summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--.gitattributes7
-rw-r--r--src/emu/audit.c15
-rw-r--r--src/emu/clifront.c10
-rw-r--r--src/emu/cpu/h6280/h6280.c4
-rw-r--r--src/emu/cpu/h6280/h6280.h4
-rw-r--r--src/emu/cpuexec.c6
-rw-r--r--src/emu/devintrf.c40
-rw-r--r--src/emu/devintrf.h1
-rw-r--r--src/emu/emu.mak1
-rw-r--r--src/emu/info.c52
-rw-r--r--src/emu/inptport.h8
-rw-r--r--src/emu/machine/laserdsc.h13
-rw-r--r--src/emu/machine/latch8.c7
-rw-r--r--src/emu/machine/latch8.h4
-rw-r--r--src/emu/machine/ldcore.c66
-rw-r--r--src/emu/machine/pcshare.h2
-rw-r--r--src/emu/machine/scsicd.c66
-rw-r--r--src/emu/mame.c6
-rw-r--r--src/emu/mconfig.c135
-rw-r--r--src/emu/mconfig.h192
-rw-r--r--src/emu/sndintrf.c442
-rw-r--r--src/emu/sndintrf.h199
-rw-r--r--src/emu/sound.c506
-rw-r--r--src/emu/sound.h126
-rw-r--r--src/emu/sound/2151intf.c195
-rw-r--r--src/emu/sound/2151intf.h40
-rw-r--r--src/emu/sound/2203intf.c251
-rw-r--r--src/emu/sound/2203intf.h62
-rw-r--r--src/emu/sound/2413intf.c118
-rw-r--r--src/emu/sound/2413intf.h26
-rw-r--r--src/emu/sound/2608intf.c197
-rw-r--r--src/emu/sound/2608intf.h40
-rw-r--r--src/emu/sound/2610intf.c419
-rw-r--r--src/emu/sound/2610intf.h61
-rw-r--r--src/emu/sound/2612intf.c328
-rw-r--r--src/emu/sound/2612intf.h83
-rw-r--r--src/emu/sound/262intf.c130
-rw-r--r--src/emu/sound/262intf.h25
-rw-r--r--src/emu/sound/3526intf.c170
-rw-r--r--src/emu/sound/3526intf.h23
-rw-r--r--src/emu/sound/3812intf.c501
-rw-r--r--src/emu/sound/3812intf.h64
-rw-r--r--src/emu/sound/5110intf.c182
-rw-r--r--src/emu/sound/5110intf.h48
-rw-r--r--src/emu/sound/5220intf.c118
-rw-r--r--src/emu/sound/5220intf.h43
-rw-r--r--src/emu/sound/8950intf.c205
-rw-r--r--src/emu/sound/8950intf.h28
-rw-r--r--src/emu/sound/aica.c138
-rw-r--r--src/emu/sound/aica.h18
-rw-r--r--src/emu/sound/astrocde.c90
-rw-r--r--src/emu/sound/astrocde.h7
-rw-r--r--src/emu/sound/ay8910.c238
-rw-r--r--src/emu/sound/ay8910.h106
-rw-r--r--src/emu/sound/beep.c62
-rw-r--r--src/emu/sound/beep.h18
-rw-r--r--src/emu/sound/bsmt2000.c97
-rw-r--r--src/emu/sound/bsmt2000.h6
-rw-r--r--src/emu/sound/c140.c65
-rw-r--r--src/emu/sound/c140.h10
-rw-r--r--src/emu/sound/c352.c68
-rw-r--r--src/emu/sound/c352.h8
-rw-r--r--src/emu/sound/c6280.c67
-rw-r--r--src/emu/sound/c6280.h9
-rw-r--r--src/emu/sound/cdda.c112
-rw-r--r--src/emu/sound/cdda.h22
-rw-r--r--src/emu/sound/cdp1869.c77
-rw-r--r--src/emu/sound/cdp1869.h20
-rw-r--r--src/emu/sound/cem3394.c59
-rw-r--r--src/emu/sound/cem3394.h8
-rw-r--r--src/emu/sound/custom.c85
-rw-r--r--src/emu/sound/custom.h24
-rw-r--r--src/emu/sound/dac.c99
-rw-r--r--src/emu/sound/dac.h20
-rw-r--r--src/emu/sound/digitalk.c70
-rw-r--r--src/emu/sound/digitalk.h14
-rw-r--r--src/emu/sound/disc_inp.c57
-rw-r--r--src/emu/sound/discrete.c48
-rw-r--r--src/emu/sound/discrete.h17
-rw-r--r--src/emu/sound/dmadac.c66
-rw-r--r--src/emu/sound/dmadac.h12
-rw-r--r--src/emu/sound/es5503.c71
-rw-r--r--src/emu/sound/es5503.h14
-rw-r--r--src/emu/sound/es5506.c295
-rw-r--r--src/emu/sound/es5506.h41
-rw-r--r--src/emu/sound/es8712.c134
-rw-r--r--src/emu/sound/es8712.h20
-rw-r--r--src/emu/sound/flt_rc.c57
-rw-r--r--src/emu/sound/flt_rc.h6
-rw-r--r--src/emu/sound/flt_vol.c52
-rw-r--r--src/emu/sound/flt_vol.h6
-rw-r--r--src/emu/sound/fm.c6
-rw-r--r--src/emu/sound/gaelco.c111
-rw-r--r--src/emu/sound/gaelco.h12
-rw-r--r--src/emu/sound/hc55516.c135
-rw-r--r--src/emu/sound/hc55516.h41
-rw-r--r--src/emu/sound/ics2115.c76
-rw-r--r--src/emu/sound/ics2115.h10
-rw-r--r--src/emu/sound/iremga20.c70
-rw-r--r--src/emu/sound/iremga20.h8
-rw-r--r--src/emu/sound/k005289.c80
-rw-r--r--src/emu/sound/k005289.h16
-rw-r--r--src/emu/sound/k007232.c103
-rw-r--r--src/emu/sound/k007232.h18
-rw-r--r--src/emu/sound/k051649.c82
-rw-r--r--src/emu/sound/k051649.h17
-rw-r--r--src/emu/sound/k053260.c133
-rw-r--r--src/emu/sound/k053260.h16
-rw-r--r--src/emu/sound/k054539.c112
-rw-r--r--src/emu/sound/k054539.h18
-rw-r--r--src/emu/sound/msm5205.c93
-rw-r--r--src/emu/sound/msm5205.h14
-rw-r--r--src/emu/sound/msm5232.c108
-rw-r--r--src/emu/sound/msm5232.h11
-rw-r--r--src/emu/sound/multipcm.c88
-rw-r--r--src/emu/sound/multipcm.h12
-rw-r--r--src/emu/sound/n63701x.c56
-rw-r--r--src/emu/sound/n63701x.h6
-rw-r--r--src/emu/sound/namco.c160
-rw-r--r--src/emu/sound/namco.h30
-rw-r--r--src/emu/sound/namco52.c64
-rw-r--r--src/emu/sound/namco52.h6
-rw-r--r--src/emu/sound/nes_apu.c78
-rw-r--r--src/emu/sound/nes_apu.h10
-rw-r--r--src/emu/sound/nile.c65
-rw-r--r--src/emu/sound/nile.h12
-rw-r--r--src/emu/sound/okim6258.c186
-rw-r--r--src/emu/sound/okim6258.h36
-rw-r--r--src/emu/sound/okim6295.c199
-rw-r--r--src/emu/sound/okim6295.h30
-rw-r--r--src/emu/sound/okim6376.c189
-rw-r--r--src/emu/sound/okim6376.h24
-rw-r--r--src/emu/sound/pokey.c374
-rw-r--r--src/emu/sound/pokey.h45
-rw-r--r--src/emu/sound/psx.c70
-rw-r--r--src/emu/sound/psx.h14
-rw-r--r--src/emu/sound/qsound.c96
-rw-r--r--src/emu/sound/qsound.h10
-rw-r--r--src/emu/sound/rf5c400.c71
-rw-r--r--src/emu/sound/rf5c400.h8
-rw-r--r--src/emu/sound/rf5c68.c71
-rw-r--r--src/emu/sound/rf5c68.h10
-rw-r--r--src/emu/sound/s14001a.c61
-rw-r--r--src/emu/sound/s14001a.h14
-rw-r--r--src/emu/sound/saa1099.c118
-rw-r--r--src/emu/sound/saa1099.h15
-rw-r--r--src/emu/sound/samples.c125
-rw-r--r--src/emu/sound/samples.h32
-rw-r--r--src/emu/sound/scsp.c109
-rw-r--r--src/emu/sound/scsp.h18
-rw-r--r--src/emu/sound/segapcm.c58
-rw-r--r--src/emu/sound/segapcm.h8
-rw-r--r--src/emu/sound/sid6581.c59
-rw-r--r--src/emu/sound/sid6581.h8
-rw-r--r--src/emu/sound/sn76477.c276
-rw-r--r--src/emu/sound/sn76477.h62
-rw-r--r--src/emu/sound/sn76496.c137
-rw-r--r--src/emu/sound/sn76496.h30
-rw-r--r--src/emu/sound/snkwave.c56
-rw-r--r--src/emu/sound/snkwave.h6
-rw-r--r--src/emu/sound/sound.mak13
-rw-r--r--src/emu/sound/sp0250.c76
-rw-r--r--src/emu/sound/sp0250.h10
-rw-r--r--src/emu/sound/sp0256.c79
-rw-r--r--src/emu/sound/sp0256.h10
-rw-r--r--src/emu/sound/speaker.c52
-rw-r--r--src/emu/sound/speaker.h6
-rw-r--r--src/emu/sound/st0016.c80
-rw-r--r--src/emu/sound/st0016.h9
-rw-r--r--src/emu/sound/tiaintf.c60
-rw-r--r--src/emu/sound/tiaintf.h6
-rw-r--r--src/emu/sound/tms3615.c58
-rw-r--r--src/emu/sound/tms3615.h6
-rw-r--r--src/emu/sound/tms36xx.c70
-rw-r--r--src/emu/sound/tms36xx.h10
-rw-r--r--src/emu/sound/tms5110.c6
-rw-r--r--src/emu/sound/tms5110.h2
-rw-r--r--src/emu/sound/tms5220.c38
-rw-r--r--src/emu/sound/tms5220.h8
-rw-r--r--src/emu/sound/upd7759.c124
-rw-r--r--src/emu/sound/upd7759.h20
-rw-r--r--src/emu/sound/vlm5030.c90
-rw-r--r--src/emu/sound/vlm5030.h16
-rw-r--r--src/emu/sound/votrax.c58
-rw-r--r--src/emu/sound/votrax.h8
-rw-r--r--src/emu/sound/vrender0.c64
-rw-r--r--src/emu/sound/vrender0.h10
-rw-r--r--src/emu/sound/wave.c32
-rw-r--r--src/emu/sound/wave.h4
-rw-r--r--src/emu/sound/x1_010.c84
-rw-r--r--src/emu/sound/x1_010.h14
-rw-r--r--src/emu/sound/ym2151.c28
-rw-r--r--src/emu/sound/ym2151.h4
-rw-r--r--src/emu/sound/ymf271.c113
-rw-r--r--src/emu/sound/ymf271.h18
-rw-r--r--src/emu/sound/ymf278b.c221
-rw-r--r--src/emu/sound/ymf278b.h25
-rw-r--r--src/emu/sound/ymz280b.c257
-rw-r--r--src/emu/sound/ymz280b.h36
-rw-r--r--src/emu/streams.c104
-rw-r--r--src/emu/streams.h26
-rw-r--r--src/emu/ui.c33
-rw-r--r--src/emu/validity.c97
-rw-r--r--src/emu/video/cdp1869.c16
-rw-r--r--src/ldplayer/ldplayer.c3
-rw-r--r--src/mame/audio/8080bw.c246
-rw-r--r--src/mame/audio/amiga.c27
-rw-r--r--src/mame/audio/asteroid.c24
-rw-r--r--src/mame/audio/astrof.c28
-rw-r--r--src/mame/audio/atarijsa.c120
-rw-r--r--src/mame/audio/attckufo.c19
-rw-r--r--src/mame/audio/avalnche.c16
-rw-r--r--src/mame/audio/blockade.c7
-rw-r--r--src/mame/audio/bsktball.c14
-rw-r--r--src/mame/audio/bzone.c19
-rw-r--r--src/mame/audio/cage.c22
-rw-r--r--src/mame/audio/canyon.c16
-rw-r--r--src/mame/audio/carnival.c40
-rw-r--r--src/mame/audio/cchasm.c102
-rw-r--r--src/mame/audio/cclimber.c13
-rw-r--r--src/mame/audio/cinemat.c327
-rw-r--r--src/mame/audio/circus.c37
-rw-r--r--src/mame/audio/cps3.c21
-rw-r--r--src/mame/audio/crbaloon.c24
-rw-r--r--src/mame/audio/cyberbal.c6
-rw-r--r--src/mame/audio/dcs.c32
-rw-r--r--src/mame/audio/depthch.c15
-rw-r--r--src/mame/audio/dkong.c52
-rw-r--r--src/mame/audio/exidy.c128
-rw-r--r--src/mame/audio/exidy440.c42
-rw-r--r--src/mame/audio/fghtbskt.c5
-rw-r--r--src/mame/audio/firetrk.c34
-rw-r--r--src/mame/audio/flower.c23
-rw-r--r--src/mame/audio/galaxian.c52
-rw-r--r--src/mame/audio/geebee.c19
-rw-r--r--src/mame/audio/gomoku.c23
-rw-r--r--src/mame/audio/gorf.c15
-rw-r--r--src/mame/audio/gottlieb.c82
-rw-r--r--src/mame/audio/gotya.c5
-rw-r--r--src/mame/audio/gridlee.c32
-rw-r--r--src/mame/audio/harddriv.c4
-rw-r--r--src/mame/audio/invinco.c17
-rw-r--r--src/mame/audio/irem.c82
-rw-r--r--src/mame/audio/jaguar.c4
-rw-r--r--src/mame/audio/jedi.c15
-rw-r--r--src/mame/audio/laserbat.c23
-rw-r--r--src/mame/audio/leland.c72
-rw-r--r--src/mame/audio/llander.c14
-rw-r--r--src/mame/audio/m72.c12
-rw-r--r--src/mame/audio/m72.h4
-rw-r--r--src/mame/audio/mario.c28
-rw-r--r--src/mame/audio/mcr.c128
-rw-r--r--src/mame/audio/meadows.c27
-rw-r--r--src/mame/audio/mw8080bw.c253
-rw-r--r--src/mame/audio/n8080.c65
-rw-r--r--src/mame/audio/namco54.c14
-rw-r--r--src/mame/audio/namcoc7x.c4
-rw-r--r--src/mame/audio/orbit.c20
-rw-r--r--src/mame/audio/phoenix.c37
-rw-r--r--src/mame/audio/pleiads.c61
-rw-r--r--src/mame/audio/polepos.c22
-rw-r--r--src/mame/audio/polyplay.c22
-rw-r--r--src/mame/audio/poolshrk.c16
-rw-r--r--src/mame/audio/pulsar.c36
-rw-r--r--src/mame/audio/qix.c12
-rw-r--r--src/mame/audio/redalert.c48
-rw-r--r--src/mame/audio/redbaron.c23
-rw-r--r--src/mame/audio/rockola.c58
-rw-r--r--src/mame/audio/scramble.c68
-rw-r--r--src/mame/audio/segag80r.c139
-rw-r--r--src/mame/audio/segag80v.c105
-rw-r--r--src/mame/audio/segasnd.c38
-rw-r--r--src/mame/audio/seibu.c159
-rw-r--r--src/mame/audio/seibu.h23
-rw-r--r--src/mame/audio/senjyo.c11
-rw-r--r--src/mame/audio/snes.c16
-rw-r--r--src/mame/audio/spacefb.c10
-rw-r--r--src/mame/audio/spiders.c17
-rw-r--r--src/mame/audio/starwars.c8
-rw-r--r--src/mame/audio/subs.c20
-rw-r--r--src/mame/audio/suna8.c8
-rw-r--r--src/mame/audio/t5182.c9
-rw-r--r--src/mame/audio/taito_en.c6
-rw-r--r--src/mame/audio/targ.c39
-rw-r--r--src/mame/audio/tiamc1.c19
-rw-r--r--src/mame/audio/timeplt.c44
-rw-r--r--src/mame/audio/toaplan2.c40
-rw-r--r--src/mame/audio/trackfld.c22
-rw-r--r--src/mame/audio/turbo.c148
-rw-r--r--src/mame/audio/tx1.c76
-rw-r--r--src/mame/audio/vicdual.c63
-rw-r--r--src/mame/audio/warpwarp.c20
-rw-r--r--src/mame/audio/williams.c62
-rw-r--r--src/mame/audio/wiping.c24
-rw-r--r--src/mame/audio/wow.c15
-rw-r--r--src/mame/audio/zaxxon.c61
-rw-r--r--src/mame/drivers/1942.c6
-rw-r--r--src/mame/drivers/1943.c6
-rw-r--r--src/mame/drivers/1945kiii.c8
-rw-r--r--src/mame/drivers/20pacgal.c12
-rw-r--r--src/mame/drivers/2mindril.c9
-rw-r--r--src/mame/drivers/40love.c45
-rw-r--r--src/mame/drivers/4enraya.c11
-rw-r--r--src/mame/drivers/4roses.c8
-rw-r--r--src/mame/drivers/8080bw.c12
-rw-r--r--src/mame/drivers/86lions.c11
-rw-r--r--src/mame/drivers/88games.c19
-rw-r--r--src/mame/drivers/acommand.c12
-rw-r--r--src/mame/drivers/actfancr.c12
-rw-r--r--src/mame/drivers/adp.c10
-rw-r--r--src/mame/drivers/aeroboto.c18
-rw-r--r--src/mame/drivers/aerofgt.c41
-rw-r--r--src/mame/drivers/airbustr.c13
-rw-r--r--src/mame/drivers/ajax.c29
-rw-r--r--src/mame/drivers/aleck64.c1
-rw-r--r--src/mame/drivers/alg.c19
-rw-r--r--src/mame/drivers/aliens.c15
-rw-r--r--src/mame/drivers/alpha68k.c41
-rw-r--r--src/mame/drivers/ambush.c24
-rw-r--r--src/mame/drivers/ampoker2.c7
-rw-r--r--src/mame/drivers/amspdwy.c13
-rw-r--r--src/mame/drivers/angelkds.c12
-rw-r--r--src/mame/drivers/appoooh.c15
-rw-r--r--src/mame/drivers/aquarium.c19
-rw-r--r--src/mame/drivers/arabian.c16
-rw-r--r--src/mame/drivers/arcadecl.c24
-rw-r--r--src/mame/drivers/arcadia.c17
-rw-r--r--src/mame/drivers/argus.c17
-rw-r--r--src/mame/drivers/aristmk5.c2
-rw-r--r--src/mame/drivers/arkanoid.c16
-rw-r--r--src/mame/drivers/armedf.c7
-rw-r--r--src/mame/drivers/artmagic.c6
-rw-r--r--src/mame/drivers/ashnojoe.c27
-rw-r--r--src/mame/drivers/asterix.c12
-rw-r--r--src/mame/drivers/asteroid.c30
-rw-r--r--src/mame/drivers/astinvad.c44
-rw-r--r--src/mame/drivers/astrocde.c66
-rw-r--r--src/mame/drivers/astrocorp.c12
-rw-r--r--src/mame/drivers/asuka.c38
-rw-r--r--src/mame/drivers/atarisy1.c18
-rw-r--r--src/mame/drivers/atarisy2.c26
-rw-r--r--src/mame/drivers/ataxx.c17
-rw-r--r--src/mame/drivers/atetris.c18
-rw-r--r--src/mame/drivers/attckufo.c8
-rw-r--r--src/mame/drivers/avalnche.c6
-rw-r--r--src/mame/drivers/aztarac.c12
-rw-r--r--src/mame/drivers/backfire.c18
-rw-r--r--src/mame/drivers/badlands.c3
-rw-r--r--src/mame/drivers/bagman.c88
-rw-r--r--src/mame/drivers/bankp.c6
-rw-r--r--src/mame/drivers/baraduke.c4
-rw-r--r--src/mame/drivers/battlane.c9
-rw-r--r--src/mame/drivers/battlera.c22
-rw-r--r--src/mame/drivers/battlex.c3
-rw-r--r--src/mame/drivers/battlnts.c6
-rw-r--r--src/mame/drivers/bbusters.c16
-rw-r--r--src/mame/drivers/berzerk.c29
-rw-r--r--src/mame/drivers/bestleag.c8
-rw-r--r--src/mame/drivers/bfcobra.c18
-rw-r--r--src/mame/drivers/bfm_sc2.c72
-rw-r--r--src/mame/drivers/big10.c25
-rw-r--r--src/mame/drivers/bigevglf.c5
-rw-r--r--src/mame/drivers/bigfghtr.c7
-rw-r--r--src/mame/drivers/bigstrkb.c4
-rw-r--r--src/mame/drivers/bingoc.c13
-rw-r--r--src/mame/drivers/bionicc.c3
-rw-r--r--src/mame/drivers/bishi.c25
-rw-r--r--src/mame/drivers/bishjan.c11
-rw-r--r--src/mame/drivers/bking.c18
-rw-r--r--src/mame/drivers/bladestl.c29
-rw-r--r--src/mame/drivers/blktiger.c12
-rw-r--r--src/mame/drivers/blmbycar.c4
-rw-r--r--src/mame/drivers/blockade.c2
-rw-r--r--src/mame/drivers/blockhl.c3
-rw-r--r--src/mame/drivers/blockout.c9
-rw-r--r--src/mame/drivers/blueprnt.c28
-rw-r--r--src/mame/drivers/bmcbowl.c24
-rw-r--r--src/mame/drivers/bogeyman.c16
-rw-r--r--src/mame/drivers/bombjack.c9
-rw-r--r--src/mame/drivers/boogwing.c16
-rw-r--r--src/mame/drivers/bottom9.c20
-rw-r--r--src/mame/drivers/brasil.c10
-rw-r--r--src/mame/drivers/brkthru.c13
-rw-r--r--src/mame/drivers/bsktball.c6
-rw-r--r--src/mame/drivers/btime.c22
-rw-r--r--src/mame/drivers/btoads.c8
-rw-r--r--src/mame/drivers/bublbobl.c17
-rw-r--r--src/mame/drivers/buggychl.c32
-rw-r--r--src/mame/drivers/bwidow.c16
-rw-r--r--src/mame/drivers/bwing.c10
-rw-r--r--src/mame/drivers/bzone.c35
-rw-r--r--src/mame/drivers/cabal.c47
-rw-r--r--src/mame/drivers/cabaret.c3
-rw-r--r--src/mame/drivers/calomega.c30
-rw-r--r--src/mame/drivers/calorie.c8
-rw-r--r--src/mame/drivers/canyon.c8
-rw-r--r--src/mame/drivers/capbowl.c17
-rw-r--r--src/mame/drivers/cardline.c2
-rw-r--r--src/mame/drivers/carjmbre.c6
-rw-r--r--src/mame/drivers/carrera.c15
-rw-r--r--src/mame/drivers/caswin.c23
-rw-r--r--src/mame/drivers/cave.c116
-rw-r--r--src/mame/drivers/cbasebal.c5
-rw-r--r--src/mame/drivers/cbuster.c44
-rw-r--r--src/mame/drivers/ccastles.c8
-rw-r--r--src/mame/drivers/cchance.c22
-rw-r--r--src/mame/drivers/cchasm.c10
-rw-r--r--src/mame/drivers/cclimber.c17
-rw-r--r--src/mame/drivers/centiped.c63
-rw-r--r--src/mame/drivers/chaknpop.c34
-rw-r--r--src/mame/drivers/cham24.c18
-rw-r--r--src/mame/drivers/champbas.c36
-rw-r--r--src/mame/drivers/champbwl.c2
-rw-r--r--src/mame/drivers/chanbara.c21
-rw-r--r--src/mame/drivers/changela.c26
-rw-r--r--src/mame/drivers/chinagat.c47
-rw-r--r--src/mame/drivers/chinsan.c15
-rw-r--r--src/mame/drivers/chqflag.c39
-rw-r--r--src/mame/drivers/cidelsa.c24
-rw-r--r--src/mame/drivers/circusc.c17
-rw-r--r--src/mame/drivers/cischeat.c96
-rw-r--r--src/mame/drivers/citycon.c18
-rw-r--r--src/mame/drivers/cliffhgr.c19
-rw-r--r--src/mame/drivers/cloak.c12
-rw-r--r--src/mame/drivers/cloud9.c8
-rw-r--r--src/mame/drivers/clshroad.c19
-rw-r--r--src/mame/drivers/cninja.c49
-rw-r--r--src/mame/drivers/cntsteer.c8
-rw-r--r--src/mame/drivers/coinmstr.c24
-rw-r--r--src/mame/drivers/combatsc.c51
-rw-r--r--src/mame/drivers/commando.c6
-rw-r--r--src/mame/drivers/compgolf.c21
-rw-r--r--src/mame/drivers/contra.c5
-rw-r--r--src/mame/drivers/coolpool.c6
-rw-r--r--src/mame/drivers/coolridr.c4
-rw-r--r--src/mame/drivers/cop01.c14
-rw-r--r--src/mame/drivers/cosmic.c142
-rw-r--r--src/mame/drivers/cowrace.c9
-rw-r--r--src/mame/drivers/cps1.c25
-rw-r--r--src/mame/drivers/cps3.c11
-rw-r--r--src/mame/drivers/crbaloon.c24
-rw-r--r--src/mame/drivers/crgolf.c16
-rw-r--r--src/mame/drivers/crimfght.c19
-rw-r--r--src/mame/drivers/crospang.c9
-rw-r--r--src/mame/drivers/crshrace.c9
-rw-r--r--src/mame/drivers/crystal.c4
-rw-r--r--src/mame/drivers/cshooter.c13
-rw-r--r--src/mame/drivers/cubeqst.c17
-rw-r--r--src/mame/drivers/cubocd32.c13
-rw-r--r--src/mame/drivers/cultures.c2
-rw-r--r--src/mame/drivers/cvs.c54
-rw-r--r--src/mame/drivers/cyberbal.c3
-rw-r--r--src/mame/drivers/cybertnk.c9
-rw-r--r--src/mame/drivers/dacholer.c11
-rw-r--r--src/mame/drivers/darius.c144
-rw-r--r--src/mame/drivers/darkhors.c15
-rw-r--r--src/mame/drivers/darkseal.c44
-rw-r--r--src/mame/drivers/dassault.c24
-rw-r--r--src/mame/drivers/dblewing.c10
-rw-r--r--src/mame/drivers/dbz.c15
-rw-r--r--src/mame/drivers/dcheese.c8
-rw-r--r--src/mame/drivers/dday.c18
-rw-r--r--src/mame/drivers/ddayjlc.c16
-rw-r--r--src/mame/drivers/ddealer.c10
-rw-r--r--src/mame/drivers/ddenlovr.c318
-rw-r--r--src/mame/drivers/ddragon.c25
-rw-r--r--src/mame/drivers/ddragon3.c28
-rw-r--r--src/mame/drivers/ddrible.c48
-rw-r--r--src/mame/drivers/dec0.c56
-rw-r--r--src/mame/drivers/dec8.c41
-rw-r--r--src/mame/drivers/deco156.c51
-rw-r--r--src/mame/drivers/deco32.c61
-rw-r--r--src/mame/drivers/deco_mlc.c27
-rw-r--r--src/mame/drivers/decocass.c8
-rw-r--r--src/mame/drivers/deniam.c47
-rw-r--r--src/mame/drivers/dietgo.c24
-rw-r--r--src/mame/drivers/discoboy.c5
-rw-r--r--src/mame/drivers/diverboy.c10
-rw-r--r--src/mame/drivers/djboy.c7
-rw-r--r--src/mame/drivers/djmain.c34
-rw-r--r--src/mame/drivers/dlair.c24
-rw-r--r--src/mame/drivers/dmndrby.c5
-rw-r--r--src/mame/drivers/docastle.c40
-rw-r--r--src/mame/drivers/dogfgt.c17
-rw-r--r--src/mame/drivers/dominob.c12
-rw-r--r--src/mame/drivers/dooyong.c43
-rw-r--r--src/mame/drivers/dragrace.c32
-rw-r--r--src/mame/drivers/dreamwld.c38
-rw-r--r--src/mame/drivers/drgnmst.c12
-rw-r--r--src/mame/drivers/drmicro.c14
-rw-r--r--src/mame/drivers/drtomy.c8
-rw-r--r--src/mame/drivers/drw80pkr.c9
-rw-r--r--src/mame/drivers/dunhuang.c30
-rw-r--r--src/mame/drivers/dwarfd.c13
-rw-r--r--src/mame/drivers/dynadice.c8
-rw-r--r--src/mame/drivers/dynax.c170
-rw-r--r--src/mame/drivers/egghunt.c12
-rw-r--r--src/mame/drivers/enigma2.c19
-rw-r--r--src/mame/drivers/eolith16.c2
-rw-r--r--src/mame/drivers/epos.c4
-rw-r--r--src/mame/drivers/equites.c71
-rw-r--r--src/mame/drivers/esd16.c5
-rw-r--r--src/mame/drivers/esh.c3
-rw-r--r--src/mame/drivers/espial.c3
-rw-r--r--src/mame/drivers/esripsys.c16
-rw-r--r--src/mame/drivers/ettrivia.c34
-rw-r--r--src/mame/drivers/exedexes.c7
-rw-r--r--src/mame/drivers/exerion.c22
-rw-r--r--src/mame/drivers/expro02.c4
-rw-r--r--src/mame/drivers/exprraid.c12
-rw-r--r--src/mame/drivers/exterm.c15
-rw-r--r--src/mame/drivers/exzisus.c10
-rw-r--r--src/mame/drivers/f-32.c35
-rw-r--r--src/mame/drivers/f1gp.c11
-rw-r--r--src/mame/drivers/fantland.c47
-rw-r--r--src/mame/drivers/fastfred.c9
-rw-r--r--src/mame/drivers/fastlane.c38
-rw-r--r--src/mame/drivers/fcombat.c15
-rw-r--r--src/mame/drivers/fcrash.c14
-rw-r--r--src/mame/drivers/feversoc.c4
-rw-r--r--src/mame/drivers/finalizr.c4
-rw-r--r--src/mame/drivers/findout.c2
-rw-r--r--src/mame/drivers/firebeat.c44
-rw-r--r--src/mame/drivers/firefox.c24
-rw-r--r--src/mame/drivers/firetrap.c9
-rw-r--r--src/mame/drivers/firetrk.c55
-rw-r--r--src/mame/drivers/flkatck.c17
-rw-r--r--src/mame/drivers/flower.c8
-rw-r--r--src/mame/drivers/flstory.c45
-rw-r--r--src/mame/drivers/foodf.c37
-rw-r--r--src/mame/drivers/forte2.c19
-rw-r--r--src/mame/drivers/fortecar.c16
-rw-r--r--src/mame/drivers/freekick.c24
-rw-r--r--src/mame/drivers/fromanc2.c9
-rw-r--r--src/mame/drivers/fromance.c21
-rw-r--r--src/mame/drivers/funkybee.c13
-rw-r--r--src/mame/drivers/funkyjet.c12
-rw-r--r--src/mame/drivers/funworld.c32
-rw-r--r--src/mame/drivers/funybubl.c10
-rw-r--r--src/mame/drivers/fuukifg2.c20
-rw-r--r--src/mame/drivers/fuukifg3.c33
-rw-r--r--src/mame/drivers/gaelco.c19
-rw-r--r--src/mame/drivers/gaelco2.c24
-rw-r--r--src/mame/drivers/gaelco3d.c20
-rw-r--r--src/mame/drivers/gaiden.c21
-rw-r--r--src/mame/drivers/galaga.c20
-rw-r--r--src/mame/drivers/galaxi.c2
-rw-r--r--src/mame/drivers/galaxian.c170
-rw-r--r--src/mame/drivers/galaxold.c36
-rw-r--r--src/mame/drivers/galdrvr.c23
-rw-r--r--src/mame/drivers/galivan.c9
-rw-r--r--src/mame/drivers/galpani2.c12
-rw-r--r--src/mame/drivers/galpani3.c3
-rw-r--r--src/mame/drivers/galpanic.c32
-rw-r--r--src/mame/drivers/galspnbl.c9
-rw-r--r--src/mame/drivers/gameplan.c16
-rw-r--r--src/mame/drivers/gaplus.c10
-rw-r--r--src/mame/drivers/gatron.c4
-rw-r--r--src/mame/drivers/gauntlet.c14
-rw-r--r--src/mame/drivers/gberet.c6
-rw-r--r--src/mame/drivers/gbusters.c21
-rw-r--r--src/mame/drivers/gcpinbal.c4
-rw-r--r--src/mame/drivers/genesis.c69
-rw-r--r--src/mame/drivers/getrivia.c4
-rw-r--r--src/mame/drivers/gijoe.c8
-rw-r--r--src/mame/drivers/ginganin.c8
-rw-r--r--src/mame/drivers/gladiatr.c51
-rw-r--r--src/mame/drivers/glass.c4
-rw-r--r--src/mame/drivers/gng.c6
-rw-r--r--src/mame/drivers/goal92.c24
-rw-r--r--src/mame/drivers/goindol.c3
-rw-r--r--src/mame/drivers/goldnpkr.c6
-rw-r--r--src/mame/drivers/goldstar.c78
-rw-r--r--src/mame/drivers/gomoku.c9
-rw-r--r--src/mame/drivers/good.c2
-rw-r--r--src/mame/drivers/gotcha.c17
-rw-r--r--src/mame/drivers/gottlieb.c4
-rw-r--r--src/mame/drivers/gpworld.c3
-rw-r--r--src/mame/drivers/gradius3.c17
-rw-r--r--src/mame/drivers/grchamp.c55
-rw-r--r--src/mame/drivers/gridlee.c10
-rw-r--r--src/mame/drivers/gstream.c13
-rw-r--r--src/mame/drivers/gstriker.c11
-rw-r--r--src/mame/drivers/gsword.c48
-rw-r--r--src/mame/drivers/gticlub.c2
-rw-r--r--src/mame/drivers/guab.c2
-rw-r--r--src/mame/drivers/gumbo.c12
-rw-r--r--src/mame/drivers/gundealr.c3
-rw-r--r--src/mame/drivers/gunsmoke.c6
-rw-r--r--src/mame/drivers/gyruss.c124
-rw-r--r--src/mame/drivers/halleys.c25
-rw-r--r--src/mame/drivers/hanaawas.c14
-rw-r--r--src/mame/drivers/hanaroku.c13
-rw-r--r--src/mame/drivers/harddriv.c2
-rw-r--r--src/mame/drivers/hcastle.c33
-rw-r--r--src/mame/drivers/hexa.c13
-rw-r--r--src/mame/drivers/hexion.c10
-rw-r--r--src/mame/drivers/higemaru.c6
-rw-r--r--src/mame/drivers/highvdeo.c24
-rw-r--r--src/mame/drivers/himesiki.c3
-rw-r--r--src/mame/drivers/hitme.c24
-rw-r--r--src/mame/drivers/hnayayoi.c68
-rw-r--r--src/mame/drivers/holeland.c24
-rw-r--r--src/mame/drivers/homedata.c30
-rw-r--r--src/mame/drivers/homerun.c13
-rw-r--r--src/mame/drivers/hornet.c2
-rw-r--r--src/mame/drivers/hotblock.c12
-rw-r--r--src/mame/drivers/hyhoo.c19
-rw-r--r--src/mame/drivers/hyperspt.c12
-rw-r--r--src/mame/drivers/hyprduel.c22
-rw-r--r--src/mame/drivers/igs009.c5
-rw-r--r--src/mame/drivers/igs017.c7
-rw-r--r--src/mame/drivers/igs_blit.c62
-rw-r--r--src/mame/drivers/igspoker.c5
-rw-r--r--src/mame/drivers/ikki.c4
-rw-r--r--src/mame/drivers/imolagp.c4
-rw-r--r--src/mame/drivers/inufuku.c9
-rw-r--r--src/mame/drivers/iqblock.c3
-rw-r--r--src/mame/drivers/irobot.c4
-rw-r--r--src/mame/drivers/ironhors.c25
-rw-r--r--src/mame/drivers/istellar.c3
-rw-r--r--src/mame/drivers/itech32.c5
-rw-r--r--src/mame/drivers/itech8.c44
-rw-r--r--src/mame/drivers/jack.c12
-rw-r--r--src/mame/drivers/jackal.c3
-rw-r--r--src/mame/drivers/jackie.c3
-rw-r--r--src/mame/drivers/jackpool.c2
-rw-r--r--src/mame/drivers/jailbrek.c18
-rw-r--r--src/mame/drivers/jalmah.c4
-rw-r--r--src/mame/drivers/jangou.c42
-rw-r--r--src/mame/drivers/jantotsu.c16
-rw-r--r--src/mame/drivers/jchan.c3
-rw-r--r--src/mame/drivers/jollyjgr.c4
-rw-r--r--src/mame/drivers/jongkyo.c53
-rw-r--r--src/mame/drivers/jpmimpct.c24
-rw-r--r--src/mame/drivers/jpmsys5.c23
-rw-r--r--src/mame/drivers/jrpacman.c4
-rw-r--r--src/mame/drivers/junofrst.c25
-rw-r--r--src/mame/drivers/kaneko16.c165
-rw-r--r--src/mame/drivers/kangaroo.c10
-rw-r--r--src/mame/drivers/karnov.c12
-rw-r--r--src/mame/drivers/kchamp.c25
-rw-r--r--src/mame/drivers/kickgoal.c128
-rw-r--r--src/mame/drivers/kingobox.c14
-rw-r--r--src/mame/drivers/klax.c24
-rw-r--r--src/mame/drivers/kncljoe.c40
-rw-r--r--src/mame/drivers/koftball.c2
-rw-r--r--src/mame/drivers/koikoi.c16
-rw-r--r--src/mame/drivers/konamigq.c8
-rw-r--r--src/mame/drivers/konamigv.c13
-rw-r--r--src/mame/drivers/konamigx.c15
-rw-r--r--src/mame/drivers/ksayakyu.c26
-rw-r--r--src/mame/drivers/ksys573.c13
-rw-r--r--src/mame/drivers/kyugo.c24
-rw-r--r--src/mame/drivers/labyrunr.c28
-rw-r--r--src/mame/drivers/ladybug.c14
-rw-r--r--src/mame/drivers/ladyfrog.c15
-rw-r--r--src/mame/drivers/laserbat.c23
-rw-r--r--src/mame/drivers/lasso.c16
-rw-r--r--src/mame/drivers/lastduel.c28
-rw-r--r--src/mame/drivers/lazercmd.c12
-rw-r--r--src/mame/drivers/legionna.c4
-rw-r--r--src/mame/drivers/leland.c36
-rw-r--r--src/mame/drivers/lemmings.c13
-rw-r--r--src/mame/drivers/lethal.c6
-rw-r--r--src/mame/drivers/lethalj.c6
-rw-r--r--src/mame/drivers/lgp.c3
-rw-r--r--src/mame/drivers/liberate.c16
-rw-r--r--src/mame/drivers/liberatr.c16
-rw-r--r--src/mame/drivers/limenko.c4
-rw-r--r--src/mame/drivers/lkage.c16
-rw-r--r--src/mame/drivers/lockon.c29
-rw-r--r--src/mame/drivers/looping.c40
-rw-r--r--src/mame/drivers/lordgun.c24
-rw-r--r--src/mame/drivers/lsasquad.c29
-rw-r--r--src/mame/drivers/ltcasino.c5
-rw-r--r--src/mame/drivers/lucky74.c30
-rw-r--r--src/mame/drivers/lvcards.c16
-rw-r--r--src/mame/drivers/lwings.c20
-rw-r--r--src/mame/drivers/m10.c45
-rw-r--r--src/mame/drivers/m107.c11
-rw-r--r--src/mame/drivers/m63.c17
-rw-r--r--src/mame/drivers/m72.c49
-rw-r--r--src/mame/drivers/m90.c10
-rw-r--r--src/mame/drivers/m92.c11
-rw-r--r--src/mame/drivers/macrossp.c20
-rw-r--r--src/mame/drivers/macs.c2
-rw-r--r--src/mame/drivers/madalien.c19
-rw-r--r--src/mame/drivers/madmotor.c44
-rw-r--r--src/mame/drivers/magic10.c10
-rw-r--r--src/mame/drivers/magicard.c3
-rw-r--r--src/mame/drivers/magicfly.c2
-rw-r--r--src/mame/drivers/magmax.c42
-rw-r--r--src/mame/drivers/mainevt.c43
-rw-r--r--src/mame/drivers/mainsnk.c6
-rw-r--r--src/mame/drivers/mappy.c31
-rw-r--r--src/mame/drivers/marineb.c15
-rw-r--r--src/mame/drivers/mario.c4
-rw-r--r--src/mame/drivers/markham.c4
-rw-r--r--src/mame/drivers/mastboy.c22
-rw-r--r--src/mame/drivers/matmania.c25
-rw-r--r--src/mame/drivers/maxaflex.c8
-rw-r--r--src/mame/drivers/mayumi.c11
-rw-r--r--src/mame/drivers/mazerbla.c28
-rw-r--r--src/mame/drivers/mcatadv.c20
-rw-r--r--src/mame/drivers/mcr.c8
-rw-r--r--src/mame/drivers/meadows.c2
-rw-r--r--src/mame/drivers/mediagx.c16
-rw-r--r--src/mame/drivers/megadriv.c84
-rw-r--r--src/mame/drivers/megaplay.c2
-rw-r--r--src/mame/drivers/megasys1.c74
-rw-r--r--src/mame/drivers/megatech.c2
-rw-r--r--src/mame/drivers/megazone.c25
-rw-r--r--src/mame/drivers/meijinsn.c6
-rw-r--r--src/mame/drivers/merit.c18
-rw-r--r--src/mame/drivers/meritm.c23
-rw-r--r--src/mame/drivers/mermaid.c8
-rw-r--r--src/mame/drivers/metlclsh.c14
-rw-r--r--src/mame/drivers/metro.c162
-rw-r--r--src/mame/drivers/mexico86.c21
-rw-r--r--src/mame/drivers/mhavoc.c31
-rw-r--r--src/mame/drivers/micro3d.c20
-rw-r--r--src/mame/drivers/midas.c5
-rw-r--r--src/mame/drivers/midyunit.c8
-rw-r--r--src/mame/drivers/mikie.c4
-rw-r--r--src/mame/drivers/mil4000.c2
-rw-r--r--src/mame/drivers/mirage.c4
-rw-r--r--src/mame/drivers/mirax.c22
-rw-r--r--src/mame/drivers/missb2.c11
-rw-r--r--src/mame/drivers/missile.c8
-rw-r--r--src/mame/drivers/mitchell.c24
-rw-r--r--src/mame/drivers/mjkjidai.c36
-rw-r--r--src/mame/drivers/mjsister.c16
-rw-r--r--src/mame/drivers/mlanding.c27
-rw-r--r--src/mame/drivers/model1.c66
-rw-r--r--src/mame/drivers/model2.c76
-rw-r--r--src/mame/drivers/model3.c12
-rw-r--r--src/mame/drivers/mogura.c8
-rw-r--r--src/mame/drivers/mole.c3
-rw-r--r--src/mame/drivers/momoko.c20
-rw-r--r--src/mame/drivers/moo.c19
-rw-r--r--src/mame/drivers/mosaic.c14
-rw-r--r--src/mame/drivers/mouser.c6
-rw-r--r--src/mame/drivers/mpu4.c12
-rw-r--r--src/mame/drivers/mpu4drvr.c8
-rw-r--r--src/mame/drivers/mquake.c41
-rw-r--r--src/mame/drivers/mrdo.c4
-rw-r--r--src/mame/drivers/mrflea.c83
-rw-r--r--src/mame/drivers/mrjong.c4
-rw-r--r--src/mame/drivers/ms32.c4
-rw-r--r--src/mame/drivers/msisaac.c28
-rw-r--r--src/mame/drivers/mugsmash.c13
-rw-r--r--src/mame/drivers/multigam.c24
-rw-r--r--src/mame/drivers/munchmo.c8
-rw-r--r--src/mame/drivers/mw8080bw.c60
-rw-r--r--src/mame/drivers/mwarr.c10
-rw-r--r--src/mame/drivers/mystston.c10
-rw-r--r--src/mame/drivers/mystwarr.c40
-rw-r--r--src/mame/drivers/namcona1.c18
-rw-r--r--src/mame/drivers/namconb1.c2
-rw-r--r--src/mame/drivers/namcond1.c2
-rw-r--r--src/mame/drivers/namcos1.c21
-rw-r--r--src/mame/drivers/namcos12.c2
-rw-r--r--src/mame/drivers/namcos2.c13
-rw-r--r--src/mame/drivers/namcos21.c9
-rw-r--r--src/mame/drivers/namcos22.c4
-rw-r--r--src/mame/drivers/namcos23.c2
-rw-r--r--src/mame/drivers/namcos86.c10
-rw-r--r--src/mame/drivers/naomi.c12
-rw-r--r--src/mame/drivers/naughtyb.c17
-rw-r--r--src/mame/drivers/nbmj8688.c85
-rw-r--r--src/mame/drivers/nbmj8891.c81
-rw-r--r--src/mame/drivers/nbmj8991.c39
-rw-r--r--src/mame/drivers/nbmj9195.c17
-rw-r--r--src/mame/drivers/nemesis.c148
-rw-r--r--src/mame/drivers/neogeo.c9
-rw-r--r--src/mame/drivers/news.c4
-rw-r--r--src/mame/drivers/nightgal.c56
-rw-r--r--src/mame/drivers/ninjakd2.c17
-rw-r--r--src/mame/drivers/ninjaw.c46
-rw-r--r--src/mame/drivers/niyanpai.c13
-rw-r--r--src/mame/drivers/nmg5.c15
-rw-r--r--src/mame/drivers/nmk16.c82
-rw-r--r--src/mame/drivers/norautp.c5
-rw-r--r--src/mame/drivers/nova2001.c80
-rw-r--r--src/mame/drivers/nss.c6
-rw-r--r--src/mame/drivers/nwk-tr.c2
-rw-r--r--src/mame/drivers/nycaptor.c18
-rw-r--r--src/mame/drivers/nyny.c36
-rw-r--r--src/mame/drivers/ohmygod.c4
-rw-r--r--src/mame/drivers/ojankohs.c72
-rw-r--r--src/mame/drivers/olibochu.c5
-rw-r--r--src/mame/drivers/omegrace.c7
-rw-r--r--src/mame/drivers/oneshot.c19
-rw-r--r--src/mame/drivers/onetwo.c10
-rw-r--r--src/mame/drivers/opwolf.c35
-rw-r--r--src/mame/drivers/orbit.c12
-rw-r--r--src/mame/drivers/othldrby.c10
-rw-r--r--src/mame/drivers/othunder.c21
-rw-r--r--src/mame/drivers/overdriv.c30
-rw-r--r--src/mame/drivers/pacland.c4
-rw-r--r--src/mame/drivers/pacman.c62
-rw-r--r--src/mame/drivers/pandoras.c22
-rw-r--r--src/mame/drivers/paradise.c30
-rw-r--r--src/mame/drivers/paranoia.c4
-rw-r--r--src/mame/drivers/parodius.c17
-rw-r--r--src/mame/drivers/pasha2.c40
-rw-r--r--src/mame/drivers/pass.c5
-rw-r--r--src/mame/drivers/pastelg.c26
-rw-r--r--src/mame/drivers/pbaction.c9
-rw-r--r--src/mame/drivers/pcktgal.c14
-rw-r--r--src/mame/drivers/pcxt.c10
-rw-r--r--src/mame/drivers/pengo.c8
-rw-r--r--src/mame/drivers/peplus.c7
-rw-r--r--src/mame/drivers/pgm.c8
-rw-r--r--src/mame/drivers/phoenix.c33
-rw-r--r--src/mame/drivers/pingpong.c4
-rw-r--r--src/mame/drivers/pipedrm.c18
-rw-r--r--src/mame/drivers/pipeline.c2
-rw-r--r--src/mame/drivers/pirates.c6
-rw-r--r--src/mame/drivers/pitnrun.c15
-rw-r--r--src/mame/drivers/pkscram.c23
-rw-r--r--src/mame/drivers/pktgaldx.c14
-rw-r--r--src/mame/drivers/playch10.c20
-rw-r--r--src/mame/drivers/playmark.c16
-rw-r--r--src/mame/drivers/plygonet.c4
-rw-r--r--src/mame/drivers/pokechmp.c10
-rw-r--r--src/mame/drivers/polepos.c35
-rw-r--r--src/mame/drivers/policetr.c19
-rw-r--r--src/mame/drivers/polyplay.c12
-rw-r--r--src/mame/drivers/poolshrk.c8
-rw-r--r--src/mame/drivers/popeye.c25
-rw-r--r--src/mame/drivers/popper.c6
-rw-r--r--src/mame/drivers/powerbal.c14
-rw-r--r--src/mame/drivers/powerins.c21
-rw-r--r--src/mame/drivers/ppmast93.c6
-rw-r--r--src/mame/drivers/prehisle.c25
-rw-r--r--src/mame/drivers/progolf.c8
-rw-r--r--src/mame/drivers/psikyo.c27
-rw-r--r--src/mame/drivers/psikyo4.c59
-rw-r--r--src/mame/drivers/psikyosh.c63
-rw-r--r--src/mame/drivers/psychic5.c18
-rw-r--r--src/mame/drivers/pturn.c6
-rw-r--r--src/mame/drivers/puckpkmn.c28
-rw-r--r--src/mame/drivers/punchout.c26
-rw-r--r--src/mame/drivers/pushman.c12
-rw-r--r--src/mame/drivers/qdrmfgp.c32
-rw-r--r--src/mame/drivers/quantum.c57
-rw-r--r--src/mame/drivers/quasar.c7
-rw-r--r--src/mame/drivers/quizdna.c23
-rw-r--r--src/mame/drivers/quizo.c3
-rw-r--r--src/mame/drivers/quizpani.c4
-rw-r--r--src/mame/drivers/quizpun2.c3
-rw-r--r--src/mame/drivers/r2dtank.c50
-rw-r--r--src/mame/drivers/raiden2.c13
-rw-r--r--src/mame/drivers/rainbow.c23
-rw-r--r--src/mame/drivers/rallyx.c7
-rw-r--r--src/mame/drivers/rampart.c47
-rw-r--r--src/mame/drivers/rastan.c27
-rw-r--r--src/mame/drivers/rcasino.c13
-rw-r--r--src/mame/drivers/re900.c57
-rw-r--r--src/mame/drivers/realbrk.c15
-rw-r--r--src/mame/drivers/relief.c47
-rw-r--r--src/mame/drivers/renegade.c41
-rw-r--r--src/mame/drivers/retofinv.c4
-rw-r--r--src/mame/drivers/rmhaihai.c24
-rw-r--r--src/mame/drivers/rockola.c7
-rw-r--r--src/mame/drivers/rockrage.c21
-rw-r--r--src/mame/drivers/rohga.c22
-rw-r--r--src/mame/drivers/rollerg.c17
-rw-r--r--src/mame/drivers/rollrace.c9
-rw-r--r--src/mame/drivers/route16.c34
-rw-r--r--src/mame/drivers/royalmah.c104
-rw-r--r--src/mame/drivers/rpunch.c27
-rw-r--r--src/mame/drivers/runaway.c27
-rw-r--r--src/mame/drivers/rungun.c10
-rw-r--r--src/mame/drivers/sandscrp.c17
-rw-r--r--src/mame/drivers/sangho.c6
-rw-r--r--src/mame/drivers/sauro.c12
-rw-r--r--src/mame/drivers/sbasketb.c12
-rw-r--r--src/mame/drivers/sbowling.c4
-rw-r--r--src/mame/drivers/sbrkout.c2
-rw-r--r--src/mame/drivers/sbugger.c4
-rw-r--r--src/mame/drivers/scobra.c32
-rw-r--r--src/mame/drivers/scotrsht.c3
-rw-r--r--src/mame/drivers/scramble.c40
-rw-r--r--src/mame/drivers/scregg.c12
-rw-r--r--src/mame/drivers/sderby.c6
-rw-r--r--src/mame/drivers/segac2.c63
-rw-r--r--src/mame/drivers/segae.c4
-rw-r--r--src/mame/drivers/segag80r.c14
-rw-r--r--src/mame/drivers/segag80v.c70
-rw-r--r--src/mame/drivers/segahang.c22
-rw-r--r--src/mame/drivers/segald.c3
-rw-r--r--src/mame/drivers/segaorun.c5
-rw-r--r--src/mame/drivers/segas16a.c17
-rw-r--r--src/mame/drivers/segas16b.c36
-rw-r--r--src/mame/drivers/segas18.c14
-rw-r--r--src/mame/drivers/segas24.c41
-rw-r--r--src/mame/drivers/segas32.c40
-rw-r--r--src/mame/drivers/segaxbd.c11
-rw-r--r--src/mame/drivers/segaybd.c11
-rw-r--r--src/mame/drivers/seibuspi.c46
-rw-r--r--src/mame/drivers/seicross.c32
-rw-r--r--src/mame/drivers/senjyo.c12
-rw-r--r--src/mame/drivers/seta.c170
-rw-r--r--src/mame/drivers/seta2.c30
-rw-r--r--src/mame/drivers/sf.c22
-rw-r--r--src/mame/drivers/sfkick.c9
-rw-r--r--src/mame/drivers/sg1000a.c2
-rw-r--r--src/mame/drivers/shadfrce.c15
-rw-r--r--src/mame/drivers/shangha3.c33
-rw-r--r--src/mame/drivers/shanghai.c18
-rw-r--r--src/mame/drivers/shangkid.c97
-rw-r--r--src/mame/drivers/shaolins.c4
-rw-r--r--src/mame/drivers/shisen.c5
-rw-r--r--src/mame/drivers/shootout.c28
-rw-r--r--src/mame/drivers/shougi.c4
-rw-r--r--src/mame/drivers/shuuz.c22
-rw-r--r--src/mame/drivers/sidearms.c19
-rw-r--r--src/mame/drivers/sidepckt.c12
-rw-r--r--src/mame/drivers/silkroad.c62
-rw-r--r--src/mame/drivers/simpl156.c42
-rw-r--r--src/mame/drivers/simpsons.c7
-rw-r--r--src/mame/drivers/skyarmy.c5
-rw-r--r--src/mame/drivers/skydiver.c22
-rw-r--r--src/mame/drivers/skyfox.c10
-rw-r--r--src/mame/drivers/skykid.c4
-rw-r--r--src/mame/drivers/skylncr.c12
-rw-r--r--src/mame/drivers/slapfght.c40
-rw-r--r--src/mame/drivers/slapshot.c13
-rw-r--r--src/mame/drivers/sliver.c2
-rw-r--r--src/mame/drivers/slotcarn.c16
-rw-r--r--src/mame/drivers/sms.c3
-rw-r--r--src/mame/drivers/snesb.c6
-rw-r--r--src/mame/drivers/snk.c68
-rw-r--r--src/mame/drivers/snk68.c25
-rw-r--r--src/mame/drivers/snookr10.c4
-rw-r--r--src/mame/drivers/snowbros.c81
-rw-r--r--src/mame/drivers/solomon.c9
-rw-r--r--src/mame/drivers/sonson.c6
-rw-r--r--src/mame/drivers/sothello.c29
-rw-r--r--src/mame/drivers/spacefb.c2
-rw-r--r--src/mame/drivers/spbactn.c11
-rw-r--r--src/mame/drivers/spcforce.c6
-rw-r--r--src/mame/drivers/spdodgeb.c18
-rw-r--r--src/mame/drivers/speedatk.c4
-rw-r--r--src/mame/drivers/speedbal.c3
-rw-r--r--src/mame/drivers/speedspn.c10
-rw-r--r--src/mame/drivers/speglsht.c2
-rw-r--r--src/mame/drivers/splash.c14
-rw-r--r--src/mame/drivers/spoker.c5
-rw-r--r--src/mame/drivers/spool99.c4
-rw-r--r--src/mame/drivers/sprcros2.c6
-rw-r--r--src/mame/drivers/sprint2.c40
-rw-r--r--src/mame/drivers/sprint4.c36
-rw-r--r--src/mame/drivers/spy.c33
-rw-r--r--src/mame/drivers/srmp2.c49
-rw-r--r--src/mame/drivers/srmp5.c2
-rw-r--r--src/mame/drivers/srmp6.c4
-rw-r--r--src/mame/drivers/srumbler.c6
-rw-r--r--src/mame/drivers/sshangha.c11
-rw-r--r--src/mame/drivers/ssingles.c8
-rw-r--r--src/mame/drivers/sslam.c64
-rw-r--r--src/mame/drivers/ssozumo.c8
-rw-r--r--src/mame/drivers/ssrj.c13
-rw-r--r--src/mame/drivers/ssv.c7
-rw-r--r--src/mame/drivers/st0016.c2
-rw-r--r--src/mame/drivers/stadhero.c34
-rw-r--r--src/mame/drivers/starshp1.c28
-rw-r--r--src/mame/drivers/statriv2.c28
-rw-r--r--src/mame/drivers/stfight.c12
-rw-r--r--src/mame/drivers/stlforce.c8
-rw-r--r--src/mame/drivers/strnskil.c4
-rw-r--r--src/mame/drivers/stv.c27
-rw-r--r--src/mame/drivers/subs.c10
-rw-r--r--src/mame/drivers/subsino.c5
-rw-r--r--src/mame/drivers/suna16.c37
-rw-r--r--src/mame/drivers/suna8.c43
-rw-r--r--src/mame/drivers/supbtime.c24
-rw-r--r--src/mame/drivers/supdrapo.c3
-rw-r--r--src/mame/drivers/superdq.c6
-rw-r--r--src/mame/drivers/superqix.c101
-rw-r--r--src/mame/drivers/supertnk.c5
-rw-r--r--src/mame/drivers/suprgolf.c19
-rw-r--r--src/mame/drivers/suprloco.c4
-rw-r--r--src/mame/drivers/suprnova.c10
-rw-r--r--src/mame/drivers/suprridr.c18
-rw-r--r--src/mame/drivers/suprslam.c9
-rw-r--r--src/mame/drivers/surpratk.c9
-rw-r--r--src/mame/drivers/system1.c4
-rw-r--r--src/mame/drivers/system16.c29
-rw-r--r--src/mame/drivers/system18.c41
-rw-r--r--src/mame/drivers/tagteam.c8
-rw-r--r--src/mame/drivers/tail2nos.c24
-rw-r--r--src/mame/drivers/taito_b.c43
-rw-r--r--src/mame/drivers/taito_f2.c46
-rw-r--r--src/mame/drivers/taito_f3.c17
-rw-r--r--src/mame/drivers/taito_h.c13
-rw-r--r--src/mame/drivers/taito_l.c200
-rw-r--r--src/mame/drivers/taito_x.c28
-rw-r--r--src/mame/drivers/taito_z.c63
-rw-r--r--src/mame/drivers/taitoair.c9
-rw-r--r--src/mame/drivers/taitosj.c68
-rw-r--r--src/mame/drivers/tank8.c50
-rw-r--r--src/mame/drivers/tankbatt.c19
-rw-r--r--src/mame/drivers/tankbust.c22
-rw-r--r--src/mame/drivers/taotaido.c9
-rw-r--r--src/mame/drivers/targeth.c2
-rw-r--r--src/mame/drivers/tatsumi.c19
-rw-r--r--src/mame/drivers/taxidrvr.c30
-rw-r--r--src/mame/drivers/tbowl.c26
-rw-r--r--src/mame/drivers/tceptor.c13
-rw-r--r--src/mame/drivers/tecmo.c36
-rw-r--r--src/mame/drivers/tecmo16.c13
-rw-r--r--src/mame/drivers/tecmosys.c14
-rw-r--r--src/mame/drivers/tehkanwc.c42
-rw-r--r--src/mame/drivers/tempest.c36
-rw-r--r--src/mame/drivers/terracre.c16
-rw-r--r--src/mame/drivers/tetrisp2.c36
-rw-r--r--src/mame/drivers/thayers.c3
-rw-r--r--src/mame/drivers/thedeep.c9
-rw-r--r--src/mame/drivers/thepit.c14
-rw-r--r--src/mame/drivers/thief.c46
-rw-r--r--src/mame/drivers/thoop2.c4
-rw-r--r--src/mame/drivers/thunderx.c26
-rw-r--r--src/mame/drivers/tiamc1.c8
-rw-r--r--src/mame/drivers/tickee.c42
-rw-r--r--src/mame/drivers/tigeroad.c24
-rw-r--r--src/mame/drivers/timelimt.c16
-rw-r--r--src/mame/drivers/tmaster.c10
-rw-r--r--src/mame/drivers/tmnt.c164
-rw-r--r--src/mame/drivers/tnzs.c74
-rw-r--r--src/mame/drivers/toaplan1.c22
-rw-r--r--src/mame/drivers/toaplan2.c81
-rw-r--r--src/mame/drivers/toki.c17
-rw-r--r--src/mame/drivers/topspeed.c29
-rw-r--r--src/mame/drivers/toratora.c36
-rw-r--r--src/mame/drivers/toypop.c10
-rw-r--r--src/mame/drivers/tp84.c14
-rw-r--r--src/mame/drivers/trackfld.c18
-rw-r--r--src/mame/drivers/triplhnt.c21
-rw-r--r--src/mame/drivers/truco.c2
-rw-r--r--src/mame/drivers/trucocl.c10
-rw-r--r--src/mame/drivers/trvmadns.c3
-rw-r--r--src/mame/drivers/trvquest.c6
-rw-r--r--src/mame/drivers/tryout.c3
-rw-r--r--src/mame/drivers/tsamurai.c29
-rw-r--r--src/mame/drivers/tubep.c72
-rw-r--r--src/mame/drivers/tugboat.c3
-rw-r--r--src/mame/drivers/tumbleb.c108
-rw-r--r--src/mame/drivers/tumblep.c24
-rw-r--r--src/mame/drivers/tunhunt.c44
-rw-r--r--src/mame/drivers/twin16.c29
-rw-r--r--src/mame/drivers/twincobr.c7
-rw-r--r--src/mame/drivers/twins.c12
-rw-r--r--src/mame/drivers/tx1.c75
-rw-r--r--src/mame/drivers/uapce.c4
-rw-r--r--src/mame/drivers/ultraman.c5
-rw-r--r--src/mame/drivers/ultratnk.c24
-rw-r--r--src/mame/drivers/ultrsprt.c27
-rw-r--r--src/mame/drivers/unico.c52
-rw-r--r--src/mame/drivers/upscope.c16
-rw-r--r--src/mame/drivers/usgames.c6
-rw-r--r--src/mame/drivers/vamphalf.c106
-rw-r--r--src/mame/drivers/vaportra.c36
-rw-r--r--src/mame/drivers/vastar.c13
-rw-r--r--src/mame/drivers/vball.c13
-rw-r--r--src/mame/drivers/vcombat.c6
-rw-r--r--src/mame/drivers/vendetta.c21
-rw-r--r--src/mame/drivers/videopin.c36
-rw-r--r--src/mame/drivers/videopkr.c32
-rw-r--r--src/mame/drivers/vigilant.c15
-rw-r--r--src/mame/drivers/vmetal.c26
-rw-r--r--src/mame/drivers/volfied.c15
-rw-r--r--src/mame/drivers/vroulet.c12
-rw-r--r--src/mame/drivers/vsnes.c47
-rw-r--r--src/mame/drivers/vulgus.c6
-rw-r--r--src/mame/drivers/wallc.c4
-rw-r--r--src/mame/drivers/wardner.c7
-rw-r--r--src/mame/drivers/warpwarp.c18
-rw-r--r--src/mame/drivers/warriorb.c33
-rw-r--r--src/mame/drivers/wc90.c11
-rw-r--r--src/mame/drivers/wc90b.c21
-rw-r--r--src/mame/drivers/wecleman.c56
-rw-r--r--src/mame/drivers/welltris.c9
-rw-r--r--src/mame/drivers/wgp.c9
-rw-r--r--src/mame/drivers/williams.c2
-rw-r--r--src/mame/drivers/wink.c14
-rw-r--r--src/mame/drivers/wiping.c16
-rw-r--r--src/mame/drivers/witch.c39
-rw-r--r--src/mame/drivers/wiz.c31
-rw-r--r--src/mame/drivers/wldarrow.c24
-rw-r--r--src/mame/drivers/wolfpack.c17
-rw-r--r--src/mame/drivers/wrally.c2
-rw-r--r--src/mame/drivers/wwfsstar.c9
-rw-r--r--src/mame/drivers/wwfwfest.c17
-rw-r--r--src/mame/drivers/xain.c12
-rw-r--r--src/mame/drivers/xexex.c17
-rw-r--r--src/mame/drivers/xmen.c5
-rw-r--r--src/mame/drivers/xorworld.c4
-rw-r--r--src/mame/drivers/xtheball.c16
-rw-r--r--src/mame/drivers/xxmissio.c32
-rw-r--r--src/mame/drivers/xyonix.c4
-rw-r--r--src/mame/drivers/yiear.c20
-rw-r--r--src/mame/drivers/yumefuda.c22
-rw-r--r--src/mame/drivers/yunsun16.c11
-rw-r--r--src/mame/drivers/yunsung8.c17
-rw-r--r--src/mame/drivers/zaccaria.c45
-rw-r--r--src/mame/drivers/zaxxon.c4
-rw-r--r--src/mame/drivers/zerozone.c2
-rw-r--r--src/mame/drivers/zn.c48
-rw-r--r--src/mame/drivers/zodiack.c3
-rw-r--r--src/mame/drivers/zr107.c8
-rw-r--r--src/mame/includes/8080bw.h9
-rw-r--r--src/mame/includes/amiga.h6
-rw-r--r--src/mame/includes/asteroid.h14
-rw-r--r--src/mame/includes/astrocde.h2
-rw-r--r--src/mame/includes/atari.h2
-rw-r--r--src/mame/includes/attckufo.h6
-rw-r--r--src/mame/includes/avalnche.h6
-rw-r--r--src/mame/includes/blockade.h2
-rw-r--r--src/mame/includes/bsktball.h6
-rw-r--r--src/mame/includes/bzone.h10
-rw-r--r--src/mame/includes/canyon.h8
-rw-r--r--src/mame/includes/cchasm.h6
-rw-r--r--src/mame/includes/cps3.h5
-rw-r--r--src/mame/includes/crbaloon.h12
-rw-r--r--src/mame/includes/dc.h8
-rw-r--r--src/mame/includes/exidy.h7
-rw-r--r--src/mame/includes/exidy440.h3
-rw-r--r--src/mame/includes/firetrk.h16
-rw-r--r--src/mame/includes/flower.h6
-rw-r--r--src/mame/includes/galaxold.h6
-rw-r--r--src/mame/includes/genesis.h2
-rw-r--r--src/mame/includes/gomoku.h6
-rw-r--r--src/mame/includes/gridlee.h6
-rw-r--r--src/mame/includes/harddriv.h2
-rw-r--r--src/mame/includes/leland.h19
-rw-r--r--src/mame/includes/mario.h4
-rw-r--r--src/mame/includes/meadows.h2
-rw-r--r--src/mame/includes/mw8080bw.h42
-rw-r--r--src/mame/includes/orbit.h8
-rw-r--r--src/mame/includes/phoenix.h21
-rw-r--r--src/mame/includes/polepos.h6
-rw-r--r--src/mame/includes/polyplay.h4
-rw-r--r--src/mame/includes/poolshrk.h8
-rw-r--r--src/mame/includes/rockola.h5
-rw-r--r--src/mame/includes/segag80v.h2
-rw-r--r--src/mame/includes/simpsons.h2
-rw-r--r--src/mame/includes/snes.h5
-rw-r--r--src/mame/includes/stfight.h2
-rw-r--r--src/mame/includes/subs.h10
-rw-r--r--src/mame/includes/suna8.h4
-rw-r--r--src/mame/includes/tatsumi.h4
-rw-r--r--src/mame/includes/tiamc1.h6
-rw-r--r--src/mame/includes/toaplan2.h8
-rw-r--r--src/mame/includes/tx1.h19
-rw-r--r--src/mame/includes/warpwarp.h8
-rw-r--r--src/mame/machine/archimds.c2
-rw-r--r--src/mame/machine/atari.c35
-rw-r--r--src/mame/machine/atarifb.c48
-rw-r--r--src/mame/machine/atarigen.c20
-rw-r--r--src/mame/machine/atarigen.h2
-rw-r--r--src/mame/machine/balsente.c22
-rw-r--r--src/mame/machine/cubocd32.c64
-rw-r--r--src/mame/machine/dc.c24
-rw-r--r--src/mame/machine/gaplus.c3
-rw-r--r--src/mame/machine/leland.c20
-rw-r--r--src/mame/machine/mhavoc.c2
-rw-r--r--src/mame/machine/n64.c19
-rw-r--r--src/mame/machine/namcoio.c2
-rw-r--r--src/mame/machine/namcos1.c4
-rw-r--r--src/mame/machine/nitedrvr.c19
-rw-r--r--src/mame/machine/nmk004.c181
-rw-r--r--src/mame/machine/nmk004.h2
-rw-r--r--src/mame/machine/qix.c4
-rw-r--r--src/mame/machine/simpsons.c4
-rw-r--r--src/mame/machine/stfight.c10
-rw-r--r--src/mame/machine/tatsumi.c10
-rw-r--r--src/mame/machine/toaplan1.c3
-rw-r--r--src/mame/machine/williams.c8
-rw-r--r--src/mame/machine/xevious.c5
-rw-r--r--src/mame/video/astrocde.c2
-rw-r--r--src/mame/video/attckufo.c1
-rw-r--r--src/mame/video/cheekyms.c2
-rw-r--r--src/mame/video/dday.c2
-rw-r--r--src/mame/video/genesis.c6
-rw-r--r--src/mame/video/hanaawas.c6
-rw-r--r--src/mame/video/homerun.c8
-rw-r--r--src/mame/video/leland.c4
-rw-r--r--src/mame/video/mitchell.c5
-rw-r--r--src/mame/video/phoenix.c2
-rw-r--r--src/mame/video/seta.c5
-rw-r--r--src/mame/video/skydiver.c7
-rw-r--r--src/mame/video/sprint4.c10
-rw-r--r--src/mame/video/starcrus.c28
-rw-r--r--src/mame/video/subs.c6
-rw-r--r--src/mame/video/tia.c2
-rw-r--r--src/mame/video/toaplan2.c3
-rw-r--r--src/mame/video/triplhnt.c6
-rw-r--r--src/mame/video/ultratnk.c6
-rw-r--r--src/mame/video/xxmissio.c4
1203 files changed, 16152 insertions, 21734 deletions
diff --git a/.gitattributes b/.gitattributes
index 988c801e0b6..91c51713558 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -720,7 +720,6 @@ src/emu/restrack.c svneol=native#text/plain
src/emu/restrack.h svneol=native#text/plain
src/emu/romload.c svneol=native#text/plain
src/emu/romload.h svneol=native#text/plain
-src/emu/sndintrf.c svneol=native#text/plain
src/emu/sndintrf.h svneol=native#text/plain
src/emu/sound.c svneol=native#text/plain
src/emu/sound.h svneol=native#text/plain
@@ -738,12 +737,16 @@ src/emu/sound/2612intf.c svneol=native#text/plain
src/emu/sound/2612intf.h svneol=native#text/plain
src/emu/sound/262intf.c svneol=native#text/plain
src/emu/sound/262intf.h svneol=native#text/plain
+src/emu/sound/3526intf.c svneol=native#text/plain
+src/emu/sound/3526intf.h svneol=native#text/plain
src/emu/sound/3812intf.c svneol=native#text/plain
src/emu/sound/3812intf.h svneol=native#text/plain
src/emu/sound/5110intf.c svneol=native#text/plain
src/emu/sound/5110intf.h svneol=native#text/plain
src/emu/sound/5220intf.c svneol=native#text/plain
src/emu/sound/5220intf.h svneol=native#text/plain
+src/emu/sound/8950intf.c svneol=native#text/plain
+src/emu/sound/8950intf.h svneol=native#text/plain
src/emu/sound/aica.c svneol=native#text/plain
src/emu/sound/aica.h svneol=native#text/plain
src/emu/sound/aicadsp.c svneol=native#text/plain
@@ -769,8 +772,6 @@ src/emu/sound/cdp1869.c svneol=native#text/plain
src/emu/sound/cdp1869.h svneol=native#text/plain
src/emu/sound/cem3394.c svneol=native#text/plain
src/emu/sound/cem3394.h svneol=native#text/plain
-src/emu/sound/custom.c svneol=native#text/plain
-src/emu/sound/custom.h svneol=native#text/plain
src/emu/sound/dac.c svneol=native#text/plain
src/emu/sound/dac.h svneol=native#text/plain
src/emu/sound/digitalk.c svneol=native#text/plain
diff --git a/src/emu/audit.c b/src/emu/audit.c
index 3fd8a79448d..6b7e8c4d7a1 100644
--- a/src/emu/audit.c
+++ b/src/emu/audit.c
@@ -139,14 +139,15 @@ int audit_samples(core_options *options, const game_driver *gamedrv, audit_recor
int records = 0;
#if HAS_SAMPLES
machine_config *config = machine_config_alloc(gamedrv->machine_config);
+ const device_config *device;
audit_record *record;
- int sndnum, sampnum;
+ int sampnum;
/* count the number of sample records attached to this driver */
- for (sndnum = 0; sndnum < ARRAY_LENGTH(config->sound); sndnum++)
- if (config->sound[sndnum].type == SOUND_SAMPLES)
+ for (device = sound_first(config); device != NULL; device = sound_next(device))
+ if (sound_get_type(device) == SOUND_SAMPLES)
{
- const samples_interface *intf = (const samples_interface *)config->sound[sndnum].config;
+ const samples_interface *intf = (const samples_interface *)device->static_config;
if (intf->samplenames != NULL)
{
@@ -167,10 +168,10 @@ int audit_samples(core_options *options, const game_driver *gamedrv, audit_recor
record = *audit;
/* now iterate over sample entries */
- for (sndnum = 0; sndnum < ARRAY_LENGTH(config->sound); sndnum++)
- if (config->sound[sndnum].type == SOUND_SAMPLES)
+ for (device = sound_first(config); device != NULL; device = sound_next(device))
+ if (sound_get_type(device) == SOUND_SAMPLES)
{
- const samples_interface *intf = (const samples_interface *)config->sound[sndnum].config;
+ const samples_interface *intf = (const samples_interface *)device->static_config;
const char *sharedname = NULL;
if (intf->samplenames != NULL)
diff --git a/src/emu/clifront.c b/src/emu/clifront.c
index 27722ae5638..2e60ea20918 100644
--- a/src/emu/clifront.c
+++ b/src/emu/clifront.c
@@ -339,7 +339,6 @@ int cli_info_listxml(core_options *options, const char *gamename)
{
/* since print_mame_xml expands the machine driver, we need to set things up */
init_resource_tracking();
- sndintrf_init(NULL);
print_mame_xml(stdout, drivers, gamename);
@@ -604,20 +603,19 @@ int cli_info_listsamples(core_options *options, const char *gamename)
/* since we expand the machine driver, we need to set things up */
init_resource_tracking();
- sndintrf_init(NULL);
/* iterate over drivers */
for (drvindex = 0; drivers[drvindex] != NULL; drvindex++)
if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0)
{
machine_config *config = machine_config_alloc(drivers[drvindex]->machine_config);
- int sndnum;
+ const device_config *device;
/* find samples interfaces */
- for (sndnum = 0; sndnum < MAX_SOUND && config->sound[sndnum].type != SOUND_DUMMY; sndnum++)
- if (config->sound[sndnum].type == SOUND_SAMPLES)
+ for (device = sound_first(config); device != NULL; device = sound_next(device))
+ if (sound_get_type(device) == SOUND_SAMPLES)
{
- const char *const *samplenames = ((const samples_interface *)config->sound[sndnum].config)->samplenames;
+ const char *const *samplenames = ((const samples_interface *)device->static_config)->samplenames;
int sampnum;
/* if the list is legit, walk it and print the sample info */
diff --git a/src/emu/cpu/h6280/h6280.c b/src/emu/cpu/h6280/h6280.c
index 57a7ca0a867..28fd0ca5cb4 100644
--- a/src/emu/cpu/h6280/h6280.c
+++ b/src/emu/cpu/h6280/h6280.c
@@ -356,12 +356,12 @@ static CPU_TRANSLATE( h6280 )
return TRUE;
}
-UINT8 h6280io_get_buffer(device_config *device)
+UINT8 h6280io_get_buffer(const device_config *device)
{
h6280_Regs* cpustate = device->token;
return cpustate->io_buffer;
}
-void h6280io_set_buffer(device_config *device, UINT8 data)
+void h6280io_set_buffer(const device_config *device, UINT8 data)
{
h6280_Regs* cpustate = device->token;
cpustate->io_buffer=data;
diff --git a/src/emu/cpu/h6280/h6280.h b/src/emu/cpu/h6280/h6280.h
index 3a714074741..3f40ddcf03e 100644
--- a/src/emu/cpu/h6280/h6280.h
+++ b/src/emu/cpu/h6280/h6280.h
@@ -84,8 +84,8 @@ READ8_HANDLER( h6280_timer_r );
WRITE8_HANDLER( h6280_timer_w );
/* functions for use by the PSG and joypad port only! */
-UINT8 h6280io_get_buffer(device_config*);
-void h6280io_set_buffer(device_config*, UINT8);
+UINT8 h6280io_get_buffer(const device_config*);
+void h6280io_set_buffer(const device_config*, UINT8);
CPU_DISASSEMBLE( h6280 );
diff --git a/src/emu/cpuexec.c b/src/emu/cpuexec.c
index d7145ad1a4b..fa709823692 100644
--- a/src/emu/cpuexec.c
+++ b/src/emu/cpuexec.c
@@ -433,7 +433,7 @@ const char *cpuexec_describe_context(running_machine *machine)
/***************************************************************************
- VIDEO SCREEN DEVICE INTERFACE
+ CPU DEVICE INTERFACE
***************************************************************************/
/*-------------------------------------------------
@@ -536,9 +536,9 @@ static DEVICE_START( cpu )
/* if no state registered for saving, we can't save */
if (num_regs == 0)
{
- logerror("CPU '%s' did not register any state to save!\n", cpu_get_name(device));
+ logerror("CPU '%s' did not register any state to save!\n", device->tag);
if (device->machine->gamedrv->flags & GAME_SUPPORTS_SAVE)
- fatalerror("CPU '%s' did not register any state to save!", cpu_get_name(device));
+ fatalerror("CPU '%s' did not register any state to save!", device->tag);
}
/* register some internal states as well */
diff --git a/src/emu/devintrf.c b/src/emu/devintrf.c
index 1011fae1056..616aac761a2 100644
--- a/src/emu/devintrf.c
+++ b/src/emu/devintrf.c
@@ -49,6 +49,7 @@ static int temp_string_pool_index;
static void device_list_stop(running_machine *machine);
static void device_list_reset(running_machine *machine);
+static void set_default_string(UINT32 state, char *buffer);
@@ -608,18 +609,20 @@ void device_list_start(running_machine *machine)
for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
{
device_start_func start = (device_start_func)device_get_info_fct(device, DEVINFO_FCT_START);
-
assert(start != NULL);
+
if (!device->started)
{
device->started = DEVICE_STARTING;
(*start)(device);
+
+ /* if the start was delayed, move back to the stopped state, otherwise count it */
if (device->started == DEVICE_DELAYED)
device->started = DEVICE_STOPPED;
else
{
device->started = DEVICE_STARTED;
- numstarted ++;
+ numstarted++;
}
}
}
@@ -632,9 +635,10 @@ void device_list_start(running_machine *machine)
/*-------------------------------------------------
- device_delay_init - delay the startup of a given
- device for dependency reasons
+ device_delay_init - delay the startup of a
+ given device for dependency reasons
-------------------------------------------------*/
+
void device_delay_init(const device_config *device)
{
if (device->started != DEVICE_STARTING && device->started != DEVICE_DELAYED)
@@ -642,6 +646,7 @@ void device_delay_init(const device_config *device)
((device_config *)device)->started = DEVICE_DELAYED;
}
+
/*-------------------------------------------------
device_list_stop - stop the configured list
of devices for a machine
@@ -811,6 +816,8 @@ const char *device_get_info_string(const device_config *device, UINT32 state)
/* retrieve the value */
info.s = get_temp_string_buffer();
(*device->type)(device, state, &info);
+ if (info.s[0] == 0)
+ set_default_string(state, info.s);
return info.s;
}
@@ -876,6 +883,8 @@ const char *devtype_get_info_string(device_type type, UINT32 state)
/* retrieve the value */
info.s = get_temp_string_buffer();
(*type)(NULL, state, &info);
+ if (info.s[0] == 0)
+ set_default_string(state, info.s);
return info.s;
}
@@ -943,3 +952,26 @@ void device_set_info_fct(const device_config *device, UINT32 state, genf *data)
info.f = data;
(*device->set_info)(device, state, &info);
}
+
+
+
+/***************************************************************************
+ DEVICE INFORMATION SETTERS
+***************************************************************************/
+
+/*-------------------------------------------------
+ set_default_string - compute a default string
+ if none is provided
+-------------------------------------------------*/
+
+static void set_default_string(UINT32 state, char *buffer)
+{
+ switch (state)
+ {
+ case DEVINFO_STR_NAME: strcpy(buffer, "Custom"); break;
+ case DEVINFO_STR_FAMILY: strcpy(buffer, "Custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(buffer, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(buffer, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(buffer, "Copyright Nicola Salmoria and the MAME Team"); break;
+ }
+}
diff --git a/src/emu/devintrf.h b/src/emu/devintrf.h
index b3a25b9116c..203e432c30c 100644
--- a/src/emu/devintrf.h
+++ b/src/emu/devintrf.h
@@ -336,6 +336,7 @@ void device_set_clock(const device_config *device, UINT32 clock);
void device_delay_init(const device_config *device);
+
/* ----- device information getters ----- */
/* return an integer state value from an allocated device */
diff --git a/src/emu/emu.mak b/src/emu/emu.mak
index 8a7604bf60c..96233ccb270 100644
--- a/src/emu/emu.mak
+++ b/src/emu/emu.mak
@@ -68,7 +68,6 @@ EMUOBJS = \
$(EMUOBJ)/restrack.o \
$(EMUOBJ)/romload.o \
$(EMUOBJ)/sound.o \
- $(EMUOBJ)/sndintrf.o \
$(EMUOBJ)/state.o \
$(EMUOBJ)/streams.o \
$(EMUOBJ)/tilemap.o \
diff --git a/src/emu/info.c b/src/emu/info.c
index b50a05c0d12..3cfeafd09f7 100644
--- a/src/emu/info.c
+++ b/src/emu/info.c
@@ -485,12 +485,12 @@ static void print_game_rom(FILE *out, const game_driver *game, const machine_con
static void print_game_sampleof(FILE *out, const game_driver *game, const machine_config *config)
{
#if (HAS_SAMPLES)
- int sndnum;
+ const device_config *device;
- for (sndnum = 0; sndnum < ARRAY_LENGTH(config->sound) && config->sound[sndnum].type != SOUND_DUMMY; sndnum++)
- if (config->sound[sndnum].type == SOUND_SAMPLES)
+ for (device = sound_first(config); device != NULL; device = sound_next(device))
+ if (sound_get_type(device) == SOUND_SAMPLES)
{
- const char *const *samplenames = ((const samples_interface *)config->sound[sndnum].config)->samplenames;
+ const char *const *samplenames = ((const samples_interface *)device->static_config)->samplenames;
if (samplenames != NULL)
{
int sampnum;
@@ -518,13 +518,13 @@ static void print_game_sampleof(FILE *out, const game_driver *game, const machin
static void print_game_sample(FILE *out, const game_driver *game, const machine_config *config)
{
#if (HAS_SAMPLES)
- int sndnum;
+ const device_config *device;
/* iterate over sound chips looking for samples */
- for (sndnum = 0; sndnum < ARRAY_LENGTH(config->sound) && config->sound[sndnum].type != SOUND_DUMMY; sndnum++)
- if (config->sound[sndnum].type == SOUND_SAMPLES)
+ for (device = sound_first(config); device != NULL; device = sound_next(device))
+ if (sound_get_type(device) == SOUND_SAMPLES)
{
- const char *const *samplenames = ((const samples_interface *)config->sound[sndnum].config)->samplenames;
+ const char *const *samplenames = ((const samples_interface *)device->static_config)->samplenames;
if (samplenames != NULL)
{
int sampnum;
@@ -563,7 +563,6 @@ static void print_game_sample(FILE *out, const game_driver *game, const machine_
static void print_game_chips(FILE *out, const game_driver *game, const machine_config *config)
{
const device_config *device;
- int chipnum;
/* iterate over CPUs */
for (device = cpu_first(config); device != NULL; device = cpu_next(device))
@@ -577,17 +576,16 @@ static void print_game_chips(FILE *out, const game_driver *game, const machine_c
}
/* iterate over sound chips */
- for (chipnum = 0; chipnum < ARRAY_LENGTH(config->sound); chipnum++)
- if (config->sound[chipnum].type != SOUND_DUMMY)
- {
- fprintf(out, "\t\t<chip");
- fprintf(out, " type=\"audio\"");
- fprintf(out, " tag=\"%s\"", xml_normalize_string(config->sound[chipnum].tag));
- fprintf(out, " name=\"%s\"", xml_normalize_string(sndtype_get_name(config->sound[chipnum].type)));
- if (config->sound[chipnum].clock != 0)
- fprintf(out, " clock=\"%d\"", config->sound[chipnum].clock);
- fprintf(out, "/>\n");
- }
+ for (device = sound_first(config); device != NULL; device = sound_next(device))
+ {
+ fprintf(out, "\t\t<chip");
+ fprintf(out, " type=\"audio\"");
+ fprintf(out, " tag=\"%s\"", xml_normalize_string(device->tag));
+ fprintf(out, " name=\"%s\"", xml_normalize_string(device_get_name(device)));
+ if (device->clock != 0)
+ fprintf(out, " clock=\"%d\"", device->clock);
+ fprintf(out, "/>\n");
+ }
}
@@ -684,19 +682,9 @@ static void print_game_display(FILE *out, const game_driver *game, const machine
static void print_game_sound(FILE *out, const game_driver *game, const machine_config *config)
{
int speakers = speaker_output_count(config);
- int has_sound = FALSE;
- int sndnum;
-
- /* see if we have any sound chips to report */
- for (sndnum = 0; sndnum < ARRAY_LENGTH(config->sound); sndnum++)
- if (config->sound[sndnum].type != SOUND_DUMMY)
- {
- has_sound = TRUE;
- break;
- }
- /* if we have sound, count the number of speakers */
- if (!has_sound)
+ /* if we have no sound, zero out the speaker count */
+ if (sound_first(config) == NULL)
speakers = 0;
fprintf(out, "\t\t<sound channels=\"%d\"/>\n", speakers);
diff --git a/src/emu/inptport.h b/src/emu/inptport.h
index 86ccb51756b..796f22495c1 100644
--- a/src/emu/inptport.h
+++ b/src/emu/inptport.h
@@ -677,14 +677,6 @@ struct _inp_header
/* macro for wrapping a default string */
#define DEF_STR(str_num) ((const char *)INPUT_STRING_##str_num)
-/* macros for referencing input ports in place of read handlers */
-#define HANDLER_PORT(name, type) ((type)("\0\0\0\0" name))
-#define DEVICE8_PORT(name) HANDLER_PORT(name, read8_device_func)
-#define MACHINE8_PORT(name) HANDLER_PORT(name, read8_space_func)
-#define IS_HANDLER_PORT(ptr) (((const char *)(ptr))[0] == 0 && ((const char *)(ptr))[1] == 0 && ((const char *)(ptr))[2] == 0 && ((const char *)(ptr))[3] == 0)
-#define CALL_DEVICE8_READ(ptr,d,offs) (IS_HANDLER_PORT(ptr) ? input_port_read((d)->machine, ((const char *)(ptr)) + 4) : (*ptr)(d, offs))
-#define CALL_MACHINE8_READ(ptr,m,offs) (IS_HANDLER_PORT(ptr) ? input_port_read((m), ((const char *)(ptr)) + 4) : (*ptr)(m, offs))
-
/***************************************************************************
diff --git a/src/emu/machine/laserdsc.h b/src/emu/machine/laserdsc.h
index 06c497184e0..5f6117c3ea3 100644
--- a/src/emu/machine/laserdsc.h
+++ b/src/emu/machine/laserdsc.h
@@ -15,7 +15,6 @@
#define __LASERDSC_H__
#include "chd.h"
-#include "sound/custom.h"
@@ -153,14 +152,6 @@ struct _laserdisc_config
/***************************************************************************
- GLOBAL VARIABLES
-***************************************************************************/
-
-extern const custom_sound_interface laserdisc_custom_interface;
-
-
-
-/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
@@ -233,5 +224,9 @@ void laserdisc_set_config(const device_config *device, const laserdisc_config *c
#define LASERDISC DEVICE_GET_INFO_NAME(laserdisc)
DEVICE_GET_INFO( laserdisc );
+/* audio get info callback */
+#define SOUND_LASERDISC DEVICE_GET_INFO_NAME(laserdisc_sound)
+DEVICE_GET_INFO( laserdisc_sound );
+
#endif /* __LASERDSC_H__ */
diff --git a/src/emu/machine/latch8.c b/src/emu/machine/latch8.c
index 5cfbc32695b..74ec2b64f61 100644
--- a/src/emu/machine/latch8.c
+++ b/src/emu/machine/latch8.c
@@ -34,7 +34,6 @@ INLINE latch8_t *get_safe_token(const device_config *device) {
static void update(const device_config *device, UINT8 new_val, UINT8 mask)
{
/* temporary hack until the discrete system is a device */
- const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
latch8_t *latch8 = get_safe_token(device);
UINT8 old_val = latch8->value;
@@ -46,7 +45,7 @@ static void update(const device_config *device, UINT8 new_val, UINT8 mask)
UINT8 changed = old_val ^ latch8->value;
for (i=0; i<8; i++)
if (((changed & (1<<i)) != 0) && latch8->intf->node_map[i] != 0)
- discrete_sound_w(space, latch8->intf->node_map[i] , (latch8->value >> i) & 1);
+ discrete_sound_w(devtag_get_device(device->machine, SOUND, latch8->intf->node_device[i]), latch8->intf->node_map[i] , (latch8->value >> i) & 1);
}
}
@@ -196,7 +195,11 @@ static DEVICE_START( latch8 )
/* setup nodemap */
for (i=0; i<8; i++)
if (latch8->intf->node_map[i] )
+ {
+ if (!latch8->intf->node_device[i])
+ fatalerror("Device %s: Bit %d has invalid discrete device\n", device->tag, i);
latch8->has_node_map = 1;
+ }
/* setup device read handlers */
for (i=0; i<8; i++)
diff --git a/src/emu/machine/latch8.h b/src/emu/machine/latch8.h
index 3455a259de9..2c9732d6971 100644
--- a/src/emu/machine/latch8.h
+++ b/src/emu/machine/latch8.h
@@ -40,6 +40,7 @@ struct _latch8_config
UINT32 xor; /* after mask */
UINT32 nosync;
UINT32 node_map[8];
+ const char * node_device[8];
latch8_devread devread[8];
};
@@ -64,7 +65,8 @@ struct _latch8_config
MDRV_DEVICE_CONFIG_DATA32(latch8_config, nosync, _nosync)
/* Write bit to discrete node */
-#define MDRV_LATCH8_DISCRETE_NODE(_bit, _node) \
+#define MDRV_LATCH8_DISCRETE_NODE(_device, _bit, _node) \
+ MDRV_DEVICE_CONFIG_DATA32_ARRAY(latch8_config, node_device, _bit, _device) \
MDRV_DEVICE_CONFIG_DATA32_ARRAY(latch8_config, node_map, _bit, _node)
/* Upon read, replace bits by reading from another device handler */
diff --git a/src/emu/machine/ldcore.c b/src/emu/machine/ldcore.c
index 179389d0067..349b078cd33 100644
--- a/src/emu/machine/ldcore.c
+++ b/src/emu/machine/ldcore.c
@@ -15,7 +15,6 @@
#include "streams.h"
#include "vbiparse.h"
#include "config.h"
-#include "sound/custom.h"
@@ -105,7 +104,7 @@ struct _ldcore_data
UINT32 audiobufout; /* output index */
UINT32 audiocursamples; /* current samples this track */
UINT32 audiomaxsamples; /* maximum samples per track */
- int audiocustom; /* custom sound index */
+ const device_config *audiocustom; /* custom sound device */
/* metadata */
vbi_metadata metadata[2]; /* metadata parsed from the stream, for each field */
@@ -145,7 +144,7 @@ struct _sound_token
static TIMER_CALLBACK( perform_player_update );
static void read_track_data(laserdisc_state *ld);
static void process_track_data(const device_config *device);
-static CUSTOM_START( custom_start );
+static DEVICE_START( laserdisc_sound );
static STREAM_UPDATE( custom_stream_callback );
static void configuration_load(running_machine *machine, int config_type, xml_data_node *parentnode);
static void configuration_save(running_machine *machine, int config_type, xml_data_node *parentnode);
@@ -167,11 +166,6 @@ static const ldplayer_interface *const player_interfaces[] =
&vp931_interface
};
-const custom_sound_interface laserdisc_custom_interface =
-{
- custom_start
-};
-
/***************************************************************************
@@ -198,11 +192,12 @@ INLINE laserdisc_state *get_safe_token(const device_config *device)
current time
-------------------------------------------------*/
-INLINE void update_audio(ldcore_data *ldcore)
+INLINE void update_audio(laserdisc_state *ld)
{
- if (ldcore->audiocustom != -1)
+ ldcore_data *ldcore = ld->core;
+ if (ldcore->audiocustom != NULL)
{
- sound_token *token = custom_get_token(ldcore->audiocustom);
+ sound_token *token = ldcore->audiocustom->token;
stream_update(token->stream);
}
}
@@ -338,7 +333,7 @@ static TIMER_CALLBACK( perform_player_update )
add_and_clamp_track(ldcore, (*ldcore->intf.update)(ld, &ldcore->metadata[ldcore->fieldnum], ldcore->fieldnum, curtime));
/* flush any audio before we read more */
- update_audio(ldcore);
+ update_audio(ld);
/* start reading the track data for the next round */
ldcore->fieldnum ^= 1;
@@ -530,7 +525,7 @@ laserdisc_state *ldcore_get_safe_token(const device_config *device)
void ldcore_set_audio_squelch(laserdisc_state *ld, UINT8 squelchleft, UINT8 squelchright)
{
- update_audio(ld->core);
+ update_audio(ld);
ld->core->audiosquelch = (squelchleft ? 1 : 0) | (squelchright ? 2 : 0);
}
@@ -939,16 +934,37 @@ static void process_track_data(const device_config *device)
/*-------------------------------------------------
- custom_start - custom audio start
+ laserdisc_sound_start - custom audio start
for laserdiscs
-------------------------------------------------*/
-static CUSTOM_START( custom_start )
+static DEVICE_START( laserdisc_sound )
{
- sound_token *token = auto_malloc(sizeof(*token));
+ sound_token *token = device->token;
token->stream = stream_create(device, 0, 2, 48000, token, custom_stream_callback);
token->ld = NULL;
- return token;
+}
+
+
+/*-------------------------------------------------
+ laserdisc_sound_get_info - information
+ callback for laserdisc audio
+-------------------------------------------------*/
+
+DEVICE_GET_INFO( laserdisc_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as 64-bit signed integers --- */
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(sound_token); break;
+
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(laserdisc_sound);break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Laserdisc Analog"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
}
@@ -1412,19 +1428,9 @@ static void init_audio(const device_config *device)
{
laserdisc_state *ld = get_safe_token(device);
ldcore_data *ldcore = ld->core;
- int sndnum;
/* find the custom audio */
- ldcore->audiocustom = 0;
- for (sndnum = 0; sndnum < MAX_SOUND; sndnum++)
- {
- if (device->machine->config->sound[sndnum].tag != NULL && strcmp(device->machine->config->sound[sndnum].tag, ldcore->config.sound) == 0)
- break;
- if (device->machine->config->sound[sndnum].type == SOUND_CUSTOM)
- ldcore->audiocustom++;
- }
- if (sndnum == MAX_SOUND)
- ldcore->audiocustom = -1;
+ ldcore->audiocustom = devtag_get_device(device->machine, SOUND, ldcore->config.sound);
/* allocate audio buffers */
ldcore->audiomaxsamples = ((UINT64)ldcore->samplerate * 1000000 + ldcore->fps_times_1million - 1) / ldcore->fps_times_1million;
@@ -1541,9 +1547,9 @@ static DEVICE_RESET( laserdisc )
ldcore->intf = *player_interfaces[pltype];
/* attempt to wire up the audio */
- if (ldcore->audiocustom != -1)
+ if (ldcore->audiocustom != NULL)
{
- sound_token *token = custom_get_token(ldcore->audiocustom);
+ sound_token *token = ldcore->audiocustom->token;
token->ld = ld;
stream_set_sample_rate(token->stream, ldcore->samplerate);
}
diff --git a/src/emu/machine/pcshare.h b/src/emu/machine/pcshare.h
index cb877e2777e..6696e3215b4 100644
--- a/src/emu/machine/pcshare.h
+++ b/src/emu/machine/pcshare.h
@@ -1,5 +1,3 @@
-#include "sound/custom.h"
-
/* flags for init_pc_common */
#define PCCOMMON_KEYBOARD_PC 0
#define PCCOMMON_KEYBOARD_AT 1
diff --git a/src/emu/machine/scsicd.c b/src/emu/machine/scsicd.c
index 74ad9f105ed..add7d134dd0 100644
--- a/src/emu/machine/scsicd.c
+++ b/src/emu/machine/scsicd.c
@@ -45,7 +45,7 @@ static int scsicd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode )
SCSICd *our_this = SCSIThis( &SCSIClassCDROM, scsiInstance );
cdrom_file *cdrom = our_this->cdrom;
- int cddanum;
+ const device_config *cdda;
int trk;
SCSIGetCommand( scsiInstance, &command, &commandLength );
@@ -71,10 +71,10 @@ static int scsicd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode )
return SCSILengthFromUINT8( &command[ 4 ] );
case 0x1b: // START STOP UNIT
- cddanum = cdda_num_from_cdrom(cdrom);
- if (cddanum != -1)
+ cdda = cdda_from_cdrom(scsiInstance->machine, cdrom);
+ if (cdda != NULL)
{
- cdda_stop_audio(cddanum);
+ cdda_stop_audio(cdda);
}
SCSISetPhase( scsiInstance, SCSI_PHASE_STATUS );
return 0;
@@ -104,10 +104,10 @@ static int scsicd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode )
our_this->cur_subblock = 0;
}
- cddanum = cdda_num_from_cdrom(cdrom);
- if (cddanum != -1)
+ cdda = cdda_from_cdrom(scsiInstance->machine, cdrom);
+ if (cdda != NULL)
{
- cdda_stop_audio(cddanum);
+ cdda_stop_audio(cdda);
}
SCSISetPhase( scsiInstance, SCSI_PHASE_DATAIN );
@@ -144,10 +144,10 @@ static int scsicd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode )
length = 4;
}
- cddanum = cdda_num_from_cdrom(cdrom);
- if (cddanum != -1)
+ cdda = cdda_from_cdrom(scsiInstance->machine, cdrom);
+ if (cdda != NULL)
{
- cdda_stop_audio(cddanum);
+ cdda_stop_audio(cdda);
}
SCSISetPhase( scsiInstance, SCSI_PHASE_DATAIN );
@@ -174,9 +174,9 @@ static int scsicd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode )
if (cdrom_get_track_type(cdrom, trk) == CD_TRACK_AUDIO)
{
our_this->play_err_flag = 0;
- cddanum = cdda_num_from_cdrom(cdrom);
- if (cddanum != -1)
- cdda_start_audio(cddanum, our_this->lba, our_this->blocks);
+ cdda = cdda_from_cdrom(scsiInstance->machine, cdrom);
+ if (cdda != NULL)
+ cdda_start_audio(cdda, our_this->lba, our_this->blocks);
}
else
{
@@ -204,9 +204,9 @@ static int scsicd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode )
if (our_this->blocks && cdrom)
{
- cddanum = cdda_num_from_cdrom(cdrom);
- if (cddanum != -1)
- cdda_start_audio(cddanum, our_this->lba, our_this->blocks);
+ cdda = cdda_from_cdrom(scsiInstance->machine, cdrom);
+ if (cdda != NULL)
+ cdda_start_audio(cdda, our_this->lba, our_this->blocks);
}
logerror("SCSICD: PLAY AUDIO T/I: strk %d idx %d etrk %d idx %d frames %d\n", command[4], command[5], command[7], command[8], our_this->blocks);
@@ -216,9 +216,9 @@ static int scsicd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode )
case 0x4b: // PAUSE/RESUME
if (cdrom)
{
- cddanum = cdda_num_from_cdrom(cdrom);
- if (cddanum != -1)
- cdda_pause_audio(cddanum, (command[8] & 0x01) ^ 0x01);
+ cdda = cdda_from_cdrom(scsiInstance->machine, cdrom);
+ if (cdda != NULL)
+ cdda_pause_audio(cdda, (command[8] & 0x01) ^ 0x01);
}
logerror("SCSICD: PAUSE/RESUME: %s\n", command[8]&1 ? "RESUME" : "PAUSE");
@@ -255,9 +255,9 @@ static int scsicd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode )
if (cdrom_get_track_type(cdrom, trk) == CD_TRACK_AUDIO)
{
our_this->play_err_flag = 0;
- cddanum = cdda_num_from_cdrom(cdrom);
- if (cddanum != -1)
- cdda_start_audio(cddanum, our_this->lba, our_this->blocks);
+ cdda = cdda_from_cdrom(scsiInstance->machine, cdrom);
+ if (cdda != NULL)
+ cdda_start_audio(cdda, our_this->lba, our_this->blocks);
}
else
{
@@ -283,10 +283,10 @@ static int scsicd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode )
our_this->cur_subblock = 0;
}
- cddanum = cdda_num_from_cdrom(cdrom);
- if (cddanum != -1)
+ cdda = cdda_from_cdrom(scsiInstance->machine, cdrom);
+ if (cdda != NULL)
{
- cdda_stop_audio(cddanum);
+ cdda_stop_audio(cdda);
}
SCSISetPhase( scsiInstance, SCSI_PHASE_DATAIN );
@@ -317,7 +317,7 @@ static void scsicd_read_data( SCSIInstance *scsiInstance, UINT8 *data, int dataL
cdrom_file *cdrom = our_this->cdrom;
UINT32 temp;
UINT8 tmp_buffer[2048];
- int cddanum;
+ const device_config *cdda;
SCSIGetCommand( scsiInstance, &command, &commandLength );
@@ -330,8 +330,8 @@ static void scsicd_read_data( SCSIInstance *scsiInstance, UINT8 *data, int dataL
data[0] = 0x71; // deferred error
- cddanum = cdda_num_from_cdrom(cdrom);
- if (cddanum != -1 && cdda_audio_active(cddanum))
+ cdda = cdda_from_cdrom(scsiInstance->machine, cdrom);
+ if (cdda != NULL && cdda_audio_active(cdda))
{
data[12] = 0x00;
data[13] = 0x11; // AUDIO PLAY OPERATION IN PROGRESS
@@ -423,11 +423,11 @@ static void scsicd_read_data( SCSIInstance *scsiInstance, UINT8 *data, int dataL
msf = command[1] & 0x2;
- cddanum = cdda_num_from_cdrom(cdrom);
- audio_active = cddanum != -1 && cdda_audio_active(cddanum);
+ cdda = cdda_from_cdrom(scsiInstance->machine, cdrom);
+ audio_active = cdda != NULL && cdda_audio_active(cdda);
if (audio_active)
{
- if (cdda_audio_paused(cddanum))
+ if (cdda_audio_paused(cdda))
{
data[1] = 0x12; // audio is paused
}
@@ -438,7 +438,7 @@ static void scsicd_read_data( SCSIInstance *scsiInstance, UINT8 *data, int dataL
}
else
{
- if (cddanum != -1 && cdda_audio_ended(cddanum))
+ if (cdda != NULL && cdda_audio_ended(cdda))
{
data[1] = 0x13; // ended successfully
}
@@ -452,7 +452,7 @@ static void scsicd_read_data( SCSIInstance *scsiInstance, UINT8 *data, int dataL
// if audio is playing, get the latest LBA from the CDROM layer
if (audio_active)
{
- our_this->last_lba = cdda_get_audio_lba(cddanum);
+ our_this->last_lba = cdda_get_audio_lba(cdda);
}
else
{
diff --git a/src/emu/mame.c b/src/emu/mame.c
index 18a15de9157..938bff007da 100644
--- a/src/emu/mame.c
+++ b/src/emu/mame.c
@@ -25,7 +25,6 @@
- calls init_machine() [mame.c]
init_machine() [mame.c]
- - calls sndintrf_init() [sndintrf.c] to determine which sound chips are available
- calls fileio_init() [fileio.c] to initialize file I/O info
- calls config_init() [config.c] to initialize configuration system
- calls input_init() [input.c] to initialize the input system
@@ -86,6 +85,7 @@
#include "ui.h"
#include "uimenu.h"
#include "uiinput.h"
+#include "streams.h"
#include "deprecat.h"
#include "debug/debugcon.h"
@@ -1470,7 +1470,6 @@ static void init_machine(running_machine *machine)
time_t newbase;
/* initialize basic can't-fail systems here */
- sndintrf_init(machine);
fileio_init(machine);
config_init(machine);
input_init(machine);
@@ -1508,6 +1507,9 @@ static void init_machine(running_machine *machine)
/* intialize UI input */
ui_input_init(machine);
+
+ /* initialize the streams engine before the sound devices start */
+ streams_init(machine);
/* first load ROMs, then populate memory, and finally initialize CPUs */
/* these operations must proceed in this order */
diff --git a/src/emu/mconfig.c b/src/emu/mconfig.c
index b3c3e5ff332..a93e17a92a2 100644
--- a/src/emu/mconfig.c
+++ b/src/emu/mconfig.c
@@ -58,94 +58,16 @@ machine_config *machine_config_alloc(const machine_config_token *tokens)
void machine_config_free(machine_config *config)
{
- int soundnum;
-
/* release the device list */
while (config->devicelist != NULL)
device_list_remove(&config->devicelist, config->devicelist->type, config->devicelist->tag);
- /* release the strings */
- for (soundnum = 0; soundnum < ARRAY_LENGTH(config->soundtag); soundnum++)
- if (config->soundtag[soundnum] != NULL)
- astring_free(config->soundtag[soundnum]);
-
/* release the configuration itself */
free(config);
}
/*-------------------------------------------------
- sound_add - add a sound system during
- machine driver expansion
--------------------------------------------------*/
-
-static sound_config *sound_add(machine_config *machine, const char *tag, sound_type type, int clock)
-{
- int soundnum;
-
- for (soundnum = 0; soundnum < MAX_SOUND; soundnum++)
- if (machine->sound[soundnum].type == SOUND_DUMMY)
- {
- if (machine->soundtag[soundnum] == NULL)
- machine->soundtag[soundnum] = astring_alloc();
- astring_cpyc(machine->soundtag[soundnum], tag);
- machine->sound[soundnum].tag = astring_c(machine->soundtag[soundnum]);
- machine->sound[soundnum].type = type;
- machine->sound[soundnum].clock = clock;
- machine->sound[soundnum].config = NULL;
- machine->sound[soundnum].routes = 0;
- return &machine->sound[soundnum];
- }
-
- fatalerror("Out of sounds!\n");
- return NULL;
-}
-
-
-/*-------------------------------------------------
- sound_find - find a tagged sound system during
- machine driver expansion
--------------------------------------------------*/
-
-static sound_config *sound_find(machine_config *machine, const char *tag)
-{
- int soundnum;
-
- for (soundnum = 0; soundnum < MAX_SOUND; soundnum++)
- if (machine->sound[soundnum].tag && strcmp(machine->sound[soundnum].tag, tag) == 0)
- return &machine->sound[soundnum];
-
- fatalerror("Can't find sound '%s'!\n", tag);
- return NULL;
-}
-
-
-/*-------------------------------------------------
- sound_remove - remove a tagged sound system
- during machine driver expansion
--------------------------------------------------*/
-
-static void sound_remove(machine_config *machine, const char *tag)
-{
- int soundnum;
-
- for (soundnum = 0; soundnum < MAX_SOUND; soundnum++)
- if (machine->sound[soundnum].tag && strcmp(machine->sound[soundnum].tag, tag) == 0)
- {
- if (machine->soundtag[soundnum] != NULL)
- astring_free(machine->soundtag[soundnum]);
- memmove(&machine->sound[soundnum], &machine->sound[soundnum + 1], sizeof(machine->sound[0]) * (MAX_SOUND - soundnum - 1));
- memmove(&machine->soundtag[soundnum], &machine->soundtag[soundnum + 1], sizeof(machine->soundtag[0]) * (MAX_SOUND - soundnum - 1));
- memset(&machine->sound[MAX_SOUND - 1], 0, sizeof(machine->sound[0]));
- memset(&machine->soundtag[MAX_SOUND - 1], 0, sizeof(machine->soundtag[0]));
- return;
- }
-
- fatalerror("Can't find sound '%s'!\n", tag);
-}
-
-
-/*-------------------------------------------------
machine_config_detokenize - detokenize a
machine config
-------------------------------------------------*/
@@ -155,15 +77,13 @@ static void machine_config_detokenize(machine_config *config, const machine_conf
UINT32 entrytype = MCONFIG_TOKEN_INVALID;
astring *tempstring = astring_alloc();
device_config *device = NULL;
- sound_config *sound = NULL;
/* loop over tokens until we hit the end */
while (entrytype != MCONFIG_TOKEN_END)
{
- int size, offset, bits, in, out;
- UINT32 data32, clock, gain;
+ int size, offset, bits;
+ UINT32 data32, clock;
device_type devtype;
- sound_type type;
const char *tag;
UINT64 data64;
@@ -358,57 +278,6 @@ static void machine_config_detokenize(machine_config *config, const machine_conf
config->sound_reset = TOKEN_GET_PTR(tokens, sound_reset);
break;
- /* add/remove/replace sounds */
- case MCONFIG_TOKEN_SOUND_ADD:
- TOKEN_UNGET_UINT32(tokens);
- TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, clock, 32);
- type = TOKEN_GET_PTR(tokens, sndtype);
- tag = TOKEN_GET_STRING(tokens);
- sound = sound_add(config, device_build_tag(tempstring, owner, tag), type, clock);
- break;
-
- case MCONFIG_TOKEN_SOUND_REMOVE:
- sound_remove(config, TOKEN_GET_STRING(tokens));
- break;
-
- case MCONFIG_TOKEN_SOUND_MODIFY:
- tag = TOKEN_GET_STRING(tokens);
- sound = sound_find(config, device_build_tag(tempstring, owner, tag));
- if (sound == NULL)
- fatalerror("Unable to find sound: tag=%s\n", astring_c(tempstring));
- sound->routes = 0;
- break;
-
- case MCONFIG_TOKEN_SOUND_CONFIG:
- assert(sound != NULL);
- sound->config = TOKEN_GET_PTR(tokens, voidptr);
- break;
-
- case MCONFIG_TOKEN_SOUND_REPLACE:
- TOKEN_UNGET_UINT32(tokens);
- TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, clock, 32);
- type = TOKEN_GET_PTR(tokens, sndtype);
- tag = TOKEN_GET_STRING(tokens);
- sound = sound_find(config, device_build_tag(tempstring, owner, tag));
- if (sound == NULL)
- fatalerror("Unable to find sound: tag=%s\n", astring_c(tempstring));
- sound->type = type;
- sound->clock = clock;
- sound->config = NULL;
- sound->routes = 0;
- break;
-
- case MCONFIG_TOKEN_SOUND_ROUTE:
- assert(sound != NULL);
- TOKEN_UNGET_UINT32(tokens);
- TOKEN_GET_UINT64_UNPACK4(tokens, entrytype, 8, out, -12, in, -12, gain, 32);
- sound->route[sound->routes].input = in;
- sound->route[sound->routes].output = out;
- sound->route[sound->routes].gain = (float)gain / 16777216.0f;
- sound->route[sound->routes].target = TOKEN_GET_STRING(tokens);
- sound->routes++;
- break;
-
default:
fatalerror("Invalid token %d in machine config\n", entrytype);
break;
diff --git a/src/emu/mconfig.h b/src/emu/mconfig.h
index c5228374dde..e0ca465edf5 100644
--- a/src/emu/mconfig.h
+++ b/src/emu/mconfig.h
@@ -137,9 +137,6 @@ struct _machine_config
video_eof_func video_eof; /* end-of-frame video callback */
video_update_func video_update; /* video update callback */
- sound_config sound[MAX_SOUND]; /* array of sound chips in the system */
- astring * soundtag[MAX_SOUND]; /* allocated strings for each sound tag */
-
sound_start_func sound_start; /* one-time sound start callback */
sound_reset_func sound_reset; /* sound reset callback */
@@ -173,7 +170,6 @@ union _machine_config_token
palette_init_func palette_init;
video_eof_func video_eof;
video_update_func video_update;
- sound_type sndtype;
};
@@ -199,78 +195,6 @@ union _machine_config_token
TOKEN_PTR(tokenptr, machine_config_##_name),
-/* add/remove/config devices */
-#define MDRV_DEVICE_ADD(_tag, _type, _clock) \
- TOKEN_UINT64_PACK2(MCONFIG_TOKEN_DEVICE_ADD, 8, _clock, 32), \
- TOKEN_PTR(devtype, _type), \
- TOKEN_STRING(_tag),
-
-#define MDRV_DEVICE_REMOVE(_tag, _type) \
- TOKEN_UINT32_PACK1(MCONFIG_TOKEN_DEVICE_REMOVE, 8), \
- TOKEN_PTR(devtype, _type), \
- TOKEN_STRING(_tag),
-
-#define MDRV_DEVICE_MODIFY(_tag, _type) \
- TOKEN_UINT32_PACK1(MCONFIG_TOKEN_DEVICE_MODIFY, 8), \
- TOKEN_PTR(devtype, _type), \
- TOKEN_STRING(_tag),
-
-#define MDRV_DEVICE_CONFIG(_config) \
- TOKEN_UINT32_PACK1(MCONFIG_TOKEN_DEVICE_CONFIG, 8), \
- TOKEN_PTR(voidptr, &(_config)),
-
-#define MDRV_DEVICE_CLOCK(_clock) \
- TOKEN_UINT64_PACK2(MCONFIG_TOKEN_DEVICE_CLOCK, 8, _clock, 32),
-
-#define structsizeof(_struct, _field) sizeof(((_struct *)NULL)->_field)
-
-#define MDRV_DEVICE_CONFIG_DATA32_EXPLICIT(_size, _offset, _val) \
- TOKEN_UINT32_PACK3(MCONFIG_TOKEN_DEVICE_CONFIG_DATA32, 8, (_size), 6, (_offset), 12), \
- TOKEN_UINT32((UINT32)(_val)),
-
-#define MDRV_DEVICE_CONFIG_DATA32(_struct, _field, _val) \
- MDRV_DEVICE_CONFIG_DATA32_EXPLICIT(structsizeof(_struct, _field), offsetof(_struct, _field), _val)
-
-#define MDRV_DEVICE_CONFIG_DATA32_ARRAY(_struct, _field, _index, _val) \
- MDRV_DEVICE_CONFIG_DATA32_EXPLICIT(structsizeof(_struct, _field[0]), offsetof(_struct, _field) + (_index) * structsizeof(_struct, _field[0]), _val)
-
-#define MDRV_DEVICE_CONFIG_DATA32_ARRAY_MEMBER(_struct, _field, _index, _memstruct, _member, _val) \
- MDRV_DEVICE_CONFIG_DATA32_EXPLICIT(structsizeof(_memstruct, _member), offsetof(_struct, _field) + (_index) * structsizeof(_struct, _field[0]) + offsetof(_memstruct, _member), _val)
-
-#define MDRV_DEVICE_CONFIG_DATA64_EXPLICIT(_size, _offset, _val) \
- TOKEN_UINT32_PACK3(MCONFIG_TOKEN_DEVICE_CONFIG_DATA64, 8, (_size), 6, (_offset), 12), \
- TOKEN_UINT64((UINT64)(_val)),
-
-#define MDRV_DEVICE_CONFIG_DATA64(_struct, _field, _val) \
- MDRV_DEVICE_CONFIG_DATA64_EXPLICIT(structsizeof(_struct, _field), offsetof(_struct, _field), _val)
-
-#define MDRV_DEVICE_CONFIG_DATA64_ARRAY(_struct, _field, _index, _val) \
- MDRV_DEVICE_CONFIG_DATA64_EXPLICIT(structsizeof(_struct, _field[0]), offsetof(_struct, _field) + (_index) * structsizeof(_struct, _field[0]), _val)
-
-#define MDRV_DEVICE_CONFIG_DATA64_ARRAY_MEMBER(_struct, _field, _index, _memstruct, _member, _val) \
- MDRV_DEVICE_CONFIG_DATA64_EXPLICIT(structsizeof(_memstruct, _member), offsetof(_struct, _field) + (_index) * structsizeof(_struct, _field[0]) + offsetof(_memstruct, _member), _val)
-
-#define MDRV_DEVICE_CONFIG_DATAFP32(_struct, _field, _val, _fixbits) \
- TOKEN_UINT32_PACK4(MCONFIG_TOKEN_DEVICE_CONFIG_DATAFP32, 8, structsizeof(_struct, _field), 6, _fixbits, 6, offsetof(_struct, _field), 12), \
- TOKEN_UINT32((INT32)((float)(_val) * (float)(1 << (_fixbits)))),
-
-#define MDRV_DEVICE_CONFIG_DATAFP64(_struct, _field, _val, _fixbits) \
- TOKEN_UINT32_PACK4(MCONFIG_TOKEN_DEVICE_CONFIG_DATAFP64, 8, structsizeof(_struct, _field), 6, _fixbits, 6, offsetof(_struct, _field), 12), \
- TOKEN_UINT64((INT64)((float)(_val) * (float)((UINT64)1 << (_fixbits)))),
-
-#ifdef PTR64
-#define MDRV_DEVICE_CONFIG_DATAPTR_EXPLICIT(_struct, _size, _offset) MDRV_DEVICE_CONFIG_DATA64_EXPLICIT(_struct, _size, _offset)
-#define MDRV_DEVICE_CONFIG_DATAPTR(_struct, _field, _val) MDRV_DEVICE_CONFIG_DATA64(_struct, _field, _val)
-#define MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(_struct, _field, _index, _val) MDRV_DEVICE_CONFIG_DATA64_ARRAY(_struct, _field, _index, _val)
-#define MDRV_DEVICE_CONFIG_DATAPTR_ARRAY_MEMBER(_struct, _field, _index, _memstruct, _member, _val) MDRV_DEVICE_CONFIG_DATA64_ARRAY_MEMBER(_struct, _field, _index, _memstruct, _member, _val)
-#else
-#define MDRV_DEVICE_CONFIG_DATAPTR_EXPLICIT(_struct, _size, _offset) MDRV_DEVICE_CONFIG_DATA32_EXPLICIT(_struct, _size, _offset)
-#define MDRV_DEVICE_CONFIG_DATAPTR(_struct, _field, _val) MDRV_DEVICE_CONFIG_DATA32(_struct, _field, _val)
-#define MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(_struct, _field, _index, _val) MDRV_DEVICE_CONFIG_DATA32_ARRAY(_struct, _field, _index, _val)
-#define MDRV_DEVICE_CONFIG_DATAPTR_ARRAY_MEMBER(_struct, _field, _index, _memstruct, _member, _val) MDRV_DEVICE_CONFIG_DATA32_ARRAY_MEMBER(_struct, _field, _index, _memstruct, _member, _val)
-#endif
-
-
/* core parameters */
#define MDRV_DRIVER_DATA(_struct) \
TOKEN_UINT32_PACK2(MCONFIG_TOKEN_DRIVER_DATA, 8, sizeof(_struct), 24),
@@ -347,24 +271,6 @@ union _machine_config_token
TOKEN_PTR(video_update, video_update_##_func),
-/* add/remove speakers */
-#define MDRV_SPEAKER_ADD(_tag, _x, _y, _z) \
- MDRV_DEVICE_ADD(_tag, SPEAKER_OUTPUT, 0) \
- MDRV_DEVICE_CONFIG_DATAFP32(speaker_config, x, _x, 24) \
- MDRV_DEVICE_CONFIG_DATAFP32(speaker_config, y, _y, 24) \
- MDRV_DEVICE_CONFIG_DATAFP32(speaker_config, z, _z, 24)
-
-#define MDRV_SPEAKER_REMOVE(_tag) \
- MDRV_DEVICE_REMOVE(_tag, SPEAKER_OUTPUT)
-
-#define MDRV_SPEAKER_STANDARD_MONO(_tag) \
- MDRV_SPEAKER_ADD(_tag, 0.0, 0.0, 1.0)
-
-#define MDRV_SPEAKER_STANDARD_STEREO(_tagl, _tagr) \
- MDRV_SPEAKER_ADD(_tagl, -0.2, 0.0, 1.0) \
- MDRV_SPEAKER_ADD(_tagr, 0.2, 0.0, 1.0)
-
-
/* core sound functions */
#define MDRV_SOUND_START(_func) \
TOKEN_UINT32_PACK1(MCONFIG_TOKEN_SOUND_START, 8), \
@@ -375,35 +281,95 @@ union _machine_config_token
TOKEN_PTR(sound_start, sound_reset_##_func),
-/* add/remove/replace sounds */
-#define MDRV_SOUND_ADD(_tag, _type, _clock) \
- TOKEN_UINT64_PACK2(MCONFIG_TOKEN_SOUND_ADD, 8, _clock, 32), \
- TOKEN_PTR(sndtype, SOUND_##_type), \
+/* add/remove devices */
+#define MDRV_DEVICE_ADD(_tag, _type, _clock) \
+ TOKEN_UINT64_PACK2(MCONFIG_TOKEN_DEVICE_ADD, 8, _clock, 32), \
+ TOKEN_PTR(devtype, _type), \
TOKEN_STRING(_tag),
-#define MDRV_SOUND_REMOVE(_tag) \
- TOKEN_UINT32_PACK1(MCONFIG_TOKEN_SOUND_REMOVE, 8), \
+#define MDRV_DEVICE_REMOVE(_tag, _type) \
+ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_DEVICE_REMOVE, 8), \
+ TOKEN_PTR(devtype, _type), \
TOKEN_STRING(_tag),
-#define MDRV_SOUND_MODIFY(_tag) \
- TOKEN_UINT32_PACK1(MCONFIG_TOKEN_SOUND_MODIFY, 8), \
+#define MDRV_DEVICE_MODIFY(_tag, _type) \
+ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_DEVICE_MODIFY, 8), \
+ TOKEN_PTR(devtype, _type), \
TOKEN_STRING(_tag),
-#define MDRV_SOUND_CONFIG(_config) \
- TOKEN_UINT32_PACK1(MCONFIG_TOKEN_SOUND_CONFIG, 8), \
+
+/* configure devices */
+#define MDRV_DEVICE_CONFIG(_config) \
+ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_DEVICE_CONFIG, 8), \
TOKEN_PTR(voidptr, &(_config)),
-#define MDRV_SOUND_REPLACE(_tag, _type, _clock) \
- TOKEN_UINT64_PACK2(MCONFIG_TOKEN_SOUND_REPLACE, 8, _clock, 32), \
- TOKEN_PTR(sndtype, SOUND_##_type), \
- TOKEN_STRING(_tag),
+#define MDRV_DEVICE_CONFIG_CLEAR() \
+ TOKEN_UINT32_PACK1(MCONFIG_TOKEN_DEVICE_CONFIG, 8), \
+ TOKEN_PTR(voidptr, NULL),
-#define MDRV_SOUND_ROUTE_EX(_output, _target, _gain, _input) \
- TOKEN_UINT64_PACK4(MCONFIG_TOKEN_SOUND_ROUTE, 8, _output, 12, _input, 12, (UINT32)((float)(_gain) * 16777216.0f), 32), \
- TOKEN_STRING(_target),
+#define MDRV_DEVICE_CLOCK(_clock) \
+ TOKEN_UINT64_PACK2(MCONFIG_TOKEN_DEVICE_CLOCK, 8, _clock, 32),
+
+#define structsizeof(_struct, _field) sizeof(((_struct *)NULL)->_field)
+
+
+/* inline device configurations that require 32 bits of storage in the token */
+#define MDRV_DEVICE_CONFIG_DATA32_EXPLICIT(_size, _offset, _val) \
+ TOKEN_UINT32_PACK3(MCONFIG_TOKEN_DEVICE_CONFIG_DATA32, 8, _size, 6, _offset, 12), \
+ TOKEN_UINT32((UINT32)(_val)),
-#define MDRV_SOUND_ROUTE(_output, _target, _gain) \
- MDRV_SOUND_ROUTE_EX(_output, _target, _gain, -1)
+#define MDRV_DEVICE_CONFIG_DATA32(_struct, _field, _val) \
+ MDRV_DEVICE_CONFIG_DATA32_EXPLICIT(structsizeof(_struct, _field), offsetof(_struct, _field), _val)
+
+#define MDRV_DEVICE_CONFIG_DATA32_ARRAY(_struct, _field, _index, _val) \
+ MDRV_DEVICE_CONFIG_DATA32_EXPLICIT(structsizeof(_struct, _field[0]), offsetof(_struct, _field) + (_index) * structsizeof(_struct, _field[0]), _val)
+
+#define MDRV_DEVICE_CONFIG_DATA32_ARRAY_MEMBER(_struct, _field, _index, _memstruct, _member, _val) \
+ MDRV_DEVICE_CONFIG_DATA32_EXPLICIT(structsizeof(_memstruct, _member), offsetof(_struct, _field) + (_index) * structsizeof(_struct, _field[0]) + offsetof(_memstruct, _member), _val)
+
+
+/* inline device configurations that require 32 bits of fixed-point storage in the token */
+#define MDRV_DEVICE_CONFIG_DATAFP32_EXPLICIT(_size, _offset, _val, _fixbits) \
+ TOKEN_UINT32_PACK4(MCONFIG_TOKEN_DEVICE_CONFIG_DATAFP32, 8, _size, 6, _fixbits, 6, _offset, 12), \
+ TOKEN_UINT32((INT32)((float)(_val) * (float)(1 << (_fixbits)))),
+
+#define MDRV_DEVICE_CONFIG_DATAFP32(_struct, _field, _val, _fixbits) \
+ MDRV_DEVICE_CONFIG_DATAFP32_EXPLICIT(structsizeof(_struct, _field), offsetof(_struct, _field), _val, _fixbits)
+
+#define MDRV_DEVICE_CONFIG_DATAFP32_ARRAY(_struct, _field, _index, _val, _fixbits) \
+ MDRV_DEVICE_CONFIG_DATAFP32_EXPLICIT(structsizeof(_struct, _field[0]), offsetof(_struct, _field) + (_index) * structsizeof(_struct, _field[0]), _val, _fixbits)
+
+#define MDRV_DEVICE_CONFIG_DATAFP32_ARRAY_MEMBER(_struct, _field, _index, _memstruct, _member, _val, _fixbits) \
+ MDRV_DEVICE_CONFIG_DATAFP32_EXPLICIT(structsizeof(_memstruct, _member), offsetof(_struct, _field) + (_index) * structsizeof(_struct, _field[0]) + offsetof(_memstruct, _member), _val, _fixbits)
+
+
+/* inline device configurations that require 64 bits of storage in the token */
+#define MDRV_DEVICE_CONFIG_DATA64_EXPLICIT(_size, _offset, _val) \
+ TOKEN_UINT32_PACK3(MCONFIG_TOKEN_DEVICE_CONFIG_DATA64, 8, _size, 6, _offset, 12), \
+ TOKEN_UINT64((UINT64)(_val)),
+
+#define MDRV_DEVICE_CONFIG_DATA64(_struct, _field, _val) \
+ MDRV_DEVICE_CONFIG_DATA64_EXPLICIT(structsizeof(_struct, _field), offsetof(_struct, _field), _val)
+
+#define MDRV_DEVICE_CONFIG_DATA64_ARRAY(_struct, _field, _index, _val) \
+ MDRV_DEVICE_CONFIG_DATA64_EXPLICIT(structsizeof(_struct, _field[0]), offsetof(_struct, _field) + (_index) * structsizeof(_struct, _field[0]), _val)
+
+#define MDRV_DEVICE_CONFIG_DATA64_ARRAY_MEMBER(_struct, _field, _index, _memstruct, _member, _val) \
+ MDRV_DEVICE_CONFIG_DATA64_EXPLICIT(structsizeof(_memstruct, _member), offsetof(_struct, _field) + (_index) * structsizeof(_struct, _field[0]) + offsetof(_memstruct, _member), _val)
+
+
+/* inline device configurations that require a pointer-sized amount of storage in the token */
+#ifdef PTR64
+#define MDRV_DEVICE_CONFIG_DATAPTR_EXPLICIT(_struct, _size, _offset) MDRV_DEVICE_CONFIG_DATA64_EXPLICIT(_struct, _size, _offset)
+#define MDRV_DEVICE_CONFIG_DATAPTR(_struct, _field, _val) MDRV_DEVICE_CONFIG_DATA64(_struct, _field, _val)
+#define MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(_struct, _field, _index, _val) MDRV_DEVICE_CONFIG_DATA64_ARRAY(_struct, _field, _index, _val)
+#define MDRV_DEVICE_CONFIG_DATAPTR_ARRAY_MEMBER(_struct, _field, _index, _memstruct, _member, _val) MDRV_DEVICE_CONFIG_DATA64_ARRAY_MEMBER(_struct, _field, _index, _memstruct, _member, _val)
+#else
+#define MDRV_DEVICE_CONFIG_DATAPTR_EXPLICIT(_struct, _size, _offset) MDRV_DEVICE_CONFIG_DATA32_EXPLICIT(_struct, _size, _offset)
+#define MDRV_DEVICE_CONFIG_DATAPTR(_struct, _field, _val) MDRV_DEVICE_CONFIG_DATA32(_struct, _field, _val)
+#define MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(_struct, _field, _index, _val) MDRV_DEVICE_CONFIG_DATA32_ARRAY(_struct, _field, _index, _val)
+#define MDRV_DEVICE_CONFIG_DATAPTR_ARRAY_MEMBER(_struct, _field, _index, _memstruct, _member, _val) MDRV_DEVICE_CONFIG_DATA32_ARRAY_MEMBER(_struct, _field, _index, _memstruct, _member, _val)
+#endif
diff --git a/src/emu/sndintrf.c b/src/emu/sndintrf.c
deleted file mode 100644
index 038d588cdf0..00000000000
--- a/src/emu/sndintrf.c
+++ /dev/null
@@ -1,442 +0,0 @@
-/***************************************************************************
-
- sndintrf.c
-
- Core sound interface functions and definitions.
-
- Copyright Nicola Salmoria and the MAME Team.
- Visit http://mamedev.org for licensing and usage restrictions.
-
-****************************************************************************
-
- Still to do:
- * fix drivers that used to use ADPCM
- * many cores do their own resampling; they should stop
- * many cores mix to a separate buffer; no longer necessary
-
-***************************************************************************/
-
-#include "driver.h"
-
-
-
-/***************************************************************************
- DEBUGGING
-***************************************************************************/
-
-#define VERBOSE (0)
-
-#define VPRINTF(x) do { if (VERBOSE) mame_printf_debug x; } while (0)
-
-
-
-/***************************************************************************
- TYPE DEFINITIONS
-***************************************************************************/
-
-typedef struct _sndintrf_data sndintrf_data;
-struct _sndintrf_data
-{
- sound_type sndtype; /* type index of this sound chip */
- sound_type aliastype; /* aliased type index of this sound chip */
- device_config * device; /* dummy device for now */
- int index; /* index of this sound chip */
-};
-
-
-
-/***************************************************************************
- VALIDATION MACROS
-***************************************************************************/
-
-#define VERIFY_SNDNUM(name) \
- assert_always(sndnum >= 0 && sndnum < totalsnd, #name "() called with invalid sound num!")
-
-#define VERIFY_SNDTI(name) \
- int sndnum = sndti_to_sndnum(sndtype, sndindex); \
- assert_always(sndindex >= 0 && sndindex < totalsnd && sndnum != -1, #name "() called with invalid (type,index) pair!")
-
-#define VERIFY_SNDTYPE(name) \
-
-
-
-/***************************************************************************
- GLOBAL VARIABLES
-***************************************************************************/
-
-static sndintrf_data sound[MAX_SOUND];
-static int totalsnd;
-
-
-
-/***************************************************************************
- INITIALIZATION
-***************************************************************************/
-
-/*-------------------------------------------------
- sndintrf_init - discover all linked sound
- systems and build a matrix for sound
- (type,index) pairs for the current machine
--------------------------------------------------*/
-
-void sndintrf_init(running_machine *machine)
-{
- /* zap the sound data structures */
- memset(sound, 0, sizeof(sound));
- totalsnd = 0;
-}
-
-
-/*-------------------------------------------------
- sndintrf_init_sound - initialize data for a
- particular sndnum
--------------------------------------------------*/
-
-static DEVICE_GET_INFO( sndclass )
-{
- sndintrf_data *snddata = device->inline_config;
- (*snddata->sndtype)(device, state, (sndinfo *)info);
-}
-
-int sndintrf_init_sound(running_machine *machine, int sndnum, const char *tag, sound_type sndtype, int clock, const void *config)
-{
- snd_start_func start;
- sndintrf_data *info = &sound[sndnum];
- int tokenbytes;
- int index;
- int sndidx;
-
- info->device = auto_malloc(sizeof(*info->device) + strlen(tag));
- memset(info->device, 0, sizeof(*info->device) + strlen(tag));
- info->device->type = DEVICE_GET_INFO_NAME(sndclass);
- info->device->machine = machine;
- strcpy(info->device->tag, tag);
- info->device->static_config = config;
- info->device->region = memory_region(info->device->machine, info->device->tag);
- info->device->regionbytes = memory_region_length(info->device->machine, info->device->tag);
-
- /* hack: stash the info pointer in the inline_config */
- info->device->inline_config = info;
-
- /* fill in the type and interface */
- info->sndtype = sndtype;
- info->aliastype = (sound_type)sndtype_get_info_fct(sndtype, SNDINFO_FCT_ALIAS);
- if (info->aliastype == 0)
- info->aliastype = sndtype;
- info->device->clock = clock;
-
- /* compute the index */
- for (index = 0, sndidx = 0; sndidx < totalsnd; sndidx++)
- if (sound[sndidx].aliastype == info->aliastype)
- index++;
- info->index = index;
- totalsnd++;
-
- /* allocate the token */
- tokenbytes = sndtype_get_info_int(sndtype, DEVINFO_INT_TOKEN_BYTES);
- assert(tokenbytes != 0);
- info->device->token = auto_malloc(tokenbytes);
- memset(info->device->token, 0, tokenbytes);
-
- /* start the chip, tagging all its streams */
- start = (snd_start_func)sndtype_get_info_fct(sndtype, SNDINFO_PTR_START);
- (*start)(info->device, clock);
- VPRINTF((" token = %p\n", info->device->token));
-
- return 0;
-}
-
-
-/*-------------------------------------------------
- sndintrf_exit_sound - tear down data for a
- particular sndnum
--------------------------------------------------*/
-
-void sndintrf_exit_sound(int sndnum)
-{
- sndinfo info;
-
- info.stop = NULL;
- (*sound[sndnum].sndtype)(NULL, SNDINFO_PTR_STOP, &info);
-
- /* stop the chip */
- if (info.stop)
- (*info.stop)(sound[sndnum].device);
-}
-
-
-
-/***************************************************************************
- HELPERS
-***************************************************************************/
-
-/*-------------------------------------------------
- sndti_exists - return TRUE if a (type,index)
- pair describes an existing chip
--------------------------------------------------*/
-
-int sndti_exists(sound_type type, int index)
-{
- return (sndti_to_sndnum(type, index) != -1);
-}
-
-
-/*-------------------------------------------------
- sndti_to_sndnum - map a (type,index) pair to
- a sound number
--------------------------------------------------*/
-
-int sndti_to_sndnum(sound_type type, int index)
-{
- int sndnum;
- for (sndnum = 0; sndnum < totalsnd; sndnum++)
- if (sound[sndnum].aliastype == type)
- if (index-- == 0)
- return sndnum;
- return -1;
-}
-
-
-/*-------------------------------------------------
- sndnum_to_sndti - map a sound number to a
- (type,index) pair
--------------------------------------------------*/
-
-sound_type sndnum_to_sndti(int sndnum, int *index)
-{
- if (index != NULL)
- *index = sound[sndnum].index;
- return sound[sndnum].aliastype;
-}
-
-
-/*-------------------------------------------------
- sndtype_count - count the number of a
- given type
--------------------------------------------------*/
-
-int sndtype_count(sound_type sndtype)
-{
- int index;
- int count = 0;
-
- for (index = 0; index < totalsnd; index++)
- if (sound[index].sndtype == sndtype)
- count++;
-
- return count;
-}
-
-
-
-/***************************************************************************
- CHIP INTERFACES BY INDEX
-***************************************************************************/
-
-/*-------------------------------------------------
- Get info accessors
--------------------------------------------------*/
-
-INT64 sndnum_get_info_int(int sndnum, UINT32 state)
-{
- sndinfo info;
-
- VERIFY_SNDNUM(sndnum_get_info_int);
- info.i = 0;
- (*sound[sndnum].sndtype)(sound[sndnum].device, state, &info);
- return info.i;
-}
-
-void *sndnum_get_info_ptr(int sndnum, UINT32 state)
-{
- sndinfo info;
-
- VERIFY_SNDNUM(sndnum_get_info_ptr);
- info.p = NULL;
- (*sound[sndnum].sndtype)(sound[sndnum].device, state, &info);
- return info.p;
-}
-
-genf *sndnum_get_info_fct(int sndnum, UINT32 state)
-{
- sndinfo info;
-
- VERIFY_SNDNUM(sndnum_get_info_fct);
- info.f = NULL;
- (*sound[sndnum].sndtype)(sound[sndnum].device, state, &info);
- return info.f;
-}
-
-const char *sndnum_get_info_string(int sndnum, UINT32 state)
-{
- extern char *get_temp_string_buffer(void);
- sndinfo info;
-
- VERIFY_SNDNUM(sndnum_get_info_string);
- info.s = get_temp_string_buffer();
- (*sound[sndnum].sndtype)(sound[sndnum].device, state, &info);
- return info.s;
-}
-
-
-/*-------------------------------------------------
- Misc accessors
--------------------------------------------------*/
-
-void sndnum_reset(int sndnum)
-{
- sndinfo info;
-
- VERIFY_SNDNUM(sndnum_reset);
- info.reset = NULL;
- (*sound[sndnum].sndtype)(NULL, SNDINFO_PTR_RESET, &info);
- if (info.reset)
- (info.reset)(sound[sndnum].device);
-}
-
-int sndnum_clock(int sndnum)
-{
- VERIFY_SNDNUM(sndnum_clock);
- return sound[sndnum].device->clock;
-}
-
-void *sndnum_token(int sndnum)
-{
- VERIFY_SNDNUM(sndnum_token);
- return sound[sndnum].device->token;
-}
-
-
-
-/***************************************************************************
- CHIP INTERFACES BY (TYPE,INDEX) PAIR
-***************************************************************************/
-
-/*-------------------------------------------------
- Get info accessors
--------------------------------------------------*/
-
-INT64 sndti_get_info_int(sound_type sndtype, int sndindex, UINT32 state)
-{
- sndinfo info;
-
- VERIFY_SNDTI(sndti_get_info_int);
- info.i = 0;
- (*sound[sndnum].sndtype)(sound[sndnum].device, state, &info);
- return info.i;
-}
-
-void *sndti_get_info_ptr(sound_type sndtype, int sndindex, UINT32 state)
-{
- sndinfo info;
-
- VERIFY_SNDTI(sndti_get_info_ptr);
- info.p = NULL;
- (*sound[sndnum].sndtype)(sound[sndnum].device, state, &info);
- return info.p;
-}
-
-genf *sndti_get_info_fct(sound_type sndtype, int sndindex, UINT32 state)
-{
- sndinfo info;
-
- VERIFY_SNDTI(sndti_get_info_fct);
- info.f = NULL;
- (*sound[sndnum].sndtype)(sound[sndnum].device, state, &info);
- return info.f;
-}
-
-const char *sndti_get_info_string(sound_type sndtype, int sndindex, UINT32 state)
-{
- extern char *get_temp_string_buffer(void);
- sndinfo info;
-
- VERIFY_SNDTI(sndti_get_info_string);
- info.s = get_temp_string_buffer();
- (*sound[sndnum].sndtype)(sound[sndnum].device, state, &info);
- return info.s;
-}
-
-
-/*-------------------------------------------------
- Misc accessors
--------------------------------------------------*/
-
-void sndti_reset(sound_type sndtype, int sndindex)
-{
- sndinfo info;
-
- VERIFY_SNDTI(sndti_reset);
- info.reset = NULL;
- (*sound[sndnum].sndtype)(NULL, SNDINFO_PTR_RESET, &info);
-
- if (info.reset)
- (*info.reset)(sound[sndnum].device);
-}
-
-int sndti_clock(sound_type sndtype, int sndindex)
-{
- VERIFY_SNDTI(sndti_clock);
- return sound[sndnum].device->clock;
-}
-
-void *sndti_token(sound_type sndtype, int sndindex)
-{
- VERIFY_SNDTI(sndti_token);
- return sound[sndnum].device->token;
-}
-
-
-
-/***************************************************************************
- CHIP INTERFACES BY TYPE
-***************************************************************************/
-
-/*-------------------------------------------------
- Get info accessors
--------------------------------------------------*/
-
-INT64 sndtype_get_info_int(sound_type sndtype, UINT32 state)
-{
- snd_get_info_func get_info = sndtype;
- sndinfo info;
-
- VERIFY_SNDTYPE(sndtype_get_info_int);
- info.i = 0;
- (*get_info)(NULL, state, &info);
- return info.i;
-}
-
-void *sndtype_get_info_ptr(sound_type sndtype, UINT32 state)
-{
- snd_get_info_func get_info = sndtype;
- sndinfo info;
-
- VERIFY_SNDTYPE(sndtype_get_info_ptr);
- info.p = NULL;
- (*get_info)(NULL, state, &info);
- return info.p;
-}
-
-genf *sndtype_get_info_fct(sound_type sndtype, UINT32 state)
-{
- snd_get_info_func get_info = sndtype;
- sndinfo info;
-
- VERIFY_SNDTYPE(sndtype_get_info_fct);
- info.f = NULL;
- (*get_info)(NULL, state, &info);
- return info.f;
-}
-
-const char *sndtype_get_info_string(sound_type sndtype, UINT32 state)
-{
- extern char *get_temp_string_buffer(void);
- snd_get_info_func get_info = sndtype;
- sndinfo info;
-
- VERIFY_SNDTYPE(sndtype_get_info_string);
- info.s = get_temp_string_buffer();
- (*get_info)(NULL, state, &info);
- return info.s;
-}
diff --git a/src/emu/sndintrf.h b/src/emu/sndintrf.h
index 15a38447fba..647d12b9dd0 100644
--- a/src/emu/sndintrf.h
+++ b/src/emu/sndintrf.h
@@ -17,204 +17,7 @@
#include "memory.h"
#include "mame.h"
#include "state.h"
-
-
-/***************************************************************************
- CONSTANTS
-***************************************************************************/
-
-#define MAX_SOUND 32
-
-
-/* Sound information constants */
-enum
-{
- /* --- the following bits of info are returned as 64-bit signed integers --- */
- SNDINFO_INT_FIRST = DEVINFO_INT_FIRST,
-
- SNDINFO_INT_TOKEN_BYTES = DEVINFO_INT_TOKEN_BYTES, /* R/O: bytes to allocate for the token */
-
- SNDINFO_INT_CORE_SPECIFIC = DEVINFO_INT_DEVICE_SPECIFIC, /* R/W: core-specific values start here */
-
- /* --- the following bits of info are returned as pointers to data or functions --- */
- SNDINFO_PTR_FIRST = DEVINFO_PTR_FIRST,
-
- SNDINFO_PTR_CORE_SPECIFIC = DEVINFO_PTR_DEVICE_SPECIFIC, /* R/W: core-specific values start here */
-
- /* --- the following bits of info are returned as pointers to functions --- */
- SNDINFO_FCT_FIRST = DEVINFO_FCT_FIRST,
-
- SNDINFO_PTR_START = DEVINFO_FCT_START, /* R/O: void *(*start)(const device_config *device, int clock) */
- SNDINFO_PTR_STOP = DEVINFO_FCT_STOP, /* R/O: void (*stop)(const device_config *device) */
- SNDINFO_PTR_RESET = DEVINFO_FCT_RESET, /* R/O: void (*reset)(const device_config *device) */
-
- SNDINFO_PTR_SET_INFO = DEVINFO_FCT_CLASS_SPECIFIC, /* R/O: void (*set_info)(const device_config *device, UINT32 state, sndinfo *info) */
- SNDINFO_FCT_ALIAS, /* R/O: alias to sound type for (type,index) identification */
-
- SNDINFO_FCT_CORE_SPECIFIC = DEVINFO_FCT_DEVICE_SPECIFIC, /* R/W: core-specific values start here */
-
- /* --- the following bits of info are returned as NULL-terminated strings --- */
- SNDINFO_STR_FIRST = DEVINFO_STR_FIRST,
-
- SNDINFO_STR_NAME = DEVINFO_STR_NAME, /* R/O: name of the sound chip */
- SNDINFO_STR_CORE_FAMILY = DEVINFO_STR_FAMILY, /* R/O: family of the sound chip */
- SNDINFO_STR_CORE_VERSION = DEVINFO_STR_VERSION, /* R/O: version of the sound core */
- SNDINFO_STR_CORE_FILE = DEVINFO_STR_SOURCE_FILE, /* R/O: file containing the sound core */
- SNDINFO_STR_CORE_CREDITS = DEVINFO_STR_CREDITS, /* R/O: credits for the sound core */
-
- SNDINFO_STR_CORE_SPECIFIC = DEVINFO_STR_DEVICE_SPECIFIC /* R/W: core-specific values start here */
-};
-
-
-
-/***************************************************************************
- MACROS
-***************************************************************************/
-
-#define SND_GET_INFO_NAME(name) snd_get_info_##name
-#define SND_GET_INFO(name) void SND_GET_INFO_NAME(name)(const device_config *device, UINT32 state, sndinfo *info)
-#define SND_GET_INFO_CALL(name) SND_GET_INFO_NAME(name)(device, state, info)
-
-#define SND_SET_INFO_NAME(name) snd_set_info_##name
-#define SND_SET_INFO(name) void SND_SET_INFO_NAME(name)(const device_config *device, UINT32 state, sndinfo *info)
-#define SND_SET_INFO_CALL(name) SND_SET_INFO_NAME(name)(device, state, info)
-
-#define SND_START_NAME(name) snd_start_##name
-#define SND_START(name) void SND_START_NAME(name)(const device_config *device, int clock)
-#define SND_START_CALL(name) SND_START_NAME(name)(device, clock)
-
-#define SND_STOP_NAME(name) snd_stop_##name
-#define SND_STOP(name) void SND_STOP_NAME(name)(const device_config *device)
-#define SND_STOP_CALL(name) SND_STOP_NAME(name)(device)
-
-#define SND_RESET_NAME(name) snd_reset_##name
-#define SND_RESET(name) void SND_RESET_NAME(name)(const device_config *device)
-#define SND_RESET_CALL(name) SND_RESET_NAME(name)(device)
-
-
-
-/***************************************************************************
- TYPE DEFINITIONS
-***************************************************************************/
-
-/* forward declaration of this union */
-typedef union _sndinfo sndinfo;
-
-/* define the various callback functions */
-typedef void (*snd_get_info_func)(const device_config *device, UINT32 state, sndinfo *info);
-typedef void (*snd_set_info_func)(const device_config *device, UINT32 state, sndinfo *info);
-typedef void (*snd_start_func)(const device_config *device, int clock);
-typedef void (*snd_stop_func)(const device_config *device);
-typedef void (*snd_reset_func)(const device_config *device);
-
-typedef snd_get_info_func sound_type;
-
-
-/* sndinfo union used to pass data to/from the get_info/set_info functions */
-union _sndinfo
-{
- INT64 i; /* generic integers */
- void * p; /* generic pointers */
- genf * f; /* generic function pointers */
- char * s; /* generic strings */
- sound_type type; /* generic type */
-
- snd_set_info_func set_info; /* SNDINFO_PTR_SET_INFO */
- snd_start_func start; /* SNDINFO_PTR_START */
- snd_stop_func stop; /* SNDINFO_PTR_STOP */
- snd_reset_func reset; /* SNDINFO_PTR_RESET */
-};
-
-
-
-/***************************************************************************
- CHIP INTERFACES BY INDEX
-***************************************************************************/
-
-/* get info accessors */
-INT64 sndnum_get_info_int(int sndnum, UINT32 state);
-void *sndnum_get_info_ptr(int sndnum, UINT32 state);
-genf *sndnum_get_info_fct(int sndnum, UINT32 state);
-const char *sndnum_get_info_string(int sndnum, UINT32 state);
-
-/* set info accessors */
-void sndnum_set_info_int(int sndnum, UINT32 state, INT64 data);
-void sndnum_set_info_ptr(int sndnum, UINT32 state, void *data);
-void sndnum_set_info_fct(int sndnum, UINT32 state, genf *data);
-
-#define sndnum_get_name(sndnum) sndnum_get_info_string(sndnum, SNDINFO_STR_NAME)
-#define sndnum_get_core_family(sndnum) sndnum_get_info_string(sndnum, SNDINFO_STR_CORE_FAMILY)
-#define sndnum_get_core_version(sndnum) sndnum_get_info_string(sndnum, SNDINFO_STR_CORE_VERSION)
-#define sndnum_get_core_file(sndnum) sndnum_get_info_string(sndnum, SNDINFO_STR_CORE_FILE)
-#define sndnum_get_core_credits(sndnum) sndnum_get_info_string(sndnum, SNDINFO_STR_CORE_CREDITS)
-
-/* misc accessors */
-void sndnum_reset(int sndnum);
-int sndnum_clock(int sndnum);
-void *sndnum_token(int sndnum);
-
-
-
-/***************************************************************************
- CHIP INTERFACES BY (TYPE,INDEX) PAIR
-***************************************************************************/
-
-/* get info accessors */
-INT64 sndti_get_info_int(sound_type sndtype, int sndindex, UINT32 state);
-void *sndti_get_info_ptr(sound_type sndtype, int sndindex, UINT32 state);
-genf *sndti_get_info_fct(sound_type sndtype, int sndindex, UINT32 state);
-const char *sndti_get_info_string(sound_type sndtype, int sndindex, UINT32 state);
-
-#define sndti_get_name(sndtype, sndindex) sndti_get_info_string(sndtype, sndindex, SNDINFO_STR_NAME)
-#define sndti_get_core_family(sndtype, sndindex) sndti_get_info_string(sndtype, sndindex, SNDINFO_STR_CORE_FAMILY)
-#define sndti_get_core_version(sndtype, sndindex) sndti_get_info_string(sndtype, sndindex, SNDINFO_STR_CORE_VERSION)
-#define sndti_get_core_file(sndtype, sndindex) sndti_get_info_string(sndtype, sndindex, SNDINFO_STR_CORE_FILE)
-#define sndti_get_core_credits(sndtype, sndindex) sndti_get_info_string(sndtype, sndindex, SNDINFO_STR_CORE_CREDITS)
-
-/* misc accessors */
-void sndti_reset(sound_type sndtype, int sndindex);
-int sndti_clock(sound_type sndtype, int sndindex);
-void *sndti_token(sound_type sndtype, int sndindex);
-
-/* driver gain controls on chip outputs */
-void sndti_set_output_gain(sound_type sndtype, int sndindex, int output, float gain);
-
-
-
-/***************************************************************************
- CHIP INTERFACES BY TYPE
-***************************************************************************/
-
-/* get info accessors */
-INT64 sndtype_get_info_int(sound_type sndtype, UINT32 state);
-void *sndtype_get_info_ptr(sound_type sndtype, UINT32 state);
-genf *sndtype_get_info_fct(sound_type sndtype, UINT32 state);
-const char *sndtype_get_info_string(sound_type sndtype, UINT32 state);
-
-#define sndtype_get_name(sndtype) sndtype_get_info_string(sndtype, SNDINFO_STR_NAME)
-#define sndtype_get_core_family(sndtype) sndtype_get_info_string(sndtype, SNDINFO_STR_CORE_FAMILY)
-#define sndtype_get_core_version(sndtype) sndtype_get_info_string(sndtype, SNDINFO_STR_CORE_VERSION)
-#define sndtype_get_core_file(sndtype) sndtype_get_info_string(sndtype, SNDINFO_STR_CORE_FILE)
-#define sndtype_get_core_credits(sndtype) sndtype_get_info_string(sndtype, SNDINFO_STR_CORE_CREDITS)
-
-
-
-/***************************************************************************
- FUNCTION PROTOTYPES
-***************************************************************************/
-
-/* Initialization/Tear down */
-void sndintrf_init(running_machine *machine);
-int sndintrf_init_sound(running_machine *machine, int sndnum, const char *tag, sound_type sndtype, int clock, const void *config);
-void sndintrf_exit_sound(int sndnum);
-
-/* Misc helpers */
-int sndti_exists(sound_type sndtype, int sndindex);
-int sndti_to_sndnum(sound_type type, int index);
-sound_type sndnum_to_sndti(int sndnum, int *index);
-int sndtype_count(sound_type sndtype);
-
-#define SOUND_DUMMY NULL
+#include "sound.h"
#endif /* __SNDINTRF_H__ */
diff --git a/src/emu/sound.c b/src/emu/sound.c
index a6df8328b38..3b22fc2b9f5 100644
--- a/src/emu/sound.c
+++ b/src/emu/sound.c
@@ -24,7 +24,7 @@
#define VERBOSE (0)
-#define VPRINTF(x) do { if (VERBOSE) mame_printf_debug x; } while (0)
+#define VPRINTF(x) do { if (VERBOSE) mame_printf_debug x; } while (0)
@@ -33,7 +33,6 @@
***************************************************************************/
#define MAX_MIXER_CHANNELS 100
-#define SOUND_UPDATE_FREQUENCY ATTOTIME_IN_HZ(50)
@@ -49,12 +48,11 @@ struct _sound_output
};
-typedef struct _sound_info sound_info;
-struct _sound_info
+typedef struct _sound_class_data sound_class_data;
+struct _sound_class_data
{
- const sound_config *sound; /* pointer to the sound info */
int outputs; /* number of outputs from this instance */
- sound_output * output; /* array of output information */
+ sound_output output[MAX_OUTPUTS]; /* array of output information */
};
@@ -91,7 +89,6 @@ struct _speaker_info
static emu_timer *sound_update_timer;
static int totalsnd;
-static sound_info sound[MAX_SOUND];
static INT16 *finalmix;
static UINT32 finalmix_leftover;
@@ -116,7 +113,6 @@ static void sound_pause(running_machine *machine, int pause);
static void sound_load(running_machine *machine, int config_type, xml_data_node *parentnode);
static void sound_save(running_machine *machine, int config_type, xml_data_node *parentnode);
static TIMER_CALLBACK( sound_update );
-static void start_sound_chips(running_machine *machine);
static void route_sound(running_machine *machine);
static STREAM_UPDATE( mixer_update );
static STATE_POSTLOAD( mixer_postload );
@@ -128,43 +124,58 @@ static STATE_POSTLOAD( mixer_postload );
***************************************************************************/
/*-------------------------------------------------
- get_safe_token - makes sure that the passed
- in device is, in fact, a timer
+ get_class_data - return a pointer to the
+ class data
-------------------------------------------------*/
-INLINE speaker_info *get_safe_token(const device_config *device)
+INLINE sound_class_data *get_class_data(const device_config *device)
{
assert(device != NULL);
+ assert(device->type == SOUND);
+ assert(device->class == DEVICE_CLASS_SOUND_CHIP);
assert(device->token != NULL);
- assert(device->type == SPEAKER_OUTPUT);
-
- return (speaker_info *)device->token;
+ return (sound_class_data *)((UINT8 *)device->token + device->tokenbytes) - 1;
}
/*-------------------------------------------------
- find_speaker_by_tag - find a tagged speaker
+ get_safe_token - makes sure that the passed
+ in device is, in fact, a timer
-------------------------------------------------*/
-INLINE speaker_info *find_speaker_by_tag(running_machine *machine, const char *tag)
+INLINE speaker_info *get_safe_token(const device_config *device)
{
- const device_config *speaker = device_list_find_by_tag(machine->config->devicelist, SPEAKER_OUTPUT, tag);
- return (speaker == NULL) ? NULL : speaker->token;
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SPEAKER_OUTPUT);
+
+ return (speaker_info *)device->token;
}
/*-------------------------------------------------
- find_sound_by_tag - find a tagged sound chip
+ index_to_input - map an absolute index to
+ a particular input
-------------------------------------------------*/
-INLINE sound_info *find_sound_by_tag(const char *tag)
+INLINE speaker_info *index_to_input(running_machine *machine, int index, int *input)
{
- int sndnum;
+ const device_config *curspeak;
+ int count = 0;
+
+ /* scan through the speakers until we find the indexed input */
+ for (curspeak = speaker_output_first(machine->config); curspeak != NULL; curspeak = speaker_output_next(curspeak))
+ {
+ speaker_info *info = curspeak->token;
+ if (index < count + info->inputs)
+ {
+ *input = index - count;
+ return info;
+ }
+ count += info->inputs;
+ }
- /* attempt to find the speaker in our list */
- for (sndnum = 0; sndnum < totalsnd; sndnum++)
- if (sound[sndnum].sound->tag && !strcmp(sound[sndnum].sound->tag, tag))
- return &sound[sndnum];
+ /* index out of range */
return NULL;
}
@@ -180,7 +191,6 @@ INLINE sound_info *find_sound_by_tag(const char *tag)
void sound_init(running_machine *machine)
{
- attotime update_frequency = SOUND_UPDATE_FREQUENCY;
const char *filename;
/* handle -nosound */
@@ -198,15 +208,7 @@ void sound_init(running_machine *machine)
/* allocate a global timer for sound timing */
sound_update_timer = timer_alloc(machine, sound_update, NULL);
- timer_adjust_periodic(sound_update_timer, update_frequency, 0, update_frequency);
-
- /* initialize the streams engine */
- VPRINTF(("streams_init\n"));
- streams_init(machine, update_frequency.attoseconds);
-
- /* now start up the sound chips and tag their streams */
- VPRINTF(("start_sound_chips\n"));
- start_sound_chips(machine);
+ timer_adjust_periodic(sound_update_timer, STREAMS_UPDATE_FREQUENCY, 0, STREAMS_UPDATE_FREQUENCY);
/* finally, do all the routing */
VPRINTF(("route_sound\n"));
@@ -236,118 +238,129 @@ void sound_init(running_machine *machine)
static void sound_exit(running_machine *machine)
{
- int sndnum;
-
/* close any open WAV file */
if (wavfile != NULL)
wav_close(wavfile);
- /* stop all the sound chips */
- for (sndnum = 0; sndnum < MAX_SOUND; sndnum++)
- if (machine->config->sound[sndnum].type != SOUND_DUMMY)
- sndintrf_exit_sound(sndnum);
-
/* reset variables */
totalsnd = 0;
- memset(sound, 0, sizeof(sound));
}
/***************************************************************************
- INITIALIZATION HELPERS
+ SOUND DEVICE INTERFACE
***************************************************************************/
/*-------------------------------------------------
- start_sound_chips - loop over all sound chips
- and initialize them
+ device_start_sound - device start callback
-------------------------------------------------*/
-static void start_sound_chips(running_machine *machine)
+static DEVICE_START( sound )
{
- int sndnum;
-
- /* reset the sound array */
- memset(sound, 0, sizeof(sound));
+ sound_class_data *classdata;
+ const sound_config *config;
+ deviceinfo devinfo;
+ int num_regs, outputnum;
- /* start up all the sound chips */
- for (sndnum = 0; sndnum < MAX_SOUND; sndnum++)
+ /* validate some basic stuff */
+ assert(device != NULL);
+ assert(device->inline_config != NULL);
+ assert(device->machine != NULL);
+ assert(device->machine->config != NULL);
+
+ /* get pointers to our data */
+ config = device->inline_config;
+ classdata = get_class_data(device);
+
+ /* get the chip's start function */
+ devinfo.start = NULL;
+ (*config->type)(device, DEVINFO_FCT_START, &devinfo);
+ assert(devinfo.start != NULL);
+
+ /* initialize this sound chip */
+ num_regs = state_save_get_reg_count(device->machine);
+ (*devinfo.start)(device);
+ num_regs = state_save_get_reg_count(device->machine) - num_regs;
+
+ /* now count the outputs */
+ VPRINTF(("Counting outputs\n"));
+ for (outputnum = 0; outputnum < MAX_OUTPUTS; outputnum++)
{
- const sound_config *msound = &machine->config->sound[sndnum];
- sound_info *info;
- int num_regs;
- int index;
-
- /* stop when we hit an empty entry */
- if (msound->type == SOUND_DUMMY)
+ sound_stream *stream = stream_find_by_device(device, outputnum);
+ int curoutput, numoutputs;
+
+ /* stop when we run out of streams */
+ if (stream == NULL)
break;
- totalsnd++;
+
+ /* accumulate the number of outputs from this stream */
+ numoutputs = stream_get_outputs(stream);
+ assert(classdata->outputs < MAX_OUTPUTS);
- /* zap all the info */
- info = &sound[sndnum];
- memset(info, 0, sizeof(*info));
+ /* fill in the array */
+ for (curoutput = 0; curoutput < numoutputs; curoutput++)
+ {
+ sound_output *output = &classdata->output[classdata->outputs++];
+ output->stream = stream;
+ output->output = curoutput;
+ }
+ }
- /* copy in all the relevant info */
- info->sound = msound;
+ /* if no state registered for saving, we can't save */
+ if (num_regs == 0)
+ {
+ logerror("Sound chip '%s' did not register any state to save!\n", device->tag);
+ if (device->machine->gamedrv->flags & GAME_SUPPORTS_SAVE)
+ fatalerror("Sound chip '%s' did not register any state to save!", device->tag);
+ }
+}
- /* start the chip, tagging all its streams */
- VPRINTF(("sndnum = %d -- sound_type = %s\n", sndnum, sndtype_get_name(msound->type)));
- num_regs = state_save_get_reg_count(machine);
- streams_set_tag(machine, info);
- if (sndintrf_init_sound(machine, sndnum, msound->tag, msound->type, msound->clock, msound->config) != 0)
- fatalerror("Sound chip #%d (%s) failed to initialize!", sndnum, sndnum_get_name(sndnum));
- /* if no state registered for saving, we can't save */
- num_regs = state_save_get_reg_count(machine) - num_regs;
- if (num_regs == 0)
- {
- logerror("Sound chip #%d (%s) did not register any state to save!\n", sndnum, sndnum_get_name(sndnum));
- if (machine->gamedrv->flags & GAME_SUPPORTS_SAVE)
- fatalerror("Sound chip #%d (%s) did not register any state to save!", sndnum, sndnum_get_name(sndnum));
- }
+/*-------------------------------------------------
+ device_get_info_sound - device get info
+ callback
+-------------------------------------------------*/
- /* now count the outputs */
- VPRINTF(("Counting outputs\n"));
- for (index = 0; ; index++)
- {
- sound_stream *stream = stream_find_by_tag(machine, info, index);
- if (!stream)
- break;
- info->outputs += stream_get_outputs(stream);
- VPRINTF((" stream %p, %d outputs\n", stream, stream_get_outputs(stream)));
- }
+DEVICE_GET_INFO( sound )
+{
+ const sound_config *config = (device != NULL) ? device->inline_config : NULL;
- /* if we have outputs, examine them */
- if (info->outputs)
- {
- /* allocate an array to hold them */
- info->output = auto_malloc(info->outputs * sizeof(*info->output));
- VPRINTF((" %d outputs total\n", info->outputs));
+ switch (state)
+ {
+ /* --- the following bits of info are returned as 64-bit signed integers --- */
+ case DEVINFO_INT_TOKEN_BYTES:
+ (*config->type)(device, DEVINFO_INT_TOKEN_BYTES, info);
+ info->i += sizeof(sound_class_data);
+ break;
- /* now fill the array */
- info->outputs = 0;
- for (index = 0; ; index++)
- {
- sound_stream *stream = stream_find_by_tag(machine, info, index);
- int outputs, outputnum;
+ case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = sizeof(sound_config); break;
+ case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_SOUND_CHIP; break;
- if (!stream)
- break;
- outputs = stream_get_outputs(stream);
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(sound); break;
+ case DEVINFO_FCT_SET_INFO: info->set_info = NULL; break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME:
+ if (config != NULL)
+ (*config->type)(device, state, info);
+ else
+ strcpy(info->s, "sound");
+ break;
- /* fill in an entry for each output */
- for (outputnum = 0; outputnum < outputs; outputnum++)
- {
- info->output[info->outputs].stream = stream;
- info->output[info->outputs].output = outputnum;
- info->outputs++;
- }
- }
- }
+ default:
+ (*config->type)(device, state, info);
+ break;
}
}
+
+/***************************************************************************
+ INITIALIZATION HELPERS
+***************************************************************************/
+
/*-------------------------------------------------
route_sound - route sound outputs to target
inputs
@@ -355,45 +368,44 @@ static void start_sound_chips(running_machine *machine)
static void route_sound(running_machine *machine)
{
- int sndnum, routenum, outputnum;
+ astring *tempstring = astring_alloc();
+ int routenum, outputnum;
const device_config *curspeak;
+ const device_config *sound;
- /* iterate over all the sound chips */
- for (sndnum = 0; sndnum < totalsnd; sndnum++)
+ /* first count up the inputs for each speaker */
+ for (sound = sound_first(machine->config); sound != NULL; sound = sound_next(sound))
{
- sound_info *info = &sound[sndnum];
-
+ const sound_config *config = sound->inline_config;
+ int numoutputs = stream_get_device_outputs(sound);
+ int numassigned = 0;
+
/* iterate over all routes */
- for (routenum = 0; routenum < info->sound->routes; routenum++)
+ for (routenum = 0; routenum <= ALL_OUTPUTS; routenum++)
{
- const sound_route *mroute = &info->sound->route[routenum];
- speaker_info *speaker;
- sound_info *sound;
-
- /* find the target */
- speaker = find_speaker_by_tag(machine, mroute->target);
- sound = find_sound_by_tag(mroute->target);
-
- /* if neither found, it's fatal */
- if (speaker == NULL && sound == NULL)
- fatalerror("Sound route \"%s\" not found!\n", mroute->target);
-
- /* if we got a speaker, bump its input count */
- if (speaker != NULL)
+ const sound_route *mroute = &config->route[routenum];
+ if (mroute->target != NULL)
{
- if (mroute->output >= 0 && mroute->output < info->outputs)
- speaker->inputs++;
- else if (mroute->output == ALL_OUTPUTS)
- speaker->inputs += info->outputs;
+ const device_config *target_speaker = devtag_get_device(machine, SPEAKER_OUTPUT, mroute->target);
+ const device_config *target_sound = devtag_get_device(machine, SOUND, mroute->target);
+ int numentries = (routenum != ALL_OUTPUTS) ? 1 : (numoutputs - numassigned);
+
+ /* if neither found, it's fatal */
+ if (target_speaker == NULL && target_sound == NULL)
+ fatalerror("Sound route \"%s\" not found!\n", mroute->target);
+
+ /* if we got a speaker, bump its input count */
+ if (target_speaker != NULL)
+ get_safe_token(target_speaker)->inputs += numentries;
+ numassigned += numentries;
}
}
}
-
+
/* now allocate the mixers and input data */
- streams_set_tag(machine, NULL);
for (curspeak = speaker_output_first(machine->config); curspeak != NULL; curspeak = speaker_output_next(curspeak))
{
- speaker_info *info = curspeak->token;
+ speaker_info *info = get_safe_token(curspeak);
if (info->inputs != 0)
{
info->mixer_stream = stream_create(curspeak, info->inputs, 1, machine->sample_rate, info, mixer_update);
@@ -406,84 +418,68 @@ static void route_sound(running_machine *machine)
}
/* iterate again over all the sound chips */
- for (sndnum = 0; sndnum < totalsnd; sndnum++)
+ for (sound = sound_first(machine->config); sound != NULL; sound = sound_next(sound))
{
- sound_info *info = &sound[sndnum];
-
+ const sound_config *config = sound->inline_config;
+ int numoutputs = stream_get_device_outputs(sound);
+ UINT8 assigned[MAX_OUTPUTS] = { FALSE };
+
/* iterate over all routes */
- for (routenum = 0; routenum < info->sound->routes; routenum++)
+ for (routenum = 0; routenum <= ALL_OUTPUTS; routenum++)
{
- const sound_route *mroute = &info->sound->route[routenum];
- speaker_info *speaker;
- sound_info *sound;
-
- /* find the target */
- speaker = find_speaker_by_tag(machine, mroute->target);
- sound = find_sound_by_tag(mroute->target);
-
- /* if it's a speaker, set the input */
- if (speaker != NULL)
+ const sound_route *mroute = &config->route[routenum];
+ if (mroute->target != NULL)
{
- for (outputnum = 0; outputnum < info->outputs; outputnum++)
- if (mroute->output == outputnum || mroute->output == ALL_OUTPUTS)
+ const device_config *target_speaker = devtag_get_device(machine, SPEAKER_OUTPUT, mroute->target);
+ const device_config *target_sound = devtag_get_device(machine, SOUND, mroute->target);
+ int inputnum = mroute->input;
+ sound_stream *stream;
+ int streamoutput;
+
+ /* iterate over all outputs, matching any that apply */
+ for (outputnum = 0; outputnum < numoutputs; outputnum++)
+ if (routenum == outputnum || (routenum == ALL_OUTPUTS && !assigned[outputnum]))
{
- char namebuf[256];
- int index;
-
- sound_type sndtype = sndnum_to_sndti(sndnum, &index);
-
- /* built the display name */
- namebuf[0] = '\0';
-
- /* speaker name, if more than one speaker */
- if (speaker_output_count(machine->config) > 1)
- sprintf(namebuf, "%sSpeaker '%s': ", namebuf, speaker->tag);
-
- /* device name */
- sprintf(namebuf, "%s%s ", namebuf, sndnum_get_name(sndnum));
-
- /* device index, if more than one of this type */
- if (sndtype_count(sndtype) > 1)
- sprintf(namebuf, "%s#%d ", namebuf, index);
-
- /* channel number, if more than channel for this device */
- if (info->outputs > 1)
- sprintf(namebuf, "%sCh.%d", namebuf, outputnum);
-
- /* remove final space */
- if (namebuf[strlen(namebuf) - 1] == ' ')
- namebuf[strlen(namebuf) - 1] = '\0';
-
- /* fill in the input data on this speaker */
- speaker->input[speaker->inputs].gain = mroute->gain;
- speaker->input[speaker->inputs].default_gain = mroute->gain;
- speaker->input[speaker->inputs].name = auto_strdup(namebuf);
-
- /* connect the output to the input */
- stream_set_input(speaker->mixer_stream, speaker->inputs++, info->output[outputnum].stream, info->output[outputnum].output, mroute->gain);
+ /* mark this output as assigned */
+ assigned[outputnum] = TRUE;
+
+ /* if it's a speaker, set the input */
+ if (target_speaker != NULL)
+ {
+ speaker_info *speakerinfo = get_safe_token(target_speaker);
+
+ /* generate text for the UI */
+ astring_printf(tempstring, "Speaker '%s': %s '%s'", target_speaker->tag, device_get_name(sound), sound->tag);
+ if (numoutputs > 1)
+ astring_catprintf(tempstring, " Ch.%d", outputnum);
+
+ /* fill in the input data on this speaker */
+ speakerinfo->input[speakerinfo->inputs].gain = mroute->gain;
+ speakerinfo->input[speakerinfo->inputs].default_gain = mroute->gain;
+ speakerinfo->input[speakerinfo->inputs].name = auto_strdup(astring_c(tempstring));
+
+ /* connect the output to the input */
+ if (stream_device_output_to_stream_output(sound, outputnum, &stream, &streamoutput))
+ stream_set_input(speakerinfo->mixer_stream, speakerinfo->inputs++, stream, streamoutput, mroute->gain);
+ }
+
+ /* otherwise, it's a sound chip */
+ else
+ {
+ sound_stream *inputstream;
+ int streaminput;
+
+ if (stream_device_input_to_stream_input(target_sound, inputnum++, &inputstream, &streaminput))
+ if (stream_device_output_to_stream_output(sound, outputnum, &stream, &streamoutput))
+ stream_set_input(inputstream, streaminput, stream, streamoutput, mroute->gain);
+ }
}
}
-
- /* if it's a sound chip, set the input */
- else
- {
- if (mroute->input < 0)
- {
- for (outputnum = 0; outputnum < info->outputs; outputnum++)
- if (mroute->output == outputnum || mroute->output == ALL_OUTPUTS)
- stream_set_input(sound->output[0].stream, 0, info->output[outputnum].stream, info->output[outputnum].output, mroute->gain);
- }
- else
- {
- assert(mroute->output != ALL_OUTPUTS);
- for (outputnum = 0; outputnum < info->outputs; outputnum++)
- if (mroute->output == outputnum)
- stream_set_input(sound->output[0].stream, mroute->input, info->output[outputnum].stream, info->output[outputnum].output, mroute->gain);
- }
-
- }
}
}
+
+ /* free up our temporary string */
+ astring_free(tempstring);
}
@@ -498,12 +494,11 @@ static void route_sound(running_machine *machine)
static void sound_reset(running_machine *machine)
{
- int sndnum;
+ const device_config *sound;
/* reset all the sound chips */
- for (sndnum = 0; sndnum < MAX_SOUND; sndnum++)
- if (machine->config->sound[sndnum].type != SOUND_DUMMY)
- sndnum_reset(sndnum);
+ for (sound = sound_first(machine->config); sound != NULL; sound = sound_next(sound))
+ device_reset(sound);
}
@@ -842,20 +837,6 @@ static DEVICE_STOP( speaker_output )
/*-------------------------------------------------
- speaker_output_set_info - device set info
- callback
--------------------------------------------------*/
-
-static DEVICE_SET_INFO( speaker_output )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-/*-------------------------------------------------
speaker_output_get_info - device get info
callback
-------------------------------------------------*/
@@ -870,7 +851,6 @@ DEVICE_GET_INFO( speaker_output )
case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_AUDIO; break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case DEVINFO_FCT_SET_INFO: info->set_info = DEVICE_SET_INFO_NAME(speaker_output); break;
case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(speaker_output); break;
case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME(speaker_output); break;
case DEVINFO_FCT_RESET: /* Nothing */ break;
@@ -891,25 +871,17 @@ DEVICE_GET_INFO( speaker_output )
***************************************************************************/
/*-------------------------------------------------
- sndti_set_output_gain - set the gain of a
+ sound_set_output_gain - set the gain of a
particular output
-------------------------------------------------*/
-void sndti_set_output_gain(sound_type type, int index, int output, float gain)
+void sound_set_output_gain(const device_config *device, int output, float gain)
{
- int sndnum = sndti_to_sndnum(type, index);
-
- if (sndnum < 0)
- {
- logerror("sndti_set_output_gain called for invalid sound type %s, index %d\n", sndtype_get_name(type), index);
- return;
- }
- if (output >= sound[sndnum].outputs)
- {
- logerror("sndti_set_output_gain called for invalid sound output %d (type %s, index %d)\n", output, sndtype_get_name(type), index);
- return;
- }
- stream_set_output_gain(sound[sndnum].output[output].stream, sound[sndnum].output[output].output, gain);
+ sound_stream *stream;
+ int outputnum;
+
+ if (stream_device_output_to_stream_output(device, output, &stream, &outputnum))
+ stream_set_output_gain(stream, outputnum, gain);
}
@@ -919,33 +891,6 @@ void sndti_set_output_gain(sound_type type, int index, int output, float gain)
***************************************************************************/
/*-------------------------------------------------
- index_to_input - map an absolute index to
- a particular input
--------------------------------------------------*/
-
-INLINE speaker_info *index_to_input(running_machine *machine, int index, int *input)
-{
- const device_config *curspeak;
- int count = 0;
-
- /* scan through the speakers until we find the indexed input */
- for (curspeak = speaker_output_first(machine->config); curspeak != NULL; curspeak = speaker_output_next(curspeak))
- {
- speaker_info *info = curspeak->token;
- if (index < count + info->inputs)
- {
- *input = index - count;
- return info;
- }
- count += info->inputs;
- }
-
- /* index out of range */
- return NULL;
-}
-
-
-/*-------------------------------------------------
sound_get_user_gain_count - return the number
of user-controllable gain parameters
-------------------------------------------------*/
@@ -1020,22 +965,3 @@ const char *sound_get_user_gain_name(running_machine *machine, int index)
speaker_info *spk = index_to_input(machine, index, &inputnum);
return (spk != NULL) ? spk->input[inputnum].name : NULL;
}
-
-
-/*-------------------------------------------------
- sound_find_sndnum_by_tag - return a sndnum
- by finding the appropriate tag
--------------------------------------------------*/
-
-int sound_find_sndnum_by_tag(const char *tag)
-{
- int index;
-
- /* find a match */
- for (index = 0; index < MAX_SOUND; index++)
- if (sound[index].sound != NULL && sound[index].sound->tag != NULL)
- if (strcmp(tag, sound[index].sound->tag) == 0)
- return index;
-
- return -1;
-}
diff --git a/src/emu/sound.h b/src/emu/sound.h
index 45b131da923..2f57ae6c040 100644
--- a/src/emu/sound.h
+++ b/src/emu/sound.h
@@ -14,14 +14,15 @@
#ifndef __SOUND_H__
#define __SOUND_H__
-#include "mamecore.h"
+#include "driver.h"
+
/***************************************************************************
CONSTANTS
***************************************************************************/
-#define MAX_ROUTES (16) /* maximum number of streams of any chip */
-#define ALL_OUTPUTS (-1) /* special value indicating all outputs for the current chip */
+#define MAX_OUTPUTS 256 /* maximum number of outputs a sound chip can support */
+#define ALL_OUTPUTS (MAX_OUTPUTS) /* special value indicating all outputs for the current chip */
@@ -31,9 +32,15 @@
/* these functions are macros primarily due to include file ordering */
/* plus, they are very simple */
+#define sound_count(config) device_list_items((config)->devicelist, SOUND)
+#define sound_first(config) device_list_first((config)->devicelist, SOUND)
+#define sound_next(previous) ((previous)->typenext)
+
+/* these functions are macros primarily due to include file ordering */
+/* plus, they are very simple */
#define speaker_output_count(config) device_list_items((config)->devicelist, SPEAKER_OUTPUT)
#define speaker_output_first(config) device_list_first((config)->devicelist, SPEAKER_OUTPUT)
-#define speaker_output_next(previous) device_list_next((previous), SPEAKER_OUTPUT)
+#define speaker_output_next(previous) ((previous)->typenext)
@@ -41,14 +48,17 @@
TYPE DEFINITIONS
***************************************************************************/
+/* sound type is just a device type */
+typedef device_type sound_type;
+
+
/* Sound route for the machine driver */
typedef struct _sound_route sound_route;
struct _sound_route
{
- int output; /* output ID */
- const char *target; /* tag of the target */
- float gain; /* gain */
- int input; /* input ID, -1 is default behavior */
+ const char * target; /* tag of the target */
+ int input; /* input ID, -1 is default behavior */
+ float gain; /* gain */
};
@@ -56,12 +66,8 @@ struct _sound_route
typedef struct _sound_config sound_config;
struct _sound_config
{
- sound_type type; /* what type of sound chip? */
- int clock; /* clock speed */
- const void *config; /* configuration for this chip */
- const char *tag; /* tag for this chip */
- int routes; /* number of routes we have */
- sound_route route[MAX_ROUTES]; /* routes for the various streams */
+ sound_type type; /* type of sound chip */
+ sound_route route[ALL_OUTPUTS+1]; /* one route per output */
};
@@ -69,18 +75,86 @@ struct _sound_config
typedef struct _speaker_config speaker_config;
struct _speaker_config
{
- float x, y, z; /* positioning vector */
+ float x, y, z; /* positioning vector */
};
/***************************************************************************
+ SOUND DEVICE CONFIGURATION MACROS
+***************************************************************************/
+
+#define MDRV_SOUND_ADD(_tag, _type, _clock) \
+ MDRV_DEVICE_ADD(_tag, SOUND, _clock) \
+ MDRV_DEVICE_CONFIG_DATAPTR(sound_config, type, SOUND_##_type)
+
+#define MDRV_SOUND_REMOVE(_tag) \
+ MDRV_DEVICE_REMOVE(_tag, SOUND)
+
+#define MDRV_SOUND_MODIFY(_tag) \
+ MDRV_DEVICE_MODIFY(_tag, SOUND)
+
+#define MDRV_SOUND_TYPE(_type) \
+ MDRV_DEVICE_CONFIG_DATAPTR(sound_config, type, SOUND_##_type)
+
+#define MDRV_SOUND_CLOCK(_clock) \
+ MDRV_DEVICE_CLOCK(_clock)
+
+#define MDRV_SOUND_REPLACE(_tag, _type, _clock) \
+ MDRV_DEVICE_MODIFY(_tag, SOUND) \
+ MDRV_DEVICE_CONFIG_CLEAR() \
+ MDRV_DEVICE_CONFIG_DATAPTR(sound_config, type, SOUND_##_type) \
+ MDRV_DEVICE_CLOCK(_clock)
+
+#define MDRV_SOUND_CONFIG(_config) \
+ MDRV_DEVICE_CONFIG(_config)
+
+#define MDRV_SOUND_ROUTE_EX(_output, _target, _gain, _input) \
+ MDRV_DEVICE_CONFIG_DATAPTR_ARRAY_MEMBER(sound_config, route, _output, sound_route, target, _target) \
+ MDRV_DEVICE_CONFIG_DATA32_ARRAY_MEMBER(sound_config, route, _output, sound_route, input, _input) \
+ MDRV_DEVICE_CONFIG_DATAFP32_ARRAY_MEMBER(sound_config, route, _output, sound_route, gain, _gain, 24)
+
+#define MDRV_SOUND_ROUTE(_output, _target, _gain) \
+ MDRV_SOUND_ROUTE_EX(_output, _target, _gain, 0)
+
+
+
+/* add/remove speakers */
+#define MDRV_SPEAKER_ADD(_tag, _x, _y, _z) \
+ MDRV_DEVICE_ADD(_tag, SPEAKER_OUTPUT, 0) \
+ MDRV_DEVICE_CONFIG_DATAFP32(speaker_config, x, _x, 24) \
+ MDRV_DEVICE_CONFIG_DATAFP32(speaker_config, y, _y, 24) \
+ MDRV_DEVICE_CONFIG_DATAFP32(speaker_config, z, _z, 24)
+
+#define MDRV_SPEAKER_REMOVE(_tag) \
+ MDRV_DEVICE_REMOVE(_tag, SPEAKER_OUTPUT)
+
+#define MDRV_SPEAKER_STANDARD_MONO(_tag) \
+ MDRV_SPEAKER_ADD(_tag, 0.0, 0.0, 1.0)
+
+#define MDRV_SPEAKER_STANDARD_STEREO(_tagl, _tagr) \
+ MDRV_SPEAKER_ADD(_tagl, -0.2, 0.0, 1.0) \
+ MDRV_SPEAKER_ADD(_tagr, 0.2, 0.0, 1.0)
+
+
+
+/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
/* core interfaces */
void sound_init(running_machine *machine);
+
+
+/* ----- sound device interface ----- */
+
+/* device get info callback */
+#define SOUND DEVICE_GET_INFO_NAME(sound)
+DEVICE_GET_INFO( sound );
+
+
+
/* global sound controls */
void sound_mute(int mute);
void sound_set_attenuation(int attenuation);
@@ -94,8 +168,9 @@ float sound_get_user_gain(running_machine *machine, int index);
float sound_get_default_gain(running_machine *machine, int index);
const char *sound_get_user_gain_name(running_machine *machine, int index);
-/* misc helpers */
-int sound_find_sndnum_by_tag(const char *tag);
+
+/* driver gain controls on chip outputs */
+void sound_set_output_gain(const device_config *device, int output, float gain);
/* ----- sound speaker device interface ----- */
@@ -105,4 +180,21 @@ int sound_find_sndnum_by_tag(const char *tag);
DEVICE_GET_INFO( speaker_output );
+
+/***************************************************************************
+ INLINE FUNCTIONS
+***************************************************************************/
+
+/*-------------------------------------------------
+ sound_get_type - return the type of the
+ specified sound chip
+-------------------------------------------------*/
+
+INLINE sound_type sound_get_type(const device_config *device)
+{
+ const sound_config *config = device->inline_config;
+ return config->type;
+}
+
+
#endif /* __SOUND_H__ */
diff --git a/src/emu/sound/2151intf.c b/src/emu/sound/2151intf.c
index 7f8f1b3b4f3..6c2e5b59625 100644
--- a/src/emu/sound/2151intf.c
+++ b/src/emu/sound/2151intf.c
@@ -13,43 +13,55 @@
#include "ym2151.h"
-struct ym2151_info
+typedef struct _ym2151_state ym2151_state;
+struct _ym2151_state
{
- sound_stream * stream;
- emu_timer * timer[2];
- void * chip;
+ sound_stream * stream;
+ emu_timer * timer[2];
+ void * chip;
+ UINT8 lastreg;
const ym2151_interface *intf;
};
+INLINE ym2151_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_YM2151);
+ return (ym2151_state *)device->token;
+}
+
+
static STREAM_UPDATE( ym2151_update )
{
- struct ym2151_info *info = param;
+ ym2151_state *info = param;
ym2151_update_one(info->chip, outputs, samples);
}
static STATE_POSTLOAD( ym2151intf_postload )
{
- struct ym2151_info *info = param;
+ ym2151_state *info = param;
ym2151_postload(machine, info->chip);
}
-static SND_START( ym2151 )
+static DEVICE_START( ym2151 )
{
static const ym2151_interface dummy = { 0 };
- struct ym2151_info *info = device->token;
+ ym2151_state *info = device->token;
int rate;
info->intf = device->static_config ? device->static_config : &dummy;
- rate = clock/64;
+ rate = device->clock/64;
/* stream setup */
info->stream = stream_create(device,0,2,rate,info,ym2151_update);
- info->chip = ym2151_init(device,clock,rate);
+ info->chip = ym2151_init(device,device->clock,rate);
assert_always(info->chip != NULL, "Error creating YM2151 chip");
state_save_register_postload(device->machine, ym2151intf_postload, info);
@@ -59,175 +71,66 @@ static SND_START( ym2151 )
}
-static SND_STOP( ym2151 )
+static DEVICE_STOP( ym2151 )
{
- struct ym2151_info *info = device->token;
+ ym2151_state *info = device->token;
ym2151_shutdown(info->chip);
}
-static SND_RESET( ym2151 )
+static DEVICE_RESET( ym2151 )
{
- struct ym2151_info *info = device->token;
+ ym2151_state *info = device->token;
ym2151_reset_chip(info->chip);
}
-static int lastreg0,lastreg1,lastreg2;
-
-READ8_HANDLER( ym2151_status_port_0_r )
-{
- struct ym2151_info *token = sndti_token(SOUND_YM2151, 0);
- stream_update(token->stream);
- return ym2151_read_status(token->chip);
-}
-
-READ8_HANDLER( ym2151_status_port_1_r )
-{
- struct ym2151_info *token = sndti_token(SOUND_YM2151, 1);
- stream_update(token->stream);
- return ym2151_read_status(token->chip);
-}
-
-READ8_HANDLER( ym2151_status_port_2_r )
-{
- struct ym2151_info *token = sndti_token(SOUND_YM2151, 2);
- stream_update(token->stream);
- return ym2151_read_status(token->chip);
-}
-
-WRITE8_HANDLER( ym2151_register_port_0_w )
-{
- lastreg0 = data;
-}
-WRITE8_HANDLER( ym2151_register_port_1_w )
-{
- lastreg1 = data;
-}
-WRITE8_HANDLER( ym2151_register_port_2_w )
-{
- lastreg2 = data;
-}
-
-WRITE8_HANDLER( ym2151_data_port_0_w )
-{
- struct ym2151_info *token = sndti_token(SOUND_YM2151, 0);
- stream_update(token->stream);
- ym2151_write_reg(token->chip,lastreg0,data);
-}
-WRITE8_HANDLER( ym2151_data_port_1_w )
+READ8_DEVICE_HANDLER( ym2151_r )
{
- struct ym2151_info *token = sndti_token(SOUND_YM2151, 1);
- stream_update(token->stream);
- ym2151_write_reg(token->chip,lastreg1,data);
-}
-
-WRITE8_HANDLER( ym2151_data_port_2_w )
-{
- struct ym2151_info *token = sndti_token(SOUND_YM2151, 2);
- stream_update(token->stream);
- ym2151_write_reg(token->chip,lastreg2,data);
-}
-
-WRITE8_HANDLER( ym2151_word_0_w )
-{
- if (offset)
- ym2151_data_port_0_w(space,0,data);
+ ym2151_state *token = get_safe_token(device);
+ if (offset & 1)
+ return ym2151_read_status(token->chip);
else
- ym2151_register_port_0_w(space,0,data);
+ return 0xff; /* confirmed on a real YM2151 */
}
-WRITE8_HANDLER( ym2151_word_1_w )
+WRITE8_DEVICE_HANDLER( ym2151_w )
{
- if (offset)
- ym2151_data_port_1_w(space,0,data);
+ ym2151_state *token = get_safe_token(device);
+ if (offset & 1)
+ ym2151_write_reg(token->chip, token->lastreg, data);
else
- ym2151_register_port_1_w(space,0,data);
-}
-
-READ16_HANDLER( ym2151_status_port_0_lsb_r )
-{
- return ym2151_status_port_0_r(space,0);
-}
-
-READ16_HANDLER( ym2151_status_port_1_lsb_r )
-{
- return ym2151_status_port_1_r(space,0);
-}
-
-READ16_HANDLER( ym2151_status_port_2_lsb_r )
-{
- return ym2151_status_port_2_r(space,0);
-}
-
-
-WRITE16_HANDLER( ym2151_register_port_0_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- ym2151_register_port_0_w(space, 0, data & 0xff);
-}
-
-WRITE16_HANDLER( ym2151_register_port_1_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- ym2151_register_port_1_w(space, 0, data & 0xff);
+ token->lastreg = data;
}
-WRITE16_HANDLER( ym2151_register_port_2_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- ym2151_register_port_2_w(space, 0, data & 0xff);
-}
-WRITE16_HANDLER( ym2151_data_port_0_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- ym2151_data_port_0_w(space, 0, data & 0xff);
-}
+READ8_DEVICE_HANDLER( ym2151_status_port_r ) { return ym2151_r(device, 1); }
-WRITE16_HANDLER( ym2151_data_port_1_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- ym2151_data_port_1_w(space, 0, data & 0xff);
-}
+WRITE8_DEVICE_HANDLER( ym2151_register_port_w ) { ym2151_w(device, 0, data); }
+WRITE8_DEVICE_HANDLER( ym2151_data_port_w ) { ym2151_w(device, 1, data); }
-WRITE16_HANDLER( ym2151_data_port_2_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- ym2151_data_port_2_w(space, 0, data & 0xff);
-}
/**************************************************************************
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( ym2151 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( ym2151 )
+DEVICE_GET_INFO( ym2151 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct ym2151_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(ym2151_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( ym2151 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( ym2151 ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( ym2151 ); break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( ym2151 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ym2151 ); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( ym2151 ); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( ym2151 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "YM2151"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Yamaha FM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "YM2151"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Yamaha FM"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/2151intf.h b/src/emu/sound/2151intf.h
index f05bc35ce71..fb9bb6e3f00 100644
--- a/src/emu/sound/2151intf.h
+++ b/src/emu/sound/2151intf.h
@@ -6,40 +6,18 @@
typedef struct _ym2151_interface ym2151_interface;
struct _ym2151_interface
{
- void (*irqhandler)(running_machine *machine, int irq);
- write8_space_func portwritehandler;
+ void (*irqhandler)(const device_config *device, int irq);
+ write8_device_func portwritehandler;
};
-READ8_HANDLER( ym2151_status_port_0_r );
-READ8_HANDLER( ym2151_status_port_1_r );
-READ8_HANDLER( ym2151_status_port_2_r );
+READ8_DEVICE_HANDLER( ym2151_r );
+WRITE8_DEVICE_HANDLER( ym2151_w );
-WRITE8_HANDLER( ym2151_register_port_0_w );
-WRITE8_HANDLER( ym2151_register_port_1_w );
-WRITE8_HANDLER( ym2151_register_port_2_w );
+READ8_DEVICE_HANDLER( ym2151_status_port_r );
+WRITE8_DEVICE_HANDLER( ym2151_register_port_w );
+WRITE8_DEVICE_HANDLER( ym2151_data_port_w );
-WRITE8_HANDLER( ym2151_data_port_0_w );
-WRITE8_HANDLER( ym2151_data_port_1_w );
-WRITE8_HANDLER( ym2151_data_port_2_w );
-
-WRITE8_HANDLER( ym2151_word_0_w );
-WRITE8_HANDLER( ym2151_word_1_w );
-
-READ16_HANDLER( ym2151_status_port_0_lsb_r );
-READ16_HANDLER( ym2151_status_port_1_lsb_r );
-READ16_HANDLER( ym2151_status_port_2_lsb_r );
-
-WRITE16_HANDLER( ym2151_register_port_0_lsb_w );
-WRITE16_HANDLER( ym2151_register_port_1_lsb_w );
-WRITE16_HANDLER( ym2151_register_port_2_lsb_w );
-
-WRITE16_HANDLER( ym2151_data_port_0_lsb_w );
-WRITE16_HANDLER( ym2151_data_port_1_lsb_w );
-WRITE16_HANDLER( ym2151_data_port_2_lsb_w );
-
-SND_GET_INFO( ym2151 );
-#define SOUND_YM2151 SND_GET_INFO_NAME( ym2151 )
+DEVICE_GET_INFO( ym2151 );
+#define SOUND_YM2151 DEVICE_GET_INFO_NAME( ym2151 )
#endif /* __2151INTF_H__ */
-
-
diff --git a/src/emu/sound/2203intf.c b/src/emu/sound/2203intf.c
index 209e9657298..ba3e2074f3e 100644
--- a/src/emu/sound/2203intf.c
+++ b/src/emu/sound/2203intf.c
@@ -5,10 +5,11 @@
#include "fm.h"
-struct ym2203_info
+typedef struct _ym2203_state ym2203_state;
+struct _ym2203_state
{
sound_stream * stream;
- emu_timer * timer[2];
+ emu_timer * timer[2];
void * chip;
void * psg;
const ym2203_interface *intf;
@@ -16,27 +17,37 @@ struct ym2203_info
};
+INLINE ym2203_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_YM2203);
+ return (ym2203_state *)device->token;
+}
+
+
static void psg_set_clock(void *param, int clock)
{
- struct ym2203_info *info = param;
+ ym2203_state *info = param;
ay8910_set_clock_ym(info->psg, clock);
}
static void psg_write(void *param, int address, int data)
{
- struct ym2203_info *info = param;
+ ym2203_state *info = param;
ay8910_write_ym(info->psg, address, data);
}
static int psg_read(void *param)
{
- struct ym2203_info *info = param;
+ ym2203_state *info = param;
return ay8910_read_ym(info->psg);
}
static void psg_reset(void *param)
{
- struct ym2203_info *info = param;
+ ym2203_state *info = param;
ay8910_reset_ym(info->psg);
}
@@ -51,34 +62,35 @@ static const ssg_callbacks psgintf =
/* IRQ Handler */
static void IRQHandler(void *param,int irq)
{
- struct ym2203_info *info = param;
- if(info->intf->handler) info->intf->handler(info->device->machine, irq);
+ ym2203_state *info = param;
+ if (info->intf->handler != NULL)
+ (*info->intf->handler)(info->device, irq);
}
/* Timer overflow callback from timer.c */
static TIMER_CALLBACK( timer_callback_2203_0 )
{
- struct ym2203_info *info = ptr;
+ ym2203_state *info = ptr;
ym2203_timer_over(info->chip,0);
}
static TIMER_CALLBACK( timer_callback_2203_1 )
{
- struct ym2203_info *info = ptr;
+ ym2203_state *info = ptr;
ym2203_timer_over(info->chip,1);
}
/* update request from fm.c */
void ym2203_update_request(void *param)
{
- struct ym2203_info *info = param;
+ ym2203_state *info = param;
stream_update(info->stream);
}
static void timer_handler(void *param,int c,int count,int clock)
{
- struct ym2203_info *info = param;
+ ym2203_state *info = param;
if( count == 0 )
{ /* Reset FM Timer */
timer_enable(info->timer[c], 0);
@@ -93,36 +105,36 @@ static void timer_handler(void *param,int c,int count,int clock)
static STREAM_UPDATE( ym2203_stream_update )
{
- struct ym2203_info *info = param;
+ ym2203_state *info = param;
ym2203_update_one(info->chip, outputs[0], samples);
}
static STATE_POSTLOAD( ym2203_intf_postload )
{
- struct ym2203_info *info = param;
+ ym2203_state *info = param;
ym2203_postload(info->chip);
}
-static SND_START( ym2203 )
+static DEVICE_START( ym2203 )
{
static const ym2203_interface generic_2203 =
{
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
NULL
};
const ym2203_interface *intf = device->static_config ? device->static_config : &generic_2203;
- struct ym2203_info *info = device->token;
- int rate = clock/72; /* ??? */
+ ym2203_state *info = device->token;
+ int rate = device->clock/72; /* ??? */
info->intf = intf;
info->device = device;
- info->psg = ay8910_start_ym(NULL, SOUND_YM2203, device, clock, &intf->ay8910_intf);
+ info->psg = ay8910_start_ym(NULL, SOUND_YM2203, device, device->clock, &intf->ay8910_intf);
assert_always(info->psg != NULL, "Error creating YM2203/AY8910 chip");
/* Timer Handler set */
@@ -133,218 +145,67 @@ static SND_START( ym2203 )
info->stream = stream_create(device,0,1,rate,info,ym2203_stream_update);
/* Initialize FM emurator */
- info->chip = ym2203_init(info,device,clock,rate,timer_handler,IRQHandler,&psgintf);
+ info->chip = ym2203_init(info,device,device->clock,rate,timer_handler,IRQHandler,&psgintf);
assert_always(info->chip != NULL, "Error creating YM2203 chip");
state_save_register_postload(device->machine, ym2203_intf_postload, info);
}
-static SND_STOP( ym2203 )
+static DEVICE_STOP( ym2203 )
{
- struct ym2203_info *info = device->token;
+ ym2203_state *info = device->token;
ym2203_shutdown(info->chip);
ay8910_stop_ym(info->psg);
}
-static SND_RESET( ym2203 )
+static DEVICE_RESET( ym2203 )
{
- struct ym2203_info *info = device->token;
+ ym2203_state *info = device->token;
ym2203_reset_chip(info->chip);
}
-READ8_HANDLER( ym2203_status_port_0_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 0); return ym2203_read(info->chip,0); }
-READ8_HANDLER( ym2203_status_port_1_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 1); return ym2203_read(info->chip,0); }
-READ8_HANDLER( ym2203_status_port_2_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 2); return ym2203_read(info->chip,0); }
-READ8_HANDLER( ym2203_status_port_3_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 3); return ym2203_read(info->chip,0); }
-READ8_HANDLER( ym2203_status_port_4_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 4); return ym2203_read(info->chip,0); }
-
-READ8_HANDLER( ym2203_read_port_0_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 0); return ym2203_read(info->chip,1); }
-READ8_HANDLER( ym2203_read_port_1_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 1); return ym2203_read(info->chip,1); }
-READ8_HANDLER( ym2203_read_port_2_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 2); return ym2203_read(info->chip,1); }
-READ8_HANDLER( ym2203_read_port_3_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 3); return ym2203_read(info->chip,1); }
-READ8_HANDLER( ym2203_read_port_4_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 4); return ym2203_read(info->chip,1); }
-
-WRITE8_HANDLER( ym2203_control_port_0_w )
-{
- struct ym2203_info *info = sndti_token(SOUND_YM2203, 0);
- ym2203_write(info->chip,0,data);
-}
-WRITE8_HANDLER( ym2203_control_port_1_w )
-{
- struct ym2203_info *info = sndti_token(SOUND_YM2203, 1);
- ym2203_write(info->chip,0,data);
-}
-WRITE8_HANDLER( ym2203_control_port_2_w )
-{
- struct ym2203_info *info = sndti_token(SOUND_YM2203, 2);
- ym2203_write(info->chip,0,data);
-}
-WRITE8_HANDLER( ym2203_control_port_3_w )
-{
- struct ym2203_info *info = sndti_token(SOUND_YM2203, 3);
- ym2203_write(info->chip,0,data);
-}
-WRITE8_HANDLER( ym2203_control_port_4_w )
-{
- struct ym2203_info *info = sndti_token(SOUND_YM2203, 4);
- ym2203_write(info->chip,0,data);
-}
-
-WRITE8_HANDLER( ym2203_write_port_0_w )
-{
- struct ym2203_info *info = sndti_token(SOUND_YM2203, 0);
- ym2203_write(info->chip,1,data);
-}
-WRITE8_HANDLER( ym2203_write_port_1_w )
-{
- struct ym2203_info *info = sndti_token(SOUND_YM2203, 1);
- ym2203_write(info->chip,1,data);
-}
-WRITE8_HANDLER( ym2203_write_port_2_w )
-{
- struct ym2203_info *info = sndti_token(SOUND_YM2203, 2);
- ym2203_write(info->chip,1,data);
-}
-WRITE8_HANDLER( ym2203_write_port_3_w )
-{
- struct ym2203_info *info = sndti_token(SOUND_YM2203, 3);
- ym2203_write(info->chip,1,data);
-}
-WRITE8_HANDLER( ym2203_write_port_4_w )
-{
- struct ym2203_info *info = sndti_token(SOUND_YM2203, 4);
- ym2203_write(info->chip,1,data);
-}
-
-
-READ16_HANDLER( ym2203_status_port_0_lsb_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 0); return ym2203_read(info->chip,0) | 0xff00; }
-READ16_HANDLER( ym2203_status_port_1_lsb_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 1); return ym2203_read(info->chip,0) | 0xff00; }
-READ16_HANDLER( ym2203_status_port_2_lsb_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 2); return ym2203_read(info->chip,0) | 0xff00; }
-READ16_HANDLER( ym2203_status_port_3_lsb_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 3); return ym2203_read(info->chip,0) | 0xff00; }
-READ16_HANDLER( ym2203_status_port_4_lsb_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 4); return ym2203_read(info->chip,0) | 0xff00; }
-
-READ16_HANDLER( ym2203_read_port_0_lsb_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 0); return ym2203_read(info->chip,1) | 0xff00; }
-READ16_HANDLER( ym2203_read_port_1_lsb_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 1); return ym2203_read(info->chip,1) | 0xff00; }
-READ16_HANDLER( ym2203_read_port_2_lsb_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 2); return ym2203_read(info->chip,1) | 0xff00; }
-READ16_HANDLER( ym2203_read_port_3_lsb_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 3); return ym2203_read(info->chip,1) | 0xff00; }
-READ16_HANDLER( ym2203_read_port_4_lsb_r ) { struct ym2203_info *info = sndti_token(SOUND_YM2203, 4); return ym2203_read(info->chip,1) | 0xff00; }
-
-WRITE16_HANDLER( ym2203_control_port_0_lsb_w )
-{
- struct ym2203_info *info = sndti_token(SOUND_YM2203, 0);
- if (ACCESSING_BITS_0_7)
- ym2203_write(info->chip,0,data);
-}
-WRITE16_HANDLER( ym2203_control_port_1_lsb_w )
-{
- struct ym2203_info *info = sndti_token(SOUND_YM2203, 1);
- if (ACCESSING_BITS_0_7)
- ym2203_write(info->chip,0,data);
-}
-WRITE16_HANDLER( ym2203_control_port_2_lsb_w )
-{
- struct ym2203_info *info = sndti_token(SOUND_YM2203, 2);
- if (ACCESSING_BITS_0_7)
- ym2203_write(info->chip,0,data);
-}
-WRITE16_HANDLER( ym2203_control_port_3_lsb_w )
-{
- struct ym2203_info *info = sndti_token(SOUND_YM2203, 3);
- if (ACCESSING_BITS_0_7)
- ym2203_write(info->chip,0,data);
-}
-WRITE16_HANDLER( ym2203_control_port_4_lsb_w )
-{
- struct ym2203_info *info = sndti_token(SOUND_YM2203, 4);
- if (ACCESSING_BITS_0_7)
- ym2203_write(info->chip,0,data);
-}
-
-WRITE16_HANDLER( ym2203_write_port_0_lsb_w )
-{
- struct ym2203_info *info = sndti_token(SOUND_YM2203, 0);
- if (ACCESSING_BITS_0_7)
- ym2203_write(info->chip,1,data);
-}
-WRITE16_HANDLER( ym2203_write_port_1_lsb_w )
-{
- struct ym2203_info *info = sndti_token(SOUND_YM2203, 1);
- if (ACCESSING_BITS_0_7)
- ym2203_write(info->chip,1,data);
-}
-WRITE16_HANDLER( ym2203_write_port_2_lsb_w )
-{
- struct ym2203_info *info = sndti_token(SOUND_YM2203, 2);
- if (ACCESSING_BITS_0_7)
- ym2203_write(info->chip,1,data);
-}
-WRITE16_HANDLER( ym2203_write_port_3_lsb_w )
-{
- struct ym2203_info *info = sndti_token(SOUND_YM2203, 3);
- if (ACCESSING_BITS_0_7)
- ym2203_write(info->chip,1,data);
-}
-WRITE16_HANDLER( ym2203_write_port_4_lsb_w )
-{
- struct ym2203_info *info = sndti_token(SOUND_YM2203, 4);
- if (ACCESSING_BITS_0_7)
- ym2203_write(info->chip,1,data);
-}
-
-
-WRITE8_HANDLER( ym2203_word_0_w )
+READ8_DEVICE_HANDLER( ym2203_r )
{
- if (offset)
- ym2203_write_port_0_w(space,0,data);
- else
- ym2203_control_port_0_w(space,0,data);
+ ym2203_state *info = get_safe_token(device);
+ return ym2203_read(info->chip, offset & 1);
}
-WRITE8_HANDLER( ym2203_word_1_w )
+WRITE8_DEVICE_HANDLER( ym2203_w )
{
- if (offset)
- ym2203_write_port_1_w(space,0,data);
- else
- ym2203_control_port_1_w(space,0,data);
+ ym2203_state *info = get_safe_token(device);
+ ym2203_write(info->chip, offset & 1, data);
}
-
+READ8_DEVICE_HANDLER( ym2203_status_port_r ) { return ym2203_r(device, 0); }
+READ8_DEVICE_HANDLER( ym2203_read_port_r ) { return ym2203_r(device, 1); }
+WRITE8_DEVICE_HANDLER( ym2203_control_port_w ) { ym2203_w(device, 0, data); }
+WRITE8_DEVICE_HANDLER( ym2203_write_port_w ) { ym2203_w(device, 1, data); }
/**************************************************************************
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( ym2203 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( ym2203 )
+DEVICE_GET_INFO( ym2203 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct ym2203_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(ym2203_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( ym2203 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( ym2203 ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( ym2203 ); break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( ym2203 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ym2203 ); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( ym2203 ); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( ym2203 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "YM2203"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Yamaha FM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "YM2203"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Yamaha FM"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/2203intf.h b/src/emu/sound/2203intf.h
index cd34a9cde26..48d64ad1a06 100644
--- a/src/emu/sound/2203intf.h
+++ b/src/emu/sound/2203intf.h
@@ -11,62 +11,18 @@ typedef struct _ym2203_interface ym2203_interface;
struct _ym2203_interface
{
const ay8910_interface ay8910_intf;
- void (*handler)(running_machine *machine, int irq);
+ void (*handler)(const device_config *device, int irq);
};
+READ8_DEVICE_HANDLER( ym2203_r );
+WRITE8_DEVICE_HANDLER( ym2203_w );
-READ8_HANDLER( ym2203_status_port_0_r );
-READ8_HANDLER( ym2203_status_port_1_r );
-READ8_HANDLER( ym2203_status_port_2_r );
-READ8_HANDLER( ym2203_status_port_3_r );
-READ8_HANDLER( ym2203_status_port_4_r );
+READ8_DEVICE_HANDLER( ym2203_status_port_r );
+READ8_DEVICE_HANDLER( ym2203_read_port_r );
+WRITE8_DEVICE_HANDLER( ym2203_control_port_w );
+WRITE8_DEVICE_HANDLER( ym2203_write_port_w );
-READ8_HANDLER( ym2203_read_port_0_r );
-READ8_HANDLER( ym2203_read_port_1_r );
-READ8_HANDLER( ym2203_read_port_2_r );
-READ8_HANDLER( ym2203_read_port_3_r );
-READ8_HANDLER( ym2203_read_port_4_r );
-
-WRITE8_HANDLER( ym2203_control_port_0_w );
-WRITE8_HANDLER( ym2203_control_port_1_w );
-WRITE8_HANDLER( ym2203_control_port_2_w );
-WRITE8_HANDLER( ym2203_control_port_3_w );
-WRITE8_HANDLER( ym2203_control_port_4_w );
-
-WRITE8_HANDLER( ym2203_write_port_0_w );
-WRITE8_HANDLER( ym2203_write_port_1_w );
-WRITE8_HANDLER( ym2203_write_port_2_w );
-WRITE8_HANDLER( ym2203_write_port_3_w );
-WRITE8_HANDLER( ym2203_write_port_4_w );
-
-READ16_HANDLER( ym2203_status_port_0_lsb_r );
-READ16_HANDLER( ym2203_status_port_1_lsb_r );
-READ16_HANDLER( ym2203_status_port_2_lsb_r );
-READ16_HANDLER( ym2203_status_port_3_lsb_r );
-READ16_HANDLER( ym2203_status_port_4_lsb_r );
-
-READ16_HANDLER( ym2203_read_port_0_lsb_r );
-READ16_HANDLER( ym2203_read_port_1_lsb_r );
-READ16_HANDLER( ym2203_read_port_2_lsb_r );
-READ16_HANDLER( ym2203_read_port_3_lsb_r );
-READ16_HANDLER( ym2203_read_port_4_lsb_r );
-
-WRITE16_HANDLER( ym2203_control_port_0_lsb_w );
-WRITE16_HANDLER( ym2203_control_port_1_lsb_w );
-WRITE16_HANDLER( ym2203_control_port_2_lsb_w );
-WRITE16_HANDLER( ym2203_control_port_3_lsb_w );
-WRITE16_HANDLER( ym2203_control_port_4_lsb_w );
-
-WRITE16_HANDLER( ym2203_write_port_0_lsb_w );
-WRITE16_HANDLER( ym2203_write_port_1_lsb_w );
-WRITE16_HANDLER( ym2203_write_port_2_lsb_w );
-WRITE16_HANDLER( ym2203_write_port_3_lsb_w );
-WRITE16_HANDLER( ym2203_write_port_4_lsb_w );
-
-WRITE8_HANDLER( ym2203_word_0_w );
-WRITE8_HANDLER( ym2203_word_1_w );
-
-SND_GET_INFO( ym2203 );
-#define SOUND_YM2203 SND_GET_INFO_NAME( ym2203 )
+DEVICE_GET_INFO( ym2203 );
+#define SOUND_YM2203 DEVICE_GET_INFO_NAME( ym2203 )
#endif /* __2203INTF_H__ */
diff --git a/src/emu/sound/2413intf.c b/src/emu/sound/2413intf.c
index 7d8b634b9c8..4f274bc6c45 100644
--- a/src/emu/sound/2413intf.c
+++ b/src/emu/sound/2413intf.c
@@ -9,19 +9,26 @@
#include "ym2413.h"
#include "2413intf.h"
-//#define YM2413ISA
-#ifdef YM2413ISA
- #include <pc.h>
-#endif
-
/* for stream system */
-struct ym2413_info
+typedef struct _ym2413_state ym2413_state;
+struct _ym2413_state
{
sound_stream * stream;
void * chip;
};
+
+INLINE ym2413_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_YM2413);
+ return (ym2413_state *)device->token;
+}
+
+
#ifdef UNUSED_FUNCTION
void YM2413DAC_update(int chip,stream_sample_t **inputs, stream_sample_t **_buffer,int length)
{
@@ -38,23 +45,23 @@ void YM2413DAC_update(int chip,stream_sample_t **inputs, stream_sample_t **_buff
static STREAM_UPDATE( ym2413_stream_update )
{
- struct ym2413_info *info = param;
+ ym2413_state *info = param;
ym2413_update_one(info->chip, outputs, samples);
}
static void _stream_update(void *param, int interval)
{
- struct ym2413_info *info = param;
+ ym2413_state *info = param;
stream_update(info->stream);
}
-static SND_START( ym2413 )
+static DEVICE_START( ym2413 )
{
- int rate = clock/72;
- struct ym2413_info *info = device->token;
+ ym2413_state *info = get_safe_token(device);
+ int rate = device->clock/72;
/* emulator create */
- info->chip = ym2413_init(device, clock, rate);
+ info->chip = ym2413_init(device, device->clock, rate);
assert_always(info->chip != NULL, "Error creating YM2413 chip");
/* stream system initialize */
@@ -79,7 +86,7 @@ static SND_START( ym2413 )
{
ym2413_reset (i);
- ym2413[i].DAC_stream = stream_create(device, 0, 1, clock/72, i, YM2413DAC_update);
+ ym2413[i].DAC_stream = stream_create(device, 0, 1, device->clock/72, i, YM2413DAC_update);
if (ym2413[i].DAC_stream == -1)
return 1;
@@ -89,93 +96,50 @@ static SND_START( ym2413 )
}
-static SND_STOP( ym2413 )
+static DEVICE_STOP( ym2413 )
{
- struct ym2413_info *info = device->token;
+ ym2413_state *info = get_safe_token(device);
ym2413_shutdown(info->chip);
}
-static SND_RESET( ym2413 )
+static DEVICE_RESET( ym2413 )
{
- struct ym2413_info *info = device->token;
+ ym2413_state *info = get_safe_token(device);
ym2413_reset_chip(info->chip);
}
-#ifdef YM2413ISA
-WRITE8_HANDLER( ym2413_register_port_0_w ) {
-int i,a;
- outportb(0x308,data); // ym2413_write (0, 0, data);
- //add delay
- for (i=0; i<0x20; i++)
- a = inportb(0x80);
+WRITE8_DEVICE_HANDLER( ym2413_w )
+{
+ ym2413_state *info = get_safe_token(device);
+ ym2413_write(info->chip, offset & 1, data);
+}
- } /* 1st chip */
-#else
-WRITE8_HANDLER( ym2413_register_port_0_w ) { struct ym2413_info *info = sndti_token(SOUND_YM2413, 0); ym2413_write (info->chip, 0, data); } /* 1st chip */
-#endif
-WRITE8_HANDLER( ym2413_register_port_1_w ) { struct ym2413_info *info = sndti_token(SOUND_YM2413, 1); ym2413_write (info->chip, 0, data); } /* 2nd chip */
-WRITE8_HANDLER( ym2413_register_port_2_w ) { struct ym2413_info *info = sndti_token(SOUND_YM2413, 2); ym2413_write (info->chip, 0, data); } /* 3rd chip */
-WRITE8_HANDLER( ym2413_register_port_3_w ) { struct ym2413_info *info = sndti_token(SOUND_YM2413, 3); ym2413_write (info->chip, 0, data); } /* 4th chip */
-
-#ifdef YM2413ISA
-WRITE8_HANDLER( ym2413_data_port_0_w ) {
-int i,a;
- outportb(0x309,data);// ym2413_write (sndti_token(SOUND_YM2413, 0), 1, data);
- //add delay
- for (i=0; i<0x40; i++)
- a = inportb(0x80);
- } /* 1st chip */
-#else
-WRITE8_HANDLER( ym2413_data_port_0_w ) { struct ym2413_info *info = sndti_token(SOUND_YM2413, 0); ym2413_write (info->chip, 1, data); } /* 1st chip */
-#endif
-WRITE8_HANDLER( ym2413_data_port_1_w ) { struct ym2413_info *info = sndti_token(SOUND_YM2413, 1); ym2413_write (info->chip, 1, data); } /* 2nd chip */
-WRITE8_HANDLER( ym2413_data_port_2_w ) { struct ym2413_info *info = sndti_token(SOUND_YM2413, 2); ym2413_write (info->chip, 1, data); } /* 3rd chip */
-WRITE8_HANDLER( ym2413_data_port_3_w ) { struct ym2413_info *info = sndti_token(SOUND_YM2413, 3); ym2413_write (info->chip, 1, data); } /* 4th chip */
-
-WRITE16_HANDLER( ym2413_register_port_0_lsb_w ) { if (ACCESSING_BITS_0_7) ym2413_register_port_0_w(space,offset,data & 0xff); }
-WRITE16_HANDLER( ym2413_register_port_0_msb_w ) { if (ACCESSING_BITS_8_15) ym2413_register_port_0_w(space,offset,((data & 0xff00) >> 8)); }
-WRITE16_HANDLER( ym2413_register_port_1_lsb_w ) { if (ACCESSING_BITS_0_7) ym2413_register_port_1_w(space,offset,data & 0xff); }
-WRITE16_HANDLER( ym2413_register_port_2_lsb_w ) { if (ACCESSING_BITS_0_7) ym2413_register_port_2_w(space,offset,data & 0xff); }
-WRITE16_HANDLER( ym2413_register_port_3_lsb_w ) { if (ACCESSING_BITS_0_7) ym2413_register_port_3_w(space,offset,data & 0xff); }
-WRITE16_HANDLER( ym2413_data_port_0_lsb_w ) { if (ACCESSING_BITS_0_7) ym2413_data_port_0_w(space,offset,data & 0xff); }
-WRITE16_HANDLER( ym2413_data_port_0_msb_w ) { if (ACCESSING_BITS_8_15) ym2413_data_port_0_w(space,offset,((data & 0xff00) >> 8)); }
-WRITE16_HANDLER( ym2413_data_port_1_lsb_w ) { if (ACCESSING_BITS_0_7) ym2413_data_port_1_w(space,offset,data & 0xff); }
-WRITE16_HANDLER( ym2413_data_port_2_lsb_w ) { if (ACCESSING_BITS_0_7) ym2413_data_port_2_w(space,offset,data & 0xff); }
-WRITE16_HANDLER( ym2413_data_port_3_lsb_w ) { if (ACCESSING_BITS_0_7) ym2413_data_port_3_w(space,offset,data & 0xff); }
+WRITE8_DEVICE_HANDLER( ym2413_register_port_w ) { ym2413_w(device, 0, data); }
+WRITE8_DEVICE_HANDLER( ym2413_data_port_w ) { ym2413_w(device, 1, data); }
/**************************************************************************
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( ym2413 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( ym2413 )
+DEVICE_GET_INFO( ym2413 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct ym2413_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(ym2413_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( ym2413 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( ym2413 ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( ym2413 ); break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( ym2413 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ym2413 ); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( ym2413 ); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( ym2413 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "YM2413"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Yamaha FM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "YM2413"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Yamaha FM"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/2413intf.h b/src/emu/sound/2413intf.h
index d63be022024..80154e52042 100644
--- a/src/emu/sound/2413intf.h
+++ b/src/emu/sound/2413intf.h
@@ -3,28 +3,12 @@
#ifndef __2413INTF_H__
#define __2413INTF_H__
+WRITE8_DEVICE_HANDLER( ym2413_w );
-WRITE8_HANDLER( ym2413_register_port_0_w );
-WRITE8_HANDLER( ym2413_register_port_1_w );
-WRITE8_HANDLER( ym2413_register_port_2_w );
-WRITE8_HANDLER( ym2413_register_port_3_w );
-WRITE8_HANDLER( ym2413_data_port_0_w );
-WRITE8_HANDLER( ym2413_data_port_1_w );
-WRITE8_HANDLER( ym2413_data_port_2_w );
-WRITE8_HANDLER( ym2413_data_port_3_w );
+WRITE8_DEVICE_HANDLER( ym2413_register_port_w );
+WRITE8_DEVICE_HANDLER( ym2413_data_port_w );
-WRITE16_HANDLER( ym2413_register_port_0_lsb_w );
-WRITE16_HANDLER( ym2413_register_port_0_msb_w );
-WRITE16_HANDLER( ym2413_register_port_1_lsb_w );
-WRITE16_HANDLER( ym2413_register_port_2_lsb_w );
-WRITE16_HANDLER( ym2413_register_port_3_lsb_w );
-WRITE16_HANDLER( ym2413_data_port_0_lsb_w );
-WRITE16_HANDLER( ym2413_data_port_0_msb_w );
-WRITE16_HANDLER( ym2413_data_port_1_lsb_w );
-WRITE16_HANDLER( ym2413_data_port_2_lsb_w );
-WRITE16_HANDLER( ym2413_data_port_3_lsb_w );
-
-SND_GET_INFO( ym2413 );
-#define SOUND_YM2413 SND_GET_INFO_NAME( ym2413 )
+DEVICE_GET_INFO( ym2413 );
+#define SOUND_YM2413 DEVICE_GET_INFO_NAME( ym2413 )
#endif /* __2413INTF_H__ */
diff --git a/src/emu/sound/2608intf.c b/src/emu/sound/2608intf.c
index 517f2f060db..712787118ac 100644
--- a/src/emu/sound/2608intf.c
+++ b/src/emu/sound/2608intf.c
@@ -17,7 +17,8 @@
#include "2608intf.h"
#include "fm.h"
-struct ym2608_info
+typedef struct _ym2608_state ym2608_state;
+struct _ym2608_state
{
sound_stream * stream;
emu_timer * timer[2];
@@ -28,28 +29,38 @@ struct ym2608_info
};
+INLINE ym2608_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_YM2608);
+ return (ym2608_state *)device->token;
+}
+
+
static void psg_set_clock(void *param, int clock)
{
- struct ym2608_info *info = param;
+ ym2608_state *info = param;
ay8910_set_clock_ym(info->psg, clock);
}
static void psg_write(void *param, int address, int data)
{
- struct ym2608_info *info = param;
+ ym2608_state *info = param;
ay8910_write_ym(info->psg, address, data);
}
static int psg_read(void *param)
{
- struct ym2608_info *info = param;
+ ym2608_state *info = param;
return ay8910_read_ym(info->psg);
}
static void psg_reset(void *param)
{
- struct ym2608_info *info = param;
+ ym2608_state *info = param;
ay8910_reset_ym(info->psg);
}
@@ -65,26 +76,26 @@ static const ssg_callbacks psgintf =
/* IRQ Handler */
static void IRQHandler(void *param,int irq)
{
- struct ym2608_info *info = param;
- if(info->intf->handler) info->intf->handler(info->device->machine, irq);
+ ym2608_state *info = param;
+ if(info->intf->handler) info->intf->handler(info->device, irq);
}
/* Timer overflow callback from timer.c */
static TIMER_CALLBACK( timer_callback_2608_0 )
{
- struct ym2608_info *info = ptr;
+ ym2608_state *info = ptr;
ym2608_timer_over(info->chip,0);
}
static TIMER_CALLBACK( timer_callback_2608_1 )
{
- struct ym2608_info *info = ptr;
+ ym2608_state *info = ptr;
ym2608_timer_over(info->chip,1);
}
static void timer_handler(void *param,int c,int count,int clock)
{
- struct ym2608_info *info = param;
+ ym2608_state *info = param;
if( count == 0 )
{ /* Reset FM Timer */
timer_enable(info->timer[c], 0);
@@ -100,47 +111,47 @@ static void timer_handler(void *param,int c,int count,int clock)
/* update request from fm.c */
void ym2608_update_request(void *param)
{
- struct ym2608_info *info = param;
+ ym2608_state *info = param;
stream_update(info->stream);
}
static STREAM_UPDATE( ym2608_stream_update )
{
- struct ym2608_info *info = param;
+ ym2608_state *info = param;
ym2608_update_one(info->chip, outputs, samples);
}
static STATE_POSTLOAD( ym2608_intf_postload )
{
- struct ym2608_info *info = param;
+ ym2608_state *info = param;
ym2608_postload(info->chip);
}
-static SND_START( ym2608 )
+static DEVICE_START( ym2608 )
{
static const ym2608_interface generic_2608 =
{
{
AY8910_LEGACY_OUTPUT | AY8910_SINGLE_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
NULL
};
const ym2608_interface *intf = device->static_config ? device->static_config : &generic_2608;
- int rate = clock/72;
+ int rate = device->clock/72;
void *pcmbufa;
int pcmsizea;
- struct ym2608_info *info = device->token;
+ ym2608_state *info = get_safe_token(device);
info->intf = intf;
info->device = device;
/* FIXME: Force to use simgle output */
- info->psg = ay8910_start_ym(NULL, SOUND_YM2608, device, clock, &intf->ay8910_intf);
+ info->psg = ay8910_start_ym(NULL, SOUND_YM2608, device, device->clock, &intf->ay8910_intf);
assert_always(info->psg != NULL, "Error creating YM2608/AY8910 chip");
/* Timer Handler set */
@@ -154,7 +165,7 @@ static SND_START( ym2608 )
pcmsizea = device->regionbytes;
/* initialize YM2608 */
- info->chip = ym2608_init(info,device,clock,rate,
+ info->chip = ym2608_init(info,device,device->clock,rate,
pcmbufa,pcmsizea,
timer_handler,IRQHandler,&psgintf);
assert_always(info->chip != NULL, "Error creating YM2608 chip");
@@ -162,158 +173,64 @@ static SND_START( ym2608 )
state_save_register_postload(device->machine, ym2608_intf_postload, info);
}
-static SND_STOP( ym2608 )
+static DEVICE_STOP( ym2608 )
{
- struct ym2608_info *info = device->token;
+ ym2608_state *info = get_safe_token(device);
ym2608_shutdown(info->chip);
ay8910_stop_ym(info->psg);
}
-static SND_RESET( ym2608 )
+static DEVICE_RESET( ym2608 )
{
- struct ym2608_info *info = device->token;
+ ym2608_state *info = get_safe_token(device);
ym2608_reset_chip(info->chip);
}
-/************************************************/
-/* Status Read for YM2608 - Chip 0 */
-/************************************************/
-READ8_HANDLER( ym2608_status_port_0_a_r )
-{
-//logerror("PC %04x: 2608 S0A=%02X\n",cpu_get_pc(space->cpu),ym2608_read(sndti_token(SOUND_YM2608, 0),0));
- struct ym2608_info *info = sndti_token(SOUND_YM2608, 0);
- return ym2608_read(info->chip,0);
-}
-READ8_HANDLER( ym2608_status_port_0_b_r )
+READ8_DEVICE_HANDLER( ym2608_r )
{
-//logerror("PC %04x: 2608 S0B=%02X\n",cpu_get_pc(space->cpu),ym2608_read(sndti_token(SOUND_YM2608, 0),2));
- struct ym2608_info *info = sndti_token(SOUND_YM2608, 0);
- return ym2608_read(info->chip,2);
-}
-
-/************************************************/
-/* Status Read for YM2608 - Chip 1 */
-/************************************************/
-READ8_HANDLER( ym2608_status_port_1_a_r ) {
- struct ym2608_info *info = sndti_token(SOUND_YM2608, 1);
- return ym2608_read(info->chip,0);
-}
-
-READ8_HANDLER( ym2608_status_port_1_b_r ) {
- struct ym2608_info *info = sndti_token(SOUND_YM2608, 1);
- return ym2608_read(info->chip,2);
-}
-
-/************************************************/
-/* Port Read for YM2608 - Chip 0 */
-/************************************************/
-READ8_HANDLER( ym2608_read_port_0_r ){
- struct ym2608_info *info = sndti_token(SOUND_YM2608, 0);
- return ym2608_read(info->chip,1);
-}
-
-/************************************************/
-/* Port Read for YM2608 - Chip 1 */
-/************************************************/
-READ8_HANDLER( ym2608_read_port_1_r ){
- struct ym2608_info *info = sndti_token(SOUND_YM2608, 1);
- return ym2608_read(info->chip,1);
+ ym2608_state *info = get_safe_token(device);
+ return ym2608_read(info->chip, offset & 3);
}
-/************************************************/
-/* Control Write for YM2608 - Chip 0 */
-/* Consists of 2 addresses */
-/************************************************/
-WRITE8_HANDLER( ym2608_control_port_0_a_w )
+WRITE8_DEVICE_HANDLER( ym2608_w )
{
- struct ym2608_info *info = sndti_token(SOUND_YM2608, 0);
- ym2608_write(info->chip,0,data);
+ ym2608_state *info = get_safe_token(device);
+ ym2608_write(info->chip, offset & 3, data);
}
-WRITE8_HANDLER( ym2608_control_port_0_b_w )
-{
- struct ym2608_info *info = sndti_token(SOUND_YM2608, 0);
- ym2608_write(info->chip,2,data);
-}
+READ8_DEVICE_HANDLER( ym2608_read_port_r ) { return ym2608_r(device, 1); }
+READ8_DEVICE_HANDLER( ym2608_status_port_a_r ) { return ym2608_r(device, 0); }
+READ8_DEVICE_HANDLER( ym2608_status_port_b_r ) { return ym2608_r(device, 2); }
-/************************************************/
-/* Control Write for YM2608 - Chip 1 */
-/* Consists of 2 addresses */
-/************************************************/
-WRITE8_HANDLER( ym2608_control_port_1_a_w ){
- struct ym2608_info *info = sndti_token(SOUND_YM2608, 1);
- ym2608_write(info->chip,0,data);
-}
+WRITE8_DEVICE_HANDLER( ym2608_control_port_a_w ) { ym2608_w(device, 0, data); }
+WRITE8_DEVICE_HANDLER( ym2608_control_port_b_w ) { ym2608_w(device, 2, data); }
+WRITE8_DEVICE_HANDLER( ym2608_data_port_a_w ) { ym2608_w(device, 1, data); }
+WRITE8_DEVICE_HANDLER( ym2608_data_port_b_w ) { ym2608_w(device, 3, data); }
-WRITE8_HANDLER( ym2608_control_port_1_b_w ){
- struct ym2608_info *info = sndti_token(SOUND_YM2608, 1);
- ym2608_write(info->chip,2,data);
-}
-
-/************************************************/
-/* Data Write for YM2608 - Chip 0 */
-/* Consists of 2 addresses */
-/************************************************/
-WRITE8_HANDLER( ym2608_data_port_0_a_w )
-{
- struct ym2608_info *info = sndti_token(SOUND_YM2608, 0);
- ym2608_write(info->chip,1,data);
-}
-
-WRITE8_HANDLER( ym2608_data_port_0_b_w )
-{
- struct ym2608_info *info = sndti_token(SOUND_YM2608, 0);
- ym2608_write(info->chip,3,data);
-}
-
-/************************************************/
-/* Data Write for YM2608 - Chip 1 */
-/* Consists of 2 addresses */
-/************************************************/
-WRITE8_HANDLER( ym2608_data_port_1_a_w ){
- struct ym2608_info *info = sndti_token(SOUND_YM2608, 1);
- ym2608_write(info->chip,1,data);
-}
-WRITE8_HANDLER( ym2608_data_port_1_b_w ){
- struct ym2608_info *info = sndti_token(SOUND_YM2608, 1);
- ym2608_write(info->chip,3,data);
-}
-
-/**************** end of file ****************/
/**************************************************************************
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( ym2608 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( ym2608 )
+DEVICE_GET_INFO( ym2608 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct ym2608_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(ym2608_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( ym2608 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( ym2608 ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( ym2608 ); break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( ym2608 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ym2608 ); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( ym2608 ); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( ym2608 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "YM2608"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Yamaha FM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "YM2608"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Yamaha FM"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/2608intf.h b/src/emu/sound/2608intf.h
index b3a9b8ec3f6..f541742c068 100644
--- a/src/emu/sound/2608intf.h
+++ b/src/emu/sound/2608intf.h
@@ -12,32 +12,22 @@ typedef struct _ym2608_interface ym2608_interface;
struct _ym2608_interface
{
const ay8910_interface ay8910_intf;
- void ( *handler )( running_machine *machine, int irq ); /* IRQ handler for the YM2608 */
+ void ( *handler )( const device_config *device, int irq ); /* IRQ handler for the YM2608 */
};
-/************************************************/
-/* Chip 0 functions */
-/************************************************/
-READ8_HANDLER( ym2608_status_port_0_a_r );
-READ8_HANDLER( ym2608_status_port_0_b_r );
-READ8_HANDLER( ym2608_read_port_0_r );
-WRITE8_HANDLER( ym2608_control_port_0_a_w );
-WRITE8_HANDLER( ym2608_control_port_0_b_w );
-WRITE8_HANDLER( ym2608_data_port_0_a_w );
-WRITE8_HANDLER( ym2608_data_port_0_b_w );
-
-/************************************************/
-/* Chip 1 functions */
-/************************************************/
-READ8_HANDLER( ym2608_status_port_1_a_r );
-READ8_HANDLER( ym2608_status_port_1_b_r );
-READ8_HANDLER( ym2608_read_port_1_r );
-WRITE8_HANDLER( ym2608_control_port_1_a_w );
-WRITE8_HANDLER( ym2608_control_port_1_b_w );
-WRITE8_HANDLER( ym2608_data_port_1_a_w );
-WRITE8_HANDLER( ym2608_data_port_1_b_w );
-
-SND_GET_INFO( ym2608 );
-#define SOUND_YM2608 SND_GET_INFO_NAME( ym2608 )
+READ8_DEVICE_HANDLER( ym2608_r );
+WRITE8_DEVICE_HANDLER( ym2608_w );
+
+READ8_DEVICE_HANDLER( ym2608_read_port_r );
+READ8_DEVICE_HANDLER( ym2608_status_port_a_r );
+READ8_DEVICE_HANDLER( ym2608_status_port_b_r );
+
+WRITE8_DEVICE_HANDLER( ym2608_control_port_a_w );
+WRITE8_DEVICE_HANDLER( ym2608_control_port_b_w );
+WRITE8_DEVICE_HANDLER( ym2608_data_port_a_w );
+WRITE8_DEVICE_HANDLER( ym2608_data_port_b_w );
+
+DEVICE_GET_INFO( ym2608 );
+#define SOUND_YM2608 DEVICE_GET_INFO_NAME( ym2608 )
#endif /* __2608INTF_H__ */
diff --git a/src/emu/sound/2610intf.c b/src/emu/sound/2610intf.c
index 3c515449ae0..e6c8804d488 100644
--- a/src/emu/sound/2610intf.c
+++ b/src/emu/sound/2610intf.c
@@ -17,11 +17,11 @@
#include "2610intf.h"
#include "fm.h"
-static sound_type chip_type = SOUND_YM2610;
-struct ym2610_info
+typedef struct _ym2610_state ym2610_state;
+struct _ym2610_state
{
sound_stream * stream;
- emu_timer * timer[2];
+ emu_timer * timer[2];
void * chip;
void * psg;
const ym2610_interface *intf;
@@ -29,27 +29,37 @@ struct ym2610_info
};
+INLINE ym2610_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_YM2610 || sound_get_type(device) == SOUND_YM2610B);
+ return (ym2610_state *)device->token;
+}
+
+
static void psg_set_clock(void *param, int clock)
{
- struct ym2610_info *info = param;
+ ym2610_state *info = param;
ay8910_set_clock_ym(info->psg, clock);
}
static void psg_write(void *param, int address, int data)
{
- struct ym2610_info *info = param;
+ ym2610_state *info = param;
ay8910_write_ym(info->psg, address, data);
}
static int psg_read(void *param)
{
- struct ym2610_info *info = param;
+ ym2610_state *info = param;
return ay8910_read_ym(info->psg);
}
static void psg_reset(void *param)
{
- struct ym2610_info *info = param;
+ ym2610_state *info = param;
ay8910_reset_ym(info->psg);
}
@@ -65,26 +75,26 @@ static const ssg_callbacks psgintf =
/* IRQ Handler */
static void IRQHandler(void *param,int irq)
{
- struct ym2610_info *info = param;
- if(info->intf->handler) info->intf->handler(info->device->machine, irq);
+ ym2610_state *info = param;
+ if(info->intf->handler) info->intf->handler(info->device, irq);
}
/* Timer overflow callback from timer.c */
static TIMER_CALLBACK( timer_callback_0 )
{
- struct ym2610_info *info = ptr;
+ ym2610_state *info = ptr;
ym2610_timer_over(info->chip,0);
}
static TIMER_CALLBACK( timer_callback_1 )
{
- struct ym2610_info *info = ptr;
+ ym2610_state *info = ptr;
ym2610_timer_over(info->chip,1);
}
static void timer_handler(void *param,int c,int count,int clock)
{
- struct ym2610_info *info = param;
+ ym2610_state *info = param;
if( count == 0 )
{ /* Reset FM Timer */
timer_enable(info->timer[c], 0);
@@ -101,46 +111,51 @@ static void timer_handler(void *param,int c,int count,int clock)
/* update request from fm.c */
void ym2610_update_request(void *param)
{
- struct ym2610_info *info = param;
+ ym2610_state *info = param;
stream_update(info->stream);
}
-#if BUILD_YM2610
+
static STREAM_UPDATE( ym2610_stream_update )
{
- struct ym2610_info *info = param;
+ ym2610_state *info = param;
ym2610_update_one(info->chip, outputs, samples);
}
+static STREAM_UPDATE( ym2610b_stream_update )
+{
+ ym2610_state *info = param;
+ ym2610b_update_one(info->chip, outputs, samples);
+}
+
static STATE_POSTLOAD( ym2610_intf_postload )
{
- struct ym2610_info *info = param;
+ ym2610_state *info = param;
ym2610_postload(info->chip);
}
-static SND_START( ym2610 )
+static DEVICE_START( ym2610 )
{
static const ym2610_interface generic_2610 = { 0 };
static const ay8910_interface generic_ay8910 =
{
AY8910_LEGACY_OUTPUT | AY8910_SINGLE_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
};
const ym2610_interface *intf = device->static_config ? device->static_config : &generic_2610;
- int rate = clock/72;
+ int rate = device->clock/72;
void *pcmbufa,*pcmbufb;
int pcmsizea,pcmsizeb;
- struct ym2610_info *info = device->token;
+ ym2610_state *info = get_safe_token(device);
astring *name = astring_alloc();
-
- chip_type = SOUND_YM2610;
+ sound_type type = sound_get_type(device);
info->intf = intf;
info->device = device;
- info->psg = ay8910_start_ym(NULL, SOUND_YM2610, device, clock, &generic_ay8910);
+ info->psg = ay8910_start_ym(NULL, sound_get_type(device), device, device->clock, &generic_ay8910);
assert_always(info->psg != NULL, "Error creating YM2610/AY8910 chip");
/* Timer Handler set */
@@ -148,7 +163,7 @@ static SND_START( ym2610 )
info->timer[1] = timer_alloc(device->machine, timer_callback_1, info);
/* stream system initialize */
- info->stream = stream_create(device,0,2,rate,info,ym2610_stream_update);
+ info->stream = stream_create(device,0,2,rate,info,(type == SOUND_YM2610) ? ym2610_stream_update : ym2610b_stream_update);
/* setup adpcm buffers */
pcmbufa = device->region;
pcmsizea = device->regionbytes;
@@ -163,376 +178,84 @@ static SND_START( ym2610 )
}
/**** initialize YM2610 ****/
- info->chip = ym2610_init(info,device,clock,rate,
+ info->chip = ym2610_init(info,device,device->clock,rate,
pcmbufa,pcmsizea,pcmbufb,pcmsizeb,
timer_handler,IRQHandler,&psgintf);
assert_always(info->chip != NULL, "Error creating YM2610 chip");
state_save_register_postload(device->machine, ym2610_intf_postload, info);
}
-#endif
-
-#if BUILD_YM2610B
-static STREAM_UPDATE( ym2610b_stream_update )
-{
- struct ym2610_info *info = param;
- ym2610b_update_one(info->chip, outputs, samples);
-}
-
-static SND_START( ym2610b )
-{
- static const ym2610_interface generic_2610 = { 0 };
- static const ay8910_interface generic_ay8910 =
- {
- AY8910_LEGACY_OUTPUT | AY8910_SINGLE_OUTPUT,
- AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
- };
- const ym2610_interface *intf = device->static_config ? device->static_config : &generic_2610;
- int rate = clock/72;
- void *pcmbufa,*pcmbufb;
- int pcmsizea,pcmsizeb;
- struct ym2610_info *info = device->token;
- astring *name = astring_alloc();
-
- chip_type = SOUND_YM2610B;
-
- info->intf = intf;
- info->device = device;
- info->psg = ay8910_start_ym(NULL, SOUND_YM2610B, device, clock, &generic_ay8910);
- assert_always(info->psg != NULL, "Error creating YM2610B/AY8910 chip");
-
- /* Timer Handler set */
- info->timer[0] =timer_alloc(device->machine, timer_callback_0, info);
- info->timer[1] =timer_alloc(device->machine, timer_callback_1, info);
-
- /* stream system initialize */
- info->stream = stream_create(device, 0,2,rate,info,ym2610b_stream_update);
- /* setup adpcm buffers */
- pcmbufa = device->region;
- pcmsizea = device->regionbytes;
- astring_printf(name, "%s.deltat", device->tag);
- pcmbufb = (void *)(memory_region(device->machine, astring_c(name)));
- pcmsizeb = memory_region_length(device->machine, astring_c(name));
- astring_free(name);
- if (pcmbufb == NULL || pcmsizeb == 0)
- {
- pcmbufb = pcmbufa;
- pcmsizeb = pcmsizea;
- }
-
- /**** initialize YM2610 ****/
- info->chip = ym2610_init(info,device,clock,rate,
- pcmbufa,pcmsizea,pcmbufb,pcmsizeb,
- timer_handler,IRQHandler,&psgintf);
- assert_always(info->chip != NULL, "Error creating YM2610B chip");
-}
-#endif
-static SND_STOP( ym2610 )
+static DEVICE_STOP( ym2610 )
{
- struct ym2610_info *info = device->token;
+ ym2610_state *info = get_safe_token(device);
ym2610_shutdown(info->chip);
ay8910_stop_ym(info->psg);
}
-static SND_RESET( ym2610 )
+static DEVICE_RESET( ym2610 )
{
- struct ym2610_info *info = device->token;
+ ym2610_state *info = get_safe_token(device);
ym2610_reset_chip(info->chip);
}
-/************************************************/
-/* Status Read for YM2610 - Chip 0 */
-/************************************************/
-READ8_HANDLER( ym2610_status_port_0_a_r )
-{
-//logerror("PC %04x: 2610 S0A=%02X\n",cpu_get_pc(space->cpu),ym2610_read(sndti_token(chip_type,0,0));
- struct ym2610_info *info = sndti_token(chip_type,0);
- return ym2610_read(info->chip,0);
-}
-
-READ16_HANDLER( ym2610_status_port_0_a_lsb_r )
-{
-//logerror("PC %04x: 2610 S0A=%02X\n",cpu_get_pc(space->cpu),ym2610_read(sndti_token(chip_type,0,0));
- struct ym2610_info *info = sndti_token(chip_type,0);
- return ym2610_read(info->chip,0);
-}
-
-READ8_HANDLER( ym2610_status_port_0_b_r )
-{
-//logerror("PC %04x: 2610 S0B=%02X\n",cpu_get_pc(space->cpu),ym2610_read(sndti_token(chip_type,0,2));
- struct ym2610_info *info = sndti_token(chip_type,0);
- return ym2610_read(info->chip,2);
-}
-
-READ16_HANDLER( ym2610_status_port_0_b_lsb_r )
-{
-//logerror("PC %04x: 2610 S0B=%02X\n",cpu_get_pc(space->cpu),ym2610_read(sndti_token(chip_type,0,2));
- struct ym2610_info *info = sndti_token(chip_type,0);
- return ym2610_read(info->chip,2);
-}
-
-/************************************************/
-/* Status Read for YM2610 - Chip 1 */
-/************************************************/
-READ8_HANDLER( ym2610_status_port_1_a_r ) {
- struct ym2610_info *info = sndti_token(chip_type,1);
- return ym2610_read(info->chip,0);
-}
-
-READ16_HANDLER( ym2610_status_port_1_a_lsb_r ) {
- struct ym2610_info *info = sndti_token(chip_type,1);
- return ym2610_read(info->chip,0);
-}
-
-READ8_HANDLER( ym2610_status_port_1_b_r ) {
- struct ym2610_info *info = sndti_token(chip_type,1);
- return ym2610_read(info->chip,2);
-}
-
-READ16_HANDLER( ym2610_status_port_1_b_lsb_r ) {
- struct ym2610_info *info = sndti_token(chip_type,1);
- return ym2610_read(info->chip,2);
-}
-
-/************************************************/
-/* Port Read for YM2610 - Chip 0 */
-/************************************************/
-READ8_HANDLER( ym2610_read_port_0_r ){
- struct ym2610_info *info = sndti_token(chip_type,0);
- return ym2610_read(info->chip,1);
-}
-
-READ16_HANDLER( ym2610_read_port_0_lsb_r ){
- struct ym2610_info *info = sndti_token(chip_type,0);
- return ym2610_read(info->chip,1);
-}
-
-/************************************************/
-/* Port Read for YM2610 - Chip 1 */
-/************************************************/
-READ8_HANDLER( ym2610_read_port_1_r ){
- struct ym2610_info *info = sndti_token(chip_type,1);
- return ym2610_read(info->chip,1);
-}
-
-READ16_HANDLER( ym2610_read_port_1_lsb_r ){
- struct ym2610_info *info = sndti_token(chip_type,1);
- return ym2610_read(info->chip,1);
-}
-
-/************************************************/
-/* Control Write for YM2610 - Chip 0 */
-/* Consists of 2 addresses */
-/************************************************/
-WRITE8_HANDLER( ym2610_control_port_0_a_w )
-{
-//logerror("PC %04x: 2610 Reg A %02X",cpu_get_pc(space->cpu),data);
- struct ym2610_info *info = sndti_token(chip_type,0);
- ym2610_write(info->chip,0,data);
-}
-
-WRITE16_HANDLER( ym2610_control_port_0_a_lsb_w )
-{
-//logerror("PC %04x: 2610 Reg A %02X",cpu_get_pc(space->cpu),data);
- if (ACCESSING_BITS_0_7)
- {
- struct ym2610_info *info = sndti_token(chip_type,0);
- ym2610_write(info->chip,0,data);
- }
-}
-
-WRITE8_HANDLER( ym2610_control_port_0_b_w )
-{
-//logerror("PC %04x: 2610 Reg B %02X",cpu_get_pc(space->cpu),data);
- struct ym2610_info *info = sndti_token(chip_type,0);
- ym2610_write(info->chip,2,data);
-}
-
-WRITE16_HANDLER( ym2610_control_port_0_b_lsb_w )
-{
-//logerror("PC %04x: 2610 Reg B %02X",cpu_get_pc(space->cpu),data);
- if (ACCESSING_BITS_0_7)
- {
- struct ym2610_info *info = sndti_token(chip_type,0);
- ym2610_write(info->chip,2,data);
- }
-}
-
-/************************************************/
-/* Control Write for YM2610 - Chip 1 */
-/* Consists of 2 addresses */
-/************************************************/
-WRITE8_HANDLER( ym2610_control_port_1_a_w ){
- struct ym2610_info *info = sndti_token(chip_type,1);
- ym2610_write(info->chip,0,data);
-}
-
-WRITE16_HANDLER( ym2610_control_port_1_a_lsb_w ){
- if (ACCESSING_BITS_0_7)
- {
- struct ym2610_info *info = sndti_token(chip_type,1);
- ym2610_write(info->chip,0,data);
- }
-}
-
-WRITE8_HANDLER( ym2610_control_port_1_b_w ){
- struct ym2610_info *info = sndti_token(chip_type,1);
- ym2610_write(info->chip,2,data);
-}
-
-WRITE16_HANDLER( ym2610_control_port_1_b_lsb_w ){
- if (ACCESSING_BITS_0_7)
- {
- struct ym2610_info *info = sndti_token(chip_type,1);
- ym2610_write(info->chip,2,data);
- }
-}
-
-/************************************************/
-/* Data Write for YM2610 - Chip 0 */
-/* Consists of 2 addresses */
-/************************************************/
-WRITE8_HANDLER( ym2610_data_port_0_a_w )
-{
-//logerror(" =%02X\n",data);
- struct ym2610_info *info = sndti_token(chip_type,0);
- ym2610_write(info->chip,1,data);
-}
-
-WRITE16_HANDLER( ym2610_data_port_0_a_lsb_w )
-{
-//logerror(" =%02X\n",data);
- if (ACCESSING_BITS_0_7)
- {
- struct ym2610_info *info = sndti_token(chip_type,0);
- ym2610_write(info->chip,1,data);
- }
-}
-WRITE8_HANDLER( ym2610_data_port_0_b_w )
+READ8_DEVICE_HANDLER( ym2610_r )
{
-//logerror(" =%02X\n",data);
- struct ym2610_info *info = sndti_token(chip_type,0);
- ym2610_write(info->chip,3,data);
+ ym2610_state *info = get_safe_token(device);
+ return ym2610_read(info->chip, offset & 3);
}
-WRITE16_HANDLER( ym2610_data_port_0_b_lsb_w )
+WRITE8_DEVICE_HANDLER( ym2610_w )
{
-//logerror(" =%02X\n",data);
- if (ACCESSING_BITS_0_7)
- {
- struct ym2610_info *info = sndti_token(chip_type,0);
- ym2610_write(info->chip,3,data);
- }
+ ym2610_state *info = get_safe_token(device);
+ ym2610_write(info->chip, offset & 3, data);
}
-/************************************************/
-/* Data Write for YM2610 - Chip 1 */
-/* Consists of 2 addresses */
-/************************************************/
-WRITE8_HANDLER( ym2610_data_port_1_a_w ){
- struct ym2610_info *info = sndti_token(chip_type,1);
- ym2610_write(info->chip,1,data);
-}
-WRITE16_HANDLER( ym2610_data_port_1_a_lsb_w ){
- if (ACCESSING_BITS_0_7)
- {
- struct ym2610_info *info = sndti_token(chip_type,1);
- ym2610_write(info->chip,1,data);
- }
-}
+READ8_DEVICE_HANDLER( ym2610_status_port_a_r ) { return ym2610_r(device, 0); }
+READ8_DEVICE_HANDLER( ym2610_status_port_b_r ) { return ym2610_r(device, 2); }
+READ8_DEVICE_HANDLER( ym2610_read_port_r ) { return ym2610_r(device, 1); }
-WRITE8_HANDLER( ym2610_data_port_1_b_w ){
- struct ym2610_info *info = sndti_token(chip_type,1);
- ym2610_write(info->chip,3,data);
-}
+WRITE8_DEVICE_HANDLER( ym2610_control_port_a_w ) { ym2610_w(device, 0, data); }
+WRITE8_DEVICE_HANDLER( ym2610_control_port_b_w ) { ym2610_w(device, 2, data); }
+WRITE8_DEVICE_HANDLER( ym2610_data_port_a_w ) { ym2610_w(device, 1, data); }
+WRITE8_DEVICE_HANDLER( ym2610_data_port_b_w ) { ym2610_w(device, 3, data); }
-WRITE16_HANDLER( ym2610_data_port_1_b_lsb_w ){
- if (ACCESSING_BITS_0_7)
- {
- struct ym2610_info *info = sndti_token(chip_type,1);
- ym2610_write(info->chip,3,data);
- }
-}
-
-/**************** end of file ****************/
/**************************************************************************
* Generic get_info
**************************************************************************/
-#if BUILD_YM2610
-static SND_SET_INFO( ym2610 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( ym2610 )
+DEVICE_GET_INFO( ym2610 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct ym2610_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(ym2610_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( ym2610 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( ym2610 ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( ym2610 ); break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( ym2610 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ym2610 ); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( ym2610 ); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( ym2610 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "YM2610"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Yamaha FM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "YM2610"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Yamaha FM"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
-#endif
-
-
-/**************************************************************************
- * Generic get_info
- **************************************************************************/
-#if BUILD_YM2610B
-static SND_SET_INFO( ym2610b )
+DEVICE_GET_INFO( ym2610b )
{
switch (state)
{
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( ym2610b )
-{
- switch (state)
- {
- /* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct ym2610_info); break;
-
- /* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( ym2610b ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( ym2610b ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( ym2610 ); break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( ym2610 ); break;
-
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "YM2610B"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Yamaha FM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "YM2610B"); break;
+
+ default: DEVICE_GET_INFO_CALL(ym2610); break;
}
}
-
-#endif
diff --git a/src/emu/sound/2610intf.h b/src/emu/sound/2610intf.h
index 39050bf5af2..31129b477e5 100644
--- a/src/emu/sound/2610intf.h
+++ b/src/emu/sound/2610intf.h
@@ -11,49 +11,26 @@ void ym2610_update_request(void *param);
typedef struct _ym2610_interface ym2610_interface;
struct _ym2610_interface
{
- void ( *handler )( running_machine *machine, int irq ); /* IRQ handler for the YM2610 */
+ void ( *handler )( const device_config *device, int irq ); /* IRQ handler for the YM2610 */
};
-/************************************************/
-/* Chip 0 functions */
-/************************************************/
-READ8_HANDLER( ym2610_status_port_0_a_r );
-READ16_HANDLER( ym2610_status_port_0_a_lsb_r );
-READ8_HANDLER( ym2610_status_port_0_b_r );
-READ16_HANDLER( ym2610_status_port_0_b_lsb_r );
-READ8_HANDLER( ym2610_read_port_0_r );
-READ16_HANDLER( ym2610_read_port_0_lsb_r );
-WRITE8_HANDLER( ym2610_control_port_0_a_w );
-WRITE16_HANDLER( ym2610_control_port_0_a_lsb_w );
-WRITE8_HANDLER( ym2610_control_port_0_b_w );
-WRITE16_HANDLER( ym2610_control_port_0_b_lsb_w );
-WRITE8_HANDLER( ym2610_data_port_0_a_w );
-WRITE16_HANDLER( ym2610_data_port_0_a_lsb_w );
-WRITE8_HANDLER( ym2610_data_port_0_b_w );
-WRITE16_HANDLER( ym2610_data_port_0_b_lsb_w );
-
-/************************************************/
-/* Chip 1 functions */
-/************************************************/
-READ8_HANDLER( ym2610_status_port_1_a_r );
-READ16_HANDLER( ym2610_status_port_1_a_lsb_r );
-READ8_HANDLER( ym2610_status_port_1_b_r );
-READ16_HANDLER( ym2610_status_port_1_b_lsb_r );
-READ8_HANDLER( ym2610_read_port_1_r );
-READ16_HANDLER( ym2610_read_port_1_lsb_r );
-WRITE8_HANDLER( ym2610_control_port_1_a_w );
-WRITE16_HANDLER( ym2610_control_port_1_a_lsb_w );
-WRITE8_HANDLER( ym2610_control_port_1_b_w );
-WRITE16_HANDLER( ym2610_control_port_1_b_lsb_w );
-WRITE8_HANDLER( ym2610_data_port_1_a_w );
-WRITE16_HANDLER( ym2610_data_port_1_a_lsb_w );
-WRITE8_HANDLER( ym2610_data_port_1_b_w );
-WRITE16_HANDLER( ym2610_data_port_1_b_lsb_w );
-
-SND_GET_INFO( ym2610 );
-SND_GET_INFO( ym2610b );
-
-#define SOUND_YM2610 SND_GET_INFO_NAME( ym2610 )
-#define SOUND_YM2610B SND_GET_INFO_NAME( ym2610b )
+READ8_DEVICE_HANDLER( ym2610_r );
+WRITE8_DEVICE_HANDLER( ym2610_w );
+
+READ8_DEVICE_HANDLER( ym2610_status_port_a_r );
+READ8_DEVICE_HANDLER( ym2610_status_port_b_r );
+READ8_DEVICE_HANDLER( ym2610_read_port_r );
+
+WRITE8_DEVICE_HANDLER( ym2610_control_port_a_w );
+WRITE8_DEVICE_HANDLER( ym2610_control_port_b_w );
+WRITE8_DEVICE_HANDLER( ym2610_data_port_a_w );
+WRITE8_DEVICE_HANDLER( ym2610_data_port_b_w );
+
+
+DEVICE_GET_INFO( ym2610 );
+DEVICE_GET_INFO( ym2610b );
+
+#define SOUND_YM2610 DEVICE_GET_INFO_NAME( ym2610 )
+#define SOUND_YM2610B DEVICE_GET_INFO_NAME( ym2610b )
#endif /* __2610INTF_H__ */
diff --git a/src/emu/sound/2612intf.c b/src/emu/sound/2612intf.c
index aa11a9dcfc9..be1e6db2d75 100644
--- a/src/emu/sound/2612intf.c
+++ b/src/emu/sound/2612intf.c
@@ -17,39 +17,52 @@
#include "sound/2612intf.h"
-struct ym2612_info
+typedef struct _ym2612_state ym2612_state;
+struct _ym2612_state
{
sound_stream * stream;
- emu_timer * timer[2];
+ emu_timer * timer[2];
void * chip;
const ym2612_interface *intf;
const device_config *device;
};
+
+INLINE ym2612_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_YM2612 || sound_get_type(device) == SOUND_YM3438);
+ return (ym2612_state *)device->token;
+}
+
+
+
/*------------------------- TM2612 -------------------------------*/
/* IRQ Handler */
static void IRQHandler(void *param,int irq)
{
- struct ym2612_info *info = param;
- if(info->intf->handler) info->intf->handler(info->device->machine, irq);
+ ym2612_state *info = param;
+ if(info->intf->handler) info->intf->handler(info->device, irq);
}
/* Timer overflow callback from timer.c */
static TIMER_CALLBACK( timer_callback_2612_0 )
{
- struct ym2612_info *info = ptr;
+ ym2612_state *info = ptr;
ym2612_timer_over(info->chip,0);
}
static TIMER_CALLBACK( timer_callback_2612_1 )
{
- struct ym2612_info *info = ptr;
+ ym2612_state *info = ptr;
ym2612_timer_over(info->chip,1);
}
static void timer_handler(void *param,int c,int count,int clock)
{
- struct ym2612_info *info = param;
+ ym2612_state *info = param;
if( count == 0 )
{ /* Reset FM Timer */
timer_enable(info->timer[c], 0);
@@ -65,7 +78,7 @@ static void timer_handler(void *param,int c,int count,int clock)
/* update request from fm.c */
void ym2612_update_request(void *param)
{
- struct ym2612_info *info = param;
+ ym2612_state *info = param;
stream_update(info->stream);
}
@@ -75,23 +88,23 @@ void ym2612_update_request(void *param)
static STREAM_UPDATE( ym2612_stream_update )
{
- struct ym2612_info *info = param;
+ ym2612_state *info = param;
ym2612_update_one(info->chip, outputs, samples);
}
static STATE_POSTLOAD( ym2612_intf_postload )
{
- struct ym2612_info *info = param;
+ ym2612_state *info = param;
ym2612_postload(info->chip);
}
-static SND_START( ym2612 )
+static DEVICE_START( ym2612 )
{
static const ym2612_interface dummy = { 0 };
- struct ym2612_info *info = device->token;
- int rate = clock/72;
+ ym2612_state *info = get_safe_token(device);
+ int rate = device->clock/72;
info->intf = device->static_config ? device->static_config : &dummy;
info->device = device;
@@ -105,308 +118,85 @@ static SND_START( ym2612 )
info->stream = stream_create(device,0,2,rate,info,ym2612_stream_update);
/**** initialize YM2612 ****/
- info->chip = ym2612_init(info,device,clock,rate,timer_handler,IRQHandler);
+ info->chip = ym2612_init(info,device,device->clock,rate,timer_handler,IRQHandler);
assert_always(info->chip != NULL, "Error creating YM2612 chip");
state_save_register_postload(device->machine, ym2612_intf_postload, info);
}
-static SND_STOP( ym2612 )
+static DEVICE_STOP( ym2612 )
{
- struct ym2612_info *info = device->token;
+ ym2612_state *info = get_safe_token(device);
ym2612_shutdown(info->chip);
}
-static SND_RESET( ym2612 )
+static DEVICE_RESET( ym2612 )
{
- struct ym2612_info *info = device->token;
+ ym2612_state *info = get_safe_token(device);
ym2612_reset_chip(info->chip);
}
-/************************************************/
-/* Status Read for YM2612 - Chip 0 */
-/************************************************/
-READ8_HANDLER( ym2612_status_port_0_a_r )
-{
- struct ym2612_info *info = sndti_token(SOUND_YM2612,0);
- return ym2612_read(info->chip,0);
-}
-
-READ8_HANDLER( ym2612_status_port_0_b_r )
-{
- struct ym2612_info *info = sndti_token(SOUND_YM2612,0);
- return ym2612_read(info->chip,2);
-}
-
-/************************************************/
-/* Status Read for YM2612 - Chip 1 */
-/************************************************/
-READ8_HANDLER( ym2612_status_port_1_a_r ) {
- struct ym2612_info *info = sndti_token(SOUND_YM2612,1);
- return ym2612_read(info->chip,0);
-}
-
-READ8_HANDLER( ym2612_status_port_1_b_r ) {
- struct ym2612_info *info = sndti_token(SOUND_YM2612,1);
- return ym2612_read(info->chip,2);
-}
-
-/************************************************/
-/* Port Read for YM2612 - Chip 0 */
-/************************************************/
-READ8_HANDLER( ym2612_read_port_0_r ){
- struct ym2612_info *info = sndti_token(SOUND_YM2612,0);
- return ym2612_read(info->chip,1);
-}
-
-/************************************************/
-/* Port Read for YM2612 - Chip 1 */
-/************************************************/
-READ8_HANDLER( ym2612_read_port_1_r ){
- struct ym2612_info *info = sndti_token(SOUND_YM2612,1);
- return ym2612_read(info->chip,1);
-}
-
-/************************************************/
-/* Control Write for YM2612 - Chip 0 */
-/* Consists of 2 addresses */
-/************************************************/
-WRITE8_HANDLER( ym2612_control_port_0_a_w )
-{
- struct ym2612_info *info = sndti_token(SOUND_YM2612,0);
- ym2612_write(info->chip,0,data);
-}
-
-WRITE8_HANDLER( ym2612_control_port_0_b_w )
-{
- struct ym2612_info *info = sndti_token(SOUND_YM2612,0);
- ym2612_write(info->chip,2,data);
-}
-
-/************************************************/
-/* Control Write for YM2612 - Chip 1 */
-/* Consists of 2 addresses */
-/************************************************/
-WRITE8_HANDLER( ym2612_control_port_1_a_w ){
- struct ym2612_info *info = sndti_token(SOUND_YM2612,1);
- ym2612_write(info->chip,0,data);
-}
-
-WRITE8_HANDLER( ym2612_control_port_1_b_w ){
- struct ym2612_info *info = sndti_token(SOUND_YM2612,1);
- ym2612_write(info->chip,2,data);
-}
-
-/************************************************/
-/* Data Write for YM2612 - Chip 0 */
-/* Consists of 2 addresses */
-/************************************************/
-WRITE8_HANDLER( ym2612_data_port_0_a_w )
-{
- struct ym2612_info *info = sndti_token(SOUND_YM2612,0);
- ym2612_write(info->chip,1,data);
-}
-
-WRITE8_HANDLER( ym2612_data_port_0_b_w )
-{
- struct ym2612_info *info = sndti_token(SOUND_YM2612,0);
- ym2612_write(info->chip,3,data);
-}
-
-/************************************************/
-/* Data Write for YM2612 - Chip 1 */
-/* Consists of 2 addresses */
-/************************************************/
-WRITE8_HANDLER( ym2612_data_port_1_a_w ){
- struct ym2612_info *info = sndti_token(SOUND_YM2612,1);
- ym2612_write(info->chip,1,data);
-}
-WRITE8_HANDLER( ym2612_data_port_1_b_w ){
- struct ym2612_info *info = sndti_token(SOUND_YM2612,1);
- ym2612_write(info->chip,3,data);
-}
-
-#if BUILD_YM3438
-
-/************************************************/
-/* Status Read for YM3438 - Chip 0 */
-/************************************************/
-READ8_HANDLER( ym3438_status_port_0_a_r )
-{
- struct ym2612_info *info = sndti_token(SOUND_YM3438,0);
- return ym2612_read(info->chip,0);
-}
-
-READ8_HANDLER( ym3438_status_port_0_b_r )
-{
- struct ym2612_info *info = sndti_token(SOUND_YM3438,0);
- return ym2612_read(info->chip,2);
-}
-
-/************************************************/
-/* Status Read for YM3438 - Chip 1 */
-/************************************************/
-READ8_HANDLER( ym3438_status_port_1_a_r ) {
- struct ym2612_info *info = sndti_token(SOUND_YM3438,1);
- return ym2612_read(info->chip,0);
-}
-
-READ8_HANDLER( ym3438_status_port_1_b_r ) {
- struct ym2612_info *info = sndti_token(SOUND_YM3438,1);
- return ym2612_read(info->chip,2);
-}
-
-/************************************************/
-/* Port Read for YM3438 - Chip 0 */
-/************************************************/
-READ8_HANDLER( ym3438_read_port_0_r ){
- struct ym2612_info *info = sndti_token(SOUND_YM3438,0);
- return ym2612_read(info->chip,1);
-}
-
-/************************************************/
-/* Port Read for YM3438 - Chip 1 */
-/************************************************/
-READ8_HANDLER( ym3438_read_port_1_r ){
- struct ym2612_info *info = sndti_token(SOUND_YM3438,1);
- return ym2612_read(info->chip,1);
-}
-
-/************************************************/
-/* Control Write for YM3438 - Chip 0 */
-/* Consists of 2 addresses */
-/************************************************/
-WRITE8_HANDLER( ym3438_control_port_0_a_w )
+READ8_DEVICE_HANDLER( ym2612_r )
{
- struct ym2612_info *info = sndti_token(SOUND_YM3438,0);
- ym2612_write(info->chip,0,data);
+ ym2612_state *info = get_safe_token(device);
+ return ym2612_read(info->chip, offset & 3);
}
-WRITE8_HANDLER( ym3438_control_port_0_b_w )
+WRITE8_DEVICE_HANDLER( ym2612_w )
{
- struct ym2612_info *info = sndti_token(SOUND_YM3438,0);
- ym2612_write(info->chip,2,data);
+ ym2612_state *info = get_safe_token(device);
+ ym2612_write(info->chip, offset & 3, data);
}
-/************************************************/
-/* Control Write for YM3438 - Chip 1 */
-/* Consists of 2 addresses */
-/************************************************/
-WRITE8_HANDLER( ym3438_control_port_1_a_w ){
- struct ym2612_info *info = sndti_token(SOUND_YM3438,1);
- ym2612_write(info->chip,0,data);
-}
-WRITE8_HANDLER( ym3438_control_port_1_b_w ){
- struct ym2612_info *info = sndti_token(SOUND_YM3438,1);
- ym2612_write(info->chip,2,data);
-}
+READ8_DEVICE_HANDLER( ym2612_status_port_a_r ) { return ym2612_r(device, 0); }
+READ8_DEVICE_HANDLER( ym2612_status_port_b_r ) { return ym2612_r(device, 2); }
+READ8_DEVICE_HANDLER( ym2612_data_port_a_r ) { return ym2612_r(device, 1); }
+READ8_DEVICE_HANDLER( ym2612_data_port_b_r ) { return ym2612_r(device, 3); }
-/************************************************/
-/* Data Write for YM3438 - Chip 0 */
-/* Consists of 2 addresses */
-/************************************************/
-WRITE8_HANDLER( ym3438_data_port_0_a_w )
-{
- struct ym2612_info *info = sndti_token(SOUND_YM3438,0);
- ym2612_write(info->chip,1,data);
-}
+WRITE8_DEVICE_HANDLER( ym2612_control_port_a_w ) { ym2612_w(device, 0, data); }
+WRITE8_DEVICE_HANDLER( ym2612_control_port_b_w ) { ym2612_w(device, 2, data); }
+WRITE8_DEVICE_HANDLER( ym2612_data_port_a_w ) { ym2612_w(device, 1, data); }
+WRITE8_DEVICE_HANDLER( ym2612_data_port_b_w ) { ym2612_w(device, 3, data); }
-WRITE8_HANDLER( ym3438_data_port_0_b_w )
-{
- struct ym2612_info *info = sndti_token(SOUND_YM3438,0);
- ym2612_write(info->chip,3,data);
-}
-/************************************************/
-/* Data Write for YM3438 - Chip 1 */
-/* Consists of 2 addresses */
-/************************************************/
-WRITE8_HANDLER( ym3438_data_port_1_a_w ){
- struct ym2612_info *info = sndti_token(SOUND_YM3438,1);
- ym2612_write(info->chip,1,data);
-}
-WRITE8_HANDLER( ym3438_data_port_1_b_w ){
- struct ym2612_info *info = sndti_token(SOUND_YM3438,1);
- ym2612_write(info->chip,3,data);
-}
-
-#endif
-/**************** end of file ****************/
/**************************************************************************
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( ym2612 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( ym2612 )
+DEVICE_GET_INFO( ym2612 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct ym2612_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(ym2612_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( ym2612 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( ym2612 ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( ym2612 ); break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( ym2612 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ym2612 ); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( ym2612 ); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( ym2612 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "YM2612"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Yamaha FM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "YM2612"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Yamaha FM"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
-/**************************************************************************
- * Generic get_info
- **************************************************************************/
-
-#if BUILD_YM3438
-static SND_SET_INFO( ym3438 )
+DEVICE_GET_INFO( ym3438 )
{
switch (state)
{
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( ym3438 )
-{
- switch (state)
- {
- /* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct ym2612_info); break;
-
- /* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( ym3438 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( ym2612 ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( ym2612 ); break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( ym2612 ); break;
-
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "YM3438"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Yamaha FM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "YM3438"); break;
+
+ default: DEVICE_GET_INFO_CALL(ym2612); break;
}
}
-
-#endif
diff --git a/src/emu/sound/2612intf.h b/src/emu/sound/2612intf.h
index 16eb800a16d..1cce505d279 100644
--- a/src/emu/sound/2612intf.h
+++ b/src/emu/sound/2612intf.h
@@ -8,66 +8,49 @@ void ym2612_update_request(void *param);
typedef struct _ym2612_interface ym2612_interface;
struct _ym2612_interface
{
- void (*handler)(running_machine *machine, int irq);
+ void (*handler)(const device_config *device, int irq);
};
+READ8_DEVICE_HANDLER( ym2612_r );
+WRITE8_DEVICE_HANDLER( ym2612_w );
-/************************************************/
-/* Chip 0 functions */
-/************************************************/
-READ8_HANDLER( ym2612_status_port_0_a_r ); /* A=0 : OPN status */
-READ8_HANDLER( ym2612_status_port_0_b_r ); /* A=2 : don't care */
-READ8_HANDLER( ym2612_read_port_0_r ); /* A=1 : don't care */
-WRITE8_HANDLER( ym2612_control_port_0_a_w ); /* A=0:OPN address */
-WRITE8_HANDLER( ym2612_control_port_0_b_w ); /* A=2:OPN2 address */
-WRITE8_HANDLER( ym2612_data_port_0_a_w ); /* A=1:OPN data */
-WRITE8_HANDLER( ym2612_data_port_0_b_w ); /* A=3:OPN2 data */
-
-/************************************************/
-/* Chip 1 functions */
-/************************************************/
-READ8_HANDLER( ym2612_status_port_1_a_r );
-READ8_HANDLER( ym2612_status_port_1_b_r );
-READ8_HANDLER( ym2612_read_port_1_r );
-WRITE8_HANDLER( ym2612_control_port_1_a_w );
-WRITE8_HANDLER( ym2612_control_port_1_b_w );
-WRITE8_HANDLER( ym2612_data_port_1_a_w );
-WRITE8_HANDLER( ym2612_data_port_1_b_w );
-
-SND_GET_INFO( ym2612 );
-#define SOUND_YM2612 SND_GET_INFO_NAME( ym2612 )
+READ8_DEVICE_HANDLER( ym2612_status_port_a_r );
+READ8_DEVICE_HANDLER( ym2612_status_port_b_r );
+READ8_DEVICE_HANDLER( ym2612_data_port_a_r );
+READ8_DEVICE_HANDLER( ym2612_data_port_b_r );
+
+WRITE8_DEVICE_HANDLER( ym2612_control_port_a_w );
+WRITE8_DEVICE_HANDLER( ym2612_control_port_b_w );
+WRITE8_DEVICE_HANDLER( ym2612_data_port_a_w );
+WRITE8_DEVICE_HANDLER( ym2612_data_port_b_w );
+
+
+DEVICE_GET_INFO( ym2612 );
+#define SOUND_YM2612 DEVICE_GET_INFO_NAME( ym2612 )
typedef struct _ym3438_interface ym3438_interface;
struct _ym3438_interface
{
- void (*handler)(running_machine *machine, int irq);
+ void (*handler)(const device_config *device, int irq);
};
-/************************************************/
-/* Chip 0 functions */
-/************************************************/
-READ8_HANDLER( ym3438_status_port_0_a_r ); /* A=0 : OPN status */
-READ8_HANDLER( ym3438_status_port_0_b_r ); /* A=2 : don't care */
-READ8_HANDLER( ym3438_read_port_0_r ); /* A=1 : don't care */
-WRITE8_HANDLER( ym3438_control_port_0_a_w ); /* A=0:OPN address */
-WRITE8_HANDLER( ym3438_control_port_0_b_w ); /* A=2:OPN2 address */
-WRITE8_HANDLER( ym3438_data_port_0_a_w ); /* A=1:OPN data */
-WRITE8_HANDLER( ym3438_data_port_0_b_w ); /* A=3:OPN2 data */
-
-/************************************************/
-/* Chip 1 functions */
-/************************************************/
-READ8_HANDLER( ym3438_status_port_1_a_r );
-READ8_HANDLER( ym3438_status_port_1_b_r );
-READ8_HANDLER( ym3438_read_port_1_r );
-WRITE8_HANDLER( ym3438_control_port_1_a_w );
-WRITE8_HANDLER( ym3438_control_port_1_b_w );
-WRITE8_HANDLER( ym3438_data_port_1_a_w );
-WRITE8_HANDLER( ym3438_data_port_1_b_w );
-
-SND_GET_INFO( ym3438 );
-#define SOUND_YM3438 SND_GET_INFO_NAME( ym3438 )
+#define ym3438_r ym2612_r
+#define ym3438_w ym2612_w
+
+#define ym3438_status_port_a_r ym2612_status_port_a_r
+#define ym3438_status_port_b_r ym2612_status_port_b_r
+#define ym3438_data_port_a_r ym2612_data_port_a_r
+#define ym3438_data_port_b_r ym2612_data_port_b_r
+
+#define ym3438_control_port_a_w ym2612_control_port_a_w
+#define ym3438_control_port_b_w ym2612_control_port_b_w
+#define ym3438_data_port_a_w ym2612_data_port_a_w
+#define ym3438_data_port_b_w ym2612_data_port_b_w
+
+
+DEVICE_GET_INFO( ym3438 );
+#define SOUND_YM3438 DEVICE_GET_INFO_NAME( ym3438 )
#endif /* __2612INTF_H__ */
diff --git a/src/emu/sound/262intf.c b/src/emu/sound/262intf.c
index bbb3bff6319..30369f8f61d 100644
--- a/src/emu/sound/262intf.c
+++ b/src/emu/sound/262intf.c
@@ -11,39 +11,50 @@
#include "ymf262.h"
-struct ymf262_info
+typedef struct _ymf262_state ymf262_state;
+struct _ymf262_state
{
sound_stream * stream;
- emu_timer * timer[2];
+ emu_timer * timer[2];
void * chip;
const ymf262_interface *intf;
const device_config *device;
};
+INLINE ymf262_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_YMF262);
+ return (ymf262_state *)device->token;
+}
+
+
static void IRQHandler_262(void *param,int irq)
{
- struct ymf262_info *info = param;
- if (info->intf->handler) (info->intf->handler)(info->device->machine, irq);
+ ymf262_state *info = param;
+ if (info->intf->handler) (info->intf->handler)(info->device, irq);
}
static TIMER_CALLBACK( timer_callback_262_0 )
{
- struct ymf262_info *info = ptr;
+ ymf262_state *info = ptr;
ymf262_timer_over(info->chip, 0);
}
static TIMER_CALLBACK( timer_callback_262_1 )
{
- struct ymf262_info *info = ptr;
+ ymf262_state *info = ptr;
ymf262_timer_over(info->chip, 1);
}
static void timer_handler_262(void *param,int timer, attotime period)
{
- struct ymf262_info *info = param;
+ ymf262_state *info = param;
if( attotime_compare(period, attotime_zero) == 0 )
{ /* Reset FM Timer */
timer_enable(info->timer[timer], 0);
@@ -56,28 +67,28 @@ static void timer_handler_262(void *param,int timer, attotime period)
static STREAM_UPDATE( ymf262_stream_update )
{
- struct ymf262_info *info = param;
+ ymf262_state *info = param;
ymf262_update_one(info->chip, outputs, samples);
}
static void _stream_update(void *param, int interval)
{
- struct ymf262_info *info = param;
+ ymf262_state *info = param;
stream_update(info->stream);
}
-static SND_START( ymf262 )
+static DEVICE_START( ymf262 )
{
static const ymf262_interface dummy = { 0 };
- struct ymf262_info *info = device->token;
- int rate = clock/288;
+ ymf262_state *info = get_safe_token(device);
+ int rate = device->clock/288;
info->intf = device->static_config ? device->static_config : &dummy;
info->device = device;
/* stream system initialize */
- info->chip = ymf262_init(device,clock,rate);
+ info->chip = ymf262_init(device,device->clock,rate);
assert_always(info->chip != NULL, "Error creating YMF262 chip");
info->stream = stream_create(device,0,4,rate,info,ymf262_stream_update);
@@ -91,96 +102,61 @@ static SND_START( ymf262 )
info->timer[1] = timer_alloc(device->machine, timer_callback_262_1, info);
}
-static SND_STOP( ymf262 )
+static DEVICE_STOP( ymf262 )
{
- struct ymf262_info *info = device->token;
+ ymf262_state *info = get_safe_token(device);
ymf262_shutdown(info->chip);
}
/* reset */
-static SND_RESET( ymf262 )
+static DEVICE_RESET( ymf262 )
{
- struct ymf262_info *info = device->token;
+ ymf262_state *info = get_safe_token(device);
ymf262_reset_chip(info->chip);
}
-/* chip #0 */
-READ8_HANDLER( ymf262_status_0_r ) {
- struct ymf262_info *info = sndti_token(SOUND_YMF262, 0);
- return ymf262_read(info->chip, 0);
-}
-WRITE8_HANDLER( ymf262_register_a_0_w ) {
- struct ymf262_info *info = sndti_token(SOUND_YMF262, 0);
- ymf262_write(info->chip, 0, data);
-}
-WRITE8_HANDLER( ymf262_data_a_0_w ) {
- struct ymf262_info *info = sndti_token(SOUND_YMF262, 0);
- ymf262_write(info->chip, 1, data);
-}
-WRITE8_HANDLER( ymf262_register_b_0_w ) {
- struct ymf262_info *info = sndti_token(SOUND_YMF262, 0);
- ymf262_write(info->chip, 2, data);
-}
-WRITE8_HANDLER( ymf262_data_b_0_w ) {
- struct ymf262_info *info = sndti_token(SOUND_YMF262, 0);
- ymf262_write(info->chip, 3, data);
-}
-/* chip #1 */
-READ8_HANDLER( ymf262_status_1_r ) {
- struct ymf262_info *info = sndti_token(SOUND_YMF262, 1);
- return ymf262_read(info->chip, 0);
-}
-WRITE8_HANDLER( ymf262_register_a_1_w ) {
- struct ymf262_info *info = sndti_token(SOUND_YMF262, 1);
- ymf262_write(info->chip, 0, data);
-}
-WRITE8_HANDLER( ymf262_data_a_1_w ) {
- struct ymf262_info *info = sndti_token(SOUND_YMF262, 1);
- ymf262_write(info->chip, 1, data);
-}
-WRITE8_HANDLER( ymf262_register_b_1_w ) {
- struct ymf262_info *info = sndti_token(SOUND_YMF262, 1);
- ymf262_write(info->chip, 2, data);
+READ8_DEVICE_HANDLER( ymf262_r )
+{
+ ymf262_state *info = get_safe_token(device);
+ return ymf262_read(info->chip, offset & 3);
}
-WRITE8_HANDLER( ymf262_data_b_1_w ) {
- struct ymf262_info *info = sndti_token(SOUND_YMF262, 1);
- ymf262_write(info->chip, 3, data);
+
+WRITE8_DEVICE_HANDLER( ymf262_w )
+{
+ ymf262_state *info = get_safe_token(device);
+ ymf262_write(info->chip, offset & 3, data);
}
+READ8_DEVICE_HANDLER ( ymf262_status_r ) { return ymf262_r(device, 0); }
+WRITE8_DEVICE_HANDLER( ymf262_register_a_w ) { ymf262_w(device, 0, data); }
+WRITE8_DEVICE_HANDLER( ymf262_register_b_w ) { ymf262_w(device, 2, data); }
+WRITE8_DEVICE_HANDLER( ymf262_data_a_w ) { ymf262_w(device, 1, data); }
+WRITE8_DEVICE_HANDLER( ymf262_data_b_w ) { ymf262_w(device, 3, data); }
+
/**************************************************************************
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( ymf262 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( ymf262 )
+DEVICE_GET_INFO( ymf262 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct ymf262_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(ymf262_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( ymf262 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( ymf262 ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( ymf262 ); break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( ymf262 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ymf262 ); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( ymf262 ); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( ymf262 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "YMF262"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Yamaha FM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "YMF262"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Yamaha FM"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/262intf.h b/src/emu/sound/262intf.h
index 10818a575df..7bcf1a69da3 100644
--- a/src/emu/sound/262intf.h
+++ b/src/emu/sound/262intf.h
@@ -7,26 +7,21 @@
typedef struct _ymf262_interface ymf262_interface;
struct _ymf262_interface
{
- void (*handler)(running_machine *machine, int irq);
+ void (*handler)(const device_config *device, int irq);
};
+READ8_DEVICE_HANDLER( ymf262_r );
+WRITE8_DEVICE_HANDLER( ymf262_w );
-/* YMF262 */
-READ8_HANDLER ( ymf262_status_0_r );
-WRITE8_HANDLER( ymf262_register_a_0_w );
-WRITE8_HANDLER( ymf262_register_b_0_w );
-WRITE8_HANDLER( ymf262_data_a_0_w );
-WRITE8_HANDLER( ymf262_data_b_0_w );
+READ8_DEVICE_HANDLER ( ymf262_status_r );
+WRITE8_DEVICE_HANDLER( ymf262_register_a_w );
+WRITE8_DEVICE_HANDLER( ymf262_register_b_w );
+WRITE8_DEVICE_HANDLER( ymf262_data_a_w );
+WRITE8_DEVICE_HANDLER( ymf262_data_b_w );
-READ8_HANDLER ( ymf262_status_1_r );
-WRITE8_HANDLER( ymf262_register_a_1_w );
-WRITE8_HANDLER( ymf262_register_b_1_w );
-WRITE8_HANDLER( ymf262_data_a_1_w );
-WRITE8_HANDLER( ymf262_data_b_1_w );
-
-SND_GET_INFO( ymf262 );
-#define SOUND_YMF262 SND_GET_INFO_NAME( ymf262 )
+DEVICE_GET_INFO( ymf262 );
+#define SOUND_YMF262 DEVICE_GET_INFO_NAME( ymf262 )
#endif /* __262INTF_H__ */
diff --git a/src/emu/sound/3526intf.c b/src/emu/sound/3526intf.c
new file mode 100644
index 00000000000..53146bb3e69
--- /dev/null
+++ b/src/emu/sound/3526intf.c
@@ -0,0 +1,170 @@
+/******************************************************************************
+* FILE
+* Yamaha 3812 emulator interface - MAME VERSION
+*
+* CREATED BY
+* Ernesto Corvi
+*
+* UPDATE LOG
+* JB 28-04-2002 Fixed simultaneous usage of all three different chip types.
+* Used real sample rate when resample filter is active.
+* AAT 12-28-2001 Protected Y8950 from accessing unmapped port and keyboard handlers.
+* CHS 1999-01-09 Fixes new ym3812 emulation interface.
+* CHS 1998-10-23 Mame streaming sound chip update
+* EC 1998 Created Interface
+*
+* NOTES
+*
+******************************************************************************/
+#include "sndintrf.h"
+#include "streams.h"
+#include "cpuintrf.h"
+#include "3526intf.h"
+#include "fm.h"
+#include "sound/fmopl.h"
+
+
+typedef struct _ym3526_state ym3526_state;
+struct _ym3526_state
+{
+ sound_stream * stream;
+ emu_timer * timer[2];
+ void * chip;
+ const ym3526_interface *intf;
+ const device_config *device;
+};
+
+
+INLINE ym3526_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_YM3526);
+ return (ym3526_state *)device->token;
+}
+
+
+/* IRQ Handler */
+static void IRQHandler(void *param,int irq)
+{
+ ym3526_state *info = param;
+ if (info->intf->handler) (info->intf->handler)(info->device, irq ? ASSERT_LINE : CLEAR_LINE);
+}
+/* Timer overflow callback from timer.c */
+static TIMER_CALLBACK( timer_callback_0 )
+{
+ ym3526_state *info = ptr;
+ ym3526_timer_over(info->chip,0);
+}
+static TIMER_CALLBACK( timer_callback_1 )
+{
+ ym3526_state *info = ptr;
+ ym3526_timer_over(info->chip,1);
+}
+/* TimerHandler from fm.c */
+static void TimerHandler(void *param,int c,attotime period)
+{
+ ym3526_state *info = param;
+ if( attotime_compare(period, attotime_zero) == 0 )
+ { /* Reset FM Timer */
+ timer_enable(info->timer[c], 0);
+ }
+ else
+ { /* Start FM Timer */
+ timer_adjust_oneshot(info->timer[c], period, 0);
+ }
+}
+
+
+static STREAM_UPDATE( ym3526_stream_update )
+{
+ ym3526_state *info = param;
+ ym3526_update_one(info->chip, outputs[0], samples);
+}
+
+static void _stream_update(void *param, int interval)
+{
+ ym3526_state *info = param;
+ stream_update(info->stream);
+}
+
+
+static DEVICE_START( ym3526 )
+{
+ static const ym3526_interface dummy = { 0 };
+ ym3526_state *info = get_safe_token(device);
+ int rate = device->clock/72;
+
+ info->intf = device->static_config ? device->static_config : &dummy;
+ info->device = device;
+
+ /* stream system initialize */
+ info->chip = ym3526_init(device,device->clock,rate);
+ assert_always(info->chip != NULL, "Error creating YM3526 chip");
+
+ info->stream = stream_create(device,0,1,rate,info,ym3526_stream_update);
+ /* YM3526 setup */
+ ym3526_set_timer_handler (info->chip, TimerHandler, info);
+ ym3526_set_irq_handler (info->chip, IRQHandler, info);
+ ym3526_set_update_handler(info->chip, _stream_update, info);
+
+ info->timer[0] = timer_alloc(device->machine, timer_callback_0, info);
+ info->timer[1] = timer_alloc(device->machine, timer_callback_1, info);
+}
+
+static DEVICE_STOP( ym3526 )
+{
+ ym3526_state *info = get_safe_token(device);
+ ym3526_shutdown(info->chip);
+}
+
+static DEVICE_RESET( ym3526 )
+{
+ ym3526_state *info = get_safe_token(device);
+ ym3526_reset_chip(info->chip);
+}
+
+
+READ8_DEVICE_HANDLER( ym3526_r )
+{
+ ym3526_state *info = get_safe_token(device);
+ return ym3526_read(info->chip, offset & 1);
+}
+
+WRITE8_DEVICE_HANDLER( ym3526_w )
+{
+ ym3526_state *info = get_safe_token(device);
+ ym3526_write(info->chip, offset & 1, data);
+}
+
+READ8_DEVICE_HANDLER( ym3526_status_port_r ) { return ym3526_r(device, 0); }
+READ8_DEVICE_HANDLER( ym3526_read_port_r ) { return ym3526_r(device, 1); }
+WRITE8_DEVICE_HANDLER( ym3526_control_port_w ) { ym3526_w(device, 0, data); }
+WRITE8_DEVICE_HANDLER( ym3526_write_port_w ) { ym3526_w(device, 1, data); }
+
+
+/**************************************************************************
+ * Generic get_info
+ **************************************************************************/
+
+DEVICE_GET_INFO( ym3526 )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as 64-bit signed integers --- */
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(ym3526_state); break;
+
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ym3526 ); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( ym3526 ); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( ym3526 ); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "YM3526"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Yamaha FM"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ }
+}
diff --git a/src/emu/sound/3526intf.h b/src/emu/sound/3526intf.h
new file mode 100644
index 00000000000..b61928928b5
--- /dev/null
+++ b/src/emu/sound/3526intf.h
@@ -0,0 +1,23 @@
+#pragma once
+
+#ifndef __3526INTF_H__
+#define __3526INTF_H__
+
+typedef struct _ym3526_interface ym3526_interface;
+struct _ym3526_interface
+{
+ void (*handler)(const device_config *device, int linestate);
+};
+
+READ8_DEVICE_HANDLER( ym3526_r );
+WRITE8_DEVICE_HANDLER( ym3526_w );
+
+READ8_DEVICE_HANDLER( ym3526_status_port_r );
+READ8_DEVICE_HANDLER( ym3526_read_port_r );
+WRITE8_DEVICE_HANDLER( ym3526_control_port_w );
+WRITE8_DEVICE_HANDLER( ym3526_write_port_w );
+
+DEVICE_GET_INFO( ym3526 );
+#define SOUND_YM3526 DEVICE_GET_INFO_NAME( ym3526 )
+
+#endif /* __3526INTF_H__ */
diff --git a/src/emu/sound/3812intf.c b/src/emu/sound/3812intf.c
index 07d845dad38..a784ea54ffd 100644
--- a/src/emu/sound/3812intf.c
+++ b/src/emu/sound/3812intf.c
@@ -24,37 +24,48 @@
#include "sound/fmopl.h"
-#if BUILD_YM3812
-
-struct ym3812_info
+typedef struct _ym3812_state ym3812_state;
+struct _ym3812_state
{
sound_stream * stream;
- emu_timer * timer[2];
+ emu_timer * timer[2];
void * chip;
const ym3812_interface *intf;
const device_config *device;
};
-static void IRQHandler_3812(void *param,int irq)
+
+INLINE ym3812_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_YM3812);
+ return (ym3812_state *)device->token;
+}
+
+
+
+static void IRQHandler(void *param,int irq)
{
- struct ym3812_info *info = param;
- if (info->intf->handler) (info->intf->handler)(info->device->machine, irq ? ASSERT_LINE : CLEAR_LINE);
+ ym3812_state *info = param;
+ if (info->intf->handler) (info->intf->handler)(info->device, irq ? ASSERT_LINE : CLEAR_LINE);
}
-static TIMER_CALLBACK( timer_callback_3812_0 )
+static TIMER_CALLBACK( timer_callback_0 )
{
- struct ym3812_info *info = ptr;
+ ym3812_state *info = ptr;
ym3812_timer_over(info->chip,0);
}
-static TIMER_CALLBACK( timer_callback_3812_1 )
+static TIMER_CALLBACK( timer_callback_1 )
{
- struct ym3812_info *info = ptr;
+ ym3812_state *info = ptr;
ym3812_timer_over(info->chip,1);
}
-static void TimerHandler_3812(void *param,int c,attotime period)
+static void TimerHandler(void *param,int c,attotime period)
{
- struct ym3812_info *info = param;
+ ym3812_state *info = param;
if( attotime_compare(period, attotime_zero) == 0 )
{ /* Reset FM Timer */
timer_enable(info->timer[c], 0);
@@ -68,485 +79,93 @@ static void TimerHandler_3812(void *param,int c,attotime period)
static STREAM_UPDATE( ym3812_stream_update )
{
- struct ym3812_info *info = param;
+ ym3812_state *info = param;
ym3812_update_one(info->chip, outputs[0], samples);
}
-static void _stream_update_3812(void * param, int interval)
+static void _stream_update(void * param, int interval)
{
- struct ym3812_info *info = param;
+ ym3812_state *info = param;
stream_update(info->stream);
}
-static SND_START( ym3812 )
+static DEVICE_START( ym3812 )
{
static const ym3812_interface dummy = { 0 };
- struct ym3812_info *info = device->token;
- int rate = clock/72;
+ ym3812_state *info = get_safe_token(device);
+ int rate = device->clock/72;
info->intf = device->static_config ? device->static_config : &dummy;
info->device = device;
/* stream system initialize */
- info->chip = ym3812_init(device,clock,rate);
+ info->chip = ym3812_init(device,device->clock,rate);
assert_always(info->chip != NULL, "Error creating YM3812 chip");
info->stream = stream_create(device,0,1,rate,info,ym3812_stream_update);
/* YM3812 setup */
- ym3812_set_timer_handler (info->chip, TimerHandler_3812, info);
- ym3812_set_irq_handler (info->chip, IRQHandler_3812, info);
- ym3812_set_update_handler(info->chip, _stream_update_3812, info);
+ ym3812_set_timer_handler (info->chip, TimerHandler, info);
+ ym3812_set_irq_handler (info->chip, IRQHandler, info);
+ ym3812_set_update_handler(info->chip, _stream_update, info);
- info->timer[0] = timer_alloc(device->machine, timer_callback_3812_0, info);
- info->timer[1] = timer_alloc(device->machine, timer_callback_3812_1, info);
+ info->timer[0] = timer_alloc(device->machine, timer_callback_0, info);
+ info->timer[1] = timer_alloc(device->machine, timer_callback_1, info);
}
-static SND_STOP( ym3812 )
+static DEVICE_STOP( ym3812 )
{
- struct ym3812_info *info = device->token;
+ ym3812_state *info = get_safe_token(device);
ym3812_shutdown(info->chip);
}
-static SND_RESET( ym3812 )
+static DEVICE_RESET( ym3812 )
{
- struct ym3812_info *info = device->token;
+ ym3812_state *info = get_safe_token(device);
ym3812_reset_chip(info->chip);
}
-WRITE8_HANDLER( ym3812_control_port_0_w ) {
- struct ym3812_info *info = sndti_token(SOUND_YM3812, 0);
- ym3812_write(info->chip, 0, data);
-}
-WRITE8_HANDLER( ym3812_write_port_0_w ) {
- struct ym3812_info *info = sndti_token(SOUND_YM3812, 0);
- ym3812_write(info->chip, 1, data);
-}
-READ8_HANDLER( ym3812_status_port_0_r ) {
- struct ym3812_info *info = sndti_token(SOUND_YM3812, 0);
- return ym3812_read(info->chip, 0);
-}
-READ8_HANDLER( ym3812_read_port_0_r ) {
- struct ym3812_info *info = sndti_token(SOUND_YM3812, 0);
- return ym3812_read(info->chip, 1);
-}
-
-
-WRITE8_HANDLER( ym3812_control_port_1_w ) {
- struct ym3812_info *info = sndti_token(SOUND_YM3812, 1);
- ym3812_write(info->chip, 0, data);
-}
-WRITE8_HANDLER( ym3812_write_port_1_w ) {
- struct ym3812_info *info = sndti_token(SOUND_YM3812, 1);
- ym3812_write(info->chip, 1, data);
-}
-READ8_HANDLER( ym3812_status_port_1_r ) {
- struct ym3812_info *info = sndti_token(SOUND_YM3812, 1);
- return ym3812_read(info->chip, 0);
-}
-READ8_HANDLER( ym3812_read_port_1_r ) {
- struct ym3812_info *info = sndti_token(SOUND_YM3812, 1);
- return ym3812_read(info->chip, 1);
-}
-
-/**************************************************************************
- * Generic get_info
- **************************************************************************/
-static SND_SET_INFO( ym3812 )
+READ8_DEVICE_HANDLER( ym3812_r )
{
- switch (state)
- {
- /* no parameters to set */
- }
+ ym3812_state *info = get_safe_token(device);
+ return ym3812_read(info->chip, offset & 1);
}
-
-SND_GET_INFO( ym3812 )
+WRITE8_DEVICE_HANDLER( ym3812_w )
{
- switch (state)
- {
- /* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct ym3812_info); break;
-
- /* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( ym3812 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( ym3812 ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( ym3812 ); break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( ym3812 ); break;
-
- /* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "YM3812"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Yamaha FM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
- }
+ ym3812_state *info = get_safe_token(device);
+ ym3812_write(info->chip, offset & 1, data);
}
-#endif
+READ8_DEVICE_HANDLER( ym3812_status_port_r ) { return ym3812_r(device, 0); }
+READ8_DEVICE_HANDLER( ym3812_read_port_r ) { return ym3812_r(device, 1); }
+WRITE8_DEVICE_HANDLER( ym3812_control_port_w ) { ym3812_w(device, 0, data); }
+WRITE8_DEVICE_HANDLER( ym3812_write_port_w ) { ym3812_w(device, 1, data); }
-#if BUILD_YM3526
-
-struct ym3526_info
-{
- sound_stream * stream;
- emu_timer * timer[2];
- void * chip;
- const ym3526_interface *intf;
- const device_config *device;
-};
-
-
-/* IRQ Handler */
-static void IRQHandler_3526(void *param,int irq)
-{
- struct ym3526_info *info = param;
- if (info->intf->handler) (info->intf->handler)(info->device->machine, irq ? ASSERT_LINE : CLEAR_LINE);
-}
-/* Timer overflow callback from timer.c */
-static TIMER_CALLBACK( timer_callback_3526_0 )
-{
- struct ym3526_info *info = ptr;
- ym3526_timer_over(info->chip,0);
-}
-static TIMER_CALLBACK( timer_callback_3526_1 )
-{
- struct ym3526_info *info = ptr;
- ym3526_timer_over(info->chip,1);
-}
-/* TimerHandler from fm.c */
-static void TimerHandler_3526(void *param,int c,attotime period)
-{
- struct ym3526_info *info = param;
- if( attotime_compare(period, attotime_zero) == 0 )
- { /* Reset FM Timer */
- timer_enable(info->timer[c], 0);
- }
- else
- { /* Start FM Timer */
- timer_adjust_oneshot(info->timer[c], period, 0);
- }
-}
-
-
-static STREAM_UPDATE( ym3526_stream_update )
-{
- struct ym3526_info *info = param;
- ym3526_update_one(info->chip, outputs[0], samples);
-}
-
-static void _stream_update_3526(void *param, int interval)
-{
- struct ym3526_info *info = param;
- stream_update(info->stream);
-}
-
-
-static SND_START( ym3526 )
-{
- static const ym3526_interface dummy = { 0 };
- struct ym3526_info *info = device->token;
- int rate = clock/72;
-
- info->intf = device->static_config ? device->static_config : &dummy;
- info->device = device;
-
- /* stream system initialize */
- info->chip = ym3526_init(device,clock,rate);
- assert_always(info->chip != NULL, "Error creating YM3526 chip");
-
- info->stream = stream_create(device,0,1,rate,info,ym3526_stream_update);
- /* YM3526 setup */
- ym3526_set_timer_handler (info->chip, TimerHandler_3526, info);
- ym3526_set_irq_handler (info->chip, IRQHandler_3526, info);
- ym3526_set_update_handler(info->chip, _stream_update_3526, info);
-
- info->timer[0] = timer_alloc(device->machine, timer_callback_3526_0, info);
- info->timer[1] = timer_alloc(device->machine, timer_callback_3526_1, info);
-}
-
-static SND_STOP( ym3526 )
-{
- struct ym3526_info *info = device->token;
- ym3526_shutdown(info->chip);
-}
-
-static SND_RESET( ym3526 )
-{
- struct ym3526_info *info = device->token;
- ym3526_reset_chip(info->chip);
-}
-
-WRITE8_HANDLER( ym3526_control_port_0_w ) {
- struct ym3526_info *info = sndti_token(SOUND_YM3526, 0);
- ym3526_write(info->chip, 0, data);
-}
-WRITE8_HANDLER( ym3526_write_port_0_w ) {
- struct ym3526_info *info = sndti_token(SOUND_YM3526, 0);
- ym3526_write(info->chip, 1, data);
-}
-READ8_HANDLER( ym3526_status_port_0_r ) {
- struct ym3526_info *info = sndti_token(SOUND_YM3526, 0);
- return ym3526_read(info->chip, 0);
-}
-READ8_HANDLER( ym3526_read_port_0_r ) {
- struct ym3526_info *info = sndti_token(SOUND_YM3526, 0);
- return ym3526_read(info->chip, 1);
-}
-
-
-WRITE8_HANDLER( ym3526_control_port_1_w ) {
- struct ym3526_info *info = sndti_token(SOUND_YM3526, 1);
- ym3526_write(info->chip, 0, data);
-}
-WRITE8_HANDLER( ym3526_write_port_1_w ) {
- struct ym3526_info *info = sndti_token(SOUND_YM3526, 1);
- ym3526_write(info->chip, 1, data);
-}
-READ8_HANDLER( ym3526_status_port_1_r ) {
- struct ym3526_info *info = sndti_token(SOUND_YM3526, 1);
- return ym3526_read(info->chip, 0);
-}
-READ8_HANDLER( ym3526_read_port_1_r ) {
- struct ym3526_info *info = sndti_token(SOUND_YM3526, 1);
- return ym3526_read(info->chip, 1);
-}
-
/**************************************************************************
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( ym3526 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( ym3526 )
+DEVICE_GET_INFO( ym3812 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct ym3526_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(ym3812_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( ym3526 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( ym3526 ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( ym3526 ); break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( ym3526 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ym3812 ); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( ym3812 ); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( ym3812 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "YM3526"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Yamaha FM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "YM3812"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Yamaha FM"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
-
-#endif
-
-
-#if BUILD_Y8950
-
-struct y8950_info
-{
- sound_stream * stream;
- emu_timer * timer[2];
- void * chip;
- const y8950_interface *intf;
- const device_config *device;
-};
-
-static void IRQHandler_8950(void *param,int irq)
-{
- struct y8950_info *info = param;
- if (info->intf->handler) (info->intf->handler)(info->device->machine, irq ? ASSERT_LINE : CLEAR_LINE);
-}
-static TIMER_CALLBACK( timer_callback_8950_0 )
-{
- struct y8950_info *info = ptr;
- y8950_timer_over(info->chip,0);
-}
-static TIMER_CALLBACK( timer_callback_8950_1 )
-{
- struct y8950_info *info = ptr;
- y8950_timer_over(info->chip,1);
-}
-static void TimerHandler_8950(void *param,int c,attotime period)
-{
- struct y8950_info *info = param;
- if( attotime_compare(period, attotime_zero) == 0 )
- { /* Reset FM Timer */
- timer_enable(info->timer[c], 0);
- }
- else
- { /* Start FM Timer */
- timer_adjust_oneshot(info->timer[c], period, 0);
- }
-}
-
-
-static unsigned char Y8950PortHandler_r(void *param)
-{
- struct y8950_info *info = param;
- if (info->intf->portread)
- return info->intf->portread(info->device,0);
- return 0;
-}
-
-static void Y8950PortHandler_w(void *param,unsigned char data)
-{
- struct y8950_info *info = param;
- if (info->intf->portwrite)
- info->intf->portwrite(info->device,0,data);
-}
-
-static unsigned char Y8950KeyboardHandler_r(void *param)
-{
- struct y8950_info *info = param;
- if (info->intf->keyboardread)
- return info->intf->keyboardread(info->device,0);
- return 0;
-}
-
-static void Y8950KeyboardHandler_w(void *param,unsigned char data)
-{
- struct y8950_info *info = param;
- if (info->intf->keyboardwrite)
- info->intf->keyboardwrite(info->device,0,data);
-}
-
-static STREAM_UPDATE( y8950_stream_update )
-{
- struct y8950_info *info = param;
- y8950_update_one(info->chip, outputs[0], samples);
-}
-
-static void _stream_update_8950(void *param, int interval)
-{
- struct y8950_info *info = param;
- stream_update(info->stream);
-}
-
-
-static SND_START( y8950 )
-{
- static const y8950_interface dummy = { 0 };
- struct y8950_info *info = device->token;
- int rate = clock/72;
-
- info->intf = device->static_config ? device->static_config : &dummy;
- info->device = device;
-
- /* stream system initialize */
- info->chip = y8950_init(device,clock,rate);
- assert_always(info->chip != NULL, "Error creating Y8950 chip");
-
- /* ADPCM ROM data */
- y8950_set_delta_t_memory(info->chip, device->region, device->regionbytes);
-
- info->stream = stream_create(device,0,1,rate,info,y8950_stream_update);
-
- /* port and keyboard handler */
- y8950_set_port_handler(info->chip, Y8950PortHandler_w, Y8950PortHandler_r, info);
- y8950_set_keyboard_handler(info->chip, Y8950KeyboardHandler_w, Y8950KeyboardHandler_r, info);
-
- /* Y8950 setup */
- y8950_set_timer_handler (info->chip, TimerHandler_8950, info);
- y8950_set_irq_handler (info->chip, IRQHandler_8950, info);
- y8950_set_update_handler(info->chip, _stream_update_8950, info);
-
- info->timer[0] = timer_alloc(device->machine, timer_callback_8950_0, info);
- info->timer[1] = timer_alloc(device->machine, timer_callback_8950_1, info);
-}
-
-static SND_STOP( y8950 )
-{
- struct y8950_info *info = device->token;
- y8950_shutdown(info->chip);
-}
-
-static SND_RESET( y8950 )
-{
- struct y8950_info *info = device->token;
- y8950_reset_chip(info->chip);
-}
-
-WRITE8_HANDLER( y8950_control_port_0_w ) {
- struct y8950_info *info = sndti_token(SOUND_Y8950, 0);
- y8950_write(info->chip, 0, data);
-}
-WRITE8_HANDLER( y8950_write_port_0_w ) {
- struct y8950_info *info = sndti_token(SOUND_Y8950, 0);
- y8950_write(info->chip, 1, data);
-}
-READ8_HANDLER( y8950_status_port_0_r ) {
- struct y8950_info *info = sndti_token(SOUND_Y8950, 0);
- return y8950_read(info->chip, 0);
-}
-READ8_HANDLER( y8950_read_port_0_r ) {
- struct y8950_info *info = sndti_token(SOUND_Y8950, 0);
- return y8950_read(info->chip, 1);
-}
-
-
-WRITE8_HANDLER( y8950_control_port_1_w ) {
- struct y8950_info *info = sndti_token(SOUND_Y8950, 1);
- y8950_write(info->chip, 0, data);
-}
-WRITE8_HANDLER( y8950_write_port_1_w ) {
- struct y8950_info *info = sndti_token(SOUND_Y8950, 1);
- y8950_write(info->chip, 1, data);
-}
-READ8_HANDLER( y8950_status_port_1_r ) {
- struct y8950_info *info = sndti_token(SOUND_Y8950, 1);
- return y8950_read(info->chip, 0);
-}
-READ8_HANDLER( y8950_read_port_1_r ) {
- struct y8950_info *info = sndti_token(SOUND_Y8950, 1);
- return y8950_read(info->chip, 1);
-}
-
-/**************************************************************************
- * Generic get_info
- **************************************************************************/
-
-static SND_SET_INFO( y8950 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( y8950 )
-{
- switch (state)
- {
- /* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct y8950_info); break;
-
- /* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( y8950 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( y8950 ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( y8950 ); break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( y8950 ); break;
-
- /* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "Y8950"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Yamaha FM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
- }
-}
-
-#endif
diff --git a/src/emu/sound/3812intf.h b/src/emu/sound/3812intf.h
index bd7c5ac818c..7f1fe932cdb 100644
--- a/src/emu/sound/3812intf.h
+++ b/src/emu/sound/3812intf.h
@@ -3,67 +3,21 @@
#ifndef __3812INTF_H__
#define __3812INTF_H__
-
typedef struct _ym3812_interface ym3812_interface;
struct _ym3812_interface
{
- void (*handler)(running_machine *machine, int linestate);
+ void (*handler)(const device_config *device, int linestate);
};
-#define ym3526_interface ym3812_interface
-
-typedef struct _y8950_interface y8950_interface;
-struct _y8950_interface
-{
- void (*handler)(running_machine *machine, int linestate);
-
- read8_device_func keyboardread;
- write8_device_func keyboardwrite;
- read8_device_func portread;
- write8_device_func portwrite;
-};
-
-
-/* YM3812 */
-READ8_HANDLER ( ym3812_status_port_0_r );
-WRITE8_HANDLER( ym3812_control_port_0_w );
-READ8_HANDLER( ym3812_read_port_0_r );
-WRITE8_HANDLER( ym3812_write_port_0_w );
-
-READ8_HANDLER ( ym3812_status_port_1_r );
-WRITE8_HANDLER( ym3812_control_port_1_w );
-READ8_HANDLER( ym3812_read_port_1_r );
-WRITE8_HANDLER( ym3812_write_port_1_w );
-
-SND_GET_INFO( ym3812 );
-#define SOUND_YM3812 SND_GET_INFO_NAME( ym3812 )
-
-/* YM3526 */
-READ8_HANDLER ( ym3526_status_port_0_r );
-WRITE8_HANDLER( ym3526_control_port_0_w );
-READ8_HANDLER( ym3526_read_port_0_r );
-WRITE8_HANDLER( ym3526_write_port_0_w );
-
-READ8_HANDLER ( ym3526_status_port_1_r );
-WRITE8_HANDLER( ym3526_control_port_1_w );
-READ8_HANDLER( ym3526_read_port_1_r );
-WRITE8_HANDLER( ym3526_write_port_1_w );
-
-SND_GET_INFO( ym3526 );
-#define SOUND_YM3526 SND_GET_INFO_NAME( ym3526 )
-
-/* Y8950 */
-READ8_HANDLER ( y8950_status_port_0_r );
-WRITE8_HANDLER( y8950_control_port_0_w );
-READ8_HANDLER ( y8950_read_port_0_r );
-WRITE8_HANDLER( y8950_write_port_0_w );
+READ8_DEVICE_HANDLER( ym3812_r );
+WRITE8_DEVICE_HANDLER( ym3812_w );
-READ8_HANDLER ( y8950_status_port_1_r );
-WRITE8_HANDLER( y8950_control_port_1_w );
-READ8_HANDLER ( y8950_read_port_1_r );
-WRITE8_HANDLER( y8950_write_port_1_w );
+READ8_DEVICE_HANDLER( ym3812_status_port_r );
+READ8_DEVICE_HANDLER( ym3812_read_port_r );
+WRITE8_DEVICE_HANDLER( ym3812_control_port_w );
+WRITE8_DEVICE_HANDLER( ym3812_write_port_w );
-SND_GET_INFO( y8950 );
-#define SOUND_Y8950 SND_GET_INFO_NAME( y8950 )
+DEVICE_GET_INFO( ym3812 );
+#define SOUND_YM3812 DEVICE_GET_INFO_NAME( ym3812 )
#endif /* __3812INTF_H__ */
diff --git a/src/emu/sound/5110intf.c b/src/emu/sound/5110intf.c
index 893973f8dc2..53e95538314 100644
--- a/src/emu/sound/5110intf.c
+++ b/src/emu/sound/5110intf.c
@@ -22,7 +22,8 @@
/* the state of the streamed output */
-struct tms5110_info
+typedef struct _tms5110_state tms5110_state;
+struct _tms5110_state
{
const tms5110_interface *intf;
const UINT8 *table;
@@ -32,12 +33,28 @@ struct tms5110_info
};
+INLINE tms5110_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_TMS5110 ||
+ sound_get_type(device) == SOUND_TMS5100 ||
+ sound_get_type(device) == SOUND_TMS5110A ||
+ sound_get_type(device) == SOUND_CD2801 ||
+ sound_get_type(device) == SOUND_TMC0281 ||
+ sound_get_type(device) == SOUND_CD2802 ||
+ sound_get_type(device) == SOUND_M58817);
+ return (tms5110_state *)device->token;
+}
+
+
/* static function prototypes */
static STREAM_UPDATE( tms5110_update );
static int speech_rom_read_bit(const device_config *device)
{
- struct tms5110_info *info = sndti_token(SOUND_TMS5110, 0);
+ tms5110_state *info = get_safe_token(device);
int r;
@@ -51,23 +68,23 @@ static int speech_rom_read_bit(const device_config *device)
return r;
}
-static void speech_rom_set_addr(int addr)
+static void speech_rom_set_addr(const device_config *device, int addr)
{
- struct tms5110_info *info = sndti_token(SOUND_TMS5110, 0);
+ tms5110_state *info = get_safe_token(device);
info->speech_rom_bitnum = addr * 8 - 1;
}
/******************************************************************************
- SND_START( tms5110 ) -- allocate buffers and reset the 5110
+ DEVICE_START( tms5110 ) -- allocate buffers and reset the 5110
******************************************************************************/
-static SND_START( tms5110 )
+static DEVICE_START( tms5110 )
{
static const tms5110_interface dummy = { 0 };
- struct tms5110_info *info = device->token;
+ tms5110_state *info = get_safe_token(device);
info->intf = device->static_config ? device->static_config : &dummy;
info->table = device->region;
@@ -76,7 +93,7 @@ static SND_START( tms5110 )
assert_always(info->chip != NULL, "Error creating TMS5110 chip");
/* initialize a stream */
- info->stream = stream_create(device, 0, 1, clock / 80, info, tms5110_update);
+ info->stream = stream_create(device, 0, 1, device->clock / 80, info, tms5110_update);
if (info->table == NULL)
{
@@ -94,65 +111,65 @@ static SND_START( tms5110 )
tms5110_reset_chip(info->chip);
}
-static SND_START( tms5100 )
+static DEVICE_START( tms5100 )
{
- struct tms5110_info *info = device->token;
- SND_START_CALL( tms5110 );
+ tms5110_state *info = get_safe_token(device);
+ DEVICE_START_CALL( tms5110 );
tms5110_set_variant(info->chip, TMS5110_IS_5100);
}
-static SND_START( tms5110a )
+static DEVICE_START( tms5110a )
{
- struct tms5110_info *info = device->token;
- SND_START_CALL( tms5110 );
+ tms5110_state *info = get_safe_token(device);
+ DEVICE_START_CALL( tms5110 );
tms5110_set_variant(info->chip, TMS5110_IS_5110A);
}
-static SND_START( cd2801 )
+static DEVICE_START( cd2801 )
{
- struct tms5110_info *info = device->token;
- SND_START_CALL( tms5110 );
+ tms5110_state *info = get_safe_token(device);
+ DEVICE_START_CALL( tms5110 );
tms5110_set_variant(info->chip, TMS5110_IS_CD2801);
}
-static SND_START( tmc0281 )
+static DEVICE_START( tmc0281 )
{
- struct tms5110_info *info = device->token;
- SND_START_CALL( tms5110 );
+ tms5110_state *info = get_safe_token(device);
+ DEVICE_START_CALL( tms5110 );
tms5110_set_variant(info->chip, TMS5110_IS_TMC0281);
}
-static SND_START( cd2802 )
+static DEVICE_START( cd2802 )
{
- struct tms5110_info *info = device->token;
- SND_START_CALL( tms5110 );
+ tms5110_state *info = get_safe_token(device);
+ DEVICE_START_CALL( tms5110 );
tms5110_set_variant(info->chip, TMS5110_IS_CD2802);
}
-static SND_START( m58817 )
+static DEVICE_START( m58817 )
{
- struct tms5110_info *info = device->token;
- SND_START_CALL( tms5110 );
+ tms5110_state *info = get_safe_token(device);
+ DEVICE_START_CALL( tms5110 );
tms5110_set_variant(info->chip, TMS5110_IS_M58817);
}
/******************************************************************************
- SND_STOP( tms5110 ) -- free buffers
+ DEVICE_STOP( tms5110 ) -- free buffers
******************************************************************************/
-static SND_STOP( tms5110 )
+static DEVICE_STOP( tms5110 )
{
- struct tms5110_info *info = device->token;
+ tms5110_state *info = get_safe_token(device);
tms5110_destroy(info->chip);
}
-static SND_RESET( tms5110 )
+static DEVICE_RESET( tms5110 )
{
- struct tms5110_info *info = device->token;
+ tms5110_state *info = get_safe_token(device);
tms5110_reset_chip(info->chip);
}
@@ -165,9 +182,9 @@ commands like Speech, Reset, etc., are loaded into the chip via the CTL pins
******************************************************************************/
-WRITE8_HANDLER( tms5110_ctl_w )
+WRITE8_DEVICE_HANDLER( tms5110_ctl_w )
{
- struct tms5110_info *info = sndti_token(SOUND_TMS5110, 0);
+ tms5110_state *info = get_safe_token(device);
/* bring up to date first */
stream_update(info->stream);
@@ -180,9 +197,9 @@ WRITE8_HANDLER( tms5110_ctl_w )
******************************************************************************/
-WRITE8_HANDLER( tms5110_pdc_w )
+WRITE8_DEVICE_HANDLER( tms5110_pdc_w )
{
- struct tms5110_info *info = sndti_token(SOUND_TMS5110, 0);
+ tms5110_state *info = get_safe_token(device);
/* bring up to date first */
stream_update(info->stream);
@@ -197,9 +214,9 @@ WRITE8_HANDLER( tms5110_pdc_w )
******************************************************************************/
-READ8_HANDLER( tms5110_status_r )
+READ8_DEVICE_HANDLER( tms5110_status_r )
{
- struct tms5110_info *info = sndti_token(SOUND_TMS5110, 0);
+ tms5110_state *info = get_safe_token(device);
/* bring up to date first */
stream_update(info->stream);
@@ -214,9 +231,9 @@ READ8_HANDLER( tms5110_status_r )
******************************************************************************/
-int tms5110_ready_r(void)
+int tms5110_ready_r(const device_config *device)
{
- struct tms5110_info *info = sndti_token(SOUND_TMS5110, 0);
+ tms5110_state *info = get_safe_token(device);
/* bring up to date first */
stream_update(info->stream);
@@ -233,7 +250,7 @@ int tms5110_ready_r(void)
static STREAM_UPDATE( tms5110_update )
{
- struct tms5110_info *info = param;
+ tms5110_state *info = param;
INT16 sample_data[MAX_SAMPLE_CHUNK];
stream_sample_t *buffer = outputs[0];
@@ -261,9 +278,9 @@ static STREAM_UPDATE( tms5110_update )
******************************************************************************/
-void tms5110_set_frequency(int frequency)
+void tms5110_set_frequency(const device_config *device, int frequency)
{
- struct tms5110_info *info = sndti_token(SOUND_TMS5110, 0);
+ tms5110_state *info = get_safe_token(device);
stream_set_sample_rate(info->stream, frequency / 80);
}
@@ -274,96 +291,83 @@ void tms5110_set_frequency(int frequency)
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( tms5110 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-SND_GET_INFO( tms5110 )
+DEVICE_GET_INFO( tms5110 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct tms5110_info); break;
- case SNDINFO_FCT_ALIAS: info->type = SOUND_TMS5110; break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(tms5110_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( tms5110 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( tms5110 ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( tms5110 ); break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( tms5110 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( tms5110 ); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( tms5110 ); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( tms5110 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "TMS5110"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "TI Speech"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "TMS5110"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "TI Speech"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
-SND_GET_INFO( tms5100 )
+DEVICE_GET_INFO( tms5100 )
{
switch (state)
{
- case SNDINFO_PTR_START: info->start = SND_START_NAME( tms5100 ); break;
- case SNDINFO_STR_NAME: strcpy(info->s, "TMS5100"); break;
- default: SND_GET_INFO_CALL(tms5110); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( tms5100 ); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "TMS5100"); break;
+ default: DEVICE_GET_INFO_CALL(tms5110); break;
}
}
-SND_GET_INFO( tms5110a )
+DEVICE_GET_INFO( tms5110a )
{
switch (state)
{
- case SNDINFO_PTR_START: info->start = SND_START_NAME( tms5110a ); break;
- case SNDINFO_STR_NAME: strcpy(info->s, "TMS5100A"); break;
- default: SND_GET_INFO_CALL(tms5110); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( tms5110a ); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "TMS5100A"); break;
+ default: DEVICE_GET_INFO_CALL(tms5110); break;
}
}
-SND_GET_INFO( cd2801 )
+DEVICE_GET_INFO( cd2801 )
{
switch (state)
{
- case SNDINFO_PTR_START: info->start = SND_START_NAME( cd2801 ); break;
- case SNDINFO_STR_NAME: strcpy(info->s, "CD2801"); break;
- default: SND_GET_INFO_CALL(tms5110); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( cd2801 ); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "CD2801"); break;
+ default: DEVICE_GET_INFO_CALL(tms5110); break;
}
}
-SND_GET_INFO( tmc0281 )
+DEVICE_GET_INFO( tmc0281 )
{
switch (state)
{
- case SNDINFO_PTR_START: info->start = SND_START_NAME( tmc0281 ); break;
- case SNDINFO_STR_NAME: strcpy(info->s, "TMS5100"); break;
- default: SND_GET_INFO_CALL(tms5110); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( tmc0281 ); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "TMS5100"); break;
+ default: DEVICE_GET_INFO_CALL(tms5110); break;
}
}
-SND_GET_INFO( cd2802 )
+DEVICE_GET_INFO( cd2802 )
{
switch (state)
{
- case SNDINFO_PTR_START: info->start = SND_START_NAME( cd2802 ); break;
- case SNDINFO_STR_NAME: strcpy(info->s, "CD2802"); break;
- default: SND_GET_INFO_CALL(tms5110); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( cd2802 ); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "CD2802"); break;
+ default: DEVICE_GET_INFO_CALL(tms5110); break;
}
}
-SND_GET_INFO( m58817 )
+DEVICE_GET_INFO( m58817 )
{
switch (state)
{
- case SNDINFO_PTR_START: info->start = SND_START_NAME( m58817 ); break;
- case SNDINFO_STR_NAME: strcpy(info->s, "M58817"); break;
- default: SND_GET_INFO_CALL(tms5110); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( m58817 ); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "M58817"); break;
+ default: DEVICE_GET_INFO_CALL(tms5110); break;
}
}
-
-
-
diff --git a/src/emu/sound/5110intf.h b/src/emu/sound/5110intf.h
index 8ec02891475..5834fbbdc5b 100644
--- a/src/emu/sound/5110intf.h
+++ b/src/emu/sound/5110intf.h
@@ -11,31 +11,31 @@ typedef struct _tms5110_interface tms5110_interface;
struct _tms5110_interface
{
int (*M0_callback)(const device_config *device); /* function to be called when chip requests another bit */
- void (*load_address)(int addr); /* speech ROM load address callback */
+ void (*load_address)(const device_config *device, int addr); /* speech ROM load address callback */
};
-WRITE8_HANDLER( tms5110_ctl_w );
-WRITE8_HANDLER( tms5110_pdc_w );
-
-READ8_HANDLER( tms5110_status_r );
-int tms5110_ready_r(void);
-
-void tms5110_set_frequency(int frequency);
-
-SND_GET_INFO( tms5110 );
-SND_GET_INFO( tms5100 );
-SND_GET_INFO( tms5110a );
-SND_GET_INFO( cd2801 );
-SND_GET_INFO( tmc0281 );
-SND_GET_INFO( cd2802 );
-SND_GET_INFO( m58817 );
-
-#define SOUND_TMS5110 SND_GET_INFO_NAME( tms5110 )
-#define SOUND_TMS5100 SND_GET_INFO_NAME( tms5100 )
-#define SOUND_TMS5110A SND_GET_INFO_NAME( tms5110a )
-#define SOUND_CD2801 SND_GET_INFO_NAME( cd2801 )
-#define SOUND_TMC0281 SND_GET_INFO_NAME( tmc0281 )
-#define SOUND_CD2802 SND_GET_INFO_NAME( cd2802 )
-#define SOUND_M58817 SND_GET_INFO_NAME( m58817 )
+WRITE8_DEVICE_HANDLER( tms5110_ctl_w );
+WRITE8_DEVICE_HANDLER( tms5110_pdc_w );
+
+READ8_DEVICE_HANDLER( tms5110_status_r );
+int tms5110_ready_r(const device_config *device);
+
+void tms5110_set_frequency(const device_config *device, int frequency);
+
+DEVICE_GET_INFO( tms5110 );
+DEVICE_GET_INFO( tms5100 );
+DEVICE_GET_INFO( tms5110a );
+DEVICE_GET_INFO( cd2801 );
+DEVICE_GET_INFO( tmc0281 );
+DEVICE_GET_INFO( cd2802 );
+DEVICE_GET_INFO( m58817 );
+
+#define SOUND_TMS5110 DEVICE_GET_INFO_NAME( tms5110 )
+#define SOUND_TMS5100 DEVICE_GET_INFO_NAME( tms5100 )
+#define SOUND_TMS5110A DEVICE_GET_INFO_NAME( tms5110a )
+#define SOUND_CD2801 DEVICE_GET_INFO_NAME( cd2801 )
+#define SOUND_TMC0281 DEVICE_GET_INFO_NAME( tmc0281 )
+#define SOUND_CD2802 DEVICE_GET_INFO_NAME( cd2802 )
+#define SOUND_M58817 DEVICE_GET_INFO_NAME( m58817 )
#endif /* __5110INTF_H__ */
diff --git a/src/emu/sound/5220intf.c b/src/emu/sound/5220intf.c
index 0a24db7dc10..f3daac7c3fb 100644
--- a/src/emu/sound/5220intf.c
+++ b/src/emu/sound/5220intf.c
@@ -21,7 +21,8 @@
/* the state of the streamed output */
-struct tms5220_info
+typedef struct _tms5220_state tms5220_state;
+struct _tms5220_state
{
const tms5220_interface *intf;
sound_stream *stream;
@@ -30,6 +31,18 @@ struct tms5220_info
};
+INLINE tms5220_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_TMS5220 ||
+ sound_get_type(device) == SOUND_TMC0285 ||
+ sound_get_type(device) == SOUND_TMS5200);
+ return (tms5220_state *)device->token;
+}
+
+
/* static function prototypes */
static STREAM_UPDATE( tms5220_update );
@@ -37,14 +50,14 @@ static STREAM_UPDATE( tms5220_update );
/**********************************************************************************************
- SND_START( tms5220 ) -- allocate buffers and reset the 5220
+ DEVICE_START( tms5220 ) -- allocate buffers and reset the 5220
***********************************************************************************************/
-static SND_START( tms5220 )
+static DEVICE_START( tms5220 )
{
static const tms5220_interface dummy = { 0 };
- struct tms5220_info *info = device->token;
+ tms5220_state *info = get_safe_token(device);
info->intf = device->static_config ? device->static_config : &dummy;
@@ -52,8 +65,8 @@ static SND_START( tms5220 )
assert_always(info->chip != NULL, "Error creating TMS5220 chip");
/* initialize a info->stream */
- info->stream = stream_create(device, 0, 1, clock / 80, info, tms5220_update);
- info->clock = clock;
+ info->stream = stream_create(device, 0, 1, device->clock / 80, info, tms5220_update);
+ info->clock = device->clock;
/* reset the 5220 */
tms5220_reset_chip(info->chip);
@@ -67,10 +80,10 @@ static SND_START( tms5220 )
#if (HAS_TMC0285 || HAS_TMS5200)
-static SND_START( tms5200 )
+static DEVICE_START( tms5200 )
{
- struct tms5220_info *info = device->token;
- SND_START_CALL( tms5220 );
+ tms5220_state *info = get_safe_token(device);
+ DEVICE_START_CALL( tms5220 );
tms5220_set_variant(info->chip, variant_tmc0285);
}
#endif /* (HAS_TMC0285) && (HAS_TMS5200) */
@@ -79,21 +92,21 @@ static SND_START( tms5200 )
/**********************************************************************************************
- SND_STOP( tms5220 ) -- free buffers
+ DEVICE_STOP( tms5220 ) -- free buffers
***********************************************************************************************/
-static SND_STOP( tms5220 )
+static DEVICE_STOP( tms5220 )
{
- struct tms5220_info *info = device->token;
+ tms5220_state *info = get_safe_token(device);
tms5220_destroy(info->chip);
}
-static SND_RESET( tms5220 )
+static DEVICE_RESET( tms5220 )
{
- struct tms5220_info *info = device->token;
+ tms5220_state *info = get_safe_token(device);
tms5220_reset_chip(info->chip);
}
@@ -105,9 +118,9 @@ static SND_RESET( tms5220 )
***********************************************************************************************/
-WRITE8_HANDLER( tms5220_data_w )
+WRITE8_DEVICE_HANDLER( tms5220_data_w )
{
- struct tms5220_info *info = sndti_token(SOUND_TMS5220, 0);
+ tms5220_state *info = get_safe_token(device);
/* bring up to date first */
stream_update(info->stream);
tms5220_data_write(info->chip, data);
@@ -121,9 +134,9 @@ WRITE8_HANDLER( tms5220_data_w )
***********************************************************************************************/
-READ8_HANDLER( tms5220_status_r )
+READ8_DEVICE_HANDLER( tms5220_status_r )
{
- struct tms5220_info *info = sndti_token(SOUND_TMS5220, 0);
+ tms5220_state *info = get_safe_token(device);
/* bring up to date first */
stream_update(info->stream);
return tms5220_status_read(info->chip);
@@ -137,9 +150,9 @@ READ8_HANDLER( tms5220_status_r )
***********************************************************************************************/
-int tms5220_ready_r(void)
+int tms5220_ready_r(const device_config *device)
{
- struct tms5220_info *info = sndti_token(SOUND_TMS5220, 0);
+ tms5220_state *info = get_safe_token(device);
/* bring up to date first */
stream_update(info->stream);
return tms5220_ready_read(info->chip);
@@ -149,13 +162,13 @@ int tms5220_ready_r(void)
/**********************************************************************************************
- tms5220_ready_r -- return the time in seconds until the ready line is asserted
+ tms5220_time_to_ready -- return the time in seconds until the ready line is asserted
***********************************************************************************************/
-double tms5220_time_to_ready(void)
+double tms5220_time_to_ready(const device_config *device)
{
- struct tms5220_info *info = sndti_token(SOUND_TMS5220, 0);
+ tms5220_state *info = get_safe_token(device);
double cycles;
/* bring up to date first */
@@ -172,9 +185,9 @@ double tms5220_time_to_ready(void)
***********************************************************************************************/
-int tms5220_int_r(void)
+int tms5220_int_r(const device_config *device)
{
- struct tms5220_info *info = sndti_token(SOUND_TMS5220, 0);
+ tms5220_state *info = get_safe_token(device);
/* bring up to date first */
stream_update(info->stream);
return tms5220_int_read(info->chip);
@@ -190,7 +203,7 @@ int tms5220_int_r(void)
static STREAM_UPDATE( tms5220_update )
{
- struct tms5220_info *info = param;
+ tms5220_state *info = param;
INT16 sample_data[MAX_SAMPLE_CHUNK];
stream_sample_t *buffer = outputs[0];
@@ -218,9 +231,9 @@ static STREAM_UPDATE( tms5220_update )
***********************************************************************************************/
-void tms5220_set_frequency(int frequency)
+void tms5220_set_frequency(const device_config *device, int frequency)
{
- struct tms5220_info *info = sndti_token(SOUND_TMS5220, 0);
+ tms5220_state *info = get_safe_token(device);
stream_set_sample_rate(info->stream, frequency / 80);
info->clock = frequency;
}
@@ -231,60 +244,47 @@ void tms5220_set_frequency(int frequency)
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( tms5220 )
-{
- struct tms5220_info *ti = device->token;
-
- switch (state)
- {
- case SNDINFO_INT_TMS5220_VARIANT: tms5220_set_variant(ti->chip, (tms5220_variant) info->i); break;
- }
-}
-
-
-SND_GET_INFO( tms5220 )
+DEVICE_GET_INFO( tms5220 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct tms5220_info); break;
- case SNDINFO_FCT_ALIAS: info->type = SOUND_TMS5220; break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(tms5220_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( tms5220 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( tms5220 ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( tms5220 ); break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( tms5220 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( tms5220 ); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( tms5220 ); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( tms5220 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "TMS5220"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "TI Speech"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "TMS5220"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "TI Speech"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
#if (HAS_TMC0285)
-SND_GET_INFO( tmc0285 )
+DEVICE_GET_INFO( tmc0285 )
{
switch (state)
{
- case SNDINFO_PTR_START: info->start = SND_START_NAME( tms5200 ); break;
- case SNDINFO_STR_NAME: strcpy(info->s, "TMC0285"); break;
- default: SND_GET_INFO_CALL( tms5220 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( tms5200 ); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "TMC0285"); break;
+ default: DEVICE_GET_INFO_CALL( tms5220 ); break;
}
}
#endif
#if (HAS_TMS5200)
-SND_GET_INFO( tms5200 )
+DEVICE_GET_INFO( tms5200 )
{
switch (state)
{
- case SNDINFO_PTR_START: info->start = SND_START_NAME( tms5200 ); break;
- case SNDINFO_STR_NAME: strcpy(info->s, "TMS5200"); break;
- default: SND_GET_INFO_CALL( tms5220 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( tms5200 ); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "TMS5200"); break;
+ default: DEVICE_GET_INFO_CALL( tms5220 ); break;
}
}
#endif
diff --git a/src/emu/sound/5220intf.h b/src/emu/sound/5220intf.h
index d52b89373de..1fcdc86b8fa 100644
--- a/src/emu/sound/5220intf.h
+++ b/src/emu/sound/5220intf.h
@@ -1,7 +1,7 @@
#pragma once
-#ifndef __5200INTF_H__
-#define __5200INTF_H__
+#ifndef __5220INTF_H__
+#define __5220INTF_H__
/* clock rate = 80 * output sample rate, */
/* usually 640000 for 8000 Hz sample rate or */
@@ -10,32 +10,27 @@
typedef struct _tms5220_interface tms5220_interface;
struct _tms5220_interface
{
- void (*irq)(running_machine *machine, int state); /* IRQ callback function */
+ void (*irq)(const device_config *device, int state); /* IRQ callback function */
- int (*read)(int count); /* speech ROM read callback */
- void (*load_address)(int data); /* speech ROM load address callback */
- void (*read_and_branch)(void); /* speech ROM read and branch callback */
+ int (*read)(const device_config *device, int count); /* speech ROM read callback */
+ void (*load_address)(const device_config *device, int data); /* speech ROM load address callback */
+ void (*read_and_branch)(const device_config *device); /* speech ROM read and branch callback */
};
-WRITE8_HANDLER( tms5220_data_w );
-READ8_HANDLER( tms5220_status_r );
-int tms5220_ready_r(void);
-double tms5220_time_to_ready(void);
-int tms5220_int_r(void);
+WRITE8_DEVICE_HANDLER( tms5220_data_w );
+READ8_DEVICE_HANDLER( tms5220_status_r );
+int tms5220_ready_r(const device_config *device);
+double tms5220_time_to_ready(const device_config *device);
+int tms5220_int_r(const device_config *device);
-void tms5220_set_frequency(int frequency);
+void tms5220_set_frequency(const device_config *device, int frequency);
-enum
-{
- SNDINFO_INT_TMS5220_VARIANT = SNDINFO_INT_CORE_SPECIFIC
-};
-
-SND_GET_INFO( tms5220 );
-SND_GET_INFO( tmc0285 );
-SND_GET_INFO( tms5200 );
+DEVICE_GET_INFO( tms5220 );
+DEVICE_GET_INFO( tmc0285 );
+DEVICE_GET_INFO( tms5200 );
-#define SOUND_TMS5220 SND_GET_INFO_NAME( tms5220 )
-#define SOUND_TMC0285 SND_GET_INFO_NAME( tmc0285 )
-#define SOUND_TMS5200 SND_GET_INFO_NAME( tms5200 )
+#define SOUND_TMS5220 DEVICE_GET_INFO_NAME( tms5220 )
+#define SOUND_TMC0285 DEVICE_GET_INFO_NAME( tmc0285 )
+#define SOUND_TMS5200 DEVICE_GET_INFO_NAME( tms5200 )
-#endif /* __5200INTF_H__ */
+#endif /* __5220INTF_H__ */
diff --git a/src/emu/sound/8950intf.c b/src/emu/sound/8950intf.c
new file mode 100644
index 00000000000..a435102fa80
--- /dev/null
+++ b/src/emu/sound/8950intf.c
@@ -0,0 +1,205 @@
+/******************************************************************************
+* FILE
+* Yamaha 3812 emulator interface - MAME VERSION
+*
+* CREATED BY
+* Ernesto Corvi
+*
+* UPDATE LOG
+* JB 28-04-2002 Fixed simultaneous usage of all three different chip types.
+* Used real sample rate when resample filter is active.
+* AAT 12-28-2001 Protected Y8950 from accessing unmapped port and keyboard handlers.
+* CHS 1999-01-09 Fixes new ym3812 emulation interface.
+* CHS 1998-10-23 Mame streaming sound chip update
+* EC 1998 Created Interface
+*
+* NOTES
+*
+******************************************************************************/
+#include "sndintrf.h"
+#include "streams.h"
+#include "cpuintrf.h"
+#include "8950intf.h"
+#include "fm.h"
+#include "sound/fmopl.h"
+
+
+typedef struct _y8950_state y8950_state;
+struct _y8950_state
+{
+ sound_stream * stream;
+ emu_timer * timer[2];
+ void * chip;
+ const y8950_interface *intf;
+ const device_config *device;
+};
+
+
+INLINE y8950_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_Y8950);
+ return (y8950_state *)device->token;
+}
+
+
+static void IRQHandler(void *param,int irq)
+{
+ y8950_state *info = param;
+ if (info->intf->handler) (info->intf->handler)(info->device, irq ? ASSERT_LINE : CLEAR_LINE);
+}
+static TIMER_CALLBACK( timer_callback_0 )
+{
+ y8950_state *info = ptr;
+ y8950_timer_over(info->chip,0);
+}
+static TIMER_CALLBACK( timer_callback_1 )
+{
+ y8950_state *info = ptr;
+ y8950_timer_over(info->chip,1);
+}
+static void TimerHandler(void *param,int c,attotime period)
+{
+ y8950_state *info = param;
+ if( attotime_compare(period, attotime_zero) == 0 )
+ { /* Reset FM Timer */
+ timer_enable(info->timer[c], 0);
+ }
+ else
+ { /* Start FM Timer */
+ timer_adjust_oneshot(info->timer[c], period, 0);
+ }
+}
+
+
+static unsigned char Y8950PortHandler_r(void *param)
+{
+ y8950_state *info = param;
+ if (info->intf->portread)
+ return info->intf->portread(info->device,0);
+ return 0;
+}
+
+static void Y8950PortHandler_w(void *param,unsigned char data)
+{
+ y8950_state *info = param;
+ if (info->intf->portwrite)
+ info->intf->portwrite(info->device,0,data);
+}
+
+static unsigned char Y8950KeyboardHandler_r(void *param)
+{
+ y8950_state *info = param;
+ if (info->intf->keyboardread)
+ return info->intf->keyboardread(info->device,0);
+ return 0;
+}
+
+static void Y8950KeyboardHandler_w(void *param,unsigned char data)
+{
+ y8950_state *info = param;
+ if (info->intf->keyboardwrite)
+ info->intf->keyboardwrite(info->device,0,data);
+}
+
+static STREAM_UPDATE( y8950_stream_update )
+{
+ y8950_state *info = param;
+ y8950_update_one(info->chip, outputs[0], samples);
+}
+
+static void _stream_update(void *param, int interval)
+{
+ y8950_state *info = param;
+ stream_update(info->stream);
+}
+
+
+static DEVICE_START( y8950 )
+{
+ static const y8950_interface dummy = { 0 };
+ y8950_state *info = get_safe_token(device);
+ int rate = device->clock/72;
+
+ info->intf = device->static_config ? device->static_config : &dummy;
+ info->device = device;
+
+ /* stream system initialize */
+ info->chip = y8950_init(device,device->clock,rate);
+ assert_always(info->chip != NULL, "Error creating Y8950 chip");
+
+ /* ADPCM ROM data */
+ y8950_set_delta_t_memory(info->chip, device->region, device->regionbytes);
+
+ info->stream = stream_create(device,0,1,rate,info,y8950_stream_update);
+
+ /* port and keyboard handler */
+ y8950_set_port_handler(info->chip, Y8950PortHandler_w, Y8950PortHandler_r, info);
+ y8950_set_keyboard_handler(info->chip, Y8950KeyboardHandler_w, Y8950KeyboardHandler_r, info);
+
+ /* Y8950 setup */
+ y8950_set_timer_handler (info->chip, TimerHandler, info);
+ y8950_set_irq_handler (info->chip, IRQHandler, info);
+ y8950_set_update_handler(info->chip, _stream_update, info);
+
+ info->timer[0] = timer_alloc(device->machine, timer_callback_0, info);
+ info->timer[1] = timer_alloc(device->machine, timer_callback_1, info);
+}
+
+static DEVICE_STOP( y8950 )
+{
+ y8950_state *info = get_safe_token(device);
+ y8950_shutdown(info->chip);
+}
+
+static DEVICE_RESET( y8950 )
+{
+ y8950_state *info = get_safe_token(device);
+ y8950_reset_chip(info->chip);
+}
+
+
+READ8_DEVICE_HANDLER( y8950_r )
+{
+ y8950_state *info = get_safe_token(device);
+ return y8950_read(info->chip, offset & 1);
+}
+
+WRITE8_DEVICE_HANDLER( y8950_w )
+{
+ y8950_state *info = get_safe_token(device);
+ y8950_write(info->chip, offset & 1, data);
+}
+
+READ8_DEVICE_HANDLER( y8950_status_port_r ) { return y8950_r(device, 0); }
+READ8_DEVICE_HANDLER( y8950_read_port_r ) { return y8950_r(device, 1); }
+WRITE8_DEVICE_HANDLER( y8950_control_port_w ) { y8950_w(device, 0, data); }
+WRITE8_DEVICE_HANDLER( y8950_write_port_w ) { y8950_w(device, 1, data); }
+
+
+/**************************************************************************
+ * Generic get_info
+ **************************************************************************/
+
+DEVICE_GET_INFO( y8950 )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as 64-bit signed integers --- */
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(y8950_state); break;
+
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( y8950 ); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( y8950 ); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( y8950 ); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Y8950"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Yamaha FM"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ }
+}
diff --git a/src/emu/sound/8950intf.h b/src/emu/sound/8950intf.h
new file mode 100644
index 00000000000..d4ad63fbd36
--- /dev/null
+++ b/src/emu/sound/8950intf.h
@@ -0,0 +1,28 @@
+#pragma once
+
+#ifndef __8950INTF_H__
+#define __8950INTF_H__
+
+typedef struct _y8950_interface y8950_interface;
+struct _y8950_interface
+{
+ void (*handler)(const device_config *device, int linestate);
+
+ read8_device_func keyboardread;
+ write8_device_func keyboardwrite;
+ read8_device_func portread;
+ write8_device_func portwrite;
+};
+
+READ8_DEVICE_HANDLER( y8950_r );
+WRITE8_DEVICE_HANDLER( y8950_w );
+
+READ8_DEVICE_HANDLER( y8950_status_port_r );
+READ8_DEVICE_HANDLER( y8950_read_port_r );
+WRITE8_DEVICE_HANDLER( y8950_control_port_w );
+WRITE8_DEVICE_HANDLER( y8950_write_port_w );
+
+DEVICE_GET_INFO( y8950 );
+#define SOUND_Y8950 DEVICE_GET_INFO_NAME( y8950 )
+
+#endif /* __8950INTF_H__ */
diff --git a/src/emu/sound/aica.c b/src/emu/sound/aica.c
index 775208445f7..2c6e10f0d3c 100644
--- a/src/emu/sound/aica.c
+++ b/src/emu/sound/aica.c
@@ -157,6 +157,7 @@ struct _SLOT
#define SCITMA 6
#define SCITMB 7
+typedef struct _AICA aica_state;
struct _AICA
{
union
@@ -172,7 +173,7 @@ struct _AICA
unsigned char *AICARAM;
UINT32 AICARAM_LENGTH, RAM_MASK, RAM_MASK16;
char Master;
- void (*IntARMCB)(running_machine *machine, int irq);
+ void (*IntARMCB)(const device_config *device, int irq);
sound_stream * stream;
INT32 *buffertmpl, *buffertmpr;
@@ -214,7 +215,16 @@ static int length;
static signed short *RBUFDST; //this points to where the sample will be stored in the RingBuf
-static unsigned char DecodeSCI(struct _AICA *AICA, unsigned char irq)
+INLINE aica_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_AICA);
+ return (aica_state *)device->token;
+}
+
+static unsigned char DecodeSCI(aica_state *AICA, unsigned char irq)
{
unsigned char SCI=0;
unsigned char v;
@@ -227,29 +237,27 @@ static unsigned char DecodeSCI(struct _AICA *AICA, unsigned char irq)
return SCI;
}
-static void ResetInterrupts(struct _AICA *AICA)
+static void ResetInterrupts(aica_state *AICA)
{
#if 0
UINT32 reset = AICA->udata.data[0xa4/2];
- running_machine *machine = AICA->device->machine;
if (reset & 0x40)
- AICA->IntARMCB(machine, -AICA->IrqTimA);
+ AICA->IntARMCB(AICA->device, -AICA->IrqTimA);
if (reset & 0x180)
- AICA->IntARMCB(machine, -AICA->IrqTimBC);
+ AICA->IntARMCB(AICA->device, -AICA->IrqTimBC);
#endif
}
-static void CheckPendingIRQ(struct _AICA *AICA)
+static void CheckPendingIRQ(aica_state *AICA)
{
UINT32 pend=AICA->udata.data[0xa0/2];
UINT32 en=AICA->udata.data[0x9c/2];
- running_machine *machine = AICA->device->machine;
if(AICA->MidiW!=AICA->MidiR)
{
AICA->IRQL = AICA->IrqMidi;
- AICA->IntARMCB(machine, 1);
+ AICA->IntARMCB(AICA->device, 1);
return;
}
if(!pend)
@@ -258,28 +266,28 @@ static void CheckPendingIRQ(struct _AICA *AICA)
if(en&0x40)
{
AICA->IRQL = AICA->IrqTimA;
- AICA->IntARMCB(machine, 1);
+ AICA->IntARMCB(AICA->device, 1);
return;
}
if(pend&0x80)
if(en&0x80)
{
AICA->IRQL = AICA->IrqTimBC;
- AICA->IntARMCB(machine, 1);
+ AICA->IntARMCB(AICA->device, 1);
return;
}
if(pend&0x100)
if(en&0x100)
{
AICA->IRQL = AICA->IrqTimBC;
- AICA->IntARMCB(machine, 1);
+ AICA->IntARMCB(AICA->device, 1);
return;
}
}
static TIMER_CALLBACK( timerA_cb )
{
- struct _AICA *AICA = (struct _AICA *)ptr;
+ aica_state *AICA = (aica_state *)ptr;
AICA->TimCnt[0] = 0xFFFF;
AICA->udata.data[0xa0/2]|=0x40;
@@ -291,7 +299,7 @@ static TIMER_CALLBACK( timerA_cb )
static TIMER_CALLBACK( timerB_cb )
{
- struct _AICA *AICA = (struct _AICA *)ptr;
+ aica_state *AICA = (aica_state *)ptr;
AICA->TimCnt[1] = 0xFFFF;
AICA->udata.data[0xa0/2]|=0x80;
@@ -303,7 +311,7 @@ static TIMER_CALLBACK( timerB_cb )
static TIMER_CALLBACK( timerC_cb )
{
- struct _AICA *AICA = (struct _AICA *)ptr;
+ aica_state *AICA = (aica_state *)ptr;
AICA->TimCnt[2] = 0xFFFF;
AICA->udata.data[0xa0/2]|=0x100;
@@ -313,7 +321,7 @@ static TIMER_CALLBACK( timerC_cb )
CheckPendingIRQ(AICA);
}
-static int Get_AR(struct _AICA *AICA,int base,int R)
+static int Get_AR(aica_state *AICA,int base,int R)
{
int Rate=base+(R<<1);
if(Rate>63) Rate=63;
@@ -321,7 +329,7 @@ static int Get_AR(struct _AICA *AICA,int base,int R)
return AICA->ARTABLE[Rate];
}
-static int Get_DR(struct _AICA *AICA,int base,int R)
+static int Get_DR(aica_state *AICA,int base,int R)
{
int Rate=base+(R<<1);
if(Rate>63) Rate=63;
@@ -329,7 +337,7 @@ static int Get_DR(struct _AICA *AICA,int base,int R)
return AICA->DRTABLE[Rate];
}
-static int Get_RR(struct _AICA *AICA,int base,int R)
+static int Get_RR(aica_state *AICA,int base,int R)
{
int Rate=base+(R<<1);
if(Rate>63) Rate=63;
@@ -337,7 +345,7 @@ static int Get_RR(struct _AICA *AICA,int base,int R)
return AICA->DRTABLE[Rate];
}
-static void Compute_EG(struct _AICA *AICA,struct _SLOT *slot)
+static void Compute_EG(aica_state *AICA,struct _SLOT *slot)
{
int octave=OCT(slot);
int rate;
@@ -450,7 +458,7 @@ INLINE signed short DecodeADPCM(int *PrevSignal, unsigned char Delta, int *PrevQ
return *PrevSignal;
}
-static void AICA_StartSlot(struct _AICA *AICA, struct _SLOT *slot)
+static void AICA_StartSlot(aica_state *AICA, struct _SLOT *slot)
{
UINT64 start_offset;
@@ -513,7 +521,7 @@ static void AICA_StopSlot(struct _SLOT *slot,int keyoff)
#define log_base_2(n) (log((float) n)/log((float) 2))
-static void AICA_Init(const device_config *device, struct _AICA *AICA, const aica_interface *intf)
+static void AICA_Init(const device_config *device, aica_state *AICA, const aica_interface *intf)
{
int i;
@@ -652,7 +660,7 @@ static void AICA_Init(const device_config *device, struct _AICA *AICA, const aic
AICA->TimCnt[2] = 0xffff;
}
-static void AICA_UpdateSlotReg(struct _AICA *AICA,int s,int r)
+static void AICA_UpdateSlotReg(aica_state *AICA,int s,int r)
{
struct _SLOT *slot=AICA->Slots+s;
int sl;
@@ -708,10 +716,8 @@ static void AICA_UpdateSlotReg(struct _AICA *AICA,int s,int r)
}
}
-static void AICA_UpdateReg(struct _AICA *AICA, int reg)
+static void AICA_UpdateReg(aica_state *AICA, int reg)
{
- /* temporary hack until this is converted to a device */
- const address_space *space = memory_find_address_space(AICA->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
switch(reg&0xff)
{
case 0x4:
@@ -731,7 +737,7 @@ static void AICA_UpdateReg(struct _AICA *AICA, int reg)
break;
case 0x8:
case 0x9:
- aica_midi_in(space, 0, AICA->udata.data[0x8/2]&0xff, 0);
+ aica_midi_in(AICA->device, 0, AICA->udata.data[0x8/2]&0xff, 0xffff);
break;
case 0x12:
case 0x13:
@@ -837,12 +843,12 @@ static void AICA_UpdateReg(struct _AICA *AICA, int reg)
}
}
-static void AICA_UpdateSlotRegR(struct _AICA *AICA, int slot,int reg)
+static void AICA_UpdateSlotRegR(aica_state *AICA, int slot,int reg)
{
}
-static void AICA_UpdateRegR(struct _AICA *AICA, int reg)
+static void AICA_UpdateRegR(aica_state *AICA, int reg)
{
switch(reg&0xff)
{
@@ -852,7 +858,7 @@ static void AICA_UpdateRegR(struct _AICA *AICA, int reg)
unsigned short v=AICA->udata.data[0x8/2];
v&=0xff00;
v|=AICA->MidiStack[AICA->MidiR];
- AICA->IntARMCB(AICA->device->machine, 0); // cancel the IRQ
+ AICA->IntARMCB(AICA->device, 0); // cancel the IRQ
if(AICA->MidiR!=AICA->MidiW)
{
++AICA->MidiR;
@@ -881,7 +887,7 @@ static void AICA_UpdateRegR(struct _AICA *AICA, int reg)
}
}
-static void AICA_w16(struct _AICA *AICA,unsigned int addr,unsigned short val)
+static void AICA_w16(aica_state *AICA,unsigned int addr,unsigned short val)
{
addr&=0xffff;
if(addr<0x2000)
@@ -918,7 +924,7 @@ static void AICA_w16(struct _AICA *AICA,unsigned int addr,unsigned short val)
if (val)
{
- AICA->IntARMCB(AICA->device->machine, 0);
+ AICA->IntARMCB(AICA->device, 0);
}
}
}
@@ -941,7 +947,7 @@ static void AICA_w16(struct _AICA *AICA,unsigned int addr,unsigned short val)
}
}
-static unsigned short AICA_r16(struct _AICA *AICA, unsigned int addr)
+static unsigned short AICA_r16(aica_state *AICA, unsigned int addr)
{
unsigned short v=0;
addr&=0xffff;
@@ -982,7 +988,7 @@ static unsigned short AICA_r16(struct _AICA *AICA, unsigned int addr)
#define REVSIGN(v) ((~v)+1)
#ifdef UNUSED_FUNCTION
-static void AICA_TimersAddTicks(struct _AICA *AICA, int ticks)
+static void AICA_TimersAddTicks(aica_state *AICA, int ticks)
{
if(AICA->TimCnt[0]<=0xff00)
{
@@ -1022,7 +1028,7 @@ static void AICA_TimersAddTicks(struct _AICA *AICA, int ticks)
}
#endif
-INLINE INT32 AICA_UpdateSlot(struct _AICA *AICA, struct _SLOT *slot)
+INLINE INT32 AICA_UpdateSlot(aica_state *AICA, struct _SLOT *slot)
{
INT32 sample;
int step=slot->step;
@@ -1201,7 +1207,7 @@ INLINE INT32 AICA_UpdateSlot(struct _AICA *AICA, struct _SLOT *slot)
return sample;
}
-static void AICA_DoMasterSamples(struct _AICA *AICA, int nsamples)
+static void AICA_DoMasterSamples(aica_state *AICA, int nsamples)
{
stream_sample_t *bufr,*bufl;
int sl, s, i;
@@ -1269,18 +1275,18 @@ static int AICA_IRQCB(void *param)
static STREAM_UPDATE( AICA_Update )
{
- struct _AICA *AICA = param;
+ aica_state *AICA = param;
bufferl = outputs[0];
bufferr = outputs[1];
length = samples;
AICA_DoMasterSamples(AICA, samples);
}
-static SND_START( aica )
+static DEVICE_START( aica )
{
const aica_interface *intf;
- struct _AICA *AICA = device->token;
+ aica_state *AICA = get_safe_token(device);
intf = device->static_config;
@@ -1296,14 +1302,14 @@ static SND_START( aica )
}
#ifdef UNUSED_FUNCTION
-static SND_STOP( aica )
+static DEVICE_STOP( aica )
{
}
#endif
-void aica_set_ram_base(int which, void *base, int size)
+void aica_set_ram_base(const device_config *device, void *base, int size)
{
- struct _AICA *AICA = sndti_token(SOUND_AICA, which);
+ aica_state *AICA = get_safe_token(device);
if (AICA)
{
AICA->AICARAM = base;
@@ -1315,34 +1321,32 @@ void aica_set_ram_base(int which, void *base, int size)
}
}
-READ16_HANDLER( aica_0_r )
+READ16_DEVICE_HANDLER( aica_r )
{
- struct _AICA *AICA = sndti_token(SOUND_AICA, 0);
- UINT16 res = AICA_r16(AICA, offset*2);
-
- return res;
+ aica_state *AICA = get_safe_token(device);
+ return AICA_r16(AICA, offset*2);
}
-WRITE16_HANDLER( aica_0_w )
+WRITE16_DEVICE_HANDLER( aica_w )
{
- struct _AICA *AICA = sndti_token(SOUND_AICA, 0);
+ aica_state *AICA = get_safe_token(device);
UINT16 tmp;
tmp = AICA_r16(AICA, offset*2);
COMBINE_DATA(&tmp);
- AICA_w16(AICA,offset*2, tmp);
+ AICA_w16(AICA, offset*2, tmp);
}
-WRITE16_HANDLER( aica_midi_in )
+WRITE16_DEVICE_HANDLER( aica_midi_in )
{
- struct _AICA *AICA = sndti_token(SOUND_AICA, 0);
+ aica_state *AICA = get_safe_token(device);
AICA->MidiStack[AICA->MidiW++]=data;
AICA->MidiW &= 15;
}
-READ16_HANDLER( aica_midi_out_r )
+READ16_DEVICE_HANDLER( aica_midi_out_r )
{
- struct _AICA *AICA = sndti_token(SOUND_AICA, 0);
+ aica_state *AICA = get_safe_token(device);
unsigned char val;
val=AICA->MidiStack[AICA->MidiR++];
@@ -1354,34 +1358,22 @@ READ16_HANDLER( aica_midi_out_r )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( aica )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( aica )
+DEVICE_GET_INFO( aica )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct _AICA); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(aica_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( aica ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( aica ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( aica ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "AICA"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Sega/Yamaha custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0.1"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "AICA"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Sega/Yamaha custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0.1"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/aica.h b/src/emu/sound/aica.h
index 136ca6d122b..ac31e89b075 100644
--- a/src/emu/sound/aica.h
+++ b/src/emu/sound/aica.h
@@ -6,27 +6,25 @@
#ifndef __AICA_H__
#define __AICA_H__
-#define MAX_AICA (2)
-
typedef struct _aica_interface aica_interface;
struct _aica_interface
{
int master;
int roffset; /* offset in the region */
- void (*irq_callback)(running_machine *machine, int state); /* irq callback */
+ void (*irq_callback)(const device_config *device, int state); /* irq callback */
};
-void aica_set_ram_base(int which, void *base, int size);
+void aica_set_ram_base(const device_config *device, void *base, int size);
// AICA register access
-READ16_HANDLER( aica_0_r );
-WRITE16_HANDLER( aica_0_w );
+READ16_DEVICE_HANDLER( aica_r );
+WRITE16_DEVICE_HANDLER( aica_w );
// MIDI I/O access
-WRITE16_HANDLER( aica_midi_in );
-READ16_HANDLER( aica_midi_out_r );
+WRITE16_DEVICE_HANDLER( aica_midi_in );
+READ16_DEVICE_HANDLER( aica_midi_out_r );
-SND_GET_INFO( aica );
-#define SOUND_AICA SND_GET_INFO_NAME( aica )
+DEVICE_GET_INFO( aica );
+#define SOUND_AICA DEVICE_GET_INFO_NAME( aica )
#endif /* __AICA_H__ */
diff --git a/src/emu/sound/astrocde.c b/src/emu/sound/astrocde.c
index 6f8481adb0e..7a6e21823c6 100644
--- a/src/emu/sound/astrocde.c
+++ b/src/emu/sound/astrocde.c
@@ -44,7 +44,8 @@
#include "astrocde.h"
-struct astrocade_info
+typedef struct _astrocade_state astrocade_state;
+struct _astrocade_state
{
sound_stream *stream; /* sound stream */
@@ -69,6 +70,16 @@ struct astrocade_info
};
+INLINE astrocade_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_ASTROCADE);
+ return (astrocade_state *)device->token;
+}
+
+
/*************************************
*
@@ -78,7 +89,7 @@ struct astrocade_info
static STREAM_UPDATE( astrocade_update )
{
- struct astrocade_info *chip = param;
+ astrocade_state *chip = param;
stream_sample_t *dest = outputs[0];
UINT16 noise_state;
UINT8 master_count;
@@ -196,8 +207,10 @@ static STREAM_UPDATE( astrocade_update )
*
*************************************/
-static void astrocade_reset(struct astrocade_info *chip)
+static DEVICE_RESET( astrocade )
{
+ astrocade_state *chip = get_safe_token(device);
+
memset(chip->reg, 0, sizeof(chip->reg));
chip->master_count = 0;
@@ -216,11 +229,6 @@ static void astrocade_reset(struct astrocade_info *chip)
chip->c_state = 0;
}
-static SND_RESET( astrocade )
-{
- astrocade_reset(device->token);
-}
-
/*************************************
*
@@ -228,7 +236,7 @@ static SND_RESET( astrocade )
*
*************************************/
-static void astrocade_state_save_register(struct astrocade_info *chip, const device_config *device)
+static void astrocade_state_save_register(astrocade_state *chip, const device_config *device)
{
state_save_register_device_item_array(device, 0, chip->reg);
@@ -256,9 +264,9 @@ static void astrocade_state_save_register(struct astrocade_info *chip, const dev
*
*************************************/
-static SND_START( astrocade )
+static DEVICE_START( astrocade )
{
- struct astrocade_info *chip = device->token;
+ astrocade_state *chip = get_safe_token(device);
int i;
/* generate a bitswap table for the noise */
@@ -266,10 +274,10 @@ static SND_START( astrocade )
chip->bitswap[i] = BITSWAP8(i, 0,1,2,3,4,5,6,7);
/* allocate a stream for output */
- chip->stream = stream_create(device, 0, 1, clock, chip, astrocade_update);
+ chip->stream = stream_create(device, 0, 1, device->clock, chip, astrocade_update);
/* reset state */
- astrocade_reset(chip);
+ DEVICE_RESET_CALL(astrocade);
astrocade_state_save_register(chip, device);
}
@@ -281,9 +289,14 @@ static SND_START( astrocade )
*
*************************************/
-static void astrocade_sound_w(UINT8 num, offs_t offset, UINT8 data)
+WRITE8_DEVICE_HANDLER( astrocade_sound_w )
{
- struct astrocade_info *chip = sndti_token(SOUND_ASTROCADE, num);
+ astrocade_state *chip = get_safe_token(device);
+
+ if ((offset & 8) != 0)
+ offset = (offset >> 8) & 7;
+ else
+ offset &= 7;
/* update */
stream_update(chip->stream);
@@ -293,24 +306,6 @@ static void astrocade_sound_w(UINT8 num, offs_t offset, UINT8 data)
}
-WRITE8_HANDLER( astrocade_sound1_w )
-{
- if ((offset & 8) != 0)
- astrocade_sound_w(0, (offset >> 8) & 7, data);
- else
- astrocade_sound_w(0, offset & 7, data);
-}
-
-
-WRITE8_HANDLER( astrocade_sound2_w )
-{
- if ((offset & 8) != 0)
- astrocade_sound_w(1, (offset >> 8) & 7, data);
- else
- astrocade_sound_w(1, offset & 7, data);
-}
-
-
/*************************************
*
@@ -318,33 +313,22 @@ WRITE8_HANDLER( astrocade_sound2_w )
*
*************************************/
-static SND_SET_INFO( astrocade )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( astrocade )
+DEVICE_GET_INFO( astrocade )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct astrocade_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(astrocade_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( astrocade ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( astrocade ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( astrocade ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( astrocade ); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( astrocade ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "Astrocade"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Bally"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "2.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "Astrocade"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Bally"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "2.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/astrocde.h b/src/emu/sound/astrocde.h
index e5363176862..555c549f2ba 100644
--- a/src/emu/sound/astrocde.h
+++ b/src/emu/sound/astrocde.h
@@ -3,10 +3,9 @@
#ifndef __ASTROCDE_H__
#define __ASTROCDE_H__
-WRITE8_HANDLER( astrocade_sound1_w );
-WRITE8_HANDLER( astrocade_sound2_w );
+WRITE8_DEVICE_HANDLER( astrocade_sound_w );
-SND_GET_INFO( astrocade );
-#define SOUND_ASTROCADE SND_GET_INFO_NAME( astrocade )
+DEVICE_GET_INFO( astrocade );
+#define SOUND_ASTROCADE DEVICE_GET_INFO_NAME( astrocade )
#endif /* __ASTROCDE_H__ */
diff --git a/src/emu/sound/ay8910.c b/src/emu/sound/ay8910.c
index e9a614487d6..c12ef2f3999 100644
--- a/src/emu/sound/ay8910.c
+++ b/src/emu/sound/ay8910.c
@@ -187,8 +187,29 @@ struct _ay8910_context
INT32 vol_table[NUM_CHANNELS][16];
INT32 env_table[NUM_CHANNELS][32];
INT32 vol3d_table[8*32*32*32];
+ devcb_resolved_read8 portAread;
+ devcb_resolved_read8 portBread;
+ devcb_resolved_write8 portAwrite;
+ devcb_resolved_write8 portBwrite;
};
+INLINE ay8910_context *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_AY8910 ||
+ sound_get_type(device) == SOUND_AY8912 ||
+ sound_get_type(device) == SOUND_AY8913 ||
+ sound_get_type(device) == SOUND_AY8930 ||
+ sound_get_type(device) == SOUND_YM2149 ||
+ sound_get_type(device) == SOUND_YM3439 ||
+ sound_get_type(device) == SOUND_YMZ284 ||
+ sound_get_type(device) == SOUND_YMZ294);
+ return (ay8910_context *)device->token;
+}
+
+
/*************************************
*
* Static
@@ -386,9 +407,6 @@ INLINE UINT16 mix_3D(ay8910_context *psg)
static void ay8910_write_reg(ay8910_context *psg, int r, int v)
{
- /* temporary hack until this is converted to a device */
- const address_space *space = memory_find_address_space(psg->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
-
//if (r >= 11 && r <= 13 ) printf("%d %x %02x\n", PSG->index, r, v);
psg->regs[r] = v;
@@ -413,16 +431,14 @@ static void ay8910_write_reg(ay8910_context *psg, int r, int v)
((psg->last_enable & 0x40) != (psg->regs[AY_ENABLE] & 0x40)))
{
/* write out 0xff if port set to input */
- if (psg->intf->portAwrite)
- (*psg->intf->portAwrite)(space, 0, (psg->regs[AY_ENABLE] & 0x40) ? psg->regs[AY_PORTA] : 0xff);
+ devcb_call_write8(&psg->portAwrite, 0, (psg->regs[AY_ENABLE] & 0x40) ? psg->regs[AY_PORTA] : 0xff);
}
if ((psg->last_enable == -1) ||
((psg->last_enable & 0x80) != (psg->regs[AY_ENABLE] & 0x80)))
{
/* write out 0xff if port set to input */
- if (psg->intf->portBwrite)
- (*psg->intf->portBwrite)(space, 0, (psg->regs[AY_ENABLE] & 0x80) ? psg->regs[AY_PORTB] : 0xff);
+ devcb_call_write8(&psg->portBwrite, 0, (psg->regs[AY_ENABLE] & 0x80) ? psg->regs[AY_PORTB] : 0xff);
}
psg->last_enable = psg->regs[AY_ENABLE];
@@ -447,8 +463,8 @@ static void ay8910_write_reg(ay8910_context *psg, int r, int v)
case AY_PORTA:
if (psg->regs[AY_ENABLE] & 0x40)
{
- if (psg->intf->portAwrite)
- (*psg->intf->portAwrite)(space, 0, psg->regs[AY_PORTA]);
+ if (psg->portAwrite.write)
+ devcb_call_write8(&psg->portAwrite, 0, psg->regs[AY_PORTA]);
else
logerror("warning - write %02x to 8910 '%s' Port A\n",psg->regs[AY_PORTA],psg->device->tag);
}
@@ -460,8 +476,8 @@ static void ay8910_write_reg(ay8910_context *psg, int r, int v)
case AY_PORTB:
if (psg->regs[AY_ENABLE] & 0x80)
{
- if (psg->intf->portBwrite)
- (*psg->intf->portBwrite)(space, 0, psg->regs[AY_PORTB]);
+ if (psg->portBwrite.write)
+ devcb_call_write8(&psg->portBwrite, 0, psg->regs[AY_PORTB]);
else
logerror("warning - write %02x to 8910 '%s' Port B\n",psg->regs[AY_PORTB],psg->device->tag);
}
@@ -670,6 +686,10 @@ void *ay8910_start_ym(void *infoptr, sound_type chip_type, const device_config *
}
info->device = device;
info->intf = intf;
+ devcb_resolve_read8(&info->portAread, &intf->portAread, device);
+ devcb_resolve_read8(&info->portBread, &intf->portBread, device);
+ devcb_resolve_write8(&info->portAwrite, &intf->portAwrite, device);
+ devcb_resolve_write8(&info->portBwrite, &intf->portBwrite, device);
if ((info->intf->flags & AY8910_SINGLE_OUTPUT) != 0)
{
logerror("AY-3-8910/YM2149 using single output!\n");
@@ -699,9 +719,9 @@ void *ay8910_start_ym(void *infoptr, sound_type chip_type, const device_config *
/* The envelope is pacing twice as fast for the YM2149 as for the AY-3-8910, */
/* This handled by the step parameter. Consequently we use a divider of 8 here. */
- info->channel = stream_create(device, 0, info->streams, clock / 8, info, ay8910_update);
+ info->channel = stream_create(device, 0, info->streams, device->clock / 8, info, ay8910_update);
- ay8910_set_clock_ym(info,clock);
+ ay8910_set_clock_ym(info,device->clock);
ay8910_statesave(info, device);
return info;
@@ -733,9 +753,9 @@ void ay8910_reset_ym(void *chip)
psg->ready = 1;
}
-void ay8910_set_volume(int chip,int channel,int volume)
+void ay8910_set_volume(const device_config *device,int channel,int volume)
{
- ay8910_context *psg = sndti_token(SOUND_AY8910, chip);
+ ay8910_context *psg = get_safe_token(device);
int ch;
for (ch = 0; ch < psg->streams; ch++)
@@ -775,8 +795,6 @@ void ay8910_write_ym(void *chip, int addr, int data)
int ay8910_read_ym(void *chip)
{
ay8910_context *psg = chip;
- /* temporary hack until this is converted to a device */
- const address_space *space = memory_find_address_space(psg->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
int r = psg->register_latch;
if (r > 15) return 0;
@@ -790,16 +808,16 @@ int ay8910_read_ym(void *chip)
even if the port is set as output, we still need to return the external
data. Some games, like kidniki, need this to work.
*/
- if (psg->intf->portAread)
- psg->regs[AY_PORTA] = (*psg->intf->portAread)(space, 0);
+ if (psg->portAread.read)
+ psg->regs[AY_PORTA] = devcb_call_read8(&psg->portAread, 0);
else
logerror("%s: warning - read 8910 '%s' Port A\n",cpuexec_describe_context(psg->device->machine),psg->device->tag);
break;
case AY_PORTB:
if ((psg->regs[AY_ENABLE] & 0x80) != 0)
logerror("warning: read from 8910 '%s' Port B set as output\n",psg->device->tag);
- if (psg->intf->portBread)
- psg->regs[AY_PORTB] = (*psg->intf->portBread)(space, 0);
+ if (psg->portBread.read)
+ psg->regs[AY_PORTB] = devcb_call_read8(&psg->portBread, 0);
else
logerror("%s: warning - read 8910 '%s' Port B\n",cpuexec_describe_context(psg->device->machine),psg->device->tag);
break;
@@ -813,138 +831,128 @@ int ay8910_read_ym(void *chip)
*
*************************************/
-static SND_START( ay8910 )
+static DEVICE_START( ay8910 )
{
static const ay8910_interface generic_ay8910 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
};
const ay8910_interface *intf = (device->static_config ? device->static_config : &generic_ay8910);
- ay8910_start_ym(device->token, SOUND_AY8910, device, clock, intf);
+ ay8910_start_ym(get_safe_token(device), SOUND_AY8910, device, device->clock, intf);
}
-static SND_START( ym2149 )
+static DEVICE_START( ym2149 )
{
static const ay8910_interface generic_ay8910 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
};
const ay8910_interface *intf = (device->static_config ? device->static_config : &generic_ay8910);
- ay8910_start_ym(device->token, SOUND_YM2149, device, clock, intf);
-}
-
-static SND_STOP( ay8910 )
-{
- ay8910_stop_ym(device->token);
+ ay8910_start_ym(get_safe_token(device), SOUND_YM2149, device, device->clock, intf);
}
-static SND_RESET( ay8910 )
+static DEVICE_STOP( ay8910 )
{
- ay8910_reset_ym(device->token);
+ ay8910_stop_ym(get_safe_token(device));
}
-static SND_SET_INFO( ay8910 )
+static DEVICE_RESET( ay8910 )
{
- switch (state)
- {
- /* no parameters to set */
- }
+ ay8910_reset_ym(get_safe_token(device));
}
-SND_GET_INFO( ay8910 )
+DEVICE_GET_INFO( ay8910 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(ay8910_context); break;
- case SNDINFO_FCT_ALIAS: info->type = SOUND_AY8910; break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(ay8910_context); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( ay8910 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( ay8910 ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( ay8910 ); break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( ay8910 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ay8910 ); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( ay8910 ); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( ay8910 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "AY-3-8910A"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "PSG"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "AY-3-8910A"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "PSG"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
-SND_GET_INFO( ay8912 )
+DEVICE_GET_INFO( ay8912 )
{
switch (state)
{
- case SNDINFO_PTR_START: info->start = SND_START_NAME( ay8910 ); break;
- case SNDINFO_STR_NAME: strcpy(info->s, "AY-3-8912A"); break;
- default: SND_GET_INFO_CALL(ay8910); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ay8910 ); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "AY-3-8912A"); break;
+ default: DEVICE_GET_INFO_CALL(ay8910); break;
}
}
-SND_GET_INFO( ay8913 )
+DEVICE_GET_INFO( ay8913 )
{
switch (state)
{
- case SNDINFO_PTR_START: info->start = SND_START_NAME( ay8910 ); break;
- case SNDINFO_STR_NAME: strcpy(info->s, "AY-3-8913A"); break;
- default: SND_GET_INFO_CALL(ay8910); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ay8910 ); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "AY-3-8913A"); break;
+ default: DEVICE_GET_INFO_CALL(ay8910); break;
}
}
-SND_GET_INFO( ay8930 )
+DEVICE_GET_INFO( ay8930 )
{
switch (state)
{
- case SNDINFO_PTR_START: info->start = SND_START_NAME( ay8910 ); break;
- case SNDINFO_STR_NAME: strcpy(info->s, "AY8930"); break;
- default: SND_GET_INFO_CALL(ay8910); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ay8910 ); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "AY8930"); break;
+ default: DEVICE_GET_INFO_CALL(ay8910); break;
}
}
-SND_GET_INFO( ym2149 )
+DEVICE_GET_INFO( ym2149 )
{
switch (state)
{
- case SNDINFO_PTR_START: info->start = SND_START_NAME( ym2149 ); break;
- case SNDINFO_STR_NAME: strcpy(info->s, "YM2149"); break;
- default: SND_GET_INFO_CALL(ay8910); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ym2149 ); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "YM2149"); break;
+ default: DEVICE_GET_INFO_CALL(ay8910); break;
}
}
-SND_GET_INFO( ym3439 )
+DEVICE_GET_INFO( ym3439 )
{
switch (state)
{
- case SNDINFO_PTR_START: info->start = SND_START_NAME( ym2149 ); break;
- case SNDINFO_STR_NAME: strcpy(info->s, "YM3439"); break;
- default: SND_GET_INFO_CALL(ay8910); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ym2149 ); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "YM3439"); break;
+ default: DEVICE_GET_INFO_CALL(ay8910); break;
}
}
-SND_GET_INFO( ymz284 )
+DEVICE_GET_INFO( ymz284 )
{
switch (state)
{
- case SNDINFO_PTR_START: info->start = SND_START_NAME( ym2149 ); break;
- case SNDINFO_STR_NAME: strcpy(info->s, "YMZ284"); break;
- default: SND_GET_INFO_CALL(ay8910); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ym2149 ); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "YMZ284"); break;
+ default: DEVICE_GET_INFO_CALL(ay8910); break;
}
}
-SND_GET_INFO( ymz294 )
+DEVICE_GET_INFO( ymz294 )
{
switch (state)
{
- case SNDINFO_PTR_START: info->start = SND_START_NAME( ym2149 ); break;
- case SNDINFO_STR_NAME: strcpy(info->s, "YMZ294"); break;
- default: SND_GET_INFO_CALL(ay8910); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ym2149 ); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "YMZ294"); break;
+ default: DEVICE_GET_INFO_CALL(ay8910); break;
}
}
@@ -954,50 +962,28 @@ SND_GET_INFO( ymz294 )
*
*************************************/
-READ8_HANDLER( ay8910_read_port_0_r ) { return ay8910_read_ym(sndti_token(SOUND_AY8910, 0)); }
-READ8_HANDLER( ay8910_read_port_1_r ) { return ay8910_read_ym(sndti_token(SOUND_AY8910, 1)); }
-READ8_HANDLER( ay8910_read_port_2_r ) { return ay8910_read_ym(sndti_token(SOUND_AY8910, 2)); }
-READ8_HANDLER( ay8910_read_port_3_r ) { return ay8910_read_ym(sndti_token(SOUND_AY8910, 3)); }
-READ8_HANDLER( ay8910_read_port_4_r ) { return ay8910_read_ym(sndti_token(SOUND_AY8910, 4)); }
-READ16_HANDLER( ay8910_read_port_0_lsb_r ) { return ay8910_read_ym(sndti_token(SOUND_AY8910, 0)); }
-READ16_HANDLER( ay8910_read_port_1_lsb_r ) { return ay8910_read_ym(sndti_token(SOUND_AY8910, 1)); }
-READ16_HANDLER( ay8910_read_port_2_lsb_r ) { return ay8910_read_ym(sndti_token(SOUND_AY8910, 2)); }
-READ16_HANDLER( ay8910_read_port_3_lsb_r ) { return ay8910_read_ym(sndti_token(SOUND_AY8910, 3)); }
-READ16_HANDLER( ay8910_read_port_4_lsb_r ) { return ay8910_read_ym(sndti_token(SOUND_AY8910, 4)); }
-READ16_HANDLER( ay8910_read_port_0_msb_r ) { return ay8910_read_ym(sndti_token(SOUND_AY8910, 0)) << 8; }
-READ16_HANDLER( ay8910_read_port_1_msb_r ) { return ay8910_read_ym(sndti_token(SOUND_AY8910, 1)) << 8; }
-READ16_HANDLER( ay8910_read_port_2_msb_r ) { return ay8910_read_ym(sndti_token(SOUND_AY8910, 2)) << 8; }
-READ16_HANDLER( ay8910_read_port_3_msb_r ) { return ay8910_read_ym(sndti_token(SOUND_AY8910, 3)) << 8; }
-READ16_HANDLER( ay8910_read_port_4_msb_r ) { return ay8910_read_ym(sndti_token(SOUND_AY8910, 4)) << 8; }
-
-WRITE8_HANDLER( ay8910_control_port_0_w ) { ay8910_write_ym(sndti_token(SOUND_AY8910, 0),0,data); }
-WRITE8_HANDLER( ay8910_control_port_1_w ) { ay8910_write_ym(sndti_token(SOUND_AY8910, 1),0,data); }
-WRITE8_HANDLER( ay8910_control_port_2_w ) { ay8910_write_ym(sndti_token(SOUND_AY8910, 2),0,data); }
-WRITE8_HANDLER( ay8910_control_port_3_w ) { ay8910_write_ym(sndti_token(SOUND_AY8910, 3),0,data); }
-WRITE8_HANDLER( ay8910_control_port_4_w ) { ay8910_write_ym(sndti_token(SOUND_AY8910, 4),0,data); }
-WRITE16_HANDLER( ay8910_control_port_0_lsb_w ) { if (ACCESSING_BITS_0_7) ay8910_write_ym(sndti_token(SOUND_AY8910, 0),0,data & 0xff); }
-WRITE16_HANDLER( ay8910_control_port_1_lsb_w ) { if (ACCESSING_BITS_0_7) ay8910_write_ym(sndti_token(SOUND_AY8910, 1),0,data & 0xff); }
-WRITE16_HANDLER( ay8910_control_port_2_lsb_w ) { if (ACCESSING_BITS_0_7) ay8910_write_ym(sndti_token(SOUND_AY8910, 2),0,data & 0xff); }
-WRITE16_HANDLER( ay8910_control_port_3_lsb_w ) { if (ACCESSING_BITS_0_7) ay8910_write_ym(sndti_token(SOUND_AY8910, 3),0,data & 0xff); }
-WRITE16_HANDLER( ay8910_control_port_4_lsb_w ) { if (ACCESSING_BITS_0_7) ay8910_write_ym(sndti_token(SOUND_AY8910, 4),0,data & 0xff); }
-WRITE16_HANDLER( ay8910_control_port_0_msb_w ) { if (ACCESSING_BITS_8_15) ay8910_write_ym(sndti_token(SOUND_AY8910, 0),0,data >> 8); }
-WRITE16_HANDLER( ay8910_control_port_1_msb_w ) { if (ACCESSING_BITS_8_15) ay8910_write_ym(sndti_token(SOUND_AY8910, 1),0,data >> 8); }
-WRITE16_HANDLER( ay8910_control_port_2_msb_w ) { if (ACCESSING_BITS_8_15) ay8910_write_ym(sndti_token(SOUND_AY8910, 2),0,data >> 8); }
-WRITE16_HANDLER( ay8910_control_port_3_msb_w ) { if (ACCESSING_BITS_8_15) ay8910_write_ym(sndti_token(SOUND_AY8910, 3),0,data >> 8); }
-WRITE16_HANDLER( ay8910_control_port_4_msb_w ) { if (ACCESSING_BITS_8_15) ay8910_write_ym(sndti_token(SOUND_AY8910, 4),0,data >> 8); }
-
-WRITE8_HANDLER( ay8910_write_port_0_w ) { ay8910_write_ym(sndti_token(SOUND_AY8910, 0),1,data); }
-WRITE8_HANDLER( ay8910_write_port_1_w ) { ay8910_write_ym(sndti_token(SOUND_AY8910, 1),1,data); }
-WRITE8_HANDLER( ay8910_write_port_2_w ) { ay8910_write_ym(sndti_token(SOUND_AY8910, 2),1,data); }
-WRITE8_HANDLER( ay8910_write_port_3_w ) { ay8910_write_ym(sndti_token(SOUND_AY8910, 3),1,data); }
-WRITE8_HANDLER( ay8910_write_port_4_w ) { ay8910_write_ym(sndti_token(SOUND_AY8910, 4),1,data); }
-WRITE16_HANDLER( ay8910_write_port_0_lsb_w ) { if (ACCESSING_BITS_0_7) ay8910_write_ym(sndti_token(SOUND_AY8910, 0),1,data & 0xff); }
-WRITE16_HANDLER( ay8910_write_port_1_lsb_w ) { if (ACCESSING_BITS_0_7) ay8910_write_ym(sndti_token(SOUND_AY8910, 1),1,data & 0xff); }
-WRITE16_HANDLER( ay8910_write_port_2_lsb_w ) { if (ACCESSING_BITS_0_7) ay8910_write_ym(sndti_token(SOUND_AY8910, 2),1,data & 0xff); }
-WRITE16_HANDLER( ay8910_write_port_3_lsb_w ) { if (ACCESSING_BITS_0_7) ay8910_write_ym(sndti_token(SOUND_AY8910, 3),1,data & 0xff); }
-WRITE16_HANDLER( ay8910_write_port_4_lsb_w ) { if (ACCESSING_BITS_0_7) ay8910_write_ym(sndti_token(SOUND_AY8910, 4),1,data & 0xff); }
-WRITE16_HANDLER( ay8910_write_port_0_msb_w ) { if (ACCESSING_BITS_8_15) ay8910_write_ym(sndti_token(SOUND_AY8910, 0),1,data >> 8); }
-WRITE16_HANDLER( ay8910_write_port_1_msb_w ) { if (ACCESSING_BITS_8_15) ay8910_write_ym(sndti_token(SOUND_AY8910, 1),1,data >> 8); }
-WRITE16_HANDLER( ay8910_write_port_2_msb_w ) { if (ACCESSING_BITS_8_15) ay8910_write_ym(sndti_token(SOUND_AY8910, 2),1,data >> 8); }
-WRITE16_HANDLER( ay8910_write_port_3_msb_w ) { if (ACCESSING_BITS_8_15) ay8910_write_ym(sndti_token(SOUND_AY8910, 3),1,data >> 8); }
-WRITE16_HANDLER( ay8910_write_port_4_msb_w ) { if (ACCESSING_BITS_8_15) ay8910_write_ym(sndti_token(SOUND_AY8910, 4),1,data >> 8); }
+READ8_DEVICE_HANDLER( ay8910_r )
+{
+ return ay8910_read_ym(get_safe_token(device));
+}
+
+WRITE8_DEVICE_HANDLER( ay8910_data_address_w )
+{
+ /* note that directly connecting BC1 to A0 puts data on 0 and address on 1 */
+ ay8910_write_ym(get_safe_token(device), ~offset & 1, data);
+}
+
+WRITE8_DEVICE_HANDLER( ay8910_address_data_w )
+{
+ ay8910_write_ym(get_safe_token(device), offset & 1, data);
+}
+
+WRITE8_DEVICE_HANDLER( ay8910_address_w )
+{
+ ay8910_data_address_w(device, 1, data);
+}
+
+WRITE8_DEVICE_HANDLER( ay8910_data_w )
+{
+ ay8910_data_address_w(device, 0, data);
+}
diff --git a/src/emu/sound/ay8910.h b/src/emu/sound/ay8910.h
index 73580224c00..b6e49f8a3e3 100644
--- a/src/emu/sound/ay8910.h
+++ b/src/emu/sound/ay8910.h
@@ -3,6 +3,8 @@
#ifndef __AY8910_H__
#define __AY8910_H__
+#include "devcb.h"
+
/*
AY-3-8910A: 2 I/O ports
AY-3-8912A: 1 I/O port
@@ -66,63 +68,25 @@ struct _ay8910_interface
{
int flags; /* Flags */
int res_load[3]; /* Load on channel in ohms */
- read8_space_func portAread;
- read8_space_func portBread;
- write8_space_func portAwrite;
- write8_space_func portBwrite;
+ devcb_read8 portAread;
+ devcb_read8 portBread;
+ devcb_write8 portAwrite;
+ devcb_write8 portBwrite;
};
-void ay8910_set_volume(int chip,int channel,int volume);
-
-
-READ8_HANDLER( ay8910_read_port_0_r );
-READ8_HANDLER( ay8910_read_port_1_r );
-READ8_HANDLER( ay8910_read_port_2_r );
-READ8_HANDLER( ay8910_read_port_3_r );
-READ8_HANDLER( ay8910_read_port_4_r );
-READ16_HANDLER( ay8910_read_port_0_lsb_r );
-READ16_HANDLER( ay8910_read_port_1_lsb_r );
-READ16_HANDLER( ay8910_read_port_2_lsb_r );
-READ16_HANDLER( ay8910_read_port_3_lsb_r );
-READ16_HANDLER( ay8910_read_port_4_lsb_r );
-READ16_HANDLER( ay8910_read_port_0_msb_r );
-READ16_HANDLER( ay8910_read_port_1_msb_r );
-READ16_HANDLER( ay8910_read_port_2_msb_r );
-READ16_HANDLER( ay8910_read_port_3_msb_r );
-READ16_HANDLER( ay8910_read_port_4_msb_r );
-
-WRITE8_HANDLER( ay8910_control_port_0_w );
-WRITE8_HANDLER( ay8910_control_port_1_w );
-WRITE8_HANDLER( ay8910_control_port_2_w );
-WRITE8_HANDLER( ay8910_control_port_3_w );
-WRITE8_HANDLER( ay8910_control_port_4_w );
-WRITE16_HANDLER( ay8910_control_port_0_lsb_w );
-WRITE16_HANDLER( ay8910_control_port_1_lsb_w );
-WRITE16_HANDLER( ay8910_control_port_2_lsb_w );
-WRITE16_HANDLER( ay8910_control_port_3_lsb_w );
-WRITE16_HANDLER( ay8910_control_port_4_lsb_w );
-WRITE16_HANDLER( ay8910_control_port_0_msb_w );
-WRITE16_HANDLER( ay8910_control_port_1_msb_w );
-WRITE16_HANDLER( ay8910_control_port_2_msb_w );
-WRITE16_HANDLER( ay8910_control_port_3_msb_w );
-WRITE16_HANDLER( ay8910_control_port_4_msb_w );
-
-WRITE8_HANDLER( ay8910_write_port_0_w );
-WRITE8_HANDLER( ay8910_write_port_1_w );
-WRITE8_HANDLER( ay8910_write_port_2_w );
-WRITE8_HANDLER( ay8910_write_port_3_w );
-WRITE8_HANDLER( ay8910_write_port_4_w );
-WRITE16_HANDLER( ay8910_write_port_0_lsb_w );
-WRITE16_HANDLER( ay8910_write_port_1_lsb_w );
-WRITE16_HANDLER( ay8910_write_port_2_lsb_w );
-WRITE16_HANDLER( ay8910_write_port_3_lsb_w );
-WRITE16_HANDLER( ay8910_write_port_4_lsb_w );
-WRITE16_HANDLER( ay8910_write_port_0_msb_w );
-WRITE16_HANDLER( ay8910_write_port_1_msb_w );
-WRITE16_HANDLER( ay8910_write_port_2_msb_w );
-WRITE16_HANDLER( ay8910_write_port_3_msb_w );
-WRITE16_HANDLER( ay8910_write_port_4_msb_w );
+void ay8910_set_volume(const device_config *device,int channel,int volume);
+
+READ8_DEVICE_HANDLER( ay8910_r );
+WRITE8_DEVICE_HANDLER( ay8910_address_w );
+WRITE8_DEVICE_HANDLER( ay8910_data_w );
+
+/* use this when BC1 == A0; here, BC1=0 selects 'data' and BC1=1 selects 'latch address' */
+WRITE8_DEVICE_HANDLER( ay8910_data_address_w );
+
+/* use this when BC1 == !A0; here, BC1=0 selects 'latch address' and BC1=1 selects 'data' */
+WRITE8_DEVICE_HANDLER( ay8910_address_data_w );
+
/*********** An interface for SSG of YM2203 ***********/
@@ -134,22 +98,22 @@ void ay8910_set_clock_ym(void *chip, int clock);
void ay8910_write_ym(void *chip, int addr, int data);
int ay8910_read_ym(void *chip);
-SND_GET_INFO( ay8910 );
-SND_GET_INFO( ay8912 );
-SND_GET_INFO( ay8913 );
-SND_GET_INFO( ay8930 );
-SND_GET_INFO( ym2149 );
-SND_GET_INFO( ym3439 );
-SND_GET_INFO( ymz284 );
-SND_GET_INFO( ymz294 );
-
-#define SOUND_AY8910 SND_GET_INFO_NAME( ay8910 )
-#define SOUND_AY8912 SND_GET_INFO_NAME( ay8912 )
-#define SOUND_AY8913 SND_GET_INFO_NAME( ay8913 )
-#define SOUND_AY8930 SND_GET_INFO_NAME( ay8930 )
-#define SOUND_YM2149 SND_GET_INFO_NAME( ym2149 )
-#define SOUND_YM3439 SND_GET_INFO_NAME( ym3439 )
-#define SOUND_YMZ284 SND_GET_INFO_NAME( ymz284 )
-#define SOUND_YMZ294 SND_GET_INFO_NAME( ymz294 )
+DEVICE_GET_INFO( ay8910 );
+DEVICE_GET_INFO( ay8912 );
+DEVICE_GET_INFO( ay8913 );
+DEVICE_GET_INFO( ay8930 );
+DEVICE_GET_INFO( ym2149 );
+DEVICE_GET_INFO( ym3439 );
+DEVICE_GET_INFO( ymz284 );
+DEVICE_GET_INFO( ymz294 );
+
+#define SOUND_AY8910 DEVICE_GET_INFO_NAME( ay8910 )
+#define SOUND_AY8912 DEVICE_GET_INFO_NAME( ay8912 )
+#define SOUND_AY8913 DEVICE_GET_INFO_NAME( ay8913 )
+#define SOUND_AY8930 DEVICE_GET_INFO_NAME( ay8930 )
+#define SOUND_YM2149 DEVICE_GET_INFO_NAME( ym2149 )
+#define SOUND_YM3439 DEVICE_GET_INFO_NAME( ym3439 )
+#define SOUND_YMZ284 DEVICE_GET_INFO_NAME( ymz284 )
+#define SOUND_YMZ294 DEVICE_GET_INFO_NAME( ymz294 )
#endif /* __AY8910_H__ */
diff --git a/src/emu/sound/beep.c b/src/emu/sound/beep.c
index ca07ea59aaf..e320f39d845 100644
--- a/src/emu/sound/beep.c
+++ b/src/emu/sound/beep.c
@@ -18,8 +18,8 @@
#define BEEP_RATE 48000
-
-struct beep_sound
+typedef struct _beep_state beep_state;
+struct _beep_state
{
sound_stream *stream; /* stream number */
int enable; /* enable beep */
@@ -29,6 +29,16 @@ struct beep_sound
};
+INLINE beep_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_BEEP);
+ return (beep_state *)device->token;
+}
+
+
/*************************************
*
@@ -38,7 +48,7 @@ struct beep_sound
static STREAM_UPDATE( beep_sound_update )
{
- struct beep_sound *bs = (struct beep_sound *) param;
+ beep_state *bs = (beep_state *) param;
stream_sample_t *buffer = outputs[0];
INT16 signal = bs->signal;
int clock = 0, rate = BEEP_RATE / 2;
@@ -81,9 +91,9 @@ static STREAM_UPDATE( beep_sound_update )
*
*************************************/
-static SND_START( beep )
+static DEVICE_START( beep )
{
- struct beep_sound *pBeep = device->token;
+ beep_state *pBeep = get_safe_token(device);
pBeep->stream = stream_create(device, 0, 1, BEEP_RATE, pBeep, beep_sound_update );
pBeep->enable = 0;
@@ -100,9 +110,9 @@ static SND_START( beep )
*
*************************************/
-void beep_set_state( int num, int on )
+void beep_set_state(const device_config *device, int on)
{
- struct beep_sound *info = sndti_token(SOUND_BEEP, num);
+ beep_state *info = get_safe_token(device);
/* only update if new state is not the same as old state */
if (info->enable == on)
@@ -124,9 +134,9 @@ void beep_set_state( int num, int on )
*
*************************************/
-void beep_set_frequency(int num,int frequency)
+void beep_set_frequency(const device_config *device,int frequency)
{
- struct beep_sound *info = sndti_token(SOUND_BEEP, num);
+ beep_state *info = get_safe_token(device);
if (info->frequency == frequency)
return;
@@ -145,15 +155,15 @@ void beep_set_frequency(int num,int frequency)
*
*************************************/
-void beep_set_volume(int num, int volume)
+void beep_set_volume(const device_config *device, int volume)
{
- struct beep_sound *info = sndti_token(SOUND_BEEP, num);
+ beep_state *info = get_safe_token(device);
stream_update(info->stream);
volume = 100 * volume / 7;
- sndti_set_output_gain(SOUND_BEEP, num, 0, volume );
+ sound_set_output_gain(device, 0, volume);
}
@@ -162,33 +172,21 @@ void beep_set_volume(int num, int volume)
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( beep )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( beep )
+DEVICE_GET_INFO( beep )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct beep_sound); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(beep_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( beep ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( beep ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: /* nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( beep ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "Beep"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Beep"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright The MESS Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "Beep"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Beep"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright The MESS Team"); break;
}
}
diff --git a/src/emu/sound/beep.h b/src/emu/sound/beep.h
index 2b01ed48dbb..41784e553bf 100644
--- a/src/emu/sound/beep.h
+++ b/src/emu/sound/beep.h
@@ -3,19 +3,11 @@
#ifndef __BEEP_H__
#define __BEEP_H__
-#ifdef __cplusplus
-extern "C" {
-#endif
+void beep_set_state(const device_config *device, int on);
+void beep_set_frequency(const device_config *device, int frequency);
+void beep_set_volume(const device_config *device, int volume);
-void beep_set_state(int,int);
-void beep_set_frequency(int,int);
-void beep_set_volume(int,int);
-
-SND_GET_INFO( beep );
-#define SOUND_BEEP SND_GET_INFO_NAME( beep )
-
-#ifdef __cplusplus
-}
-#endif
+DEVICE_GET_INFO( beep );
+#define SOUND_BEEP DEVICE_GET_INFO_NAME( beep )
#endif /* __BEEP_H__ */
diff --git a/src/emu/sound/bsmt2000.c b/src/emu/sound/bsmt2000.c
index 8a09d46f02d..1a93826dc54 100644
--- a/src/emu/sound/bsmt2000.c
+++ b/src/emu/sound/bsmt2000.c
@@ -85,12 +85,8 @@ struct _bsmt2000_chip
***************************************************************************/
/* core implementation */
-static void bsmt2000_reset(bsmt2000_chip *chip);
static STREAM_UPDATE( bsmt2000_update );
-/* read/write access */
-static void bsmt2000_reg_write(bsmt2000_chip *chip, offs_t offset, UINT16 data);
-
/* local functions */
static void set_mode(bsmt2000_chip *chip);
static void set_regmap(bsmt2000_chip *chip, UINT8 posbase, UINT8 ratebase, UINT8 endbase, UINT8 loopbase, UINT8 bankbase, UINT8 rvolbase, UINT8 lvolbase);
@@ -98,21 +94,36 @@ static void set_regmap(bsmt2000_chip *chip, UINT8 posbase, UINT8 ratebase, UINT8
/***************************************************************************
+ INLINE FUNCTIONS
+***************************************************************************/
+
+INLINE bsmt2000_chip *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_BSMT2000);
+ return (bsmt2000_chip *)device->token;
+}
+
+
+
+/***************************************************************************
CORE IMPLEMENTATION
***************************************************************************/
/*-------------------------------------------------
- SND_START( bsmt2000 ) - initialization callback
+ DEVICE_START( bsmt2000 ) - initialization callback
-------------------------------------------------*/
-static SND_START( bsmt2000 )
+static DEVICE_START( bsmt2000 )
{
- bsmt2000_chip *chip = device->token;
+ bsmt2000_chip *chip = get_safe_token(device);
int voicenum;
/* create a stream at a nominal sample rate (real one specified later) */
- chip->stream = stream_create(device, 0, 2, clock / 1000, chip, bsmt2000_update);
- chip->clock = clock;
+ chip->stream = stream_create(device, 0, 2, device->clock / 1000, chip, bsmt2000_update);
+ chip->clock = device->clock;
/* initialize the regions */
chip->region_base = (INT8 *)device->region;
@@ -140,18 +151,16 @@ static SND_START( bsmt2000 )
state_save_register_device_item(device, voicenum, voice->rightvol);
state_save_register_device_item(device, voicenum, voice->fraction);
}
-
- /* reset the chip -- this also configures the default mode */
- bsmt2000_reset(chip);
}
/*-------------------------------------------------
- SND_RESET( bsmt2000 ) - chip reset callback
+ DEVICE_RESET( bsmt2000 ) - chip reset callback
-------------------------------------------------*/
-static void bsmt2000_reset(bsmt2000_chip *chip)
+static DEVICE_RESET( bsmt2000 )
{
+ bsmt2000_chip *chip = get_safe_token(device);
int voicenum;
/* reset all the voice data */
@@ -167,11 +176,6 @@ static void bsmt2000_reset(bsmt2000_chip *chip)
set_mode(chip);
}
-static SND_RESET( bsmt2000 )
-{
- bsmt2000_reset(device->token);
-}
-
/*-------------------------------------------------
bsmt2000_update - update callback for
@@ -316,8 +320,10 @@ static STREAM_UPDATE( bsmt2000_update )
bsmt2000_reg_write - handle a register write
-------------------------------------------------*/
-static void bsmt2000_reg_write(bsmt2000_chip *chip, offs_t offset, UINT16 data)
+WRITE16_DEVICE_HANDLER( bsmt2000_data_w )
{
+ bsmt2000_chip *chip = get_safe_token(device);
+
if (LOG_COMMANDS) mame_printf_debug("BSMT write: reg %02X = %04X\n", offset, data);
/* remember the last write */
@@ -344,21 +350,6 @@ static void bsmt2000_reg_write(bsmt2000_chip *chip, offs_t offset, UINT16 data)
/***************************************************************************
- PER-CHIP READ/WRITE HANDLERS
-***************************************************************************/
-
-/*-------------------------------------------------
- bsmt2000_data_0_w - write to chip 0
--------------------------------------------------*/
-
-WRITE16_HANDLER( bsmt2000_data_0_w )
-{
- bsmt2000_reg_write(sndti_token(SOUND_BSMT2000, 0), offset, data);
-}
-
-
-
-/***************************************************************************
LOCAL FUNCTIONS
***************************************************************************/
@@ -472,42 +463,26 @@ static void set_regmap(bsmt2000_chip *chip, UINT8 posbase, UINT8 ratebase, UINT8
***************************************************************************/
/*-------------------------------------------------
- SND_SET_INFO( bsmt2000 ) - callback for
- setting chip information
--------------------------------------------------*/
-
-static SND_SET_INFO( bsmt2000 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-/*-------------------------------------------------
- SND_GET_INFO( bsmt2000 ) - callback for
+ DEVICE_GET_INFO( bsmt2000 ) - callback for
retrieving chip information
-------------------------------------------------*/
-SND_GET_INFO( bsmt2000 )
+DEVICE_GET_INFO( bsmt2000 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(bsmt2000_chip); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(bsmt2000_chip); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( bsmt2000 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( bsmt2000 ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( bsmt2000 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( bsmt2000 ); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( bsmt2000 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "BSMT2000"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Data East Wavetable"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "BSMT2000"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Data East Wavetable"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/bsmt2000.h b/src/emu/sound/bsmt2000.h
index cc3fc2d12a4..02f7a9418fe 100644
--- a/src/emu/sound/bsmt2000.h
+++ b/src/emu/sound/bsmt2000.h
@@ -10,9 +10,9 @@
#ifndef __BSMT2000_H__
#define __BSMT2000_H__
-WRITE16_HANDLER( bsmt2000_data_0_w );
+WRITE16_DEVICE_HANDLER( bsmt2000_data_w );
-SND_GET_INFO( bsmt2000 );
-#define SOUND_BSMT2000 SND_GET_INFO_NAME( bsmt2000 )
+DEVICE_GET_INFO( bsmt2000 );
+#define SOUND_BSMT2000 DEVICE_GET_INFO_NAME( bsmt2000 )
#endif /* __BSMT2000_H__ */
diff --git a/src/emu/sound/c140.c b/src/emu/sound/c140.c
index d8867e9846e..68bb3ec66e8 100644
--- a/src/emu/sound/c140.c
+++ b/src/emu/sound/c140.c
@@ -88,7 +88,8 @@ typedef struct
long sample_loop;
} VOICE;
-struct c140_info
+typedef struct _c140_state c140_state;
+struct _c140_state
{
int sample_rate;
sound_stream *stream;
@@ -106,6 +107,16 @@ struct c140_info
VOICE voi[MAX_VOICE];
};
+INLINE c140_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_C140);
+ return (c140_state *)device->token;
+}
+
+
static void init_voice( VOICE *v )
{
v->key=0;
@@ -119,9 +130,9 @@ static void init_voice( VOICE *v )
v->sample_end=0;
v->sample_loop=0;
}
-READ8_HANDLER( c140_r )
+READ8_DEVICE_HANDLER( c140_r )
{
- struct c140_info *info = sndti_token(SOUND_C140, 0);
+ c140_state *info = get_safe_token(device);
offset&=0x1ff;
return info->REG[offset];
}
@@ -134,7 +145,7 @@ READ8_HANDLER( c140_r )
is done by a small PAL or GAL external to the sound chip, which can be switched
per-game or at least per-PCB revision as addressing range needs grow.
*/
-static long find_sample(struct c140_info *info, long adrs, long bank, int voice)
+static long find_sample(c140_state *info, long adrs, long bank, int voice)
{
long newadr = 0;
@@ -184,9 +195,9 @@ static long find_sample(struct c140_info *info, long adrs, long bank, int voice)
return (newadr);
}
-WRITE8_HANDLER( c140_w )
+WRITE8_DEVICE_HANDLER( c140_w )
{
- struct c140_info *info = sndti_token(SOUND_C140, 0);
+ c140_state *info = get_safe_token(device);
stream_update(info->stream);
offset&=0x1ff;
@@ -246,9 +257,9 @@ WRITE8_HANDLER( c140_w )
}
}
-void c140_set_base(int which, void *base)
+void c140_set_base(const device_config *device, void *base)
{
- struct c140_info *info = sndti_token(SOUND_C140, 0);
+ c140_state *info = get_safe_token(device);
info->pRom = base;
}
@@ -261,7 +272,7 @@ INLINE int limit(INT32 in)
static STREAM_UPDATE( update_stereo )
{
- struct c140_info *info = param;
+ c140_state *info = param;
int i,j;
INT32 rvol,lvol;
@@ -454,12 +465,12 @@ static STREAM_UPDATE( update_stereo )
}
}
-static SND_START( c140 )
+static DEVICE_START( c140 )
{
const c140_interface *intf = device->static_config;
- struct c140_info *info = device->token;
+ c140_state *info = get_safe_token(device);
- info->sample_rate=info->baserate=clock;
+ info->sample_rate=info->baserate=device->clock;
info->banking_type = intf->banking_type;
@@ -496,34 +507,24 @@ static SND_START( c140 )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( c140 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( c140 )
+DEVICE_GET_INFO( c140 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct c140_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(c140_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( c140 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( c140 ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: /* nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( c140 ); break;
+ case DEVINFO_FCT_STOP: /* nothing */ break;
+ case DEVINFO_FCT_RESET: /* nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "C140"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Namco PCM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "C140"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Namco PCM"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/c140.h b/src/emu/sound/c140.h
index 5d78c7eb264..f814e9c242e 100644
--- a/src/emu/sound/c140.h
+++ b/src/emu/sound/c140.h
@@ -5,10 +5,10 @@
#ifndef __C140_H__
#define __C140_H__
-READ8_HANDLER( c140_r );
-WRITE8_HANDLER( c140_w );
+READ8_DEVICE_HANDLER( c140_r );
+WRITE8_DEVICE_HANDLER( c140_w );
-void c140_set_base(int which, void *base);
+void c140_set_base(const device_config *device, void *base);
enum
{
@@ -23,7 +23,7 @@ struct _c140_interface {
int banking_type;
};
-SND_GET_INFO( c140 );
-#define SOUND_C140 SND_GET_INFO_NAME( c140 )
+DEVICE_GET_INFO( c140 );
+#define SOUND_C140 DEVICE_GET_INFO_NAME( c140 )
#endif /* __C140_H__ */
diff --git a/src/emu/sound/c352.c b/src/emu/sound/c352.c
index d6a8ca6502b..71c2df438d8 100644
--- a/src/emu/sound/c352.c
+++ b/src/emu/sound/c352.c
@@ -65,7 +65,8 @@ typedef struct
UINT32 pos;
} c352_ch_t;
-struct c352_info
+typedef struct _c352_state c352_state;
+struct _c352_state
{
sound_stream *stream;
c352_ch_t c352_ch[32];
@@ -82,8 +83,17 @@ struct c352_info
unsigned int mseq_reg;
};
+INLINE c352_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_C352);
+ return (c352_state *)device->token;
+}
+
// noise generator
-static int get_mseq_bit(struct c352_info *info)
+static int get_mseq_bit(c352_state *info)
{
unsigned int mask = (1 << (7 - 1));
unsigned int reg = info->mseq_reg;
@@ -103,7 +113,7 @@ static int get_mseq_bit(struct c352_info *info)
return (reg & 1);
}
-static void c352_mix_one_channel(struct c352_info *info, unsigned long ch, long sample_count)
+static void c352_mix_one_channel(c352_state *info, unsigned long ch, long sample_count)
{
int i;
@@ -327,7 +337,7 @@ static void c352_mix_one_channel(struct c352_info *info, unsigned long ch, long
static STREAM_UPDATE( c352_update )
{
- struct c352_info *info = param;
+ c352_state *info = param;
int i, j;
stream_sample_t *bufferl = outputs[0];
stream_sample_t *bufferr = outputs[1];
@@ -353,7 +363,7 @@ static STREAM_UPDATE( c352_update )
}
}
-static unsigned short c352_read_reg16(struct c352_info *info, unsigned long address)
+static unsigned short c352_read_reg16(c352_state *info, unsigned long address)
{
unsigned long chan;
unsigned short val;
@@ -379,7 +389,7 @@ static unsigned short c352_read_reg16(struct c352_info *info, unsigned long addr
return val;
}
-static void c352_write_reg16(struct c352_info *info, unsigned long address, unsigned short val)
+static void c352_write_reg16(c352_state *info, unsigned long address, unsigned short val)
{
unsigned long chan;
int i;
@@ -481,7 +491,7 @@ static void c352_write_reg16(struct c352_info *info, unsigned long address, unsi
}
}
-static void c352_init(struct c352_info *info, const device_config *device)
+static void c352_init(c352_state *info, const device_config *device)
{
int i;
double x_max = 32752.0;
@@ -530,14 +540,14 @@ static void c352_init(struct c352_info *info, const device_config *device)
}
}
-static SND_START( c352 )
+static DEVICE_START( c352 )
{
- struct c352_info *info = device->token;
+ c352_state *info = get_safe_token(device);
info->c352_rom_samples = device->region;
info->c352_rom_length = device->regionbytes;
- info->sample_rate_base = clock / 192;
+ info->sample_rate_base = device->clock / 192;
info->stream = stream_create(device, 0, 4, info->sample_rate_base, info, c352_update);
@@ -545,16 +555,16 @@ static SND_START( c352 )
}
-READ16_HANDLER( c352_0_r )
+READ16_DEVICE_HANDLER( c352_r )
{
- return(c352_read_reg16(sndti_token(SOUND_C352, 0), offset*2));
+ return(c352_read_reg16(get_safe_token(device), offset*2));
}
-WRITE16_HANDLER( c352_0_w )
+WRITE16_DEVICE_HANDLER( c352_w )
{
if (mem_mask == 0xffff)
{
- c352_write_reg16(sndti_token(SOUND_C352, 0), offset*2, data);
+ c352_write_reg16(get_safe_token(device), offset*2, data);
}
else
{
@@ -572,34 +582,24 @@ WRITE16_HANDLER( c352_0_w )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( c352 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( c352 )
+DEVICE_GET_INFO( c352 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct c352_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(c352_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( c352 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( c352 ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: /* nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( c352 ); break;
+ case DEVINFO_FCT_STOP: /* nothing */ break;
+ case DEVINFO_FCT_RESET: /* nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "C352"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Namco PCM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.1"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "C352"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Namco PCM"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.1"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/c352.h b/src/emu/sound/c352.h
index 71c284c2f99..6d3b970821a 100644
--- a/src/emu/sound/c352.h
+++ b/src/emu/sound/c352.h
@@ -3,11 +3,11 @@
#ifndef __C352_H__
#define __C352_H__
-READ16_HANDLER( c352_0_r );
-WRITE16_HANDLER( c352_0_w );
+READ16_DEVICE_HANDLER( c352_r );
+WRITE16_DEVICE_HANDLER( c352_w );
-SND_GET_INFO( c352 );
-#define SOUND_C352 SND_GET_INFO_NAME( c352 )
+DEVICE_GET_INFO( c352 );
+#define SOUND_C352 DEVICE_GET_INFO_NAME( c352 )
#endif /* __C352_H__ */
diff --git a/src/emu/sound/c6280.c b/src/emu/sound/c6280.c
index 815dc8a9478..daa3083d917 100644
--- a/src/emu/sound/c6280.c
+++ b/src/emu/sound/c6280.c
@@ -72,6 +72,7 @@ typedef struct {
typedef struct {
sound_stream *stream;
const device_config *device;
+ const device_config *cpudevice;
UINT8 select;
UINT8 balance;
UINT8 lfo_frequency;
@@ -82,6 +83,16 @@ typedef struct {
UINT32 wave_freq_tab[4096];
} c6280_t;
+INLINE c6280_t *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_C6280);
+ return (c6280_t *)device->token;
+}
+
+
/* only needed for io_buffer */
#include "cpu/h6280/h6280.h"
@@ -98,6 +109,9 @@ static void c6280_init(const device_config *device, c6280_t *p, double clk, doub
memset(p, 0, sizeof(c6280_t));
p->device = device;
+ p->cpudevice = cputag_get_cpu(device->machine, device->tag);
+ if (p->cpudevice == NULL)
+ fatalerror("c6280_init: no CPU found with tag of '%s'\n", device->tag);
/* Make waveform frequency table */
for(i = 0; i < 4096; i += 1)
@@ -307,21 +321,30 @@ static STREAM_UPDATE( c6280_update )
/* MAME specific code */
/*--------------------------------------------------------------------------*/
-static SND_START( c6280 )
+static DEVICE_START( c6280 )
{
- int rate = clock/16;
- c6280_t *info = device->token;
+ int rate = device->clock/16;
+ c6280_t *info = get_safe_token(device);
/* Initialize PSG emulator */
- c6280_init(device, info, clock, rate);
+ c6280_init(device, info, device->clock, rate);
/* Create stereo stream */
info->stream = stream_create(device, 0, 2, rate, info, c6280_update);
}
-READ8_HANDLER( c6280_r ) { return h6280io_get_buffer((device_config*)space->cpu); }
-WRITE8_HANDLER( c6280_0_w ) { h6280io_set_buffer((device_config*)space->cpu, data); c6280_write(sndti_token(SOUND_C6280, 0),offset,data); }
-WRITE8_HANDLER( c6280_1_w ) { h6280io_set_buffer((device_config*)space->cpu, data); c6280_write(sndti_token(SOUND_C6280, 1),offset,data); }
+READ8_DEVICE_HANDLER( c6280_r )
+{
+ c6280_t *info = get_safe_token(device);
+ return h6280io_get_buffer(info->cpudevice);
+}
+
+WRITE8_DEVICE_HANDLER( c6280_w )
+{
+ c6280_t *info = get_safe_token(device);
+ h6280io_set_buffer(info->cpudevice, data);
+ c6280_write(info, offset, data);
+}
@@ -329,34 +352,24 @@ WRITE8_HANDLER( c6280_1_w ) { h6280io_set_buffer((device_config*)space->cpu, da
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( c6280 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( c6280 )
+DEVICE_GET_INFO( c6280 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(c6280_t); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(c6280_t); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( c6280 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( c6280 ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: /* nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( c6280 ); break;
+ case DEVINFO_FCT_STOP: /* nothing */ break;
+ case DEVINFO_FCT_RESET: /* nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "HuC6280"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "????"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "HuC6280"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "????"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/c6280.h b/src/emu/sound/c6280.h
index 737f2b89c55..6aceeae9196 100644
--- a/src/emu/sound/c6280.h
+++ b/src/emu/sound/c6280.h
@@ -4,11 +4,10 @@
#define __C6280_H__
/* Function prototypes */
-WRITE8_HANDLER( c6280_0_w );
-WRITE8_HANDLER( c6280_1_w );
-READ8_HANDLER( c6280_r );
+WRITE8_DEVICE_HANDLER( c6280_w );
+READ8_DEVICE_HANDLER( c6280_r );
-SND_GET_INFO( c6280 );
-#define SOUND_C6280 SND_GET_INFO_NAME( c6280 )
+DEVICE_GET_INFO( c6280 );
+#define SOUND_C6280 DEVICE_GET_INFO_NAME( c6280 )
#endif /* __C6280_H__ */
diff --git a/src/emu/sound/cdda.c b/src/emu/sound/cdda.c
index 347225be67c..c9172bb8a66 100644
--- a/src/emu/sound/cdda.c
+++ b/src/emu/sound/cdda.c
@@ -5,9 +5,10 @@
#include "sndintrf.h"
#include "streams.h"
-#include "cpuintrf.h"
#include "cdrom.h"
#include "cdda.h"
+#include "sound.h"
+#include "driver.h"
typedef struct _cdda_info cdda_info;
struct _cdda_info
@@ -23,6 +24,15 @@ struct _cdda_info
UINT32 audio_bptr;
};
+INLINE cdda_info *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_CDDA);
+ return (cdda_info *)device->token;
+}
+
#define MAX_SECTORS ( 4 )
static void get_audio_data(cdda_info *info, stream_sample_t *bufL, stream_sample_t *bufR, UINT32 samples_wanted);
@@ -40,13 +50,13 @@ static STREAM_UPDATE( cdda_update )
/*-------------------------------------------------
- SND_START( cdda ) - audio start callback
+ DEVICE_START( cdda ) - audio start callback
-------------------------------------------------*/
-static SND_START( cdda )
+static DEVICE_START( cdda )
{
const struct CDDAinterface *intf;
- cdda_info *info = device->token;
+ cdda_info *info = get_safe_token(device);
/* allocate an audio cache */
info->audio_cache = auto_malloc( CD_MAX_SECTOR_DATA * MAX_SECTORS );
@@ -71,37 +81,31 @@ static SND_START( cdda )
given CDDA stream
-------------------------------------------------*/
-void cdda_set_cdrom(int num, void *file)
+void cdda_set_cdrom(const device_config *device, void *file)
{
- cdda_info *info = sndti_token(SOUND_CDDA, num);
+ cdda_info *info = get_safe_token(device);
info->disc = (cdrom_file *)file;
}
/*-------------------------------------------------
- cdda_num_from_cdrom - find the CDDA stream
+ cdda_from_cdrom - find the CDDA stream
that references the given CD-ROM file
-------------------------------------------------*/
-int cdda_num_from_cdrom(void *file)
+const device_config *cdda_from_cdrom(running_machine *machine, void *file)
{
- int index = 0;
-
- do
- {
- cdda_info *info;
-
- if (!sndti_exists(SOUND_CDDA, index))
- return -1;
-
- info = sndti_token(SOUND_CDDA, index);
-
- if (info == NULL)
- return -1;
- if (info->disc == file)
- return index;
- index++;
- } while (1);
+ const device_config *device;
+
+ for (device = sound_first(machine->config); device != NULL; device = sound_next(device))
+ if (sound_get_type(device) == SOUND_CDDA)
+ {
+ cdda_info *info = get_safe_token(device);
+ if (info->disc == file)
+ return device;
+ }
+
+ return NULL;
}
@@ -110,9 +114,9 @@ int cdda_num_from_cdrom(void *file)
Book audio track
-------------------------------------------------*/
-void cdda_start_audio(int num, UINT32 startlba, UINT32 numblocks)
+void cdda_start_audio(const device_config *device, UINT32 startlba, UINT32 numblocks)
{
- cdda_info *info = sndti_token(SOUND_CDDA, num);
+ cdda_info *info = get_safe_token(device);
stream_update(info->stream);
info->audio_playing = TRUE;
@@ -128,9 +132,9 @@ void cdda_start_audio(int num, UINT32 startlba, UINT32 numblocks)
audio track
-------------------------------------------------*/
-void cdda_stop_audio(int num)
+void cdda_stop_audio(const device_config *device)
{
- cdda_info *info = sndti_token(SOUND_CDDA, num);
+ cdda_info *info = get_safe_token(device);
stream_update(info->stream);
info->audio_playing = FALSE;
@@ -143,9 +147,9 @@ void cdda_stop_audio(int num)
a Red Book audio track
-------------------------------------------------*/
-void cdda_pause_audio(int num, int pause)
+void cdda_pause_audio(const device_config *device, int pause)
{
- cdda_info *info = sndti_token(SOUND_CDDA, num);
+ cdda_info *info = get_safe_token(device);
stream_update(info->stream);
info->audio_pause = pause;
@@ -157,9 +161,9 @@ void cdda_pause_audio(int num, int pause)
(physical sector) during Red Book playback
-------------------------------------------------*/
-UINT32 cdda_get_audio_lba(int num)
+UINT32 cdda_get_audio_lba(const device_config *device)
{
- cdda_info *info = sndti_token(SOUND_CDDA, num);
+ cdda_info *info = get_safe_token(device);
stream_update(info->stream);
return info->audio_lba;
@@ -171,9 +175,9 @@ UINT32 cdda_get_audio_lba(int num)
playback status
-------------------------------------------------*/
-int cdda_audio_active(int num)
+int cdda_audio_active(const device_config *device)
{
- cdda_info *info = sndti_token(SOUND_CDDA, num);
+ cdda_info *info = get_safe_token(device);
stream_update(info->stream);
return info->audio_playing;
@@ -185,9 +189,9 @@ int cdda_audio_active(int num)
playback is paused
-------------------------------------------------*/
-int cdda_audio_paused(int num)
+int cdda_audio_paused(const device_config *device)
{
- cdda_info *info = sndti_token(SOUND_CDDA, num);
+ cdda_info *info = get_safe_token(device);
return info->audio_pause;
}
@@ -197,9 +201,9 @@ int cdda_audio_paused(int num)
track reached it's natural end
-------------------------------------------------*/
-int cdda_audio_ended(int num)
+int cdda_audio_ended(const device_config *device)
{
- cdda_info *info = sndti_token(SOUND_CDDA, num);
+ cdda_info *info = get_safe_token(device);
return info->audio_ended_normally;
}
@@ -296,34 +300,24 @@ static void get_audio_data(cdda_info *info, stream_sample_t *bufL, stream_sample
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( cdda )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( cdda )
+DEVICE_GET_INFO( cdda )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(cdda_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(cdda_info); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( cdda ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( cdda ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: /* nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( cdda ); break;
+ case DEVINFO_FCT_STOP: /* nothing */ break;
+ case DEVINFO_FCT_RESET: /* nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "CD/DA"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "CD Audio"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "CD/DA"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "CD Audio"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/cdda.h b/src/emu/sound/cdda.h
index 411813090ea..5a7fe1bd5f8 100644
--- a/src/emu/sound/cdda.h
+++ b/src/emu/sound/cdda.h
@@ -3,19 +3,19 @@
#ifndef __CDDA_H__
#define _CDDA_H_
-void cdda_set_cdrom(int num, void *file);
-int cdda_num_from_cdrom(void *file);
+void cdda_set_cdrom(const device_config *device, void *file);
+const device_config *cdda_from_cdrom(running_machine *machine, void *file);
-void cdda_start_audio(int num, UINT32 startlba, UINT32 numblocks);
-void cdda_stop_audio(int num);
-void cdda_pause_audio(int num, int pause);
+void cdda_start_audio(const device_config *device, UINT32 startlba, UINT32 numblocks);
+void cdda_stop_audio(const device_config *device);
+void cdda_pause_audio(const device_config *device, int pause);
-UINT32 cdda_get_audio_lba(int num);
-int cdda_audio_active(int num);
-int cdda_audio_paused(int num);
-int cdda_audio_ended(int num);
+UINT32 cdda_get_audio_lba(const device_config *device);
+int cdda_audio_active(const device_config *device);
+int cdda_audio_paused(const device_config *device);
+int cdda_audio_ended(const device_config *device);
-SND_GET_INFO( cdda );
-#define SOUND_CDDA SND_GET_INFO_NAME( cdda )
+DEVICE_GET_INFO( cdda );
+#define SOUND_CDDA DEVICE_GET_INFO_NAME( cdda )
#endif /* __CDDA_H__ */
diff --git a/src/emu/sound/cdp1869.c b/src/emu/sound/cdp1869.c
index aca0ba1f882..1b048fd403d 100644
--- a/src/emu/sound/cdp1869.c
+++ b/src/emu/sound/cdp1869.c
@@ -14,7 +14,8 @@
#include "streams.h"
#include "sound/cdp1869.h"
-struct CDP1869
+typedef struct _cdp1869_state cdp1869_state;
+struct _cdp1869_state
{
const device_config *device;
sound_stream *stream; /* returned by stream_create() */
@@ -34,6 +35,15 @@ struct CDP1869
UINT8 wnamp;
};
+INLINE cdp1869_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_CDP1869);
+ return (cdp1869_state *)device->token;
+}
+
/*************************************
*
* Stream update
@@ -42,7 +52,7 @@ struct CDP1869
static STREAM_UPDATE( cdp1869_update )
{
- struct CDP1869 *info = param;
+ cdp1869_state *info = param;
INT16 signal = info->signal;
stream_sample_t *buffer = outputs[0];
@@ -103,16 +113,16 @@ static STREAM_UPDATE( cdp1869_update )
*
*************************************/
-static SND_START( cdp1869 )
+static DEVICE_START( cdp1869 )
{
- struct CDP1869 *info = device->token;
+ cdp1869_state *info = get_safe_token(device);
info->device = device;
info->stream = stream_create(device, 0, 1, device->machine->sample_rate, info, cdp1869_update );
info->incr = 0;
info->signal = 0x07fff;
- info->clock = clock;
+ info->clock = device->clock;
info->toneoff = 1;
info->wnoff = 1;
info->tonediv = 0;
@@ -122,45 +132,45 @@ static SND_START( cdp1869 )
info->wnamp = 0;
}
-void cdp1869_set_toneamp(int which, int value)
+void cdp1869_set_toneamp(const device_config *device, int value)
{
- struct CDP1869 *info = sndti_token(SOUND_CDP1869, which);
+ cdp1869_state *info = get_safe_token(device);
info->toneamp = value & 0x0f;
}
-void cdp1869_set_tonefreq(int which, int value)
+void cdp1869_set_tonefreq(const device_config *device, int value)
{
- struct CDP1869 *info = sndti_token(SOUND_CDP1869, which);
+ cdp1869_state *info = get_safe_token(device);
info->tonefreq = value & 0x07;
}
-void cdp1869_set_toneoff(int which, int value)
+void cdp1869_set_toneoff(const device_config *device, int value)
{
- struct CDP1869 *info = sndti_token(SOUND_CDP1869, which);
+ cdp1869_state *info = get_safe_token(device);
info->toneoff = value & 0x01;
}
-void cdp1869_set_tonediv(int which, int value)
+void cdp1869_set_tonediv(const device_config *device, int value)
{
- struct CDP1869 *info = sndti_token(SOUND_CDP1869, which);
+ cdp1869_state *info = get_safe_token(device);
info->tonediv = value & 0x7f;
}
-void cdp1869_set_wnamp(int which, int value)
+void cdp1869_set_wnamp(const device_config *device, int value)
{
- struct CDP1869 *info = sndti_token(SOUND_CDP1869, which);
+ cdp1869_state *info = get_safe_token(device);
info->wnamp = value & 0x0f;
}
-void cdp1869_set_wnfreq(int which, int value)
+void cdp1869_set_wnfreq(const device_config *device, int value)
{
- struct CDP1869 *info = sndti_token(SOUND_CDP1869, which);
+ cdp1869_state *info = get_safe_token(device);
info->wnfreq = value & 0x07;
}
-void cdp1869_set_wnoff(int which, int value)
+void cdp1869_set_wnoff(const device_config *device, int value)
{
- struct CDP1869 *info = sndti_token(SOUND_CDP1869, which);
+ cdp1869_state *info = get_safe_token(device);
info->wnoff = value & 0x01;
}
@@ -168,32 +178,23 @@ void cdp1869_set_wnoff(int which, int value)
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( cdp1869 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-SND_GET_INFO( cdp1869 )
+DEVICE_GET_INFO( cdp1869 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct CDP1869); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(cdp1869_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( cdp1869 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( cdp1869 ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: /* nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( cdp1869 ); break;
+ case DEVINFO_FCT_STOP: /* nothing */ break;
+ case DEVINFO_FCT_RESET: /* nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "CDP1869"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "RCA CDP1869"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "CDP1869"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "RCA CDP1869"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/cdp1869.h b/src/emu/sound/cdp1869.h
index 54e604fcd36..2593757a84e 100644
--- a/src/emu/sound/cdp1869.h
+++ b/src/emu/sound/cdp1869.h
@@ -32,15 +32,15 @@
#ifndef __CDP1869_H__
#define __CDP1869_H__
-void cdp1869_set_toneamp(int which, int value);
-void cdp1869_set_tonefreq(int which, int value);
-void cdp1869_set_toneoff(int which, int value);
-void cdp1869_set_tonediv(int which, int value);
-void cdp1869_set_wnamp(int which, int value);
-void cdp1869_set_wnfreq(int which, int value);
-void cdp1869_set_wnoff(int which, int value);
-
-SND_GET_INFO( cdp1869 );
-#define SOUND_CDP1869 SND_GET_INFO_NAME( cdp1869 )
+void cdp1869_set_toneamp(const device_config *device, int value);
+void cdp1869_set_tonefreq(const device_config *device, int value);
+void cdp1869_set_toneoff(const device_config *device, int value);
+void cdp1869_set_tonediv(const device_config *device, int value);
+void cdp1869_set_wnamp(const device_config *device, int value);
+void cdp1869_set_wnfreq(const device_config *device, int value);
+void cdp1869_set_wnoff(const device_config *device, int value);
+
+DEVICE_GET_INFO( cdp1869 );
+#define SOUND_CDP1869 DEVICE_GET_INFO_NAME( cdp1869 )
#endif /* __CDP1869_H__ */
diff --git a/src/emu/sound/cem3394.c b/src/emu/sound/cem3394.c
index aa93e5e58cf..09a3c8a176c 100644
--- a/src/emu/sound/cem3394.c
+++ b/src/emu/sound/cem3394.c
@@ -105,7 +105,8 @@
/* this structure defines the parameters for a channel */
-typedef struct
+typedef struct _cem3394_state cem3394_state;
+struct _cem3394_state
{
sound_stream * stream; /* our stream */
void (*external)(const device_config *, int, short *);/* callback to generate external samples */
@@ -135,13 +136,23 @@ typedef struct
INT16 *mixer_buffer;
INT16 *external_buffer;
-} sound_chip;
+};
+
+
+INLINE cem3394_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_CEM3394);
+ return (cem3394_state *)device->token;
+}
/* generate sound to the mix buffer in mono */
static STREAM_UPDATE( cem3394_update )
{
- sound_chip *chip = param;
+ cem3394_state *chip = param;
int int_volume = (chip->volume * chip->mixer_internal) / 256;
int ext_volume = (chip->volume * chip->mixer_external) / 256;
UINT32 step = chip->step, position, end_position = 0;
@@ -315,10 +326,10 @@ static STREAM_UPDATE( cem3394_update )
}
-static SND_START( cem3394 )
+static DEVICE_START( cem3394 )
{
const cem3394_interface *intf = device->static_config;
- sound_chip *chip = device->token;
+ cem3394_state *chip = get_safe_token(device);
chip->device = device;
@@ -407,9 +418,9 @@ INLINE UINT32 compute_db_volume(double voltage)
}
-void cem3394_set_voltage(int chipnum, int input, double voltage)
+void cem3394_set_voltage(const device_config *device, int input, double voltage)
{
- sound_chip *chip = sndti_token(SOUND_CEM3394, chipnum);
+ cem3394_state *chip = get_safe_token(device);
double temp;
/* don't do anything if no change */
@@ -501,9 +512,9 @@ void cem3394_set_voltage(int chipnum, int input, double voltage)
}
-double cem3394_get_parameter(int chipnum, int input)
+double cem3394_get_parameter(const device_config *device, int input)
{
- sound_chip *chip = sndti_token(SOUND_CEM3394, chipnum);
+ cem3394_state *chip = get_safe_token(device);
double voltage = chip->values[input];
switch (input)
@@ -557,34 +568,24 @@ double cem3394_get_parameter(int chipnum, int input)
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( cem3394 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( cem3394 )
+DEVICE_GET_INFO( cem3394 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(sound_chip); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(cem3394_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( cem3394 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( cem3394 ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: /* nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( cem3394 ); break;
+ case DEVINFO_FCT_STOP: /* nothing */ break;
+ case DEVINFO_FCT_RESET: /* nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "CEM3394"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Analog Synth"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "CEM3394"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Analog Synth"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/cem3394.h b/src/emu/sound/cem3394.h
index bf592394ac7..8db36dbf712 100644
--- a/src/emu/sound/cem3394.h
+++ b/src/emu/sound/cem3394.h
@@ -30,7 +30,7 @@ enum
};
/* set the voltage going to a particular parameter */
-void cem3394_set_voltage(int chip, int input, double voltage);
+void cem3394_set_voltage(const device_config *device, int input, double voltage);
/* get the translated parameter associated with the given input as follows:
CEM3394_VCO_FREQUENCY: frequency in Hz
@@ -41,9 +41,9 @@ void cem3394_set_voltage(int chip, int input, double voltage);
CEM3394_FILTER_RESONANCE: resonance, from 0.0 to 1.0
CEM3394_FILTER_FREQENCY: frequency, in Hz
CEM3394_FINAL_GAIN: gain, in dB */
-double cem3394_get_parameter(int chip, int input);
+double cem3394_get_parameter(const device_config *device, int input);
-SND_GET_INFO( cem3394 );
-#define SOUND_CEM3394 SND_GET_INFO_NAME( cem3394 )
+DEVICE_GET_INFO( cem3394 );
+#define SOUND_CEM3394 DEVICE_GET_INFO_NAME( cem3394 )
#endif /* __CEM3394_H__ */
diff --git a/src/emu/sound/custom.c b/src/emu/sound/custom.c
deleted file mode 100644
index 1b6a2a722fe..00000000000
--- a/src/emu/sound/custom.c
+++ /dev/null
@@ -1,85 +0,0 @@
-#include "sndintrf.h"
-#include "custom.h"
-
-
-struct custom_info
-{
- const custom_sound_interface *intf;
- void * token;
-};
-
-
-
-static SND_START( custom )
-{
- struct custom_info *info = device->token;
-
- /* stash a pointer and call the start routine */
- info->intf = device->static_config;
- if (info->intf->start)
- {
- info->token = (*info->intf->start)(device, clock, device->static_config);
- assert_always(info->token != NULL, "Error starting custom sound");
- }
-}
-
-
-static SND_STOP( custom )
-{
- struct custom_info *info = device->token;
- if (info->intf->stop)
- (*info->intf->stop)(device, info->token);
-}
-
-
-static SND_RESET( custom )
-{
- struct custom_info *info = device->token;
- if (info->intf->reset)
- (*info->intf->reset)(device, info->token);
-}
-
-
-void *custom_get_token(int index)
-{
- struct custom_info *token = sndti_token(SOUND_CUSTOM, index);
- return token->token;
-}
-
-
-
-/**************************************************************************
- * Generic get_info
- **************************************************************************/
-
-static SND_SET_INFO( custom )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( custom )
-{
- switch (state)
- {
- /* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct custom_info); break;
-
- /* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( custom ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( custom ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( custom ); break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( custom ); break;
-
- /* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "Custom"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "None"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
- }
-}
-
diff --git a/src/emu/sound/custom.h b/src/emu/sound/custom.h
deleted file mode 100644
index 78dcacf553f..00000000000
--- a/src/emu/sound/custom.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#pragma once
-
-#ifndef __CUSTOM_H__
-#define __CUSTOM_H__
-
-typedef struct _custom_sound_interface custom_sound_interface;
-struct _custom_sound_interface
-{
- void *(*start)(const device_config *device, int clock, const custom_sound_interface *config);
- void (*stop)(const device_config *device, void *token);
- void (*reset)(const device_config *device, void *token);
- void *extra_data;
-};
-
-void *custom_get_token(int index);
-
-#define CUSTOM_START(name) void *name(const device_config *device, int clock, const custom_sound_interface *config)
-#define CUSTOM_STOP(name) void name(const device_config *device, void *token)
-#define CUSTOM_RESET(name) void name(const device_config *device, void *token)
-
-SND_GET_INFO( custom );
-#define SOUND_CUSTOM SND_GET_INFO_NAME( custom )
-
-#endif /* __CUSTOM_H__ */
diff --git a/src/emu/sound/dac.c b/src/emu/sound/dac.c
index 2c1509a6b96..5992861adf9 100644
--- a/src/emu/sound/dac.c
+++ b/src/emu/sound/dac.c
@@ -8,7 +8,8 @@
#define DEFAULT_SAMPLE_RATE (48000 * 4)
-struct dac_info
+typedef struct _dac_state dac_state;
+struct _dac_state
{
sound_stream *channel;
INT16 output;
@@ -17,10 +18,19 @@ struct dac_info
};
+INLINE dac_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_DAC);
+ return (dac_state *)device->token;
+}
+
static STREAM_UPDATE( DAC_update )
{
- struct dac_info *info = param;
+ dac_state *info = param;
stream_sample_t *buffer = outputs[0];
INT16 out = info->output;
@@ -28,9 +38,9 @@ static STREAM_UPDATE( DAC_update )
}
-void dac_data_w(int num,UINT8 data)
+void dac_data_w(const device_config *device, UINT8 data)
{
- struct dac_info *info = sndti_token(SOUND_DAC, num);
+ dac_state *info = get_safe_token(device);
INT16 out = info->UnsignedVolTable[data];
if (info->output != out)
@@ -42,9 +52,9 @@ void dac_data_w(int num,UINT8 data)
}
-void dac_signed_data_w(int num,UINT8 data)
+void dac_signed_data_w(const device_config *device, UINT8 data)
{
- struct dac_info *info = sndti_token(SOUND_DAC, num);
+ dac_state *info = get_safe_token(device);
INT16 out = info->SignedVolTable[data];
if (info->output != out)
@@ -56,9 +66,9 @@ void dac_signed_data_w(int num,UINT8 data)
}
-void dac_data_16_w(int num,UINT16 data)
+void dac_data_16_w(const device_config *device, UINT16 data)
{
- struct dac_info *info = sndti_token(SOUND_DAC, num);
+ dac_state *info = get_safe_token(device);
INT16 out = data >> 1; /* range 0..32767 */
if (info->output != out)
@@ -70,9 +80,9 @@ void dac_data_16_w(int num,UINT16 data)
}
-void dac_signed_data_16_w(int num,UINT16 data)
+void dac_signed_data_16_w(const device_config *device, UINT16 data)
{
- struct dac_info *info = sndti_token(SOUND_DAC, num);
+ dac_state *info = get_safe_token(device);
INT16 out = (INT32)data - (INT32)0x08000; /* range -32768..32767 */
/* casts avoid potential overflow on some ABIs */
@@ -85,11 +95,10 @@ void dac_signed_data_16_w(int num,UINT16 data)
}
-static void DAC_build_voltable(struct dac_info *info)
+static void DAC_build_voltable(dac_state *info)
{
int i;
-
/* build volume table (linear) */
for (i = 0;i < 256;i++)
{
@@ -99,13 +108,13 @@ static void DAC_build_voltable(struct dac_info *info)
}
-static SND_START( dac )
+static DEVICE_START( dac )
{
- struct dac_info *info = device->token;
+ dac_state *info = get_safe_token(device);
DAC_build_voltable(info);
- info->channel = stream_create(device,0,1,clock ? clock : DEFAULT_SAMPLE_RATE,info,DAC_update);
+ info->channel = stream_create(device,0,1,device->clock ? device->clock : DEFAULT_SAMPLE_RATE,info,DAC_update);
info->output = 0;
state_save_register_device_item(device, 0, info->output);
@@ -113,71 +122,39 @@ static SND_START( dac )
-WRITE8_HANDLER( dac_0_data_w )
+WRITE8_DEVICE_HANDLER( dac_w )
{
- dac_data_w(0,data);
+ dac_data_w(device, data);
}
-WRITE8_HANDLER( dac_1_data_w )
+WRITE8_DEVICE_HANDLER( dac_signed_w )
{
- dac_data_w(1,data);
+ dac_signed_data_w(device, data);
}
-WRITE8_HANDLER( dac_2_data_w )
-{
- dac_data_w(2,data);
-}
-
-WRITE8_HANDLER( dac_0_signed_data_w )
-{
- dac_signed_data_w(0,data);
-}
-
-WRITE8_HANDLER( dac_1_signed_data_w )
-{
- dac_signed_data_w(1,data);
-}
-
-WRITE8_HANDLER( dac_2_signed_data_w )
-{
- dac_signed_data_w(2,data);
-}
-
-
/**************************************************************************
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( dac )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( dac )
+DEVICE_GET_INFO( dac )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct dac_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(dac_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( dac ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( dac ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: /* nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( dac ); break;
+ case DEVINFO_FCT_STOP: /* nothing */ break;
+ case DEVINFO_FCT_RESET: /* nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "DAC"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "DAC"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "DAC"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "DAC"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
-
diff --git a/src/emu/sound/dac.h b/src/emu/sound/dac.h
index 75577e98205..23e31e308e7 100644
--- a/src/emu/sound/dac.h
+++ b/src/emu/sound/dac.h
@@ -3,19 +3,15 @@
#ifndef __DAC_H__
#define __DAC_H__
-void dac_data_w(int num,UINT8 data);
-void dac_signed_data_w(int num,UINT8 data);
-void dac_data_16_w(int num,UINT16 data);
-void dac_signed_data_16_w(int num,UINT16 data);
+void dac_data_w(const device_config *device, UINT8 data);
+void dac_signed_data_w(const device_config *device, UINT8 data);
+void dac_data_16_w(const device_config *device, UINT16 data);
+void dac_signed_data_16_w(const device_config *device, UINT16 data);
-WRITE8_HANDLER( dac_0_data_w );
-WRITE8_HANDLER( dac_1_data_w );
-WRITE8_HANDLER( dac_2_data_w );
-WRITE8_HANDLER( dac_0_signed_data_w );
-WRITE8_HANDLER( dac_1_signed_data_w );
-WRITE8_HANDLER( dac_2_signed_data_w );
+WRITE8_DEVICE_HANDLER( dac_w );
+WRITE8_DEVICE_HANDLER( dac_signed_w );
-SND_GET_INFO( dac );
-#define SOUND_DAC SND_GET_INFO_NAME( dac )
+DEVICE_GET_INFO( dac );
+#define SOUND_DAC DEVICE_GET_INFO_NAME( dac )
#endif /* __DAC_H__ */
diff --git a/src/emu/sound/digitalk.c b/src/emu/sound/digitalk.c
index 01879b7a24c..f5b943735da 100644
--- a/src/emu/sound/digitalk.c
+++ b/src/emu/sound/digitalk.c
@@ -285,6 +285,17 @@ static const int pitch_vals[32] = {
61, 60, 58, 56, 55, 53, 52, 50, 49, 48, 46, 45, 43, 42, 41, 40
};
+
+INLINE digitalker *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_DIGITALKER);
+ return (digitalker *)device->token;
+}
+
+
static void digitalker_write(digitalker *dg, UINT8 *adr, UINT8 vol, INT8 dac)
{
INT16 v;
@@ -569,11 +580,6 @@ static STREAM_UPDATE(digitalker_update)
}
}
-static void digitalker_data_w(digitalker *dg, UINT8 data)
-{
- dg->data = data;
-}
-
static void digitalker_cs_w(digitalker *dg, int line)
{
UINT8 cs = line == ASSERT_LINE ? 1 : 0;
@@ -639,12 +645,12 @@ static void digitalker_register_for_save(digitalker *dg)
state_save_register_device_item_array(dg->device, 0, dg->dac);
}
-static SND_START(digitalker)
+static DEVICE_START(digitalker)
{
- digitalker *dg = device->token;
+ digitalker *dg = get_safe_token(device);
dg->device = device;
dg->rom = memory_region(device->machine, device->tag);
- dg->stream = stream_create(device, 0, 1, clock/4, dg, digitalker_update);
+ dg->stream = stream_create(device, 0, 1, device->clock/4, dg, digitalker_update);
dg->dac_index = 128;
dg->data = 0xff;
dg->cs = dg->cms = dg->wr = 1;
@@ -654,53 +660,47 @@ static SND_START(digitalker)
digitalker_register_for_save(dg);
}
-static SND_SET_INFO(digitalker)
-{
- /* no parameters to set */
-}
-
-SND_GET_INFO(digitalker)
+DEVICE_GET_INFO(digitalker)
{
switch(state) {
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(digitalker); break;
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME(digitalker); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME(digitalker); break;
- case SNDINFO_PTR_STOP: break;
- case SNDINFO_PTR_RESET: break;
- case SNDINFO_STR_NAME: strcpy(info->s, "Digitalker"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "National Semiconductor"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Olivier Galibert"); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(digitalker); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(digitalker); break;
+ case DEVINFO_FCT_STOP: break;
+ case DEVINFO_FCT_RESET: break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "Digitalker"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "National Semiconductor"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Olivier Galibert"); break;
}
}
-void digitalker_0_cs_w(int line)
+void digitalker_0_cs_w(const device_config *device, int line)
{
- digitalker *dg = sndti_token(SOUND_DIGITALKER, 0);
+ digitalker *dg = get_safe_token(device);
digitalker_cs_w(dg, line);
}
-void digitalker_0_cms_w(int line)
+void digitalker_0_cms_w(const device_config *device, int line)
{
- digitalker *dg = sndti_token(SOUND_DIGITALKER, 0);
+ digitalker *dg = get_safe_token(device);
digitalker_cms_w(dg, line);
}
-void digitalker_0_wr_w(int line)
+void digitalker_0_wr_w(const device_config *device, int line)
{
- digitalker *dg = sndti_token(SOUND_DIGITALKER, 0);
+ digitalker *dg = get_safe_token(device);
digitalker_wr_w(dg, line);
}
-int digitalker_0_intr_r(void)
+int digitalker_0_intr_r(const device_config *device)
{
- digitalker *dg = sndti_token(SOUND_DIGITALKER, 0);
+ digitalker *dg = get_safe_token(device);
return digitalker_intr_r(dg);
}
-WRITE8_HANDLER(digitalker_0_data_w)
+WRITE8_DEVICE_HANDLER( digitalker_data_w )
{
- digitalker *dg = sndti_token(SOUND_DIGITALKER, 0);
- digitalker_data_w(dg, data);
+ digitalker *dg = get_safe_token(device);
+ dg->data = data;
}
diff --git a/src/emu/sound/digitalk.h b/src/emu/sound/digitalk.h
index 42baa503aea..e933041fbdc 100644
--- a/src/emu/sound/digitalk.h
+++ b/src/emu/sound/digitalk.h
@@ -1,13 +1,13 @@
#ifndef _DIGITALKER_H_
#define _DIGITALKER_H_
-void digitalker_0_cs_w(int line);
-void digitalker_0_cms_w(int line);
-void digitalker_0_wr_w(int line);
-int digitalker_0_intr_r(void);
-WRITE8_HANDLER(digitalker_0_data_w);
+void digitalker_0_cs_w(const device_config *device, int line);
+void digitalker_0_cms_w(const device_config *device, int line);
+void digitalker_0_wr_w(const device_config *device, int line);
+int digitalker_0_intr_r(const device_config *device);
+WRITE8_DEVICE_HANDLER(digitalker_data_w);
-SND_GET_INFO(digitalker);
-#define SOUND_DIGITALKER SND_GET_INFO_NAME(digitalker)
+DEVICE_GET_INFO(digitalker);
+#define SOUND_DIGITALKER DEVICE_GET_INFO_NAME(digitalker)
#endif
diff --git a/src/emu/sound/disc_inp.c b/src/emu/sound/disc_inp.c
index 1ea58bf7a18..18a0be48a11 100644
--- a/src/emu/sound/disc_inp.c
+++ b/src/emu/sound/disc_inp.c
@@ -30,9 +30,18 @@ struct dss_adjustment_context
double scale;
};
-UINT8 discrete_sound_n_r(void *chip, offs_t offset)
+INLINE discrete_info *get_safe_token(const device_config *device)
{
- discrete_info *info = chip;
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_DISCRETE);
+ return (discrete_info *)device->token;
+}
+
+READ8_DEVICE_HANDLER(discrete_sound_r)
+{
+ discrete_info *info = get_safe_token(device);
node_description *node = discrete_find_node(info, offset);
UINT8 data = 0;
@@ -56,29 +65,9 @@ UINT8 discrete_sound_n_r(void *chip, offs_t offset)
return data;
}
-READ8_HANDLER(discrete_sound_r)
-{
- return discrete_sound_n_r(sndti_token(SOUND_DISCRETE, 0), offset);
-}
-
-READ8_HANDLER(discrete_sound_1_r)
-{
- return discrete_sound_n_r(sndti_token(SOUND_DISCRETE, 1), offset);
-}
-
-READ8_HANDLER(discrete_sound_2_r)
+WRITE8_DEVICE_HANDLER(discrete_sound_w)
{
- return discrete_sound_n_r(sndti_token(SOUND_DISCRETE, 2), offset);
-}
-
-READ8_HANDLER(discrete_sound_3_r)
-{
- return discrete_sound_n_r(sndti_token(SOUND_DISCRETE, 3), offset);
-}
-
-void discrete_sound_n_w(void *chip, offs_t offset, UINT8 data)
-{
- discrete_info *info = chip;
+ discrete_info *info = get_safe_token(device);
node_description *node = discrete_find_node(info, offset);
/* Update the node input value if it's a proper input node */
@@ -118,26 +107,6 @@ void discrete_sound_n_w(void *chip, offs_t offset, UINT8 data)
}
}
-WRITE8_HANDLER(discrete_sound_w)
-{
- discrete_sound_n_w(sndti_token(SOUND_DISCRETE, 0), offset, data);
-}
-
-WRITE8_HANDLER(discrete_sound_1_w)
-{
- discrete_sound_n_w(sndti_token(SOUND_DISCRETE, 1), offset, data);
-}
-
-WRITE8_HANDLER(discrete_sound_2_w)
-{
- discrete_sound_n_w(sndti_token(SOUND_DISCRETE, 2), offset, data);
-}
-
-WRITE8_HANDLER(discrete_sound_3_w)
-{
- discrete_sound_n_w(sndti_token(SOUND_DISCRETE, 3), offset, data);
-}
-
/************************************************************************
*
* DSS_ADJUSTMENT - UI Adjustable constant node to emulate trimmers
diff --git a/src/emu/sound/discrete.c b/src/emu/sound/discrete.c
index b20f6f03027..60dd17191f4 100644
--- a/src/emu/sound/discrete.c
+++ b/src/emu/sound/discrete.c
@@ -26,9 +26,9 @@
* Core software takes care of traversing the netlist in the correct
* order
*
- * SND_START(discrete) - Read Node list, initialise & reset
- * SND_STOP(discrete) - Shutdown discrete sound system
- * SND_RESET(discrete) - Put sound system back to time 0
+ * DEVICE_START(discrete) - Read Node list, initialise & reset
+ * DEVICE_STOP(discrete) - Shutdown discrete sound system
+ * DEVICE_RESET(discrete) - Put sound system back to time 0
* discrete_stream_update() - This does the real update to the sim
*
************************************************************************/
@@ -69,7 +69,7 @@ static void init_nodes(discrete_info *info, discrete_sound_block *block_list, co
static void find_input_nodes(discrete_info *info, discrete_sound_block *block_list);
static void setup_output_nodes(const device_config *device, discrete_info *info);
static void setup_disc_logs(discrete_info *info);
-static SND_RESET( discrete );
+static DEVICE_RESET( discrete );
@@ -245,7 +245,7 @@ node_description *discrete_find_node(void *chip, int node)
*
*************************************/
-static SND_START( discrete )
+static DEVICE_START( discrete )
{
discrete_sound_block *intf = (discrete_sound_block *)device->static_config;
discrete_info *info = device->token;
@@ -254,8 +254,8 @@ static SND_START( discrete )
info->device = device;
/* If a clock is specified we will use it, otherwise run at the audio sample rate. */
- if (clock)
- info->sample_rate = clock;
+ if (device->clock)
+ info->sample_rate = device->clock;
else
info->sample_rate = device->machine->sample_rate;
info->sample_time = 1.0 / info->sample_rate;
@@ -325,7 +325,7 @@ static SND_START( discrete )
*
*************************************/
-static SND_STOP( discrete )
+static DEVICE_STOP( discrete )
{
discrete_info *info = device->token;
int log_num;
@@ -385,7 +385,7 @@ static SND_STOP( discrete )
*
*************************************/
-static SND_RESET( discrete )
+static DEVICE_RESET( discrete )
{
discrete_info *info = device->token;
int nodenum;
@@ -737,34 +737,24 @@ static void setup_disc_logs(discrete_info *info)
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( discrete )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( discrete )
+DEVICE_GET_INFO( discrete )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(discrete_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(discrete_info); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( discrete ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( discrete ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( discrete ); break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( discrete ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( discrete ); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( discrete ); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( discrete ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "Discrete"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Analog"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.1"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "Discrete"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Analog"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.1"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/discrete.h b/src/emu/sound/discrete.h
index bc254432e7d..68db0bb2dd8 100644
--- a/src/emu/sound/discrete.h
+++ b/src/emu/sound/discrete.h
@@ -4294,17 +4294,10 @@ node_description *discrete_find_node(void *chip, int node);
void discrete_sound_n_w(void *chip, offs_t offset, UINT8 data);
UINT8 discrete_sound_n_r(void *chip, offs_t offset);
-WRITE8_HANDLER(discrete_sound_w);
-WRITE8_HANDLER(discrete_sound_1_w);
-WRITE8_HANDLER(discrete_sound_2_w);
-WRITE8_HANDLER(discrete_sound_3_w);
-
-READ8_HANDLER(discrete_sound_r);
-READ8_HANDLER(discrete_sound_1_r);
-READ8_HANDLER(discrete_sound_2_r);
-READ8_HANDLER(discrete_sound_3_r);
-
-SND_GET_INFO( discrete );
-#define SOUND_DISCRETE SND_GET_INFO_NAME( discrete )
+WRITE8_DEVICE_HANDLER( discrete_sound_w );
+READ8_DEVICE_HANDLER( discrete_sound_r );
+
+DEVICE_GET_INFO( discrete );
+#define SOUND_DISCRETE DEVICE_GET_INFO_NAME( discrete )
#endif /* __DISCRETE_H__ */
diff --git a/src/emu/sound/dmadac.c b/src/emu/sound/dmadac.c
index ae34b5228c6..33598a73065 100644
--- a/src/emu/sound/dmadac.c
+++ b/src/emu/sound/dmadac.c
@@ -40,7 +40,8 @@
*
*************************************/
-struct dmadac_channel_data
+typedef struct _dmadac_state dmadac_state;
+struct _dmadac_state
{
/* sound stream and buffers */
sound_stream * channel;
@@ -55,6 +56,15 @@ struct dmadac_channel_data
};
+INLINE dmadac_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_DMADAC);
+ return (dmadac_state *)device->token;
+}
+
/*************************************
*
@@ -64,7 +74,7 @@ struct dmadac_channel_data
static STREAM_UPDATE( dmadac_update )
{
- struct dmadac_channel_data *ch = param;
+ dmadac_state *ch = param;
stream_sample_t *output = outputs[0];
INT16 *source = ch->buffer;
UINT32 curout = ch->bufout;
@@ -91,9 +101,9 @@ static STREAM_UPDATE( dmadac_update )
*
*************************************/
-static SND_START( dmadac )
+static DEVICE_START( dmadac )
{
- struct dmadac_channel_data *info = device->token;
+ dmadac_state *info = device->token;
/* allocate a clear a buffer */
info->buffer = auto_malloc(sizeof(info->buffer[0]) * BUFFER_SIZE);
@@ -122,21 +132,21 @@ static SND_START( dmadac )
*
*************************************/
-void dmadac_transfer(UINT8 first_channel, UINT8 num_channels, offs_t channel_spacing, offs_t frame_spacing, offs_t total_frames, INT16 *data)
+void dmadac_transfer(const device_config **devlist, UINT8 num_channels, offs_t channel_spacing, offs_t frame_spacing, offs_t total_frames, INT16 *data)
{
int i, j;
/* flush out as much data as we can */
for (i = 0; i < num_channels; i++)
{
- struct dmadac_channel_data *info = sndti_token(SOUND_DMADAC, first_channel + i);
+ dmadac_state *info = get_safe_token(devlist[i]);
stream_update(info->channel);
}
/* loop over all channels and accumulate the data */
for (i = 0; i < num_channels; i++)
{
- struct dmadac_channel_data *ch = sndti_token(SOUND_DMADAC, first_channel + i);
+ dmadac_state *ch = get_safe_token(devlist[i]);
if (ch->enabled)
{
int maxin = (ch->bufout + BUFFER_SIZE - 1) % BUFFER_SIZE;
@@ -168,14 +178,14 @@ void dmadac_transfer(UINT8 first_channel, UINT8 num_channels, offs_t channel_spa
*
*************************************/
-void dmadac_enable(UINT8 first_channel, UINT8 num_channels, UINT8 enable)
+void dmadac_enable(const device_config **devlist, UINT8 num_channels, UINT8 enable)
{
int i;
/* flush out as much data as we can */
for (i = 0; i < num_channels; i++)
{
- struct dmadac_channel_data *info = sndti_token(SOUND_DMADAC, first_channel + i);
+ dmadac_state *info = get_safe_token(devlist[i]);
stream_update(info->channel);
info->enabled = enable;
if (!enable)
@@ -191,14 +201,14 @@ void dmadac_enable(UINT8 first_channel, UINT8 num_channels, UINT8 enable)
*
*************************************/
-void dmadac_set_frequency(UINT8 first_channel, UINT8 num_channels, double frequency)
+void dmadac_set_frequency(const device_config **devlist, UINT8 num_channels, double frequency)
{
int i;
/* set the sample rate on each channel */
for (i = 0; i < num_channels; i++)
{
- struct dmadac_channel_data *info = sndti_token(SOUND_DMADAC, first_channel + i);
+ dmadac_state *info = get_safe_token(devlist[i]);
stream_set_sample_rate(info->channel, frequency);
}
}
@@ -211,14 +221,14 @@ void dmadac_set_frequency(UINT8 first_channel, UINT8 num_channels, double freque
*
*************************************/
-void dmadac_set_volume(UINT8 first_channel, UINT8 num_channels, UINT16 volume)
+void dmadac_set_volume(const device_config **devlist, UINT8 num_channels, UINT16 volume)
{
int i;
/* flush out as much data as we can */
for (i = 0; i < num_channels; i++)
{
- struct dmadac_channel_data *info = sndti_token(SOUND_DMADAC, first_channel + i);
+ dmadac_state *info = get_safe_token(devlist[i]);
stream_update(info->channel);
info->volume = volume;
}
@@ -230,34 +240,24 @@ void dmadac_set_volume(UINT8 first_channel, UINT8 num_channels, UINT16 volume)
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( dmadac )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( dmadac )
+DEVICE_GET_INFO( dmadac )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct dmadac_channel_data); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(dmadac_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( dmadac ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( dmadac ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: /* nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( dmadac ); break;
+ case DEVINFO_FCT_STOP: /* nothing */ break;
+ case DEVINFO_FCT_RESET: /* nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "DMA-driven DAC"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "DAC"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "DMA-driven DAC"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "DAC"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/dmadac.h b/src/emu/sound/dmadac.h
index 1f0eed3cb78..0f2e8f339be 100644
--- a/src/emu/sound/dmadac.h
+++ b/src/emu/sound/dmadac.h
@@ -10,12 +10,12 @@
#ifndef __DMADAC_H__
#define __DMADAC_H__
-void dmadac_transfer(UINT8 first_channel, UINT8 num_channels, offs_t channel_spacing, offs_t frame_spacing, offs_t total_frames, INT16 *data);
-void dmadac_enable(UINT8 first_channel, UINT8 num_channels, UINT8 enable);
-void dmadac_set_frequency(UINT8 first_channel, UINT8 num_channels, double frequency);
-void dmadac_set_volume(UINT8 first_channel, UINT8 num_channels, UINT16 volume);
+void dmadac_transfer(const device_config **devlist, UINT8 num_channels, offs_t channel_spacing, offs_t frame_spacing, offs_t total_frames, INT16 *data);
+void dmadac_enable(const device_config **devlist, UINT8 num_channels, UINT8 enable);
+void dmadac_set_frequency(const device_config **devlist, UINT8 num_channels, double frequency);
+void dmadac_set_volume(const device_config **devlist, UINT8 num_channels, UINT16 volume);
-SND_GET_INFO( dmadac );
-#define SOUND_DMADAC SND_GET_INFO_NAME( dmadac )
+DEVICE_GET_INFO( dmadac );
+#define SOUND_DMADAC DEVICE_GET_INFO_NAME( dmadac )
#endif /* __DMADAC_H__ */
diff --git a/src/emu/sound/es5503.c b/src/emu/sound/es5503.c
index ead51f6573b..76f31fa54be 100644
--- a/src/emu/sound/es5503.c
+++ b/src/emu/sound/es5503.c
@@ -66,9 +66,9 @@ typedef struct
sound_stream * stream;
- void (*irq_callback)(running_machine *machine, int); // IRQ callback
+ void (*irq_callback)(const device_config *, int); // IRQ callback
- read8_space_func adc_read; // callback for the 5503's built-in analog to digital converter
+ read8_device_func adc_read; // callback for the 5503's built-in analog to digital converter
INT8 oscsenabled; // # of oscillators enabled
@@ -79,6 +79,15 @@ typedef struct
const device_config *device;
} ES5503Chip;
+INLINE ES5503Chip *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_ES5503);
+ return (ES5503Chip *)device->token;
+}
+
static const UINT16 wavesizes[8] = { 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 };
static const UINT32 wavemasks[8] = { 0x1ff00, 0x1fe00, 0x1fc00, 0x1f800, 0x1f000, 0x1e000, 0x1c000, 0x18000 };
static const UINT32 accmasks[8] = { 0xff, 0x1ff, 0x3ff, 0x7ff, 0xfff, 0x1fff, 0x3fff, 0x7fff };
@@ -127,7 +136,7 @@ static void es5503_halt_osc(ES5503Chip *chip, int onum, int type, UINT32 *accumu
if (chip->irq_callback)
{
- chip->irq_callback(chip->device->machine, 1);
+ chip->irq_callback(chip->device, 1);
}
}
}
@@ -223,18 +232,18 @@ static STREAM_UPDATE( es5503_pcm_update )
}
-static SND_START( es5503 )
+static DEVICE_START( es5503 )
{
const es5503_interface *intf;
int osc;
- ES5503Chip *chip = device->token;
+ ES5503Chip *chip = get_safe_token(device);
intf = device->static_config;
chip->irq_callback = intf->irq_callback;
chip->adc_read = intf->adc_read;
chip->docram = intf->wave_memory;
- chip->clock = clock;
+ chip->clock = device->clock;
chip->device = device;
chip->rege0 = 0x80;
@@ -262,15 +271,15 @@ static SND_START( es5503 )
chip->oscsenabled = 1;
- chip->output_rate = (clock/8)/34; // (input clock / 8) / # of oscs. enabled + 2
+ chip->output_rate = (device->clock/8)/34; // (input clock / 8) / # of oscs. enabled + 2
chip->stream = stream_create(device, 0, 2, chip->output_rate, chip, es5503_pcm_update);
}
-READ8_HANDLER(es5503_reg_0_r)
+READ8_DEVICE_HANDLER( es5503_r )
{
UINT8 retval;
int i;
- ES5503Chip *chip = sndti_token(SOUND_ES5503, 0);
+ ES5503Chip *chip = get_safe_token(device);
stream_update(chip->stream);
@@ -332,7 +341,7 @@ READ8_HANDLER(es5503_reg_0_r)
if (chip->irq_callback)
{
- chip->irq_callback(space->machine, 0);
+ chip->irq_callback(chip->device, 0);
}
break;
}
@@ -345,7 +354,7 @@ READ8_HANDLER(es5503_reg_0_r)
{
if (chip->irq_callback)
{
- chip->irq_callback(space->machine, 1);
+ chip->irq_callback(chip->device, 1);
}
break;
}
@@ -359,7 +368,7 @@ READ8_HANDLER(es5503_reg_0_r)
case 0xe2: // A/D converter
if (chip->adc_read)
{
- return chip->adc_read(space, 0);
+ return chip->adc_read(chip->device, 0);
}
break;
}
@@ -368,9 +377,9 @@ READ8_HANDLER(es5503_reg_0_r)
return 0;
}
-WRITE8_HANDLER(es5503_reg_0_w)
+WRITE8_DEVICE_HANDLER( es5503_w )
{
- ES5503Chip *chip = sndti_token(SOUND_ES5503, 0);
+ ES5503Chip *chip = get_safe_token(device);
stream_update(chip->stream);
@@ -491,9 +500,9 @@ WRITE8_HANDLER(es5503_reg_0_w)
}
}
-void es5503_set_base_0(UINT8 *wavemem)
+void es5503_set_base(const device_config *device, UINT8 *wavemem)
{
- ES5503Chip *chip = sndti_token(SOUND_ES5503, 0);
+ ES5503Chip *chip = get_safe_token(device);
chip->docram = wavemem;
}
@@ -502,34 +511,24 @@ void es5503_set_base_0(UINT8 *wavemem)
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( es5503 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( es5503 )
+DEVICE_GET_INFO( es5503 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(ES5503Chip); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(ES5503Chip); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( es5503 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( es5503 ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( es5503 ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "ES5503"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Ensoniq ES550x"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright R. Belmont"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "ES5503"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Ensoniq ES550x"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright R. Belmont"); break;
}
}
diff --git a/src/emu/sound/es5503.h b/src/emu/sound/es5503.h
index d7e6e454f87..de368a7aca1 100644
--- a/src/emu/sound/es5503.h
+++ b/src/emu/sound/es5503.h
@@ -6,16 +6,16 @@
typedef struct _es5503_interface es5503_interface;
struct _es5503_interface
{
- void (*irq_callback)(running_machine *machine, int state);
- read8_space_func adc_read;
+ void (*irq_callback)(const device_config *device, int state);
+ read8_device_func adc_read;
UINT8 *wave_memory;
};
-READ8_HANDLER(es5503_reg_0_r);
-WRITE8_HANDLER(es5503_reg_0_w);
-void es5503_set_base_0(UINT8 *wavemem);
+READ8_DEVICE_HANDLER( es5503_r );
+WRITE8_DEVICE_HANDLER( es5503_w );
+void es5503_set_base(const device_config *device, UINT8 *wavemem);
-SND_GET_INFO( es5503 );
-#define SOUND_ES5503 SND_GET_INFO_NAME( es5503 )
+DEVICE_GET_INFO( es5503 );
+#define SOUND_ES5503 DEVICE_GET_INFO_NAME( es5503 )
#endif /* __ES5503_H__ */
diff --git a/src/emu/sound/es5506.c b/src/emu/sound/es5506.c
index 7b98a846c0a..557ea92df6d 100644
--- a/src/emu/sound/es5506.c
+++ b/src/emu/sound/es5506.c
@@ -66,7 +66,8 @@
***********************************************************************************************/
/* struct describing a single playing voice */
-struct ES5506Voice
+typedef struct _es5506_voice es5506_voice;
+struct _es5506_voice
{
/* external state */
UINT32 control; /* control register */
@@ -97,7 +98,8 @@ struct ES5506Voice
UINT32 accum_mask;
};
-struct ES5506Chip
+typedef struct _es5506_state es5506_state;
+struct _es5506_state
{
sound_stream *stream; /* which stream are we using */
int sample_rate; /* current sample rate */
@@ -105,7 +107,7 @@ struct ES5506Chip
UINT32 write_latch; /* currently accumulated data for write */
UINT32 read_latch; /* currently accumulated data for read */
UINT32 master_clock; /* master clock frequency */
- void (*irq_callback)(running_machine *, int); /* IRQ callback */
+ void (*irq_callback)(const device_config *, int); /* IRQ callback */
UINT16 (*port_read)(void); /* input port read */
UINT8 current_page; /* current register page */
@@ -116,7 +118,7 @@ struct ES5506Chip
UINT8 lrend; /* LR_END register */
UINT8 irqv; /* IRQV register */
- struct ES5506Voice voice[32]; /* the 32 voices */
+ es5506_voice voice[32]; /* the 32 voices */
INT32 * scratch;
@@ -130,6 +132,16 @@ struct ES5506Chip
};
+INLINE es5506_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_ES5505 || sound_get_type(device) == SOUND_ES5506);
+ return (es5506_state *)device->token;
+}
+
+
/**********************************************************************************************
@@ -147,14 +159,14 @@ static FILE *eslog;
***********************************************************************************************/
-static void update_irq_state(struct ES5506Chip *chip)
+static void update_irq_state(es5506_state *chip)
{
/* ES5505/6 irq line has been set high - inform the host */
if (chip->irq_callback)
- (*chip->irq_callback)(chip->device->machine, 1); /* IRQB set high */
+ (*chip->irq_callback)(chip->device, 1); /* IRQB set high */
}
-static void update_internal_irq_state(struct ES5506Chip *chip)
+static void update_internal_irq_state(es5506_state *chip)
{
/* Host (cpu) has just read the voice interrupt vector (voice IRQ ack).
@@ -168,7 +180,7 @@ static void update_internal_irq_state(struct ES5506Chip *chip)
chip->irqv=0x80;
if (chip->irq_callback)
- (*chip->irq_callback)(chip->device->machine, 0); /* IRQB set low */
+ (*chip->irq_callback)(chip->device, 0); /* IRQB set low */
}
/**********************************************************************************************
@@ -177,7 +189,7 @@ static void update_internal_irq_state(struct ES5506Chip *chip)
***********************************************************************************************/
-static void compute_tables(struct ES5506Chip *chip)
+static void compute_tables(es5506_state *chip)
{
int i;
@@ -441,7 +453,7 @@ do \
***********************************************************************************************/
-static void generate_dummy(struct ES5506Chip *chip, struct ES5506Voice *voice, UINT16 *base, INT32 *lbuffer, INT32 *rbuffer, int samples)
+static void generate_dummy(es5506_state *chip, es5506_voice *voice, UINT16 *base, INT32 *lbuffer, INT32 *rbuffer, int samples)
{
UINT32 freqcount = voice->freqcount;
UINT32 accum = voice->accum & voice->accum_mask;
@@ -502,7 +514,7 @@ alldone:
***********************************************************************************************/
-static void generate_ulaw(struct ES5506Chip *chip, struct ES5506Voice *voice, UINT16 *base, INT32 *lbuffer, INT32 *rbuffer, int samples)
+static void generate_ulaw(es5506_state *chip, es5506_voice *voice, UINT16 *base, INT32 *lbuffer, INT32 *rbuffer, int samples)
{
UINT32 freqcount = voice->freqcount;
UINT32 accum = voice->accum & voice->accum_mask;
@@ -608,7 +620,7 @@ alldone:
***********************************************************************************************/
-static void generate_pcm(struct ES5506Chip *chip, struct ES5506Voice *voice, UINT16 *base, INT32 *lbuffer, INT32 *rbuffer, int samples)
+static void generate_pcm(es5506_state *chip, es5506_voice *voice, UINT16 *base, INT32 *lbuffer, INT32 *rbuffer, int samples)
{
UINT32 freqcount = voice->freqcount;
UINT32 accum = voice->accum & voice->accum_mask;
@@ -706,7 +718,7 @@ alldone:
***********************************************************************************************/
-static void generate_samples(struct ES5506Chip *chip, INT32 *left, INT32 *right, int samples)
+static void generate_samples(es5506_state *chip, INT32 *left, INT32 *right, int samples)
{
int v;
@@ -721,7 +733,7 @@ static void generate_samples(struct ES5506Chip *chip, INT32 *left, INT32 *right,
/* loop over voices */
for (v = 0; v <= chip->active_voices; v++)
{
- struct ES5506Voice *voice = &chip->voice[v];
+ es5506_voice *voice = &chip->voice[v];
UINT16 *base = chip->region_base[voice->control >> 14];
/* special case: if end == start, stop the voice */
@@ -769,7 +781,7 @@ logerror("IRQ raised on voice %d!!\n",v);
static STREAM_UPDATE( es5506_update )
{
- struct ES5506Chip *chip = param;
+ es5506_state *chip = param;
INT32 *lsrc = chip->scratch, *rsrc = chip->scratch;
stream_sample_t *ldest = outputs[0];
stream_sample_t *rdest = outputs[1];
@@ -815,14 +827,14 @@ static STREAM_UPDATE( es5506_update )
/**********************************************************************************************
- SND_START( es5506 ) -- start emulation of the ES5506
+ DEVICE_START( es5506 ) -- start emulation of the ES5506
***********************************************************************************************/
-static void es5506_start_common(const device_config *device, int clock, const void *config, sound_type sndtype)
+static void es5506_start_common(const device_config *device, const void *config, sound_type sndtype)
{
const es5506_interface *intf = config;
- struct ES5506Chip *chip = device->token;
+ es5506_state *chip = get_safe_token(device);
int j;
UINT32 accum_mask;
@@ -834,7 +846,7 @@ static void es5506_start_common(const device_config *device, int clock, const vo
compute_tables(chip);
/* create the stream */
- chip->stream = stream_create(device, 0, 2, clock / (16*32), chip, es5506_update);
+ chip->stream = stream_create(device, 0, 2, device->clock / (16*32), chip, es5506_update);
/* initialize the regions */
chip->region_base[0] = intf->region0 ? (UINT16 *)memory_region(device->machine, intf->region0) : NULL;
@@ -844,7 +856,7 @@ static void es5506_start_common(const device_config *device, int clock, const vo
/* initialize the rest of the structure */
chip->device = device;
- chip->master_clock = clock;
+ chip->master_clock = device->clock;
chip->irq_callback = intf->irq_callback;
chip->irqv = 0x80;
@@ -867,20 +879,20 @@ static void es5506_start_common(const device_config *device, int clock, const vo
}
-static SND_START( es5506 )
+static DEVICE_START( es5506 )
{
- es5506_start_common(device, clock, device->static_config, SOUND_ES5506);
+ es5506_start_common(device, device->static_config, SOUND_ES5506);
}
/**********************************************************************************************
- SND_STOP( es5506 ) -- stop emulation of the ES5506
+ DEVICE_STOP( es5506 ) -- stop emulation of the ES5506
***********************************************************************************************/
-static SND_STOP( es5506 )
+static DEVICE_STOP( es5506 )
{
/* debugging */
if (LOG_COMMANDS && eslog)
@@ -903,7 +915,7 @@ static SND_STOP( es5506 )
}
-static SND_RESET( es5506 )
+static DEVICE_RESET( es5506 )
{
}
@@ -915,7 +927,7 @@ static SND_RESET( es5506 )
***********************************************************************************************/
-INLINE void es5506_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *voice, offs_t offset, UINT32 data)
+INLINE void es5506_reg_write_low(es5506_state *chip, es5506_voice *voice, offs_t offset, UINT32 data)
{
switch (offset)
{
@@ -1012,7 +1024,7 @@ INLINE void es5506_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo
}
-INLINE void es5506_reg_write_high(struct ES5506Chip *chip, struct ES5506Voice *voice, offs_t offset, UINT32 data)
+INLINE void es5506_reg_write_high(es5506_state *chip, es5506_voice *voice, offs_t offset, UINT32 data)
{
switch (offset)
{
@@ -1098,7 +1110,7 @@ INLINE void es5506_reg_write_high(struct ES5506Chip *chip, struct ES5506Voice *v
}
}
-INLINE void es5506_reg_write_test(struct ES5506Chip *chip, struct ES5506Voice *voice, offs_t offset, UINT32 data)
+INLINE void es5506_reg_write_test(es5506_state *chip, es5506_voice *voice, offs_t offset, UINT32 data)
{
switch (offset)
{
@@ -1177,9 +1189,10 @@ INLINE void es5506_reg_write_test(struct ES5506Chip *chip, struct ES5506Voice *v
}
}
-static void es5506_reg_write(struct ES5506Chip *chip, offs_t offset, UINT8 data)
+WRITE8_DEVICE_HANDLER( es5506_w )
{
- struct ES5506Voice *voice = &chip->voice[chip->current_page & 0x1f];
+ es5506_state *chip = get_safe_token(device);
+ es5506_voice *voice = &chip->voice[chip->current_page & 0x1f];
int shift = 8 * (offset & 3);
/* accumulate the data */
@@ -1212,7 +1225,7 @@ static void es5506_reg_write(struct ES5506Chip *chip, offs_t offset, UINT8 data)
***********************************************************************************************/
-INLINE UINT32 es5506_reg_read_low(struct ES5506Chip *chip, struct ES5506Voice *voice, offs_t offset)
+INLINE UINT32 es5506_reg_read_low(es5506_state *chip, es5506_voice *voice, offs_t offset)
{
UINT32 result = 0;
@@ -1288,7 +1301,7 @@ INLINE UINT32 es5506_reg_read_low(struct ES5506Chip *chip, struct ES5506Voice *v
}
-INLINE UINT32 es5506_reg_read_high(struct ES5506Chip *chip, struct ES5506Voice *voice, offs_t offset)
+INLINE UINT32 es5506_reg_read_high(es5506_state *chip, es5506_voice *voice, offs_t offset)
{
UINT32 result = 0;
@@ -1363,7 +1376,7 @@ INLINE UINT32 es5506_reg_read_high(struct ES5506Chip *chip, struct ES5506Voice *
return result;
}
-INLINE UINT32 es5506_reg_read_test(struct ES5506Chip *chip, struct ES5506Voice *voice, offs_t offset)
+INLINE UINT32 es5506_reg_read_test(es5506_state *chip, es5506_voice *voice, offs_t offset)
{
UINT32 result = 0;
@@ -1385,9 +1398,10 @@ INLINE UINT32 es5506_reg_read_test(struct ES5506Chip *chip, struct ES5506Voice *
return result;
}
-static UINT8 es5506_reg_read(struct ES5506Chip *chip, offs_t offset)
+READ8_DEVICE_HANDLER( es5506_r )
{
- struct ES5506Voice *voice = &chip->voice[chip->current_page & 0x1f];
+ es5506_state *chip = get_safe_token(device);
+ es5506_voice *voice = &chip->voice[chip->current_page & 0x1f];
int shift = 8 * (offset & 3);
/* only read on offset 0 */
@@ -1417,84 +1431,20 @@ static UINT8 es5506_reg_read(struct ES5506Chip *chip, offs_t offset)
-/**********************************************************************************************
-
- es5506_data_0_r/es5506_data_1_r -- handle a read from the status register
-
-**********************************************************************************************/
-
-READ8_HANDLER( es5506_data_0_r )
-{
- return es5506_reg_read(sndti_token(SOUND_ES5506, 0), offset);
-}
-
-READ8_HANDLER( es5506_data_1_r )
-{
- return es5506_reg_read(sndti_token(SOUND_ES5506, 1), offset);
-}
-
-READ16_HANDLER( es5506_data_0_word_r )
-{
- return es5506_reg_read(sndti_token(SOUND_ES5506, 0), offset);
-}
-
-READ16_HANDLER( es5506_data_1_word_r )
-{
- return es5506_reg_read(sndti_token(SOUND_ES5506, 1), offset);
-}
-
-
-
-/**********************************************************************************************
-
- es5506_data_0_w/es5506_data_1_w -- handle a write to the current register
-
-***********************************************************************************************/
-
-WRITE8_HANDLER( es5506_data_0_w )
-{
- es5506_reg_write(sndti_token(SOUND_ES5506, 0), offset, data);
-}
-
-WRITE8_HANDLER( es5506_data_1_w )
-{
- es5506_reg_write(sndti_token(SOUND_ES5506, 1), offset, data);
-}
-
-WRITE16_HANDLER( es5506_data_0_word_w )
-{
- if (ACCESSING_BITS_0_7)
- es5506_reg_write(sndti_token(SOUND_ES5506, 0), offset, data);
-}
-
-WRITE16_HANDLER( es5506_data_1_word_w )
-{
- if (ACCESSING_BITS_0_7)
- es5506_reg_write(sndti_token(SOUND_ES5506, 1), offset, data);
-}
-
-
-
-void es5506_voice_bank_0_w(int voice, int bank)
-{
- struct ES5506Chip *chip = sndti_token(SOUND_ES5506, 0);
- chip->voice[voice].exbank=bank;
-}
-
-void es5506_voice_bank_1_w(int voice, int bank)
+void es5506_voice_bank_w(const device_config *device, int voice, int bank)
{
- struct ES5506Chip *chip = sndti_token(SOUND_ES5506, 1);
+ es5506_state *chip = get_safe_token(device);
chip->voice[voice].exbank=bank;
}
/**********************************************************************************************
- SND_START( es5505 ) -- start emulation of the ES5505
+ DEVICE_START( es5505 ) -- start emulation of the ES5505
***********************************************************************************************/
-static SND_START( es5505 )
+static DEVICE_START( es5505 )
{
const es5505_interface *intf = device->static_config;
es5506_interface es5506intf;
@@ -1506,26 +1456,26 @@ static SND_START( es5505 )
es5506intf.irq_callback = intf->irq_callback;
es5506intf.read_port = intf->read_port;
- es5506_start_common(device, clock, &es5506intf, SOUND_ES5505);
+ es5506_start_common(device, &es5506intf, SOUND_ES5505);
}
/**********************************************************************************************
- SND_STOP( es5505 ) -- stop emulation of the ES5505
+ DEVICE_STOP( es5505 ) -- stop emulation of the ES5505
***********************************************************************************************/
-static SND_STOP( es5505 )
+static DEVICE_STOP( es5505 )
{
- SND_STOP_CALL( es5506 );
+ DEVICE_STOP_CALL( es5506 );
}
-static SND_RESET( es5505 )
+static DEVICE_RESET( es5505 )
{
- SND_RESET_CALL( es5506 );
+ DEVICE_RESET_CALL( es5506 );
}
@@ -1536,7 +1486,7 @@ static SND_RESET( es5505 )
***********************************************************************************************/
-INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *voice, offs_t offset, UINT16 data, UINT16 mem_mask)
+INLINE void es5505_reg_write_low(es5506_state *chip, es5506_voice *voice, offs_t offset, UINT16 data, UINT16 mem_mask)
{
running_machine *machine = chip->device->machine;
@@ -1691,7 +1641,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo
}
-INLINE void es5505_reg_write_high(struct ES5506Chip *chip, struct ES5506Voice *voice, offs_t offset, UINT16 data, UINT16 mem_mask)
+INLINE void es5505_reg_write_high(es5506_state *chip, es5506_voice *voice, offs_t offset, UINT16 data, UINT16 mem_mask)
{
running_machine *machine = chip->device->machine;
@@ -1799,7 +1749,7 @@ INLINE void es5505_reg_write_high(struct ES5506Chip *chip, struct ES5506Voice *v
}
-INLINE void es5505_reg_write_test(struct ES5506Chip *chip, struct ES5506Voice *voice, offs_t offset, UINT16 data, UINT16 mem_mask)
+INLINE void es5505_reg_write_test(es5506_state *chip, es5506_voice *voice, offs_t offset, UINT16 data, UINT16 mem_mask)
{
switch (offset)
{
@@ -1843,9 +1793,10 @@ INLINE void es5505_reg_write_test(struct ES5506Chip *chip, struct ES5506Voice *v
}
-static void es5505_reg_write(struct ES5506Chip *chip, offs_t offset, UINT16 data, UINT16 mem_mask)
+WRITE16_DEVICE_HANDLER( es5505_w )
{
- struct ES5506Voice *voice = &chip->voice[chip->current_page & 0x1f];
+ es5506_state *chip = get_safe_token(device);
+ es5506_voice *voice = &chip->voice[chip->current_page & 0x1f];
// logerror("%s:ES5505 write %02x/%02x = %04x & %04x\n", cpuexec_describe_context(machine), chip->current_page, offset, data, mem_mask);
@@ -1869,7 +1820,7 @@ static void es5505_reg_write(struct ES5506Chip *chip, offs_t offset, UINT16 data
***********************************************************************************************/
-INLINE UINT16 es5505_reg_read_low(struct ES5506Chip *chip, struct ES5506Voice *voice, offs_t offset)
+INLINE UINT16 es5505_reg_read_low(es5506_state *chip, es5506_voice *voice, offs_t offset)
{
UINT16 result = 0;
@@ -1947,7 +1898,7 @@ INLINE UINT16 es5505_reg_read_low(struct ES5506Chip *chip, struct ES5506Voice *v
}
-INLINE UINT16 es5505_reg_read_high(struct ES5506Chip *chip, struct ES5506Voice *voice, offs_t offset)
+INLINE UINT16 es5505_reg_read_high(es5506_state *chip, es5506_voice *voice, offs_t offset)
{
UINT16 result = 0;
@@ -2020,7 +1971,7 @@ INLINE UINT16 es5505_reg_read_high(struct ES5506Chip *chip, struct ES5506Voice *
}
-INLINE UINT16 es5505_reg_read_test(struct ES5506Chip *chip, struct ES5506Voice *voice, offs_t offset)
+INLINE UINT16 es5505_reg_read_test(es5506_state *chip, es5506_voice *voice, offs_t offset)
{
UINT16 result = 0;
@@ -2053,9 +2004,10 @@ INLINE UINT16 es5505_reg_read_test(struct ES5506Chip *chip, struct ES5506Voice *
}
-static UINT16 es5505_reg_read(struct ES5506Chip *chip, offs_t offset)
+READ16_DEVICE_HANDLER( es5505_r )
{
- struct ES5506Voice *voice = &chip->voice[chip->current_page & 0x1f];
+ es5506_state *chip = get_safe_token(device);
+ es5506_voice *voice = &chip->voice[chip->current_page & 0x1f];
UINT16 result = 0;
if (LOG_COMMANDS && eslog)
@@ -2081,50 +2033,9 @@ static UINT16 es5505_reg_read(struct ES5506Chip *chip, offs_t offset)
-/**********************************************************************************************
-
- es5505_data_0_r/es5505_data_1_r -- handle a read from the status register
-
-***********************************************************************************************/
-
-READ16_HANDLER( es5505_data_0_r )
-{
- return es5505_reg_read(sndti_token(SOUND_ES5505, 0), offset);
-}
-
-READ16_HANDLER( es5505_data_1_r )
-{
- return es5505_reg_read(sndti_token(SOUND_ES5505, 1), offset);
-}
-
-/**********************************************************************************************
-
- es5505_data_0_w/es5505_data_1_w -- handle a write to the current register
-
-***********************************************************************************************/
-
-WRITE16_HANDLER( es5505_data_0_w )
-{
- es5505_reg_write(sndti_token(SOUND_ES5505, 0), offset, data, mem_mask);
-}
-
-WRITE16_HANDLER( es5505_data_1_w )
-{
- es5505_reg_write(sndti_token(SOUND_ES5505, 1), offset, data, mem_mask);
-}
-
-void es5505_voice_bank_0_w(int voice, int bank)
-{
- struct ES5506Chip *chip = sndti_token(SOUND_ES5505, 0);
-#if RAINE_CHECK
- chip->voice[voice].control = CONTROL_STOPMASK;
-#endif
- chip->voice[voice].exbank=bank;
-}
-
-void es5505_voice_bank_1_w(int voice, int bank)
+void es5505_voice_bank_w(const device_config *device, int voice, int bank)
{
- struct ES5506Chip *chip = sndti_token(SOUND_ES5505, 1);
+ es5506_state *chip = get_safe_token(device);
#if RAINE_CHECK
chip->voice[voice].control = CONTROL_STOPMASK;
#endif
@@ -2138,34 +2049,24 @@ void es5505_voice_bank_1_w(int voice, int bank)
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( es5505 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( es5505 )
+DEVICE_GET_INFO( es5505 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct ES5506Chip); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(es5506_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( es5505 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( es5505 ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( es5505 ); break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( es5505 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( es5505 ); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( es5505 ); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( es5505 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "ES5505"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Ensoniq Wavetable"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "ES5505"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Ensoniq Wavetable"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
@@ -2174,34 +2075,24 @@ SND_GET_INFO( es5505 )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( es5506 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( es5506 )
+DEVICE_GET_INFO( es5506 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct ES5506Chip); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(es5506_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( es5506 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( es5506 ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( es5506 ); break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( es5506 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( es5506 ); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( es5506 ); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( es5506 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "ES5506"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Ensoniq Wavetable"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "ES5506"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Ensoniq Wavetable"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/es5506.h b/src/emu/sound/es5506.h
index 13deb9e827c..d0380c8ee7b 100644
--- a/src/emu/sound/es5506.h
+++ b/src/emu/sound/es5506.h
@@ -15,20 +15,16 @@ struct _es5505_interface
{
const char * region0; /* memory region where the sample ROM lives */
const char * region1; /* memory region where the sample ROM lives */
- void (*irq_callback)(running_machine *machine, int state); /* irq callback */
- UINT16 (*read_port)(void); /* input port read */
+ void (*irq_callback)(const device_config *device, int state); /* irq callback */
+ UINT16 (*read_port)(const device_config *device); /* input port read */
};
-READ16_HANDLER( es5505_data_0_r );
-READ16_HANDLER( es5505_data_1_r );
-WRITE16_HANDLER( es5505_data_0_w );
-WRITE16_HANDLER( es5505_data_1_w );
+READ16_DEVICE_HANDLER( es5505_r );
+WRITE16_DEVICE_HANDLER( es5505_w );
+void es5505_voice_bank_w(const device_config *device, int voice, int bank);
-void es5505_voice_bank_0_w(int voice, int bank);
-void es5505_voice_bank_1_w(int voice, int bank);
-
-SND_GET_INFO( es5505 );
-#define SOUND_ES5505 SND_GET_INFO_NAME( es5505 )
+DEVICE_GET_INFO( es5505 );
+#define SOUND_ES5505 DEVICE_GET_INFO_NAME( es5505 )
typedef struct _es5506_interface es5506_interface;
@@ -38,24 +34,15 @@ struct _es5506_interface
const char * region1; /* memory region where the sample ROM lives */
const char * region2; /* memory region where the sample ROM lives */
const char * region3; /* memory region where the sample ROM lives */
- void (*irq_callback)(running_machine *machine, int state); /* irq callback */
- UINT16 (*read_port)(void); /* input port read */
+ void (*irq_callback)(const device_config *device, int state); /* irq callback */
+ UINT16 (*read_port)(const device_config *device); /* input port read */
};
-READ8_HANDLER( es5506_data_0_r );
-READ8_HANDLER( es5506_data_1_r );
-WRITE8_HANDLER( es5506_data_0_w );
-WRITE8_HANDLER( es5506_data_1_w );
-
-READ16_HANDLER( es5506_data_0_word_r );
-READ16_HANDLER( es5506_data_1_word_r );
-WRITE16_HANDLER( es5506_data_0_word_w );
-WRITE16_HANDLER( es5506_data_1_word_w );
-
-void es5506_voice_bank_0_w(int voice, int bank);
-void es5506_voice_bank_1_w(int voice, int bank);
+READ8_DEVICE_HANDLER( es5506_r );
+WRITE8_DEVICE_HANDLER( es5506_w );
+void es5506_voice_bank_w(const device_config *device, int voice, int bank);
-SND_GET_INFO( es5506 );
-#define SOUND_ES5506 SND_GET_INFO_NAME( es5506 )
+DEVICE_GET_INFO( es5506 );
+#define SOUND_ES5506 DEVICE_GET_INFO_NAME( es5506 )
#endif /* __ES5506_H__ */
diff --git a/src/emu/sound/es8712.c b/src/emu/sound/es8712.c
index 2bb1aa014ee..a21247a1251 100644
--- a/src/emu/sound/es8712.c
+++ b/src/emu/sound/es8712.c
@@ -22,7 +22,8 @@
/* struct describing a playing ADPCM chip */
-struct es8712
+typedef struct _es8712_state es8712_state;
+struct _es8712_state
{
UINT8 playing; /* 1 if we're actively playing */
@@ -49,6 +50,16 @@ static const int index_shift[8] = { -1, -1, -1, -1, 2, 4, 6, 8 };
static int diff_lookup[49*16];
+INLINE es8712_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_ES8712);
+ return (es8712_state *)device->token;
+}
+
+
/**********************************************************************************************
compute_tables -- compute the difference tables
@@ -94,7 +105,7 @@ static void compute_tables(void)
***********************************************************************************************/
-static void generate_adpcm(struct es8712 *chip, stream_sample_t *buffer, int samples)
+static void generate_adpcm(es8712_state *chip, stream_sample_t *buffer, int samples)
{
/* if this chip is active */
if (chip->playing)
@@ -168,7 +179,7 @@ static void generate_adpcm(struct es8712 *chip, stream_sample_t *buffer, int sam
static STREAM_UPDATE( es8712_update )
{
stream_sample_t *buffer = outputs[0];
- struct es8712 *chip = param;
+ es8712_state *chip = param;
/* generate them into our buffer */
generate_adpcm(chip, buffer, samples);
@@ -182,7 +193,7 @@ static STREAM_UPDATE( es8712_update )
***********************************************************************************************/
-static void es8712_state_save_register(struct es8712 *chip, const device_config *device)
+static void es8712_state_save_register(es8712_state *chip, const device_config *device)
{
state_save_register_device_item(device, 0, chip->bank_offset);
@@ -203,13 +214,13 @@ static void es8712_state_save_register(struct es8712 *chip, const device_config
/**********************************************************************************************
- SND_START( es8712 ) -- start emulation of an ES8712 chip
+ DEVICE_START( es8712 ) -- start emulation of an ES8712 chip
***********************************************************************************************/
-static SND_START( es8712 )
+static DEVICE_START( es8712 )
{
- struct es8712 *chip = device->token;
+ es8712_state *chip = device->token;
compute_tables();
@@ -221,7 +232,7 @@ static SND_START( es8712 )
chip->region_base = device->region;
/* generate the name and create the stream */
- chip->stream = stream_create(device, 0, 1, clock, chip, es8712_update);
+ chip->stream = stream_create(device, 0, 1, device->clock, chip, es8712_update);
/* initialize the rest of the structure */
chip->signal = -2;
@@ -233,13 +244,13 @@ static SND_START( es8712 )
/*************************************************************************************
- SND_RESET( es8712 ) -- stop emulation of an ES8712-compatible chip
+ DEVICE_RESET( es8712 ) -- stop emulation of an ES8712-compatible chip
**************************************************************************************/
-static SND_RESET( es8712 )
+static DEVICE_RESET( es8712 )
{
- struct es8712 *chip = device->token;
+ es8712_state *chip = device->token;
if (chip->playing)
{
@@ -257,9 +268,9 @@ static SND_RESET( es8712 )
*****************************************************************************/
-void es8712_set_bank_base(int which, int base)
+void es8712_set_bank_base(const device_config *device, int base)
{
- struct es8712 *chip = sndti_token(SOUND_ES8712, which);
+ es8712_state *chip = device->token;
stream_update(chip->stream);
chip->bank_offset = base;
}
@@ -271,9 +282,9 @@ void es8712_set_bank_base(int which, int base)
*****************************************************************************/
-void es8712_set_frequency(int which, int frequency)
+void es8712_set_frequency(const device_config *device, int frequency)
{
- struct es8712 *chip = sndti_token(SOUND_ES8712, which);
+ es8712_state *chip = device->token;
/* update the stream and set the new base */
stream_update(chip->stream);
@@ -288,9 +299,9 @@ void es8712_set_frequency(int which, int frequency)
***********************************************************************************************/
-void es8712_play(int which)
+void es8712_play(const device_config *device)
{
- struct es8712 *chip = sndti_token(SOUND_ES8712, which);
+ es8712_state *chip = get_safe_token(device);
if (chip->start < chip->end)
@@ -311,7 +322,7 @@ void es8712_play(int which)
/* invalid samples go here */
else
{
- logerror("ES871295:%d requested to play invalid sample range %06x-%06x\n",which,chip->start,chip->end);
+ logerror("ES871295:'%s' requested to play invalid sample range %06x-%06x\n",device->tag,chip->start,chip->end);
if (chip->playing)
{
@@ -348,9 +359,9 @@ void es8712_play(int which)
*
***********************************************************************************************/
-static void ES8712_data_w(int which, int offset, UINT32 data)
+WRITE8_DEVICE_HANDLER( es8712_w )
{
- struct es8712 *chip = sndti_token(SOUND_ES8712, which);
+ es8712_state *chip = get_safe_token(device);
switch (offset)
{
case 00: chip->start &= 0x000fff00;
@@ -366,98 +377,37 @@ static void ES8712_data_w(int which, int offset, UINT32 data)
case 05: chip->end &= 0x0000ffff;
chip->end |= ((data & 0x0f) << 16); break;
case 06:
- es8712_play(which);
+ es8712_play(device);
break;
default: break;
}
chip->start &= 0xfffff; chip->end &= 0xfffff;
}
-WRITE8_HANDLER( es8712_data_0_w )
-{
- ES8712_data_w(0, offset, data);
-}
-
-WRITE8_HANDLER( es8712_data_1_w )
-{
- ES8712_data_w(1, offset, data);
-}
-
-WRITE8_HANDLER( es8712_data_2_w )
-{
- ES8712_data_w(2, offset, data);
-}
-
-WRITE16_HANDLER( es8712_data_0_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- ES8712_data_w(0, offset, data & 0xff);
-}
-
-WRITE16_HANDLER( es8712_data_1_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- ES8712_data_w(1, offset, data & 0xff);
-}
-
-WRITE16_HANDLER( es8712_data_2_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- ES8712_data_w(2, offset, data & 0xff);
-}
-
-WRITE16_HANDLER( es8712_data_0_msb_w )
-{
- if (ACCESSING_BITS_8_15)
- ES8712_data_w(0, offset, data >> 8);
-}
-
-WRITE16_HANDLER( es8712_data_1_msb_w )
-{
- if (ACCESSING_BITS_8_15)
- ES8712_data_w(1, offset, data >> 8);
-}
-
-WRITE16_HANDLER( es8712_data_2_msb_w )
-{
- if (ACCESSING_BITS_8_15)
- ES8712_data_w(2, offset, data >> 8);
-}
-
/**************************************************************************
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( es8712 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( es8712 )
+DEVICE_GET_INFO( es8712 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct es8712); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(es8712_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( es8712 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( es8712 ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( es8712 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( es8712 ); break;
+ case DEVINFO_FCT_STOP: /* nothing */ break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( es8712 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "ES8712"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Excellent Systems ADPCM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "ES8712"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Excellent Systems ADPCM"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/es8712.h b/src/emu/sound/es8712.h
index b61ae742074..5cb33dcb322 100644
--- a/src/emu/sound/es8712.h
+++ b/src/emu/sound/es8712.h
@@ -5,21 +5,13 @@
/* An interface for the ES8712 ADPCM chip */
-void es8712_play(int which);
-void es8712_set_bank_base(int which, int base);
-void es8712_set_frequency(int which, int frequency);
+void es8712_play(const device_config *device);
+void es8712_set_bank_base(const device_config *device, int base);
+void es8712_set_frequency(const device_config *device, int frequency);
-WRITE8_HANDLER( es8712_data_0_w );
-WRITE8_HANDLER( es8712_data_1_w );
-WRITE8_HANDLER( es8712_data_2_w );
-WRITE16_HANDLER( es8712_data_0_lsb_w );
-WRITE16_HANDLER( es8712_data_1_lsb_w );
-WRITE16_HANDLER( es8712_data_2_lsb_w );
-WRITE16_HANDLER( es8712_data_0_msb_w );
-WRITE16_HANDLER( es8712_data_1_msb_w );
-WRITE16_HANDLER( es8712_data_2_msb_w );
+WRITE8_DEVICE_HANDLER( es8712_w );
-SND_GET_INFO( es8712 );
-#define SOUND_ES8712 SND_GET_INFO_NAME( es8712 )
+DEVICE_GET_INFO( es8712 );
+#define SOUND_ES8712 DEVICE_GET_INFO_NAME( es8712 )
#endif /* __ES8712_H__ */
diff --git a/src/emu/sound/flt_rc.c b/src/emu/sound/flt_rc.c
index ed095e742d6..0fb54399802 100644
--- a/src/emu/sound/flt_rc.c
+++ b/src/emu/sound/flt_rc.c
@@ -2,7 +2,8 @@
#include "streams.h"
#include "flt_rc.h"
-struct filter_rc_info
+typedef struct _filter_rc_state filter_rc_state;
+struct _filter_rc_state
{
const device_config *device;
sound_stream * stream;
@@ -11,6 +12,15 @@ struct filter_rc_info
int type;
};
+INLINE filter_rc_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_FILTER_RC);
+ return (filter_rc_state *)device->token;
+}
+
const flt_rc_config flt_rc_ac_default = {FLT_RC_AC, 10000, 0, 0, CAP_U(1)};
@@ -18,7 +28,7 @@ static STREAM_UPDATE( filter_rc_update )
{
stream_sample_t *src = inputs[0];
stream_sample_t *dst = outputs[0];
- struct filter_rc_info *info = param;
+ filter_rc_state *info = param;
int memory = info->memory;
switch (info->type)
@@ -42,7 +52,7 @@ static STREAM_UPDATE( filter_rc_update )
info->memory = memory;
}
-static void set_RC_info(struct filter_rc_info *info, int type, double R1, double R2, double R3, double C)
+static void set_RC_info(filter_rc_state *info, int type, double R1, double R2, double R3, double C)
{
double Req;
@@ -80,9 +90,9 @@ static void set_RC_info(struct filter_rc_info *info, int type, double R1, double
}
-static SND_START( filter_rc )
+static DEVICE_START( filter_rc )
{
- struct filter_rc_info *info = device->token;
+ filter_rc_state *info = get_safe_token(device);
const flt_rc_config *conf = device->static_config;
info->device = device;
@@ -94,12 +104,9 @@ static SND_START( filter_rc )
}
-void filter_rc_set_RC(int num, int type, double R1, double R2, double R3, double C)
+void filter_rc_set_RC(const device_config *device, int type, double R1, double R2, double R3, double C)
{
- struct filter_rc_info *info = sndti_token(SOUND_FILTER_RC, num);
-
- if(!info)
- return;
+ filter_rc_state *info = get_safe_token(device);
stream_update(info->stream);
@@ -111,34 +118,24 @@ void filter_rc_set_RC(int num, int type, double R1, double R2, double R3, double
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( filter_rc )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( filter_rc )
+DEVICE_GET_INFO( filter_rc )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct filter_rc_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(filter_rc_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( filter_rc ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( filter_rc ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( filter_rc ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "RC Filter"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Filters"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "RC Filter"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Filters"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/flt_rc.h b/src/emu/sound/flt_rc.h
index 3bed9401430..06a575464d4 100644
--- a/src/emu/sound/flt_rc.h
+++ b/src/emu/sound/flt_rc.h
@@ -56,9 +56,9 @@ struct _flt_rc_config
extern const flt_rc_config flt_rc_ac_default;
-void filter_rc_set_RC(int num, int type, double R1, double R2, double R3, double C);
+void filter_rc_set_RC(const device_config *device, int type, double R1, double R2, double R3, double C);
-SND_GET_INFO( filter_rc );
-#define SOUND_FILTER_RC SND_GET_INFO_NAME( filter_rc )
+DEVICE_GET_INFO( filter_rc );
+#define SOUND_FILTER_RC DEVICE_GET_INFO_NAME( filter_rc )
#endif /* __FLT_RC_H__ */
diff --git a/src/emu/sound/flt_vol.c b/src/emu/sound/flt_vol.c
index 36fe1c65b29..c69ff8a19c6 100644
--- a/src/emu/sound/flt_vol.c
+++ b/src/emu/sound/flt_vol.c
@@ -3,37 +3,47 @@
#include "flt_vol.h"
-struct filter_volume_info
+typedef struct _filter_volume_state filter_volume_state;
+struct _filter_volume_state
{
sound_stream * stream;
int gain;
};
+INLINE filter_volume_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_FILTER_VOLUME);
+ return (filter_volume_state *)device->token;
+}
+
static STREAM_UPDATE( filter_volume_update )
{
stream_sample_t *src = inputs[0];
stream_sample_t *dst = outputs[0];
- struct filter_volume_info *info = param;
+ filter_volume_state *info = param;
while (samples--)
*dst++ = (*src++ * info->gain) >> 8;
}
-static SND_START( filter_volume )
+static DEVICE_START( filter_volume )
{
- struct filter_volume_info *info = device->token;
+ filter_volume_state *info = get_safe_token(device);
info->gain = 0x100;
info->stream = stream_create(device, 1, 1, device->machine->sample_rate, info, filter_volume_update);
}
-void flt_volume_set_volume(int num, float volume)
+void flt_volume_set_volume(const device_config *device, float volume)
{
- struct filter_volume_info *info = sndti_token(SOUND_FILTER_VOLUME, num);
+ filter_volume_state *info = get_safe_token(device);
info->gain = (int)(volume * 256);
}
@@ -43,34 +53,24 @@ void flt_volume_set_volume(int num, float volume)
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( filter_volume )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( filter_volume )
+DEVICE_GET_INFO( filter_volume )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct filter_volume_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(filter_volume_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( filter_volume ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( filter_volume ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( filter_volume ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "Volume Filter"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Filters"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "Volume Filter"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Filters"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/flt_vol.h b/src/emu/sound/flt_vol.h
index f1b2e8c1bb1..a0de74c4741 100644
--- a/src/emu/sound/flt_vol.h
+++ b/src/emu/sound/flt_vol.h
@@ -3,9 +3,9 @@
#ifndef __FLT_VOL_H__
#define __FLT_VOL_H__
-void flt_volume_set_volume(int num, float volume);
+void flt_volume_set_volume(const device_config *device, float volume);
-SND_GET_INFO( filter_volume );
-#define SOUND_FILTER_VOLUME SND_GET_INFO_NAME( filter_volume )
+DEVICE_GET_INFO( filter_volume );
+#define SOUND_FILTER_VOLUME DEVICE_GET_INFO_NAME( filter_volume )
#endif /* __FLT_VOL_H__ */
diff --git a/src/emu/sound/fm.c b/src/emu/sound/fm.c
index 95b60426bcb..cf51deb3890 100644
--- a/src/emu/sound/fm.c
+++ b/src/emu/sound/fm.c
@@ -2444,7 +2444,6 @@ void * ym2203_init(void *param, const device_config *device, int clock, int rate
F2203->OPN.ST.timer_handler = timer_handler;
F2203->OPN.ST.IRQ_Handler = IRQHandler;
F2203->OPN.ST.SSG = ssg;
- ym2203_reset_chip(F2203);
#ifdef __STATE_H__
YM2203_save_state(F2203, device);
@@ -3688,8 +3687,6 @@ void * ym2608_init(void *param, const device_config *device, int clock, int rate
F2608->pcmbuf = YM2608_ADPCM_ROM;
F2608->pcm_size = 0x2000;
- ym2608_reset_chip(F2608);
-
Init_ADPCMATable();
#ifdef __STATE_H__
@@ -4368,8 +4365,6 @@ void *ym2610_init(void *param, const device_config *device, int clock, int rate,
F2610->deltaT.status_change_which_chip = F2610;
F2610->deltaT.status_change_EOS_bit = 0x80; /* status flag: set bit7 on End Of Sample */
- ym2610_reset_chip(F2610);
-
Init_ADPCMATable();
#ifdef __STATE_H__
YM2610_save_state(F2610, device);
@@ -4822,7 +4817,6 @@ void * ym2612_init(void *param, const device_config *device, int clock, int rate
/* Extend handler */
F2612->OPN.ST.timer_handler = timer_handler;
F2612->OPN.ST.IRQ_Handler = IRQHandler;
- ym2612_reset_chip(F2612);
#ifdef __STATE_H__
YM2612_save_state(F2612, device);
diff --git a/src/emu/sound/gaelco.c b/src/emu/sound/gaelco.c
index ea03c086b2e..8d7ff73e186 100644
--- a/src/emu/sound/gaelco.c
+++ b/src/emu/sound/gaelco.c
@@ -56,7 +56,8 @@ UINT16 *gaelco_sndregs;
static sound_type chip_type;
/* this structure defines a channel */
-struct gaelcosnd_channel
+typedef struct _gaelco_sound_channel gaelco_sound_channel;
+struct _gaelco_sound_channel
{
int active; /* is it playing? */
int loop; /* = 0 no looping, = 1 looping */
@@ -64,12 +65,13 @@ struct gaelcosnd_channel
};
/* this structure defines the Gaelco custom sound chip */
-struct GAELCOSND
+typedef struct _gaelco_sound_state gaelco_sound_state;
+struct _gaelco_sound_state
{
sound_stream *stream; /* our stream */
UINT8 *snd_data; /* PCM data */
int banks[4]; /* start of each ROM bank */
- struct gaelcosnd_channel channel[GAELCO_NUM_CHANNELS]; /* 7 stereo channels */
+ gaelco_sound_channel channel[GAELCO_NUM_CHANNELS]; /* 7 stereo channels */
/* table for converting from 8 to 16 bits with volume control */
INT16 volume_table[VOLUME_LEVELS][256];
@@ -77,6 +79,15 @@ struct GAELCOSND
static void * wavraw; /* raw waveform */
+INLINE gaelco_sound_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_GAELCO_GAE1 || sound_get_type(device) == SOUND_GAELCO_CG1V);
+ return (gaelco_sound_state *)device->token;
+}
+
/*============================================================================
CG-1V/GAE1 Sound Update
@@ -85,7 +96,7 @@ static void * wavraw; /* raw waveform */
static STREAM_UPDATE( gaelco_update )
{
- struct GAELCOSND *info = param;
+ gaelco_sound_state *info = param;
int j, ch;
/* fill all data needed */
@@ -95,7 +106,7 @@ static STREAM_UPDATE( gaelco_update )
/* for each channel */
for (ch = 0; ch < GAELCO_NUM_CHANNELS; ch ++){
int ch_data_l = 0, ch_data_r = 0;
- struct gaelcosnd_channel *channel = &info->channel[ch];
+ gaelco_sound_channel *channel = &info->channel[ch];
/* if the channel is playing */
if (channel->active == 1){
@@ -187,9 +198,9 @@ static STREAM_UPDATE( gaelco_update )
CG-1V/GAE1 Read Handler
============================================================================*/
-READ16_HANDLER( gaelcosnd_r )
+READ16_DEVICE_HANDLER( gaelcosnd_r )
{
- LOG_READ_WRITES(("%06x: (GAE1): read from %04x\n", cpu_get_pc(space->cpu), offset));
+ LOG_READ_WRITES(("%s: (GAE1): read from %04x\n", cpuexec_describe_context(device->machine), offset));
return gaelco_sndregs[offset];
}
@@ -198,12 +209,12 @@ READ16_HANDLER( gaelcosnd_r )
CG-1V/GAE1 Write Handler
============================================================================*/
-WRITE16_HANDLER( gaelcosnd_w )
+WRITE16_DEVICE_HANDLER( gaelcosnd_w )
{
- struct GAELCOSND *info = sndti_token(chip_type, 0);
- struct gaelcosnd_channel *channel = &info->channel[offset >> 3];
+ gaelco_sound_state *info = get_safe_token(device);
+ gaelco_sound_channel *channel = &info->channel[offset >> 3];
- LOG_READ_WRITES(("%06x: (GAE1): write %04x to %04x\n", cpu_get_pc(space->cpu), data, offset));
+ LOG_READ_WRITES(("%s: (GAE1): write %04x to %04x\n", cpuexec_describe_context(device->machine), data, offset));
/* first update the stream to this point in time */
stream_update(info->stream);
@@ -242,14 +253,14 @@ WRITE16_HANDLER( gaelcosnd_w )
CG-1V/GAE1 Init
============================================================================*/
-static void gaelcosnd_start(sound_type sndtype, const device_config *device, int clock)
+static DEVICE_START( gaelco )
{
int j, vol;
const gaelcosnd_interface *intf = device->static_config;
- struct GAELCOSND *info = device->token;
+ gaelco_sound_state *info = get_safe_token(device);
- chip_type = sndtype;
+ chip_type = sound_get_type(device);
/* copy rom banks */
for (j = 0; j < 4; j++){
@@ -271,18 +282,8 @@ static void gaelcosnd_start(sound_type sndtype, const device_config *device, int
wavraw = wav_open("gae1_snd.wav", 8000, 2);
}
-static SND_START( gaelco_gae1 )
-{
- gaelcosnd_start(SOUND_GAELCO_GAE1, device, clock);
-}
-
-static SND_START( gaelco_cg1v )
-{
- gaelcosnd_start(SOUND_GAELCO_CG1V, device, clock);
-}
-
-static SND_STOP( gaelco )
+static DEVICE_STOP( gaelco )
{
if (wavraw)
wav_close(wavraw);
@@ -296,34 +297,24 @@ static SND_STOP( gaelco )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( gaelco_gae1 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( gaelco_gae1 )
+DEVICE_GET_INFO( gaelco_gae1 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct GAELCOSND); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(gaelco_sound_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( gaelco_gae1 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( gaelco_gae1 ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( gaelco ); break;
- case SNDINFO_PTR_RESET: /* nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( gaelco ); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( gaelco ); break;
+ case DEVINFO_FCT_RESET: /* nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "Gaelco GAE1"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Gaelco custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "Gaelco GAE1"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Gaelco custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
@@ -333,34 +324,24 @@ SND_GET_INFO( gaelco_gae1 )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( gaelco_cg1v )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( gaelco_cg1v )
+DEVICE_GET_INFO( gaelco_cg1v )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct GAELCOSND); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(gaelco_sound_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( gaelco_cg1v ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( gaelco_cg1v ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( gaelco ); break;
- case SNDINFO_PTR_RESET: /* nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( gaelco ); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( gaelco ); break;
+ case DEVINFO_FCT_RESET: /* nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "Gaelco CG1V"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Gaelco custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "Gaelco CG1V"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Gaelco custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/gaelco.h b/src/emu/sound/gaelco.h
index 76787b9d909..f6716b0e710 100644
--- a/src/emu/sound/gaelco.h
+++ b/src/emu/sound/gaelco.h
@@ -12,13 +12,13 @@ struct _gaelcosnd_interface
extern UINT16 *gaelco_sndregs;
-WRITE16_HANDLER( gaelcosnd_w );
-READ16_HANDLER( gaelcosnd_r );
+WRITE16_DEVICE_HANDLER( gaelcosnd_w );
+READ16_DEVICE_HANDLER( gaelcosnd_r );
-SND_GET_INFO( gaelco_gae1 );
-SND_GET_INFO( gaelco_cg1v );
+DEVICE_GET_INFO( gaelco_gae1 );
+DEVICE_GET_INFO( gaelco_cg1v );
-#define SOUND_GAELCO_GAE1 SND_GET_INFO_NAME( gaelco_gae1 )
-#define SOUND_GAELCO_CG1V SND_GET_INFO_NAME( gaelco_cg1v )
+#define SOUND_GAELCO_GAE1 DEVICE_GET_INFO_NAME( gaelco_gae1 )
+#define SOUND_GAELCO_CG1V DEVICE_GET_INFO_NAME( gaelco_cg1v )
#endif /* __GALELCO_H__ */
diff --git a/src/emu/sound/hc55516.c b/src/emu/sound/hc55516.c
index 1c8115da886..1872c4b519f 100644
--- a/src/emu/sound/hc55516.c
+++ b/src/emu/sound/hc55516.c
@@ -23,7 +23,8 @@
#define SAMPLE_GAIN 10000.0
-struct hc55516_data
+typedef struct _hc55516_state hc55516_state;
+struct _hc55516_state
{
sound_stream *channel;
int clock; /* 0 = software driven, non-0 = oscillator */
@@ -52,17 +53,28 @@ static STREAM_UPDATE( hc55516_update );
-static void start_common(const device_config *device, int clock,
- UINT8 _shiftreg_mask, int _active_clock_hi)
+INLINE hc55516_state *get_safe_token(const device_config *device)
{
- struct hc55516_data *chip = device->token;
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_HC55516 ||
+ sound_get_type(device) == SOUND_MC3417 ||
+ sound_get_type(device) == SOUND_MC3418);
+ return (hc55516_state *)device->token;
+}
+
+
+static void start_common(const device_config *device, UINT8 _shiftreg_mask, int _active_clock_hi)
+{
+ hc55516_state *chip = get_safe_token(device);
/* compute the fixed charge, decay, and leak time constants */
charge = pow(exp(-1), 1.0 / (FILTER_CHARGE_TC * 16000.0));
decay = pow(exp(-1), 1.0 / (FILTER_DECAY_TC * 16000.0));
leak = pow(exp(-1), 1.0 / (INTEGRATOR_LEAK_TC * 16000.0));
- chip->clock = clock;
+ chip->clock = device->clock;
chip->shiftreg_mask = _shiftreg_mask;
chip->active_clock_hi = _active_clock_hi;
chip->last_clock_state = 0;
@@ -82,53 +94,53 @@ static void start_common(const device_config *device, int clock,
}
-static SND_START( hc55516 )
+static DEVICE_START( hc55516 )
{
- start_common(device, clock, 0x07, TRUE);
+ start_common(device, 0x07, TRUE);
}
-static SND_START( mc3417 )
+static DEVICE_START( mc3417 )
{
- start_common(device, clock, 0x07, FALSE);
+ start_common(device, 0x07, FALSE);
}
-static SND_START( mc3418 )
+static DEVICE_START( mc3418 )
{
- start_common(device, clock, 0x0f, FALSE);
+ start_common(device, 0x0f, FALSE);
}
-static SND_RESET( hc55516 )
+static DEVICE_RESET( hc55516 )
{
- struct hc55516_data *chip = device->token;
+ hc55516_state *chip = get_safe_token(device);
chip->last_clock_state = 0;
}
-INLINE int is_external_osciallator(struct hc55516_data *chip)
+INLINE int is_external_osciallator(hc55516_state *chip)
{
return chip->clock != 0;
}
-INLINE int is_active_clock_transition(struct hc55516_data *chip, int clock_state)
+INLINE int is_active_clock_transition(hc55516_state *chip, int clock_state)
{
return (( chip->active_clock_hi && !chip->last_clock_state && clock_state) ||
(!chip->active_clock_hi && chip->last_clock_state && !clock_state));
}
-INLINE int current_clock_state(struct hc55516_data *chip)
+INLINE int current_clock_state(hc55516_state *chip)
{
return ((UINT64)chip->update_count * chip->clock * 2 / SAMPLE_RATE) & 0x01;
}
-static void process_digit(struct hc55516_data *chip)
+static void process_digit(hc55516_state *chip)
{
double integrator = chip->integrator, temp;
@@ -177,7 +189,7 @@ static void process_digit(struct hc55516_data *chip)
static STREAM_UPDATE( hc55516_update )
{
- struct hc55516_data *chip = param;
+ hc55516_state *chip = param;
stream_sample_t *buffer = outputs[0];
int i;
INT32 sample, slope;
@@ -234,9 +246,9 @@ static STREAM_UPDATE( hc55516_update )
}
-void hc55516_clock_w(int num, int state)
+void hc55516_clock_w(const device_config *device, int state)
{
- struct hc55516_data *chip = sndti_token(SOUND_HC55516, num);
+ hc55516_state *chip = get_safe_token(device);
UINT8 clock_state = state ? TRUE : FALSE;
/* only makes sense for setups with a software driven clock */
@@ -259,9 +271,9 @@ void hc55516_clock_w(int num, int state)
}
-void hc55516_digit_w(int num, int digit)
+void hc55516_digit_w(const device_config *device, int digit)
{
- struct hc55516_data *chip = sndti_token(SOUND_HC55516, num);
+ hc55516_state *chip = get_safe_token(device);
if (is_external_osciallator(chip))
{
@@ -273,29 +285,9 @@ void hc55516_digit_w(int num, int digit)
}
-void hc55516_clock_clear_w(int num)
-{
- hc55516_clock_w(num, 0);
-}
-
-
-void hc55516_clock_set_w(int num)
-{
- hc55516_clock_w(num, 1);
-}
-
-
-void hc55516_digit_clock_clear_w(int num, int digit)
-{
- struct hc55516_data *chip = sndti_token(SOUND_HC55516, num);
- chip->digit = digit & 1;
- hc55516_clock_w(num, 0);
-}
-
-
-int hc55516_clock_state_r(int num)
+int hc55516_clock_state_r(const device_config *device)
{
- struct hc55516_data *chip = sndti_token(SOUND_HC55516, num);
+ hc55516_state *chip = get_safe_token(device);
/* only makes sense for setups with an external oscillator */
assert(is_external_osciallator(chip));
@@ -307,67 +299,50 @@ int hc55516_clock_state_r(int num)
-WRITE8_HANDLER( hc55516_0_digit_w ) { hc55516_digit_w(0, data); }
-WRITE8_HANDLER( hc55516_0_clock_w ) { hc55516_clock_w(0, data); }
-WRITE8_HANDLER( hc55516_0_clock_clear_w ) { hc55516_clock_clear_w(0); }
-WRITE8_HANDLER( hc55516_0_clock_set_w ) { hc55516_clock_set_w(0); }
-WRITE8_HANDLER( hc55516_0_digit_clock_clear_w ) { hc55516_digit_clock_clear_w(0, data); }
-READ8_HANDLER ( hc55516_0_clock_state_r ) { return hc55516_clock_state_r(0); }
-
-WRITE8_HANDLER( hc55516_1_digit_w ) { hc55516_digit_w(1, data); }
-WRITE8_HANDLER( hc55516_1_clock_w ) { hc55516_clock_w(1, data); }
-WRITE8_HANDLER( hc55516_1_clock_clear_w ) { hc55516_clock_clear_w(1); }
-WRITE8_HANDLER( hc55516_1_clock_set_w ) { hc55516_clock_set_w(1); }
-WRITE8_HANDLER( hc55516_1_digit_clock_clear_w ) { hc55516_digit_clock_clear_w(1, data); }
-READ8_HANDLER ( hc55516_1_clock_state_r ) { return hc55516_clock_state_r(1); }
-
-
-
/**************************************************************************
* Generic get_info
**************************************************************************/
-SND_GET_INFO( hc55516 )
+DEVICE_GET_INFO( hc55516 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct hc55516_data); break;
- case SNDINFO_FCT_ALIAS: info->type = SOUND_HC55516; break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(hc55516_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_START: info->start = SND_START_NAME( hc55516 ); break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( hc55516 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( hc55516 ); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( hc55516 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "HC-55516"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "CVSD"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "2.1"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "HC-55516"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "CVSD"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "2.1"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
-SND_GET_INFO( mc3417 )
+DEVICE_GET_INFO( mc3417 )
{
switch (state)
{
- case SNDINFO_PTR_START: info->start = SND_START_NAME( mc3417 ); break;
- case SNDINFO_PTR_RESET: /* chip has no reset pin */ break;
- case SNDINFO_STR_NAME: strcpy(info->s, "MC3417"); break;
- default: SND_GET_INFO_CALL(hc55516); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( mc3417 ); break;
+ case DEVINFO_FCT_RESET: /* chip has no reset pin */ break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "MC3417"); break;
+ default: DEVICE_GET_INFO_CALL(hc55516); break;
}
}
-SND_GET_INFO( mc3418 )
+DEVICE_GET_INFO( mc3418 )
{
switch (state)
{
- case SNDINFO_PTR_START: info->start = SND_START_NAME( mc3418 ); break;
- case SNDINFO_PTR_RESET: /* chip has no reset pin */ break;
- case SNDINFO_STR_NAME: strcpy(info->s, "MC3418"); break;
- default: SND_GET_INFO_CALL(hc55516); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( mc3418 ); break;
+ case DEVINFO_FCT_RESET: /* chip has no reset pin */ break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "MC3418"); break;
+ default: DEVICE_GET_INFO_CALL(hc55516); break;
}
}
diff --git a/src/emu/sound/hc55516.h b/src/emu/sound/hc55516.h
index 634a8c36329..f241e8f49f3 100644
--- a/src/emu/sound/hc55516.h
+++ b/src/emu/sound/hc55516.h
@@ -5,41 +5,20 @@
/* sets the digit (0 or 1) */
-void hc55516_digit_w(int num, int digit);
+void hc55516_digit_w(const device_config *device, int digit);
/* sets the clock state (0 or 1, clocked on the rising edge) */
-void hc55516_clock_w(int num, int state);
+void hc55516_clock_w(const device_config *device, int state);
-/* clears or sets the clock state */
-void hc55516_clock_clear_w(int num);
-void hc55516_clock_set_w(int num);
+/* returns whether the clock is currently LO or HI */
+int hc55516_clock_state_r(const device_config *device);
-/* clears the clock state and sets the digit */
-void hc55516_digit_clock_clear_w(int num, int digit);
+DEVICE_GET_INFO( hc55516 );
+DEVICE_GET_INFO( mc3417 );
+DEVICE_GET_INFO( mc3418 );
-/* returns whether the clock is currently LO or HI */
-int hc55516_clock_state_r(int num);
-
-WRITE8_HANDLER( hc55516_0_digit_w );
-WRITE8_HANDLER( hc55516_0_clock_w );
-WRITE8_HANDLER( hc55516_0_clock_clear_w );
-WRITE8_HANDLER( hc55516_0_clock_set_w );
-WRITE8_HANDLER( hc55516_0_digit_clock_clear_w );
-READ8_HANDLER ( hc55516_0_clock_state_r );
-
-WRITE8_HANDLER( hc55516_1_digit_w );
-WRITE8_HANDLER( hc55516_1_clock_w );
-WRITE8_HANDLER( hc55516_1_clock_clear_w );
-WRITE8_HANDLER( hc55516_1_clock_set_w );
-WRITE8_HANDLER( hc55516_1_digit_clock_clear_w );
-READ8_HANDLER ( hc55516_1_clock_state_r );
-
-SND_GET_INFO( hc55516 );
-SND_GET_INFO( mc3417 );
-SND_GET_INFO( mc3418 );
-
-#define SOUND_HC55516 SND_GET_INFO_NAME( hc55516 )
-#define SOUND_MC3417 SND_GET_INFO_NAME( mc3417 )
-#define SOUND_MC3418 SND_GET_INFO_NAME( mc3418 )
+#define SOUND_HC55516 DEVICE_GET_INFO_NAME( hc55516 )
+#define SOUND_MC3417 DEVICE_GET_INFO_NAME( mc3417 )
+#define SOUND_MC3418 DEVICE_GET_INFO_NAME( mc3418 )
#endif /* __HC55516_H__ */
diff --git a/src/emu/sound/ics2115.c b/src/emu/sound/ics2115.c
index fc562f9d7dc..60bfeadb11f 100644
--- a/src/emu/sound/ics2115.c
+++ b/src/emu/sound/ics2115.c
@@ -41,7 +41,8 @@
enum { V_ON = 1, V_DONE = 2 };
-struct ics2115
+typedef struct _ics2115_state ics2115_state;
+struct _ics2115_state
{
const ics2115_interface *intf;
const device_config *device;
@@ -67,7 +68,16 @@ struct ics2115
sound_stream * stream;
};
-static void recalc_irq(struct ics2115 *chip)
+INLINE ics2115_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_ICS2115);
+ return (ics2115_state *)device->token;
+}
+
+static void recalc_irq(ics2115_state *chip)
{
int i;
int irq = 0;
@@ -79,14 +89,14 @@ static void recalc_irq(struct ics2115 *chip)
if(irq != chip->irq_on) {
chip->irq_on = irq;
if(chip->intf->irq_cb)
- chip->intf->irq_cb(chip->device->machine, irq ? ASSERT_LINE : CLEAR_LINE);
+ chip->intf->irq_cb(chip->device, irq ? ASSERT_LINE : CLEAR_LINE);
}
}
static STREAM_UPDATE( update )
{
- struct ics2115 *chip = param;
+ ics2115_state *chip = param;
int osc, i;
int rec_irq = 0;
@@ -134,7 +144,7 @@ static STREAM_UPDATE( update )
recalc_irq(chip);
}
-static void keyon(struct ics2115 *chip, int osc)
+static void keyon(ics2115_state *chip, int osc)
{
if (ICS2115LOGERROR) logerror("ICS2115: KEYON %2d conf:%02x vctl:%02x a:%07x.%03x l:%05x.%x e:%05x.%x v:%03x f:%d\n",
osc,
@@ -154,19 +164,19 @@ static void keyon(struct ics2115 *chip, int osc)
static TIMER_CALLBACK( timer_cb_0 )
{
- struct ics2115 *chip = ptr;
+ ics2115_state *chip = ptr;
chip->irq_pend |= 1<<0;
recalc_irq(chip);
}
static TIMER_CALLBACK( timer_cb_1 )
{
- struct ics2115 *chip = ptr;
+ ics2115_state *chip = ptr;
chip->irq_pend |= 1<<1;
recalc_irq(chip);
}
-static void recalc_timer(struct ics2115 *chip, int timer)
+static void recalc_timer(ics2115_state *chip, int timer)
{
UINT64 period = 1000000000 * chip->timer[timer].scale*chip->timer[timer].preset / 33868800;
if(period)
@@ -190,7 +200,7 @@ static void recalc_timer(struct ics2115 *chip, int timer)
}
-static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb)
+static void ics2115_reg_w(ics2115_state *chip, UINT8 reg, UINT8 data, int msb)
{
running_machine *machine = chip->device->machine;
@@ -377,7 +387,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb)
}
}
-static UINT16 ics2115_reg_r(struct ics2115 *chip, UINT8 reg)
+static UINT16 ics2115_reg_r(ics2115_state *chip, UINT8 reg)
{
running_machine *machine = chip->device->machine;
@@ -439,9 +449,9 @@ static UINT16 ics2115_reg_r(struct ics2115 *chip, UINT8 reg)
}
-static SND_START( ics2115 )
+static DEVICE_START( ics2115 )
{
- struct ics2115 *chip = device->token;
+ ics2115_state *chip = get_safe_token(device);
int i;
chip->device = device;
@@ -465,9 +475,9 @@ static SND_START( ics2115 )
}
}
-READ8_HANDLER( ics2115_r )
+READ8_DEVICE_HANDLER( ics2115_r )
{
- struct ics2115 *chip = sndti_token(SOUND_ICS2115, 0);
+ ics2115_state *chip = get_safe_token(device);
switch(offset) {
case 0: {
UINT8 res = 0;
@@ -496,9 +506,9 @@ READ8_HANDLER( ics2115_r )
}
}
-WRITE8_HANDLER( ics2115_w )
+WRITE8_DEVICE_HANDLER( ics2115_w )
{
- struct ics2115 *chip = sndti_token(SOUND_ICS2115, 0);
+ ics2115_state *chip = get_safe_token(device);
switch(offset) {
case 1:
chip->reg = data;
@@ -513,9 +523,9 @@ WRITE8_HANDLER( ics2115_w )
// if (ICS2115LOGERROR) logerror("ICS2115: wi %d, %02x\n", cpuexec_describe_context(space->machine), offset, data);
}
-static SND_RESET( ics2115 )
+static DEVICE_RESET( ics2115 )
{
- struct ics2115 *chip = device->token;
+ ics2115_state *chip = get_safe_token(device);
chip->irq_en = 0;
chip->irq_pend = 0;
memset(chip->voice, 0, sizeof(chip->voice));
@@ -533,34 +543,24 @@ static SND_RESET( ics2115 )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( ics2115 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( ics2115 )
+DEVICE_GET_INFO( ics2115 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct ics2115); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(ics2115_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( ics2115 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( ics2115 ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( ics2115 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ics2115 ); break;
+ case DEVINFO_FCT_STOP: /* nothing */ break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( ics2115 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "ICS2115"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "ICS"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.01"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "ICS2115"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "ICS"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.01"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/ics2115.h b/src/emu/sound/ics2115.h
index 544efc13b85..7697bb82f0c 100644
--- a/src/emu/sound/ics2115.h
+++ b/src/emu/sound/ics2115.h
@@ -5,13 +5,13 @@
typedef struct _ics2115_interface ics2115_interface;
struct _ics2115_interface {
- void (*irq_cb)(running_machine *, int);
+ void (*irq_cb)(const device_config *, int);
};
-READ8_HANDLER( ics2115_r );
-WRITE8_HANDLER( ics2115_w );
+READ8_DEVICE_HANDLER( ics2115_r );
+WRITE8_DEVICE_HANDLER( ics2115_w );
-SND_GET_INFO( ics2115 );
-#define SOUND_ICS2115 SND_GET_INFO_NAME( ics2115 )
+DEVICE_GET_INFO( ics2115 );
+#define SOUND_ICS2115 DEVICE_GET_INFO_NAME( ics2115 )
#endif /* __ICS2115_H__ */
diff --git a/src/emu/sound/iremga20.c b/src/emu/sound/iremga20.c
index 0978b4914ad..1a9ab88f96a 100644
--- a/src/emu/sound/iremga20.c
+++ b/src/emu/sound/iremga20.c
@@ -46,7 +46,8 @@ struct IremGA20_channel_def
UINT32 play;
};
-struct IremGA20_chip_def
+typedef struct _ga20_state ga20_state;
+struct _ga20_state
{
UINT8 *rom;
INT32 rom_size;
@@ -55,9 +56,20 @@ struct IremGA20_chip_def
struct IremGA20_channel_def channel[4];
};
+
+INLINE ga20_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_IREMGA20);
+ return (ga20_state *)device->token;
+}
+
+
static STREAM_UPDATE( IremGA20_update )
{
- struct IremGA20_chip_def *chip = param;
+ ga20_state *chip = param;
UINT32 rate[4], pos[4], frac[4], end[4], vol[4], play[4];
UINT8 *pSamples;
stream_sample_t *outL, *outR;
@@ -131,15 +143,11 @@ static STREAM_UPDATE( IremGA20_update )
}
}
-WRITE16_HANDLER( irem_ga20_w )
+WRITE8_DEVICE_HANDLER( irem_ga20_w )
{
- struct IremGA20_chip_def *chip = sndti_token(SOUND_IREMGA20, 0);
+ ga20_state *chip = get_safe_token(device);
int channel;
- /* only low byte hooked up? */
- if (!ACCESSING_BITS_0_7)
- return;
-
//logerror("GA20: Offset %02x, data %04x\n",offset,data);
stream_update(chip->stream);
@@ -182,9 +190,9 @@ WRITE16_HANDLER( irem_ga20_w )
}
}
-READ16_HANDLER( irem_ga20_r )
+READ8_DEVICE_HANDLER( irem_ga20_r )
{
- struct IremGA20_chip_def *chip = sndti_token(SOUND_IREMGA20, 0);
+ ga20_state *chip = get_safe_token(device);
int channel;
stream_update(chip->stream);
@@ -204,7 +212,7 @@ READ16_HANDLER( irem_ga20_r )
return 0;
}
-static void iremga20_reset(struct IremGA20_chip_def *chip)
+static void iremga20_reset(ga20_state *chip)
{
int i;
@@ -223,14 +231,14 @@ static void iremga20_reset(struct IremGA20_chip_def *chip)
}
-static SND_RESET( iremga20 )
+static DEVICE_RESET( iremga20 )
{
- iremga20_reset(device->token);
+ iremga20_reset(get_safe_token(device));
}
-static SND_START( iremga20 )
+static DEVICE_START( iremga20 )
{
- struct IremGA20_chip_def *chip = device->token;
+ ga20_state *chip = get_safe_token(device);
int i;
/* Initialize our chip structure */
@@ -242,7 +250,7 @@ static SND_START( iremga20 )
for ( i = 0; i < 0x40; i++ )
chip->regs[i] = 0;
- chip->stream = stream_create( device, 0, 2, clock/4, chip, IremGA20_update );
+ chip->stream = stream_create( device, 0, 2, device->clock/4, chip, IremGA20_update );
state_save_register_device_item_array(device, 0, chip->regs);
for (i = 0; i < 4; i++)
@@ -266,34 +274,24 @@ static SND_START( iremga20 )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( iremga20 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( iremga20 )
+DEVICE_GET_INFO( iremga20 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct IremGA20_chip_def); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(ga20_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( iremga20 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( iremga20 ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( iremga20 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( iremga20 ); break;
+ case DEVINFO_FCT_STOP: /* nothing */ break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( iremga20 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "Irem GA20"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Irem custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "Irem GA20"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Irem custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/iremga20.h b/src/emu/sound/iremga20.h
index 352864f4e7e..f5fffa85c01 100644
--- a/src/emu/sound/iremga20.h
+++ b/src/emu/sound/iremga20.h
@@ -8,10 +8,10 @@
#ifndef __IREMGA20_H__
#define __IREMGA20_H__
-WRITE16_HANDLER( irem_ga20_w );
-READ16_HANDLER( irem_ga20_r );
+WRITE8_DEVICE_HANDLER( irem_ga20_w );
+READ8_DEVICE_HANDLER( irem_ga20_r );
-SND_GET_INFO( iremga20 );
-#define SOUND_IREMGA20 SND_GET_INFO_NAME( iremga20 )
+DEVICE_GET_INFO( iremga20 );
+#define SOUND_IREMGA20 DEVICE_GET_INFO_NAME( iremga20 )
#endif /* __IREMGA20_H__ */
diff --git a/src/emu/sound/k005289.c b/src/emu/sound/k005289.c
index 94499d9e42f..0585dae1dcc 100644
--- a/src/emu/sound/k005289.c
+++ b/src/emu/sound/k005289.c
@@ -40,7 +40,8 @@ typedef struct
const unsigned char *wave;
} k005289_sound_channel;
-struct k005289_info
+typedef struct _k005289_state k005289_state;
+struct _k005289_state
{
k005289_sound_channel channel_list[2];
@@ -60,8 +61,17 @@ struct k005289_info
int k005289_A_latch,k005289_B_latch;
};
+INLINE k005289_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_K005289);
+ return (k005289_state *)device->token;
+}
+
/* build a table to divide by the number of voices */
-static void make_mixer_table(struct k005289_info *info, int voices)
+static void make_mixer_table(k005289_state *info, int voices)
{
int count = voices * 128;
int i;
@@ -87,7 +97,7 @@ static void make_mixer_table(struct k005289_info *info, int voices)
/* generate sound to the mix buffer */
static STREAM_UPDATE( K005289_update )
{
- struct k005289_info *info = param;
+ k005289_state *info = param;
k005289_sound_channel *voice=info->channel_list;
stream_sample_t *buffer = outputs[0];
short *mix;
@@ -148,17 +158,17 @@ static STREAM_UPDATE( K005289_update )
*buffer++ = info->mixer_lookup[*mix++];
}
-static SND_START( k005289 )
+static DEVICE_START( k005289 )
{
k005289_sound_channel *voice;
- struct k005289_info *info = device->token;
+ k005289_state *info = get_safe_token(device);
voice = info->channel_list;
/* get stream channels */
- info->rate = clock/16;
+ info->rate = device->clock/16;
info->stream = stream_create(device, 0, 1, info->rate, info, K005289_update);
- info->mclock = clock;
+ info->mclock = device->clock;
/* allocate a pair of buffers to mix into - 1 second's worth should be more than enough */
info->mixer_buffer = auto_malloc(2 * sizeof(short) * info->rate);
@@ -182,7 +192,7 @@ static SND_START( k005289 )
/********************************************************************************/
-static void k005289_recompute(struct k005289_info *info)
+static void k005289_recompute(k005289_state *info)
{
k005289_sound_channel *voice = info->channel_list;
@@ -196,44 +206,44 @@ static void k005289_recompute(struct k005289_info *info)
voice[1].wave = &info->sound_prom[32 * info->k005289_B_waveform + 0x100];
}
-WRITE8_HANDLER( k005289_control_A_w )
+WRITE8_DEVICE_HANDLER( k005289_control_A_w )
{
- struct k005289_info *info = sndti_token(SOUND_K005289, 0);
+ k005289_state *info = get_safe_token(device);
info->k005289_A_volume=data&0xf;
info->k005289_A_waveform=data>>5;
k005289_recompute(info);
}
-WRITE8_HANDLER( k005289_control_B_w )
+WRITE8_DEVICE_HANDLER( k005289_control_B_w )
{
- struct k005289_info *info = sndti_token(SOUND_K005289, 0);
+ k005289_state *info = get_safe_token(device);
info->k005289_B_volume=data&0xf;
info->k005289_B_waveform=data>>5;
k005289_recompute(info);
}
-WRITE8_HANDLER( k005289_pitch_A_w )
+WRITE8_DEVICE_HANDLER( k005289_pitch_A_w )
{
- struct k005289_info *info = sndti_token(SOUND_K005289, 0);
+ k005289_state *info = get_safe_token(device);
info->k005289_A_latch = 0x1000 - offset;
}
-WRITE8_HANDLER( k005289_pitch_B_w )
+WRITE8_DEVICE_HANDLER( k005289_pitch_B_w )
{
- struct k005289_info *info = sndti_token(SOUND_K005289, 0);
+ k005289_state *info = get_safe_token(device);
info->k005289_B_latch = 0x1000 - offset;
}
-WRITE8_HANDLER( k005289_keylatch_A_w )
+WRITE8_DEVICE_HANDLER( k005289_keylatch_A_w )
{
- struct k005289_info *info = sndti_token(SOUND_K005289, 0);
+ k005289_state *info = get_safe_token(device);
info->k005289_A_frequency = info->k005289_A_latch;
k005289_recompute(info);
}
-WRITE8_HANDLER( k005289_keylatch_B_w )
+WRITE8_DEVICE_HANDLER( k005289_keylatch_B_w )
{
- struct k005289_info *info = sndti_token(SOUND_K005289, 0);
+ k005289_state *info = get_safe_token(device);
info->k005289_B_frequency = info->k005289_B_latch;
k005289_recompute(info);
}
@@ -245,34 +255,24 @@ WRITE8_HANDLER( k005289_keylatch_B_w )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( k005289 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( k005289 )
+DEVICE_GET_INFO( k005289 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct k005289_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(k005289_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( k005289 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( k005289 ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: /* nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( k005289 ); break;
+ case DEVINFO_FCT_STOP: /* nothing */ break;
+ case DEVINFO_FCT_RESET: /* nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "K005289"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Konami custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "K005289"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Konami custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/k005289.h b/src/emu/sound/k005289.h
index 44edd0efd2c..23d49701b07 100644
--- a/src/emu/sound/k005289.h
+++ b/src/emu/sound/k005289.h
@@ -3,14 +3,14 @@
#ifndef __K005289_H__
#define __K005289_H__
-WRITE8_HANDLER( k005289_control_A_w );
-WRITE8_HANDLER( k005289_control_B_w );
-WRITE8_HANDLER( k005289_pitch_A_w );
-WRITE8_HANDLER( k005289_pitch_B_w );
-WRITE8_HANDLER( k005289_keylatch_A_w );
-WRITE8_HANDLER( k005289_keylatch_B_w );
+WRITE8_DEVICE_HANDLER( k005289_control_A_w );
+WRITE8_DEVICE_HANDLER( k005289_control_B_w );
+WRITE8_DEVICE_HANDLER( k005289_pitch_A_w );
+WRITE8_DEVICE_HANDLER( k005289_pitch_B_w );
+WRITE8_DEVICE_HANDLER( k005289_keylatch_A_w );
+WRITE8_DEVICE_HANDLER( k005289_keylatch_B_w );
-SND_GET_INFO( k005289 );
-#define SOUND_K005289 SND_GET_INFO_NAME( k005289 )
+DEVICE_GET_INFO( k005289 );
+#define SOUND_K005289 DEVICE_GET_INFO_NAME( k005289 )
#endif /* __K005289_H__ */
diff --git a/src/emu/sound/k007232.c b/src/emu/sound/k007232.c
index f506d5d9735..2bb71726081 100644
--- a/src/emu/sound/k007232.c
+++ b/src/emu/sound/k007232.c
@@ -56,6 +56,15 @@ typedef struct kdacApcm
#define BASE_SHIFT (12)
+INLINE KDAC_A_PCM *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_K007232);
+ return (KDAC_A_PCM *)device->token;
+}
+
#if 0
static const int kdac_note[] = {
@@ -169,7 +178,7 @@ static const float kdaca_fn[][2] = {
#endif
/*************************************************************/
-static void KDAC_A_make_fncode( struct kdacApcm *info ){
+static void KDAC_A_make_fncode( KDAC_A_PCM *info ){
int i;
#if 0
int i, j, k;
@@ -218,7 +227,7 @@ static void KDAC_A_make_fncode( struct kdacApcm *info ){
static STREAM_UPDATE( KDAC_A_update )
{
- struct kdacApcm *info = param;
+ KDAC_A_PCM *info = param;
int i;
memset(outputs[0],0,samples * sizeof(*outputs[0]));
@@ -293,11 +302,11 @@ static STREAM_UPDATE( KDAC_A_update )
/************************************************/
/* Konami PCM start */
/************************************************/
-static SND_START( k007232 )
+static DEVICE_START( k007232 )
{
static const k007232_interface defintrf = { 0 };
int i;
- struct kdacApcm *info = device->token;
+ KDAC_A_PCM *info = get_safe_token(device);
info->intf = (device->static_config != NULL) ? device->static_config : &defintrf;
@@ -307,7 +316,7 @@ static SND_START( k007232 )
info->pcmbuf[1] = device->region;
info->pcmlimit = device->regionbytes;
- info->clock = clock;
+ info->clock = device->clock;
for( i = 0; i < KDAC_A_PCM_MAX; i++ )
{
@@ -323,7 +332,7 @@ static SND_START( k007232 )
for( i = 0; i < 0x10; i++ ) info->wreg[i] = 0;
- info->stream = stream_create(device,0,2,clock/128,info,KDAC_A_update);
+ info->stream = stream_create(device,0,2,device->clock/128,info,KDAC_A_update);
KDAC_A_make_fncode(info);
}
@@ -331,10 +340,11 @@ static SND_START( k007232 )
/************************************************/
/* Konami PCM write register */
/************************************************/
-static void k007232_WriteReg( int r, int v, int chip )
+WRITE8_DEVICE_HANDLER( k007232_w )
{
- struct kdacApcm *info = sndti_token(SOUND_K007232, chip);
- int data;
+ KDAC_A_PCM *info = get_safe_token(device);
+ int r = offset;
+ int v = data;
stream_update(info->stream);
@@ -342,7 +352,7 @@ static void k007232_WriteReg( int r, int v, int chip )
if (r == 0x0c){
/* external port, usually volume control */
- if (info->intf->portwritehandler) (*info->intf->portwritehandler)(v);
+ if (info->intf->portwritehandler) (*info->intf->portwritehandler)(device,v);
return;
}
else if( r == 0x0d ){
@@ -394,9 +404,10 @@ static void k007232_WriteReg( int r, int v, int chip )
/************************************************/
/* Konami PCM read register */
/************************************************/
-static int k007232_ReadReg( int r, int chip )
+READ8_DEVICE_HANDLER( k007232_r )
{
- struct kdacApcm *info = sndti_token(SOUND_K007232, chip);
+ KDAC_A_PCM *info = get_safe_token(device);
+ int r = offset;
int ch = 0;
if( r == 0x0005 || r == 0x000b ){
@@ -419,46 +430,16 @@ static int k007232_ReadReg( int r, int chip )
/*****************************************************************************/
-WRITE8_HANDLER( k007232_write_port_0_w )
-{
- k007232_WriteReg(offset,data,0);
-}
-
-READ8_HANDLER( k007232_read_port_0_r )
-{
- return k007232_ReadReg(offset,0);
-}
-
-WRITE8_HANDLER( k007232_write_port_1_w )
-{
- k007232_WriteReg(offset,data,1);
-}
-
-READ8_HANDLER( k007232_read_port_1_r )
-{
- return k007232_ReadReg(offset,1);
-}
-
-WRITE8_HANDLER( k007232_write_port_2_w )
-{
- k007232_WriteReg(offset,data,2);
-}
-
-READ8_HANDLER( k007232_read_port_2_r )
-{
- return k007232_ReadReg(offset,2);
-}
-
-void k007232_set_volume(int chip,int channel,int volumeA,int volumeB)
+void k007232_set_volume(const device_config *device,int channel,int volumeA,int volumeB)
{
- struct kdacApcm *info = sndti_token(SOUND_K007232, chip);
+ KDAC_A_PCM *info = get_safe_token(device);
info->vol[channel][0] = volumeA;
info->vol[channel][1] = volumeB;
}
-void k007232_set_bank( int chip, int chABank, int chBBank )
+void k007232_set_bank( const device_config *device, int chABank, int chBBank )
{
- struct kdacApcm *info = sndti_token(SOUND_K007232, chip);
+ KDAC_A_PCM *info = get_safe_token(device);
info->bank[0] = chABank<<17;
info->bank[1] = chBBank<<17;
}
@@ -473,34 +454,24 @@ void k007232_set_bank( int chip, int chABank, int chBBank )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( k007232 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( k007232 )
+DEVICE_GET_INFO( k007232 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct kdacApcm); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(KDAC_A_PCM); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( k007232 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( k007232 ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: /* nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( k007232 ); break;
+ case DEVINFO_FCT_STOP: /* nothing */ break;
+ case DEVINFO_FCT_RESET: /* nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "K007232"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Konami custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "K007232"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Konami custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/k007232.h b/src/emu/sound/k007232.h
index fbb2150ddcb..51dd44b25e6 100644
--- a/src/emu/sound/k007232.h
+++ b/src/emu/sound/k007232.h
@@ -10,17 +10,13 @@
typedef struct _k007232_interface k007232_interface;
struct _k007232_interface
{
- void (*portwritehandler)(int);
+ void (*portwritehandler)(const device_config *, int);
};
-WRITE8_HANDLER( k007232_write_port_0_w );
-WRITE8_HANDLER( k007232_write_port_1_w );
-WRITE8_HANDLER( k007232_write_port_2_w );
-READ8_HANDLER( k007232_read_port_0_r );
-READ8_HANDLER( k007232_read_port_1_r );
-READ8_HANDLER( k007232_read_port_2_r );
+WRITE8_DEVICE_HANDLER( k007232_w );
+READ8_DEVICE_HANDLER( k007232_r );
-void k007232_set_bank( int chip, int chABank, int chBBank );
+void k007232_set_bank( const device_config *device, int chABank, int chBBank );
/*
The 007232 has two channels and produces two outputs. The volume control
@@ -30,9 +26,9 @@ void k007232_set_bank( int chip, int chABank, int chBBank );
then volumeB will be 0 for channel 0, and volumeA will be 0 for channel 1.
Volume is in the range 0-255.
*/
-void k007232_set_volume(int chip,int channel,int volumeA,int volumeB);
+void k007232_set_volume(const device_config *device,int channel,int volumeA,int volumeB);
-SND_GET_INFO( k007232 );
-#define SOUND_K007232 SND_GET_INFO_NAME( k007232 )
+DEVICE_GET_INFO( k007232 );
+#define SOUND_K007232 DEVICE_GET_INFO_NAME( k007232 )
#endif /* __K007232_H__ */
diff --git a/src/emu/sound/k051649.c b/src/emu/sound/k051649.c
index d89b9b66520..9da21cae5ea 100644
--- a/src/emu/sound/k051649.c
+++ b/src/emu/sound/k051649.c
@@ -38,7 +38,8 @@ typedef struct
signed char waveform[32]; /* 19991207.CAB */
} k051649_sound_channel;
-struct k051649_info
+typedef struct _k051649_state k051649_state;
+struct _k051649_state
{
k051649_sound_channel channel_list[5];
@@ -54,8 +55,17 @@ struct k051649_info
int f[10];
};
+INLINE k051649_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_K051649);
+ return (k051649_state *)device->token;
+}
+
/* build a table to divide by the number of voices */
-static void make_mixer_table(struct k051649_info *info, int voices)
+static void make_mixer_table(k051649_state *info, int voices)
{
int count = voices * 256;
int i;
@@ -81,7 +91,7 @@ static void make_mixer_table(struct k051649_info *info, int voices)
/* generate sound to the mix buffer */
static STREAM_UPDATE( k051649_update )
{
- struct k051649_info *info = param;
+ k051649_state *info = param;
k051649_sound_channel *voice=info->channel_list;
stream_sample_t *buffer = outputs[0];
short *mix;
@@ -125,14 +135,14 @@ static STREAM_UPDATE( k051649_update )
*buffer++ = info->mixer_lookup[*mix++];
}
-static SND_START( k051649 )
+static DEVICE_START( k051649 )
{
- struct k051649_info *info = device->token;
+ k051649_state *info = get_safe_token(device);
/* get stream channels */
- info->rate = clock/16;
+ info->rate = device->clock/16;
info->stream = stream_create(device, 0, 1, info->rate, info, k051649_update);
- info->mclock = clock;
+ info->mclock = device->clock;
/* allocate a buffer to mix into - 1 second's worth should be more than enough */
info->mixer_buffer = auto_malloc(2 * sizeof(short) * info->rate);
@@ -141,9 +151,9 @@ static SND_START( k051649 )
make_mixer_table(info, 5);
}
-static SND_RESET( k051649 )
+static DEVICE_RESET( k051649 )
{
- struct k051649_info *info = device->token;
+ k051649_state *info = get_safe_token(device);
k051649_sound_channel *voice = info->channel_list;
int i;
@@ -157,9 +167,9 @@ static SND_RESET( k051649 )
/********************************************************************************/
-WRITE8_HANDLER( k051649_waveform_w )
+WRITE8_DEVICE_HANDLER( k051649_waveform_w )
{
- struct k051649_info *info = sndti_token(SOUND_K051649, 0);
+ k051649_state *info = get_safe_token(device);
stream_update(info->stream);
info->channel_list[offset>>5].waveform[offset&0x1f]=data;
/* SY 20001114: Channel 5 shares the waveform with channel 4 */
@@ -167,39 +177,39 @@ WRITE8_HANDLER( k051649_waveform_w )
info->channel_list[4].waveform[offset&0x1f]=data;
}
-READ8_HANDLER ( k051649_waveform_r )
+READ8_DEVICE_HANDLER ( k051649_waveform_r )
{
- struct k051649_info *info = sndti_token(SOUND_K051649, 0);
+ k051649_state *info = get_safe_token(device);
return info->channel_list[offset>>5].waveform[offset&0x1f];
}
/* SY 20001114: Channel 5 doesn't share the waveform with channel 4 on this chip */
-WRITE8_HANDLER( k052539_waveform_w )
+WRITE8_DEVICE_HANDLER( k052539_waveform_w )
{
- struct k051649_info *info = sndti_token(SOUND_K051649, 0);
+ k051649_state *info = get_safe_token(device);
stream_update(info->stream);
info->channel_list[offset>>5].waveform[offset&0x1f]=data;
}
-WRITE8_HANDLER( k051649_volume_w )
+WRITE8_DEVICE_HANDLER( k051649_volume_w )
{
- struct k051649_info *info = sndti_token(SOUND_K051649, 0);
+ k051649_state *info = get_safe_token(device);
stream_update(info->stream);
info->channel_list[offset&0x7].volume=data&0xf;
}
-WRITE8_HANDLER( k051649_frequency_w )
+WRITE8_DEVICE_HANDLER( k051649_frequency_w )
{
- struct k051649_info *info = sndti_token(SOUND_K051649, 0);
+ k051649_state *info = get_safe_token(device);
info->f[offset]=data;
stream_update(info->stream);
info->channel_list[offset>>1].frequency=(info->f[offset&0xe] + (info->f[offset|1]<<8))&0xfff;
}
-WRITE8_HANDLER( k051649_keyonoff_w )
+WRITE8_DEVICE_HANDLER( k051649_keyonoff_w )
{
- struct k051649_info *info = sndti_token(SOUND_K051649, 0);
+ k051649_state *info = get_safe_token(device);
stream_update(info->stream);
info->channel_list[0].key=data&1;
info->channel_list[1].key=data&2;
@@ -215,34 +225,24 @@ WRITE8_HANDLER( k051649_keyonoff_w )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( k051649 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( k051649 )
+DEVICE_GET_INFO( k051649 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct k051649_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(k051649_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( k051649 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( k051649 ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( k051649 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( k051649 ); break;
+ case DEVINFO_FCT_STOP: /* nothing */ break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( k051649 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "K051649"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Konami custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "K051649"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Konami custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/k051649.h b/src/emu/sound/k051649.h
index b784f757e08..ae598570bad 100644
--- a/src/emu/sound/k051649.h
+++ b/src/emu/sound/k051649.h
@@ -3,14 +3,15 @@
#ifndef __K051649_H__
#define __K051649_H__
-WRITE8_HANDLER( k051649_waveform_w );
-READ8_HANDLER( k051649_waveform_r );
-WRITE8_HANDLER( k051649_volume_w );
-WRITE8_HANDLER( k051649_frequency_w );
-WRITE8_HANDLER( k051649_keyonoff_w );
-WRITE8_HANDLER( k052539_waveform_w );
+WRITE8_DEVICE_HANDLER( k051649_waveform_w );
+READ8_DEVICE_HANDLER( k051649_waveform_r );
+WRITE8_DEVICE_HANDLER( k051649_volume_w );
+WRITE8_DEVICE_HANDLER( k051649_frequency_w );
+WRITE8_DEVICE_HANDLER( k051649_keyonoff_w );
-SND_GET_INFO( k051649 );
-#define SOUND_K051649 SND_GET_INFO_NAME( k051649 )
+WRITE8_DEVICE_HANDLER( k052539_waveform_w );
+
+DEVICE_GET_INFO( k051649 );
+#define SOUND_K051649 DEVICE_GET_INFO_NAME( k051649 )
#endif /* __K051649_H__ */
diff --git a/src/emu/sound/k053260.c b/src/emu/sound/k053260.c
index 1e16477ded4..92fb19f0d2c 100644
--- a/src/emu/sound/k053260.c
+++ b/src/emu/sound/k053260.c
@@ -16,7 +16,9 @@
#define BASE_SHIFT 16
-struct k053260_channel_def {
+typedef struct _k053260_channel k053260_channel;
+struct _k053260_channel
+{
UINT32 rate;
UINT32 size;
UINT32 start;
@@ -29,20 +31,31 @@ struct k053260_channel_def {
int ppcm; /* packed PCM ( 4 bit signed ) */
int ppcm_data;
};
-struct k053260_chip_def {
+
+typedef struct _k053260_state k053260_state;
+struct _k053260_state {
sound_stream * channel;
int mode;
int regs[0x30];
UINT8 *rom;
int rom_size;
UINT32 *delta_table;
- struct k053260_channel_def channels[4];
+ k053260_channel channels[4];
const k053260_interface *intf;
const device_config *device;
};
+INLINE k053260_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_K053260);
+ return (k053260_state *)device->token;
+}
+
-static void InitDeltaTable( struct k053260_chip_def *ic, int rate, int clock ) {
+static void InitDeltaTable( k053260_state *ic, int rate, int clock ) {
int i;
double base = ( double )rate;
double max = (double)(clock); /* Hz */
@@ -65,7 +78,8 @@ static void InitDeltaTable( struct k053260_chip_def *ic, int rate, int clock ) {
}
}
-static void k053260_reset(struct k053260_chip_def *ic) {
+DEVICE_RESET( k053260 ) {
+ k053260_state *ic = get_safe_token(device);
int i;
for( i = 0; i < 4; i++ ) {
@@ -83,11 +97,6 @@ static void k053260_reset(struct k053260_chip_def *ic) {
}
}
-static SND_RESET( k053260 ) {
- k053260_reset(device->token);
-}
-
-
INLINE int limit( int val, int max, int min ) {
if ( val > max )
val = max;
@@ -108,7 +117,7 @@ static STREAM_UPDATE( k053260_update ) {
UINT32 delta[4], end[4], pos[4];
int dataL, dataR;
signed char d;
- struct k053260_chip_def *ic = param;
+ k053260_state *ic = param;
/* precache some values */
for ( i = 0; i < 4; i++ ) {
@@ -199,11 +208,11 @@ static STREAM_UPDATE( k053260_update ) {
}
}
-static SND_START( k053260 )
+static DEVICE_START( k053260 )
{
static const k053260_interface defintrf = { 0 };
- struct k053260_chip_def *ic = device->token;
- int rate = clock / 32;
+ k053260_state *ic = get_safe_token(device);
+ int rate = device->clock / 32;
int i;
/* Initialize our chip structure */
@@ -219,7 +228,7 @@ static SND_START( k053260 )
ic->rom_size = memory_region_length(device->machine, ic->intf->rgnoverride);
}
- k053260_reset( ic );
+ DEVICE_RESET_CALL(k053260);
for ( i = 0; i < 0x30; i++ )
ic->regs[i] = 0;
@@ -228,14 +237,14 @@ static SND_START( k053260 )
ic->channel = stream_create( device, 0, 2, rate, ic, k053260_update );
- InitDeltaTable( ic, rate, clock );
+ InitDeltaTable( ic, rate, device->clock );
/* setup SH1 timer if necessary */
if ( ic->intf->irq )
- timer_pulse( device->machine, attotime_mul(ATTOTIME_IN_HZ(clock), 32), NULL, 0, ic->intf->irq );
+ timer_pulse( device->machine, attotime_mul(ATTOTIME_IN_HZ(device->clock), 32), NULL, 0, ic->intf->irq );
}
-INLINE void check_bounds( struct k053260_chip_def *ic, int channel ) {
+INLINE void check_bounds( k053260_state *ic, int channel ) {
int channel_start = ( ic->channels[channel].bank << 16 ) + ic->channels[channel].start;
int channel_end = channel_start + ic->channels[channel].size - 1;
@@ -256,13 +265,13 @@ INLINE void check_bounds( struct k053260_chip_def *ic, int channel ) {
if (LOG) logerror("K053260: Sample Start = %06x, Sample End = %06x, Sample rate = %04x, PPCM = %s\n", channel_start, channel_end, ic->channels[channel].rate, ic->channels[channel].ppcm ? "yes" : "no" );
}
-static void k053260_write( const address_space *space, offs_t offset, UINT8 data, int chip )
+WRITE8_DEVICE_HANDLER( k053260_w )
{
int i, t;
int r = offset;
int v = data;
- struct k053260_chip_def *ic = sndti_token(SOUND_K053260, chip);
+ k053260_state *ic = get_safe_token(device);
if ( r > 0x2f ) {
logerror("K053260: Writing past registers\n" );
@@ -373,9 +382,9 @@ static void k053260_write( const address_space *space, offs_t offset, UINT8 data
}
}
-static UINT8 k053260_read( const address_space *space, offs_t offset, int chip )
+READ8_DEVICE_HANDLER( k053260_r )
{
- struct k053260_chip_def *ic = sndti_token(SOUND_K053260, chip);
+ k053260_state *ic = get_safe_token(device);
switch ( offset ) {
case 0x29: /* channel status */
@@ -397,7 +406,7 @@ static UINT8 k053260_read( const address_space *space, offs_t offset, int chip
ic->channels[0].pos += ( 1 << 16 );
if ( offs > ic->rom_size ) {
- logerror("%s: K53260: Attempting to read past rom size in rom Read Mode (offs = %06x, size = %06x).\n", cpuexec_describe_context(space->machine),offs,ic->rom_size );
+ logerror("%s: K53260: Attempting to read past rom size in rom Read Mode (offs = %06x, size = %06x).\n", cpuexec_describe_context(device->machine),offs,ic->rom_size );
return 0;
}
@@ -410,86 +419,28 @@ static UINT8 k053260_read( const address_space *space, offs_t offset, int chip
return ic->regs[offset];
}
-/**************************************************************************************************/
-/* Accesors */
-
-READ8_HANDLER( k053260_0_r )
-{
- return k053260_read( space, offset, 0 );
-}
-
-WRITE8_HANDLER( k053260_0_w )
-{
- k053260_write( space, offset, data, 0 );
-}
-
-READ8_HANDLER( k053260_1_r )
-{
- return k053260_read( space, offset, 1 );
-}
-
-WRITE8_HANDLER( k053260_1_w )
-{
- k053260_write( space, offset, data, 1 );
-}
-
-WRITE16_HANDLER( k053260_0_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- k053260_0_w (space, offset, data & 0xff);
-}
-
-READ16_HANDLER( k053260_0_lsb_r )
-{
- return k053260_0_r(space, offset);
-}
-
-WRITE16_HANDLER( k053260_1_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- k053260_1_w (space, offset, data & 0xff);
-}
-
-READ16_HANDLER( k053260_1_lsb_r )
-{
- return k053260_1_r(space, offset);
-}
-
-
-
-
/**************************************************************************
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( k053260 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( k053260 )
+DEVICE_GET_INFO( k053260 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct k053260_chip_def); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(k053260_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( k053260 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( k053260 ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( k053260); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( k053260 ); break;
+ case DEVINFO_FCT_STOP: /* nothing */ break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( k053260); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "K053260"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Konami custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "K053260"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Konami custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/k053260.h b/src/emu/sound/k053260.h
index 03e65dbd9f0..4aae1dd1b9f 100644
--- a/src/emu/sound/k053260.h
+++ b/src/emu/sound/k053260.h
@@ -16,16 +16,10 @@ struct _k053260_interface {
};
-WRITE8_HANDLER( k053260_0_w );
-WRITE8_HANDLER( k053260_1_w );
-READ8_HANDLER( k053260_0_r );
-READ8_HANDLER( k053260_1_r );
-WRITE16_HANDLER( k053260_0_lsb_w );
-READ16_HANDLER( k053260_0_lsb_r );
-WRITE16_HANDLER( k053260_1_lsb_w );
-READ16_HANDLER( k053260_1_lsb_r );
-
-SND_GET_INFO( k053260 );
-#define SOUND_K053260 SND_GET_INFO_NAME( k053260 )
+WRITE8_DEVICE_HANDLER( k053260_w );
+READ8_DEVICE_HANDLER( k053260_r );
+
+DEVICE_GET_INFO( k053260 );
+#define SOUND_K053260 DEVICE_GET_INFO_NAME( k053260 )
#endif /* __K053260_H__ */
diff --git a/src/emu/sound/k054539.c b/src/emu/sound/k054539.c
index f0c10fbcea3..8c2e71b8501 100644
--- a/src/emu/sound/k054539.c
+++ b/src/emu/sound/k054539.c
@@ -58,8 +58,10 @@ CHANNEL_DEBUG enables the following keys:
rendering instead of sample-based.
*/
-struct k054539_info {
+typedef struct _k054539_state k054539_state;
+struct _k054539_state {
const k054539_interface *intf;
+ const device_config *device;
double voltab[256];
double pantab[0xf];
@@ -87,33 +89,42 @@ struct k054539_info {
} channels[8];
};
+INLINE k054539_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_K054539);
+ return (k054539_state *)device->token;
+}
+
//*
-void k054539_init_flags(int chip, int flags)
+void k054539_init_flags(const device_config *device, int flags)
{
- struct k054539_info *info = sndti_token(SOUND_K054539, chip);
+ k054539_state *info = get_safe_token(device);
info->k054539_flags = flags;
}
-void k054539_set_gain(int chip, int channel, double gain)
+void k054539_set_gain(const device_config *device, int channel, double gain)
{
- struct k054539_info *info = sndti_token(SOUND_K054539, chip);
+ k054539_state *info = get_safe_token(device);
if (gain >= 0) info->k054539_gain[channel] = gain;
}
//*
-static int k054539_regupdate(struct k054539_info *info)
+static int k054539_regupdate(k054539_state *info)
{
return !(info->regs[0x22f] & 0x80);
}
-static void k054539_keyon(struct k054539_info *info, int channel)
+static void k054539_keyon(k054539_state *info, int channel)
{
if(k054539_regupdate(info))
info->regs[0x22c] |= 1 << channel;
}
-static void k054539_keyoff(struct k054539_info *info, int channel)
+static void k054539_keyoff(k054539_state *info, int channel)
{
if(k054539_regupdate(info))
info->regs[0x22c] &= ~(1 << channel);
@@ -121,7 +132,7 @@ static void k054539_keyoff(struct k054539_info *info, int channel)
static STREAM_UPDATE( k054539_update )
{
- struct k054539_info *info = param;
+ k054539_state *info = param;
#define VOL_CAP 1.80
static const INT16 dpcm[16] = {
@@ -427,12 +438,12 @@ else
static TIMER_CALLBACK( k054539_irq )
{
- struct k054539_info *info = ptr;
+ k054539_state *info = ptr;
if(info->regs[0x22f] & 0x20)
- info->intf->irq(machine);
+ info->intf->irq(info->device);
}
-static void k054539_init_chip(const device_config *device, struct k054539_info *info, int clock)
+static void k054539_init_chip(const device_config *device, k054539_state *info)
{
int i;
@@ -441,10 +452,10 @@ static void k054539_init_chip(const device_config *device, struct k054539_info *
info->k054539_flags |= K054539_UPDATE_AT_KEYON; //* make it default until proven otherwise
// Real size of 0x4000, the addon is to simplify the reverb buffer computations
- info->ram = auto_malloc(0x4000*2+clock/50*2);
+ info->ram = auto_malloc(0x4000*2+device->clock/50*2);
info->reverb_pos = 0;
info->cur_ptr = 0;
- memset(info->ram, 0, 0x4000*2+clock/50*2);
+ memset(info->ram, 0, 0x4000*2+device->clock/50*2);
info->rom = device->region;
info->rom_size = device->regionbytes;
@@ -466,16 +477,17 @@ static void k054539_init_chip(const device_config *device, struct k054539_info *
// 480 hz is TRUSTED by gokuparo disco stage - the looping sample doesn't line up otherwise
timer_pulse(device->machine, ATTOTIME_IN_HZ(480), info, 0, k054539_irq);
- info->stream = stream_create(device, 0, 2, clock, info, k054539_update);
+ info->stream = stream_create(device, 0, 2, device->clock, info, k054539_update);
state_save_register_device_item_array(device, 0, info->regs);
state_save_register_device_item_pointer(device, 0, info->ram, 0x4000);
state_save_register_device_item(device, 0, info->cur_ptr);
}
-static void k054539_w(int chip, offs_t offset, UINT8 data) //*
+WRITE8_DEVICE_HANDLER( k054539_w )
{
- struct k054539_info *info = sndti_token(SOUND_K054539, chip);
+ k054539_state *info = get_safe_token(device);
+
#if 0
int voice, reg;
@@ -524,7 +536,7 @@ static void k054539_w(int chip, offs_t offset, UINT8 data) //*
case 0x13f:
pan = data >= 0x11 && data <= 0x1f ? data - 0x11 : 0x18 - 0x11;
if(info->intf->apan)
- info->intf->apan(info->pantab[pan], info->pantab[0xe - pan]);
+ info->intf->apan(info->device, info->pantab[pan], info->pantab[0xe - pan]);
break;
case 0x214:
@@ -599,7 +611,7 @@ static void k054539_w(int chip, offs_t offset, UINT8 data) //*
static STATE_POSTLOAD( reset_zones )
{
- struct k054539_info *info = param;
+ k054539_state *info = param;
int data = info->regs[0x22e];
info->cur_zone =
data == 0x80 ? info->ram :
@@ -607,9 +619,9 @@ static STATE_POSTLOAD( reset_zones )
info->cur_limit = data == 0x80 ? 0x4000 : 0x20000;
}
-static UINT8 k054539_r(int chip, offs_t offset)
+READ8_DEVICE_HANDLER( k054539_r )
{
- struct k054539_info *info = sndti_token(SOUND_K054539, chip);
+ k054539_state *info = get_safe_token(device);
switch(offset) {
case 0x22d:
if(info->regs[0x22f] & 0x10) {
@@ -629,11 +641,13 @@ static UINT8 k054539_r(int chip, offs_t offset)
return info->regs[offset];
}
-static SND_START( k054539 )
+static DEVICE_START( k054539 )
{
static const k054539_interface defintrf = { 0 };
int i;
- struct k054539_info *info = device->token;
+ k054539_state *info = get_safe_token(device);
+
+ info->device = device;
for (i = 0; i < 8; i++)
info->k054539_gain[i] = 1.0;
@@ -663,31 +677,11 @@ static SND_START( k054539 )
for(i=0; i<0xf; i++)
info->pantab[i] = sqrt(i) / sqrt(0xe);
- k054539_init_chip(device, info, clock);
+ k054539_init_chip(device, info);
state_save_register_postload(device->machine, reset_zones, info);
}
-WRITE8_HANDLER( k054539_0_w )
-{
- k054539_w(0, offset, data);
-}
-
-READ8_HANDLER( k054539_0_r )
-{
- return k054539_r(0, offset);
-}
-
-WRITE8_HANDLER( k054539_1_w )
-{
- k054539_w(1, offset, data);
-}
-
-READ8_HANDLER( k054539_1_r )
-{
- return k054539_r(1, offset);
-}
-
@@ -695,34 +689,24 @@ READ8_HANDLER( k054539_1_r )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( k054539 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( k054539 )
+DEVICE_GET_INFO( k054539 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct k054539_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(k054539_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( k054539 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( k054539 ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: /* nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( k054539 ); break;
+ case DEVINFO_FCT_STOP: /* nothing */ break;
+ case DEVINFO_FCT_RESET: /* nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "K054539"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Konami custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "K054539"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Konami custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/k054539.h b/src/emu/sound/k054539.h
index 39db47db6f7..d48681db441 100644
--- a/src/emu/sound/k054539.h
+++ b/src/emu/sound/k054539.h
@@ -13,15 +13,13 @@ typedef struct _k054539_interface k054539_interface;
struct _k054539_interface
{
const char *rgnoverride;
- void (*apan)(double, double); /* Callback for analog output mixing levels (0..1 for each channel) */
- void (*irq)(running_machine *);
+ void (*apan)(const device_config *, double, double); /* Callback for analog output mixing levels (0..1 for each channel) */
+ void (*irq)(const device_config *);
};
-WRITE8_HANDLER( k054539_0_w );
-READ8_HANDLER( k054539_0_r );
-WRITE8_HANDLER( k054539_1_w );
-READ8_HANDLER( k054539_1_r );
+WRITE8_DEVICE_HANDLER( k054539_w );
+READ8_DEVICE_HANDLER( k054539_r );
//* control flags, may be set at DRIVER_INIT().
#define K054539_RESET_FLAGS 0
@@ -29,7 +27,7 @@ READ8_HANDLER( k054539_1_r );
#define K054539_DISABLE_REVERB 2
#define K054539_UPDATE_AT_KEYON 4
-void k054539_init_flags(int chip, int flags);
+void k054539_init_flags(const device_config *device, int flags);
/*
Note that the eight PCM channels of a K054539 do not have seperate
@@ -43,9 +41,9 @@ void k054539_init_flags(int chip, int flags);
channel : 0 - 7
gain : 0.0=silent, 1.0=no gain, 2.0=twice as loud, etc.
*/
-void k054539_set_gain(int chip, int channel, double gain);
+void k054539_set_gain(const device_config *device, int channel, double gain);
-SND_GET_INFO( k054539 );
-#define SOUND_K054539 SND_GET_INFO_NAME( k054539 )
+DEVICE_GET_INFO( k054539 );
+#define SOUND_K054539 DEVICE_GET_INFO_NAME( k054539 )
#endif /* __K054539_H__ */
diff --git a/src/emu/sound/msm5205.c b/src/emu/sound/msm5205.c
index b4a051a4e84..a93cc4c6e24 100644
--- a/src/emu/sound/msm5205.c
+++ b/src/emu/sound/msm5205.c
@@ -28,7 +28,8 @@
*
*/
-struct MSM5205Voice
+typedef struct _msm5205_state msm5205_state;
+struct _msm5205_state
{
const msm5205_interface *intf;
const device_config *device;
@@ -45,8 +46,17 @@ struct MSM5205Voice
int diff_lookup[49*16];
};
+INLINE msm5205_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_MSM5205);
+ return (msm5205_state *)device->token;
+}
-static void msm5205_playmode(struct MSM5205Voice *voice,int select);
+
+static void msm5205_playmode(msm5205_state *voice,int select);
/*
* ADPCM lockup tabe
@@ -59,7 +69,7 @@ static const int index_shift[8] = { -1, -1, -1, -1, 2, 4, 6, 8 };
* Compute the difference table
*/
-static void ComputeTables (struct MSM5205Voice *voice)
+static void ComputeTables (msm5205_state *voice)
{
/* nibble to bit map */
static const int nbl2bit[16][4] =
@@ -93,7 +103,7 @@ static void ComputeTables (struct MSM5205Voice *voice)
/* stream update callbacks */
static STREAM_UPDATE( MSM5205_update )
{
- struct MSM5205Voice *voice = param;
+ msm5205_state *voice = param;
stream_sample_t *buffer = outputs[0];
/* if this voice is active */
@@ -113,7 +123,7 @@ static STREAM_UPDATE( MSM5205_update )
/* timer callback at VCLK low eddge */
static TIMER_CALLBACK( MSM5205_vclk_callback )
{
- struct MSM5205Voice *voice = ptr;
+ msm5205_state *voice = ptr;
int val;
int new_signal;
/* callback user handler and latch next data */
@@ -148,8 +158,10 @@ static TIMER_CALLBACK( MSM5205_vclk_callback )
/*
* Reset emulation of an MSM5205-compatible chip
*/
-static void msm5205_reset(struct MSM5205Voice *voice)
+static DEVICE_RESET( msm5205 )
{
+ msm5205_state *voice = get_safe_token(device);
+
/* initialize work */
voice->data = 0;
voice->vclk = 0;
@@ -161,33 +173,28 @@ static void msm5205_reset(struct MSM5205Voice *voice)
}
-static SND_RESET( msm5205 )
-{
- msm5205_reset(device->token);
-}
-
/*
* Start emulation of an MSM5205-compatible chip
*/
-static SND_START( msm5205 )
+static DEVICE_START( msm5205 )
{
- struct MSM5205Voice *voice = device->token;
+ msm5205_state *voice = get_safe_token(device);
/* save a global pointer to our interface */
voice->intf = device->static_config;
voice->device = device;
- voice->clock = clock;
+ voice->clock = device->clock;
/* compute the difference tables */
ComputeTables (voice);
/* stream system initialize */
- voice->stream = stream_create(device,0,1,clock,voice,MSM5205_update);
+ voice->stream = stream_create(device,0,1,device->clock,voice,MSM5205_update);
voice->timer = timer_alloc(device->machine, MSM5205_vclk_callback, voice);
/* initialize */
- msm5205_reset(voice);
+ DEVICE_RESET_CALL(msm5205);
/* register for save states */
state_save_register_device_item(device, 0, voice->clock);
@@ -204,13 +211,13 @@ static SND_START( msm5205 )
* Handle an update of the vclk status of a chip (1 is reset ON, 0 is reset OFF)
* This function can use selector = MSM5205_SEX only
*/
-void msm5205_vclk_w (int num, int vclk)
+void msm5205_vclk_w (const device_config *device, int vclk)
{
- struct MSM5205Voice *voice = sndti_token(SOUND_MSM5205, num);
+ msm5205_state *voice = get_safe_token(device);
if( voice->prescaler != 0 )
{
- logerror("error: msm5205_vclk_w() called with chip = %d, but VCLK selected master mode\n", num);
+ logerror("error: msm5205_vclk_w() called with chip = '%s', but VCLK selected master mode\n", device->tag);
}
else
{
@@ -226,9 +233,9 @@ void msm5205_vclk_w (int num, int vclk)
* Handle an update of the reset status of a chip (1 is reset ON, 0 is reset OFF)
*/
-void msm5205_reset_w (int num, int reset)
+void msm5205_reset_w (const device_config *device, int reset)
{
- struct MSM5205Voice *voice = sndti_token(SOUND_MSM5205, num);
+ msm5205_state *voice = get_safe_token(device);
voice->reset = reset;
}
@@ -236,9 +243,9 @@ void msm5205_reset_w (int num, int reset)
* Handle an update of the data to the chip
*/
-void msm5205_data_w (int num, int data)
+void msm5205_data_w (const device_config *device, int data)
{
- struct MSM5205Voice *voice = sndti_token(SOUND_MSM5205, num);
+ msm5205_state *voice = get_safe_token(device);
if( voice->bitwidth == 4)
voice->data = data & 0x0f;
else
@@ -249,13 +256,13 @@ void msm5205_data_w (int num, int data)
* Handle an change of the selector
*/
-void msm5205_playmode_w(int num,int select)
+void msm5205_playmode_w(const device_config *device, int select)
{
- struct MSM5205Voice *voice = sndti_token(SOUND_MSM5205, num);
+ msm5205_state *voice = get_safe_token(device);
msm5205_playmode(voice,select);
}
-static void msm5205_playmode(struct MSM5205Voice *voice,int select)
+static void msm5205_playmode(msm5205_state *voice,int select)
{
static const int prescaler_table[4] = {96,48,64,0};
int prescaler = prescaler_table[select & 3];
@@ -286,9 +293,9 @@ static void msm5205_playmode(struct MSM5205Voice *voice,int select)
}
-void msm5205_set_volume(int num,int volume)
+void msm5205_set_volume(const device_config *device,int volume)
{
- struct MSM5205Voice *voice = sndti_token(SOUND_MSM5205, num);
+ msm5205_state *voice = get_safe_token(device);
stream_set_output_gain(voice->stream,0,volume / 100.0);
}
@@ -300,34 +307,24 @@ void msm5205_set_volume(int num,int volume)
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( msm5205 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( msm5205 )
+DEVICE_GET_INFO( msm5205 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct MSM5205Voice); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(msm5205_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( msm5205 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( msm5205 ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( msm5205 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( msm5205 ); break;
+ case DEVINFO_FCT_STOP: /* nothing */ break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( msm5205 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "MSM5205"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "ADPCM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "MSM5205"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "ADPCM"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/msm5205.h b/src/emu/sound/msm5205.h
index d5d97e97f6b..cee26a7bf48 100644
--- a/src/emu/sound/msm5205.h
+++ b/src/emu/sound/msm5205.h
@@ -24,19 +24,19 @@ struct _msm5205_interface
};
/* reset signal should keep for 2cycle of VCLK */
-void msm5205_reset_w (int num, int reset);
+void msm5205_reset_w (const device_config *device, int reset);
/* adpcmata is latched after vclk_interrupt callback */
-void msm5205_data_w (int num, int data);
+void msm5205_data_w (const device_config *device, int data);
/* VCLK slave mode option */
/* if VCLK and reset or data is changed at the same time, */
/* Call msm5205_vclk_w after msm5205_data_w and msm5205_reset_w. */
-void msm5205_vclk_w (int num, int reset);
+void msm5205_vclk_w (const device_config *device, int reset);
/* option , selected pin seletor */
-void msm5205_playmode_w(int num,int _select);
+void msm5205_playmode_w(const device_config *device, int _select);
-void msm5205_set_volume(int num,int volume);
+void msm5205_set_volume(const device_config *device,int volume);
-SND_GET_INFO( msm5205 );
-#define SOUND_MSM5205 SND_GET_INFO_NAME( msm5205 )
+DEVICE_GET_INFO( msm5205 );
+#define SOUND_MSM5205 DEVICE_GET_INFO_NAME( msm5205 )
#endif /* __MSM5205_H__ */
diff --git a/src/emu/sound/msm5232.c b/src/emu/sound/msm5232.c
index 87f8acf0815..3c6c022e776 100644
--- a/src/emu/sound/msm5232.c
+++ b/src/emu/sound/msm5232.c
@@ -71,11 +71,22 @@ typedef struct {
int rate; /* sample rate in Hz */
double external_capacity[8]; /* in Farads, eg 0.39e-6 = 0.36 uF (microFarads) */
- void (*gate_handler)(int state); /* callback called when the GATE output pin changes state */
+ const device_config *device;
+ void (*gate_handler)(const device_config *device, int state); /* callback called when the GATE output pin changes state */
} MSM5232;
+INLINE MSM5232 *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_MSM5232);
+ return (MSM5232 *)device->token;
+}
+
+
/* Default chip clock is 2119040 Hz */
/* At this clock chip generates exactly 440.0 Hz signal on 8' output when pitch data=0x21 */
@@ -250,9 +261,6 @@ static void msm5232_init_voice(MSM5232 *chip, int i)
}
-static void msm5232_write(MSM5232 *chip, int ofst, int data);
-
-
static void msm5232_gate_update(MSM5232 *chip)
{
int new_state = (chip->control2 & 0x20) ? chip->voi[7].GF : 0;
@@ -260,19 +268,20 @@ static void msm5232_gate_update(MSM5232 *chip)
if (chip->gate != new_state && chip->gate_handler)
{
chip->gate = new_state;
- (*chip->gate_handler)(new_state);
+ (*chip->gate_handler)(chip->device, new_state);
}
}
-static void msm5232_reset(MSM5232 *chip)
+static DEVICE_RESET( msm5232 )
{
+ MSM5232 *chip = get_safe_token(device);
int i;
for (i=0; i<8; i++)
{
- msm5232_write(chip,i,0x80);
- msm5232_write(chip,i,0x00);
+ msm5232_w(device,i,0x80);
+ msm5232_w(device,i,0x00);
}
chip->noise_cnt = 0;
chip->noise_rng = 1;
@@ -293,11 +302,6 @@ static void msm5232_reset(MSM5232 *chip)
msm5232_gate_update(chip);
}
-static SND_RESET( msm5232 )
-{
- msm5232_reset(device->token);
-}
-
static void msm5232_init(MSM5232 *chip, const msm5232_interface *intf, int clock, int rate)
{
int j;
@@ -319,10 +323,9 @@ static void msm5232_init(MSM5232 *chip, const msm5232_interface *intf, int clock
memset(&chip->voi[j],0,sizeof(VOICE));
msm5232_init_voice(chip,j);
}
- msm5232_reset( chip );
}
-static void msm5232_shutdown(void *chip)
+static DEVICE_STOP( msm5232 )
{
#ifdef SAVE_SAMPLE
fclose(sample[8]);
@@ -339,14 +342,18 @@ static void msm5232_shutdown(void *chip)
#endif
}
-static void msm5232_write(MSM5232 *chip, int ofst, int data)
+WRITE8_DEVICE_HANDLER( msm5232_w )
{
- if (ofst > 0x0d)
+ MSM5232 *chip = get_safe_token(device);
+
+ if (offset > 0x0d)
return;
- if (ofst < 0x08) /* pitch */
+ stream_update (chip->stream);
+
+ if (offset < 0x08) /* pitch */
{
- int ch = ofst&7;
+ int ch = offset&7;
chip->voi[ch].GF = ((data&0x80)>>7);
if (ch == 7)
@@ -402,7 +409,7 @@ static void msm5232_write(MSM5232 *chip, int ofst, int data)
else
{
int i;
- switch(ofst)
+ switch(offset)
{
case 0x08: /* group1 attack */
for (i=0; i<4; i++)
@@ -778,39 +785,22 @@ static STREAM_UPDATE( MSM5232_update_one )
/* MAME Interface */
-static SND_START( msm5232 )
+static DEVICE_START( msm5232 )
{
const msm5232_interface *intf = device->static_config;
- int rate = clock/CLOCK_RATE_DIVIDER;
+ int rate = device->clock/CLOCK_RATE_DIVIDER;
MSM5232 *chip = device->token;
+
+ chip->device = device;
- msm5232_init(chip, intf, clock, rate);
+ msm5232_init(chip, intf, device->clock, rate);
chip->stream = stream_create(device,0,11,rate,chip,MSM5232_update_one);
}
-static SND_STOP( msm5232 )
-{
- msm5232_shutdown(device->token);
-}
-
-WRITE8_HANDLER ( msm5232_0_w )
+void msm5232_set_clock(const device_config *device, int clock)
{
- MSM5232 *chip = sndti_token(SOUND_MSM5232, 0);
- stream_update (chip->stream);
- msm5232_write(chip, offset, data);
-}
-
-WRITE8_HANDLER ( msm5232_1_w )
-{
- MSM5232 *chip = sndti_token(SOUND_MSM5232, 1);
- stream_update (chip->stream);
- msm5232_write(chip, offset, data);
-}
-
-void msm5232_set_clock(void *_chip, int clock)
-{
- MSM5232 *chip = _chip;
+ MSM5232 *chip = get_safe_token(device);
if (chip->clock != clock)
{
@@ -828,34 +818,24 @@ void msm5232_set_clock(void *_chip, int clock)
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( msm5232 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( msm5232 )
+DEVICE_GET_INFO( msm5232 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(MSM5232); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(MSM5232); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( msm5232 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( msm5232 ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( msm5232 ); break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( msm5232 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( msm5232 ); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( msm5232 ); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( msm5232 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "MSM5232"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Oki Tone"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.1"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "MSM5232"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Oki Tone"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.1"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/msm5232.h b/src/emu/sound/msm5232.h
index 474cbb1fae6..ec786a10a77 100644
--- a/src/emu/sound/msm5232.h
+++ b/src/emu/sound/msm5232.h
@@ -7,15 +7,14 @@ typedef struct _msm5232_interface msm5232_interface;
struct _msm5232_interface
{
double capacity[8]; /* in Farads, capacitors connected to pins: 24,25,26,27 and 37,38,39,40 */
- void (*gate_handler)(int state); /* callback called when the GATE output pin changes state */
+ void (*gate_handler)(const device_config *device, int state); /* callback called when the GATE output pin changes state */
};
-WRITE8_HANDLER( msm5232_0_w );
-WRITE8_HANDLER( msm5232_1_w );
+WRITE8_DEVICE_HANDLER( msm5232_w );
-void msm5232_set_clock(void *chip, int clock);
+void msm5232_set_clock(const device_config *device, int clock);
-SND_GET_INFO( msm5232 );
-#define SOUND_MSM5232 SND_GET_INFO_NAME( msm5232 )
+DEVICE_GET_INFO( msm5232 );
+#define SOUND_MSM5232 DEVICE_GET_INFO_NAME( msm5232 )
#endif /* __MSM5232_H__ */
diff --git a/src/emu/sound/multipcm.c b/src/emu/sound/multipcm.c
index 903ce9d9a03..a457faf7c80 100644
--- a/src/emu/sound/multipcm.c
+++ b/src/emu/sound/multipcm.c
@@ -91,6 +91,7 @@ struct _SLOT
struct _LFO ALFO; //AM lfo
};
+typedef struct _MultiPCM MultiPCM;
struct _MultiPCM
{
sound_stream * stream;
@@ -125,6 +126,17 @@ static const int val2chan[] =
#define MULTIPCM_RATE 44100.0
+
+INLINE MultiPCM *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_MULTIPCM);
+ return (MultiPCM *)device->token;
+}
+
+
/*******************************
ENVELOPE SECTION
*******************************/
@@ -193,7 +205,7 @@ static unsigned int Get_RATE(unsigned int *Steps,unsigned int rate,unsigned int
return Steps[r];
}
-static void EG_Calc(struct _MultiPCM *ptChip,struct _SLOT *slot)
+static void EG_Calc(MultiPCM *ptChip,struct _SLOT *slot)
{
int octave=((slot->Regs[3]>>4)-1)&0xf;
int rate;
@@ -293,7 +305,7 @@ INLINE signed int ALFO_Step(struct _LFO *LFO)
return p<<(SHIFT-LFO_SHIFT);
}
-static void LFO_ComputeStep(struct _MultiPCM *ptChip,struct _LFO *LFO,UINT32 LFOF,UINT32 LFOS,int ALFO)
+static void LFO_ComputeStep(MultiPCM *ptChip,struct _LFO *LFO,UINT32 LFOF,UINT32 LFOS,int ALFO)
{
float step=(float) LFOFreq[LFOF]*256.0/(float) ptChip->Rate;
LFO->phase_step=(unsigned int) ((float) (1<<LFO_SHIFT)*step);
@@ -311,7 +323,7 @@ static void LFO_ComputeStep(struct _MultiPCM *ptChip,struct _LFO *LFO,UINT32 LFO
-static void WriteSlot(struct _MultiPCM *ptChip,struct _SLOT *slot,int reg,unsigned char data)
+static void WriteSlot(MultiPCM *ptChip,struct _SLOT *slot,int reg,unsigned char data)
{
slot->Regs[reg]=data;
@@ -415,7 +427,7 @@ static void WriteSlot(struct _MultiPCM *ptChip,struct _SLOT *slot,int reg,unsign
static STREAM_UPDATE( MultiPCM_update )
{
- struct _MultiPCM *ptChip = param;
+ MultiPCM *ptChip = param;
stream_sample_t *datap[2];
int i,sl;
@@ -480,19 +492,19 @@ static STREAM_UPDATE( MultiPCM_update )
}
}
-static unsigned char multi_pcm_reg_r(int chip, int offset)
+READ8_DEVICE_HANDLER( multipcm_r )
{
-// struct _MultiPCM *ptChip = sndti_token(SOUND_MULTIPCM, chip);
+// MultiPCM *ptChip = get_safe_token(device);
return 0;
}
-static SND_START( multipcm )
+static DEVICE_START( multipcm )
{
- struct _MultiPCM *ptChip = device->token;
+ MultiPCM *ptChip = get_safe_token(device);
int i;
ptChip->ROM=(INT8 *)device->region;
- ptChip->Rate=(float) clock / MULTIPCM_CLOCKDIV;
+ ptChip->Rate=(float) device->clock / MULTIPCM_CLOCKDIV;
ptChip->stream = stream_create(device, 0, 2, ptChip->Rate, ptChip, MultiPCM_update);
@@ -636,9 +648,9 @@ static SND_START( multipcm )
}
-static void multi_pcm_reg_w(int chip, int offset, UINT8 data)
+WRITE8_DEVICE_HANDLER( multipcm_w )
{
- struct _MultiPCM *ptChip = sndti_token(SOUND_MULTIPCM, chip);
+ MultiPCM *ptChip = get_safe_token(device);
switch(offset)
{
case 0: //Data write
@@ -656,29 +668,9 @@ static void multi_pcm_reg_w(int chip, int offset, UINT8 data)
/* MAME/M1 access functions */
-READ8_HANDLER( multi_pcm_reg_0_r )
-{
- return multi_pcm_reg_r(0, offset);
-}
-
-WRITE8_HANDLER( multi_pcm_reg_0_w )
-{
- multi_pcm_reg_w(0, offset, data);
-}
-
-READ8_HANDLER( multi_pcm_reg_1_r )
-{
- return multi_pcm_reg_r(1, offset);
-}
-
-WRITE8_HANDLER( multi_pcm_reg_1_w )
-{
- multi_pcm_reg_w(1, offset, data);
-}
-
-void multi_pcm_set_bank(int which, UINT32 leftoffs, UINT32 rightoffs)
+void multipcm_set_bank(const device_config *device, UINT32 leftoffs, UINT32 rightoffs)
{
- struct _MultiPCM *ptChip = sndti_token(SOUND_MULTIPCM, which);
+ MultiPCM *ptChip = get_safe_token(device);
ptChip->BankL = leftoffs;
ptChip->BankR = rightoffs;
}
@@ -689,34 +681,24 @@ void multi_pcm_set_bank(int which, UINT32 leftoffs, UINT32 rightoffs)
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( multipcm )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( multipcm )
+DEVICE_GET_INFO( multipcm )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct _MultiPCM); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(MultiPCM); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( multipcm ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( multipcm ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( multipcm ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "Sega/Yamaha 315-5560"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Sega custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "2.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "Sega/Yamaha 315-5560"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Sega custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "2.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/multipcm.h b/src/emu/sound/multipcm.h
index c1637f0b969..e7c8f61c27e 100644
--- a/src/emu/sound/multipcm.h
+++ b/src/emu/sound/multipcm.h
@@ -3,14 +3,12 @@
#ifndef __MULTIPCM_H__
#define __MULTIPCM_H__
-WRITE8_HANDLER( multi_pcm_reg_0_w );
-READ8_HANDLER( multi_pcm_reg_0_r);
-WRITE8_HANDLER( multi_pcm_reg_1_w );
-READ8_HANDLER( multi_pcm_reg_1_r);
+WRITE8_DEVICE_HANDLER( multipcm_w );
+READ8_DEVICE_HANDLER( multipcm_r );
-void multi_pcm_set_bank(int which, UINT32 leftoffs, UINT32 rightoffs);
+void multipcm_set_bank(const device_config *device, UINT32 leftoffs, UINT32 rightoffs);
-SND_GET_INFO( multipcm );
-#define SOUND_MULTIPCM SND_GET_INFO_NAME( multipcm )
+DEVICE_GET_INFO( multipcm );
+#define SOUND_MULTIPCM DEVICE_GET_INFO_NAME( multipcm )
#endif /* __MULTIPCM_H__ */
diff --git a/src/emu/sound/n63701x.c b/src/emu/sound/n63701x.c
index 55df82232c1..a74547952f2 100644
--- a/src/emu/sound/n63701x.c
+++ b/src/emu/sound/n63701x.c
@@ -28,7 +28,9 @@ typedef struct
int silence_counter;
} voice;
-struct namco_63701x
+
+typedef struct _namco_63701x namco_63701x;
+struct _namco_63701x
{
voice voices[2];
sound_stream * stream; /* channel assigned by the mixer */
@@ -45,9 +47,19 @@ struct namco_63701x
static const int vol_table[4] = { 26, 84, 200, 258 };
+INLINE namco_63701x *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_NAMCO_63701X);
+ return (namco_63701x *)device->token;
+}
+
+
static STREAM_UPDATE( namco_63701x_update )
{
- struct namco_63701x *chip = param;
+ namco_63701x *chip = param;
int ch;
for (ch = 0;ch < 2;ch++)
@@ -99,20 +111,20 @@ static STREAM_UPDATE( namco_63701x_update )
}
-static SND_START( namco_63701x )
+static DEVICE_START( namco_63701x )
{
- struct namco_63701x *chip = device->token;
+ namco_63701x *chip = get_safe_token(device);
chip->rom = device->region;
- chip->stream = stream_create(device, 0, 2, clock/1000, chip, namco_63701x_update);
+ chip->stream = stream_create(device, 0, 2, device->clock/1000, chip, namco_63701x_update);
}
-void namco_63701x_write(int offset, int data)
+WRITE8_DEVICE_HANDLER( namco_63701x_w )
{
- struct namco_63701x *chip = sndti_token(SOUND_NAMCO_63701X, 0);
+ namco_63701x *chip = get_safe_token(device);
int ch = offset / 2;
if (offset & 1)
@@ -154,34 +166,24 @@ void namco_63701x_write(int offset, int data)
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( namco_63701x )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( namco_63701x )
+DEVICE_GET_INFO( namco_63701x )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct namco_63701x); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(namco_63701x); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( namco_63701x ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( namco_63701x ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( namco_63701x ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "Namco 63701X"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Namco custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "Namco 63701X"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Namco custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/n63701x.h b/src/emu/sound/n63701x.h
index d13884b2830..82ed30cf6ce 100644
--- a/src/emu/sound/n63701x.h
+++ b/src/emu/sound/n63701x.h
@@ -3,9 +3,9 @@
#ifndef __N63701X_H__
#define __N63701X_H__
-void namco_63701x_write(int offset,int data);
+WRITE8_DEVICE_HANDLER( namco_63701x_w );
-SND_GET_INFO( namco_63701x );
-#define SOUND_NAMCO_63701X SND_GET_INFO_NAME( namco_63701x )
+DEVICE_GET_INFO( namco_63701x );
+#define SOUND_NAMCO_63701X DEVICE_GET_INFO_NAME( namco_63701x )
#endif /* __N63701X_H__ */
diff --git a/src/emu/sound/namco.c b/src/emu/sound/namco.c
index 401a7910ef0..2480d3e82af 100644
--- a/src/emu/sound/namco.c
+++ b/src/emu/sound/namco.c
@@ -55,7 +55,8 @@ typedef struct
UINT8 *namco_soundregs;
UINT8 *namco_wavedata;
-struct namco_sound
+typedef struct _namco_sound namco_sound;
+struct _namco_sound
{
/* data about the sound system */
sound_channel channel_list[MAX_VOICES];
@@ -76,8 +77,19 @@ struct namco_sound
};
+INLINE namco_sound *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_NAMCO ||
+ sound_get_type(device) == SOUND_NAMCO_15XX ||
+ sound_get_type(device) == SOUND_NAMCO_CUS30);
+ return (namco_sound *)device->token;
+}
+
/* update the decoded waveform data */
-static void update_namco_waveform(struct namco_sound *chip, int offset, UINT8 data)
+static void update_namco_waveform(namco_sound *chip, int offset, UINT8 data)
{
if (chip->wave_size == 1)
{
@@ -105,7 +117,7 @@ static void update_namco_waveform(struct namco_sound *chip, int offset, UINT8 da
/* build the decoded waveform table */
-static void build_decoded_waveform(struct namco_sound *chip, UINT8 *rgnbase)
+static void build_decoded_waveform(namco_sound *chip, UINT8 *rgnbase)
{
INT16 *p;
int size;
@@ -145,7 +157,7 @@ static void build_decoded_waveform(struct namco_sound *chip, UINT8 *rgnbase)
/* generate sound by oversampling */
-INLINE UINT32 namco_update_one(struct namco_sound *chip, stream_sample_t *buffer, int length, const INT16 *wave, UINT32 counter, UINT32 freq)
+INLINE UINT32 namco_update_one(namco_sound *chip, stream_sample_t *buffer, int length, const INT16 *wave, UINT32 counter, UINT32 freq)
{
while (length-- > 0)
{
@@ -160,7 +172,7 @@ INLINE UINT32 namco_update_one(struct namco_sound *chip, stream_sample_t *buffer
/* generate sound to the mix buffer in mono */
static STREAM_UPDATE( namco_update_mono )
{
- struct namco_sound *chip = param;
+ namco_sound *chip = param;
stream_sample_t *buffer = outputs[0];
sound_channel *voice;
@@ -243,7 +255,7 @@ static STREAM_UPDATE( namco_update_mono )
/* generate sound to the mix buffer in stereo */
static STREAM_UPDATE( namco_update_stereo )
{
- struct namco_sound *chip = param;
+ namco_sound *chip = param;
sound_channel *voice;
/* zap the contents of the buffers */
@@ -351,12 +363,12 @@ static STREAM_UPDATE( namco_update_stereo )
}
-static SND_START( namco )
+static DEVICE_START( namco )
{
sound_channel *voice;
const namco_interface *intf = device->static_config;
int clock_multiple;
- struct namco_sound *chip = device->token;
+ namco_sound *chip = get_safe_token(device);
/* extract globals from the interface */
chip->num_voices = intf->voices;
@@ -364,7 +376,7 @@ static SND_START( namco )
chip->stereo = intf->stereo;
/* adjust internal clock */
- chip->namco_clock = clock;
+ chip->namco_clock = device->clock;
for (clock_multiple = 0; chip->namco_clock < INTERNAL_RATE; clock_multiple++)
chip->namco_clock *= 2;
@@ -440,15 +452,15 @@ static SND_START( namco )
0x1f: ch 2 volume
*/
-WRITE8_HANDLER( pacman_sound_enable_w )
+WRITE8_DEVICE_HANDLER( pacman_sound_enable_w )
{
- struct namco_sound *chip = sndti_token(SOUND_NAMCO, 0);
+ namco_sound *chip = get_safe_token(device);
chip->sound_enable = data;
}
-WRITE8_HANDLER( pacman_sound_w )
+WRITE8_DEVICE_HANDLER( pacman_sound_w )
{
- struct namco_sound *chip = sndti_token(SOUND_NAMCO, 0);
+ namco_sound *chip = get_safe_token(device);
sound_channel *voice;
int ch;
@@ -537,15 +549,15 @@ it select the 54XX/52XX outputs on those channels
0x3f ch 7
*/
-void polepos_sound_enable(int enable)
+void polepos_sound_enable(const device_config *device, int enable)
{
- struct namco_sound *chip = sndti_token(SOUND_NAMCO, 0);
+ namco_sound *chip = get_safe_token(device);
chip->sound_enable = enable;
}
-WRITE8_HANDLER( polepos_sound_w )
+WRITE8_DEVICE_HANDLER( polepos_sound_w )
{
- struct namco_sound *chip = sndti_token(SOUND_NAMCO, 0);
+ namco_sound *chip = get_safe_token(device);
sound_channel *voice;
int ch;
@@ -615,15 +627,15 @@ WRITE8_HANDLER( polepos_sound_w )
0x3e ch 7 waveform select & frequency
*/
-void mappy_sound_enable(int enable)
+void mappy_sound_enable(const device_config *device, int enable)
{
- struct namco_sound *chip = sndti_token(SOUND_NAMCO_15XX, 0);
+ namco_sound *chip = get_safe_token(device);
chip->sound_enable = enable;
}
-WRITE8_HANDLER( namco_15xx_w )
+WRITE8_DEVICE_HANDLER( namco_15xx_w )
{
- struct namco_sound *chip = sndti_token(SOUND_NAMCO_15XX, 0);
+ namco_sound *chip = get_safe_token(device);
sound_channel *voice;
int ch;
@@ -687,9 +699,9 @@ WRITE8_HANDLER( namco_15xx_w )
0x3c ch 0 noise sw
*/
-static WRITE8_HANDLER( namcos1_sound_w )
+static WRITE8_DEVICE_HANDLER( namcos1_sound_w )
{
- struct namco_sound *chip = sndti_token(SOUND_NAMCO_CUS30, 0);
+ namco_sound *chip = device->token;
sound_channel *voice;
int ch;
int nssw;
@@ -746,13 +758,13 @@ static WRITE8_HANDLER( namcos1_sound_w )
}
}
-WRITE8_HANDLER( namcos1_cus30_w )
+WRITE8_DEVICE_HANDLER( namcos1_cus30_w )
{
if (offset < 0x100)
{
if (namco_wavedata[offset] != data)
{
- struct namco_sound *chip = sndti_token(SOUND_NAMCO_CUS30, 0);
+ namco_sound *chip = get_safe_token(device);
/* update the streams */
stream_update(chip->stream);
@@ -763,19 +775,19 @@ WRITE8_HANDLER( namcos1_cus30_w )
}
}
else if (offset < 0x140)
- namcos1_sound_w(space, offset - 0x100,data);
+ namcos1_sound_w(device, offset - 0x100,data);
else
namco_wavedata[offset] = data;
}
-READ8_HANDLER( namcos1_cus30_r )
+READ8_DEVICE_HANDLER( namcos1_cus30_r )
{
return namco_wavedata[offset];
}
-WRITE8_HANDLER( _20pacgal_wavedata_w )
+WRITE8_DEVICE_HANDLER( _20pacgal_wavedata_w )
{
- struct namco_sound *chip = sndti_token(SOUND_NAMCO, 0);
+ namco_sound *chip = get_safe_token(device);
if (namco_wavedata[offset] != data)
{
@@ -796,34 +808,24 @@ WRITE8_HANDLER( _20pacgal_wavedata_w )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( namco )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( namco )
+DEVICE_GET_INFO( namco )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct namco_sound); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(namco_sound); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( namco ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( namco ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( namco ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "Namco"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Namco custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "Namco"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Namco custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
@@ -831,34 +833,24 @@ SND_GET_INFO( namco )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( namco_15xx )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( namco_15xx )
+DEVICE_GET_INFO( namco_15xx )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct namco_sound); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(namco_sound); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( namco_15xx ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( namco ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( namco ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "Namco 15XX"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Namco custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "Namco 15XX"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Namco custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
@@ -866,34 +858,24 @@ SND_GET_INFO( namco_15xx )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( namco_cus30 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( namco_cus30 )
+DEVICE_GET_INFO( namco_cus30 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct namco_sound); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(namco_sound); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( namco_cus30 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( namco ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( namco ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "Namco CUS30"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Namco custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "Namco CUS30"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Namco custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/namco.h b/src/emu/sound/namco.h
index b80250d5eb7..d251e34abf3 100644
--- a/src/emu/sound/namco.h
+++ b/src/emu/sound/namco.h
@@ -10,19 +10,19 @@ struct _namco_interface
int stereo; /* set to 1 to indicate stereo (e.g., System 1) */
};
-WRITE8_HANDLER( pacman_sound_enable_w );
-WRITE8_HANDLER( pacman_sound_w );
+WRITE8_DEVICE_HANDLER( pacman_sound_enable_w );
+WRITE8_DEVICE_HANDLER( pacman_sound_w );
-void polepos_sound_enable(int enable);
-WRITE8_HANDLER( polepos_sound_w );
+void polepos_sound_enable(const device_config *device, int enable);
+WRITE8_DEVICE_HANDLER( polepos_sound_w );
-void mappy_sound_enable(int enable);
-WRITE8_HANDLER( namco_15xx_w );
+void mappy_sound_enable(const device_config *device, int enable);
+WRITE8_DEVICE_HANDLER( namco_15xx_w );
-WRITE8_HANDLER( namcos1_cus30_w ); /* wavedata + sound registers + RAM */
-READ8_HANDLER( namcos1_cus30_r );
+WRITE8_DEVICE_HANDLER( namcos1_cus30_w ); /* wavedata + sound registers + RAM */
+READ8_DEVICE_HANDLER( namcos1_cus30_r );
-WRITE8_HANDLER( _20pacgal_wavedata_w );
+WRITE8_DEVICE_HANDLER( _20pacgal_wavedata_w );
extern UINT8 *namco_soundregs;
extern UINT8 *namco_wavedata;
@@ -30,13 +30,13 @@ extern UINT8 *namco_wavedata;
#define pacman_soundregs namco_soundregs
#define polepos_soundregs namco_soundregs
-SND_GET_INFO( namco );
-SND_GET_INFO( namco_15xx );
-SND_GET_INFO( namco_cus30 );
+DEVICE_GET_INFO( namco );
+DEVICE_GET_INFO( namco_15xx );
+DEVICE_GET_INFO( namco_cus30 );
-#define SOUND_NAMCO SND_GET_INFO_NAME( namco )
-#define SOUND_NAMCO_15XX SND_GET_INFO_NAME( namco_15xx )
-#define SOUND_NAMCO_CUS30 SND_GET_INFO_NAME( namco_cus30 )
+#define SOUND_NAMCO DEVICE_GET_INFO_NAME( namco )
+#define SOUND_NAMCO_15XX DEVICE_GET_INFO_NAME( namco_15xx )
+#define SOUND_NAMCO_CUS30 DEVICE_GET_INFO_NAME( namco_cus30 )
#endif /* __NAMCO_H__ */
diff --git a/src/emu/sound/namco52.c b/src/emu/sound/namco52.c
index 8c50574627f..f94fd4a2a90 100644
--- a/src/emu/sound/namco52.c
+++ b/src/emu/sound/namco52.c
@@ -51,7 +51,8 @@ Jan 12, 2005. The 555 is probably an external playback frequency.
#include "namco52.h"
-struct namco_52xx
+typedef struct _namco_52xx namco_52xx;
+struct _namco_52xx
{
const namco_52xx_interface *intf; /* pointer to our config data */
UINT8 *rom; /* pointer to sample ROM */
@@ -69,12 +70,23 @@ struct namco_52xx
filter2_context n52_lp_filter;
};
-static void namco_52xx_reset(struct namco_52xx *chip);
+
+INLINE namco_52xx *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_NAMCO_52XX);
+ return (namco_52xx *)device->token;
+}
+
+
+static void namco_52xx_reset(namco_52xx *chip);
static STREAM_UPDATE( namco_52xx_stream_update_one )
{
- struct namco_52xx *chip = param;
+ namco_52xx *chip = param;
int i, rom_pos, whole_pb_cycles, buf;
stream_sample_t *buffer = outputs[0];
@@ -119,7 +131,7 @@ static STREAM_UPDATE( namco_52xx_stream_update_one )
}
}
-static void namco_52xx_reset(struct namco_52xx *chip)
+static void namco_52xx_reset(namco_52xx *chip)
{
chip->n52_pb_cycle = chip->n52_start = chip->n52_end = chip->n52_length = chip->n52_pos = 0;
@@ -127,15 +139,15 @@ static void namco_52xx_reset(struct namco_52xx *chip)
filter2_reset(&chip->n52_lp_filter);
}
-static SND_RESET( namco_52xx )
+static DEVICE_RESET( namco_52xx )
{
namco_52xx_reset(device->token);
}
-static SND_START( namco_52xx )
+static DEVICE_START( namco_52xx )
{
- struct namco_52xx *chip = device->token;
- int rate = clock/32;
+ namco_52xx *chip = device->token;
+ int rate = device->clock/32;
chip->intf = device->static_config;
chip->rom = device->region;
@@ -144,7 +156,7 @@ static SND_START( namco_52xx )
if (chip->intf->play_rate == 0)
{
/* If play clock is 0 (grounded) then default to internal clock */
- chip->n52_step = (double)clock / 384 / rate;
+ chip->n52_step = (double)device->clock / 384 / rate;
}
else
{
@@ -167,9 +179,9 @@ static SND_START( namco_52xx )
}
-void namcoio_52xx_write(int data)
+void namcoio_52xx_write(const device_config *device, int data)
{
- struct namco_52xx *chip = sndti_token(SOUND_NAMCO_52XX, 0);
+ namco_52xx *chip = get_safe_token(device);
data &= 0x0f;
if (data != 0)
@@ -194,34 +206,24 @@ void namcoio_52xx_write(int data)
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( namco_52xx )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( namco_52xx )
+DEVICE_GET_INFO( namco_52xx )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct namco_52xx); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(namco_52xx); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( namco_52xx ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( namco_52xx ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( namco_52xx ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( namco_52xx ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( namco_52xx ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "Namco 52XX"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Namco custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "Namco 52XX"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Namco custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/namco52.h b/src/emu/sound/namco52.h
index b19720451e0..b4f168de822 100644
--- a/src/emu/sound/namco52.h
+++ b/src/emu/sound/namco52.h
@@ -28,10 +28,10 @@ struct _namco_52xx_interface
double filt_gain;
};
-void namcoio_52xx_write(int data);
+void namcoio_52xx_write(const device_config *device, int data);
-SND_GET_INFO( namco_52xx );
-#define SOUND_NAMCO_52XX SND_GET_INFO_NAME( namco_52xx )
+DEVICE_GET_INFO( namco_52xx );
+#define SOUND_NAMCO_52XX DEVICE_GET_INFO_NAME( namco_52xx )
#endif /* __NAMCO52_H__ */
diff --git a/src/emu/sound/nes_apu.c b/src/emu/sound/nes_apu.c
index f544bb75c14..3d1c61298ae 100644
--- a/src/emu/sound/nes_apu.c
+++ b/src/emu/sound/nes_apu.c
@@ -58,7 +58,8 @@
#define SYNCS_MAX2 0x80
/* GLOBAL VARIABLES */
-struct nesapu_info
+typedef struct _nesapu_state nesapu_state;
+struct _nesapu_state
{
apu_t APU; /* Actual APUs */
float apu_incsize; /* Adjustment increment */
@@ -73,6 +74,15 @@ struct nesapu_info
};
+INLINE nesapu_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_NES);
+ return (nesapu_state *)device->token;
+}
+
/* INTERNAL FUNCTIONS */
/* INITIALIZE WAVE TIMES RELATIVE TO SAMPLE RATE */
@@ -85,7 +95,7 @@ static void create_vbltimes(uint32 * table,const uint8 *vbl,unsigned int rate)
}
/* INITIALIZE SAMPLE TIMES IN TERMS OF VSYNCS */
-static void create_syncs(struct nesapu_info *info, unsigned long sps)
+static void create_syncs(nesapu_state *info, unsigned long sps)
{
int i;
unsigned long val=sps;
@@ -125,7 +135,7 @@ static void create_noise(uint8 *buf, const int bits, int size)
/* TODO: sound channels should *ALL* have DC volume decay */
/* OUTPUT SQUARE WAVE SAMPLE (VALUES FROM -16 to +15) */
-static int8 apu_square(struct nesapu_info *info, square_t *chan)
+static int8 apu_square(nesapu_state *info, square_t *chan)
{
int env_delay;
int sweep_delay;
@@ -200,7 +210,7 @@ static int8 apu_square(struct nesapu_info *info, square_t *chan)
}
/* OUTPUT TRIANGLE WAVE SAMPLE (VALUES FROM -16 to +15) */
-static int8 apu_triangle(struct nesapu_info *info, triangle_t *chan)
+static int8 apu_triangle(nesapu_state *info, triangle_t *chan)
{
int freq;
int8 output;
@@ -258,7 +268,7 @@ static int8 apu_triangle(struct nesapu_info *info, triangle_t *chan)
}
/* OUTPUT NOISE WAVE SAMPLE (VALUES FROM -16 to +15) */
-static int8 apu_noise(struct nesapu_info *info, noise_t *chan)
+static int8 apu_noise(nesapu_state *info, noise_t *chan)
{
int freq, env_delay;
uint8 outvol;
@@ -337,7 +347,7 @@ INLINE void apu_dpcmreset(dpcm_t *chan)
/* OUTPUT DPCM WAVE SAMPLE (VALUES FROM -64 to +63) */
/* TODO: centerline naughtiness */
-static int8 apu_dpcm(struct nesapu_info *info, dpcm_t *chan)
+static int8 apu_dpcm(nesapu_state *info, dpcm_t *chan)
{
int freq, bit_pos;
@@ -401,7 +411,7 @@ static int8 apu_dpcm(struct nesapu_info *info, dpcm_t *chan)
}
/* WRITE REGISTER VALUE */
-INLINE void apu_regwrite(struct nesapu_info *info,int address, uint8 value)
+INLINE void apu_regwrite(nesapu_state *info,int address, uint8 value)
{
int chan = (address & 4) ? 1 : 0;
@@ -598,7 +608,7 @@ logerror("invalid apu write: $%02X at $%04X\n", value, address);
}
/* UPDATE SOUND BUFFER USING CURRENT DATA */
-INLINE void apu_update(struct nesapu_info *info, stream_sample_t *buffer16, int samples)
+INLINE void apu_update(nesapu_state *info, stream_sample_t *buffer16, int samples)
{
int accum;
@@ -621,9 +631,8 @@ INLINE void apu_update(struct nesapu_info *info, stream_sample_t *buffer16, int
}
/* READ VALUES FROM REGISTERS */
-INLINE uint8 apu_read(int chip,int address)
+INLINE uint8 apu_read(nesapu_state *info,int address)
{
- struct nesapu_info *info = sndti_token(SOUND_NES, chip);
if (address == 0x0f) /*FIXED* Address $4015 has different behaviour*/
{
int readval = 0;
@@ -643,9 +652,8 @@ INLINE uint8 apu_read(int chip,int address)
}
/* WRITE VALUE TO TEMP REGISTRY AND QUEUE EVENT */
-INLINE void apu_write(int chip,int address, uint8 value)
+INLINE void apu_write(nesapu_state *info,int address, uint8 value)
{
- struct nesapu_info *info = sndti_token(SOUND_NES, chip);
info->APU.regs[address]=value;
stream_update(info->stream);
apu_regwrite(info,address,value);
@@ -654,32 +662,30 @@ INLINE void apu_write(int chip,int address, uint8 value)
/* EXTERNAL INTERFACE FUNCTIONS */
/* REGISTER READ/WRITE FUNCTIONS */
-READ8_HANDLER( nes_psg_0_r ) {return apu_read(0,offset);}
-READ8_HANDLER( nes_psg_1_r ) {return apu_read(1,offset);}
-WRITE8_HANDLER( nes_psg_0_w ) {apu_write(0,offset,data);}
-WRITE8_HANDLER( nes_psg_1_w ) {apu_write(1,offset,data);}
+READ8_DEVICE_HANDLER( nes_psg_r ) {return apu_read(get_safe_token(device),offset);}
+WRITE8_DEVICE_HANDLER( nes_psg_w ) {apu_write(get_safe_token(device),offset,data);}
/* UPDATE APU SYSTEM */
static STREAM_UPDATE( nes_psg_update_sound )
{
- struct nesapu_info *info = param;
+ nesapu_state *info = param;
apu_update(info, outputs[0], samples);
}
/* INITIALIZE APU SYSTEM */
-static SND_START( nesapu )
+static DEVICE_START( nesapu )
{
const nes_interface *intf = device->static_config;
- struct nesapu_info *info = device->token;
- int rate = clock / 4;
+ nesapu_state *info = get_safe_token(device);
+ int rate = device->clock / 4;
int i;
/* Initialize global variables */
info->samps_per_sync = rate / ATTOSECONDS_TO_HZ(video_screen_get_frame_period(device->machine->primary_screen).attoseconds);
info->buffer_size = info->samps_per_sync;
info->real_rate = info->samps_per_sync * ATTOSECONDS_TO_HZ(video_screen_get_frame_period(device->machine->primary_screen).attoseconds);
- info->apu_incsize = (float) (clock / (float) info->real_rate);
+ info->apu_incsize = (float) (device->clock / (float) info->real_rate);
/* Use initializer calls */
create_noise(info->noise_lut, 13, NOISE_LONG);
@@ -755,34 +761,24 @@ static SND_START( nesapu )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( nesapu )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( nesapu )
+DEVICE_GET_INFO( nesapu )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct nesapu_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(nesapu_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( nesapu ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( nesapu ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( nesapu ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "N2A03"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Nintendo custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "N2A03"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Nintendo custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/nes_apu.h b/src/emu/sound/nes_apu.h
index 38447cf3b26..9fbf995ab3d 100644
--- a/src/emu/sound/nes_apu.h
+++ b/src/emu/sound/nes_apu.h
@@ -42,12 +42,10 @@ struct _nes_interface
const char *cpu_tag; /* CPU tag */
};
-READ8_HANDLER( nes_psg_0_r );
-READ8_HANDLER( nes_psg_1_r );
-WRITE8_HANDLER( nes_psg_0_w );
-WRITE8_HANDLER( nes_psg_1_w );
+READ8_DEVICE_HANDLER( nes_psg_r );
+WRITE8_DEVICE_HANDLER( nes_psg_w );
-SND_GET_INFO( nesapu );
-#define SOUND_NES SND_GET_INFO_NAME( nesapu )
+DEVICE_GET_INFO( nesapu );
+#define SOUND_NES DEVICE_GET_INFO_NAME( nesapu )
#endif /* __NES_APU_H__ */
diff --git a/src/emu/sound/nile.c b/src/emu/sound/nile.c
index d86f0ac4c9d..68629460d88 100644
--- a/src/emu/sound/nile.c
+++ b/src/emu/sound/nile.c
@@ -56,7 +56,8 @@ enum
UINT16 *nile_sound_regs;
-struct nile_info
+typedef struct _nile_state nile_state;
+struct _nile_state
{
sound_stream * stream;
UINT8 *sound_ram;
@@ -64,9 +65,19 @@ struct nile_info
UINT16 ctrl;
};
-WRITE16_HANDLER(nile_sndctrl_w)
+INLINE nile_state *get_safe_token(const device_config *device)
{
- struct nile_info *info = sndti_token(SOUND_NILE, 0);
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_NILE);
+ return (nile_state *)device->token;
+}
+
+
+WRITE16_DEVICE_HANDLER( nile_sndctrl_w )
+{
+ nile_state *info = get_safe_token(device);
UINT16 ctrl=info->ctrl;
stream_update(info->stream);
@@ -78,18 +89,18 @@ WRITE16_HANDLER(nile_sndctrl_w)
ctrl^=info->ctrl;
}
-READ16_HANDLER(nile_sndctrl_r)
+READ16_DEVICE_HANDLER( nile_sndctrl_r )
{
- struct nile_info *info = sndti_token(SOUND_NILE, 0);
+ nile_state *info = get_safe_token(device);
stream_update(info->stream);
return info->ctrl;
}
-READ16_HANDLER(nile_snd_r)
+READ16_DEVICE_HANDLER( nile_snd_r )
{
- struct nile_info *info = sndti_token(SOUND_NILE, 0);
+ nile_state *info = get_safe_token(device);
int reg=offset&0xf;
stream_update(info->stream);
@@ -111,9 +122,9 @@ READ16_HANDLER(nile_snd_r)
return nile_sound_regs[offset];
}
-WRITE16_HANDLER(nile_snd_w)
+WRITE16_DEVICE_HANDLER( nile_snd_w )
{
- struct nile_info *info = sndti_token(SOUND_NILE, 0);
+ nile_state *info = get_safe_token(device);
int v, r;
stream_update(info->stream);
@@ -133,7 +144,7 @@ WRITE16_HANDLER(nile_snd_w)
static STREAM_UPDATE( nile_update )
{
- struct nile_info *info = param;
+ nile_state *info = param;
UINT8 *sound_ram = info->sound_ram;
int v, i, snum;
UINT16 *slot;
@@ -216,9 +227,9 @@ static STREAM_UPDATE( nile_update )
}
}
-static SND_START( nile )
+static DEVICE_START( nile )
{
- struct nile_info *info = device->token;
+ nile_state *info = get_safe_token(device);
info->sound_ram = device->region;
@@ -231,34 +242,24 @@ static SND_START( nile )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( nile )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( nile )
+DEVICE_GET_INFO( nile )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct nile_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(nile_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( nile ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( nile ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( nile ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "NiLe"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Seta custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "NiLe"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Seta custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/nile.h b/src/emu/sound/nile.h
index 2f79eb0352e..840dda109ef 100644
--- a/src/emu/sound/nile.h
+++ b/src/emu/sound/nile.h
@@ -5,12 +5,12 @@
extern UINT16 *nile_sound_regs;
-WRITE16_HANDLER(nile_snd_w);
-READ16_HANDLER(nile_snd_r);
-WRITE16_HANDLER(nile_sndctrl_w);
-READ16_HANDLER(nile_sndctrl_r);
+WRITE16_DEVICE_HANDLER( nile_snd_w );
+READ16_DEVICE_HANDLER( nile_snd_r );
+WRITE16_DEVICE_HANDLER( nile_sndctrl_w );
+READ16_DEVICE_HANDLER( nile_sndctrl_r );
-SND_GET_INFO( nile );
-#define SOUND_NILE SND_GET_INFO_NAME( nile )
+DEVICE_GET_INFO( nile );
+#define SOUND_NILE DEVICE_GET_INFO_NAME( nile )
#endif /* __NILE_H__ */
diff --git a/src/emu/sound/okim6258.c b/src/emu/sound/okim6258.c
index b5a3af3f29a..0e7a4952c2a 100644
--- a/src/emu/sound/okim6258.c
+++ b/src/emu/sound/okim6258.c
@@ -24,7 +24,8 @@
static const int dividers[4] = { 1024, 768, 512, 512 };
-struct okim6258
+typedef struct _okim6258_state okim6258_state;
+struct _okim6258_state
{
UINT8 status;
@@ -50,6 +51,15 @@ static int diff_lookup[49*16];
/* tables computed? */
static int tables_computed = 0;
+INLINE okim6258_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_OKIM6258);
+ return (okim6258_state *)device->token;
+}
+
/**********************************************************************************************
compute_tables -- compute the difference tables
@@ -90,7 +100,7 @@ static void compute_tables(void)
}
-static INT16 clock_adpcm(struct okim6258 *chip, UINT8 nibble)
+static INT16 clock_adpcm(okim6258_state *chip, UINT8 nibble)
{
INT32 max = (1 << (chip->output_bits - 1)) - 1;
INT32 min = -(1 << (chip->output_bits - 1));
@@ -122,7 +132,7 @@ static INT16 clock_adpcm(struct okim6258 *chip, UINT8 nibble)
static STREAM_UPDATE( okim6258_update )
{
- struct okim6258 *chip = param;
+ okim6258_state *chip = param;
stream_sample_t *buffer = outputs[0];
memset(outputs[0], 0, samples * sizeof(*outputs[0]));
@@ -164,7 +174,7 @@ static STREAM_UPDATE( okim6258_update )
***********************************************************************************************/
-static void okim6258_state_save_register(struct okim6258 *info, const device_config *device)
+static void okim6258_state_save_register(okim6258_state *info, const device_config *device)
{
state_save_register_device_item(device, 0, info->status);
state_save_register_device_item(device, 0, info->master_clock);
@@ -182,21 +192,21 @@ static void okim6258_state_save_register(struct okim6258 *info, const device_con
***********************************************************************************************/
-static SND_START( okim6258 )
+static DEVICE_START( okim6258 )
{
const okim6258_interface *intf = device->static_config;
- struct okim6258 *info = device->token;
+ okim6258_state *info = get_safe_token(device);
compute_tables();
- info->master_clock = clock;
+ info->master_clock = device->clock;
info->adpcm_type = intf->adpcm_type;
/* D/A precision is 10-bits but 12-bit data can be output serially to an external DAC */
info->output_bits = intf->output_12bits ? 12 : 10;
info->divider = dividers[intf->divider];
- info->stream = stream_create(device, 0, 1, clock/info->divider, info, okim6258_update);
+ info->stream = stream_create(device, 0, 1, device->clock/info->divider, info, okim6258_update);
info->signal = -2;
info->step = 0;
@@ -211,9 +221,9 @@ static SND_START( okim6258 )
***********************************************************************************************/
-static SND_RESET( okim6258 )
+static DEVICE_RESET( okim6258 )
{
- struct okim6258 *info = device->token;
+ okim6258_state *info = get_safe_token(device);
stream_update(info->stream);
@@ -229,9 +239,9 @@ static SND_RESET( okim6258 )
***********************************************************************************************/
-void okim6258_set_divider(int which, int val)
+void okim6258_set_divider(const device_config *device, int val)
{
- struct okim6258 *info = sndti_token(SOUND_OKIM6258, which);
+ okim6258_state *info = get_safe_token(device);
int divider = dividers[val];
info->divider = dividers[val];
@@ -245,9 +255,9 @@ void okim6258_set_divider(int which, int val)
***********************************************************************************************/
-void okim6258_set_clock(int which, int val)
+void okim6258_set_clock(const device_config *device, int val)
{
- struct okim6258 *info = sndti_token(SOUND_OKIM6258, which);
+ okim6258_state *info = get_safe_token(device);
info->master_clock = val;
stream_set_sample_rate(info->stream, info->master_clock / info->divider);
@@ -260,9 +270,9 @@ void okim6258_set_clock(int which, int val)
***********************************************************************************************/
-int okim6258_get_vclk(int which)
+int okim6258_get_vclk(const device_config *device)
{
- struct okim6258 *info = sndti_token(SOUND_OKIM6258, which);
+ okim6258_state *info = get_safe_token(device);
return (info->master_clock / info->divider);
}
@@ -274,9 +284,9 @@ int okim6258_get_vclk(int which)
***********************************************************************************************/
-static int okim6258_status_r(int num)
+READ8_DEVICE_HANDLER( okim6258_status_r )
{
- struct okim6258 *info = sndti_token(SOUND_OKIM6258, num);
+ okim6258_state *info = get_safe_token(device);
stream_update(info->stream);
@@ -289,9 +299,9 @@ static int okim6258_status_r(int num)
okim6258_data_w -- write to the control port of an OKIM6258-compatible chip
***********************************************************************************************/
-static void okim6258_data_w(int num, int data)
+WRITE8_DEVICE_HANDLER( okim6258_data_w )
{
- struct okim6258 *info = sndti_token(SOUND_OKIM6258, num);
+ okim6258_state *info = get_safe_token(device);
/* update the stream */
stream_update(info->stream);
@@ -307,9 +317,9 @@ static void okim6258_data_w(int num, int data)
***********************************************************************************************/
-static void okim6258_ctrl_w(int num, int data)
+WRITE8_DEVICE_HANDLER( okim6258_ctrl_w )
{
- struct okim6258 *info = sndti_token(SOUND_OKIM6258, num);
+ okim6258_state *info = get_safe_token(device);
stream_update(info->stream);
@@ -348,142 +358,30 @@ static void okim6258_ctrl_w(int num, int data)
}
-/**********************************************************************************************
-
- okim6258_status_0_r -- generic status read functions
-
-***********************************************************************************************/
-
-READ8_HANDLER( okim6258_status_0_r )
-{
- return okim6258_status_r(0);
-}
-
-READ16_HANDLER( okim6258_status_0_lsb_r )
-{
- return okim6258_status_r(0);
-}
-
-READ16_HANDLER( okim6258_status_0_msb_r )
-{
- return okim6258_status_r(0) << 8;
-}
-
-READ8_HANDLER( okim6258_data_0_r )
-{
- // TODO
- return 0;
-}
-
-READ16_HANDLER( okim6258_data_0_lsb_r )
-{
- // TODO
- return 0;
-}
-
-READ16_HANDLER( okim6258_data_0_msb_r )
-{
- // TODO
- return 0;
-}
-
-/**********************************************************************************************
-
- okim6258_data_0_w -- generic data write functions
- okim6258_data_1_w
-
-***********************************************************************************************/
-
-WRITE8_HANDLER( okim6258_data_0_w )
-{
- okim6258_data_w(0, data);
-}
-
-WRITE8_HANDLER( okim6258_data_1_w )
-{
- okim6258_data_w(1, data);
-}
-
-WRITE8_HANDLER( okim6258_data_2_w )
-{
- okim6258_data_w(2, data);
-}
-
-WRITE16_HANDLER( okim6258_data_0_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- okim6258_data_w(0, data & 0xff);
-}
-
-WRITE16_HANDLER( okim6258_data_1_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- okim6258_data_w(1, data & 0xff);
-}
-
-WRITE16_HANDLER( okim6258_data_2_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- okim6258_data_w(2, data & 0xff);
-}
-
-WRITE16_HANDLER( okim6258_data_0_msb_w )
-{
- if (ACCESSING_BITS_8_15)
- okim6258_data_w(0, data >> 8);
-}
-
-WRITE16_HANDLER( okim6258_data_1_msb_w )
-{
- if (ACCESSING_BITS_8_15)
- okim6258_data_w(1, data >> 8);
-}
-
-WRITE16_HANDLER( okim6258_data_2_msb_w )
-{
- if (ACCESSING_BITS_8_15)
- okim6258_data_w(2, data >> 8);
-}
-
-WRITE16_HANDLER( okim6258_ctrl_0_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- okim6258_ctrl_w(0, data & 0xff);
-}
/**************************************************************************
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( okim6258 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( okim6258 )
+DEVICE_GET_INFO( okim6258 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct okim6258); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(okim6258_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME(okim6258); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME(okim6258); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME(okim6258); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(okim6258); break;
+ case DEVINFO_FCT_STOP: /* nothing */ break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(okim6258); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "OKI6258"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "OKI ADPCM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "OKI6258"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "OKI ADPCM"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/okim6258.h b/src/emu/sound/okim6258.h
index 786ac7cc452..f0ed30b4322 100644
--- a/src/emu/sound/okim6258.h
+++ b/src/emu/sound/okim6258.h
@@ -5,6 +5,7 @@
/* an interface for the OKIM6258 and similar chips */
+typedef struct _okim6258_interface okim6258_interface;
struct _okim6258_interface
{
int divider;
@@ -12,7 +13,6 @@ struct _okim6258_interface
int output_12bits;
};
-typedef struct _okim6258_interface okim6258_interface;
#define FOSC_DIV_BY_1024 0
#define FOSC_DIV_BY_768 1
@@ -24,28 +24,16 @@ typedef struct _okim6258_interface okim6258_interface;
#define OUTPUT_10BITS 0
#define OUTPUT_12BITS 1
-void okim6258_set_divider(int which, int val);
-void okim6258_set_clock(int which, int val);
-int okim6258_get_vclk(int which);
-
-READ8_HANDLER( okim6258_status_0_r );
-READ16_HANDLER( okim6258_status_0_lsb_r );
-READ16_HANDLER( okim6258_status_0_msb_r );
-READ8_HANDLER( okim6258_data_0_r );
-READ16_HANDLER( okim6258_data_0_lsb_r );
-READ16_HANDLER( okim6258_data_0_msb_r );
-WRITE8_HANDLER( okim6258_data_0_w );
-WRITE8_HANDLER( okim6258_data_1_w );
-WRITE8_HANDLER( okim6258_data_2_w );
-WRITE16_HANDLER( okim6258_data_0_lsb_w );
-WRITE16_HANDLER( okim6258_data_1_lsb_w );
-WRITE16_HANDLER( okim6258_data_2_lsb_w );
-WRITE16_HANDLER( okim6258_data_0_msb_w );
-WRITE16_HANDLER( okim6258_data_1_msb_w );
-WRITE16_HANDLER( okim6258_data_2_msb_w );
-WRITE16_HANDLER( okim6258_ctrl_0_lsb_w );
-
-SND_GET_INFO( okim6258 );
-#define SOUND_OKIM6258 SND_GET_INFO_NAME( okim6258 )
+void okim6258_set_divider(const device_config *device, int val);
+void okim6258_set_clock(const device_config *device, int val);
+int okim6258_get_vclk(const device_config *device);
+
+READ8_DEVICE_HANDLER( okim6258_status_r );
+READ8_DEVICE_HANDLER( okim6258_data_r );
+WRITE8_DEVICE_HANDLER( okim6258_data_w );
+WRITE8_DEVICE_HANDLER( okim6258_ctrl_w );
+
+DEVICE_GET_INFO( okim6258 );
+#define SOUND_OKIM6258 DEVICE_GET_INFO_NAME( okim6258 )
#endif /* __OKIM6258_H__ */
diff --git a/src/emu/sound/okim6295.c b/src/emu/sound/okim6295.c
index 8d120899e7b..c39becd72d8 100644
--- a/src/emu/sound/okim6295.c
+++ b/src/emu/sound/okim6295.c
@@ -43,7 +43,8 @@ struct ADPCMVoice
UINT32 volume; /* output volume */
};
-struct okim6295
+typedef struct _okim6295_state okim6295_state;
+struct _okim6295_state
{
#define OKIM6295_VOICES 4
struct ADPCMVoice voice[OKIM6295_VOICES];
@@ -91,6 +92,15 @@ const okim6295_interface okim6295_interface_pin7high = { 1 };
const okim6295_interface okim6295_interface_pin7low = { 0 };
+INLINE okim6295_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_OKIM6295);
+ return (okim6295_state *)device->token;
+}
+
/**********************************************************************************************
@@ -187,7 +197,7 @@ INT16 clock_adpcm(struct adpcm_state *state, UINT8 nibble)
***********************************************************************************************/
-static void generate_adpcm(struct okim6295 *chip, struct ADPCMVoice *voice, INT16 *buffer, int samples)
+static void generate_adpcm(okim6295_state *chip, struct ADPCMVoice *voice, INT16 *buffer, int samples)
{
/* if this voice is active */
if (voice->playing)
@@ -253,7 +263,7 @@ static void generate_adpcm(struct okim6295 *chip, struct ADPCMVoice *voice, INT1
static STREAM_UPDATE( okim6295_update )
{
- struct okim6295 *chip = param;
+ okim6295_state *chip = param;
int i;
memset(outputs[0], 0, samples * sizeof(*outputs[0]));
@@ -299,7 +309,7 @@ static void adpcm_state_save_register(struct ADPCMVoice *voice, const device_con
state_save_register_device_item(device, index, voice->base_offset);
}
-static void okim6295_state_save_register(struct okim6295 *info, const device_config *device)
+static void okim6295_state_save_register(okim6295_state *info, const device_config *device)
{
int j;
@@ -313,14 +323,14 @@ static void okim6295_state_save_register(struct okim6295 *info, const device_con
/**********************************************************************************************
- SND_START( okim6295 ) -- start emulation of an OKIM6295-compatible chip
+ DEVICE_START( okim6295 ) -- start emulation of an OKIM6295-compatible chip
***********************************************************************************************/
-static SND_START( okim6295 )
+static DEVICE_START( okim6295 )
{
const okim6295_interface *intf = device->static_config;
- struct okim6295 *info = device->token;
+ okim6295_state *info = get_safe_token(device);
int voice;
int divisor = intf->pin7 ? 132 : 165;
@@ -332,10 +342,10 @@ static SND_START( okim6295 )
if (intf->rgnoverride != NULL)
info->region_base = memory_region(device->machine, intf->rgnoverride);
- info->master_clock = clock;
+ info->master_clock = device->clock;
/* generate the name and create the stream */
- info->stream = stream_create(device, 0, 1, clock/divisor, info, okim6295_update);
+ info->stream = stream_create(device, 0, 1, device->clock/divisor, info, okim6295_update);
/* initialize the voices */
for (voice = 0; voice < OKIM6295_VOICES; voice++)
@@ -352,13 +362,13 @@ static SND_START( okim6295 )
/**********************************************************************************************
- SND_RESET( okim6295 ) -- stop emulation of an OKIM6295-compatible chip
+ DEVICE_RESET( okim6295 ) -- stop emulation of an OKIM6295-compatible chip
***********************************************************************************************/
-static SND_RESET( okim6295 )
+static DEVICE_RESET( okim6295 )
{
- struct okim6295 *info = device->token;
+ okim6295_state *info = get_safe_token(device);
int i;
stream_update(info->stream);
@@ -374,9 +384,9 @@ static SND_RESET( okim6295 )
***********************************************************************************************/
-void okim6295_set_bank_base(int which, int base)
+void okim6295_set_bank_base(const device_config *device, int base)
{
- struct okim6295 *info = sndti_token(SOUND_OKIM6295, which);
+ okim6295_state *info = get_safe_token(device);
stream_update(info->stream);
info->bank_offset = base;
}
@@ -389,9 +399,9 @@ void okim6295_set_bank_base(int which, int base)
***********************************************************************************************/
-void okim6295_set_pin7(int which, int pin7)
+void okim6295_set_pin7(const device_config *device, int pin7)
{
- struct okim6295 *info = sndti_token(SOUND_OKIM6295, which);
+ okim6295_state *info = get_safe_token(device);
int divisor = pin7 ? 132 : 165;
stream_set_sample_rate(info->stream, info->master_clock/divisor);
@@ -404,9 +414,9 @@ void okim6295_set_pin7(int which, int pin7)
***********************************************************************************************/
-static int okim6295_status_r(int num)
+READ8_DEVICE_HANDLER( okim6295_r )
{
- struct okim6295 *info = sndti_token(SOUND_OKIM6295, num);
+ okim6295_state *info = get_safe_token(device);
int i, result;
result = 0xf0; /* naname expects bits 4-7 to be 1 */
@@ -433,9 +443,9 @@ static int okim6295_status_r(int num)
***********************************************************************************************/
-static void okim6295_data_w(int num, int data)
+WRITE8_DEVICE_HANDLER( okim6295_w )
{
- struct okim6295 *info = sndti_token(SOUND_OKIM6295, num);
+ okim6295_state *info = get_safe_token(device);
/* if a command is pending, process the second half */
if (info->command != -1)
@@ -479,13 +489,13 @@ static void okim6295_data_w(int num, int data)
}
else
{
- logerror("OKIM6295:%d requested to play sample %02x on non-stopped voice\n",num,info->command);
+ logerror("OKIM6295:'%s' requested to play sample %02x on non-stopped voice\n",device->tag,info->command);
}
}
/* invalid samples go here */
else
{
- logerror("OKIM6295:%d requested to play invalid sample %02x\n",num,info->command);
+ logerror("OKIM6295:'%s' requested to play invalid sample %02x\n",device->tag,info->command);
voice->playing = 0;
}
}
@@ -524,152 +534,27 @@ static void okim6295_data_w(int num, int data)
-/**********************************************************************************************
-
- okim6295_status_0_r -- generic status read functions
- okim6295_status_1_r
-
-***********************************************************************************************/
-
-READ8_HANDLER( okim6295_status_0_r )
-{
- return okim6295_status_r(0);
-}
-
-READ8_HANDLER( okim6295_status_1_r )
-{
- return okim6295_status_r(1);
-}
-
-READ8_HANDLER( okim6295_status_2_r )
-{
- return okim6295_status_r(2);
-}
-
-READ16_HANDLER( okim6295_status_0_lsb_r )
-{
- return okim6295_status_r(0);
-}
-
-READ16_HANDLER( okim6295_status_1_lsb_r )
-{
- return okim6295_status_r(1);
-}
-
-READ16_HANDLER( okim6295_status_2_lsb_r )
-{
- return okim6295_status_r(2);
-}
-
-READ16_HANDLER( okim6295_status_0_msb_r )
-{
- return okim6295_status_r(0) << 8;
-}
-
-READ16_HANDLER( okim6295_status_1_msb_r )
-{
- return okim6295_status_r(1) << 8;
-}
-
-READ16_HANDLER( okim6295_status_2_msb_r )
-{
- return okim6295_status_r(2) << 8;
-}
-
-
-
-/**********************************************************************************************
-
- okim6295_data_0_w -- generic data write functions
- okim6295_data_1_w
-
-***********************************************************************************************/
-
-WRITE8_HANDLER( okim6295_data_0_w )
-{
- okim6295_data_w(0, data);
-}
-
-WRITE8_HANDLER( okim6295_data_1_w )
-{
- okim6295_data_w(1, data);
-}
-
-WRITE8_HANDLER( okim6295_data_2_w )
-{
- okim6295_data_w(2, data);
-}
-
-WRITE16_HANDLER( okim6295_data_0_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- okim6295_data_w(0, data & 0xff);
-}
-
-WRITE16_HANDLER( okim6295_data_1_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- okim6295_data_w(1, data & 0xff);
-}
-
-WRITE16_HANDLER( okim6295_data_2_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- okim6295_data_w(2, data & 0xff);
-}
-
-WRITE16_HANDLER( okim6295_data_0_msb_w )
-{
- if (ACCESSING_BITS_8_15)
- okim6295_data_w(0, data >> 8);
-}
-
-WRITE16_HANDLER( okim6295_data_1_msb_w )
-{
- if (ACCESSING_BITS_8_15)
- okim6295_data_w(1, data >> 8);
-}
-
-WRITE16_HANDLER( okim6295_data_2_msb_w )
-{
- if (ACCESSING_BITS_8_15)
- okim6295_data_w(2, data >> 8);
-}
-
-
-
/**************************************************************************
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( okim6295 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( okim6295 )
+DEVICE_GET_INFO( okim6295 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct okim6295); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(okim6295_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( okim6295 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( okim6295 ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( okim6295 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( okim6295 ); break;
+ case DEVINFO_FCT_STOP: /* nothing */ break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( okim6295 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "OKI6295"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "OKI ADPCM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "OKI6295"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "OKI ADPCM"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
-
diff --git a/src/emu/sound/okim6295.h b/src/emu/sound/okim6295.h
index b52e6aa0887..d9e27938eca 100644
--- a/src/emu/sound/okim6295.h
+++ b/src/emu/sound/okim6295.h
@@ -21,27 +21,11 @@ extern const okim6295_interface okim6295_interface_pin7low;
-void okim6295_set_bank_base(int which, int base);
-void okim6295_set_pin7(int which, int pin7);
-
-READ8_HANDLER( okim6295_status_0_r );
-READ8_HANDLER( okim6295_status_1_r );
-READ8_HANDLER( okim6295_status_2_r );
-READ16_HANDLER( okim6295_status_0_lsb_r );
-READ16_HANDLER( okim6295_status_1_lsb_r );
-READ16_HANDLER( okim6295_status_2_lsb_r );
-READ16_HANDLER( okim6295_status_0_msb_r );
-READ16_HANDLER( okim6295_status_1_msb_r );
-READ16_HANDLER( okim6295_status_2_msb_r );
-WRITE8_HANDLER( okim6295_data_0_w );
-WRITE8_HANDLER( okim6295_data_1_w );
-WRITE8_HANDLER( okim6295_data_2_w );
-WRITE16_HANDLER( okim6295_data_0_lsb_w );
-WRITE16_HANDLER( okim6295_data_1_lsb_w );
-WRITE16_HANDLER( okim6295_data_2_lsb_w );
-WRITE16_HANDLER( okim6295_data_0_msb_w );
-WRITE16_HANDLER( okim6295_data_1_msb_w );
-WRITE16_HANDLER( okim6295_data_2_msb_w );
+void okim6295_set_bank_base(const device_config *device, int base);
+void okim6295_set_pin7(const device_config *device, int pin7);
+
+READ8_DEVICE_HANDLER( okim6295_r );
+WRITE8_DEVICE_HANDLER( okim6295_w );
/*
To help the various custom ADPCM generators out there,
@@ -55,7 +39,7 @@ struct adpcm_state
void reset_adpcm(struct adpcm_state *state);
INT16 clock_adpcm(struct adpcm_state *state, UINT8 nibble);
-SND_GET_INFO( okim6295 );
-#define SOUND_OKIM6295 SND_GET_INFO_NAME( okim6295 )
+DEVICE_GET_INFO( okim6295 );
+#define SOUND_OKIM6295 DEVICE_GET_INFO_NAME( okim6295 )
#endif /* __OKIM6295_H__ */
diff --git a/src/emu/sound/okim6376.c b/src/emu/sound/okim6376.c
index 8b12c535597..d95a4e44c1d 100644
--- a/src/emu/sound/okim6376.c
+++ b/src/emu/sound/okim6376.c
@@ -34,7 +34,8 @@ struct ADPCMVoice
INT32 step;
};
-struct okim6376
+typedef struct _okim6376_state okim6376_state;
+struct _okim6376_state
{
#define OKIM6376_VOICES 2
struct ADPCMVoice voice[OKIM6376_VOICES];
@@ -64,6 +65,16 @@ static int volume_table[4] =
static int tables_computed = 0;
+INLINE okim6376_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_OKIM6376);
+ return (okim6376_state *)device->token;
+}
+
+
/**********************************************************************************************
@@ -160,7 +171,7 @@ static INT16 clock_adpcm(struct ADPCMVoice *voice, UINT8 nibble)
***********************************************************************************************/
-static void generate_adpcm(struct okim6376 *chip, struct ADPCMVoice *voice, INT16 *buffer, int samples)
+static void generate_adpcm(okim6376_state *chip, struct ADPCMVoice *voice, INT16 *buffer, int samples)
{
/* if this voice is active */
if (voice->playing)
@@ -224,7 +235,7 @@ static void generate_adpcm(struct okim6376 *chip, struct ADPCMVoice *voice, INT1
static STREAM_UPDATE( okim6376_update )
{
- struct okim6376 *chip = param;
+ okim6376_state *chip = param;
int i;
memset(outputs[0], 0, samples * sizeof(*outputs[0]));
@@ -270,7 +281,7 @@ static void adpcm_state_save_register(struct ADPCMVoice *voice, const device_con
state_save_register_device_item(device, index, voice->base_offset);
}
-static void okim6376_state_save_register(struct okim6376 *info, const device_config *device)
+static void okim6376_state_save_register(okim6376_state *info, const device_config *device)
{
int j;
@@ -283,13 +294,13 @@ static void okim6376_state_save_register(struct okim6376 *info, const device_con
/**********************************************************************************************
- SND_START( okim6376 ) -- start emulation of an OKIM6376-compatible chip
+ DEVICE_START( okim6376 ) -- start emulation of an OKIM6376-compatible chip
***********************************************************************************************/
-static SND_START( okim6376 )
+static DEVICE_START( okim6376 )
{
- struct okim6376 *info = device->token;
+ okim6376_state *info = get_safe_token(device);
int voice;
int divisor = 165;
@@ -297,10 +308,10 @@ static SND_START( okim6376 )
info->command = -1;
info->region_base = device->region;
- info->master_clock = clock;
+ info->master_clock = device->clock;
/* generate the name and create the stream */
- info->stream = stream_create(device, 0, 1, clock/divisor, info, okim6376_update);
+ info->stream = stream_create(device, 0, 1, device->clock/divisor, info, okim6376_update);
/* initialize the voices */
for (voice = 0; voice < OKIM6376_VOICES; voice++)
@@ -317,13 +328,13 @@ static SND_START( okim6376 )
/**********************************************************************************************
- SND_RESET( okim6376 ) -- stop emulation of an OKIM6376-compatible chip
+ DEVICE_RESET( okim6376 ) -- stop emulation of an OKIM6376-compatible chip
***********************************************************************************************/
-static SND_RESET( okim6376 )
+static DEVICE_RESET( okim6376 )
{
- struct okim6376 *info = device->token;
+ okim6376_state *info = get_safe_token(device);
int i;
stream_update(info->stream);
@@ -340,9 +351,9 @@ static SND_RESET( okim6376 )
***********************************************************************************************/
-static int okim6376_status_r(int num)
+READ8_DEVICE_HANDLER( okim6376_r )
{
- struct okim6376 *info = sndti_token(SOUND_OKIM6376, num);
+ okim6376_state *info = get_safe_token(device);
int i, result;
result = 0xff;
@@ -369,9 +380,9 @@ static int okim6376_status_r(int num)
***********************************************************************************************/
-static void okim6376_data_w(int num, int data)
+WRITE8_DEVICE_HANDLER( okim6376_w )
{
- struct okim6376 *info = sndti_token(SOUND_OKIM6376, num);
+ okim6376_state *info = get_safe_token(device);
/* if a command is pending, process the second half */
if (info->command != -1)
@@ -420,7 +431,7 @@ static void okim6376_data_w(int num, int data)
}
else
{
- logerror("OKIM6376:%d requested to play sample %02x on non-stopped voice\n",num,info->command);
+ logerror("OKIM6376:'%s' requested to play sample %02x on non-stopped voice\n",device->tag,info->command);
}
}
}
@@ -461,152 +472,28 @@ static void okim6376_data_w(int num, int data)
-/**********************************************************************************************
-
- okim6376_status_0_r -- generic status read functions
- okim6376_status_1_r
-
-***********************************************************************************************/
-
-READ8_HANDLER( okim6376_status_0_r )
-{
- return okim6376_status_r(0);
-}
-
-READ8_HANDLER( okim6376_status_1_r )
-{
- return okim6376_status_r(1);
-}
-
-READ8_HANDLER( okim6376_status_2_r )
-{
- return okim6376_status_r(2);
-}
-
-READ16_HANDLER( okim6376_status_0_lsb_r )
-{
- return okim6376_status_r(0);
-}
-
-READ16_HANDLER( okim6376_status_1_lsb_r )
-{
- return okim6376_status_r(1);
-}
-
-READ16_HANDLER( okim6376_status_2_lsb_r )
-{
- return okim6376_status_r(2);
-}
-
-READ16_HANDLER( okim6376_status_0_msb_r )
-{
- return okim6376_status_r(0) << 8;
-}
-
-READ16_HANDLER( okim6376_status_1_msb_r )
-{
- return okim6376_status_r(1) << 8;
-}
-
-READ16_HANDLER( okim6376_status_2_msb_r )
-{
- return okim6376_status_r(2) << 8;
-}
-
-
-
-/**********************************************************************************************
-
- okim6376_data_0_w -- generic data write functions
- okim6376_data_1_w
-
-***********************************************************************************************/
-
-WRITE8_HANDLER( okim6376_data_0_w )
-{
- okim6376_data_w(0, data);
-}
-
-WRITE8_HANDLER( okim6376_data_1_w )
-{
- okim6376_data_w(1, data);
-}
-
-WRITE8_HANDLER( okim6376_data_2_w )
-{
- okim6376_data_w(2, data);
-}
-
-WRITE16_HANDLER( okim6376_data_0_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- okim6376_data_w(0, data & 0xff);
-}
-
-WRITE16_HANDLER( okim6376_data_1_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- okim6376_data_w(1, data & 0xff);
-}
-
-WRITE16_HANDLER( okim6376_data_2_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- okim6376_data_w(2, data & 0xff);
-}
-
-WRITE16_HANDLER( okim6376_data_0_msb_w )
-{
- if (ACCESSING_BITS_8_15)
- okim6376_data_w(0, data >> 8);
-}
-
-WRITE16_HANDLER( okim6376_data_1_msb_w )
-{
- if (ACCESSING_BITS_8_15)
- okim6376_data_w(1, data >> 8);
-}
-
-WRITE16_HANDLER( okim6376_data_2_msb_w )
-{
- if (ACCESSING_BITS_8_15)
- okim6376_data_w(2, data >> 8);
-}
-
-
-
/**************************************************************************
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( okim6376 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( okim6376 )
+DEVICE_GET_INFO( okim6376 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct okim6376); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(okim6376_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( okim6376 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( okim6376 ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( okim6376 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( okim6376 ); break;
+ case DEVINFO_FCT_STOP: /* nothing */ break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( okim6376 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "OKI6376"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "OKI ADPCM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "OKI6376"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "OKI ADPCM"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/okim6376.h b/src/emu/sound/okim6376.h
index 2554ab0e37f..bf38fccc6ec 100644
--- a/src/emu/sound/okim6376.h
+++ b/src/emu/sound/okim6376.h
@@ -5,26 +5,10 @@
/* an interface for the OKIM6376 and similar chips */
-READ8_HANDLER( okim6376_status_0_r );
-READ8_HANDLER( okim6376_status_1_r );
-READ8_HANDLER( okim6376_status_2_r );
-READ16_HANDLER( okim6376_status_0_lsb_r );
-READ16_HANDLER( okim6376_status_1_lsb_r );
-READ16_HANDLER( okim6376_status_2_lsb_r );
-READ16_HANDLER( okim6376_status_0_msb_r );
-READ16_HANDLER( okim6376_status_1_msb_r );
-READ16_HANDLER( okim6376_status_2_msb_r );
-WRITE8_HANDLER( okim6376_data_0_w );
-WRITE8_HANDLER( okim6376_data_1_w );
-WRITE8_HANDLER( okim6376_data_2_w );
-WRITE16_HANDLER( okim6376_data_0_lsb_w );
-WRITE16_HANDLER( okim6376_data_1_lsb_w );
-WRITE16_HANDLER( okim6376_data_2_lsb_w );
-WRITE16_HANDLER( okim6376_data_0_msb_w );
-WRITE16_HANDLER( okim6376_data_1_msb_w );
-WRITE16_HANDLER( okim6376_data_2_msb_w );
+READ8_DEVICE_HANDLER( okim6376_r );
+WRITE8_DEVICE_HANDLER( okim6376_w );
-SND_GET_INFO( okim6376 );
-#define SOUND_OKIM6376 SND_GET_INFO_NAME( okim6376 )
+DEVICE_GET_INFO( okim6376 );
+#define SOUND_OKIM6376 DEVICE_GET_INFO_NAME( okim6376 )
#endif /* __OKIM6376_H__ */
diff --git a/src/emu/sound/pokey.c b/src/emu/sound/pokey.c
index 8a0c12f4d7c..99b45a1384c 100644
--- a/src/emu/sound/pokey.c
+++ b/src/emu/sound/pokey.c
@@ -157,7 +157,8 @@
#define DIV_64 28 /* divisor for 1.78979 MHz clock to 63.9211 kHz */
#define DIV_15 114 /* divisor for 1.78979 MHz clock to 15.6999 kHz */
-struct POKEYregisters
+typedef struct _pokey_state pokey_state;
+struct _pokey_state
{
INT32 counter[4]; /* channel counter */
INT32 divisor[4]; /* channel divisor (modulo value) */
@@ -182,11 +183,11 @@ struct POKEYregisters
int timer_param[3]; /* computed parameters for these timers */
emu_timer *rtimer; /* timer for calculating the random offset */
emu_timer *ptimer[8]; /* pot timers */
- read8_space_func pot_r[8];
- read8_space_func allpot_r;
- read8_space_func serin_r;
- write8_space_func serout_w;
- void (*interrupt_cb)(running_machine *machine, int mask);
+ devcb_resolved_read8 pot_r[8];
+ devcb_resolved_read8 allpot_r;
+ devcb_resolved_read8 serin_r;
+ devcb_resolved_write8 serout_w;
+ void (*interrupt_cb)(const device_config *device, int mask);
UINT8 AUDF[4]; /* AUDFx (D200, D202, D204, D206) */
UINT8 AUDC[4]; /* AUDCx (D201, D203, D205, D207) */
UINT8 POTx[8]; /* POTx (R/D200-D207) */
@@ -523,9 +524,19 @@ static TIMER_CALLBACK( pokey_pot_trigger );
#endif
+INLINE pokey_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_POKEY);
+ return (pokey_state *)device->token;
+}
+
+
static STREAM_UPDATE( pokey_update )
{
- struct POKEYregisters *chip = param;
+ pokey_state *chip = param;
stream_sample_t *buffer = outputs[0];
PROCESS_POKEY(chip);
}
@@ -566,7 +577,7 @@ static void rand_init(UINT8 *rng, int size, int left, int right, int add)
}
-static void register_for_save(struct POKEYregisters *chip, const device_config *device)
+static void register_for_save(pokey_state *chip, const device_config *device)
{
state_save_register_device_item_array(device, 0, chip->counter);
state_save_register_device_item_array(device, 0, chip->divisor);
@@ -606,16 +617,16 @@ static void register_for_save(struct POKEYregisters *chip, const device_config *
}
-static SND_START( pokey )
+static DEVICE_START( pokey )
{
- struct POKEYregisters *chip = device->token;
- int sample_rate = clock;
+ pokey_state *chip = get_safe_token(device);
+ int sample_rate = device->clock;
int i;
if (device->static_config)
memcpy(&chip->intf, device->static_config, sizeof(pokey_interface));
chip->device = device;
- chip->clock_period = ATTOTIME_IN_HZ(clock);
+ chip->clock_period = ATTOTIME_IN_HZ(device->clock);
/* calculate the A/D times
* In normal, slow mode (SKCTL bit SK_PADDLE is clear) the conversion
@@ -624,8 +635,8 @@ static SND_START( pokey )
* In quick mode (SK_PADDLE set) the conversion is done very fast
* (takes two scanlines) but the result is not as accurate.
*/
- chip->ad_time_fast = attotime_div(attotime_mul(ATTOTIME_IN_NSEC(64000*2/228), FREQ_17_EXACT), clock);
- chip->ad_time_slow = attotime_div(attotime_mul(ATTOTIME_IN_NSEC(64000 ), FREQ_17_EXACT), clock);
+ chip->ad_time_fast = attotime_div(attotime_mul(ATTOTIME_IN_NSEC(64000*2/228), FREQ_17_EXACT), device->clock);
+ chip->ad_time_slow = attotime_div(attotime_mul(ATTOTIME_IN_NSEC(64000 ), FREQ_17_EXACT), device->clock);
/* initialize the poly counters */
poly_init(chip->poly4, 4, 3, 1, 0x00004);
@@ -637,7 +648,7 @@ static SND_START( pokey )
rand_init(chip->rand9, 9, 8, 1, 0x00180);
rand_init(chip->rand17, 17,16, 1, 0x1c000);
- chip->samplerate_24_8 = (clock << 8) / sample_rate;
+ chip->samplerate_24_8 = (device->clock << 8) / sample_rate;
chip->divisor[CHAN1] = 4;
chip->divisor[CHAN2] = 4;
chip->divisor[CHAN3] = 4;
@@ -654,11 +665,11 @@ static SND_START( pokey )
for (i=0; i<8; i++)
{
chip->ptimer[i] = timer_alloc(device->machine, pokey_pot_trigger, chip);
- chip->pot_r[i] = chip->intf.pot_r[i];
+ devcb_resolve_read8(&chip->pot_r[i], &chip->intf.pot_r[i], device);
}
- chip->allpot_r = chip->intf.allpot_r;
- chip->serin_r = chip->intf.serin_r;
- chip->serout_w = chip->intf.serout_w;
+ devcb_resolve_read8(&chip->allpot_r, &chip->intf.allpot_r, device);
+ devcb_resolve_read8(&chip->serin_r, &chip->intf.serin_r, device);
+ devcb_resolve_write8(&chip->serout_w, &chip->intf.serout_w, device);
chip->interrupt_cb = chip->intf.interrupt_cb;
chip->channel = stream_create(device, 0, 1, sample_rate, chip, pokey_update);
@@ -668,7 +679,7 @@ static SND_START( pokey )
static TIMER_CALLBACK( pokey_timer_expire )
{
- struct POKEYregisters *p = ptr;
+ pokey_state *p = ptr;
int timers = param;
LOG_TIMER(("POKEY #%p timer %d with IRQEN $%02x\n", p, timers, p->IRQEN));
@@ -682,7 +693,7 @@ static TIMER_CALLBACK( pokey_timer_expire )
p->IRQST |= timers;
/* call back an application supplied function to handle the interrupt */
if( p->interrupt_cb )
- (*p->interrupt_cb)(machine, timers);
+ (*p->interrupt_cb)(p->device, timers);
}
}
@@ -736,44 +747,44 @@ static char *audctl2str(int val)
return buff;
}
-static TIMER_CALLBACK( pokey_serin_ready )
+static TIMER_CALLBACK( pokey_serin_ready_cb )
{
- struct POKEYregisters *p = ptr;
+ pokey_state *p = ptr;
if( p->IRQEN & IRQ_SERIN )
{
/* set the enabled timer irq status bits */
p->IRQST |= IRQ_SERIN;
/* call back an application supplied function to handle the interrupt */
if( p->interrupt_cb )
- (*p->interrupt_cb)(machine, IRQ_SERIN);
+ (*p->interrupt_cb)(p->device, IRQ_SERIN);
}
}
-static TIMER_CALLBACK( pokey_serout_ready )
+static TIMER_CALLBACK( pokey_serout_ready_cb )
{
- struct POKEYregisters *p = ptr;
+ pokey_state *p = ptr;
if( p->IRQEN & IRQ_SEROR )
{
p->IRQST |= IRQ_SEROR;
if( p->interrupt_cb )
- (*p->interrupt_cb)(machine, IRQ_SEROR);
+ (*p->interrupt_cb)(p->device, IRQ_SEROR);
}
}
static TIMER_CALLBACK( pokey_serout_complete )
{
- struct POKEYregisters *p = ptr;
+ pokey_state *p = ptr;
if( p->IRQEN & IRQ_SEROC )
{
p->IRQST |= IRQ_SEROC;
if( p->interrupt_cb )
- (*p->interrupt_cb)(machine, IRQ_SEROC);
+ (*p->interrupt_cb)(p->device, IRQ_SEROC);
}
}
static TIMER_CALLBACK( pokey_pot_trigger )
{
- struct POKEYregisters *p = ptr;
+ pokey_state *p = ptr;
int pot = param;
LOG(("POKEY #%p POT%d triggers after %dus\n", p, pot, (int)(1000000 * attotime_to_double(timer_timeelapsed(p->ptimer[pot])))));
p->ALLPOT &= ~(1 << pot); /* set the enabled timer irq status bits */
@@ -781,7 +792,7 @@ static TIMER_CALLBACK( pokey_pot_trigger )
#define AD_TIME ((p->SKCTL & SK_PADDLE) ? p->ad_time_fast : p->ad_time_slow)
-static void pokey_potgo(const address_space *space, struct POKEYregisters *p)
+static void pokey_potgo(pokey_state *p)
{
int pot;
@@ -792,9 +803,9 @@ static void pokey_potgo(const address_space *space, struct POKEYregisters *p)
for( pot = 0; pot < 8; pot++ )
{
p->POTx[pot] = 0xff;
- if( p->pot_r[pot] )
+ if( p->pot_r[pot].read )
{
- int r = (*p->pot_r[pot])(space, pot);
+ int r = devcb_call_read8(&p->pot_r[pot], pot);
LOG(("POKEY %s pot_r(%d) returned $%02x\n", p->device->tag, pot, r));
if( r != -1 )
@@ -810,29 +821,18 @@ static void pokey_potgo(const address_space *space, struct POKEYregisters *p)
}
}
-static int pokey_register_r(int chip, int offs)
+READ8_DEVICE_HANDLER( pokey_r )
{
- struct POKEYregisters *p = sndti_token(SOUND_POKEY, chip);
- /* temporary hack until this is converted to a device */
- const address_space *space;
+ pokey_state *p = get_safe_token(device);
int data = 0, pot;
UINT32 adjust = 0;
-#ifdef MAME_DEBUG
- if( !p )
- {
- logerror("POKEY #%d is >= number of Pokeys!\n", chip);
- return data;
- }
-#endif
-
- space = memory_find_address_space(p->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
- switch (offs & 15)
+ switch (offset & 15)
{
case POT0_C: case POT1_C: case POT2_C: case POT3_C:
case POT4_C: case POT5_C: case POT6_C: case POT7_C:
- pot = offs & 7;
- if( p->pot_r[pot] )
+ pot = offset & 7;
+ if( p->pot_r[pot].read )
{
/*
* If the conversion is not yet finished (ptimer running),
@@ -842,16 +842,16 @@ static int pokey_register_r(int chip, int offs)
if( p->ALLPOT & (1 << pot) )
{
data = timer_timeelapsed(p->ptimer[pot]).attoseconds / AD_TIME.attoseconds;
- LOG(("POKEY #%d read POT%d (interpolated) $%02x\n", chip, pot, data));
+ LOG(("POKEY '%s' read POT%d (interpolated) $%02x\n", p->device->tag, pot, data));
}
else
{
data = p->POTx[pot];
- LOG(("POKEY #%d read POT%d (final value) $%02x\n", chip, pot, data));
+ LOG(("POKEY '%s' read POT%d (final value) $%02x\n", p->device->tag, pot, data));
}
}
else
- logerror("%s: warning - read p[chip] #%d POT%d\n", cpuexec_describe_context(p->device->machine), chip, pot);
+ logerror("%s: warning - read '%s' POT%d\n", cpuexec_describe_context(p->device->machine), p->device->tag, pot);
break;
case ALLPOT_C:
@@ -862,17 +862,17 @@ static int pokey_register_r(int chip, int offs)
if( (p->SKCTL & SK_RESET) == 0)
{
data = 0;
- LOG(("POKEY #%d ALLPOT internal $%02x (reset)\n", chip, data));
+ LOG(("POKEY '%s' ALLPOT internal $%02x (reset)\n", p->device->tag, data));
}
- else if( p->allpot_r )
+ else if( p->allpot_r.read )
{
- data = (*p->allpot_r)(space, offs);
- LOG(("POKEY #%d ALLPOT callback $%02x\n", chip, data));
+ data = devcb_call_read8(&p->allpot_r, offset);
+ LOG(("POKEY '%s' ALLPOT callback $%02x\n", p->device->tag, data));
}
else
{
data = p->ALLPOT;
- LOG(("POKEY #%d ALLPOT internal $%02x\n", chip, data));
+ LOG(("POKEY '%s' ALLPOT internal $%02x\n", p->device->tag, data));
}
break;
@@ -900,17 +900,17 @@ static int pokey_register_r(int chip, int offs)
adjust = 1;
p->r9 = 0;
p->r17 = 0;
- LOG_RAND(("POKEY #%d rand17 frozen (SKCTL): $%02x\n", chip, p->RANDOM));
+ LOG_RAND(("POKEY '%s' rand17 frozen (SKCTL): $%02x\n", p->device->tag, p->RANDOM));
}
if( p->AUDCTL & POLY9 )
{
p->RANDOM = p->rand9[p->r9];
- LOG_RAND(("POKEY #%d adjust %u rand9[$%05x]: $%02x\n", chip, adjust, p->r9, p->RANDOM));
+ LOG_RAND(("POKEY '%s' adjust %u rand9[$%05x]: $%02x\n", p->device->tag, adjust, p->r9, p->RANDOM));
}
else
{
p->RANDOM = p->rand17[p->r17];
- LOG_RAND(("POKEY #%d adjust %u rand17[$%05x]: $%02x\n", chip, adjust, p->r17, p->RANDOM));
+ LOG_RAND(("POKEY '%s' adjust %u rand17[$%05x]: $%02x\n", p->device->tag, adjust, p->r17, p->RANDOM));
}
if (adjust > 0)
timer_adjust_oneshot(p->rtimer, attotime_never, 0);
@@ -918,85 +918,57 @@ static int pokey_register_r(int chip, int offs)
break;
case SERIN_C:
- if( p->serin_r )
- p->SERIN = (*p->serin_r)(space, offs);
+ if( p->serin_r.read )
+ p->SERIN = devcb_call_read8(&p->serin_r, offset);
data = p->SERIN;
- LOG(("POKEY #%d SERIN $%02x\n", chip, data));
+ LOG(("POKEY '%s' SERIN $%02x\n", p->device->tag, data));
break;
case IRQST_C:
/* IRQST is an active low input port; we keep it active high */
/* internally to ease the (un-)masking of bits */
data = p->IRQST ^ 0xff;
- LOG(("POKEY #%d IRQST $%02x\n", chip, data));
+ LOG(("POKEY '%s' IRQST $%02x\n", p->device->tag, data));
break;
case SKSTAT_C:
/* SKSTAT is also an active low input port */
data = p->SKSTAT ^ 0xff;
- LOG(("POKEY #%d SKSTAT $%02x\n", chip, data));
+ LOG(("POKEY '%s' SKSTAT $%02x\n", p->device->tag, data));
break;
default:
- LOG(("POKEY #%d register $%02x\n", chip, offs));
+ LOG(("POKEY '%s' register $%02x\n", p->device->tag, offset));
break;
}
return data;
}
-READ8_HANDLER( pokey1_r )
-{
- return pokey_register_r(0, offset);
-}
-
-READ8_HANDLER( pokey2_r )
-{
- return pokey_register_r(1, offset);
-}
-
-READ8_HANDLER( pokey3_r )
-{
- return pokey_register_r(2, offset);
-}
-
-READ8_HANDLER( pokey4_r )
-{
- return pokey_register_r(3, offset);
-}
-
READ8_HANDLER( quad_pokey_r )
{
+ static const char *devname[4] = { "pokey1", "pokey2", "pokey3", "pokey4" };
int pokey_num = (offset >> 3) & ~0x04;
int control = (offset & 0x20) >> 2;
int pokey_reg = (offset % 8) | control;
- return pokey_register_r(pokey_num, pokey_reg);
+ return pokey_r(devtag_get_device(space->machine, SOUND, devname[pokey_num]), pokey_reg);
}
-static void pokey_register_w(int chip, int offs, int data)
+WRITE8_DEVICE_HANDLER( pokey_w )
{
- struct POKEYregisters *p = sndti_token(SOUND_POKEY, chip);
- /* temporary hack until this is converted to a device */
- const address_space *space = memory_find_address_space(p->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ pokey_state *p = get_safe_token(device);
int ch_mask = 0, new_val;
-#ifdef MAME_DEBUG
- if( !p )
- {
- logerror("POKEY #%d is >= number of Pokeys!\n", chip);
- return;
- }
-#endif
stream_update(p->channel);
/* determine which address was changed */
- switch (offs & 15)
+ switch (offset & 15)
{
case AUDF1_C:
if( data == p->AUDF[CHAN1] )
return;
- LOG_SOUND(("POKEY #%d AUDF1 $%02x\n", chip, data));
+ LOG_SOUND(("POKEY '%s' AUDF1 $%02x\n", p->device->tag, data));
p->AUDF[CHAN1] = data;
ch_mask = 1 << CHAN1;
if( p->AUDCTL & CH12_JOINED ) /* if ch 1&2 tied together */
@@ -1006,7 +978,7 @@ static void pokey_register_w(int chip, int offs, int data)
case AUDC1_C:
if( data == p->AUDC[CHAN1] )
return;
- LOG_SOUND(("POKEY #%d AUDC1 $%02x (%s)\n", chip, data, audc2str(data)));
+ LOG_SOUND(("POKEY '%s' AUDC1 $%02x (%s)\n", p->device->tag, data, audc2str(data)));
p->AUDC[CHAN1] = data;
ch_mask = 1 << CHAN1;
break;
@@ -1014,7 +986,7 @@ static void pokey_register_w(int chip, int offs, int data)
case AUDF2_C:
if( data == p->AUDF[CHAN2] )
return;
- LOG_SOUND(("POKEY #%d AUDF2 $%02x\n", chip, data));
+ LOG_SOUND(("POKEY '%s' AUDF2 $%02x\n", p->device->tag, data));
p->AUDF[CHAN2] = data;
ch_mask = 1 << CHAN2;
break;
@@ -1022,7 +994,7 @@ static void pokey_register_w(int chip, int offs, int data)
case AUDC2_C:
if( data == p->AUDC[CHAN2] )
return;
- LOG_SOUND(("POKEY #%d AUDC2 $%02x (%s)\n", chip, data, audc2str(data)));
+ LOG_SOUND(("POKEY '%s' AUDC2 $%02x (%s)\n", p->device->tag, data, audc2str(data)));
p->AUDC[CHAN2] = data;
ch_mask = 1 << CHAN2;
break;
@@ -1030,7 +1002,7 @@ static void pokey_register_w(int chip, int offs, int data)
case AUDF3_C:
if( data == p->AUDF[CHAN3] )
return;
- LOG_SOUND(("POKEY #%d AUDF3 $%02x\n", chip, data));
+ LOG_SOUND(("POKEY '%s' AUDF3 $%02x\n", p->device->tag, data));
p->AUDF[CHAN3] = data;
ch_mask = 1 << CHAN3;
@@ -1041,7 +1013,7 @@ static void pokey_register_w(int chip, int offs, int data)
case AUDC3_C:
if( data == p->AUDC[CHAN3] )
return;
- LOG_SOUND(("POKEY #%d AUDC3 $%02x (%s)\n", chip, data, audc2str(data)));
+ LOG_SOUND(("POKEY '%s' AUDC3 $%02x (%s)\n", p->device->tag, data, audc2str(data)));
p->AUDC[CHAN3] = data;
ch_mask = 1 << CHAN3;
break;
@@ -1049,7 +1021,7 @@ static void pokey_register_w(int chip, int offs, int data)
case AUDF4_C:
if( data == p->AUDF[CHAN4] )
return;
- LOG_SOUND(("POKEY #%d AUDF4 $%02x\n", chip, data));
+ LOG_SOUND(("POKEY '%s' AUDF4 $%02x\n", p->device->tag, data));
p->AUDF[CHAN4] = data;
ch_mask = 1 << CHAN4;
break;
@@ -1057,7 +1029,7 @@ static void pokey_register_w(int chip, int offs, int data)
case AUDC4_C:
if( data == p->AUDC[CHAN4] )
return;
- LOG_SOUND(("POKEY #%d AUDC4 $%02x (%s)\n", chip, data, audc2str(data)));
+ LOG_SOUND(("POKEY '%s' AUDC4 $%02x (%s)\n", p->device->tag, data, audc2str(data)));
p->AUDC[CHAN4] = data;
ch_mask = 1 << CHAN4;
break;
@@ -1065,7 +1037,7 @@ static void pokey_register_w(int chip, int offs, int data)
case AUDCTL_C:
if( data == p->AUDCTL )
return;
- LOG_SOUND(("POKEY #%d AUDCTL $%02x (%s)\n", chip, data, audctl2str(data)));
+ LOG_SOUND(("POKEY '%s' AUDCTL $%02x (%s)\n", p->device->tag, data, audctl2str(data)));
p->AUDCTL = data;
ch_mask = 15; /* all channels */
/* determine the base multiplier for the 'div by n' calculations */
@@ -1074,7 +1046,7 @@ static void pokey_register_w(int chip, int offs, int data)
case STIMER_C:
/* first remove any existing timers */
- LOG_TIMER(("POKEY #%d STIMER $%02x\n", chip, data));
+ LOG_TIMER(("POKEY '%s' STIMER $%02x\n", p->device->tag, data));
timer_adjust_oneshot(p->timer[TIMER1], attotime_never, p->timer_param[TIMER1]);
timer_adjust_oneshot(p->timer[TIMER2], attotime_never, p->timer_param[TIMER2]);
@@ -1092,10 +1064,10 @@ static void pokey_register_w(int chip, int offs, int data)
{
if( p->divisor[CHAN2] > 4 )
{
- LOG_TIMER(("POKEY #%d timer1+2 after %d clocks\n", chip, p->divisor[CHAN2]));
+ LOG_TIMER(("POKEY '%s' timer1+2 after %d clocks\n", p->device->tag, p->divisor[CHAN2]));
/* set timer #1 _and_ #2 event after timer_div clocks of joined CHAN1+CHAN2 */
p->timer_period[TIMER2] = attotime_mul(p->clock_period, p->divisor[CHAN2]);
- p->timer_param[TIMER2] = (chip<<3)|IRQ_TIMR2|IRQ_TIMR1;
+ p->timer_param[TIMER2] = IRQ_TIMR2|IRQ_TIMR1;
timer_adjust_periodic(p->timer[TIMER2], p->timer_period[TIMER2], p->timer_param[TIMER2], p->timer_period[TIMER2]);
}
}
@@ -1103,19 +1075,19 @@ static void pokey_register_w(int chip, int offs, int data)
{
if( p->divisor[CHAN1] > 4 )
{
- LOG_TIMER(("POKEY #%d timer1 after %d clocks\n", chip, p->divisor[CHAN1]));
+ LOG_TIMER(("POKEY '%s' timer1 after %d clocks\n", p->device->tag, p->divisor[CHAN1]));
/* set timer #1 event after timer_div clocks of CHAN1 */
p->timer_period[TIMER1] = attotime_mul(p->clock_period, p->divisor[CHAN1]);
- p->timer_param[TIMER1] = (chip<<3)|IRQ_TIMR1;
+ p->timer_param[TIMER1] = IRQ_TIMR1;
timer_adjust_periodic(p->timer[TIMER1], p->timer_period[TIMER1], p->timer_param[TIMER1], p->timer_period[TIMER1]);
}
if( p->divisor[CHAN2] > 4 )
{
- LOG_TIMER(("POKEY #%d timer2 after %d clocks\n", chip, p->divisor[CHAN2]));
+ LOG_TIMER(("POKEY '%s' timer2 after %d clocks\n", p->device->tag, p->divisor[CHAN2]));
/* set timer #2 event after timer_div clocks of CHAN2 */
p->timer_period[TIMER2] = attotime_mul(p->clock_period, p->divisor[CHAN2]);
- p->timer_param[TIMER2] = (chip<<3)|IRQ_TIMR2;
+ p->timer_param[TIMER2] = IRQ_TIMR2;
timer_adjust_periodic(p->timer[TIMER2], p->timer_period[TIMER2], p->timer_param[TIMER2], p->timer_period[TIMER2]);
}
}
@@ -1129,10 +1101,10 @@ static void pokey_register_w(int chip, int offs, int data)
{
if( p->divisor[CHAN4] > 4 )
{
- LOG_TIMER(("POKEY #%d timer4 after %d clocks\n", chip, p->divisor[CHAN4]));
+ LOG_TIMER(("POKEY '%s' timer4 after %d clocks\n", p->device->tag, p->divisor[CHAN4]));
/* set timer #4 event after timer_div clocks of CHAN4 */
p->timer_period[TIMER4] = attotime_mul(p->clock_period, p->divisor[CHAN4]);
- p->timer_param[TIMER4] = (chip<<3)|IRQ_TIMR4;
+ p->timer_param[TIMER4] = IRQ_TIMR4;
timer_adjust_periodic(p->timer[TIMER4], p->timer_period[TIMER4], p->timer_param[TIMER4], p->timer_period[TIMER4]);
}
}
@@ -1141,10 +1113,10 @@ static void pokey_register_w(int chip, int offs, int data)
{
if( p->divisor[CHAN4] > 4 )
{
- LOG_TIMER(("POKEY #%d timer4 after %d clocks\n", chip, p->divisor[CHAN4]));
+ LOG_TIMER(("POKEY '%s' timer4 after %d clocks\n", p->device->tag, p->divisor[CHAN4]));
/* set timer #4 event after timer_div clocks of CHAN4 */
p->timer_period[TIMER4] = attotime_mul(p->clock_period, p->divisor[CHAN4]);
- p->timer_param[TIMER4] = (chip<<3)|IRQ_TIMR4;
+ p->timer_param[TIMER4] = IRQ_TIMR4;
timer_adjust_periodic(p->timer[TIMER4], p->timer_period[TIMER4], p->timer_param[TIMER4], p->timer_period[TIMER4]);
}
}
@@ -1156,32 +1128,31 @@ static void pokey_register_w(int chip, int offs, int data)
case SKREST_C:
/* reset SKSTAT */
- LOG(("POKEY #%d SKREST $%02x\n", chip, data));
+ LOG(("POKEY '%s' SKREST $%02x\n", p->device->tag, data));
p->SKSTAT &= ~(SK_FRAME|SK_OVERRUN|SK_KBERR);
break;
case POTGO_C:
- LOG(("POKEY #%d POTGO $%02x\n", chip, data));
- pokey_potgo(space, p);
+ LOG(("POKEY '%s' POTGO $%02x\n", p->device->tag, data));
+ pokey_potgo(p);
break;
case SEROUT_C:
- LOG(("POKEY #%d SEROUT $%02x\n", chip, data));
- if (p->serout_w)
- (*p->serout_w)(space, offs, data);
+ LOG(("POKEY '%s' SEROUT $%02x\n", p->device->tag, data));
+ devcb_call_write8(&p->serout_w, offset, data);
p->SKSTAT |= SK_SEROUT;
/*
* These are arbitrary values, tested with some custom boot
* loaders from Ballblazer and Escape from Fractalus
* The real times are unknown
*/
- timer_set(space->machine, ATTOTIME_IN_USEC(200), p, 0, pokey_serout_ready);
+ timer_set(device->machine, ATTOTIME_IN_USEC(200), p, 0, pokey_serout_ready_cb);
/* 10 bits (assumption 1 start, 8 data and 1 stop bit) take how long? */
- timer_set(space->machine, ATTOTIME_IN_USEC(2000), p, 0, pokey_serout_complete);
+ timer_set(device->machine, ATTOTIME_IN_USEC(2000), p, 0, pokey_serout_complete);
break;
case IRQEN_C:
- LOG(("POKEY #%d IRQEN $%02x\n", chip, data));
+ LOG(("POKEY '%s' IRQEN $%02x\n", p->device->tag, data));
/* acknowledge one or more IRQST bits ? */
if( p->IRQST & ~data )
@@ -1207,12 +1178,12 @@ static void pokey_register_w(int chip, int offs, int data)
case SKCTL_C:
if( data == p->SKCTL )
return;
- LOG(("POKEY #%d SKCTL $%02x\n", chip, data));
+ LOG(("POKEY '%s' SKCTL $%02x\n", p->device->tag, data));
p->SKCTL = data;
if( !(data & SK_RESET) )
{
- pokey_register_w(chip, IRQEN_C, 0);
- pokey_register_w(chip, SKREST_C, 0);
+ pokey_w(device, IRQEN_C, 0);
+ pokey_w(device, SKREST_C, 0);
}
break;
}
@@ -1235,7 +1206,7 @@ static void pokey_register_w(int chip, int offs, int data)
else
new_val = (p->AUDF[CHAN1] + DIVADD_LOCLK) * p->clockmult;
- LOG_SOUND(("POKEY #%d chan1 %d\n", chip, new_val));
+ LOG_SOUND(("POKEY '%s' chan1 %d\n", p->device->tag, new_val));
p->volume[CHAN1] = (p->AUDC[CHAN1] & VOLUME_MASK) * POKEY_DEFAULT_GAIN;
p->divisor[CHAN1] = new_val;
@@ -1265,12 +1236,12 @@ static void pokey_register_w(int chip, int offs, int data)
new_val = p->AUDF[CHAN2] * 256 + p->AUDF[CHAN1] + DIVADD_HICLK_JOINED;
else
new_val = (p->AUDF[CHAN2] * 256 + p->AUDF[CHAN1] + DIVADD_LOCLK) * p->clockmult;
- LOG_SOUND(("POKEY #%d chan1+2 %d\n", chip, new_val));
+ LOG_SOUND(("POKEY '%s' chan1+2 %d\n", p->device->tag, new_val));
}
else
{
new_val = (p->AUDF[CHAN2] + DIVADD_LOCLK) * p->clockmult;
- LOG_SOUND(("POKEY #%d chan2 %d\n", chip, new_val));
+ LOG_SOUND(("POKEY '%s' chan2 %d\n", p->device->tag, new_val));
}
p->volume[CHAN2] = (p->AUDC[CHAN2] & VOLUME_MASK) * POKEY_DEFAULT_GAIN;
@@ -1300,7 +1271,7 @@ static void pokey_register_w(int chip, int offs, int data)
else
new_val = (p->AUDF[CHAN3] + DIVADD_LOCLK) * p->clockmult;
- LOG_SOUND(("POKEY #%d chan3 %d\n", chip, new_val));
+ LOG_SOUND(("POKEY '%s' chan3 %d\n", p->device->tag, new_val));
p->volume[CHAN3] = (p->AUDC[CHAN3] & VOLUME_MASK) * POKEY_DEFAULT_GAIN;
p->divisor[CHAN3] = new_val;
@@ -1330,12 +1301,12 @@ static void pokey_register_w(int chip, int offs, int data)
new_val = p->AUDF[CHAN4] * 256 + p->AUDF[CHAN3] + DIVADD_HICLK_JOINED;
else
new_val = (p->AUDF[CHAN4] * 256 + p->AUDF[CHAN3] + DIVADD_LOCLK) * p->clockmult;
- LOG_SOUND(("POKEY #%d chan3+4 %d\n", chip, new_val));
+ LOG_SOUND(("POKEY '%s' chan3+4 %d\n", p->device->tag, new_val));
}
else
{
new_val = (p->AUDF[CHAN4] + DIVADD_LOCLK) * p->clockmult;
- LOG_SOUND(("POKEY #%d chan4 %d\n", chip, new_val));
+ LOG_SOUND(("POKEY '%s' chan4 %d\n", p->device->tag, new_val));
}
p->volume[CHAN4] = (p->AUDC[CHAN4] & VOLUME_MASK) * POKEY_DEFAULT_GAIN;
@@ -1359,62 +1330,25 @@ static void pokey_register_w(int chip, int offs, int data)
}
}
-WRITE8_HANDLER( pokey1_w )
-{
- pokey_register_w(0,offset,data);
-}
-
-WRITE8_HANDLER( pokey2_w )
-{
- pokey_register_w(1,offset,data);
-}
-
-WRITE8_HANDLER( pokey3_w )
-{
- pokey_register_w(2,offset,data);
-}
-
-WRITE8_HANDLER( pokey4_w )
-{
- pokey_register_w(3,offset,data);
-}
-
WRITE8_HANDLER( quad_pokey_w )
{
+ static const char *devname[4] = { "pokey1", "pokey2", "pokey3", "pokey4" };
int pokey_num = (offset >> 3) & ~0x04;
int control = (offset & 0x20) >> 2;
int pokey_reg = (offset % 8) | control;
- pokey_register_w(pokey_num, pokey_reg, data);
-}
-
-void pokey1_serin_ready(int after)
-{
- struct POKEYregisters *p = sndti_token(SOUND_POKEY, 0);
- timer_set(p->device->machine, attotime_mul(p->clock_period, after), p, 0, pokey_serin_ready);
+ pokey_w(devtag_get_device(space->machine, SOUND, devname[pokey_num]), pokey_reg, data);
}
-void pokey2_serin_ready(int after)
+void pokey_serin_ready(const device_config *device, int after)
{
- struct POKEYregisters *p = sndti_token(SOUND_POKEY, 1);
- timer_set(p->device->machine, attotime_mul(p->clock_period, after), p, 0, pokey_serin_ready);
+ pokey_state *p = get_safe_token(device);
+ timer_set(device->machine, attotime_mul(p->clock_period, after), p, 0, pokey_serin_ready_cb);
}
-void pokey3_serin_ready(int after)
+void pokey_break_w(const device_config *device, int shift)
{
- struct POKEYregisters *p = sndti_token(SOUND_POKEY, 2);
- timer_set(p->device->machine, attotime_mul(p->clock_period, after), p, 0, pokey_serin_ready);
-}
-
-void pokey4_serin_ready(int after)
-{
- struct POKEYregisters *p = sndti_token(SOUND_POKEY, 3);
- timer_set(p->device->machine, attotime_mul(p->clock_period, after), p, 0, pokey_serin_ready);
-}
-
-static void pokey_break_w(int chip, int shift)
-{
- struct POKEYregisters *p = sndti_token(SOUND_POKEY, chip);
+ pokey_state *p = get_safe_token(device);
if( shift ) /* shift code ? */
p->SKSTAT |= SK_SHIFT;
else
@@ -1425,33 +1359,13 @@ static void pokey_break_w(int chip, int shift)
/* set break IRQ status and call back the interrupt handler */
p->IRQST |= IRQ_BREAK;
if( p->interrupt_cb )
- (*p->interrupt_cb)(p->device->machine, IRQ_BREAK);
+ (*p->interrupt_cb)(device, IRQ_BREAK);
}
}
-void pokey1_break_w(int shift)
+void pokey_kbcode_w(const device_config *device, int kbcode, int make)
{
- pokey_break_w(0, shift);
-}
-
-void pokey2_break_w(int shift)
-{
- pokey_break_w(1, shift);
-}
-
-void pokey3_break_w(int shift)
-{
- pokey_break_w(2, shift);
-}
-
-void pokey4_break_w(int shift)
-{
- pokey_break_w(3, shift);
-}
-
-static void pokey_kbcode_w(int chip, int kbcode, int make)
-{
- struct POKEYregisters *p = sndti_token(SOUND_POKEY, chip);
+ pokey_state *p = get_safe_token(device);
/* make code ? */
if( make )
{
@@ -1469,7 +1383,7 @@ static void pokey_kbcode_w(int chip, int kbcode, int make)
p->SKSTAT |= SK_KBERR;
p->IRQST |= IRQ_KEYBD;
if( p->interrupt_cb )
- (*p->interrupt_cb)(p->device->machine, IRQ_KEYBD);
+ (*p->interrupt_cb)(device, IRQ_KEYBD);
}
}
else
@@ -1479,26 +1393,6 @@ static void pokey_kbcode_w(int chip, int kbcode, int make)
}
}
-void pokey1_kbcode_w(int kbcode, int make)
-{
- pokey_kbcode_w(0, kbcode, make);
-}
-
-void pokey2_kbcode_w(int kbcode, int make)
-{
- pokey_kbcode_w(1, kbcode, make);
-}
-
-void pokey3_kbcode_w(int kbcode, int make)
-{
- pokey_kbcode_w(2, kbcode, make);
-}
-
-void pokey4_kbcode_w(int kbcode, int make)
-{
- pokey_kbcode_w(3, kbcode, make);
-}
-
@@ -1506,34 +1400,24 @@ void pokey4_kbcode_w(int kbcode, int make)
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( pokey )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( pokey )
+DEVICE_GET_INFO( pokey )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct POKEYregisters); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(pokey_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( pokey ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( pokey ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( pokey ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "POKEY"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Atari custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "4.51"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "POKEY"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Atari custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "4.51"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/pokey.h b/src/emu/sound/pokey.h
index c8d4f3aab9f..12a68a24438 100644
--- a/src/emu/sound/pokey.h
+++ b/src/emu/sound/pokey.h
@@ -20,6 +20,7 @@
#define __POKEY_H__
#include "sndintrf.h"
+#include "devcb.h"
/* CONSTANT DEFINITIONS */
@@ -71,42 +72,26 @@
typedef struct _pokey_interface pokey_interface;
struct _pokey_interface
{
- read8_space_func pot_r[8];
- read8_space_func allpot_r;
- read8_space_func serin_r;
- write8_space_func serout_w;
- void (*interrupt_cb)(running_machine *machine, int mask);
+ devcb_read8 pot_r[8];
+ devcb_read8 allpot_r;
+ devcb_read8 serin_r;
+ devcb_write8 serout_w;
+ void (*interrupt_cb)(const device_config *device, int mask);
};
-READ8_HANDLER( pokey1_r );
-READ8_HANDLER( pokey2_r );
-READ8_HANDLER( pokey3_r );
-READ8_HANDLER( pokey4_r );
-READ8_HANDLER( quad_pokey_r );
+READ8_DEVICE_HANDLER( pokey_r );
+WRITE8_DEVICE_HANDLER( pokey_w );
-WRITE8_HANDLER( pokey1_w );
-WRITE8_HANDLER( pokey2_w );
-WRITE8_HANDLER( pokey3_w );
-WRITE8_HANDLER( pokey4_w );
+/* fix me: eventually this should be a single device with pokey subdevices */
+READ8_HANDLER( quad_pokey_r );
WRITE8_HANDLER( quad_pokey_w );
-void pokey1_serin_ready (int after);
-void pokey2_serin_ready (int after);
-void pokey3_serin_ready (int after);
-void pokey4_serin_ready (int after);
-
-void pokey1_break_w (int shift);
-void pokey2_break_w (int shift);
-void pokey3_break_w (int shift);
-void pokey4_break_w (int shift);
-
-void pokey1_kbcode_w (int kbcode, int make);
-void pokey2_kbcode_w (int kbcode, int make);
-void pokey3_kbcode_w (int kbcode, int make);
-void pokey4_kbcode_w (int kbcode, int make);
+void pokey_serin_ready (const device_config *device, int after);
+void pokey_break_w (const device_config *device, int shift);
+void pokey_kbcode_w (const device_config *device, int kbcode, int make);
-SND_GET_INFO( pokey );
-#define SOUND_POKEY SND_GET_INFO_NAME( pokey )
+DEVICE_GET_INFO( pokey );
+#define SOUND_POKEY DEVICE_GET_INFO_NAME( pokey )
#endif /* __POKEY_H__ */
diff --git a/src/emu/sound/psx.c b/src/emu/sound/psx.c
index 54284139b25..6d99c4687a7 100644
--- a/src/emu/sound/psx.c
+++ b/src/emu/sound/psx.c
@@ -82,6 +82,16 @@ struct psxinfo
sound_stream *stream;
};
+INLINE struct psxinfo *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_PSXSPU);
+ return (struct psxinfo *)device->token;
+}
+
+
#define SPU_REG( a ) ( ( a - 0xc00 ) / 4 )
#define SPU_CHANNEL_REG( a ) ( a / 4 )
@@ -156,7 +166,7 @@ static STREAM_UPDATE( PSXSPU_update )
( chip->m_n_irqaddress * 4 ) >= chip->m_p_n_blockaddress[ n_channel ] &&
( chip->m_n_irqaddress * 4 ) <= chip->m_p_n_blockaddress[ n_channel ] + 7 )
{
- chip->intf->irq_set( chip->device->machine, 0x0200 );
+ chip->intf->irq_set( chip->device, 0x0200 );
}
n_shift = ( chip->m_p_n_spuram[ chip->m_p_n_blockaddress[ n_channel ] ] >> 0 ) & 0x0f;
@@ -215,7 +225,7 @@ static STREAM_UPDATE( PSXSPU_update )
static void spu_read( running_machine *machine, UINT32 n_address, INT32 n_size )
{
- struct psxinfo *chip = sndti_token(SOUND_PSXSPU, 0);
+ struct psxinfo *chip = get_safe_token(devtag_get_device(machine, SOUND, "spu"));
verboselog( machine, 1, "spu_read( %08x, %08x )\n", n_address, n_size );
while( n_size > 0 )
@@ -234,7 +244,7 @@ static void spu_read( running_machine *machine, UINT32 n_address, INT32 n_size )
static void spu_write( running_machine *machine, UINT32 n_address, INT32 n_size )
{
- struct psxinfo *chip = sndti_token(SOUND_PSXSPU, 0);
+ struct psxinfo *chip = get_safe_token(devtag_get_device(machine, SOUND, "spu"));
verboselog( machine, 1, "spu_write( %08x, %08x )\n", n_address, n_size );
while( n_size > 0 )
@@ -250,9 +260,9 @@ static void spu_write( running_machine *machine, UINT32 n_address, INT32 n_size
}
}
-static SND_START( psxspu )
+static DEVICE_START( psxspu )
{
- struct psxinfo *chip = device->token;
+ struct psxinfo *chip = get_safe_token(device);
int n_effect;
int n_channel;
@@ -354,22 +364,22 @@ static SND_START( psxspu )
static UINT32 psx_spu_delay = 0;
-WRITE32_HANDLER( psx_spu_delay_w )
+WRITE32_DEVICE_HANDLER( psx_spu_delay_w )
{
COMBINE_DATA( &psx_spu_delay );
- verboselog( space->machine, 1, "psx_spu_delay_w( %08x %08x )\n", data, mem_mask );
+ verboselog( device->machine, 1, "psx_spu_delay_w( %08x %08x )\n", data, mem_mask );
}
-READ32_HANDLER( psx_spu_delay_r )
+READ32_DEVICE_HANDLER( psx_spu_delay_r )
{
- verboselog( space->machine, 1, "psx_spu_delay_r( %08x )\n", mem_mask );
+ verboselog( device->machine, 1, "psx_spu_delay_r( %08x )\n", mem_mask );
return psx_spu_delay;
}
-READ32_HANDLER( psx_spu_r )
+READ32_DEVICE_HANDLER( psx_spu_r )
{
- running_machine *machine = space->machine;
- struct psxinfo *chip = sndti_token(SOUND_PSXSPU, 0);
+ struct psxinfo *chip = get_safe_token(device);
+ running_machine *machine = device->machine;
int n_channel;
n_channel = offset / 4;
if( n_channel < MAX_CHANNEL )
@@ -436,10 +446,10 @@ READ32_HANDLER( psx_spu_r )
}
}
-WRITE32_HANDLER( psx_spu_w )
+WRITE32_DEVICE_HANDLER( psx_spu_w )
{
- running_machine *machine = space->machine;
- struct psxinfo *chip = sndti_token(SOUND_PSXSPU, 0);
+ struct psxinfo *chip = get_safe_token(device);
+ running_machine *machine = device->machine;
int n_channel;
n_channel = offset / 4;
if( n_channel < MAX_CHANNEL )
@@ -664,34 +674,24 @@ WRITE32_HANDLER( psx_spu_w )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( psxspu )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( psxspu )
+DEVICE_GET_INFO( psxspu )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct psxinfo); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(struct psxinfo); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( psxspu ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( psxspu ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( psxspu ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "SPU"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Sony custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "SPU"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Sony custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/psx.h b/src/emu/sound/psx.h
index 081f808dfff..95fcd31cded 100644
--- a/src/emu/sound/psx.h
+++ b/src/emu/sound/psx.h
@@ -11,10 +11,10 @@
#ifndef __SOUND_PSX_H__
#define __SOUND_PSX_H__
-WRITE32_HANDLER( psx_spu_w );
-READ32_HANDLER( psx_spu_r );
-WRITE32_HANDLER( psx_spu_delay_w );
-READ32_HANDLER( psx_spu_delay_r );
+WRITE32_DEVICE_HANDLER( psx_spu_w );
+READ32_DEVICE_HANDLER( psx_spu_r );
+WRITE32_DEVICE_HANDLER( psx_spu_delay_w );
+READ32_DEVICE_HANDLER( psx_spu_delay_r );
typedef void ( *spu_handler )( running_machine *, UINT32, INT32 );
@@ -22,12 +22,12 @@ typedef struct _psx_spu_interface psx_spu_interface;
struct _psx_spu_interface
{
UINT32 **p_psxram;
- void (*irq_set)(running_machine *,UINT32);
+ void (*irq_set)(const device_config *,UINT32);
void (*spu_install_read_handler)(int,spu_handler);
void (*spu_install_write_handler)(int,spu_handler);
};
-SND_GET_INFO( psxspu );
-#define SOUND_PSXSPU SND_GET_INFO_NAME( psxspu )
+DEVICE_GET_INFO( psxspu );
+#define SOUND_PSXSPU DEVICE_GET_INFO_NAME( psxspu )
#endif /* __SOUND_PSX_H__ */
diff --git a/src/emu/sound/qsound.c b/src/emu/sound/qsound.c
index 49c3911b044..6b8e679bad1 100644
--- a/src/emu/sound/qsound.c
+++ b/src/emu/sound/qsound.c
@@ -72,7 +72,8 @@ struct QSOUND_CHANNEL
INT32 offset; /* current offset counter */
};
-struct qsound_info
+typedef struct _qsound_state qsound_state;
+struct _qsound_state
{
/* Private variables */
sound_stream * stream; /* Audio stream */
@@ -88,13 +89,23 @@ struct qsound_info
FILE *fpRawDataR;
};
+INLINE qsound_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_QSOUND);
+ return (qsound_state *)device->token;
+}
+
+
/* Function prototypes */
static STREAM_UPDATE( qsound_update );
-static void qsound_set_command(struct qsound_info *chip, int data, int value);
+static void qsound_set_command(qsound_state *chip, int data, int value);
-static SND_START( qsound )
+static DEVICE_START( qsound )
{
- struct qsound_info *chip = device->token;
+ qsound_state *chip = get_safe_token(device);
int i;
chip->sample_rom = (QSOUND_SRC_SAMPLE *)device->region;
@@ -118,7 +129,7 @@ static SND_START( qsound )
/* Allocate stream */
chip->stream = stream_create(
device, 0, 2,
- clock / QSOUND_CLOCKDIV,
+ device->clock / QSOUND_CLOCKDIV,
chip,
qsound_update );
}
@@ -147,9 +158,9 @@ static SND_START( qsound )
}
}
-static SND_STOP( qsound )
+static DEVICE_STOP( qsound )
{
- struct qsound_info *chip = device->token;
+ qsound_state *chip = get_safe_token(device);
if (chip->fpRawDataR)
{
fclose(chip->fpRawDataR);
@@ -162,31 +173,36 @@ static SND_STOP( qsound )
chip->fpRawDataL = NULL;
}
-WRITE8_HANDLER( qsound_data_h_w )
-{
- struct qsound_info *chip = sndti_token(SOUND_QSOUND, 0);
- chip->data=(chip->data&0xff)|(data<<8);
-}
-
-WRITE8_HANDLER( qsound_data_l_w )
-{
- struct qsound_info *chip = sndti_token(SOUND_QSOUND, 0);
- chip->data=(chip->data&0xff00)|data;
-}
-
-WRITE8_HANDLER( qsound_cmd_w )
+WRITE8_DEVICE_HANDLER( qsound_w )
{
- struct qsound_info *chip = sndti_token(SOUND_QSOUND, 0);
- qsound_set_command(chip, data, chip->data);
+ qsound_state *chip = get_safe_token(device);
+ switch (offset)
+ {
+ case 0:
+ chip->data=(chip->data&0xff)|(data<<8);
+ break;
+
+ case 1:
+ chip->data=(chip->data&0xff00)|data;
+ break;
+
+ case 2:
+ qsound_set_command(chip, data, chip->data);
+ break;
+
+ default:
+ logerror("%s: unexpected qsound write to offset %d == %02X\n", cpuexec_describe_context(device->machine), offset, data);
+ break;
+ }
}
-READ8_HANDLER( qsound_status_r )
+READ8_DEVICE_HANDLER( qsound_r )
{
/* Port ready bit (0x80 if ready) */
return 0x80;
}
-static void qsound_set_command(struct qsound_info *chip, int data, int value)
+static void qsound_set_command(qsound_state *chip, int data, int value)
{
int ch=0,reg=0;
if (data < 0x80)
@@ -301,7 +317,7 @@ static void qsound_set_command(struct qsound_info *chip, int data, int value)
static STREAM_UPDATE( qsound_update )
{
- struct qsound_info *chip = param;
+ qsound_state *chip = param;
int i,j;
int rvol, lvol, count;
struct QSOUND_CHANNEL *pC=&chip->channel[0];
@@ -364,34 +380,24 @@ static STREAM_UPDATE( qsound_update )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( qsound )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( qsound )
+DEVICE_GET_INFO( qsound )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct qsound_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(qsound_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( qsound ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( qsound ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( qsound ); break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( qsound ); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( qsound ); break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "Q-Sound"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Capcom custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "Q-Sound"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Capcom custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/qsound.h b/src/emu/sound/qsound.h
index a4ae2e615af..e729ee7f7d4 100644
--- a/src/emu/sound/qsound.h
+++ b/src/emu/sound/qsound.h
@@ -11,12 +11,10 @@
#define QSOUND_CLOCK 4000000 /* default 4MHz clock */
-WRITE8_HANDLER( qsound_data_h_w );
-WRITE8_HANDLER( qsound_data_l_w );
-WRITE8_HANDLER( qsound_cmd_w );
-READ8_HANDLER( qsound_status_r );
+WRITE8_DEVICE_HANDLER( qsound_w );
+READ8_DEVICE_HANDLER( qsound_r );
-SND_GET_INFO( qsound );
-#define SOUND_QSOUND SND_GET_INFO_NAME( qsound )
+DEVICE_GET_INFO( qsound );
+#define SOUND_QSOUND DEVICE_GET_INFO_NAME( qsound )
#endif /* __QSOUND_H__ */
diff --git a/src/emu/sound/rf5c400.c b/src/emu/sound/rf5c400.c
index d082a75a836..db172bd5104 100644
--- a/src/emu/sound/rf5c400.c
+++ b/src/emu/sound/rf5c400.c
@@ -19,7 +19,8 @@
#include "streams.h"
#include "rf5c400.h"
-struct rf5c400_info
+typedef struct _rf5c400_state rf5c400_state;
+struct _rf5c400_state
{
INT16 *rom;
UINT32 rom_length;
@@ -90,6 +91,16 @@ enum {
};
+INLINE rf5c400_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_RF5C400);
+ return (rf5c400_state *)device->token;
+}
+
+
/*****************************************************************************/
static UINT8 decode80(UINT8 val)
@@ -105,7 +116,7 @@ static UINT8 decode80(UINT8 val)
static STREAM_UPDATE( rf5c400_update )
{
int i, ch;
- struct rf5c400_info *info = param;
+ rf5c400_state *info = param;
INT16 *rom = info->rom;
UINT32 start, end, loop;
UINT64 pos;
@@ -226,7 +237,7 @@ static STREAM_UPDATE( rf5c400_update )
}
}
-static void rf5c400_init_chip(const device_config *device, struct rf5c400_info *info, int clock)
+static void rf5c400_init_chip(const device_config *device, rf5c400_state *info)
{
int i;
@@ -334,21 +345,21 @@ static void rf5c400_init_chip(const device_config *device, struct rf5c400_info *
state_save_register_device_item(device, i, info->channels[i].env_scale);
}
- info->stream = stream_create(device, 0, 2, clock/384, info, rf5c400_update);
+ info->stream = stream_create(device, 0, 2, device->clock/384, info, rf5c400_update);
}
-static SND_START( rf5c400 )
+static DEVICE_START( rf5c400 )
{
- struct rf5c400_info *info = device->token;
+ rf5c400_state *info = get_safe_token(device);
- rf5c400_init_chip(device, info, clock);
+ rf5c400_init_chip(device, info);
}
/*****************************************************************************/
static UINT16 rf5c400_status = 0;
-static UINT16 rf5c400_r(int chipnum, int offset)
+READ16_DEVICE_HANDLER( rf5c400_r )
{
switch(offset)
{
@@ -366,9 +377,9 @@ static UINT16 rf5c400_r(int chipnum, int offset)
return 0;
}
-static void rf5c400_w(int chipnum, int offset, UINT16 data)
+WRITE16_DEVICE_HANDLER( rf5c400_w )
{
- struct rf5c400_info *info = sndti_token(SOUND_RF5C400, chipnum);
+ rf5c400_state *info = get_safe_token(device);
if (offset < 0x400)
{
@@ -547,47 +558,27 @@ static void rf5c400_w(int chipnum, int offset, UINT16 data)
}
}
-READ16_HANDLER( rf5c400_0_r )
-{
- return rf5c400_r(0, offset);
-}
-
-WRITE16_HANDLER( rf5c400_0_w )
-{
- rf5c400_w(0, offset, data);
-}
-
/**************************************************************************
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( rf5c400 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( rf5c400 )
+DEVICE_GET_INFO( rf5c400 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct rf5c400_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(rf5c400_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( rf5c400 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( rf5c400 ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: /* nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( rf5c400 ); break;
+ case DEVINFO_FCT_STOP: /* nothing */ break;
+ case DEVINFO_FCT_RESET: /* nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "RF5C400"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Ricoh PCM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.1"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team & hoot development team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "RF5C400"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Ricoh PCM"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.1"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team & hoot development team"); break;
}
}
diff --git a/src/emu/sound/rf5c400.h b/src/emu/sound/rf5c400.h
index 1a61725642e..0bfdf6a3812 100644
--- a/src/emu/sound/rf5c400.h
+++ b/src/emu/sound/rf5c400.h
@@ -5,10 +5,10 @@
#ifndef __RF5C400_H__
#define __RF5C400_H__
-READ16_HANDLER( rf5c400_0_r );
-WRITE16_HANDLER( rf5c400_0_w );
+READ16_DEVICE_HANDLER( rf5c400_r );
+WRITE16_DEVICE_HANDLER( rf5c400_w );
-SND_GET_INFO( rf5c400 );
-#define SOUND_RF5C400 SND_GET_INFO_NAME( rf5c400 )
+DEVICE_GET_INFO( rf5c400 );
+#define SOUND_RF5C400 DEVICE_GET_INFO_NAME( rf5c400 )
#endif /* __RF5C400_H__ */
diff --git a/src/emu/sound/rf5c68.c b/src/emu/sound/rf5c68.c
index 5522e605d4c..0a79cc42e2f 100644
--- a/src/emu/sound/rf5c68.c
+++ b/src/emu/sound/rf5c68.c
@@ -11,7 +11,8 @@
#define NUM_CHANNELS (8)
-struct pcm_channel
+typedef struct _pcm_channel pcm_channel;
+struct _pcm_channel
{
UINT8 enable;
UINT8 env;
@@ -23,10 +24,11 @@ struct pcm_channel
};
-struct rf5c68pcm
+typedef struct _rf5c68_state rf5c68_state;
+struct _rf5c68_state
{
sound_stream * stream;
- struct pcm_channel chan[NUM_CHANNELS];
+ pcm_channel chan[NUM_CHANNELS];
UINT8 cbank;
UINT8 wbank;
UINT8 enable;
@@ -34,6 +36,15 @@ struct rf5c68pcm
};
+INLINE rf5c68_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_RF5C68);
+ return (rf5c68_state *)device->token;
+}
+
/************************************************/
/* RF5C68 stream update */
@@ -41,7 +52,7 @@ struct rf5c68pcm
static STREAM_UPDATE( rf5c68_update )
{
- struct rf5c68pcm *chip = param;
+ rf5c68_state *chip = param;
stream_sample_t *left = outputs[0];
stream_sample_t *right = outputs[1];
int i, j;
@@ -57,7 +68,7 @@ static STREAM_UPDATE( rf5c68_update )
/* loop over channels */
for (i = 0; i < NUM_CHANNELS; i++)
{
- struct pcm_channel *chan = &chip->chan[i];
+ pcm_channel *chan = &chip->chan[i];
/* if this channel is active, accumulate samples */
if (chan->enable)
@@ -121,13 +132,13 @@ static STREAM_UPDATE( rf5c68_update )
/* RF5C68 start */
/************************************************/
-static SND_START( rf5c68 )
+static DEVICE_START( rf5c68 )
{
/* allocate memory for the chip */
- struct rf5c68pcm *chip = device->token;
+ rf5c68_state *chip = get_safe_token(device);
/* allocate the stream */
- chip->stream = stream_create(device, 0, 2, clock / 384, chip, rf5c68_update);
+ chip->stream = stream_create(device, 0, 2, device->clock / 384, chip, rf5c68_update);
}
@@ -135,10 +146,10 @@ static SND_START( rf5c68 )
/* RF5C68 write register */
/************************************************/
-WRITE8_HANDLER( rf5c68_reg_w )
+WRITE8_DEVICE_HANDLER( rf5c68_w )
{
- struct rf5c68pcm *chip = sndti_token(SOUND_RF5C68, 0);
- struct pcm_channel *chan = &chip->chan[chip->cbank];
+ rf5c68_state *chip = get_safe_token(device);
+ pcm_channel *chan = &chip->chan[chip->cbank];
int i;
/* force the stream to update first */
@@ -201,9 +212,9 @@ WRITE8_HANDLER( rf5c68_reg_w )
/* RF5C68 read memory */
/************************************************/
-READ8_HANDLER( rf5c68_r )
+READ8_DEVICE_HANDLER( rf5c68_mem_r )
{
- struct rf5c68pcm *chip = sndti_token(SOUND_RF5C68, 0);
+ rf5c68_state *chip = get_safe_token(device);
return chip->data[chip->wbank * 0x1000 + offset];
}
@@ -212,9 +223,9 @@ READ8_HANDLER( rf5c68_r )
/* RF5C68 write memory */
/************************************************/
-WRITE8_HANDLER( rf5c68_w )
+WRITE8_DEVICE_HANDLER( rf5c68_mem_w )
{
- struct rf5c68pcm *chip = sndti_token(SOUND_RF5C68, 0);
+ rf5c68_state *chip = get_safe_token(device);
chip->data[chip->wbank * 0x1000 + offset] = data;
}
@@ -224,34 +235,24 @@ WRITE8_HANDLER( rf5c68_w )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( rf5c68 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( rf5c68 )
+DEVICE_GET_INFO( rf5c68 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct rf5c68pcm); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(rf5c68_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( rf5c68 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( rf5c68 ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( rf5c68 ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "RF5C68"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Ricoh PCM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "RF5C68"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Ricoh PCM"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/rf5c68.h b/src/emu/sound/rf5c68.h
index 3b38d4b41ee..2231a63e1ed 100644
--- a/src/emu/sound/rf5c68.h
+++ b/src/emu/sound/rf5c68.h
@@ -8,12 +8,12 @@
#define __RF5C68_H__
/******************************************/
-WRITE8_HANDLER( rf5c68_reg_w );
+WRITE8_DEVICE_HANDLER( rf5c68_w );
-READ8_HANDLER( rf5c68_r );
-WRITE8_HANDLER( rf5c68_w );
+READ8_DEVICE_HANDLER( rf5c68_mem_r );
+WRITE8_DEVICE_HANDLER( rf5c68_mem_w );
-SND_GET_INFO( rf5c68 );
-#define SOUND_RF5C68 SND_GET_INFO_NAME( rf5c68 )
+DEVICE_GET_INFO( rf5c68 );
+#define SOUND_RF5C68 DEVICE_GET_INFO_NAME( rf5c68 )
#endif /* __RF5C68_H__ */
diff --git a/src/emu/sound/s14001a.c b/src/emu/sound/s14001a.c
index 6de40b5c51f..3f04481349a 100644
--- a/src/emu/sound/s14001a.c
+++ b/src/emu/sound/s14001a.c
@@ -261,6 +261,16 @@ typedef struct
UINT8 VSU1000_amp; // amplitude setting on VSU-1000 board
} S14001AChip;
+INLINE S14001AChip *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_S14001A);
+ return (S14001AChip *)device->token;
+}
+
+
//#define DEBUGSTATE
#define SILENCE 0x7 // value output when silent
@@ -557,9 +567,9 @@ static STREAM_UPDATE( s14001a_pcm_update )
}
}
-static SND_START( s14001a )
+static DEVICE_START( s14001a )
{
- S14001AChip *chip = device->token;
+ S14001AChip *chip = get_safe_token(device);
int i;
chip->GlobalSilenceState = 1;
@@ -573,20 +583,12 @@ static SND_START( s14001a )
chip->SpeechRom = device->region;
- chip->stream = stream_create(device, 0, 1, clock ? clock : device->machine->sample_rate, chip, s14001a_pcm_update);
-}
-
-static SND_SET_INFO( s14001a )
-{
- switch (state)
- {
- /* no parameters to set */
- }
+ chip->stream = stream_create(device, 0, 1, device->clock ? device->clock : device->machine->sample_rate, chip, s14001a_pcm_update);
}
-int s14001a_bsy_0_r(void)
+int s14001a_bsy_r(const device_config *device)
{
- S14001AChip *chip = sndti_token(SOUND_S14001A, 0);
+ S14001AChip *chip = get_safe_token(device);
stream_update(chip->stream);
#ifdef DEBUGSTATE
fprintf(stderr,"busy state checked: %d\n",(chip->machineState != 0) );
@@ -594,51 +596,50 @@ int s14001a_bsy_0_r(void)
return (chip->machineState != 0);
}
-void s14001a_reg_0_w(int data)
+void s14001a_reg_w(const device_config *device, int data)
{
- S14001AChip *chip = sndti_token(SOUND_S14001A, 0);
+ S14001AChip *chip = get_safe_token(device);
stream_update(chip->stream);
chip->WordInput = data;
}
-void s14001a_rst_0_w(int data)
+void s14001a_rst_w(const device_config *device, int data)
{
- S14001AChip *chip = sndti_token(SOUND_S14001A, 0);
+ S14001AChip *chip = get_safe_token(device);
stream_update(chip->stream);
chip->LatchedWord = chip->WordInput;
chip->resetState = (data==1);
chip->machineState = chip->resetState ? 1 : chip->machineState;
}
-void s14001a_set_clock(int clock)
+void s14001a_set_clock(const device_config *device, int clock)
{
- S14001AChip *chip = sndti_token(SOUND_S14001A, 0);
+ S14001AChip *chip = get_safe_token(device);
stream_set_sample_rate(chip->stream, clock);
}
-void s14001a_set_volume(int volume)
+void s14001a_set_volume(const device_config *device, int volume)
{
- S14001AChip *chip = sndti_token(SOUND_S14001A, 0);
+ S14001AChip *chip = get_safe_token(device);
stream_update(chip->stream);
chip->VSU1000_amp = volume;
}
-SND_GET_INFO( s14001a )
+DEVICE_GET_INFO( s14001a )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(S14001AChip); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(S14001AChip); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( s14001a ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( s14001a ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( s14001a ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "S14001A"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "TSI S14001A"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.31"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Jonathan Gevaryahu"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "S14001A"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "TSI S14001A"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.31"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Jonathan Gevaryahu"); break;
}
}
diff --git a/src/emu/sound/s14001a.h b/src/emu/sound/s14001a.h
index d05f776c1e7..f465fb2df18 100644
--- a/src/emu/sound/s14001a.h
+++ b/src/emu/sound/s14001a.h
@@ -3,14 +3,14 @@
#ifndef __S14001A_H__
#define __S14001A_H__
-int s14001a_bsy_0_r(void); /* read BUSY pin */
-void s14001a_reg_0_w(int data); /* write to input latch */
-void s14001a_rst_0_w(int data); /* write to RESET pin */
-void s14001a_set_clock(int clock); /* set VSU-1000 clock */
-void s14001a_set_volume(int volume); /* set VSU-1000 volume control */
+int s14001a_bsy_r(const device_config *device); /* read BUSY pin */
+void s14001a_reg_w(const device_config *device, int data); /* write to input latch */
+void s14001a_rst_w(const device_config *device, int data); /* write to RESET pin */
+void s14001a_set_clock(const device_config *device, int clock); /* set VSU-1000 clock */
+void s14001a_set_volume(const device_config *device, int volume); /* set VSU-1000 volume control */
-SND_GET_INFO( s14001a );
-#define SOUND_S14001A SND_GET_INFO_NAME( s14001a )
+DEVICE_GET_INFO( s14001a );
+#define SOUND_S14001A DEVICE_GET_INFO_NAME( s14001a )
#endif /* __S14001A_H__ */
diff --git a/src/emu/sound/saa1099.c b/src/emu/sound/saa1099.c
index d7d975264ba..37fd4e3600a 100644
--- a/src/emu/sound/saa1099.c
+++ b/src/emu/sound/saa1099.c
@@ -100,7 +100,8 @@ struct saa1099_noise
};
/* this structure defines a SAA1099 chip */
-struct SAA1099
+typedef struct _saa1099_state saa1099_state;
+struct _saa1099_state
{
const device_config *device;
sound_stream * stream; /* our stream */
@@ -169,7 +170,18 @@ static const UINT8 envelope[8][64] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15 }
};
-static void saa1099_envelope(struct SAA1099 *saa, int ch)
+
+INLINE saa1099_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_SAA1099);
+ return (saa1099_state *)device->token;
+}
+
+
+static void saa1099_envelope(saa1099_state *saa, int ch)
{
if (saa->env_enable[ch])
{
@@ -214,7 +226,7 @@ static void saa1099_envelope(struct SAA1099 *saa, int ch)
static STREAM_UPDATE( saa1099_update )
{
- struct SAA1099 *saa = param;
+ saa1099_state *saa = param;
int j, ch;
/* if the channels are disabled we're done */
@@ -312,26 +324,26 @@ static STREAM_UPDATE( saa1099_update )
-static SND_START( saa1099 )
+static DEVICE_START( saa1099 )
{
- struct SAA1099 *saa = device->token;
+ saa1099_state *saa = get_safe_token(device);
/* copy global parameters */
saa->device = device;
- saa->sample_rate = clock / 256;
+ saa->sample_rate = device->clock / 256;
/* for each chip allocate one stream */
saa->stream = stream_create(device, 0, 2, saa->sample_rate, saa, saa1099_update);
}
-static void saa1099_control_port_w( int chip, int reg, int data )
+WRITE8_DEVICE_HANDLER( saa1099_control_w )
{
- struct SAA1099 *saa = sndti_token(SOUND_SAA1099, chip);
+ saa1099_state *saa = get_safe_token(device);
if ((data & 0xff) > 0x1c)
{
/* Error! */
- logerror("%s: (SAA1099 #%d) Unknown register selected\n",cpuexec_describe_context(saa->device->machine), chip);
+ logerror("%s: (SAA1099 '%s') Unknown register selected\n",cpuexec_describe_context(device->machine), device->tag);
}
saa->selected_reg = data & 0x1f;
@@ -346,9 +358,9 @@ static void saa1099_control_port_w( int chip, int reg, int data )
}
-static void saa1099_write_port_w( int chip, int offset, int data )
+WRITE8_DEVICE_HANDLER( saa1099_data_w )
{
- struct SAA1099 *saa = sndti_token(SOUND_SAA1099, chip);
+ saa1099_state *saa = get_safe_token(device);
int reg = saa->selected_reg;
int ch;
@@ -417,7 +429,7 @@ static void saa1099_write_port_w( int chip, int offset, int data )
int i;
/* Synch & Reset generators */
- logerror("%s: (SAA1099 #%d) -reg 0x1c- Chip reset\n",cpuexec_describe_context(saa->device->machine), chip);
+ logerror("%s: (SAA1099 '%s') -reg 0x1c- Chip reset\n",cpuexec_describe_context(device->machine), device->tag);
for (i = 0; i < 6; i++)
{
saa->channels[i].level = 0;
@@ -426,93 +438,33 @@ static void saa1099_write_port_w( int chip, int offset, int data )
}
break;
default: /* Error! */
- logerror("%s: (SAA1099 #%d) Unknown operation (reg:%02x, data:%02x)\n",cpuexec_describe_context(saa->device->machine), chip, reg, data);
+ logerror("%s: (SAA1099 '%s') Unknown operation (reg:%02x, data:%02x)\n",cpuexec_describe_context(device->machine), device->tag, reg, data);
}
}
-/*******************************************
- SAA1099 interface functions
-*******************************************/
-
-WRITE8_HANDLER( saa1099_control_port_0_w )
-{
- saa1099_control_port_w(0, offset, data);
-}
-
-WRITE8_HANDLER( saa1099_write_port_0_w )
-{
- saa1099_write_port_w(0, offset, data);
-}
-
-WRITE8_HANDLER( saa1099_control_port_1_w )
-{
- saa1099_control_port_w(1, offset, data);
-}
-
-WRITE8_HANDLER( saa1099_write_port_1_w )
-{
- saa1099_write_port_w(1, offset, data);
-}
-
-WRITE16_HANDLER( saa1099_control_port_0_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- saa1099_control_port_w(0, offset, data & 0xff);
-}
-
-WRITE16_HANDLER( saa1099_write_port_0_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- saa1099_write_port_w(0, offset, data & 0xff);
-}
-
-WRITE16_HANDLER( saa1099_control_port_1_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- saa1099_control_port_w(1, offset, data & 0xff);
-}
-
-WRITE16_HANDLER( saa1099_write_port_1_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
- saa1099_write_port_w(1, offset, data & 0xff);
-}
-
-
-
/**************************************************************************
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( saa1099 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( saa1099 )
+DEVICE_GET_INFO( saa1099 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct SAA1099); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(saa1099_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( saa1099 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( saa1099 ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( saa1099 ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "SAA1099"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Philips"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "SAA1099"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Philips"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/saa1099.h b/src/emu/sound/saa1099.h
index 474ed4cf5e8..f91eba85723 100644
--- a/src/emu/sound/saa1099.h
+++ b/src/emu/sound/saa1099.h
@@ -7,17 +7,10 @@
Philips SAA1099 Sound driver
**********************************************/
-WRITE8_HANDLER( saa1099_control_port_0_w );
-WRITE8_HANDLER( saa1099_write_port_0_w );
-WRITE8_HANDLER( saa1099_control_port_1_w );
-WRITE8_HANDLER( saa1099_write_port_1_w );
+WRITE8_DEVICE_HANDLER( saa1099_control_w );
+WRITE8_DEVICE_HANDLER( saa1099_data_w );
-WRITE16_HANDLER( saa1099_control_port_0_lsb_w );
-WRITE16_HANDLER( saa1099_write_port_0_lsb_w );
-WRITE16_HANDLER( saa1099_control_port_1_lsb_w );
-WRITE16_HANDLER( saa1099_write_port_1_lsb_w );
-
-SND_GET_INFO( saa1099 );
-#define SOUND_SAA1099 SND_GET_INFO_NAME( saa1099 )
+DEVICE_GET_INFO( saa1099 );
+#define SOUND_SAA1099 DEVICE_GET_INFO_NAME( saa1099 )
#endif /* __SAA1099_H__ */
diff --git a/src/emu/sound/samples.c b/src/emu/sound/samples.c
index 88cc8411638..e0c9d74c642 100644
--- a/src/emu/sound/samples.c
+++ b/src/emu/sound/samples.c
@@ -226,9 +226,9 @@ struct loaded_samples *readsamples(const char *const *samplenames, const char *b
/* Start one of the samples loaded from disk. Note: channel must be in the range */
/* 0 .. Samplesinterface->channels-1. It is NOT the discrete channel to pass to */
/* mixer_play_sample() */
-void sample_start_n(int num,int channel,int samplenum,int loop)
+void sample_start(const device_config *device,int channel,int samplenum,int loop)
{
- struct samples_info *info = sndti_token(SOUND_SAMPLES, num);
+ struct samples_info *info = device->token;
struct sample_channel *chan;
struct loaded_sample *sample;
@@ -256,15 +256,10 @@ void sample_start_n(int num,int channel,int samplenum,int loop)
chan->loop = loop;
}
-void sample_start(int channel,int samplenum,int loop)
-{
- sample_start_n(0,channel,samplenum,loop);
-}
-
-void sample_start_raw_n(int num,int channel,const INT16 *sampledata,int samples,int frequency,int loop)
+void sample_start_raw(const device_config *device,int channel,const INT16 *sampledata,int samples,int frequency,int loop)
{
- struct samples_info *info = sndti_token(SOUND_SAMPLES, num);
+ struct samples_info *info = device->token;
struct sample_channel *chan;
assert( channel < info->numchannels );
@@ -285,15 +280,10 @@ void sample_start_raw_n(int num,int channel,const INT16 *sampledata,int samples,
chan->loop = loop;
}
-void sample_start_raw(int channel,const INT16 *sampledata,int samples,int frequency,int loop)
-{
- sample_start_raw_n(0,channel,sampledata,samples,frequency,loop);
-}
-
-void sample_set_freq_n(int num,int channel,int freq)
+void sample_set_freq(const device_config *device,int channel,int freq)
{
- struct samples_info *info = sndti_token(SOUND_SAMPLES, num);
+ struct samples_info *info = device->token;
struct sample_channel *chan;
assert( channel < info->numchannels );
@@ -306,15 +296,10 @@ void sample_set_freq_n(int num,int channel,int freq)
chan->step = ((INT64)freq << FRAC_BITS) / info->device->machine->sample_rate;
}
-void sample_set_freq(int channel,int freq)
-{
- sample_set_freq_n(0,channel,freq);
-}
-
-void sample_set_volume_n(int num,int channel,float volume)
+void sample_set_volume(const device_config *device,int channel,float volume)
{
- struct samples_info *info = sndti_token(SOUND_SAMPLES, num);
+ struct samples_info *info = device->token;
struct sample_channel *chan;
assert( channel < info->numchannels );
@@ -324,15 +309,10 @@ void sample_set_volume_n(int num,int channel,float volume)
stream_set_output_gain(chan->stream, 0, volume);
}
-void sample_set_volume(int channel,float volume)
-{
- sample_set_volume_n(0,channel,volume);
-}
-
-void sample_set_pause_n(int num,int channel,int pause)
+void sample_set_pause(const device_config *device,int channel,int pause)
{
- struct samples_info *info = sndti_token(SOUND_SAMPLES, num);
+ struct samples_info *info = device->token;
struct sample_channel *chan;
assert( channel < info->numchannels );
@@ -345,15 +325,10 @@ void sample_set_pause_n(int num,int channel,int pause)
chan->paused = pause;
}
-void sample_set_pause(int channel,int pause)
-{
- sample_set_pause_n(0,channel,pause);
-}
-
-void sample_stop_n(int num,int channel)
+void sample_stop(const device_config *device,int channel)
{
- struct samples_info *info = sndti_token(SOUND_SAMPLES, num);
+ struct samples_info *info = device->token;
struct sample_channel *chan;
assert( channel < info->numchannels );
@@ -366,15 +341,10 @@ void sample_stop_n(int num,int channel)
chan->source_num = -1;
}
-void sample_stop(int channel)
-{
- sample_stop_n(0,channel);
-}
-
-int sample_get_base_freq_n(int num,int channel)
+int sample_get_base_freq(const device_config *device,int channel)
{
- struct samples_info *info = sndti_token(SOUND_SAMPLES, num);
+ struct samples_info *info = device->token;
struct sample_channel *chan;
assert( channel < info->numchannels );
@@ -386,15 +356,10 @@ int sample_get_base_freq_n(int num,int channel)
return chan->basefreq;
}
-int sample_get_base_freq(int channel)
-{
- return sample_get_base_freq_n(0,channel);
-}
-
-int sample_playing_n(int num,int channel)
+int sample_playing(const device_config *device,int channel)
{
- struct samples_info *info = sndti_token(SOUND_SAMPLES, num);
+ struct samples_info *info = device->token;
struct sample_channel *chan;
assert( channel < info->numchannels );
@@ -406,32 +371,6 @@ int sample_playing_n(int num,int channel)
return (chan->source != NULL);
}
-int sample_playing(int channel)
-{
- return sample_playing_n(0,channel);
-}
-
-
-int sample_loaded_n(int num,int samplenum)
-{
- int ret = 0;
- struct samples_info *info = sndti_token(SOUND_SAMPLES, num);
-
- if (info->samples != NULL)
- {
- assert( samplenum < info->samples->total );
-
- ret = (info->samples->sample[samplenum].data != NULL);
- }
-
- return ret;
-}
-
-int sample_loaded(int samplenum)
-{
- return sample_loaded_n(0,samplenum);
-}
-
static STREAM_UPDATE( sample_update_sound )
{
@@ -520,7 +459,7 @@ static STATE_POSTLOAD( samples_postload )
}
-static SND_START( samples )
+static DEVICE_START( samples )
{
int i;
const samples_interface *intf = device->static_config;
@@ -568,34 +507,24 @@ static SND_START( samples )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( samples )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( samples )
+DEVICE_GET_INFO( samples )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct samples_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(struct samples_info); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( samples ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( samples ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( samples ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "Samples"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Big Hack"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.1"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "Samples"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Big Hack"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.1"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/samples.h b/src/emu/sound/samples.h
index 73ce770ff70..ff8e3fa0911 100644
--- a/src/emu/sound/samples.h
+++ b/src/emu/sound/samples.h
@@ -27,32 +27,20 @@ struct _samples_interface
#define SAMPLES_START(name) void name(const device_config *device)
-void sample_start_n(int num,int channel,int samplenum,int loop);
-void sample_start_raw_n(int num,int channel,const INT16 *sampledata,int samples,int frequency,int loop);
-void sample_set_freq_n(int num,int channel,int freq);
-void sample_set_volume_n(int num,int channel,float volume);
-void sample_set_pause_n(int num,int channel,int pause);
-void sample_stop_n(int num,int channel);
-int sample_get_base_freq_n(int num,int channel);
-int sample_playing_n(int num,int channel);
-int sample_loaded_n(int num,int samplenum);
-
-/* shortcuts for backwards compatibilty */
-void sample_start(int channel,int samplenum,int loop);
-void sample_start_raw(int channel,const INT16 *sampledata,int samples,int frequency,int loop);
-void sample_set_freq(int channel,int freq);
-void sample_set_volume(int channel,float volume);
-void sample_set_pause(int channel,int pause);
-void sample_stop(int channel);
-int sample_get_base_freq(int channel);
-int sample_playing(int channel);
-int sample_loaded(int samplenum);
+void sample_start(const device_config *device,int channel,int samplenum,int loop);
+void sample_start_raw(const device_config *device,int channel,const INT16 *sampledata,int samples,int frequency,int loop);
+void sample_set_freq(const device_config *device,int channel,int freq);
+void sample_set_volume(const device_config *device,int channel,float volume);
+void sample_set_pause(const device_config *device,int channel,int pause);
+void sample_stop(const device_config *device,int channel);
+int sample_get_base_freq(const device_config *device,int channel);
+int sample_playing(const device_config *device,int channel);
/* helper function that reads samples from disk - this can be used by other */
/* drivers as well (e.g. a sound chip emulator needing drum samples) */
struct loaded_samples *readsamples(const char *const *samplenames, const char *name);
-SND_GET_INFO( samples );
-#define SOUND_SAMPLES SND_GET_INFO_NAME( samples )
+DEVICE_GET_INFO( samples );
+#define SOUND_SAMPLES DEVICE_GET_INFO_NAME( samples )
#endif /* __SAMPLES_H__ */
diff --git a/src/emu/sound/scsp.c b/src/emu/sound/scsp.c
index c265bf69f3a..765fe91b701 100644
--- a/src/emu/sound/scsp.c
+++ b/src/emu/sound/scsp.c
@@ -177,6 +177,7 @@ struct _SLOT
#define USEDSP
+typedef struct _SCSP SCSP;
struct _SCSP
{
union
@@ -194,7 +195,7 @@ struct _SCSP
unsigned char *SCSPRAM;
UINT32 SCSPRAM_LENGTH;
char Master;
- void (*Int68kCB)(running_machine *machine, int irq);
+ void (*Int68kCB)(const device_config *device, int irq);
sound_stream * stream;
INT32 *buffertmpl,*buffertmpr;
@@ -244,6 +245,16 @@ static int length;
static signed short *RBUFDST; //this points to where the sample will be stored in the RingBuf
+
+INLINE SCSP *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_SCSP);
+ return (SCSP *)device->token;
+}
+
static unsigned char DecodeSCI(struct _SCSP *SCSP,unsigned char irq)
{
unsigned char SCI=0;
@@ -261,7 +272,6 @@ static void CheckPendingIRQ(struct _SCSP *SCSP)
{
UINT32 pend=SCSP->udata.data[0x20/2];
UINT32 en=SCSP->udata.data[0x1e/2];
- running_machine *machine = SCSP->device->machine;
if(SCSP->MidiW!=SCSP->MidiR)
{
@@ -273,48 +283,47 @@ static void CheckPendingIRQ(struct _SCSP *SCSP)
if(pend&0x40)
if(en&0x40)
{
- SCSP->Int68kCB(machine, SCSP->IrqTimA);
+ SCSP->Int68kCB(SCSP->device, SCSP->IrqTimA);
return;
}
if(pend&0x80)
if(en&0x80)
{
- SCSP->Int68kCB(machine, SCSP->IrqTimBC);
+ SCSP->Int68kCB(SCSP->device, SCSP->IrqTimBC);
return;
}
if(pend&0x100)
if(en&0x100)
{
- SCSP->Int68kCB(machine, SCSP->IrqTimBC);
+ SCSP->Int68kCB(SCSP->device, SCSP->IrqTimBC);
return;
}
if(pend&8)
if (en&8)
{
- SCSP->Int68kCB(machine, SCSP->IrqMidi);
+ SCSP->Int68kCB(SCSP->device, SCSP->IrqMidi);
SCSP->udata.data[0x20/2] &= ~8;
return;
}
- SCSP->Int68kCB(machine, 0);
+ SCSP->Int68kCB(SCSP->device, 0);
}
static void ResetInterrupts(struct _SCSP *SCSP)
{
UINT32 reset = SCSP->udata.data[0x22/2];
- running_machine *machine = SCSP->device->machine;
if (reset & 0x40)
{
- SCSP->Int68kCB(machine, -SCSP->IrqTimA);
+ SCSP->Int68kCB(SCSP->device, -SCSP->IrqTimA);
}
if (reset & 0x180)
{
- SCSP->Int68kCB(machine, -SCSP->IrqTimBC);
+ SCSP->Int68kCB(SCSP->device, -SCSP->IrqTimBC);
}
if (reset & 0x8)
{
- SCSP->Int68kCB(machine, -SCSP->IrqMidi);
+ SCSP->Int68kCB(SCSP->device, -SCSP->IrqMidi);
}
CheckPendingIRQ(SCSP);
@@ -718,7 +727,7 @@ static void SCSP_UpdateReg(struct _SCSP *SCSP, int reg)
break;
case 0x6:
case 0x7:
- scsp_midi_in(space, 0, SCSP->udata.data[0x6/2]&0xff, 0);
+ scsp_midi_in(devtag_get_device(space->machine, SOUND, "scsp"), 0, SCSP->udata.data[0x6/2]&0xff, 0);
break;
case 0x12:
case 0x13:
@@ -839,7 +848,7 @@ static void SCSP_UpdateRegR(struct _SCSP *SCSP, int reg)
unsigned short v=SCSP->udata.data[0x5/2];
v&=0xff00;
v|=SCSP->MidiStack[SCSP->MidiR];
- SCSP[0].Int68kCB(SCSP->device->machine, -SCSP->IrqMidi); // cancel the IRQ
+ SCSP[0].Int68kCB(SCSP->device, -SCSP->IrqMidi); // cancel the IRQ
if(SCSP->MidiR!=SCSP->MidiW)
{
++SCSP->MidiR;
@@ -1221,11 +1230,11 @@ static STREAM_UPDATE( SCSP_Update )
SCSP_DoMasterSamples(SCSP, samples);
}
-static SND_START( scsp )
+static DEVICE_START( scsp )
{
const scsp_interface *intf;
- struct _SCSP *SCSP = device->token;
+ struct _SCSP *SCSP = get_safe_token(device);
intf = device->static_config;
@@ -1241,9 +1250,9 @@ static SND_START( scsp )
}
-void SCSP_set_ram_base(int which, void *base)
+void scsp_set_ram_base(const device_config *device, void *base)
{
- struct _SCSP *SCSP = sndti_token(SOUND_SCSP, which);
+ struct _SCSP *SCSP = get_safe_token(device);
if (SCSP)
{
SCSP->SCSPRAM = base;
@@ -1254,9 +1263,9 @@ void SCSP_set_ram_base(int which, void *base)
}
-READ16_HANDLER( scsp_0_r )
+READ16_DEVICE_HANDLER( scsp_r )
{
- struct _SCSP *SCSP = sndti_token(SOUND_SCSP, 0);
+ struct _SCSP *SCSP = get_safe_token(device);
stream_update(SCSP->stream);
@@ -1265,9 +1274,9 @@ READ16_HANDLER( scsp_0_r )
UINT32* stv_scu;
-WRITE16_HANDLER( scsp_0_w )
+WRITE16_DEVICE_HANDLER( scsp_w )
{
- struct _SCSP *SCSP = sndti_token(SOUND_SCSP, 0);
+ struct _SCSP *SCSP = get_safe_token(device);
UINT16 tmp, *scsp_regs;
stream_update(SCSP->stream);
@@ -1305,7 +1314,7 @@ WRITE16_HANDLER( scsp_0_w )
SCSP->scsp_dtlg = scsp_regs[0x416/2] & 0x0ffe;
if(scsp_dexe)
{
- dma_scsp(space, SCSP);
+ dma_scsp(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), SCSP);
scsp_regs[0x416/2]^=0x1000;//disable starting bit
}
break;
@@ -1313,7 +1322,7 @@ WRITE16_HANDLER( scsp_0_w )
case 0x42a:
if(stv_scu && !(stv_scu[40] & 0x40) /*&& scsp_regs[0x42c/2] & 0x20*/)/*Main CPU allow sound irq*/
{
- cpu_set_input_line_and_vector(space->machine->cpu[0], 9, HOLD_LINE , 0x46);
+ cpu_set_input_line_and_vector(device->machine->cpu[0], 9, HOLD_LINE , 0x46);
logerror("SCSP: Main CPU interrupt\n");
}
break;
@@ -1324,25 +1333,9 @@ WRITE16_HANDLER( scsp_0_w )
}
}
-READ16_HANDLER( scsp_1_r )
+WRITE16_DEVICE_HANDLER( scsp_midi_in )
{
- struct _SCSP *SCSP = sndti_token(SOUND_SCSP, 1);
- return SCSP_r16(SCSP, offset*2);
-}
-
-WRITE16_HANDLER( scsp_1_w )
-{
- struct _SCSP *SCSP = sndti_token(SOUND_SCSP, 1);
- unsigned short tmp;
-
- tmp = SCSP_r16(SCSP, offset*2);
- COMBINE_DATA(&tmp);
- SCSP_w16(SCSP, offset*2, tmp);
-}
-
-WRITE16_HANDLER( scsp_midi_in )
-{
- struct _SCSP *SCSP = sndti_token(SOUND_SCSP, 0);
+ struct _SCSP *SCSP = get_safe_token(device);
SCSP->MidiStack[SCSP->MidiW++]=data;
SCSP->MidiW &= 31;
@@ -1350,9 +1343,9 @@ WRITE16_HANDLER( scsp_midi_in )
CheckPendingIRQ(SCSP);
}
-READ16_HANDLER( scsp_midi_out_r )
+READ16_DEVICE_HANDLER( scsp_midi_out_r )
{
- struct _SCSP *SCSP = sndti_token(SOUND_SCSP, 0);
+ struct _SCSP *SCSP = get_safe_token(device);
unsigned char val;
val=SCSP->MidiStack[SCSP->MidiR++];
@@ -1366,34 +1359,24 @@ READ16_HANDLER( scsp_midi_out_r )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( scsp )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( scsp )
+DEVICE_GET_INFO( scsp )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct _SCSP); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(struct _SCSP); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( scsp ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( scsp ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( scsp ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "SCSP"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Sega/Yamaha custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "2.1.1"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "SCSP"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Sega/Yamaha custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "2.1.1"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/scsp.h b/src/emu/sound/scsp.h
index 889a8d0995b..ab197d595e7 100644
--- a/src/emu/sound/scsp.h
+++ b/src/emu/sound/scsp.h
@@ -11,24 +11,22 @@ typedef struct _scsp_interface scsp_interface;
struct _scsp_interface
{
int roffset; /* offset in the region */
- void (*irq_callback)(running_machine *machine, int state); /* irq callback */
+ void (*irq_callback)(const device_config *device, int state); /* irq callback */
};
-void SCSP_set_ram_base(int which, void *base);
+void scsp_set_ram_base(const device_config *device, void *base);
// SCSP register access
-READ16_HANDLER( scsp_0_r );
-WRITE16_HANDLER( scsp_0_w );
-READ16_HANDLER( scsp_1_r );
-WRITE16_HANDLER( scsp_1_w );
+READ16_DEVICE_HANDLER( scsp_r );
+WRITE16_DEVICE_HANDLER( scsp_w );
// MIDI I/O access (used for comms on Model 2/3)
-WRITE16_HANDLER( scsp_midi_in );
-READ16_HANDLER( scsp_midi_out_r );
+WRITE16_DEVICE_HANDLER( scsp_midi_in );
+READ16_DEVICE_HANDLER( scsp_midi_out_r );
extern UINT32* stv_scu;
-SND_GET_INFO( scsp );
-#define SOUND_SCSP SND_GET_INFO_NAME( scsp )
+DEVICE_GET_INFO( scsp );
+#define SOUND_SCSP DEVICE_GET_INFO_NAME( scsp )
#endif /* __SCSP_H__ */
diff --git a/src/emu/sound/segapcm.c b/src/emu/sound/segapcm.c
index 0cfd7fe1c3a..5d4b0813a32 100644
--- a/src/emu/sound/segapcm.c
+++ b/src/emu/sound/segapcm.c
@@ -6,7 +6,8 @@
#include "streams.h"
#include "segapcm.h"
-struct segapcm
+typedef struct _segapcm_state segapcm_state;
+struct _segapcm_state
{
UINT8 *ram;
UINT8 low[16];
@@ -16,9 +17,18 @@ struct segapcm
sound_stream * stream;
};
+INLINE segapcm_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_SEGAPCM);
+ return (segapcm_state *)device->token;
+}
+
static STREAM_UPDATE( SEGAPCM_update )
{
- struct segapcm *spcm = param;
+ segapcm_state *spcm = param;
int ch;
/* clear the buffers */
@@ -76,11 +86,11 @@ static STREAM_UPDATE( SEGAPCM_update )
}
}
-static SND_START( segapcm )
+static DEVICE_START( segapcm )
{
const sega_pcm_interface *intf = device->static_config;
int mask, rom_mask, len;
- struct segapcm *spcm = device->token;
+ segapcm_state *spcm = get_safe_token(device);
spcm->rom = (const UINT8 *)device->region;
spcm->ram = auto_malloc(0x800);
@@ -98,23 +108,23 @@ static SND_START( segapcm )
spcm->bankmask = mask & (rom_mask >> spcm->bankshift);
- spcm->stream = stream_create(device, 0, 2, clock / 128, spcm, SEGAPCM_update);
+ spcm->stream = stream_create(device, 0, 2, device->clock / 128, spcm, SEGAPCM_update);
state_save_register_device_item_array(device, 0, spcm->low);
state_save_register_device_item_pointer(device, 0, spcm->ram, 0x800);
}
-WRITE8_HANDLER( sega_pcm_w )
+WRITE8_DEVICE_HANDLER( sega_pcm_w )
{
- struct segapcm *spcm = sndti_token(SOUND_SEGAPCM, 0);
+ segapcm_state *spcm = get_safe_token(device);
stream_update(spcm->stream);
spcm->ram[offset & 0x07ff] = data;
}
-READ8_HANDLER( sega_pcm_r )
+READ8_DEVICE_HANDLER( sega_pcm_r )
{
- struct segapcm *spcm = sndti_token(SOUND_SEGAPCM, 0);
+ segapcm_state *spcm = get_safe_token(device);
stream_update(spcm->stream);
return spcm->ram[offset & 0x07ff];
}
@@ -125,33 +135,23 @@ READ8_HANDLER( sega_pcm_r )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( segapcm )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( segapcm )
+DEVICE_GET_INFO( segapcm )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct segapcm); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(segapcm_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( segapcm ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( segapcm ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( segapcm ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "Sega PCM"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Sega custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "Sega PCM"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Sega custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/segapcm.h b/src/emu/sound/segapcm.h
index bc4e7b3b16d..d23a13e88dc 100644
--- a/src/emu/sound/segapcm.h
+++ b/src/emu/sound/segapcm.h
@@ -20,10 +20,10 @@ struct _sega_pcm_interface
int bank;
};
-WRITE8_HANDLER( sega_pcm_w );
-READ8_HANDLER( sega_pcm_r );
+WRITE8_DEVICE_HANDLER( sega_pcm_w );
+READ8_DEVICE_HANDLER( sega_pcm_r );
-SND_GET_INFO( segapcm );
-#define SOUND_SEGAPCM SND_GET_INFO_NAME( segapcm )
+DEVICE_GET_INFO( segapcm );
+#define SOUND_SEGAPCM DEVICE_GET_INFO_NAME( segapcm )
#endif /* __SEGAPCM_H__ */
diff --git a/src/emu/sound/sid6581.c b/src/emu/sound/sid6581.c
index e86f9e71a4d..30276322ec8 100644
--- a/src/emu/sound/sid6581.c
+++ b/src/emu/sound/sid6581.c
@@ -14,9 +14,10 @@
static SID6581 *get_sid(int indx)
{
- sound_type type = sndnum_to_sndti(indx, NULL);
- assert((type == SOUND_SID6581) || (type == SOUND_SID8580));
- return (SID6581 *) sndti_token(type, indx);
+ return NULL;
+// sound_type type = sndnum_to_sndti(indx, NULL);
+// assert((type == SOUND_SID6581) || (type == SOUND_SID8580));
+// return (SID6581 *) sndti_token(space->machine, type, indx);
}
@@ -29,7 +30,7 @@ static STREAM_UPDATE( sid_update )
-static void sid_start(const device_config *device, int clock, SIDTYPE sidtype)
+static void sid_start(const device_config *device, SIDTYPE sidtype)
{
SID6581 *sid = device->token;
const sid6581_interface *iface = (const sid6581_interface*) device->static_config;
@@ -37,7 +38,7 @@ static void sid_start(const device_config *device, int clock, SIDTYPE sidtype)
sid->device = device;
sid->mixer_channel = stream_create (device, 0, 1, device->machine->sample_rate, (void *) sid, sid_update);
sid->PCMfreq = device->machine->sample_rate;
- sid->clock = clock;
+ sid->clock = device->clock;
sid->ad_read = iface ? iface->ad_read : NULL;
sid->type = sidtype;
@@ -47,7 +48,7 @@ static void sid_start(const device_config *device, int clock, SIDTYPE sidtype)
-static SND_RESET( sid )
+static DEVICE_RESET( sid )
{
SID6581 *sid = device->token;
sidEmuReset(sid);
@@ -55,16 +56,16 @@ static SND_RESET( sid )
-static SND_START( sid6581 )
+static DEVICE_START( sid6581 )
{
- sid_start(device, clock, MOS6581);
+ sid_start(devices, MOS6581);
}
-static SND_START( sid8580 )
+static DEVICE_START( sid8580 )
{
- sid_start(device, clock, MOS8580);
+ sid_start(device, MOS8580);
}
@@ -95,48 +96,38 @@ WRITE8_HANDLER ( sid6581_1_port_w )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( sid6581 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( sid6581 )
+DEVICE_GET_INFO( sid6581 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(SID6581); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(SID6581); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( sid6581 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( sid6581 ); break;
- case SNDINFO_PTR_STOP: info->stop = NULL; break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( sid ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( sid6581 ); break;
+ case DEVINFO_FCT_STOP: info->stop = NULL; break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( sid ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "SID6581"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "SID"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright The MESS Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "SID6581"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "SID"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright The MESS Team"); break;
}
}
-SND_GET_INFO( sid8580 )
+DEVICE_GET_INFO( sid8580 )
{
switch (state)
{
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_START: info->start = SND_START_NAME( sid8580 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( sid8580 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "SID8580"); break;
- default: SND_GET_INFO_CALL(sid6581); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "SID8580"); break;
+ default: DEVICE_GET_INFO_CALL(sid6581); break;
}
}
diff --git a/src/emu/sound/sid6581.h b/src/emu/sound/sid6581.h
index 17bfb4d7f51..37bc8599480 100644
--- a/src/emu/sound/sid6581.h
+++ b/src/emu/sound/sid6581.h
@@ -32,9 +32,9 @@ READ8_HANDLER ( sid6581_1_port_r );
WRITE8_HANDLER ( sid6581_0_port_w );
WRITE8_HANDLER ( sid6581_1_port_w );
-SND_GET_INFO( sid6581 );
-SND_GET_INFO( sid8580 );
-#define SOUND_SID6581 SND_GET_INFO_NAME( sid6581 )
-#define SOUND_SID8580 SND_GET_INFO_NAME( sid8580 )
+DEVICE_GET_INFO( sid6581 );
+DEVICE_GET_INFO( sid8580 );
+#define SOUND_SID6581 DEVICE_GET_INFO_NAME( sid6581 )
+#define SOUND_SID8580 DEVICE_GET_INFO_NAME( sid8580 )
#endif /* __SID6581_H__ */
diff --git a/src/emu/sound/sn76477.c b/src/emu/sound/sn76477.c
index 9fbf95f9b50..bfe491709f5 100644
--- a/src/emu/sound/sn76477.c
+++ b/src/emu/sound/sn76477.c
@@ -196,7 +196,8 @@ static const double out_neg_gain[] =
*
*****************************************************************************/
-struct SN76477
+typedef struct _sn76477_state sn76477_state;
+struct _sn76477_state
{
/* chip's external interface */
UINT32 enable;
@@ -262,6 +263,15 @@ struct SN76477
};
+INLINE sn76477_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_SN76477);
+ return (sn76477_state *)device->token;
+}
+
/*****************************************************************************
*
@@ -293,7 +303,7 @@ INLINE double min(double a, double b)
*
*****************************************************************************/
-static double compute_one_shot_cap_charging_rate(struct SN76477 *sn) /* in V/sec */
+static double compute_one_shot_cap_charging_rate(sn76477_state *sn) /* in V/sec */
{
/* this formula was derived using the data points below
@@ -331,7 +341,7 @@ static double compute_one_shot_cap_charging_rate(struct SN76477 *sn) /* in V/sec
}
-static double compute_one_shot_cap_discharging_rate(struct SN76477 *sn) /* in V/sec */
+static double compute_one_shot_cap_discharging_rate(sn76477_state *sn) /* in V/sec */
{
/* this formula was derived using the data points below
@@ -359,7 +369,7 @@ static double compute_one_shot_cap_discharging_rate(struct SN76477 *sn) /* in V/
}
-static double compute_slf_cap_charging_rate(struct SN76477 *sn) /* in V/sec */
+static double compute_slf_cap_charging_rate(sn76477_state *sn) /* in V/sec */
{
/* this formula was derived using the data points below
@@ -382,7 +392,7 @@ static double compute_slf_cap_charging_rate(struct SN76477 *sn) /* in V/sec */
}
-static double compute_slf_cap_discharging_rate(struct SN76477 *sn) /* in V/sec */
+static double compute_slf_cap_discharging_rate(sn76477_state *sn) /* in V/sec */
{
/* this formula was derived using the data points below
@@ -405,7 +415,7 @@ static double compute_slf_cap_discharging_rate(struct SN76477 *sn) /* in V/sec *
}
-static double compute_vco_cap_charging_discharging_rate(struct SN76477 *sn) /* in V/sec */
+static double compute_vco_cap_charging_discharging_rate(sn76477_state *sn) /* in V/sec */
{
double ret = 0;
@@ -418,7 +428,7 @@ static double compute_vco_cap_charging_discharging_rate(struct SN76477 *sn) /* i
}
-static double compute_vco_duty_cycle(struct SN76477 *sn) /* no measure, just a number */
+static double compute_vco_duty_cycle(sn76477_state *sn) /* no measure, just a number */
{
double ret = 0.5; /* 50% */
@@ -433,7 +443,7 @@ static double compute_vco_duty_cycle(struct SN76477 *sn) /* no measure, just a n
}
-static UINT32 compute_noise_gen_freq(struct SN76477 *sn) /* in Hz */
+static UINT32 compute_noise_gen_freq(sn76477_state *sn) /* in Hz */
{
/* this formula was derived using the data points below
@@ -475,7 +485,7 @@ static UINT32 compute_noise_gen_freq(struct SN76477 *sn) /* in Hz */
}
-static double compute_noise_filter_cap_charging_rate(struct SN76477 *sn) /* in V/sec */
+static double compute_noise_filter_cap_charging_rate(sn76477_state *sn) /* in V/sec */
{
/* this formula was derived using the data points below
@@ -513,7 +523,7 @@ static double compute_noise_filter_cap_charging_rate(struct SN76477 *sn) /* in V
}
-static double compute_noise_filter_cap_discharging_rate(struct SN76477 *sn) /* in V/sec */
+static double compute_noise_filter_cap_discharging_rate(sn76477_state *sn) /* in V/sec */
{
/* this formula was derived using the data points below
@@ -551,7 +561,7 @@ static double compute_noise_filter_cap_discharging_rate(struct SN76477 *sn) /* i
}
-static double compute_attack_decay_cap_charging_rate(struct SN76477 *sn) /* in V/sec */
+static double compute_attack_decay_cap_charging_rate(sn76477_state *sn) /* in V/sec */
{
double ret = 0;
@@ -576,7 +586,7 @@ static double compute_attack_decay_cap_charging_rate(struct SN76477 *sn) /* in
}
-static double compute_attack_decay_cap_discharging_rate(struct SN76477 *sn) /* in V/sec */
+static double compute_attack_decay_cap_discharging_rate(sn76477_state *sn) /* in V/sec */
{
double ret = 0;
@@ -601,7 +611,7 @@ static double compute_attack_decay_cap_discharging_rate(struct SN76477 *sn) /*
}
-static double compute_center_to_peak_voltage_out(struct SN76477 *sn)
+static double compute_center_to_peak_voltage_out(sn76477_state *sn)
{
/* this formula was derived using the data points below
@@ -635,7 +645,7 @@ static double compute_center_to_peak_voltage_out(struct SN76477 *sn)
*
*****************************************************************************/
-static void log_enable_line(struct SN76477 *sn)
+static void log_enable_line(sn76477_state *sn)
{
static const char *const desc[] =
{
@@ -646,7 +656,7 @@ static void log_enable_line(struct SN76477 *sn)
}
-static void log_mixer_mode(struct SN76477 *sn)
+static void log_mixer_mode(sn76477_state *sn)
{
static const char *const desc[] =
{
@@ -658,7 +668,7 @@ static void log_mixer_mode(struct SN76477 *sn)
}
-static void log_envelope_mode(struct SN76477 *sn)
+static void log_envelope_mode(sn76477_state *sn)
{
static const char *const desc[] =
{
@@ -669,7 +679,7 @@ static void log_envelope_mode(struct SN76477 *sn)
}
-static void log_vco_mode(struct SN76477 *sn)
+static void log_vco_mode(sn76477_state *sn)
{
static const char *const desc[] =
{
@@ -680,7 +690,7 @@ static void log_vco_mode(struct SN76477 *sn)
}
-static void log_one_shot_time(struct SN76477 *sn)
+static void log_one_shot_time(sn76477_state *sn)
{
if (!sn->one_shot_cap_voltage_ext)
{
@@ -700,7 +710,7 @@ static void log_one_shot_time(struct SN76477 *sn)
}
-static void log_slf_freq(struct SN76477 *sn)
+static void log_slf_freq(sn76477_state *sn)
{
if (!sn->slf_cap_voltage_ext)
{
@@ -723,19 +733,19 @@ static void log_slf_freq(struct SN76477 *sn)
}
-static void log_vco_pitch_voltage(struct SN76477 *sn)
+static void log_vco_pitch_voltage(sn76477_state *sn)
{
LOG(1, ("SN76477 '%s': VCO pitch voltage (19): %.2fV\n", sn->device->tag, sn->pitch_voltage));
}
-static void log_vco_duty_cycle(struct SN76477 *sn)
+static void log_vco_duty_cycle(sn76477_state *sn)
{
LOG(1, ("SN76477 '%s': VCO duty cycle (16,19): %.0f%%\n", sn->device->tag, compute_vco_duty_cycle(sn) * 100.0));
}
-static void log_vco_freq(struct SN76477 *sn)
+static void log_vco_freq(sn76477_state *sn)
{
if (!sn->vco_cap_voltage_ext)
{
@@ -758,7 +768,7 @@ static void log_vco_freq(struct SN76477 *sn)
}
-static void log_vco_ext_voltage(struct SN76477 *sn)
+static void log_vco_ext_voltage(sn76477_state *sn)
{
if (sn->vco_voltage <= VCO_MAX_EXT_VOLTAGE)
{
@@ -776,7 +786,7 @@ static void log_vco_ext_voltage(struct SN76477 *sn)
}
-static void log_noise_gen_freq(struct SN76477 *sn)
+static void log_noise_gen_freq(sn76477_state *sn)
{
if (sn->noise_clock_ext)
{
@@ -796,7 +806,7 @@ static void log_noise_gen_freq(struct SN76477 *sn)
}
-static void log_noise_filter_freq(struct SN76477 *sn)
+static void log_noise_filter_freq(sn76477_state *sn)
{
if (!sn->noise_filter_cap_voltage_ext)
{
@@ -828,7 +838,7 @@ static void log_noise_filter_freq(struct SN76477 *sn)
}
-static void log_attack_time(struct SN76477 *sn)
+static void log_attack_time(sn76477_state *sn)
{
if (!sn->attack_decay_cap_voltage_ext)
{
@@ -848,7 +858,7 @@ static void log_attack_time(struct SN76477 *sn)
}
-static void log_decay_time(struct SN76477 *sn)
+static void log_decay_time(sn76477_state *sn)
{
if (!sn->attack_decay_cap_voltage_ext)
{
@@ -868,7 +878,7 @@ static void log_decay_time(struct SN76477 *sn)
}
-static void log_voltage_out(struct SN76477 *sn)
+static void log_voltage_out(sn76477_state *sn)
{
LOG(1, ("SN76477 '%s': Voltage OUT range (11,12): %.2fV - %.2fV (clips above %.2fV)\n",
sn->device->tag,
@@ -878,7 +888,7 @@ static void log_voltage_out(struct SN76477 *sn)
}
-static void log_complete_state(struct SN76477 *sn)
+static void log_complete_state(sn76477_state *sn)
{
log_enable_line(sn);
log_mixer_mode(sn);
@@ -906,7 +916,7 @@ static void log_complete_state(struct SN76477 *sn)
*****************************************************************************/
-static void open_wav_file(struct SN76477 *sn)
+static void open_wav_file(sn76477_state *sn)
{
char wav_file_name[30];
@@ -917,13 +927,13 @@ static void open_wav_file(struct SN76477 *sn)
}
-static void close_wav_file(struct SN76477 *sn)
+static void close_wav_file(sn76477_state *sn)
{
wav_close(sn->file);
}
-static void add_wav_data(struct SN76477 *sn, INT16 data_l, INT16 data_r)
+static void add_wav_data(sn76477_state *sn, INT16 data_l, INT16 data_r)
{
wav_add_data_16lr(sn->file, &data_l, &data_r, 1);
}
@@ -936,13 +946,13 @@ static void add_wav_data(struct SN76477 *sn, INT16 data_l, INT16 data_r)
*
*****************************************************************************/
-static void intialize_noise(struct SN76477 *sn)
+static void intialize_noise(sn76477_state *sn)
{
sn->rng = 0;
}
-INLINE UINT32 generate_next_real_noise_bit(struct SN76477 *sn)
+INLINE UINT32 generate_next_real_noise_bit(sn76477_state *sn)
{
UINT32 out = ((sn->rng >> 28) & 1) ^ ((sn->rng >> 0) & 1);
@@ -965,7 +975,7 @@ INLINE UINT32 generate_next_real_noise_bit(struct SN76477 *sn)
*
*****************************************************************************/
-static void _SN76477_enable_w(struct SN76477 *sn, UINT32 data)
+static void _SN76477_enable_w(sn76477_state *sn, UINT32 data)
{
sn->enable = data;
@@ -981,7 +991,7 @@ static void _SN76477_enable_w(struct SN76477 *sn, UINT32 data)
}
-static void SN76477_test_enable_w(struct SN76477 *sn, UINT32 data)
+static void SN76477_test_enable_w(sn76477_state *sn, UINT32 data)
{
if (data != sn->enable)
{
@@ -994,10 +1004,10 @@ static void SN76477_test_enable_w(struct SN76477 *sn, UINT32 data)
}
-void sn76477_enable_w(int chip, UINT32 data)
+void sn76477_enable_w(const device_config *device, UINT32 data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_BOOLEAN;
@@ -1013,16 +1023,16 @@ void sn76477_enable_w(int chip, UINT32 data)
*
*****************************************************************************/
-static void _SN76477_mixer_a_w(struct SN76477 *sn, UINT32 data)
+static void _SN76477_mixer_a_w(sn76477_state *sn, UINT32 data)
{
sn->mixer_mode = (sn->mixer_mode & ~0x01) | (data << 0);
}
-void sn76477_mixer_a_w(int chip, UINT32 data)
+void sn76477_mixer_a_w(const device_config *device, UINT32 data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_BOOLEAN;
@@ -1038,16 +1048,16 @@ void sn76477_mixer_a_w(int chip, UINT32 data)
}
-static void _SN76477_mixer_b_w(struct SN76477 *sn, UINT32 data)
+static void _SN76477_mixer_b_w(sn76477_state *sn, UINT32 data)
{
sn->mixer_mode = (sn->mixer_mode & ~0x02) | (data << 1);
}
-void sn76477_mixer_b_w(int chip, UINT32 data)
+void sn76477_mixer_b_w(const device_config *device, UINT32 data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_BOOLEAN;
@@ -1063,16 +1073,16 @@ void sn76477_mixer_b_w(int chip, UINT32 data)
}
-static void _SN76477_mixer_c_w(struct SN76477 *sn, UINT32 data)
+static void _SN76477_mixer_c_w(sn76477_state *sn, UINT32 data)
{
sn->mixer_mode = (sn->mixer_mode & ~0x04) | (data << 2);
}
-void sn76477_mixer_c_w(int chip, UINT32 data)
+void sn76477_mixer_c_w(const device_config *device, UINT32 data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_BOOLEAN;
@@ -1095,16 +1105,16 @@ void sn76477_mixer_c_w(int chip, UINT32 data)
*
*****************************************************************************/
-static void _SN76477_envelope_1_w(struct SN76477 *sn, UINT32 data)
+static void _SN76477_envelope_1_w(sn76477_state *sn, UINT32 data)
{
sn->envelope_mode = (sn->envelope_mode & ~0x01) | (data << 0);
}
-void sn76477_envelope_1_w(int chip, UINT32 data)
+void sn76477_envelope_1_w(const device_config *device, UINT32 data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_BOOLEAN;
@@ -1120,16 +1130,16 @@ void sn76477_envelope_1_w(int chip, UINT32 data)
}
-static void _SN76477_envelope_2_w(struct SN76477 *sn, UINT32 data)
+static void _SN76477_envelope_2_w(sn76477_state *sn, UINT32 data)
{
sn->envelope_mode = (sn->envelope_mode & ~0x02) | (data << 1);
}
-void sn76477_envelope_2_w(int chip, UINT32 data)
+void sn76477_envelope_2_w(const device_config *device, UINT32 data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_BOOLEAN;
@@ -1152,16 +1162,16 @@ void sn76477_envelope_2_w(int chip, UINT32 data)
*
*****************************************************************************/
-static void _SN76477_vco_w(struct SN76477 *sn, UINT32 data)
+static void _SN76477_vco_w(sn76477_state *sn, UINT32 data)
{
sn->vco_mode = data;
}
-void sn76477_vco_w(int chip, UINT32 data)
+void sn76477_vco_w(const device_config *device, UINT32 data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_BOOLEAN;
@@ -1184,16 +1194,16 @@ void sn76477_vco_w(int chip, UINT32 data)
*
*****************************************************************************/
-static void _SN76477_one_shot_res_w(struct SN76477 *sn, double data)
+static void _SN76477_one_shot_res_w(sn76477_state *sn, double data)
{
sn->one_shot_res = data;
}
-void sn76477_one_shot_res_w(int chip, double data)
+void sn76477_one_shot_res_w(const device_config *device, double data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_POSITIVE;
@@ -1216,16 +1226,16 @@ void sn76477_one_shot_res_w(int chip, double data)
*
*****************************************************************************/
-static void _SN76477_one_shot_cap_w(struct SN76477 *sn, double data)
+static void _SN76477_one_shot_cap_w(sn76477_state *sn, double data)
{
sn->one_shot_cap = data;
}
-void sn76477_one_shot_cap_w(int chip, double data)
+void sn76477_one_shot_cap_w(const device_config *device, double data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_POSITIVE;
@@ -1248,10 +1258,10 @@ void sn76477_one_shot_cap_w(int chip, double data)
*
*****************************************************************************/
-void sn76477_one_shot_cap_voltage_w(int chip, double data)
+void sn76477_one_shot_cap_voltage_w(const device_config *device, double data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_CAP_VOLTAGE;
@@ -1291,16 +1301,16 @@ void sn76477_one_shot_cap_voltage_w(int chip, double data)
*
*****************************************************************************/
-static void _SN76477_slf_res_w(struct SN76477 *sn, double data)
+static void _SN76477_slf_res_w(sn76477_state *sn, double data)
{
sn->slf_res = data;
}
-void sn76477_slf_res_w(int chip, double data)
+void sn76477_slf_res_w(const device_config *device, double data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_POSITIVE;
@@ -1323,16 +1333,16 @@ void sn76477_slf_res_w(int chip, double data)
*
*****************************************************************************/
-static void _SN76477_slf_cap_w(struct SN76477 *sn, double data)
+static void _SN76477_slf_cap_w(sn76477_state *sn, double data)
{
sn->slf_cap = data;
}
-void sn76477_slf_cap_w(int chip, double data)
+void sn76477_slf_cap_w(const device_config *device, double data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_POSITIVE;
@@ -1357,10 +1367,10 @@ void sn76477_slf_cap_w(int chip, double data)
*
*****************************************************************************/
-void sn76477_slf_cap_voltage_w(int chip, double data)
+void sn76477_slf_cap_voltage_w(const device_config *device, double data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_CAP_VOLTAGE;
@@ -1400,16 +1410,16 @@ void sn76477_slf_cap_voltage_w(int chip, double data)
*
*****************************************************************************/
-static void _SN76477_vco_res_w(struct SN76477 *sn, double data)
+static void _SN76477_vco_res_w(sn76477_state *sn, double data)
{
sn->vco_res = data;
}
-void sn76477_vco_res_w(int chip, double data)
+void sn76477_vco_res_w(const device_config *device, double data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_POSITIVE;
@@ -1432,16 +1442,16 @@ void sn76477_vco_res_w(int chip, double data)
*
*****************************************************************************/
-static void _SN76477_vco_cap_w(struct SN76477 *sn, double data)
+static void _SN76477_vco_cap_w(sn76477_state *sn, double data)
{
sn->vco_cap = data;
}
-void sn76477_vco_cap_w(int chip, double data)
+void sn76477_vco_cap_w(const device_config *device, double data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_POSITIVE;
@@ -1464,10 +1474,10 @@ void sn76477_vco_cap_w(int chip, double data)
*
*****************************************************************************/
-void sn76477_vco_cap_voltage_w(int chip, double data)
+void sn76477_vco_cap_voltage_w(const device_config *device, double data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_CAP_VOLTAGE;
@@ -1507,16 +1517,16 @@ void sn76477_vco_cap_voltage_w(int chip, double data)
*
*****************************************************************************/
-static void _SN76477_vco_voltage_w(struct SN76477 *sn, double data)
+static void _SN76477_vco_voltage_w(sn76477_state *sn, double data)
{
sn->vco_voltage = data;
}
-void sn76477_vco_voltage_w(int chip, double data)
+void sn76477_vco_voltage_w(const device_config *device, double data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_VOLTAGE;
@@ -1540,16 +1550,16 @@ void sn76477_vco_voltage_w(int chip, double data)
*
*****************************************************************************/
-static void _SN76477_pitch_voltage_w(struct SN76477 *sn, double data)
+static void _SN76477_pitch_voltage_w(sn76477_state *sn, double data)
{
sn->pitch_voltage = data;
}
-void sn76477_pitch_voltage_w(int chip, double data)
+void sn76477_pitch_voltage_w(const device_config *device, double data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_VOLTAGE;
@@ -1573,10 +1583,10 @@ void sn76477_pitch_voltage_w(int chip, double data)
*
*****************************************************************************/
-void sn76477_noise_clock_w(int chip, UINT32 data)
+void sn76477_noise_clock_w(const device_config *device, UINT32 data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_BOOLEAN;
@@ -1604,7 +1614,7 @@ void sn76477_noise_clock_w(int chip, UINT32 data)
*
*****************************************************************************/
-static void _SN76477_noise_clock_res_w(struct SN76477 *sn, double data)
+static void _SN76477_noise_clock_res_w(sn76477_state *sn, double data)
{
if (data == 0)
{
@@ -1619,10 +1629,10 @@ static void _SN76477_noise_clock_res_w(struct SN76477 *sn, double data)
}
-void sn76477_noise_clock_res_w(int chip, double data)
+void sn76477_noise_clock_res_w(const device_config *device, double data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_POSITIVE;
@@ -1646,16 +1656,16 @@ void sn76477_noise_clock_res_w(int chip, double data)
*
*****************************************************************************/
-static void _SN76477_noise_filter_res_w(struct SN76477 *sn, double data)
+static void _SN76477_noise_filter_res_w(sn76477_state *sn, double data)
{
sn->noise_filter_res = data;
}
-void sn76477_noise_filter_res_w(int chip, double data)
+void sn76477_noise_filter_res_w(const device_config *device, double data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_POSITIVE;
@@ -1678,16 +1688,16 @@ void sn76477_noise_filter_res_w(int chip, double data)
*
*****************************************************************************/
-static void _SN76477_noise_filter_cap_w(struct SN76477 *sn, double data)
+static void _SN76477_noise_filter_cap_w(sn76477_state *sn, double data)
{
sn->noise_filter_cap = data;
}
-void sn76477_noise_filter_cap_w(int chip, double data)
+void sn76477_noise_filter_cap_w(const device_config *device, double data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_POSITIVE;
@@ -1710,10 +1720,10 @@ void sn76477_noise_filter_cap_w(int chip, double data)
*
*****************************************************************************/
-void sn76477_noise_filter_cap_voltage_w(int chip, double data)
+void sn76477_noise_filter_cap_voltage_w(const device_config *device, double data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_CAP_VOLTAGE;
@@ -1753,16 +1763,16 @@ void sn76477_noise_filter_cap_voltage_w(int chip, double data)
*
*****************************************************************************/
-static void _SN76477_attack_res_w(struct SN76477 *sn, double data)
+static void _SN76477_attack_res_w(sn76477_state *sn, double data)
{
sn->attack_res = data;
}
-void sn76477_attack_res_w(int chip, double data)
+void sn76477_attack_res_w(const device_config *device, double data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_POSITIVE;
@@ -1785,16 +1795,16 @@ void sn76477_attack_res_w(int chip, double data)
*
*****************************************************************************/
-static void _SN76477_decay_res_w(struct SN76477 *sn, double data)
+static void _SN76477_decay_res_w(sn76477_state *sn, double data)
{
sn->decay_res = data;
}
-void sn76477_decay_res_w(int chip, double data)
+void sn76477_decay_res_w(const device_config *device, double data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_POSITIVE;
@@ -1817,16 +1827,16 @@ void sn76477_decay_res_w(int chip, double data)
*
*****************************************************************************/
-static void _SN76477_attack_decay_cap_w(struct SN76477 *sn, double data)
+static void _SN76477_attack_decay_cap_w(sn76477_state *sn, double data)
{
sn->attack_decay_cap = data;
}
-void sn76477_attack_decay_cap_w(int chip, double data)
+void sn76477_attack_decay_cap_w(const device_config *device, double data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_POSITIVE;
@@ -1850,10 +1860,10 @@ void sn76477_attack_decay_cap_w(int chip, double data)
*
*****************************************************************************/
-void sn76477_attack_decay_cap_voltage_w(int chip, double data)
+void sn76477_attack_decay_cap_voltage_w(const device_config *device, double data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_CAP_VOLTAGE;
@@ -1895,16 +1905,16 @@ void sn76477_attack_decay_cap_voltage_w(int chip, double data)
*
*****************************************************************************/
-static void _SN76477_amplitude_res_w(struct SN76477 *sn, double data)
+static void _SN76477_amplitude_res_w(sn76477_state *sn, double data)
{
sn->amplitude_res = data;
}
-void sn76477_amplitude_res_w(int chip, double data)
+void sn76477_amplitude_res_w(const device_config *device, double data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_POSITIVE;
@@ -1927,16 +1937,16 @@ void sn76477_amplitude_res_w(int chip, double data)
*
*****************************************************************************/
-static void _SN76477_feedback_res_w(struct SN76477 *sn, double data)
+static void _SN76477_feedback_res_w(sn76477_state *sn, double data)
{
sn->feedback_res = data;
}
-void sn76477_feedback_res_w(int chip, double data)
+void sn76477_feedback_res_w(const device_config *device, double data)
{
#if TEST_MODE == 0
- struct SN76477 *sn = sndti_token(SOUND_SN76477, chip);
+ sn76477_state *sn = get_safe_token(device);
CHECK_CHIP_NUM_AND_POSITIVE;
@@ -1978,7 +1988,7 @@ static STREAM_UPDATE( SN76477_update )
double voltage_out;
double center_to_peak_voltage_out;
- struct SN76477 *sn = param;
+ sn76477_state *sn = param;
stream_sample_t *buffer = outputs[0];
@@ -2322,7 +2332,7 @@ static STREAM_UPDATE( SN76477_update )
*
*****************************************************************************/
-static void state_save_register(const device_config *device, struct SN76477 *sn)
+static void state_save_register(const device_config *device, sn76477_state *sn)
{
state_save_register_device_item(device, 0, sn->enable);
state_save_register_device_item(device, 0, sn->envelope_mode);
@@ -2386,9 +2396,9 @@ static void state_save_register(const device_config *device, struct SN76477 *sn)
*
*****************************************************************************/
-static SND_START( sn76477 )
+static DEVICE_START( sn76477 )
{
- struct SN76477 *sn = device->token;
+ sn76477_state *sn = get_safe_token(device);
sn76477_interface *intf;
@@ -2403,9 +2413,9 @@ static SND_START( sn76477 )
sn->channel = stream_create(device, 0, 1, device->machine->sample_rate, sn, SN76477_update);
- if (clock > 0)
+ if (device->clock > 0)
{
- sn->sample_rate = clock;
+ sn->sample_rate = device->clock;
}
else
{
@@ -2454,27 +2464,27 @@ static SND_START( sn76477 )
}
-static SND_STOP( sn76477 )
+static DEVICE_STOP( sn76477 )
{
- struct SN76477 *sn = device->token;
+ sn76477_state *sn = get_safe_token(device);
if (LOG_WAV)
close_wav_file(sn);
}
-SND_GET_INFO( sn76477 )
+DEVICE_GET_INFO( sn76477 )
{
switch (state)
{
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct SN76477); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( sn76477 ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( sn76477 ); break;
- case SNDINFO_STR_NAME: strcpy(info->s, "SN76477"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Analog"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "2.1"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(sn76477_state); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( sn76477 ); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( sn76477 ); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "SN76477"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Analog"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "2.1"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/sn76477.h b/src/emu/sound/sn76477.h
index 63ef9f74433..285957a00f1 100644
--- a/src/emu/sound/sn76477.h
+++ b/src/emu/sound/sn76477.h
@@ -85,46 +85,46 @@ struct _sn76477_interface
*****************************************************************************/
/* these functions take 0 or 1 as a logic input */
-void sn76477_enable_w(int chip, UINT32 data); /* active LO, 0 = enabled, 1 = disabled */
-void sn76477_mixer_a_w(int chip, UINT32 data);
-void sn76477_mixer_b_w(int chip, UINT32 data);
-void sn76477_mixer_c_w(int chip, UINT32 data);
-void sn76477_envelope_1_w(int chip, UINT32 data);
-void sn76477_envelope_2_w(int chip, UINT32 data);
-void sn76477_vco_w(int chip, UINT32 data); /* 0 = external, 1 = controlled by SLF */
-void sn76477_noise_clock_w(int chip, UINT32 data); /* noise clock write, if noise_clock_res = 0 */
+void sn76477_enable_w(const device_config *device, UINT32 data); /* active LO, 0 = enabled, 1 = disabled */
+void sn76477_mixer_a_w(const device_config *device, UINT32 data);
+void sn76477_mixer_b_w(const device_config *device, UINT32 data);
+void sn76477_mixer_c_w(const device_config *device, UINT32 data);
+void sn76477_envelope_1_w(const device_config *device, UINT32 data);
+void sn76477_envelope_2_w(const device_config *device, UINT32 data);
+void sn76477_vco_w(const device_config *device, UINT32 data); /* 0 = external, 1 = controlled by SLF */
+void sn76477_noise_clock_w(const device_config *device, UINT32 data); /* noise clock write, if noise_clock_res = 0 */
/* these functions take a resistor value in Ohms */
-void sn76477_one_shot_res_w(int chip, double data);
-void sn76477_slf_res_w(int chip, double data);
-void sn76477_vco_res_w(int chip, double data);
-void sn76477_noise_clock_res_w(int chip, double data); /* = 0 if the noise gen is clocked via noise_clock */
-void sn76477_noise_filter_res_w(int chip, double data);
-void sn76477_decay_res_w(int chip, double data);
-void sn76477_attack_res_w(int chip, double data);
-void sn76477_amplitude_res_w(int chip, double data);
-void sn76477_feedback_res_w(int chip, double data);
+void sn76477_one_shot_res_w(const device_config *device, double data);
+void sn76477_slf_res_w(const device_config *device, double data);
+void sn76477_vco_res_w(const device_config *device, double data);
+void sn76477_noise_clock_res_w(const device_config *device, double data); /* = 0 if the noise gen is clocked via noise_clock */
+void sn76477_noise_filter_res_w(const device_config *device, double data);
+void sn76477_decay_res_w(const device_config *device, double data);
+void sn76477_attack_res_w(const device_config *device, double data);
+void sn76477_amplitude_res_w(const device_config *device, double data);
+void sn76477_feedback_res_w(const device_config *device, double data);
/* these functions take a capacitor value in Farads or the voltage on it in Volts */
#define SN76477_EXTERNAL_VOLTAGE_DISCONNECT (-1.0) /* indicates that the voltage is internally computed,
can be used in all the functions that take a
voltage on a capacitor */
-void sn76477_one_shot_cap_w(int chip, double data);
-void sn76477_one_shot_cap_voltage_w(int chip, double data);
-void sn76477_slf_cap_w(int chip, double data);
-void sn76477_slf_cap_voltage_w(int chip, double data);
-void sn76477_vco_cap_w(int chip, double data);
-void sn76477_vco_cap_voltage_w(int chip, double data);
-void sn76477_noise_filter_cap_w(int chip, double data);
-void sn76477_noise_filter_cap_voltage_w(int chip, double data);
-void sn76477_attack_decay_cap_w(int chip, double data);
-void sn76477_attack_decay_cap_voltage_w(int chip, double data);
+void sn76477_one_shot_cap_w(const device_config *device, double data);
+void sn76477_one_shot_cap_voltage_w(const device_config *device, double data);
+void sn76477_slf_cap_w(const device_config *device, double data);
+void sn76477_slf_cap_voltage_w(const device_config *device, double data);
+void sn76477_vco_cap_w(const device_config *device, double data);
+void sn76477_vco_cap_voltage_w(const device_config *device, double data);
+void sn76477_noise_filter_cap_w(const device_config *device, double data);
+void sn76477_noise_filter_cap_voltage_w(const device_config *device, double data);
+void sn76477_attack_decay_cap_w(const device_config *device, double data);
+void sn76477_attack_decay_cap_voltage_w(const device_config *device, double data);
/* these functions take a voltage value in Volts */
-void sn76477_vco_voltage_w(int chip, double data);
-void sn76477_pitch_voltage_w(int chip, double data);
+void sn76477_vco_voltage_w(const device_config *device, double data);
+void sn76477_pitch_voltage_w(const device_config *device, double data);
-SND_GET_INFO( sn76477 );
-#define SOUND_SN76477 SND_GET_INFO_NAME( sn76477 )
+DEVICE_GET_INFO( sn76477 );
+#define SOUND_SN76477 DEVICE_GET_INFO_NAME( sn76477 )
#endif/* __SN76477_H__ */
diff --git a/src/emu/sound/sn76496.c b/src/emu/sound/sn76496.c
index af6ed2eecb9..6e9ec1c9ae9 100644
--- a/src/emu/sound/sn76496.c
+++ b/src/emu/sound/sn76496.c
@@ -47,7 +47,8 @@
#define STEP 0x10000
-struct SN76496
+typedef struct _sn76496_state sn76496_state;
+struct _sn76496_state
{
sound_stream * Channel;
int SampleRate;
@@ -66,10 +67,24 @@ struct SN76496
};
+INLINE sn76496_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_SN76496 ||
+ sound_get_type(device) == SOUND_SN76489 ||
+ sound_get_type(device) == SOUND_SN76489A ||
+ sound_get_type(device) == SOUND_SN76494 ||
+ sound_get_type(device) == SOUND_GAMEGEAR ||
+ sound_get_type(device) == SOUND_SMSIII);
+ return (sn76496_state *)device->token;
+}
+
-static void SN76496Write(int chip,int data)
+WRITE8_DEVICE_HANDLER( sn76496_w )
{
- struct SN76496 *R = sndti_token(SOUND_SN76496, chip);
+ sn76496_state *R = get_safe_token(device);
int n, r, c;
@@ -127,17 +142,10 @@ static void SN76496Write(int chip,int data)
-WRITE8_HANDLER( sn76496_0_w ) { SN76496Write(0,data); }
-WRITE8_HANDLER( sn76496_1_w ) { SN76496Write(1,data); }
-WRITE8_HANDLER( sn76496_2_w ) { SN76496Write(2,data); }
-WRITE8_HANDLER( sn76496_3_w ) { SN76496Write(3,data); }
-WRITE8_HANDLER( sn76496_4_w ) { SN76496Write(4,data); }
-
-
static STREAM_UPDATE( SN76496Update )
{
int i;
- struct SN76496 *R = param;
+ sn76496_state *R = param;
stream_sample_t *buffer = outputs[0];
@@ -251,7 +259,7 @@ static STREAM_UPDATE( SN76496Update )
-static void SN76496_set_gain(struct SN76496 *R,int gain)
+static void SN76496_set_gain(sn76496_state *R,int gain)
{
int i;
double out;
@@ -278,9 +286,9 @@ static void SN76496_set_gain(struct SN76496 *R,int gain)
-static int SN76496_init(const device_config *device, int clock, struct SN76496 *R)
+static int SN76496_init(const device_config *device, sn76496_state *R)
{
- int sample_rate = clock/16;
+ int sample_rate = device->clock/16;
int i;
R->Channel = stream_create(device,0,1,sample_rate,R,SN76496Update);
@@ -314,11 +322,11 @@ static int SN76496_init(const device_config *device, int clock, struct SN76496 *
}
-static void generic_start(const device_config *device, int clock, int feedbackmask, int noisetaps, int noiseinvert)
+static void generic_start(const device_config *device, int feedbackmask, int noisetaps, int noiseinvert)
{
- struct SN76496 *chip = device->token;
+ sn76496_state *chip = get_safe_token(device);
- if (SN76496_init(device,clock,chip) != 0)
+ if (SN76496_init(device,chip) != 0)
fatalerror("Error creating SN76496 chip");
SN76496_set_gain(chip, 0);
@@ -337,34 +345,34 @@ static void generic_start(const device_config *device, int clock, int feedbackma
}
-static SND_START( sn76489 )
+static DEVICE_START( sn76489 )
{
- generic_start(device, clock, 0x4000, 0x03, TRUE);
+ generic_start(device, 0x4000, 0x03, TRUE);
}
-static SND_START( sn76489a )
+static DEVICE_START( sn76489a )
{
- generic_start(device, clock, 0x8000, 0x06, FALSE);
+ generic_start(device, 0x8000, 0x06, FALSE);
}
-static SND_START( sn76494 )
+static DEVICE_START( sn76494 )
{
- generic_start(device, clock, 0x8000, 0x06, FALSE);
+ generic_start(device, 0x8000, 0x06, FALSE);
}
-static SND_START( sn76496 )
+static DEVICE_START( sn76496 )
{
- generic_start(device, clock, 0x8000, 0x06, FALSE);
+ generic_start(device, 0x8000, 0x06, FALSE);
}
-static SND_START( gamegear )
+static DEVICE_START( gamegear )
{
- generic_start(device, clock, 0x8000, 0x09, FALSE);
+ generic_start(device, 0x8000, 0x09, FALSE);
}
-static SND_START( smsiii )
+static DEVICE_START( smsiii )
{
- generic_start(device, clock, 0x8000, 0x09, FALSE);
+ generic_start(device, 0x8000, 0x09, FALSE);
}
@@ -372,84 +380,73 @@ static SND_START( smsiii )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( sn76496 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( sn76496 )
+DEVICE_GET_INFO( sn76496 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct SN76496); break;
- case SNDINFO_FCT_ALIAS: info->type = SOUND_SN76496; break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(sn76496_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( sn76496 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( sn76496 ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( sn76496 ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "SN76496"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "TI PSG"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.1"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "SN76496"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "TI PSG"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.1"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
-SND_GET_INFO( sn76489 )
+DEVICE_GET_INFO( sn76489 )
{
switch (state)
{
- case SNDINFO_PTR_START: info->start = SND_START_NAME( sn76489 ); break;
- case SNDINFO_STR_NAME: strcpy(info->s, "SN76489"); break;
- default: SND_GET_INFO_CALL(sn76496); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( sn76489 ); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "SN76489"); break;
+ default: DEVICE_GET_INFO_CALL(sn76496); break;
}
}
-SND_GET_INFO( sn76489a )
+DEVICE_GET_INFO( sn76489a )
{
switch (state)
{
- case SNDINFO_PTR_START: info->start = SND_START_NAME( sn76489a ); break;
- case SNDINFO_STR_NAME: strcpy(info->s, "SN76489A"); break;
- default: SND_GET_INFO_CALL(sn76496); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( sn76489a ); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "SN76489A"); break;
+ default: DEVICE_GET_INFO_CALL(sn76496); break;
}
}
-SND_GET_INFO( sn76494 )
+DEVICE_GET_INFO( sn76494 )
{
switch (state)
{
- case SNDINFO_PTR_START: info->start = SND_START_NAME( sn76494 ); break;
- case SNDINFO_STR_NAME: strcpy(info->s, "SN76494"); break;
- default: SND_GET_INFO_CALL(sn76496); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( sn76494 ); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "SN76494"); break;
+ default: DEVICE_GET_INFO_CALL(sn76496); break;
}
}
-SND_GET_INFO( gamegear )
+DEVICE_GET_INFO( gamegear )
{
switch (state)
{
- case SNDINFO_PTR_START: info->start = SND_START_NAME( gamegear ); break;
- case SNDINFO_STR_NAME: strcpy(info->s, "Game Gear PSG"); break;
- default: SND_GET_INFO_CALL(sn76496); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( gamegear ); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "Game Gear PSG"); break;
+ default: DEVICE_GET_INFO_CALL(sn76496); break;
}
}
-SND_GET_INFO( smsiii )
+DEVICE_GET_INFO( smsiii )
{
switch (state)
{
- case SNDINFO_PTR_START: info->start = SND_START_NAME( smsiii ); break;
- case SNDINFO_STR_NAME: strcpy(info->s, "SMSIII PSG"); break;
- default: SND_GET_INFO_CALL(sn76496); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( smsiii ); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "SMSIII PSG"); break;
+ default: DEVICE_GET_INFO_CALL(sn76496); break;
}
}
diff --git a/src/emu/sound/sn76496.h b/src/emu/sound/sn76496.h
index 0b41fd307a5..7435c6e72cb 100644
--- a/src/emu/sound/sn76496.h
+++ b/src/emu/sound/sn76496.h
@@ -3,24 +3,20 @@
#ifndef __SN76496_H__
#define __SN76496_H__
-WRITE8_HANDLER( sn76496_0_w );
-WRITE8_HANDLER( sn76496_1_w );
-WRITE8_HANDLER( sn76496_2_w );
-WRITE8_HANDLER( sn76496_3_w );
-WRITE8_HANDLER( sn76496_4_w );
+WRITE8_DEVICE_HANDLER( sn76496_w );
-SND_GET_INFO( sn76496 );
-SND_GET_INFO( sn76489 );
-SND_GET_INFO( sn76489a );
-SND_GET_INFO( sn76494 );
-SND_GET_INFO( gamegear );
-SND_GET_INFO( smsiii );
+DEVICE_GET_INFO( sn76496 );
+DEVICE_GET_INFO( sn76489 );
+DEVICE_GET_INFO( sn76489a );
+DEVICE_GET_INFO( sn76494 );
+DEVICE_GET_INFO( gamegear );
+DEVICE_GET_INFO( smsiii );
-#define SOUND_SN76496 SND_GET_INFO_NAME( sn76496 )
-#define SOUND_SN76489 SND_GET_INFO_NAME( sn76489 )
-#define SOUND_SN76489A SND_GET_INFO_NAME( sn76489a )
-#define SOUND_SN76494 SND_GET_INFO_NAME( sn76494 )
-#define SOUND_GAMEGEAR SND_GET_INFO_NAME( gamegear )
-#define SOUND_SMSIII SND_GET_INFO_NAME( smsiii )
+#define SOUND_SN76496 DEVICE_GET_INFO_NAME( sn76496 )
+#define SOUND_SN76489 DEVICE_GET_INFO_NAME( sn76489 )
+#define SOUND_SN76489A DEVICE_GET_INFO_NAME( sn76489a )
+#define SOUND_SN76494 DEVICE_GET_INFO_NAME( sn76494 )
+#define SOUND_GAMEGEAR DEVICE_GET_INFO_NAME( gamegear )
+#define SOUND_SMSIII DEVICE_GET_INFO_NAME( smsiii )
#endif /* __SN76496_H__ */
diff --git a/src/emu/sound/snkwave.c b/src/emu/sound/snkwave.c
index c38208df1e3..d7fb7d779a4 100644
--- a/src/emu/sound/snkwave.c
+++ b/src/emu/sound/snkwave.c
@@ -16,7 +16,8 @@
#define CLOCK_SHIFT 8
-struct snkwave_sound
+typedef struct _snkwave_state snkwave_state;
+struct _snkwave_state
{
/* global sound parameters */
sound_stream * stream;
@@ -32,6 +33,15 @@ struct snkwave_sound
INT16 waveform[WAVEFORM_LENGTH];
};
+INLINE snkwave_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_SNKWAVE);
+ return (snkwave_state *)device->token;
+}
+
/* update the decoded waveform data */
/* The programmable waveform consists of 8 3-bit nibbles.
@@ -41,7 +51,7 @@ struct snkwave_sound
So the sequence 01234567 will play as
89ABCDEF76543210
*/
-static void update_waveform(struct snkwave_sound *chip, unsigned int offset, UINT8 data)
+static void update_waveform(snkwave_state *chip, unsigned int offset, UINT8 data)
{
assert(offset < WAVEFORM_LENGTH/4);
@@ -55,7 +65,7 @@ static void update_waveform(struct snkwave_sound *chip, unsigned int offset, UIN
/* generate sound to the mix buffer */
static STREAM_UPDATE( snkwave_update )
{
- struct snkwave_sound *chip = param;
+ snkwave_state *chip = param;
stream_sample_t *buffer = outputs[0];
/* zap the contents of the buffer */
@@ -99,14 +109,14 @@ static STREAM_UPDATE( snkwave_update )
}
-static SND_START( snkwave )
+static DEVICE_START( snkwave )
{
- struct snkwave_sound *chip = device->token;
+ snkwave_state *chip = get_safe_token(device);
assert(device->static_config == 0);
/* adjust internal clock */
- chip->external_clock = clock;
+ chip->external_clock = device->clock;
/* adjust output clock */
chip->sample_rate = chip->external_clock >> CLOCK_SHIFT;
@@ -135,9 +145,9 @@ static SND_START( snkwave )
2-5 waveform (8 3-bit nibbles)
*/
-WRITE8_HANDLER( snkwave_w )
+WRITE8_DEVICE_HANDLER( snkwave_w )
{
- struct snkwave_sound *chip = sndti_token(SOUND_SNKWAVE, 0);
+ snkwave_state *chip = get_safe_token(device);
stream_update(chip->stream);
@@ -158,33 +168,23 @@ WRITE8_HANDLER( snkwave_w )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( snkwave )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( snkwave )
+DEVICE_GET_INFO( snkwave )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct snkwave_sound); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(snkwave_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( snkwave ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( snkwave ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( snkwave ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "SNK Wave"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "SNK Wave"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "SNK Wave"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "SNK Wave"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/snkwave.h b/src/emu/sound/snkwave.h
index f3a1c9a7b0b..043bb6580a1 100644
--- a/src/emu/sound/snkwave.h
+++ b/src/emu/sound/snkwave.h
@@ -3,9 +3,9 @@
#ifndef __SNKWAVE_H__
#define __SNKWAVE_H__
-WRITE8_HANDLER( snkwave_w );
+WRITE8_DEVICE_HANDLER( snkwave_w );
-SND_GET_INFO( snkwave );
-#define SOUND_SNKWAVE SND_GET_INFO_NAME( snkwave )
+DEVICE_GET_INFO( snkwave );
+#define SOUND_SNKWAVE DEVICE_GET_INFO_NAME( snkwave )
#endif /* __SNKWAVE_H__ */
diff --git a/src/emu/sound/sound.mak b/src/emu/sound/sound.mak
index 2cefa85ee8f..459da32c267 100644
--- a/src/emu/sound/sound.mak
+++ b/src/emu/sound/sound.mak
@@ -18,13 +18,8 @@ SOUNDOBJ = $(EMUOBJ)/sound
# Core sound types
#-------------------------------------------------
-SOUNDDEFS += -DHAS_CUSTOM=$(if $(filter CUSTOM,$(SOUNDS)),1,0)
SOUNDDEFS += -DHAS_SAMPLES=$(if $(filter SAMPLES,$(SOUNDS)),1,0)
-ifneq ($(filter CUSTOM,$(SOUNDS)),)
-SOUNDOBJS += $(SOUNDOBJ)/custom.o
-endif
-
ifneq ($(filter SAMPLES,$(SOUNDS)),)
SOUNDOBJS += $(SOUNDOBJ)/samples.o
endif
@@ -730,12 +725,16 @@ ifneq ($(filter YM2612 YM3438,$(SOUNDS)),)
SOUNDOBJS += $(SOUNDOBJ)/2612intf.o $(SOUNDOBJ)/ay8910.o $(SOUNDOBJ)/fm.o
endif
-ifneq ($(filter YM3812 YM3526,$(SOUNDS)),)
+ifneq ($(filter YM3812,$(SOUNDS)),)
SOUNDOBJS += $(SOUNDOBJ)/3812intf.o $(SOUNDOBJ)/fmopl.o
endif
+ifneq ($(filter YM3526,$(SOUNDS)),)
+SOUNDOBJS += $(SOUNDOBJ)/3526intf.o $(SOUNDOBJ)/fmopl.o
+endif
+
ifneq ($(filter Y8950,$(SOUNDS)),)
-SOUNDOBJS += $(SOUNDOBJ)/3812intf.o $(SOUNDOBJ)/fmopl.o $(SOUNDOBJ)/ymdeltat.o
+SOUNDOBJS += $(SOUNDOBJ)/8950intf.o $(SOUNDOBJ)/fmopl.o $(SOUNDOBJ)/ymdeltat.o
endif
ifneq ($(filter YMF262,$(SOUNDS)),)
diff --git a/src/emu/sound/sp0250.c b/src/emu/sound/sp0250.c
index b4d4d803403..5c096485d0f 100644
--- a/src/emu/sound/sp0250.c
+++ b/src/emu/sound/sp0250.c
@@ -36,7 +36,8 @@ should be 312, but 312 = 39*8 so it doesn't look right because a divider by 39 i
*/
#define CLOCK_DIVIDER (7*6*8)
-struct sp0250
+typedef struct _sp0250_state sp0250_state;
+struct _sp0250_state
{
INT16 amp;
UINT8 pitch;
@@ -49,7 +50,8 @@ struct sp0250
UINT8 fifo[15];
int fifo_pos;
- void (*drq)(int state);
+ const device_config *device;
+ void (*drq)(const device_config *device, int state);
struct
{
@@ -58,6 +60,15 @@ struct sp0250
} filter[6];
};
+INLINE sp0250_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_SP0250);
+ return (sp0250_state *)device->token;
+}
+
static UINT16 sp0250_ga(UINT8 v)
{
@@ -85,7 +96,7 @@ static INT16 sp0250_gc(UINT8 v)
return res;
}
-static void sp0250_load_values(struct sp0250 *sp)
+static void sp0250_load_values(sp0250_state *sp)
{
int f;
@@ -108,7 +119,7 @@ static void sp0250_load_values(struct sp0250 *sp)
sp->filter[5].F = sp0250_gc(sp->fifo[14]);
sp->fifo_pos = 0;
if (sp->drq != NULL)
- sp->drq(ASSERT_LINE);
+ sp->drq(sp->device, ASSERT_LINE);
sp->pcount = 0;
sp->rcount = 0;
@@ -121,13 +132,13 @@ static void sp0250_load_values(struct sp0250 *sp)
static TIMER_CALLBACK( sp0250_timer_tick )
{
- struct sp0250 *sp = ptr;
+ sp0250_state *sp = ptr;
stream_update(sp->stream);
}
static STREAM_UPDATE( sp0250_update )
{
- struct sp0250 *sp = param;
+ sp0250_state *sp = param;
stream_sample_t *output = outputs[0];
int i;
for (i = 0; i < samples; i++)
@@ -192,41 +203,42 @@ static STREAM_UPDATE( sp0250_update )
}
-static SND_START( sp0250 )
+static DEVICE_START( sp0250 )
{
const struct sp0250_interface *intf = device->static_config;
- struct sp0250 *sp = device->token;
+ sp0250_state *sp = get_safe_token(device);
+ sp->device = device;
sp->RNG = 1;
sp->drq = (intf != NULL) ? intf->drq_callback : NULL;
if (sp->drq != NULL)
{
- sp->drq(ASSERT_LINE);
- timer_pulse(device->machine, attotime_mul(ATTOTIME_IN_HZ(clock), CLOCK_DIVIDER), sp, 0, sp0250_timer_tick);
+ sp->drq(sp->device, ASSERT_LINE);
+ timer_pulse(device->machine, attotime_mul(ATTOTIME_IN_HZ(device->clock), CLOCK_DIVIDER), sp, 0, sp0250_timer_tick);
}
- sp->stream = stream_create(device, 0, 1, clock / CLOCK_DIVIDER, sp, sp0250_update);
+ sp->stream = stream_create(device, 0, 1, device->clock / CLOCK_DIVIDER, sp, sp0250_update);
}
-WRITE8_HANDLER( sp0250_w )
+WRITE8_DEVICE_HANDLER( sp0250_w )
{
- struct sp0250 *sp = sndti_token(SOUND_SP0250, 0);
+ sp0250_state *sp = get_safe_token(device);
stream_update(sp->stream);
if (sp->fifo_pos != 15)
{
sp->fifo[sp->fifo_pos++] = data;
if (sp->fifo_pos == 15 && sp->drq != NULL)
- sp->drq(CLEAR_LINE);
+ sp->drq(sp->device, CLEAR_LINE);
}
else
- logerror("%s: overflow SP0250 FIFO\n", cpuexec_describe_context(space->machine));
+ logerror("%s: overflow SP0250 FIFO\n", cpuexec_describe_context(device->machine));
}
-UINT8 sp0250_drq_r(void)
+UINT8 sp0250_drq_r(const device_config *device)
{
- struct sp0250 *sp = sndti_token(SOUND_SP0250, 0);
+ sp0250_state *sp = get_safe_token(device);
stream_update(sp->stream);
return (sp->fifo_pos == 15) ? CLEAR_LINE : ASSERT_LINE;
}
@@ -237,34 +249,24 @@ UINT8 sp0250_drq_r(void)
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( sp0250 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( sp0250 )
+DEVICE_GET_INFO( sp0250 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct sp0250); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(sp0250_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( sp0250 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( sp0250 ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( sp0250 ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "SP0250"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "GI speech"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.1"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "SP0250"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "GI speech"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.1"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/sp0250.h b/src/emu/sound/sp0250.h
index 30074422e16..0bfc012c424 100644
--- a/src/emu/sound/sp0250.h
+++ b/src/emu/sound/sp0250.h
@@ -4,13 +4,13 @@
#define __SP0250_H__
struct sp0250_interface {
- void (*drq_callback)(int state);
+ void (*drq_callback)(const device_config *device, int state);
};
-WRITE8_HANDLER( sp0250_w );
-UINT8 sp0250_drq_r(void);
+WRITE8_DEVICE_HANDLER( sp0250_w );
+UINT8 sp0250_drq_r(const device_config *device);
-SND_GET_INFO( sp0250 );
-#define SOUND_SP0250 SND_GET_INFO_NAME( sp0250 )
+DEVICE_GET_INFO( sp0250 );
+#define SOUND_SP0250 DEVICE_GET_INFO_NAME( sp0250 )
#endif /* __SP0250_H__ */
diff --git a/src/emu/sound/sp0256.c b/src/emu/sound/sp0256.c
index aa3e044ce36..807471ededf 100644
--- a/src/emu/sound/sp0256.c
+++ b/src/emu/sound/sp0256.c
@@ -75,7 +75,8 @@ struct lpc12_t
};
-struct sp0256
+typedef struct _sp0256_state sp0256_state;
+struct _sp0256_state
{
const device_config *device;
sound_stream *stream; /* MAME core sound stream */
@@ -133,6 +134,16 @@ static const INT16 qtbl[128] =
504, 505, 506, 507, 508, 509, 510, 511
};
+INLINE sp0256_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_SP0256);
+ return (sp0256_state *)device->token;
+}
+
+
/* ======================================================================== */
/* LIMIT -- Limiter function for digital sample output. */
/* ======================================================================== */
@@ -680,7 +691,7 @@ void sp0256_bitrevbuff(UINT8 *buffer, unsigned int start, unsigned int length)
/* ======================================================================== */
/* SP0256_GETB -- Get up to 8 bits at the current PC. */
/* ======================================================================== */
-static UINT32 sp0256_getb(struct sp0256 *sp, int len)
+static UINT32 sp0256_getb(sp0256_state *sp, int len)
{
UINT32 data = 0;
UINT32 d0, d1;
@@ -740,7 +751,7 @@ static UINT32 sp0256_getb(struct sp0256 *sp, int len)
/* instructions either until the repeat count != 0 or */
/* the sequencer gets halted by a RTS to 0. */
/* ======================================================================== */
-static void sp0256_micro(struct sp0256 *sp)
+static void sp0256_micro(sp0256_state *sp)
{
UINT8 immed4;
UINT8 opcode;
@@ -1094,7 +1105,7 @@ static void sp0256_micro(struct sp0256 *sp)
static STREAM_UPDATE( sp0256_update )
{
- struct sp0256 *sp = param;
+ sp0256_state *sp = param;
stream_sample_t *output = outputs[0];
int output_index = 0;
int length, did_samp, old_idx;
@@ -1169,10 +1180,10 @@ static STREAM_UPDATE( sp0256_update )
}
}
-static SND_START( sp0256 )
+static DEVICE_START( sp0256 )
{
const sp0256_interface *intf = device->static_config;
- struct sp0256 *sp = device->token;
+ sp0256_state *sp = get_safe_token(device);
sp->device = device;
devcb_resolve_write_line(&sp->drq, &intf->lrq_callback, device);
@@ -1180,7 +1191,7 @@ static SND_START( sp0256 )
devcb_call_write_line(&sp->drq, 1);
devcb_call_write_line(&sp->sby, 1);
- sp->stream = stream_create(device, 0, 1, clock / CLOCK_DIVIDER, sp, sp0256_update);
+ sp->stream = stream_create(device, 0, 1, device->clock / CLOCK_DIVIDER, sp, sp0256_update);
/* -------------------------------------------------------------------- */
/* Configure our internal variables. */
@@ -1209,13 +1220,13 @@ static SND_START( sp0256 )
sp0256_bitrevbuff(sp->rom, 0, 0xffff);
}
-static SND_STOP( sp0256 )
+static DEVICE_STOP( sp0256 )
{
- struct sp0256 *sp = device->token;
+ sp0256_state *sp = get_safe_token(device);
free( sp->scratch );
}
-static void sp0256_reset(struct sp0256 *sp)
+static void sp0256_reset(sp0256_state *sp)
{
/* ---------------------------------------------------------------- */
/* Reset the FIFO and SP0256. */
@@ -1238,14 +1249,14 @@ static void sp0256_reset(struct sp0256 *sp)
SET_SBY(1)
}
-static SND_RESET( sp0256 )
+static DEVICE_RESET( sp0256 )
{
- sp0256_reset(device->token);
+ sp0256_reset(get_safe_token(device));
}
-WRITE8_HANDLER( sp0256_ALD_w )
+WRITE8_DEVICE_HANDLER( sp0256_ALD_w )
{
- struct sp0256 *sp = sndti_token(SOUND_SP0256, 0);
+ sp0256_state *sp = get_safe_token(device);
/* ---------------------------------------------------------------- */
/* Drop writes to the ALD register if we're busy. */
@@ -1269,9 +1280,9 @@ WRITE8_HANDLER( sp0256_ALD_w )
return;
}
-READ16_HANDLER( spb640_r )
+READ16_DEVICE_HANDLER( spb640_r )
{
- struct sp0256 *sp = sndti_token(SOUND_SP0256, 0);
+ sp0256_state *sp = get_safe_token(device);
/* -------------------------------------------------------------------- */
/* Offset 0 returns the SP0256 LRQ status on bit 15. */
@@ -1295,13 +1306,13 @@ READ16_HANDLER( spb640_r )
return 0x00FF;
}
-WRITE16_HANDLER( spb640_w )
+WRITE16_DEVICE_HANDLER( spb640_w )
{
- struct sp0256 *sp = sndti_token(SOUND_SP0256, 0);
+ sp0256_state *sp = get_safe_token(device);
if( offset == 0 )
{
- sp0256_ALD_w( space, 0, data & 0xff );
+ sp0256_ALD_w( device, 0, data & 0xff );
return;
}
@@ -1344,34 +1355,24 @@ WRITE16_HANDLER( spb640_w )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( sp0256 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( sp0256 )
+DEVICE_GET_INFO( sp0256 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct sp0256); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(sp0256_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( sp0256 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( sp0256 ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( sp0256 ); break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( sp0256 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( sp0256 ); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( sp0256 ); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( sp0256 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "SP0256"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "GI"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Joseph Zbiciak, tim lindner"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "SP0256"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "GI"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Joseph Zbiciak, tim lindner"); break;
}
}
diff --git a/src/emu/sound/sp0256.h b/src/emu/sound/sp0256.h
index be0dc901720..f9968accb72 100644
--- a/src/emu/sound/sp0256.h
+++ b/src/emu/sound/sp0256.h
@@ -34,12 +34,12 @@ struct _sp0256_interface
void sp0256_bitrevbuff(UINT8 *buffer, unsigned int start, unsigned int length);
-WRITE8_HANDLER( sp0256_ALD_w );
+WRITE8_DEVICE_HANDLER( sp0256_ALD_w );
-READ16_HANDLER( spb640_r );
-WRITE16_HANDLER( spb640_w );
+READ16_DEVICE_HANDLER( spb640_r );
+WRITE16_DEVICE_HANDLER( spb640_w );
-SND_GET_INFO( sp0256 );
-#define SOUND_SP0256 SND_GET_INFO_NAME( sp0256 )
+DEVICE_GET_INFO( sp0256 );
+#define SOUND_SP0256 DEVICE_GET_INFO_NAME( sp0256 )
#endif /* __SP0256_H__ */
diff --git a/src/emu/sound/speaker.c b/src/emu/sound/speaker.c
index 8c7074ce74b..510d9d455e1 100644
--- a/src/emu/sound/speaker.c
+++ b/src/emu/sound/speaker.c
@@ -13,7 +13,8 @@
static const INT16 default_levels[2] = {0,32767};
-struct speaker
+typedef struct _speaker_state speaker_state;
+struct _speaker_state
{
sound_stream *channel;
const INT16 *levels;
@@ -22,10 +23,19 @@ struct speaker
};
+INLINE speaker_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_SPEAKER);
+ return (speaker_state *)device->token;
+}
+
static STREAM_UPDATE( speaker_sound_update )
{
- struct speaker *sp = (struct speaker *) param;
+ speaker_state *sp = (speaker_state *) param;
stream_sample_t *buffer = outputs[0];
int volume = sp->levels[sp->level];
@@ -35,9 +45,9 @@ static STREAM_UPDATE( speaker_sound_update )
-static SND_START( speaker )
+static DEVICE_START( speaker )
{
- struct speaker *sp = device->token;
+ speaker_state *sp = get_safe_token(device);
sp->channel = stream_create(device, 0, 1, device->machine->sample_rate, sp, speaker_sound_update);
sp->num_levels = 2;
@@ -47,9 +57,9 @@ static SND_START( speaker )
-void speaker_level_w(int which, int new_level)
+void speaker_level_w(const device_config *device, int new_level)
{
- struct speaker *sp = sndti_token(SOUND_SPEAKER, which);
+ speaker_state *sp = get_safe_token(device);
if( new_level < 0 )
new_level = 0;
@@ -72,33 +82,23 @@ void speaker_level_w(int which, int new_level)
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( speaker )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( speaker )
+DEVICE_GET_INFO( speaker )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct speaker); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(speaker_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( speaker ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( speaker ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: /* nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( speaker ); break;
+ case DEVINFO_FCT_STOP: /* nothing */ break;
+ case DEVINFO_FCT_RESET: /* nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "Speaker"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Speaker"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright The MESS Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "Speaker"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Speaker"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright The MESS Team"); break;
}
}
diff --git a/src/emu/sound/speaker.h b/src/emu/sound/speaker.h
index 66a2e659c80..8598f28c903 100644
--- a/src/emu/sound/speaker.h
+++ b/src/emu/sound/speaker.h
@@ -23,10 +23,10 @@ struct _speaker_interface
const INT16 *levels; /* optional: pointer to level lookup table */
};
-void speaker_level_w (int which, int new_level);
+void speaker_level_w (const device_config *device, int new_level);
-SND_GET_INFO( speaker );
-#define SOUND_SPEAKER SND_GET_INFO_NAME( speaker )
+DEVICE_GET_INFO( speaker );
+#define SOUND_SPEAKER DEVICE_GET_INFO_NAME( speaker )
#ifdef __cplusplus
}
diff --git a/src/emu/sound/st0016.c b/src/emu/sound/st0016.c
index ac0cf140cd6..5936f7e3d2d 100644
--- a/src/emu/sound/st0016.c
+++ b/src/emu/sound/st0016.c
@@ -12,24 +12,40 @@
#define VERBOSE (0)
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
-UINT8 *st0016_sound_regs;
-
-struct st0016_info
+typedef struct _st0016_state st0016_state;
+struct _st0016_state
{
sound_stream * stream;
UINT8 **sound_ram;
int vpos[8], frac[8], lponce[8];
+ UINT8 regs[0x100];
};
-WRITE8_HANDLER(st0016_snd_w)
+INLINE st0016_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_ST0016);
+ return (st0016_state *)device->token;
+}
+
+
+READ8_DEVICE_HANDLER( st0016_snd_r )
+{
+ st0016_state *info = get_safe_token(device);
+ return info->regs[offset];
+}
+
+WRITE8_DEVICE_HANDLER( st0016_snd_w )
{
- struct st0016_info *info = sndti_token(SOUND_ST0016, 0);
+ st0016_state *info = get_safe_token(device);
int voice = offset/32;
int reg = offset & 0x1f;
- int oldreg = st0016_sound_regs[offset];
+ int oldreg = info->regs[offset];
int vbase = offset & ~0x1f;
- st0016_sound_regs[offset] = data;
+ info->regs[offset] = data;
if ((voice < 8) && (data != oldreg))
{
@@ -38,19 +54,19 @@ WRITE8_HANDLER(st0016_snd_w)
info->vpos[voice] = info->frac[voice] = info->lponce[voice] = 0;
LOG(("Key on V%02d: st %06x-%06x lp %06x-%06x frq %x flg %x\n", voice,
- st0016_sound_regs[vbase+2]<<16 | st0016_sound_regs[vbase+1]<<8 | st0016_sound_regs[vbase+2],
- st0016_sound_regs[vbase+0xe]<<16 | st0016_sound_regs[vbase+0xd]<<8 | st0016_sound_regs[vbase+0xc],
- st0016_sound_regs[vbase+6]<<16 | st0016_sound_regs[vbase+5]<<8 | st0016_sound_regs[vbase+4],
- st0016_sound_regs[vbase+0xa]<<16 | st0016_sound_regs[vbase+0x9]<<8 | st0016_sound_regs[vbase+0x8],
- st0016_sound_regs[vbase+0x11]<<8 | st0016_sound_regs[vbase+0x10],
- st0016_sound_regs[vbase+0x16]));
+ info->regs[vbase+2]<<16 | info->regs[vbase+1]<<8 | info->regs[vbase+2],
+ info->regs[vbase+0xe]<<16 | info->regs[vbase+0xd]<<8 | info->regs[vbase+0xc],
+ info->regs[vbase+6]<<16 | info->regs[vbase+5]<<8 | info->regs[vbase+4],
+ info->regs[vbase+0xa]<<16 | info->regs[vbase+0x9]<<8 | info->regs[vbase+0x8],
+ info->regs[vbase+0x11]<<8 | info->regs[vbase+0x10],
+ info->regs[vbase+0x16]));
}
}
}
static STREAM_UPDATE( st0016_update )
{
- struct st0016_info *info = param;
+ st0016_state *info = param;
UINT8 *sound_ram = *info->sound_ram;
int v, i, snum;
unsigned char *slot;
@@ -63,7 +79,7 @@ static STREAM_UPDATE( st0016_update )
for (v = 0; v < 8; v++)
{
- slot = (unsigned char *)&st0016_sound_regs[v * 32];
+ slot = (unsigned char *)&info->regs[v * 32];
if (slot[0x16] & 0x06)
{
@@ -124,10 +140,10 @@ static STREAM_UPDATE( st0016_update )
}
}
-static SND_START( st0016 )
+static DEVICE_START( st0016 )
{
const st0016_interface *intf = device->static_config;
- struct st0016_info *info = device->token;
+ st0016_state *info = get_safe_token(device);
info->sound_ram = intf->p_soundram;
@@ -140,34 +156,24 @@ static SND_START( st0016 )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( st0016 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( st0016 )
+DEVICE_GET_INFO( st0016 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct st0016_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(st0016_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( st0016 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( st0016 ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( st0016 ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "ST0016"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Seta custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "ST0016"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Seta custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/st0016.h b/src/emu/sound/st0016.h
index 8c1b01d3a5f..39d6f734be7 100644
--- a/src/emu/sound/st0016.h
+++ b/src/emu/sound/st0016.h
@@ -9,11 +9,10 @@ struct _st0016_interface
UINT8 **p_soundram;
};
-extern UINT8 *st0016_sound_regs;
+READ8_DEVICE_HANDLER( st0016_snd_r );
+WRITE8_DEVICE_HANDLER( st0016_snd_w );
-WRITE8_HANDLER(st0016_snd_w);
-
-SND_GET_INFO( st0016 );
-#define SOUND_ST0016 SND_GET_INFO_NAME( st0016 )
+DEVICE_GET_INFO( st0016 );
+#define SOUND_ST0016 DEVICE_GET_INFO_NAME( st0016 )
#endif /* __ST0016_H__ */
diff --git a/src/emu/sound/tiaintf.c b/src/emu/sound/tiaintf.c
index 85b0140e9ca..327db696a70 100644
--- a/src/emu/sound/tiaintf.c
+++ b/src/emu/sound/tiaintf.c
@@ -3,39 +3,49 @@
#include "tiaintf.h"
#include "tiasound.h"
-struct tia_info
+typedef struct _tia_state tia_state;
+struct _tia_state
{
sound_stream * channel;
void *chip;
};
+INLINE tia_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_TIA);
+ return (tia_state *)device->token;
+}
+
static STREAM_UPDATE( tia_update )
{
- struct tia_info *info = param;
+ tia_state *info = param;
tia_process(info->chip, outputs[0], samples);
}
-static SND_START( tia )
+static DEVICE_START( tia )
{
- struct tia_info *info = device->token;
+ tia_state *info = get_safe_token(device);
- info->channel = stream_create(device, 0, 1, clock, info, tia_update);
+ info->channel = stream_create(device, 0, 1, device->clock, info, tia_update);
- info->chip = tia_sound_init(clock, clock, 16);
+ info->chip = tia_sound_init(device->clock, device->clock, 16);
assert_always(info->chip != NULL, "Error creating TIA chip");
}
-static SND_STOP( tia )
+static DEVICE_STOP( tia )
{
- struct tia_info *info = device->token;
+ tia_state *info = get_safe_token(device);
tia_sound_free(info->chip);
}
-WRITE8_HANDLER( tia_sound_w )
+WRITE8_DEVICE_HANDLER( tia_sound_w )
{
- struct tia_info *info = sndti_token(SOUND_TIA, 0);
+ tia_state *info = get_safe_token(device);
stream_update(info->channel);
tia_write(info->chip, offset, data);
}
@@ -47,34 +57,24 @@ WRITE8_HANDLER( tia_sound_w )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( tia )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( tia )
+DEVICE_GET_INFO( tia )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct tia_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(tia_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( tia ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( tia ); break;
- case SNDINFO_PTR_STOP: info->stop = SND_STOP_NAME( tia ); break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( tia ); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME( tia ); break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "TIA"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Atari custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "TIA"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Atari custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/tiaintf.h b/src/emu/sound/tiaintf.h
index 118da9f7557..571c7420cab 100644
--- a/src/emu/sound/tiaintf.h
+++ b/src/emu/sound/tiaintf.h
@@ -3,9 +3,9 @@
#ifndef __TIAINTF_H__
#define __TIAINTF_H__
-WRITE8_HANDLER( tia_sound_w );
+WRITE8_DEVICE_HANDLER( tia_sound_w );
-SND_GET_INFO( tia );
-#define SOUND_TIA SND_GET_INFO_NAME( tia )
+DEVICE_GET_INFO( tia );
+#define SOUND_TIA DEVICE_GET_INFO_NAME( tia )
#endif /* __TIAINTF_H__ */
diff --git a/src/emu/sound/tms3615.c b/src/emu/sound/tms3615.c
index 0eb4eb89d2f..c16d07a6dd2 100644
--- a/src/emu/sound/tms3615.c
+++ b/src/emu/sound/tms3615.c
@@ -9,7 +9,8 @@
static const int divisor[TONES] = { 478, 451, 426, 402, 379, 358, 338, 319, 301, 284, 268, 253, 239 };
-struct TMS3615 {
+typedef struct _tms_state tms_state;
+struct _tms_state {
sound_stream *channel; /* returned by stream_create() */
int samplerate; /* output sample rate */
int basefreq; /* chip's base frequency */
@@ -20,9 +21,19 @@ struct TMS3615 {
int enable; /* mask which tones to play */
};
+INLINE tms_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_TMS3615);
+ return (tms_state *)device->token;
+}
+
+
static STREAM_UPDATE( tms3615_sound_update )
{
- struct TMS3615 *tms = param;
+ tms_state *tms = param;
int samplerate = tms->samplerate;
stream_sample_t *buffer8 = outputs[TMS3615_FOOTAGE_8];
stream_sample_t *buffer16 = outputs[TMS3615_FOOTAGE_16];
@@ -71,51 +82,42 @@ static STREAM_UPDATE( tms3615_sound_update )
tms->enable = 0;
}
-void tms3615_enable_w(int chip, int enable)
+void tms3615_enable_w(const device_config *device, int enable)
{
- struct TMS3615 *tms = sndti_token(SOUND_TMS3615, chip);
+ tms_state *tms = get_safe_token(device);
tms->enable = enable;
}
-static SND_START( tms3615 )
+static DEVICE_START( tms3615 )
{
- struct TMS3615 *tms = device->token;
+ tms_state *tms = get_safe_token(device);
- tms->channel = stream_create(device, 0, 2, clock/8, tms, tms3615_sound_update);
- tms->samplerate = clock/8;
- tms->basefreq = clock;
+ tms->channel = stream_create(device, 0, 2, device->clock/8, tms, tms3615_sound_update);
+ tms->samplerate = device->clock/8;
+ tms->basefreq = device->clock;
}
/**************************************************************************
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( tms3615 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-SND_GET_INFO( tms3615 )
+DEVICE_GET_INFO( tms3615 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct TMS3615); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(tms_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( tms3615 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( tms3615 ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( tms3615 ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "TMS3615"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "TI PSG"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "TMS3615"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "TI PSG"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/tms3615.h b/src/emu/sound/tms3615.h
index abc9c65728a..b1d14d14eb9 100644
--- a/src/emu/sound/tms3615.h
+++ b/src/emu/sound/tms3615.h
@@ -3,12 +3,12 @@
#ifndef __TMS3615_H__
#define __TMS3615_H__
-extern void tms3615_enable_w(int chip, int enable);
+extern void tms3615_enable_w(const device_config *device, int enable);
#define TMS3615_FOOTAGE_8 0
#define TMS3615_FOOTAGE_16 1
-SND_GET_INFO( tms3615 );
-#define SOUND_TMS3615 SND_GET_INFO_NAME( tms3615 )
+DEVICE_GET_INFO( tms3615 );
+#define SOUND_TMS3615 DEVICE_GET_INFO_NAME( tms3615 )
#endif /* __TMS3615_H__ */
diff --git a/src/emu/sound/tms36xx.c b/src/emu/sound/tms36xx.c
index f1a88d70e43..b7c601b573f 100644
--- a/src/emu/sound/tms36xx.c
+++ b/src/emu/sound/tms36xx.c
@@ -12,7 +12,8 @@
/* the frequencies are later adjusted by "* clock / FSCALE" */
#define FSCALE 1024
-struct TMS36XX {
+typedef struct _tms_state tms_state;
+struct _tms_state {
char *subtype; /* subtype name MM6221AA, TMS3615 or TMS3617 */
sound_stream * channel; /* returned by stream_create() */
@@ -340,10 +341,19 @@ static const int *const tunes[] = {NULL,tune1,tune2,tune3,tune4};
}
+INLINE tms_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_TMS36XX);
+ return (tms_state *)device->token;
+}
+
static STREAM_UPDATE( tms36xx_sound_update )
{
- struct TMS36XX *tms = param;
+ tms_state *tms = param;
int samplerate = tms->samplerate;
stream_sample_t *buffer = outputs[0];
@@ -393,7 +403,7 @@ static STREAM_UPDATE( tms36xx_sound_update )
}
}
-static void tms36xx_reset_counters(struct TMS36XX *tms)
+static void tms36xx_reset_counters(tms_state *tms)
{
tms->tune_counter = 0;
tms->note_counter = 0;
@@ -401,9 +411,9 @@ static void tms36xx_reset_counters(struct TMS36XX *tms)
memset(tms->counter, 0, sizeof(tms->counter));
}
-void mm6221aa_tune_w(int chip, int tune)
+void mm6221aa_tune_w(const device_config *device, int tune)
{
- struct TMS36XX *tms = sndti_token(SOUND_TMS36XX, chip);
+ tms_state *tms = get_safe_token(device);
/* which tune? */
tune &= 3;
@@ -420,9 +430,9 @@ void mm6221aa_tune_w(int chip, int tune)
tms->tune_max = 96; /* fixed for now */
}
-void tms36xx_note_w(int chip, int octave, int note)
+void tms36xx_note_w(const device_config *device, int octave, int note)
{
- struct TMS36XX *tms = sndti_token(SOUND_TMS36XX, chip);
+ tms_state *tms = get_safe_token(device);
octave &= 3;
note &= 15;
@@ -443,7 +453,7 @@ void tms36xx_note_w(int chip, int octave, int note)
tms->tune_max = note + 1;
}
-static void tms3617_enable(struct TMS36XX *tms, int enable)
+static void tms3617_enable(tms_state *tms, int enable)
{
int i, bits = 0;
@@ -479,23 +489,23 @@ static void tms3617_enable(struct TMS36XX *tms, int enable)
LOG(("%s\n", bits ? "" : " none"));
}
-void tms3617_enable_w(int chip, int enable)
+void tms3617_enable_w(const device_config *device, int enable)
{
- struct TMS36XX *tms = sndti_token(SOUND_TMS36XX, chip);
+ tms_state *tms = get_safe_token(device);
tms3617_enable(tms, enable);
}
-static SND_START( tms36xx )
+static DEVICE_START( tms36xx )
{
int j;
- struct TMS36XX *tms = device->token;
+ tms_state *tms = get_safe_token(device);
int enable;
tms->intf = device->static_config;
- tms->channel = stream_create(device, 0, 1, clock * 64, tms, tms36xx_sound_update);
- tms->samplerate = clock * 64;
- tms->basefreq = clock;
+ tms->channel = stream_create(device, 0, 1, device->clock * 64, tms, tms36xx_sound_update);
+ tms->samplerate = device->clock * 64;
+ tms->basefreq = device->clock;
enable = 0;
for (j = 0; j < 6; j++)
{
@@ -523,34 +533,24 @@ static SND_START( tms36xx )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( tms36xx )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( tms36xx )
+DEVICE_GET_INFO( tms36xx )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct TMS36XX); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(tms_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( tms36xx ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( tms36xx ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( tms36xx ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "TMS36XX"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "TI PSG"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "TMS36XX"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "TI PSG"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/tms36xx.h b/src/emu/sound/tms36xx.h
index 17df0dcf72c..27d5d255739 100644
--- a/src/emu/sound/tms36xx.h
+++ b/src/emu/sound/tms36xx.h
@@ -18,15 +18,15 @@ struct _tms36xx_interface
};
/* MM6221AA interface functions */
-extern void mm6221aa_tune_w(int chip, int tune);
+extern void mm6221aa_tune_w(const device_config *device, int tune);
/* TMS3615/17 interface functions */
-extern void tms36xx_note_w(int chip, int octave, int note);
+extern void tms36xx_note_w(const device_config *device, int octave, int note);
/* TMS3617 interface functions */
-extern void tms3617_enable_w(int chip, int enable);
+extern void tms3617_enable_w(const device_config *device, int enable);
-SND_GET_INFO( tms36xx );
-#define SOUND_TMS36XX SND_GET_INFO_NAME( tms36xx )
+DEVICE_GET_INFO( tms36xx );
+#define SOUND_TMS36XX DEVICE_GET_INFO_NAME( tms36xx )
#endif /* __TMS36XX_H__ */
diff --git a/src/emu/sound/tms5110.c b/src/emu/sound/tms5110.c
index fc7315c41a7..a13582a649f 100644
--- a/src/emu/sound/tms5110.c
+++ b/src/emu/sound/tms5110.c
@@ -112,7 +112,7 @@ struct tms5110
/* external callback */
int (*M0_callback)(const device_config *);
- void (*set_load_address)(int);
+ void (*set_load_address)(const device_config *, int);
const device_config *device;
/* these contain data describing the current and previous voice frames */
@@ -294,7 +294,7 @@ void tms5110_set_M0_callback(void *chip, int (*func)(const device_config *))
******************************************************************************************/
-void tms5110_set_load_address(void *chip, void (*func)(int))
+void tms5110_set_load_address(void *chip, void (*func)(const device_config *, int))
{
struct tms5110 *tms = chip;
tms->set_load_address = func;
@@ -764,7 +764,7 @@ void tms5110_PDC_set(void *chip, int data)
tms->addr_bit = (tms->addr_bit + 4) % 12;
tms->schedule_dummy_read = TRUE;
if (tms->set_load_address)
- tms->set_load_address(tms->address);
+ tms->set_load_address(tms->device, tms->address);
}
else
{
diff --git a/src/emu/sound/tms5110.h b/src/emu/sound/tms5110.h
index c6a739f2945..c3a2f901997 100644
--- a/src/emu/sound/tms5110.h
+++ b/src/emu/sound/tms5110.h
@@ -34,7 +34,7 @@ void tms5110_set_variant(void *chip, int variant);
void tms5110_reset_chip(void *chip);
void tms5110_set_M0_callback(void *chip, int (*func)(const device_config *));
-void tms5110_set_load_address(void *chip, void (*func)(int));
+void tms5110_set_load_address(void *chip, void (*func)(const device_config *, int));
void tms5110_CTL_set(void *chip, int data);
void tms5110_PDC_set(void *chip, int data);
diff --git a/src/emu/sound/tms5220.c b/src/emu/sound/tms5220.c
index 20274fb3802..f2286ffec43 100644
--- a/src/emu/sound/tms5220.c
+++ b/src/emu/sound/tms5220.c
@@ -91,7 +91,7 @@ struct tms5220
UINT8 buffer_empty; /* FIFO is empty*/
UINT8 irq_pin; /* state of the IRQ pin (output) */
- void (*irq_func)(running_machine *machine, int state); /* called when the state of the IRQ pin changes */
+ void (*irq_func)(const device_config *device, int state); /* called when the state of the IRQ pin changes */
/* these contain data describing the current and previous voice frames */
@@ -126,9 +126,9 @@ struct tms5220
INT8 excitation_data;
/* R Nabet : These have been added to emulate speech Roms */
- int (*read_callback)(int count);
- void (*load_address_callback)(int data);
- void (*read_and_branch_callback)(void);
+ int (*read_callback)(const device_config *device, int count);
+ void (*load_address_callback)(const device_config *device, int data);
+ void (*read_and_branch_callback)(const device_config *device);
UINT8 schedule_dummy_read; /* set after each load address, so that next read operation
is preceded by a dummy read */
@@ -257,7 +257,7 @@ void tms5220_reset_chip(void *chip)
/* initialize the chip state */
/* Note that we do not actually clear IRQ on start-up : IRQ is even raised if tms->buffer_empty or tms->buffer_low are 0 */
tms->tms5220_speaking = tms->speak_external = tms->talk_status = tms->first_frame = tms->last_frame = tms->irq_pin = 0;
- if (tms->irq_func) tms->irq_func(tms->device->machine, 0);
+ if (tms->irq_func) tms->irq_func(tms->device, 0);
tms->buffer_empty = tms->buffer_low = 1;
tms->RDB_flag = FALSE;
@@ -277,7 +277,7 @@ void tms5220_reset_chip(void *chip)
memset(tms->x, 0, sizeof(tms->x));
if (tms->load_address_callback)
- (*tms->load_address_callback)(0);
+ (*tms->load_address_callback)(tms->device, 0);
tms->schedule_dummy_read = TRUE;
}
@@ -290,7 +290,7 @@ void tms5220_reset_chip(void *chip)
***********************************************************************************************/
-void tms5220_set_irq(void *chip, void (*func)(running_machine *, int))
+void tms5220_set_irq(void *chip, void (*func)(const device_config *, int))
{
struct tms5220 *tms = chip;
tms->irq_func = func;
@@ -303,7 +303,7 @@ void tms5220_set_irq(void *chip, void (*func)(running_machine *, int))
***********************************************************************************************/
-void tms5220_set_read(void *chip, int (*func)(int))
+void tms5220_set_read(void *chip, int (*func)(const device_config *, int))
{
struct tms5220 *tms = chip;
tms->read_callback = func;
@@ -316,7 +316,7 @@ void tms5220_set_read(void *chip, int (*func)(int))
***********************************************************************************************/
-void tms5220_set_load_address(void *chip, void (*func)(int))
+void tms5220_set_load_address(void *chip, void (*func)(const device_config *, int))
{
struct tms5220 *tms = chip;
tms->load_address_callback = func;
@@ -329,7 +329,7 @@ void tms5220_set_load_address(void *chip, void (*func)(int))
***********************************************************************************************/
-void tms5220_set_read_and_branch(void *chip, void (*func)(void))
+void tms5220_set_read_and_branch(void *chip, void (*func)(const device_config *))
{
struct tms5220 *tms = chip;
tms->read_and_branch_callback = func;
@@ -447,7 +447,7 @@ int tms5220_ready_read(void *chip)
/**********************************************************************************************
- tms5220_ready_read -- returns the number of cycles until ready is asserted
+ tms5220_cycles_to_ready -- returns the number of cycles until ready is asserted
***********************************************************************************************/
@@ -866,10 +866,10 @@ static void process_command(struct tms5220 *tms)
{
tms->schedule_dummy_read = FALSE;
if (tms->read_callback)
- (*tms->read_callback)(1);
+ (*tms->read_callback)(tms->device, 1);
}
if (tms->read_callback)
- tms->data_register = (*tms->read_callback)(8); /* read one byte from speech ROM... */
+ tms->data_register = (*tms->read_callback)(tms->device, 8); /* read one byte from speech ROM... */
tms->RDB_flag = TRUE;
break;
@@ -877,14 +877,14 @@ static void process_command(struct tms5220 *tms)
if (DEBUG_5220) logerror("read and branch command received\n");
tms->RDB_flag = FALSE;
if (tms->read_and_branch_callback)
- (*tms->read_and_branch_callback)();
+ (*tms->read_and_branch_callback)(tms->device);
break;
case 0x40 : /* load address */
/* tms5220 data sheet says that if we load only one 4-bit nibble, it won't work.
This code does not care about this. */
if (tms->load_address_callback)
- (*tms->load_address_callback)(cmd & 0x0f);
+ (*tms->load_address_callback)(tms->device, cmd & 0x0f);
tms->schedule_dummy_read = TRUE;
break;
@@ -893,7 +893,7 @@ static void process_command(struct tms5220 *tms)
{
tms->schedule_dummy_read = FALSE;
if (tms->read_callback)
- (*tms->read_callback)(1);
+ (*tms->read_callback)(tms->device, 1);
}
tms->tms5220_speaking = 1;
tms->speak_external = 0;
@@ -923,7 +923,7 @@ static void process_command(struct tms5220 *tms)
{
tms->schedule_dummy_read = FALSE;
if (tms->read_callback)
- (*tms->read_callback)(1);
+ (*tms->read_callback)(tms->device, 1);
}
tms5220_reset_chip(tms);
break;
@@ -965,7 +965,7 @@ static int extract_bits(struct tms5220 *tms, int count)
{
/* extract from speech ROM */
if (tms->read_callback)
- val = (* tms->read_callback)(count);
+ val = (* tms->read_callback)(tms->device, count);
}
return val;
@@ -1194,6 +1194,6 @@ static void check_buffer_low(struct tms5220 *tms)
static void set_interrupt_state(struct tms5220 *tms, int state)
{
if (tms->irq_func && state != tms->irq_pin)
- tms->irq_func(tms->device->machine, state);
+ tms->irq_func(tms->device, state);
tms->irq_pin = state;
}
diff --git a/src/emu/sound/tms5220.h b/src/emu/sound/tms5220.h
index 922e4681a45..63451c8a5bb 100644
--- a/src/emu/sound/tms5220.h
+++ b/src/emu/sound/tms5220.h
@@ -7,7 +7,7 @@ void *tms5220_create(const device_config *device);
void tms5220_destroy(void *chip);
void tms5220_reset_chip(void *chip);
-void tms5220_set_irq(void *chip, void (*func)(running_machine *, int));
+void tms5220_set_irq(void *chip, void (*func)(const device_config *, int));
void tms5220_data_write(void *chip, int data);
int tms5220_status_read(void *chip);
@@ -18,9 +18,9 @@ int tms5220_int_read(void *chip);
void tms5220_process(void *chip, INT16 *buffer, unsigned int size);
/* three variables added by R Nabet */
-void tms5220_set_read(void *chip, int (*func)(int));
-void tms5220_set_load_address(void *chip, void (*func)(int));
-void tms5220_set_read_and_branch(void *chip, void (*func)(void));
+void tms5220_set_read(void *chip, int (*func)(const device_config *, int));
+void tms5220_set_load_address(void *chip, void (*func)(const device_config *, int));
+void tms5220_set_read_and_branch(void *chip, void (*func)(const device_config *));
enum _tms5220_variant
diff --git a/src/emu/sound/upd7759.c b/src/emu/sound/upd7759.c
index 9e6aa341514..cd96389f198 100644
--- a/src/emu/sound/upd7759.c
+++ b/src/emu/sound/upd7759.c
@@ -146,7 +146,8 @@ enum
*************************************************************/
-struct upd7759_chip
+typedef struct _upd7759_state upd7759_state;
+struct _upd7759_state
{
const device_config *device;
sound_stream *channel; /* stream channel for playback */
@@ -218,21 +219,31 @@ static const int upd7759_step[16][16] =
{ 6, 20, 36, 54, 76, 104, 144, 214, -6, -20, -36, -54, -76, -104, -144, -214 },
};
-static const int upd7759_state[16] = { -1, -1, 0, 0, 1, 2, 2, 3, -1, -1, 0, 0, 1, 2, 2, 3 };
+static const int upd7759_state_table[16] = { -1, -1, 0, 0, 1, 2, 2, 3, -1, -1, 0, 0, 1, 2, 2, 3 };
+INLINE upd7759_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_UPD7759);
+ return (upd7759_state *)device->token;
+}
+
+
/************************************************************
ADPCM sample updater
*************************************************************/
-INLINE void update_adpcm(struct upd7759_chip *chip, int data)
+INLINE void update_adpcm(upd7759_state *chip, int data)
{
/* update the sample and the state */
chip->sample += upd7759_step[chip->adpcm_state][data];
- chip->adpcm_state += upd7759_state[data];
+ chip->adpcm_state += upd7759_state_table[data];
/* clamp the state to 0..15 */
if (chip->adpcm_state < 0)
@@ -249,7 +260,7 @@ INLINE void update_adpcm(struct upd7759_chip *chip, int data)
*************************************************************/
-static void advance_state(struct upd7759_chip *chip)
+static void advance_state(upd7759_state *chip)
{
switch (chip->state)
{
@@ -462,7 +473,7 @@ static void advance_state(struct upd7759_chip *chip)
static STREAM_UPDATE( upd7759_update )
{
- struct upd7759_chip *chip = param;
+ upd7759_state *chip = param;
INT32 clocks_left = chip->clocks_left;
INT16 sample = chip->sample;
UINT32 step = chip->step;
@@ -525,7 +536,7 @@ static STREAM_UPDATE( upd7759_update )
static TIMER_CALLBACK( upd7759_slave_update )
{
- struct upd7759_chip *chip = ptr;
+ upd7759_state *chip = ptr;
UINT8 olddrq = chip->drq;
/* update the stream */
@@ -552,7 +563,7 @@ static TIMER_CALLBACK( upd7759_slave_update )
*************************************************************/
-static void upd7759_reset(struct upd7759_chip *chip)
+static void upd7759_reset(upd7759_state *chip)
{
chip->pos = 0;
chip->fifo_in = 0;
@@ -580,7 +591,7 @@ static void upd7759_reset(struct upd7759_chip *chip)
}
-static SND_RESET( upd7759 )
+static DEVICE_RESET( upd7759 )
{
upd7759_reset(device->token);
}
@@ -588,12 +599,12 @@ static SND_RESET( upd7759 )
static STATE_POSTLOAD( upd7759_postload )
{
- struct upd7759_chip *chip = (struct upd7759_chip *)param;
+ upd7759_state *chip = (upd7759_state *)param;
chip->rom = chip->rombase + chip->romoffset;
}
-static void register_for_save(struct upd7759_chip *chip, const device_config *device)
+static void register_for_save(upd7759_state *chip, const device_config *device)
{
state_save_register_device_item(device, 0, chip->pos);
state_save_register_device_item(device, 0, chip->step);
@@ -626,22 +637,22 @@ static void register_for_save(struct upd7759_chip *chip, const device_config *de
}
-static SND_START( upd7759 )
+static DEVICE_START( upd7759 )
{
static const upd7759_interface defintrf = { 0 };
const upd7759_interface *intf = (device->static_config != NULL) ? device->static_config : &defintrf;
- struct upd7759_chip *chip = device->token;
+ upd7759_state *chip = device->token;
chip->device = device;
/* allocate a stream channel */
- chip->channel = stream_create(device, 0, 1, clock/4, chip, upd7759_update);
+ chip->channel = stream_create(device, 0, 1, device->clock/4, chip, upd7759_update);
/* compute the stepping rate based on the chip's clock speed */
chip->step = 4 * FRAC_ONE;
/* compute the clock period */
- chip->clock_period = ATTOTIME_IN_HZ(clock);
+ chip->clock_period = ATTOTIME_IN_HZ(device->clock);
/* set the intial state */
chip->state = STATE_IDLE;
@@ -672,10 +683,10 @@ static SND_START( upd7759 )
*************************************************************/
-void upd7759_reset_w(int which, UINT8 data)
+void upd7759_reset_w(const device_config *device, UINT8 data)
{
/* update the reset value */
- struct upd7759_chip *chip = sndti_token(SOUND_UPD7759, which);
+ upd7759_state *chip = get_safe_token(device);
UINT8 oldreset = chip->reset;
chip->reset = (data != 0);
@@ -687,10 +698,10 @@ void upd7759_reset_w(int which, UINT8 data)
upd7759_reset(chip);
}
-void upd7759_start_w(int which, UINT8 data)
+void upd7759_start_w(const device_config *device, UINT8 data)
{
/* update the start value */
- struct upd7759_chip *chip = sndti_token(SOUND_UPD7759, which);
+ upd7759_state *chip = get_safe_token(device);
UINT8 oldstart = chip->start;
chip->start = (data != 0);
@@ -711,96 +722,53 @@ void upd7759_start_w(int which, UINT8 data)
}
-void upd7759_port_w(int which, UINT8 data)
+WRITE8_DEVICE_HANDLER( upd7759_port_w )
{
/* update the FIFO value */
- struct upd7759_chip *chip = sndti_token(SOUND_UPD7759, which);
+ upd7759_state *chip = get_safe_token(device);
chip->fifo_in = data;
}
-int upd7759_busy_r(int which)
+int upd7759_busy_r(const device_config *device)
{
/* return /BUSY */
- struct upd7759_chip *chip = sndti_token(SOUND_UPD7759, which);
+ upd7759_state *chip = get_safe_token(device);
return (chip->state == STATE_IDLE);
}
-void upd7759_set_bank_base(int which, UINT32 base)
+void upd7759_set_bank_base(const device_config *device, UINT32 base)
{
- struct upd7759_chip *chip = sndti_token(SOUND_UPD7759, which);
+ upd7759_state *chip = get_safe_token(device);
chip->rom = chip->rombase + base;
chip->romoffset = base;
}
-/************************************************************
-
- Convenience handlers
-
-*************************************************************/
-
-WRITE8_HANDLER(upd7759_0_start_w)
-{
- upd7759_start_w(0,data);
-}
-
-
-WRITE8_HANDLER(upd7759_0_reset_w)
-{
- upd7759_reset_w(0,data);
-}
-
-
-WRITE8_HANDLER(upd7759_0_port_w)
-{
- upd7759_port_w(0,data);
-}
-
-
-READ8_HANDLER(upd7759_0_busy_r)
-{
- return upd7759_busy_r(0);
-}
-
-
-
-
-
/**************************************************************************
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( upd7759 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( upd7759 )
+DEVICE_GET_INFO( upd7759 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct upd7759_chip); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(upd7759_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( upd7759 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( upd7759 ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( upd7759 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( upd7759 ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( upd7759 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "UPD7759"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "NEC ADPCM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "UPD7759"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "NEC ADPCM"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/upd7759.h b/src/emu/sound/upd7759.h
index b0c7c969592..150bf70f72c 100644
--- a/src/emu/sound/upd7759.h
+++ b/src/emu/sound/upd7759.h
@@ -16,20 +16,14 @@ struct _upd7759_interface
void (*drqcallback)(const device_config *device, int param); /* drq callback (per chip, slave mode only) */
};
-void upd7759_set_bank_base(int which, offs_t base);
+void upd7759_set_bank_base(const device_config *device, offs_t base);
-void upd7759_reset_w(int num, UINT8 data);
+void upd7759_reset_w(const device_config *device, UINT8 data);
+void upd7759_start_w(const device_config *device, UINT8 data);
+int upd7759_busy_r(const device_config *device);
+WRITE8_DEVICE_HANDLER( upd7759_port_w );
-void upd7759_port_w(int num, UINT8 data);
-void upd7759_start_w(int num, UINT8 data);
-int upd7759_busy_r(int num);
-
-WRITE8_HANDLER( upd7759_0_reset_w );
-WRITE8_HANDLER( upd7759_0_port_w );
-WRITE8_HANDLER( upd7759_0_start_w );
-READ8_HANDLER( upd7759_0_busy_r );
-
-SND_GET_INFO( upd7759 );
-#define SOUND_UPD7759 SND_GET_INFO_NAME( upd7759 )
+DEVICE_GET_INFO( upd7759 );
+#define SOUND_UPD7759 DEVICE_GET_INFO_NAME( upd7759 )
#endif /* __UPD7759_H__ */
diff --git a/src/emu/sound/vlm5030.c b/src/emu/sound/vlm5030.c
index 6adc7f1b5db..8dd95608636 100644
--- a/src/emu/sound/vlm5030.c
+++ b/src/emu/sound/vlm5030.c
@@ -86,7 +86,8 @@ chirp 12-..: vokume 0 : silent
#define IP_SIZE_FAST (120/FR_SIZE)
#define IP_SIZE_FASTER ( 80/FR_SIZE)
-struct vlm5030_info
+typedef struct _vlm5030_state vml5030_state;
+struct _vlm5030_state
{
const device_config *device;
const vlm5030_interface *intf;
@@ -218,7 +219,16 @@ static const INT16 K5_table[] = {
0, -8127, -16384, -24511, 32638, 24511, 16254, 8127
};
-static int get_bits(struct vlm5030_info *chip, int sbit,int bits)
+INLINE vml5030_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_VLM5030);
+ return (vml5030_state *)device->token;
+}
+
+static int get_bits(vml5030_state *chip, int sbit,int bits)
{
int offset = chip->address + (sbit>>3);
int data;
@@ -232,7 +242,7 @@ static int get_bits(struct vlm5030_info *chip, int sbit,int bits)
}
/* get next frame */
-static int parse_frame (struct vlm5030_info *chip)
+static int parse_frame (vml5030_state *chip)
{
unsigned char cmd;
int i;
@@ -289,7 +299,7 @@ static int parse_frame (struct vlm5030_info *chip)
/* decode and buffering data */
static STREAM_UPDATE( vlm5030_update_callback )
{
- struct vlm5030_info *chip = param;
+ vml5030_state *chip = param;
int buf_count=0;
int interp_effect;
int i;
@@ -444,13 +454,13 @@ phase_stop:
}
/* realtime update */
-static void vlm5030_update(struct vlm5030_info *chip)
+static void vlm5030_update(vml5030_state *chip)
{
stream_update(chip->channel);
}
/* setup parameteroption when RST=H */
-static void vlm5030_setup_parameter(struct vlm5030_info *chip, UINT8 param)
+static void vlm5030_setup_parameter(vml5030_state *chip, UINT8 param)
{
/* latch parameter value */
chip->parameter = param;
@@ -478,7 +488,7 @@ static void vlm5030_setup_parameter(struct vlm5030_info *chip, UINT8 param)
static STATE_POSTLOAD( vlm5030_restore_state )
{
- struct vlm5030_info *chip = param;
+ vml5030_state *chip = param;
int i;
int interp_effect = FR_SIZE - (chip->interp_count%FR_SIZE);
@@ -494,7 +504,7 @@ static STATE_POSTLOAD( vlm5030_restore_state )
}
-static void vlm5030_reset(struct vlm5030_info *chip)
+static void vlm5030_reset(vml5030_state *chip)
{
chip->phase = PH_RESET;
chip->address = 0;
@@ -515,38 +525,38 @@ static void vlm5030_reset(struct vlm5030_info *chip)
vlm5030_setup_parameter(chip, 0x00);
}
-static SND_RESET( vlm5030 )
+static DEVICE_RESET( vlm5030 )
{
- vlm5030_reset(device->token);
+ vlm5030_reset(get_safe_token(device));
}
/* set speech rom address */
-void vlm5030_set_rom(void *speech_rom)
+void vlm5030_set_rom(const device_config *device, void *speech_rom)
{
- struct vlm5030_info *chip = sndti_token(SOUND_VLM5030, 0);
+ vml5030_state *chip = get_safe_token(device);
chip->rom = (UINT8 *)speech_rom;
}
/* get BSY pin level */
-int vlm5030_bsy(void)
+int vlm5030_bsy(const device_config *device)
{
- struct vlm5030_info *chip = sndti_token(SOUND_VLM5030, 0);
+ vml5030_state *chip = get_safe_token(device);
vlm5030_update(chip);
return chip->pin_BSY;
}
/* latch contoll data */
-WRITE8_HANDLER( vlm5030_data_w )
+WRITE8_DEVICE_HANDLER( vlm5030_data_w )
{
- struct vlm5030_info *chip = sndti_token(SOUND_VLM5030, 0);
+ vml5030_state *chip = get_safe_token(device);
chip->latch_data = (UINT8)data;
}
/* set RST pin level : reset / set table address A8-A15 */
-void vlm5030_rst (int pin )
+void vlm5030_rst (const device_config *device, int pin )
{
- struct vlm5030_info *chip = sndti_token(SOUND_VLM5030, 0);
+ vml5030_state *chip = get_safe_token(device);
if( chip->pin_RST )
{
if( !pin )
@@ -569,18 +579,18 @@ void vlm5030_rst (int pin )
}
/* set VCU pin level : ?? unknown */
-void vlm5030_vcu(int pin)
+void vlm5030_vcu(const device_config *device, int pin)
{
- struct vlm5030_info *chip = sndti_token(SOUND_VLM5030, 0);
+ vml5030_state *chip = get_safe_token(device);
/* direct mode / indirect mode */
chip->pin_VCU = pin;
return;
}
/* set ST pin level : set table address A0-A7 / start speech */
-void vlm5030_st(int pin )
+void vlm5030_st(const device_config *device, int pin )
{
- struct vlm5030_info *chip = sndti_token(SOUND_VLM5030, 0);
+ vml5030_state *chip = get_safe_token(device);
int table;
if( chip->pin_ST != pin )
@@ -637,16 +647,16 @@ if( chip->interp_step != 1)
/* start VLM5030 with sound rom */
/* speech_rom == 0 -> use sampling data mode */
-static SND_START( vlm5030 )
+static DEVICE_START( vlm5030 )
{
const vlm5030_interface defintrf = { 0 };
int emulation_rate;
- struct vlm5030_info *chip = device->token;
+ vml5030_state *chip = get_safe_token(device);
chip->device = device;
chip->intf = (device->static_config != NULL) ? device->static_config : &defintrf;
- emulation_rate = clock / 440;
+ emulation_rate = device->clock / 440;
/* reset input pins */
chip->pin_RST = chip->pin_ST = chip->pin_VCU= 0;
@@ -693,34 +703,24 @@ static SND_START( vlm5030 )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( vlm5030 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( vlm5030 )
+DEVICE_GET_INFO( vlm5030 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct vlm5030_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(vml5030_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( vlm5030 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( vlm5030 ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( vlm5030 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( vlm5030 ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( vlm5030 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "VLM5030"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "VLM speech"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "VLM5030"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "VLM speech"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/vlm5030.h b/src/emu/sound/vlm5030.h
index 401ed9d6eeb..6efc9e0b8b1 100644
--- a/src/emu/sound/vlm5030.h
+++ b/src/emu/sound/vlm5030.h
@@ -10,20 +10,20 @@ struct _vlm5030_interface
};
/* set speech rom address */
-void vlm5030_set_rom(void *speech_rom);
+void vlm5030_set_rom(const device_config *device, void *speech_rom);
/* get BSY pin level */
-int vlm5030_bsy(void);
+int vlm5030_bsy(const device_config *device);
/* latch contoll data */
-WRITE8_HANDLER( vlm5030_data_w );
+WRITE8_DEVICE_HANDLER( vlm5030_data_w );
/* set RST pin level : reset / set table address A8-A15 */
-void vlm5030_rst (int pin );
+void vlm5030_rst (const device_config *device, int pin );
/* set VCU pin level : ?? unknown */
-void vlm5030_vcu(int pin );
+void vlm5030_vcu(const device_config *device, int pin );
/* set ST pin level : set table address A0-A7 / start speech */
-void vlm5030_st(int pin );
+void vlm5030_st(const device_config *device, int pin );
-SND_GET_INFO( vlm5030 );
-#define SOUND_VLM5030 SND_GET_INFO_NAME( vlm5030 )
+DEVICE_GET_INFO( vlm5030 );
+#define SOUND_VLM5030 DEVICE_GET_INFO_NAME( vlm5030 )
#endif /* __VLM5030_H__ */
diff --git a/src/emu/sound/votrax.c b/src/emu/sound/votrax.c
index 6b19ca8d8ba..299e1ee5fd9 100644
--- a/src/emu/sound/votrax.c
+++ b/src/emu/sound/votrax.c
@@ -6,7 +6,7 @@
**************************************************************************
-SND_START(votrax)- Start emulation, load samples from Votrax subdirectory
+DEVICE_START(votrax)- Start emulation, load samples from Votrax subdirectory
votrax_w - Write data to votrax port
votrax_status_r - Return busy status (-1 = busy)
@@ -21,7 +21,8 @@ the variable VotraxBaseFrequency, this is defaulted to 8000
#include "votrax.h"
-struct votrax_info
+typedef struct _votrax_state votrax_state;
+struct _votrax_state
{
const device_config *device;
int stream;
@@ -37,6 +38,15 @@ struct votrax_info
struct loaded_samples *samples;
};
+INLINE votrax_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_VOTRAX);
+ return (votrax_state *)device->token;
+}
+
#define FRAC_BITS 24
#define FRAC_ONE (1 << FRAC_BITS)
#define FRAC_MASK (FRAC_ONE - 1)
@@ -61,7 +71,7 @@ static const char *const VotraxTable[65] =
static STREAM_UPDATE( votrax_update_sound )
{
- struct votrax_info *info = param;
+ votrax_state *info = param;
stream_sample_t *buffer = outputs[0];
if (info->sample)
@@ -101,9 +111,9 @@ static STREAM_UPDATE( votrax_update_sound )
}
-static SND_START( votrax )
+static DEVICE_START( votrax )
{
- struct votrax_info *votrax = device->token;
+ votrax_state *votrax = get_safe_token(device);
votrax->device = device;
votrax->samples = readsamples(VotraxTable,"votrax");
@@ -117,9 +127,9 @@ static SND_START( votrax )
}
-void votrax_w(int data)
+WRITE8_DEVICE_HANDLER( votrax_w )
{
- struct votrax_info *info = sndti_token(SOUND_VOTRAX, 0);
+ votrax_state *info = get_safe_token(device);
int Phoneme,Intonation;
stream_update(info->channel);
@@ -142,9 +152,9 @@ void votrax_w(int data)
}
}
-int votrax_status_r(void)
+int votrax_status_r(const device_config *device)
{
- struct votrax_info *info = sndti_token(SOUND_VOTRAX, 0);
+ votrax_state *info = get_safe_token(device);
stream_update(info->channel);
return (info->sample != NULL);
}
@@ -155,34 +165,24 @@ int votrax_status_r(void)
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( votrax )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( votrax )
+DEVICE_GET_INFO( votrax )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct votrax_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(votrax_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( votrax ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( votrax ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( votrax ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "Votrax SC-01"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Votrax speech"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "Votrax SC-01"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Votrax speech"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/votrax.h b/src/emu/sound/votrax.h
index 4a8000f399c..abe8b632748 100644
--- a/src/emu/sound/votrax.h
+++ b/src/emu/sound/votrax.h
@@ -3,10 +3,10 @@
#ifndef __VOTRAX_H__
#define __VOTRAX_H__
-void votrax_w(int data);
-int votrax_status_r(void);
+WRITE8_DEVICE_HANDLER( votrax_w );
+int votrax_status_r(const device_config *device);
-SND_GET_INFO( votrax );
-#define SOUND_VOTRAX SND_GET_INFO_NAME( votrax )
+DEVICE_GET_INFO( votrax );
+#define SOUND_VOTRAX DEVICE_GET_INFO_NAME( votrax )
#endif /* __VOTRAX_H__ */
diff --git a/src/emu/sound/vrender0.c b/src/emu/sound/vrender0.c
index 7f55f747aaa..480a1a761f2 100644
--- a/src/emu/sound/vrender0.c
+++ b/src/emu/sound/vrender0.c
@@ -14,7 +14,8 @@ reverb
interrupts
*************/
-struct _VR0Chip
+typedef struct _vr0_state vr0_state;
+struct _vr0_state
{
UINT32 *TexBase;
UINT32 *FBBase;
@@ -23,11 +24,20 @@ struct _VR0Chip
sound_stream * stream;
};
-static void VR0_RenderAudio(struct _VR0Chip *VR0, int nsamples,stream_sample_t *l,stream_sample_t *r);
+INLINE vr0_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_VRENDER0);
+ return (vr0_state *)device->token;
+}
+
+static void VR0_RenderAudio(vr0_state *VR0, int nsamples,stream_sample_t *l,stream_sample_t *r);
static STREAM_UPDATE( VR0_Update )
{
- struct _VR0Chip *VR0 = param;
+ vr0_state *VR0 = param;
VR0_RenderAudio(VR0, samples,outputs[0],outputs[1]);
}
@@ -87,17 +97,17 @@ static const unsigned short ULawTo16[]=
#define LOOPEND(chan) (GETSOUNDREG32(chan,0x10)&0x3fffff)
#define ENVVOL(chan) (GETSOUNDREG32(chan,0x04)&0xffffff)
*/
-void vr0_snd_set_areas(UINT32 *texture,UINT32 *frame)
+void vr0_snd_set_areas(const device_config *device,UINT32 *texture,UINT32 *frame)
{
- struct _VR0Chip *VR0 = sndti_token(SOUND_VRENDER0, 0);
+ vr0_state *VR0 = get_safe_token(device);
VR0->TexBase=texture;
VR0->FBBase=frame;
}
-static SND_START( vrender0 )
+static DEVICE_START( vrender0 )
{
const vr0_interface *intf;
- struct _VR0Chip *VR0 = device->token;
+ vr0_state *VR0 = get_safe_token(device);
intf=device->static_config;
@@ -107,9 +117,9 @@ static SND_START( vrender0 )
VR0->stream = stream_create(device, 0, 2, 44100, VR0, VR0_Update);
}
-WRITE32_HANDLER(vr0_snd_write)
+WRITE32_DEVICE_HANDLER(vr0_snd_write)
{
- struct _VR0Chip *VR0 = sndti_token(SOUND_VRENDER0, 0);
+ vr0_state *VR0 = get_safe_token(device);
if(offset==0x404/4)
{
data&=0xffff;
@@ -132,13 +142,13 @@ WRITE32_HANDLER(vr0_snd_write)
}
-READ32_HANDLER(vr0_snd_read)
+READ32_DEVICE_HANDLER(vr0_snd_read)
{
- struct _VR0Chip *VR0 = sndti_token(SOUND_VRENDER0, 0);
+ vr0_state *VR0 = get_safe_token(device);
return VR0->SOUNDREGS[offset];
}
-static void VR0_RenderAudio(struct _VR0Chip *VR0, int nsamples,stream_sample_t *l,stream_sample_t *r)
+static void VR0_RenderAudio(vr0_state *VR0, int nsamples,stream_sample_t *l,stream_sample_t *r)
{
INT16 *SAMPLES;
UINT32 st=STATUS;
@@ -237,34 +247,24 @@ static void VR0_RenderAudio(struct _VR0Chip *VR0, int nsamples,stream_sample_t *
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( vrender0 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( vrender0 )
+DEVICE_GET_INFO( vrender0 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct _VR0Chip); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(vr0_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( vrender0 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( vrender0 ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( vrender0 ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "VRender0"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "???"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "VRender0"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "???"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/vrender0.h b/src/emu/sound/vrender0.h
index fcf69e0bcd9..abeab068c09 100644
--- a/src/emu/sound/vrender0.h
+++ b/src/emu/sound/vrender0.h
@@ -10,12 +10,12 @@ struct _vr0_interface
UINT32 RegBase;
};
-void vr0_snd_set_areas(UINT32 *texture,UINT32 *frame);
+void vr0_snd_set_areas(const device_config *device,UINT32 *texture,UINT32 *frame);
-READ32_HANDLER(vr0_snd_read);
-WRITE32_HANDLER(vr0_snd_write);
+READ32_DEVICE_HANDLER( vr0_snd_read );
+WRITE32_DEVICE_HANDLER( vr0_snd_write );
-SND_GET_INFO( vrender0 );
-#define SOUND_VRENDER0 SND_GET_INFO_NAME( vrender0 )
+DEVICE_GET_INFO( vrender0 );
+#define SOUND_VRENDER0 DEVICE_GET_INFO_NAME( vrender0 )
#endif /* __VRENDER0_H__ */
diff --git a/src/emu/sound/wave.c b/src/emu/sound/wave.c
index b1f8f7dea27..78540a68a86 100644
--- a/src/emu/sound/wave.c
+++ b/src/emu/sound/wave.c
@@ -55,7 +55,7 @@ static STREAM_UPDATE( wave_sound_update )
-static SND_START( wave )
+static DEVICE_START( wave )
{
const device_config *image = NULL;
@@ -71,33 +71,23 @@ static SND_START( wave )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( wave )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( wave )
+DEVICE_GET_INFO( wave )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = 1; break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = 1; break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( wave ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( wave ); break;
- case SNDINFO_PTR_STOP: /* nothing */ break;
- case SNDINFO_PTR_RESET: /* nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( wave ); break;
+ case DEVINFO_FCT_STOP: /* nothing */ break;
+ case DEVINFO_FCT_RESET: /* nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "Cassette"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Cassette"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright The MESS Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "Cassette"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Cassette"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright The MESS Team"); break;
}
}
diff --git a/src/emu/sound/wave.h b/src/emu/sound/wave.h
index 166c1c0d955..556d1589449 100644
--- a/src/emu/sound/wave.h
+++ b/src/emu/sound/wave.h
@@ -11,7 +11,7 @@
#include "messdrv.h"
#endif
-SND_GET_INFO( wave );
-#define SOUND_WAVE SND_GET_INFO_NAME( wave )
+DEVICE_GET_INFO( wave );
+#define SOUND_WAVE DEVICE_GET_INFO_NAME( wave )
#endif /* __WAVE_H__ */
diff --git a/src/emu/sound/x1_010.c b/src/emu/sound/x1_010.c
index 6c92b74bd28..ea5bb33f137 100644
--- a/src/emu/sound/x1_010.c
+++ b/src/emu/sound/x1_010.c
@@ -79,7 +79,8 @@ typedef struct {
unsigned char reserve[2];
} X1_010_CHANNEL;
-struct x1_010_info
+typedef struct _x1_010_state x1_010_state;
+struct _x1_010_state
{
/* Variables only used here */
int rate; // Output sampling rate (Hz)
@@ -98,13 +99,22 @@ struct x1_010_info
/* mixer tables and internal buffers */
//static short *mixer_buffer = NULL;
+INLINE x1_010_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_X1_010);
+ return (x1_010_state *)device->token;
+}
+
/*--------------------------------------------------------------
generate sound to the mix buffer
--------------------------------------------------------------*/
static STREAM_UPDATE( seta_update )
{
- struct x1_010_info *info = param;
+ x1_010_state *info = param;
X1_010_CHANNEL *reg;
int ch, i, volL, volR, freq;
register INT8 *start, *end, data;
@@ -191,15 +201,15 @@ static STREAM_UPDATE( seta_update )
-static SND_START( x1_010 )
+static DEVICE_START( x1_010 )
{
int i;
const x1_010_interface *intf = device->static_config;
- struct x1_010_info *info = device->token;
+ x1_010_state *info = device->token;
info->region = device->region;
- info->base_clock = clock;
- info->rate = clock / 1024;
+ info->base_clock = device->clock;
+ info->rate = device->clock / 1024;
info->address = intf->adr;
for( i = 0; i < SETA_NUM_CHANNELS; i++ ) {
@@ -207,16 +217,16 @@ static SND_START( x1_010 )
info->env_offset[i] = 0;
}
/* Print some more debug info */
- LOG_SOUND(("masterclock = %d rate = %d\n", clock, info->rate ));
+ LOG_SOUND(("masterclock = %d rate = %d\n", device->clock, info->rate ));
/* get stream channels */
info->stream = stream_create(device,0,2,info->rate,info,seta_update);
}
-void seta_sound_enable_w(int data)
+void seta_sound_enable_w(const device_config *device, int data)
{
- struct x1_010_info *info = sndti_token(SOUND_X1_010, 0);
+ x1_010_state *info = get_safe_token(device);
info->sound_enable = data;
}
@@ -225,9 +235,9 @@ void seta_sound_enable_w(int data)
/* Use these for 8 bit CPUs */
-READ8_HANDLER( seta_sound_r )
+READ8_DEVICE_HANDLER( seta_sound_r )
{
- struct x1_010_info *info = sndti_token(SOUND_X1_010, 0);
+ x1_010_state *info = get_safe_token(device);
offset ^= info->address;
return info->reg[offset];
}
@@ -235,9 +245,9 @@ READ8_HANDLER( seta_sound_r )
-WRITE8_HANDLER( seta_sound_w )
+WRITE8_DEVICE_HANDLER( seta_sound_w )
{
- struct x1_010_info *info = sndti_token(SOUND_X1_010, 0);
+ x1_010_state *info = get_safe_token(device);
int channel, reg;
offset ^= info->address;
@@ -249,7 +259,7 @@ WRITE8_HANDLER( seta_sound_w )
info->smp_offset[channel] = 0;
info->env_offset[channel] = 0;
}
- LOG_REGISTER_WRITE(("PC: %06X : offset %6X : data %2X\n", cpu_get_pc(space->cpu), offset, data ));
+ LOG_REGISTER_WRITE(("%s: offset %6X : data %2X\n", cpuexec_describe_context(device->machine), offset, data ));
info->reg[offset] = data;
}
@@ -258,23 +268,23 @@ WRITE8_HANDLER( seta_sound_w )
/* Use these for 16 bit CPUs */
-READ16_HANDLER( seta_sound_word_r )
+READ16_DEVICE_HANDLER( seta_sound_word_r )
{
- struct x1_010_info *info = sndti_token(SOUND_X1_010, 0);
+ x1_010_state *info = get_safe_token(device);
UINT16 ret;
ret = info->HI_WORD_BUF[offset]<<8;
- ret += (seta_sound_r( space, offset )&0xff);
- LOG_REGISTER_READ(( "Read X1-010 PC:%06X Offset:%04X Data:%04X\n", cpu_get_pc(space->cpu), offset, ret ));
+ ret += (seta_sound_r( device, offset )&0xff);
+ LOG_REGISTER_READ(( "%s: Read X1-010 Offset:%04X Data:%04X\n", cpuexec_describe_context(device->machine), offset, ret ));
return ret;
}
-WRITE16_HANDLER( seta_sound_word_w )
+WRITE16_DEVICE_HANDLER( seta_sound_word_w )
{
- struct x1_010_info *info = sndti_token(SOUND_X1_010, 0);
+ x1_010_state *info = get_safe_token(device);
info->HI_WORD_BUF[offset] = (data>>8)&0xff;
- seta_sound_w( space, offset, data&0xff );
- LOG_REGISTER_WRITE(( "Write X1-010 PC:%06X Offset:%04X Data:%04X\n", cpu_get_pc(space->cpu), offset, data ));
+ seta_sound_w( device, offset, data&0xff );
+ LOG_REGISTER_WRITE(( "%s: Write X1-010 Offset:%04X Data:%04X\n", cpuexec_describe_context(device->machine), offset, data ));
}
@@ -283,34 +293,24 @@ WRITE16_HANDLER( seta_sound_word_w )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( x1_010 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( x1_010 )
+DEVICE_GET_INFO( x1_010 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct x1_010_info); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(x1_010_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( x1_010 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( x1_010 ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( x1_010 ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "X1-010"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Seta custom"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "X1-010"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Seta custom"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/x1_010.h b/src/emu/sound/x1_010.h
index bef66892beb..1d75f4b5b2a 100644
--- a/src/emu/sound/x1_010.h
+++ b/src/emu/sound/x1_010.h
@@ -11,15 +11,15 @@ struct _x1_010_interface
};
-READ8_HANDLER ( seta_sound_r );
-WRITE8_HANDLER( seta_sound_w );
+READ8_DEVICE_HANDLER ( seta_sound_r );
+WRITE8_DEVICE_HANDLER( seta_sound_w );
-READ16_HANDLER ( seta_sound_word_r );
-WRITE16_HANDLER( seta_sound_word_w );
+READ16_DEVICE_HANDLER ( seta_sound_word_r );
+WRITE16_DEVICE_HANDLER( seta_sound_word_w );
-void seta_sound_enable_w(int);
+void seta_sound_enable_w(const device_config *device, int data);
-SND_GET_INFO( x1_010 );
-#define SOUND_X1_010 SND_GET_INFO_NAME( x1_010 )
+DEVICE_GET_INFO( x1_010 );
+#define SOUND_X1_010 DEVICE_GET_INFO_NAME( x1_010 )
#endif /* __X1_010_H__ */
diff --git a/src/emu/sound/ym2151.c b/src/emu/sound/ym2151.c
index 7732b60d184..6f2c35fa37b 100644
--- a/src/emu/sound/ym2151.c
+++ b/src/emu/sound/ym2151.c
@@ -160,8 +160,8 @@ typedef struct
UINT32 noise_tab[32]; /* 17bit Noise Generator periods */
- void (*irqhandler)(running_machine *machine, int irq); /* IRQ function handler */
- write8_space_func porthandler; /* port write function handler */
+ void (*irqhandler)(const device_config *device, int irq); /* IRQ function handler */
+ write8_device_func porthandler; /* port write function handler */
const device_config *device;
unsigned int clock; /* chip clock in Hz (passed from 2151intf.c) */
@@ -787,7 +787,7 @@ static TIMER_CALLBACK( irqAon_callback )
chip->irqlinestate |= 1;
- if (oldstate == 0 && chip->irqhandler) (*chip->irqhandler)(machine, 1);
+ if (oldstate == 0 && chip->irqhandler) (*chip->irqhandler)(chip->device, 1);
}
static TIMER_CALLBACK( irqBon_callback )
@@ -797,7 +797,7 @@ static TIMER_CALLBACK( irqBon_callback )
chip->irqlinestate |= 2;
- if (oldstate == 0 && chip->irqhandler) (*chip->irqhandler)(machine, 1);
+ if (oldstate == 0 && chip->irqhandler) (*chip->irqhandler)(chip->device, 1);
}
static TIMER_CALLBACK( irqAoff_callback )
@@ -807,7 +807,7 @@ static TIMER_CALLBACK( irqAoff_callback )
chip->irqlinestate &= ~1;
- if (oldstate == 1 && chip->irqhandler) (*chip->irqhandler)(machine, 0);
+ if (oldstate == 1 && chip->irqhandler) (*chip->irqhandler)(chip->device, 0);
}
static TIMER_CALLBACK( irqBoff_callback )
@@ -817,7 +817,7 @@ static TIMER_CALLBACK( irqBoff_callback )
chip->irqlinestate &= ~2;
- if (oldstate == 2 && chip->irqhandler) (*chip->irqhandler)(machine, 0);
+ if (oldstate == 2 && chip->irqhandler) (*chip->irqhandler)(chip->device, 0);
}
static TIMER_CALLBACK( timer_callback_a )
@@ -1044,8 +1044,6 @@ INLINE void refresh_EG(YM2151Operator * op)
void ym2151_write_reg(void *_chip, int r, int v)
{
YM2151 *chip = _chip;
- /* temporary hack until this is converted to a device */
- const address_space *space = memory_find_address_space(chip->device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
YM2151Operator *op = &chip->oper[ (r&0x07)*4+((r&0x18)>>3) ];
/* adjust bus to 8 bits */
@@ -1108,7 +1106,7 @@ void ym2151_write_reg(void *_chip, int r, int v)
#else
int oldstate = chip->status & 3;
chip->status &= ~1;
- if ((oldstate==1) && (chip->irqhandler)) (*chip->irqhandler)(machine, 0);
+ if ((oldstate==1) && (chip->irqhandler)) (*chip->irqhandler)(chip->device, 0);
#endif
}
@@ -1120,7 +1118,7 @@ void ym2151_write_reg(void *_chip, int r, int v)
#else
int oldstate = chip->status & 3;
chip->status &= ~2;
- if ((oldstate==2) && (chip->irqhandler)) (*chip->irqhandler)(machine, 0);
+ if ((oldstate==2) && (chip->irqhandler)) (*chip->irqhandler)(chip->device, 0);
#endif
}
@@ -1192,7 +1190,7 @@ void ym2151_write_reg(void *_chip, int r, int v)
case 0x1b: /* CT2, CT1, LFO waveform */
chip->ct = v >> 6;
chip->lfo_wsel = v & 3;
- if (chip->porthandler) (*chip->porthandler)(space, 0 , chip->ct );
+ if (chip->porthandler) (*chip->porthandler)(chip->device, 0 , chip->ct );
break;
default:
@@ -2394,7 +2392,7 @@ void ym2151_update_one(void *chip, SAMP **buffers, int length)
{
int oldstate = PSG->status & 3;
PSG->status |= 2;
- if ((!oldstate) && (PSG->irqhandler)) (*PSG->irqhandler)(machine, 1);
+ if ((!oldstate) && (PSG->irqhandler)) (*PSG->irqhandler)(chip->device, 1);
}
}
}
@@ -2472,7 +2470,7 @@ void ym2151_update_one(void *chip, SAMP **buffers, int length)
{
int oldstate = PSG->status & 3;
PSG->status |= 1;
- if ((!oldstate) && (PSG->irqhandler)) (*PSG->irqhandler)(machine, 1);
+ if ((!oldstate) && (PSG->irqhandler)) (*PSG->irqhandler)(chip->device, 1);
}
if (PSG->irq_enable & 0x80)
PSG->csm_req = 2; /* request KEY ON / KEY OFF sequence */
@@ -2483,13 +2481,13 @@ void ym2151_update_one(void *chip, SAMP **buffers, int length)
}
}
-void ym2151_set_irq_handler(void *chip, void(*handler)(running_machine *machine, int irq))
+void ym2151_set_irq_handler(void *chip, void(*handler)(const device_config *device, int irq))
{
YM2151 *PSG = chip;
PSG->irqhandler = handler;
}
-void ym2151_set_port_write_handler(void *chip, write8_space_func handler)
+void ym2151_set_port_write_handler(void *chip, write8_device_func handler)
{
YM2151 *PSG = chip;
PSG->porthandler = handler;
diff --git a/src/emu/sound/ym2151.h b/src/emu/sound/ym2151.h
index 6d34df700c2..5f717d1d53d 100644
--- a/src/emu/sound/ym2151.h
+++ b/src/emu/sound/ym2151.h
@@ -78,10 +78,10 @@ void ym2151_write_reg(void *chip, int r, int v);
int ym2151_read_status(void *chip);
/* set interrupt handler on YM2151 chip number 'n'*/
-void ym2151_set_irq_handler(void *chip, void (*handler)(running_machine *machine, int irq));
+void ym2151_set_irq_handler(void *chip, void (*handler)(const device_config *device, int irq));
/* set port write handler on YM2151 chip number 'n'*/
-void ym2151_set_port_write_handler(void *chip, write8_space_func handler);
+void ym2151_set_port_write_handler(void *chip, write8_device_func handler);
/* refresh chip when load state */
STATE_POSTLOAD( ym2151_postload );
diff --git a/src/emu/sound/ymf271.c b/src/emu/sound/ymf271.c
index b28c37feb5d..8e202bcc955 100644
--- a/src/emu/sound/ymf271.c
+++ b/src/emu/sound/ymf271.c
@@ -107,9 +107,9 @@ typedef struct
UINT8 ext_read;
const UINT8 *rom;
- read8_device_func ext_mem_read;
- write8_device_func ext_mem_write;
- void (*irq_callback)(running_machine *, int);
+ devcb_resolved_read8 ext_mem_read;
+ devcb_resolved_write8 ext_mem_write;
+ void (*irq_callback)(const device_config *, int);
UINT32 clock;
sound_stream * stream;
@@ -252,6 +252,16 @@ static int channel_attenuation[16];
static int total_level[128];
static int env_volume_table[256];
+INLINE YMF271Chip *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_YMF271);
+ return (YMF271Chip *)device->token;
+}
+
+
INLINE int GET_KEYSCALED_RATE(int rate, int keycode, int keyscale)
{
int newrate = rate + RKS_Table[keycode][keyscale];
@@ -1355,7 +1365,7 @@ static TIMER_CALLBACK( ymf271_timer_a_tick )
if (chip->enable & 4)
{
chip->irqstate |= 1;
- if (chip->irq_callback) chip->irq_callback(machine, 1);
+ if (chip->irq_callback) chip->irq_callback(chip->device, 1);
}
}
@@ -1368,14 +1378,14 @@ static TIMER_CALLBACK( ymf271_timer_b_tick )
if (chip->enable & 8)
{
chip->irqstate |= 2;
- if (chip->irq_callback) chip->irq_callback(machine, 1);
+ if (chip->irq_callback) chip->irq_callback(chip->device, 1);
}
}
static UINT8 ymf271_read_ext_memory(YMF271Chip *chip, UINT32 address)
{
- if( chip->ext_mem_read ) {
- return chip->ext_mem_read(chip->device,address);
+ if( chip->ext_mem_read.read ) {
+ return devcb_call_read8(&chip->ext_mem_read, address);
} else {
if( address < 0x800000)
return chip->rom[address];
@@ -1385,9 +1395,7 @@ static UINT8 ymf271_read_ext_memory(YMF271Chip *chip, UINT32 address)
static void ymf271_write_ext_memory(YMF271Chip *chip, UINT32 address, UINT8 data)
{
- if( chip->ext_mem_write ) {
- chip->ext_mem_write(chip->device, address, data);
- }
+ devcb_call_write8(&chip->ext_mem_write, address, data);
}
static void ymf271_write_timer(YMF271Chip *chip, int data)
@@ -1395,7 +1403,6 @@ static void ymf271_write_timer(YMF271Chip *chip, int data)
int slotnum;
YMF271Group *group;
attotime period;
- running_machine *machine = chip->device->machine;
slotnum = fm_tab[chip->timerreg & 0xf];
group = &chip->groups[slotnum];
@@ -1453,7 +1460,7 @@ static void ymf271_write_timer(YMF271Chip *chip, int data)
chip->irqstate &= ~1;
chip->status &= ~1;
- if (chip->irq_callback) chip->irq_callback(machine, 0);
+ if (chip->irq_callback) chip->irq_callback(chip->device, 0);
//period = (double)(256.0 - chip->timerAVal ) * ( 384.0 * 4.0 / (double)CLOCK);
period = attotime_mul(ATTOTIME_IN_HZ(chip->clock), 384 * (1024 - chip->timerAVal));
@@ -1465,7 +1472,7 @@ static void ymf271_write_timer(YMF271Chip *chip, int data)
chip->irqstate &= ~2;
chip->status &= ~2;
- if (chip->irq_callback) chip->irq_callback(machine, 0);
+ if (chip->irq_callback) chip->irq_callback(chip->device, 0);
period = attotime_mul(ATTOTIME_IN_HZ(chip->clock), 384 * 16 * (256 - chip->timerBVal));
@@ -1497,9 +1504,9 @@ static void ymf271_write_timer(YMF271Chip *chip, int data)
}
}
-static void ymf271_w(int chipnum, int offset, int data)
+WRITE8_DEVICE_HANDLER( ymf271_w )
{
- YMF271Chip *chip = sndti_token(SOUND_YMF271, chipnum);
+ YMF271Chip *chip = get_safe_token(device);
switch (offset)
{
@@ -1542,10 +1549,10 @@ static void ymf271_w(int chipnum, int offset, int data)
}
}
-static int ymf271_r(int chipnum, int offset)
+READ8_DEVICE_HANDLER( ymf271_r )
{
UINT8 value;
- YMF271Chip *chip = sndti_token(SOUND_YMF271, chipnum);
+ YMF271Chip *chip = get_safe_token(device);
switch(offset)
{
@@ -1723,7 +1730,7 @@ static void init_state(YMF271Chip *chip, const device_config *device)
state_save_register_device_item(device, 0, chip->ext_read);
}
-static void ymf271_init(const device_config *device, YMF271Chip *chip, UINT8 *rom, void (*cb)(running_machine *,int), read8_device_func ext_read, write8_device_func ext_write)
+static void ymf271_init(const device_config *device, YMF271Chip *chip, UINT8 *rom, void (*cb)(const device_config *,int), const devcb_read8 *ext_read, const devcb_write8 *ext_write)
{
chip->timA = timer_alloc(device->machine, ymf271_timer_a_tick, chip);
chip->timB = timer_alloc(device->machine, ymf271_timer_b_tick, chip);
@@ -1731,27 +1738,27 @@ static void ymf271_init(const device_config *device, YMF271Chip *chip, UINT8 *ro
chip->rom = rom;
chip->irq_callback = cb;
- chip->ext_mem_read = ext_read;
- chip->ext_mem_write = ext_write;
+ devcb_resolve_read8(&chip->ext_mem_read, ext_read, device);
+ devcb_resolve_write8(&chip->ext_mem_write, ext_write, device);
init_tables();
init_state(chip, device);
}
-static SND_START( ymf271 )
+static DEVICE_START( ymf271 )
{
- static const ymf271_interface defintrf = { 0 };
+ static const ymf271_interface defintrf = { DEVCB_NULL };
const ymf271_interface *intf;
int i;
- YMF271Chip *chip = device->token;
+ YMF271Chip *chip = get_safe_token(device);
chip->device = device;
- chip->clock = clock;
+ chip->clock = device->clock;
intf = (device->static_config != NULL) ? device->static_config : &defintrf;
- ymf271_init(device, chip, device->region, intf->irq_callback, intf->ext_read, intf->ext_write);
- chip->stream = stream_create(device, 0, 2, clock/384, chip, ymf271_update);
+ ymf271_init(device, chip, device->region, intf->irq_callback, &intf->ext_read, &intf->ext_write);
+ chip->stream = stream_create(device, 0, 2, device->clock/384, chip, ymf271_update);
for (i = 0; i < 256; i++)
{
@@ -1769,30 +1776,10 @@ static SND_START( ymf271 )
}
}
-READ8_HANDLER( ymf271_0_r )
-{
- return ymf271_r(0, offset);
-}
-
-WRITE8_HANDLER( ymf271_0_w )
-{
- ymf271_w(0, offset, data);
-}
-
-READ8_HANDLER( ymf271_1_r )
-{
- return ymf271_r(1, offset);
-}
-
-WRITE8_HANDLER( ymf271_1_w )
-{
- ymf271_w(1, offset, data);
-}
-
-static SND_RESET( ymf271 )
+static DEVICE_RESET( ymf271 )
{
int i;
- YMF271Chip *chip = device->token;
+ YMF271Chip *chip = get_safe_token(device);
for (i = 0; i < 48; i++)
{
@@ -1805,33 +1792,23 @@ static SND_RESET( ymf271 )
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( ymf271 )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( ymf271 )
+DEVICE_GET_INFO( ymf271 )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(YMF271Chip); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(YMF271Chip); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( ymf271 ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( ymf271 ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: info->reset = SND_RESET_NAME( ymf271 ); break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ymf271 ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( ymf271 ); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "YMF271"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Yamaha FM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "YMF271"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Yamaha FM"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/ymf271.h b/src/emu/sound/ymf271.h
index 26273d69875..8cb9e339cce 100644
--- a/src/emu/sound/ymf271.h
+++ b/src/emu/sound/ymf271.h
@@ -3,20 +3,20 @@
#ifndef __YMF271_H__
#define __YMF271_H__
+#include "devcb.h"
+
typedef struct _ymf271_interface ymf271_interface;
struct _ymf271_interface
{
- read8_device_func ext_read; /* external memory read */
- write8_device_func ext_write; /* external memory write */
- void (*irq_callback)(running_machine *machine, int state); /* irq callback */
+ devcb_read8 ext_read; /* external memory read */
+ devcb_write8 ext_write; /* external memory write */
+ void (*irq_callback)(const device_config *device, int state); /* irq callback */
};
-READ8_HANDLER( ymf271_0_r );
-WRITE8_HANDLER( ymf271_0_w );
-READ8_HANDLER( ymf271_1_r );
-WRITE8_HANDLER( ymf271_1_w );
+READ8_DEVICE_HANDLER( ymf271_r );
+WRITE8_DEVICE_HANDLER( ymf271_w );
-SND_GET_INFO( ymf271 );
-#define SOUND_YMF271 SND_GET_INFO_NAME( ymf271 )
+DEVICE_GET_INFO( ymf271 );
+#define SOUND_YMF271 DEVICE_GET_INFO_NAME( ymf271 )
#endif /* __YMF271_H__ */
diff --git a/src/emu/sound/ymf278b.c b/src/emu/sound/ymf278b.c
index e080342758e..083ea2e17b5 100644
--- a/src/emu/sound/ymf278b.c
+++ b/src/emu/sound/ymf278b.c
@@ -118,7 +118,8 @@ typedef struct
int irq_line;
UINT8 port_A, port_B, port_C;
- void (*irq_callback)(running_machine *, int);
+ void (*irq_callback)(const device_config *, int);
+ const device_config *device;
const UINT8 *rom;
int clock;
@@ -130,6 +131,15 @@ typedef struct
sound_stream * stream;
} YMF278BChip;
+INLINE YMF278BChip *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_YMF278B);
+ return (YMF278BChip *)device->token;
+}
+
static INT32 *mix;
static int ymf278b_compute_rate(YMF278BSlot *slot, int val)
@@ -340,7 +350,7 @@ static void ymf278b_irq_check(running_machine *machine, YMF278BChip *chip)
int prev_line = chip->irq_line;
chip->irq_line = chip->current_irq ? ASSERT_LINE : CLEAR_LINE;
if(chip->irq_line != prev_line && chip->irq_callback)
- chip->irq_callback(machine, chip->irq_line);
+ chip->irq_callback(chip->device, chip->irq_line);
}
static TIMER_CALLBACK( ymf278b_timer_a_tick )
@@ -605,77 +615,82 @@ static void ymf278b_C_w(YMF278BChip *chip, UINT8 reg, UINT8 data)
}
}
-static UINT8 ymf278b_status_port_r(int num)
+READ8_DEVICE_HANDLER( ymf278b_r )
{
- YMF278BChip *chip = sndti_token(SOUND_YMF278B, num);
- return chip->current_irq | (chip->irq_line == ASSERT_LINE ? 0x80 : 0x00);
-}
+ YMF278BChip *chip = get_safe_token(device);
-// Not implemented yet
-static UINT8 ymf278b_data_port_r(int num)
-{
- return 0;
-}
+ switch (offset)
+ {
+ case 0:
+ return chip->current_irq | (chip->irq_line == ASSERT_LINE ? 0x80 : 0x00);
-static void ymf278b_control_port_A_w(int num, UINT8 data)
-{
- YMF278BChip *chip = sndti_token(SOUND_YMF278B, num);
- chip->port_A = data;
+ default:
+ logerror("%s: unexpected write at offset %X to ymf278b\n", cpuexec_describe_context(device->machine), offset);
+ break;
+ }
+ return 0xff;
}
-static void ymf278b_data_port_A_w(running_machine *machine, int num, UINT8 data)
+WRITE8_DEVICE_HANDLER( ymf278b_w )
{
- YMF278BChip *chip = sndti_token(SOUND_YMF278B, num);
- ymf278b_A_w(machine, chip, chip->port_A, data);
-}
+ YMF278BChip *chip = get_safe_token(device);
-static void ymf278b_control_port_B_w(int num, UINT8 data)
-{
- YMF278BChip *chip = sndti_token(SOUND_YMF278B, num);
- chip->port_B = data;
-}
+ switch (offset)
+ {
+ case 0:
+ chip->port_A = data;
+ break;
-static void ymf278b_data_port_B_w(int num, UINT8 data)
-{
- YMF278BChip *chip = sndti_token(SOUND_YMF278B, num);
- ymf278b_B_w(chip, chip->port_B, data);
-}
+ case 1:
+ ymf278b_A_w(device->machine, chip, chip->port_A, data);
+ break;
-static void ymf278b_control_port_C_w(int num, UINT8 data)
-{
- YMF278BChip *chip = sndti_token(SOUND_YMF278B, num);
- chip->port_C = data;
-}
+ case 2:
+ chip->port_B = data;
+ break;
-static void ymf278b_data_port_C_w(int num, UINT8 data)
-{
- YMF278BChip *chip = sndti_token(SOUND_YMF278B, num);
- ymf278b_C_w(chip, chip->port_C, data);
+ case 3:
+ ymf278b_B_w(chip, chip->port_B, data);
+ break;
+
+ case 4:
+ chip->port_C = data;
+ break;
+
+ case 5:
+ ymf278b_C_w(chip, chip->port_C, data);
+ break;
+
+ default:
+ logerror("%s: unexpected write at offset %X to ymf278b = %02X\n", cpuexec_describe_context(device->machine), offset, data);
+ break;
+ }
}
-static void ymf278b_init(running_machine *machine, YMF278BChip *chip, UINT8 *rom, void (*cb)(running_machine *, int), int clock)
+static void ymf278b_init(const device_config *device, YMF278BChip *chip, void (*cb)(const device_config *, int))
{
- chip->rom = rom;
+ chip->rom = device->region;
chip->irq_callback = cb;
- chip->timer_a = timer_alloc(machine, ymf278b_timer_a_tick, chip);
- chip->timer_b = timer_alloc(machine, ymf278b_timer_b_tick, chip);
+ chip->timer_a = timer_alloc(device->machine, ymf278b_timer_a_tick, chip);
+ chip->timer_b = timer_alloc(device->machine, ymf278b_timer_b_tick, chip);
chip->irq_line = CLEAR_LINE;
- chip->clock = clock;
+ chip->clock = device->clock;
mix = auto_malloc(44100*2*sizeof(*mix));
}
-static SND_START( ymf278b )
+static DEVICE_START( ymf278b )
{
static const ymf278b_interface defintrf = { 0 };
const ymf278b_interface *intf;
int i;
- YMF278BChip *chip = device->token;
+ YMF278BChip *chip = get_safe_token(device);
+ chip->device = device;
intf = (device->static_config != NULL) ? device->static_config : &defintrf;
- ymf278b_init(device->machine, chip, device->region, intf->irq_callback, clock);
- chip->stream = stream_create(device, 0, 2, clock/768, chip, ymf278b_pcm_update);
+ ymf278b_init(device, chip, intf->irq_callback);
+ chip->stream = stream_create(device, 0, 2, device->clock/768, chip, ymf278b_pcm_update);
// Volume table, 1 = -0.375dB, 8 = -3dB, 256 = -96dB
for(i = 0; i < 256; i++)
@@ -697,122 +712,30 @@ static SND_START( ymf278b )
}
-READ8_HANDLER( ymf278b_status_port_0_r )
-{
- return ymf278b_status_port_r(0);
-}
-
-READ8_HANDLER( ymf278b_data_port_0_r )
-{
- return ymf278b_data_port_r(0);
-}
-
-WRITE8_HANDLER( ymf278b_control_port_0_a_w )
-{
- ymf278b_control_port_A_w(0, data);
-}
-
-WRITE8_HANDLER( ymf278b_data_port_0_a_w )
-{
- ymf278b_data_port_A_w(space->machine, 0, data);
-}
-
-WRITE8_HANDLER( ymf278b_control_port_0_b_w )
-{
- ymf278b_control_port_B_w(0, data);
-}
-
-WRITE8_HANDLER( ymf278b_data_port_0_b_w )
-{
- ymf278b_data_port_B_w(0, data);
-}
-
-WRITE8_HANDLER( ymf278b_control_port_0_c_w )
-{
- ymf278b_control_port_C_w(0, data);
-}
-
-WRITE8_HANDLER( ymf278b_data_port_0_c_w )
-{
- ymf278b_data_port_C_w(0, data);
-}
-
-
-READ8_HANDLER( ymf278b_status_port_1_r )
-{
- return ymf278b_status_port_r(1);
-}
-
-READ8_HANDLER( ymf278b_data_port_1_r )
-{
- return ymf278b_data_port_r(1);
-}
-
-WRITE8_HANDLER( ymf278b_control_port_1_a_w )
-{
- ymf278b_control_port_A_w(1, data);
-}
-
-WRITE8_HANDLER( ymf278b_data_port_1_a_w )
-{
- ymf278b_data_port_A_w(space->machine, 1, data);
-}
-
-WRITE8_HANDLER( ymf278b_control_port_1_b_w )
-{
- ymf278b_control_port_B_w(1, data);
-}
-
-WRITE8_HANDLER( ymf278b_data_port_1_b_w )
-{
- ymf278b_data_port_B_w(1, data);
-}
-
-WRITE8_HANDLER( ymf278b_control_port_1_c_w )
-{
- ymf278b_control_port_C_w(1, data);
-}
-
-WRITE8_HANDLER( ymf278b_data_port_1_c_w )
-{
- ymf278b_data_port_C_w(1, data);
-}
-
-
/**************************************************************************
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( ymf278b )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( ymf278b )
+DEVICE_GET_INFO( ymf278b )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(YMF278BChip); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(YMF278BChip); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( ymf278b ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( ymf278b ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ymf278b ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "YMF278B"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Yamaha FM"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "YMF278B"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Yamaha FM"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/ymf278b.h b/src/emu/sound/ymf278b.h
index b5f91ca26f6..aa10c761c8a 100644
--- a/src/emu/sound/ymf278b.h
+++ b/src/emu/sound/ymf278b.h
@@ -9,28 +9,13 @@
typedef struct _ymf278b_interface ymf278b_interface;
struct _ymf278b_interface
{
- void (*irq_callback)(running_machine *machine, int state); /* irq callback */
+ void (*irq_callback)(const device_config *device, int state); /* irq callback */
};
-READ8_HANDLER( ymf278b_status_port_0_r );
-READ8_HANDLER( ymf278b_data_port_0_r );
-WRITE8_HANDLER( ymf278b_control_port_0_a_w );
-WRITE8_HANDLER( ymf278b_data_port_0_a_w );
-WRITE8_HANDLER( ymf278b_control_port_0_b_w );
-WRITE8_HANDLER( ymf278b_data_port_0_b_w );
-WRITE8_HANDLER( ymf278b_control_port_0_c_w );
-WRITE8_HANDLER( ymf278b_data_port_0_c_w );
+READ8_DEVICE_HANDLER( ymf278b_r );
+WRITE8_DEVICE_HANDLER( ymf278b_w );
-READ8_HANDLER( ymf278b_status_port_1_r );
-READ8_HANDLER( ymf278b_data_port_1_r );
-WRITE8_HANDLER( ymf278b_control_port_1_a_w );
-WRITE8_HANDLER( ymf278b_data_port_1_a_w );
-WRITE8_HANDLER( ymf278b_control_port_1_b_w );
-WRITE8_HANDLER( ymf278b_data_port_1_b_w );
-WRITE8_HANDLER( ymf278b_control_port_1_c_w );
-WRITE8_HANDLER( ymf278b_data_port_1_c_w );
-
-SND_GET_INFO( ymf278b );
-#define SOUND_YMF278B SND_GET_INFO_NAME( ymf278b )
+DEVICE_GET_INFO( ymf278b );
+#define SOUND_YMF278B DEVICE_GET_INFO_NAME( ymf278b )
#endif /* __YMF278B_H__ */
diff --git a/src/emu/sound/ymz280b.c b/src/emu/sound/ymz280b.c
index 4539b8d7e61..1d6e08581bc 100644
--- a/src/emu/sound/ymz280b.c
+++ b/src/emu/sound/ymz280b.c
@@ -77,7 +77,8 @@ struct YMZ280BVoice
UINT8 irq_schedule; /* 1 if the IRQ state is updated by timer */
};
-struct YMZ280BChip
+typedef struct _ymz280b_state ymz280b_state;
+struct _ymz280b_state
{
sound_stream * stream; /* which stream are we using */
UINT8 *region_base; /* pointer to the base of the region */
@@ -88,11 +89,11 @@ struct YMZ280BChip
UINT8 irq_enable; /* current IRQ enable */
UINT8 keyon_enable; /* key on enable */
double master_clock; /* master clock frequency */
- void (*irq_callback)(running_machine *, int); /* IRQ callback */
+ void (*irq_callback)(const device_config *, int); /* IRQ callback */
struct YMZ280BVoice voice[8]; /* the 8 voices */
UINT32 rom_readback_addr; /* where the CPU can read the ROM */
- read8_device_func ext_ram_read; /* external RAM read handler */
- write8_device_func ext_ram_write; /* external RAM write handler */
+ devcb_resolved_read8 ext_ram_read; /* external RAM read handler */
+ devcb_resolved_write8 ext_ram_write; /* external RAM write handler */
#if MAKE_WAVS
void * wavresample; /* resampled waveform */
@@ -131,8 +132,17 @@ static const timer_fired_func update_irq_state_cb[] =
};
+INLINE ymz280b_state *get_safe_token(const device_config *device)
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == SOUND);
+ assert(sound_get_type(device) == SOUND_YMZ280B);
+ return (ymz280b_state *)device->token;
+}
-INLINE void update_irq_state(struct YMZ280BChip *chip)
+
+INLINE void update_irq_state(ymz280b_state *chip)
{
int irq_bits = chip->status_register & chip->irq_mask;
@@ -145,20 +155,20 @@ INLINE void update_irq_state(struct YMZ280BChip *chip)
{
chip->irq_state = 1;
if (chip->irq_callback)
- (*chip->irq_callback)(chip->device->machine, 1);
+ (*chip->irq_callback)(chip->device, 1);
else logerror("YMZ280B: IRQ generated, but no callback specified!");
}
else if (!irq_bits && chip->irq_state)
{
chip->irq_state = 0;
if (chip->irq_callback)
- (*chip->irq_callback)(chip->device->machine, 0);
+ (*chip->irq_callback)(chip->device, 0);
else logerror("YMZ280B: IRQ generated, but no callback specified!");
}
}
-INLINE void update_step(struct YMZ280BChip *chip, struct YMZ280BVoice *voice)
+INLINE void update_step(ymz280b_state *chip, struct YMZ280BVoice *voice)
{
double frequency;
@@ -193,7 +203,7 @@ INLINE void update_volumes(struct YMZ280BVoice *voice)
static STATE_POSTLOAD( YMZ280B_state_save_update_step )
{
- struct YMZ280BChip *chip = param;
+ ymz280b_state *chip = param;
int j;
for (j = 0; j < 8; j++)
{
@@ -207,7 +217,7 @@ static STATE_POSTLOAD( YMZ280B_state_save_update_step )
static void update_irq_state_timer_common(void *param, int voicenum)
{
- struct YMZ280BChip *chip = param;
+ ymz280b_state *chip = param;
struct YMZ280BVoice *voice = &chip->voice[voicenum];
if(!voice->irq_schedule) return;
@@ -490,7 +500,7 @@ static int generate_pcm16(struct YMZ280BVoice *voice, UINT8 *base, INT16 *buffer
static STREAM_UPDATE( ymz280b_update )
{
- struct YMZ280BChip *chip = param;
+ ymz280b_state *chip = param;
stream_sample_t *lacc = outputs[0];
stream_sample_t *racc = outputs[1];
int v;
@@ -623,25 +633,25 @@ static STREAM_UPDATE( ymz280b_update )
/**********************************************************************************************
- SND_START( ymz280b ) -- start emulation of the YMZ280B
+ DEVICE_START( ymz280b ) -- start emulation of the YMZ280B
***********************************************************************************************/
-static SND_START( ymz280b )
+static DEVICE_START( ymz280b )
{
static const ymz280b_interface defintrf = { 0 };
const ymz280b_interface *intf = (device->static_config != NULL) ? device->static_config : &defintrf;
- struct YMZ280BChip *chip = device->token;
+ ymz280b_state *chip = get_safe_token(device);
chip->device = device;
- chip->ext_ram_read = intf->ext_read;
- chip->ext_ram_write = intf->ext_write;
+ devcb_resolve_read8(&chip->ext_ram_read, &intf->ext_read, device);
+ devcb_resolve_write8(&chip->ext_ram_write, &intf->ext_write, device);
/* compute ADPCM tables */
compute_tables();
/* initialize the rest of the structure */
- chip->master_clock = (double)clock / 384.0;
+ chip->master_clock = (double)device->clock / 384.0;
chip->region_base = device->region;
chip->irq_callback = intf->irq_callback;
@@ -700,36 +710,11 @@ static SND_START( ymz280b )
/**********************************************************************************************
- SND_STOP( YMZ280B_sh ) -- stop emulation of the YMZ280B
-
-***********************************************************************************************/
-
-#ifdef UNUSED_FUNCTION
-SND_STOP( YMZ280B_sh )
-{
-#if MAKE_WAVS
-{
- int i;
-
- for (i = 0; i < MAX_BSMT2000; i++)
- {
- if (ymz280b[i].wavresample)
- wav_close(ymz280b[i].wavresample);
- }
-}
-#endif
-}
-#endif
-
-
-
-/**********************************************************************************************
-
write_to_register -- handle a write to the current register
***********************************************************************************************/
-static void write_to_register(struct YMZ280BChip *chip, int data)
+static void write_to_register(ymz280b_state *chip, int data)
{
struct YMZ280BVoice *voice;
int i;
@@ -860,10 +845,8 @@ static void write_to_register(struct YMZ280BChip *chip, int data)
break;
case 0x87: /* RAM write */
- if (chip->ext_ram_write)
- {
- chip->ext_ram_write(chip->device, chip->rom_readback_addr, data);
- }
+ if (chip->ext_ram_write.write)
+ devcb_call_write8(&chip->ext_ram_write, chip->rom_readback_addr, data);
else
logerror("YMZ280B attempted RAM write to %X\n", chip->rom_readback_addr);
break;
@@ -913,7 +896,7 @@ static void write_to_register(struct YMZ280BChip *chip, int data)
***********************************************************************************************/
-static int compute_status(struct YMZ280BChip *chip)
+static int compute_status(ymz280b_state *chip)
{
UINT8 result;
@@ -943,185 +926,51 @@ static int compute_status(struct YMZ280BChip *chip)
***********************************************************************************************/
-READ8_HANDLER( ymz280b_status_0_r )
-{
- struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 0);
- return compute_status(chip);
-}
-
-READ8_HANDLER( ymz280b_status_1_r )
-{
- struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 1);
- return compute_status(chip);
-}
-
-READ16_HANDLER( ymz280b_status_0_lsb_r )
-{
- struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 0);
- return compute_status(chip);
-}
-
-READ16_HANDLER( ymz280b_status_0_msb_r )
-{
- struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 0);
- return compute_status(chip) << 8;
-}
-
-READ16_HANDLER( ymz280b_status_1_lsb_r )
-{
- struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 1);
- return compute_status(chip);
-}
-
-READ16_HANDLER( ymz280b_status_1_msb_r )
-{
- struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 1);
- return compute_status(chip) << 8;
-}
-
-/**********************************************************************************************
-
- ymz280b_register_0_w/ymz280b_register_1_w -- handle a write to the register select
-
-***********************************************************************************************/
-
-WRITE8_HANDLER( ymz280b_register_0_w )
-{
- struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 0);
- chip->current_register = data;
-}
-
-WRITE8_HANDLER( ymz280b_register_1_w )
-{
- struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 1);
- chip->current_register = data;
-}
-
-WRITE16_HANDLER( ymz280b_register_0_lsb_w )
-{
- struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 0);
- if (ACCESSING_BITS_0_7) chip->current_register = data & 0xff;
-}
-
-WRITE16_HANDLER( ymz280b_register_0_msb_w )
-{
- struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 0);
- if (ACCESSING_BITS_8_15) chip->current_register = (data >> 8) & 0xff;
-}
-
-WRITE16_HANDLER( ymz280b_register_1_lsb_w )
-{
- struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 1);
- if (ACCESSING_BITS_0_7) chip->current_register = data & 0xff;
-}
-
-WRITE16_HANDLER( ymz280b_register_1_msb_w )
-{
- struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 1);
- if (ACCESSING_BITS_8_15) chip->current_register = (data >> 8) & 0xff;
-}
-
-/**********************************************************************************************
-
- ymz280b_data_0_w/ymz280b_data_1_w -- handle a write to the current register
-
-***********************************************************************************************/
-
-WRITE8_HANDLER( ymz280b_data_0_w )
-{
- struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 0);
- write_to_register(chip, data);
-}
-
-WRITE8_HANDLER( ymz280b_data_1_w )
-{
- struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 1);
- write_to_register(chip, data);
-}
-
-WRITE16_HANDLER( ymz280b_data_0_lsb_w )
+READ8_DEVICE_HANDLER( ymz280b_r )
{
- struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 0);
- if (ACCESSING_BITS_0_7) write_to_register(chip, data & 0xff);
-}
+ ymz280b_state *chip = get_safe_token(device);
-WRITE16_HANDLER( ymz280b_data_0_msb_w )
-{
- struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 0);
- if (ACCESSING_BITS_8_15) write_to_register(chip, (data >> 8) & 0xff);
+ if ((offset & 1) == 0)
+ return devcb_call_read8(&chip->ext_ram_read, chip->rom_readback_addr++ - 1);
+ else
+ return compute_status(chip);
}
-WRITE16_HANDLER( ymz280b_data_1_lsb_w )
-{
- struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 1);
- if (ACCESSING_BITS_0_7) write_to_register(chip, data & 0xff);
-}
-WRITE16_HANDLER( ymz280b_data_1_msb_w )
+WRITE8_DEVICE_HANDLER( ymz280b_w )
{
- struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 1);
- if (ACCESSING_BITS_8_15) write_to_register(chip, (data >> 8) & 0xff);
-}
+ ymz280b_state *chip = get_safe_token(device);
-/**********************************************************************************************
-
- ymz280b_data_0_r/ymz280b_data_1_r -- handle an external RAM read
-
-***********************************************************************************************/
-
-READ8_HANDLER( ymz280b_data_0_r )
-{
- UINT8 data;
- struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 0);
- data = chip->ext_ram_read(chip->device, chip->rom_readback_addr - 1);
- chip->rom_readback_addr++;
- return data;
-}
-
-READ8_HANDLER( ymz280b_data_1_r )
-{
- UINT8 data;
- struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 1);
- data = chip->ext_ram_read(chip->device, chip->rom_readback_addr - 1);
- chip->rom_readback_addr++;
- return data;
+ if ((offset & 1) == 0)
+ chip->current_register = data;
+ else
+ write_to_register(chip, data);
}
-
/**************************************************************************
* Generic get_info
**************************************************************************/
-static SND_SET_INFO( ymz280b )
-{
- switch (state)
- {
- /* no parameters to set */
- }
-}
-
-
-SND_GET_INFO( ymz280b )
+DEVICE_GET_INFO( ymz280b )
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case SNDINFO_INT_TOKEN_BYTES: info->i = sizeof(struct YMZ280BChip); break;
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(ymz280b_state); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case SNDINFO_PTR_SET_INFO: info->set_info = SND_SET_INFO_NAME( ymz280b ); break;
- case SNDINFO_PTR_START: info->start = SND_START_NAME( ymz280b ); break;
- case SNDINFO_PTR_STOP: /* Nothing */ break;
- case SNDINFO_PTR_RESET: /* Nothing */ break;
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ymz280b ); break;
+ case DEVINFO_FCT_STOP: /* Nothing */ break;
+ case DEVINFO_FCT_RESET: /* Nothing */ break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case SNDINFO_STR_NAME: strcpy(info->s, "YMZ280B"); break;
- case SNDINFO_STR_CORE_FAMILY: strcpy(info->s, "Yamaha Wavetable"); break;
- case SNDINFO_STR_CORE_VERSION: strcpy(info->s, "1.0"); break;
- case SNDINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
- case SNDINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
+ case DEVINFO_STR_NAME: strcpy(info->s, "YMZ280B"); break;
+ case DEVINFO_STR_FAMILY: strcpy(info->s, "Yamaha Wavetable"); break;
+ case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
}
}
diff --git a/src/emu/sound/ymz280b.h b/src/emu/sound/ymz280b.h
index 050c04eb891..f61622b95fc 100644
--- a/src/emu/sound/ymz280b.h
+++ b/src/emu/sound/ymz280b.h
@@ -10,40 +10,20 @@
#ifndef __YMZ280B_H__
#define __YMZ280B_H__
+#include "devcb.h"
typedef struct _ymz280b_interface ymz280b_interface;
struct _ymz280b_interface
{
- void (*irq_callback)(running_machine *machine, int state); /* irq callback */
- read8_device_func ext_read; /* external RAM read */
- write8_device_func ext_write; /* external RAM write */
+ void (*irq_callback)(const device_config *device, int state); /* irq callback */
+ devcb_read8 ext_read; /* external RAM read */
+ devcb_write8 ext_write; /* external RAM write */
};
-READ8_HANDLER ( ymz280b_status_0_r );
-WRITE8_HANDLER( ymz280b_register_0_w );
-READ8_HANDLER( ymz280b_data_0_r );
-WRITE8_HANDLER( ymz280b_data_0_w );
+READ8_DEVICE_HANDLER ( ymz280b_r );
+WRITE8_DEVICE_HANDLER( ymz280b_w );
-READ16_HANDLER ( ymz280b_status_0_lsb_r );
-READ16_HANDLER ( ymz280b_status_0_msb_r );
-WRITE16_HANDLER( ymz280b_register_0_lsb_w );
-WRITE16_HANDLER( ymz280b_register_0_msb_w );
-WRITE16_HANDLER( ymz280b_data_0_lsb_w );
-WRITE16_HANDLER( ymz280b_data_0_msb_w );
-
-READ8_HANDLER ( ymz280b_status_1_r );
-WRITE8_HANDLER( ymz280b_register_1_w );
-READ8_HANDLER( ymz280b_data_1_r );
-WRITE8_HANDLER( ymz280b_data_1_w );
-
-READ16_HANDLER ( ymz280b_status_1_lsb_r );
-READ16_HANDLER ( ymz280b_status_1_msb_r );
-WRITE16_HANDLER( ymz280b_register_1_lsb_w );
-WRITE16_HANDLER( ymz280b_register_1_msb_w );
-WRITE16_HANDLER( ymz280b_data_1_lsb_w );
-WRITE16_HANDLER( ymz280b_data_1_msb_w );
-
-SND_GET_INFO( ymz280b );
-#define SOUND_YMZ280B SND_GET_INFO_NAME( ymz280b )
+DEVICE_GET_INFO( ymz280b );
+#define SOUND_YMZ280B DEVICE_GET_INFO_NAME( ymz280b )
#endif /* __YMZ280B_H__ */
diff --git a/src/emu/streams.c b/src/emu/streams.c
index 2b33c5fa109..31d4f01f0e8 100644
--- a/src/emu/streams.c
+++ b/src/emu/streams.c
@@ -114,7 +114,6 @@ struct _sound_stream
/* linking information */
const device_config * device; /* owning device */
sound_stream * next; /* next stream in the chain */
- void * tag; /* tag (used for identification) */
int index; /* index for save states */
/* general information */
@@ -154,7 +153,6 @@ struct _streams_private
{
sound_stream * stream_head; /* pointer to first stream */
sound_stream ** stream_tailptr; /* pointer to pointer to last stream */
- void * current_tag; /* current tag to assign to new streams */
int stream_index; /* index of the current stream */
attoseconds_t update_attoseconds; /* attoseconds between global updates */
attotime last_update; /* last update time */
@@ -215,7 +213,7 @@ INLINE INT32 time_to_sampindex(const streams_private *strdata, const sound_strea
streams_init - initialize the streams engine
-------------------------------------------------*/
-void streams_init(running_machine *machine, attoseconds_t update_attoseconds)
+void streams_init(running_machine *machine)
{
streams_private *strdata;
@@ -225,7 +223,7 @@ void streams_init(running_machine *machine, attoseconds_t update_attoseconds)
/* reset globals */
strdata->stream_tailptr = &strdata->stream_head;
- strdata->update_attoseconds = update_attoseconds;
+ strdata->update_attoseconds = STREAMS_UPDATE_FREQUENCY.attoseconds;
/* set the global pointer */
machine->streams_data = strdata;
@@ -237,18 +235,6 @@ void streams_init(running_machine *machine, attoseconds_t update_attoseconds)
/*-------------------------------------------------
- streams_set_tag - set the tag to be associated
- with all streams allocated from now on
--------------------------------------------------*/
-
-void streams_set_tag(running_machine *machine, void *streamtag)
-{
- streams_private *strdata = machine->streams_data;
- strdata->current_tag = streamtag;
-}
-
-
-/*-------------------------------------------------
streams_update - update all the streams
periodically
-------------------------------------------------*/
@@ -364,7 +350,6 @@ sound_stream *stream_create(const device_config *device, int inputs, int outputs
/* fill in the data */
stream->device = device;
- stream->tag = strdata->current_tag;
stream->index = strdata->stream_index++;
stream->sample_rate = sample_rate;
stream->inputs = inputs;
@@ -427,6 +412,60 @@ sound_stream *stream_create(const device_config *device, int inputs, int outputs
/*-------------------------------------------------
+ stream_device_output_to_stream_output -
+ convert a device/output pair to a stream/
+ output pair
+-------------------------------------------------*/
+
+int stream_device_output_to_stream_output(const device_config *device, int outputnum, sound_stream **streamptr, int *streamoutputptr)
+{
+ streams_private *strdata = device->machine->streams_data;
+ sound_stream *stream;
+
+ /* scan the list looking for the nth stream that matches the tag */
+ for (stream = strdata->stream_head; stream != NULL; stream = stream->next)
+ if (stream->device == device)
+ {
+ if (outputnum < stream->outputs)
+ {
+ *streamptr = stream;
+ *streamoutputptr = outputnum;
+ return TRUE;
+ }
+ outputnum -= stream->outputs;
+ }
+ return FALSE;
+}
+
+
+/*-------------------------------------------------
+ stream_device_input_to_stream_input -
+ convert a device/input pair to a stream/
+ input pair
+-------------------------------------------------*/
+
+int stream_device_input_to_stream_input(const device_config *device, int inputnum, sound_stream **streamptr, int *streaminputptr)
+{
+ streams_private *strdata = device->machine->streams_data;
+ sound_stream *stream;
+
+ /* scan the list looking for the nth stream that matches the tag */
+ for (stream = strdata->stream_head; stream != NULL; stream = stream->next)
+ if (stream->device == device)
+ {
+ if (inputnum < stream->inputs)
+ {
+ *streamptr = stream;
+ *streaminputptr = inputnum;
+ return TRUE;
+ }
+ inputnum -= stream->inputs;
+ }
+ return FALSE;
+}
+
+
+/*-------------------------------------------------
stream_set_input - configure a stream's input
-------------------------------------------------*/
@@ -565,18 +604,37 @@ attotime stream_get_sample_period(sound_stream *stream)
***************************************************************************/
/*-------------------------------------------------
- stream_find_by_tag - find a stream using a
- tag and index
+ stream_get_device_outputs - return the total
+ number of outputs for the given device
-------------------------------------------------*/
-sound_stream *stream_find_by_tag(running_machine *machine, void *streamtag, int streamindex)
+int stream_get_device_outputs(const device_config *device)
{
- streams_private *strdata = machine->streams_data;
+ streams_private *strdata = device->machine->streams_data;
sound_stream *stream;
+ int outputs = 0;
/* scan the list looking for the nth stream that matches the tag */
- for (stream = strdata->stream_head; stream; stream = stream->next)
- if (stream->tag == streamtag && streamindex-- == 0)
+ for (stream = strdata->stream_head; stream != NULL; stream = stream->next)
+ if (stream->device == device)
+ outputs += stream->outputs;
+ return outputs;
+}
+
+
+/*-------------------------------------------------
+ stream_find_by_device - find a stream using a
+ device and index
+-------------------------------------------------*/
+
+sound_stream *stream_find_by_device(const device_config *device, int streamindex)
+{
+ streams_private *strdata = device->machine->streams_data;
+ sound_stream *stream;
+
+ /* scan the list looking for the nth stream that matches the tag */
+ for (stream = strdata->stream_head; stream != NULL; stream = stream->next)
+ if (stream->device == device && streamindex-- == 0)
return stream;
return NULL;
}
diff --git a/src/emu/streams.h b/src/emu/streams.h
index d79858768c6..0407b2974c5 100644
--- a/src/emu/streams.h
+++ b/src/emu/streams.h
@@ -16,6 +16,14 @@
/***************************************************************************
+ CONSTANTS
+***************************************************************************/
+
+#define STREAMS_UPDATE_FREQUENCY ATTOTIME_IN_HZ(50)
+
+
+
+/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
@@ -35,10 +43,7 @@ typedef void (*stream_update_func)(const device_config *device, void *param, str
/* ----- system-level management ----- */
/* initialize the streams engine */
-void streams_init(running_machine *machine, attoseconds_t update_subseconds);
-
-/* set the tag to be associated with all streams allocated from now on */
-void streams_set_tag(running_machine *machine, void *streamtag);
+void streams_init(running_machine *machine);
/* update all the streams periodically */
void streams_update(running_machine *machine);
@@ -50,6 +55,12 @@ void streams_update(running_machine *machine);
/* create a new stream */
sound_stream *stream_create(const device_config *device, int inputs, int outputs, int sample_rate, void *param, stream_update_func callback);
+/* convert a device/output pair to a stream/output pair */
+int stream_device_output_to_stream_output(const device_config *device, int outputnum, sound_stream **streamptr, int *streamoutputptr);
+
+/* convert a device/input pair to a stream/input pair */
+int stream_device_input_to_stream_input(const device_config *device, int inputnum, sound_stream **streamptr, int *streaminputptr);
+
/* configure a stream's input */
void stream_set_input(sound_stream *stream, int index, sound_stream *input_stream, int output_index, float gain);
@@ -79,8 +90,11 @@ attotime stream_get_sample_period(sound_stream *stream);
/* ----- stream information and control ----- */
-/* find a stream using a tag and index */
-sound_stream *stream_find_by_tag(running_machine *machine, void *streamtag, int streamindex);
+/* return the total number of outputs for the given device */
+int stream_get_device_outputs(const device_config *device);
+
+/* find a stream using a device and index */
+sound_stream *stream_find_by_device(const device_config *device, int streamindex);
/* return the number of inputs for a given stream */
int stream_get_inputs(sound_stream *stream);
diff --git a/src/emu/ui.c b/src/emu/ui.c
index 9b201a3856c..5b283501013 100644
--- a/src/emu/ui.c
+++ b/src/emu/ui.c
@@ -986,7 +986,7 @@ astring *game_info_astring(running_machine *machine, astring *string)
int scrcount = video_screen_count(machine->config);
const device_config *scandevice;
const device_config *device;
- int sndnum;
+ int found_sound = FALSE;
int count;
/* print description, manufacturer, and CPU: */
@@ -1017,31 +1017,32 @@ astring *game_info_astring(running_machine *machine, astring *string)
}
/* loop over all sound chips */
- for (sndnum = 0; sndnum < MAX_SOUND && machine->config->sound[sndnum].type != SOUND_DUMMY; sndnum += count)
+ for (device = sound_first(machine->config); device != NULL; device = scandevice)
{
- sound_type type = machine->config->sound[sndnum].type;
- int clock = machine->config->sound[sndnum].clock;
-
/* append the Sound: string */
- if (sndnum == 0)
+ if (!found_sound)
astring_catc(string, "\nSound:\n");
+ found_sound = TRUE;
/* count how many identical sound chips we have */
- for (count = 1; sndnum + count < MAX_SOUND; count++)
- if (machine->config->sound[sndnum + count].type != type ||
- machine->config->sound[sndnum + count].clock != clock)
- break;
+ count = 1;
+ for (scandevice = device->typenext; scandevice != NULL; scandevice = scandevice->typenext)
+ {
+ if (sound_get_type(device) != sound_get_type(scandevice) || device->clock != scandevice->clock)
+ break;
+ count++;
+ }
- /* if more than one, prepend a #x in front of the SND name */
+ /* if more than one, prepend a #x in front of the CPU name */
if (count > 1)
astring_catprintf(string, "%d" UTF8_MULTIPLY, count);
- astring_catc(string, sndtype_get_name(type));
+ astring_catc(string, device_get_name(device));
/* display clock in kHz or MHz */
- if (clock >= 1000000)
- astring_catprintf(string, " %d.%06d" UTF8_NBSP "MHz\n", clock / 1000000, clock % 1000000);
- else if (clock != 0)
- astring_catprintf(string, " %d.%03d" UTF8_NBSP "kHz\n", clock / 1000, clock % 1000);
+ if (device->clock >= 1000000)
+ astring_catprintf(string, " %d.%06d" UTF8_NBSP "MHz\n", device->clock / 1000000, device->clock % 1000000);
+ else if (device->clock != 0)
+ astring_catprintf(string, " %d.%03d" UTF8_NBSP "kHz\n", device->clock / 1000, device->clock % 1000);
else
astring_catc(string, "\n");
}
diff --git a/src/emu/validity.c b/src/emu/validity.c
index c93e4fe1b7a..1302f0f72bb 100644
--- a/src/emu/validity.c
+++ b/src/emu/validity.c
@@ -502,7 +502,7 @@ static int validate_driver(int drivnum, const machine_config *config)
#ifndef MESS
/* make sure sound-less drivers are flagged */
- if ((driver->flags & GAME_IS_BIOS_ROOT) == 0 && config->sound[0].type == SOUND_DUMMY && (driver->flags & GAME_NO_SOUND) == 0 && strcmp(driver->name, "minivadr"))
+ if ((driver->flags & GAME_IS_BIOS_ROOT) == 0 && sound_first(config) == NULL && (driver->flags & GAME_NO_SOUND) == 0 && strcmp(driver->name, "minivadr"))
{
mame_printf_error("%s: %s missing GAME_NO_SOUND flag\n", driver->source_file, driver->name);
error = TRUE;
@@ -600,7 +600,7 @@ static int validate_roms(int drivnum, const machine_config *config, region_info
/* load by name entries must be 8 characters or less */
else if (ROMREGION_ISLOADBYNAME(romp) && strlen(regiontag) > 8)
{
- mame_printf_error("%s: %s has load-by-name region \"%s\" with name >8 characters\n", driver->source_file, driver->name, regiontag);
+ mame_printf_error("%s: %s has load-by-name region '%s' with name >8 characters\n", driver->source_file, driver->name, regiontag);
error = TRUE;
}
@@ -625,7 +625,7 @@ static int validate_roms(int drivnum, const machine_config *config, region_info
/* fail if we hit a duplicate */
if (astring_cmp(fulltag, rgninfo->entries[rgnnum].tag) == 0)
{
- mame_printf_error("%s: %s has duplicate ROM_REGION tag \"%s\"\n", driver->source_file, driver->name, astring_c(fulltag));
+ mame_printf_error("%s: %s has duplicate ROM_REGION tag '%s'\n", driver->source_file, driver->name, astring_c(fulltag));
error = TRUE;
astring_free(fulltag);
break;
@@ -821,7 +821,7 @@ static int validate_cpu(int drivnum, const machine_config *config, const input_p
/* stop if we hit an empty */
if (rgninfo->entries[rgnnum].tag == NULL)
{
- mame_printf_error("%s: %s CPU '%s' %s space memory map entry %X-%X references non-existant region \"%s\"\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], entry->addrstart, entry->addrend, entry->region);
+ mame_printf_error("%s: %s CPU '%s' %s space memory map entry %X-%X references non-existant region '%s'\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], entry->addrstart, entry->addrend, entry->region);
error = TRUE;
break;
}
@@ -832,7 +832,7 @@ static int validate_cpu(int drivnum, const machine_config *config, const input_p
offs_t length = rgninfo->entries[rgnnum].length;
if (entry->rgnoffs + (byteend - bytestart + 1) > length)
{
- mame_printf_error("%s: %s CPU '%s' %s space memory map entry %X-%X extends beyond region \"%s\" size (%X)\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], entry->addrstart, entry->addrend, entry->region, length);
+ mame_printf_error("%s: %s CPU '%s' %s space memory map entry %X-%X extends beyond region '%s' size (%X)\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], entry->addrstart, entry->addrend, entry->region, length);
error = TRUE;
}
break;
@@ -843,19 +843,19 @@ static int validate_cpu(int drivnum, const machine_config *config, const input_p
/* make sure all devices exist */
if (entry->read_devtype != NULL && device_list_find_by_tag(config->devicelist, entry->read_devtype, entry->read_devtag) == NULL)
{
- mame_printf_error("%s: %s CPU '%s' %s space memory map entry references nonexistant device type %s, tag %s\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], devtype_get_name(entry->read_devtype), entry->read_devtag);
+ mame_printf_error("%s: %s CPU '%s' %s space memory map entry references nonexistant device %s '%s'\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], devtype_get_name(entry->read_devtype), entry->read_devtag);
error = TRUE;
}
if (entry->write_devtype != NULL && device_list_find_by_tag(config->devicelist, entry->write_devtype, entry->write_devtag) == NULL)
{
- mame_printf_error("%s: %s CPU '%s' %s space memory map entry references nonexistant device type %s, tag %s\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], devtype_get_name(entry->write_devtype), entry->write_devtag);
+ mame_printf_error("%s: %s CPU '%s' %s space memory map entry references nonexistant device %s '%s'\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], devtype_get_name(entry->write_devtype), entry->write_devtag);
error = TRUE;
}
/* make sure ports exist */
if (entry->read_porttag != NULL && input_port_by_tag(portlist, entry->read_porttag) == NULL)
{
- mame_printf_error("%s: %s CPU '%s' %s space memory map entry references nonexistant port tag %s\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], entry->read_porttag);
+ mame_printf_error("%s: %s CPU '%s' %s space memory map entry references nonexistant port tag '%s'\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], entry->read_porttag);
error = TRUE;
}
}
@@ -930,7 +930,7 @@ static int validate_display(int drivnum, const machine_config *config)
/* sanity check dimensions */
if ((scrconfig->width <= 0) || (scrconfig->height <= 0))
{
- mame_printf_error("%s: %s screen \"%s\" has invalid display dimensions\n", driver->source_file, driver->name, device->tag);
+ mame_printf_error("%s: %s screen '%s' has invalid display dimensions\n", driver->source_file, driver->name, device->tag);
error = TRUE;
}
@@ -942,7 +942,7 @@ static int validate_display(int drivnum, const machine_config *config)
(scrconfig->visarea.max_x >= scrconfig->width) ||
(scrconfig->visarea.max_y >= scrconfig->height))
{
- mame_printf_error("%s: %s screen \"%s\" has an invalid display area\n", driver->source_file, driver->name, device->tag);
+ mame_printf_error("%s: %s screen '%s' has an invalid display area\n", driver->source_file, driver->name, device->tag);
error = TRUE;
}
@@ -951,7 +951,7 @@ static int validate_display(int drivnum, const machine_config *config)
scrconfig->format != BITMAP_FORMAT_RGB15 &&
scrconfig->format != BITMAP_FORMAT_RGB32)
{
- mame_printf_error("%s: %s screen \"%s\" has unsupported format\n", driver->source_file, driver->name, device->tag);
+ mame_printf_error("%s: %s screen '%s' has unsupported format\n", driver->source_file, driver->name, device->tag);
error = TRUE;
}
if (scrconfig->format == BITMAP_FORMAT_INDEXED16)
@@ -961,7 +961,7 @@ static int validate_display(int drivnum, const machine_config *config)
/* check for zero frame rate */
if (scrconfig->refresh == 0)
{
- mame_printf_error("%s: %s screen \"%s\" has a zero refresh rate\n", driver->source_file, driver->name, device->tag);
+ mame_printf_error("%s: %s screen '%s' has a zero refresh rate\n", driver->source_file, driver->name, device->tag);
error = TRUE;
}
}
@@ -1017,7 +1017,7 @@ static int validate_gfx(int drivnum, const machine_config *config, region_info *
/* stop if we hit an empty */
if (rgninfo->entries[rgnnum].tag == NULL)
{
- mame_printf_error("%s: %s has gfx[%d] referencing non-existent region \"%s\"\n", driver->source_file, driver->name, gfxnum, region);
+ mame_printf_error("%s: %s has gfx[%d] referencing non-existent region '%s'\n", driver->source_file, driver->name, gfxnum, region);
error = TRUE;
break;
}
@@ -1048,7 +1048,7 @@ static int validate_gfx(int drivnum, const machine_config *config, region_info *
/* if not, this is an error */
if ((start + len) / 8 > avail)
{
- mame_printf_error("%s: %s has gfx[%d] extending past allocated memory of region \"%s\"\n", driver->source_file, driver->name, gfxnum, region);
+ mame_printf_error("%s: %s has gfx[%d] extending past allocated memory of region '%s'\n", driver->source_file, driver->name, gfxnum, region);
error = TRUE;
}
}
@@ -1355,7 +1355,7 @@ static int validate_inputs(int drivnum, const machine_config *config, const inpu
for (scanport = port->next; scanport != NULL; scanport = scanport->next)
if (scanport->tag != NULL && strcmp(port->tag, scanport->tag) == 0)
{
- mame_printf_error("%s: %s has a duplicate input port tag \"%s\"\n", driver->source_file, driver->name, port->tag);
+ mame_printf_error("%s: %s has a duplicate input port tag '%s'\n", driver->source_file, driver->name, port->tag);
error = TRUE;
}
@@ -1430,7 +1430,7 @@ static int validate_inputs(int drivnum, const machine_config *config, const inpu
/* if none, error */
if (scanport == NULL)
{
- mame_printf_error("%s: %s has a condition referencing non-existent input port tag \"%s\"\n", driver->source_file, driver->name, field->condition.tag);
+ mame_printf_error("%s: %s has a condition referencing non-existent input port tag '%s'\n", driver->source_file, driver->name, field->condition.tag);
error = TRUE;
}
}
@@ -1447,7 +1447,7 @@ static int validate_inputs(int drivnum, const machine_config *config, const inpu
/* if none, error */
if (scanport == NULL)
{
- mame_printf_error("%s: %s has a condition referencing non-existent input port tag \"%s\"\n", driver->source_file, driver->name, setting->condition.tag);
+ mame_printf_error("%s: %s has a condition referencing non-existent input port tag '%s'\n", driver->source_file, driver->name, setting->condition.tag);
error = TRUE;
}
}
@@ -1470,16 +1470,13 @@ static int validate_inputs(int drivnum, const machine_config *config, const inpu
static int validate_sound(int drivnum, const machine_config *config)
{
+ const device_config *curspeak, *checkspeak, *cursound, *checksound;
const game_driver *driver = drivers[drivnum];
- const device_config *curspeak, *checkspeak;
int error = FALSE;
- int sndnum;
/* make sure the speaker layout makes sense */
for (curspeak = speaker_output_first(config); curspeak != NULL; curspeak = speaker_output_next(curspeak))
{
- int check;
-
/* check for duplicate tags */
for (checkspeak = speaker_output_first(config); checkspeak != NULL; checkspeak = speaker_output_next(checkspeak))
if (checkspeak != curspeak && strcmp(checkspeak->tag, curspeak->tag) == 0)
@@ -1489,8 +1486,8 @@ static int validate_sound(int drivnum, const machine_config *config)
}
/* make sure there are no sound chips with the same tag */
- for (check = 0; check < MAX_SOUND && config->sound[check].type != SOUND_DUMMY; check++)
- if (config->sound[check].tag && strcmp(curspeak->tag, config->sound[check].tag) == 0)
+ for (checksound = sound_first(config); checksound != NULL; checksound = sound_next(checksound))
+ if (strcmp(curspeak->tag, checksound->tag) == 0)
{
mame_printf_error("%s: %s has both a speaker and a sound chip tagged as '%s'\n", driver->source_file, driver->name, curspeak->tag);
error = TRUE;
@@ -1498,44 +1495,35 @@ static int validate_sound(int drivnum, const machine_config *config)
}
/* make sure the sounds are wired to the speakers correctly */
- for (sndnum = 0; sndnum < MAX_SOUND && config->sound[sndnum].type != SOUND_DUMMY; sndnum++)
+ for (cursound = sound_first(config); cursound != NULL; cursound = sound_next(cursound))
{
- int routenum, checknum;
-
- /* check for duplicate tags */
- if (config->sound[sndnum].tag != NULL)
- for (checknum = 0; checknum < sndnum; checknum++)
- if (config->sound[checknum].tag != NULL && strcmp(config->sound[sndnum].tag, config->sound[checknum].tag) == 0)
- {
- mame_printf_error("%s: %s has multiple sound chips tagged as '%s'\n", driver->source_file, driver->name, config->sound[sndnum].tag);
- error = TRUE;
- }
-
- /* validate the sound tag */
- error |= validate_tag(driver, "sound", config->sound[sndnum].tag);
+ const sound_config *curconfig = cursound->inline_config;
+ int routenum;
/* loop over all the routes */
- for (routenum = 0; routenum < config->sound[sndnum].routes; routenum++)
+ for (routenum = 0; routenum <= ALL_OUTPUTS; routenum++)
{
- /* find a speaker with the requested tag */
- for (checkspeak = speaker_output_first(config); checkspeak != NULL; checkspeak = speaker_output_next(checkspeak))
- if (strcmp(config->sound[sndnum].route[routenum].target, checkspeak->tag) == 0)
- break;
-
- /* if we didn't find one, look for another sound chip with the tag */
- if (checkspeak == NULL)
+ const sound_route *mroute = &curconfig->route[routenum];
+ if (mroute->target != NULL)
{
- int check;
-
- for (check = 0; check < MAX_SOUND && config->sound[check].type != SOUND_DUMMY; check++)
- if (check != sndnum && config->sound[check].tag && strcmp(config->sound[check].tag, config->sound[sndnum].route[routenum].target) == 0)
+ /* find a speaker with the requested tag */
+ for (checkspeak = speaker_output_first(config); checkspeak != NULL; checkspeak = speaker_output_next(checkspeak))
+ if (strcmp(mroute->target, checkspeak->tag) == 0)
break;
- /* if we didn't find one, it's an error */
- if (check >= MAX_SOUND || config->sound[check].type == SOUND_DUMMY)
+ /* if we didn't find one, look for another sound chip with the tag */
+ if (checkspeak == NULL)
{
- mame_printf_error("%s: %s attempting to route sound to non-existant speaker '%s'\n", driver->source_file, driver->name, config->sound[sndnum].route[routenum].target);
- error = TRUE;
+ for (checksound = sound_first(config); checksound != NULL; checksound = sound_next(checksound))
+ if (checksound != cursound && strcmp(mroute->target, checksound->tag) == 0)
+ break;
+
+ /* if we didn't find one, it's an error */
+ if (checksound == NULL)
+ {
+ mame_printf_error("%s: %s attempting to route sound to non-existant speaker '%s'\n", driver->source_file, driver->name, mroute->target);
+ error = TRUE;
+ }
}
}
}
@@ -1625,9 +1613,6 @@ int mame_validitychecks(const game_driver *curdriver)
/* validate inline function behavior */
error = validate_inlines() || error;
- /* make sure the CPU and sound interfaces are up and running */
- sndintrf_init(NULL);
-
init_resource_tracking();
begin_resource_tracking();
osd_profiling_ticks();
diff --git a/src/emu/video/cdp1869.c b/src/emu/video/cdp1869.c
index 71175e63ea5..32d611ba0ca 100644
--- a/src/emu/video/cdp1869.c
+++ b/src/emu/video/cdp1869.c
@@ -384,6 +384,7 @@ WRITE8_DEVICE_HANDLER( cdp1869_out3_w )
WRITE8_DEVICE_HANDLER( cdp1869_out4_w )
{
cdp1869_t *cdp1869 = get_safe_token(device);
+ const device_config *cdp = devtag_get_device(device->machine, SOUND, "cdp");
UINT16 word = cdp1802_get_r_x(cdp1869);
@@ -414,15 +415,16 @@ WRITE8_DEVICE_HANDLER( cdp1869_out4_w )
cdp1869->tonediv = (word & 0x7f00) >> 8;
// fork out to CDP1869 sound core
- cdp1869_set_toneamp(0, cdp1869->toneamp);
- cdp1869_set_tonefreq(0, cdp1869->tonefreq);
- cdp1869_set_toneoff(0, cdp1869->toneoff);
- cdp1869_set_tonediv(0, cdp1869->tonediv);
+ cdp1869_set_toneamp(cdp, cdp1869->toneamp);
+ cdp1869_set_tonefreq(cdp, cdp1869->tonefreq);
+ cdp1869_set_toneoff(cdp, cdp1869->toneoff);
+ cdp1869_set_tonediv(cdp, cdp1869->tonediv);
}
WRITE8_DEVICE_HANDLER( cdp1869_out5_w )
{
cdp1869_t *cdp1869 = get_safe_token(device);
+ const device_config *cdp = devtag_get_device(device->machine, SOUND, "cdp");
UINT16 word = cdp1802_get_r_x(cdp1869);
@@ -463,9 +465,9 @@ WRITE8_DEVICE_HANDLER( cdp1869_out5_w )
cdp1869->wnoff = BIT(word, 15);
// fork out to CDP1869 sound core
- cdp1869_set_wnamp(0, cdp1869->wnamp);
- cdp1869_set_wnfreq(0, cdp1869->wnfreq);
- cdp1869_set_wnoff(0, cdp1869->wnoff);
+ cdp1869_set_wnamp(cdp, cdp1869->wnamp);
+ cdp1869_set_wnfreq(cdp, cdp1869->wnfreq);
+ cdp1869_set_wnoff(cdp, cdp1869->wnoff);
if (cdp1869->cmem)
{
diff --git a/src/ldplayer/ldplayer.c b/src/ldplayer/ldplayer.c
index 564f6899a7a..695fd3c3bc4 100644
--- a/src/ldplayer/ldplayer.c
+++ b/src/ldplayer/ldplayer.c
@@ -563,8 +563,7 @@ static MACHINE_DRIVER_START( ldplayer_core )
/* audio hardware */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("ldsound", CUSTOM, 0)
- MDRV_SOUND_CONFIG(laserdisc_custom_interface)
+ MDRV_SOUND_ADD("ldsound", LASERDISC, 0)
MDRV_SOUND_ROUTE(0, "left", 1.0)
MDRV_SOUND_ROUTE(1, "right", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/audio/8080bw.c b/src/mame/audio/8080bw.c
index 8eb5a5adc0a..3ad07c0ddf5 100644
--- a/src/mame/audio/8080bw.c
+++ b/src/mame/audio/8080bw.c
@@ -39,14 +39,16 @@ MACHINE_START( extra_8080bw_sh )
WRITE8_HANDLER( invadpt2_sh_port_1_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
+ const device_config *sn = devtag_get_device(space->machine, SOUND, "sn");
UINT8 rising_bits = data & ~port_1_last_extra;
- sn76477_enable_w(0, !(data & 0x01)); /* SAUCER SOUND */
+ sn76477_enable_w(sn, !(data & 0x01)); /* SAUCER SOUND */
- if (rising_bits & 0x02) sample_start_n(0, 0, 0, 0); /* MISSLE SOUND */
- if (rising_bits & 0x04) sample_start_n(0, 1, 1, 0); /* EXPLOSION */
- if (rising_bits & 0x08) sample_start_n(0, 2, 2, 0); /* INVADER HIT */
- if (rising_bits & 0x10) sample_start_n(0, 5, 8, 0); /* BONUS MISSILE BASE */
+ if (rising_bits & 0x02) sample_start(samples, 0, 0, 0); /* MISSLE SOUND */
+ if (rising_bits & 0x04) sample_start(samples, 1, 1, 0); /* EXPLOSION */
+ if (rising_bits & 0x08) sample_start(samples, 2, 2, 0); /* INVADER HIT */
+ if (rising_bits & 0x10) sample_start(samples, 5, 8, 0); /* BONUS MISSILE BASE */
c8080bw_screen_red_w(data & 0x04);
@@ -65,13 +67,14 @@ WRITE8_HANDLER( invadpt2_sh_port_2_w )
D2 = 82K
D3 = 100K */
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
UINT8 rising_bits = data & ~port_2_last_extra;
- if (rising_bits & 0x01) sample_start_n(0, 4, 3, 0); /* FLEET */
- if (rising_bits & 0x02) sample_start_n(0, 4, 4, 0); /* FLEET */
- if (rising_bits & 0x04) sample_start_n(0, 4, 5, 0); /* FLEET */
- if (rising_bits & 0x08) sample_start_n(0, 4, 6, 0); /* FLEET */
- if (rising_bits & 0x10) sample_start_n(0, 3, 7, 0); /* SAUCER HIT */
+ if (rising_bits & 0x01) sample_start(samples, 4, 3, 0); /* FLEET */
+ if (rising_bits & 0x02) sample_start(samples, 4, 4, 0); /* FLEET */
+ if (rising_bits & 0x04) sample_start(samples, 4, 5, 0); /* FLEET */
+ if (rising_bits & 0x08) sample_start(samples, 4, 6, 0); /* FLEET */
+ if (rising_bits & 0x10) sample_start(samples, 3, 7, 0); /* SAUCER HIT */
c8080bw_flip_screen_w(space, data & 0x20);
@@ -87,15 +90,18 @@ WRITE8_HANDLER( invadpt2_sh_port_2_w )
WRITE8_HANDLER( spcewars_sh_port_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
+ const device_config *speaker = devtag_get_device(space->machine, SOUND, "speaker");
+ const device_config *sn = devtag_get_device(space->machine, SOUND, "sn");
UINT8 rising_bits = data & ~port_1_last_extra;
- sn76477_enable_w(0, !(data & 0x01)); /* Saucer Sound */
+ sn76477_enable_w(sn, !(data & 0x01)); /* Saucer Sound */
- if (rising_bits & 0x02) sample_start(0, 0, 0); /* Shot Sound */
- if (rising_bits & 0x04) sample_start(1, 1, 0); /* Base Hit */
- if (rising_bits & 0x08) sample_start(2, 2, 0); /* Invader Hit */
+ if (rising_bits & 0x02) sample_start(samples, 0, 0, 0); /* Shot Sound */
+ if (rising_bits & 0x04) sample_start(samples, 1, 1, 0); /* Base Hit */
+ if (rising_bits & 0x08) sample_start(samples, 2, 2, 0); /* Invader Hit */
- speaker_level_w(0, (data & 0x10) ? 1 : 0); /* Various bitstream tunes */
+ speaker_level_w(speaker, (data & 0x10) ? 1 : 0); /* Various bitstream tunes */
port_1_last_extra = data;
}
@@ -130,13 +136,14 @@ const samples_interface lrescue_samples_interface =
WRITE8_HANDLER( lrescue_sh_port_1_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
UINT8 rising_bits = data & ~port_1_last_extra;
- if (rising_bits & 0x01) sample_start(0, 3, 0); /* Thrust */
- if (rising_bits & 0x02) sample_start(1, 2, 0); /* Shot Sound */
- if (rising_bits & 0x04) sample_start(0, 1, 0); /* Death */
- if (rising_bits & 0x08) sample_start(1, 0, 0); /* Alien Hit */
- if (rising_bits & 0x10) sample_start(2, 5, 0); /* Bonus Ship (not confirmed) */
+ if (rising_bits & 0x01) sample_start(samples, 0, 3, 0); /* Thrust */
+ if (rising_bits & 0x02) sample_start(samples, 1, 2, 0); /* Shot Sound */
+ if (rising_bits & 0x04) sample_start(samples, 0, 1, 0); /* Death */
+ if (rising_bits & 0x08) sample_start(samples, 1, 0, 0); /* Alien Hit */
+ if (rising_bits & 0x10) sample_start(samples, 2, 5, 0); /* Bonus Ship (not confirmed) */
sound_global_enable(data & 0x20);
@@ -147,16 +154,18 @@ WRITE8_HANDLER( lrescue_sh_port_1_w )
WRITE8_HANDLER( lrescue_sh_port_2_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
+ const device_config *speaker = devtag_get_device(space->machine, SOUND, "speaker");
UINT8 rising_bits = data & ~port_2_last_extra;
- if (rising_bits & 0x01) sample_start(1, 8, 0); /* Footstep high tone */
- if (rising_bits & 0x02) sample_start(1, 7, 0); /* Footstep low tone */
- if (rising_bits & 0x04) sample_start(1, 4, 0); /* Bonus when counting men saved */
+ if (rising_bits & 0x01) sample_start(samples, 1, 8, 0); /* Footstep high tone */
+ if (rising_bits & 0x02) sample_start(samples, 1, 7, 0); /* Footstep low tone */
+ if (rising_bits & 0x04) sample_start(samples, 1, 4, 0); /* Bonus when counting men saved */
- speaker_level_w(0, (data & 0x08) ? 1 : 0); /* Bitstream tunes - endlevel and bonus1 */
+ speaker_level_w(speaker, (data & 0x08) ? 1 : 0); /* Bitstream tunes - endlevel and bonus1 */
- if (rising_bits & 0x10) sample_start(3, 6, 0); /* Shooting Star and Rescue Ship sounds */
- if (~data & 0x10 && port_2_last_extra & 0x10) sample_stop (3); /* This makes the rescue ship sound beep on and off */
+ if (rising_bits & 0x10) sample_start(samples, 3, 6, 0); /* Shooting Star and Rescue Ship sounds */
+ if (~data & 0x10 && port_2_last_extra & 0x10) sample_stop (samples, 3); /* This makes the rescue ship sound beep on and off */
c8080bw_flip_screen_w(space, data & 0x20);
@@ -186,13 +195,14 @@ WRITE8_HANDLER( cosmo_sh_port_2_w )
WRITE8_HANDLER( ballbomb_sh_port_1_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
UINT8 rising_bits = data & ~port_1_last_extra;
- if (rising_bits & 0x01) sample_start(1, 2, 0); /* Hit a balloon */
- if (rising_bits & 0x02) sample_start(2, 0, 0); /* Shot Sound */
- if (rising_bits & 0x04) sample_start(2, 1, 0); /* Base Hit */
- if (rising_bits & 0x08) sample_start(1, 7, 0); /* Hit a Bomb */
- if (rising_bits & 0x10) sample_start(3, 8, 0); /* Bonus Base at 1500 points */
+ if (rising_bits & 0x01) sample_start(samples, 1, 2, 0); /* Hit a balloon */
+ if (rising_bits & 0x02) sample_start(samples, 2, 0, 0); /* Shot Sound */
+ if (rising_bits & 0x04) sample_start(samples, 2, 1, 0); /* Base Hit */
+ if (rising_bits & 0x08) sample_start(samples, 1, 7, 0); /* Hit a Bomb */
+ if (rising_bits & 0x10) sample_start(samples, 3, 8, 0); /* Bonus Base at 1500 points */
sound_global_enable(data & 0x20);
@@ -203,11 +213,12 @@ WRITE8_HANDLER( ballbomb_sh_port_1_w )
WRITE8_HANDLER( ballbomb_sh_port_2_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
UINT8 rising_bits = data & ~port_2_last_extra;
- if (data & 0x01) sample_start(0, 7, 0); /* Indicates plane will drop bombs */
- if (data & 0x04) sample_start(0, 4, 0); /* Plane is dropping new balloons at start of level */
- if (rising_bits & 0x10) sample_start(2, 2, 0); /* Balloon hit and bomb drops */
+ if (data & 0x01) sample_start(samples, 0, 7, 0); /* Indicates plane will drop bombs */
+ if (data & 0x04) sample_start(samples, 0, 4, 0); /* Plane is dropping new balloons at start of level */
+ if (rising_bits & 0x10) sample_start(samples, 2, 2, 0); /* Balloon hit and bomb drops */
c8080bw_flip_screen_w(space, data & 0x20);
@@ -262,12 +273,13 @@ WRITE8_HANDLER( indianbt_sh_port_1_w )
{
/* bit 4 occurs every 5.25 seconds during gameplay */
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
UINT8 rising_bits = data & ~port_1_last_extra;
- if (rising_bits & 0x01) sample_start(1, 7, 0); /* Death */
- if (rising_bits & 0x02) sample_start(0, 1, 0); /* Shot Sound */
- if (rising_bits & 0x04) sample_start(2, 3, 0); /* Move */
- if (rising_bits & 0x08) sample_start(3, 2, 0); /* Hit */
+ if (rising_bits & 0x01) sample_start(samples, 1, 7, 0); /* Death */
+ if (rising_bits & 0x02) sample_start(samples, 0, 1, 0); /* Shot Sound */
+ if (rising_bits & 0x04) sample_start(samples, 2, 3, 0); /* Move */
+ if (rising_bits & 0x08) sample_start(samples, 3, 2, 0); /* Hit */
sound_global_enable(data & 0x20);
@@ -278,19 +290,20 @@ WRITE8_HANDLER( indianbt_sh_port_1_w )
WRITE8_HANDLER( indianbt_sh_port_2_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
UINT8 rising_bits = data & ~port_2_last_extra;
- if (rising_bits & 0x01) sample_start(4, 0, 0); /* Bird dropped an egg, Lasso used */
- if (rising_bits & 0x02) sample_start(4, 2, 0); /* Egg hatches, egg shot */
- if (rising_bits & 0x08) sample_start(5, 0, 0); /* Grabber, Lasso caught something */
- if (rising_bits & 0x10) sample_start(3, 7, 0); /* Lasso sound */
+ if (rising_bits & 0x01) sample_start(samples, 4, 0, 0); /* Bird dropped an egg, Lasso used */
+ if (rising_bits & 0x02) sample_start(samples, 4, 2, 0); /* Egg hatches, egg shot */
+ if (rising_bits & 0x08) sample_start(samples, 5, 0, 0); /* Grabber, Lasso caught something */
+ if (rising_bits & 0x10) sample_start(samples, 3, 7, 0); /* Lasso sound */
port_2_last_extra = data;
}
-WRITE8_HANDLER( indianbt_sh_port_3_w )
+WRITE8_DEVICE_HANDLER( indianbt_sh_port_3_w )
{
- discrete_sound_w(space, INDIANBT_MUSIC_DATA, data);
+ discrete_sound_w(device, INDIANBT_MUSIC_DATA, data);
}
@@ -606,49 +619,49 @@ DISCRETE_SOUND_START(polaris)
DISCRETE_SOUND_END
-WRITE8_HANDLER( polaris_sh_port_1_w )
+WRITE8_DEVICE_HANDLER( polaris_sh_port_1_w )
{
- discrete_sound_w(space, POLARIS_MUSIC_DATA, data);
+ discrete_sound_w(device, POLARIS_MUSIC_DATA, data);
}
-WRITE8_HANDLER( polaris_sh_port_2_w )
+WRITE8_DEVICE_HANDLER( polaris_sh_port_2_w )
{
/* 0x01 - SX0 - Shot */
- discrete_sound_w(space, POLARIS_SX0_EN, data & 0x01);
+ discrete_sound_w(device, POLARIS_SX0_EN, data & 0x01);
/* 0x02 - SX1 - Ship Hit (Sub) */
- discrete_sound_w(space, POLARIS_SX1_EN, data & 0x02);
+ discrete_sound_w(device, POLARIS_SX1_EN, data & 0x02);
/* 0x04 - SX2 - Ship */
- discrete_sound_w(space, POLARIS_SX2_EN, data & 0x04);
+ discrete_sound_w(device, POLARIS_SX2_EN, data & 0x04);
/* 0x08 - SX3 - Explosion */
- discrete_sound_w(space, POLARIS_SX3_EN, data & 0x08);
+ discrete_sound_w(device, POLARIS_SX3_EN, data & 0x08);
/* 0x10 - SX4 */
/* 0x20 - SX5 - Sound Enable */
- discrete_sound_w(space, POLARIS_SX5_EN, data & 0x20);
+ discrete_sound_w(device, POLARIS_SX5_EN, data & 0x20);
}
-WRITE8_HANDLER( polaris_sh_port_3_w )
+WRITE8_DEVICE_HANDLER( polaris_sh_port_3_w )
{
coin_lockout_global_w(data & 0x04); /* SX8 */
- c8080bw_flip_screen_w(space, data & 0x20); /* SX11 */
+ c8080bw_flip_screen_w(cputag_get_address_space(device->machine, "main", ADDRESS_SPACE_PROGRAM), data & 0x20); /* SX11 */
/* 0x01 - SX6 - Plane Down */
- discrete_sound_w(space, POLARIS_SX6_EN, data & 0x01);
+ discrete_sound_w(device, POLARIS_SX6_EN, data & 0x01);
/* 0x02 - SX7 - Plane Up */
- discrete_sound_w(space, POLARIS_SX7_EN, data & 0x02);
+ discrete_sound_w(device, POLARIS_SX7_EN, data & 0x02);
/* 0x08 - SX9 - Hit */
- discrete_sound_w(space, POLARIS_SX9_EN, data & 0x08);
+ discrete_sound_w(device, POLARIS_SX9_EN, data & 0x08);
/* 0x10 - SX10 - Hit */
- discrete_sound_w(space, POLARIS_SX10_EN, data & 0x10);
+ discrete_sound_w(device, POLARIS_SX10_EN, data & 0x10);
}
@@ -786,6 +799,8 @@ static const double schaser_effect_rc[8] =
WRITE8_HANDLER( schaser_sh_port_1_w )
{
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+ const device_config *sn = devtag_get_device(space->machine, SOUND, "sn");
static int last_effect = 0;
int effect;
@@ -797,8 +812,8 @@ WRITE8_HANDLER( schaser_sh_port_1_w )
bit 5 - Explosion (SX5) */
//printf( "schaser_sh_port_1_w: %02x\n", data );
- discrete_sound_w(space, SCHASER_DOT_EN, data & 0x01);
- discrete_sound_w(space, SCHASER_DOT_SEL, data & 0x02);
+ discrete_sound_w(discrete, SCHASER_DOT_EN, data & 0x01);
+ discrete_sound_w(discrete, SCHASER_DOT_SEL, data & 0x02);
/* The effect is a variable rate 555 timer. A diode/resistor array is used to
* select the frequency. Because of the diode voltage drop, we can not use the
@@ -839,15 +854,15 @@ WRITE8_HANDLER( schaser_sh_port_1_w )
schaser_explosion = (data >> 5) & 0x01;
if (schaser_explosion)
{
- sn76477_amplitude_res_w(0, 1.0 / (1.0/RES_K(200) + 1.0/RES_K(68)));
+ sn76477_amplitude_res_w(sn, 1.0 / (1.0/RES_K(200) + 1.0/RES_K(68)));
}
else
{
- sn76477_amplitude_res_w(0, RES_K(200));
+ sn76477_amplitude_res_w(sn, RES_K(200));
}
- sn76477_enable_w(0, !(schaser_effect_555_is_low || schaser_explosion));
- sn76477_one_shot_cap_voltage_w(0, !(schaser_effect_555_is_low || schaser_explosion) ? 0 : SN76477_EXTERNAL_VOLTAGE_DISCONNECT);
- sn76477_mixer_b_w(0, schaser_explosion);
+ sn76477_enable_w(sn, !(schaser_effect_555_is_low || schaser_explosion));
+ sn76477_one_shot_cap_voltage_w(sn, !(schaser_effect_555_is_low || schaser_explosion) ? 0 : SN76477_EXTERNAL_VOLTAGE_DISCONNECT);
+ sn76477_mixer_b_w(sn, schaser_explosion);
}
WRITE8_HANDLER( schaser_sh_port_2_w )
@@ -859,11 +874,13 @@ WRITE8_HANDLER( schaser_sh_port_2_w )
bit 4 - Field Control B (SX10)
bit 5 - Flip Screen */
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+
printf( "schaser_sh_port_2_w: %02x\n", data );
- discrete_sound_w(space, SCHASER_MUSIC_BIT, data & 0x01);
+ discrete_sound_w(discrete, SCHASER_MUSIC_BIT, data & 0x01);
- discrete_sound_w(space, SCHASER_SND_EN, data & 0x02);
+ discrete_sound_w(discrete, SCHASER_SND_EN, data & 0x02);
sound_global_enable(data & 0x02);
coin_lockout_global_w(data & 0x04);
@@ -878,6 +895,7 @@ WRITE8_HANDLER( schaser_sh_port_2_w )
static TIMER_CALLBACK( schaser_effect_555_cb )
{
+ const device_config *sn = devtag_get_device(machine, SOUND, "sn");
int effect = param;
attotime new_time;
/* Toggle 555 output */
@@ -895,8 +913,8 @@ static TIMER_CALLBACK( schaser_effect_555_cb )
new_time = attotime_never;
}
timer_adjust_oneshot(schaser_effect_555_timer, new_time, effect);
- sn76477_enable_w(0, !(schaser_effect_555_is_low || schaser_explosion));
- sn76477_one_shot_cap_voltage_w(0, !(schaser_effect_555_is_low || schaser_explosion) ? 0 : SN76477_EXTERNAL_VOLTAGE_DISCONNECT);
+ sn76477_enable_w(sn, !(schaser_effect_555_is_low || schaser_explosion));
+ sn76477_one_shot_cap_voltage_w(sn, !(schaser_effect_555_is_low || schaser_explosion) ? 0 : SN76477_EXTERNAL_VOLTAGE_DISCONNECT);
}
@@ -945,11 +963,12 @@ MACHINE_RESET( schaser )
WRITE8_HANDLER( rollingc_sh_port_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
UINT8 rising_bits = data & ~port_3_last_extra;
- if (rising_bits & 0x02) sample_start(4, 0, 0); /* Steering */
- if (rising_bits & 0x04) sample_start(0, 1, 0); /* Collision */
- if (rising_bits & 0x10) sample_start(1, 8, 0); /* Computer car is starting to move */
+ if (rising_bits & 0x02) sample_start(samples, 4, 0, 0); /* Steering */
+ if (rising_bits & 0x04) sample_start(samples, 0, 1, 0); /* Collision */
+ if (rising_bits & 0x10) sample_start(samples, 1, 8, 0); /* Computer car is starting to move */
port_3_last_extra = data;
}
@@ -968,27 +987,28 @@ WRITE8_HANDLER( rollingc_sh_port_w )
WRITE8_HANDLER( invrvnge_sh_port_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
switch (data)
{
case 0x06:
- sample_start(1, 0, 0); /* Shoot */
+ sample_start(samples, 1, 0, 0); /* Shoot */
break;
case 0x14:
- sample_start(2, 2, 0); /* Hit Alien */
+ sample_start(samples, 2, 2, 0); /* Hit Alien */
break;
case 0x16:
- sample_start(2, 5, 0); /* Hit Asteroid */
+ sample_start(samples, 2, 5, 0); /* Hit Asteroid */
break;
case 0x1e:
- sample_start(3, 1, 0); /* Death (followed by 0x0a byte), also bit 4 of port 5 */
+ sample_start(samples, 3, 1, 0); /* Death (followed by 0x0a byte), also bit 4 of port 5 */
break;
case 0x18: /* Fuel Low */
case 0x30: /* Fuel bar filling up */
- sample_start(4, 7, 0);
+ sample_start(samples, 4, 7, 0);
break;
case 0x02: /* Coin */
@@ -998,7 +1018,7 @@ WRITE8_HANDLER( invrvnge_sh_port_w )
break;
case 0x3a: /* Thrust, Docking, extra ship? */
- sample_start(0, 8, 0);
+ sample_start(samples, 0, 8, 0);
break;
}
}
@@ -1011,28 +1031,31 @@ WRITE8_HANDLER( invrvnge_sh_port_w )
WRITE8_HANDLER( lupin3_sh_port_1_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
+ const device_config *sn = devtag_get_device(space->machine, SOUND, "sn");
UINT8 rising_bits = data & ~port_1_last_extra;
- if (rising_bits & 0x01) sample_start(0, 6, 0); /* Walking, get money */
+ if (rising_bits & 0x01) sample_start(samples, 0, 6, 0); /* Walking, get money */
- sn76477_enable_w(0, data & 0x02 ? 0:1); /* Helicopter */
+ sn76477_enable_w(sn, data & 0x02 ? 0:1); /* Helicopter */
- if (rising_bits & 0x04) sample_start(0, 7, 0); /* Translocate */
- if (rising_bits & 0x08) sample_start(0, 1, 0); /* Jail */
- if (rising_bits & 0x10) sample_start(3, 8, 0); /* Bonus Man */
+ if (rising_bits & 0x04) sample_start(samples, 0, 7, 0); /* Translocate */
+ if (rising_bits & 0x08) sample_start(samples, 0, 1, 0); /* Jail */
+ if (rising_bits & 0x10) sample_start(samples, 3, 8, 0); /* Bonus Man */
port_1_last_extra = data;
}
WRITE8_HANDLER( lupin3_sh_port_2_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
UINT8 rising_bits = data & ~port_2_last_extra;
- if (rising_bits & 0x01) sample_start(0, 3, 0); /* Lands on top of building, wife kicks man */
- if (rising_bits & 0x02) sample_start(1, 2, 0); /* deposit money, start intermission, end game */
- if (rising_bits & 0x04) sample_start(2, 5, 0); /* deposit money, start intermission, Slides down rope */
- if (rising_bits & 0x08) sample_start(3, 0, 0); /* start intermission, end game */
- //if (rising_bits & 0x10) sample_start(3, 9, 0); /* Dog barking */
+ if (rising_bits & 0x01) sample_start(samples, 0, 3, 0); /* Lands on top of building, wife kicks man */
+ if (rising_bits & 0x02) sample_start(samples, 1, 2, 0); /* deposit money, start intermission, end game */
+ if (rising_bits & 0x04) sample_start(samples, 2, 5, 0); /* deposit money, start intermission, Slides down rope */
+ if (rising_bits & 0x08) sample_start(samples, 3, 0, 0); /* start intermission, end game */
+ //if (rising_bits & 0x10) sample_start(samples, 3, 9, 0); /* Dog barking */
c8080bw_flip_screen_w(space, data & 0x20);
@@ -1052,17 +1075,20 @@ WRITE8_HANDLER( schasrcv_sh_port_1_w )
bit 3 = 1st speedup
Death is a stream of ff's with some fe's thrown in */
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
UINT8 rising_bits = data & ~port_1_last_extra;
- if (rising_bits & 0x02) sample_start(1, 6, 0); /* Ran over a dot */
- if (rising_bits & 0x10) sample_start(0, 1, 0); /* Death */
+ if (rising_bits & 0x02) sample_start(samples, 1, 6, 0); /* Ran over a dot */
+ if (rising_bits & 0x10) sample_start(samples, 0, 1, 0); /* Death */
port_1_last_extra = data;
}
WRITE8_HANDLER( schasrcv_sh_port_2_w )
{
- speaker_level_w(0, (data & 0x01) ? 1 : 0); /* End-of-Level */
+ const device_config *speaker = devtag_get_device(space->machine, SOUND, "speaker");
+
+ speaker_level_w(speaker, (data & 0x01) ? 1 : 0); /* End-of-Level */
sound_global_enable(data & 0x10);
@@ -1077,13 +1103,14 @@ WRITE8_HANDLER( schasrcv_sh_port_2_w )
WRITE8_HANDLER( yosakdon_sh_port_1_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
UINT8 rising_bits = data & ~port_1_last_extra;
- if (rising_bits & 0x01) sample_start(0, 3, 0); /* Game Over */
- if (rising_bits & 0x02) sample_start(2, 0, 0); /* Bird dead */
- if (rising_bits & 0x04) sample_start(0, 1, 0); /* Rifle being fired */
- if (rising_bits & 0x08) sample_start(1, 2, 0); /* Man dead */
- if (rising_bits & 0x10) sample_start(5, 8, 0); /* Bonus Man? */
+ if (rising_bits & 0x01) sample_start(samples, 0, 3, 0); /* Game Over */
+ if (rising_bits & 0x02) sample_start(samples, 2, 0, 0); /* Bird dead */
+ if (rising_bits & 0x04) sample_start(samples, 0, 1, 0); /* Rifle being fired */
+ if (rising_bits & 0x08) sample_start(samples, 1, 2, 0); /* Man dead */
+ if (rising_bits & 0x10) sample_start(samples, 5, 8, 0); /* Bonus Man? */
sound_global_enable(data & 0x20);
@@ -1092,14 +1119,16 @@ WRITE8_HANDLER( yosakdon_sh_port_1_w )
WRITE8_HANDLER( yosakdon_sh_port_2_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
+ const device_config *sn = devtag_get_device(space->machine, SOUND, "sn");
UINT8 rising_bits = data & ~port_2_last_extra;
- if (rising_bits & 0x01) sample_start(1, 6, 0); /* Ready? , Game Over */
- if (rising_bits & 0x04) sample_start(3, 7, 0); /* Big bird dead */
+ if (rising_bits & 0x01) sample_start(samples, 1, 6, 0); /* Ready? , Game Over */
+ if (rising_bits & 0x04) sample_start(samples, 3, 7, 0); /* Big bird dead */
- sn76477_enable_w(0, data & 0x08 ? 0:1); /* Big bird */
+ sn76477_enable_w(sn, data & 0x08 ? 0:1); /* Big bird */
- if (rising_bits & 0x10) sample_start(2, 7, 0); /* Game Over */
+ if (rising_bits & 0x10) sample_start(samples, 2, 7, 0); /* Game Over */
c8080bw_flip_screen_w(space, data & 0x20);
@@ -1116,34 +1145,37 @@ WRITE8_HANDLER( shuttlei_sh_port_1_w )
{
/* bit 3 is high while you are alive and playing */
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
+ const device_config *sn = devtag_get_device(space->machine, SOUND, "sn");
UINT8 rising_bits = data & ~port_1_last_extra;
- if (rising_bits & 0x01) sample_start(4, 4, 0); /* Fleet move */
- if (rising_bits & 0x02) sample_start(5, 8, 0); /* Extra Tank */
+ if (rising_bits & 0x01) sample_start(samples, 4, 4, 0); /* Fleet move */
+ if (rising_bits & 0x02) sample_start(samples, 5, 8, 0); /* Extra Tank */
- sn76477_enable_w(0, data & 0x04 ? 0:1); /* UFO */
+ sn76477_enable_w(sn, data & 0x04 ? 0:1); /* UFO */
port_1_last_extra = data;
}
WRITE8_HANDLER( shuttlei_sh_port_2_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
switch (data)
{
case 0x23:
- sample_start(2, 2, 0); /* Hit */
+ sample_start(samples, 2, 2, 0); /* Hit */
break;
case 0x2b:
- sample_start(0, 0, 0); /* Shoot */
+ sample_start(samples, 0, 0, 0); /* Shoot */
break;
case 0xa3:
- sample_start(3, 7, 0); /* Hit UFO */
+ sample_start(samples, 3, 7, 0); /* Hit UFO */
break;
case 0xab:
- sample_start(1, 1, 0); /* Death */
+ sample_start(samples, 1, 1, 0); /* Death */
break;
}
}
diff --git a/src/mame/audio/amiga.c b/src/mame/audio/amiga.c
index 1e4e0d590da..2a879e0ded2 100644
--- a/src/mame/audio/amiga.c
+++ b/src/mame/audio/amiga.c
@@ -261,14 +261,13 @@ static STREAM_UPDATE( amiga_stream_update )
*
*************************************/
-CUSTOM_START( amiga_sh_start )
+static DEVICE_START( amiga_sound )
{
running_machine *machine = device->machine;
int i;
/* allocate a new audio state */
- audio_state = auto_malloc(sizeof(*audio_state));
- memset(audio_state, 0, sizeof(*audio_state));
+ audio_state = device->token;
for (i = 0; i < 4; i++)
{
audio_state->channel[i].index = i;
@@ -276,6 +275,24 @@ CUSTOM_START( amiga_sh_start )
}
/* create the stream */
- audio_state->stream = stream_create(device, 0, 4, clock / CLOCK_DIVIDER, audio_state, amiga_stream_update);
- return audio_state;
+ audio_state->stream = stream_create(device, 0, 4, device->clock / CLOCK_DIVIDER, audio_state, amiga_stream_update);
}
+
+
+DEVICE_GET_INFO( amiga_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as 64-bit signed integers --- */
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(*audio_state); break;
+
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(amiga_sound); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Amiga Custom"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
+}
+
+
diff --git a/src/mame/audio/asteroid.c b/src/mame/audio/asteroid.c
index 70de7afbe8a..3732378e489 100644
--- a/src/mame/audio/asteroid.c
+++ b/src/mame/audio/asteroid.c
@@ -277,9 +277,9 @@ DISCRETE_SOUND_START(astdelux)
DISCRETE_SOUND_END
-WRITE8_HANDLER( asteroid_explode_w )
+WRITE8_DEVICE_HANDLER( asteroid_explode_w )
{
- discrete_sound_w(space,ASTEROID_EXPLODE_DATA,(data&0x3c)>>2); // Volume
+ discrete_sound_w(device,ASTEROID_EXPLODE_DATA,(data&0x3c)>>2); // Volume
/* We will modify the pitch data to send the divider value. */
switch ((data&0xc0))
{
@@ -296,27 +296,27 @@ WRITE8_HANDLER( asteroid_explode_w )
data = 5;
break;
}
- discrete_sound_w(space,ASTEROID_EXPLODE_PITCH, data);
+ discrete_sound_w(device,ASTEROID_EXPLODE_PITCH, data);
}
-WRITE8_HANDLER( asteroid_thump_w )
+WRITE8_DEVICE_HANDLER( asteroid_thump_w )
{
- discrete_sound_w(space, ASTEROID_THUMP_EN, data & 0x10);
- discrete_sound_w(space, ASTEROID_THUMP_DATA, data & 0x0f);
+ discrete_sound_w(device, ASTEROID_THUMP_EN, data & 0x10);
+ discrete_sound_w(device, ASTEROID_THUMP_DATA, data & 0x0f);
}
-WRITE8_HANDLER( asteroid_sounds_w )
+WRITE8_DEVICE_HANDLER( asteroid_sounds_w )
{
- discrete_sound_w(space, NODE_RELATIVE(ASTEROID_SAUCER_SND_EN, offset), data & 0x80);
+ discrete_sound_w(device, NODE_RELATIVE(ASTEROID_SAUCER_SND_EN, offset), data & 0x80);
}
-WRITE8_HANDLER( astdelux_sounds_w )
+WRITE8_DEVICE_HANDLER( astdelux_sounds_w )
{
/* Only ever activates the thrusters in Astdelux */
- discrete_sound_w(space, ASTEROID_THRUST_EN, data & 0x80);
+ discrete_sound_w(device, ASTEROID_THRUST_EN, data & 0x80);
}
-WRITE8_HANDLER( asteroid_noise_reset_w )
+WRITE8_DEVICE_HANDLER( asteroid_noise_reset_w )
{
- discrete_sound_w(space, ASTEROID_NOISE_RESET, 0);
+ discrete_sound_w(device, ASTEROID_NOISE_RESET, 0);
}
diff --git a/src/mame/audio/astrof.c b/src/mame/audio/astrof.c
index 3861a81afc6..0da20817a26 100644
--- a/src/mame/audio/astrof.c
+++ b/src/mame/audio/astrof.c
@@ -68,13 +68,14 @@ MACHINE_START( astrof_audio )
WRITE8_HANDLER( astrof_audio_1_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
UINT8 rising_bits = data & ~port_1_last;
if (astrof_death_playing)
- astrof_death_playing = sample_playing(CHANNEL_EXPLOSION);
+ astrof_death_playing = sample_playing(samples, CHANNEL_EXPLOSION);
if (astrof_bosskill_playing)
- astrof_bosskill_playing = sample_playing(CHANNEL_EXPLOSION);
+ astrof_bosskill_playing = sample_playing(samples, CHANNEL_EXPLOSION);
/* D2 - explosion */
if (rising_bits & 0x04)
@@ -88,19 +89,19 @@ WRITE8_HANDLER( astrof_audio_1_w )
if ((data & 0x08) && (~port_1_last & 0x08))
{
int sample = SAMPLE_WAVE + (data & 3);
- sample_start(CHANNEL_WAVE, sample, 1);
+ sample_start(samples, CHANNEL_WAVE, sample, 1);
}
if ((~data & 0x08) && (port_1_last & 0x08))
- sample_stop(CHANNEL_WAVE);
+ sample_stop(samples, CHANNEL_WAVE);
/* D4 - boss laser */
if ((rising_bits & 0x10) && !astrof_bosskill_playing)
- sample_start(CHANNEL_BOSSFIRE, SAMPLE_BOSSFIRE, 0);
+ sample_start(samples, CHANNEL_BOSSFIRE, SAMPLE_BOSSFIRE, 0);
/* D5 - fire */
if ((rising_bits & 0x20) && !astrof_bosskill_playing)
- sample_start(CHANNEL_FIRE, SAMPLE_FIRE, 0);
+ sample_start(samples, CHANNEL_FIRE, SAMPLE_FIRE, 0);
/* D6 - don't know. Probably something to do with the explosion sounds */
@@ -113,6 +114,7 @@ WRITE8_HANDLER( astrof_audio_1_w )
WRITE8_HANDLER( astrof_audio_2_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
UINT8 rising_bits = data & ~port_2_last;
/* D0-D2 - explosion select (triggered by D2 of the other port */
@@ -126,20 +128,20 @@ logerror("Explosion: %x\n", data);
{
if (!astrof_bosskill_playing)
{
- sample_start(CHANNEL_EXPLOSION, SAMPLE_BOSSKILL, 0);
+ sample_start(samples, CHANNEL_EXPLOSION, SAMPLE_BOSSKILL, 0);
astrof_bosskill_playing = 1;
}
}
else if (data & 0x02)
- sample_start(CHANNEL_EXPLOSION, SAMPLE_BOSSHIT, 0);
+ sample_start(samples, CHANNEL_EXPLOSION, SAMPLE_BOSSHIT, 0);
else if (data & 0x01)
- sample_start(CHANNEL_EXPLOSION, SAMPLE_EKILLED, 0);
+ sample_start(samples, CHANNEL_EXPLOSION, SAMPLE_EKILLED, 0);
else
{
if (!astrof_death_playing)
{
- sample_start(CHANNEL_EXPLOSION, SAMPLE_DEATH, 0);
+ sample_start(samples, CHANNEL_EXPLOSION, SAMPLE_DEATH, 0);
astrof_death_playing = 1;
}
@@ -150,7 +152,7 @@ logerror("Explosion: %x\n", data);
/* D3 - low fuel warning */
if (rising_bits & 0x08)
- sample_start(CHANNEL_FUEL, SAMPLE_FUEL, 0);
+ sample_start(samples, CHANNEL_FUEL, SAMPLE_FUEL, 0);
port_2_last = data;
}
@@ -217,6 +219,8 @@ MACHINE_DRIVER_END
WRITE8_HANDLER( tomahawk_audio_w )
{
+ const device_config *sn = devtag_get_device(space->machine, SOUND, "sn");
+
/* D0 - sonar */
/* D1 - UFO explosion */
@@ -228,7 +232,7 @@ WRITE8_HANDLER( tomahawk_audio_w )
/* D4 - UFO */
/* D5 - UFO under water */
- sn76477_enable_w(0, (~data >> 5) & 0x01);
+ sn76477_enable_w(sn, (~data >> 5) & 0x01);
/* D6 - explosion */
diff --git a/src/mame/audio/atarijsa.c b/src/mame/audio/atarijsa.c
index 0de0f662560..48bdd65e2bc 100644
--- a/src/mame/audio/atarijsa.c
+++ b/src/mame/audio/atarijsa.c
@@ -53,10 +53,11 @@ static const device_config *jsacpu;
static const char *test_port;
static UINT16 test_mask;
-static UINT8 has_pokey;
-static UINT8 has_ym2151;
-static UINT8 has_tms5220;
-static UINT8 has_oki6295;
+static const device_config *pokey;
+static const device_config *ym2151;
+static const device_config *tms5220;
+static const device_config *oki6295;
+static const device_config *oki6295_l, *oki6295_r;
static UINT32 oki6295_bank_base;
@@ -106,7 +107,6 @@ static void init_save_state(running_machine *machine)
void atarijsa_init(running_machine *machine, const char *testport, int testmask)
{
- int i;
UINT8 *rgn;
/* copy in the parameters */
@@ -121,23 +121,16 @@ void atarijsa_init(running_machine *machine, const char *testport, int testmask)
bank_source_data = &rgn[0x10000];
/* determine which sound hardware is installed */
- has_tms5220 = has_oki6295 = has_pokey = has_ym2151 = 0;
- for (i = 0; i < MAX_SOUND; i++)
- {
- sound_type type = machine->config->sound[i].type;
- if (type == SOUND_TMS5220)
- has_tms5220 = 1;
- if (type == SOUND_OKIM6295)
- has_oki6295 = 1;
- if (type == SOUND_POKEY)
- has_pokey = 1;
- if (type == SOUND_YM2151)
- has_ym2151 = 1;
- }
+ tms5220 = devtag_get_device(machine, SOUND, "tms");
+ ym2151 = devtag_get_device(machine, SOUND, "ym");
+ pokey = devtag_get_device(machine, SOUND, "pokey");
+ oki6295 = devtag_get_device(machine, SOUND, "adpcm");
+ oki6295_l = devtag_get_device(machine, SOUND, "adpcml");
+ oki6295_r = devtag_get_device(machine, SOUND, "adpcmr");
/* install POKEY memory handlers */
- if (has_pokey)
- memory_install_readwrite8_handler(cpu_get_address_space(jsacpu, ADDRESS_SPACE_PROGRAM), 0x2c00, 0x2c0f, 0, 0, pokey1_r, pokey1_w);
+ if (pokey != NULL)
+ memory_install_readwrite8_device_handler(cpu_get_address_space(jsacpu, ADDRESS_SPACE_PROGRAM), pokey, 0x2c00, 0x2c0f, 0, 0, pokey_r, pokey_w);
init_save_state(machine);
atarijsa_reset();
@@ -223,7 +216,7 @@ static READ8_HANDLER( jsa1_io_r )
if (!(input_port_read(space->machine, test_port) & test_mask)) result ^= 0x80;
if (atarigen_cpu_to_sound_ready) result ^= 0x40;
if (atarigen_sound_to_cpu_ready) result ^= 0x20;
- if (!has_tms5220 || tms5220_ready_r()) result ^= 0x10;
+ if (tms5220 == NULL || tms5220_ready_r(tms5220)) result ^= 0x10;
break;
case 0x006: /* /IRQACK */
@@ -276,14 +269,14 @@ static WRITE8_HANDLER( jsa1_io_w )
*/
/* handle TMS5220 I/O */
- if (has_tms5220)
+ if (tms5220 != NULL)
{
int count;
if (((data ^ last_ctl) & 0x02) && (data & 0x02))
- tms5220_data_w(space, 0, speech_data);
+ tms5220_data_w(tms5220, 0, speech_data);
count = 5 | ((data >> 2) & 2);
- tms5220_set_frequency(JSA_MASTER_CLOCK*2 / (16 - count));
+ tms5220_set_frequency(tms5220, JSA_MASTER_CLOCK*2 / (16 - count));
}
/* coin counters */
@@ -325,8 +318,8 @@ static READ8_HANDLER( jsa2_io_r )
switch (offset & 0x206)
{
case 0x000: /* /RDV */
- if (has_oki6295)
- result = okim6295_status_0_r(space, offset);
+ if (oki6295 != NULL)
+ result = okim6295_r(oki6295, offset);
else
logerror("atarijsa: Unknown read at %04X\n", offset & 0x206);
break;
@@ -383,8 +376,8 @@ static WRITE8_HANDLER( jsa2_io_w )
break;
case 0x200: /* /WRV */
- if (has_oki6295)
- okim6295_data_0_w(space, offset, data);
+ if (oki6295 != NULL)
+ okim6295_w(oki6295, offset, data);
else
logerror("atarijsa: Unknown write (%02X) at %04X\n", data & 0xff, offset & 0x206);
break;
@@ -413,7 +406,8 @@ static WRITE8_HANDLER( jsa2_io_w )
coin_counter_w(0, (data >> 4) & 1);
/* update the OKI frequency */
- if (has_oki6295) okim6295_set_pin7(0, data & 8);
+ if (oki6295 != NULL)
+ okim6295_set_pin7(oki6295, data & 8);
break;
case 0x206: /* /MIX */
@@ -446,8 +440,8 @@ static READ8_HANDLER( jsa3_io_r )
switch (offset & 0x206)
{
case 0x000: /* /RDV */
- if (has_oki6295)
- result = okim6295_status_0_r(space, offset);
+ if (oki6295 != NULL)
+ result = okim6295_r(oki6295, offset);
break;
case 0x002: /* /RDP */
@@ -506,8 +500,8 @@ static WRITE8_HANDLER( jsa3_io_w )
break;
case 0x200: /* /WRV */
- if (has_oki6295)
- okim6295_data_0_w(space, offset, data);
+ if (oki6295 != NULL)
+ okim6295_w(oki6295, offset, data);
break;
case 0x202: /* /WRP */
@@ -526,9 +520,8 @@ static WRITE8_HANDLER( jsa3_io_w )
*/
/* update the OKI bank */
-
oki6295_bank_base = (0x40000 * ((data >> 1) & 1)) | (oki6295_bank_base & 0x80000);
- if (has_oki6295) okim6295_set_bank_base(0, oki6295_bank_base);
+ if (oki6295 != NULL) okim6295_set_bank_base(oki6295, oki6295_bank_base);
/* update the bank */
memcpy(bank_base, &bank_source_data[0x1000 * ((data >> 6) & 3)], 0x1000);
@@ -539,7 +532,8 @@ static WRITE8_HANDLER( jsa3_io_w )
coin_counter_w(0, (data >> 4) & 1);
/* update the OKI frequency */
- if (has_oki6295) okim6295_set_pin7(0, data & 8);
+ if (oki6295_l != NULL) okim6295_set_pin7(oki6295_l, data & 8);
+ if (oki6295_r != NULL) okim6295_set_pin7(oki6295_r, data & 8);
break;
case 0x206: /* /MIX */
@@ -553,7 +547,7 @@ static WRITE8_HANDLER( jsa3_io_w )
/* update the OKI bank */
oki6295_bank_base = (0x80000 * ((data >> 4) & 1)) | (oki6295_bank_base & 0x40000);
- if (has_oki6295) okim6295_set_bank_base(0, oki6295_bank_base);
+ if (oki6295 != NULL) okim6295_set_bank_base(oki6295, oki6295_bank_base);
/* update the volumes */
ym2151_volume = ((data >> 1) & 7) * 100 / 7;
@@ -578,13 +572,8 @@ static READ8_HANDLER( jsa3s_io_r )
switch (offset & 0x206)
{
case 0x000: /* /RDV */
- if (has_oki6295)
- {
- if (offset & 1)
- result = okim6295_status_1_r(space, offset);
- else
- result = okim6295_status_0_r(space, offset);
- }
+ if (oki6295_l != NULL)
+ result = okim6295_r((offset & 1) ? oki6295_r : oki6295_l, offset);
break;
case 0x002: /* /RDP */
@@ -643,13 +632,8 @@ static WRITE8_HANDLER( jsa3s_io_w )
break;
case 0x200: /* /WRV */
- if (has_oki6295)
- {
- if (offset & 1)
- okim6295_data_1_w(space, offset, data);
- else
- okim6295_data_0_w(space, offset, data);
- }
+ if (oki6295_l != NULL)
+ okim6295_w((offset & 1) ? oki6295_r : oki6295_l, 0, data);
break;
case 0x202: /* /WRP */
@@ -669,7 +653,7 @@ static WRITE8_HANDLER( jsa3s_io_w )
/* update the OKI bank */
oki6295_bank_base = (0x40000 * ((data >> 1) & 1)) | (oki6295_bank_base & 0x80000);
- okim6295_set_bank_base(0, oki6295_bank_base);
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "adpcml"), oki6295_bank_base);
/* update the bank */
memcpy(bank_base, &bank_source_data[0x1000 * ((data >> 6) & 3)], 0x1000);
@@ -680,8 +664,8 @@ static WRITE8_HANDLER( jsa3s_io_w )
coin_counter_w(0, (data >> 4) & 1);
/* update the OKI frequency */
- okim6295_set_pin7(0, data & 8);
- okim6295_set_pin7(1, data & 8);
+ okim6295_set_pin7(oki6295_l, data & 8);
+ okim6295_set_pin7(oki6295_r, data & 8);
break;
case 0x206: /* /MIX */
@@ -695,8 +679,8 @@ static WRITE8_HANDLER( jsa3s_io_w )
/* update the OKI bank */
oki6295_bank_base = (0x80000 * ((data >> 4) & 1)) | (oki6295_bank_base & 0x40000);
- okim6295_set_bank_base(0, oki6295_bank_base);
- okim6295_set_bank_base(1, 0x40000 * (data >> 6));
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "adpcml"), oki6295_bank_base);
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "adpcmr"), 0x40000 * (data >> 6));
/* update the volumes */
ym2151_volume = ((data >> 1) & 7) * 100 / 7;
@@ -716,10 +700,10 @@ static WRITE8_HANDLER( jsa3s_io_w )
static void update_all_volumes(running_machine *machine )
{
- if (has_pokey) atarigen_set_pokey_vol(machine, overall_volume * pokey_volume / 100);
- if (has_ym2151) atarigen_set_ym2151_vol(machine, overall_volume * ym2151_volume / 100);
- if (has_tms5220) atarigen_set_tms5220_vol(machine, overall_volume * tms5220_volume / 100);
- if (has_oki6295) atarigen_set_oki6295_vol(machine, overall_volume * oki6295_volume / 100);
+ if (pokey != NULL) atarigen_set_pokey_vol(machine, overall_volume * pokey_volume / 100);
+ if (ym2151 != NULL) atarigen_set_ym2151_vol(machine, overall_volume * ym2151_volume / 100);
+ if (tms5220 != NULL) atarigen_set_tms5220_vol(machine, overall_volume * tms5220_volume / 100);
+ if (oki6295 != NULL || oki6295_l != NULL || oki6295_r != NULL) atarigen_set_oki6295_vol(machine, overall_volume * oki6295_volume / 100);
}
@@ -732,9 +716,7 @@ static void update_all_volumes(running_machine *machine )
static ADDRESS_MAP_START( atarijsa1_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_RAM
- AM_RANGE(0x2000, 0x2000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x2001, 0x2001) AM_WRITE(ym2151_data_port_0_w)
- AM_RANGE(0x2000, 0x2001) AM_READ(ym2151_status_port_0_r)
+ AM_RANGE(0x2000, 0x2001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x2800, 0x2bff) AM_READWRITE(jsa1_io_r, jsa1_io_w)
AM_RANGE(0x3000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -742,9 +724,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( atarijsa2_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_RAM
- AM_RANGE(0x2000, 0x2000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x2001, 0x2001) AM_WRITE(ym2151_data_port_0_w)
- AM_RANGE(0x2000, 0x2001) AM_READ(ym2151_status_port_0_r)
+ AM_RANGE(0x2000, 0x2001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x2800, 0x2bff) AM_READWRITE(jsa2_io_r, jsa2_io_w)
AM_RANGE(0x3000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -753,9 +733,7 @@ ADDRESS_MAP_END
/* full map verified from schematics and Batman GALs */
static ADDRESS_MAP_START( atarijsa3_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_RAM
- AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x07fe) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x07fe) AM_WRITE(ym2151_data_port_0_w)
- AM_RANGE(0x2000, 0x2001) AM_MIRROR(0x07fe) AM_READ(ym2151_status_port_0_r)
+ AM_RANGE(0x2000, 0x2001) AM_MIRROR(0x07fe) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x2800, 0x2fff) AM_READWRITE(jsa3_io_r, jsa3_io_w)
AM_RANGE(0x3000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -763,9 +741,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( atarijsa3s_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_RAM
- AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x07fe) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x07fe) AM_WRITE(ym2151_data_port_0_w)
- AM_RANGE(0x2000, 0x2001) AM_MIRROR(0x07fe) AM_READ(ym2151_status_port_0_r)
+ AM_RANGE(0x2000, 0x2001) AM_MIRROR(0x07fe) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x2800, 0x2fff) AM_READWRITE(jsa3s_io_r, jsa3s_io_w)
AM_RANGE(0x3000, 0xffff) AM_ROM
ADDRESS_MAP_END
diff --git a/src/mame/audio/attckufo.c b/src/mame/audio/attckufo.c
index de63983dd16..5dcea68a53a 100644
--- a/src/mame/audio/attckufo.c
+++ b/src/mame/audio/attckufo.c
@@ -8,7 +8,6 @@
#include <math.h>
#include "driver.h"
#include "streams.h"
-#include "sound/custom.h"
#include "includes/attckufo.h"
/*
@@ -208,7 +207,7 @@ static STREAM_UPDATE( attckufo_update )
/************************************/
-CUSTOM_START( attckufo_custom_start )
+DEVICE_START( attckufo_sound )
{
int i;
@@ -261,6 +260,20 @@ CUSTOM_START( attckufo_custom_start )
{
tone[i] = (INT16)(sin (2 * M_PI * i / tonesize) * 127 + 0.5);
}
- return (void *) ~0;
}
+
+DEVICE_GET_INFO( attckufo_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(attckufo_sound);break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Attack Ufo Custom"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
+}
+
+
diff --git a/src/mame/audio/avalnche.c b/src/mame/audio/avalnche.c
index cca36497623..2965cf8d915 100644
--- a/src/mame/audio/avalnche.c
+++ b/src/mame/audio/avalnche.c
@@ -21,35 +21,35 @@
avalnche_noise_amplitude_w
***************************************************************************/
-WRITE8_HANDLER( avalnche_noise_amplitude_w )
+WRITE8_DEVICE_HANDLER( avalnche_noise_amplitude_w )
{
- discrete_sound_w(space, AVALNCHE_SOUNDLVL_DATA, data & 0x3f);
+ discrete_sound_w(device, AVALNCHE_SOUNDLVL_DATA, data & 0x3f);
}
-WRITE8_HANDLER( avalnche_attract_enable_w )
+WRITE8_DEVICE_HANDLER( avalnche_attract_enable_w )
{
- discrete_sound_w(space, AVALNCHE_ATTRACT_EN, data & 0x01);
+ discrete_sound_w(device, AVALNCHE_ATTRACT_EN, data & 0x01);
}
-WRITE8_HANDLER( avalnche_audio_w )
+WRITE8_DEVICE_HANDLER( avalnche_audio_w )
{
int bit = data & 0x01;
switch (offset & 0x07)
{
case 0x00: /* AUD0 */
- discrete_sound_w(space, AVALNCHE_AUD0_EN, bit);
+ discrete_sound_w(device, AVALNCHE_AUD0_EN, bit);
break;
case 0x01: /* AUD1 */
- discrete_sound_w(space, AVALNCHE_AUD1_EN, bit);
+ discrete_sound_w(device, AVALNCHE_AUD1_EN, bit);
break;
case 0x02: /* AUD2 */
default:
- discrete_sound_w(space, AVALNCHE_AUD2_EN, bit);
+ discrete_sound_w(device, AVALNCHE_AUD2_EN, bit);
break;
}
}
diff --git a/src/mame/audio/blockade.c b/src/mame/audio/blockade.c
index bbbf8c6c828..011021f71f2 100644
--- a/src/mame/audio/blockade.c
+++ b/src/mame/audio/blockade.c
@@ -36,16 +36,17 @@ DISCRETE_SOUND_START(blockade)
DISCRETE_OUTPUT(NODE_10, 7500)
DISCRETE_SOUND_END
-WRITE8_HANDLER( blockade_sound_freq_w )
+WRITE8_DEVICE_HANDLER( blockade_sound_freq_w )
{
- discrete_sound_w(space,BLOCKADE_NOTE_DATA, data);
+ discrete_sound_w(device,BLOCKADE_NOTE_DATA, data);
return;
}
WRITE8_HANDLER( blockade_env_on_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
if (BLOCKADE_LOG) mame_printf_debug("Boom Start\n");
- sample_start(0,0,0);
+ sample_start(samples, 0,0,0);
return;
}
diff --git a/src/mame/audio/bsktball.c b/src/mame/audio/bsktball.c
index fa6e0d79c18..32f0d5d6f5f 100644
--- a/src/mame/audio/bsktball.c
+++ b/src/mame/audio/bsktball.c
@@ -10,20 +10,20 @@
/***************************************************************************
Sound handlers
***************************************************************************/
-WRITE8_HANDLER( bsktball_bounce_w )
+WRITE8_DEVICE_HANDLER( bsktball_bounce_w )
{
- discrete_sound_w(space, BSKTBALL_CROWD_DATA, data & 0x0f); // Crowd
- discrete_sound_w(space, BSKTBALL_BOUNCE_EN, data & 0x10); // Bounce
+ discrete_sound_w(device, BSKTBALL_CROWD_DATA, data & 0x0f); // Crowd
+ discrete_sound_w(device, BSKTBALL_BOUNCE_EN, data & 0x10); // Bounce
}
-WRITE8_HANDLER( bsktball_note_w )
+WRITE8_DEVICE_HANDLER( bsktball_note_w )
{
- discrete_sound_w(space, BSKTBALL_NOTE_DATA, data); // Note
+ discrete_sound_w(device, BSKTBALL_NOTE_DATA, data); // Note
}
-WRITE8_HANDLER( bsktball_noise_reset_w )
+WRITE8_DEVICE_HANDLER( bsktball_noise_reset_w )
{
- discrete_sound_w(space, BSKTBALL_NOISE_EN, offset & 0x01);
+ discrete_sound_w(device, BSKTBALL_NOISE_EN, offset & 0x01);
}
diff --git a/src/mame/audio/bzone.c b/src/mame/audio/bzone.c
index ffebf8062c0..4b1088460a7 100644
--- a/src/mame/audio/bzone.c
+++ b/src/mame/audio/bzone.c
@@ -21,7 +21,6 @@ D0 explosion enable gates a noise generator
#include "driver.h"
#include "streams.h"
#include "bzone.h"
-#include "sound/custom.h"
#define OUTPUT_RATE (6000*4)
@@ -271,7 +270,7 @@ static STREAM_UPDATE( bzone_sound_update )
}
}
-CUSTOM_START( bzone_sh_start )
+static DEVICE_START( bzone_sound )
{
int i;
@@ -280,6 +279,20 @@ CUSTOM_START( bzone_sh_start )
discharge[0x7fff-i] = (INT16) (0x7fff/exp(1.0*i/4096));
channel = stream_create(device, 0, 1, OUTPUT_RATE, 0, bzone_sound_update);
+}
+
+
+DEVICE_GET_INFO( bzone_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(bzone_sound); break;
- return auto_malloc(1);
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Battlezone Engine"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
}
+
+
diff --git a/src/mame/audio/cage.c b/src/mame/audio/cage.c
index c6b12564411..7c0a51b23c3 100644
--- a/src/mame/audio/cage.c
+++ b/src/mame/audio/cage.c
@@ -57,6 +57,8 @@ static UINT16 cage_control;
static UINT32 *speedup_ram;
+static const device_config *dmadac[DAC_BUFFER_CHANNELS];
+
/*************************************
@@ -154,6 +156,7 @@ static WRITE32_HANDLER( speedup_w );
void cage_init(running_machine *machine, offs_t speedup)
{
attotime cage_cpu_clock_period;
+ int chan;
cage_irqhandler = NULL;
@@ -171,6 +174,13 @@ void cage_init(running_machine *machine, offs_t speedup)
if (speedup)
speedup_ram = memory_install_write32_handler(cpu_get_address_space(cage_cpu, ADDRESS_SPACE_PROGRAM), speedup, speedup, 0, 0, speedup_w);
+ for (chan = 0; chan < DAC_BUFFER_CHANNELS; chan++)
+ {
+ char buffer[10];
+ sprintf(buffer, "dac%d", chan);
+ dmadac[chan] = devtag_get_device(machine, SOUND, buffer);
+ }
+
state_save_register_global(machine, cpu_to_cage_ready);
state_save_register_global(machine, cage_to_cpu_ready);
state_save_register_global(machine, serial_period_per_word.seconds);
@@ -253,10 +263,10 @@ static void update_dma_state(const address_space *space)
sound_data[i % STACK_SOUND_BUFSIZE] = memory_read_dword(space, addr * 4);
addr += inc;
if (i % STACK_SOUND_BUFSIZE == STACK_SOUND_BUFSIZE - 1)
- dmadac_transfer(0, DAC_BUFFER_CHANNELS, 1, DAC_BUFFER_CHANNELS, STACK_SOUND_BUFSIZE / DAC_BUFFER_CHANNELS, sound_data);
+ dmadac_transfer(&dmadac[0], DAC_BUFFER_CHANNELS, 1, DAC_BUFFER_CHANNELS, STACK_SOUND_BUFSIZE / DAC_BUFFER_CHANNELS, sound_data);
}
if (tms32031_io_regs[DMA_TRANSFER_COUNT] % STACK_SOUND_BUFSIZE != 0)
- dmadac_transfer(0, DAC_BUFFER_CHANNELS, 1, DAC_BUFFER_CHANNELS, (tms32031_io_regs[DMA_TRANSFER_COUNT] % STACK_SOUND_BUFSIZE) / DAC_BUFFER_CHANNELS, sound_data);
+ dmadac_transfer(&dmadac[0], DAC_BUFFER_CHANNELS, 1, DAC_BUFFER_CHANNELS, (tms32031_io_regs[DMA_TRANSFER_COUNT] % STACK_SOUND_BUFSIZE) / DAC_BUFFER_CHANNELS, sound_data);
/* compute the time of the interrupt and set the timer */
if (!dma_timer_enabled)
@@ -333,7 +343,7 @@ static void update_timer(int which)
*
*************************************/
-static void update_serial(void)
+static void update_serial(running_machine *machine)
{
attotime serial_clock_period, bit_clock_period;
UINT32 freq;
@@ -355,8 +365,8 @@ static void update_serial(void)
freq = ATTOSECONDS_TO_HZ(serial_period_per_word.attoseconds) / DAC_BUFFER_CHANNELS;
if (freq > 0 && freq < 100000)
{
- dmadac_set_frequency(0, DAC_BUFFER_CHANNELS, freq);
- dmadac_enable(0, DAC_BUFFER_CHANNELS, 1);
+ dmadac_set_frequency(&dmadac[0], DAC_BUFFER_CHANNELS, freq);
+ dmadac_enable(&dmadac[0], DAC_BUFFER_CHANNELS, 1);
}
}
@@ -429,7 +439,7 @@ static WRITE32_HANDLER( tms32031_io_w )
case SPORT_GLOBAL_CTL:
case SPORT_TIMER_CTL:
case SPORT_TIMER_PERIOD:
- update_serial();
+ update_serial(space->machine);
break;
}
}
diff --git a/src/mame/audio/canyon.c b/src/mame/audio/canyon.c
index 73868e0787e..d60ee3e20ae 100644
--- a/src/mame/audio/canyon.c
+++ b/src/mame/audio/canyon.c
@@ -14,27 +14,27 @@
*
*************************************/
-WRITE8_HANDLER( canyon_motor_w )
+WRITE8_DEVICE_HANDLER( canyon_motor_w )
{
- discrete_sound_w(space, NODE_RELATIVE(CANYON_MOTOR1_DATA, (offset & 0x01)), data & 0x0f);
+ discrete_sound_w(device, NODE_RELATIVE(CANYON_MOTOR1_DATA, (offset & 0x01)), data & 0x0f);
}
-WRITE8_HANDLER( canyon_explode_w )
+WRITE8_DEVICE_HANDLER( canyon_explode_w )
{
- discrete_sound_w(space, CANYON_EXPLODE_DATA, data >> 4);
+ discrete_sound_w(device, CANYON_EXPLODE_DATA, data >> 4);
}
-WRITE8_HANDLER( canyon_attract_w )
+WRITE8_DEVICE_HANDLER( canyon_attract_w )
{
- discrete_sound_w(space, NODE_RELATIVE(CANYON_ATTRACT1_EN, (offset & 0x01)), offset & 0x02);
+ discrete_sound_w(device, NODE_RELATIVE(CANYON_ATTRACT1_EN, (offset & 0x01)), offset & 0x02);
}
-WRITE8_HANDLER( canyon_whistle_w )
+WRITE8_DEVICE_HANDLER( canyon_whistle_w )
{
- discrete_sound_w(space, NODE_RELATIVE(CANYON_WHISTLE1_EN, (offset & 0x01)), offset & 0x02);
+ discrete_sound_w(device, NODE_RELATIVE(CANYON_WHISTLE1_EN, (offset & 0x01)), offset & 0x02);
}
diff --git a/src/mame/audio/carnival.c b/src/mame/audio/carnival.c
index 9ec267e6e52..60aeeaa5ce5 100644
--- a/src/mame/audio/carnival.c
+++ b/src/mame/audio/carnival.c
@@ -76,8 +76,8 @@
#define PSG_BC_LATCH_ADDRESS ( MUSIC_PORT2_PSG_BDIR | MUSIC_PORT2_PSG_BC1 )
-#define PLAY(id,loop) sample_start( id, id, loop )
-#define STOP(id) sample_stop( id )
+#define PLAY(samp,id,loop) sample_start( samp, id, id, loop )
+#define STOP(samp,id) sample_stop( samp, id )
/* sample file names */
@@ -128,6 +128,7 @@ static int psgData = 0;
WRITE8_HANDLER( carnival_audio_1_w )
{
static int port1State = 0;
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
int bitsChanged;
int bitsGoneHigh;
int bitsGoneLow;
@@ -152,60 +153,61 @@ WRITE8_HANDLER( carnival_audio_1_w )
if ( bitsGoneLow & OUT_PORT_1_RIFLE_SHOT )
{
- PLAY( SND_RIFLE_SHOT, 0 );
+ PLAY( samples, SND_RIFLE_SHOT, 0 );
}
if ( bitsGoneLow & OUT_PORT_1_CLANG )
{
- PLAY( SND_CLANG, 0 );
+ PLAY( samples, SND_CLANG, 0 );
}
if ( bitsGoneLow & OUT_PORT_1_DUCK_1 )
{
- PLAY( SND_DUCK_1, 1 );
+ PLAY( samples, SND_DUCK_1, 1 );
}
if ( bitsGoneHigh & OUT_PORT_1_DUCK_1 )
{
- STOP( SND_DUCK_1 );
+ STOP( samples, SND_DUCK_1 );
}
if ( bitsGoneLow & OUT_PORT_1_DUCK_2 )
{
- PLAY( SND_DUCK_2, 1 );
+ PLAY( samples, SND_DUCK_2, 1 );
}
if ( bitsGoneHigh & OUT_PORT_1_DUCK_2 )
{
- STOP( SND_DUCK_2 );
+ STOP( samples, SND_DUCK_2 );
}
if ( bitsGoneLow & OUT_PORT_1_DUCK_3 )
{
- PLAY( SND_DUCK_3, 1 );
+ PLAY( samples, SND_DUCK_3, 1 );
}
if ( bitsGoneHigh & OUT_PORT_1_DUCK_3 )
{
- STOP( SND_DUCK_3 );
+ STOP( samples, SND_DUCK_3 );
}
if ( bitsGoneLow & OUT_PORT_1_PIPE_HIT )
{
- PLAY( SND_PIPE_HIT, 0 );
+ PLAY( samples, SND_PIPE_HIT, 0 );
}
if ( bitsGoneLow & OUT_PORT_1_BONUS_1 )
{
- PLAY( SND_BONUS_1, 0 );
+ PLAY( samples, SND_BONUS_1, 0 );
}
if ( bitsGoneLow & OUT_PORT_1_BONUS_2 )
{
- PLAY( SND_BONUS_2, 0 );
+ PLAY( samples, SND_BONUS_2, 0 );
}
}
WRITE8_HANDLER( carnival_audio_2_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
int bitsChanged;
int bitsGoneHigh;
int bitsGoneLow;
@@ -228,10 +230,10 @@ WRITE8_HANDLER( carnival_audio_2_w )
port2State = data;
if ( bitsGoneLow & OUT_PORT_2_BEAR )
- PLAY( SND_BEAR, 0 );
+ PLAY( samples, SND_BEAR, 0 );
if ( bitsGoneLow & OUT_PORT_2_RANKING )
- PLAY( SND_RANKING, 0 );
+ PLAY( samples, SND_RANKING, 0 );
if ( bitsGoneHigh & OUT_PORT_2_MUSIC_RESET )
/* reset output is no longer asserted active low */
@@ -252,7 +254,7 @@ static WRITE8_HANDLER( carnival_music_port_1_w )
}
-static WRITE8_HANDLER( carnival_music_port_2_w )
+static WRITE8_DEVICE_HANDLER( carnival_music_port_2_w )
{
static int psgSelect = 0;
int newSelect;
@@ -273,11 +275,11 @@ static WRITE8_HANDLER( carnival_music_port_2_w )
break;
case PSG_BC_WRITE:
- ay8910_write_port_0_w( space, 0, psgData );
+ ay8910_data_w( device, 0, psgData );
break;
case PSG_BC_LATCH_ADDRESS:
- ay8910_control_port_0_w( space, 0, psgData );
+ ay8910_address_w( device, 0, psgData );
break;
}
}
@@ -291,7 +293,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( carnival_audio_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(carnival_music_port_t1_r)
AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(carnival_music_port_1_w)
- AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(carnival_music_port_2_w)
+ AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_DEVWRITE(SOUND, "psg", carnival_music_port_2_w)
ADDRESS_MAP_END
diff --git a/src/mame/audio/cchasm.c b/src/mame/audio/cchasm.c
index ac629a35c27..5bf15cdd0ce 100644
--- a/src/mame/audio/cchasm.c
+++ b/src/mame/audio/cchasm.c
@@ -15,73 +15,25 @@
static int sound_flags;
static const device_config *ctc;
-READ8_HANDLER( cchasm_snd_io_r )
+READ8_HANDLER( cchasm_coin_sound_r )
{
- int coin;
-
- switch (offset & 0x61 )
- {
- case 0x00:
- coin = (input_port_read(space->machine, "IN3") >> 4) & 0x7;
- if (coin != 0x7) coin |= 0x8;
- return sound_flags | coin;
-
- case 0x01:
- return ay8910_read_port_0_r (space, offset);
-
- case 0x21:
- return ay8910_read_port_1_r (space, offset);
-
- case 0x40:
- return soundlatch_r (space, offset);
-
- case 0x41:
- sound_flags &= ~0x80;
- z80ctc_trg2_w(ctc, 0, 0);
- return soundlatch2_r (space, offset);
- default:
- logerror("Read from unmapped internal IO device at 0x%x\n", offset + 0x6000);
- return 0;
- }
+ UINT8 coin = (input_port_read(space->machine, "IN3") >> 4) & 0x7;
+ if (coin != 0x7) coin |= 0x8;
+ return sound_flags | coin;
}
-WRITE8_HANDLER( cchasm_snd_io_w )
+READ8_HANDLER( cchasm_soundlatch2_r )
{
- switch (offset & 0x61 )
- {
- case 0x00:
- ay8910_control_port_0_w (space, offset, data);
- break;
-
- case 0x01:
- ay8910_write_port_0_w (space, offset, data);
- break;
-
- case 0x20:
- ay8910_control_port_1_w (space, offset, data);
- break;
-
- case 0x21:
- ay8910_write_port_1_w (space, offset, data);
- break;
-
- case 0x40:
- soundlatch3_w (space, offset, data);
- break;
-
- case 0x41:
- sound_flags |= 0x40;
- soundlatch4_w (space, offset, data);
- cpu_set_input_line(space->machine->cpu[0], 1, HOLD_LINE);
- break;
-
- case 0x61:
- z80ctc_trg0_w(ctc, 0, 0);
- break;
-
- default:
- logerror("Write %x to unmapped internal IO device at 0x%x\n", data, offset + 0x6000);
- }
+ sound_flags &= ~0x80;
+ z80ctc_trg2_w(ctc, 0, 0);
+ return soundlatch2_r(space, offset);
+}
+
+WRITE8_HANDLER( cchasm_soundlatch4_w )
+{
+ sound_flags |= 0x40;
+ soundlatch4_w(space, offset, data);
+ cpu_set_input_line(space->machine->cpu[0], 1, HOLD_LINE);
}
WRITE16_HANDLER( cchasm_io_w )
@@ -139,22 +91,22 @@ static void ctc_interrupt (const device_config *device, int state)
static WRITE8_DEVICE_HANDLER( ctc_timer_1_w )
{
- if (data) /* rising edge */
- {
- output[0] ^= 0x7f;
- channel_active[0] = 1;
- dac_data_w(0, output[0]);
- }
+ if (data) /* rising edge */
+ {
+ output[0] ^= 0x7f;
+ channel_active[0] = 1;
+ dac_data_w(devtag_get_device(device->machine, SOUND, "dac1"), output[0]);
+ }
}
static WRITE8_DEVICE_HANDLER( ctc_timer_2_w )
{
- if (data) /* rising edge */
- {
- output[1] ^= 0x7f;
- channel_active[1] = 1;
- dac_data_w(1, output[0]);
- }
+ if (data) /* rising edge */
+ {
+ output[1] ^= 0x7f;
+ channel_active[1] = 1;
+ dac_data_w(devtag_get_device(device->machine, SOUND, "dac2"), output[0]);
+ }
}
z80ctc_interface cchasm_ctc_intf =
diff --git a/src/mame/audio/cclimber.c b/src/mame/audio/cclimber.c
index bae43bc63aa..b7afaed66d1 100644
--- a/src/mame/audio/cclimber.c
+++ b/src/mame/audio/cclimber.c
@@ -27,6 +27,7 @@ static void cclimber_play_sample(running_machine *machine, int start,int freq,in
int len;
int romlen = memory_region_length(machine, "samples");
const UINT8 *rom = memory_region(machine, "samples");
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
if (!rom) return;
@@ -46,13 +47,13 @@ static void cclimber_play_sample(running_machine *machine, int start,int freq,in
len++;
}
- sample_start_raw(0,samplebuf,2 * len,freq,0);
+ sample_start_raw(samples,0,samplebuf,2 * len,freq,0);
}
static int sample_num,sample_freq,sample_volume;
-static WRITE8_HANDLER( cclimber_sample_select_w )
+static WRITE8_DEVICE_HANDLER( cclimber_sample_select_w )
{
sample_num = data;
}
@@ -81,10 +82,10 @@ const ay8910_interface cclimber_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- cclimber_sample_select_w,
- NULL
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(cclimber_sample_select_w),
+ DEVCB_NULL
};
const samples_interface cclimber_samples_interface =
diff --git a/src/mame/audio/cinemat.c b/src/mame/audio/cinemat.c
index 931f48077a1..72c11ba50f4 100644
--- a/src/mame/audio/cinemat.c
+++ b/src/mame/audio/cinemat.c
@@ -161,29 +161,31 @@ static const samples_interface spacewar_samples_interface =
static void spacewar_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
{
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
+
/* Explosion - rising edge */
if (SOUNDVAL_RISING_EDGE(0x01))
- sample_start(0, (mame_rand(machine) & 1) ? 0 : 6, 0);
+ sample_start(samples, 0, (mame_rand(machine) & 1) ? 0 : 6, 0);
/* Fire sound - rising edge */
if (SOUNDVAL_RISING_EDGE(0x02))
- sample_start(1, (mame_rand(machine) & 1) ? 1 : 7, 0);
+ sample_start(samples, 1, (mame_rand(machine) & 1) ? 1 : 7, 0);
/* Player 1 thrust - 0=on, 1=off */
if (SOUNDVAL_FALLING_EDGE(0x04))
- sample_start(3, 3, 1);
+ sample_start(samples, 3, 3, 1);
if (SOUNDVAL_RISING_EDGE(0x04))
- sample_stop(3);
+ sample_stop(samples, 3);
/* Player 2 thrust - 0=on, 1-off */
if (SOUNDVAL_FALLING_EDGE(0x08))
- sample_start(4, 4, 1);
+ sample_start(samples, 4, 4, 1);
if (SOUNDVAL_RISING_EDGE(0x08))
- sample_stop(4);
+ sample_stop(samples, 4);
/* Mute - 0=off, 1=on */
if (SOUNDVAL_FALLING_EDGE(0x10))
- sample_start(2, 2, 1); /* play idle sound */
+ sample_start(samples, 2, 2, 1); /* play idle sound */
if (SOUNDVAL_RISING_EDGE(0x10))
{
int i;
@@ -191,10 +193,10 @@ static void spacewar_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bi
/* turn off all but the idle sound */
for (i = 0; i < 5; i++)
if (i != 2)
- sample_stop(i);
+ sample_stop(samples, i);
/* Pop when board is shut off */
- sample_start(2, 5, 0);
+ sample_start(samples, 2, 5, 0);
}
}
@@ -238,17 +240,19 @@ static const samples_interface barrier_samples_interface =
static void barrier_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
{
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
+
/* Player die - rising edge */
if (SOUNDVAL_RISING_EDGE(0x01))
- sample_start(0, 0, 0);
+ sample_start(samples, 0, 0, 0);
/* Player move - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x02))
- sample_start(1, 1, 0);
+ sample_start(samples, 1, 1, 0);
/* Enemy move - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x04))
- sample_start(2, 2, 0);
+ sample_start(samples, 2, 2, 0);
}
static MACHINE_RESET( barrier )
@@ -289,6 +293,8 @@ static const samples_interface speedfrk_samples_interface =
static void speedfrk_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
{
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
+
/* on the falling edge of bit 0x08, clock the inverse of bit 0x04 into the top of the shiftreg */
if (SOUNDVAL_FALLING_EDGE(0x08))
{
@@ -301,9 +307,9 @@ static void speedfrk_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bi
/* off-road - 1=on, 0=off */
if (SOUNDVAL_RISING_EDGE(0x10))
- sample_start(0, 0, 1);
+ sample_start(samples, 0, 0, 1);
if (SOUNDVAL_FALLING_EDGE(0x10))
- sample_stop(0);
+ sample_stop(samples, 0);
/* start LED is controlled by bit 0x02 */
set_led_status(0, ~sound_val & 0x02);
@@ -352,35 +358,37 @@ static const samples_interface starhawk_samples_interface =
static void starhawk_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
{
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
+
/* explosion - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x01))
- sample_start(0, 0, 0);
+ sample_start(samples, 0, 0, 0);
/* right laser - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x02))
- sample_start(1, 1, 0);
+ sample_start(samples, 1, 1, 0);
/* left laser - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x04))
- sample_start(2, 2, 0);
+ sample_start(samples, 2, 2, 0);
/* K - 0=on, 1=off */
if (SOUNDVAL_FALLING_EDGE(0x08))
- sample_start(3, 3, 1);
+ sample_start(samples, 3, 3, 1);
if (SOUNDVAL_RISING_EDGE(0x08))
- sample_stop(3);
+ sample_stop(samples, 3);
/* master - 0=on, 1=off */
if (SOUNDVAL_FALLING_EDGE(0x10))
- sample_start(4, 4, 1);
+ sample_start(samples, 4, 4, 1);
if (SOUNDVAL_RISING_EDGE(0x10))
- sample_stop(4);
+ sample_stop(samples, 4);
/* K exit - 1=on, 0=off */
if (SOUNDVAL_RISING_EDGE(0x80))
- sample_start(3, 5, 1);
+ sample_start(samples, 3, 5, 1);
if (SOUNDVAL_FALLING_EDGE(0x80))
- sample_stop(3);
+ sample_stop(samples, 3);
}
static MACHINE_RESET( starhawk )
@@ -426,29 +434,31 @@ static const samples_interface sundance_samples_interface =
static void sundance_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
{
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
+
/* bong - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x01))
- sample_start(0, 0, 0);
+ sample_start(samples, 0, 0, 0);
/* whoosh - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x02))
- sample_start(1, 1, 0);
+ sample_start(samples, 1, 1, 0);
/* explosion - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x04))
- sample_start(2, 2, 0);
+ sample_start(samples, 2, 2, 0);
/* ping - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x08))
- sample_start(3, 3, 0);
+ sample_start(samples, 3, 3, 0);
/* ping - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x10))
- sample_start(4, 4, 0);
+ sample_start(samples, 4, 4, 0);
/* hatch - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x80))
- sample_start(5, 5, 0);
+ sample_start(samples, 5, 5, 0);
}
static MACHINE_RESET( sundance )
@@ -497,38 +507,40 @@ static void tailg_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_
/* the falling edge of bit 0x10 clocks bit 0x08 into the mux selected by bits 0x07 */
if (SOUNDVAL_FALLING_EDGE(0x10))
{
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
+
/* update the shift register (actually just a simple mux) */
current_shift = (current_shift & ~(1 << (sound_val & 7))) | (((sound_val >> 3) & 1) << (sound_val & 7));
/* explosion - falling edge */
if (SHIFTREG_FALLING_EDGE(0x01))
- sample_start(0, 0, 0);
+ sample_start(samples, 0, 0, 0);
/* rumble - 0=on, 1=off */
if (SHIFTREG_FALLING_EDGE(0x02))
- sample_start(1, 1, 1);
+ sample_start(samples, 1, 1, 1);
if (SHIFTREG_RISING_EDGE(0x02))
- sample_stop(1);
+ sample_stop(samples, 1);
/* laser - 0=on, 1=off */
if (SHIFTREG_FALLING_EDGE(0x04))
- sample_start(2, 2, 1);
+ sample_start(samples, 2, 2, 1);
if (SHIFTREG_RISING_EDGE(0x04))
- sample_stop(2);
+ sample_stop(samples, 2);
/* shield - 0=on, 1=off */
if (SHIFTREG_FALLING_EDGE(0x08))
- sample_start(3, 3, 1);
+ sample_start(samples, 3, 3, 1);
if (SHIFTREG_RISING_EDGE(0x08))
- sample_stop(3);
+ sample_stop(samples, 3);
/* bounce - falling edge */
if (SHIFTREG_FALLING_EDGE(0x10))
- sample_start(4, 4, 0);
+ sample_start(samples, 4, 4, 0);
/* hyperspace - falling edge */
if (SHIFTREG_FALLING_EDGE(0x20))
- sample_start(5, 5, 0);
+ sample_start(samples, 5, 5, 0);
/* LED */
set_led_status(0, current_shift & 0x40);
@@ -580,29 +592,31 @@ static const samples_interface warrior_samples_interface =
static void warrior_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
{
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
+
/* normal level - 0=on, 1=off */
if (SOUNDVAL_FALLING_EDGE(0x01))
- sample_start(0, 0, 1);
+ sample_start(samples, 0, 0, 1);
if (SOUNDVAL_RISING_EDGE(0x01))
- sample_stop(0);
+ sample_stop(samples, 0);
/* hi level - 0=on, 1=off */
if (SOUNDVAL_FALLING_EDGE(0x02))
- sample_start(1, 1, 1);
+ sample_start(samples, 1, 1, 1);
if (SOUNDVAL_RISING_EDGE(0x02))
- sample_stop(1);
+ sample_stop(samples, 1);
/* explosion - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x04))
- sample_start(2, 2, 0);
+ sample_start(samples, 2, 2, 0);
/* fall - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x08))
- sample_start(3, 3, 0);
+ sample_start(samples, 3, 3, 0);
/* appear - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x10))
- sample_start(4, 4, 0);
+ sample_start(samples, 4, 4, 0);
}
static MACHINE_RESET( warrior )
@@ -649,6 +663,8 @@ static const samples_interface armora_samples_interface =
static void armora_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
{
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
+
/* on the rising edge of bit 0x10, clock bit 0x80 into the shift register */
if (SOUNDVAL_RISING_EDGE(0x10))
current_shift = ((current_shift >> 1) & 0x7f) | (sound_val & 0x80);
@@ -660,19 +676,19 @@ static void armora_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits
/* lo explosion - falling edge */
if (SHIFTREG_FALLING_EDGE(0x10))
- sample_start(0, 0, 0);
+ sample_start(samples, 0, 0, 0);
/* jeep fire - falling edge */
if (SHIFTREG_FALLING_EDGE(0x20))
- sample_start(1, 1, 0);
+ sample_start(samples, 1, 1, 0);
/* hi explosion - falling edge */
if (SHIFTREG_FALLING_EDGE(0x40))
- sample_start(2, 2, 0);
+ sample_start(samples, 2, 2, 0);
/* tank fire - falling edge */
if (SHIFTREG_FALLING_EDGE(0x80))
- sample_start(3, 3, 0);
+ sample_start(samples, 3, 3, 0);
/* remember the previous value */
last_shift = current_shift;
@@ -681,21 +697,21 @@ static void armora_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits
/* tank sound - 0=on, 1=off */
/* still not totally correct - should be multiple speeds based on remaining bits in shift reg */
if (SOUNDVAL_FALLING_EDGE(0x02))
- sample_start(4, 4, 1);
+ sample_start(samples, 4, 4, 1);
if (SOUNDVAL_RISING_EDGE(0x02))
- sample_stop(4);
+ sample_stop(samples, 4);
/* beep sound - 0=on, 1=off */
if (SOUNDVAL_FALLING_EDGE(0x04))
- sample_start(5, 5, 1);
+ sample_start(samples, 5, 5, 1);
if (SOUNDVAL_RISING_EDGE(0x04))
- sample_stop(5);
+ sample_stop(samples, 5);
/* chopper sound - 0=on, 1=off */
if (SOUNDVAL_FALLING_EDGE(0x08))
- sample_start(6, 6, 1);
+ sample_start(samples, 6, 6, 1);
if (SOUNDVAL_RISING_EDGE(0x08))
- sample_stop(6);
+ sample_stop(samples, 6);
}
static MACHINE_RESET( armora )
@@ -748,6 +764,8 @@ static const samples_interface ripoff_samples_interface =
static void ripoff_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
{
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
+
/* on the rising edge of bit 0x02, clock bit 0x01 into the shift register */
if (SOUNDVAL_RISING_EDGE(0x02))
current_shift = ((current_shift >> 1) & 0x7f) | ((sound_val << 7) & 0x80);
@@ -757,19 +775,19 @@ static void ripoff_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits
{
/* background - 0=on, 1=off, selected by bits 0x38 */
if ((((current_shift ^ last_shift) & 0x38) && !(current_shift & 0x04)) || SHIFTREG_FALLING_EDGE(0x04))
- sample_start(5, 5 + ((current_shift >> 5) & 7), 1);
+ sample_start(samples, 5, 5 + ((current_shift >> 5) & 7), 1);
if (SHIFTREG_RISING_EDGE(0x04))
- sample_stop(5);
+ sample_stop(samples, 5);
/* beep - falling edge */
if (SHIFTREG_FALLING_EDGE(0x02))
- sample_start(0, 0, 0);
+ sample_start(samples, 0, 0, 0);
/* motor - 0=on, 1=off */
if (SHIFTREG_FALLING_EDGE(0x01))
- sample_start(1, 1, 1);
+ sample_start(samples, 1, 1, 1);
if (SHIFTREG_RISING_EDGE(0x01))
- sample_stop(1);
+ sample_stop(samples, 1);
/* remember the previous value */
last_shift = current_shift;
@@ -777,15 +795,15 @@ static void ripoff_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits
/* torpedo - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x08))
- sample_start(2, 2, 0);
+ sample_start(samples, 2, 2, 0);
/* laser - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x10))
- sample_start(3, 3, 0);
+ sample_start(samples, 3, 3, 0);
/* explosion - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x80))
- sample_start(4, 4, 0);
+ sample_start(samples, 4, 4, 0);
}
static MACHINE_RESET( ripoff )
@@ -833,6 +851,7 @@ static const samples_interface starcas_samples_interface =
static void starcas_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
{
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
UINT32 target_pitch;
/* on the rising edge of bit 0x10, clock bit 0x80 into the shift register */
@@ -844,29 +863,29 @@ static void starcas_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bit
{
/* fireball - falling edge */
if (SHIFTREG_FALLING_EDGE(0x80))
- sample_start(0, 0, 0);
+ sample_start(samples, 0, 0, 0);
/* shield hit - falling edge */
if (SHIFTREG_FALLING_EDGE(0x40))
- sample_start(1, 1, 0);
+ sample_start(samples, 1, 1, 0);
/* star sound - 0=off, 1=on */
if (SHIFTREG_RISING_EDGE(0x20))
- sample_start(2, 2, 1);
+ sample_start(samples, 2, 2, 1);
if (SHIFTREG_FALLING_EDGE(0x20))
- sample_stop(2);
+ sample_stop(samples, 2);
/* thrust sound - 1=off, 0=on*/
if (SHIFTREG_FALLING_EDGE(0x10))
- sample_start(3, 3, 1);
+ sample_start(samples, 3, 3, 1);
if (SHIFTREG_RISING_EDGE(0x10))
- sample_stop(3);
+ sample_stop(samples, 3);
/* drone - 1=off, 0=on */
if (SHIFTREG_FALLING_EDGE(0x08))
- sample_start(4, 4, 1);
+ sample_start(samples, 4, 4, 1);
if (SHIFTREG_RISING_EDGE(0x08))
- sample_stop(4);
+ sample_stop(samples, 4);
/* latch the drone pitch */
target_pitch = (current_shift & 7) + ((current_shift & 2) << 2);
@@ -879,7 +898,7 @@ static void starcas_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bit
current_pitch -= 225;
if (current_pitch < target_pitch)
current_pitch += 150;
- sample_set_freq(4, current_pitch);
+ sample_set_freq(samples, 4, current_pitch);
last_frame = video_screen_get_frame_number(machine->primary_screen);
}
@@ -889,15 +908,15 @@ static void starcas_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bit
/* loud explosion - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x02))
- sample_start(5, 5, 0);
+ sample_start(samples, 5, 5, 0);
/* soft explosion - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x04))
- sample_start(6, 6, 0);
+ sample_start(samples, 6, 6, 0);
/* player fire - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x08))
- sample_start(7, 7, 0);
+ sample_start(samples, 7, 7, 0);
}
static MACHINE_RESET( starcas )
@@ -945,6 +964,7 @@ static const samples_interface solarq_samples_interface =
static void solarq_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
{
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
static float target_volume, current_volume;
/* on the rising edge of bit 0x10, clock bit 0x80 into the shift register */
@@ -959,53 +979,53 @@ static void solarq_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits
/* loud explosion - falling edge */
if (SHIFTREG_FALLING_EDGE(0x80))
- sample_start(0, 0, 0);
+ sample_start(samples, 0, 0, 0);
/* soft explosion - falling edge */
if (SHIFTREG_FALLING_EDGE(0x40))
- sample_start(1, 1, 0);
+ sample_start(samples, 1, 1, 0);
/* thrust - 0=on, 1=off */
if (SHIFTREG_FALLING_EDGE(0x20))
{
target_volume = 1.0;
- if (!sample_playing(2))
- sample_start(2, 2, 1);
+ if (!sample_playing(samples, 2))
+ sample_start(samples, 2, 2, 1);
}
if (SHIFTREG_RISING_EDGE(0x20))
target_volume = 0;
/* ramp the thrust volume */
- if (sample_playing(2) && video_screen_get_frame_number(machine->primary_screen) > last_frame)
+ if (sample_playing(samples, 2) && video_screen_get_frame_number(machine->primary_screen) > last_frame)
{
if (current_volume > target_volume)
current_volume -= 0.078f;
if (current_volume < target_volume)
current_volume += 0.078f;
if (current_volume > 0)
- sample_set_volume(2, current_volume);
+ sample_set_volume(samples, 2, current_volume);
else
- sample_stop(2);
+ sample_stop(samples, 2);
last_frame = video_screen_get_frame_number(machine->primary_screen);
}
/* fire - falling edge */
if (SHIFTREG_FALLING_EDGE(0x10))
- sample_start(3, 3, 0);
+ sample_start(samples, 3, 3, 0);
/* capture - falling edge */
if (SHIFTREG_FALLING_EDGE(0x08))
- sample_start(4, 4, 0);
+ sample_start(samples, 4, 4, 0);
/* nuke - 1=on, 0=off */
if (SHIFTREG_RISING_EDGE(0x04))
- sample_start(5, 5, 1);
+ sample_start(samples, 5, 5, 1);
if (SHIFTREG_FALLING_EDGE(0x04))
- sample_stop(5);
+ sample_stop(samples, 5);
/* photon - falling edge */
if (SHIFTREG_FALLING_EDGE(0x02))
- sample_start(6, 6, 0);
+ sample_start(samples, 6, 6, 0);
/* remember the previous value */
last_shift = current_shift;
@@ -1018,17 +1038,17 @@ static void solarq_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits
/* start/stop the music sample on the high bit */
if (SHIFTREG2_RISING_EDGE(0x8000))
- sample_start(7, 7, 1);
+ sample_start(samples, 7, 7, 1);
if (SHIFTREG2_FALLING_EDGE(0x8000))
- sample_stop(7);
+ sample_stop(samples, 7);
/* set the frequency */
freq = 56818.181818 / (4096 - (current_shift & 0xfff));
- sample_set_freq(7, 44100 * freq / 1050);
+ sample_set_freq(samples, 7, 44100 * freq / 1050);
/* set the volume */
vol = (~current_shift >> 12) & 7;
- sample_set_volume(7, vol / 7.0);
+ sample_set_volume(samples, 7, vol / 7.0);
/* remember the previous value */
last_shift2 = current_shift;
@@ -1084,6 +1104,8 @@ static const samples_interface boxingb_samples_interface =
static void boxingb_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
{
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
+
/* on the rising edge of bit 0x10, clock bit 0x80 into the shift register */
if (SOUNDVAL_RISING_EDGE(0x10))
current_shift = ((current_shift >> 1) & 0x7fff) | ((sound_val << 8) & 0x8000);
@@ -1096,37 +1118,37 @@ static void boxingb_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bit
/* soft explosion - falling edge */
if (SHIFTREG_FALLING_EDGE(0x80))
- sample_start(0, 0, 0);
+ sample_start(samples, 0, 0, 0);
/* loud explosion - falling edge */
if (SHIFTREG_FALLING_EDGE(0x40))
- sample_start(1, 1, 0);
+ sample_start(samples, 1, 1, 0);
/* chirping birds - 0=on, 1=off */
if (SHIFTREG_FALLING_EDGE(0x20))
- sample_start(2, 2, 0);
+ sample_start(samples, 2, 2, 0);
if (SHIFTREG_RISING_EDGE(0x20))
- sample_stop(2);
+ sample_stop(samples, 2);
/* egg cracking - falling edge */
if (SHIFTREG_FALLING_EDGE(0x10))
- sample_start(3, 3, 0);
+ sample_start(samples, 3, 3, 0);
/* bug pushing A - rising edge */
if (SHIFTREG_RISING_EDGE(0x08))
- sample_start(4, 4, 0);
+ sample_start(samples, 4, 4, 0);
/* bug pushing B - rising edge */
if (SHIFTREG_RISING_EDGE(0x04))
- sample_start(5, 5, 0);
+ sample_start(samples, 5, 5, 0);
/* bug dying - falling edge */
if (SHIFTREG_FALLING_EDGE(0x02))
- sample_start(6, 6, 0);
+ sample_start(samples, 6, 6, 0);
/* beetle on screen - falling edge */
if (SHIFTREG_FALLING_EDGE(0x01))
- sample_start(7, 7, 0);
+ sample_start(samples, 7, 7, 0);
/* remember the previous value */
last_shift = current_shift;
@@ -1139,21 +1161,21 @@ static void boxingb_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bit
/* start/stop the music sample on the high bit */
if (SHIFTREG2_RISING_EDGE(0x8000))
- sample_start(8, 8, 1);
+ sample_start(samples, 8, 8, 1);
if (SHIFTREG2_FALLING_EDGE(0x8000))
- sample_stop(8);
+ sample_stop(samples, 8);
/* set the frequency */
freq = 56818.181818 / (4096 - (current_shift & 0xfff));
- sample_set_freq(8, 44100 * freq / 1050);
+ sample_set_freq(samples, 8, 44100 * freq / 1050);
/* set the volume */
vol = (~current_shift >> 12) & 3;
- sample_set_volume(8, vol / 3.0);
+ sample_set_volume(samples, 8, vol / 3.0);
/* cannon - falling edge */
if (SHIFTREG2_RISING_EDGE(0x4000))
- sample_start(9, 9, 0);
+ sample_start(samples, 9, 9, 0);
/* remember the previous value */
last_shift2 = current_shift;
@@ -1161,11 +1183,11 @@ static void boxingb_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bit
/* bounce - rising edge */
if (SOUNDVAL_RISING_EDGE(0x04))
- sample_start(10, 10, 0);
+ sample_start(samples, 10, 10, 0);
/* bell - falling edge */
if (SOUNDVAL_RISING_EDGE(0x08))
- sample_start(11, 11, 0);
+ sample_start(samples, 11, 11, 0);
}
static MACHINE_RESET( boxingb )
@@ -1213,6 +1235,7 @@ static const samples_interface wotw_samples_interface =
static void wotw_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
{
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
UINT32 target_pitch;
/* on the rising edge of bit 0x10, clock bit 0x80 into the shift register */
@@ -1224,29 +1247,29 @@ static void wotw_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_c
{
/* fireball - falling edge */
if (SHIFTREG_FALLING_EDGE(0x80))
- sample_start(0, 0, 0);
+ sample_start(samples, 0, 0, 0);
/* shield hit - falling edge */
if (SHIFTREG_FALLING_EDGE(0x40))
- sample_start(1, 1, 0);
+ sample_start(samples, 1, 1, 0);
/* star sound - 0=off, 1=on */
if (SHIFTREG_RISING_EDGE(0x20))
- sample_start(2, 2, 1);
+ sample_start(samples, 2, 2, 1);
if (SHIFTREG_FALLING_EDGE(0x20))
- sample_stop(2);
+ sample_stop(samples, 2);
/* thrust sound - 1=off, 0=on*/
if (SHIFTREG_FALLING_EDGE(0x10))
- sample_start(3, 3, 1);
+ sample_start(samples, 3, 3, 1);
if (SHIFTREG_RISING_EDGE(0x10))
- sample_stop(3);
+ sample_stop(samples, 3);
/* drone - 1=off, 0=on */
if (SHIFTREG_FALLING_EDGE(0x08))
- sample_start(4, 4, 1);
+ sample_start(samples, 4, 4, 1);
if (SHIFTREG_RISING_EDGE(0x08))
- sample_stop(4);
+ sample_stop(samples, 4);
/* latch the drone pitch */
target_pitch = (current_shift & 7) + ((current_shift & 2) << 2);
@@ -1259,7 +1282,7 @@ static void wotw_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_c
current_pitch -= 300;
if (current_pitch < target_pitch)
current_pitch += 200;
- sample_set_freq(4, current_pitch);
+ sample_set_freq(samples, 4, current_pitch);
last_frame = video_screen_get_frame_number(machine->primary_screen);
}
@@ -1269,15 +1292,15 @@ static void wotw_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_c
/* loud explosion - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x02))
- sample_start(5, 5, 0);
+ sample_start(samples, 5, 5, 0);
/* soft explosion - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x04))
- sample_start(6, 6, 0);
+ sample_start(samples, 6, 6, 0);
/* player fire - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x08))
- sample_start(7, 7, 0);
+ sample_start(samples, 7, 7, 0);
}
static MACHINE_RESET( wotw )
@@ -1325,6 +1348,7 @@ static const samples_interface wotwc_samples_interface =
static void wotwc_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
{
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
UINT32 target_pitch;
/* on the rising edge of bit 0x10, clock bit 0x80 into the shift register */
@@ -1336,29 +1360,29 @@ static void wotwc_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_
{
/* fireball - falling edge */
if (SHIFTREG_FALLING_EDGE(0x80))
- sample_start(0, 0, 0);
+ sample_start(samples, 0, 0, 0);
/* shield hit - falling edge */
if (SHIFTREG_FALLING_EDGE(0x40))
- sample_start(1, 1, 0);
+ sample_start(samples, 1, 1, 0);
/* star sound - 0=off, 1=on */
if (SHIFTREG_RISING_EDGE(0x20))
- sample_start(2, 2, 1);
+ sample_start(samples, 2, 2, 1);
if (SHIFTREG_FALLING_EDGE(0x20))
- sample_stop(2);
+ sample_stop(samples, 2);
/* thrust sound - 1=off, 0=on*/
if (SHIFTREG_FALLING_EDGE(0x10))
- sample_start(3, 3, 1);
+ sample_start(samples, 3, 3, 1);
if (SHIFTREG_RISING_EDGE(0x10))
- sample_stop(3);
+ sample_stop(samples, 3);
/* drone - 1=off, 0=on */
if (SHIFTREG_FALLING_EDGE(0x08))
- sample_start(4, 4, 1);
+ sample_start(samples, 4, 4, 1);
if (SHIFTREG_RISING_EDGE(0x08))
- sample_stop(4);
+ sample_stop(samples, 4);
/* latch the drone pitch */
target_pitch = (current_shift & 7) + ((current_shift & 2) << 2);
@@ -1371,7 +1395,7 @@ static void wotwc_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_
current_pitch -= 300;
if (current_pitch < target_pitch)
current_pitch += 200;
- sample_set_freq(4, current_pitch);
+ sample_set_freq(samples, 4, current_pitch);
last_frame = video_screen_get_frame_number(machine->primary_screen);
}
@@ -1381,15 +1405,15 @@ static void wotwc_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_
/* loud explosion - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x02))
- sample_start(5, 5, 0);
+ sample_start(samples, 5, 5, 0);
/* soft explosion - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x04))
- sample_start(6, 6, 0);
+ sample_start(samples, 6, 6, 0);
/* player fire - falling edge */
if (SOUNDVAL_FALLING_EDGE(0x08))
- sample_start(7, 7, 0);
+ sample_start(samples, 7, 7, 0);
}
static MACHINE_RESET( wotwc )
@@ -1433,20 +1457,20 @@ static void demon_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_
}
-static READ8_HANDLER( sound_porta_r )
+static READ8_DEVICE_HANDLER( sound_porta_r )
{
/* bits 0-3 are the sound data; bit 4 is the data ready */
return sound_fifo[sound_fifo_out] | ((sound_fifo_in != sound_fifo_out) << 4);
}
-static READ8_HANDLER( sound_portb_r )
+static READ8_DEVICE_HANDLER( sound_portb_r )
{
return last_portb_write;
}
-static WRITE8_HANDLER( sound_portb_w )
+static WRITE8_DEVICE_HANDLER( sound_portb_w )
{
/* watch for a 0->1 edge on bit 0 ("shift out") to advance the data pointer */
if ((data & 1) != (last_portb_write & 1) && (data & 1) != 0)
@@ -1465,7 +1489,7 @@ static WRITE8_HANDLER( sound_portb_w )
}
-static WRITE8_HANDLER( sound_output_w )
+static WRITE8_DEVICE_HANDLER( sound_output_w )
{
logerror("sound_output = %02X\n", data);
}
@@ -1475,20 +1499,20 @@ static const ay8910_interface demon_ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- sound_porta_r,
- sound_portb_r,
- 0,
- sound_portb_w
+ DEVCB_HANDLER(sound_porta_r),
+ DEVCB_HANDLER(sound_portb_r),
+ DEVCB_NULL,
+ DEVCB_HANDLER(sound_portb_w)
};
static const ay8910_interface demon_ay8910_interface_3 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- 0,
- 0,
- 0,
- sound_output_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(sound_output_w)
};
@@ -1518,22 +1542,19 @@ static MACHINE_RESET( demon_sound )
last_portb_write = 0xff;
/* turn off channel A on AY8910 #0 because it is used as a low-pass filter */
- ay8910_set_volume(0, 0, 0);
+ ay8910_set_volume(devtag_get_device(machine, SOUND, "ay1"), 0, 0);
}
static ADDRESS_MAP_START( demon_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_ROM
AM_RANGE(0x3000, 0x33ff) AM_RAM
- AM_RANGE(0x4001, 0x4001) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x4002, 0x4002) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x4003, 0x4003) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x5001, 0x5001) AM_READ(ay8910_read_port_1_r)
- AM_RANGE(0x5002, 0x5002) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x5003, 0x5003) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x6001, 0x6001) AM_READ(ay8910_read_port_2_r)
- AM_RANGE(0x6002, 0x6002) AM_WRITE(ay8910_write_port_2_w)
- AM_RANGE(0x6003, 0x6003) AM_WRITE(ay8910_control_port_2_w)
+ AM_RANGE(0x4000, 0x4001) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0x4002, 0x4003) AM_DEVWRITE(SOUND, "ay1", ay8910_data_address_w)
+ AM_RANGE(0x5000, 0x5001) AM_DEVREAD(SOUND, "ay2", ay8910_r)
+ AM_RANGE(0x5002, 0x5003) AM_DEVWRITE(SOUND, "ay2", ay8910_data_address_w)
+ AM_RANGE(0x6000, 0x6001) AM_DEVREAD(SOUND, "ay3", ay8910_r)
+ AM_RANGE(0x6002, 0x6003) AM_DEVWRITE(SOUND, "ay3", ay8910_data_address_w)
AM_RANGE(0x7000, 0x7000) AM_WRITE(SMH_NOP) /* watchdog? */
ADDRESS_MAP_END
diff --git a/src/mame/audio/circus.c b/src/mame/audio/circus.c
index 782ff6f0724..c3607fa6cec 100644
--- a/src/mame/audio/circus.c
+++ b/src/mame/audio/circus.c
@@ -174,6 +174,9 @@ DISCRETE_SOUND_END
WRITE8_HANDLER( circus_clown_z_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+
clown_z = (data & 0x0f);
*(memory_region(space->machine, "main")+0x8000)=data; logerror("Z:%02x\n",data); //DEBUG
/* Bits 4-6 enable/disable trigger different events */
@@ -185,55 +188,55 @@ WRITE8_HANDLER( circus_clown_z_w )
switch ((data & 0x70) >> 4)
{
case 0 : /* All Off */
- discrete_sound_w(space, CIRCUS_MUSIC_BIT, 0);
+ discrete_sound_w(discrete, CIRCUS_MUSIC_BIT, 0);
break;
case 1 : /* Music */
- discrete_sound_w(space, CIRCUS_MUSIC_BIT, 1);
+ discrete_sound_w(discrete, CIRCUS_MUSIC_BIT, 1);
break;
case 2 : /* Circus = Pop; Rip Cord = Splash */
- sample_start (0, 0, 0);
+ sample_start (samples, 0, 0, 0);
break;
case 3 : /* Normal Video */
break;
case 4 : /* Circus = Miss; Rip Cord = Scream */
- sample_start (1, 1, 0);
+ sample_start (samples, 1, 1, 0);
break;
case 5 : /* Invert Video */
break;
case 6 : /* Circus = Bounce; Rip Cord = Chute Open */
- sample_start (2, 2, 0);
+ sample_start (samples, 2, 2, 0);
break;
case 7 : /* Circus = not used; Rip Cord = Whistle */
if GAME_IS_RIPCORD
- sample_start (3, 3, 0);
+ sample_start (samples, 3, 3, 0);
break;
}
break;
case 2: /* robotbwl */
- discrete_sound_w(space, ROBOTBWL_MUSIC_BIT, data & 0x08); /* Footsteps */
+ discrete_sound_w(discrete, ROBOTBWL_MUSIC_BIT, data & 0x08); /* Footsteps */
if (data & 0x40) /* Hit */
- sample_start (0, 0, 0);
+ sample_start (samples, 0, 0, 0);
if (data & 0x20) /* Roll */
- sample_start (1, 1, 0);
+ sample_start (samples, 1, 1, 0);
if (data & 0x10) /* Ball Drop */
- sample_start (2, 2, 0);
+ sample_start (samples, 2, 2, 0);
if (data & 0x02) /* Demerit */
- sample_start (3, 3, 0);
+ sample_start (samples, 3, 3, 0);
if (data & 0x01) /* Reward */
- sample_start (4, 4, 0);
+ sample_start (samples, 4, 4, 0);
// if (data & 0x04) /* Invert */
break;
@@ -243,26 +246,26 @@ WRITE8_HANDLER( circus_clown_z_w )
switch ((data & 0x70) >> 4)
{
case 0 : /* All Off */
- discrete_sound_w(space, CRASH_MUSIC_BIT, 0);
+ discrete_sound_w(discrete, CRASH_MUSIC_BIT, 0);
break;
case 1 : /* Music */
- discrete_sound_w(space, CRASH_MUSIC_BIT, 1);
+ discrete_sound_w(discrete, CRASH_MUSIC_BIT, 1);
break;
case 2 : /* Crash */
- sample_start (0, 0, 0);
+ sample_start (samples, 0, 0, 0);
break;
case 3 : /* Normal Video and Beep */
- discrete_sound_w(space, CRASH_BEEPER_EN, 0);
+ discrete_sound_w(discrete, CRASH_BEEPER_EN, 0);
break;
case 4 : /* Skid */
break;
case 5 : /* Invert Video and Beep */
- discrete_sound_w(space, CRASH_BEEPER_EN, 0);
+ discrete_sound_w(discrete, CRASH_BEEPER_EN, 0);
break;
case 6 : /* Hi Motor */
diff --git a/src/mame/audio/cps3.c b/src/mame/audio/cps3.c
index dc564fb157b..e1d28db90fe 100644
--- a/src/mame/audio/cps3.c
+++ b/src/mame/audio/cps3.c
@@ -10,7 +10,6 @@
#define CPS3_VOICES 16
static sound_stream *cps3_stream;
-extern UINT8* cps3_user5region;
typedef struct _cps3_voice_
{
@@ -97,18 +96,30 @@ static STREAM_UPDATE( cps3_stream_update )
}
-CUSTOM_START( cps3_sh_start )
+static DEVICE_START( cps3_sound )
{
/* Allocate the stream */
- cps3_stream = stream_create(device, 0, 2, clock / 384, NULL, cps3_stream_update);
+ cps3_stream = stream_create(device, 0, 2, device->clock / 384, NULL, cps3_stream_update);
memset(&chip, 0, sizeof(chip));
- chip.base = (INT8*)cps3_user5region;
+ chip.base = (INT8*)memory_region(device->machine,"user5");
+}
+
+DEVICE_GET_INFO( cps3_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(cps3_sound); break;
- return auto_malloc(1);
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "CPS3 Custom"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
}
+
WRITE32_HANDLER( cps3_sound_w )
{
stream_update(cps3_stream);
diff --git a/src/mame/audio/crbaloon.c b/src/mame/audio/crbaloon.c
index c11feb25427..48f30af3b57 100644
--- a/src/mame/audio/crbaloon.c
+++ b/src/mame/audio/crbaloon.c
@@ -30,43 +30,43 @@
-void crbaloon_audio_set_music_freq(const address_space *space, UINT8 freq)
+WRITE8_DEVICE_HANDLER( crbaloon_audio_set_music_freq )
{
- discrete_sound_w(space, CRBALOON_MUSIC_DATA, freq);
+ discrete_sound_w(device, CRBALOON_MUSIC_DATA, data);
}
-void crbaloon_audio_set_music_enable(const address_space *space, int enabled)
+WRITE8_DEVICE_HANDLER( crbaloon_audio_set_music_enable )
{
- discrete_sound_w(space, CRBALOON_MUSIC_EN, enabled);
+ discrete_sound_w(device, CRBALOON_MUSIC_EN, data);
}
-void crbaloon_audio_set_explosion_enable(int enabled)
+void crbaloon_audio_set_explosion_enable(const device_config *sn, int enabled)
{
- sn76477_enable_w(0, enabled);
+ sn76477_enable_w(sn, enabled);
}
-void crbaloon_audio_set_breath_enable(int enabled)
+void crbaloon_audio_set_breath_enable(const device_config *sn, int enabled)
{
/* changes slf_res to 10k (middle of two 10k resistors)
it also puts a tantal capacitor against GND on the output,
but this section of the schematics is not readable. */
- sn76477_slf_res_w(0, enabled ? RES_K(10) : RES_K(20) );
+ sn76477_slf_res_w(sn, enabled ? RES_K(10) : RES_K(20) );
}
-void crbaloon_audio_set_appear_enable(int enabled)
+void crbaloon_audio_set_appear_enable(const device_config *sn, int enabled)
{
/* APPEAR is connected to MIXER B */
- sn76477_mixer_b_w(0, enabled);
+ sn76477_mixer_b_w(sn, enabled);
}
-void crbaloon_audio_set_laugh_enable(const address_space *space, int enabled)
+WRITE8_DEVICE_HANDLER( crbaloon_audio_set_laugh_enable )
{
- discrete_sound_w(space, CRBALOON_LAUGH_EN, enabled);
+ discrete_sound_w(device, CRBALOON_LAUGH_EN, data);
}
diff --git a/src/mame/audio/cyberbal.c b/src/mame/audio/cyberbal.c
index f4c06f736e5..d748eea9e54 100644
--- a/src/mame/audio/cyberbal.c
+++ b/src/mame/audio/cyberbal.c
@@ -64,8 +64,7 @@ WRITE8_HANDLER( cyberbal_sound_bank_select_w )
coin_counter_w(1, (data >> 5) & 1);
coin_counter_w(0, (data >> 4) & 1);
cpu_set_input_line(space->machine->cpu[3], INPUT_LINE_RESET, (data & 0x08) ? CLEAR_LINE : ASSERT_LINE);
- if (!(data & 0x01)) sndti_reset(SOUND_YM2151, 0);
-
+ if (!(data & 0x01)) devtag_reset(space->machine, SOUND, "ym");
}
@@ -147,7 +146,8 @@ WRITE16_HANDLER( cyberbal_sound_68k_w )
WRITE16_HANDLER( cyberbal_sound_68k_dac_w )
{
- dac_data_16_w((offset >> 3) & 1, (((data >> 3) & 0x800) | ((data >> 2) & 0x7ff)) << 4);
+ const device_config *dac = devtag_get_device(space->machine, SOUND, (offset & 8) ? "dac2" : "dac1");
+ dac_data_16_w(dac, (((data >> 3) & 0x800) | ((data >> 2) & 0x7ff)) << 4);
if (fast_68k_int)
{
diff --git a/src/mame/audio/dcs.c b/src/mame/audio/dcs.c
index 6d5cff959c2..e5dfa79f676 100644
--- a/src/mame/audio/dcs.c
+++ b/src/mame/audio/dcs.c
@@ -293,6 +293,7 @@ struct _dcs_state
UINT8 channels;
UINT16 size;
UINT16 incs;
+ const device_config *dmadac[6];
emu_timer * reg_timer;
emu_timer * sport_timer;
emu_timer * internal_timer;
@@ -933,6 +934,7 @@ void dcs_init(running_machine *machine)
dcs.data = cpu_get_address_space(dcs.cpu, ADDRESS_SPACE_DATA);
dcs.rev = 1;
dcs.channels = 1;
+ dcs.dmadac[0] = devtag_get_device(machine, SOUND, "dac1");
/* configure boot and sound ROMs */
dcs.bootrom = (UINT16 *)memory_region(machine, "dcs");
@@ -982,6 +984,8 @@ void dcs2_init(running_machine *machine, int dram_in_mb, offs_t polling_offset)
dcs.program = cpu_get_address_space(dcs.cpu, ADDRESS_SPACE_PROGRAM);
dcs.data = cpu_get_address_space(dcs.cpu, ADDRESS_SPACE_DATA);
dcs.channels = 2;
+ dcs.dmadac[0] = devtag_get_device(machine, SOUND, "dac1");
+ dcs.dmadac[1] = devtag_get_device(machine, SOUND, "dac2");
/* always boot from the base of "dcs" */
dcs.bootrom = (UINT16 *)memory_region(machine, "dcs");
@@ -1246,7 +1250,7 @@ static WRITE16_HANDLER( sdrc_w )
/* offset 1 controls RAM mapping */
case 1:
sdrc.reg[1] = data;
-// dmadac_enable(0, dcs.channels, SDRC_MUTE);
+// dmadac_enable(&dcs.dmadac[0], dcs.channels, SDRC_MUTE);
if (diff & 0x0003)
sdrc_remap_memory(space->machine);
break;
@@ -1331,7 +1335,7 @@ static WRITE16_HANDLER( dsio_w )
dsio.reg[1] = data;
/* determine /MUTE and number of channels */
- dmadac_enable(0, dcs.channels, DSIO_MUTE);
+ dmadac_enable(&dcs.dmadac[0], dcs.channels, DSIO_MUTE);
/* bit 0 resets the FIFO */
midway_ioasic_fifo_reset_w(space->machine, DSIO_EMPTY_FIFO ^ 1);
@@ -1374,7 +1378,7 @@ static READ16_HANDLER( denver_r )
static WRITE16_HANDLER( denver_w )
{
- int enable, channels;
+ int enable, channels, chan;
switch (offset)
{
@@ -1390,9 +1394,15 @@ static WRITE16_HANDLER( denver_w )
if (channels != dcs.channels)
{
dcs.channels = channels;
- dmadac_enable(0, dcs.channels, enable);
+ for (chan = 0; chan < dcs.channels; chan++)
+ {
+ char buffer[10];
+ sprintf(buffer, "dac%d", chan);
+ dcs.dmadac[chan] = devtag_get_device(space->machine, SOUND, buffer);
+ }
+ dmadac_enable(&dcs.dmadac[0], dcs.channels, enable);
if (dcs.channels < 6)
- dmadac_enable(dcs.channels, 6 - dcs.channels, FALSE);
+ dmadac_enable(&dcs.dmadac[dcs.channels], 6 - dcs.channels, FALSE);
recompute_sample_rate(space->machine);
}
break;
@@ -1862,7 +1872,7 @@ static WRITE16_HANDLER( adsp_control_w )
/* see if SPORT1 got disabled */
if ((data & 0x0800) == 0)
{
- dmadac_enable(0, dcs.channels, 0);
+ dmadac_enable(&dcs.dmadac[0], dcs.channels, 0);
timer_adjust_oneshot(dcs.reg_timer, attotime_never, 0);
}
break;
@@ -1871,7 +1881,7 @@ static WRITE16_HANDLER( adsp_control_w )
/* autobuffer off: nuke the timer, and disable the DAC */
if ((data & 0x0002) == 0)
{
- dmadac_enable(0, dcs.channels, 0);
+ dmadac_enable(&dcs.dmadac[0], dcs.channels, 0);
timer_adjust_oneshot(dcs.reg_timer, attotime_never, 0);
}
break;
@@ -1936,7 +1946,7 @@ static TIMER_CALLBACK( dcs_irq )
}
if (dcs.channels)
- dmadac_transfer(0, dcs.channels, 1, dcs.channels, (dcs.size / 2) / dcs.channels, buffer);
+ dmadac_transfer(&dcs.dmadac[0], dcs.channels, 1, dcs.channels, (dcs.size / 2) / dcs.channels, buffer);
}
/* check for wrapping */
@@ -1977,8 +1987,8 @@ static void recompute_sample_rate(running_machine *machine)
/* now put it down to samples, so we know what the channel frequency has to be */
sample_period = attotime_mul(sample_period, 16 * dcs.channels);
- dmadac_set_frequency(0, dcs.channels, ATTOSECONDS_TO_HZ(sample_period.attoseconds));
- dmadac_enable(0, dcs.channels, 1);
+ dmadac_set_frequency(&dcs.dmadac[0], dcs.channels, ATTOSECONDS_TO_HZ(sample_period.attoseconds));
+ dmadac_enable(&dcs.dmadac[0], dcs.channels, 1);
/* fire off a timer wich will hit every half-buffer */
if (dcs.incs)
@@ -2034,7 +2044,7 @@ static void sound_tx_callback(const device_config *device, int port, INT32 data)
}
/* if we get there, something went wrong. Disable playing */
- dmadac_enable(0, dcs.channels, 0);
+ dmadac_enable(&dcs.dmadac[0], dcs.channels, 0);
/* remove timer */
timer_adjust_oneshot(dcs.reg_timer, attotime_never, 0);
diff --git a/src/mame/audio/depthch.c b/src/mame/audio/depthch.c
index 5307a397d96..3eb403cd678 100644
--- a/src/mame/audio/depthch.c
+++ b/src/mame/audio/depthch.c
@@ -13,8 +13,8 @@
#define OUT_PORT_1_SONAR 0x08
-#define PLAY(id,loop) sample_start( id, id, loop )
-#define STOP(id) sample_stop( id )
+#define PLAY(samp,id,loop) sample_start( samp, id, id, loop )
+#define STOP(samp,id) sample_stop( samp, id )
/* sample file names */
@@ -56,6 +56,7 @@ enum
WRITE8_HANDLER( depthch_audio_w )
{
static int port1State = 0;
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
int bitsChanged;
int bitsGoneHigh;
int bitsGoneLow;
@@ -69,25 +70,25 @@ WRITE8_HANDLER( depthch_audio_w )
if ( bitsGoneHigh & OUT_PORT_1_LONGEXPL )
{
- PLAY( SND_LONGEXPL, 0 );
+ PLAY( samples, SND_LONGEXPL, 0 );
}
if ( bitsGoneHigh & OUT_PORT_1_SHRTEXPL )
{
- PLAY( SND_SHRTEXPL, 0 );
+ PLAY( samples, SND_SHRTEXPL, 0 );
}
if ( bitsGoneHigh & OUT_PORT_1_SPRAY )
{
- PLAY( SND_SPRAY, 0 );
+ PLAY( samples, SND_SPRAY, 0 );
}
if ( bitsGoneHigh & OUT_PORT_1_SONAR )
{
- PLAY( SND_SONAR, 1 );
+ PLAY( samples, SND_SONAR, 1 );
}
if ( bitsGoneLow & OUT_PORT_1_SONAR )
{
- STOP( SND_SONAR );
+ STOP( samples, SND_SONAR );
}
}
diff --git a/src/mame/audio/dkong.c b/src/mame/audio/dkong.c
index 123113ba054..61a3c81ba7b 100644
--- a/src/mame/audio/dkong.c
+++ b/src/mame/audio/dkong.c
@@ -1074,10 +1074,10 @@ Addresses found at @0x510, cpu2
*/
-static WRITE8_HANDLER( M58817_command_w )
+static WRITE8_DEVICE_HANDLER( M58817_command_w )
{
- tms5110_ctl_w(space, 0, data & 0x0f);
- tms5110_pdc_w(space, 0, (data>>4) & 0x01);
+ tms5110_ctl_w(device, 0, data & 0x0f);
+ tms5110_pdc_w(device, 0, (data>>4) & 0x01);
/* FIXME 0x20 is CS */
}
@@ -1120,9 +1120,9 @@ static READ8_DEVICE_HANDLER( dkong_tune_r )
}
}
-static WRITE8_HANDLER( dkong_p1_w )
+static WRITE8_DEVICE_HANDLER( dkong_p1_w )
{
- discrete_sound_w(space,DS_DAC,data);
+ discrete_sound_w(device,DS_DAC,data);
}
@@ -1156,7 +1156,7 @@ static ADDRESS_MAP_START( dkong_sound_io_map, ADDRESS_SPACE_IO, 8 )
AM_WRITE(dkong_voice_w)
AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_DEVREAD(LATCH8, "ls175.3d", dkong_tune_r)
AM_WRITE(dkong_voice_w)
- AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(dkong_p1_w) /* only write to dac */
+ AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE(SOUND, "discrete", dkong_p1_w) /* only write to dac */
AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_LATCH8_READWRITE("virtual_p2")
AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_LATCH8_READBIT("ls259.6h", 5)
AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_LATCH8_READBIT("ls259.6h", 4)
@@ -1164,7 +1164,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( dkongjr_sound_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0x00) AM_MIRROR(0xff) AM_LATCH8_READ("ls174.3d")
- AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(dkong_p1_w) /* only write to dac */
+ AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE(SOUND, "discrete", dkong_p1_w) /* only write to dac */
AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_LATCH8_READWRITE("virtual_p2")
AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_LATCH8_READBIT("ls259.6h", 5)
AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_LATCH8_READBIT("ls259.6h", 4)
@@ -1172,9 +1172,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( radarsc1_sound_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0x00) AM_MIRROR(0xff) AM_DEVREAD(LATCH8, "ls175.3d", latch8_r)
- AM_RANGE(0x00, 0xff) AM_WRITE(dkong_p1_w) /* DAC here */
+ AM_RANGE(0x00, 0xff) AM_DEVWRITE(SOUND, "discrete", dkong_p1_w) /* DAC here */
AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_LATCH8_READ("virtual_p1")
- AM_WRITE(M58817_command_w)
+ AM_DEVWRITE(SOUND, "tms", M58817_command_w)
AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_LATCH8_WRITE("virtual_p2")
AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_LATCH8_READBIT("ls259.6h", 5)
AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_LATCH8_READBIT("ls259.6h", 4)
@@ -1184,16 +1184,16 @@ static ADDRESS_MAP_START( dkong3_sound1_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x01ff) AM_RAM
AM_RANGE(0x4016, 0x4016) AM_LATCH8_READ("latch1") /* overwrite default */
AM_RANGE(0x4017, 0x4017) AM_LATCH8_READ("latch2")
- AM_RANGE(0x4000, 0x4017) AM_READ(nes_psg_0_r)
- AM_RANGE(0x4000, 0x4017) AM_WRITE(nes_psg_0_w)
+ AM_RANGE(0x4000, 0x4017) AM_DEVREAD(SOUND, "nes1", nes_psg_r)
+ AM_RANGE(0x4000, 0x4017) AM_DEVWRITE(SOUND, "nes1", nes_psg_w)
AM_RANGE(0xe000, 0xffff) AM_ROM
ADDRESS_MAP_END
static ADDRESS_MAP_START( dkong3_sound2_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x01ff) AM_RAM
AM_RANGE(0x4016, 0x4016) AM_LATCH8_READ("latch3") /* overwrite default */
- AM_RANGE(0x4000, 0x4017) AM_READ(nes_psg_1_r)
- AM_RANGE(0x4000, 0x4017) AM_WRITE(nes_psg_1_w)
+ AM_RANGE(0x4000, 0x4017) AM_DEVREAD(SOUND, "nes2", nes_psg_r)
+ AM_RANGE(0x4000, 0x4017) AM_DEVWRITE(SOUND, "nes2", nes_psg_w)
AM_RANGE(0xe000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -1224,11 +1224,11 @@ MACHINE_DRIVER_START( dkong2b_audio )
MDRV_LATCH8_INVERT(0x0F)
MDRV_LATCH8_ADD("ls259.6h")
- MDRV_LATCH8_DISCRETE_NODE(0, DS_SOUND0_INP)
- MDRV_LATCH8_DISCRETE_NODE(1, DS_SOUND1_INP)
- MDRV_LATCH8_DISCRETE_NODE(2, DS_SOUND2_INP)
- MDRV_LATCH8_DISCRETE_NODE(6, DS_SOUND6_INP)
- MDRV_LATCH8_DISCRETE_NODE(7, DS_SOUND7_INP)
+ MDRV_LATCH8_DISCRETE_NODE("discrete", 0, DS_SOUND0_INP)
+ MDRV_LATCH8_DISCRETE_NODE("discrete", 1, DS_SOUND1_INP)
+ MDRV_LATCH8_DISCRETE_NODE("discrete", 2, DS_SOUND2_INP)
+ MDRV_LATCH8_DISCRETE_NODE("discrete", 6, DS_SOUND6_INP)
+ MDRV_LATCH8_DISCRETE_NODE("discrete", 7, DS_SOUND7_INP)
/* If P2.Bit7 -> is apparently an external signal decay or other output control
* If P2.Bit6 -> activates the external compressed sample ROM (not radarsc1)
@@ -1240,7 +1240,7 @@ MACHINE_DRIVER_START( dkong2b_audio )
MDRV_LATCH8_ADD( "virtual_p2" ) /* virtual latch for port B */
MDRV_LATCH8_INVERT( 0x20 ) /* signal is inverted */
MDRV_LATCH8_DEVREAD(5, LATCH8, "ls259.6h", latch8_r, 3)
- MDRV_LATCH8_DISCRETE_NODE(7, DS_DISCHARGE_INV)
+ MDRV_LATCH8_DISCRETE_NODE("discrete", 7, DS_DISCHARGE_INV)
MDRV_CPU_ADD("sound", MB8884, I8035_CLOCK)
MDRV_CPU_PROGRAM_MAP(dkong_sound_map,0)
@@ -1273,7 +1273,7 @@ MACHINE_DRIVER_START( radarsc1_audio )
MDRV_LATCH8_ADD( "virtual_p1" ) /* virtual latch for port A */
MDRV_LATCH8_INVERT( 0x80 ) /* signal is inverted */
MDRV_LATCH8_DEVREAD(7, LATCH8, "ls259.6h", latch8_r, 3)
- MDRV_LATCH8_READ(6, tms5110_status_r, 0)
+ MDRV_LATCH8_DEVREAD(6, SOUND, "tms", tms5110_status_r, 0)
MDRV_SOUND_ADD("tms", M58817, XTAL_640kHz)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
@@ -1288,13 +1288,13 @@ MACHINE_DRIVER_START( dkongjr_audio )
MDRV_LATCH8_MASKOUT(0xE0)
MDRV_LATCH8_ADD( "ls259.6h")
- MDRV_LATCH8_DISCRETE_NODE(0, DS_SOUND0_INP)
- MDRV_LATCH8_DISCRETE_NODE(1, DS_SOUND1_INP)
- MDRV_LATCH8_DISCRETE_NODE(2, DS_SOUND2_INP)
- MDRV_LATCH8_DISCRETE_NODE(7, DS_SOUND7_INP)
+ MDRV_LATCH8_DISCRETE_NODE("discrete", 0, DS_SOUND0_INP)
+ MDRV_LATCH8_DISCRETE_NODE("discrete", 1, DS_SOUND1_INP)
+ MDRV_LATCH8_DISCRETE_NODE("discrete", 2, DS_SOUND2_INP)
+ MDRV_LATCH8_DISCRETE_NODE("discrete", 7, DS_SOUND7_INP)
MDRV_LATCH8_ADD( "ls259.5h")
- MDRV_LATCH8_DISCRETE_NODE(1, DS_SOUND9_INP)
+ MDRV_LATCH8_DISCRETE_NODE("discrete", 1, DS_SOUND9_INP)
MDRV_LATCH8_ADD( "ls259.4h")
@@ -1303,7 +1303,7 @@ MACHINE_DRIVER_START( dkongjr_audio )
MDRV_LATCH8_DEVREAD(6, LATCH8, "ls259.4h", latch8_r, 1)
MDRV_LATCH8_DEVREAD(5, LATCH8, "ls259.6h", latch8_r, 3)
MDRV_LATCH8_DEVREAD(4, LATCH8, "ls259.6h", latch8_r, 6)
- MDRV_LATCH8_DISCRETE_NODE(7, DS_DISCHARGE_INV)
+ MDRV_LATCH8_DISCRETE_NODE("discrete", 7, DS_DISCHARGE_INV)
MDRV_CPU_ADD("sound", MB8884, I8035_CLOCK)
MDRV_CPU_PROGRAM_MAP(dkong_sound_map,0)
diff --git a/src/mame/audio/exidy.c b/src/mame/audio/exidy.c
index ddd4de6890b..75a89dee399 100644
--- a/src/mame/audio/exidy.c
+++ b/src/mame/audio/exidy.c
@@ -13,7 +13,6 @@
#include "machine/6532riot.h"
#include "sound/hc55516.h"
#include "sound/5220intf.h"
-#include "sound/custom.h"
#include "exidy.h"
@@ -377,7 +376,7 @@ static STREAM_UPDATE( exidy_stream_update )
*
*************************************/
-static void *common_sh_start(const device_config *device, int clock, const custom_sound_interface *config)
+static DEVICE_START( common_sh_start )
{
int sample_rate = SH8253_CLOCK;
@@ -387,29 +386,26 @@ static void *common_sh_start(const device_config *device, int clock, const custo
exidy_stream = stream_create(device, 0, 1, sample_rate, NULL, exidy_stream_update);
sh6840_register_state_globals(device->machine);
-
- return auto_malloc(1);
}
-CUSTOM_START( exidy_sh6840_sh_start )
+DEVICE_START( exidy_sound )
{
/* indicate no additional hardware */
has_sh8253 = FALSE;
has_tms5220 = FALSE;
has_mc3417 = FALSE;
- return common_sh_start(device, clock, config);
+ DEVICE_START_CALL(common_sh_start);
}
-
/*************************************
*
* Audio reset routines
*
*************************************/
-static void common_sh_reset(void *token)
+static DEVICE_RESET( common_sh_reset )
{
/* 6840 */
memset(sh6840_timer, 0, sizeof(sh6840_timer));
@@ -428,12 +424,26 @@ static void common_sh_reset(void *token)
sh6840_LFSR_3 = 0xffffffff;
}
-CUSTOM_RESET( exidy_sh6840_sh_reset )
+static DEVICE_RESET( exidy_sound )
{
- common_sh_reset(token);
+ DEVICE_RESET_CALL(common_sh_reset);
}
+DEVICE_GET_INFO( exidy_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(exidy_sound); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(exidy_sound); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Exidy SFX"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
+}
+
/*************************************
*
@@ -457,18 +467,18 @@ static void r6532_porta_w(const device_config *device, UINT8 newdata, UINT8 oldd
static void r6532_portb_w(const device_config *device, UINT8 newdata, UINT8 olddata)
{
- const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
- if (has_tms5220)
+ const device_config *tms = devtag_get_device(device->machine, SOUND, "tms");
+ if (device != NULL)
{
if ((olddata & 0x01) && !(newdata & 0x01))
{
- riot6532_porta_in_set(riot, tms5220_status_r(space, 0), 0xff);
- logerror("(%f)%s:TMS5220 status read = %02X\n", attotime_to_double(timer_get_time(device->machine)), cpuexec_describe_context(device->machine), tms5220_status_r(space, 0));
+ riot6532_porta_in_set(riot, tms5220_status_r(tms, 0), 0xff);
+ logerror("(%f)%s:TMS5220 status read = %02X\n", attotime_to_double(timer_get_time(device->machine)), cpuexec_describe_context(device->machine), tms5220_status_r(tms, 0));
}
if ((olddata & 0x02) && !(newdata & 0x02))
{
logerror("(%f)%s:TMS5220 data write = %02X\n", attotime_to_double(timer_get_time(device->machine)), cpuexec_describe_context(device->machine), riot6532_porta_out_get(riot));
- tms5220_data_w(space, 0, riot6532_porta_out_get(riot));
+ tms5220_data_w(tms, 0, riot6532_porta_out_get(riot));
}
}
}
@@ -479,9 +489,10 @@ static UINT8 r6532_portb_r(const device_config *device, UINT8 olddata)
UINT8 newdata = olddata;
if (has_tms5220)
{
+ const device_config *tms = devtag_get_device(device->machine, SOUND, "tms");
newdata &= ~0x0c;
- if (!tms5220_ready_r()) newdata |= 0x04;
- if (!tms5220_int_r()) newdata |= 0x08;
+ if (!tms5220_ready_r(tms)) newdata |= 0x04;
+ if (!tms5220_int_r(tms)) newdata |= 0x08;
}
return newdata;
}
@@ -703,49 +714,41 @@ static const pia6821_interface venture_pia_1_intf =
};
-static void *venture_common_sh_start(const device_config *device, int clock, const custom_sound_interface *config, int _has_tms5220)
+static DEVICE_START( venture_common_sh_start )
{
running_machine *machine = device->machine;
- int i;
- void *ret = common_sh_start(device, clock, config);
+ DEVICE_START_CALL(common_sh_start);
riot = device_list_find_by_tag(machine->config->devicelist, RIOT6532, "riot");
has_sh8253 = TRUE;
- has_tms5220 = _has_tms5220;
+ has_tms5220 = FALSE;
/* determine which sound hardware is installed */
- has_mc3417 = FALSE;
- for (i = 0; i < MAX_SOUND; i++)
- {
- if (machine->config->sound[i].type == SOUND_MC3417)
- has_mc3417 = TRUE;
- }
+ has_mc3417 = (devtag_get_device(device->machine, SOUND, "cvsd") != NULL);
/* 8253 */
freq_to_step = (double)(1 << 24) / (double)SH8253_CLOCK;
state_save_register_global(machine, riot_irq_state);
sh8253_register_state_globals(device->machine);
-
- return ret;
}
-static CUSTOM_START( venture_sh_start )
+static DEVICE_START( venture_sound )
{
running_machine *machine = device->machine;
pia_config(machine, 0, &venture_pia_0_intf);
pia_config(machine, 1, &venture_pia_1_intf);
- return venture_common_sh_start(device, clock, config, FALSE);
+ DEVICE_START_CALL(venture_common_sh_start);
}
-static CUSTOM_RESET( venture_sh_reset )
+static DEVICE_RESET( venture_sound )
{
- common_sh_reset(token);
+ DEVICE_RESET_CALL(common_sh_reset);
/* PIA */
pia_reset();
@@ -758,12 +761,22 @@ static CUSTOM_RESET( venture_sh_reset )
}
-static const custom_sound_interface venture_custom_interface =
+static DEVICE_GET_INFO( venture_sound )
{
- venture_sh_start,
- 0,
- venture_sh_reset
-};
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(venture_sound); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(venture_sound); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Exidy SFX+PSG"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
+}
+
+
+#define SOUND_EXIDY_VENTURE DEVICE_GET_INFO_NAME( venture_sound )
static ADDRESS_MAP_START( venture_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
@@ -788,8 +801,7 @@ MACHINE_DRIVER_START( venture_audio )
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("custom", CUSTOM, 0)
- MDRV_SOUND_CONFIG(venture_custom_interface)
+ MDRV_SOUND_ADD("custom", EXIDY_VENTURE, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MACHINE_DRIVER_END
@@ -804,7 +816,7 @@ MACHINE_DRIVER_END
static WRITE8_HANDLER( mtrap_voiceio_w )
{
if (!(offset & 0x10))
- hc55516_digit_w(0, data & 1);
+ hc55516_digit_w(devtag_get_device(space->machine, SOUND, "cvsd"), data & 1);
if (!(offset & 0x20))
riot6532_portb_in_set(riot, data & 1, 0xff);
@@ -823,7 +835,7 @@ static READ8_HANDLER( mtrap_voiceio_r )
}
if (!(offset & 0x40))
- return hc55516_clock_state_r(0) << 7;
+ return hc55516_clock_state_r(devtag_get_device(space->machine, SOUND, "cvsd")) << 7;
return 0;
}
@@ -930,20 +942,21 @@ static const pia6821_interface victory_pia_e5_intf =
};
-static CUSTOM_START( victory_sh_start )
+static DEVICE_START( victory_sound )
{
running_machine *machine = device->machine;
pia_config(machine, 1, &victory_pia_e5_intf);
state_save_register_global(machine, victory_sound_response_ack_clk);
- return venture_common_sh_start(device, clock, config, TRUE);
+ DEVICE_START_CALL(venture_common_sh_start);
+ has_tms5220 = TRUE;
}
-static CUSTOM_RESET( victory_sh_reset )
+static DEVICE_RESET( victory_sound )
{
- common_sh_reset(token);
+ DEVICE_RESET_CALL(common_sh_reset);
pia_reset();
device_reset(riot);
memset(sh8253_timer, 0, sizeof(sh8253_timer));
@@ -959,12 +972,22 @@ static CUSTOM_RESET( victory_sh_reset )
}
-static const custom_sound_interface victory_custom_interface =
+static DEVICE_GET_INFO( victory_sound )
{
- victory_sh_start,
- 0,
- victory_sh_reset,
-};
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(victory_sound); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(victory_sound); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Exidy SFX+PSG+Speech"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
+}
+
+
+#define SOUND_EXIDY_VICTORY DEVICE_GET_INFO_NAME( victory_sound )
static ADDRESS_MAP_START( victory_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
@@ -989,8 +1012,7 @@ MACHINE_DRIVER_START( victory_audio )
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("custom", CUSTOM, 0)
- MDRV_SOUND_CONFIG(victory_custom_interface)
+ MDRV_SOUND_ADD("custom", EXIDY_VICTORY, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD("tms", TMS5220, 640000)
diff --git a/src/mame/audio/exidy440.c b/src/mame/audio/exidy440.c
index 8fa3b2ac9fa..20d67d8f2b8 100644
--- a/src/mame/audio/exidy440.c
+++ b/src/mame/audio/exidy440.c
@@ -131,7 +131,7 @@ static void fir_filter(INT32 *input, INT16 *output, int count);
*
*************************************/
-static CUSTOM_START( exidy440_sh_start )
+static DEVICE_START( exidy440_sound )
{
running_machine *machine = device->machine;
int i, length;
@@ -156,13 +156,13 @@ static CUSTOM_START( exidy440_sh_start )
state_save_register_global(machine, m6844_interrupt);
state_save_register_global(machine, m6844_chain);
- channel_frequency[0] = clock; /* channels 0 and 1 are run by FCLK */
- channel_frequency[1] = clock;
- channel_frequency[2] = clock/2; /* channels 2 and 3 are run by SCLK */
- channel_frequency[3] = clock/2;
+ channel_frequency[0] = device->clock; /* channels 0 and 1 are run by FCLK */
+ channel_frequency[1] = device->clock;
+ channel_frequency[2] = device->clock/2; /* channels 2 and 3 are run by SCLK */
+ channel_frequency[3] = device->clock/2;
/* get stream channels */
- stream = stream_create(device, 0, 2, clock, NULL, channel_update);
+ stream = stream_create(device, 0, 2, device->clock, NULL, channel_update);
/* allocate the sample cache */
length = memory_region_length(machine, "cvsd") * 16 + MAX_CACHE_ENTRIES * sizeof(sound_cache_entry);
@@ -173,13 +173,11 @@ static CUSTOM_START( exidy440_sh_start )
reset_sound_cache();
/* allocate the mixer buffer */
- mixer_buffer_left = auto_malloc(2 * clock * sizeof(INT32));
- mixer_buffer_right = mixer_buffer_left + clock;
+ mixer_buffer_left = auto_malloc(2 * device->clock * sizeof(INT32));
+ mixer_buffer_right = mixer_buffer_left + device->clock;
if (SOUND_LOG)
debuglog = fopen("sound.log", "w");
-
- return auto_malloc(1);
}
@@ -190,7 +188,7 @@ static CUSTOM_START( exidy440_sh_start )
*
*************************************/
-static CUSTOM_STOP( exidy440_sh_stop )
+static DEVICE_STOP( exidy440_sound )
{
if (SOUND_LOG && debuglog)
fclose(debuglog);
@@ -915,11 +913,22 @@ ADDRESS_MAP_END
*
*************************************/
-static const custom_sound_interface custom_interface =
+static DEVICE_GET_INFO( exidy440_sound )
{
- exidy440_sh_start,
- exidy440_sh_stop
-};
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(exidy440_sound); break;
+ case DEVINFO_FCT_STOP: info->stop = DEVICE_STOP_NAME(exidy440_sound); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Exidy 440 CVSD"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
+}
+
+
+#define SOUND_EXIDY440 DEVICE_GET_INFO_NAME( exidy440_sound )
@@ -937,8 +946,7 @@ MACHINE_DRIVER_START( exidy440_audio )
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("custom", CUSTOM, EXIDY440_MASTER_CLOCK/256)
- MDRV_SOUND_CONFIG(custom_interface)
+ MDRV_SOUND_ADD("custom", EXIDY440, EXIDY440_MASTER_CLOCK/256)
MDRV_SOUND_ROUTE(0, "left", 1.0)
MDRV_SOUND_ROUTE(1, "right", 1.0)
diff --git a/src/mame/audio/fghtbskt.c b/src/mame/audio/fghtbskt.c
index b409791929d..d3ab1ef1229 100644
--- a/src/mame/audio/fghtbskt.c
+++ b/src/mame/audio/fghtbskt.c
@@ -12,7 +12,10 @@ static INT16 *samplebuf;
WRITE8_HANDLER( fghtbskt_samples_w )
{
if( data & 1 )
- sample_start_raw(0, samplebuf + ((data & 0xf0) << 8), 0x2000, 8000, 0);
+ {
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
+ sample_start_raw(samples, 0, samplebuf + ((data & 0xf0) << 8), 0x2000, 8000, 0);
+ }
}
SAMPLES_START( fghtbskt_sh_start )
diff --git a/src/mame/audio/firetrk.c b/src/mame/audio/firetrk.c
index bd489763c26..104a5ea5db2 100644
--- a/src/mame/audio/firetrk.c
+++ b/src/mame/audio/firetrk.c
@@ -9,62 +9,62 @@
#include "sound/discrete.h"
-WRITE8_HANDLER( firetrk_skid_reset_w )
+WRITE8_DEVICE_HANDLER( firetrk_skid_reset_w )
{
firetrk_skid[0] = 0;
firetrk_skid[1] = 0;
// also SUPERBUG_SKID_EN
- discrete_sound_w(space, FIRETRUCK_SKID_EN, 1);
+ discrete_sound_w(device, FIRETRUCK_SKID_EN, 1);
}
-WRITE8_HANDLER( montecar_skid_reset_w )
+WRITE8_DEVICE_HANDLER( montecar_skid_reset_w )
{
- discrete_sound_w(space, MONTECAR_SKID_EN, 1);
+ discrete_sound_w(device, MONTECAR_SKID_EN, 1);
}
-WRITE8_HANDLER( firetrk_crash_snd_w )
+WRITE8_DEVICE_HANDLER( firetrk_crash_snd_w )
{
// also SUPERBUG_CRASH_DATA and MONTECAR_CRASH_DATA
- discrete_sound_w(space, FIRETRUCK_CRASH_DATA, data >> 4);
+ discrete_sound_w(device, FIRETRUCK_CRASH_DATA, data >> 4);
}
-WRITE8_HANDLER( firetrk_skid_snd_w )
+WRITE8_DEVICE_HANDLER( firetrk_skid_snd_w )
{
// also SUPERBUG_SKID_EN and MONTECAR_SKID_EN
- discrete_sound_w(space, FIRETRUCK_SKID_EN, 0);
+ discrete_sound_w(device, FIRETRUCK_SKID_EN, 0);
}
-WRITE8_HANDLER( firetrk_motor_snd_w )
+WRITE8_DEVICE_HANDLER( firetrk_motor_snd_w )
{
// also MONTECAR_DRONE_MOTOR_DATA
- discrete_sound_w(space, FIRETRUCK_SIREN_DATA, data >> 4);
+ discrete_sound_w(device, FIRETRUCK_SIREN_DATA, data >> 4);
// also MONTECAR_MOTOR_DATA
- discrete_sound_w(space, FIRETRUCK_MOTOR_DATA, data & 0x0f);
+ discrete_sound_w(device, FIRETRUCK_MOTOR_DATA, data & 0x0f);
}
-WRITE8_HANDLER( superbug_motor_snd_w )
+WRITE8_DEVICE_HANDLER( superbug_motor_snd_w )
{
- discrete_sound_w(space, SUPERBUG_SPEED_DATA, data & 0x0f);
+ discrete_sound_w(device, SUPERBUG_SPEED_DATA, data & 0x0f);
}
-WRITE8_HANDLER( firetrk_xtndply_w )
+WRITE8_DEVICE_HANDLER( firetrk_xtndply_w )
{
- discrete_sound_w(space, FIRETRUCK_XTNDPLY_EN, data);
+ discrete_sound_w(device, FIRETRUCK_XTNDPLY_EN, data);
}
-WRITE8_HANDLER( superbug_asr_w )
+WRITE8_DEVICE_HANDLER( superbug_asr_w )
{
popmessage("ASR");
- discrete_sound_w(space, SUPERBUG_ASR_EN, 1); /* ASR */
+ discrete_sound_w(device, SUPERBUG_ASR_EN, 1); /* ASR */
}
diff --git a/src/mame/audio/flower.c b/src/mame/audio/flower.c
index 604b4186a29..d699ae3d4d8 100644
--- a/src/mame/audio/flower.c
+++ b/src/mame/audio/flower.c
@@ -52,7 +52,7 @@ static short *mixer_buffer_2;
/* build a table to divide by the number of voices; gain is specified as gain*16 */
-static int make_mixer_table(int voices, int gain)
+static void make_mixer_table(int voices, int gain)
{
int count = voices * 128;
int i;
@@ -71,8 +71,6 @@ static int make_mixer_table(int voices, int gain)
mixer_lookup[ i] = val;
mixer_lookup[-i] = -val;
}
-
- return 0;
}
@@ -154,7 +152,7 @@ static STREAM_UPDATE( flower_update_mono )
-CUSTOM_START( flower_sh_start )
+static DEVICE_START( flower_sound )
{
running_machine *machine = device->machine;
sound_channel *voice;
@@ -168,8 +166,7 @@ CUSTOM_START( flower_sh_start )
mixer_buffer_2 = mixer_buffer + samplerate;
/* build the mixer table */
- if (make_mixer_table(8, defgain))
- return NULL;
+ make_mixer_table(8, defgain);
/* extract globals from the interface */
num_voices = 8;
@@ -202,8 +199,20 @@ CUSTOM_START( flower_sh_start )
state_save_register_item(machine, "flower_custom", NULL, i+1, voice->oneshotplaying);
state_save_register_item(machine, "flower_custom", NULL, i+1, voice->rom_offset);
}
+}
- return auto_malloc(1);
+
+DEVICE_GET_INFO( flower_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(flower_sound); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Flower Custom"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
}
diff --git a/src/mame/audio/galaxian.c b/src/mame/audio/galaxian.c
index e130e6ddbbc..a9b1cac2bd4 100644
--- a/src/mame/audio/galaxian.c
+++ b/src/mame/audio/galaxian.c
@@ -154,8 +154,9 @@ static TIMER_CALLBACK( noise_timer_cb )
{
if( !noise_enable && noisevolume > 0 )
{
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
noisevolume -= (noisevolume / 10) + 1;
- sample_set_volume(CHANNEL_NOISE,noisevolume / 100.0);
+ sample_set_volume(samples, CHANNEL_NOISE,noisevolume / 100.0);
}
}
@@ -165,8 +166,9 @@ WRITE8_HANDLER( galaxian_noise_enable_w )
if( noise_enable )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
noisevolume = 100;
- sample_set_volume(CHANNEL_NOISE,noisevolume / 100.0);
+ sample_set_volume(samples, CHANNEL_NOISE,noisevolume / 100.0);
}
}
@@ -174,8 +176,9 @@ WRITE8_HANDLER( galaxian_shoot_enable_w )
{
if( data & 1 && !(last_port2 & 1) )
{
- sample_start_raw(CHANNEL_SHOOT, shootwave, shoot_length, shoot_rate, 0);
- sample_set_volume(CHANNEL_SHOOT,SHOOT_VOLUME);
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
+ sample_start_raw(samples, CHANNEL_SHOOT, shootwave, shoot_length, shoot_rate, 0);
+ sample_set_volume(samples, CHANNEL_SHOOT,SHOOT_VOLUME);
}
last_port2=data;
}
@@ -188,11 +191,11 @@ static SAMPLES_START( galaxian_sh_start )
freq = MAXFREQ;
- sample_set_volume(CHANNEL_NOISE, NOISE_VOLUME);
- sample_set_volume(CHANNEL_SHOOT, SHOOT_VOLUME);
- sample_set_volume(CHANNEL_LFO+0, LFO_VOLUME);
- sample_set_volume(CHANNEL_LFO+1, LFO_VOLUME);
- sample_set_volume(CHANNEL_LFO+2, LFO_VOLUME);
+ sample_set_volume(device, CHANNEL_NOISE, NOISE_VOLUME);
+ sample_set_volume(device, CHANNEL_SHOOT, SHOOT_VOLUME);
+ sample_set_volume(device, CHANNEL_LFO+0, LFO_VOLUME);
+ sample_set_volume(device, CHANNEL_LFO+1, LFO_VOLUME);
+ sample_set_volume(device, CHANNEL_LFO+2, LFO_VOLUME);
noisewave = auto_malloc(NOISE_LENGTH * sizeof(INT16));
@@ -379,18 +382,18 @@ static SAMPLES_START( galaxian_sh_start )
tone_stream = stream_create(device,0,1,SOUND_CLOCK/STEPS,NULL,tone_update);
stream_set_output_gain(tone_stream, 0, TOOTHSAW_VOLUME);
- sample_set_volume(CHANNEL_NOISE,0);
- sample_start_raw(CHANNEL_NOISE,noisewave,NOISE_LENGTH,NOISE_RATE,1);
+ sample_set_volume(device, CHANNEL_NOISE,0);
+ sample_start_raw(device, CHANNEL_NOISE,noisewave,NOISE_LENGTH,NOISE_RATE,1);
- sample_set_volume(CHANNEL_SHOOT,0);
- sample_start_raw(CHANNEL_SHOOT,shootwave,SHOOT_LENGTH,SHOOT_RATE,1);
+ sample_set_volume(device, CHANNEL_SHOOT,0);
+ sample_start_raw(device, CHANNEL_SHOOT,shootwave,SHOOT_LENGTH,SHOOT_RATE,1);
- sample_set_volume(CHANNEL_LFO+0,0);
- sample_start_raw(CHANNEL_LFO+0,backgroundwave,ARRAY_LENGTH(backgroundwave),1000,1);
- sample_set_volume(CHANNEL_LFO+1,0);
- sample_start_raw(CHANNEL_LFO+1,backgroundwave,ARRAY_LENGTH(backgroundwave),1000,1);
- sample_set_volume(CHANNEL_LFO+2,0);
- sample_start_raw(CHANNEL_LFO+2,backgroundwave,ARRAY_LENGTH(backgroundwave),1000,1);
+ sample_set_volume(device, CHANNEL_LFO+0,0);
+ sample_start_raw(device, CHANNEL_LFO+0,backgroundwave,ARRAY_LENGTH(backgroundwave),1000,1);
+ sample_set_volume(device, CHANNEL_LFO+1,0);
+ sample_start_raw(device, CHANNEL_LFO+1,backgroundwave,ARRAY_LENGTH(backgroundwave),1000,1);
+ sample_set_volume(device, CHANNEL_LFO+2,0);
+ sample_start_raw(device, CHANNEL_LFO+2,backgroundwave,ARRAY_LENGTH(backgroundwave),1000,1);
noisetimer = timer_alloc(machine, noise_timer_cb, NULL);
timer_adjust_periodic(noisetimer, ATTOTIME_IN_NSEC((155000+22000)/100*693*22), 0, ATTOTIME_IN_NSEC((155000+22000)/100*693*22));
@@ -414,7 +417,8 @@ static SAMPLES_START( galaxian_sh_start )
WRITE8_HANDLER( galaxian_background_enable_w )
{
- sample_set_volume(CHANNEL_LFO+offset,(data & 1) ? LFO_VOLUME : 0);
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
+ sample_set_volume(samples, CHANNEL_LFO+offset,(data & 1) ? LFO_VOLUME : 0);
}
static TIMER_CALLBACK( lfo_timer_cb )
@@ -538,6 +542,8 @@ WRITE8_HANDLER( galaxian_lfo_freq_w )
static TIMER_CALLBACK( galaxian_sh_update )
{
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
+
/*
* NE555 8R, 8S and 8T are used as pulse position modulators
* FS1 Ra=100k, Rb=470k and C=0.01uF
@@ -548,9 +554,9 @@ static TIMER_CALLBACK( galaxian_sh_update )
* -> 0.693 * 540k * 0.01uF -> 3742.2us = 267Hz
*/
- sample_set_freq(CHANNEL_LFO+0, sizeof(backgroundwave)*freq*(100+2*470)/(100+2*470) );
- sample_set_freq(CHANNEL_LFO+1, sizeof(backgroundwave)*freq*(100+2*330)/(100+2*470) );
- sample_set_freq(CHANNEL_LFO+2, sizeof(backgroundwave)*freq*(100+2*220)/(100+2*470) );
+ sample_set_freq(samples, CHANNEL_LFO+0, sizeof(backgroundwave)*freq*(100+2*470)/(100+2*470) );
+ sample_set_freq(samples, CHANNEL_LFO+1, sizeof(backgroundwave)*freq*(100+2*330)/(100+2*470) );
+ sample_set_freq(samples, CHANNEL_LFO+2, sizeof(backgroundwave)*freq*(100+2*220)/(100+2*470) );
}
diff --git a/src/mame/audio/geebee.c b/src/mame/audio/geebee.c
index fb704493a1e..26f3922469f 100644
--- a/src/mame/audio/geebee.c
+++ b/src/mame/audio/geebee.c
@@ -10,7 +10,6 @@
#include <math.h>
#include "driver.h"
#include "streams.h"
-#include "sound/custom.h"
#include "includes/warpwarp.h"
static emu_timer *volume_timer = NULL;
@@ -112,7 +111,7 @@ static STREAM_UPDATE( geebee_sound_update )
}
}
-CUSTOM_START( geebee_sh_start )
+static DEVICE_START( geebee_sound )
{
running_machine *machine = device->machine;
int i;
@@ -127,5 +126,19 @@ CUSTOM_START( geebee_sh_start )
vcount = 0;
volume_timer = timer_alloc(machine, volume_decay, NULL);
- return auto_malloc(1);
}
+
+DEVICE_GET_INFO( geebee_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(geebee_sound); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Gee Bee Custom"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
+}
+
+
diff --git a/src/mame/audio/gomoku.c b/src/mame/audio/gomoku.c
index fbe6bfc3536..4d33932d43f 100644
--- a/src/mame/audio/gomoku.c
+++ b/src/mame/audio/gomoku.c
@@ -53,7 +53,7 @@ static short *mixer_buffer_2;
/* build a table to divide by the number of voices; gain is specified as gain*16 */
-static int make_mixer_table(int voices, int gain)
+static void make_mixer_table(int voices, int gain)
{
int count = voices * 128;
int i;
@@ -72,8 +72,6 @@ static int make_mixer_table(int voices, int gain)
mixer_lookup[ i] = val;
mixer_lookup[-i] = -val;
}
-
- return 0;
}
@@ -162,7 +160,7 @@ static STREAM_UPDATE( gomoku_update_mono )
-CUSTOM_START( gomoku_sh_start )
+static DEVICE_START( gomoku_sound )
{
running_machine *machine = device->machine;
sound_channel *voice;
@@ -176,8 +174,7 @@ CUSTOM_START( gomoku_sh_start )
mixer_buffer_2 = mixer_buffer + samplerate;
/* build the mixer table */
- if (make_mixer_table(8, defgain))
- return NULL;
+ make_mixer_table(8, defgain);
/* extract globals from the interface */
num_voices = MAX_VOICES;
@@ -197,8 +194,20 @@ CUSTOM_START( gomoku_sh_start )
voice->volume = 0;
voice->oneshotplaying = 0;
}
+}
- return auto_malloc(1);
+
+DEVICE_GET_INFO( gomoku_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(gomoku_sound); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Gomoku Custom"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
}
diff --git a/src/mame/audio/gorf.c b/src/mame/audio/gorf.c
index 1951027180a..cec76bc9d61 100644
--- a/src/mame/audio/gorf.c
+++ b/src/mame/audio/gorf.c
@@ -19,7 +19,6 @@ gorf_sh_ update- Null
#include "driver.h"
#include "cpu/z80/z80.h"
-#include "sound/custom.h"
#include "sound/samples.h"
#include "includes/astrocde.h"
@@ -117,6 +116,7 @@ static int plural = 0;
READ8_HANDLER( gorf_speech_r )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
int Phoneme,Intonation;
int i = 0;
@@ -131,7 +131,7 @@ READ8_HANDLER( gorf_speech_r )
logerror("Date : %d Speech : %s at intonation %d\n",Phoneme, PhonemeTable[Phoneme],Intonation);
if(Phoneme==63) {
- sample_stop(0);
+ sample_stop(samples, 0);
if (strlen(totalword)>2) logerror("Clearing sample %s\n",totalword);
totalword[0] = 0; /* Clear the total word stack */
return data;
@@ -144,8 +144,8 @@ READ8_HANDLER( gorf_speech_r )
if (plural != 0) {
logerror("found a possible plural at %d\n",plural-1);
if (!strcmp("S",totalword)) { /* Plural check */
- sample_start(0, num_samples-2, 0); /* play the sample at position of word */
- sample_set_freq(0, 11025); /* play at correct rate */
+ sample_start(samples, 0, num_samples-2, 0); /* play the sample at position of word */
+ sample_set_freq(samples, 0, 11025); /* play at correct rate */
totalword[0] = 0; /* Clear the total word stack */
oldword[0] = 0; /* Clear the total word stack */
return data;
@@ -167,8 +167,8 @@ READ8_HANDLER( gorf_speech_r )
} else {
plural=0;
}
- sample_start(0, i, 0); /* play the sample at position of word */
- sample_set_freq(0, 11025); /* play at correct rate */
+ sample_start(samples, 0, i, 0); /* play the sample at position of word */
+ sample_set_freq(samples, 0, 11025); /* play at correct rate */
logerror("Playing sample %d",i);
totalword[0] = 0; /* Clear the total word stack */
return data;
@@ -182,5 +182,6 @@ READ8_HANDLER( gorf_speech_r )
CUSTOM_INPUT( gorf_speech_status_r )
{
- return !sample_playing(0);
+ const device_config *samples = devtag_get_device(field->port->machine, SOUND, "samples");
+ return !sample_playing(samples, 0);
}
diff --git a/src/mame/audio/gottlieb.c b/src/mame/audio/gottlieb.c
index f18d3030949..ca2ba51429b 100644
--- a/src/mame/audio/gottlieb.c
+++ b/src/mame/audio/gottlieb.c
@@ -43,7 +43,7 @@ static int random_offset;
static void gottlieb1_sh_w(const device_config *riot, UINT8 data);
static void gottlieb2_sh_w(const address_space *space, UINT8 data);
-static void trigger_sample(running_machine *machine, UINT8 data);
+static void trigger_sample(const device_config *samples, UINT8 data);
@@ -74,12 +74,13 @@ WRITE8_HANDLER( gottlieb_sh_w )
static void gottlieb1_sh_w(const device_config *riot, UINT8 data)
{
+ const device_config *samples = devtag_get_device(riot->machine, SOUND, "samples");
int pa7 = (data & 0x0f) != 0xf;
int pa0_5 = ~data & 0x3f;
/* snoop the data looking for commands that need samples */
- if (pa7 && sndti_exists(SOUND_SAMPLES, 0))
- trigger_sample(riot->machine, pa0_5);
+ if (pa7 && samples != NULL)
+ trigger_sample(samples, pa0_5);
/* write the command data to the low 6 bits, and the trigger to the upper bit */
riot6532_porta_in_set(riot, pa0_5 | (pa7 << 7), 0xbf);
@@ -129,27 +130,27 @@ static const riot6532_interface gottlieb_riot6532_intf =
*
*************************************/
-static void play_sample(const char *phonemes)
+static void play_sample(const device_config *samples, const char *phonemes)
{
if (strcmp(phonemes, " HEH3LOOW AH1EH3I3YMTERI2NDAHN") == 0) /* Q-Bert - Hello, I am turned on */
- sample_start(0, 42, 0);
+ sample_start(samples, 0, 42, 0);
else if (strcmp(phonemes, "BAH1EH1Y") == 0) /* Q-Bert - Bye, bye */
- sample_start(0, 43, 0);
+ sample_start(samples, 0, 43, 0);
else if (strcmp(phonemes, "A2YHT LEH2FTTH") == 0) /* Reactor - Eight left */
- sample_start(0, 0, 0);
+ sample_start(samples, 0, 0, 0);
else if (strcmp(phonemes, "SI3KS DTYN LEH2FTTH") == 0) /* Reactor - Sixteen left */
- sample_start(0, 1, 0);
+ sample_start(samples, 0, 1, 0);
else if (strcmp(phonemes, "WO2RNYNG KO2R UH1NSDTABUH1L") == 0) /* Reactor - Warning core unstable */
- sample_start(0, 5, 0);
+ sample_start(samples, 0, 5, 0);
else if (strcmp(phonemes, "CHAMBERR AE1EH2KTI1VA1I3DTEH1DT ") == 0) /* Reactor - Chamber activated */
- sample_start(0, 7, 0);
+ sample_start(samples, 0, 7, 0);
}
-static void trigger_sample(running_machine *machine, UINT8 data)
+static void trigger_sample(const device_config *samples, UINT8 data)
{
/* Reactor samples */
- if (strcmp(machine->gamedrv->name, "reactor") == 0)
+ if (strcmp(samples->machine->gamedrv->name, "reactor") == 0)
{
switch (data)
{
@@ -157,7 +158,7 @@ static void trigger_sample(running_machine *machine, UINT8 data)
case 56:
case 57:
case 59:
- sample_start(0, data - 53, 0);
+ sample_start(samples, 0, data - 53, 0);
break;
case 31:
@@ -167,7 +168,7 @@ static void trigger_sample(running_machine *machine, UINT8 data)
case 39:
score_sample++;
if (score_sample < 20)
- sample_start(0, score_sample, 0);
+ sample_start(samples, 0, score_sample, 0);
break;
}
}
@@ -182,16 +183,16 @@ static void trigger_sample(running_machine *machine, UINT8 data)
case 19:
case 20:
case 21:
- sample_start(0, (data - 17) * 8 + random_offset, 0);
+ sample_start(samples, 0, (data - 17) * 8 + random_offset, 0);
random_offset = (random_offset + 1) & 7;
break;
case 22:
- sample_start(0,40,0);
+ sample_start(samples, 0,40,0);
break;
case 23:
- sample_start(0,41,0);
+ sample_start(samples, 0,41,0);
break;
}
}
@@ -201,11 +202,12 @@ static void trigger_sample(running_machine *machine, UINT8 data)
#ifdef UNUSED_FUNCTION
void gottlieb_knocker(running_machine *machine)
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
if (!strcmp(machine->gamedrv->name,"reactor")) /* reactor */
{
}
- else if (sndti_exists(SOUND_SAMPLES, 0)) /* qbert */
- sample_start(0,44,0);
+ else if (samples != NULL) /* qbert */
+ sample_start(samples, 0,44,0);
}
#endif
@@ -248,6 +250,7 @@ logerror("Votrax: intonation %d, phoneme %02x %s\n",data >> 6,data & 0x3f,Phonem
{
if (votrax_queuepos > 1)
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
int last = -1;
int i;
char phonemes[200];
@@ -265,7 +268,7 @@ logerror("Votrax: intonation %d, phoneme %02x %s\n",data >> 6,data & 0x3f,Phonem
}
printf("Votrax played '%s'\n", phonemes);
- play_sample(phonemes);
+ play_sample(samples, phonemes);
#if 0
popmessage("%s", phonemes);
#endif
@@ -315,7 +318,7 @@ static ADDRESS_MAP_START( gottlieb_sound1_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_GLOBAL_MASK(0x7fff)
AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x0d80) AM_RAM
AM_RANGE(0x0200, 0x021f) AM_MIRROR(0x0de0) AM_DEVREADWRITE(RIOT6532, "riot", riot6532_r, riot6532_w)
- AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x0fff) AM_WRITE(dac_0_data_w)
+ AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x0fff) AM_DEVWRITE(SOUND, "dac", dac_w)
AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x0fff) AM_WRITE(vortrax_data_w)
AM_RANGE(0x3000, 0x3000) AM_MIRROR(0x0fff) AM_WRITE(speech_clock_dac_w)
AM_RANGE(0x6000, 0x7fff) AM_ROM
@@ -472,16 +475,16 @@ static WRITE8_HANDLER( nmi_rate_w )
static CUSTOM_INPUT( speech_drq_custom_r )
{
- return sp0250_drq_r();
+ return sp0250_drq_r(devtag_get_device(field->port->machine, SOUND, "sp"));
}
-static WRITE8_HANDLER( dac_w )
+static WRITE8_DEVICE_HANDLER( gottlieb_dac_w )
{
/* dual DAC; the first DAC serves as the reference voltage for the
second, effectively scaling the output */
dac_data[offset] = data;
- dac_data_16_w(0, dac_data[0] * dac_data[1]);
+ dac_data_16_w(device, dac_data[0] * dac_data[1]);
}
@@ -499,33 +502,26 @@ static WRITE8_HANDLER( speech_control_w )
if ((previous & 0x04) != 0 && (data & 0x04) == 0)
{
/* bit 3 selects which of the two 8913 to enable */
- if (data & 0x08)
- {
- /* bit 4 goes to the 8913 BC1 pin */
- if (data & 0x10)
- ay8910_control_port_0_w(space, 0, *psg_latch);
- else
- ay8910_write_port_0_w(space, 0, *psg_latch);
- }
- else
- {
- /* bit 4 goes to the 8913 BC1 pin */
- if (data & 0x10)
- ay8910_control_port_1_w(space, 0, *psg_latch);
- else
- ay8910_write_port_1_w(space, 0, *psg_latch);
- }
+ /* bit 4 goes to the 8913 BC1 pin */
+ const device_config *ay = devtag_get_device(space->machine, SOUND, (data & 0x08) ? "ay1" : "ay2");
+ ay8910_data_address_w(ay, data >> 4, *psg_latch);
}
/* bit 5 goes to the speech chip DIRECT DATA TEST pin */
/* bit 6 = speech chip DATA PRESENT pin; high then low to make the chip read data */
if ((previous & 0x40) == 0 && (data & 0x40) != 0)
- sp0250_w(space, 0, *sp0250_latch);
+ {
+ const device_config *sp = devtag_get_device(space->machine, SOUND, "sp");
+ sp0250_w(sp, 0, *sp0250_latch);
+ }
/* bit 7 goes to the speech chip RESET pin */
if ((previous ^ data) & 0x80)
- sndti_reset(SOUND_SP0250, 0);
+ {
+ const device_config *sp = devtag_get_device(space->machine, SOUND, "sp");
+ device_reset(sp);
+ }
}
@@ -573,7 +569,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( gottlieb_audio2_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x3c00) AM_RAM
- AM_RANGE(0x4000, 0x4001) AM_MIRROR(0x3ffe) AM_WRITE(dac_w) AM_BASE(&dac_data)
+ AM_RANGE(0x4000, 0x4001) AM_MIRROR(0x3ffe) AM_DEVWRITE(SOUND, "dac1", gottlieb_dac_w) AM_BASE(&dac_data)
AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x3fff) AM_READ(audio_data_r)
AM_RANGE(0xe000, 0xffff) AM_MIRROR(0x2000) AM_ROM
ADDRESS_MAP_END
diff --git a/src/mame/audio/gotya.c b/src/mame/audio/gotya.c
index ccc26203e69..bbe376411e9 100644
--- a/src/mame/audio/gotya.c
+++ b/src/mame/audio/gotya.c
@@ -41,13 +41,14 @@ static const struct gotya_sample gotya_samples[] =
WRITE8_HANDLER( gotya_soundlatch_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
static int theme_playing;
int sample_number;
if (data == 0)
{
- sample_stop(0);
+ sample_stop(samples, 0);
theme_playing = 0;
return;
}
@@ -67,7 +68,7 @@ WRITE8_HANDLER( gotya_soundlatch_w )
return;
}
- sample_start(gotya_samples[sample_number].channel,
+ sample_start(samples, gotya_samples[sample_number].channel,
sample_number,
gotya_samples[sample_number].looping);
diff --git a/src/mame/audio/gridlee.c b/src/mame/audio/gridlee.c
index 013cd159168..e33fd147e4f 100644
--- a/src/mame/audio/gridlee.c
+++ b/src/mame/audio/gridlee.c
@@ -7,7 +7,6 @@
#include "driver.h"
#include "streams.h"
#include "gridlee.h"
-#include "sound/custom.h"
#include "sound/samples.h"
@@ -63,7 +62,7 @@ static STREAM_UPDATE( gridlee_stream_update )
*
*************************************/
-CUSTOM_START( gridlee_sh_start )
+static DEVICE_START( gridlee_sound )
{
running_machine *machine = device->machine;
@@ -71,15 +70,28 @@ CUSTOM_START( gridlee_sh_start )
gridlee_stream = stream_create(device, 0, 1, machine->sample_rate, NULL, gridlee_stream_update);
freq_to_step = (double)(1 << 24) / (double)machine->sample_rate;
+}
+
+
+DEVICE_GET_INFO( gridlee_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(gridlee_sound); break;
- return auto_malloc(1);
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Gridlee Custom"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
}
WRITE8_HANDLER( gridlee_sound_w )
{
-static UINT8 sound_data[24];
+ static UINT8 sound_data[24];
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
stream_update(gridlee_stream);
@@ -87,13 +99,13 @@ static UINT8 sound_data[24];
{
case 0x04:
if (data == 0xef && sound_data[offset] != 0xef)
- sample_start(4, 1, 0);
+ sample_start(samples, 4, 1, 0);
else if (data != 0xef && sound_data[offset] == 0xef)
- sample_stop(4);
+ sample_stop(samples, 4);
// if (!(data & 0x01) && (sound_data[offset] & 0x01))
-// sample_start(5, 1, 0);
+// sample_start(samples, 5, 1, 0);
// else if ((data & 0x01) && !(sound_data[offset] & 0x01))
-// sample_stop(5);
+// sample_stop(samples, 5);
break;
case 0x0c:
@@ -101,9 +113,9 @@ static UINT8 sound_data[24];
case 0x0e:
case 0x0f:
if ((data & 1) && !(sound_data[offset] & 1))
- sample_start(offset - 0x0c, 1 - sound_data[offset - 4], 0);
+ sample_start(samples, offset - 0x0c, 1 - sound_data[offset - 4], 0);
else if (!(data & 1) && (sound_data[offset] & 1))
- sample_stop(offset - 0x0c);
+ sample_stop(samples, offset - 0x0c);
break;
case 0x08+0x08:
diff --git a/src/mame/audio/harddriv.c b/src/mame/audio/harddriv.c
index 6d21a810b29..7f1bab012db 100644
--- a/src/mame/audio/harddriv.c
+++ b/src/mame/audio/harddriv.c
@@ -319,11 +319,11 @@ READ16_HANDLER( hdsnddsp_get_bio )
*
*************************************/
-WRITE16_HANDLER( hdsnddsp_dac_w )
+WRITE16_DEVICE_HANDLER( hdsnddsp_dac_w )
{
/* DAC L */
if (!dacmute)
- dac_signed_data_16_w(offset, data ^ 0x8000);
+ dac_signed_data_16_w(device, data ^ 0x8000);
}
diff --git a/src/mame/audio/invinco.c b/src/mame/audio/invinco.c
index e666d011b42..9a30f2baa1d 100644
--- a/src/mame/audio/invinco.c
+++ b/src/mame/audio/invinco.c
@@ -15,8 +15,8 @@
#define OUT_PORT_2_SHIPHIT 0x80
-#define PLAY(id,loop) sample_start( id, id, loop )
-#define STOP(id) sample_stop( id )
+#define PLAY(samp,id,loop) sample_start( samp, id, id, loop )
+#define STOP(samp,id) sample_stop( samp, id )
/* sample file names */
@@ -66,6 +66,7 @@ enum
WRITE8_HANDLER( invinco_audio_w )
{
static int port2State = 0;
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
int bitsChanged;
int bitsGoneHigh;
int bitsGoneLow;
@@ -79,32 +80,32 @@ WRITE8_HANDLER( invinco_audio_w )
if ( bitsGoneLow & OUT_PORT_2_SAUCER )
{
- PLAY( SND_SAUCER, 0 );
+ PLAY( samples, SND_SAUCER, 0 );
}
if ( bitsGoneLow & OUT_PORT_2_MOVE1 )
{
- PLAY( SND_MOVE1, 0 );
+ PLAY( samples, SND_MOVE1, 0 );
}
if ( bitsGoneLow & OUT_PORT_2_MOVE2 )
{
- PLAY( SND_MOVE2, 0 );
+ PLAY( samples, SND_MOVE2, 0 );
}
if ( bitsGoneLow & OUT_PORT_2_FIRE )
{
- PLAY( SND_FIRE, 0 );
+ PLAY( samples, SND_FIRE, 0 );
}
if ( bitsGoneLow & OUT_PORT_2_INVHIT )
{
- PLAY( SND_INVHIT, 0 );
+ PLAY( samples, SND_INVHIT, 0 );
}
if ( bitsGoneLow & OUT_PORT_2_SHIPHIT )
{
- PLAY( SND_SHIPHIT, 0 );
+ PLAY( samples, SND_SHIPHIT, 0 );
}
#if 0
diff --git a/src/mame/audio/irem.c b/src/mame/audio/irem.c
index 5f6ee85574f..31eb7de4e01 100644
--- a/src/mame/audio/irem.c
+++ b/src/mame/audio/irem.c
@@ -59,26 +59,28 @@ static WRITE8_HANDLER( m6803_port1_w )
static WRITE8_HANDLER( m6803_port2_w )
{
-
/* write latch */
if ((port2 & 0x01) && !(data & 0x01))
{
+ const device_config *ay1 = devtag_get_device(space->machine, SOUND, "ay1");
+ const device_config *ay2 = devtag_get_device(space->machine, SOUND, "ay2");
+
/* control or data port? */
if (port2 & 0x04)
{
/* PSG 0 or 1? */
if (port2 & 0x08)
- ay8910_control_port_0_w(space, 0, port1);
+ ay8910_address_w(ay1, 0, port1);
if (port2 & 0x10)
- ay8910_control_port_1_w(space, 0, port1);
+ ay8910_address_w(ay2, 0, port1);
}
else
{
/* PSG 0 or 1? */
if (port2 & 0x08)
- ay8910_write_port_0_w(space, 0, port1);
+ ay8910_data_w(ay1, 0, port1);
if (port2 & 0x10)
- ay8910_write_port_1_w(space, 0, port1);
+ ay8910_data_w(ay2, 0, port1);
}
}
port2 = data;
@@ -96,9 +98,9 @@ static READ8_HANDLER( m6803_port1_r )
{
/* PSG 0 or 1? */
if (port2 & 0x08)
- return ay8910_read_port_0_r(space, 0);
+ return ay8910_r(devtag_get_device(space->machine, SOUND, "ay1"), 0);
if (port2 & 0x10)
- return ay8910_read_port_1_r(space, 0);
+ return ay8910_r(devtag_get_device(space->machine, SOUND, "ay2"), 0);
return 0xff;
}
@@ -116,21 +118,24 @@ static READ8_HANDLER( m6803_port2_r )
*
*************************************/
-static WRITE8_HANDLER( ay8910_0_portb_w )
+static WRITE8_DEVICE_HANDLER( ay8910_0_portb_w )
{
+ const device_config *adpcm0 = devtag_get_device(device->machine, SOUND, "msm1");
+ const device_config *adpcm1 = devtag_get_device(device->machine, SOUND, "msm2");
+
/* bits 2-4 select MSM5205 clock & 3b/4b playback mode */
- msm5205_playmode_w(0, (data >> 2) & 7);
- if (sndti_exists(SOUND_MSM5205, 1))
- msm5205_playmode_w(1, ((data >> 2) & 4) | 3); /* always in slave mode */
+ msm5205_playmode_w(adpcm0, (data >> 2) & 7);
+ if (adpcm1 != NULL)
+ msm5205_playmode_w(adpcm1, ((data >> 2) & 4) | 3); /* always in slave mode */
/* bits 0 and 1 reset the two chips */
- msm5205_reset_w(0, data & 1);
- if (sndti_exists(SOUND_MSM5205, 1))
- msm5205_reset_w(1, data & 2);
+ msm5205_reset_w(adpcm0, data & 1);
+ if (adpcm1 != NULL)
+ msm5205_reset_w(adpcm1, data & 2);
}
-static WRITE8_HANDLER( ay8910_1_porta_w )
+static WRITE8_DEVICE_HANDLER( ay8910_1_porta_w )
{
#ifdef MAME_DEBUG
if (data & 0x0f) popmessage("analog sound %x",data&0x0f);
@@ -154,15 +159,24 @@ static WRITE8_HANDLER( sound_irq_ack_w )
static WRITE8_HANDLER( m52_adpcm_w )
{
if (offset & 1)
- msm5205_data_w(0, data);
- if ((offset & 2) && sndti_exists(SOUND_MSM5205, 1))
- msm5205_data_w(1, data);
+ {
+ const device_config *adpcm = devtag_get_device(space->machine, SOUND, "msm1");
+ msm5205_data_w(adpcm, data);
+ }
+ if (offset & 2)
+ {
+ const device_config *adpcm = devtag_get_device(space->machine, SOUND, "msm2");
+ if (adpcm != NULL)
+ msm5205_data_w(adpcm, data);
+ }
}
static WRITE8_HANDLER( m62_adpcm_w )
{
- msm5205_data_w(offset, data);
+ const device_config *adpcm = devtag_get_device(space->machine, SOUND, (offset & 1) ? "msm2" : "msm1");
+ if (adpcm != NULL)
+ msm5205_data_w(adpcm, data);
}
@@ -175,13 +189,15 @@ static WRITE8_HANDLER( m62_adpcm_w )
static void adpcm_int(const device_config *device)
{
+ const device_config *msm2 = devtag_get_device(device->machine, SOUND, "msm2");
+
cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE);
/* the first MSM5205 clocks the second */
- if (sndti_exists(SOUND_MSM5205, 1))
+ if (msm2 != NULL)
{
- msm5205_vclk_w(1,1);
- msm5205_vclk_w(1,0);
+ msm5205_vclk_w(msm2,1);
+ msm5205_vclk_w(msm2,0);
}
}
@@ -203,20 +219,20 @@ static const ay8910_interface irem_ay8910_interface_1 =
{
AY8910_SINGLE_OUTPUT,
{470, 0, 0},
- soundlatch_r,
- NULL,
- NULL,
- ay8910_0_portb_w
+ DEVCB_MEMORY_HANDLER("iremsound", PROGRAM, soundlatch_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(ay8910_0_portb_w)
};
static const ay8910_interface irem_ay8910_interface_2 =
{
AY8910_SINGLE_OUTPUT,
{470, 0, 0},
- NULL,
- NULL,
- ay8910_1_porta_w,
- NULL
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(ay8910_1_porta_w),
+ DEVCB_NULL
};
static const msm5205_interface irem_msm5205_interface_1 =
@@ -400,15 +416,15 @@ MACHINE_DRIVER_START( m52_sound_c_audio )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("ay8910.0", AY8910, XTAL_3_579545MHz/4) /* verified on pcb */
+ MDRV_SOUND_ADD("ay1", AY8910, XTAL_3_579545MHz/4) /* verified on pcb */
MDRV_SOUND_CONFIG(irem_ay8910_interface_1)
MDRV_SOUND_ROUTE_EX(0, "filtermix", 1.0, 0)
- MDRV_SOUND_ADD("ay8910.1", AY8910, XTAL_3_579545MHz/4) /* verified on pcb */
+ MDRV_SOUND_ADD("ay2", AY8910, XTAL_3_579545MHz/4) /* verified on pcb */
MDRV_SOUND_CONFIG(irem_ay8910_interface_2)
MDRV_SOUND_ROUTE_EX(0, "filtermix", 1.0, 1)
- MDRV_SOUND_ADD("msm5250", MSM5205, XTAL_384kHz) /* verified on pcb */
+ MDRV_SOUND_ADD("msm1", MSM5205, XTAL_384kHz) /* verified on pcb */
MDRV_SOUND_CONFIG(irem_msm5205_interface_1)
MDRV_SOUND_ROUTE_EX(0, "filtermix", 1.0, 2)
diff --git a/src/mame/audio/jaguar.c b/src/mame/audio/jaguar.c
index 08a5245a523..0017e8ccb20 100644
--- a/src/mame/audio/jaguar.c
+++ b/src/mame/audio/jaguar.c
@@ -439,12 +439,12 @@ WRITE32_HANDLER( jaguar_serial_w )
{
/* right DAC */
case 2:
- dac_signed_data_16_w(1, (data & 0xffff) ^ 0x8000);
+ dac_signed_data_16_w(devtag_get_device(space->machine, SOUND, "dac2"), (data & 0xffff) ^ 0x8000);
break;
/* left DAC */
case 3:
- dac_signed_data_16_w(0, (data & 0xffff) ^ 0x8000);
+ dac_signed_data_16_w(devtag_get_device(space->machine, SOUND, "dac1"), (data & 0xffff) ^ 0x8000);
break;
/* frequency register */
diff --git a/src/mame/audio/jedi.c b/src/mame/audio/jedi.c
index 59968462753..0bde3c66f0a 100644
--- a/src/mame/audio/jedi.c
+++ b/src/mame/audio/jedi.c
@@ -146,14 +146,17 @@ static WRITE8_HANDLER( speech_strobe_w )
int new_speech_strobe_state = (~offset >> 8) & 1;
if ((new_speech_strobe_state != state->speech_strobe_state) && new_speech_strobe_state)
- tms5220_data_w(space, 0, *state->speech_data);
+ {
+ const device_config *tms = devtag_get_device(space->machine, SOUND, "tms");
+ tms5220_data_w(tms, 0, *state->speech_data);
+ }
state->speech_strobe_state = new_speech_strobe_state;
}
static READ8_HANDLER( speech_ready_r )
{
- return (!tms5220_ready_r()) << 7;
+ return (!tms5220_ready_r(devtag_get_device(space->machine, SOUND, "tms"))) << 7;
}
@@ -172,10 +175,10 @@ static WRITE8_HANDLER( speech_reset_w )
static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM
- AM_RANGE(0x0800, 0x080f) AM_MIRROR(0x07c0) AM_READWRITE(pokey1_r, pokey1_w)
- AM_RANGE(0x0810, 0x081f) AM_MIRROR(0x07c0) AM_READWRITE(pokey2_r, pokey2_w)
- AM_RANGE(0x0820, 0x082f) AM_MIRROR(0x07c0) AM_READWRITE(pokey3_r, pokey3_w)
- AM_RANGE(0x0830, 0x083f) AM_MIRROR(0x07c0) AM_READWRITE(pokey4_r, pokey4_w)
+ AM_RANGE(0x0800, 0x080f) AM_MIRROR(0x07c0) AM_DEVREADWRITE(SOUND, "pokey1", pokey_r, pokey_w)
+ AM_RANGE(0x0810, 0x081f) AM_MIRROR(0x07c0) AM_DEVREADWRITE(SOUND, "pokey2", pokey_r, pokey_w)
+ AM_RANGE(0x0820, 0x082f) AM_MIRROR(0x07c0) AM_DEVREADWRITE(SOUND, "pokey3", pokey_r, pokey_w)
+ AM_RANGE(0x0830, 0x083f) AM_MIRROR(0x07c0) AM_DEVREADWRITE(SOUND, "pokey4", pokey_r, pokey_w)
AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x00ff) AM_READWRITE(SMH_NOP, irq_ack_w)
AM_RANGE(0x1100, 0x1100) AM_MIRROR(0x00ff) AM_READWRITE(SMH_NOP, SMH_RAM) AM_BASE_MEMBER(jedi_state, speech_data)
AM_RANGE(0x1200, 0x13ff) AM_READWRITE(SMH_NOP, speech_strobe_w)
diff --git a/src/mame/audio/laserbat.c b/src/mame/audio/laserbat.c
index 5c0152324e2..f6d7095c5a0 100644
--- a/src/mame/audio/laserbat.c
+++ b/src/mame/audio/laserbat.c
@@ -13,6 +13,7 @@ WRITE8_HANDLER( laserbat_csound1_w )
WRITE8_HANDLER( laserbat_csound2_w )
{
+ const device_config *sn = devtag_get_device(space->machine, SOUND, "sn");
int ksound = 0;
if (data & 0x01)
@@ -55,11 +56,11 @@ WRITE8_HANDLER( laserbat_csound2_w )
break;
}
- sn76477_noise_filter_res_w(0, noise_filter_res);
- sn76477_vco_res_w(0, vco_res);
+ sn76477_noise_filter_res_w(sn, noise_filter_res);
+ sn76477_vco_res_w(sn, vco_res);
- sn76477_enable_w(0, (csound1 & 0x08) ? 1 : 0); // AB SOUND
- sn76477_mixer_b_w(0, (csound1 & 0x10) ? 1 : 0); // _VCO/NOISE
+ sn76477_enable_w(sn, (csound1 & 0x08) ? 1 : 0); // AB SOUND
+ sn76477_mixer_b_w(sn, (csound1 & 0x10) ? 1 : 0); // _VCO/NOISE
degr = (csound1 & 0x20) ? 1 : 0;
filt = (csound1 & 0x40) ? 1 : 0;
@@ -67,21 +68,21 @@ WRITE8_HANDLER( laserbat_csound2_w )
us = 0; // sn76477 pin 12
}
- sn76477_vco_w(0, (data & 0x40) ? 0 : 1);
+ sn76477_vco_w(sn, (data & 0x40) ? 0 : 1);
switch((data & 0x1c) >> 2)
{
case 0x00:
- sn76477_slf_res_w(0, RES_K(27));
+ sn76477_slf_res_w(sn, RES_K(27));
break;
case 0x01:
- sn76477_slf_res_w(0, RES_K(22));
+ sn76477_slf_res_w(sn, RES_K(22));
break;
case 0x02:
- sn76477_slf_res_w(0, RES_K(22));
+ sn76477_slf_res_w(sn, RES_K(22));
break;
case 0x03:
- sn76477_slf_res_w(0, RES_K(12));
+ sn76477_slf_res_w(sn, RES_K(12));
break;
case 0x04: // not connected
break;
@@ -98,8 +99,8 @@ WRITE8_HANDLER( laserbat_csound2_w )
ksound = ((data & 0x02) << 23) + (ksound3 << 16) + (ksound2 << 8) + ksound1;
- tms3615_enable_w(0, ksound & 0x1fff);
- tms3615_enable_w(1, (ksound >> 13) << 1);
+ tms3615_enable_w(devtag_get_device(space->machine, SOUND, "tms1"), ksound & 0x1fff);
+ tms3615_enable_w(devtag_get_device(space->machine, SOUND, "tms2"), (ksound >> 13) << 1);
bit14 = (data & 0x20) ? 1 : 0;
diff --git a/src/mame/audio/leland.c b/src/mame/audio/leland.c
index 5ea14593a3d..6fac99eb1e4 100644
--- a/src/mame/audio/leland.c
+++ b/src/mame/audio/leland.c
@@ -82,7 +82,6 @@
#include "cpu/i86/i86.h"
#include "cpu/z80/z80.h"
#include "leland.h"
-#include "sound/custom.h"
#include "sound/2151intf.h"
@@ -132,7 +131,7 @@ static STREAM_UPDATE( leland_update )
}
-CUSTOM_START( leland_sh_start )
+static DEVICE_START( leland_sound )
{
/* reset globals */
dac_buffer[0] = dac_buffer[1] = NULL;
@@ -145,8 +144,20 @@ CUSTOM_START( leland_sh_start )
/* allocate memory */
dac_buffer[0] = auto_malloc(DAC_BUFFER_SIZE);
dac_buffer[1] = auto_malloc(DAC_BUFFER_SIZE);
+}
+
+
+DEVICE_GET_INFO( leland_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(leland_sound); break;
- return auto_malloc(1);
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Leland DAC"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
}
@@ -500,17 +511,14 @@ static STREAM_UPDATE( leland_80186_extern_update )
static TIMER_CALLBACK( internal_timer_int );
static TIMER_CALLBACK( dma_timer_callback );
-static void *common_sh_start(const device_config *device, int clock, const custom_sound_interface *config)
+static DEVICE_START( common_sh_start )
{
running_machine *machine = device->machine;
- const address_space *dmaspace = cputag_get_address_space(machine, "audio", ADDRESS_SPACE_PROGRAM);
+ const address_space *dmaspace = memory_find_address_space(cputag_get_cpu(machine, "audio"), ADDRESS_SPACE_PROGRAM);
int i;
/* determine which sound hardware is installed */
- has_ym2151 = 0;
- for (i = 0; i < MAX_SOUND; i++)
- if (machine->config->sound[i].type == SOUND_YM2151)
- has_ym2151 = 1;
+ has_ym2151 = (devtag_get_device(device->machine, SOUND, "ym") != NULL);
/* allocate separate streams for the DMA and non-DMA DACs */
dma_stream = stream_create(device, 0, 1, OUTPUT_RATE, (void *)dmaspace, leland_80186_dma_update);
@@ -535,20 +543,46 @@ static void *common_sh_start(const device_config *device, int clock, const custo
for (i = 0; i < 9; i++)
counter[i].timer = timer_alloc(machine, NULL, NULL);
-
- return auto_malloc(1);
}
-CUSTOM_START( leland_80186_sh_start )
+static DEVICE_START( leland_80186_sound )
{
is_redline = 0;
- return common_sh_start(device, clock, config);
+ DEVICE_START_CALL(common_sh_start);
}
-CUSTOM_START( redline_80186_sh_start )
+static DEVICE_START( redline_80186_sound )
{
is_redline = 1;
- return common_sh_start(device, clock, config);
+ DEVICE_START_CALL(common_sh_start);
+}
+
+
+DEVICE_GET_INFO( leland_80186_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(leland_80186_sound); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Leland 80186 DAC"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
+}
+
+
+DEVICE_GET_INFO( redline_80186_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(redline_80186_sound); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Redline Racer 80186 DAC"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
}
@@ -2009,7 +2043,7 @@ static READ16_HANDLER( peripheral_r )
if (!has_ym2151)
return pit8254_r(space, offset | 0x40, mem_mask);
else
- return ym2151_status_port_0_lsb_r(space, offset, mem_mask);
+ return ym2151_r(devtag_get_device(space->machine, SOUND, "ym"), offset);
case 4:
if (is_redline)
@@ -2044,10 +2078,8 @@ static WRITE16_HANDLER( peripheral_w )
case 3:
if (!has_ym2151)
pit8254_w(space, offset | 0x40, data, mem_mask);
- else if (offset == 0)
- ym2151_register_port_0_lsb_w(space, offset, data, mem_mask);
- else if (offset == 1)
- ym2151_data_port_0_lsb_w(space, offset, data, mem_mask);
+ else
+ ym2151_w(devtag_get_device(space->machine, SOUND, "ym"), offset, data);
break;
case 4:
diff --git a/src/mame/audio/llander.c b/src/mame/audio/llander.c
index 4b323993a8d..68854e48617 100644
--- a/src/mame/audio/llander.c
+++ b/src/mame/audio/llander.c
@@ -79,17 +79,17 @@ DISCRETE_SOUND_START(llander)
DISCRETE_OUTPUT(NODE_90, 65534.0/(9.2+9.2+600+1000)) // Take the output from the mixer
DISCRETE_SOUND_END
-WRITE8_HANDLER( llander_snd_reset_w )
+WRITE8_DEVICE_HANDLER( llander_snd_reset_w )
{
/* Resets the LFSR that is used for the white noise generator */
- discrete_sound_w(space, LLANDER_NOISE_RESET, 0); /* Reset */
+ discrete_sound_w(device, LLANDER_NOISE_RESET, 0); /* Reset */
}
-WRITE8_HANDLER( llander_sounds_w )
+WRITE8_DEVICE_HANDLER( llander_sounds_w )
{
- discrete_sound_w(space, LLANDER_THRUST_DATA, data & 0x07); /* Thrust volume */
- discrete_sound_w(space, LLANDER_TONE3K_EN, data & 0x10); /* Tone 3KHz enable */
- discrete_sound_w(space, LLANDER_TONE6K_EN, data & 0x20); /* Tone 6KHz enable */
- discrete_sound_w(space, LLANDER_EXPLOD_EN, data & 0x08); /* Explosion */
+ discrete_sound_w(device, LLANDER_THRUST_DATA, data & 0x07); /* Thrust volume */
+ discrete_sound_w(device, LLANDER_TONE3K_EN, data & 0x10); /* Tone 3KHz enable */
+ discrete_sound_w(device, LLANDER_TONE6K_EN, data & 0x20); /* Tone 6KHz enable */
+ discrete_sound_w(device, LLANDER_EXPLOD_EN, data & 0x08); /* Explosion */
}
diff --git a/src/mame/audio/m72.c b/src/mame/audio/m72.c
index 2f09a852422..cf77fb93e42 100644
--- a/src/mame/audio/m72.c
+++ b/src/mame/audio/m72.c
@@ -112,12 +112,12 @@ MACHINE_RESET( m72_sound )
state_save_register_global(machine, sample_addr);
}
-void m72_ym2151_irq_handler(running_machine *machine, int irq)
+void m72_ym2151_irq_handler(const device_config *device, int irq)
{
if (irq)
- timer_call_after_resynch(machine, NULL, YM2151_ASSERT,setvector_callback);
+ timer_call_after_resynch(device->machine, NULL, YM2151_ASSERT,setvector_callback);
else
- timer_call_after_resynch(machine, NULL, YM2151_CLEAR,setvector_callback);
+ timer_call_after_resynch(device->machine, NULL, YM2151_CLEAR,setvector_callback);
}
WRITE16_HANDLER( m72_sound_command_w )
@@ -200,8 +200,8 @@ READ8_HANDLER( m72_sample_r )
return memory_region(space->machine, "samples")[sample_addr];
}
-WRITE8_HANDLER( m72_sample_w )
+WRITE8_DEVICE_HANDLER( m72_sample_w )
{
- dac_signed_data_w(0,data);
- sample_addr = (sample_addr + 1) & (memory_region_length(space->machine, "samples") - 1);
+ dac_signed_data_w(device, data);
+ sample_addr = (sample_addr + 1) & (memory_region_length(device->machine, "samples") - 1);
}
diff --git a/src/mame/audio/m72.h b/src/mame/audio/m72.h
index 0d2c06bff8e..a38ef4de10d 100644
--- a/src/mame/audio/m72.h
+++ b/src/mame/audio/m72.h
@@ -5,12 +5,12 @@
****************************************************************************/
MACHINE_RESET( m72_sound );
-void m72_ym2151_irq_handler(running_machine *machine, int irq);
+void m72_ym2151_irq_handler(const device_config *device, int irq);
WRITE8_HANDLER( m72_sound_command_byte_w );
WRITE16_HANDLER( m72_sound_command_w );
WRITE8_HANDLER( m72_sound_irq_ack_w );
READ8_HANDLER( m72_sample_r );
-WRITE8_HANDLER( m72_sample_w );
+WRITE8_DEVICE_HANDLER( m72_sample_w );
/* the port goes to different address bits depending on the game */
void m72_set_sample_start(int start);
diff --git a/src/mame/audio/mario.c b/src/mame/audio/mario.c
index e5e171e4b33..9998d0f0ed8 100644
--- a/src/mame/audio/mario.c
+++ b/src/mame/audio/mario.c
@@ -457,9 +457,9 @@ static READ8_HANDLER( mario_sh_tune_r )
return (SND[(0x1000 + (p2 & 0x0f)*256+offset) & mask]);
}
-static WRITE8_HANDLER( mario_sh_sound_w )
+static WRITE8_DEVICE_HANDLER( mario_sh_sound_w )
{
- discrete_sound_w(space,DS_DAC,data);
+ discrete_sound_w(device,DS_DAC,data);
}
static WRITE8_HANDLER( mario_sh_p1_w )
@@ -499,17 +499,17 @@ WRITE8_HANDLER( mario_sh_tuneselect_w )
/* Sound 0 and 1 are pulsed !*/
/* Mario running sample */
-WRITE8_HANDLER( mario_sh1_w )
+WRITE8_DEVICE_HANDLER( mario_sh1_w )
{
printf("sound0\n");
- discrete_sound_w(space,DS_SOUND0_INP, 0);
+ discrete_sound_w(device,DS_SOUND0_INP, 0);
}
/* Luigi running sample */
-WRITE8_HANDLER( mario_sh2_w )
+WRITE8_DEVICE_HANDLER( mario_sh2_w )
{
printf("sound1\n");
- discrete_sound_w(space,DS_SOUND1_INP, 0);
+ discrete_sound_w(device,DS_SOUND1_INP, 0);
}
/* Misc samples */
@@ -544,7 +544,7 @@ WRITE8_HANDLER( mario_sh3_w )
I8035_P1_W_AH(space,3,data & 1);
break;
case 7: /* skid */
- discrete_sound_w(space,DS_SOUND7_INP,data & 1);
+ discrete_sound_w(devtag_get_device(space->machine, SOUND, "discrete"),DS_SOUND7_INP,data & 1);
break;
}
}
@@ -561,7 +561,7 @@ static ADDRESS_MAP_START( mario_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END
static ADDRESS_MAP_START( mario_sound_io_map, ADDRESS_SPACE_IO, 8 )
- AM_RANGE(0x00, 0xff) AM_READWRITE(mario_sh_tune_r, mario_sh_sound_w)
+ AM_RANGE(0x00, 0xff) AM_READ(mario_sh_tune_r) AM_DEVWRITE(SOUND, "discrete", mario_sh_sound_w)
AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(mario_sh_p1_r, mario_sh_p1_w)
AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(mario_sh_p2_r, mario_sh_p2_w)
AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(mario_sh_t0_r)
@@ -571,8 +571,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( masao_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_ROM
AM_RANGE(0x2000, 0x23ff) AM_RAM
- AM_RANGE(0x4000, 0x4000) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x6000, 0x6000) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x4000, 0x4000) AM_DEVREADWRITE(SOUND, "ay", ay8910_r, ay8910_data_w)
+ AM_RANGE(0x6000, 0x6000) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
ADDRESS_MAP_END
/*************************************
@@ -585,10 +585,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r,
- NULL,
- NULL,
- NULL
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/audio/mcr.c b/src/mame/audio/mcr.c
index 0bc9d8ad94b..70e745958f0 100644
--- a/src/mame/audio/mcr.c
+++ b/src/mame/audio/mcr.c
@@ -53,7 +53,7 @@ static UINT8 mcr_sound_config;
static UINT16 dacval;
/* SSIO-specific globals */
-static UINT8 ssio_sound_cpu;
+static const device_config *ssio_sound_cpu;
static UINT8 ssio_data[4];
static UINT8 ssio_status;
static UINT8 ssio_14024_count;
@@ -67,25 +67,22 @@ static read8_space_func ssio_custom_input[5];
static write8_space_func ssio_custom_output[2];
/* Chip Squeak Deluxe-specific globals */
-static UINT8 csdeluxe_sound_cpu;
-static UINT8 csdeluxe_dac_index;
+static const device_config *csdeluxe_sound_cpu;
static UINT8 csdeluxe_status;
static const pia6821_interface csdeluxe_pia_intf;
/* Turbo Chip Squeak-specific globals */
-static UINT8 turbocs_sound_cpu;
-static UINT8 turbocs_dac_index;
+static const device_config *turbocs_sound_cpu;
static UINT8 turbocs_status;
static const pia6821_interface turbocs_pia_intf;
/* Sounds Good-specific globals */
-static UINT8 soundsgood_sound_cpu;
-static UINT8 soundsgood_dac_index;
+static const device_config *soundsgood_sound_cpu;
static UINT8 soundsgood_status;
static const pia6821_interface soundsgood_pia_intf;
/* Squawk n' Talk-specific globals */
-static UINT8 squawkntalk_sound_cpu;
+static const device_config *squawkntalk_sound_cpu;
static UINT8 squawkntalk_tms_command;
static UINT8 squawkntalk_tms_strobes;
static const pia6821_interface squawkntalk_pia0_intf;
@@ -112,14 +109,13 @@ static void ssio_compute_ay8910_modulation(running_machine *machine);
void mcr_sound_init(running_machine *machine, UINT8 config)
{
int sound_cpu = 1;
- int dac_index = 0;
mcr_sound_config = config;
/* SSIO */
if (mcr_sound_config & MCR_SSIO)
{
- ssio_sound_cpu = sound_cpu++;
+ ssio_sound_cpu = cputag_get_cpu(machine, "ssio");
ssio_compute_ay8910_modulation(machine);
state_save_register_global_array(machine, ssio_data);
state_save_register_global(machine, ssio_status);
@@ -133,8 +129,7 @@ void mcr_sound_init(running_machine *machine, UINT8 config)
if (mcr_sound_config & MCR_TURBO_CHIP_SQUEAK)
{
pia_config(machine, 0, &turbocs_pia_intf);
- turbocs_dac_index = dac_index++;
- turbocs_sound_cpu = sound_cpu++;
+ turbocs_sound_cpu = cputag_get_cpu(machine, "tcs");
state_save_register_global(machine, turbocs_status);
}
@@ -142,8 +137,7 @@ void mcr_sound_init(running_machine *machine, UINT8 config)
if (mcr_sound_config & MCR_CHIP_SQUEAK_DELUXE)
{
pia_config(machine, 0, &csdeluxe_pia_intf);
- csdeluxe_dac_index = dac_index++;
- csdeluxe_sound_cpu = sound_cpu++;
+ csdeluxe_sound_cpu = cputag_get_cpu(machine, "csd");
state_save_register_global(machine, csdeluxe_status);
}
@@ -152,8 +146,7 @@ void mcr_sound_init(running_machine *machine, UINT8 config)
{
/* special case: Spy Hunter 2 has both Turbo CS and Sounds Good, so we use PIA slot 1 */
pia_config(machine, 1, &soundsgood_pia_intf);
- soundsgood_dac_index = dac_index++;
- soundsgood_sound_cpu = sound_cpu++;
+ soundsgood_sound_cpu = cputag_get_cpu(machine, "sg");
state_save_register_global(machine, soundsgood_status);
}
@@ -162,7 +155,7 @@ void mcr_sound_init(running_machine *machine, UINT8 config)
{
pia_config(machine, 0, &squawkntalk_pia0_intf);
pia_config(machine, 1, &squawkntalk_pia1_intf);
- squawkntalk_sound_cpu = sound_cpu++;
+ squawkntalk_sound_cpu = cputag_get_cpu(machine, "snt");
state_save_register_global(machine, squawkntalk_tms_command);
state_save_register_global(machine, squawkntalk_tms_strobes);
}
@@ -172,7 +165,6 @@ void mcr_sound_init(running_machine *machine, UINT8 config)
{
williams_cvsd_init(machine, 0);
sound_cpu++;
- dac_index++;
}
}
@@ -322,7 +314,7 @@ static READ8_HANDLER( ssio_irq_clear )
{
/* a read here asynchronously resets the 14024 count, clearing /SINT */
ssio_14024_count = 0;
- cpu_set_input_line(space->machine->cpu[ssio_sound_cpu], 0, CLEAR_LINE);
+ cpu_set_input_line(ssio_sound_cpu, 0, CLEAR_LINE);
return 0xff;
}
@@ -341,43 +333,45 @@ static TIMER_CALLBACK( ssio_delayed_data_w )
ssio_data[param >> 8] = param & 0xff;
}
-static void ssio_update_volumes(void)
+static void ssio_update_volumes(running_machine *machine)
{
- ay8910_set_volume(0, 0, ssio_mute ? 0 : ssio_ayvolume_lookup[ssio_duty_cycle[0][0]]);
- ay8910_set_volume(0, 1, ssio_mute ? 0 : ssio_ayvolume_lookup[ssio_duty_cycle[0][1]]);
- ay8910_set_volume(0, 2, ssio_mute ? 0 : ssio_ayvolume_lookup[ssio_duty_cycle[0][2]]);
- ay8910_set_volume(1, 0, ssio_mute ? 0 : ssio_ayvolume_lookup[ssio_duty_cycle[1][0]]);
- ay8910_set_volume(1, 1, ssio_mute ? 0 : ssio_ayvolume_lookup[ssio_duty_cycle[1][1]]);
- ay8910_set_volume(1, 2, ssio_mute ? 0 : ssio_ayvolume_lookup[ssio_duty_cycle[1][2]]);
+ const device_config *ay0 = devtag_get_device(machine, SOUND, "ssio.1");
+ const device_config *ay1 = devtag_get_device(machine, SOUND, "ssio.2");
+ ay8910_set_volume(ay0, 0, ssio_mute ? 0 : ssio_ayvolume_lookup[ssio_duty_cycle[0][0]]);
+ ay8910_set_volume(ay0, 1, ssio_mute ? 0 : ssio_ayvolume_lookup[ssio_duty_cycle[0][1]]);
+ ay8910_set_volume(ay0, 2, ssio_mute ? 0 : ssio_ayvolume_lookup[ssio_duty_cycle[0][2]]);
+ ay8910_set_volume(ay1, 0, ssio_mute ? 0 : ssio_ayvolume_lookup[ssio_duty_cycle[1][0]]);
+ ay8910_set_volume(ay1, 1, ssio_mute ? 0 : ssio_ayvolume_lookup[ssio_duty_cycle[1][1]]);
+ ay8910_set_volume(ay1, 2, ssio_mute ? 0 : ssio_ayvolume_lookup[ssio_duty_cycle[1][2]]);
}
-static WRITE8_HANDLER( ssio_porta0_w )
+static WRITE8_DEVICE_HANDLER( ssio_porta0_w )
{
ssio_duty_cycle[0][0] = data & 15;
ssio_duty_cycle[0][1] = data >> 4;
- ssio_update_volumes();
+ ssio_update_volumes(device->machine);
}
-static WRITE8_HANDLER( ssio_portb0_w )
+static WRITE8_DEVICE_HANDLER( ssio_portb0_w )
{
ssio_duty_cycle[0][2] = data & 15;
ssio_overall[0] = (data >> 4) & 7;
- ssio_update_volumes();
+ ssio_update_volumes(device->machine);
}
-static WRITE8_HANDLER( ssio_porta1_w )
+static WRITE8_DEVICE_HANDLER( ssio_porta1_w )
{
ssio_duty_cycle[1][0] = data & 15;
ssio_duty_cycle[1][1] = data >> 4;
- ssio_update_volumes();
+ ssio_update_volumes(device->machine);
}
-static WRITE8_HANDLER( ssio_portb1_w )
+static WRITE8_DEVICE_HANDLER( ssio_portb1_w )
{
ssio_duty_cycle[1][2] = data & 15;
ssio_overall[1] = (data >> 4) & 7;
ssio_mute = data & 0x80;
- ssio_update_volumes();
+ ssio_update_volumes(device->machine);
}
/********* external interfaces ***********/
@@ -398,7 +392,7 @@ void ssio_reset_w(running_machine *machine, int state)
{
int i;
- cpu_set_input_line(machine->cpu[ssio_sound_cpu], INPUT_LINE_RESET, ASSERT_LINE);
+ cpu_set_input_line(ssio_sound_cpu, INPUT_LINE_RESET, ASSERT_LINE);
/* latches also get reset */
for (i = 0; i < 4; i++)
@@ -408,7 +402,7 @@ void ssio_reset_w(running_machine *machine, int state)
}
/* going low resets and reactivates the CPU */
else
- cpu_set_input_line(machine->cpu[ssio_sound_cpu], INPUT_LINE_RESET, CLEAR_LINE);
+ cpu_set_input_line(ssio_sound_cpu, INPUT_LINE_RESET, CLEAR_LINE);
}
READ8_HANDLER( ssio_input_port_r )
@@ -448,20 +442,20 @@ static const ay8910_interface ssio_ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- ssio_porta0_w,
- ssio_portb0_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(ssio_porta0_w),
+ DEVCB_HANDLER(ssio_portb0_w)
};
static const ay8910_interface ssio_ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- ssio_porta1_w,
- ssio_portb1_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(ssio_porta1_w),
+ DEVCB_HANDLER(ssio_portb1_w)
};
@@ -473,12 +467,12 @@ static ADDRESS_MAP_START( ssio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM
AM_RANGE(0x8000, 0x83ff) AM_MIRROR(0x0c00) AM_RAM
AM_RANGE(0x9000, 0x9003) AM_MIRROR(0x0ffc) AM_READ(ssio_data_r)
- AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x0ffc) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xa001, 0xa001) AM_MIRROR(0x0ffc) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0xa002, 0xa002) AM_MIRROR(0x0ffc) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xb000, 0xb000) AM_MIRROR(0x0ffc) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0xb001, 0xb001) AM_MIRROR(0x0ffc) AM_READ(ay8910_read_port_1_r)
- AM_RANGE(0xb002, 0xb002) AM_MIRROR(0x0ffc) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x0ffc) AM_DEVWRITE(SOUND, "ssio.1", ay8910_address_w)
+ AM_RANGE(0xa001, 0xa001) AM_MIRROR(0x0ffc) AM_DEVREAD(SOUND, "ssio.1", ay8910_r)
+ AM_RANGE(0xa002, 0xa002) AM_MIRROR(0x0ffc) AM_DEVWRITE(SOUND, "ssio.1", ay8910_data_w)
+ AM_RANGE(0xb000, 0xb000) AM_MIRROR(0x0ffc) AM_DEVWRITE(SOUND, "ssio.2", ay8910_address_w)
+ AM_RANGE(0xb001, 0xb001) AM_MIRROR(0x0ffc) AM_DEVREAD(SOUND, "ssio.2", ay8910_r)
+ AM_RANGE(0xb002, 0xb002) AM_MIRROR(0x0ffc) AM_DEVWRITE(SOUND, "ssio.2", ay8910_data_w)
AM_RANGE(0xc000, 0xcfff) AM_READWRITE(SMH_NOP, ssio_status_w)
AM_RANGE(0xd000, 0xdfff) AM_WRITENOP /* low bit controls yellow LED */
AM_RANGE(0xe000, 0xefff) AM_READ(ssio_irq_clear)
@@ -516,7 +510,7 @@ MACHINE_DRIVER_END
static WRITE8_HANDLER( csdeluxe_porta_w )
{
dacval = (dacval & ~0x3fc) | (data << 2);
- dac_signed_data_16_w(csdeluxe_dac_index, dacval << 6);
+ dac_signed_data_16_w(devtag_get_device(space->machine, SOUND, "csd"), dacval << 6);
}
static WRITE8_HANDLER( csdeluxe_portb_w )
@@ -524,7 +518,7 @@ static WRITE8_HANDLER( csdeluxe_portb_w )
UINT8 z_mask = pia_get_port_b_z_mask(0);
dacval = (dacval & ~0x003) | (data >> 6);
- dac_signed_data_16_w(csdeluxe_dac_index, dacval << 6);
+ dac_signed_data_16_w(devtag_get_device(space->machine, SOUND, "csd"), dacval << 6);
if (~z_mask & 0x10) csdeluxe_status = (csdeluxe_status & ~1) | ((data >> 4) & 1);
if (~z_mask & 0x20) csdeluxe_status = (csdeluxe_status & ~2) | ((data >> 4) & 2);
@@ -534,7 +528,7 @@ static void csdeluxe_irq(running_machine *machine, int state)
{
int combined_state = pia_get_irq_a(0) | pia_get_irq_b(0);
- cpu_set_input_line(machine->cpu[csdeluxe_sound_cpu], 4, combined_state ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(csdeluxe_sound_cpu, 4, combined_state ? ASSERT_LINE : CLEAR_LINE);
}
static TIMER_CALLBACK( csdeluxe_delayed_data_w )
@@ -583,7 +577,7 @@ READ8_HANDLER( csdeluxe_status_r )
void csdeluxe_reset_w(running_machine *machine, int state)
{
- cpu_set_input_line(machine->cpu[csdeluxe_sound_cpu], INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(csdeluxe_sound_cpu, INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE);
}
@@ -641,7 +635,7 @@ MACHINE_DRIVER_END
static WRITE8_HANDLER( soundsgood_porta_w )
{
dacval = (dacval & ~0x3fc) | (data << 2);
- dac_signed_data_16_w(soundsgood_dac_index, dacval << 6);
+ dac_signed_data_16_w(devtag_get_device(space->machine, SOUND, "sg"), dacval << 6);
}
static WRITE8_HANDLER( soundsgood_portb_w )
@@ -649,7 +643,7 @@ static WRITE8_HANDLER( soundsgood_portb_w )
UINT8 z_mask = pia_get_port_b_z_mask(1);
dacval = (dacval & ~0x003) | (data >> 6);
- dac_signed_data_16_w(soundsgood_dac_index, dacval << 6);
+ dac_signed_data_16_w(devtag_get_device(space->machine, SOUND, "sg"), dacval << 6);
if (~z_mask & 0x10) soundsgood_status = (soundsgood_status & ~1) | ((data >> 4) & 1);
if (~z_mask & 0x20) soundsgood_status = (soundsgood_status & ~2) | ((data >> 4) & 2);
@@ -659,7 +653,7 @@ static void soundsgood_irq(running_machine *machine, int state)
{
int combined_state = pia_get_irq_a(1) | pia_get_irq_b(1);
- cpu_set_input_line(machine->cpu[soundsgood_sound_cpu], 4, combined_state ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(soundsgood_sound_cpu, 4, combined_state ? ASSERT_LINE : CLEAR_LINE);
}
static TIMER_CALLBACK( soundsgood_delayed_data_w )
@@ -689,7 +683,7 @@ READ8_HANDLER( soundsgood_status_r )
void soundsgood_reset_w(running_machine *machine, int state)
{
//if (state) mame_printf_debug("SG Reset\n");
- cpu_set_input_line(machine->cpu[soundsgood_sound_cpu], INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(soundsgood_sound_cpu, INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE);
}
@@ -741,13 +735,13 @@ MACHINE_DRIVER_END
static WRITE8_HANDLER( turbocs_porta_w )
{
dacval = (dacval & ~0x3fc) | (data << 2);
- dac_signed_data_16_w(turbocs_dac_index, dacval << 6);
+ dac_signed_data_16_w(devtag_get_device(space->machine, SOUND, "tcs"), dacval << 6);
}
static WRITE8_HANDLER( turbocs_portb_w )
{
dacval = (dacval & ~0x003) | (data >> 6);
- dac_signed_data_16_w(turbocs_dac_index, dacval << 6);
+ dac_signed_data_16_w(devtag_get_device(space->machine, SOUND, "tcs"), dacval << 6);
turbocs_status = (data >> 4) & 3;
}
@@ -755,7 +749,7 @@ static void turbocs_irq(running_machine *machine, int state)
{
int combined_state = pia_get_irq_a(0) | pia_get_irq_b(0);
- cpu_set_input_line(machine->cpu[turbocs_sound_cpu], M6809_IRQ_LINE, combined_state ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(turbocs_sound_cpu, M6809_IRQ_LINE, combined_state ? ASSERT_LINE : CLEAR_LINE);
}
static TIMER_CALLBACK( turbocs_delayed_data_w )
@@ -784,7 +778,7 @@ READ8_HANDLER( turbocs_status_r )
void turbocs_reset_w(running_machine *machine, int state)
{
- cpu_set_input_line(machine->cpu[turbocs_sound_cpu], INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(turbocs_sound_cpu, INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE);
}
@@ -859,13 +853,15 @@ static WRITE8_HANDLER( squawkntalk_porta2_w )
static WRITE8_HANDLER( squawkntalk_portb2_w )
{
+ const device_config *tms = devtag_get_device(space->machine, SOUND, "snt");
+
/* bits 0-1 select read/write strobes on the TMS5200 */
data &= 0x03;
/* write strobe -- pass the current command to the TMS5200 */
if (((data ^ squawkntalk_tms_strobes) & 0x02) && !(data & 0x02))
{
- tms5220_data_w(space, offset, squawkntalk_tms_command);
+ tms5220_data_w(tms, offset, squawkntalk_tms_command);
/* DoT expects the ready line to transition on a command/write here, so we oblige */
pia_1_ca2_w(space, 0, 1);
@@ -875,7 +871,7 @@ static WRITE8_HANDLER( squawkntalk_portb2_w )
/* read strobe -- read the current status from the TMS5200 */
else if (((data ^ squawkntalk_tms_strobes) & 0x01) && !(data & 0x01))
{
- pia_1_porta_w(space, 0, tms5220_status_r(space, offset));
+ pia_1_porta_w(space, 0, tms5220_status_r(tms, offset));
/* DoT expects the ready line to transition on a command/write here, so we oblige */
pia_1_ca2_w(space, 0, 1);
@@ -890,7 +886,7 @@ static void squawkntalk_irq(running_machine *machine, int state)
{
int combined_state = pia_get_irq_a(0) | pia_get_irq_b(0) | pia_get_irq_a(1) | pia_get_irq_b(1);
- cpu_set_input_line(machine->cpu[squawkntalk_sound_cpu], M6800_IRQ_LINE, combined_state ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(squawkntalk_sound_cpu, M6800_IRQ_LINE, combined_state ? ASSERT_LINE : CLEAR_LINE);
}
static TIMER_CALLBACK( squawkntalk_delayed_data_w )
@@ -910,7 +906,7 @@ WRITE8_HANDLER( squawkntalk_data_w )
void squawkntalk_reset_w(running_machine *machine, int state)
{
- cpu_set_input_line(machine->cpu[squawkntalk_sound_cpu], INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(squawkntalk_sound_cpu, INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE);
}
diff --git a/src/mame/audio/meadows.c b/src/mame/audio/meadows.c
index fad34320627..8dcb8eb8c87 100644
--- a/src/mame/audio/meadows.c
+++ b/src/mame/audio/meadows.c
@@ -49,10 +49,10 @@ SAMPLES_START( meadows_sh_start )
freq1 = freq2 = 1000;
latched_0c01 = latched_0c02 = latched_0c03 = 0;
- sample_set_volume(0,0);
- sample_start_raw(0,waveform,ARRAY_LENGTH(waveform),freq1,1);
- sample_set_volume(1,0);
- sample_start_raw(1,waveform,ARRAY_LENGTH(waveform),freq2,1);
+ sample_set_volume(device,0,0);
+ sample_start_raw(device,0,waveform,ARRAY_LENGTH(waveform),freq1,1);
+ sample_set_volume(device,1,0);
+ sample_start_raw(device,1,waveform,ARRAY_LENGTH(waveform),freq2,1);
}
/************************************/
@@ -60,6 +60,7 @@ SAMPLES_START( meadows_sh_start )
/************************************/
void meadows_sh_update(running_machine *machine)
{
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
int preset, amp;
if (latched_0c01 != meadows_0c01 || latched_0c03 != meadows_0c03)
@@ -76,8 +77,8 @@ void meadows_sh_update(running_machine *machine)
freq1 = BASE_CTR1 / (preset + 1);
else amp = 0;
logerror("meadows ctr1 channel #%d preset:%3d freq:%5d amp:%d\n", channel, preset, freq1, amp);
- sample_set_freq(0, freq1 * sizeof(waveform)/2);
- sample_set_volume(0,amp/255.0);
+ sample_set_freq(samples, 0, freq1 * sizeof(waveform)/2);
+ sample_set_volume(samples, 0,amp/255.0);
}
if (latched_0c02 != meadows_0c02 || latched_0c03 != meadows_0c03)
@@ -94,8 +95,8 @@ void meadows_sh_update(running_machine *machine)
}
else amp = 0;
logerror("meadows ctr2 channel #%d preset:%3d freq:%5d amp:%d\n", channel+1, preset, freq2, amp);
- sample_set_freq(1, freq2 * sizeof(waveform));
- sample_set_volume(1,amp/255.0);
+ sample_set_freq(samples, 1, freq2 * sizeof(waveform));
+ sample_set_volume(samples, 1,amp/255.0);
}
if (latched_0c03 != meadows_0c03)
@@ -103,9 +104,9 @@ void meadows_sh_update(running_machine *machine)
dac_enable = meadows_0c03 & ENABLE_DAC;
if (dac_enable)
- dac_data_w(0, meadows_dac);
+ dac_data_w(devtag_get_device(machine, SOUND, "dac"), meadows_dac);
else
- dac_data_w(0, 0);
+ dac_data_w(devtag_get_device(machine, SOUND, "dac"), 0);
}
latched_0c01 = meadows_0c01;
@@ -116,13 +117,13 @@ void meadows_sh_update(running_machine *machine)
/************************************/
/* Write DAC value */
/************************************/
-void meadows_sh_dac_w(int data)
+void meadows_sh_dac_w(running_machine *machine, int data)
{
meadows_dac = data;
if (dac_enable)
- dac_data_w(0, meadows_dac);
+ dac_data_w(devtag_get_device(machine, SOUND, "dac"), meadows_dac);
else
- dac_data_w(0, 0);
+ dac_data_w(devtag_get_device(machine, SOUND, "dac"), 0);
}
diff --git a/src/mame/audio/mw8080bw.c b/src/mame/audio/mw8080bw.c
index cff9e30ec2c..9799431a270 100644
--- a/src/mame/audio/mw8080bw.c
+++ b/src/mame/audio/mw8080bw.c
@@ -64,19 +64,19 @@ static SOUND_START( samples )
DISCRETE_OP_AMP_TRIG_VCA(MIDWAY_TONE_SND, MIDWAY_TONE_BEFORE_AMP_SND, MIDWAY_TONE_EN, 0, 12, 0, &discrete_op_amp_tvca_info)
-WRITE8_HANDLER( midway_tone_generator_lo_w )
+WRITE8_DEVICE_HANDLER( midway_tone_generator_lo_w )
{
- discrete_sound_w(space, MIDWAY_TONE_EN, (data >> 0) & 0x01);
+ discrete_sound_w(device, MIDWAY_TONE_EN, (data >> 0) & 0x01);
- discrete_sound_w(space, MIDWAY_TONE_DATA_L, (data >> 1) & 0x1f);
+ discrete_sound_w(device, MIDWAY_TONE_DATA_L, (data >> 1) & 0x1f);
/* D6 and D7 are not connected */
}
-WRITE8_HANDLER( midway_tone_generator_hi_w )
+WRITE8_DEVICE_HANDLER( midway_tone_generator_hi_w )
{
- discrete_sound_w(space, MIDWAY_TONE_DATA_H, data & 0x3f);
+ discrete_sound_w(device, MIDWAY_TONE_DATA_H, data & 0x3f);
/* D6 and D7 are not connected */
}
@@ -146,22 +146,23 @@ MACHINE_DRIVER_END
WRITE8_HANDLER( seawolf_audio_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
UINT8 rising_bits = data & ~port_1_last;
/* if (data & 0x01) enable SHIP HIT sound */
- if (rising_bits & 0x01) sample_start_n(0, 0, 0, 0);
+ if (rising_bits & 0x01) sample_start(samples, 0, 0, 0);
/* if (data & 0x02) enable TORPEDO sound */
- if (rising_bits & 0x02) sample_start_n(0, 1, 1, 0);
+ if (rising_bits & 0x02) sample_start(samples, 1, 1, 0);
/* if (data & 0x04) enable DIVE sound */
- if (rising_bits & 0x04) sample_start_n(0, 2, 2, 0);
+ if (rising_bits & 0x04) sample_start(samples, 2, 2, 0);
/* if (data & 0x08) enable SONAR sound */
- if (rising_bits & 0x08) sample_start_n(0, 3, 3, 0);
+ if (rising_bits & 0x08) sample_start(samples, 3, 3, 0);
/* if (data & 0x10) enable MINE HIT sound */
- if (rising_bits & 0x10) sample_start_n(0, 4, 4, 0);
+ if (rising_bits & 0x10) sample_start(samples, 4, 4, 0);
coin_counter_w(0, (data >> 5) & 0x01);
@@ -211,6 +212,9 @@ MACHINE_DRIVER_END
WRITE8_HANDLER( gunfight_audio_w )
{
+ const device_config *samples0 = devtag_get_device(space->machine, SOUND, "samples1");
+ const device_config *samples1 = devtag_get_device(space->machine, SOUND, "samples2");
+
/* D0 and D1 are just tied to 1k resistors */
coin_counter_w(0, (data >> 2) & 0x01);
@@ -223,22 +227,22 @@ WRITE8_HANDLER( gunfight_audio_w )
case 0x01:
/* enable LEFT SHOOT sound (left speaker) */
- sample_start_n(0, 0, 0, 0);
+ sample_start(samples0, 0, 0, 0);
break;
case 0x02:
/* enable RIGHT SHOOT sound (right speaker) */
- sample_start_n(1, 0, 0, 0);
+ sample_start(samples1, 0, 0, 0);
break;
case 0x03:
/* enable LEFT HIT sound (left speaker) */
- sample_start_n(0, 0, 1, 0);
+ sample_start(samples0, 0, 1, 0);
break;
case 0x04:
/* enable RIGHT HIT sound (right speaker) */
- sample_start_n(1, 0, 1, 0);
+ sample_start(samples1, 0, 1, 0);
break;
default:
@@ -309,19 +313,19 @@ MACHINE_DRIVER_START( tornbase_audio )
MACHINE_DRIVER_END
-WRITE8_HANDLER( tornbase_audio_w )
+WRITE8_DEVICE_HANDLER( tornbase_audio_w )
{
- discrete_sound_w(space, TORNBASE_TONE_240_EN, (data >> 0) & 0x01);
+ discrete_sound_w(device, TORNBASE_TONE_240_EN, (data >> 0) & 0x01);
- discrete_sound_w(space, TORNBASE_TONE_960_EN, (data >> 1) & 0x01);
+ discrete_sound_w(device, TORNBASE_TONE_960_EN, (data >> 1) & 0x01);
- discrete_sound_w(space, TORNBASE_TONE_120_EN, (data >> 2) & 0x01);
+ discrete_sound_w(device, TORNBASE_TONE_120_EN, (data >> 2) & 0x01);
/* if (data & 0x08) enable SIREN sound */
/* if (data & 0x10) enable CHEER sound */
- if (tornbase_get_cabinet_type(space->machine) == TORNBASE_CAB_TYPE_UPRIGHT_OLD)
+ if (tornbase_get_cabinet_type(device->machine) == TORNBASE_CAB_TYPE_UPRIGHT_OLD)
{
/* if (data & 0x20) enable WHISTLE sound */
@@ -565,24 +569,22 @@ MACHINE_DRIVER_START( maze_audio )
MACHINE_DRIVER_END
-void maze_write_discrete(running_machine *machine, UINT8 maze_tone_timing_state)
+void maze_write_discrete(const device_config *device, UINT8 maze_tone_timing_state)
{
- const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
-
/* controls need to be active low */
- int controls = ~input_port_read(machine, "IN0") & 0xff;
+ int controls = ~input_port_read(device->machine, "IN0") & 0xff;
- discrete_sound_w(space, MAZE_TONE_TIMING, maze_tone_timing_state);
- discrete_sound_w(space, MAZE_P1_DATA, controls & 0x0f);
- discrete_sound_w(space, MAZE_P2_DATA, (controls >> 4) & 0x0f);
- discrete_sound_w(space, MAZE_JOYSTICK_IN_USE, controls != 0xff);
+ discrete_sound_w(device, MAZE_TONE_TIMING, maze_tone_timing_state);
+ discrete_sound_w(device, MAZE_P1_DATA, controls & 0x0f);
+ discrete_sound_w(device, MAZE_P2_DATA, (controls >> 4) & 0x0f);
+ discrete_sound_w(device, MAZE_JOYSTICK_IN_USE, controls != 0xff);
/* The coin line is connected directly to the discrete circuit. */
/* We can't really do that, so updating it with the tone timing is close enough. */
/* A better option might be to update it at vblank or set a timer to do it. */
/* The only noticeable difference doing it here, is that the controls don't */
/* imediately start making tones if pressed right after the coin is inserted. */
- discrete_sound_w(space, MAZE_COIN, (~input_port_read(machine, "IN1") >> 3) & 0x01);
+ discrete_sound_w(device, MAZE_COIN, (~input_port_read(device->machine, "IN1") >> 3) & 0x01);
}
@@ -803,21 +805,21 @@ MACHINE_DRIVER_START( boothill_audio )
MACHINE_DRIVER_END
-WRITE8_HANDLER( boothill_audio_w )
+WRITE8_DEVICE_HANDLER( boothill_audio_w )
{
/* D0 and D1 are not connected */
coin_counter_w(0, (data >> 2) & 0x01);
- discrete_sound_w(space, BOOTHILL_GAME_ON_EN, (data >> 3) & 0x01);
+ discrete_sound_w(device, BOOTHILL_GAME_ON_EN, (data >> 3) & 0x01);
- discrete_sound_w(space, BOOTHILL_LEFT_SHOT_EN, (data >> 4) & 0x01);
+ discrete_sound_w(device, BOOTHILL_LEFT_SHOT_EN, (data >> 4) & 0x01);
- discrete_sound_w(space, BOOTHILL_RIGHT_SHOT_EN, (data >> 5) & 0x01);
+ discrete_sound_w(device, BOOTHILL_RIGHT_SHOT_EN, (data >> 5) & 0x01);
- discrete_sound_w(space, BOOTHILL_LEFT_HIT_EN, (data >> 6) & 0x01);
+ discrete_sound_w(device, BOOTHILL_LEFT_HIT_EN, (data >> 6) & 0x01);
- discrete_sound_w(space, BOOTHILL_RIGHT_HIT_EN, (data >> 7) & 0x01);
+ discrete_sound_w(device, BOOTHILL_RIGHT_HIT_EN, (data >> 7) & 0x01);
}
@@ -1037,18 +1039,18 @@ MACHINE_DRIVER_START( checkmat_audio )
MACHINE_DRIVER_END
-WRITE8_HANDLER( checkmat_audio_w )
+WRITE8_DEVICE_HANDLER( checkmat_audio_w )
{
- discrete_sound_w(space, CHECKMAT_TONE_EN, data & 0x01);
+ discrete_sound_w(device, CHECKMAT_TONE_EN, data & 0x01);
- discrete_sound_w(space, CHECKMAT_BOOM_EN, (data >> 1) & 0x01);
+ discrete_sound_w(device, CHECKMAT_BOOM_EN, (data >> 1) & 0x01);
coin_counter_w(0, (data >> 2) & 0x01);
sound_global_enable((data >> 3) & 0x01);
- discrete_sound_w(space, CHECKMAT_TONE_DATA_45, (data >> 4) & 0x03);
- discrete_sound_w(space, CHECKMAT_TONE_DATA_67, (data >> 6) & 0x03);
+ discrete_sound_w(device, CHECKMAT_TONE_DATA_45, (data >> 4) & 0x03);
+ discrete_sound_w(device, CHECKMAT_TONE_DATA_67, (data >> 6) & 0x03);
}
@@ -1276,29 +1278,29 @@ MACHINE_DRIVER_START( desertgu_audio )
MACHINE_DRIVER_END
-WRITE8_HANDLER( desertgu_audio_1_w )
+WRITE8_DEVICE_HANDLER( desertgu_audio_1_w )
{
/* D0 and D1 are not connected */
coin_counter_w(0, (data >> 2) & 0x01);
- discrete_sound_w(space, DESERTGU_GAME_ON_EN, (data >> 3) & 0x01);
+ discrete_sound_w(device, DESERTGU_GAME_ON_EN, (data >> 3) & 0x01);
- discrete_sound_w(space, DESERTGU_RIFLE_SHOT_EN, (data >> 4) & 0x01);
+ discrete_sound_w(device, DESERTGU_RIFLE_SHOT_EN, (data >> 4) & 0x01);
- discrete_sound_w(space, DESERTGU_BOTTLE_HIT_EN, (data >> 5) & 0x01);
+ discrete_sound_w(device, DESERTGU_BOTTLE_HIT_EN, (data >> 5) & 0x01);
- discrete_sound_w(space, DESERTGU_ROAD_RUNNER_HIT_EN, (data >> 6) & 0x01);
+ discrete_sound_w(device, DESERTGU_ROAD_RUNNER_HIT_EN, (data >> 6) & 0x01);
- discrete_sound_w(space, DESERTGU_CREATURE_HIT_EN, (data >> 7) & 0x01);
+ discrete_sound_w(device, DESERTGU_CREATURE_HIT_EN, (data >> 7) & 0x01);
}
-WRITE8_HANDLER( desertgu_audio_2_w )
+WRITE8_DEVICE_HANDLER( desertgu_audio_2_w )
{
- discrete_sound_w(space, DESERTGU_ROADRUNNER_BEEP_BEEP_EN, (data >> 0) & 0x01);
+ discrete_sound_w(device, DESERTGU_ROADRUNNER_BEEP_BEEP_EN, (data >> 0) & 0x01);
- discrete_sound_w(space, DESERTGU_TRIGGER_CLICK_EN, (data >> 1) & 0x01);
+ discrete_sound_w(device, DESERTGU_TRIGGER_CLICK_EN, (data >> 1) & 0x01);
output_set_value("KICKER", (data >> 2) & 0x01);
@@ -1570,17 +1572,17 @@ MACHINE_DRIVER_START( dplay_audio )
MACHINE_DRIVER_END
-WRITE8_HANDLER( dplay_audio_w )
+WRITE8_DEVICE_HANDLER( dplay_audio_w )
{
- discrete_sound_w(space, DPLAY_TONE_ON_EN, (data >> 0) & 0x01);
+ discrete_sound_w(device, DPLAY_TONE_ON_EN, (data >> 0) & 0x01);
- discrete_sound_w(space, DPLAY_CHEER_EN, (data >> 1) & 0x01);
+ discrete_sound_w(device, DPLAY_CHEER_EN, (data >> 1) & 0x01);
- discrete_sound_w(space, DPLAY_SIREN_EN, (data >> 2) & 0x01);
+ discrete_sound_w(device, DPLAY_SIREN_EN, (data >> 2) & 0x01);
- discrete_sound_w(space, DPLAY_WHISTLE_EN, (data >> 3) & 0x01);
+ discrete_sound_w(device, DPLAY_WHISTLE_EN, (data >> 3) & 0x01);
- discrete_sound_w(space, DPLAY_GAME_ON_EN, (data >> 4) & 0x01);
+ discrete_sound_w(device, DPLAY_GAME_ON_EN, (data >> 4) & 0x01);
coin_counter_w(0, (data >> 5) & 0x01);
@@ -1632,6 +1634,8 @@ WRITE8_HANDLER( gmissile_audio_1_w )
reversed (D5=R, D7=L), but the software confirms that
ours is right */
+ const device_config *samples0 = devtag_get_device(space->machine, SOUND, "samples1");
+ const device_config *samples1 = devtag_get_device(space->machine, SOUND, "samples2");
UINT8 rising_bits = data & ~port_1_last;
/* D0 and D1 are not connected */
@@ -1641,18 +1645,18 @@ WRITE8_HANDLER( gmissile_audio_1_w )
sound_global_enable((data >> 3) & 0x01);
/* if (data & 0x10) enable RIGHT MISSILE sound (goes to right speaker) */
- if (rising_bits & 0x10) sample_start_n(1, 0, 0, 0);
+ if (rising_bits & 0x10) sample_start(samples1, 0, 0, 0);
/* if (data & 0x20) enable LEFT EXPLOSION sound (goes to left speaker) */
output_set_value("L_EXP_LIGHT", (data >> 5) & 0x01);
- if (rising_bits & 0x20) sample_start_n(0, 0, 1, 0);
+ if (rising_bits & 0x20) sample_start(samples0, 0, 1, 0);
/* if (data & 0x40) enable LEFT MISSILE sound (goes to left speaker) */
- if (rising_bits & 0x40) sample_start_n(0, 0, 0, 0);
+ if (rising_bits & 0x40) sample_start(samples0, 0, 0, 0);
/* if (data & 0x80) enable RIGHT EXPLOSION sound (goes to right speaker) */
output_set_value("R_EXP_LIGHT", (data >> 7) & 0x01);
- if (rising_bits & 0x80) sample_start_n(1, 0, 1, 0);
+ if (rising_bits & 0x80) sample_start(samples1, 0, 1, 0);
port_1_last = data;
}
@@ -1726,6 +1730,8 @@ MACHINE_DRIVER_END
WRITE8_HANDLER( m4_audio_1_w )
{
+ const device_config *samples0 = devtag_get_device(space->machine, SOUND, "samples1");
+ const device_config *samples1 = devtag_get_device(space->machine, SOUND, "samples2");
UINT8 rising_bits = data & ~port_1_last;
/* D0 and D1 are not connected */
@@ -1735,16 +1741,16 @@ WRITE8_HANDLER( m4_audio_1_w )
sound_global_enable((data >> 3) & 0x01);
/* if (data & 0x10) enable LEFT PLAYER SHOT sound (goes to left speaker) */
- if (rising_bits & 0x10) sample_start_n(0, 0, 0, 0);
+ if (rising_bits & 0x10) sample_start(samples0, 0, 0, 0);
/* if (data & 0x20) enable RIGHT PLAYER SHOT sound (goes to right speaker) */
- if (rising_bits & 0x20) sample_start_n(1, 0, 0, 0);
+ if (rising_bits & 0x20) sample_start(samples1, 0, 0, 0);
/* if (data & 0x40) enable LEFT PLAYER EXPLOSION sound via 300K res (goes to left speaker) */
- if (rising_bits & 0x40) sample_start_n(0, 1, 1, 0);
+ if (rising_bits & 0x40) sample_start(samples0, 1, 1, 0);
/* if (data & 0x80) enable RIGHT PLAYER EXPLOSION sound via 300K res (goes to right speaker) */
- if (rising_bits & 0x80) sample_start_n(1, 1, 1, 0);
+ if (rising_bits & 0x80) sample_start(samples1, 1, 1, 0);
port_1_last = data;
}
@@ -1752,13 +1758,15 @@ WRITE8_HANDLER( m4_audio_1_w )
WRITE8_HANDLER( m4_audio_2_w )
{
+ const device_config *samples0 = devtag_get_device(space->machine, SOUND, "samples1");
+ const device_config *samples1 = devtag_get_device(space->machine, SOUND, "samples2");
UINT8 rising_bits = data & ~port_2_last;
/* if (data & 0x01) enable LEFT PLAYER EXPLOSION sound via 510K res (goes to left speaker) */
- if (rising_bits & 0x01) sample_start_n(0, 1, 1, 0);
+ if (rising_bits & 0x01) sample_start(samples0, 1, 1, 0);
/* if (data & 0x02) enable RIGHT PLAYER EXPLOSION sound via 510K res (goes to right speaker) */
- if (rising_bits & 0x02) sample_start_n(1, 1, 1, 0);
+ if (rising_bits & 0x02) sample_start(samples1, 1, 1, 0);
/* if (data & 0x04) enable LEFT TANK MOTOR sound (goes to left speaker) */
@@ -2022,21 +2030,22 @@ WRITE8_HANDLER( clowns_audio_1_w )
}
-WRITE8_HANDLER( clowns_audio_2_w )
+WRITE8_DEVICE_HANDLER( clowns_audio_2_w )
{
+ const device_config *samples = devtag_get_device(device->machine, SOUND, "samples");
UINT8 rising_bits = data & ~port_2_last;
- discrete_sound_w(space, CLOWNS_POP_BOTTOM_EN, (data >> 0) & 0x01);
+ discrete_sound_w(device, CLOWNS_POP_BOTTOM_EN, (data >> 0) & 0x01);
- discrete_sound_w(space, CLOWNS_POP_MIDDLE_EN, (data >> 1) & 0x01);
+ discrete_sound_w(device, CLOWNS_POP_MIDDLE_EN, (data >> 1) & 0x01);
- discrete_sound_w(space, CLOWNS_POP_TOP_EN, (data >> 2) & 0x01);
+ discrete_sound_w(device, CLOWNS_POP_TOP_EN, (data >> 2) & 0x01);
sound_global_enable((data >> 3) & 0x01);
- discrete_sound_w(space, CLOWNS_SPRINGBOARD_HIT_EN, (data >> 4) & 0x01);
+ discrete_sound_w(device, CLOWNS_SPRINGBOARD_HIT_EN, (data >> 4) & 0x01);
- if (rising_bits & 0x20) sample_start_n(0, 0, 0, 0); /* springboard miss */
+ if (rising_bits & 0x20) sample_start(samples, 0, 0, 0); /* springboard miss */
/* D6 and D7 are not connected */
@@ -2696,26 +2705,26 @@ MACHINE_DRIVER_END
-WRITE8_HANDLER( spcenctr_audio_1_w )
+WRITE8_DEVICE_HANDLER( spcenctr_audio_1_w )
{
sound_global_enable((data >> 0) & 0x01);
/* D1 is marked as 'OPTIONAL SWITCH VIDEO FOR COCKTAIL',
but it is never set by the software */
- discrete_sound_w(space, SPCENCTR_CRASH_EN, (data >> 2) & 0x01);
+ discrete_sound_w(device, SPCENCTR_CRASH_EN, (data >> 2) & 0x01);
/* D3-D7 are not connected */
}
-WRITE8_HANDLER( spcenctr_audio_2_w )
+WRITE8_DEVICE_HANDLER( spcenctr_audio_2_w )
{
/* set WIND SOUND FREQ(data & 0x0f) 0, if no wind */
- discrete_sound_w(space, SPCENCTR_EXPLOSION_EN, (data >> 4) & 0x01);
+ discrete_sound_w(device, SPCENCTR_EXPLOSION_EN, (data >> 4) & 0x01);
- discrete_sound_w(space, SPCENCTR_PLAYER_SHOT_EN, (data >> 5) & 0x01);
+ discrete_sound_w(device, SPCENCTR_PLAYER_SHOT_EN, (data >> 5) & 0x01);
/* D6 and D7 are not connected */
@@ -2723,19 +2732,21 @@ WRITE8_HANDLER( spcenctr_audio_2_w )
}
-WRITE8_HANDLER( spcenctr_audio_3_w )
+WRITE8_DEVICE_HANDLER( spcenctr_audio_3_w )
{
+ const device_config *sn = devtag_get_device(device->machine, SOUND, "sn");
+
/* if (data & 0x01) enable SCREECH (hit the sides) sound */
- discrete_sound_w(space, SPCENCTR_ENEMY_SHIP_SHOT_EN, (data >> 1) & 0x01);
+ discrete_sound_w(device, SPCENCTR_ENEMY_SHIP_SHOT_EN, (data >> 1) & 0x01);
spcenctr_set_strobe_state((data >> 2) & 0x01);
output_set_value("LAMP", (data >> 3) & 0x01);
- discrete_sound_w(space, SPCENCTR_BONUS_EN, (data >> 4) & 0x01);
+ discrete_sound_w(device, SPCENCTR_BONUS_EN, (data >> 4) & 0x01);
- sn76477_enable_w(0, (data >> 5) & 0x01); /* saucer sound */
+ sn76477_enable_w(sn, (data >> 5) & 0x01); /* saucer sound */
/* D6 and D7 are not connected */
}
@@ -2776,10 +2787,11 @@ MACHINE_DRIVER_END
WRITE8_HANDLER( phantom2_audio_1_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
UINT8 rising_bits = data & ~port_1_last;
/* if (data & 0x01) enable PLAYER SHOT sound */
- if (rising_bits & 0x01) sample_start_n(0, 0, 0, 0);
+ if (rising_bits & 0x01) sample_start(samples, 0, 0, 0);
/* if (data & 0x02) enable ENEMY SHOT sound */
@@ -2797,12 +2809,13 @@ WRITE8_HANDLER( phantom2_audio_1_w )
WRITE8_HANDLER( phantom2_audio_2_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
UINT8 rising_bits = data & ~port_2_last;
/* D0-D2 are not connected */
/* if (data & 0x08) enable EXPLOSION sound */
- if (rising_bits & 0x08) sample_start_n(0, 1, 1, 0);
+ if (rising_bits & 0x08) sample_start(samples, 1, 1, 0);
output_set_value("EXPLAMP", (data >> 4) & 0x01);
@@ -2902,7 +2915,7 @@ MACHINE_DRIVER_START( bowler_audio )
MACHINE_DRIVER_END
-WRITE8_HANDLER( bowler_audio_1_w )
+WRITE8_DEVICE_HANDLER( bowler_audio_1_w )
{
/* D0 - selects controller on the cocktail PCB */
@@ -2910,7 +2923,7 @@ WRITE8_HANDLER( bowler_audio_1_w )
sound_global_enable((data >> 2) & 0x01);
- discrete_sound_w(space, BOWLER_FOWL_EN, (data >> 3) & 0x01);
+ discrete_sound_w(device, BOWLER_FOWL_EN, (data >> 3) & 0x01);
/* D4 - appears to be a screen flip, but it's
shown unconnected on the schematics for both the
@@ -3634,14 +3647,16 @@ MACHINE_DRIVER_START( invaders_audio )
MACHINE_DRIVER_END
-WRITE8_HANDLER( invaders_audio_1_w )
+WRITE8_DEVICE_HANDLER( invaders_audio_1_w )
{
- sn76477_enable_w(0, (~data >> 0) & 0x01); /* saucer sound */
+ const device_config *sn = devtag_get_device(device->machine, SOUND, "sn");
- discrete_sound_w(space, INVADERS_NODE(INVADERS_MISSILE_EN, 1), data & 0x02);
- discrete_sound_w(space, INVADERS_NODE(INVADERS_EXPLOSION_EN, 1), data & 0x04);
- discrete_sound_w(space, INVADERS_NODE(INVADERS_INVADER_HIT_EN, 1), data & 0x08);
- discrete_sound_w(space, INVADERS_NODE(INVADERS_BONUS_MISSLE_BASE_EN, 1), data & 0x10);
+ sn76477_enable_w(sn, (~data >> 0) & 0x01); /* saucer sound */
+
+ discrete_sound_w(device, INVADERS_NODE(INVADERS_MISSILE_EN, 1), data & 0x02);
+ discrete_sound_w(device, INVADERS_NODE(INVADERS_EXPLOSION_EN, 1), data & 0x04);
+ discrete_sound_w(device, INVADERS_NODE(INVADERS_INVADER_HIT_EN, 1), data & 0x08);
+ discrete_sound_w(device, INVADERS_NODE(INVADERS_BONUS_MISSLE_BASE_EN, 1), data & 0x10);
sound_global_enable(data & 0x20);
@@ -3649,13 +3664,13 @@ WRITE8_HANDLER( invaders_audio_1_w )
}
-WRITE8_HANDLER( invaders_audio_2_w )
+WRITE8_DEVICE_HANDLER( invaders_audio_2_w )
{
- discrete_sound_w(space, INVADERS_NODE(INVADERS_FLEET_DATA, 1), data & 0x0f);
- discrete_sound_w(space, INVADERS_NODE(INVADERS_SAUCER_HIT_EN, 1), data & 0x10);
+ discrete_sound_w(device, INVADERS_NODE(INVADERS_FLEET_DATA, 1), data & 0x0f);
+ discrete_sound_w(device, INVADERS_NODE(INVADERS_SAUCER_HIT_EN, 1), data & 0x10);
/* the flip screen line is only connected on the cocktail PCB */
- if (invaders_is_cabinet_cocktail(space->machine))
+ if (invaders_is_cabinet_cocktail(device->machine))
{
invaders_set_flip_screen((data >> 5) & 0x01);
}
@@ -3786,20 +3801,20 @@ MACHINE_DRIVER_START( blueshrk_audio )
MACHINE_DRIVER_END
-WRITE8_HANDLER( blueshrk_audio_w )
+WRITE8_DEVICE_HANDLER( blueshrk_audio_w )
{
- discrete_sound_w(space, BLUESHRK_GAME_ON_EN, (data >> 0) & 0x01);
+ discrete_sound_w(device, BLUESHRK_GAME_ON_EN, (data >> 0) & 0x01);
- /* discrete_sound_w(BLUESHRK_SHOT_EN, (data >> 1) & 0x01); */
+ /* discrete_sound_w(device, BLUESHRK_SHOT_EN, (data >> 1) & 0x01); */
- discrete_sound_w(space, BLUESHRK_HIT_EN, (data >> 2) & 0x01);
+ discrete_sound_w(device, BLUESHRK_HIT_EN, (data >> 2) & 0x01);
- /* discrete_sound_w(BLUESHRK_SHARK_EN, (data >> 3) & 0x01); */
+ /* discrete_sound_w(device, BLUESHRK_SHARK_EN, (data >> 3) & 0x01); */
/* if (data & 0x10) enable KILLED DIVER sound, this circuit
doesn't appear to be on the schematics */
- /* discrete_sound_w(BLUESHRK_OCTOPUS_EN, (data >> 5) & 0x01); */
+ /* discrete_sound_w(device, BLUESHRK_OCTOPUS_EN, (data >> 5) & 0x01); */
/* D6 and D7 are not connected */
}
@@ -4014,14 +4029,16 @@ MACHINE_DRIVER_START( invad2ct_audio )
MACHINE_DRIVER_END
-WRITE8_HANDLER( invad2ct_audio_1_w )
+WRITE8_DEVICE_HANDLER( invad2ct_audio_1_w )
{
- sn76477_enable_w(0, (~data >> 0) & 0x01); /* saucer sound */
+ const device_config *sn = devtag_get_device(device->machine, SOUND, "sn1");
+
+ sn76477_enable_w(sn, (~data >> 0) & 0x01); /* saucer sound */
- discrete_sound_w(space, INVADERS_NODE(INVADERS_MISSILE_EN, 1), data & 0x02);
- discrete_sound_w(space, INVADERS_NODE(INVADERS_EXPLOSION_EN, 1), data & 0x04);
- discrete_sound_w(space, INVADERS_NODE(INVADERS_INVADER_HIT_EN, 1), data & 0x08);
- discrete_sound_w(space, INVADERS_NODE(INVADERS_BONUS_MISSLE_BASE_EN, 1), data & 0x10);
+ discrete_sound_w(device, INVADERS_NODE(INVADERS_MISSILE_EN, 1), data & 0x02);
+ discrete_sound_w(device, INVADERS_NODE(INVADERS_EXPLOSION_EN, 1), data & 0x04);
+ discrete_sound_w(device, INVADERS_NODE(INVADERS_INVADER_HIT_EN, 1), data & 0x08);
+ discrete_sound_w(device, INVADERS_NODE(INVADERS_BONUS_MISSLE_BASE_EN, 1), data & 0x10);
sound_global_enable(data & 0x20);
@@ -4029,32 +4046,34 @@ WRITE8_HANDLER( invad2ct_audio_1_w )
}
-WRITE8_HANDLER( invad2ct_audio_2_w )
+WRITE8_DEVICE_HANDLER( invad2ct_audio_2_w )
{
- discrete_sound_w(space, INVADERS_NODE(INVADERS_FLEET_DATA, 1), data & 0x0f);
- discrete_sound_w(space, INVADERS_NODE(INVADERS_SAUCER_HIT_EN, 1), data & 0x10);
+ discrete_sound_w(device, INVADERS_NODE(INVADERS_FLEET_DATA, 1), data & 0x0f);
+ discrete_sound_w(device, INVADERS_NODE(INVADERS_SAUCER_HIT_EN, 1), data & 0x10);
/* D5-D7 are not connected */
}
-WRITE8_HANDLER( invad2ct_audio_3_w )
+WRITE8_DEVICE_HANDLER( invad2ct_audio_3_w )
{
- sn76477_enable_w(1, (~data >> 0) & 0x01); /* saucer sound */
+ const device_config *sn = devtag_get_device(device->machine, SOUND, "sn2");
+
+ sn76477_enable_w(sn, (~data >> 0) & 0x01); /* saucer sound */
- discrete_sound_w(space, INVADERS_NODE(INVADERS_MISSILE_EN, 2), data & 0x02);
- discrete_sound_w(space, INVADERS_NODE(INVADERS_EXPLOSION_EN, 2), data & 0x04);
- discrete_sound_w(space, INVADERS_NODE(INVADERS_INVADER_HIT_EN, 2), data & 0x08);
- discrete_sound_w(space, INVADERS_NODE(INVADERS_BONUS_MISSLE_BASE_EN, 2), data & 0x10);
+ discrete_sound_w(device, INVADERS_NODE(INVADERS_MISSILE_EN, 2), data & 0x02);
+ discrete_sound_w(device, INVADERS_NODE(INVADERS_EXPLOSION_EN, 2), data & 0x04);
+ discrete_sound_w(device, INVADERS_NODE(INVADERS_INVADER_HIT_EN, 2), data & 0x08);
+ discrete_sound_w(device, INVADERS_NODE(INVADERS_BONUS_MISSLE_BASE_EN, 2), data & 0x10);
/* D5-D7 are not connected */
}
-WRITE8_HANDLER( invad2ct_audio_4_w )
+WRITE8_DEVICE_HANDLER( invad2ct_audio_4_w )
{
- discrete_sound_w(space, INVADERS_NODE(INVADERS_FLEET_DATA, 2), data & 0x0f);
- discrete_sound_w(space, INVADERS_NODE(INVADERS_SAUCER_HIT_EN, 2), data & 0x10);
+ discrete_sound_w(device, INVADERS_NODE(INVADERS_FLEET_DATA, 2), data & 0x0f);
+ discrete_sound_w(device, INVADERS_NODE(INVADERS_SAUCER_HIT_EN, 2), data & 0x10);
/* D5-D7 are not connected */
}
diff --git a/src/mame/audio/n8080.c b/src/mame/audio/n8080.c
index d9f2e91d3dd..0d78b9a5e9e 100644
--- a/src/mame/audio/n8080.c
+++ b/src/mame/audio/n8080.c
@@ -85,7 +85,7 @@ static const sn76477_interface spacefev_sn76477_interface =
};
-static void spacefev_update_SN76477_status(running_machine *machine)
+static void spacefev_update_SN76477_status(const device_config *sn)
{
double dblR0 = RES_M(1.0);
double dblR1 = RES_M(1.5);
@@ -99,70 +99,70 @@ static void spacefev_update_SN76477_status(running_machine *machine)
dblR1 = 1 / (1 / RES_K(620) + 1 / dblR1); /* ? */
}
- sn76477_decay_res_w(0, dblR0);
+ sn76477_decay_res_w(sn, dblR0);
- sn76477_vco_res_w(0, dblR1);
+ sn76477_vco_res_w(sn, dblR1);
- sn76477_enable_w(0,
+ sn76477_enable_w(sn,
!mono_flop[0] &&
!mono_flop[1] &&
!mono_flop[2]);
- sn76477_vco_w(0, mono_flop[1]);
+ sn76477_vco_w(sn, mono_flop[1]);
- sn76477_mixer_b_w(0, mono_flop[0]);
+ sn76477_mixer_b_w(sn, mono_flop[0]);
}
-static void sheriff_update_SN76477_status(running_machine *machine)
+static void sheriff_update_SN76477_status(const device_config *sn)
{
if (mono_flop[1])
{
- sn76477_vco_voltage_w(0, 5);
+ sn76477_vco_voltage_w(sn, 5);
}
else
{
- sn76477_vco_voltage_w(0, 0);
+ sn76477_vco_voltage_w(sn, 0);
}
- sn76477_enable_w(0,
+ sn76477_enable_w(sn,
!mono_flop[0] &&
!mono_flop[1]);
- sn76477_vco_w(0, mono_flop[0]);
+ sn76477_vco_w(sn, mono_flop[0]);
- sn76477_mixer_b_w(0, !mono_flop[0]);
+ sn76477_mixer_b_w(sn, !mono_flop[0]);
}
-static void update_SN76477_status(running_machine *machine)
+static void update_SN76477_status(const device_config *device)
{
if (n8080_hardware == 1)
{
- spacefev_update_SN76477_status(machine);
+ spacefev_update_SN76477_status(device);
}
if (n8080_hardware == 2)
{
- sheriff_update_SN76477_status(machine);
+ sheriff_update_SN76477_status(device);
}
}
-static void start_mono_flop(running_machine *machine, int n, attotime expire)
+static void start_mono_flop(const device_config *sn, int n, attotime expire)
{
mono_flop[n] = 1;
- update_SN76477_status(machine);
+ update_SN76477_status(sn);
timer_adjust_oneshot(sound_timer[n], expire, n);
}
-static void stop_mono_flop(running_machine *machine, int n)
+static void stop_mono_flop(const device_config *sn, int n)
{
mono_flop[n] = 0;
- update_SN76477_status(machine);
+ update_SN76477_status(sn);
timer_adjust_oneshot(sound_timer[n], attotime_never, n);
}
@@ -170,33 +170,34 @@ static void stop_mono_flop(running_machine *machine, int n)
static TIMER_CALLBACK( stop_mono_flop_callback )
{
- stop_mono_flop(machine, param);
+ stop_mono_flop(devtag_get_device(machine, SOUND, "sn"), param);
}
static void spacefev_sound_pins_changed(running_machine *machine)
{
+ const device_config *sn = devtag_get_device(machine, SOUND, "sn");
UINT16 changes = ~curr_sound_pins & prev_sound_pins;
if (changes & (1 << 0x3))
{
- stop_mono_flop(machine, 1);
+ stop_mono_flop(sn, 1);
}
if (changes & ((1 << 0x3) | (1 << 0x6)))
{
- stop_mono_flop(machine, 2);
+ stop_mono_flop(sn, 2);
}
if (changes & (1 << 0x3))
{
- start_mono_flop(machine, 0, ATTOTIME_IN_USEC(550 * 36 * 100));
+ start_mono_flop(sn, 0, ATTOTIME_IN_USEC(550 * 36 * 100));
}
if (changes & (1 << 0x6))
{
- start_mono_flop(machine, 1, ATTOTIME_IN_USEC(550 * 22 * 33));
+ start_mono_flop(sn, 1, ATTOTIME_IN_USEC(550 * 22 * 33));
}
if (changes & (1 << 0x4))
{
- start_mono_flop(machine, 2, ATTOTIME_IN_USEC(550 * 22 * 33));
+ start_mono_flop(sn, 2, ATTOTIME_IN_USEC(550 * 22 * 33));
}
if (changes & ((1 << 0x2) | (1 << 0x3) | (1 << 0x5)))
{
@@ -207,19 +208,20 @@ static void spacefev_sound_pins_changed(running_machine *machine)
static void sheriff_sound_pins_changed(running_machine *machine)
{
+ const device_config *sn = devtag_get_device(machine, SOUND, "sn");
UINT16 changes = ~curr_sound_pins & prev_sound_pins;
if (changes & (1 << 0x6))
{
- stop_mono_flop(machine, 1);
+ stop_mono_flop(sn, 1);
}
if (changes & (1 << 0x6))
{
- start_mono_flop(machine, 0, ATTOTIME_IN_USEC(550 * 33 * 33));
+ start_mono_flop(sn, 0, ATTOTIME_IN_USEC(550 * 33 * 33));
}
if (changes & (1 << 0x4))
{
- start_mono_flop(machine, 1, ATTOTIME_IN_USEC(550 * 33 * 33));
+ start_mono_flop(sn, 1, ATTOTIME_IN_USEC(550 * 33 * 33));
}
if (changes & ((1 << 0x2) | (1 << 0x3) | (1 << 0x5)))
{
@@ -408,13 +410,13 @@ static READ8_HANDLER( helifire_8035_p2_r )
static WRITE8_HANDLER( n8080_dac_w )
{
- dac_data_w(0, data & 0x80);
+ dac_data_w(devtag_get_device(space->machine, SOUND, "dac"), data & 0x80);
}
static WRITE8_HANDLER( helifire_dac_w )
{
- dac_data_w(0, data * helifire_dac_volume);
+ dac_data_w(devtag_get_device(space->machine, SOUND, "dac"), data * helifire_dac_volume);
}
@@ -440,6 +442,7 @@ static WRITE8_HANDLER( helifire_sound_ctrl_w )
static TIMER_CALLBACK( spacefev_vco_voltage_timer )
{
+ const device_config *sn = devtag_get_device(machine, SOUND, "sn");
double voltage = 0;
if (mono_flop[2])
@@ -447,7 +450,7 @@ static TIMER_CALLBACK( spacefev_vco_voltage_timer )
voltage = 5 * (1 - exp(- attotime_to_double(timer_timeelapsed(sound_timer[2])) / 0.22));
}
- sn76477_vco_voltage_w(0, voltage);
+ sn76477_vco_voltage_w(sn, voltage);
}
diff --git a/src/mame/audio/namco54.c b/src/mame/audio/namco54.c
index f987b5d8fc6..2938e751083 100644
--- a/src/mame/audio/namco54.c
+++ b/src/mame/audio/namco54.c
@@ -71,20 +71,20 @@ static READ8_HANDLER( namco_54xx_R0_r )
}
-static WRITE8_HANDLER( namco_54xx_O_w )
+static WRITE8_DEVICE_HANDLER( namco_54xx_O_w )
{
UINT8 out = (data & 0x0f);
if (data & 0x10)
- discrete_sound_w(space, NAMCO_54XX_1_DATA, out);
+ discrete_sound_w(device, NAMCO_54XX_1_DATA, out);
else
- discrete_sound_w(space, NAMCO_54XX_0_DATA, out);
+ discrete_sound_w(device, NAMCO_54XX_0_DATA, out);
}
-static WRITE8_HANDLER( namco_54xx_R1_w )
+static WRITE8_DEVICE_HANDLER( namco_54xx_R1_w )
{
UINT8 out = (data & 0x0f);
- discrete_sound_w(space, NAMCO_54XX_2_DATA, out);
+ discrete_sound_w(device, NAMCO_54XX_2_DATA, out);
}
@@ -99,9 +99,9 @@ ADDRESS_MAP_END
ADDRESS_MAP_START( namco_54xx_map_io, ADDRESS_SPACE_IO, 8 )
AM_RANGE(MB88_PORTK, MB88_PORTK) AM_READ(namco_54xx_K_r)
- AM_RANGE(MB88_PORTO, MB88_PORTO) AM_WRITE(namco_54xx_O_w)
+ AM_RANGE(MB88_PORTO, MB88_PORTO) AM_DEVWRITE(SOUND, "discrete", namco_54xx_O_w)
AM_RANGE(MB88_PORTR0, MB88_PORTR0) AM_READ(namco_54xx_R0_r)
- AM_RANGE(MB88_PORTR1, MB88_PORTR1) AM_WRITE(namco_54xx_R1_w)
+ AM_RANGE(MB88_PORTR1, MB88_PORTR1) AM_DEVWRITE(SOUND, "discrete", namco_54xx_R1_w)
AM_RANGE(MB88_PORTR2, MB88_PORTR2) AM_NOP
ADDRESS_MAP_END
diff --git a/src/mame/audio/namcoc7x.c b/src/mame/audio/namcoc7x.c
index 4c36e3e7b8a..7b1073bbb1b 100644
--- a/src/mame/audio/namcoc7x.c
+++ b/src/mame/audio/namcoc7x.c
@@ -126,7 +126,7 @@ static WRITE16_HANDLER( c7x_shared_w )
}
ADDRESS_MAP_START( namcoc7x_mcu_map, ADDRESS_SPACE_PROGRAM, 16 )
- AM_RANGE(0x002000, 0x002fff) AM_READWRITE( c352_0_r, c352_0_w )
+ AM_RANGE(0x002000, 0x002fff) AM_DEVREADWRITE(SOUND, "c352", c352_r, c352_w)
AM_RANGE(0x004000, 0x00bfff) AM_RAM AM_BASE(&namcoc7x_mcuram)
AM_RANGE(0x00c000, 0x00ffff) AM_ROM AM_REGION("c7x", 0x8c000)
AM_RANGE(0x080000, 0x0fffff) AM_ROM AM_REGION("c7x", 0)
@@ -137,7 +137,7 @@ ADDRESS_MAP_START( namcoc7x_mcu_map, ADDRESS_SPACE_PROGRAM, 16 )
ADDRESS_MAP_END
ADDRESS_MAP_START( namcoc7x_mcu_share_map, ADDRESS_SPACE_PROGRAM, 16 )
- AM_RANGE(0x002000, 0x002fff) AM_READWRITE( c352_0_r, c352_0_w )
+ AM_RANGE(0x002000, 0x002fff) AM_DEVREADWRITE(SOUND, "c352", c352_r, c352_w )
AM_RANGE(0x004000, 0x00bfff) AM_READWRITE( c7x_shared_r, c7x_shared_w ) AM_BASE(&namcoc7x_mcuram)
AM_RANGE(0x00c000, 0x00ffff) AM_ROM AM_REGION("c7x", 0x8c000)
AM_RANGE(0x080000, 0x0fffff) AM_ROM AM_REGION("c7x", 0)
diff --git a/src/mame/audio/orbit.c b/src/mame/audio/orbit.c
index 9542e26ac6a..1465ec1cda9 100644
--- a/src/mame/audio/orbit.c
+++ b/src/mame/audio/orbit.c
@@ -13,26 +13,26 @@
*
*************************************/
-WRITE8_HANDLER( orbit_note_w )
+WRITE8_DEVICE_HANDLER( orbit_note_w )
{
- discrete_sound_w(space, ORBIT_NOTE_FREQ, (~data) & 0xff);
+ discrete_sound_w(device, ORBIT_NOTE_FREQ, (~data) & 0xff);
}
-WRITE8_HANDLER( orbit_note_amp_w )
+WRITE8_DEVICE_HANDLER( orbit_note_amp_w )
{
- discrete_sound_w(space, ORBIT_ANOTE1_AMP, data & 0x0f);
- discrete_sound_w(space, ORBIT_ANOTE2_AMP, data >> 4);
+ discrete_sound_w(device, ORBIT_ANOTE1_AMP, data & 0x0f);
+ discrete_sound_w(device, ORBIT_ANOTE2_AMP, data >> 4);
}
-WRITE8_HANDLER( orbit_noise_amp_w )
+WRITE8_DEVICE_HANDLER( orbit_noise_amp_w )
{
- discrete_sound_w(space, ORBIT_NOISE1_AMP, data & 0x0f);
- discrete_sound_w(space, ORBIT_NOISE2_AMP, data >> 4);
+ discrete_sound_w(device, ORBIT_NOISE1_AMP, data & 0x0f);
+ discrete_sound_w(device, ORBIT_NOISE2_AMP, data >> 4);
}
-WRITE8_HANDLER( orbit_noise_rst_w )
+WRITE8_DEVICE_HANDLER( orbit_noise_rst_w )
{
- discrete_sound_w(space, ORBIT_NOISE_EN, 0);
+ discrete_sound_w(device, ORBIT_NOISE_EN, 0);
}
diff --git a/src/mame/audio/phoenix.c b/src/mame/audio/phoenix.c
index 6d342eee2fe..44adda93ced 100644
--- a/src/mame/audio/phoenix.c
+++ b/src/mame/audio/phoenix.c
@@ -10,7 +10,6 @@
#include "driver.h"
#include "streams.h"
-#include "sound/custom.h"
#include "sound/tms36xx.h"
#include "phoenix.h"
@@ -476,14 +475,14 @@ DISCRETE_SOUND_START(phoenix)
DISCRETE_OUTPUT(NODE_90, 1)
DISCRETE_SOUND_END
-WRITE8_HANDLER( phoenix_sound_control_a_w )
+WRITE8_DEVICE_HANDLER( phoenix_sound_control_a_w )
{
- discrete_sound_w(space, PHOENIX_EFFECT_2_DATA, data & 0x0f);
- discrete_sound_w(space, PHOENIX_EFFECT_2_FREQ, (data & 0x30) >> 4);
+ discrete_sound_w(device, PHOENIX_EFFECT_2_DATA, data & 0x0f);
+ discrete_sound_w(device, PHOENIX_EFFECT_2_FREQ, (data & 0x30) >> 4);
#if 0
/* future handling of noise sounds */
- discrete_sound_w(PHOENIX_EFFECT_3_EN , data & 0x40);
- discrete_sound_w(PHOENIX_EFFECT_4_EN , data & 0x80);
+ discrete_sound_w(device, PHOENIX_EFFECT_3_EN , data & 0x40);
+ discrete_sound_w(device, PHOENIX_EFFECT_4_EN , data & 0x80);
#endif
stream_update(channel);
sound_latch_a = data;
@@ -509,17 +508,17 @@ SOUND_START( phoenix)
}
-WRITE8_HANDLER( phoenix_sound_control_b_w )
+WRITE8_DEVICE_HANDLER( phoenix_sound_control_b_w )
{
- discrete_sound_w(space, PHOENIX_EFFECT_1_DATA, data & 0x0f);
- discrete_sound_w(space, PHOENIX_EFFECT_1_FILT, data & 0x20);
- discrete_sound_w(space, PHOENIX_EFFECT_1_FREQ, data & 0x10);
+ discrete_sound_w(device, PHOENIX_EFFECT_1_DATA, data & 0x0f);
+ discrete_sound_w(device, PHOENIX_EFFECT_1_FILT, data & 0x20);
+ discrete_sound_w(device, PHOENIX_EFFECT_1_FREQ, data & 0x10);
/* update the tune that the MM6221AA is playing */
- mm6221aa_tune_w(0, data >> 6);
+ mm6221aa_tune_w(devtag_get_device(device->machine, SOUND, "tms"), data >> 6);
}
-CUSTOM_START( phoenix_sh_start )
+static DEVICE_START( phoenix_sound )
{
running_machine *machine = device->machine;
int i, j;
@@ -545,7 +544,17 @@ CUSTOM_START( phoenix_sh_start )
channel = stream_create(device, 0, 1, machine->sample_rate, 0, phoenix_sound_update);
state_save_register_global_pointer(machine, poly18, (1ul << (18-5)) );
+}
- /* a dummy token */
- return auto_malloc(1);
+DEVICE_GET_INFO( phoenix_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(phoenix_sound); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Phoenix Custom"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
}
diff --git a/src/mame/audio/pleiads.c b/src/mame/audio/pleiads.c
index c26ad9fa8f5..60dc3991bf5 100644
--- a/src/mame/audio/pleiads.c
+++ b/src/mame/audio/pleiads.c
@@ -8,7 +8,6 @@
****************************************************************************/
#include "driver.h"
#include "streams.h"
-#include "sound/custom.h"
#include "sound/tms36xx.h"
#include "includes/phoenix.h"
@@ -437,7 +436,7 @@ WRITE8_HANDLER( pleiads_sound_control_b_w )
if (pitch == 3)
pitch = 2; /* 2 and 3 are the same */
- tms36xx_note_w(0, pitch, note);
+ tms36xx_note_w(devtag_get_device(space->machine, SOUND, "tms"), pitch, note);
stream_update(channel);
sound_latch_b = data;
@@ -454,7 +453,7 @@ WRITE8_HANDLER( pleiads_sound_control_c_w )
sound_latch_c = data;
}
-static void *common_sh_start(const device_config *device, const custom_sound_interface *config, const char *name)
+static DEVICE_START( common_sh_start )
{
running_machine *machine = device->machine;
int i, j;
@@ -478,12 +477,9 @@ static void *common_sh_start(const device_config *device, const custom_sound_int
}
channel = stream_create(device, 0, 1, machine->sample_rate, NULL, pleiads_sound_update);
-
- /* just a dummy alloc to make the caller happy */
- return auto_malloc(1);
}
-CUSTOM_START( pleiads_sh_start )
+static DEVICE_START( pleiads_sound )
{
/* The real values are _unknown_!
* I took the ones from Naughty Boy / Pop Flamer
@@ -541,10 +537,24 @@ CUSTOM_START( pleiads_sh_start )
freq = 1.44 / ((100000+2*1000) * 0.01e-6) = approx. 1412 Hz */
noise_freq = 1412; /* higher noise rate than popflame/naughtyb??? */
- return common_sh_start(device, config, "Custom (Pleiads)");
+ DEVICE_START_CALL(common_sh_start);
}
-CUSTOM_START( naughtyb_sh_start )
+DEVICE_GET_INFO( pleiads_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(pleiads_sound); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Pleiads Custom"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
+}
+
+
+static DEVICE_START( naughtyb_sound )
{
/* charge 10u??? through 330K (R??) -> 3.3s */
pa5_charge_time = 3.3;
@@ -598,10 +608,24 @@ CUSTOM_START( naughtyb_sh_start )
freq = 1.44 / ((200000+2*1000) * 0.01e-6) = approx. 713 Hz */
noise_freq = 713;
- return common_sh_start(device, config, "Custom (Naughty Boy)");
+ DEVICE_START_CALL(common_sh_start);
}
-CUSTOM_START( popflame_sh_start )
+DEVICE_GET_INFO( naughtyb_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(naughtyb_sound);break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Naughty Boy Custom"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
+}
+
+
+static DEVICE_START( popflame_sound )
{
/* charge 10u (C63 in Pop Flamer) through 330K -> 3.3s */
pa5_charge_time = 3.3;
@@ -655,5 +679,18 @@ CUSTOM_START( popflame_sh_start )
freq = 1.44 / ((200000+2*1000) * 0.01e-6) = approx. 713 Hz */
noise_freq = 713;
- return common_sh_start(device, config, "Custom (Pop Flamer)");
+ DEVICE_START_CALL(common_sh_start);
+}
+
+DEVICE_GET_INFO( popflame_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(popflame_sound); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Pop Flamer Custom"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
}
diff --git a/src/mame/audio/polepos.c b/src/mame/audio/polepos.c
index 051e0fbc82e..2016183269a 100644
--- a/src/mame/audio/polepos.c
+++ b/src/mame/audio/polepos.c
@@ -6,7 +6,6 @@
#include "streams.h"
#include "sound/filter.h"
#include "machine/rescap.h"
-#include "sound/custom.h"
#include "namco54.h"
#include "polepos.h"
@@ -99,7 +98,7 @@ static STREAM_UPDATE( engine_sound_update )
/************************************/
/* Sound handler start */
/************************************/
-CUSTOM_START( polepos_sh_start )
+static DEVICE_START( polepos_sound )
{
stream = stream_create(device, 0, 1, OUTPUT_RATE, NULL, engine_sound_update);
sample_msb = sample_lsb = 0;
@@ -114,19 +113,32 @@ CUSTOM_START( polepos_sh_start )
* a high pass filter. */
filter2_setup(device, FILTER_HIGHPASS, 950, Q_TO_DAMP(.707), 1,
&filter_engine[2]);
-
- return auto_malloc(1);
}
/************************************/
/* Sound handler reset */
/************************************/
-CUSTOM_RESET( polepos_sh_reset )
+static DEVICE_RESET( polepos_sound )
{
int loop;
for (loop = 0; loop < 3; loop++) filter2_reset(&filter_engine[loop]);
}
+DEVICE_GET_INFO( polepos_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(polepos_sound); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(polepos_sound); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Pole Position Custom"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
+}
+
+
/************************************/
/* Write LSB of engine sound */
/************************************/
diff --git a/src/mame/audio/polyplay.c b/src/mame/audio/polyplay.c
index cd3da330c50..3ba5f4e0f3c 100644
--- a/src/mame/audio/polyplay.c
+++ b/src/mame/audio/polyplay.c
@@ -47,28 +47,30 @@ void polyplay_set_channel2(int active)
channel_playing2 = active;
}
-void polyplay_play_channel1(int data)
+void polyplay_play_channel1(running_machine *machine, int data)
{
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
if (data) {
freq1 = 2457600 / 16 / data / 8;
- sample_set_volume(0, channel_playing1 * 1.0);
- sample_start_raw(0, backgroundwave, ARRAY_LENGTH(backgroundwave), sizeof(backgroundwave)*freq1,1);
+ sample_set_volume(samples, 0, channel_playing1 * 1.0);
+ sample_start_raw(samples, 0, backgroundwave, ARRAY_LENGTH(backgroundwave), sizeof(backgroundwave)*freq1,1);
}
else {
- sample_stop(0);
- sample_stop(1);
+ sample_stop(samples, 0);
+ sample_stop(samples, 1);
}
}
-void polyplay_play_channel2(int data)
+void polyplay_play_channel2(running_machine *machine, int data)
{
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
if (data) {
freq2 = 2457600 / 16 / data / 8;
- sample_set_volume(1, channel_playing2 * 1.0);
- sample_start_raw(1, backgroundwave, ARRAY_LENGTH(backgroundwave), sizeof(backgroundwave)*freq2,1);
+ sample_set_volume(samples, 1, channel_playing2 * 1.0);
+ sample_start_raw(samples, 1, backgroundwave, ARRAY_LENGTH(backgroundwave), sizeof(backgroundwave)*freq2,1);
}
else {
- sample_stop(0);
- sample_stop(1);
+ sample_stop(samples, 0);
+ sample_stop(samples, 1);
}
}
diff --git a/src/mame/audio/poolshrk.c b/src/mame/audio/poolshrk.c
index 4d47c9ea0f9..2d7ba4e4588 100644
--- a/src/mame/audio/poolshrk.c
+++ b/src/mame/audio/poolshrk.c
@@ -155,22 +155,22 @@ DISCRETE_SOUND_END
*
*************************************/
-WRITE8_HANDLER( poolshrk_scratch_sound_w )
+WRITE8_DEVICE_HANDLER( poolshrk_scratch_sound_w )
{
- discrete_sound_w(space, POOLSHRK_SCRATCH_SND, offset & 1);
+ discrete_sound_w(device, POOLSHRK_SCRATCH_SND, offset & 1);
}
-WRITE8_HANDLER( poolshrk_score_sound_w )
+WRITE8_DEVICE_HANDLER( poolshrk_score_sound_w )
{
- discrete_sound_w(space, POOLSHRK_SCORE_EN, 1); /* this will trigger the sound code for 1 sample */
+ discrete_sound_w(device, POOLSHRK_SCORE_EN, 1); /* this will trigger the sound code for 1 sample */
}
-WRITE8_HANDLER( poolshrk_click_sound_w )
+WRITE8_DEVICE_HANDLER( poolshrk_click_sound_w )
{
- discrete_sound_w(space, POOLSHRK_CLICK_EN, 1); /* this will trigger the sound code for 1 sample */
+ discrete_sound_w(device, POOLSHRK_CLICK_EN, 1); /* this will trigger the sound code for 1 sample */
}
-WRITE8_HANDLER( poolshrk_bump_sound_w )
+WRITE8_DEVICE_HANDLER( poolshrk_bump_sound_w )
{
- discrete_sound_w(space, POOLSHRK_BUMP_EN, offset & 1);
+ discrete_sound_w(device, POOLSHRK_BUMP_EN, offset & 1);
}
diff --git a/src/mame/audio/pulsar.c b/src/mame/audio/pulsar.c
index 58ac1263b6f..f5646e48e1e 100644
--- a/src/mame/audio/pulsar.c
+++ b/src/mame/audio/pulsar.c
@@ -28,8 +28,8 @@
#define OUT_PORT_2_MOVMAZE 0x10
-#define PLAY(id,loop) sample_start( id, id, loop )
-#define STOP(id) sample_stop( id )
+#define PLAY(samp,id,loop) sample_start( samp, id, id, loop )
+#define STOP(samp,id) sample_stop( samp, id )
/* sample file names */
@@ -88,6 +88,7 @@ static int port1State = 0;
WRITE8_HANDLER( pulsar_audio_1_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
int bitsChanged;
int bitsGoneHigh;
int bitsGoneLow;
@@ -101,43 +102,44 @@ WRITE8_HANDLER( pulsar_audio_1_w )
if ( bitsGoneLow & OUT_PORT_1_CLANG )
{
- PLAY( SND_CLANG, 0 );
+ PLAY( samples, SND_CLANG, 0 );
}
if ( bitsGoneLow & OUT_PORT_1_KEY )
{
- PLAY( SND_KEY, 0 );
+ PLAY( samples, SND_KEY, 0 );
}
if ( bitsGoneLow & OUT_PORT_1_ALIENHIT )
{
- PLAY( SND_ALIENHIT, 0 );
+ PLAY( samples, SND_ALIENHIT, 0 );
}
if ( bitsGoneLow & OUT_PORT_1_PHIT )
{
- PLAY( SND_PHIT, 0 );
+ PLAY( samples, SND_PHIT, 0 );
}
if ( bitsGoneLow & OUT_PORT_1_ASHOOT )
{
- PLAY( SND_ASHOOT, 0 );
+ PLAY( samples, SND_ASHOOT, 0 );
}
if ( bitsGoneLow & OUT_PORT_1_PSHOOT )
{
- PLAY( SND_PSHOOT, 0 );
+ PLAY( samples, SND_PSHOOT, 0 );
}
if ( bitsGoneLow & OUT_PORT_1_BONUS )
{
- PLAY( SND_BONUS, 0 );
+ PLAY( samples, SND_BONUS, 0 );
}
}
WRITE8_HANDLER( pulsar_audio_2_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
static int port2State = 0;
int bitsChanged;
int bitsGoneHigh;
@@ -152,38 +154,38 @@ WRITE8_HANDLER( pulsar_audio_2_w )
if ( bitsGoneLow & OUT_PORT_2_SIZZLE )
{
- PLAY( SND_SIZZLE, 0 );
+ PLAY( samples, SND_SIZZLE, 0 );
}
if ( bitsGoneLow & OUT_PORT_2_GATE )
{
- sample_start( SND_CLANG, SND_GATE, 0 );
+ sample_start( samples, SND_CLANG, SND_GATE, 0 );
}
if ( bitsGoneHigh & OUT_PORT_2_GATE )
{
- STOP( SND_CLANG );
+ STOP( samples, SND_CLANG );
}
if ( bitsGoneLow & OUT_PORT_2_BIRTH )
{
- PLAY( SND_BIRTH, 0 );
+ PLAY( samples, SND_BIRTH, 0 );
}
if ( bitsGoneLow & OUT_PORT_2_HBEAT )
{
- PLAY( SND_HBEAT, 1 );
+ PLAY( samples, SND_HBEAT, 1 );
}
if ( bitsGoneHigh & OUT_PORT_2_HBEAT )
{
- STOP( SND_HBEAT );
+ STOP( samples, SND_HBEAT );
}
if ( bitsGoneLow & OUT_PORT_2_MOVMAZE )
{
- PLAY( SND_MOVMAZE, 1 );
+ PLAY( samples, SND_MOVMAZE, 1 );
}
if ( bitsGoneHigh & OUT_PORT_2_MOVMAZE )
{
- STOP( SND_MOVMAZE );
+ STOP( samples, SND_MOVMAZE );
}
}
diff --git a/src/mame/audio/qix.c b/src/mame/audio/qix.c
index c57a9a9820f..d1e56d358c0 100644
--- a/src/mame/audio/qix.c
+++ b/src/mame/audio/qix.c
@@ -23,12 +23,14 @@ Audio handlers
WRITE8_HANDLER( qix_dac_w )
{
- discrete_sound_w(space, QIX_DAC_DATA, data);
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+ discrete_sound_w(discrete, QIX_DAC_DATA, data);
}
WRITE8_HANDLER( qix_vol_w )
{
- discrete_sound_w(space, QIX_VOL_DATA, data);
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+ discrete_sound_w(discrete, QIX_VOL_DATA, data);
}
@@ -122,10 +124,12 @@ MACHINE_DRIVER_START( slither_audio )
MDRV_SPEAKER_REMOVE("left")
MDRV_SPEAKER_REMOVE("right")
MDRV_SPEAKER_STANDARD_MONO("mono")
+
+ MDRV_SOUND_REMOVE("discrete")
- MDRV_SOUND_REPLACE("discrete", SN76489, SLITHER_CLOCK_OSC/4/4)
+ MDRV_SOUND_ADD("sn1", SN76489, SLITHER_CLOCK_OSC/4/4)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
- MDRV_SOUND_ADD("sn", SN76489, SLITHER_CLOCK_OSC/4/4)
+ MDRV_SOUND_ADD("sn2", SN76489, SLITHER_CLOCK_OSC/4/4)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MACHINE_DRIVER_END
diff --git a/src/mame/audio/redalert.c b/src/mame/audio/redalert.c
index bbef0deaf94..96111309e44 100644
--- a/src/mame/audio/redalert.c
+++ b/src/mame/audio/redalert.c
@@ -53,7 +53,7 @@ static UINT8 ay8910_latch_1;
*
*************************************/
-static WRITE8_HANDLER( redalert_analog_w )
+static WRITE8_DEVICE_HANDLER( redalert_analog_w )
{
/* this port triggers analog sounds
D0 = Formation Aircraft?
@@ -87,7 +87,7 @@ WRITE8_HANDLER( redalert_audio_command_w )
}
-static WRITE8_HANDLER( redalert_AY8910_w )
+static WRITE8_DEVICE_HANDLER( redalert_AY8910_w )
{
/* BC2 is connected to a pull-up resistor, so BC2=1 always */
switch (data & 0x03)
@@ -98,18 +98,15 @@ static WRITE8_HANDLER( redalert_AY8910_w )
/* BC1=1, BDIR=0 : read from PSG */
case 0x01:
- ay8910_latch_1 = ay8910_read_port_0_r(space, 0);
+ ay8910_latch_1 = ay8910_r(device, 0);
break;
/* BC1=0, BDIR=1 : write to PSG */
- case 0x02:
- ay8910_write_port_0_w(space, 0, ay8910_latch_2);
- break;
-
/* BC1=1, BDIR=1 : latch address */
- default:
+ case 0x02:
case 0x03:
- ay8910_control_port_0_w(space, 0, ay8910_latch_2);
+ default:
+ ay8910_data_address_w(device, data, ay8910_latch_2);
break;
}
}
@@ -131,15 +128,17 @@ static const ay8910_interface redalert_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r, NULL, /* port A/B read */
- NULL, redalert_analog_w /* port A/B write */
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r),
+ DEVCB_NULL, /* port A/B read */
+ DEVCB_NULL,
+ DEVCB_HANDLER(redalert_analog_w) /* port A/B write */
};
static ADDRESS_MAP_START( redalert_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_GLOBAL_MASK(0x7fff)
AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x0c00) AM_RAM
- AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x0ffe) AM_READWRITE(SMH_NOP, redalert_AY8910_w)
+ AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x0ffe) AM_READNOP AM_DEVWRITE(SOUND, "ay", redalert_AY8910_w)
AM_RANGE(0x1001, 0x1001) AM_MIRROR(0x0ffe) AM_READWRITE(redalert_ay8910_latch_1_r, redalert_ay8910_latch_2_w)
AM_RANGE(0x2000, 0x6fff) AM_NOP
AM_RANGE(0x7000, 0x77ff) AM_MIRROR(0x0800) AM_ROM
@@ -173,13 +172,13 @@ WRITE8_HANDLER( redalert_voice_command_w )
static void sod_callback(const device_config *device, int data)
{
- hc55516_digit_w(0, data);
+ hc55516_digit_w(devtag_get_device(device->machine, SOUND, "cvsd"), data);
}
static int sid_callback(const device_config *device)
{
- return hc55516_clock_state_r(0);
+ return hc55516_clock_state_r(devtag_get_device(device->machine, SOUND, "cvsd"));
}
@@ -312,32 +311,35 @@ static READ8_HANDLER( demoneye_ay8910_latch_2_r )
static WRITE8_HANDLER( demoneye_ay8910_data_w )
{
+ const device_config *ay1 = devtag_get_device(space->machine, SOUND, "ay1");
+ const device_config *ay2 = devtag_get_device(space->machine, SOUND, "ay2");
+
switch (ay8910_latch_1 & 0x03)
{
case 0x00:
if (ay8910_latch_1 & 0x10)
- ay8910_write_port_0_w(space, 0, data);
+ ay8910_data_w(ay1, 0, data);
if (ay8910_latch_1 & 0x20)
- ay8910_write_port_1_w(space, 0, data);
+ ay8910_data_w(ay2, 0, data);
break;
case 0x01:
if (ay8910_latch_1 & 0x10)
- ay8910_latch_2 = ay8910_read_port_0_r(space, 0);
+ ay8910_latch_2 = ay8910_r(ay1, 0);
if (ay8910_latch_1 & 0x20)
- ay8910_latch_2 = ay8910_read_port_1_r(space, 0);
+ ay8910_latch_2 = ay8910_r(ay2, 0);
break;
case 0x03:
if (ay8910_latch_1 & 0x10)
- ay8910_control_port_0_w(space, 0, data);
+ ay8910_address_w(ay1, 0, data);
if (ay8910_latch_1 & 0x20)
- ay8910_control_port_1_w(space, 0, data);
+ ay8910_address_w(ay2, 0, data);
break;
@@ -360,8 +362,10 @@ static const ay8910_interface demoneye_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r, NULL, /* port A/B read */
- NULL, NULL /* port A/B write */
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r),
+ DEVCB_NULL, /* port A/B read */
+ DEVCB_NULL,
+ DEVCB_NULL /* port A/B write */
};
diff --git a/src/mame/audio/redbaron.c b/src/mame/audio/redbaron.c
index 04f6c869408..24fd47dc150 100644
--- a/src/mame/audio/redbaron.c
+++ b/src/mame/audio/redbaron.c
@@ -18,7 +18,6 @@
#include "driver.h"
#include "streams.h"
#include "bzone.h"
-#include "sound/custom.h"
#include "sound/pokey.h"
#define OUTPUT_RATE (48000)
@@ -56,10 +55,10 @@ WRITE8_HANDLER( redbaron_sounds_w )
rb_input_select = data & 1;
}
-WRITE8_HANDLER( redbaron_pokey_w )
+WRITE8_DEVICE_HANDLER( redbaron_pokey_w )
{
if( latch & 0x20 )
- pokey1_w(space, offset, data);
+ pokey_w(device, offset, data);
}
static STREAM_UPDATE( redbaron_sound_update )
@@ -169,7 +168,7 @@ static STREAM_UPDATE( redbaron_sound_update )
}
}
-CUSTOM_START( redbaron_sh_start )
+static DEVICE_START( redbaron_sound )
{
int i;
@@ -208,6 +207,20 @@ CUSTOM_START( redbaron_sh_start )
}
channel = stream_create(device, 0, 1, OUTPUT_RATE, 0, redbaron_sound_update);
+}
+
+
+DEVICE_GET_INFO( redbaron_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(redbaron_sound);break;
- return auto_malloc(1);
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Red Baron Custom"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
}
+
+
diff --git a/src/mame/audio/rockola.c b/src/mame/audio/rockola.c
index d6c2515a45c..28c57383451 100644
--- a/src/mame/audio/rockola.c
+++ b/src/mame/audio/rockola.c
@@ -12,7 +12,6 @@
#include "driver.h"
#include "streams.h"
-#include "sound/custom.h"
#include "sound/sn76477.h"
#include "sound/samples.h"
#include "rockola.h"
@@ -52,11 +51,6 @@ static int Sound0StopOnRollover;
static UINT8 LastPort1;
-const custom_sound_interface custom_interface =
-{
- rockola_sh_start
-};
-
static const char *const sasuke_sample_names[] =
{
"*sasuke",
@@ -626,7 +620,7 @@ void rockola_set_music_clock(double clock_time)
tone_clock = 0;
}
-CUSTOM_START( rockola_sh_start )
+static DEVICE_START( rockola_sound )
{
// adjusted
rockola_set_music_freq(43000);
@@ -635,8 +629,19 @@ CUSTOM_START( rockola_sh_start )
rockola_set_music_clock(M_LN2 * (RES_K(18) * 2 + RES_K(1)) * CAP_U(1));
tone_stream = stream_create(device, 0, 1, SAMPLE_RATE, NULL, rockola_tone_update);
+}
- return auto_malloc(1);
+DEVICE_GET_INFO( rockola_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(rockola_sound); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Rockola Custom"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
}
int rockola_music0_playing(void)
@@ -647,6 +652,7 @@ int rockola_music0_playing(void)
WRITE8_HANDLER( sasuke_sound_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
switch (offset)
{
case 0:
@@ -664,13 +670,13 @@ WRITE8_HANDLER( sasuke_sound_w )
*/
if ((~data & 0x01) && (LastPort1 & 0x01))
- sample_start(0, 0, 0);
+ sample_start(samples, 0, 0, 0);
if ((~data & 0x02) && (LastPort1 & 0x02))
- sample_start(1, 1, 0);
+ sample_start(samples, 1, 1, 0);
if ((~data & 0x04) && (LastPort1 & 0x04))
- sample_start(2, 2, 0);
+ sample_start(samples, 2, 2, 0);
if ((~data & 0x08) && (LastPort1 & 0x08))
- sample_start(3, 3, 0);
+ sample_start(samples, 3, 3, 0);
if ((data & 0x80) && (~LastPort1 & 0x80))
{
@@ -712,6 +718,7 @@ WRITE8_HANDLER( sasuke_sound_w )
WRITE8_HANDLER( satansat_sound_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
switch (offset)
{
case 0:
@@ -726,7 +733,7 @@ WRITE8_HANDLER( satansat_sound_w )
/* bit 2 = analog sound trigger */
if (data & 0x04 && !(LastPort1 & 0x04))
- sample_start(0, 1, 0);
+ sample_start(samples, 0, 1, 0);
if (data & 0x08)
{
@@ -774,6 +781,7 @@ WRITE8_HANDLER( satansat_sound_w )
WRITE8_HANDLER( vanguard_sound_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
switch (offset)
{
case 0:
@@ -799,13 +807,13 @@ WRITE8_HANDLER( vanguard_sound_w )
/* play noise samples requested by sound command byte */
/* SHOT A */
if (data & 0x20 && !(LastPort1 & 0x20))
- sample_start(1, 0, 0);
+ sample_start(samples, 1, 0, 0);
else if (!(data & 0x20) && LastPort1 & 0x20)
- sample_stop(1);
+ sample_stop(samples, 1);
/* BOMB */
if (data & 0x80 && !(LastPort1 & 0x80))
- sample_start(2, 1, 0);
+ sample_start(samples, 2, 1, 0);
if (data & 0x08)
{
@@ -819,7 +827,7 @@ WRITE8_HANDLER( vanguard_sound_w )
}
/* SHOT B */
- sn76477_enable_w(1, (data & 0x40) ? 0 : 1);
+ sn76477_enable_w(devtag_get_device(space->machine, SOUND, "sn76477.2"), (data & 0x40) ? 0 : 1);
LastPort1 = data;
break;
@@ -909,7 +917,7 @@ WRITE8_HANDLER( fantasy_sound_w )
}
/* BOMB */
- discrete_sound_w(space, FANTASY_BOMB_EN, data & 0x80);
+ discrete_sound_w(devtag_get_device(space->machine, SOUND, "discrete"), FANTASY_BOMB_EN, data & 0x80);
LastPort1 = data;
break;
@@ -1010,7 +1018,7 @@ static int hd38880_data_bytes;
static double hd38880_speed;
-static void rockola_speech_w(UINT8 data, const UINT16 *table, int start)
+static void rockola_speech_w(running_machine *machine, UINT8 data, const UINT16 *table, int start)
{
/*
bit description
@@ -1026,6 +1034,7 @@ static void rockola_speech_w(UINT8 data, const UINT16 *table, int start)
if ((data & HD38880_CTP) && (data & HD38880_CMV))
{
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
data &= HD68880_SYBS;
switch (hd38880_cmd)
@@ -1036,7 +1045,7 @@ static void rockola_speech_w(UINT8 data, const UINT16 *table, int start)
case HD38880_START:
logerror("speech: START\n");
- if (hd38880_data_bytes == 5 && !sample_playing(0))
+ if (hd38880_data_bytes == 5 && !sample_playing(samples, 0))
{
int i;
@@ -1044,7 +1053,8 @@ static void rockola_speech_w(UINT8 data, const UINT16 *table, int start)
{
if (table[i] && table[i] == hd38880_addr)
{
- sample_start(0, start + i, 0);
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
+ sample_start(samples, 0, start + i, 0);
break;
}
}
@@ -1056,7 +1066,7 @@ static void rockola_speech_w(UINT8 data, const UINT16 *table, int start)
break;
case HD38880_STOP:
- sample_stop(0);
+ sample_stop(samples, 0);
logerror("speech: STOP\n");
break;
@@ -1173,7 +1183,7 @@ WRITE8_HANDLER( vanguard_speech_w )
0x054ce
};
- rockola_speech_w(data, vanguard_table, 2);
+ rockola_speech_w(space->machine, data, vanguard_table, 2);
}
WRITE8_HANDLER( fantasy_speech_w )
@@ -1198,5 +1208,5 @@ WRITE8_HANDLER( fantasy_speech_w )
0
};
- rockola_speech_w(data, fantasy_table, 0);
+ rockola_speech_w(space->machine, data, fantasy_table, 0);
}
diff --git a/src/mame/audio/scramble.c b/src/mame/audio/scramble.c
index 4f5fbfad8af..99160912b43 100644
--- a/src/mame/audio/scramble.c
+++ b/src/mame/audio/scramble.c
@@ -44,9 +44,9 @@ static const int scramble_timer[10] =
0x00, 0x10, 0x20, 0x30, 0x40, 0x90, 0xa0, 0xb0, 0xa0, 0xd0
};
-READ8_HANDLER( scramble_portB_r )
+READ8_DEVICE_HANDLER( scramble_portB_r )
{
- return scramble_timer[(cpu_get_total_cycles(space->cpu)/512) % 10];
+ return scramble_timer[(cputag_get_total_cycles(device->machine, "audio")/512) % 10];
}
@@ -73,9 +73,9 @@ static const int frogger_timer[10] =
0x00, 0x10, 0x08, 0x18, 0x40, 0x90, 0x88, 0x98, 0x88, 0xd0
};
-READ8_HANDLER( frogger_portB_r )
+READ8_DEVICE_HANDLER( frogger_portB_r )
{
- return frogger_timer[(cpu_get_total_cycles(space->cpu)/512) % 10];
+ return frogger_timer[(cputag_get_total_cycles(device->machine, "audio")/512) % 10];
}
@@ -159,13 +159,13 @@ WRITE8_HANDLER( hotshock_sh_irqtrigger_w )
cpu_set_input_line(space->machine->cpu[1], 0, ASSERT_LINE);
}
-READ8_HANDLER( hotshock_soundlatch_r )
+READ8_DEVICE_HANDLER( hotshock_soundlatch_r )
{
- cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE);
- return soundlatch_r(space,0);
+ cpu_set_input_line(device->machine->cpu[1], 0, CLEAR_LINE);
+ return soundlatch_r(cpu_get_address_space(device->machine->cpu[1], ADDRESS_SPACE_PROGRAM),0);
}
-static void filter_w(int chip, int channel, int data)
+static void filter_w(const device_config *device, int data)
{
int C;
@@ -175,25 +175,25 @@ static void filter_w(int chip, int channel, int data)
C += 220000; /* 220000pF = 0.220uF */
if (data & 2)
C += 47000; /* 47000pF = 0.047uF */
- if (sndti_exists(SOUND_FILTER_RC, 3*chip + channel))
- filter_rc_set_RC(3*chip + channel,FLT_RC_LOWPASS,1000,5100,0,CAP_P(C));
+ if (device != NULL)
+ filter_rc_set_RC(device,FLT_RC_LOWPASS,1000,5100,0,CAP_P(C));
}
WRITE8_HANDLER( scramble_filter_w )
{
- filter_w(1, 0, (offset >> 0) & 3);
- filter_w(1, 1, (offset >> 2) & 3);
- filter_w(1, 2, (offset >> 4) & 3);
- filter_w(0, 0, (offset >> 6) & 3);
- filter_w(0, 1, (offset >> 8) & 3);
- filter_w(0, 2, (offset >> 10) & 3);
+ filter_w(devtag_get_device(space->machine, SOUND, "filter.1.0"), (offset >> 0) & 3);
+ filter_w(devtag_get_device(space->machine, SOUND, "filter.1.1"), (offset >> 2) & 3);
+ filter_w(devtag_get_device(space->machine, SOUND, "filter.1.2"), (offset >> 4) & 3);
+ filter_w(devtag_get_device(space->machine, SOUND, "filter.0.0"), (offset >> 6) & 3);
+ filter_w(devtag_get_device(space->machine, SOUND, "filter.0.1"), (offset >> 8) & 3);
+ filter_w(devtag_get_device(space->machine, SOUND, "filter.0.2"), (offset >> 10) & 3);
}
WRITE8_HANDLER( frogger_filter_w )
{
- filter_w(0, 0, (offset >> 6) & 3);
- filter_w(0, 1, (offset >> 8) & 3);
- filter_w(0, 2, (offset >> 10) & 3);
+ filter_w(devtag_get_device(space->machine, SOUND, "filter.0.0"), (offset >> 6) & 3);
+ filter_w(devtag_get_device(space->machine, SOUND, "filter.0.1"), (offset >> 8) & 3);
+ filter_w(devtag_get_device(space->machine, SOUND, "filter.0.2"), (offset >> 10) & 3);
}
@@ -300,7 +300,7 @@ static UINT8 speech_cnt;
static TIMER_CALLBACK( ad2083_step )
{
- const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const device_config *tms = devtag_get_device(machine, SOUND, "tms");
/* only 16 bytes needed ... The original dump is bad. This
* is what is needed to get speech to work. The prom data has
@@ -328,8 +328,8 @@ static TIMER_CALLBACK( ad2083_step )
if (ctrl & 0x40)
speech_rom_address = 0;
- tms5110_ctl_w(space, 0, ctrl & 0x04 ? TMS5110_CMD_SPEAK : TMS5110_CMD_RESET);
- tms5110_pdc_w(space, 0, ctrl & 0x02 ? 0 : 1);
+ tms5110_ctl_w(tms, 0, ctrl & 0x04 ? TMS5110_CMD_SPEAK : TMS5110_CMD_RESET);
+ tms5110_pdc_w(tms, 0, ctrl & 0x02 ? 0 : 1);
if (!(ctrl & 0x80))
timer_set(machine, ATTOTIME_IN_HZ(AD2083_TMS5110_CLOCK / 2),NULL,1,ad2083_step);
@@ -383,20 +383,20 @@ static const ay8910_interface ad2083_ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- scramble_portB_r,
- NULL,
- NULL,
- NULL
+ DEVCB_HANDLER(scramble_portB_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface ad2083_ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- hotshock_soundlatch_r,
- NULL,
- NULL,
- NULL
+ DEVCB_HANDLER(hotshock_soundlatch_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
static ADDRESS_MAP_START( ad2083_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
@@ -407,10 +407,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( ad2083_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x01, 0x01) AM_WRITE(ad2083_tms5110_ctrl_w)
- AM_RANGE(0x10, 0x10) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x20, 0x20) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x40, 0x40) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0x10, 0x10) AM_DEVWRITE(SOUND, "ay1", ay8910_address_w)
+ AM_RANGE(0x20, 0x20) AM_DEVREADWRITE(SOUND, "ay1", ay8910_r, ay8910_data_w)
+ AM_RANGE(0x40, 0x40) AM_DEVREADWRITE(SOUND, "ay2", ay8910_r, ay8910_data_w)
+ AM_RANGE(0x80, 0x80) AM_DEVWRITE(SOUND, "ay2", ay8910_address_w)
ADDRESS_MAP_END
static SOUND_START( ad2083 )
diff --git a/src/mame/audio/segag80r.c b/src/mame/audio/segag80r.c
index 714d150fcb2..f271c780967 100644
--- a/src/mame/audio/segag80r.c
+++ b/src/mame/audio/segag80r.c
@@ -16,7 +16,6 @@
#include "sound/samples.h"
#include "sound/tms36xx.h"
#include "sound/dac.h"
-#include "sound/custom.h"
@@ -29,6 +28,9 @@
#define SEGA005_555_TIMER_FREQ (1.44 / ((15000 + 2 * 4700) * 1.5e-6))
#define SEGA005_COUNTER_FREQ (100000) /* unknown, just a guess */
+static DEVICE_GET_INFO( sega005_sound );
+#define SOUND_005 DEVICE_GET_INFO_NAME(sega005_sound)
+
/*************************************
@@ -242,6 +244,7 @@ WRITE8_HANDLER( astrob_sound_w )
{
120.0f, 82.0f, 62.0f, 56.0f, 47.0f, 39.0f, 33.0f, 27.0f, 24.0f, 22.0f
};
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
float freq_factor;
UINT8 diff = data ^ sound_state[offset];
@@ -251,54 +254,54 @@ WRITE8_HANDLER( astrob_sound_w )
{
case 0:
/* INVADER-1: channel 0 */
- if ((diff & 0x01) && !(data & 0x01)) sample_start(0, (data & 0x80) ? 0 : 1, TRUE);
- if ((data & 0x01) && sample_playing(0)) sample_stop(0);
+ if ((diff & 0x01) && !(data & 0x01)) sample_start(samples, 0, (data & 0x80) ? 0 : 1, TRUE);
+ if ((data & 0x01) && sample_playing(samples, 0)) sample_stop(samples, 0);
/* INVADER-2: channel 1 */
- if ((diff & 0x02) && !(data & 0x02)) sample_start(1, (data & 0x80) ? 2 : 3, TRUE);
- if ((data & 0x02) && sample_playing(1)) sample_stop(1);
+ if ((diff & 0x02) && !(data & 0x02)) sample_start(samples, 1, (data & 0x80) ? 2 : 3, TRUE);
+ if ((data & 0x02) && sample_playing(samples, 1)) sample_stop(samples, 1);
/* INVADER-3: channel 2 */
- if ((diff & 0x04) && !(data & 0x04)) sample_start(2, (data & 0x80) ? 4 : 5, TRUE);
- if ((data & 0x04) && sample_playing(2)) sample_stop(2);
+ if ((diff & 0x04) && !(data & 0x04)) sample_start(samples, 2, (data & 0x80) ? 4 : 5, TRUE);
+ if ((data & 0x04) && sample_playing(samples, 2)) sample_stop(samples, 2);
/* INVADER-4: channel 3 */
- if ((diff & 0x08) && !(data & 0x08)) sample_start(3, (data & 0x80) ? 6 : 7, TRUE);
- if ((data & 0x08) && sample_playing(3)) sample_stop(3);
+ if ((diff & 0x08) && !(data & 0x08)) sample_start(samples, 3, (data & 0x80) ? 6 : 7, TRUE);
+ if ((data & 0x08) && sample_playing(samples, 3)) sample_stop(samples, 3);
/* ASTROIDS: channel 4 */
- if ((diff & 0x10) && !(data & 0x10)) sample_start(4, 8, TRUE);
- if ((data & 0x10) && sample_playing(4)) sample_stop(4);
+ if ((diff & 0x10) && !(data & 0x10)) sample_start(samples, 4, 8, TRUE);
+ if ((data & 0x10) && sample_playing(samples, 4)) sample_stop(samples, 4);
/* MUTE */
sound_global_enable(!(data & 0x20));
/* REFILL: channel 5 */
- if (!(data & 0x40) && !sample_playing(5)) sample_start(5, 9, FALSE);
- if ( (data & 0x40) && sample_playing(5)) sample_stop(5);
+ if (!(data & 0x40) && !sample_playing(samples, 5)) sample_start(samples, 5, 9, FALSE);
+ if ( (data & 0x40) && sample_playing(samples, 5)) sample_stop(samples, 5);
/* WARP: changes which sample is played for the INVADER samples above */
if (diff & 0x80)
{
- if (sample_playing(0)) sample_start(0, (data & 0x80) ? 0 : 1, TRUE);
- if (sample_playing(1)) sample_start(1, (data & 0x80) ? 2 : 3, TRUE);
- if (sample_playing(2)) sample_start(2, (data & 0x80) ? 4 : 5, TRUE);
- if (sample_playing(3)) sample_start(3, (data & 0x80) ? 6 : 7, TRUE);
+ if (sample_playing(samples, 0)) sample_start(samples, 0, (data & 0x80) ? 0 : 1, TRUE);
+ if (sample_playing(samples, 1)) sample_start(samples, 1, (data & 0x80) ? 2 : 3, TRUE);
+ if (sample_playing(samples, 2)) sample_start(samples, 2, (data & 0x80) ? 4 : 5, TRUE);
+ if (sample_playing(samples, 3)) sample_start(samples, 3, (data & 0x80) ? 6 : 7, TRUE);
}
break;
case 1:
/* LASER #1: channel 6 */
- if ((diff & 0x01) && !(data & 0x01)) sample_start(6, 10, FALSE);
+ if ((diff & 0x01) && !(data & 0x01)) sample_start(samples, 6, 10, FALSE);
/* LASER #2: channel 7 */
- if ((diff & 0x02) && !(data & 0x02)) sample_start(7, 11, FALSE);
+ if ((diff & 0x02) && !(data & 0x02)) sample_start(samples, 7, 11, FALSE);
/* SHORT EXPL: channel 8 */
- if ((diff & 0x04) && !(data & 0x04)) sample_start(8, 12, FALSE);
+ if ((diff & 0x04) && !(data & 0x04)) sample_start(samples, 8, 12, FALSE);
/* LONG EXPL: channel 8 */
- if ((diff & 0x08) && !(data & 0x08)) sample_start(8, 13, FALSE);
+ if ((diff & 0x08) && !(data & 0x08)) sample_start(samples, 8, 13, FALSE);
/* ATTACK RATE */
if ((diff & 0x10) && !(data & 0x10)) sound_rate = (sound_rate + 1) % 10;
@@ -307,10 +310,10 @@ WRITE8_HANDLER( astrob_sound_w )
if (!(data & 0x20)) sound_rate = 0;
/* BONUS: channel 9 */
- if ((diff & 0x40) && !(data & 0x40)) sample_start(9, 14, FALSE);
+ if ((diff & 0x40) && !(data & 0x40)) sample_start(samples, 9, 14, FALSE);
/* SONAR: channel 10 */
- if ((diff & 0x80) && !(data & 0x80)) sample_start(10, 15, FALSE);
+ if ((diff & 0x80) && !(data & 0x80)) sample_start(samples, 10, 15, FALSE);
break;
}
@@ -324,10 +327,10 @@ WRITE8_HANDLER( astrob_sound_w )
/* adjust the sample rate of invader sounds based the sound_rate */
/* this is an approximation */
- if (sample_playing(0)) sample_set_freq(0, sample_get_base_freq(0) * freq_factor);
- if (sample_playing(1)) sample_set_freq(1, sample_get_base_freq(1) * freq_factor);
- if (sample_playing(2)) sample_set_freq(2, sample_get_base_freq(2) * freq_factor);
- if (sample_playing(3)) sample_set_freq(3, sample_get_base_freq(3) * freq_factor);
+ if (sample_playing(samples, 0)) sample_set_freq(samples, 0, sample_get_base_freq(samples, 0) * freq_factor);
+ if (sample_playing(samples, 1)) sample_set_freq(samples, 1, sample_get_base_freq(samples, 1) * freq_factor);
+ if (sample_playing(samples, 2)) sample_set_freq(samples, 2, sample_get_base_freq(samples, 2) * freq_factor);
+ if (sample_playing(samples, 3)) sample_set_freq(samples, 3, sample_get_base_freq(samples, 3) * freq_factor);
}
@@ -339,7 +342,6 @@ WRITE8_HANDLER( astrob_sound_w )
*************************************/
static SOUND_START( 005 );
-static CUSTOM_START( sega005_custom_start );
static STREAM_UPDATE( sega005_stream_update );
static TIMER_CALLBACK( sega005_auto_timer );
static WRITE8_DEVICE_HANDLER( sega005_sound_a_w );
@@ -421,12 +423,6 @@ static const samples_interface sega005_samples_interface =
};
-static const custom_sound_interface sega005_custom_interface =
-{
- sega005_custom_start
-};
-
-
static const ppi8255_interface ppi8255_005_intf =
{
DEVCB_NULL,
@@ -449,8 +445,7 @@ MACHINE_DRIVER_START( 005_sound_board )
MDRV_SOUND_CONFIG(sega005_samples_interface)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
- MDRV_SOUND_ADD("005", CUSTOM, 0)
- MDRV_SOUND_CONFIG(sega005_custom_interface)
+ MDRV_SOUND_ADD("005", 005, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MACHINE_DRIVER_END
@@ -481,31 +476,32 @@ static SOUND_START( 005 )
static WRITE8_DEVICE_HANDLER( sega005_sound_a_w )
{
+ const device_config *samples = devtag_get_device(device->machine, SOUND, "samples");
UINT8 diff = data ^ sound_state[0];
sound_state[0] = data;
/* LARGE EXPL: channel 0 */
- if ((diff & 0x01) && !(data & 0x01)) sample_start(0, 0, FALSE);
+ if ((diff & 0x01) && !(data & 0x01)) sample_start(samples, 0, 0, FALSE);
/* SMALL EXPL: channel 1 */
- if ((diff & 0x02) && !(data & 0x02)) sample_start(1, 1, FALSE);
+ if ((diff & 0x02) && !(data & 0x02)) sample_start(samples, 1, 1, FALSE);
/* DROP BOMB: channel 2 */
- if ((diff & 0x04) && !(data & 0x04)) sample_start(2, 2, FALSE);
+ if ((diff & 0x04) && !(data & 0x04)) sample_start(samples, 2, 2, FALSE);
/* SHOOT PISTOL: channel 3 */
- if ((diff & 0x08) && !(data & 0x08)) sample_start(3, 3, FALSE);
+ if ((diff & 0x08) && !(data & 0x08)) sample_start(samples, 3, 3, FALSE);
/* MISSILE: channel 4 */
- if ((diff & 0x10) && !(data & 0x10)) sample_start(4, 4, FALSE);
+ if ((diff & 0x10) && !(data & 0x10)) sample_start(samples, 4, 4, FALSE);
/* HELICOPTER: channel 5 */
- if ((diff & 0x20) && !(data & 0x20) && !sample_playing(5)) sample_start(5, 5, TRUE);
- if ((diff & 0x20) && (data & 0x20)) sample_stop(5);
+ if ((diff & 0x20) && !(data & 0x20) && !sample_playing(samples, 5)) sample_start(samples, 5, 5, TRUE);
+ if ((diff & 0x20) && (data & 0x20)) sample_stop(samples, 5);
/* WHISTLE: channel 6 */
- if ((diff & 0x40) && !(data & 0x40) && !sample_playing(6)) sample_start(6, 6, TRUE);
- if ((diff & 0x40) && (data & 0x40)) sample_stop(6);
+ if ((diff & 0x40) && !(data & 0x40) && !sample_playing(samples, 6)) sample_start(samples, 6, 6, TRUE);
+ if ((diff & 0x40) && (data & 0x40)) sample_stop(samples, 6);
}
@@ -577,7 +573,7 @@ static WRITE8_DEVICE_HANDLER( sega005_sound_b_w )
*
*************************************/
-static CUSTOM_START( sega005_custom_start )
+static DEVICE_START( sega005_sound )
{
running_machine *machine = device->machine;
@@ -590,8 +586,20 @@ static CUSTOM_START( sega005_custom_start )
/* set the initial sound data */
sound_data = 0x00;
sega005_update_sound_data(machine);
+}
- return auto_malloc(1);
+
+static DEVICE_GET_INFO( sega005_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(sega005_sound); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "005 Custom"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
}
@@ -696,6 +704,7 @@ static SOUND_START( spaceod )
WRITE8_HANDLER( spaceod_sound_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
UINT8 diff = data ^ sound_state[offset];
sound_state[offset] = data;
@@ -703,40 +712,40 @@ WRITE8_HANDLER( spaceod_sound_w )
{
case 0:
/* BACK G: channel 0 */
- if ((diff & 0x01) && !(data & 0x01) && !sample_playing(0)) sample_start(0, 7, TRUE);
- if ((diff & 0x01) && (data & 0x01)) sample_stop(0);
+ if ((diff & 0x01) && !(data & 0x01) && !sample_playing(samples, 0)) sample_start(samples, 0, 7, TRUE);
+ if ((diff & 0x01) && (data & 0x01)) sample_stop(samples, 0);
/* SHORT EXP: channel 1 */
- if ((diff & 0x04) && !(data & 0x04)) sample_start(1, 2, FALSE);
+ if ((diff & 0x04) && !(data & 0x04)) sample_start(samples, 1, 2, FALSE);
/* ACCELERATE: channel 2 */
- if ((diff & 0x10) && !(data & 0x10)) sample_start(2, 8, FALSE);
+ if ((diff & 0x10) && !(data & 0x10)) sample_start(samples, 2, 8, FALSE);
/* BATTLE STAR: channel 3 */
- if ((diff & 0x20) && !(data & 0x20)) sample_start(3, 10, FALSE);
+ if ((diff & 0x20) && !(data & 0x20)) sample_start(samples, 3, 10, FALSE);
/* D BOMB: channel 4 */
- if ((diff & 0x40) && !(data & 0x40)) sample_start(4, 1, FALSE);
+ if ((diff & 0x40) && !(data & 0x40)) sample_start(samples, 4, 1, FALSE);
/* LONG EXP: channel 5 */
- if ((diff & 0x80) && !(data & 0x80)) sample_start(5, 3, FALSE);
+ if ((diff & 0x80) && !(data & 0x80)) sample_start(samples, 5, 3, FALSE);
break;
case 1:
/* SHOT: channel 6 */
- if ((diff & 0x01) && !(data & 0x01)) sample_start(6, 0, FALSE);
+ if ((diff & 0x01) && !(data & 0x01)) sample_start(samples, 6, 0, FALSE);
/* BONUS UP: channel 7 */
- if ((diff & 0x02) && !(data & 0x02)) sample_start(7, 6, FALSE);
+ if ((diff & 0x02) && !(data & 0x02)) sample_start(samples, 7, 6, FALSE);
/* WARP: channel 8 */
- if ((diff & 0x08) && !(data & 0x08)) sample_start(8, 4, FALSE);
+ if ((diff & 0x08) && !(data & 0x08)) sample_start(samples, 8, 4, FALSE);
/* APPEARANCE UFO: channel 9 */
- if ((diff & 0x40) && !(data & 0x40)) sample_start(9, 5, FALSE);
+ if ((diff & 0x40) && !(data & 0x40)) sample_start(samples, 9, 5, FALSE);
/* BLACK HOLE: channel 10 */
- if ((diff & 0x80) && !(data & 0x80)) sample_start(10, 9, FALSE);
+ if ((diff & 0x80) && !(data & 0x80)) sample_start(samples, 10, 9, FALSE);
break;
}
}
@@ -805,7 +814,7 @@ static ADDRESS_MAP_START( monsterb_7751_portmap, ADDRESS_SPACE_IO, 8 )
AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(n7751_t1_r)
AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READ(n7751_command_r)
AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ(n7751_rom_r)
- AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(dac_0_data_w)
+ AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE(SOUND, "dac", dac_w)
AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_DEVWRITE(I8243, "audio_8243", n7751_p2_w)
AM_RANGE(MCS48_PORT_PROG, MCS48_PORT_PROG) AM_DEVWRITE(I8243, "audio_8243", i8243_prog_w)
ADDRESS_MAP_END
@@ -880,14 +889,15 @@ static SOUND_START( monsterb )
static WRITE8_DEVICE_HANDLER( monsterb_sound_a_w )
{
+ const device_config *tms = devtag_get_device(device->machine, SOUND, "music");
int enable_val;
/* Lower four data lines get decoded into 13 control lines */
- tms36xx_note_w(0, 0, data & 15);
+ tms36xx_note_w(tms, 0, data & 15);
/* Top four data lines address an 82S123 ROM that enables/disables voices */
enable_val = memory_region(device->machine, "prom")[(data & 0xF0) >> 4];
- tms3617_enable_w(0, enable_val >> 2);
+ tms3617_enable_w(tms, enable_val >> 2);
}
@@ -900,14 +910,15 @@ static WRITE8_DEVICE_HANDLER( monsterb_sound_a_w )
static WRITE8_DEVICE_HANDLER( monsterb_sound_b_w )
{
+ const device_config *samples = devtag_get_device(device->machine, SOUND, "samples");
UINT8 diff = data ^ sound_state[1];
sound_state[1] = data;
/* SHOT: channel 0 */
- if ((diff & 0x01) && !(data & 0x01)) sample_start(0, 0, FALSE);
+ if ((diff & 0x01) && !(data & 0x01)) sample_start(samples, 0, 0, FALSE);
/* DIVE: channel 1 */
- if ((diff & 0x02) && !(data & 0x02)) sample_start(1, 1, FALSE);
+ if ((diff & 0x02) && !(data & 0x02)) sample_start(samples, 1, 1, FALSE);
/* TODO: D7 on Port B might affect TMS3617 output (mute?) */
}
diff --git a/src/mame/audio/segag80v.c b/src/mame/audio/segag80v.c
index 3b95e9932af..8c3ab810a68 100644
--- a/src/mame/audio/segag80v.c
+++ b/src/mame/audio/segag80v.c
@@ -137,190 +137,197 @@ d0 crafts joining
WRITE8_HANDLER( elim1_sh_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
data ^= 0xff;
/* Play fireball sample */
if (data & 0x02)
- sample_start (0, 0, 0);
+ sample_start (samples, 0, 0, 0);
/* Play explosion samples */
if (data & 0x04)
- sample_start (1, 10, 0);
+ sample_start (samples, 1, 10, 0);
if (data & 0x08)
- sample_start (1, 9, 0);
+ sample_start (samples, 1, 9, 0);
if (data & 0x10)
- sample_start (1, 8, 0);
+ sample_start (samples, 1, 8, 0);
/* Play bounce sample */
if (data & 0x20)
{
- if (sample_playing(2))
- sample_stop (2);
- sample_start (2, 1, 0);
+ if (sample_playing(samples, 2))
+ sample_stop (samples, 2);
+ sample_start (samples, 2, 1, 0);
}
/* Play lazer sample */
if (data & 0xc0)
{
- if (sample_playing(3))
- sample_stop (3);
- sample_start (3, 5, 0);
+ if (sample_playing(samples, 3))
+ sample_stop (samples, 3);
+ sample_start (samples, 3, 5, 0);
}
}
WRITE8_HANDLER( elim2_sh_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
data ^= 0xff;
/* Play thrust sample */
if (data & 0x0f)
- sample_start (4, 6, 0);
+ sample_start (samples, 4, 6, 0);
else
- sample_stop (4);
+ sample_stop (samples, 4);
/* Play skitter sample */
if (data & 0x10)
- sample_start (5, 2, 0);
+ sample_start (samples, 5, 2, 0);
/* Play eliminator sample */
if (data & 0x20)
- sample_start (6, 3, 0);
+ sample_start (samples, 6, 3, 0);
/* Play electron samples */
if (data & 0x40)
- sample_start (7, 7, 0);
+ sample_start (samples, 7, 7, 0);
if (data & 0x80)
- sample_start (7, 4, 0);
+ sample_start (samples, 7, 4, 0);
}
WRITE8_HANDLER( zektor1_sh_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
+
data ^= 0xff;
/* Play fireball sample */
if (data & 0x02)
- sample_start (0, 0, 0);
+ sample_start (samples, 0, 0, 0);
/* Play explosion samples */
if (data & 0x04)
- sample_start (1, 10, 0);
+ sample_start (samples, 1, 10, 0);
if (data & 0x08)
- sample_start (1, 9, 0);
+ sample_start (samples, 1, 9, 0);
if (data & 0x10)
- sample_start (1, 8, 0);
+ sample_start (samples, 1, 8, 0);
/* Play bounce sample */
if (data & 0x20)
{
- if (sample_playing(2))
- sample_stop (2);
- sample_start (2, 1, 0);
+ if (sample_playing(samples, 2))
+ sample_stop (samples, 2);
+ sample_start (samples, 2, 1, 0);
}
/* Play lazer sample */
if (data & 0xc0)
{
- if (sample_playing(3))
- sample_stop (3);
- sample_start (3, 5, 0);
+ if (sample_playing(samples, 3))
+ sample_stop (samples, 3);
+ sample_start (samples, 3, 5, 0);
}
}
WRITE8_HANDLER( zektor2_sh_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
data ^= 0xff;
/* Play thrust sample */
if (data & 0x0f)
- sample_start (4, 6, 0);
+ sample_start (samples, 4, 6, 0);
else
- sample_stop (4);
+ sample_stop (samples, 4);
/* Play skitter sample */
if (data & 0x10)
- sample_start (5, 2, 0);
+ sample_start (samples, 5, 2, 0);
/* Play eliminator sample */
if (data & 0x20)
- sample_start (6, 3, 0);
+ sample_start (samples, 6, 3, 0);
/* Play electron samples */
if (data & 0x40)
- sample_start (7, 40, 0);
+ sample_start (samples, 7, 40, 0);
if (data & 0x80)
- sample_start (7, 41, 0);
+ sample_start (samples, 7, 41, 0);
}
WRITE8_HANDLER( spacfury1_sh_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
data ^= 0xff;
/* craft growing */
if (data & 0x01)
- sample_start (1, 0, 0);
+ sample_start (samples, 1, 0, 0);
/* craft moving */
if (data & 0x02)
{
- if (!sample_playing(2))
- sample_start (2, 1, 1);
+ if (!sample_playing(samples, 2))
+ sample_start (samples, 2, 1, 1);
}
else
- sample_stop (2);
+ sample_stop (samples, 2);
/* Thrust */
if (data & 0x04)
{
- if (!sample_playing(3))
- sample_start (3, 4, 1);
+ if (!sample_playing(samples, 3))
+ sample_start (samples, 3, 4, 1);
}
else
- sample_stop (3);
+ sample_stop (samples, 3);
/* star spin */
if (data & 0x40)
- sample_start (4, 8, 0);
+ sample_start (samples, 4, 8, 0);
/* partial warship? */
if (data & 0x80)
- sample_start (4, 9, 0);
+ sample_start (samples, 4, 9, 0);
}
WRITE8_HANDLER( spacfury2_sh_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
data ^= 0xff;
/* craft joining */
if (data & 0x01)
- sample_start (5, 2, 0);
+ sample_start (samples, 5, 2, 0);
/* ship firing */
if (data & 0x02)
{
- if (sample_playing(6))
- sample_stop(6);
- sample_start(6, 3, 0);
+ if (sample_playing(samples, 6))
+ sample_stop(samples, 6);
+ sample_start(samples, 6, 3, 0);
}
/* fireball */
if (data & 0x04)
- sample_start (7, 6, 0);
+ sample_start (samples, 7, 6, 0);
/* small explosion */
if (data & 0x08)
- sample_start (7, 6, 0);
+ sample_start (samples, 7, 6, 0);
/* large explosion */
if (data & 0x10)
- sample_start (7, 5, 0);
+ sample_start (samples, 7, 5, 0);
/* docking bang */
if (data & 0x20)
- sample_start (0, 7, 0);
+ sample_start (samples, 0, 7, 0);
}
diff --git a/src/mame/audio/segasnd.c b/src/mame/audio/segasnd.c
index 69a06c816e5..ccc36253d39 100644
--- a/src/mame/audio/segasnd.c
+++ b/src/mame/audio/segasnd.c
@@ -192,7 +192,7 @@ static WRITE8_HANDLER( speech_p2_w )
*
*************************************/
-static void speech_drq_w(int level)
+static void speech_drq_w(const device_config *device, int level)
{
speech_drq = (level == ASSERT_LINE);
}
@@ -248,7 +248,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( speech_portmap, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0xff) AM_READ(speech_rom_r)
- AM_RANGE(0x00, 0xff) AM_WRITE(sp0250_w)
+ AM_RANGE(0x00, 0xff) AM_DEVWRITE(SOUND, "speech", sp0250_w)
AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(speech_p1_r, speech_p1_w)
AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(speech_p2_w)
AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(speech_t0_r)
@@ -639,7 +639,7 @@ static STREAM_UPDATE( usb_stream_update )
}
-static CUSTOM_START( usb_start )
+static DEVICE_START( usb_sound )
{
running_machine *machine = device->machine;
filter_state temp;
@@ -727,10 +727,24 @@ static CUSTOM_START( usb_start )
state_save_register_item(machine, "usb", NULL, 0, usb.noise_filters[2].capval);
state_save_register_item(machine, "usb", NULL, 0, usb.noise_filters[3].capval);
state_save_register_item(machine, "usb", NULL, 0, usb.noise_filters[4].capval);
+}
+
+
+static DEVICE_GET_INFO( usb_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(usb_sound); break;
- return usb.stream;
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Sega Universal Sound Board"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
}
+#define SOUND_USB DEVICE_GET_INFO_NAME(usb_sound)
+
/*************************************
@@ -898,19 +912,6 @@ ADDRESS_MAP_END
/*************************************
*
- * USB sound definitions
- *
- *************************************/
-
-static const custom_sound_interface usb_custom_interface =
-{
- usb_start
-};
-
-
-
-/*************************************
- *
* USB machine drivers
*
*************************************/
@@ -923,8 +924,7 @@ MACHINE_DRIVER_START( sega_universal_sound_board )
MDRV_CPU_IO_MAP(usb_portmap, 0)
/* sound hardware */
- MDRV_SOUND_ADD("usb", CUSTOM, 0)
- MDRV_SOUND_CONFIG(usb_custom_interface)
+ MDRV_SOUND_ADD("usb", USB, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/audio/seibu.c b/src/mame/audio/seibu.c
index 99e23c3deb1..d969ae47cd9 100644
--- a/src/mame/audio/seibu.c
+++ b/src/mame/audio/seibu.c
@@ -130,7 +130,8 @@ void seibu_sound_decrypt(running_machine *machine,const char *cpu,int length)
Handlers for early Seibu/Tad games with dual channel ADPCM
*/
-static struct seibu_adpcm_state
+typedef struct _seibu_adpcm_state seibu_adpcm_state;
+struct _seibu_adpcm_state
{
struct adpcm_state adpcm;
sound_stream *stream;
@@ -139,11 +140,11 @@ static struct seibu_adpcm_state
UINT8 playing;
UINT8 allocated;
UINT8 *base;
-} seibu_adpcm[2];
+};
static STREAM_UPDATE( seibu_adpcm_callback )
{
- struct seibu_adpcm_state *state = param;
+ seibu_adpcm_state *state = param;
stream_sample_t *dest = outputs[0];
while (state->playing && samples > 0)
@@ -168,31 +169,34 @@ static STREAM_UPDATE( seibu_adpcm_callback )
}
}
-static CUSTOM_START( seibu_adpcm_start )
+static DEVICE_START( seibu_adpcm )
{
running_machine *machine = device->machine;
- int i;
+ seibu_adpcm_state *state = device->token;
- for (i = 0; i < 2; i++)
- if (!seibu_adpcm[i].allocated)
- {
- struct seibu_adpcm_state *state = &seibu_adpcm[i];
- state->allocated = 1;
- state->playing = 0;
- state->stream = stream_create(device, 0, 1, clock, state, seibu_adpcm_callback);
- state->base = memory_region(machine, "adpcm");
- reset_adpcm(&state->adpcm);
- return state;
- }
- return NULL;
+ state->playing = 0;
+ state->stream = stream_create(device, 0, 1, device->clock, state, seibu_adpcm_callback);
+ state->base = memory_region(machine, "adpcm");
+ reset_adpcm(&state->adpcm);
}
-static CUSTOM_STOP( seibu_adpcm_stop )
+DEVICE_GET_INFO( seibu_adpcm )
{
- struct seibu_adpcm_state *state = token;
- state->allocated = 0;
+ switch (state)
+ {
+ /* --- the following bits of info are returned as 64-bit signed integers --- */
+ case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(seibu_adpcm_state); break;
+
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(seibu_adpcm); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Seibu ADPCM"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
}
+
// "decrypt" is a bit flowery here, as it's probably just line-swapping to
// simplify PCB layout/routing rather than intentional protection, but it
// still fits, especially since the Z80s for all these games are truly encrypted.
@@ -209,69 +213,39 @@ void seibu_adpcm_decrypt(running_machine *machine, const char *region)
}
}
-WRITE8_HANDLER( seibu_adpcm_adr_1_w )
+WRITE8_DEVICE_HANDLER( seibu_adpcm_adr_w )
{
- if (seibu_adpcm[0].stream)
- stream_update(seibu_adpcm[0].stream);
- if (offset)
- {
- seibu_adpcm[0].end = data<<8;
- }
- else
- {
- seibu_adpcm[0].current = data<<8;
- seibu_adpcm[0].nibble = 4;
- }
-}
+ seibu_adpcm_state *state = device->token;
-WRITE8_HANDLER( seibu_adpcm_ctl_1_w )
-{
- // sequence is 00 02 01 each time.
- if (seibu_adpcm[0].stream)
- stream_update(seibu_adpcm[0].stream);
- switch (data)
- {
- case 0:
- seibu_adpcm[0].playing = 0;
- break;
- case 2:
- break;
- case 1:
- seibu_adpcm[0].playing = 1;
- break;
-
- }
-}
-
-WRITE8_HANDLER( seibu_adpcm_adr_2_w )
-{
- if (seibu_adpcm[1].stream)
- stream_update(seibu_adpcm[1].stream);
+ if (state->stream)
+ stream_update(state->stream);
if (offset)
{
- seibu_adpcm[1].end = (data<<8) + 0x10000;
+ state->end = data<<8;
}
else
{
- seibu_adpcm[1].current = (data<<8) + 0x10000;
- seibu_adpcm[1].nibble = 4;
+ state->current = data<<8;
+ state->nibble = 4;
}
}
-WRITE8_HANDLER( seibu_adpcm_ctl_2_w )
+WRITE8_DEVICE_HANDLER( seibu_adpcm_ctl_w )
{
+ seibu_adpcm_state *state = device->token;
+
// sequence is 00 02 01 each time.
- if (seibu_adpcm[1].stream)
- stream_update(seibu_adpcm[1].stream);
+ if (state->stream)
+ stream_update(state->stream);
switch (data)
{
case 0:
- seibu_adpcm[1].playing = 0;
+ state->playing = 0;
break;
case 2:
break;
case 1:
- seibu_adpcm[1].playing = 1;
+ state->playing = 1;
break;
}
@@ -338,19 +312,19 @@ WRITE8_HANDLER( seibu_rst18_ack_w )
update_irq_lines(space->machine, RST18_CLEAR);
}
-void seibu_ym3812_irqhandler(running_machine *machine, int linestate)
+void seibu_ym3812_irqhandler(const device_config *device, int linestate)
{
- update_irq_lines(machine, linestate ? RST10_ASSERT : RST10_CLEAR);
+ update_irq_lines(device->machine, linestate ? RST10_ASSERT : RST10_CLEAR);
}
-void seibu_ym2151_irqhandler(running_machine *machine, int linestate)
+void seibu_ym2151_irqhandler(const device_config *device, int linestate)
{
- update_irq_lines(machine, linestate ? RST10_ASSERT : RST10_CLEAR);
+ update_irq_lines(device->machine, linestate ? RST10_ASSERT : RST10_CLEAR);
}
-void seibu_ym2203_irqhandler(running_machine *machine, int linestate)
+void seibu_ym2203_irqhandler(const device_config *device, int linestate)
{
- update_irq_lines(machine, linestate ? RST10_ASSERT : RST10_CLEAR);
+ update_irq_lines(device->machine, linestate ? RST10_ASSERT : RST10_CLEAR);
}
/***************************************************************************/
@@ -473,12 +447,6 @@ const ym3812_interface seibu_ym3812_interface =
seibu_ym3812_irqhandler
};
-const custom_sound_interface seibu_adpcm_interface =
-{
- seibu_adpcm_start,
- seibu_adpcm_stop
-};
-
const ym2151_interface seibu_ym2151_interface =
{
seibu_ym2151_irqhandler
@@ -489,7 +457,7 @@ const ym2203_interface seibu_ym2203_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
seibu_ym2203_irqhandler
};
@@ -504,14 +472,13 @@ ADDRESS_MAP_START( seibu_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4002, 0x4002) AM_WRITE(seibu_rst10_ack_w)
AM_RANGE(0x4003, 0x4003) AM_WRITE(seibu_rst18_ack_w)
AM_RANGE(0x4007, 0x4007) AM_WRITE(seibu_bank_w)
- AM_RANGE(0x4008, 0x4008) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0x4009, 0x4009) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x4008, 0x4009) AM_DEVREADWRITE(SOUND, "ym", ym3812_r, ym3812_w)
AM_RANGE(0x4010, 0x4011) AM_READ(seibu_soundlatch_r)
AM_RANGE(0x4012, 0x4012) AM_READ(seibu_main_data_pending_r)
AM_RANGE(0x4013, 0x4013) AM_READ_PORT("COIN")
AM_RANGE(0x4018, 0x4019) AM_WRITE(seibu_main_data_w)
AM_RANGE(0x401b, 0x401b) AM_WRITE(seibu_coin_w)
- AM_RANGE(0x6000, 0x6000) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x6000, 0x6000) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0x8000, 0xffff) AM_ROMBANK(1)
ADDRESS_MAP_END
@@ -524,14 +491,13 @@ ADDRESS_MAP_START( seibu2_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4002, 0x4002) AM_WRITE(seibu_rst10_ack_w)
AM_RANGE(0x4003, 0x4003) AM_WRITE(seibu_rst18_ack_w)
AM_RANGE(0x4007, 0x4007) AM_WRITE(seibu_bank_w)
- AM_RANGE(0x4008, 0x4008) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x4009, 0x4009) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x4008, 0x4009) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x4010, 0x4011) AM_READ(seibu_soundlatch_r)
AM_RANGE(0x4012, 0x4012) AM_READ(seibu_main_data_pending_r)
AM_RANGE(0x4013, 0x4013) AM_READ_PORT("COIN")
AM_RANGE(0x4018, 0x4019) AM_WRITE(seibu_main_data_w)
AM_RANGE(0x401b, 0x401b) AM_WRITE(seibu_coin_w)
- AM_RANGE(0x6000, 0x6000) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x6000, 0x6000) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0x8000, 0xffff) AM_ROMBANK(1)
ADDRESS_MAP_END
@@ -543,15 +509,14 @@ ADDRESS_MAP_START( seibu2_raiden2_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4002, 0x4002) AM_WRITE(seibu_rst10_ack_w)
AM_RANGE(0x4003, 0x4003) AM_WRITE(seibu_rst18_ack_w)
AM_RANGE(0x4007, 0x4007) AM_WRITE(seibu_bank_w)
- AM_RANGE(0x4008, 0x4008) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x4009, 0x4009) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x4008, 0x4009) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x4010, 0x4011) AM_READ(seibu_soundlatch_r)
AM_RANGE(0x4012, 0x4012) AM_READ(seibu_main_data_pending_r)
AM_RANGE(0x4013, 0x4013) AM_READ_PORT("COIN")
AM_RANGE(0x4018, 0x4019) AM_WRITE(seibu_main_data_w)
AM_RANGE(0x401b, 0x401b) AM_WRITE(seibu_coin_w)
- AM_RANGE(0x6000, 0x6000) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
- AM_RANGE(0x6002, 0x6002) AM_READWRITE(okim6295_status_1_r, okim6295_data_1_w)
+ AM_RANGE(0x6000, 0x6000) AM_DEVREADWRITE(SOUND, "oki1", okim6295_r, okim6295_w)
+ AM_RANGE(0x6002, 0x6002) AM_DEVREADWRITE(SOUND, "oki2", okim6295_r, okim6295_w)
AM_RANGE(0x8000, 0xffff) AM_ROMBANK(1)
ADDRESS_MAP_END
@@ -564,15 +529,13 @@ ADDRESS_MAP_START( seibu3_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4002, 0x4002) AM_WRITE(seibu_rst10_ack_w)
AM_RANGE(0x4003, 0x4003) AM_WRITE(seibu_rst18_ack_w)
AM_RANGE(0x4007, 0x4007) AM_WRITE(seibu_bank_w)
- AM_RANGE(0x4008, 0x4008) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x4009, 0x4009) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
+ AM_RANGE(0x4008, 0x4009) AM_DEVREADWRITE(SOUND, "ym1", ym2203_r, ym2203_w)
AM_RANGE(0x4010, 0x4011) AM_READ(seibu_soundlatch_r)
AM_RANGE(0x4012, 0x4012) AM_READ(seibu_main_data_pending_r)
AM_RANGE(0x4013, 0x4013) AM_READ_PORT("COIN")
AM_RANGE(0x4018, 0x4019) AM_WRITE(seibu_main_data_w)
AM_RANGE(0x401b, 0x401b) AM_WRITE(seibu_coin_w)
- AM_RANGE(0x6008, 0x6008) AM_READWRITE(ym2203_status_port_1_r, ym2203_control_port_1_w)
- AM_RANGE(0x6009, 0x6009) AM_READWRITE(ym2203_read_port_1_r, ym2203_write_port_1_w)
+ AM_RANGE(0x6008, 0x6009) AM_DEVREADWRITE(SOUND, "ym2", ym2203_r, ym2203_w)
AM_RANGE(0x8000, 0xffff) AM_ROMBANK(1)
ADDRESS_MAP_END
@@ -583,19 +546,17 @@ ADDRESS_MAP_START( seibu3_adpcm_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4001, 0x4001) AM_WRITE(seibu_irq_clear_w)
AM_RANGE(0x4002, 0x4002) AM_WRITE(seibu_rst10_ack_w)
AM_RANGE(0x4003, 0x4003) AM_WRITE(seibu_rst18_ack_w)
- AM_RANGE(0x4005, 0x4006) AM_WRITE(seibu_adpcm_adr_1_w)
+ AM_RANGE(0x4005, 0x4006) AM_DEVWRITE(SOUND, "adpcm1", seibu_adpcm_adr_w)
AM_RANGE(0x4007, 0x4007) AM_WRITE(seibu_bank_w)
- AM_RANGE(0x4008, 0x4008) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x4009, 0x4009) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
+ AM_RANGE(0x4008, 0x4009) AM_DEVREADWRITE(SOUND, "ym1", ym2203_r, ym2203_w)
AM_RANGE(0x4010, 0x4011) AM_READ(seibu_soundlatch_r)
AM_RANGE(0x4012, 0x4012) AM_READ(seibu_main_data_pending_r)
AM_RANGE(0x4013, 0x4013) AM_READ_PORT("COIN")
AM_RANGE(0x4018, 0x4019) AM_WRITE(seibu_main_data_w)
- AM_RANGE(0x401a, 0x401a) AM_WRITE(seibu_adpcm_ctl_1_w)
+ AM_RANGE(0x401a, 0x401a) AM_DEVWRITE(SOUND, "adpcm1", seibu_adpcm_ctl_w)
AM_RANGE(0x401b, 0x401b) AM_WRITE(seibu_coin_w)
- AM_RANGE(0x6005, 0x6006) AM_WRITE(seibu_adpcm_adr_2_w)
- AM_RANGE(0x6008, 0x6008) AM_READWRITE(ym2203_status_port_1_r, ym2203_control_port_1_w)
- AM_RANGE(0x6009, 0x6009) AM_READWRITE(ym2203_read_port_1_r, ym2203_write_port_1_w)
- AM_RANGE(0x601a, 0x601a) AM_WRITE(seibu_adpcm_ctl_2_w)
+ AM_RANGE(0x6005, 0x6006) AM_DEVWRITE(SOUND, "adpcm2", seibu_adpcm_adr_w)
+ AM_RANGE(0x6008, 0x6009) AM_DEVREADWRITE(SOUND, "ym2", ym2203_r, ym2203_w)
+ AM_RANGE(0x601a, 0x601a) AM_DEVWRITE(SOUND, "adpcm2", seibu_adpcm_ctl_w)
AM_RANGE(0x8000, 0xffff) AM_ROMBANK(1)
ADDRESS_MAP_END
diff --git a/src/mame/audio/seibu.h b/src/mame/audio/seibu.h
index a2ccceaecc2..a3f51a58248 100644
--- a/src/mame/audio/seibu.h
+++ b/src/mame/audio/seibu.h
@@ -28,7 +28,6 @@
#include "sound/2151intf.h"
#include "sound/2203intf.h"
#include "sound/okim6295.h"
-#include "sound/custom.h"
ADDRESS_MAP_EXTERN(seibu_sound_map, 8);
ADDRESS_MAP_EXTERN(seibu2_sound_map, 8);
@@ -48,9 +47,9 @@ WRITE8_HANDLER( seibu_rst10_ack_w );
WRITE8_HANDLER( seibu_rst18_ack_w );
WRITE8_HANDLER( seibu_bank_w );
WRITE8_HANDLER( seibu_coin_w );
-void seibu_ym3812_irqhandler(running_machine *machine, int linestate);
-void seibu_ym2151_irqhandler(running_machine *machine, int linestate);
-void seibu_ym2203_irqhandler(running_machine *machine, int linestate);
+void seibu_ym3812_irqhandler(const device_config *device, int linestate);
+void seibu_ym2151_irqhandler(const device_config *device, int linestate);
+void seibu_ym2203_irqhandler(const device_config *device, int linestate);
READ8_HANDLER( seibu_soundlatch_r );
READ8_HANDLER( seibu_main_data_pending_r );
WRITE8_HANDLER( seibu_main_data_w );
@@ -58,13 +57,13 @@ MACHINE_RESET( seibu_sound );
void seibu_sound_decrypt(running_machine *machine,const char *cpu,int length);
void seibu_adpcm_decrypt(running_machine *machine, const char *region);
-WRITE8_HANDLER( seibu_adpcm_adr_1_w );
-WRITE8_HANDLER( seibu_adpcm_ctl_1_w );
-WRITE8_HANDLER( seibu_adpcm_adr_2_w );
-WRITE8_HANDLER( seibu_adpcm_ctl_2_w );
+WRITE8_DEVICE_HANDLER( seibu_adpcm_adr_w );
+WRITE8_DEVICE_HANDLER( seibu_adpcm_ctl_w );
+
+DEVICE_GET_INFO( seibu_adpcm );
+#define SOUND_SEIBU_ADPCM DEVICE_GET_INFO_NAME(seibu_adpcm)
extern const ym3812_interface seibu_ym3812_interface;
-extern const custom_sound_interface seibu_adpcm_interface;
extern const ym2151_interface seibu_ym2151_interface;
extern const ym2203_interface seibu_ym2203_interface;
@@ -159,12 +158,10 @@ extern const ym2203_interface seibu_ym2203_interface;
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15) \
#define SEIBU_SOUND_SYSTEM_ADPCM_INTERFACE \
- MDRV_SOUND_ADD("adpcm1", CUSTOM, 8000) \
- MDRV_SOUND_CONFIG(seibu_adpcm_interface) \
+ MDRV_SOUND_ADD("adpcm1", SEIBU_ADPCM, 8000) \
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) \
\
- MDRV_SOUND_ADD("adpcm2", CUSTOM, 8000) \
- MDRV_SOUND_CONFIG(seibu_adpcm_interface) \
+ MDRV_SOUND_ADD("adpcm2", SEIBU_ADPCM, 8000) \
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) \
diff --git a/src/mame/audio/senjyo.c b/src/mame/audio/senjyo.c
index b07ae292b01..01491938e4e 100644
--- a/src/mame/audio/senjyo.c
+++ b/src/mame/audio/senjyo.c
@@ -50,13 +50,16 @@ const z80ctc_interface senjyo_ctc_intf =
WRITE8_HANDLER( senjyo_volume_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
single_volume = data & 0x0f;
- sample_set_volume(0,single_volume / 15.0);
+ sample_set_volume(samples,0,single_volume / 15.0);
}
static TIMER_CALLBACK( senjyo_sh_update )
{
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
+
/* ctc2 timer single tone generator frequency */
attotime period = z80ctc_getperiod (devtag_get_device(machine, Z80CTC, "z80ctc"), 2);
if (attotime_compare(period, attotime_zero) != 0 )
@@ -64,7 +67,7 @@ static TIMER_CALLBACK( senjyo_sh_update )
else
single_rate = 0;
- sample_set_freq(0,single_rate);
+ sample_set_freq(samples, 0,single_rate);
}
@@ -79,8 +82,8 @@ SAMPLES_START( senjyo_sh_start )
_single[i] = ((i/SINGLE_DIVIDER)&0x01)*127*256;
/* CTC2 single tone generator */
- sample_set_volume(0,0);
- sample_start_raw(0,_single,SINGLE_LENGTH,single_rate,1);
+ sample_set_volume(device,0,0);
+ sample_start_raw(device,0,_single,SINGLE_LENGTH,single_rate,1);
timer_pulse(machine, video_screen_get_frame_period(machine->primary_screen), NULL, 0, senjyo_sh_update);
}
diff --git a/src/mame/audio/snes.c b/src/mame/audio/snes.c
index 41aa37ae0cd..118d0c41f1e 100644
--- a/src/mame/audio/snes.c
+++ b/src/mame/audio/snes.c
@@ -1134,7 +1134,7 @@ static TIMER_CALLBACK( snes_spc_timer )
}
}
-CUSTOM_START( snes_sh_start )
+static DEVICE_START( snes_sound )
{
running_machine *machine = device->machine;
UINT8 ii;
@@ -1166,10 +1166,22 @@ CUSTOM_START( snes_sh_start )
timer_enable( timers[2].timer, 0 );
DSP_Reset();
+}
+
+DEVICE_GET_INFO( snes_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(snes_sound); break;
- return auto_malloc(1);
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "SNES Custom"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
}
+
STREAM_UPDATE( snes_sh_update )
{
int i;
diff --git a/src/mame/audio/spacefb.c b/src/mame/audio/spacefb.c
index 064026608e3..1516de54ce1 100644
--- a/src/mame/audio/spacefb.c
+++ b/src/mame/audio/spacefb.c
@@ -36,13 +36,15 @@ READ8_HANDLER( spacefb_audio_t1_r )
WRITE8_HANDLER( spacefb_port_1_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
+
cpu_set_input_line(space->machine->cpu[1], 0, (data & 0x02) ? CLEAR_LINE : ASSERT_LINE);
/* enemy killed */
- if (!(data & 0x01) && (spacefb_sound_latch & 0x01)) sample_start(0,0,0);
+ if (!(data & 0x01) && (spacefb_sound_latch & 0x01)) sample_start(samples, 0,0,0);
/* ship fire */
- if (!(data & 0x40) && (spacefb_sound_latch & 0x40)) sample_start(1,1,0);
+ if (!(data & 0x40) && (spacefb_sound_latch & 0x40)) sample_start(samples, 1,1,0);
/*
* Explosion Noise
@@ -56,10 +58,10 @@ WRITE8_HANDLER( spacefb_port_1_w )
{
if (data & 0x80)
/* play decaying noise */
- sample_start(2,3,0);
+ sample_start(samples, 2,3,0);
else
/* start looping noise */
- sample_start(2,2,1);
+ sample_start(samples, 2,2,1);
}
spacefb_sound_latch = data;
diff --git a/src/mame/audio/spiders.c b/src/mame/audio/spiders.c
index 60e64b49c8f..9f9e3a61159 100644
--- a/src/mame/audio/spiders.c
+++ b/src/mame/audio/spiders.c
@@ -179,22 +179,25 @@ WRITE8_HANDLER( spiders_audio_command_w )
WRITE8_HANDLER( spiders_audio_a_w )
{
- discrete_sound_w(space, SPIDER_WEB_SOUND_MOD_DATA, 1 + (data & 4) * 8 + (data & 2) * 4 + (data & 1) * 2);
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+ discrete_sound_w(discrete, SPIDER_WEB_SOUND_MOD_DATA, 1 + (data & 4) * 8 + (data & 2) * 4 + (data & 1) * 2);
}
WRITE8_HANDLER( spiders_audio_b_w )
{
- discrete_sound_w(space, SPIDERS_WEB_SOUND_DATA, data);
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+ discrete_sound_w(discrete, SPIDERS_WEB_SOUND_DATA, data);
}
WRITE8_HANDLER( spiders_audio_ctrl_w )
{
- discrete_sound_w(space, SPIDERS_FIRE_EN, data & 0x10 ? 1 : 0);
- discrete_sound_w(space, SPIDERS_EXP_EN, data & 0x08 ? 1 : 0);
- discrete_sound_w(space, SPIDERS_SUPER_WEB_EXPL_EN, data & 0x04 ? 1 : 0);
- discrete_sound_w(space, SPIDERS_SUPER_WEB_EN, data & 0x02 ? 1 : 0);
- discrete_sound_w(space, SPIDERS_X_EN, data & 0x01 ? 1 : 0);
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+ discrete_sound_w(discrete, SPIDERS_FIRE_EN, data & 0x10 ? 1 : 0);
+ discrete_sound_w(discrete, SPIDERS_EXP_EN, data & 0x08 ? 1 : 0);
+ discrete_sound_w(discrete, SPIDERS_SUPER_WEB_EXPL_EN, data & 0x04 ? 1 : 0);
+ discrete_sound_w(discrete, SPIDERS_SUPER_WEB_EN, data & 0x02 ? 1 : 0);
+ discrete_sound_w(discrete, SPIDERS_X_EN, data & 0x01 ? 1 : 0);
}
diff --git a/src/mame/audio/starwars.c b/src/mame/audio/starwars.c
index d6df725a943..0938ea1ef6b 100644
--- a/src/mame/audio/starwars.c
+++ b/src/mame/audio/starwars.c
@@ -45,21 +45,21 @@ static UINT8 r6532_porta_r(const device_config *device, UINT8 olddata)
/* d0 (out) TMS5220 Not Write */
/* Note: bit 4 is always set to avoid sound self test */
- return (olddata & 0xc0) | 0x10 | (!tms5220_ready_r() << 2);
+ return (olddata & 0xc0) | 0x10 | (!tms5220_ready_r(devtag_get_device(device->machine, SOUND, "tms")) << 2);
}
static void r6532_porta_w(const device_config *device, UINT8 newdata, UINT8 olddata)
{
- const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const device_config *tms = devtag_get_device(device->machine, SOUND, "tms");
/* handle 5220 read */
if ((olddata & 2) != 0 && (newdata & 2) == 0)
- riot6532_portb_in_set(riot, tms5220_status_r(space, 0), 0xff);
+ riot6532_portb_in_set(riot, tms5220_status_r(tms, 0), 0xff);
/* handle 5220 write */
if ((olddata & 1) != 0 && (newdata & 1) == 0)
- tms5220_data_w(space, 0, riot6532_portb_out_get(riot));
+ tms5220_data_w(tms, 0, riot6532_portb_out_get(riot));
}
diff --git a/src/mame/audio/subs.c b/src/mame/audio/subs.c
index 74e34b95bbb..d18615982ef 100644
--- a/src/mame/audio/subs.c
+++ b/src/mame/audio/subs.c
@@ -12,30 +12,30 @@
sub sound functions
***************************************************************************/
-WRITE8_HANDLER( subs_sonar1_w )
+WRITE8_DEVICE_HANDLER( subs_sonar1_w )
{
- discrete_sound_w(space, SUBS_SONAR1_EN, offset & 0x01);
+ discrete_sound_w(device, SUBS_SONAR1_EN, offset & 0x01);
}
-WRITE8_HANDLER( subs_sonar2_w )
+WRITE8_DEVICE_HANDLER( subs_sonar2_w )
{
- discrete_sound_w(space, SUBS_SONAR2_EN, offset & 0x01);
+ discrete_sound_w(device, SUBS_SONAR2_EN, offset & 0x01);
}
-WRITE8_HANDLER( subs_crash_w )
+WRITE8_DEVICE_HANDLER( subs_crash_w )
{
- discrete_sound_w(space, SUBS_CRASH_EN, offset & 0x01);
+ discrete_sound_w(device, SUBS_CRASH_EN, offset & 0x01);
}
-WRITE8_HANDLER( subs_explode_w )
+WRITE8_DEVICE_HANDLER( subs_explode_w )
{
- discrete_sound_w(space, SUBS_EXPLODE_EN, offset & 0x01);
+ discrete_sound_w(device, SUBS_EXPLODE_EN, offset & 0x01);
}
-WRITE8_HANDLER( subs_noise_reset_w )
+WRITE8_DEVICE_HANDLER( subs_noise_reset_w )
{
/* Pulse noise reset */
- discrete_sound_w(space, SUBS_NOISE_RESET, 0);
+ discrete_sound_w(device, SUBS_NOISE_RESET, 0);
}
diff --git a/src/mame/audio/suna8.c b/src/mame/audio/suna8.c
index 0a5d0431d4a..cf60d41f0c4 100644
--- a/src/mame/audio/suna8.c
+++ b/src/mame/audio/suna8.c
@@ -13,23 +13,23 @@
static INT16 *samplebuf;
static int sample;
-WRITE8_HANDLER( suna8_play_samples_w )
+WRITE8_DEVICE_HANDLER( suna8_play_samples_w )
{
if( data )
{
if( ~data & 0x10 )
{
- sample_start_raw(0, &samplebuf[0x800*sample], 0x0800, 4000, 0);
+ sample_start_raw(device, 0, &samplebuf[0x800*sample], 0x0800, 4000, 0);
}
else if( ~data & 0x08 )
{
sample &= 3;
- sample_start_raw(0, &samplebuf[0x800*(sample+7)], 0x0800, 4000, 0);
+ sample_start_raw(device, 0, &samplebuf[0x800*(sample+7)], 0x0800, 4000, 0);
}
}
}
-WRITE8_HANDLER( suna8_samples_number_w )
+WRITE8_DEVICE_HANDLER( suna8_samples_number_w )
{
sample = data & 0xf;
}
diff --git a/src/mame/audio/t5182.c b/src/mame/audio/t5182.c
index 4bbe2e28acb..440600daab6 100644
--- a/src/mame/audio/t5182.c
+++ b/src/mame/audio/t5182.c
@@ -219,12 +219,12 @@ static WRITE8_HANDLER( t5182_cpu_irq_ack_w )
timer_call_after_resynch(space->machine, NULL, CPU_CLEAR,setirq_callback);
}
-static void t5182_ym2151_irq_handler(running_machine *machine, int irq)
+static void t5182_ym2151_irq_handler(const device_config *device, int irq)
{
if (irq)
- timer_call_after_resynch(machine, NULL, YM2151_ASSERT,setirq_callback);
+ timer_call_after_resynch(device->machine, NULL, YM2151_ASSERT,setirq_callback);
else
- timer_call_after_resynch(machine, NULL, YM2151_CLEAR,setirq_callback);
+ timer_call_after_resynch(device->machine, NULL, YM2151_CLEAR,setirq_callback);
}
@@ -307,8 +307,7 @@ ADDRESS_MAP_END
// 50 W test mode status flags (bit 0 = ROM test fail, bit 1 = RAM test fail, bit 2 = YM2151 IRQ not received)
ADDRESS_MAP_START( t5182_io, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x10, 0x10) AM_WRITE(t5182_sharedram_semaphore_snd_acquire_w)
AM_RANGE(0x11, 0x11) AM_WRITE(t5182_sharedram_semaphore_snd_release_w)
AM_RANGE(0x12, 0x12) AM_WRITE(t5182_ym2151_irq_ack_w)
diff --git a/src/mame/audio/taito_en.c b/src/mame/audio/taito_en.c
index d84a716d142..38ced54e84c 100644
--- a/src/mame/audio/taito_en.c
+++ b/src/mame/audio/taito_en.c
@@ -47,7 +47,7 @@ WRITE16_HANDLER( f3_es5505_bank_w )
/* mask out unused bits */
data &= max_banks_this_game;
- es5505_voice_bank_0_w(offset,data<<20);
+ es5505_voice_bank_w(devtag_get_device(space->machine, SOUND, "ensoniq"),offset,data<<20);
}
WRITE16_HANDLER( f3_volume_w )
@@ -233,7 +233,7 @@ static UINT16 *sound_ram;
ADDRESS_MAP_START( f3_sound_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x00ffff) AM_RAM AM_MIRROR(0x30000) AM_SHARE(1) AM_BASE(&sound_ram)
AM_RANGE(0x140000, 0x140fff) AM_READWRITE(f3_68000_share_r, f3_68000_share_w)
- AM_RANGE(0x200000, 0x20001f) AM_READWRITE(es5505_data_0_r, es5505_data_0_w)
+ AM_RANGE(0x200000, 0x20001f) AM_DEVREADWRITE(SOUND, "ensoniq", es5505_r, es5505_w)
AM_RANGE(0x260000, 0x2601ff) AM_READWRITE(es5510_dsp_r, es5510_dsp_w)
AM_RANGE(0x280000, 0x28001f) AM_READWRITE(f3_68681_r, f3_68681_w)
AM_RANGE(0x300000, 0x30003f) AM_WRITE(f3_es5505_bank_w)
@@ -266,7 +266,7 @@ const es5505_interface es5505_taito_f3_config =
{
"ensoniq.0", /* Bank 0: Unused by F3 games? */
"ensoniq.0", /* Bank 1: All games seem to use this */
- 0 /* irq */
+ NULL /* irq */
};
diff --git a/src/mame/audio/targ.c b/src/mame/audio/targ.c
index 3536336bf75..3aeb9fc8d34 100644
--- a/src/mame/audio/targ.c
+++ b/src/mame/audio/targ.c
@@ -45,50 +45,52 @@ static const INT16 sine_wave[32] =
-static void adjust_sample(UINT8 freq)
+static void adjust_sample(const device_config *samples, UINT8 freq)
{
tone_freq = freq;
if ((tone_freq == 0xff) || (tone_freq == 0x00))
- sample_set_volume(3, 0);
+ sample_set_volume(samples, 3, 0);
else
{
- sample_set_freq(3, 1.0 * max_freq / (0xff - tone_freq));
- sample_set_volume(3, tone_active);
+ sample_set_freq(samples, 3, 1.0 * max_freq / (0xff - tone_freq));
+ sample_set_volume(samples, 3, tone_active);
}
}
WRITE8_HANDLER( targ_audio_1_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
+
/* CPU music */
if ((data & 0x01) != (port_1_last & 0x01))
- dac_data_w(0,(data & 0x01) * 0xff);
+ dac_data_w(devtag_get_device(space->machine, SOUND, "dac"),(data & 0x01) * 0xff);
/* shot */
- if (FALLING_EDGE(0x02) && !sample_playing(0)) sample_start(0,1,0);
- if (RISING_EDGE(0x02)) sample_stop(0);
+ if (FALLING_EDGE(0x02) && !sample_playing(samples, 0)) sample_start(samples, 0,1,0);
+ if (RISING_EDGE(0x02)) sample_stop(samples, 0);
/* crash */
if (RISING_EDGE(0x20))
{
if (data & 0x40)
- sample_start(1,2,0);
+ sample_start(samples, 1,2,0);
else
- sample_start(1,0,0);
+ sample_start(samples, 1,0,0);
}
/* Sspec */
if (data & 0x10)
- sample_stop(2);
+ sample_stop(samples, 2);
else
{
if ((data & 0x08) != (port_1_last & 0x08))
{
if (data & 0x08)
- sample_start(2,3,1);
+ sample_start(samples, 2,3,1);
else
- sample_start(2,4,1);
+ sample_start(samples, 2,4,1);
}
}
@@ -98,7 +100,7 @@ WRITE8_HANDLER( targ_audio_1_w )
tone_pointer = 0;
tone_active = 0;
- adjust_sample(tone_freq);
+ adjust_sample(samples, tone_freq);
}
if (RISING_EDGE(0x80))
@@ -112,11 +114,12 @@ WRITE8_HANDLER( targ_audio_2_w )
{
if ((data & 0x01) && !(port_2_last & 0x01))
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
UINT8 *prom = memory_region(space->machine, "targ");
tone_pointer = (tone_pointer + 1) & 0x0f;
- adjust_sample(prom[((data & 0x02) << 3) | tone_pointer]);
+ adjust_sample(samples, prom[((data & 0x02) << 3) | tone_pointer]);
}
port_2_last = data;
@@ -125,7 +128,8 @@ WRITE8_HANDLER( targ_audio_2_w )
WRITE8_HANDLER( spectar_audio_2_w )
{
- adjust_sample(data);
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
+ adjust_sample(samples, data);
}
@@ -143,13 +147,14 @@ static const char *const sample_names[] =
static void common_audio_start(running_machine *machine, int freq)
{
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
max_freq = freq;
tone_freq = 0;
tone_active = 0;
- sample_set_volume(3, 0);
- sample_start_raw(3, sine_wave, 32, 1000, 1);
+ sample_set_volume(samples, 3, 0);
+ sample_start_raw(samples, 3, sine_wave, 32, 1000, 1);
state_save_register_global(machine, port_1_last);
state_save_register_global(machine, port_2_last);
diff --git a/src/mame/audio/tiamc1.c b/src/mame/audio/tiamc1.c
index 39d5b0b89fc..107489948b0 100644
--- a/src/mame/audio/tiamc1.c
+++ b/src/mame/audio/tiamc1.c
@@ -280,7 +280,7 @@ static STREAM_UPDATE( tiamc1_sound_update )
}
}
-CUSTOM_START( tiamc1_sh_start )
+static DEVICE_START( tiamc1_sound )
{
running_machine *machine = device->machine;
int i, j;
@@ -288,7 +288,7 @@ CUSTOM_START( tiamc1_sh_start )
timer8253_reset(&timer0);
timer8253_reset(&timer1);
- channel = stream_create(device, 0, 1, clock / CLOCK_DIVIDER, 0, tiamc1_sound_update);
+ channel = stream_create(device, 0, 1, device->clock / CLOCK_DIVIDER, 0, tiamc1_sound_update);
timer1_divider = 0;
@@ -309,7 +309,20 @@ CUSTOM_START( tiamc1_sh_start )
}
state_save_register_global(machine, timer1_divider);
+}
+
- return channel;
+DEVICE_GET_INFO( tiamc1_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(tiamc1_sound); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "TIA-MC1 Custom"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
}
+
diff --git a/src/mame/audio/timeplt.c b/src/mame/audio/timeplt.c
index 6a0bd9f13f2..bf61872a466 100644
--- a/src/mame/audio/timeplt.c
+++ b/src/mame/audio/timeplt.c
@@ -60,13 +60,13 @@ static SOUND_START( timeplt )
/* Bit 7 comes from the QA output of the LS90 producing a sequence of */
/* 0, 0, 0, 0, 0, 1, 1, 1, 1, 1 */
-static READ8_HANDLER( timeplt_portB_r )
+static READ8_DEVICE_HANDLER( timeplt_portB_r )
{
static const int timeplt_timer[10] =
{
0x00, 0x10, 0x20, 0x30, 0x40, 0x90, 0xa0, 0xb0, 0xa0, 0xd0
};
- return timeplt_timer[(cputag_get_total_cycles(space->machine, "tpsound") / 512) % 10];
+ return timeplt_timer[(cputag_get_total_cycles(device->machine, "tpsound") / 512) % 10];
}
@@ -77,24 +77,24 @@ static READ8_HANDLER( timeplt_portB_r )
*
*************************************/
-static void filter_w(int chip, int channel, int data)
+static void filter_w(const device_config *device, int data)
{
int C = 0;
if (data & 1) C += 220000; /* 220000pF = 0.220uF */
if (data & 2) C += 47000; /* 47000pF = 0.047uF */
- filter_rc_set_RC(3*chip + channel,FLT_RC_LOWPASS, 1000,5100,0,CAP_P(C));
+ filter_rc_set_RC(device,FLT_RC_LOWPASS, 1000,5100,0,CAP_P(C));
}
static WRITE8_HANDLER( timeplt_filter_w )
{
- filter_w(0, 0, (offset >> 6) & 3);
- filter_w(0, 1, (offset >> 8) & 3);
- filter_w(0, 2, (offset >> 10) & 3);
- filter_w(1, 0, (offset >> 0) & 3);
- filter_w(1, 1, (offset >> 2) & 3);
- filter_w(1, 2, (offset >> 4) & 3);
+ filter_w(devtag_get_device(space->machine, SOUND, "filter.0.0"), (offset >> 6) & 3);
+ filter_w(devtag_get_device(space->machine, SOUND, "filter.0.1"), (offset >> 8) & 3);
+ filter_w(devtag_get_device(space->machine, SOUND, "filter.0.2"), (offset >> 10) & 3);
+ filter_w(devtag_get_device(space->machine, SOUND, "filter.1.0"), (offset >> 0) & 3);
+ filter_w(devtag_get_device(space->machine, SOUND, "filter.1.1"), (offset >> 2) & 3);
+ filter_w(devtag_get_device(space->machine, SOUND, "filter.1.2"), (offset >> 4) & 3);
}
@@ -127,10 +127,10 @@ WRITE8_HANDLER( timeplt_sh_irqtrigger_w )
static ADDRESS_MAP_START( timeplt_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x2fff) AM_ROM
AM_RANGE(0x3000, 0x33ff) AM_MIRROR(0x0c00) AM_RAM
- AM_RANGE(0x4000, 0x4000) AM_MIRROR(0x0fff) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x5000, 0x5000) AM_MIRROR(0x0fff) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x0fff) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
- AM_RANGE(0x7000, 0x7000) AM_MIRROR(0x0fff) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0x4000, 0x4000) AM_MIRROR(0x0fff) AM_DEVREADWRITE(SOUND, "ay1", ay8910_r, ay8910_data_w)
+ AM_RANGE(0x5000, 0x5000) AM_MIRROR(0x0fff) AM_DEVWRITE(SOUND, "ay1", ay8910_address_w)
+ AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x0fff) AM_DEVREADWRITE(SOUND, "ay2", ay8910_r, ay8910_data_w)
+ AM_RANGE(0x7000, 0x7000) AM_MIRROR(0x0fff) AM_DEVWRITE(SOUND, "ay2", ay8910_address_w)
AM_RANGE(0x8000, 0xffff) AM_WRITE(timeplt_filter_w)
ADDRESS_MAP_END
@@ -139,10 +139,10 @@ static ADDRESS_MAP_START( locomotn_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_ROM
AM_RANGE(0x2000, 0x23ff) AM_MIRROR(0x0c00) AM_RAM
AM_RANGE(0x3000, 0x3fff) AM_WRITE(timeplt_filter_w)
- AM_RANGE(0x4000, 0x4000) AM_MIRROR(0x0fff) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x5000, 0x5000) AM_MIRROR(0x0fff) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x0fff) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
- AM_RANGE(0x7000, 0x7000) AM_MIRROR(0x0fff) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0x4000, 0x4000) AM_MIRROR(0x0fff) AM_DEVREADWRITE(SOUND, "ay1", ay8910_r, ay8910_data_w)
+ AM_RANGE(0x5000, 0x5000) AM_MIRROR(0x0fff) AM_DEVWRITE(SOUND, "ay1", ay8910_address_w)
+ AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x0fff) AM_DEVREADWRITE(SOUND, "ay2", ay8910_r, ay8910_data_w)
+ AM_RANGE(0x7000, 0x7000) AM_MIRROR(0x0fff) AM_DEVWRITE(SOUND, "ay2", ay8910_address_w)
ADDRESS_MAP_END
@@ -157,10 +157,10 @@ static const ay8910_interface timeplt_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r,
- timeplt_portB_r,
- NULL,
- NULL
+ DEVCB_MEMORY_HANDLER("tpsound", PROGRAM, soundlatch_r),
+ DEVCB_HANDLER(timeplt_portB_r),
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/audio/toaplan2.c b/src/mame/audio/toaplan2.c
index 45d34a564a9..0c1a9962a97 100644
--- a/src/mame/audio/toaplan2.c
+++ b/src/mame/audio/toaplan2.c
@@ -71,77 +71,77 @@ static const UINT8 fixeight_cmd_snd[128] =
/*78*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
-static void play_oki_sound(const address_space *space, int game_sound, int data)
+static void play_oki_sound(const device_config *device, int game_sound, int data)
{
- int status = okim6295_status_0_r(space,0);
+ int status = okim6295_r(device,0);
logerror("Playing sample %02x from command %02x\n",game_sound,data);
if (game_sound != 0)
{
if ((status & 0x01) == 0) {
- okim6295_data_0_w(space,0,(0x80 | game_sound));
- okim6295_data_0_w(space,0,0x11);
+ okim6295_w(device,0,(0x80 | game_sound));
+ okim6295_w(device,0,0x11);
}
else if ((status & 0x02) == 0) {
- okim6295_data_0_w(space,0,(0x80 | game_sound));
- okim6295_data_0_w(space,0,0x21);
+ okim6295_w(device,0,(0x80 | game_sound));
+ okim6295_w(device,0,0x21);
}
else if ((status & 0x04) == 0) {
- okim6295_data_0_w(space,0,(0x80 | game_sound));
- okim6295_data_0_w(space,0,0x41);
+ okim6295_w(device,0,(0x80 | game_sound));
+ okim6295_w(device,0,0x41);
}
else if ((status & 0x08) == 0) {
- okim6295_data_0_w(space,0,(0x80 | game_sound));
- okim6295_data_0_w(space,0,0x81);
+ okim6295_w(device,0,(0x80 | game_sound));
+ okim6295_w(device,0,0x81);
}
}
}
-void dogyuun_okisnd_w(const address_space *space, int data)
+void dogyuun_okisnd_w(const device_config *device, int data)
{
/* Need a board to determine the sound commands */
// popmessage("Writing %04x to Sound CPU",data);
}
-void kbash_okisnd_w(const address_space *space, int data)
+void kbash_okisnd_w(const device_config *device, int data)
{
// popmessage("Writing %04x to Sound CPU",data);
if (data == 0)
{
- okim6295_data_0_w(space,0,0x78); /* Stop playing effects */
+ okim6295_w(device,0,0x78); /* Stop playing effects */
}
else if ((data > 0) && (data < 128))
{
- play_oki_sound(space, kbash_cmd_snd[data], data);
+ play_oki_sound(device, kbash_cmd_snd[data], data);
}
}
-void fixeight_okisnd_w(const address_space *space, int data)
+void fixeight_okisnd_w(const device_config *device, int data)
{
// popmessage("Writing %04x to Sound CPU",data);
if (data == 0)
{
- okim6295_data_0_w(space,0,0x78); /* Stop playing effects */
+ okim6295_w(device,0,0x78); /* Stop playing effects */
}
else if ((data > 0) && (data < 128))
{
- play_oki_sound(space, fixeight_cmd_snd[data], data);
+ play_oki_sound(device, fixeight_cmd_snd[data], data);
}
}
-void batsugun_okisnd_w(const address_space *space, int data)
+void batsugun_okisnd_w(const device_config *device, int data)
{
// popmessage("Writing %04x to Sound CPU",data);
if (data == 0)
{
- okim6295_data_0_w(space,0,0x78); /* Stop playing effects */
+ okim6295_w(device,0,0x78); /* Stop playing effects */
}
else if ((data > 0) && (data < 64))
{
- play_oki_sound(space, batsugun_cmd_snd[data], data);
+ play_oki_sound(device, batsugun_cmd_snd[data], data);
}
}
diff --git a/src/mame/audio/trackfld.c b/src/mame/audio/trackfld.c
index 990d95d063f..bfc41a61542 100644
--- a/src/mame/audio/trackfld.c
+++ b/src/mame/audio/trackfld.c
@@ -27,14 +27,14 @@ READ8_HANDLER( trackfld_sh_timer_r )
return clock & 0xF;
}
-READ8_HANDLER( trackfld_speech_r )
+READ8_DEVICE_HANDLER( trackfld_speech_r )
{
- return vlm5030_bsy() ? 0x10 : 0;
+ return vlm5030_bsy(device) ? 0x10 : 0;
}
static int last_addr = 0;
-WRITE8_HANDLER( trackfld_sound_w )
+WRITE8_DEVICE_HANDLER( trackfld_sound_w )
{
if( (offset & 0x07) == 0x03 )
{
@@ -45,10 +45,10 @@ WRITE8_HANDLER( trackfld_sound_w )
/* A8 VLM5030 ST pin */
if( changes & 0x100 )
- vlm5030_st( offset&0x100 );
+ vlm5030_st( device, offset&0x100 );
/* A9 VLM5030 RST pin */
if( changes & 0x200 )
- vlm5030_rst( offset&0x200 );
+ vlm5030_rst( device, offset&0x200 );
}
last_addr = offset;
}
@@ -57,10 +57,10 @@ READ8_HANDLER( hyperspt_sh_timer_r )
{
UINT32 clock = cpu_get_total_cycles(space->cpu) / TIMER_RATE;
- return (clock & 0x3) | (vlm5030_bsy()? 0x04 : 0);
+ return (clock & 0x3) | (vlm5030_bsy(devtag_get_device(space->machine, SOUND, "vlm"))? 0x04 : 0);
}
-WRITE8_HANDLER( hyperspt_sound_w )
+WRITE8_DEVICE_HANDLER( hyperspt_sound_w )
{
int changes = offset^last_addr;
/* A3 = data enable for VLM5030 (don't care ) */
@@ -72,10 +72,10 @@ WRITE8_HANDLER( hyperspt_sound_w )
/* A4 VLM5030 ST pin */
if( changes & 0x10 )
- vlm5030_st( offset&0x10 );
+ vlm5030_st( device, offset&0x10 );
/* A5 VLM5030 RST pin */
if( changes & 0x20 )
- vlm5030_rst( offset&0x20 );
+ vlm5030_rst( device, offset&0x20 );
last_addr = offset;
}
@@ -102,9 +102,9 @@ WRITE8_HANDLER( konami_SN76496_latch_w )
}
-WRITE8_HANDLER( konami_SN76496_0_w )
+WRITE8_DEVICE_HANDLER( konami_SN76496_w )
{
- sn76496_0_w(space, offset, SN76496_latch);
+ sn76496_w(device, offset, SN76496_latch);
}
diff --git a/src/mame/audio/turbo.c b/src/mame/audio/turbo.c
index 8915b8e7273..d8289e22147 100644
--- a/src/mame/audio/turbo.c
+++ b/src/mame/audio/turbo.c
@@ -19,19 +19,19 @@
*
*************************************/
-static void turbo_update_samples(turbo_state *state)
+static void turbo_update_samples(turbo_state *state, const device_config *samples)
{
/* accelerator sounds */
/* BSEL == 3 --> off */
/* BSEL == 2 --> standard */
/* BSEL == 1 --> tunnel */
/* BSEL == 0 --> ??? */
- if (state->turbo_bsel == 3 && sample_playing(5))
- sample_stop(5);
- else if (state->turbo_bsel != 3 && !sample_playing(5))
- sample_start(5, 7, TRUE);
- if (sample_playing(5))
- sample_set_freq(5, sample_get_base_freq(5) * ((state->turbo_accel & 0x3f) / 5.25 + 1));
+ if (state->turbo_bsel == 3 && sample_playing(samples, 5))
+ sample_stop(samples, 5);
+ else if (state->turbo_bsel != 3 && !sample_playing(samples, 5))
+ sample_start(samples, 5, 7, TRUE);
+ if (sample_playing(samples, 5))
+ sample_set_freq(samples, 5, sample_get_base_freq(samples, 5) * ((state->turbo_accel & 0x3f) / 5.25 + 1));
}
@@ -40,16 +40,17 @@ static int last_sound_a;
static TIMER_CALLBACK( update_sound_a )
{
+ const device_config *discrete = devtag_get_device(machine, SOUND, "discrete");
int data = param;
/* missing short crash sample, but I've never seen it triggered */
- discrete_sound_w(0, !(data & 0x01));
- discrete_sound_w(1, (data >> 1) & 1);
- discrete_sound_w(2, (data >> 2) & 1);
- discrete_sound_w(3, (data >> 3) & 1);
- discrete_sound_w(4, (data >> 4) & 1);
- discrete_sound_w(5, !(data & 0x20));
- discrete_sound_w(6, !(data & 0x40));
+ discrete_sound_w(discrete, 0, !(data & 0x01));
+ discrete_sound_w(discrete, 1, (data >> 1) & 1);
+ discrete_sound_w(discrete, 2, (data >> 2) & 1);
+ discrete_sound_w(discrete, 3, (data >> 3) & 1);
+ discrete_sound_w(discrete, 4, (data >> 4) & 1);
+ discrete_sound_w(discrete, 5, !(data & 0x20));
+ discrete_sound_w(discrete, 6, !(data & 0x40));
if (!((data >> 1) & 1)) mame_printf_debug("/TRIG1\n");
if (!((data >> 2) & 1)) mame_printf_debug("/TRIG2\n");
@@ -57,7 +58,7 @@ if (!((data >> 3) & 1)) mame_printf_debug("/TRIG3\n");
if (!((data >> 4) & 1)) mame_printf_debug("/TRIG4\n");
// osel = (osel & 6) | ((data >> 5) & 1);
-// turbo_update_samples();
+// turbo_update_samples(samples);
}
#endif
@@ -71,6 +72,7 @@ if (!((data >> 4) & 1)) mame_printf_debug("/TRIG4\n");
WRITE8_DEVICE_HANDLER( turbo_sound_a_w )
{
+ const device_config *samples = devtag_get_device(device->machine, SOUND, "samples");
turbo_state *state = device->machine->driver_data;
UINT8 diff = data ^ state->sound_state[0];
state->sound_state[0] = data;
@@ -78,31 +80,31 @@ WRITE8_DEVICE_HANDLER( turbo_sound_a_w )
#if (!DISCRETE_TEST)
/* /CRASH.S: channel 0 */
- if ((diff & 0x01) && !(data & 0x01)) sample_start(0, 5, FALSE);
+ if ((diff & 0x01) && !(data & 0x01)) sample_start(samples, 0, 5, FALSE);
/* /TRIG1: channel 1 */
- if ((diff & 0x02) && !(data & 0x02)) sample_start(1, 0, FALSE);
+ if ((diff & 0x02) && !(data & 0x02)) sample_start(samples, 1, 0, FALSE);
/* /TRIG2: channel 1 */
- if ((diff & 0x04) && !(data & 0x04)) sample_start(1, 1, FALSE);
+ if ((diff & 0x04) && !(data & 0x04)) sample_start(samples, 1, 1, FALSE);
/* /TRIG3: channel 1 */
- if ((diff & 0x08) && !(data & 0x08)) sample_start(1, 2, FALSE);
+ if ((diff & 0x08) && !(data & 0x08)) sample_start(samples, 1, 2, FALSE);
/* /TRIG4: channel 1 */
- if ((diff & 0x10) && !(data & 0x10)) sample_start(1, 3, FALSE);
+ if ((diff & 0x10) && !(data & 0x10)) sample_start(samples, 1, 3, FALSE);
/* OSEL0 */
state->turbo_osel = (state->turbo_osel & 6) | ((data >> 5) & 1);
/* /SLIP: channel 2 */
- if ((diff & 0x40) && !(data & 0x40)) sample_start(2, 4, FALSE);
+ if ((diff & 0x40) && !(data & 0x40)) sample_start(samples, 2, 4, FALSE);
/* /CRASH.L: channel 3 */
- if ((diff & 0x80) && !(data & 0x80)) sample_start(3, 5, FALSE);
+ if ((diff & 0x80) && !(data & 0x80)) sample_start(samples, 3, 5, FALSE);
/* update any samples */
- turbo_update_samples(state);
+ turbo_update_samples(state, samples);
#else
@@ -119,6 +121,7 @@ WRITE8_DEVICE_HANDLER( turbo_sound_a_w )
WRITE8_DEVICE_HANDLER( turbo_sound_b_w )
{
+ const device_config *samples = devtag_get_device(device->machine, SOUND, "samples");
turbo_state *state = device->machine->driver_data;
UINT8 diff = data ^ state->sound_state[1];
state->sound_state[1] = data;
@@ -128,19 +131,20 @@ WRITE8_DEVICE_HANDLER( turbo_sound_b_w )
output_set_value("tachometer", state->turbo_accel);
/* /AMBU: channel 4 */
- if ((diff & 0x40) && !(data & 0x40) && !sample_playing(4)) sample_start(4, 8, TRUE);
- if ((diff & 0x40) && (data & 0x40)) sample_stop(4);
+ if ((diff & 0x40) && !(data & 0x40) && !sample_playing(samples, 4)) sample_start(samples, 4, 8, TRUE);
+ if ((diff & 0x40) && (data & 0x40)) sample_stop(samples, 4);
/* /SPIN: channel 2 */
- if ((diff & 0x80) && !(data & 0x80)) sample_start(2, 6, FALSE);
+ if ((diff & 0x80) && !(data & 0x80)) sample_start(samples, 2, 6, FALSE);
/* update any samples */
- turbo_update_samples(state);
+ turbo_update_samples(state, samples);
}
WRITE8_DEVICE_HANDLER( turbo_sound_c_w )
{
+ const device_config *samples = devtag_get_device(device->machine, SOUND, "samples");
turbo_state *state = device->machine->driver_data;
/* OSEL1-2 */
@@ -153,7 +157,7 @@ WRITE8_DEVICE_HANDLER( turbo_sound_c_w )
output_set_value("speed", (data >> 4) & 0x0f);
/* update any samples */
- turbo_update_samples(state);
+ turbo_update_samples(state, samples);
}
@@ -299,7 +303,7 @@ WRITE8_DEVICE_HANDLER( subroc3d_sound_a_w )
}
-INLINE void subroc3d_update_volume(int leftchan, UINT8 dis, UINT8 dir)
+INLINE void subroc3d_update_volume(const device_config *samples, int leftchan, UINT8 dis, UINT8 dir)
{
float volume = (float)(15 - dis) / 16.0f;
float lvol, rvol;
@@ -314,13 +318,14 @@ INLINE void subroc3d_update_volume(int leftchan, UINT8 dis, UINT8 dir)
lvol = rvol = 0;
/* if the sample is playing, adjust it */
- sample_set_volume(leftchan + 0, lvol);
- sample_set_volume(leftchan + 1, rvol);
+ sample_set_volume(samples, leftchan + 0, lvol);
+ sample_set_volume(samples, leftchan + 1, rvol);
}
WRITE8_DEVICE_HANDLER( subroc3d_sound_b_w )
{
+ const device_config *samples = devtag_get_device(device->machine, SOUND, "samples");
turbo_state *state = device->machine->driver_data;
UINT8 diff = data ^ state->sound_state[1];
state->sound_state[1] = data;
@@ -330,12 +335,12 @@ WRITE8_DEVICE_HANDLER( subroc3d_sound_b_w )
{
state->subroc3d_mdis = state->sound_state[0] & 0x0f;
state->subroc3d_mdir = (state->sound_state[0] >> 4) & 0x07;
- if (!sample_playing(0))
+ if (!sample_playing(samples, 0))
{
- sample_start(0, 0, TRUE);
- sample_start(1, 0, TRUE);
+ sample_start(samples, 0, 0, TRUE);
+ sample_start(samples, 1, 0, TRUE);
}
- subroc3d_update_volume(0, state->subroc3d_mdis, state->subroc3d_mdir);
+ subroc3d_update_volume(samples, 0, state->subroc3d_mdis, state->subroc3d_mdir);
}
/* bit 1 latches direction/volume for torpedo */
@@ -343,12 +348,12 @@ WRITE8_DEVICE_HANDLER( subroc3d_sound_b_w )
{
state->subroc3d_tdis = state->sound_state[0] & 0x0f;
state->subroc3d_tdir = (state->sound_state[0] >> 4) & 0x07;
- if (!sample_playing(2))
+ if (!sample_playing(samples, 2))
{
- sample_start(2, 1, TRUE);
- sample_start(3, 1, TRUE);
+ sample_start(samples, 2, 1, TRUE);
+ sample_start(samples, 3, 1, TRUE);
}
- subroc3d_update_volume(2, state->subroc3d_tdis, state->subroc3d_tdir);
+ subroc3d_update_volume(samples, 2, state->subroc3d_tdis, state->subroc3d_tdir);
}
/* bit 2 latches direction/volume for fighter */
@@ -356,12 +361,12 @@ WRITE8_DEVICE_HANDLER( subroc3d_sound_b_w )
{
state->subroc3d_fdis = state->sound_state[0] & 0x0f;
state->subroc3d_fdir = (state->sound_state[0] >> 4) & 0x07;
- if (!sample_playing(4))
+ if (!sample_playing(samples, 4))
{
- sample_start(4, 2, TRUE);
- sample_start(5, 2, TRUE);
+ sample_start(samples, 4, 2, TRUE);
+ sample_start(samples, 5, 2, TRUE);
}
- subroc3d_update_volume(4, state->subroc3d_fdis, state->subroc3d_fdir);
+ subroc3d_update_volume(samples, 4, state->subroc3d_fdis, state->subroc3d_fdir);
}
/* bit 3 latches direction/volume for hit */
@@ -369,13 +374,14 @@ WRITE8_DEVICE_HANDLER( subroc3d_sound_b_w )
{
state->subroc3d_hdis = state->sound_state[0] & 0x0f;
state->subroc3d_hdir = (state->sound_state[0] >> 4) & 0x07;
- subroc3d_update_volume(6, state->subroc3d_hdis, state->subroc3d_hdir);
+ subroc3d_update_volume(samples, 6, state->subroc3d_hdis, state->subroc3d_hdir);
}
}
WRITE8_DEVICE_HANDLER( subroc3d_sound_c_w )
{
+ const device_config *samples = devtag_get_device(device->machine, SOUND, "samples");
turbo_state *state = device->machine->driver_data;
UINT8 diff = data ^ state->sound_state[2];
state->sound_state[2] = data;
@@ -383,28 +389,28 @@ WRITE8_DEVICE_HANDLER( subroc3d_sound_c_w )
/* /FIRE TRIG */
/* FIRE SELECT */
if ((diff & 0x01) && (data & 0x01))
- sample_start(8, (data & 0x02) ? 6 : 5, FALSE);
+ sample_start(samples, 8, (data & 0x02) ? 6 : 5, FALSE);
/* /SHIP EXP TRIG -> MY SHIP EXP: channel 9 */
if ((diff & 0x04) && (data & 0x04))
- sample_start(9, 7, FALSE);
+ sample_start(samples, 9, 7, FALSE);
/* /HIT TRIG -> HIT.L/R: channels 6+7 */
if ((diff & 0x08) && (data & 0x08))
{
- sample_start(6, (state->sound_state[0] & 0x80) ? 4 : 3, FALSE);
- sample_start(7, (state->sound_state[0] & 0x80) ? 4 : 3, FALSE);
+ sample_start(samples, 6, (state->sound_state[0] & 0x80) ? 4 : 3, FALSE);
+ sample_start(samples, 7, (state->sound_state[0] & 0x80) ? 4 : 3, FALSE);
}
/* /ALARM TRIG -> ALARM.M: channel 10 */
/* ALARM SELECT */
if ((diff & 0x10) && (data & 0x10))
- sample_start(10, (data & 0x20) ? 10 : 9, FALSE);
+ sample_start(samples, 10, (data & 0x20) ? 10 : 9, FALSE);
/* /PROLOGUE */
- if (!sample_playing(11))
- sample_start(11, 8, TRUE);
- sample_set_volume(11, (data & 0x40) ? 0 : 1.0);
+ if (!sample_playing(samples, 11))
+ sample_start(samples, 11, 8, TRUE);
+ sample_set_volume(samples, 11, (data & 0x40) ? 0 : 1.0);
/* /GAME START */
sound_global_enable(!(data & 0x80));
@@ -490,74 +496,76 @@ MACHINE_DRIVER_END
*
*************************************/
-static void buckrog_update_samples(turbo_state *state)
+static void buckrog_update_samples(turbo_state *state, const device_config *samples)
{
/* accelerator sounds */
- if (sample_playing(5))
- sample_set_freq(5, sample_get_base_freq(5) * (state->buckrog_myship / 100.25 + 1));
+ if (sample_playing(samples, 5))
+ sample_set_freq(samples, 5, sample_get_base_freq(samples, 5) * (state->buckrog_myship / 100.25 + 1));
}
WRITE8_DEVICE_HANDLER( buckrog_sound_a_w )
{
+ const device_config *samples = devtag_get_device(device->machine, SOUND, "samples");
turbo_state *state = device->machine->driver_data;
UINT8 diff = data ^ state->sound_state[0];
state->sound_state[0] = data;
/* clock HIT DIS from bits 0-2 */
if ((diff & 0x10) && (data & 0x10))
- sample_set_volume(3, (float)(/*7 - */(data & 7)) / 7.0f);
+ sample_set_volume(samples, 3, (float)(/*7 - */(data & 7)) / 7.0f);
/* clock ACC from bits 0-3 */
if ((diff & 0x20) && (data & 0x20))
{
state->buckrog_myship = data & 0x0f;
- buckrog_update_samples(state);
+ buckrog_update_samples(state, samples);
}
/* /ALARM0: channel 0 */
- if ((diff & 0x40) && !(data & 0x40)) sample_start(0, 0, FALSE);
+ if ((diff & 0x40) && !(data & 0x40)) sample_start(samples, 0, 0, FALSE);
/* /ALARM1: channel 0 */
- if ((diff & 0x80) && !(data & 0x80)) sample_start(0, 1, FALSE);
+ if ((diff & 0x80) && !(data & 0x80)) sample_start(samples, 0, 1, FALSE);
}
WRITE8_DEVICE_HANDLER( buckrog_sound_b_w )
{
+ const device_config *samples = devtag_get_device(device->machine, SOUND, "samples");
turbo_state *state = device->machine->driver_data;
UINT8 diff = data ^ state->sound_state[1];
state->sound_state[1] = data;
/* /ALARM3: channel 0 */
- if ((diff & 0x01) && !(data & 0x01)) sample_start(0, 2, FALSE);
+ if ((diff & 0x01) && !(data & 0x01)) sample_start(samples, 0, 2, FALSE);
/* /ALARM4: channel 0 */
- if ((diff & 0x02) && !(data & 0x02)) sample_start(0, 3, FALSE);
+ if ((diff & 0x02) && !(data & 0x02)) sample_start(samples, 0, 3, FALSE);
/* /FIRE: channel 1 */
- if ((diff & 0x04) && !(data & 0x04)) sample_start(1, 5, FALSE);
+ if ((diff & 0x04) && !(data & 0x04)) sample_start(samples, 1, 5, FALSE);
/* /EXP: channel 2 */
- if ((diff & 0x08) && !(data & 0x08)) sample_start(2, 4, FALSE);
+ if ((diff & 0x08) && !(data & 0x08)) sample_start(samples, 2, 4, FALSE);
/* /HIT: channel 3 */
if ((diff & 0x10) && !(data & 0x10))
{
- sample_start(3, 7, FALSE);
- buckrog_update_samples(state);
+ sample_start(samples, 3, 7, FALSE);
+ buckrog_update_samples(state, samples);
}
/* /REBOUND: channel 4 */
- if ((diff & 0x20) && !(data & 0x20)) sample_start(4, 6, FALSE);
+ if ((diff & 0x20) && !(data & 0x20)) sample_start(samples, 4, 6, FALSE);
/* SHIP: channel 5 */
- if ((diff & 0x40) && (data & 0x40) && !sample_playing(5))
+ if ((diff & 0x40) && (data & 0x40) && !sample_playing(samples, 5))
{
- sample_start(5, 8, TRUE);
- buckrog_update_samples(state);
+ sample_start(samples, 5, 8, TRUE);
+ buckrog_update_samples(state, samples);
}
- if ((diff & 0x40) && !(data & 0x40) && sample_playing(5)) sample_stop(5);
+ if ((diff & 0x40) && !(data & 0x40) && sample_playing(samples, 5)) sample_stop(samples, 5);
/* GAME ON */
sound_global_enable(data & 0x80);
diff --git a/src/mame/audio/tx1.c b/src/mame/audio/tx1.c
index ceec51bd03d..fdfc2dd452c 100644
--- a/src/mame/audio/tx1.c
+++ b/src/mame/audio/tx1.c
@@ -7,7 +7,6 @@
#include "driver.h"
#include "streams.h"
#include "sound/ay8910.h"
-#include "sound/custom.h"
#include "video/resnet.h"
#include "includes/tx1.h"
@@ -149,7 +148,7 @@ static int eng2[4];
***************************************************************************/
-WRITE8_HANDLER( tx1_ay8910_a_w )
+WRITE8_DEVICE_HANDLER( tx1_ay8910_a_w )
{
stream_update(stream);
@@ -157,7 +156,7 @@ WRITE8_HANDLER( tx1_ay8910_a_w )
ay_outputa = ~data;
}
-WRITE8_HANDLER( tx1_ay8910_b_w )
+WRITE8_DEVICE_HANDLER( tx1_ay8910_b_w )
{
double gain;
@@ -167,9 +166,9 @@ WRITE8_HANDLER( tx1_ay8910_b_w )
/* It'll do until we get quadrophonic speaker support! */
gain = BIT(ay_outputb, 4) ? 1.5 : 2.0;
- sndti_set_output_gain(SOUND_AY8910, 0, 0, gain);
- sndti_set_output_gain(SOUND_AY8910, 0, 1, gain);
- sndti_set_output_gain(SOUND_AY8910, 0, 2, gain);
+ sound_set_output_gain(device, 0, gain);
+ sound_set_output_gain(device, 1, gain);
+ sound_set_output_gain(device, 2, gain);
}
/***************************************************************************
@@ -271,7 +270,7 @@ static STREAM_UPDATE( tx1_stream_update )
}
-CUSTOM_START( tx1_sh_start )
+static DEVICE_START( tx1_sound )
{
running_machine *machine = device->machine;
static const int r0[4] = { 390e3, 180e3, 180e3, 180e3 };
@@ -288,15 +287,28 @@ CUSTOM_START( tx1_sh_start )
4, &r0[0], weights0, 0, 0,
3, &r1[0], weights1, 0, 0,
3, &r2[0], weights2, 0, 0);
-
- return auto_malloc(1);
}
-CUSTOM_RESET( tx1_sh_reset )
+static DEVICE_RESET( tx1_sound )
{
step0 = step1 = step2 = 0;
}
+DEVICE_GET_INFO( tx1_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(tx1_sound); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(tx1_sound); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "TX-1 Custom"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
+}
+
+
/*************************************
*
* Buggy Boy
@@ -386,27 +398,29 @@ static const double bb_engine_gains[16] =
***************************************************************************/
-WRITE8_HANDLER( bb_ym1_a_w )
+WRITE8_DEVICE_HANDLER( bb_ym1_a_w )
{
stream_update(stream);
ym1_outputa = data ^ 0xff;
}
-WRITE8_HANDLER( bb_ym2_a_w )
+WRITE8_DEVICE_HANDLER( bb_ym2_a_w )
{
stream_update(stream);
ym2_outputa = data ^ 0xff;
}
-WRITE8_HANDLER( bb_ym2_b_w )
+WRITE8_DEVICE_HANDLER( bb_ym2_b_w )
{
+ const device_config *ay1 = devtag_get_device(device->machine, SOUND, "ay1");
+ const device_config *ay2 = devtag_get_device(device->machine, SOUND, "ay2");
double gain;
stream_update(stream);
ym2_outputb = data ^ 0xff;
- if (!strcmp(space->machine->gamedrv->name, "buggybjr"))
+ if (!strcmp(device->machine->gamedrv->name, "buggybjr"))
{
coin_counter_w(0, data & 0x01);
coin_counter_w(1, data & 0x02);
@@ -416,15 +430,15 @@ WRITE8_HANDLER( bb_ym2_b_w )
/* Rear left speaker */
gain = data & 0x80 ? 1.0 : 2.0;
- sndti_set_output_gain(SOUND_AY8910, 0, 0, gain);
- sndti_set_output_gain(SOUND_AY8910, 0, 1, gain);
- sndti_set_output_gain(SOUND_AY8910, 0, 2, gain);
+ sound_set_output_gain(ay1, 0, gain);
+ sound_set_output_gain(ay1, 1, gain);
+ sound_set_output_gain(ay1, 2, gain);
/* Rear right speaker */
gain = data & 0x40 ? 1.0 : 2.0;
- sndti_set_output_gain(SOUND_AY8910, 1, 0, gain);
- sndti_set_output_gain(SOUND_AY8910, 1, 1, gain);
- sndti_set_output_gain(SOUND_AY8910, 1, 2, gain);
+ sound_set_output_gain(ay2, 0, gain);
+ sound_set_output_gain(ay2, 1, gain);
+ sound_set_output_gain(ay2, 2, gain);
}
/* This is admittedly a bit of a hack job... */
@@ -507,7 +521,7 @@ static STREAM_UPDATE( buggyboy_stream_update )
}
}
-CUSTOM_START( buggyboy_sh_start )
+static DEVICE_START( buggyboy_sound )
{
running_machine *machine = device->machine;
static const int resistors[4] = { 330000, 220000, 330000, 220000 };
@@ -529,11 +543,9 @@ CUSTOM_START( buggyboy_sh_start )
/* Allocate the stream */
stream = stream_create(device, 0, 2, machine->sample_rate, NULL, buggyboy_stream_update);
freq_to_step = (double)(1 << 24) / (double)machine->sample_rate;
-
- return auto_malloc(1);
}
-CUSTOM_RESET( buggyboy_sh_reset )
+static DEVICE_RESET( buggyboy_sound )
{
step0 = step1 = 0;
@@ -543,3 +555,19 @@ CUSTOM_RESET( buggyboy_sh_reset )
noise_lfsrc = 0;
noise_lfsrd = 0;
}
+
+DEVICE_GET_INFO( buggyboy_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(buggyboy_sound); break;
+ case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(buggyboy_sound); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Buggy Boy Custom"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
+}
+
+
diff --git a/src/mame/audio/vicdual.c b/src/mame/audio/vicdual.c
index 1b4ffb2a9db..0b5abd1c80a 100644
--- a/src/mame/audio/vicdual.c
+++ b/src/mame/audio/vicdual.c
@@ -132,7 +132,8 @@ MACHINE_DRIVER_END
static TIMER_CALLBACK( frogs_croak_callback )
{
- sample_stop(2);
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
+ sample_stop(samples, 2);
}
@@ -144,24 +145,26 @@ MACHINE_START( frogs_audio )
WRITE8_HANDLER( frogs_audio_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND_SAMPLES, "samples");
+ const device_config *discrete = devtag_get_device(space->machine, SOUND_SAMPLES, "discrete");
static int last_croak = 0;
static int last_buzzz = 0;
int new_croak = data & 0x08;
int new_buzzz = data & 0x10;
-// discrete_sound_w(space, FROGS_HOP_EN, data & 0x01);
-// discrete_sound_w(space, FROGS_JUMP_EN, data & 0x02);
- discrete_sound_w(space, FROGS_TONGUE_EN, data & 0x04);
-// discrete_sound_w(space, FROGS_CAPTURE_EN, data & 0x08);
-// discrete_sound_w(space, FROGS_FLY_EN, data & 0x10);
-// discrete_sound_w(space, FROGS_SPLASH_EN, data & 0x80);
+// discrete_sound_w(discrete, FROGS_HOP_EN, data & 0x01);
+// discrete_sound_w(discrete, FROGS_JUMP_EN, data & 0x02);
+ discrete_sound_w(discrete, FROGS_TONGUE_EN, data & 0x04);
+// discrete_sound_w(discrete, FROGS_CAPTURE_EN, data & 0x08);
+// discrete_sound_w(discrete, FROGS_FLY_EN, data & 0x10);
+// discrete_sound_w(discrete, FROGS_SPLASH_EN, data & 0x80);
if (data & 0x01)
- sample_start (3, 3, 0); // Hop
+ sample_start (samples, 3, 3, 0); // Hop
if (data & 0x02)
- sample_start (0, 0, 0); // Boing
+ sample_start (samples, 0, 0, 0); // Boing
if (new_croak)
- sample_start (2, 2, 0); // Croak
+ sample_start (samples, 2, 2, 0); // Croak
else
{
if (last_croak)
@@ -184,12 +187,12 @@ WRITE8_HANDLER( frogs_audio_w )
* 12 seconds.
*/
if (!last_buzzz)
- sample_start (1, 1, 1); // Buzzz
+ sample_start (samples, 1, 1, 1); // Buzzz
}
else
- sample_stop(1);
+ sample_stop(samples, 1);
if (data & 0x80)
- sample_start (4, 4, 0); // Splash
+ sample_start (samples, 4, 4, 0); // Splash
last_croak = new_croak;
last_buzzz = new_buzzz;
@@ -459,29 +462,31 @@ MACHINE_DRIVER_END
WRITE8_HANDLER( headon_audio_w )
{
- if (!sndti_exists(SOUND_DISCRETE, 0))
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+ if (discrete == NULL)
return;
- discrete_sound_w(space, HEADON_HISPEED_PC_EN, data & 0x01);
- discrete_sound_w(space, HEADON_SCREECH1_EN, data & 0x02);
- discrete_sound_w(space, HEADON_CRASH_EN, data & 0x04);
- discrete_sound_w(space, HEADON_HISPEED_CC_EN, data & 0x08);
- discrete_sound_w(space, HEADON_SCREECH2_EN, data & 0x10);
- discrete_sound_w(space, HEADON_BONUS_EN, data & 0x20);
- discrete_sound_w(space, HEADON_CAR_ON_EN, data & 0x40);
+ discrete_sound_w(discrete, HEADON_HISPEED_PC_EN, data & 0x01);
+ discrete_sound_w(discrete, HEADON_SCREECH1_EN, data & 0x02);
+ discrete_sound_w(discrete, HEADON_CRASH_EN, data & 0x04);
+ discrete_sound_w(discrete, HEADON_HISPEED_CC_EN, data & 0x08);
+ discrete_sound_w(discrete, HEADON_SCREECH2_EN, data & 0x10);
+ discrete_sound_w(discrete, HEADON_BONUS_EN, data & 0x20);
+ discrete_sound_w(discrete, HEADON_CAR_ON_EN, data & 0x40);
}
WRITE8_HANDLER( invho2_audio_w )
{
- if (!sndti_exists(SOUND_DISCRETE, 0))
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+ if (discrete == NULL)
return;
- discrete_sound_w(space, HEADON_HISPEED_PC_EN, data & 0x10);
- discrete_sound_w(space, HEADON_SCREECH1_EN, data & 0x08);
- discrete_sound_w(space, HEADON_CRASH_EN, data & 0x80);
- discrete_sound_w(space, HEADON_HISPEED_CC_EN, data & 0x40);
- discrete_sound_w(space, HEADON_SCREECH2_EN, data & 0x04);
- discrete_sound_w(space, HEADON_BONUS_EN, data & 0x02);
- discrete_sound_w(space, HEADON_CAR_ON_EN, data & 0x20);
+ discrete_sound_w(discrete, HEADON_HISPEED_PC_EN, data & 0x10);
+ discrete_sound_w(discrete, HEADON_SCREECH1_EN, data & 0x08);
+ discrete_sound_w(discrete, HEADON_CRASH_EN, data & 0x80);
+ discrete_sound_w(discrete, HEADON_HISPEED_CC_EN, data & 0x40);
+ discrete_sound_w(discrete, HEADON_SCREECH2_EN, data & 0x04);
+ discrete_sound_w(discrete, HEADON_BONUS_EN, data & 0x02);
+ discrete_sound_w(discrete, HEADON_CAR_ON_EN, data & 0x20);
}
diff --git a/src/mame/audio/warpwarp.c b/src/mame/audio/warpwarp.c
index 5030c4722e5..95014f1b2be 100644
--- a/src/mame/audio/warpwarp.c
+++ b/src/mame/audio/warpwarp.c
@@ -10,7 +10,6 @@
#include <math.h>
#include "driver.h"
#include "streams.h"
-#include "sound/custom.h"
#include "includes/warpwarp.h"
#define CLOCK_16H (18432000/3/2/16)
@@ -204,7 +203,7 @@ static STREAM_UPDATE( warpwarp_sound_update )
}
}
-CUSTOM_START( warpwarp_sh_start )
+static DEVICE_START( warpwarp_sound )
{
running_machine *machine = device->machine;
int i;
@@ -218,5 +217,20 @@ CUSTOM_START( warpwarp_sh_start )
sound_volume_timer = timer_alloc(machine, sound_volume_decay, NULL);
music_volume_timer = timer_alloc(machine, music_volume_decay, NULL);
- return auto_malloc(1);
}
+
+
+DEVICE_GET_INFO( warpwarp_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(warpwarp_sound); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Warp Warp Custom"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
+}
+
+
diff --git a/src/mame/audio/williams.c b/src/mame/audio/williams.c
index f63c9d1ccad..00edee14db5 100644
--- a/src/mame/audio/williams.c
+++ b/src/mame/audio/williams.c
@@ -64,8 +64,8 @@ static UINT8 williams_pianum;
static void init_audio_state(running_machine *machine);
-static void cvsd_ym2151_irq(running_machine *machine, int state);
-static void adpcm_ym2151_irq(running_machine *machine, int state);
+static void cvsd_ym2151_irq(const device_config *device, int state);
+static void adpcm_ym2151_irq(const device_config *device, int state);
static void cvsd_irqa(running_machine *machine, int state);
static void cvsd_irqb(running_machine *machine, int state);
@@ -73,10 +73,12 @@ static WRITE8_HANDLER( cvsd_bank_select_w );
static READ8_HANDLER( cvsd_pia_r );
static WRITE8_HANDLER( cvsd_pia_w );
static WRITE8_HANDLER( cvsd_talkback_w );
+static WRITE8_DEVICE_HANDLER( cvsd_digit_clock_clear_w );
+static WRITE8_DEVICE_HANDLER( cvsd_clock_set_w );
static READ8_HANDLER( adpcm_command_r );
static WRITE8_HANDLER( adpcm_bank_select_w );
-static WRITE8_HANDLER( adpcm_6295_bank_select_w );
+static WRITE8_DEVICE_HANDLER( adpcm_6295_bank_select_w );
static WRITE8_HANDLER( adpcm_talkback_w );
static READ8_HANDLER( narc_command_r );
@@ -98,11 +100,10 @@ static WRITE8_HANDLER( narc_slave_sync_w );
/* CVSD readmem/writemem structures */
static ADDRESS_MAP_START( williams_cvsd_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x1800) AM_RAM
- AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x1ffe) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x1ffe) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x2000, 0x2001) AM_MIRROR(0x1ffe) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x4000, 0x4003) AM_MIRROR(0x1ffc) AM_READWRITE(cvsd_pia_r, cvsd_pia_w)
- AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x07ff) AM_WRITE(hc55516_0_digit_clock_clear_w)
- AM_RANGE(0x6800, 0x6800) AM_MIRROR(0x07ff) AM_WRITE(hc55516_0_clock_set_w)
+ AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x07ff) AM_DEVWRITE(SOUND, "cvsd", cvsd_digit_clock_clear_w)
+ AM_RANGE(0x6800, 0x6800) AM_MIRROR(0x07ff) AM_DEVWRITE(SOUND, "cvsd", cvsd_clock_set_w)
AM_RANGE(0x7800, 0x7800) AM_MIRROR(0x07ff) AM_WRITE(cvsd_bank_select_w)
AM_RANGE(0x8000, 0xffff) AM_ROMBANK(5)
ADDRESS_MAP_END
@@ -111,11 +112,10 @@ ADDRESS_MAP_END
/* NARC master readmem/writemem structures */
static ADDRESS_MAP_START( williams_narc_master_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_RAM
- AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x03fe) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x03fe) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x2000, 0x2001) AM_MIRROR(0x03fe) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x2800, 0x2800) AM_MIRROR(0x03ff) AM_WRITE(narc_master_talkback_w)
AM_RANGE(0x2c00, 0x2c00) AM_MIRROR(0x03ff) AM_WRITE(narc_command2_w)
- AM_RANGE(0x3000, 0x3000) AM_MIRROR(0x03ff) AM_WRITE(dac_0_data_w)
+ AM_RANGE(0x3000, 0x3000) AM_MIRROR(0x03ff) AM_DEVWRITE(SOUND, "dac1", dac_w)
AM_RANGE(0x3400, 0x3400) AM_MIRROR(0x03ff) AM_READ(narc_command_r)
AM_RANGE(0x3800, 0x3800) AM_MIRROR(0x03ff) AM_WRITE(narc_master_bank_select_w)
AM_RANGE(0x3c00, 0x3c00) AM_MIRROR(0x03ff) AM_WRITE(narc_master_sync_w)
@@ -126,10 +126,10 @@ ADDRESS_MAP_END
/* NARC slave readmem/writemem structures */
static ADDRESS_MAP_START( williams_narc_slave_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_RAM
- AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x03ff) AM_WRITE(hc55516_0_clock_set_w)
- AM_RANGE(0x2400, 0x2400) AM_MIRROR(0x03ff) AM_WRITE(hc55516_0_digit_clock_clear_w)
+ AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x03ff) AM_DEVWRITE(SOUND, "cvsd", cvsd_clock_set_w)
+ AM_RANGE(0x2400, 0x2400) AM_MIRROR(0x03ff) AM_DEVWRITE(SOUND, "cvsd", cvsd_digit_clock_clear_w)
AM_RANGE(0x2800, 0x2800) AM_MIRROR(0x03ff) AM_WRITE(narc_slave_talkback_w)
- AM_RANGE(0x3000, 0x3000) AM_MIRROR(0x03ff) AM_WRITE(dac_1_data_w)
+ AM_RANGE(0x3000, 0x3000) AM_MIRROR(0x03ff) AM_DEVWRITE(SOUND, "dac2", dac_w)
AM_RANGE(0x3400, 0x3400) AM_MIRROR(0x03ff) AM_READ(narc_command2_r)
AM_RANGE(0x3800, 0x3800) AM_MIRROR(0x03ff) AM_WRITE(narc_slave_bank_select_w)
AM_RANGE(0x3c00, 0x3c00) AM_MIRROR(0x03ff) AM_WRITE(narc_slave_sync_w)
@@ -142,12 +142,11 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( williams_adpcm_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_RAM
AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x03ff) AM_WRITE(adpcm_bank_select_w)
- AM_RANGE(0x2400, 0x2400) AM_MIRROR(0x03fe) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x2401, 0x2401) AM_MIRROR(0x03fe) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
- AM_RANGE(0x2800, 0x2800) AM_MIRROR(0x03ff) AM_WRITE(dac_0_data_w)
- AM_RANGE(0x2c00, 0x2c00) AM_MIRROR(0x03ff) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x2400, 0x2401) AM_MIRROR(0x03fe) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0x2800, 0x2800) AM_MIRROR(0x03ff) AM_DEVWRITE(SOUND, "dac", dac_w)
+ AM_RANGE(0x2c00, 0x2c00) AM_MIRROR(0x03ff) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0x3000, 0x3000) AM_MIRROR(0x03ff) AM_READ(adpcm_command_r)
- AM_RANGE(0x3400, 0x3400) AM_MIRROR(0x03ff) AM_WRITE(adpcm_6295_bank_select_w)
+ AM_RANGE(0x3400, 0x3400) AM_MIRROR(0x03ff) AM_DEVWRITE(SOUND, "oki", adpcm_6295_bank_select_w)
AM_RANGE(0x3c00, 0x3c00) AM_MIRROR(0x03ff) AM_WRITE(adpcm_talkback_w)
AM_RANGE(0x4000, 0xbfff) AM_ROMBANK(5)
AM_RANGE(0xc000, 0xffff) AM_ROMBANK(6)
@@ -156,6 +155,11 @@ ADDRESS_MAP_END
/* PIA structure */
+static WRITE8_HANDLER( dac_0_data_w )
+{
+ dac_data_w(devtag_get_device(space->machine, SOUND, "dac"), data);
+}
+
static const pia6821_interface cvsd_pia_intf =
{
/*inputs : A/B,CA/B1,CA/B2 */ 0, 0, 0, 0, 0, 0,
@@ -379,7 +383,7 @@ void williams_adpcm_init(running_machine *machine)
static void init_audio_state(running_machine *machine)
{
/* reset the YM2151 state */
- sndti_reset(SOUND_YM2151, 0);
+ devtag_reset(machine, SOUND, "ym");
/* clear all the interrupts */
williams_sound_int_state = 0;
@@ -403,7 +407,7 @@ static void init_audio_state(running_machine *machine)
CVSD IRQ GENERATION CALLBACKS
****************************************************************************/
-static void cvsd_ym2151_irq(running_machine *machine, int state)
+static void cvsd_ym2151_irq(const device_config *device, int state)
{
pia_set_input_ca1(williams_pianum, !state);
}
@@ -426,7 +430,7 @@ static void cvsd_irqb(running_machine *machine, int state)
ADPCM IRQ GENERATION CALLBACKS
****************************************************************************/
-static void adpcm_ym2151_irq(running_machine *machine, int state)
+static void adpcm_ym2151_irq(const device_config *device, int state)
{
cpu_set_input_line(sound_cpu, M6809_FIRQ_LINE, state ? ASSERT_LINE : CLEAR_LINE);
}
@@ -462,6 +466,18 @@ static WRITE8_HANDLER( cvsd_talkback_w )
}
+static WRITE8_DEVICE_HANDLER( cvsd_digit_clock_clear_w )
+{
+ hc55516_digit_w(device, data);
+ hc55516_clock_w(device, 0);
+}
+
+
+static WRITE8_DEVICE_HANDLER( cvsd_clock_set_w )
+{
+ hc55516_clock_w(device, 1);
+}
+
/***************************************************************************
CVSD COMMUNICATIONS
@@ -628,9 +644,9 @@ static WRITE8_HANDLER( adpcm_bank_select_w )
}
-static WRITE8_HANDLER( adpcm_6295_bank_select_w )
+static WRITE8_DEVICE_HANDLER( adpcm_6295_bank_select_w )
{
- okim6295_set_bank_base(0, (data & 7) * 0x40000);
+ okim6295_set_bank_base(device, (data & 7) * 0x40000);
}
diff --git a/src/mame/audio/wiping.c b/src/mame/audio/wiping.c
index 504d274cd27..5c4ee7feabb 100644
--- a/src/mame/audio/wiping.c
+++ b/src/mame/audio/wiping.c
@@ -8,7 +8,6 @@
#include "driver.h"
#include "streams.h"
-#include "sound/custom.h"
/* 8 voices max */
@@ -53,7 +52,7 @@ static short *mixer_buffer_2;
/* build a table to divide by the number of voices; gain is specified as gain*16 */
-static int make_mixer_table(int voices, int gain)
+static void make_mixer_table(int voices, int gain)
{
int count = voices * 128;
int i;
@@ -72,8 +71,6 @@ static int make_mixer_table(int voices, int gain)
mixer_lookup[ i] = val;
mixer_lookup[-i] = -val;
}
-
- return 0;
}
@@ -161,7 +158,7 @@ static STREAM_UPDATE( wiping_update_mono )
-CUSTOM_START( wiping_sh_start )
+static DEVICE_START( wiping_sound )
{
running_machine *machine = device->machine;
sound_channel *voice;
@@ -174,8 +171,7 @@ CUSTOM_START( wiping_sh_start )
mixer_buffer_2 = mixer_buffer + samplerate;
/* build the mixer table */
- if (make_mixer_table(8, defgain))
- return NULL;
+ make_mixer_table(8, defgain);
/* extract globals from the interface */
num_voices = 8;
@@ -195,8 +191,20 @@ CUSTOM_START( wiping_sh_start )
voice->wave = &sound_prom[0];
voice->counter = 0;
}
+}
- return auto_malloc(1);
+
+DEVICE_GET_INFO( wiping_sound )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(wiping_sound); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Wiping Custom"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
}
diff --git a/src/mame/audio/wow.c b/src/mame/audio/wow.c
index c968cc169cd..ad35a0a1fac 100644
--- a/src/mame/audio/wow.c
+++ b/src/mame/audio/wow.c
@@ -21,7 +21,6 @@ wow_sh_ update- Null
#include "driver.h"
#include "cpu/z80/z80.h"
#include "sound/samples.h"
-#include "sound/custom.h"
#include "includes/astrocde.h"
@@ -109,6 +108,7 @@ static int plural;
READ8_HANDLER( wow_speech_r )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
int Phoneme,Intonation;
int i = 0;
@@ -123,7 +123,7 @@ READ8_HANDLER( wow_speech_r )
// logerror("Data : %d Speech : %s at intonation %d\n",Phoneme, PhonemeTable[Phoneme],Intonation);
if(Phoneme==63) {
- sample_stop(0);
+ sample_stop(samples, 0);
// logerror("Clearing sample %s\n",totalword);
totalword[0] = 0; /* Clear the total word stack */
return data;
@@ -138,8 +138,8 @@ READ8_HANDLER( wow_speech_r )
if (plural != 0) {
// logerror("found a possible plural at %d\n",plural-1);
if (!strcmp("S",totalword)) { /* Plural check */
- sample_start(0, num_samples-2, 0); /* play the sample at position of word */
- sample_set_freq(0, 11025); /* play at correct rate */
+ sample_start(samples, 0, num_samples-2, 0); /* play the sample at position of word */
+ sample_set_freq(samples, 0, 11025); /* play at correct rate */
totalword[0] = 0; /* Clear the total word stack */
oldword[0] = 0; /* Clear the total word stack */
return data;
@@ -162,8 +162,8 @@ READ8_HANDLER( wow_speech_r )
} else {
plural=0;
}
- sample_start(0, i, 0); /* play the sample at position of word */
- sample_set_freq(0, 11025); /* play at correct rate */
+ sample_start(samples, 0, i, 0); /* play the sample at position of word */
+ sample_set_freq(samples, 0, 11025); /* play at correct rate */
// logerror("Playing sample %d\n",i);
totalword[0] = 0; /* Clear the total word stack */
return data;
@@ -177,5 +177,6 @@ READ8_HANDLER( wow_speech_r )
CUSTOM_INPUT( wow_speech_status_r )
{
- return !sample_playing(0);
+ const device_config *samples = devtag_get_device(field->port->machine, SOUND, "samples");
+ return !sample_playing(samples, 0);
}
diff --git a/src/mame/audio/zaxxon.c b/src/mame/audio/zaxxon.c
index 1eb0694a4c6..44261f47258 100644
--- a/src/mame/audio/zaxxon.c
+++ b/src/mame/audio/zaxxon.c
@@ -123,67 +123,70 @@ MACHINE_DRIVER_END
WRITE8_DEVICE_HANDLER( zaxxon_sound_a_w )
{
+ const device_config *samples = devtag_get_device(device->machine, SOUND, "samples");
UINT8 diff = data ^ sound_state[0];
sound_state[0] = data;
/* PLAYER SHIP A/B: volume */
- sample_set_volume(10, 0.5 + 0.157 * (data & 0x03));
- sample_set_volume(11, 0.5 + 0.157 * (data & 0x03));
+ sample_set_volume(samples, 10, 0.5 + 0.157 * (data & 0x03));
+ sample_set_volume(samples, 11, 0.5 + 0.157 * (data & 0x03));
/* PLAYER SHIP C: channel 10 */
- if ((diff & 0x04) && !(data & 0x04)) sample_start(10, 10, TRUE);
- if ((diff & 0x04) && (data & 0x04)) sample_stop(10);
+ if ((diff & 0x04) && !(data & 0x04)) sample_start(samples, 10, 10, TRUE);
+ if ((diff & 0x04) && (data & 0x04)) sample_stop(samples, 10);
/* PLAYER SHIP D: channel 11 */
- if ((diff & 0x08) && !(data & 0x08)) sample_start(11, 11, TRUE);
- if ((diff & 0x08) && (data & 0x08)) sample_stop(11);
+ if ((diff & 0x08) && !(data & 0x08)) sample_start(samples, 11, 11, TRUE);
+ if ((diff & 0x08) && (data & 0x08)) sample_stop(samples, 11);
/* HOMING MISSILE: channel 0 */
- if ((diff & 0x10) && !(data & 0x10)) sample_start(0, 0, TRUE);
- if ((diff & 0x10) && (data & 0x10)) sample_stop(0);
+ if ((diff & 0x10) && !(data & 0x10)) sample_start(samples, 0, 0, TRUE);
+ if ((diff & 0x10) && (data & 0x10)) sample_stop(samples, 0);
/* BASE MISSILE: channel 1 */
- if ((diff & 0x20) && !(data & 0x20)) sample_start(1, 1, FALSE);
+ if ((diff & 0x20) && !(data & 0x20)) sample_start(samples, 1, 1, FALSE);
/* LASER: channel 2 */
- if ((diff & 0x40) && !(data & 0x40)) sample_start(2, 2, TRUE);
- if ((diff & 0x40) && (data & 0x40)) sample_stop(2);
+ if ((diff & 0x40) && !(data & 0x40)) sample_start(samples, 2, 2, TRUE);
+ if ((diff & 0x40) && (data & 0x40)) sample_stop(samples, 2);
/* BATTLESHIP: channel 3 */
- if ((diff & 0x80) && !(data & 0x80)) sample_start(3, 3, TRUE);
- if ((diff & 0x80) && (data & 0x80)) sample_stop(3);
+ if ((diff & 0x80) && !(data & 0x80)) sample_start(samples, 3, 3, TRUE);
+ if ((diff & 0x80) && (data & 0x80)) sample_stop(samples, 3);
}
WRITE8_DEVICE_HANDLER( zaxxon_sound_b_w )
{
+ const device_config *samples = devtag_get_device(device->machine, SOUND, "samples");
UINT8 diff = data ^ sound_state[1];
sound_state[1] = data;
/* S-EXP: channel 4 */
- if ((diff & 0x10) && !(data & 0x10)) sample_start(4, 4, FALSE);
+ if ((diff & 0x10) && !(data & 0x10)) sample_start(samples, 4, 4, FALSE);
/* M-EXP: channel 5 */
- if ((diff & 0x20) && !(data & 0x20) && !sample_playing(5)) sample_start(5, 5, FALSE);
+ if ((diff & 0x20) && !(data & 0x20) && !sample_playing(samples, 5)) sample_start(samples, 5, 5, FALSE);
/* CANNON: channel 6 */
- if ((diff & 0x80) && !(data & 0x80)) sample_start(6, 6, FALSE);
+ if ((diff & 0x80) && !(data & 0x80)) sample_start(samples, 6, 6, FALSE);
}
WRITE8_DEVICE_HANDLER( zaxxon_sound_c_w )
{
+ const device_config *samples = devtag_get_device(device->machine, SOUND, "samples");
UINT8 diff = data ^ sound_state[2];
sound_state[2] = data;
/* SHOT: channel 7 */
- if ((diff & 0x01) && !(data & 0x01)) sample_start(7, 7, FALSE);
+ if ((diff & 0x01) && !(data & 0x01)) sample_start(samples, 7, 7, FALSE);
/* ALARM2: channel 8 */
- if ((diff & 0x04) && !(data & 0x04)) sample_start(8, 8, FALSE);
+ if ((diff & 0x04) && !(data & 0x04)) sample_start(samples, 8, 8, FALSE);
/* ALARM3: channel 9 */
- if ((diff & 0x08) && !(data & 0x08) && !sample_playing(9)) sample_start(9, 9, FALSE);
+ if ((diff & 0x08) && !(data & 0x08) && !sample_playing(samples, 9)) sample_start(samples, 9, 9, FALSE);
}
@@ -229,34 +232,36 @@ MACHINE_DRIVER_END
WRITE8_DEVICE_HANDLER( congo_sound_b_w )
{
+ const device_config *samples = devtag_get_device(device->machine, SOUND, "samples");
UINT8 diff = data ^ sound_state[1];
sound_state[1] = data;
/* bit 7 = mute */
/* GORILLA: channel 0 */
- if ((diff & 0x02) && !(data & 0x02) && !sample_playing(0)) sample_start(0, 0, FALSE);
+ if ((diff & 0x02) && !(data & 0x02) && !sample_playing(samples, 0)) sample_start(samples, 0, 0, FALSE);
}
WRITE8_DEVICE_HANDLER( congo_sound_c_w )
{
+ const device_config *samples = devtag_get_device(device->machine, SOUND, "samples");
UINT8 diff = data ^ sound_state[2];
sound_state[2] = data;
/* BASS DRUM: channel 1 */
- if ((diff & 0x01) && !(data & 0x01)) sample_start(1, 1, FALSE);
- if ((diff & 0x01) && (data & 0x01)) sample_stop(1);
+ if ((diff & 0x01) && !(data & 0x01)) sample_start(samples, 1, 1, FALSE);
+ if ((diff & 0x01) && (data & 0x01)) sample_stop(samples, 1);
/* CONGA (LOW): channel 2 */
- if ((diff & 0x02) && !(data & 0x02)) sample_start(2, 2, FALSE);
- if ((diff & 0x02) && (data & 0x02)) sample_stop(2);
+ if ((diff & 0x02) && !(data & 0x02)) sample_start(samples, 2, 2, FALSE);
+ if ((diff & 0x02) && (data & 0x02)) sample_stop(samples, 2);
/* CONGA (HIGH): channel 3 */
- if ((diff & 0x04) && !(data & 0x04)) sample_start(3, 3, FALSE);
- if ((diff & 0x04) && (data & 0x04)) sample_stop(3);
+ if ((diff & 0x04) && !(data & 0x04)) sample_start(samples, 3, 3, FALSE);
+ if ((diff & 0x04) && (data & 0x04)) sample_stop(samples, 3);
/* RIM: channel 4 */
- if ((diff & 0x08) && !(data & 0x08)) sample_start(4, 4, FALSE);
- if ((diff & 0x08) && (data & 0x08)) sample_stop(4);
+ if ((diff & 0x08) && !(data & 0x08)) sample_start(samples, 4, 4, FALSE);
+ if ((diff & 0x08) && (data & 0x08)) sample_stop(samples, 4);
}
diff --git a/src/mame/drivers/1942.c b/src/mame/drivers/1942.c
index 6cce86778d4..24ad2b49a91 100644
--- a/src/mame/drivers/1942.c
+++ b/src/mame/drivers/1942.c
@@ -138,10 +138,8 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM
AM_RANGE(0x4000, 0x47ff) AM_RAM
AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
- AM_RANGE(0x8000, 0x8000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x8001, 0x8001) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0x8000, 0x8001) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/1943.c b/src/mame/drivers/1943.c
index c129fd08ad0..1a625d84158 100644
--- a/src/mame/drivers/1943.c
+++ b/src/mame/drivers/1943.c
@@ -85,10 +85,8 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0xc000, 0xc7ff) AM_RAM
AM_RANGE(0xc800, 0xc800) AM_READ(soundlatch_r)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0xe002, 0xe002) AM_WRITE(ym2203_control_port_1_w)
- AM_RANGE(0xe003, 0xe003) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0xe000, 0xe001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0xe002, 0xe003) AM_DEVWRITE(SOUND, "ym2", ym2203_w)
ADDRESS_MAP_END
/* Input Ports */
diff --git a/src/mame/drivers/1945kiii.c b/src/mame/drivers/1945kiii.c
index e81acfc5a04..97214c9faad 100644
--- a/src/mame/drivers/1945kiii.c
+++ b/src/mame/drivers/1945kiii.c
@@ -124,8 +124,8 @@ static WRITE16_HANDLER( k3_scrolly_w )
static WRITE16_HANDLER( k3_soundbanks_w )
{
- okim6295_set_bank_base(0, (data & 4) ? 0x40000 : 0);
- okim6295_set_bank_base(1, (data & 2) ? 0x40000 : 0);
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki1"), (data & 4) ? 0x40000 : 0);
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki2"), (data & 2) ? 0x40000 : 0);
}
@@ -146,8 +146,8 @@ static ADDRESS_MAP_START( k3_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x400000, 0x400001) AM_READ_PORT("INPUTS")
AM_RANGE(0x440000, 0x440001) AM_READ_PORT("SYSTEM")
AM_RANGE(0x480000, 0x480001) AM_READ_PORT("DSW")
- AM_RANGE(0x4c0000, 0x4c0001) AM_READWRITE(okim6295_status_1_msb_r, okim6295_data_1_msb_w)
- AM_RANGE(0x500000, 0x500001) AM_READWRITE(okim6295_status_0_msb_r, okim6295_data_0_msb_w)
+ AM_RANGE(0x4c0000, 0x4c0001) AM_DEVREADWRITE8(SOUND, "oki2", okim6295_r, okim6295_w, 0xff00)
+ AM_RANGE(0x500000, 0x500001) AM_DEVREADWRITE8(SOUND, "oki1", okim6295_r, okim6295_w, 0xff00)
AM_RANGE(0x8c0000, 0x8cffff) AM_RAM // not used?
ADDRESS_MAP_END
diff --git a/src/mame/drivers/20pacgal.c b/src/mame/drivers/20pacgal.c
index 915d66d49cc..44bb5174d53 100644
--- a/src/mame/drivers/20pacgal.c
+++ b/src/mame/drivers/20pacgal.c
@@ -87,12 +87,6 @@ static const namco_interface namco_config =
};
-static WRITE8_HANDLER( _20pacgal_dac_w )
-{
- dac_signed_data_w(0, data);
-}
-
-
/*************************************
*
@@ -205,9 +199,9 @@ static ADDRESS_MAP_START( 20pacgal_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0a000, 0x0ffff) AM_MIRROR(0x40000) AM_ROM
AM_RANGE(0x10000, 0x3ffff) AM_ROM
AM_RANGE(0x44000, 0x447ff) AM_RAM AM_BASE_MEMBER(_20pacgal_state, video_ram)
- AM_RANGE(0x45040, 0x4505f) AM_WRITE(pacman_sound_w) AM_BASE(&namco_soundregs)
+ AM_RANGE(0x45040, 0x4505f) AM_DEVWRITE(SOUND, "namco", pacman_sound_w) AM_BASE(&namco_soundregs)
AM_RANGE(0x44800, 0x45eff) AM_RAM
- AM_RANGE(0x45f00, 0x45fff) AM_WRITE(_20pacgal_wavedata_w) AM_BASE(&namco_wavedata)
+ AM_RANGE(0x45f00, 0x45fff) AM_DEVWRITE(SOUND, "namco", _20pacgal_wavedata_w) AM_BASE(&namco_wavedata)
AM_RANGE(0x46000, 0x46fff) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(_20pacgal_state, char_gfx_ram)
AM_RANGE(0x47100, 0x47100) AM_RAM /* leftover from original Galaga code */
AM_RANGE(0x48000, 0x49fff) AM_READWRITE(SMH_ROM, rom_48000_w) /* this should be a mirror of 08000-09ffff */
@@ -237,7 +231,7 @@ static ADDRESS_MAP_START( 20pacgal_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x85, 0x86) AM_WRITE(SMH_NOP) /* stars: rng seed (lo/hi) */
AM_RANGE(0x87, 0x87) AM_READWRITE(eeprom_r, eeprom_w)
AM_RANGE(0x88, 0x88) AM_WRITE(rom_bank_select_w)
- AM_RANGE(0x89, 0x89) AM_WRITE(_20pacgal_dac_w)
+ AM_RANGE(0x89, 0x89) AM_DEVWRITE(SOUND, "dac", dac_signed_w)
AM_RANGE(0x8a, 0x8a) AM_WRITE(SMH_NOP) /* stars: bits 3-4 = active set; bit 5 = enable */
AM_RANGE(0x8b, 0x8b) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(_20pacgal_state, flip)
AM_RANGE(0x8f, 0x8f) AM_WRITE(_20pacgal_coin_counter_w)
diff --git a/src/mame/drivers/2mindril.c b/src/mame/drivers/2mindril.c
index 82a001605c9..9c528dcc6ce 100644
--- a/src/mame/drivers/2mindril.c
+++ b/src/mame/drivers/2mindril.c
@@ -234,10 +234,7 @@ static ADDRESS_MAP_START( drill_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x400000, 0x4fffff) AM_RAM AM_BASE(&unkram)// video stuff, 460000 - video regs ?
AM_RANGE(0x500000, 0x501fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE(&paletteram16)
AM_RANGE(0x502000, 0x503fff) AM_RAM
- AM_RANGE(0x600000, 0x600001) AM_READ(ym2610_status_port_0_a_lsb_r) AM_WRITE(ym2610_control_port_0_a_lsb_w)
- AM_RANGE(0x600002, 0x600003) AM_READ(ym2610_read_port_0_lsb_r) AM_WRITE(ym2610_data_port_0_a_lsb_w)
- AM_RANGE(0x600004, 0x600005) AM_READ(ym2610_status_port_0_b_lsb_r) AM_WRITE(ym2610_control_port_0_b_lsb_w)
- AM_RANGE(0x600006, 0x600007) AM_WRITE(ym2610_data_port_0_b_lsb_w)
+ AM_RANGE(0x600000, 0x600007) AM_DEVREADWRITE8(SOUND, "ym", ym2610_r, ym2610_w, 0x00ff)
AM_RANGE(0x60000c, 0x60000d) AM_RAM
AM_RANGE(0x60000e, 0x60000f) AM_RAM
AM_RANGE(0x700000, 0x70000f) AM_READWRITE(drill_io_r,drill_io_w) AM_BASE(&iodata) // i/o
@@ -394,9 +391,9 @@ static INTERRUPT_GEN( drill_interrupt )
}
/* WRONG,it does something with 60000c & 700002,likely to be called when the player throws the ball.*/
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
-// cpu_set_input_line(machine->cpu[0],5,irq ? ASSERT_LINE : CLEAR_LINE);
+// cpu_set_input_line(device->machine->cpu[0],5,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface ym2610_config =
diff --git a/src/mame/drivers/40love.c b/src/mame/drivers/40love.c
index 88fa6b53919..c2b6ead2f03 100644
--- a/src/mame/drivers/40love.c
+++ b/src/mame/drivers/40love.c
@@ -738,29 +738,29 @@ static UINT8 snd_ctrl1=0;
static UINT8 snd_ctrl2=0;
static UINT8 snd_ctrl3=0;
-static WRITE8_HANDLER( sound_control_0_w )
+static WRITE8_DEVICE_HANDLER( sound_control_0_w )
{
snd_ctrl0 = data & 0xff;
// popmessage("SND0 0=%02x 1=%02x 2=%02x 3=%02x", snd_ctrl0, snd_ctrl1, snd_ctrl2, snd_ctrl3);
/* this definitely controls main melody voice on 2'-1 and 4'-1 outputs */
- sndti_set_output_gain(SOUND_MSM5232, 0, 0, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group1 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 1, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group1 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 2, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group1 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 3, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group1 from msm5232 */
+ sound_set_output_gain(device, 0, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group1 from msm5232 */
+ sound_set_output_gain(device, 1, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group1 from msm5232 */
+ sound_set_output_gain(device, 2, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group1 from msm5232 */
+ sound_set_output_gain(device, 3, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group1 from msm5232 */
}
-static WRITE8_HANDLER( sound_control_1_w )
+static WRITE8_DEVICE_HANDLER( sound_control_1_w )
{
snd_ctrl1 = data & 0xff;
// popmessage("SND1 0=%02x 1=%02x 2=%02x 3=%02x", snd_ctrl0, snd_ctrl1, snd_ctrl2, snd_ctrl3);
- sndti_set_output_gain(SOUND_MSM5232, 0, 4, vol_ctrl[ (snd_ctrl1>>4) & 15 ] / 100.0); /* group2 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 5, vol_ctrl[ (snd_ctrl1>>4) & 15 ] / 100.0); /* group2 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 6, vol_ctrl[ (snd_ctrl1>>4) & 15 ] / 100.0); /* group2 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 7, vol_ctrl[ (snd_ctrl1>>4) & 15 ] / 100.0); /* group2 from msm5232 */
+ sound_set_output_gain(device, 4, vol_ctrl[ (snd_ctrl1>>4) & 15 ] / 100.0); /* group2 from msm5232 */
+ sound_set_output_gain(device, 5, vol_ctrl[ (snd_ctrl1>>4) & 15 ] / 100.0); /* group2 from msm5232 */
+ sound_set_output_gain(device, 6, vol_ctrl[ (snd_ctrl1>>4) & 15 ] / 100.0); /* group2 from msm5232 */
+ sound_set_output_gain(device, 7, vol_ctrl[ (snd_ctrl1>>4) & 15 ] / 100.0); /* group2 from msm5232 */
}
-static WRITE8_HANDLER( sound_control_2_w )
+static WRITE8_DEVICE_HANDLER( sound_control_2_w )
{
int i;
@@ -768,10 +768,10 @@ static WRITE8_HANDLER( sound_control_2_w )
// popmessage("SND2 0=%02x 1=%02x 2=%02x 3=%02x", snd_ctrl0, snd_ctrl1, snd_ctrl2, snd_ctrl3);
for (i=0; i<3; i++)
- sndti_set_output_gain(SOUND_AY8910, 0, i, vol_ctrl[ (snd_ctrl2>>4) & 15 ] / 100.0); /* ym2149f all */
+ sound_set_output_gain(device, i, vol_ctrl[ (snd_ctrl2>>4) & 15 ] / 100.0); /* ym2149f all */
}
-static WRITE8_HANDLER( sound_control_3_w ) /* unknown */
+static WRITE8_DEVICE_HANDLER( sound_control_3_w ) /* unknown */
{
snd_ctrl3 = data & 0xff;
// popmessage("SND3 0=%02x 1=%02x 2=%02x 3=%02x", snd_ctrl0, snd_ctrl1, snd_ctrl2, snd_ctrl3);
@@ -780,15 +780,14 @@ static WRITE8_HANDLER( sound_control_3_w ) /* unknown */
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xc7ff) AM_RAM
- AM_RANGE(0xc800, 0xc800) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xc801, 0xc801) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xca00, 0xca0d) AM_WRITE(msm5232_0_w)
- AM_RANGE(0xcc00, 0xcc00) AM_WRITE(sound_control_0_w)
- AM_RANGE(0xce00, 0xce00) AM_WRITE(sound_control_1_w)
+ AM_RANGE(0xc800, 0xc801) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0xca00, 0xca0d) AM_DEVWRITE(SOUND, "msm", msm5232_w)
+ AM_RANGE(0xcc00, 0xcc00) AM_DEVWRITE(SOUND, "msm", sound_control_0_w)
+ AM_RANGE(0xce00, 0xce00) AM_DEVWRITE(SOUND, "msm", sound_control_1_w)
AM_RANGE(0xd800, 0xd800) AM_READWRITE(soundlatch_r, to_main_w)
AM_RANGE(0xda00, 0xda00) AM_READNOP AM_WRITE(nmi_enable_w) /* unknown read */
AM_RANGE(0xdc00, 0xdc00) AM_WRITE(nmi_disable_w)
- AM_RANGE(0xde00, 0xde00) AM_READNOP AM_WRITE(dac_0_signed_data_w) /* signed 8-bit DAC - unknown read */
+ AM_RANGE(0xde00, 0xde00) AM_READNOP AM_DEVWRITE(SOUND, "dac", dac_signed_w) /* signed 8-bit DAC - unknown read */
AM_RANGE(0xe000, 0xefff) AM_ROM /* space for diagnostics ROM */
ADDRESS_MAP_END
@@ -1007,10 +1006,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- sound_control_2_w,
- sound_control_3_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_DEVICE_HANDLER(SOUND, "ay", sound_control_2_w),
+ DEVCB_HANDLER(sound_control_3_w)
};
static const msm5232_interface msm5232_config =
diff --git a/src/mame/drivers/4enraya.c b/src/mame/drivers/4enraya.c
index c7352ae5ecc..2811eb33b9d 100644
--- a/src/mame/drivers/4enraya.c
+++ b/src/mame/drivers/4enraya.c
@@ -65,16 +65,11 @@ static WRITE8_HANDLER( sound_data_w )
soundlatch = data;
}
-static WRITE8_HANDLER( sound_control_w )
+static WRITE8_DEVICE_HANDLER( sound_control_w )
{
static int last;
if ((last & 0x04) == 0x04 && (data & 0x4) == 0x00)
- {
- if (last & 0x01)
- ay8910_control_port_0_w(space,0,soundlatch);
- else
- ay8910_write_port_0_w(space,0,soundlatch);
- }
+ ay8910_data_address_w(device, last, soundlatch);
last=data;
}
@@ -90,7 +85,7 @@ static ADDRESS_MAP_START( main_portmap, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x01, 0x01) AM_READ_PORT("INPUTS")
AM_RANGE(0x02, 0x02) AM_READ_PORT("SYSTEM")
AM_RANGE(0x23, 0x23) AM_WRITE(sound_data_w)
- AM_RANGE(0x33, 0x33) AM_WRITE(sound_control_w)
+ AM_RANGE(0x33, 0x33) AM_DEVWRITE(SOUND, "ay", sound_control_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/4roses.c b/src/mame/drivers/4roses.c
index 03bba7c4544..34249fd22d9 100644
--- a/src/mame/drivers/4roses.c
+++ b/src/mame/drivers/4roses.c
@@ -346,10 +346,10 @@ static const ay8910_interface ay8910_intf =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, /* portA in */
- NULL, /* portB in */
- NULL, /* portA out */
- NULL /* portB out */
+ DEVCB_NULL, /* portA in */
+ DEVCB_NULL, /* portB in */
+ DEVCB_NULL, /* portA out */
+ DEVCB_NULL /* portB out */
};
diff --git a/src/mame/drivers/8080bw.c b/src/mame/drivers/8080bw.c
index ea9770679d0..1cd0aa10484 100644
--- a/src/mame/drivers/8080bw.c
+++ b/src/mame/drivers/8080bw.c
@@ -323,8 +323,8 @@ static ADDRESS_MAP_START( astropal_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x01, 0x01) AM_MIRROR(0x04) AM_READ_PORT("IN1")
AM_RANGE(0x03, 0x03) AM_MIRROR(0x04) AM_READ_PORT("IN3")
- AM_RANGE(0x03, 0x03) AM_WRITE(invaders_audio_1_w)
- AM_RANGE(0x05, 0x05) AM_WRITE(invaders_audio_2_w)
+ AM_RANGE(0x03, 0x03) AM_DEVWRITE(SOUND, "discrete", invaders_audio_1_w)
+ AM_RANGE(0x05, 0x05) AM_DEVWRITE(SOUND, "discrete", invaders_audio_2_w)
AM_RANGE(0x06, 0x06) AM_WRITE(watchdog_reset_w)
ADDRESS_MAP_END
@@ -1178,11 +1178,11 @@ static MACHINE_START( polaris )
static ADDRESS_MAP_START( polaris_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0") AM_WRITE(mb14241_0_shift_count_w)
AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1")
- AM_RANGE(0x02, 0x02) AM_READ_PORT("IN2") AM_WRITE(polaris_sh_port_1_w)
+ AM_RANGE(0x02, 0x02) AM_READ_PORT("IN2") AM_DEVWRITE(SOUND, "discrete", polaris_sh_port_1_w)
AM_RANGE(0x03, 0x03) AM_READWRITE(mb14241_0_shift_result_r, mb14241_0_shift_data_w)
- AM_RANGE(0x04, 0x04) AM_WRITE(polaris_sh_port_2_w)
+ AM_RANGE(0x04, 0x04) AM_DEVWRITE(SOUND, "discrete", polaris_sh_port_2_w)
AM_RANGE(0x05, 0x05) AM_WRITE(watchdog_reset_w)
- AM_RANGE(0x06, 0x06) AM_WRITE(polaris_sh_port_3_w)
+ AM_RANGE(0x06, 0x06) AM_DEVWRITE(SOUND, "discrete", polaris_sh_port_3_w)
ADDRESS_MAP_END
@@ -1534,7 +1534,7 @@ static ADDRESS_MAP_START( indianbt_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x04, 0x04) AM_WRITE(mb14241_0_shift_data_w)
AM_RANGE(0x05, 0x05) AM_WRITE(indianbt_sh_port_2_w)
AM_RANGE(0x06, 0x06) AM_WRITENOP /* sound ? */
- AM_RANGE(0x07, 0x07) AM_WRITE(indianbt_sh_port_3_w)
+ AM_RANGE(0x07, 0x07) AM_DEVWRITE(SOUND, "discrete", indianbt_sh_port_3_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/86lions.c b/src/mame/drivers/86lions.c
index 65a459bc650..7cfb1f10a11 100644
--- a/src/mame/drivers/86lions.c
+++ b/src/mame/drivers/86lions.c
@@ -89,8 +89,7 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1801, 0x1801) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
AM_RANGE(0x5000, 0x500f) AM_READWRITE(lions_via_r, lions_via_w)
AM_RANGE(0x5300, 0x5300) AM_READ(test_r)//AM_READ_PORT("IN0")
- AM_RANGE(0x5382, 0x5382) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x5383, 0x5383) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x5382, 0x5383) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
AM_RANGE(0xe000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -214,10 +213,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_2_r, /* DSW? */
- input_port_3_r, /* DSW? */
- NULL,
- NULL
+ DEVCB_INPUT_PORT("IN2"), /* DSW? */
+ DEVCB_INPUT_PORT("IN3"), /* DSW? */
+ DEVCB_NULL,
+ DEVCB_NULL
};
//static READ8_DEVICE_HANDLER( input_a )
diff --git a/src/mame/drivers/88games.c b/src/mame/drivers/88games.c
index a3222190488..6c1407e8cc7 100644
--- a/src/mame/drivers/88games.c
+++ b/src/mame/drivers/88games.c
@@ -107,17 +107,21 @@ static READ8_HANDLER( cheat2_r )
return res;
}
-static int speech_chip;
+static char speech_chip[8];
static WRITE8_HANDLER( speech_control_w )
{
- speech_chip = ( data & 4 ) ? 1 : 0;
- upd7759_reset_w( speech_chip, data & 2 );
- upd7759_start_w( speech_chip, data & 1 );
+ const device_config *upd;
+
+ strcpy(speech_chip, ( data & 4 ) ? "upd2" : "upd1");
+
+ upd = devtag_get_device(space->machine, SOUND, speech_chip);
+ upd7759_reset_w( upd, data & 2 );
+ upd7759_start_w( upd, data & 1 );
}
static WRITE8_HANDLER( speech_msg_w )
{
- upd7759_port_w( speech_chip, data );
+ upd7759_port_w( devtag_get_device(space->machine, SOUND, speech_chip), 0, data );
}
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
@@ -147,8 +151,7 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0x87ff) AM_RAM
AM_RANGE(0x9000, 0x9000) AM_WRITE(speech_msg_w)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xc001, 0xc001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0xe000, 0xe000) AM_WRITE(speech_control_w)
ADDRESS_MAP_END
@@ -521,7 +524,7 @@ static MACHINE_START( 88games )
{
state_save_register_global(machine, videobank);
state_save_register_global(machine, zoomreadroms);
- state_save_register_global(machine, speech_chip);
+ state_save_register_global_array(machine, speech_chip);
}
static DRIVER_INIT( 88games )
diff --git a/src/mame/drivers/acommand.c b/src/mame/drivers/acommand.c
index ff1e6d9363f..6a8607c77ec 100644
--- a/src/mame/drivers/acommand.c
+++ b/src/mame/drivers/acommand.c
@@ -295,10 +295,10 @@ static READ16_HANDLER(ac_devices_r)
return input_port_read(space->machine, "IN0");
case 0x0014/2:
case 0x0016/2:
- return okim6295_status_0_r(space,0);
+ return okim6295_r(devtag_get_device(space->machine, SOUND, "oki1"),0);
case 0x0018/2:
case 0x001a/2:
- return okim6295_status_1_r(space,0);
+ return okim6295_r(devtag_get_device(space->machine, SOUND, "oki2"),0);
case 0x0040/2:
/*
"Upper switch / Under Switch"
@@ -378,19 +378,19 @@ static WRITE16_HANDLER(ac_devices_w)
case 0x00/2:
if (ACCESSING_BITS_0_7)
{
- okim6295_set_bank_base(0, 0x40000 * (data & 0x3));
- okim6295_set_bank_base(1, 0x40000 * (data & 0x30) >> 4);
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki1"), 0x40000 * (data & 0x3));
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki2"), 0x40000 * (data & 0x30) >> 4);
}
break;
case 0x14/2:
case 0x16/2:
if(ACCESSING_BITS_0_7)
- okim6295_data_0_w(space,0,data);
+ okim6295_w(devtag_get_device(space->machine, SOUND, "oki1"),0,data);
break;
case 0x18/2:
case 0x1a/2:
if(ACCESSING_BITS_0_7)
- okim6295_data_1_w(space,0,data);
+ okim6295_w(devtag_get_device(space->machine, SOUND, "oki2"),0,data);
break;
case 0x1c/2:
/*IRQ mask?*/
diff --git a/src/mame/drivers/actfancr.c b/src/mame/drivers/actfancr.c
index 4d211be1d9a..170e895501f 100644
--- a/src/mame/drivers/actfancr.c
+++ b/src/mame/drivers/actfancr.c
@@ -114,12 +114,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( dec0_s_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM
- AM_RANGE(0x0800, 0x0800) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x0801, 0x0801) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0x1000, 0x1000) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x1001, 0x1001) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x0800, 0x0801) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x1000, 0x1001) AM_DEVWRITE(SOUND, "ym2", ym3812_w)
AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r)
- AM_RANGE(0x3800, 0x3800) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x3800, 0x3800) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0x4000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -276,9 +274,9 @@ GFXDECODE_END
/******************************************************************************/
-static void sound_irq(running_machine *machine, int linestate)
+static void sound_irq(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1],0,linestate); /* IRQ */
+ cpu_set_input_line(device->machine->cpu[1],0,linestate); /* IRQ */
}
static const ym3812_interface ym3812_config =
diff --git a/src/mame/drivers/adp.c b/src/mame/drivers/adp.c
index 70cf200c3a9..bf5f27f651a 100644
--- a/src/mame/drivers/adp.c
+++ b/src/mame/drivers/adp.c
@@ -375,8 +375,9 @@ static ADDRESS_MAP_START( skattv_mem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x800080, 0x800081) AM_READWRITE(HD63484_status_r, HD63484_address_w)
AM_RANGE(0x800082, 0x800083) AM_READWRITE(HD63484_data_r, HD63484_data_w)
AM_RANGE(0x800100, 0x800101) AM_READWRITE(test_r,wh2_w) //related to input
- AM_RANGE(0x800140, 0x800141) AM_READWRITE(t2_r,ay8910_control_port_0_lsb_w) //18b too
- AM_RANGE(0x800142, 0x800143) AM_READWRITE(ay8910_read_port_0_lsb_r,ay8910_write_port_0_lsb_w) //18b too
+ AM_RANGE(0x800140, 0x800141) AM_READ(t2_r)
+ AM_RANGE(0x800140, 0x800143) AM_DEVWRITE8(SOUND, "ay", ay8910_address_data_w, 0x00ff) //18b too
+ AM_RANGE(0x800142, 0x800143) AM_DEVREAD8(SOUND, "ay", ay8910_r, 0x00ff) //18b too
AM_RANGE(0x800180, 0x80019f) AM_DEVREADWRITE8( DUART68681, "duart68681", duart68681_r, duart68681_w, 0xff )
// AM_RANGE(0xffd246, 0xffd247) AM_READ(handler3_r)
// AM_RANGE(0xffd248, 0xffd249) AM_READ(handler3_r)
@@ -407,8 +408,9 @@ static ADDRESS_MAP_START( funland_mem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x800080, 0x800081) AM_READWRITE(HD63484_status_r, HD63484_address_w)
AM_RANGE(0x800082, 0x800083) AM_READWRITE(HD63484_data_r, HD63484_data_w)
// AM_RANGE(0x800100, 0x8001ff) AM_READ(test_r) //18b too
- AM_RANGE(0x800140, 0x800141) AM_READWRITE(t2_r,ay8910_control_port_0_lsb_w) //18b too
- AM_RANGE(0x800142, 0x800143) AM_READWRITE(ay8910_read_port_0_lsb_r,ay8910_write_port_0_lsb_w) //18b too
+ AM_RANGE(0x800140, 0x800141) AM_READ(t2_r)
+ AM_RANGE(0x800140, 0x800143) AM_DEVWRITE8(SOUND, "ay", ay8910_address_data_w, 0x00ff) //18b too
+ AM_RANGE(0x800142, 0x800143) AM_DEVREAD8(SOUND, "ay", ay8910_r, 0x00ff) //18b too
AM_RANGE(0x800180, 0x80019f) AM_DEVREADWRITE8( DUART68681, "duart68681", duart68681_r, duart68681_w, 0xff )
AM_RANGE(0xfc0000, 0xffffff) AM_RAM
ADDRESS_MAP_END
diff --git a/src/mame/drivers/aeroboto.c b/src/mame/drivers/aeroboto.c
index 4a8e51a9330..ef3b0558d8e 100644
--- a/src/mame/drivers/aeroboto.c
+++ b/src/mame/drivers/aeroboto.c
@@ -99,12 +99,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_RAM
- AM_RANGE(0x9000, 0x9000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x9001, 0x9001) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x9002, 0x9002) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0xa000, 0xa000) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0xa001, 0xa001) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0xa002, 0xa002) AM_READ(ay8910_read_port_1_r)
+ AM_RANGE(0x9000, 0x9001) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x9002, 0x9002) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0xa000, 0xa001) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0xa002, 0xa002) AM_DEVREAD(SOUND, "ay2", ay8910_r)
AM_RANGE(0xf000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -223,10 +221,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r,
- soundlatch2_r,
- NULL,
- NULL
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r),
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch2_r),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static MACHINE_START( formatz )
diff --git a/src/mame/drivers/aerofgt.c b/src/mame/drivers/aerofgt.c
index a882fc622da..3e8663abe1b 100644
--- a/src/mame/drivers/aerofgt.c
+++ b/src/mame/drivers/aerofgt.c
@@ -128,16 +128,16 @@ static MACHINE_RESET( aerofgt )
}
-static WRITE16_HANDLER( pspikesb_oki_banking_w )
+static WRITE16_DEVICE_HANDLER( pspikesb_oki_banking_w )
{
- okim6295_set_bank_base(0, 0x40000 * (data & 3));
+ okim6295_set_bank_base(device, 0x40000 * (data & 3));
}
/*TODO: sound banking. */
-static WRITE16_HANDLER( aerfboo2_okim6295_banking_w )
+static WRITE16_DEVICE_HANDLER( aerfboo2_okim6295_banking_w )
{
// if(ACCESSING_BITS_8_15)
-// okim6295_set_bank_base(0, 0x40000 * ((data & 0xf00)>>8));
+// okim6295_set_bank_base(device, 0x40000 * ((data & 0xf00)>>8));
}
static WRITE8_HANDLER( aerfboot_okim6295_banking_w )
@@ -175,8 +175,8 @@ static ADDRESS_MAP_START( pspikesb_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xfff000, 0xfff001) AM_READ_PORT("IN0")
AM_RANGE(0xfff002, 0xfff003) AM_READ_PORT("IN1")
AM_RANGE(0xfff004, 0xfff005) AM_READ_PORT("DSW") AM_WRITE(aerofgt_bg1scrolly_w)
- AM_RANGE(0xfff006, 0xfff007) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
- AM_RANGE(0xfff008, 0xfff009) AM_WRITE(pspikesb_oki_banking_w)
+ AM_RANGE(0xfff006, 0xfff007) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
+ AM_RANGE(0xfff008, 0xfff009) AM_DEVWRITE(SOUND, "oki", pspikesb_oki_banking_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( spikes91_map, ADDRESS_SPACE_PROGRAM, 16 )
@@ -211,7 +211,7 @@ static ADDRESS_MAP_START( pspikesc_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xfff002, 0xfff003) AM_READ_PORT("IN1") AM_WRITE(pspikes_gfxbank_w)
AM_RANGE(0xfff004, 0xfff005) AM_READ_PORT("DSW")
AM_RANGE(0xfff004, 0xfff005) AM_WRITE(aerofgt_bg1scrolly_w)
- AM_RANGE(0xfff006, 0xfff007) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0xfff006, 0xfff007) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
ADDRESS_MAP_END
static ADDRESS_MAP_START( karatblz_map, ADDRESS_SPACE_PROGRAM, 16 )
@@ -363,9 +363,9 @@ static ADDRESS_MAP_START( aerfboo2_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x0fe004, 0x0fe005) AM_WRITE(aerofgt_bg2scrollx_w)
AM_RANGE(0x0fe006, 0x0fe007) AM_WRITE(aerofgt_bg2scrolly_w)
AM_RANGE(0x0fe008, 0x0fe00b) AM_WRITE(turbofrc_gfxbank_w)
- AM_RANGE(0x0fe006, 0x0fe007) AM_READ(okim6295_status_0_msb_r)
- AM_RANGE(0x0fe00e, 0x0fe00f) AM_WRITE(okim6295_data_0_msb_w)
- AM_RANGE(0x0fe01e, 0x0fe01f) AM_WRITE(aerfboo2_okim6295_banking_w)
+ AM_RANGE(0x0fe006, 0x0fe007) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0xff00)
+ AM_RANGE(0x0fe00e, 0x0fe00f) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0xff00)
+ AM_RANGE(0x0fe01e, 0x0fe01f) AM_DEVWRITE(SOUND, "oki", aerfboo2_okim6295_banking_w)
// AM_RANGE(0x0fe010, 0x0fe011) AM_WRITENOP
// AM_RANGE(0x0fe012, 0x0fe013) AM_WRITE(aerfboot_soundlatch_w)
AM_RANGE(0x0fe400, 0x0fe401) AM_WRITENOP // data for a crtc?
@@ -399,18 +399,12 @@ static ADDRESS_MAP_START( turbofrc_sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(aerofgt_sh_bankswitch_w)
AM_RANGE(0x14, 0x14) AM_READWRITE(soundlatch_r, pending_command_clear_w)
- AM_RANGE(0x18, 0x18) AM_READWRITE(ym2610_status_port_0_a_r, ym2610_control_port_0_a_w)
- AM_RANGE(0x19, 0x19) AM_WRITE(ym2610_data_port_0_a_w)
- AM_RANGE(0x1a, 0x1a) AM_READWRITE(ym2610_status_port_0_b_r, ym2610_control_port_0_b_w)
- AM_RANGE(0x1b, 0x1b) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE(SOUND, "ym", ym2610_r, ym2610_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( aerofgt_sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym2610_status_port_0_a_r, ym2610_control_port_0_a_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym2610_data_port_0_a_w)
- AM_RANGE(0x02, 0x02) AM_READWRITE(ym2610_status_port_0_b_r, ym2610_control_port_0_b_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(SOUND, "ym", ym2610_r, ym2610_w)
AM_RANGE(0x04, 0x04) AM_WRITE(aerofgt_sh_bankswitch_w)
AM_RANGE(0x08, 0x08) AM_WRITE(pending_command_clear_w)
AM_RANGE(0x0c, 0x0c) AM_READ(soundlatch_r)
@@ -420,16 +414,15 @@ static ADDRESS_MAP_START( aerfboot_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
AM_RANGE(0x9000, 0x9000) AM_WRITE(aerfboot_okim6295_banking_w)
- AM_RANGE(0x9800, 0x9800) AM_READWRITE(okim6295_status_0_r,okim6295_data_0_w)
+ AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE(SOUND, "oki", okim6295_r,okim6295_w)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( wbbc97_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_ROM
AM_RANGE(0xf000, 0xf7ff) AM_RAM
- AM_RANGE(0xf800, 0xf800) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
- AM_RANGE(0xf810, 0xf810) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0xf811, 0xf811) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0xf800, 0xf800) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
+ AM_RANGE(0xf810, 0xf811) AM_DEVWRITE(SOUND, "ym", ym3812_w)
AM_RANGE(0xfc00, 0xfc00) AM_NOP
AM_RANGE(0xfc20, 0xfc20) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -1295,9 +1288,9 @@ static GFXDECODE_START( wbbc97 )
GFXDECODE_ENTRY( "gfx2", 0, wbbc97_spritelayout, 1024, 64 ) /* colors 1024-2047 in 4 banks */
GFXDECODE_END
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface ym2610_config =
diff --git a/src/mame/drivers/airbustr.c b/src/mame/drivers/airbustr.c
index be430266d59..f6542f388ec 100644
--- a/src/mame/drivers/airbustr.c
+++ b/src/mame/drivers/airbustr.c
@@ -418,9 +418,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(sound_bankswitch_w)
- AM_RANGE(0x02, 0x02) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x03, 0x03) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
- AM_RANGE(0x04, 0x04) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x02, 0x03) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
+ AM_RANGE(0x04, 0x04) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0x06, 0x06) AM_READWRITE(soundcommand_r, soundcommand2_w)
ADDRESS_MAP_END
@@ -565,10 +564,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_3_r, // DSW-1 connected to port A
- input_port_4_r, // DSW-2 connected to port B
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW1"), // DSW-1 connected to port A
+ DEVCB_INPUT_PORT("DSW2"), // DSW-2 connected to port B
+ DEVCB_NULL,
+ DEVCB_NULL
},
NULL
};
diff --git a/src/mame/drivers/ajax.c b/src/mame/drivers/ajax.c
index c7868aa6991..8203f539b37 100644
--- a/src/mame/drivers/ajax.c
+++ b/src/mame/drivers/ajax.c
@@ -19,7 +19,7 @@ TO DO:
#include "sound/k007232.h"
#include "includes/ajax.h"
-static WRITE8_HANDLER( k007232_extvol_w );
+static WRITE8_DEVICE_HANDLER( k007232_extvol_w );
static WRITE8_HANDLER( sound_bank_w );
/****************************************************************************/
@@ -50,12 +50,11 @@ static ADDRESS_MAP_START( ajax_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM /* ROM F6 */
AM_RANGE(0x8000, 0x87ff) AM_RAM /* RAM 2128SL at D16 */
AM_RANGE(0x9000, 0x9000) AM_WRITE(sound_bank_w) /* 007232 bankswitch */
- AM_RANGE(0xa000, 0xa00d) AM_READWRITE(k007232_read_port_0_r, k007232_write_port_0_w) /* 007232 registers (chip 1) */
- AM_RANGE(0xb000, 0xb00d) AM_READWRITE(k007232_read_port_1_r, k007232_write_port_1_w) /* 007232 registers (chip 2) */
- AM_RANGE(0xb80c, 0xb80c) AM_WRITE(k007232_extvol_w) /* extra volume, goes to the 007232 w/ A11 */
+ AM_RANGE(0xa000, 0xa00d) AM_DEVREADWRITE(SOUND, "konami1", k007232_r, k007232_w) /* 007232 registers (chip 1) */
+ AM_RANGE(0xb000, 0xb00d) AM_DEVREADWRITE(SOUND, "konami2", k007232_r, k007232_w) /* 007232 registers (chip 2) */
+ AM_RANGE(0xb80c, 0xb80c) AM_DEVWRITE(SOUND, "konami2", k007232_extvol_w) /* extra volume, goes to the 007232 w/ A11 */
/* selecting a different latch for the external port */
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym2151_register_port_0_w) /* YM2151 */
- AM_RANGE(0xc001, 0xc001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w) /* YM2151 */
+ AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w) /* YM2151 */
AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r) /* soundlatch_r */
ADDRESS_MAP_END
@@ -188,30 +187,30 @@ static WRITE8_HANDLER( sound_bank_w )
/* banks # for the 007232 (chip 1) */
bank_A = ((data >> 1) & 0x01);
bank_B = ((data >> 0) & 0x01);
- k007232_set_bank( 0, bank_A, bank_B );
+ k007232_set_bank( devtag_get_device(space->machine, SOUND, "konami1"), bank_A, bank_B );
/* banks # for the 007232 (chip 2) */
bank_A = ((data >> 4) & 0x03);
bank_B = ((data >> 2) & 0x03);
- k007232_set_bank( 1, bank_A, bank_B );
+ k007232_set_bank( devtag_get_device(space->machine, SOUND, "konami2"), bank_A, bank_B );
}
-static void volume_callback0(int v)
+static void volume_callback0(const device_config *device, int v)
{
- k007232_set_volume(0,0,(v >> 4) * 0x11,0);
- k007232_set_volume(0,1,0,(v & 0x0f) * 0x11);
+ k007232_set_volume(device,0,(v >> 4) * 0x11,0);
+ k007232_set_volume(device,1,0,(v & 0x0f) * 0x11);
}
-static WRITE8_HANDLER( k007232_extvol_w )
+static WRITE8_DEVICE_HANDLER( k007232_extvol_w )
{
/* channel A volume (mono) */
- k007232_set_volume(1,0,(data & 0x0f) * 0x11/2,(data & 0x0f) * 0x11/2);
+ k007232_set_volume(device,0,(data & 0x0f) * 0x11/2,(data & 0x0f) * 0x11/2);
}
-static void volume_callback1(int v)
+static void volume_callback1(const device_config *device, int v)
{
/* channel B volume/pan */
- k007232_set_volume(1,1,(v & 0x0f) * 0x11/2,(v >> 4) * 0x11/2);
+ k007232_set_volume(device,1,(v & 0x0f) * 0x11/2,(v >> 4) * 0x11/2);
}
static const k007232_interface k007232_interface_1 =
diff --git a/src/mame/drivers/aleck64.c b/src/mame/drivers/aleck64.c
index 7ec3e6a5132..81fa276f8f7 100644
--- a/src/mame/drivers/aleck64.c
+++ b/src/mame/drivers/aleck64.c
@@ -169,7 +169,6 @@ Notes:
#include "streams.h"
#include "cpu/rsp/rsp.h"
#include "cpu/mips/mips3.h"
-#include "sound/custom.h"
#include "sound/dmadac.h"
#include "includes/n64.h"
diff --git a/src/mame/drivers/alg.c b/src/mame/drivers/alg.c
index e5744640407..4a191d3d64f 100644
--- a/src/mame/drivers/alg.c
+++ b/src/mame/drivers/alg.c
@@ -371,19 +371,6 @@ INPUT_PORTS_END
/*************************************
*
- * Sound definitions
- *
- *************************************/
-
-static const custom_sound_interface amiga_custom_interface =
-{
- amiga_sh_start
-};
-
-
-
-/*************************************
- *
* Machine driver
*
*************************************/
@@ -436,15 +423,13 @@ static MACHINE_DRIVER_START( alg_r1 )
/* sound hardware */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("amiga", CUSTOM, 3579545)
- MDRV_SOUND_CONFIG(amiga_custom_interface)
+ MDRV_SOUND_ADD("amiga", AMIGA, 3579545)
MDRV_SOUND_ROUTE(0, "left", 0.25)
MDRV_SOUND_ROUTE(1, "right", 0.25)
MDRV_SOUND_ROUTE(2, "right", 0.25)
MDRV_SOUND_ROUTE(3, "left", 0.25)
- MDRV_SOUND_ADD("ldsound", CUSTOM, 0)
- MDRV_SOUND_CONFIG(laserdisc_custom_interface)
+ MDRV_SOUND_ADD("ldsound", LASERDISC, 0)
MDRV_SOUND_ROUTE(0, "left", 1.0)
MDRV_SOUND_ROUTE(1, "right", 1.0)
diff --git a/src/mame/drivers/aliens.c b/src/mame/drivers/aliens.c
index 1ba89dd1e74..62b166f5e5d 100644
--- a/src/mame/drivers/aliens.c
+++ b/src/mame/drivers/aliens.c
@@ -77,7 +77,7 @@ static WRITE8_HANDLER( aliens_sh_irqtrigger_w )
cpu_set_input_line_and_vector(space->machine->cpu[1], 0, HOLD_LINE, 0xff);
}
-static WRITE8_HANDLER( aliens_snd_bankswitch_w )
+static WRITE8_DEVICE_HANDLER( aliens_snd_bankswitch_w )
{
/* b1: bank for chanel A */
/* b0: bank for chanel B */
@@ -85,7 +85,7 @@ static WRITE8_HANDLER( aliens_snd_bankswitch_w )
int bank_A = ((data >> 1) & 0x01);
int bank_B = ((data) & 0x01);
- k007232_set_bank( 0, bank_A, bank_B );
+ k007232_set_bank( devtag_get_device(device->machine, SOUND, "konami"), bank_A, bank_B );
}
@@ -107,10 +107,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( aliens_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM /* ROM g04_b03.bin */
AM_RANGE(0x8000, 0x87ff) AM_RAM /* RAM */
- AM_RANGE(0xa000, 0xa000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xa001, 0xa001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_r) /* soundlatch_r */
- AM_RANGE(0xe000, 0xe00d) AM_READWRITE(k007232_read_port_0_r, k007232_write_port_0_w)
+ AM_RANGE(0xe000, 0xe00d) AM_DEVREADWRITE(SOUND, "konami", k007232_r, k007232_w)
ADDRESS_MAP_END
@@ -215,10 +214,10 @@ INPUT_PORTS_END
***************************************************************************/
-static void volume_callback(int v)
+static void volume_callback(const device_config *device, int v)
{
- k007232_set_volume(0,0,(v & 0x0f) * 0x11,0);
- k007232_set_volume(0,1,0,(v >> 4) * 0x11);
+ k007232_set_volume(device,0,(v & 0x0f) * 0x11,0);
+ k007232_set_volume(device,1,0,(v >> 4) * 0x11);
}
static const k007232_interface k007232_config =
diff --git a/src/mame/drivers/alpha68k.c b/src/mame/drivers/alpha68k.c
index 8db9de0f081..021c88c0c0d 100644
--- a/src/mame/drivers/alpha68k.c
+++ b/src/mame/drivers/alpha68k.c
@@ -803,7 +803,7 @@ static ADDRESS_MAP_START( kyros_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xc000, 0xc7ff) AM_RAM
AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
AM_RANGE(0xe002, 0xe002) AM_WRITE(soundlatch_clear_w)
- AM_RANGE(0xe004, 0xe004) AM_WRITE(dac_0_signed_data_w)
+ AM_RANGE(0xe004, 0xe004) AM_DEVWRITE(SOUND, "dac", dac_signed_w)
AM_RANGE(0xe006, 0xe00e) AM_WRITE(SMH_NOP) // soundboard I/O's, ignored
/* reference only
AM_RANGE(0xe006, 0xe006) AM_WRITE(SMH_NOP) // NMI: diminishing saw-tooth
@@ -819,7 +819,7 @@ static ADDRESS_MAP_START( sstingry_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0x87ff) AM_RAM
AM_RANGE(0xc100, 0xc100) AM_READ(soundlatch_r)
AM_RANGE(0xc102, 0xc102) AM_WRITE(soundlatch_clear_w)
- AM_RANGE(0xc104, 0xc104) AM_WRITE(dac_0_signed_data_w)
+ AM_RANGE(0xc104, 0xc104) AM_DEVWRITE(SOUND, "dac", dac_signed_w)
AM_RANGE(0xc106, 0xc10e) AM_WRITENOP // soundboard I/O's, ignored
ADDRESS_MAP_END
@@ -831,8 +831,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( alpha68k_I_s_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x9fff) AM_ROM
AM_RANGE(0xe000, 0xe000) AM_READWRITE(soundlatch_r, soundlatch_clear_w)
- AM_RANGE(0xe800, 0xe800) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0xec00, 0xec00) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE(SOUND, "ym", ym3812_status_port_r, ym3812_control_port_w)
+ AM_RANGE(0xec00, 0xec00) AM_DEVWRITE(SOUND, "ym", ym3812_write_port_w)
AM_RANGE(0xf000, 0xf7ff) AM_RAM
AM_RANGE(0xfc00, 0xfc00) AM_RAM // unknown port
ADDRESS_MAP_END
@@ -847,36 +847,31 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_READWRITE(soundlatch_r, soundlatch_clear_w)
- AM_RANGE(0x08, 0x08) AM_WRITE(dac_0_signed_data_w)
- AM_RANGE(0x0a, 0x0a) AM_WRITE(ym2413_register_port_0_w)
- AM_RANGE(0x0b, 0x0b) AM_WRITE(ym2413_data_port_0_w)
- AM_RANGE(0x0c, 0x0c) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x0d, 0x0d) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0x08, 0x08) AM_DEVWRITE(SOUND, "dac", dac_signed_w)
+ AM_RANGE(0x0a, 0x0b) AM_DEVWRITE(SOUND, "ym2", ym2413_w)
+ AM_RANGE(0x0c, 0x0d) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
AM_RANGE(0x0e, 0x0e) AM_WRITE(sound_bank_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( kyros_sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x10, 0x10) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x11, 0x11) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ym2203_write_port_1_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ym2203_control_port_1_w)
- AM_RANGE(0x90, 0x90) AM_WRITE(ym2203_write_port_2_w)
- AM_RANGE(0x91, 0x91) AM_WRITE(ym2203_control_port_2_w)
+ AM_RANGE(0x10, 0x11) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "ym2", ym2203_w)
+ AM_RANGE(0x90, 0x91) AM_DEVWRITE(SOUND, "ym3", ym2203_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( jongbou_sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
+ AM_RANGE(0x00, 0x00) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
+ AM_RANGE(0x01, 0x01) AM_DEVREADWRITE(SOUND, "ay", ay8910_r, ay8910_data_w)
AM_RANGE(0x02, 0x02) AM_WRITE(soundlatch_clear_w)
AM_RANGE(0x06, 0x06) AM_WRITE(SMH_NOP)
ADDRESS_MAP_END
static ADDRESS_MAP_START( tnexspce_sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0x20, 0x20) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x00, 0x00) AM_DEVREADWRITE(SOUND, "ym", ym3812_status_port_r, ym3812_control_port_w)
+ AM_RANGE(0x20, 0x20) AM_DEVWRITE(SOUND, "ym", ym3812_write_port_w)
AM_RANGE(0x3b, 0x3b) AM_READNOP // unknown read port
AM_RANGE(0x3d, 0x3d) AM_READNOP // unknown read port
AM_RANGE(0x7b, 0x7b) AM_READNOP // unknown read port
@@ -1879,7 +1874,7 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r)
};
static const ym2203_interface ym2203_config =
@@ -1887,13 +1882,13 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r)
}
};
-static void YM3812_irq(running_machine *machine, int param)
+static void YM3812_irq(const device_config *device, int param)
{
- cpu_set_input_line(machine->cpu[1], 0, (param) ? HOLD_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, (param) ? HOLD_LINE : CLEAR_LINE);
}
static const ym3812_interface ym3812_config =
diff --git a/src/mame/drivers/ambush.c b/src/mame/drivers/ambush.c
index f17861ac88a..5a158c7e052 100644
--- a/src/mame/drivers/ambush.c
+++ b/src/mame/drivers/ambush.c
@@ -75,10 +75,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( main_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ay8910_read_port_0_r, ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x80, 0x80) AM_READWRITE(ay8910_read_port_1_r, ay8910_control_port_1_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0x00, 0x00) AM_DEVREADWRITE(SOUND, "ay1", ay8910_r, ay8910_address_w)
+ AM_RANGE(0x01, 0x01) AM_DEVWRITE(SOUND, "ay1", ay8910_data_w)
+ AM_RANGE(0x80, 0x80) AM_DEVREADWRITE(SOUND, "ay2", ay8910_r, ay8910_address_w)
+ AM_RANGE(0x81, 0x81) AM_DEVWRITE(SOUND, "ay2", ay8910_data_w)
ADDRESS_MAP_END
@@ -179,20 +179,20 @@ static const ay8910_interface ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r,
- NULL,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("SYSTEM"),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_1_r,
- NULL,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("INPUTS"),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/ampoker2.c b/src/mame/drivers/ampoker2.c
index e43156c8e65..6270950e387 100644
--- a/src/mame/drivers/ampoker2.c
+++ b/src/mame/drivers/ampoker2.c
@@ -598,9 +598,8 @@ static ADDRESS_MAP_START( ampoker2_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x35, 0x35) AM_WRITE (ampoker2_port35_w) /* see write handlers */
AM_RANGE(0x36, 0x36) AM_WRITE (ampoker2_port36_w) /* see write handlers */
AM_RANGE(0x37, 0x37) AM_WRITE(ampoker2_watchdog_reset_w)
- AM_RANGE(0x38, 0x38) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x39, 0x39) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x3A, 0x3A) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0x38, 0x39) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0x3A, 0x3A) AM_DEVREAD(SOUND, "ay", ay8910_r)
ADDRESS_MAP_END
@@ -1010,7 +1009,7 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL /* no ports used */
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL /* no ports used */
};
diff --git a/src/mame/drivers/amspdwy.c b/src/mame/drivers/amspdwy.c
index 79ff495260c..52f86dc85e1 100644
--- a/src/mame/drivers/amspdwy.c
+++ b/src/mame/drivers/amspdwy.c
@@ -72,9 +72,9 @@ static READ8_HANDLER( amspdwy_wheel_1_r )
return amspdwy_wheel_r(space->machine, 0);
}
-static READ8_HANDLER( amspdwy_sound_r )
+static READ8_DEVICE_HANDLER( amspdwy_sound_r )
{
- return (ym2151_status_port_0_r(space,0) & ~ 0x30) | input_port_read(space->machine, "IN0");
+ return (ym2151_status_port_r(device,0) & ~ 0x30) | input_port_read(device->machine, "IN0");
}
static WRITE8_HANDLER( amspdwy_sound_w )
@@ -95,7 +95,7 @@ static ADDRESS_MAP_START( amspdwy_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xa800, 0xa800) AM_READ(amspdwy_wheel_0_r) // Player 1
AM_RANGE(0xac00, 0xac00) AM_READ(amspdwy_wheel_1_r) // Player 2
AM_RANGE(0xb000, 0xb000) AM_WRITENOP // ? Exiting IRQ
- AM_RANGE(0xb400, 0xb400) AM_READWRITE(amspdwy_sound_r, amspdwy_sound_w) // YM2151 status, To Sound CPU
+ AM_RANGE(0xb400, 0xb400) AM_DEVREAD(SOUND, "ym", amspdwy_sound_r) AM_WRITE(amspdwy_sound_w) // YM2151 status, To Sound CPU
AM_RANGE(0xc000, 0xc0ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)// Sprites
AM_RANGE(0xe000, 0xe7ff) AM_RAM // Work RAM
ADDRESS_MAP_END
@@ -125,8 +125,7 @@ static ADDRESS_MAP_START( amspdwy_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM // ROM
// AM_RANGE(0x8000, 0x8000) AM_WRITENOP // ? Written with 0 at the start
AM_RANGE(0x9000, 0x9000) AM_READ(soundlatch_r) // From Main CPU
- AM_RANGE(0xa000, 0xa000) AM_WRITE(ym2151_register_port_0_w) // YM2151
- AM_RANGE(0xa001, 0xa001) AM_WRITE(ym2151_data_port_0_w) //
+ AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w) //
AM_RANGE(0xc000, 0xdfff) AM_RAM // Work RAM
AM_RANGE(0xffff, 0xffff) AM_READNOP // ??? IY = FFFF at the start ?
ADDRESS_MAP_END
@@ -249,9 +248,9 @@ GFXDECODE_END
***************************************************************************/
-static void irq_handler(running_machine *machine, int irq)
+static void irq_handler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2151_interface amspdwy_ym2151_interface =
diff --git a/src/mame/drivers/angelkds.c b/src/mame/drivers/angelkds.c
index 0dfcd43e4ad..0b4ea52d80f 100644
--- a/src/mame/drivers/angelkds.c
+++ b/src/mame/drivers/angelkds.c
@@ -262,10 +262,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sub_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0x40, 0x40) AM_READWRITE(ym2203_status_port_1_r, ym2203_control_port_1_w)
- AM_RANGE(0x41, 0x41) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym1", ym2203_r, ym2203_w)
+ AM_RANGE(0x40, 0x41) AM_DEVREADWRITE(SOUND, "ym2", ym2203_r, ym2203_w)
AM_RANGE(0x80, 0x83) AM_READWRITE(angelkds_sub_sound_r, angelkds_sub_sound_w) // spcpostn
ADDRESS_MAP_END
@@ -538,9 +536,9 @@ static READ8_HANDLER( angelkds_sub_sound_r )
}
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface ym2203_config =
@@ -548,7 +546,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
irqhandler
};
diff --git a/src/mame/drivers/appoooh.c b/src/mame/drivers/appoooh.c
index d29a2d61bca..1c19d2a2070 100644
--- a/src/mame/drivers/appoooh.c
+++ b/src/mame/drivers/appoooh.c
@@ -65,16 +65,16 @@ static void appoooh_adpcm_int(const device_config *device)
{
UINT8 *RAM = memory_region(device->machine, "adpcm");
appoooh_adpcm_data = RAM[appoooh_adpcm_address++];
- msm5205_data_w(0, appoooh_adpcm_data >> 4);
+ msm5205_data_w(device, appoooh_adpcm_data >> 4);
if(appoooh_adpcm_data == 0x70)
{
appoooh_adpcm_address = 0xffffffff;
- msm5205_reset_w(0,1);
+ msm5205_reset_w(device,1);
}
}
else
{
- msm5205_data_w(0,appoooh_adpcm_data & 0x0f );
+ msm5205_data_w(device,appoooh_adpcm_data & 0x0f );
appoooh_adpcm_data = -1;
}
}
@@ -82,8 +82,9 @@ static void appoooh_adpcm_int(const device_config *device)
/* adpcm address write */
static WRITE8_HANDLER( appoooh_adpcm_w )
{
+ const device_config *adpcm = devtag_get_device(space->machine, SOUND, "msm");
appoooh_adpcm_address = data << 8;
- msm5205_reset_w(0,0);
+ msm5205_reset_w(adpcm,0);
appoooh_adpcm_data = 0xffffffff;
}
@@ -107,9 +108,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( main_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READ_PORT("P1") AM_WRITE(sn76496_0_w)
- AM_RANGE(0x01, 0x01) AM_READ_PORT("P2") AM_WRITE(sn76496_1_w)
- AM_RANGE(0x02, 0x02) AM_WRITE(sn76496_2_w)
+ AM_RANGE(0x00, 0x00) AM_READ_PORT("P1") AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0x01, 0x01) AM_READ_PORT("P2") AM_DEVWRITE(SOUND, "sn2", sn76496_w)
+ AM_RANGE(0x02, 0x02) AM_DEVWRITE(SOUND, "sn3", sn76496_w)
AM_RANGE(0x03, 0x03) AM_READ_PORT("DSW1") AM_WRITE(appoooh_adpcm_w)
AM_RANGE(0x04, 0x04) AM_READ_PORT("BUTTON3") AM_WRITE(appoooh_out_w)
AM_RANGE(0x05, 0x05) AM_WRITE(appoooh_scroll_w) /* unknown */
diff --git a/src/mame/drivers/aquarium.c b/src/mame/drivers/aquarium.c
index a4b07febecb..e431df4ed57 100644
--- a/src/mame/drivers/aquarium.c
+++ b/src/mame/drivers/aquarium.c
@@ -125,15 +125,15 @@ static UINT8 aquarium_snd_bitswap(UINT8 scrambled_data)
return data;
}
-static READ8_HANDLER( aquarium_oki_r )
+static READ8_DEVICE_HANDLER( aquarium_oki_r )
{
- return (aquarium_snd_bitswap(okim6295_status_0_r(space,0)) );
+ return (aquarium_snd_bitswap(okim6295_r(device,0)) );
}
-static WRITE8_HANDLER( aquarium_oki_w )
+static WRITE8_DEVICE_HANDLER( aquarium_oki_w )
{
- logerror("Z80-PC:%04x Writing %04x to the OKI M6295\n",cpu_get_previouspc(space->cpu),aquarium_snd_bitswap(data));
- okim6295_data_0_w( space, 0, (aquarium_snd_bitswap(data)) );
+ logerror("%s:Writing %04x to the OKI M6295\n",cpuexec_describe_context(device->machine),aquarium_snd_bitswap(data));
+ okim6295_w( device, 0, (aquarium_snd_bitswap(data)) );
}
@@ -165,9 +165,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( snd_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
- AM_RANGE(0x02, 0x02) AM_READWRITE(aquarium_oki_r, aquarium_oki_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0x02, 0x02) AM_DEVREADWRITE(SOUND, "oki", aquarium_oki_r, aquarium_oki_w)
AM_RANGE(0x04, 0x04) AM_READ(soundlatch_r)
AM_RANGE(0x06, 0x06) AM_WRITE(aquarium_snd_ack_w)
AM_RANGE(0x08, 0x08) AM_WRITE(aquarium_z80_bank_w)
@@ -330,9 +329,9 @@ static GFXDECODE_START( aquarium )
GFXDECODE_ENTRY( "gfx4", 0, char5bpplayout, 0x400, 32 )
GFXDECODE_END
-static void irq_handler(running_machine *machine, int irq)
+static void irq_handler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1], 0 , irq ? ASSERT_LINE : CLEAR_LINE );
+ cpu_set_input_line(device->machine->cpu[1], 0 , irq ? ASSERT_LINE : CLEAR_LINE );
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/arabian.c b/src/mame/drivers/arabian.c
index 47a9b1e5b40..ce247549430 100644
--- a/src/mame/drivers/arabian.c
+++ b/src/mame/drivers/arabian.c
@@ -89,7 +89,7 @@ static UINT8 *custom_cpu_ram;
*
*************************************/
-static WRITE8_HANDLER( ay8910_porta_w )
+static WRITE8_DEVICE_HANDLER( ay8910_porta_w )
{
/*
bit 7 = ENA
@@ -102,7 +102,7 @@ static WRITE8_HANDLER( ay8910_porta_w )
}
-static WRITE8_HANDLER( ay8910_portb_w )
+static WRITE8_DEVICE_HANDLER( ay8910_portb_w )
{
/*
bit 5 = /IREQ to custom CPU
@@ -230,8 +230,8 @@ ADDRESS_MAP_END
*************************************/
static ADDRESS_MAP_START( main_io_map, ADDRESS_SPACE_IO, 8 )
- AM_RANGE(0xc800, 0xc800) AM_MIRROR(0x01ff) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xca00, 0xca00) AM_MIRROR(0x01ff) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0xc800, 0xc800) AM_MIRROR(0x01ff) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
+ AM_RANGE(0xca00, 0xca00) AM_MIRROR(0x01ff) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
ADDRESS_MAP_END
@@ -347,10 +347,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- ay8910_porta_w,
- ay8910_portb_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(ay8910_porta_w),
+ DEVCB_HANDLER(ay8910_portb_w)
};
diff --git a/src/mame/drivers/arcadecl.c b/src/mame/drivers/arcadecl.c
index 991715eaf89..45aef63670a 100644
--- a/src/mame/drivers/arcadecl.c
+++ b/src/mame/drivers/arcadecl.c
@@ -114,26 +114,6 @@ static MACHINE_RESET( arcadecl )
/*************************************
*
- * MSM6295 I/O
- *
- *************************************/
-
-static READ16_HANDLER( adpcm_r )
-{
- return (okim6295_status_0_r(space, offset) << 8) | 0x00ff;
-}
-
-
-static WRITE16_HANDLER( adpcm_w )
-{
- if (ACCESSING_BITS_8_15)
- okim6295_data_0_w(space, offset, (data >> 8) & 0xff);
-}
-
-
-
-/*************************************
- *
* Latch write
*
*************************************/
@@ -149,7 +129,7 @@ static WRITE16_HANDLER( latch_w )
/* lower byte being modified? */
if (ACCESSING_BITS_0_7)
{
- okim6295_set_bank_base(0, (data & 0x80) ? 0x40000 : 0x00000);
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki"), (data & 0x80) ? 0x40000 : 0x00000);
atarigen_set_oki6295_vol(space->machine, (data & 0x001f) * 100 / 0x1f);
}
}
@@ -180,7 +160,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x640040, 0x64004f) AM_WRITE(latch_w)
AM_RANGE(0x640060, 0x64006f) AM_WRITE(atarigen_eeprom_enable_w)
AM_RANGE(0x641000, 0x641fff) AM_READWRITE(atarigen_eeprom_r, atarigen_eeprom_w) AM_BASE(&atarigen_eeprom) AM_SIZE(&atarigen_eeprom_size)
- AM_RANGE(0x642000, 0x642001) AM_READWRITE(adpcm_r, adpcm_w)
+ AM_RANGE(0x642000, 0x642001) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0xff00)
AM_RANGE(0x646000, 0x646fff) AM_WRITE(atarigen_scanline_int_ack_w)
AM_RANGE(0x647000, 0x647fff) AM_WRITE(watchdog_reset16_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/arcadia.c b/src/mame/drivers/arcadia.c
index 427d02a2296..e57d356e2d6 100644
--- a/src/mame/drivers/arcadia.c
+++ b/src/mame/drivers/arcadia.c
@@ -49,7 +49,6 @@
#include "driver.h"
#include "cpu/m68000/m68000.h"
-#include "sound/custom.h"
#include "includes/amiga.h"
#include "machine/6526cia.h"
@@ -254,19 +253,6 @@ INPUT_PORTS_END
/*************************************
*
- * Sound definitions
- *
- *************************************/
-
-static const custom_sound_interface amiga_custom_interface =
-{
- amiga_sh_start
-};
-
-
-
-/*************************************
- *
* Machine driver
*
*************************************/
@@ -318,8 +304,7 @@ static MACHINE_DRIVER_START( arcadia )
/* sound hardware */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("amiga", CUSTOM, 3579545)
- MDRV_SOUND_CONFIG(amiga_custom_interface)
+ MDRV_SOUND_ADD("amiga", AMIGA, 3579545)
MDRV_SOUND_ROUTE(0, "left", 0.50)
MDRV_SOUND_ROUTE(1, "right", 0.50)
MDRV_SOUND_ROUTE(2, "right", 0.50)
diff --git a/src/mame/drivers/argus.c b/src/mame/drivers/argus.c
index b24f4a1b335..f39f73dbcbd 100644
--- a/src/mame/drivers/argus.c
+++ b/src/mame/drivers/argus.c
@@ -108,9 +108,9 @@ static INTERRUPT_GEN( argus_interrupt )
}
/* Handler called by the YM2203 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface ym2203_config =
@@ -118,7 +118,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
irqhandler
};
@@ -236,17 +236,14 @@ ADDRESS_MAP_END
#if 0
static ADDRESS_MAP_START( sound_portmap_1, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym1", ym2203_r, ym2203_w)
ADDRESS_MAP_END
#endif
static ADDRESS_MAP_START( sound_portmap_2, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
- AM_RANGE(0x80, 0x80) AM_READWRITE(ym2203_status_port_1_r, ym2203_control_port_1_w)
- AM_RANGE(0x81, 0x81) AM_READWRITE(ym2203_read_port_1_r, ym2203_write_port_1_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym1", ym2203_r, ym2203_w)
+ AM_RANGE(0x80, 0x81) AM_DEVREADWRITE(SOUND, "ym2", ym2203_r, ym2203_w)
ADDRESS_MAP_END
@@ -546,7 +543,7 @@ static MACHINE_DRIVER_START( argus )
MDRV_SPEAKER_STANDARD_MONO("mono")
#if 0
- MDRV_SOUND_ADD("ym", YM2203, 6000000 / 4)
+ MDRV_SOUND_ADD("ym1", YM2203, 6000000 / 4)
MDRV_SOUND_CONFIG(ym2203_config)
MDRV_SOUND_ROUTE(0, "mono", 0.15)
MDRV_SOUND_ROUTE(1, "mono", 0.15)
diff --git a/src/mame/drivers/aristmk5.c b/src/mame/drivers/aristmk5.c
index cdb35856382..3f6ca043357 100644
--- a/src/mame/drivers/aristmk5.c
+++ b/src/mame/drivers/aristmk5.c
@@ -45,7 +45,7 @@ static MACHINE_START( aristmk5 )
archimedes_init(machine);
// reset the DAC to centerline
- dac_signed_data_w(0, 0x80);
+ dac_signed_data_w(devtag_get_device(machine, SOUND, "dac"), 0x80);
}
static MACHINE_RESET( aristmk5 )
diff --git a/src/mame/drivers/arkanoid.c b/src/mame/drivers/arkanoid.c
index b47d3a52561..008f5995c87 100644
--- a/src/mame/drivers/arkanoid.c
+++ b/src/mame/drivers/arkanoid.c
@@ -484,8 +484,8 @@ int arkanoid_bootleg_id;
static ADDRESS_MAP_START( arkanoid_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xc7ff) AM_RAM
- AM_RANGE(0xd000, 0xd000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xd001, 0xd001) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
+ AM_RANGE(0xd000, 0xd001) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0xd001, 0xd001) AM_DEVREAD(SOUND, "ay", ay8910_r)
AM_RANGE(0xd008, 0xd008) AM_WRITE(arkanoid_d008_w) /* gfx bank, flip screen etc. */
AM_RANGE(0xd00c, 0xd00c) AM_READ_PORT("SYSTEM") /* 2 bits from the 68705 */
AM_RANGE(0xd010, 0xd010) AM_READ_PORT("BUTTONS") AM_WRITE(watchdog_reset_w)
@@ -499,8 +499,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( bootleg_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xc7ff) AM_RAM
- AM_RANGE(0xd000, 0xd000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xd001, 0xd001) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
+ AM_RANGE(0xd000, 0xd000) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
+ AM_RANGE(0xd001, 0xd001) AM_DEVREADWRITE(SOUND, "ay", ay8910_r, ay8910_data_w)
AM_RANGE(0xd008, 0xd008) AM_WRITE(arkanoid_d008_w) /* gfx bank, flip screen etc. */
AM_RANGE(0xd00c, 0xd00c) AM_READ_PORT("SYSTEM")
AM_RANGE(0xd010, 0xd010) AM_READ_PORT("BUTTONS") AM_WRITE(watchdog_reset_w)
@@ -751,10 +751,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_4_r,
- input_port_3_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("UNUSED"),
+ DEVCB_INPUT_PORT("DSW"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
/* Machine Drivers */
diff --git a/src/mame/drivers/armedf.c b/src/mame/drivers/armedf.c
index d445fc0afa9..e79e46524d5 100644
--- a/src/mame/drivers/armedf.c
+++ b/src/mame/drivers/armedf.c
@@ -427,10 +427,9 @@ static READ8_HANDLER( soundlatch_clear_r )
static ADDRESS_MAP_START( sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x0, 0x0) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x1, 0x1) AM_WRITE(ym3812_write_port_0_w)
- AM_RANGE(0x2, 0x2) AM_WRITE(dac_0_signed_data_w)
- AM_RANGE(0x3, 0x3) AM_WRITE(dac_1_signed_data_w)
+ AM_RANGE(0x0, 0x1) AM_DEVWRITE(SOUND, "ym", ym3812_w)
+ AM_RANGE(0x2, 0x2) AM_DEVWRITE(SOUND, "dac1", dac_signed_w)
+ AM_RANGE(0x3, 0x3) AM_DEVWRITE(SOUND, "dac2", dac_signed_w)
AM_RANGE(0x4, 0x4) AM_READ(soundlatch_clear_r)
AM_RANGE(0x6, 0x6) AM_READ(soundlatch_r)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/artmagic.c b/src/mame/drivers/artmagic.c
index b5fc1f6ce5f..ac6966ffba5 100644
--- a/src/mame/drivers/artmagic.c
+++ b/src/mame/drivers/artmagic.c
@@ -116,7 +116,7 @@ static WRITE16_HANDLER( control_w )
/* OKI banking here */
if (offset == 0)
- okim6295_set_bank_base(0, (((data >> 4) & 1) * 0x40000) % memory_region_length(space->machine, "oki"));
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki"), (((data >> 4) & 1) * 0x40000) % memory_region_length(space->machine, "oki"));
logerror("%06X:control_w(%d) = %04X\n", cpu_get_pc(space->cpu), offset, data);
}
@@ -421,7 +421,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x30000a, 0x30000b) AM_READ_PORT("30000a")
AM_RANGE(0x300000, 0x300003) AM_WRITE(control_w) AM_BASE(&control)
AM_RANGE(0x300004, 0x300007) AM_WRITE(protection_bit_w)
- AM_RANGE(0x360000, 0x360001) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x360000, 0x360001) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x380000, 0x380007) AM_READWRITE(tms_host_r, tms_host_w)
ADDRESS_MAP_END
@@ -440,7 +440,7 @@ static ADDRESS_MAP_START( stonebal_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x30000e, 0x30000f) AM_READ_PORT("30000e")
AM_RANGE(0x300000, 0x300003) AM_WRITE(control_w) AM_BASE(&control)
AM_RANGE(0x300004, 0x300007) AM_WRITE(protection_bit_w)
- AM_RANGE(0x340000, 0x340001) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x340000, 0x340001) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x380000, 0x380007) AM_READWRITE(tms_host_r, tms_host_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/ashnojoe.c b/src/mame/drivers/ashnojoe.c
index 786de5502ad..e2428662ea8 100644
--- a/src/mame/drivers/ashnojoe.c
+++ b/src/mame/drivers/ashnojoe.c
@@ -163,8 +163,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
AM_RANGE(0x02, 0x02) AM_WRITE(adpcm_w)
AM_RANGE(0x04, 0x04) AM_READ(sound_latch_r)
AM_RANGE(0x06, 0x06) AM_READ(sound_latch_status_r)
@@ -292,23 +291,23 @@ static GFXDECODE_START( ashnojoe )
GFXDECODE_END
-static void ym2203_irq_handler(running_machine *machine, int irq)
+static void ym2203_irq_handler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
}
-static WRITE8_HANDLER( ym2203_write_a )
+static WRITE8_DEVICE_HANDLER( ym2203_write_a )
{
/* This gets called at 8910 startup with 0xff before the 5205 exists, causing a crash */
if (data == 0xff)
return;
- msm5205_reset_w(0, !(data & 0x01));
+ msm5205_reset_w(device, !(data & 0x01));
}
-static WRITE8_HANDLER( ym2203_write_b )
+static WRITE8_DEVICE_HANDLER( ym2203_write_b )
{
- memory_set_bankptr(space->machine, 4, memory_region(space->machine, "adpcm") + ((data & 0xf) * 0x8000));
+ memory_set_bankptr(device->machine, 4, memory_region(device->machine, "adpcm") + ((data & 0xf) * 0x8000));
}
static const ym2203_interface ym2203_config =
@@ -316,10 +315,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- ym2203_write_a,
- ym2203_write_b,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_DEVICE_HANDLER(SOUND, "msm", ym2203_write_a),
+ DEVCB_HANDLER(ym2203_write_b),
},
ym2203_irq_handler
};
@@ -328,11 +327,11 @@ static void ashnojoe_vclk_cb(const device_config *device)
{
if (msm5205_vclk_toggle == 0)
{
- msm5205_data_w(0, adpcm_byte >> 4);
+ msm5205_data_w(device, adpcm_byte >> 4);
}
else
{
- msm5205_data_w(0, adpcm_byte & 0xf);
+ msm5205_data_w(device, adpcm_byte & 0xf);
cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE);
}
diff --git a/src/mame/drivers/asterix.c b/src/mame/drivers/asterix.c
index 5290638fd3f..cdde5ecdf4c 100644
--- a/src/mame/drivers/asterix.c
+++ b/src/mame/drivers/asterix.c
@@ -107,9 +107,9 @@ static INTERRUPT_GEN( asterix_interrupt )
mask used is 0 or 7 */
}
-static READ16_HANDLER( asterix_sound_r )
+static READ8_DEVICE_HANDLER( asterix_sound_r )
{
- return k053260_0_r(space,2 + offset);
+ return k053260_r(device,2 + offset);
}
static TIMER_CALLBACK( nmi_callback )
@@ -186,7 +186,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x380000, 0x380001) AM_READ_PORT("IN0")
AM_RANGE(0x380002, 0x380003) AM_READ(control1_r)
AM_RANGE(0x380100, 0x380101) AM_WRITE(control2_w)
- AM_RANGE(0x380200, 0x380203) AM_READWRITE(asterix_sound_r, k053260_0_lsb_w)
+ AM_RANGE(0x380200, 0x380203) AM_DEVREADWRITE8(SOUND, "konami", asterix_sound_r, k053260_w, 0x00ff)
AM_RANGE(0x380300, 0x380301) AM_WRITE(sound_irq_w)
AM_RANGE(0x380400, 0x380401) AM_WRITE(asterix_spritebank_w)
AM_RANGE(0x380500, 0x38051f) AM_WRITE(K053251_lsb_w)
@@ -201,10 +201,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_ROM
AM_RANGE(0xf000, 0xf7ff) AM_RAM
- AM_RANGE(0xf801, 0xf801) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
- AM_RANGE(0xfa00, 0xfa2f) AM_READWRITE(k053260_0_r, k053260_0_w)
+ AM_RANGE(0xf801, 0xf801) AM_DEVREADWRITE(SOUND, "ym", ym2151_status_port_r, ym2151_data_port_w)
+ AM_RANGE(0xfa00, 0xfa2f) AM_DEVREADWRITE(SOUND, "konami", k053260_r, k053260_w)
AM_RANGE(0xfc00, 0xfc00) AM_WRITE(sound_arm_nmi_w)
- AM_RANGE(0xfe00, 0xfe00) AM_WRITE(ym2151_register_port_0_w)
+ AM_RANGE(0xfe00, 0xfe00) AM_DEVWRITE(SOUND, "ym", ym2151_register_port_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/asteroid.c b/src/mame/drivers/asteroid.c
index cfc81a27fe1..78f8fa5ee4b 100644
--- a/src/mame/drivers/asteroid.c
+++ b/src/mame/drivers/asteroid.c
@@ -227,10 +227,10 @@ static ADDRESS_MAP_START( asteroid_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x3000, 0x3000) AM_WRITE(avgdvg_go_w)
AM_RANGE(0x3200, 0x3200) AM_WRITE(asteroid_bank_switch_w)
AM_RANGE(0x3400, 0x3400) AM_WRITE(watchdog_reset_w)
- AM_RANGE(0x3600, 0x3600) AM_WRITE(asteroid_explode_w)
- AM_RANGE(0x3a00, 0x3a00) AM_WRITE(asteroid_thump_w)
- AM_RANGE(0x3c00, 0x3c05) AM_WRITE(asteroid_sounds_w)
- AM_RANGE(0x3e00, 0x3e00) AM_WRITE(asteroid_noise_reset_w)
+ AM_RANGE(0x3600, 0x3600) AM_DEVWRITE(SOUND, "discrete", asteroid_explode_w)
+ AM_RANGE(0x3a00, 0x3a00) AM_DEVWRITE(SOUND, "discrete", asteroid_thump_w)
+ AM_RANGE(0x3c00, 0x3c05) AM_DEVWRITE(SOUND, "discrete", asteroid_sounds_w)
+ AM_RANGE(0x3e00, 0x3e00) AM_DEVWRITE(SOUND, "discrete", asteroid_noise_reset_w)
AM_RANGE(0x4000, 0x47ff) AM_RAM AM_BASE(&vectorram) AM_SIZE(&vectorram_size) AM_REGION("main", 0x4000)
AM_RANGE(0x5000, 0x57ff) AM_ROM /* vector rom */
AM_RANGE(0x6800, 0x7fff) AM_ROM
@@ -245,18 +245,18 @@ static ADDRESS_MAP_START( astdelux_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x2000, 0x2007) AM_READ(asteroid_IN0_r) /* IN0 */
AM_RANGE(0x2400, 0x2407) AM_READ(asteroid_IN1_r) /* IN1 */
AM_RANGE(0x2800, 0x2803) AM_READ(asteroid_DSW1_r) /* DSW1 */
- AM_RANGE(0x2c00, 0x2c0f) AM_READWRITE(pokey1_r, pokey1_w)
+ AM_RANGE(0x2c00, 0x2c0f) AM_DEVREADWRITE(SOUND, "pokey", pokey_r, pokey_w)
AM_RANGE(0x2c40, 0x2c7f) AM_READ(atari_vg_earom_r)
AM_RANGE(0x3000, 0x3000) AM_WRITE(avgdvg_go_w)
AM_RANGE(0x3200, 0x323f) AM_WRITE(atari_vg_earom_w)
AM_RANGE(0x3400, 0x3400) AM_WRITE(watchdog_reset_w)
- AM_RANGE(0x3600, 0x3600) AM_WRITE(asteroid_explode_w)
+ AM_RANGE(0x3600, 0x3600) AM_DEVWRITE(SOUND, "discrete", asteroid_explode_w)
AM_RANGE(0x3a00, 0x3a00) AM_WRITE(atari_vg_earom_ctrl_w)
AM_RANGE(0x3c00, 0x3c01) AM_WRITE(astdelux_led_w)
- AM_RANGE(0x3c03, 0x3c03) AM_WRITE(astdelux_sounds_w)
+ AM_RANGE(0x3c03, 0x3c03) AM_DEVWRITE(SOUND, "discrete", astdelux_sounds_w)
AM_RANGE(0x3c04, 0x3c04) AM_WRITE(astdelux_bank_switch_w)
AM_RANGE(0x3c05, 0x3c07) AM_WRITE(astdelux_coin_counter_w)
- AM_RANGE(0x3e00, 0x3e00) AM_WRITE(asteroid_noise_reset_w)
+ AM_RANGE(0x3e00, 0x3e00) AM_DEVWRITE(SOUND, "discrete", asteroid_noise_reset_w)
AM_RANGE(0x4000, 0x47ff) AM_RAM AM_BASE(&vectorram) AM_SIZE(&vectorram_size) AM_REGION("main", 0x4000)
AM_RANGE(0x4800, 0x57ff) AM_ROM /* vector rom */
AM_RANGE(0x6000, 0x7fff) AM_ROM
@@ -273,8 +273,8 @@ static ADDRESS_MAP_START( llander_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x3000, 0x3000) AM_WRITE(avgdvg_go_w)
AM_RANGE(0x3200, 0x3200) AM_WRITE(llander_led_w)
AM_RANGE(0x3400, 0x3400) AM_WRITE(watchdog_reset_w)
- AM_RANGE(0x3c00, 0x3c00) AM_WRITE(llander_sounds_w)
- AM_RANGE(0x3e00, 0x3e00) AM_WRITE(llander_snd_reset_w)
+ AM_RANGE(0x3c00, 0x3c00) AM_DEVWRITE(SOUND, "discrete", llander_sounds_w)
+ AM_RANGE(0x3e00, 0x3e00) AM_DEVWRITE(SOUND, "discrete", llander_snd_reset_w)
AM_RANGE(0x4000, 0x47ff) AM_RAM AM_BASE(&vectorram) AM_SIZE(&vectorram_size) AM_REGION("main", 0x4000)
AM_RANGE(0x4800, 0x5fff) AM_ROM /* vector rom */
AM_RANGE(0x6000, 0x7fff) AM_ROM
@@ -577,8 +577,8 @@ INPUT_PORTS_END
static const pokey_interface pokey_config =
{
- { 0 },
- input_port_3_r
+ { DEVCB_NULL },
+ DEVCB_INPUT_PORT("DSW2")
};
@@ -610,7 +610,7 @@ static MACHINE_DRIVER_START( asteroid )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("disc", DISCRETE, 0)
+ MDRV_SOUND_ADD("discrete", DISCRETE, 0)
MDRV_SOUND_CONFIG_DISCRETE(asteroid)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.4)
MACHINE_DRIVER_END
@@ -634,7 +634,7 @@ static MACHINE_DRIVER_START( astdelux )
MDRV_NVRAM_HANDLER(atari_vg)
/* sound hardware */
- MDRV_SOUND_REPLACE("disc", DISCRETE, 0)
+ MDRV_SOUND_REPLACE("discrete", DISCRETE, 0)
MDRV_SOUND_CONFIG_DISCRETE(astdelux)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
@@ -661,7 +661,7 @@ static MACHINE_DRIVER_START( llander )
MDRV_VIDEO_UPDATE(vector)
/* sound hardware */
- MDRV_SOUND_REPLACE("disc", DISCRETE, 0)
+ MDRV_SOUND_REPLACE("discrete", DISCRETE, 0)
MDRV_SOUND_CONFIG_DISCRETE(llander)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/astinvad.c b/src/mame/drivers/astinvad.c
index fed86680fd7..867d60b4b2d 100644
--- a/src/mame/drivers/astinvad.c
+++ b/src/mame/drivers/astinvad.c
@@ -257,14 +257,15 @@ static WRITE8_HANDLER( kamikaze_ppi_w )
static WRITE8_DEVICE_HANDLER( astinvad_sound1_w )
{
+ const device_config *samples = devtag_get_device(device->machine, SOUND, "samples");
int bits_gone_hi = data & ~sound_state[0];
sound_state[0] = data;
- if (bits_gone_hi & 0x01) sample_start(0, SND_UFO, 1);
- if (!(data & 0x01)) sample_stop(0);
- if (bits_gone_hi & 0x02) sample_start(1, SND_SHOT, 0);
- if (bits_gone_hi & 0x04) sample_start(2, SND_BASEHIT, 0);
- if (bits_gone_hi & 0x08) sample_start(3, SND_INVADERHIT, 0);
+ if (bits_gone_hi & 0x01) sample_start(samples, 0, SND_UFO, 1);
+ if (!(data & 0x01)) sample_stop(samples, 0);
+ if (bits_gone_hi & 0x02) sample_start(samples, 1, SND_SHOT, 0);
+ if (bits_gone_hi & 0x04) sample_start(samples, 2, SND_BASEHIT, 0);
+ if (bits_gone_hi & 0x08) sample_start(samples, 3, SND_INVADERHIT, 0);
sound_global_enable(data & 0x20);
screen_red = data & 0x04;
@@ -273,14 +274,15 @@ static WRITE8_DEVICE_HANDLER( astinvad_sound1_w )
static WRITE8_DEVICE_HANDLER( astinvad_sound2_w )
{
+ const device_config *samples = devtag_get_device(device->machine, SOUND, "samples");
int bits_gone_hi = data & ~sound_state[1];
sound_state[1] = data;
- if (bits_gone_hi & 0x01) sample_start(5, SND_FLEET1, 0);
- if (bits_gone_hi & 0x02) sample_start(5, SND_FLEET2, 0);
- if (bits_gone_hi & 0x04) sample_start(5, SND_FLEET3, 0);
- if (bits_gone_hi & 0x08) sample_start(5, SND_FLEET4, 0);
- if (bits_gone_hi & 0x10) sample_start(4, SND_UFOHIT, 0);
+ if (bits_gone_hi & 0x01) sample_start(samples, 5, SND_FLEET1, 0);
+ if (bits_gone_hi & 0x02) sample_start(samples, 5, SND_FLEET2, 0);
+ if (bits_gone_hi & 0x04) sample_start(samples, 5, SND_FLEET3, 0);
+ if (bits_gone_hi & 0x08) sample_start(samples, 5, SND_FLEET4, 0);
+ if (bits_gone_hi & 0x10) sample_start(samples, 4, SND_UFOHIT, 0);
screen_flip = (input_port_read(device->machine, "CABINET") & data & 0x20) ? 0xff : 0x00;
}
@@ -288,30 +290,32 @@ static WRITE8_DEVICE_HANDLER( astinvad_sound2_w )
static WRITE8_HANDLER( spaceint_sound1_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
int bits_gone_hi = data & ~sound_state[0];
sound_state[0] = data;
- if (bits_gone_hi & 0x01) sample_start(1, SND_SHOT, 0);
- if (bits_gone_hi & 0x02) sample_start(2, SND_BASEHIT, 0);
- if (bits_gone_hi & 0x04) sample_start(4, SND_UFOHIT, 0);
- if (bits_gone_hi & 0x08) sample_start(0, SND_UFO, 1);
- if (!(data & 0x08)) sample_stop(0);
+ if (bits_gone_hi & 0x01) sample_start(samples, 1, SND_SHOT, 0);
+ if (bits_gone_hi & 0x02) sample_start(samples, 2, SND_BASEHIT, 0);
+ if (bits_gone_hi & 0x04) sample_start(samples, 4, SND_UFOHIT, 0);
+ if (bits_gone_hi & 0x08) sample_start(samples, 0, SND_UFO, 1);
+ if (!(data & 0x08)) sample_stop(samples, 0);
- if (bits_gone_hi & 0x10) sample_start(5, SND_FLEET1, 0);
- if (bits_gone_hi & 0x20) sample_start(5, SND_FLEET2, 0);
- if (bits_gone_hi & 0x40) sample_start(5, SND_FLEET3, 0);
- if (bits_gone_hi & 0x80) sample_start(5, SND_FLEET4, 0);
+ if (bits_gone_hi & 0x10) sample_start(samples, 5, SND_FLEET1, 0);
+ if (bits_gone_hi & 0x20) sample_start(samples, 5, SND_FLEET2, 0);
+ if (bits_gone_hi & 0x40) sample_start(samples, 5, SND_FLEET3, 0);
+ if (bits_gone_hi & 0x80) sample_start(samples, 5, SND_FLEET4, 0);
}
static WRITE8_HANDLER( spaceint_sound2_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
int bits_gone_hi = data & ~sound_state[1];
sound_state[1] = data;
sound_global_enable(data & 0x02);
- if (bits_gone_hi & 0x04) sample_start(3, SND_INVADERHIT, 0);
+ if (bits_gone_hi & 0x04) sample_start(samples, 3, SND_INVADERHIT, 0);
screen_flip = (input_port_read(space->machine, "CABINET") & data & 0x80) ? 0xff : 0x00;
}
diff --git a/src/mame/drivers/astrocde.c b/src/mame/drivers/astrocde.c
index ed0f874a477..4eeb1c760e8 100644
--- a/src/mame/drivers/astrocde.c
+++ b/src/mame/drivers/astrocde.c
@@ -206,43 +206,45 @@ static WRITE8_HANDLER( seawolf2_lamps_w )
static WRITE8_HANDLER( seawolf2_sound_1_w ) // Port 40
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
UINT8 rising_bits = data & ~port_1_last;
port_1_last = data;
- if (rising_bits & 0x01) sample_start(1, 1, 0); /* Left Torpedo */
- if (rising_bits & 0x02) sample_start(0, 0, 0); /* Left Ship Hit */
- if (rising_bits & 0x04) sample_start(4, 4, 0); /* Left Mine Hit */
- if (rising_bits & 0x08) sample_start(6, 1, 0); /* Right Torpedo */
- if (rising_bits & 0x10) sample_start(5, 0, 0); /* Right Ship Hit */
- if (rising_bits & 0x20) sample_start(9, 4, 0); /* Right Mine Hit */
+ if (rising_bits & 0x01) sample_start(samples, 1, 1, 0); /* Left Torpedo */
+ if (rising_bits & 0x02) sample_start(samples, 0, 0, 0); /* Left Ship Hit */
+ if (rising_bits & 0x04) sample_start(samples, 4, 4, 0); /* Left Mine Hit */
+ if (rising_bits & 0x08) sample_start(samples, 6, 1, 0); /* Right Torpedo */
+ if (rising_bits & 0x10) sample_start(samples, 5, 0, 0); /* Right Ship Hit */
+ if (rising_bits & 0x20) sample_start(samples, 9, 4, 0); /* Right Mine Hit */
}
static WRITE8_HANDLER( seawolf2_sound_2_w ) // Port 41
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
UINT8 rising_bits = data & ~port_2_last;
port_2_last = data;
- sample_set_volume(0, (data & 0x80) ? 1.0 : 0.0);
- sample_set_volume(1, (data & 0x80) ? 1.0 : 0.0);
- sample_set_volume(3, (data & 0x80) ? 1.0 : 0.0);
- sample_set_volume(4, (data & 0x80) ? 1.0 : 0.0);
- sample_set_volume(5, (data & 0x80) ? 1.0 : 0.0);
- sample_set_volume(6, (data & 0x80) ? 1.0 : 0.0);
- sample_set_volume(8, (data & 0x80) ? 1.0 : 0.0);
- sample_set_volume(9, (data & 0x80) ? 1.0 : 0.0);
+ sample_set_volume(samples, 0, (data & 0x80) ? 1.0 : 0.0);
+ sample_set_volume(samples, 1, (data & 0x80) ? 1.0 : 0.0);
+ sample_set_volume(samples, 3, (data & 0x80) ? 1.0 : 0.0);
+ sample_set_volume(samples, 4, (data & 0x80) ? 1.0 : 0.0);
+ sample_set_volume(samples, 5, (data & 0x80) ? 1.0 : 0.0);
+ sample_set_volume(samples, 6, (data & 0x80) ? 1.0 : 0.0);
+ sample_set_volume(samples, 8, (data & 0x80) ? 1.0 : 0.0);
+ sample_set_volume(samples, 9, (data & 0x80) ? 1.0 : 0.0);
/* dive panning controlled by low 3 bits */
- sample_set_volume(2, (float)(~data & 0x07) / 7.0);
- sample_set_volume(7, (float)(data & 0x07) / 7.0);
+ sample_set_volume(samples, 2, (float)(~data & 0x07) / 7.0);
+ sample_set_volume(samples, 7, (float)(data & 0x07) / 7.0);
if (rising_bits & 0x08)
{
- sample_start(2, 2, 0);
- sample_start(7, 2, 0);
+ sample_start(samples, 2, 2, 0);
+ sample_start(samples, 7, 2, 0);
}
- if (rising_bits & 0x10) sample_start(8, 3, 0); /* Right Sonar */
- if (rising_bits & 0x20) sample_start(3, 3, 0); /* Left Sonar */
+ if (rising_bits & 0x10) sample_start(samples, 8, 3, 0); /* Right Sonar */
+ if (rising_bits & 0x20) sample_start(samples, 3, 3, 0); /* Left Sonar */
coin_counter_w(0, data & 0x40); /* Coin Counter */
}
@@ -334,8 +336,8 @@ static READ8_HANDLER( gorf_io_1_r )
case 4: astrocade_sparkle[2] = data; break;
case 5: astrocade_sparkle[3] = data; break;
case 6:
- sndti_set_output_gain(SOUND_ASTROCADE, 0, 0, data ? 0.0 : 1.0);
- sndti_set_output_gain(SOUND_SAMPLES, 0, 0, data ? 1.0 : 0.0);
+ sound_set_output_gain(devtag_get_device(space->machine, SOUND, "astrocade1"), 0, data ? 0.0 : 1.0);
+ sound_set_output_gain(devtag_get_device(space->machine, SOUND, "samples"), 0, data ? 1.0 : 0.0);
break;
case 7: mame_printf_debug("io_1:%d\n", data); break;
}
@@ -516,10 +518,10 @@ static const ay8910_interface ay8912_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_5_r,
- NULL,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DIPSW"),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
@@ -679,7 +681,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( port_map_stereo_pattern, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x0000, 0x0019) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(astrocade_data_chip_register_r, astrocade_data_chip_register_w)
- AM_RANGE(0x0050, 0x0058) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_WRITE(astrocade_sound2_w)
+ AM_RANGE(0x0050, 0x0058) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_DEVWRITE(SOUND, "astrocade2", astrocade_sound_w)
AM_RANGE(0x0078, 0x007e) AM_MIRROR(0xff00) AM_WRITE(astrocade_pattern_board_w)
AM_RANGE(0xa55b, 0xa55b) AM_WRITE(protected_ram_enable_w)
ADDRESS_MAP_END
@@ -687,7 +689,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( port_map_16col_pattern, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x0000, 0x0019) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(astrocade_data_chip_register_r, astrocade_data_chip_register_w)
- AM_RANGE(0x0050, 0x0058) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_WRITE(astrocade_sound2_w)
+ AM_RANGE(0x0050, 0x0058) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_DEVWRITE(SOUND, "astrocade2", astrocade_sound_w)
AM_RANGE(0x0078, 0x007e) AM_MIRROR(0xff00) AM_WRITE(astrocade_pattern_board_w)
AM_RANGE(0x00bf, 0x00bf) AM_MIRROR(0xff00) AM_WRITE(profpac_page_select_w)
AM_RANGE(0x00c3, 0x00c3) AM_MIRROR(0xff00) AM_READ(profpac_intercept_r)
@@ -712,9 +714,9 @@ static ADDRESS_MAP_START( tenpin_sub_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x90, 0x93) AM_DEVREADWRITE(Z80CTC, "ctc", z80ctc_r, z80ctc_w)
AM_RANGE(0x97, 0x97) AM_READ(soundlatch_r)
- AM_RANGE(0x98, 0x98) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x98, 0x98) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x9a, 0x9a) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x98, 0x98) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
+ AM_RANGE(0x98, 0x98) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x9a, 0x9a) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
ADDRESS_MAP_END
@@ -1295,7 +1297,7 @@ static MACHINE_DRIVER_START( astrocade_mono_sound )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("astrocade", ASTROCADE, ASTROCADE_CLOCK/4)
+ MDRV_SOUND_ADD("astrocade1", ASTROCADE, ASTROCADE_CLOCK/4)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/astrocorp.c b/src/mame/drivers/astrocorp.c
index 364352bb9ea..97213b988f8 100644
--- a/src/mame/drivers/astrocorp.c
+++ b/src/mame/drivers/astrocorp.c
@@ -114,11 +114,11 @@ static WRITE16_HANDLER( astrocorp_eeprom_w )
}
}
-static WRITE16_HANDLER( astrocorp_sound_bank_w )
+static WRITE16_DEVICE_HANDLER( astrocorp_sound_bank_w )
{
if (ACCESSING_BITS_8_15)
{
- okim6295_set_bank_base(0, 0x40000 * ((data >> 8) & 1) );
+ okim6295_set_bank_base(device, 0x40000 * ((data >> 8) & 1) );
// logerror("CPU #0 PC %06X: OKI bank %08X\n",cpu_get_pc(space->cpu),data);
}
}
@@ -177,15 +177,15 @@ static ADDRESS_MAP_START( showhand_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE( 0x05e000, 0x05e001 ) AM_READ( astrocorp_eeprom_r )
AM_RANGE( 0x060000, 0x0601ff ) AM_RAM_WRITE( astrocorp_palette_w ) AM_BASE( &paletteram16 )
AM_RANGE( 0x070000, 0x073fff ) AM_RAM
- AM_RANGE( 0x080000, 0x080001 ) AM_WRITE( astrocorp_sound_bank_w )
+ AM_RANGE( 0x080000, 0x080001 ) AM_DEVWRITE( SOUND, "oki", astrocorp_sound_bank_w )
AM_RANGE( 0x0a0000, 0x0a0001 ) AM_WRITE( astrocorp_enable_w )
- AM_RANGE( 0x0d0000, 0x0d0001 ) AM_READWRITE( astrocorp_unk_r, okim6295_data_0_msb_w )
+ AM_RANGE( 0x0d0000, 0x0d0001 ) AM_READ( astrocorp_unk_r ) AM_DEVWRITE8( SOUND, "oki", okim6295_w, 0xff00 )
ADDRESS_MAP_END
static ADDRESS_MAP_START( showhanc_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE( 0x000000, 0x01ffff ) AM_ROM
AM_RANGE( 0x060000, 0x0601ff ) AM_RAM_WRITE( astrocorp_palette_w ) AM_BASE( &paletteram16 )
- AM_RANGE( 0x070000, 0x070001 ) AM_WRITE( astrocorp_sound_bank_w )
+ AM_RANGE( 0x070000, 0x070001 ) AM_DEVWRITE( SOUND, "oki", astrocorp_sound_bank_w )
AM_RANGE( 0x080000, 0x080fff ) AM_RAM AM_BASE( &spriteram16 ) AM_SIZE( &spriteram_size )
AM_RANGE( 0x082000, 0x082001 ) AM_WRITE( SMH_NOP )
AM_RANGE( 0x084000, 0x084001 ) AM_READ_PORT( "INPUTS" )
@@ -194,7 +194,7 @@ static ADDRESS_MAP_START( showhanc_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE( 0x08e000, 0x08e001 ) AM_READ( astrocorp_eeprom_r )
AM_RANGE( 0x090000, 0x093fff ) AM_RAM
AM_RANGE( 0x0a0000, 0x0a0001 ) AM_WRITE( astrocorp_enable_w )
- AM_RANGE( 0x0e0000, 0x0e0001 ) AM_READWRITE( astrocorp_unk_r, okim6295_data_0_msb_w )
+ AM_RANGE( 0x0e0000, 0x0e0001 ) AM_READ( astrocorp_unk_r ) AM_DEVWRITE8( SOUND, "oki", okim6295_w, 0xff00 )
ADDRESS_MAP_END
/***************************************************************************
diff --git a/src/mame/drivers/asuka.c b/src/mame/drivers/asuka.c
index b2fa055269b..816ddd68dad 100644
--- a/src/mame/drivers/asuka.c
+++ b/src/mame/drivers/asuka.c
@@ -262,20 +262,25 @@ static WRITE8_HANDLER( sound_bankswitch_w )
memory_set_bankptr(space->machine, 1, memory_region(space->machine, "audio") + ((data-1) & 0x03) * 0x4000 + 0x10000 );
}
+static WRITE8_DEVICE_HANDLER( sound_bankswitch_2151_w )
+{
+ memory_set_bankptr(device->machine, 1, memory_region(device->machine, "audio") + ((data-1) & 0x03) * 0x4000 + 0x10000 );
+}
+
static void asuka_msm5205_vck(const device_config *device)
{
if (adpcm_data != -1)
{
- msm5205_data_w(0, adpcm_data & 0x0f);
+ msm5205_data_w(device, adpcm_data & 0x0f);
adpcm_data = -1;
}
else
{
adpcm_data = memory_region(device->machine, "ym")[adpcm_pos];
adpcm_pos = (adpcm_pos + 1) & 0xffff;
- msm5205_data_w(0, adpcm_data >> 4);
+ msm5205_data_w(device, adpcm_data >> 4);
}
}
@@ -284,14 +289,14 @@ static WRITE8_HANDLER( asuka_msm5205_address_w )
adpcm_pos = (adpcm_pos & 0x00ff) | (data << 8);
}
-static WRITE8_HANDLER( asuka_msm5205_start_w )
+static WRITE8_DEVICE_HANDLER( asuka_msm5205_start_w )
{
- msm5205_reset_w(0, 0);
+ msm5205_reset_w(device, 0);
}
-static WRITE8_HANDLER( asuka_msm5205_stop_w )
+static WRITE8_DEVICE_HANDLER( asuka_msm5205_stop_w )
{
- msm5205_reset_w(0, 1);
+ msm5205_reset_w(device, 1);
adpcm_pos &= 0xff00;
}
@@ -388,10 +393,7 @@ static ADDRESS_MAP_START( bonzeadv_z80_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM
AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(1)
AM_RANGE(0xc000, 0xdfff) AM_RAM
- AM_RANGE(0xe000, 0xe000) AM_READWRITE(ym2610_status_port_0_a_r, ym2610_control_port_0_a_w)
- AM_RANGE(0xe001, 0xe001) AM_READWRITE(ym2610_read_port_0_r, ym2610_data_port_0_a_w)
- AM_RANGE(0xe002, 0xe002) AM_READWRITE(ym2610_status_port_0_b_r, ym2610_control_port_0_b_w)
- AM_RANGE(0xe003, 0xe003) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0xe000, 0xe003) AM_DEVREADWRITE(SOUND, "ym", ym2610_r, ym2610_w)
AM_RANGE(0xe200, 0xe200) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xe201, 0xe201) AM_READWRITE(taitosound_slave_comm_r, taitosound_slave_comm_w)
AM_RANGE(0xe400, 0xe403) AM_WRITENOP /* pan */
@@ -405,14 +407,13 @@ static ADDRESS_MAP_START( z80_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM
AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(1)
AM_RANGE(0x8000, 0x8fff) AM_RAM
- AM_RANGE(0x9000, 0x9000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x9001, 0x9001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x9000, 0x9001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
// AM_RANGE(0x9002, 0x9100) AM_READ(SMH_RAM)
AM_RANGE(0xa000, 0xa000) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xa001, 0xa001) AM_READWRITE(taitosound_slave_comm_r, taitosound_slave_comm_w)
AM_RANGE(0xb000, 0xb000) AM_WRITE(asuka_msm5205_address_w)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(asuka_msm5205_start_w)
- AM_RANGE(0xd000, 0xd000) AM_WRITE(asuka_msm5205_stop_w)
+ AM_RANGE(0xc000, 0xc000) AM_DEVWRITE(SOUND, "msm", asuka_msm5205_start_w)
+ AM_RANGE(0xd000, 0xd000) AM_DEVWRITE(SOUND, "msm", asuka_msm5205_stop_w)
ADDRESS_MAP_END
/* no MSM5205 */
@@ -420,8 +421,7 @@ static ADDRESS_MAP_START( cadash_z80_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM
AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(1)
AM_RANGE(0x8000, 0x8fff) AM_RAM
- AM_RANGE(0x9000, 0x9000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x9001, 0x9001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x9000, 0x9001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0xa000, 0xa000) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xa001, 0xa001) AM_READWRITE(taitosound_slave_comm_r, taitosound_slave_comm_w)
ADDRESS_MAP_END
@@ -753,9 +753,9 @@ GFXDECODE_END
SOUND
**************************************************************/
-static void irq_handler(running_machine *machine, int irq)
+static void irq_handler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface ym2610_config =
@@ -767,7 +767,7 @@ static const ym2610_interface ym2610_config =
static const ym2151_interface ym2151_config =
{
irq_handler,
- sound_bankswitch_w
+ sound_bankswitch_2151_w
};
static const msm5205_interface msm5205_config =
diff --git a/src/mame/drivers/atarisy1.c b/src/mame/drivers/atarisy1.c
index a46e9028a48..e606ffe5510 100644
--- a/src/mame/drivers/atarisy1.c
+++ b/src/mame/drivers/atarisy1.c
@@ -404,35 +404,34 @@ static READ8_DEVICE_HANDLER( via_pa_r )
static WRITE8_DEVICE_HANDLER( via_pb_w )
{
- const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
UINT8 old = tms5220_ctl;
tms5220_ctl = data;
/* write strobe */
if (!(old & 1) && (tms5220_ctl & 1))
- tms5220_data_w(space, 0, tms5220_out_data);
+ tms5220_data_w(device, 0, tms5220_out_data);
/* read strobe */
if (!(old & 2) && (tms5220_ctl & 2))
- tms5220_in_data = tms5220_status_r(space, 0);
+ tms5220_in_data = tms5220_status_r(device, 0);
/* bit 4 is connected to an up-counter, clocked by SYCLKB */
data = 5 | ((data >> 3) & 2);
- tms5220_set_frequency(ATARI_CLOCK_14MHz/2 / (16 - data));
+ tms5220_set_frequency(device, ATARI_CLOCK_14MHz/2 / (16 - data));
}
static READ8_DEVICE_HANDLER( via_pb_r )
{
- return (!tms5220_ready_r() << 2) | (!tms5220_int_r() << 3);
+ return (!tms5220_ready_r(device) << 2) | (!tms5220_int_r(device) << 3);
}
static const via6522_interface via_interface =
{
- /*inputs : A/B */ DEVCB_HANDLER(via_pa_r), DEVCB_HANDLER(via_pb_r),
+ /*inputs : A/B */ DEVCB_HANDLER(via_pa_r), DEVCB_DEVICE_HANDLER(SOUND, "tms", via_pb_r),
/*inputs : CA/B1,CA/B2 */ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,
- /*outputs: A/B */ DEVCB_HANDLER(via_pa_w), DEVCB_HANDLER(via_pb_w),
+ /*outputs: A/B */ DEVCB_HANDLER(via_pa_w), DEVCB_DEVICE_HANDLER(SOUND, "tms", via_pb_w),
/*outputs: CA/B1,CA/B2 */ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,
/*irq */ DEVCB_NULL
};
@@ -495,12 +494,11 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_RAM
AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE(VIA6522, "via6522_0", via_r, via_w)
- AM_RANGE(0x1800, 0x1800) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x1800, 0x1801) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x1800, 0x1801) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x1810, 0x1810) AM_READWRITE(atarigen_6502_sound_r, atarigen_6502_sound_w)
AM_RANGE(0x1820, 0x1820) AM_READ(switch_6502_r)
AM_RANGE(0x1824, 0x1825) AM_WRITE(led_w)
- AM_RANGE(0x1870, 0x187f) AM_READWRITE(pokey1_r, pokey1_w)
+ AM_RANGE(0x1870, 0x187f) AM_DEVREADWRITE(SOUND, "pokey", pokey_r, pokey_w)
AM_RANGE(0x4000, 0xffff) AM_ROM
ADDRESS_MAP_END
diff --git a/src/mame/drivers/atarisy2.c b/src/mame/drivers/atarisy2.c
index 479082472e3..7709fdda175 100644
--- a/src/mame/drivers/atarisy2.c
+++ b/src/mame/drivers/atarisy2.c
@@ -392,7 +392,7 @@ static READ8_HANDLER( switch_6502_r )
if (atarigen_cpu_to_sound_ready) result ^= 0x01;
if (atarigen_sound_to_cpu_ready) result ^= 0x02;
- if (!has_tms5220 || tms5220_ready_r()) result ^= 0x04;
+ if (!has_tms5220 || tms5220_ready_r(devtag_get_device(space->machine, SOUND, "tms"))) result ^= 0x04;
if (!(input_port_read(space->machine, "1801") & 0x80)) result ^= 0x10;
return result;
@@ -406,7 +406,7 @@ static WRITE8_HANDLER( switch_6502_w )
if (has_tms5220)
{
data = 12 | ((data >> 5) & 1);
- tms5220_set_frequency(MASTER_CLOCK/4 / (16 - data) / 2);
+ tms5220_set_frequency(devtag_get_device(space->machine, SOUND, "tms"), MASTER_CLOCK/4 / (16 - data) / 2);
}
}
@@ -631,7 +631,7 @@ static WRITE8_HANDLER( sound_reset_w )
/* a large number of signals are reset when this happens */
atarigen_sound_io_reset(space->machine->cpu[1]);
- sndti_reset(SOUND_YM2151, 0);
+ devtag_reset(space->machine, SOUND, "ym");
mixer_w(space, 0, 0);
tms5220_data = 0;
tms5220_data_strobe = 0;
@@ -687,7 +687,10 @@ static WRITE8_HANDLER( tms5220_w )
static WRITE8_HANDLER( tms5220_strobe_w )
{
if (!(offset & 1) && tms5220_data_strobe && has_tms5220)
- tms5220_data_w(space, 0, tms5220_data);
+ {
+ const device_config *tms = devtag_get_device(space->machine, SOUND, "tms");
+ tms5220_data_w(tms, 0, tms5220_data);
+ }
tms5220_data_strobe = offset & 1;
}
@@ -748,12 +751,11 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_MIRROR(0x2000) AM_RAM
AM_RANGE(0x1000, 0x17ff) AM_MIRROR(0x2000) AM_RAM AM_BASE((UINT8 **)&atarigen_eeprom) AM_SIZE(&atarigen_eeprom_size)
- AM_RANGE(0x1800, 0x180f) AM_MIRROR(0x2780) AM_READWRITE(pokey1_r, pokey1_w)
+ AM_RANGE(0x1800, 0x180f) AM_MIRROR(0x2780) AM_DEVREADWRITE(SOUND, "pokey1", pokey_r, pokey_w)
AM_RANGE(0x1810, 0x1813) AM_MIRROR(0x278c) AM_READ(leta_r)
- AM_RANGE(0x1830, 0x183f) AM_MIRROR(0x2780) AM_READWRITE(pokey2_r, pokey2_w)
+ AM_RANGE(0x1830, 0x183f) AM_MIRROR(0x2780) AM_DEVREADWRITE(SOUND, "pokey2", pokey_r, pokey_w)
AM_RANGE(0x1840, 0x1840) AM_MIRROR(0x278f) AM_READ(switch_6502_r)
- AM_RANGE(0x1850, 0x1850) AM_MIRROR(0x278e) AM_READWRITE(ym2151_status_port_0_r, ym2151_register_port_0_w)
- AM_RANGE(0x1851, 0x1851) AM_MIRROR(0x278e) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x1850, 0x1851) AM_MIRROR(0x278e) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x1860, 0x1860) AM_MIRROR(0x278f) AM_READ(sound_6502_r)
AM_RANGE(0x1870, 0x1870) AM_MIRROR(0x2781) AM_WRITE(tms5220_w)
AM_RANGE(0x1872, 0x1873) AM_MIRROR(0x2780) AM_WRITE(tms5220_strobe_w)
@@ -1114,14 +1116,14 @@ GFXDECODE_END
static const pokey_interface pokey_interface_1 =
{
- { 0 },
- input_port_11_r
+ { DEVCB_NULL },
+ DEVCB_INPUT_PORT("DSW0")
};
static const pokey_interface pokey_interface_2 =
{
- { 0 },
- input_port_12_r
+ { DEVCB_NULL },
+ DEVCB_INPUT_PORT("DSW1")
};
diff --git a/src/mame/drivers/ataxx.c b/src/mame/drivers/ataxx.c
index 5a791e7aa28..e2a947f05bb 100644
--- a/src/mame/drivers/ataxx.c
+++ b/src/mame/drivers/ataxx.c
@@ -31,7 +31,6 @@
#include "cpu/z80/z80.h"
#include "leland.h"
#include "sound/2151intf.h"
-#include "sound/custom.h"
#define MASTER_CLOCK XTAL_28_63636MHz
@@ -288,19 +287,6 @@ INPUT_PORTS_END
/*************************************
*
- * Sound definitions
- *
- *************************************/
-
-static const custom_sound_interface i80186_custom_interface =
-{
- leland_80186_sh_start
-};
-
-
-
-/*************************************
- *
* Machine driver
*
*************************************/
@@ -330,8 +316,7 @@ static MACHINE_DRIVER_START( ataxx )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("leland", CUSTOM, 0)
- MDRV_SOUND_CONFIG(i80186_custom_interface)
+ MDRV_SOUND_ADD("leland", LELAND_80186, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/atetris.c b/src/mame/drivers/atetris.c
index 914aa82b0e4..5fd6d302c62 100644
--- a/src/mame/drivers/atetris.c
+++ b/src/mame/drivers/atetris.c
@@ -209,8 +209,8 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(atetris_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size)
AM_RANGE(0x2000, 0x20ff) AM_MIRROR(0x0300) AM_RAM_WRITE(paletteram_RRRGGGBB_w) AM_BASE(&paletteram)
AM_RANGE(0x2400, 0x25ff) AM_MIRROR(0x0200) AM_RAM_WRITE(nvram_w) AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
- AM_RANGE(0x2800, 0x280f) AM_MIRROR(0x03e0) AM_READWRITE(pokey1_r, pokey1_w)
- AM_RANGE(0x2810, 0x281f) AM_MIRROR(0x03e0) AM_READWRITE(pokey2_r, pokey2_w)
+ AM_RANGE(0x2800, 0x280f) AM_MIRROR(0x03e0) AM_DEVREADWRITE(SOUND, "pokey1", pokey_r, pokey_w)
+ AM_RANGE(0x2810, 0x281f) AM_MIRROR(0x03e0) AM_DEVREADWRITE(SOUND, "pokey2", pokey_r, pokey_w)
AM_RANGE(0x3000, 0x3000) AM_MIRROR(0x03ff) AM_WRITE(watchdog_reset_w)
AM_RANGE(0x3400, 0x3400) AM_MIRROR(0x03ff) AM_WRITE(nvram_enable_w)
AM_RANGE(0x3800, 0x3800) AM_MIRROR(0x03ff) AM_WRITE(irq_ack_w)
@@ -226,9 +226,9 @@ static ADDRESS_MAP_START( atetrsb2_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(atetris_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size)
AM_RANGE(0x2000, 0x20ff) AM_RAM_WRITE(paletteram_RRRGGGBB_w) AM_BASE(&paletteram)
AM_RANGE(0x2400, 0x25ff) AM_RAM_WRITE(nvram_w) AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
- AM_RANGE(0x2802, 0x2802) AM_WRITE(sn76496_0_w)
- AM_RANGE(0x2804, 0x2804) AM_WRITE(sn76496_1_w)
- AM_RANGE(0x2806, 0x2806) AM_WRITE(sn76496_2_w)
+ AM_RANGE(0x2802, 0x2802) AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0x2804, 0x2804) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
+ AM_RANGE(0x2806, 0x2806) AM_DEVWRITE(SOUND, "sn3", sn76496_w)
AM_RANGE(0x2808, 0x2808) AM_READ_PORT("IN0")
AM_RANGE(0x2818, 0x2818) AM_READ_PORT("IN1")
AM_RANGE(0x3000, 0x3000) AM_WRITE(watchdog_reset_w)
@@ -320,15 +320,15 @@ GFXDECODE_END
static const pokey_interface pokey_interface_1 =
{
- { 0 },
- input_port_0_r
+ { DEVCB_NULL },
+ DEVCB_INPUT_PORT("IN0")
};
static const pokey_interface pokey_interface_2 =
{
- { 0 },
- input_port_1_r
+ { DEVCB_NULL },
+ DEVCB_INPUT_PORT("IN1")
};
diff --git a/src/mame/drivers/attckufo.c b/src/mame/drivers/attckufo.c
index 6f5c543f4b6..81e80485583 100644
--- a/src/mame/drivers/attckufo.c
+++ b/src/mame/drivers/attckufo.c
@@ -47,11 +47,6 @@ LOIPOIO-B
#include "includes/attckufo.h"
-static const custom_sound_interface attckufo_sound_interface =
-{
- attckufo_custom_start
-};
-
static UINT8 *mainram;
static UINT8 *tileram;
@@ -149,8 +144,7 @@ static MACHINE_DRIVER_START( attckufo )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("attckufo", CUSTOM, 0)
- MDRV_SOUND_CONFIG(attckufo_sound_interface)
+ MDRV_SOUND_ADD("attckufo", ATTCKUFO, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/avalnche.c b/src/mame/drivers/avalnche.c
index 443e9321987..a0655d812d6 100644
--- a/src/mame/drivers/avalnche.c
+++ b/src/mame/drivers/avalnche.c
@@ -140,12 +140,12 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x2003, 0x2003) AM_MIRROR(0x0ffc) AM_READ(SMH_NOP)
AM_RANGE(0x3000, 0x3000) AM_MIRROR(0x0fff) AM_WRITE(watchdog_reset_w)
AM_RANGE(0x4000, 0x4000) AM_MIRROR(0x0ff8) AM_WRITE(avalance_credit_1_lamp_w)
- AM_RANGE(0x4001, 0x4001) AM_MIRROR(0x0ff8) AM_WRITE(avalnche_attract_enable_w)
+ AM_RANGE(0x4001, 0x4001) AM_MIRROR(0x0ff8) AM_DEVWRITE(SOUND, "discrete", avalnche_attract_enable_w)
AM_RANGE(0x4002, 0x4002) AM_MIRROR(0x0ff8) AM_WRITE(avalance_video_invert_w)
AM_RANGE(0x4003, 0x4003) AM_MIRROR(0x0ff8) AM_WRITE(avalance_credit_2_lamp_w)
- AM_RANGE(0x4004, 0x4006) AM_MIRROR(0x0ff8) AM_WRITE(avalnche_audio_w)
+ AM_RANGE(0x4004, 0x4006) AM_MIRROR(0x0ff8) AM_DEVWRITE(SOUND, "discrete", avalnche_audio_w)
AM_RANGE(0x4007, 0x4007) AM_MIRROR(0x0ff8) AM_WRITE(avalance_start_lamp_w)
- AM_RANGE(0x5000, 0x5000) AM_MIRROR(0x0fff) AM_WRITE(avalnche_noise_amplitude_w)
+ AM_RANGE(0x5000, 0x5000) AM_MIRROR(0x0fff) AM_DEVWRITE(SOUND, "discrete", avalnche_noise_amplitude_w)
AM_RANGE(0x6000, 0x7fff) AM_ROM
ADDRESS_MAP_END
diff --git a/src/mame/drivers/aztarac.c b/src/mame/drivers/aztarac.c
index 2221492bde9..4c7723b7402 100644
--- a/src/mame/drivers/aztarac.c
+++ b/src/mame/drivers/aztarac.c
@@ -99,14 +99,10 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
AM_RANGE(0x8800, 0x8800) AM_READ(aztarac_snd_command_r)
- AM_RANGE(0x8c00, 0x8c00) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x8c01, 0x8c01) AM_READWRITE(ay8910_read_port_0_r, ay8910_control_port_0_w)
- AM_RANGE(0x8c02, 0x8c02) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
- AM_RANGE(0x8c03, 0x8c03) AM_READWRITE(ay8910_read_port_1_r, ay8910_control_port_1_w)
- AM_RANGE(0x8c04, 0x8c04) AM_READWRITE(ay8910_read_port_2_r, ay8910_write_port_2_w)
- AM_RANGE(0x8c05, 0x8c05) AM_READWRITE(ay8910_read_port_2_r, ay8910_control_port_2_w)
- AM_RANGE(0x8c06, 0x8c06) AM_READWRITE(ay8910_read_port_3_r, ay8910_write_port_3_w)
- AM_RANGE(0x8c07, 0x8c07) AM_READWRITE(ay8910_read_port_3_r, ay8910_control_port_3_w)
+ AM_RANGE(0x8c00, 0x8c01) AM_DEVREADWRITE(SOUND, "ay1", ay8910_r, ay8910_data_address_w)
+ AM_RANGE(0x8c02, 0x8c03) AM_DEVREADWRITE(SOUND, "ay2", ay8910_r, ay8910_data_address_w)
+ AM_RANGE(0x8c04, 0x8c05) AM_DEVREADWRITE(SOUND, "ay3", ay8910_r, ay8910_data_address_w)
+ AM_RANGE(0x8c06, 0x8c07) AM_DEVREADWRITE(SOUND, "ay4", ay8910_r, ay8910_data_address_w)
AM_RANGE(0x9000, 0x9000) AM_READWRITE(aztarac_snd_status_r, aztarac_snd_status_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/backfire.c b/src/mame/drivers/backfire.c
index ee199bf6ad7..934f3aa070f 100644
--- a/src/mame/drivers/backfire.c
+++ b/src/mame/drivers/backfire.c
@@ -265,20 +265,6 @@ static WRITE32_HANDLER(wcvol95_nonbuffered_palette_w)
palette_set_color_rgb(space->machine,offset,pal5bit(paletteram32[offset] >> 0),pal5bit(paletteram32[offset] >> 5),pal5bit(paletteram32[offset] >> 10));
}
-
-static READ32_HANDLER( deco156_snd_r )
-{
- return ymz280b_status_0_r(space, 0);
-}
-
-static WRITE32_HANDLER( deco156_snd_w )
-{
- if (offset)
- ymz280b_data_0_w(space, 0, data);
- else
- ymz280b_register_0_w(space, 0, data);
-}
-
/* map 32-bit writes to 16-bit */
static READ32_HANDLER( backfire_pf1_rowscroll_r ) { return deco16_pf1_rowscroll[offset]^0xffff0000; }
@@ -353,7 +339,7 @@ static ADDRESS_MAP_START( backfire_map, ADDRESS_SPACE_PROGRAM, 32 )
// AM_RANGE(0x1e8000, 0x1e8003) AM_READ(backfire_wheel1_r)
// AM_RANGE(0x1e8004, 0x1e8007) AM_READ(backfire_wheel2_r)
- AM_RANGE(0x1c0000, 0x1c0007) AM_READ(deco156_snd_r) AM_WRITE(deco156_snd_w)
+ AM_RANGE(0x1c0000, 0x1c0007) AM_DEVREADWRITE8(SOUND, "ymz", ymz280b_r, ymz280b_w, 0x000000ff)
ADDRESS_MAP_END
@@ -459,7 +445,7 @@ static GFXDECODE_START( backfire )
GFXDECODE_END
-static void sound_irq_gen(running_machine *machine, int state)
+static void sound_irq_gen(const device_config *device, int state)
{
logerror("sound irq\n");
}
diff --git a/src/mame/drivers/badlands.c b/src/mame/drivers/badlands.c
index 36725f65d71..2ffc2184562 100644
--- a/src/mame/drivers/badlands.c
+++ b/src/mame/drivers/badlands.c
@@ -337,8 +337,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_RAM
- AM_RANGE(0x2000, 0x2000) AM_READWRITE(ym2151_status_port_0_r, ym2151_register_port_0_w)
- AM_RANGE(0x2000, 0x2001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x2000, 0x2001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x2800, 0x2bff) AM_READWRITE(audio_io_r, audio_io_w)
AM_RANGE(0x3000, 0xffff) AM_ROM
ADDRESS_MAP_END
diff --git a/src/mame/drivers/bagman.c b/src/mame/drivers/bagman.c
index 289c1710507..ddb637da509 100644
--- a/src/mame/drivers/bagman.c
+++ b/src/mame/drivers/bagman.c
@@ -73,33 +73,33 @@ static int speech_rom_address = 0;
static UINT8 ls259_buf[8] = {0,0,0,0,0,0,0,0};
-static void start_talking (const address_space *space)
+static void start_talking (const device_config *tms)
{
speech_rom_address = 0x0;
- tms5110_ctl_w(space,0,TMS5110_CMD_SPEAK);
- tms5110_pdc_w(space,0,0);
- tms5110_pdc_w(space,0,1);
- tms5110_pdc_w(space,0,0);
+ tms5110_ctl_w(tms,0,TMS5110_CMD_SPEAK);
+ tms5110_pdc_w(tms,0,0);
+ tms5110_pdc_w(tms,0,1);
+ tms5110_pdc_w(tms,0,0);
}
-static void reset_talking (const address_space *space)
+static void reset_talking (const device_config *tms)
{
/*To be extremely accurate there should be a delays between each of
the function calls below. In real they happen with the frequency of 160 kHz.
*/
- tms5110_ctl_w(space,0,TMS5110_CMD_RESET);
- tms5110_pdc_w(space,0,0);
- tms5110_pdc_w(space,0,1);
- tms5110_pdc_w(space,0,0);
+ tms5110_ctl_w(tms,0,TMS5110_CMD_RESET);
+ tms5110_pdc_w(tms,0,0);
+ tms5110_pdc_w(tms,0,1);
+ tms5110_pdc_w(tms,0,0);
- tms5110_pdc_w(space,0,0);
- tms5110_pdc_w(space,0,1);
- tms5110_pdc_w(space,0,0);
+ tms5110_pdc_w(tms,0,0);
+ tms5110_pdc_w(tms,0,1);
+ tms5110_pdc_w(tms,0,0);
- tms5110_pdc_w(space,0,0);
- tms5110_pdc_w(space,0,1);
- tms5110_pdc_w(space,0,0);
+ tms5110_pdc_w(tms,0,0);
+ tms5110_pdc_w(tms,0,1);
+ tms5110_pdc_w(tms,0,0);
speech_rom_address = 0x0;
}
@@ -152,13 +152,14 @@ static WRITE8_HANDLER( bagman_ls259_w )
if (offset==3)
{
+ const device_config *tms = devtag_get_device(space->machine, SOUND, "tms");
if (ls259_buf[3] == 0) /* 1->0 transition */
{
- reset_talking(space);
+ reset_talking(tms);
}
else
{
- start_talking(space); /* 0->1 transition */
+ start_talking(tms); /* 0->1 transition */
}
}
}
@@ -220,15 +221,14 @@ static ADDRESS_MAP_START( pickin_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xa007, 0xa007) AM_WRITE(SMH_NOP) /* ???? */
/* guess */
- AM_RANGE(0xb000, 0xb000) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0xb800, 0xb800) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
+ AM_RANGE(0xb000, 0xb000) AM_DEVWRITE(SOUND, "ay2", ay8910_address_w)
+ AM_RANGE(0xb800, 0xb800) AM_DEVREADWRITE(SOUND, "ay2", ay8910_r, ay8910_data_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( main_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x08, 0x08) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x09, 0x09) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x0c, 0x0c) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0x08, 0x09) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0x0c, 0x0c) AM_DEVREAD(SOUND, "ay", ay8910_r)
//AM_RANGE(0x56, 0x56) AM_WRITE(SMH_NOP)
ADDRESS_MAP_END
@@ -429,19 +429,19 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r,
- input_port_1_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("P1"),
+ DEVCB_INPUT_PORT("P2"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
/* squaitsa doesn't map the dial directly, instead it polls the results of the dial thru an external circuitry.
I don't know if the following is correct, there can possbily be multiple solutions for the same problem. */
-static READ8_HANDLER( dial_input_p1_r )
+static READ8_DEVICE_HANDLER( dial_input_p1_r )
{
static UINT8 res,dial_val,old_val;
- dial_val = input_port_read(space->machine, "DIAL_P1");
+ dial_val = input_port_read(device->machine, "DIAL_P1");
if(res != 0x60)
res = 0x60;
@@ -454,14 +454,14 @@ static READ8_HANDLER( dial_input_p1_r )
old_val = dial_val;
- return (input_port_read(space->machine, "P1") & 0x9f) | (res);
+ return (input_port_read(device->machine, "P1") & 0x9f) | (res);
}
-static READ8_HANDLER( dial_input_p2_r )
+static READ8_DEVICE_HANDLER( dial_input_p2_r )
{
static UINT8 res,dial_val,old_val;
- dial_val = input_port_read(space->machine, "DIAL_P2");
+ dial_val = input_port_read(device->machine, "DIAL_P2");
if(res != 0x60)
res = 0x60;
@@ -474,27 +474,27 @@ static READ8_HANDLER( dial_input_p2_r )
old_val = dial_val;
- return (input_port_read(space->machine, "P2") & 0x9f) | (res);
+ return (input_port_read(device->machine, "P2") & 0x9f) | (res);
}
static const ay8910_interface ay8910_dial_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- dial_input_p1_r,
- dial_input_p2_r,
- NULL,
- NULL
+ DEVCB_HANDLER(dial_input_p1_r),
+ DEVCB_HANDLER(dial_input_p2_r),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- NULL,
- NULL
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const tms5110_interface bagman_tms5110_interface =
@@ -565,7 +565,7 @@ static MACHINE_DRIVER_START( pickin )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("ay1", AY8910, 1500000)
+ MDRV_SOUND_ADD("ay", AY8910, 1500000)
MDRV_SOUND_CONFIG(ay8910_config)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
@@ -620,7 +620,7 @@ static MACHINE_DRIVER_START( botanic )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("ay1", AY8910, 1500000)
+ MDRV_SOUND_ADD("ay", AY8910, 1500000)
MDRV_SOUND_CONFIG(ay8910_config)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
@@ -631,7 +631,7 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( squaitsa )
MDRV_IMPORT_FROM( botanic )
- MDRV_SOUND_MODIFY("ay1")
+ MDRV_SOUND_MODIFY("ay")
MDRV_SOUND_CONFIG(ay8910_dial_config)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/bankp.c b/src/mame/drivers/bankp.c
index 2d104be0aae..13543f1d06f 100644
--- a/src/mame/drivers/bankp.c
+++ b/src/mame/drivers/bankp.c
@@ -127,9 +127,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( bankp_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0") AM_WRITE(sn76496_0_w)
- AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1") AM_WRITE(sn76496_1_w)
- AM_RANGE(0x02, 0x02) AM_READ_PORT("IN2") AM_WRITE(sn76496_2_w)
+ AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0") AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1") AM_DEVWRITE(SOUND, "sn2", sn76496_w)
+ AM_RANGE(0x02, 0x02) AM_READ_PORT("IN2") AM_DEVWRITE(SOUND, "sn3", sn76496_w)
AM_RANGE(0x04, 0x04) AM_READ_PORT("DSW1")
AM_RANGE(0x05, 0x05) AM_WRITE(bankp_scroll_w)
AM_RANGE(0x07, 0x07) AM_WRITE(bankp_out_w)
diff --git a/src/mame/drivers/baraduke.c b/src/mame/drivers/baraduke.c
index 6b074341add..37407620564 100644
--- a/src/mame/drivers/baraduke.c
+++ b/src/mame/drivers/baraduke.c
@@ -178,7 +178,7 @@ static WRITE8_HANDLER( baraduke_irq_ack_w )
static ADDRESS_MAP_START( baraduke_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_READWRITE(baraduke_spriteram_r,baraduke_spriteram_w) AM_BASE(&baraduke_spriteram) /* Sprite RAM */
AM_RANGE(0x2000, 0x3fff) AM_READWRITE(baraduke_videoram_r,baraduke_videoram_w) AM_BASE(&baraduke_videoram) /* Video RAM */
- AM_RANGE(0x4000, 0x43ff) AM_READWRITE(namcos1_cus30_r,namcos1_cus30_w) /* PSG device, shared RAM */
+ AM_RANGE(0x4000, 0x43ff) AM_DEVREADWRITE(SOUND, "namco", namcos1_cus30_r,namcos1_cus30_w) /* PSG device, shared RAM */
AM_RANGE(0x4800, 0x4fff) AM_READWRITE(baraduke_textram_r,baraduke_textram_w) AM_BASE(&baraduke_textram)/* video RAM (text layer) */
AM_RANGE(0x8000, 0x8000) AM_WRITE(watchdog_reset_w) /* watchdog reset */
AM_RANGE(0x8800, 0x8800) AM_WRITE(baraduke_irq_ack_w) /* irq acknowledge */
@@ -198,7 +198,7 @@ static ADDRESS_MAP_START( mcu_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x001f) AM_READWRITE(hd63701_internal_registers_r,hd63701_internal_registers_w)/* internal registers */
AM_RANGE(0x0080, 0x00ff) AM_RAM /* built in RAM */
AM_RANGE(0x1105, 0x1105) AM_READ(soundkludge_r) /* cures speech */
- AM_RANGE(0x1000, 0x13ff) AM_READWRITE(namcos1_cus30_r,namcos1_cus30_w) AM_BASE(&namco_wavedata)/* PSG device, shared RAM */
+ AM_RANGE(0x1000, 0x13ff) AM_DEVREADWRITE(SOUND, "namco", namcos1_cus30_r,namcos1_cus30_w) AM_BASE(&namco_wavedata)/* PSG device, shared RAM */
AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_ROM) /* MCU external ROM */
AM_RANGE(0x8000, 0x8000) AM_WRITE(SMH_NOP) /* watchdog reset? */
AM_RANGE(0x8800, 0x8800) AM_WRITE(SMH_NOP) /* irq acknoledge? */
diff --git a/src/mame/drivers/battlane.c b/src/mame/drivers/battlane.c
index 9a91df0c9d8..de81204d2a1 100644
--- a/src/mame/drivers/battlane.c
+++ b/src/mame/drivers/battlane.c
@@ -11,7 +11,7 @@
#include "driver.h"
#include "cpu/m6809/m6809.h"
-#include "sound/3812intf.h"
+#include "sound/3526intf.h"
extern UINT8 *battlane_spriteram;
extern UINT8 *battlane_tileram;
@@ -97,8 +97,7 @@ static ADDRESS_MAP_START( battlane_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1c01, 0x1c01) AM_READ_PORT("P2") AM_WRITE(battlane_scrollx_w)
AM_RANGE(0x1c02, 0x1c02) AM_READ_PORT("DSW1") AM_WRITE(battlane_scrolly_w)
AM_RANGE(0x1c03, 0x1c03) AM_READ_PORT("DSW2") AM_WRITE(battlane_cpu_command_w)
- AM_RANGE(0x1c04, 0x1c04) AM_READWRITE(ym3526_status_port_0_r, ym3526_control_port_0_w)
- AM_RANGE(0x1c05, 0x1c05) AM_WRITE(ym3526_write_port_0_w)
+ AM_RANGE(0x1c04, 0x1c05) AM_DEVREADWRITE(SOUND, "ym", ym3526_r, ym3526_w)
AM_RANGE(0x1e00, 0x1e3f) AM_WRITE(battlane_palette_w)
AM_RANGE(0x2000, 0x3fff) AM_RAM_WRITE(battlane_bitmap_w) AM_SHARE(4)
AM_RANGE(0x4000, 0xffff) AM_ROM
@@ -241,9 +240,9 @@ static GFXDECODE_START( battlane )
GFXDECODE_END
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[0], M6809_FIRQ_LINE, irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[0], M6809_FIRQ_LINE, irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym3526_interface ym3526_config =
diff --git a/src/mame/drivers/battlera.c b/src/mame/drivers/battlera.c
index 7c62e101a18..c33bb1f73f8 100644
--- a/src/mame/drivers/battlera.c
+++ b/src/mame/drivers/battlera.c
@@ -93,21 +93,13 @@ ADDRESS_MAP_END
/******************************************************************************/
-static WRITE8_HANDLER( YM2203_w )
-{
- switch (offset) {
- case 0: ym2203_control_port_0_w(space,0,data); break;
- case 1: ym2203_write_port_0_w(space,0,data); break;
- }
-}
-
static int msm5205next;
static void battlera_adpcm_int(const device_config *device)
{
static int toggle;
- msm5205_data_w(0,msm5205next >> 4);
+ msm5205_data_w(device,msm5205next >> 4);
msm5205next<<=4;
toggle = 1 - toggle;
@@ -120,18 +112,18 @@ static WRITE8_HANDLER( battlera_adpcm_data_w )
msm5205next=data;
}
-static WRITE8_HANDLER( battlera_adpcm_reset_w )
+static WRITE8_DEVICE_HANDLER( battlera_adpcm_reset_w )
{
- msm5205_reset_w(0,0);
+ msm5205_reset_w(device,0);
}
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_ROM
- AM_RANGE(0x040000, 0x040001) AM_WRITE(YM2203_w)
+ AM_RANGE(0x040000, 0x040001) AM_DEVWRITE(SOUND, "ym", ym2203_w)
AM_RANGE(0x080000, 0x080001) AM_WRITE(battlera_adpcm_data_w)
- AM_RANGE(0x1fe800, 0x1fe80f) AM_WRITE(c6280_0_w)
+ AM_RANGE(0x1fe800, 0x1fe80f) AM_DEVWRITE(SOUND, "audio", c6280_w)
AM_RANGE(0x1f0000, 0x1f1fff) AM_RAMBANK(7) /* Main ram */
- AM_RANGE(0x1ff000, 0x1ff001) AM_READWRITE(soundlatch_r, battlera_adpcm_reset_w)
+ AM_RANGE(0x1ff000, 0x1ff001) AM_READ(soundlatch_r) AM_DEVWRITE(SOUND, "msm", battlera_adpcm_reset_w)
AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w)
ADDRESS_MAP_END
@@ -278,7 +270,7 @@ static MACHINE_DRIVER_START( battlera )
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.85)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.85)
- MDRV_SOUND_ADD("huc", C6280, 21477270/6)
+ MDRV_SOUND_ADD("audio", C6280, 21477270/6)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.60)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.60)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/battlex.c b/src/mame/drivers/battlex.c
index 424c8fd5ff1..a34579a7506 100644
--- a/src/mame/drivers/battlex.c
+++ b/src/mame/drivers/battlex.c
@@ -85,8 +85,7 @@ static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x10, 0x10) AM_WRITE(battlex_flipscreen_w)
/* verify all of these */
- AM_RANGE(0x22, 0x22) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x23, 0x23) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x22, 0x23) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
/* 0x30 looks like scroll, but can't be ? changes (increases or decreases)
depending on the direction your ship is facing on lev 2. at least */
diff --git a/src/mame/drivers/battlnts.c b/src/mame/drivers/battlnts.c
index 22345fb8394..444c44d939b 100644
--- a/src/mame/drivers/battlnts.c
+++ b/src/mame/drivers/battlnts.c
@@ -71,10 +71,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( battlnts_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM /* ROM 777c01.rom */
AM_RANGE(0x8000, 0x87ff) AM_RAM /* RAM */
- AM_RANGE(0xa000, 0xa000) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w) /* YM3812 (chip 1) */
- AM_RANGE(0xa001, 0xa001) AM_WRITE(ym3812_write_port_0_w) /* YM3812 (chip 1) */
- AM_RANGE(0xc000, 0xc000) AM_READWRITE(ym3812_status_port_1_r, ym3812_control_port_1_w) /* YM3812 (chip 2) */
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ym3812_write_port_1_w) /* YM3812 (chip 2) */
+ AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE(SOUND, "ym1", ym3812_r, ym3812_w) /* YM3812 (chip 1) */
+ AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE(SOUND, "ym2", ym3812_r, ym3812_w) /* YM3812 (chip 2) */
AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r) /* soundlatch_r */
ADDRESS_MAP_END
diff --git a/src/mame/drivers/bbusters.c b/src/mame/drivers/bbusters.c
index a335f1b8605..0be0ebc6fef 100644
--- a/src/mame/drivers/bbusters.c
+++ b/src/mame/drivers/bbusters.c
@@ -378,19 +378,13 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym2610_status_port_0_a_r, ym2610_control_port_0_a_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym2610_data_port_0_a_w)
- AM_RANGE(0x02, 0x02) AM_READWRITE(ym2610_status_port_0_b_r, ym2610_control_port_0_b_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(SOUND, "ym", ym2610_r, ym2610_w)
AM_RANGE(0xc0, 0xc1) AM_WRITE(SMH_NOP) /* -> Main CPU */
ADDRESS_MAP_END
static ADDRESS_MAP_START( sounda_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym2608_status_port_0_a_r, ym2608_control_port_0_a_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym2608_data_port_0_a_w)
- AM_RANGE(0x02, 0x02) AM_READWRITE(ym2608_status_port_0_b_r, ym2608_control_port_0_b_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ym2608_data_port_0_b_w)
+ AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(SOUND, "ym", ym2608_r, ym2608_w)
AM_RANGE(0xc0, 0xc1) AM_WRITE(SMH_NOP) /* -> Main CPU */
ADDRESS_MAP_END
@@ -626,9 +620,9 @@ GFXDECODE_END
/******************************************************************************/
-static void sound_irq( running_machine *machine, int irq )
+static void sound_irq( const device_config *device, int irq )
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2608_interface ym2608_config =
@@ -636,7 +630,7 @@ static const ym2608_interface ym2608_config =
{
AY8910_LEGACY_OUTPUT | AY8910_SINGLE_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
sound_irq
};
diff --git a/src/mame/drivers/berzerk.c b/src/mame/drivers/berzerk.c
index b991f1784cf..d44a92ac981 100644
--- a/src/mame/drivers/berzerk.c
+++ b/src/mame/drivers/berzerk.c
@@ -466,47 +466,42 @@ static VIDEO_UPDATE( berzerk )
*
*************************************/
-static const custom_sound_interface berzerk_custom_interface =
-{
- exidy_sh6840_sh_start,
- 0,
- exidy_sh6840_sh_reset
-};
-
-
static WRITE8_HANDLER( berzerk_audio_w )
{
+ const device_config *device;
int clock_divisor;
switch (offset)
{
/* offset 4 writes to the S14001A */
case 4:
+ device = devtag_get_device(space->machine, SOUND, "speech");
switch (data >> 6)
{
/* write data to the S14001 */
case 0:
/* only if not busy */
- if (!s14001a_bsy_0_r())
+ if (!s14001a_bsy_r(device))
{
- s14001a_reg_0_w(data & 0x3f);
+ s14001a_reg_w(device, data & 0x3f);
/* clock the chip -- via a 555 timer */
- s14001a_rst_0_w(1);
- s14001a_rst_0_w(0);
+ s14001a_rst_w(device, 1);
+ s14001a_rst_w(device, 0);
}
break;
case 1:
+ device = devtag_get_device(space->machine, SOUND, "speech");
/* volume */
- s14001a_set_volume(((data & 0x38) >> 3) + 1);
+ s14001a_set_volume(device, ((data & 0x38) >> 3) + 1);
/* clock control - the first LS161 divides the clock by 9 to 16, the 2nd by 8,
giving a final clock from 19.5kHz to 34.7kHz */
clock_divisor = 16 - (data & 0x07);
- s14001a_set_clock(S14001_CLOCK / clock_divisor / 8);
+ s14001a_set_clock(device, S14001_CLOCK / clock_divisor / 8);
break;
default: break; /* 2 and 3 are not connected */
@@ -530,7 +525,8 @@ static WRITE8_HANDLER( berzerk_audio_w )
static READ8_HANDLER( berzerk_audio_r )
{
- return ((offset == 4) && !s14001a_bsy_0_r()) ? 0x40 : 0x00;
+ const device_config *device = devtag_get_device(space->machine, SOUND, "speech");
+ return ((offset == 4) && !s14001a_bsy_r(device)) ? 0x40 : 0x00;
}
@@ -861,8 +857,7 @@ static MACHINE_DRIVER_START( berzerk )
MDRV_SOUND_ADD("speech", S14001A, 0) /* placeholder - the clock is software controllable */
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
- MDRV_SOUND_ADD("exidy", CUSTOM, 0)
- MDRV_SOUND_CONFIG(berzerk_custom_interface)
+ MDRV_SOUND_ADD("exidy", EXIDY, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/bestleag.c b/src/mame/drivers/bestleag.c
index 683ac99ac32..794bf982158 100644
--- a/src/mame/drivers/bestleag.c
+++ b/src/mame/drivers/bestleag.c
@@ -179,9 +179,9 @@ static WRITE16_HANDLER( bestleag_fgram_w )
tilemap_mark_tile_dirty(fg_tilemap,offset);
}
-static WRITE16_HANDLER( oki_bank_w )
+static WRITE16_DEVICE_HANDLER( oki_bank_w )
{
- okim6295_set_bank_base(0, 0x40000 * ((data & 3) - 1));
+ okim6295_set_bank_base(device, 0x40000 * ((data & 3) - 1));
}
@@ -201,8 +201,8 @@ static ADDRESS_MAP_START( bestleag_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x300014, 0x300015) AM_READ_PORT("P2")
AM_RANGE(0x300016, 0x300017) AM_READ_PORT("DSWA")
AM_RANGE(0x300018, 0x300019) AM_READ_PORT("DSWB")
- AM_RANGE(0x30001c, 0x30001d) AM_WRITE(oki_bank_w)
- AM_RANGE(0x30001e, 0x30001f) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x30001c, 0x30001d) AM_DEVWRITE(SOUND, "oki", oki_bank_w)
+ AM_RANGE(0x30001e, 0x30001f) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x304000, 0x304001) AM_WRITENOP
AM_RANGE(0xfe0000, 0xffffff) AM_RAM
ADDRESS_MAP_END
diff --git a/src/mame/drivers/bfcobra.c b/src/mame/drivers/bfcobra.c
index 530573aabc5..c852c3d99d6 100644
--- a/src/mame/drivers/bfcobra.c
+++ b/src/mame/drivers/bfcobra.c
@@ -1424,16 +1424,16 @@ static WRITE8_HANDLER( latch_w )
}
}
-static READ8_HANDLER( upd7759_r )
+static READ8_DEVICE_HANDLER( upd_r )
{
- return 2 | upd7759_busy_r(0);
+ return 2 | upd7759_busy_r(device);
}
-static WRITE8_HANDLER( upd7759_w )
+static WRITE8_DEVICE_HANDLER( upd_w )
{
- upd7759_reset_w(0, data & 0x80);
- upd7759_port_w(0, data & 0x3f);
- upd7759_start_w(0, data & 0x40 ? 0 : 1);
+ upd7759_reset_w(device, data & 0x80);
+ upd7759_port_w(device, 0, data & 0x3f);
+ upd7759_start_w(device, data & 0x40 ? 0 : 1);
}
static ADDRESS_MAP_START( m6809_prog_map, ADDRESS_SPACE_PROGRAM, 8 )
@@ -1444,8 +1444,8 @@ static ADDRESS_MAP_START( m6809_prog_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x2800, 0x2800) AM_RAM // W
AM_RANGE(0x2A00, 0x2A02) AM_READWRITE(latch_r, latch_w)
AM_RANGE(0x2E00, 0x2E00) AM_READ(int_latch_r)
- AM_RANGE(0x3001, 0x3001) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x3201, 0x3201) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x3001, 0x3001) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
+ AM_RANGE(0x3201, 0x3201) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
AM_RANGE(0x3404, 0x3404) AM_DEVREADWRITE(ACIA6850, "acia6850_1", acia6850_stat_r, acia6850_ctrl_w)
AM_RANGE(0x3405, 0x3405) AM_DEVREADWRITE(ACIA6850, "acia6850_1", acia6850_data_r, acia6850_data_w)
AM_RANGE(0x3406, 0x3406) AM_DEVREADWRITE(ACIA6850, "acia6850_2", acia6850_stat_r, acia6850_ctrl_w)
@@ -1453,7 +1453,7 @@ static ADDRESS_MAP_START( m6809_prog_map, ADDRESS_SPACE_PROGRAM, 8 )
// AM_RANGE(0x3408, 0x3408) AM_NOP
// AM_RANGE(0x340A, 0x340A) AM_NOP
// AM_RANGE(0x3600, 0x3600) AM_NOP
- AM_RANGE(0x3801, 0x3801) AM_READWRITE(upd7759_r, upd7759_w)
+ AM_RANGE(0x3801, 0x3801) AM_DEVREADWRITE(SOUND, "upd", upd_r, upd_w)
AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM)
AM_RANGE(0xf000, 0xf000) AM_WRITE(SMH_NOP) /* Watchdog */
ADDRESS_MAP_END
diff --git a/src/mame/drivers/bfm_sc2.c b/src/mame/drivers/bfm_sc2.c
index 43fee8f59d8..6817f850c80 100644
--- a/src/mame/drivers/bfm_sc2.c
+++ b/src/mame/drivers/bfm_sc2.c
@@ -344,7 +344,7 @@ static void on_scorpion2_reset(running_machine *machine)
e2ram_reset();
- sndti_reset(SOUND_YM2413, 0);
+ devtag_reset(machine, SOUND, "ym");
// reset stepper motors /////////////////////////////////////////////////
{
@@ -703,36 +703,38 @@ static WRITE8_HANDLER( volume_override_w )
if ( old != volume_override )
{
+ const device_config *ym = devtag_get_device(space->machine, SOUND, "ym");
+ const device_config *upd = devtag_get_device(space->machine, SOUND, "upd");
float percent = volume_override? 1.0f : (32-global_volume)/32.0f;
- sndti_set_output_gain(SOUND_YM2413, 0, 0, percent);
- sndti_set_output_gain(SOUND_YM2413, 0, 1, percent);
- sndti_set_output_gain(SOUND_UPD7759, 0, 0, percent);
+ sound_set_output_gain(ym, 0, percent);
+ sound_set_output_gain(ym, 1, percent);
+ sound_set_output_gain(upd, 0, percent);
}
}
///////////////////////////////////////////////////////////////////////////
-static WRITE8_HANDLER( nec_reset_w )
+static WRITE8_DEVICE_HANDLER( nec_reset_w )
{
- upd7759_start_w(0, 0);
- upd7759_reset_w(0, data);
+ upd7759_start_w(device, 0);
+ upd7759_reset_w(device, data);
}
///////////////////////////////////////////////////////////////////////////
-static WRITE8_HANDLER( nec_latch_w )
+static WRITE8_DEVICE_HANDLER( nec_latch_w )
{
int bank = 0;
if ( data & 0x80 ) bank |= 0x01;
if ( expansion_latch & 2 ) bank |= 0x02;
- upd7759_set_bank_base(0, bank*0x20000);
+ upd7759_set_bank_base(device, bank*0x20000);
- upd7759_port_w(0, data&0x3F); // setup sample
- upd7759_start_w(0, 0);
- upd7759_start_w(0, 1);
+ upd7759_port_w(device, 0, data&0x3F); // setup sample
+ upd7759_start_w(device, 0);
+ upd7759_start_w(device, 1);
}
///////////////////////////////////////////////////////////////////////////
@@ -779,7 +781,7 @@ static READ8_HANDLER( vfd_status_hop_r ) // on video games, hopper inputs are co
}
}
- if ( !upd7759_busy_r(0) ) result |= 0x80; // update sound busy input
+ if ( !upd7759_busy_r(devtag_get_device(space->machine, SOUND, "upd")) ) result |= 0x80; // update sound busy input
return result;
}
@@ -815,11 +817,13 @@ static WRITE8_HANDLER( expansion_latch_w )
}
{
+ const device_config *ym = devtag_get_device(space->machine, SOUND, "ym");
+ const device_config *upd = devtag_get_device(space->machine, SOUND, "upd");
float percent = volume_override ? 1.0f : (32-global_volume)/32.0f;
- sndti_set_output_gain(SOUND_YM2413, 0, 0, percent);
- sndti_set_output_gain(SOUND_YM2413, 0, 1, percent);
- sndti_set_output_gain(SOUND_UPD7759, 0, 0, percent);
+ sound_set_output_gain(ym, 0, percent);
+ sound_set_output_gain(ym, 1, percent);
+ sound_set_output_gain(upd, 0, percent);
}
}
}
@@ -1542,11 +1546,10 @@ static ADDRESS_MAP_START( memmap_vid, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x2800, 0x2800) AM_WRITE(vfd1_data_w) // vfd1 data
AM_RANGE(0x2900, 0x2900) AM_WRITE(vfd_reset_w) // vfd1+vfd2 reset line
- AM_RANGE(0x2A00, 0x2AFF) AM_WRITE(nec_latch_w) // this is where it reads?
- AM_RANGE(0x2B00, 0x2BFF) AM_WRITE(nec_reset_w) // upd7759 reset line
+ AM_RANGE(0x2A00, 0x2AFF) AM_DEVWRITE(SOUND, "upd", nec_latch_w) // this is where it reads?
+ AM_RANGE(0x2B00, 0x2BFF) AM_DEVWRITE(SOUND, "upd", nec_reset_w) // upd7759 reset line
AM_RANGE(0x2C00, 0x2C00) AM_WRITE(unlock_w) // custom chip unlock
- AM_RANGE(0x2D00, 0x2D00) AM_WRITE(ym2413_register_port_0_w)
- AM_RANGE(0x2D01, 0x2D01) AM_WRITE(ym2413_data_port_0_w)
+ AM_RANGE(0x2D00, 0x2D01) AM_DEVWRITE(SOUND, "ym", ym2413_w)
AM_RANGE(0x2E00, 0x2E00) AM_WRITE(bankswitch_w) // write bank (rom page select for 0x6000 - 0x7fff )
AM_RANGE(0x2F00, 0x2F00) AM_WRITE(vfd2_data_w) // vfd2 data
@@ -2728,7 +2731,7 @@ static READ8_HANDLER( vfd_status_r )
int result = optic_pattern;
- if ( !upd7759_busy_r(0) ) result |= 0x80;
+ if ( !upd7759_busy_r(devtag_get_device(space->machine, SOUND, "upd")) ) result |= 0x80;
return result;
}
@@ -2742,7 +2745,7 @@ static READ8_HANDLER( vfd_status_dm01_r )
int result = optic_pattern;
- if ( !upd7759_busy_r(0) ) result |= 0x80;
+ if ( !upd7759_busy_r(devtag_get_device(space->machine, SOUND, "upd")) ) result |= 0x80;
if ( BFM_dm01_busy() ) result |= 0x40;
@@ -2843,11 +2846,10 @@ static ADDRESS_MAP_START( sc2_memmap, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x2800, 0x2800) AM_WRITE(vfd1_data_w) /* vfd1 data */
AM_RANGE(0x2900, 0x2900) AM_WRITE(vfd_reset_w) /* vfd1+vfd2 reset line */
- AM_RANGE(0x2A00, 0x2AFF) AM_WRITE(nec_latch_w)
- AM_RANGE(0x2B00, 0x2BFF) AM_WRITE(nec_reset_w)
+ AM_RANGE(0x2A00, 0x2AFF) AM_DEVWRITE(SOUND, "upd", nec_latch_w)
+ AM_RANGE(0x2B00, 0x2BFF) AM_DEVWRITE(SOUND, "upd", nec_reset_w)
AM_RANGE(0x2C00, 0x2C00) AM_WRITE(unlock_w) /* custom chip unlock */
- AM_RANGE(0x2D00, 0x2D00) AM_WRITE(ym2413_register_port_0_w)
- AM_RANGE(0x2D01, 0x2D01) AM_WRITE(ym2413_data_port_0_w)
+ AM_RANGE(0x2D00, 0x2D01) AM_DEVWRITE(SOUND, "ym", ym2413_w)
AM_RANGE(0x2E00, 0x2E00) AM_WRITE(bankswitch_w) /* write bank (rom page select for 0x6000 - 0x7fff ) */
AM_RANGE(0x2F00, 0x2F00) AM_WRITE(vfd2_data_w) /* vfd2 data */
@@ -2893,11 +2895,10 @@ static ADDRESS_MAP_START( sc3_memmap, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x2800, 0x2800) AM_WRITE(vfd1_data_w)
AM_RANGE(0x2900, 0x2900) AM_WRITE(vfd_reset_w)
- AM_RANGE(0x2A00, 0x2AFF) AM_WRITE(nec_latch_w)
- AM_RANGE(0x2B00, 0x2BFF) AM_WRITE(nec_reset_w)
+ AM_RANGE(0x2A00, 0x2AFF) AM_DEVWRITE(SOUND, "upd", nec_latch_w)
+ AM_RANGE(0x2B00, 0x2BFF) AM_DEVWRITE(SOUND, "upd", nec_reset_w)
AM_RANGE(0x2C00, 0x2C00) AM_WRITE(unlock_w)
- AM_RANGE(0x2D00, 0x2D00) AM_WRITE(ym2413_register_port_0_w)
- AM_RANGE(0x2D01, 0x2D01) AM_WRITE(ym2413_data_port_0_w)
+ AM_RANGE(0x2D00, 0x2D01) AM_DEVWRITE(SOUND, "ym", ym2413_w)
AM_RANGE(0x2E00, 0x2E00) AM_WRITE(bankswitch_w)
AM_RANGE(0x2F00, 0x2F00) AM_WRITE(vfd2_data_w)
AM_RANGE(0x3FFF, 0x3FFF) AM_READ( coin_input_r)
@@ -2943,11 +2944,10 @@ static ADDRESS_MAP_START( memmap_sc2_dm01, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x2800, 0x2800) AM_WRITE(vfd1_data_dm01_w)
AM_RANGE(0x2900, 0x2900) AM_WRITE(vfd_reset_w)
- AM_RANGE(0x2A00, 0x2AFF) AM_WRITE(nec_latch_w)
- AM_RANGE(0x2B00, 0x2BFF) AM_WRITE(nec_reset_w)
+ AM_RANGE(0x2A00, 0x2AFF) AM_DEVWRITE(SOUND, "upd", nec_latch_w)
+ AM_RANGE(0x2B00, 0x2BFF) AM_DEVWRITE(SOUND, "upd", nec_reset_w)
AM_RANGE(0x2C00, 0x2C00) AM_WRITE(unlock_w)
- AM_RANGE(0x2D00, 0x2D00) AM_WRITE(ym2413_register_port_0_w)
- AM_RANGE(0x2D01, 0x2D01) AM_WRITE(ym2413_data_port_0_w)
+ AM_RANGE(0x2D00, 0x2D01) AM_DEVWRITE(SOUND, "ym", ym2413_w)
AM_RANGE(0x2E00, 0x2E00) AM_WRITE(bankswitch_w)
AM_RANGE(0x2F00, 0x2F00) AM_WRITE(vfd2_data_w)
AM_RANGE(0x3FFE, 0x3FFE) AM_READ( direct_input_r)
@@ -3899,7 +3899,7 @@ static MACHINE_DRIVER_START( scorpion2 )
MDRV_SOUND_ADD("upd",UPD7759, UPD7759_STANDARD_CLOCK)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
- MDRV_SOUND_ADD("ym2413",YM2413, XTAL_3_579545MHz)
+ MDRV_SOUND_ADD("ym",YM2413, XTAL_3_579545MHz)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_NVRAM_HANDLER(bfm_sc2)
@@ -3926,7 +3926,7 @@ static MACHINE_DRIVER_START( scorpion2_dm01 )
MDRV_CPU_PERIODIC_INT(timer_irq, 1000 )
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("ym2413",YM2413, XTAL_3_579545MHz)
+ MDRV_SOUND_ADD("ym",YM2413, XTAL_3_579545MHz)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD("upd",UPD7759, UPD7759_STANDARD_CLOCK)
diff --git a/src/mame/drivers/big10.c b/src/mame/drivers/big10.c
index 668105ecfe4..130c2f52f7e 100644
--- a/src/mame/drivers/big10.c
+++ b/src/mame/drivers/big10.c
@@ -104,7 +104,7 @@ static MACHINE_RESET(big10)
static UINT8 mux_data;
-static WRITE8_HANDLER( mux_w )
+static WRITE8_DEVICE_HANDLER( mux_w )
{
mux_data = ~data;
}
@@ -121,16 +121,6 @@ static READ8_HANDLER( mux_r )
return mux_data;
}
-static READ8_HANDLER( big10_dsw_1_r )
-{
- return input_port_read(space->machine, "DSW1");
-}
-
-static READ8_HANDLER( big10_dsw_2_r )
-{
- return input_port_read(space->machine, "DSW2");
-}
-
/**************************************
* Memory Map *
@@ -150,9 +140,8 @@ static ADDRESS_MAP_START( main_io, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x99, 0x99) AM_WRITE(v9938_0_command_w) AM_READ(v9938_0_status_r)
AM_RANGE(0x9a, 0x9a) AM_WRITE(v9938_0_palette_w)
AM_RANGE(0x9b, 0x9b) AM_WRITE(v9938_0_register_w)
- AM_RANGE(0xa0, 0xa0) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xa1, 0xa1) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xa2, 0xa2) AM_READ(ay8910_read_port_0_r) /* Dip-Switches routes here. */
+ AM_RANGE(0xa0, 0xa1) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0xa2, 0xa2) AM_DEVREAD(SOUND, "ay", ay8910_r) /* Dip-Switches routes here. */
ADDRESS_MAP_END
@@ -237,10 +226,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- big10_dsw_2_r,
- big10_dsw_1_r,
- mux_w,
- NULL
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_HANDLER(mux_w),
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/bigevglf.c b/src/mame/drivers/bigevglf.c
index b42ea77218b..5747db4e897 100644
--- a/src/mame/drivers/bigevglf.c
+++ b/src/mame/drivers/bigevglf.c
@@ -368,9 +368,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xc7ff) AM_RAM
- AM_RANGE(0xc800, 0xc800) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xc801, 0xc801) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xca00, 0xca0d) AM_WRITE(msm5232_0_w)
+ AM_RANGE(0xc800, 0xc801) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0xca00, 0xca0d) AM_DEVWRITE(SOUND, "msm", msm5232_w)
AM_RANGE(0xcc00, 0xcc00) AM_WRITE(SMH_NOP)
AM_RANGE(0xce00, 0xce00) AM_WRITE(SMH_NOP)
AM_RANGE(0xd800, 0xd800) AM_READWRITE(sound_command_r, beg_fromsound_w) /* write to D800 sets bit 1 in status */
diff --git a/src/mame/drivers/bigfghtr.c b/src/mame/drivers/bigfghtr.c
index 8441998c4ee..6ece1c544e0 100644
--- a/src/mame/drivers/bigfghtr.c
+++ b/src/mame/drivers/bigfghtr.c
@@ -366,10 +366,9 @@ static READ8_HANDLER( soundlatch_clear_r )
static ADDRESS_MAP_START( soundport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x0, 0x0) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x1, 0x1) AM_WRITE(ym3812_write_port_0_w)
- AM_RANGE(0x2, 0x2) AM_WRITE(dac_0_signed_data_w)
- AM_RANGE(0x3, 0x3) AM_WRITE(dac_1_signed_data_w)
+ AM_RANGE(0x0, 0x1) AM_DEVWRITE(SOUND, "ym", ym3812_w)
+ AM_RANGE(0x2, 0x2) AM_DEVWRITE(SOUND, "dac1", dac_signed_w)
+ AM_RANGE(0x3, 0x3) AM_DEVWRITE(SOUND, "dac2", dac_signed_w)
AM_RANGE(0x4, 0x4) AM_READ(soundlatch_clear_r)
AM_RANGE(0x6, 0x6) AM_READ(soundlatch_r)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/bigstrkb.c b/src/mame/drivers/bigstrkb.c
index f62f4b8696d..4df0eb63198 100644
--- a/src/mame/drivers/bigstrkb.c
+++ b/src/mame/drivers/bigstrkb.c
@@ -80,8 +80,8 @@ static ADDRESS_MAP_START( bigstrkb_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xB00000, 0xB00001) AM_WRITENOP
- AM_RANGE(0xE00000, 0xE00001) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
- AM_RANGE(0xE00002, 0xE00003) AM_READWRITE(okim6295_status_1_lsb_r, okim6295_data_1_lsb_w)
+ AM_RANGE(0xE00000, 0xE00001) AM_DEVREADWRITE8(SOUND, "oki1", okim6295_r, okim6295_w, 0x00ff)
+ AM_RANGE(0xE00002, 0xE00003) AM_DEVREADWRITE8(SOUND, "oki2", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0xE00008, 0xE00009) AM_WRITENOP
AM_RANGE(0xE0000c, 0xE0000d) AM_WRITENOP
diff --git a/src/mame/drivers/bingoc.c b/src/mame/drivers/bingoc.c
index 63b251ee82b..430f54853c7 100644
--- a/src/mame/drivers/bingoc.c
+++ b/src/mame/drivers/bingoc.c
@@ -81,15 +81,15 @@ static WRITE16_HANDLER( main_sound_latch_w )
}
#endif
-static WRITE8_HANDLER( bingoc_play_w )
+static WRITE8_DEVICE_HANDLER( bingoc_play_w )
{
/*
---- --x- sound rom banking
---- ---x start-stop sample
*/
- UINT8 *upd = memory_region(space->machine, "upd");
+ UINT8 *upd = memory_region(device->machine, "upd");
memcpy(&upd[0x00000], &upd[0x20000 + (((data & 2)>>1) * 0x20000)], 0x20000);
- upd7759_start_w(0, data & 1);
+ upd7759_start_w(device, data & 1);
// printf("%02x\n",data);
}
@@ -110,10 +110,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
- AM_RANGE(0x40, 0x40) AM_WRITE(bingoc_play_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(upd7759_0_port_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0x40, 0x40) AM_DEVWRITE(SOUND, "upd", bingoc_play_w)
+ AM_RANGE(0x80, 0x80) AM_DEVWRITE(SOUND, "upd", upd7759_port_w)
#if !SOUND_TEST
AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_r) //soundlatch
#else
diff --git a/src/mame/drivers/bionicc.c b/src/mame/drivers/bionicc.c
index b0775fb7950..342bf721e58 100644
--- a/src/mame/drivers/bionicc.c
+++ b/src/mame/drivers/bionicc.c
@@ -168,8 +168,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
- AM_RANGE(0x8000, 0x8000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x8001, 0x8001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x8000, 0x8001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
AM_RANGE(0xc000, 0xc7ff) AM_RAM
ADDRESS_MAP_END
diff --git a/src/mame/drivers/bishi.c b/src/mame/drivers/bishi.c
index 926cea642ef..85e7093d230 100644
--- a/src/mame/drivers/bishi.c
+++ b/src/mame/drivers/bishi.c
@@ -144,23 +144,6 @@ static READ16_HANDLER( bishi_mirror_r )
return paletteram16[offset];
}
-static READ16_HANDLER( bishi_sound_r )
-{
- return ymz280b_status_0_r(space, offset)<<8;
-}
-
-static WRITE16_HANDLER( bishi_sound_w )
-{
- if (offset)
- {
- ymz280b_data_0_w(space, offset, data>>8);
- }
- else
- {
- ymz280b_register_0_w(space, offset, data>>8);
- }
-}
-
static READ16_HANDLER( bishi_K056832_rom_r )
{
UINT16 ouroffs;
@@ -192,7 +175,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x840000, 0x840007) AM_WRITE(K056832_b_word_w) // VSCCS
AM_RANGE(0x850000, 0x85001f) AM_WRITE(K054338_word_w) // CLTC
AM_RANGE(0x870000, 0x8700ff) AM_WRITE(K055555_word_w) // PCU2
- AM_RANGE(0x880000, 0x880003) AM_READWRITE(bishi_sound_r, bishi_sound_w)
+ AM_RANGE(0x880000, 0x880003) AM_DEVREADWRITE8(SOUND, "ymz", ymz280b_r, ymz280b_w, 0xff00)
AM_RANGE(0xa00000, 0xa01fff) AM_READWRITE(K056832_ram_word_r, K056832_ram_word_w) // Graphic planes
AM_RANGE(0xb00000, 0xb03fff) AM_RAM_WRITE(paletteram16_xbgr_word_be_w) AM_BASE(&paletteram16)
AM_RANGE(0xb04000, 0xb047ff) AM_READ(bishi_mirror_r) // bug in the ram/rom test?
@@ -299,12 +282,12 @@ static MACHINE_RESET( bishi )
{
}
-static void sound_irq_gen(running_machine *machine, int state)
+static void sound_irq_gen(const device_config *device, int state)
{
if (state)
- cpu_set_input_line(machine->cpu[0], M68K_IRQ_1, ASSERT_LINE);
+ cpu_set_input_line(device->machine->cpu[0], M68K_IRQ_1, ASSERT_LINE);
else
- cpu_set_input_line(machine->cpu[0], M68K_IRQ_1, CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[0], M68K_IRQ_1, CLEAR_LINE);
}
static const ymz280b_interface ymz280b_intf =
diff --git a/src/mame/drivers/bishjan.c b/src/mame/drivers/bishjan.c
index ab9a30d9b8d..be83aff4a45 100644
--- a/src/mame/drivers/bishjan.c
+++ b/src/mame/drivers/bishjan.c
@@ -450,10 +450,10 @@ static WRITE8_HANDLER( saklove_outputs_w )
// popmessage("0: %02x - 1: %02x - 2: %02x - 3: %02x", saklove_outputs[0], saklove_outputs[1], saklove_outputs[2], saklove_outputs[3]);
}
-static WRITE8_HANDLER( saklove_oki_bank_w )
+static WRITE8_DEVICE_HANDLER( saklove_oki_bank_w )
{
// it writes 0x32 or 0x33
- okim6295_set_bank_base(0, (data & 1) * 0x40000);
+ okim6295_set_bank_base(device, (data & 1) * 0x40000);
}
static READ8_HANDLER( saklove_vblank_r )
@@ -511,9 +511,8 @@ static ADDRESS_MAP_START( saklove_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END
static ADDRESS_MAP_START( saklove_io, ADDRESS_SPACE_IO, 8 )
- AM_RANGE(0x0020, 0x0020) AM_READWRITE( okim6295_status_0_r, okim6295_data_0_w )
- AM_RANGE(0x0040, 0x0040) AM_WRITE( ym3812_control_port_0_w )
- AM_RANGE(0x0041, 0x0041) AM_WRITE( ym3812_write_port_0_w )
+ AM_RANGE(0x0020, 0x0020) AM_DEVREADWRITE( SOUND, "oki", okim6295_r, okim6295_w )
+ AM_RANGE(0x0040, 0x0041) AM_DEVWRITE( SOUND, "ym", ym3812_w )
AM_RANGE(0x0060, 0x0062) AM_WRITE( colordac_w )
@@ -531,7 +530,7 @@ static ADDRESS_MAP_START( saklove_io, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x0307, 0x0307) AM_READ ( saklove_dsw_r )
AM_RANGE(0x0308, 0x0308) AM_WRITE( saklove_dsw_mask_w )
- AM_RANGE(0x0312, 0x0312) AM_READWRITE( saklove_vblank_r, saklove_oki_bank_w )
+ AM_RANGE(0x0312, 0x0312) AM_READ( saklove_vblank_r ) AM_DEVWRITE( SOUND, "oki", saklove_oki_bank_w )
// Peripheral Control Block
AM_RANGE(0xff00, 0xffff) AM_READWRITE( am188em_regs_r, am188em_regs_w ) AM_BASE( &am188em_regs )
diff --git a/src/mame/drivers/bking.c b/src/mame/drivers/bking.c
index 7dc44ba5fe9..f4a25596a95 100644
--- a/src/mame/drivers/bking.c
+++ b/src/mame/drivers/bking.c
@@ -155,10 +155,10 @@ static ADDRESS_MAP_START( bking_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_ROM
AM_RANGE(0x2000, 0x2fff) AM_ROM //only bking3
AM_RANGE(0x4000, 0x43ff) AM_RAM
- AM_RANGE(0x4400, 0x4400) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x4401, 0x4401) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x4402, 0x4402) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x4403, 0x4403) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
+ AM_RANGE(0x4400, 0x4401) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x4401, 0x4401) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0x4402, 0x4403) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x4403, 0x4403) AM_DEVREAD(SOUND, "ay2", ay8910_r)
AM_RANGE(0x4800, 0x4800) AM_READ(soundlatch_r)
AM_RANGE(0x4802, 0x4802) AM_READWRITE(bking_sndnmi_disable_r, bking_sndnmi_enable_w)
AM_RANGE(0xe000, 0xefff) AM_ROM /* Space for diagnostic ROM */
@@ -412,7 +412,7 @@ static GFXDECODE_START( bking )
GFXDECODE_END
-static WRITE8_HANDLER( portb_w )
+static WRITE8_DEVICE_HANDLER( portb_w )
{
/* don't know what this is... could be a filter */
if (data != 0x00) logerror("portB = %02x\n",data);
@@ -422,10 +422,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- dac_0_signed_data_w,
- portb_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_DEVICE_HANDLER(SOUND, "dac", dac_signed_w),
+ DEVCB_HANDLER(portb_w)
};
static MACHINE_DRIVER_START( bking )
diff --git a/src/mame/drivers/bladestl.c b/src/mame/drivers/bladestl.c
index 40d43459749..00f31b14836 100644
--- a/src/mame/drivers/bladestl.c
+++ b/src/mame/drivers/bladestl.c
@@ -94,14 +94,18 @@ static WRITE8_HANDLER( bladestl_sh_irqtrigger_w )
//logerror("(sound) write %02x\n", data);
}
-static WRITE8_HANDLER( bladestl_port_B_w ){
+static WRITE8_DEVICE_HANDLER( bladestl_port_B_w ){
/* bit 1, 2 unknown */
- upd7759_set_bank_base(0, ((data & 0x38) >> 3)*0x20000);
+ upd7759_set_bank_base(device, ((data & 0x38) >> 3)*0x20000);
}
-static WRITE8_HANDLER( bladestl_speech_ctrl_w ){
- upd7759_reset_w(0, data & 1);
- upd7759_start_w(0, data & 2);
+static READ8_DEVICE_HANDLER( bladestl_speech_busy_r ){
+ return upd7759_busy_r(device) ? 1 : 0;
+}
+
+static WRITE8_DEVICE_HANDLER( bladestl_speech_ctrl_w ){
+ upd7759_reset_w(device, data & 1);
+ upd7759_start_w(device, data & 2);
}
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
@@ -128,10 +132,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM
- AM_RANGE(0x1000, 0x1000) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w) /* YM2203 */
- AM_RANGE(0x1001, 0x1001) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w) /* YM2203 */
- AM_RANGE(0x3000, 0x3000) AM_WRITE(bladestl_speech_ctrl_w) /* UPD7759 */
- AM_RANGE(0x4000, 0x4000) AM_READ(upd7759_0_busy_r) /* UPD7759 */
+ AM_RANGE(0x1000, 0x1001) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w) /* YM2203 */
+ AM_RANGE(0x3000, 0x3000) AM_DEVWRITE(SOUND, "upd", bladestl_speech_ctrl_w) /* UPD7759 */
+ AM_RANGE(0x4000, 0x4000) AM_DEVREAD(SOUND, "upd", bladestl_speech_busy_r) /* UPD7759 */
AM_RANGE(0x5000, 0x5000) AM_WRITE(SMH_NOP) /* ??? */
AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r) /* soundlatch_r */
AM_RANGE(0x8000, 0xffff) AM_ROM
@@ -304,10 +307,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- upd7759_0_port_w,
- bladestl_port_B_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_DEVICE_HANDLER(SOUND, "upd", upd7759_port_w),
+ DEVCB_DEVICE_HANDLER(SOUND, "upd", bladestl_port_B_w)
},
NULL
};
diff --git a/src/mame/drivers/blktiger.c b/src/mame/drivers/blktiger.c
index 3c2a4518ed1..0ff79942764 100644
--- a/src/mame/drivers/blktiger.c
+++ b/src/mame/drivers/blktiger.c
@@ -93,10 +93,8 @@ static ADDRESS_MAP_START( sound_mem_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0xc000, 0xc7ff) AM_RAM
AM_RANGE(0xc800, 0xc800) AM_READ(soundlatch_r)
- AM_RANGE(0xe000, 0xe000) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0xe001, 0xe001) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
- AM_RANGE(0xe002, 0xe002) AM_READWRITE(ym2203_status_port_1_r, ym2203_control_port_1_w)
- AM_RANGE(0xe003, 0xe003) AM_READWRITE(ym2203_read_port_1_r, ym2203_write_port_1_w)
+ AM_RANGE(0xe000, 0xe001) AM_DEVREADWRITE(SOUND, "ym1", ym2203_r, ym2203_w)
+ AM_RANGE(0xe002, 0xe003) AM_DEVREADWRITE(SOUND, "ym2", ym2203_r, ym2203_w)
ADDRESS_MAP_END
@@ -228,9 +226,9 @@ GFXDECODE_END
/* handler called by the 2203 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface ym2203_config =
@@ -238,7 +236,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL,
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,
},
irqhandler
};
diff --git a/src/mame/drivers/blmbycar.c b/src/mame/drivers/blmbycar.c
index 753c4df2282..3c7b12b9a4a 100644
--- a/src/mame/drivers/blmbycar.c
+++ b/src/mame/drivers/blmbycar.c
@@ -136,7 +136,7 @@ static ADDRESS_MAP_START( blmbycar_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x700008, 0x700009) AM_READ(blmbycar_pot_wheel_r ) // Wheel (potentiometer)
AM_RANGE(0x70000a, 0x70000b) AM_WRITE(SMH_NOP ) // ? Wheel
AM_RANGE(0x70000c, 0x70000d) AM_WRITE(blmbycar_okibank_w ) // Sound
- AM_RANGE(0x70000e, 0x70000f) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w) // Sound
+ AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff) // Sound
AM_RANGE(0x70006a, 0x70006b) AM_WRITE(blmbycar_pot_wheel_reset_w ) // Wheel (potentiometer)
AM_RANGE(0x70007a, 0x70007b) AM_WRITE(blmbycar_pot_wheel_shift_w ) //
ADDRESS_MAP_END
@@ -171,7 +171,7 @@ static ADDRESS_MAP_START( watrball_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x700008, 0x700009) AM_READ(waterball_unk_r ) // 0x0008 must toggle
AM_RANGE(0x70000a, 0x70000b) AM_WRITE(SMH_NOP ) // ?? busy
AM_RANGE(0x70000c, 0x70000d) AM_WRITE(blmbycar_okibank_w ) // Sound
- AM_RANGE(0x70000e, 0x70000f) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w) //
+ AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff) //
ADDRESS_MAP_END
/***************************************************************************
diff --git a/src/mame/drivers/blockade.c b/src/mame/drivers/blockade.c
index 2cfd25fb65b..541bdf7fd53 100644
--- a/src/mame/drivers/blockade.c
+++ b/src/mame/drivers/blockade.c
@@ -120,7 +120,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( main_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x01, 0x01) AM_READWRITE(blockade_input_port_0_r, blockade_coin_latch_w)
AM_RANGE(0x02, 0x02) AM_READ_PORT("IN1")
- AM_RANGE(0x02, 0x02) AM_WRITE(blockade_sound_freq_w)
+ AM_RANGE(0x02, 0x02) AM_DEVWRITE(SOUND, "discrete", blockade_sound_freq_w)
AM_RANGE(0x04, 0x04) AM_READ_PORT("IN2")
AM_RANGE(0x04, 0x04) AM_WRITE(blockade_env_on_w)
AM_RANGE(0x08, 0x08) AM_WRITE(blockade_env_off_w)
diff --git a/src/mame/drivers/blockhl.c b/src/mame/drivers/blockhl.c
index 6854b971e26..33f8dc40c69 100644
--- a/src/mame/drivers/blockhl.c
+++ b/src/mame/drivers/blockhl.c
@@ -86,8 +86,7 @@ static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xc001, 0xc001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0xe00c, 0xe00d) AM_WRITE(SMH_NOP) /* leftover from missing 007232? */
ADDRESS_MAP_END
diff --git a/src/mame/drivers/blockout.c b/src/mame/drivers/blockout.c
index af942614dda..77a210d7d93 100644
--- a/src/mame/drivers/blockout.c
+++ b/src/mame/drivers/blockout.c
@@ -67,9 +67,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
- AM_RANGE(0x8800, 0x8800) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x8801, 0x8801) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
- AM_RANGE(0x9800, 0x9800) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x8800, 0x8801) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -170,9 +169,9 @@ static INPUT_PORTS_START( agress )
INPUT_PORTS_END
/* handler called by the 2151 emulator when the internal timers cause an IRQ */
-static void blockout_irq_handler(running_machine *machine, int irq)
+static void blockout_irq_handler(const device_config *device, int irq)
{
- cpu_set_input_line_and_vector(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE,0xff);
+ cpu_set_input_line_and_vector(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE,0xff);
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/blueprnt.c b/src/mame/drivers/blueprnt.c
index ee14c6d9fea..ad981aaf81e 100644
--- a/src/mame/drivers/blueprnt.c
+++ b/src/mame/drivers/blueprnt.c
@@ -73,7 +73,7 @@ extern VIDEO_UPDATE( blueprnt );
static int dipsw;
-static WRITE8_HANDLER( dipsw_w )
+static WRITE8_DEVICE_HANDLER( dipsw_w )
{
dipsw = data;
}
@@ -115,12 +115,10 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_ROM
AM_RANGE(0x2000, 0x2fff) AM_ROM
AM_RANGE(0x4000, 0x43ff) AM_RAM
- AM_RANGE(0x6000, 0x6000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x6001, 0x6001) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x6002, 0x6002) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x8000, 0x8000) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x8001, 0x8001) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x8002, 0x8002) AM_READ(ay8910_read_port_1_r)
+ AM_RANGE(0x6000, 0x6001) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x6002, 0x6002) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0x8000, 0x8001) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x8002, 0x8002) AM_DEVREAD(SOUND, "ay2", ay8910_r)
ADDRESS_MAP_END
/* Input Ports */
@@ -252,20 +250,20 @@ static const ay8910_interface ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- soundlatch_r,
- dipsw_w,
- NULL
+ DEVCB_NULL,
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r),
+ DEVCB_HANDLER(dipsw_w),
+ DEVCB_NULL
};
static const ay8910_interface ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_2_r,
- input_port_3_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DILSW1"),
+ DEVCB_INPUT_PORT("DILSW2"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
/* Machine Driver */
diff --git a/src/mame/drivers/bmcbowl.c b/src/mame/drivers/bmcbowl.c
index 1fcc3c32b92..b321d90e539 100644
--- a/src/mame/drivers/bmcbowl.c
+++ b/src/mame/drivers/bmcbowl.c
@@ -338,8 +338,8 @@ static ADDRESS_MAP_START( bmcbowl_mem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x092000, 0x09201f) AM_READWRITE(bmcbowl_via_r, bmcbowl_via_w)
AM_RANGE(0x093000, 0x093003) AM_WRITE(SMH_NOP) // related to music
- AM_RANGE(0x092800, 0x092801) AM_WRITE(ay8910_write_port_0_msb_w )
- AM_RANGE(0x092802, 0x092803) AM_READ(ay8910_read_port_0_msb_r) AM_WRITE(ay8910_control_port_0_msb_w )
+ AM_RANGE(0x092800, 0x092803) AM_DEVWRITE8(SOUND, "ay", ay8910_data_address_w, 0xff00)
+ AM_RANGE(0x092802, 0x092803) AM_DEVREAD8(SOUND, "ay", ay8910_r, 0xff00)
AM_RANGE(0x093802, 0x093803) AM_READ_PORT("IN0")
AM_RANGE(0x095000, 0x095fff) AM_RAM AM_BASE((UINT16 **)&stats_ram) AM_SIZE(&stats_ram_size) /* 8 bit */
AM_RANGE(0x097000, 0x097001) AM_READ(SMH_NOP)
@@ -348,7 +348,7 @@ static ADDRESS_MAP_START( bmcbowl_mem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x1f0000, 0x1fffff) AM_RAM
AM_RANGE(0x200000, 0x21ffff) AM_RAM AM_BASE(&bmcbowl_vid2)
- AM_RANGE(0x28c000, 0x28c001) AM_READWRITE(okim6295_status_0_msb_r,okim6295_data_0_msb_w)
+ AM_RANGE(0x28c000, 0x28c001) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0xff00)
/* protection device*/
AM_RANGE(0x30c000, 0x30c001) AM_WRITE(SMH_NOP)
@@ -444,19 +444,19 @@ static INPUT_PORTS_START( bmcbowl )
INPUT_PORTS_END
-static READ8_HANDLER(dips1_r)
+static READ8_DEVICE_HANDLER(dips1_r)
{
switch(bmc_input)
{
- case 0x00: return input_port_read(space->machine, "IN1");
- case 0x40: return input_port_read(space->machine, "IN2");
+ case 0x00: return input_port_read(device->machine, "IN1");
+ case 0x40: return input_port_read(device->machine, "IN2");
}
- logerror("unknown input - %X (PC=%X)\n",bmc_input,cpu_get_previouspc(space->cpu));
+ logerror("%s:unknown input - %X\n",cpuexec_describe_context(device->machine),bmc_input);
return 0xff;
}
-static WRITE8_HANDLER(input_mux_w)
+static WRITE8_DEVICE_HANDLER(input_mux_w)
{
bmc_input=data;
}
@@ -466,10 +466,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- dips1_r,
- NULL,
- NULL,
- input_mux_w
+ DEVCB_HANDLER(dips1_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(input_mux_w)
};
diff --git a/src/mame/drivers/bogeyman.c b/src/mame/drivers/bogeyman.c
index a46860c9ee3..949216fb0d6 100644
--- a/src/mame/drivers/bogeyman.c
+++ b/src/mame/drivers/bogeyman.c
@@ -47,23 +47,11 @@ static WRITE8_HANDLER( bogeyman_8910_control_w )
// bit 5 goes to 8910 #0 BDIR pin
if ((last & 0x20) == 0x20 && (data & 0x20) == 0x00)
- {
- // bit 4 goes to the 8910 #0 BC1 pin
- if (last & 0x10)
- ay8910_control_port_0_w(space,0,psg_latch);
- else
- ay8910_write_port_0_w(space,0,psg_latch);
- }
+ ay8910_data_address_w(devtag_get_device(space->machine, SOUND, "ay1"), last >> 4, psg_latch);
// bit 7 goes to 8910 #1 BDIR pin
if ((last & 0x80) == 0x80 && (data & 0x80) == 0x00)
- {
- // bit 6 goes to the 8910 #1 BC1 pin
- if (last & 0x40)
- ay8910_control_port_1_w(space,0,psg_latch);
- else
- ay8910_write_port_1_w(space,0,psg_latch);
- }
+ ay8910_data_address_w(devtag_get_device(space->machine, SOUND, "ay2"), last >> 6, psg_latch);
last = data;
}
diff --git a/src/mame/drivers/bombjack.c b/src/mame/drivers/bombjack.c
index bbcb8a06025..8e7742f31ac 100644
--- a/src/mame/drivers/bombjack.c
+++ b/src/mame/drivers/bombjack.c
@@ -168,12 +168,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( audio_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x10, 0x10) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x11, 0x11) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ay8910_control_port_2_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ay8910_write_port_2_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x10, 0x11) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "ay3", ay8910_address_data_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/boogwing.c b/src/mame/drivers/boogwing.c
index a1c72e59cf1..38d03cab425 100644
--- a/src/mame/drivers/boogwing.c
+++ b/src/mame/drivers/boogwing.c
@@ -133,9 +133,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_ROM
AM_RANGE(0x100000, 0x100001) AM_NOP
- AM_RANGE(0x110000, 0x110001) AM_READWRITE(ym2151_status_port_0_r, ym2151_word_0_w)
- AM_RANGE(0x120000, 0x120001) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
- AM_RANGE(0x130000, 0x130001) AM_READWRITE(okim6295_status_1_r, okim6295_data_1_w)
+ AM_RANGE(0x110000, 0x110001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE(SOUND, "oki1", okim6295_r, okim6295_w)
+ AM_RANGE(0x130000, 0x130001) AM_DEVREADWRITE(SOUND, "oki2", okim6295_r, okim6295_w)
AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
AM_RANGE(0x1f0000, 0x1f1fff) AM_READWRITE(SMH_BANK8, SMH_BANK8)
AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w)
@@ -277,15 +277,15 @@ GFXDECODE_END
/**********************************************************************************/
-static void sound_irq(running_machine *machine, int state)
+static void sound_irq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1],1,state); /* IRQ 2 */
+ cpu_set_input_line(device->machine->cpu[1],1,state); /* IRQ 2 */
}
-static WRITE8_HANDLER( sound_bankswitch_w )
+static WRITE8_DEVICE_HANDLER( sound_bankswitch_w )
{
- okim6295_set_bank_base(1, ((data & 2)>>1) * 0x40000);
- okim6295_set_bank_base(0, (data & 1) * 0x40000);
+ okim6295_set_bank_base(devtag_get_device(device->machine, SOUND, "oki2"), ((data & 2)>>1) * 0x40000);
+ okim6295_set_bank_base(devtag_get_device(device->machine, SOUND, "oki1"), (data & 1) * 0x40000);
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/bottom9.c b/src/mame/drivers/bottom9.c
index cf270a1f0c6..20da577b4bc 100644
--- a/src/mame/drivers/bottom9.c
+++ b/src/mame/drivers/bottom9.c
@@ -124,10 +124,10 @@ static WRITE8_HANDLER( sound_bank_w )
bank_A = ((data >> 0) & 0x03);
bank_B = ((data >> 2) & 0x03);
- k007232_set_bank( 0, bank_A, bank_B );
+ k007232_set_bank( devtag_get_device(space->machine, SOUND, "konami1"), bank_A, bank_B );
bank_A = ((data >> 4) & 0x03);
bank_B = ((data >> 6) & 0x03);
- k007232_set_bank( 1, bank_A, bank_B );
+ k007232_set_bank( devtag_get_device(space->machine, SOUND, "konami2"), bank_A, bank_B );
}
@@ -155,8 +155,8 @@ static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
AM_RANGE(0x9000, 0x9000) AM_WRITE(sound_bank_w)
- AM_RANGE(0xa000, 0xa00d) AM_READWRITE(k007232_read_port_0_r, k007232_write_port_0_w)
- AM_RANGE(0xb000, 0xb00d) AM_READWRITE(k007232_read_port_1_r, k007232_write_port_1_w)
+ AM_RANGE(0xa000, 0xa00d) AM_DEVREADWRITE(SOUND, "konami1", k007232_r, k007232_w)
+ AM_RANGE(0xb000, 0xb00d) AM_DEVREADWRITE(SOUND, "konami2", k007232_r, k007232_w)
AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_r)
AM_RANGE(0xf000, 0xf000) AM_WRITE(nmi_enable_w)
ADDRESS_MAP_END
@@ -279,16 +279,16 @@ INPUT_PORTS_END
-static void volume_callback0(int v)
+static void volume_callback0(const device_config *device, int v)
{
- k007232_set_volume(0,0,(v >> 4) * 0x11,0);
- k007232_set_volume(0,1,0,(v & 0x0f) * 0x11);
+ k007232_set_volume(device,0,(v >> 4) * 0x11,0);
+ k007232_set_volume(device,1,0,(v & 0x0f) * 0x11);
}
-static void volume_callback1(int v)
+static void volume_callback1(const device_config *device, int v)
{
- k007232_set_volume(1,0,(v >> 4) * 0x11,0);
- k007232_set_volume(1,1,0,(v & 0x0f) * 0x11);
+ k007232_set_volume(device,0,(v >> 4) * 0x11,0);
+ k007232_set_volume(device,1,0,(v & 0x0f) * 0x11);
}
static const k007232_interface k007232_interface_1 =
diff --git a/src/mame/drivers/brasil.c b/src/mame/drivers/brasil.c
index 73943363384..40c3b5bc871 100644
--- a/src/mame/drivers/brasil.c
+++ b/src/mame/drivers/brasil.c
@@ -274,12 +274,12 @@ static WRITE16_HANDLER( fashion_write2_w )
}
}
-static WRITE16_HANDLER( write3_w )
+static WRITE16_DEVICE_HANDLER( write3_w )
{
if (t3 != data) {
t3 = data;
- okim6376_data_0_lsb_w(space, 0, t3, mem_mask);
- okim6376_data_0_lsb_w(space, 0, (1 << 4), mem_mask);
+ okim6376_w(device, 0, t3);
+ okim6376_w(device, 0, (1 << 4));
}
// popmessage("%04x %04x",t1,t3);
}
@@ -296,7 +296,7 @@ static ADDRESS_MAP_START( brasil_io, ADDRESS_SPACE_IO, 16 )
AM_RANGE(0x0030, 0x0031) AM_WRITE( blit_status_w )
AM_RANGE(0x0000, 0x0001) AM_WRITE( write1_w ) // lamps
AM_RANGE(0x0002, 0x0003) AM_WRITE( write2_w ) // coin counter & coin lockout
- AM_RANGE(0x0006, 0x0007) AM_WRITE( write3_w ) // sound chip routes here
+ AM_RANGE(0x0006, 0x0007) AM_DEVWRITE( SOUND, "samples", write3_w ) // sound chip routes here
AM_RANGE(0x0008, 0x0009) AM_READ( read1_r )
AM_RANGE(0x000a, 0x000b) AM_READ( read2_r )
AM_RANGE(0x000e, 0x000f) AM_READ( read3_r )
@@ -317,7 +317,7 @@ static ADDRESS_MAP_START( vidpokr2_io, ADDRESS_SPACE_IO, 16 )
AM_RANGE(0x0000, 0x0001) AM_WRITE( write1_w ) // lamps
AM_RANGE(0x0002, 0x0003) AM_WRITE( write2_w ) // coin counter & coin lockout
AM_RANGE(0x0004, 0x0005) AM_WRITE( vidpokr2_vblank_w )
- AM_RANGE(0x0006, 0x0007) AM_WRITE( write3_w ) // sound chip routes here
+ AM_RANGE(0x0006, 0x0007) AM_DEVWRITE( SOUND, "samples", write3_w ) // sound chip routes here
AM_RANGE(0x0008, 0x0009) AM_READ( read1_r )
AM_RANGE(0x000a, 0x000b) AM_READ( read2_r )
AM_RANGE(0x000c, 0x000d) AM_READ( vidpokr2_vblank_r )
diff --git a/src/mame/drivers/brkthru.c b/src/mame/drivers/brkthru.c
index b2c41f56b40..b6320e2f34e 100644
--- a/src/mame/drivers/brkthru.c
+++ b/src/mame/drivers/brkthru.c
@@ -51,7 +51,7 @@ Dip locations verified with manual for brkthru (US conv. kit) and darwin
#include "driver.h"
#include "cpu/m6809/m6809.h"
#include "sound/2203intf.h"
-#include "sound/3812intf.h"
+#include "sound/3526intf.h"
#define MASTER_CLOCK XTAL_12MHz
@@ -138,12 +138,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_RAM
- AM_RANGE(0x2000, 0x2000) AM_WRITE(ym3526_control_port_0_w)
- AM_RANGE(0x2001, 0x2001) AM_WRITE(ym3526_write_port_0_w)
+ AM_RANGE(0x2000, 0x2001) AM_DEVWRITE(SOUND, "ym2", ym3526_w)
AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_r)
- AM_RANGE(0x6000, 0x6000) AM_READ(ym2203_status_port_0_r)
- AM_RANGE(0x6000, 0x6000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x6001, 0x6001) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0x6000, 0x6001) AM_DEVREADWRITE(SOUND, "ym1", ym2203_r, ym2203_w)
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -325,9 +322,9 @@ static GFXDECODE_START( brkthru )
GFXDECODE_END
/* handler called by the 3812 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1],M6809_IRQ_LINE,linestate);
+ cpu_set_input_line(device->machine->cpu[1],M6809_IRQ_LINE,linestate);
}
static const ym3526_interface ym3526_config =
diff --git a/src/mame/drivers/bsktball.c b/src/mame/drivers/bsktball.c
index 7dcd66dd82a..cff9990b8ae 100644
--- a/src/mame/drivers/bsktball.c
+++ b/src/mame/drivers/bsktball.c
@@ -81,15 +81,15 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0802, 0x0802) AM_READ_PORT("IN1")
AM_RANGE(0x0803, 0x0803) AM_READ_PORT("DSW")
AM_RANGE(0x1000, 0x1000) AM_WRITE(SMH_NOP) /* Timer Reset */
- AM_RANGE(0x1010, 0x1010) AM_WRITE(bsktball_bounce_w) /* Crowd Amp / Bounce */
+ AM_RANGE(0x1010, 0x1010) AM_DEVWRITE(SOUND, "discrete", bsktball_bounce_w) /* Crowd Amp / Bounce */
AM_RANGE(0x1022, 0x1023) AM_WRITE(SMH_NOP) /* Coin Counter */
AM_RANGE(0x1024, 0x1025) AM_WRITE(bsktball_led1_w) /* LED 1 */
AM_RANGE(0x1026, 0x1027) AM_WRITE(bsktball_led2_w) /* LED 2 */
AM_RANGE(0x1028, 0x1029) AM_WRITE(bsktball_ld1_w) /* LD 1 */
AM_RANGE(0x102a, 0x102b) AM_WRITE(bsktball_ld2_w) /* LD 2 */
- AM_RANGE(0x102c, 0x102d) AM_WRITE(bsktball_noise_reset_w) /* Noise Reset */
+ AM_RANGE(0x102c, 0x102d) AM_DEVWRITE(SOUND, "discrete", bsktball_noise_reset_w) /* Noise Reset */
AM_RANGE(0x102e, 0x102f) AM_WRITE(bsktball_nmion_w) /* NMI On */
- AM_RANGE(0x1030, 0x1030) AM_WRITE(bsktball_note_w) /* Music Ckt Note Dvsr */
+ AM_RANGE(0x1030, 0x1030) AM_DEVWRITE(SOUND, "discrete", bsktball_note_w) /* Music Ckt Note Dvsr */
AM_RANGE(0x1800, 0x1bbf) AM_RAM_WRITE(bsktball_videoram_w) AM_BASE(&videoram) /* DISPLAY */
AM_RANGE(0x1bc0, 0x1bff) AM_RAM AM_BASE(&bsktball_motion)
AM_RANGE(0x1c00, 0x1cff) AM_RAM
diff --git a/src/mame/drivers/btime.c b/src/mame/drivers/btime.c
index 5b06b19f30c..4e4a1646682 100644
--- a/src/mame/drivers/btime.c
+++ b/src/mame/drivers/btime.c
@@ -111,13 +111,13 @@ static WRITE8_HANDLER( audio_nmi_enable_w )
}
}
-static WRITE8_HANDLER( ay_audio_nmi_enable_w )
+static WRITE8_DEVICE_HANDLER( ay_audio_nmi_enable_w )
{
/* port A bit 0, when 1, inhibits the NMI */
if (audio_nmi_enable_type == AUDIO_ENABLE_AY8910)
{
audio_nmi_enabled = ~data & 1;
- cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_NMI, (audio_nmi_enabled && audio_nmi_state) ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_NMI, (audio_nmi_enabled && audio_nmi_state) ? ASSERT_LINE : CLEAR_LINE);
}
}
@@ -423,10 +423,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x1c00) AM_RAM AM_BASE(&audio_rambase)
- AM_RANGE(0x2000, 0x3fff) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x4000, 0x5fff) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x6000, 0x7fff) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x8000, 0x9fff) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0x2000, 0x3fff) AM_DEVWRITE(SOUND, "ay1", ay8910_data_w)
+ AM_RANGE(0x4000, 0x5fff) AM_DEVWRITE(SOUND, "ay1", ay8910_address_w)
+ AM_RANGE(0x6000, 0x7fff) AM_DEVWRITE(SOUND, "ay2", ay8910_data_w)
+ AM_RANGE(0x8000, 0x9fff) AM_DEVWRITE(SOUND, "ay2", ay8910_address_w)
AM_RANGE(0xa000, 0xbfff) AM_READ(audio_command_r)
AM_RANGE(0xc000, 0xdfff) AM_WRITE(audio_nmi_enable_w)
AM_RANGE(0xe000, 0xefff) AM_MIRROR(0x1000) AM_ROM
@@ -434,10 +434,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( disco_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x03ff) AM_RAM
- AM_RANGE(0x4000, 0x4fff) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x5000, 0x5fff) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x6000, 0x6fff) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x7000, 0x7fff) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0x4000, 0x4fff) AM_DEVWRITE(SOUND, "ay1", ay8910_data_w)
+ AM_RANGE(0x5000, 0x5fff) AM_DEVWRITE(SOUND, "ay1", ay8910_address_w)
+ AM_RANGE(0x6000, 0x6fff) AM_DEVWRITE(SOUND, "ay2", ay8910_data_w)
+ AM_RANGE(0x7000, 0x7fff) AM_DEVWRITE(SOUND, "ay2", ay8910_address_w)
AM_RANGE(0x8000, 0x8fff) AM_READWRITE(soundlatch_r, SMH_NOP) /* ack ? */
AM_RANGE(0xf000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -1240,7 +1240,7 @@ static const ay8910_interface ay1_intf =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, ay_audio_nmi_enable_w, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_HANDLER(ay_audio_nmi_enable_w), DEVCB_NULL
};
static MACHINE_DRIVER_START( btime )
diff --git a/src/mame/drivers/btoads.c b/src/mame/drivers/btoads.c
index bd17b0f67a3..ac6764e01a6 100644
--- a/src/mame/drivers/btoads.c
+++ b/src/mame/drivers/btoads.c
@@ -146,7 +146,7 @@ static WRITE8_HANDLER( sound_int_state_w )
{
/* top bit controls BSMT2000 reset */
if (!(sound_int_state & 0x80) && (data & 0x80))
- sndti_reset(SOUND_BSMT2000, 0);
+ devtag_reset(space->machine, SOUND, "bsmt");
/* also clears interrupts */
cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE);
@@ -167,11 +167,11 @@ static READ8_HANDLER( bsmt_ready_r )
}
-static WRITE8_HANDLER( bsmt2000_port_w )
+static WRITE8_DEVICE_HANDLER( bsmt2000_port_w )
{
UINT16 reg = offset >> 8;
UINT16 val = ((offset & 0xff) << 8) | data;
- bsmt2000_data_0_w(space, reg, val, 0xffff);
+ bsmt2000_data_w(device, reg, val, 0xffff);
}
@@ -224,7 +224,7 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
- AM_RANGE(0x0000, 0x7fff) AM_WRITE(bsmt2000_port_w)
+ AM_RANGE(0x0000, 0x7fff) AM_DEVWRITE(SOUND, "bsmt", bsmt2000_port_w)
AM_RANGE(0x8000, 0x8000) AM_READWRITE(sound_data_r, sound_data_w)
AM_RANGE(0x8002, 0x8002) AM_WRITE(sound_int_state_w)
AM_RANGE(0x8004, 0x8004) AM_READ(sound_data_ready_r)
diff --git a/src/mame/drivers/bublbobl.c b/src/mame/drivers/bublbobl.c
index 979b30da298..3770d532805 100644
--- a/src/mame/drivers/bublbobl.c
+++ b/src/mame/drivers/bublbobl.c
@@ -273,7 +273,7 @@ TODO:
#include "cpu/m6800/m6800.h"
#include "deprecat.h"
#include "sound/2203intf.h"
-#include "sound/3812intf.h"
+#include "sound/3526intf.h"
#include "cpu/m6805/m6805.h"
#include "includes/bublbobl.h"
@@ -310,10 +310,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x8fff) AM_RAM
- AM_RANGE(0x9000, 0x9000) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x9001, 0x9001) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
- AM_RANGE(0xa000, 0xa000) AM_READWRITE(ym3526_status_port_0_r, ym3526_control_port_0_w)
- AM_RANGE(0xa001, 0xa001) AM_WRITE(ym3526_write_port_0_w)
+ AM_RANGE(0x9000, 0x9001) AM_DEVREADWRITE(SOUND, "ym1", ym2203_r, ym2203_w)
+ AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE(SOUND, "ym2", ym3526_r, ym3526_w)
AM_RANGE(0xb000, 0xb000) AM_READ(soundlatch_r) AM_WRITENOP
AM_RANGE(0xb001, 0xb001) AM_WRITE(bublbobl_sh_nmi_enable_w) AM_READNOP
AM_RANGE(0xb002, 0xb002) AM_WRITE(bublbobl_sh_nmi_disable_w)
@@ -402,8 +400,7 @@ static ADDRESS_MAP_START( tokio_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x9800, 0x9800) AM_READNOP // ???
AM_RANGE(0xa000, 0xa000) AM_WRITE(bublbobl_sh_nmi_disable_w)
AM_RANGE(0xa800, 0xa800) AM_WRITE(bublbobl_sh_nmi_enable_w)
- AM_RANGE(0xb000, 0xb000) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0xb001, 0xb001) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
+ AM_RANGE(0xb000, 0xb001) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
AM_RANGE(0xe000, 0xffff) AM_ROM // space for diagnostic ROM?
ADDRESS_MAP_END
@@ -668,9 +665,9 @@ GFXDECODE_END
// handler called by the 2203 emulator when the internal timers cause an IRQ
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[2], 0, irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[2], 0, irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface ym2203_config =
@@ -678,7 +675,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
irqhandler
};
diff --git a/src/mame/drivers/buggychl.c b/src/mame/drivers/buggychl.c
index 90e9d5edebf..499d9ca8c65 100644
--- a/src/mame/drivers/buggychl.c
+++ b/src/mame/drivers/buggychl.c
@@ -188,11 +188,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x4000, 0x47ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x4800, 0x4800) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x4801, 0x4801) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x4802, 0x4802) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x4803, 0x4803) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x4810, 0x481d) AM_WRITE(msm5232_0_w)
+ AM_RANGE(0x4800, 0x4801) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x4802, 0x4803) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x4810, 0x481d) AM_DEVWRITE(SOUND, "msm", msm5232_w)
AM_RANGE(0x4820, 0x4820) AM_WRITE(SMH_RAM) /* VOL/BAL for the 7630 on the MSM5232 output */
AM_RANGE(0x4830, 0x4830) AM_WRITE(SMH_RAM) /* TRBL/BASS for the 7630 on the MSM5232 output */
// AM_RANGE(0x5000, 0x5000) AM_WRITE(SMH_RAM) /* to main cpu */
@@ -358,19 +356,19 @@ GFXDECODE_END
-static WRITE8_HANDLER( portA_0_w )
+static WRITE8_DEVICE_HANDLER( portA_0_w )
{
/* VOL/BAL for the 7630 on this 8910 output */
}
-static WRITE8_HANDLER( portB_0_w )
+static WRITE8_DEVICE_HANDLER( portB_0_w )
{
/* TRBL/BASS for the 7630 on this 8910 output */
}
-static WRITE8_HANDLER( portA_1_w )
+static WRITE8_DEVICE_HANDLER( portA_1_w )
{
/* VOL/BAL for the 7630 on this 8910 output */
}
-static WRITE8_HANDLER( portB_1_w )
+static WRITE8_DEVICE_HANDLER( portB_1_w )
{
/* TRBL/BASS for the 7630 on this 8910 output */
}
@@ -380,20 +378,20 @@ static const ay8910_interface ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- portA_0_w,
- portB_0_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(portA_0_w),
+ DEVCB_HANDLER(portB_0_w)
};
static const ay8910_interface ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- portA_1_w,
- portB_1_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(portA_1_w),
+ DEVCB_HANDLER(portB_1_w)
};
static const msm5232_interface msm5232_config =
diff --git a/src/mame/drivers/bwidow.c b/src/mame/drivers/bwidow.c
index 26c80e17350..d8bbbdf1d92 100644
--- a/src/mame/drivers/bwidow.c
+++ b/src/mame/drivers/bwidow.c
@@ -355,8 +355,8 @@ static ADDRESS_MAP_START( bwidow_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM
AM_RANGE(0x2000, 0x27ff) AM_RAM AM_BASE(&vectorram) AM_SIZE(&vectorram_size) AM_REGION("main", 0x2000)
AM_RANGE(0x2800, 0x5fff) AM_ROM
- AM_RANGE(0x6000, 0x67ff) AM_READWRITE(pokey1_r, pokey1_w)
- AM_RANGE(0x6800, 0x6fff) AM_READWRITE(pokey2_r, pokey2_w)
+ AM_RANGE(0x6000, 0x67ff) AM_DEVREADWRITE(SOUND, "pokey1", pokey_r, pokey_w)
+ AM_RANGE(0x6800, 0x6fff) AM_DEVREADWRITE(SOUND, "pokey2", pokey_r, pokey_w)
AM_RANGE(0x7000, 0x7000) AM_READ(atari_vg_earom_r)
AM_RANGE(0x7800, 0x7800) AM_READ_PORT("IN0")
AM_RANGE(0x8000, 0x8000) AM_READ_PORT("IN3")
@@ -385,8 +385,8 @@ static ADDRESS_MAP_START( spacduel_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0e00, 0x0e00) AM_WRITE(irq_ack_w) /* interrupt acknowledge */
AM_RANGE(0x0e80, 0x0e80) AM_WRITE(atari_vg_earom_ctrl_w)
AM_RANGE(0x0f00, 0x0f3f) AM_WRITE(atari_vg_earom_w)
- AM_RANGE(0x1000, 0x100f) AM_READWRITE(pokey1_r, pokey1_w)
- AM_RANGE(0x1400, 0x140f) AM_READWRITE(pokey2_r, pokey2_w)
+ AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE(SOUND, "pokey1", pokey_r, pokey_w)
+ AM_RANGE(0x1400, 0x140f) AM_DEVREADWRITE(SOUND, "pokey2", pokey_r, pokey_w)
AM_RANGE(0x2000, 0x27ff) AM_RAM AM_BASE(&vectorram) AM_SIZE(&vectorram_size) AM_REGION("main", 0x2000)
AM_RANGE(0x2800, 0x3fff) AM_ROM
AM_RANGE(0x4000, 0xffff) AM_ROM
@@ -690,15 +690,15 @@ INPUT_PORTS_END
static const pokey_interface pokey_interface_1 =
{
- { 0 },
- input_port_1_r
+ { DEVCB_NULL },
+ DEVCB_INPUT_PORT("DSW0")
};
static const pokey_interface pokey_interface_2 =
{
- { 0 },
- input_port_2_r
+ { DEVCB_NULL },
+ DEVCB_INPUT_PORT("DSW1")
};
diff --git a/src/mame/drivers/bwing.c b/src/mame/drivers/bwing.c
index e27d010bfb5..25c8b8dc740 100644
--- a/src/mame/drivers/bwing.c
+++ b/src/mame/drivers/bwing.c
@@ -225,12 +225,12 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( bwp3_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x01ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x0200, 0x0200) AM_WRITE(dac_0_signed_data_w)
+ AM_RANGE(0x0200, 0x0200) AM_DEVWRITE(SOUND, "dac", dac_signed_w)
AM_RANGE(0x1000, 0x1000) AM_WRITE(bwp3_nmiack_w)
- AM_RANGE(0x2000, 0x2000) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x4000, 0x4000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x6000, 0x6000) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x8000, 0x8000) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0x2000, 0x2000) AM_DEVWRITE(SOUND, "ay1", ay8910_data_w)
+ AM_RANGE(0x4000, 0x4000) AM_DEVWRITE(SOUND, "ay1", ay8910_address_w)
+ AM_RANGE(0x6000, 0x6000) AM_DEVWRITE(SOUND, "ay2", ay8910_data_w)
+ AM_RANGE(0x8000, 0x8000) AM_DEVWRITE(SOUND, "ay2", ay8910_address_w)
AM_RANGE(0xd000, 0xd000) AM_WRITE(bwp3_nmimask_w)
AM_RANGE(0xe000, 0xffff) AM_WRITE(SMH_ROM) AM_BASE(&bwp3_rombase) AM_SIZE(&bwp3_romsize)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/bzone.c b/src/mame/drivers/bzone.c
index 2be56c621c7..420aa94d3f2 100644
--- a/src/mame/drivers/bzone.c
+++ b/src/mame/drivers/bzone.c
@@ -207,7 +207,6 @@
#include "machine/mathbox.h"
#include "machine/atari_vg.h"
#include "sound/pokey.h"
-#include "sound/custom.h"
#include "rendlay.h"
#include "bzone.h"
@@ -286,9 +285,9 @@ static WRITE8_HANDLER( bzone_coin_counter_w )
*
*************************************/
-static READ8_HANDLER( redbaron_joy_r )
+static READ8_DEVICE_HANDLER( redbaron_joy_r )
{
- return input_port_read(space->machine, rb_input_select ? "FAKE1" : "FAKE2");
+ return input_port_read(device->machine, rb_input_select ? "FAKE1" : "FAKE2");
}
@@ -312,7 +311,7 @@ static ADDRESS_MAP_START( bzone_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1800, 0x1800) AM_READ(mb_status_r)
AM_RANGE(0x1810, 0x1810) AM_READ(mb_lo_r)
AM_RANGE(0x1818, 0x1818) AM_READ(mb_hi_r)
- AM_RANGE(0x1820, 0x182f) AM_READWRITE(pokey1_r, pokey1_w)
+ AM_RANGE(0x1820, 0x182f) AM_DEVREADWRITE(SOUND, "pokey", pokey_r, pokey_w)
AM_RANGE(0x1840, 0x1840) AM_WRITE(bzone_sounds_w)
AM_RANGE(0x1860, 0x187f) AM_WRITE(mb_go_w)
AM_RANGE(0x2000, 0x2fff) AM_RAM AM_BASE(&vectorram) AM_SIZE(&vectorram_size) AM_REGION("main", 0x2000)
@@ -336,7 +335,7 @@ static ADDRESS_MAP_START( redbaron_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1808, 0x1808) AM_WRITE(redbaron_sounds_w) /* and select joystick pot also */
AM_RANGE(0x180a, 0x180a) AM_WRITE(SMH_NOP) /* sound reset, yet todo */
AM_RANGE(0x180c, 0x180c) AM_WRITE(atari_vg_earom_ctrl_w)
- AM_RANGE(0x1810, 0x181f) AM_READWRITE(pokey1_r, pokey1_w)
+ AM_RANGE(0x1810, 0x181f) AM_DEVREADWRITE(SOUND, "pokey", pokey_r, pokey_w)
AM_RANGE(0x1820, 0x185f) AM_READWRITE(atari_vg_earom_r, atari_vg_earom_w)
AM_RANGE(0x1860, 0x187f) AM_WRITE(mb_go_w)
AM_RANGE(0x2000, 0x2fff) AM_RAM AM_BASE(&vectorram) AM_SIZE(&vectorram_size) AM_REGION("main", 0x2000)
@@ -529,27 +528,15 @@ INPUT_PORTS_END
static const pokey_interface bzone_pokey_interface =
{
- { 0 },
- input_port_3_r
-};
-
-
-static const custom_sound_interface bzone_custom_interface =
-{
- bzone_sh_start
+ { DEVCB_NULL },
+ DEVCB_INPUT_PORT("IN3")
};
static const pokey_interface redbaron_pokey_interface =
{
- { 0 },
- redbaron_joy_r
-};
-
-
-static const custom_sound_interface redbaron_custom_interface =
-{
- redbaron_sh_start
+ { DEVCB_NULL },
+ DEVCB_HANDLER(redbaron_joy_r)
};
@@ -585,8 +572,7 @@ static MACHINE_DRIVER_START( bzone )
MDRV_SOUND_CONFIG(bzone_pokey_interface)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
- MDRV_SOUND_ADD("custom", CUSTOM, 0)
- MDRV_SOUND_CONFIG(bzone_custom_interface)
+ MDRV_SOUND_ADD("custom", BZONE, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MACHINE_DRIVER_END
@@ -627,8 +613,7 @@ static MACHINE_DRIVER_START( redbaron )
MDRV_SOUND_CONFIG(redbaron_pokey_interface)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
- MDRV_SOUND_REPLACE("custom", CUSTOM, 0)
- MDRV_SOUND_CONFIG(redbaron_custom_interface)
+ MDRV_SOUND_REPLACE("custom", REDBARON, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/cabal.c b/src/mame/drivers/cabal.c
index a34eadef02c..e1563c6822c 100644
--- a/src/mame/drivers/cabal.c
+++ b/src/mame/drivers/cabal.c
@@ -188,17 +188,16 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4001, 0x4001) AM_WRITE(seibu_irq_clear_w)
AM_RANGE(0x4002, 0x4002) AM_WRITE(seibu_rst10_ack_w)
AM_RANGE(0x4003, 0x4003) AM_WRITE(seibu_rst18_ack_w)
- AM_RANGE(0x4005, 0x4006) AM_WRITE(seibu_adpcm_adr_1_w)
- AM_RANGE(0x4008, 0x4008) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x4009, 0x4009) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x4005, 0x4006) AM_DEVWRITE(SOUND, "adpcm1", seibu_adpcm_adr_w)
+ AM_RANGE(0x4008, 0x4009) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x4010, 0x4011) AM_READ(seibu_soundlatch_r)
AM_RANGE(0x4012, 0x4012) AM_READ(seibu_main_data_pending_r)
AM_RANGE(0x4013, 0x4013) AM_READ_PORT("COIN")
AM_RANGE(0x4018, 0x4019) AM_WRITE(seibu_main_data_w)
- AM_RANGE(0x401a, 0x401a) AM_WRITE(seibu_adpcm_ctl_1_w)
+ AM_RANGE(0x401a, 0x401a) AM_DEVWRITE(SOUND, "adpcm1", seibu_adpcm_ctl_w)
AM_RANGE(0x401b, 0x401b) AM_WRITE(seibu_coin_w)
- AM_RANGE(0x6005, 0x6006) AM_WRITE(seibu_adpcm_adr_2_w)
- AM_RANGE(0x601a, 0x601a) AM_WRITE(seibu_adpcm_ctl_2_w)
+ AM_RANGE(0x6005, 0x6006) AM_DEVWRITE(SOUND, "adpcm2", seibu_adpcm_adr_w)
+ AM_RANGE(0x601a, 0x601a) AM_DEVWRITE(SOUND, "adpcm2", seibu_adpcm_ctl_w)
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -212,30 +211,20 @@ static ADDRESS_MAP_START( cabalbl_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4008, 0x4008) AM_READ(cabalbl_snd2_r)
AM_RANGE(0x400a, 0x400a) AM_READ(cabalbl_snd1_r)
AM_RANGE(0x400c, 0x400c) AM_WRITE(soundlatch2_w)
- AM_RANGE(0x400e, 0x400e) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x400f, 0x400f) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x400e, 0x400f) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x6000, 0x6000) AM_WRITE(SMH_NOP) /* ??? */
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
/* the bootleg has 2x z80 sample players */
-static WRITE8_HANDLER( cabalbl_adpcm_0_w )
+static WRITE8_DEVICE_HANDLER( cabalbl_adpcm_w )
{
- msm5205_reset_w(0,(data>>7)&1);
+ msm5205_reset_w(device,(data>>7)&1);
/* ?? bit 6?? */
- msm5205_data_w(0,data);
- msm5205_vclk_w(0,1);
- msm5205_vclk_w(0,0);
-}
-
-static WRITE8_HANDLER( cabalbl_adpcm_1_w )
-{
- msm5205_reset_w(1,(data>>7)&1);
- /* ?? bit 6?? */
- msm5205_data_w(1,data);
- msm5205_vclk_w(1,1);
- msm5205_vclk_w(1,0);
+ msm5205_data_w(device,data);
+ msm5205_vclk_w(device,1);
+ msm5205_vclk_w(device,0);
}
static ADDRESS_MAP_START( cabalbl_talk1_map, ADDRESS_SPACE_PROGRAM, 8 )
@@ -245,7 +234,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( cabalbl_talk1_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_READ(soundlatch3_r)
- AM_RANGE(0x01, 0x01) AM_WRITE(cabalbl_adpcm_0_w)
+ AM_RANGE(0x01, 0x01) AM_DEVWRITE(SOUND, "msm1", cabalbl_adpcm_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( cabalbl_talk2_map, ADDRESS_SPACE_PROGRAM, 8 )
@@ -255,7 +244,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( cabalbl_talk2_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_READ(soundlatch4_r)
- AM_RANGE(0x01, 0x01) AM_WRITE(cabalbl_adpcm_1_w)
+ AM_RANGE(0x01, 0x01) AM_DEVWRITE(SOUND, "msm2", cabalbl_adpcm_w)
ADDRESS_MAP_END
/***************************************************************************/
@@ -473,9 +462,9 @@ static GFXDECODE_START( cabal )
GFXDECODE_END
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2151_interface cabalbl_ym2151_interface =
@@ -528,12 +517,10 @@ static MACHINE_DRIVER_START( cabal )
MDRV_SOUND_CONFIG(seibu_ym2151_interface)
MDRV_SOUND_ROUTE(ALL_OUTPUTS,"mono", 0.80)
- MDRV_SOUND_ADD("adpcm1", CUSTOM, 8000) /* it should use the msm5205 */
- MDRV_SOUND_CONFIG(seibu_adpcm_interface)
+ MDRV_SOUND_ADD("adpcm1", SEIBU_ADPCM, 8000) /* it should use the msm5205 */
MDRV_SOUND_ROUTE(ALL_OUTPUTS,"mono", 0.40)
- MDRV_SOUND_ADD("adpcm2", CUSTOM, 8000) /* it should use the msm5205 */
- MDRV_SOUND_CONFIG(seibu_adpcm_interface)
+ MDRV_SOUND_ADD("adpcm2", SEIBU_ADPCM, 8000) /* it should use the msm5205 */
MDRV_SOUND_ROUTE(ALL_OUTPUTS,"mono", 0.40)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/cabaret.c b/src/mame/drivers/cabaret.c
index 8239240eee3..5f3db3b6ee1 100644
--- a/src/mame/drivers/cabaret.c
+++ b/src/mame/drivers/cabaret.c
@@ -151,8 +151,7 @@ static ADDRESS_MAP_START( cabaret_portmap, ADDRESS_SPACE_IO, 8 )
AM_RANGE( 0x00a2, 0x00a2 ) AM_READ_PORT("DSW2") /* DSW2 */
AM_RANGE( 0x00b0, 0x00b0 ) AM_READ_PORT("DSW3") /* DSW3 */
- AM_RANGE( 0x00e0, 0x00e0 ) AM_WRITE( ym2413_register_port_0_w )
- AM_RANGE( 0x00e1, 0x00e1 ) AM_WRITE( ym2413_data_port_0_w )
+ AM_RANGE( 0x00e0, 0x00e1 ) AM_DEVWRITE( SOUND, "ym", ym2413_w )
AM_RANGE( 0x2000, 0x27ff ) AM_RAM_WRITE( fg_tile_w ) AM_BASE( &fg_tile_ram )
AM_RANGE( 0x2800, 0x2fff ) AM_RAM_WRITE( fg_color_w ) AM_BASE( &fg_color_ram )
diff --git a/src/mame/drivers/calomega.c b/src/mame/drivers/calomega.c
index 5054c681660..065e2116ac1 100644
--- a/src/mame/drivers/calomega.c
+++ b/src/mame/drivers/calomega.c
@@ -660,11 +660,6 @@ static WRITE_LINE_DEVICE_HANDLER( tx_rx_clk )
acia6850_set_tx_clock(device, trx_clk);
}
-static READ8_HANDLER( dipsw_3_r )
-{
- return input_port_read(space->machine, "SW3");
-}
-
static int s903_mux_data = 0;
static READ8_HANDLER( s903_mux_port_r )
@@ -757,8 +752,7 @@ static WRITE8_HANDLER( lamps_b_w )
static ADDRESS_MAP_START( sys903_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_GLOBAL_MASK(0x3fff)
AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
- AM_RANGE(0x0840, 0x0840) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x0841, 0x0841) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x0840, 0x0841) AM_DEVWRITE(SOUND, "ay8912", ay8910_address_data_w)
AM_RANGE(0x0880, 0x0880) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
AM_RANGE(0x0881, 0x0881) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
AM_RANGE(0x08c4, 0x08c7) AM_READWRITE(pia_0_r, pia_0_w)
@@ -773,8 +767,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( s903mod_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_GLOBAL_MASK(0x3fff)
AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
- AM_RANGE(0x0840, 0x0840) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x0841, 0x0841) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x0840, 0x0841) AM_DEVWRITE(SOUND, "ay8912", ay8910_address_data_w)
AM_RANGE(0x0880, 0x0880) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
AM_RANGE(0x0881, 0x0881) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
AM_RANGE(0x08c4, 0x08c7) AM_READWRITE(pia_0_r, pia_0_w)
@@ -787,8 +780,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sys905_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_GLOBAL_MASK(0x7fff)
AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
- AM_RANGE(0x1040, 0x1040) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x1041, 0x1041) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x1040, 0x1041) AM_DEVWRITE(SOUND, "ay8912", ay8910_address_data_w)
AM_RANGE(0x1080, 0x1080) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
AM_RANGE(0x1081, 0x1081) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
AM_RANGE(0x10c4, 0x10c7) AM_READWRITE(pia_0_r, pia_0_w)
@@ -1897,20 +1889,20 @@ static const ay8910_interface sys903_ay8912_intf =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- dipsw_3_r, /* from schematics */
- NULL,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("SW3"), /* from schematics */
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface sys905_ay8912_intf =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- NULL,
- NULL
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/calorie.c b/src/mame/drivers/calorie.c
index 43fca108364..dae6bef4958 100644
--- a/src/mame/drivers/calorie.c
+++ b/src/mame/drivers/calorie.c
@@ -226,10 +226,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( calorie_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x10, 0x10) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x11, 0x11) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x01, 0x01) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0x10, 0x11) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x11, 0x11) AM_DEVREAD(SOUND, "ay2", ay8910_r)
// 3rd ?
AM_RANGE(0x00, 0xff) AM_WRITE(bogus_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/canyon.c b/src/mame/drivers/canyon.c
index 89d53c197cd..d10fd7d7ae8 100644
--- a/src/mame/drivers/canyon.c
+++ b/src/mame/drivers/canyon.c
@@ -113,12 +113,12 @@ static WRITE8_HANDLER( canyon_led_w )
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_GLOBAL_MASK(0x3fff)
AM_RANGE(0x0000, 0x00ff) AM_MIRROR(0x100) AM_RAM
- AM_RANGE(0x0400, 0x0401) AM_WRITE(canyon_motor_w)
- AM_RANGE(0x0500, 0x0500) AM_WRITE(canyon_explode_w)
+ AM_RANGE(0x0400, 0x0401) AM_DEVWRITE(SOUND, "discrete", canyon_motor_w)
+ AM_RANGE(0x0500, 0x0500) AM_DEVWRITE(SOUND, "discrete", canyon_explode_w)
AM_RANGE(0x0501, 0x0501) AM_WRITE(watchdog_reset_w) /* watchdog, disabled in service mode */
- AM_RANGE(0x0600, 0x0603) AM_WRITE(canyon_whistle_w)
+ AM_RANGE(0x0600, 0x0603) AM_DEVWRITE(SOUND, "discrete", canyon_whistle_w)
AM_RANGE(0x0680, 0x0683) AM_WRITE(canyon_led_w)
- AM_RANGE(0x0700, 0x0703) AM_WRITE(canyon_attract_w)
+ AM_RANGE(0x0700, 0x0703) AM_DEVWRITE(SOUND, "discrete", canyon_attract_w)
AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(canyon_videoram_w) AM_BASE(&canyon_videoram)
AM_RANGE(0x1000, 0x17ff) AM_READWRITE(canyon_switches_r, SMH_NOP) /* sloppy code writes here */
AM_RANGE(0x1800, 0x1fff) AM_READ(canyon_options_r)
diff --git a/src/mame/drivers/capbowl.c b/src/mame/drivers/capbowl.c
index 2751ba8d16c..642f3a8073f 100644
--- a/src/mame/drivers/capbowl.c
+++ b/src/mame/drivers/capbowl.c
@@ -204,9 +204,9 @@ static WRITE8_HANDLER( capbowl_sndcmd_w )
*
*************************************/
-static void firqhandler(running_machine *machine, int irq)
+static void firqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1], 1, irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 1, irq ? ASSERT_LINE : CLEAR_LINE);
}
@@ -276,10 +276,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM
- AM_RANGE(0x1000, 0x1000) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x1001, 0x1001) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
+ AM_RANGE(0x1000, 0x1001) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
AM_RANGE(0x2000, 0x2000) AM_WRITENOP /* Not hooked up according to the schematics */
- AM_RANGE(0x6000, 0x6000) AM_WRITE(dac_0_data_w)
+ AM_RANGE(0x6000, 0x6000) AM_DEVWRITE(SOUND, "dac", dac_w)
AM_RANGE(0x7000, 0x7000) AM_READ(soundlatch_r)
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -334,10 +333,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- ticket_dispenser_r,
- NULL,
- NULL,
- ticket_dispenser_w, /* Also a status LED. See memory map above */
+ DEVCB_MEMORY_HANDLER("main", PROGRAM, ticket_dispenser_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_MEMORY_HANDLER("main", PROGRAM, ticket_dispenser_w), /* Also a status LED. See memory map above */
},
firqhandler
};
diff --git a/src/mame/drivers/cardline.c b/src/mame/drivers/cardline.c
index 5f33c8f896d..da166d58aea 100644
--- a/src/mame/drivers/cardline.c
+++ b/src/mame/drivers/cardline.c
@@ -107,7 +107,7 @@ static ADDRESS_MAP_START( mem_io, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x2007, 0x2007) AM_WRITE(lamps_w)
AM_RANGE(0x2008, 0x2008) AM_NOP
AM_RANGE(0x2080, 0x213f) AM_NOP
- AM_RANGE(0x2400, 0x2400) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x2400, 0x2400) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0x2800, 0x2801) AM_NOP
AM_RANGE(0x2840, 0x2840) AM_NOP
AM_RANGE(0x2880, 0x2880) AM_NOP
diff --git a/src/mame/drivers/carjmbre.c b/src/mame/drivers/carjmbre.c
index 7df22e8d037..9ecc69748b1 100644
--- a/src/mame/drivers/carjmbre.c
+++ b/src/mame/drivers/carjmbre.c
@@ -97,12 +97,10 @@ static ADDRESS_MAP_START( carjmbre_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r)
AM_RANGE(0x10, 0x10) AM_WRITE(SMH_NOP) //?? written on init/0xff sound command reset
- AM_RANGE(0x20, 0x20) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x21, 0x21) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x20, 0x21) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
AM_RANGE(0x22, 0x22) AM_WRITE(SMH_NOP) //?? written before and after 0x21 with same value
AM_RANGE(0x24, 0x24) AM_READ(SMH_NOP) //??
- AM_RANGE(0x30, 0x30) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x31, 0x31) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0x30, 0x31) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
AM_RANGE(0x32, 0x32) AM_WRITE(SMH_NOP) //?? written before and after 0x31 with same value
ADDRESS_MAP_END
diff --git a/src/mame/drivers/carrera.c b/src/mame/drivers/carrera.c
index ca25927124a..0dd58823f0f 100644
--- a/src/mame/drivers/carrera.c
+++ b/src/mame/drivers/carrera.c
@@ -74,8 +74,7 @@ static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x04, 0x04) AM_READ_PORT("IN4")
AM_RANGE(0x05, 0x05) AM_READ_PORT("IN5")
AM_RANGE(0x06, 0x06) AM_WRITE(SMH_NOP) // ?
- AM_RANGE(0x08, 0x08) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x09, 0x09) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x08, 0x09) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
ADDRESS_MAP_END
static INPUT_PORTS_START( carrera )
@@ -259,9 +258,9 @@ static VIDEO_UPDATE(carrera)
return 0;
}
-static READ8_HANDLER( unknown_r )
+static READ8_DEVICE_HANDLER( unknown_r )
{
- return mame_rand(space->machine);
+ return mame_rand(device->machine);
}
/* these are set as input, but I have no idea which input port it uses is for the AY */
@@ -269,10 +268,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- unknown_r,
- unknown_r,
- NULL,
- NULL
+ DEVCB_HANDLER(unknown_r),
+ DEVCB_HANDLER(unknown_r),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static PALETTE_INIT(carrera)
diff --git a/src/mame/drivers/caswin.c b/src/mame/drivers/caswin.c
index f2da6ecf7a2..5e7ca6510e4 100644
--- a/src/mame/drivers/caswin.c
+++ b/src/mame/drivers/caswin.c
@@ -68,16 +68,6 @@ static WRITE8_HANDLER( vregs_w )
*
**********************/
-static READ8_HANDLER( input_buttons_r )
-{
- return input_port_read(space->machine,"DSW1");
-}
-
-static READ8_HANDLER( input_coins_r )
-{
- return input_port_read(space->machine,"DSW2");
-}
-
static READ8_HANDLER( vvillage_rng_r )
{
return mame_rand(space->machine);
@@ -112,9 +102,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x01,0x01) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x02,0x02) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x03,0x03) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x01,0x01) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x02,0x03) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
AM_RANGE(0x10,0x10) AM_READ_PORT("IN0")
AM_RANGE(0x11,0x11) AM_READ_PORT("IN1")
AM_RANGE(0x10,0x10) AM_WRITE(scroll_w)
@@ -211,10 +200,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_buttons_r,
- input_coins_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static PALETTE_INIT( caswin )
diff --git a/src/mame/drivers/cave.c b/src/mame/drivers/cave.c
index dd39e444859..217762ed4ce 100644
--- a/src/mame/drivers/cave.c
+++ b/src/mame/drivers/cave.c
@@ -130,10 +130,10 @@ static INTERRUPT_GEN( cave_interrupt )
}
/* Called by the YMZ280B to set the IRQ state */
-static void sound_irq_gen(running_machine *machine, int state)
+static void sound_irq_gen(const device_config *device, int state)
{
sound_irq = (state != 0);
- update_irq_state(machine);
+ update_irq_state(device->machine);
}
@@ -269,23 +269,6 @@ static WRITE8_HANDLER( soundlatch_ack_w )
-/* Handles writes to the YMZ280B */
-static WRITE16_HANDLER( cave_sound_w )
-{
- if (ACCESSING_BITS_0_7)
- {
- if (offset) ymz280b_data_0_w (space, offset, data & 0xff);
- else ymz280b_register_0_w (space, offset, data & 0xff);
- }
-}
-
-/* Handles reads from the YMZ280B */
-static READ16_HANDLER( cave_sound_r )
-{
- return ymz280b_status_0_r(space,offset);
-}
-
-
/***************************************************************************
@@ -482,7 +465,7 @@ static NVRAM_HANDLER( korokoro )
static ADDRESS_MAP_START( dfeveron_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0x100000, 0x10ffff) AM_READ(SMH_RAM ) // RAM
- AM_RANGE(0x300002, 0x300003) AM_READ(cave_sound_r ) // YMZ280
+ AM_RANGE(0x300002, 0x300003) AM_DEVREAD8(SOUND, "ymz", ymz280b_r, 0x00ff) // YMZ280
/**/AM_RANGE(0x400000, 0x407fff) AM_READ(SMH_RAM ) // Sprites
/**/AM_RANGE(0x408000, 0x40ffff) AM_READ(SMH_RAM ) // Sprites?
/**/AM_RANGE(0x500000, 0x507fff) AM_READ(SMH_RAM ) // Layer 0
@@ -499,7 +482,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( dfeveron_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_WRITE(SMH_ROM ) // ROM
AM_RANGE(0x100000, 0x10ffff) AM_WRITE(SMH_RAM ) // RAM
- AM_RANGE(0x300000, 0x300003) AM_WRITE(cave_sound_w ) // YMZ280
+ AM_RANGE(0x300000, 0x300003) AM_DEVWRITE8(SOUND, "ymz", ymz280b_w, 0x00ff) // YMZ280
AM_RANGE(0x400000, 0x407fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) // Sprites
AM_RANGE(0x408000, 0x40ffff) AM_WRITE(SMH_RAM) AM_BASE(&cave_spriteram16_2)
AM_RANGE(0x500000, 0x507fff) AM_WRITE(cave_vram_0_w) AM_BASE(&cave_vram_0 ) // Layer 0
@@ -520,7 +503,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( ddonpach_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0x100000, 0x10ffff) AM_READ(SMH_RAM ) // RAM
- AM_RANGE(0x300002, 0x300003) AM_READ(cave_sound_r ) // YMZ280
+ AM_RANGE(0x300002, 0x300003) AM_DEVREAD8(SOUND, "ymz", ymz280b_r, 0x00ff) // YMZ280
/**/AM_RANGE(0x400000, 0x407fff) AM_READ(SMH_RAM ) // Sprites
/**/AM_RANGE(0x408000, 0x40ffff) AM_READ(SMH_RAM ) // Sprites?
/**/AM_RANGE(0x500000, 0x507fff) AM_READ(SMH_RAM ) // Layer 0
@@ -538,7 +521,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( ddonpach_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_WRITE(SMH_ROM ) // ROM
AM_RANGE(0x100000, 0x10ffff) AM_WRITE(SMH_RAM ) // RAM
- AM_RANGE(0x300000, 0x300003) AM_WRITE(cave_sound_w ) // YMZ280
+ AM_RANGE(0x300000, 0x300003) AM_DEVWRITE8(SOUND, "ymz", ymz280b_w, 0x00ff) // YMZ280
AM_RANGE(0x400000, 0x407fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) // Sprites
AM_RANGE(0x408000, 0x40ffff) AM_WRITE(SMH_RAM) AM_BASE(&cave_spriteram16_2 )
AM_RANGE(0x500000, 0x507fff) AM_WRITE(cave_vram_0_w) AM_BASE(&cave_vram_0 ) // Layer 0
@@ -595,8 +578,8 @@ static ADDRESS_MAP_START( donpachi_readmem, ADDRESS_SPACE_PROGRAM, 16 )
/**/AM_RANGE(0x800000, 0x800005) AM_READ(SMH_RAM ) // Layer 2 Control
AM_RANGE(0x900000, 0x90007f) AM_READ(donpachi_videoregs_r ) // Video Regs
/**/AM_RANGE(0xa08000, 0xa08fff) AM_READ(SMH_RAM ) // Palette
- AM_RANGE(0xb00000, 0xb00001) AM_READ(okim6295_status_0_lsb_r ) // M6295
- AM_RANGE(0xb00010, 0xb00011) AM_READ(okim6295_status_1_lsb_r ) //
+ AM_RANGE(0xb00000, 0xb00001) AM_DEVREAD8(SOUND, "oki1", okim6295_r, 0x00ff ) // M6295
+ AM_RANGE(0xb00010, 0xb00011) AM_DEVREAD8(SOUND, "oki2", okim6295_r, 0x00ff ) //
AM_RANGE(0xc00000, 0xc00001) AM_READ_PORT("IN0" ) // Inputs
AM_RANGE(0xc00002, 0xc00003) AM_READ_PORT("IN1" ) // Inputs + EEPROM
ADDRESS_MAP_END
@@ -614,8 +597,8 @@ static ADDRESS_MAP_START( donpachi_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x800000, 0x800005) AM_WRITE(SMH_RAM) AM_BASE(&cave_vctrl_2 ) // Layer 2 Control
AM_RANGE(0x900000, 0x90007f) AM_WRITE(SMH_RAM) AM_BASE(&cave_videoregs ) // Video Regs
AM_RANGE(0xa08000, 0xa08fff) AM_WRITE(SMH_RAM) AM_BASE(&paletteram16) AM_SIZE(&cave_paletteram_size) // Palette
- AM_RANGE(0xb00000, 0xb00003) AM_WRITE(okim6295_data_0_lsb_w ) // M6295
- AM_RANGE(0xb00010, 0xb00013) AM_WRITE(okim6295_data_1_lsb_w ) //
+ AM_RANGE(0xb00000, 0xb00003) AM_DEVWRITE8(SOUND, "oki1", okim6295_w, 0x00ff ) // M6295
+ AM_RANGE(0xb00010, 0xb00013) AM_DEVWRITE8(SOUND, "oki2", okim6295_w, 0x00ff ) //
AM_RANGE(0xb00020, 0xb0002f) AM_WRITE(NMK112_okibank_lsb_w ) //
AM_RANGE(0xd00000, 0xd00001) AM_WRITE(cave_eeprom_msb_w ) // EEPROM
ADDRESS_MAP_END
@@ -628,7 +611,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( esprade_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0x100000, 0x10ffff) AM_READ(SMH_RAM ) // RAM
- AM_RANGE(0x300002, 0x300003) AM_READ(cave_sound_r ) // YMZ280
+ AM_RANGE(0x300002, 0x300003) AM_DEVREAD8(SOUND, "ymz", ymz280b_r, 0x00ff) // YMZ280
/**/AM_RANGE(0x400000, 0x407fff) AM_READ(SMH_RAM ) // Sprites
/**/AM_RANGE(0x408000, 0x40ffff) AM_READ(SMH_RAM ) // Sprites?
/**/AM_RANGE(0x500000, 0x507fff) AM_READ(SMH_RAM ) // Layer 0
@@ -646,7 +629,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( esprade_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_WRITE(SMH_ROM ) // ROM
AM_RANGE(0x100000, 0x10ffff) AM_WRITE(SMH_RAM ) // RAM
- AM_RANGE(0x300000, 0x300003) AM_WRITE(cave_sound_w ) // YMZ280
+ AM_RANGE(0x300000, 0x300003) AM_DEVWRITE8(SOUND, "ymz", ymz280b_w, 0x00ff) // YMZ280
AM_RANGE(0x400000, 0x407fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) // Sprites
AM_RANGE(0x408000, 0x40ffff) AM_WRITE(SMH_RAM) AM_BASE(&cave_spriteram16_2) // Sprites?
AM_RANGE(0x500000, 0x507fff) AM_WRITE(cave_vram_0_w) AM_BASE(&cave_vram_0 ) // Layer 0
@@ -668,7 +651,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( gaia_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0x100000, 0x10ffff) AM_READ(SMH_RAM ) // RAM
- AM_RANGE(0x300002, 0x300003) AM_READ(cave_sound_r ) // YMZ280
+ AM_RANGE(0x300002, 0x300003) AM_DEVREAD8(SOUND, "ymz", ymz280b_r, 0x00ff) // YMZ280
AM_RANGE(0x400000, 0x407fff) AM_READ(SMH_RAM ) // Sprite bank 1
AM_RANGE(0x408000, 0x40ffff) AM_READ(SMH_RAM ) // Sprite bank 2
AM_RANGE(0x500000, 0x507fff) AM_READ(SMH_RAM ) // Layer 0
@@ -690,7 +673,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( gaia_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_WRITE(SMH_ROM ) // ROM
AM_RANGE(0x100000, 0x10ffff) AM_WRITE(SMH_RAM ) // RAM
- AM_RANGE(0x300000, 0x300003) AM_WRITE(cave_sound_w ) // YMZ280
+ AM_RANGE(0x300000, 0x300003) AM_DEVWRITE8(SOUND, "ymz", ymz280b_w, 0x00ff ) // YMZ280
AM_RANGE(0x400000, 0x407fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size ) // Sprite bank 1
AM_RANGE(0x408000, 0x40ffff) AM_WRITE(SMH_RAM) AM_BASE(&cave_spriteram16_2 ) // Sprite bank 2
AM_RANGE(0x500000, 0x507fff) AM_WRITE(cave_vram_0_w) AM_BASE(&cave_vram_0 ) // Layer 0
@@ -722,7 +705,7 @@ static ADDRESS_MAP_START( guwange_readmem, ADDRESS_SPACE_PROGRAM, 16 )
/**/AM_RANGE(0x500000, 0x507fff) AM_READ(SMH_RAM ) // Layer 0
/**/AM_RANGE(0x600000, 0x607fff) AM_READ(SMH_RAM ) // Layer 1
/**/AM_RANGE(0x700000, 0x707fff) AM_READ(SMH_RAM ) // Layer 2
- AM_RANGE(0x800002, 0x800003) AM_READ(cave_sound_r ) // YMZ280
+ AM_RANGE(0x800002, 0x800003) AM_DEVREAD8(SOUND, "ymz", ymz280b_r, 0x00ff) // YMZ280
/**/AM_RANGE(0x900000, 0x900005) AM_READ(SMH_RAM ) // Layer 0 Control
/**/AM_RANGE(0xa00000, 0xa00005) AM_READ(SMH_RAM ) // Layer 1 Control
/**/AM_RANGE(0xb00000, 0xb00005) AM_READ(SMH_RAM ) // Layer 2 Control
@@ -740,7 +723,7 @@ static ADDRESS_MAP_START( guwange_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x500000, 0x507fff) AM_WRITE(cave_vram_0_w) AM_BASE(&cave_vram_0 ) // Layer 0
AM_RANGE(0x600000, 0x607fff) AM_WRITE(cave_vram_1_w) AM_BASE(&cave_vram_1 ) // Layer 1
AM_RANGE(0x700000, 0x707fff) AM_WRITE(cave_vram_2_w) AM_BASE(&cave_vram_2 ) // Layer 2
- AM_RANGE(0x800000, 0x800003) AM_WRITE(cave_sound_w ) // YMZ280
+ AM_RANGE(0x800000, 0x800003) AM_DEVWRITE8(SOUND, "ymz", ymz280b_w, 0x00ff ) // YMZ280
AM_RANGE(0x900000, 0x900005) AM_WRITE(SMH_RAM) AM_BASE(&cave_vctrl_0 ) // Layer 0 Control
AM_RANGE(0xa00000, 0xa00005) AM_WRITE(SMH_RAM) AM_BASE(&cave_vctrl_1 ) // Layer 1 Control
AM_RANGE(0xb00000, 0xb00005) AM_WRITE(SMH_RAM) AM_BASE(&cave_vctrl_2 ) // Layer 2 Control
@@ -866,7 +849,7 @@ static ADDRESS_MAP_START( korokoro_readmem, ADDRESS_SPACE_PROGRAM, 16 )
// AM_RANGE(0x180000, 0x187fff) AM_READ( SMH_RAM ) // Sprites
AM_RANGE(0x1c0000, 0x1c0007) AM_READ( cave_irq_cause_r ) // IRQ Cause
// AM_RANGE(0x200000, 0x207fff) AM_READ( SMH_RAM ) // Palette
-// AM_RANGE(0x240000, 0x240003) AM_READ( cave_sound_r ) // YMZ280
+// AM_RANGE(0x240000, 0x240003) AM_DEVREAD8( SOUND, "ymz", ymz280b_r, 0x00ff ) // YMZ280
AM_RANGE(0x280000, 0x280001) AM_READ_PORT("IN0" ) // Inputs + ???
AM_RANGE(0x280002, 0x280003) AM_READ_PORT("IN1" ) // Inputs + EEPROM
AM_RANGE(0x300000, 0x30ffff) AM_READ( SMH_RAM ) // RAM
@@ -879,7 +862,7 @@ static ADDRESS_MAP_START( korokoro_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x180000, 0x187fff) AM_WRITE( SMH_RAM ) AM_BASE( &spriteram16 ) AM_SIZE(&spriteram_size ) // Sprites
AM_RANGE(0x1c0000, 0x1c007f) AM_WRITE( SMH_RAM ) AM_BASE( &cave_videoregs ) // Video Regs
AM_RANGE(0x200000, 0x207fff) AM_WRITE( SMH_RAM ) AM_BASE(&paletteram16) AM_SIZE(&cave_paletteram_size) // Palette
- AM_RANGE(0x240000, 0x240003) AM_WRITE( cave_sound_w ) // YMZ280
+ AM_RANGE(0x240000, 0x240003) AM_DEVWRITE8( SOUND, "ymz", ymz280b_w, 0x00ff) // YMZ280
AM_RANGE(0x280008, 0x280009) AM_WRITE( korokoro_leds_w )
AM_RANGE(0x28000a, 0x28000b) AM_WRITE( korokoro_eeprom_msb_w ) // EEPROM
AM_RANGE(0x28000c, 0x28000d) AM_WRITE( SMH_NOP ) // 0 (watchdog?)
@@ -1133,7 +1116,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( uopoko_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0x100000, 0x10ffff) AM_READ(SMH_RAM ) // RAM
- AM_RANGE(0x300002, 0x300003) AM_READ(cave_sound_r ) // YMZ280
+ AM_RANGE(0x300002, 0x300003) AM_DEVREAD8(SOUND, "ymz", ymz280b_r, 0x00ff) // YMZ280
/**/AM_RANGE(0x400000, 0x407fff) AM_READ(SMH_RAM ) // Sprites
/**/AM_RANGE(0x408000, 0x40ffff) AM_READ(SMH_RAM ) // Sprites?
/**/AM_RANGE(0x500000, 0x507fff) AM_READ(SMH_RAM ) // Layer 0
@@ -1147,7 +1130,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( uopoko_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_WRITE(SMH_ROM ) // ROM
AM_RANGE(0x100000, 0x10ffff) AM_WRITE(SMH_RAM ) // RAM
- AM_RANGE(0x300000, 0x300003) AM_WRITE(cave_sound_w ) // YMZ280
+ AM_RANGE(0x300000, 0x300003) AM_DEVWRITE8(SOUND, "ymz", ymz280b_w, 0x00ff) // YMZ280
AM_RANGE(0x400000, 0x407fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) // Sprites
AM_RANGE(0x408000, 0x40ffff) AM_WRITE(SMH_RAM) AM_BASE(&cave_spriteram16_2 )
AM_RANGE(0x500000, 0x507fff) AM_WRITE(cave_vram_0_w) AM_BASE(&cave_vram_0 ) // Layer 0
@@ -1205,17 +1188,15 @@ static ADDRESS_MAP_START( hotdogst_sound_readport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x30, 0x30) AM_READ(soundlatch_lo_r ) // From Main CPU
AM_RANGE(0x40, 0x40) AM_READ(soundlatch_hi_r ) //
- AM_RANGE(0x50, 0x50) AM_READ(ym2203_status_port_0_r ) // YM2203
- AM_RANGE(0x51, 0x51) AM_READ(ym2203_read_port_0_r ) //
- AM_RANGE(0x60, 0x60) AM_READ(okim6295_status_0_r ) // M6295
+ AM_RANGE(0x50, 0x51) AM_DEVREAD(SOUND, "ym", ym2203_r ) //
+ AM_RANGE(0x60, 0x60) AM_DEVREAD(SOUND, "oki", okim6295_r) // M6295
ADDRESS_MAP_END
static ADDRESS_MAP_START( hotdogst_sound_writeport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(hotdogst_rombank_w ) // ROM bank
- AM_RANGE(0x50, 0x50) AM_WRITE(ym2203_control_port_0_w ) // YM2203
- AM_RANGE(0x51, 0x51) AM_WRITE(ym2203_write_port_0_w ) //
- AM_RANGE(0x60, 0x60) AM_WRITE(okim6295_data_0_w ) // M6295
+ AM_RANGE(0x50, 0x51) AM_DEVWRITE(SOUND, "ym", ym2203_w ) //
+ AM_RANGE(0x60, 0x60) AM_DEVWRITE(SOUND, "oki", okim6295_w) // M6295
AM_RANGE(0x70, 0x70) AM_WRITE(hotdogst_okibank_w ) // Samples bank
ADDRESS_MAP_END
@@ -1250,16 +1231,15 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( mazinger_sound_readport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x30, 0x30) AM_READ(soundlatch_lo_r ) // From Main CPU
- AM_RANGE(0x52, 0x52) AM_READ(ym2203_status_port_0_r ) // YM2203
+ AM_RANGE(0x52, 0x53) AM_DEVREAD(SOUND, "ym", ym2203_r ) // YM2203
ADDRESS_MAP_END
static ADDRESS_MAP_START( mazinger_sound_writeport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(mazinger_rombank_w ) // ROM bank
AM_RANGE(0x10, 0x10) AM_WRITE(soundlatch_ack_w ) // To Main CPU
- AM_RANGE(0x50, 0x50) AM_WRITE(ym2203_control_port_0_w ) // YM2203
- AM_RANGE(0x51, 0x51) AM_WRITE(ym2203_write_port_0_w ) //
- AM_RANGE(0x70, 0x70) AM_WRITE(okim6295_data_0_w ) // M6295
+ AM_RANGE(0x50, 0x51) AM_DEVWRITE(SOUND, "ym", ym2203_w ) // YM2203
+ AM_RANGE(0x70, 0x70) AM_DEVWRITE(SOUND, "oki", okim6295_w) // M6295
AM_RANGE(0x74, 0x74) AM_WRITE(hotdogst_okibank_w ) // Samples bank
ADDRESS_MAP_END
@@ -1312,17 +1292,16 @@ static ADDRESS_MAP_START( metmqstr_sound_readport, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x20, 0x20) AM_READ(soundflags_r ) // Communication
AM_RANGE(0x30, 0x30) AM_READ(soundlatch_lo_r ) // From Main CPU
AM_RANGE(0x40, 0x40) AM_READ(soundlatch_hi_r ) //
- AM_RANGE(0x51, 0x51) AM_READ(ym2151_status_port_0_r ) // YM2151
+ AM_RANGE(0x50, 0x51) AM_DEVREAD(SOUND, "ym", ym2151_r ) // YM2151
ADDRESS_MAP_END
static ADDRESS_MAP_START( metmqstr_sound_writeport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(metmqstr_rombank_w ) // Rom Bank
- AM_RANGE(0x50, 0x50) AM_WRITE(ym2151_register_port_0_w ) // YM2151
- AM_RANGE(0x51, 0x51) AM_WRITE(ym2151_data_port_0_w ) //
- AM_RANGE(0x60, 0x60) AM_WRITE(okim6295_data_0_w ) // M6295 #0
+ AM_RANGE(0x50, 0x51) AM_DEVWRITE(SOUND, "ym", ym2151_w ) // YM2151
+ AM_RANGE(0x60, 0x60) AM_DEVWRITE(SOUND, "oki1", okim6295_w) // M6295 #0
AM_RANGE(0x70, 0x70) AM_WRITE(metmqstr_okibank0_w ) // Samples Bank #0
- AM_RANGE(0x80, 0x80) AM_WRITE(okim6295_data_1_w ) // M6295 #1
+ AM_RANGE(0x80, 0x80) AM_DEVWRITE(SOUND, "oki2", okim6295_w) // M6295 #1
AM_RANGE(0x90, 0x90) AM_WRITE(metmqstr_okibank1_w ) // Samples Bank #1
ADDRESS_MAP_END
@@ -1354,21 +1333,19 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( pwrinst2_sound_readport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READ(okim6295_status_0_r ) // M6295
- AM_RANGE(0x08, 0x08) AM_READ(okim6295_status_1_r ) //
- AM_RANGE(0x40, 0x40) AM_READ(ym2203_status_port_0_r ) // YM2203
- AM_RANGE(0x41, 0x41) AM_READ(ym2203_read_port_0_r ) //
+ AM_RANGE(0x00, 0x00) AM_DEVREAD(SOUND, "oki1", okim6295_r ) // M6295
+ AM_RANGE(0x08, 0x08) AM_DEVREAD(SOUND, "oki2", okim6295_r ) //
+ AM_RANGE(0x40, 0x41) AM_DEVREAD(SOUND, "ym", ym2203_r ) //
AM_RANGE(0x60, 0x60) AM_READ(soundlatch_hi_r ) // From Main CPU
AM_RANGE(0x70, 0x70) AM_READ(soundlatch_lo_r ) //
ADDRESS_MAP_END
static ADDRESS_MAP_START( pwrinst2_sound_writeport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(okim6295_data_0_w ) // M6295
- AM_RANGE(0x08, 0x08) AM_WRITE(okim6295_data_1_w ) //
+ AM_RANGE(0x00, 0x00) AM_DEVWRITE(SOUND, "oki1", okim6295_w ) // M6295
+ AM_RANGE(0x08, 0x08) AM_DEVWRITE(SOUND, "oki2", okim6295_w ) //
AM_RANGE(0x10, 0x17) AM_WRITE(NMK112_okibank_w ) // Samples bank
- AM_RANGE(0x40, 0x40) AM_WRITE(ym2203_control_port_0_w ) // YM2203
- AM_RANGE(0x41, 0x41) AM_WRITE(ym2203_write_port_0_w ) //
+ AM_RANGE(0x40, 0x41) AM_DEVWRITE(SOUND, "ym", ym2203_w ) //
AM_RANGE(0x50, 0x50) AM_WRITE(soundlatch_ack_w ) // To Main CPU
// AM_RANGE(0x51, 0x51) AM_WRITE(SMH_NOP ) // ?? volume
AM_RANGE(0x80, 0x80) AM_WRITE(pwrinst2_rombank_w ) // ROM bank
@@ -1435,20 +1412,19 @@ static ADDRESS_MAP_START( sailormn_sound_readport, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x20, 0x20) AM_READ(soundflags_r ) // Communication
AM_RANGE(0x30, 0x30) AM_READ(soundlatch_lo_r ) // From Main CPU
AM_RANGE(0x40, 0x40) AM_READ(soundlatch_hi_r ) //
- AM_RANGE(0x51, 0x51) AM_READ(ym2151_status_port_0_r ) // YM2151
- AM_RANGE(0x60, 0x60) AM_READ(okim6295_status_0_r ) // M6295 #0
- AM_RANGE(0x80, 0x80) AM_READ(okim6295_status_1_r ) // M6295 #1
+ AM_RANGE(0x50, 0x51) AM_DEVREAD(SOUND, "ym", ym2151_r ) // YM2151
+ AM_RANGE(0x60, 0x60) AM_DEVREAD(SOUND, "oki1", okim6295_r ) // M6295 #0
+ AM_RANGE(0x80, 0x80) AM_DEVREAD(SOUND, "oki2", okim6295_r ) // M6295 #1
ADDRESS_MAP_END
static ADDRESS_MAP_START( sailormn_sound_writeport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(sailormn_rombank_w ) // Rom Bank
AM_RANGE(0x10, 0x10) AM_WRITE(soundlatch_ack_w ) // To Main CPU
- AM_RANGE(0x50, 0x50) AM_WRITE(ym2151_register_port_0_w ) // YM2151
- AM_RANGE(0x51, 0x51) AM_WRITE(ym2151_data_port_0_w ) //
- AM_RANGE(0x60, 0x60) AM_WRITE(okim6295_data_0_w ) // M6295 #0
+ AM_RANGE(0x50, 0x51) AM_DEVWRITE(SOUND, "ym", ym2151_w ) // YM2151
+ AM_RANGE(0x60, 0x60) AM_DEVWRITE(SOUND, "oki1", okim6295_w ) // M6295 #0
AM_RANGE(0x70, 0x70) AM_WRITE(sailormn_okibank0_w ) // Samples Bank #0
- AM_RANGE(0x80, 0x80) AM_WRITE(okim6295_data_1_w ) // M6295 #1
+ AM_RANGE(0x80, 0x80) AM_DEVWRITE(SOUND, "oki2", okim6295_w ) // M6295 #1
AM_RANGE(0xc0, 0xc0) AM_WRITE(sailormn_okibank1_w ) // Samples Bank #1
ADDRESS_MAP_END
@@ -1960,9 +1936,9 @@ static const ymz280b_interface ymz280b_intf =
sound_irq_gen
};
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2151_interface ym2151_config =
@@ -1975,7 +1951,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
irqhandler
};
diff --git a/src/mame/drivers/cbasebal.c b/src/mame/drivers/cbasebal.c
index bc1d4de4813..99ac6e2a383 100644
--- a/src/mame/drivers/cbasebal.c
+++ b/src/mame/drivers/cbasebal.c
@@ -145,9 +145,8 @@ static ADDRESS_MAP_START( cbasebal_portmap, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x01, 0x01) AM_WRITE(eeprom_cs_w)
AM_RANGE(0x02, 0x02) AM_WRITE(eeprom_clock_w)
AM_RANGE(0x03, 0x03) AM_WRITE(eeprom_serial_w)
- AM_RANGE(0x05, 0x05) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0x06, 0x06) AM_WRITE(ym2413_register_port_0_w)
- AM_RANGE(0x07, 0x07) AM_WRITE(ym2413_data_port_0_w)
+ AM_RANGE(0x05, 0x05) AM_DEVWRITE(SOUND, "oki", okim6295_w)
+ AM_RANGE(0x06, 0x07) AM_DEVWRITE(SOUND, "ym", ym2413_w)
AM_RANGE(0x08, 0x09) AM_WRITE(cbasebal_scrollx_w)
AM_RANGE(0x0a, 0x0b) AM_WRITE(cbasebal_scrolly_w)
AM_RANGE(0x10, 0x10) AM_READ_PORT("P1")
diff --git a/src/mame/drivers/cbuster.c b/src/mame/drivers/cbuster.c
index 4963e2ef52a..9d745d4f8a9 100644
--- a/src/mame/drivers/cbuster.c
+++ b/src/mame/drivers/cbuster.c
@@ -157,46 +157,22 @@ ADDRESS_MAP_END
/******************************************************************************/
-static WRITE8_HANDLER( YM2151_w )
-{
- switch (offset) {
- case 0:
- ym2151_register_port_0_w(space,0,data);
- break;
- case 1:
- ym2151_data_port_0_w(space,0,data);
- break;
- }
-}
-
-static WRITE8_HANDLER( YM2203_w )
-{
- switch (offset) {
- case 0:
- ym2203_control_port_0_w(space,0,data);
- break;
- case 1:
- ym2203_write_port_0_w(space,0,data);
- break;
- }
-}
-
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_READ(SMH_ROM)
- AM_RANGE(0x100000, 0x100001) AM_READ(ym2203_status_port_0_r)
- AM_RANGE(0x110000, 0x110001) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0x120000, 0x120001) AM_READ(okim6295_status_0_r)
- AM_RANGE(0x130000, 0x130001) AM_READ(okim6295_status_1_r)
+ AM_RANGE(0x100000, 0x100001) AM_DEVREAD(SOUND, "ym1", ym2203_r)
+ AM_RANGE(0x110000, 0x110001) AM_DEVREAD(SOUND, "ym2", ym2151_r)
+ AM_RANGE(0x120000, 0x120001) AM_DEVREAD(SOUND, "oki1", okim6295_r)
+ AM_RANGE(0x130000, 0x130001) AM_DEVREAD(SOUND, "oki2", okim6295_r)
AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
AM_RANGE(0x1f0000, 0x1f1fff) AM_READ(SMH_BANK8)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_WRITE(SMH_ROM)
- AM_RANGE(0x100000, 0x100001) AM_WRITE(YM2203_w)
- AM_RANGE(0x110000, 0x110001) AM_WRITE(YM2151_w)
- AM_RANGE(0x120000, 0x120001) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0x130000, 0x130001) AM_WRITE(okim6295_data_1_w)
+ AM_RANGE(0x100000, 0x100001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x110000, 0x110001) AM_DEVWRITE(SOUND, "ym2", ym2151_w)
+ AM_RANGE(0x120000, 0x120001) AM_DEVWRITE(SOUND, "oki1", okim6295_w)
+ AM_RANGE(0x130000, 0x130001) AM_DEVWRITE(SOUND, "oki2", okim6295_w)
AM_RANGE(0x1f0000, 0x1f1fff) AM_WRITE(SMH_BANK8)
AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w)
AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w)
@@ -325,9 +301,9 @@ GFXDECODE_END
/******************************************************************************/
-static void sound_irq(running_machine *machine, int state)
+static void sound_irq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1],1,state); /* IRQ 2 */
+ cpu_set_input_line(device->machine->cpu[1],1,state); /* IRQ 2 */
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/ccastles.c b/src/mame/drivers/ccastles.c
index 177381a15fa..fd0b2269b2e 100644
--- a/src/mame/drivers/ccastles.c
+++ b/src/mame/drivers/ccastles.c
@@ -350,8 +350,8 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x9000, 0x90ff) AM_MIRROR(0x0300) AM_RAM AM_BASE(&nvram_stage) AM_SIZE(&generic_nvram_size)
AM_RANGE(0x9400, 0x9403) AM_MIRROR(0x01fc) AM_READ(leta_r)
AM_RANGE(0x9600, 0x97ff) AM_READ_PORT("IN0")
- AM_RANGE(0x9800, 0x980f) AM_MIRROR(0x01f0) AM_READWRITE(pokey1_r, pokey1_w)
- AM_RANGE(0x9a00, 0x9a0f) AM_MIRROR(0x01f0) AM_READWRITE(pokey2_r, pokey2_w)
+ AM_RANGE(0x9800, 0x980f) AM_MIRROR(0x01f0) AM_DEVREADWRITE(SOUND, "pokey1", pokey_r, pokey_w)
+ AM_RANGE(0x9a00, 0x9a0f) AM_MIRROR(0x01f0) AM_DEVREADWRITE(SOUND, "pokey2", pokey_r, pokey_w)
AM_RANGE(0x9c00, 0x9c7f) AM_WRITE(nvram_recall_w)
AM_RANGE(0x9c80, 0x9cff) AM_WRITE(ccastles_hscroll_w)
AM_RANGE(0x9d00, 0x9d7f) AM_WRITE(ccastles_vscroll_w)
@@ -474,8 +474,8 @@ GFXDECODE_END
static const pokey_interface pokey_config =
{
- { 0 },
- input_port_1_r
+ { DEVCB_NULL },
+ DEVCB_INPUT_PORT("IN1")
};
diff --git a/src/mame/drivers/cchance.c b/src/mame/drivers/cchance.c
index 2f82d208e70..7fa443c2477 100644
--- a/src/mame/drivers/cchance.c
+++ b/src/mame/drivers/cchance.c
@@ -74,8 +74,8 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xf000, 0xf000) AM_READNOP AM_WRITENOP //???
AM_RANGE(0xf001, 0xf001) AM_READ(input_1_r) AM_WRITE(output_0_w)
AM_RANGE(0xf002, 0xf002) AM_READ_PORT("IN0") AM_WRITE(output_1_w)
- AM_RANGE(0xf800, 0xf800) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xf801, 0xf801) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
+ AM_RANGE(0xf800, 0xf801) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0xf801, 0xf801) AM_DEVREAD(SOUND, "ay", ay8910_r)
ADDRESS_MAP_END
@@ -169,24 +169,14 @@ static GFXDECODE_START( cchance )
GFXDECODE_ENTRY( "gfx1", 0, cchance_layout, 0x0, 32 )
GFXDECODE_END
-static READ8_HANDLER( dsw1_r )
-{
- return input_port_read(space->machine, "DSW1");
-}
-
-static READ8_HANDLER( dsw2_r )
-{
- return input_port_read(space->machine, "DSW2");
-}
-
static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- dsw1_r,
- dsw2_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static MACHINE_DRIVER_START( cchance )
diff --git a/src/mame/drivers/cchasm.c b/src/mame/drivers/cchasm.c
index de4886b5368..d45baf49f02 100644
--- a/src/mame/drivers/cchasm.c
+++ b/src/mame/drivers/cchasm.c
@@ -17,7 +17,6 @@
#include "cpu/z80/z80daisy.h"
#include "cpu/m68000/m68000.h"
#include "sound/ay8910.h"
-#include "sound/custom.h"
#include "sound/dac.h"
#include "video/vector.h"
#include "machine/6840ptm.h"
@@ -52,7 +51,14 @@ static ADDRESS_MAP_START( sound_memmap, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_ROM
AM_RANGE(0x4000, 0x43ff) AM_RAM
AM_RANGE(0x5000, 0x53ff) AM_RAM
- AM_RANGE(0x6000, 0x6fff) AM_READWRITE(cchasm_snd_io_r,cchasm_snd_io_w)
+ AM_RANGE(0x6000, 0x6001) AM_MIRROR(0xf9e) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x6000, 0x6000) AM_MIRROR(0xf9e) AM_READ(cchasm_coin_sound_r)
+ AM_RANGE(0x6001, 0x6001) AM_MIRROR(0xf9e) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0x6020, 0x6021) AM_MIRROR(0xf9e) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x6021, 0x6021) AM_MIRROR(0xf9e) AM_DEVREAD(SOUND, "ay2", ay8910_r)
+ AM_RANGE(0x6040, 0x6040) AM_MIRROR(0xf9e) AM_READWRITE(soundlatch_r, soundlatch3_w)
+ AM_RANGE(0x6041, 0x6041) AM_MIRROR(0xf9e) AM_READWRITE(cchasm_soundlatch2_r, cchasm_soundlatch4_w)
+ AM_RANGE(0x6061, 0x6061) AM_MIRROR(0xf9e) AM_DEVWRITE(Z80CTC, "ctc", z80ctc_trg0_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_portmap, ADDRESS_SPACE_IO, 8 )
diff --git a/src/mame/drivers/cclimber.c b/src/mame/drivers/cclimber.c
index be45be46333..6624b81b1a6 100644
--- a/src/mame/drivers/cclimber.c
+++ b/src/mame/drivers/cclimber.c
@@ -381,9 +381,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( cclimber_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x08, 0x08) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x09, 0x09) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x0c, 0x0c) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0x08, 0x09) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0x0c, 0x0c) AM_DEVREAD(SOUND, "ay", ay8910_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( yamato_portmap, ADDRESS_SPACE_IO, 8 )
@@ -408,18 +407,14 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( swimmer_audio_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay1", ay8910_data_address_w)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "ay2", ay8910_data_address_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( yamato_audio_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x02, 0x02) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x02, 0x03) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
AM_RANGE(0x04, 0x04) AM_READ(yamato_p0_r) /* ??? */
AM_RANGE(0x08, 0x08) AM_READ(yamato_p1_r) /* ??? */
ADDRESS_MAP_END
diff --git a/src/mame/drivers/centiped.c b/src/mame/drivers/centiped.c
index 756888a268e..01fc93a4ab6 100644
--- a/src/mame/drivers/centiped.c
+++ b/src/mame/drivers/centiped.c
@@ -625,9 +625,9 @@ static WRITE8_HANDLER( led_w )
}
-static READ8_HANDLER( caterplr_rand_r )
+static READ8_DEVICE_HANDLER( caterplr_rand_r )
{
- return mame_rand(space->machine) % 0xff;
+ return mame_rand(device->machine) % 0xff;
}
@@ -650,17 +650,17 @@ static WRITE8_HANDLER( bullsdrt_coin_count_w )
*
*************************************/
-static WRITE8_HANDLER( caterplr_AY8910_w )
+static WRITE8_DEVICE_HANDLER( caterplr_AY8910_w )
{
- ay8910_control_port_0_w(space, 0, offset);
- ay8910_write_port_0_w(space, 0, data);
+ ay8910_address_w(device, 0, offset);
+ ay8910_data_w(device, 0, data);
}
-static READ8_HANDLER( caterplr_AY8910_r )
+static READ8_DEVICE_HANDLER( caterplr_AY8910_r )
{
- ay8910_control_port_0_w(space, 0, offset);
- return ay8910_read_port_0_r(space, 0);
+ ay8910_address_w(device, 0, offset);
+ return ay8910_r(device, 0);
}
@@ -682,7 +682,7 @@ static ADDRESS_MAP_START( centiped_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0c01, 0x0c01) AM_READ_PORT("IN1") /* IN1 */
AM_RANGE(0x0c02, 0x0c02) AM_READ(centiped_IN2_r) /* IN2 */
AM_RANGE(0x0c03, 0x0c03) AM_READ_PORT("IN3") /* IN3 */
- AM_RANGE(0x1000, 0x100f) AM_READWRITE(pokey1_r, pokey1_w)
+ AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE(SOUND, "pokey", pokey_r, pokey_w)
AM_RANGE(0x1400, 0x140f) AM_WRITE(centiped_paletteram_w) AM_BASE(&paletteram)
AM_RANGE(0x1600, 0x163f) AM_WRITE(atari_vg_earom_w)
AM_RANGE(0x1680, 0x1680) AM_WRITE(atari_vg_earom_ctrl_w)
@@ -707,8 +707,8 @@ static ADDRESS_MAP_START( centipdb_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0c01, 0x0c01) AM_MIRROR(0x4000) AM_READ_PORT("IN1") /* IN1 */
AM_RANGE(0x0c02, 0x0c02) AM_MIRROR(0x4000) AM_READ(centiped_IN2_r) /* IN2 */
AM_RANGE(0x0c03, 0x0c03) AM_MIRROR(0x4000) AM_READ_PORT("IN3") /* IN3 */
- AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x4000) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x1001, 0x1001) AM_MIRROR(0x4000) AM_READWRITE(ay8910_read_port_0_r, ay8910_control_port_0_w)
+ AM_RANGE(0x1000, 0x1001) AM_MIRROR(0x4000) AM_DEVWRITE(SOUND, "pokey", ay8910_data_address_w)
+ AM_RANGE(0x1001, 0x1001) AM_MIRROR(0x4000) AM_DEVREAD(SOUND, "pokey", ay8910_r)
AM_RANGE(0x1400, 0x140f) AM_MIRROR(0x4000) AM_WRITE(centiped_paletteram_w) AM_BASE(&paletteram)
AM_RANGE(0x1600, 0x163f) AM_MIRROR(0x4000) AM_WRITE(atari_vg_earom_w)
AM_RANGE(0x1680, 0x1680) AM_MIRROR(0x4000) AM_WRITE(atari_vg_earom_ctrl_w)
@@ -733,8 +733,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( milliped_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_GLOBAL_MASK(0x7fff)
AM_RANGE(0x0000, 0x03ff) AM_RAM
- AM_RANGE(0x0400, 0x040f) AM_READWRITE(pokey1_r, pokey1_w)
- AM_RANGE(0x0800, 0x080f) AM_READWRITE(pokey2_r, pokey2_w)
+ AM_RANGE(0x0400, 0x040f) AM_DEVREADWRITE(SOUND, "pokey", pokey_r, pokey_w)
+ AM_RANGE(0x0800, 0x080f) AM_DEVREADWRITE(SOUND, "pokey2", pokey_r, pokey_w)
AM_RANGE(0x1000, 0x13bf) AM_RAM_WRITE(centiped_videoram_w) AM_BASE(&videoram)
AM_RANGE(0x13c0, 0x13ff) AM_RAM AM_BASE(&spriteram)
AM_RANGE(0x2000, 0x2000) AM_READ(centiped_IN0_r)
@@ -772,7 +772,7 @@ static ADDRESS_MAP_START( warlords_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0801, 0x0801) AM_READ_PORT("DSW2") /* DSW2 */
AM_RANGE(0x0c00, 0x0c00) AM_READ_PORT("IN0") /* IN0 */
AM_RANGE(0x0c01, 0x0c01) AM_READ_PORT("IN1") /* IN1 */
- AM_RANGE(0x1000, 0x100f) AM_READWRITE(pokey1_r, pokey1_w)
+ AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE(SOUND, "pokey", pokey_r, pokey_w)
AM_RANGE(0x1800, 0x1800) AM_WRITE(irq_ack_w)
AM_RANGE(0x1c00, 0x1c02) AM_WRITE(coin_count_w)
AM_RANGE(0x1c03, 0x1c06) AM_WRITE(led_w)
@@ -791,8 +791,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( mazeinv_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_GLOBAL_MASK(0x7fff)
AM_RANGE(0x0000, 0x03ff) AM_RAM
- AM_RANGE(0x0400, 0x040f) AM_READWRITE(pokey1_r, pokey1_w)
- AM_RANGE(0x0800, 0x080f) AM_READWRITE(pokey2_r, pokey2_w)
+ AM_RANGE(0x0400, 0x040f) AM_DEVREADWRITE(SOUND, "pokey", pokey_r, pokey_w)
+ AM_RANGE(0x0800, 0x080f) AM_DEVREADWRITE(SOUND, "pokey2", pokey_r, pokey_w)
AM_RANGE(0x1000, 0x13bf) AM_RAM_WRITE(centiped_videoram_w) AM_BASE(&videoram)
AM_RANGE(0x13c0, 0x13ff) AM_RAM AM_BASE(&spriteram)
AM_RANGE(0x2000, 0x2000) AM_READ_PORT("IN0")
@@ -848,7 +848,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( bullsdrt_port_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0x00) AM_WRITE(bullsdrt_sprites_bank_w)
AM_RANGE(0x20, 0x3f) AM_WRITE(bullsdrt_tilesbank_w) AM_BASE(&bullsdrt_tiles_bankram)
- AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_READWRITE(bullsdrt_data_port_r, sn76496_0_w)
+ AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_READ(bullsdrt_data_port_r) AM_DEVWRITE(SOUND, "sn", sn76496_w)
ADDRESS_MAP_END
@@ -1550,27 +1550,32 @@ static const ay8910_interface centipdb_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- caterplr_rand_r
+ DEVCB_HANDLER(caterplr_rand_r)
};
static const pokey_interface milliped_pokey_interface_1 =
{
- { 0 },
- input_port_4_r
+ { DEVCB_NULL },
+ DEVCB_INPUT_PORT("DSW1")
};
static const pokey_interface milliped_pokey_interface_2 =
{
- { 0 },
- input_port_5_r
+ { DEVCB_NULL },
+ DEVCB_INPUT_PORT("DSW2")
};
static const pokey_interface warlords_pokey_interface =
{
- { input_port_4_r,input_port_5_r,input_port_6_r,input_port_7_r }
+ {
+ DEVCB_INPUT_PORT("PADDLE0"),
+ DEVCB_INPUT_PORT("PADDLE1"),
+ DEVCB_INPUT_PORT("PADDLE2"),
+ DEVCB_INPUT_PORT("PADDLE3")
+ }
};
@@ -1970,15 +1975,19 @@ ROM_END
static DRIVER_INIT( caterplr )
{
- memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1000, 0x100f, 0, 0, caterplr_AY8910_r, caterplr_AY8910_w);
- memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1780, 0x1780, 0, 0, caterplr_rand_r);
+ const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const device_config *device = devtag_get_device(machine, SOUND, "pokey");
+ memory_install_readwrite8_device_handler(space, device, 0x1000, 0x100f, 0, 0, caterplr_AY8910_r, caterplr_AY8910_w);
+ memory_install_read8_device_handler(space, device, 0x1780, 0x1780, 0, 0, caterplr_rand_r);
}
static DRIVER_INIT( magworm )
{
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1001, 0x1001, 0, 0, ay8910_control_port_0_w);
- memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1003, 0x1003, 0, 0, ay8910_read_port_0_r, ay8910_write_port_0_w);
+ const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const device_config *device = devtag_get_device(machine, SOUND, "pokey");
+ memory_install_write8_device_handler(space, device, 0x1001, 0x1001, 0, 0, ay8910_address_w);
+ memory_install_readwrite8_device_handler(space, device, 0x1003, 0x1003, 0, 0, ay8910_r, ay8910_data_w);
}
diff --git a/src/mame/drivers/chaknpop.c b/src/mame/drivers/chaknpop.c
index 691509944e9..da83b67223e 100644
--- a/src/mame/drivers/chaknpop.c
+++ b/src/mame/drivers/chaknpop.c
@@ -17,14 +17,14 @@
***************************************************************************/
-static WRITE8_HANDLER ( unknown_port_1_w )
+static WRITE8_DEVICE_HANDLER ( unknown_port_1_w )
{
- //logerror("%04x: write to unknow port 1: 0x%02x\n", cpu_get_pc(space->cpu), data);
+ //logerror("%s: write to unknow port 1: 0x%02x\n", cpuexec_describe_context(device->machine), data);
}
-static WRITE8_HANDLER ( unknown_port_2_w )
+static WRITE8_DEVICE_HANDLER ( unknown_port_2_w )
{
- //logerror("%04x: write to unknow port 2: 0x%02x\n", cpu_get_pc(space->cpu), data);
+ //logerror("%s: write to unknow port 2: 0x%02x\n", cpuexec_describe_context(device->machine), data);
}
static WRITE8_HANDLER ( coinlock_w )
@@ -45,8 +45,8 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8800, 0x8800) AM_READ(chaknpop_mcu_portA_r)
AM_RANGE(0x8801, 0x8801) AM_READ(chaknpop_mcu_portB_r)
AM_RANGE(0x8802, 0x8802) AM_READ(chaknpop_mcu_portC_r)
- AM_RANGE(0x8805, 0x8805) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x8807, 0x8807) AM_READ(ay8910_read_port_1_r)
+ AM_RANGE(0x8805, 0x8805) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0x8807, 0x8807) AM_DEVREAD(SOUND, "ay2", ay8910_r)
AM_RANGE(0x8808, 0x8808) AM_READ_PORT("DSWC")
AM_RANGE(0x8809, 0x8809) AM_READ_PORT("P1")
AM_RANGE(0x880a, 0x880a) AM_READ_PORT("SYSTEM")
@@ -65,10 +65,8 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8800, 0x8800) AM_WRITE(chaknpop_mcu_portA_w)
AM_RANGE(0x8801, 0x8801) AM_WRITE(chaknpop_mcu_portB_w)
AM_RANGE(0x8802, 0x8802) AM_WRITE(chaknpop_mcu_portC_w)
- AM_RANGE(0x8804, 0x8804) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x8805, 0x8805) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x8806, 0x8806) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x8807, 0x8807) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0x8804, 0x8805) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x8806, 0x8807) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
AM_RANGE(0x880c, 0x880c) AM_WRITE(chaknpop_gfxmode_w)
AM_RANGE(0x880D, 0x880D) AM_WRITE(coinlock_w) // coin lock out
AM_RANGE(0x9000, 0x93ff) AM_WRITE(chaknpop_txram_w) AM_BASE(&chaknpop_txram)
@@ -82,20 +80,20 @@ static const ay8910_interface ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_5_r, // DSW A
- input_port_4_r, // DSW B
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSWA"), // DSW A
+ DEVCB_INPUT_PORT("DSWB"), // DSW B
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- unknown_port_1_w, // ??
- unknown_port_2_w // ??
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(unknown_port_1_w), // ??
+ DEVCB_HANDLER(unknown_port_2_w) // ??
};
diff --git a/src/mame/drivers/cham24.c b/src/mame/drivers/cham24.c
index 2b3872170c0..880488e4125 100644
--- a/src/mame/drivers/cham24.c
+++ b/src/mame/drivers/cham24.c
@@ -66,19 +66,19 @@ static WRITE8_HANDLER( sprite_dma_w )
ppu2c0x_spriteram_dma( space, 0, source );
}
-static READ8_HANDLER( psg_4015_r )
+static READ8_DEVICE_HANDLER( psg_4015_r )
{
- return nes_psg_0_r(space,0x15);
+ return nes_psg_r(device,0x15);
}
-static WRITE8_HANDLER( psg_4015_w )
+static WRITE8_DEVICE_HANDLER( psg_4015_w )
{
- nes_psg_0_w(space,0x15, data);
+ nes_psg_w(device,0x15, data);
}
-static WRITE8_HANDLER( psg_4017_w )
+static WRITE8_DEVICE_HANDLER( psg_4017_w )
{
- nes_psg_0_w(space,0x17, data);
+ nes_psg_w(device,0x17, data);
}
static UINT32 in_0;
@@ -159,11 +159,11 @@ static WRITE8_HANDLER( cham24_mapper_w )
static ADDRESS_MAP_START( cham24_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM /* NES RAM */
AM_RANGE(0x2000, 0x3fff) AM_READWRITE(ppu2c0x_0_r, ppu2c0x_0_w)
- AM_RANGE(0x4000, 0x4013) AM_READWRITE(nes_psg_0_r, nes_psg_0_w) /* PSG primary registers */
+ AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE(SOUND, "nes", nes_psg_r, nes_psg_w) /* PSG primary registers */
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_w)
- AM_RANGE(0x4015, 0x4015) AM_READWRITE(psg_4015_r, psg_4015_w) /* PSG status / first control register */
+ AM_RANGE(0x4015, 0x4015) AM_DEVREADWRITE(SOUND, "nes", psg_4015_r, psg_4015_w) /* PSG status / first control register */
AM_RANGE(0x4016, 0x4016) AM_READWRITE(cham24_IN0_r, cham24_IN0_w) /* IN0 - input port 1 */
- AM_RANGE(0x4017, 0x4017) AM_READWRITE(cham24_IN1_r, psg_4017_w) /* IN1 - input port 2 / PSG second control register */
+ AM_RANGE(0x4017, 0x4017) AM_READ(cham24_IN1_r) AM_DEVWRITE(SOUND, "nes", psg_4017_w) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x8000, 0xffff) AM_ROM AM_WRITE(cham24_mapper_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/champbas.c b/src/mame/drivers/champbas.c
index 139b8efdff0..0292a1b3d9e 100644
--- a/src/mame/drivers/champbas.c
+++ b/src/mame/drivers/champbas.c
@@ -149,15 +149,9 @@ static MACHINE_START( exctsccr )
// Champion Baseball has only one DAC
-static WRITE8_HANDLER( champbas_dac_w )
+static WRITE8_DEVICE_HANDLER( champbas_dac_w )
{
- dac_signed_data_w(0, data << 2);
-}
-
-// Exciting Soccer has two
-static WRITE8_HANDLER( exctsccr_DAC_data_w )
-{
- dac_signed_data_w(offset, data << 2);
+ dac_signed_data_w(device, data << 2);
}
@@ -219,8 +213,7 @@ AB 1010_1011
static ADDRESS_MAP_START( talbot_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x5fff) AM_ROM
AM_RANGE(0x6000, 0x63ff) AM_RAM AM_SHARE(1) /* MCU shared RAM */
- AM_RANGE(0x7000, 0x7000) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x7001, 0x7001) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x7000, 0x7001) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
AM_RANGE(0x8000, 0x87ff) AM_RAM_WRITE(champbas_bg_videoram_w) AM_BASE(&champbas_bg_videoram)
AM_RANGE(0x8800, 0x8fef) AM_RAM
AM_RANGE(0x8ff0, 0x8fff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
@@ -247,8 +240,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( champbas_main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x5fff) AM_ROM
AM_RANGE(0x6000, 0x63ff) AM_RAM AM_SHARE(1)
- AM_RANGE(0x7000, 0x7000) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x7001, 0x7001) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x7000, 0x7001) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
AM_RANGE(0x7800, 0x7fff) AM_ROM // champbb2 only
AM_RANGE(0x8000, 0x87ff) AM_RAM_WRITE(champbas_bg_videoram_w) AM_BASE(&champbas_bg_videoram)
AM_RANGE(0x8800, 0x8fef) AM_RAM
@@ -280,8 +272,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( exctsccb_main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x5fff) AM_ROM
// AM_RANGE(0x6000, 0x63ff) AM_RAM AM_SHARE(1) // MCU not used (though it's present on the board)
- AM_RANGE(0x7000, 0x7000) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x7001, 0x7001) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x7000, 0x7001) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
// AM_RANGE(0x7800, 0x7fff) AM_ROM // champbb2 only
AM_RANGE(0x8000, 0x87ff) AM_RAM_WRITE(champbas_bg_videoram_w) AM_BASE(&champbas_bg_videoram)
AM_RANGE(0x8800, 0x8fff) AM_RAM AM_BASE(&spriteram_2) /* ??? */
@@ -335,7 +326,7 @@ static ADDRESS_MAP_START( champbas_sub_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x6000, 0x7fff) AM_READ(soundlatch_r)
AM_RANGE(0x8000, 0x9fff) AM_WRITENOP // 4-bit return code to main CPU (not used)
AM_RANGE(0xa000, 0xbfff) AM_WRITE(soundlatch_clear_w)
- AM_RANGE(0xc000, 0xdfff) AM_WRITE(champbas_dac_w)
+ AM_RANGE(0xc000, 0xdfff) AM_DEVWRITE(SOUND, "dac", champbas_dac_w)
AM_RANGE(0xe000, 0xe3ff) AM_MIRROR(0x1c00) AM_RAM
ADDRESS_MAP_END
@@ -343,7 +334,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( exctsccr_sub_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x8fff) AM_ROM
AM_RANGE(0xa000, 0xa7ff) AM_RAM
- AM_RANGE(0xc008, 0xc009) AM_WRITE(exctsccr_DAC_data_w)
+ AM_RANGE(0xc008, 0xc008) AM_DEVWRITE(SOUND, "dac1", champbas_dac_w)
+ AM_RANGE(0xc009, 0xc009) AM_DEVWRITE(SOUND, "dac2", champbas_dac_w)
AM_RANGE(0xc00c, 0xc00c) AM_WRITE(soundlatch_clear_w)
AM_RANGE(0xc00d, 0xc00d) AM_READ(soundlatch_r)
// AM_RANGE(0xc00f, 0xc00f) AM_WRITENOP /* ??? */
@@ -351,14 +343,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( exctsccr_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK( 0x00ff )
- AM_RANGE(0x82, 0x82) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x83, 0x83) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x86, 0x86) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x87, 0x87) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x8a, 0x8a) AM_WRITE(ay8910_write_port_2_w)
- AM_RANGE(0x8b, 0x8b) AM_WRITE(ay8910_control_port_2_w)
- AM_RANGE(0x8e, 0x8e) AM_WRITE(ay8910_write_port_3_w)
- AM_RANGE(0x8f, 0x8f) AM_WRITE(ay8910_control_port_3_w)
+ AM_RANGE(0x82, 0x83) AM_DEVWRITE(SOUND, "ay1", ay8910_data_address_w)
+ AM_RANGE(0x86, 0x87) AM_DEVWRITE(SOUND, "ay2", ay8910_data_address_w)
+ AM_RANGE(0x8a, 0x8b) AM_DEVWRITE(SOUND, "ay3", ay8910_data_address_w)
+ AM_RANGE(0x8e, 0x8f) AM_DEVWRITE(SOUND, "ay4", ay8910_data_address_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/champbwl.c b/src/mame/drivers/champbwl.c
index c0c98093e81..212fc39c3a0 100644
--- a/src/mame/drivers/champbwl.c
+++ b/src/mame/drivers/champbwl.c
@@ -195,7 +195,7 @@ static ADDRESS_MAP_START( champbwl_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(1)
AM_RANGE(0x8000, 0x87ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
AM_RANGE(0xa000, 0xbfff) AM_RAM AM_BASE(&tnzs_objram)
- AM_RANGE(0xc000, 0xdfff) AM_READWRITE(seta_sound_r, seta_sound_w)
+ AM_RANGE(0xc000, 0xdfff) AM_DEVREADWRITE(SOUND, "x1", seta_sound_r, seta_sound_w)
AM_RANGE(0xe000, 0xe1ff) AM_RAM AM_BASE(&tnzs_vdcram)
AM_RANGE(0xe200, 0xe2ff) AM_RAM AM_BASE(&tnzs_scrollram) /* scrolling info */
AM_RANGE(0xe300, 0xe303) AM_MIRROR(0xfc) AM_WRITE(champbwl_objctrl_w) AM_BASE(&tnzs_objctrl) /* control registers (0x80 mirror used by Arkanoid 2) */
diff --git a/src/mame/drivers/chanbara.c b/src/mame/drivers/chanbara.c
index 5ee19d41c45..1a3c093d95e 100644
--- a/src/mame/drivers/chanbara.c
+++ b/src/mame/drivers/chanbara.c
@@ -183,8 +183,7 @@ static ADDRESS_MAP_START( memmap, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x2000, 0x2000) AM_READ_PORT("DSW0")
AM_RANGE(0x2001, 0x2001) AM_READ_PORT("SYSTEM")
AM_RANGE(0x2003, 0x2003) AM_READ_PORT("JOY")
- AM_RANGE(0x3800, 0x3800) AM_READ(ym2203_status_port_0_r) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x3801, 0x3801) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0x3800, 0x3801) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1)
AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM)
ADDRESS_MAP_END
@@ -296,24 +295,24 @@ GFXDECODE_END
/***************************************************************************/
-static WRITE8_HANDLER(chanbara_ay_out_0_w)
+static WRITE8_DEVICE_HANDLER(chanbara_ay_out_0_w)
{
// printf("chanbara_ay_out_0_w %02x\n",data);
scroll=data;
}
-static WRITE8_HANDLER(chanbara_ay_out_1_w)
+static WRITE8_DEVICE_HANDLER(chanbara_ay_out_1_w)
{
// printf("chanbara_ay_out_1_w %02x\n",data);
- memory_set_bankptr(space->machine, 1, memory_region(space->machine, "user1") + ((data&4)?0x4000:0x0000) );
+ memory_set_bankptr(device->machine, 1, memory_region(device->machine, "user1") + ((data&4)?0x4000:0x0000) );
scrollhi = data & 0x03;
//if (data&0xf8) printf("chanbara_ay_out_1_w unused bits set %02x\n",data&0xf8);
}
-static void sound_irq(running_machine *machine, int linestate)
+static void sound_irq(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[0],0,linestate);
+ cpu_set_input_line(device->machine->cpu[0],0,linestate);
}
@@ -322,10 +321,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- 0,
- 0,
- chanbara_ay_out_0_w,
- chanbara_ay_out_1_w,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(chanbara_ay_out_0_w),
+ DEVCB_HANDLER(chanbara_ay_out_1_w),
},
sound_irq
};
diff --git a/src/mame/drivers/changela.c b/src/mame/drivers/changela.c
index d7481f7c5e5..c394258719c 100644
--- a/src/mame/drivers/changela.c
+++ b/src/mame/drivers/changela.c
@@ -256,8 +256,8 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xc000, 0xc7ff) AM_READ(changela_mem_device_r) /* RAM4 (River Bed RAM); RAM5 (Tree RAM) */
- AM_RANGE(0xd000, 0xd000) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0xd010, 0xd010) AM_READ(ay8910_read_port_1_r)
+ AM_RANGE(0xd000, 0xd000) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0xd010, 0xd010) AM_DEVREAD(SOUND, "ay2", ay8910_r)
/* LS139 - U24 */
AM_RANGE(0xd024, 0xd024) AM_READ(changela_24_r)
@@ -288,10 +288,8 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xca00, 0xca00) AM_WRITE(changela_slope_rom_addr_hi_w)
AM_RANGE(0xcb00, 0xcb00) AM_WRITE(changela_slope_rom_addr_lo_w)
- AM_RANGE(0xd000, 0xd000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xd001, 0xd001) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xd010, 0xd010) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0xd011, 0xd011) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0xd000, 0xd001) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0xd010, 0xd011) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
/* LS259 - U44 */
AM_RANGE(0xd020, 0xd020) AM_WRITE(changela_collision_reset_0)
@@ -451,20 +449,20 @@ static const ay8910_interface ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r,
- input_port_1_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSWA"),
+ DEVCB_INPUT_PORT("DSWB"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_2_r,
- input_port_3_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSWC"),
+ DEVCB_INPUT_PORT("DSWD"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/chinagat.c b/src/mame/drivers/chinagat.c
index 8b6040efe0f..4862c71f7bc 100644
--- a/src/mame/drivers/chinagat.c
+++ b/src/mame/drivers/chinagat.c
@@ -248,17 +248,17 @@ static WRITE8_HANDLER( saiyugb1_adpcm_rom_addr_w )
saiyugb1_i8748_P1 = data;
}
-static WRITE8_HANDLER( saiyugb1_adpcm_control_w )
+static WRITE8_DEVICE_HANDLER( saiyugb1_adpcm_control_w )
{
/* i8748 Port 2 write */
- UINT8 *saiyugb1_adpcm_rom = memory_region(space->machine, "adpcm");
+ UINT8 *saiyugb1_adpcm_rom = memory_region(device->machine, "adpcm");
if (data & 0x80) /* Reset m5205 and disable ADPCM ROM outputs */
{
logerror("ADPCM output disabled\n");
saiyugb1_pcm_nibble = 0x0f;
- msm5205_reset_w(0,1);
+ msm5205_reset_w(device,1);
}
else
{
@@ -287,7 +287,7 @@ static WRITE8_HANDLER( saiyugb1_adpcm_control_w )
if ( ((saiyugb1_i8748_P2 & 0xc) >= 8) && ((data & 0xc) == 4) )
{
- msm5205_data_w (0, saiyugb1_pcm_nibble);
+ msm5205_data_w (device, saiyugb1_pcm_nibble);
logerror("Writing %02x to m5205\n",saiyugb1_pcm_nibble);
}
logerror("$ROM=%08x P1=%02x P2=%02x Prev_P2=%02x Nibble=%1x PCM_data=%02x\n",saiyugb1_adpcm_addr,saiyugb1_i8748_P1,data,saiyugb1_i8748_P2,saiyugb1_pcm_shift,saiyugb1_pcm_nibble);
@@ -295,7 +295,7 @@ static WRITE8_HANDLER( saiyugb1_adpcm_control_w )
saiyugb1_i8748_P2 = data;
}
-static WRITE8_HANDLER( saiyugb1_m5205_clk_w )
+static WRITE8_DEVICE_HANDLER( saiyugb1_m5205_clk_w )
{
/* i8748 T0 output clk mode */
/* This signal goes through a divide by 8 counter */
@@ -307,12 +307,12 @@ static WRITE8_HANDLER( saiyugb1_m5205_clk_w )
saiyugb1_m5205_clk++;
if (saiyugb1_m5205_clk == 8)
}
- msm5205_vclk_w (0, 1); /* ??? */
+ msm5205_vclk_w (device, 1); /* ??? */
saiyugb1_m5205_clk = 0;
}
else
}
- msm5205_vclk_w (0, 0); /* ??? */
+ msm5205_vclk_w (device, 0); /* ??? */
}
#endif
}
@@ -365,9 +365,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
- AM_RANGE(0x8800, 0x8800) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x8801, 0x8801) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
- AM_RANGE(0x9800, 0x9800) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x8800, 0x8801) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0xA000, 0xA000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -377,26 +376,22 @@ static ADDRESS_MAP_START( ym2203c_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
// 8804 and/or 8805 make a gong sound when the coin goes in
// but only on the title screen....
- AM_RANGE(0x8800, 0x8800) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x8801, 0x8801) AM_WRITE(ym2203_write_port_0_w)
-// AM_RANGE(0x8802, 0x8802) AM_READWRITE(okim6295_data_0_w, okim6295_status_0_r)
-// AM_RANGE(0x8803, 0x8803) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0x8804, 0x8804) AM_READWRITE(ym2203_status_port_1_r, ym2203_control_port_1_w)
- AM_RANGE(0x8805, 0x8805) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0x8800, 0x8801) AM_DEVREADWRITE(SOUND, "ym1", ym2203_r, ym2203_w)
+// AM_RANGE(0x8802, 0x8802) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
+// AM_RANGE(0x8803, 0x8803) AM_DEVWRITE(SOUND, "oki", okim6295_w)
+ AM_RANGE(0x8804, 0x8805) AM_DEVREADWRITE(SOUND, "ym2", ym2203_r, ym2203_w)
// AM_RANGE(0x8804, 0x8804) AM_WRITE(SMH_RAM)
// AM_RANGE(0x8805, 0x8805) AM_WRITE(SMH_RAM)
-// AM_RANGE(0x8800, 0x8800) AM_WRITE(ym2151_register_port_0_w)
-// AM_RANGE(0x8801, 0x8801) AM_WRITE(ym2151_data_port_0_w)
-// AM_RANGE(0x9800, 0x9800) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+// AM_RANGE(0x8800, 0x8801) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+// AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0xA000, 0xA000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( saiyugb1_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
- AM_RANGE(0x8800, 0x8800) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x8801, 0x8801) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x8800, 0x8801) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x9800, 0x9800) AM_WRITE(saiyugb1_mcu_command_w)
AM_RANGE(0xA000, 0xA000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -408,10 +403,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( i8748_portmap, ADDRESS_SPACE_IO, 8 )
AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ(saiyugb1_mcu_command_r)
- AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_WRITE(saiyugb1_m5205_clk_w) /* Drives the clock on the m5205 at 1/8 of this frequency */
+ AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_DEVWRITE(SOUND, "adpcm", saiyugb1_m5205_clk_w) /* Drives the clock on the m5205 at 1/8 of this frequency */
AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(saiyugb1_m5205_irq_r)
AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(saiyugb1_adpcm_rom_addr_w)
- AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(saiyugb1_adpcm_control_w)
+ AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_DEVWRITE(SOUND, "adpcm", saiyugb1_adpcm_control_w)
ADDRESS_MAP_END
@@ -523,9 +518,9 @@ static GFXDECODE_START( chinagat )
GFXDECODE_END
-static void chinagat_irq_handler(running_machine *machine, int irq)
+static void chinagat_irq_handler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[2], 0, irq ? ASSERT_LINE : CLEAR_LINE );
+ cpu_set_input_line(device->machine->cpu[2], 0, irq ? ASSERT_LINE : CLEAR_LINE );
}
static const ym2151_interface ym2151_config =
@@ -546,7 +541,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
chinagat_irq_handler
};
diff --git a/src/mame/drivers/chinsan.c b/src/mame/drivers/chinsan.c
index 9624df4293c..9fe42ec4f80 100644
--- a/src/mame/drivers/chinsan.c
+++ b/src/mame/drivers/chinsan.c
@@ -83,13 +83,13 @@ static WRITE8_HANDLER(ctrl_w)
memory_set_bank(space->machine, 1, data >> 6);
}
-static WRITE8_HANDLER( ym_port_w1 )
+static WRITE8_DEVICE_HANDLER( ym_port_w1 )
{
logerror("ym_write port 1 %02x\n",data);
}
-static WRITE8_HANDLER( ym_port_w2 )
+static WRITE8_DEVICE_HANDLER( ym_port_w2 )
{
logerror("ym_write port 2 %02x\n",data);
}
@@ -100,10 +100,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r,
- input_port_1_r,
- ym_port_w1,
- ym_port_w2
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_HANDLER(ym_port_w1),
+ DEVCB_HANDLER(ym_port_w2)
},
};
@@ -198,8 +198,7 @@ static ADDRESS_MAP_START( chinsan_io, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0x00) AM_WRITE(chinsan_port00_w)
AM_RANGE(0x01, 0x01) AM_READ(chinsan_input_port_0_r)
AM_RANGE(0x02, 0x02) AM_READ(chinsan_input_port_1_r)
- AM_RANGE(0x10, 0x10) AM_READ(ym2203_status_port_0_r) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x11, 0x11) AM_READ(ym2203_read_port_0_r) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0x10, 0x11) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
AM_RANGE(0x30, 0x30) AM_WRITE(ctrl_w) // ROM bank + unknown stuff (input mutliplex?)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/chqflag.c b/src/mame/drivers/chqflag.c
index c423fdfce1a..2684093fc74 100644
--- a/src/mame/drivers/chqflag.c
+++ b/src/mame/drivers/chqflag.c
@@ -21,7 +21,7 @@ Dip locations and recommended settings verified with manual
static int K051316_readroms;
-static WRITE8_HANDLER( k007232_extvolume_w );
+static WRITE8_DEVICE_HANDLER( k007232_extvolume_w );
/* from video/chqflag.c */
VIDEO_START( chqflag );
@@ -186,9 +186,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( chqflag_readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) /* ROM */
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM) /* RAM */
- AM_RANGE(0xa000, 0xa00d) AM_READ(k007232_read_port_0_r) /* 007232 (chip 1) */
- AM_RANGE(0xb000, 0xb00d) AM_READ(k007232_read_port_1_r) /* 007232 (chip 2) */
- AM_RANGE(0xc001, 0xc001) AM_READ(ym2151_status_port_0_r) /* YM2151 */
+ AM_RANGE(0xa000, 0xa00d) AM_DEVREAD(SOUND, "konami1", k007232_r) /* 007232 (chip 1) */
+ AM_RANGE(0xb000, 0xb00d) AM_DEVREAD(SOUND, "konami2", k007232_r) /* 007232 (chip 2) */
+ AM_RANGE(0xc000, 0xc001) AM_DEVREAD(SOUND, "ym", ym2151_r) /* YM2151 */
AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_r) /* soundlatch_r */
//AM_RANGE(0xe000, 0xe000) AM_READ(SMH_NOP) /* ??? */
ADDRESS_MAP_END
@@ -200,24 +200,23 @@ static WRITE8_HANDLER( k007232_bankswitch_w )
/* banks # for the 007232 (chip 1) */
bank_A = ((data >> 4) & 0x03);
bank_B = ((data >> 6) & 0x03);
- k007232_set_bank( 0, bank_A, bank_B );
+ k007232_set_bank( devtag_get_device(space->machine, SOUND, "konami1"), bank_A, bank_B );
/* banks # for the 007232 (chip 2) */
bank_A = ((data >> 0) & 0x03);
bank_B = ((data >> 2) & 0x03);
- k007232_set_bank( 1, bank_A, bank_B );
+ k007232_set_bank( devtag_get_device(space->machine, SOUND, "konami2"), bank_A, bank_B );
}
static ADDRESS_MAP_START( chqflag_writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM) /* ROM */
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM) /* RAM */
AM_RANGE(0x9000, 0x9000) AM_WRITE(k007232_bankswitch_w) /* 007232 bankswitch */
- AM_RANGE(0xa000, 0xa00d) AM_WRITE(k007232_write_port_0_w) /* 007232 (chip 1) */
- AM_RANGE(0xa01c, 0xa01c) AM_WRITE(k007232_extvolume_w)/* extra volume, goes to the 007232 w/ A11 */
+ AM_RANGE(0xa000, 0xa00d) AM_DEVWRITE(SOUND, "konami1", k007232_w) /* 007232 (chip 1) */
+ AM_RANGE(0xa01c, 0xa01c) AM_DEVWRITE(SOUND, "konami2", k007232_extvolume_w)/* extra volume, goes to the 007232 w/ A11 */
/* selecting a different latch for the external port */
- AM_RANGE(0xb000, 0xb00d) AM_WRITE(k007232_write_port_1_w) /* 007232 (chip 2) */
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym2151_register_port_0_w) /* YM2151 */
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ym2151_data_port_0_w) /* YM2151 */
+ AM_RANGE(0xb000, 0xb00d) AM_DEVWRITE(SOUND, "konami2", k007232_w) /* 007232 (chip 2) */
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ym", ym2151_w) /* YM2151 */
AM_RANGE(0xf000, 0xf000) AM_WRITE(SMH_NOP) /* ??? */
ADDRESS_MAP_END
@@ -307,9 +306,9 @@ INPUT_PORTS_END
-static void chqflag_ym2151_irq_w(running_machine *machine, int data)
+static void chqflag_ym2151_irq_w(const device_config *device, int data)
{
- cpu_set_input_line(machine->cpu[1],INPUT_LINE_NMI,PULSE_LINE);
+ cpu_set_input_line(device->machine->cpu[1],INPUT_LINE_NMI,PULSE_LINE);
}
@@ -318,20 +317,20 @@ static const ym2151_interface ym2151_config =
chqflag_ym2151_irq_w
};
-static void volume_callback0(int v)
+static void volume_callback0(const device_config *device, int v)
{
- k007232_set_volume(0,0,(v & 0x0f)*0x11,0);
- k007232_set_volume(0,1,0,(v >> 4)*0x11);
+ k007232_set_volume(device,0,(v & 0x0f)*0x11,0);
+ k007232_set_volume(device,1,0,(v >> 4)*0x11);
}
-static WRITE8_HANDLER( k007232_extvolume_w )
+static WRITE8_DEVICE_HANDLER( k007232_extvolume_w )
{
- k007232_set_volume(1,1,(data & 0x0f)*0x11/2,(data >> 4)*0x11/2);
+ k007232_set_volume(device,1,(data & 0x0f)*0x11/2,(data >> 4)*0x11/2);
}
-static void volume_callback1(int v)
+static void volume_callback1(const device_config *device, int v)
{
- k007232_set_volume(1,0,(v & 0x0f)*0x11/2,(v >> 4)*0x11/2);
+ k007232_set_volume(device,0,(v & 0x0f)*0x11/2,(v >> 4)*0x11/2);
}
static const k007232_interface k007232_interface_1 =
diff --git a/src/mame/drivers/cidelsa.c b/src/mame/drivers/cidelsa.c
index 29ade817dbe..3f615f4b235 100644
--- a/src/mame/drivers/cidelsa.c
+++ b/src/mame/drivers/cidelsa.c
@@ -75,9 +75,9 @@ static WRITE8_HANDLER( draco_sound_bankswitch_w )
memory_set_bank(space->machine, 1, bank);
}
-static WRITE8_HANDLER( draco_sound_g_w )
+static WRITE8_DEVICE_HANDLER( draco_sound_g_w )
{
- cidelsa_state *state = space->machine->driver_data;
+ cidelsa_state *state = device->machine->driver_data;
/*
@@ -93,15 +93,15 @@ static WRITE8_HANDLER( draco_sound_g_w )
switch (data)
{
case 0x01:
- ay8910_write_port_0_w(space, 0, state->draco_ay_latch);
+ ay8910_data_w(device, 0, state->draco_ay_latch);
break;
case 0x02:
- state->draco_ay_latch = ay8910_read_port_0_r(space, 0);
+ state->draco_ay_latch = ay8910_r(device, 0);
break;
case 0x03:
- ay8910_control_port_0_w(space, 0, state->draco_ay_latch);
+ ay8910_address_w(device, 0, state->draco_ay_latch);
break;
}
}
@@ -127,7 +127,7 @@ static WRITE8_HANDLER( draco_sound_ay8910_w )
state->draco_ay_latch = data;
}
-static WRITE8_HANDLER( draco_ay8910_port_a_w )
+static WRITE8_DEVICE_HANDLER( draco_ay8910_port_a_w )
{
/*
bit description
@@ -143,7 +143,7 @@ static WRITE8_HANDLER( draco_ay8910_port_a_w )
*/
}
-static WRITE8_HANDLER( draco_ay8910_port_b_w )
+static WRITE8_DEVICE_HANDLER( draco_ay8910_port_b_w )
{
/*
bit description
@@ -163,10 +163,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_SINGLE_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- draco_ay8910_port_a_w,
- draco_ay8910_port_b_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(draco_ay8910_port_a_w),
+ DEVCB_HANDLER(draco_ay8910_port_b_w)
};
/* Read/Write Handlers */
@@ -365,7 +365,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( draco_sound_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(COP400_PORT_D, COP400_PORT_D) AM_WRITE(draco_sound_bankswitch_w)
- AM_RANGE(COP400_PORT_G, COP400_PORT_G) AM_WRITE(draco_sound_g_w)
+ AM_RANGE(COP400_PORT_G, COP400_PORT_G) AM_DEVWRITE(SOUND, "ay", draco_sound_g_w)
AM_RANGE(COP400_PORT_L, COP400_PORT_L) AM_READWRITE(draco_sound_ay8910_r, draco_sound_ay8910_w)
AM_RANGE(COP400_PORT_IN, COP400_PORT_IN) AM_READ(draco_sound_in_r)
AM_RANGE(COP400_PORT_SIO, COP400_PORT_SIO) AM_NOP
diff --git a/src/mame/drivers/circusc.c b/src/mame/drivers/circusc.c
index 2f479bf51c6..090ef586dc5 100644
--- a/src/mame/drivers/circusc.c
+++ b/src/mame/drivers/circusc.c
@@ -114,6 +114,7 @@ static WRITE8_HANDLER( circusc_coin_counter_w )
static WRITE8_HANDLER(circusc_sound_w)
{
+ const device_config *device;
//int c;
switch (offset & 7)
@@ -125,24 +126,28 @@ static WRITE8_HANDLER(circusc_sound_w)
/* CS3 */
case 1:
- sn76496_0_w(space, 0, sn_latch);
+ device = devtag_get_device(space->machine, SOUND, "sn1");
+ sn76496_w(device, 0, sn_latch);
break;
/* CS4 */
case 2:
- sn76496_1_w(space, 0, sn_latch);
+ device = devtag_get_device(space->machine, SOUND, "sn2");
+ sn76496_w(device, 0, sn_latch);
break;
/* CS5 */
case 3:
- discrete_sound_w(space, NODE_03, data);
+ device = devtag_get_device(space->machine, SOUND, "discrete");
+ discrete_sound_w(device, NODE_03, data);
break;
/* CS6 */
case 4:
- discrete_sound_w(space, NODE_05, (offset & 0x20) >> 5);
- discrete_sound_w(space, NODE_06, (offset & 0x18) >> 3);
- discrete_sound_w(space, NODE_07, (offset & 0x40) >> 6);
+ device = devtag_get_device(space->machine, SOUND, "discrete");
+ discrete_sound_w(device, NODE_05, (offset & 0x20) >> 5);
+ discrete_sound_w(device, NODE_06, (offset & 0x18) >> 3);
+ discrete_sound_w(device, NODE_07, (offset & 0x40) >> 6);
break;
}
}
diff --git a/src/mame/drivers/cischeat.c b/src/mame/drivers/cischeat.c
index bef9a045e3f..0039d899d78 100644
--- a/src/mame/drivers/cischeat.c
+++ b/src/mame/drivers/cischeat.c
@@ -579,8 +579,8 @@ static WRITE16_HANDLER( scudhamm_oki_bank_w )
{
if (ACCESSING_BITS_0_7)
{
- okim6295_set_bank_base(0, 0x40000 * ((data >> 0) & 0x3) );
- okim6295_set_bank_base(1, 0x40000 * ((data >> 4) & 0x3) );
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki1"), 0x40000 * ((data >> 0) & 0x3) );
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki2"), 0x40000 * ((data >> 4) & 0x3) );
}
}
@@ -592,8 +592,8 @@ static ADDRESS_MAP_START( readmem_scudhamm, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x0b0000, 0x0b3fff) AM_READ(SMH_RAM ) // Scroll RAM 2
AM_RANGE(0x0b8000, 0x0bffff) AM_READ(SMH_RAM ) // Palette
AM_RANGE(0x100008, 0x100009) AM_READ_PORT("IN0") // Buttons
- AM_RANGE(0x100014, 0x100015) AM_READ(okim6295_status_0_lsb_r ) // Sound
- AM_RANGE(0x100018, 0x100019) AM_READ(okim6295_status_1_lsb_r ) //
+ AM_RANGE(0x100014, 0x100015) AM_DEVREAD8(SOUND, "oki1", okim6295_r, 0x00ff ) // Sound
+ AM_RANGE(0x100018, 0x100019) AM_DEVREAD8(SOUND, "oki2", okim6295_r, 0x00ff ) //
AM_RANGE(0x100040, 0x100041) AM_READ(scudhamm_analog_r ) // A / D
AM_RANGE(0x100044, 0x100045) AM_READ(scudhamm_motor_pos_r ) // Motor Position
AM_RANGE(0x100050, 0x100051) AM_READ(scudhamm_motor_status_r ) // Motor Limit Switches
@@ -609,8 +609,8 @@ static ADDRESS_MAP_START( writemem_scudhamm, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x0b8000, 0x0bffff) AM_WRITE(scudhamm_paletteram16_w) AM_BASE( &paletteram16 ) // Palette
AM_RANGE(0x100000, 0x100001) AM_WRITE(scudhamm_oki_bank_w ) // Sound
AM_RANGE(0x100008, 0x100009) AM_WRITE(scudhamm_leds_w ) // Leds
- AM_RANGE(0x100014, 0x100015) AM_WRITE(okim6295_data_0_lsb_w ) // Sound
- AM_RANGE(0x100018, 0x100019) AM_WRITE(okim6295_data_1_lsb_w ) //
+ AM_RANGE(0x100014, 0x100015) AM_DEVWRITE8(SOUND, "oki1", okim6295_w, 0x00ff ) // Sound
+ AM_RANGE(0x100018, 0x100019) AM_DEVWRITE8(SOUND, "oki2", okim6295_w, 0x00ff ) //
AM_RANGE(0x10001c, 0x10001d) AM_WRITE(scudhamm_enable_w ) // ?
AM_RANGE(0x100040, 0x100041) AM_WRITE(SMH_NOP ) // ? 0 written before reading
AM_RANGE(0x100050, 0x100051) AM_WRITE(scudhamm_motor_command_w ) // Move Motor
@@ -692,8 +692,8 @@ static ADDRESS_MAP_START( readmem_armchmp2, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x100008, 0x100009) AM_READ(armchmp2_buttons_r ) // Buttons + Sensors
AM_RANGE(0x10000c, 0x10000d) AM_READ(armchmp2_analog_r ) // A / D
AM_RANGE(0x100010, 0x100011) AM_READ(armchmp2_motor_status_r ) // Motor Limit Switches?
- AM_RANGE(0x100014, 0x100015) AM_READ(okim6295_status_0_lsb_r ) // Sound
- AM_RANGE(0x100018, 0x100019) AM_READ(okim6295_status_1_lsb_r ) //
+ AM_RANGE(0x100014, 0x100015) AM_DEVREAD8(SOUND, "oki1", okim6295_r, 0x00ff ) // Sound
+ AM_RANGE(0x100018, 0x100019) AM_DEVREAD8(SOUND, "oki2", okim6295_r, 0x00ff ) //
ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem_armchmp2, ADDRESS_SPACE_PROGRAM, 16 )
@@ -707,8 +707,8 @@ static ADDRESS_MAP_START( writemem_armchmp2, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x100008, 0x100009) AM_WRITE(armchmp2_leds_w ) // Leds + Coin Counters
AM_RANGE(0x10000c, 0x10000d) AM_WRITE(SMH_NOP ) // ?
AM_RANGE(0x100010, 0x100011) AM_WRITE(armchmp2_motor_command_w ) // Move Motor
- AM_RANGE(0x100014, 0x100015) AM_WRITE(okim6295_data_0_lsb_w ) // Sound
- AM_RANGE(0x100018, 0x100019) AM_WRITE(okim6295_data_1_lsb_w ) //
+ AM_RANGE(0x100014, 0x100015) AM_DEVWRITE8(SOUND, "oki1", okim6295_w, 0x00ff ) // Sound
+ AM_RANGE(0x100018, 0x100019) AM_DEVWRITE8(SOUND, "oki2", okim6295_w, 0x00ff ) //
ADDRESS_MAP_END
@@ -843,8 +843,8 @@ static WRITE16_HANDLER( bigrun_soundbank_w )
{
if (ACCESSING_BITS_0_7)
{
- okim6295_set_bank_base(0, 0x40000 * ((data >> 0) & 1) );
- okim6295_set_bank_base(1, 0x40000 * ((data >> 4) & 1) );
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki1"), 0x40000 * ((data >> 0) & 1) );
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki2"), 0x40000 * ((data >> 4) & 1) );
}
}
@@ -852,9 +852,9 @@ static ADDRESS_MAP_START( bigrun_sound_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x03ffff) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0x0f0000, 0x0fffff) AM_READ(SMH_RAM ) // RAM
AM_RANGE(0x040000, 0x040001) AM_READ(soundlatch_word_r ) // From Main CPU
- AM_RANGE(0x080002, 0x080003) AM_READ(ym2151_status_port_0_lsb_r )
- AM_RANGE(0x0a0000, 0x0a0001) AM_READ(okim6295_status_0_lsb_r )
- AM_RANGE(0x0c0000, 0x0c0001) AM_READ(okim6295_status_1_lsb_r )
+ AM_RANGE(0x080000, 0x080003) AM_DEVREAD8(SOUND, "ym", ym2151_r, 0x00ff )
+ AM_RANGE(0x0a0000, 0x0a0001) AM_DEVREAD8(SOUND, "oki1", okim6295_r, 0x00ff )
+ AM_RANGE(0x0c0000, 0x0c0001) AM_DEVREAD8(SOUND, "oki2", okim6295_r, 0x00ff )
ADDRESS_MAP_END
static ADDRESS_MAP_START( bigrun_sound_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -862,10 +862,9 @@ static ADDRESS_MAP_START( bigrun_sound_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x0f0000, 0x0fffff) AM_WRITE(SMH_RAM ) // RAM
AM_RANGE(0x040000, 0x040001) AM_WRITE(bigrun_soundbank_w ) // Sample Banking
AM_RANGE(0x060000, 0x060001) AM_WRITE(soundlatch2_word_w ) // To Main CPU
- AM_RANGE(0x080000, 0x080001) AM_WRITE(ym2151_register_port_0_lsb_w )
- AM_RANGE(0x080002, 0x080003) AM_WRITE(ym2151_data_port_0_lsb_w )
- AM_RANGE(0x0a0000, 0x0a0003) AM_WRITE(okim6295_data_0_lsb_w )
- AM_RANGE(0x0c0000, 0x0c0003) AM_WRITE(okim6295_data_1_lsb_w )
+ AM_RANGE(0x080000, 0x080003) AM_DEVWRITE8(SOUND, "ym", ym2151_w, 0x00ff )
+ AM_RANGE(0x0a0000, 0x0a0003) AM_DEVWRITE8(SOUND, "oki1", okim6295_w, 0x00ff )
+ AM_RANGE(0x0c0000, 0x0c0003) AM_DEVWRITE8(SOUND, "oki2", okim6295_w, 0x00ff )
ADDRESS_MAP_END
@@ -873,34 +872,29 @@ ADDRESS_MAP_END
Cisco Heat
**************************************************************************/
-static WRITE16_HANDLER( cischeat_soundbank_0_w )
+static WRITE16_DEVICE_HANDLER( cischeat_soundbank_w )
{
- if (ACCESSING_BITS_0_7) okim6295_set_bank_base(0, 0x40000 * (data & 1) );
-}
-static WRITE16_HANDLER( cischeat_soundbank_1_w )
-{
- if (ACCESSING_BITS_0_7) okim6295_set_bank_base(1, 0x40000 * (data & 1) );
+ if (ACCESSING_BITS_0_7) okim6295_set_bank_base(device, 0x40000 * (data & 1) );
}
static ADDRESS_MAP_START( cischeat_sound_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x03ffff) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0x0f0000, 0x0fffff) AM_READ(SMH_RAM ) // RAM
AM_RANGE(0x060004, 0x060005) AM_READ(soundlatch_word_r ) // From Main CPU
- AM_RANGE(0x080002, 0x080003) AM_READ(ym2151_status_port_0_lsb_r )
- AM_RANGE(0x0a0000, 0x0a0001) AM_READ(okim6295_status_0_lsb_r )
- AM_RANGE(0x0c0000, 0x0c0001) AM_READ(okim6295_status_1_lsb_r )
+ AM_RANGE(0x080000, 0x080003) AM_DEVREAD8(SOUND, "ym", ym2151_r, 0x00ff )
+ AM_RANGE(0x0a0000, 0x0a0001) AM_DEVREAD8(SOUND, "oki1", okim6295_r, 0x00ff )
+ AM_RANGE(0x0c0000, 0x0c0001) AM_DEVREAD8(SOUND, "oki2", okim6295_r, 0x00ff )
ADDRESS_MAP_END
static ADDRESS_MAP_START( cischeat_sound_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x03ffff) AM_WRITE(SMH_ROM ) // ROM
AM_RANGE(0x0f0000, 0x0fffff) AM_WRITE(SMH_RAM ) // RAM
- AM_RANGE(0x040002, 0x040003) AM_WRITE(cischeat_soundbank_0_w ) // Sample Banking
- AM_RANGE(0x040004, 0x040005) AM_WRITE(cischeat_soundbank_1_w ) // Sample Banking
+ AM_RANGE(0x040002, 0x040003) AM_DEVWRITE(SOUND, "oki1", cischeat_soundbank_w ) // Sample Banking
+ AM_RANGE(0x040004, 0x040005) AM_DEVWRITE(SOUND, "oki2", cischeat_soundbank_w ) // Sample Banking
AM_RANGE(0x060002, 0x060003) AM_WRITE(soundlatch2_word_w ) // To Main CPU
- AM_RANGE(0x080000, 0x080001) AM_WRITE(ym2151_register_port_0_lsb_w )
- AM_RANGE(0x080002, 0x080003) AM_WRITE(ym2151_data_port_0_lsb_w )
- AM_RANGE(0x0a0000, 0x0a0003) AM_WRITE(okim6295_data_0_lsb_w )
- AM_RANGE(0x0c0000, 0x0c0003) AM_WRITE(okim6295_data_1_lsb_w )
+ AM_RANGE(0x080000, 0x080003) AM_DEVWRITE8(SOUND, "ym", ym2151_w, 0x00ff )
+ AM_RANGE(0x0a0000, 0x0a0003) AM_DEVWRITE8(SOUND, "oki1", okim6295_w, 0x00ff )
+ AM_RANGE(0x0c0000, 0x0c0003) AM_DEVWRITE8(SOUND, "oki2", okim6295_w, 0x00ff )
ADDRESS_MAP_END
@@ -912,21 +906,20 @@ static ADDRESS_MAP_START( f1gpstar_sound_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x03ffff) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0x0e0000, 0x0fffff) AM_READ(SMH_RAM ) // RAM (cischeat: f0000-fffff)
AM_RANGE(0x060000, 0x060001) AM_READ(soundlatch_word_r ) // From Main CPU (cischeat: 60004)
- AM_RANGE(0x080002, 0x080003) AM_READ(ym2151_status_port_0_lsb_r )
- AM_RANGE(0x0a0000, 0x0a0001) AM_READ(okim6295_status_0_lsb_r )
- AM_RANGE(0x0c0000, 0x0c0001) AM_READ(okim6295_status_1_lsb_r )
+ AM_RANGE(0x080000, 0x080003) AM_DEVREAD8(SOUND, "ym", ym2151_r, 0x00ff )
+ AM_RANGE(0x0a0000, 0x0a0001) AM_DEVREAD8(SOUND, "oki1", okim6295_r, 0x00ff )
+ AM_RANGE(0x0c0000, 0x0c0001) AM_DEVREAD8(SOUND, "oki2", okim6295_r, 0x00ff )
ADDRESS_MAP_END
static ADDRESS_MAP_START( f1gpstar_sound_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x03ffff) AM_WRITE(SMH_ROM ) // ROM
AM_RANGE(0x0e0000, 0x0fffff) AM_WRITE(SMH_RAM ) // RAM (cischeat: f0000-fffff)
- AM_RANGE(0x040004, 0x040005) AM_WRITE(cischeat_soundbank_0_w ) // Sample Banking (cischeat: 40002)
- AM_RANGE(0x040008, 0x040009) AM_WRITE(cischeat_soundbank_1_w ) // Sample Banking (cischeat: 40004)
+ AM_RANGE(0x040004, 0x040005) AM_DEVWRITE(SOUND, "oki1", cischeat_soundbank_w ) // Sample Banking (cischeat: 40002)
+ AM_RANGE(0x040008, 0x040009) AM_DEVWRITE(SOUND, "oki2", cischeat_soundbank_w ) // Sample Banking (cischeat: 40004)
AM_RANGE(0x060000, 0x060001) AM_WRITE(soundlatch2_word_w ) // To Main CPU (cischeat: 60002)
- AM_RANGE(0x080000, 0x080001) AM_WRITE(ym2151_register_port_0_lsb_w )
- AM_RANGE(0x080002, 0x080003) AM_WRITE(ym2151_data_port_0_lsb_w )
- AM_RANGE(0x0a0000, 0x0a0003) AM_WRITE(okim6295_data_0_lsb_w )
- AM_RANGE(0x0c0000, 0x0c0003) AM_WRITE(okim6295_data_1_lsb_w )
+ AM_RANGE(0x080000, 0x080003) AM_DEVWRITE8(SOUND, "ym", ym2151_w, 0x00ff )
+ AM_RANGE(0x0a0000, 0x0a0003) AM_DEVWRITE8(SOUND, "oki1", okim6295_w, 0x00ff )
+ AM_RANGE(0x0c0000, 0x0c0003) AM_DEVWRITE8(SOUND, "oki2", okim6295_w, 0x00ff )
ADDRESS_MAP_END
@@ -938,22 +931,21 @@ static ADDRESS_MAP_START( f1gpstr2_sound_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x03ffff) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0x0e0000, 0x0fffff) AM_READ(SMH_RAM ) // RAM
AM_RANGE(0x060004, 0x060005) AM_READ(soundlatch_word_r ) // From Main CPU (f1gpstar: 60000)
- AM_RANGE(0x080002, 0x080003) AM_READ(ym2151_status_port_0_lsb_r )
- AM_RANGE(0x0a0000, 0x0a0001) AM_READ(okim6295_status_0_lsb_r )
- AM_RANGE(0x0c0000, 0x0c0001) AM_READ(okim6295_status_1_lsb_r )
+ AM_RANGE(0x080002, 0x080003) AM_DEVREAD8(SOUND, "ym", ym2151_r, 0x00ff )
+ AM_RANGE(0x0a0000, 0x0a0001) AM_DEVREAD8(SOUND, "oki1", okim6295_r, 0x00ff )
+ AM_RANGE(0x0c0000, 0x0c0001) AM_DEVREAD8(SOUND, "oki2", okim6295_r, 0x00ff )
ADDRESS_MAP_END
static ADDRESS_MAP_START( f1gpstr2_sound_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x03ffff) AM_WRITE(SMH_ROM ) // ROM
AM_RANGE(0x0e0000, 0x0fffff) AM_WRITE(SMH_RAM ) // RAM
- AM_RANGE(0x040004, 0x040005) AM_WRITE(cischeat_soundbank_0_w ) // Sample Banking
- AM_RANGE(0x040008, 0x040009) AM_WRITE(cischeat_soundbank_1_w ) // Sample Banking
+ AM_RANGE(0x040004, 0x040005) AM_DEVWRITE(SOUND, "oki1", cischeat_soundbank_w) // Sample Banking
+ AM_RANGE(0x040008, 0x040009) AM_DEVWRITE(SOUND, "oki2", cischeat_soundbank_w) // Sample Banking
AM_RANGE(0x04000e, 0x04000f) AM_WRITE(SMH_NOP ) // ? 0 (f1gpstar: no)
AM_RANGE(0x060002, 0x060003) AM_WRITE(soundlatch2_word_w ) // To Main CPU (f1gpstar: 60000)
- AM_RANGE(0x080000, 0x080001) AM_WRITE(ym2151_register_port_0_lsb_w )
- AM_RANGE(0x080002, 0x080003) AM_WRITE(ym2151_data_port_0_lsb_w )
- AM_RANGE(0x0a0000, 0x0a0003) AM_WRITE(okim6295_data_0_lsb_w )
- AM_RANGE(0x0c0000, 0x0c0003) AM_WRITE(okim6295_data_1_lsb_w )
+ AM_RANGE(0x080000, 0x080003) AM_DEVWRITE8(SOUND, "ym", ym2151_w, 0x00ff )
+ AM_RANGE(0x0a0000, 0x0a0003) AM_DEVWRITE8(SOUND, "oki1", okim6295_w, 0x00ff )
+ AM_RANGE(0x0c0000, 0x0c0003) AM_DEVWRITE8(SOUND, "oki2", okim6295_w, 0x00ff )
ADDRESS_MAP_END
/**************************************************************************
diff --git a/src/mame/drivers/citycon.c b/src/mame/drivers/citycon.c
index e56315d84f2..06f82bc52fd 100644
--- a/src/mame/drivers/citycon.c
+++ b/src/mame/drivers/citycon.c
@@ -54,17 +54,15 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_READ(SMH_RAM)
-// AM_RANGE(0x4002, 0x4002) AM_READ(ay8910_read_port_0_r) /* ?? */
- AM_RANGE(0x6001, 0x6001) AM_READ(ym2203_read_port_0_r)
+// AM_RANGE(0x4002, 0x4002) AM_DEVREAD(SOUND, "ay", ay8910_r) /* ?? */
+ AM_RANGE(0x6000, 0x6001) AM_DEVREAD(SOUND, "ym", ym2203_r)
AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM)
ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x4000, 0x4000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x4001, 0x4001) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x6000, 0x6000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x6001, 0x6001) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0x4000, 0x4001) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0x6000, 0x6001) AM_DEVWRITE(SOUND, "ym", ym2203_w)
AM_RANGE(0x8000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
@@ -195,10 +193,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r,
- soundlatch2_r,
- NULL,
- NULL
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r),
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch2_r),
+ DEVCB_NULL,
+ DEVCB_NULL
},
NULL
};
diff --git a/src/mame/drivers/cliffhgr.c b/src/mame/drivers/cliffhgr.c
index b55cc4183c8..8d0946b748c 100644
--- a/src/mame/drivers/cliffhgr.c
+++ b/src/mame/drivers/cliffhgr.c
@@ -142,7 +142,7 @@ static READ8_HANDLER( cliff_irq_ack_r )
return 0x00;
}
-static WRITE8_HANDLER( cliff_sound_overlay_w )
+static WRITE8_DEVICE_HANDLER( cliff_sound_overlay_w )
{
int sound = data & 3;
int overlay = ( data & 0x10 ) ? 1 : 0;
@@ -150,18 +150,18 @@ static WRITE8_HANDLER( cliff_sound_overlay_w )
/* configure pen 0 and 1 as transparent in the renderer and use it as the compositing color */
if (overlay)
{
- palette_set_color(space->machine, 0, palette_get_color(space->machine, 0) & MAKE_ARGB(0,255,255,255));
- palette_set_color(space->machine, 1, palette_get_color(space->machine, 1) & MAKE_ARGB(0,255,255,255));
+ palette_set_color(device->machine, 0, palette_get_color(device->machine, 0) & MAKE_ARGB(0,255,255,255));
+ palette_set_color(device->machine, 1, palette_get_color(device->machine, 1) & MAKE_ARGB(0,255,255,255));
}
else
{
- palette_set_color(space->machine, 0, palette_get_color(space->machine, 0) | MAKE_ARGB(255,0,0,0));
- palette_set_color(space->machine, 1, palette_get_color(space->machine, 1) | MAKE_ARGB(255,0,0,0));
+ palette_set_color(device->machine, 0, palette_get_color(device->machine, 0) | MAKE_ARGB(255,0,0,0));
+ palette_set_color(device->machine, 1, palette_get_color(device->machine, 1) | MAKE_ARGB(255,0,0,0));
}
/* audio */
- discrete_sound_w(space, CLIFF_ENABLE_SND_1, sound&1);
- discrete_sound_w(space, CLIFF_ENABLE_SND_2, (sound>>1)&1);
+ discrete_sound_w(device, CLIFF_ENABLE_SND_1, sound&1);
+ discrete_sound_w(device, CLIFF_ENABLE_SND_2, (sound>>1)&1);
}
static WRITE8_HANDLER( cliff_ldwire_w )
@@ -234,7 +234,7 @@ static ADDRESS_MAP_START( mainport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x44, 0x44) AM_WRITE(TMS9928A_vram_w)
AM_RANGE(0x45, 0x45) AM_READ(TMS9928A_vram_r)
- AM_RANGE(0x46, 0x46) AM_WRITE(cliff_sound_overlay_w)
+ AM_RANGE(0x46, 0x46) AM_DEVWRITE(SOUND, "discrete", cliff_sound_overlay_w)
AM_RANGE(0x50, 0x52) AM_READ(cliff_phillips_code_r)
AM_RANGE(0x53, 0x53) AM_READ(cliff_irq_ack_r)
AM_RANGE(0x54, 0x54) AM_WRITE(TMS9928A_register_w)
@@ -706,8 +706,7 @@ static MACHINE_DRIVER_START( cliffhgr )
/* sound hardware */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("ldsound", CUSTOM, 0)
- MDRV_SOUND_CONFIG(laserdisc_custom_interface)
+ MDRV_SOUND_ADD("ldsound", LASERDISC, 0)
MDRV_SOUND_ROUTE(0, "left", 1.0)
MDRV_SOUND_ROUTE(1, "right", 1.0)
diff --git a/src/mame/drivers/cloak.c b/src/mame/drivers/cloak.c
index 92729dcdd17..15f3cd4a47c 100644
--- a/src/mame/drivers/cloak.c
+++ b/src/mame/drivers/cloak.c
@@ -169,8 +169,8 @@ static ADDRESS_MAP_START( master_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x03ff) AM_RAM
AM_RANGE(0x0400, 0x07ff) AM_RAM_WRITE(cloak_videoram_w) AM_BASE(&videoram)
AM_RANGE(0x0800, 0x0fff) AM_RAM AM_SHARE(1)
- AM_RANGE(0x1000, 0x100f) AM_READWRITE(pokey1_r, pokey1_w) /* DSW0 also */
- AM_RANGE(0x1800, 0x180f) AM_READWRITE(pokey2_r, pokey2_w) /* DSW1 also */
+ AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE(SOUND, "pokey1", pokey_r, pokey_w) /* DSW0 also */
+ AM_RANGE(0x1800, 0x180f) AM_DEVREADWRITE(SOUND, "pokey2", pokey_r, pokey_w) /* DSW1 also */
AM_RANGE(0x2000, 0x2000) AM_READ_PORT("P1")
AM_RANGE(0x2200, 0x2200) AM_READ_PORT("P2")
AM_RANGE(0x2400, 0x2400) AM_READ_PORT("SYSTEM")
@@ -312,14 +312,14 @@ GFXDECODE_END
static const pokey_interface pokey_interface_1 =
{
- { 0 },
- input_port_3_r
+ { DEVCB_NULL },
+ DEVCB_INPUT_PORT("START"),
};
static const pokey_interface pokey_interface_2 =
{
- { 0 },
- input_port_4_r
+ { DEVCB_NULL },
+ DEVCB_INPUT_PORT("DSW"),
};
diff --git a/src/mame/drivers/cloud9.c b/src/mame/drivers/cloud9.c
index 5817f8d7128..d23c09d4c0c 100644
--- a/src/mame/drivers/cloud9.c
+++ b/src/mame/drivers/cloud9.c
@@ -316,8 +316,8 @@ static ADDRESS_MAP_START( cloud9_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x5800, 0x5800) AM_MIRROR(0x007e) AM_READ_PORT("IN0")
AM_RANGE(0x5801, 0x5801) AM_MIRROR(0x007e) AM_READ_PORT("IN1")
AM_RANGE(0x5900, 0x5903) AM_MIRROR(0x007c) AM_READ(leta_r)
- AM_RANGE(0x5a00, 0x5a0f) AM_MIRROR(0x00f0) AM_READWRITE(pokey1_r, pokey1_w)
- AM_RANGE(0x5b00, 0x5b0f) AM_MIRROR(0x00f0) AM_READWRITE(pokey2_r, pokey2_w)
+ AM_RANGE(0x5a00, 0x5a0f) AM_MIRROR(0x00f0) AM_DEVREADWRITE(SOUND, "pokey1", pokey_r, pokey_w)
+ AM_RANGE(0x5b00, 0x5b0f) AM_MIRROR(0x00f0) AM_DEVREADWRITE(SOUND, "pokey2", pokey_r, pokey_w)
AM_RANGE(0x5c00, 0x5cff) AM_MIRROR(0x0300) AM_READWRITE(nvram_r, SMH_RAM) AM_BASE(&nvram_stage) AM_SIZE(&generic_nvram_size)
AM_RANGE(0x6000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -443,8 +443,8 @@ GFXDECODE_END
static const pokey_interface pokey_config =
{
- { 0 },
- input_port_2_r
+ { DEVCB_NULL },
+ DEVCB_INPUT_PORT("DSW"),
};
diff --git a/src/mame/drivers/clshroad.c b/src/mame/drivers/clshroad.c
index 7c4d2b92d86..df80d544949 100644
--- a/src/mame/drivers/clshroad.c
+++ b/src/mame/drivers/clshroad.c
@@ -19,7 +19,6 @@ XTAL : 18.432 MHz
#include "driver.h"
#include "cpu/z80/z80.h"
-#include "sound/custom.h"
/* Variables & functions defined in video: */
@@ -37,7 +36,10 @@ VIDEO_START( clshroad );
VIDEO_UPDATE( clshroad );
extern UINT8 *wiping_soundregs;
-CUSTOM_START( wiping_sh_start );
+
+DEVICE_GET_INFO( wiping_sound );
+#define SOUND_WIPING DEVICE_GET_INFO_NAME(wiping_sound)
+
WRITE8_HANDLER( wiping_sound_w );
@@ -246,13 +248,6 @@ GFXDECODE_END
-static const custom_sound_interface custom_interface =
-{
- wiping_sh_start
-};
-
-
-
static MACHINE_DRIVER_START( firebatl )
/* basic machine hardware */
@@ -284,8 +279,7 @@ static MACHINE_DRIVER_START( firebatl )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("custom", CUSTOM, 0)
- MDRV_SOUND_CONFIG(custom_interface)
+ MDRV_SOUND_ADD("custom", WIPING, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
@@ -320,8 +314,7 @@ static MACHINE_DRIVER_START( clshroad )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("custom", CUSTOM, 0)
- MDRV_SOUND_CONFIG(custom_interface)
+ MDRV_SOUND_ADD("custom", WIPING, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/cninja.c b/src/mame/drivers/cninja.c
index 664ee2004f7..ce196827571 100644
--- a/src/mame/drivers/cninja.c
+++ b/src/mame/drivers/cninja.c
@@ -329,20 +329,20 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_READ(SMH_ROM)
- AM_RANGE(0x100000, 0x100001) AM_READ(ym2203_status_port_0_r)
- AM_RANGE(0x110000, 0x110001) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0x120000, 0x120001) AM_READ(okim6295_status_0_r)
- AM_RANGE(0x130000, 0x130001) AM_READ(okim6295_status_1_r)
+ AM_RANGE(0x100000, 0x100001) AM_DEVREAD(SOUND, "ym1", ym2203_r)
+ AM_RANGE(0x110000, 0x110001) AM_DEVREAD(SOUND, "ym2", ym2151_r)
+ AM_RANGE(0x120000, 0x120001) AM_DEVREAD(SOUND, "oki1", okim6295_r)
+ AM_RANGE(0x130000, 0x130001) AM_DEVREAD(SOUND, "oki2", okim6295_r)
AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
AM_RANGE(0x1f0000, 0x1f1fff) AM_READ(SMH_BANK8)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_WRITE(SMH_ROM)
- AM_RANGE(0x100000, 0x100001) AM_WRITE(ym2203_word_0_w)
- AM_RANGE(0x110000, 0x110001) AM_WRITE(ym2151_word_0_w)
- AM_RANGE(0x120000, 0x120001) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0x130000, 0x130001) AM_WRITE(okim6295_data_1_w)
+ AM_RANGE(0x100000, 0x100001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x110000, 0x110001) AM_DEVWRITE(SOUND, "ym2", ym2151_w)
+ AM_RANGE(0x120000, 0x120001) AM_DEVWRITE(SOUND, "oki1", okim6295_w)
+ AM_RANGE(0x130000, 0x130001) AM_DEVWRITE(SOUND, "oki2", okim6295_w)
AM_RANGE(0x1f0000, 0x1f1fff) AM_WRITE(SMH_BANK8)
AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w)
AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w)
@@ -351,9 +351,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readmem_mutantf, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_READ(SMH_ROM)
AM_RANGE(0x100000, 0x100001) AM_READ(SMH_NOP)
- AM_RANGE(0x110000, 0x110001) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0x120000, 0x120001) AM_READ(okim6295_status_0_r)
- AM_RANGE(0x130000, 0x130001) AM_READ(okim6295_status_1_r)
+ AM_RANGE(0x110000, 0x110001) AM_DEVREAD(SOUND, "ym", ym2151_r)
+ AM_RANGE(0x120000, 0x120001) AM_DEVREAD(SOUND, "oki1", okim6295_r)
+ AM_RANGE(0x130000, 0x130001) AM_DEVREAD(SOUND, "oki2", okim6295_r)
AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
AM_RANGE(0x1f0000, 0x1f1fff) AM_READ(SMH_BANK8)
ADDRESS_MAP_END
@@ -361,9 +361,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem_mutantf, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_WRITE(SMH_ROM)
AM_RANGE(0x100000, 0x100001) AM_WRITE(SMH_NOP)
- AM_RANGE(0x110000, 0x110001) AM_WRITE(ym2151_word_0_w)
- AM_RANGE(0x120000, 0x120001) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0x130000, 0x130001) AM_WRITE(okim6295_data_1_w)
+ AM_RANGE(0x110000, 0x110001) AM_DEVWRITE(SOUND, "ym", ym2151_w)
+ AM_RANGE(0x120000, 0x120001) AM_DEVWRITE(SOUND, "oki1", okim6295_w)
+ AM_RANGE(0x130000, 0x130001) AM_DEVWRITE(SOUND, "oki2", okim6295_w)
AM_RANGE(0x1f0000, 0x1f1fff) AM_WRITE(SMH_BANK8)
AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w)
AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w)
@@ -372,17 +372,16 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( stoneage_s_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM)
- AM_RANGE(0x8801, 0x8801) AM_READ(ym2151_status_port_0_r)
+ AM_RANGE(0x8800, 0x8801) AM_DEVREAD(SOUND, "ym", ym2151_r)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
- AM_RANGE(0x9800, 0x9800) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x9800, 0x9800) AM_DEVREAD(SOUND, "oki1", okim6295_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( stoneage_s_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x8800, 0x8800) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x8801, 0x8801) AM_WRITE(ym2151_data_port_0_w)
- AM_RANGE(0x9800, 0x9800) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0x8800, 0x8801) AM_DEVWRITE(SOUND, "ym", ym2151_w)
+ AM_RANGE(0x9800, 0x9800) AM_DEVWRITE(SOUND, "oki1", okim6295_w)
ADDRESS_MAP_END
/***********************************************************
@@ -749,20 +748,20 @@ static MACHINE_RESET( cninja )
cninja_irq_mask=0;
}
-static void sound_irq(running_machine *machine, int state)
+static void sound_irq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1],1,state); /* IRQ 2 */
+ cpu_set_input_line(device->machine->cpu[1],1,state); /* IRQ 2 */
}
-static void sound_irq2(running_machine *machine, int state)
+static void sound_irq2(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1],0,state);
+ cpu_set_input_line(device->machine->cpu[1],0,state);
}
-static WRITE8_HANDLER( sound_bankswitch_w )
+static WRITE8_DEVICE_HANDLER( sound_bankswitch_w )
{
/* the second OKIM6295 ROM is bank switched */
- okim6295_set_bank_base(1, (data & 1) * 0x40000);
+ okim6295_set_bank_base(devtag_get_device(device->machine, SOUND, "oki2"), (data & 1) * 0x40000);
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/cntsteer.c b/src/mame/drivers/cntsteer.c
index 2d9dc120752..22b935513d7 100644
--- a/src/mame/drivers/cntsteer.c
+++ b/src/mame/drivers/cntsteer.c
@@ -476,10 +476,10 @@ static INTERRUPT_GEN ( sound_interrupt ) { if (!nmimask) cpu_set_input_line(devi
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x01ff) AM_RAM
// AM_RANGE(0x1000, 0x1000) AM_WRITE(nmiack_w)
- AM_RANGE(0x2000, 0x2000) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x4000, 0x4000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x6000, 0x6000) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x8000, 0x8000) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0x2000, 0x2000) AM_DEVWRITE(SOUND, "ay1", ay8910_data_w)
+ AM_RANGE(0x4000, 0x4000) AM_DEVWRITE(SOUND, "ay1", ay8910_address_w)
+ AM_RANGE(0x6000, 0x6000) AM_DEVWRITE(SOUND, "ay2", ay8910_data_w)
+ AM_RANGE(0x8000, 0x8000) AM_DEVWRITE(SOUND, "ay2", ay8910_address_w)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
AM_RANGE(0xd000, 0xd000) AM_WRITE(nmimask_w)
AM_RANGE(0xe000, 0xffff) AM_ROM
diff --git a/src/mame/drivers/coinmstr.c b/src/mame/drivers/coinmstr.c
index 5760eb68118..428036e851a 100644
--- a/src/mame/drivers/coinmstr.c
+++ b/src/mame/drivers/coinmstr.c
@@ -197,8 +197,8 @@ static ADDRESS_MAP_START( quizmstr_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_READ(question_r)
AM_RANGE(0x00, 0x03) AM_WRITE(question_w)
- AM_RANGE(0x40, 0x40) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x41, 0x41) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
+ AM_RANGE(0x40, 0x41) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0x41, 0x41) AM_DEVREAD(SOUND, "ay", ay8910_r)
AM_RANGE(0x48, 0x4b) AM_READWRITE(pia_0_r, pia_0_w)
AM_RANGE(0x50, 0x53) AM_READNOP
AM_RANGE(0x50, 0x53) AM_WRITENOP
@@ -215,8 +215,8 @@ static ADDRESS_MAP_START( trailblz_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0x03) AM_WRITE(question_w)
AM_RANGE(0x40, 0x40) AM_DEVWRITE(H46505, "crtc", mc6845_address_w)
AM_RANGE(0x41, 0x41) AM_DEVWRITE(H46505, "crtc", mc6845_register_w)
- AM_RANGE(0x48, 0x48) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x49, 0x49) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
+ AM_RANGE(0x48, 0x49) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0x49, 0x49) AM_DEVREAD(SOUND, "ay", ay8910_r)
AM_RANGE(0x50, 0x53) AM_READWRITE(pia_0_r, pia_0_w) //?
AM_RANGE(0x60, 0x63) AM_READWRITE(pia_1_r, pia_1_w)
AM_RANGE(0x70, 0x73) AM_READWRITE(pia_2_r, pia_2_w)
@@ -239,8 +239,8 @@ static ADDRESS_MAP_START( supnudg2_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x68, 0x69) AM_READNOP
AM_RANGE(0x68, 0x6b) AM_WRITENOP
AM_RANGE(0x6b, 0x6b) AM_READNOP
- AM_RANGE(0x78, 0x78) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x79, 0x79) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
+ AM_RANGE(0x78, 0x79) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0x79, 0x79) AM_DEVREAD(SOUND, "ay", ay8910_r)
AM_RANGE(0xc0, 0xc1) AM_READNOP
AM_RANGE(0xc0, 0xc3) AM_WRITENOP
ADDRESS_MAP_END
@@ -249,8 +249,8 @@ static ADDRESS_MAP_START( pokeroul_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x40, 0x40) AM_DEVWRITE(H46505, "crtc", mc6845_address_w)
AM_RANGE(0x41, 0x41) AM_DEVWRITE(H46505, "crtc", mc6845_register_w)
- AM_RANGE(0x48, 0x48) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x49, 0x49) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
+ AM_RANGE(0x48, 0x49) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0x49, 0x49) AM_DEVREAD(SOUND, "ay", ay8910_r)
AM_RANGE(0x58, 0x5b) AM_READWRITE(pia_0_r, pia_0_w) /* confirmed */
AM_RANGE(0x68, 0x6b) AM_READWRITE(pia_1_r, pia_1_w) /* confirmed */
AM_RANGE(0x78, 0x7b) AM_READWRITE(pia_2_r, pia_2_w) /* confirmed */
@@ -809,10 +809,10 @@ static const ay8910_interface ay8912_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_4_r,
- NULL,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const mc6845_interface h46505_intf =
diff --git a/src/mame/drivers/combatsc.c b/src/mame/drivers/combatsc.c
index afa26c354c6..6fe17fe29b3 100644
--- a/src/mame/drivers/combatsc.c
+++ b/src/mame/drivers/combatsc.c
@@ -222,34 +222,39 @@ static WRITE8_HANDLER( combasc_sh_irqtrigger_w )
cpu_set_input_line_and_vector(space->machine->cpu[1],0,HOLD_LINE,0xff);
}
-static WRITE8_HANDLER( combasc_play_w )
+static READ8_DEVICE_HANDLER( combasc_busy_r )
{
- upd7759_start_w(0, data & 2);
+ return upd7759_busy_r(device) ? 1 : 0;
}
-static WRITE8_HANDLER( combasc_voice_reset_w )
+static WRITE8_DEVICE_HANDLER( combasc_play_w )
{
- upd7759_reset_w(0,data & 1);
+ upd7759_start_w(device, data & 2);
}
-static WRITE8_HANDLER( combasc_portA_w )
+static WRITE8_DEVICE_HANDLER( combasc_voice_reset_w )
+{
+ upd7759_reset_w(device,data & 1);
+}
+
+static WRITE8_DEVICE_HANDLER( combasc_portA_w )
{
/* unknown. always write 0 */
}
static emu_timer *combasc_interleave_timer;
-static READ8_HANDLER ( combasc_YM2203_status_port_0_r )
+static READ8_DEVICE_HANDLER ( combasc_ym2203_r )
{
static int boost = 1;
- int status = ym2203_status_port_0_r(space,0);
+ int status = ym2203_r(device,offset);
- if (cpu_get_pc(space->cpu) == 0x334)
+ if (cpu_get_pc(device->machine->cpu[1]) == 0x334)
{
if (boost)
{
boost = 0;
- timer_adjust_periodic(combasc_interleave_timer, attotime_zero, 0, cpu_clocks_to_attotime(space->cpu,80));
+ timer_adjust_periodic(combasc_interleave_timer, attotime_zero, 0, cpu_clocks_to_attotime(device->machine->cpu[1],80));
}
else if (status & 2)
{
@@ -321,8 +326,8 @@ static ADDRESS_MAP_START( readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) /* ROM */
AM_RANGE(0x8000, 0x87ef) AM_READ(SMH_RAM) /* RAM */
AM_RANGE(0x87f0, 0x87ff) AM_READ(SMH_RAM) /* ??? */
- AM_RANGE(0x9000, 0x9000) AM_READ(ym2203_status_port_0_r) /* YM 2203 */
- AM_RANGE(0x9008, 0x9008) AM_READ(ym2203_status_port_0_r) /* ??? */
+ AM_RANGE(0x9000, 0x9001) AM_DEVREAD(SOUND, "ym", ym2203_r) /* YM 2203 */
+ AM_RANGE(0x9008, 0x9009) AM_DEVREAD(SOUND, "ym", ym2203_r) /* ??? */
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r) /* soundlatch_r? */
AM_RANGE(0x8800, 0xfffb) AM_READ(SMH_ROM) /* ROM? */
AM_RANGE(0xfffc, 0xffff) AM_READ(SMH_RAM) /* ??? */
@@ -332,8 +337,7 @@ static ADDRESS_MAP_START( writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM) /* ROM */
AM_RANGE(0x8000, 0x87ef) AM_WRITE(SMH_RAM) /* RAM */
AM_RANGE(0x87f0, 0x87ff) AM_WRITE(SMH_RAM) /* ??? */
- AM_RANGE(0x9000, 0x9000) AM_WRITE(ym2203_control_port_0_w)/* YM 2203 */
- AM_RANGE(0x9001, 0x9001) AM_WRITE(ym2203_write_port_0_w) /* YM 2203 */
+ AM_RANGE(0x9000, 0x9001) AM_DEVWRITE(SOUND, "ym", ym2203_w) /* YM 2203 */
//AM_RANGE(0x9800, 0x9800) AM_WRITE(combasc_unknown_w_1) /* OKIM5205? */
//AM_RANGE(0xa800, 0xa800) AM_WRITE(combasc_unknown_w_2) /* OKIM5205? */
AM_RANGE(0x8800, 0xfffb) AM_WRITE(SMH_ROM) /* ROM */
@@ -344,19 +348,18 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( combasc_readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) /* ROM */
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM) /* RAM */
- AM_RANGE(0xb000, 0xb000) AM_READ(upd7759_0_busy_r) /* upd7759 busy? */
+ AM_RANGE(0xb000, 0xb000) AM_DEVREAD(SOUND, "upd", combasc_busy_r) /* upd7759 busy? */
AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_r) /* soundlatch_r? */
- AM_RANGE(0xe000, 0xe000) AM_READ(combasc_YM2203_status_port_0_r) /* YM 2203 intercepted */
+ AM_RANGE(0xe000, 0xe001) AM_DEVREAD(SOUND, "ym", combasc_ym2203_r) /* YM 2203 intercepted */
ADDRESS_MAP_END
static ADDRESS_MAP_START( combasc_writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM) /* ROM */
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM) /* RAM */
- AM_RANGE(0x9000, 0x9000) AM_WRITE(combasc_play_w) /* upd7759 play voice */
- AM_RANGE(0xa000, 0xa000) AM_WRITE(upd7759_0_port_w) /* upd7759 voice select */
- AM_RANGE(0xc000, 0xc000) AM_WRITE(combasc_voice_reset_w) /* upd7759 reset? */
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ym2203_control_port_0_w)/* YM 2203 */
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ym2203_write_port_0_w) /* YM 2203 */
+ AM_RANGE(0x9000, 0x9000) AM_DEVWRITE(SOUND, "upd", combasc_play_w) /* upd7759 play voice */
+ AM_RANGE(0xa000, 0xa000) AM_DEVWRITE(SOUND, "upd", upd7759_port_w) /* upd7759 voice select */
+ AM_RANGE(0xc000, 0xc000) AM_DEVWRITE(SOUND, "upd", combasc_voice_reset_w) /* upd7759 reset? */
+ AM_RANGE(0xe000, 0xe001) AM_DEVWRITE(SOUND, "ym", ym2203_w) /* YM 2203 */
ADDRESS_MAP_END
@@ -563,10 +566,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- combasc_portA_w,
- NULL
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(combasc_portA_w),
+ DEVCB_NULL
},
NULL
};
diff --git a/src/mame/drivers/commando.c b/src/mame/drivers/commando.c
index 9c247fcd555..b1a6ed561a9 100644
--- a/src/mame/drivers/commando.c
+++ b/src/mame/drivers/commando.c
@@ -87,10 +87,8 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM
AM_RANGE(0x4000, 0x47ff) AM_RAM
AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
- AM_RANGE(0x8000, 0x8000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x8001, 0x8001) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0x8002, 0x8002) AM_WRITE(ym2203_control_port_1_w)
- AM_RANGE(0x8003, 0x8003) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0x8000, 0x8001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x8002, 0x8003) AM_DEVWRITE(SOUND, "ym2", ym2203_w)
ADDRESS_MAP_END
/* Input Ports */
diff --git a/src/mame/drivers/compgolf.c b/src/mame/drivers/compgolf.c
index ef1ddc33de8..98c69c89540 100644
--- a/src/mame/drivers/compgolf.c
+++ b/src/mame/drivers/compgolf.c
@@ -25,12 +25,12 @@ extern VIDEO_UPDATE ( compgolf );
static int bank;
-static WRITE8_HANDLER( compgolf_scrollx_lo_w )
+static WRITE8_DEVICE_HANDLER( compgolf_scrollx_lo_w )
{
compgolf_scrollx_lo = data;
}
-static WRITE8_HANDLER( compgolf_scrolly_lo_w )
+static WRITE8_DEVICE_HANDLER( compgolf_scrolly_lo_w )
{
compgolf_scrolly_lo = data;
}
@@ -60,7 +60,7 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x3001, 0x3001) AM_READ_PORT("P2")
AM_RANGE(0x3002, 0x3002) AM_READ_PORT("DSW1")
AM_RANGE(0x3003, 0x3003) AM_READ_PORT("DSW2")
- AM_RANGE(0x3800, 0x3800) AM_READ(ym2203_status_port_0_r)
+ AM_RANGE(0x3800, 0x3801) AM_DEVREAD(SOUND, "ym", ym2203_r)
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1)
AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM)
ADDRESS_MAP_END
@@ -72,8 +72,7 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x2000, 0x2060) AM_WRITE(SMH_RAM) AM_BASE(&spriteram)
AM_RANGE(0x2061, 0x2061) AM_WRITE(SMH_NOP)
AM_RANGE(0x3001, 0x3001) AM_WRITE(compgolf_ctrl_w)
- AM_RANGE(0x3800, 0x3800) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x3801, 0x3801) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0x3800, 0x3801) AM_DEVWRITE(SOUND, "ym", ym2203_w)
AM_RANGE(0x4000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
@@ -191,9 +190,9 @@ GFXDECODE_END
/***************************************************************************/
-static void sound_irq(running_machine *machine, int linestate)
+static void sound_irq(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[0],0,linestate);
+ cpu_set_input_line(device->machine->cpu[0],0,linestate);
}
static const ym2203_interface ym2203_config =
@@ -201,10 +200,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- compgolf_scrollx_lo_w,
- compgolf_scrolly_lo_w,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(compgolf_scrollx_lo_w),
+ DEVCB_HANDLER(compgolf_scrolly_lo_w),
},
sound_irq
};
diff --git a/src/mame/drivers/contra.c b/src/mame/drivers/contra.c
index fde77355ae3..45e0814a432 100644
--- a/src/mame/drivers/contra.c
+++ b/src/mame/drivers/contra.c
@@ -108,14 +108,13 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0000) AM_READ(soundlatch_r)
- AM_RANGE(0x2001, 0x2001) AM_READ(ym2151_status_port_0_r)
+ AM_RANGE(0x2000, 0x2001) AM_DEVREAD(SOUND, "ym", ym2151_r)
AM_RANGE(0x6000, 0x67ff) AM_READ(SMH_RAM)
AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM)
ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
- AM_RANGE(0x2000, 0x2000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x2001, 0x2001) AM_WRITE(ym2151_data_port_0_w)
+ AM_RANGE(0x2000, 0x2001) AM_DEVWRITE(SOUND, "ym", ym2151_w)
AM_RANGE(0x4000, 0x4000) AM_WRITE(SMH_NOP) /* read triggers irq reset and latch read (in the hardware only). */
AM_RANGE(0x6000, 0x67ff) AM_WRITE(SMH_RAM)
AM_RANGE(0x8000, 0xffff) AM_WRITE(SMH_ROM)
diff --git a/src/mame/drivers/coolpool.c b/src/mame/drivers/coolpool.c
index 634d68d7641..77c830d240d 100644
--- a/src/mame/drivers/coolpool.c
+++ b/src/mame/drivers/coolpool.c
@@ -401,9 +401,9 @@ static WRITE16_HANDLER( dsp_romaddr_w )
}
-static WRITE16_HANDLER( dsp_dac_w )
+static WRITE16_DEVICE_HANDLER( dsp_dac_w )
{
- dac_signed_data_16_w(0, (INT16)(data << 4) + 0x8000);
+ dac_signed_data_16_w(device, (INT16)(data << 4) + 0x8000);
}
@@ -540,7 +540,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( dsp_io_map, ADDRESS_SPACE_IO, 16 )
AM_RANGE(0x00, 0x01) AM_WRITE(dsp_romaddr_w)
AM_RANGE(0x02, 0x02) AM_READWRITE(dsp_cmd_r, dsp_answer_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(dsp_dac_w)
+ AM_RANGE(0x03, 0x03) AM_DEVWRITE(SOUND, "dac", dsp_dac_w)
AM_RANGE(0x04, 0x04) AM_READ(dsp_rom_r)
AM_RANGE(0x05, 0x05) AM_READ_PORT("IN0")
AM_RANGE(0x07, 0x07) AM_READ_PORT("IN1")
diff --git a/src/mame/drivers/coolridr.c b/src/mame/drivers/coolridr.c
index b04bdad42c4..002600ad1c0 100644
--- a/src/mame/drivers/coolridr.c
+++ b/src/mame/drivers/coolridr.c
@@ -185,9 +185,9 @@ ADDRESS_MAP_END
// (see also Model 3):
static ADDRESS_MAP_START( system_h1_sound_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_RAM
- AM_RANGE(0x100000, 0x100fff) AM_READWRITE(scsp_0_r, scsp_0_w)
+// AM_RANGE(0x100000, 0x100fff) AM_DEVREADWRITE(SOUND, "scsp1", scsp_r, scsp_w)
AM_RANGE(0x200000, 0x27ffff) AM_RAM
- AM_RANGE(0x300000, 0x300fff) AM_READWRITE(scsp_1_r, scsp_1_w)
+// AM_RANGE(0x300000, 0x300fff) AM_DEVREADWRITE(SOUND, "scsp2", scsp_r, scsp_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/cop01.c b/src/mame/drivers/cop01.c
index 406a855609c..e2cf2d9233e 100644
--- a/src/mame/drivers/cop01.c
+++ b/src/mame/drivers/cop01.c
@@ -52,7 +52,7 @@ Mighty Guy board layout:
#include "driver.h"
#include "cpu/z80/z80.h"
#include "sound/ay8910.h"
-#include "sound/3812intf.h"
+#include "sound/3526intf.h"
#define MIGHTGUY_HACK 0
@@ -152,12 +152,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( audio_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x02, 0x02) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x04, 0x04) AM_WRITE(ay8910_control_port_2_w)
- AM_RANGE(0x05, 0x05) AM_WRITE(ay8910_write_port_2_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x02, 0x03) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x04, 0x05) AM_DEVWRITE(SOUND, "ay3", ay8910_address_data_w)
AM_RANGE(0x06, 0x06) AM_READ(cop01_sound_command_r)
ADDRESS_MAP_END
@@ -167,8 +164,7 @@ static READ8_HANDLER( kludge ) { static int timer; return timer++; }
static ADDRESS_MAP_START( mightguy_audio_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym3526_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym3526_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ym", ym3526_w)
AM_RANGE(0x02, 0x02) AM_WRITE(SMH_NOP) /* 1412M2? */
AM_RANGE(0x03, 0x03) AM_WRITE(SMH_NOP) /* 1412M2? */
AM_RANGE(0x03, 0x03) AM_READ(kludge) /* 1412M2? */
diff --git a/src/mame/drivers/cosmic.c b/src/mame/drivers/cosmic.c
index 8dae9781e39..7bb60f88644 100644
--- a/src/mame/drivers/cosmic.c
+++ b/src/mame/drivers/cosmic.c
@@ -59,6 +59,7 @@ static UINT32 pixel_clock = 0;
static WRITE8_HANDLER( panic_sound_output_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
static int sound_enabled=1;
/* Sound Enable / Disable */
@@ -67,7 +68,7 @@ static WRITE8_HANDLER( panic_sound_output_w )
{
int count;
if (data == 0)
- for(count=0; count<9; count++) sample_stop(count);
+ for(count=0; count<9; count++) sample_stop(samples, count);
sound_enabled = data;
}
@@ -76,50 +77,50 @@ static WRITE8_HANDLER( panic_sound_output_w )
{
switch (offset)
{
- case 0: if (data) sample_start(0, 0, 0); break; /* Walk */
- case 1: if (data) sample_start(0, 5, 0); break; /* Enemy Die 1 */
+ case 0: if (data) sample_start(samples, 0, 0, 0); break; /* Walk */
+ case 1: if (data) sample_start(samples, 0, 5, 0); break; /* Enemy Die 1 */
case 2: if (data) /* Drop 1 */
{
- if (!sample_playing(1))
+ if (!sample_playing(samples, 1))
{
- sample_stop(2);
- sample_start(1, 3, 0);
+ sample_stop(samples, 2);
+ sample_start(samples, 1, 3, 0);
}
}
else
- sample_stop(1);
+ sample_stop(samples, 1);
break;
- case 3: if (data && !sample_playing(6)) /* Oxygen */
- sample_start(6, 9, 1);
+ case 3: if (data && !sample_playing(samples, 6)) /* Oxygen */
+ sample_start(samples, 6, 9, 1);
break;
case 4: break; /* Drop 2 */
- case 5: if (data) sample_start(0, 5, 0); break; /* Enemy Die 2 (use same sample as 1) */
- case 6: if (data && !sample_playing(1) && !sample_playing(3)) /* Hang */
- sample_start(2, 2, 0);
+ case 5: if (data) sample_start(samples, 0, 5, 0); break; /* Enemy Die 2 (use same sample as 1) */
+ case 6: if (data && !sample_playing(samples, 1) && !sample_playing(samples, 3)) /* Hang */
+ sample_start(samples, 2, 2, 0);
break;
case 7: if (data) /* Escape */
{
- sample_stop(2);
- sample_start(3, 4, 0);
+ sample_stop(samples, 2);
+ sample_start(samples, 3, 4, 0);
}
else
- sample_stop(3);
+ sample_stop(samples, 3);
break;
- case 8: if (data) sample_start(0, 1, 0); break; /* Stairs */
+ case 8: if (data) sample_start(samples, 0, 1, 0); break; /* Stairs */
case 9: if (data) /* Extend */
- sample_start(4, 8, 0);
+ sample_start(samples, 4, 8, 0);
else
- sample_stop(4);
+ sample_stop(samples, 4);
break;
- case 10: dac_data_w(0, data); break; /* Bonus */
- case 15: if (data) sample_start(0, 6, 0); break; /* Player Die */
- case 16: if (data) sample_start(5, 7, 0); break; /* Enemy Laugh */
- case 17: if (data) sample_start(0, 10, 0); break; /* Coin - Not triggered by software */
+ case 10: dac_data_w(devtag_get_device(space->machine, SOUND, "dac"), data); break;/* Bonus */
+ case 15: if (data) sample_start(samples, 0, 6, 0); break; /* Player Die */
+ case 16: if (data) sample_start(samples, 5, 7, 0); break; /* Enemy Laugh */
+ case 17: if (data) sample_start(samples, 0, 10, 0); break; /* Coin - Not triggered by software */
}
}
@@ -135,6 +136,7 @@ static WRITE8_HANDLER( panic_sound_output2_w )
static WRITE8_HANDLER( cosmicg_output_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
static int march_select;
static int gun_die_select;
static int sound_enabled;
@@ -147,7 +149,7 @@ static WRITE8_HANDLER( cosmicg_output_w )
sound_enabled = data;
if (data == 0)
- for(count=0;count<9;count++) sample_stop(count);
+ for(count=0;count<9;count++) sample_stop(samples, count);
}
if (sound_enabled)
@@ -158,38 +160,38 @@ static WRITE8_HANDLER( cosmicg_output_w )
/* as other cosmic series games, but it never seems to */
/* be used for anything. It is implemented for sake of */
/* completness. Maybe it plays a tune if you win ? */
- case 1: dac_data_w(0, -data); break;
- case 2: if (data) sample_start (0, march_select, 0); break; /* March Sound */
+ case 1: dac_data_w(devtag_get_device(space->machine, SOUND, "dac"), -data); break;
+ case 2: if (data) sample_start (samples, 0, march_select, 0); break; /* March Sound */
case 3: march_select = (march_select & 0xfe) | data; break;
case 4: march_select = (march_select & 0xfd) | (data << 1); break;
case 5: march_select = (march_select & 0xfb) | (data << 2); break;
case 6: if (data) /* Killer Attack (crawly thing at bottom of screen) */
- sample_start(1, 8, 1);
+ sample_start(samples, 1, 8, 1);
else
- sample_stop(1);
+ sample_stop(samples, 1);
break;
case 7: if (data) /* Bonus Chance & Got Bonus */
{
- sample_stop(4);
- sample_start(4, 10, 0);
+ sample_stop(samples, 4);
+ sample_start(samples, 4, 10, 0);
}
break;
case 8: if (data)
{
- if (!sample_playing(4)) sample_start(4, 9, 1);
+ if (!sample_playing(samples, 4)) sample_start(samples, 4, 9, 1);
}
else
- sample_stop(4);
+ sample_stop(samples, 4);
break;
- case 9: if (data) sample_start(3, 11, 0); break; /* Got Ship */
+ case 9: if (data) sample_start(samples, 3, 11, 0); break; /* Got Ship */
// case 11: watchdog_reset_w(0, 0); break; /* Watchdog */
- case 13: if (data) sample_start(8, 13-gun_die_select, 0); break; /* Got Monster / Gunshot */
+ case 13: if (data) sample_start(samples, 8, 13-gun_die_select, 0); break; /* Got Monster / Gunshot */
case 14: gun_die_select = data; break;
- case 15: if (data) sample_start(5, 14, 0); break; /* Coin Extend (extra base) */
+ case 15: if (data) sample_start(samples, 5, 14, 0); break; /* Coin Extend (extra base) */
}
}
@@ -201,6 +203,7 @@ static WRITE8_HANDLER( cosmicg_output_w )
static WRITE8_HANDLER( cosmica_sound_output_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
static int sound_enabled=1;
static int dive_bomb_b_select=0;
@@ -209,10 +212,10 @@ static WRITE8_HANDLER( cosmica_sound_output_w )
{
int count;
if (data == 0)
- for(count=0; count<12; count++) sample_stop(count);
+ for(count=0; count<12; count++) sample_stop(samples, count);
else
{
- sample_start(0, 0, 1); /*Background Noise*/
+ sample_start(samples, 0, 0, 1); /*Background Noise*/
}
sound_enabled = data;
@@ -222,7 +225,7 @@ static WRITE8_HANDLER( cosmica_sound_output_w )
{
switch (offset)
{
- case 0: if (data) sample_start(1, 2, 0); break; /*Dive Bombing Type A*/
+ case 0: if (data) sample_start(samples, 1, 2, 0); break; /*Dive Bombing Type A*/
case 2: /*Dive Bombing Type B (Main Control)*/
@@ -235,65 +238,65 @@ static WRITE8_HANDLER( cosmica_sound_output_w )
case 2:
- if (sample_playing(2))
+ if (sample_playing(samples, 2))
{
- sample_stop(2);
- sample_start(2, 3, 0); break;
+ sample_stop(samples, 2);
+ sample_start(samples, 2, 3, 0); break;
}
else
- sample_start(2, 3, 0); break;
+ sample_start(samples, 2, 3, 0); break;
case 3:
- if (sample_playing(3))
+ if (sample_playing(samples, 3))
{
- sample_stop(3);
- sample_start(3, 4, 0); break;
+ sample_stop(samples, 3);
+ sample_start(samples, 3, 4, 0); break;
}
else
- sample_start(3, 4, 0); break;
+ sample_start(samples, 3, 4, 0); break;
case 4:
- if (sample_playing(4))
+ if (sample_playing(samples, 4))
{
- sample_stop(4);
- sample_start(4, 5, 0); break;
+ sample_stop(samples, 4);
+ sample_start(samples, 4, 5, 0); break;
}
else
- sample_start(4, 5, 0); break;
+ sample_start(samples, 4, 5, 0); break;
case 5:
- if (sample_playing(5))
+ if (sample_playing(samples, 5))
{
- sample_stop(5);
- sample_start(5, 6, 0); break;
+ sample_stop(samples, 5);
+ sample_start(samples, 5, 6, 0); break;
}
else
- sample_start(5, 6, 0); break;
+ sample_start(samples, 5, 6, 0); break;
case 6:
- if (sample_playing(6))
+ if (sample_playing(samples, 6))
{
- sample_stop(6);
- sample_start(6, 7, 0); break;
+ sample_stop(samples, 6);
+ sample_start(samples, 6, 7, 0); break;
}
else
- sample_start(6, 7, 0); break;
+ sample_start(samples, 6, 7, 0); break;
case 7:
- if (sample_playing(7))
+ if (sample_playing(samples, 7))
{
- sample_stop(7);
- sample_start(7, 8, 0); break;
+ sample_stop(samples, 7);
+ sample_start(samples, 7, 8, 0); break;
}
else
- sample_start(7, 8, 0); break;
+ sample_start(samples, 7, 8, 0); break;
}
}
@@ -324,22 +327,22 @@ static WRITE8_HANDLER( cosmica_sound_output_w )
break;
- case 6: if (data) sample_start(8, 9, 0); break; /*Fire Control*/
+ case 6: if (data) sample_start(samples, 8, 9, 0); break; /*Fire Control*/
- case 7: if (data) sample_start(9, 10, 0); break; /*Small Explosion*/
+ case 7: if (data) sample_start(samples, 9, 10, 0); break; /*Small Explosion*/
- case 8: if (data) sample_start(10, 11, 0); break; /*Loud Explosion*/
+ case 8: if (data) sample_start(samples, 10, 11, 0); break; /*Loud Explosion*/
case 9:
if (data)
- sample_start(11, 1, 1);
+ sample_start(samples, 11, 1, 1);
else
- sample_stop(11);
+ sample_stop(samples, 11);
break; /*Extend Sound control*/
case 12:
- if (data) sample_start(11,12, 0); break; /*Insert Coin*/
+ if (data) sample_start(samples, 11,12, 0); break; /*Insert Coin*/
}
}
@@ -536,7 +539,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( magspot_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x2fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x4000, 0x401f) AM_WRITE(SMH_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
- AM_RANGE(0x4800, 0x4800) AM_WRITE(dac_0_data_w)
+ AM_RANGE(0x4800, 0x4800) AM_DEVWRITE(SOUND, "dac", dac_w)
AM_RANGE(0x480c, 0x480d) AM_WRITE(cosmic_color_register_w)
AM_RANGE(0x480f, 0x480f) AM_WRITE(flip_screen_w)
AM_RANGE(0x6000, 0x7fff) AM_WRITE(SMH_RAM) AM_BASE(&videoram) AM_SIZE(&videoram_size)
@@ -1593,10 +1596,11 @@ static DRIVER_INIT( devzone )
static DRIVER_INIT( nomnlnd )
{
+ const device_config *dac = devtag_get_device(machine, SOUND, "dac");
memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5000, 0x5001, 0, 0, nomnlnd_port_0_1_r);
memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4800, 0x4800, 0, 0, SMH_NOP);
memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4807, 0x4807, 0, 0, cosmic_background_enable_w);
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x480a, 0x480a, 0, 0, dac_0_data_w);
+ memory_install_write8_device_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), dac, 0x480a, 0x480a, 0, 0, dac_w);
}
diff --git a/src/mame/drivers/cowrace.c b/src/mame/drivers/cowrace.c
index b6f75c46907..7cf843ea25c 100644
--- a/src/mame/drivers/cowrace.c
+++ b/src/mame/drivers/cowrace.c
@@ -106,8 +106,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( io_map_sound_cowrace, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x40, 0x40) AM_READWRITE(ym2203_read_port_0_r,ym2203_write_port_0_w)
- AM_RANGE(0x41, 0x41) AM_WRITE(ym2203_control_port_0_w)
+ AM_RANGE(0x40, 0x41) AM_DEVWRITE(SOUND, "ym", ym2203_w)
ADDRESS_MAP_END
@@ -155,8 +154,10 @@ static const ym2203_interface ym2203_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r, okim6295_status_0_r, // read A,B
- NULL, okim6295_data_0_w, // write A,B
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r), // read A
+ DEVCB_DEVICE_HANDLER(SOUND, "oki", okim6295_r), // read B
+ DEVCB_NULL, // write A
+ DEVCB_DEVICE_HANDLER(SOUND, "oki", okim6295_w) // write B
},
NULL
};
diff --git a/src/mame/drivers/cps1.c b/src/mame/drivers/cps1.c
index fa21dc86b0f..a2632f3c44e 100644
--- a/src/mame/drivers/cps1.c
+++ b/src/mame/drivers/cps1.c
@@ -288,9 +288,9 @@ static WRITE8_HANDLER( cps1_snd_bankswitch_w )
memory_set_bankptr(space->machine, 1,&RAM[0x10000 + bankaddr]);
}
-static WRITE8_HANDLER( cps1_oki_pin7_w )
+static WRITE8_DEVICE_HANDLER( cps1_oki_pin7_w )
{
- okim6295_set_pin7(0, (data & 1));
+ okim6295_set_pin7(device, (data & 1));
}
static WRITE16_HANDLER( cps1_soundlatch_w )
@@ -632,11 +632,10 @@ static ADDRESS_MAP_START( sub_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1)
AM_RANGE(0xd000, 0xd7ff) AM_RAM
- AM_RANGE(0xf000, 0xf000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xf001, 0xf001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
- AM_RANGE(0xf002, 0xf002) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0xf000, 0xf001) AM_DEVREADWRITE(SOUND, "2151", ym2151_r, ym2151_w)
+ AM_RANGE(0xf002, 0xf002) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0xf004, 0xf004) AM_WRITE(cps1_snd_bankswitch_w)
- AM_RANGE(0xf006, 0xf006) AM_WRITE(cps1_oki_pin7_w) /* controls pin 7 of OKI chip */
+ AM_RANGE(0xf006, 0xf006) AM_DEVWRITE(SOUND, "oki", cps1_oki_pin7_w) /* controls pin 7 of OKI chip */
AM_RANGE(0xf008, 0xf008) AM_READ(soundlatch_r) /* Sound command */
AM_RANGE(0xf00a, 0xf00a) AM_READ(soundlatch2_r) /* Sound timer fade */
ADDRESS_MAP_END
@@ -664,11 +663,9 @@ ADDRESS_MAP_START( qsound_sub_map, ADDRESS_SPACE_PROGRAM, 8 ) // used by cps2.c
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1) /* banked (contains music data) */
AM_RANGE(0xc000, 0xcfff) AM_RAM AM_BASE(&qsound_sharedram1)
- AM_RANGE(0xd000, 0xd000) AM_WRITE(qsound_data_h_w)
- AM_RANGE(0xd001, 0xd001) AM_WRITE(qsound_data_l_w)
- AM_RANGE(0xd002, 0xd002) AM_WRITE(qsound_cmd_w)
+ AM_RANGE(0xd000, 0xd002) AM_DEVWRITE(SOUND, "qsound", qsound_w)
AM_RANGE(0xd003, 0xd003) AM_WRITE(qsound_banksw_w)
- AM_RANGE(0xd007, 0xd007) AM_READ(qsound_status_r)
+ AM_RANGE(0xd007, 0xd007) AM_DEVREAD(SOUND, "qsound", qsound_r)
AM_RANGE(0xf000, 0xffff) AM_RAM AM_BASE(&qsound_sharedram2)
ADDRESS_MAP_END
@@ -2737,9 +2734,9 @@ GFXDECODE_END
-static void cps1_irq_handler_mus(running_machine *machine, int irq)
+static void cps1_irq_handler_mus(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2151_interface ym2151_config =
@@ -2891,7 +2888,7 @@ ADDRESS_MAP_END
static void m5205_int1(const device_config *device)
{
-// msm5205_data_w(0, sample_buffer1 & 0x0F);
+// msm5205_data_w(device, sample_buffer1 & 0x0F);
// sample_buffer1 >>= 4;
// sample_select1 ^= 1;
// if (sample_select1 == 0)
@@ -2900,7 +2897,7 @@ static void m5205_int1(const device_config *device)
static void m5205_int2(const device_config *device)
{
-// msm5205_data_w(1, sample_buffer2 & 0x0F);
+// msm5205_data_w(device, sample_buffer2 & 0x0F);
// sample_buffer2 >>= 4;
// sample_select2 ^= 1;
}
diff --git a/src/mame/drivers/cps3.c b/src/mame/drivers/cps3.c
index 42d353d0099..a0abfcc66b8 100644
--- a/src/mame/drivers/cps3.c
+++ b/src/mame/drivers/cps3.c
@@ -2257,14 +2257,6 @@ static INTERRUPT_GEN(cps3_other_interrupt)
//static sh2_cpu_core sh2cp_conf_slave = { 1 };
-static const custom_sound_interface custom_interface =
-{
- cps3_sh_start
-};
-
-
-
-
static const SCSIConfigTable dev_table =
{
1, /* 1 SCSI device */
@@ -2580,8 +2572,7 @@ static MACHINE_DRIVER_START( cps3 )
/* sound hardware */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("cps3", CUSTOM, MASTER_CLOCK / 3)
- MDRV_SOUND_CONFIG(custom_interface)
+ MDRV_SOUND_ADD("cps3", CPS3, MASTER_CLOCK / 3)
MDRV_SOUND_ROUTE(1, "left", 1.0)
MDRV_SOUND_ROUTE(0, "right", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/crbaloon.c b/src/mame/drivers/crbaloon.c
index 38f115cf4b1..49009d7ce3f 100644
--- a/src/mame/drivers/crbaloon.c
+++ b/src/mame/drivers/crbaloon.c
@@ -159,6 +159,9 @@ static READ8_HANDLER( pc3259_r )
static WRITE8_HANDLER( port_sound_w )
{
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+ const device_config *sn = devtag_get_device(space->machine, SOUND, "sn");
+
/* D0 - interrupt enable - also goes to PC3259 as /HTCTRL */
cpu_interrupt_enable(space->machine->cpu[0], (data & 0x01) ? TRUE : FALSE);
crbaloon_set_clear_collision_address((data & 0x01) ? TRUE : FALSE);
@@ -167,19 +170,19 @@ static WRITE8_HANDLER( port_sound_w )
sound_global_enable((data & 0x02) ? TRUE : FALSE);
/* D2 - unlabeled - music enable */
- crbaloon_audio_set_music_enable(space, (data & 0x04) ? TRUE : FALSE);
+ crbaloon_audio_set_music_enable(discrete, 0, (data & 0x04) ? TRUE : FALSE);
/* D3 - EXPLOSION */
- crbaloon_audio_set_explosion_enable((data & 0x08) ? TRUE : FALSE);
+ crbaloon_audio_set_explosion_enable(sn, (data & 0x08) ? TRUE : FALSE);
/* D4 - BREATH */
- crbaloon_audio_set_breath_enable((data & 0x10) ? TRUE : FALSE);
+ crbaloon_audio_set_breath_enable(sn, (data & 0x10) ? TRUE : FALSE);
/* D5 - APPEAR */
- crbaloon_audio_set_appear_enable((data & 0x20) ? TRUE : FALSE);
+ crbaloon_audio_set_appear_enable(sn, (data & 0x20) ? TRUE : FALSE);
/* D6 - unlabeled - laugh enable */
- crbaloon_audio_set_laugh_enable(space, (data & 0x40) ? TRUE : FALSE);
+ crbaloon_audio_set_laugh_enable(discrete, 0, (data & 0x40) ? TRUE : FALSE);
/* D7 - unlabeled - goes to PC3259 pin 16 */
@@ -187,12 +190,6 @@ static WRITE8_HANDLER( port_sound_w )
}
-static WRITE8_HANDLER( port_music_w )
-{
- crbaloon_audio_set_music_freq(space, data);
-}
-
-
/*************************************
*
@@ -227,7 +224,7 @@ static ADDRESS_MAP_START( main_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0x00) AM_WRITE(SMH_NOP) /* not connected */
AM_RANGE(0x01, 0x01) AM_WRITE(SMH_NOP) /* watchdog */
AM_RANGE(0x02, 0x04) AM_WRITE(SMH_RAM) AM_BASE(&crbaloon_spriteram)
- AM_RANGE(0x05, 0x05) AM_WRITE(port_music_w)
+ AM_RANGE(0x05, 0x05) AM_DEVWRITE(SOUND, "discrete", crbaloon_audio_set_music_freq)
AM_RANGE(0x06, 0x06) AM_WRITE(port_sound_w)
AM_RANGE(0x07, 0x0b) AM_WRITE(pc3092_w) AM_BASE(&pc3092_data)
AM_RANGE(0x0c, 0x0c) AM_WRITE(SMH_NOP) /* MSK - to PC3259 */
@@ -346,10 +343,11 @@ GFXDECODE_END
static MACHINE_RESET( crballoon )
{
const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO);
+ const device_config *discrete = devtag_get_device(machine, SOUND, "discrete");
pc3092_reset();
port_sound_w(space, 0, 0);
- port_music_w(space, 0, 0);
+ crbaloon_audio_set_music_freq(discrete, 0, 0);
}
diff --git a/src/mame/drivers/crgolf.c b/src/mame/drivers/crgolf.c
index c56cb83d6e6..bef4c579fdc 100644
--- a/src/mame/drivers/crgolf.c
+++ b/src/mame/drivers/crgolf.c
@@ -183,7 +183,7 @@ static void vck_callback(const device_config *device)
UINT8 data = memory_region(device->machine, "adpcm")[sample_offset >> 1];
/* write the next nibble and advance */
- msm5205_data_w(0, (data >> (4 * (~sample_offset & 1))) & 0x0f);
+ msm5205_data_w(device, (data >> (4 * (~sample_offset & 1))) & 0x0f);
sample_offset++;
/* every 256 clocks, we decrement the length */
@@ -193,19 +193,19 @@ static void vck_callback(const device_config *device)
/* if we hit 0xff, automatically turn off playback */
if (sample_count == 0xff)
- msm5205_reset_w(0, 1);
+ msm5205_reset_w(device, 1);
}
}
}
-static WRITE8_HANDLER( crgolfhi_sample_w )
+static WRITE8_DEVICE_HANDLER( crgolfhi_sample_w )
{
switch (offset)
{
/* offset 0 holds the MSM5205 in reset */
case 0:
- msm5205_reset_w(0, 1);
+ msm5205_reset_w(device, 1);
break;
/* offset 1 is the length/256 nibbles */
@@ -220,7 +220,7 @@ static WRITE8_HANDLER( crgolfhi_sample_w )
/* offset 3 turns on playback */
case 3:
- msm5205_reset_w(0, 0);
+ msm5205_reset_w(device, 0);
break;
}
}
@@ -258,8 +258,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
AM_RANGE(0xc002, 0xc002) AM_WRITE(SMH_NOP)
AM_RANGE(0xe000, 0xe000) AM_READWRITE(switch_input_r, switch_input_select_w)
AM_RANGE(0xe001, 0xe001) AM_READWRITE(analog_input_r, unknown_w)
@@ -581,7 +580,8 @@ ROM_END
static DRIVER_INIT( crgolfhi )
{
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xa000, 0xa003, 0, 0, crgolfhi_sample_w);
+ const device_config *msm = devtag_get_device(machine, SOUND, "msm");
+ memory_install_write8_device_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), msm, 0xa000, 0xa003, 0, 0, crgolfhi_sample_w);
}
diff --git a/src/mame/drivers/crimfght.c b/src/mame/drivers/crimfght.c
index 2e4945c65f4..a09376d6958 100644
--- a/src/mame/drivers/crimfght.c
+++ b/src/mame/drivers/crimfght.c
@@ -39,14 +39,14 @@ static WRITE8_HANDLER( crimfght_sh_irqtrigger_w )
cpu_set_input_line_and_vector(space->machine->cpu[1],0,HOLD_LINE,0xff);
}
-static WRITE8_HANDLER( crimfght_snd_bankswitch_w )
+static WRITE8_DEVICE_HANDLER( crimfght_snd_bankswitch_w )
{
/* b1: bank for channel A */
/* b0: bank for channel B */
int bank_A = ((data >> 1) & 0x01);
int bank_B = ((data) & 0x01);
- k007232_set_bank( 0, bank_A, bank_B );
+ k007232_set_bank( devtag_get_device(device->machine, SOUND, "konami"), bank_A, bank_B );
}
@@ -82,17 +82,16 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( crimfght_readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) /* ROM 821l01.h4 */
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM) /* RAM */
- AM_RANGE(0xa001, 0xa001) AM_READ(ym2151_status_port_0_r) /* YM2151 */
+ AM_RANGE(0xa000, 0xa001) AM_DEVREAD(SOUND, "ym", ym2151_r) /* YM2151 */
AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_r) /* soundlatch_r */
- AM_RANGE(0xe000, 0xe00d) AM_READ(k007232_read_port_0_r) /* 007232 registers */
+ AM_RANGE(0xe000, 0xe00d) AM_DEVREAD(SOUND, "konami", k007232_r) /* 007232 registers */
ADDRESS_MAP_END
static ADDRESS_MAP_START( crimfght_writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM) /* ROM 821l01.h4 */
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM) /* RAM */
- AM_RANGE(0xa000, 0xa000) AM_WRITE(ym2151_register_port_0_w) /* YM2151 */
- AM_RANGE(0xa001, 0xa001) AM_WRITE(ym2151_data_port_0_w) /* YM2151 */
- AM_RANGE(0xe000, 0xe00d) AM_WRITE(k007232_write_port_0_w) /* 007232 registers */
+ AM_RANGE(0xa000, 0xa001) AM_DEVWRITE(SOUND, "ym", ym2151_w) /* YM2151 */
+ AM_RANGE(0xe000, 0xe00d) AM_DEVWRITE(SOUND, "konami", k007232_w) /* 007232 registers */
ADDRESS_MAP_END
/***************************************************************************
@@ -278,10 +277,10 @@ static const ym2151_interface ym2151_config =
crimfght_snd_bankswitch_w
};
-static void volume_callback(int v)
+static void volume_callback(const device_config *device, int v)
{
- k007232_set_volume(0,0,(v & 0x0f) * 0x11,0);
- k007232_set_volume(0,1,0,(v >> 4) * 0x11);
+ k007232_set_volume(device,0,(v & 0x0f) * 0x11,0);
+ k007232_set_volume(device,1,0,(v >> 4) * 0x11);
}
static const k007232_interface k007232_config =
diff --git a/src/mame/drivers/crospang.c b/src/mame/drivers/crospang.c
index fe3541fc2b7..499e9360f3a 100644
--- a/src/mame/drivers/crospang.c
+++ b/src/mame/drivers/crospang.c
@@ -138,9 +138,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( crospang_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym3812_write_port_0_w)
- AM_RANGE(0x02, 0x02) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym3812_r, ym3812_w)
+ AM_RANGE(0x02, 0x02) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0x06, 0x06) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -316,9 +315,9 @@ static GFXDECODE_START( crospang )
GFXDECODE_END
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1],0,linestate);
+ cpu_set_input_line(device->machine->cpu[1],0,linestate);
}
static const ym3812_interface ym3812_config =
diff --git a/src/mame/drivers/crshrace.c b/src/mame/drivers/crshrace.c
index 093f063313b..6bde5ca5c61 100644
--- a/src/mame/drivers/crshrace.c
+++ b/src/mame/drivers/crshrace.c
@@ -237,10 +237,7 @@ static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(crshrace_sh_bankswitch_w)
AM_RANGE(0x04, 0x04) AM_READWRITE(soundlatch_r, pending_command_clear_w)
- AM_RANGE(0x08, 0x08) AM_READWRITE(ym2610_status_port_0_a_r, ym2610_control_port_0_a_w)
- AM_RANGE(0x09, 0x09) AM_WRITE(ym2610_data_port_0_a_w)
- AM_RANGE(0x0a, 0x0a) AM_READWRITE(ym2610_status_port_0_b_r, ym2610_control_port_0_b_w)
- AM_RANGE(0x0b, 0x0b) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE(SOUND, "ym", ym2610_r, ym2610_w)
ADDRESS_MAP_END
@@ -436,9 +433,9 @@ GFXDECODE_END
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface ym2610_config =
diff --git a/src/mame/drivers/crystal.c b/src/mame/drivers/crystal.c
index 2444c54b273..91d1c19c065 100644
--- a/src/mame/drivers/crystal.c
+++ b/src/mame/drivers/crystal.c
@@ -440,7 +440,7 @@ static ADDRESS_MAP_START( crystal_mem, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x03000000, 0x0300ffff) AM_RAM AM_BASE(&vidregs)
AM_RANGE(0x03800000, 0x03ffffff) AM_RAM AM_BASE(&textureram)
AM_RANGE(0x04000000, 0x047fffff) AM_RAM AM_BASE(&frameram)
- AM_RANGE(0x04800000, 0x04800fff) AM_READ(vr0_snd_read) AM_WRITE(vr0_snd_write)
+ AM_RANGE(0x04800000, 0x04800fff) AM_DEVREADWRITE(SOUND, "vrender", vr0_snd_read, vr0_snd_write)
AM_RANGE(0x05000000, 0x05000003) AM_READ(FlashCmd_r) AM_WRITE(FlashCmd_w)
AM_RANGE(0x05000000, 0x05ffffff) AM_READ(SMH_BANK1)
@@ -531,7 +531,7 @@ static MACHINE_RESET(crystal)
timer_adjust_oneshot(Timer[i],attotime_never,0);
}
- vr0_snd_set_areas(textureram,frameram);
+ vr0_snd_set_areas(devtag_get_device(machine, SOUND, "vrender"), textureram,frameram);
#ifdef IDLE_LOOP_SPEEDUP
FlipCntRead=0;
#endif
diff --git a/src/mame/drivers/cshooter.c b/src/mame/drivers/cshooter.c
index 086b1001005..5962e62a89d 100644
--- a/src/mame/drivers/cshooter.c
+++ b/src/mame/drivers/cshooter.c
@@ -324,10 +324,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( s_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_WRITE(SMH_ROM)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(SMH_NOP) // ym2203_control_port_0_w ?
- AM_RANGE(0xc001, 0xc001) AM_WRITE(SMH_NOP) // ym2203_write_port_0_w
- AM_RANGE(0xc800, 0xc800) AM_WRITE(SMH_NOP) // ym2203_control_port_1_w ?
- AM_RANGE(0xc801, 0xc801) AM_WRITE(SMH_NOP) // ym2203_write_port_1_w
+ AM_RANGE(0xc000, 0xc001) AM_WRITE(SMH_NOP) // AM_DEVWRITE(SOUND, "ym1", ym2203_w) ?
+ AM_RANGE(0xc800, 0xc801) AM_WRITE(SMH_NOP) // AM_DEVWRITE(SOUND, "ym2", ym2203_w) ?
AM_RANGE(0xf800, 0xffff) AM_WRITE(SMH_RAM)
ADDRESS_MAP_END
@@ -337,11 +335,8 @@ static ADDRESS_MAP_START( s2_readmem, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END
static ADDRESS_MAP_START( s2_writemem, ADDRESS_SPACE_PROGRAM, 8 )
- AM_RANGE(0x4000, 0x4000) AM_WRITE(SMH_NOP) // ym2203_control_port_0_w ?
- AM_RANGE(0x4001, 0x4001) AM_WRITE(SMH_NOP) // ym2203_write_port_0_w
-
- AM_RANGE(0x4008, 0x4008) AM_WRITE(SMH_NOP) // ym2203_control_port_0_w ?
- AM_RANGE(0x4009, 0x4009) AM_WRITE(SMH_NOP) // ym2203_write_port_0_w
+ AM_RANGE(0x4000, 0x4001) AM_WRITE(SMH_NOP) // AM_DEVWRITE(SOUND, "ym1", ym2203_w) ?
+ AM_RANGE(0x4008, 0x4009) AM_WRITE(SMH_NOP) // AM_DEVWRITE(SOUND, "ym2", ym2203_w) ?
ADDRESS_MAP_END
diff --git a/src/mame/drivers/cubeqst.c b/src/mame/drivers/cubeqst.c
index 8076d053d81..ea563804da3 100644
--- a/src/mame/drivers/cubeqst.c
+++ b/src/mame/drivers/cubeqst.c
@@ -21,7 +21,6 @@
#include "cpu/m68000/m68000.h"
#include "cpu/cubeqcpu/cubeqcpu.h"
#include "sound/dac.h"
-#include "sound/custom.h"
#include "streams.h"
#include "machine/laserdsc.h"
@@ -465,7 +464,18 @@ static MACHINE_RESET( cubeqst )
/* Called by the sound CPU emulation */
static void sound_dac_w(const device_config *device, UINT16 data)
{
- dac_signed_data_16_w(data & 15, (data & 0xfff0) ^ 0x8000);
+ static const char *dacs[] =
+ {
+ "rdac0", "ldac0",
+ "rdac1", "ldac1",
+ "rdac2", "ldac2",
+ "rdac3", "ldac3",
+ "rdac4", "ldac4",
+ "rdac5", "ldac5",
+ "rdac6", "ldac6",
+ "rdac7", "ldac7"
+ };
+ dac_signed_data_16_w(devtag_get_device(device->machine, SOUND, dacs[data & 15]), (data & 0xfff0) ^ 0x8000);
}
static const cubeqst_snd_config snd_config =
@@ -527,8 +537,7 @@ static MACHINE_DRIVER_START( cubeqst )
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("ldsound", CUSTOM, 0)
- MDRV_SOUND_CONFIG(laserdisc_custom_interface)
+ MDRV_SOUND_ADD("ldsound", LASERDISC, 0)
MDRV_SOUND_ROUTE(0, "left", 1.0)
MDRV_SOUND_ROUTE(1, "right", 1.0)
diff --git a/src/mame/drivers/cubocd32.c b/src/mame/drivers/cubocd32.c
index 5dbc77464dc..3224386645a 100644
--- a/src/mame/drivers/cubocd32.c
+++ b/src/mame/drivers/cubocd32.c
@@ -46,7 +46,6 @@
#include "driver.h"
#include "cpu/m68000/m68000.h"
-#include "sound/custom.h"
#include "sound/cdda.h"
#include "includes/amiga.h"
#include "includes/cubocd32.h"
@@ -89,7 +88,7 @@ static WRITE32_HANDLER( aga_overlay_w )
static WRITE8_DEVICE_HANDLER( cd32_cia_0_porta_w )
{
/* bit 1 = cd audio mute */
- sndti_set_output_gain(SOUND_CDDA, 0, 0, ( data & 1 ) ? 0.0 : 1.0 );
+ sound_set_output_gain(devtag_get_device(device->machine, SOUND, "cdda"), 0, ( data & 1 ) ? 0.0 : 1.0 );
/* bit 2 = Power Led on Amiga */
set_led_status(0, (data & 2) ? 0 : 1);
@@ -210,13 +209,6 @@ INPUT_PORTS_END
*
*************************************/
-static const custom_sound_interface amiga_custom_interface =
-{
- amiga_sh_start
-};
-
-
-
static const cia6526_interface cia_0_intf =
{
DEVCB_LINE(amiga_cia_0_irq), /* irq_func */
@@ -265,8 +257,7 @@ static MACHINE_DRIVER_START( cd32 )
/* sound hardware */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("amiga", CUSTOM, 3579545)
- MDRV_SOUND_CONFIG(amiga_custom_interface)
+ MDRV_SOUND_ADD("amiga", AMIGA, 3579545)
MDRV_SOUND_ROUTE(0, "left", 0.25)
MDRV_SOUND_ROUTE(1, "right", 0.25)
MDRV_SOUND_ROUTE(2, "right", 0.25)
diff --git a/src/mame/drivers/cultures.c b/src/mame/drivers/cultures.c
index aaef89e45b7..522ac0381f9 100644
--- a/src/mame/drivers/cultures.c
+++ b/src/mame/drivers/cultures.c
@@ -165,7 +165,7 @@ static ADDRESS_MAP_START( cultures_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x80, 0x80) AM_WRITE(cpu_bankswitch_w)
AM_RANGE(0x90, 0x90) AM_WRITE(misc_w)
AM_RANGE(0xa0, 0xa0) AM_WRITE(bg_bank_w)
- AM_RANGE(0xc0, 0xc0) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0xd0, 0xd0) AM_READ_PORT("SW1_A")
AM_RANGE(0xd1, 0xd1) AM_READ_PORT("SW1_B")
AM_RANGE(0xd2, 0xd2) AM_READ_PORT("SW2_A")
diff --git a/src/mame/drivers/cvs.c b/src/mame/drivers/cvs.c
index e7346d97bc6..1453931786f 100644
--- a/src/mame/drivers/cvs.c
+++ b/src/mame/drivers/cvs.c
@@ -334,7 +334,7 @@ static void start_393hz_timer(running_machine *machine)
*
*************************************/
-static WRITE8_HANDLER( cvs_4_bit_dac_data_w )
+static WRITE8_DEVICE_HANDLER( cvs_4_bit_dac_data_w )
{
UINT8 dac_value;
@@ -347,7 +347,7 @@ static WRITE8_HANDLER( cvs_4_bit_dac_data_w )
(cvs_4_bit_dac_data[3] << 3);
/* scale up to a full byte and output */
- dac_1_data_w(space, 0, (dac_value << 4) | dac_value);
+ dac_data_w(device, (dac_value << 4) | dac_value);
}
@@ -359,35 +359,35 @@ static WRITE8_HANDLER( cvs_4_bit_dac_data_w )
*************************************/
/* temporary code begin */
-static void speech_execute_command(const address_space *space, UINT8 command)
+static void speech_execute_command(const device_config *tms, UINT8 command)
{
/* reset */
if (command == 0x3f)
{
- tms5110_ctl_w(space, 0, TMS5110_CMD_RESET);
+ tms5110_ctl_w(tms, 0, TMS5110_CMD_RESET);
- tms5110_pdc_w(space, 0,0);
- tms5110_pdc_w(space, 0,1);
- tms5110_pdc_w(space, 0,0);
+ tms5110_pdc_w(tms, 0,0);
+ tms5110_pdc_w(tms, 0,1);
+ tms5110_pdc_w(tms, 0,0);
- tms5110_pdc_w(space, 0,0);
- tms5110_pdc_w(space, 0,1);
- tms5110_pdc_w(space, 0,0);
+ tms5110_pdc_w(tms, 0,0);
+ tms5110_pdc_w(tms, 0,1);
+ tms5110_pdc_w(tms, 0,0);
- tms5110_pdc_w(space, 0,0);
- tms5110_pdc_w(space, 0,1);
- tms5110_pdc_w(space, 0,0);
+ tms5110_pdc_w(tms, 0,0);
+ tms5110_pdc_w(tms, 0,1);
+ tms5110_pdc_w(tms, 0,0);
speech_rom_bit_address = 0;
}
/* start */
else
{
- tms5110_ctl_w(space, 0, TMS5110_CMD_SPEAK);
+ tms5110_ctl_w(tms, 0, TMS5110_CMD_SPEAK);
- tms5110_pdc_w(space, 0, 0);
- tms5110_pdc_w(space, 0, 1);
- tms5110_pdc_w(space, 0, 0);
+ tms5110_pdc_w(tms, 0, 0);
+ tms5110_pdc_w(tms, 0, 1);
+ tms5110_pdc_w(tms, 0, 0);
speech_rom_bit_address = command * 0x80 * 8;
}
@@ -418,11 +418,11 @@ static void cvs_set_speech_command_w(const address_space *space, UINT8 data)
static READ8_HANDLER( cvs_speech_command_r )
{
/* bit 7 is TMS status (active LO) */
- return (~tms5110_status_r(space, 0) << 7) | soundlatch2_r(space, 0);
+ return (~tms5110_status_r(devtag_get_device(space->machine, SOUND, "tms"), 0) << 7) | soundlatch2_r(space, 0);
}
-static WRITE8_HANDLER( cvs_tms5110_ctl_w )
+static WRITE8_DEVICE_HANDLER( cvs_tms5110_ctl_w )
{
UINT8 ctl;
@@ -433,13 +433,13 @@ static WRITE8_HANDLER( cvs_tms5110_ctl_w )
0 | /* CTL4 */
(cvs_tms5110_ctl_data[0] << 3); /* CTL8 */
- //tms5110_ctl_w(0, ctl);
+ //tms5110_ctl_w(device, ctl);
}
-static WRITE8_HANDLER( cvs_tms5110_pdc_w )
+static WRITE8_DEVICE_HANDLER( cvs_tms5110_pdc_w )
{
- //tms5110_pdc_w(0, ~data >> 7);
+ //tms5110_pdc_w(device, ~data >> 7);
}
@@ -489,7 +489,7 @@ static WRITE8_HANDLER( audio_command_w )
/* temporary code begin */
if ((data & 0x40) == 0)
- speech_execute_command(space, data & 0x03f);
+ speech_execute_command(devtag_get_device(space->machine, SOUND, "tms"), data & 0x03f);
/* temporary code end */
}
@@ -568,8 +568,8 @@ static ADDRESS_MAP_START( cvs_dac_cpu_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_ROM
AM_RANGE(0x1000, 0x107f) AM_RAM
AM_RANGE(0x1800, 0x1800) AM_READ(soundlatch_r)
- AM_RANGE(0x1840, 0x1840) AM_WRITE(dac_0_data_w)
- AM_RANGE(0x1880, 0x1883) AM_WRITE(cvs_4_bit_dac_data_w) AM_BASE(&cvs_4_bit_dac_data)
+ AM_RANGE(0x1840, 0x1840) AM_DEVWRITE(SOUND, "dac1", dac_w)
+ AM_RANGE(0x1880, 0x1883) AM_DEVWRITE(SOUND, "dac2", cvs_4_bit_dac_data_w) AM_BASE(&cvs_4_bit_dac_data)
AM_RANGE(0x1884, 0x1887) AM_WRITE(SMH_NOP) /* not connected to anything */
ADDRESS_MAP_END
@@ -592,8 +592,8 @@ static ADDRESS_MAP_START( cvs_speech_cpu_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1d00, 0x1d00) AM_WRITE(cvs_speech_rom_address_lo_w)
AM_RANGE(0x1d40, 0x1d40) AM_WRITE(cvs_speech_rom_address_hi_w)
AM_RANGE(0x1d80, 0x1d80) AM_READ(cvs_speech_command_r)
- AM_RANGE(0x1ddd, 0x1dde) AM_WRITE(cvs_tms5110_ctl_w) AM_BASE(&cvs_tms5110_ctl_data)
- AM_RANGE(0x1ddf, 0x1ddf) AM_WRITE(cvs_tms5110_pdc_w)
+ AM_RANGE(0x1ddd, 0x1dde) AM_DEVWRITE(SOUND, "tms", cvs_tms5110_ctl_w) AM_BASE(&cvs_tms5110_ctl_data)
+ AM_RANGE(0x1ddf, 0x1ddf) AM_DEVWRITE(SOUND, "tms", cvs_tms5110_pdc_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/cyberbal.c b/src/mame/drivers/cyberbal.c
index 39f9d6dda45..50a144dbb1c 100644
--- a/src/mame/drivers/cyberbal.c
+++ b/src/mame/drivers/cyberbal.c
@@ -187,8 +187,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_RAM
- AM_RANGE(0x2000, 0x2000) AM_READWRITE(ym2151_status_port_0_r, ym2151_register_port_0_w)
- AM_RANGE(0x2001, 0x2001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x2000, 0x2001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x2800, 0x2801) AM_WRITE(cyberbal_sound_68k_6502_w)
AM_RANGE(0x2802, 0x2803) AM_READWRITE(atarigen_6502_irq_ack_r, atarigen_6502_irq_ack_w)
AM_RANGE(0x2804, 0x2805) AM_WRITE(atarigen_6502_sound_w)
diff --git a/src/mame/drivers/cybertnk.c b/src/mame/drivers/cybertnk.c
index e7e8d6907cb..1694a639ea9 100644
--- a/src/mame/drivers/cybertnk.c
+++ b/src/mame/drivers/cybertnk.c
@@ -173,7 +173,7 @@ lev 7 : 0x7c : 0000 07e0 - input device clear?
#include "cpu/z80/z80.h"
#include "cpu/m68000/m68000.h"
#include "deprecat.h"
-#include "sound/3812intf.h"
+#include "sound/8950intf.h"
static tilemap *tx_tilemap;
static UINT16 *tx_vram;
@@ -392,10 +392,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_mem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff ) AM_ROM
AM_RANGE(0x8000, 0x9fff ) AM_RAM
- AM_RANGE(0xa000, 0xa000 ) AM_READWRITE(y8950_status_port_0_r,y8950_control_port_0_w)
- AM_RANGE(0xa001, 0xa001 ) AM_READWRITE(soundport_r,y8950_write_port_0_w)
- AM_RANGE(0xc000, 0xc000 ) AM_READWRITE(y8950_status_port_1_r,y8950_control_port_1_w)
- AM_RANGE(0xc001, 0xc001 ) AM_WRITE(y8950_write_port_1_w)
+ AM_RANGE(0xa001, 0xa001 ) AM_READ(soundport_r)
+ AM_RANGE(0xa000, 0xa001 ) AM_DEVREADWRITE(SOUND, "ym1", y8950_r, y8950_w)
+ AM_RANGE(0xc000, 0xc001 ) AM_DEVREADWRITE(SOUND, "ym2", y8950_r, y8950_w)
ADDRESS_MAP_END
static INPUT_PORTS_START( cybertnk )
diff --git a/src/mame/drivers/dacholer.c b/src/mame/drivers/dacholer.c
index 4cf8f615ed3..2ccf0e584b0 100644
--- a/src/mame/drivers/dacholer.c
+++ b/src/mame/drivers/dacholer.c
@@ -136,12 +136,9 @@ static ADDRESS_MAP_START( snd_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x08, 0x08) AM_WRITE(snd_irq_w)
AM_RANGE(0x0c, 0x0c) AM_WRITE(snd_ack_w)
AM_RANGE(0x80, 0x80) AM_WRITE(adpcm_w)
- AM_RANGE(0x86, 0x86) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x87, 0x87) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x8a, 0x8a) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x8b, 0x8b) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x8e, 0x8e) AM_WRITE(ay8910_write_port_2_w)
- AM_RANGE(0x8f, 0x8f) AM_WRITE(ay8910_control_port_2_w)
+ AM_RANGE(0x86, 0x87) AM_DEVWRITE(SOUND, "ay1", ay8910_data_address_w)
+ AM_RANGE(0x8a, 0x8b) AM_DEVWRITE(SOUND, "ay2", ay8910_data_address_w)
+ AM_RANGE(0x8e, 0x8f) AM_DEVWRITE(SOUND, "ay3", ay8910_data_address_w)
ADDRESS_MAP_END
@@ -384,7 +381,7 @@ static void adpcm_int(const device_config *device)
{
if(snd_interrupt_enable == 1 || (snd_interrupt_enable ==0 && msm_toggle==1))
{
- msm5205_data_w(0,msm_data >> 4);
+ msm5205_data_w(device,msm_data >> 4);
msm_data<<=4;
msm_toggle^=1;
if (msm_toggle==0)
diff --git a/src/mame/drivers/darius.c b/src/mame/drivers/darius.c
index db5185d65db..f68f2b58cbf 100644
--- a/src/mame/drivers/darius.c
+++ b/src/mame/drivers/darius.c
@@ -337,136 +337,148 @@ static UINT32 darius_def_vol[0x10];
static UINT8 darius_vol[DARIUS_VOL_MAX];
static UINT8 darius_pan[DARIUS_PAN_MAX];
-static void update_fm0( void )
+static void update_fm0( running_machine *machine )
{
+ const device_config *lvol = devtag_get_device(machine, SOUND, "filter0.3l");
+ const device_config *rvol = devtag_get_device(machine, SOUND, "filter0.3r");
int left, right;
left = ( darius_pan[0] * darius_vol[6])>>8;
right = ((0xff - darius_pan[0]) * darius_vol[6])>>8;
- if (sndti_exists(SOUND_FILTER_VOLUME, 6))
- flt_volume_set_volume(6, left / 100.0);
- if (sndti_exists(SOUND_FILTER_VOLUME, 7))
- flt_volume_set_volume(7, right / 100.0); /* FM #0 */
+ if (lvol != NULL)
+ flt_volume_set_volume(lvol, left / 100.0);
+ if (rvol != NULL)
+ flt_volume_set_volume(rvol, right / 100.0); /* FM #0 */
}
-static void update_fm1( void )
+static void update_fm1( running_machine *machine )
{
+ const device_config *lvol = devtag_get_device(machine, SOUND, "filter1.3l");
+ const device_config *rvol = devtag_get_device(machine, SOUND, "filter1.3r");
int left, right;
left = ( darius_pan[1] * darius_vol[7])>>8;
right = ((0xff - darius_pan[1]) * darius_vol[7])>>8;
- if (sndti_exists(SOUND_FILTER_VOLUME, 14))
- flt_volume_set_volume(14, left / 100.0);
- if (sndti_exists(SOUND_FILTER_VOLUME, 15))
- flt_volume_set_volume(15, right / 100.0); /* FM #1 */
+ if (lvol != NULL)
+ flt_volume_set_volume(lvol, left / 100.0);
+ if (rvol != NULL)
+ flt_volume_set_volume(rvol, right / 100.0); /* FM #1 */
}
-static void update_psg0( int port )
+static void update_psg0( running_machine *machine, int port )
{
+ static const char *fltname[3][2] = { { "filter0.0l", "filter0.0r" }, { "filter0.1l", "filter0.1r" }, { "filter0.2l", "filter0.2r" } };
+ const device_config *lvol = devtag_get_device(machine, SOUND, fltname[port][0]);
+ const device_config *rvol = devtag_get_device(machine, SOUND, fltname[port][1]);
int left, right;
left = ( darius_pan[2] * darius_vol[port])>>8;
right = ((0xff - darius_pan[2]) * darius_vol[port])>>8;
- if (sndti_exists(SOUND_FILTER_VOLUME, port*2+0))
- flt_volume_set_volume(port*2+0, left / 100.0);
- if (sndti_exists(SOUND_FILTER_VOLUME, port*2+1))
- flt_volume_set_volume(port*2+1, right / 100.0);
+ if (lvol != NULL)
+ flt_volume_set_volume(lvol, left / 100.0);
+ if (rvol != NULL)
+ flt_volume_set_volume(rvol, right / 100.0);
}
-static void update_psg1( int port )
+static void update_psg1( running_machine *machine, int port )
{
+ static const char *fltname[3][2] = { { "filter0.0l", "filter0.0r" }, { "filter0.1l", "filter0.1r" }, { "filter0.2l", "filter0.2r" } };
+ const device_config *lvol = devtag_get_device(machine, SOUND, fltname[port][0]);
+ const device_config *rvol = devtag_get_device(machine, SOUND, fltname[port][1]);
int left, right;
left = ( darius_pan[3] * darius_vol[port + 3])>>8;
right = ((0xff - darius_pan[3]) * darius_vol[port + 3])>>8;
- if (sndti_exists(SOUND_FILTER_VOLUME, port*2+0+8))
- flt_volume_set_volume(port*2+0+8, left / 100.0);
- if (sndti_exists(SOUND_FILTER_VOLUME, port*2+1+8))
- flt_volume_set_volume(port*2+1+8, right / 100.0);
+ if (lvol != NULL)
+ flt_volume_set_volume(lvol, left / 100.0);
+ if (rvol != NULL)
+ flt_volume_set_volume(rvol, right / 100.0);
}
-static void update_da( void )
+static void update_da( running_machine *machine )
{
+ const device_config *lvol = devtag_get_device(machine, SOUND, "msm5205.l");
+ const device_config *rvol = devtag_get_device(machine, SOUND, "msm5205.r");
int left, right;
left = darius_def_vol[(darius_pan[4]>>4)&0x0f];
right = darius_def_vol[(darius_pan[4]>>0)&0x0f];
- if (sndti_exists(SOUND_FILTER_VOLUME, 16))
- flt_volume_set_volume(16, left / 100.0);
- if (sndti_exists(SOUND_FILTER_VOLUME, 17))
- flt_volume_set_volume(17, right / 100.0); /* FM #1 */
+ if (lvol != NULL)
+ flt_volume_set_volume(lvol, left / 100.0);
+ if (rvol != NULL)
+ flt_volume_set_volume(rvol, right / 100.0); /* FM #1 */
}
static WRITE8_HANDLER( darius_fm0_pan )
{
darius_pan[0] = data&0xff; /* data 0x00:right 0xff:left */
- update_fm0();
+ update_fm0(space->machine);
}
static WRITE8_HANDLER( darius_fm1_pan )
{
darius_pan[1] = data&0xff;
- update_fm1();
+ update_fm1(space->machine);
}
static WRITE8_HANDLER( darius_psg0_pan )
{
darius_pan[2] = data&0xff;
- update_psg0( 0 );
- update_psg0( 1 );
- update_psg0( 2 );
+ update_psg0( space->machine, 0 );
+ update_psg0( space->machine, 1 );
+ update_psg0( space->machine, 2 );
}
static WRITE8_HANDLER( darius_psg1_pan )
{
darius_pan[3] = data&0xff;
- update_psg1( 0 );
- update_psg1( 1 );
- update_psg1( 2 );
+ update_psg1( space->machine, 0 );
+ update_psg1( space->machine, 1 );
+ update_psg1( space->machine, 2 );
}
static WRITE8_HANDLER( darius_da_pan )
{
darius_pan[4] = data&0xff;
- update_da();
+ update_da(space->machine);
}
/**** Mixer Control ****/
-static WRITE8_HANDLER( darius_write_portA0 )
+static WRITE8_DEVICE_HANDLER( darius_write_portA0 )
{
// volume control FM #0 PSG #0 A
//popmessage(" pan %02x %02x %02x %02x %02x", darius_pan[0], darius_pan[1], darius_pan[2], darius_pan[3], darius_pan[4] );
//popmessage(" A0 %02x A1 %02x B0 %02x B1 %02x", port[0], port[1], port[2], port[3] );
darius_vol[0] = darius_def_vol[(data>>4)&0x0f];
darius_vol[6] = darius_def_vol[(data>>0)&0x0f];
- update_fm0();
- update_psg0( 0 );
+ update_fm0(device->machine);
+ update_psg0( device->machine, 0 );
}
-static WRITE8_HANDLER( darius_write_portA1 )
+static WRITE8_DEVICE_HANDLER( darius_write_portA1 )
{
// volume control FM #1 PSG #1 A
//popmessage(" pan %02x %02x %02x %02x %02x", darius_pan[0], darius_pan[1], darius_pan[2], darius_pan[3], darius_pan[4] );
darius_vol[3] = darius_def_vol[(data>>4)&0x0f];
darius_vol[7] = darius_def_vol[(data>>0)&0x0f];
- update_fm1();
- update_psg1( 0 );
+ update_fm1(device->machine);
+ update_psg1( device->machine, 0 );
}
-static WRITE8_HANDLER( darius_write_portB0 )
+static WRITE8_DEVICE_HANDLER( darius_write_portB0 )
{
// volume control PSG #0 B/C
//popmessage(" pan %02x %02x %02x %02x %02x", darius_pan[0], darius_pan[1], darius_pan[2], darius_pan[3], darius_pan[4] );
darius_vol[1] = darius_def_vol[(data>>4)&0x0f];
darius_vol[2] = darius_def_vol[(data>>0)&0x0f];
- update_psg0( 1 );
- update_psg0( 2 );
+ update_psg0( device->machine, 1 );
+ update_psg0( device->machine, 2 );
}
-static WRITE8_HANDLER( darius_write_portB1 )
+static WRITE8_DEVICE_HANDLER( darius_write_portB1 )
{
// volume control PSG #1 B/C
//popmessage(" pan %02x %02x %02x %02x %02x", darius_pan[0], darius_pan[1], darius_pan[2], darius_pan[3], darius_pan[4] );
darius_vol[4] = darius_def_vol[(data>>4)&0x0f];
darius_vol[5] = darius_def_vol[(data>>0)&0x0f];
- update_psg1( 1 );
- update_psg1( 2 );
+ update_psg1( device->machine, 1 );
+ update_psg1( device->machine, 2 );
}
@@ -477,10 +489,8 @@ static WRITE8_HANDLER( darius_write_portB1 )
static ADDRESS_MAP_START( darius_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_BANK1)
AM_RANGE(0x8000, 0x8fff) AM_READ(SMH_RAM)
- AM_RANGE(0x9000, 0x9000) AM_READ(ym2203_status_port_0_r)
- AM_RANGE(0x9001, 0x9001) AM_READ(ym2203_read_port_0_r)
- AM_RANGE(0xa000, 0xa000) AM_READ(ym2203_status_port_1_r)
- AM_RANGE(0xa001, 0xa001) AM_READ(ym2203_read_port_1_r)
+ AM_RANGE(0x9000, 0x9001) AM_DEVREAD(SOUND, "ym1", ym2203_r)
+ AM_RANGE(0xa000, 0xa001) AM_DEVREAD(SOUND, "ym2", ym2203_r)
AM_RANGE(0xb000, 0xb000) AM_READ(SMH_NOP)
AM_RANGE(0xb001, 0xb001) AM_READ(taitosound_slave_comm_r)
ADDRESS_MAP_END
@@ -488,10 +498,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( darius_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x8fff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x9000, 0x9000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x9001, 0x9001) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0xa000, 0xa000) AM_WRITE(ym2203_control_port_1_w)
- AM_RANGE(0xa001, 0xa001) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0x9000, 0x9001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0xa000, 0xa001) AM_DEVWRITE(SOUND, "ym2", ym2203_w)
AM_RANGE(0xb000, 0xb000) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xb001, 0xb001) AM_WRITE(taitosound_slave_comm_w)
AM_RANGE(0xc000, 0xc000) AM_WRITE(darius_fm0_pan)
@@ -555,17 +563,17 @@ static WRITE8_HANDLER ( adpcm_nmi_enable )
/* logerror("write port 1: NMI ENABLE PC=%4x\n", cpu_get_pc(space->cpu) ); */
}
-static WRITE8_HANDLER( adpcm_data_w )
+static WRITE8_DEVICE_HANDLER( adpcm_data_w )
{
- msm5205_data_w (0, data );
- msm5205_reset_w(0, !(data & 0x20) ); /* my best guess, but it could be output enable as well */
+ msm5205_data_w (device, data );
+ msm5205_reset_w(device, !(data & 0x20) ); /* my best guess, but it could be output enable as well */
}
static ADDRESS_MAP_START( darius_sound2_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_READWRITE(adpcm_command_read, adpcm_nmi_disable)
AM_RANGE(0x01, 0x01) AM_WRITE(adpcm_nmi_enable)
- AM_RANGE(0x02, 0x02) AM_READWRITE(readport2, adpcm_data_w) /* readport2 ??? */
+ AM_RANGE(0x02, 0x02) AM_READ(readport2) AM_DEVWRITE(SOUND, "msm", adpcm_data_w) /* readport2 ??? */
AM_RANGE(0x03, 0x03) AM_READ(readport3) /* ??? */
ADDRESS_MAP_END
@@ -793,9 +801,9 @@ GFXDECODE_END
**************************************************************/
/* handler called by the YM2203 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq) /* assumes Z80 sandwiched between 68Ks */
+static void irqhandler(const device_config *device, int irq) /* assumes Z80 sandwiched between 68Ks */
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface ym2203_interface_1 =
@@ -803,10 +811,10 @@ static const ym2203_interface ym2203_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, /* portA read */
- NULL,
- darius_write_portA0, /* portA write */
- darius_write_portB0, /* portB write */
+ DEVCB_NULL, /* portA read */
+ DEVCB_NULL,
+ DEVCB_HANDLER(darius_write_portA0), /* portA write */
+ DEVCB_HANDLER(darius_write_portB0), /* portB write */
},
irqhandler
};
@@ -816,10 +824,10 @@ static const ym2203_interface ym2203_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, /* portA read */
- NULL,
- darius_write_portA1, /* portA write */
- darius_write_portB1 /* portB write */
+ DEVCB_NULL, /* portA read */
+ DEVCB_NULL,
+ DEVCB_HANDLER(darius_write_portA1), /* portA write */
+ DEVCB_HANDLER(darius_write_portB1) /* portB write */
},
};
diff --git a/src/mame/drivers/darkhors.c b/src/mame/drivers/darkhors.c
index 5867c66c58c..c68db92874e 100644
--- a/src/mame/drivers/darkhors.c
+++ b/src/mame/drivers/darkhors.c
@@ -250,17 +250,6 @@ static WRITE32_HANDLER( darkhors_eeprom_w )
}
}
-static WRITE32_HANDLER( okim6295_data_0_msb32_w )
-{
- if (ACCESSING_BITS_24_31)
- okim6295_data_0_msb_w(space, offset, data >> 16, mem_mask >> 16);
-}
-
-static READ32_HANDLER( okim6295_status_0_msb32_r )
-{
- return okim6295_status_0_msb_r(space, offset, mem_mask >> 16) << 16;
-}
-
static WRITE32_HANDLER( paletteram32_xBBBBBGGGGGRRRRR_dword_w )
{
paletteram16 = (UINT16 *)paletteram32;
@@ -315,7 +304,7 @@ static ADDRESS_MAP_START( darkhors_readmem, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x580000, 0x580003) AM_READ_PORT("580000")
AM_RANGE(0x580004, 0x580007) AM_READ_PORT("580004")
AM_RANGE(0x580008, 0x58000b) AM_READ( darkhors_input_sel_r )
- AM_RANGE(0x580084, 0x580087) AM_READ( okim6295_status_0_msb32_r )
+ AM_RANGE(0x580084, 0x580087) AM_DEVREAD8( SOUND, "oki", okim6295_r, 0xff000000 )
AM_RANGE(0x580200, 0x580203) AM_READ( SMH_NOP )
AM_RANGE(0x580400, 0x580403) AM_READ_PORT("580400")
AM_RANGE(0x580420, 0x580423) AM_READ_PORT("580420")
@@ -328,7 +317,7 @@ static ADDRESS_MAP_START( darkhors_writemem, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x490040, 0x490043) AM_WRITE( darkhors_eeprom_w )
AM_RANGE(0x58000c, 0x58000f) AM_WRITE( darkhors_input_sel_w )
AM_RANGE(0x4e0080, 0x4e0083) AM_WRITE( darkhors_unk1_w )
- AM_RANGE(0x580084, 0x580087) AM_WRITE( okim6295_data_0_msb32_w )
+ AM_RANGE(0x580084, 0x580087) AM_DEVWRITE8( SOUND, "oki", okim6295_w, 0xff000000 )
AM_RANGE(0x800000, 0x86bfff) AM_WRITE( SMH_RAM )
AM_RANGE(0x86c000, 0x86ffff) AM_WRITE( darkhors_tmapram_w ) AM_BASE(&darkhors_tmapram)
AM_RANGE(0x870000, 0x873fff) AM_WRITE( darkhors_tmapram2_w ) AM_BASE(&darkhors_tmapram2)
diff --git a/src/mame/drivers/darkseal.c b/src/mame/drivers/darkseal.c
index 3bdf64a18f8..cf8d003abf7 100644
--- a/src/mame/drivers/darkseal.c
+++ b/src/mame/drivers/darkseal.c
@@ -101,46 +101,22 @@ ADDRESS_MAP_END
/******************************************************************************/
-static WRITE8_HANDLER( YM2151_w )
-{
- switch (offset) {
- case 0:
- ym2151_register_port_0_w(space,0,data);
- break;
- case 1:
- ym2151_data_port_0_w(space,0,data);
- break;
- }
-}
-
-static WRITE8_HANDLER( YM2203_w )
-{
- switch (offset) {
- case 0:
- ym2203_control_port_0_w(space,0,data);
- break;
- case 1:
- ym2203_write_port_0_w(space,0,data);
- break;
- }
-}
-
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_READ(SMH_ROM)
- AM_RANGE(0x100000, 0x100001) AM_READ(ym2203_status_port_0_r)
- AM_RANGE(0x110000, 0x110001) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0x120000, 0x120001) AM_READ(okim6295_status_0_r)
- AM_RANGE(0x130000, 0x130001) AM_READ(okim6295_status_1_r)
+ AM_RANGE(0x100000, 0x100001) AM_DEVREAD(SOUND, "ym1", ym2203_r)
+ AM_RANGE(0x110000, 0x110001) AM_DEVREAD(SOUND, "ym2", ym2151_r)
+ AM_RANGE(0x120000, 0x120001) AM_DEVREAD(SOUND, "oki1", okim6295_r)
+ AM_RANGE(0x130000, 0x130001) AM_DEVREAD(SOUND, "oki2", okim6295_r)
AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
AM_RANGE(0x1f0000, 0x1f1fff) AM_READ(SMH_BANK8)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_WRITE(SMH_ROM)
- AM_RANGE(0x100000, 0x100001) AM_WRITE(YM2203_w)
- AM_RANGE(0x110000, 0x110001) AM_WRITE(YM2151_w)
- AM_RANGE(0x120000, 0x120001) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0x130000, 0x130001) AM_WRITE(okim6295_data_1_w)
+ AM_RANGE(0x100000, 0x100001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x110000, 0x110001) AM_DEVWRITE(SOUND, "ym2", ym2151_w)
+ AM_RANGE(0x120000, 0x120001) AM_DEVWRITE(SOUND, "oki1", okim6295_w)
+ AM_RANGE(0x130000, 0x130001) AM_DEVWRITE(SOUND, "oki2", okim6295_w)
AM_RANGE(0x1f0000, 0x1f1fff) AM_WRITE(SMH_BANK8)
AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w)
AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w)
@@ -273,9 +249,9 @@ GFXDECODE_END
/******************************************************************************/
-static void sound_irq(running_machine *machine, int state)
+static void sound_irq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1],1,state); /* IRQ 2 */
+ cpu_set_input_line(device->machine->cpu[1],1,state); /* IRQ 2 */
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/dassault.c b/src/mame/drivers/dassault.c
index dd7ac5cd573..ce2d0538702 100644
--- a/src/mame/drivers/dassault.c
+++ b/src/mame/drivers/dassault.c
@@ -271,20 +271,20 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_READ(SMH_ROM)
- AM_RANGE(0x100000, 0x100001) AM_READ(ym2203_status_port_0_r)
- AM_RANGE(0x110000, 0x110001) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0x120000, 0x120001) AM_READ(okim6295_status_0_r)
- AM_RANGE(0x130000, 0x130001) AM_READ(okim6295_status_1_r)
+ AM_RANGE(0x100000, 0x100001) AM_DEVREAD(SOUND, "ym1", ym2203_r)
+ AM_RANGE(0x110000, 0x110001) AM_DEVREAD(SOUND, "ym2", ym2151_r)
+ AM_RANGE(0x120000, 0x120001) AM_DEVREAD(SOUND, "oki1", okim6295_r)
+ AM_RANGE(0x130000, 0x130001) AM_DEVREAD(SOUND, "oki2", okim6295_r)
AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
AM_RANGE(0x1f0000, 0x1f1fff) AM_READ(SMH_BANK8)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_WRITE(SMH_ROM)
- AM_RANGE(0x100000, 0x100001) AM_WRITE(ym2203_word_0_w)
- AM_RANGE(0x110000, 0x110001) AM_WRITE(ym2151_word_0_w)
- AM_RANGE(0x120000, 0x120001) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0x130000, 0x130001) AM_WRITE(okim6295_data_1_w)
+ AM_RANGE(0x100000, 0x100001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x110000, 0x110001) AM_DEVWRITE(SOUND, "ym2", ym2151_w)
+ AM_RANGE(0x120000, 0x120001) AM_DEVWRITE(SOUND, "oki1", okim6295_w)
+ AM_RANGE(0x130000, 0x130001) AM_DEVWRITE(SOUND, "oki2", okim6295_w)
AM_RANGE(0x1f0000, 0x1f1fff) AM_WRITE(SMH_BANK8)
AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w)
AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w)
@@ -532,15 +532,15 @@ GFXDECODE_END
/**********************************************************************************/
-static void sound_irq(running_machine *machine, int state)
+static void sound_irq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[2],1,state);
+ cpu_set_input_line(device->machine->cpu[2],1,state);
}
-static WRITE8_HANDLER( sound_bankswitch_w )
+static WRITE8_DEVICE_HANDLER( sound_bankswitch_w )
{
/* the second OKIM6295 ROM is bank switched */
- okim6295_set_bank_base(1, (data & 1) * 0x40000);
+ okim6295_set_bank_base(devtag_get_device(device->machine, SOUND, "oki2"), (data & 1) * 0x40000);
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/dblewing.c b/src/mame/drivers/dblewing.c
index ae2826b8bee..ab0038c1a33 100644
--- a/src/mame/drivers/dblewing.c
+++ b/src/mame/drivers/dblewing.c
@@ -468,11 +468,11 @@ static READ8_HANDLER(irq_latch_r)
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
- AM_RANGE(0xa000, 0xa001) AM_READWRITE(ym2151_status_port_0_r,ym2151_word_0_w)
- AM_RANGE(0xb000, 0xb000) AM_READWRITE(okim6295_status_0_r,okim6295_data_0_w)
+ AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE(SOUND, "ym", ym2151_status_port_r,ym2151_w)
+ AM_RANGE(0xb000, 0xb000) AM_DEVREADWRITE(SOUND, "oki", okim6295_r,okim6295_w)
AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_r)
AM_RANGE(0xd000, 0xd000) AM_READ(irq_latch_r) //timing? sound latch?
- AM_RANGE(0xf000, 0xf000) AM_READWRITE(okim6295_status_0_r,okim6295_data_0_w)
+ AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE(SOUND, "oki", okim6295_r,okim6295_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io, ADDRESS_SPACE_IO, 8 )
@@ -647,14 +647,14 @@ static INPUT_PORTS_START( dblewing )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
INPUT_PORTS_END
-static void sound_irq(running_machine *machine, int state)
+static void sound_irq(const device_config *device, int state)
{
/* bit 0 of dblewing_sound_irq specifies IRQ from sound chip */
if (state)
dblewing_sound_irq |= 0x01;
else
dblewing_sound_irq &= ~0x01;
- cpu_set_input_line(machine->cpu[1], 0, (dblewing_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, (dblewing_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/dbz.c b/src/mame/drivers/dbz.c
index 36f30cebd53..d991b78c038 100644
--- a/src/mame/drivers/dbz.c
+++ b/src/mame/drivers/dbz.c
@@ -123,12 +123,12 @@ static WRITE16_HANDLER( dbz_sound_cause_nmi )
cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE);
}
-static void dbz_sound_irq(running_machine *machine, int irq)
+static void dbz_sound_irq(const device_config *device, int irq)
{
if (irq)
- cpu_set_input_line(machine->cpu[1], 0, ASSERT_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, ASSERT_LINE);
else
- cpu_set_input_line(machine->cpu[1], 0, CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, CLEAR_LINE);
}
static ADDRESS_MAP_START( dbz_readmem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -183,17 +183,16 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( dbz_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_RAM)
- AM_RANGE(0xc000, 0xc001) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0xd000, 0xd002) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0xc000, 0xc001) AM_DEVREAD(SOUND, "ym", ym2151_r)
+ AM_RANGE(0xd000, 0xd002) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0xe000, 0xe001) AM_READ(soundlatch_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( dbz_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0xbfff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ym2151_data_port_0_w)
- AM_RANGE(0xd000, 0xd001) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ym", ym2151_w)
+ AM_RANGE(0xd000, 0xd001) AM_DEVWRITE(SOUND, "oki", okim6295_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( dbz_sound_io_map, ADDRESS_SPACE_IO, 8 )
diff --git a/src/mame/drivers/dcheese.c b/src/mame/drivers/dcheese.c
index c8c123620d7..326e68afdd8 100644
--- a/src/mame/drivers/dcheese.c
+++ b/src/mame/drivers/dcheese.c
@@ -182,19 +182,19 @@ static WRITE8_HANDLER( sound_control_w )
/* bit 0x20 = LED */
/* bit 0x40 = BSMT2000 reset */
if ((diff & 0x40) && (data & 0x40))
- sndti_reset(SOUND_BSMT2000, 0);
+ devtag_reset(space->machine, SOUND, "bmst");
if (data != 0x40 && data != 0x60)
logerror("%04X:sound_control_w = %02X\n", cpu_get_pc(space->cpu), data);
}
-static WRITE8_HANDLER( bsmt_data_w )
+static WRITE8_DEVICE_HANDLER( bsmt_data_w )
{
/* writes come in pairs; even bytes latch, odd bytes write */
if (offset % 2 == 0)
sound_msb_latch = data;
else
- bsmt2000_data_0_w(space, offset/2, (sound_msb_latch << 8) | data, 0xffff);
+ bsmt2000_data_w(device, offset/2, (sound_msb_latch << 8) | data, 0xffff);
}
@@ -231,7 +231,7 @@ static ADDRESS_MAP_START( sound_cpu_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x0000, 0x07ff) AM_READWRITE(sound_status_r, sound_control_w)
AM_RANGE(0x0800, 0x0fff) AM_READ(sound_command_r)
- AM_RANGE(0x1000, 0x10ff) AM_MIRROR(0x0700) AM_WRITE(bsmt_data_w)
+ AM_RANGE(0x1000, 0x10ff) AM_MIRROR(0x0700) AM_DEVWRITE(SOUND, "bsmt", bsmt_data_w)
AM_RANGE(0x1800, 0x1fff) AM_RAM
AM_RANGE(0x2000, 0xffff) AM_ROM
ADDRESS_MAP_END
diff --git a/src/mame/drivers/dday.c b/src/mame/drivers/dday.c
index db179dd1447..54283f70d5d 100644
--- a/src/mame/drivers/dday.c
+++ b/src/mame/drivers/dday.c
@@ -91,22 +91,8 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x5800, 0x5bff) AM_WRITE(dday_bgvideoram_w) AM_BASE(&dday_bgvideoram)
AM_RANGE(0x5c00, 0x5fff) AM_WRITE(dday_colorram_w) AM_BASE(&dday_colorram)
AM_RANGE(0x6000, 0x63ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x6400, 0x6400) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x6401, 0x6401) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x6402, 0x6402) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x6403, 0x6403) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x6404, 0x6404) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x6405, 0x6405) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x6406, 0x6406) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x6407, 0x6407) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x6408, 0x6408) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x6409, 0x6409) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x640a, 0x640a) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x640b, 0x640b) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x640c, 0x640c) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x640d, 0x640d) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x6800, 0x6800) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x6801, 0x6801) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0x6400, 0x6401) AM_MIRROR(0x000e) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x6800, 0x6801) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
AM_RANGE(0x7800, 0x7800) AM_WRITE(dday_control_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/ddayjlc.c b/src/mame/drivers/ddayjlc.c
index d6342c8c506..7afa023f73e 100644
--- a/src/mame/drivers/ddayjlc.c
+++ b/src/mame/drivers/ddayjlc.c
@@ -236,10 +236,10 @@ static ADDRESS_MAP_START( sound_cpu, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x2000, 0x23ff) AM_RAM
AM_RANGE(0x7000, 0x7000) AM_WRITE(sound_nmi_w)
- AM_RANGE(0x3000, 0x3000) AM_READ(ay8910_read_port_0_r) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x4000, 0x4000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x5000, 0x5000) AM_READ(ay8910_read_port_1_r) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x6000, 0x6000) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0x3000, 0x3000) AM_DEVREADWRITE(SOUND, "ay1", ay8910_r, ay8910_data_w)
+ AM_RANGE(0x4000, 0x4000) AM_DEVWRITE(SOUND, "ay1", ay8910_address_w)
+ AM_RANGE(0x5000, 0x5000) AM_DEVREADWRITE(SOUND, "ay2", ay8910_r, ay8910_data_w)
+ AM_RANGE(0x6000, 0x6000) AM_DEVWRITE(SOUND, "ay2", ay8910_address_w)
ADDRESS_MAP_END
@@ -382,10 +382,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r,
- NULL,
- NULL,
- NULL
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
static INTERRUPT_GEN( ddayjlc_interrupt )
diff --git a/src/mame/drivers/ddealer.c b/src/mame/drivers/ddealer.c
index b04f33735ca..f5ca0256aa4 100644
--- a/src/mame/drivers/ddealer.c
+++ b/src/mame/drivers/ddealer.c
@@ -427,21 +427,13 @@ static WRITE16_HANDLER( ddealer_mcu_shared_w )
}
}
-static WRITE16_HANDLER( YM2203_w )
-{
- switch (offset) {
- case 0: ym2203_control_port_0_w(space,0,data & 0xff); break;
- case 1: ym2203_write_port_0_w(space,0,data & 0xff); break;
- }
-}
-
static ADDRESS_MAP_START( ddealer, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x03ffff) AM_ROM
AM_RANGE(0x080000, 0x080001) AM_READ_PORT("IN0")
AM_RANGE(0x080002, 0x080003) AM_READ_PORT("IN1")
AM_RANGE(0x080008, 0x080009) AM_READ_PORT("DSW1")
AM_RANGE(0x08000a, 0x08000b) AM_READ_PORT("UNK")
- AM_RANGE(0x084000, 0x084003) AM_WRITE( YM2203_w ) // ym ?
+ AM_RANGE(0x084000, 0x084003) AM_DEVWRITE8(SOUND, "ym", ym2203_w, 0x00ff) // ym ?
AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE(&paletteram16) // palette ram
AM_RANGE(0x08c000, 0x08cfff) AM_RAM_WRITE(ddealer_vregs_w) AM_BASE(&ddealer_vregs) // palette ram
diff --git a/src/mame/drivers/ddenlovr.c b/src/mame/drivers/ddenlovr.c
index c1e3993bd95..4b00b7be614 100644
--- a/src/mame/drivers/ddenlovr.c
+++ b/src/mame/drivers/ddenlovr.c
@@ -1416,35 +1416,35 @@ static WRITE16_HANDLER( ddenlovr16_transparency_mask_w )
}
-static WRITE8_HANDLER( quizchq_oki_bank_w )
+static WRITE8_DEVICE_HANDLER( quizchq_oki_bank_w )
{
- okim6295_set_bank_base(0, (data & 1) * 0x40000);
+ okim6295_set_bank_base(device, (data & 1) * 0x40000);
}
-static WRITE16_HANDLER( ddenlovr_oki_bank_w )
+static WRITE16_DEVICE_HANDLER( ddenlovr_oki_bank_w )
{
if (ACCESSING_BITS_0_7)
- okim6295_set_bank_base(0, (data & 7) * 0x40000);
+ okim6295_set_bank_base(device, (data & 7) * 0x40000);
}
static int okibank;
-static WRITE16_HANDLER( quiz365_oki_bank1_w )
+static WRITE16_DEVICE_HANDLER( quiz365_oki_bank1_w )
{
if (ACCESSING_BITS_0_7)
{
okibank = (okibank & 2) | (data & 1);
- okim6295_set_bank_base(0, okibank * 0x40000);
+ okim6295_set_bank_base(device, okibank * 0x40000);
}
}
-static WRITE16_HANDLER( quiz365_oki_bank2_w )
+static WRITE16_DEVICE_HANDLER( quiz365_oki_bank2_w )
{
if (ACCESSING_BITS_0_7)
{
okibank = (okibank & 1) | ((data & 1) << 1);
- okim6295_set_bank_base(0, okibank * 0x40000);
+ okim6295_set_bank_base(device, okibank * 0x40000);
}
}
@@ -1463,7 +1463,7 @@ static READ16_HANDLER( unk16_r )
static UINT8 ddenlovr_select, ddenlovr_select2;
-static WRITE8_HANDLER( ddenlovr_select_w )
+static WRITE8_DEVICE_HANDLER( ddenlovr_select_w )
{
ddenlovr_select = data;
}
@@ -1499,13 +1499,13 @@ static READ8_HANDLER( rongrong_input2_r )
}
-static READ8_HANDLER( quiz365_input_r )
+static READ8_DEVICE_HANDLER( quiz365_input_r )
{
- if (!(ddenlovr_select & 0x01)) return input_port_read(space->machine, "DSW1");
- if (!(ddenlovr_select & 0x02)) return input_port_read(space->machine, "DSW2");
- if (!(ddenlovr_select & 0x04)) return input_port_read(space->machine, "DSW3");
- if (!(ddenlovr_select & 0x08)) return 0xff;//mame_rand(space->machine);
- if (!(ddenlovr_select & 0x10)) return 0xff;//mame_rand(space->machine);
+ if (!(ddenlovr_select & 0x01)) return input_port_read(device->machine, "DSW1");
+ if (!(ddenlovr_select & 0x02)) return input_port_read(device->machine, "DSW2");
+ if (!(ddenlovr_select & 0x04)) return input_port_read(device->machine, "DSW3");
+ if (!(ddenlovr_select & 0x08)) return 0xff;//mame_rand(device->machine);
+ if (!(ddenlovr_select & 0x10)) return 0xff;//mame_rand(device->machine);
return 0xff;
}
@@ -1581,9 +1581,9 @@ static ADDRESS_MAP_START( quiz365_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x300204, 0x300207) AM_READ(quiz365_input2_r) //
AM_RANGE(0x300270, 0x300271) AM_READ(unk16_r) // ? must be 78 on startup (not necessary in ddlover)
AM_RANGE(0x300286, 0x300287) AM_READ(ddenlovr_gfxrom_r) // Video Chip
- AM_RANGE(0x3002c0, 0x3002c1) AM_READ(okim6295_status_0_lsb_r) // Sound
+ AM_RANGE(0x3002c0, 0x3002c1) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff) // Sound
AM_RANGE(0x300340, 0x30035f) AM_DEVREAD8(MSM6242, "rtc", msm6242_r, 0x00ff) // 6242RTC
- AM_RANGE(0x300384, 0x300385) AM_READ(ay8910_read_port_0_lsb_r)
+ AM_RANGE(0x300384, 0x300385) AM_DEVREAD8(SOUND, "ay", ay8910_r, 0x00ff)
AM_RANGE(0xff0000, 0xffffff) AM_READ(SMH_RAM) // RAM
ADDRESS_MAP_END
@@ -1602,15 +1602,13 @@ static ADDRESS_MAP_START( quiz365_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x30026a, 0x30026b) AM_WRITE(ddenlovr16_priority_w)
AM_RANGE(0x30026c, 0x30026d) AM_WRITE(ddenlovr16_layer_enable_w)
AM_RANGE(0x300280, 0x300283) AM_WRITE(ddenlovr_blitter_w)
- AM_RANGE(0x300300, 0x300301) AM_WRITE(ym2413_register_port_0_lsb_w)
- AM_RANGE(0x300302, 0x300303) AM_WRITE(ym2413_data_port_0_lsb_w)
+ AM_RANGE(0x300300, 0x300303) AM_DEVWRITE8(SOUND, "ym", ym2413_w, 0x00ff)
AM_RANGE(0x300340, 0x30035f) AM_DEVWRITE8(MSM6242, "rtc", msm6242_w, 0x00ff) // 6242RTC
AM_RANGE(0x3003ca, 0x3003cb) AM_WRITE(ddenlovr_blitter_irq_ack_w) // Blitter irq acknowledge
- AM_RANGE(0x300380, 0x300381) AM_WRITE(ay8910_control_port_0_lsb_w)
- AM_RANGE(0x300382, 0x300383) AM_WRITE(ay8910_write_port_0_lsb_w)
- AM_RANGE(0x3002c0, 0x3002c1) AM_WRITE(okim6295_data_0_lsb_w)
- AM_RANGE(0x3003c2, 0x3003c3) AM_WRITE(quiz365_oki_bank1_w)
- AM_RANGE(0x3003cc, 0x3003cd) AM_WRITE(quiz365_oki_bank2_w)
+ AM_RANGE(0x300380, 0x300383) AM_DEVWRITE8(SOUND, "ay", ay8910_address_data_w, 0x00ff)
+ AM_RANGE(0x3002c0, 0x3002c1) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff)
+ AM_RANGE(0x3003c2, 0x3003c3) AM_DEVWRITE(SOUND, "oki", quiz365_oki_bank1_w)
+ AM_RANGE(0x3003cc, 0x3003cd) AM_DEVWRITE(SOUND, "oki", quiz365_oki_bank2_w)
AM_RANGE(0xff0000, 0xffffff) AM_WRITE(SMH_RAM) // RAM
ADDRESS_MAP_END
@@ -1650,7 +1648,7 @@ static ADDRESS_MAP_START( ddenlvrj_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x300182, 0x300183) AM_READ_PORT("P2")
AM_RANGE(0x300184, 0x300185) AM_READ_PORT("SYSTEM")
AM_RANGE(0x300186, 0x300187) AM_READ(ddenlvrj_dsw_r) // DSW
- AM_RANGE(0x300240, 0x300241) AM_READ(okim6295_status_0_lsb_r) // Sound
+ AM_RANGE(0x300240, 0x300241) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff) // Sound
AM_RANGE(0xff0000, 0xffffff) AM_READ(SMH_RAM) // RAM
ADDRESS_MAP_END
@@ -1666,16 +1664,14 @@ static ADDRESS_MAP_START( ddenlvrj_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x30006a, 0x30006b) AM_WRITE(ddenlovr16_priority_w)
AM_RANGE(0x30006c, 0x30006d) AM_WRITE(ddenlovr16_layer_enable_w)
AM_RANGE(0x300080, 0x300083) AM_WRITE(ddenlovr_blitter_w)
- AM_RANGE(0x3000c0, 0x3000c1) AM_WRITE(ym2413_register_port_0_lsb_w)
- AM_RANGE(0x3000c2, 0x3000c3) AM_WRITE(ym2413_data_port_0_lsb_w)
+ AM_RANGE(0x3000c0, 0x3000c3) AM_DEVWRITE8(SOUND, "ym", ym2413_w, 0x00ff)
AM_RANGE(0x300100, 0x30011f) AM_DEVWRITE8(MSM6242, "rtc", msm6242_w, 0x00ff) // 6242RTC
- AM_RANGE(0x300140, 0x300141) AM_WRITE(ay8910_control_port_0_lsb_w)
- AM_RANGE(0x300142, 0x300143) AM_WRITE(ay8910_write_port_0_lsb_w)
+ AM_RANGE(0x300140, 0x300143) AM_DEVWRITE8(SOUND, "ay", ay8910_address_data_w, 0x00ff)
AM_RANGE(0x300188, 0x300189) AM_WRITE(ddenlvrj_coincounter_w) // Coin Counters
AM_RANGE(0x30018a, 0x30018b) AM_WRITE(SMH_RAM) AM_BASE( &ddenlvrj_dsw_sel ) // DSW select
- AM_RANGE(0x30018c, 0x30018d) AM_WRITE(ddenlovr_oki_bank_w)
+ AM_RANGE(0x30018c, 0x30018d) AM_DEVWRITE(SOUND, "oki", ddenlovr_oki_bank_w)
AM_RANGE(0x3001ca, 0x3001cb) AM_WRITE(ddenlovr_blitter_irq_ack_w) // Blitter irq acknowledge
- AM_RANGE(0x300240, 0x300241) AM_WRITE(okim6295_data_0_lsb_w)
+ AM_RANGE(0x300240, 0x300241) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff)
AM_RANGE(0xff0000, 0xffffff) AM_WRITE(SMH_RAM) // RAM
ADDRESS_MAP_END
@@ -1701,7 +1697,7 @@ static READ16_HANDLER( ddenlvrk_protection2_r )
static WRITE16_HANDLER( ddenlvrk_protection2_w )
{
COMBINE_DATA( ddenlvrk_protection2 );
- okim6295_set_bank_base(0, ((*ddenlvrk_protection2)&0x7) * 0x40000);
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki"), ((*ddenlvrk_protection2)&0x7) * 0x40000);
}
static ADDRESS_MAP_START( ddenlvrk_readmem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -1713,8 +1709,8 @@ static ADDRESS_MAP_START( ddenlvrk_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xe00104, 0xe00105) AM_READ_PORT("SYSTEM")
AM_RANGE(0xe00200, 0xe00201) AM_READ_PORT("DSW")
AM_RANGE(0xe00500, 0xe0051f) AM_DEVREAD8(MSM6242, "rtc", msm6242_r, 0x00ff) // 6242RTC
- AM_RANGE(0xe00604, 0xe00605) AM_READ(ay8910_read_port_0_lsb_r)
- AM_RANGE(0xe00700, 0xe00701) AM_READ(okim6295_status_0_lsb_r) // Sound
+ AM_RANGE(0xe00604, 0xe00605) AM_DEVREAD8(SOUND, "ay", ay8910_r, 0x00ff)
+ AM_RANGE(0xe00700, 0xe00701) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff) // Sound
AM_RANGE(0xff0000, 0xffffff) AM_READ(SMH_RAM) // RAM
ADDRESS_MAP_END
@@ -1737,13 +1733,11 @@ static ADDRESS_MAP_START( ddenlvrk_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xe00302, 0xe00303) AM_WRITE(ddenlovr_blitter_irq_ack_w) // Blitter irq acknowledge
AM_RANGE(0xe00308, 0xe00309) AM_WRITE(ddenlovr_coincounter_0_w) // Coin Counters
AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w) //
- AM_RANGE(0xe00400, 0xe00401) AM_WRITE(ym2413_register_port_0_lsb_w)
- AM_RANGE(0xe00402, 0xe00403) AM_WRITE(ym2413_data_port_0_lsb_w)
+ AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8(SOUND, "ym", ym2413_w, 0x00ff)
AM_RANGE(0xe00500, 0xe0051f) AM_DEVWRITE8(MSM6242, "rtc", msm6242_w, 0x00ff) // 6242RTC
// AM_RANGE(0xe00302, 0xe00303) AM_WRITE(SMH_NOP) // ?
- AM_RANGE(0xe00600, 0xe00601) AM_WRITE(ay8910_control_port_0_lsb_w)
- AM_RANGE(0xe00602, 0xe00603) AM_WRITE(ay8910_write_port_0_lsb_w)
- AM_RANGE(0xe00700, 0xe00701) AM_WRITE(okim6295_data_0_lsb_w)
+ AM_RANGE(0xe00600, 0xe00603) AM_DEVWRITE8(SOUND, "ay", ay8910_address_data_w, 0x00ff)
+ AM_RANGE(0xe00700, 0xe00701) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff)
AM_RANGE(0xff0000, 0xffffff) AM_WRITE(SMH_RAM) // RAM
ADDRESS_MAP_END
@@ -1759,14 +1753,14 @@ static ADDRESS_MAP_START( ddenlovr_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xe00104, 0xe00105) AM_READ_PORT("SYSTEM")
AM_RANGE(0xe00200, 0xe00201) AM_READ_PORT("DSW")
AM_RANGE(0xe00500, 0xe0051f) AM_DEVREAD8(MSM6242, "rtc", msm6242_r, 0x00ff) // 6242RTC
- AM_RANGE(0xe00604, 0xe00605) AM_READ(ay8910_read_port_0_lsb_r)
- AM_RANGE(0xe00700, 0xe00701) AM_READ(okim6295_status_0_lsb_r) // Sound
+ AM_RANGE(0xe00604, 0xe00605) AM_DEVREAD8(SOUND, "ay", ay8910_r, 0x00ff)
+ AM_RANGE(0xe00700, 0xe00701) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff) // Sound
AM_RANGE(0xff0000, 0xffffff) AM_READ(SMH_RAM) // RAM
ADDRESS_MAP_END
static ADDRESS_MAP_START( ddenlovr_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_WRITE(SMH_ROM) // ROM
- AM_RANGE(0x300000, 0x300001) AM_WRITE(ddenlovr_oki_bank_w)
+ AM_RANGE(0x300000, 0x300001) AM_DEVWRITE(SOUND, "oki", ddenlovr_oki_bank_w)
AM_RANGE(0xd00000, 0xd003ff) AM_WRITE(ddenlovr_palette_w) // Palette
// AM_RANGE(0xd01000, 0xd017ff) SMH_RAM) // ? B0 on startup, then 00
AM_RANGE(0xe00040, 0xe00047) AM_WRITE(ddenlovr16_palette_base_w)
@@ -1780,13 +1774,11 @@ static ADDRESS_MAP_START( ddenlovr_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xe00302, 0xe00303) AM_WRITE(ddenlovr_blitter_irq_ack_w) // Blitter irq acknowledge
AM_RANGE(0xe00308, 0xe00309) AM_WRITE(ddenlovr_coincounter_0_w) // Coin Counters
AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w) //
- AM_RANGE(0xe00400, 0xe00401) AM_WRITE(ym2413_register_port_0_lsb_w)
- AM_RANGE(0xe00402, 0xe00403) AM_WRITE(ym2413_data_port_0_lsb_w)
+ AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8(SOUND, "ym", ym2413_w, 0x00ff)
AM_RANGE(0xe00500, 0xe0051f) AM_DEVWRITE8(MSM6242, "rtc", msm6242_w, 0x00ff) // 6242RTC
// AM_RANGE(0xe00302, 0xe00303) AM_WRITE(SMH_NOP) // ?
- AM_RANGE(0xe00600, 0xe00601) AM_WRITE(ay8910_control_port_0_lsb_w)
- AM_RANGE(0xe00602, 0xe00603) AM_WRITE(ay8910_write_port_0_lsb_w)
- AM_RANGE(0xe00700, 0xe00701) AM_WRITE(okim6295_data_0_lsb_w)
+ AM_RANGE(0xe00600, 0xe00603) AM_DEVWRITE8(SOUND, "ay", ay8910_address_data_w, 0x00ff)
+ AM_RANGE(0xe00700, 0xe00701) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff)
AM_RANGE(0xff0000, 0xffffff) AM_WRITE(SMH_RAM) // RAM
ADDRESS_MAP_END
@@ -1832,10 +1824,10 @@ static WRITE16_HANDLER( nettoqc_coincounter_w )
}
}
-static WRITE16_HANDLER( nettoqc_oki_bank_w )
+static WRITE16_DEVICE_HANDLER( nettoqc_oki_bank_w )
{
if (ACCESSING_BITS_0_7)
- okim6295_set_bank_base(0, (data & 3) * 0x40000);
+ okim6295_set_bank_base(device, (data & 3) * 0x40000);
}
static ADDRESS_MAP_START( nettoqc_readmem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -1848,7 +1840,7 @@ static ADDRESS_MAP_START( nettoqc_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x300182, 0x300183) AM_READ_PORT("P2")
AM_RANGE(0x300184, 0x300185) AM_READ_PORT("SYSTEM")
AM_RANGE(0x300186, 0x300187) AM_READ(nettoqc_input_r) // DSW's
- AM_RANGE(0x300240, 0x300241) AM_READ(okim6295_status_0_lsb_r) // Sound
+ AM_RANGE(0x300240, 0x300241) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff) // Sound
AM_RANGE(0xff0000, 0xffffff) AM_READ(SMH_RAM) // RAM
ADDRESS_MAP_END
@@ -1865,16 +1857,14 @@ static ADDRESS_MAP_START( nettoqc_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x30006a, 0x30006b) AM_WRITE(ddenlovr16_priority_w)
AM_RANGE(0x30006c, 0x30006d) AM_WRITE(ddenlovr16_layer_enable_w)
AM_RANGE(0x300080, 0x300083) AM_WRITE(ddenlovr_blitter_w)
- AM_RANGE(0x3000c0, 0x3000c1) AM_WRITE(ym2413_register_port_0_lsb_w)
- AM_RANGE(0x3000c2, 0x3000c3) AM_WRITE(ym2413_data_port_0_lsb_w)
+ AM_RANGE(0x3000c0, 0x3000c3) AM_DEVWRITE8(SOUND, "ym", ym2413_w, 0x00ff)
AM_RANGE(0x300100, 0x30011f) AM_DEVWRITE8(MSM6242, "rtc", msm6242_w, 0x00ff) // 6242RTC
- AM_RANGE(0x300140, 0x300141) AM_WRITE(ay8910_control_port_0_lsb_w)
- AM_RANGE(0x300142, 0x300143) AM_WRITE(ay8910_write_port_0_lsb_w )
+ AM_RANGE(0x300140, 0x300143) AM_DEVWRITE8(SOUND, "ay", ay8910_address_data_w, 0x00ff)
AM_RANGE(0x300188, 0x300189) AM_WRITE(nettoqc_coincounter_w) // Coin Counters
AM_RANGE(0x30018a, 0x30018b) AM_WRITE(ddenlovr_select_16_w) //
- AM_RANGE(0x30018c, 0x30018d) AM_WRITE(nettoqc_oki_bank_w)
+ AM_RANGE(0x30018c, 0x30018d) AM_DEVWRITE(SOUND, "oki", nettoqc_oki_bank_w)
AM_RANGE(0x3001ca, 0x3001cb) AM_WRITE(ddenlovr_blitter_irq_ack_w) // Blitter irq acknowledge
- AM_RANGE(0x300240, 0x300241) AM_WRITE(okim6295_data_0_lsb_w)
+ AM_RANGE(0x300240, 0x300241) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff)
AM_RANGE(0xff0000, 0xffffff) AM_WRITE(SMH_RAM) // RAM
ADDRESS_MAP_END
@@ -1925,7 +1915,7 @@ static ADDRESS_MAP_START( quizchq_readport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_GL
AM_RANGE(0x1b, 0x1b) AM_READ(rongrong_blitter_busy_r)
AM_RANGE(0x1c, 0x1c) AM_READ(rongrong_input_r)
AM_RANGE(0x22, 0x23) AM_READ(rongrong_input2_r)
- AM_RANGE(0x40, 0x40) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x40, 0x40) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0x98, 0x98) AM_READ(unk_r) // ? must be 78 on startup
AM_RANGE(0xa0, 0xaf) AM_DEVREAD(MSM6242, "rtc", msm6242_r) // 6242RTC
ADDRESS_MAP_END
@@ -1935,9 +1925,8 @@ static ADDRESS_MAP_START( quizchq_writeport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_G
AM_RANGE(0x1b, 0x1b) AM_WRITE(rongrong_blitter_busy_w)
AM_RANGE(0x1e, 0x1e) AM_WRITE(rongrong_select_w)
AM_RANGE(0x20, 0x20) AM_WRITE(ddenlovr_select2_w)
- AM_RANGE(0x40, 0x40) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0x60, 0x60) AM_WRITE(ym2413_register_port_0_w)
- AM_RANGE(0x61, 0x61) AM_WRITE(ym2413_data_port_0_w)
+ AM_RANGE(0x40, 0x40) AM_DEVWRITE(SOUND, "oki", okim6295_w)
+ AM_RANGE(0x60, 0x61) AM_DEVWRITE(SOUND, "ym", ym2413_w)
AM_RANGE(0x80, 0x83) AM_WRITE(ddenlovr_palette_base_w)
AM_RANGE(0x84, 0x87) AM_WRITE(ddenlovr_palette_mask_w)
AM_RANGE(0x88, 0x8b) AM_WRITE(ddenlovr_transparency_pen_w)
@@ -1946,7 +1935,7 @@ static ADDRESS_MAP_START( quizchq_writeport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_G
AM_RANGE(0x95, 0x95) AM_WRITE(ddenlovr_priority_w)
AM_RANGE(0x96, 0x96) AM_WRITE(ddenlovr_layer_enable_w)
AM_RANGE(0xa0, 0xaf) AM_DEVWRITE(MSM6242, "rtc", msm6242_w) // 6242RTC
- AM_RANGE(0xc0, 0xc0) AM_WRITE(quizchq_oki_bank_w)
+ AM_RANGE(0xc0, 0xc0) AM_DEVWRITE(SOUND, "oki", quizchq_oki_bank_w)
AM_RANGE(0xc2, 0xc2) AM_WRITE(SMH_NOP) // enables palette RAM at 8000
ADDRESS_MAP_END
@@ -1970,7 +1959,7 @@ static ADDRESS_MAP_START( rongrong_readport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_G
AM_RANGE(0x1b, 0x1b) AM_READ(rongrong_blitter_busy_r)
AM_RANGE(0x1c, 0x1c) AM_READ(rongrong_input_r)
AM_RANGE(0x20, 0x2f) AM_DEVREAD(MSM6242, "rtc", msm6242_r) // 6242RTC
- AM_RANGE(0x40, 0x40) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x40, 0x40) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0x98, 0x98) AM_READ(unk_r) // ? must be 78 on startup
AM_RANGE(0xa2, 0xa3) AM_READ(rongrong_input2_r)
ADDRESS_MAP_END
@@ -1980,9 +1969,8 @@ static ADDRESS_MAP_START( rongrong_writeport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_
AM_RANGE(0x1b, 0x1b) AM_WRITE(rongrong_blitter_busy_w)
AM_RANGE(0x1e, 0x1e) AM_WRITE(rongrong_select_w)
AM_RANGE(0x20, 0x2f) AM_DEVWRITE(MSM6242, "rtc", msm6242_w) // 6242RTC
- AM_RANGE(0x40, 0x40) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0x60, 0x60) AM_WRITE(ym2413_register_port_0_w)
- AM_RANGE(0x61, 0x61) AM_WRITE(ym2413_data_port_0_w)
+ AM_RANGE(0x40, 0x40) AM_DEVWRITE(SOUND, "oki", okim6295_w)
+ AM_RANGE(0x60, 0x61) AM_DEVWRITE(SOUND, "ym", ym2413_w)
AM_RANGE(0x80, 0x83) AM_WRITE(ddenlovr_palette_base_w)
AM_RANGE(0x84, 0x87) AM_WRITE(ddenlovr_palette_mask_w)
AM_RANGE(0x88, 0x8b) AM_WRITE(ddenlovr_transparency_pen_w)
@@ -2092,7 +2080,7 @@ static ADDRESS_MAP_START( mmpanic_readport, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x6a, 0x6a) AM_READ_PORT("IN0")
AM_RANGE(0x6b, 0x6b) AM_READ_PORT("IN1")
AM_RANGE(0x6c, 0x6d) AM_READ(mmpanic_link_r) // Other cabinets?
- AM_RANGE(0x7c, 0x7c) AM_READ(okim6295_status_0_r) // Sound
+ AM_RANGE(0x7c, 0x7c) AM_DEVREAD(SOUND, "oki", okim6295_r) // Sound
AM_RANGE(0x94, 0x94) AM_READ_PORT("DSW1")
AM_RANGE(0x98, 0x98) AM_READ_PORT("DSW2")
AM_RANGE(0x9c, 0x9c) AM_READ_PORT("DSW3") // DSW 1&2 high bits
@@ -2120,13 +2108,13 @@ static ADDRESS_MAP_START( mmpanic_writeport, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x60, 0x61) AM_WRITE(mmpanic_blitter_w)
AM_RANGE(0x64, 0x65) AM_WRITE(mmpanic_blitter2_w)
- AM_RANGE(0x68, 0x68) AM_WRITE(ddenlovr_select_w)
+ AM_RANGE(0x68, 0x68) AM_DEVWRITE(SOUND, "ay", ddenlovr_select_w)
AM_RANGE(0x69, 0x69) AM_WRITE(mmpanic_lockout_w)
AM_RANGE(0x74, 0x74) AM_WRITE(mmpanic_rombank_w)
AM_RANGE(0x78, 0x78) AM_WRITE(SMH_NOP) // 0, during RST 08 (irq acknowledge?)
- AM_RANGE(0x7c, 0x7c) AM_WRITE(okim6295_data_0_w) // Sound
+ AM_RANGE(0x7c, 0x7c) AM_DEVWRITE(SOUND, "oki", okim6295_w) // Sound
AM_RANGE(0x8c, 0x8c) AM_WRITE(mmpanic_soundlatch_w) //
AM_RANGE(0x88, 0x88) AM_WRITE(mmpanic_leds_w) // Leds
AM_RANGE(0x90, 0x90) AM_WRITE(SMH_NOP) // written just before port 8c
@@ -2154,10 +2142,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( mmpanic_sound_writeport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x04, 0x04) AM_WRITE(SMH_NOP) // 0, during IRQ
AM_RANGE(0x06, 0x06) AM_WRITE(SMH_NOP) // almost always 1, sometimes 0
- AM_RANGE(0x08, 0x08) AM_WRITE(ym2413_register_port_0_w)
- AM_RANGE(0x09, 0x09) AM_WRITE(ym2413_data_port_0_w)
- AM_RANGE(0x0c, 0x0c) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x0e, 0x0e) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x08, 0x09) AM_DEVWRITE(SOUND, "ym", ym2413_w)
+ AM_RANGE(0x0c, 0x0c) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
+ AM_RANGE(0x0e, 0x0e) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
ADDRESS_MAP_END
@@ -2258,7 +2245,7 @@ static WRITE8_HANDLER( funkyfig_lockout_w )
}
static ADDRESS_MAP_START( funkyfig_readport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READ(okim6295_status_0_r) // Sound
+ AM_RANGE(0x00, 0x00) AM_DEVREAD(SOUND, "oki", okim6295_r) // Sound
AM_RANGE(0x04, 0x04) AM_READ(funkyfig_busy_r)
AM_RANGE(0x1c, 0x1c) AM_READ(funkyfig_dsw_r)
AM_RANGE(0x23, 0x23) AM_READ(rongrong_gfxrom_r) // Video Chip
@@ -2270,7 +2257,7 @@ static ADDRESS_MAP_START( funkyfig_readport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_G
ADDRESS_MAP_END
static ADDRESS_MAP_START( funkyfig_writeport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(okim6295_data_0_w) // Sound
+ AM_RANGE(0x00, 0x00) AM_DEVWRITE(SOUND, "oki", okim6295_w) // Sound
AM_RANGE(0x01, 0x01) AM_WRITE(mmpanic_leds_w) // Leds
AM_RANGE(0x02, 0x02) AM_WRITE(mmpanic_soundlatch_w) //
AM_RANGE(0x1e, 0x1e) AM_WRITE(funkyfig_rombank_w)
@@ -2434,9 +2421,9 @@ static WRITE8_HANDLER( hanakanz_palette_w )
}
}
-static WRITE8_HANDLER( hanakanz_oki_bank_w )
+static WRITE8_DEVICE_HANDLER( hanakanz_oki_bank_w )
{
- okim6295_set_bank_base(0, (data & 0x40) ? 0x40000 : 0);
+ okim6295_set_bank_base(device, (data & 0x40) ? 0x40000 : 0);
}
static READ8_HANDLER( hanakanz_rand_r )
@@ -2451,12 +2438,12 @@ static ADDRESS_MAP_START( hanakanz_readport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_G
AM_RANGE(0x90, 0x90) AM_READ_PORT("SYSTEM")
AM_RANGE(0x91, 0x92) AM_READ(hanakanz_keyb_r)
AM_RANGE(0x96, 0x96) AM_READ(hanakanz_rand_r)
- AM_RANGE(0xc0, 0xc0) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0xc0, 0xc0) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0xe0, 0xef) AM_DEVREAD(MSM6242, "rtc", msm6242_r) // 6242RTC
ADDRESS_MAP_END
static ADDRESS_MAP_START( hanakanz_writeport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x2c, 0x2c) AM_WRITE(hanakanz_oki_bank_w)
+ AM_RANGE(0x2c, 0x2c) AM_DEVWRITE(SOUND, "oki", hanakanz_oki_bank_w)
AM_RANGE(0x2e, 0x2e) AM_WRITE(hanakanz_blitter_reg_w)
AM_RANGE(0x30, 0x30) AM_WRITE(hanakanz_rombank_w)
AM_RANGE(0x31, 0x31) AM_WRITE(hanakanz_dsw_w)
@@ -2464,9 +2451,8 @@ static ADDRESS_MAP_START( hanakanz_writeport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_
AM_RANGE(0x81, 0x81) AM_WRITE(hanakanz_palette_w)
AM_RANGE(0x93, 0x93) AM_WRITE(hanakanz_coincounter_w)
AM_RANGE(0x94, 0x94) AM_WRITE(hanakanz_keyb_w)
- AM_RANGE(0xa0, 0xa0) AM_WRITE(ym2413_register_port_0_w)
- AM_RANGE(0xa1, 0xa1) AM_WRITE(ym2413_data_port_0_w)
- AM_RANGE(0xc0, 0xc0) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0xa0, 0xa1) AM_DEVWRITE(SOUND, "ym", ym2413_w)
+ AM_RANGE(0xc0, 0xc0) AM_DEVWRITE(SOUND, "oki", okim6295_w)
AM_RANGE(0xe0, 0xef) AM_DEVWRITE(MSM6242, "rtc", msm6242_w) // 6242RTC
ADDRESS_MAP_END
@@ -2478,22 +2464,21 @@ static ADDRESS_MAP_START( hkagerou_readport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_G
AM_RANGE(0xb0, 0xb0) AM_READ_PORT("SYSTEM")
AM_RANGE(0xb1, 0xb2) AM_READ(hanakanz_keyb_r)
AM_RANGE(0xb6, 0xb6) AM_READ(hanakanz_rand_r)
- AM_RANGE(0xc0, 0xc0) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0xc0, 0xc0) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0xe0, 0xef) AM_DEVREAD(MSM6242, "rtc", msm6242_r) // 6242RTC
ADDRESS_MAP_END
static ADDRESS_MAP_START( hkagerou_writeport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x2c, 0x2c) AM_WRITE(hanakanz_oki_bank_w)
+ AM_RANGE(0x2c, 0x2c) AM_DEVWRITE(SOUND, "oki", hanakanz_oki_bank_w)
AM_RANGE(0x2e, 0x2e) AM_WRITE(hanakanz_blitter_reg_w)
AM_RANGE(0x30, 0x30) AM_WRITE(hanakanz_rombank_w)
AM_RANGE(0x31, 0x31) AM_WRITE(hanakanz_dsw_w)
AM_RANGE(0x80, 0x80) AM_WRITE(hanakanz_blitter_data_w)
AM_RANGE(0x81, 0x81) AM_WRITE(hanakanz_palette_w)
- AM_RANGE(0xa0, 0xa0) AM_WRITE(ym2413_register_port_0_w)
- AM_RANGE(0xa1, 0xa1) AM_WRITE(ym2413_data_port_0_w)
+ AM_RANGE(0xa0, 0xa1) AM_DEVWRITE(SOUND, "ym", ym2413_w)
AM_RANGE(0xb3, 0xb3) AM_WRITE(hanakanz_coincounter_w)
AM_RANGE(0xb4, 0xb4) AM_WRITE(hanakanz_keyb_w)
- AM_RANGE(0xc0, 0xc0) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0xc0, 0xc0) AM_DEVWRITE(SOUND, "oki", okim6295_w)
AM_RANGE(0xe0, 0xef) AM_DEVWRITE(MSM6242, "rtc", msm6242_w) // 6242RTC
ADDRESS_MAP_END
@@ -2518,12 +2503,12 @@ static ADDRESS_MAP_START( mjreach1_readport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_G
AM_RANGE(0x93, 0x93) AM_READ(mjreach1_protection_r )
AM_RANGE(0x94, 0x94) AM_READ_PORT("SYSTEM")
AM_RANGE(0x95, 0x96) AM_READ(hanakanz_keyb_r)
- AM_RANGE(0xc0, 0xc0) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0xc0, 0xc0) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0xe0, 0xef) AM_DEVREAD(MSM6242, "rtc", msm6242_r) // 6242RTC
ADDRESS_MAP_END
static ADDRESS_MAP_START( mjreach1_writeport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x2c, 0x2c) AM_WRITE(hanakanz_oki_bank_w)
+ AM_RANGE(0x2c, 0x2c) AM_DEVWRITE(SOUND, "oki", hanakanz_oki_bank_w)
AM_RANGE(0x2e, 0x2e) AM_WRITE(hanakanz_blitter_reg_w)
AM_RANGE(0x30, 0x30) AM_WRITE(hanakanz_rombank_w)
AM_RANGE(0x31, 0x31) AM_WRITE(hanakanz_dsw_w)
@@ -2532,9 +2517,8 @@ static ADDRESS_MAP_START( mjreach1_writeport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_
AM_RANGE(0x90, 0x90) AM_WRITE(hanakanz_keyb_w)
AM_RANGE(0x93, 0x93) AM_WRITE(mjreach1_protection_w)
AM_RANGE(0x97, 0x97) AM_WRITE(hanakanz_coincounter_w)
- AM_RANGE(0xa0, 0xa0) AM_WRITE(ym2413_register_port_0_w)
- AM_RANGE(0xa1, 0xa1) AM_WRITE(ym2413_data_port_0_w)
- AM_RANGE(0xc0, 0xc0) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0xa0, 0xa1) AM_DEVWRITE(SOUND, "ym", ym2413_w)
+ AM_RANGE(0xc0, 0xc0) AM_DEVWRITE(SOUND, "oki", okim6295_w)
AM_RANGE(0xe0, 0xef) AM_DEVWRITE(MSM6242, "rtc", msm6242_w) // 6242RTC
ADDRESS_MAP_END
@@ -2632,10 +2616,10 @@ static WRITE8_HANDLER( mjchuuka_coincounter_w )
#endif
}
-static WRITE8_HANDLER( mjchuuka_oki_bank_w )
+static WRITE8_DEVICE_HANDLER( mjchuuka_oki_bank_w )
{
// data & 0x08 ?
- okim6295_set_bank_base(0, (data & 0x01) ? 0x40000 : 0);
+ okim6295_set_bank_base(device, (data & 0x01) ? 0x40000 : 0);
#ifdef MAME_DEBUG
// popmessage("1e = %02x",data);
@@ -2653,7 +2637,7 @@ static ADDRESS_MAP_START( mjchuuka_readport, ADDRESS_SPACE_IO, 8 ) // 16 bit I/O
AM_RANGE(0x62, 0x62) AM_MIRROR(0xff00) AM_READ_PORT("DSW3")
AM_RANGE(0x63, 0x63) AM_MIRROR(0xff00) AM_READ_PORT("DSW4")
AM_RANGE(0x64, 0x64) AM_MIRROR(0xff00) AM_READ_PORT("DSW5") // DSW 1-4 high bits
- AM_RANGE(0x80, 0x80) AM_MIRROR(0xff00) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x80, 0x80) AM_MIRROR(0xff00) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0xc0, 0xcf) AM_MIRROR(0xff00) AM_DEVREAD(MSM6242, "rtc", msm6242_r) // 6242RTC
ADDRESS_MAP_END
@@ -2663,13 +2647,11 @@ static ADDRESS_MAP_START( mjchuuka_writeport, ADDRESS_SPACE_IO, 8 ) // 16 bit I/
AM_RANGE(0x21, 0x21) AM_MIRROR(0xff00) AM_MASK(0xff00) AM_WRITE(mjchuuka_palette_w)
AM_RANGE(0x40, 0x40) AM_MIRROR(0xff00) AM_WRITE(mjchuuka_coincounter_w)
AM_RANGE(0x41, 0x41) AM_MIRROR(0xff00) AM_WRITE(hanakanz_keyb_w)
- AM_RANGE(0x80, 0x80) AM_MIRROR(0xff00) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0x80, 0x80) AM_MIRROR(0xff00) AM_DEVWRITE(SOUND, "oki", okim6295_w)
AM_RANGE(0xc0, 0xcf) AM_MIRROR(0xff00) AM_DEVWRITE(MSM6242, "rtc", msm6242_w) // 6242RTC
- AM_RANGE(0xa0, 0xa0) AM_MIRROR(0xff00) AM_WRITE(ym2413_register_port_0_w)
- AM_RANGE(0xa1, 0xa1) AM_MIRROR(0xff00) AM_WRITE(ym2413_data_port_0_w)
- AM_RANGE(0xe0, 0xe0) AM_MIRROR(0xff00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xe1, 0xe1) AM_MIRROR(0xff00) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x1e, 0x1e) AM_MIRROR(0xff00) AM_WRITE(mjchuuka_oki_bank_w )
+ AM_RANGE(0xa0, 0xa1) AM_MIRROR(0xff00) AM_DEVWRITE(SOUND, "ym", ym2413_w)
+ AM_RANGE(0xe0, 0xe1) AM_MIRROR(0xff00) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0x1e, 0x1e) AM_MIRROR(0xff00) AM_DEVWRITE(SOUND, "oki", mjchuuka_oki_bank_w )
ADDRESS_MAP_END
@@ -2774,8 +2756,8 @@ static ADDRESS_MAP_START( mjmyster_readport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_G
AM_RANGE(0x03, 0x03) AM_READ(rongrong_gfxrom_r)
AM_RANGE(0x22, 0x22) AM_READ(mjmyster_coins_r)
AM_RANGE(0x23, 0x23) AM_READ(mjmyster_keyb_r)
- AM_RANGE(0x40, 0x40) AM_READ(okim6295_status_0_r)
- AM_RANGE(0x44, 0x44) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0x40, 0x40) AM_DEVREAD(SOUND, "oki", okim6295_r)
+ AM_RANGE(0x44, 0x44) AM_DEVREAD(SOUND, "ay", ay8910_r)
AM_RANGE(0x60, 0x6f) AM_DEVREAD(MSM6242, "rtc", msm6242_r) // 6242RTC
AM_RANGE(0x98, 0x98) AM_READ(unk_r) // ? must be 78 on startup
AM_RANGE(0xc2, 0xc2) AM_READ(hanakanz_rand_r)
@@ -2788,11 +2770,10 @@ static ADDRESS_MAP_START( mjmyster_writeport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_
AM_RANGE(0x1e, 0x1e) AM_WRITE(mmpanic_rombank_w)
AM_RANGE(0x20, 0x20) AM_WRITE(mjmyster_select2_w)
AM_RANGE(0x21, 0x21) AM_WRITE(mjmyster_coincounter_w)
- AM_RANGE(0x40, 0x40) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0x42, 0x42) AM_WRITE(ym2413_register_port_0_w)
- AM_RANGE(0x43, 0x43) AM_WRITE(ym2413_data_port_0_w)
- AM_RANGE(0x46, 0x46) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x48, 0x48) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x40, 0x40) AM_DEVWRITE(SOUND, "oki", okim6295_w)
+ AM_RANGE(0x42, 0x43) AM_DEVWRITE(SOUND, "ym", ym2413_w)
+ AM_RANGE(0x46, 0x46) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
+ AM_RANGE(0x48, 0x48) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
AM_RANGE(0x60, 0x6f) AM_DEVWRITE(MSM6242, "rtc", msm6242_w) // 6242RTC
AM_RANGE(0x80, 0x83) AM_WRITE(ddenlovr_palette_base_w)
AM_RANGE(0x84, 0x87) AM_WRITE(ddenlovr_palette_mask_w)
@@ -2839,14 +2820,14 @@ static ADDRESS_MAP_START( hginga_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xf700, 0xf706) AM_WRITE(SMH_NOP)
ADDRESS_MAP_END
-static READ8_HANDLER( hginga_dsw_r )
+static READ8_DEVICE_HANDLER( hginga_dsw_r )
{
- if (!(ddenlovr_select & 0x01)) return input_port_read(space->machine, "DSW4");
- if (!(ddenlovr_select & 0x02)) return input_port_read(space->machine, "DSW3");
- if (!(ddenlovr_select & 0x04)) return input_port_read(space->machine, "DSW2");
- if (!(ddenlovr_select & 0x08)) return input_port_read(space->machine, "DSW1");
- if (!(ddenlovr_select & 0x10)) return input_port_read(space->machine, "DSW5");
- logerror("%06x: warning, unknown bits read, ddenlovr_select = %02x\n", cpu_get_pc(space->cpu), ddenlovr_select);
+ if (!(ddenlovr_select & 0x01)) return input_port_read(device->machine, "DSW4");
+ if (!(ddenlovr_select & 0x02)) return input_port_read(device->machine, "DSW3");
+ if (!(ddenlovr_select & 0x04)) return input_port_read(device->machine, "DSW2");
+ if (!(ddenlovr_select & 0x08)) return input_port_read(device->machine, "DSW1");
+ if (!(ddenlovr_select & 0x10)) return input_port_read(device->machine, "DSW5");
+ logerror("%s: warning, unknown bits read, ddenlovr_select = %02x\n", cpuexec_describe_context(device->machine), ddenlovr_select);
return 0xff;
}
@@ -2954,7 +2935,7 @@ static WRITE8_HANDLER( hginga_blitter_w )
static ADDRESS_MAP_START( hginga_readport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x03, 0x03) AM_READ(rongrong_gfxrom_r)
AM_RANGE(0x1c, 0x1c) AM_READ(SMH_NOP)
- AM_RANGE(0x24, 0x24) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0x24, 0x24) AM_DEVREAD(SOUND, "ay", ay8910_r)
AM_RANGE(0x60, 0x6f) AM_DEVREAD(MSM6242, "rtc", msm6242_r) // 6242RTC
AM_RANGE(0x42, 0x42) AM_READ(hginga_coins_r)
AM_RANGE(0x43, 0x43) AM_READ(hginga_input_r)
@@ -2965,10 +2946,9 @@ static ADDRESS_MAP_START( hginga_writeport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_GL
AM_RANGE(0x00, 0x01) AM_WRITE(hginga_blitter_w)
AM_RANGE(0x1c, 0x1c) AM_WRITE(mjmyster_rambank_w)
AM_RANGE(0x1e, 0x1e) AM_WRITE(hginga_rombank_w)
- AM_RANGE(0x22, 0x22) AM_WRITE(ym2413_register_port_0_w)
- AM_RANGE(0x23, 0x23) AM_WRITE(ym2413_data_port_0_w)
- AM_RANGE(0x26, 0x26) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x28, 0x28) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x22, 0x23) AM_DEVWRITE(SOUND, "ym", ym2413_w)
+ AM_RANGE(0x26, 0x26) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
+ AM_RANGE(0x28, 0x28) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
AM_RANGE(0x40, 0x40) AM_WRITE(hginga_input_w)
AM_RANGE(0x41, 0x41) AM_WRITE(hginga_coins_w)
AM_RANGE(0x60, 0x6f) AM_DEVWRITE(MSM6242, "rtc", msm6242_w) // 6242RTC
@@ -3070,8 +3050,8 @@ static ADDRESS_MAP_START( hgokou_readport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_GLO
AM_RANGE(0x20, 0x2f) AM_DEVREAD(MSM6242, "rtc", msm6242_r) // 6242RTC
AM_RANGE(0x58, 0x58) AM_READ(unk_r) // ? must be 78 on startup
AM_RANGE(0x62, 0x62) AM_READ(hgokou_input_r)
- AM_RANGE(0x80, 0x80) AM_READ(okim6295_status_0_r)
- AM_RANGE(0x84, 0x84) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0x80, 0x80) AM_DEVREAD(SOUND, "oki", okim6295_r)
+ AM_RANGE(0x84, 0x84) AM_DEVREAD(SOUND, "ay", ay8910_r)
AM_RANGE(0xb0, 0xb0) AM_READ(hanakanz_rand_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( hgokou_writeport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_GLOBAL_MASK(0xff)
@@ -3088,11 +3068,10 @@ static ADDRESS_MAP_START( hgokou_writeport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_GL
AM_RANGE(0x56, 0x56) AM_WRITE(ddenlovr_layer_enable_w)
AM_RANGE(0x60, 0x60) AM_WRITE(hginga_input_w)
AM_RANGE(0x61, 0x61) AM_WRITE(hgokou_input_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0x82, 0x82) AM_WRITE(ym2413_register_port_0_w)
- AM_RANGE(0x83, 0x83) AM_WRITE(ym2413_data_port_0_w)
- AM_RANGE(0x86, 0x86) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x88, 0x88) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x80, 0x80) AM_DEVWRITE(SOUND, "oki", okim6295_w)
+ AM_RANGE(0x82, 0x83) AM_DEVWRITE(SOUND, "ym", ym2413_w)
+ AM_RANGE(0x86, 0x86) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
+ AM_RANGE(0x88, 0x88) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
ADDRESS_MAP_END
@@ -3168,7 +3147,7 @@ static ADDRESS_MAP_START( hparadis_readport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_G
AM_RANGE(0x03, 0x03) AM_READ(rongrong_gfxrom_r)
AM_RANGE(0x1b, 0x1b) AM_READ(rongrong_blitter_busy_r)
AM_RANGE(0x1c, 0x1c) AM_READ(hparadis_dsw_r)
- AM_RANGE(0x40, 0x40) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x40, 0x40) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0x98, 0x98) AM_READ(unk_r) // ? must be 78 on startup
AM_RANGE(0xa2, 0xa3) AM_READ(hparadis_input_r)
ADDRESS_MAP_END
@@ -3176,9 +3155,8 @@ static ADDRESS_MAP_START( hparadis_writeport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_
AM_RANGE(0x00, 0x01) AM_WRITE(rongrong_blitter_w)
AM_RANGE(0x1b, 0x1b) AM_WRITE(rongrong_blitter_busy_w)
AM_RANGE(0x1e, 0x1e) AM_WRITE(hparadis_select_w)
- AM_RANGE(0x40, 0x40) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0x60, 0x60) AM_WRITE(ym2413_register_port_0_w)
- AM_RANGE(0x61, 0x61) AM_WRITE(ym2413_data_port_0_w)
+ AM_RANGE(0x40, 0x40) AM_DEVWRITE(SOUND, "oki", okim6295_w)
+ AM_RANGE(0x60, 0x61) AM_DEVWRITE(SOUND, "ym", ym2413_w)
AM_RANGE(0x80, 0x83) AM_WRITE(ddenlovr_palette_base_w)
AM_RANGE(0x84, 0x87) AM_WRITE(ddenlovr_palette_mask_w)
AM_RANGE(0x88, 0x8b) AM_WRITE(ddenlovr_transparency_pen_w)
@@ -3215,8 +3193,8 @@ static ADDRESS_MAP_START( mjmywrld_readport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_G
AM_RANGE(0x03, 0x03) AM_READ(rongrong_gfxrom_r)
AM_RANGE(0x22, 0x22) AM_READ(mjmywrld_coins_r)
AM_RANGE(0x23, 0x23) AM_READ(mjmyster_keyb_r)
- AM_RANGE(0x40, 0x40) AM_READ(okim6295_status_0_r)
- AM_RANGE(0x44, 0x44) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0x40, 0x40) AM_DEVREAD(SOUND, "oki", okim6295_r)
+ AM_RANGE(0x44, 0x44) AM_DEVREAD(SOUND, "ay", ay8910_r)
AM_RANGE(0x60, 0x6f) AM_DEVREAD(MSM6242, "rtc", msm6242_r) // 6242RTC
AM_RANGE(0x98, 0x98) AM_READ(unk_r) // ? must be 78 on startup
AM_RANGE(0xc0, 0xc0) AM_READ(hanakanz_rand_r)
@@ -3229,11 +3207,10 @@ static ADDRESS_MAP_START( mjmywrld_writeport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_
AM_RANGE(0x1e, 0x1e) AM_WRITE(hginga_rombank_w)
AM_RANGE(0x20, 0x20) AM_WRITE(mjmyster_select2_w)
AM_RANGE(0x21, 0x21) AM_WRITE(mjmyster_coincounter_w)
- AM_RANGE(0x40, 0x40) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0x42, 0x42) AM_WRITE(ym2413_register_port_0_w)
- AM_RANGE(0x43, 0x43) AM_WRITE(ym2413_data_port_0_w)
- AM_RANGE(0x46, 0x46) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x48, 0x48) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x40, 0x40) AM_DEVWRITE(SOUND, "oki", okim6295_w)
+ AM_RANGE(0x42, 0x43) AM_DEVWRITE(SOUND, "ym", ym2413_w)
+ AM_RANGE(0x46, 0x46) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
+ AM_RANGE(0x48, 0x48) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
AM_RANGE(0x60, 0x6f) AM_DEVWRITE(MSM6242, "rtc", msm6242_w) // 6242RTC
AM_RANGE(0x80, 0x83) AM_WRITE(ddenlovr_palette_base_w)
AM_RANGE(0x84, 0x87) AM_WRITE(ddenlovr_palette_mask_w)
@@ -3260,7 +3237,7 @@ static WRITE16_HANDLER( akamaru_protection1_w )
COMBINE_DATA( &akamaru_protection1 );
// BCD number?
bank = (((akamaru_protection1>>4)&0xf)%10) * 10 + ((akamaru_protection1&0xf)%10);
- okim6295_set_bank_base(0, bank * 0x40000);
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki"), bank * 0x40000);
// popmessage("bank $%0x (%d)",akamaru_protection1, bank);
}
@@ -3304,8 +3281,8 @@ static ADDRESS_MAP_START( akamaru_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xe00200, 0xe00201) AM_READ(akamaru_dsw_r) // DSW
AM_RANGE(0xe00204, 0xe00205) AM_READ(akamaru_blitter_r) // Blitter Busy & IRQ
AM_RANGE(0xe00500, 0xe0051f) AM_DEVREAD8(MSM6242, "rtc", msm6242_r, 0x00ff) // 6242RTC
- AM_RANGE(0xe00604, 0xe00605) AM_READ(ay8910_read_port_0_lsb_r)
- AM_RANGE(0xe00700, 0xe00701) AM_READ(okim6295_status_0_lsb_r) // Sound
+ AM_RANGE(0xe00604, 0xe00605) AM_DEVREAD8(SOUND, "ay", ay8910_r, 0x00ff)
+ AM_RANGE(0xe00700, 0xe00701) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff) // Sound
AM_RANGE(0xff0000, 0xffffff) AM_READ(SMH_RAM) // RAM
ADDRESS_MAP_END
@@ -3327,12 +3304,10 @@ static ADDRESS_MAP_START( akamaru_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xe00304, 0xe00307) AM_WRITE(SMH_RAM) AM_BASE( &akamaru_dsw_sel) // DSW select
AM_RANGE(0xe00308, 0xe00309) AM_WRITE(ddenlovr_coincounter_0_w) // Coin Counters
AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w) //
- AM_RANGE(0xe00400, 0xe00401) AM_WRITE(ym2413_register_port_0_lsb_w)
- AM_RANGE(0xe00402, 0xe00403) AM_WRITE(ym2413_data_port_0_lsb_w)
+ AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8(SOUND, "ym", ym2413_w, 0x00ff)
AM_RANGE(0xe00500, 0xe0051f) AM_DEVWRITE8(MSM6242, "rtc", msm6242_w, 0x00ff) // 6242RTC
- AM_RANGE(0xe00600, 0xe00601) AM_WRITE(ay8910_control_port_0_lsb_w)
- AM_RANGE(0xe00602, 0xe00603) AM_WRITE(ay8910_write_port_0_lsb_w)
- AM_RANGE(0xe00700, 0xe00701) AM_WRITE(okim6295_data_0_lsb_w)
+ AM_RANGE(0xe00600, 0xe00603) AM_DEVWRITE8(SOUND, "ay", ay8910_address_data_w, 0x00ff)
+ AM_RANGE(0xe00700, 0xe00701) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff)
AM_RANGE(0xff0000, 0xffffff) AM_WRITE(SMH_RAM) // RAM
ADDRESS_MAP_END
@@ -3347,9 +3322,9 @@ static WRITE8_HANDLER( mjflove_rombank_w )
memory_set_bankptr(space->machine, 1, &rom[0x10000 + 0x8000 * (data & 0xf)]);
}
-static WRITE8_HANDLER( mjflove_okibank_w )
+static WRITE8_DEVICE_HANDLER( mjflove_okibank_w )
{
- okim6295_set_bank_base(0, (data & 0x07) * 0x40000);
+ okim6295_set_bank_base(device, (data & 0x07) * 0x40000);
// popmessage("SOUND = %02x",data);
}
@@ -3408,7 +3383,7 @@ static ADDRESS_MAP_START( mjflove_readport, ADDRESS_SPACE_IO, 8 ) // 16 bit I/O
AM_RANGE(0x00da, 0x00da) AM_READ(mjflove_protection_r) AM_MIRROR(0xff00)
AM_RANGE(0x0100, 0x0100) AM_READ_PORT("DSW1")
AM_RANGE(0x0280, 0x028f) AM_DEVREAD(MSM6242, "rtc", msm6242_r) // 6242RTC
- AM_RANGE(0x0380, 0x0380) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x0380, 0x0380) AM_DEVREAD(SOUND, "oki", okim6295_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( mjflove_writeport, ADDRESS_SPACE_IO, 8 ) // 16 bit I/O
@@ -3423,24 +3398,22 @@ static ADDRESS_MAP_START( mjflove_writeport, ADDRESS_SPACE_IO, 8 ) // 16 bit I/O
AM_RANGE(0x0040, 0x0041) AM_WRITE(mjflove_blitter_w) AM_MIRROR(0xff00)
AM_RANGE(0x00f2, 0x00f2) AM_WRITE(mjmyster_rambank_w) AM_MIRROR(0xff00)
AM_RANGE(0x00f8, 0x00f8) AM_WRITE(mjflove_rombank_w) AM_MIRROR(0xff00)
- AM_RANGE(0x00fa, 0x00fa) AM_WRITE(mjflove_okibank_w)
+ AM_RANGE(0x00fa, 0x00fa) AM_DEVWRITE(SOUND, "oki", mjflove_okibank_w)
AM_RANGE(0x0181, 0x0181) AM_WRITE(SMH_NOP) // ? int. enable
AM_RANGE(0x0184, 0x0184) AM_WRITE(mjflove_coincounter_w)
- AM_RANGE(0x0200, 0x0200) AM_WRITE(ym2413_register_port_0_w)
- AM_RANGE(0x0201, 0x0201) AM_WRITE(ym2413_data_port_0_w)
+ AM_RANGE(0x0200, 0x0201) AM_DEVWRITE(SOUND, "ym", ym2413_w)
AM_RANGE(0x0280, 0x028f) AM_DEVWRITE(MSM6242, "rtc", msm6242_w) // 6242RTC
- AM_RANGE(0x0300, 0x0300) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x0301, 0x0301) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x0380, 0x0380) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0x0300, 0x0301) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0x0380, 0x0380) AM_DEVWRITE(SOUND, "oki", okim6295_w)
ADDRESS_MAP_END
/***************************************************************************
Mahjong Jong-Tei
***************************************************************************/
-static WRITE8_HANDLER( jongtei_okibank_w )
+static WRITE8_DEVICE_HANDLER( jongtei_okibank_w )
{
- okim6295_set_bank_base(0, ((data >> 4) & 0x07) * 0x40000);
+ okim6295_set_bank_base(device, ((data >> 4) & 0x07) * 0x40000);
}
static WRITE8_HANDLER( jongtei_dsw_keyb_w )
@@ -3461,20 +3434,19 @@ static ADDRESS_MAP_START( jongtei_readport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_GL
AM_RANGE(0x41, 0x42) AM_READ(hanakanz_keyb_r)
AM_RANGE(0x46, 0x46) AM_READ(hanakanz_rand_r)
AM_RANGE(0x63, 0x64) AM_READ(hanakanz_gfxrom_r)
- AM_RANGE(0xa0, 0xa0) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0xa0, 0xa0) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0xc0, 0xcf) AM_DEVREAD(MSM6242, "rtc", msm6242_r) // 6242RTC
ADDRESS_MAP_END
static ADDRESS_MAP_START( jongtei_writeport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x2c, 0x2c) AM_WRITE(jongtei_okibank_w)
+ AM_RANGE(0x2c, 0x2c) AM_DEVWRITE(SOUND, "oki", jongtei_okibank_w)
AM_RANGE(0x2e, 0x2e) AM_WRITE(hanakanz_blitter_reg_w)
AM_RANGE(0x30, 0x30) AM_WRITE(hanakanz_rombank_w)
AM_RANGE(0x31, 0x31) AM_WRITE(jongtei_dsw_keyb_w)
AM_RANGE(0x43, 0x43) AM_WRITE(hanakanz_coincounter_w)
AM_RANGE(0x60, 0x60) AM_WRITE(hanakanz_blitter_data_w)
AM_RANGE(0x61, 0x61) AM_WRITE(hanakanz_palette_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ym2413_register_port_0_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ym2413_data_port_0_w)
- AM_RANGE(0xa0, 0xa0) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "ym", ym2413_w)
+ AM_RANGE(0xa0, 0xa0) AM_DEVWRITE(SOUND, "oki", okim6295_w)
AM_RANGE(0xc0, 0xcf) AM_DEVWRITE(MSM6242, "rtc", msm6242_w) // 6242RTC
ADDRESS_MAP_END
@@ -6866,7 +6838,7 @@ static MACHINE_DRIVER_START( ddenlovr )
MDRV_SOUND_ADD("ym", YM2413, XTAL_28_63636MHz / 8)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
- MDRV_SOUND_ADD("ay8910", AY8910, XTAL_28_63636MHz / 16) // or /8 ?
+ MDRV_SOUND_ADD("ay", AY8910, XTAL_28_63636MHz / 16) // or /8 ?
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
MDRV_SOUND_ADD("oki", OKIM6295, XTAL_28_63636MHz / 28)
@@ -6904,10 +6876,10 @@ static const ay8910_interface quiz365_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- quiz365_input_r,
- 0,
- 0,
- ddenlovr_select_w
+ DEVCB_HANDLER(quiz365_input_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(ddenlovr_select_w)
};
static MACHINE_DRIVER_START( quiz365 )
@@ -6917,7 +6889,7 @@ static MACHINE_DRIVER_START( quiz365 )
MDRV_CPU_MODIFY("main")
MDRV_CPU_PROGRAM_MAP(quiz365_readmem,quiz365_writemem)
- MDRV_SOUND_MODIFY("ay8910")
+ MDRV_SOUND_MODIFY("ay")
MDRV_SOUND_CONFIG(quiz365_ay8910_interface)
MACHINE_DRIVER_END
@@ -7253,10 +7225,10 @@ static const ay8910_interface mjmyster_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- 0,
- 0,
- 0,
- ddenlovr_select_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(ddenlovr_select_w)
};
static MACHINE_DRIVER_START( mjmyster )
@@ -7304,8 +7276,8 @@ static const ay8910_interface hginga_ay8910_interface =
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
// A B
- hginga_dsw_r, 0, // R
- 0, ddenlovr_select_w // W
+ DEVCB_HANDLER(hginga_dsw_r), DEVCB_NULL, // R
+ DEVCB_NULL, DEVCB_HANDLER(ddenlovr_select_w) // W
};
static MACHINE_DRIVER_START( hginga )
diff --git a/src/mame/drivers/ddragon.c b/src/mame/drivers/ddragon.c
index 3e9b62bb6da..edb29f4f4c9 100644
--- a/src/mame/drivers/ddragon.c
+++ b/src/mame/drivers/ddragon.c
@@ -344,7 +344,7 @@ static WRITE8_HANDLER( ddragon2_sub_irq_w )
}
-static void irq_handler(running_machine *machine, int irq)
+static void irq_handler(const device_config *device, int irq)
{
cpu_set_input_line(snd_cpu, ym_irq , irq ? ASSERT_LINE : CLEAR_LINE );
}
@@ -429,13 +429,14 @@ static WRITE8_HANDLER( ddragon_spriteram_w )
static WRITE8_HANDLER( dd_adpcm_w )
{
- int chip = offset & 1;
+ const device_config *adpcm = devtag_get_device(space->machine, SOUND, (offset & 1) ? "adpcm2" : "adpcm1");
+ int chip = (strcmp(adpcm->tag, "adpcm1") == 0) ? 0 : 1;
switch (offset/2)
{
case 3:
adpcm_idle[chip] = 1;
- msm5205_reset_w(chip,1);
+ msm5205_reset_w(adpcm,1);
break;
case 2:
@@ -448,7 +449,7 @@ static WRITE8_HANDLER( dd_adpcm_w )
case 0:
adpcm_idle[chip] = 0;
- msm5205_reset_w(chip,0);
+ msm5205_reset_w(adpcm,0);
break;
}
}
@@ -460,11 +461,11 @@ static void dd_adpcm_int(const device_config *device)
if (adpcm_pos[chip] >= adpcm_end[chip] || adpcm_pos[chip] >= 0x10000)
{
adpcm_idle[chip] = 1;
- msm5205_reset_w(chip,1);
+ msm5205_reset_w(device,1);
}
else if (adpcm_data[chip] != -1)
{
- msm5205_data_w(chip, adpcm_data[chip] & 0x0f);
+ msm5205_data_w(device, adpcm_data[chip] & 0x0f);
adpcm_data[chip] = -1;
}
else
@@ -472,7 +473,7 @@ static void dd_adpcm_int(const device_config *device)
UINT8 *ROM = memory_region(device->machine, "adpcm") + 0x10000 * chip;
adpcm_data[chip] = ROM[adpcm_pos[chip]++];
- msm5205_data_w(chip,adpcm_data[chip] >> 4);
+ msm5205_data_w(device,adpcm_data[chip] >> 4);
}
}
@@ -585,8 +586,7 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_RAM
AM_RANGE(0x1000, 0x1000) AM_READ(soundlatch_r)
AM_RANGE(0x1800, 0x1800) AM_READ(dd_adpcm_status_r)
- AM_RANGE(0x2800, 0x2800) AM_READWRITE(ym2151_status_port_0_r, ym2151_register_port_0_w)
- AM_RANGE(0x2801, 0x2801) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x2800, 0x2801) AM_DEVREADWRITE(SOUND, "fm", ym2151_r, ym2151_w)
AM_RANGE(0x3800, 0x3807) AM_WRITE(dd_adpcm_w)
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -595,9 +595,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( dd2_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
- AM_RANGE(0x8800, 0x8800) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x8801, 0x8801) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
- AM_RANGE(0x9800, 0x9800) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x8800, 0x8801) AM_DEVREADWRITE(SOUND, "fm", ym2151_r, ym2151_w)
+ AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0xA000, 0xA000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -1109,7 +1108,7 @@ static MACHINE_DRIVER_START( ddragon2 )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("ym", YM2151, SOUND_CLOCK)
+ MDRV_SOUND_ADD("fm", YM2151, SOUND_CLOCK)
MDRV_SOUND_CONFIG(ym2151_config)
MDRV_SOUND_ROUTE(0, "mono", 0.60)
MDRV_SOUND_ROUTE(1, "mono", 0.60)
diff --git a/src/mame/drivers/ddragon3.c b/src/mame/drivers/ddragon3.c
index f6a1dd26914..99780cac46d 100644
--- a/src/mame/drivers/ddragon3.c
+++ b/src/mame/drivers/ddragon3.c
@@ -165,9 +165,9 @@ extern VIDEO_UPDATE( ctribe );
*
*************************************/
-static WRITE8_HANDLER( oki_bankswitch_w )
+static WRITE8_DEVICE_HANDLER( oki_bankswitch_w )
{
- okim6295_set_bank_base(0, (data & 1) * 0x40000);
+ okim6295_set_bank_base(device, (data & 1) * 0x40000);
}
static WRITE16_HANDLER( ddragon3_io16_w )
@@ -295,34 +295,32 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_READ(SMH_ROM)
AM_RANGE(0xc000, 0xc7ff) AM_READ(SMH_RAM)
- AM_RANGE(0xc801, 0xc801) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0xd800, 0xd800) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0xc800, 0xc801) AM_DEVREAD(SOUND, "ym2151", ym2151_r)
+ AM_RANGE(0xd800, 0xd800) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xc7ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xc800, 0xc800) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xc801, 0xc801) AM_WRITE(ym2151_data_port_0_w)
- AM_RANGE(0xd800, 0xd800) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0xe800, 0xe800) AM_WRITE(oki_bankswitch_w)
+ AM_RANGE(0xc800, 0xc801) AM_DEVWRITE(SOUND, "ym2151", ym2151_w)
+ AM_RANGE(0xd800, 0xd800) AM_DEVWRITE(SOUND, "oki", okim6295_w)
+ AM_RANGE(0xe800, 0xe800) AM_DEVWRITE(SOUND, "oki", oki_bankswitch_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( ctribe_readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM)
- AM_RANGE(0x8801, 0x8801) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0x9800, 0x9800) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x8801, 0x8801) AM_DEVREAD(SOUND, "ym2151", ym2151_status_port_r)
+ AM_RANGE(0x9800, 0x9800) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( ctribe_writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x8800, 0x8800) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x8801, 0x8801) AM_WRITE(ym2151_data_port_0_w)
- AM_RANGE(0x9800, 0x9800) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0x8800, 0x8801) AM_DEVWRITE(SOUND, "ym2151", ym2151_w)
+ AM_RANGE(0x9800, 0x9800) AM_DEVWRITE(SOUND, "oki", okim6295_w)
ADDRESS_MAP_END
/*************************************
@@ -569,9 +567,9 @@ GFXDECODE_END
*
*************************************/
-static void dd3_ymirq_handler(running_machine *machine, int irq)
+static void dd3_ymirq_handler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1], 0 , irq ? ASSERT_LINE : CLEAR_LINE );
+ cpu_set_input_line(device->machine->cpu[1], 0 , irq ? ASSERT_LINE : CLEAR_LINE );
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/ddrible.c b/src/mame/drivers/ddrible.c
index 4958ab47424..c33519deab6 100644
--- a/src/mame/drivers/ddrible.c
+++ b/src/mame/drivers/ddrible.c
@@ -91,40 +91,36 @@ static WRITE8_HANDLER( ddrible_coin_counter_w )
coin_counter_w(1,(data >> 1) & 0x01);
}
-static READ8_HANDLER( ddrible_vlm5030_busy_r )
+static READ8_DEVICE_HANDLER( ddrible_vlm5030_busy_r )
{
- return mame_rand(space->machine); /* patch */
+ return mame_rand(device->machine); /* patch */
/* FIXME: remove ? */
#if 0
- if (vlm5030_bsy()) return 1;
+ if (vlm5030_bsy(device)) return 1;
else return 0;
#endif
}
-static WRITE8_HANDLER( ddrible_vlm5030_ctrl_w )
+static WRITE8_DEVICE_HANDLER( ddrible_vlm5030_ctrl_w )
{
- UINT8 *SPEECH_ROM = memory_region(space->machine, "vlm");
+ UINT8 *SPEECH_ROM = memory_region(device->machine, "vlm");
+
/* b7 : vlm data bus OE */
/* b6 : VLM5030-RST */
/* b5 : VLM5030-ST */
/* b4 : VLM5300-VCU */
/* b3 : ROM bank select */
- if (sndti_exists(SOUND_VLM5030, 0))
- {
- vlm5030_rst( data & 0x40 ? 1 : 0 );
- vlm5030_st( data & 0x20 ? 1 : 0 );
- vlm5030_vcu( data & 0x10 ? 1 : 0 );
- vlm5030_set_rom(&SPEECH_ROM[data & 0x08 ? 0x10000 : 0]);
- }
+ vlm5030_rst( device, data & 0x40 ? 1 : 0 );
+ vlm5030_st( device, data & 0x20 ? 1 : 0 );
+ vlm5030_vcu( device, data & 0x10 ? 1 : 0 );
+ vlm5030_set_rom(device, &SPEECH_ROM[data & 0x08 ? 0x10000 : 0]);
+
/* b2 : SSG-C rc filter enable */
/* b1 : SSG-B rc filter enable */
/* b0 : SSG-A rc filter enable */
- if (sndti_exists(SOUND_FILTER_RC, 2))
- {
- filter_rc_set_RC(2,FLT_RC_LOWPASS, 1000,2200,1000,data & 0x04 ? CAP_N(150) : 0); /* YM2203-SSG-C */
- filter_rc_set_RC(1,FLT_RC_LOWPASS, 1000,2200,1000,data & 0x02 ? CAP_N(150) : 0); /* YM2203-SSG-B */
- filter_rc_set_RC(0,FLT_RC_LOWPASS, 1000,2200,1000,data & 0x01 ? CAP_N(150) : 0); /* YM2203-SSG-A */
- }
+ filter_rc_set_RC(devtag_get_device(device->machine, SOUND, "filter3"),FLT_RC_LOWPASS, 1000,2200,1000,data & 0x04 ? CAP_N(150) : 0); /* YM2203-SSG-C */
+ filter_rc_set_RC(devtag_get_device(device->machine, SOUND, "filter2"),FLT_RC_LOWPASS, 1000,2200,1000,data & 0x02 ? CAP_N(150) : 0); /* YM2203-SSG-B */
+ filter_rc_set_RC(devtag_get_device(device->machine, SOUND, "filter1"),FLT_RC_LOWPASS, 1000,2200,1000,data & 0x01 ? CAP_N(150) : 0); /* YM2203-SSG-A */
}
@@ -173,16 +169,14 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( readmem_cpu2, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_READ(SMH_RAM) /* shared RAM with CPU #1 */
- AM_RANGE(0x1000, 0x1000) AM_READ(ym2203_status_port_0_r) /* YM2203 */
- AM_RANGE(0x1001, 0x1001) AM_READ(ym2203_read_port_0_r) /* YM2203 */
+ AM_RANGE(0x1000, 0x1001) AM_DEVREAD(SOUND, "ym", ym2203_r) /* YM2203 */
AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) /* ROM */
ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem_cpu2, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_WRITE(SMH_RAM) AM_BASE(&ddrible_snd_sharedram) /* shared RAM with CPU #1 */
- AM_RANGE(0x1000, 0x1000) AM_WRITE(ym2203_control_port_0_w) /* YM2203 */
- AM_RANGE(0x1001, 0x1001) AM_WRITE(ym2203_write_port_0_w) /* YM2203 */
- AM_RANGE(0x3000, 0x3000) AM_WRITE(vlm5030_data_w) /* Speech data */
+ AM_RANGE(0x1000, 0x1001) AM_DEVWRITE(SOUND, "ym", ym2203_w) /* YM2203 */
+ AM_RANGE(0x3000, 0x3000) AM_DEVWRITE(SOUND, "vlm", vlm5030_data_w) /* Speech data */
AM_RANGE(0x8000, 0xffff) AM_WRITE(SMH_ROM) /* ROM */
ADDRESS_MAP_END
@@ -323,10 +317,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- ddrible_vlm5030_busy_r,
- ddrible_vlm5030_ctrl_w,
- NULL
+ DEVCB_NULL,
+ DEVCB_DEVICE_HANDLER(SOUND, "vlm", ddrible_vlm5030_busy_r),
+ DEVCB_DEVICE_HANDLER(SOUND, "vlm", ddrible_vlm5030_ctrl_w),
+ DEVCB_NULL
},
NULL
};
diff --git a/src/mame/drivers/dec0.c b/src/mame/drivers/dec0.c
index 7e06a7c6776..1857fdb3d7f 100644
--- a/src/mame/drivers/dec0.c
+++ b/src/mame/drivers/dec0.c
@@ -295,42 +295,18 @@ ADDRESS_MAP_END
/******************************************************************************/
-static WRITE8_HANDLER( YM3812_w )
-{
- switch (offset) {
- case 0:
- ym3812_control_port_0_w(space,0,data);
- break;
- case 1:
- ym3812_write_port_0_w(space,0,data);
- break;
- }
-}
-
-static WRITE8_HANDLER( YM2203_w )
-{
- switch (offset) {
- case 0:
- ym2203_control_port_0_w(space,0,data);
- break;
- case 1:
- ym2203_write_port_0_w(space,0,data);
- break;
- }
-}
-
static ADDRESS_MAP_START( dec0_s_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x05ff) AM_READ(SMH_RAM)
AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r)
- AM_RANGE(0x3800, 0x3800) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x3800, 0x3800) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM)
ADDRESS_MAP_END
static ADDRESS_MAP_START( dec0_s_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x05ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x0800, 0x0801) AM_WRITE(YM2203_w)
- AM_RANGE(0x1000, 0x1001) AM_WRITE(YM3812_w)
- AM_RANGE(0x3800, 0x3800) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0x0800, 0x0801) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x1000, 0x1001) AM_DEVWRITE(SOUND, "ym2", ym3812_w)
+ AM_RANGE(0x3800, 0x3800) AM_DEVWRITE(SOUND, "oki", okim6295_w)
AM_RANGE(0x8000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
@@ -338,32 +314,32 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( slyspy_s_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_READ(SMH_ROM)
AM_RANGE(0x0a0000, 0x0a0001) AM_READ(SMH_NOP) /* Protection counter */
- AM_RANGE(0x0e0000, 0x0e0001) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x0e0000, 0x0e0001) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0x0f0000, 0x0f0001) AM_READ(soundlatch_r)
AM_RANGE(0x1f0000, 0x1f1fff) AM_READ(SMH_BANK8)
ADDRESS_MAP_END
static ADDRESS_MAP_START( slyspy_s_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_WRITE(SMH_ROM)
- AM_RANGE(0x090000, 0x090001) AM_WRITE(YM3812_w)
- AM_RANGE(0x0b0000, 0x0b0001) AM_WRITE(YM2203_w)
- AM_RANGE(0x0e0000, 0x0e0001) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0x090000, 0x090001) AM_DEVWRITE(SOUND, "ym2", ym3812_w)
+ AM_RANGE(0x0b0000, 0x0b0001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x0e0000, 0x0e0001) AM_DEVWRITE(SOUND, "oki", okim6295_w)
AM_RANGE(0x1f0000, 0x1f1fff) AM_WRITE(SMH_BANK8) /* Main ram */
AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( midres_s_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_READ(SMH_ROM)
- AM_RANGE(0x130000, 0x130001) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x130000, 0x130001) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0x138000, 0x138001) AM_READ(soundlatch_r)
AM_RANGE(0x1f0000, 0x1f1fff) AM_READ(SMH_BANK8)
ADDRESS_MAP_END
static ADDRESS_MAP_START( midres_s_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_WRITE(SMH_ROM)
- AM_RANGE(0x108000, 0x108001) AM_WRITE(YM3812_w)
- AM_RANGE(0x118000, 0x118001) AM_WRITE(YM2203_w)
- AM_RANGE(0x130000, 0x130001) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0x108000, 0x108001) AM_DEVWRITE(SOUND, "ym2", ym3812_w)
+ AM_RANGE(0x118000, 0x118001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x130000, 0x130001) AM_DEVWRITE(SOUND, "oki", okim6295_w)
AM_RANGE(0x1f0000, 0x1f1fff) AM_WRITE(SMH_BANK8) /* Main ram */
AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w)
ADDRESS_MAP_END
@@ -823,14 +799,14 @@ GFXDECODE_END
/******************************************************************************/
-static void sound_irq(running_machine *machine, int linestate)
+static void sound_irq(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1],0,linestate); /* IRQ */
+ cpu_set_input_line(device->machine->cpu[1],0,linestate); /* IRQ */
}
-static void sound_irq2(running_machine *machine, int linestate)
+static void sound_irq2(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1],1,linestate); /* IRQ2 */
+ cpu_set_input_line(device->machine->cpu[1],1,linestate); /* IRQ2 */
}
static const ym3812_interface ym3812_config =
diff --git a/src/mame/drivers/dec8.c b/src/mame/drivers/dec8.c
index 4fe38ebc38e..b1da385b6f2 100644
--- a/src/mame/drivers/dec8.c
+++ b/src/mame/drivers/dec8.c
@@ -43,6 +43,7 @@ To do:
#include "cpu/m6502/m6502.h"
#include "sound/2203intf.h"
#include "sound/3812intf.h"
+#include "sound/3526intf.h"
#include "sound/msm5205.h"
#include "includes/dec8.h"
@@ -405,13 +406,13 @@ static void csilver_adpcm_int(const device_config *device)
if (toggle)
cpu_set_input_line(device->machine->cpu[2],M6502_IRQ_LINE,HOLD_LINE);
- msm5205_data_w (0,msm5205next>>4);
+ msm5205_data_w (device,msm5205next>>4);
msm5205next<<=4;
}
-static READ8_HANDLER( csilver_adpcm_reset_r )
+static READ8_DEVICE_HANDLER( csilver_adpcm_reset_r )
{
- msm5205_reset_w(0,0);
+ msm5205_reset_w(device,0);
return 0;
}
@@ -924,20 +925,16 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( dec8_s_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x05ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x2000, 0x2000) AM_WRITE(ym2203_control_port_0_w) /* OPN */
- AM_RANGE(0x2001, 0x2001) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0x4000, 0x4000) AM_WRITE(ym3812_control_port_0_w) /* OPL */
- AM_RANGE(0x4001, 0x4001) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x2000, 0x2001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x4000, 0x4001) AM_DEVWRITE(SOUND, "ym2", ym3812_w)
AM_RANGE(0x8000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
/* Used by Gondomania, Psycho-Nics Oscar & Garyo Retsuden */
static ADDRESS_MAP_START( oscar_s_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x05ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x2000, 0x2000) AM_WRITE(ym2203_control_port_0_w) /* OPN */
- AM_RANGE(0x2001, 0x2001) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0x4000, 0x4000) AM_WRITE(ym3526_control_port_0_w) /* OPL */
- AM_RANGE(0x4001, 0x4001) AM_WRITE(ym3526_write_port_0_w)
+ AM_RANGE(0x2000, 0x2001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x4000, 0x4001) AM_DEVWRITE(SOUND, "ym2", ym3526_w)
AM_RANGE(0x8000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
@@ -950,10 +947,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( ym3526_s_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x05ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x0800, 0x0800) AM_WRITE(ym2203_control_port_0_w) /* OPN */
- AM_RANGE(0x0801, 0x0801) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0x1000, 0x1000) AM_WRITE(ym3526_control_port_0_w) /* OPL? */
- AM_RANGE(0x1001, 0x1001) AM_WRITE(ym3526_write_port_0_w)
+ AM_RANGE(0x0800, 0x0801) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x1000, 0x1001) AM_DEVWRITE(SOUND, "ym2", ym3526_w)
AM_RANGE(0x8000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
@@ -961,17 +956,15 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( csilver_s_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_READ(SMH_RAM)
AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r)
- AM_RANGE(0x3400, 0x3400) AM_READ(csilver_adpcm_reset_r) /* ? not sure */
+ AM_RANGE(0x3400, 0x3400) AM_DEVREAD(SOUND, "msm", csilver_adpcm_reset_r) /* ? not sure */
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK3)
AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM)
ADDRESS_MAP_END
static ADDRESS_MAP_START( csilver_s_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x0800, 0x0800) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x0801, 0x0801) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0x1000, 0x1000) AM_WRITE(ym3526_control_port_0_w)
- AM_RANGE(0x1001, 0x1001) AM_WRITE(ym3526_write_port_0_w)
+ AM_RANGE(0x0800, 0x0801) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x1000, 0x1001) AM_DEVWRITE(SOUND, "ym2", ym3526_w)
AM_RANGE(0x1800, 0x1800) AM_WRITE(csilver_adpcm_data_w) /* ADPCM data for the MSM5205 chip */
AM_RANGE(0x2000, 0x2000) AM_WRITE(csilver_sound_bank_w)
AM_RANGE(0x4000, 0xffff) AM_WRITE(SMH_ROM)
@@ -1971,14 +1964,14 @@ GFXDECODE_END
/******************************************************************************/
/* handler called by the 3812 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1],0,linestate); /* M6502_IRQ_LINE */
+ cpu_set_input_line(device->machine->cpu[1],0,linestate); /* M6502_IRQ_LINE */
}
-static void oscar_irqhandler(running_machine *machine, int linestate)
+static void oscar_irqhandler(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[2],0,linestate); /* M6502_IRQ_LINE */
+ cpu_set_input_line(device->machine->cpu[2],0,linestate); /* M6502_IRQ_LINE */
}
static const ym3526_interface ym3526_config =
diff --git a/src/mame/drivers/deco156.c b/src/mame/drivers/deco156.c
index db00e0dd24a..ea00f82f3ca 100644
--- a/src/mame/drivers/deco156.c
+++ b/src/mame/drivers/deco156.c
@@ -152,7 +152,7 @@ static WRITE32_HANDLER(hvysmsh_eeprom_w)
{
if (ACCESSING_BITS_0_7) {
- okim6295_set_bank_base(1, 0x40000 * (data & 0x7) );
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki2"), 0x40000 * (data & 0x7) );
eeprom_set_clock_line((data & 0x20) ? ASSERT_LINE : CLEAR_LINE);
eeprom_write_bit(data & 0x10);
@@ -160,30 +160,9 @@ static WRITE32_HANDLER(hvysmsh_eeprom_w)
}
}
-static WRITE32_HANDLER( hvysmsh_oki_0_bank_w )
+static WRITE32_DEVICE_HANDLER( hvysmsh_oki_0_bank_w )
{
- okim6295_set_bank_base(0, (data & 1) * 0x40000);
-}
-
-static READ32_HANDLER(hvysmsh_oki_0_r)
-{
- return okim6295_status_0_r(space, 0);
-}
-
-static WRITE32_HANDLER(hvysmsh_oki_0_w)
-{
-// data & 0xff00 is written sometimes too. game bug or needed data?
- okim6295_data_0_w(space,0,data&0xff);
-}
-
-static READ32_HANDLER(hvysmsh_oki_1_r)
-{
- return okim6295_status_1_r(space, 0);
-}
-
-static WRITE32_HANDLER(hvysmsh_oki_1_w)
-{
- okim6295_data_1_w(space,0,data&0xff);
+ okim6295_set_bank_base(device, (data & 1) * 0x40000);
}
static WRITE32_HANDLER(wcvol95_eeprom_w)
@@ -201,20 +180,6 @@ static WRITE32_HANDLER(wcvol95_nonbuffered_palette_w)
palette_set_color_rgb(space->machine,offset,pal5bit(paletteram32[offset] >> 0),pal5bit(paletteram32[offset] >> 5),pal5bit(paletteram32[offset] >> 10));
}
-
-static READ32_HANDLER( deco156_snd_r )
-{
- return ymz280b_status_0_r(space, 0);
-}
-
-static WRITE32_HANDLER( deco156_snd_w )
-{
- if (offset)
- ymz280b_data_0_w(space, 0, data);
- else
- ymz280b_register_0_w(space, 0, data);
-}
-
/***************************************************************************/
static READ32_HANDLER( wcvol95_pf1_rowscroll_r ) { return deco16_pf1_rowscroll[offset]^0xffff0000; }
static READ32_HANDLER( wcvol95_pf2_rowscroll_r ) { return deco16_pf2_rowscroll[offset]^0xffff0000; }
@@ -235,9 +200,9 @@ static ADDRESS_MAP_START( hvysmsh_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x120000, 0x120003) AM_WRITE(SMH_NOP) // Volume control in low byte
AM_RANGE(0x120004, 0x120007) AM_WRITE(hvysmsh_eeprom_w)
AM_RANGE(0x120008, 0x12000b) AM_WRITE(SMH_NOP) // IRQ ack?
- AM_RANGE(0x12000c, 0x12000f) AM_WRITE(hvysmsh_oki_0_bank_w)
- AM_RANGE(0x140000, 0x140003) AM_READ(hvysmsh_oki_0_r) AM_WRITE(hvysmsh_oki_0_w)
- AM_RANGE(0x160000, 0x160003) AM_READ(hvysmsh_oki_1_r) AM_WRITE(hvysmsh_oki_1_w)
+ AM_RANGE(0x12000c, 0x12000f) AM_DEVWRITE(SOUND, "oki1", hvysmsh_oki_0_bank_w)
+ AM_RANGE(0x140000, 0x140003) AM_DEVREADWRITE8(SOUND, "oki1", okim6295_r, okim6295_w, 0x000000ff)
+ AM_RANGE(0x160000, 0x160003) AM_DEVREADWRITE8(SOUND, "oki2", okim6295_r, okim6295_w, 0x000000ff)
AM_RANGE(0x180000, 0x18001f) AM_READWRITE( wcvol95_pf12_control_r, wcvol95_pf12_control_w )
AM_RANGE(0x190000, 0x191fff) AM_READWRITE( wcvol95_pf1_data_r, wcvol95_pf1_data_w )
AM_RANGE(0x194000, 0x195fff) AM_READWRITE( wcvol95_pf2_data_r, wcvol95_pf2_data_w )
@@ -261,7 +226,7 @@ static ADDRESS_MAP_START( wcvol95_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x160000, 0x161fff) AM_RAM AM_BASE(&spriteram32) AM_SIZE(&spriteram_size)
AM_RANGE(0x170000, 0x170003) AM_NOP // Irq ack?
AM_RANGE(0x180000, 0x180fff) AM_READ(SMH_RAM) AM_WRITE(wcvol95_nonbuffered_palette_w) AM_BASE(&paletteram32)
- AM_RANGE(0x1a0000, 0x1a0007) AM_READ(deco156_snd_r) AM_WRITE(deco156_snd_w)
+ AM_RANGE(0x1a0000, 0x1a0007) AM_DEVREADWRITE8(SOUND, "ymz", ymz280b_r, ymz280b_w, 0x000000ff)
ADDRESS_MAP_END
@@ -390,7 +355,7 @@ GFXDECODE_END
/**********************************************************************************/
-static void sound_irq_gen(running_machine *machine, int state)
+static void sound_irq_gen(const device_config *device, int state)
{
logerror("sound irq\n");
}
diff --git a/src/mame/drivers/deco32.c b/src/mame/drivers/deco32.c
index d9626430961..7d2cc9d83f2 100644
--- a/src/mame/drivers/deco32.c
+++ b/src/mame/drivers/deco32.c
@@ -442,16 +442,6 @@ static WRITE32_HANDLER( dragngun_eeprom_w )
logerror("%08x:Write control 1 %08x %08x\n",cpu_get_pc(space->cpu),offset,data);
}
-static READ32_HANDLER(dragngun_oki_2_r)
-{
- return okim6295_status_2_r(space, 0);
-}
-
-static WRITE32_HANDLER(dragngun_oki_2_w)
-{
- okim6295_data_2_w(space, 0, data&0xff);
-}
-
/**********************************************************************************/
static int tattass_eprom_bit;
@@ -833,7 +823,7 @@ static ADDRESS_MAP_START( dragngun_readmem, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x300000, 0x3fffff) AM_READ(SMH_ROM)
- AM_RANGE(0x400000, 0x400003) AM_READ(dragngun_oki_2_r)
+ AM_RANGE(0x400000, 0x400003) AM_DEVREAD8(SOUND, "oki3", okim6295_r, 0x000000ff)
AM_RANGE(0x420000, 0x420003) AM_READ(dragngun_eeprom_r)
AM_RANGE(0x438000, 0x438003) AM_READ(dragngun_lightgun_r)
AM_RANGE(0x440000, 0x440003) AM_READ(dragngun_service_r)
@@ -873,7 +863,7 @@ static ADDRESS_MAP_START( dragngun_writemem, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x300000, 0x3fffff) AM_WRITE(SMH_ROM)
- AM_RANGE(0x400000, 0x400003) AM_WRITE(dragngun_oki_2_w)
+ AM_RANGE(0x400000, 0x400003) AM_DEVWRITE8(SOUND, "oki3", okim6295_w, 0x000000ff)
AM_RANGE(0x410000, 0x410003) AM_WRITE(SMH_NOP) /* Some kind of serial bit-stream - digital volume control? */
AM_RANGE(0x420000, 0x420003) AM_WRITE(dragngun_eeprom_w)
AM_RANGE(0x430000, 0x43001f) AM_WRITE(dragngun_lightgun_w)
@@ -913,7 +903,7 @@ static ADDRESS_MAP_START( lockload_readmem, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x300000, 0x3fffff) AM_READ(SMH_ROM)
- AM_RANGE(0x400000, 0x400003) AM_READ(dragngun_oki_2_r)
+ AM_RANGE(0x400000, 0x400003) AM_DEVREAD8(SOUND, "oki3", okim6295_r, 0x000000ff)
AM_RANGE(0x420000, 0x420003) AM_READ(dragngun_eeprom_r)
// AM_RANGE(0x438000, 0x438003) AM_READ(dragngun_lightgun_r)
AM_RANGE(0x440000, 0x440003) AM_READ(dragngun_service_r)
@@ -956,7 +946,7 @@ static ADDRESS_MAP_START( lockload_writemem, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x230000, 0x230003) AM_WRITE(dragngun_spriteram_dma_w)
AM_RANGE(0x300000, 0x3fffff) AM_WRITE(SMH_ROM)
- AM_RANGE(0x400000, 0x400003) AM_WRITE(dragngun_oki_2_w)
+ AM_RANGE(0x400000, 0x400003) AM_DEVWRITE8(SOUND, "oki3", okim6295_w, 0x000000ff)
AM_RANGE(0x420000, 0x420003) AM_WRITE(dragngun_eeprom_w)
// AM_RANGE(0x430000, 0x43001f) AM_WRITE(dragngun_lightgun_w)
AM_RANGE(0x500000, 0x500003) AM_WRITE(dragngun_sprite_control_w)
@@ -1122,7 +1112,7 @@ static WRITE8_HANDLER(deco32_bsmt_reset_w)
UINT8 diff = data ^ bsmt_reset;
bsmt_reset = data;
if ((diff & 0x80) && !(data & 0x80))
- sndti_reset(SOUND_BSMT2000, 0);
+ devtag_reset(space->machine, SOUND, "bsmt");
}
static WRITE8_HANDLER(deco32_bsmt0_w)
@@ -1130,10 +1120,10 @@ static WRITE8_HANDLER(deco32_bsmt0_w)
bsmt_latch = data;
}
-static WRITE8_HANDLER(deco32_bsmt1_w)
+static WRITE8_DEVICE_HANDLER(deco32_bsmt1_w)
{
- bsmt2000_data_0_w(space, offset^ 0xff, ((bsmt_latch<<8)|data), 0xffff);
- cpu_set_input_line(space->machine->cpu[1], M6809_IRQ_LINE, HOLD_LINE); /* BSMT is ready */
+ bsmt2000_data_w(device, offset^ 0xff, ((bsmt_latch<<8)|data), 0xffff);
+ cpu_set_input_line(device->machine->cpu[1], M6809_IRQ_LINE, HOLD_LINE); /* BSMT is ready */
}
static READ8_HANDLER(deco32_bsmt_status_r)
@@ -1143,18 +1133,18 @@ static READ8_HANDLER(deco32_bsmt_status_r)
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_READ(SMH_ROM)
- AM_RANGE(0x110000, 0x110001) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0x120000, 0x120001) AM_READ(okim6295_status_0_r)
- AM_RANGE(0x130000, 0x130001) AM_READ(okim6295_status_1_r)
+ AM_RANGE(0x110000, 0x110001) AM_DEVREAD(SOUND, "ym", ym2151_r)
+ AM_RANGE(0x120000, 0x120001) AM_DEVREAD(SOUND, "oki1", okim6295_r)
+ AM_RANGE(0x130000, 0x130001) AM_DEVREAD(SOUND, "oki2", okim6295_r)
AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
AM_RANGE(0x1f0000, 0x1f1fff) AM_READ(SMH_BANK8)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_WRITE(SMH_ROM)
- AM_RANGE(0x110000, 0x110001) AM_WRITE(ym2151_word_0_w)
- AM_RANGE(0x120000, 0x120001) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0x130000, 0x130001) AM_WRITE(okim6295_data_1_w)
+ AM_RANGE(0x110000, 0x110001) AM_DEVWRITE(SOUND, "ym", ym2151_w)
+ AM_RANGE(0x120000, 0x120001) AM_DEVWRITE(SOUND, "oki1", okim6295_w)
+ AM_RANGE(0x130000, 0x130001) AM_DEVWRITE(SOUND, "oki2", okim6295_w)
AM_RANGE(0x1f0000, 0x1f1fff) AM_WRITE(SMH_BANK8)
AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w)
AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w)
@@ -1171,7 +1161,7 @@ static ADDRESS_MAP_START( sound_writemem_tattass, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_WRITE(SMH_RAM)
AM_RANGE(0x2000, 0x2001) AM_WRITE(deco32_bsmt_reset_w)
AM_RANGE(0x6000, 0x6000) AM_WRITE(deco32_bsmt0_w)
- AM_RANGE(0xa000, 0xa0ff) AM_WRITE(deco32_bsmt1_w)
+ AM_RANGE(0xa000, 0xa0ff) AM_DEVWRITE(SOUND, "bsmt", deco32_bsmt1_w)
AM_RANGE(0x2000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
@@ -1186,10 +1176,9 @@ static READ8_HANDLER(latch_r)
static ADDRESS_MAP_START( nslasher_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
- AM_RANGE(0xa000, 0xa000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xa001, 0xa001) AM_READ(ym2151_status_port_0_r) AM_WRITE(ym2151_data_port_0_w)
- AM_RANGE(0xb000, 0xb000) AM_READ(okim6295_status_0_r) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0xc000, 0xc000) AM_READ(okim6295_status_1_r) AM_WRITE(okim6295_data_1_w)
+ AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0xb000, 0xb000) AM_DEVREADWRITE(SOUND, "oki1", okim6295_r, okim6295_w)
+ AM_RANGE(0xc000, 0xc000) AM_DEVREADWRITE(SOUND, "oki2", okim6295_r, okim6295_w)
AM_RANGE(0xd000, 0xd000) AM_READ(latch_r)
ADDRESS_MAP_END
@@ -1776,25 +1765,25 @@ GFXDECODE_END
/**********************************************************************************/
-static void sound_irq(running_machine *machine, int state)
+static void sound_irq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1],1,state); /* IRQ 2 */
+ cpu_set_input_line(device->machine->cpu[1],1,state); /* IRQ 2 */
}
-static void sound_irq_nslasher(running_machine *machine, int state)
+static void sound_irq_nslasher(const device_config *device, int state)
{
/* bit 0 of nslasher_sound_irq specifies IRQ from sound chip */
if (state)
nslasher_sound_irq |= 0x01;
else
nslasher_sound_irq &= ~0x01;
- cpu_set_input_line(machine->cpu[1], 0, (nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, (nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE);
}
-static WRITE8_HANDLER( sound_bankswitch_w )
+static WRITE8_DEVICE_HANDLER( sound_bankswitch_w )
{
- okim6295_set_bank_base(0, ((data >> 0)& 1) * 0x40000);
- okim6295_set_bank_base(1, ((data >> 1)& 1) * 0x40000);
+ okim6295_set_bank_base(devtag_get_device(device->machine, SOUND, "oki1"), ((data >> 0)& 1) * 0x40000);
+ okim6295_set_bank_base(devtag_get_device(device->machine, SOUND, "oki2"), ((data >> 1)& 1) * 0x40000);
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/deco_mlc.c b/src/mame/drivers/deco_mlc.c
index 72e6d820894..40e08ddcd3c 100644
--- a/src/mame/drivers/deco_mlc.c
+++ b/src/mame/drivers/deco_mlc.c
@@ -159,29 +159,6 @@ static WRITE32_HANDLER( avengrs_palette_w )
palette_set_color_rgb(space->machine,offset,pal5bit(paletteram32[offset] >> 0),pal5bit(paletteram32[offset] >> 5),pal5bit(paletteram32[offset] >> 10));
}
-static READ32_HANDLER( avengrs_sound_r )
-{
- if (ACCESSING_BITS_24_31) {
- return ymz280b_status_0_r(space,0)<<24;
- } else {
- logerror("%08x: non-byte read from sound mask %08x\n",cpu_get_pc(space->cpu),mem_mask);
- }
-
- return 0;
-}
-
-static WRITE32_HANDLER( avengrs_sound_w )
-{
- if (ACCESSING_BITS_24_31) {
- if (offset)
- ymz280b_data_0_w(space,0,data>>24);
- else
- ymz280b_register_0_w(space,0,data>>24);
- } else {
- logerror("%08x: non-byte written to sound %08x mask %08x\n",cpu_get_pc(space->cpu),data,mem_mask);
- }
-}
-
static READ32_HANDLER( decomlc_vbl_r )
{
static int i=0xffffffff;
@@ -301,7 +278,7 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x0300000, 0x0307fff) AM_READ(SMH_RAM) AM_MIRROR(0xff000000)
AM_RANGE(0x0400000, 0x0400003) AM_READ_PORT("INPUTS") AM_MIRROR(0xff000000)
AM_RANGE(0x0440000, 0x044001f) AM_READ(test3_r) AM_MIRROR(0xff000000)
- AM_RANGE(0x0600004, 0x0600007) AM_READ(avengrs_sound_r) AM_MIRROR(0xff000000)
+ AM_RANGE(0x0600004, 0x0600007) AM_DEVREAD8(SOUND, "ymz", ymz280b_r, 0xff000000) AM_MIRROR(0xff000000)
AM_RANGE(0x070f000, 0x070ffff) AM_READ(stadhr96_prot_146_r) AM_MIRROR(0xff000000)
ADDRESS_MAP_END
@@ -315,7 +292,7 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x0300000, 0x0307fff) AM_WRITE(avengrs_palette_w) AM_BASE(&paletteram32) AM_MIRROR(0xff000000)
AM_RANGE(0x044001c, 0x044001f) AM_WRITE(SMH_NOP) AM_MIRROR(0xff000000)
AM_RANGE(0x0500000, 0x0500003) AM_WRITE(avengrs_eprom_w) AM_MIRROR(0xff000000)
- AM_RANGE(0x0600000, 0x0600007) AM_WRITE(avengrs_sound_w) AM_MIRROR(0xff000000)
+ AM_RANGE(0x0600000, 0x0600007) AM_DEVWRITE8(SOUND, "ymz", ymz280b_w, 0xff000000) AM_MIRROR(0xff000000)
// AM_RANGE(0x070f000, 0x070ffff) AM_READ(stadhr96_prot_146_w) AM_BASE(&deco32_prot_ram)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/decocass.c b/src/mame/drivers/decocass.c
index 7d70fc3b12b..bdd45713890 100644
--- a/src/mame/drivers/decocass.c
+++ b/src/mame/drivers/decocass.c
@@ -138,10 +138,10 @@ static ADDRESS_MAP_START( decocass_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_RAM
AM_RANGE(0x1000, 0x17ff) AM_READWRITE(decocass_sound_nmi_enable_r, decocass_sound_nmi_enable_w)
AM_RANGE(0x1800, 0x1fff) AM_READWRITE(decocass_sound_data_ack_reset_r, decocass_sound_data_ack_reset_w)
- AM_RANGE(0x2000, 0x2fff) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x4000, 0x4fff) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x6000, 0x6fff) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x8000, 0x8fff) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0x2000, 0x2fff) AM_DEVWRITE(SOUND, "ay1", ay8910_data_w)
+ AM_RANGE(0x4000, 0x4fff) AM_DEVWRITE(SOUND, "ay1", ay8910_address_w)
+ AM_RANGE(0x6000, 0x6fff) AM_DEVWRITE(SOUND, "ay2", ay8910_data_w)
+ AM_RANGE(0x8000, 0x8fff) AM_DEVWRITE(SOUND, "ay2", ay8910_address_w)
AM_RANGE(0xa000, 0xafff) AM_READ(decocass_sound_command_r)
AM_RANGE(0xc000, 0xcfff) AM_WRITE(decocass_sound_data_w)
AM_RANGE(0xf800, 0xffff) AM_ROM
diff --git a/src/mame/drivers/deniam.c b/src/mame/drivers/deniam.c
index 5ec73854606..1e157127e79 100644
--- a/src/mame/drivers/deniam.c
+++ b/src/mame/drivers/deniam.c
@@ -61,37 +61,24 @@ static WRITE16_HANDLER( sound_command_w )
}
}
-static WRITE8_HANDLER( deniam16b_oki_rom_bank_w )
+static WRITE8_DEVICE_HANDLER( deniam16b_oki_rom_bank_w )
{
- okim6295_set_bank_base(0,(data & 0x40) ? 0x40000 : 0x00000);
+ okim6295_set_bank_base(device,(data & 0x40) ? 0x40000 : 0x00000);
}
-static WRITE16_HANDLER( deniam16c_oki_rom_bank_w )
+static WRITE16_DEVICE_HANDLER( deniam16c_oki_rom_bank_w )
{
if (ACCESSING_BITS_0_7)
- okim6295_set_bank_base(0,(data & 0x01) ? 0x40000 : 0x00000);
+ okim6295_set_bank_base(device,(data & 0x01) ? 0x40000 : 0x00000);
}
static MACHINE_RESET( deniam )
{
/* logicpr2 does not reset the bank base on startup */
- okim6295_set_bank_base(0,0x00000);
-}
-
-static WRITE16_HANDLER( YM3812_control_port_0_msb_w )
-{
- if (ACCESSING_BITS_8_15)
- ym3812_control_port_0_w(space,0,(data >> 8) & 0xff);
-}
-
-static WRITE16_HANDLER( YM3812_write_port_0_msb_w )
-{
- if (ACCESSING_BITS_8_15)
- ym3812_write_port_0_w(space,0,(data >> 8) & 0xff);
+ okim6295_set_bank_base(devtag_get_device(machine, SOUND, "oki"),0x00000);
}
-
static ADDRESS_MAP_START( deniam16b_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM)
AM_RANGE(0x400000, 0x40ffff) AM_READ(SMH_RAM)
@@ -130,10 +117,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x01, 0x01) AM_READ(soundlatch_r)
- AM_RANGE(0x02, 0x02) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ym3812_write_port_0_w)
- AM_RANGE(0x05, 0x05) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
- AM_RANGE(0x07, 0x07) AM_WRITE(deniam16b_oki_rom_bank_w)
+ AM_RANGE(0x02, 0x03) AM_DEVWRITE(SOUND, "ym", ym3812_w)
+ AM_RANGE(0x05, 0x05) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
+ AM_RANGE(0x07, 0x07) AM_DEVWRITE(SOUND, "oki", deniam16b_oki_rom_bank_w)
ADDRESS_MAP_END
/* identical to 16b, but handles sound directly */
@@ -141,13 +127,13 @@ static ADDRESS_MAP_START( deniam16c_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM)
AM_RANGE(0x400000, 0x40ffff) AM_READ(SMH_RAM)
AM_RANGE(0x410000, 0x410fff) AM_READ(SMH_RAM)
- AM_RANGE(0xc40000, 0xc40001) AM_READ(okim6295_status_0_lsb_r)
+ AM_RANGE(0xc40000, 0xc40001) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff)
AM_RANGE(0xc40002, 0xc40003) AM_READ(deniam_coinctrl_r)
AM_RANGE(0xc44000, 0xc44001) AM_READ_PORT("SYSTEM")
AM_RANGE(0xc44002, 0xc44003) AM_READ_PORT("P1")
AM_RANGE(0xc44004, 0xc44005) AM_READ_PORT("P2")
AM_RANGE(0xc44006, 0xc44007) AM_READ(SMH_NOP) /* unused? */
- AM_RANGE(0xc4400a, 0xc4400b) AM_READ_PORT("DSW")
+ AM_RANGE(0xc4400a, 0xc4400b) AM_READ_PORT("DSW") /* probably YM3812 input port */
AM_RANGE(0xff0000, 0xffffff) AM_READ(SMH_RAM)
ADDRESS_MAP_END
@@ -157,12 +143,11 @@ static ADDRESS_MAP_START( deniam16c_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x410000, 0x410fff) AM_WRITE(deniam_textram_w) AM_BASE(&deniam_textram)
AM_RANGE(0x440000, 0x4407ff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
AM_RANGE(0x840000, 0x840fff) AM_WRITE(deniam_palette_w) AM_BASE(&paletteram16)
- AM_RANGE(0xc40000, 0xc40001) AM_WRITE(okim6295_data_0_lsb_w)
+ AM_RANGE(0xc40000, 0xc40001) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff)
AM_RANGE(0xc40002, 0xc40003) AM_WRITE(deniam_coinctrl_w)
AM_RANGE(0xc40004, 0xc40005) AM_WRITE(SMH_NOP) /* irq ack? */
- AM_RANGE(0xc40006, 0xc40007) AM_WRITE(deniam16c_oki_rom_bank_w)
- AM_RANGE(0xc40008, 0xc40009) AM_WRITE(YM3812_control_port_0_msb_w)
- AM_RANGE(0xc4000a, 0xc4000b) AM_WRITE(YM3812_write_port_0_msb_w)
+ AM_RANGE(0xc40006, 0xc40007) AM_DEVWRITE(SOUND, "oki", deniam16c_oki_rom_bank_w)
+ AM_RANGE(0xc40008, 0xc4000b) AM_DEVWRITE8(SOUND, "ym", ym3812_w, 0xff00)
AM_RANGE(0xff0000, 0xffffff) AM_WRITE(SMH_RAM)
ADDRESS_MAP_END
@@ -260,11 +245,11 @@ static GFXDECODE_START( deniam )
GFXDECODE_END
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
/* system 16c doesn't have the sound CPU */
- if (machine->cpu[1] != NULL)
- cpu_set_input_line(machine->cpu[1],0,linestate);
+ if (device->machine->cpu[1] != NULL)
+ cpu_set_input_line(device->machine->cpu[1],0,linestate);
}
static const ym3812_interface ym3812_config =
diff --git a/src/mame/drivers/dietgo.c b/src/mame/drivers/dietgo.c
index 1613e343194..73e84be4a1d 100644
--- a/src/mame/drivers/dietgo.c
+++ b/src/mame/drivers/dietgo.c
@@ -31,24 +31,12 @@ static ADDRESS_MAP_START( dietgo_map, ADDRESS_SPACE_PROGRAM, 16 )
ADDRESS_MAP_END
-static WRITE8_HANDLER( YM2151_w )
-{
- switch (offset) {
- case 0:
- ym2151_register_port_0_w(space,0,data);
- break;
- case 1:
- ym2151_data_port_0_w(space,0,data);
- break;
- }
-}
-
/* Physical memory map (21 bits) */
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_READ(SMH_ROM)
AM_RANGE(0x100000, 0x100001) AM_READ(SMH_NOP)
- AM_RANGE(0x110000, 0x110001) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0x120000, 0x120001) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x110000, 0x110001) AM_DEVREAD(SOUND, "ym", ym2151_r)
+ AM_RANGE(0x120000, 0x120001) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0x130000, 0x130001) AM_READ(SMH_NOP) /* This board only has 1 oki chip */
AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
AM_RANGE(0x1f0000, 0x1f1fff) AM_READ(SMH_BANK8)
@@ -57,8 +45,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_WRITE(SMH_ROM)
AM_RANGE(0x100000, 0x100001) AM_WRITE(SMH_NOP) /* YM2203 - this board doesn't have one */
- AM_RANGE(0x110000, 0x110001) AM_WRITE(YM2151_w)
- AM_RANGE(0x120000, 0x120001) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0x110000, 0x110001) AM_DEVWRITE(SOUND, "ym", ym2151_w)
+ AM_RANGE(0x120000, 0x120001) AM_DEVWRITE(SOUND, "oki", okim6295_w)
AM_RANGE(0x130000, 0x130001) AM_WRITE(SMH_NOP)
AM_RANGE(0x1f0000, 0x1f1fff) AM_WRITE(SMH_BANK8)
AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w)
@@ -183,9 +171,9 @@ static GFXDECODE_START( dietgo )
GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 512, 16 ) /* Sprites (16x16) */
GFXDECODE_END
-static void sound_irq(running_machine *machine, int state)
+static void sound_irq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1],1,state); /* IRQ 2 */
+ cpu_set_input_line(device->machine->cpu[1],1,state); /* IRQ 2 */
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/discoboy.c b/src/mame/drivers/discoboy.c
index d317f46b591..32d47ced2d4 100644
--- a/src/mame/drivers/discoboy.c
+++ b/src/mame/drivers/discoboy.c
@@ -329,7 +329,7 @@ ADDRESS_MAP_END
static void splash_msm5205_int(const device_config *device)
{
- msm5205_data_w(0,adpcm_data >> 4);
+ msm5205_data_w(device,adpcm_data >> 4);
// adpcm_data = (adpcm_data << 4) & 0xf0;
}
@@ -342,8 +342,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0xf000, 0xf7ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xec00, 0xec00) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0xec01, 0xec01) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0xec00, 0xec01) AM_DEVWRITE(SOUND, "ym", ym3812_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/diverboy.c b/src/mame/drivers/diverboy.c
index 852301589fb..b332a63a15e 100644
--- a/src/mame/drivers/diverboy.c
+++ b/src/mame/drivers/diverboy.c
@@ -67,12 +67,12 @@ static WRITE16_HANDLER( soundcmd_w )
}
}
-static WRITE8_HANDLER( okibank_w )
+static WRITE8_DEVICE_HANDLER( okibank_w )
{
/* bit 2 might be reset */
// popmessage("%02x",data);
- okim6295_set_bank_base(0,(data & 3) * 0x40000);
+ okim6295_set_bank_base(device,(data & 3) * 0x40000);
}
@@ -103,15 +103,15 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( snd_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM)
- AM_RANGE(0x9800, 0x9800) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x9800, 0x9800) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( snd_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x9000, 0x9000) AM_WRITE(okibank_w)
- AM_RANGE(0x9800, 0x9800) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0x9000, 0x9000) AM_DEVWRITE(SOUND, "oki", okibank_w)
+ AM_RANGE(0x9800, 0x9800) AM_DEVWRITE(SOUND, "oki", okim6295_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/djboy.c b/src/mame/drivers/djboy.c
index 1a89d57ac3c..13e4ca7b1e6 100644
--- a/src/mame/drivers/djboy.c
+++ b/src/mame/drivers/djboy.c
@@ -785,11 +785,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( cpu2_port_am, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(cpu2_bankswitch_w)
- AM_RANGE(0x02, 0x02) AM_READ(ym2203_status_port_0_r) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x03, 0x03) AM_READ(ym2203_read_port_0_r) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0x02, 0x03) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
AM_RANGE(0x04, 0x04) AM_READ(soundlatch_r)
- AM_RANGE(0x06, 0x06) AM_READ(okim6295_status_0_r) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0x07, 0x07) AM_READ(okim6295_status_1_r) AM_WRITE(okim6295_data_1_w)
+ AM_RANGE(0x06, 0x06) AM_DEVREADWRITE(SOUND, "oki1", okim6295_r, okim6295_w)
+ AM_RANGE(0x07, 0x07) AM_DEVREADWRITE(SOUND, "oki2", okim6295_r, okim6295_w)
ADDRESS_MAP_END
/******************************************************************************/
diff --git a/src/mame/drivers/djmain.c b/src/mame/drivers/djmain.c
index 149bfee6668..d76aa5571a2 100644
--- a/src/mame/drivers/djmain.c
+++ b/src/mame/drivers/djmain.c
@@ -169,44 +169,24 @@ static WRITE32_HANDLER( sndram_w )
//---------
-static READ16_HANDLER( dual539_16_r )
+static READ16_HANDLER( dual539_r )
{
UINT16 ret = 0;
if (ACCESSING_BITS_0_7)
- ret |= k054539_1_r(space, offset);
+ ret |= k054539_r(devtag_get_device(space->machine, SOUND, "konami2"), offset);
if (ACCESSING_BITS_8_15)
- ret |= k054539_0_r(space, offset)<<8;
+ ret |= k054539_r(devtag_get_device(space->machine, SOUND, "konami1"), offset)<<8;
return ret;
}
-static WRITE16_HANDLER( dual539_16_w )
+static WRITE16_HANDLER( dual539_w )
{
if (ACCESSING_BITS_0_7)
- k054539_1_w(space, offset, data);
+ k054539_w(devtag_get_device(space->machine, SOUND, "konami2"), offset, data);
if (ACCESSING_BITS_8_15)
- k054539_0_w(space, offset, data>>8);
-}
-
-static READ32_HANDLER( dual539_r )
-{
- UINT32 data = 0;
-
- if (ACCESSING_BITS_16_31)
- data |= dual539_16_r(space, offset * 2, mem_mask >> 16) << 16;
- if (ACCESSING_BITS_0_15)
- data |= dual539_16_r(space, offset * 2 + 1, mem_mask);
-
- return data;
-}
-
-static WRITE32_HANDLER( dual539_w )
-{
- if (ACCESSING_BITS_16_31)
- dual539_16_w(space, offset * 2, data >> 16, mem_mask >> 16);
- if (ACCESSING_BITS_0_15)
- dual539_16_w(space, offset * 2 + 1, data, mem_mask);
+ k054539_w(devtag_get_device(space->machine, SOUND, "konami1"), offset, data>>8);
}
@@ -485,7 +465,7 @@ static ADDRESS_MAP_START( memory_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x580000, 0x58003f) AM_READWRITE(K056832_long_r, K056832_long_w) // VIDEO REG (tilemap)
AM_RANGE(0x590000, 0x590007) AM_WRITE(unknown590000_w) // ??
AM_RANGE(0x5a0000, 0x5a005f) AM_WRITE(K055555_long_w) // 055555: priority encoder
- AM_RANGE(0x5b0000, 0x5b04ff) AM_READWRITE(dual539_r, dual539_w) // SOUND regs
+ AM_RANGE(0x5b0000, 0x5b04ff) AM_READWRITE16(dual539_r, dual539_w, 0xffffffff) // SOUND regs
AM_RANGE(0x5c0000, 0x5c0003) AM_READ_PORT("INPUTS")
AM_RANGE(0x5c8000, 0x5c8003) AM_READ_PORT("DSW")
AM_RANGE(0x5d0000, 0x5d0003) AM_WRITE(light_ctrl_1_w) // light/coin blocker control
diff --git a/src/mame/drivers/dlair.c b/src/mame/drivers/dlair.c
index 39bfacb03e2..ac0275474e4 100644
--- a/src/mame/drivers/dlair.c
+++ b/src/mame/drivers/dlair.c
@@ -40,7 +40,6 @@
#include "machine/z80ctc.h"
#include "machine/z80sio.h"
#include "sound/ay8910.h"
-#include "sound/custom.h"
#include "sound/beep.h"
#include "dlair.lh"
@@ -210,11 +209,12 @@ static MACHINE_RESET( dlair )
static INTERRUPT_GEN( vblank_callback )
{
/* also update the speaker on the European version */
- if (sndti_exists(SOUND_BEEP, 0))
+ const device_config *beep = devtag_get_device(device->machine, SOUND, "beep");
+ if (beep != NULL)
{
const device_config *ctc = devtag_get_device(device->machine, Z80CTC, "ctc");
- beep_set_state(0, 1);
- beep_set_frequency(0, ATTOSECONDS_TO_HZ(z80ctc_getperiod(ctc, 0).attoseconds));
+ beep_set_state(beep, 1);
+ beep_set_frequency(beep, ATTOSECONDS_TO_HZ(z80ctc_getperiod(ctc, 0).attoseconds));
}
}
@@ -376,13 +376,13 @@ static WRITE8_DEVICE_HANDLER( sio_w )
static ADDRESS_MAP_START( dlus_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x9fff) AM_ROM
AM_RANGE(0xa000, 0xa7ff) AM_MIRROR(0x1800) AM_RAM
- AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x1fc7) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x1fc7) AM_DEVREAD(SOUND, "ay", ay8910_r)
AM_RANGE(0xc008, 0xc008) AM_MIRROR(0x1fc7) AM_READ_PORT("CONTROLS")
AM_RANGE(0xc010, 0xc010) AM_MIRROR(0x1fc7) AM_READ_PORT("SERVICE")
AM_RANGE(0xc020, 0xc020) AM_MIRROR(0x1fc7) AM_READ(laserdisc_r)
- AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x1fc7) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x1fc7) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
AM_RANGE(0xe008, 0xe008) AM_MIRROR(0x1fc7) AM_WRITE(misc_w)
- AM_RANGE(0xe010, 0xe010) AM_MIRROR(0x1fc7) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0xe010, 0xe010) AM_MIRROR(0x1fc7) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
AM_RANGE(0xe020, 0xe020) AM_MIRROR(0x1fc7) AM_WRITE(laserdisc_w)
AM_RANGE(0xe030, 0xe037) AM_MIRROR(0x1fc0) AM_WRITE(led_den2_w)
AM_RANGE(0xe038, 0xe03f) AM_MIRROR(0x1fc0) AM_WRITE(led_den1_w)
@@ -679,8 +679,8 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r,
- input_port_1_r
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_INPUT_PORT("DSW2")
};
@@ -712,8 +712,7 @@ static MACHINE_DRIVER_START( dlair_base )
MDRV_SOUND_CONFIG(ay8910_config)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.33)
- MDRV_SOUND_ADD("ldsound", CUSTOM, 0)
- MDRV_SOUND_CONFIG(laserdisc_custom_interface)
+ MDRV_SOUND_ADD("ldsound", LASERDISC, 0)
MDRV_SOUND_ROUTE(0, "left", 1.0)
MDRV_SOUND_ROUTE(1, "right", 1.0)
MACHINE_DRIVER_END
@@ -766,8 +765,7 @@ static MACHINE_DRIVER_START( dleuro )
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.33)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.33)
- MDRV_SOUND_ADD("laserdisc", CUSTOM, 0)
- MDRV_SOUND_CONFIG(laserdisc_custom_interface)
+ MDRV_SOUND_ADD("laserdisc", LASERDISC, 0)
MDRV_SOUND_ROUTE(0, "left", 1.0)
MDRV_SOUND_ROUTE(1, "right", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/dmndrby.c b/src/mame/drivers/dmndrby.c
index 028ad5b1284..5f60a8c20e1 100644
--- a/src/mame/drivers/dmndrby.c
+++ b/src/mame/drivers/dmndrby.c
@@ -134,8 +134,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( dderby_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_ROM
AM_RANGE(0x1000, 0x1000) AM_RAM //???
- AM_RANGE(0x4000, 0x4000) AM_READWRITE(soundlatch_r,ay8910_control_port_0_w)
- AM_RANGE(0x4001, 0x4001) AM_READWRITE(ay8910_read_port_0_r,ay8910_write_port_0_w)
+ AM_RANGE(0x4000, 0x4001) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_r)
+ AM_RANGE(0x4001, 0x4001) AM_DEVREAD(SOUND, "ay1", ay8910_r)
AM_RANGE(0x6000, 0x67ff) AM_RAM
ADDRESS_MAP_END
diff --git a/src/mame/drivers/docastle.c b/src/mame/drivers/docastle.c
index cf56db8e2ed..833d730aa25 100644
--- a/src/mame/drivers/docastle.c
+++ b/src/mame/drivers/docastle.c
@@ -173,39 +173,39 @@ static void idsoccer_adpcm_int(const device_config *device)
if (adpcm_pos >= memory_region_length(device->machine, "adpcm"))
{
adpcm_idle = 1;
- msm5205_reset_w(0, 1);
+ msm5205_reset_w(device, 1);
}
else if (adpcm_data != -1)
{
- msm5205_data_w(0, adpcm_data & 0x0f);
+ msm5205_data_w(device, adpcm_data & 0x0f);
adpcm_data = -1;
}
else
{
adpcm_data = memory_region(device->machine, "adpcm")[adpcm_pos++];
- msm5205_data_w(0, adpcm_data >> 4);
+ msm5205_data_w(device, adpcm_data >> 4);
}
}
-static READ8_HANDLER( idsoccer_adpcm_status_r )
+static READ8_DEVICE_HANDLER( idsoccer_adpcm_status_r )
{
// this is wrong, but the samples work anyway!!
adpcm_status ^= 0x80;
return adpcm_status;
}
-static WRITE8_HANDLER( idsoccer_adpcm_w )
+static WRITE8_DEVICE_HANDLER( idsoccer_adpcm_w )
{
if (data & 0x80)
{
adpcm_idle = 1;
- msm5205_reset_w(0, 1);
+ msm5205_reset_w(device, 1);
}
else
{
adpcm_pos = (data & 0x7f) * 0x200;
adpcm_idle = 0;
- msm5205_reset_w(0, 0);
+ msm5205_reset_w(device, 0);
}
}
@@ -233,10 +233,10 @@ static ADDRESS_MAP_START( docastle_map2, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xc005, 0xc005) AM_MIRROR(0x0080) AM_READ_PORT("BUTTONS")
AM_RANGE(0xc007, 0xc007) AM_MIRROR(0x0080) AM_READ_PORT("SYSTEM")
AM_RANGE(0xc084, 0xc084) AM_READWRITE(docastle_flipscreen_on_r, docastle_flipscreen_on_w)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(sn76496_0_w)
- AM_RANGE(0xe400, 0xe400) AM_WRITE(sn76496_1_w)
- AM_RANGE(0xe800, 0xe800) AM_WRITE(sn76496_2_w)
- AM_RANGE(0xec00, 0xec00) AM_WRITE(sn76496_3_w)
+ AM_RANGE(0xe000, 0xe000) AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0xe400, 0xe400) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
+ AM_RANGE(0xe800, 0xe800) AM_DEVWRITE(SOUND, "sn3", sn76496_w)
+ AM_RANGE(0xec00, 0xec00) AM_DEVWRITE(SOUND, "sn4", sn76496_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( docastle_map3, ADDRESS_SPACE_PROGRAM, 8 )
@@ -269,10 +269,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( dorunrun_map2, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
- AM_RANGE(0xa000, 0xa000) AM_WRITE(sn76496_0_w)
- AM_RANGE(0xa400, 0xa400) AM_WRITE(sn76496_1_w)
- AM_RANGE(0xa800, 0xa800) AM_WRITE(sn76496_2_w)
- AM_RANGE(0xac00, 0xac00) AM_WRITE(sn76496_3_w)
+ AM_RANGE(0xa000, 0xa000) AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0xa400, 0xa400) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
+ AM_RANGE(0xa800, 0xa800) AM_DEVWRITE(SOUND, "sn3", sn76496_w)
+ AM_RANGE(0xac00, 0xac00) AM_DEVWRITE(SOUND, "sn4", sn76496_w)
AM_RANGE(0xc001, 0xc001) AM_MIRROR(0x0080) AM_READ_PORT("DSW2")
AM_RANGE(0xc002, 0xc002) AM_MIRROR(0x0080) AM_READ_PORT("DSW1")
AM_RANGE(0xc003, 0xc003) AM_MIRROR(0x0080) AM_READ_PORT("JOYS")
@@ -293,7 +293,7 @@ static ADDRESS_MAP_START( idsoccer_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xa800, 0xa800) AM_WRITE(watchdog_reset_w)
AM_RANGE(0xb000, 0xb3ff) AM_MIRROR(0x0800) AM_RAM_WRITE(docastle_videoram_w) AM_BASE(&videoram)
AM_RANGE(0xb400, 0xb7ff) AM_MIRROR(0x0800) AM_RAM_WRITE(docastle_colorram_w) AM_BASE(&colorram)
- AM_RANGE(0xc000, 0xc000) AM_READWRITE(idsoccer_adpcm_status_r, idsoccer_adpcm_w)
+ AM_RANGE(0xc000, 0xc000) AM_DEVREADWRITE(SOUND, "msm", idsoccer_adpcm_status_r, idsoccer_adpcm_w)
AM_RANGE(0xe000, 0xe000) AM_WRITE(docastle_nmitrigger_w)
ADDRESS_MAP_END
@@ -308,10 +308,10 @@ static ADDRESS_MAP_START( idsoccer_map2, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xc005, 0xc005) AM_MIRROR(0x0080) AM_READ_PORT("BUTTONS")
AM_RANGE(0xc007, 0xc007) AM_MIRROR(0x0080) AM_READ_PORT("SYSTEM")
AM_RANGE(0xc084, 0xc084) AM_READ_PORT("JOYS_RIGHT") AM_WRITE(docastle_flipscreen_on_w)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(sn76496_0_w)
- AM_RANGE(0xe400, 0xe400) AM_WRITE(sn76496_1_w)
- AM_RANGE(0xe800, 0xe800) AM_WRITE(sn76496_2_w)
- AM_RANGE(0xec00, 0xec00) AM_WRITE(sn76496_3_w)
+ AM_RANGE(0xe000, 0xe000) AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0xe400, 0xe400) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
+ AM_RANGE(0xe800, 0xe800) AM_DEVWRITE(SOUND, "sn3", sn76496_w)
+ AM_RANGE(0xec00, 0xec00) AM_DEVWRITE(SOUND, "sn4", sn76496_w)
ADDRESS_MAP_END
/* Input Ports */
diff --git a/src/mame/drivers/dogfgt.c b/src/mame/drivers/dogfgt.c
index 23ac78f4990..97c0543a090 100644
--- a/src/mame/drivers/dogfgt.c
+++ b/src/mame/drivers/dogfgt.c
@@ -55,22 +55,11 @@ static WRITE8_HANDLER( dogfgt_soundcontrol_w )
/* bit 5 goes to 8910 #0 BDIR pin */
if ((last & 0x20) == 0x20 && (data & 0x20) == 0x00)
- {
- /* bit 4 goes to the 8910 #0 BC1 pin */
- if (last & 0x10)
- ay8910_control_port_0_w(space,0,soundlatch);
- else
- ay8910_write_port_0_w(space,0,soundlatch);
- }
+ ay8910_data_address_w(devtag_get_device(space->machine, SOUND, "ay1"), last >> 4, soundlatch);
+
/* bit 7 goes to 8910 #1 BDIR pin */
if ((last & 0x80) == 0x80 && (data & 0x80) == 0x00)
- {
- /* bit 6 goes to the 8910 #1 BC1 pin */
- if (last & 0x40)
- ay8910_control_port_1_w(space,0,soundlatch);
- else
- ay8910_write_port_1_w(space,0,soundlatch);
- }
+ ay8910_data_address_w(devtag_get_device(space->machine, SOUND, "ay2"), last >> 6, soundlatch);
last = data;
}
diff --git a/src/mame/drivers/dominob.c b/src/mame/drivers/dominob.c
index 4bbe248b30e..a231986d816 100644
--- a/src/mame/drivers/dominob.c
+++ b/src/mame/drivers/dominob.c
@@ -126,8 +126,8 @@ static ADDRESS_MAP_START( memmap, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_READWRITE(SMH_ROM, SMH_NOP) // there are some garbage writes to ROM
AM_RANGE(0xc000, 0xc7ff) AM_RAM
- AM_RANGE(0xd000, 0xd000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xd001, 0xd001) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
+ AM_RANGE(0xd000, 0xd001) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0xd001, 0xd001) AM_DEVREAD(SOUND, "ay", ay8910_r)
AM_RANGE(0xd008, 0xd008) AM_WRITE(dominob_d008_w)
AM_RANGE(0xd00c, 0xd00c) AM_READ_PORT("IN0")
AM_RANGE(0xd010, 0xd010) AM_READ_PORT("IN1") AM_WRITE(SMH_NOP)
@@ -239,10 +239,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_5_r,
- input_port_4_r,
- NULL,
- NULL
+ DEVCB_NULL,//input_port_5_r,
+ DEVCB_INPUT_PORT("DSW"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/dooyong.c b/src/mame/drivers/dooyong.c
index 75e493d2e95..cb9a6d82c5b 100644
--- a/src/mame/drivers/dooyong.c
+++ b/src/mame/drivers/dooyong.c
@@ -305,54 +305,45 @@ static ADDRESS_MAP_START( lastday_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0xc000, 0xc7ff) AM_READ(SMH_RAM)
AM_RANGE(0xc800, 0xc800) AM_READ(soundlatch_r)
- AM_RANGE(0xf000, 0xf000) AM_READ(ym2203_status_port_0_r)
- AM_RANGE(0xf001, 0xf001) AM_READ(ym2203_read_port_0_r)
- AM_RANGE(0xf002, 0xf002) AM_READ(ym2203_status_port_1_r)
- AM_RANGE(0xf003, 0xf003) AM_READ(ym2203_read_port_1_r)
+ AM_RANGE(0xf000, 0xf001) AM_DEVREAD(SOUND, "ym1", ym2203_r)
+ AM_RANGE(0xf002, 0xf003) AM_DEVREAD(SOUND, "ym1", ym2203_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( lastday_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xc7ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xf000, 0xf000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xf001, 0xf001) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0xf002, 0xf002) AM_WRITE(ym2203_control_port_1_w)
- AM_RANGE(0xf003, 0xf003) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0xf000, 0xf001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0xf002, 0xf003) AM_DEVWRITE(SOUND, "ym2", ym2203_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( pollux_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_READ(SMH_ROM)
AM_RANGE(0xf000, 0xf7ff) AM_READ(SMH_RAM)
AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r)
- AM_RANGE(0xf802, 0xf802) AM_READ(ym2203_status_port_0_r)
- AM_RANGE(0xf803, 0xf803) AM_READ(ym2203_read_port_0_r)
- AM_RANGE(0xf804, 0xf804) AM_READ(ym2203_status_port_1_r)
- AM_RANGE(0xf805, 0xf805) AM_READ(ym2203_read_port_1_r)
+ AM_RANGE(0xf802, 0xf803) AM_DEVREAD(SOUND, "ym1", ym2203_r)
+ AM_RANGE(0xf804, 0xf805) AM_DEVREAD(SOUND, "ym2", ym2203_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( pollux_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_WRITE(SMH_ROM)
AM_RANGE(0xf000, 0xf7ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xf802, 0xf802) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xf803, 0xf803) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0xf804, 0xf804) AM_WRITE(ym2203_control_port_1_w)
- AM_RANGE(0xf805, 0xf805) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0xf802, 0xf803) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0xf804, 0xf805) AM_DEVWRITE(SOUND, "ym2", ym2203_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( bluehawk_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_READ(SMH_ROM)
AM_RANGE(0xf000, 0xf7ff) AM_READ(SMH_RAM)
AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r)
- AM_RANGE(0xf809, 0xf809) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0xf80a, 0xf80a) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0xf808, 0xf809) AM_DEVREAD(SOUND, "ym", ym2151_r)
+ AM_RANGE(0xf80a, 0xf80a) AM_DEVREAD(SOUND, "oki", okim6295_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( bluehawk_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_WRITE(SMH_ROM)
AM_RANGE(0xf000, 0xf7ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xf808, 0xf808) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xf809, 0xf809) AM_WRITE(ym2151_data_port_0_w)
- AM_RANGE(0xf80a, 0xf80a) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0xf808, 0xf809) AM_DEVWRITE(SOUND, "ym", ym2151_w)
+ AM_RANGE(0xf80a, 0xf80a) AM_DEVWRITE(SOUND, "oki", okim6295_w)
ADDRESS_MAP_END
/***************************************************************************
@@ -812,12 +803,12 @@ static GFXDECODE_START( popbingo )
GFXDECODE_ENTRY( "gfx2", 0, popbingo_tilelayout, 256, 1 )
GFXDECODE_END
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
-static READ8_HANDLER( unk_r )
+static READ8_DEVICE_HANDLER( unk_r )
{
return 0;
}
@@ -827,7 +818,7 @@ static const ym2203_interface ym2203_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- unk_r, NULL, NULL, NULL
+ DEVCB_HANDLER(unk_r), DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
irqhandler
};
@@ -837,7 +828,7 @@ static const ym2203_interface ym2203_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- unk_r, NULL, NULL, NULL
+ DEVCB_HANDLER(unk_r), DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
NULL
};
diff --git a/src/mame/drivers/dragrace.c b/src/mame/drivers/dragrace.c
index 841fa8ff6f9..c15d899a63c 100644
--- a/src/mame/drivers/dragrace.c
+++ b/src/mame/drivers/dragrace.c
@@ -44,6 +44,8 @@ static MACHINE_RESET( dragrace )
static void dragrace_update_misc_flags(const address_space *space)
{
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+
/* 0x0900 = set 3SPEED1 0x00000001
* 0x0901 = set 4SPEED1 0x00000002
* 0x0902 = set 5SPEED1 0x00000004
@@ -78,21 +80,21 @@ static void dragrace_update_misc_flags(const address_space *space)
set_led_status(0, dragrace_misc_flags & 0x00008000);
set_led_status(1, dragrace_misc_flags & 0x80000000);
- discrete_sound_w(space, DRAGRACE_MOTOR1_DATA, ~dragrace_misc_flags & 0x0000001f); // Speed1 data*
- discrete_sound_w(space, DRAGRACE_EXPLODE1_EN, (dragrace_misc_flags & 0x00000020) ? 1: 0); // Explosion1 enable
- discrete_sound_w(space, DRAGRACE_SCREECH1_EN, (dragrace_misc_flags & 0x00000040) ? 1: 0); // Screech1 enable
- discrete_sound_w(space, DRAGRACE_KLEXPL1_EN, (dragrace_misc_flags & 0x00000200) ? 1: 0); // KLEXPL1 enable
- discrete_sound_w(space, DRAGRACE_MOTOR1_EN, (dragrace_misc_flags & 0x00000800) ? 1: 0); // Motor1 enable
-
- discrete_sound_w(space, DRAGRACE_MOTOR2_DATA, (~dragrace_misc_flags & 0x001f0000) >> 0x10); // Speed2 data*
- discrete_sound_w(space, DRAGRACE_EXPLODE2_EN, (dragrace_misc_flags & 0x00200000) ? 1: 0); // Explosion2 enable
- discrete_sound_w(space, DRAGRACE_SCREECH2_EN, (dragrace_misc_flags & 0x00400000) ? 1: 0); // Screech2 enable
- discrete_sound_w(space, DRAGRACE_KLEXPL2_EN, (dragrace_misc_flags & 0x02000000) ? 1: 0); // KLEXPL2 enable
- discrete_sound_w(space, DRAGRACE_MOTOR2_EN, (dragrace_misc_flags & 0x08000000) ? 1: 0); // Motor2 enable
-
- discrete_sound_w(space, DRAGRACE_ATTRACT_EN, (dragrace_misc_flags & 0x00001000) ? 1: 0); // Attract enable
- discrete_sound_w(space, DRAGRACE_LOTONE_EN, (dragrace_misc_flags & 0x00002000) ? 1: 0); // LoTone enable
- discrete_sound_w(space, DRAGRACE_HITONE_EN, (dragrace_misc_flags & 0x20000000) ? 1: 0); // HiTone enable
+ discrete_sound_w(discrete, DRAGRACE_MOTOR1_DATA, ~dragrace_misc_flags & 0x0000001f); // Speed1 data*
+ discrete_sound_w(discrete, DRAGRACE_EXPLODE1_EN, (dragrace_misc_flags & 0x00000020) ? 1: 0); // Explosion1 enable
+ discrete_sound_w(discrete, DRAGRACE_SCREECH1_EN, (dragrace_misc_flags & 0x00000040) ? 1: 0); // Screech1 enable
+ discrete_sound_w(discrete, DRAGRACE_KLEXPL1_EN, (dragrace_misc_flags & 0x00000200) ? 1: 0); // KLEXPL1 enable
+ discrete_sound_w(discrete, DRAGRACE_MOTOR1_EN, (dragrace_misc_flags & 0x00000800) ? 1: 0); // Motor1 enable
+
+ discrete_sound_w(discrete, DRAGRACE_MOTOR2_DATA, (~dragrace_misc_flags & 0x001f0000) >> 0x10); // Speed2 data*
+ discrete_sound_w(discrete, DRAGRACE_EXPLODE2_EN, (dragrace_misc_flags & 0x00200000) ? 1: 0); // Explosion2 enable
+ discrete_sound_w(discrete, DRAGRACE_SCREECH2_EN, (dragrace_misc_flags & 0x00400000) ? 1: 0); // Screech2 enable
+ discrete_sound_w(discrete, DRAGRACE_KLEXPL2_EN, (dragrace_misc_flags & 0x02000000) ? 1: 0); // KLEXPL2 enable
+ discrete_sound_w(discrete, DRAGRACE_MOTOR2_EN, (dragrace_misc_flags & 0x08000000) ? 1: 0); // Motor2 enable
+
+ discrete_sound_w(discrete, DRAGRACE_ATTRACT_EN, (dragrace_misc_flags & 0x00001000) ? 1: 0); // Attract enable
+ discrete_sound_w(discrete, DRAGRACE_LOTONE_EN, (dragrace_misc_flags & 0x00002000) ? 1: 0); // LoTone enable
+ discrete_sound_w(discrete, DRAGRACE_HITONE_EN, (dragrace_misc_flags & 0x20000000) ? 1: 0); // HiTone enable
}
static WRITE8_HANDLER( dragrace_misc_w )
diff --git a/src/mame/drivers/dreamwld.c b/src/mame/drivers/dreamwld.c
index f5e17509560..feec3e82f48 100644
--- a/src/mame/drivers/dreamwld.c
+++ b/src/mame/drivers/dreamwld.c
@@ -251,23 +251,6 @@ static WRITE32_HANDLER( dreamwld_palette_w )
palette_set_color_rgb(space->machine, color, pal5bit(dat >> 10), pal5bit(dat >> 5), pal5bit(dat >> 0));
}
-static READ32_HANDLER( dreamwld_6295_0_r )
-{
- return okim6295_status_0_r(space, 0)<<24;
-}
-
-static WRITE32_HANDLER( dreamwld_6295_0_w )
-{
- if (ACCESSING_BITS_24_31)
- {
- okim6295_data_0_w(space, 0, (data>>24) & 0xff);
- }
- else
- {
- logerror("OKI0: unk write %x mem_mask %8x\n", data, mem_mask);
- }
-}
-
static void dreamwld_oki_setbank( running_machine *machine, UINT8 chip, UINT8 bank )
{
/* 0x30000-0x3ffff is banked.
@@ -290,23 +273,6 @@ static WRITE32_HANDLER( dreamwld_6295_0_bank_w )
}
}
-static READ32_HANDLER( dreamwld_6295_1_r )
-{
- return okim6295_status_1_r(space, 0)<<24;
-}
-
-static WRITE32_HANDLER( dreamwld_6295_1_w )
-{
- if (ACCESSING_BITS_24_31)
- {
- okim6295_data_1_w(space, 0, (data>>24) & 0xff);
- }
- else
- {
- logerror("OKI1: unk write %x mem_mask %8x\n", data, mem_mask);
- }
-}
-
static WRITE32_HANDLER( dreamwld_6295_1_bank_w )
{
if (ACCESSING_BITS_0_7)
@@ -332,10 +298,10 @@ static ADDRESS_MAP_START( dreamwld_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0xc00004, 0xc00007) AM_READ_PORT("c00004")
AM_RANGE(0xc0000c, 0xc0000f) AM_WRITE( dreamwld_6295_0_bank_w ) // sfx
- AM_RANGE(0xc00018, 0xc0001b) AM_READWRITE( dreamwld_6295_0_r, dreamwld_6295_0_w) // sfx
+ AM_RANGE(0xc00018, 0xc0001b) AM_DEVREADWRITE8( SOUND, "oki1", okim6295_r, okim6295_w, 0xff000000 ) // sfx
AM_RANGE(0xc0002c, 0xc0002f) AM_WRITE( dreamwld_6295_1_bank_w ) // sfx
- AM_RANGE(0xc00028, 0xc0002b) AM_READWRITE( dreamwld_6295_1_r, dreamwld_6295_1_w) // sfx
+ AM_RANGE(0xc00028, 0xc0002b) AM_DEVREADWRITE8( SOUND, "oki2", okim6295_r, okim6295_w, 0xff000000 ) // sfx
AM_RANGE(0xc00030, 0xc00033) AM_READ(dreamwld_protdata_r) // it reads protection data (irq code) from here and puts it at ffd000
diff --git a/src/mame/drivers/drgnmst.c b/src/mame/drivers/drgnmst.c
index f450dc4fb76..9b9be662725 100644
--- a/src/mame/drivers/drgnmst.c
+++ b/src/mame/drivers/drgnmst.c
@@ -91,8 +91,8 @@ static READ8_HANDLER( drgnmst_snd_command_r )
switch (drgnmst_oki_control & 0x1f)
{
- case 0x12: data = (okim6295_status_1_r(space, 0) & 0x0f); break;
- case 0x16: data = (okim6295_status_0_r(space, 0) & 0x0f); break;
+ case 0x12: data = (okim6295_r(devtag_get_device(space->machine, SOUND, "oki2"), 0) & 0x0f); break;
+ case 0x16: data = (okim6295_r(devtag_get_device(space->machine, SOUND, "oki1"), 0) & 0x0f); break;
case 0x0b:
case 0x0f: data = drgnmst_snd_command; break;
default: break;
@@ -159,12 +159,12 @@ static WRITE8_HANDLER( drgnmst_snd_control_w )
if (oki_new_bank != drgnmst_oki0_bank) {
drgnmst_oki0_bank = oki_new_bank;
if (drgnmst_oki0_bank) oki_new_bank--;
- okim6295_set_bank_base(0, (oki_new_bank * 0x40000));
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki1"), (oki_new_bank * 0x40000));
}
oki_new_bank = ((pic16c5x_port0 & 0x3) >> 0) | ((drgnmst_oki_control & 0x20) >> 3);
if (oki_new_bank != drgnmst_oki1_bank) {
drgnmst_oki1_bank = oki_new_bank;
- okim6295_set_bank_base(1, (oki_new_bank * 0x40000));
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki2"), (oki_new_bank * 0x40000));
}
switch(drgnmst_oki_control & 0x1f)
@@ -172,12 +172,12 @@ static WRITE8_HANDLER( drgnmst_snd_control_w )
case 0x11:
// logerror("Writing %02x to OKI1",drgnmst_oki_command);
// logerror(", PortC=%02x, Code=%02x, Bank0=%01x, Bank1=%01x\n",drgnmst_oki_control,drgnmst_snd_command,drgnmst_oki0_bank,drgnmst_oki1_bank);
- okim6295_data_1_w(space, 0, drgnmst_oki_command);
+ okim6295_w(devtag_get_device(space->machine, SOUND, "oki2"), 0, drgnmst_oki_command);
break;
case 0x15:
// logerror("Writing %02x to OKI0",drgnmst_oki_command);
// logerror(", PortC=%02x, Code=%02x, Bank0=%01x, Bank1=%01x\n",drgnmst_oki_control,drgnmst_snd_command,drgnmst_oki0_bank,drgnmst_oki1_bank);
- okim6295_data_0_w(space, 0, drgnmst_oki_command);
+ okim6295_w(devtag_get_device(space->machine, SOUND, "oki1"), 0, drgnmst_oki_command);
break;
default: break;
}
diff --git a/src/mame/drivers/drmicro.c b/src/mame/drivers/drmicro.c
index ed880c7f12a..838b3d27424 100644
--- a/src/mame/drivers/drmicro.c
+++ b/src/mame/drivers/drmicro.c
@@ -57,19 +57,19 @@ static void pcm_w(const device_config *device)
if (~pcm_adr & 1)
data >>= 4;
- msm5205_data_w(0, data & 0x0f);
- msm5205_reset_w(0, 0);
+ msm5205_data_w(device, data & 0x0f);
+ msm5205_reset_w(device, 0);
pcm_adr = (pcm_adr + 1) & 0x7fff;
}
else
- msm5205_reset_w(0, 1);
+ msm5205_reset_w(device, 1);
}
static WRITE8_HANDLER( pcm_set_w )
{
pcm_adr = ((data & 0x3f) << 9);
- pcm_w(space->cpu /* wrong -- should be msm device */);
+ pcm_w(devtag_get_device(space->machine, SOUND, "msm"));
}
/****************************************************************************/
@@ -90,9 +90,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READ_PORT("P1") AM_WRITE(sn76496_0_w)
- AM_RANGE(0x01, 0x01) AM_READ_PORT("P2") AM_WRITE(sn76496_1_w)
- AM_RANGE(0x02, 0x02) AM_WRITE(sn76496_2_w)
+ AM_RANGE(0x00, 0x00) AM_READ_PORT("P1") AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0x01, 0x01) AM_READ_PORT("P2") AM_DEVWRITE(SOUND, "sn2", sn76496_w)
+ AM_RANGE(0x02, 0x02) AM_DEVWRITE(SOUND, "sn3", sn76496_w)
AM_RANGE(0x03, 0x03) AM_READ_PORT("DSW1") AM_WRITE(pcm_set_w)
AM_RANGE(0x04, 0x04) AM_READ_PORT("DSW2") AM_WRITE(nmi_enable_w)
AM_RANGE(0x05, 0x05) AM_READWRITE(SMH_NOP, SMH_NOP) // unused? / watchdog?
diff --git a/src/mame/drivers/drtomy.c b/src/mame/drivers/drtomy.c
index cc567e2c243..2afee9f453a 100644
--- a/src/mame/drivers/drtomy.c
+++ b/src/mame/drivers/drtomy.c
@@ -118,14 +118,14 @@ static WRITE16_HANDLER( drtomy_vram_bg_w )
tilemap_mark_tile_dirty(tilemap_bg,offset);
}
-static WRITE16_HANDLER( drtomy_okibank_w )
+static WRITE16_DEVICE_HANDLER( drtomy_okibank_w )
{
static int oki_bank;
if(oki_bank != (data & 3))
{
oki_bank = data & 3;
- okim6295_set_bank_base(0, oki_bank * 0x40000);
+ okim6295_set_bank_base(device, oki_bank * 0x40000);
}
/* unknown bit 2 -> (data & 4) */
@@ -141,8 +141,8 @@ static ADDRESS_MAP_START( drtomy_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW2")
AM_RANGE(0x700004, 0x700005) AM_READ_PORT("P1")
AM_RANGE(0x700006, 0x700007) AM_READ_PORT("P2")
- AM_RANGE(0x70000c, 0x70000d) AM_WRITE(drtomy_okibank_w) /* OKI banking */
- AM_RANGE(0x70000e, 0x70000f) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w) /* OKI 6295*/
+ AM_RANGE(0x70000c, 0x70000d) AM_DEVWRITE(SOUND, "oki", drtomy_okibank_w) /* OKI banking */
+ AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff) /* OKI 6295*/
AM_RANGE(0xffc000, 0xffffff) AM_RAM /* Work RAM */
ADDRESS_MAP_END
diff --git a/src/mame/drivers/drw80pkr.c b/src/mame/drivers/drw80pkr.c
index d5c3af27c10..bd04f9625a6 100644
--- a/src/mame/drivers/drw80pkr.c
+++ b/src/mame/drivers/drw80pkr.c
@@ -119,13 +119,13 @@ static WRITE8_HANDLER( drw80pkr_io_w )
tilemap_mark_tile_dirty(bg_tilemap, n_offs);
}
- // ay8910_control_port_0_w
+ // ay8910 control port
if (p1 == 0xfc && p2 == 0xff && offset == 0x00)
- ay8910_control_port_0_w(space, 0, data);
+ ay8910_address_w(devtag_get_device(space->machine, SOUND, "ay"), 0, data);
// ay8910_write_port_0_w
if (p1 == 0xfe && p2 == 0xff && offset == 0x00)
- ay8910_write_port_0_w(space, 1, data);
+ ay8910_data_w(devtag_get_device(space->machine, SOUND, "ay"), 0, data);
// CRTC Register
// R0 = 0x1f(31) Horizontal Total
@@ -329,8 +329,9 @@ static MACHINE_DRIVER_START( drw80pkr )
MDRV_VIDEO_UPDATE(drw80pkr)
// sound hardware
- MDRV_SOUND_ADD("ay", AY8912, 20000000/12)
MDRV_SPEAKER_STANDARD_MONO("mono")
+
+ MDRV_SOUND_ADD("ay", AY8912, 20000000/12)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/dunhuang.c b/src/mame/drivers/dunhuang.c
index 6cda5148e3b..33f988e99bd 100644
--- a/src/mame/drivers/dunhuang.c
+++ b/src/mame/drivers/dunhuang.c
@@ -351,14 +351,14 @@ static READ8_HANDLER( dunhuang_service_r )
;
}
-static READ8_HANDLER( dunhuang_dsw_r )
+static READ8_DEVICE_HANDLER( dunhuang_dsw_r )
{
- if (!(dunhuang_input & 0x01)) return input_port_read(space->machine, "DSW1");
- if (!(dunhuang_input & 0x02)) return input_port_read(space->machine, "DSW2");
- if (!(dunhuang_input & 0x04)) return input_port_read(space->machine, "DSW3");
- if (!(dunhuang_input & 0x08)) return input_port_read(space->machine, "DSW4");
- if (!(dunhuang_input & 0x10)) return input_port_read(space->machine, "DSW5");
- logerror("%06x: warning, unknown dsw bits read, dunhuang_input = %02x\n", cpu_get_pc(space->cpu), dunhuang_input);
+ if (!(dunhuang_input & 0x01)) return input_port_read(device->machine, "DSW1");
+ if (!(dunhuang_input & 0x02)) return input_port_read(device->machine, "DSW2");
+ if (!(dunhuang_input & 0x04)) return input_port_read(device->machine, "DSW3");
+ if (!(dunhuang_input & 0x08)) return input_port_read(device->machine, "DSW4");
+ if (!(dunhuang_input & 0x10)) return input_port_read(device->machine, "DSW5");
+ logerror("%s: warning, unknown dsw bits read, dunhuang_input = %02x\n", cpuexec_describe_context(device->machine), dunhuang_input);
return 0xff;
}
static READ8_HANDLER( dunhuang_input_r )
@@ -368,7 +368,7 @@ static READ8_HANDLER( dunhuang_input_r )
if (!(dunhuang_input & 0x04)) return input_port_read(space->machine, "IN2");
if (!(dunhuang_input & 0x08)) return input_port_read(space->machine, "IN3");
if (!(dunhuang_input & 0x10)) return input_port_read(space->machine, "IN4");
- logerror("%06x: warning, unknown input bits read, dunhuang_input = %02x\n", cpu_get_pc(space->cpu), dunhuang_input);
+ logerror("%s: warning, unknown input bits read, dunhuang_input = %02x\n", cpuexec_describe_context(space->machine), dunhuang_input);
return 0xff;
}
@@ -417,8 +417,8 @@ static ADDRESS_MAP_START( dunhuang_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE( 0x001b, 0x001b ) AM_WRITE( dunhuang_block_dest_w )
- AM_RANGE( 0x0081, 0x0081 ) AM_WRITE( ym2413_register_port_0_w )
- AM_RANGE( 0x0089, 0x0089 ) AM_WRITE( ym2413_data_port_0_w )
+ AM_RANGE( 0x0081, 0x0081 ) AM_DEVWRITE( SOUND, "ym", ym2413_register_port_w )
+ AM_RANGE( 0x0089, 0x0089 ) AM_DEVWRITE( SOUND, "ym", ym2413_data_port_w )
// AM_RANGE( 0x0082, 0x0082 ) AM_WRITE( dunhuang_82_w )
@@ -431,9 +431,9 @@ static ADDRESS_MAP_START( dunhuang_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE( 0x0086, 0x0086 ) AM_WRITE( dunhuang_rombank_w )
AM_RANGE( 0x0087, 0x0087 ) AM_WRITE( dunhuang_layers_w )
- AM_RANGE( 0x0088, 0x0088 ) AM_READ( ay8910_read_port_0_r )
- AM_RANGE( 0x0090, 0x0090 ) AM_WRITE( ay8910_write_port_0_w )
- AM_RANGE( 0x0098, 0x0098 ) AM_WRITE( ay8910_control_port_0_w )
+ AM_RANGE( 0x0088, 0x0088 ) AM_DEVREAD( SOUND, "ay8910", ay8910_r )
+ AM_RANGE( 0x0090, 0x0090 ) AM_DEVWRITE( SOUND, "ay8910", ay8910_data_w )
+ AM_RANGE( 0x0098, 0x0098 ) AM_DEVWRITE( SOUND, "ay8910", ay8910_address_w )
ADDRESS_MAP_END
@@ -669,8 +669,8 @@ static const ay8910_interface dunhuang_ay8910_interface =
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
// A B
- NULL, dunhuang_dsw_r, // R
- dunhuang_input_w, NULL // W
+ DEVCB_NULL, DEVCB_HANDLER(dunhuang_dsw_r), // R
+ DEVCB_MEMORY_HANDLER("main", PROGRAM, dunhuang_input_w), DEVCB_NULL // W
};
static MACHINE_DRIVER_START( dunhuang )
diff --git a/src/mame/drivers/dwarfd.c b/src/mame/drivers/dwarfd.c
index 76af6d584c2..2c8b50cd987 100644
--- a/src/mame/drivers/dwarfd.c
+++ b/src/mame/drivers/dwarfd.c
@@ -365,9 +365,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x01, 0x01) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x02, 0x02) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x01, 0x01) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x02, 0x03) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
AM_RANGE(0x20, 0x20) AM_READWRITE(i8275_preg_r, i8275_preg_w)
AM_RANGE(0x21, 0x21) AM_READWRITE(i8275_sreg_r, i8275_creg_w)
@@ -687,10 +686,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_3_r,
- input_port_2_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("IN2"),
+ DEVCB_INPUT_PORT("IN1"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/dynadice.c b/src/mame/drivers/dynadice.c
index 0b9ad5ea1f3..1eb924c43b8 100644
--- a/src/mame/drivers/dynadice.c
+++ b/src/mame/drivers/dynadice.c
@@ -51,7 +51,7 @@ static WRITE8_HANDLER( sound_data_w )
ay_data = data;
}
-static WRITE8_HANDLER( sound_control_w )
+static WRITE8_DEVICE_HANDLER( sound_control_w )
{
/*
AY 3-8910 :
@@ -62,8 +62,8 @@ static WRITE8_HANDLER( sound_control_w )
D3 - /Reset
*/
- if ((data &7)==7) ay8910_control_port_0_w(space,0,ay_data);
- if ((data &7)==6) ay8910_write_port_0_w(space,0,ay_data);
+ if ((data &7)==7) ay8910_address_w(device,0,ay_data);
+ if ((data &7)==6) ay8910_data_w(device,0,ay_data);
}
@@ -92,7 +92,7 @@ static ADDRESS_MAP_START( dynadice_sound_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r)
AM_RANGE(0x01, 0x01) AM_WRITE(soundlatch_clear_w)
AM_RANGE(0x02, 0x02) AM_WRITE(sound_data_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(sound_control_w)
+ AM_RANGE(0x03, 0x03) AM_DEVWRITE(SOUND, "ay", sound_control_w)
ADDRESS_MAP_END
static INPUT_PORTS_START( dynadice )
diff --git a/src/mame/drivers/dynax.c b/src/mame/drivers/dynax.c
index 7d3e064f282..4c6e8802285 100644
--- a/src/mame/drivers/dynax.c
+++ b/src/mame/drivers/dynax.c
@@ -126,10 +126,10 @@ static INTERRUPT_GEN( sprtmtch_vblank_interrupt )
sprtmtch_update_irq(device->machine);
}
-static void sprtmtch_sound_callback(running_machine *machine, int state)
+static void sprtmtch_sound_callback(const device_config *device, int state)
{
dynax_sound_irq = state;
- sprtmtch_update_irq(machine);
+ sprtmtch_update_irq(device->machine);
}
@@ -200,10 +200,10 @@ static WRITE8_HANDLER( jantouki_sound_vblank_ack_w )
jantouki_sound_update_irq(space->machine);
}
-static void jantouki_sound_callback(running_machine *machine, int state)
+static void jantouki_sound_callback(const device_config *device, int state)
{
dynax_sound_irq = state;
- jantouki_sound_update_irq(machine);
+ jantouki_sound_update_irq(device->machine);
}
@@ -401,7 +401,7 @@ static void adpcm_int(const device_config *device)
{
static int toggle;
- msm5205_data_w(0,msm5205next >> 4);
+ msm5205_data_w(device,msm5205next >> 4);
msm5205next<<=4;
toggle = 1 - toggle;
@@ -415,7 +415,7 @@ static void adpcm_int_cpu1(const device_config *device)
{
static int toggle;
- msm5205_data_w(0,msm5205next >> 4);
+ msm5205_data_w(device,msm5205next >> 4);
msm5205next<<=4;
toggle = 1 - toggle;
@@ -432,17 +432,17 @@ static WRITE8_HANDLER( adpcm_data_w )
msm5205next = data;
}
-static WRITE8_HANDLER( adpcm_reset_w )
+static WRITE8_DEVICE_HANDLER( adpcm_reset_w )
{
resetkludge = data & 1;
- msm5205_reset_w(0,~data & 1);
+ msm5205_reset_w(device,~data & 1);
}
static MACHINE_RESET( adpcm )
{
/* start with the MSM5205 reset */
resetkludge = 0;
- msm5205_reset_w(0,1);
+ msm5205_reset_w(devtag_get_device(machine, SOUND, "msm"),1);
}
static WRITE8_HANDLER( yarunara_layer_half_w )
@@ -532,17 +532,15 @@ static ADDRESS_MAP_START( hanamai_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE( 0x6c, 0x6c ) AM_WRITE ( dynax_blit_palette01_w ) // Layers Palettes (Low Bits)
AM_RANGE( 0x6d, 0x6d ) AM_WRITE ( dynax_blit_palette23_w ) //
AM_RANGE( 0x6e, 0x6e ) AM_WRITE ( dynax_blit_backpen_w ) // Background Color
- AM_RANGE( 0x70, 0x70 ) AM_WRITE ( adpcm_reset_w ) // MSM5205 reset
+ AM_RANGE( 0x70, 0x70 ) AM_DEVWRITE ( SOUND, "msm", adpcm_reset_w) // MSM5205 reset
AM_RANGE( 0x71, 0x71 ) AM_WRITE ( dynax_flipscreen_w ) // Flip Screen
AM_RANGE( 0x72, 0x72 ) AM_WRITE ( dynax_coincounter_0_w ) // Coin Counters
AM_RANGE( 0x73, 0x73 ) AM_WRITE ( dynax_coincounter_1_w ) //
AM_RANGE( 0x74, 0x74 ) AM_WRITE ( dynax_blitter_ack_w ) // Blitter IRQ Ack
AM_RANGE( 0x76, 0x76 ) AM_WRITE ( dynax_blit_palbank_w ) // Layers Palettes (High Bit)
AM_RANGE( 0x77, 0x77 ) AM_WRITE ( hanamai_layer_half_w ) // half of the interleaved layer to write to
- AM_RANGE( 0x78, 0x78 ) AM_READWRITE ( ym2203_status_port_0_r, ym2203_control_port_0_w ) // YM2203
- AM_RANGE( 0x79, 0x79 ) AM_READWRITE ( ym2203_read_port_0_r, ym2203_write_port_0_w ) // 2 x DSW
- AM_RANGE( 0x7a, 0x7a ) AM_WRITE ( ay8910_control_port_0_w ) // AY8910
- AM_RANGE( 0x7b, 0x7b ) AM_WRITE ( ay8910_write_port_0_w ) //
+ AM_RANGE( 0x78, 0x79 ) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w ) // 2 x DSW
+ AM_RANGE( 0x7a, 0x7b ) AM_DEVWRITE ( SOUND, "ay", ay8910_address_data_w ) // AY8910
// AM_RANGE( 0x7c, 0x7c ) AM_WRITE ( SMH_NOP ) // CRT Controller
// AM_RANGE( 0x7d, 0x7d ) AM_WRITE ( SMH_NOP ) //
AM_RANGE( 0x7e, 0x7e ) AM_WRITE ( dynax_blit_romregion_w ) // Blitter ROM bank
@@ -561,13 +559,12 @@ static ADDRESS_MAP_START( hnoridur_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE( 0x24, 0x24 ) AM_READ_PORT ( "DSW1" ) // DSW2
AM_RANGE( 0x25, 0x25 ) AM_READ_PORT ( "DSW3" ) // DSW4
AM_RANGE( 0x26, 0x26 ) AM_READ_PORT ( "DSW2" ) // DSW3
- AM_RANGE( 0x30, 0x30 ) AM_WRITE ( adpcm_reset_w ) // MSM5205 reset
+ AM_RANGE( 0x30, 0x30 ) AM_DEVWRITE ( SOUND, "msm", adpcm_reset_w ) // MSM5205 reset
AM_RANGE( 0x32, 0x32 ) AM_WRITE ( adpcm_data_w ) // MSM5205 data
- AM_RANGE( 0x34, 0x34 ) AM_WRITE ( ym2413_register_port_0_w ) // YM2413
- AM_RANGE( 0x35, 0x35 ) AM_WRITE ( ym2413_data_port_0_w ) //
- AM_RANGE( 0x36, 0x36 ) AM_READ ( ay8910_read_port_0_r ) // AY8910, DSW1
- AM_RANGE( 0x38, 0x38 ) AM_WRITE ( ay8910_write_port_0_w ) // AY8910
- AM_RANGE( 0x3a, 0x3a ) AM_WRITE ( ay8910_control_port_0_w ) //
+ AM_RANGE( 0x34, 0x35 ) AM_DEVWRITE( SOUND, "ym", ym2413_w ) //
+ AM_RANGE( 0x36, 0x36 ) AM_DEVREAD ( SOUND, "ay", ay8910_r ) // AY8910, DSW1
+ AM_RANGE( 0x38, 0x38 ) AM_DEVWRITE ( SOUND, "ay", ay8910_data_w ) // AY8910
+ AM_RANGE( 0x3a, 0x3a ) AM_DEVWRITE ( SOUND, "ay", ay8910_address_w ) //
AM_RANGE( 0x40, 0x40 ) AM_WRITE ( dynax_blit_pen_w ) // Destination Pen
AM_RANGE( 0x41, 0x41 ) AM_WRITE ( dynax_blit_dest_w ) // Destination Layer
AM_RANGE( 0x42, 0x42 ) AM_WRITE ( dynax_blit_palette01_w ) // Layers Palettes
@@ -688,12 +685,11 @@ static ADDRESS_MAP_START( yarunara_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE( 0x00, 0x01 ) AM_WRITE ( yarunara_input_w ) // Controls
AM_RANGE( 0x02, 0x03 ) AM_READ ( yarunara_input_r ) //
AM_RANGE( 0x11, 0x17 ) AM_WRITE ( dynax_blitter_rev2_w ) // Blitter
- AM_RANGE( 0x20, 0x20 ) AM_WRITE ( adpcm_reset_w ) // MSM5205 reset
+ AM_RANGE( 0x20, 0x20 ) AM_DEVWRITE ( SOUND, "msm", adpcm_reset_w ) // MSM5205 reset
AM_RANGE( 0x22, 0x22 ) AM_WRITE ( adpcm_data_w ) // MSM5205 data
- AM_RANGE( 0x24, 0x24 ) AM_WRITE ( ym2413_register_port_0_w ) // YM2413
- AM_RANGE( 0x25, 0x25 ) AM_WRITE ( ym2413_data_port_0_w ) //
- AM_RANGE( 0x28, 0x28 ) AM_WRITE ( ay8910_write_port_0_w ) // AY8910
- AM_RANGE( 0x2a, 0x2a ) AM_WRITE ( ay8910_control_port_0_w ) //
+ AM_RANGE( 0x24, 0x25 ) AM_DEVWRITE( SOUND, "ym", ym2413_w ) //
+ AM_RANGE( 0x28, 0x28 ) AM_DEVWRITE ( SOUND, "ay", ay8910_data_w ) // AY8910
+ AM_RANGE( 0x2a, 0x2a ) AM_DEVWRITE ( SOUND, "ay", ay8910_address_w ) //
AM_RANGE( 0x48, 0x48 ) AM_WRITE ( dynax_extra_scrollx_w ) // screen scroll X
AM_RANGE( 0x49, 0x49 ) AM_WRITE ( dynax_extra_scrolly_w ) // screen scroll Y
AM_RANGE( 0x4a, 0x4a ) AM_WRITE ( yarunara_rombank_w ) // BANK ROM Select
@@ -728,12 +724,11 @@ static ADDRESS_MAP_START( mcnpshnt_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE( 0x23, 0x23 ) AM_READ ( hanamai_keyboard_0_r ) // P1
AM_RANGE( 0x24, 0x24 ) AM_READ_PORT ( "DSW0" ) // DSW2
AM_RANGE( 0x26, 0x26 ) AM_READ_PORT ( "DSW1" ) // DSW3
- AM_RANGE( 0x30, 0x30 ) AM_WRITE ( adpcm_reset_w ) // MSM5205 reset
+ AM_RANGE( 0x30, 0x30 ) AM_DEVWRITE ( SOUND, "msm", adpcm_reset_w ) // MSM5205 reset
AM_RANGE( 0x32, 0x32 ) AM_WRITE ( adpcm_data_w ) // MSM5205 data
- AM_RANGE( 0x34, 0x34 ) AM_WRITE ( ym2413_register_port_0_w ) // YM2413
- AM_RANGE( 0x35, 0x35 ) AM_WRITE ( ym2413_data_port_0_w ) //
- AM_RANGE( 0x38, 0x38 ) AM_WRITE ( ay8910_write_port_0_w ) // AY8910
- AM_RANGE( 0x3a, 0x3a ) AM_WRITE ( ay8910_control_port_0_w ) //
+ AM_RANGE( 0x34, 0x35 ) AM_DEVWRITE( SOUND, "ym", ym2413_w ) //
+ AM_RANGE( 0x38, 0x38 ) AM_DEVWRITE ( SOUND, "ay", ay8910_data_w ) // AY8910
+ AM_RANGE( 0x3a, 0x3a ) AM_DEVWRITE ( SOUND, "ay", ay8910_address_w ) //
AM_RANGE( 0x40, 0x40 ) AM_WRITE ( dynax_blit_pen_w ) // Destination Pen
AM_RANGE( 0x41, 0x41 ) AM_WRITE ( dynax_blit_dest_w ) // Destination Layer
AM_RANGE( 0x42, 0x42 ) AM_WRITE ( dynax_blit_palette01_w ) // Layers Palettes
@@ -759,8 +754,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sprtmtch_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE( 0x01, 0x07 ) AM_WRITE ( dynax_blitter_rev2_w ) // Blitter
- AM_RANGE( 0x10, 0x10 ) AM_READWRITE ( ym2203_status_port_0_r, ym2203_control_port_0_w ) // YM2203
- AM_RANGE( 0x11, 0x11 ) AM_READWRITE ( ym2203_read_port_0_r, ym2203_write_port_0_w ) // 2 x DSW
+ AM_RANGE( 0x10, 0x11 ) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w ) // 2 x DSW
// AM_RANGE( 0x12, 0x12 ) AM_WRITE ( SMH_NOP ) // CRT Controller
// AM_RANGE( 0x13, 0x13 ) AM_WRITE ( SMH_NOP ) // CRT Controller
AM_RANGE( 0x20, 0x20 ) AM_READ_PORT ( "P1" ) // P1
@@ -775,7 +769,7 @@ static ADDRESS_MAP_START( sprtmtch_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE( 0x35, 0x35 ) AM_WRITE ( dynax_blit_palette23_w ) //
AM_RANGE( 0x36, 0x36 ) AM_WRITE ( dynax_blit_backpen_w ) // Background Color
AM_RANGE( 0x37, 0x37 ) AM_WRITE ( dynax_vblank_ack_w ) // VBlank IRQ Ack
-// AM_RANGE( 0x40, 0x40 ) AM_WRITE ( adpcm_reset_w ) // MSM5205 reset
+// AM_RANGE( 0x40, 0x40 ) AM_DEVWRITE ( SOUND, "msm", adpcm_reset_w ) // MSM5205 reset
AM_RANGE( 0x41, 0x41 ) AM_WRITE ( dynax_flipscreen_w ) // Flip Screen
AM_RANGE( 0x42, 0x42 ) AM_WRITE ( dynax_coincounter_0_w ) // Coin Counters
AM_RANGE( 0x43, 0x43 ) AM_WRITE ( dynax_coincounter_1_w ) //
@@ -806,20 +800,18 @@ static ADDRESS_MAP_START( mjfriday_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE( 0x63, 0x63 ) AM_READ ( hanamai_keyboard_0_r ) // P1
AM_RANGE( 0x64, 0x64 ) AM_READ_PORT ( "DSW0" ) // DSW
AM_RANGE( 0x67, 0x67 ) AM_READ_PORT ( "DSW1" ) // DSW
- AM_RANGE( 0x70, 0x70 ) AM_WRITE ( ym2413_register_port_0_w ) // YM2413
- AM_RANGE( 0x71, 0x71 ) AM_WRITE ( ym2413_data_port_0_w ) //
+ AM_RANGE( 0x70, 0x71 ) AM_DEVWRITE ( SOUND, "ym", ym2413_w ) //
// AM_RANGE( 0x80, 0x80 ) AM_WRITE ( SMH_NOP ) // IRQ ack?
ADDRESS_MAP_END
static ADDRESS_MAP_START( nanajign_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE( 0x00, 0x00 ) AM_WRITE ( adpcm_reset_w ) // MSM5205 reset
+ AM_RANGE( 0x00, 0x00 ) AM_DEVWRITE ( SOUND, "msm", adpcm_reset_w ) // MSM5205 reset
AM_RANGE( 0x02, 0x02 ) AM_WRITE ( adpcm_data_w ) // MSM5205 data
- AM_RANGE( 0x04, 0x04 ) AM_WRITE ( ym2413_register_port_0_w ) // YM2413
- AM_RANGE( 0x05, 0x05 ) AM_WRITE ( ym2413_data_port_0_w ) //
- AM_RANGE( 0x08, 0x08 ) AM_WRITE ( ay8910_write_port_0_w ) // AY8910
- AM_RANGE( 0x0a, 0x0a ) AM_WRITE ( ay8910_control_port_0_w ) //
+ AM_RANGE( 0x04, 0x05 ) AM_DEVWRITE( SOUND, "ym", ym2413_w ) //
+ AM_RANGE( 0x08, 0x08 ) AM_DEVWRITE ( SOUND, "ay", ay8910_data_w ) // AY8910
+ AM_RANGE( 0x0a, 0x0a ) AM_DEVWRITE ( SOUND, "ay", ay8910_address_w ) //
AM_RANGE( 0x10, 0x10 ) AM_WRITE ( hanamai_keyboard_w ) // keyboard row select
AM_RANGE( 0x11, 0x11 ) AM_READ_PORT ( "IN0" ) // Coins
AM_RANGE( 0x12, 0x12 ) AM_READ ( hanamai_keyboard_1_r ) // P2
@@ -945,12 +937,10 @@ static ADDRESS_MAP_START( jantouki_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE( 0x00, 0x00 ) AM_WRITE ( jantouki_sound_rombank_w ) // BANK ROM Select
AM_RANGE( 0x10, 0x10 ) AM_WRITE ( jantouki_sound_vblank_ack_w ) // VBlank IRQ Ack
- AM_RANGE( 0x21, 0x21 ) AM_READ ( ay8910_read_port_0_r ) // AY8910
- AM_RANGE( 0x22, 0x22 ) AM_WRITE ( ay8910_write_port_0_w ) //
- AM_RANGE( 0x23, 0x23 ) AM_WRITE ( ay8910_control_port_0_w ) //
- AM_RANGE( 0x28, 0x28 ) AM_READWRITE ( ym2203_status_port_0_r, ym2203_control_port_0_w ) // YM2203
- AM_RANGE( 0x29, 0x29 ) AM_READWRITE ( ym2203_read_port_0_r, ym2203_write_port_0_w ) //
- AM_RANGE( 0x30, 0x30 ) AM_WRITE ( adpcm_reset_w ) // MSM5205 reset
+ AM_RANGE( 0x21, 0x21 ) AM_DEVREAD ( SOUND, "ay", ay8910_r ) // AY8910
+ AM_RANGE( 0x22, 0x23 ) AM_DEVWRITE ( SOUND, "ay", ay8910_data_address_w ) //
+ AM_RANGE( 0x28, 0x29 ) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w) //
+ AM_RANGE( 0x30, 0x30 ) AM_DEVWRITE ( SOUND, "msm", adpcm_reset_w ) // MSM5205 reset
AM_RANGE( 0x40, 0x40 ) AM_WRITE ( adpcm_data_w ) // MSM5205 data
AM_RANGE( 0x50, 0x50 ) AM_READ ( jantouki_soundlatch_status_r ) // Soundlatch status
AM_RANGE( 0x60, 0x60 ) AM_WRITE ( jantouki_soundlatch_ack_w ) // Soundlatch status
@@ -983,12 +973,11 @@ static WRITE8_HANDLER( mjelctrn_blitter_ack_w )
static ADDRESS_MAP_START( mjelctrn_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE( 0x00, 0x00 ) AM_WRITE ( adpcm_reset_w ) // MSM5205 reset
+ AM_RANGE( 0x00, 0x00 ) AM_DEVWRITE ( SOUND, "msm", adpcm_reset_w ) // MSM5205 reset
AM_RANGE( 0x02, 0x02 ) AM_WRITE ( adpcm_data_w ) // MSM5205 data
- AM_RANGE( 0x04, 0x04 ) AM_WRITE ( ym2413_register_port_0_w ) // YM2413
- AM_RANGE( 0x05, 0x05 ) AM_WRITE ( ym2413_data_port_0_w ) //
- AM_RANGE( 0x08, 0x08 ) AM_WRITE ( ay8910_write_port_0_w ) // AY8910
- AM_RANGE( 0x0a, 0x0a ) AM_WRITE ( ay8910_control_port_0_w ) //
+ AM_RANGE( 0x04, 0x05 ) AM_DEVWRITE( SOUND, "ym", ym2413_w ) //
+ AM_RANGE( 0x08, 0x08 ) AM_DEVWRITE( SOUND, "ay", ay8910_data_w ) // AY8910
+ AM_RANGE( 0x0a, 0x0a ) AM_DEVWRITE( SOUND, "ay", ay8910_address_w ) //
AM_RANGE( 0x11, 0x12 ) AM_WRITE ( mjelctrn_blitter_ack_w ) //?
// AM_RANGE( 0x20, 0x20 ) AM_WRITE ( SMH_NOP ) // CRT Controller
// AM_RANGE( 0x21, 0x21 ) AM_WRITE ( SMH_NOP ) // CRT Controller
@@ -1032,19 +1021,18 @@ static WRITE8_HANDLER( htengoku_select_w )
htengoku_ip = 0;
}
-static WRITE8_HANDLER( htengoku_dsw_w )
+static WRITE8_DEVICE_HANDLER( htengoku_dsw_w )
{
htengoku_dsw = data;
}
-static READ8_HANDLER( htengoku_dsw_r )
+static READ8_DEVICE_HANDLER( htengoku_dsw_r )
{
-
- if (!(htengoku_dsw & 0x01)) return input_port_read(space->machine, "DSW0");
- if (!(htengoku_dsw & 0x02)) return input_port_read(space->machine, "DSW1");
- if (!(htengoku_dsw & 0x04)) return input_port_read(space->machine, "DSW2");
- if (!(htengoku_dsw & 0x08)) return input_port_read(space->machine, "DSW3");
- if (!(htengoku_dsw & 0x10)) return input_port_read(space->machine, "DSW4");
- logerror("%06x: warning, unknown bits read, htengoku_dsw = %02x\n", cpu_get_pc(space->cpu), htengoku_dsw);
+ if (!(htengoku_dsw & 0x01)) return input_port_read(device->machine, "DSW0");
+ if (!(htengoku_dsw & 0x02)) return input_port_read(device->machine, "DSW1");
+ if (!(htengoku_dsw & 0x04)) return input_port_read(device->machine, "DSW2");
+ if (!(htengoku_dsw & 0x08)) return input_port_read(device->machine, "DSW3");
+ if (!(htengoku_dsw & 0x10)) return input_port_read(device->machine, "DSW4");
+ logerror("%s: warning, unknown bits read, htengoku_dsw = %02x\n", cpuexec_describe_context(device->machine), htengoku_dsw);
return 0xff;
}
@@ -1131,11 +1119,10 @@ static ADDRESS_MAP_START( htengoku_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE( 0x21, 0x21 ) AM_WRITE ( htengoku_coin_w ) //
AM_RANGE( 0x22, 0x22 ) AM_READ ( htengoku_coin_r ) //
AM_RANGE( 0x23, 0x23 ) AM_READ ( htengoku_input_r ) //
- AM_RANGE( 0x40, 0x40 ) AM_WRITE ( ay8910_control_port_0_w ) // AY8910
- AM_RANGE( 0x42, 0x42 ) AM_READ ( ay8910_read_port_0_r ) //
- AM_RANGE( 0x44, 0x44 ) AM_WRITE ( ay8910_write_port_0_w ) //
- AM_RANGE( 0x46, 0x46 ) AM_WRITE ( ym2413_register_port_0_w ) // YM2413
- AM_RANGE( 0x47, 0x47 ) AM_WRITE ( ym2413_data_port_0_w ) //
+ AM_RANGE( 0x40, 0x40 ) AM_DEVWRITE ( SOUND, "ay", ay8910_address_w ) // AY8910
+ AM_RANGE( 0x42, 0x42 ) AM_DEVREAD ( SOUND, "ay", ay8910_r ) //
+ AM_RANGE( 0x44, 0x44 ) AM_DEVWRITE ( SOUND, "ay", ay8910_data_w) //
+ AM_RANGE( 0x46, 0x47 ) AM_DEVWRITE( SOUND, "ym", ym2413_w ) //
AM_RANGE( 0x80, 0x8f ) AM_DEVREADWRITE(MSM6242, "rtc", msm6242_r, msm6242_w) // 6242RTC
AM_RANGE( 0xa0, 0xa3 ) AM_WRITE ( ddenlovr_palette_base_w ) // ddenlovr mixer chip
AM_RANGE( 0xa4, 0xa7 ) AM_WRITE ( ddenlovr_palette_mask_w )
@@ -1251,18 +1238,18 @@ static READ8_HANDLER( tenkai_ip_r )
}
-static WRITE8_HANDLER( tenkai_dswsel_w )
+static WRITE8_DEVICE_HANDLER( tenkai_dswsel_w )
{
tenkai_dswsel = data;
}
-static READ8_HANDLER( tenkai_dsw_r )
+static READ8_DEVICE_HANDLER( tenkai_dsw_r )
{
- if (~tenkai_dswsel & 0x01) return input_port_read(space->machine, "DSW0");
- if (~tenkai_dswsel & 0x02) return input_port_read(space->machine, "DSW1");
- if (~tenkai_dswsel & 0x04) return input_port_read(space->machine, "DSW2");
- if (~tenkai_dswsel & 0x08) return input_port_read(space->machine, "DSW3");
- if (~tenkai_dswsel & 0x10) return input_port_read(space->machine, "DSW4");
- logerror("%04x: unmapped dsw %02x read\n",cpu_get_pc(space->cpu),tenkai_dswsel);
+ if (~tenkai_dswsel & 0x01) return input_port_read(device->machine, "DSW0");
+ if (~tenkai_dswsel & 0x02) return input_port_read(device->machine, "DSW1");
+ if (~tenkai_dswsel & 0x04) return input_port_read(device->machine, "DSW2");
+ if (~tenkai_dswsel & 0x08) return input_port_read(device->machine, "DSW3");
+ if (~tenkai_dswsel & 0x10) return input_port_read(device->machine, "DSW4");
+ logerror("%s: unmapped dsw %02x read\n",cpuexec_describe_context(device->machine),tenkai_dswsel);
return 0xff;
}
@@ -1406,11 +1393,10 @@ static ADDRESS_MAP_START( tenkai_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE( 0x6000, 0x6fff ) AM_RAM
AM_RANGE( 0x7000, 0x7fff ) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
AM_RANGE( 0x8000, 0xffff ) AM_READWRITE( tenkai_8000_r, tenkai_8000_w )
- AM_RANGE( 0x10000, 0x10000 ) AM_READ ( ay8910_read_port_0_r ) // AY8910
- AM_RANGE( 0x10008, 0x10008 ) AM_WRITE( ay8910_write_port_0_w ) //
- AM_RANGE( 0x10010, 0x10010 ) AM_WRITE( ay8910_control_port_0_w ) //
- AM_RANGE( 0x10020, 0x10020 ) AM_WRITE( ym2413_register_port_0_w ) // YM2413
- AM_RANGE( 0x10021, 0x10021 ) AM_WRITE( ym2413_data_port_0_w ) //
+ AM_RANGE( 0x10000, 0x10000 ) AM_DEVREAD ( SOUND, "ay", ay8910_r ) // AY8910
+ AM_RANGE( 0x10008, 0x10008 ) AM_DEVWRITE( SOUND, "ay", ay8910_data_w ) //
+ AM_RANGE( 0x10010, 0x10010 ) AM_DEVWRITE( SOUND, "ay", ay8910_address_w ) //
+ AM_RANGE( 0x10020, 0x10021 ) AM_DEVWRITE(SOUND, "ym", ym2413_w ) //
AM_RANGE( 0x10040, 0x10040 ) AM_WRITE( dynax_blit_pen_w ) // Destination Pen
AM_RANGE( 0x10044, 0x10044 ) AM_WRITE( tenkai_blit_dest_w ) // Destination Layer
AM_RANGE( 0x10048, 0x10048 ) AM_WRITE( tenkai_blit_palette23_w ) // Layers Palettes
@@ -3612,10 +3598,10 @@ static const ym2203_interface hanamai_ym2203_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_1_r, /* Port A Read: DSW */
- input_port_0_r, /* Port B Read: DSW */
- NULL, /* Port A Write */
- NULL, /* Port B Write */
+ DEVCB_INPUT_PORT("DSW1"), /* Port A Read: DSW */
+ DEVCB_INPUT_PORT("DSW0"), /* Port B Read: DSW */
+ DEVCB_NULL, /* Port A Write */
+ DEVCB_NULL, /* Port B Write */
},
sprtmtch_sound_callback /* IRQ handler */
};
@@ -3682,7 +3668,7 @@ static const ay8910_interface hnoridur_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r /* Port A Read: DSW */
+ DEVCB_INPUT_PORT("DSW0") /* Port A Read: DSW */
};
static MACHINE_DRIVER_START( hnoridur )
@@ -3735,10 +3721,10 @@ static const ym2203_interface sprtmtch_ym2203_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_3_r, /* Port A Read: DSW */
- input_port_4_r, /* Port B Read: DSW */
- NULL, /* Port A Write */
- NULL, /* Port B Write */
+ DEVCB_INPUT_PORT("DSW0"), /* Port A Read: DSW */
+ DEVCB_INPUT_PORT("DSW1"), /* Port B Read: DSW */
+ DEVCB_NULL, /* Port A Write */
+ DEVCB_NULL, /* Port B Write */
},
sprtmtch_sound_callback, /* IRQ handler */
};
@@ -3912,7 +3898,7 @@ static const ym2203_interface jantouki_ym2203_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
jantouki_sound_callback /* IRQ handler */
};
@@ -4087,8 +4073,8 @@ static const ay8910_interface htengoku_ay8910_interface =
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
// A B
- htengoku_dsw_r, 0, // R
- 0, htengoku_dsw_w // W
+ DEVCB_HANDLER(htengoku_dsw_r), DEVCB_NULL, // R
+ DEVCB_NULL, DEVCB_HANDLER(htengoku_dsw_w) // W
};
static MACHINE_DRIVER_START( htengoku )
@@ -4150,8 +4136,8 @@ static const ay8910_interface tenkai_ay8910_interface =
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
// A // B
- tenkai_dsw_r, 0, // Read
- 0, tenkai_dswsel_w // Write
+ DEVCB_HANDLER(tenkai_dsw_r), DEVCB_NULL, // Read
+ DEVCB_NULL, DEVCB_HANDLER(tenkai_dswsel_w) // Write
};
static MACHINE_DRIVER_START( tenkai )
diff --git a/src/mame/drivers/egghunt.c b/src/mame/drivers/egghunt.c
index 7ed506e7061..3ab2213bb3e 100644
--- a/src/mame/drivers/egghunt.c
+++ b/src/mame/drivers/egghunt.c
@@ -177,15 +177,15 @@ static WRITE8_HANDLER( egghunt_soundlatch_w )
cpu_set_input_line(space->machine->cpu[1],0,HOLD_LINE);
}
-static READ8_HANDLER( egghunt_okibanking_r )
+static READ8_DEVICE_HANDLER( egghunt_okibanking_r )
{
return egghunt_okibanking;
}
-static WRITE8_HANDLER( egghunt_okibanking_w )
+static WRITE8_DEVICE_HANDLER( egghunt_okibanking_w )
{
egghunt_okibanking = data;
- okim6295_set_bank_base(0, (data & 0x10) ? 0x40000 : 0);
+ okim6295_set_bank_base(device, (data & 0x10) ? 0x40000 : 0);
}
static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
@@ -218,14 +218,14 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
- AM_RANGE(0xe004, 0xe004) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0xe004, 0xe004) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0xf000, 0xffff) AM_READ(SMH_RAM)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
- AM_RANGE(0xe001, 0xe001) AM_READWRITE(egghunt_okibanking_r, egghunt_okibanking_w)
- AM_RANGE(0xe004, 0xe004) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0xe001, 0xe001) AM_DEVREADWRITE(SOUND, "oki", egghunt_okibanking_r, egghunt_okibanking_w)
+ AM_RANGE(0xe004, 0xe004) AM_DEVWRITE(SOUND, "oki", okim6295_w)
AM_RANGE(0xf000, 0xffff) AM_WRITE(SMH_RAM)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/enigma2.c b/src/mame/drivers/enigma2.c
index 005e33f85ba..c8622e18725 100644
--- a/src/mame/drivers/enigma2.c
+++ b/src/mame/drivers/enigma2.c
@@ -357,15 +357,15 @@ static WRITE8_HANDLER( sound_data_w )
}
-static READ8_HANDLER( sound_latch_r )
+static READ8_DEVICE_HANDLER( sound_latch_r )
{
return BITSWAP8(sound_latch,0,1,2,3,4,5,6,7);
}
-static WRITE8_HANDLER( protection_data_w )
+static WRITE8_DEVICE_HANDLER( protection_data_w )
{
-if (LOG_PROT) logerror("Protection Data Write: %x at %x\n", data, cpu_get_pc(space->cpu));
+if (LOG_PROT) logerror("%s: Protection Data Write: %x\n", cpuexec_describe_context(device->machine), data);
protection_data = data;
}
@@ -396,10 +396,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- sound_latch_r,
- 0,
- 0,
- protection_data_w
+ DEVCB_HANDLER(sound_latch_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(protection_data_w)
};
@@ -445,9 +445,8 @@ static ADDRESS_MAP_START( engima2_audio_cpu_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_MIRROR(0x1000) AM_ROM AM_WRITENOP
AM_RANGE(0x2000, 0x7fff) AM_NOP
AM_RANGE(0x8000, 0x83ff) AM_MIRROR(0x1c00) AM_RAM
- AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x1ffc) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xa001, 0xa001) AM_MIRROR(0x1ffc) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xa002, 0xa002) AM_MIRROR(0x1ffc) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0xa000, 0xa001) AM_MIRROR(0x1ffc) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0xa002, 0xa002) AM_MIRROR(0x1ffc) AM_DEVREAD(SOUND, "ay", ay8910_r)
AM_RANGE(0xa003, 0xa003) AM_MIRROR(0x1ffc) AM_NOP
AM_RANGE(0xc000, 0xffff) AM_NOP
ADDRESS_MAP_END
diff --git a/src/mame/drivers/eolith16.c b/src/mame/drivers/eolith16.c
index 23c8380cc3f..663ce470e36 100644
--- a/src/mame/drivers/eolith16.c
+++ b/src/mame/drivers/eolith16.c
@@ -66,7 +66,7 @@ static ADDRESS_MAP_START( eolith16_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x50000000, 0x5000ffff) AM_READWRITE(vram_r, vram_w)
AM_RANGE(0x90000000, 0x9000002f) AM_WRITENOP //?
AM_RANGE(0xff000000, 0xff1fffff) AM_ROM AM_REGION("user2", 0)
- AM_RANGE(0xffe40000, 0xffe40001) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0xffe40000, 0xffe40001) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0xffe80000, 0xffe80001) AM_WRITE(eeprom_w)
AM_RANGE(0xffea0000, 0xffea0001) AM_READ(eolith16_custom_r)
AM_RANGE(0xffea0002, 0xffea0003) AM_READ_PORT("SYSTEM")
diff --git a/src/mame/drivers/epos.c b/src/mame/drivers/epos.c
index f3b7670921f..710550b60b8 100644
--- a/src/mame/drivers/epos.c
+++ b/src/mame/drivers/epos.c
@@ -95,9 +95,9 @@ static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_READ_PORT("DSW") AM_WRITE(watchdog_reset_w)
AM_RANGE(0x01, 0x01) AM_READ_PORT("SYSTEM") AM_WRITE(epos_port_1_w)
- AM_RANGE(0x02, 0x02) AM_READ_PORT("INPUTS") AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x02, 0x02) AM_READ_PORT("INPUTS") AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
AM_RANGE(0x03, 0x03) AM_READ_PORT("UNK")
- AM_RANGE(0x06, 0x06) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x06, 0x06) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( dealer_io_map, ADDRESS_SPACE_IO, 8 )
diff --git a/src/mame/drivers/equites.c b/src/mame/drivers/equites.c
index 73ccdaca228..2a9eebffee1 100644
--- a/src/mame/drivers/equites.c
+++ b/src/mame/drivers/equites.c
@@ -418,15 +418,16 @@ static float cymvol,hihatvol;
static TIMER_CALLBACK( equites_frq_adjuster_callback )
{
+ const device_config *msm = devtag_get_device(machine, SOUND, "msm");
UINT8 frq = input_port_read(machine, FRQ_ADJUSTER_TAG);
- msm5232_set_clock(sndti_token(SOUND_MSM5232, 0), MSM5232_MIN_CLOCK + frq * (MSM5232_MAX_CLOCK - MSM5232_MIN_CLOCK) / 100);
+ msm5232_set_clock(msm, MSM5232_MIN_CLOCK + frq * (MSM5232_MAX_CLOCK - MSM5232_MIN_CLOCK) / 100);
//popmessage("8155: C %02x A %02x AY: A %02x B %02x Unk:%x", eq8155_port_c,eq8155_port_a,ay_port_a,ay_port_b,eq_cymbal_ctrl&15);
cymvol *= 0.94f;
hihatvol *= 0.94f;
- sndti_set_output_gain(SOUND_MSM5232, 0, 10, hihatvol + cymvol * (ay_port_b & 3) * 0.33); /* NO from msm5232 */
+ sound_set_output_gain(msm, 0, hihatvol + cymvol * (ay_port_b & 3) * 0.33); /* NO from msm5232 */
}
static SOUND_START(equites)
@@ -489,17 +490,17 @@ static WRITE8_HANDLER(equites_c0f8_w)
static int hihat,cymbal;
#endif
-static WRITE8_HANDLER(equites_8910porta_w)
+static WRITE8_DEVICE_HANDLER(equites_8910porta_w)
{
// bongo 1
- sample_set_volume(0, ((data & 0x30)>>4) * 0.33);
+ sample_set_volume(device, 0, ((data & 0x30)>>4) * 0.33);
if (data & ~ay_port_a & 0x80)
- sample_start(0, 0, 0);
+ sample_start(device, 0, 0, 0);
// bongo 2
- sample_set_volume(1, (data & 0x03) * 0.33);
+ sample_set_volume(device, 1, (data & 0x03) * 0.33);
if (data & ~ay_port_a & 0x08)
- sample_start(1, 1, 0);
+ sample_start(device, 1, 1, 0);
ay_port_a = data;
@@ -508,7 +509,7 @@ popmessage("HH %d(%d) CYM %d(%d)",hihat,BIT(ay_port_b,6),cymbal,ay_port_b&3);
#endif
}
-static WRITE8_HANDLER(equites_8910portb_w)
+static WRITE8_DEVICE_HANDLER(equites_8910portb_w)
{
#if POPDRUMKIT
if (data & ~ay_port_b & 0x08) cymbal++;
@@ -516,9 +517,9 @@ if (data & ~ay_port_b & 0x04) hihat++;
#endif
// bongo 3
- sample_set_volume(2, ((data & 0x30)>>4) * 0.33);
+ sample_set_volume(device, 2, ((data & 0x30)>>4) * 0.33);
if (data & ~ay_port_b & 0x80)
- sample_start(2, 2, 0);
+ sample_start(device, 2, 2, 0);
// FIXME I'm just enabling the MSM5232 Noise Output for now. Proper emulation
// of the analog circuitry should be done instead.
@@ -550,7 +551,7 @@ static WRITE8_HANDLER(equites_cymbal_ctrl_w)
-static void equites_update_dac(void)
+static void equites_update_dac(running_machine *machine)
{
// there is only one latch, which is used to drive two DAC channels.
// When the channel is enabled in the 4066, it goes to a series of
@@ -559,25 +560,25 @@ static void equites_update_dac(void)
// Note that PB0 goes through three filters while PB1 only goes through one.
if (equites_8155_portb & 1)
- dac_signed_data_w(0, equites_dac_latch);
+ dac_signed_data_w(devtag_get_device(machine, SOUND, "dac1"), equites_dac_latch);
if (equites_8155_portb & 2)
- dac_signed_data_w(1, equites_dac_latch);
+ dac_signed_data_w(devtag_get_device(machine, SOUND, "dac2"), equites_dac_latch);
}
static WRITE8_HANDLER(equites_dac_latch_w)
{
equites_dac_latch = data<<2;
- equites_update_dac();
+ equites_update_dac(space->machine);
}
static WRITE8_HANDLER(equites_8155_portb_w)
{
equites_8155_portb = data;
- equites_update_dac();
+ equites_update_dac(space->machine);
}
-static void equites_msm5232_gate(int state)
+static void equites_msm5232_gate(const device_config *device, int state)
{
}
@@ -599,6 +600,7 @@ static INTERRUPT_GEN( equites_interrupt )
static WRITE8_HANDLER(equites_8155_w)
{
static int timer_count;
+ const device_config *device;
// FIXME proper 8155 emulation must be implemented
switch( offset )
@@ -610,14 +612,15 @@ static WRITE8_HANDLER(equites_8155_w)
case 1: //logerror( "8155 I/O Port A write %x\n", data );
eq8155_port_a = data;
- sndti_set_output_gain(SOUND_MSM5232, 0, 0, (data >> 4) / 15.0); /* group1 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 1, (data >> 4) / 15.0); /* group1 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 2, (data >> 4) / 15.0); /* group1 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 3, (data >> 4) / 15.0); /* group1 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 4, (data & 0x0f) / 15.0); /* group2 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 5, (data & 0x0f) / 15.0); /* group2 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 6, (data & 0x0f) / 15.0); /* group2 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 7, (data & 0x0f) / 15.0); /* group2 from msm5232 */
+ device = devtag_get_device(space->machine, SOUND, "msm");
+ sound_set_output_gain(device, 0, (data >> 4) / 15.0); /* group1 from msm5232 */
+ sound_set_output_gain(device, 1, (data >> 4) / 15.0); /* group1 from msm5232 */
+ sound_set_output_gain(device, 2, (data >> 4) / 15.0); /* group1 from msm5232 */
+ sound_set_output_gain(device, 3, (data >> 4) / 15.0); /* group1 from msm5232 */
+ sound_set_output_gain(device, 4, (data & 0x0f) / 15.0); /* group2 from msm5232 */
+ sound_set_output_gain(device, 5, (data & 0x0f) / 15.0); /* group2 from msm5232 */
+ sound_set_output_gain(device, 6, (data & 0x0f) / 15.0); /* group2 from msm5232 */
+ sound_set_output_gain(device, 7, (data & 0x0f) / 15.0); /* group2 from msm5232 */
break;
case 2: //logerror( "8155 I/O Port B write %x\n", data );
@@ -626,11 +629,12 @@ static WRITE8_HANDLER(equites_8155_w)
case 3: //logerror( "8155 I/O Port C (or control) write %x\n", data );
eq8155_port_c = data;
- sndti_set_output_gain(SOUND_MSM5232, 0, 8, (data & 0x0f) / 15.0); /* SOLO 8' from msm5232 */
+ device = devtag_get_device(space->machine, SOUND, "msm");
+ sound_set_output_gain(device, 8, (data & 0x0f) / 15.0); /* SOLO 8' from msm5232 */
if (data & 0x20)
- sndti_set_output_gain(SOUND_MSM5232, 0, 9, (data & 0x0f) / 15.0); /* SOLO 16' from msm5232 */
+ sound_set_output_gain(device, 9, (data & 0x0f) / 15.0); /* SOLO 16' from msm5232 */
else
- sndti_set_output_gain(SOUND_MSM5232, 0, 9, 0); /* SOLO 16' from msm5232 */
+ sound_set_output_gain(device, 9, 0); /* SOLO 16' from msm5232 */
break;
case 4: //logerror( "8155 Timer low 8 bits write %x\n", data );
@@ -755,9 +759,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_r)
- AM_RANGE(0xc080, 0xc08d) AM_WRITE(msm5232_0_w)
- AM_RANGE(0xc0a0, 0xc0a0) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xc0a1, 0xc0a1) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0xc080, 0xc08d) AM_DEVWRITE(SOUND, "msm", msm5232_w)
+ AM_RANGE(0xc0a0, 0xc0a1) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
AM_RANGE(0xc0b0, 0xc0b0) AM_WRITENOP // n.c.
AM_RANGE(0xc0c0, 0xc0c0) AM_WRITE(equites_cymbal_ctrl_w)
AM_RANGE(0xc0d0, 0xc0d0) AM_WRITE(equites_dac_latch_w) // followed by 1 (and usually 0) on 8155 port B
@@ -1126,10 +1129,10 @@ static const ay8910_interface equites_8910intf =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- 0,
- 0,
- equites_8910porta_w,
- equites_8910portb_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_DEVICE_HANDLER(SOUND, "samples", equites_8910porta_w),
+ DEVCB_DEVICE_HANDLER(SOUND, "samples", equites_8910portb_w)
};
diff --git a/src/mame/drivers/esd16.c b/src/mame/drivers/esd16.c
index fd852da4ca0..ad3afdd120e 100644
--- a/src/mame/drivers/esd16.c
+++ b/src/mame/drivers/esd16.c
@@ -307,9 +307,8 @@ static READ8_HANDLER( esd16_sound_command_r )
static ADDRESS_MAP_START( multchmp_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym3812_control_port_0_w ) // YM3812
- AM_RANGE(0x01, 0x01) AM_WRITE(ym3812_write_port_0_w )
- AM_RANGE(0x02, 0x02) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w) // M6295
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ym", ym3812_w ) // YM3812
+ AM_RANGE(0x02, 0x02) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w) // M6295
AM_RANGE(0x03, 0x03) AM_READ(esd16_sound_command_r ) // From Main CPU
AM_RANGE(0x04, 0x04) AM_WRITE(SMH_NOP ) // ? $00, $30
AM_RANGE(0x05, 0x05) AM_WRITE(esd16_sound_rombank_w ) // ROM Bank
diff --git a/src/mame/drivers/esh.c b/src/mame/drivers/esh.c
index 79bfb7e0e74..1f2d3eb73a0 100644
--- a/src/mame/drivers/esh.c
+++ b/src/mame/drivers/esh.c
@@ -303,8 +303,7 @@ static MACHINE_DRIVER_START( esh )
/* sound hardware */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("ldsound", CUSTOM, 0)
- MDRV_SOUND_CONFIG(laserdisc_custom_interface)
+ MDRV_SOUND_ADD("ldsound", LASERDISC, 0)
MDRV_SOUND_ROUTE(0, "left", 1.0)
MDRV_SOUND_ROUTE(1, "right", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/espial.c b/src/mame/drivers/espial.c
index 0658349703e..1e2c3ba7cdf 100644
--- a/src/mame/drivers/espial.c
+++ b/src/mame/drivers/espial.c
@@ -146,8 +146,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/esripsys.c b/src/mame/drivers/esripsys.c
index 937e378cfda..ce994f986b3 100644
--- a/src/mame/drivers/esripsys.c
+++ b/src/mame/drivers/esripsys.c
@@ -554,10 +554,11 @@ static READ8_HANDLER( tms5220_r )
if (offset == 0)
{
/* TMS5220 core returns status bits in D7-D6 */
- UINT8 status = tms5220_status_r(space, 0);
+ const device_config *tms = devtag_get_device(space->machine, SOUND, "tms");
+ UINT8 status = tms5220_status_r(tms, 0);
status = ((status & 0x80) >> 5) | ((status & 0x40) >> 5) | ((status & 0x20) >> 5);
- return (!tms5220_ready_r() << 7) | (!tms5220_int_r() << 6) | status;
+ return (!tms5220_ready_r(tms) << 7) | (!tms5220_int_r(tms) << 6) | status;
}
return 0xff;
@@ -566,15 +567,16 @@ static READ8_HANDLER( tms5220_r )
/* TODO: Implement correctly using the state PROM */
static WRITE8_HANDLER( tms5220_w )
{
+ const device_config *tms = devtag_get_device(space->machine, SOUND, "tms");
if (offset == 0)
{
tms_data = data;
- tms5220_data_w(0, 0, tms_data);
+ tms5220_data_w(tms, 0, tms_data);
}
#if 0
if (offset == 1)
{
- tms5220_data_w(0, 0, tms_data);
+ tms5220_data_w(tms, 0, tms_data);
}
#endif
}
@@ -587,7 +589,7 @@ static WRITE8_HANDLER( control_w )
/* 10-bit MC3410CL DAC */
-static WRITE8_HANDLER( dac_w )
+static WRITE8_DEVICE_HANDLER( esripsys_dac_w )
{
if (offset == 0)
{
@@ -601,7 +603,7 @@ static WRITE8_HANDLER( dac_w )
The 8-bit DAC modulates the 10-bit DAC.
Shift down to prevent clipping.
*/
- dac_signed_data_16_w(0, (dac_vol * dac_data) >> 1);
+ dac_signed_data_16_w(device, (dac_vol * dac_data) >> 1);
}
}
@@ -646,7 +648,7 @@ static ADDRESS_MAP_START( sound_cpu_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM
AM_RANGE(0x0800, 0x0fff) AM_RAM /* Not installed on later PCBs */
AM_RANGE(0x2008, 0x2009) AM_READWRITE(tms5220_r, tms5220_w)
- AM_RANGE(0x200a, 0x200b) AM_WRITE(dac_w)
+ AM_RANGE(0x200a, 0x200b) AM_DEVWRITE(SOUND, "dac", esripsys_dac_w)
AM_RANGE(0x200c, 0x200c) AM_WRITE(volume_dac_w)
AM_RANGE(0x200d, 0x200d) AM_WRITE(control_w)
AM_RANGE(0x200e, 0x200e) AM_READWRITE(s_200e_r, s_200e_w)
diff --git a/src/mame/drivers/ettrivia.c b/src/mame/drivers/ettrivia.c
index 0a1fa944ce3..d936e87d987 100644
--- a/src/mame/drivers/ettrivia.c
+++ b/src/mame/drivers/ettrivia.c
@@ -94,20 +94,20 @@ static WRITE8_HANDLER( b800_w )
/* special case to return the value written to 0xb000 */
/* does it reset the chips too ? */
case 0: break;
- case 0xc4: b000_ret = ay8910_read_port_0_r(space,0); break;
- case 0x94: b000_ret = ay8910_read_port_1_r(space,0); break;
- case 0x86: b000_ret = ay8910_read_port_2_r(space,0); break;
+ case 0xc4: b000_ret = ay8910_r(devtag_get_device(space->machine, SOUND, "ay1"), 0); break;
+ case 0x94: b000_ret = ay8910_r(devtag_get_device(space->machine, SOUND, "ay2"), 0); break;
+ case 0x86: b000_ret = ay8910_r(devtag_get_device(space->machine, SOUND, "ay3"), 0); break;
case 0x80:
switch(b800_prev)
{
- case 0xe0: ay8910_control_port_0_w(space,0,b000_val); break;
- case 0x98: ay8910_control_port_1_w(space,0,b000_val); break;
- case 0x83: ay8910_control_port_2_w(space,0,b000_val); break;
+ case 0xe0: ay8910_address_w(devtag_get_device(space->machine, SOUND, "ay1"),0,b000_val); break;
+ case 0x98: ay8910_address_w(devtag_get_device(space->machine, SOUND, "ay2"),0,b000_val); break;
+ case 0x83: ay8910_address_w(devtag_get_device(space->machine, SOUND, "ay3"),0,b000_val); break;
- case 0xa0: ay8910_write_port_0_w(space,0,b000_val); break;
- case 0x88: ay8910_write_port_1_w(space,0,b000_val); break;
- case 0x81: ay8910_write_port_2_w(space,0,b000_val); break;
+ case 0xa0: ay8910_data_w(devtag_get_device(space->machine, SOUND, "ay1"),0,b000_val); break;
+ case 0x88: ay8910_data_w(devtag_get_device(space->machine, SOUND, "ay2"),0,b000_val); break;
+ case 0x81: ay8910_data_w(devtag_get_device(space->machine, SOUND, "ay3"),0,b000_val); break;
}
break;
@@ -212,20 +212,20 @@ static const ay8910_interface ay8912_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_1_r,
- NULL,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("IN1"),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface ay8912_interface_3 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r,
- NULL,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("IN0"),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/exedexes.c b/src/mame/drivers/exedexes.c
index 0941abe61a8..d0a087cc14a 100644
--- a/src/mame/drivers/exedexes.c
+++ b/src/mame/drivers/exedexes.c
@@ -80,10 +80,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x4000, 0x47ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x8000, 0x8000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x8001, 0x8001) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x8002, 0x8002) AM_WRITE(sn76496_0_w)
- AM_RANGE(0x8003, 0x8003) AM_WRITE(sn76496_1_w)
+ AM_RANGE(0x8000, 0x8001) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0x8002, 0x8002) AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0x8003, 0x8003) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/exerion.c b/src/mame/drivers/exerion.c
index 1f3f553b88e..4c3053a0381 100644
--- a/src/mame/drivers/exerion.c
+++ b/src/mame/drivers/exerion.c
@@ -55,17 +55,17 @@ static INPUT_CHANGED( coin_inserted )
static UINT8 porta;
static UINT8 portb;
-static READ8_HANDLER( exerion_porta_r )
+static READ8_DEVICE_HANDLER( exerion_porta_r )
{
porta ^= 0x40;
return porta;
}
-static WRITE8_HANDLER( exerion_portb_w )
+static WRITE8_DEVICE_HANDLER( exerion_portb_w )
{
/* pull the expected value from the ROM */
- porta = memory_region(space->machine, "main")[0x5f76];
+ porta = memory_region(device->machine, "main")[0x5f76];
portb = data;
logerror("Port B = %02X\n", data);
@@ -100,11 +100,9 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xb000, 0xb000) AM_READ_PORT("DSW1")
AM_RANGE(0xc000, 0xc000) AM_WRITE(exerion_videoreg_w)
AM_RANGE(0xc800, 0xc800) AM_WRITE(soundlatch_w)
- AM_RANGE(0xd000, 0xd000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xd001, 0xd001) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xd800, 0xd800) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0xd801, 0xd801) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0xd802, 0xd802) AM_READ(ay8910_read_port_1_r)
+ AM_RANGE(0xd000, 0xd001) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0xd800, 0xd801) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0xd802, 0xd802) AM_DEVREAD(SOUND, "ay2", ay8910_r)
ADDRESS_MAP_END
@@ -263,10 +261,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- exerion_porta_r,
- NULL,
- NULL,
- exerion_portb_w
+ DEVCB_HANDLER(exerion_porta_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(exerion_portb_w)
};
diff --git a/src/mame/drivers/expro02.c b/src/mame/drivers/expro02.c
index b283ceaeb2d..e1547559a64 100644
--- a/src/mame/drivers/expro02.c
+++ b/src/mame/drivers/expro02.c
@@ -357,7 +357,7 @@ static ADDRESS_MAP_START( galsnew_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x03ffff) AM_ROM // main program
AM_RANGE(0x080000, 0x0fffff) AM_ROM AM_REGION("user2",0) // other data
AM_RANGE(0x100000, 0x3fffff) AM_ROM AM_REGION("user1",0) // main data
- AM_RANGE(0x400000, 0x400001) AM_READWRITE(okim6295_status_0_lsb_r,okim6295_data_0_lsb_w)
+ AM_RANGE(0x400000, 0x400001) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x500000, 0x51ffff) AM_RAM AM_BASE(&galsnew_bg_pixram)
@@ -418,7 +418,7 @@ static ADDRESS_MAP_START( fantasia_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xd80000, 0xd80001) AM_WRITE(galsnew_vram_1_bank_w) /* ??? */
//AM_RANGE(0xe00000, 0xe00015) AM_READWRITE(galpanib_calc_r,galpanib_calc_w) /* CALC1 MCU interaction (simulated) */
AM_RANGE(0xe80000, 0xe80001) AM_WRITE(galsnew_vram_0_bank_w) /* ??? */
- AM_RANGE(0xf00000, 0xf00001) AM_READWRITE(okim6295_status_0_msb_r,okim6295_data_0_msb_w)
+ AM_RANGE(0xf00000, 0xf00001) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0xff00)
ADDRESS_MAP_END
/*************************************
diff --git a/src/mame/drivers/exprraid.c b/src/mame/drivers/exprraid.c
index 3a4f053b9a5..ba6d94e7ffa 100644
--- a/src/mame/drivers/exprraid.c
+++ b/src/mame/drivers/exprraid.c
@@ -212,7 +212,7 @@ Stephh's notes (based on the games M6502 code and some tests) :
#include "cpu/m6502/m6502.h"
#include "cpu/m6809/m6809.h"
#include "sound/2203intf.h"
-#include "sound/3812intf.h"
+#include "sound/3526intf.h"
extern WRITE8_HANDLER( exprraid_videoram_w );
@@ -282,10 +282,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( slave_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_RAM
- AM_RANGE(0x2000, 0x2000) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x2001, 0x2001) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
- AM_RANGE(0x4000, 0x4000) AM_READWRITE(ym3526_status_port_0_r, ym3526_control_port_0_w)
- AM_RANGE(0x4001, 0x4001) AM_WRITE(ym3526_write_port_0_w)
+ AM_RANGE(0x2000, 0x2001) AM_DEVREADWRITE(SOUND, "ym1", ym2203_r, ym2203_w)
+ AM_RANGE(0x4000, 0x4001) AM_DEVREADWRITE(SOUND, "ym2", ym3526_r, ym3526_w)
AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -435,9 +433,9 @@ GFXDECODE_END
/* handler called by the 3812 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
- cpu_set_input_line_and_vector(machine->cpu[1],0,linestate,0xff);
+ cpu_set_input_line_and_vector(device->machine->cpu[1],0,linestate,0xff);
}
static const ym3526_interface ym3526_config =
diff --git a/src/mame/drivers/exterm.c b/src/mame/drivers/exterm.c
index 208dba5d7da..8117cd99721 100644
--- a/src/mame/drivers/exterm.c
+++ b/src/mame/drivers/exterm.c
@@ -240,13 +240,10 @@ static TIMER_CALLBACK( master_sound_nmi_callback )
}
-static WRITE8_HANDLER( ym2151_data_latch_w )
+static WRITE8_DEVICE_HANDLER( ym2151_data_latch_w )
{
/* bit 7 of the sound control selects which port */
- if (sound_control & 0x80)
- ym2151_data_port_0_w(space, offset, data);
- else
- ym2151_register_port_0_w(space, offset, data);
+ ym2151_w(device, sound_control >> 7, data);
}
@@ -276,11 +273,11 @@ static READ8_HANDLER( sound_slave_latch_r )
}
-static WRITE8_HANDLER( sound_slave_dac_w )
+static WRITE8_DEVICE_HANDLER( sound_slave_dac_w )
{
/* DAC A is used to modulate DAC B */
dac_value[offset & 1] = data;
- dac_data_16_w(0, (dac_value[0] ^ 0xff) * dac_value[1]);
+ dac_data_16_w(device, (dac_value[0] ^ 0xff) * dac_value[1]);
}
@@ -345,7 +342,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_master_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x1800) AM_RAM
- AM_RANGE(0x4000, 0x5fff) AM_WRITE(ym2151_data_latch_w)
+ AM_RANGE(0x4000, 0x5fff) AM_DEVWRITE(SOUND, "ym", ym2151_data_latch_w)
AM_RANGE(0x6000, 0x67ff) AM_WRITE(sound_nmi_rate_w)
AM_RANGE(0x6800, 0x6fff) AM_READ(sound_master_latch_r)
AM_RANGE(0x7000, 0x77ff) AM_READ(sound_nmi_to_slave_r)
@@ -358,7 +355,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_slave_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x3800) AM_RAM
AM_RANGE(0x4000, 0x5fff) AM_READ(sound_slave_latch_r)
- AM_RANGE(0x8000, 0xbfff) AM_WRITE(sound_slave_dac_w)
+ AM_RANGE(0x8000, 0xbfff) AM_DEVWRITE(SOUND, "dac", sound_slave_dac_w)
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
diff --git a/src/mame/drivers/exzisus.c b/src/mame/drivers/exzisus.c
index a7f6da1c76f..371ecb709e0 100644
--- a/src/mame/drivers/exzisus.c
+++ b/src/mame/drivers/exzisus.c
@@ -224,8 +224,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x8fff) AM_READ(SMH_RAM)
- AM_RANGE(0x9000, 0x9000) AM_READ(SMH_NOP)
- AM_RANGE(0x9001, 0x9001) AM_READ(ym2151_status_port_0_r)
+ AM_RANGE(0x9000, 0x9001) AM_DEVREAD(SOUND, "ym", ym2151_r)
AM_RANGE(0xa000, 0xa000) AM_READ(SMH_NOP)
AM_RANGE(0xa001, 0xa001) AM_READ(taitosound_slave_comm_r)
ADDRESS_MAP_END
@@ -233,8 +232,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x8fff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x9000, 0x9000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x9001, 0x9001) AM_WRITE(ym2151_data_port_0_w)
+ AM_RANGE(0x9000, 0x9001) AM_DEVWRITE(SOUND, "ym", ym2151_w)
AM_RANGE(0xa000, 0xa000) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xa001, 0xa001) AM_WRITE(taitosound_slave_comm_w)
ADDRESS_MAP_END
@@ -311,9 +309,9 @@ GFXDECODE_END
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/f-32.c b/src/mame/drivers/f-32.c
index 724c2b2976c..be0f16a858e 100644
--- a/src/mame/drivers/f-32.c
+++ b/src/mame/drivers/f-32.c
@@ -19,31 +19,6 @@
static UINT32 *mosaicf2_videoram;
-static READ32_HANDLER( oki_32bit_r )
-{
- return okim6295_status_0_r(space, 0);
-}
-
-static WRITE32_HANDLER( oki_32bit_w )
-{
- okim6295_data_0_w(space, 0, data & 0xff);
-}
-
-static READ32_HANDLER( ym2151_status_32bit_r )
-{
- return ym2151_status_port_0_r(space, 0);
-}
-
-static WRITE32_HANDLER( ym2151_data_32bit_w )
-{
- ym2151_data_port_0_w(space, 0, data & 0xff);
-}
-
-static WRITE32_HANDLER( ym2151_register_32bit_w )
-{
- ym2151_register_port_0_w(space,0,data & 0xff);
-}
-
static READ32_HANDLER( eeprom_r )
{
return eeprom_read_bit();
@@ -104,14 +79,14 @@ static READ32_HANDLER( f32_input_port_1_r )
static ADDRESS_MAP_START( mosaicf2_io, ADDRESS_SPACE_IO, 32 )
- AM_RANGE(0x4000, 0x4003) AM_READ(oki_32bit_r)
- AM_RANGE(0x4810, 0x4813) AM_READ(ym2151_status_32bit_r)
+ AM_RANGE(0x4000, 0x4003) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x000000ff)
+ AM_RANGE(0x4810, 0x4813) AM_DEVREAD8(SOUND, "ym", ym2151_status_port_r, 0x000000ff)
AM_RANGE(0x5000, 0x5003) AM_READ_PORT("P1")
AM_RANGE(0x5200, 0x5203) AM_READ(f32_input_port_1_r)
AM_RANGE(0x5400, 0x5403) AM_READ(eeprom_r)
- AM_RANGE(0x6000, 0x6003) AM_WRITE(oki_32bit_w)
- AM_RANGE(0x6800, 0x6803) AM_WRITE(ym2151_data_32bit_w)
- AM_RANGE(0x6810, 0x6813) AM_WRITE(ym2151_register_32bit_w)
+ AM_RANGE(0x6000, 0x6003) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x000000ff)
+ AM_RANGE(0x6800, 0x6803) AM_DEVWRITE8(SOUND, "ym", ym2151_data_port_w, 0x000000ff)
+ AM_RANGE(0x6810, 0x6813) AM_DEVWRITE8(SOUND, "ym", ym2151_register_port_w, 0x000000ff)
AM_RANGE(0x7000, 0x7003) AM_WRITE(eeprom_clock_line_w)
AM_RANGE(0x7200, 0x7203) AM_WRITE(eeprom_cs_line_w)
AM_RANGE(0x7400, 0x7403) AM_WRITE(eeprom_bit_w)
diff --git a/src/mame/drivers/f1gp.c b/src/mame/drivers/f1gp.c
index e5f128c2c4b..bacffdb596f 100644
--- a/src/mame/drivers/f1gp.c
+++ b/src/mame/drivers/f1gp.c
@@ -198,10 +198,7 @@ static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0x00) AM_WRITE(f1gp_sh_bankswitch_w) // f1gp
AM_RANGE(0x0c, 0x0c) AM_WRITE(f1gp_sh_bankswitch_w) // f1gp2
AM_RANGE(0x14, 0x14) AM_READWRITE(soundlatch_r, pending_command_clear_w)
- AM_RANGE(0x18, 0x18) AM_READWRITE(ym2610_status_port_0_a_r, ym2610_control_port_0_a_w)
- AM_RANGE(0x19, 0x19) AM_WRITE(ym2610_data_port_0_a_w)
- AM_RANGE(0x1a, 0x1a) AM_READWRITE(ym2610_status_port_0_b_r, ym2610_control_port_0_b_w)
- AM_RANGE(0x1b, 0x1b) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE(SOUND, "ym", ym2610_r, ym2610_w)
ADDRESS_MAP_END
static WRITE16_HANDLER( f1gpb_misc_w )
@@ -253,7 +250,7 @@ static ADDRESS_MAP_START( f1gpb_cpu1_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xfff008, 0xfff009) AM_READNOP //?
AM_RANGE(0xfff006, 0xfff007) AM_WRITENOP
AM_RANGE(0xfff00a, 0xfff00b) AM_RAM AM_BASE(&f1gpb_fgregs)
- AM_RANGE(0xfff00e, 0xfff00f) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0xfff00e, 0xfff00f) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0xfff00c, 0xfff00d) AM_WRITE(f1gpb_misc_w)
AM_RANGE(0xfff010, 0xfff011) AM_WRITENOP
AM_RANGE(0xfff020, 0xfff023) AM_RAM //?
@@ -458,9 +455,9 @@ GFXDECODE_END
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[2],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[2],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface ym2610_config =
diff --git a/src/mame/drivers/fantland.c b/src/mame/drivers/fantland.c
index e5d79cea484..35a19715143 100644
--- a/src/mame/drivers/fantland.c
+++ b/src/mame/drivers/fantland.c
@@ -49,12 +49,14 @@ Year + Game Main CPU Sound CPU Sound Video
#include "cpu/i86/i86.h"
#include "cpu/i86/i86.h"
#include "sound/2151intf.h"
-#include "sound/3812intf.h"
+#include "sound/3526intf.h"
#include "sound/dac.h"
#include "sound/msm5205.h"
VIDEO_UPDATE( fantland );
+static const char *msm_name[4] = { "msm1", "msm2", "msm3", "msm4" };
+
/***************************************************************************
Memory Maps - Main CPU
@@ -280,9 +282,13 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( fantland_sound_iomap, ADDRESS_SPACE_IO, 8 )
AM_RANGE( 0x0080, 0x0080 ) AM_READ( soundlatch_r )
- AM_RANGE( 0x0100, 0x0100 ) AM_WRITE( ym2151_register_port_0_w )
- AM_RANGE( 0x0101, 0x0101 ) AM_READWRITE( ym2151_status_port_0_r, ym2151_data_port_0_w )
- AM_RANGE( 0x0180, 0x0180 ) AM_WRITE( dac_0_data_w )
+ AM_RANGE( 0x0100, 0x0101 ) AM_DEVREADWRITE( SOUND, "ym", ym2151_r, ym2151_w )
+ AM_RANGE( 0x0180, 0x0180 ) AM_DEVWRITE( SOUND, "dac", dac_w )
+ADDRESS_MAP_END
+
+static ADDRESS_MAP_START( galaxygn_sound_iomap, ADDRESS_SPACE_IO, 8 )
+ AM_RANGE( 0x0080, 0x0080 ) AM_READ( soundlatch_r )
+ AM_RANGE( 0x0100, 0x0101 ) AM_DEVREADWRITE( SOUND, "ym", ym2151_r, ym2151_w )
ADDRESS_MAP_END
@@ -299,17 +305,17 @@ static struct
} borntofi_adpcm[4];
-static void borntofi_adpcm_start(int voice)
+static void borntofi_adpcm_start(const device_config *device, int voice)
{
- msm5205_reset_w(voice,0);
+ msm5205_reset_w(device,0);
borntofi_adpcm[voice].playing = 1;
borntofi_adpcm[voice].nibble = 0;
// logerror("%s: adpcm start = %06x, stop = %06x\n", cpuexec_describe_context(device->machine), borntofi_adpcm[voice].addr[0], borntofi_adpcm[voice].addr[1]);
}
-static void borntofi_adpcm_stop(int voice)
+static void borntofi_adpcm_stop(const device_config *device, int voice)
{
- msm5205_reset_w(voice,1);
+ msm5205_reset_w(device,1);
borntofi_adpcm[voice].playing = 0;
}
@@ -323,8 +329,8 @@ static WRITE8_HANDLER( borntofi_msm5205_w )
// Play / Stop
switch(data)
{
- case 0x00: borntofi_adpcm_stop(voice); break;
- case 0x03: borntofi_adpcm_start(voice); break;
+ case 0x00: borntofi_adpcm_stop(devtag_get_device(space->machine, SOUND, msm_name[voice]), voice); break;
+ case 0x03: borntofi_adpcm_start(devtag_get_device(space->machine, SOUND, msm_name[voice]), voice); break;
default: logerror("CPU #0 PC = %04X: adpcm reg %d <- %02x\n", cpu_get_pc(space->cpu), reg, data);
}
}
@@ -355,18 +361,18 @@ static void borntofi_adpcm_int(const device_config *device, int voice)
if (start >= len)
{
- borntofi_adpcm_stop(voice);
+ borntofi_adpcm_stop(device, voice);
logerror("adpcm address out of range: %06x\n", start);
return;
}
if (start >= stop)
{
- borntofi_adpcm_stop(voice);
+ borntofi_adpcm_stop(device, voice);
}
else
{
- msm5205_data_w( voice, rom[start/2] >> ((start & 1) * 4) );
+ msm5205_data_w( device, rom[start/2] >> ((start & 1) * 4) );
borntofi_adpcm[voice].nibble++;
}
}
@@ -393,8 +399,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( wheelrun_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
- AM_RANGE(0xa000, 0xa000) AM_READWRITE( ym3526_status_port_0_r, ym3526_control_port_0_w )
- AM_RANGE(0xa001, 0xa001) AM_WRITE( ym3526_write_port_0_w )
+ AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE(SOUND, "ym", ym3526_r, ym3526_w )
AM_RANGE(0xb000, 0xb000) AM_WRITE( SMH_NOP ) // on a car crash / hit
AM_RANGE(0xc000, 0xc000) AM_WRITE( SMH_NOP ) // ""
@@ -857,9 +862,9 @@ static MACHINE_DRIVER_START( fantland )
MACHINE_DRIVER_END
-static void galaxygn_sound_irq(running_machine *machine, int line)
+static void galaxygn_sound_irq(const device_config *device, int line)
{
- cpu_set_input_line_and_vector(machine->cpu[1], 0, line ? ASSERT_LINE : CLEAR_LINE, 0x80/4);
+ cpu_set_input_line_and_vector(device->machine->cpu[1], 0, line ? ASSERT_LINE : CLEAR_LINE, 0x80/4);
}
static const ym2151_interface galaxygn_ym2151_interface =
@@ -875,7 +880,7 @@ static MACHINE_DRIVER_START( galaxygn )
MDRV_CPU_ADD("audio", I8088, 8000000) // ?
MDRV_CPU_PROGRAM_MAP(fantland_sound_map, 0)
- MDRV_CPU_IO_MAP(fantland_sound_iomap, 0)
+ MDRV_CPU_IO_MAP(galaxygn_sound_iomap, 0)
// IRQ by YM2151, NMI when soundlatch is written
MDRV_MACHINE_RESET(fantland)
@@ -932,7 +937,7 @@ static MACHINE_RESET( borntofi )
MACHINE_RESET_CALL(fantland);
for (voice = 0; voice < 4; voice++)
- borntofi_adpcm_stop(voice);
+ borntofi_adpcm_stop(devtag_get_device(machine, SOUND, msm_name[voice]), voice);
}
static MACHINE_DRIVER_START( borntofi )
@@ -970,9 +975,9 @@ MACHINE_DRIVER_END
-static void wheelrun_ym3526_irqhandler(running_machine *machine, int state)
+static void wheelrun_ym3526_irqhandler(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1], INPUT_LINE_IRQ0, state);
+ cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_IRQ0, state);
}
static const ym3526_interface wheelrun_ym3526_interface =
diff --git a/src/mame/drivers/fastfred.c b/src/mame/drivers/fastfred.c
index 81a882d1d59..cae472d33c2 100644
--- a/src/mame/drivers/fastfred.c
+++ b/src/mame/drivers/fastfred.c
@@ -202,8 +202,7 @@ static ADDRESS_MAP_START( jumpcoas_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xf116, 0xf116) AM_WRITE(fastfred_flip_screen_x_w)
AM_RANGE(0xf117, 0xf117) AM_WRITE(fastfred_flip_screen_y_w)
//AM_RANGE(0xf800, 0xf800) AM_READ(watchdog_reset_r) // Why doesn't this work???
- AM_RANGE(0xf800, 0xf800) AM_READWRITE(SMH_NOP, ay8910_control_port_0_w)
- AM_RANGE(0xf801, 0xf801) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0xf800, 0xf801) AM_DEVREADWRITE(SOUND, "ay8910.1", SMH_NOP, ay8910_address_data_w)
ADDRESS_MAP_END
@@ -239,10 +238,8 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x2000, 0x23ff) AM_RAM
AM_RANGE(0x3000, 0x3000) AM_READWRITE(soundlatch_r, interrupt_enable_w)
AM_RANGE(0x4000, 0x4000) AM_WRITE(SMH_RAM) // Reset PSG's
- AM_RANGE(0x5000, 0x5000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x5001, 0x5001) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x6000, 0x6000) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x6001, 0x6001) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0x5000, 0x5001) AM_DEVWRITE(SOUND, "ay8910.1", ay8910_address_data_w)
+ AM_RANGE(0x6000, 0x6001) AM_DEVWRITE(SOUND, "ay8910.2", ay8910_address_data_w)
AM_RANGE(0x7000, 0x7000) AM_READ(SMH_NOP) // only for Imago, read but not used
ADDRESS_MAP_END
diff --git a/src/mame/drivers/fastlane.c b/src/mame/drivers/fastlane.c
index bf39e899e23..86343dffe11 100644
--- a/src/mame/drivers/fastlane.c
+++ b/src/mame/drivers/fastlane.c
@@ -60,7 +60,7 @@ static WRITE8_HANDLER( fastlane_bankswitch_w )
memory_set_bankptr(space->machine, 1,&RAM[bankaddress]);
/* bit 4: bank # for the 007232 (chip 2) */
- k007232_set_bank(1,0 + ((data & 0x10) >> 4),2 + ((data & 0x10) >> 4));
+ k007232_set_bank(devtag_get_device(space->machine, SOUND, "konami2"),0 + ((data & 0x10) >> 4),2 + ((data & 0x10) >> 4));
/* other bits seems to be unused */
}
@@ -68,21 +68,13 @@ static WRITE8_HANDLER( fastlane_bankswitch_w )
/* Read and write handlers for one K007232 chip:
even and odd register are mapped swapped */
-static READ8_HANDLER( fastlane_k007232_read_port_0_r )
+static READ8_DEVICE_HANDLER( fastlane_k007232_r )
{
- return k007232_read_port_0_r(space, offset ^ 1);
+ return k007232_r(device, offset ^ 1);
}
-static WRITE8_HANDLER( fastlane_k007232_write_port_0_w )
+static WRITE8_DEVICE_HANDLER( fastlane_k007232_w )
{
- k007232_write_port_0_w(space, offset ^ 1, data);
-}
-static READ8_HANDLER( fastlane_k007232_read_port_1_r )
-{
- return k007232_read_port_1_r(space, offset ^ 1);
-}
-static WRITE8_HANDLER( fastlane_k007232_write_port_1_w )
-{
- k007232_write_port_1_w(space, offset ^ 1, data);
+ k007232_w(device, offset ^ 1, data);
}
@@ -95,8 +87,8 @@ static ADDRESS_MAP_START( fastlane_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0803, 0x0803) AM_READ_PORT("SYSTEM")
AM_RANGE(0x0900, 0x0900) AM_READ_PORT("DSW1")
AM_RANGE(0x0901, 0x0901) AM_READ_PORT("DSW2")
- AM_RANGE(0x0d00, 0x0d0d) AM_READ(fastlane_k007232_read_port_0_r)/* 007232 registers (chip 1) */
- AM_RANGE(0x0e00, 0x0e0d) AM_READ(fastlane_k007232_read_port_1_r)/* 007232 registers (chip 2) */
+ AM_RANGE(0x0d00, 0x0d0d) AM_DEVREAD(SOUND, "konami1", fastlane_k007232_r)/* 007232 registers (chip 1) */
+ AM_RANGE(0x0e00, 0x0e0d) AM_DEVREAD(SOUND, "konami2", fastlane_k007232_r)/* 007232 registers (chip 2) */
AM_RANGE(0x0f00, 0x0f1f) AM_READ(K051733_r) /* 051733 (protection) */
AM_RANGE(0x1000, 0x1fff) AM_READ(SMH_RAM) /* Palette RAM/Work RAM */
AM_RANGE(0x2000, 0x3fff) AM_READ(SMH_RAM) /* Video RAM + Sprite RAM */
@@ -108,8 +100,8 @@ static ADDRESS_MAP_START( fastlane_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x005f) AM_WRITE(k007121_registers_w) AM_BASE(&fastlane_k007121_regs)/* 007121 registers */
AM_RANGE(0x0b00, 0x0b00) AM_WRITE(watchdog_reset_w) /* watchdog reset */
AM_RANGE(0x0c00, 0x0c00) AM_WRITE(fastlane_bankswitch_w) /* bankswitch control */
- AM_RANGE(0x0d00, 0x0d0d) AM_WRITE(fastlane_k007232_write_port_0_w) /* 007232 registers (chip 1) */
- AM_RANGE(0x0e00, 0x0e0d) AM_WRITE(fastlane_k007232_write_port_1_w) /* 007232 registers (chip 2) */
+ AM_RANGE(0x0d00, 0x0d0d) AM_DEVWRITE(SOUND, "konami1", fastlane_k007232_w) /* 007232 registers (chip 1) */
+ AM_RANGE(0x0e00, 0x0e0d) AM_DEVWRITE(SOUND, "konami2", fastlane_k007232_w) /* 007232 registers (chip 2) */
AM_RANGE(0x0f00, 0x0f1f) AM_WRITE(K051733_w) /* 051733 (protection) */
AM_RANGE(0x1000, 0x17ff) AM_WRITE(SMH_RAM) AM_BASE(&paletteram)/* palette RAM */
AM_RANGE(0x1800, 0x1fff) AM_WRITE(SMH_RAM) /* Work RAM */
@@ -248,16 +240,16 @@ GFXDECODE_END
***************************************************************************/
-static void volume_callback0(int v)
+static void volume_callback0(const device_config *device, int v)
{
- k007232_set_volume(0,0,(v >> 4) * 0x11,0);
- k007232_set_volume(0,1,0,(v & 0x0f) * 0x11);
+ k007232_set_volume(device,0,(v >> 4) * 0x11,0);
+ k007232_set_volume(device,1,0,(v & 0x0f) * 0x11);
}
-static void volume_callback1(int v)
+static void volume_callback1(const device_config *device, int v)
{
- k007232_set_volume(1,0,(v >> 4) * 0x11,0);
- k007232_set_volume(1,1,0,(v & 0x0f) * 0x11);
+ k007232_set_volume(device,0,(v >> 4) * 0x11,0);
+ k007232_set_volume(device,1,0,(v & 0x0f) * 0x11);
}
static const k007232_interface k007232_interface_1 =
diff --git a/src/mame/drivers/fcombat.c b/src/mame/drivers/fcombat.c
index 6530191750e..f3150d96c37 100644
--- a/src/mame/drivers/fcombat.c
+++ b/src/mame/drivers/fcombat.c
@@ -220,15 +220,12 @@ static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM
AM_RANGE(0x4000, 0x47ff) AM_RAM
AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
- AM_RANGE(0x8001, 0x8001) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x8002, 0x8002) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x8003, 0x8003) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xa001, 0xa001) AM_READ(ay8910_read_port_1_r)
- AM_RANGE(0xa002, 0xa002) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0xa003, 0xa003) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0xc001, 0xc001) AM_READ(ay8910_read_port_2_r)
- AM_RANGE(0xc002, 0xc002) AM_WRITE(ay8910_write_port_2_w)
- AM_RANGE(0xc003, 0xc003) AM_WRITE(ay8910_control_port_2_w)
+ AM_RANGE(0x8001, 0x8001) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0x8002, 0x8003) AM_DEVWRITE(SOUND, "ay1", ay8910_data_address_w)
+ AM_RANGE(0xa001, 0xa001) AM_DEVREAD(SOUND, "ay2", ay8910_r)
+ AM_RANGE(0xa002, 0xa003) AM_DEVWRITE(SOUND, "ay2", ay8910_data_address_w)
+ AM_RANGE(0xc001, 0xc001) AM_DEVREAD(SOUND, "ay3", ay8910_r)
+ AM_RANGE(0xc002, 0xc003) AM_DEVWRITE(SOUND, "ay3", ay8910_data_address_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/fcrash.c b/src/mame/drivers/fcrash.c
index e27ed4abeed..bd0facea14c 100644
--- a/src/mame/drivers/fcrash.c
+++ b/src/mame/drivers/fcrash.c
@@ -57,8 +57,8 @@ static WRITE8_HANDLER( fcrash_snd_bankswitch_w )
UINT8 *RAM = memory_region(space->machine, "sound");
int bankaddr;
- sndti_set_output_gain(SOUND_MSM5205, 0, 0, (data & 0x08) ? 0.0 : 1.0);
- sndti_set_output_gain(SOUND_MSM5205, 1, 0, (data & 0x10) ? 0.0 : 1.0);
+ sound_set_output_gain(devtag_get_device(space->machine, SOUND, "msm1"), 0, (data & 0x08) ? 0.0 : 1.0);
+ sound_set_output_gain(devtag_get_device(space->machine, SOUND, "msm2"), 0, (data & 0x10) ? 0.0 : 1.0);
bankaddr = ((data & 7) * 0x4000);
memory_set_bankptr(space->machine, 1,&RAM[0x10000 + bankaddr]);
@@ -66,7 +66,7 @@ static WRITE8_HANDLER( fcrash_snd_bankswitch_w )
static void m5205_int1(const device_config *device)
{
- msm5205_data_w(0, sample_buffer1 & 0x0F);
+ msm5205_data_w(device, sample_buffer1 & 0x0F);
sample_buffer1 >>= 4;
sample_select1 ^= 1;
if (sample_select1 == 0)
@@ -75,7 +75,7 @@ static void m5205_int1(const device_config *device)
static void m5205_int2(const device_config *device)
{
- msm5205_data_w(1, sample_buffer2 & 0x0F);
+ msm5205_data_w(device, sample_buffer2 & 0x0F);
sample_buffer2 >>= 4;
sample_select2 ^= 1;
}
@@ -364,10 +364,8 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1)
AM_RANGE(0xd000, 0xd7ff) AM_RAM
- AM_RANGE(0xd800, 0xd800) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0xd801, 0xd801) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
- AM_RANGE(0xdc00, 0xdc00) AM_READWRITE(ym2203_status_port_1_r, ym2203_control_port_1_w)
- AM_RANGE(0xdc01, 0xdc01) AM_READWRITE(ym2203_read_port_1_r, ym2203_write_port_1_w)
+ AM_RANGE(0xd800, 0xd801) AM_DEVREADWRITE(SOUND, "ym1", ym2203_r, ym2203_w)
+ AM_RANGE(0xdc00, 0xdc01) AM_DEVREADWRITE(SOUND, "ym2", ym2203_r, ym2203_w)
AM_RANGE(0xe000, 0xe000) AM_WRITE(fcrash_snd_bankswitch_w)
AM_RANGE(0xe400, 0xe400) AM_READ(soundlatch_r)
AM_RANGE(0xe800, 0xe800) AM_WRITE(fcrash_msm5205_0_data_w)
diff --git a/src/mame/drivers/feversoc.c b/src/mame/drivers/feversoc.c
index b87efde50f0..9c4cfd7ab87 100644
--- a/src/mame/drivers/feversoc.c
+++ b/src/mame/drivers/feversoc.c
@@ -134,7 +134,7 @@ static WRITE32_HANDLER( output_w )
//data>>16 & 2 coin out
coin_counter_w(1,data>>16 & 4);
//data>>16 & 8 coin hopper
- okim6295_set_bank_base(0, 0x40000 * (((data>>16) & 0x20)>>5));
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki"), 0x40000 * (((data>>16) & 0x20)>>5));
}
if(ACCESSING_BITS_0_15)
{
@@ -151,7 +151,7 @@ static ADDRESS_MAP_START( feversoc_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x06000000, 0x06000003) AM_WRITE(output_w)
AM_RANGE(0x06000004, 0x06000007) AM_WRITENOP //???
AM_RANGE(0x06000008, 0x0600000b) AM_READ(in0_r)
- AM_RANGE(0x0600000c, 0x0600000f) AM_READWRITE16(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w,0xffff0000)
+ AM_RANGE(0x0600000c, 0x0600000f) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff0000)
// AM_RANGE(0x06010000, 0x06017fff) AM_RAM //contains RISE11 keys and other related stuff.
AM_RANGE(0x06018000, 0x06019fff) AM_RAM_WRITE(fs_paletteram_w) AM_BASE(&paletteram32)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/finalizr.c b/src/mame/drivers/finalizr.c
index 68cca6173f2..8a42e9e01f2 100644
--- a/src/mame/drivers/finalizr.c
+++ b/src/mame/drivers/finalizr.c
@@ -113,7 +113,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0813, 0x0813) AM_READ_PORT("DSW1")
AM_RANGE(0x0818, 0x0818) AM_WRITE(watchdog_reset_w)
AM_RANGE(0x0819, 0x0819) AM_WRITE(finalizr_coin_w)
- AM_RANGE(0x081a, 0x081a) AM_WRITE(sn76496_0_w) /* This address triggers the SN chip to read the data port. */
+ AM_RANGE(0x081a, 0x081a) AM_DEVWRITE(SOUND, "sn", sn76496_w) /* This address triggers the SN chip to read the data port. */
AM_RANGE(0x081b, 0x081b) AM_WRITE(SMH_NOP) /* Loads the snd command into the snd latch */
AM_RANGE(0x081c, 0x081c) AM_WRITE(finalizr_i8039_irq_w) /* custom sound chip */
AM_RANGE(0x081d, 0x081d) AM_WRITE(soundlatch_w) /* custom sound chip */
@@ -134,7 +134,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0xff) AM_READ(soundlatch_r)
- AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(dac_0_data_w)
+ AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE(SOUND, "dac", dac_w)
AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(i8039_irqen_w)
AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_WRITE(i8039_T0_w)
AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(i8039_T1_r)
diff --git a/src/mame/drivers/findout.c b/src/mame/drivers/findout.c
index 40ee2989073..846e22b54ae 100644
--- a/src/mame/drivers/findout.c
+++ b/src/mame/drivers/findout.c
@@ -101,7 +101,7 @@ static WRITE8_DEVICE_HANDLER( sound_w )
interrupt_enable_w(space, 0,data & 0x40);
/* bit 7 goes directly to the sound amplifier */
- dac_data_w(0,((data & 0x80) >> 7) * 255);
+ dac_data_w(devtag_get_device(device->machine, SOUND, "dac"), ((data & 0x80) >> 7) * 255);
// logerror("%s: sound_w %02x\n",cpuexec_describe_context(device->machine),data);
// popmessage("%02x",data);
diff --git a/src/mame/drivers/firebeat.c b/src/mame/drivers/firebeat.c
index 1c1d4f4055f..5bcc2d847ae 100644
--- a/src/mame/drivers/firebeat.c
+++ b/src/mame/drivers/firebeat.c
@@ -1331,37 +1331,6 @@ static WRITE32_HANDLER( rtc_w )
/*****************************************************************************/
-static READ32_HANDLER( sound_r )
-{
- UINT32 r = 0;
-
-// printf("sound_r: %08X, %08X\n", offset, mem_mask);
-
- if (ACCESSING_BITS_24_31) /* External RAM read */
- {
- r |= ymz280b_data_0_r(space, offset) << 24;
- }
- if (ACCESSING_BITS_16_23)
- {
- r |= ymz280b_status_0_r(space, offset) << 16;
- }
-
- return r;
-}
-
-static WRITE32_HANDLER( sound_w )
-{
-// printf("sound_w: %08X, %08X, %08X\n", offset, data, mem_mask);
- if (ACCESSING_BITS_24_31)
- {
- ymz280b_register_0_w(space, offset, (data >> 24) & 0xff);
- }
- if (ACCESSING_BITS_16_23)
- {
- ymz280b_data_0_w(space, offset, (data >> 16) & 0xff);
- }
-}
-
static const int cab_data[2] = { 0x0, 0x8 };
static const int kbm_cab_data[2] = { 0x2, 0x8 };
static const int ppd_cab_data[2] = { 0x1, 0x9 };
@@ -1783,7 +1752,7 @@ static ADDRESS_MAP_START( firebeat_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x74000000, 0x740003ff) AM_READWRITE(ppc_spu_share_r, ppc_spu_share_w) // SPU shared RAM
AM_RANGE(0x7d000200, 0x7d00021f) AM_READ(cabinet_r)
AM_RANGE(0x7d000340, 0x7d000347) AM_READ(sensor_r)
- AM_RANGE(0x7d000400, 0x7d000403) AM_READWRITE(sound_r, sound_w)
+ AM_RANGE(0x7d000400, 0x7d000403) AM_DEVREADWRITE8(SOUND, "ymz", ymz280b_r, ymz280b_w, 0xffff0000)
AM_RANGE(0x7d000800, 0x7d000803) AM_READ(input_r)
AM_RANGE(0x7d400000, 0x7d5fffff) AM_READWRITE(flashram_r, flashram_w)
AM_RANGE(0x7d800000, 0x7dbfffff) AM_READWRITE(soundflash_r, soundflash_w)
@@ -1817,19 +1786,14 @@ static READ8_DEVICE_HANDLER( soundram_r )
return 0;
}
-static WRITE8_DEVICE_HANDLER( soundram_w )
-{
-}
-
-static void sound_irq_callback(running_machine *machine, int state)
+static void sound_irq_callback(const device_config *device, int state)
{
}
static const ymz280b_interface ymz280b_intf =
{
sound_irq_callback, // irq
- soundram_r,
- soundram_w,
+ DEVCB_HANDLER(soundram_r)
};
static NVRAM_HANDLER(firebeat)
@@ -2012,7 +1976,7 @@ static MACHINE_RESET( firebeat )
}
SCSIGetDevice( atapi_device_data[1], &cd );
- cdda_set_cdrom(0, cd);
+ cdda_set_cdrom(devtag_get_device(machine, SOUND, "cdda"), cd);
}
static MACHINE_DRIVER_START(firebeat)
diff --git a/src/mame/drivers/firefox.c b/src/mame/drivers/firefox.c
index abe2acfb82a..168c1a5d397 100644
--- a/src/mame/drivers/firefox.c
+++ b/src/mame/drivers/firefox.c
@@ -102,7 +102,7 @@ static WRITE8_HANDLER( firefox_disc_lock_w )
static WRITE8_HANDLER( audio_enable_w )
{
- sndti_set_output_gain(SOUND_CUSTOM, 0, ~offset & 1, (data & 0x80) ? 1.0 : 0.0);
+ sound_set_output_gain(devtag_get_device(space->machine, SOUND, "ldsound"), ~offset & 1, (data & 0x80) ? 1.0 : 0.0);
}
static WRITE8_HANDLER( firefox_disc_reset_w )
@@ -300,22 +300,23 @@ static UINT8 riot_porta_r(const device_config *device, UINT8 olddata)
/* bit 2 = TMS /ready */
/* bit 1 = TMS /read */
/* bit 0 = TMS /write */
-
- return (main_to_sound_flag << 7) | (sound_to_main_flag << 6) | 0x10 | (!tms5220_ready_r() << 2);
+
+ const device_config *tms = devtag_get_device(device->machine, SOUND, "tms");
+ return (main_to_sound_flag << 7) | (sound_to_main_flag << 6) | 0x10 | (!tms5220_ready_r(tms) << 2);
}
static void riot_porta_w(const device_config *device, UINT8 newdata, UINT8 olddata)
{
- const address_space *space = cpu_get_address_space(device->machine->cpu[1], ADDRESS_SPACE_PROGRAM);
+ const device_config *tms = devtag_get_device(device->machine, SOUND, "tms");
/* handle 5220 read */
if ((olddata & 2) != 0 && (newdata & 2) == 0)
- riot6532_portb_in_set(device, tms5220_status_r(space, 0), 0xff);
+ riot6532_portb_in_set(device, tms5220_status_r(tms, 0), 0xff);
/* handle 5220 write */
if ((olddata & 1) != 0 && (newdata & 1) == 0)
- tms5220_data_w(space, 0, riot6532_portb_out_get(device));
+ tms5220_data_w(tms, 0, riot6532_portb_out_get(device));
}
@@ -505,10 +506,10 @@ static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0880, 0x089f) AM_MIRROR(0x07e0) AM_DEVREADWRITE(RIOT6532,"riot",riot6532_r, riot6532_w)
AM_RANGE(0x1000, 0x1000) AM_READ(main_to_sound_r)
AM_RANGE(0x1800, 0x1800) AM_WRITE(sound_to_main_w)
- AM_RANGE(0x2000, 0x200f) AM_READWRITE(pokey1_r, pokey1_w)
- AM_RANGE(0x2800, 0x280f) AM_READWRITE(pokey2_r, pokey2_w)
- AM_RANGE(0x3000, 0x300f) AM_READWRITE(pokey3_r, pokey3_w)
- AM_RANGE(0x3800, 0x380f) AM_READWRITE(pokey4_r, pokey4_w)
+ AM_RANGE(0x2000, 0x200f) AM_DEVREADWRITE(SOUND, "pokey1", pokey_r, pokey_w)
+ AM_RANGE(0x2800, 0x280f) AM_DEVREADWRITE(SOUND, "pokey2", pokey_r, pokey_w)
+ AM_RANGE(0x3000, 0x300f) AM_DEVREADWRITE(SOUND, "pokey3", pokey_r, pokey_w)
+ AM_RANGE(0x3800, 0x380f) AM_DEVREADWRITE(SOUND, "pokey4", pokey_r, pokey_w)
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -702,8 +703,7 @@ static MACHINE_DRIVER_START( firefox )
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.75)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.75)
- MDRV_SOUND_ADD("ldsound", CUSTOM, 0)
- MDRV_SOUND_CONFIG(laserdisc_custom_interface)
+ MDRV_SOUND_ADD("ldsound", LASERDISC, 0)
MDRV_SOUND_ROUTE(0, "left", 0.50)
MDRV_SOUND_ROUTE(1, "right", 0.50)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/firetrap.c b/src/mame/drivers/firetrap.c
index f4a2b4fd68d..f7c97971c28 100644
--- a/src/mame/drivers/firetrap.c
+++ b/src/mame/drivers/firetrap.c
@@ -60,7 +60,7 @@ write:
#include "cpu/z80/z80.h"
#include "deprecat.h"
#include "cpu/m6502/m6502.h"
-#include "sound/3812intf.h"
+#include "sound/3526intf.h"
#include "sound/msm5205.h"
@@ -206,7 +206,7 @@ static WRITE8_HANDLER( firetrap_sound_command_w )
static WRITE8_HANDLER( firetrap_sound_2400_w )
{
- msm5205_reset_w(offset,~data & 0x01);
+ msm5205_reset_w(devtag_get_device(space->machine, SOUND, "msm"),~data & 0x01);
firetrap_irq_enable = data & 0x02;
}
@@ -225,7 +225,7 @@ static void firetrap_adpcm_int (const device_config *device)
{
static int toggle=0;
- msm5205_data_w (0,msm5205next>>4);
+ msm5205_data_w (device,msm5205next>>4);
msm5205next<<=4;
toggle ^= 1;
@@ -317,8 +317,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x1000, 0x1000) AM_WRITE(ym3526_control_port_0_w)
- AM_RANGE(0x1001, 0x1001) AM_WRITE(ym3526_write_port_0_w)
+ AM_RANGE(0x1000, 0x1001) AM_DEVWRITE(SOUND, "ym", ym3526_w)
AM_RANGE(0x2000, 0x2000) AM_WRITE(firetrap_adpcm_data_w) /* ADPCM data for the MSM5205 chip */
AM_RANGE(0x2400, 0x2400) AM_WRITE(firetrap_sound_2400_w)
AM_RANGE(0x2800, 0x2800) AM_WRITE(firetrap_sound_bankselect_w)
diff --git a/src/mame/drivers/firetrk.c b/src/mame/drivers/firetrk.c
index efabcf07748..9107edc318d 100644
--- a/src/mame/drivers/firetrk.c
+++ b/src/mame/drivers/firetrk.c
@@ -39,9 +39,8 @@ static INPUT_CHANGED( service_mode_switch_changed )
static INPUT_CHANGED( firetrk_horn_changed )
{
- const address_space *space = cpu_get_address_space(field->port->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
-
- discrete_sound_w(space, FIRETRUCK_HORN_EN, newval);
+ const device_config *discrete = devtag_get_device(field->port->machine, SOUND, "discrete");
+ discrete_sound_w(discrete, FIRETRUCK_HORN_EN, newval);
}
@@ -55,7 +54,7 @@ static INPUT_CHANGED( gear_changed )
static INTERRUPT_GEN( firetrk_interrupt )
{
/* Super Bug - ASR - when is this used and what is an ASR? */
-// discrete_sound_w(machine, SUPERBUG_ASR_EN, 0);
+// discrete_sound_w(devtag_get_device(machine, SOUND, "discrete"), SUPERBUG_ASR_EN, 0);
/* NMI interrupts are disabled during service mode in firetrk and montecar */
if (!in_service_mode)
@@ -81,6 +80,8 @@ static TIMER_CALLBACK( periodic_callback )
static WRITE8_HANDLER( firetrk_output_w )
{
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+
/* BIT0 => START1 LAMP */
set_led_status(0, !(data & 0x01));
@@ -94,7 +95,7 @@ static WRITE8_HANDLER( firetrk_output_w )
set_led_status(3, !(data & 0x08));
/* BIT4 => ATTRACT */
- discrete_sound_w(space, FIRETRUCK_ATTRACT_EN, data & 0x10);
+ discrete_sound_w(discrete, FIRETRUCK_ATTRACT_EN, data & 0x10);
coin_lockout_w(0, !(data & 0x10));
coin_lockout_w(1, !(data & 0x10));
@@ -104,17 +105,19 @@ static WRITE8_HANDLER( firetrk_output_w )
/* BIT6 => UNUSED */
/* BIT7 => BELL OUT */
- discrete_sound_w(space, FIRETRUCK_BELL_EN, data & 0x80);
+ discrete_sound_w(discrete, FIRETRUCK_BELL_EN, data & 0x80);
}
static WRITE8_HANDLER( superbug_output_w )
{
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+
/* BIT0 => START LAMP */
set_led_status(0, offset & 0x01);
/* BIT1 => ATTRACT */
- discrete_sound_w(space, SUPERBUG_ATTRACT_EN, offset & 0x02);
+ discrete_sound_w(discrete, SUPERBUG_ATTRACT_EN, offset & 0x02);
coin_lockout_w(0, !(offset & 0x02));
coin_lockout_w(1, !(offset & 0x02));
@@ -128,6 +131,8 @@ static WRITE8_HANDLER( superbug_output_w )
static WRITE8_HANDLER( montecar_output_1_w )
{
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+
/* BIT0 => START LAMP */
set_led_status(0, !(data & 0x01));
@@ -135,7 +140,7 @@ static WRITE8_HANDLER( montecar_output_1_w )
set_led_status(1, !(data & 0x02));
/* BIT2 => ATTRACT */
- discrete_sound_w(space, MONTECAR_ATTRACT_INV, data & 0x04);
+ discrete_sound_w(discrete, MONTECAR_ATTRACT_INV, data & 0x04);
/* BIT3 => UNUSED */
/* BIT4 => UNUSED */
@@ -153,10 +158,12 @@ static WRITE8_HANDLER( montecar_output_1_w )
static WRITE8_HANDLER( montecar_output_2_w )
{
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+
firetrk_flash = data & 0x80;
- discrete_sound_w(space, MONTECAR_BEEPER_EN, data & 0x10);
- discrete_sound_w(space, MONTECAR_DRONE_LOUD_DATA, data & 0x0f);
+ discrete_sound_w(discrete, MONTECAR_BEEPER_EN, data & 0x10);
+ discrete_sound_w(discrete, MONTECAR_DRONE_LOUD_DATA, data & 0x0f);
}
@@ -319,19 +326,19 @@ static ADDRESS_MAP_START( firetrk_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x001f) AM_WRITE(SMH_RAM) AM_BASE(&firetrk_scroll_y)
AM_RANGE(0x1020, 0x1020) AM_MIRROR(0x001f) AM_WRITE(SMH_RAM) AM_BASE(&firetrk_scroll_x)
AM_RANGE(0x1040, 0x1040) AM_MIRROR(0x001f) AM_WRITE(crash_reset_w)
- AM_RANGE(0x1060, 0x1060) AM_MIRROR(0x001f) AM_WRITE(firetrk_skid_reset_w)
+ AM_RANGE(0x1060, 0x1060) AM_MIRROR(0x001f) AM_DEVWRITE(SOUND, "discrete", firetrk_skid_reset_w)
AM_RANGE(0x1080, 0x1080) AM_MIRROR(0x001f) AM_WRITE(SMH_RAM) AM_BASE(&firetrk_car_rot)
AM_RANGE(0x10a0, 0x10a0) AM_MIRROR(0x001f) AM_WRITE(steer_reset_w)
AM_RANGE(0x10c0, 0x10c0) AM_MIRROR(0x001f) AM_WRITE(watchdog_reset_w)
AM_RANGE(0x10e0, 0x10e0) AM_MIRROR(0x001f) AM_WRITE(blink_on_w) AM_BASE(&firetrk_blink)
- AM_RANGE(0x1400, 0x1400) AM_MIRROR(0x001f) AM_WRITE(firetrk_motor_snd_w)
- AM_RANGE(0x1420, 0x1420) AM_MIRROR(0x001f) AM_WRITE(firetrk_crash_snd_w)
- AM_RANGE(0x1440, 0x1440) AM_MIRROR(0x001f) AM_WRITE(firetrk_skid_snd_w)
+ AM_RANGE(0x1400, 0x1400) AM_MIRROR(0x001f) AM_DEVWRITE(SOUND, "discrete", firetrk_motor_snd_w)
+ AM_RANGE(0x1420, 0x1420) AM_MIRROR(0x001f) AM_DEVWRITE(SOUND, "discrete", firetrk_crash_snd_w)
+ AM_RANGE(0x1440, 0x1440) AM_MIRROR(0x001f) AM_DEVWRITE(SOUND, "discrete", firetrk_skid_snd_w)
AM_RANGE(0x1460, 0x1460) AM_MIRROR(0x001f) AM_WRITE(SMH_RAM) AM_BASE(&firetrk_drone_x)
AM_RANGE(0x1480, 0x1480) AM_MIRROR(0x001f) AM_WRITE(SMH_RAM) AM_BASE(&firetrk_drone_y)
AM_RANGE(0x14a0, 0x14a0) AM_MIRROR(0x001f) AM_WRITE(SMH_RAM) AM_BASE(&firetrk_drone_rot)
AM_RANGE(0x14c0, 0x14c0) AM_MIRROR(0x001f) AM_WRITE(firetrk_output_w)
- AM_RANGE(0x14e0, 0x14e0) AM_MIRROR(0x001f) AM_WRITE(firetrk_xtndply_w)
+ AM_RANGE(0x14e0, 0x14e0) AM_MIRROR(0x001f) AM_DEVWRITE(SOUND, "discrete", firetrk_xtndply_w)
AM_RANGE(0x1800, 0x1807) AM_MIRROR(0x03f8) AM_READWRITE(firetrk_input_r, SMH_NOP)
AM_RANGE(0x1c00, 0x1c03) AM_MIRROR(0x03fc) AM_READ(firetrk_dip_r)
AM_RANGE(0x2000, 0x3fff) AM_ROM
@@ -344,18 +351,18 @@ static ADDRESS_MAP_START( superbug_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0100, 0x0100) AM_MIRROR(0x001f) AM_WRITE(SMH_RAM) AM_BASE(&firetrk_scroll_y)
AM_RANGE(0x0120, 0x0120) AM_MIRROR(0x001f) AM_WRITE(SMH_RAM) AM_BASE(&firetrk_scroll_x)
AM_RANGE(0x0140, 0x0140) AM_MIRROR(0x001f) AM_WRITE(crash_reset_w)
- AM_RANGE(0x0160, 0x0160) AM_MIRROR(0x001f) AM_WRITE(firetrk_skid_reset_w)
+ AM_RANGE(0x0160, 0x0160) AM_MIRROR(0x001f) AM_DEVWRITE(SOUND, "discrete", firetrk_skid_reset_w)
AM_RANGE(0x0180, 0x0180) AM_MIRROR(0x001f) AM_WRITE(SMH_RAM) AM_BASE(&firetrk_car_rot)
AM_RANGE(0x01a0, 0x01a0) AM_MIRROR(0x001f) AM_WRITE(steer_reset_w)
AM_RANGE(0x01c0, 0x01c0) AM_MIRROR(0x001f) AM_WRITE(watchdog_reset_w)
AM_RANGE(0x01e0, 0x01e0) AM_MIRROR(0x001f) AM_WRITE(blink_on_w) AM_BASE(&firetrk_blink)
AM_RANGE(0x0200, 0x0207) AM_MIRROR(0x0018) AM_READ(firetrk_input_r)
- AM_RANGE(0x0220, 0x0220) AM_MIRROR(0x001f) AM_WRITE(superbug_asr_w)
+ AM_RANGE(0x0220, 0x0220) AM_MIRROR(0x001f) AM_DEVWRITE(SOUND, "discrete", superbug_asr_w)
AM_RANGE(0x0240, 0x0243) AM_MIRROR(0x001c) AM_READ(firetrk_dip_r)
AM_RANGE(0x0260, 0x026f) AM_MIRROR(0x0010) AM_WRITE(superbug_output_w)
- AM_RANGE(0x0280, 0x0280) AM_MIRROR(0x001f) AM_WRITE(superbug_motor_snd_w)
- AM_RANGE(0x02a0, 0x02a0) AM_MIRROR(0x001f) AM_WRITE(firetrk_crash_snd_w)
- AM_RANGE(0x02c0, 0x02c0) AM_MIRROR(0x001f) AM_WRITE(firetrk_skid_snd_w)
+ AM_RANGE(0x0280, 0x0280) AM_MIRROR(0x001f) AM_DEVWRITE(SOUND, "discrete", superbug_motor_snd_w)
+ AM_RANGE(0x02a0, 0x02a0) AM_MIRROR(0x001f) AM_DEVWRITE(SOUND, "discrete", firetrk_crash_snd_w)
+ AM_RANGE(0x02c0, 0x02c0) AM_MIRROR(0x001f) AM_DEVWRITE(SOUND, "discrete", firetrk_skid_snd_w)
AM_RANGE(0x0400, 0x041f) AM_RAM AM_BASE(&firetrk_alpha_num_ram)
AM_RANGE(0x0500, 0x05ff) AM_RAM AM_BASE(&firetrk_playfield_ram)
AM_RANGE(0x0800, 0x1fff) AM_ROM
@@ -373,10 +380,10 @@ static ADDRESS_MAP_START( montecar_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1080, 0x1080) AM_MIRROR(0x001f) AM_WRITE(SMH_RAM) AM_BASE(&firetrk_car_rot)
AM_RANGE(0x10a0, 0x10a0) AM_MIRROR(0x001f) AM_WRITE(steer_reset_w)
AM_RANGE(0x10c0, 0x10c0) AM_MIRROR(0x001f) AM_WRITE(watchdog_reset_w)
- AM_RANGE(0x10e0, 0x10e0) AM_MIRROR(0x001f) AM_WRITE(montecar_skid_reset_w)
- AM_RANGE(0x1400, 0x1400) AM_MIRROR(0x001f) AM_WRITE(firetrk_motor_snd_w)
- AM_RANGE(0x1420, 0x1420) AM_MIRROR(0x001f) AM_WRITE(firetrk_crash_snd_w)
- AM_RANGE(0x1440, 0x1440) AM_MIRROR(0x001f) AM_WRITE(firetrk_skid_snd_w)
+ AM_RANGE(0x10e0, 0x10e0) AM_MIRROR(0x001f) AM_DEVWRITE(SOUND, "discrete", montecar_skid_reset_w)
+ AM_RANGE(0x1400, 0x1400) AM_MIRROR(0x001f) AM_DEVWRITE(SOUND, "discrete", firetrk_motor_snd_w)
+ AM_RANGE(0x1420, 0x1420) AM_MIRROR(0x001f) AM_DEVWRITE(SOUND, "discrete", firetrk_crash_snd_w)
+ AM_RANGE(0x1440, 0x1440) AM_MIRROR(0x001f) AM_DEVWRITE(SOUND, "discrete", firetrk_skid_snd_w)
AM_RANGE(0x1460, 0x1460) AM_MIRROR(0x001f) AM_WRITE(SMH_RAM) AM_BASE(&firetrk_drone_x)
AM_RANGE(0x1480, 0x1480) AM_MIRROR(0x001f) AM_WRITE(SMH_RAM) AM_BASE(&firetrk_drone_y)
AM_RANGE(0x14a0, 0x14a0) AM_MIRROR(0x001f) AM_WRITE(SMH_RAM) AM_BASE(&firetrk_drone_rot)
diff --git a/src/mame/drivers/flkatck.c b/src/mame/drivers/flkatck.c
index dc7d67d7d09..a58349fc96c 100644
--- a/src/mame/drivers/flkatck.c
+++ b/src/mame/drivers/flkatck.c
@@ -31,7 +31,7 @@ static int multiply_reg[2];
static MACHINE_RESET( flkatck )
{
- k007232_set_bank( 0, 0, 1 );
+ k007232_set_bank( devtag_get_device(machine, SOUND, "konami"), 0, 1 );
}
static INTERRUPT_GEN( flkatck_interrupt )
@@ -133,8 +133,8 @@ static ADDRESS_MAP_START( flkatck_readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
// AM_RANGE(0x9001, 0x9001) AM_READ(SMH_RAM) /* ??? */
AM_RANGE(0x9004, 0x9004) AM_READ(SMH_RAM) /* ??? */
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r) /* soundlatch_r */
- AM_RANGE(0xb000, 0xb00d) AM_READ(k007232_read_port_0_r) /* 007232 registers */
- AM_RANGE(0xc001, 0xc001) AM_READ(ym2151_status_port_0_r) /* YM2151 */
+ AM_RANGE(0xb000, 0xb00d) AM_DEVREAD(SOUND, "konami", k007232_r) /* 007232 registers */
+ AM_RANGE(0xc000, 0xc001) AM_DEVREAD(SOUND, "ym", ym2151_r) /* YM2151 */
ADDRESS_MAP_END
static ADDRESS_MAP_START( flkatck_writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
@@ -143,9 +143,8 @@ static ADDRESS_MAP_START( flkatck_writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x9000, 0x9001) AM_WRITE(multiply_w) /* ??? */
// AM_RANGE(0x9001, 0x9001) AM_WRITE(SMH_RAM) /* ??? */
AM_RANGE(0x9006, 0x9006) AM_WRITE(SMH_RAM) /* ??? */
- AM_RANGE(0xb000, 0xb00d) AM_WRITE(k007232_write_port_0_w) /* 007232 registers */
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym2151_register_port_0_w) /* YM2151 */
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ym2151_data_port_0_w) /* YM2151 */
+ AM_RANGE(0xb000, 0xb00d) AM_DEVWRITE(SOUND, "konami", k007232_w) /* 007232 registers */
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ym", ym2151_w) /* YM2151 */
ADDRESS_MAP_END
@@ -268,10 +267,10 @@ static GFXDECODE_START( flkatck )
GFXDECODE_ENTRY( "gfx1", 0, gfxlayout, 0, 32 )
GFXDECODE_END
-static void volume_callback0(int v)
+static void volume_callback0(const device_config *device, int v)
{
- k007232_set_volume(0,0,(v >> 4) * 0x11,0);
- k007232_set_volume(0,1,0,(v & 0x0f) * 0x11);
+ k007232_set_volume(device,0,(v >> 4) * 0x11,0);
+ k007232_set_volume(device,1,0,(v & 0x0f) * 0x11);
}
static const k007232_interface k007232_config =
diff --git a/src/mame/drivers/flower.c b/src/mame/drivers/flower.c
index d2728eb21a3..aeb7ebc9aad 100644
--- a/src/mame/drivers/flower.c
+++ b/src/mame/drivers/flower.c
@@ -232,11 +232,6 @@ static GFXDECODE_START( flower )
GFXDECODE_ENTRY( "gfx3", 0, flower_tilelayout, 0, 16 )
GFXDECODE_END
-static const custom_sound_interface custom_interface =
-{
- flower_sh_start
-};
-
static INTERRUPT_GEN( flower_cpu0_interrupt )
{
cpu_set_input_line(device, 0, ASSERT_LINE);
@@ -278,8 +273,7 @@ static MACHINE_DRIVER_START( flower )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("flower", CUSTOM, 0)
- MDRV_SOUND_CONFIG(custom_interface)
+ MDRV_SOUND_ADD("flower", FLOWER, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/flstory.c b/src/mame/drivers/flstory.c
index fc7df384a57..90bb1057e14 100644
--- a/src/mame/drivers/flstory.c
+++ b/src/mame/drivers/flstory.c
@@ -189,29 +189,29 @@ static UINT8 snd_ctrl1=0;
static UINT8 snd_ctrl2=0;
static UINT8 snd_ctrl3=0;
-static WRITE8_HANDLER( sound_control_0_w )
+static WRITE8_DEVICE_HANDLER( sound_control_0_w )
{
snd_ctrl0 = data & 0xff;
// popmessage("SND0 0=%02x 1=%02x 2=%02x 3=%02x", snd_ctrl0, snd_ctrl1, snd_ctrl2, snd_ctrl3);
/* this definitely controls main melody voice on 2'-1 and 4'-1 outputs */
- sndti_set_output_gain(SOUND_MSM5232, 0, 0, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group1 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 1, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group1 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 2, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group1 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 3, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group1 from msm5232 */
+ sound_set_output_gain(device, 0, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group1 from msm5232 */
+ sound_set_output_gain(device, 1, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group1 from msm5232 */
+ sound_set_output_gain(device, 2, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group1 from msm5232 */
+ sound_set_output_gain(device, 3, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group1 from msm5232 */
}
-static WRITE8_HANDLER( sound_control_1_w )
+static WRITE8_DEVICE_HANDLER( sound_control_1_w )
{
snd_ctrl1 = data & 0xff;
// popmessage("SND1 0=%02x 1=%02x 2=%02x 3=%02x", snd_ctrl0, snd_ctrl1, snd_ctrl2, snd_ctrl3);
- sndti_set_output_gain(SOUND_MSM5232, 0, 4, vol_ctrl[ (snd_ctrl1>>4) & 15 ] / 100.0); /* group2 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 5, vol_ctrl[ (snd_ctrl1>>4) & 15 ] / 100.0); /* group2 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 6, vol_ctrl[ (snd_ctrl1>>4) & 15 ] / 100.0); /* group2 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 7, vol_ctrl[ (snd_ctrl1>>4) & 15 ] / 100.0); /* group2 from msm5232 */
+ sound_set_output_gain(device, 4, vol_ctrl[ (snd_ctrl1>>4) & 15 ] / 100.0); /* group2 from msm5232 */
+ sound_set_output_gain(device, 5, vol_ctrl[ (snd_ctrl1>>4) & 15 ] / 100.0); /* group2 from msm5232 */
+ sound_set_output_gain(device, 6, vol_ctrl[ (snd_ctrl1>>4) & 15 ] / 100.0); /* group2 from msm5232 */
+ sound_set_output_gain(device, 7, vol_ctrl[ (snd_ctrl1>>4) & 15 ] / 100.0); /* group2 from msm5232 */
}
-static WRITE8_HANDLER( sound_control_2_w )
+static WRITE8_DEVICE_HANDLER( sound_control_2_w )
{
int i;
@@ -219,10 +219,10 @@ static WRITE8_HANDLER( sound_control_2_w )
// popmessage("SND2 0=%02x 1=%02x 2=%02x 3=%02x", snd_ctrl0, snd_ctrl1, snd_ctrl2, snd_ctrl3);
for (i=0; i<3; i++)
- sndti_set_output_gain (SOUND_AY8910, 0, i, vol_ctrl[ (snd_ctrl2>>4) & 15 ] / 100.0); /* ym2149f all */
+ sound_set_output_gain (device, i, vol_ctrl[ (snd_ctrl2>>4) & 15 ] / 100.0); /* ym2149f all */
}
-static WRITE8_HANDLER( sound_control_3_w ) /* unknown */
+static WRITE8_DEVICE_HANDLER( sound_control_3_w ) /* unknown */
{
snd_ctrl3 = data & 0xff;
// popmessage("SND3 0=%02x 1=%02x 2=%02x 3=%02x", snd_ctrl0, snd_ctrl1, snd_ctrl2, snd_ctrl3);
@@ -232,15 +232,14 @@ static WRITE8_HANDLER( sound_control_3_w ) /* unknown */
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xc7ff) AM_RAM
- AM_RANGE(0xc800, 0xc800) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xc801, 0xc801) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xca00, 0xca0d) AM_WRITE(msm5232_0_w)
- AM_RANGE(0xcc00, 0xcc00) AM_WRITE(sound_control_0_w)
- AM_RANGE(0xce00, 0xce00) AM_WRITE(sound_control_1_w)
+ AM_RANGE(0xc800, 0xc801) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0xca00, 0xca0d) AM_DEVWRITE(SOUND, "msm", msm5232_w)
+ AM_RANGE(0xcc00, 0xcc00) AM_DEVWRITE(SOUND, "msm", sound_control_0_w)
+ AM_RANGE(0xce00, 0xce00) AM_DEVWRITE(SOUND, "msm", sound_control_1_w)
AM_RANGE(0xd800, 0xd800) AM_READWRITE(soundlatch_r, to_main_w)
AM_RANGE(0xda00, 0xda00) AM_READWRITE(SMH_NOP, nmi_enable_w) /* unknown read*/
AM_RANGE(0xdc00, 0xdc00) AM_WRITE(nmi_disable_w)
- AM_RANGE(0xde00, 0xde00) AM_READWRITE(SMH_NOP, dac_0_signed_data_w) /* signed 8-bit DAC & unknown read */
+ AM_RANGE(0xde00, 0xde00) AM_READNOP AM_DEVWRITE(SOUND, "dac", dac_w) /* signed 8-bit DAC & unknown read */
AM_RANGE(0xe000, 0xefff) AM_ROM /* space for diagnostics ROM */
ADDRESS_MAP_END
@@ -641,10 +640,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- sound_control_2_w,
- sound_control_3_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_DEVICE_HANDLER(SOUND, "ay", sound_control_2_w),
+ DEVCB_HANDLER(sound_control_3_w)
};
static const msm5232_interface msm5232_config =
diff --git a/src/mame/drivers/foodf.c b/src/mame/drivers/foodf.c
index a6183bb1ac9..5713c58cd64 100644
--- a/src/mame/drivers/foodf.c
+++ b/src/mame/drivers/foodf.c
@@ -210,22 +210,6 @@ static WRITE16_HANDLER( analog_w )
/*************************************
*
- * POKEY I/O
- *
- *************************************/
-
-static READ16_HANDLER( pokey1_word_r ) { return pokey1_r(space, offset); }
-static READ16_HANDLER( pokey2_word_r ) { return pokey2_r(space, offset); }
-static READ16_HANDLER( pokey3_word_r ) { return pokey3_r(space, offset); }
-
-static WRITE16_HANDLER( pokey1_word_w ) { if (ACCESSING_BITS_0_7) pokey1_w(space, offset, data & 0xff); }
-static WRITE16_HANDLER( pokey2_word_w ) { if (ACCESSING_BITS_0_7) pokey2_w(space, offset, data & 0xff); }
-static WRITE16_HANDLER( pokey3_word_w ) { if (ACCESSING_BITS_0_7) pokey3_w(space, offset, data & 0xff); }
-
-
-
-/*************************************
- *
* Main CPU memory handlers
*
*************************************/
@@ -243,9 +227,9 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x950000, 0x9501ff) AM_MIRROR(0x023e00) AM_WRITE(foodf_paletteram_w) AM_BASE(&paletteram16)
AM_RANGE(0x954000, 0x954001) AM_MIRROR(0x023ffe) AM_WRITENOP /* RECALL */
AM_RANGE(0x958000, 0x958001) AM_MIRROR(0x023ffe) AM_READWRITE(watchdog_reset16_r, watchdog_reset16_w)
- AM_RANGE(0xa40000, 0xa4001f) AM_MIRROR(0x03ffe0) AM_READWRITE(pokey2_word_r, pokey2_word_w)
- AM_RANGE(0xa80000, 0xa8001f) AM_MIRROR(0x03ffe0) AM_READWRITE(pokey1_word_r, pokey1_word_w)
- AM_RANGE(0xac0000, 0xac001f) AM_MIRROR(0x03ffe0) AM_READWRITE(pokey3_word_r, pokey3_word_w)
+ AM_RANGE(0xa40000, 0xa4001f) AM_MIRROR(0x03ffe0) AM_DEVREADWRITE8(SOUND, "pokey2", pokey_r, pokey_w, 0x00ff)
+ AM_RANGE(0xa80000, 0xa8001f) AM_MIRROR(0x03ffe0) AM_DEVREADWRITE8(SOUND, "pokey1", pokey_r, pokey_w, 0x00ff)
+ AM_RANGE(0xac0000, 0xac001f) AM_MIRROR(0x03ffe0) AM_DEVREADWRITE8(SOUND, "pokey3", pokey_r, pokey_w, 0x00ff)
ADDRESS_MAP_END
@@ -346,14 +330,23 @@ GFXDECODE_END
*
*************************************/
-static READ8_HANDLER( pot_r )
+static READ8_DEVICE_HANDLER( pot_r )
{
- return (input_port_read(space->machine, "DSW") >> offset) << 7;
+ return (input_port_read(device->machine, "DSW") >> offset) << 7;
}
static const pokey_interface pokey_config =
{
- { pot_r,pot_r,pot_r,pot_r,pot_r,pot_r,pot_r,pot_r }
+ {
+ DEVCB_HANDLER(pot_r),
+ DEVCB_HANDLER(pot_r),
+ DEVCB_HANDLER(pot_r),
+ DEVCB_HANDLER(pot_r),
+ DEVCB_HANDLER(pot_r),
+ DEVCB_HANDLER(pot_r),
+ DEVCB_HANDLER(pot_r),
+ DEVCB_HANDLER(pot_r)
+ }
};
diff --git a/src/mame/drivers/forte2.c b/src/mame/drivers/forte2.c
index aab62854a9d..1385a5ed670 100644
--- a/src/mame/drivers/forte2.c
+++ b/src/mame/drivers/forte2.c
@@ -37,9 +37,8 @@ static ADDRESS_MAP_START( io_mem, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x98, 0x98) AM_READWRITE( TMS9928A_vram_r, TMS9928A_vram_w )
AM_RANGE(0x99, 0x99) AM_READWRITE( TMS9928A_register_r, TMS9928A_register_w )
- AM_RANGE(0xa0, 0xa0) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xa1, 0xa1) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xa2, 0xa2) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0xa0, 0xa1) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0xa2, 0xa2) AM_DEVREAD(SOUND, "ay", ay8910_r)
//Ports a8-ab are originally for communicating with the i8255 PPI on MSX.
//( http://map.tni.nl/resources/msx_io_ports.php#ppi )
@@ -63,12 +62,12 @@ static INPUT_PORTS_START( pesadelo )
INPUT_PORTS_END
-static READ8_HANDLER(forte2_ay8910_read_input)
+static READ8_DEVICE_HANDLER(forte2_ay8910_read_input)
{
- return input_port_read(space->machine, "IN0") | (forte2_input_mask&0x3f);
+ return input_port_read(device->machine, "IN0") | (forte2_input_mask&0x3f);
}
-static WRITE8_HANDLER( forte2_ay8910_set_input_mask )
+static WRITE8_DEVICE_HANDLER( forte2_ay8910_set_input_mask )
{
/* PSG reg 15, writes 0 at coin insert, 0xff at boot and game over */
forte2_input_mask = data;
@@ -78,10 +77,10 @@ static const ay8910_interface forte2_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- forte2_ay8910_read_input,
- NULL,
- NULL,
- forte2_ay8910_set_input_mask
+ DEVCB_HANDLER(forte2_ay8910_read_input),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(forte2_ay8910_set_input_mask)
};
diff --git a/src/mame/drivers/fortecar.c b/src/mame/drivers/fortecar.c
index a70a53e015b..24b399a9840 100644
--- a/src/mame/drivers/fortecar.c
+++ b/src/mame/drivers/fortecar.c
@@ -81,11 +81,11 @@ static WRITE8_HANDLER( rom_bank_w )
}
}
-static WRITE8_HANDLER( ayporta_w )
+static WRITE8_DEVICE_HANDLER( ayporta_w )
{
}
-static WRITE8_HANDLER( ayportb_w )
+static WRITE8_DEVICE_HANDLER( ayportb_w )
{
}
@@ -93,10 +93,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- ayporta_w,
- ayportb_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(ayporta_w),
+ DEVCB_HANDLER(ayportb_w)
};
static ADDRESS_MAP_START( fortecar_map, ADDRESS_SPACE_PROGRAM, 8 )
@@ -109,8 +109,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( fortecar_ports, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x20, 0x21) AM_WRITE(fortecar_videoregs_w) // MC6845?
- AM_RANGE(0x40, 0x40) AM_READWRITE(ay8910_read_port_0_r, ay8910_control_port_0_w)
- AM_RANGE(0x41, 0x41) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x40, 0x40) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x40, 0x41) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
AM_RANGE(0x60, 0x62) AM_DEVREADWRITE(PPI8255, "fcppi0", ppi8255_r, ppi8255_w)//M5L8255AP
AM_RANGE(0x81, 0x81) AM_WRITE(rom_bank_w) //completely wrong,might not be there...
AM_RANGE(0xa0, 0xa0) AM_READ_PORT("IN0") //written too,multiplexer?
diff --git a/src/mame/drivers/freekick.c b/src/mame/drivers/freekick.c
index f00039f75ee..cd72e6688e4 100644
--- a/src/mame/drivers/freekick.c
+++ b/src/mame/drivers/freekick.c
@@ -195,10 +195,10 @@ static ADDRESS_MAP_START( pbillrd_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xe002, 0xe003) AM_WRITE(coin_w)
AM_RANGE(0xe004, 0xe004) AM_WRITE(nmi_enable_w)
AM_RANGE(0xf000, 0xf000) AM_WRITE(pbillrd_bankswitch_w)
- AM_RANGE(0xfc00, 0xfc00) AM_WRITE(sn76496_0_w)
- AM_RANGE(0xfc01, 0xfc01) AM_WRITE(sn76496_1_w)
- AM_RANGE(0xfc02, 0xfc02) AM_WRITE(sn76496_2_w)
- AM_RANGE(0xfc03, 0xfc03) AM_WRITE(sn76496_3_w)
+ AM_RANGE(0xfc00, 0xfc00) AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0xfc01, 0xfc01) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
+ AM_RANGE(0xfc02, 0xfc02) AM_DEVWRITE(SOUND, "sn3", sn76496_w)
+ AM_RANGE(0xfc03, 0xfc03) AM_DEVWRITE(SOUND, "sn4", sn76496_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( freekckb_readmem, ADDRESS_SPACE_PROGRAM, 8 )
@@ -225,10 +225,10 @@ static ADDRESS_MAP_START( freekckb_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xf802, 0xf803) AM_WRITE(coin_w)
AM_RANGE(0xf804, 0xf804) AM_WRITE(nmi_enable_w)
AM_RANGE(0xf806, 0xf806) AM_WRITE(spinner_select_w)
- AM_RANGE(0xfc00, 0xfc00) AM_WRITE(sn76496_0_w)
- AM_RANGE(0xfc01, 0xfc01) AM_WRITE(sn76496_1_w)
- AM_RANGE(0xfc02, 0xfc02) AM_WRITE(sn76496_2_w)
- AM_RANGE(0xfc03, 0xfc03) AM_WRITE(sn76496_3_w)
+ AM_RANGE(0xfc00, 0xfc00) AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0xfc01, 0xfc01) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
+ AM_RANGE(0xfc02, 0xfc02) AM_DEVWRITE(SOUND, "sn3", sn76496_w)
+ AM_RANGE(0xfc03, 0xfc03) AM_DEVWRITE(SOUND, "sn4", sn76496_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( gigas_readmem, ADDRESS_SPACE_PROGRAM, 8 )
@@ -252,10 +252,10 @@ static ADDRESS_MAP_START( gigas_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xe004, 0xe004) AM_WRITE(nmi_enable_w)
AM_RANGE(0xe005, 0xe005) AM_WRITE(SMH_NOP)
AM_RANGE(0xf000, 0xf000) AM_WRITE(SMH_NOP) //bankswitch ?
- AM_RANGE(0xfc00, 0xfc00) AM_WRITE(sn76496_0_w)
- AM_RANGE(0xfc01, 0xfc01) AM_WRITE(sn76496_1_w)
- AM_RANGE(0xfc02, 0xfc02) AM_WRITE(sn76496_2_w)
- AM_RANGE(0xfc03, 0xfc03) AM_WRITE(sn76496_3_w)
+ AM_RANGE(0xfc00, 0xfc00) AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0xfc01, 0xfc01) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
+ AM_RANGE(0xfc02, 0xfc02) AM_DEVWRITE(SOUND, "sn3", sn76496_w)
+ AM_RANGE(0xfc03, 0xfc03) AM_DEVWRITE(SOUND, "sn4", sn76496_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( gigas_io_map, ADDRESS_SPACE_IO, 8 )
diff --git a/src/mame/drivers/fromanc2.c b/src/mame/drivers/fromanc2.c
index 6df316d4557..d0e9dc4e4b0 100644
--- a/src/mame/drivers/fromanc2.c
+++ b/src/mame/drivers/fromanc2.c
@@ -436,10 +436,7 @@ static ADDRESS_MAP_START( fromanc2_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_READWRITE(soundlatch_r, SMH_NOP) // snd cmd (1P) / ?
AM_RANGE(0x04, 0x04) AM_READ(soundlatch2_r) // snd cmd (2P)
- AM_RANGE(0x08, 0x08) AM_READWRITE(ym2610_status_port_0_a_r, ym2610_control_port_0_a_w)
- AM_RANGE(0x09, 0x09) AM_READWRITE(SMH_NOP, ym2610_data_port_0_a_w) // ?
- AM_RANGE(0x0a, 0x0a) AM_READWRITE(ym2610_status_port_0_b_r, ym2610_control_port_0_b_w)
- AM_RANGE(0x0b, 0x0b) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE(SOUND, "ym", ym2610_r, ym2610_w)
AM_RANGE(0x0c, 0x0c) AM_READ(fromanc2_sndcpu_nmi_clr)
ADDRESS_MAP_END
@@ -600,9 +597,9 @@ GFXDECODE_END
//
// ----------------------------------------------------------------------------
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface ym2610_config =
diff --git a/src/mame/drivers/fromance.c b/src/mame/drivers/fromance.c
index 8d84db7a3e2..cff3345ebb9 100644
--- a/src/mame/drivers/fromance.c
+++ b/src/mame/drivers/fromance.c
@@ -148,12 +148,12 @@ static WRITE8_HANDLER( fromance_rombank_w )
*
*************************************/
-static WRITE8_HANDLER( fromance_adpcm_reset_w )
+static WRITE8_DEVICE_HANDLER( fromance_adpcm_reset_w )
{
fromance_adpcm_reset = (data & 0x01);
fromance_vclk_left = 0;
- msm5205_reset_w(0, !(data & 0x01));
+ msm5205_reset_w(device, !(data & 0x01));
}
@@ -173,7 +173,7 @@ static void fromance_adpcm_int(const device_config *device)
/* clock the data through */
if (fromance_vclk_left)
{
- msm5205_data_w(0, (fromance_adpcm_data >> 4));
+ msm5205_data_w(device, (fromance_adpcm_data >> 4));
fromance_adpcm_data <<= 4;
fromance_vclk_left--;
}
@@ -335,10 +335,9 @@ static ADDRESS_MAP_START( nekkyoku_sub_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0xe1, 0xe1) AM_READWRITE(fromance_busycheck_sub_r, fromance_gfxreg_w)
AM_RANGE(0xe2, 0xe5) AM_WRITE(fromance_scroll_w)
AM_RANGE(0xe6, 0xe6) AM_READWRITE(fromance_commanddata_r, fromance_busycheck_sub_w)
- AM_RANGE(0xe7, 0xe7) AM_WRITE(fromance_adpcm_reset_w)
+ AM_RANGE(0xe7, 0xe7) AM_DEVWRITE(SOUND, "msm", fromance_adpcm_reset_w)
AM_RANGE(0xe8, 0xe8) AM_WRITE(fromance_adpcm_w)
- AM_RANGE(0xe9, 0xe9) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xea, 0xea) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0xe9, 0xea) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( idolmj_sub_io_map, ADDRESS_SPACE_IO, 8 )
@@ -350,10 +349,9 @@ static ADDRESS_MAP_START( idolmj_sub_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x21, 0x21) AM_READWRITE(fromance_busycheck_sub_r, fromance_gfxreg_w)
AM_RANGE(0x22, 0x25) AM_WRITE(fromance_scroll_w)
AM_RANGE(0x26, 0x26) AM_READWRITE(fromance_commanddata_r, fromance_busycheck_sub_w)
- AM_RANGE(0x27, 0x27) AM_WRITE(fromance_adpcm_reset_w)
+ AM_RANGE(0x27, 0x27) AM_DEVWRITE(SOUND, "msm", fromance_adpcm_reset_w)
AM_RANGE(0x28, 0x28) AM_WRITE(fromance_adpcm_w)
- AM_RANGE(0x29, 0x29) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x2a, 0x2a) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x29, 0x2a) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( fromance_sub_io_map, ADDRESS_SPACE_IO, 8 )
@@ -365,10 +363,9 @@ static ADDRESS_MAP_START( fromance_sub_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x21, 0x21) AM_READWRITE(fromance_busycheck_sub_r, fromance_gfxreg_w)
AM_RANGE(0x22, 0x25) AM_WRITE(fromance_scroll_w)
AM_RANGE(0x26, 0x26) AM_READWRITE(fromance_commanddata_r, fromance_busycheck_sub_w)
- AM_RANGE(0x27, 0x27) AM_WRITE(fromance_adpcm_reset_w)
+ AM_RANGE(0x27, 0x27) AM_DEVWRITE(SOUND, "msm", fromance_adpcm_reset_w)
AM_RANGE(0x28, 0x28) AM_WRITE(fromance_adpcm_w)
- AM_RANGE(0x2a, 0x2a) AM_WRITE(ym2413_register_port_0_w)
- AM_RANGE(0x2b, 0x2b) AM_WRITE(ym2413_data_port_0_w)
+ AM_RANGE(0x2a, 0x2b) AM_DEVWRITE(SOUND, "ym", ym2413_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/funkybee.c b/src/mame/drivers/funkybee.c
index 84a55e45e9c..762d212f191 100644
--- a/src/mame/drivers/funkybee.c
+++ b/src/mame/drivers/funkybee.c
@@ -122,9 +122,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x02, 0x02) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0x02, 0x02) AM_DEVREAD(SOUND, "ay", ay8910_r)
ADDRESS_MAP_END
@@ -289,10 +288,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_3_r,
- NULL,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW"),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/funkyjet.c b/src/mame/drivers/funkyjet.c
index ccad7b4e2f5..fefc2f36836 100644
--- a/src/mame/drivers/funkyjet.c
+++ b/src/mame/drivers/funkyjet.c
@@ -135,8 +135,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_READ(SMH_ROM)
AM_RANGE(0x100000, 0x100001) AM_READ(SMH_NOP)
- AM_RANGE(0x110000, 0x110001) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0x120000, 0x120001) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x110000, 0x110001) AM_DEVREAD(SOUND, "ym", ym2151_r)
+ AM_RANGE(0x120000, 0x120001) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0x130000, 0x130001) AM_READ(SMH_NOP) /* This board only has 1 oki chip */
AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
AM_RANGE(0x1f0000, 0x1f1fff) AM_READ(SMH_BANK8)
@@ -145,8 +145,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_WRITE(SMH_ROM)
AM_RANGE(0x100000, 0x100001) AM_WRITE(SMH_NOP) /* YM2203 - this board doesn't have one */
- AM_RANGE(0x110000, 0x110001) AM_WRITE(ym2151_word_0_w)
- AM_RANGE(0x120000, 0x120001) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0x110000, 0x110001) AM_DEVWRITE(SOUND, "ym", ym2151_w)
+ AM_RANGE(0x120000, 0x120001) AM_DEVWRITE(SOUND, "oki", okim6295_w)
AM_RANGE(0x130000, 0x130001) AM_WRITE(SMH_NOP)
AM_RANGE(0x1f0000, 0x1f1fff) AM_WRITE(SMH_BANK8)
AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w)
@@ -298,9 +298,9 @@ GFXDECODE_END
/******************************************************************************/
-static void sound_irq(running_machine *machine, int state)
+static void sound_irq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1],1,state); /* IRQ 2 */
+ cpu_set_input_line(device->machine->cpu[1],1,state); /* IRQ 2 */
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/funworld.c b/src/mame/drivers/funworld.c
index 962e2aa82b2..95af5153382 100644
--- a/src/mame/drivers/funworld.c
+++ b/src/mame/drivers/funworld.c
@@ -1052,7 +1052,7 @@ VIDEO_UPDATE( funworld );
* Read/Write Handlers *
**********************/
-static WRITE8_HANDLER(funworld_lamp_a_w)
+static WRITE8_DEVICE_HANDLER(funworld_lamp_a_w)
{
coin_counter_w(0, data & 0x01); /* credit in counter */
@@ -1066,7 +1066,7 @@ static WRITE8_HANDLER(funworld_lamp_a_w)
output_set_lamp_value(3, (data >> 7) & 1); /* button hold4/high */
}
-static WRITE8_HANDLER(funworld_lamp_b_w)
+static WRITE8_DEVICE_HANDLER(funworld_lamp_b_w)
{
output_set_lamp_value(4, (data >> 0) & 1); /* button hold5/bet */
output_set_lamp_value(6, (data >> 1) & 1); /* button 7 (start/play) */
@@ -1087,8 +1087,8 @@ static ADDRESS_MAP_START( funworld_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
AM_RANGE(0x0800, 0x0803) AM_READWRITE(pia_0_r, pia_0_w)
AM_RANGE(0x0a00, 0x0a03) AM_READWRITE(pia_1_r, pia_1_w)
- AM_RANGE(0x0c00, 0x0c00) AM_READWRITE(ay8910_read_port_0_r, ay8910_control_port_0_w)
- AM_RANGE(0x0c01, 0x0c01) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x0c00, 0x0c00) AM_DEVREAD(SOUND, "ay8910", ay8910_r)
+ AM_RANGE(0x0c00, 0x0c01) AM_DEVWRITE(SOUND, "ay8910", ay8910_address_data_w)
AM_RANGE(0x0e00, 0x0e00) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
AM_RANGE(0x0e01, 0x0e01) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
AM_RANGE(0x2000, 0x2fff) AM_RAM_WRITE(funworld_videoram_w) AM_BASE(&videoram)
@@ -1102,8 +1102,8 @@ static ADDRESS_MAP_START( magicrd2_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
AM_RANGE(0x0800, 0x0803) AM_READWRITE(pia_0_r, pia_0_w)
AM_RANGE(0x0a00, 0x0a03) AM_READWRITE(pia_1_r, pia_1_w)
- AM_RANGE(0x0c00, 0x0c00) AM_READWRITE(ay8910_read_port_0_r, ay8910_control_port_0_w)
- AM_RANGE(0x0c01, 0x0c01) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x0c00, 0x0c00) AM_DEVREAD(SOUND, "ay8910", ay8910_r)
+ AM_RANGE(0x0c00, 0x0c01) AM_DEVWRITE(SOUND, "ay8910", ay8910_address_data_w)
AM_RANGE(0x0e00, 0x0e00) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
AM_RANGE(0x0e01, 0x0e01) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
AM_RANGE(0x2c00, 0x2cff) AM_RAM /* range for protection */
@@ -1118,8 +1118,8 @@ static ADDRESS_MAP_START( cuoreuno_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
AM_RANGE(0x0800, 0x0803) AM_READWRITE(pia_0_r, pia_0_w)
AM_RANGE(0x0a00, 0x0a03) AM_READWRITE(pia_1_r, pia_1_w)
- AM_RANGE(0x0c00, 0x0c00) AM_READWRITE(ay8910_read_port_0_r, ay8910_control_port_0_w)
- AM_RANGE(0x0c01, 0x0c01) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x0c00, 0x0c00) AM_DEVREAD(SOUND, "ay8910", ay8910_r)
+ AM_RANGE(0x0c00, 0x0c01) AM_DEVWRITE(SOUND, "ay8910", ay8910_address_data_w)
AM_RANGE(0x0e00, 0x0e00) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
AM_RANGE(0x0e01, 0x0e01) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
AM_RANGE(0x2000, 0x2000) AM_READNOP /* some unknown reads */
@@ -1133,8 +1133,8 @@ static ADDRESS_MAP_START( royalmcu_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
AM_RANGE(0x2800, 0x2803) AM_READWRITE(pia_0_r, pia_0_w)
AM_RANGE(0x2a00, 0x2a03) AM_READWRITE(pia_1_r, pia_1_w)
- AM_RANGE(0x2c00, 0x2c00) AM_READWRITE(ay8910_read_port_0_r, ay8910_control_port_0_w)
- AM_RANGE(0x2c01, 0x2c01) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x2c00, 0x2c00) AM_DEVREAD(SOUND, "ay8910", ay8910_r)
+ AM_RANGE(0x2c00, 0x2c01) AM_DEVWRITE(SOUND, "ay8910", ay8910_address_data_w)
AM_RANGE(0x2e00, 0x2e00) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
AM_RANGE(0x2e01, 0x2e01) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
AM_RANGE(0x4000, 0x4fff) AM_RAM_WRITE(funworld_videoram_w) AM_BASE(&videoram)
@@ -1149,8 +1149,8 @@ static ADDRESS_MAP_START( saloon_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x081c, 0x081c) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
AM_RANGE(0x081d, 0x081d) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
AM_RANGE(0x1000, 0x1000) AM_READ(input_port_2_r)
- AM_RANGE(0x1800, 0x1800) AM_READWRITE(ay8910_read_port_0_r, ay8910_control_port_0_w)
- AM_RANGE(0x1801, 0x1801) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x1800, 0x1800) AM_DEVREAD(SOUND, "ay8910", ay8910_r)
+ AM_RANGE(0x1800, 0x1801) AM_DEVWRITE(SOUND, "ay8910", ay8910_address_data_w)
// AM_RANGE(0x2000, 0x2000) AM_READNOP /* some unknown reads... maybe a DSW */
AM_RANGE(0x6000, 0x6fff) AM_RAM_WRITE(funworld_videoram_w) AM_BASE(&videoram)
AM_RANGE(0x7000, 0x7fff) AM_RAM_WRITE(funworld_colorram_w) AM_BASE(&colorram)
@@ -1974,10 +1974,10 @@ static const ay8910_interface ay8910_intf =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, /* portA in */
- NULL, /* portB in */
- funworld_lamp_a_w, /* portA out */
- funworld_lamp_b_w /* portB out */
+ DEVCB_NULL, /* portA in */
+ DEVCB_NULL, /* portB in */
+ DEVCB_HANDLER(funworld_lamp_a_w), /* portA out */
+ DEVCB_HANDLER(funworld_lamp_b_w) /* portB out */
};
diff --git a/src/mame/drivers/funybubl.c b/src/mame/drivers/funybubl.c
index 72c261291cd..1be3c70db8a 100644
--- a/src/mame/drivers/funybubl.c
+++ b/src/mame/drivers/funybubl.c
@@ -84,9 +84,9 @@ static WRITE8_HANDLER( funybubl_soundcommand_w )
cpu_set_input_line(space->machine->cpu[1],0, HOLD_LINE);
}
-static WRITE8_HANDLER( funybubl_oki_bank_sw )
+static WRITE8_DEVICE_HANDLER( funybubl_oki_bank_sw )
{
- okim6295_set_bank_base(0, ((data & 1) * 0x40000));
+ okim6295_set_bank_base(device, ((data & 1) * 0x40000));
}
@@ -123,15 +123,15 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( soundreadmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM)
- AM_RANGE(0x9800, 0x9800) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x9800, 0x9800) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( soundwritemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x9000, 0x9000) AM_WRITE(funybubl_oki_bank_sw)
- AM_RANGE(0x9800, 0x9800) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0x9000, 0x9000) AM_DEVWRITE(SOUND, "oki", funybubl_oki_bank_sw)
+ AM_RANGE(0x9800, 0x9800) AM_DEVWRITE(SOUND, "oki", okim6295_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/fuukifg2.c b/src/mame/drivers/fuukifg2.c
index a0f42191c23..81a99808df6 100644
--- a/src/mame/drivers/fuukifg2.c
+++ b/src/mame/drivers/fuukifg2.c
@@ -137,14 +137,14 @@ static WRITE8_HANDLER( fuuki16_sound_rombank_w )
logerror("CPU #1 - PC %04X: unknown bank bits: %02X\n",cpu_get_pc(space->cpu),data);
}
-static WRITE8_HANDLER( fuuki16_oki_banking_w )
+static WRITE8_DEVICE_HANDLER( fuuki16_oki_banking_w )
{
/*
data & 0x06 is always equals to data & 0x60
data & 0x10 is always set
*/
- okim6295_set_bank_base(0, ((data & 6) >> 1) * 0x40000);
+ okim6295_set_bank_base(device, ((data & 6) >> 1) * 0x40000);
}
static ADDRESS_MAP_START( fuuki16_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
@@ -163,14 +163,12 @@ static ADDRESS_MAP_START( fuuki16_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(fuuki16_sound_rombank_w ) // ROM Bank
AM_RANGE(0x11, 0x11) AM_READWRITE(soundlatch_r, SMH_NOP ) // From Main CPU / ? To Main CPU ?
- AM_RANGE(0x20, 0x20) AM_WRITE(fuuki16_oki_banking_w ) // Oki Banking
+ AM_RANGE(0x20, 0x20) AM_DEVWRITE(SOUND, "oki", fuuki16_oki_banking_w ) // Oki Banking
AM_RANGE(0x30, 0x30) AM_WRITE(SMH_NOP ) // ? In the NMI routine
- AM_RANGE(0x40, 0x40) AM_WRITE(ym2203_control_port_0_w ) // YM2203
- AM_RANGE(0x41, 0x41) AM_WRITE(ym2203_write_port_0_w )
- AM_RANGE(0x50, 0x50) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w) // YM3812
- AM_RANGE(0x51, 0x51) AM_WRITE(ym3812_write_port_0_w )
- AM_RANGE(0x60, 0x60) AM_READ(okim6295_status_0_r ) // M6295
- AM_RANGE(0x61, 0x61) AM_WRITE(okim6295_data_0_w ) // M6295
+ AM_RANGE(0x40, 0x41) AM_DEVWRITE(SOUND, "ym1", ym2203_w )
+ AM_RANGE(0x50, 0x51) AM_DEVREADWRITE(SOUND, "ym2", ym3812_r, ym3812_w )
+ AM_RANGE(0x60, 0x60) AM_DEVREAD(SOUND, "oki", okim6295_r) // M6295
+ AM_RANGE(0x61, 0x61) AM_DEVWRITE(SOUND, "oki", okim6295_w) // M6295
ADDRESS_MAP_END
@@ -407,9 +405,9 @@ GFXDECODE_END
***************************************************************************/
-static void soundirq(running_machine *machine, int state)
+static void soundirq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1], 0, state);
+ cpu_set_input_line(device->machine->cpu[1], 0, state);
}
static const ym3812_interface fuuki16_ym3812_intf =
diff --git a/src/mame/drivers/fuukifg3.c b/src/mame/drivers/fuukifg3.c
index 9ecd9cdea82..30a09d385fa 100644
--- a/src/mame/drivers/fuukifg3.c
+++ b/src/mame/drivers/fuukifg3.c
@@ -160,7 +160,6 @@ FG-3J ROM-J 507KA0301P04 Rev:1.3
#include "driver.h"
#include "cpu/z80/z80.h"
#include "cpu/m68000/m68000.h"
-#include "sound/262intf.h"
#include "sound/ymf278b.h"
static emu_timer *raster_interrupt_timer;
@@ -353,12 +352,7 @@ static ADDRESS_MAP_START( fuuki32_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(fuuki32_sound_bw_w)
AM_RANGE(0x30, 0x30) AM_WRITE(SMH_NOP)
- AM_RANGE(0x40, 0x40) AM_READWRITE(ymf262_status_0_r, ymf262_register_a_0_w)
- AM_RANGE(0x41, 0x41) AM_WRITE(ymf262_data_a_0_w)
- AM_RANGE(0x42, 0x42) AM_WRITE(ymf262_register_b_0_w)
- AM_RANGE(0x43, 0x43) AM_WRITE(ymf262_data_b_0_w)
- AM_RANGE(0x44, 0x44) AM_WRITE(ymf278b_control_port_0_c_w)
- AM_RANGE(0x45, 0x45) AM_WRITE(ymf278b_data_port_0_c_w)
+ AM_RANGE(0x40, 0x45) AM_DEVREADWRITE(SOUND, "ymf", ymf278b_r, ymf278b_w)
ADDRESS_MAP_END
/***************************************************************************
@@ -583,12 +577,12 @@ static MACHINE_RESET( fuuki32 )
}
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
}
-static const ymf262_interface fuuki32_ymf262_interface =
+static const ymf278b_interface fuuki32_ymf278b_interface =
{
irqhandler /* irq */
};
@@ -625,14 +619,7 @@ static MACHINE_DRIVER_START( fuuki32 )
/* sound hardware */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("ymf1", YMF262, FM_SOUND_CLOCK) /* 33.8688MHz OSC divided by 2 is 16.9344MHz */
- MDRV_SOUND_CONFIG(fuuki32_ymf262_interface)
- MDRV_SOUND_ROUTE(0, "left", 0.50)
- MDRV_SOUND_ROUTE(1, "right", 0.50)
- MDRV_SOUND_ROUTE(2, "left", 0.50)
- MDRV_SOUND_ROUTE(3, "right", 0.50)
-
- MDRV_SOUND_ADD("ymf2", YMF278B, YMF278B_STD_CLOCK) /* YMF278B_STD_CLOCK = OSC 33.8688MHz */
+ MDRV_SOUND_ADD("ymf", YMF278B, YMF278B_STD_CLOCK) /* YMF278B_STD_CLOCK = OSC 33.8688MHz */
MDRV_SOUND_ROUTE(0, "left", 0.50)
MDRV_SOUND_ROUTE(1, "right", 0.50)
MACHINE_DRIVER_END
@@ -684,10 +671,7 @@ ROM_START( asurabld )
ROM_REGION( 0x200000, "gfx4", ROMREGION_DISPOSE ) // background tiles
ROM_LOAD( "map.u5", 0x00000, 0x200000, CRC(e681155e) SHA1(458845b9c86df72685d92d0d4052aacc2fa7d1bd) )
- ROM_REGION( 0x400000, "ymf1", 0 ) // OPL4 samples
- ROM_LOAD( "pcm.u6", 0x00000, 0x400000, CRC(ac72225a) SHA1(8d16399ed34ac5bd69dbf43b2de2b0db9ac1c610) )
-
- ROM_REGION( 0x400000, "ymf2", 0 ) // OPL4 samples
+ ROM_REGION( 0x400000, "ymf", 0 ) // OPL4 samples
ROM_LOAD( "pcm.u6", 0x00000, 0x400000, CRC(ac72225a) SHA1(8d16399ed34ac5bd69dbf43b2de2b0db9ac1c610) )
ROM_END
@@ -731,10 +715,7 @@ ROM_START( asurabus )
ROM_REGION( 0x200000, "gfx4", ROMREGION_DISPOSE ) // background tiles
ROM_LOAD( "map.u5", 0x00000, 0x200000, CRC(bd179dc5) SHA1(ce3fcac573b14fd5365eb5dcec3257e439d2c129) )
- ROM_REGION( 0x400000, "ymf1", 0 ) // OPL4 samples
- ROM_LOAD( "opm.u6", 0x00000, 0x400000, CRC(31b05be4) SHA1(d0f4f387f84a74591224b0f42b7f5c538a3dc498) )
-
- ROM_REGION( 0x400000, "ymf2", 0 ) // OPL4 samples
+ ROM_REGION( 0x400000, "ymf", 0 ) // OPL4 samples
ROM_LOAD( "opm.u6", 0x00000, 0x400000, CRC(31b05be4) SHA1(d0f4f387f84a74591224b0f42b7f5c538a3dc498) )
ROM_END
diff --git a/src/mame/drivers/gaelco.c b/src/mame/drivers/gaelco.c
index ce61fcd30b6..867dc5d245f 100644
--- a/src/mame/drivers/gaelco.c
+++ b/src/mame/drivers/gaelco.c
@@ -165,18 +165,17 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( bigkarnk_readmem_snd, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_READ(SMH_RAM) /* RAM */
- AM_RANGE(0x0800, 0x0801) AM_READ(okim6295_status_0_r) /* OKI6295 */
- AM_RANGE(0x0a00, 0x0a00) AM_READ(ym3812_status_port_0_r) /* YM3812 */
+ AM_RANGE(0x0800, 0x0801) AM_DEVREAD(SOUND, "oki", okim6295_r) /* OKI6295 */
+ AM_RANGE(0x0a00, 0x0a01) AM_DEVREAD(SOUND, "ym", ym3812_r) /* YM3812 */
AM_RANGE(0x0b00, 0x0b00) AM_READ(soundlatch_r) /* Sound latch */
AM_RANGE(0x0c00, 0xffff) AM_READ(SMH_ROM) /* ROM */
ADDRESS_MAP_END
static ADDRESS_MAP_START( bigkarnk_writemem_snd, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_WRITE(SMH_RAM) /* RAM */
- AM_RANGE(0x0800, 0x0800) AM_WRITE(okim6295_data_0_w) /* OKI6295 */
+ AM_RANGE(0x0800, 0x0800) AM_DEVWRITE(SOUND, "oki", okim6295_w) /* OKI6295 */
// AM_RANGE(0x0900, 0x0900) AM_WRITE(SMH_NOP) /* enable sound output? */
- AM_RANGE(0x0a00, 0x0a00) AM_WRITE(ym3812_control_port_0_w)/* YM3812 */
- AM_RANGE(0x0a01, 0x0a01) AM_WRITE(ym3812_write_port_0_w) /* YM3812 */
+ AM_RANGE(0x0a00, 0x0a01) AM_DEVWRITE(SOUND, "ym", ym3812_w) /* YM3812 */
AM_RANGE(0x0c00, 0xffff) AM_WRITE(SMH_ROM) /* ROM */
ADDRESS_MAP_END
@@ -300,7 +299,7 @@ static ADDRESS_MAP_START( maniacsq_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW1")
AM_RANGE(0x700004, 0x700005) AM_READ_PORT("P1")
AM_RANGE(0x700006, 0x700007) AM_READ_PORT("P2")
- AM_RANGE(0x70000e, 0x70000f) AM_READ(okim6295_status_0_lsb_r)/* OKI6295 status register */
+ AM_RANGE(0x70000e, 0x70000f) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff)/* OKI6295 status register */
AM_RANGE(0xff0000, 0xffffff) AM_READ(SMH_RAM) /* Work RAM */
ADDRESS_MAP_END
@@ -322,7 +321,7 @@ static ADDRESS_MAP_START( maniacsq_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x200000, 0x2007ff) AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)/* Palette */
AM_RANGE(0x440000, 0x440fff) AM_WRITE(SMH_RAM) AM_BASE(&gaelco_spriteram) /* Sprite RAM */
AM_RANGE(0x70000c, 0x70000d) AM_WRITE(OKIM6295_bankswitch_w) /* OKI6295 bankswitch */
- AM_RANGE(0x70000e, 0x70000f) AM_WRITE(okim6295_data_0_lsb_w) /* OKI6295 data register */
+ AM_RANGE(0x70000e, 0x70000f) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff) /* OKI6295 data register */
AM_RANGE(0xff0000, 0xffffff) AM_WRITE(SMH_RAM) /* Work RAM */
ADDRESS_MAP_END
@@ -600,7 +599,7 @@ static ADDRESS_MAP_START( squash_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW1")
AM_RANGE(0x700004, 0x700005) AM_READ_PORT("P1")
AM_RANGE(0x700006, 0x700007) AM_READ_PORT("P2")
- AM_RANGE(0x70000e, 0x70000f) AM_READ(okim6295_status_0_lsb_r)/* OKI6295 status register */
+ AM_RANGE(0x70000e, 0x70000f) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff)/* OKI6295 status register */
AM_RANGE(0xff0000, 0xffffff) AM_READ(SMH_RAM) /* Work RAM */
ADDRESS_MAP_END
@@ -613,7 +612,7 @@ static ADDRESS_MAP_START( squash_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x200000, 0x2007ff) AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)/* Palette */
AM_RANGE(0x440000, 0x440fff) AM_WRITE(SMH_RAM) AM_BASE(&gaelco_spriteram) /* Sprite RAM */
AM_RANGE(0x70000c, 0x70000d) AM_WRITE(OKIM6295_bankswitch_w) /* OKI6295 bankswitch */
- AM_RANGE(0x70000e, 0x70000f) AM_WRITE(okim6295_data_0_lsb_w) /* OKI6295 data register */
+ AM_RANGE(0x70000e, 0x70000f) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff) /* OKI6295 data register */
AM_RANGE(0xff0000, 0xffffff) AM_WRITE(SMH_RAM) /* Work RAM */
ADDRESS_MAP_END
@@ -764,7 +763,7 @@ static ADDRESS_MAP_START( thoop_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x200000, 0x2007ff) AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)/* Palette */
AM_RANGE(0x440000, 0x440fff) AM_WRITE(SMH_RAM) AM_BASE(&gaelco_spriteram) /* Sprite RAM */
AM_RANGE(0x70000c, 0x70000d) AM_WRITE(OKIM6295_bankswitch_w) /* OKI6295 bankswitch */
- AM_RANGE(0x70000e, 0x70000f) AM_WRITE(okim6295_data_0_lsb_w) /* OKI6295 data register */
+ AM_RANGE(0x70000e, 0x70000f) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff) /* OKI6295 data register */
AM_RANGE(0xff0000, 0xffffff) AM_WRITE(SMH_RAM) /* Work RAM */
ADDRESS_MAP_END
diff --git a/src/mame/drivers/gaelco2.c b/src/mame/drivers/gaelco2.c
index 068a8bf7f04..b38d56eefe3 100644
--- a/src/mame/drivers/gaelco2.c
+++ b/src/mame/drivers/gaelco2.c
@@ -58,7 +58,7 @@ GFXDECODEINFO(0x0400000, 128)
static ADDRESS_MAP_START( maniacsq_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x03ffff) AM_READ(SMH_ROM) /* ROM */
- AM_RANGE(0x202890, 0x2028ff) AM_READ(gaelcosnd_r) /* Sound Registers */
+ AM_RANGE(0x202890, 0x2028ff) AM_DEVREAD(SOUND, "gaelco", gaelcosnd_r) /* Sound Registers */
AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM) /* Video RAM */
AM_RANGE(0x210000, 0x211fff) AM_READ(SMH_RAM) /* Palette */
AM_RANGE(0x218004, 0x218009) AM_READ(SMH_RAM) /* Video Registers */
@@ -70,7 +70,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( maniacsq_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x03ffff) AM_WRITE(SMH_ROM) /* ROM */
- AM_RANGE(0x202890, 0x2028ff) AM_WRITE(gaelcosnd_w) AM_BASE(&gaelco_sndregs) /* Sound Registers */
+ AM_RANGE(0x202890, 0x2028ff) AM_DEVWRITE(SOUND, "gaelco", gaelcosnd_w) AM_BASE(&gaelco_sndregs) /* Sound Registers */
AM_RANGE(0x200000, 0x20ffff) AM_WRITE(gaelco2_vram_w) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) /* Video RAM */
AM_RANGE(0x210000, 0x211fff) AM_WRITE(gaelco2_palette_w) AM_BASE(&paletteram16) /* Palette */
AM_RANGE(0x218004, 0x218009) AM_WRITE(SMH_RAM) AM_BASE(&gaelco2_vregs) /* Video Registers */
@@ -225,7 +225,7 @@ static READ16_HANDLER(p2_gun_y) {return (input_port_read(space->machine, "LIGHT1
static ADDRESS_MAP_START( bang_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM) /* ROM */
- AM_RANGE(0x202890, 0x2028ff) AM_READ(gaelcosnd_r) /* Sound Registers */
+ AM_RANGE(0x202890, 0x2028ff) AM_DEVREAD(SOUND, "gaelco", gaelcosnd_r) /* Sound Registers */
AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM) /* Video RAM */
AM_RANGE(0x210000, 0x211fff) AM_READ(SMH_RAM) /* Palette */
AM_RANGE(0x218004, 0x218009) AM_READ(SMH_RAM) /* Video Registers */
@@ -242,7 +242,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( bang_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_WRITE(SMH_ROM) /* ROM */
- AM_RANGE(0x202890, 0x2028ff) AM_WRITE(gaelcosnd_w) AM_BASE(&gaelco_sndregs) /* Sound Registers */
+ AM_RANGE(0x202890, 0x2028ff) AM_DEVWRITE(SOUND, "gaelco", gaelcosnd_w) AM_BASE(&gaelco_sndregs) /* Sound Registers */
AM_RANGE(0x200000, 0x20ffff) AM_WRITE(gaelco2_vram_w) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) /* Video RAM */
AM_RANGE(0x210000, 0x211fff) AM_WRITE(gaelco2_palette_w) AM_BASE(&paletteram16) /* Palette */
AM_RANGE(0x218004, 0x218007) AM_WRITE(SMH_RAM) AM_BASE(&gaelco2_vregs) /* Video Registers */
@@ -391,7 +391,7 @@ ROM_END
static ADDRESS_MAP_START( alighunt_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM) /* ROM */
- AM_RANGE(0x202890, 0x2028ff) AM_READ(gaelcosnd_r) /* Sound Registers */
+ AM_RANGE(0x202890, 0x2028ff) AM_DEVREAD(SOUND, "gaelco", gaelcosnd_r) /* Sound Registers */
AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM) /* Video RAM */
AM_RANGE(0x210000, 0x211fff) AM_READ(SMH_RAM) /* Palette */
AM_RANGE(0x218004, 0x218009) AM_READ(SMH_RAM) /* Video Registers */
@@ -403,7 +403,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( alighunt_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_WRITE(SMH_ROM) /* ROM */
- AM_RANGE(0x202890, 0x2028ff) AM_WRITE(gaelcosnd_w) AM_BASE(&gaelco_sndregs) /* Sound Registers */
+ AM_RANGE(0x202890, 0x2028ff) AM_DEVWRITE(SOUND, "gaelco", gaelcosnd_w) AM_BASE(&gaelco_sndregs) /* Sound Registers */
AM_RANGE(0x200000, 0x20ffff) AM_WRITE(gaelco2_vram_w) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) /* Video RAM */
AM_RANGE(0x210000, 0x211fff) AM_WRITE(gaelco2_palette_w) AM_BASE(&paletteram16) /* Palette */
AM_RANGE(0x218004, 0x218009) AM_WRITE(SMH_RAM) AM_BASE(&gaelco2_vregs) /* Video Registers */
@@ -612,7 +612,7 @@ static READ16_HANDLER ( dallas_kludge_r )
static ADDRESS_MAP_START( touchgo_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM) /* ROM */
- AM_RANGE(0x202890, 0x2028ff) AM_READ(gaelcosnd_r) /* Sound Registers */
+ AM_RANGE(0x202890, 0x2028ff) AM_DEVREAD(SOUND, "gaelco", gaelcosnd_r) /* Sound Registers */
AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM) /* Video RAM */
AM_RANGE(0x210000, 0x211fff) AM_READ(SMH_RAM) /* Palette */
AM_RANGE(0x218004, 0x218009) AM_READ(SMH_RAM) /* Video Registers */
@@ -626,7 +626,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( touchgo_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_WRITE(SMH_ROM) /* ROM */
- AM_RANGE(0x202890, 0x2028ff) AM_WRITE(gaelcosnd_w) AM_BASE(&gaelco_sndregs) /* Sound Registers */
+ AM_RANGE(0x202890, 0x2028ff) AM_DEVWRITE(SOUND, "gaelco", gaelcosnd_w) AM_BASE(&gaelco_sndregs) /* Sound Registers */
AM_RANGE(0x200000, 0x20ffff) AM_WRITE(gaelco2_vram_w) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) /* Video RAM */
AM_RANGE(0x210000, 0x211fff) AM_WRITE(gaelco2_palette_w) AM_BASE(&paletteram16) /* Palette */
AM_RANGE(0x218004, 0x218009) AM_WRITE(SMH_RAM) AM_BASE(&gaelco2_vregs) /* Video Registers */
@@ -886,7 +886,7 @@ ROM_END
static ADDRESS_MAP_START( snowboar_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM) /* ROM */
- AM_RANGE(0x202890, 0x2028ff) AM_READ(gaelcosnd_r) /* Sound Registers */
+ AM_RANGE(0x202890, 0x2028ff) AM_DEVREAD(SOUND, "gaelco", gaelcosnd_r) /* Sound Registers */
AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM) /* Video RAM */
AM_RANGE(0x210000, 0x211fff) AM_READ(SMH_RAM) /* Palette */
AM_RANGE(0x212000, 0x213fff) AM_READ(SMH_RAM) /* Extra RAM */
@@ -900,7 +900,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( snowboar_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_WRITE(SMH_ROM) /* ROM */
- AM_RANGE(0x202890, 0x2028ff) AM_WRITE(gaelcosnd_w) AM_BASE(&gaelco_sndregs) /* Sound Registers */
+ AM_RANGE(0x202890, 0x2028ff) AM_DEVWRITE(SOUND, "gaelco", gaelcosnd_w) AM_BASE(&gaelco_sndregs) /* Sound Registers */
AM_RANGE(0x200000, 0x20ffff) AM_WRITE(gaelco2_vram_w) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) /* Video RAM */
AM_RANGE(0x210000, 0x211fff) AM_WRITE(gaelco2_palette_w) AM_BASE(&paletteram16) /* Palette */
AM_RANGE(0x212000, 0x213fff) AM_WRITE(SMH_RAM) /* Extra RAM */
@@ -1083,7 +1083,7 @@ ROM_END
static ADDRESS_MAP_START( wrally2_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM) /* ROM */
- AM_RANGE(0x202890, 0x2028ff) AM_READ(gaelcosnd_r) /* Sound Registers */
+ AM_RANGE(0x202890, 0x2028ff) AM_DEVREAD(SOUND, "gaelco", gaelcosnd_r) /* Sound Registers */
AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM) /* Video RAM */
AM_RANGE(0x210000, 0x211fff) AM_READ(SMH_RAM) /* Palette */
AM_RANGE(0x212000, 0x213fff) AM_READ(SMH_RAM) /* Extra RAM */
@@ -1097,7 +1097,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( wrally2_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_WRITE(SMH_ROM) /* ROM */
- AM_RANGE(0x202890, 0x2028ff) AM_WRITE(gaelcosnd_w) AM_BASE(&gaelco_sndregs) /* Sound Registers */
+ AM_RANGE(0x202890, 0x2028ff) AM_DEVWRITE(SOUND, "gaelco", gaelcosnd_w) AM_BASE(&gaelco_sndregs) /* Sound Registers */
AM_RANGE(0x200000, 0x20ffff) AM_WRITE(gaelco2_vram_w) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) /* Video RAM */
AM_RANGE(0x210000, 0x211fff) AM_WRITE(gaelco2_palette_w) AM_BASE(&paletteram16) /* Palette */
AM_RANGE(0x212000, 0x213fff) AM_WRITE(SMH_RAM) /* Extra RAM */
diff --git a/src/mame/drivers/gaelco3d.c b/src/mame/drivers/gaelco3d.c
index 60309dd689e..cbac0220171 100644
--- a/src/mame/drivers/gaelco3d.c
+++ b/src/mame/drivers/gaelco3d.c
@@ -168,6 +168,7 @@ static UINT16 *adsp_control_regs;
static UINT16 *adsp_fastram_base;
static UINT8 adsp_ireg;
static offs_t adsp_ireg_base, adsp_incs, adsp_size;
+static const device_config *dmadac[SOUND_CHANNELS];
static void adsp_tx_callback(const device_config *device, int port, INT32 data);
static TIMER_CALLBACK( adsp_autobuffer_irq );
@@ -203,6 +204,13 @@ static MACHINE_RESET( common )
/* keep the TMS32031 halted until the code is ready to go */
cpu_set_input_line(machine->cpu[1], INPUT_LINE_RESET, ASSERT_LINE);
+ for (i = 0; i < SOUND_CHANNELS; i++)
+ {
+ char buffer[10];
+ sprintf(buffer, "dac%d", i);
+ dmadac[i] = devtag_get_device(machine, SOUND, buffer);
+ }
+
/* Save state support */
state_save_register_global(machine, sound_data);
state_save_register_global(machine, sound_status);
@@ -501,7 +509,7 @@ static WRITE16_HANDLER( adsp_control_w )
/* see if SPORT1 got disabled */
if ((data & 0x0800) == 0)
{
- dmadac_enable(0, SOUND_CHANNELS, 0);
+ dmadac_enable(&dmadac[0], SOUND_CHANNELS, 0);
timer_adjust_oneshot(adsp_autobuffer_timer, attotime_never, 0);
}
break;
@@ -510,7 +518,7 @@ static WRITE16_HANDLER( adsp_control_w )
/* autobuffer off: nuke the timer, and disable the DAC */
if ((data & 0x0002) == 0)
{
- dmadac_enable(0, SOUND_CHANNELS, 0);
+ dmadac_enable(&dmadac[0], SOUND_CHANNELS, 0);
timer_adjust_oneshot(adsp_autobuffer_timer, attotime_never, 0);
}
break;
@@ -547,7 +555,7 @@ static TIMER_CALLBACK( adsp_autobuffer_irq )
/* copy the current data into the buffer */
// logerror("ADSP buffer: I%d=%04X incs=%04X size=%04X\n", adsp_ireg, reg, adsp_incs, adsp_size);
if (adsp_incs)
- dmadac_transfer(0, SOUND_CHANNELS, adsp_incs, SOUND_CHANNELS * adsp_incs, adsp_size / (SOUND_CHANNELS * adsp_incs), (INT16 *)&adsp_fastram_base[reg - 0x3800]);
+ dmadac_transfer(&dmadac[0], SOUND_CHANNELS, adsp_incs, SOUND_CHANNELS * adsp_incs, adsp_size / (SOUND_CHANNELS * adsp_incs), (INT16 *)&adsp_fastram_base[reg - 0x3800]);
/* increment it */
reg += adsp_size;
@@ -612,8 +620,8 @@ static void adsp_tx_callback(const device_config *device, int port, INT32 data)
/* now put it down to samples, so we know what the channel frequency has to be */
sample_period = attotime_mul(sample_period, 16 * SOUND_CHANNELS);
- dmadac_set_frequency(0, SOUND_CHANNELS, ATTOSECONDS_TO_HZ(sample_period.attoseconds));
- dmadac_enable(0, SOUND_CHANNELS, 1);
+ dmadac_set_frequency(&dmadac[0], SOUND_CHANNELS, ATTOSECONDS_TO_HZ(sample_period.attoseconds));
+ dmadac_enable(&dmadac[0], SOUND_CHANNELS, 1);
/* fire off a timer wich will hit every half-buffer */
sample_period = attotime_div(attotime_mul(sample_period, adsp_size), SOUND_CHANNELS * adsp_incs);
@@ -627,7 +635,7 @@ static void adsp_tx_callback(const device_config *device, int port, INT32 data)
}
/* if we get there, something went wrong. Disable playing */
- dmadac_enable(0, SOUND_CHANNELS, 0);
+ dmadac_enable(&dmadac[0], SOUND_CHANNELS, 0);
/* remove timer */
timer_adjust_oneshot(adsp_autobuffer_timer, attotime_never, 0);
diff --git a/src/mame/drivers/gaiden.c b/src/mame/drivers/gaiden.c
index 0bd51817ead..ebd8c2d5cc2 100644
--- a/src/mame/drivers/gaiden.c
+++ b/src/mame/drivers/gaiden.c
@@ -433,7 +433,7 @@ static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xdfff) AM_READ(SMH_ROM)
AM_RANGE(0xe000, 0xefff) AM_READ(SMH_ROM) /* raiga only */
AM_RANGE(0xf000, 0xf7ff) AM_READ(SMH_RAM)
- AM_RANGE(0xf800, 0xf800) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0xf800, 0xf800) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0xfc00, 0xfc00) AM_READ(SMH_NOP) /* ?? */
AM_RANGE(0xfc20, 0xfc20) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -442,11 +442,9 @@ static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xdfff) AM_WRITE(SMH_ROM)
AM_RANGE(0xe000, 0xefff) AM_WRITE(SMH_ROM) /* raiga only */
AM_RANGE(0xf000, 0xf7ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xf800, 0xf800) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0xf810, 0xf810) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xf811, 0xf811) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0xf820, 0xf820) AM_WRITE(ym2203_control_port_1_w)
- AM_RANGE(0xf821, 0xf821) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0xf800, 0xf800) AM_DEVWRITE(SOUND, "oki", okim6295_w)
+ AM_RANGE(0xf810, 0xf811) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0xf820, 0xf821) AM_DEVWRITE(SOUND, "ym2", ym2203_w)
AM_RANGE(0xfc00, 0xfc00) AM_WRITE(SMH_NOP) /* ?? */
ADDRESS_MAP_END
@@ -457,9 +455,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( drgnbowl_sound_port_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
- AM_RANGE(0x80, 0x80) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0x80, 0x80) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -855,9 +852,9 @@ static GFXDECODE_START( drgnbowl )
GFXDECODE_END
/* handler called by the 2203 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface ym2203_config =
@@ -865,7 +862,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
irqhandler
};
diff --git a/src/mame/drivers/galaga.c b/src/mame/drivers/galaga.c
index 0344621b70c..dc0a74fa711 100644
--- a/src/mame/drivers/galaga.c
+++ b/src/mame/drivers/galaga.c
@@ -915,7 +915,7 @@ static MACHINE_RESET( digdug )
static ADDRESS_MAP_START( bosco_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM AM_WRITENOP /* the only area different for each CPU */
AM_RANGE(0x6800, 0x6807) AM_READ(bosco_dsw_r)
- AM_RANGE(0x6800, 0x681f) AM_WRITE(pacman_sound_w) AM_BASE(&namco_soundregs)
+ AM_RANGE(0x6800, 0x681f) AM_DEVWRITE(SOUND, "namco", pacman_sound_w) AM_BASE(&namco_soundregs)
AM_RANGE(0x6820, 0x6827) AM_WRITE(bosco_latch_w) /* misc latches */
AM_RANGE(0x6830, 0x6830) AM_WRITE(watchdog_reset_w)
AM_RANGE(0x7000, 0x70ff) AM_READWRITE(namco_06xx_0_data_r, namco_06xx_0_data_w)
@@ -937,7 +937,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( galaga_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM AM_WRITENOP /* the only area different for each CPU */
AM_RANGE(0x6800, 0x6807) AM_READ(bosco_dsw_r)
- AM_RANGE(0x6800, 0x681f) AM_WRITE(pacman_sound_w) AM_BASE(&namco_soundregs)
+ AM_RANGE(0x6800, 0x681f) AM_DEVWRITE(SOUND, "namco", pacman_sound_w) AM_BASE(&namco_soundregs)
AM_RANGE(0x6820, 0x6827) AM_WRITE(bosco_latch_w) /* misc latches */
AM_RANGE(0x6830, 0x6830) AM_WRITE(watchdog_reset_w)
AM_RANGE(0x7000, 0x70ff) AM_READWRITE(namco_06xx_0_data_r, namco_06xx_0_data_w)
@@ -954,7 +954,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( xevious_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM AM_WRITENOP /* the only area different for each CPU */
AM_RANGE(0x6800, 0x6807) AM_READ(bosco_dsw_r)
- AM_RANGE(0x6800, 0x681f) AM_WRITE(pacman_sound_w) AM_BASE(&namco_soundregs)
+ AM_RANGE(0x6800, 0x681f) AM_DEVWRITE(SOUND, "namco", pacman_sound_w) AM_BASE(&namco_soundregs)
AM_RANGE(0x6820, 0x6827) AM_WRITE(bosco_latch_w) /* misc latches */
AM_RANGE(0x6830, 0x6830) AM_WRITE(watchdog_reset_w)
AM_RANGE(0x7000, 0x70ff) AM_READWRITE(namco_06xx_0_data_r, namco_06xx_0_data_w)
@@ -974,7 +974,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( digdug_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM AM_WRITENOP /* the only area different for each CPU */
- AM_RANGE(0x6800, 0x681f) AM_WRITE(pacman_sound_w) AM_BASE(&namco_soundregs)
+ AM_RANGE(0x6800, 0x681f) AM_DEVWRITE(SOUND, "namco", pacman_sound_w) AM_BASE(&namco_soundregs)
AM_RANGE(0x6820, 0x6827) AM_WRITE(bosco_latch_w) /* misc latches */
AM_RANGE(0x6830, 0x6830) AM_WRITE(watchdog_reset_w)
AM_RANGE(0x7000, 0x70ff) AM_READWRITE(namco_06xx_0_data_r, namco_06xx_0_data_w)
@@ -1677,7 +1677,7 @@ static MACHINE_DRIVER_START( bosco )
MDRV_SOUND_CONFIG(namco_config)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90 * 10.0 / 16.0)
- MDRV_SOUND_ADD("namco2", NAMCO_52XX, MASTER_CLOCK/12) /* 1.536 MHz */
+ MDRV_SOUND_ADD("namco52", NAMCO_52XX, MASTER_CLOCK/12) /* 1.536 MHz */
MDRV_SOUND_CONFIG(namco_52xx_config)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90)
@@ -1954,7 +1954,7 @@ ROM_START( bosco )
ROM_LOAD( "prom.1d", 0x0000, 0x0100, CRC(de2316c6) SHA1(0e55c56046331888d1d3f0d9823d2ceb203e7d3f) )
ROM_LOAD( "prom.5c", 0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) ) /* timing - not used */
- ROM_REGION( 0x3000, "namco2", 0 ) /* ROMs for digitised speech */
+ ROM_REGION( 0x3000, "namco52", 0 ) /* ROMs for digitised speech */
ROM_LOAD( "4900.5n", 0x0000, 0x1000, CRC(09acc978) SHA1(2b264aaeb6eba70ad91593413dca733990e5467b) )
ROM_LOAD( "5000.5m", 0x1000, 0x1000, CRC(e571e959) SHA1(9c81d7bec73bc605f7dd9a089171b0f34c4bb09a) )
ROM_LOAD( "5100.5l", 0x2000, 0x1000, CRC(17ac9511) SHA1(266f3fae90d2fe38d109096d352863a52b379899) )
@@ -1995,7 +1995,7 @@ ROM_START( boscoo )
ROM_LOAD( "prom.1d", 0x0000, 0x0100, CRC(de2316c6) SHA1(0e55c56046331888d1d3f0d9823d2ceb203e7d3f) )
ROM_LOAD( "prom.5c", 0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) ) /* timing - not used */
- ROM_REGION( 0x3000, "namco2", 0 ) /* ROMs for digitised speech */
+ ROM_REGION( 0x3000, "namco52", 0 ) /* ROMs for digitised speech */
ROM_LOAD( "4900.5n", 0x0000, 0x1000, CRC(09acc978) SHA1(2b264aaeb6eba70ad91593413dca733990e5467b) )
ROM_LOAD( "5000.5m", 0x1000, 0x1000, CRC(e571e959) SHA1(9c81d7bec73bc605f7dd9a089171b0f34c4bb09a) )
ROM_LOAD( "5100.5l", 0x2000, 0x1000, CRC(17ac9511) SHA1(266f3fae90d2fe38d109096d352863a52b379899) )
@@ -2036,7 +2036,7 @@ ROM_START( boscoo2 )
ROM_LOAD( "prom.1d", 0x0000, 0x0100, CRC(de2316c6) SHA1(0e55c56046331888d1d3f0d9823d2ceb203e7d3f) )
ROM_LOAD( "prom.5c", 0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) ) /* timing - not used */
- ROM_REGION( 0x3000, "namco2", 0 ) /* ROMs for digitised speech */
+ ROM_REGION( 0x3000, "namco52", 0 ) /* ROMs for digitised speech */
ROM_LOAD( "4900.5n", 0x0000, 0x1000, CRC(09acc978) SHA1(2b264aaeb6eba70ad91593413dca733990e5467b) )
ROM_LOAD( "5000.5m", 0x1000, 0x1000, CRC(e571e959) SHA1(9c81d7bec73bc605f7dd9a089171b0f34c4bb09a) )
ROM_LOAD( "5100.5l", 0x2000, 0x1000, CRC(17ac9511) SHA1(266f3fae90d2fe38d109096d352863a52b379899) )
@@ -2084,7 +2084,7 @@ ROM_START( boscomd )
ROM_LOAD( "prom.1d", 0x0000, 0x0100, CRC(de2316c6) SHA1(0e55c56046331888d1d3f0d9823d2ceb203e7d3f) )
ROM_LOAD( "prom.5c", 0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) ) /* timing - not used */
- ROM_REGION( 0x3000, "namco2", 0 ) /* ROMs for digitised speech */
+ ROM_REGION( 0x3000, "namco52", 0 ) /* ROMs for digitised speech */
ROM_LOAD( "4900.5n", 0x0000, 0x1000, CRC(09acc978) SHA1(2b264aaeb6eba70ad91593413dca733990e5467b) )
ROM_LOAD( "5000.5m", 0x1000, 0x1000, CRC(e571e959) SHA1(9c81d7bec73bc605f7dd9a089171b0f34c4bb09a) )
ROM_LOAD( "5100.5l", 0x2000, 0x1000, CRC(17ac9511) SHA1(266f3fae90d2fe38d109096d352863a52b379899) )
@@ -2128,7 +2128,7 @@ ROM_START( boscomdo )
ROM_LOAD( "prom.1d", 0x0000, 0x0100, CRC(de2316c6) SHA1(0e55c56046331888d1d3f0d9823d2ceb203e7d3f) )
ROM_LOAD( "prom.5c", 0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) ) /* timing - not used */
- ROM_REGION( 0x3000, "namco2", 0 ) /* ROMs for digitised speech */
+ ROM_REGION( 0x3000, "namco52", 0 ) /* ROMs for digitised speech */
ROM_LOAD( "4900.5n", 0x0000, 0x1000, CRC(09acc978) SHA1(2b264aaeb6eba70ad91593413dca733990e5467b) )
ROM_LOAD( "5000.5m", 0x1000, 0x1000, CRC(e571e959) SHA1(9c81d7bec73bc605f7dd9a089171b0f34c4bb09a) )
ROM_LOAD( "5100.5l", 0x2000, 0x1000, CRC(17ac9511) SHA1(266f3fae90d2fe38d109096d352863a52b379899) )
diff --git a/src/mame/drivers/galaxi.c b/src/mame/drivers/galaxi.c
index d5ba7d94478..f589fd640d5 100644
--- a/src/mame/drivers/galaxi.c
+++ b/src/mame/drivers/galaxi.c
@@ -242,7 +242,7 @@ static ADDRESS_MAP_START( galaxi_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE( 0x500002, 0x500003 ) AM_WRITE( galaxi_500002_w )
AM_RANGE( 0x500004, 0x500005 ) AM_WRITE( galaxi_500004_w )
- AM_RANGE( 0x700000, 0x700001 ) AM_READWRITE( okim6295_status_0_lsb_r, okim6295_data_0_lsb_w )
+ AM_RANGE( 0x700000, 0x700001 ) AM_DEVREADWRITE8( SOUND, "oki", okim6295_r, okim6295_w, 0x00ff )
AM_RANGE( 0x600000, 0x607fff ) AM_RAM AM_BASE( &generic_nvram16 ) AM_SIZE( &generic_nvram_size ) // 2x DS1230Y (non volatile SRAM)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/galaxian.c b/src/mame/drivers/galaxian.c
index c435dbf9f6e..f3a4dcc1703 100644
--- a/src/mame/drivers/galaxian.c
+++ b/src/mame/drivers/galaxian.c
@@ -337,8 +337,8 @@ static READ8_HANDLER( konami_ay8910_r )
{
/* the decoding here is very simplistic, and you can address both simultaneously */
UINT8 result = 0xff;
- if (offset & 0x20) result &= ay8910_read_port_0_r(space, 0);
- if (offset & 0x80) result &= ay8910_read_port_1_r(space, 0);
+ if (offset & 0x20) result &= ay8910_r(devtag_get_device(space->machine, SOUND, "8910.0"), 0);
+ if (offset & 0x80) result &= ay8910_r(devtag_get_device(space->machine, SOUND, "8910.1"), 0);
return result;
}
@@ -347,14 +347,14 @@ static WRITE8_HANDLER( konami_ay8910_w )
{
/* the decoding here is very simplistic, and you can address two simultaneously */
if (offset & 0x10)
- ay8910_control_port_0_w(space, 0, data);
+ ay8910_address_w(devtag_get_device(space->machine, SOUND, "8910.0"), 0, data);
else if (offset & 0x20)
- ay8910_write_port_0_w(space, 0, data);
+ ay8910_data_w(devtag_get_device(space->machine, SOUND, "8910.0"), 0, data);
if (offset & 0x40)
- ay8910_control_port_1_w(space, 0, data);
+ ay8910_address_w(devtag_get_device(space->machine, SOUND, "8910.1"), 0, data);
else if (offset & 0x80)
- ay8910_write_port_1_w(space, 0, data);
+ ay8910_data_w(devtag_get_device(space->machine, SOUND, "8910.1"), 0, data);
}
@@ -373,7 +373,7 @@ static WRITE8_DEVICE_HANDLER( konami_sound_control_w )
}
-static READ8_HANDLER( konami_sound_timer_r )
+static READ8_DEVICE_HANDLER( konami_sound_timer_r )
{
/*
The timer is clocked at KONAMI_SOUND_CLOCK and cascades through a
@@ -389,7 +389,7 @@ static READ8_HANDLER( konami_sound_timer_r )
current counter index, we use the sound cpu clock times 8 mod
16*16*2*8*5*2.
*/
- UINT32 cycles = (cpu_get_total_cycles(space->machine->cpu[1]) * 8) % (UINT64)(16*16*2*8*5*2);
+ UINT32 cycles = (cputag_get_total_cycles(device->machine, "audio") * 8) % (UINT64)(16*16*2*8*5*2);
UINT8 hibit = 0;
/* separate the high bit from the others */
@@ -410,18 +410,20 @@ static READ8_HANDLER( konami_sound_timer_r )
static WRITE8_HANDLER( konami_sound_filter_w )
{
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "konami");
+ static const char *ayname[2] = { "8910.0", "8910.1" };
int which, chan;
/* the offset is used as data, 6 channels * 2 bits each */
for (which = 0; which < 2; which++)
- if (sndti_exists(SOUND_AY8910, which))
+ if (devtag_get_device(space->machine, SOUND, ayname[which]) != NULL)
for (chan = 0; chan < 3; chan++)
{
UINT8 bits = (offset >> (2 * chan + 6 * (1 - which))) & 3;
/* low bit goes to 0.22uF capacitor = 220000pF */
/* high bit goes to 0.047uF capacitor = 47000pF */
- discrete_sound_w(space, NODE(3 * (1-which) + chan + 11), bits);
+ discrete_sound_w(discrete, NODE(3 * (1-which) + chan + 11), bits);
}
}
@@ -574,10 +576,10 @@ static WRITE8_HANDLER( explorer_sound_control_w )
}
-static READ8_HANDLER( explorer_sound_latch_r )
+static READ8_DEVICE_HANDLER( explorer_sound_latch_r )
{
- cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE);
- return soundlatch_r(space, 0);
+ cpu_set_input_line(device->machine->cpu[1], 0, CLEAR_LINE);
+ return soundlatch_r(cpu_get_address_space(device->machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0);
}
@@ -601,11 +603,11 @@ static WRITE8_HANDLER( sfx_sample_io_w )
{
/* the decoding here is very simplistic, and you can address both simultaneously */
if (offset & 0x04) ppi8255_w(devtag_get_device(space->machine, PPI8255, "ppi8255_2"), offset & 3, data);
- if (offset & 0x10) dac_0_signed_data_w(space, offset, data);
+ if (offset & 0x10) dac_signed_data_w(devtag_get_device(space->machine, SOUND, "dac"), data);
}
-static WRITE8_HANDLER( sfx_sample_control_w )
+static WRITE8_DEVICE_HANDLER( sfx_sample_control_w )
{
UINT8 old = sfx_sample_control;
sfx_sample_control = data;
@@ -613,7 +615,7 @@ static WRITE8_HANDLER( sfx_sample_control_w )
/* the inverse of bit 0 clocks the flip flop to signal an INT */
/* it is automatically cleared on the acknowledge */
if ((old & 0x01) && !(data & 0x01))
- cpu_set_input_line(space->machine->cpu[1], 0, HOLD_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, HOLD_LINE);
}
@@ -657,7 +659,7 @@ static READ8_HANDLER( frogger_ay8910_r )
{
/* the decoding here is very simplistic */
UINT8 result = 0xff;
- if (offset & 0x40) result &= ay8910_read_port_0_r(space, 0);
+ if (offset & 0x40) result &= ay8910_r(devtag_get_device(space->machine, SOUND, "8910.0"), 0);
return result;
}
@@ -666,16 +668,16 @@ static WRITE8_HANDLER( frogger_ay8910_w )
{
/* the decoding here is very simplistic */
if (offset & 0x40)
- ay8910_write_port_0_w(space, 0, data);
+ ay8910_data_w(devtag_get_device(space->machine, SOUND, "8910.0"), 0, data);
else if (offset & 0x80)
- ay8910_control_port_0_w(space, 0, data);
+ ay8910_address_w(devtag_get_device(space->machine, SOUND, "8910.0"), 0, data);
}
-static READ8_HANDLER( frogger_sound_timer_r )
+static READ8_DEVICE_HANDLER( frogger_sound_timer_r )
{
/* same as regular Konami sound but with bits 3,5 swapped */
- UINT8 konami_value = konami_sound_timer_r(space, 0);
+ UINT8 konami_value = konami_sound_timer_r(device, 0);
return BITSWAP8(konami_value, 7,6,3,4,5,2,1,0);
}
@@ -735,9 +737,9 @@ static READ8_HANDLER( scorpion_ay8910_r )
{
/* the decoding here is very simplistic, and you can address both simultaneously */
UINT8 result = 0xff;
- if (offset & 0x08) result &= ay8910_read_port_2_r(space, 0);
- if (offset & 0x20) result &= ay8910_read_port_0_r(space, 0);
- if (offset & 0x80) result &= ay8910_read_port_1_r(space, 0);
+ if (offset & 0x08) result &= ay8910_r(devtag_get_device(space->machine, SOUND, "8910.2"), 0);
+ if (offset & 0x20) result &= ay8910_r(devtag_get_device(space->machine, SOUND, "8910.0"), 0);
+ if (offset & 0x80) result &= ay8910_r(devtag_get_device(space->machine, SOUND, "8910.1"), 0);
return result;
}
@@ -745,12 +747,12 @@ static READ8_HANDLER( scorpion_ay8910_r )
static WRITE8_HANDLER( scorpion_ay8910_w )
{
/* the decoding here is very simplistic, and you can address all six simultaneously */
- if (offset & 0x04) ay8910_control_port_2_w(space, 0, data);
- if (offset & 0x08) ay8910_write_port_2_w(space, 0, data);
- if (offset & 0x10) ay8910_control_port_0_w(space, 0, data);
- if (offset & 0x20) ay8910_write_port_0_w(space, 0, data);
- if (offset & 0x40) ay8910_control_port_1_w(space, 0, data);
- if (offset & 0x80) ay8910_write_port_1_w(space, 0, data);
+ if (offset & 0x04) ay8910_address_w(devtag_get_device(space->machine, SOUND, "8910.2"), 0, data);
+ if (offset & 0x08) ay8910_data_w(devtag_get_device(space->machine, SOUND, "8910.2"), 0, data);
+ if (offset & 0x10) ay8910_address_w(devtag_get_device(space->machine, SOUND, "8910.0"), 0, data);
+ if (offset & 0x20) ay8910_data_w(devtag_get_device(space->machine, SOUND, "8910.0"), 0, data);
+ if (offset & 0x40) ay8910_address_w(devtag_get_device(space->machine, SOUND, "8910.1"), 0, data);
+ if (offset & 0x80) ay8910_data_w(devtag_get_device(space->machine, SOUND, "8910.1"), 0, data);
}
@@ -785,14 +787,15 @@ static WRITE8_DEVICE_HANDLER( scorpion_protection_w )
static READ8_HANDLER( scorpion_digitalker_intr_r )
{
- return digitalker_0_intr_r();
+ const device_config *digitalker = devtag_get_device(space->machine, SOUND, "digitalker");
+ return digitalker_0_intr_r(digitalker);
}
-static WRITE8_HANDLER( scorpion_digitalker_control_w )
+static WRITE8_DEVICE_HANDLER( scorpion_digitalker_control_w )
{
- digitalker_0_cs_w(data & 1 ? ASSERT_LINE : CLEAR_LINE);
- digitalker_0_cms_w(data & 2 ? ASSERT_LINE : CLEAR_LINE);
- digitalker_0_wr_w(data & 4 ? ASSERT_LINE : CLEAR_LINE);
+ digitalker_0_cs_w(device, data & 1 ? ASSERT_LINE : CLEAR_LINE);
+ digitalker_0_cms_w(device, data & 2 ? ASSERT_LINE : CLEAR_LINE);
+ digitalker_0_wr_w(device, data & 4 ? ASSERT_LINE : CLEAR_LINE);
}
static const ppi8255_interface scorpion_ppi8255_1_intf =
@@ -864,12 +867,7 @@ static WRITE8_HANDLER( zigzag_ay8910_w )
/* bit 0 = WRITE */
/* bit 1 = C/D */
if ((offset & 1) != 0)
- {
- if ((offset & 2) == 0)
- ay8910_write_port_0_w(space, 0, zigzag_ay8910_latch);
- else
- ay8910_control_port_0_w(space, 0, zigzag_ay8910_latch);
- }
+ ay8910_data_address_w(devtag_get_device(space->machine, SOUND, "ay"), offset >> 1, zigzag_ay8910_latch);
break;
case 0x100:
@@ -939,9 +937,9 @@ static WRITE8_HANDLER( kingball_sound2_w )
}
-static WRITE8_HANDLER( kingball_dac_w )
+static WRITE8_DEVICE_HANDLER( kingball_dac_w )
{
- dac_0_data_w(space, offset, data ^ 0xff);
+ dac_w(device, offset, data ^ 0xff);
}
@@ -961,21 +959,21 @@ static WRITE8_HANDLER( mshuttle_ay8910_cs_w )
static WRITE8_HANDLER( mshuttle_ay8910_control_w )
{
if (!mshuttle_ay8910_cs)
- ay8910_control_port_0_w(space, offset, data);
+ ay8910_address_w(devtag_get_device(space->machine, SOUND, "ay"), offset, data);
}
static WRITE8_HANDLER( mshuttle_ay8910_data_w )
{
if (!mshuttle_ay8910_cs)
- ay8910_write_port_0_w(space, offset, data);
+ ay8910_data_w(devtag_get_device(space->machine, SOUND, "ay"), offset, data);
}
static READ8_HANDLER( mshuttle_ay8910_data_r )
{
if (!mshuttle_ay8910_cs)
- return ay8910_read_port_0_r(space, offset);
+ return ay8910_r(devtag_get_device(space->machine, SOUND, "ay"), offset);
return 0xff;
}
@@ -1348,8 +1346,8 @@ static ADDRESS_MAP_START( jumpbug_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4000, 0x47ff) AM_RAM
AM_RANGE(0x4800, 0x4bff) AM_MIRROR(0x0400) AM_RAM_WRITE(galaxian_videoram_w) AM_BASE(&videoram)
AM_RANGE(0x5000, 0x50ff) AM_MIRROR(0x0700) AM_RAM_WRITE(galaxian_objram_w) AM_BASE(&spriteram)
- AM_RANGE(0x5800, 0x5800) AM_MIRROR(0x00ff) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x5900, 0x5900) AM_MIRROR(0x00ff) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x5800, 0x5800) AM_MIRROR(0x00ff) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
+ AM_RANGE(0x5900, 0x5900) AM_MIRROR(0x00ff) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x07ff) AM_READ_PORT("IN0")
AM_RANGE(0x6002, 0x6006) AM_MIRROR(0x07f8) AM_WRITE(galaxian_gfxbank_w)
AM_RANGE(0x6800, 0x6800) AM_MIRROR(0x07ff) AM_READ_PORT("IN1")
@@ -1454,9 +1452,8 @@ static ADDRESS_MAP_START( checkman_sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x03, 0x03) AM_READ(soundlatch_r)
- AM_RANGE(0x04, 0x04) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x05, 0x05) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x06, 0x06) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0x04, 0x05) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0x06, 0x06) AM_DEVREAD(SOUND, "ay", ay8910_r)
ADDRESS_MAP_END
@@ -1465,9 +1462,8 @@ static ADDRESS_MAP_START( checkmaj_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x0000, 0x0fff) AM_ROM
AM_RANGE(0x8000, 0x83ff) AM_RAM
- AM_RANGE(0xa000, 0xa000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xa001, 0xa001) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xa002, 0xa002) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0xa000, 0xa000) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0xa002, 0xa002) AM_DEVREAD(SOUND, "ay", ay8910_r)
ADDRESS_MAP_END
@@ -1482,7 +1478,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( kingball_sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_MIRROR(0xff) AM_READWRITE(soundlatch_r, kingball_dac_w)
+ AM_RANGE(0x00, 0x00) AM_MIRROR(0xff) AM_READ(soundlatch_r) AM_DEVWRITE(SOUND, "dac", kingball_dac_w)
ADDRESS_MAP_END
@@ -1563,80 +1559,80 @@ static const ay8910_interface frogger_ay8910_interface =
{
AY8910_DISCRETE_OUTPUT,
{RES_K(5.1), RES_K(5.1), RES_K(5.1)},
- soundlatch_r,
- frogger_sound_timer_r,
- NULL,
- NULL
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r),
+ DEVCB_HANDLER(frogger_sound_timer_r),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface konami_ay8910_interface_1 =
{
AY8910_DISCRETE_OUTPUT,
{RES_K(5.1), RES_K(5.1), RES_K(5.1)},
- NULL,
- NULL,
- NULL,
- NULL
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface konami_ay8910_interface_2 =
{
AY8910_DISCRETE_OUTPUT,
{RES_K(5.1), RES_K(5.1), RES_K(5.1)},
- soundlatch_r,
- konami_sound_timer_r,
- NULL,
- NULL
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r),
+ DEVCB_HANDLER(konami_sound_timer_r),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface explorer_ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- konami_sound_timer_r,
- NULL,
- NULL,
- NULL
+ DEVCB_HANDLER(konami_sound_timer_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface explorer_ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- explorer_sound_latch_r,
- NULL,
- NULL,
- NULL
+ DEVCB_HANDLER(explorer_sound_latch_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface sfx_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- soundlatch2_w,
- sfx_sample_control_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch2_w),
+ DEVCB_HANDLER(sfx_sample_control_w)
};
static const ay8910_interface scorpion_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- digitalker_0_data_w,
- scorpion_digitalker_control_w,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_DEVICE_HANDLER(SOUND, "digitalker", digitalker_data_w),
+ DEVCB_DEVICE_HANDLER(SOUND, "digitalker", scorpion_digitalker_control_w)
};
static const ay8910_interface checkmaj_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r,
- NULL,
- NULL,
- NULL
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const discrete_mixer_desc konami_sound_mixer_desc =
diff --git a/src/mame/drivers/galaxold.c b/src/mame/drivers/galaxold.c
index d151e575557..ca469e9b55e 100644
--- a/src/mame/drivers/galaxold.c
+++ b/src/mame/drivers/galaxold.c
@@ -712,8 +712,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( ozon1_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( drivfrcg, ADDRESS_SPACE_PROGRAM, 8 )
@@ -764,9 +763,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( bongo_io, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x02, 0x02) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0x02, 0x02) AM_DEVREAD(SOUND, "ay", ay8910_r)
ADDRESS_MAP_END
@@ -822,12 +820,12 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( harem_cpu2_io, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x04, 0x04) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x08, 0x08) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x10, 0x10) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x20, 0x20) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x40, 0x40) AM_WRITE(ay8910_control_port_2_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ay8910_write_port_2_w)
+ AM_RANGE(0x04, 0x04) AM_DEVWRITE(SOUND, "ay1", ay8910_address_w)
+ AM_RANGE(0x08, 0x08) AM_DEVWRITE(SOUND, "ay1", ay8910_data_w)
+ AM_RANGE(0x10, 0x10) AM_DEVWRITE(SOUND, "ay2", ay8910_address_w)
+ AM_RANGE(0x20, 0x20) AM_DEVWRITE(SOUND, "ay2", ay8910_data_w)
+ AM_RANGE(0x40, 0x40) AM_DEVWRITE(SOUND, "ay3", ay8910_address_w)
+ AM_RANGE(0x80, 0x80) AM_DEVWRITE(SOUND, "ay3", ay8910_data_w)
AM_RANGE(0x80, 0x80) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -877,9 +875,9 @@ static ADDRESS_MAP_START( racknrol, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END
static ADDRESS_MAP_START( racknrol_io, ADDRESS_SPACE_IO, 8 )
- AM_RANGE(0x1d, 0x1d) AM_WRITE(sn76496_0_w)
- AM_RANGE(0x1e, 0x1e) AM_WRITE(sn76496_1_w)
- AM_RANGE(0x1f, 0x1f) AM_WRITE(sn76496_2_w)
+ AM_RANGE(0x1d, 0x1d) AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0x1e, 0x1e) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
+ AM_RANGE(0x1f, 0x1f) AM_DEVWRITE(SOUND, "sn3", sn76496_w)
AM_RANGE(0x20, 0x3f) AM_WRITE(racknrol_tiles_bank_w) AM_BASE(&racknrol_tiles_bank)
AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ_PORT("SENSE")
ADDRESS_MAP_END
@@ -969,7 +967,7 @@ static READ8_HANDLER( hexpoola_data_port_r )
static ADDRESS_MAP_START( hexpoola_io, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0x00) AM_READNOP
AM_RANGE(0x20, 0x3f) AM_WRITE(racknrol_tiles_bank_w) AM_BASE(&racknrol_tiles_bank)
- AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_READWRITE(hexpoola_data_port_r, sn76496_0_w)
+ AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_READ(hexpoola_data_port_r) AM_DEVWRITE(SOUND, "sn", sn76496_w)
AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ_PORT("SENSE")
ADDRESS_MAP_END
@@ -2187,10 +2185,10 @@ static const ay8910_interface bongo_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_3_r,
- NULL,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/galdrvr.c b/src/mame/drivers/galdrvr.c
index 421f4282d88..686b5188d3d 100644
--- a/src/mame/drivers/galdrvr.c
+++ b/src/mame/drivers/galdrvr.c
@@ -1279,6 +1279,9 @@ INPUT_PORTS_START( frogger )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_START("IN3") /* need for some PPI accesses */
+ PORT_BIT( 0xff, 0x00, IPT_UNUSED )
INPUT_PORTS_END
@@ -1377,6 +1380,9 @@ INPUT_PORTS_START( turtles )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_START("IN3") /* need for some PPI accesses */
+ PORT_BIT( 0xff, 0x00, IPT_UNUSED )
INPUT_PORTS_END
@@ -1396,9 +1402,6 @@ INPUT_PORTS_START( turpin )
PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x04, DEF_STR( 1C_2C ) )
-
- PORT_START("IN3")
- PORT_BIT( 0xff, 0x00, IPT_UNKNOWN )
INPUT_PORTS_END
@@ -1420,7 +1423,7 @@ INPUT_PORTS_START( amidar )
PORT_DIPSETTING( 0x00, "30000 50000" )
PORT_DIPSETTING( 0x04, "50000 50000" )
- PORT_START("IN3")
+ PORT_MODIFY("IN3")
PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
PORT_DIPSETTING( 0x04, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0a, DEF_STR( 3C_1C ) )
@@ -1541,6 +1544,9 @@ INPUT_PORTS_START( theend )
PORT_DIPSETTING( 0x00, DEF_STR( Upright ) )
PORT_DIPSETTING( 0x08, DEF_STR( Cocktail ) )
PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) /* output bits */
+
+ PORT_START("IN3") /* need for some PPI accesses */
+ PORT_BIT( 0xff, 0x00, IPT_UNUSED )
INPUT_PORTS_END
@@ -1582,6 +1588,9 @@ INPUT_PORTS_START( scramble )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(scramble_protection_alt_r, (void *)0) /* protection bit */
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(scramble_protection_alt_r, (void *)1) /* protection bit */
+
+ PORT_START("IN3") /* need for some PPI accesses */
+ PORT_BIT( 0xff, 0x00, IPT_UNUSED )
INPUT_PORTS_END
@@ -1711,6 +1720,9 @@ INPUT_PORTS_START( atlantis )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
+
+ PORT_START("IN3") /* need for some PPI accesses */
+ PORT_BIT( 0xff, 0x00, IPT_UNUSED )
INPUT_PORTS_END
@@ -1756,6 +1768,9 @@ INPUT_PORTS_START( scorpion )
PORT_DIPSETTING( 0x80, DEF_STR( Medium ) )
PORT_DIPSETTING( 0x20, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Very_Hard ) )
+
+ PORT_START("IN3") /* need for some PPI accesses */
+ PORT_BIT( 0xff, 0x00, IPT_UNUSED )
INPUT_PORTS_END
diff --git a/src/mame/drivers/galivan.c b/src/mame/drivers/galivan.c
index 4883453143f..8fc0733ce1f 100644
--- a/src/mame/drivers/galivan.c
+++ b/src/mame/drivers/galivan.c
@@ -30,7 +30,7 @@ Driver by Takahiro Nogi (nogi@kt.rim.or.jp) 1999/12/17 -
#include "driver.h"
#include "cpu/z80/z80.h"
#include "sound/dac.h"
-#include "sound/3812intf.h"
+#include "sound/3526intf.h"
WRITE8_HANDLER( galivan_scrollx_w );
WRITE8_HANDLER( galivan_scrolly_w );
@@ -165,10 +165,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym3526_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym3526_write_port_0_w)
- AM_RANGE(0x02, 0x02) AM_WRITE(dac_0_data_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(dac_1_data_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ym", ym3526_w)
+ AM_RANGE(0x02, 0x02) AM_DEVWRITE(SOUND, "dac1", dac_w)
+ AM_RANGE(0x03, 0x03) AM_DEVWRITE(SOUND, "dac2", dac_w)
/* AM_RANGE(0x04, 0x04) AM_READ(SMH_NOP) value read and *discarded* */
AM_RANGE(0x06, 0x06) AM_READ(galivan_sound_command_r)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/galpani2.c b/src/mame/drivers/galpani2.c
index 85dfe030ddf..1d144492a7e 100644
--- a/src/mame/drivers/galpani2.c
+++ b/src/mame/drivers/galpani2.c
@@ -214,12 +214,12 @@ static WRITE16_HANDLER( galpani2_oki_0_bank_w )
}
}
-static WRITE16_HANDLER( galpani2_oki_1_bank_w )
+static WRITE16_DEVICE_HANDLER( galpani2_oki_1_bank_w )
{
if (ACCESSING_BITS_0_7)
{
- okim6295_set_bank_base(1, 0x40000 * (data & 0xf) );
- logerror("CPU #0 PC %06X : OKI 1 bank %08X\n",cpu_get_pc(space->cpu),data);
+ okim6295_set_bank_base(device, 0x40000 * (data & 0xf) );
+ logerror("%s:OKI 1 bank %08X\n",cpuexec_describe_context(device->machine),data);
}
}
@@ -253,10 +253,10 @@ static ADDRESS_MAP_START( galpani2_mem1, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x780002, 0x780003) AM_READ_PORT("DSW2_P2")
AM_RANGE(0x780004, 0x780005) AM_READ_PORT("SPECIAL")
AM_RANGE(0x780006, 0x780007) AM_READ_PORT("SERVICE")
- AM_RANGE(0xc00000, 0xc00001) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w ) // 2 x OKIM6295
- AM_RANGE(0xc40000, 0xc40001) AM_READWRITE(okim6295_status_1_lsb_r, okim6295_data_1_lsb_w ) //
+ AM_RANGE(0xc00000, 0xc00001) AM_DEVREADWRITE8(SOUND, "oki1", okim6295_r, okim6295_w, 0x00ff ) // 2 x OKIM6295
+ AM_RANGE(0xc40000, 0xc40001) AM_DEVREADWRITE8(SOUND, "oki2", okim6295_r, okim6295_w, 0x00ff ) //
AM_RANGE(0xc80000, 0xc80001) AM_WRITE(galpani2_oki_0_bank_w ) //
- AM_RANGE(0xcc0000, 0xcc0001) AM_WRITE(galpani2_oki_1_bank_w ) //
+ AM_RANGE(0xcc0000, 0xcc0001) AM_DEVWRITE(SOUND, "oki2", galpani2_oki_1_bank_w ) //
ADDRESS_MAP_END
diff --git a/src/mame/drivers/galpani3.c b/src/mame/drivers/galpani3.c
index d2fdb7adce8..36869a08489 100644
--- a/src/mame/drivers/galpani3.c
+++ b/src/mame/drivers/galpani3.c
@@ -889,8 +889,7 @@ static ADDRESS_MAP_START( galpani3_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xf00012, 0xf00013) AM_READ_PORT("P2")
AM_RANGE(0xf00014, 0xf00015) AM_READ_PORT("COIN")
AM_RANGE(0xf00016, 0xf00017) AM_NOP // ? read, but overwritten
- AM_RANGE(0xf00020, 0xf00021) AM_WRITE(ymz280b_register_0_lsb_w) // sound
- AM_RANGE(0xf00022, 0xf00023) AM_WRITE(ymz280b_data_0_lsb_w) //
+ AM_RANGE(0xf00020, 0xf00023) AM_DEVWRITE8(SOUND, "ymz", ymz280b_w, 0x00ff) // sound
AM_RANGE(0xf00040, 0xf00041) AM_READWRITE(watchdog_reset16_r, watchdog_reset16_w) // watchdog
AM_RANGE(0xf00050, 0xf00051) AM_NOP // ? written once (3rd opcode, $30.b)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/galpanic.c b/src/mame/drivers/galpanic.c
index 9b58ff6519a..8481f9c31ce 100644
--- a/src/mame/drivers/galpanic.c
+++ b/src/mame/drivers/galpanic.c
@@ -219,7 +219,7 @@ static WRITE16_HANDLER( galpanic_bgvideoram_mirror_w )
static ADDRESS_MAP_START( galpanic, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x3fffff) AM_ROM
- AM_RANGE(0x400000, 0x400001) AM_READWRITE(okim6295_status_0_lsb_r,okim6295_data_0_lsb_w)
+ AM_RANGE(0x400000, 0x400001) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x500000, 0x51ffff) AM_RAM AM_BASE(&galpanic_fgvideoram) AM_SIZE(&galpanic_fgvideoram_size)
AM_RANGE(0x520000, 0x53ffff) AM_READWRITE(SMH_RAM,galpanic_bgvideoram_w) AM_BASE(&galpanic_bgvideoram) /* + work RAM */
AM_RANGE(0x600000, 0x6007ff) AM_READWRITE(SMH_RAM,galpanic_paletteram_w) AM_BASE(&paletteram16) /* 1024 colors, but only 512 seem to be used */
@@ -242,12 +242,12 @@ static READ16_HANDLER( kludge )
}
/* a kludge! */
-static READ16_HANDLER( comad_okim6295_status_0_msb_r )
+static READ8_DEVICE_HANDLER( comad_okim6295_r )
{
UINT16 retvalue;
-// retvalue = okim6295_status_0_msb_r(offset,mem_mask); // doesn't work, causes lockups when girls change..
- retvalue = mame_rand(space->machine);
+// retvalue = okim6295_r(offset,mem_mask) << 8; // doesn't work, causes lockups when girls change..
+ retvalue = mame_rand(device->machine);
return retvalue;
}
@@ -266,8 +266,8 @@ static ADDRESS_MAP_START( comad_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x80000c, 0x80000d) AM_READ(kludge) /* missw96 bits 8-a = timer? palette update code waits for them to be 111 */
AM_RANGE(0xc00000, 0xc0ffff) AM_READ(SMH_RAM) /* missw96 */
AM_RANGE(0xc80000, 0xc8ffff) AM_READ(SMH_RAM) /* fantasia, newfant */
- AM_RANGE(0xf00000, 0xf00001) AM_READ(comad_okim6295_status_0_msb_r) /* fantasia, missw96 */
- AM_RANGE(0xf80000, 0xf80001) AM_READ(comad_okim6295_status_0_msb_r) /* newfant */
+ AM_RANGE(0xf00000, 0xf00001) AM_DEVREAD8(SOUND, "oki", comad_okim6295_r, 0xff00) /* fantasia, missw96 */
+ AM_RANGE(0xf80000, 0xf80001) AM_DEVREAD8(SOUND, "oki", comad_okim6295_r, 0xff00) /* newfant */
ADDRESS_MAP_END
static ADDRESS_MAP_START( comad_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -279,8 +279,8 @@ static ADDRESS_MAP_START( comad_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x900000, 0x900001) AM_WRITE(galpania_6295_bankswitch_w) /* not sure */
AM_RANGE(0xc00000, 0xc0ffff) AM_WRITE(SMH_RAM) /* missw96 */
AM_RANGE(0xc80000, 0xc8ffff) AM_WRITE(SMH_RAM) /* fantasia, newfant */
- AM_RANGE(0xf00000, 0xf00001) AM_WRITE(okim6295_data_0_msb_w) /* fantasia, missw96 */
- AM_RANGE(0xf80000, 0xf80001) AM_WRITE(okim6295_data_0_msb_w) /* newfant */
+ AM_RANGE(0xf00000, 0xf00001) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0xff00) /* fantasia, missw96 */
+ AM_RANGE(0xf80000, 0xf80001) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0xff00) /* newfant */
ADDRESS_MAP_END
static ADDRESS_MAP_START( fantsia2_readmem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -295,7 +295,7 @@ static ADDRESS_MAP_START( fantsia2_readmem, ADDRESS_SPACE_PROGRAM, 16 )
// AM_RANGE(0x800006, 0x800007) ??
AM_RANGE(0x800008, 0x800009) AM_READ(kludge) /* bits 8-a = timer? palette update code waits for them to be 111 */
AM_RANGE(0xf80000, 0xf8ffff) AM_READ(SMH_RAM)
- AM_RANGE(0xc80000, 0xc80001) AM_READ(comad_okim6295_status_0_msb_r)
+ AM_RANGE(0xc80000, 0xc80001) AM_DEVREAD8(SOUND, "oki", comad_okim6295_r, 0xff00)
ADDRESS_MAP_END
static ADDRESS_MAP_START( fantsia2_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -307,7 +307,7 @@ static ADDRESS_MAP_START( fantsia2_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x900000, 0x900001) AM_WRITE(galpania_6295_bankswitch_w) /* not sure */
AM_RANGE(0xf80000, 0xf8ffff) AM_WRITE(SMH_RAM)
AM_RANGE(0xa00000, 0xa00001) AM_WRITE(SMH_NOP) /* coin counters, + ? */
- AM_RANGE(0xc80000, 0xc80001) AM_WRITE(okim6295_data_0_msb_w)
+ AM_RANGE(0xc80000, 0xc80001) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0xff00)
ADDRESS_MAP_END
@@ -323,7 +323,7 @@ static ADDRESS_MAP_START( galhustl_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x800000, 0x800001) AM_READ_PORT("DSW1_P1")
AM_RANGE(0x800002, 0x800003) AM_READ_PORT("DSW2_P2")
AM_RANGE(0x800004, 0x800005) AM_READ_PORT("SYSTEM")
- AM_RANGE(0xd00000, 0xd00001) AM_READ(okim6295_status_0_msb_r)
+ AM_RANGE(0xd00000, 0xd00001) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0xff00)
AM_RANGE(0xe80000, 0xe8ffff) AM_READ(SMH_RAM)
ADDRESS_MAP_END
@@ -339,7 +339,7 @@ static ADDRESS_MAP_START( galhustl_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x780000, 0x78001f) AM_WRITE(SMH_RAM) // regs?
AM_RANGE(0xa00000, 0xa00001) AM_WRITE(SMH_NOP) // ?
AM_RANGE(0x900000, 0x900001) AM_WRITE(galpania_6295_bankswitch_w)
- AM_RANGE(0xd00000, 0xd00001) AM_WRITE(okim6295_data_0_msb_w)
+ AM_RANGE(0xd00000, 0xd00001) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0xff00)
AM_RANGE(0xe80000, 0xe8ffff) AM_WRITE(SMH_RAM)
ADDRESS_MAP_END
@@ -363,7 +363,7 @@ static ADDRESS_MAP_START( zipzap_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x800002, 0x800003) AM_READ_PORT("DSW2_P2")
AM_RANGE(0x800004, 0x800005) AM_READ_PORT("SYSTEM")
- AM_RANGE(0xc00000, 0xc00001) AM_READ(comad_okim6295_status_0_msb_r)
+ AM_RANGE(0xc00000, 0xc00001) AM_DEVREAD8(SOUND, "oki", comad_okim6295_r, 0xff00)
AM_RANGE(0xc80000, 0xc8ffff) AM_READ(SMH_RAM)
ADDRESS_MAP_END
@@ -379,7 +379,7 @@ static ADDRESS_MAP_START( zipzap_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x701000, 0x71ffff) AM_WRITE(SMH_RAM)
AM_RANGE(0x780000, 0x78001f) AM_WRITE(SMH_RAM)
AM_RANGE(0x900000, 0x900001) AM_WRITE(galpania_6295_bankswitch_w)
- AM_RANGE(0xc00000, 0xc00001) AM_WRITE(okim6295_data_0_msb_w)
+ AM_RANGE(0xc00000, 0xc00001) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0xff00)
AM_RANGE(0xc80000, 0xc8ffff) AM_WRITE(SMH_RAM) // main ram
ADDRESS_MAP_END
@@ -398,7 +398,7 @@ static ADDRESS_MAP_START( supmodel_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x800006, 0x800007) AM_READ(kludge)
AM_RANGE(0x800008, 0x800009) AM_READ(kludge)
AM_RANGE(0xc80000, 0xc8ffff) AM_READ(SMH_RAM)
- AM_RANGE(0xf80000, 0xf80001) AM_READ(comad_okim6295_status_0_msb_r)
+ AM_RANGE(0xf80000, 0xf80001) AM_DEVREAD8(SOUND, "oki", comad_okim6295_r, 0xff00)
ADDRESS_MAP_END
static ADDRESS_MAP_START( supmodel_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -416,7 +416,7 @@ static ADDRESS_MAP_START( supmodel_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xd80000, 0xd80001) AM_WRITE(SMH_NOP)
AM_RANGE(0xe00012, 0xe00013) AM_WRITE(SMH_NOP)
AM_RANGE(0xe80000, 0xe80001) AM_WRITE(SMH_NOP)
- AM_RANGE(0xf80000, 0xf80001) AM_WRITE(okim6295_data_0_msb_w)
+ AM_RANGE(0xf80000, 0xf80001) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0xff00)
ADDRESS_MAP_END
#define COMMON_COIN0\
diff --git a/src/mame/drivers/galspnbl.c b/src/mame/drivers/galspnbl.c
index 2d96b82343c..967d71ba5f3 100644
--- a/src/mame/drivers/galspnbl.c
+++ b/src/mame/drivers/galspnbl.c
@@ -71,9 +71,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_ROM
AM_RANGE(0xf000, 0xf7ff) AM_RAM
- AM_RANGE(0xf800, 0xf800) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
- AM_RANGE(0xf810, 0xf810) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0xf811, 0xf811) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0xf800, 0xf800) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
+ AM_RANGE(0xf810, 0xf811) AM_DEVWRITE(SOUND, "ym", ym3812_w)
AM_RANGE(0xfc00, 0xfc00) AM_READWRITE(SMH_NOP, SMH_NOP) /* irq ack ?? */
AM_RANGE(0xfc20, 0xfc20) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -195,9 +194,9 @@ GFXDECODE_END
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1],0,linestate);
+ cpu_set_input_line(device->machine->cpu[1],0,linestate);
}
static const ym3812_interface ym3812_config =
diff --git a/src/mame/drivers/gameplan.c b/src/mame/drivers/gameplan.c
index 7d80ba08b98..7f4afe2b2e5 100644
--- a/src/mame/drivers/gameplan.c
+++ b/src/mame/drivers/gameplan.c
@@ -250,9 +250,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( gameplan_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x1780) AM_RAM /* 6532 internal RAM */
AM_RANGE(0x0800, 0x081f) AM_MIRROR(0x17e0) AM_DEVREADWRITE(RIOT6532, "riot", riot6532_r, riot6532_w)
- AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x1ffc) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xa001, 0xa001) AM_MIRROR(0x1ffc) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0xa002, 0xa002) AM_MIRROR(0x1ffc) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x1ffc) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
+ AM_RANGE(0xa001, 0xa001) AM_MIRROR(0x1ffc) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0xa002, 0xa002) AM_MIRROR(0x1ffc) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
AM_RANGE(0xe000, 0xe7ff) AM_MIRROR(0x1800) AM_ROM
ADDRESS_MAP_END
@@ -261,9 +261,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( leprechn_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x007f) AM_MIRROR(0x1780) AM_RAM /* 6532 internal RAM */
AM_RANGE(0x0800, 0x081f) AM_MIRROR(0x17e0) AM_DEVREADWRITE(RIOT6532, "riot", riot6532_r, riot6532_w)
- AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x1ffc) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xa001, 0xa001) AM_MIRROR(0x1ffc) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0xa002, 0xa002) AM_MIRROR(0x1ffc) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x1ffc) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
+ AM_RANGE(0xa001, 0xa001) AM_MIRROR(0x1ffc) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0xa002, 0xa002) AM_MIRROR(0x1ffc) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
AM_RANGE(0xe000, 0xefff) AM_MIRROR(0x1000) AM_ROM
ADDRESS_MAP_END
@@ -1158,8 +1158,8 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_6_r,
- input_port_7_r
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_INPUT_PORT("DSW3")
};
diff --git a/src/mame/drivers/gaplus.c b/src/mame/drivers/gaplus.c
index 9cca4a4c3ef..29fad9362a0 100644
--- a/src/mame/drivers/gaplus.c
+++ b/src/mame/drivers/gaplus.c
@@ -244,10 +244,10 @@ static READ8_HANDLER( gaplus_snd_sharedram_r )
return namco_soundregs[offset];
}
-static WRITE8_HANDLER( gaplus_snd_sharedram_w )
+static WRITE8_DEVICE_HANDLER( gaplus_snd_sharedram_w )
{
if (offset < 0x40)
- namco_15xx_w(space,offset,data);
+ namco_15xx_w(device,offset,data);
else
namco_soundregs[offset] = data;
}
@@ -282,7 +282,7 @@ static WRITE8_HANDLER( gaplus_sreset_w )
int bit = !BIT(offset,11);
cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE);
cpu_set_input_line(space->machine->cpu[2], INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE);
- mappy_sound_enable(bit);
+ mappy_sound_enable(devtag_get_device(space->machine, SOUND, "namco"), bit);
}
static WRITE8_HANDLER( gaplus_freset_w )
@@ -323,7 +323,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem_cpu1, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_WRITE(gaplus_videoram_w) AM_BASE(&gaplus_videoram) /* tilemap RAM (shared with CPU #2) */
AM_RANGE(0x0800, 0x1fff) AM_WRITE(gaplus_spriteram_w) AM_BASE(&gaplus_spriteram) /* shared RAM with CPU #2 (includes sprite RAM) */
- AM_RANGE(0x6000, 0x63ff) AM_WRITE(gaplus_snd_sharedram_w) /* shared RAM with CPU #3 */
+ AM_RANGE(0x6000, 0x63ff) AM_DEVWRITE(SOUND, "namco", gaplus_snd_sharedram_w) /* shared RAM with CPU #3 */
AM_RANGE(0x6820, 0x682f) AM_WRITE(gaplus_customio_3_w) AM_BASE(&gaplus_customio_3)/* custom I/O chip #3 interface */
AM_RANGE(0x6800, 0x6bff) AM_WRITE(namcoio_w) /* custom I/O chips interface */
AM_RANGE(0x7000, 0x7fff) AM_WRITE(gaplus_irq_1_ctrl_w) /* main CPU irq control */
@@ -355,7 +355,7 @@ ADDRESS_MAP_END
/* CPU 3 (SOUND CPU) write addresses */
static ADDRESS_MAP_START( writemem_cpu3, ADDRESS_SPACE_PROGRAM, 8 )
- AM_RANGE(0x0000, 0x03ff) AM_WRITE(gaplus_snd_sharedram_w) AM_BASE(&namco_soundregs) /* shared RAM with the main CPU + sound registers */
+ AM_RANGE(0x0000, 0x03ff) AM_DEVWRITE(SOUND, "namco", gaplus_snd_sharedram_w) AM_BASE(&namco_soundregs) /* shared RAM with the main CPU + sound registers */
AM_RANGE(0x2000, 0x3fff) AM_WRITE(watchdog_reset_w) /* watchdog? */
AM_RANGE(0x4000, 0x7fff) AM_WRITE(gaplus_irq_3_ctrl_w) /* interrupt enable/disable */
AM_RANGE(0xe000, 0xffff) AM_WRITE(SMH_ROM) /* ROM */
diff --git a/src/mame/drivers/gatron.c b/src/mame/drivers/gatron.c
index 69faddd9aa4..f80ea60e561 100644
--- a/src/mame/drivers/gatron.c
+++ b/src/mame/drivers/gatron.c
@@ -346,7 +346,7 @@ static ADDRESS_MAP_START( gat_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x5fff) AM_ROM
AM_RANGE(0x6000, 0x63ff) AM_RAM_WRITE(gat_videoram_w) AM_BASE(&videoram)
AM_RANGE(0x8000, 0x87ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) /* battery backed RAM */
- AM_RANGE(0xa000, 0xa000) AM_WRITE(sn76496_0_w) /* PSG */
+ AM_RANGE(0xa000, 0xa000) AM_DEVWRITE(SOUND, "sn", sn76496_w) /* PSG */
AM_RANGE(0xe000, 0xe000) AM_WRITE(output_port_0_w) /* lamps */
ADDRESS_MAP_END
@@ -465,7 +465,7 @@ static MACHINE_DRIVER_START( gat )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("sn1", SN76496, MASTER_CLOCK/8 ) /* 2 MHz, guess */
+ MDRV_SOUND_ADD("sn", SN76496, MASTER_CLOCK/8 ) /* 2 MHz, guess */
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 2.00)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/gauntlet.c b/src/mame/drivers/gauntlet.c
index 4a3dbb8c123..b857cf779e9 100644
--- a/src/mame/drivers/gauntlet.c
+++ b/src/mame/drivers/gauntlet.c
@@ -231,7 +231,7 @@ static READ8_HANDLER( switch_6502_r )
if (atarigen_cpu_to_sound_ready) temp ^= 0x80;
if (atarigen_sound_to_cpu_ready) temp ^= 0x40;
- if (tms5220_ready_r()) temp ^= 0x20;
+ if (tms5220_ready_r(devtag_get_device(space->machine, SOUND, "tms"))) temp ^= 0x20;
if (!(input_port_read(space->machine, "803008") & 0x0008)) temp ^= 0x10;
return temp;
@@ -260,6 +260,7 @@ static WRITE8_HANDLER( tms5220_w )
static WRITE8_HANDLER( sound_ctl_w )
{
+ const device_config *tms = devtag_get_device(space->machine, SOUND, "tms");
switch (offset & 7)
{
case 0: /* music reset, bit D7, low reset */
@@ -267,18 +268,18 @@ static WRITE8_HANDLER( sound_ctl_w )
case 1: /* speech write, bit D7, active low */
if (((data ^ last_speech_write) & 0x80) && (data & 0x80))
- tms5220_data_w(space, 0, speech_val);
+ tms5220_data_w(tms, 0, speech_val);
last_speech_write = data;
break;
case 2: /* speech reset, bit D7, active low */
if (((data ^ last_speech_write) & 0x80) && (data & 0x80))
- sndti_reset(SOUND_TMS5220, 0);
+ device_reset(tms);
break;
case 3: /* speech squeak, bit D7 */
data = 5 | ((data >> 6) & 2);
- tms5220_set_frequency(ATARI_CLOCK_14MHz/2 / (16 - data));
+ tms5220_set_frequency(tms, ATARI_CLOCK_14MHz/2 / (16 - data));
break;
}
}
@@ -355,9 +356,8 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1010, 0x101f) AM_MIRROR(0x27c0) AM_READ(atarigen_6502_sound_r)
AM_RANGE(0x1020, 0x102f) AM_MIRROR(0x27c0) AM_READ_PORT("COIN") AM_WRITE(mixer_w)
AM_RANGE(0x1030, 0x103f) AM_MIRROR(0x27c0) AM_READWRITE(switch_6502_r, sound_ctl_w)
- AM_RANGE(0x1800, 0x180f) AM_MIRROR(0x27c0) AM_READWRITE(pokey1_r, pokey1_w)
- AM_RANGE(0x1810, 0x1810) AM_MIRROR(0x27ce) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x1811, 0x1811) AM_MIRROR(0x27ce) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x1800, 0x180f) AM_MIRROR(0x27c0) AM_DEVREADWRITE(SOUND, "pokey", pokey_r, pokey_w)
+ AM_RANGE(0x1810, 0x1811) AM_MIRROR(0x27ce) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x1820, 0x182f) AM_MIRROR(0x27c0) AM_WRITE(tms5220_w)
AM_RANGE(0x1830, 0x183f) AM_MIRROR(0x27c0) AM_READWRITE(atarigen_6502_irq_ack_r, atarigen_6502_irq_ack_w)
AM_RANGE(0x4000, 0xffff) AM_ROM
diff --git a/src/mame/drivers/gberet.c b/src/mame/drivers/gberet.c
index 77b4883f044..fb4471f0f99 100644
--- a/src/mame/drivers/gberet.c
+++ b/src/mame/drivers/gberet.c
@@ -159,7 +159,7 @@ static ADDRESS_MAP_START( gberet_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xe044, 0xe044) AM_WRITE(gberet_flipscreen_w)
AM_RANGE(0xf000, 0xf000) AM_WRITE(gberet_coin_counter_w)
AM_RANGE(0xf200, 0xf200) AM_READ_PORT("DSW2") AM_WRITENOP // Loads the snd command into the snd latch
- AM_RANGE(0xf400, 0xf400) AM_READ_PORT("DSW3") AM_WRITE(sn76496_0_w) // This address triggers the SN chip to read the data port.
+ AM_RANGE(0xf400, 0xf400) AM_READ_PORT("DSW3") AM_DEVWRITE(SOUND, "sn", sn76496_w) // This address triggers the SN chip to read the data port.
AM_RANGE(0xf600, 0xf600) AM_READ_PORT("DSW1")
AM_RANGE(0xf601, 0xf601) AM_READ_PORT("P2")
AM_RANGE(0xf602, 0xf602) AM_READ_PORT("P1")
@@ -179,7 +179,7 @@ static ADDRESS_MAP_START( gberetb_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xe900, 0xe9ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0xf000, 0xf000) AM_WRITENOP // coin counter not supported
AM_RANGE(0xf200, 0xf200) AM_READ_PORT("DSW2")
- AM_RANGE(0xf400, 0xf400) AM_WRITE(sn76496_0_w)
+ AM_RANGE(0xf400, 0xf400) AM_DEVWRITE(SOUND, "sn", sn76496_w)
AM_RANGE(0xf600, 0xf600) AM_READ_PORT("P2")
AM_RANGE(0xf601, 0xf601) AM_READ_PORT("DSW1")
AM_RANGE(0xf602, 0xf602) AM_READ_PORT("P1")
@@ -201,7 +201,7 @@ static ADDRESS_MAP_START( mrgoemon_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xe044, 0xe044) AM_WRITE(mrgoemon_flipscreen_w)
AM_RANGE(0xf000, 0xf000) AM_WRITE(mrgoemon_coin_counter_w)
AM_RANGE(0xf200, 0xf200) AM_READ_PORT("DSW2") AM_WRITENOP // Loads the snd command into the snd latch
- AM_RANGE(0xf400, 0xf400) AM_READ_PORT("DSW3") AM_WRITE(sn76496_0_w) // This address triggers the SN chip to read the data port.
+ AM_RANGE(0xf400, 0xf400) AM_READ_PORT("DSW3") AM_DEVWRITE(SOUND, "sn", sn76496_w) // This address triggers the SN chip to read the data port.
AM_RANGE(0xf600, 0xf600) AM_READ_PORT("DSW1") AM_WRITE(watchdog_reset_w)
AM_RANGE(0xf601, 0xf601) AM_READ_PORT("P2")
AM_RANGE(0xf602, 0xf602) AM_READ_PORT("P1")
diff --git a/src/mame/drivers/gbusters.c b/src/mame/drivers/gbusters.c
index 1aabad338ed..dc0570d203f 100644
--- a/src/mame/drivers/gbusters.c
+++ b/src/mame/drivers/gbusters.c
@@ -106,11 +106,11 @@ static WRITE8_HANDLER( gbusters_sh_irqtrigger_w )
cpu_set_input_line_and_vector(space->machine->cpu[1],0,HOLD_LINE,0xff);
}
-static WRITE8_HANDLER( gbusters_snd_bankswitch_w )
+static WRITE8_DEVICE_HANDLER( gbusters_snd_bankswitch_w )
{
int bank_B = ((data >> 2) & 0x01); /* ?? */
int bank_A = ((data) & 0x01); /* ?? */
- k007232_set_bank( 0, bank_A, bank_B );
+ k007232_set_bank( device, bank_A, bank_B );
#if 0
{
@@ -153,17 +153,16 @@ static ADDRESS_MAP_START( gbusters_readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) /* ROM 878h01.rom */
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM) /* RAM */
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r) /* soundlatch_r */
- AM_RANGE(0xb000, 0xb00d) AM_READ(k007232_read_port_0_r) /* 007232 registers */
- AM_RANGE(0xc001, 0xc001) AM_READ(ym2151_status_port_0_r) /* YM 2151 */
+ AM_RANGE(0xb000, 0xb00d) AM_DEVREAD(SOUND, "konami", k007232_r) /* 007232 registers */
+ AM_RANGE(0xc001, 0xc001) AM_DEVREAD(SOUND, "ym", ym2151_status_port_r) /* YM 2151 */
ADDRESS_MAP_END
static ADDRESS_MAP_START( gbusters_writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM) /* ROM 878h01.rom */
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM) /* RAM */
- AM_RANGE(0xb000, 0xb00d) AM_WRITE(k007232_write_port_0_w) /* 007232 registers */
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym2151_register_port_0_w) /* YM 2151 */
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ym2151_data_port_0_w) /* YM 2151 */
- AM_RANGE(0xf000, 0xf000) AM_WRITE(gbusters_snd_bankswitch_w) /* 007232 bankswitch? */
+ AM_RANGE(0xb000, 0xb00d) AM_DEVWRITE(SOUND, "konami", k007232_w) /* 007232 registers */
+ AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w) /* YM 2151 */
+ AM_RANGE(0xf000, 0xf000) AM_DEVWRITE(SOUND, "konami", gbusters_snd_bankswitch_w) /* 007232 bankswitch? */
ADDRESS_MAP_END
/***************************************************************************
@@ -283,10 +282,10 @@ INPUT_PORTS_END
***************************************************************************/
-static void volume_callback(int v)
+static void volume_callback(const device_config *device, int v)
{
- k007232_set_volume(0,0,(v >> 4) * 0x11,0);
- k007232_set_volume(0,1,0,(v & 0x0f) * 0x11);
+ k007232_set_volume(device,0,(v >> 4) * 0x11,0);
+ k007232_set_volume(device,1,0,(v & 0x0f) * 0x11);
}
static const k007232_interface k007232_config =
diff --git a/src/mame/drivers/gcpinbal.c b/src/mame/drivers/gcpinbal.c
index 6b76a6edc16..ec790fd4c90 100644
--- a/src/mame/drivers/gcpinbal.c
+++ b/src/mame/drivers/gcpinbal.c
@@ -91,7 +91,7 @@ static READ16_HANDLER( ioc_r )
case 0x50:
case 0x51:
- return okim6295_status_0_r(space,0)<<8;
+ return okim6295_r(devtag_get_device(space->machine, SOUND, "oki"),0)<<8;
}
@@ -148,7 +148,7 @@ static WRITE16_HANDLER( ioc_w )
// OKIM6295
case 0x50:
case 0x51:
- okim6295_data_0_w(space, 0, data>>8);
+ okim6295_w(devtag_get_device(space->machine, SOUND, "oki"), 0, data>>8);
break;
// MSM6585 ADPCM - mini emulation
diff --git a/src/mame/drivers/genesis.c b/src/mame/drivers/genesis.c
index 954196956b4..cd3c5ef6243 100644
--- a/src/mame/drivers/genesis.c
+++ b/src/mame/drivers/genesis.c
@@ -14,6 +14,7 @@ segac2.c
#include "driver.h"
#include "cpu/z80/z80.h"
#include "cpu/m68000/m68000.h"
+#include "sound/2612intf.h"
#include "genesis.h"
#define MASTER_CLOCK 53693100
@@ -132,10 +133,10 @@ INTERRUPT_GEN( genesis_vblank_interrupt )
/* interrupt callback to generate the YM3438 interrupt */
-void genesis_irq2_interrupt(running_machine *machine, int state)
+void genesis_irq2_interrupt(const device_config *device, int state)
{
irq2_int = state;
- update_interrupts(machine);
+ update_interrupts(device->machine);
}
@@ -253,17 +254,9 @@ READ16_HANDLER ( genesis_68k_to_z80_r )
/* YM2610 */
if ((offset >= 0x4000) && (offset <= 0x5fff))
{
- switch (offset & 3)
- {
- case 0:
- if (ACCESSING_BITS_8_15) return ym3438_status_port_0_a_r(space, 0) << 8;
- else return ym3438_read_port_0_r(space, 0);
- break;
- case 2:
- if (ACCESSING_BITS_8_15) return ym3438_status_port_0_b_r(space, 0) << 8;
- else return 0;
- break;
- }
+ if (ACCESSING_BITS_0_7)
+ offset += 1;
+ return ym3438_r(devtag_get_device(space->machine, SOUND, "ym"), offset);
}
/* Bank Register */
@@ -313,17 +306,9 @@ READ16_HANDLER ( megaplay_68k_to_z80_r )
/* YM2610 */
if ((offset >= 0x4000) && (offset <= 0x5fff))
{
- switch (offset & 3)
- {
- case 0:
- if (ACCESSING_BITS_8_15) return ym3438_status_port_0_a_r(space, 0) << 8;
- else return ym3438_read_port_0_r(space, 0);
- break;
- case 2:
- if (ACCESSING_BITS_8_15) return ym3438_status_port_0_b_r(space, 0) << 8;
- else return 0;
- break;
- }
+ if (ACCESSING_BITS_0_7)
+ offset += 1;
+ return ym3438_r(devtag_get_device(space->machine, SOUND, "ym"), offset);
}
/* Bank Register */
@@ -362,18 +347,19 @@ WRITE16_HANDLER ( genesis_68k_to_z80_w )
}
- /* YM2610 */
+ /* YM2612 */
if ((offset >= 0x4000) && (offset <= 0x5fff))
{
+ const device_config *ym = devtag_get_device(space->machine, SOUND, "ym");
switch (offset & 3)
{
case 0:
- if (ACCESSING_BITS_8_15) ym3438_control_port_0_a_w (space, 0, (data >> 8) & 0xff);
- else ym3438_data_port_0_a_w (space, 0, (data >> 0) & 0xff);
+ if (ACCESSING_BITS_8_15) ym3438_control_port_a_w (ym, 0, (data >> 8) & 0xff);
+ else ym3438_data_port_a_w (ym, 0, (data >> 0) & 0xff);
break;
case 2:
- if (ACCESSING_BITS_8_15) ym3438_control_port_0_b_w (space, 0, (data >> 8) & 0xff);
- else ym3438_data_port_0_b_w (space, 0, (data >> 0) & 0xff);
+ if (ACCESSING_BITS_8_15) ym3438_control_port_b_w (ym, 0, (data >> 8) & 0xff);
+ else ym3438_data_port_b_w (ym, 0, (data >> 0) & 0xff);
break;
}
}
@@ -397,8 +383,9 @@ WRITE16_HANDLER ( genesis_68k_to_z80_w )
if ( (offset >= 0x10) && (offset <=0x17) )
{
- if (ACCESSING_BITS_0_7) sn76496_0_w(space, 0, data & 0xff);
- if (ACCESSING_BITS_8_15) sn76496_0_w(space, 0, (data >>8) & 0xff);
+ const device_config *sn = devtag_get_device(space->machine, SOUND, "sn");
+ if (ACCESSING_BITS_0_7) sn76496_w(sn, 0, data & 0xff);
+ if (ACCESSING_BITS_8_15) sn76496_w(sn, 0, (data >>8) & 0xff);
}
}
@@ -525,13 +512,7 @@ READ8_HANDLER ( genesis_z80_r )
/* YM2610 */
if ((offset >= 0x4000) && (offset <= 0x5fff))
{
- switch (offset & 3)
- {
- case 0: return ym3438_status_port_0_a_r(space, 0);
- case 1: return ym3438_read_port_0_r(space, 0);
- case 2: return ym3438_status_port_0_b_r(space, 0);
- case 3: return 0;
- }
+ return ym3438_r(devtag_get_device(space->machine, SOUND, "ym"), offset);
}
/* Bank Register */
@@ -562,17 +543,7 @@ WRITE8_HANDLER ( genesis_z80_w )
/* YM2610 */
if ((offset >= 0x4000) && (offset <= 0x5fff))
{
- switch (offset & 3)
- {
- case 0: ym3438_control_port_0_a_w (space, 0, data);
- break;
- case 1: ym3438_data_port_0_a_w (space, 0, data);
- break;
- case 2: ym3438_control_port_0_b_w (space, 0, data);
- break;
- case 3: ym3438_data_port_0_b_w (space, 0, data);
- break;
- }
+ ym3438_w(devtag_get_device(space->machine, SOUND, "ym"), offset & 3, data);
}
/* Bank Register */
diff --git a/src/mame/drivers/getrivia.c b/src/mame/drivers/getrivia.c
index 174fb54ea63..48a513d5a59 100644
--- a/src/mame/drivers/getrivia.c
+++ b/src/mame/drivers/getrivia.c
@@ -151,7 +151,7 @@ static WRITE8_DEVICE_HANDLER( sound_w )
interrupt_enable_w(space, 0, data & 0x40);
/* bit 7 goes directly to the sound amplifier */
- dac_data_w(0,((data & 0x80) >> 7) * 255);
+ dac_data_w(devtag_get_device(device->machine, SOUND, "dac"), ((data & 0x80) >> 7) * 255);
}
static WRITE8_DEVICE_HANDLER( sound2_w )
@@ -168,7 +168,7 @@ static WRITE8_DEVICE_HANDLER( sound2_w )
set_led_status(12,data & 0x20);
/* bit 7 goes directly to the sound amplifier */
- dac_data_w(0,((data & 0x80) >> 7) * 255);
+ dac_data_w(devtag_get_device(device->machine, SOUND, "dac"), ((data & 0x80) >> 7) * 255);
}
static WRITE8_DEVICE_HANDLER( lamps2_w )
diff --git a/src/mame/drivers/gijoe.c b/src/mame/drivers/gijoe.c
index 8b95904425e..73c960530e9 100644
--- a/src/mame/drivers/gijoe.c
+++ b/src/mame/drivers/gijoe.c
@@ -191,9 +191,9 @@ static READ16_HANDLER( sound_status_r )
return soundlatch2_r(space,0);
}
-static void sound_nmi(running_machine *machine)
+static void sound_nmi(const device_config *device)
{
- cpu_set_input_line(machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE);
+ cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE);
}
static MACHINE_START( gijoe )
@@ -250,14 +250,14 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xebff) AM_READ(SMH_ROM)
AM_RANGE(0xf000, 0xf7ff) AM_READ(SMH_RAM)
- AM_RANGE(0xf800, 0xfa2f) AM_READ(k054539_0_r)
+ AM_RANGE(0xf800, 0xfa2f) AM_DEVREAD(SOUND, "konami", k054539_r)
AM_RANGE(0xfc02, 0xfc02) AM_READ(soundlatch_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xebff) AM_WRITE(SMH_ROM)
AM_RANGE(0xf000, 0xf7ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xf800, 0xfa2f) AM_WRITE(k054539_0_w)
+ AM_RANGE(0xf800, 0xfa2f) AM_DEVWRITE(SOUND, "konami", k054539_w)
AM_RANGE(0xfc00, 0xfc00) AM_WRITE(soundlatch2_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/ginganin.c b/src/mame/drivers/ginganin.c
index a26c38050ca..559b3412cdb 100644
--- a/src/mame/drivers/ginganin.c
+++ b/src/mame/drivers/ginganin.c
@@ -53,7 +53,7 @@ f5d6 print 7 digit BCD number: d0.l to (a1)+ color $3000
#include "cpu/m68000/m68000.h"
#include "deprecat.h"
#include "sound/ay8910.h"
-#include "sound/3812intf.h"
+#include "sound/8950intf.h"
/* Variables only used here */
@@ -181,10 +181,8 @@ static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0801, 0x0801) AM_WRITE(MC6840_control_port_1_w) /* Takahiro Nogi. 1999/09/27 */
AM_RANGE(0x0802, 0x0802) AM_WRITE(MC6840_write_port_0_w) /* Takahiro Nogi. 1999/09/27 */
AM_RANGE(0x0803, 0x0803) AM_WRITE(MC6840_write_port_1_w) /* Takahiro Nogi. 1999/09/27 */
- AM_RANGE(0x2000, 0x2000) AM_WRITE(y8950_control_port_0_w)
- AM_RANGE(0x2001, 0x2001) AM_WRITE(y8950_write_port_0_w)
- AM_RANGE(0x2800, 0x2800) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x2801, 0x2801) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x2000, 0x2001) AM_DEVWRITE(SOUND, "ym", y8950_w)
+ AM_RANGE(0x2800, 0x2801) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/gladiatr.c b/src/mame/drivers/gladiatr.c
index 4bdc62fd098..39153b73c7c 100644
--- a/src/mame/drivers/gladiatr.c
+++ b/src/mame/drivers/gladiatr.c
@@ -276,36 +276,31 @@ static MACHINE_RESET( gladiator )
}
}
-/* YM2203 port A handler (input) */
-static READ8_HANDLER( gladiator_dsw3_r )
-{
- return input_port_read(space->machine, "DSW3");
-}
/* YM2203 port B handler (output) */
-static WRITE8_HANDLER( gladiator_int_control_w )
+static WRITE8_DEVICE_HANDLER( gladiator_int_control_w )
{
/* bit 7 : SSRST = sound reset ? */
/* bit 6-1 : N.C. */
/* bit 0 : ?? */
}
/* YM2203 IRQ */
-static void gladiator_ym_irq(running_machine *machine, int irq)
+static void gladiator_ym_irq(const device_config *device, int irq)
{
/* NMI IRQ is not used by gladiator sound program */
- cpu_set_input_line(machine->cpu[1], INPUT_LINE_NMI, irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_NMI, irq ? ASSERT_LINE : CLEAR_LINE);
}
/*Sound Functions*/
-static WRITE8_HANDLER( glad_adpcm_w )
+static WRITE8_DEVICE_HANDLER( glad_adpcm_w )
{
- UINT8 *rom = memory_region(space->machine, "audio") + 0x10000;
+ UINT8 *rom = memory_region(device->machine, "audio") + 0x10000;
/* bit6 = bank offset */
- memory_set_bankptr(space->machine, 2,rom + ((data & 0x40) ? 0xc000 : 0));
+ memory_set_bankptr(device->machine, 2,rom + ((data & 0x40) ? 0xc000 : 0));
- msm5205_data_w(0,data); /* bit0..3 */
- msm5205_reset_w(0,(data>>5)&1); /* bit 5 */
- msm5205_vclk_w (0,(data>>4)&1); /* bit4 */
+ msm5205_data_w(device,data); /* bit0..3 */
+ msm5205_reset_w(device,(data>>5)&1); /* bit 5 */
+ msm5205_vclk_w (device,(data>>4)&1); /* bit4 */
}
static WRITE8_HANDLER( glad_cpu_sound_command_w )
@@ -416,8 +411,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( ppking_cpu2_io, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READ(ym2203_status_port_0_r) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READ(ym2203_read_port_0_r) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
AM_RANGE(0x20, 0x21) AM_READ(qx1_r) AM_WRITE(qx1_w)
AM_RANGE(0x40, 0x40) AM_READ(SMH_NOP)
AM_RANGE(0x60, 0x61) AM_READ(qx2_r) AM_WRITE(qx2_w)
@@ -445,7 +439,7 @@ static ADDRESS_MAP_START( cpu2_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END
static ADDRESS_MAP_START( gladiatr_cpu3_map, ADDRESS_SPACE_PROGRAM, 8 )
- AM_RANGE(0x1000, 0x1fff) AM_WRITE(glad_adpcm_w)
+ AM_RANGE(0x1000, 0x1fff) AM_DEVWRITE(SOUND, "msm", glad_adpcm_w)
AM_RANGE(0x2000, 0x2fff) AM_READ(glad_cpu_sound_command_r)
AM_RANGE(0x4000, 0xffff) AM_ROMBANK(2)
ADDRESS_MAP_END
@@ -464,8 +458,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( gladiatr_cpu2_io, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
AM_RANGE(0x20, 0x21) AM_READWRITE(TAITO8741_1_r, TAITO8741_1_w)
AM_RANGE(0x40, 0x40) AM_NOP // WRITE(sub_irq_ack_w)
AM_RANGE(0x60, 0x61) AM_READWRITE(TAITO8741_2_r, TAITO8741_2_w)
@@ -650,9 +643,9 @@ GFXDECODE_END
-static READ8_HANDLER(f1_r)
+static READ8_DEVICE_HANDLER(f1_r)
{
- return mame_rand(space->machine);
+ return mame_rand(device->machine);
}
static const ym2203_interface ppking_ym2203_interface =
@@ -660,10 +653,10 @@ static const ym2203_interface ppking_ym2203_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- f1_r,
- f1_r,
- NULL,
- NULL
+ DEVCB_HANDLER(f1_r),
+ DEVCB_HANDLER(f1_r),
+ DEVCB_NULL,
+ DEVCB_NULL
},
NULL
};
@@ -673,10 +666,10 @@ static const ym2203_interface gladiatr_ym2203_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- gladiator_dsw3_r, /* port B read */
- gladiator_int_control_w, /* port A write */
- NULL,
+ DEVCB_NULL,
+ DEVCB_INPUT_PORT("DSW3"), /* port B read */
+ DEVCB_HANDLER(gladiator_int_control_w), /* port A write */
+ DEVCB_NULL,
},
gladiator_ym_irq /* NMI request for 2nd cpu */
};
diff --git a/src/mame/drivers/glass.c b/src/mame/drivers/glass.c
index b4905949374..ea63b5765d5 100644
--- a/src/mame/drivers/glass.c
+++ b/src/mame/drivers/glass.c
@@ -77,7 +77,7 @@ static ADDRESS_MAP_START( glass_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW1")
AM_RANGE(0x700004, 0x700005) AM_READ_PORT("P1")
AM_RANGE(0x700006, 0x700007) AM_READ_PORT("P2")
- AM_RANGE(0x70000e, 0x70000f) AM_READ(okim6295_status_0_lsb_r)/* OKI6295 status register */
+ AM_RANGE(0x70000e, 0x70000f) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff)/* OKI6295 status register */
AM_RANGE(0xfec000, 0xfeffff) AM_READ(SMH_RAM) /* Work RAM (partially shared with DS5002FP) */
ADDRESS_MAP_END
@@ -117,7 +117,7 @@ static ADDRESS_MAP_START( glass_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x440000, 0x440fff) AM_WRITE(SMH_RAM) AM_BASE(&glass_spriteram) /* Sprite RAM */
AM_RANGE(0x700008, 0x700009) AM_WRITE(glass_blitter_w) /* serial blitter */
AM_RANGE(0x70000c, 0x70000d) AM_WRITE(OKIM6295_bankswitch_w) /* OKI6295 bankswitch */
- AM_RANGE(0x70000e, 0x70000f) AM_WRITE(okim6295_data_0_lsb_w) /* OKI6295 data register */
+ AM_RANGE(0x70000e, 0x70000f) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff) /* OKI6295 data register */
AM_RANGE(0x70000a, 0x70004b) AM_WRITE(glass_coin_w) /* Coin Counters/Lockout */
AM_RANGE(0xfec000, 0xfeffff) AM_WRITE(SMH_RAM) /* Work RAM (partially shared with DS5002FP) */
ADDRESS_MAP_END
diff --git a/src/mame/drivers/gng.c b/src/mame/drivers/gng.c
index e29e0fe75e5..caeaceec3a7 100644
--- a/src/mame/drivers/gng.c
+++ b/src/mame/drivers/gng.c
@@ -106,10 +106,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xc000, 0xc7ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0xe002, 0xe002) AM_WRITE(ym2203_control_port_1_w)
- AM_RANGE(0xe003, 0xe003) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0xe000, 0xe001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0xe002, 0xe003) AM_DEVWRITE(SOUND, "ym2", ym2203_w)
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/goal92.c b/src/mame/drivers/goal92.c
index 868058f4869..3775c483246 100644
--- a/src/mame/drivers/goal92.c
+++ b/src/mame/drivers/goal92.c
@@ -86,16 +86,16 @@ ADDRESS_MAP_END
/* Sound CPU */
-static WRITE8_HANDLER( adpcm_control_w )
+static WRITE8_DEVICE_HANDLER( adpcm_control_w )
{
int bankaddress;
- UINT8 *RAM = memory_region(space->machine, "audio");
+ UINT8 *RAM = memory_region(device->machine, "audio");
/* the code writes either 2 or 3 in the bottom two bits */
bankaddress = 0x10000 + (data & 0x01) * 0x4000;
- memory_set_bankptr(space->machine, 1,&RAM[bankaddress]);
+ memory_set_bankptr(device->machine, 1,&RAM[bankaddress]);
- msm5205_reset_w(0,data & 0x08);
+ msm5205_reset_w(device,data & 0x08);
}
static WRITE8_HANDLER( adpcm_data_w )
@@ -106,12 +106,10 @@ static WRITE8_HANDLER( adpcm_data_w )
static ADDRESS_MAP_START( sound_cpu, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(adpcm_control_w)
+ AM_RANGE(0xe000, 0xe000) AM_DEVWRITE(SOUND, "msm", adpcm_control_w)
AM_RANGE(0xe400, 0xe400) AM_WRITE(adpcm_data_w)
- AM_RANGE(0xe800, 0xe800) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0xe801, 0xe801) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
- AM_RANGE(0xec00, 0xec00) AM_READWRITE(ym2203_status_port_1_r, ym2203_control_port_1_w)
- AM_RANGE(0xec01, 0xec01) AM_READWRITE(ym2203_read_port_1_r, ym2203_write_port_1_w)
+ AM_RANGE(0xe800, 0xe801) AM_DEVREADWRITE(SOUND, "ym1", ym2203_r, ym2203_w)
+ AM_RANGE(0xec00, 0xec01) AM_DEVREADWRITE(SOUND, "ym2", ym2203_r, ym2203_w)
AM_RANGE(0xf000, 0xf7ff) AM_RAM
AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -234,9 +232,9 @@ static INPUT_PORTS_START( goal92 )
INPUT_PORTS_END
/* handler called by the 2203 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1], INPUT_LINE_NMI, irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_NMI, irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface ym2203_config =
@@ -244,7 +242,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
irqhandler
};
@@ -253,7 +251,7 @@ static void goal92_adpcm_int(const device_config *device)
{
static int toggle = 0;
- msm5205_data_w (0,msm5205next);
+ msm5205_data_w (device,msm5205next);
msm5205next>>=4;
toggle ^= 1;
diff --git a/src/mame/drivers/goindol.c b/src/mame/drivers/goindol.c
index aada4cce90e..9c28ed7c7cf 100644
--- a/src/mame/drivers/goindol.c
+++ b/src/mame/drivers/goindol.c
@@ -139,8 +139,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xc7ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xa000, 0xa000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xa001, 0xa001) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0xa000, 0xa001) AM_DEVWRITE(SOUND, "ym", ym2203_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/goldnpkr.c b/src/mame/drivers/goldnpkr.c
index c63b8d2a0e1..309f364ddfd 100644
--- a/src/mame/drivers/goldnpkr.c
+++ b/src/mame/drivers/goldnpkr.c
@@ -864,12 +864,14 @@ static WRITE8_HANDLER( lamps_a_w )
static WRITE8_HANDLER( sound_w )
{
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+
/* 555 voltage controlled */
logerror("Sound Data: %2x\n",data & 0x0f);
/* discrete sound is connected to PIA1, portA: bits 0-3 */
- discrete_sound_w(space, NODE_01, data >> 3 & 0x01);
- discrete_sound_w(space, NODE_10, data & 0x07);
+ discrete_sound_w(discrete, NODE_01, data >> 3 & 0x01);
+ discrete_sound_w(discrete, NODE_10, data & 0x07);
}
diff --git a/src/mame/drivers/goldstar.c b/src/mame/drivers/goldstar.c
index 9fcbca43e24..be39ed458eb 100644
--- a/src/mame/drivers/goldstar.c
+++ b/src/mame/drivers/goldstar.c
@@ -171,10 +171,10 @@ static ADDRESS_MAP_START( goldstar_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xf810, 0xf810) AM_READ_PORT("UNK1")
AM_RANGE(0xf811, 0xf811) AM_READ_PORT("UNK2")
AM_RANGE(0xf820, 0xf820) AM_READ_PORT("DSW2")
- AM_RANGE(0xf830, 0xf830) AM_READWRITE(ay8910_read_port_0_r,ay8910_write_port_0_w)
- AM_RANGE(0xf840, 0xf840) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0xf830, 0xf830) AM_DEVREADWRITE(SOUND, "ay", ay8910_r, ay8910_data_w)
+ AM_RANGE(0xf840, 0xf840) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
AM_RANGE(0xfa00, 0xfa00) AM_WRITE(goldstar_fa00_w)
- AM_RANGE(0xfb00, 0xfb00) AM_READWRITE(okim6295_status_0_r,okim6295_data_0_w)
+ AM_RANGE(0xfb00, 0xfb00) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0xfd00, 0xfdff) AM_READWRITE(SMH_RAM,paletteram_BBGGGRRR_w) AM_BASE(&paletteram)
AM_RANGE(0xfe00, 0xfe00) AM_READWRITE(protection_r,protection_w)
ADDRESS_MAP_END
@@ -202,11 +202,11 @@ static ADDRESS_MAP_START( ncb3_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xf800, 0xf803) AM_DEVREADWRITE(PPI8255, "ppi8255_0", ppi8255_r, ppi8255_w) /* Input Ports */
AM_RANGE(0xf810, 0xf813) AM_DEVREADWRITE(PPI8255, "ppi8255_1", ppi8255_r, ppi8255_w) /* Input Ports */
AM_RANGE(0xf820, 0xf823) AM_DEVREADWRITE(PPI8255, "ppi8255_2", ppi8255_r, ppi8255_w) /* Input/Output Ports */
- AM_RANGE(0xf830, 0xf830) AM_READWRITE(ay8910_read_port_0_r,ay8910_write_port_0_w)
- AM_RANGE(0xf840, 0xf840) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0xf830, 0xf830) AM_DEVREADWRITE(SOUND, "ay", ay8910_r, ay8910_data_w)
+ AM_RANGE(0xf840, 0xf840) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
// AM_RANGE(0xf850, 0xf850) AM_WRITE(ncb3_p1_flip_w) // need flip?
// AM_RANGE(0xf860, 0xf860) AM_WRITE(ncb3_p2_flip_w) // need flip?
- AM_RANGE(0xf870, 0xf870) AM_WRITE(sn76496_0_w) /* guess... device is initialized, but doesn't seems to be used.*/
+ AM_RANGE(0xf870, 0xf870) AM_DEVWRITE(SOUND, "sn", sn76496_w) /* guess... device is initialized, but doesn't seems to be used.*/
ADDRESS_MAP_END
static ADDRESS_MAP_START( ncb3_readwriteport, ADDRESS_SPACE_IO, 8 )
@@ -282,9 +282,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( cm_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x01, 0x01) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x02, 0x02) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x01, 0x01) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x02, 0x03) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
AM_RANGE(0x04, 0x07) AM_DEVREADWRITE(PPI8255, "ppi8255_0", ppi8255_r, ppi8255_w) /* Input Ports */
AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE(PPI8255, "ppi8255_1", ppi8255_r, ppi8255_w) /* DIP switches */
AM_RANGE(0x10, 0x10) AM_WRITE (cm_outport0_w) /* output port */
@@ -298,9 +297,8 @@ static ADDRESS_MAP_START( cmast91_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(PPI8255, "ppi8255_0", ppi8255_r, ppi8255_w) /* Input Ports */
AM_RANGE(0x10, 0x13) AM_DEVREADWRITE(PPI8255, "ppi8255_1", ppi8255_r, ppi8255_w) /* DIP switches */
- AM_RANGE(0x21, 0x21) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x22, 0x22) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x23, 0x23) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x21, 0x21) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x22, 0x23) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
ADDRESS_MAP_END
static WRITE8_HANDLER( lucky8_outport_w )
@@ -323,10 +321,10 @@ static ADDRESS_MAP_START( lucky8_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xb800, 0xb803) AM_DEVREADWRITE(PPI8255, "ppi8255_0", ppi8255_r, ppi8255_w) /* Input Ports */
AM_RANGE(0xb810, 0xb813) AM_DEVREADWRITE(PPI8255, "ppi8255_1", ppi8255_r, ppi8255_w) /* Input Ports */
AM_RANGE(0xb820, 0xb823) AM_DEVREADWRITE(PPI8255, "ppi8255_2", ppi8255_r, ppi8255_w) /* Input/Output Ports */
- AM_RANGE(0xb830, 0xb830) AM_READWRITE(ay8910_read_port_0_r,ay8910_write_port_0_w)
- AM_RANGE(0xb840, 0xb840) AM_WRITE(ay8910_control_port_0_w) /* no sound... only use both ports for DSWs */
+ AM_RANGE(0xb830, 0xb830) AM_DEVREADWRITE(SOUND, "ay", ay8910_r, ay8910_data_w)
+ AM_RANGE(0xb840, 0xb840) AM_DEVWRITE(SOUND, "ay", ay8910_address_w) /* no sound... only use both ports for DSWs */
AM_RANGE(0xb850, 0xb850) AM_WRITE(lucky8_outport_w)
- AM_RANGE(0xb870, 0xb870) AM_WRITE(sn76496_0_w) /* sound */
+ AM_RANGE(0xb870, 0xb870) AM_DEVWRITE(SOUND, "sn", sn76496_w) /* sound */
AM_RANGE(0xf800, 0xffff) AM_RAM
ADDRESS_MAP_END
@@ -349,7 +347,7 @@ static ADDRESS_MAP_START( kkojnoli_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xb830, 0xb830) AM_WRITENOP /* no ay8910 */
AM_RANGE(0xb840, 0xb840) AM_WRITENOP /* no ay8910 */
AM_RANGE(0xb850, 0xb850) AM_WRITE(lucky8_outport_w)
- AM_RANGE(0xb870, 0xb870) AM_WRITE(sn76496_0_w) /* sound */
+ AM_RANGE(0xb870, 0xb870) AM_DEVWRITE(SOUND, "sn", sn76496_w) /* sound */
AM_RANGE(0xf800, 0xffff) AM_RAM
ADDRESS_MAP_END
@@ -384,10 +382,10 @@ static ADDRESS_MAP_START( ladylinr_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xb800, 0xb803) AM_DEVREADWRITE(PPI8255, "ppi8255_0", ppi8255_r, ppi8255_w) /* Input Ports */
AM_RANGE(0xb810, 0xb813) AM_DEVREADWRITE(PPI8255, "ppi8255_1", ppi8255_r, ppi8255_w) /* DSW bank */
- AM_RANGE(0xb830, 0xb830) AM_READWRITE(ay8910_read_port_0_r,ay8910_write_port_0_w)
- AM_RANGE(0xb840, 0xb840) AM_WRITE(ay8910_control_port_0_w) /* no sound... only use ports */
+ AM_RANGE(0xb830, 0xb830) AM_DEVREADWRITE(SOUND, "ay", ay8910_r, ay8910_data_w)
+ AM_RANGE(0xb840, 0xb840) AM_DEVWRITE(SOUND, "ay", ay8910_address_w) /* no sound... only use ports */
AM_RANGE(0xb850, 0xb850) AM_WRITENOP /* just turn off the lamps, if exist */
- AM_RANGE(0xb870, 0xb870) AM_WRITE(sn76496_0_w) /* sound */
+ AM_RANGE(0xb870, 0xb870) AM_DEVWRITE(SOUND, "sn", sn76496_w) /* sound */
AM_RANGE(0xf800, 0xffff) AM_RAM
ADDRESS_MAP_END
@@ -2975,40 +2973,40 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_7_r, /* DSW 4 */
- input_port_6_r, /* DSW 3 */
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW4"),
+ DEVCB_INPUT_PORT("DSW3"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface cm_ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_6_r, /* DSW 4 */
- input_port_7_r, /* DSW 5 */
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW4"),
+ DEVCB_INPUT_PORT("DSW5"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface lucky8_ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_7_r, /* DSW 3 */
- input_port_8_r, /* DSW 4 */
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW3"),
+ DEVCB_INPUT_PORT("DSW4"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface ladylinr_ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- NULL,
- NULL
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
static MACHINE_DRIVER_START( goldstar )
@@ -3211,7 +3209,7 @@ static MACHINE_DRIVER_START( chrygld )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("sn1", SN76489, PSG_CLOCK)
+ MDRV_SOUND_ADD("sn", SN76489, PSG_CLOCK)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
MDRV_SOUND_ADD("ay", AY8910, AY_CLOCK)
@@ -3254,7 +3252,7 @@ static MACHINE_DRIVER_START( ncb3 )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("sn1", SN76489, PSG_CLOCK)
+ MDRV_SOUND_ADD("sn", SN76489, PSG_CLOCK)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
MDRV_SOUND_ADD("ay", AY8910, AY_CLOCK)
@@ -3400,7 +3398,7 @@ static MACHINE_DRIVER_START( lucky8 )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("sn1", SN76489, PSG_CLOCK)
+ MDRV_SOUND_ADD("sn", SN76489, PSG_CLOCK)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
MDRV_SOUND_ADD("ay", AY8910, AY_CLOCK)
@@ -3441,7 +3439,7 @@ static MACHINE_DRIVER_START( kkojnoli )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("sn1", SN76489, PSG_CLOCK)
+ MDRV_SOUND_ADD("sn", SN76489, PSG_CLOCK)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
MACHINE_DRIVER_END
@@ -3478,7 +3476,7 @@ static MACHINE_DRIVER_START( ladylinr )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")//set up a standard mono speaker called 'mono'
- MDRV_SOUND_ADD("sn1", SN76489, PSG_CLOCK)
+ MDRV_SOUND_ADD("sn", SN76489, PSG_CLOCK)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
MDRV_SOUND_ADD("ay", AY8910, AY_CLOCK)
diff --git a/src/mame/drivers/gomoku.c b/src/mame/drivers/gomoku.c
index 6c9ef50ccb1..504f4eec575 100644
--- a/src/mame/drivers/gomoku.c
+++ b/src/mame/drivers/gomoku.c
@@ -21,7 +21,6 @@ todo:
#include "driver.h"
#include "cpu/z80/z80.h"
-#include "sound/custom.h"
#include "includes/gomoku.h"
@@ -126,11 +125,6 @@ static GFXDECODE_START( gomoku )
GFXDECODE_END
-static const custom_sound_interface custom_interface =
-{
- gomoku_sh_start
-};
-
static MACHINE_DRIVER_START( gomoku )
/* basic machine hardware */
MDRV_CPU_ADD("main", Z80, 18432000/12) /* 1.536 MHz ? */
@@ -155,8 +149,7 @@ static MACHINE_DRIVER_START( gomoku )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("gomoku", CUSTOM, 0)
- MDRV_SOUND_CONFIG(custom_interface)
+ MDRV_SOUND_ADD("gomoku", GOMOKU, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/good.c b/src/mame/drivers/good.c
index 353ba578af5..0b2c8f31180 100644
--- a/src/mame/drivers/good.c
+++ b/src/mame/drivers/good.c
@@ -87,7 +87,7 @@ static ADDRESS_MAP_START( good_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x01ffff) AM_ROM
//AM_RANGE(0x270000, 0x270007) AM_RAM // scroll?
- AM_RANGE(0x270000, 0x270001) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x270000, 0x270001) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x280000, 0x280001) AM_READ_PORT("IN0")
AM_RANGE(0x280002, 0x280003) AM_READ_PORT("IN1")
diff --git a/src/mame/drivers/gotcha.c b/src/mame/drivers/gotcha.c
index 756b54a7c6b..172fe5921c6 100644
--- a/src/mame/drivers/gotcha.c
+++ b/src/mame/drivers/gotcha.c
@@ -96,11 +96,11 @@ static WRITE16_HANDLER( gotcha_lamps_w )
#endif
}
-static WRITE16_HANDLER( gotcha_oki_bank_w )
+static WRITE16_DEVICE_HANDLER( gotcha_oki_bank_w )
{
if (ACCESSING_BITS_8_15)
{
- okim6295_set_bank_base(0,(((~data & 0x0100) >> 8) * 0x40000));
+ okim6295_set_bank_base(device,(((~data & 0x0100) >> 8) * 0x40000));
}
}
@@ -120,7 +120,7 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_WRITE(SMH_ROM)
AM_RANGE(0x100000, 0x100001) AM_WRITE(soundlatch_word_w)
AM_RANGE(0x100002, 0x100003) AM_WRITE(gotcha_lamps_w)
- AM_RANGE(0x100004, 0x100005) AM_WRITE(gotcha_oki_bank_w)
+ AM_RANGE(0x100004, 0x100005) AM_DEVWRITE(SOUND, "oki", gotcha_oki_bank_w)
AM_RANGE(0x120000, 0x12ffff) AM_WRITE(SMH_RAM)
AM_RANGE(0x140000, 0x1405ff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16)
AM_RANGE(0x160000, 0x1607ff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
@@ -135,16 +135,15 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
- AM_RANGE(0xc001, 0xc001) AM_READ(ym2151_status_port_0_r)
+ AM_RANGE(0xc000, 0xc001) AM_DEVREAD(SOUND, "ym", ym2151_r)
AM_RANGE(0xc006, 0xc006) AM_READ(soundlatch_r)
AM_RANGE(0xd000, 0xd7ff) AM_READ(SMH_RAM)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ym2151_data_port_0_w)
- AM_RANGE(0xc002, 0xc003) AM_WRITE(okim6295_data_0_w) // TWO addresses!
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ym", ym2151_w)
+ AM_RANGE(0xc002, 0xc003) AM_DEVWRITE(SOUND, "oki", okim6295_w) // TWO addresses!
AM_RANGE(0xd000, 0xd7ff) AM_WRITE(SMH_RAM)
ADDRESS_MAP_END
@@ -261,9 +260,9 @@ GFXDECODE_END
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1],0,linestate);
+ cpu_set_input_line(device->machine->cpu[1],0,linestate);
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/gottlieb.c b/src/mame/drivers/gottlieb.c
index 1f437f24d85..8ed925e50cf 100644
--- a/src/mame/drivers/gottlieb.c
+++ b/src/mame/drivers/gottlieb.c
@@ -183,7 +183,6 @@ VBlank duration: 1/VSYNC * (16/256) = 1017.6 us
#include "sound/ay8910.h"
#include "sound/dac.h"
#include "sound/samples.h"
-#include "sound/custom.h"
#include "sound/sp0250.h"
#include "streams.h"
#include "gottlieb.h"
@@ -1896,8 +1895,7 @@ static MACHINE_DRIVER_START( g2laser )
MDRV_SCREEN_REMOVE("main")
MDRV_LASERDISC_SCREEN_ADD_NTSC("main", BITMAP_FORMAT_INDEXED16)
- MDRV_SOUND_ADD("ldsound", CUSTOM, 0)
- MDRV_SOUND_CONFIG(laserdisc_custom_interface)
+ MDRV_SOUND_ADD("ldsound", LASERDISC, 0)
MDRV_SOUND_ROUTE(0, "mono", 1.0)
/* right channel is processed as data */
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/gpworld.c b/src/mame/drivers/gpworld.c
index b566eecd3b0..a0c9ffb0fe9 100644
--- a/src/mame/drivers/gpworld.c
+++ b/src/mame/drivers/gpworld.c
@@ -463,8 +463,7 @@ static MACHINE_DRIVER_START( gpworld )
/* sound hardware */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("ldsound", CUSTOM, 0)
- MDRV_SOUND_CONFIG(laserdisc_custom_interface)
+ MDRV_SOUND_ADD("ldsound", LASERDISC, 0)
MDRV_SOUND_ROUTE(0, "left", 1.0)
MDRV_SOUND_ROUTE(1, "right", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/gradius3.c b/src/mame/drivers/gradius3.c
index 9a1204f2be9..ab77086b6a4 100644
--- a/src/mame/drivers/gradius3.c
+++ b/src/mame/drivers/gradius3.c
@@ -157,14 +157,14 @@ static WRITE16_HANDLER( sound_irq_w )
cpu_set_input_line_and_vector(space->machine->cpu[2],0,HOLD_LINE,0xff);
}
-static WRITE8_HANDLER( sound_bank_w )
+static WRITE8_DEVICE_HANDLER( sound_bank_w )
{
int bank_A, bank_B;
/* banks # for the 007232 (chip 1) */
bank_A = ((data >> 0) & 0x03);
bank_B = ((data >> 2) & 0x03);
- k007232_set_bank( 0, bank_A, bank_B );
+ k007232_set_bank( device, bank_A, bank_B );
}
@@ -205,11 +205,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( gradius3_s_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_ROM
- AM_RANGE(0xf000, 0xf000) AM_WRITE(sound_bank_w) /* 007232 bankswitch */
+ AM_RANGE(0xf000, 0xf000) AM_DEVWRITE(SOUND, "konami", sound_bank_w) /* 007232 bankswitch */
AM_RANGE(0xf010, 0xf010) AM_READ(soundlatch_r)
- AM_RANGE(0xf020, 0xf02d) AM_READWRITE(k007232_read_port_0_r, k007232_write_port_0_w)
- AM_RANGE(0xf030, 0xf030) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xf031, 0xf031) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0xf020, 0xf02d) AM_DEVREADWRITE(SOUND, "konami", k007232_r, k007232_w)
+ AM_RANGE(0xf030, 0xf031) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0xf800, 0xffff) AM_RAM
ADDRESS_MAP_END
@@ -321,10 +320,10 @@ INPUT_PORTS_END
-static void volume_callback(int v)
+static void volume_callback(const device_config *device, int v)
{
- k007232_set_volume(0,0,(v >> 4) * 0x11,0);
- k007232_set_volume(0,1,0,(v & 0x0f) * 0x11);
+ k007232_set_volume(device,0,(v >> 4) * 0x11,0);
+ k007232_set_volume(device,1,0,(v & 0x0f) * 0x11);
}
static const k007232_interface k007232_config =
diff --git a/src/mame/drivers/grchamp.c b/src/mame/drivers/grchamp.c
index d894f645f97..d35e3fbf127 100644
--- a/src/mame/drivers/grchamp.c
+++ b/src/mame/drivers/grchamp.c
@@ -243,6 +243,7 @@ static WRITE8_HANDLER( led_board_w )
static WRITE8_HANDLER( cpu1_outputs_w )
{
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
grchamp_state *state = space->machine->driver_data;
UINT8 diff = data ^ state->cpu1_out[offset];
state->cpu1_out[offset] = data;
@@ -306,18 +307,18 @@ static WRITE8_HANDLER( cpu1_outputs_w )
/* bit 2-4: ATTACK UP 1-3 */
/* bit 5-6: SIFT 1-2 */
/* bit 7: ENGINE CS */
- discrete_sound_w(space, GRCHAMP_ENGINE_CS_EN, data & 0x80);
- discrete_sound_w(space, GRCHAMP_SIFT_DATA, (data >> 5) & 0x03);
- discrete_sound_w(space, GRCHAMP_ATTACK_UP_DATA, (data >> 2) & 0x07);
- discrete_sound_w(space, GRCHAMP_IDLING_EN, data & 0x02);
- discrete_sound_w(space, GRCHAMP_FOG_EN, data & 0x01);
+ discrete_sound_w(discrete, GRCHAMP_ENGINE_CS_EN, data & 0x80);
+ discrete_sound_w(discrete, GRCHAMP_SIFT_DATA, (data >> 5) & 0x03);
+ discrete_sound_w(discrete, GRCHAMP_ATTACK_UP_DATA, (data >> 2) & 0x07);
+ discrete_sound_w(discrete, GRCHAMP_IDLING_EN, data & 0x02);
+ discrete_sound_w(discrete, GRCHAMP_FOG_EN, data & 0x01);
break;
case 0x0d: /* OUTD */
/* bit 0-3: ATTACK SPEED 1-4 */
/* bit 4-7: PLAYER SPEED 1-4 */
- discrete_sound_w(space, GRCHAMP_PLAYER_SPEED_DATA, (data >> 4) & 0x0f);
- discrete_sound_w(space, GRCHAMP_ATTACK_SPEED_DATA, data & 0x0f);
+ discrete_sound_w(discrete, GRCHAMP_PLAYER_SPEED_DATA, (data >> 4) & 0x0f);
+ discrete_sound_w(discrete, GRCHAMP_ATTACK_SPEED_DATA, data & 0x0f);
break;
default:
@@ -420,22 +421,22 @@ static READ8_HANDLER( main_to_sub_comm_r )
*
*************************************/
-static WRITE8_HANDLER( grchamp_portA_0_w )
+static WRITE8_DEVICE_HANDLER( grchamp_portA_0_w )
{
- discrete_sound_w(space, GRCHAMP_A_DATA, data);
+ discrete_sound_w(device, GRCHAMP_A_DATA, data);
}
-static WRITE8_HANDLER( grchamp_portB_0_w )
+static WRITE8_DEVICE_HANDLER( grchamp_portB_0_w )
{
- discrete_sound_w(space, GRCHAMP_B_DATA, 255-data);
+ discrete_sound_w(device, GRCHAMP_B_DATA, 255-data);
}
-static WRITE8_HANDLER( grchamp_portA_2_w )
+static WRITE8_DEVICE_HANDLER( grchamp_portA_2_w )
{
/* A0/A1 modify the output of AY8910 #2 */
/* A7 contributes to the discrete logic hanging off of AY8910 #0 */
}
-static WRITE8_HANDLER( grchamp_portB_2_w )
+static WRITE8_DEVICE_HANDLER( grchamp_portB_2_w )
{
/* B0 connects elsewhere */
}
@@ -452,20 +453,20 @@ static const ay8910_interface ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- grchamp_portA_0_w,
- grchamp_portB_0_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_DEVICE_HANDLER(SOUND, "discrete", grchamp_portA_0_w),
+ DEVCB_DEVICE_HANDLER(SOUND, "discrete", grchamp_portB_0_w)
};
static const ay8910_interface ay8910_interface_3 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- grchamp_portA_2_w,
- grchamp_portB_2_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(grchamp_portA_2_w),
+ DEVCB_HANDLER(grchamp_portB_2_w)
};
@@ -564,12 +565,12 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_ROM
AM_RANGE(0x4000, 0x43ff) AM_RAM
- AM_RANGE(0x4800, 0x4800) AM_MIRROR(0x07f8) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x4801, 0x4801) AM_MIRROR(0x07f8) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x4802, 0x4802) AM_MIRROR(0x07f8) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x4803, 0x4803) AM_MIRROR(0x07f8) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
- AM_RANGE(0x4804, 0x4804) AM_MIRROR(0x07fa) AM_WRITE(ay8910_control_port_2_w)
- AM_RANGE(0x4805, 0x4805) AM_MIRROR(0x07fa) AM_READWRITE(ay8910_read_port_2_r, ay8910_write_port_2_w)
+ AM_RANGE(0x4800, 0x4801) AM_MIRROR(0x07f8) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x4801, 0x4801) AM_MIRROR(0x07f8) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0x4802, 0x4803) AM_MIRROR(0x07f8) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x4803, 0x4803) AM_MIRROR(0x07f8) AM_DEVREAD(SOUND, "ay2", ay8910_r)
+ AM_RANGE(0x4804, 0x4805) AM_MIRROR(0x07fa) AM_DEVWRITE(SOUND, "ay3", ay8910_address_data_w)
+ AM_RANGE(0x4805, 0x4805) AM_MIRROR(0x07fa) AM_DEVREAD(SOUND, "ay3", ay8910_r)
AM_RANGE(0x5000, 0x5000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/gridlee.c b/src/mame/drivers/gridlee.c
index 051ef5149a8..eb998bb952e 100644
--- a/src/mame/drivers/gridlee.c
+++ b/src/mame/drivers/gridlee.c
@@ -81,7 +81,6 @@
#include "cpu/m6809/m6809.h"
#include "gridlee.h"
#include "balsente.h"
-#include "sound/custom.h"
#include "sound/samples.h"
@@ -417,12 +416,6 @@ INPUT_PORTS_END
*
*************************************/
-static const custom_sound_interface custom_interface =
-{
- gridlee_sh_start
-};
-
-
static const char *const sample_names[] =
{
"*gridlee",
@@ -469,8 +462,7 @@ static MACHINE_DRIVER_START( gridlee )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("gridlee", CUSTOM, 0)
- MDRV_SOUND_CONFIG(custom_interface)
+ MDRV_SOUND_ADD("gridlee", GRIDLEE, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD("samples", SAMPLES, 0)
diff --git a/src/mame/drivers/gstream.c b/src/mame/drivers/gstream.c
index a4c02fb34b2..08e225d67a4 100644
--- a/src/mame/drivers/gstream.c
+++ b/src/mame/drivers/gstream.c
@@ -195,11 +195,6 @@ static ADDRESS_MAP_START( gstream_32bit_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0xFFF80000, 0xFFFFFFFF) AM_ROM AM_REGION("user1",0) // boot rom
ADDRESS_MAP_END
-static READ32_HANDLER( gstream_oki_0_r ) { return okim6295_status_0_r(space, 0); }
-static READ32_HANDLER( gstream_oki_1_r ) { return okim6295_status_1_r(space, 0); }
-static WRITE32_HANDLER( gstream_oki_0_w ) { okim6295_data_0_w(space, 0, data & 0xff); }
-static WRITE32_HANDLER( gstream_oki_1_w ) { okim6295_data_1_w(space, 0, data & 0xff); }
-
static WRITE32_HANDLER( gstream_oki_banking_w )
{
/* OKI BANKING (still far from perfect, based on game behaviour)
@@ -263,8 +258,8 @@ static WRITE32_HANDLER( gstream_oki_banking_w )
bank_1 = 3; // end sequence music
}
- okim6295_set_bank_base(0, bank_0 * 0x40000);
- okim6295_set_bank_base(1, bank_1 * 0x40000);
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki1"), bank_0 * 0x40000);
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki2"), bank_1 * 0x40000);
}
static WRITE32_HANDLER( gstream_oki_4040_w )
@@ -278,8 +273,8 @@ static ADDRESS_MAP_START( gstream_io, ADDRESS_SPACE_IO, 32 )
AM_RANGE(0x4020, 0x4023) AM_READ_PORT("IN2") // extra coin switches etc
AM_RANGE(0x4030, 0x4033) AM_WRITE(gstream_oki_banking_w) // oki banking
AM_RANGE(0x4040, 0x4043) AM_WRITE(gstream_oki_4040_w) // ??
- AM_RANGE(0x4050, 0x4053) AM_READWRITE(gstream_oki_1_r, gstream_oki_1_w) // music and samples
- AM_RANGE(0x4060, 0x4063) AM_READWRITE(gstream_oki_0_r, gstream_oki_0_w) // music and samples
+ AM_RANGE(0x4050, 0x4053) AM_DEVREADWRITE8(SOUND, "oki2", okim6295_r, okim6295_w, 0x000000ff) // music and samples
+ AM_RANGE(0x4060, 0x4063) AM_DEVREADWRITE8(SOUND, "oki1", okim6295_r, okim6295_w, 0x000000ff) // music and samples
ADDRESS_MAP_END
static INPUT_PORTS_START( gstream )
diff --git a/src/mame/drivers/gstriker.c b/src/mame/drivers/gstriker.c
index 0a0e1c0e49d..70740cf6368 100644
--- a/src/mame/drivers/gstriker.c
+++ b/src/mame/drivers/gstriker.c
@@ -267,12 +267,12 @@ GFXDECODE_END
/*** MORE SOUND RELATED ******************************************************/
-static void gs_ym2610_irq(running_machine *machine, int irq)
+static void gs_ym2610_irq(const device_config *device, int irq)
{
if (irq)
- cpu_set_input_line(machine->cpu[1], 0, ASSERT_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, ASSERT_LINE);
else
- cpu_set_input_line(machine->cpu[1], 0, CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, CLEAR_LINE);
}
static const ym2610_interface ym2610_config =
@@ -330,10 +330,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym2610_status_port_0_a_r, ym2610_control_port_0_a_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym2610_data_port_0_a_w)
- AM_RANGE(0x02, 0x02) AM_READWRITE(ym2610_status_port_0_b_r, ym2610_control_port_0_b_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(SOUND, "ym", ym2610_r, ym2610_w)
AM_RANGE(0x04, 0x04) AM_WRITE(gs_sh_bankswitch_w)
AM_RANGE(0x08, 0x08) AM_WRITE(gs_sh_pending_command_clear_w)
AM_RANGE(0x0c, 0x0c) AM_READ(soundlatch_r)
diff --git a/src/mame/drivers/gsword.c b/src/mame/drivers/gsword.c
index 2f687357be6..ee94431cfe6 100644
--- a/src/mame/drivers/gsword.c
+++ b/src/mame/drivers/gsword.c
@@ -289,7 +289,7 @@ static INTERRUPT_GEN( gsword_snd_interrupt )
}
}
-static WRITE8_HANDLER( gsword_nmi_set_w )
+static WRITE8_DEVICE_HANDLER( gsword_nmi_set_w )
{
/* mame_printf_debug("AY write %02X\n",data);*/
@@ -329,31 +329,31 @@ static WRITE8_HANDLER( josvolly_nmi_enable_w )
josvolly_nmi_enable = 1;
}
-static WRITE8_HANDLER( gsword_AY8910_control_port_0_w )
+static WRITE8_DEVICE_HANDLER( gsword_AY8910_control_port_0_w )
{
- ay8910_control_port_0_w(space,offset,data);
+ ay8910_address_w(device,offset,data);
fake8910_0 = data;
}
-static WRITE8_HANDLER( gsword_AY8910_control_port_1_w )
+static WRITE8_DEVICE_HANDLER( gsword_AY8910_control_port_1_w )
{
- ay8910_control_port_1_w(space,offset,data);
+ ay8910_address_w(device,offset,data);
fake8910_1 = data;
}
-static READ8_HANDLER( gsword_fake_0_r )
+static READ8_DEVICE_HANDLER( gsword_fake_0_r )
{
return fake8910_0+1;
}
-static READ8_HANDLER( gsword_fake_1_r )
+static READ8_DEVICE_HANDLER( gsword_fake_1_r )
{
return fake8910_1+1;
}
-static WRITE8_HANDLER( gsword_adpcm_data_w )
+static WRITE8_DEVICE_HANDLER( gsword_adpcm_data_w )
{
- msm5205_data_w (0,data & 0x0f); /* bit 0..3 */
- msm5205_reset_w(0,(data>>5)&1); /* bit 5 */
- msm5205_vclk_w(0,(data>>4)&1); /* bit 4 */
+ msm5205_data_w (device,data & 0x0f); /* bit 0..3 */
+ msm5205_reset_w(device,(data>>5)&1); /* bit 5 */
+ msm5205_vclk_w(device,(data>>4)&1); /* bit 4 */
}
static WRITE8_HANDLER( adpcm_soundcommand_w )
@@ -398,10 +398,10 @@ static ADDRESS_MAP_START( cpu2_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0x01) AM_WRITE(TAITO8741_2_w) AM_READ(TAITO8741_2_r)
AM_RANGE(0x20, 0x21) AM_WRITE(TAITO8741_3_w) AM_READ(TAITO8741_3_r)
AM_RANGE(0x40, 0x41) AM_WRITE(TAITO8741_1_w) AM_READ(TAITO8741_1_r)
- AM_RANGE(0x60, 0x60) AM_WRITE(gsword_AY8910_control_port_0_w) AM_READ(gsword_fake_0_r)
- AM_RANGE(0x61, 0x61) AM_WRITE(ay8910_write_port_0_w) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x80, 0x80) AM_WRITE(gsword_AY8910_control_port_1_w) AM_READ(gsword_fake_1_r)
- AM_RANGE(0x81, 0x81) AM_WRITE(ay8910_write_port_1_w) AM_READ(ay8910_read_port_1_r)
+ AM_RANGE(0x60, 0x60) AM_DEVREADWRITE(SOUND, "ay1", gsword_fake_0_r, gsword_AY8910_control_port_0_w)
+ AM_RANGE(0x61, 0x61) AM_DEVREADWRITE(SOUND, "ay1", ay8910_r, ay8910_data_w)
+ AM_RANGE(0x80, 0x80) AM_DEVREADWRITE(SOUND, "ay2", gsword_fake_1_r, gsword_AY8910_control_port_1_w)
+ AM_RANGE(0x81, 0x81) AM_DEVREADWRITE(SOUND, "ay2", ay8910_r, ay8910_data_w)
//
AM_RANGE(0xe0, 0xe0) AM_READ(SMH_NOP) /* ?? */
AM_RANGE(0xa0, 0xa0) AM_WRITE(SMH_NOP) /* ?? */
@@ -412,7 +412,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( cpu3_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
- AM_RANGE(0x8000, 0x8000) AM_WRITE(gsword_adpcm_data_w)
+ AM_RANGE(0x8000, 0x8000) AM_DEVWRITE(SOUND, "msm", gsword_adpcm_data_w)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -432,10 +432,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( josvolly_cpu2_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(gsword_AY8910_control_port_0_w) AM_READ(gsword_fake_0_r)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_write_port_0_w) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x40, 0x40) AM_WRITE(gsword_AY8910_control_port_1_w) AM_READ(gsword_fake_1_r)
- AM_RANGE(0x41, 0x41) AM_WRITE(ay8910_write_port_1_w) AM_READ(ay8910_read_port_1_r)
+ AM_RANGE(0x00, 0x00) AM_DEVREADWRITE(SOUND, "ay1", gsword_fake_0_r, gsword_AY8910_control_port_0_w)
+ AM_RANGE(0x01, 0x01) AM_DEVREADWRITE(SOUND, "ay1", ay8910_r, ay8910_data_w)
+ AM_RANGE(0x40, 0x40) AM_DEVREADWRITE(SOUND, "ay2", gsword_fake_1_r, gsword_AY8910_control_port_1_w)
+ AM_RANGE(0x41, 0x41) AM_DEVREADWRITE(SOUND, "ay2", ay8910_r, ay8910_data_w)
AM_RANGE(0x81, 0x81) AM_WRITE(josvolly_nmi_enable_w)
AM_RANGE(0xC1, 0xC1) AM_NOP // irq clear
@@ -679,10 +679,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- gsword_nmi_set_w, /* portA write */
- NULL
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(gsword_nmi_set_w), /* portA write */
+ DEVCB_NULL
};
static const msm5205_interface msm5205_config =
diff --git a/src/mame/drivers/gticlub.c b/src/mame/drivers/gticlub.c
index 18d3b71d1d8..911ab299e76 100644
--- a/src/mame/drivers/gticlub.c
+++ b/src/mame/drivers/gticlub.c
@@ -632,7 +632,7 @@ static ADDRESS_MAP_START( sound_memmap, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_ROM
AM_RANGE(0x200000, 0x20ffff) AM_RAM
AM_RANGE(0x300000, 0x30000f) AM_READWRITE(K056800_sound_r, K056800_sound_w)
- AM_RANGE(0x400000, 0x400fff) AM_READWRITE(rf5c400_0_r, rf5c400_0_w) /* Ricoh RF5C400 */
+ AM_RANGE(0x400000, 0x400fff) AM_DEVREADWRITE(SOUND, "rf", rf5c400_r, rf5c400_w) /* Ricoh RF5C400 */
AM_RANGE(0x580000, 0x580001) AM_WRITENOP
AM_RANGE(0x600000, 0x600001) AM_WRITENOP
ADDRESS_MAP_END
diff --git a/src/mame/drivers/guab.c b/src/mame/drivers/guab.c
index e1471ecff56..4d3a0904f79 100644
--- a/src/mame/drivers/guab.c
+++ b/src/mame/drivers/guab.c
@@ -622,7 +622,7 @@ static WRITE16_HANDLER( io_w )
}
case 0x30:
{
- sn76496_0_w(0, 0, data & 0xff);
+ sn76496_w(devtag_get_device(space->machine, SOUND, "sn"), 0, data & 0xff);
break;
}
case 0x31:
diff --git a/src/mame/drivers/gumbo.c b/src/mame/drivers/gumbo.c
index 1473729237d..6732c76a570 100644
--- a/src/mame/drivers/gumbo.c
+++ b/src/mame/drivers/gumbo.c
@@ -59,7 +59,7 @@ static ADDRESS_MAP_START( gumbo_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x1b0000, 0x1b03ff) AM_READ(SMH_RAM)
AM_RANGE(0x1c0100, 0x1c0101) AM_READ_PORT("P1_P2")
AM_RANGE(0x1c0200, 0x1c0201) AM_READ_PORT("DSW")
- AM_RANGE(0x1c0300, 0x1c0301) AM_READ(okim6295_status_0_lsb_r)
+ AM_RANGE(0x1c0300, 0x1c0301) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff)
AM_RANGE(0x1e0000, 0x1e0fff) AM_READ(SMH_RAM)
AM_RANGE(0x1f0000, 0x1f3fff) AM_READ(SMH_RAM)
ADDRESS_MAP_END
@@ -67,7 +67,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( gumbo_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x03ffff) AM_WRITE(SMH_ROM)
AM_RANGE(0x080000, 0x083fff) AM_WRITE(SMH_RAM) // main ram
- AM_RANGE(0x1c0300, 0x1c0301) AM_WRITE(okim6295_data_0_lsb_w)
+ AM_RANGE(0x1c0300, 0x1c0301) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff)
AM_RANGE(0x1b0000, 0x1b03ff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16)
AM_RANGE(0x1e0000, 0x1e0fff) AM_WRITE(gumbo_bg_videoram_w) AM_BASE(&gumbo_bg_videoram) // bg tilemap
AM_RANGE(0x1f0000, 0x1f3fff) AM_WRITE(gumbo_fg_videoram_w) AM_BASE(&gumbo_fg_videoram) // fg tilemap
@@ -81,7 +81,7 @@ static ADDRESS_MAP_START( mspuzzle_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x1a0000, 0x1a03ff) AM_READ(SMH_RAM)
AM_RANGE(0x1b0100, 0x1b0101) AM_READ_PORT("P1_P2")
AM_RANGE(0x1b0200, 0x1b0201) AM_READ_PORT("DSW")
- AM_RANGE(0x1b0300, 0x1b0301) AM_READ(okim6295_status_0_lsb_r)
+ AM_RANGE(0x1b0300, 0x1b0301) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff)
AM_RANGE(0x190000, 0x197fff) AM_READ(SMH_RAM)
AM_RANGE(0x1c0000, 0x1c1fff) AM_READ(SMH_RAM)
ADDRESS_MAP_END
@@ -89,7 +89,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( mspuzzle_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_WRITE(SMH_ROM)
AM_RANGE(0x100000, 0x103fff) AM_WRITE(SMH_RAM) // main ram
- AM_RANGE(0x1b0300, 0x1b0301) AM_WRITE(okim6295_data_0_lsb_w)
+ AM_RANGE(0x1b0300, 0x1b0301) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff)
AM_RANGE(0x1a0000, 0x1a03ff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16)
AM_RANGE(0x190000, 0x197fff) AM_WRITE(gumbo_fg_videoram_w) AM_BASE(&gumbo_fg_videoram) // fg tilemap
AM_RANGE(0x1c0000, 0x1c1fff) AM_WRITE(gumbo_bg_videoram_w) AM_BASE(&gumbo_bg_videoram) // bg tilemap
@@ -100,7 +100,7 @@ static ADDRESS_MAP_START( dblpoint_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x080000, 0x083fff) AM_READ(SMH_RAM)
AM_RANGE(0x1c0100, 0x1c0101) AM_READ_PORT("P1_P2")
AM_RANGE(0x1c0200, 0x1c0201) AM_READ_PORT("DSW")
- AM_RANGE(0x1c0300, 0x1c0301) AM_READ(okim6295_status_0_lsb_r)
+ AM_RANGE(0x1c0300, 0x1c0301) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff)
AM_RANGE(0x1e0000, 0x1e3fff) AM_READ(SMH_RAM)
AM_RANGE(0x1f0000, 0x1f0fff) AM_READ(SMH_RAM)
ADDRESS_MAP_END
@@ -108,7 +108,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( dblpoint_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_WRITE(SMH_ROM)
AM_RANGE(0x080000, 0x083fff) AM_WRITE(SMH_RAM) // main ram
- AM_RANGE(0x1c0300, 0x1c0301) AM_WRITE(okim6295_data_0_lsb_w)
+ AM_RANGE(0x1c0300, 0x1c0301) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff)
AM_RANGE(0x1b0000, 0x1b03ff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16)
AM_RANGE(0x1e0000, 0x1e3fff) AM_WRITE(gumbo_fg_videoram_w) AM_BASE(&gumbo_fg_videoram) // fg tilemap
AM_RANGE(0x1f0000, 0x1f0fff) AM_WRITE(gumbo_bg_videoram_w) AM_BASE(&gumbo_bg_videoram) // bg tilemap
diff --git a/src/mame/drivers/gundealr.c b/src/mame/drivers/gundealr.c
index 502525983bd..2c6062a4a32 100644
--- a/src/mame/drivers/gundealr.c
+++ b/src/mame/drivers/gundealr.c
@@ -176,8 +176,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( main_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/gunsmoke.c b/src/mame/drivers/gunsmoke.c
index e33f15780c8..1508fa04965 100644
--- a/src/mame/drivers/gunsmoke.c
+++ b/src/mame/drivers/gunsmoke.c
@@ -134,10 +134,8 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0xc000, 0xc7ff) AM_RAM
AM_RANGE(0xc800, 0xc800) AM_READ(soundlatch_r)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0xe002, 0xe002) AM_WRITE(ym2203_control_port_1_w)
- AM_RANGE(0xe003, 0xe003) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0xe000, 0xe001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0xe002, 0xe003) AM_DEVWRITE(SOUND, "ym2", ym2203_w)
ADDRESS_MAP_END
/* Input Ports */
diff --git a/src/mame/drivers/gyruss.c b/src/mame/drivers/gyruss.c
index 3808c50db80..faac9a9f139 100644
--- a/src/mame/drivers/gyruss.c
+++ b/src/mame/drivers/gyruss.c
@@ -96,15 +96,15 @@ static const int gyruss_timer[10] =
0x00, 0x01, 0x02, 0x03, 0x04, 0x09, 0x0a, 0x0b, 0x0a, 0x0d
};
-static READ8_HANDLER( gyruss_portA_r )
+static READ8_DEVICE_HANDLER( gyruss_portA_r )
{
- return gyruss_timer[(cputag_get_total_cycles(space->machine, "audio") / 1024) % 10];
+ return gyruss_timer[(cputag_get_total_cycles(device->machine, "audio") / 1024) % 10];
}
-static WRITE8_HANDLER( gyruss_dac_w )
+static WRITE8_DEVICE_HANDLER( gyruss_dac_w )
{
- discrete_sound_w(space, NODE(16), data);
+ discrete_sound_w(device, NODE(16), data);
}
static WRITE8_HANDLER( gyruss_irq_clear_w )
@@ -112,7 +112,7 @@ static WRITE8_HANDLER( gyruss_irq_clear_w )
cputag_set_input_line(space->machine, "audio2", 0, CLEAR_LINE);
}
-static void filter_w(const address_space *space, int chip, int data)
+static void filter_w(const device_config *device, int chip, int data)
{
int i;
@@ -121,19 +121,19 @@ static void filter_w(const address_space *space, int chip, int data)
{
/* low bit: 47000pF = 0.047uF */
/* high bit: 220000pF = 0.22uF */
- discrete_sound_w(space, NODE(3 * chip + i + 21), data & 3);
+ discrete_sound_w(device, NODE(3 * chip + i + 21), data & 3);
data >>= 2;
}
}
-static WRITE8_HANDLER( gyruss_filter0_w )
+static WRITE8_DEVICE_HANDLER( gyruss_filter0_w )
{
- filter_w(space, 0,data);
+ filter_w(device, 0,data);
}
-static WRITE8_HANDLER( gyruss_filter1_w )
+static WRITE8_DEVICE_HANDLER( gyruss_filter1_w )
{
- filter_w(space, 1,data);
+ filter_w(device, 1,data);
}
@@ -183,21 +183,21 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( audio_cpu1_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x02, 0x02) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x04, 0x04) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x05, 0x05) AM_READ(ay8910_read_port_1_r)
- AM_RANGE(0x06, 0x06) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x08, 0x08) AM_WRITE(ay8910_control_port_2_w)
- AM_RANGE(0x09, 0x09) AM_READ(ay8910_read_port_2_r)
- AM_RANGE(0x0a, 0x0a) AM_WRITE(ay8910_write_port_2_w)
- AM_RANGE(0x0c, 0x0c) AM_WRITE(ay8910_control_port_3_w)
- AM_RANGE(0x0d, 0x0d) AM_READ(ay8910_read_port_3_r)
- AM_RANGE(0x0e, 0x0e) AM_WRITE(ay8910_write_port_3_w)
- AM_RANGE(0x10, 0x10) AM_WRITE(ay8910_control_port_4_w)
- AM_RANGE(0x11, 0x11) AM_READ(ay8910_read_port_4_r)
- AM_RANGE(0x12, 0x12) AM_WRITE(ay8910_write_port_4_w)
+ AM_RANGE(0x00, 0x00) AM_DEVWRITE(SOUND, "ay1", ay8910_address_w)
+ AM_RANGE(0x01, 0x01) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0x02, 0x02) AM_DEVWRITE(SOUND, "ay1", ay8910_data_w)
+ AM_RANGE(0x04, 0x04) AM_DEVWRITE(SOUND, "ay2", ay8910_address_w)
+ AM_RANGE(0x05, 0x05) AM_DEVREAD(SOUND, "ay2", ay8910_r)
+ AM_RANGE(0x06, 0x06) AM_DEVWRITE(SOUND, "ay2", ay8910_data_w)
+ AM_RANGE(0x08, 0x08) AM_DEVWRITE(SOUND, "ay3", ay8910_address_w)
+ AM_RANGE(0x09, 0x09) AM_DEVREAD(SOUND, "ay3", ay8910_r)
+ AM_RANGE(0x0a, 0x0a) AM_DEVWRITE(SOUND, "ay3", ay8910_data_w)
+ AM_RANGE(0x0c, 0x0c) AM_DEVWRITE(SOUND, "ay4", ay8910_address_w)
+ AM_RANGE(0x0d, 0x0d) AM_DEVREAD(SOUND, "ay4", ay8910_r)
+ AM_RANGE(0x0e, 0x0e) AM_DEVWRITE(SOUND, "ay4", ay8910_data_w)
+ AM_RANGE(0x10, 0x10) AM_DEVWRITE(SOUND, "ay5", ay8910_address_w)
+ AM_RANGE(0x11, 0x11) AM_DEVREAD(SOUND, "ay5", ay8910_r)
+ AM_RANGE(0x12, 0x12) AM_DEVWRITE(SOUND, "ay5", ay8910_data_w)
AM_RANGE(0x14, 0x14) AM_WRITE(gyruss_i8039_irq_w)
AM_RANGE(0x18, 0x18) AM_WRITE(soundlatch2_w)
ADDRESS_MAP_END
@@ -208,7 +208,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( audio_cpu2_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0xff) AM_READ(soundlatch2_r)
- AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(gyruss_dac_w)
+ AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE(SOUND, "discrete", gyruss_dac_w)
AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(gyruss_irq_clear_w)
ADDRESS_MAP_END
@@ -363,50 +363,50 @@ static const ay8910_interface ay8910_interface_1 =
{
AY8910_DISCRETE_OUTPUT,
{ RES_K(3.3), RES_K(3.3), RES_K(3.3) },
- NULL,
- NULL,
- NULL,
- gyruss_filter0_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_DEVICE_HANDLER(SOUND, "discrete", gyruss_filter0_w)
};
static const ay8910_interface ay8910_interface_2 =
{
AY8910_DISCRETE_OUTPUT,
{ RES_K(3.3), RES_K(3.3), RES_K(3.3) },
- NULL,
- NULL,
- NULL,
- gyruss_filter1_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_DEVICE_HANDLER(SOUND, "discrete", gyruss_filter1_w)
};
static const ay8910_interface ay8910_interface_3 =
{
AY8910_DISCRETE_OUTPUT,
{ RES_K(3.3), RES_K(3.3), RES_K(3.3) },
- gyruss_portA_r,
- NULL,
- NULL,
- NULL
+ DEVCB_HANDLER(gyruss_portA_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface ay8910_interface_4 =
{
AY8910_DISCRETE_OUTPUT,
{ RES_K(3.3), RES_K(3.3), RES_K(3.3) },
- NULL,
- NULL,
- NULL,
- NULL
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface ay8910_interface_5 =
{
AY8910_DISCRETE_OUTPUT,
{ RES_K(3.3), RES_K(3.3), RES_K(3.3) },
- NULL,
- NULL,
- NULL,
- NULL
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const discrete_mixer_desc konami_right_mixer_desc =
@@ -543,35 +543,35 @@ static MACHINE_DRIVER_START( gyruss )
MDRV_SOUND_ADD("ay1", AY8910, 14318180/8)
MDRV_SOUND_CONFIG(ay8910_interface_1)
- MDRV_SOUND_ROUTE_EX(0, "konami", 1.0, 0)
- MDRV_SOUND_ROUTE_EX(1, "konami", 1.0, 1)
- MDRV_SOUND_ROUTE_EX(2, "konami", 1.0, 2)
+ MDRV_SOUND_ROUTE_EX(0, "discrete", 1.0, 0)
+ MDRV_SOUND_ROUTE_EX(1, "discrete", 1.0, 1)
+ MDRV_SOUND_ROUTE_EX(2, "discrete", 1.0, 2)
MDRV_SOUND_ADD("ay2", AY8910, 14318180/8)
MDRV_SOUND_CONFIG(ay8910_interface_2)
- MDRV_SOUND_ROUTE_EX(0, "konami", 1.0, 3)
- MDRV_SOUND_ROUTE_EX(1, "konami", 1.0, 4)
- MDRV_SOUND_ROUTE_EX(2, "konami", 1.0, 5)
+ MDRV_SOUND_ROUTE_EX(0, "discrete", 1.0, 3)
+ MDRV_SOUND_ROUTE_EX(1, "discrete", 1.0, 4)
+ MDRV_SOUND_ROUTE_EX(2, "discrete", 1.0, 5)
MDRV_SOUND_ADD("ay3", AY8910, 14318180/8)
MDRV_SOUND_CONFIG(ay8910_interface_3)
- MDRV_SOUND_ROUTE_EX(0, "konami", 1.0, 6)
- MDRV_SOUND_ROUTE_EX(1, "konami", 1.0, 7)
- MDRV_SOUND_ROUTE_EX(2, "konami", 1.0, 8)
+ MDRV_SOUND_ROUTE_EX(0, "discrete", 1.0, 6)
+ MDRV_SOUND_ROUTE_EX(1, "discrete", 1.0, 7)
+ MDRV_SOUND_ROUTE_EX(2, "discrete", 1.0, 8)
MDRV_SOUND_ADD("ay4", AY8910, 14318180/8)
MDRV_SOUND_CONFIG(ay8910_interface_4)
- MDRV_SOUND_ROUTE_EX(0, "konami", 1.0, 9)
- MDRV_SOUND_ROUTE_EX(1, "konami", 1.0, 10)
- MDRV_SOUND_ROUTE_EX(2, "konami", 1.0, 11)
+ MDRV_SOUND_ROUTE_EX(0, "discrete", 1.0, 9)
+ MDRV_SOUND_ROUTE_EX(1, "discrete", 1.0, 10)
+ MDRV_SOUND_ROUTE_EX(2, "discrete", 1.0, 11)
MDRV_SOUND_ADD("ay5", AY8910, 14318180/8)
MDRV_SOUND_CONFIG(ay8910_interface_5)
- MDRV_SOUND_ROUTE_EX(0, "konami", 1.0, 12)
- MDRV_SOUND_ROUTE_EX(1, "konami", 1.0, 13)
- MDRV_SOUND_ROUTE_EX(2, "konami", 1.0, 14)
+ MDRV_SOUND_ROUTE_EX(0, "discrete", 1.0, 12)
+ MDRV_SOUND_ROUTE_EX(1, "discrete", 1.0, 13)
+ MDRV_SOUND_ROUTE_EX(2, "discrete", 1.0, 14)
- MDRV_SOUND_ADD("konami", DISCRETE, 0)
+ MDRV_SOUND_ADD("discrete", DISCRETE, 0)
MDRV_SOUND_CONFIG_DISCRETE(gyruss_sound)
MDRV_SOUND_ROUTE(0, "right", 1.0)
MDRV_SOUND_ROUTE(1, "left", 1.0)
diff --git a/src/mame/drivers/halleys.c b/src/mame/drivers/halleys.c
index 946530e5f8d..07679f8ca97 100644
--- a/src/mame/drivers/halleys.c
+++ b/src/mame/drivers/halleys.c
@@ -1577,7 +1577,7 @@ static WRITE8_HANDLER( firq_ack_w )
}
-static WRITE8_HANDLER( sndnmi_msk_w )
+static WRITE8_DEVICE_HANDLER( sndnmi_msk_w )
{
sndnmi_mask = data & 1;
}
@@ -1663,9 +1663,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM)
AM_RANGE(0x4000, 0x47ff) AM_READ(SMH_RAM)
- AM_RANGE(0x4801, 0x4801) AM_READ(ay8910_read_port_1_r)
- AM_RANGE(0x4803, 0x4803) AM_READ(ay8910_read_port_2_r)
- AM_RANGE(0x4805, 0x4805) AM_READ(ay8910_read_port_3_r)
+ AM_RANGE(0x4801, 0x4801) AM_DEVREAD(SOUND, "ay2", ay8910_r)
+ AM_RANGE(0x4803, 0x4803) AM_DEVREAD(SOUND, "ay3", ay8910_r)
+ AM_RANGE(0x4805, 0x4805) AM_DEVREAD(SOUND, "ay4", ay8910_r)
AM_RANGE(0x5000, 0x5000) AM_READ(soundlatch_r)
AM_RANGE(0xe000, 0xefff) AM_READ(SMH_ROM) // space for diagnostic ROM
ADDRESS_MAP_END
@@ -1674,12 +1674,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x4000, 0x47ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x4800, 0x4800) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x4801, 0x4801) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x4802, 0x4802) AM_WRITE(ay8910_control_port_2_w)
- AM_RANGE(0x4803, 0x4803) AM_WRITE(ay8910_write_port_2_w)
- AM_RANGE(0x4804, 0x4804) AM_WRITE(ay8910_control_port_3_w)
- AM_RANGE(0x4805, 0x4805) AM_WRITE(ay8910_write_port_3_w)
+ AM_RANGE(0x4800, 0x4801) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x4802, 0x4803) AM_DEVWRITE(SOUND, "ay3", ay8910_address_data_w)
+ AM_RANGE(0x4804, 0x4805) AM_DEVWRITE(SOUND, "ay4", ay8910_address_data_w)
AM_RANGE(0xe000, 0xefff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
@@ -1940,10 +1937,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- NULL,
- sndnmi_msk_w // port Bwrite
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(sndnmi_msk_w) // port Bwrite
};
diff --git a/src/mame/drivers/hanaawas.c b/src/mame/drivers/hanaawas.c
index c99fc04b116..5eb2faef003 100644
--- a/src/mame/drivers/hanaawas.c
+++ b/src/mame/drivers/hanaawas.c
@@ -32,7 +32,7 @@
extern WRITE8_HANDLER( hanaawas_videoram_w );
extern WRITE8_HANDLER( hanaawas_colorram_w );
-extern WRITE8_HANDLER( hanaawas_portB_w );
+extern WRITE8_DEVICE_HANDLER( hanaawas_portB_w );
extern PALETTE_INIT( hanaawas );
extern VIDEO_START( hanaawas );
@@ -99,8 +99,8 @@ static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_READWRITE(hanaawas_input_port_0_r, hanaawas_inputs_mux_w)
AM_RANGE(0x01, 0x01) AM_READNOP /* it must return 0 */
- AM_RANGE(0x10, 0x10) AM_READWRITE(ay8910_read_port_0_r, ay8910_control_port_0_w)
- AM_RANGE(0x11, 0x11) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x10, 0x10) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x10, 0x11) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
ADDRESS_MAP_END
static INPUT_PORTS_START( hanaawas )
@@ -192,10 +192,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_1_r,
- NULL,
- NULL,
- hanaawas_portB_w
+ DEVCB_INPUT_PORT("DSW"),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(hanaawas_portB_w)
};
diff --git a/src/mame/drivers/hanaroku.c b/src/mame/drivers/hanaroku.c
index 263ae4858d9..e12a60b229b 100644
--- a/src/mame/drivers/hanaroku.c
+++ b/src/mame/drivers/hanaroku.c
@@ -125,7 +125,7 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xa000, 0xa1ff) AM_READ(SMH_RAM)
AM_RANGE(0xc000, 0xc3ff) AM_READ(SMH_RAM)
AM_RANGE(0xc400, 0xc4ff) AM_READ(SMH_RAM)
- AM_RANGE(0xd000, 0xd000) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0xd000, 0xd000) AM_DEVREAD(SOUND, "ay", ay8910_r)
AM_RANGE(0xe000, 0xe000) AM_READ_PORT("IN0")
AM_RANGE(0xe001, 0xe001) AM_READ_PORT("IN1")
AM_RANGE(0xe002, 0xe002) AM_READ_PORT("IN2")
@@ -142,8 +142,7 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xc000, 0xc3ff) AM_WRITE(SMH_RAM) // main ram
AM_RANGE(0xc400, 0xc4ff) AM_WRITE(SMH_RAM) // ???
AM_RANGE(0xb000, 0xb000) AM_WRITE(SMH_NOP) // ??? always 0x40
- AM_RANGE(0xd000, 0xd000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xd001, 0xd001) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0xd000, 0xd001) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
AM_RANGE(0xe000, 0xe000) AM_WRITE(hanaroku_out_0_w)
AM_RANGE(0xe002, 0xe002) AM_WRITE(hanaroku_out_1_w)
AM_RANGE(0xe004, 0xe004) AM_WRITE(hanaroku_out_2_w)
@@ -233,10 +232,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_3_r,
- input_port_4_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/harddriv.c b/src/mame/drivers/harddriv.c
index a56b1e9f814..4ce54162891 100644
--- a/src/mame/drivers/harddriv.c
+++ b/src/mame/drivers/harddriv.c
@@ -551,7 +551,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( driversnd_dsp_io_map, ADDRESS_SPACE_IO, 16 )
- AM_RANGE(0, 0) AM_READWRITE(hdsnddsp_rom_r, hdsnddsp_dac_w)
+ AM_RANGE(0, 0) AM_READ(hdsnddsp_rom_r) AM_DEVWRITE(SOUND, "dac", hdsnddsp_dac_w)
AM_RANGE(1, 1) AM_READ(hdsnddsp_comram_r)
AM_RANGE(2, 2) AM_READ(hdsnddsp_compare_r)
AM_RANGE(1, 2) AM_WRITENOP
diff --git a/src/mame/drivers/hcastle.c b/src/mame/drivers/hcastle.c
index 2752f4501b4..a46a2147781 100644
--- a/src/mame/drivers/hcastle.c
+++ b/src/mame/drivers/hcastle.c
@@ -86,32 +86,31 @@ ADDRESS_MAP_END
/*****************************************************************************/
-static WRITE8_HANDLER( sound_bank_w )
+static WRITE8_DEVICE_HANDLER( sound_bank_w )
{
int bank_A=(data&0x3);
int bank_B=((data>>2)&0x3);
- k007232_set_bank( 0, bank_A, bank_B );
+ k007232_set_bank(device, bank_A, bank_B );
}
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM)
- AM_RANGE(0xa000, 0xa000) AM_READ(ym3812_status_port_0_r)
- AM_RANGE(0xb000, 0xb00d) AM_READ(k007232_read_port_0_r)
+ AM_RANGE(0xa000, 0xa001) AM_DEVREAD(SOUND, "ym", ym3812_r)
+ AM_RANGE(0xb000, 0xb00d) AM_DEVREAD(SOUND, "konami1", k007232_r)
AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x9800, 0x987f) AM_WRITE(k051649_waveform_w)
- AM_RANGE(0x9880, 0x9889) AM_WRITE(k051649_frequency_w)
- AM_RANGE(0x988a, 0x988e) AM_WRITE(k051649_volume_w)
- AM_RANGE(0x988f, 0x988f) AM_WRITE(k051649_keyonoff_w)
- AM_RANGE(0xa000, 0xa000) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0xa001, 0xa001) AM_WRITE(ym3812_write_port_0_w)
- AM_RANGE(0xb000, 0xb00d) AM_WRITE(k007232_write_port_0_w)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(sound_bank_w) /* 7232 bankswitch */
+ AM_RANGE(0x9800, 0x987f) AM_DEVWRITE(SOUND, "konami2", k051649_waveform_w)
+ AM_RANGE(0x9880, 0x9889) AM_DEVWRITE(SOUND, "konami2", k051649_frequency_w)
+ AM_RANGE(0x988a, 0x988e) AM_DEVWRITE(SOUND, "konami2", k051649_volume_w)
+ AM_RANGE(0x988f, 0x988f) AM_DEVWRITE(SOUND, "konami2", k051649_keyonoff_w)
+ AM_RANGE(0xa000, 0xa001) AM_DEVWRITE(SOUND, "ym", ym3812_w)
+ AM_RANGE(0xb000, 0xb00d) AM_DEVWRITE(SOUND, "konami1", k007232_w)
+ AM_RANGE(0xc000, 0xc000) AM_DEVWRITE(SOUND, "konami1", sound_bank_w) /* 7232 bankswitch */
ADDRESS_MAP_END
/*****************************************************************************/
@@ -241,15 +240,15 @@ GFXDECODE_END
/*****************************************************************************/
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
-// cpu_set_input_line(machine->cpu[1],0,linestate);
+// cpu_set_input_line(device->machine->cpu[1],0,linestate);
}
-static void volume_callback(int v)
+static void volume_callback(const device_config *device, int v)
{
- k007232_set_volume(0,0,(v >> 4) * 0x11,0);
- k007232_set_volume(0,1,0,(v & 0x0f) * 0x11);
+ k007232_set_volume(device,0,(v >> 4) * 0x11,0);
+ k007232_set_volume(device,1,0,(v & 0x0f) * 0x11);
}
static const k007232_interface k007232_config =
diff --git a/src/mame/drivers/hexa.c b/src/mame/drivers/hexa.c
index 55b0fdd1fe7..fa2d760e874 100644
--- a/src/mame/drivers/hexa.c
+++ b/src/mame/drivers/hexa.c
@@ -63,15 +63,14 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1)
AM_RANGE(0xc000, 0xc7ff) AM_READ(SMH_RAM)
- AM_RANGE(0xd001, 0xd001) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0xd001, 0xd001) AM_DEVREAD(SOUND, "ay", ay8910_r)
AM_RANGE(0xe000, 0xe7ff) AM_READ(SMH_RAM)
ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xc7ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xd000, 0xd000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xd001, 0xd001) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0xd000, 0xd001) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
AM_RANGE(0xd008, 0xd008) AM_WRITE(hexa_d008_w)
AM_RANGE(0xd010, 0xd010) AM_WRITE(watchdog_reset_w) /* or IRQ acknowledge, or both */
AM_RANGE(0xe000, 0xe7ff) AM_WRITE(hexa_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size)
@@ -140,10 +139,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r,
- input_port_1_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("INPUTS"),
+ DEVCB_INPUT_PORT("DSW"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/hexion.c b/src/mame/drivers/hexion.c
index 6d4bc8f6e35..53a749b8198 100644
--- a/src/mame/drivers/hexion.c
+++ b/src/mame/drivers/hexion.c
@@ -132,12 +132,12 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xa000, 0xbfff) AM_WRITE(SMH_RAM)
AM_RANGE(0xc000, 0xdffe) AM_WRITE(hexion_bankedram_w)
AM_RANGE(0xdfff, 0xdfff) AM_WRITE(hexion_bankctrl_w)
- AM_RANGE(0xe800, 0xe87f) AM_WRITE(k051649_waveform_w)
- AM_RANGE(0xe880, 0xe889) AM_WRITE(k051649_frequency_w)
- AM_RANGE(0xe88a, 0xe88e) AM_WRITE(k051649_volume_w)
- AM_RANGE(0xe88f, 0xe88f) AM_WRITE(k051649_keyonoff_w)
+ AM_RANGE(0xe800, 0xe87f) AM_DEVWRITE(SOUND, "konami", k051649_waveform_w)
+ AM_RANGE(0xe880, 0xe889) AM_DEVWRITE(SOUND, "konami", k051649_frequency_w)
+ AM_RANGE(0xe88a, 0xe88e) AM_DEVWRITE(SOUND, "konami", k051649_volume_w)
+ AM_RANGE(0xe88f, 0xe88f) AM_DEVWRITE(SOUND, "konami", k051649_keyonoff_w)
AM_RANGE(0xf000, 0xf00f) AM_WRITE(SMH_NOP) /* 053252? f00e = IRQ ack, f00f = NMI ack */
- AM_RANGE(0xf200, 0xf200) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0xf200, 0xf200) AM_DEVWRITE(SOUND, "oki", okim6295_w)
AM_RANGE(0xf480, 0xf480) AM_WRITE(hexion_bankswitch_w)
AM_RANGE(0xf4c0, 0xf4c0) AM_WRITE(coincntr_w)
AM_RANGE(0xf500, 0xf500) AM_WRITE(hexion_gfxrom_select_w)
diff --git a/src/mame/drivers/higemaru.c b/src/mame/drivers/higemaru.c
index d60879a3ebd..b3a58c0302e 100644
--- a/src/mame/drivers/higemaru.c
+++ b/src/mame/drivers/higemaru.c
@@ -48,10 +48,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc800, 0xc800) AM_WRITE(higemaru_c800_w)
- AM_RANGE(0xc801, 0xc801) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xc802, 0xc802) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xc803, 0xc803) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0xc804, 0xc804) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0xc801, 0xc802) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0xc803, 0xc804) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
AM_RANGE(0xd000, 0xd3ff) AM_WRITE(higemaru_videoram_w) AM_BASE(&videoram)
AM_RANGE(0xd400, 0xd7ff) AM_WRITE(higemaru_colorram_w) AM_BASE(&colorram)
AM_RANGE(0xd880, 0xd9ff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
diff --git a/src/mame/drivers/highvdeo.c b/src/mame/drivers/highvdeo.c
index ad50970e45c..bb90d0c5c92 100644
--- a/src/mame/drivers/highvdeo.c
+++ b/src/mame/drivers/highvdeo.c
@@ -186,13 +186,13 @@ static WRITE16_HANDLER( tv_vcf_bankselect_w )
}
-static WRITE16_HANDLER( tv_oki6395_w )
+static WRITE16_DEVICE_HANDLER( tv_oki6395_w )
{
static int okidata;
- if (okidata != data) {
+ if (ACCESSING_BITS_0_7 && okidata != data) {
okidata = data;
- okim6376_data_0_lsb_w(space, 0, data, mem_mask);
- okim6376_data_0_lsb_w(space, 0, (1 << 4), mem_mask);
+ okim6376_w(device, 0, data);
+ okim6376_w(device, 0, (1 << 4));
}
}
@@ -206,12 +206,12 @@ static ADDRESS_MAP_START( tv_vcf_map, ADDRESS_SPACE_PROGRAM, 16 )
ADDRESS_MAP_END
static ADDRESS_MAP_START( tv_vcf_io, ADDRESS_SPACE_IO, 16 )
- AM_RANGE(0x0006, 0x0007) AM_WRITE( tv_oki6395_w )
+ AM_RANGE(0x0006, 0x0007) AM_DEVWRITE( SOUND, "oki", tv_oki6395_w )
AM_RANGE(0x0008, 0x0009) AM_READ( read1_r )
AM_RANGE(0x000a, 0x000b) AM_READ( read2_r )
AM_RANGE(0x000c, 0x000d) AM_READ( read3_r )
AM_RANGE(0x0010, 0x0015) AM_WRITE( tv_vcf_paletteram_w )
- AM_RANGE(0x0030, 0x0031) AM_WRITE( tv_vcf_bankselect_w ) AM_READ( okim6376_status_0_lsb_r )
+ AM_RANGE(0x0030, 0x0031) AM_WRITE( tv_vcf_bankselect_w ) AM_DEVREAD8( SOUND, "oki", okim6376_r, 0x00ff )
ADDRESS_MAP_END
@@ -226,13 +226,13 @@ static READ16_HANDLER( tv_ncf_read2_r )
return (input_port_read(space->machine, "IN1") & 0xbf) | resetpulse;
}
-static WRITE16_HANDLER( tv_ncf_oki6395_w )
+static WRITE16_DEVICE_HANDLER( tv_ncf_oki6395_w )
{
static int okidata;
- if (okidata != data) {
+ if (ACCESSING_BITS_0_7 && okidata != data) {
okidata = data;
- okim6376_data_0_lsb_w(space, 0, data | 0x80, mem_mask);
- okim6376_data_0_lsb_w(space, 0, (1 << 4), mem_mask);
+ okim6376_w(device, 0, data | 0x80);
+ okim6376_w(device, 0, (1 << 4));
}
}
static ADDRESS_MAP_START( tv_ncf_map, ADDRESS_SPACE_PROGRAM, 16 )
@@ -244,7 +244,7 @@ static ADDRESS_MAP_START( tv_ncf_map, ADDRESS_SPACE_PROGRAM, 16 )
ADDRESS_MAP_END
static ADDRESS_MAP_START( tv_ncf_io, ADDRESS_SPACE_IO, 16 )
- AM_RANGE(0x0008, 0x0009) AM_WRITE( tv_ncf_oki6395_w )
+ AM_RANGE(0x0008, 0x0009) AM_DEVWRITE( SOUND, "oki", tv_ncf_oki6395_w )
AM_RANGE(0x000c, 0x000d) AM_READ( read1_r )
AM_RANGE(0x0010, 0x0011) AM_READ( tv_ncf_read2_r )
AM_RANGE(0x0012, 0x0013) AM_READ( read3_r )
@@ -287,7 +287,7 @@ static ADDRESS_MAP_START( tv_tcf_map, ADDRESS_SPACE_PROGRAM, 16 )
ADDRESS_MAP_END
static ADDRESS_MAP_START( tv_tcf_io, ADDRESS_SPACE_IO, 16 )
- AM_RANGE(0x0006, 0x0007) AM_WRITE( tv_oki6395_w )
+ AM_RANGE(0x0006, 0x0007) AM_DEVWRITE( SOUND, "oki", tv_oki6395_w )
AM_RANGE(0x0008, 0x0009) AM_READ( read1_r )
AM_RANGE(0x000a, 0x000b) AM_READ( read2_r )
AM_RANGE(0x0030, 0x0031) AM_READ( read3_r ) AM_WRITE( tv_tcf_bankselect_w )
diff --git a/src/mame/drivers/himesiki.c b/src/mame/drivers/himesiki.c
index 71361d46aff..60a960052f0 100644
--- a/src/mame/drivers/himesiki.c
+++ b/src/mame/drivers/himesiki.c
@@ -146,8 +146,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( himesiki_iom1, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym2203_status_port_0_r,ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ym2203_read_port_0_r,ym2203_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym2203", ym2203_r, ym2203_w)
AM_RANGE(0x04, 0x04) AM_READ(soundlatch_r)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/hitme.c b/src/mame/drivers/hitme.c
index 30fa9d74e4b..20829bb1c13 100644
--- a/src/mame/drivers/hitme.c
+++ b/src/mame/drivers/hitme.c
@@ -180,7 +180,7 @@ static READ8_HANDLER( hitme_port_3_r )
*
*************************************/
-static WRITE8_HANDLER( output_port_0_w )
+static WRITE8_DEVICE_HANDLER( output_port_0_w )
{
/*
Note: We compute the timeout time on a write here. Unfortunately, the situation is
@@ -188,20 +188,20 @@ static WRITE8_HANDLER( output_port_0_w )
In fact, it is very important that our timing calculation timeout AFTER the sound
system's equivalent computation, or else we will hang notes.
*/
- UINT8 raw_game_speed = input_port_read(space->machine, "R3");
+ UINT8 raw_game_speed = input_port_read(device->machine, "R3");
double resistance = raw_game_speed * 25000 / 100;
attotime duration = attotime_make(0, ATTOSECONDS_PER_SECOND * 0.45 * 6.8e-6 * resistance * (data+1));
- timeout_time = attotime_add(timer_get_time(space->machine), duration);
+ timeout_time = attotime_add(timer_get_time(device->machine), duration);
- discrete_sound_w(space, HITME_DOWNCOUNT_VAL, data);
- discrete_sound_w(space, HITME_OUT0, 1);
+ discrete_sound_w(device, HITME_DOWNCOUNT_VAL, data);
+ discrete_sound_w(device, HITME_OUT0, 1);
}
-static WRITE8_HANDLER( output_port_1_w )
+static WRITE8_DEVICE_HANDLER( output_port_1_w )
{
- discrete_sound_w(space, HITME_ENABLE_VAL, data);
- discrete_sound_w(space, HITME_OUT1, 1);
+ discrete_sound_w(device, HITME_ENABLE_VAL, data);
+ discrete_sound_w(device, HITME_OUT1, 1);
}
@@ -230,8 +230,8 @@ static ADDRESS_MAP_START( hitme_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1700, 0x17ff) AM_READ(hitme_port_3_r)
AM_RANGE(0x1800, 0x18ff) AM_READ_PORT("IN4")
AM_RANGE(0x1900, 0x19ff) AM_READ_PORT("IN5")
- AM_RANGE(0x1d00, 0x1dff) AM_WRITE(output_port_0_w)
- AM_RANGE(0x1e00, 0x1fff) AM_WRITE(output_port_1_w)
+ AM_RANGE(0x1d00, 0x1dff) AM_DEVWRITE(SOUND, "discrete", output_port_0_w)
+ AM_RANGE(0x1e00, 0x1fff) AM_DEVWRITE(SOUND, "discrete", output_port_1_w)
ADDRESS_MAP_END
@@ -242,8 +242,8 @@ static ADDRESS_MAP_START( hitme_portmap, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x17, 0x17) AM_READ(hitme_port_3_r)
AM_RANGE(0x18, 0x18) AM_READ_PORT("IN4")
AM_RANGE(0x19, 0x19) AM_READ_PORT("IN5")
- AM_RANGE(0x1d, 0x1d) AM_WRITE(output_port_0_w)
- AM_RANGE(0x1e, 0x1f) AM_WRITE(output_port_1_w)
+ AM_RANGE(0x1d, 0x1d) AM_DEVWRITE(SOUND, "discrete", output_port_0_w)
+ AM_RANGE(0x1e, 0x1f) AM_DEVWRITE(SOUND, "discrete", output_port_1_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/hnayayoi.c b/src/mame/drivers/hnayayoi.c
index c2d224649bf..e3ca53046b1 100644
--- a/src/mame/drivers/hnayayoi.c
+++ b/src/mame/drivers/hnayayoi.c
@@ -75,30 +75,30 @@ static WRITE8_HANDLER( keyboard_w )
}
-static WRITE8_HANDLER( adpcm_data_w )
+static WRITE8_DEVICE_HANDLER( adpcm_data_w )
{
- msm5205_data_w(0,data);
+ msm5205_data_w(device,data);
}
-static WRITE8_HANDLER( adpcm_vclk_w )
+static WRITE8_DEVICE_HANDLER( adpcm_vclk_w )
{
- msm5205_vclk_w(0,data & 1);
+ msm5205_vclk_w(device,data & 1);
}
-static WRITE8_HANDLER( adpcm_reset_w )
+static WRITE8_DEVICE_HANDLER( adpcm_reset_w )
{
- msm5205_reset_w(0,data & 1);
+ msm5205_reset_w(device,data & 1);
}
-static WRITE8_HANDLER( adpcm_reset_inv_w )
+static WRITE8_DEVICE_HANDLER( adpcm_reset_inv_w )
{
- msm5205_reset_w(0,~data & 1);
+ msm5205_reset_w(device,~data & 1);
}
static MACHINE_RESET( hnayayoi )
{
/* start with the MSM5205 reset */
- msm5205_reset_w(0,1);
+ msm5205_reset_w(devtag_get_device(machine, SOUND, "msm"),1);
}
@@ -117,18 +117,16 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( hnayayoi_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0x02, 0x02) AM_READ(ym2203_status_port_0_r)
- AM_RANGE(0x03, 0x03) AM_READ(ym2203_read_port_0_r)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ym", ym2203_w)
+ AM_RANGE(0x02, 0x03) AM_DEVREAD(SOUND, "ym", ym2203_r)
AM_RANGE(0x04, 0x04) AM_READ_PORT("DSW3")
- AM_RANGE(0x06, 0x06) AM_WRITE(adpcm_data_w)
+ AM_RANGE(0x06, 0x06) AM_DEVWRITE(SOUND, "msm", adpcm_data_w)
// AM_RANGE(0x08, 0x08) AM_WRITE(SMH_NOP) // CRT Controller
// AM_RANGE(0x09, 0x09) AM_WRITE(SMH_NOP) // CRT Controller
AM_RANGE(0x0a, 0x0a) AM_WRITE(dynax_blitter_rev1_start_w)
AM_RANGE(0x0c, 0x0c) AM_WRITE(dynax_blitter_rev1_clear_w)
- AM_RANGE(0x23, 0x23) AM_WRITE(adpcm_vclk_w)
- AM_RANGE(0x24, 0x24) AM_WRITE(adpcm_reset_w)
+ AM_RANGE(0x23, 0x23) AM_DEVWRITE(SOUND, "msm", adpcm_vclk_w)
+ AM_RANGE(0x24, 0x24) AM_DEVWRITE(SOUND, "msm", adpcm_reset_w)
AM_RANGE(0x40, 0x40) AM_WRITE(keyboard_w)
AM_RANGE(0x41, 0x41) AM_READ(keyboard_0_r)
AM_RANGE(0x42, 0x42) AM_READ(keyboard_1_r)
@@ -141,8 +139,7 @@ static ADDRESS_MAP_START( hnfubuki_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x77ff) AM_READ(SMH_ROM)
AM_RANGE(0x7800, 0x7fff) AM_READ(SMH_RAM)
AM_RANGE(0x8000, 0xfeff) AM_READ(SMH_ROM)
- AM_RANGE(0xff02, 0xff02) AM_READ(ym2203_status_port_0_r)
- AM_RANGE(0xff03, 0xff03) AM_READ(ym2203_read_port_0_r)
+ AM_RANGE(0xff02, 0xff03) AM_DEVREAD(SOUND, "ym", ym2203_r)
AM_RANGE(0xff04, 0xff04) AM_READ_PORT("DSW3")
AM_RANGE(0xff41, 0xff41) AM_READ(keyboard_0_r)
AM_RANGE(0xff42, 0xff42) AM_READ(keyboard_1_r)
@@ -153,15 +150,14 @@ static ADDRESS_MAP_START( hnfubuki_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x77ff) AM_WRITE(SMH_ROM)
AM_RANGE(0x7800, 0x7fff) AM_WRITE(SMH_RAM) AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
AM_RANGE(0x8000, 0xfeff) AM_WRITE(SMH_ROM)
- AM_RANGE(0xff00, 0xff00) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xff01, 0xff01) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0xff06, 0xff06) AM_WRITE(adpcm_data_w)
+ AM_RANGE(0xff00, 0xff01) AM_DEVWRITE(SOUND, "ym", ym2203_w)
+ AM_RANGE(0xff06, 0xff06) AM_DEVWRITE(SOUND, "msm", adpcm_data_w)
// AM_RANGE(0xff08, 0xff08) AM_WRITE(SMH_NOP) // CRT Controller
// AM_RANGE(0xff09, 0xff09) AM_WRITE(SMH_NOP) // CRT Controller
AM_RANGE(0xff0a, 0xff0a) AM_WRITE(dynax_blitter_rev1_start_w)
AM_RANGE(0xff0c, 0xff0c) AM_WRITE(dynax_blitter_rev1_clear_w)
- AM_RANGE(0xff23, 0xff23) AM_WRITE(adpcm_vclk_w)
- AM_RANGE(0xff24, 0xff24) AM_WRITE(adpcm_reset_inv_w)
+ AM_RANGE(0xff23, 0xff23) AM_DEVWRITE(SOUND, "msm", adpcm_vclk_w)
+ AM_RANGE(0xff24, 0xff24) AM_DEVWRITE(SOUND, "msm", adpcm_reset_inv_w)
AM_RANGE(0xff40, 0xff40) AM_WRITE(keyboard_w)
AM_RANGE(0xff60, 0xff61) AM_WRITE(hnayayoi_palbank_w)
AM_RANGE(0xff62, 0xff67) AM_WRITE(dynax_blitter_rev1_param_w)
@@ -181,10 +177,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( untoucha_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x10, 0x10) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x11, 0x11) AM_READ(ym2203_status_port_0_r)
+ AM_RANGE(0x10, 0x10) AM_DEVWRITE(SOUND, "ym", ym2203_control_port_w)
+ AM_RANGE(0x11, 0x11) AM_DEVREAD(SOUND, "ym", ym2203_status_port_r)
// AM_RANGE(0x12, 0x12) AM_WRITE(SMH_NOP) // CRT Controller
- AM_RANGE(0x13, 0x13) AM_WRITE(adpcm_data_w)
+ AM_RANGE(0x13, 0x13) AM_DEVWRITE(SOUND, "msm", adpcm_data_w)
AM_RANGE(0x14, 0x14) AM_READ_PORT("COIN")
AM_RANGE(0x15, 0x15) AM_READ(keyboard_1_r)
AM_RANGE(0x16, 0x16) AM_READ(keyboard_0_r) // bit 7 = blitter busy flag
@@ -193,10 +189,10 @@ static ADDRESS_MAP_START( untoucha_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x1a, 0x1f) AM_WRITE(dynax_blitter_rev1_param_w)
AM_RANGE(0x20, 0x20) AM_WRITE(dynax_blitter_rev1_clear_w)
AM_RANGE(0x28, 0x28) AM_WRITE(dynax_blitter_rev1_start_w)
- AM_RANGE(0x31, 0x31) AM_WRITE(adpcm_vclk_w)
- AM_RANGE(0x32, 0x32) AM_WRITE(adpcm_reset_inv_w)
- AM_RANGE(0x50, 0x50) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0x51, 0x51) AM_READ(ym2203_read_port_0_r)
+ AM_RANGE(0x31, 0x31) AM_DEVWRITE(SOUND, "msm", adpcm_vclk_w)
+ AM_RANGE(0x32, 0x32) AM_DEVWRITE(SOUND, "msm", adpcm_reset_inv_w)
+ AM_RANGE(0x50, 0x50) AM_DEVWRITE(SOUND, "ym", ym2203_write_port_w)
+ AM_RANGE(0x51, 0x51) AM_DEVREAD(SOUND, "ym", ym2203_read_port_r)
// AM_RANGE(0x52, 0x52) AM_WRITE(SMH_NOP) // CRT Controller
ADDRESS_MAP_END
@@ -535,10 +531,10 @@ INPUT_PORTS_END
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
popmessage("irq");
-// cpu_set_input_line(machine->cpu[2],0,irq ? ASSERT_LINE : CLEAR_LINE);
+// cpu_set_input_line(device->machine->cpu[2],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
@@ -547,10 +543,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r,
- input_port_1_r,
- NULL,
- NULL,
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_NULL,
+ DEVCB_NULL,
},
irqhandler
};
diff --git a/src/mame/drivers/holeland.c b/src/mame/drivers/holeland.c
index b1ee26ff837..5a65ce18f2e 100644
--- a/src/mame/drivers/holeland.c
+++ b/src/mame/drivers/holeland.c
@@ -64,10 +64,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x01, 0x01) AM_READ(watchdog_reset_r) /* ? */
- AM_RANGE(0x04, 0x04) AM_READWRITE(ay8910_read_port_0_r, ay8910_control_port_0_w)
- AM_RANGE(0x05, 0x05) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x06, 0x06) AM_READWRITE(ay8910_read_port_1_r, ay8910_control_port_1_w)
- AM_RANGE(0x07, 0x07) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0x04, 0x04) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0x04, 0x05) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x06, 0x06) AM_DEVREAD(SOUND, "ay2", ay8910_r)
+ AM_RANGE(0x06, 0x07) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
ADDRESS_MAP_END
@@ -278,20 +278,20 @@ static const ay8910_interface ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r,
- input_port_1_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("IN0"),
+ DEVCB_INPUT_PORT("IN1"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_2_r,
- input_port_3_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/homedata.c b/src/mame/drivers/homedata.c
index a96ed8a1344..a26b089f87d 100644
--- a/src/mame/drivers/homedata.c
+++ b/src/mame/drivers/homedata.c
@@ -317,7 +317,7 @@ static WRITE8_HANDLER( mrokumei_sound_io_w )
switch (offset & 0xff)
{
case 0x40:
- dac_signed_data_w(0,data);
+ dac_signed_data_w(devtag_get_device(space->machine, SOUND, "dac"),data);
break;
default:
logerror("%04x: I/O write to port %04x\n",cpu_get_pc(space->cpu),offset);
@@ -373,18 +373,14 @@ static WRITE8_HANDLER( reikaids_upd7807_portc_w )
if (BIT(upd7807_portc,5) && !BIT(data,5)) /* write clock 1->0 */
{
- if (BIT(data,3))
- ym2203_write_port_0_w(space,0,upd7807_porta);
- else
- ym2203_control_port_0_w(space,0,upd7807_porta);
+ const device_config *device = devtag_get_device(space->machine, SOUND, "ym");
+ ym2203_w(device, BIT(data,3), upd7807_porta);
}
if (BIT(upd7807_portc,4) && !BIT(data,4)) /* read clock 1->0 */
{
- if (BIT(data,3))
- upd7807_porta = ym2203_read_port_0_r(space,0);
- else
- upd7807_porta = ym2203_status_port_0_r(space,0);
+ const device_config *device = devtag_get_device(space->machine, SOUND, "ym");
+ upd7807_porta = ym2203_r(device, BIT(data,3));
}
upd7807_portc = data;
@@ -532,7 +528,7 @@ static WRITE8_HANDLER( pteacher_upd7807_portc_w )
coin_counter_w(0,~data & 0x80);
if (BIT(upd7807_portc,5) && !BIT(data,5)) /* clock 1->0 */
- sn76496_0_w(space,0,upd7807_porta);
+ sn76496_w(devtag_get_device(space->machine, SOUND, "sn"),0,upd7807_porta);
upd7807_portc = data;
}
@@ -593,7 +589,7 @@ static ADDRESS_MAP_START( mrokumei_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0x8000) AM_WRITE(mrokumei_blitter_start_w) // in some games also ROM bank switch to access service ROM
AM_RANGE(0x8001, 0x8001) AM_WRITE(mrokumei_keyboard_select_w)
AM_RANGE(0x8002, 0x8002) AM_WRITE(mrokumei_sound_cmd_w)
- AM_RANGE(0x8003, 0x8003) AM_WRITE(sn76496_0_w)
+ AM_RANGE(0x8003, 0x8003) AM_DEVWRITE(SOUND, "sn", sn76496_w)
AM_RANGE(0x8006, 0x8006) AM_WRITE(homedata_blitter_param_w)
AM_RANGE(0x8007, 0x8007) AM_WRITE(mrokumei_blitter_bank_w)
AM_RANGE(0x8000, 0xffff) AM_WRITE(SMH_ROM)
@@ -655,7 +651,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( reikaids_upd7807_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(UPD7807_PORTA, UPD7807_PORTA) AM_READWRITE(reikaids_upd7807_porta_r, reikaids_upd7807_porta_w)
- AM_RANGE(UPD7807_PORTB, UPD7807_PORTB) AM_WRITE(dac_0_signed_data_w)
+ AM_RANGE(UPD7807_PORTB, UPD7807_PORTB) AM_DEVWRITE(SOUND, "dac", dac_signed_w)
AM_RANGE(UPD7807_PORTC, UPD7807_PORTC) AM_WRITE(reikaids_upd7807_portc_w)
AM_RANGE(UPD7807_PORTT, UPD7807_PORTT) AM_READ(reikaids_snd_command_r)
ADDRESS_MAP_END
@@ -703,7 +699,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( pteacher_upd7807_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(UPD7807_PORTA, UPD7807_PORTA) AM_READWRITE(pteacher_upd7807_porta_r, pteacher_upd7807_porta_w)
- AM_RANGE(UPD7807_PORTB, UPD7807_PORTB) AM_WRITE(dac_0_signed_data_w)
+ AM_RANGE(UPD7807_PORTB, UPD7807_PORTB) AM_DEVWRITE(SOUND, "dac", dac_signed_w)
AM_RANGE(UPD7807_PORTC, UPD7807_PORTC) AM_READ_PORT("COIN") AM_WRITE(pteacher_upd7807_portc_w)
AM_RANGE(UPD7807_PORTT, UPD7807_PORTT) AM_READ(pteacher_keyboard_r)
ADDRESS_MAP_END
@@ -1258,10 +1254,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_3_r,
- input_port_4_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_NULL,
+ DEVCB_NULL
},
NULL
};
diff --git a/src/mame/drivers/homerun.c b/src/mame/drivers/homerun.c
index 0ff38164272..a7481424653 100644
--- a/src/mame/drivers/homerun.c
+++ b/src/mame/drivers/homerun.c
@@ -27,7 +27,7 @@ extern UINT8 *homerun_videoram;
WRITE8_HANDLER( homerun_videoram_w );
WRITE8_HANDLER( homerun_color_w );
-WRITE8_HANDLER( homerun_banking_w );
+WRITE8_DEVICE_HANDLER( homerun_banking_w );
VIDEO_START(homerun);
VIDEO_UPDATE(homerun);
@@ -103,8 +103,7 @@ static ADDRESS_MAP_START( homerun_iomap, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x40, 0x40) AM_READ_PORT("IN0")
AM_RANGE(0x50, 0x50) AM_READ_PORT("IN2")
AM_RANGE(0x60, 0x60) AM_READ_PORT("IN1")
- AM_RANGE(0x70, 0x70) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x71, 0x71) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
+ AM_RANGE(0x70, 0x71) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
ADDRESS_MAP_END
static const ym2203_interface ym2203_config =
@@ -112,10 +111,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_3_r,
- NULL,
- NULL,
- homerun_banking_w
+ DEVCB_INPUT_PORT("DSW"),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(homerun_banking_w)
},
NULL
};
diff --git a/src/mame/drivers/hornet.c b/src/mame/drivers/hornet.c
index 48ba1f31e7c..4e992e2459e 100644
--- a/src/mame/drivers/hornet.c
+++ b/src/mame/drivers/hornet.c
@@ -796,7 +796,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_memmap, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_ROM
AM_RANGE(0x100000, 0x10ffff) AM_RAM /* Work RAM */
- AM_RANGE(0x200000, 0x200fff) AM_READWRITE(rf5c400_0_r, rf5c400_0_w) /* Ricoh RF5C400 */
+ AM_RANGE(0x200000, 0x200fff) AM_DEVREADWRITE(SOUND, "rf", rf5c400_r, rf5c400_w) /* Ricoh RF5C400 */
AM_RANGE(0x300000, 0x30000f) AM_READWRITE(K056800_sound_r, K056800_sound_w)
AM_RANGE(0x600000, 0x600001) AM_NOP
ADDRESS_MAP_END
diff --git a/src/mame/drivers/hotblock.c b/src/mame/drivers/hotblock.c
index 182e21034f4..574cf6d0d8f 100644
--- a/src/mame/drivers/hotblock.c
+++ b/src/mame/drivers/hotblock.c
@@ -109,8 +109,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( hotblock_io, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x0000, 0x0000) AM_WRITE(hotblock_port0_w)
AM_RANGE(0x0004, 0x0004) AM_READ(hotblock_port4_r) AM_WRITE(hotblock_port4_w)
- AM_RANGE(0x8000, 0x8000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x8001, 0x8001) AM_READ( ay8910_read_port_0_r ) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x8000, 0x8001) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0x8001, 0x8001) AM_DEVREAD(SOUND, "ay", ay8910_r)
ADDRESS_MAP_END
@@ -181,10 +181,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r,
- input_port_1_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("P1"),
+ DEVCB_INPUT_PORT("P2"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/hyhoo.c b/src/mame/drivers/hyhoo.c
index 24d7176f30c..1c4ab0a7bd0 100644
--- a/src/mame/drivers/hyhoo.c
+++ b/src/mame/drivers/hyhoo.c
@@ -30,9 +30,9 @@ Memo:
#define SIGNED_DAC 0 // 0:unsigned DAC, 1:signed DAC
#if SIGNED_DAC
-#define DAC_0_WRITE dac_0_signed_data_w
+#define DAC_WRITE dac_signed_w
#else
-#define DAC_0_WRITE dac_0_data_w
+#define DAC_WRITE dac_w
#endif
@@ -69,15 +69,14 @@ static ADDRESS_MAP_START( hyhoo_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
// AM_RANGE(0x00, 0x00) AM_WRITE(nb1413m3_nmi_clock_w)
AM_RANGE(0x00, 0x7f) AM_READ(nb1413m3_sndrom_r)
- AM_RANGE(0x81, 0x81) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x82, 0x82) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x83, 0x83) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x81, 0x81) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x82, 0x83) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
AM_RANGE(0x90, 0x90) AM_READ_PORT("SYSTEM")
AM_RANGE(0x90, 0x97) AM_WRITE(hyhoo_blitter_w)
AM_RANGE(0xa0, 0xa0) AM_READWRITE(nb1413m3_inputport1_r, nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_READWRITE(nb1413m3_inputport2_r, nb1413m3_sndrombank1_w)
AM_RANGE(0xc0, 0xcf) AM_WRITE(SMH_RAM) AM_BASE(&hyhoo_clut)
- AM_RANGE(0xd0, 0xd0) AM_READWRITE(SMH_NOP, DAC_0_WRITE) // unknown read
+ AM_RANGE(0xd0, 0xd0) AM_READNOP AM_DEVWRITE(SOUND, "dac", DAC_WRITE) // unknown read
AM_RANGE(0xe0, 0xe0) AM_WRITE(hyhoo_romsel_w)
AM_RANGE(0xe0, 0xe1) AM_READ(nb1413m3_gfxrom_r)
AM_RANGE(0xf0, 0xf0) AM_READ(nb1413m3_dipsw1_r)
@@ -251,10 +250,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r, // DIPSW-A read
- input_port_1_r, // DIPSW-B read
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSWA"),
+ DEVCB_INPUT_PORT("DSWB"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/hyperspt.c b/src/mame/drivers/hyperspt.c
index c3dce62779a..1dc7711a8bd 100644
--- a/src/mame/drivers/hyperspt.c
+++ b/src/mame/drivers/hyperspt.c
@@ -27,11 +27,11 @@ extern VIDEO_UPDATE( roadf );
extern WRITE8_HANDLER( konami_sh_irqtrigger_w );
extern READ8_HANDLER( hyperspt_sh_timer_r );
-extern WRITE8_HANDLER( hyperspt_sound_w );
+extern WRITE8_DEVICE_HANDLER( hyperspt_sound_w );
/* these routines lurk in audio/trackfld.c */
extern WRITE8_HANDLER( konami_SN76496_latch_w );
-extern WRITE8_HANDLER( konami_SN76496_0_w );
+extern WRITE8_DEVICE_HANDLER( konami_SN76496_w );
static WRITE8_HANDLER( hyperspt_coin_counter_w )
@@ -124,11 +124,11 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x4000, 0x4fff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xa000, 0xa000) AM_WRITE(vlm5030_data_w) /* speech data */
- AM_RANGE(0xc000, 0xdfff) AM_WRITE(hyperspt_sound_w) /* speech and output control */
- AM_RANGE(0xe000, 0xe000) AM_WRITE(dac_0_data_w)
+ AM_RANGE(0xa000, 0xa000) AM_DEVWRITE(SOUND, "vlm", vlm5030_data_w) /* speech data */
+ AM_RANGE(0xc000, 0xdfff) AM_DEVWRITE(SOUND, "vlm", hyperspt_sound_w) /* speech and output control */
+ AM_RANGE(0xe000, 0xe000) AM_DEVWRITE(SOUND, "dac", dac_w)
AM_RANGE(0xe001, 0xe001) AM_WRITE(konami_SN76496_latch_w) /* Loads the snd command into the snd latch */
- AM_RANGE(0xe002, 0xe002) AM_WRITE(konami_SN76496_0_w) /* This address triggers the SN chip to read the data port. */
+ AM_RANGE(0xe002, 0xe002) AM_DEVWRITE(SOUND, "sn", konami_SN76496_w) /* This address triggers the SN chip to read the data port. */
ADDRESS_MAP_END
diff --git a/src/mame/drivers/hyprduel.c b/src/mame/drivers/hyprduel.c
index cf384c12755..f4d3399ea0c 100644
--- a/src/mame/drivers/hyprduel.c
+++ b/src/mame/drivers/hyprduel.c
@@ -510,8 +510,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( hyprduel_readmem2, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x003fff) AM_READ(SMH_RAM )
AM_RANGE(0x004000, 0x007fff) AM_READ(SMH_RAM )
- AM_RANGE(0x400002, 0x400003) AM_READ(ym2151_status_port_0_lsb_r )
- AM_RANGE(0x400004, 0x400005) AM_READ(okim6295_status_0_lsb_r )
+ AM_RANGE(0x400000, 0x400003) AM_DEVREAD8(SOUND, "ym", ym2151_r, 0x00ff )
+ AM_RANGE(0x400004, 0x400005) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff )
AM_RANGE(0xc00000, 0xc07fff) AM_READ(SMH_RAM )
AM_RANGE(0xfe0000, 0xffffff) AM_READ(SMH_RAM )
ADDRESS_MAP_END
@@ -519,9 +519,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( hyprduel_writemem2, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x003fff) AM_WRITE(SMH_RAM) AM_BASE(&hypr_sub_sharedram1_2 ) // shadow ($c00000 - $c03fff : vector, write ok)
AM_RANGE(0x004000, 0x007fff) AM_WRITE(SMH_RAM) AM_BASE(&hypr_sub_sharedram2_2 ) // shadow ($fe4000 - $fe7fff : read only)
- AM_RANGE(0x400000, 0x400001) AM_WRITE(ym2151_register_port_0_lsb_w )
- AM_RANGE(0x400002, 0x400003) AM_WRITE(ym2151_data_port_0_lsb_w )
- AM_RANGE(0x400004, 0x400005) AM_WRITE(okim6295_data_0_lsb_w )
+ AM_RANGE(0x400000, 0x400003) AM_DEVWRITE8(SOUND, "ym", ym2151_w, 0x00ff )
+ AM_RANGE(0x400004, 0x400005) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff)
AM_RANGE(0x800000, 0x800001) AM_WRITE(SMH_NOP )
AM_RANGE(0xc00000, 0xc07fff) AM_WRITE(SMH_RAM) AM_BASE(&hypr_sub_sharedram1_1 ) // (sound driver)
AM_RANGE(0xfe0000, 0xffffff) AM_WRITE(SMH_RAM) AM_BASE(&hypr_sub_sharedram2_1 )
@@ -578,8 +577,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( magerror_readmem2, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x003fff) AM_READ(SMH_RAM )
AM_RANGE(0x004000, 0x007fff) AM_READ(SMH_RAM )
-// AM_RANGE(0x400002, 0x400003) AM_READ(ym2151_status_port_0_lsb_r )
- AM_RANGE(0x400004, 0x400005) AM_READ(okim6295_status_0_lsb_r )
+// AM_RANGE(0x400000, 0x400003) AM_DEVREAD8(SOUND, "ym", ym2151_r, 0x00ff )
+ AM_RANGE(0x400004, 0x400005) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff)
AM_RANGE(0xc00000, 0xc07fff) AM_READ(SMH_RAM )
AM_RANGE(0xfe0000, 0xffffff) AM_READ(SMH_RAM )
ADDRESS_MAP_END
@@ -587,9 +586,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( magerror_writemem2, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x003fff) AM_WRITE(SMH_RAM) AM_BASE(&hypr_sub_sharedram1_2 ) // shadow ($c00000 - $c03fff : vector, write ok)
AM_RANGE(0x004000, 0x007fff) AM_WRITE(SMH_RAM) AM_BASE(&hypr_sub_sharedram2_2 ) // shadow ($fe4000 - $fe7fff : read only)
- AM_RANGE(0x400000, 0x400001) AM_WRITE(ym2413_register_port_0_lsb_w )
- AM_RANGE(0x400002, 0x400003) AM_WRITE(ym2413_data_port_0_lsb_w )
- AM_RANGE(0x400004, 0x400005) AM_WRITE(okim6295_data_0_lsb_w )
+ AM_RANGE(0x400000, 0x400003) AM_DEVWRITE8(SOUND, "ym", ym2413_w, 0x00ff)
+ AM_RANGE(0x400004, 0x400005) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff)
AM_RANGE(0x800000, 0x800001) AM_WRITE(SMH_NOP )
AM_RANGE(0xc00000, 0xc07fff) AM_WRITE(SMH_RAM) AM_BASE(&hypr_sub_sharedram1_1 ) // (sound driver)
AM_RANGE(0xfe0000, 0xffffff) AM_WRITE(SMH_RAM) AM_BASE(&hypr_sub_sharedram2_1 )
@@ -703,9 +701,9 @@ GFXDECODE_END
Sound Communication
***************************************************************************/
-static void sound_irq(running_machine *machine, int state)
+static void sound_irq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1], 1, HOLD_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 1, HOLD_LINE);
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/igs009.c b/src/mame/drivers/igs009.c
index 5b479f4ee7a..2bd25a0dc18 100644
--- a/src/mame/drivers/igs009.c
+++ b/src/mame/drivers/igs009.c
@@ -438,10 +438,9 @@ static ADDRESS_MAP_START( jingbell_portmap, ADDRESS_SPACE_IO, 8 )
AM_RANGE( 0x6492, 0x6492 ) AM_WRITE( jingbell_leds_w )
AM_RANGE( 0x64a0, 0x64a0 ) AM_READ_PORT( "BUTTONS2" )
- AM_RANGE( 0x64b0, 0x64b0 ) AM_WRITE( ym2413_register_port_0_w )
- AM_RANGE( 0x64b1, 0x64b1 ) AM_WRITE( ym2413_data_port_0_w )
+ AM_RANGE( 0x64b0, 0x64b1 ) AM_DEVWRITE( SOUND, "ym", ym2413_w )
- AM_RANGE( 0x64c0, 0x64c0 ) AM_READWRITE( okim6295_status_0_r, okim6295_data_0_w )
+ AM_RANGE( 0x64c0, 0x64c0 ) AM_DEVREADWRITE( SOUND, "oki", okim6295_r, okim6295_w )
AM_RANGE( 0x64d0, 0x64d1 ) AM_READWRITE( jingbell_magic_r, jingbell_magic_w ) // DSW1-5
diff --git a/src/mame/drivers/igs017.c b/src/mame/drivers/igs017.c
index fd792501d05..ff5b1a34b6e 100644
--- a/src/mame/drivers/igs017.c
+++ b/src/mame/drivers/igs017.c
@@ -641,12 +641,11 @@ static ADDRESS_MAP_START( iqblocka_io, ADDRESS_SPACE_IO, 8 )
AM_RANGE( 0x8000, 0x8000 ) AM_WRITE( input_select_w )
AM_RANGE( 0x8001, 0x8001 ) AM_READ ( input_r )
- AM_RANGE( 0x9000, 0x9000 ) AM_READWRITE( okim6295_status_0_r, okim6295_data_0_w )
+ AM_RANGE( 0x9000, 0x9000 ) AM_DEVREADWRITE( SOUND, "oki", okim6295_r, okim6295_w )
AM_RANGE( 0xa000, 0xa000 ) AM_READ_PORT( "BUTTONS" )
- AM_RANGE( 0xb000, 0xb000 ) AM_WRITE( ym2413_register_port_0_w )
- AM_RANGE( 0xb001, 0xb001 ) AM_WRITE( ym2413_data_port_0_w )
+ AM_RANGE( 0xb000, 0xb001 ) AM_DEVWRITE( SOUND, "ym", ym2413_w )
ADDRESS_MAP_END
@@ -769,7 +768,7 @@ static ADDRESS_MAP_START( mgcs, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE( 0xa0c000, 0xa0ffff ) AM_READWRITE( bg_lsb_r, bg_lsb_w ) AM_BASE( (UINT16**)&bg_videoram )
// oki banking?
- AM_RANGE( 0xa12000, 0xa12001 ) AM_READWRITE( okim6295_status_0_lsb_r, okim6295_data_0_lsb_w )
+ AM_RANGE( 0xa12000, 0xa12001 ) AM_DEVREADWRITE8( SOUND, "oki", okim6295_r, okim6295_w, 0x00ff )
ADDRESS_MAP_END
diff --git a/src/mame/drivers/igs_blit.c b/src/mame/drivers/igs_blit.c
index 7e1a2815262..7213279d549 100644
--- a/src/mame/drivers/igs_blit.c
+++ b/src/mame/drivers/igs_blit.c
@@ -689,7 +689,7 @@ static WRITE16_HANDLER( chmplst2_magic_w )
{
chmplst2_pen_hi = data & 0x07;
- okim6295_set_bank_base(0, (data & 0x08) ? 0x40000 : 0);
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki"), (data & 0x08) ? 0x40000 : 0);
}
if ( chmplst2_pen_hi & ~0xf )
@@ -830,7 +830,7 @@ static WRITE16_HANDLER( grtwall_magic_w )
{
coin_counter_w(0,data & 0x01);
- okim6295_set_bank_base(0, (data & 0x10) ? 0x40000 : 0);
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki"), (data & 0x10) ? 0x40000 : 0);
}
if (data & ~0x11)
@@ -881,15 +881,15 @@ static READ16_HANDLER( grtwall_magic_r )
-static WRITE16_HANDLER( lhb_okibank_w )
+static WRITE16_DEVICE_HANDLER( lhb_okibank_w )
{
if (ACCESSING_BITS_8_15)
{
- okim6295_set_bank_base(0, (data & 0x200) ? 0x40000 : 0);
+ okim6295_set_bank_base(device, (data & 0x200) ? 0x40000 : 0);
}
if ( data & (~0x200) )
- logerror("%06x: warning, unknown bits written in oki bank = %02x\n", cpu_get_pc(space->cpu), data);
+ logerror("%s: warning, unknown bits written in oki bank = %02x\n", cpuexec_describe_context(device->machine), data);
// popmessage("oki %04x",data);
}
@@ -1078,27 +1078,14 @@ static READ16_HANDLER( xymg_magic_r )
***************************************************************************/
-static WRITE16_HANDLER( igs_YM3812_control_port_0_w )
-{
- if (ACCESSING_BITS_0_7)
- ym3812_control_port_0_w(space,0,data);
-}
-
-static WRITE16_HANDLER( igs_YM3812_write_port_0_w )
-{
- if (ACCESSING_BITS_0_7)
- ym3812_write_port_0_w(space,0,data);
-}
-
static ADDRESS_MAP_START( chindrag, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE( 0x000000, 0x07ffff ) AM_ROM
AM_RANGE( 0x100000, 0x103fff ) AM_RAM AM_BASE( &generic_nvram16 ) AM_SIZE( &generic_nvram_size )
AM_RANGE( 0x200000, 0x200fff ) AM_RAM AM_BASE( &igs_priority_ram )
AM_RANGE( 0x400000, 0x401fff ) AM_RAM_WRITE( igs_palette_w ) AM_BASE( &paletteram16 )
AM_RANGE( 0x500000, 0x500001 ) AM_READ_PORT( "COIN" )
- AM_RANGE( 0x600000, 0x600001 ) AM_READWRITE( okim6295_status_0_lsb_r, okim6295_data_0_lsb_w )
- AM_RANGE( 0x700000, 0x700001 ) AM_WRITE( igs_YM3812_control_port_0_w )
- AM_RANGE( 0x700002, 0x700003 ) AM_WRITE( igs_YM3812_write_port_0_w )
+ AM_RANGE( 0x600000, 0x600001 ) AM_DEVREADWRITE8( SOUND, "oki", okim6295_r, okim6295_w, 0x00ff )
+ AM_RANGE( 0x700000, 0x700003 ) AM_DEVWRITE8( SOUND, "ym", ym3812_w, 0x00ff )
AM_RANGE( 0x800000, 0x800003 ) AM_WRITE( chindrag_magic_w )
AM_RANGE( 0x800002, 0x800003 ) AM_READ ( chindrag_magic_r )
AM_RANGE( 0xa20000, 0xa20001 ) AM_WRITE( igs_priority_w )
@@ -1119,9 +1106,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( chmplst2, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE( 0x000000, 0x07ffff ) AM_ROM
AM_RANGE( 0x100000, 0x103fff ) AM_RAM AM_BASE( &generic_nvram16 ) AM_SIZE( &generic_nvram_size )
- AM_RANGE( 0x200000, 0x200001 ) AM_READWRITE( okim6295_status_0_lsb_r, okim6295_data_0_lsb_w )
- AM_RANGE( 0x204000, 0x204001 ) AM_WRITE( ym2413_register_port_0_lsb_w )
- AM_RANGE( 0x204002, 0x204003 ) AM_WRITE( ym2413_data_port_0_lsb_w )
+ AM_RANGE( 0x200000, 0x200001 ) AM_DEVREADWRITE8( SOUND, "oki", okim6295_r, okim6295_w, 0x00ff )
+ AM_RANGE( 0x204000, 0x204003 ) AM_DEVWRITE8( SOUND, "ym", ym2413_w, 0x00ff )
AM_RANGE( 0x208000, 0x208003 ) AM_WRITE( chmplst2_magic_w )
AM_RANGE( 0x208002, 0x208003 ) AM_READ ( chmplst2_magic_r )
AM_RANGE( 0x20c000, 0x20cfff ) AM_RAM AM_BASE(&igs_priority_ram)
@@ -1150,7 +1136,7 @@ static ADDRESS_MAP_START( grtwall, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE( 0x300000, 0x3fffff ) AM_READWRITE( igs_layers_r, igs_layers_w )
AM_RANGE( 0x400000, 0x401fff ) AM_RAM_WRITE( igs_palette_w ) AM_BASE( &paletteram16 )
AM_RANGE( 0x520000, 0x520001 ) AM_READ_PORT( "COIN" )
- AM_RANGE( 0x600000, 0x600001 ) AM_READWRITE( okim6295_status_0_lsb_r, okim6295_data_0_lsb_w )
+ AM_RANGE( 0x600000, 0x600001 ) AM_DEVREADWRITE8( SOUND, "oki", okim6295_r, okim6295_w, 0x00ff )
AM_RANGE( 0x800000, 0x800003 ) AM_WRITE( grtwall_magic_w )
AM_RANGE( 0x800002, 0x800003 ) AM_READ ( grtwall_magic_r )
AM_RANGE( 0xa20000, 0xa20001 ) AM_WRITE( igs_priority_w )
@@ -1176,13 +1162,13 @@ static WRITE16_HANDLER( lhb_irq_enable_w )
}
static ADDRESS_MAP_START( lhb, ADDRESS_SPACE_PROGRAM, 16 )
- AM_RANGE( 0x010000, 0x010001 ) AM_WRITE( lhb_okibank_w )
+ AM_RANGE( 0x010000, 0x010001 ) AM_DEVWRITE( SOUND, "oki", lhb_okibank_w )
AM_RANGE( 0x000000, 0x07ffff ) AM_ROM
AM_RANGE( 0x100000, 0x103fff ) AM_RAM AM_BASE( &generic_nvram16 ) AM_SIZE( &generic_nvram_size )
AM_RANGE( 0x200000, 0x200fff ) AM_RAM AM_BASE( &igs_priority_ram )
AM_RANGE( 0x300000, 0x3fffff ) AM_READWRITE( igs_layers_r, igs_layers_w )
AM_RANGE( 0x400000, 0x401fff ) AM_RAM_WRITE( igs_palette_w ) AM_BASE( &paletteram16 )
- AM_RANGE( 0x600000, 0x600001 ) AM_READWRITE( okim6295_status_0_lsb_r, okim6295_data_0_lsb_w )
+ AM_RANGE( 0x600000, 0x600001 ) AM_DEVREADWRITE8( SOUND, "oki", okim6295_r, okim6295_w, 0x00ff )
AM_RANGE( 0x700000, 0x700001 ) AM_READ_PORT( "COIN" )
AM_RANGE( 0x700002, 0x700005 ) AM_READ ( lhb_inputs_r )
AM_RANGE( 0x700002, 0x700003 ) AM_WRITE( lhb_inputs_w )
@@ -1204,27 +1190,27 @@ ADDRESS_MAP_END
-static READ16_HANDLER( ics2115_0_word_r )
+static READ16_DEVICE_HANDLER( ics2115_word_r )
{
switch(offset)
{
- case 0: return ics2115_r(space,0);
- case 1: return ics2115_r(space,1);
- case 2: return (ics2115_r(space,3) << 8) | ics2115_r(space,2);
+ case 0: return ics2115_r(device,0);
+ case 1: return ics2115_r(device,1);
+ case 2: return (ics2115_r(device,3) << 8) | ics2115_r(device,2);
}
return 0xff;
}
-static WRITE16_HANDLER( ics2115_0_word_w )
+static WRITE16_DEVICE_HANDLER( ics2115_word_w )
{
switch(offset)
{
case 1:
- if (ACCESSING_BITS_0_7) ics2115_w(space,1,data);
+ if (ACCESSING_BITS_0_7) ics2115_w(device,1,data);
break;
case 2:
- if (ACCESSING_BITS_0_7) ics2115_w(space,2,data);
- if (ACCESSING_BITS_8_15) ics2115_w(space,3,data>>8);
+ if (ACCESSING_BITS_0_7) ics2115_w(device,2,data);
+ if (ACCESSING_BITS_8_15) ics2115_w(device,3,data>>8);
break;
}
}
@@ -1264,7 +1250,7 @@ static ADDRESS_MAP_START( vbowl, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE( 0x300000, 0x3fffff ) AM_READWRITE( igs_layers_r, igs_layers_w )
AM_RANGE( 0x400000, 0x401fff ) AM_RAM_WRITE( igs_palette_w ) AM_BASE( &paletteram16 )
AM_RANGE( 0x520000, 0x520001 ) AM_READ_PORT( "COIN" )
- AM_RANGE( 0x600000, 0x600007 ) AM_READWRITE( ics2115_0_word_r, ics2115_0_word_w )
+ AM_RANGE( 0x600000, 0x600007 ) AM_DEVREADWRITE( SOUND, "ics", ics2115_word_r, ics2115_word_w )
AM_RANGE( 0x700000, 0x700003 ) AM_RAM AM_BASE( &vbowl_trackball )
AM_RANGE( 0x700004, 0x700005 ) AM_WRITE( vbowl_pen_hi_w )
AM_RANGE( 0x800000, 0x800003 ) AM_WRITE( vbowl_magic_w )
@@ -1296,13 +1282,13 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( xymg, ADDRESS_SPACE_PROGRAM, 16 )
- AM_RANGE( 0x010000, 0x010001 ) AM_WRITE( lhb_okibank_w )
+ AM_RANGE( 0x010000, 0x010001 ) AM_DEVWRITE( SOUND, "oki", lhb_okibank_w )
AM_RANGE( 0x000000, 0x07ffff ) AM_ROM
AM_RANGE( 0x100000, 0x103fff ) AM_RAM
AM_RANGE( 0x200000, 0x200fff ) AM_RAM AM_BASE( &igs_priority_ram )
AM_RANGE( 0x300000, 0x3fffff ) AM_READWRITE( igs_layers_r, igs_layers_w )
AM_RANGE( 0x400000, 0x401fff ) AM_RAM_WRITE( igs_palette_w ) AM_BASE( &paletteram16 )
- AM_RANGE( 0x600000, 0x600001 ) AM_READWRITE( okim6295_status_0_lsb_r, okim6295_data_0_lsb_w )
+ AM_RANGE( 0x600000, 0x600001 ) AM_DEVREADWRITE8( SOUND, "oki", okim6295_r, okim6295_w, 0x00ff )
AM_RANGE( 0x700000, 0x700003 ) AM_WRITE( xymg_magic_w )
AM_RANGE( 0x700002, 0x700003 ) AM_READ ( xymg_magic_r )
AM_RANGE( 0x820000, 0x820001 ) AM_WRITE( igs_priority_w )
@@ -2507,7 +2493,7 @@ MACHINE_DRIVER_END
-static void sound_irq(running_machine *machine, int state)
+static void sound_irq(const device_config *device, int state)
{
// cpu_set_input_line(machine->cpu[0], 3, state);
}
diff --git a/src/mame/drivers/igspoker.c b/src/mame/drivers/igspoker.c
index cf585911ea4..888d1a88e00 100644
--- a/src/mame/drivers/igspoker.c
+++ b/src/mame/drivers/igspoker.c
@@ -308,8 +308,7 @@ static ADDRESS_MAP_START( igspoker_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x5090, 0x5090) AM_WRITE(custom_io_w)
AM_RANGE(0x5091, 0x5091) AM_READ(custom_io_r) AM_WRITE( igs_lamps_w ) /* Keyboard */
AM_RANGE(0x50a0, 0x50a0) AM_READ_PORT("BUTTONS2") /* Not connected */
- AM_RANGE(0x50b0, 0x50b0) AM_WRITE(ym2413_register_port_0_w)
- AM_RANGE(0x50b1, 0x50b1) AM_WRITE(ym2413_data_port_0_w)
+ AM_RANGE(0x50b0, 0x50b1) AM_DEVWRITE(SOUND, "ym", ym2413_w)
AM_RANGE(0x50c0, 0x50c0) AM_READ(igs_irqack_r) AM_WRITE(igs_irqack_w)
AM_RANGE(0x6800, 0x6fff) AM_RAM_WRITE( bg_tile_w ) AM_BASE( &bg_tile_ram )
AM_RANGE(0x7000, 0x77ff) AM_RAM_WRITE( fg_tile_w ) AM_BASE( &fg_tile_ram )
@@ -927,7 +926,7 @@ static ADDRESS_MAP_START( number10_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x5091, 0x5091) AM_READ(custom_io_r) AM_WRITE( igs_lamps_w ) /* Keyboard */
AM_RANGE(0x50a0, 0x50a0) AM_READ_PORT("BUTTONS2")
/* Sound synthesys has been patched out, replaced by ADPCM samples */
- AM_RANGE(0x50b0, 0x50b0) AM_READWRITE( okim6295_status_0_r, okim6295_data_0_w )
+ AM_RANGE(0x50b0, 0x50b0) AM_DEVREADWRITE( SOUND, "oki", okim6295_r, okim6295_w )
AM_RANGE(0x50c0, 0x50c0) AM_READ(igs_irqack_r) AM_WRITE(igs_irqack_w)
AM_RANGE(0x7000, 0x77ff) AM_RAM_WRITE( fg_tile_w ) AM_BASE( &fg_tile_ram )
AM_RANGE(0x7800, 0x7fff) AM_RAM_WRITE( fg_color_w ) AM_BASE( &fg_color_ram )
diff --git a/src/mame/drivers/ikki.c b/src/mame/drivers/ikki.c
index d731093d782..aa3bb802725 100644
--- a/src/mame/drivers/ikki.c
+++ b/src/mame/drivers/ikki.c
@@ -62,8 +62,8 @@ static ADDRESS_MAP_START( ikki_cpu2, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_ROM
AM_RANGE(0xc000, 0xc7ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0xc800, 0xcfff) AM_RAM AM_SHARE(1)
- AM_RANGE(0xd801, 0xd801) AM_WRITE(sn76496_0_w)
- AM_RANGE(0xd802, 0xd802) AM_WRITE(sn76496_1_w)
+ AM_RANGE(0xd801, 0xd801) AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0xd802, 0xd802) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/imolagp.c b/src/mame/drivers/imolagp.c
index b6d84a8c0e8..caa951d9bc9 100644
--- a/src/mame/drivers/imolagp.c
+++ b/src/mame/drivers/imolagp.c
@@ -327,10 +327,10 @@ static ADDRESS_MAP_START( imolagp_master, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x2802, 0x2802) AM_READ(steerlatch_r) AM_WRITE(SMH_NOP)
/* AM_RANGE(0x2803, 0x2803) ? */
AM_RANGE(0x3000, 0x3000) AM_WRITE(vreg_control_w)
- AM_RANGE(0x37f0, 0x37f0) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x37f0, 0x37f0) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
/* AM_RANGE(0x37f7, 0x37f7) ? */
AM_RANGE(0x3800, 0x3800) AM_WRITE(vreg_data_w)
- AM_RANGE(0x3810, 0x3810) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x3810, 0x3810) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
AM_RANGE(0x4000, 0x4000) AM_READ_PORT("DSWA") /* DSWA */
AM_RANGE(0x5000, 0x50ff) AM_WRITE(imola_ledram_w)
AM_RANGE(0x47ff, 0x4800) AM_WRITE(transmit_data_w)
diff --git a/src/mame/drivers/inufuku.c b/src/mame/drivers/inufuku.c
index 7d7dc23e419..30be3154584 100644
--- a/src/mame/drivers/inufuku.c
+++ b/src/mame/drivers/inufuku.c
@@ -232,10 +232,7 @@ static ADDRESS_MAP_START( inufuku_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(inufuku_soundrombank_w)
AM_RANGE(0x04, 0x04) AM_READWRITE(soundlatch_r, pending_command_clear_w)
- AM_RANGE(0x08, 0x08) AM_READWRITE(ym2610_status_port_0_a_r, ym2610_control_port_0_a_w)
- AM_RANGE(0x09, 0x09) AM_READWRITE(ym2610_read_port_0_r, ym2610_data_port_0_a_w)
- AM_RANGE(0x0a, 0x0a) AM_READWRITE(ym2610_status_port_0_b_r, ym2610_control_port_0_b_w)
- AM_RANGE(0x0b, 0x0b) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE(SOUND, "ym", ym2610_r, ym2610_w)
ADDRESS_MAP_END
/******************************************************************************
@@ -352,9 +349,9 @@ GFXDECODE_END
******************************************************************************/
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface ym2610_config =
diff --git a/src/mame/drivers/iqblock.c b/src/mame/drivers/iqblock.c
index f799329a21b..8e70c88b087 100644
--- a/src/mame/drivers/iqblock.c
+++ b/src/mame/drivers/iqblock.c
@@ -134,8 +134,7 @@ static ADDRESS_MAP_START( main_portmap, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x5080, 0x5083) AM_DEVREAD(PPI8255, "ppi8255", ppi8255_r)
AM_RANGE(0x5090, 0x5090) AM_READ_PORT("SW0")
AM_RANGE(0x50a0, 0x50a0) AM_READ_PORT("SW1")
- AM_RANGE(0x50b0, 0x50b0) AM_WRITE(ym2413_register_port_0_w) // UM3567_register_port_0_w
- AM_RANGE(0x50b1, 0x50b1) AM_WRITE(ym2413_data_port_0_w) // UM3567_data_port_0_w
+ AM_RANGE(0x50b0, 0x50b1) AM_DEVWRITE(SOUND, "ym", ym2413_w) // UM3567_data_port_0_w
AM_RANGE(0x50c0, 0x50c0) AM_WRITE(iqblock_irqack_w)
AM_RANGE(0x7000, 0x7fff) AM_READ(iqblock_bgvideoram_r)
AM_RANGE(0x8000, 0xffff) AM_READ(extrarom_r)
diff --git a/src/mame/drivers/irobot.c b/src/mame/drivers/irobot.c
index aebc7be34d5..34b753d42bd 100644
--- a/src/mame/drivers/irobot.c
+++ b/src/mame/drivers/irobot.c
@@ -281,8 +281,8 @@ GFXDECODE_END
static const pokey_interface pokey_config =
{
- { 0 },
- input_port_4_r
+ { DEVCB_NULL },
+ DEVCB_INPUT_PORT("DSW2")
};
diff --git a/src/mame/drivers/ironhors.c b/src/mame/drivers/ironhors.c
index aecf993bf6e..4fc0e02cc9d 100644
--- a/src/mame/drivers/ironhors.c
+++ b/src/mame/drivers/ironhors.c
@@ -46,14 +46,11 @@ static WRITE8_HANDLER( ironhors_sh_irqtrigger_w )
cpu_set_input_line_and_vector(space->machine->cpu[1],0,HOLD_LINE,0xff);
}
-static WRITE8_HANDLER( ironhors_filter_w )
+static WRITE8_DEVICE_HANDLER( ironhors_filter_w )
{
- if (sndti_exists(SOUND_DISCRETE, 2))
- {
- discrete_sound_w(space, NODE_11, (data & 0x04) >> 2);
- discrete_sound_w(space, NODE_12, (data & 0x02) >> 1);
- discrete_sound_w(space, NODE_13, (data & 0x01) >> 0);
- }
+ discrete_sound_w(device, NODE_11, (data & 0x04) >> 2);
+ discrete_sound_w(device, NODE_12, (data & 0x02) >> 1);
+ discrete_sound_w(device, NODE_13, (data & 0x01) >> 0);
}
static ADDRESS_MAP_START( master_map, ADDRESS_SPACE_PROGRAM, 8 )
@@ -92,16 +89,14 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( slave_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym2203", ym2203_r, ym2203_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( farwest_slave_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM
AM_RANGE(0x4000, 0x43ff) AM_RAM
- AM_RANGE(0x8000, 0x8000) AM_READWRITE(soundlatch_r, ym2203_control_port_0_w)
- AM_RANGE(0x8001, 0x8001) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0x8000, 0x8001) AM_DEVREADWRITE(SOUND, "ym2203", ym2203_r, ym2203_w)
ADDRESS_MAP_END
@@ -342,10 +337,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- ironhors_filter_w,
- NULL
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_DEVICE_HANDLER(SOUND, "disc_ih", ironhors_filter_w),
+ DEVCB_NULL
},
NULL
};
diff --git a/src/mame/drivers/istellar.c b/src/mame/drivers/istellar.c
index baf3d4fc347..af9ae8a8d3c 100644
--- a/src/mame/drivers/istellar.c
+++ b/src/mame/drivers/istellar.c
@@ -354,8 +354,7 @@ static MACHINE_DRIVER_START( istellar )
/* sound hardware */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("ldsound", CUSTOM, 0)
- MDRV_SOUND_CONFIG(laserdisc_custom_interface)
+ MDRV_SOUND_ADD("ldsound", LASERDISC, 0)
MDRV_SOUND_ROUTE(0, "left", 1.0)
MDRV_SOUND_ROUTE(1, "right", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/itech32.c b/src/mame/drivers/itech32.c
index e159cbe708e..a113b82a8da 100644
--- a/src/mame/drivers/itech32.c
+++ b/src/mame/drivers/itech32.c
@@ -1048,8 +1048,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0000) AM_WRITE(sound_return_w)
AM_RANGE(0x0400, 0x0400) AM_READ(sound_data_r)
- AM_RANGE(0x0800, 0x083f) AM_MIRROR(0x80) AM_READWRITE(es5506_data_0_r, es5506_data_0_w)
- AM_RANGE(0x0880, 0x08bf) AM_READ(es5506_data_0_r)
+ AM_RANGE(0x0800, 0x083f) AM_MIRROR(0x80) AM_DEVREADWRITE(SOUND, "ensoniq", es5506_r, es5506_w)
AM_RANGE(0x0c00, 0x0c00) AM_WRITE(sound_bank_w)
AM_RANGE(0x1000, 0x1000) AM_WRITENOP /* noisy */
AM_RANGE(0x1400, 0x140f) AM_DEVREADWRITE(VIA6522, "via6522_0", via_r, via_w)
@@ -1062,7 +1061,7 @@ ADDRESS_MAP_END
/*------ Rev 2 sound board memory layout ------*/
static ADDRESS_MAP_START( sound_020_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0000) AM_MIRROR(0x400) AM_READ(sound_data_r)
- AM_RANGE(0x0800, 0x083f) AM_MIRROR(0x80) AM_READWRITE(es5506_data_0_r, es5506_data_0_w)
+ AM_RANGE(0x0800, 0x083f) AM_MIRROR(0x80) AM_DEVREADWRITE(SOUND, "ensoniq", es5506_r, es5506_w)
AM_RANGE(0x0c00, 0x0c00) AM_WRITE(sound_bank_w)
AM_RANGE(0x1400, 0x1400) AM_WRITE(firq_clear_w)
AM_RANGE(0x1800, 0x1800) AM_READWRITE(sound_data_buffer_r, SMH_NOP)
diff --git a/src/mame/drivers/itech8.c b/src/mame/drivers/itech8.c
index c95280f72d8..ce072c94cf5 100644
--- a/src/mame/drivers/itech8.c
+++ b/src/mame/drivers/itech8.c
@@ -638,9 +638,9 @@ static WRITE8_HANDLER( itech8_nmi_ack_w )
}
-static void generate_sound_irq(running_machine *machine, int state)
+static void generate_sound_irq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1], M6809_FIRQ_LINE, state ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], M6809_FIRQ_LINE, state ? ASSERT_LINE : CLEAR_LINE);
}
@@ -785,7 +785,7 @@ static WRITE8_HANDLER( pia_portb_out )
}
-static WRITE8_HANDLER( ym2203_portb_out )
+static WRITE8_DEVICE_HANDLER( ym2203_portb_out )
{
logerror("YM2203 port B write = %02x\n", data);
@@ -794,7 +794,7 @@ static WRITE8_HANDLER( ym2203_portb_out )
/* bit 6 controls the diagnostic sound LED */
/* bit 7 controls the ticket dispenser */
pia_portb_data = data;
- ticket_dispenser_w(space, 0, data & 0x80);
+ ticket_dispenser_w(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0, data & 0x80);
coin_counter_w(0, (data & 0x20) >> 5);
}
@@ -968,10 +968,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound2203_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0000) AM_WRITENOP
AM_RANGE(0x1000, 0x1000) AM_READ(sound_data_r)
- AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x0002) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x0002) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0x2000, 0x2001) AM_MIRROR(0x0002) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
AM_RANGE(0x3000, 0x37ff) AM_RAM
- AM_RANGE(0x4000, 0x4000) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x4000, 0x4000) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -980,10 +979,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound2608b_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1000, 0x1000) AM_WRITENOP
AM_RANGE(0x2000, 0x2000) AM_READ(sound_data_r)
- AM_RANGE(0x4000, 0x4000) AM_READWRITE(ym2608_status_port_0_a_r, ym2608_control_port_0_a_w)
- AM_RANGE(0x4001, 0x4001) AM_WRITE(ym2608_data_port_0_a_w)
- AM_RANGE(0x4002, 0x4002) AM_READWRITE(ym2608_status_port_0_b_r, ym2608_control_port_0_b_w)
- AM_RANGE(0x4003, 0x4003) AM_WRITE(ym2608_data_port_0_b_w)
+ AM_RANGE(0x4000, 0x4003) AM_DEVREADWRITE(SOUND, "ym", ym2608_r, ym2608_w)
AM_RANGE(0x6000, 0x67ff) AM_RAM
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -993,10 +989,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound3812_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0000) AM_WRITENOP
AM_RANGE(0x1000, 0x1000) AM_READ(sound_data_r)
- AM_RANGE(0x2000, 0x2000) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0x2001, 0x2001) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x2000, 0x2001) AM_DEVREADWRITE(SOUND, "ym", ym3812_r, ym3812_w)
AM_RANGE(0x3000, 0x37ff) AM_RAM
- AM_RANGE(0x4000, 0x4000) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x4000, 0x4000) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0x5000, 0x5003) AM_READWRITE(pia_0_r, pia_0_w)
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -1006,10 +1001,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound3812_external_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0000) AM_WRITENOP
AM_RANGE(0x1000, 0x1000) AM_READ(sound_data_r)
- AM_RANGE(0x2000, 0x2000) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0x2001, 0x2001) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x2000, 0x2001) AM_DEVREADWRITE(SOUND, "ym", ym3812_r, ym3812_w)
AM_RANGE(0x3000, 0x37ff) AM_RAM
- AM_RANGE(0x4000, 0x4000) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x4000, 0x4000) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0x5000, 0x500f) AM_DEVREADWRITE(VIA6522, "via6522_0", via_r, via_w)
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -1689,10 +1683,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- NULL,
- ym2203_portb_out,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(ym2203_portb_out)
},
generate_sound_irq
};
@@ -1703,10 +1697,10 @@ static const ym2608_interface ym2608b_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- NULL,
- ym2203_portb_out,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(ym2203_portb_out),
},
generate_sound_irq
};
diff --git a/src/mame/drivers/jack.c b/src/mame/drivers/jack.c
index 747ff848c2b..bc52acdf2e9 100644
--- a/src/mame/drivers/jack.c
+++ b/src/mame/drivers/jack.c
@@ -62,11 +62,11 @@ extern VIDEO_UPDATE( joinem );
static int timer_rate;
-static READ8_HANDLER( timer_r )
+static READ8_DEVICE_HANDLER( timer_r )
{
/* wrong! there should be no need for timer_rate, the same function */
/* should work for both games */
- return cputag_get_total_cycles(space->machine, "audio") / timer_rate;
+ return cputag_get_total_cycles(device->machine, "audio") / timer_rate;
}
@@ -195,8 +195,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x40, 0x40) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x40, 0x40) AM_DEVREADWRITE(SOUND, "ay", ay8910_r, ay8910_data_w)
+ AM_RANGE(0x80, 0x80) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
ADDRESS_MAP_END
@@ -846,8 +846,8 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r,
- timer_r
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r),
+ DEVCB_DEVICE_HANDLER(CPU, "audio", timer_r)
};
diff --git a/src/mame/drivers/jackal.c b/src/mame/drivers/jackal.c
index 3fe66bf5c06..50e467f7ea4 100644
--- a/src/mame/drivers/jackal.c
+++ b/src/mame/drivers/jackal.c
@@ -117,8 +117,7 @@ static ADDRESS_MAP_START( master_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END
static ADDRESS_MAP_START( slave_map, ADDRESS_SPACE_PROGRAM, 8 )
- AM_RANGE(0x2000, 0x2000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x2001, 0x2001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x2000, 0x2001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x4000, 0x43ff) AM_RAM_WRITE(SMH_RAM) AM_BASE(&paletteram) // self test only checks 0x4000-0x423f, 007327 should actually go up to 4fff
AM_RANGE(0x6000, 0x605f) AM_RAM // SOUND RAM (Self test check 0x6000-605f, 0x7c00-0x7fff)
AM_RANGE(0x6060, 0x7fff) AM_RAM AM_SHARE(1)
diff --git a/src/mame/drivers/jackie.c b/src/mame/drivers/jackie.c
index 71553822766..aacb9bc8466 100644
--- a/src/mame/drivers/jackie.c
+++ b/src/mame/drivers/jackie.c
@@ -297,8 +297,7 @@ static ADDRESS_MAP_START( jackie_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x5090, 0x5090) AM_READ_PORT("BUTTONS1")
AM_RANGE(0x5091, 0x5091) AM_WRITE( jackie_lamps_w )
AM_RANGE(0x50a0, 0x50a0) AM_READ_PORT("BUTTONS2")
- AM_RANGE(0x50b0, 0x50b0) AM_WRITE(ym2413_register_port_0_w)
- AM_RANGE(0x50b1, 0x50b1) AM_WRITE(ym2413_data_port_0_w)
+ AM_RANGE(0x50b0, 0x50b1) AM_DEVWRITE(SOUND, "ym", ym2413_w)
AM_RANGE(0x50c0, 0x50c0) AM_READ(igs_irqack_r) AM_WRITE(igs_irqack_w)
AM_RANGE(0x6000, 0x60ff) AM_RAM_WRITE( bg_scroll_w ) AM_BASE( &bg_scroll )
AM_RANGE(0x6800, 0x69ff) AM_RAM_WRITE( jackie_reel1_ram_w ) AM_BASE( &jackie_reel1_ram )
diff --git a/src/mame/drivers/jackpool.c b/src/mame/drivers/jackpool.c
index 6272613a55d..0e103e565e8 100644
--- a/src/mame/drivers/jackpool.c
+++ b/src/mame/drivers/jackpool.c
@@ -184,7 +184,7 @@ static ADDRESS_MAP_START( jackpool_mem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x380000, 0x380061) AM_READWRITE(jackpool_io_r,jackpool_io_w) AM_BASE(&jackpool_io)//AM_READ(jackpool_io_r)
AM_RANGE(0x800000, 0x80000f) AM_READ(jackpool_ff_r) AM_WRITENOP
- AM_RANGE(0xa00000, 0xa00001) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0xa00000, 0xa00001) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/jailbrek.c b/src/mame/drivers/jailbrek.c
index 9977a651d4c..4f1d55b82e8 100644
--- a/src/mame/drivers/jailbrek.c
+++ b/src/mame/drivers/jailbrek.c
@@ -77,14 +77,14 @@ static INTERRUPT_GEN( jb_interrupt_nmi )
}
-static READ8_HANDLER( jailbrek_speech_r ) {
- return ( vlm5030_bsy() ? 1 : 0 );
+static READ8_DEVICE_HANDLER( jailbrek_speech_r ) {
+ return ( vlm5030_bsy(device) ? 1 : 0 );
}
-static WRITE8_HANDLER( jailbrek_speech_w ) {
+static WRITE8_DEVICE_HANDLER( jailbrek_speech_w ) {
/* bit 0 could be latch direction like in yiear */
- vlm5030_st( ( data >> 1 ) & 1 );
- vlm5030_rst( ( data >> 2 ) & 1 );
+ vlm5030_st( device, ( data >> 1 ) & 1 );
+ vlm5030_rst( device, ( data >> 2 ) & 1 );
}
static ADDRESS_MAP_START( jailbrek_map, ADDRESS_SPACE_PROGRAM, 8 )
@@ -100,15 +100,15 @@ static ADDRESS_MAP_START( jailbrek_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x2043, 0x2043) AM_WRITENOP /* ??? */
AM_RANGE(0x2044, 0x2044) AM_WRITE(ctrl_w) /* irq, nmi enable, screen flip */
AM_RANGE(0x3000, 0x307f) AM_RAM /* related to sprites? */
- AM_RANGE(0x3100, 0x3100) AM_READ_PORT("DSW2") AM_WRITE(sn76496_0_w)
+ AM_RANGE(0x3100, 0x3100) AM_READ_PORT("DSW2") AM_DEVWRITE(SOUND, "sn", sn76496_w)
AM_RANGE(0x3200, 0x3200) AM_READ_PORT("DSW3") AM_WRITENOP /* mirror of the previous? */
AM_RANGE(0x3300, 0x3300) AM_READ_PORT("SYSTEM") AM_WRITE(watchdog_reset_w)
AM_RANGE(0x3301, 0x3301) AM_READ_PORT("P1")
AM_RANGE(0x3302, 0x3302) AM_READ_PORT("P2")
AM_RANGE(0x3303, 0x3303) AM_READ_PORT("DSW1")
- AM_RANGE(0x4000, 0x4000) AM_WRITE(jailbrek_speech_w) /* speech pins */
- AM_RANGE(0x5000, 0x5000) AM_WRITE(vlm5030_data_w) /* speech data */
- AM_RANGE(0x6000, 0x6000) AM_READ(jailbrek_speech_r)
+ AM_RANGE(0x4000, 0x4000) AM_DEVWRITE(SOUND, "vlm", jailbrek_speech_w) /* speech pins */
+ AM_RANGE(0x5000, 0x5000) AM_DEVWRITE(SOUND, "vlm", vlm5030_data_w) /* speech data */
+ AM_RANGE(0x6000, 0x6000) AM_DEVREAD(SOUND, "vlm", jailbrek_speech_r)
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
diff --git a/src/mame/drivers/jalmah.c b/src/mame/drivers/jalmah.c
index e788946a56a..3d348583349 100644
--- a/src/mame/drivers/jalmah.c
+++ b/src/mame/drivers/jalmah.c
@@ -909,7 +909,7 @@ static ADDRESS_MAP_START( jalmah, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x080018, 0x080019) AM_WRITE(jalmah_okibank_w)
AM_RANGE(0x08001a, 0x08001b) AM_WRITE(jalmah_okirom_w)
/**/AM_RANGE(0x080020, 0x08003f) AM_READ(SMH_RAM) AM_WRITE(jalmah_scroll_w)
- AM_RANGE(0x080040, 0x080041) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x080040, 0x080041) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
// 0x084000, 0x084001 ?
AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE(&paletteram16) /* Palette RAM */
AM_RANGE(0x090000, 0x093fff) AM_RAM_WRITE(sc0_vram_w) AM_BASE(&sc0_vram)
@@ -933,7 +933,7 @@ static ADDRESS_MAP_START( urashima, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x080018, 0x080019) AM_WRITE(jalmah_okibank_w)
AM_RANGE(0x08001a, 0x08001b) AM_WRITE(jalmah_okirom_w)
/**/AM_RANGE(0x08001c, 0x08001d) AM_READ(SMH_RAM) AM_WRITE(urashima_bank_w)
- AM_RANGE(0x080040, 0x080041) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x080040, 0x080041) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
// 0x084000, 0x084001 ?
AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE(&paletteram16) /* Palette RAM */
AM_RANGE(0x090000, 0x093fff) AM_RAM_WRITE(urashima_sc0_vram_w) AM_BASE(&sc0_vram)
diff --git a/src/mame/drivers/jangou.c b/src/mame/drivers/jangou.c
index dfdb4bce466..b0dfb8d0c10 100644
--- a/src/mame/drivers/jangou.c
+++ b/src/mame/drivers/jangou.c
@@ -228,25 +228,25 @@ static WRITE8_HANDLER( output_w )
// coin_lockout_w(0,~data & 0x20);
}
-static READ8_HANDLER( input_mux_r )
+static READ8_DEVICE_HANDLER( input_mux_r )
{
switch(mux_data)
{
- case 0x01: return input_port_read(space->machine, "PL1_1");
- case 0x02: return input_port_read(space->machine, "PL1_2");
- case 0x04: return input_port_read(space->machine, "PL2_1");
- case 0x08: return input_port_read(space->machine, "PL2_2");
- case 0x10: return input_port_read(space->machine, "PL1_3");
- case 0x20: return input_port_read(space->machine, "PL2_3");
+ case 0x01: return input_port_read(device->machine, "PL1_1");
+ case 0x02: return input_port_read(device->machine, "PL1_2");
+ case 0x04: return input_port_read(device->machine, "PL2_1");
+ case 0x08: return input_port_read(device->machine, "PL2_2");
+ case 0x10: return input_port_read(device->machine, "PL1_3");
+ case 0x20: return input_port_read(device->machine, "PL2_3");
}
// printf("%04x\n",mux_data);
return 0xff;
}
-static READ8_HANDLER( input_system_r )
+static READ8_DEVICE_HANDLER( input_system_r )
{
- return input_port_read(space->machine, "SYSTEM");
+ return input_port_read(device->machine, "SYSTEM");
}
@@ -277,7 +277,7 @@ static WRITE8_HANDLER( cvsd_w )
static TIMER_CALLBACK( cvsd_bit_timer_callback )
{
/* Data is shifted out at the MSB */
- hc55516_digit_w(0, (cvsd_shiftreg >> 7) & 1);
+ hc55516_digit_w(devtag_get_device(machine, SOUND, "cvsd"), (cvsd_shiftreg >> 7) & 1);
cvsd_shiftreg <<= 1;
/* Trigger an IRQ for every 8 shifted bits */
@@ -296,11 +296,11 @@ static void jngolady_vclk_cb(const device_config *device)
{
if (msm5205_vclk_toggle == 0)
{
- msm5205_data_w(0, adpcm_byte >> 4);
+ msm5205_data_w(device, adpcm_byte >> 4);
}
else
{
- msm5205_data_w(0, adpcm_byte & 0xf);
+ msm5205_data_w(device, adpcm_byte & 0xf);
cpu_set_input_line(device->machine->cpu[1], 0, HOLD_LINE);
}
@@ -350,9 +350,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( cpu0_io, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x01,0x01) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x02,0x02) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x03,0x03) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x01,0x01) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x02,0x03) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
AM_RANGE(0x10,0x10) AM_READ(blitter_status_r)
AM_RANGE(0x10,0x10) AM_WRITE(output_w)
AM_RANGE(0x11,0x11) AM_WRITE(mux_w)
@@ -422,9 +421,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( cntrygrl_cpu0_io, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x01,0x01) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x02,0x02) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x03,0x03) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x01,0x01) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x02,0x03) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
AM_RANGE(0x10,0x10) AM_READ_PORT("DSW") //dsw + blitter busy flag
AM_RANGE(0x10,0x10) AM_WRITE(output_w)
AM_RANGE(0x11,0x11) AM_WRITE(mux_w)
@@ -617,10 +615,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_mux_r,
- input_system_r,
- NULL,
- NULL
+ DEVCB_HANDLER(input_mux_r),
+ DEVCB_HANDLER(input_system_r),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const msm5205_interface msm5205_config =
diff --git a/src/mame/drivers/jantotsu.c b/src/mame/drivers/jantotsu.c
index 58fcef3a72e..77742786c17 100644
--- a/src/mame/drivers/jantotsu.c
+++ b/src/mame/drivers/jantotsu.c
@@ -216,20 +216,20 @@ static UINT32 adpcm_pos;
static UINT8 adpcm_idle;
static int adpcm_data;
-static WRITE8_HANDLER( jan_adpcm_w )
+static WRITE8_DEVICE_HANDLER( jan_adpcm_w )
{
switch (offset)
{
case 0:
adpcm_pos = (data & 0xff) * 0x80;
adpcm_idle = 0;
- msm5205_reset_w(0,0);
+ msm5205_reset_w(device,0);
// printf("%02x 0\n",data);
break;
/*same write as port 2?*/
case 1:
// adpcm_idle = 1;
-// msm5205_reset_w(0,1);
+// msm5205_reset_w(device,1);
// printf("%02x 1\n",data);
break;
}
@@ -242,7 +242,7 @@ static void jan_adpcm_int(const device_config *device)
if (adpcm_pos >= 0x8000 || adpcm_idle)
{
//adpcm_idle = 1;
- msm5205_reset_w(0,1);
+ msm5205_reset_w(device,1);
trigger = 0;
}
else
@@ -250,7 +250,7 @@ static void jan_adpcm_int(const device_config *device)
UINT8 *ROM = memory_region(device->machine, "adpcm");
adpcm_data = ((trigger ? (ROM[adpcm_pos] & 0x0f) : (ROM[adpcm_pos] & 0xf0)>>4) );
- msm5205_data_w(0,adpcm_data & 0xf);
+ msm5205_data_w(device,adpcm_data & 0xf);
trigger^=1;
if(trigger == 0)
{
@@ -270,9 +270,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( jantotsu_io, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READ_PORT("DSW1") AM_WRITE(sn76496_0_w)
- AM_RANGE(0x01, 0x01) AM_READ(jantotsu_dsw2_r) AM_WRITE(sn76496_1_w)
- AM_RANGE(0x02, 0x03) AM_WRITE(jan_adpcm_w)
+ AM_RANGE(0x00, 0x00) AM_READ_PORT("DSW1") AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0x01, 0x01) AM_READ(jantotsu_dsw2_r) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
+ AM_RANGE(0x02, 0x03) AM_DEVWRITE(SOUND, "adpcm", jan_adpcm_w)
AM_RANGE(0x04, 0x04) AM_READWRITE(jantotsu_mux_r,jantotsu_mux_w)
AM_RANGE(0x07, 0x07) AM_WRITE(bankaddr_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/jchan.c b/src/mame/drivers/jchan.c
index dbdd3225079..74dcd043f09 100644
--- a/src/mame/drivers/jchan.c
+++ b/src/mame/drivers/jchan.c
@@ -538,8 +538,7 @@ static ADDRESS_MAP_START( jchan_sub, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x700000, 0x703fff) AM_RAM AM_BASE(&jchan_spriteram_2) AM_WRITE(jchan_suprnova_sprite32_2_w)
AM_RANGE(0x780000, 0x78003f) AM_RAM AM_BASE(&jchan_sprregs_2) AM_WRITE(jchan_suprnova_sprite32regs_2_w)
- AM_RANGE(0x800000, 0x800001) AM_WRITE(ymz280b_register_0_lsb_w) // sound
- AM_RANGE(0x800002, 0x800003) AM_WRITE(ymz280b_data_0_lsb_w) //
+ AM_RANGE(0x800000, 0x800003) AM_DEVWRITE8(SOUND, "ymz", ymz280b_w, 0x00ff) // sound
AM_RANGE(0xa00000, 0xa00001) AM_READWRITE(watchdog_reset16_r, watchdog_reset16_w) // watchdog
ADDRESS_MAP_END
diff --git a/src/mame/drivers/jollyjgr.c b/src/mame/drivers/jollyjgr.c
index ee0177715b6..913f1c43ae5 100644
--- a/src/mame/drivers/jollyjgr.c
+++ b/src/mame/drivers/jollyjgr.c
@@ -151,8 +151,8 @@ static ADDRESS_MAP_START( jollyjgr_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0x87ff) AM_RAM
AM_RANGE(0x8ff8, 0x8ff8) AM_READ_PORT("DSW1")
AM_RANGE(0x8ff9, 0x8ff9) AM_READ_PORT("INPUTS")
- AM_RANGE(0x8ff8, 0x8ff8) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x8ffa, 0x8ffa) AM_READ_PORT("SYSTEM") AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x8ff8, 0x8ff8) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
+ AM_RANGE(0x8ffa, 0x8ffa) AM_READ_PORT("SYSTEM") AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
AM_RANGE(0x8fff, 0x8fff) AM_READ_PORT("DSW2")
AM_RANGE(0x8ffc, 0x8ffc) AM_WRITE(jollyjgr_misc_w)
AM_RANGE(0x8ffd, 0x8ffd) AM_WRITE(jollyjgr_coin_lookout_w)
diff --git a/src/mame/drivers/jongkyo.c b/src/mame/drivers/jongkyo.c
index e6b5c149c8f..b7ef1e8fc9c 100644
--- a/src/mame/drivers/jongkyo.c
+++ b/src/mame/drivers/jongkyo.c
@@ -118,46 +118,46 @@ static WRITE8_HANDLER( jongkyo_coin_counter_w )
/* bit 2 always set? */
}
-static READ8_HANDLER( input_1p_r )
+static READ8_DEVICE_HANDLER( input_1p_r )
{
static UINT8 cr_clear;
- cr_clear = input_port_read(space->machine, "CR_CLEAR");
+ cr_clear = input_port_read(device->machine, "CR_CLEAR");
switch(mux_data)
{
- case 0x01: return input_port_read(space->machine, "PL1_1") | cr_clear;
- case 0x02: return input_port_read(space->machine, "PL1_2") | cr_clear;
- case 0x04: return input_port_read(space->machine, "PL1_3") | cr_clear;
- case 0x08: return input_port_read(space->machine, "PL1_4") | cr_clear;
- case 0x10: return input_port_read(space->machine, "PL1_5") | cr_clear;
- case 0x20: return input_port_read(space->machine, "PL1_6") | cr_clear;
+ case 0x01: return input_port_read(device->machine, "PL1_1") | cr_clear;
+ case 0x02: return input_port_read(device->machine, "PL1_2") | cr_clear;
+ case 0x04: return input_port_read(device->machine, "PL1_3") | cr_clear;
+ case 0x08: return input_port_read(device->machine, "PL1_4") | cr_clear;
+ case 0x10: return input_port_read(device->machine, "PL1_5") | cr_clear;
+ case 0x20: return input_port_read(device->machine, "PL1_6") | cr_clear;
}
// printf("%04x\n",mux_data);
- return (input_port_read(space->machine, "PL1_1") & input_port_read(space->machine, "PL1_2") & input_port_read(space->machine, "PL1_3") &
- input_port_read(space->machine, "PL1_4") & input_port_read(space->machine, "PL1_5") & input_port_read(space->machine, "PL1_6")) | cr_clear;//input_port_read(space->machine, "PL1_0") && ;
+ return (input_port_read(device->machine, "PL1_1") & input_port_read(device->machine, "PL1_2") & input_port_read(device->machine, "PL1_3") &
+ input_port_read(device->machine, "PL1_4") & input_port_read(device->machine, "PL1_5") & input_port_read(device->machine, "PL1_6")) | cr_clear;//input_port_read(device->machine, "PL1_0") && ;
}
-static READ8_HANDLER( input_2p_r )
+static READ8_DEVICE_HANDLER( input_2p_r )
{
static UINT8 coin_port;
- coin_port = input_port_read(space->machine, "COINS");
+ coin_port = input_port_read(device->machine, "COINS");
switch(mux_data)
{
- case 0x01: return input_port_read(space->machine, "PL2_1") | coin_port;
- case 0x02: return input_port_read(space->machine, "PL2_2") | coin_port;
- case 0x04: return input_port_read(space->machine, "PL2_3") | coin_port;
- case 0x08: return input_port_read(space->machine, "PL2_4") | coin_port;
- case 0x10: return input_port_read(space->machine, "PL2_5") | coin_port;
- case 0x20: return input_port_read(space->machine, "PL2_6") | coin_port;
+ case 0x01: return input_port_read(device->machine, "PL2_1") | coin_port;
+ case 0x02: return input_port_read(device->machine, "PL2_2") | coin_port;
+ case 0x04: return input_port_read(device->machine, "PL2_3") | coin_port;
+ case 0x08: return input_port_read(device->machine, "PL2_4") | coin_port;
+ case 0x10: return input_port_read(device->machine, "PL2_5") | coin_port;
+ case 0x20: return input_port_read(device->machine, "PL2_6") | coin_port;
}
// printf("%04x\n",mux_data);
- return (input_port_read(space->machine, "PL2_1") & input_port_read(space->machine, "PL2_2") & input_port_read(space->machine, "PL2_3") &
- input_port_read(space->machine, "PL2_4") & input_port_read(space->machine, "PL2_5") & input_port_read(space->machine, "PL2_6")) | coin_port;//input_port_read(space->machine, "PL1_0") && ;
+ return (input_port_read(device->machine, "PL2_1") & input_port_read(device->machine, "PL2_2") & input_port_read(device->machine, "PL2_3") &
+ input_port_read(device->machine, "PL2_4") & input_port_read(device->machine, "PL2_5") & input_port_read(device->machine, "PL2_6")) | coin_port;//input_port_read(device->machine, "PL1_0") && ;
}
static WRITE8_HANDLER( videoram2_w )
@@ -204,9 +204,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( jongkyo_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
// R 01 keyboard
- AM_RANGE(0x01, 0x01) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x02, 0x02) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x01, 0x01) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x02, 0x03) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
AM_RANGE(0x10, 0x10) AM_READ_PORT("DSW") AM_WRITE(jongkyo_coin_counter_w)
AM_RANGE(0x11, 0x11) AM_READ_PORT("IN0") AM_WRITE(mux_w)
@@ -410,10 +409,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_1p_r,
- input_2p_r,
- NULL,
- NULL
+ DEVCB_HANDLER(input_1p_r),
+ DEVCB_HANDLER(input_2p_r),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static MACHINE_DRIVER_START( jongkyo )
diff --git a/src/mame/drivers/jpmimpct.c b/src/mame/drivers/jpmimpct.c
index 1f3983f56a6..eb36f5801af 100644
--- a/src/mame/drivers/jpmimpct.c
+++ b/src/mame/drivers/jpmimpct.c
@@ -496,30 +496,30 @@ static READ16_HANDLER( inputs1_r )
* Sound control
*
*************************************/
-static WRITE16_HANDLER( volume_w )
+static WRITE16_DEVICE_HANDLER( volume_w )
{
if (ACCESSING_BITS_0_7)
{
- upd7759_set_bank_base(0, 0x20000 * ((data >> 1) & 3));
- upd7759_reset_w(0, data & 0x01);
+ upd7759_set_bank_base(device, 0x20000 * ((data >> 1) & 3));
+ upd7759_reset_w(device, data & 0x01);
}
}
-static WRITE16_HANDLER( upd7759_w )
+static WRITE16_DEVICE_HANDLER( upd7759_w )
{
if (ACCESSING_BITS_0_7)
{
- upd7759_port_w(0, data);
- upd7759_start_w(0, 0);
- upd7759_start_w(0, 1);
+ upd7759_port_w(device, 0, data);
+ upd7759_start_w(device, 0);
+ upd7759_start_w(device, 1);
}
}
-static READ16_HANDLER( upd7759_r )
+static READ16_DEVICE_HANDLER( upd7759_r )
{
if (ACCESSING_BITS_0_7)
{
- return upd7759_busy_r(0);
+ return upd7759_busy_r(device);
}
return 0xffff;
@@ -630,9 +630,9 @@ static ADDRESS_MAP_START( m68k_program_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x004800e0, 0x004800e1) AM_WRITE(unk_w)
AM_RANGE(0x004801dc, 0x004801dd) AM_READ(unk_r)
AM_RANGE(0x004801de, 0x004801df) AM_READ(unk_r)
- AM_RANGE(0x00480080, 0x00480081) AM_WRITE(upd7759_w)
- AM_RANGE(0x00480082, 0x00480083) AM_WRITE(volume_w)
- AM_RANGE(0x00480084, 0x00480085) AM_READ(upd7759_r)
+ AM_RANGE(0x00480080, 0x00480081) AM_DEVWRITE(SOUND, "upd", upd7759_w)
+ AM_RANGE(0x00480082, 0x00480083) AM_DEVWRITE(SOUND, "upd", volume_w)
+ AM_RANGE(0x00480084, 0x00480085) AM_DEVREAD(SOUND, "upd", upd7759_r)
AM_RANGE(0x004801e0, 0x004801ff) AM_READWRITE(duart_2_r, duart_2_w)
AM_RANGE(0x00800000, 0x00800007) AM_READWRITE(m68k_tms_r, m68k_tms_w)
AM_RANGE(0x00c00000, 0x00cfffff) AM_ROM
diff --git a/src/mame/drivers/jpmsys5.c b/src/mame/drivers/jpmsys5.c
index 7a885646a27..ae411641751 100644
--- a/src/mame/drivers/jpmsys5.c
+++ b/src/mame/drivers/jpmsys5.c
@@ -247,28 +247,28 @@ static READ16_HANDLER( mux_r )
return 0xffff;
}
-static WRITE16_HANDLER( upd7759_w )
+static WRITE16_DEVICE_HANDLER( jpm_upd7759_w )
{
if (offset == 0)
{
- upd7759_port_w(0, data & 0xff);
- upd7759_start_w(0, 0);
- upd7759_start_w(0, 1);
+ upd7759_port_w(device, 0, data & 0xff);
+ upd7759_start_w(device, 0);
+ upd7759_start_w(device, 1);
}
else if (offset == 2)
{
- upd7759_reset_w(0, ~data & 0x4);
- upd7759_set_bank_base(0, (data & 2) ? 0x20000 : 0);
+ upd7759_reset_w(device, ~data & 0x4);
+ upd7759_set_bank_base(device, (data & 2) ? 0x20000 : 0);
}
else
{
- logerror("upd7759: Unknown write to %x with %x (PC:%04x)\n", offset, data, cpu_get_previouspc(space->cpu));
+ logerror("%s: upd7759: Unknown write to %x with %x\n", cpuexec_describe_context(device->machine), offset, data);
}
}
-static READ16_HANDLER( upd7759_r )
+static READ16_DEVICE_HANDLER( jpm_upd7759_r )
{
- return 0x14 | upd7759_busy_r(0);
+ return 0x14 | upd7759_busy_r(device);
}
@@ -297,13 +297,12 @@ static ADDRESS_MAP_START( 68000_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x046088, 0x046089) AM_READ(unk_r) // PIA?
AM_RANGE(0x04608c, 0x04608d) AM_DEVREADWRITE8(ACIA6850, "acia6850_2", acia6850_stat_r, acia6850_ctrl_w, 0xff)
AM_RANGE(0x04608e, 0x04608f) AM_DEVREADWRITE8(ACIA6850, "acia6850_2", acia6850_data_r, acia6850_data_w, 0xff)
- AM_RANGE(0x0460a0, 0x0460a1) AM_WRITE(ym2413_register_port_0_lsb_w)
- AM_RANGE(0x0460a2, 0x0460a3) AM_WRITE(ym2413_data_port_0_lsb_w)
+ AM_RANGE(0x0460a0, 0x0460a3) AM_DEVWRITE8(SOUND, "ym2413", ym2413_w, 0x00ff)
AM_RANGE(0x0460c0, 0x0460c1) AM_WRITENOP
AM_RANGE(0x0460e0, 0x0460e5) AM_WRITE(ramdac_w)
AM_RANGE(0x048000, 0x04801f) AM_READWRITE(coins_r, coins_w)
AM_RANGE(0x04c000, 0x04c0ff) AM_READ(mux_r) AM_WRITE(mux_w)
- AM_RANGE(0x04c100, 0x04c105) AM_READWRITE(upd7759_r, upd7759_w)
+ AM_RANGE(0x04c100, 0x04c105) AM_DEVREADWRITE(SOUND, "upd7759", jpm_upd7759_r, jpm_upd7759_w)
AM_RANGE(0x800000, 0xcfffff) AM_READWRITE(sys5_tms34061_r, sys5_tms34061_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/jrpacman.c b/src/mame/drivers/jrpacman.c
index 8fe3b169388..c26d144c83e 100644
--- a/src/mame/drivers/jrpacman.c
+++ b/src/mame/drivers/jrpacman.c
@@ -125,10 +125,10 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4ff0, 0x4fff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0x5000, 0x503f) AM_READ_PORT("P1")
AM_RANGE(0x5000, 0x5000) AM_WRITE(interrupt_enable_w)
- AM_RANGE(0x5001, 0x5001) AM_WRITE(pacman_sound_enable_w)
+ AM_RANGE(0x5001, 0x5001) AM_DEVWRITE(SOUND, "namco", pacman_sound_enable_w)
AM_RANGE(0x5003, 0x5003) AM_WRITE(pacman_flipscreen_w)
AM_RANGE(0x5040, 0x507f) AM_READ_PORT("P2")
- AM_RANGE(0x5040, 0x505f) AM_WRITE(pacman_sound_w) AM_BASE(&pacman_soundregs)
+ AM_RANGE(0x5040, 0x505f) AM_DEVWRITE(SOUND, "namco", pacman_sound_w) AM_BASE(&pacman_soundregs)
AM_RANGE(0x5060, 0x506f) AM_WRITEONLY AM_BASE(&spriteram_2)
AM_RANGE(0x5070, 0x5070) AM_WRITE(pengo_palettebank_w)
AM_RANGE(0x5071, 0x5071) AM_WRITE(pengo_colortablebank_w)
diff --git a/src/mame/drivers/junofrst.c b/src/mame/drivers/junofrst.c
index 4fc18a7430c..5c02d8a4b09 100644
--- a/src/mame/drivers/junofrst.c
+++ b/src/mame/drivers/junofrst.c
@@ -96,7 +96,7 @@ static WRITE8_HANDLER( junofrst_bankselect_w )
}
-static READ8_HANDLER( junofrst_portA_r )
+static READ8_DEVICE_HANDLER( junofrst_portA_r )
{
int timer;
@@ -105,7 +105,7 @@ static READ8_HANDLER( junofrst_portA_r )
/* divided by 1024 to get this timer */
/* (divide by (1024/2), and not 1024, because the CPU cycle counter is */
/* incremented every other state change of the clock) */
- timer = (cputag_get_total_cycles(space->machine, "audio") / (1024/2)) & 0x0f;
+ timer = (cputag_get_total_cycles(device->machine, "audio") / (1024/2)) & 0x0f;
/* low three bits come from the 8039 */
@@ -113,8 +113,9 @@ static READ8_HANDLER( junofrst_portA_r )
}
-static WRITE8_HANDLER( junofrst_portB_w )
+static WRITE8_DEVICE_HANDLER( junofrst_portB_w )
{
+ static const char *fltname[] = { "filter.0.0", "filter.0.1", "filter.0.2" };
int i;
@@ -127,7 +128,7 @@ static WRITE8_HANDLER( junofrst_portB_w )
if (data & 1) C += 47000; /* 47000pF = 0.047uF */
if (data & 2) C += 220000; /* 220000pF = 0.22uF */
data >>= 2;
- filter_rc_set_RC(i,FLT_RC_LOWPASS,1000,2200,200,CAP_P(C));
+ filter_rc_set_RC(devtag_get_device(device->machine, SOUND, fltname[i]),FLT_RC_LOWPASS,1000,2200,200,CAP_P(C));
}
}
@@ -202,9 +203,9 @@ static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_ROM
AM_RANGE(0x2000, 0x23ff) AM_RAM
AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r)
- AM_RANGE(0x4000, 0x4000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x4001, 0x4001) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x4002, 0x4002) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x4000, 0x4000) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
+ AM_RANGE(0x4001, 0x4001) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x4002, 0x4002) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
AM_RANGE(0x5000, 0x5000) AM_WRITE(soundlatch2_w)
AM_RANGE(0x6000, 0x6000) AM_WRITE(junofrst_i8039_irq_w)
ADDRESS_MAP_END
@@ -217,7 +218,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( mcu_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0xff) AM_READ(soundlatch2_r)
- AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(dac_0_data_w)
+ AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE(SOUND, "dac", dac_w)
AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(i8039_irqen_and_status_w)
ADDRESS_MAP_END
@@ -322,10 +323,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- junofrst_portA_r,
- NULL,
- NULL,
- junofrst_portB_w
+ DEVCB_HANDLER(junofrst_portA_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(junofrst_portB_w)
};
diff --git a/src/mame/drivers/kaneko16.c b/src/mame/drivers/kaneko16.c
index 0b5f27b2a34..13f0b1da660 100644
--- a/src/mame/drivers/kaneko16.c
+++ b/src/mame/drivers/kaneko16.c
@@ -276,34 +276,20 @@ static WRITE16_HANDLER( kaneko16_soundlatch_w )
/* Two identically mapped YM2149 chips */
-static READ16_HANDLER( kaneko16_YM2149_0_r )
+static READ16_DEVICE_HANDLER( kaneko16_YM2149_r )
{
/* Each 2149 register is mapped to a different address */
- ay8910_control_port_0_w(space,0,offset);
- return ay8910_read_port_0_r(space,0);
-}
-static READ16_HANDLER( kaneko16_YM2149_1_r )
-{
- /* Each 2149 register is mapped to a different address */
- ay8910_control_port_1_w(space,0,offset);
- return ay8910_read_port_1_r(space,0);
+ ay8910_address_w(device,0,offset);
+ return ay8910_r(device,0);
}
-static WRITE16_HANDLER( kaneko16_YM2149_0_w )
-{
- /* Each 2149 register is mapped to a different address */
- ay8910_control_port_0_w(space,0,offset);
- /* The registers are mapped to odd addresses, except one! */
- if (ACCESSING_BITS_0_7) ay8910_write_port_0_w(space,0, data & 0xff);
- else ay8910_write_port_0_w(space,0,(data >> 8) & 0xff);
-}
-static WRITE16_HANDLER( kaneko16_YM2149_1_w )
+static WRITE16_DEVICE_HANDLER( kaneko16_YM2149_w )
{
/* Each 2149 register is mapped to a different address */
- ay8910_control_port_1_w(space,0,offset);
+ ay8910_address_w(device,0,offset);
/* The registers are mapped to odd addresses, except one! */
- if (ACCESSING_BITS_0_7) ay8910_write_port_1_w(space,0, data & 0xff);
- else ay8910_write_port_1_w(space,0,(data >> 8) & 0xff);
+ if (ACCESSING_BITS_0_7) ay8910_data_w(device,0, data & 0xff);
+ else ay8910_data_w(device,0,(data >> 8) & 0xff);
}
@@ -315,12 +301,12 @@ static WRITE16_HANDLER( kaneko16_YM2149_1_w )
***************************************************************************/
-static READ8_HANDLER( kaneko16_eeprom_r )
+static READ8_DEVICE_HANDLER( kaneko16_eeprom_r )
{
return eeprom_read_bit() & 1;
}
-static WRITE8_HANDLER( kaneko16_eeprom_reset_w )
+static WRITE8_DEVICE_HANDLER( kaneko16_eeprom_reset_w )
{
// reset line asserted: reset.
eeprom_set_cs_line((data & 0x01) ? CLEAR_LINE : ASSERT_LINE );
@@ -377,10 +363,10 @@ static ADDRESS_MAP_START( berlwall, ADDRESS_SPACE_PROGRAM, 16 )
// AM_RANGE(0x680006, 0x680007) AM_READ_PORT("UNK")
AM_RANGE(0x700000, 0x700001) AM_WRITE(kaneko16_coin_lockout_w) // Coin Lockout
AM_RANGE(0x780000, 0x780001) AM_READ(watchdog_reset16_r) // Watchdog
- AM_RANGE(0x800000, 0x80001f) AM_READWRITE(kaneko16_YM2149_0_r, kaneko16_YM2149_0_w) // Sound
- AM_RANGE(0x800200, 0x80021f) AM_READWRITE(kaneko16_YM2149_1_r, kaneko16_YM2149_1_w)
+ AM_RANGE(0x800000, 0x80001f) AM_DEVREADWRITE(SOUND, "ay1", kaneko16_YM2149_r, kaneko16_YM2149_w) // Sound
+ AM_RANGE(0x800200, 0x80021f) AM_DEVREADWRITE(SOUND, "ay2", kaneko16_YM2149_r, kaneko16_YM2149_w)
AM_RANGE(0x8003fe, 0x8003ff) AM_NOP // for OKI when accessed as .l
- AM_RANGE(0x800400, 0x800401) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x800400, 0x800401) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0xc00000, 0xc00fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE(&kaneko16_vram_1) // Layers
AM_RANGE(0xc01000, 0xc01fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE(&kaneko16_vram_0) //
AM_RANGE(0xc02000, 0xc02fff) AM_RAM AM_BASE(&kaneko16_vscroll_1) //
@@ -397,22 +383,22 @@ ADDRESS_MAP_END
/* The two YM2149 chips are only used when entering high score initials, and */
/* when the game is fully completed. Overkill??? */
-static WRITE16_HANDLER( bakubrkr_oki_bank_sw )
+static WRITE16_DEVICE_HANDLER( bakubrkr_oki_bank_sw )
{
if (ACCESSING_BITS_0_7) {
- okim6295_set_bank_base(0, 0x40000 * (data & 0x7) );
- logerror("PC:%06X Selecting OKI bank %02X\n",cpu_get_pc(space->cpu),data&0xff);
+ okim6295_set_bank_base(device, 0x40000 * (data & 0x7) );
+ logerror("%s:Selecting OKI bank %02X\n",cpuexec_describe_context(device->machine),data&0xff);
}
}
static ADDRESS_MAP_START( bakubrkr, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_ROM // ROM
AM_RANGE(0x100000, 0x10ffff) AM_RAM // Work RAM
- AM_RANGE(0x400000, 0x40001f) AM_READ(kaneko16_YM2149_0_r) // Sound
- AM_RANGE(0x400000, 0x40001d) AM_WRITE(kaneko16_YM2149_0_w)
- AM_RANGE(0x40001e, 0x40001f) AM_WRITE(bakubrkr_oki_bank_sw) // OKI bank Switch
- AM_RANGE(0x400200, 0x40021f) AM_READWRITE(kaneko16_YM2149_1_r,kaneko16_YM2149_1_w) // Sound
- AM_RANGE(0x400400, 0x400401) AM_READWRITE(okim6295_status_0_lsb_r,okim6295_data_0_lsb_w) //
+ AM_RANGE(0x400000, 0x40001f) AM_DEVREAD(SOUND, "ay1", kaneko16_YM2149_r) // Sound
+ AM_RANGE(0x400000, 0x40001d) AM_DEVWRITE(SOUND, "ay1", kaneko16_YM2149_w)
+ AM_RANGE(0x40001e, 0x40001f) AM_DEVWRITE(SOUND, "oki", bakubrkr_oki_bank_sw) // OKI bank Switch
+ AM_RANGE(0x400200, 0x40021f) AM_DEVREADWRITE(SOUND, "ay2", kaneko16_YM2149_r,kaneko16_YM2149_w) // Sound
+ AM_RANGE(0x400400, 0x400401) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff) //
AM_RANGE(0x500000, 0x500fff) AM_READWRITE(SMH_RAM,kaneko16_vram_1_w) AM_BASE(&kaneko16_vram_1) // Layers 0
AM_RANGE(0x501000, 0x501fff) AM_READWRITE(SMH_RAM,kaneko16_vram_0_w) AM_BASE(&kaneko16_vram_0) //
AM_RANGE(0x502000, 0x502fff) AM_RAM AM_BASE(&kaneko16_vscroll_1) //
@@ -467,20 +453,20 @@ ADDRESS_MAP_END
Blood Warrior
***************************************************************************/
-static WRITE16_HANDLER( bloodwar_oki_0_bank_w )
+static WRITE16_DEVICE_HANDLER( bloodwar_oki_0_bank_w )
{
if (ACCESSING_BITS_0_7)
{
- okim6295_set_bank_base(0, 0x40000 * (data & 0xf) );
+ okim6295_set_bank_base(device, 0x40000 * (data & 0xf) );
// logerror("CPU #0 PC %06X : OKI0 bank %08X\n",cpu_get_pc(space->cpu),data);
}
}
-static WRITE16_HANDLER( bloodwar_oki_1_bank_w )
+static WRITE16_DEVICE_HANDLER( bloodwar_oki_1_bank_w )
{
if (ACCESSING_BITS_0_7)
{
- okim6295_set_bank_base(1, 0x40000 * data );
+ okim6295_set_bank_base(device, 0x40000 * data );
// logerror("CPU #0 PC %06X : OKI1 bank %08X\n",cpu_get_pc(space->cpu),data);
}
}
@@ -517,8 +503,8 @@ static ADDRESS_MAP_START( bloodwar, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x600000, 0x60001f) AM_RAM_WRITE(kaneko16_layers_0_regs_w) AM_BASE(&kaneko16_layers_0_regs) // Layers 0 Regs
AM_RANGE(0x680000, 0x68001f) AM_RAM_WRITE(kaneko16_layers_1_regs_w) AM_BASE(&kaneko16_layers_1_regs) // Layers 1 Regs
AM_RANGE(0x700000, 0x70001f) AM_RAM_WRITE(kaneko16_sprites_regs_w) AM_BASE(&kaneko16_sprites_regs) // Sprites Regs
- AM_RANGE(0x800000, 0x800001) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
- AM_RANGE(0x880000, 0x880001) AM_READWRITE(okim6295_status_1_lsb_r, okim6295_data_1_lsb_w)
+ AM_RANGE(0x800000, 0x800001) AM_DEVREADWRITE8(SOUND, "oki1", okim6295_r, okim6295_w, 0x00ff)
+ AM_RANGE(0x880000, 0x880001) AM_DEVREADWRITE8(SOUND, "oki2", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x900000, 0x900039) AM_READWRITE(bloodwar_calc_r, bloodwar_calc_w)
AM_RANGE(0xa00000, 0xa00001) AM_READWRITE(watchdog_reset16_r, watchdog_reset16_w) // Watchdog
AM_RANGE(0xb00000, 0xb00001) AM_READ_PORT("P1")
@@ -528,8 +514,8 @@ static ADDRESS_MAP_START( bloodwar, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xb80000, 0xb80001) AM_WRITE(bloodwar_coin_lockout_w) // Coin Lockout
AM_RANGE(0xc00000, 0xc00001) AM_WRITE(kaneko16_display_enable)
AM_RANGE(0xd00000, 0xd00001) AM_READ(toybox_mcu_status_r)
- AM_RANGE(0xe00000, 0xe00001) AM_WRITE(bloodwar_oki_0_bank_w)
- AM_RANGE(0xe80000, 0xe80001) AM_WRITE(bloodwar_oki_1_bank_w)
+ AM_RANGE(0xe00000, 0xe00001) AM_DEVWRITE(SOUND, "oki1", bloodwar_oki_0_bank_w)
+ AM_RANGE(0xe80000, 0xe80001) AM_DEVWRITE(SOUND, "oki2", bloodwar_oki_1_bank_w)
ADDRESS_MAP_END
@@ -537,21 +523,21 @@ ADDRESS_MAP_END
Bonk's Adventure
***************************************************************************/
-static WRITE16_HANDLER( bonkadv_oki_0_bank_w )
+static WRITE16_DEVICE_HANDLER( bonkadv_oki_0_bank_w )
{
if (ACCESSING_BITS_0_7)
{
- okim6295_set_bank_base(0, 0x40000 * (data & 0xF));
- logerror("CPU #0 PC %06X : OKI0 bank %08X\n",cpu_get_pc(space->cpu),data);
+ okim6295_set_bank_base(device, 0x40000 * (data & 0xF));
+ logerror("%s: OKI0 bank %08X\n",cpuexec_describe_context(device->machine),data);
}
}
-static WRITE16_HANDLER( bonkadv_oki_1_bank_w )
+static WRITE16_DEVICE_HANDLER( bonkadv_oki_1_bank_w )
{
if (ACCESSING_BITS_0_7)
{
- okim6295_set_bank_base(1, 0x40000 * data );
- logerror("CPU #0 PC %06X : OKI1 bank %08X\n",cpu_get_pc(space->cpu),data);
+ okim6295_set_bank_base(device, 0x40000 * data );
+ logerror("%s: OKI1 bank %08X\n",cpuexec_describe_context(device->machine),data);
}
}
@@ -577,8 +563,8 @@ static ADDRESS_MAP_START( bonkadv, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x600000, 0x60001f) AM_RAM_WRITE(kaneko16_layers_0_regs_w) AM_BASE(&kaneko16_layers_0_regs) // Layers 0 Regs
AM_RANGE(0x680000, 0x68001f) AM_RAM_WRITE(kaneko16_layers_1_regs_w) AM_BASE(&kaneko16_layers_1_regs) // Layers 1 Regs
AM_RANGE(0x700000, 0x70001f) AM_RAM_WRITE(kaneko16_sprites_regs_w) AM_BASE(&kaneko16_sprites_regs) // Sprites Regs
- AM_RANGE(0x800000, 0x800001) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
- AM_RANGE(0x880000, 0x880001) AM_READWRITE(okim6295_status_1_lsb_r, okim6295_data_1_lsb_w)
+ AM_RANGE(0x800000, 0x800001) AM_DEVREADWRITE8(SOUND, "oki1", okim6295_r, okim6295_w, 0x00ff)
+ AM_RANGE(0x880000, 0x880001) AM_DEVREADWRITE8(SOUND, "oki2", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x900000, 0x900015) AM_READWRITE(galpanib_calc_r,galpanib_calc_w)
AM_RANGE(0xa00000, 0xa00001) AM_READWRITE(watchdog_reset16_r, watchdog_reset16_w) // Watchdog
AM_RANGE(0xb00000, 0xb00001) AM_READ_PORT("P1")
@@ -588,8 +574,8 @@ static ADDRESS_MAP_START( bonkadv, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xb80000, 0xb80001) AM_WRITE(bloodwar_coin_lockout_w) // Coin Lockout
AM_RANGE(0xc00000, 0xc00001) AM_WRITE(kaneko16_display_enable)
AM_RANGE(0xd00000, 0xd00001) AM_READ(toybox_mcu_status_r)
- AM_RANGE(0xe00000, 0xe00001) AM_WRITE(bonkadv_oki_0_bank_w)
- AM_RANGE(0xe80000, 0xe80001) AM_WRITE(bonkadv_oki_1_bank_w)
+ AM_RANGE(0xe00000, 0xe00001) AM_DEVWRITE(SOUND, "oki1", bonkadv_oki_0_bank_w)
+ AM_RANGE(0xe80000, 0xe80001) AM_DEVWRITE(SOUND, "oki2", bonkadv_oki_1_bank_w)
ADDRESS_MAP_END
@@ -612,42 +598,24 @@ static READ16_HANDLER( gtmr_wheel_r )
}
}
-static WRITE16_HANDLER( gtmr_oki_0_bank_w )
+static WRITE16_DEVICE_HANDLER( gtmr_oki_0_bank_w )
{
if (ACCESSING_BITS_0_7)
{
- okim6295_set_bank_base(0, 0x40000 * (data & 0xF) );
+ okim6295_set_bank_base(device, 0x40000 * (data & 0xF) );
// logerror("CPU #0 PC %06X : OKI0 bank %08X\n",cpu_get_pc(space->cpu),data);
}
}
-static WRITE16_HANDLER( gtmr_oki_1_bank_w )
+static WRITE16_DEVICE_HANDLER( gtmr_oki_1_bank_w )
{
if (ACCESSING_BITS_0_7)
{
- okim6295_set_bank_base(1, 0x40000 * (data & 0x1) );
+ okim6295_set_bank_base(device, 0x40000 * (data & 0x1) );
// logerror("CPU #0 PC %06X : OKI1 bank %08X\n",cpu_get_pc(space->cpu),data);
}
}
-static WRITE16_HANDLER( gtmr_oki_0_data_w )
-{
- if (ACCESSING_BITS_0_7)
- {
- okim6295_data_0_w(space,0,data);
-// logerror("CPU #0 PC %06X : OKI0 <- %08X\n",cpu_get_pc(space->cpu),data);
- }
-}
-
-static WRITE16_HANDLER( gtmr_oki_1_data_w )
-{
- if (ACCESSING_BITS_0_7)
- {
- okim6295_data_1_w(space,0,data);
-// logerror("CPU #0 PC %06X : OKI1 <- %08X\n",cpu_get_pc(space->cpu),data);
- }
-}
-
static ADDRESS_MAP_START( gtmr_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0ffffd) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0x0ffffe, 0x0fffff) AM_READ(gtmr_wheel_r ) // Wheel Value
@@ -661,8 +629,8 @@ static ADDRESS_MAP_START( gtmr_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x600000, 0x60000f) AM_READ(SMH_RAM ) // Layers 0 Regs
AM_RANGE(0x680000, 0x68000f) AM_READ(SMH_RAM ) // Layers 1 Regs
AM_RANGE(0x700000, 0x70001f) AM_READ(kaneko16_sprites_regs_r ) // Sprites Regs
- AM_RANGE(0x800000, 0x800001) AM_READ(okim6295_status_0_lsb_r ) // Samples
- AM_RANGE(0x880000, 0x880001) AM_READ(okim6295_status_1_lsb_r )
+ AM_RANGE(0x800000, 0x800001) AM_DEVREAD8(SOUND, "oki1", okim6295_r, 0x00ff ) // Samples
+ AM_RANGE(0x880000, 0x880001) AM_DEVREAD8(SOUND, "oki2", okim6295_r, 0x00ff )
AM_RANGE(0x900014, 0x900015) AM_READ(kaneko16_rnd_r ) // Random Number ?
AM_RANGE(0xa00000, 0xa00001) AM_READ(watchdog_reset16_r ) // Watchdog
AM_RANGE(0xb00000, 0xb00001) AM_READ_PORT("P1")
@@ -694,13 +662,13 @@ static ADDRESS_MAP_START( gtmr_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x600000, 0x60000f) AM_WRITE(kaneko16_layers_0_regs_w) AM_BASE(&kaneko16_layers_0_regs ) // Layers 0 Regs
AM_RANGE(0x680000, 0x68000f) AM_WRITE(kaneko16_layers_1_regs_w) AM_BASE(&kaneko16_layers_1_regs ) // Layers 1 Regs
AM_RANGE(0x700000, 0x70001f) AM_WRITE(kaneko16_sprites_regs_w) AM_BASE(&kaneko16_sprites_regs ) // Sprites Regs
- AM_RANGE(0x800000, 0x800001) AM_WRITE(gtmr_oki_0_data_w ) // Samples
- AM_RANGE(0x880000, 0x880001) AM_WRITE(gtmr_oki_1_data_w )
+ AM_RANGE(0x800000, 0x800001) AM_DEVWRITE8(SOUND, "oki1", okim6295_w, 0x00ff ) // Samples
+ AM_RANGE(0x880000, 0x880001) AM_DEVWRITE8(SOUND, "oki2", okim6295_w, 0x00ff )
AM_RANGE(0xa00000, 0xa00001) AM_WRITE(watchdog_reset16_w ) // Watchdog
AM_RANGE(0xb80000, 0xb80001) AM_WRITE(kaneko16_coin_lockout_w ) // Coin Lockout
AM_RANGE(0xc00000, 0xc00001) AM_WRITE(kaneko16_display_enable ) // might do more than that
- AM_RANGE(0xe00000, 0xe00001) AM_WRITE(gtmr_oki_0_bank_w ) // Samples Bankswitching
- AM_RANGE(0xe80000, 0xe80001) AM_WRITE(gtmr_oki_1_bank_w )
+ AM_RANGE(0xe00000, 0xe00001) AM_DEVWRITE(SOUND, "oki1", gtmr_oki_0_bank_w ) // Samples Bankswitching
+ AM_RANGE(0xe80000, 0xe80001) AM_DEVWRITE(SOUND, "oki2", gtmr_oki_1_bank_w )
ADDRESS_MAP_END
@@ -743,8 +711,8 @@ static ADDRESS_MAP_START( gtmr2_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x600000, 0x60000f) AM_READ(SMH_RAM ) // Layers 0 Regs
AM_RANGE(0x680000, 0x68000f) AM_READ(SMH_RAM ) // Layers 1 Regs
AM_RANGE(0x700000, 0x70001f) AM_READ(kaneko16_sprites_regs_r ) // Sprites Regs
- AM_RANGE(0x800000, 0x800001) AM_READ(okim6295_status_0_lsb_r ) // Samples
- AM_RANGE(0x880000, 0x880001) AM_READ(okim6295_status_1_lsb_r )
+ AM_RANGE(0x800000, 0x800001) AM_DEVREAD8(SOUND, "oki1", okim6295_r, 0x00ff ) // Samples
+ AM_RANGE(0x880000, 0x880001) AM_DEVREAD8(SOUND, "oki2", okim6295_r, 0x00ff )
AM_RANGE(0x900014, 0x900015) AM_READ(kaneko16_rnd_r ) // Random Number ?
AM_RANGE(0xa00000, 0xa00001) AM_READ(watchdog_reset16_r ) // Watchdog
AM_RANGE(0xb00000, 0xb00001) AM_READ_PORT("P1")
@@ -763,9 +731,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( mgcrystl, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_ROM // ROM
AM_RANGE(0x300000, 0x30ffff) AM_RAM // Work RAM
- AM_RANGE(0x400000, 0x40001f) AM_READWRITE(kaneko16_YM2149_0_r, kaneko16_YM2149_0_w) // Sound
- AM_RANGE(0x400200, 0x40021f) AM_READWRITE(kaneko16_YM2149_1_r, kaneko16_YM2149_1_w)
- AM_RANGE(0x400400, 0x400401) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x400000, 0x40001f) AM_DEVREADWRITE(SOUND, "ay1", kaneko16_YM2149_r, kaneko16_YM2149_w) // Sound
+ AM_RANGE(0x400200, 0x40021f) AM_DEVREADWRITE(SOUND, "ay2", kaneko16_YM2149_r, kaneko16_YM2149_w)
+ AM_RANGE(0x400400, 0x400401) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x500000, 0x500fff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_BASE(&paletteram16) // Palette
AM_RANGE(0x600000, 0x600fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE(&kaneko16_vram_1) // Layers 0
AM_RANGE(0x601000, 0x601fff) AM_RAM_WRITE(kaneko16_vram_0_w) AM_BASE(&kaneko16_vram_0) //
@@ -797,8 +765,8 @@ static WRITE16_HANDLER( shogwarr_oki_bank_w )
{
if (ACCESSING_BITS_0_7)
{
- okim6295_set_bank_base(0, 0x10000 * ((data >> 0) & 0x3) );
- okim6295_set_bank_base(1, 0x10000 * ((data >> 4) & 0x3) );
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki1"), 0x10000 * ((data >> 0) & 0x3) );
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki2"), 0x10000 * ((data >> 4) & 0x3) );
}
}
@@ -811,8 +779,8 @@ static ADDRESS_MAP_START( shogwarr, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x2b0000, 0x2b0001) AM_WRITE(calc3_mcu_com2_w)
AM_RANGE(0x2d0000, 0x2d0001) AM_WRITE(calc3_mcu_com3_w)
AM_RANGE(0x380000, 0x380fff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_BASE(&paletteram16) // Palette
- AM_RANGE(0x400000, 0x400001) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w) // Samples
- AM_RANGE(0x480000, 0x480001) AM_READWRITE(okim6295_status_1_lsb_r, okim6295_data_1_lsb_w)
+ AM_RANGE(0x400000, 0x400001) AM_DEVREADWRITE8(SOUND, "oki1", okim6295_r, okim6295_w, 0x00ff) // Samples
+ AM_RANGE(0x480000, 0x480001) AM_DEVREADWRITE8(SOUND, "oki2", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x580000, 0x581fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) // Sprites
AM_RANGE(0x600000, 0x600fff) AM_RAM_WRITE(kaneko16_vram_1_w) AM_BASE(&kaneko16_vram_1) // Layers 0
AM_RANGE(0x601000, 0x601fff) AM_READWRITE(SMH_RAM,kaneko16_vram_0_w) AM_BASE(&kaneko16_vram_0)
@@ -850,8 +818,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( blazeon_soundport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x02, 0x02) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x03, 0x03) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x02, 0x03) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x06, 0x06) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -1644,20 +1611,20 @@ static const ay8910_interface ay8910_intf_dsw =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_4_r, /* input A: DSW 1 */
- input_port_5_r, /* input B: DSW 2 */
- NULL,
- NULL,
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_NULL,
+ DEVCB_NULL,
};
static const ay8910_interface ay8910_intf_eeprom =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- kaneko16_eeprom_r, /* inputs A: 0,EEPROM bit read */
- NULL, /* inputs B */
- NULL, /* outputs A */
- kaneko16_eeprom_reset_w /* outputs B: 0,EEPROM reset */
+ DEVCB_HANDLER(kaneko16_eeprom_r), /* inputs A: 0,EEPROM bit read */
+ DEVCB_NULL, /* inputs B */
+ DEVCB_NULL, /* outputs A */
+ DEVCB_HANDLER(kaneko16_eeprom_reset_w) /* outputs B: 0,EEPROM reset */
};
diff --git a/src/mame/drivers/kangaroo.c b/src/mame/drivers/kangaroo.c
index d4e852abf4b..6a1004327a5 100644
--- a/src/mame/drivers/kangaroo.c
+++ b/src/mame/drivers/kangaroo.c
@@ -275,18 +275,18 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_ROM
AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x0c00) AM_RAM
AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x0fff) AM_READ(soundlatch_r)
- AM_RANGE(0x7000, 0x7000) AM_MIRROR(0x0fff) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x0fff) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x7000, 0x7000) AM_MIRROR(0x0fff) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
+ AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x0fff) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
ADDRESS_MAP_END
-/* yes, this is indentical */
+/* yes, this is identical */
static ADDRESS_MAP_START( sound_portmap, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x0000, 0x0fff) AM_ROM
AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x0c00) AM_RAM
AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x0fff) AM_READ(soundlatch_r)
- AM_RANGE(0x7000, 0x7000) AM_MIRROR(0x0fff) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x0fff) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x7000, 0x7000) AM_MIRROR(0x0fff) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
+ AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x0fff) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/karnov.c b/src/mame/drivers/karnov.c
index 43ec2afcdfa..da9cfc108cf 100644
--- a/src/mame/drivers/karnov.c
+++ b/src/mame/drivers/karnov.c
@@ -41,7 +41,7 @@
#include "cpu/m68000/m68000.h"
#include "cpu/m6502/m6502.h"
#include "sound/2203intf.h"
-#include "sound/3812intf.h"
+#include "sound/3526intf.h"
PALETTE_INIT( karnov );
VIDEO_UPDATE( karnov );
@@ -370,10 +370,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( karnov_s_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x05ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x1000, 0x1000) AM_WRITE(ym2203_control_port_0_w) /* OPN */
- AM_RANGE(0x1001, 0x1001) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0x1800, 0x1800) AM_WRITE(ym3526_control_port_0_w) /* OPL */
- AM_RANGE(0x1801, 0x1801) AM_WRITE(ym3526_write_port_0_w)
+ AM_RANGE(0x1000, 0x1001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x1800, 0x1801) AM_DEVWRITE(SOUND, "ym2", ym3526_w)
AM_RANGE(0x8000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
@@ -690,9 +688,9 @@ static INTERRUPT_GEN( karnov_interrupt )
cpu_set_input_line(device,7,HOLD_LINE); /* VBL */
}
-static void sound_irq(running_machine *machine, int linestate)
+static void sound_irq(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1],0,linestate); /* IRQ */
+ cpu_set_input_line(device->machine->cpu[1],0,linestate); /* IRQ */
}
static const ym3526_interface ym3526_config =
diff --git a/src/mame/drivers/kchamp.c b/src/mame/drivers/kchamp.c
index e96ee1ff0ba..fd05c072daa 100644
--- a/src/mame/drivers/kchamp.c
+++ b/src/mame/drivers/kchamp.c
@@ -121,8 +121,8 @@ static WRITE8_HANDLER( sound_reset_w ) {
cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, PULSE_LINE);
}
-static WRITE8_HANDLER( sound_control_w ) {
- msm5205_reset_w( 0, !( data & 1 ) );
+static WRITE8_DEVICE_HANDLER( sound_control_w ) {
+ msm5205_reset_w( device, !( data & 1 ) );
sound_nmi_enable = ( ( data >> 1 ) & 1 );
}
@@ -151,12 +151,11 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(soundlatch_r, ay8910_control_port_0_w)
- AM_RANGE(0x02, 0x02) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay1", ay8910_data_address_w)
+ AM_RANGE(0x01, 0x01) AM_READ(soundlatch_r)
+ AM_RANGE(0x02, 0x03) AM_DEVWRITE(SOUND, "ay2", ay8910_data_address_w)
AM_RANGE(0x04, 0x04) AM_WRITE(sound_msm_w)
- AM_RANGE(0x05, 0x05) AM_WRITE(sound_control_w)
+ AM_RANGE(0x05, 0x05) AM_DEVWRITE(SOUND, "msm", sound_control_w)
ADDRESS_MAP_END
/********************
@@ -215,11 +214,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( kc_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x02, 0x02) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x04, 0x04) AM_WRITE(dac_0_data_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay1", ay8910_data_address_w)
+ AM_RANGE(0x02, 0x03) AM_DEVWRITE(SOUND, "ay2", ay8910_data_address_w)
+ AM_RANGE(0x04, 0x04) AM_DEVWRITE(SOUND, "dac", dac_w)
AM_RANGE(0x05, 0x05) AM_WRITE(kc_sound_control_w)
AM_RANGE(0x06, 0x06) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -385,9 +382,9 @@ static void msmint(const device_config *device) {
static int counter = 0;
if ( msm_play_lo_nibble )
- msm5205_data_w( 0, msm_data & 0x0f );
+ msm5205_data_w( device, msm_data & 0x0f );
else
- msm5205_data_w( 0, ( msm_data >> 4 ) & 0x0f );
+ msm5205_data_w( device, ( msm_data >> 4 ) & 0x0f );
msm_play_lo_nibble ^= 1;
diff --git a/src/mame/drivers/kickgoal.c b/src/mame/drivers/kickgoal.c
index c1140a444b5..917b3afa3b8 100644
--- a/src/mame/drivers/kickgoal.c
+++ b/src/mame/drivers/kickgoal.c
@@ -129,9 +129,9 @@ VIDEO_UPDATE( actionhw );
#ifdef UNUSED_FUNCTION
-static void kickgoal_play(int melody, int data)
+static void kickgoal_play(const device_config *device, int melody, int data)
{
- int status = okim6295_status_0_r(0);
+ int status = okim6295_r(device,0);
logerror("Playing sample %01x:%02x from command %02x\n",kickgoal_snd_bank,kickgoal_sound,data);
if (kickgoal_sound == 0) popmessage("Unknown sound command %02x",kickgoal_sound);
@@ -141,35 +141,35 @@ static void kickgoal_play(int melody, int data)
kickgoal_melody = kickgoal_sound;
kickgoal_melody_loop = kickgoal_sound;
if (status & 0x08)
- okim6295_data_0_w(0,0x40);
- okim6295_data_0_w(0,(0x80 | kickgoal_melody));
- okim6295_data_0_w(0,0x81);
+ okim6295_w(device,0,0x40);
+ okim6295_w(device,0,(0x80 | kickgoal_melody));
+ okim6295_w(device,0,0x81);
}
}
else {
if ((status & 0x01) == 0) {
- okim6295_data_0_w(0,(0x80 | kickgoal_sound));
- okim6295_data_0_w(0,0x11);
+ okim6295_w(device,0,(0x80 | kickgoal_sound));
+ okim6295_w(device,0,0x11);
}
else if ((status & 0x02) == 0) {
- okim6295_data_0_w(0,(0x80 | kickgoal_sound));
- okim6295_data_0_w(0,0x21);
+ okim6295_w(device,0,(0x80 | kickgoal_sound));
+ okim6295_w(device,0,0x21);
}
else if ((status & 0x04) == 0) {
- okim6295_data_0_w(0,(0x80 | kickgoal_sound));
- okim6295_data_0_w(0,0x41);
+ okim6295_w(device,0,(0x80 | kickgoal_sound));
+ okim6295_w(device,0,0x41);
}
}
}
-WRITE16_HANDLER( kickgoal_snd_w )
+WRITE16_DEVICE_HANDLER( kickgoal_snd_w )
{
if (ACCESSING_BITS_0_7)
{
logerror("PC:%06x Writing %04x to Sound CPU\n",cpu_get_previouspc(space->cpu),data);
if (data >= 0x40) {
if (data == 0xfe) {
- okim6295_data_0_w(0,0x40); /* Stop playing the melody */
+ okim6295_w(device,0,0x40); /* Stop playing the melody */
kickgoal_melody = 0x00;
kickgoal_melody_loop = 0x00;
}
@@ -178,56 +178,56 @@ WRITE16_HANDLER( kickgoal_snd_w )
}
}
else if (data == 0) {
- okim6295_data_0_w(0,0x38); /* Stop playing effects */
+ okim6295_w(device,0,0x38); /* Stop playing effects */
}
else {
kickgoal_sound = kickgoal_cmd_snd[data];
if (kickgoal_sound >= 0x70) {
if (kickgoal_snd_bank != 1)
- okim6295_set_bank_base(0, (1 * 0x40000));
+ okim6295_set_bank_base(device, (1 * 0x40000));
kickgoal_snd_bank = 1;
- kickgoal_play(0, data);
+ kickgoal_play(device, 0, data);
}
else if (kickgoal_sound >= 0x69) {
if (kickgoal_snd_bank != 2)
- okim6295_set_bank_base(0, (2 * 0x40000));
+ okim6295_set_bank_base(device, (2 * 0x40000));
kickgoal_snd_bank = 2;
- kickgoal_play(4, data);
+ kickgoal_play(device, 4, data);
}
else if (kickgoal_sound >= 0x65) {
if (kickgoal_snd_bank != 1)
- okim6295_set_bank_base(0, (1 * 0x40000));
+ okim6295_set_bank_base(device, (1 * 0x40000));
kickgoal_snd_bank = 1;
- kickgoal_play(4, data);
+ kickgoal_play(device, 4, data);
}
else if (kickgoal_sound >= 0x60) {
kickgoal_snd_bank = 0;
- okim6295_set_bank_base(0, (0 * 0x40000));
+ okim6295_set_bank_base(device, (0 * 0x40000));
kickgoal_snd_bank = 0;
- kickgoal_play(4, data);
+ kickgoal_play(device, 4, data);
}
else {
- kickgoal_play(0, data);
+ kickgoal_play(device, 0, data);
}
}
}
}
#endif
-static WRITE16_HANDLER( actionhw_snd_w )
+static WRITE16_DEVICE_HANDLER( actionhw_snd_w )
{
- logerror("PC:%06x Writing %04x to Sound CPU - mask %04x\n",cpu_get_previouspc(space->cpu),data,mem_mask);
+ logerror("%s: Writing %04x to Sound CPU - mask %04x\n",cpuexec_describe_context(device->machine),data,mem_mask);
if (!ACCESSING_BITS_0_7) data >>= 8;
switch (data)
{
- case 0xfc: okim6295_set_bank_base(0, (0 * 0x40000)); break;
- case 0xfd: okim6295_set_bank_base(0, (2 * 0x40000)); break;
- case 0xfe: okim6295_set_bank_base(0, (1 * 0x40000)); break;
- case 0xff: okim6295_set_bank_base(0, (3 * 0x40000)); break;
- case 0x78: okim6295_data_0_w(space,0,data);
+ case 0xfc: okim6295_set_bank_base(device, (0 * 0x40000)); break;
+ case 0xfd: okim6295_set_bank_base(device, (2 * 0x40000)); break;
+ case 0xfe: okim6295_set_bank_base(device, (1 * 0x40000)); break;
+ case 0xff: okim6295_set_bank_base(device, (3 * 0x40000)); break;
+ case 0x78: okim6295_w(device,0,data);
snd_sam[0]=00; snd_sam[1]=00; snd_sam[2]=00; snd_sam[3]=00;
break;
default: if (snd_new) /* Play new sample */
@@ -235,44 +235,44 @@ static WRITE16_HANDLER( actionhw_snd_w )
if ((data & 0x80) && (snd_sam[3] != snd_new))
{
logerror("About to play sample %02x at vol %02x\n",snd_new,data);
- if ((okim6295_status_0_r(space,0) & 0x08) != 0x08)
+ if ((okim6295_r(device,0) & 0x08) != 0x08)
{
logerror("Playing sample %02x at vol %02x\n",snd_new,data);
- okim6295_data_0_w(space,0,snd_new);
- okim6295_data_0_w(space,0,data);
+ okim6295_w(device,0,snd_new);
+ okim6295_w(device,0,data);
}
snd_new = 00;
}
if ((data & 0x40) && (snd_sam[2] != snd_new))
{
logerror("About to play sample %02x at vol %02x\n",snd_new,data);
- if ((okim6295_status_0_r(space,0) & 0x04) != 0x04)
+ if ((okim6295_r(device,0) & 0x04) != 0x04)
{
logerror("Playing sample %02x at vol %02x\n",snd_new,data);
- okim6295_data_0_w(space,0,snd_new);
- okim6295_data_0_w(space,0,data);
+ okim6295_w(device,0,snd_new);
+ okim6295_w(device,0,data);
}
snd_new = 00;
}
if ((data & 0x20) && (snd_sam[1] != snd_new))
{
logerror("About to play sample %02x at vol %02x\n",snd_new,data);
- if ((okim6295_status_0_r(space,0) & 0x02) != 0x02)
+ if ((okim6295_r(device,0) & 0x02) != 0x02)
{
logerror("Playing sample %02x at vol %02x\n",snd_new,data);
- okim6295_data_0_w(space,0,snd_new);
- okim6295_data_0_w(space,0,data);
+ okim6295_w(device,0,snd_new);
+ okim6295_w(device,0,data);
}
snd_new = 00;
}
if ((data & 0x10) && (snd_sam[0] != snd_new))
{
logerror("About to play sample %02x at vol %02x\n",snd_new,data);
- if ((okim6295_status_0_r(space,0) & 0x01) != 0x01)
+ if ((okim6295_r(device,0) & 0x01) != 0x01)
{
logerror("Playing sample %02x at vol %02x\n",snd_new,data);
- okim6295_data_0_w(space,0,snd_new);
- okim6295_data_0_w(space,0,data);
+ okim6295_w(device,0,snd_new);
+ okim6295_w(device,0,data);
}
snd_new = 00;
}
@@ -287,7 +287,7 @@ static WRITE16_HANDLER( actionhw_snd_w )
else /* Turn a channel off */
{
logerror("Turning channel %02x off\n",data);
- okim6295_data_0_w(space,0,data);
+ okim6295_w(device,0,data);
if (data & 0x40) snd_sam[3] = 00;
if (data & 0x20) snd_sam[2] = 00;
if (data & 0x10) snd_sam[1] = 00;
@@ -306,9 +306,9 @@ static int m6295_bank;
static UINT16 m6295_key_delay;
static INTERRUPT_GEN( kickgoal_interrupt )
{
- const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const device_config *adpcm = devtag_get_device(device->machine, SOUND, "oki");
- if ((okim6295_status_0_r(space,0) & 0x08) == 0)
+ if ((okim6295_r(adpcm,0) & 0x08) == 0)
{
switch(kickgoal_melody_loop)
{
@@ -337,8 +337,8 @@ static INTERRUPT_GEN( kickgoal_interrupt )
if (kickgoal_melody_loop)
{
// logerror("Changing to sample %02x\n",kickgoal_melody_loop);
- okim6295_data_0_w(space,0,((0x80 | kickgoal_melody_loop) & 0xff));
- okim6295_data_0_w(space,0,0x81);
+ okim6295_w(adpcm,0,((0x80 | kickgoal_melody_loop) & 0xff));
+ okim6295_w(adpcm,0,0x81);
}
}
if ( input_code_pressed_once(KEYCODE_PGUP) )
@@ -349,7 +349,7 @@ static INTERRUPT_GEN( kickgoal_interrupt )
m6295_bank &= 0x03;
if (m6295_bank == 0x03) m6295_bank = 0x00;
popmessage("Changing Bank to %02x",m6295_bank);
- okim6295_set_bank_base(0, ((m6295_bank) * 0x40000));
+ okim6295_set_bank_base(adpcm, ((m6295_bank) * 0x40000));
if (m6295_key_delay == 0xffff) m6295_key_delay = 0x00;
else m6295_key_delay = (0x30 * oki_time_base);
@@ -365,7 +365,7 @@ static INTERRUPT_GEN( kickgoal_interrupt )
m6295_bank &= 0x03;
if (m6295_bank == 0x03) m6295_bank = 0x02;
popmessage("Changing Bank to %02x",m6295_bank);
- okim6295_set_bank_base(0, ((m6295_bank) * 0x40000));
+ okim6295_set_bank_base(adpcm, ((m6295_bank) * 0x40000));
if (m6295_key_delay == 0xffff) m6295_key_delay = 0x00;
else m6295_key_delay = (0x30 * oki_time_base);
@@ -379,11 +379,11 @@ static INTERRUPT_GEN( kickgoal_interrupt )
{
m6295_comm += 1;
m6295_comm &= 0x7f;
- if (m6295_comm == 0x00) { okim6295_set_bank_base(0, (0 * 0x40000)); m6295_bank = 0; }
- if (m6295_comm == 0x60) { okim6295_set_bank_base(0, (0 * 0x40000)); m6295_bank = 0; }
- if (m6295_comm == 0x65) { okim6295_set_bank_base(0, (1 * 0x40000)); m6295_bank = 1; }
- if (m6295_comm == 0x69) { okim6295_set_bank_base(0, (2 * 0x40000)); m6295_bank = 2; }
- if (m6295_comm == 0x70) { okim6295_set_bank_base(0, (1 * 0x40000)); m6295_bank = 1; }
+ if (m6295_comm == 0x00) { okim6295_set_bank_base(adpcm, (0 * 0x40000)); m6295_bank = 0; }
+ if (m6295_comm == 0x60) { okim6295_set_bank_base(adpcm, (0 * 0x40000)); m6295_bank = 0; }
+ if (m6295_comm == 0x65) { okim6295_set_bank_base(adpcm, (1 * 0x40000)); m6295_bank = 1; }
+ if (m6295_comm == 0x69) { okim6295_set_bank_base(adpcm, (2 * 0x40000)); m6295_bank = 2; }
+ if (m6295_comm == 0x70) { okim6295_set_bank_base(adpcm, (1 * 0x40000)); m6295_bank = 1; }
popmessage("Sound test command %02x on Bank %02x",m6295_comm,m6295_bank);
if (m6295_key_delay == 0xffff) m6295_key_delay = 0x00;
@@ -398,11 +398,11 @@ static INTERRUPT_GEN( kickgoal_interrupt )
{
m6295_comm -= 1;
m6295_comm &= 0x7f;
- if (m6295_comm == 0x2b) { okim6295_set_bank_base(0, (0 * 0x40000)); m6295_bank = 0; }
- if (m6295_comm == 0x64) { okim6295_set_bank_base(0, (0 * 0x40000)); m6295_bank = 0; }
- if (m6295_comm == 0x68) { okim6295_set_bank_base(0, (1 * 0x40000)); m6295_bank = 1; }
- if (m6295_comm == 0x6c) { okim6295_set_bank_base(0, (2 * 0x40000)); m6295_bank = 2; }
- if (m6295_comm == 0x76) { okim6295_set_bank_base(0, (1 * 0x40000)); m6295_bank = 1; }
+ if (m6295_comm == 0x2b) { okim6295_set_bank_base(adpcm, (0 * 0x40000)); m6295_bank = 0; }
+ if (m6295_comm == 0x64) { okim6295_set_bank_base(adpcm, (0 * 0x40000)); m6295_bank = 0; }
+ if (m6295_comm == 0x68) { okim6295_set_bank_base(adpcm, (1 * 0x40000)); m6295_bank = 1; }
+ if (m6295_comm == 0x6c) { okim6295_set_bank_base(adpcm, (2 * 0x40000)); m6295_bank = 2; }
+ if (m6295_comm == 0x76) { okim6295_set_bank_base(adpcm, (1 * 0x40000)); m6295_bank = 1; }
popmessage("Sound test command %02x on Bank %02x",m6295_comm,m6295_bank);
if (m6295_key_delay == 0xffff) m6295_key_delay = 0x00;
@@ -415,9 +415,9 @@ static INTERRUPT_GEN( kickgoal_interrupt )
{
if (m6295_key_delay >= (0x80 * oki_time_base))
{
- okim6295_data_0_w(space,0,0x78);
- okim6295_data_0_w(space,0,(0x80 | m6295_comm));
- okim6295_data_0_w(space,0,0x11);
+ okim6295_w(adpcm,0,0x78);
+ okim6295_w(adpcm,0,(0x80 | m6295_comm));
+ okim6295_w(adpcm,0,0x11);
popmessage("Playing sound %02x on Bank %02x",m6295_comm,m6295_bank);
@@ -500,11 +500,11 @@ static WRITE16_HANDLER( kickgoal_eeprom_w )
static ADDRESS_MAP_START( kickgoal_program_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_ROM
-/// AM_RANGE(0x30001e, 0x30001f) AM_WRITE(kickgoal_snd_w)
+/// AM_RANGE(0x30001e, 0x30001f) AM_DEVWRITE(SOUND, "oki", kickgoal_snd_w)
AM_RANGE(0x800000, 0x800001) AM_READ_PORT("P1_P2")
AM_RANGE(0x800002, 0x800003) AM_READ_PORT("SYSTEM")
/// AM_RANGE(0x800004, 0x800005) AM_WRITE(soundlatch_word_w)
- AM_RANGE(0x800004, 0x800005) AM_WRITE(actionhw_snd_w)
+ AM_RANGE(0x800004, 0x800005) AM_DEVWRITE(SOUND, "oki", actionhw_snd_w)
AM_RANGE(0x900000, 0x900005) AM_WRITE(kickgoal_eeprom_w)
AM_RANGE(0x900006, 0x900007) AM_READ(kickgoal_eeprom_r)
AM_RANGE(0xa00000, 0xa03fff) AM_RAM_WRITE(kickgoal_fgram_w) AM_BASE(&kickgoal_fgram) /* FG Layer */
diff --git a/src/mame/drivers/kingobox.c b/src/mame/drivers/kingobox.c
index 7714adc20b4..e6e2126c04a 100644
--- a/src/mame/drivers/kingobox.c
+++ b/src/mame/drivers/kingobox.c
@@ -156,9 +156,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(dac_0_data_w)
- AM_RANGE(0x08, 0x08) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x0c, 0x0c) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x00, 0x00) AM_DEVWRITE(SOUND, "dac", dac_w)
+ AM_RANGE(0x08, 0x08) AM_DEVREADWRITE(SOUND, "ay", ay8910_r, ay8910_data_w)
+ AM_RANGE(0x0c, 0x0c) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
ADDRESS_MAP_END
/* Ring King */
@@ -227,9 +227,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( rk_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(dac_0_data_w)
- AM_RANGE(0x02, 0x02) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x00, 0x00) AM_DEVWRITE(SOUND, "dac", dac_w)
+ AM_RANGE(0x02, 0x02) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x02, 0x03) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
ADDRESS_MAP_END
@@ -531,7 +531,7 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r)
};
static INTERRUPT_GEN( kingofb_interrupt ) {
diff --git a/src/mame/drivers/klax.c b/src/mame/drivers/klax.c
index a20fd739e23..546b5a7acc0 100644
--- a/src/mame/drivers/klax.c
+++ b/src/mame/drivers/klax.c
@@ -70,26 +70,6 @@ static MACHINE_RESET( klax )
/*************************************
*
- * Sound I/O
- *
- *************************************/
-
-static READ16_HANDLER( adpcm_r )
-{
- return okim6295_status_0_r(space, offset) | 0xff00;
-}
-
-
-static WRITE16_HANDLER( adpcm_w )
-{
- if (ACCESSING_BITS_0_7)
- okim6295_data_0_w(space, offset, data & 0xff);
-}
-
-
-
-/*************************************
- *
* Main CPU memory handlers
*
*************************************/
@@ -99,7 +79,7 @@ static ADDRESS_MAP_START( main_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x0e0000, 0x0e0fff) AM_READ(atarigen_eeprom_r)
AM_RANGE(0x260000, 0x260001) AM_READ_PORT("P1")
AM_RANGE(0x260002, 0x260003) AM_READ_PORT("P2")
- AM_RANGE(0x270000, 0x270001) AM_READ(adpcm_r)
+ AM_RANGE(0x270000, 0x270001) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff)
AM_RANGE(0x3e0000, 0x3e07ff) AM_READ(SMH_RAM)
AM_RANGE(0x3f0000, 0x3f3fff) AM_READ(SMH_RAM)
ADDRESS_MAP_END
@@ -110,7 +90,7 @@ static ADDRESS_MAP_START( main_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x0e0000, 0x0e0fff) AM_WRITE(atarigen_eeprom_w) AM_BASE(&atarigen_eeprom) AM_SIZE(&atarigen_eeprom_size)
AM_RANGE(0x1f0000, 0x1fffff) AM_WRITE(atarigen_eeprom_enable_w)
AM_RANGE(0x260000, 0x260001) AM_WRITE(klax_latch_w)
- AM_RANGE(0x270000, 0x270001) AM_WRITE(adpcm_w)
+ AM_RANGE(0x270000, 0x270001) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff)
AM_RANGE(0x2e0000, 0x2e0001) AM_WRITE(watchdog_reset16_w)
AM_RANGE(0x360000, 0x360001) AM_WRITE(interrupt_ack_w)
AM_RANGE(0x3e0000, 0x3e07ff) AM_WRITE(atarigen_expanded_666_paletteram_w) AM_BASE(&paletteram16)
diff --git a/src/mame/drivers/kncljoe.c b/src/mame/drivers/kncljoe.c
index 8ba5d1773d8..8cd8edbbc02 100644
--- a/src/mame/drivers/kncljoe.c
+++ b/src/mame/drivers/kncljoe.c
@@ -64,48 +64,40 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xd804, 0xd804) AM_READ_PORT("DSWB")
AM_RANGE(0xd800, 0xd800) AM_WRITE(sound_cmd_w)
AM_RANGE(0xd801, 0xd801) AM_WRITE(kncljoe_control_w)
- AM_RANGE(0xd802, 0xd802) AM_WRITE(sn76496_0_w)
- AM_RANGE(0xd803, 0xd803) AM_WRITE(sn76496_1_w)
+ AM_RANGE(0xd802, 0xd802) AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0xd803, 0xd803) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
AM_RANGE(0xd807, 0xd807) AM_READ(SMH_NOP) /* unknown read */
AM_RANGE(0xd817, 0xd817) AM_READ(SMH_NOP) /* unknown read */
AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0xf000, 0xffff) AM_RAM
ADDRESS_MAP_END
-static WRITE8_HANDLER( m6803_port1_w )
+static WRITE8_DEVICE_HANDLER( m6803_port1_w )
{
port1 = data;
}
-static WRITE8_HANDLER( m6803_port2_w )
+static WRITE8_DEVICE_HANDLER( m6803_port2_w )
{
/* write latch */
if ((port2 & 0x01) && !(data & 0x01))
{
/* control or data port? */
- if (port2 & 0x04)
- {
- if (port2 & 0x08)
- ay8910_control_port_0_w(space, 0, port1);
- }
- else
- {
- if (port2 & 0x08)
- ay8910_write_port_0_w(space, 0, port1);
- }
+ if (port2 & 0x08)
+ ay8910_data_address_w(device, port2 >> 2, port1);
}
port2 = data;
}
-static READ8_HANDLER( m6803_port1_r )
+static READ8_DEVICE_HANDLER( m6803_port1_r )
{
if (port2 & 0x08)
- return ay8910_read_port_0_r(space, 0);
+ return ay8910_r(device, 0);
return 0xff;
}
-static READ8_HANDLER( m6803_port2_r )
+static READ8_DEVICE_HANDLER( m6803_port2_r )
{
return 0;
}
@@ -115,7 +107,7 @@ static WRITE8_HANDLER( sound_irq_ack_w )
cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE);
}
-static WRITE8_HANDLER(unused_w)
+static WRITE8_DEVICE_HANDLER(unused_w)
{
//unused - no MSM on the pcb
}
@@ -128,8 +120,8 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_portmap, ADDRESS_SPACE_IO, 8 )
- AM_RANGE(M6803_PORT1, M6803_PORT1) AM_READWRITE(m6803_port1_r, m6803_port1_w)
- AM_RANGE(M6803_PORT2, M6803_PORT2) AM_READWRITE(m6803_port2_r, m6803_port2_w)
+ AM_RANGE(M6803_PORT1, M6803_PORT1) AM_DEVREADWRITE(SOUND, "ay", m6803_port1_r, m6803_port1_w)
+ AM_RANGE(M6803_PORT2, M6803_PORT2) AM_DEVREADWRITE(SOUND, "ay", m6803_port2_r, m6803_port2_w)
ADDRESS_MAP_END
@@ -249,10 +241,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r,
- NULL,
- NULL,
- unused_w
+ DEVCB_MEMORY_HANDLER("sound", PROGRAM, soundlatch_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(unused_w)
};
static INTERRUPT_GEN (sound_nmi)
diff --git a/src/mame/drivers/koftball.c b/src/mame/drivers/koftball.c
index 51b41c2d110..b0fedc2f9d1 100644
--- a/src/mame/drivers/koftball.c
+++ b/src/mame/drivers/koftball.c
@@ -148,7 +148,7 @@ static ADDRESS_MAP_START( koftball_mem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x2db000, 0x2db001) AM_WRITE(bmc_RAMDAC_offset_w)
AM_RANGE(0x2db002, 0x2db003) AM_READWRITE(bmc_RAMDAC_color_r, bmc_RAMDAC_color_w)
AM_RANGE(0x2db004, 0x2db005) AM_WRITENOP
- AM_RANGE(0x2dc000, 0x2dc001) AM_READWRITE(okim6295_status_0_msb_r,okim6295_data_0_msb_w)
+ AM_RANGE(0x2dc000, 0x2dc001) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0xff00)
AM_RANGE(0x2f0000, 0x2f0003) AM_READ_PORT("INPUTS")
AM_RANGE(0x300000, 0x300001) AM_WRITENOP
AM_RANGE(0x320000, 0x320001) AM_WRITENOP
diff --git a/src/mame/drivers/koikoi.c b/src/mame/drivers/koikoi.c
index 80896421e58..c10dddd908b 100644
--- a/src/mame/drivers/koikoi.c
+++ b/src/mame/drivers/koikoi.c
@@ -69,7 +69,7 @@ static READ8_HANDLER(vram_r)
return videoram[offset];
}
-static READ8_HANDLER(input_r)
+static READ8_DEVICE_HANDLER(input_r)
{
if(inputcnt<0)
{
@@ -78,7 +78,7 @@ static READ8_HANDLER(input_r)
if(!inputcnt)
{
- int key=input_port_read(space->machine, "IN1");
+ int key=input_port_read(device->machine, "IN1");
int keyval=0; //we must return 0 (0x2 in 2nd read) to clear 4 bit at $6600 and allow next read
if(key)
@@ -103,7 +103,7 @@ static READ8_HANDLER(input_r)
return 0xff; //return 0^0xff
}
-static WRITE8_HANDLER(unknown_w)
+static WRITE8_DEVICE_HANDLER(unknown_w)
{
//unknown... could be input select (player 1 or 2 = fd/fe or ef/df(??) )
}
@@ -137,10 +137,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( readport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x02, 0x02) AM_WRITENOP //unknown , many writes
- AM_RANGE(0x03, 0x03) AM_READ( ay8910_read_port_0_r )
- AM_RANGE(0x07, 0x07) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x06, 0x06) AM_WRITE(ay8910_write_port_0_w)
-
+ AM_RANGE(0x03, 0x03) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x06, 0x07) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
ADDRESS_MAP_END
static INPUT_PORTS_START( koikoi )
@@ -250,8 +248,8 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, input_r,
- unknown_w, NULL
+ DEVCB_NULL, DEVCB_HANDLER(input_r),
+ DEVCB_HANDLER(unknown_w), DEVCB_NULL
};
#define KOIKOI_CRYSTAL 15468000
diff --git a/src/mame/drivers/konamigq.c b/src/mame/drivers/konamigq.c
index b6f40d0c757..5edbd90f67b 100644
--- a/src/mame/drivers/konamigq.c
+++ b/src/mame/drivers/konamigq.c
@@ -220,11 +220,11 @@ static READ16_HANDLER( dual539_r )
data = 0;
if( ACCESSING_BITS_0_7 )
{
- data |= k054539_1_r( space, offset );
+ data |= k054539_r( devtag_get_device(space->machine, SOUND, "konami2"), offset );
}
if( ACCESSING_BITS_8_15 )
{
- data |= k054539_0_r( space, offset ) << 8;
+ data |= k054539_r( devtag_get_device(space->machine, SOUND, "konami1"), offset ) << 8;
}
return data;
}
@@ -233,11 +233,11 @@ static WRITE16_HANDLER( dual539_w )
{
if( ACCESSING_BITS_0_7 )
{
- k054539_1_w( space, offset, data );
+ k054539_w( devtag_get_device(space->machine, SOUND, "konami2"), offset, data );
}
if( ACCESSING_BITS_8_15 )
{
- k054539_0_w( space, offset, data >> 8 );
+ k054539_w( devtag_get_device(space->machine, SOUND, "konami1"), offset, data >> 8 );
}
}
diff --git a/src/mame/drivers/konamigv.c b/src/mame/drivers/konamigv.c
index 7e365f94ef3..cb3a457f988 100644
--- a/src/mame/drivers/konamigv.c
+++ b/src/mame/drivers/konamigv.c
@@ -185,7 +185,7 @@ static ADDRESS_MAP_START( konamigv_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x1f801008, 0x1f80100b) AM_RAM /* ?? */
AM_RANGE(0x1f80100c, 0x1f80102f) AM_WRITENOP
AM_RANGE(0x1f801010, 0x1f801013) AM_READNOP
- AM_RANGE(0x1f801014, 0x1f801017) AM_READ(psx_spu_delay_r)
+ AM_RANGE(0x1f801014, 0x1f801017) AM_DEVREAD(SOUND, "spu", psx_spu_delay_r)
AM_RANGE(0x1f801040, 0x1f80105f) AM_READWRITE(psx_sio_r, psx_sio_w)
AM_RANGE(0x1f801060, 0x1f80106f) AM_WRITENOP
AM_RANGE(0x1f801070, 0x1f801077) AM_READWRITE(psx_irq_r, psx_irq_w)
@@ -193,7 +193,7 @@ static ADDRESS_MAP_START( konamigv_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x1f801100, 0x1f80112f) AM_READWRITE(psx_counter_r, psx_counter_w)
AM_RANGE(0x1f801810, 0x1f801817) AM_READWRITE(psx_gpu_r, psx_gpu_w)
AM_RANGE(0x1f801820, 0x1f801827) AM_READWRITE(psx_mdec_r, psx_mdec_w)
- AM_RANGE(0x1f801c00, 0x1f801dff) AM_READWRITE(psx_spu_r, psx_spu_w)
+ AM_RANGE(0x1f801c00, 0x1f801dff) AM_DEVREADWRITE(SOUND, "spu", psx_spu_r, psx_spu_w)
AM_RANGE(0x1f802020, 0x1f802033) AM_RAM /* ?? */
AM_RANGE(0x1f802040, 0x1f802043) AM_WRITENOP
AM_RANGE(0x1fc00000, 0x1fc7ffff) AM_ROM AM_SHARE(2) AM_REGION("user1", 0) /* bios */
@@ -322,7 +322,7 @@ static MACHINE_RESET( konamigv )
psx_machine_init(machine);
/* also hook up CDDA audio to the CD-ROM drive */
- cdda_set_cdrom(0, am53cf96_get_device(SCSI_ID_4));
+ cdda_set_cdrom(devtag_get_device(machine, SOUND, "cdda"), am53cf96_get_device(SCSI_ID_4));
state_save_register_global_array(machine, sector_buffer);
state_save_register_global(machine, flash_address);
@@ -332,10 +332,15 @@ static MACHINE_RESET( konamigv )
state_save_register_global_array(machine, btc_trackball_data);
}
+static void spu_irq(const device_config *device, UINT32 data)
+{
+ psx_irq_set(device->machine, data);
+}
+
static const psx_spu_interface konamigv_psxspu_interface =
{
&g_p_n_psxram,
- psx_irq_set,
+ spu_irq,
psx_dma_install_read_handler,
psx_dma_install_write_handler
};
diff --git a/src/mame/drivers/konamigx.c b/src/mame/drivers/konamigx.c
index d3ce65b3a54..d06b06422cc 100644
--- a/src/mame/drivers/konamigx.c
+++ b/src/mame/drivers/konamigx.c
@@ -1200,9 +1200,9 @@ static READ16_HANDLER( dual539_r )
UINT16 ret = 0;
if (ACCESSING_BITS_0_7)
- ret |= k054539_1_r(space, offset);
+ ret |= k054539_r(devtag_get_device(space->machine, SOUND, "konami2"), offset);
if (ACCESSING_BITS_8_15)
- ret |= k054539_0_r(space, offset)<<8;
+ ret |= k054539_r(devtag_get_device(space->machine, SOUND, "konami1"), offset)<<8;
return ret;
}
@@ -1210,9 +1210,9 @@ static READ16_HANDLER( dual539_r )
static WRITE16_HANDLER( dual539_w )
{
if (ACCESSING_BITS_0_7)
- k054539_1_w(space, offset, data);
+ k054539_w(devtag_get_device(space->machine, SOUND, "konami2"), offset, data);
if (ACCESSING_BITS_8_15)
- k054539_0_w(space, offset, data>>8);
+ k054539_w(devtag_get_device(space->machine, SOUND, "konami1"), offset, data>>8);
}
static READ16_HANDLER( sndcomm68k_r )
@@ -3312,6 +3312,7 @@ static MACHINE_START( konamigx )
static MACHINE_RESET(konamigx)
{
+ const device_config *k054539_2 = devtag_get_device(machine, SOUND, "konami2");
int i;
konamigx_wrport1_0 = konamigx_wrport1_1 = 0;
@@ -3336,15 +3337,15 @@ static MACHINE_RESET(konamigx)
if (!strcmp(machine->gamedrv->name, "tkmmpzdm"))
{
// boost voice(chip 1 channel 3-7)
- for (i=3; i<=7; i++) k054539_set_gain(1, i, 2.0);
+ for (i=3; i<=7; i++) k054539_set_gain(k054539_2, i, 2.0);
}
else if ((!strcmp(machine->gamedrv->name, "dragoonj")) || (!strcmp(machine->gamedrv->name, "dragoona")))
{
// soften percussions(chip 1 channel 0-3), boost voice(chip 1 channel 4-7)
for (i=0; i<=3; i++)
{
- k054539_set_gain(1, i, 0.8);
- k054539_set_gain(1, i+4, 2.0);
+ k054539_set_gain(k054539_2, i, 0.8);
+ k054539_set_gain(k054539_2, i+4, 2.0);
}
}
}
diff --git a/src/mame/drivers/ksayakyu.c b/src/mame/drivers/ksayakyu.c
index f32a831be37..2973d2c2527 100644
--- a/src/mame/drivers/ksayakyu.c
+++ b/src/mame/drivers/ksayakyu.c
@@ -126,11 +126,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( soundcpu_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x83ff) AM_RAM
- AM_RANGE(0xa001, 0xa001) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0xa002, 0xa002) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xa003, 0xa003) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xa006, 0xa006) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0xa007, 0xa007) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0xa001, 0xa001) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0xa002, 0xa003) AM_DEVWRITE(SOUND, "ay1", ay8910_data_address_w)
+ AM_RANGE(0xa006, 0xa006) AM_DEVWRITE(SOUND, "ay2", ay8910_data_address_w)
AM_RANGE(0xa008, 0xa008) AM_WRITE(SMH_NOP)
AM_RANGE(0xa00c, 0xa00c) AM_WRITE(tomaincpu_w)
AM_RANGE(0xa010, 0xa010) AM_WRITE(SMH_NOP)
@@ -174,7 +172,7 @@ static INPUT_PORTS_START( ksayakyu )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
INPUT_PORTS_END
-static WRITE8_HANDLER(dummy_w)
+static WRITE8_DEVICE_HANDLER(dummy_w)
{
//DAC ? communication with main cpu ?
}
@@ -183,20 +181,20 @@ static const ay8910_interface ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r,
- NULL,
- NULL,
- dummy_w
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(dummy_w)
};
static const ay8910_interface ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- dummy_w,
- dummy_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(dummy_w),
+ DEVCB_HANDLER(dummy_w)
};
static const gfx_layout charlayout =
diff --git a/src/mame/drivers/ksys573.c b/src/mame/drivers/ksys573.c
index 70df0fb2cbb..101388dfa83 100644
--- a/src/mame/drivers/ksys573.c
+++ b/src/mame/drivers/ksys573.c
@@ -1364,7 +1364,7 @@ static ADDRESS_MAP_START( konami573_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x1f801008, 0x1f80100b) AM_RAM /* ?? */
AM_RANGE(0x1f80100c, 0x1f80102f) AM_WRITENOP
AM_RANGE(0x1f801010, 0x1f801013) AM_READNOP
- AM_RANGE(0x1f801014, 0x1f801017) AM_READ(psx_spu_delay_r)
+ AM_RANGE(0x1f801014, 0x1f801017) AM_DEVREAD(SOUND, "spu", psx_spu_delay_r)
AM_RANGE(0x1f801040, 0x1f80105f) AM_READWRITE(psx_sio_r, psx_sio_w)
AM_RANGE(0x1f801060, 0x1f80106f) AM_WRITENOP
AM_RANGE(0x1f801070, 0x1f801077) AM_READWRITE(psx_irq_r, psx_irq_w)
@@ -1372,7 +1372,7 @@ static ADDRESS_MAP_START( konami573_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x1f801100, 0x1f80112f) AM_READWRITE(k573_counter_r, k573_counter_w)
AM_RANGE(0x1f801810, 0x1f801817) AM_READWRITE(psx_gpu_r, psx_gpu_w)
AM_RANGE(0x1f801820, 0x1f801827) AM_READWRITE(psx_mdec_r, psx_mdec_w)
- AM_RANGE(0x1f801c00, 0x1f801dff) AM_READWRITE(psx_spu_r, psx_spu_w)
+ AM_RANGE(0x1f801c00, 0x1f801dff) AM_DEVREADWRITE(SOUND, "spu", psx_spu_r, psx_spu_w)
AM_RANGE(0x1f802020, 0x1f802033) AM_RAM /* ?? */
AM_RANGE(0x1f802040, 0x1f802043) AM_WRITENOP
AM_RANGE(0x1fc00000, 0x1fc7ffff) AM_ROM AM_SHARE(2) AM_REGION("user1", 0) /* bios */
@@ -1587,10 +1587,15 @@ static MACHINE_RESET( konami573 )
flash_bank = -1;
}
+static void spu_irq(const device_config *device, UINT32 data)
+{
+ psx_irq_set(device->machine, data);
+}
+
static const psx_spu_interface konami573_psxspu_interface =
{
&g_p_n_psxram,
- psx_irq_set,
+ spu_irq,
psx_dma_install_read_handler,
psx_dma_install_write_handler
};
@@ -1622,7 +1627,7 @@ static void update_mode( running_machine *machine )
if( inserted_cdrom != new_cdrom )
{
inserted_cdrom = new_cdrom;
- cdda_set_cdrom(0, atapi_get_device());
+ cdda_set_cdrom(devtag_get_device(machine, SOUND, "cdda"), atapi_get_device());
}
}
diff --git a/src/mame/drivers/kyugo.c b/src/mame/drivers/kyugo.c
index 604e3d1f6fd..9db67f9e2e8 100644
--- a/src/mame/drivers/kyugo.c
+++ b/src/mame/drivers/kyugo.c
@@ -123,15 +123,13 @@ Sub_MemMap( flashgla, 0x7fff, 0xe000, 0xc040, 0xc080, 0xc0c0 )
*
*************************************/
-#define Sub_PortMap( name, ay0_base, ay1_base ) \
-static ADDRESS_MAP_START( name##_sub_portmap, ADDRESS_SPACE_IO, 8 ) \
- ADDRESS_MAP_GLOBAL_MASK(0xff) \
- AM_RANGE(ay0_base+0, ay0_base+0) AM_WRITE(ay8910_control_port_0_w) \
- AM_RANGE(ay0_base+1, ay0_base+1) AM_WRITE(ay8910_write_port_0_w) \
- AM_RANGE(ay0_base+2, ay0_base+2) AM_READ(ay8910_read_port_0_r) \
- AM_RANGE(ay1_base+0, ay1_base+0) AM_WRITE(ay8910_control_port_1_w) \
- AM_RANGE(ay1_base+1, ay1_base+1) AM_WRITE(ay8910_write_port_1_w) \
-ADDRESS_MAP_END \
+#define Sub_PortMap( name, ay0_base, ay1_base ) \
+static ADDRESS_MAP_START( name##_sub_portmap, ADDRESS_SPACE_IO, 8 ) \
+ ADDRESS_MAP_GLOBAL_MASK(0xff) \
+ AM_RANGE(ay0_base+0, ay0_base+1) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w) \
+ AM_RANGE(ay0_base+2, ay0_base+2) AM_DEVREAD(SOUND, "ay1", ay8910_r) \
+ AM_RANGE(ay1_base+0, ay1_base+1) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w) \
+ADDRESS_MAP_END \
Sub_PortMap( gyrodine, 0x00, 0xc0 )
Sub_PortMap( sonofphx, 0x00, 0x40 )
@@ -447,10 +445,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r,
- input_port_1_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/labyrunr.c b/src/mame/drivers/labyrunr.c
index 678ff40f892..926a9065bdf 100644
--- a/src/mame/drivers/labyrunr.c
+++ b/src/mame/drivers/labyrunr.c
@@ -55,10 +55,8 @@ if (data & 0xe0) popmessage("bankswitch %02x",data);
static ADDRESS_MAP_START( labyrunr_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0020, 0x005f) AM_READ(SMH_RAM) /* scroll registers */
- AM_RANGE(0x0801, 0x0801) AM_READ(ym2203_status_port_0_r)
- AM_RANGE(0x0800, 0x0800) AM_READ(ym2203_read_port_0_r)
- AM_RANGE(0x0901, 0x0901) AM_READ(ym2203_status_port_1_r)
- AM_RANGE(0x0900, 0x0900) AM_READ(ym2203_read_port_1_r)
+ AM_RANGE(0x0800, 0x0801) AM_DEVREAD(SOUND, "ym1", ym2203_r)
+ AM_RANGE(0x0900, 0x0901) AM_DEVREAD(SOUND, "ym2", ym2203_r)
AM_RANGE(0x0a00, 0x0a00) AM_READ_PORT("P2")
AM_RANGE(0x0a01, 0x0a01) AM_READ_PORT("P1")
AM_RANGE(0x0b00, 0x0b00) AM_READ_PORT("SYSTEM")
@@ -73,10 +71,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( labyrunr_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0007) AM_WRITE(K007121_ctrl_0_w)
AM_RANGE(0x0020, 0x005f) AM_WRITE(SMH_RAM) AM_BASE(&labyrunr_scrollram) /* scroll registers */
- AM_RANGE(0x0801, 0x0801) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x0800, 0x0800) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0x0901, 0x0901) AM_WRITE(ym2203_control_port_1_w)
- AM_RANGE(0x0900, 0x0900) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0x0800, 0x0801) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x0900, 0x0901) AM_DEVWRITE(SOUND, "ym2", ym2203_w)
AM_RANGE(0x0c00, 0x0c00) AM_WRITE(labyrunr_bankswitch_w)
AM_RANGE(0x0d00, 0x0d1f) AM_WRITE(K051733_w) /* 051733 (protection) */
AM_RANGE(0x0e00, 0x0e00) AM_WRITE(watchdog_reset_w)
@@ -227,10 +223,10 @@ static const ym2203_interface ym2203_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r,
- input_port_1_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_NULL,
+ DEVCB_NULL
},
NULL
};
@@ -240,10 +236,10 @@ static const ym2203_interface ym2203_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- input_port_2_r,
- NULL,
- NULL
+ DEVCB_NULL,
+ DEVCB_INPUT_PORT("DSW3"),
+ DEVCB_NULL,
+ DEVCB_NULL
},
NULL
};
diff --git a/src/mame/drivers/ladybug.c b/src/mame/drivers/ladybug.c
index 0ac8bba721b..c10a61519dc 100644
--- a/src/mame/drivers/ladybug.c
+++ b/src/mame/drivers/ladybug.c
@@ -99,8 +99,8 @@ static ADDRESS_MAP_START( ladybug_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x9002, 0x9002) AM_READ_PORT("DSW0")
AM_RANGE(0x9003, 0x9003) AM_READ_PORT("DSW1")
AM_RANGE(0xa000, 0xa000) AM_WRITE(ladybug_flipscreen_w)
- AM_RANGE(0xb000, 0xbfff) AM_WRITE(sn76496_0_w)
- AM_RANGE(0xc000, 0xcfff) AM_WRITE(sn76496_1_w)
+ AM_RANGE(0xb000, 0xbfff) AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0xc000, 0xcfff) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(ladybug_videoram_w) AM_BASE(&videoram)
AM_RANGE(0xd400, 0xd7ff) AM_RAM_WRITE(ladybug_colorram_w) AM_BASE(&colorram)
AM_RANGE(0xe000, 0xe000) AM_READ_PORT("IN2")
@@ -137,11 +137,11 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sraider_cpu2_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(sn76496_0_w)
- AM_RANGE(0x08, 0x08) AM_WRITE(sn76496_1_w)
- AM_RANGE(0x10, 0x10) AM_WRITE(sn76496_2_w)
- AM_RANGE(0x18, 0x18) AM_WRITE(sn76496_3_w)
- AM_RANGE(0x20, 0x20) AM_WRITE(sn76496_4_w)
+ AM_RANGE(0x00, 0x00) AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0x08, 0x08) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
+ AM_RANGE(0x10, 0x10) AM_DEVWRITE(SOUND, "sn3", sn76496_w)
+ AM_RANGE(0x18, 0x18) AM_DEVWRITE(SOUND, "sn4", sn76496_w)
+ AM_RANGE(0x20, 0x20) AM_DEVWRITE(SOUND, "sn5", sn76496_w)
AM_RANGE(0x28, 0x3f) AM_WRITE(sraider_misc_w) // lots unknown
ADDRESS_MAP_END
diff --git a/src/mame/drivers/ladyfrog.c b/src/mame/drivers/ladyfrog.c
index 0931112dd84..28bf1a61a99 100644
--- a/src/mame/drivers/ladyfrog.c
+++ b/src/mame/drivers/ladyfrog.c
@@ -117,7 +117,7 @@ static WRITE8_HANDLER( nmi_enable_w )
}
}
-static WRITE8_HANDLER(unk_w)
+static WRITE8_DEVICE_HANDLER(unk_w)
{
}
@@ -126,10 +126,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- unk_w,
- unk_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(unk_w),
+ DEVCB_HANDLER(unk_w)
};
static const msm5232_interface msm5232_config =
@@ -189,9 +189,8 @@ static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xc7ff) AM_WRITE(SMH_RAM)
AM_RANGE(0xc800, 0xc801) AM_WRITE(SMH_NOP)
- AM_RANGE(0xc802, 0xc802) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xc803, 0xc803) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xc900, 0xc90d) AM_WRITE(msm5232_0_w)
+ AM_RANGE(0xc802, 0xc803) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0xc900, 0xc90d) AM_DEVWRITE(SOUND, "msm", msm5232_w)
AM_RANGE(0xca00, 0xca00) AM_WRITE(SMH_NOP)
AM_RANGE(0xcb00, 0xcb00) AM_WRITE(SMH_NOP)
AM_RANGE(0xcc00, 0xcc00) AM_WRITE(SMH_NOP)
diff --git a/src/mame/drivers/laserbat.c b/src/mame/drivers/laserbat.c
index 59ed1e787c0..65aaa2c7649 100644
--- a/src/mame/drivers/laserbat.c
+++ b/src/mame/drivers/laserbat.c
@@ -602,10 +602,7 @@ static int active_8910,port0a;
static READ8_HANDLER( zaccaria_port0a_r )
{
- if (active_8910 == 0)
- return ay8910_read_port_0_r(space,0);
- else
- return ay8910_read_port_1_r(space,0);
+ return ay8910_r(devtag_get_device(space->machine, SOUND, (active_8910 == 0) ? "ay1" : "ay2"), 0);
}
static WRITE8_HANDLER( zaccaria_port0a_w )
@@ -622,10 +619,7 @@ static WRITE8_HANDLER( zaccaria_port0b_w )
if ((last & 0x02) == 0x02 && (data & 0x02) == 0x00)
{
/* bit 0 goes to the 8910 #0 BC1 pin */
- if (last & 0x01)
- ay8910_control_port_0_w(space,0,port0a);
- else
- ay8910_write_port_0_w(space,0,port0a);
+ ay8910_data_address_w(devtag_get_device(space->machine, SOUND, "ay1"), last >> 0, port0a);
}
else if ((last & 0x02) == 0x00 && (data & 0x02) == 0x02)
{
@@ -637,10 +631,7 @@ static WRITE8_HANDLER( zaccaria_port0b_w )
if ((last & 0x08) == 0x08 && (data & 0x08) == 0x00)
{
/* bit 2 goes to the 8910 #1 BC1 pin */
- if (last & 0x04)
- ay8910_control_port_1_w(space,0,port0a);
- else
- ay8910_write_port_1_w(space,0,port0a);
+ ay8910_data_address_w(devtag_get_device(space->machine, SOUND, "ay2"), last >> 2, port0a);
}
else if ((last & 0x08) == 0x00 && (data & 0x08) == 0x08)
{
@@ -663,10 +654,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- soundlatch_r,
- NULL,//ay8910_port0a_w,
- NULL
+ DEVCB_NULL,
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r),
+ DEVCB_NULL,//ay8910_port0a_w,
+ DEVCB_NULL
};
static MACHINE_START( catnmous )
diff --git a/src/mame/drivers/lasso.c b/src/mame/drivers/lasso.c
index 9e87eb47d9b..898ca0aaf5e 100644
--- a/src/mame/drivers/lasso.c
+++ b/src/mame/drivers/lasso.c
@@ -71,10 +71,10 @@ static WRITE8_HANDLER( sound_select_w )
UINT8 to_write = BITSWAP8(*lasso_chip_data, 0, 1, 2, 3, 4, 5, 6, 7);
if (~data & 0x01) /* chip #0 */
- sn76496_0_w(space, 0, to_write);
+ sn76496_w(devtag_get_device(space->machine, SOUND, "sn1"), 0, to_write);
if (~data & 0x02) /* chip #1 */
- sn76496_1_w(space, 0, to_write);
+ sn76496_w(devtag_get_device(space->machine, SOUND, "sn2"), 0, to_write);
}
@@ -168,7 +168,7 @@ static ADDRESS_MAP_START( wwjgtin_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4000, 0x7fff) AM_MIRROR(0x8000) AM_ROM
AM_RANGE(0xb000, 0xb000) AM_WRITE(SMH_RAM) AM_BASE(&lasso_chip_data)
AM_RANGE(0xb001, 0xb001) AM_WRITE(sound_select_w)
- AM_RANGE(0xb003, 0xb003) AM_WRITE(dac_0_data_w)
+ AM_RANGE(0xb003, 0xb003) AM_DEVWRITE(SOUND, "dac", dac_w)
AM_RANGE(0xb004, 0xb004) AM_READ(sound_status_r)
AM_RANGE(0xb005, 0xb005) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -199,12 +199,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( pinbo_audio_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x02, 0x02) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x04, 0x04) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x05, 0x05) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x06, 0x06) AM_READ(ay8910_read_port_1_r)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x02, 0x02) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0x04, 0x05) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x06, 0x06) AM_DEVREAD(SOUND, "ay2", ay8910_r)
AM_RANGE(0x08, 0x08) AM_READWRITE(soundlatch_r, SMH_NOP) /* ??? */
AM_RANGE(0x14, 0x14) AM_WRITE(SMH_NOP) /* ??? */
ADDRESS_MAP_END
diff --git a/src/mame/drivers/lastduel.c b/src/mame/drivers/lastduel.c
index 489d8f5b4a9..4c72da53a7b 100644
--- a/src/mame/drivers/lastduel.c
+++ b/src/mame/drivers/lastduel.c
@@ -109,18 +109,16 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xdfff) AM_READ(SMH_ROM)
AM_RANGE(0xe000, 0xe7ff) AM_READ(SMH_RAM)
- AM_RANGE(0xe800, 0xe800) AM_READ(ym2203_status_port_0_r)
- AM_RANGE(0xf000, 0xf000) AM_READ(ym2203_status_port_1_r)
+ AM_RANGE(0xe800, 0xe801) AM_DEVREAD(SOUND, "ym1", ym2203_r)
+ AM_RANGE(0xf000, 0xf001) AM_DEVREAD(SOUND, "ym2", ym2203_r)
AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xdfff) AM_WRITE(SMH_ROM)
AM_RANGE(0xe000, 0xe7ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xe800, 0xe800) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xe801, 0xe801) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0xf000, 0xf000) AM_WRITE(ym2203_control_port_1_w)
- AM_RANGE(0xf001, 0xf001) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0xe800, 0xe801) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0xf000, 0xf001) AM_DEVWRITE(SOUND, "ym2", ym2203_w)
ADDRESS_MAP_END
static WRITE8_HANDLER( mg_bankswitch_w )
@@ -136,19 +134,17 @@ static ADDRESS_MAP_START( mg_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0xcfff) AM_READ(SMH_BANK3)
AM_RANGE(0xd000, 0xd7ff) AM_READ(SMH_RAM)
- AM_RANGE(0xf000, 0xf000) AM_READ(ym2203_status_port_0_r)
- AM_RANGE(0xf002, 0xf002) AM_READ(ym2203_status_port_1_r)
+ AM_RANGE(0xf000, 0xf001) AM_DEVREAD(SOUND, "ym1", ym2203_r)
+ AM_RANGE(0xf002, 0xf003) AM_DEVREAD(SOUND, "ym2", ym2203_r)
AM_RANGE(0xf006, 0xf006) AM_READ(soundlatch_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( mg_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xcfff) AM_WRITE(SMH_ROM)
AM_RANGE(0xd000, 0xd7ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xf000, 0xf000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xf001, 0xf001) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0xf002, 0xf002) AM_WRITE(ym2203_control_port_1_w)
- AM_RANGE(0xf003, 0xf003) AM_WRITE(ym2203_write_port_1_w)
- AM_RANGE(0xf004, 0xf004) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0xf000, 0xf001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0xf002, 0xf003) AM_DEVWRITE(SOUND, "ym2", ym2203_w)
+ AM_RANGE(0xf004, 0xf004) AM_DEVWRITE(SOUND, "oki", okim6295_w)
AM_RANGE(0xf00a, 0xf00a) AM_WRITE(mg_bankswitch_w)
ADDRESS_MAP_END
@@ -234,9 +230,9 @@ GFXDECODE_END
/******************************************************************************/
/* handler called by the 2203 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface ym2203_config =
@@ -244,7 +240,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL,
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,
},
irqhandler
};
diff --git a/src/mame/drivers/lazercmd.c b/src/mame/drivers/lazercmd.c
index 27341293237..0a3fb5e73c1 100644
--- a/src/mame/drivers/lazercmd.c
+++ b/src/mame/drivers/lazercmd.c
@@ -301,11 +301,11 @@ static WRITE8_HANDLER( lazercmd_hardware_w )
DAC_data=(data&0x80)^((data&0x40)<<1)^((data&0x20)<<2)^((data&0x10)<<3);
if (DAC_data)
{
- dac_data_w(0, 0xff);
+ dac_data_w(devtag_get_device(space->machine, SOUND, "dac"), 0xff);
}
else
{
- dac_data_w(0, 0);
+ dac_data_w(devtag_get_device(space->machine, SOUND, "dac"), 0);
}
break;
case 1: /* marker Y position */
@@ -332,11 +332,11 @@ static WRITE8_HANDLER( medlanes_hardware_w )
DAC_data=((data&0x20)<<2)^((data&0x10)<<3);
if (DAC_data)
{
- dac_data_w(0, 0xff);
+ dac_data_w(devtag_get_device(space->machine, SOUND, "dac"), 0xff);
}
else
{
- dac_data_w(0, 0);
+ dac_data_w(devtag_get_device(space->machine, SOUND, "dac"), 0);
}
break;
case 1: /* marker Y position */
@@ -363,11 +363,11 @@ static WRITE8_HANDLER( bbonk_hardware_w )
DAC_data=((data&0x20)<<2)^((data&0x10)<<3);
if (DAC_data)
{
- dac_data_w(0, 0xff);
+ dac_data_w(devtag_get_device(space->machine, SOUND, "dac"), 0xff);
}
else
{
- dac_data_w(0, 0);
+ dac_data_w(devtag_get_device(space->machine, SOUND, "dac"), 0);
}
break;
case 3: /* D4 clears coin detected and D0 toggles on attract mode */
diff --git a/src/mame/drivers/legionna.c b/src/mame/drivers/legionna.c
index ba3f6471a42..98078e7a738 100644
--- a/src/mame/drivers/legionna.c
+++ b/src/mame/drivers/legionna.c
@@ -209,8 +209,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( cupsocbl_sound_mem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
- AM_RANGE(0x9000, 0x9000) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
- AM_RANGE(0x9800, 0x9800) AM_READWRITE(okim6295_status_1_r, okim6295_data_1_w)
+ AM_RANGE(0x9000, 0x9000) AM_DEVREADWRITE(SOUND, "oki1", okim6295_r, okim6295_w)
+ AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE(SOUND, "oki2", okim6295_r, okim6295_w)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/leland.c b/src/mame/drivers/leland.c
index f40b8ec4309..3bed3116c89 100644
--- a/src/mame/drivers/leland.c
+++ b/src/mame/drivers/leland.c
@@ -47,7 +47,6 @@
#include "cpu/z80/z80.h"
#include "leland.h"
#include "sound/ay8910.h"
-#include "sound/custom.h"
#define MASTER_CLOCK XTAL_12MHz
@@ -692,28 +691,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_SINGLE_OUTPUT,
{1000, 0, 0},
- leland_sound_port_r,
- 0,
- leland_sound_port_w,
- 0
-};
-
-
-static const custom_sound_interface dac_custom_interface =
-{
- leland_sh_start
-};
-
-
-static const custom_sound_interface i80186_custom_interface =
-{
- leland_80186_sh_start
-};
-
-
-static const custom_sound_interface redline_custom_interface =
-{
- redline_80186_sh_start
+ DEVCB_HANDLER(leland_sound_port_r),
+ DEVCB_NULL,
+ DEVCB_HANDLER(leland_sound_port_w),
+ DEVCB_NULL
};
@@ -754,8 +735,7 @@ static MACHINE_DRIVER_START( leland )
MDRV_SOUND_CONFIG(ay8910_config)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
- MDRV_SOUND_ADD("custom", CUSTOM, 0)
- MDRV_SOUND_CONFIG(dac_custom_interface)
+ MDRV_SOUND_ADD("custom", LELAND, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MACHINE_DRIVER_END
@@ -770,8 +750,7 @@ static MACHINE_DRIVER_START( redline )
MDRV_CPU_IO_MAP(redline_80186_map_io,0)
/* sound hardware */
- MDRV_SOUND_REPLACE("custom", CUSTOM, 0)
- MDRV_SOUND_CONFIG(redline_custom_interface)
+ MDRV_SOUND_REPLACE("custom", REDLINE_80186, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
@@ -785,8 +764,7 @@ static MACHINE_DRIVER_START( quarterb )
MDRV_CPU_IO_MAP(leland_80186_map_io,0)
/* sound hardware */
- MDRV_SOUND_REPLACE("custom", CUSTOM, 0)
- MDRV_SOUND_CONFIG(i80186_custom_interface)
+ MDRV_SOUND_REPLACE("custom", LELAND_80186, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/lemmings.c b/src/mame/drivers/lemmings.c
index f5a0dd8475b..8cfc823f5fe 100644
--- a/src/mame/drivers/lemmings.c
+++ b/src/mame/drivers/lemmings.c
@@ -118,17 +118,16 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_READ(SMH_RAM)
- AM_RANGE(0x0801, 0x0801) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0x1000, 0x1000) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x0800, 0x0801) AM_DEVREAD(SOUND, "ym", ym2151_r)
+ AM_RANGE(0x1000, 0x1000) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0x1800, 0x1800) AM_READ(soundlatch_r)
AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x0800, 0x0800) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x0801, 0x0801) AM_WRITE(ym2151_data_port_0_w)
- AM_RANGE(0x1000, 0x1000) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0x0800, 0x0801) AM_DEVWRITE(SOUND, "ym", ym2151_w)
+ AM_RANGE(0x1000, 0x1000) AM_DEVWRITE(SOUND, "oki", okim6295_w)
AM_RANGE(0x1800, 0x1800) AM_WRITE(lemmings_sound_ack_w)
AM_RANGE(0x8000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
@@ -256,9 +255,9 @@ GFXDECODE_END
/******************************************************************************/
-static void sound_irq(running_machine *machine, int state)
+static void sound_irq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1],0,state);
+ cpu_set_input_line(device->machine->cpu[1],0,state);
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/lethal.c b/src/mame/drivers/lethal.c
index dd0953491a6..78e4aa71536 100644
--- a/src/mame/drivers/lethal.c
+++ b/src/mame/drivers/lethal.c
@@ -267,9 +267,9 @@ static READ8_HANDLER( sound_status_r )
return 0xf;
}
-static void sound_nmi(running_machine *machine)
+static void sound_nmi(const device_config *device)
{
- cpu_set_input_line(machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE);
+ cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE);
}
static WRITE8_HANDLER( le_bankswitch_w )
@@ -503,7 +503,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( le_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_ROM
AM_RANGE(0xf000, 0xf7ff) AM_RAM
- AM_RANGE(0xf800, 0xfa2f) AM_READWRITE(k054539_0_r, k054539_0_w)
+ AM_RANGE(0xf800, 0xfa2f) AM_DEVREADWRITE(SOUND, "konami", k054539_r, k054539_w)
AM_RANGE(0xfc00, 0xfc00) AM_WRITE(soundlatch2_w)
AM_RANGE(0xfc02, 0xfc02) AM_READ(soundlatch_r)
AM_RANGE(0xfc03, 0xfc03) AM_READNOP
diff --git a/src/mame/drivers/lethalj.c b/src/mame/drivers/lethalj.c
index 9e24fbdd751..761dd9d23b7 100644
--- a/src/mame/drivers/lethalj.c
+++ b/src/mame/drivers/lethalj.c
@@ -217,9 +217,9 @@ static WRITE16_HANDLER( cclownz_control_w )
static ADDRESS_MAP_START( lethalj_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x00000000, 0x003fffff) AM_RAM
- AM_RANGE(0x04000000, 0x0400000f) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
- AM_RANGE(0x04000010, 0x0400001f) AM_READWRITE(okim6295_status_1_lsb_r, okim6295_data_1_lsb_w)
- AM_RANGE(0x04100000, 0x0410000f) AM_READWRITE(okim6295_status_2_lsb_r, okim6295_data_2_lsb_w)
+ AM_RANGE(0x04000000, 0x0400000f) AM_DEVREADWRITE8(SOUND, "oki1", okim6295_r, okim6295_w, 0x00ff)
+ AM_RANGE(0x04000010, 0x0400001f) AM_DEVREADWRITE8(SOUND, "oki2", okim6295_r, okim6295_w, 0x00ff)
+ AM_RANGE(0x04100000, 0x0410000f) AM_DEVREADWRITE8(SOUND, "oki3", okim6295_r, okim6295_w, 0x00ff)
// AM_RANGE(0x04100010, 0x0410001f) AM_READNOP /* read but never examined */
AM_RANGE(0x04200000, 0x0420001f) AM_WRITENOP /* clocks bits through here */
AM_RANGE(0x04300000, 0x0430007f) AM_READ(lethalj_gun_r)
diff --git a/src/mame/drivers/lgp.c b/src/mame/drivers/lgp.c
index 58954c0f507..cd625d4195b 100644
--- a/src/mame/drivers/lgp.c
+++ b/src/mame/drivers/lgp.c
@@ -366,8 +366,7 @@ static MACHINE_DRIVER_START( lgp )
/* sound hardware */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("ldsound", CUSTOM, 0)
- MDRV_SOUND_CONFIG(laserdisc_custom_interface)
+ MDRV_SOUND_ADD("ldsound", LASERDISC, 0)
MDRV_SOUND_ROUTE(0, "left", 1.0)
MDRV_SOUND_ROUTE(1, "right", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/liberate.c b/src/mame/drivers/liberate.c
index 6e2f81c7b3e..006e7d5ab3f 100644
--- a/src/mame/drivers/liberate.c
+++ b/src/mame/drivers/liberate.c
@@ -167,10 +167,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( prosoccr_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x01ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x2000, 0x2000) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x4000, 0x4000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x6000, 0x6000) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x8000, 0x8000) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0x2000, 0x2000) AM_DEVWRITE(SOUND, "ay1", ay8910_data_w)
+ AM_RANGE(0x4000, 0x4000) AM_DEVWRITE(SOUND, "ay1", ay8910_address_w)
+ AM_RANGE(0x6000, 0x6000) AM_DEVWRITE(SOUND, "ay2", ay8910_data_w)
+ AM_RANGE(0x8000, 0x8000) AM_DeVWRITE(SOUND, "ay2", ay8910_address_w)
AM_RANGE(0xe000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
#endif
@@ -183,10 +183,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x01ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x3000, 0x3000) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x4000, 0x4000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x7000, 0x7000) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x8000, 0x8000) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0x3000, 0x3000) AM_DEVWRITE(SOUND, "ay1", ay8910_data_w)
+ AM_RANGE(0x4000, 0x4000) AM_DEVWRITE(SOUND, "ay1", ay8910_address_w)
+ AM_RANGE(0x7000, 0x7000) AM_DEVWRITE(SOUND, "ay2", ay8910_data_w)
+ AM_RANGE(0x8000, 0x8000) AM_DEVWRITE(SOUND, "ay2", ay8910_address_w)
AM_RANGE(0xc000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/liberatr.c b/src/mame/drivers/liberatr.c
index 9fd70cc1667..fb9fab24b93 100644
--- a/src/mame/drivers/liberatr.c
+++ b/src/mame/drivers/liberatr.c
@@ -227,8 +227,8 @@ static ADDRESS_MAP_START( liberatr_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x6c05, 0x6c06) AM_WRITE(liberatr_coin_counter_w)
AM_RANGE(0x6c07, 0x6c07) AM_WRITE(SMH_RAM) AM_BASE(&liberatr_planet_select)
AM_RANGE(0x6e00, 0x6e3f) AM_WRITE(atari_vg_earom_w)
- AM_RANGE(0x7000, 0x701f) AM_READWRITE(pokey2_r, pokey2_w)
- AM_RANGE(0x7800, 0x781f) AM_READWRITE(pokey1_r, pokey1_w)
+ AM_RANGE(0x7000, 0x701f) AM_DEVREADWRITE(SOUND, "pokey2", pokey_r, pokey_w)
+ AM_RANGE(0x7800, 0x781f) AM_DEVREADWRITE(SOUND, "pokey1", pokey_r, pokey_w)
AM_RANGE(0x8000, 0xefff) AM_ROM
AM_RANGE(0xfffa, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -260,8 +260,8 @@ static ADDRESS_MAP_START( liberat2_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4c05, 0x4c06) AM_WRITE(liberatr_coin_counter_w)
AM_RANGE(0x4c07, 0x4c07) AM_WRITE(SMH_RAM) AM_BASE(&liberatr_planet_select)
AM_RANGE(0x4e00, 0x4e3f) AM_WRITE(atari_vg_earom_w)
- AM_RANGE(0x5000, 0x501f) AM_READWRITE(pokey2_r, pokey2_w)
- AM_RANGE(0x5800, 0x581f) AM_READWRITE(pokey1_r, pokey1_w)
+ AM_RANGE(0x5000, 0x501f) AM_DEVREADWRITE(SOUND, "pokey2", pokey_r, pokey_w)
+ AM_RANGE(0x5800, 0x581f) AM_DEVREADWRITE(SOUND, "pokey1", pokey_r, pokey_w)
//AM_RANGE(0x6000, 0x601f) AM_WRITE(pokey1_w) /* bug ??? */
AM_RANGE(0x6000, 0xbfff) AM_ROM
AM_RANGE(0xfffa, 0xffff) AM_ROM
@@ -361,15 +361,15 @@ INPUT_PORTS_END
static const pokey_interface pokey_interface_1 =
{
- { 0 },
- input_port_3_r
+ { DEVCB_NULL },
+ DEVCB_INPUT_PORT("DSW2")
};
static const pokey_interface pokey_interface_2 =
{
- { 0 },
- input_port_2_r
+ { DEVCB_NULL },
+ DEVCB_INPUT_PORT("DSW1")
};
diff --git a/src/mame/drivers/limenko.c b/src/mame/drivers/limenko.c
index c4604967d5d..7db8a9c0286 100644
--- a/src/mame/drivers/limenko.c
+++ b/src/mame/drivers/limenko.c
@@ -208,11 +208,11 @@ static READ8_HANDLER( spotty_sound_r )
if(spotty_sound_cmd == 0xf7)
return soundlatch_r(space,0);
else
- return okim6295_status_0_r(space,0);
+ return okim6295_r(devtag_get_device(space->machine, SOUND, "oki"),0);
}
static ADDRESS_MAP_START( spotty_sound_io_map, ADDRESS_SPACE_IO, 8 )
- AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_READWRITE(spotty_sound_r, okim6295_data_0_w) //? sound latch and ?
+ AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_READ(spotty_sound_r) AM_DEVWRITE(SOUND, "oki", okim6295_w) //? sound latch and ?
AM_RANGE(MCS51_PORT_P3, MCS51_PORT_P3) AM_READWRITE(spotty_sound_cmd_r, spotty_sound_cmd_w) //not sure about anything...
ADDRESS_MAP_END
diff --git a/src/mame/drivers/lkage.c b/src/mame/drivers/lkage.c
index c81698e14f1..e970fec36b0 100644
--- a/src/mame/drivers/lkage.c
+++ b/src/mame/drivers/lkage.c
@@ -174,8 +174,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM)
- AM_RANGE(0x9000, 0x9000) AM_READ(ym2203_status_port_0_r)
- AM_RANGE(0xa000, 0xa000) AM_READ(ym2203_status_port_1_r)
+ AM_RANGE(0x9000, 0x9001) AM_DEVREAD(SOUND, "ym1", ym2203_r)
+ AM_RANGE(0xa000, 0xa001) AM_DEVREAD(SOUND, "ym2", ym2203_r)
AM_RANGE(0xb000, 0xb000) AM_READ(soundlatch_r)
AM_RANGE(0xb001, 0xb001) AM_READ(SMH_NOP) /* ??? */
AM_RANGE(0xe000, 0xefff) AM_READ(SMH_ROM) /* space for diagnostic ROM? */
@@ -184,10 +184,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x9000, 0x9000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x9001, 0x9001) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0xa000, 0xa000) AM_WRITE(ym2203_control_port_1_w)
- AM_RANGE(0xa001, 0xa001) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0x9000, 0x9001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0xa000, 0xa001) AM_DEVWRITE(SOUND, "ym2", ym2203_w)
AM_RANGE(0xb000, 0xb000) AM_WRITE(SMH_NOP) /* ??? */
AM_RANGE(0xb001, 0xb001) AM_WRITE(lkage_sh_nmi_enable_w)
AM_RANGE(0xb002, 0xb002) AM_WRITE(lkage_sh_nmi_disable_w)
@@ -356,9 +354,9 @@ static GFXDECODE_START( lkage )
GFXDECODE_ENTRY( "gfx1", 0x0000, sprite_layout, 0, 16 )
GFXDECODE_END
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface ym2203_config =
@@ -366,7 +364,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
irqhandler
};
diff --git a/src/mame/drivers/lockon.c b/src/mame/drivers/lockon.c
index 0941d28ec30..105002afd32 100644
--- a/src/mame/drivers/lockon.c
+++ b/src/mame/drivers/lockon.c
@@ -207,8 +207,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
AM_RANGE(0x02, 0x02) AM_NOP
ADDRESS_MAP_END
@@ -415,21 +414,21 @@ static WRITE8_HANDLER( sound_vol )
double lgain = gains[data & 0xf];
double rgain = gains[data >> 4];
- flt_volume_set_volume(0, lgain);
- flt_volume_set_volume(2, lgain);
- flt_volume_set_volume(4, lgain);
+ flt_volume_set_volume(devtag_get_device(space->machine, SOUND, "f2203.1l"), lgain);
+ flt_volume_set_volume(devtag_get_device(space->machine, SOUND, "f2203.2l"), lgain);
+ flt_volume_set_volume(devtag_get_device(space->machine, SOUND, "f2203.3l"), lgain);
- flt_volume_set_volume(1, rgain);
- flt_volume_set_volume(3, rgain);
- flt_volume_set_volume(5, rgain);
+ flt_volume_set_volume(devtag_get_device(space->machine, SOUND, "f2203.1r"), rgain);
+ flt_volume_set_volume(devtag_get_device(space->machine, SOUND, "f2203.2r"), rgain);
+ flt_volume_set_volume(devtag_get_device(space->machine, SOUND, "f2203.3r"), rgain);
}
-static void ym2203_irq(running_machine *machine, int irq)
+static void ym2203_irq(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[SOUND_CPU], 0, irq ? ASSERT_LINE : CLEAR_LINE );
+ cpu_set_input_line(device->machine->cpu[SOUND_CPU], 0, irq ? ASSERT_LINE : CLEAR_LINE );
}
-static WRITE8_HANDLER( ym2203_out_b )
+static WRITE8_DEVICE_HANDLER( ym2203_out_b )
{
coin_counter_w(0, data & 0x80);
coin_counter_w(1, data & 0x40);
@@ -444,10 +443,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_1_r,
- NULL,
- NULL,
- ym2203_out_b,
+ DEVCB_INPUT_PORT("YM2203"),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(ym2203_out_b),
},
ym2203_irq
};
diff --git a/src/mame/drivers/looping.c b/src/mame/drivers/looping.c
index 69546e018d5..a04679b4849 100644
--- a/src/mame/drivers/looping.c
+++ b/src/mame/drivers/looping.c
@@ -332,9 +332,9 @@ static WRITE8_HANDLER( looping_souint_clr )
}
-static void looping_spcint(running_machine *machine, int state)
+static void looping_spcint(const device_config *device, int state)
{
- cpu_set_input_line_and_vector(machine->cpu[1], 0, state, 6);
+ cpu_set_input_line_and_vector(device->machine->cpu[1], 0, state, 6);
}
@@ -352,7 +352,7 @@ static WRITE8_HANDLER( looping_soundlatch_w )
*
*************************************/
-static WRITE8_HANDLER( looping_sound_sw )
+static WRITE8_DEVICE_HANDLER( looping_sound_sw )
{
/* this can be improved by adding the missing signals for decay etc. (see schematics)
@@ -365,9 +365,9 @@ static WRITE8_HANDLER( looping_sound_sw )
0007 = AFA
*/
- looping_state *state = space->machine->driver_data;
+ looping_state *state = device->machine->driver_data;
state->sound[offset + 1] = data ^ 1;
- dac_data_w(0, ((state->sound[2] << 7) + (state->sound[3] << 6)) * state->sound[7]);
+ dac_data_w(device, ((state->sound[2] << 7) + (state->sound[3] << 6)) * state->sound[7]);
}
@@ -378,18 +378,18 @@ static WRITE8_HANDLER( looping_sound_sw )
*
*************************************/
-static WRITE8_HANDLER( ay_enable_w )
+static WRITE8_DEVICE_HANDLER( ay_enable_w )
{
int output;
for (output = 0; output < 3; output++)
- sndti_set_output_gain(SOUND_AY8910, 0, output, (data & 1) ? 1.0 : 0.0);
+ sound_set_output_gain(device, output, (data & 1) ? 1.0 : 0.0);
}
-static WRITE8_HANDLER( speech_enable_w )
+static WRITE8_DEVICE_HANDLER( speech_enable_w )
{
- sndti_set_output_gain(SOUND_TMS5220, 0, 0, (data & 1) ? 1.0 : 0.0);
+ sound_set_output_gain(device, 0, (data & 1) ? 1.0 : 0.0);
}
@@ -499,19 +499,19 @@ static ADDRESS_MAP_START( looping_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_GLOBAL_MASK(0x3fff)
AM_RANGE(0x0000, 0x37ff) AM_ROM
AM_RANGE(0x3800, 0x3bff) AM_RAM
- AM_RANGE(0x3c00, 0x3c00) AM_MIRROR(0x00f4) AM_READWRITE(ay8910_read_port_0_r, ay8910_control_port_0_w)
- AM_RANGE(0x3c02, 0x3c02) AM_MIRROR(0x00f4) AM_READWRITE(SMH_NOP, ay8910_write_port_0_w)
+ AM_RANGE(0x3c00, 0x3c00) AM_MIRROR(0x00f4) AM_DEVREADWRITE(SOUND, "ay", ay8910_r, ay8910_address_w)
+ AM_RANGE(0x3c02, 0x3c02) AM_MIRROR(0x00f4) AM_READNOP AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
AM_RANGE(0x3c03, 0x3c03) AM_MIRROR(0x00f6) AM_NOP
- AM_RANGE(0x3e00, 0x3e00) AM_MIRROR(0x00f4) AM_READWRITE(SMH_NOP, tms5220_data_w)
- AM_RANGE(0x3e02, 0x3e02) AM_MIRROR(0x00f4) AM_READWRITE(tms5220_status_r, SMH_NOP)
+ AM_RANGE(0x3e00, 0x3e00) AM_MIRROR(0x00f4) AM_DEVREADWRITE(SOUND, "tms", SMH_NOP, tms5220_data_w)
+ AM_RANGE(0x3e02, 0x3e02) AM_MIRROR(0x00f4) AM_DEVREADWRITE(SOUND, "tms", tms5220_status_r, SMH_NOP)
AM_RANGE(0x3e03, 0x3e03) AM_MIRROR(0x00f6) AM_NOP
ADDRESS_MAP_END
static ADDRESS_MAP_START( looping_sound_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x000, 0x000) AM_WRITE(looping_souint_clr)
- AM_RANGE(0x001, 0x007) AM_WRITE(looping_sound_sw)
- AM_RANGE(0x008, 0x008) AM_WRITE(ay_enable_w)
- AM_RANGE(0x009, 0x009) AM_WRITE(speech_enable_w)
+ AM_RANGE(0x001, 0x007) AM_DEVWRITE(SOUND, "dac", looping_sound_sw)
+ AM_RANGE(0x008, 0x008) AM_DEVWRITE(SOUND, "ay", ay_enable_w)
+ AM_RANGE(0x009, 0x009) AM_DEVWRITE(SOUND, "tms", speech_enable_w)
AM_RANGE(0x00a, 0x00a) AM_WRITE(ballon_enable_w)
ADDRESS_MAP_END
@@ -567,10 +567,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r,
- NULL,
- NULL,
- NULL
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
static COP400_INTERFACE( looping_cop_intf )
diff --git a/src/mame/drivers/lordgun.c b/src/mame/drivers/lordgun.c
index 3024b608736..dd3d4a7ae31 100644
--- a/src/mame/drivers/lordgun.c
+++ b/src/mame/drivers/lordgun.c
@@ -235,21 +235,20 @@ static ADDRESS_MAP_START( lordgun_soundmem_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xf000, 0xffff) AM_RAM
ADDRESS_MAP_END
-static WRITE8_HANDLER( lordgun_okibank_w )
+static WRITE8_DEVICE_HANDLER( lordgun_okibank_w )
{
- okim6295_set_bank_base(0, (data & 2) ? 0x40000 : 0);
- if (data & ~3) logerror("%04x: unknown okibank bits %02x\n", cpu_get_pc(space->cpu), data);
+ okim6295_set_bank_base(device, (data & 2) ? 0x40000 : 0);
+ if (data & ~3) logerror("%s: unknown okibank bits %02x\n", cpuexec_describe_context(device->machine), data);
// popmessage("OKI %x", data);
}
static ADDRESS_MAP_START( lordgun_soundio_map, ADDRESS_SPACE_IO, 8 )
- AM_RANGE(0x1000, 0x1000) AM_WRITE( ym3812_control_port_0_w )
- AM_RANGE(0x1001, 0x1001) AM_WRITE( ym3812_write_port_0_w )
- AM_RANGE(0x2000, 0x2000) AM_READWRITE( okim6295_status_0_r, okim6295_data_0_w )
+ AM_RANGE(0x1000, 0x1001) AM_DEVWRITE( SOUND, "ym", ym3812_w )
+ AM_RANGE(0x2000, 0x2000) AM_DEVREADWRITE( SOUND, "oki", okim6295_r, okim6295_w )
AM_RANGE(0x3000, 0x3000) AM_READ( soundlatch2_r )
AM_RANGE(0x4000, 0x4000) AM_READ( soundlatch_r )
AM_RANGE(0x5000, 0x5000) AM_READ( SMH_NOP )
- AM_RANGE(0x6000, 0x6000) AM_WRITE( lordgun_okibank_w )
+ AM_RANGE(0x6000, 0x6000) AM_DEVWRITE( SOUND, "oki", lordgun_okibank_w )
ADDRESS_MAP_END
@@ -257,10 +256,9 @@ static ADDRESS_MAP_START( hfh_soundio_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x3000, 0x3000) AM_READ( soundlatch2_r )
AM_RANGE(0x4000, 0x4000) AM_READ( soundlatch_r )
AM_RANGE(0x5000, 0x5000) AM_READ( SMH_NOP )
- AM_RANGE(0x7000, 0x7000) AM_WRITE( ym3812_control_port_0_w )
- AM_RANGE(0x7001, 0x7001) AM_WRITE( ym3812_write_port_0_w )
- AM_RANGE(0x7400, 0x7400) AM_READWRITE( okim6295_status_0_r, okim6295_data_0_w )
- AM_RANGE(0x7800, 0x7800) AM_READWRITE( okim6295_status_1_r, okim6295_data_1_w )
+ AM_RANGE(0x7000, 0x7001) AM_DEVWRITE( SOUND, "ym", ym3812_w )
+ AM_RANGE(0x7400, 0x7400) AM_DEVREADWRITE( SOUND, "oki", okim6295_r, okim6295_w )
+ AM_RANGE(0x7800, 0x7800) AM_DEVREADWRITE( SOUND, "oki2", okim6295_r, okim6295_w )
ADDRESS_MAP_END
@@ -423,9 +421,9 @@ static const ppi8255_interface ppi8255_intf[2] =
}
};
-static void soundirq(running_machine *machine, int state)
+static void soundirq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1], 0, state);
+ cpu_set_input_line(device->machine->cpu[1], 0, state);
}
static const ym3812_interface lordgun_ym3812_interface =
diff --git a/src/mame/drivers/lsasquad.c b/src/mame/drivers/lsasquad.c
index 5f0e06de0f8..5f1facb6bcd 100644
--- a/src/mame/drivers/lsasquad.c
+++ b/src/mame/drivers/lsasquad.c
@@ -199,8 +199,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM)
- AM_RANGE(0xa000, 0xa000) AM_READ(ym2203_status_port_0_r)
- AM_RANGE(0xa001, 0xa001) AM_READ(ym2203_read_port_0_r)
+ AM_RANGE(0xa000, 0xa001) AM_DEVREAD(SOUND, "ym", ym2203_r)
AM_RANGE(0xd000, 0xd000) AM_READ(lsasquad_sh_sound_command_r)
AM_RANGE(0xd800, 0xd800) AM_READ(lsasquad_sound_status_r)
AM_RANGE(0xe000, 0xefff) AM_READ(SMH_ROM) /* space for diagnostic ROM? */
@@ -209,10 +208,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xa000, 0xa000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xa001, 0xa001) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0xa000, 0xa001) AM_DEVWRITE(SOUND, "ym", ym2203_w)
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
AM_RANGE(0xd000, 0xd000) AM_WRITE(lsasquad_sh_result_w)
AM_RANGE(0xd400, 0xd400) AM_WRITE(lsasquad_sh_nmi_disable_w)
AM_RANGE(0xd800, 0xd800) AM_WRITE(lsasquad_sh_nmi_enable_w)
@@ -388,10 +385,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_mem_daikaiju, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
- AM_RANGE(0xa000, 0xa000) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0xa001, 0xa001) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
AM_RANGE(0xd000, 0xd000) AM_READ(daikaiju_sh_sound_command_r)
AM_RANGE(0xd400, 0xd400) AM_WRITENOP
AM_RANGE(0xd800, 0xd800) AM_READ(daikaiju_sound_status_r) AM_WRITENOP
@@ -532,12 +527,12 @@ GFXDECODE_END
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
-static WRITE8_HANDLER( unk )
+static WRITE8_DEVICE_HANDLER( unk )
{
}
@@ -548,10 +543,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- unk,
- unk,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(unk),
+ DEVCB_HANDLER(unk),
},
irqhandler
};
diff --git a/src/mame/drivers/ltcasino.c b/src/mame/drivers/ltcasino.c
index 0c02289fd23..e2523940d36 100644
--- a/src/mame/drivers/ltcasino.c
+++ b/src/mame/drivers/ltcasino.c
@@ -70,7 +70,7 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xec10, 0xec10) AM_READ_PORT("IN4")
AM_RANGE(0xec12, 0xec12) AM_READ_PORT("IN5")
- AM_RANGE(0xec20, 0xec20) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0xec20, 0xec20) AM_DEVREAD(SOUND, "ay", ay8910_r)
AM_RANGE(0xec21, 0xec21) AM_READ_PORT("BUTTONS") //ltcasino -> pc: F3F3 (A in service) and F3FD (B in service)
AM_RANGE(0xec3e, 0xec3e) AM_READ(SMH_NOP) //not used
@@ -86,8 +86,7 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xe000, 0xe7ff) AM_WRITE(ltcasino_tile_atr_w) AM_BASE(&ltcasino_tile_atr_ram)
AM_RANGE(0xe800, 0xebff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xec20, 0xec20) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xec21, 0xec21) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0xec20, 0xec21) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
AM_RANGE(0xec30, 0xec3f) AM_WRITE(SMH_RAM)
AM_RANGE(0xf000, 0xffff) AM_WRITE(SMH_ROM)
diff --git a/src/mame/drivers/lucky74.c b/src/mame/drivers/lucky74.c
index 1ce7133e42a..164a8dc34bf 100644
--- a/src/mame/drivers/lucky74.c
+++ b/src/mame/drivers/lucky74.c
@@ -716,7 +716,7 @@ static WRITE8_HANDLER( custom_09R81P_port_w )
lucky74_adpcm_reg[offset] = data;
}
-static WRITE8_HANDLER( ym2149_portb_w )
+static WRITE8_DEVICE_HANDLER( ym2149_portb_w )
{
/* when is in game mode writes 0x0a.
when is in test mode writes 0x0e.
@@ -725,7 +725,7 @@ static WRITE8_HANDLER( ym2149_portb_w )
bit 0 contains the screen orientation.
*/
ym2149_portb = data;
- flip_screen_set(space->machine, data & 0x01);
+ flip_screen_set(device->machine, data & 0x01);
}
static READ8_HANDLER( usart_8251_r )
@@ -828,12 +828,12 @@ static ADDRESS_MAP_START( lucky74_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xf000, 0xf003) AM_DEVREADWRITE(PPI8255, "ppi8255_0", ppi8255_r, ppi8255_w) /* Input Ports 0 & 1 */
AM_RANGE(0xf080, 0xf083) AM_DEVREADWRITE(PPI8255, "ppi8255_2", ppi8255_r, ppi8255_w) /* DSW 1, 2 & 3 */
AM_RANGE(0xf0c0, 0xf0c3) AM_DEVREADWRITE(PPI8255, "ppi8255_3", ppi8255_r, ppi8255_w) /* DSW 4 */
- AM_RANGE(0xf100, 0xf100) AM_WRITE(sn76496_0_w) /* SN76489 #1 */
+ AM_RANGE(0xf100, 0xf100) AM_DEVWRITE(SOUND, "sn1", sn76496_w) /* SN76489 #1 */
AM_RANGE(0xf200, 0xf203) AM_DEVREADWRITE(PPI8255, "ppi8255_1", ppi8255_r, ppi8255_w) /* Input Ports 2 & 4 */
- AM_RANGE(0xf300, 0xf300) AM_WRITE(sn76496_1_w) /* SN76489 #2 */
- AM_RANGE(0xf400, 0xf400) AM_WRITE(ay8910_control_port_0_w) /* YM2149 control */
- AM_RANGE(0xf500, 0xf500) AM_WRITE(sn76496_2_w) /* SN76489 #3 */
- AM_RANGE(0xf600, 0xf600) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w) /* YM2149 (Input Port 1) */
+ AM_RANGE(0xf300, 0xf300) AM_DEVWRITE(SOUND, "sn2", sn76496_w) /* SN76489 #2 */
+ AM_RANGE(0xf400, 0xf400) AM_DEVWRITE(SOUND, "ay", ay8910_address_w) /* YM2149 control */
+ AM_RANGE(0xf500, 0xf500) AM_DEVWRITE(SOUND, "sn3", sn76496_w) /* SN76489 #3 */
+ AM_RANGE(0xf600, 0xf600) AM_DEVREADWRITE(SOUND, "ay", ay8910_r, ay8910_data_w) /* YM2149 (Input Port 1) */
AM_RANGE(0xf700, 0xf701) AM_READWRITE(usart_8251_r, usart_8251_w) /* USART 8251 port */
AM_RANGE(0xf800, 0xf803) AM_READWRITE(copro_sm7831_r, copro_sm7831_w) /* SM7831 Co-Processor */
ADDRESS_MAP_END
@@ -1146,11 +1146,11 @@ static void lucky74_adpcm_int(const device_config *device)
/* transferring 1st nibble */
lucky74_adpcm_data = memory_region(device->machine, "adpcm")[lucky74_adpcm_pos];
lucky74_adpcm_pos = (lucky74_adpcm_pos + 1) & 0xffff;
- msm5205_data_w(0, lucky74_adpcm_data >> 4);
+ msm5205_data_w(device, lucky74_adpcm_data >> 4);
if (lucky74_adpcm_pos == lucky74_adpcm_end)
{
- msm5205_reset_w(0, 0); /* reset the M5205 */
+ msm5205_reset_w(device, 0); /* reset the M5205 */
lucky74_adpcm_reg[05] = 0; /* clean trigger register */
lucky74_adpcm_busy_line = 0x01; /* deactivate busy flag */
logerror("end of sample.\n");
@@ -1159,7 +1159,7 @@ static void lucky74_adpcm_int(const device_config *device)
else
{
/* transferring 2nd nibble */
- msm5205_data_w(0, lucky74_adpcm_data & 0x0f);
+ msm5205_data_w(device, lucky74_adpcm_data & 0x0f);
lucky74_adpcm_data = -1;
}
}
@@ -1221,10 +1221,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_3_r,
- NULL, /* a sort of status byte */
- NULL,
- ym2149_portb_w
+ DEVCB_INPUT_PORT("IN3"),
+ DEVCB_NULL, /* a sort of status byte */
+ DEVCB_NULL,
+ DEVCB_HANDLER(ym2149_portb_w)
};
static const msm5205_interface msm5205_config =
@@ -1284,7 +1284,7 @@ static MACHINE_DRIVER_START( lucky74 )
MDRV_SOUND_ADD("sn3", SN76489, C_06B49P_CLKOUT_03) /* 3 MHz. */
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
- MDRV_SOUND_ADD("ym", AY8910, C_06B49P_CLKOUT_04) /* 1.5 MHz. */
+ MDRV_SOUND_ADD("ay", AY8910, C_06B49P_CLKOUT_04) /* 1.5 MHz. */
MDRV_SOUND_CONFIG(ay8910_config)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.00) /* not routed to audio hardware */
diff --git a/src/mame/drivers/lvcards.c b/src/mame/drivers/lvcards.c
index 4c4c890cfc6..64645c4cc1c 100644
--- a/src/mame/drivers/lvcards.c
+++ b/src/mame/drivers/lvcards.c
@@ -177,8 +177,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( lvcards_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x00, 0x00) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( lvpoker_map, ADDRESS_SPACE_PROGRAM, 8 )
@@ -390,7 +390,7 @@ static INPUT_PORTS_START( ponttehk )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CODE(KEYCODE_3) PORT_NAME("Coinout Sensor") //Token Out
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )//Motor On?
- PORT_START("DSW1")
+ PORT_START("DSW0")
PORT_DIPNAME( 0x07, 0x07, "Winning Percentage" )
PORT_DIPSETTING( 0x06, "70%" )
PORT_DIPSETTING( 0x05, "74%" )
@@ -410,7 +410,7 @@ static INPUT_PORTS_START( ponttehk )
PORT_DIPSETTING( 0x80, "Disabled" )
PORT_DIPSETTING( 0x00, "Enabled" )
- PORT_START("DSW2")
+ PORT_START("DSW1")
PORT_DIPNAME( 0x07, 0x06, DEF_STR( Coin_A ) )
PORT_DIPSETTING( 0x04, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x05, DEF_STR( 2C_1C ) )
@@ -461,10 +461,10 @@ static const ay8910_interface lcay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_3_r, //DSW0
- input_port_4_r, //DSW1
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW0"),
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/lwings.c b/src/mame/drivers/lwings.c
index bd286a40702..b3884521935 100644
--- a/src/mame/drivers/lwings.c
+++ b/src/mame/drivers/lwings.c
@@ -260,12 +260,12 @@ static READ8_HANDLER( avengers_soundlatch2_r )
return(data);
}
-static WRITE8_HANDLER( msm5205_w )
+static WRITE8_DEVICE_HANDLER( msm5205_w )
{
- msm5205_reset_w(offset,(data>>7)&1);
- msm5205_data_w(offset,data);
- msm5205_vclk_w(offset,1);
- msm5205_vclk_w(offset,0);
+ msm5205_reset_w(device,(data>>7)&1);
+ msm5205_data_w(device,data);
+ msm5205_vclk_w(device,1);
+ msm5205_vclk_w(device,0);
}
static ADDRESS_MAP_START( avengers_readmem, ADDRESS_SPACE_PROGRAM, 8 )
@@ -354,10 +354,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xc7ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0xe002, 0xe002) AM_WRITE(ym2203_control_port_1_w)
- AM_RANGE(0xe003, 0xe003) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0xe000, 0xe001) AM_DEVWRITE(SOUND, "2203a", ym2203_w)
+ AM_RANGE(0xe002, 0xe003) AM_DEVWRITE(SOUND, "2203b", ym2203_w)
AM_RANGE(0xe006, 0xe006) AM_WRITE(SMH_RAM) AM_BASE(&avengers_soundlatch2)
ADDRESS_MAP_END
@@ -374,13 +372,13 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( avengers_adpcm_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_READ(avengers_adpcm_r)
- AM_RANGE(0x01, 0x01) AM_WRITE(msm5205_w)
+ AM_RANGE(0x01, 0x01) AM_DEVWRITE(SOUND, "5205", msm5205_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( adpcm_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r)
- AM_RANGE(0x01, 0x01) AM_WRITE(msm5205_w)
+ AM_RANGE(0x01, 0x01) AM_DEVWRITE(SOUND, "5205", msm5205_w)
ADDRESS_MAP_END
/*************************************
diff --git a/src/mame/drivers/m10.c b/src/mame/drivers/m10.c
index fcb1a5c64d7..acaf1ca84a6 100644
--- a/src/mame/drivers/m10.c
+++ b/src/mame/drivers/m10.c
@@ -222,6 +222,7 @@ static MACHINE_RESET( irem )
static WRITE8_HANDLER( m10_ctrl_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
m10_state *state = space->machine->driver_data;
#if DEBUG
@@ -246,27 +247,27 @@ static WRITE8_HANDLER( m10_ctrl_w )
break;
case 0x01:
/* MISSILE sound */
- sample_start_n(0, 0, 0, 0);
+ sample_start(samples, 0, 0, 0);
break;
case 0x02:
/* EXPLOSION sound */
- sample_start_n(0, 1, 1, 0);
+ sample_start(samples, 1, 1, 0);
break;
case 0x03:
/* INVADER HIT sound */
- sample_start_n(0, 2, 2, 0);
+ sample_start(samples, 2, 2, 0);
break;
case 0x04:
/* BONUS BASE sound */
- sample_start_n(0, 3, 8, 0);
+ sample_start(samples, 3, 8, 0);
break;
case 0x05:
/* FLEET MOVE sound */
- sample_start_n(0, 3, 3, 0);
+ sample_start(samples, 3, 3, 0);
break;
case 0x06:
/* SAUCER HIT SOUND */
- sample_start_n(0, 2, 7, 0);
+ sample_start(samples, 2, 7, 0);
break;
default:
popmessage("Unknown sound M10: %02x\n", data & 0x07);
@@ -274,9 +275,9 @@ static WRITE8_HANDLER( m10_ctrl_w )
}
/* UFO SOUND */
if (data & 0x08)
- sample_stop_n(0, 4);
+ sample_stop(samples, 4);
else
- sample_start_n(0, 4, 9, 1);
+ sample_start(samples, 4, 9, 1);
}
@@ -369,6 +370,7 @@ static WRITE8_HANDLER( m10_a500_w )
static WRITE8_HANDLER( m11_a100_w )
{
static int last = 0x00;
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
int raising_bits = data & ~last;
//int falling_bits = ~data & last;
@@ -382,27 +384,28 @@ static WRITE8_HANDLER( m11_a100_w )
// audio control!
/* MISSILE sound */
if (raising_bits & 0x01)
- sample_start_n(0, 0, 0, 0);
+ sample_start(samples, 0, 0, 0);
/* EXPLOSION sound */
if (raising_bits & 0x02)
- sample_start_n(0, 1, 1, 0);
+ sample_start(samples, 1, 1, 0);
/* Rapidly falling parachute */
if (raising_bits & 0x04)
- sample_start_n(0, 3, 8, 0);
+ sample_start(samples, 3, 8, 0);
/* Background sound ? */
if (data & 0x10)
- sample_start_n(0, 4, 9, 1);
+ sample_start(samples, 4, 9, 1);
else
- sample_stop_n(0, 4);
+ sample_stop(samples, 4);
}
static WRITE8_HANDLER( m15_a100_w )
{
static int last = 0x00;
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
//int raising_bits = data & ~last;
int falling_bits = ~data & last;
@@ -425,34 +428,34 @@ static WRITE8_HANDLER( m15_a100_w )
#endif
/* DOT sound */
if (falling_bits & 0x40)
- sample_start_n(0, 0, 0, 0);
+ sample_start(samples, 0, 0, 0);
#if 0
if (raising_bits & 0x40)
- sample_stop_n(0, 0);
+ sample_stop(samples, 0);
#endif
/* EXPLOSION sound */
if (falling_bits & 0x08)
- sample_start_n(0, 1, 1, 0);
+ sample_start(samples, 1, 1, 0);
#if 0
if (raising_bits & 0x08)
- sample_stop_n(0, 1);
+ sample_stop(samples, 1);
#endif
/* player changes lane */
if (falling_bits & 0x10)
- sample_start_n(0, 3, 3, 0);
+ sample_start(samples, 3, 3, 0);
#if 0
if (raising_bits & 0x10)
- sample_stop_n(0, 3);
+ sample_stop(samples, 3);
#endif
/* computer car changes lane */
if (falling_bits & 0x20)
- sample_start_n(0, 4, 4, 0);
+ sample_start(samples, 4, 4, 0);
#if 0
if (raising_bits & 0x20)
- sample_stop_n(0, 4);
+ sample_stop(samples, 4);
#endif
last = data;
diff --git a/src/mame/drivers/m107.c b/src/mame/drivers/m107.c
index 69166652792..b0a04bac040 100644
--- a/src/mame/drivers/m107.c
+++ b/src/mame/drivers/m107.c
@@ -193,9 +193,8 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x00000, 0x1ffff) AM_ROM
AM_RANGE(0x9ff00, 0x9ffff) AM_WRITE(SMH_NOP) /* Irq controller? */
AM_RANGE(0xa0000, 0xa3fff) AM_RAM
- AM_RANGE(0xa8000, 0xa803f) AM_READWRITE(irem_ga20_r, irem_ga20_w)
- AM_RANGE(0xa8040, 0xa8041) AM_WRITE(ym2151_register_port_0_lsb_w)
- AM_RANGE(0xa8042, 0xa8043) AM_READWRITE(ym2151_status_port_0_lsb_r, ym2151_data_port_0_lsb_w)
+ AM_RANGE(0xa8000, 0xa803f) AM_DEVREADWRITE8(SOUND, "irem", irem_ga20_r, irem_ga20_w, 0x00ff)
+ AM_RANGE(0xa8040, 0xa8043) AM_DEVREADWRITE8(SOUND, "ym", ym2151_r, ym2151_w, 0x00ff)
AM_RANGE(0xa8044, 0xa8045) AM_READWRITE(m107_soundlatch_r, m107_sound_irq_ack_w)
AM_RANGE(0xa8046, 0xa8047) AM_WRITE(m107_sound_status_w)
AM_RANGE(0xffff0, 0xfffff) AM_ROM
@@ -419,12 +418,12 @@ GFXDECODE_END
/***************************************************************************/
-static void sound_irq(running_machine *machine, int state)
+static void sound_irq(const device_config *device, int state)
{
if (state)
- timer_call_after_resynch(machine, NULL, YM2151_ASSERT,setvector_callback);
+ timer_call_after_resynch(device->machine, NULL, YM2151_ASSERT,setvector_callback);
else
- timer_call_after_resynch(machine, NULL, YM2151_CLEAR,setvector_callback);
+ timer_call_after_resynch(device->machine, NULL, YM2151_CLEAR,setvector_callback);
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/m63.c b/src/mame/drivers/m63.c
index bef6f591c9e..ceb51c90c5e 100644
--- a/src/mame/drivers/m63.c
+++ b/src/mame/drivers/m63.c
@@ -329,16 +329,17 @@ static WRITE8_HANDLER( snd_irq_w )
static WRITE8_HANDLER( snddata_w )
{
- int num_ays = (sndti_exists(SOUND_AY8910, 1)) ? 2 : 1;
+ const device_config *ay1 = devtag_get_device(space->machine, SOUND, "ay1");
+ const device_config *ay2 = devtag_get_device(space->machine, SOUND, "ay2");
if ((p2 & 0xf0) == 0xe0)
- ay8910_control_port_0_w(space,0,offset);
+ ay8910_address_w(ay1,0,offset);
else if ((p2 & 0xf0) == 0xa0)
- ay8910_write_port_0_w(space,0,offset);
- else if (num_ays == 2 && (p1 & 0xe0) == 0x60)
- ay8910_control_port_1_w(space,0,offset);
- else if (num_ays == 2 && (p1 & 0xe0) == 0x40)
- ay8910_write_port_1_w(space,0,offset);
+ ay8910_data_w(ay1,0,offset);
+ else if (ay2 != NULL && (p1 & 0xe0) == 0x60)
+ ay8910_address_w(ay2,0,offset);
+ else if (ay2 != NULL && (p1 & 0xe0) == 0x40)
+ ay8910_data_w(ay2,0,offset);
else if ((p2 & 0xf0) == 0x70 )
sound_status=offset;
}
@@ -709,7 +710,7 @@ static MACHINE_DRIVER_START( fghtbskt )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("ay", AY8910, XTAL_12MHz/8)
+ MDRV_SOUND_ADD("ay1", AY8910, XTAL_12MHz/8)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD("samples", SAMPLES, 0)
diff --git a/src/mame/drivers/m72.c b/src/mame/drivers/m72.c
index 915456394e4..aeb1752e33a 100644
--- a/src/mame/drivers/m72.c
+++ b/src/mame/drivers/m72.c
@@ -309,10 +309,10 @@ static WRITE8_HANDLER( m72_mcu_high_w )
logerror("high: %02x %02x %08x\n", offset, data, mcu_sample_addr);
}
-static WRITE8_HANDLER( m72_snd_cpu_sample_w )
+static WRITE8_DEVICE_HANDLER( m72_snd_cpu_sample_w )
{
- //dac_signed_data_w(0,data);
- dac_data_w(0,data);
+ //dac_signed_data_w(device, data);
+ dac_data_w(device, data);
}
static READ8_HANDLER( m72_snd_cpu_sample_r )
@@ -322,20 +322,22 @@ static READ8_HANDLER( m72_snd_cpu_sample_r )
INLINE DRIVER_INIT( loht_mcu )
{
- const device_config *cpu = cputag_get_cpu(machine, "main");
- const device_config *sndcpu = cputag_get_cpu(machine, "sound");
+ const address_space *program = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
+ const address_space *io = cputag_get_address_space(machine, "main", ADDRESS_SPACE_IO);
+ const address_space *sndio = cputag_get_address_space(machine, "sound", ADDRESS_SPACE_IO);
+ const device_config *dac = devtag_get_device(machine, SOUND, "dac");
protection_ram = auto_malloc(0x10000);
- memory_install_read16_handler(cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM), 0xb0000, 0xbffff, 0, 0, SMH_BANK1);
- memory_install_write16_handler(cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM), 0xb0000, 0xb0fff, 0, 0, m72_main_mcu_w);
+ memory_install_read16_handler(program, 0xb0000, 0xbffff, 0, 0, SMH_BANK1);
+ memory_install_write16_handler(program, 0xb0000, 0xb0fff, 0, 0, m72_main_mcu_w);
memory_set_bankptr(machine, 1, protection_ram);
- //memory_install_write16_handler(cpu_get_address_space(cpu, ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, loht_sample_trigger_w);
- memory_install_write16_handler(cpu_get_address_space(cpu, ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, m72_main_mcu_sound_w);
+ //memory_install_write16_handler(io, 0xc0, 0xc1, 0, 0, loht_sample_trigger_w);
+ memory_install_write16_handler(io, 0xc0, 0xc1, 0, 0, m72_main_mcu_sound_w);
/* sound cpu */
- memory_install_write8_handler(cpu_get_address_space(sndcpu, ADDRESS_SPACE_IO), 0x82, 0x82, 0xff, 0, m72_snd_cpu_sample_w);
- memory_install_read8_handler (cpu_get_address_space(sndcpu, ADDRESS_SPACE_IO), 0x84, 0x84, 0xff, 0, m72_snd_cpu_sample_r);
+ memory_install_write8_device_handler(sndio, dac, 0x82, 0x82, 0xff, 0, m72_snd_cpu_sample_w);
+ memory_install_read8_handler (sndio, 0x84, 0x84, 0xff, 0, m72_snd_cpu_sample_r);
#if 0
/* running the mcu at twice the speed, the following
@@ -406,7 +408,7 @@ static INTERRUPT_GEN(fake_nmi)
const address_space *space = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
int sample = m72_sample_r(space,0);
if (sample)
- m72_sample_w(space,0,sample);
+ m72_sample_w(devtag_get_device(device->machine, SOUND, "dac"),0,sample);
}
@@ -1029,23 +1031,29 @@ static ADDRESS_MAP_START( sound_rom_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xf000, 0xffff) AM_RAM
ADDRESS_MAP_END
+static ADDRESS_MAP_START( rtype_sound_portmap, ADDRESS_SPACE_IO, 8 )
+ ADDRESS_MAP_GLOBAL_MASK(0xff)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0x02, 0x02) AM_READ(soundlatch_r)
+ AM_RANGE(0x06, 0x06) AM_WRITE(m72_sound_irq_ack_w)
+ AM_RANGE(0x84, 0x84) AM_READ(m72_sample_r)
+ADDRESS_MAP_END
+
static ADDRESS_MAP_START( sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x02, 0x02) AM_READ(soundlatch_r)
AM_RANGE(0x06, 0x06) AM_WRITE(m72_sound_irq_ack_w)
- AM_RANGE(0x82, 0x82) AM_WRITE(m72_sample_w)
+ AM_RANGE(0x82, 0x82) AM_DEVWRITE(SOUND, "dac", m72_sample_w)
AM_RANGE(0x84, 0x84) AM_READ(m72_sample_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( rtype2_sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x80, 0x80) AM_READ(soundlatch_r)
AM_RANGE(0x80, 0x81) AM_WRITE(rtype2_sample_addr_w)
- AM_RANGE(0x82, 0x82) AM_WRITE(m72_sample_w)
+ AM_RANGE(0x82, 0x82) AM_DEVWRITE(SOUND, "dac", m72_sample_w)
AM_RANGE(0x83, 0x83) AM_WRITE(m72_sound_irq_ack_w)
AM_RANGE(0x84, 0x84) AM_READ(m72_sample_r)
ADDRESS_MAP_END
@@ -1053,8 +1061,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( poundfor_sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x10, 0x13) AM_WRITE(poundfor_sample_addr_w)
- AM_RANGE(0x40, 0x40) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x41, 0x41) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x40, 0x41) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x42, 0x42) AM_READ(soundlatch_r)
AM_RANGE(0x42, 0x42) AM_WRITE(m72_sound_irq_ack_w)
ADDRESS_MAP_END
@@ -1789,7 +1796,7 @@ static MACHINE_DRIVER_START( rtype )
MDRV_CPU_ADD("sound",Z80, SOUND_CLOCK)
MDRV_CPU_PROGRAM_MAP(sound_ram_map,0)
- MDRV_CPU_IO_MAP(sound_portmap,0)
+ MDRV_CPU_IO_MAP(rtype_sound_portmap,0)
/* IRQs are generated by main Z80 and YM2151 */
MDRV_MACHINE_START(m72)
diff --git a/src/mame/drivers/m90.c b/src/mame/drivers/m90.c
index 270d5c5f06e..fe96e01d427 100644
--- a/src/mame/drivers/m90.c
+++ b/src/mame/drivers/m90.c
@@ -154,23 +154,21 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x80, 0x80) AM_READ(soundlatch_r)
AM_RANGE(0x80, 0x81) AM_WRITE(rtype2_sample_addr_w)
- AM_RANGE(0x82, 0x82) AM_WRITE(m72_sample_w)
+ AM_RANGE(0x82, 0x82) AM_DEVWRITE(SOUND, "dac", m72_sample_w)
AM_RANGE(0x83, 0x83) AM_WRITE(m72_sound_irq_ack_w)
AM_RANGE(0x84, 0x84) AM_READ(m72_sample_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( bbmanw_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x40, 0x40) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x41, 0x41) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x40, 0x41) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x42, 0x42) AM_READWRITE(soundlatch_r, m72_sound_irq_ack_w)
// AM_RANGE(0x40, 0x41) AM_WRITE(rtype2_sample_addr_w)
// AM_RANGE(0x41, 0x41) AM_READ(m72_sample_r)
-// AM_RANGE(0x42, 0x42) AM_WRITE(m72_sample_w)
+// AM_RANGE(0x42, 0x42) AM_DEVWRITE(SOUND, "dac", m72_sample_w)
ADDRESS_MAP_END
/*****************************************************************************/
diff --git a/src/mame/drivers/m92.c b/src/mame/drivers/m92.c
index c717fcb804e..67f1c5c631b 100644
--- a/src/mame/drivers/m92.c
+++ b/src/mame/drivers/m92.c
@@ -417,9 +417,8 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x00000, 0x1ffff) AM_ROM
AM_RANGE(0x9ff00, 0x9ffff) AM_WRITE(SMH_NOP) /* Irq controller? */
AM_RANGE(0xa0000, 0xa3fff) AM_RAM
- AM_RANGE(0xa8000, 0xa803f) AM_READWRITE(irem_ga20_r, irem_ga20_w)
- AM_RANGE(0xa8040, 0xa8041) AM_WRITE(ym2151_register_port_0_lsb_w)
- AM_RANGE(0xa8042, 0xa8043) AM_READWRITE(ym2151_status_port_0_lsb_r, ym2151_data_port_0_lsb_w)
+ AM_RANGE(0xa8000, 0xa803f) AM_DEVREADWRITE8(SOUND, "irem", irem_ga20_r, irem_ga20_w, 0x00ff)
+ AM_RANGE(0xa8040, 0xa8043) AM_DEVREADWRITE8(SOUND, "ym", ym2151_r, ym2151_w, 0x00ff)
AM_RANGE(0xa8044, 0xa8045) AM_READWRITE(m92_soundlatch_r, m92_sound_irq_ack_w)
AM_RANGE(0xa8046, 0xa8047) AM_WRITE(m92_sound_status_w)
AM_RANGE(0xffff0, 0xfffff) AM_ROM
@@ -894,12 +893,12 @@ GFXDECODE_END
/***************************************************************************/
-static void sound_irq(running_machine *machine, int state)
+static void sound_irq(const device_config *device, int state)
{
if (state)
- timer_call_after_resynch(machine, NULL, YM2151_ASSERT, setvector_callback);
+ timer_call_after_resynch(device->machine, NULL, YM2151_ASSERT, setvector_callback);
else
- timer_call_after_resynch(machine, NULL, YM2151_CLEAR, setvector_callback);
+ timer_call_after_resynch(device->machine, NULL, YM2151_CLEAR, setvector_callback);
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/macrossp.c b/src/mame/drivers/macrossp.c
index 18d09cdf910..d32f5355f5b 100644
--- a/src/mame/drivers/macrossp.c
+++ b/src/mame/drivers/macrossp.c
@@ -462,19 +462,13 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 32 )
ADDRESS_MAP_END
-static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 16 )
- AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM)
- AM_RANGE(0x200000, 0x207fff) AM_READ(SMH_RAM)
- AM_RANGE(0x400000, 0x40007f) AM_READ(es5506_data_0_word_r)
+static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 16 )
+ AM_RANGE(0x000000, 0x0fffff) AM_ROM
+ AM_RANGE(0x200000, 0x207fff) AM_RAM
+ AM_RANGE(0x400000, 0x40007f) AM_DEVREADWRITE8(SOUND, "ensoniq", es5506_r, es5506_w, 0x00ff)
AM_RANGE(0x600000, 0x600001) AM_READ(macrossp_soundcmd_r)
ADDRESS_MAP_END
-static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 16 )
- AM_RANGE(0x000000, 0x0fffff) AM_WRITE(SMH_ROM)
- AM_RANGE(0x200000, 0x207fff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x400000, 0x40007f) AM_WRITE(es5506_data_0_word_w)
-ADDRESS_MAP_END
-
/*** INPUT PORTS *************************************************************/
static INPUT_PORTS_START( macrossp )
@@ -613,13 +607,13 @@ GFXDECODE_END
/*** MACHINE DRIVER **********************************************************/
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
logerror("ES5506 irq %d\n",irq);
/* IRQ lines 1 & 4 on the sound 68000 are definitely triggered by the ES5506,
but I haven't noticed the ES5506 ever assert the line - maybe only used when developing the game? */
-// cpu_set_input_line(machine->cpu[1],1,irq ? ASSERT_LINE : CLEAR_LINE);
+// cpu_set_input_line(device->cpu[1],1,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const es5506_interface es5506_config =
@@ -639,7 +633,7 @@ static MACHINE_DRIVER_START( macrossp )
MDRV_CPU_VBLANK_INT("main", irq3_line_hold) // there are others ...
MDRV_CPU_ADD("audio", M68000, 32000000/2) /* 16 MHz */
- MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
+ MDRV_CPU_PROGRAM_MAP(sound_map,0)
/* video hardware */
MDRV_SCREEN_ADD("main", RASTER)
diff --git a/src/mame/drivers/macs.c b/src/mame/drivers/macs.c
index c5a0e60bd54..9b33838b7ee 100644
--- a/src/mame/drivers/macs.c
+++ b/src/mame/drivers/macs.c
@@ -74,7 +74,7 @@ static ADDRESS_MAP_START( macs_mem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xd000, 0xdfff) AM_READ(st0016_sprite2_ram_r) AM_WRITE(st0016_sprite2_ram_w)
AM_RANGE(0xe000, 0xe7ff) AM_RAM /* work ram ? */
AM_RANGE(0xe800, 0xe87f) AM_RAM AM_BASE(&macs_ram2)
- AM_RANGE(0xe900, 0xe9ff) AM_RAM_WRITE(st0016_snd_w) AM_BASE(&st0016_sound_regs)
+ AM_RANGE(0xe900, 0xe9ff) AM_DEVREADWRITE(SOUND, "st", st0016_snd_r, st0016_snd_w)
AM_RANGE(0xea00, 0xebff) AM_READ(st0016_palette_ram_r) AM_WRITE(st0016_palette_ram_w)
AM_RANGE(0xec00, 0xec1f) AM_READ(st0016_character_ram_r) AM_WRITE(st0016_character_ram_w)
AM_RANGE(0xf000, 0xf7ff) AM_RAMBANK(3) /* common /backup ram ?*/
diff --git a/src/mame/drivers/madalien.c b/src/mame/drivers/madalien.c
index 080f5fd7172..1dba6d5ea33 100644
--- a/src/mame/drivers/madalien.c
+++ b/src/mame/drivers/madalien.c
@@ -70,13 +70,13 @@ static READ8_HANDLER(madalien_sound_command_r )
}
-static WRITE8_HANDLER( madalien_portA_w )
+static WRITE8_DEVICE_HANDLER( madalien_portA_w )
{
- discrete_sound_w(space, MADALIEN_8910_PORTA, data);
+ discrete_sound_w(device, MADALIEN_8910_PORTA, data);
}
-static WRITE8_HANDLER( madalien_portB_w )
+static WRITE8_DEVICE_HANDLER( madalien_portB_w )
{
- discrete_sound_w(space, MADALIEN_8910_PORTB, data);
+ discrete_sound_w(device, MADALIEN_8910_PORTB, data);
}
@@ -112,8 +112,7 @@ static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x1c00) AM_RAM
AM_RANGE(0x6000, 0x6003) AM_MIRROR(0x1ffc) AM_RAM /* unknown device in an epoxy block, might be tilt detection */
AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x1ffc) AM_READ(madalien_sound_command_r)
- AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x1ffc) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x8001, 0x8001) AM_MIRROR(0x1ffc) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x8000, 0x8001) AM_MIRROR(0x1ffc) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
AM_RANGE(0x8002, 0x8002) AM_MIRROR(0x1ffc) AM_WRITE(soundlatch2_w)
AM_RANGE(0xf800, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -166,10 +165,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- madalien_portA_w,
- madalien_portB_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_DEVICE_HANDLER(SOUND, "discrete", madalien_portA_w),
+ DEVCB_DEVICE_HANDLER(SOUND, "discrete", madalien_portB_w)
};
diff --git a/src/mame/drivers/madmotor.c b/src/mame/drivers/madmotor.c
index 4ef65bbe808..358b1c8dcbe 100644
--- a/src/mame/drivers/madmotor.c
+++ b/src/mame/drivers/madmotor.c
@@ -85,47 +85,23 @@ ADDRESS_MAP_END
/******************************************************************************/
-static WRITE8_HANDLER( YM2151_w )
-{
- switch (offset) {
- case 0:
- ym2151_register_port_0_w(space,0,data);
- break;
- case 1:
- ym2151_data_port_0_w(space,0,data);
- break;
- }
-}
-
-static WRITE8_HANDLER( YM2203_w )
-{
- switch (offset) {
- case 0:
- ym2203_control_port_0_w(space,0,data);
- break;
- case 1:
- ym2203_write_port_0_w(space,0,data);
- break;
- }
-}
-
/* Physical memory map (21 bits) */
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_READ(SMH_ROM)
- AM_RANGE(0x100000, 0x100001) AM_READ(ym2203_status_port_0_r)
- AM_RANGE(0x110000, 0x110001) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0x120000, 0x120001) AM_READ(okim6295_status_0_r)
- AM_RANGE(0x130000, 0x130001) AM_READ(okim6295_status_1_r)
+ AM_RANGE(0x100000, 0x100001) AM_DEVREAD(SOUND, "ym1", ym2203_r)
+ AM_RANGE(0x110000, 0x110001) AM_DEVREAD(SOUND, "ym2", ym2151_r)
+ AM_RANGE(0x120000, 0x120001) AM_DEVREAD(SOUND, "oki1", okim6295_r)
+ AM_RANGE(0x130000, 0x130001) AM_DEVREAD(SOUND, "oki2", okim6295_r)
AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
AM_RANGE(0x1f0000, 0x1f1fff) AM_READ(SMH_BANK8)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_WRITE(SMH_ROM)
- AM_RANGE(0x100000, 0x100001) AM_WRITE(YM2203_w)
- AM_RANGE(0x110000, 0x110001) AM_WRITE(YM2151_w)
- AM_RANGE(0x120000, 0x120001) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0x130000, 0x130001) AM_WRITE(okim6295_data_1_w)
+ AM_RANGE(0x100000, 0x100001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x110000, 0x110001) AM_DEVWRITE(SOUND, "ym2", ym2151_w)
+ AM_RANGE(0x120000, 0x120001) AM_DEVWRITE(SOUND, "oki1", okim6295_w)
+ AM_RANGE(0x130000, 0x130001) AM_DEVWRITE(SOUND, "oki2", okim6295_w)
AM_RANGE(0x1f0000, 0x1f1fff) AM_WRITE(SMH_BANK8)
AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w)
AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w)
@@ -272,9 +248,9 @@ GFXDECODE_END
/******************************************************************************/
-static void sound_irq(running_machine *machine, int state)
+static void sound_irq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1],1,state); /* IRQ 2 */
+ cpu_set_input_line(device->machine->cpu[1],1,state); /* IRQ 2 */
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/magic10.c b/src/mame/drivers/magic10.c
index 34f91277a8e..4a2c6164dc4 100644
--- a/src/mame/drivers/magic10.c
+++ b/src/mame/drivers/magic10.c
@@ -268,7 +268,7 @@ static ADDRESS_MAP_START( magic10_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x400000, 0x400001) AM_READ_PORT("INPUTS")
AM_RANGE(0x400002, 0x400003) AM_READ_PORT("DSW")
AM_RANGE(0x400008, 0x400009) AM_WRITE(magic10_out_w)
- AM_RANGE(0x40000a, 0x40000b) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x40000a, 0x40000b) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x40000e, 0x40000f) AM_WRITENOP
AM_RANGE(0x400080, 0x400087) AM_RAM AM_BASE(&magic10_vregs)
AM_RANGE(0x600000, 0x603fff) AM_RAM
@@ -284,7 +284,7 @@ static ADDRESS_MAP_START( magic10a_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x500000, 0x500001) AM_READ_PORT("INPUTS")
AM_RANGE(0x500002, 0x500003) AM_READ_PORT("DSW")
AM_RANGE(0x500008, 0x500009) AM_WRITE(magic10_out_w)
- AM_RANGE(0x50000a, 0x50000b) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x50000a, 0x50000b) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x50000e, 0x50000f) AM_WRITENOP
AM_RANGE(0x500080, 0x500087) AM_RAM AM_BASE(&magic10_vregs) // video registers?
AM_RANGE(0x600000, 0x603fff) AM_RAM
@@ -305,7 +305,7 @@ static ADDRESS_MAP_START( magic102_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x500002, 0x50001f) AM_READNOP
AM_RANGE(0x500002, 0x50001f) AM_WRITENOP
AM_RANGE(0x600000, 0x603fff) AM_RAM
- AM_RANGE(0x700000, 0x700001) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x700000, 0x700001) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x700080, 0x700087) AM_RAM AM_BASE(&magic10_vregs) // video registers?
ADDRESS_MAP_END
@@ -324,7 +324,7 @@ static ADDRESS_MAP_START( hotslot_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x500018, 0x500019) AM_READ_PORT("DSW1")
AM_RANGE(0x50001a, 0x50001d) AM_WRITENOP
AM_RANGE(0x600000, 0x603fff) AM_RAM
- AM_RANGE(0x70000a, 0x70000b) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x70000a, 0x70000b) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x700080, 0x700087) AM_RAM AM_BASE(&magic10_vregs)
ADDRESS_MAP_END
@@ -337,7 +337,7 @@ static ADDRESS_MAP_START( sgsafari_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x300000, 0x3001ff) AM_RAM_WRITE(paletteram_w) AM_BASE(&paletteram16)
AM_RANGE(0x500002, 0x500003) AM_READ_PORT("DSW1")
AM_RANGE(0x500008, 0x500009) AM_WRITE(magic10_out_w)
- AM_RANGE(0x50000a, 0x50000b) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x50000a, 0x50000b) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x50000e, 0x50000f) AM_READ_PORT("IN0")
AM_RANGE(0x500080, 0x500087) AM_RAM AM_BASE(&magic10_vregs) // video registers?
AM_RANGE(0x600000, 0x603fff) AM_RAM
diff --git a/src/mame/drivers/magicard.c b/src/mame/drivers/magicard.c
index 7d3d6242a34..317446c6719 100644
--- a/src/mame/drivers/magicard.c
+++ b/src/mame/drivers/magicard.c
@@ -378,8 +378,7 @@ static ADDRESS_MAP_START( magicard_mem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x1ffc40, 0x1ffc41) AM_READ(test_r)
AM_RANGE(0x1ffd00, 0x1ffd05) AM_WRITE(paletteram_io_w) //RAMDAC
/*not the right sound chip,unknown type,it should be an ADPCM with 8 channels.*/
- AM_RANGE(0x1ffd40, 0x1ffd41) AM_WRITE(ym2413_register_port_0_lsb_w)
- AM_RANGE(0x1ffd42, 0x1ffd43) AM_WRITE(ym2413_data_port_0_lsb_w)
+ AM_RANGE(0x1ffd40, 0x1ffd43) AM_DEVWRITE8(SOUND, "ym", ym2413_w, 0x00ff)
AM_RANGE(0x1ffd80, 0x1ffd81) AM_READ(test_r)
AM_RANGE(0x1ffd80, 0x1ffd81) AM_WRITENOP //?
AM_RANGE(0x1fff80, 0x1fffbf) AM_RAM //DRAM I/O, not accessed by this game, CD buffer?
diff --git a/src/mame/drivers/magicfly.c b/src/mame/drivers/magicfly.c
index 49dbe810dc5..c1f4c052306 100644
--- a/src/mame/drivers/magicfly.c
+++ b/src/mame/drivers/magicfly.c
@@ -540,7 +540,7 @@ static WRITE8_HANDLER( mux_port_w )
*/
input_selector = data & 0x0f; /* Input Selector */
- dac_data_w(0, data & 0x80); /* Sound DAC */
+ dac_data_w(devtag_get_device(space->machine, SOUND, "dac"), data & 0x80); /* Sound DAC */
coin_counter_w(0, data & 0x40); /* Coin1 */
coin_counter_w(1, data & 0x10); /* Coin2 */
diff --git a/src/mame/drivers/magmax.c b/src/mame/drivers/magmax.c
index 18692161d0f..640f98c4da8 100644
--- a/src/mame/drivers/magmax.c
+++ b/src/mame/drivers/magmax.c
@@ -64,7 +64,7 @@ static READ8_HANDLER( magmax_sound_r )
return (sound_latch | LS74_q);
}
-static WRITE8_HANDLER( ay8910_portB_0_w )
+static WRITE8_DEVICE_HANDLER( ay8910_portB_0_w )
{
/*bit 0 is input to CLR line of the LS74*/
LS74_clr = data & 1;
@@ -114,8 +114,11 @@ static MACHINE_RESET( magmax )
-static WRITE8_HANDLER( ay8910_portA_0_w )
+static WRITE8_DEVICE_HANDLER( ay8910_portA_0_w )
{
+const device_config *ay1 = devtag_get_device(device->machine, SOUND, "ay1");
+const device_config *ay2 = devtag_get_device(device->machine, SOUND, "ay2");
+const device_config *ay3 = devtag_get_device(device->machine, SOUND, "ay3");
float percent;
/*There are three AY8910 chips and four(!) separate amplifiers on the board
@@ -170,26 +173,26 @@ bit3 - SOUND Chan#8 name=AY-3-8910 #2 Ch C
/*popmessage("gain_ctrl = %2x",data&0x0f);*/
percent = (gain_control & 1) ? 1.0 : 0.50;
- sndti_set_output_gain(SOUND_AY8910, 0, 0, percent);
+ sound_set_output_gain(ay1, 0, percent);
//fixme: set_RC_filter(0,10000,100000000,0,10000); /* 10K, 10000pF = 0.010uF */
percent = (gain_control & 2) ? 0.45 : 0.23;
- sndti_set_output_gain(SOUND_AY8910, 0, 1, percent);
- sndti_set_output_gain(SOUND_AY8910, 0, 2, percent);
- sndti_set_output_gain(SOUND_AY8910, 1, 0, percent);
- sndti_set_output_gain(SOUND_AY8910, 1, 1, percent);
+ sound_set_output_gain(ay1, 1, percent);
+ sound_set_output_gain(ay1, 2, percent);
+ sound_set_output_gain(ay2, 0, percent);
+ sound_set_output_gain(ay2, 1, percent);
//fixme: set_RC_filter(1,4700,100000000,0,4700); /* 4.7K, 4700pF = 0.0047uF */
//fixme: set_RC_filter(2,4700,100000000,0,4700); /* 4.7K, 4700pF = 0.0047uF */
//fixme: set_RC_filter(3,4700,100000000,0,4700); /* 4.7K, 4700pF = 0.0047uF */
//fixme: set_RC_filter(4,4700,100000000,0,4700); /* 4.7K, 4700pF = 0.0047uF */
percent = (gain_control & 4) ? 0.45 : 0.23;
- sndti_set_output_gain(SOUND_AY8910, 1, 2, percent);
- sndti_set_output_gain(SOUND_AY8910, 2, 0, percent);
+ sound_set_output_gain(ay2, 2, percent);
+ sound_set_output_gain(ay3, 0, percent);
percent = (gain_control & 8) ? 0.45 : 0.23;
- sndti_set_output_gain(SOUND_AY8910, 2, 1, percent);
- sndti_set_output_gain(SOUND_AY8910, 2, 2, percent);
+ sound_set_output_gain(ay3, 1, percent);
+ sound_set_output_gain(ay3, 2, percent);
}
static WRITE16_HANDLER( magmax_vreg_w )
@@ -243,12 +246,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( magmax_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x02, 0x02) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x04, 0x04) AM_WRITE(ay8910_control_port_2_w)
- AM_RANGE(0x05, 0x05) AM_WRITE(ay8910_write_port_2_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x02, 0x03) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x04, 0x05) AM_DEVWRITE(SOUND, "ay3", ay8910_address_data_w)
AM_RANGE(0x06, 0x06) AM_READ(magmax_sound_r)
ADDRESS_MAP_END
@@ -360,10 +360,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- ay8910_portA_0_w, /*write port A*/
- ay8910_portB_0_w /*write port B*/
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(ay8910_portA_0_w), /*write port A*/
+ DEVCB_HANDLER(ay8910_portB_0_w) /*write port B*/
};
diff --git a/src/mame/drivers/mainevt.c b/src/mame/drivers/mainevt.c
index d492e6c6a36..9d1074389c5 100644
--- a/src/mame/drivers/mainevt.c
+++ b/src/mame/drivers/mainevt.c
@@ -94,10 +94,16 @@ static WRITE8_HANDLER( mainevt_sh_irqtrigger_w )
cpu_set_input_line_and_vector(space->machine->cpu[1],0,HOLD_LINE,0xff);
}
+static READ8_DEVICE_HANDLER( mainevt_sh_busy_r )
+{
+ return upd7759_busy_r(device);
+}
+
static WRITE8_HANDLER( mainevt_sh_irqcontrol_w )
{
- upd7759_reset_w(0, data & 2);
- upd7759_start_w(0, data & 1);
+ const device_config *upd = devtag_get_device(space->machine, SOUND, "upd");
+ upd7759_reset_w(upd, data & 2);
+ upd7759_start_w(upd, data & 1);
interrupt_enable_w(space,0,data & 4);
}
@@ -116,13 +122,13 @@ static WRITE8_HANDLER( mainevt_sh_bankswitch_w )
/* bits 0-3 select the 007232 banks */
bank_A=(data&0x3);
bank_B=((data>>2)&0x3);
- k007232_set_bank( 0, bank_A, bank_B );
+ k007232_set_bank( devtag_get_device(space->machine, SOUND, "konami"), bank_A, bank_B );
/* bits 4-5 select the UPD7759 bank */
- upd7759_set_bank_base(0, ((data >> 4) & 0x03) * 0x20000);
+ upd7759_set_bank_base(devtag_get_device(space->machine, SOUND, "upd"), ((data >> 4) & 0x03) * 0x20000);
}
-static WRITE8_HANDLER( dv_sh_bankswitch_w )
+static WRITE8_DEVICE_HANDLER( dv_sh_bankswitch_w )
{
int bank_A,bank_B;
@@ -131,7 +137,7 @@ static WRITE8_HANDLER( dv_sh_bankswitch_w )
/* bits 0-3 select the 007232 banks */
bank_A=(data&0x3);
bank_B=((data>>2)&0x3);
- k007232_set_bank( 0, bank_A, bank_B );
+ k007232_set_bank( device, bank_A, bank_B );
}
@@ -199,15 +205,15 @@ static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x83ff) AM_READ(SMH_RAM)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
- AM_RANGE(0xb000, 0xb00d) AM_READ(k007232_read_port_0_r)
- AM_RANGE(0xd000, 0xd000) AM_READ(upd7759_0_busy_r)
+ AM_RANGE(0xb000, 0xb00d) AM_DEVREAD(SOUND, "konami", k007232_r)
+ AM_RANGE(0xd000, 0xd000) AM_DEVREAD(SOUND, "upd", mainevt_sh_busy_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x83ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xb000, 0xb00d) AM_WRITE(k007232_write_port_0_w)
- AM_RANGE(0x9000, 0x9000) AM_WRITE(upd7759_0_port_w)
+ AM_RANGE(0xb000, 0xb00d) AM_DEVWRITE(SOUND, "konami", k007232_w)
+ AM_RANGE(0x9000, 0x9000) AM_DEVWRITE(SOUND, "upd", upd7759_port_w)
AM_RANGE(0xe000, 0xe000) AM_WRITE(mainevt_sh_irqcontrol_w)
AM_RANGE(0xf000, 0xf000) AM_WRITE(mainevt_sh_bankswitch_w)
ADDRESS_MAP_END
@@ -216,18 +222,17 @@ static ADDRESS_MAP_START( dv_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x83ff) AM_READ(SMH_RAM)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
- AM_RANGE(0xb000, 0xb00d) AM_READ(k007232_read_port_0_r)
- AM_RANGE(0xc001, 0xc001) AM_READ(ym2151_status_port_0_r)
+ AM_RANGE(0xb000, 0xb00d) AM_DEVREAD(SOUND, "konami", k007232_r)
+ AM_RANGE(0xc000, 0xc001) AM_DEVREAD(SOUND, "ym", ym2151_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( dv_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x83ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xb000, 0xb00d) AM_WRITE(k007232_write_port_0_w)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ym2151_data_port_0_w)
+ AM_RANGE(0xb000, 0xb00d) AM_DEVWRITE(SOUND, "konami", k007232_w)
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ym", ym2151_w)
AM_RANGE(0xe000, 0xe000) AM_WRITE(devstor_sh_irqcontrol_w)
- AM_RANGE(0xf000, 0xf000) AM_WRITE(dv_sh_bankswitch_w)
+ AM_RANGE(0xf000, 0xf000) AM_DEVWRITE(SOUND, "konami", dv_sh_bankswitch_w)
ADDRESS_MAP_END
@@ -479,10 +484,10 @@ INPUT_PORTS_END
/*****************************************************************************/
-static void volume_callback(int v)
+static void volume_callback(const device_config *device, int v)
{
- k007232_set_volume(0,0,(v >> 4) * 0x11,0);
- k007232_set_volume(0,1,0,(v & 0x0f) * 0x11);
+ k007232_set_volume(device,0,(v >> 4) * 0x11,0);
+ k007232_set_volume(device,1,0,(v & 0x0f) * 0x11);
}
static const k007232_interface k007232_config =
diff --git a/src/mame/drivers/mainsnk.c b/src/mame/drivers/mainsnk.c
index 06d6f115d25..28606e7e1c2 100644
--- a/src/mame/drivers/mainsnk.c
+++ b/src/mame/drivers/mainsnk.c
@@ -170,11 +170,9 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0x87ff) AM_RAM
AM_RANGE(0xa000, 0xa000) AM_READ(sound_command_r)
AM_RANGE(0xc000, 0xc000) AM_READ(sound_ack_r)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0xe000, 0xe001) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
AM_RANGE(0xe002, 0xe003) AM_WRITENOP // ? always FFFF, snkwave leftover?
- AM_RANGE(0xe008, 0xe008) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0xe009, 0xe009) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0xe008, 0xe009) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_portmap, ADDRESS_SPACE_IO, 8 )
diff --git a/src/mame/drivers/mappy.c b/src/mame/drivers/mappy.c
index b193149b158..12ca3eb29f0 100644
--- a/src/mame/drivers/mappy.c
+++ b/src/mame/drivers/mappy.c
@@ -688,10 +688,10 @@ static DRIVER_INIT( 58_56 )
/***************************************************************************/
-static WRITE8_HANDLER( mappy_snd_sharedram_w )
+static WRITE8_DEVICE_HANDLER( mappy_snd_sharedram_w )
{
if (offset < 0x40)
- namco_15xx_w(space,offset,data);
+ namco_15xx_w(device,offset,data);
else
namco_soundregs[offset] = data;
}
@@ -718,7 +718,7 @@ static WRITE8_HANDLER( superpac_latch_w )
break;
case 0x06: /* SOUND ON */
- mappy_sound_enable(bit);
+ mappy_sound_enable(devtag_get_device(space->machine, SOUND, "namco"), bit);
break;
case 0x08: /* 4 RESET */
@@ -763,7 +763,7 @@ static WRITE8_HANDLER( phozon_latch_w )
break;
case 0x06:
- mappy_sound_enable(bit);
+ mappy_sound_enable(devtag_get_device(space->machine, SOUND, "namco"), bit);
break;
case 0x08:
@@ -807,7 +807,7 @@ static WRITE8_HANDLER( mappy_latch_w )
break;
case 0x06: /* SOUND ON */
- mappy_sound_enable(bit);
+ mappy_sound_enable(devtag_get_device(space->machine, SOUND, "namco"), bit);
break;
case 0x08: /* 4 RESET */
@@ -873,7 +873,7 @@ static ADDRESS_MAP_START( superpac_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(superpac_videoram_w) AM_BASE(&mappy_videoram) /* video RAM */
AM_RANGE(0x0800, 0x1fff) AM_RAM AM_BASE(&mappy_spriteram) /* work RAM with embedded sprite RAM */
AM_RANGE(0x2000, 0x2000) AM_READWRITE(superpac_flipscreen_r, superpac_flipscreen_w)
- AM_RANGE(0x4000, 0x43ff) AM_RAM_WRITE(mappy_snd_sharedram_w) AM_SHARE(1) /* shared RAM with the sound CPU */
+ AM_RANGE(0x4000, 0x43ff) AM_RAM AM_DEVWRITE(SOUND, "namco", mappy_snd_sharedram_w) AM_SHARE(1) /* shared RAM with the sound CPU */
AM_RANGE(0x4800, 0x4bff) AM_READWRITE(namcoio_r, namcoio_w) /* custom I/O chips interface */
AM_RANGE(0x5000, 0x500f) AM_WRITE(superpac_latch_w) /* various control bits */
AM_RANGE(0x8000, 0x8000) AM_WRITE(watchdog_reset_w)
@@ -883,7 +883,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( phozon_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(superpac_videoram_w) AM_SHARE(2) AM_BASE(&mappy_videoram) /* video RAM */
AM_RANGE(0x0800, 0x1fff) AM_RAM AM_BASE(&mappy_spriteram) AM_SHARE(3) /* shared RAM with CPU #2/sprite RAM*/
- AM_RANGE(0x4000, 0x43ff) AM_RAM_WRITE(mappy_snd_sharedram_w) AM_SHARE(1) /* shared RAM with the sound CPU */
+ AM_RANGE(0x4000, 0x43ff) AM_RAM AM_DEVWRITE(SOUND, "namco", mappy_snd_sharedram_w) AM_SHARE(1) /* shared RAM with the sound CPU */
AM_RANGE(0x4800, 0x4bff) AM_READWRITE(namcoio_r, namcoio_w) /* custom I/O chips interface */
AM_RANGE(0x5000, 0x500f) AM_WRITE(phozon_latch_w) /* various control bits */
AM_RANGE(0x7000, 0x7000) AM_WRITE(watchdog_reset_w) /* watchdog reset */
@@ -894,7 +894,7 @@ static ADDRESS_MAP_START( mappy_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_RAM_WRITE(mappy_videoram_w) AM_BASE(&mappy_videoram) /* video RAM */
AM_RANGE(0x1000, 0x27ff) AM_RAM AM_BASE(&mappy_spriteram) /* work RAM with embedded sprite RAM */
AM_RANGE(0x3800, 0x3fff) AM_WRITE(mappy_scroll_w) /* scroll */
- AM_RANGE(0x4000, 0x43ff) AM_RAM_WRITE(mappy_snd_sharedram_w) AM_SHARE(1) /* shared RAM with the sound CPU */
+ AM_RANGE(0x4000, 0x43ff) AM_RAM AM_DEVWRITE(SOUND, "namco", mappy_snd_sharedram_w) AM_SHARE(1) /* shared RAM with the sound CPU */
AM_RANGE(0x4800, 0x4bff) AM_READWRITE(namcoio_r, namcoio_w) /* custom I/O chips interface */
AM_RANGE(0x5000, 0x500f) AM_WRITE(mappy_latch_w) /* various control bits */
AM_RANGE(0x8000, 0x8000) AM_WRITE(watchdog_reset_w) /* watchdog reset */
@@ -903,18 +903,18 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( superpac_cpu2_map, ADDRESS_SPACE_PROGRAM, 8 )
- AM_RANGE(0x0000, 0x03ff) AM_RAM_WRITE(mappy_snd_sharedram_w) AM_SHARE(1) AM_BASE(&namco_soundregs) /* shared RAM with the main CPU (also sound registers) */
+ AM_RANGE(0x0000, 0x03ff) AM_RAM AM_DEVWRITE(SOUND, "namco", mappy_snd_sharedram_w) AM_SHARE(1) AM_BASE(&namco_soundregs) /* shared RAM with the main CPU (also sound registers) */
AM_RANGE(0x2000, 0x200f) AM_WRITE(superpac_latch_w) /* various control bits */
AM_RANGE(0xe000, 0xffff) AM_ROM
ADDRESS_MAP_END
static ADDRESS_MAP_START( phozon_cpu2_map, ADDRESS_SPACE_PROGRAM, 8 )
- AM_RANGE(0x0000, 0x03ff) AM_RAM_WRITE(mappy_snd_sharedram_w) AM_SHARE(1) AM_BASE(&namco_soundregs) /* shared RAM with the main CPU + sound registers */
+ AM_RANGE(0x0000, 0x03ff) AM_RAM AM_DEVWRITE(SOUND, "namco", mappy_snd_sharedram_w) AM_SHARE(1) AM_BASE(&namco_soundregs) /* shared RAM with the main CPU + sound registers */
AM_RANGE(0xe000, 0xffff) AM_ROM /* ROM */
ADDRESS_MAP_END
static ADDRESS_MAP_START( mappy_cpu2_map, ADDRESS_SPACE_PROGRAM, 8 )
- AM_RANGE(0x0000, 0x03ff) AM_RAM_WRITE(mappy_snd_sharedram_w) AM_SHARE(1) AM_BASE(&namco_soundregs) /* shared RAM with the main CPU (also sound registers) */
+ AM_RANGE(0x0000, 0x03ff) AM_RAM AM_DEVWRITE(SOUND, "namco", mappy_snd_sharedram_w) AM_SHARE(1) AM_BASE(&namco_soundregs) /* shared RAM with the main CPU (also sound registers) */
AM_RANGE(0x2000, 0x200f) AM_WRITE(mappy_latch_w) /* various control bits */
AM_RANGE(0xe000, 0xffff) AM_ROM /* ROM code */
ADDRESS_MAP_END
@@ -924,7 +924,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( phozon_cpu3_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(superpac_videoram_w) AM_SHARE(2) /* video RAM */
AM_RANGE(0x0800, 0x1fff) AM_RAM AM_SHARE(3) /* shared RAM with CPU #2/sprite RAM*/
- AM_RANGE(0x4000, 0x43ff) AM_RAM_WRITE(mappy_snd_sharedram_w) AM_SHARE(1) /* shared RAM with CPU #2 */
+ AM_RANGE(0x4000, 0x43ff) AM_RAM AM_DEVWRITE(SOUND, "namco", mappy_snd_sharedram_w) AM_SHARE(1) /* shared RAM with CPU #2 */
AM_RANGE(0xa000, 0xa7ff) AM_RAM /* RAM */
AM_RANGE(0xe000, 0xffff) AM_ROM /* ROM */
ADDRESS_MAP_END
@@ -2117,9 +2117,9 @@ ROM_END
-static WRITE8_HANDLER( grobda_DAC_w )
+static WRITE8_DEVICE_HANDLER( grobda_DAC_w )
{
- dac_data_w(0, (data << 4) | data);
+ dac_data_w(device, (data << 4) | data);
}
static DRIVER_INIT( grobda )
@@ -2132,7 +2132,8 @@ static DRIVER_INIT( grobda )
However, removing the 15XX from the board causes sound to disappear completely, so
the DAC might be built-in after all.
*/
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0002, 0x0002, 0, 0, grobda_DAC_w );
+ const device_config *dac = devtag_get_device(machine, SOUND, "dac");
+ memory_install_write8_device_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), dac, 0x0002, 0x0002, 0, 0, grobda_DAC_w );
DRIVER_INIT_CALL(58_56);
}
diff --git a/src/mame/drivers/marineb.c b/src/mame/drivers/marineb.c
index 80441dfdd0b..9607c45b8bf 100644
--- a/src/mame/drivers/marineb.c
+++ b/src/mame/drivers/marineb.c
@@ -73,16 +73,13 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( marineb_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x08, 0x08) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x09, 0x09) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x08, 0x09) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( wanted_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x02, 0x02) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x02, 0x03) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
ADDRESS_MAP_END
@@ -533,7 +530,7 @@ static MACHINE_DRIVER_START( marineb )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("8910", AY8910, 1500000)
+ MDRV_SOUND_ADD("ay1", AY8910, 1500000)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MACHINE_DRIVER_END
@@ -584,10 +581,10 @@ static MACHINE_DRIVER_START( wanted )
MDRV_VIDEO_UPDATE(springer)
/* sound hardware */
- MDRV_SOUND_REPLACE("8910", AY8910, 1500000)
+ MDRV_SOUND_REPLACE("ay1", AY8910, 1500000)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
- MDRV_SOUND_ADD("ay", AY8910, 1500000)
+ MDRV_SOUND_ADD("ay2", AY8910, 1500000)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/mario.c b/src/mame/drivers/mario.c
index b71c1cc6e03..a45266bb357 100644
--- a/src/mame/drivers/mario.c
+++ b/src/mame/drivers/mario.c
@@ -149,8 +149,8 @@ static ADDRESS_MAP_START( mario_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x6000, 0x6fff) AM_RAM
AM_RANGE(0x7000, 0x73ff) AM_RAM AM_BASE_MEMBER(mario_state, spriteram) AM_SIZE_MEMBER(mario_state, spriteram_size) /* physical sprite ram */
AM_RANGE(0x7400, 0x77ff) AM_RAM_WRITE(mario_videoram_w) AM_BASE_MEMBER(mario_state, videoram)
- AM_RANGE(0x7c00, 0x7c00) AM_READ_PORT("IN0") AM_WRITE(mario_sh1_w) /* Mario run sample */
- AM_RANGE(0x7c80, 0x7c80) AM_READ_PORT("IN1") AM_WRITE(mario_sh2_w) /* Luigi run sample */
+ AM_RANGE(0x7c00, 0x7c00) AM_READ_PORT("IN0") AM_DEVWRITE(SOUND, "discrete", mario_sh1_w) /* Mario run sample */
+ AM_RANGE(0x7c80, 0x7c80) AM_READ_PORT("IN1") AM_DEVWRITE(SOUND, "discrete", mario_sh2_w) /* Luigi run sample */
AM_RANGE(0x7d00, 0x7d00) AM_WRITE(mario_scroll_w)
AM_RANGE(0x7e80, 0x7e80) AM_WRITE(mario_gfxbank_w)
AM_RANGE(0x7e82, 0x7e82) AM_WRITE(mario_flip_w)
diff --git a/src/mame/drivers/markham.c b/src/mame/drivers/markham.c
index 653a5942eea..5d1fe90450d 100644
--- a/src/mame/drivers/markham.c
+++ b/src/mame/drivers/markham.c
@@ -73,8 +73,8 @@ static ADDRESS_MAP_START( writemem2, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x5fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM) AM_SHARE(1)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(sn76496_0_w)
- AM_RANGE(0xc001, 0xc001) AM_WRITE(sn76496_1_w)
+ AM_RANGE(0xc000, 0xc000) AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0xc001, 0xc001) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
AM_RANGE(0xc002, 0xc002) AM_WRITE(SMH_NOP) /* unknown */
AM_RANGE(0xc003, 0xc003) AM_WRITE(SMH_NOP) /* unknown */
diff --git a/src/mame/drivers/mastboy.c b/src/mame/drivers/mastboy.c
index 53c61039137..cf29269459a 100644
--- a/src/mame/drivers/mastboy.c
+++ b/src/mame/drivers/mastboy.c
@@ -609,25 +609,29 @@ static WRITE8_HANDLER( backupram_enable_w )
static WRITE8_HANDLER( msm5205_mastboy_m5205_sambit0_w )
{
+ const device_config *adpcm = devtag_get_device(space->machine, SOUND, "msm");
+
mastboy_m5205_sambit0 = data & 1;
- msm5205_playmode_w(0, (1 << 2) | (mastboy_m5205_sambit1 << 1) | (mastboy_m5205_sambit0) );
+ msm5205_playmode_w(adpcm, (1 << 2) | (mastboy_m5205_sambit1 << 1) | (mastboy_m5205_sambit0) );
logerror("msm5205 samplerate bit 0, set to %02x\n",data);
}
static WRITE8_HANDLER( msm5205_mastboy_m5205_sambit1_w )
{
+ const device_config *adpcm = devtag_get_device(space->machine, SOUND, "msm");
+
mastboy_m5205_sambit1 = data & 1;
- msm5205_playmode_w(0, (1 << 2) | (mastboy_m5205_sambit1 << 1) | (mastboy_m5205_sambit0) );
+ msm5205_playmode_w(adpcm, (1 << 2) | (mastboy_m5205_sambit1 << 1) | (mastboy_m5205_sambit0) );
logerror("msm5205 samplerate bit 0, set to %02x\n",data);
}
-static WRITE8_HANDLER( mastboy_msm5205_reset_w )
+static WRITE8_DEVICE_HANDLER( mastboy_msm5205_reset_w )
{
mastboy_m5205_part = 0;
- msm5205_reset_w(0,data&1);
+ msm5205_reset_w(device,data&1);
}
static WRITE8_HANDLER( mastboy_msm5205_data_w )
@@ -637,7 +641,7 @@ static WRITE8_HANDLER( mastboy_msm5205_data_w )
static void mastboy_adpcm_int(const device_config *device)
{
- msm5205_data_w (0,mastboy_m5205_next);
+ msm5205_data_w (device,mastboy_m5205_next);
mastboy_m5205_next>>=4;
mastboy_m5205_part ^= 1;
@@ -697,13 +701,13 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xff000, 0xff7ff) AM_WRITE(mastboy_backupram_w) AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
AM_RANGE(0xff820, 0xff827) AM_WRITE(mastboy_bank_w)
- AM_RANGE(0xff828, 0xff828) AM_WRITE(saa1099_write_port_0_w)
- AM_RANGE(0xff829, 0xff829) AM_WRITE(saa1099_control_port_0_w)
+ AM_RANGE(0xff828, 0xff828) AM_DEVWRITE(SOUND, "saa", saa1099_data_w)
+ AM_RANGE(0xff829, 0xff829) AM_DEVWRITE(SOUND, "saa", saa1099_control_w)
AM_RANGE(0xff830, 0xff830) AM_WRITE(mastboy_msm5205_data_w)
AM_RANGE(0xff838, 0xff838) AM_WRITE(mastboy_irq0_ack_w)
AM_RANGE(0xff839, 0xff839) AM_WRITE(msm5205_mastboy_m5205_sambit0_w)
AM_RANGE(0xff83a, 0xff83a) AM_WRITE(msm5205_mastboy_m5205_sambit1_w)
- AM_RANGE(0xff83b, 0xff83b) AM_WRITE(mastboy_msm5205_reset_w)
+ AM_RANGE(0xff83b, 0xff83b) AM_DEVWRITE(SOUND, "msm", mastboy_msm5205_reset_w)
AM_RANGE(0xff83c, 0xff83c) AM_WRITE(backupram_enable_w)
AM_RANGE(0xffc00, 0xfffff) AM_WRITE(SMH_RAM) // Internal RAM
ADDRESS_MAP_END
@@ -852,7 +856,7 @@ static MACHINE_RESET( mastboy )
memset( mastboy_vram, 0x00, 0x10000);
mastboy_m5205_part = 0;
- msm5205_reset_w(0,1);
+ msm5205_reset_w(devtag_get_device(machine, SOUND, "msm"),1);
mastboy_irq0_ack = 0;
}
diff --git a/src/mame/drivers/matmania.c b/src/mame/drivers/matmania.c
index 2dfc3213c0e..b426c2b4591 100644
--- a/src/mame/drivers/matmania.c
+++ b/src/mame/drivers/matmania.c
@@ -36,7 +36,7 @@ The driver has been updated accordingly.
#include "cpu/m6805/m6805.h"
#include "sound/ay8910.h"
#include "sound/dac.h"
-#include "sound/3812intf.h"
+#include "sound/3526intf.h"
#include "includes/matmania.h"
static WRITE8_HANDLER( matmania_sh_command_w )
@@ -45,12 +45,6 @@ static WRITE8_HANDLER( matmania_sh_command_w )
cpu_set_input_line(space->machine->cpu[1],M6502_IRQ_LINE,HOLD_LINE);
}
-static WRITE8_HANDLER( matmania_dac_w )
-{
- dac_signed_data_w(0,data);
-}
-
-
static WRITE8_HANDLER( maniach_sh_command_w )
{
soundlatch_w(space,offset,data);
@@ -126,11 +120,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x01ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x2000, 0x2000) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x2001, 0x2001) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x2002, 0x2002) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x2003, 0x2003) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x2004, 0x2004) AM_WRITE(matmania_dac_w)
+ AM_RANGE(0x2000, 0x2001) AM_DEVWRITE(SOUND, "ay1", ay8910_data_address_w)
+ AM_RANGE(0x2002, 0x2003) AM_DEVWRITE(SOUND, "ay2", ay8910_data_address_w)
+ AM_RANGE(0x2004, 0x2004) AM_DEVWRITE(SOUND, "dac", dac_signed_w)
AM_RANGE(0x8000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
@@ -142,9 +134,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( maniach_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x2000, 0x2000) AM_WRITE(ym3526_control_port_0_w)
- AM_RANGE(0x2001, 0x2001) AM_WRITE(ym3526_write_port_0_w)
- AM_RANGE(0x2002, 0x2002) AM_WRITE(matmania_dac_w)
+ AM_RANGE(0x2000, 0x2001) AM_DEVWRITE(SOUND, "ym", ym3526_w)
+ AM_RANGE(0x2002, 0x2002) AM_DEVWRITE(SOUND, "dac", dac_signed_w)
AM_RANGE(0x4000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
@@ -362,9 +353,9 @@ MACHINE_DRIVER_END
/* handler called by the 3526 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1],1,linestate);
+ cpu_set_input_line(device->machine->cpu[1],1,linestate);
}
static const ym3526_interface ym3526_config =
diff --git a/src/mame/drivers/maxaflex.c b/src/mame/drivers/maxaflex.c
index e20c9dfd5be..f7a77b7e6b3 100644
--- a/src/mame/drivers/maxaflex.c
+++ b/src/mame/drivers/maxaflex.c
@@ -243,7 +243,7 @@ static ADDRESS_MAP_START(a600xl_mem, ADDRESS_SPACE_PROGRAM, 8)
AM_RANGE(0xc000, 0xcfff) AM_ROM /* OS */
AM_RANGE(0xd000, 0xd0ff) AM_READWRITE(atari_gtia_r, atari_gtia_w)
AM_RANGE(0xd100, 0xd1ff) AM_NOP
- AM_RANGE(0xd200, 0xd2ff) AM_READWRITE(pokey1_r, pokey1_w)
+ AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE(SOUND, "pokey", pokey_r, pokey_w)
AM_RANGE(0xd300, 0xd3ff) AM_READWRITE(pia_0_alt_r, pia_0_alt_w)
AM_RANGE(0xd400, 0xd4ff) AM_READWRITE(atari_antic_r, atari_antic_w)
AM_RANGE(0xd500, 0xd7ff) AM_NOP
@@ -421,9 +421,9 @@ static PALETTE_INIT( atari )
static const pokey_interface pokey_config = {
- { 0 },
- 0,
- 0,0,
+ { DEVCB_NULL },
+ DEVCB_NULL,
+ DEVCB_NULL,DEVCB_NULL,
atari_interrupt_cb
};
diff --git a/src/mame/drivers/mayumi.c b/src/mame/drivers/mayumi.c
index 38ede1a45b6..a024b37f01f 100644
--- a/src/mame/drivers/mayumi.c
+++ b/src/mame/drivers/mayumi.c
@@ -95,8 +95,7 @@ static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0xc0, 0xc0) AM_WRITE(input_sel_w)
AM_RANGE(0xc1, 0xc2) AM_READ(key_matrix_r) // 0xc0-c3 8255ppi
AM_RANGE(0xc3, 0xc3) AM_WRITE(SMH_NOP) // 0xc0-c3 8255ppi
- AM_RANGE(0xd0, 0xd0) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xd1, 0xd1) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
+ AM_RANGE(0xd0, 0xd1) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
ADDRESS_MAP_END
/****************************************************************************/
@@ -268,10 +267,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r,
- input_port_1_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_NULL,
+ DEVCB_NULL
},
NULL
};
diff --git a/src/mame/drivers/mazerbla.c b/src/mame/drivers/mazerbla.c
index ece216c6a91..041be56ce07 100644
--- a/src/mame/drivers/mazerbla.c
+++ b/src/mame/drivers/mazerbla.c
@@ -1055,7 +1055,7 @@ ADDRESS_MAP_END
static UINT8 soundlatch;
-static READ8_HANDLER( soundcommand_r )
+static READ8_DEVICE_HANDLER( soundcommand_r )
{
return soundlatch;
}
@@ -1101,7 +1101,7 @@ static WRITE8_HANDLER( sound_nmi_clear_w )
cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_NMI, CLEAR_LINE);
}
-static WRITE8_HANDLER( gg_led_ctrl_w )
+static WRITE8_DEVICE_HANDLER( gg_led_ctrl_w )
{
/* bit 0, bit 1 - led on */
set_led_status(1,data&0x01);
@@ -1110,17 +1110,15 @@ static WRITE8_HANDLER( gg_led_ctrl_w )
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_READ(SMH_ROM)
AM_RANGE(0x2000, 0x27ff) AM_READ(SMH_RAM)
- AM_RANGE(0x4000, 0x4000) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0x4000, 0x4000) AM_DEVREAD(SOUND, "ay1", ay8910_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x2000, 0x27ff) AM_WRITE(SMH_RAM) /* main RAM (stack) */
- AM_RANGE(0x4000, 0x4000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x4001, 0x4001) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x6000, 0x6000) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x6001, 0x6001) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0x4000, 0x4001) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x6000, 0x6001) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
AM_RANGE(0x8000, 0x8000) AM_WRITE(sound_int_clear_w)
AM_RANGE(0xa000, 0xa000) AM_WRITE(sound_nmi_clear_w)
@@ -1454,20 +1452,20 @@ static const ay8910_interface ay8912_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- soundcommand_r,
- NULL,
- NULL
+ DEVCB_NULL,
+ DEVCB_HANDLER(soundcommand_r),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface ay8912_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- NULL,
- gg_led_ctrl_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(gg_led_ctrl_w)
};
diff --git a/src/mame/drivers/mcatadv.c b/src/mame/drivers/mcatadv.c
index cb941559c42..bbf99de2f95 100644
--- a/src/mame/drivers/mcatadv.c
+++ b/src/mame/drivers/mcatadv.c
@@ -238,18 +238,14 @@ static ADDRESS_MAP_START( mcatadv_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0x4000, 0xbfff) AM_READ(SMH_BANK1 ) // ROM
AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM ) // RAM
- AM_RANGE(0xe000, 0xe000) AM_READ(ym2610_status_port_0_a_r )
- AM_RANGE(0xe002, 0xe002) AM_READ(ym2610_status_port_0_b_r )
+ AM_RANGE(0xe000, 0xe003) AM_DEVREAD(SOUND, "ym", ym2610_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( mcatadv_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_WRITE(SMH_ROM ) // ROM
AM_RANGE(0x4000, 0xbfff) AM_WRITE(SMH_ROM ) // ROM
AM_RANGE(0xc000, 0xdfff) AM_WRITE(SMH_RAM ) // RAM
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ym2610_control_port_0_a_w)
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ym2610_data_port_0_a_w)
- AM_RANGE(0xe002, 0xe002) AM_WRITE(ym2610_control_port_0_b_w)
- AM_RANGE(0xe003, 0xe003) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0xe000, 0xe003) AM_DEVWRITE(SOUND, "ym", ym2610_w)
AM_RANGE(0xf000, 0xf000) AM_WRITE(mcatadv_sound_bw_w)
ADDRESS_MAP_END
@@ -273,12 +269,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( nost_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym2610_control_port_0_a_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym2610_data_port_0_a_w)
- AM_RANGE(0x02, 0x02) AM_WRITE(ym2610_control_port_0_b_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ym2610_data_port_0_b_w)
- AM_RANGE(0x04, 0x05) AM_READ(ym2610_status_port_0_a_r)
- AM_RANGE(0x06, 0x07) AM_READ(ym2610_status_port_0_b_r)
+ AM_RANGE(0x00, 0x03) AM_DEVWRITE(SOUND, "ym", ym2610_w)
+ AM_RANGE(0x04, 0x07) AM_DEVREAD(SOUND, "ym", ym2610_r)
AM_RANGE(0x40, 0x40) AM_WRITE(mcatadv_sound_bw_w)
AM_RANGE(0x80, 0x80) AM_READWRITE(soundlatch_r, soundlatch2_w)
ADDRESS_MAP_END
@@ -460,9 +452,9 @@ GFXDECODE_END
/* Stolen from Psikyo.c */
-static void sound_irq( running_machine *machine, int irq )
+static void sound_irq( const device_config *device, int irq )
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface mcatadv_ym2610_interface =
{
diff --git a/src/mame/drivers/mcr.c b/src/mame/drivers/mcr.c
index 93de3aa20e5..bbc52e7bc4f 100644
--- a/src/mame/drivers/mcr.c
+++ b/src/mame/drivers/mcr.c
@@ -413,12 +413,14 @@ static WRITE8_HANDLER( kroozr_op4_w )
static WRITE8_HANDLER( journey_op4_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
+
/* if we're not playing the sample yet, start it */
- if (!sample_playing(0))
- sample_start(0, 0, 1);
+ if (!sample_playing(samples, 0))
+ sample_start(samples, 0, 0, 1);
/* bit 0 turns cassette on/off */
- sample_set_pause(0, ~data & 1);
+ sample_set_pause(samples, 0, ~data & 1);
}
diff --git a/src/mame/drivers/meadows.c b/src/mame/drivers/meadows.c
index 50333d5b59b..e6fb0736d6a 100644
--- a/src/mame/drivers/meadows.c
+++ b/src/mame/drivers/meadows.c
@@ -254,7 +254,7 @@ static WRITE8_HANDLER( audio_hardware_w )
switch (offset & 3)
{
case 0: /* DAC */
- meadows_sh_dac_w(data ^ 0xff);
+ meadows_sh_dac_w(space->machine, data ^ 0xff);
break;
case 1: /* counter clk 5 MHz / 256 */
diff --git a/src/mame/drivers/mediagx.c b/src/mame/drivers/mediagx.c
index def24d3bfec..ef4133fa93d 100644
--- a/src/mame/drivers/mediagx.c
+++ b/src/mame/drivers/mediagx.c
@@ -118,6 +118,8 @@ static UINT8 ad1847_regs[16];
static UINT32 ad1847_sample_counter = 0;
static UINT32 ad1847_sample_rate;
+static const device_config *dmadac[2];
+
static struct {
const device_config *pit8254;
const device_config *pic8259_1;
@@ -636,14 +638,14 @@ static TIMER_CALLBACK( sound_timer_callback )
ad1847_sample_counter = 0;
timer_adjust_oneshot(sound_timer, ATTOTIME_IN_MSEC(10), 0);
- dmadac_transfer(0, 1, 0, 1, dacl_ptr, dacl);
- dmadac_transfer(1, 1, 0, 1, dacr_ptr, dacr);
+ dmadac_transfer(&dmadac[0], 1, 0, 1, dacl_ptr, dacl);
+ dmadac_transfer(&dmadac[1], 1, 0, 1, dacr_ptr, dacr);
dacl_ptr = 0;
dacr_ptr = 0;
}
-static void ad1847_reg_write(int reg, UINT8 data)
+static void ad1847_reg_write(running_machine *machine, int reg, UINT8 data)
{
static const int divide_factor[] = { 3072, 1536, 896, 768, 448, 384, 512, 2560 };
@@ -660,7 +662,7 @@ static void ad1847_reg_write(int reg, UINT8 data)
ad1847_sample_rate = 24576000 / divide_factor[(data >> 1) & 0x7];
}
- dmadac_set_frequency(0, 2, ad1847_sample_rate);
+ dmadac_set_frequency(&dmadac[0], 2, ad1847_sample_rate);
if (data & 0x20)
{
@@ -711,7 +713,7 @@ static WRITE32_HANDLER( ad1847_w )
else if (offset == 3)
{
int reg = (data >> 8) & 0xf;
- ad1847_reg_write(reg, data & 0xff);
+ ad1847_reg_write(space->machine, reg, data & 0xff);
}
}
@@ -964,7 +966,9 @@ static MACHINE_RESET(mediagx)
sound_timer = timer_alloc(machine, sound_timer_callback, NULL);
timer_adjust_oneshot(sound_timer, ATTOTIME_IN_MSEC(10), 0);
- dmadac_enable(0, 2, 1);
+ dmadac[0] = devtag_get_device(machine, SOUND, "dac1");
+ dmadac[1] = devtag_get_device(machine, SOUND, "dac2");
+ dmadac_enable(&dmadac[0], 2, 1);
devtag_reset(machine, IDE_CONTROLLER, "ide");
}
diff --git a/src/mame/drivers/megadriv.c b/src/mame/drivers/megadriv.c
index bfdfd679ce4..f9556252c43 100644
--- a/src/mame/drivers/megadriv.c
+++ b/src/mame/drivers/megadriv.c
@@ -1005,8 +1005,8 @@ WRITE16_HANDLER( megadriv_vdp_w )
case 0x12:
case 0x14:
case 0x16:
- if (ACCESSING_BITS_0_7) sn76496_0_w(space, 0, data & 0xff);
- //if (ACCESSING_BITS_8_15) sn76496_0_w(space, 0, (data >>8) & 0xff);
+ if (ACCESSING_BITS_0_7) sn76496_w(devtag_get_device(space->machine, SOUND, "sn"), 0, data & 0xff);
+ //if (ACCESSING_BITS_8_15) sn76496_w(devtag_get_device(space->machine, SOUND, "sn"), 0, (data >>8) & 0xff);
break;
default:
@@ -1406,26 +1406,16 @@ READ16_HANDLER( megadriv_vdp_r )
return retvalue;
}
-static READ16_HANDLER( megadriv_68k_YM2612_read)
+static READ8_DEVICE_HANDLER( megadriv_68k_YM2612_read)
{
//mame_printf_debug("megadriv_68k_YM2612_read %02x %04x\n",offset,mem_mask);
if ( (genz80.z80_has_bus==0) && (genz80.z80_is_reset==0) )
{
- switch (offset)
- {
- case 0:
- if (ACCESSING_BITS_8_15) return ym2612_status_port_0_a_r(space, 0) << 8;
- else return ym2612_status_port_0_a_r(space, 0);
- break;
- case 1:
- if (ACCESSING_BITS_8_15) return ym2612_status_port_0_a_r(space, 0) << 8;
- else return ym2612_status_port_0_a_r(space, 0);
- break;
- }
+ return ym2612_r(device, offset);
}
else
{
- logerror("%06x: 68000 attempting to access YM2612 (read) without bus\n", cpu_get_pc(space->cpu));
+ logerror("%s: 68000 attempting to access YM2612 (read) without bus\n", cpuexec_describe_context(device->machine));
return 0;
}
@@ -1434,52 +1424,16 @@ static READ16_HANDLER( megadriv_68k_YM2612_read)
-static WRITE16_HANDLER( megadriv_68k_YM2612_write)
+static WRITE8_DEVICE_HANDLER( megadriv_68k_YM2612_write)
{
//mame_printf_debug("megadriv_68k_YM2612_write %02x %04x %04x\n",offset,data,mem_mask);
if ( (genz80.z80_has_bus==0) && (genz80.z80_is_reset==0) )
{
- switch (offset)
- {
- case 0:
- if (ACCESSING_BITS_8_15) ym2612_control_port_0_a_w (space, 0, (data >> 8) & 0xff);
- else ym2612_data_port_0_a_w (space, 0, (data >> 0) & 0xff);
- break;
- case 1:
- if (ACCESSING_BITS_8_15) ym2612_control_port_0_b_w (space, 0, (data >> 8) & 0xff);
- else ym2612_data_port_0_b_w (space, 0, (data >> 0) & 0xff);
- break;
- }
+ ym2612_w(device, offset, data);
}
else
{
- logerror("%06x: 68000 attempting to access YM2612 (write) without bus\n", cpu_get_pc(space->cpu));
- }
-}
-
-static READ8_HANDLER( megadriv_z80_YM2612_read )
-{
- switch (offset)
- {
- case 0: return ym2612_status_port_0_a_r(space,0);
- case 1: return ym2612_status_port_0_a_r(space,0);
- case 2: return ym2612_status_port_0_a_r(space,0);
- case 3: return ym2612_status_port_0_a_r(space,0);
-
- }
-
- return 0x00;
-}
-
-static WRITE8_HANDLER( megadriv_z80_YM2612_write )
-{
- //mame_printf_debug("megadriv_z80_YM2612_write %02x %02x\n",offset,data);
- switch (offset)
- {
- case 0: ym2612_control_port_0_a_w(space, 0, data); break;
- case 1: ym2612_data_port_0_a_w(space, 0, data); break;
- case 2: ym2612_control_port_0_b_w(space, 0, data); break;
- case 3: ym2612_data_port_0_b_w(space, 0, data); break;
+ logerror("%s: 68000 attempting to access YM2612 (write) without bus\n", cpuexec_describe_context(device->machine));
}
}
@@ -2193,7 +2147,7 @@ static ADDRESS_MAP_START( megadriv_readmem, ADDRESS_SPACE_PROGRAM, 16 )
/* (0x000000 - 0x3fffff) == GAME ROM (4Meg Max, Some games have special banking too) */
AM_RANGE(0xa00000 , 0xa01fff) AM_READ(megadriv_68k_read_z80_ram)
- AM_RANGE(0xa04000 , 0xa04003) AM_READ(megadriv_68k_YM2612_read)
+ AM_RANGE(0xa04000 , 0xa04003) AM_DEVREAD8(SOUND, "ym", megadriv_68k_YM2612_read, 0xffff)
AM_RANGE(0xa10000 , 0xa1001f) AM_READ(megadriv_68k_io_read)
@@ -2220,7 +2174,7 @@ static ADDRESS_MAP_START( megadriv_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xa00000 , 0xa01fff) AM_WRITE(megadriv_68k_write_z80_ram)
AM_RANGE(0xa02000 , 0xa03fff) AM_WRITE(megadriv_68k_write_z80_ram)
- AM_RANGE(0xa04000 , 0xa04003) AM_WRITE(megadriv_68k_YM2612_write)
+ AM_RANGE(0xa04000 , 0xa04003) AM_DEVWRITE8(SOUND, "ym", megadriv_68k_YM2612_write, 0xffff)
AM_RANGE(0xa06000 , 0xa06001) AM_WRITE(megadriv_68k_z80_bank_write)
@@ -2390,7 +2344,7 @@ static WRITE16_HANDLER ( megadriv_68k_req_z80_reset )
//logerror("%06x: 68000 start z80 reset (byte MSB access) %04x %04x\n", cpu_get_pc(space->cpu),data,mem_mask);
genz80.z80_is_reset=1;
cpu_set_input_line(space->machine->cpu[genz80.z80_cpunum], INPUT_LINE_RESET, ASSERT_LINE);
- sndti_reset(SOUND_YM2612, 0);
+ devtag_reset(space->machine, SOUND, "ym");
}
}
else if (!ACCESSING_BITS_8_15) // is this valid?
@@ -2406,7 +2360,7 @@ static WRITE16_HANDLER ( megadriv_68k_req_z80_reset )
//logerror("%06x: 68000 start z80 reset (byte LSB access) %04x %04x\n", cpu_get_pc(space->cpu),data,mem_mask);
genz80.z80_is_reset=1;
cpu_set_input_line(space->machine->cpu[genz80.z80_cpunum], INPUT_LINE_RESET, ASSERT_LINE);
- sndti_reset(SOUND_YM2612, 0);
+ devtag_reset(space->machine, SOUND, "ym");
}
}
@@ -2423,7 +2377,7 @@ static WRITE16_HANDLER ( megadriv_68k_req_z80_reset )
//logerror("%06x: 68000 start z80 reset (byte LSB access) %04x %04x\n", cpu_get_pc(space->cpu),data,mem_mask);
genz80.z80_is_reset=1;
cpu_set_input_line(space->machine->cpu[genz80.z80_cpunum], INPUT_LINE_RESET, ASSERT_LINE);
- sndti_reset(SOUND_YM2612, 0);
+ devtag_reset(space->machine, SOUND, "ym");
}
}
}
@@ -2481,7 +2435,7 @@ static WRITE8_HANDLER( megadriv_z80_vdp_write )
case 0x13:
case 0x15:
case 0x17:
- sn76496_0_w(space, 0, data);
+ sn76496_w(devtag_get_device(space->machine, SOUND, "sn"), 0, data);
break;
default:
@@ -2512,7 +2466,7 @@ static WRITE8_HANDLER( z80_write_68k_banked_data )
else if (fulladdress == 0xc00011)
{
/* quite a few early games write here, most of the later ones don't */
- sn76496_0_w(space, 0, data);
+ sn76496_w(devtag_get_device(space->machine, SOUND, "sn"), 0, data);
}
else
{
@@ -2541,7 +2495,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( z80_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000 , 0x1fff) AM_READ(SMH_BANK1) AM_MIRROR(0x2000) // RAM can be accessed by the 68k
- AM_RANGE(0x4000 , 0x4003) AM_READ(megadriv_z80_YM2612_read)
+ AM_RANGE(0x4000 , 0x4003) AM_DEVREAD(SOUND, "ym", ym2612_r)
AM_RANGE(0x6100 , 0x7eff) AM_READ(megadriv_z80_unmapped_read)
@@ -2552,7 +2506,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( z80_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000 , 0x1fff) AM_WRITE(SMH_BANK1) AM_MIRROR(0x2000)
- AM_RANGE(0x4000 , 0x4003) AM_WRITE(megadriv_z80_YM2612_write)
+ AM_RANGE(0x4000 , 0x4003) AM_DEVWRITE(SOUND, "ym", ym2612_w)
AM_RANGE(0x7f00 , 0x7fff) AM_WRITE(megadriv_z80_vdp_write)
@@ -6613,6 +6567,8 @@ static WRITE8_HANDLER( z80_unmapped_w )
/* sets the megadrive z80 to it's normal ports / map */
void megatech_set_megadrive_z80_as_megadrive_z80(running_machine *machine)
{
+ const device_config *ym = devtag_get_device(machine, SOUND, "ym");
+
/* INIT THE PORTS *********************************************************************************************/
memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0x0000, 0xffff, 0, 0, z80_unmapped_port_r, z80_unmapped_port_w);
@@ -6630,7 +6586,7 @@ void megatech_set_megadrive_z80_as_megadrive_z80(running_machine *machine)
// not allowed??
// memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x2000, 0x3fff, 0, 0, SMH_BANK1, SMH_BANK1);
- memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x4000, 0x4003, 0, 0, megadriv_z80_YM2612_read, megadriv_z80_YM2612_write);
+ memory_install_readwrite8_device_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), ym, 0x4000, 0x4003, 0, 0, ym2612_r, ym2612_w);
memory_install_write8_handler (cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x6000, 0, 0, megadriv_z80_z80_bank_w);
memory_install_write8_handler (cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6001, 0x6001, 0, 0, megadriv_z80_z80_bank_w);
memory_install_read8_handler (cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6100, 0x7eff, 0, 0, megadriv_z80_unmapped_read);
diff --git a/src/mame/drivers/megaplay.c b/src/mame/drivers/megaplay.c
index cb255ef6c24..8c76f7935b7 100644
--- a/src/mame/drivers/megaplay.c
+++ b/src/mame/drivers/megaplay.c
@@ -741,7 +741,7 @@ static WRITE8_HANDLER (megaplay_bios_port_be_bf_w)
static ADDRESS_MAP_START( megaplay_bios_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
// AM_RANGE(0x3f, 0x3f) AM_WRITE(megatech_bios_port_ctrl_w)
- AM_RANGE(0x7f, 0x7f) AM_WRITE(sn76496_1_w) /* SN76489 */
+ AM_RANGE(0x7f, 0x7f) AM_DEVWRITE(SOUND, "sn2", sn76496_w) /* SN76489 */
// AM_RANGE(0xdc, 0xdc) AM_READ(megatech_bios_port_dc_r) // player inputs
// AM_RANGE(0xdd, 0xdd) AM_READ(megatech_bios_port_dd_r) // other player 2 inputs
AM_RANGE(0xbe, 0xbf) AM_READWRITE(megaplay_bios_port_be_bf_r, megaplay_bios_port_be_bf_w) /* VDP */
diff --git a/src/mame/drivers/megasys1.c b/src/mame/drivers/megasys1.c
index 94b0ecc9679..5a6bcc2f9c8 100644
--- a/src/mame/drivers/megasys1.c
+++ b/src/mame/drivers/megasys1.c
@@ -348,7 +348,7 @@ static ADDRESS_MAP_START( readmem_D, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x0e0000, 0x0e0001) AM_READ_PORT("DSW")
AM_RANGE(0x0e8000, 0x0ebfff) AM_READ(SMH_RAM)
AM_RANGE(0x0f0000, 0x0f0001) AM_READ_PORT("SYSTEM")
- AM_RANGE(0x0f8000, 0x0f8001) AM_READ(okim6295_status_0_lsb_r)
+ AM_RANGE(0x0f8000, 0x0f8001) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff)
// { 0x100000, 0x100001 protection
AM_RANGE(0x1f0000, 0x1fffff) AM_READ(SMH_RAM)
ADDRESS_MAP_END
@@ -361,7 +361,7 @@ static ADDRESS_MAP_START( writemem_D, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x0d4000, 0x0d7fff) AM_WRITE(megasys1_scrollram_2_w) AM_BASE(&megasys1_scrollram[2])
AM_RANGE(0x0d8000, 0x0d87ff) AM_MIRROR(0x3000) AM_WRITE(paletteram16_RRRRRGGGGGBBBBBx_word_w) AM_BASE(&paletteram16)
AM_RANGE(0x0e8000, 0x0ebfff) AM_WRITE(megasys1_scrollram_0_w) AM_BASE(&megasys1_scrollram[0])
- AM_RANGE(0x0f8000, 0x0f8001) AM_WRITE(okim6295_data_0_lsb_w)
+ AM_RANGE(0x0f8000, 0x0f8001) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff)
// { 0x100000, 0x100001 protection
AM_RANGE(0x1f0000, 0x1fffff) AM_WRITE(SMH_RAM) AM_BASE(&megasys1_ram)
ADDRESS_MAP_END
@@ -425,26 +425,18 @@ ADDRESS_MAP_END
*/
/* YM2151 IRQ */
-static void megasys1_sound_irq(running_machine *machine, int irq)
+static void megasys1_sound_irq(const device_config *device, int irq)
{
if (irq)
- cpu_set_input_line(machine->cpu[1], 4, HOLD_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 4, HOLD_LINE);
}
-static READ16_HANDLER( oki_status_0_r )
+static READ8_DEVICE_HANDLER( oki_status_r )
{
if (megasys1_ignore_oki_status == 1)
return 0;
else
- return okim6295_status_0_lsb_r(space,offset,mem_mask);
-}
-
-static READ16_HANDLER( oki_status_1_r )
-{
- if (megasys1_ignore_oki_status == 1)
- return 0;
- else
- return okim6295_status_1_lsb_r(space,offset,mem_mask);
+ return okim6295_r(device,offset);
}
/***************************************************************************
@@ -455,19 +447,18 @@ static READ16_HANDLER( oki_status_1_r )
static ADDRESS_MAP_START( sound_readmem_A, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x01ffff) AM_READ(SMH_ROM)
AM_RANGE(0x040000, 0x040001) AM_READ(soundlatch_word_r)
- AM_RANGE(0x080002, 0x080003) AM_READ(ym2151_status_port_0_lsb_r)
- AM_RANGE(0x0a0000, 0x0a0001) AM_READ(oki_status_0_r)
- AM_RANGE(0x0c0000, 0x0c0001) AM_READ(oki_status_1_r)
+ AM_RANGE(0x080000, 0x080003) AM_DEVREAD8(SOUND, "ym", ym2151_r, 0x00ff)
+ AM_RANGE(0x0a0000, 0x0a0001) AM_DEVREAD8(SOUND, "oki1", oki_status_r, 0x00ff)
+ AM_RANGE(0x0c0000, 0x0c0001) AM_DEVREAD8(SOUND, "oki2", oki_status_r, 0x00ff)
AM_RANGE(0x0e0000, 0x0fffff) AM_READ(SMH_RAM)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem_A, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x01ffff) AM_WRITE(SMH_ROM)
AM_RANGE(0x060000, 0x060001) AM_WRITE(soundlatch2_word_w) // to main cpu
- AM_RANGE(0x080000, 0x080001) AM_WRITE(ym2151_register_port_0_lsb_w)
- AM_RANGE(0x080002, 0x080003) AM_WRITE(ym2151_data_port_0_lsb_w)
- AM_RANGE(0x0a0000, 0x0a0003) AM_WRITE(okim6295_data_0_lsb_w)
- AM_RANGE(0x0c0000, 0x0c0003) AM_WRITE(okim6295_data_1_lsb_w)
+ AM_RANGE(0x080000, 0x080003) AM_DEVWRITE8(SOUND, "ym", ym2151_w, 0x00ff)
+ AM_RANGE(0x0a0000, 0x0a0003) AM_DEVWRITE8(SOUND, "oki1", okim6295_w, 0x00ff)
+ AM_RANGE(0x0c0000, 0x0c0003) AM_DEVWRITE8(SOUND, "oki2", okim6295_w, 0x00ff)
AM_RANGE(0x0e0000, 0x0fffff) AM_WRITE(SMH_RAM)
ADDRESS_MAP_END
@@ -485,9 +476,9 @@ static ADDRESS_MAP_START( sound_readmem_B, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x01ffff) AM_READ(SMH_ROM)
AM_RANGE(0x040000, 0x040001) AM_READ(soundlatch_word_r) /* from main cpu */
AM_RANGE(0x060000, 0x060001) AM_READ(soundlatch_word_r) /* from main cpu */
- AM_RANGE(0x080002, 0x080003) AM_READ(ym2151_status_port_0_lsb_r)
- AM_RANGE(0x0a0000, 0x0a0001) AM_READ(oki_status_0_r)
- AM_RANGE(0x0c0000, 0x0c0001) AM_READ(oki_status_1_r)
+ AM_RANGE(0x080000, 0x080003) AM_DEVREAD8(SOUND, "ym", ym2151_r, 0x00ff)
+ AM_RANGE(0x0a0000, 0x0a0001) AM_DEVREAD8(SOUND, "oki1", oki_status_r, 0x00ff)
+ AM_RANGE(0x0c0000, 0x0c0001) AM_DEVREAD8(SOUND, "oki2", oki_status_r, 0x00ff)
AM_RANGE(0x0e0000, 0x0effff) AM_READ(SMH_RAM)
ADDRESS_MAP_END
@@ -495,10 +486,9 @@ static ADDRESS_MAP_START( sound_writemem_B, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x01ffff) AM_WRITE(SMH_ROM )
AM_RANGE(0x040000, 0x040001) AM_WRITE(soundlatch2_word_w) /* to main cpu */
AM_RANGE(0x060000, 0x060001) AM_WRITE(soundlatch2_word_w) /* to main cpu */
- AM_RANGE(0x080000, 0x080001) AM_WRITE(ym2151_register_port_0_lsb_w)
- AM_RANGE(0x080002, 0x080003) AM_WRITE(ym2151_data_port_0_lsb_w)
- AM_RANGE(0x0a0000, 0x0a0003) AM_WRITE(okim6295_data_0_lsb_w)
- AM_RANGE(0x0c0000, 0x0c0003) AM_WRITE(okim6295_data_1_lsb_w)
+ AM_RANGE(0x080000, 0x080003) AM_DEVWRITE8(SOUND, "ym", ym2151_w, 0x00ff)
+ AM_RANGE(0x0a0000, 0x0a0003) AM_DEVWRITE8(SOUND, "oki1", okim6295_w, 0x00ff)
+ AM_RANGE(0x0c0000, 0x0c0003) AM_DEVWRITE8(SOUND, "oki2", okim6295_w, 0x00ff)
AM_RANGE(0x0e0000, 0x0effff) AM_WRITE(SMH_RAM)
ADDRESS_MAP_END
@@ -527,8 +517,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
ADDRESS_MAP_END
@@ -1660,7 +1649,7 @@ static MACHINE_DRIVER_START( system_D )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("oki1",OKIM6295, SYS_D_CPU_CLOCK/4) /* 2MHz (8MHz / 4) */
+ MDRV_SOUND_ADD("oki",OKIM6295, SYS_D_CPU_CLOCK/4) /* 2MHz (8MHz / 4) */
MDRV_SOUND_CONFIG(okim6295_interface_pin7high)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
@@ -1679,9 +1668,9 @@ MACHINE_DRIVER_END
***************************************************************************/
-static void irq_handler(running_machine *machine, int irq)
+static void irq_handler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
@@ -1690,7 +1679,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
irq_handler
};
@@ -3809,19 +3798,16 @@ static DRIVER_INIT( iganinju )
// not like lev 3 interrupts
}
-static WRITE16_HANDLER( okim6295_data_0_both_w )
-{
- if (ACCESSING_BITS_0_7) okim6295_data_0_w(space, 0, (data >> 0) & 0xff );
- else okim6295_data_0_w(space, 0, (data >> 8) & 0xff );
-}
-static WRITE16_HANDLER( okim6295_data_1_both_w )
+static WRITE16_DEVICE_HANDLER( okim6295_both_w )
{
- if (ACCESSING_BITS_0_7) okim6295_data_1_w(space, 0, (data >> 0) & 0xff );
- else okim6295_data_1_w(space, 0, (data >> 8) & 0xff );
+ if (ACCESSING_BITS_0_7) okim6295_w(device, 0, (data >> 0) & 0xff );
+ else okim6295_w(device, 0, (data >> 8) & 0xff );
}
static DRIVER_INIT( jitsupro )
{
+ const device_config *oki1 = devtag_get_device(machine, SOUND, "oki1");
+ const device_config *oki2 = devtag_get_device(machine, SOUND, "oki2");
UINT16 *RAM = (UINT16 *) memory_region(machine, "main");
astyanax_rom_decode(machine, "main"); // Code
@@ -3833,8 +3819,8 @@ static DRIVER_INIT( jitsupro )
RAM[0x438/2] = 0x4e71; //
/* the sound code writes oki commands to both the lsb and msb */
- memory_install_write16_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xa0000, 0xa0003, 0, 0, okim6295_data_0_both_w);
- memory_install_write16_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xc0000, 0xc0003, 0, 0, okim6295_data_1_both_w);
+ memory_install_write16_device_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), oki1, 0xa0000, 0xa0003, 0, 0, okim6295_both_w);
+ memory_install_write16_device_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), oki2, 0xc0000, 0xc0003, 0, 0, okim6295_both_w);
}
static DRIVER_INIT( peekaboo )
diff --git a/src/mame/drivers/megatech.c b/src/mame/drivers/megatech.c
index 50acf69c548..c9b1f4f30b7 100644
--- a/src/mame/drivers/megatech.c
+++ b/src/mame/drivers/megatech.c
@@ -363,7 +363,7 @@ static void megatech_select_game(running_machine *machine, int gameno)
cpu_set_input_line(machine->cpu[1], INPUT_LINE_RESET, ASSERT_LINE);
cpu_set_input_line(machine->cpu[0], INPUT_LINE_HALT, ASSERT_LINE);
cpu_set_input_line(machine->cpu[1], INPUT_LINE_HALT, ASSERT_LINE);
- sndti_reset(SOUND_YM2612, 0);
+ devtag_reset(machine, SOUND, "ym");
sprintf(tempname, "game%d", gameno);
game_region = memory_region(machine, tempname);
diff --git a/src/mame/drivers/megazone.c b/src/mame/drivers/megazone.c
index 5abaf679a65..eeef6d4fcec 100644
--- a/src/mame/drivers/megazone.c
+++ b/src/mame/drivers/megazone.c
@@ -34,7 +34,7 @@ VIDEO_UPDATE( megazone );
-static READ8_HANDLER( megazone_portA_r )
+static READ8_DEVICE_HANDLER( megazone_portA_r )
{
int clock,timer;
@@ -46,7 +46,7 @@ static READ8_HANDLER( megazone_portA_r )
/* (divide by (1024/2), and not 1024, because the CPU cycle counter is */
/* incremented every other state change of the clock) */
- clock = cputag_get_total_cycles(space->machine, "audio") * 7159/12288; /* = (14318/8)/(18432/6) */
+ clock = cputag_get_total_cycles(device->machine, "audio") * 7159/12288; /* = (14318/8)/(18432/6) */
timer = (clock / (1024/2)) & 0x0f;
/* low three bits come from the 8039 */
@@ -54,8 +54,9 @@ static READ8_HANDLER( megazone_portA_r )
return (timer << 4) | i8039_status;
}
-static WRITE8_HANDLER( megazone_portB_w )
+static WRITE8_DEVICE_HANDLER( megazone_portB_w )
{
+ static const char *fltname[] = { "filter.0.0", "filter.0.1", "filter.0.2" };
int i;
@@ -68,7 +69,7 @@ static WRITE8_HANDLER( megazone_portB_w )
if (data & 1) C += 10000; /* 10000pF = 0.01uF */
if (data & 2) C += 220000; /* 220000pF = 0.22uF */
data >>= 2;
- filter_rc_set_RC(i,FLT_RC_LOWPASS,1000,2200,200,CAP_P(C));
+ filter_rc_set_RC(devtag_get_device(device->machine, SOUND, fltname[i]),FLT_RC_LOWPASS,1000,2200,200,CAP_P(C));
}
}
@@ -134,9 +135,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x00, 0x02) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x02, 0x02) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x00, 0x00) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
+ AM_RANGE(0x00, 0x02) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x02, 0x02) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( i8039_readmem, ADDRESS_SPACE_PROGRAM, 8 )
@@ -149,7 +150,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( i8039_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0xff) AM_READ(soundlatch_r)
- AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(dac_0_data_w)
+ AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE(SOUND, "dac", dac_w)
AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(i8039_irqen_and_status_w)
ADDRESS_MAP_END
@@ -296,10 +297,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- megazone_portA_r,
- NULL,
- NULL,
- megazone_portB_w
+ DEVCB_HANDLER(megazone_portA_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(megazone_portB_w)
};
diff --git a/src/mame/drivers/meijinsn.c b/src/mame/drivers/meijinsn.c
index ebcdd044d34..301d6bb222e 100644
--- a/src/mame/drivers/meijinsn.c
+++ b/src/mame/drivers/meijinsn.c
@@ -162,8 +162,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( meijinsn_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0x01, 0x01) AM_DEVREAD(SOUND, "ay", ay8910_r)
AM_RANGE(0x02, 0x02) AM_WRITE(soundlatch_clear_w)
AM_RANGE(0x06, 0x06) AM_WRITE(SMH_NOP)
ADDRESS_MAP_END
@@ -295,7 +295,7 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r)
};
static MACHINE_RESET( meijinsn )
diff --git a/src/mame/drivers/merit.c b/src/mame/drivers/merit.c
index 648d802e8b4..135d6241999 100644
--- a/src/mame/drivers/merit.c
+++ b/src/mame/drivers/merit.c
@@ -273,7 +273,7 @@ static WRITE8_DEVICE_HANDLER( led1_w )
set_led_status(4,~data & 0x10);
}
-static WRITE8_HANDLER( led2_w )
+static WRITE8_DEVICE_HANDLER( led2_w )
{
/* 5 button lamps player 2 */
set_led_status(5,~data & 0x01);
@@ -405,8 +405,8 @@ static ADDRESS_MAP_START( trvwhiz_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END
static ADDRESS_MAP_START( trvwhiz_io_map, ADDRESS_SPACE_IO, 8 )
- AM_RANGE(0x8000, 0x8000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x8100, 0x8100) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x8000, 0x8000) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
+ AM_RANGE(0x8100, 0x8100) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
ADDRESS_MAP_END
@@ -426,8 +426,8 @@ static ADDRESS_MAP_START( phrcraze_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END
static ADDRESS_MAP_START( phrcraze_io_map, ADDRESS_SPACE_IO, 8 )
- AM_RANGE(0xc004, 0xc004) AM_MIRROR(0x1cf3) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xc104, 0xc104) AM_MIRROR(0x1cf3) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0xc004, 0xc004) AM_MIRROR(0x1cf3) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
+ AM_RANGE(0xc104, 0xc104) AM_MIRROR(0x1cf3) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
ADDRESS_MAP_END
@@ -447,8 +447,8 @@ static ADDRESS_MAP_START( tictac_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END
static ADDRESS_MAP_START( tictac_io_map, ADDRESS_SPACE_IO, 8 )
- AM_RANGE(0xc00c, 0xc00c) AM_MIRROR(0x1cf3) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xc10c, 0xc10c) AM_MIRROR(0x1cf3) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0xc00c, 0xc00c) AM_MIRROR(0x1cf3) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
+ AM_RANGE(0xc10c, 0xc10c) AM_MIRROR(0x1cf3) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
ADDRESS_MAP_END
@@ -1100,8 +1100,8 @@ static const ay8910_interface merit_ay8912_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL,
- led2_w, NULL
+ DEVCB_NULL, DEVCB_NULL,
+ DEVCB_HANDLER(led2_w), DEVCB_NULL
};
static NVRAM_HANDLER(dodge)
diff --git a/src/mame/drivers/meritm.c b/src/mame/drivers/meritm.c
index eef0f9815fa..aabb0cfcab2 100644
--- a/src/mame/drivers/meritm.c
+++ b/src/mame/drivers/meritm.c
@@ -562,8 +562,8 @@ static ADDRESS_MAP_START( meritm_crt250_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x30, 0x33) AM_DEVREADWRITE(PPI8255, "ppi8255", ppi8255_r, ppi8255_w)
AM_RANGE(0x40, 0x43) AM_DEVREADWRITE(Z80PIO, "z80pio_0", z80pio_r, z80pio_w)
AM_RANGE(0x50, 0x53) AM_DEVREADWRITE(Z80PIO, "z80pio_1", z80pio_r, z80pio_w)
- AM_RANGE(0x80, 0x80) AM_READWRITE(ay8910_read_port_0_r, ay8910_control_port_0_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x80, 0x80) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
AM_RANGE(0xff, 0xff) AM_WRITE(meritm_crt250_bank_w)
ADDRESS_MAP_END
@@ -589,8 +589,8 @@ static ADDRESS_MAP_START( meritm_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x40, 0x43) AM_DEVREADWRITE(Z80PIO, "z80pio_0", z80pio_r, z80pio_w)
AM_RANGE(0x50, 0x53) AM_DEVREADWRITE(Z80PIO, "z80pio_1", z80pio_r, z80pio_w)
AM_RANGE(0x60, 0x67) AM_READWRITE(pc16552d_0_r,pc16552d_0_w)
- AM_RANGE(0x80, 0x80) AM_READWRITE(ay8910_read_port_0_r, ay8910_control_port_0_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x80, 0x80) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
AM_RANGE(0xff, 0xff) AM_WRITE(meritm_bank_w)
ADDRESS_MAP_END
@@ -723,12 +723,7 @@ static const ppi8255_interface crt250_ppi8255_intf =
Port B: Bits 0,1 used
*/
-static READ8_HANDLER(meritm_ay8930_port_a_r)
-{
- return input_port_read_safe(space->machine, "DSW", 0);
-};
-
-static WRITE8_HANDLER(meritm_ay8930_port_b_w)
+static WRITE8_DEVICE_HANDLER(meritm_ay8930_port_b_w)
{
// lamps
};
@@ -737,10 +732,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- meritm_ay8930_port_a_r, /* Port A read */
- NULL, /* Port B read */
- NULL, /* Port A write */
- meritm_ay8930_port_b_w /* Port B write */
+ DEVCB_INPUT_PORT("DSW"), /* Port A read */
+ DEVCB_NULL, /* Port B read */
+ DEVCB_NULL, /* Port A write */
+ DEVCB_HANDLER(meritm_ay8930_port_b_w) /* Port B write */
};
/*************************************
diff --git a/src/mame/drivers/mermaid.c b/src/mame/drivers/mermaid.c
index dd576122a82..d0fee41e6fc 100644
--- a/src/mame/drivers/mermaid.c
+++ b/src/mame/drivers/mermaid.c
@@ -144,14 +144,14 @@ static UINT8 *mermaid_ay8910_enable;
static WRITE8_HANDLER( mermaid_ay8910_write_port_w )
{
- if (mermaid_ay8910_enable[0]) ay8910_write_port_0_w(space, offset, data);
- if (mermaid_ay8910_enable[1]) ay8910_write_port_1_w(space, offset, data);
+ if (mermaid_ay8910_enable[0]) ay8910_data_w(devtag_get_device(space->machine, SOUND, "ay1"), offset, data);
+ if (mermaid_ay8910_enable[1]) ay8910_data_w(devtag_get_device(space->machine, SOUND, "ay2"), offset, data);
}
static WRITE8_HANDLER( mermaid_ay8910_control_port_w )
{
- if (mermaid_ay8910_enable[0]) ay8910_control_port_0_w(space, offset, data);
- if (mermaid_ay8910_enable[1]) ay8910_control_port_1_w(space, offset, data);
+ if (mermaid_ay8910_enable[0]) ay8910_address_w(devtag_get_device(space->machine, SOUND, "ay1"), offset, data);
+ if (mermaid_ay8910_enable[1]) ay8910_address_w(devtag_get_device(space->machine, SOUND, "ay2"), offset, data);
}
diff --git a/src/mame/drivers/metlclsh.c b/src/mame/drivers/metlclsh.c
index e28f5f6f20e..75ca640a850 100644
--- a/src/mame/drivers/metlclsh.c
+++ b/src/mame/drivers/metlclsh.c
@@ -35,7 +35,7 @@ metlclsh:
#include "deprecat.h"
#include "cpu/m6809/m6809.h"
#include "sound/2203intf.h"
-#include "sound/3812intf.h"
+#include "sound/3526intf.h"
/* Variables defined in video: */
@@ -82,7 +82,7 @@ static ADDRESS_MAP_START( metlclsh_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xc003, 0xc003) AM_READ_PORT("DSW")
// AM_RANGE(0xc800, 0xc82f) AM_READ(SMH_RAM ) // not actually read
// AM_RANGE(0xcc00, 0xcc2f) AM_READ(SMH_RAM ) // ""
- AM_RANGE(0xd000, 0xd000) AM_READ(ym2203_status_port_0_r )
+ AM_RANGE(0xd000, 0xd001) AM_DEVREAD(SOUND, "ym1", ym2203_r )
// AM_RANGE(0xd800, 0xdfff) AM_READ(SMH_RAM ) // not actually read
AM_RANGE(0xe800, 0xe9ff) AM_READ(SMH_RAM )
AM_RANGE(0xfff0, 0xffff) AM_READ(SMH_ROM ) // Reset/IRQ vectors
@@ -97,10 +97,8 @@ static ADDRESS_MAP_START( metlclsh_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xc0c3, 0xc0c3) AM_WRITE(metlclsh_ack_nmi ) // nmi ack
AM_RANGE(0xc800, 0xc82f) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split1_w) AM_BASE(&paletteram )
AM_RANGE(0xcc00, 0xcc2f) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split2_w) AM_BASE(&paletteram_2 )
- AM_RANGE(0xd000, 0xd000) AM_WRITE(ym2203_control_port_0_w )
- AM_RANGE(0xd001, 0xd001) AM_WRITE(ym2203_write_port_0_w )
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ym3526_control_port_0_w )
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ym3526_write_port_0_w )
+ AM_RANGE(0xd000, 0xd001) AM_DEVWRITE(SOUND, "ym1", ym2203_w )
+ AM_RANGE(0xe000, 0xe001) AM_DEVWRITE(SOUND, "ym2", ym3526_w )
AM_RANGE(0xe800, 0xe9ff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size )
AM_RANGE(0xd800, 0xdfff) AM_WRITE(metlclsh_fgram_w) AM_BASE(&metlclsh_fgram )
AM_RANGE(0xfff0, 0xffff) AM_WRITE(SMH_ROM )
@@ -287,9 +285,9 @@ GFXDECODE_END
***************************************************************************/
-static void metlclsh_irqhandler(running_machine *machine, int linestate)
+static void metlclsh_irqhandler(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[0],M6809_IRQ_LINE,linestate);
+ cpu_set_input_line(device->machine->cpu[0],M6809_IRQ_LINE,linestate);
}
static const ym3526_interface ym3526_config =
diff --git a/src/mame/drivers/metro.c b/src/mame/drivers/metro.c
index 429046ad3d3..9a7f03d06e2 100644
--- a/src/mame/drivers/metro.c
+++ b/src/mame/drivers/metro.c
@@ -319,9 +319,9 @@ static INTERRUPT_GEN( dokyusei_interrupt )
}
}
-static void ymf278b_interrupt(running_machine *machine, int active)
+static void ymf278b_interrupt(const device_config *device, int active)
{
- cpu_set_input_line(machine->cpu[0], 2, active);
+ cpu_set_input_line(device->machine->cpu[0], 2, active);
}
/***************************************************************************
@@ -441,11 +441,8 @@ static WRITE8_HANDLER( metro_portb_w )
{
if (!BIT(data,2))
{
- /* write */
- if (BIT(data,1))
- ym2413_data_port_0_w(space,0,porta);
- else
- ym2413_register_port_0_w(space,0,porta);
+ const device_config *ym = devtag_get_device(space->machine, SOUND, "ym");
+ ym2413_w(ym,BIT(data,1),porta);
}
portb = data;
return;
@@ -455,7 +452,7 @@ static WRITE8_HANDLER( metro_portb_w )
{
/* write */
if (!BIT(data,4))
- okim6295_data_0_w(space,0,porta);
+ okim6295_w(devtag_get_device(space->machine, SOUND, "oki"),0,porta);
}
portb = data;
}
@@ -483,19 +480,16 @@ static WRITE8_HANDLER( daitorid_portb_w )
if (BIT(portb,6) && !BIT(data,6)) /* clock 1->0 */
{
+ const device_config *ym = devtag_get_device(space->machine, SOUND, "ym");
if (!BIT(data,2))
{
/* write */
- if (BIT(data,1))
- ym2151_data_port_0_w(space,0,porta);
- else
- ym2151_register_port_0_w(space,0,porta);
+ ym2151_w(ym,BIT(data,1),porta);
}
if (!BIT(data,3))
{
/* read */
- if (BIT(data,1))
- porta = ym2151_status_port_0_r(space,0);
+ porta = ym2151_r(ym,BIT(data,1));
}
portb = data;
return;
@@ -505,20 +499,20 @@ static WRITE8_HANDLER( daitorid_portb_w )
{
/* write */
if (!BIT(data,4))
- okim6295_data_0_w(space,0,porta);
+ okim6295_w(devtag_get_device(space->machine, SOUND, "oki"),0,porta);
}
if (BIT(portb,3) && !BIT(data,3)) /* clock 1->0 */
{
/* read */
if (!BIT(data,4))
- porta = okim6295_status_0_r(space,0);
+ porta = okim6295_r(devtag_get_device(space->machine, SOUND, "oki"),0);
}
portb = data;
}
-static void metro_sound_irq_handler(running_machine *machine, int state)
+static void metro_sound_irq_handler(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1], UPD7810_INTF2, state ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], UPD7810_INTF2, state ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2151_interface ym2151_config =
@@ -527,38 +521,6 @@ static const ym2151_interface ym2151_config =
};
-static READ16_HANDLER( ymf278b_r )
-{
- return ymf278b_status_port_0_r(space, 0);
-}
-
-static WRITE16_HANDLER( ymf278b_w )
-{
- if(ACCESSING_BITS_0_7)
- switch(offset)
- {
- case 0:
- ymf278b_control_port_0_a_w(space, 0, data);
- break;
- case 1:
- ymf278b_data_port_0_a_w(space, 0, data);
- break;
- case 2:
- ymf278b_control_port_0_b_w(space, 0, data);
- break;
- case 3:
- ymf278b_data_port_0_b_w(space, 0, data);
- break;
- case 4:
- ymf278b_control_port_0_c_w(space, 0, data);
- break;
- case 5:
- ymf278b_data_port_0_c_w(space, 0, data);
- break;
- }
-}
-
-
static const ymf278b_interface ymf278b_config =
{
ymf278b_interrupt
@@ -935,7 +897,7 @@ static READ16_HANDLER( balcube_dsw_r )
static ADDRESS_MAP_START( balcube_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0xf00000, 0xf0ffff) AM_READ(SMH_RAM ) // RAM
- AM_RANGE(0x300000, 0x300001) AM_READ(ymf278b_r ) // Sound
+ AM_RANGE(0x300000, 0x300001) AM_DEVREAD8(SOUND, "ymf", ymf278b_r, 0x00ff) // Sound
AM_RANGE(0x400000, 0x41ffff) AM_READ(balcube_dsw_r ) // DSW x 3
AM_RANGE(0x600000, 0x61ffff) AM_READ(SMH_RAM ) // Layer 0
AM_RANGE(0x620000, 0x63ffff) AM_READ(SMH_RAM ) // Layer 1
@@ -953,7 +915,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( balcube_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_WRITE(SMH_ROM ) // ROM
AM_RANGE(0xf00000, 0xf0ffff) AM_WRITE(SMH_RAM ) // RAM
- AM_RANGE(0x300000, 0x30000b) AM_WRITE(ymf278b_w ) // Sound
+ AM_RANGE(0x300000, 0x30000b) AM_DEVWRITE8(SOUND, "ymf", ymf278b_w, 0x00ff) // Sound
AM_RANGE(0x500002, 0x500009) AM_WRITE(metro_coin_lockout_4words_w ) // Coin Lockout
AM_RANGE(0x670000, 0x673fff) AM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w ) AM_BASE(&paletteram16 ) // Palette
AM_RANGE(0x674000, 0x674fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size ) // Sprites
@@ -981,7 +943,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( daitoa_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0xf00000, 0xf0ffff) AM_READ(SMH_RAM ) // RAM
- AM_RANGE(0x400000, 0x400001) AM_READ(ymf278b_r ) // Sound
+ AM_RANGE(0x400000, 0x400001) AM_DEVREAD8(SOUND, "ymf", ymf278b_r, 0x00ff) // Sound
AM_RANGE(0x300000, 0x31ffff) AM_READ(balcube_dsw_r ) // DSW x 3
AM_RANGE(0x100000, 0x11ffff) AM_READ(SMH_RAM ) // Layer 0
AM_RANGE(0x120000, 0x13ffff) AM_READ(SMH_RAM ) // Layer 1
@@ -999,7 +961,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( daitoa_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_WRITE(SMH_ROM ) // ROM
AM_RANGE(0xf00000, 0xf0ffff) AM_WRITE(SMH_RAM ) // RAM
- AM_RANGE(0x400000, 0x40000b) AM_WRITE(ymf278b_w ) // Sound
+ AM_RANGE(0x400000, 0x40000b) AM_DEVWRITE8(SOUND, "ymf", ymf278b_w, 0x00ff) // Sound
AM_RANGE(0x200002, 0x200009) AM_WRITE(metro_coin_lockout_4words_w ) // Coin Lockout
AM_RANGE(0x170000, 0x173fff) AM_WRITE(paletteram16_GGGGGRRRRRBBBBBx_word_w ) AM_BASE(&paletteram16 ) // Palette
AM_RANGE(0x174000, 0x174fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size ) // Sprites
@@ -1028,7 +990,7 @@ static ADDRESS_MAP_START( bangball_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0xf00000, 0xf0ffff) AM_READ(SMH_RAM ) // RAM
AM_RANGE(0xf10000, 0xf10fff) AM_READ(SMH_RAM ) // RAM (bug in the ram test routine)
- AM_RANGE(0xb00000, 0xb00001) AM_READ(ymf278b_r ) // Sound
+ AM_RANGE(0xb00000, 0xb00001) AM_DEVREAD8(SOUND, "ymf", ymf278b_r, 0x00ff) // Sound
AM_RANGE(0xc00000, 0xc1ffff) AM_READ(balcube_dsw_r ) // DSW x 3
AM_RANGE(0xd00000, 0xd00001) AM_READ_PORT("IN0") // Inputs
AM_RANGE(0xd00002, 0xd00003) AM_READ_PORT("IN1") //
@@ -1047,7 +1009,7 @@ static ADDRESS_MAP_START( bangball_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_WRITE(SMH_ROM ) // ROM
AM_RANGE(0xf00000, 0xf0ffff) AM_WRITE(SMH_RAM ) // RAM
AM_RANGE(0xf10000, 0xf10fff) AM_WRITE(SMH_RAM ) // RAM
- AM_RANGE(0xb00000, 0xb0000b) AM_WRITE(ymf278b_w ) // Sound
+ AM_RANGE(0xb00000, 0xb0000b) AM_DEVWRITE8(SOUND, "ymf", ymf278b_w, 0x00ff) // Sound
AM_RANGE(0xd00002, 0xd00009) AM_WRITE(metro_coin_lockout_4words_w ) // Coin Lockout
AM_RANGE(0xe00000, 0xe1ffff) AM_WRITE(metro_vram_0_w) AM_BASE(&metro_vram_0 ) // Layer 0
AM_RANGE(0xe20000, 0xe3ffff) AM_WRITE(metro_vram_1_w) AM_BASE(&metro_vram_1 ) // Layer 1
@@ -1086,7 +1048,7 @@ static ADDRESS_MAP_START( batlbubl_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x200004, 0x200005) AM_READ_PORT("IN0")
AM_RANGE(0x200006, 0x200007) AM_READ_PORT("IN2")
AM_RANGE(0x300000, 0x31ffff) AM_READ(balcube_dsw_r ) // read but ignored?
- AM_RANGE(0x400000, 0x400001) AM_READ(ymf278b_r ) // Sound
+ AM_RANGE(0x400000, 0x400001) AM_DEVREAD8(SOUND, "ymf", ymf278b_r, 0x00ff) // Sound
AM_RANGE(0xf00000, 0xf0ffff) AM_READ(SMH_RAM ) // RAM
AM_RANGE(0xf10000, 0xf10fff) AM_READ(SMH_RAM ) // RAM (bug in the ram test routine)
ADDRESS_MAP_END
@@ -1110,7 +1072,7 @@ static ADDRESS_MAP_START( batlbubl_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x1788ac, 0x1788ad) AM_WRITE(SMH_RAM) AM_BASE(&metro_screenctrl ) // Screen Control
AM_RANGE(0x179700, 0x179713) AM_WRITE(SMH_RAM) AM_BASE(&metro_videoregs ) // Video Registers
AM_RANGE(0x200002, 0x200009) AM_WRITE(metro_coin_lockout_4words_w ) // Coin Lockout
- AM_RANGE(0x400000, 0x40000b) AM_WRITE(ymf278b_w ) // Sound
+ AM_RANGE(0x400000, 0x40000b) AM_DEVWRITE8(SOUND, "ymf", ymf278b_w, 0x00ff) // Sound
AM_RANGE(0xf00000, 0xf0ffff) AM_WRITE(SMH_RAM ) // RAM
AM_RANGE(0xf10000, 0xf10fff) AM_WRITE(SMH_RAM ) // RAM
ADDRESS_MAP_END
@@ -1426,27 +1388,27 @@ ADDRESS_MAP_END
static int gakusai_oki_bank_lo, gakusai_oki_bank_hi;
-static void gakusai_oki_bank_set(void)
+static void gakusai_oki_bank_set(const device_config *device)
{
int bank = (gakusai_oki_bank_lo & 7) + (gakusai_oki_bank_hi & 1) * 8;
- okim6295_set_bank_base(0, bank * 0x40000);
+ okim6295_set_bank_base(device, bank * 0x40000);
}
-static WRITE16_HANDLER( gakusai_oki_bank_hi_w )
+static WRITE16_DEVICE_HANDLER( gakusai_oki_bank_hi_w )
{
if (ACCESSING_BITS_0_7)
{
gakusai_oki_bank_hi = data & 0xff;
- gakusai_oki_bank_set();
+ gakusai_oki_bank_set(device);
}
}
-static WRITE16_HANDLER( gakusai_oki_bank_lo_w )
+static WRITE16_DEVICE_HANDLER( gakusai_oki_bank_lo_w )
{
if (ACCESSING_BITS_0_7)
{
gakusai_oki_bank_lo = data & 0xff;
- gakusai_oki_bank_set();
+ gakusai_oki_bank_set(device);
}
}
@@ -1498,7 +1460,7 @@ static ADDRESS_MAP_START( gakusai_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x278880, 0x278881) AM_READ(gakusai_input_r ) // Inputs
AM_RANGE(0x278882, 0x278883) AM_READ_PORT("IN0") //
AM_RANGE(0x27880e, 0x27880f) AM_READ(SMH_RAM ) // Screen Control
- AM_RANGE(0x700000, 0x700001) AM_READ(okim6295_status_0_lsb_r ) // Sound
+ AM_RANGE(0x700000, 0x700001) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff ) // Sound
AM_RANGE(0xc00000, 0xc00001) AM_READ(gakusai_eeprom_r ) // EEPROM
ADDRESS_MAP_END
@@ -1524,12 +1486,11 @@ static ADDRESS_MAP_START( gakusai_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x278888, 0x278889) AM_WRITE(SMH_RAM) AM_BASE(&gakusai_input_sel ) // Inputs
AM_RANGE(0x279700, 0x279713) AM_WRITE(SMH_RAM) AM_BASE(&metro_videoregs ) // Video Registers
AM_RANGE(0x400000, 0x400001) AM_WRITE(SMH_NOP ) // ? 5
- AM_RANGE(0x500000, 0x500001) AM_WRITE(gakusai_oki_bank_lo_w ) // Sound
- AM_RANGE(0x600000, 0x600001) AM_WRITE(ym2413_register_port_0_lsb_w )
- AM_RANGE(0x600002, 0x600003) AM_WRITE(ym2413_data_port_0_lsb_w )
- AM_RANGE(0x700000, 0x700001) AM_WRITE(okim6295_data_0_lsb_w )
+ AM_RANGE(0x500000, 0x500001) AM_DEVWRITE(SOUND, "oki", gakusai_oki_bank_lo_w ) // Sound
+ AM_RANGE(0x600000, 0x600003) AM_DEVWRITE8(SOUND, "ym", ym2413_w, 0x00ff)
+ AM_RANGE(0x700000, 0x700001) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff )
AM_RANGE(0xc00000, 0xc00001) AM_WRITE(gakusai_eeprom_w ) // EEPROM
- AM_RANGE(0xd00000, 0xd00001) AM_WRITE(gakusai_oki_bank_hi_w )
+ AM_RANGE(0xd00000, 0xd00001) AM_DEVWRITE(SOUND, "oki", gakusai_oki_bank_hi_w )
ADDRESS_MAP_END
@@ -1552,7 +1513,7 @@ static ADDRESS_MAP_START( gakusai2_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x678880, 0x678881) AM_READ(gakusai_input_r ) // Inputs
AM_RANGE(0x678882, 0x678883) AM_READ_PORT("IN0") //
AM_RANGE(0x67880e, 0x67880f) AM_READ(SMH_RAM ) // Screen Control
- AM_RANGE(0xb00000, 0xb00001) AM_READ(okim6295_status_0_lsb_r ) // Sound
+ AM_RANGE(0xb00000, 0xb00001) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff ) // Sound
AM_RANGE(0xe00000, 0xe00001) AM_READ(gakusai_eeprom_r ) // EEPROM
ADDRESS_MAP_END
@@ -1579,11 +1540,10 @@ static ADDRESS_MAP_START( gakusai2_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x678888, 0x678889) AM_WRITE(SMH_RAM) AM_BASE(&gakusai_input_sel ) // Inputs
AM_RANGE(0x679700, 0x679713) AM_WRITE(SMH_RAM) AM_BASE(&metro_videoregs ) // Video Registers
AM_RANGE(0x800000, 0x800001) AM_WRITE(SMH_NOP ) // ? 5
- AM_RANGE(0x900000, 0x900001) AM_WRITE(gakusai_oki_bank_lo_w ) // Sound
- AM_RANGE(0xa00000, 0xa00001) AM_WRITE(gakusai_oki_bank_hi_w )
- AM_RANGE(0xb00000, 0xb00001) AM_WRITE(okim6295_data_0_lsb_w )
- AM_RANGE(0xc00000, 0xc00001) AM_WRITE(ym2413_register_port_0_lsb_w )
- AM_RANGE(0xc00002, 0xc00003) AM_WRITE(ym2413_data_port_0_lsb_w )
+ AM_RANGE(0x900000, 0x900001) AM_DEVWRITE(SOUND, "oki", gakusai_oki_bank_lo_w ) // Sound
+ AM_RANGE(0xa00000, 0xa00001) AM_DEVWRITE(SOUND, "oki", gakusai_oki_bank_hi_w )
+ AM_RANGE(0xb00000, 0xb00001) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff )
+ AM_RANGE(0xc00000, 0xc00003) AM_DEVWRITE8(SOUND, "ym", ym2413_w, 0x00ff)
AM_RANGE(0xe00000, 0xe00001) AM_WRITE(gakusai_eeprom_w ) // EEPROM
ADDRESS_MAP_END
@@ -1637,7 +1597,7 @@ static ADDRESS_MAP_START( dokyusp_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x278880, 0x278881) AM_READ(gakusai_input_r ) // Inputs
AM_RANGE(0x278882, 0x278883) AM_READ_PORT("IN0") //
AM_RANGE(0x27880e, 0x27880f) AM_READ(SMH_RAM ) // Screen Control
- AM_RANGE(0x700000, 0x700001) AM_READ(okim6295_status_0_lsb_r ) // Sound
+ AM_RANGE(0x700000, 0x700001) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff ) // Sound
AM_RANGE(0xd00000, 0xd00001) AM_READ(dokyusp_eeprom_r ) // EEPROM
ADDRESS_MAP_END
@@ -1663,10 +1623,9 @@ static ADDRESS_MAP_START( dokyusp_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x278888, 0x278889) AM_WRITE(SMH_RAM) AM_BASE(&gakusai_input_sel ) // Inputs
AM_RANGE(0x279700, 0x279713) AM_WRITE(SMH_RAM) AM_BASE(&metro_videoregs ) // Video Registers
AM_RANGE(0x400000, 0x400001) AM_WRITE(SMH_NOP ) // ? 5
- AM_RANGE(0x500000, 0x500001) AM_WRITE(gakusai_oki_bank_lo_w ) // Sound
- AM_RANGE(0x600000, 0x600001) AM_WRITE(ym2413_register_port_0_lsb_w )
- AM_RANGE(0x600002, 0x600003) AM_WRITE(ym2413_data_port_0_lsb_w )
- AM_RANGE(0x700000, 0x700001) AM_WRITE(okim6295_data_0_lsb_w )
+ AM_RANGE(0x500000, 0x500001) AM_DEVWRITE(SOUND, "oki", gakusai_oki_bank_lo_w ) // Sound
+ AM_RANGE(0x600000, 0x600003) AM_DEVWRITE8(SOUND, "ym", ym2413_w, 0x00ff)
+ AM_RANGE(0x700000, 0x700001) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff)
AM_RANGE(0xc00000, 0xc00001) AM_WRITE(dokyusp_eeprom_reset_w ) // EEPROM
AM_RANGE(0xd00000, 0xd00001) AM_WRITE(dokyusp_eeprom_bit_w ) // EEPROM
ADDRESS_MAP_END
@@ -1691,7 +1650,7 @@ static ADDRESS_MAP_START( dokyusei_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x478882, 0x478883) AM_READ_PORT("IN0") //
AM_RANGE(0x478884, 0x478885) AM_READ_PORT("DSW0") // 2 x DSW
AM_RANGE(0x478886, 0x478887) AM_READ_PORT("DSW1") //
- AM_RANGE(0xd00000, 0xd00001) AM_READ(okim6295_status_0_lsb_r ) // Sound
+ AM_RANGE(0xd00000, 0xd00001) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff ) // Sound
ADDRESS_MAP_END
static ADDRESS_MAP_START( dokyusei_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -1716,12 +1675,11 @@ static ADDRESS_MAP_START( dokyusei_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x478870, 0x478871) AM_WRITE(SMH_RAM) AM_BASE(&metro_rombank ) // Rom Bank
AM_RANGE(0x479700, 0x479713) AM_WRITE(SMH_RAM) AM_BASE(&metro_videoregs ) // Video Registers
AM_RANGE(0x478888, 0x478889) AM_WRITE(SMH_RAM) AM_BASE(&gakusai_input_sel ) // Inputs
- AM_RANGE(0x800000, 0x800001) AM_WRITE(gakusai_oki_bank_hi_w ) // Samples Bank?
+ AM_RANGE(0x800000, 0x800001) AM_DEVWRITE(SOUND, "oki", gakusai_oki_bank_hi_w ) // Samples Bank?
AM_RANGE(0x900000, 0x900001) AM_WRITE(SMH_NOP ) // ? 4
- AM_RANGE(0xa00000, 0xa00001) AM_WRITE(gakusai_oki_bank_lo_w ) // Samples Bank
- AM_RANGE(0xc00000, 0xc00001) AM_WRITE(ym2413_register_port_0_lsb_w ) // Sound
- AM_RANGE(0xc00002, 0xc00003) AM_WRITE(ym2413_data_port_0_lsb_w ) //
- AM_RANGE(0xd00000, 0xd00001) AM_WRITE(okim6295_data_0_lsb_w ) //
+ AM_RANGE(0xa00000, 0xa00001) AM_DEVWRITE(SOUND, "oki", gakusai_oki_bank_lo_w ) // Samples Bank
+ AM_RANGE(0xc00000, 0xc00003) AM_DEVWRITE8(SOUND, "ym", ym2413_w, 0x00ff) //
+ AM_RANGE(0xd00000, 0xd00001) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff ) //
ADDRESS_MAP_END
@@ -1982,9 +1940,9 @@ static WRITE8_HANDLER( blzntrnd_sh_bankswitch_w )
memory_set_bankptr(space->machine, 1, &RAM[bankaddress]);
}
-static void blzntrnd_irqhandler(running_machine *machine, int irq)
+static void blzntrnd_irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface blzntrnd_ym2610_interface =
@@ -2007,18 +1965,14 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( blzntrnd_sound_readport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x40, 0x40) AM_READ(soundlatch_r)
- AM_RANGE(0x80, 0x80) AM_READ(ym2610_status_port_0_a_r)
- AM_RANGE(0x82, 0x82) AM_READ(ym2610_status_port_0_b_r)
+ AM_RANGE(0x80, 0x83) AM_DEVREAD(SOUND, "ym", ym2610_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( blzntrnd_sound_writeport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(blzntrnd_sh_bankswitch_w)
AM_RANGE(0x40, 0x40) AM_WRITE(SMH_NOP)
- AM_RANGE(0x80, 0x80) AM_WRITE(ym2610_control_port_0_a_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ym2610_data_port_0_a_w)
- AM_RANGE(0x82, 0x82) AM_WRITE(ym2610_control_port_0_b_w)
- AM_RANGE(0x83, 0x83) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0x80, 0x83) AM_DEVWRITE(SOUND, "ym", ym2610_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( blzntrnd_readmem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -2071,10 +2025,10 @@ ADDRESS_MAP_END
Mouja
***************************************************************************/
-static WRITE16_HANDLER( mouja_sound_rombank_w )
+static WRITE16_DEVICE_HANDLER( mouja_sound_rombank_w )
{
if (ACCESSING_BITS_0_7)
- okim6295_set_bank_base(0, ((data >> 3) & 0x07) * 0x40000);
+ okim6295_set_bank_base(device, ((data >> 3) & 0x07) * 0x40000);
}
static ADDRESS_MAP_START( mouja_readmem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -2091,7 +2045,7 @@ static ADDRESS_MAP_START( mouja_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x478882, 0x478883) AM_READ_PORT("IN1") //
AM_RANGE(0x478884, 0x478885) AM_READ_PORT("DSW0") //
AM_RANGE(0x478886, 0x478887) AM_READ_PORT("IN2") //
- AM_RANGE(0xd00000, 0xd00001) AM_READ(okim6295_status_0_lsb_r)
+ AM_RANGE(0xd00000, 0xd00001) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff)
#if 0
AM_RANGE(0x460000, 0x46ffff) AM_READ(metro_bankedrom_r ) // Banked ROM
#endif
@@ -2117,10 +2071,9 @@ static ADDRESS_MAP_START( mouja_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x478850, 0x47885b) AM_WRITE(SMH_RAM) AM_BASE(&metro_scroll ) // Scroll Regs
AM_RANGE(0x478888, 0x478889) AM_WRITE(SMH_NOP) // ??
AM_RANGE(0x479700, 0x479713) AM_WRITE(SMH_RAM) AM_BASE(&metro_videoregs ) // Video Registers
- AM_RANGE(0xc00000, 0xc00001) AM_WRITE(ym2413_register_port_0_lsb_w )
- AM_RANGE(0xc00002, 0xc00003) AM_WRITE(ym2413_data_port_0_lsb_w )
- AM_RANGE(0x800000, 0x800001) AM_WRITE(mouja_sound_rombank_w )
- AM_RANGE(0xd00000, 0xd00001) AM_WRITE(okim6295_data_0_msb_w )
+ AM_RANGE(0xc00000, 0xc00003) AM_DEVWRITE8(SOUND, "ym", ym2413_w, 0x00ff)
+ AM_RANGE(0x800000, 0x800001) AM_DEVWRITE(SOUND, "oki", mouja_sound_rombank_w )
+ AM_RANGE(0xd00000, 0xd00001) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff )
#if 0
AM_RANGE(0x478840, 0x47884d) AM_WRITE(metro_blitter_w) AM_BASE(&metro_blitter_regs ) // Tiles Blitter
@@ -2146,9 +2099,8 @@ static ADDRESS_MAP_START( puzzlet_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE( 0x430000, 0x433fff ) AM_RAM
AM_RANGE( 0x470000, 0x47dfff ) AM_RAM
- AM_RANGE( 0x500000, 0x500001 ) AM_READWRITE( okim6295_status_0_msb_r, okim6295_data_0_msb_w )
- AM_RANGE( 0x580000, 0x580001 ) AM_WRITE( ym2413_register_port_0_msb_w )
- AM_RANGE( 0x580002, 0x580003 ) AM_WRITE( ym2413_data_port_0_msb_w )
+ AM_RANGE( 0x500000, 0x500001 ) AM_DEVREADWRITE8( SOUND, "oki", okim6295_r, okim6295_w, 0xff00 )
+ AM_RANGE( 0x580000, 0x580003 ) AM_DEVWRITE8( SOUND, "ym", ym2413_w, 0xff00 )
AM_RANGE( 0x700000, 0x71ffff ) AM_READWRITE( SMH_RAM, metro_vram_0_w ) AM_BASE( &metro_vram_0 ) // Layer 0
AM_RANGE( 0x720000, 0x73ffff ) AM_READWRITE( SMH_RAM, metro_vram_1_w ) AM_BASE( &metro_vram_1 ) // Layer 1
diff --git a/src/mame/drivers/mexico86.c b/src/mame/drivers/mexico86.c
index 25e50af1bcd..67feff2cd61 100644
--- a/src/mame/drivers/mexico86.c
+++ b/src/mame/drivers/mexico86.c
@@ -52,9 +52,12 @@ PS4 J8635 PS4 J8541 PS4 J8648
#include "includes/mexico86.h"
//AT
-static READ8_HANDLER( kiki_2203_r )
+static READ8_DEVICE_HANDLER( kiki_ym2203_r )
{
- return(ym2203_status_port_0_r(space,0) & 0x7f);
+ UINT8 result = ym2203_r(device, offset);
+ if (offset == 0)
+ result &= 0x7f;
+ return result;
}
//ZT
@@ -99,16 +102,14 @@ static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0xa7ff) AM_READ(shared_r)
AM_RANGE(0xa800, 0xbfff) AM_READ(SMH_RAM)
- AM_RANGE(0xc000, 0xc000) AM_READ(kiki_2203_r) //AT
- AM_RANGE(0xc001, 0xc001) AM_READ(ym2203_read_port_0_r)
+ AM_RANGE(0xc000, 0xc001) AM_DEVREAD(SOUND, "ym", kiki_ym2203_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0xa7ff) AM_WRITE(shared_w)
AM_RANGE(0xa800, 0xbfff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ym", ym2203_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( m68705_readmem, ADDRESS_SPACE_PROGRAM, 8 )
@@ -357,10 +358,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_3_r,
- input_port_4_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW0"),
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_NULL,
+ DEVCB_NULL
},
NULL
};
diff --git a/src/mame/drivers/mhavoc.c b/src/mame/drivers/mhavoc.c
index 007b3a2c391..f8d68816208 100644
--- a/src/mame/drivers/mhavoc.c
+++ b/src/mame/drivers/mhavoc.c
@@ -207,9 +207,9 @@ static READ8_HANDLER( dual_pokey_r )
int pokey_reg = (offset % 8) | control;
if (pokey_num == 0)
- return pokey1_r(space, pokey_reg);
+ return pokey_r(devtag_get_device(space->machine, SOUND, "pokey1"), pokey_reg);
else
- return pokey2_r(space, pokey_reg);
+ return pokey_r(devtag_get_device(space->machine, SOUND, "pokey2"), pokey_reg);
}
@@ -220,9 +220,9 @@ static WRITE8_HANDLER( dual_pokey_w )
int pokey_reg = (offset % 8) | control;
if (pokey_num == 0)
- pokey1_w(space, pokey_reg, data);
+ pokey_w(devtag_get_device(space->machine, SOUND, "pokey1"), pokey_reg, data);
else
- pokey2_w(space, pokey_reg, data);
+ pokey_w(devtag_get_device(space->machine, SOUND, "pokey2"), pokey_reg, data);
}
@@ -240,7 +240,8 @@ static WRITE8_HANDLER( speech_data_w )
static WRITE8_HANDLER( speech_strobe_w )
{
- tms5220_data_w(space, 0, speech_write_buffer);
+ const device_config *tms = devtag_get_device(space->machine, SOUND, "tms");
+ tms5220_data_w(tms, 0, speech_write_buffer);
}
/*************************************
@@ -479,8 +480,8 @@ INPUT_PORTS_END
static const pokey_interface pokey_config =
{
- { 0 },
- input_port_3_r
+ { DEVCB_NULL },
+ DEVCB_INPUT_PORT("DSW1")
};
@@ -514,17 +515,17 @@ static MACHINE_DRIVER_START( mhavoc )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("pokey.1", POKEY, MHAVOC_CLOCK_1_25M)
+ MDRV_SOUND_ADD("pokey1", POKEY, MHAVOC_CLOCK_1_25M)
MDRV_SOUND_CONFIG(pokey_config)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
- MDRV_SOUND_ADD("pokey.2", POKEY, MHAVOC_CLOCK_1_25M)
+ MDRV_SOUND_ADD("pokey2", POKEY, MHAVOC_CLOCK_1_25M)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
- MDRV_SOUND_ADD("pokey.3", POKEY, MHAVOC_CLOCK_1_25M)
+ MDRV_SOUND_ADD("pokey3", POKEY, MHAVOC_CLOCK_1_25M)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
- MDRV_SOUND_ADD("pokey.4", POKEY, MHAVOC_CLOCK_1_25M)
+ MDRV_SOUND_ADD("pokey4", POKEY, MHAVOC_CLOCK_1_25M)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MACHINE_DRIVER_END
@@ -549,14 +550,14 @@ static MACHINE_DRIVER_START( alphaone )
MDRV_SCREEN_VISIBLE_AREA(0, 580, 0, 500)
/* sound hardware */
- MDRV_SOUND_REPLACE("pokey.1", POKEY, MHAVOC_CLOCK_1_25M)
+ MDRV_SOUND_REPLACE("pokey1", POKEY, MHAVOC_CLOCK_1_25M)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
- MDRV_SOUND_REPLACE("pokey.2", POKEY, MHAVOC_CLOCK_1_25M)
+ MDRV_SOUND_REPLACE("pokey2", POKEY, MHAVOC_CLOCK_1_25M)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
- MDRV_SOUND_REMOVE("pokey.3")
- MDRV_SOUND_REMOVE("pokey.4")
+ MDRV_SOUND_REMOVE("pokey3")
+ MDRV_SOUND_REMOVE("pokey4")
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/micro3d.c b/src/mame/drivers/micro3d.c
index 8dc453c7e0b..58d539468b1 100644
--- a/src/mame/drivers/micro3d.c
+++ b/src/mame/drivers/micro3d.c
@@ -524,8 +524,9 @@ static WRITE8_HANDLER( sound_io_w )
}
case 0x03:
{
- upd7759_set_bank_base(0, (data & 0x4) ? 0x20000 : 0);
- upd7759_0_reset_w(space, 0, (data & 0x10) ? 0 : 1);
+ const device_config *upd = devtag_get_device(space->machine, SOUND, "upd7759");
+ upd7759_set_bank_base(upd, (data & 0x4) ? 0x20000 : 0);
+ upd7759_reset_w(upd, (data & 0x10) ? 0 : 1);
break;
}
}
@@ -536,16 +537,16 @@ static READ8_HANDLER( sound_io_r )
switch (offset)
{
case 0x01: return (sound_port_latch[offset] & 0x7f) | input_port_read_safe(space->machine, "SOUND_SW", 0);
- case 0x03: return (sound_port_latch[offset] & 0xf7) | (upd7759_0_busy_r(space, 0) ? 0x08 : 0);
+ case 0x03: return (sound_port_latch[offset] & 0xf7) | (upd7759_busy_r(devtag_get_device(space->machine, SOUND, "upd7759")) ? 0x08 : 0);
default: return 0;
}
}
-static WRITE8_HANDLER( upd7759_port_start_w )
+static WRITE8_DEVICE_HANDLER( upd7759_port_start_w )
{
- upd7759_0_port_w(space, offset, data);
- upd7759_0_start_w(space, offset, 0);
- upd7759_0_start_w(space, offset, 1);
+ upd7759_port_w(device, 0, data);
+ upd7759_start_w(device, 0);
+ upd7759_start_w(device, 1);
}
@@ -595,9 +596,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( soundmem_io, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM
- AM_RANGE(0xfd00, 0xfd00) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xfd01, 0xfd01) AM_READWRITE(ym2151_status_port_0_r,ym2151_data_port_0_w)
- AM_RANGE(0xfe00, 0xfe00) AM_WRITE(upd7759_port_start_w)
+ AM_RANGE(0xfd00, 0xfd01) AM_DEVREADWRITE(SOUND, "ym2151", ym2151_r, ym2151_w)
+ AM_RANGE(0xfe00, 0xfe00) AM_DEVWRITE(SOUND, "upd7759", upd7759_port_start_w)
AM_RANGE(0xff00, 0xff00) AM_NOP /* DAC A */
AM_RANGE(0xff01, 0xff01) AM_NOP /* DAC B */
AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READWRITE(sound_io_r,sound_io_w)
diff --git a/src/mame/drivers/midas.c b/src/mame/drivers/midas.c
index 7d63dd818fc..24c6855c4f3 100644
--- a/src/mame/drivers/midas.c
+++ b/src/mame/drivers/midas.c
@@ -238,8 +238,7 @@ static ADDRESS_MAP_START( mem_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xb40000, 0xb40001) AM_READ( ret_ffff )
AM_RANGE(0xb60000, 0xb60001) AM_READ( ret_ffff )
- AM_RANGE(0xb80008, 0xb80009) AM_WRITE( ymz280b_register_0_lsb_w )
- AM_RANGE(0xb8000a, 0xb8000b) AM_READWRITE( ymz280b_status_0_lsb_r, ymz280b_data_0_lsb_w )
+ AM_RANGE(0xb80008, 0xb8000b) AM_DEVREADWRITE8( SOUND, "ymz", ymz280b_r, ymz280b_w, 0x00ff )
AM_RANGE(0xba0000, 0xba0001) AM_READ_PORT("IN4")
AM_RANGE(0xbc0000, 0xbc0001) AM_READ_PORT("IN3")
@@ -422,7 +421,7 @@ static INPUT_PORTS_START( livequiz )
INPUT_PORTS_END
-static void livequiz_irqhandler(running_machine *machine, int state)
+static void livequiz_irqhandler(const device_config *device, int state)
{
logerror("YMZ280 is generating an interrupt. State=%08x\n",state);
}
diff --git a/src/mame/drivers/midyunit.c b/src/mame/drivers/midyunit.c
index e9e1a4172e8..4222e8bb56a 100644
--- a/src/mame/drivers/midyunit.c
+++ b/src/mame/drivers/midyunit.c
@@ -136,10 +136,10 @@ Notes:
*
*************************************/
-static WRITE8_HANDLER( yawdim_oki_bank_w )
+static WRITE8_DEVICE_HANDLER( yawdim_oki_bank_w )
{
if (data & 4)
- okim6295_set_bank_base(0, 0x40000 * (data & 3));
+ okim6295_set_bank_base(device, 0x40000 * (data & 3));
}
@@ -212,8 +212,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( yawdim_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
- AM_RANGE(0x9000, 0x97ff) AM_WRITE(yawdim_oki_bank_w)
- AM_RANGE(0x9800, 0x9fff) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x9000, 0x97ff) AM_DEVWRITE(SOUND, "oki", yawdim_oki_bank_w)
+ AM_RANGE(0x9800, 0x9fff) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0xa000, 0xa7ff) AM_READ(soundlatch_r)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/mikie.c b/src/mame/drivers/mikie.c
index 8079529eaa5..968ab20a72b 100644
--- a/src/mame/drivers/mikie.c
+++ b/src/mame/drivers/mikie.c
@@ -91,9 +91,9 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4000, 0x43ff) AM_RAM
AM_RANGE(0x8000, 0x8000) AM_WRITENOP // sound command latch
AM_RANGE(0x8001, 0x8001) AM_WRITENOP // ???
- AM_RANGE(0x8002, 0x8002) AM_WRITE(sn76496_0_w) // trigger read of latch
+ AM_RANGE(0x8002, 0x8002) AM_DEVWRITE(SOUND, "sn1", sn76496_w) // trigger read of latch
AM_RANGE(0x8003, 0x8003) AM_READ(soundlatch_r)
- AM_RANGE(0x8004, 0x8004) AM_WRITE(sn76496_1_w) // trigger read of latch
+ AM_RANGE(0x8004, 0x8004) AM_DEVWRITE(SOUND, "sn2", sn76496_w) // trigger read of latch
AM_RANGE(0x8005, 0x8005) AM_READ(mikie_sh_timer_r)
AM_RANGE(0x8079, 0x8079) AM_WRITENOP // ???
AM_RANGE(0xa003, 0xa003) AM_WRITENOP // ???
diff --git a/src/mame/drivers/mil4000.c b/src/mame/drivers/mil4000.c
index e10228eefa6..32cfb452891 100644
--- a/src/mame/drivers/mil4000.c
+++ b/src/mame/drivers/mil4000.c
@@ -251,7 +251,7 @@ static ADDRESS_MAP_START( mil4000_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x708006, 0x708007) AM_READ_PORT("IN2")
AM_RANGE(0x708008, 0x708009) AM_WRITE(output_w)
AM_RANGE(0x708010, 0x708011) AM_NOP //touch screen
- AM_RANGE(0x70801e, 0x70801f) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x70801e, 0x70801f) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x780000, 0x780fff) AM_RAM_WRITE(paletteram16_RRRRRGGGGGBBBBBx_word_w) AM_BASE(&paletteram16)
AM_RANGE(0xff0000, 0xffffff) AM_RAM AM_BASE(&generic_nvram16) AM_SIZE(&generic_nvram_size) // 2x CY62256L-70 (U7 & U8).
diff --git a/src/mame/drivers/mirage.c b/src/mame/drivers/mirage.c
index 59766e6bc85..dcdbbe5b0cb 100644
--- a/src/mame/drivers/mirage.c
+++ b/src/mame/drivers/mirage.c
@@ -212,8 +212,8 @@ static ADDRESS_MAP_START( mirage_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x130000, 0x1307ff) AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)
- AM_RANGE(0x140000, 0x14000f) AM_READWRITE(okim6295_status_1_lsb_r, okim6295_data_1_lsb_w)
- AM_RANGE(0x150000, 0x15000f) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x140000, 0x14000f) AM_DEVREADWRITE8(SOUND, "oki2", okim6295_r, okim6295_w, 0x00ff)
+ AM_RANGE(0x150000, 0x15000f) AM_DEVREADWRITE8(SOUND, "oki1", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x160000, 0x160001) AM_WRITE(SMH_NOP)
diff --git a/src/mame/drivers/mirax.c b/src/mame/drivers/mirax.c
index 6165f3cc313..e2d6ed1477a 100644
--- a/src/mame/drivers/mirax.c
+++ b/src/mame/drivers/mirax.c
@@ -110,22 +110,12 @@ static WRITE8_HANDLER(audio_w)
}
-static WRITE8_HANDLER(ay1_sel)
+static WRITE8_DEVICE_HANDLER(ay_sel)
{
- if(cpu_get_previouspc(space->cpu)==0x309)
+ if(cpu_get_previouspc(device->machine->cpu[0])==0x309)
{
- ay8910_control_port_0_w(space,0,nAyCtrl);
- ay8910_write_port_0_w(space,0,nAyData);
- }
-}
-
-static WRITE8_HANDLER(ay2_sel)
-{
-
- if(cpu_get_previouspc(space->cpu)==0x309)
- {
- ay8910_control_port_1_w(space,0,nAyCtrl);
- ay8910_write_port_1_w(space,0,nAyData);
+ ay8910_address_w(device,0,nAyCtrl);
+ ay8910_data_w(device,0,nAyData);
}
}
@@ -134,11 +124,11 @@ static ADDRESS_MAP_START( memory_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0x8fff) AM_RAM
AM_RANGE(0xa000, 0xa000) AM_READ(snd_read)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ay1_sel) //1st ay ?
+ AM_RANGE(0xe000, 0xe000) AM_DEVWRITE(SOUND, "ay1", ay_sel) //1st ay ?
AM_RANGE(0xe001, 0xe001) AM_WRITENOP
AM_RANGE(0xe003, 0xe003) AM_WRITENOP
- AM_RANGE(0xe400, 0xe400) AM_WRITE(ay2_sel) //2nd ay ?
+ AM_RANGE(0xe400, 0xe400) AM_DEVWRITE(SOUND, "ay2", ay_sel) //2nd ay ?
AM_RANGE(0xe401, 0xe401) AM_WRITENOP
AM_RANGE(0xe403, 0xe403) AM_WRITENOP
diff --git a/src/mame/drivers/missb2.c b/src/mame/drivers/missb2.c
index 355e708c4be..23f43851a29 100644
--- a/src/mame/drivers/missb2.c
+++ b/src/mame/drivers/missb2.c
@@ -16,7 +16,7 @@ OKI M6295 sound ROM dump is bad.
#include "driver.h"
#include "cpu/z80/z80.h"
#include "sound/okim6295.h"
-#include "sound/3812intf.h"
+#include "sound/3526intf.h"
#include "includes/bublbobl.h"
static UINT8 *bg_paletteram, *missb2_bgvram;
@@ -182,9 +182,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x8fff) AM_RAM
- AM_RANGE(0x9000, 0x9000) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
- AM_RANGE(0xa000, 0xa000) AM_READWRITE(ym3526_status_port_0_r, ym3526_control_port_0_w)
- AM_RANGE(0xa001, 0xa001) AM_WRITE(ym3526_write_port_0_w)
+ AM_RANGE(0x9000, 0x9000) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
+ AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE(SOUND, "ym", ym3526_r, ym3526_w)
AM_RANGE(0xb000, 0xb000) AM_READ(soundlatch_r) AM_WRITENOP // message for main cpu
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
AM_RANGE(0xb002, 0xb002) AM_WRITE(bublbobl_sh_nmi_disable_w)
@@ -334,10 +333,10 @@ GFXDECODE_END
/* Sound Interfaces */
// Handler called by the 3526 emulator when the internal timers cause an IRQ
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
logerror("YM3526 firing an IRQ\n");
-// cpu_set_input_line(machine->cpu[2],0,irq ? ASSERT_LINE : CLEAR_LINE);
+// cpu_set_input_line(device->machine->cpu[2],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym3526_interface ym3526_config =
diff --git a/src/mame/drivers/missile.c b/src/mame/drivers/missile.c
index 5945c12bd4c..a743db23348 100644
--- a/src/mame/drivers/missile.c
+++ b/src/mame/drivers/missile.c
@@ -679,7 +679,7 @@ static WRITE8_HANDLER( missile_w )
/* POKEY */
else if (offset < 0x4800)
- pokey1_w(space, offset & 0x0f, data);
+ pokey_w(devtag_get_device(space->machine, SOUND, "pokey"), offset & 0x0f, data);
/* OUT0 */
else if (offset < 0x4900)
@@ -738,7 +738,7 @@ static READ8_HANDLER( missile_r )
/* POKEY */
else if (offset < 0x4800)
- result = pokey1_r(space, offset & 0x0f);
+ result = pokey_r(devtag_get_device(space->machine, SOUND, "pokey"), offset & 0x0f);
/* IN0 */
else if (offset < 0x4900)
@@ -962,8 +962,8 @@ INPUT_PORTS_END
static const pokey_interface pokey_config =
{
- { 0 },
- input_port_3_r
+ { DEVCB_NULL },
+ DEVCB_INPUT_PORT("R8")
};
diff --git a/src/mame/drivers/mitchell.c b/src/mame/drivers/mitchell.c
index b43141702d6..27764dfddb1 100644
--- a/src/mame/drivers/mitchell.c
+++ b/src/mame/drivers/mitchell.c
@@ -391,9 +391,9 @@ static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
The Mahjong games and Block Block need special input treatment */
AM_RANGE(0x01, 0x01) AM_WRITE(input_w)
AM_RANGE(0x02, 0x02) AM_WRITE(pang_bankswitch_w) /* Code bank register */
- AM_RANGE(0x03, 0x03) AM_READWRITE(input_port_12_r, ym2413_data_port_0_w) /* mgakuen only */
- AM_RANGE(0x04, 0x04) AM_READWRITE(input_port_13_r, ym2413_register_port_0_w) /* mgakuen only */
- AM_RANGE(0x05, 0x05) AM_READWRITE(pang_port5_r, okim6295_data_0_w)
+ AM_RANGE(0x03, 0x03) AM_READ(input_port_12_r) AM_DEVWRITE(SOUND, "ym", ym2413_data_port_w) /* mgakuen only */
+ AM_RANGE(0x04, 0x04) AM_READ(input_port_13_r) AM_DEVWRITE(SOUND, "ym", ym2413_register_port_w) /* mgakuen only */
+ AM_RANGE(0x05, 0x05) AM_READ(pang_port5_r) AM_DEVWRITE(SOUND, "oki", okim6295_w)
AM_RANGE(0x06, 0x06) AM_WRITE(SMH_NOP) /* watchdog? irq ack? */
AM_RANGE(0x07, 0x07) AM_WRITE(pang_video_bank_w) /* Video RAM bank register */
AM_RANGE(0x08, 0x08) AM_WRITE(eeprom_cs_w)
@@ -418,8 +418,8 @@ static ADDRESS_MAP_START( spangb_portmap, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0x02) AM_READ(input_r) /* Super Pang needs a kludge to initialize EEPROM. */
AM_RANGE(0x00, 0x00) AM_WRITE(pang_gfxctrl_w) /* Palette bank, layer enable, coin counters, more */
AM_RANGE(0x02, 0x02) AM_WRITE(pang_bankswitch_w) /* Code bank register */
- AM_RANGE(0x03, 0x03) AM_WRITE(ym2413_data_port_0_w)
- AM_RANGE(0x04, 0x04) AM_WRITE(ym2413_register_port_0_w)
+ AM_RANGE(0x03, 0x03) AM_DEVWRITE(SOUND, "ym", ym2413_data_port_w)
+ AM_RANGE(0x04, 0x04) AM_DEVWRITE(SOUND, "ym", ym2413_register_port_w)
AM_RANGE(0x05, 0x05) AM_READ(pang_port5_r)
AM_RANGE(0x06, 0x06) AM_WRITE(SMH_NOP) /* watchdog? irq ack? */
AM_RANGE(0x07, 0x07) AM_WRITE(pang_video_bank_w) /* Video RAM bank register */
@@ -451,23 +451,23 @@ ADDRESS_MAP_END
/**** Monsters World ****/
-static WRITE8_HANDLER( oki_banking_w )
+static WRITE8_DEVICE_HANDLER( oki_banking_w )
{
- okim6295_set_bank_base(0, 0x40000 * (data & 3));
+ okim6295_set_bank_base(device, 0x40000 * (data & 3));
}
static ADDRESS_MAP_START( mstworld_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM)
- AM_RANGE(0x9800, 0x9800) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x9800, 0x9800) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( mstworld_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x9000, 0x9000) AM_WRITE(oki_banking_w)
- AM_RANGE(0x9800, 0x9800) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0x9000, 0x9000) AM_DEVWRITE(SOUND, "oki", oki_banking_w)
+ AM_RANGE(0x9800, 0x9800) AM_DEVWRITE(SOUND, "oki", okim6295_w)
ADDRESS_MAP_END
static WRITE8_HANDLER(mstworld_sound_w)
@@ -1178,7 +1178,7 @@ static MACHINE_DRIVER_START( pang )
MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // clock frequency & pin 7 verified
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
- MDRV_SOUND_ADD("ym2413",YM2413, 4000000) /* (verified on pcb) */
+ MDRV_SOUND_ADD("ym",YM2413, 4000000) /* (verified on pcb) */
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
@@ -1203,7 +1203,7 @@ GFXDECODE_END
static void spangbl_adpcm_int(const device_config *device)
{
- msm5205_data_w(0, sample_buffer & 0x0F);
+ msm5205_data_w(device, sample_buffer & 0x0F);
sample_buffer >>= 4;
sample_select ^= 1;
if(sample_select == 0)
diff --git a/src/mame/drivers/mjkjidai.c b/src/mame/drivers/mjkjidai.c
index b291561259d..73c84cd7111 100644
--- a/src/mame/drivers/mjkjidai.c
+++ b/src/mame/drivers/mjkjidai.c
@@ -26,7 +26,6 @@ TODO:
#include "streams.h"
#include "sound/sn76496.h"
#include "sound/okim6295.h"
-#include "sound/custom.h"
extern UINT8 *mjkjidai_videoram;
@@ -74,17 +73,32 @@ static STREAM_UPDATE( mjkjidai_adpcm_callback )
}
}
-static CUSTOM_START( mjkjidai_adpcm_start )
+static DEVICE_START( mjkjidai_adpcm )
{
running_machine *machine = device->machine;
struct mjkjidai_adpcm_state *state = &mjkjidai_adpcm;
state->playing = 0;
- state->stream = stream_create(device, 0, 1, clock, state, mjkjidai_adpcm_callback);
+ state->stream = stream_create(device, 0, 1, device->clock, state, mjkjidai_adpcm_callback);
state->base = memory_region(machine, "adpcm");
reset_adpcm(&state->adpcm);
- return state;
}
+static DEVICE_GET_INFO( mjkjidai_adpcm )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(mjkjidai_adpcm);break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Custom ADPCM"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
+}
+
+#define SOUND_MJKJIDAI DEVICE_GET_INFO_NAME(mjkjidai_adpcm)
+
+
static void mjkjidai_adpcm_play (int offset, int lenght)
{
mjkjidai_adpcm.current = offset;
@@ -183,8 +197,8 @@ static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x10, 0x10) AM_WRITE(mjkjidai_ctrl_w) // rom bank, coin counter, flip screen etc
AM_RANGE(0x11, 0x11) AM_READ_PORT("IN0")
AM_RANGE(0x12, 0x12) AM_READ_PORT("IN1")
- AM_RANGE(0x20, 0x20) AM_WRITE(sn76496_0_w)
- AM_RANGE(0x30, 0x30) AM_WRITE(sn76496_1_w)
+ AM_RANGE(0x20, 0x20) AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0x30, 0x30) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
AM_RANGE(0x40, 0x40) AM_WRITE(adpcm_w)
ADDRESS_MAP_END
@@ -341,13 +355,6 @@ static GFXDECODE_START( mjkjidai )
GFXDECODE_END
-static const custom_sound_interface adpcm_interface =
-{
- mjkjidai_adpcm_start
-};
-
-
-
static MACHINE_DRIVER_START( mjkjidai )
/* basic machine hardware */
@@ -382,8 +389,7 @@ static MACHINE_DRIVER_START( mjkjidai )
MDRV_SOUND_ADD("sn2", SN76489, 10000000/4)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
- MDRV_SOUND_ADD("adpcm", CUSTOM, 6000)
- MDRV_SOUND_CONFIG(adpcm_interface)
+ MDRV_SOUND_ADD("adpcm", MJKJIDAI, 6000)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/mjsister.c b/src/mame/drivers/mjsister.c
index c8a279a6e80..4ad3748d05d 100644
--- a/src/mame/drivers/mjsister.c
+++ b/src/mame/drivers/mjsister.c
@@ -38,7 +38,7 @@ static TIMER_CALLBACK( dac_callback )
{
UINT8 *DACROM = memory_region(machine, "samples");
- dac_data_w(0,DACROM[(dac_bank * 0x10000 + dac_adr++) & 0x1ffff]);
+ dac_data_w(devtag_get_device(machine, SOUND, "dac"),DACROM[(dac_bank * 0x10000 + dac_adr++) & 0x1ffff]);
if (((dac_adr & 0xff00 ) >> 8) != dac_adr_e )
timer_set(machine, attotime_mul(ATTOTIME_IN_HZ(MCLK), 1024), NULL, 0, dac_callback);
@@ -166,9 +166,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( mjsister_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x01) AM_WRITE(SMH_NOP) /* HD46505? */
- AM_RANGE(0x10, 0x10) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x11, 0x11) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x12, 0x12) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x10, 0x10) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
+ AM_RANGE(0x11, 0x11) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x12, 0x12) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
AM_RANGE(0x20, 0x20) AM_READ(mjsister_keys_r)
AM_RANGE(0x21, 0x21) AM_READ_PORT("IN0")
AM_RANGE(0x30, 0x30) AM_WRITE(mjsister_banksel1_w)
@@ -299,10 +299,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r,
- input_port_1_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static MACHINE_DRIVER_START( mjsister )
diff --git a/src/mame/drivers/mlanding.c b/src/mame/drivers/mlanding.c
index f47dcb082bd..c99cb2271e6 100644
--- a/src/mame/drivers/mlanding.c
+++ b/src/mame/drivers/mlanding.c
@@ -72,24 +72,24 @@ static WRITE16_HANDLER(ml_subreset_w)
cpu_set_input_line(space->machine->cpu[2], INPUT_LINE_RESET, PULSE_LINE);
}
-static WRITE8_HANDLER( sound_bankswitch_w )
+static WRITE8_DEVICE_HANDLER( sound_bankswitch_w )
{
data=0;
- memory_set_bankptr(space->machine, 1, memory_region(space->machine, "z80") + ((data) & 0x03) * 0x4000 + 0x10000 );
+ memory_set_bankptr(device->machine, 1, memory_region(device->machine, "z80") + ((data) & 0x03) * 0x4000 + 0x10000 );
}
static void ml_msm5205_vck(const device_config *device)
{
if (adpcm_data != -1)
{
- msm5205_data_w(0, adpcm_data & 0x0f);
+ msm5205_data_w(device, adpcm_data & 0x0f);
adpcm_data = -1;
}
else
{
adpcm_data = memory_region(device->machine, "adpcm")[adpcm_pos];
adpcm_pos = (adpcm_pos + 1) & 0xffff;
- msm5205_data_w(0, adpcm_data >> 4);
+ msm5205_data_w(device, adpcm_data >> 4);
}
}
@@ -98,14 +98,14 @@ static WRITE8_HANDLER( ml_msm5205_address_w )
adpcm_pos = (adpcm_pos & 0x00ff) | (data << 8);
}
-static WRITE8_HANDLER( ml_msm5205_start_w )
+static WRITE8_DEVICE_HANDLER( ml_msm5205_start_w )
{
- msm5205_reset_w(0, 0);
+ msm5205_reset_w(device, 0);
}
-static WRITE8_HANDLER( ml_msm5205_stop_w )
+static WRITE8_DEVICE_HANDLER( ml_msm5205_stop_w )
{
- msm5205_reset_w(0, 1);
+ msm5205_reset_w(device, 1);
adpcm_pos &= 0xff00;
}
@@ -158,15 +158,14 @@ static ADDRESS_MAP_START( mlanding_z80_mem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1)
AM_RANGE(0x8000, 0x8fff) AM_RAM
- AM_RANGE(0x9000, 0x9000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x9001, 0x9001) AM_READ(ym2151_status_port_0_r) AM_WRITE(ym2151_data_port_0_w)
+ AM_RANGE(0x9000, 0x9001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x9002, 0x9100) AM_READ(SMH_RAM)
AM_RANGE(0xa000, 0xa000) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xa001, 0xa001) AM_READ(taitosound_slave_comm_r) AM_WRITE(taitosound_slave_comm_w)
AM_RANGE(0xb000, 0xb000) AM_WRITE(ml_msm5205_address_w) //guess
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ml_msm5205_start_w)
- AM_RANGE(0xd000, 0xd000) AM_WRITE(ml_msm5205_stop_w)
+ AM_RANGE(0xc000, 0xc000) AM_DEVWRITE(SOUND, "msm", ml_msm5205_start_w)
+ AM_RANGE(0xd000, 0xd000) AM_DEVWRITE(SOUND, "msm", ml_msm5205_stop_w)
AM_RANGE(0xf400, 0xf400) AM_WRITENOP
AM_RANGE(0xf600, 0xf600) AM_WRITENOP
@@ -314,9 +313,9 @@ static INPUT_PORTS_START( mlanding )
PORT_BIT( 0xffff, 0x0000, IPT_AD_STICK_Z ) PORT_MINMAX(0xffc4,0x3c) PORT_SENSITIVITY(30) PORT_KEYDELTA(1) PORT_PLAYER(1)
INPUT_PORTS_END
-static void irq_handler(running_machine *machine, int irq)
+static void irq_handler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static GFXDECODE_START( mlanding )
diff --git a/src/mame/drivers/model1.c b/src/mame/drivers/model1.c
index 8ff63c3962d..58eaa266834 100644
--- a/src/mame/drivers/model1.c
+++ b/src/mame/drivers/model1.c
@@ -975,61 +975,9 @@ static READ16_HANDLER( m1_snd_v60_ready_r )
return 1;
}
-static READ16_HANDLER( m1_snd_mpcm0_r )
+static WRITE16_DEVICE_HANDLER( m1_snd_mpcm_bnk_w )
{
- return multi_pcm_reg_0_r(space, 0);
-}
-
-static WRITE16_HANDLER( m1_snd_mpcm0_w )
-{
- multi_pcm_reg_0_w(space, offset, data);
-}
-
-static WRITE16_HANDLER( m1_snd_mpcm0_bnk_w )
-{
- multi_pcm_set_bank(0, 0x100000 * (data & 3), 0x100000 * (data & 3));
-}
-
-static READ16_HANDLER( m1_snd_mpcm1_r )
-{
- return multi_pcm_reg_1_r(space, 0);
-}
-
-static WRITE16_HANDLER( m1_snd_mpcm1_w )
-{
- multi_pcm_reg_1_w(space, offset, data);
-}
-
-static WRITE16_HANDLER( m1_snd_mpcm1_bnk_w )
-{
- multi_pcm_set_bank(1, 0x100000 * (data & 3), 0x100000 * (data & 3));
-}
-
-static READ16_HANDLER( m1_snd_ym_r )
-{
- return ym3438_status_port_0_a_r(space, 0);
-}
-
-static WRITE16_HANDLER( m1_snd_ym_w )
-{
- switch (offset)
- {
- case 0:
- ym3438_control_port_0_a_w(space, 0, data);
- break;
-
- case 1:
- ym3438_data_port_0_a_w(space, 0, data);
- break;
-
- case 2:
- ym3438_control_port_0_b_w(space, 0, data);
- break;
-
- case 3:
- ym3438_data_port_0_b_w(space, 0, data);
- break;
- }
+ multipcm_set_bank(device, 0x100000 * (data & 3), 0x100000 * (data & 3));
}
static WRITE16_HANDLER( m1_snd_68k_latch1_w )
@@ -1044,12 +992,12 @@ static ADDRESS_MAP_START( model1_snd, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0bffff) AM_ROM
AM_RANGE(0xc20000, 0xc20001) AM_READWRITE( m1_snd_68k_latch_r, m1_snd_68k_latch1_w )
AM_RANGE(0xc20002, 0xc20003) AM_READWRITE( m1_snd_v60_ready_r, m1_snd_68k_latch2_w )
- AM_RANGE(0xc40000, 0xc40007) AM_READWRITE( m1_snd_mpcm0_r, m1_snd_mpcm0_w )
+ AM_RANGE(0xc40000, 0xc40007) AM_DEVREADWRITE8( SOUND, "sega1", multipcm_r, multipcm_w, 0x00ff )
AM_RANGE(0xc40012, 0xc40013) AM_WRITENOP
- AM_RANGE(0xc50000, 0xc50001) AM_WRITE( m1_snd_mpcm0_bnk_w )
- AM_RANGE(0xc60000, 0xc60007) AM_READWRITE( m1_snd_mpcm1_r, m1_snd_mpcm1_w )
- AM_RANGE(0xc70000, 0xc70001) AM_WRITE( m1_snd_mpcm1_bnk_w )
- AM_RANGE(0xd00000, 0xd00007) AM_READWRITE( m1_snd_ym_r, m1_snd_ym_w )
+ AM_RANGE(0xc50000, 0xc50001) AM_DEVWRITE( SOUND, "sega1", m1_snd_mpcm_bnk_w )
+ AM_RANGE(0xc60000, 0xc60007) AM_DEVREADWRITE8( SOUND, "sega2", multipcm_r, multipcm_w, 0x00ff )
+ AM_RANGE(0xc70000, 0xc70001) AM_DEVWRITE( SOUND, "sega2", m1_snd_mpcm_bnk_w )
+ AM_RANGE(0xd00000, 0xd00007) AM_DEVREADWRITE8( SOUND, "ym", ym3438_r, ym3438_w, 0x00ff )
AM_RANGE(0xf00000, 0xf0ffff) AM_RAM
ADDRESS_MAP_END
diff --git a/src/mame/drivers/model2.c b/src/mame/drivers/model2.c
index 938cb5a6f99..bcf88483e50 100644
--- a/src/mame/drivers/model2.c
+++ b/src/mame/drivers/model2.c
@@ -924,7 +924,7 @@ static WRITE32_HANDLER( model2_serial_w )
{
if (ACCESSING_BITS_0_7 && (offset == 0))
{
- scsp_midi_in(space, 0, data&0xff, 0);
+ scsp_midi_in(devtag_get_device(space->machine, SOUND, "scsp"), 0, data&0xff, 0);
// give the 68k time to notice
cpu_spinuntil_time(space->cpu, ATTOTIME_IN_USEC(40));
@@ -1582,61 +1582,9 @@ static READ16_HANDLER( m1_snd_v60_ready_r )
return 1;
}
-static READ16_HANDLER( m1_snd_mpcm0_r )
+static WRITE16_DEVICE_HANDLER( m1_snd_mpcm_bnk_w )
{
- return multi_pcm_reg_0_r(space, 0);
-}
-
-static WRITE16_HANDLER( m1_snd_mpcm0_w )
-{
- multi_pcm_reg_0_w(space, offset, data);
-}
-
-static WRITE16_HANDLER( m1_snd_mpcm0_bnk_w )
-{
- multi_pcm_set_bank(0, 0x100000 * (data & 0xf), 0x100000 * (data & 0xf));
-}
-
-static READ16_HANDLER( m1_snd_mpcm1_r )
-{
- return multi_pcm_reg_1_r(space, 0);
-}
-
-static WRITE16_HANDLER( m1_snd_mpcm1_w )
-{
- multi_pcm_reg_1_w(space, offset, data);
-}
-
-static WRITE16_HANDLER( m1_snd_mpcm1_bnk_w )
-{
- multi_pcm_set_bank(1, 0x100000 * (data & 0xf), 0x100000 * (data & 0xf));
-}
-
-static READ16_HANDLER( m1_snd_ym_r )
-{
- return ym3438_status_port_0_a_r(space, 0);
-}
-
-static WRITE16_HANDLER( m1_snd_ym_w )
-{
- switch (offset)
- {
- case 0:
- ym3438_control_port_0_a_w(space, 0, data);
- break;
-
- case 1:
- ym3438_data_port_0_a_w(space, 0, data);
- break;
-
- case 2:
- ym3438_control_port_0_b_w(space, 0, data);
- break;
-
- case 3:
- ym3438_data_port_0_b_w(space, 0, data);
- break;
- }
+ multipcm_set_bank(device, 0x100000 * (data & 0xf), 0x100000 * (data & 0xf));
}
static WRITE16_HANDLER( m1_snd_68k_latch1_w )
@@ -1652,12 +1600,12 @@ static ADDRESS_MAP_START( model1_snd, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x080000, 0x0bffff) AM_ROM AM_REGION("audio", 0x20000) // mirror of second program ROM
AM_RANGE(0xc20000, 0xc20001) AM_READWRITE( m1_snd_68k_latch_r, m1_snd_68k_latch1_w )
AM_RANGE(0xc20002, 0xc20003) AM_READWRITE( m1_snd_v60_ready_r, m1_snd_68k_latch2_w )
- AM_RANGE(0xc40000, 0xc40007) AM_READWRITE( m1_snd_mpcm0_r, m1_snd_mpcm0_w )
+ AM_RANGE(0xc40000, 0xc40007) AM_DEVREADWRITE8( SOUND, "sega1", multipcm_r, multipcm_w, 0x00ff )
AM_RANGE(0xc40012, 0xc40013) AM_WRITENOP
- AM_RANGE(0xc50000, 0xc50001) AM_WRITE( m1_snd_mpcm0_bnk_w )
- AM_RANGE(0xc60000, 0xc60007) AM_READWRITE( m1_snd_mpcm1_r, m1_snd_mpcm1_w )
- AM_RANGE(0xc70000, 0xc70001) AM_WRITE( m1_snd_mpcm1_bnk_w )
- AM_RANGE(0xd00000, 0xd00007) AM_READWRITE( m1_snd_ym_r, m1_snd_ym_w )
+ AM_RANGE(0xc50000, 0xc50001) AM_DEVWRITE( SOUND, "sega1", m1_snd_mpcm_bnk_w )
+ AM_RANGE(0xc60000, 0xc60007) AM_DEVREADWRITE8( SOUND, "sega2", multipcm_r, multipcm_w, 0x00ff )
+ AM_RANGE(0xc70000, 0xc70001) AM_DEVWRITE( SOUND, "sega2", m1_snd_mpcm_bnk_w )
+ AM_RANGE(0xd00000, 0xd00007) AM_DEVREADWRITE8( SOUND, "ym", ym3438_r, ym3438_w, 0x00ff )
AM_RANGE(0xf00000, 0xf0ffff) AM_RAM
ADDRESS_MAP_END
@@ -1684,7 +1632,7 @@ static WRITE16_HANDLER( model2snd_ctrl )
static ADDRESS_MAP_START( model2_snd, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_RAM AM_REGION("audio", 0) AM_BASE(&model2_soundram)
- AM_RANGE(0x100000, 0x100fff) AM_READWRITE(scsp_0_r, scsp_0_w)
+ AM_RANGE(0x100000, 0x100fff) AM_DEVREADWRITE(SOUND, "scsp", scsp_r, scsp_w)
AM_RANGE(0x400000, 0x400001) AM_WRITE(model2snd_ctrl)
AM_RANGE(0x600000, 0x67ffff) AM_ROM AM_REGION("audio", 0x80000)
AM_RANGE(0x800000, 0x9fffff) AM_ROM AM_REGION("scsp", 0)
@@ -1694,15 +1642,15 @@ ADDRESS_MAP_END
static int scsp_last_line = 0;
-static void scsp_irq(running_machine *machine, int irq)
+static void scsp_irq(const device_config *device, int irq)
{
if (irq > 0)
{
scsp_last_line = irq;
- cpu_set_input_line(machine->cpu[1], irq, ASSERT_LINE);
+ cpu_set_input_line(device->machine->cpu[1], irq, ASSERT_LINE);
}
else
- cpu_set_input_line(machine->cpu[1], -irq, CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], -irq, CLEAR_LINE);
}
static const scsp_interface scsp_config =
diff --git a/src/mame/drivers/model3.c b/src/mame/drivers/model3.c
index 5793f59fe50..af18e9f6519 100644
--- a/src/mame/drivers/model3.c
+++ b/src/mame/drivers/model3.c
@@ -1346,7 +1346,7 @@ static WRITE64_HANDLER(model3_sound_w)
// serial configuration writes
if ((mem_mask == U64(0xff00000000000000)) && (offset == 0))
{
- scsp_midi_in(space, 0, (data>>56)&0xff, 0);
+ scsp_midi_in(devtag_get_device(space->machine, SOUND, "scsp1"), 0, (data>>56)&0xff, 0);
// give the 68k time to notice
cpu_spinuntil_time(space->cpu, ATTOTIME_IN_USEC(40));
@@ -4253,9 +4253,9 @@ static WRITE16_HANDLER( model3snd_ctrl )
static ADDRESS_MAP_START( model3_snd, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_RAM AM_REGION("scsp1", 0) AM_BASE(&model3_soundram)
- AM_RANGE(0x100000, 0x100fff) AM_READWRITE(scsp_0_r, scsp_0_w)
+ AM_RANGE(0x100000, 0x100fff) AM_DEVREADWRITE(SOUND, "scsp1", scsp_r, scsp_w)
AM_RANGE(0x200000, 0x27ffff) AM_RAM AM_REGION("scsp2", 0)
- AM_RANGE(0x300000, 0x300fff) AM_READWRITE(scsp_1_r, scsp_1_w)
+ AM_RANGE(0x300000, 0x300fff) AM_DEVREADWRITE(SOUND, "scsp2", scsp_r, scsp_w)
AM_RANGE(0x400000, 0x400001) AM_WRITE(model3snd_ctrl)
AM_RANGE(0x600000, 0x67ffff) AM_ROM AM_REGION("audio", 0x80000)
AM_RANGE(0x800000, 0x9fffff) AM_ROM AM_REGION("samples", 0)
@@ -4265,15 +4265,15 @@ ADDRESS_MAP_END
static int scsp_last_line = 0;
-static void scsp_irq(running_machine *machine, int irq)
+static void scsp_irq(const device_config *device, int irq)
{
if (irq > 0)
{
scsp_last_line = irq;
- cpu_set_input_line(machine->cpu[1], irq, ASSERT_LINE);
+ cpu_set_input_line(device->machine->cpu[1], irq, ASSERT_LINE);
}
else
- cpu_set_input_line(machine->cpu[1], -irq, CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], -irq, CLEAR_LINE);
}
static const scsp_interface scsp_config =
diff --git a/src/mame/drivers/mogura.c b/src/mame/drivers/mogura.c
index ba25e30dd61..86e06be49ca 100644
--- a/src/mame/drivers/mogura.c
+++ b/src/mame/drivers/mogura.c
@@ -88,10 +88,10 @@ static WRITE8_HANDLER( mogura_tileram_w )
tilemap_mark_tile_dirty(mogura_tilemap,offset&0x7ff);
}
-static WRITE8_HANDLER(dac_w)
+static WRITE8_HANDLER(mogura_dac_w)
{
- dac_0_data_w(space, 0, data & 0xf0 ); /* left */
- dac_1_data_w(space, 0, (data & 0x0f)<<4 ); /* right */
+ dac_data_w(devtag_get_device(space->machine, SOUND, "dac1"), data & 0xf0 ); /* left */
+ dac_data_w(devtag_get_device(space->machine, SOUND, "dac2"), (data & 0x0f)<<4 ); /* right */
}
static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
@@ -103,7 +103,7 @@ static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x0e, 0x0e) AM_READ_PORT("P3")
AM_RANGE(0x0f, 0x0f) AM_READ_PORT("P4")
AM_RANGE(0x10, 0x10) AM_READ_PORT("SERVICE")
- AM_RANGE(0x14, 0x14) AM_WRITE(dac_w) /* 4 bit DAC x 2. MSB = left, LSB = right */
+ AM_RANGE(0x14, 0x14) AM_WRITE(mogura_dac_w) /* 4 bit DAC x 2. MSB = left, LSB = right */
ADDRESS_MAP_END
diff --git a/src/mame/drivers/mole.c b/src/mame/drivers/mole.c
index c35ff1eb7a0..5553c8d596e 100644
--- a/src/mame/drivers/mole.c
+++ b/src/mame/drivers/mole.c
@@ -111,8 +111,7 @@ static ADDRESS_MAP_START( mole_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x5000, 0x7fff) AM_MIRROR(0x8000) AM_ROM
AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(mole_videoram_w) AM_BASE(&videoram)
AM_RANGE(0x8400, 0x8400) AM_WRITE(mole_tilebank_w)
- AM_RANGE(0x8c00, 0x8c00) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x8c01, 0x8c01) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x8c00, 0x8c01) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
AM_RANGE(0x8c40, 0x8c40) AM_WRITENOP // ???
AM_RANGE(0x8c80, 0x8c80) AM_WRITENOP // ???
AM_RANGE(0x8c81, 0x8c81) AM_WRITENOP // ???
diff --git a/src/mame/drivers/momoko.c b/src/mame/drivers/momoko.c
index baa88654af9..09a6adc90ed 100644
--- a/src/mame/drivers/momoko.c
+++ b/src/mame/drivers/momoko.c
@@ -119,21 +119,17 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM)
- AM_RANGE(0xa000, 0xa000) AM_READ(ym2203_status_port_0_r)
- AM_RANGE(0xa001, 0xa001) AM_READ(ym2203_read_port_0_r)
- AM_RANGE(0xc000, 0xc000) AM_READ(ym2203_status_port_1_r)
- AM_RANGE(0xc001, 0xc001) AM_READ(ym2203_read_port_1_r)
+ AM_RANGE(0xa000, 0xa001) AM_DEVREAD(SOUND, "ym1", ym2203_r)
+ AM_RANGE(0xc000, 0xc001) AM_DEVREAD(SOUND, "ym2", ym2203_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
AM_RANGE(0x9000, 0x9000) AM_WRITE(SMH_NOP) /* unknown */
- AM_RANGE(0xa000, 0xa000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xa001, 0xa001) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0xa000, 0xa001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
AM_RANGE(0xb000, 0xb000) AM_WRITE(SMH_NOP) /* unknown */
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym2203_control_port_1_w)
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ym2", ym2203_w)
ADDRESS_MAP_END
/****************************************************************************/
@@ -265,10 +261,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r,
- NULL,
- NULL,
- NULL
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
},
NULL
};
diff --git a/src/mame/drivers/moo.c b/src/mame/drivers/moo.c
index cb40f1b929c..73d788e2bf3 100644
--- a/src/mame/drivers/moo.c
+++ b/src/mame/drivers/moo.c
@@ -298,11 +298,11 @@ static WRITE16_HANDLER( moo_prot_w )
}
-static WRITE16_HANDLER( moobl_oki_bank_w )
+static WRITE16_DEVICE_HANDLER( moobl_oki_bank_w )
{
logerror("%x to OKI bank\n", data);
- okim6295_set_bank_base(0, (data & 0x0f)* 0x40000);
+ okim6295_set_bank_base(device, (data & 0x0f)* 0x40000);
}
static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -358,7 +358,7 @@ static ADDRESS_MAP_START( readmembl, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_READ(SMH_ROM)
AM_RANGE(0x0c2f00, 0x0c2f01) AM_READ(SMH_NOP) /* heck if I know, but it's polled constantly */
AM_RANGE(0x0c4000, 0x0c4001) AM_READ(K053246_word_r)
- AM_RANGE(0x0d6ffe, 0x0d6fff) AM_READ(okim6295_status_0_lsb_r)
+ AM_RANGE(0x0d6ffe, 0x0d6fff) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff)
AM_RANGE(0x0da000, 0x0da001) AM_READ(player1_r)
AM_RANGE(0x0da002, 0x0da003) AM_READ(player2_r)
AM_RANGE(0x0dc000, 0x0dc001) AM_READ_PORT("IN0")
@@ -380,8 +380,8 @@ static ADDRESS_MAP_START( writemembl, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x0ca000, 0x0ca01f) AM_WRITE(K054338_word_w) /* K054338 alpha blending engine */
AM_RANGE(0x0cc000, 0x0cc01f) AM_WRITE(K053251_lsb_w)
AM_RANGE(0x0d0000, 0x0d001f) AM_WRITE(SMH_RAM) /* CCU regs (ignored) */
- AM_RANGE(0x0d6ffc, 0x0d6ffd) AM_WRITE(moobl_oki_bank_w)
- AM_RANGE(0x0d6ffe, 0x0d6fff) AM_WRITE(okim6295_data_0_lsb_w)
+ AM_RANGE(0x0d6ffc, 0x0d6ffd) AM_DEVWRITE(SOUND, "oki", moobl_oki_bank_w)
+ AM_RANGE(0x0d6ffe, 0x0d6fff) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff)
AM_RANGE(0x0d8000, 0x0d8007) AM_WRITE(K056832_b_word_w) /* VSCCS regs */
AM_RANGE(0x0de000, 0x0de001) AM_WRITE(control2_w)
AM_RANGE(0x100000, 0x17ffff) AM_WRITE(SMH_ROM)
@@ -451,8 +451,8 @@ static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK2)
AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM)
- AM_RANGE(0xe000, 0xe22f) AM_READ(k054539_0_r)
- AM_RANGE(0xec01, 0xec01) AM_READ(ym2151_status_port_0_r)
+ AM_RANGE(0xe000, 0xe22f) AM_DEVREAD(SOUND, "konami", k054539_r)
+ AM_RANGE(0xec00, 0xec01) AM_DEVREAD(SOUND, "ym", ym2151_r)
AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_r)
AM_RANGE(0xf003, 0xf003) AM_READ(soundlatch2_r)
ADDRESS_MAP_END
@@ -460,9 +460,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xdfff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xe000, 0xe22f) AM_WRITE(k054539_0_w)
- AM_RANGE(0xec00, 0xec00) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xec01, 0xec01) AM_WRITE(ym2151_data_port_0_w)
+ AM_RANGE(0xe000, 0xe22f) AM_DEVWRITE(SOUND, "konami", k054539_w)
+ AM_RANGE(0xec00, 0xec01) AM_DEVWRITE(SOUND, "ym", ym2151_w)
AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch3_w)
AM_RANGE(0xf800, 0xf800) AM_WRITE(sound_bankswitch_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/mosaic.c b/src/mame/drivers/mosaic.c
index 251cc468c64..e7e4ab3843d 100644
--- a/src/mame/drivers/mosaic.c
+++ b/src/mame/drivers/mosaic.c
@@ -131,8 +131,7 @@ static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x3f) AM_WRITE(SMH_NOP) /* Z180 internal registers */
AM_RANGE(0x30, 0x30) AM_READ(SMH_NOP) /* Z180 internal registers */
- AM_RANGE(0x70, 0x70) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x71, 0x71) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
+ AM_RANGE(0x70, 0x71) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
AM_RANGE(0x72, 0x72) AM_READWRITE(protection_r, protection_w)
AM_RANGE(0x74, 0x74) AM_READ_PORT("P1")
AM_RANGE(0x76, 0x76) AM_READ_PORT("P2")
@@ -142,8 +141,7 @@ static ADDRESS_MAP_START( gfire2_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x3f) AM_WRITE(SMH_NOP) /* Z180 internal registers */
AM_RANGE(0x30, 0x30) AM_READ(SMH_NOP) /* Z180 internal registers */
- AM_RANGE(0x70, 0x70) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x71, 0x71) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
+ AM_RANGE(0x70, 0x71) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
AM_RANGE(0x72, 0x72) AM_READWRITE(gfire2_protection_r, gfire2_protection_w)
AM_RANGE(0x74, 0x74) AM_READ_PORT("P1")
AM_RANGE(0x76, 0x76) AM_READ_PORT("P2")
@@ -265,10 +263,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_2_r,
- NULL,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW"),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
},
NULL
};
diff --git a/src/mame/drivers/mouser.c b/src/mame/drivers/mouser.c
index 7dc4cfd0956..1fb5be2b464 100644
--- a/src/mame/drivers/mouser.c
+++ b/src/mame/drivers/mouser.c
@@ -95,10 +95,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( io_map_2, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay1", ay8910_data_address_w)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "ay2", ay8910_data_address_w)
ADDRESS_MAP_END
static INPUT_PORTS_START( mouser )
diff --git a/src/mame/drivers/mpu4.c b/src/mame/drivers/mpu4.c
index 85a64876878..c529f67c74a 100644
--- a/src/mame/drivers/mpu4.c
+++ b/src/mame/drivers/mpu4.c
@@ -769,14 +769,14 @@ static void update_ay(const address_space *space)
}
case 0x02:
{/* CA2 = 0 CB2 = 1? : Write to selected PSG register and write data to Port A */
- ay8910_write_port_0_w(space, 0, pia_get_output_a(3));
+ ay8910_data_w(devtag_get_device(space->machine, SOUND, "ay8913"), 0, pia_get_output_a(3));
LOG(("AY Chip Write \n"));
break;
}
case 0x03:
{/* CA2 = 1 CB2 = 1? : The register will now be selected and the user can read from or write to it.
The register will remain selected until another is chosen.*/
- ay8910_control_port_0_w(space, 0, pia_get_output_a(3));
+ ay8910_address_w(devtag_get_device(space->machine, SOUND, "ay8913"), 0, pia_get_output_a(3));
LOG(("AY Chip Select \n"));
break;
}
@@ -1407,10 +1407,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_SINGLE_OUTPUT,
{820,0,0},
- NULL,
- NULL,
- NULL,
- NULL
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/mpu4drvr.c b/src/mame/drivers/mpu4drvr.c
index 40b559c4bf8..da90854888a 100644
--- a/src/mame/drivers/mpu4drvr.c
+++ b/src/mame/drivers/mpu4drvr.c
@@ -1454,8 +1454,8 @@ static ADDRESS_MAP_START( mpu4_68k_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE(&mpu4_vid_mainram) /* mainram / char address ram? */
/* what is here, the sound chip? Assume so */
- AM_RANGE(0x900000, 0x900001) AM_WRITE(saa1099_control_port_0_lsb_w)
- AM_RANGE(0x900002, 0x900003) AM_WRITE(saa1099_write_port_0_lsb_w)
+ AM_RANGE(0x900000, 0x900001) AM_DEVWRITE8(SOUND, "saa", saa1099_control_w, 0x00ff)
+ AM_RANGE(0x900002, 0x900003) AM_DEVWRITE8(SOUND, "saa", saa1099_data_w, 0x00ff)
AM_RANGE(0xa00000, 0xa00003) AM_READWRITE(ef9369_r, ef9369_w) /* the palette chip */
/* AM_RANGE(0xa00004, 0xa0000f) AM_READWRITE(mpu4_vid_unmap_r, mpu4_vid_unmap_w) */
@@ -1507,8 +1507,8 @@ static ADDRESS_MAP_START( vp_68k_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x810000, 0x81ffff) AM_RAM /* ? */
/* what is here, the sound chip? Assume so */
- AM_RANGE(0x900000, 0x900001) AM_WRITE(saa1099_control_port_0_lsb_w)
- AM_RANGE(0x900002, 0x900003) AM_WRITE(saa1099_write_port_0_lsb_w)
+ AM_RANGE(0x900000, 0x900001) AM_DEVWRITE8(SOUND, "saa", saa1099_control_w, 0x00ff)
+ AM_RANGE(0x900002, 0x900003) AM_DEVWRITE8(SOUND, "saa", saa1099_data_w, 0x00ff)
/* the palette chip */
AM_RANGE(0xa00000, 0xa00003) AM_READWRITE(ef9369_r, ef9369_w) /* the palette chip */
diff --git a/src/mame/drivers/mquake.c b/src/mame/drivers/mquake.c
index 94420605093..ee246017864 100644
--- a/src/mame/drivers/mquake.c
+++ b/src/mame/drivers/mquake.c
@@ -83,31 +83,23 @@ static WRITE8_DEVICE_HANDLER( mquake_cia_0_portb_w )
*
*************************************/
-static READ16_HANDLER( es5503_word_lsb_r )
+static WRITE8_DEVICE_HANDLER( mquake_es5503_w )
{
- return (ACCESSING_BITS_0_7) ? (es5503_reg_0_r(space, offset) | 0xff00) : 0xffff;
-}
-
-static WRITE16_HANDLER( es5503_word_lsb_w )
-{
- if (ACCESSING_BITS_0_7)
+ // 5503 ROM is banked by the output channel (it's a handy 4-bit output from the 5503)
+ if (offset < 0xe0)
{
- // 5503 ROM is banked by the output channel (it's a handy 4-bit output from the 5503)
- if (offset < 0xe0)
+ // if it's an oscillator control register
+ if ((offset & 0xe0) == 0xa0)
{
- // if it's an oscillator control register
- if ((offset & 0xe0) == 0xa0)
+ // if not writing a "halt", set the bank
+ if (!(data & 1))
{
- // if not writing a "halt", set the bank
- if (!(data & 1))
- {
- es5503_set_base_0(memory_region(space->machine, "ensoniq") + ((data>>4)*0x10000));
- }
+ es5503_set_base(device, memory_region(device->machine, "ensoniq") + ((data>>4)*0x10000));
}
}
-
- es5503_reg_0_w(space, offset, data);
}
+
+ es5503_w(device, offset, data);
}
@@ -154,7 +146,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xfc0000, 0xffffff) AM_ROM AM_REGION("user1", 0) /* System ROM */
AM_RANGE(0x200000, 0x203fff) AM_RAM AM_BASE(&generic_nvram16) AM_SIZE(&generic_nvram_size)
- AM_RANGE(0x204000, 0x2041ff) AM_READWRITE(es5503_word_lsb_r, es5503_word_lsb_w)
+ AM_RANGE(0x204000, 0x2041ff) AM_DEVREADWRITE8(SOUND, "ensoniq", es5503_r, mquake_es5503_w, 0x00ff)
AM_RANGE(0x282000, 0x282001) AM_READ_PORT("SW.LO")
AM_RANGE(0x282002, 0x282003) AM_READ_PORT("SW.HI")
AM_RANGE(0x284000, 0x28400f) AM_WRITE(output_w)
@@ -316,12 +308,6 @@ INPUT_PORTS_END
*
*************************************/
-static const custom_sound_interface amiga_custom_interface =
-{
- amiga_sh_start
-};
-
-
static const es5503_interface es5503_intf =
{
NULL,
@@ -333,7 +319,7 @@ static const es5503_interface es5503_intf =
static MACHINE_RESET(mquake)
{
/* set ES5503 wave memory (this is banked in 64k increments) */
- es5503_set_base_0(memory_region(machine, "ensoniq"));
+ es5503_set_base(devtag_get_device(machine, SOUND, "ensoniq"), memory_region(machine, "ensoniq"));
MACHINE_RESET_CALL(amiga);
}
@@ -392,8 +378,7 @@ static MACHINE_DRIVER_START( mquake )
/* sound hardware */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("amiga", CUSTOM, 3579545)
- MDRV_SOUND_CONFIG(amiga_custom_interface)
+ MDRV_SOUND_ADD("amiga", AMIGA, 3579545)
MDRV_SOUND_ROUTE(0, "left", 0.50)
MDRV_SOUND_ROUTE(1, "right", 0.50)
MDRV_SOUND_ROUTE(2, "right", 0.50)
diff --git a/src/mame/drivers/mrdo.c b/src/mame/drivers/mrdo.c
index 1b412112af6..8e989a8c340 100644
--- a/src/mame/drivers/mrdo.c
+++ b/src/mame/drivers/mrdo.c
@@ -48,8 +48,8 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8800, 0x8fff) AM_RAM_WRITE(mrdo_fgvideoram_w) AM_BASE(&mrdo_fgvideoram)
AM_RANGE(0x9000, 0x90ff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0x9800, 0x9800) AM_WRITE(mrdo_flipscreen_w) /* screen flip + playfield priority */
- AM_RANGE(0x9801, 0x9801) AM_WRITE(sn76496_0_w)
- AM_RANGE(0x9802, 0x9802) AM_WRITE(sn76496_1_w)
+ AM_RANGE(0x9801, 0x9801) AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0x9802, 0x9802) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
AM_RANGE(0x9803, 0x9803) AM_READ(mrdo_SECRE_r)
AM_RANGE(0xa000, 0xa000) AM_READ_PORT("P1")
AM_RANGE(0xa001, 0xa001) AM_READ_PORT("P2")
diff --git a/src/mame/drivers/mrflea.c b/src/mame/drivers/mrflea.c
index 6c379a0f291..a77fa59112d 100644
--- a/src/mame/drivers/mrflea.c
+++ b/src/mame/drivers/mrflea.c
@@ -49,10 +49,7 @@ static int mrflea_main;
static int mrflea_status;
-static int mrflea_select0;
static int mrflea_select1;
-static int mrflea_select2;
-static int mrflea_select3;
extern WRITE8_HANDLER( mrflea_gfx_bank_w );
extern WRITE8_HANDLER( mrflea_videoram_w );
@@ -182,68 +179,18 @@ ADDRESS_MAP_END
/*******************************************************/
-static WRITE8_HANDLER( mrflea_select0_w ){
- mrflea_select0 = data;
-}
-
static WRITE8_HANDLER( mrflea_select1_w ){
mrflea_select1 = data;
}
-static WRITE8_HANDLER( mrflea_select2_w ){
- mrflea_select2 = data;
-}
-
-static WRITE8_HANDLER( mrflea_select3_w ){
- mrflea_select3 = data;
-}
-
-/*******************************************************/
-
-static READ8_HANDLER( mrflea_input0_r )
-{
- if( mrflea_select0 == 0x0f ) return input_port_read(space->machine, "IN0");
- if( mrflea_select0 == 0x0e ) return input_port_read(space->machine, "IN1");
- return 0x00;
-}
-
static READ8_HANDLER( mrflea_input1_r )
{
return 0x00;
}
-static READ8_HANDLER( mrflea_input2_r )
-{
- if( mrflea_select2 == 0x0f ) return input_port_read(space->machine, "DSW1");
- if( mrflea_select2 == 0x0e ) return input_port_read(space->machine, "DSW2");
- return 0x00;
-}
-
-static READ8_HANDLER( mrflea_input3_r )
-{
- return 0x00;
-}
-
-/*******************************************************/
-
-static WRITE8_HANDLER( mrflea_data0_w ){
- ay8910_control_port_0_w( space, offset, mrflea_select0 );
- ay8910_write_port_0_w( space, offset, data );
-}
-
static WRITE8_HANDLER( mrflea_data1_w ){
}
-static WRITE8_HANDLER( mrflea_data2_w ){
- ay8910_control_port_1_w( space, offset, mrflea_select2 );
- ay8910_write_port_1_w( space, offset, data );
-}
-
-static WRITE8_HANDLER( mrflea_data3_w ){
- ay8910_control_port_2_w( space, offset, mrflea_select3 );
- ay8910_write_port_2_w( space, offset, data );
-}
-
static ADDRESS_MAP_START( inout_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(SMH_NOP) /* watchdog */
@@ -253,18 +200,34 @@ static ADDRESS_MAP_START( inout_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x21, 0x21) AM_WRITE(mrflea_main_w)
AM_RANGE(0x22, 0x22) AM_READ(mrflea_io_status_r)
AM_RANGE(0x23, 0x23) AM_WRITE(SMH_NOP) /* 0xb4,0x09,0x05 */
- AM_RANGE(0x40, 0x40) AM_READWRITE(mrflea_input0_r, mrflea_data0_w)
- AM_RANGE(0x41, 0x41) AM_WRITE(mrflea_select0_w)
+ AM_RANGE(0x40, 0x40) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0x40, 0x41) AM_DEVWRITE(SOUND, "ay1", ay8910_data_address_w)
AM_RANGE(0x42, 0x42) AM_READWRITE(mrflea_input1_r, mrflea_data1_w)
AM_RANGE(0x43, 0x43) AM_WRITE(mrflea_select1_w)
- AM_RANGE(0x44, 0x44) AM_READWRITE(mrflea_input2_r, mrflea_data2_w)
- AM_RANGE(0x45, 0x45) AM_WRITE(mrflea_select2_w)
- AM_RANGE(0x46, 0x46) AM_READWRITE(mrflea_input3_r, mrflea_data3_w)
- AM_RANGE(0x47, 0x47) AM_WRITE(mrflea_select3_w)
+ AM_RANGE(0x44, 0x44) AM_DEVREAD(SOUND, "ay2", ay8910_r)
+ AM_RANGE(0x44, 0x45) AM_DEVWRITE(SOUND, "ay2", ay8910_data_address_w)
+ AM_RANGE(0x46, 0x46) AM_DEVREAD(SOUND, "ay3", ay8910_r)
+ AM_RANGE(0x46, 0x47) AM_DEVWRITE(SOUND, "ay3", ay8910_data_address_w)
ADDRESS_MAP_END
/*******************************************************/
+static const ay8910_interface mrflea_ay8910_interface_0 =
+{
+ AY8910_LEGACY_OUTPUT,
+ AY8910_DEFAULT_LOADS,
+ DEVCB_INPUT_PORT("IN1"),
+ DEVCB_INPUT_PORT("IN0")
+};
+
+static const ay8910_interface mrflea_ay8910_interface_1 =
+{
+ AY8910_LEGACY_OUTPUT,
+ AY8910_DEFAULT_LOADS,
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_INPUT_PORT("DSW0")
+};
+
static MACHINE_DRIVER_START( mrflea )
/* basic machine hardware */
@@ -298,9 +261,11 @@ static MACHINE_DRIVER_START( mrflea )
MDRV_SPEAKER_STANDARD_MONO("mono")
MDRV_SOUND_ADD("ay1", AY8910, 2000000)
+ MDRV_SOUND_CONFIG(mrflea_ay8910_interface_0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MDRV_SOUND_ADD("ay2", AY8910, 2000000)
+ MDRV_SOUND_CONFIG(mrflea_ay8910_interface_1)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MDRV_SOUND_ADD("ay3", AY8910, 2000000)
diff --git a/src/mame/drivers/mrjong.c b/src/mame/drivers/mrjong.c
index c3ac4951494..5895d2436f0 100644
--- a/src/mame/drivers/mrjong.c
+++ b/src/mame/drivers/mrjong.c
@@ -88,8 +88,8 @@ static READ8_HANDLER( io_0x03_r )
static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_READ_PORT("P2") AM_WRITE(io_0x00_w)
- AM_RANGE(0x01, 0x01) AM_READ_PORT("P1") AM_WRITE(sn76496_0_w)
- AM_RANGE(0x02, 0x02) AM_READ_PORT("DSW") AM_WRITE(sn76496_1_w)
+ AM_RANGE(0x01, 0x01) AM_READ_PORT("P1") AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0x02, 0x02) AM_READ_PORT("DSW") AM_DEVWRITE(SOUND, "sn2", sn76496_w)
AM_RANGE(0x03, 0x03) AM_READ(io_0x03_r) // Unknown
ADDRESS_MAP_END
diff --git a/src/mame/drivers/ms32.c b/src/mame/drivers/ms32.c
index 657d04b6092..c7fdb2a7007 100644
--- a/src/mame/drivers/ms32.c
+++ b/src/mame/drivers/ms32.c
@@ -1174,7 +1174,7 @@ static WRITE8_HANDLER( to_main_w )
static ADDRESS_MAP_START( ms32_snd_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3eff) AM_READ(SMH_ROM)
- AM_RANGE(0x3f00, 0x3f0f) AM_READ(ymf271_0_r)
+ AM_RANGE(0x3f00, 0x3f0f) AM_DEVREAD(SOUND, "ymf", ymf271_r)
AM_RANGE(0x3f10, 0x3f10) AM_READ(latch_r)
AM_RANGE(0x3f20, 0x3f20) AM_READ(SMH_NOP) /* 2nd latch ? */
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_RAM)
@@ -1184,7 +1184,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( ms32_snd_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3eff) AM_WRITE(SMH_ROM)
- AM_RANGE(0x3f00, 0x3f0f) AM_WRITE(ymf271_0_w)
+ AM_RANGE(0x3f00, 0x3f0f) AM_DEVWRITE(SOUND, "ymf", ymf271_w)
AM_RANGE(0x3f10, 0x3f10) AM_WRITE(to_main_w)
AM_RANGE(0x3f20, 0x3f20) AM_WRITE(SMH_NOP) /* to_main2_w ? */
AM_RANGE(0x3f40, 0x3f40) AM_WRITE(SMH_NOP) /* YMF271 pin 4 (bit 1) , YMF271 pin 39 (bit 4) */
diff --git a/src/mame/drivers/msisaac.c b/src/mame/drivers/msisaac.c
index 1f55bffe673..6fe796733f5 100644
--- a/src/mame/drivers/msisaac.c
+++ b/src/mame/drivers/msisaac.c
@@ -289,19 +289,19 @@ static MACHINE_RESET( ta7630 )
static UINT8 snd_ctrl0=0;
static UINT8 snd_ctrl1=0;
-static WRITE8_HANDLER( sound_control_0_w )
+static WRITE8_DEVICE_HANDLER( sound_control_0_w )
{
snd_ctrl0 = data & 0xff;
//popmessage("SND0 0=%2x 1=%2x", snd_ctrl0, snd_ctrl1);
- sndti_set_output_gain(SOUND_MSM5232, 0, 0, vol_ctrl[ snd_ctrl0 & 15 ] / 100.0); /* group1 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 1, vol_ctrl[ snd_ctrl0 & 15 ] / 100.0); /* group1 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 2, vol_ctrl[ snd_ctrl0 & 15 ] / 100.0); /* group1 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 3, vol_ctrl[ snd_ctrl0 & 15 ] / 100.0); /* group1 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 4, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group2 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 5, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group2 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 6, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group2 from msm5232 */
- sndti_set_output_gain(SOUND_MSM5232, 0, 7, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group2 from msm5232 */
+ sound_set_output_gain(device, 0, vol_ctrl[ snd_ctrl0 & 15 ] / 100.0); /* group1 from msm5232 */
+ sound_set_output_gain(device, 1, vol_ctrl[ snd_ctrl0 & 15 ] / 100.0); /* group1 from msm5232 */
+ sound_set_output_gain(device, 2, vol_ctrl[ snd_ctrl0 & 15 ] / 100.0); /* group1 from msm5232 */
+ sound_set_output_gain(device, 3, vol_ctrl[ snd_ctrl0 & 15 ] / 100.0); /* group1 from msm5232 */
+ sound_set_output_gain(device, 4, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group2 from msm5232 */
+ sound_set_output_gain(device, 5, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group2 from msm5232 */
+ sound_set_output_gain(device, 6, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group2 from msm5232 */
+ sound_set_output_gain(device, 7, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group2 from msm5232 */
}
static WRITE8_HANDLER( sound_control_1_w )
{
@@ -315,12 +315,10 @@ static ADDRESS_MAP_START( writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x4000, 0x47ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x8000, 0x8000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x8001, 0x8001) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x8002, 0x8002) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x8003, 0x8003) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x8010, 0x801d) AM_WRITE(msm5232_0_w)
- AM_RANGE(0x8020, 0x8020) AM_WRITE(sound_control_0_w)
+ AM_RANGE(0x8000, 0x8001) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x8002, 0x8003) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x8010, 0x801d) AM_DEVWRITE(SOUND, "msm", msm5232_w)
+ AM_RANGE(0x8020, 0x8020) AM_DEVWRITE(SOUND, "msm", sound_control_0_w)
AM_RANGE(0x8030, 0x8030) AM_WRITE(sound_control_1_w)
AM_RANGE(0xc001, 0xc001) AM_WRITE(nmi_enable_w)
diff --git a/src/mame/drivers/mugsmash.c b/src/mame/drivers/mugsmash.c
index c3353700e84..fcd8cf71c71 100644
--- a/src/mame/drivers/mugsmash.c
+++ b/src/mame/drivers/mugsmash.c
@@ -214,17 +214,16 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( snd_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM)
- AM_RANGE(0x8801, 0x8801) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0x9800, 0x9800) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x8800, 0x8801) AM_DEVREAD(SOUND, "ym", ym2151_r)
+ AM_RANGE(0x9800, 0x9800) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( snd_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x8800, 0x8800) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x8801, 0x8801) AM_WRITE(ym2151_data_port_0_w)
- AM_RANGE(0x9800, 0x9800) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0x8800, 0x8801) AM_DEVWRITE(SOUND, "ym", ym2151_w)
+ AM_RANGE(0x9800, 0x9800) AM_DEVWRITE(SOUND, "oki", okim6295_w)
ADDRESS_MAP_END
@@ -416,9 +415,9 @@ static GFXDECODE_START( mugsmash )
GFXDECODE_ENTRY( "gfx2", 0, mugsmash2_layout, 0x100, 256 ) /* bg tiles */
GFXDECODE_END
-static void irq_handler(running_machine *machine, int irq)
+static void irq_handler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1], 0 , irq ? ASSERT_LINE : CLEAR_LINE );
+ cpu_set_input_line(device->machine->cpu[1], 0 , irq ? ASSERT_LINE : CLEAR_LINE );
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/multigam.c b/src/mame/drivers/multigam.c
index ad7e0b0a531..030d422de6f 100644
--- a/src/mame/drivers/multigam.c
+++ b/src/mame/drivers/multigam.c
@@ -57,19 +57,19 @@ static WRITE8_HANDLER( sprite_dma_w )
ppu2c0x_spriteram_dma( space, 0, source );
}
-static READ8_HANDLER( psg_4015_r )
+static READ8_DEVICE_HANDLER( psg_4015_r )
{
- return nes_psg_0_r(space, 0x15);
+ return nes_psg_r(device, 0x15);
}
-static WRITE8_HANDLER( psg_4015_w )
+static WRITE8_DEVICE_HANDLER( psg_4015_w )
{
- nes_psg_0_w(space, 0x15, data);
+ nes_psg_w(device, 0x15, data);
}
-static WRITE8_HANDLER( psg_4017_w )
+static WRITE8_DEVICE_HANDLER( psg_4017_w )
{
- nes_psg_0_w(space, 0x17, data);
+ nes_psg_w(device, 0x17, data);
}
/******************************************************
@@ -179,11 +179,11 @@ static ADDRESS_MAP_START( multigam_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM /* NES RAM */
AM_RANGE(0x0800, 0x0fff) AM_RAM /* additional RAM */
AM_RANGE(0x2000, 0x3fff) AM_READWRITE(ppu2c0x_0_r, ppu2c0x_0_w)
- AM_RANGE(0x4000, 0x4013) AM_READWRITE(nes_psg_0_r, nes_psg_0_w) /* PSG primary registers */
+ AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE(SOUND, "nes", nes_psg_r, nes_psg_w) /* PSG primary registers */
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_w)
- AM_RANGE(0x4015, 0x4015) AM_READWRITE(psg_4015_r, psg_4015_w) /* PSG status / first control register */
+ AM_RANGE(0x4015, 0x4015) AM_DEVREADWRITE(SOUND, "nes", psg_4015_r, psg_4015_w) /* PSG status / first control register */
AM_RANGE(0x4016, 0x4016) AM_READWRITE(multigam_IN0_r, multigam_IN0_w) /* IN0 - input port 1 */
- AM_RANGE(0x4017, 0x4017) AM_READWRITE(multigam_IN1_r, psg_4017_w) /* IN1 - input port 2 / PSG second control register */
+ AM_RANGE(0x4017, 0x4017) AM_READ(multigam_IN1_r) AM_DEVWRITE(SOUND, "nes", psg_4017_w) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x5002, 0x5002) AM_WRITENOP
AM_RANGE(0x5000, 0x5ffe) AM_ROM
AM_RANGE(0x5fff, 0x5fff) AM_READ_PORT("IN0")
@@ -427,11 +427,11 @@ static ADDRESS_MAP_START( multigm3_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM /* NES RAM */
AM_RANGE(0x0800, 0x0fff) AM_RAM /* additional RAM */
AM_RANGE(0x2000, 0x3fff) AM_READWRITE(ppu2c0x_0_r, ppu2c0x_0_w)
- AM_RANGE(0x4000, 0x4013) AM_READWRITE(nes_psg_0_r, nes_psg_0_w) /* PSG primary registers */
+ AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE(SOUND, "nes", nes_psg_r, nes_psg_w) /* PSG primary registers */
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_w)
- AM_RANGE(0x4015, 0x4015) AM_READWRITE(psg_4015_r, psg_4015_w) /* PSG status / first control register */
+ AM_RANGE(0x4015, 0x4015) AM_DEVREADWRITE(SOUND, "nes", psg_4015_r, psg_4015_w) /* PSG status / first control register */
AM_RANGE(0x4016, 0x4016) AM_READWRITE(multigam_IN0_r, multigam_IN0_w) /* IN0 - input port 1 */
- AM_RANGE(0x4017, 0x4017) AM_READWRITE(multigam_IN1_r, psg_4017_w) /* IN1 - input port 2 / PSG second control register */
+ AM_RANGE(0x4017, 0x4017) AM_READ(multigam_IN1_r) AM_DEVWRITE(SOUND, "nes", psg_4017_w) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x5001, 0x5001) AM_WRITE(multigm3_switch_prg_rom)
AM_RANGE(0x5002, 0x5002) AM_WRITENOP
AM_RANGE(0x5003, 0x5003) AM_WRITE(multigam_switch_gfx_rom)
diff --git a/src/mame/drivers/munchmo.c b/src/mame/drivers/munchmo.c
index ab784151466..b03a9c10aef 100644
--- a/src/mame/drivers/munchmo.c
+++ b/src/mame/drivers/munchmo.c
@@ -118,10 +118,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_ROM
AM_RANGE(0x2000, 0x2000) AM_READ(soundlatch_r)
- AM_RANGE(0x4000, 0x4000) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x5000, 0x5000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x6000, 0x6000) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x7000, 0x7000) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0x4000, 0x4000) AM_DEVWRITE(SOUND, "ay1", ay8910_data_w)
+ AM_RANGE(0x5000, 0x5000) AM_DEVWRITE(SOUND, "ay1", ay8910_address_w)
+ AM_RANGE(0x6000, 0x6000) AM_DEVWRITE(SOUND, "ay2", ay8910_data_w)
+ AM_RANGE(0x7000, 0x7000) AM_DEVWRITE(SOUND, "ay2", ay8910_address_w)
AM_RANGE(0x8000, 0x8000) AM_WRITENOP /* ? */
AM_RANGE(0xa000, 0xa000) AM_WRITENOP /* ? */
AM_RANGE(0xc000, 0xc000) AM_WRITE(sound_nmi_ack_w)
diff --git a/src/mame/drivers/mw8080bw.c b/src/mame/drivers/mw8080bw.c
index 27c8b5d4a98..dd7e4793797 100644
--- a/src/mame/drivers/mw8080bw.c
+++ b/src/mame/drivers/mw8080bw.c
@@ -611,7 +611,7 @@ static CUSTOM_INPUT( tornbase_score_input_r )
static WRITE8_HANDLER( tornbase_io_w )
{
- if (offset & 0x01) tornbase_audio_w(space, 0, data);
+ if (offset & 0x01) tornbase_audio_w(devtag_get_device(space->machine, SOUND, "discrete"), 0, data);
if (offset & 0x02) mb14241_0_shift_count_w(space, 0, data);
@@ -859,14 +859,14 @@ static UINT8 maze_tone_timing_state;
static STATE_POSTLOAD( maze_update_discrete )
{
- maze_write_discrete(machine, maze_tone_timing_state);
+ maze_write_discrete(devtag_get_device(machine, SOUND, "discrete"), maze_tone_timing_state);
}
static TIMER_CALLBACK( maze_tone_timing_timer_callback )
{
maze_tone_timing_state = !maze_tone_timing_state;
- maze_write_discrete(machine, maze_tone_timing_state);
+ maze_write_discrete(devtag_get_device(machine, SOUND, "discrete"), maze_tone_timing_state);
}
@@ -980,10 +980,10 @@ static ADDRESS_MAP_START( boothill_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x01, 0x01) AM_WRITE(mw8080bw_reversable_shift_count_w)
AM_RANGE(0x02, 0x02) AM_WRITE(mb14241_0_shift_data_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(boothill_audio_w)
+ AM_RANGE(0x03, 0x03) AM_DEVWRITE(SOUND, "discrete", boothill_audio_w)
AM_RANGE(0x04, 0x04) AM_WRITE(watchdog_reset_w)
- AM_RANGE(0x05, 0x05) AM_WRITE(midway_tone_generator_lo_w)
- AM_RANGE(0x06, 0x06) AM_WRITE(midway_tone_generator_hi_w)
+ AM_RANGE(0x05, 0x05) AM_DEVWRITE(SOUND, "discrete", midway_tone_generator_lo_w)
+ AM_RANGE(0x06, 0x06) AM_DEVWRITE(SOUND, "discrete", midway_tone_generator_hi_w)
ADDRESS_MAP_END
@@ -1055,7 +1055,7 @@ MACHINE_DRIVER_END
static WRITE8_HANDLER( checkmat_io_w )
{
- if (offset & 0x01) checkmat_audio_w(space, 0, data);
+ if (offset & 0x01) checkmat_audio_w(devtag_get_device(space->machine, SOUND, "discrete"), 0, data);
if (offset & 0x02) watchdog_reset_w(space, 0, data);
}
@@ -1212,11 +1212,11 @@ static ADDRESS_MAP_START( desertgu_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x01, 0x01) AM_WRITE(mb14241_0_shift_count_w)
AM_RANGE(0x02, 0x02) AM_WRITE(mb14241_0_shift_data_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(desertgu_audio_1_w)
+ AM_RANGE(0x03, 0x03) AM_DEVWRITE(SOUND, "discrete", desertgu_audio_1_w)
AM_RANGE(0x04, 0x04) AM_WRITE(watchdog_reset_w)
- AM_RANGE(0x05, 0x05) AM_WRITE(midway_tone_generator_lo_w)
- AM_RANGE(0x06, 0x06) AM_WRITE(midway_tone_generator_hi_w)
- AM_RANGE(0x07, 0x07) AM_WRITE(desertgu_audio_2_w)
+ AM_RANGE(0x05, 0x05) AM_DEVWRITE(SOUND, "discrete", midway_tone_generator_lo_w)
+ AM_RANGE(0x06, 0x06) AM_DEVWRITE(SOUND, "discrete", midway_tone_generator_hi_w)
+ AM_RANGE(0x07, 0x07) AM_DEVWRITE(SOUND, "discrete", desertgu_audio_2_w)
ADDRESS_MAP_END
@@ -1332,10 +1332,10 @@ static ADDRESS_MAP_START( dplay_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x01, 0x01) AM_WRITE(mb14241_0_shift_count_w)
AM_RANGE(0x02, 0x02) AM_WRITE(mb14241_0_shift_data_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(dplay_audio_w)
+ AM_RANGE(0x03, 0x03) AM_DEVWRITE(SOUND, "discrete", dplay_audio_w)
AM_RANGE(0x04, 0x04) AM_WRITE(watchdog_reset_w)
- AM_RANGE(0x05, 0x05) AM_WRITE(midway_tone_generator_lo_w)
- AM_RANGE(0x06, 0x06) AM_WRITE(midway_tone_generator_hi_w)
+ AM_RANGE(0x05, 0x05) AM_DEVWRITE(SOUND, "discrete", midway_tone_generator_lo_w)
+ AM_RANGE(0x06, 0x06) AM_DEVWRITE(SOUND, "discrete", midway_tone_generator_hi_w)
ADDRESS_MAP_END
@@ -1720,9 +1720,9 @@ static ADDRESS_MAP_START( clowns_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x02, 0x02) AM_WRITE(mb14241_0_shift_data_w)
AM_RANGE(0x03, 0x03) AM_WRITE(clowns_audio_1_w)
AM_RANGE(0x04, 0x04) AM_WRITE(watchdog_reset_w)
- AM_RANGE(0x05, 0x05) AM_WRITE(midway_tone_generator_lo_w)
- AM_RANGE(0x06, 0x06) AM_WRITE(midway_tone_generator_hi_w)
- AM_RANGE(0x07, 0x07) AM_WRITE(clowns_audio_2_w)
+ AM_RANGE(0x05, 0x05) AM_DEVWRITE(SOUND, "discrete", midway_tone_generator_lo_w)
+ AM_RANGE(0x06, 0x06) AM_DEVWRITE(SOUND, "discrete", midway_tone_generator_hi_w)
+ AM_RANGE(0x07, 0x07) AM_DEVWRITE(SOUND, "discrete", clowns_audio_2_w)
ADDRESS_MAP_END
@@ -1933,8 +1933,8 @@ static ADDRESS_MAP_START( dogpatch_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x02, 0x02) AM_WRITE(mb14241_0_shift_data_w)
AM_RANGE(0x03, 0x03) AM_WRITE(dogpatch_audio_w)
AM_RANGE(0x04, 0x04) AM_WRITE(watchdog_reset_w)
- AM_RANGE(0x05, 0x05) AM_WRITE(midway_tone_generator_lo_w)
- AM_RANGE(0x06, 0x06) AM_WRITE(midway_tone_generator_hi_w)
+ AM_RANGE(0x05, 0x05) AM_DEVWRITE(SOUND, "discrete", midway_tone_generator_lo_w)
+ AM_RANGE(0x06, 0x06) AM_DEVWRITE(SOUND, "discrete", midway_tone_generator_hi_w)
ADDRESS_MAP_END
@@ -2065,13 +2065,13 @@ static WRITE8_HANDLER( spcenctr_io_w )
watchdog_reset_w(space, 0, data); /* - - - - - 0 1 0 */
else if ((offset & 0x5f) == 0x01)
- spcenctr_audio_1_w(space, 0, data); /* - 0 - 0 0 0 0 1 */
+ spcenctr_audio_1_w(devtag_get_device(space->machine, SOUND, "discrete"), 0, data); /* - 0 - 0 0 0 0 1 */
else if ((offset & 0x5f) == 0x09)
- spcenctr_audio_2_w(space, 0, data); /* - 0 - 0 1 0 0 1 */
+ spcenctr_audio_2_w(devtag_get_device(space->machine, SOUND, "discrete"), 0, data); /* - 0 - 0 1 0 0 1 */
else if ((offset & 0x5f) == 0x11)
- spcenctr_audio_3_w(space, 0, data); /* - 0 - 1 0 0 0 1 */
+ spcenctr_audio_3_w(devtag_get_device(space->machine, SOUND, "discrete"), 0, data); /* - 0 - 1 0 0 0 1 */
else if ((offset & 0x07) == 0x03)
{ /* - - - - - 0 1 1 */
@@ -2343,7 +2343,7 @@ static ADDRESS_MAP_START( bowler_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x01, 0x01) AM_WRITE(mb14241_0_shift_count_w)
AM_RANGE(0x02, 0x02) AM_WRITE(mb14241_0_shift_data_w)
AM_RANGE(0x04, 0x04) AM_WRITE(watchdog_reset_w)
- AM_RANGE(0x05, 0x05) AM_WRITE(bowler_audio_1_w)
+ AM_RANGE(0x05, 0x05) AM_DEVWRITE(SOUND, "discrete", bowler_audio_1_w)
AM_RANGE(0x06, 0x06) AM_WRITE(bowler_audio_2_w)
AM_RANGE(0x07, 0x07) AM_WRITE(bowler_lights_1_w)
AM_RANGE(0x08, 0x08) AM_WRITE(bowler_audio_3_w)
@@ -2539,9 +2539,9 @@ static ADDRESS_MAP_START( invaders_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x03, 0x03) AM_MIRROR(0x04) AM_READ(mb14241_0_shift_result_r)
AM_RANGE(0x02, 0x02) AM_WRITE(mb14241_0_shift_count_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(invaders_audio_1_w)
+ AM_RANGE(0x03, 0x03) AM_DEVWRITE(SOUND, "discrete", invaders_audio_1_w)
AM_RANGE(0x04, 0x04) AM_WRITE(mb14241_0_shift_data_w)
- AM_RANGE(0x05, 0x05) AM_WRITE(invaders_audio_2_w)
+ AM_RANGE(0x05, 0x05) AM_DEVWRITE(SOUND, "discrete", invaders_audio_2_w)
AM_RANGE(0x06, 0x06) AM_WRITE(watchdog_reset_w)
ADDRESS_MAP_END
@@ -2668,7 +2668,7 @@ static ADDRESS_MAP_START( blueshrk_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x01, 0x01) AM_WRITE(mb14241_0_shift_count_w)
AM_RANGE(0x02, 0x02) AM_WRITE(mb14241_0_shift_data_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(blueshrk_audio_w)
+ AM_RANGE(0x03, 0x03) AM_DEVWRITE(SOUND, "discrete", blueshrk_audio_w)
AM_RANGE(0x04, 0x04) AM_WRITE(watchdog_reset_w)
ADDRESS_MAP_END
@@ -2744,13 +2744,13 @@ static ADDRESS_MAP_START( invad2ct_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x02, 0x02) AM_MIRROR(0x04) AM_READ_PORT("IN2")
AM_RANGE(0x03, 0x03) AM_MIRROR(0x04) AM_READ(mb14241_0_shift_result_r)
- AM_RANGE(0x01, 0x01) AM_WRITE(invad2ct_audio_3_w)
+ AM_RANGE(0x01, 0x01) AM_DEVWRITE(SOUND, "discrete", invad2ct_audio_3_w)
AM_RANGE(0x02, 0x02) AM_WRITE(mb14241_0_shift_count_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(invad2ct_audio_1_w)
+ AM_RANGE(0x03, 0x03) AM_DEVWRITE(SOUND, "discrete", invad2ct_audio_1_w)
AM_RANGE(0x04, 0x04) AM_WRITE(mb14241_0_shift_data_w)
- AM_RANGE(0x05, 0x05) AM_WRITE(invad2ct_audio_2_w)
+ AM_RANGE(0x05, 0x05) AM_DEVWRITE(SOUND, "discrete", invad2ct_audio_2_w)
AM_RANGE(0x06, 0x06) AM_WRITE(watchdog_reset_w)
- AM_RANGE(0x07, 0x07) AM_WRITE(invad2ct_audio_4_w)
+ AM_RANGE(0x07, 0x07) AM_DEVWRITE(SOUND, "discrete", invad2ct_audio_4_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/mwarr.c b/src/mame/drivers/mwarr.c
index d110877dbed..a31867162b8 100644
--- a/src/mame/drivers/mwarr.c
+++ b/src/mame/drivers/mwarr.c
@@ -71,9 +71,9 @@ static WRITE16_HANDLER( tx_videoram_w )
tilemap_mark_tile_dirty(tx_tilemap,offset);
}
-static WRITE16_HANDLER( oki1_bank_w )
+static WRITE16_DEVICE_HANDLER( oki1_bank_w )
{
- okim6295_set_bank_base(1, 0x40000 * (data & 3));
+ okim6295_set_bank_base(device, 0x40000 * (data & 3));
}
static WRITE16_HANDLER( sprites_commands_w )
@@ -144,12 +144,12 @@ static ADDRESS_MAP_START( mwarr_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x110000, 0x110001) AM_READ_PORT("P1_P2")
AM_RANGE(0x110002, 0x110003) AM_READ_PORT("SYSTEM")
AM_RANGE(0x110004, 0x110005) AM_READ_PORT("DSW")
- AM_RANGE(0x110010, 0x110011) AM_WRITE(oki1_bank_w)
+ AM_RANGE(0x110010, 0x110011) AM_DEVWRITE(SOUND, "oki2", oki1_bank_w)
AM_RANGE(0x110014, 0x110015) AM_WRITE(mwarr_brightness_w)
AM_RANGE(0x110016, 0x110017) AM_WRITE(sprites_commands_w)
AM_RANGE(0x110000, 0x11ffff) AM_RAM AM_BASE(&mwarr_ram)
- AM_RANGE(0x180000, 0x180001) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
- AM_RANGE(0x190000, 0x190001) AM_READWRITE(okim6295_status_1_lsb_r, okim6295_data_1_lsb_w)
+ AM_RANGE(0x180000, 0x180001) AM_DEVREADWRITE8(SOUND, "oki1", okim6295_r, okim6295_w, 0x00ff)
+ AM_RANGE(0x190000, 0x190001) AM_DEVREADWRITE8(SOUND, "oki2", okim6295_r, okim6295_w, 0x00ff)
ADDRESS_MAP_END
static INPUT_PORTS_START( mwarr )
diff --git a/src/mame/drivers/mystston.c b/src/mame/drivers/mystston.c
index 6c0a3ff6b11..e485f5f4d8e 100644
--- a/src/mame/drivers/mystston.c
+++ b/src/mame/drivers/mystston.c
@@ -78,20 +78,14 @@ static WRITE8_HANDLER( mystston_ay8910_select_w )
if (((*state->ay8910_select & 0x20) == 0x20) && ((data & 0x20) == 0x00))
{
/* bit 4 goes to the 8910 #0 BC1 pin */
- if (*state->ay8910_select & 0x10)
- ay8910_control_port_0_w(space, 0, *state->ay8910_data);
- else
- ay8910_write_port_0_w(space, 0, *state->ay8910_data);
+ ay8910_data_address_w(devtag_get_device(space->machine, SOUND, "ay1"), *state->ay8910_select >> 4, *state->ay8910_data);
}
/* bit 7 goes to 8910 #1 BDIR pin */
if (((*state->ay8910_select & 0x80) == 0x80) && ((data & 0x80) == 0x00))
{
/* bit 6 goes to the 8910 #1 BC1 pin */
- if (*state->ay8910_select & 0x40)
- ay8910_control_port_1_w(space, 0, *state->ay8910_data);
- else
- ay8910_write_port_1_w(space, 0, *state->ay8910_data);
+ ay8910_data_address_w(devtag_get_device(space->machine, SOUND, "ay2"), *state->ay8910_select >> 6, *state->ay8910_data);
}
*state->ay8910_select = data;
diff --git a/src/mame/drivers/mystwarr.c b/src/mame/drivers/mystwarr.c
index 90b7a5060dd..5ea01e40759 100644
--- a/src/mame/drivers/mystwarr.c
+++ b/src/mame/drivers/mystwarr.c
@@ -793,9 +793,9 @@ static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK2)
AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM)
- AM_RANGE(0xe000, 0xe22f) AM_READ(k054539_0_r)
+ AM_RANGE(0xe000, 0xe22f) AM_DEVREAD(SOUND, "konami1", k054539_r)
AM_RANGE(0xe230, 0xe3ff) AM_READ(SMH_RAM)
- AM_RANGE(0xe400, 0xe62f) AM_READ(k054539_1_r)
+ AM_RANGE(0xe400, 0xe62f) AM_DEVREAD(SOUND, "konami2", k054539_r)
AM_RANGE(0xe630, 0xe7ff) AM_READ(SMH_RAM)
AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_r)
AM_RANGE(0xf003, 0xf003) AM_READ(soundlatch2_r)
@@ -804,9 +804,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_WRITE(SMH_NOP)
AM_RANGE(0xc000, 0xdfff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xe000, 0xe22f) AM_WRITE(k054539_0_w)
+ AM_RANGE(0xe000, 0xe22f) AM_DEVWRITE(SOUND, "konami1", k054539_w)
AM_RANGE(0xe230, 0xe3ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xe400, 0xe62f) AM_WRITE(k054539_1_w)
+ AM_RANGE(0xe400, 0xe62f) AM_DEVWRITE(SOUND, "konami2", k054539_w)
AM_RANGE(0xe630, 0xe7ff) AM_WRITE(SMH_RAM)
AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch3_w)
AM_RANGE(0xf800, 0xf800) AM_WRITE(sound_bankswitch_w)
@@ -870,65 +870,73 @@ static MACHINE_START( mystwarr )
static MACHINE_RESET(mystwarr)
{
+ const device_config *k054539_1 = devtag_get_device(machine, SOUND, "konami1");
+ const device_config *k054539_2 = devtag_get_device(machine, SOUND, "konami2");
int i;
// soften chorus(chip 0 channel 0-3), boost voice(chip 0 channel 4-7)
for (i=0; i<=3; i++)
{
- k054539_set_gain(0, i, 0.8);
- k054539_set_gain(0, i+4, 2.0);
+ k054539_set_gain(k054539_1, i, 0.8);
+ k054539_set_gain(k054539_1, i+4, 2.0);
}
// soften percussions(chip 1 channel 0-7)
- for (i=0; i<=7; i++) k054539_set_gain(1, i, 0.5);
+ for (i=0; i<=7; i++) k054539_set_gain(k054539_2, i, 0.5);
}
static MACHINE_RESET(dadandrn)
{
+ const device_config *k054539_1 = devtag_get_device(machine, SOUND, "konami1");
int i;
// boost voice(chip 0 channel 4-7)
- for (i=4; i<=7; i++) k054539_set_gain(0, i, 2.0);
+ for (i=4; i<=7; i++) k054539_set_gain(k054539_1, i, 2.0);
}
static MACHINE_RESET(viostorm)
{
+ const device_config *k054539_1 = devtag_get_device(machine, SOUND, "konami1");
int i;
// boost voice(chip 0 channel 4-7)
- for (i=4; i<=7; i++) k054539_set_gain(0, i, 2.0);
+ for (i=4; i<=7; i++) k054539_set_gain(k054539_1, i, 2.0);
}
static MACHINE_RESET(metamrph)
{
+ const device_config *k054539_1 = devtag_get_device(machine, SOUND, "konami1");
+ const device_config *k054539_2 = devtag_get_device(machine, SOUND, "konami2");
int i;
// boost voice(chip 0 channel 4-7) and soften other channels
for (i=0; i<=3; i++)
{
- k054539_set_gain(0, i, 0.8);
- k054539_set_gain(0, i+4, 1.8);
- k054539_set_gain(1, i, 0.8);
- k054539_set_gain(1, i+4, 0.8);
+ k054539_set_gain(k054539_1, i, 0.8);
+ k054539_set_gain(k054539_1, i+4, 1.8);
+ k054539_set_gain(k054539_2, i, 0.8);
+ k054539_set_gain(k054539_2, i+4, 0.8);
}
}
static MACHINE_RESET(martchmp)
{
+ const device_config *k054539_1 = devtag_get_device(machine, SOUND, "konami1");
int i;
- k054539_init_flags(0, K054539_REVERSE_STEREO);
+ k054539_init_flags(k054539_1, K054539_REVERSE_STEREO);
// boost voice(chip 0 channel 4-7)
- for (i=4; i<=7; i++) k054539_set_gain(0, i, 1.4);
+ for (i=4; i<=7; i++) k054539_set_gain(k054539_1, i, 1.4);
}
static MACHINE_RESET(gaiapols)
{
+ const device_config *k054539_1 = devtag_get_device(machine, SOUND, "konami1");
int i;
// boost voice(chip 0 channel 5-7)
- for (i=5; i<=7; i++) k054539_set_gain(0, i, 2.0);
+ for (i=5; i<=7; i++) k054539_set_gain(k054539_1, i, 2.0);
}
static MACHINE_DRIVER_START( mystwarr )
diff --git a/src/mame/drivers/namcona1.c b/src/mame/drivers/namcona1.c
index 75e1aec2076..342e9c45c4a 100644
--- a/src/mame/drivers/namcona1.c
+++ b/src/mame/drivers/namcona1.c
@@ -806,27 +806,29 @@ static WRITE16_HANDLER( na1mcu_shared_w )
COMBINE_DATA(&namcona1_workram[offset]);
}
-static READ16_HANDLER(snd_r)
+static READ16_DEVICE_HANDLER(snd_r)
{
- return c140_r(space,offset*2+1) | c140_r(space,offset*2)<<8;
+ /* can't use DEVREADWRITE8 for this because it is opposite endianness to the CPU for some reason */
+ return c140_r(device,offset*2+1) | c140_r(device,offset*2)<<8;
}
-static WRITE16_HANDLER(snd_w)
+static WRITE16_DEVICE_HANDLER(snd_w)
{
+ /* can't use DEVREADWRITE8 for this because it is opposite endianness to the CPU for some reason */
if (ACCESSING_BITS_0_7)
{
- c140_w(space,(offset*2)+1, data);
+ c140_w(device,(offset*2)+1, data);
}
if (ACCESSING_BITS_8_15)
{
- c140_w(space,(offset*2), data>>8);
+ c140_w(device,(offset*2), data>>8);
}
}
static ADDRESS_MAP_START( namcona1_mcu_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000800, 0x000fff) AM_READWRITE(mcu_mailbox_r, mcu_mailbox_w_mcu) // "Mailslot" communications ports
- AM_RANGE(0x001000, 0x001fff) AM_READWRITE(snd_r, snd_w) // C140-alike sound chip
+ AM_RANGE(0x001000, 0x001fff) AM_DEVREADWRITE(SOUND, "c140", snd_r, snd_w) // C140-alike sound chip
AM_RANGE(0x002000, 0x002fff) AM_READWRITE(na1mcu_shared_r, na1mcu_shared_w) // mirror of first page of shared work RAM
AM_RANGE(0x003000, 0x00afff) AM_RAM // there is a 32k RAM chip according to CGFM
AM_RANGE(0x00c000, 0x00ffff) AM_ROM AM_REGION("mcu", 0) // internal ROM BIOS
@@ -917,7 +919,7 @@ static WRITE8_HANDLER( port8_w )
static MACHINE_START( namcona1 )
{
- c140_set_base(0, namcona1_workram);
+ c140_set_base(devtag_get_device(machine, SOUND, "c140"), namcona1_workram);
}
// for games with the MCU emulated, the MCU boots the 68000. don't allow it before that.
@@ -1036,7 +1038,7 @@ static MACHINE_DRIVER_START( namcona1 )
/* sound hardware */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("namco", C140, 44100)
+ MDRV_SOUND_ADD("c140", C140, 44100)
MDRV_SOUND_CONFIG(C140_interface_typeA)
MDRV_SOUND_ROUTE(0, "right", 1.00)
MDRV_SOUND_ROUTE(1, "left", 1.00)
diff --git a/src/mame/drivers/namconb1.c b/src/mame/drivers/namconb1.c
index 23a94b45596..1823be79894 100644
--- a/src/mame/drivers/namconb1.c
+++ b/src/mame/drivers/namconb1.c
@@ -899,7 +899,7 @@ static WRITE16_HANDLER( nbmcu_shared_w )
}
static ADDRESS_MAP_START( namcoc75_am, ADDRESS_SPACE_PROGRAM, 16 )
- AM_RANGE(0x002000, 0x002fff) AM_READWRITE( c352_0_r, c352_0_w )
+ AM_RANGE(0x002000, 0x002fff) AM_DEVREADWRITE(SOUND, "c352", c352_r, c352_w)
AM_RANGE(0x004000, 0x00bfff) AM_RAM_WRITE(nbmcu_shared_w) AM_BASE(&namconb_shareram)
AM_RANGE(0x00c000, 0x00ffff) AM_ROM AM_REGION("c75", 0)
AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("c75data", 0)
diff --git a/src/mame/drivers/namcond1.c b/src/mame/drivers/namcond1.c
index 8cc601836ac..2664997c34e 100644
--- a/src/mame/drivers/namcond1.c
+++ b/src/mame/drivers/namcond1.c
@@ -251,7 +251,7 @@ static WRITE8_HANDLER( mcu_pa_write )
static ADDRESS_MAP_START( nd1h8rwmap, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_READ(SMH_ROM)
AM_RANGE(0x200000, 0x20ffff) AM_READWRITE( sharedram_sub_r, sharedram_sub_w )
- AM_RANGE(0xa00000, 0xa07fff) AM_READWRITE( c352_0_r, c352_0_w )
+ AM_RANGE(0xa00000, 0xa07fff) AM_DEVREADWRITE( SOUND, "c352", c352_r, c352_w )
AM_RANGE(0xc00000, 0xc00001) AM_READ_PORT("DSW")
AM_RANGE(0xc00002, 0xc00003) AM_READ_PORT("P1_P2")
AM_RANGE(0xc00010, 0xc00011) AM_NOP
diff --git a/src/mame/drivers/namcos1.c b/src/mame/drivers/namcos1.c
index 2b114cb0da9..8eb8a1b6482 100644
--- a/src/mame/drivers/namcos1.c
+++ b/src/mame/drivers/namcos1.c
@@ -382,9 +382,9 @@ static WRITE8_HANDLER( namcos1_coin_w )
coin_counter_w(1,data & 4);
}
-static void namcos1_update_DACs(void)
+static void namcos1_update_DACs(running_machine *machine)
{
- dac_signed_data_16_w(0,0x8000 + (dac0_value * dac0_gain) + (dac1_value * dac1_gain));
+ dac_signed_data_16_w(devtag_get_device(machine, SOUND, "dac"),0x8000 + (dac0_value * dac0_gain) + (dac1_value * dac1_gain));
}
void namcos1_init_DACs(void)
@@ -407,19 +407,19 @@ static WRITE8_HANDLER( namcos1_dac_gain_w )
value = (data >> 3) & 3; /* GAIN2,GAIN3 */
dac1_gain = 0x20 * (value+1);
- namcos1_update_DACs();
+ namcos1_update_DACs(space->machine);
}
static WRITE8_HANDLER( namcos1_dac0_w )
{
dac0_value = data - 0x80; /* shift zero point */
- namcos1_update_DACs();
+ namcos1_update_DACs(space->machine);
}
static WRITE8_HANDLER( namcos1_dac1_w )
{
dac1_value = data - 0x80; /* shift zero point */
- namcos1_update_DACs();
+ namcos1_update_DACs(space->machine);
}
@@ -464,10 +464,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROMBANK(17) /* Banked ROMs */
- AM_RANGE(0x4000, 0x4001) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0x4000, 0x4000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x4001, 0x4001) AM_WRITE(ym2151_data_port_0_w)
- AM_RANGE(0x5000, 0x53ff) AM_READWRITE(namcos1_cus30_r, namcos1_cus30_w) AM_MIRROR(0x400) AM_BASE(&namco_wavedata) /* PSG ( Shared ) */
+ AM_RANGE(0x4000, 0x4001) AM_DEVREAD(SOUND, "ym", ym2151_status_port_r)
+ AM_RANGE(0x4000, 0x4001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0x5000, 0x53ff) AM_DEVREADWRITE(SOUND, "namco", namcos1_cus30_r, namcos1_cus30_w) AM_MIRROR(0x400) AM_BASE(&namco_wavedata) /* PSG ( Shared ) */
AM_RANGE(0x7000, 0x77ff) AM_RAMBANK(18) /* TRIRAM (shared) */
AM_RANGE(0x8000, 0x9fff) AM_RAM /* Sound RAM 3 */
AM_RANGE(0xc000, 0xc001) AM_WRITE(namcos1_sound_bankswitch_w) /* ROM bank selector */
@@ -947,9 +946,9 @@ GFXDECODE_END
-static void namcos1_sound_interrupt( running_machine *machine, int irq )
+static void namcos1_sound_interrupt( const device_config *device, int irq )
{
- cpu_set_input_line(machine->cpu[2], M6809_FIRQ_LINE, irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[2], M6809_FIRQ_LINE, irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/namcos12.c b/src/mame/drivers/namcos12.c
index f9464d5f302..24e35631404 100644
--- a/src/mame/drivers/namcos12.c
+++ b/src/mame/drivers/namcos12.c
@@ -1250,7 +1250,7 @@ static MACHINE_RESET( namcos12 )
static ADDRESS_MAP_START( s12h8rwmap, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_READ(SMH_ROM)
AM_RANGE(0x080000, 0x08ffff) AM_READWRITE( sharedram_sub_r, sharedram_sub_w )
- AM_RANGE(0x280000, 0x287fff) AM_READWRITE( c352_0_r, c352_0_w )
+ AM_RANGE(0x280000, 0x287fff) AM_DEVREADWRITE( SOUND, "c352", c352_r, c352_w )
AM_RANGE(0x300000, 0x300001) AM_READ_PORT("IN0")
AM_RANGE(0x300002, 0x300003) AM_READ_PORT("IN1")
AM_RANGE(0x300010, 0x300011) AM_NOP // golgo13 writes here a lot, possibly also a wait state generator?
diff --git a/src/mame/drivers/namcos2.c b/src/mame/drivers/namcos2.c
index f43cd558d5d..1ee092c09ef 100644
--- a/src/mame/drivers/namcos2.c
+++ b/src/mame/drivers/namcos2.c
@@ -710,8 +710,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_READ(BANKED_SOUND_ROM_R) /* banked */
- AM_RANGE(0x4000, 0x4001) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0x5000, 0x6fff) AM_READ(c140_r)
+ AM_RANGE(0x4000, 0x4001) AM_DEVREAD(SOUND, "ym", ym2151_r)
+ AM_RANGE(0x5000, 0x6fff) AM_DEVREAD(SOUND, "c140", c140_r)
AM_RANGE(0x7000, 0x77ff) AM_READ(namcos2_dpram_byte_r)
AM_RANGE(0x7800, 0x7fff) AM_READ(namcos2_dpram_byte_r) /* mirror */
AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_RAM)
@@ -720,9 +720,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_WRITE(SMH_ROM)
- AM_RANGE(0x4000, 0x4000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x4001, 0x4001) AM_WRITE(ym2151_data_port_0_w)
- AM_RANGE(0x5000, 0x6fff) AM_WRITE(c140_w)
+ AM_RANGE(0x4000, 0x4001) AM_DEVWRITE(SOUND, "ym", ym2151_w)
+ AM_RANGE(0x5000, 0x6fff) AM_DEVWRITE(SOUND, "c140", c140_w)
AM_RANGE(0x7000, 0x77ff) AM_WRITE(namcos2_dpram_byte_w) AM_BASE(&namcos2_dpram)
AM_RANGE(0x7800, 0x7fff) AM_WRITE(namcos2_dpram_byte_w) /* mirror */
AM_RANGE(0x8000, 0x9fff) AM_WRITE(SMH_RAM)
@@ -1631,7 +1630,7 @@ static MACHINE_DRIVER_START( default )
MDRV_SOUND_ROUTE(0, "left", 0.75)
MDRV_SOUND_ROUTE(1, "right", 0.75)
- MDRV_SOUND_ADD("2151", YM2151, 3579580)
+ MDRV_SOUND_ADD("ym", YM2151, 3579580)
MDRV_SOUND_ROUTE(0, "left", 0.80)
MDRV_SOUND_ROUTE(1, "right", 0.80)
MACHINE_DRIVER_END
@@ -1655,7 +1654,7 @@ static MACHINE_DRIVER_START( default3 )
MDRV_SOUND_ROUTE(0, "left", 0.45)
MDRV_SOUND_ROUTE(1, "right", 0.45)
- MDRV_SOUND_REPLACE("2151", YM2151, 3579580)
+ MDRV_SOUND_REPLACE("ym", YM2151, 3579580)
MDRV_SOUND_ROUTE(0, "left", 1.0)
MDRV_SOUND_ROUTE(1, "right", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/namcos21.c b/src/mame/drivers/namcos21.c
index 0538e321622..f9c19673dcb 100644
--- a/src/mame/drivers/namcos21.c
+++ b/src/mame/drivers/namcos21.c
@@ -1402,8 +1402,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_READ(BANKED_SOUND_ROM_R) /* banked */
- AM_RANGE(0x4000, 0x4001) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0x5000, 0x6fff) AM_READ(c140_r)
+ AM_RANGE(0x4000, 0x4001) AM_DEVREAD(SOUND, "ym", ym2151_r)
+ AM_RANGE(0x5000, 0x6fff) AM_DEVREAD(SOUND, "c140", c140_r)
AM_RANGE(0x7000, 0x77ff) AM_READ(namcos2_dualportram_byte_r)
AM_RANGE(0x7800, 0x7fff) AM_READ(namcos2_dualportram_byte_r) /* mirror */
AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_RAM)
@@ -1413,9 +1413,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x3000, 0x3003) AM_WRITE(SMH_NOP) /* ? */
AM_RANGE(0x0000, 0x3fff) AM_WRITE(SMH_ROM)
- AM_RANGE(0x4000, 0x4000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x4001, 0x4001) AM_WRITE(ym2151_data_port_0_w)
- AM_RANGE(0x5000, 0x6fff) AM_WRITE(c140_w)
+ AM_RANGE(0x4000, 0x4001) AM_DEVWRITE(SOUND, "ym", ym2151_w)
+ AM_RANGE(0x5000, 0x6fff) AM_DEVWRITE(SOUND, "c140", c140_w)
AM_RANGE(0x7000, 0x77ff) AM_WRITE(namcos2_dualportram_byte_w) AM_BASE(&mpDualPortRAM)
AM_RANGE(0x7800, 0x7fff) AM_WRITE(namcos2_dualportram_byte_w) /* mirror */
AM_RANGE(0x8000, 0x9fff) AM_WRITE(SMH_RAM)
diff --git a/src/mame/drivers/namcos22.c b/src/mame/drivers/namcos22.c
index c2703d96256..cdc7322bb9c 100644
--- a/src/mame/drivers/namcos22.c
+++ b/src/mame/drivers/namcos22.c
@@ -2474,7 +2474,7 @@ static MACHINE_RESET(namcoss22)
// Super System 22 M37710
static ADDRESS_MAP_START( mcu_program, ADDRESS_SPACE_PROGRAM, 16 )
- AM_RANGE(0x002000, 0x002fff) AM_READWRITE( c352_0_r, c352_0_w )
+ AM_RANGE(0x002000, 0x002fff) AM_DEVREADWRITE( SOUND, "c352", c352_r, c352_w )
AM_RANGE(0x004000, 0x00bfff) AM_READWRITE( s22mcu_shared_r, s22mcu_shared_w )
AM_RANGE(0x00c000, 0x00ffff) AM_ROM AM_REGION("user4", 0xc000)
AM_RANGE(0x080000, 0x0fffff) AM_ROM AM_REGION("user4", 0)
@@ -2486,7 +2486,7 @@ ADDRESS_MAP_END
// System 22 37702
static ADDRESS_MAP_START( mcu_s22_program, ADDRESS_SPACE_PROGRAM, 16 )
- AM_RANGE(0x002000, 0x002fff) AM_READWRITE( c352_0_r, c352_0_w )
+ AM_RANGE(0x002000, 0x002fff) AM_DEVREADWRITE( SOUND, "c352", c352_r, c352_w )
AM_RANGE(0x004000, 0x00bfff) AM_READWRITE( s22mcu_shared_r, s22mcu_shared_w )
AM_RANGE(0x00c000, 0x00ffff) AM_ROM AM_REGION("mcu", 0)
AM_RANGE(0x080000, 0x0fffff) AM_ROM AM_REGION("user4", 0)
diff --git a/src/mame/drivers/namcos23.c b/src/mame/drivers/namcos23.c
index 25b7477bc1a..33fa2cdfcbc 100644
--- a/src/mame/drivers/namcos23.c
+++ b/src/mame/drivers/namcos23.c
@@ -1090,7 +1090,7 @@ static WRITE16_HANDLER(cause_sync_w)
static ADDRESS_MAP_START( s23h8rwmap, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_READ(SMH_ROM)
AM_RANGE(0x080000, 0x08ffff) AM_READWRITE( sharedram_sub_r, sharedram_sub_w )
- AM_RANGE(0x280000, 0x287fff) AM_READWRITE( c352_0_r, c352_0_w )
+ AM_RANGE(0x280000, 0x287fff) AM_DEVREADWRITE( SOUND, "c352", c352_r, c352_w )
AM_RANGE(0x300000, 0x300001) AM_READNOP //AM_READ_PORT("IN1")
AM_RANGE(0x300002, 0x300003) AM_READNOP //AM_READ_PORT("IN2")
AM_RANGE(0x300010, 0x300011) AM_NOP
diff --git a/src/mame/drivers/namcos86.c b/src/mame/drivers/namcos86.c
index baee20024bd..f710a5a5d08 100644
--- a/src/mame/drivers/namcos86.c
+++ b/src/mame/drivers/namcos86.c
@@ -327,7 +327,7 @@ static WRITE8_HANDLER( cus115_w )
case 1:
case 2:
case 3:
- namco_63701x_write((offset & 0x1e00) >> 9,data);
+ namco_63701x_w(devtag_get_device(space->machine, SOUND, "namco2"), (offset & 0x1e00) >> 9,data);
break;
case 4:
@@ -356,7 +356,7 @@ static ADDRESS_MAP_START( cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_READWRITE(rthunder_videoram1_r,rthunder_videoram1_w) AM_BASE(&rthunder_videoram1)
AM_RANGE(0x2000, 0x3fff) AM_READWRITE(rthunder_videoram2_r,rthunder_videoram2_w) AM_BASE(&rthunder_videoram2)
- AM_RANGE(0x4000, 0x43ff) AM_READWRITE(namcos1_cus30_r,namcos1_cus30_w) AM_BASE(&namco_wavedata) /* PSG device, shared RAM */
+ AM_RANGE(0x4000, 0x43ff) AM_DEVREADWRITE(SOUND, "namco", namcos1_cus30_r,namcos1_cus30_w) AM_BASE(&namco_wavedata) /* PSG device, shared RAM */
AM_RANGE(0x4000, 0x5fff) AM_READWRITE(rthunder_spriteram_r,rthunder_spriteram_w)
@@ -412,11 +412,9 @@ CPU2_MEMORY( wndrmomo, 0x2000, 0x4000, 0x6000, UNUSED, UNUSED, 0xc000, 0xc800 )
static ADDRESS_MAP_START( NAME##_mcu_map, ADDRESS_SPACE_PROGRAM, 8 ) \
AM_RANGE(0x0000, 0x001f) AM_READWRITE(hd63701_internal_registers_r,hd63701_internal_registers_w) \
AM_RANGE(0x0080, 0x00ff) AM_RAM \
- AM_RANGE(0x1000, 0x13ff) AM_READWRITE(namcos1_cus30_r,namcos1_cus30_w) /* PSG device, shared RAM */ \
+ AM_RANGE(0x1000, 0x13ff) AM_DEVREADWRITE(SOUND, "namco", namcos1_cus30_r,namcos1_cus30_w) /* PSG device, shared RAM */ \
AM_RANGE(0x1400, 0x1fff) AM_RAM \
- AM_RANGE(ADDR_INPUT+0x00, ADDR_INPUT+0x01) AM_READ(ym2151_status_port_0_r) \
- AM_RANGE(ADDR_INPUT+0x00, ADDR_INPUT+0x00) AM_WRITE(ym2151_register_port_0_w) \
- AM_RANGE(ADDR_INPUT+0x01, ADDR_INPUT+0x01) AM_WRITE(ym2151_data_port_0_w) \
+ AM_RANGE(ADDR_INPUT+0x00, ADDR_INPUT+0x01) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w) \
AM_RANGE(ADDR_INPUT+0x20, ADDR_INPUT+0x20) AM_READ_PORT("IN0") \
AM_RANGE(ADDR_INPUT+0x21, ADDR_INPUT+0x21) AM_READ_PORT("IN1") \
AM_RANGE(ADDR_INPUT+0x30, ADDR_INPUT+0x30) AM_READ(dsw0_r) \
diff --git a/src/mame/drivers/naomi.c b/src/mame/drivers/naomi.c
index 5a3f7fdf6c5..66225c7f027 100644
--- a/src/mame/drivers/naomi.c
+++ b/src/mame/drivers/naomi.c
@@ -745,7 +745,7 @@ static ADDRESS_MAP_START( naomi_base_map, ADDRESS_SPACE_PROGRAM, 64 )
AM_RANGE(0x005f7c00, 0x005f7cff) AM_READWRITE( pvr_ctrl_r, pvr_ctrl_w )
AM_RANGE(0x005f8000, 0x005f9fff) AM_READWRITE( pvr_ta_r, pvr_ta_w )
AM_RANGE(0x00600000, 0x006007ff) AM_READWRITE( dc_modem_r, dc_modem_w )
- AM_RANGE(0x00700000, 0x00707fff) AM_READWRITE( dc_aica_reg_r, dc_aica_reg_w )
+ AM_RANGE(0x00700000, 0x00707fff) AM_DEVREADWRITE( SOUND, "aica", dc_aica_reg_r, dc_aica_reg_w )
AM_RANGE(0x00710000, 0x0071000f) AM_READWRITE( dc_rtc_r, dc_rtc_w )
AM_RANGE(0x00800000, 0x00ffffff) AM_READWRITE( naomi_arm_r, naomi_arm_w ) // sound RAM (8 MB)
AM_RANGE(0x0103ff00, 0x0103ffff) AM_READWRITE( naomi_unknown1_r, naomi_unknown1_w ) // bios uses it, actual start and end addresses not known
@@ -773,7 +773,7 @@ static ADDRESS_MAP_START( naomi_map, ADDRESS_SPACE_PROGRAM, 64 )
AM_RANGE(0x005f7c00, 0x005f7cff) AM_READWRITE( pvr_ctrl_r, pvr_ctrl_w )
AM_RANGE(0x005f8000, 0x005f9fff) AM_READWRITE( pvr_ta_r, pvr_ta_w )
AM_RANGE(0x00600000, 0x006007ff) AM_READWRITE( dc_modem_r, dc_modem_w )
- AM_RANGE(0x00700000, 0x00707fff) AM_READWRITE( dc_aica_reg_r, dc_aica_reg_w )
+ AM_RANGE(0x00700000, 0x00707fff) AM_DEVREADWRITE( SOUND, "aica", dc_aica_reg_r, dc_aica_reg_w )
AM_RANGE(0x00710000, 0x0071000f) AM_READWRITE( dc_rtc_r, dc_rtc_w )
AM_RANGE(0x00800000, 0x00ffffff) AM_READWRITE( naomi_arm_r, naomi_arm_w ) // sound RAM (8 MB)
AM_RANGE(0x0103ff00, 0x0103ffff) AM_READWRITE( naomi_unknown1_r, naomi_unknown1_w ) // bios uses it, actual start and end addresses not known
@@ -798,9 +798,9 @@ ADDRESS_MAP_END
/*
* Aica
*/
-static void aica_irq(running_machine *machine, int irq)
+static void aica_irq(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1], ARM7_FIRQ_LINE, irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], ARM7_FIRQ_LINE, irq ? ASSERT_LINE : CLEAR_LINE);
}
@@ -816,7 +816,7 @@ static const aica_interface aica_config =
static ADDRESS_MAP_START( dc_audio_map, ADDRESS_SPACE_PROGRAM, 32 )
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x00000000, 0x007fffff) AM_RAM AM_BASE( &dc_sound_ram ) /* shared with SH-4 */
- AM_RANGE(0x00800000, 0x00807fff) AM_READWRITE(dc_arm_aica_r, dc_arm_aica_w)
+ AM_RANGE(0x00800000, 0x00807fff) AM_DEVREADWRITE(SOUND, "aica", dc_arm_aica_r, dc_arm_aica_w)
ADDRESS_MAP_END
/*
@@ -856,7 +856,7 @@ INPUT_PORTS_END
static MACHINE_RESET( naomi )
{
MACHINE_RESET_CALL(dc);
- aica_set_ram_base(0, dc_sound_ram, 8*1024*1024);
+ aica_set_ram_base(devtag_get_device(machine, SOUND, "aica"), dc_sound_ram, 8*1024*1024);
}
/*
diff --git a/src/mame/drivers/naughtyb.c b/src/mame/drivers/naughtyb.c
index 5a8094bcb88..0ad17ddfd77 100644
--- a/src/mame/drivers/naughtyb.c
+++ b/src/mame/drivers/naughtyb.c
@@ -104,7 +104,6 @@ TODO:
#include "driver.h"
#include "cpu/z80/z80.h"
-#include "sound/custom.h"
#include "sound/tms36xx.h"
#include "includes/phoenix.h"
@@ -352,16 +351,6 @@ GFXDECODE_END
-static const custom_sound_interface naughtyb_custom_interface =
-{
- naughtyb_sh_start
-};
-
-static const custom_sound_interface popflame_custom_interface =
-{
- popflame_sh_start
-};
-
static const tms36xx_interface tms3615_interface =
{
TMS3615, /* TMS36xx subtype */
@@ -407,8 +396,7 @@ static MACHINE_DRIVER_START( naughtyb )
MDRV_SOUND_CONFIG(tms3615_interface)
MDRV_SOUND_ROUTE(0, "mono", 0.60)
- MDRV_SOUND_ADD("naughtyb", CUSTOM, 0)
- MDRV_SOUND_CONFIG(naughtyb_custom_interface)
+ MDRV_SOUND_ADD("naughtyb", NAUGHTYB, 0)
MDRV_SOUND_ROUTE(0, "mono", 0.40)
MACHINE_DRIVER_END
@@ -443,8 +431,7 @@ static MACHINE_DRIVER_START( popflame )
MDRV_SOUND_CONFIG(tms3615_interface)
MDRV_SOUND_ROUTE(0, "mono", 0.60)
- MDRV_SOUND_ADD("popflame", CUSTOM, 0)
- MDRV_SOUND_CONFIG(popflame_custom_interface)
+ MDRV_SOUND_ADD("popflame", POPFLAME, 0)
MDRV_SOUND_ROUTE(0, "mono", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/nbmj8688.c b/src/mame/drivers/nbmj8688.c
index fae9116acc9..598b0f570c0 100644
--- a/src/mame/drivers/nbmj8688.c
+++ b/src/mame/drivers/nbmj8688.c
@@ -43,9 +43,9 @@ TODO:
#define SIGNED_DAC 0 // 0:unsigned DAC, 1:signed DAC
#if SIGNED_DAC
-#define DAC_0_WRITE dac_0_signed_data_w
+#define DAC_WRITE dac_signed_w
#else
-#define DAC_0_WRITE dac_0_data_w
+#define DAC_WRITE dac_w
#endif
@@ -323,7 +323,7 @@ static READ8_HANDLER( ff_r )
static ADDRESS_MAP_START( readport_secolove, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x7f) AM_READ(nb1413m3_sndrom_r)
- AM_RANGE(0x81, 0x81) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0x81, 0x81) AM_DEVREAD(SOUND, "psg", ay8910_r)
AM_RANGE(0x90, 0x90) AM_READ(nb1413m3_inputport0_r)
AM_RANGE(0xa0, 0xa0) AM_READ(nb1413m3_inputport1_r)
AM_RANGE(0xb0, 0xb0) AM_READ(nb1413m3_inputport2_r)
@@ -335,13 +335,12 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( writeport_secolove, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(nb1413m3_nmi_clock_w)
- AM_RANGE(0x82, 0x82) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x83, 0x83) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x82, 0x83) AM_DEVWRITE(SOUND, "psg", ay8910_data_address_w)
AM_RANGE(0x90, 0x97) AM_WRITE(nbmj8688_blitter_w)
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(nb1413m3_sndrombank1_w)
AM_RANGE(0xc0, 0xcf) AM_WRITE(nbmj8688_clut_w)
- AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE)
+ AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE)
AM_RANGE(0xe0, 0xe0) AM_WRITE(secolove_romsel_w)
AM_RANGE(0xf0, 0xf0) AM_WRITE(mjsikaku_scrolly_w)
ADDRESS_MAP_END
@@ -355,7 +354,7 @@ static WRITE8_HANDLER( barline_output_w )
static ADDRESS_MAP_START( readport_barline, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
// AM_RANGE(0x00, 0x7f) AM_READ(nb1413m3_sndrom_r)
- AM_RANGE(0x80, 0x80) AM_READ(ym3812_status_port_0_r)
+ AM_RANGE(0x80, 0x81) AM_DEVREAD(SOUND, "psg", ym3812_r)
AM_RANGE(0x90, 0x90) AM_READ(nb1413m3_inputport0_r)
AM_RANGE(0xa0, 0xa0) AM_READ(nb1413m3_inputport1_r)
AM_RANGE(0xb0, 0xb0) AM_READ(nb1413m3_inputport2_r)
@@ -368,13 +367,12 @@ static ADDRESS_MAP_START( writeport_barline, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(nb1413m3_sndrombank1_w)
AM_RANGE(0x70, 0x70) AM_WRITE(nb1413m3_nmi_clock_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "psg", ym3812_w)
AM_RANGE(0x90, 0x97) AM_WRITE(nbmj8688_blitter_w)
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(barline_output_w)
AM_RANGE(0xc0, 0xcf) AM_WRITE(nbmj8688_clut_w)
-// AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE) //not used
+// AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE) //not used
AM_RANGE(0xe0, 0xe0) AM_WRITE(secolove_romsel_w)
AM_RANGE(0xf0, 0xf0) AM_WRITE(mjsikaku_scrolly_w)
ADDRESS_MAP_END
@@ -382,13 +380,12 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( writeport_crystalg, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(nb1413m3_nmi_clock_w)
- AM_RANGE(0x82, 0x82) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x83, 0x83) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x82, 0x83) AM_DEVWRITE(SOUND, "psg", ay8910_data_address_w)
AM_RANGE(0x90, 0x97) AM_WRITE(nbmj8688_blitter_w)
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(nb1413m3_sndrombank1_w)
AM_RANGE(0xc0, 0xcf) AM_WRITE(nbmj8688_clut_w)
- AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE)
+ AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE)
AM_RANGE(0xe0, 0xe0) AM_WRITE(crystalg_romsel_w)
// AM_RANGE(0xf0, 0xf0) AM_WRITE(SMH_NOP)
ADDRESS_MAP_END
@@ -397,7 +394,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( readport_otonano, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x7f) AM_READ(nb1413m3_sndrom_r)
- AM_RANGE(0x80, 0x80) AM_READ(ym3812_status_port_0_r)
+ AM_RANGE(0x80, 0x81) AM_DEVREAD(SOUND, "psg", ym3812_r)
AM_RANGE(0x90, 0x90) AM_READ(nb1413m3_inputport0_r)
AM_RANGE(0xa0, 0xa0) AM_READ(nb1413m3_inputport1_r)
AM_RANGE(0xb0, 0xb0) AM_READ(nb1413m3_inputport2_r)
@@ -412,11 +409,10 @@ static ADDRESS_MAP_START( writeport_otonano, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x20, 0x3f) AM_WRITE(nbmj8688_clut_w)
AM_RANGE(0x50, 0x50) AM_WRITE(mjsikaku_romsel_w)
AM_RANGE(0x70, 0x77) AM_WRITE(nbmj8688_blitter_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "psg", ym3812_w)
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(nb1413m3_sndrombank1_w)
- AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE)
+ AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE)
AM_RANGE(0xe0, 0xe0) AM_WRITE(mjsikaku_gfxflag2_w)
AM_RANGE(0xf0, 0xf0) AM_WRITE(mjsikaku_scrolly_w)
ADDRESS_MAP_END
@@ -425,7 +421,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( readport_kaguya, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x7f) AM_READ(nb1413m3_sndrom_r)
- AM_RANGE(0x81, 0x81) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0x81, 0x81) AM_DEVREAD(SOUND, "psg", ay8910_r)
AM_RANGE(0x90, 0x90) AM_READ(nb1413m3_inputport0_r)
AM_RANGE(0xa0, 0xa0) AM_READ(nb1413m3_inputport1_r)
AM_RANGE(0xb0, 0xb0) AM_READ(nb1413m3_inputport2_r)
@@ -440,11 +436,10 @@ static ADDRESS_MAP_START( writeport_kaguya, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x20, 0x3f) AM_WRITE(nbmj8688_clut_w)
AM_RANGE(0x50, 0x50) AM_WRITE(mjsikaku_romsel_w)
AM_RANGE(0x70, 0x77) AM_WRITE(nbmj8688_blitter_w)
- AM_RANGE(0x82, 0x82) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x83, 0x83) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x82, 0x83) AM_DEVWRITE(SOUND, "psg", ay8910_data_address_w)
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(nb1413m3_sndrombank1_w)
- AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE)
+ AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE)
AM_RANGE(0xe0, 0xe0) AM_WRITE(mjsikaku_gfxflag2_w)
AM_RANGE(0xf0, 0xf0) AM_WRITE(mjsikaku_scrolly_w)
ADDRESS_MAP_END
@@ -457,11 +452,10 @@ static ADDRESS_MAP_START( writeport_iemoto, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x10, 0x10) AM_WRITE(nb1413m3_sndrombank2_w)
AM_RANGE(0x40, 0x47) AM_WRITE(nbmj8688_blitter_w)
AM_RANGE(0x50, 0x50) AM_WRITE(seiha_romsel_w)
- AM_RANGE(0x82, 0x82) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x83, 0x83) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x82, 0x83) AM_DEVWRITE(SOUND, "psg", ay8910_data_address_w)
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(nb1413m3_sndrombank1_w)
- AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE)
+ AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE)
AM_RANGE(0xe0, 0xe0) AM_WRITE(mjsikaku_gfxflag2_w)
AM_RANGE(0xf0, 0xf0) AM_WRITE(mjsikaku_scrolly_w)
ADDRESS_MAP_END
@@ -473,12 +467,11 @@ static ADDRESS_MAP_START( writeport_seiha, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x10, 0x10) AM_WRITE(nb1413m3_sndrombank2_w)
AM_RANGE(0x20, 0x3f) AM_WRITE(nbmj8688_clut_w)
AM_RANGE(0x50, 0x50) AM_WRITE(seiha_romsel_w)
- AM_RANGE(0x82, 0x82) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x83, 0x83) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x82, 0x83) AM_DEVWRITE(SOUND, "psg", ay8910_data_address_w)
AM_RANGE(0x90, 0x97) AM_WRITE(nbmj8688_blitter_w)
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(nb1413m3_sndrombank1_w)
- AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE)
+ AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE)
AM_RANGE(0xe0, 0xe0) AM_WRITE(mjsikaku_gfxflag2_w)
AM_RANGE(0xf0, 0xf0) AM_WRITE(mjsikaku_scrolly_w)
ADDRESS_MAP_END
@@ -489,11 +482,10 @@ static ADDRESS_MAP_START( writeport_mjgaiden, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x20, 0x3f) AM_WRITE(nbmj8688_clut_w)
AM_RANGE(0x50, 0x50) AM_WRITE(mjsikaku_romsel_w)
AM_RANGE(0x90, 0x97) AM_WRITE(nbmj8688_blitter_w)
- AM_RANGE(0x82, 0x82) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x83, 0x83) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x82, 0x83) AM_DEVWRITE(SOUND, "psg", ay8910_data_address_w)
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(nb1413m3_sndrombank1_w)
- AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE)
+ AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE)
AM_RANGE(0xe0, 0xe0) AM_WRITE(mjsikaku_gfxflag2_w)
AM_RANGE(0xf0, 0xf0) AM_WRITE(mjsikaku_scrolly_w)
ADDRESS_MAP_END
@@ -507,13 +499,12 @@ static ADDRESS_MAP_START( writeport_p16bit_LCD, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x45, 0x45) AM_WRITE(nbmj8688_HD61830B_1_instr_w)
AM_RANGE(0x46, 0x46) AM_WRITE(nbmj8688_HD61830B_both_data_w)
AM_RANGE(0x47, 0x47) AM_WRITE(nbmj8688_HD61830B_both_instr_w)
- AM_RANGE(0x82, 0x82) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x83, 0x83) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x82, 0x83) AM_DEVWRITE(SOUND, "psg", ay8910_data_address_w)
AM_RANGE(0x90, 0x97) AM_WRITE(nbmj8688_blitter_w)
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(nb1413m3_sndrombank1_w)
AM_RANGE(0xc0, 0xcf) AM_WRITE(nbmj8688_clut_w)
- AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE)
+ AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE)
AM_RANGE(0xe0, 0xe0) AM_WRITE(secolove_romsel_w)
AM_RANGE(0xf0, 0xf0) AM_WRITE(mjsikaku_scrolly_w)
ADDRESS_MAP_END
@@ -537,11 +528,10 @@ static ADDRESS_MAP_START( writeport_mjsikaku, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x20, 0x3f) AM_WRITE(nbmj8688_clut_w)
AM_RANGE(0x50, 0x50) AM_WRITE(mjsikaku_romsel_w)
AM_RANGE(0x60, 0x67) AM_WRITE(nbmj8688_blitter_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "psg", ym3812_w)
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(nb1413m3_sndrombank1_w)
- AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE)
+ AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE)
AM_RANGE(0xe0, 0xe0) AM_WRITE(mjsikaku_gfxflag2_w)
AM_RANGE(0xf0, 0xf0) AM_WRITE(mjsikaku_scrolly_w)
ADDRESS_MAP_END
@@ -550,7 +540,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( readport_mmsikaku, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x7f) AM_READ(nb1413m3_sndrom_r)
- AM_RANGE(0x81, 0x81) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0x81, 0x81) AM_DEVREAD(SOUND, "psg", ay8910_r)
AM_RANGE(0x90, 0x90) AM_READ(nb1413m3_inputport0_r)
AM_RANGE(0xa0, 0xa0) AM_READ(nb1413m3_inputport1_r)
AM_RANGE(0xb0, 0xb0) AM_READ(nb1413m3_inputport2_r)
@@ -566,11 +556,10 @@ static ADDRESS_MAP_START( writeport_mmsikaku, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x20, 0x3f) AM_WRITE(nbmj8688_clut_w)
AM_RANGE(0x50, 0x50) AM_WRITE(mjsikaku_romsel_w)
AM_RANGE(0x40, 0x47) AM_WRITE(nbmj8688_blitter_w)
- AM_RANGE(0x82, 0x82) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x83, 0x83) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x82, 0x83) AM_DEVWRITE(SOUND, "psg", ay8910_data_address_w)
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(nb1413m3_sndrombank1_w)
- AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE)
+ AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE)
AM_RANGE(0xe0, 0xe0) AM_WRITE(mjsikaku_gfxflag2_w)
AM_RANGE(0xf0, 0xf0) AM_WRITE(mjsikaku_scrolly_w)
ADDRESS_MAP_END
@@ -2948,10 +2937,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- nb1413m3_dipsw1_r, // DIPSW-A read
- nb1413m3_dipsw2_r, // DIPSW-B read
- NULL,
- NULL
+ DEVCB_MEMORY_HANDLER("main", IO, nb1413m3_dipsw1_r), // DIPSW-A read
+ DEVCB_MEMORY_HANDLER("main", IO, nb1413m3_dipsw2_r), // DIPSW-B read
+ DEVCB_NULL,
+ DEVCB_NULL
};
@@ -2982,7 +2971,7 @@ static MACHINE_DRIVER_START( NBMJDRV_4096 )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("8910", AY8910, 1250000)
+ MDRV_SOUND_ADD("psg", AY8910, 1250000)
MDRV_SOUND_CONFIG(ay8910_config)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.35)
@@ -3065,7 +3054,7 @@ static MACHINE_DRIVER_START( barline )
MDRV_CPU_IO_MAP(readport_barline, writeport_barline)
// MDRV_CPU_VBLANK_INT_HACK(nb1413m3_interrupt, 128) // nmiclock = 60
- MDRV_SOUND_REPLACE("8910", YM3812, 20000000/8)
+ MDRV_SOUND_REPLACE("psg", YM3812, 20000000/8)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
MDRV_SOUND_REMOVE("dac")
@@ -3128,7 +3117,7 @@ static MACHINE_DRIVER_START( mbmj_p16bit_LCD )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("8910", AY8910, 1250000)
+ MDRV_SOUND_ADD("psg", AY8910, 1250000)
MDRV_SOUND_CONFIG(ay8910_config)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.35)
@@ -3198,7 +3187,7 @@ static MACHINE_DRIVER_START( mjsikaku )
// MDRV_CPU_VBLANK_INT_HACK(nb1413m3_interrupt, 144) // nmiclock = 70
/* sound hardware */
- MDRV_SOUND_REPLACE("8910", YM3812, 20000000/8)
+ MDRV_SOUND_REPLACE("psg", YM3812, 20000000/8)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/nbmj8891.c b/src/mame/drivers/nbmj8891.c
index 2be69fce514..0c22356d7bb 100644
--- a/src/mame/drivers/nbmj8891.c
+++ b/src/mame/drivers/nbmj8891.c
@@ -56,9 +56,9 @@ TODO:
#define SIGNED_DAC 0 // 0:unsigned DAC, 1:signed DAC
#if SIGNED_DAC
-#define DAC_0_WRITE dac_0_signed_data_w
+#define DAC_WRITE dac_signed_w
#else
-#define DAC_0_WRITE dac_0_data_w
+#define DAC_WRITE dac_w
#endif
@@ -521,12 +521,11 @@ static ADDRESS_MAP_START( writeport_gionbana, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x40, 0x40) AM_WRITE(nbmj8891_clutsel_w)
AM_RANGE(0x60, 0x60) AM_WRITE(nbmj8891_romsel_w)
AM_RANGE(0x70, 0x70) AM_WRITE(nbmj8891_scrolly_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "fm", ym3812_w)
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(nb1413m3_sndrombank1_w)
// AM_RANGE(0xc0, 0xc0) AM_WRITE(SMH_NOP)
- AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE)
+ AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE)
AM_RANGE(0xe0, 0xe0) AM_WRITE(nbmj8891_vramsel_w)
AM_RANGE(0xf0, 0xf0) AM_WRITE(nb1413m3_outcoin_w)
ADDRESS_MAP_END
@@ -538,12 +537,11 @@ static ADDRESS_MAP_START( writeport_mgion, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x40, 0x40) AM_WRITE(nbmj8891_clutsel_w)
AM_RANGE(0x60, 0x60) AM_WRITE(nbmj8891_romsel_w)
AM_RANGE(0x70, 0x70) AM_WRITE(nbmj8891_scrolly_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "fm", ym3812_w)
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(nb1413m3_sndrombank1_w)
// AM_RANGE(0xc0, 0xc0) AM_WRITE(SMH_NOP)
- AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE)
+ AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE)
AM_RANGE(0xe0, 0xe0) AM_WRITE(nbmj8891_vramsel_w)
AM_RANGE(0xf0, 0xf0) AM_WRITE(nb1413m3_outcoin_w)
ADDRESS_MAP_END
@@ -551,7 +549,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( readport_omotesnd, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x7f) AM_READ(nb1413m3_sndrom_r)
- AM_RANGE(0x81, 0x81) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0x81, 0x81) AM_DEVREAD(SOUND, "fm", ay8910_r)
AM_RANGE(0x90, 0x90) AM_READ(nb1413m3_inputport0_r)
AM_RANGE(0xa0, 0xa0) AM_READ(nb1413m3_inputport1_r)
AM_RANGE(0xb0, 0xb0) AM_READ(nb1413m3_inputport2_r)
@@ -570,13 +568,12 @@ static ADDRESS_MAP_START( writeport_omotesnd, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x40, 0x4f) AM_WRITE(nbmj8891_clut_w)
// AM_RANGE(0x50, 0x50) AM_WRITE(nb1413m3_nmi_clock_w)
AM_RANGE(0x70, 0x70) AM_WRITE(nbmj8891_scrolly_w)
- AM_RANGE(0x82, 0x82) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x83, 0x83) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x82, 0x83) AM_DEVWRITE(SOUND, "fm", ay8910_data_address_w)
AM_RANGE(0x90, 0x90) AM_WRITE(SMH_NOP)
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(nb1413m3_sndrombank1_w)
AM_RANGE(0xc0, 0xc0) AM_WRITE(SMH_NOP)
- AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE)
+ AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE)
AM_RANGE(0xf0, 0xf0) AM_WRITE(nb1413m3_outcoin_w)
ADDRESS_MAP_END
@@ -587,12 +584,11 @@ static ADDRESS_MAP_START( writeport_hanamomo, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x40, 0x40) AM_WRITE(nbmj8891_clutsel_w)
AM_RANGE(0x60, 0x60) AM_WRITE(nbmj8891_romsel_w)
AM_RANGE(0x70, 0x70) AM_WRITE(nbmj8891_scrolly_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "fm", ym3812_w)
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(nb1413m3_sndrombank1_w)
// AM_RANGE(0xc0, 0xc0) AM_WRITE(SMH_NOP)
- AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE)
+ AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE)
// AM_RANGE(0xe0, 0xe0) AM_WRITE(SMH_NOP)
// AM_RANGE(0xf0, 0xf0) AM_WRITE(SMH_NOP)
ADDRESS_MAP_END
@@ -604,12 +600,11 @@ static ADDRESS_MAP_START( writeport_msjiken, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x50, 0x57) AM_WRITE(nbmj8891_blitter_w)
AM_RANGE(0x60, 0x60) AM_WRITE(nbmj8891_romsel_w)
AM_RANGE(0x70, 0x70) AM_WRITE(nbmj8891_scrolly_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "fm", ym3812_w)
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(nb1413m3_sndrombank1_w)
// AM_RANGE(0xc0, 0xc0) AM_WRITE(SMH_NOP)
- AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE)
+ AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE)
// AM_RANGE(0xe0, 0xe0) AM_WRITE(SMH_NOP)
// AM_RANGE(0xf0, 0xf0) AM_WRITE(SMH_NOP)
ADDRESS_MAP_END
@@ -621,12 +616,11 @@ static ADDRESS_MAP_START( writeport_scandal, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x10, 0x10) AM_WRITE(nbmj8891_romsel_w)
AM_RANGE(0x20, 0x20) AM_WRITE(nbmj8891_clutsel_w)
AM_RANGE(0x50, 0x50) AM_WRITE(nbmj8891_scrolly_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "fm", ym3812_w)
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(nb1413m3_sndrombank1_w)
AM_RANGE(0xc0, 0xc0) AM_WRITE(nb1413m3_nmi_clock_w)
- AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE)
+ AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE)
// AM_RANGE(0xe0, 0xe0) AM_WRITE(SMH_NOP)
// AM_RANGE(0xf0, 0xf0) AM_WRITE(SMH_NOP)
ADDRESS_MAP_END
@@ -634,7 +628,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( readport_scandalm, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x7f) AM_READ(nb1413m3_sndrom_r)
- AM_RANGE(0x81, 0x81) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0x81, 0x81) AM_DEVREAD(SOUND, "fm", ay8910_r)
AM_RANGE(0x90, 0x90) AM_READ(nb1413m3_inputport0_r)
AM_RANGE(0xa0, 0xa0) AM_READ(nb1413m3_inputport1_r)
AM_RANGE(0xb0, 0xb0) AM_READ(nb1413m3_inputport2_r)
@@ -650,12 +644,11 @@ static ADDRESS_MAP_START( writeport_scandalm, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x10, 0x10) AM_WRITE(nbmj8891_romsel_w)
AM_RANGE(0x20, 0x20) AM_WRITE(nbmj8891_clutsel_w)
AM_RANGE(0x50, 0x50) AM_WRITE(nbmj8891_scrolly_w)
- AM_RANGE(0x82, 0x82) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x83, 0x83) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x82, 0x83) AM_DEVWRITE(SOUND, "fm", ay8910_data_address_w)
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(nb1413m3_sndrombank1_w)
AM_RANGE(0xc0, 0xc0) AM_WRITE(nb1413m3_nmi_clock_w)
- AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE)
+ AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE)
// AM_RANGE(0xe0, 0xe0) AM_WRITE(SMH_NOP)
AM_RANGE(0xf0, 0xf0) AM_WRITE(nb1413m3_outcoin_w)
ADDRESS_MAP_END
@@ -668,12 +661,11 @@ static ADDRESS_MAP_START( writeport_bananadr, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x20, 0x20) AM_WRITE(nbmj8891_clutsel_w)
AM_RANGE(0x30, 0x30) AM_WRITE(nbmj8891_vramsel_w)
AM_RANGE(0x50, 0x50) AM_WRITE(nbmj8891_scrolly_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "fm", ym3812_w)
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(nb1413m3_sndrombank1_w)
AM_RANGE(0xc0, 0xc0) AM_WRITE(nb1413m3_nmi_clock_w)
- AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE)
+ AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE)
// AM_RANGE(0xe0, 0xe0) AM_WRITE(SMH_NOP)
AM_RANGE(0xf0, 0xf0) AM_WRITE(nb1413m3_outcoin_w)
ADDRESS_MAP_END
@@ -696,12 +688,11 @@ static ADDRESS_MAP_START( writeport_lovehous, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x50, 0x57) AM_WRITE(nbmj8891_blitter_w)
AM_RANGE(0x60, 0x60) AM_WRITE(nbmj8891_romsel_w)
AM_RANGE(0x70, 0x70) AM_WRITE(nbmj8891_scrolly_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "fm", ym3812_w)
// AM_RANGE(0x90, 0x90) AM_WRITE(SMH_NOP)
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(nb1413m3_sndrombank1_w)
- AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE)
+ AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE)
AM_RANGE(0xe0, 0xe0) AM_WRITE(nbmj8891_vramsel_w)
AM_RANGE(0xf0, 0xf0) AM_WRITE(nb1413m3_outcoin_w)
ADDRESS_MAP_END
@@ -724,12 +715,11 @@ static ADDRESS_MAP_START( writeport_maiko, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x50, 0x57) AM_WRITE(nbmj8891_blitter_w)
AM_RANGE(0x60, 0x60) AM_WRITE(nbmj8891_romsel_w)
AM_RANGE(0x70, 0x70) AM_WRITE(nbmj8891_scrolly_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "fm", ym3812_w)
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(nb1413m3_sndrombank1_w)
// AM_RANGE(0xc0, 0xc0) AM_WRITE(SMH_NOP)
- AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE)
+ AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE)
AM_RANGE(0xe0, 0xe0) AM_WRITE(nbmj8891_vramsel_w)
AM_RANGE(0xf0, 0xf0) AM_WRITE(nb1413m3_outcoin_w)
ADDRESS_MAP_END
@@ -737,7 +727,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( readport_taiwanmb, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x7f) AM_READ(nb1413m3_sndrom_r)
- AM_RANGE(0x81, 0x81) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0x81, 0x81) AM_DEVREAD(SOUND, "fm", ay8910_r)
AM_RANGE(0x90, 0x90) AM_READ(nb1413m3_inputport0_r)
AM_RANGE(0xa0, 0xa0) AM_READ(nb1413m3_inputport1_r)
AM_RANGE(0xb0, 0xb0) AM_READ(nb1413m3_inputport2_r)
@@ -750,13 +740,12 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( writeport_taiwanmb, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x82, 0x82) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x83, 0x83) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x82, 0x83) AM_DEVWRITE(SOUND, "fm", ay8910_data_address_w)
// AM_RANGE(0x90, 0x90) AM_WRITE(SMH_NOP) // ?
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(nb1413m3_sndrombank1_w)
// AM_RANGE(0xc0, 0xc0) AM_WRITE(SMH_NOP) // ?
- AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE)
+ AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE)
AM_RANGE(0xe0, 0xe0) AM_WRITE(nbmj8891_taiwanmb_gfxdraw_w) // blitter draw start
AM_RANGE(0xf0, 0xf0) AM_WRITE(nb1413m3_outcoin_w)
ADDRESS_MAP_END
@@ -2708,10 +2697,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r, // DIPSW-A read
- input_port_1_r, // DIPSW-B read
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSWA"),
+ DEVCB_INPUT_PORT("DSWB"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
@@ -2744,7 +2733,7 @@ static MACHINE_DRIVER_START( gionbana )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("3812", YM3812, 2500000)
+ MDRV_SOUND_ADD("fm", YM3812, 2500000)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MDRV_SOUND_ADD("dac", DAC, 0)
@@ -2775,7 +2764,7 @@ static MACHINE_DRIVER_START( omotesnd )
MDRV_NVRAM_HANDLER(nb1413m3)
/* sound hardware */
- MDRV_SOUND_REPLACE("3812", AY8910, 1250000)
+ MDRV_SOUND_REPLACE("fm", AY8910, 1250000)
MDRV_SOUND_CONFIG(ay8910_config)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.35)
MACHINE_DRIVER_END
@@ -2986,7 +2975,7 @@ static MACHINE_DRIVER_START( mjfocusm )
MDRV_VIDEO_START(nbmj8891_1layer)
/* sound hardware */
- MDRV_SOUND_REPLACE("3812", AY8910, 1250000)
+ MDRV_SOUND_REPLACE("fm", AY8910, 1250000)
MDRV_SOUND_CONFIG(ay8910_config)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.35)
MACHINE_DRIVER_END
@@ -3009,7 +2998,7 @@ static MACHINE_DRIVER_START( taiwanmb )
MDRV_VIDEO_START(nbmj8891_1layer)
/* sound hardware */
- MDRV_SOUND_REPLACE("3812", AY8910, 1250000)
+ MDRV_SOUND_REPLACE("fm", AY8910, 1250000)
MDRV_SOUND_CONFIG(ay8910_config)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.35)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/nbmj8991.c b/src/mame/drivers/nbmj8991.c
index 6dd43cf9e93..a0b495104a2 100644
--- a/src/mame/drivers/nbmj8991.c
+++ b/src/mame/drivers/nbmj8991.c
@@ -40,11 +40,9 @@ Notes:
#define SIGNED_DAC 0 // 0:unsigned DAC, 1:signed DAC
#if SIGNED_DAC
-#define DAC_0_WRITE dac_0_signed_data_w
-#define DAC_1_WRITE dac_1_signed_data_w
+#define DAC_WRITE dac_signed_w
#else
-#define DAC_0_WRITE dac_0_data_w
-#define DAC_1_WRITE dac_1_data_w
+#define DAC_WRITE dac_w
#endif
@@ -332,12 +330,11 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( writeport_galkoku, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x7f) AM_WRITE(nbmj8991_blitter_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "fm", ym3812_w)
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(nb1413m3_sndrombank1_w)
AM_RANGE(0xc0, 0xc0) AM_WRITE(nb1413m3_nmi_clock_w)
- AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE)
+ AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE)
// AM_RANGE(0xe0, 0xe0) AM_WRITE(SMH_NOP)
AM_RANGE(0xf0, 0xf0) AM_WRITE(nb1413m3_outcoin_w)
ADDRESS_MAP_END
@@ -345,7 +342,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( readport_hyouban, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x7f) AM_READ(nb1413m3_sndrom_r)
- AM_RANGE(0x81, 0x81) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0x81, 0x81) AM_DEVREAD(SOUND, "fm", ay8910_r)
AM_RANGE(0x90, 0x90) AM_READ(nb1413m3_inputport0_r)
AM_RANGE(0xa0, 0xa0) AM_READ(nb1413m3_inputport1_r)
AM_RANGE(0xb0, 0xb0) AM_READ(nb1413m3_inputport2_r)
@@ -357,12 +354,11 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( writeport_hyouban, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x7f) AM_WRITE(nbmj8991_blitter_w)
- AM_RANGE(0x82, 0x82) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x83, 0x83) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x82, 0x83) AM_DEVWRITE(SOUND, "fm", ay8910_data_address_w)
AM_RANGE(0xa0, 0xa0) AM_WRITE(nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_WRITE(nb1413m3_sndrombank1_w)
AM_RANGE(0xc0, 0xc0) AM_WRITE(nb1413m3_nmi_clock_w)
- AM_RANGE(0xd0, 0xd0) AM_WRITE(DAC_0_WRITE)
+ AM_RANGE(0xd0, 0xd0) AM_DEVWRITE(SOUND, "dac", DAC_WRITE)
// AM_RANGE(0xe0, 0xe0) AM_WRITE(SMH_NOP)
AM_RANGE(0xf0, 0xf0) AM_WRITE(nb1413m3_outcoin_w)
ADDRESS_MAP_END
@@ -420,12 +416,11 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writeport_nbmj8991, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(DAC_0_WRITE)
- AM_RANGE(0x02, 0x02) AM_WRITE(DAC_1_WRITE)
+ AM_RANGE(0x00, 0x00) AM_DEVWRITE(SOUND, "dac1", DAC_WRITE)
+ AM_RANGE(0x02, 0x02) AM_DEVWRITE(SOUND, "dac2", DAC_WRITE)
AM_RANGE(0x04, 0x04) AM_WRITE(nbmj8991_soundbank_w)
AM_RANGE(0x06, 0x06) AM_WRITE(SMH_NOP)
- AM_RANGE(0x80, 0x80) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "fm", ym3812_w)
ADDRESS_MAP_END
@@ -1571,10 +1566,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r, // DIPSW-A read
- input_port_1_r, // DIPSW-B read
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSWA"),
+ DEVCB_INPUT_PORT("DSWB"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
@@ -1604,7 +1599,7 @@ static MACHINE_DRIVER_START( nbmjdrv1 ) // galkoku
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("3812", YM3812, 25000000/10)
+ MDRV_SOUND_ADD("fm", YM3812, 25000000/10)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
MDRV_SOUND_ADD("dac", DAC, 0)
@@ -1643,7 +1638,7 @@ static MACHINE_DRIVER_START( nbmjdrv2 ) // pstadium
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("ym", YM3812, 25000000/6.25)
+ MDRV_SOUND_ADD("fm", YM3812, 25000000/6.25)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
MDRV_SOUND_ADD("dac1", DAC, 0)
@@ -1660,7 +1655,7 @@ static MACHINE_DRIVER_START( nbmjdrv3 )
MDRV_IMPORT_FROM(nbmjdrv1)
/* sound hardware */
- MDRV_SOUND_REPLACE("3812", AY8910, 1250000)
+ MDRV_SOUND_REPLACE("fm", AY8910, 1250000)
MDRV_SOUND_CONFIG(ay8910_config)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.35)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/nbmj9195.c b/src/mame/drivers/nbmj9195.c
index ba78039ec84..297f3df3c86 100644
--- a/src/mame/drivers/nbmj9195.c
+++ b/src/mame/drivers/nbmj9195.c
@@ -31,11 +31,9 @@ Notes:
#define SIGNED_DAC 0 // 0:unsigned DAC, 1:signed DAC
#if SIGNED_DAC
-#define DAC_0_WRITE dac_0_signed_data_w
-#define DAC_1_WRITE dac_1_signed_data_w
+#define DAC_WRITE dac_signed_w
#else
-#define DAC_0_WRITE dac_0_data_w
-#define DAC_1_WRITE dac_1_data_w
+#define DAC_WRITE dac_w
#endif
@@ -361,10 +359,10 @@ static WRITE8_HANDLER( tmpz84c011_pio_w )
nbmj9195_soundbank_w(space, 0, data);
break;
case 6: /* PB_1 */
- DAC_1_WRITE(space, 0, data);
+ DAC_WRITE(devtag_get_device(space->machine, SOUND, "dac2"), 0, data);
break;
case 7: /* PC_1 */
- DAC_0_WRITE(space, 0, data);
+ DAC_WRITE(devtag_get_device(space->machine, SOUND, "dac1"), 0, data);
break;
case 8: /* PD_1 */
break;
@@ -399,10 +397,10 @@ static WRITE8_HANDLER( tmpz84c011_pio_w )
nbmj9195_soundbank_w(space, 0, data);
break;
case 6: /* PB_1 */
- DAC_1_WRITE(space, 0, data);
+ DAC_WRITE(devtag_get_device(space->machine, SOUND, "dac2"), 0, data);
break;
case 7: /* PC_1 */
- DAC_0_WRITE(space, 0, data);
+ DAC_WRITE(devtag_get_device(space->machine, SOUND, "dac1"), 0, data);
break;
case 8: /* PD_1 */
break;
@@ -1720,8 +1718,7 @@ static ADDRESS_MAP_START( sound_writeport, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x34, 0x34) AM_WRITE(tmpz84c011_1_dir_pd_w)
AM_RANGE(0x44, 0x44) AM_WRITE(tmpz84c011_1_dir_pe_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "ym", ym3812_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/nemesis.c b/src/mame/drivers/nemesis.c
index b93a335ec4b..4909d611696 100644
--- a/src/mame/drivers/nemesis.c
+++ b/src/mame/drivers/nemesis.c
@@ -293,21 +293,21 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x060000, 0x067fff) AM_WRITE(SMH_RAM) AM_BASE(&ram) /* WORK RAM */
ADDRESS_MAP_END
-static WRITE8_HANDLER( salamand_speech_start_w )
+static WRITE8_DEVICE_HANDLER( salamand_speech_start_w )
{
- vlm5030_st ( 1 );
- vlm5030_st ( 0 );
+ vlm5030_st ( device, 1 );
+ vlm5030_st ( device, 0 );
}
-static WRITE8_HANDLER( gx400_speech_start_w )
+static WRITE8_DEVICE_HANDLER( gx400_speech_start_w )
{
/* the voice data is not in a rom but in sound RAM at $8000 */
- vlm5030_set_rom (gx400_shared_ram + 0x4000);
- vlm5030_st (1);
- vlm5030_st (0);
+ vlm5030_set_rom (device, gx400_shared_ram + 0x4000);
+ vlm5030_st (device, 1);
+ vlm5030_st (device, 0);
}
-static READ8_HANDLER( nemesis_portA_r )
+static READ8_DEVICE_HANDLER( nemesis_portA_r )
{
/*
bit 0-3: timer
@@ -316,11 +316,12 @@ static READ8_HANDLER( nemesis_portA_r )
bit 7: unused by this software version. Bubble Memory version uses this bit.
*/
- int res = (cputag_get_total_cycles(space->machine, "audio") / 1024) & 0x2f; // this should be 0x0f, but it doesn't work
+ const device_config *vlm = devtag_get_device(device->machine, SOUND, "vlm");
+ int res = (cputag_get_total_cycles(device->machine, "audio") / 1024) & 0x2f; // this should be 0x0f, but it doesn't work
res |= 0xd0;
- if (sndti_exists(SOUND_VLM5030, 0) && vlm5030_bsy())
+ if (vlm != NULL && vlm5030_bsy(vlm))
res |= 0x20;
return res;
@@ -330,21 +331,21 @@ static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM)
AM_RANGE(0x4000, 0x47ff) AM_READ(SMH_RAM)
AM_RANGE(0xe001, 0xe001) AM_READ(soundlatch_r)
- AM_RANGE(0xe086, 0xe086) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0xe205, 0xe205) AM_READ(ay8910_read_port_1_r)
+ AM_RANGE(0xe086, 0xe086) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0xe205, 0xe205) AM_DEVREAD(SOUND, "ay2", ay8910_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x4000, 0x47ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xa000, 0xafff) AM_WRITE(k005289_pitch_A_w)
- AM_RANGE(0xc000, 0xcfff) AM_WRITE(k005289_pitch_B_w)
- AM_RANGE(0xe003, 0xe003) AM_WRITE(k005289_keylatch_A_w)
- AM_RANGE(0xe004, 0xe004) AM_WRITE(k005289_keylatch_B_w)
- AM_RANGE(0xe005, 0xe005) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0xe006, 0xe006) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xe106, 0xe106) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xe405, 0xe405) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0xa000, 0xafff) AM_DEVWRITE(SOUND, "konami", k005289_pitch_A_w)
+ AM_RANGE(0xc000, 0xcfff) AM_DEVWRITE(SOUND, "konami", k005289_pitch_B_w)
+ AM_RANGE(0xe003, 0xe003) AM_DEVWRITE(SOUND, "konami", k005289_keylatch_A_w)
+ AM_RANGE(0xe004, 0xe004) AM_DEVWRITE(SOUND, "konami", k005289_keylatch_B_w)
+ AM_RANGE(0xe005, 0xe005) AM_DEVWRITE(SOUND, "ay2", ay8910_address_w)
+ AM_RANGE(0xe006, 0xe006) AM_DEVWRITE(SOUND, "ay1", ay8910_address_w)
+ AM_RANGE(0xe106, 0xe106) AM_DEVWRITE(SOUND, "ay1", ay8910_data_w)
+ AM_RANGE(0xe405, 0xe405) AM_DEVWRITE(SOUND, "ay2", ay8910_data_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( konamigt_readmem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -516,23 +517,23 @@ static ADDRESS_MAP_START( gx400_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_READ(SMH_ROM)
AM_RANGE(0x4000, 0x87ff) AM_READ(SMH_RAM)
AM_RANGE(0xe001, 0xe001) AM_READ(soundlatch_r)
- AM_RANGE(0xe086, 0xe086) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0xe205, 0xe205) AM_READ(ay8910_read_port_1_r)
+ AM_RANGE(0xe086, 0xe086) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0xe205, 0xe205) AM_DEVREAD(SOUND, "ay2", ay8910_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( gx400_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x4000, 0x87ff) AM_WRITE(SMH_RAM) AM_BASE(&gx400_shared_ram)
- AM_RANGE(0xa000, 0xafff) AM_WRITE(k005289_pitch_A_w)
- AM_RANGE(0xc000, 0xcfff) AM_WRITE(k005289_pitch_B_w)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(vlm5030_data_w)
- AM_RANGE(0xe003, 0xe003) AM_WRITE(k005289_keylatch_A_w)
- AM_RANGE(0xe004, 0xe004) AM_WRITE(k005289_keylatch_B_w)
- AM_RANGE(0xe005, 0xe005) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0xe006, 0xe006) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xe030, 0xe030) AM_WRITE(gx400_speech_start_w)
- AM_RANGE(0xe106, 0xe106) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xe405, 0xe405) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0xa000, 0xafff) AM_DEVWRITE(SOUND, "konami", k005289_pitch_A_w)
+ AM_RANGE(0xc000, 0xcfff) AM_DEVWRITE(SOUND, "konami", k005289_pitch_B_w)
+ AM_RANGE(0xe000, 0xe000) AM_DEVWRITE(SOUND, "vlm", vlm5030_data_w)
+ AM_RANGE(0xe003, 0xe003) AM_DEVWRITE(SOUND, "konami", k005289_keylatch_A_w)
+ AM_RANGE(0xe004, 0xe004) AM_DEVWRITE(SOUND, "konami", k005289_keylatch_B_w)
+ AM_RANGE(0xe005, 0xe006) AM_DEVWRITE(SOUND, "ay2", ay8910_address_w)
+ AM_RANGE(0xe006, 0xe006) AM_DEVWRITE(SOUND, "ay1", ay8910_address_w)
+ AM_RANGE(0xe030, 0xe030) AM_DEVWRITE(SOUND, "vlm", gx400_speech_start_w)
+ AM_RANGE(0xe106, 0xe106) AM_DEVWRITE(SOUND, "ay1", ay8910_data_w)
+ AM_RANGE(0xe405, 0xe405) AM_DEVWRITE(SOUND, "ay2", ay8910_data_w)
ADDRESS_MAP_END
/******************************************************************************/
@@ -725,51 +726,56 @@ static READ8_HANDLER( wd_r )
return a;
}
-static WRITE8_HANDLER( city_sound_bank_w )
+static WRITE8_DEVICE_HANDLER( city_sound_bank_w )
{
int bank_A=(data&0x3);
int bank_B=((data>>2)&0x3);
- k007232_set_bank( 0, bank_A, bank_B );
+ k007232_set_bank( device, bank_A, bank_B );
}
static ADDRESS_MAP_START( sal_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
- AM_RANGE(0xb000, 0xb00d) AM_READ(k007232_read_port_0_r)
- AM_RANGE(0xc001, 0xc001) AM_READ(ym2151_status_port_0_r)
+ AM_RANGE(0xb000, 0xb00d) AM_DEVREAD(SOUND, "konami", k007232_r)
+ AM_RANGE(0xc000, 0xc001) AM_DEVREAD(SOUND, "ym", ym2151_r)
AM_RANGE(0xe000, 0xe000) AM_READ(wd_r) /* watchdog?? */
ADDRESS_MAP_END
static ADDRESS_MAP_START( sal_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xb000, 0xb00d) AM_WRITE(k007232_write_port_0_w)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ym2151_data_port_0_w)
- AM_RANGE(0xd000, 0xd000) AM_WRITE(vlm5030_data_w)
- AM_RANGE(0xf000, 0xf000) AM_WRITE(salamand_speech_start_w)
+ AM_RANGE(0xb000, 0xb00d) AM_DEVWRITE(SOUND, "konami", k007232_w)
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ym", ym2151_w)
+ AM_RANGE(0xd000, 0xd000) AM_DEVWRITE(SOUND, "vlm", vlm5030_data_w)
+ AM_RANGE(0xf000, 0xf000) AM_DEVWRITE(SOUND, "vlm", salamand_speech_start_w)
+ADDRESS_MAP_END
+
+static ADDRESS_MAP_START( blkpnthr_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
+ AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
+ AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
+ AM_RANGE(0xb000, 0xb00d) AM_DEVWRITE(SOUND, "konami", k007232_w)
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ym", ym2151_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( city_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM)
- AM_RANGE(0xa000, 0xa000) AM_READ(ym3812_status_port_0_r)
- AM_RANGE(0xb000, 0xb00d) AM_READ(k007232_read_port_0_r)
+ AM_RANGE(0xa000, 0xa001) AM_DEVREAD(SOUND, "ym", ym3812_r)
+ AM_RANGE(0xb000, 0xb00d) AM_DEVREAD(SOUND, "konami", k007232_r)
AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( city_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x9800, 0x987f) AM_WRITE(k051649_waveform_w)
- AM_RANGE(0x9880, 0x9889) AM_WRITE(k051649_frequency_w)
- AM_RANGE(0x988a, 0x988e) AM_WRITE(k051649_volume_w)
- AM_RANGE(0x988f, 0x988f) AM_WRITE(k051649_keyonoff_w)
- AM_RANGE(0xa000, 0xa000) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0xa001, 0xa001) AM_WRITE(ym3812_write_port_0_w)
- AM_RANGE(0xb000, 0xb00d) AM_WRITE(k007232_write_port_0_w)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(city_sound_bank_w) /* 7232 bankswitch */
+ AM_RANGE(0x9800, 0x987f) AM_DEVWRITE(SOUND, "konami2", k051649_waveform_w)
+ AM_RANGE(0x9880, 0x9889) AM_DEVWRITE(SOUND, "konami2", k051649_frequency_w)
+ AM_RANGE(0x988a, 0x988e) AM_DEVWRITE(SOUND, "konami2", k051649_volume_w)
+ AM_RANGE(0x988f, 0x988f) AM_DEVWRITE(SOUND, "konami2", k051649_keyonoff_w)
+ AM_RANGE(0xa000, 0xa001) AM_DEVWRITE(SOUND, "ym", ym3812_w)
+ AM_RANGE(0xb000, 0xb00d) AM_DEVWRITE(SOUND, "konami", k007232_w)
+ AM_RANGE(0xc000, 0xc000) AM_DEVWRITE(SOUND, "konami", city_sound_bank_w) /* 7232 bankswitch */
ADDRESS_MAP_END
/******************************************************************************/
@@ -2061,26 +2067,26 @@ static const ay8910_interface ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- nemesis_portA_r,
- NULL,
- NULL,
- NULL
+ DEVCB_HANDLER(nemesis_portA_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- k005289_control_A_w,
- k005289_control_B_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_DEVICE_HANDLER(SOUND, "konami", k005289_control_A_w),
+ DEVCB_DEVICE_HANDLER(SOUND, "konami", k005289_control_B_w)
};
-static void sound_irq(running_machine *machine, int state)
+static void sound_irq(const device_config *device, int state)
{
/* Interrupts _are_ generated, I wonder where they go.. */
-/*cpu_set_input_line(machine->cpu[1],0,HOLD_LINE);*/
+/*cpu_set_input_line(device->machine->cpu[1],0,HOLD_LINE);*/
}
static const ym2151_interface ym2151_config =
@@ -2093,10 +2099,10 @@ static const ym3812_interface ym3812_config =
sound_irq
};
-static void volume_callback(int v)
+static void volume_callback(const device_config *device, int v)
{
- k007232_set_volume(0,0,(v >> 4) * 0x11,0);
- k007232_set_volume(0,1,0,(v & 0x0f) * 0x11);
+ k007232_set_volume(device,0,(v >> 4) * 0x11,0);
+ k007232_set_volume(device,1,0,(v & 0x0f) * 0x11);
}
static const k007232_interface k007232_config =
@@ -2251,7 +2257,7 @@ static MACHINE_DRIVER_START( blkpnthr )
MDRV_CPU_VBLANK_INT("main", blkpnthr_interrupt)
MDRV_CPU_ADD("audio", Z80, 3579545) /* 3.579545 MHz */
- MDRV_CPU_PROGRAM_MAP(sal_sound_readmem,sal_sound_writemem)
+ MDRV_CPU_PROGRAM_MAP(sal_sound_readmem,blkpnthr_sound_writemem)
MDRV_MACHINE_RESET(nemesis)
@@ -2319,7 +2325,7 @@ static MACHINE_DRIVER_START( citybomb )
/* sound hardware */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("konami1", K007232, 3579545)
+ MDRV_SOUND_ADD("konami", K007232, 3579545)
MDRV_SOUND_CONFIG(k007232_config)
MDRV_SOUND_ROUTE(0, "left", 0.30)
MDRV_SOUND_ROUTE(0, "right", 0.30)
@@ -2368,7 +2374,7 @@ static MACHINE_DRIVER_START( nyanpani )
/* sound hardware */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("konami1", K007232, 3579545)
+ MDRV_SOUND_ADD("konami", K007232, 3579545)
MDRV_SOUND_CONFIG(k007232_config)
MDRV_SOUND_ROUTE(0, "left", 0.30)
MDRV_SOUND_ROUTE(0, "right", 0.30)
@@ -2742,7 +2748,7 @@ ROM_START( citybomb )
ROM_REGION( 0x10000, "audio", 0 ) /* 64k for sound */
ROM_LOAD( "787-e02.4h", 0x00000, 0x08000, CRC(f4591e46) SHA1(c17c1a24bf1866fbba388521a4b7ea0975bda587) )
- ROM_REGION( 0x80000, "konami1", 0 ) /* 007232 data */
+ ROM_REGION( 0x80000, "konami", 0 ) /* 007232 data */
ROM_LOAD( "787-e01.1k", 0x00000, 0x80000, CRC(edc34d01) SHA1(b1465d1a7364a7cebc14b96cd01dc78e57975972) )
ROM_END
@@ -2760,7 +2766,7 @@ ROM_START( citybmrj )
ROM_REGION( 0x10000, "audio", 0 ) /* 64k for sound */
ROM_LOAD( "787-e02.4h", 0x00000, 0x08000, CRC(f4591e46) SHA1(c17c1a24bf1866fbba388521a4b7ea0975bda587) )
- ROM_REGION( 0x80000, "konami1", 0 ) /* 007232 data */
+ ROM_REGION( 0x80000, "konami", 0 ) /* 007232 data */
ROM_LOAD( "787-e01.1k", 0x00000, 0x80000, CRC(edc34d01) SHA1(b1465d1a7364a7cebc14b96cd01dc78e57975972) )
ROM_END
@@ -2774,7 +2780,7 @@ ROM_START( kittenk )
ROM_REGION( 0x10000, "audio", 0 ) /* 64k for sound */
ROM_LOAD( "712-e02.4h", 0x00000, 0x08000, CRC(ba76f310) SHA1(cc2164a9617493d1b3b8ac67430f9eb26fd987d2) )
- ROM_REGION( 0x80000, "konami1", 0 ) /* 007232 data */
+ ROM_REGION( 0x80000, "konami", 0 ) /* 007232 data */
ROM_LOAD( "712-b01.1k", 0x00000, 0x80000, CRC(f65b5d95) SHA1(12701be68629844720cd16af857ce38ef06af61c) )
ROM_END
@@ -2788,7 +2794,7 @@ ROM_START( nyanpani )
ROM_REGION( 0x10000, "audio", 0 ) /* 64k for sound */
ROM_LOAD( "712-e02.4h", 0x00000, 0x08000, CRC(ba76f310) SHA1(cc2164a9617493d1b3b8ac67430f9eb26fd987d2) )
- ROM_REGION( 0x80000, "konami1", 0 ) /* 007232 data */
+ ROM_REGION( 0x80000, "konami", 0 ) /* 007232 data */
ROM_LOAD( "712-b01.1k", 0x00000, 0x80000, CRC(f65b5d95) SHA1(12701be68629844720cd16af857ce38ef06af61c) )
ROM_END
diff --git a/src/mame/drivers/neogeo.c b/src/mame/drivers/neogeo.c
index 06235130e06..3e36d3294b7 100644
--- a/src/mame/drivers/neogeo.c
+++ b/src/mame/drivers/neogeo.c
@@ -286,9 +286,9 @@ static void start_interrupt_timers(running_machine *machine)
*
*************************************/
-static void audio_cpu_irq(running_machine *machine, int assert)
+static void audio_cpu_irq(const device_config *device, int assert)
{
- cpu_set_input_line(machine->cpu[1], 0, assert ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, assert ? ASSERT_LINE : CLEAR_LINE);
}
@@ -1084,10 +1084,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( auido_io_map, ADDRESS_SPACE_IO, 8 )
/*AM_RANGE(0x00, 0x00) AM_MIRROR(0xff00) AM_READWRITE(audio_command_r, audio_cpu_clear_nmi_w);*/ /* may not and NMI clear */
AM_RANGE(0x00, 0x00) AM_MIRROR(0xff00) AM_READ(audio_command_r)
- AM_RANGE(0x04, 0x04) AM_MIRROR(0xff00) AM_READWRITE(ym2610_status_port_0_a_r, ym2610_control_port_0_a_w)
- AM_RANGE(0x05, 0x05) AM_MIRROR(0xff00) AM_READWRITE(ym2610_read_port_0_r, ym2610_data_port_0_a_w)
- AM_RANGE(0x06, 0x06) AM_MIRROR(0xff00) AM_READWRITE(ym2610_status_port_0_b_r, ym2610_control_port_0_b_w)
- AM_RANGE(0x07, 0x07) AM_MIRROR(0xff00) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0x04, 0x07) AM_MIRROR(0xff00) AM_DEVREADWRITE(SOUND, "ym", ym2610_r, ym2610_w)
AM_RANGE(0x08, 0x08) AM_MIRROR(0xff00) /* write - NMI enable / acknowledge? (the data written doesn't matter) */
AM_RANGE(0x08, 0x08) AM_MIRROR(0xfff0) AM_MASK(0xfff0) AM_READ(audio_cpu_bank_select_f000_f7ff_r)
AM_RANGE(0x09, 0x09) AM_MIRROR(0xfff0) AM_MASK(0xfff0) AM_READ(audio_cpu_bank_select_e000_efff_r)
diff --git a/src/mame/drivers/news.c b/src/mame/drivers/news.c
index 6cd291adf11..dbb4f03a7d4 100644
--- a/src/mame/drivers/news.c
+++ b/src/mame/drivers/news.c
@@ -24,7 +24,7 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0x8fff) AM_READ(SMH_RAM)
AM_RANGE(0xc000, 0xc000) AM_READ_PORT("DSW")
AM_RANGE(0xc001, 0xc001) AM_READ_PORT("INPUTS")
- AM_RANGE(0xc002, 0xc002) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0xc002, 0xc002) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0xe000, 0xffff) AM_READ(SMH_RAM)
ADDRESS_MAP_END
@@ -33,7 +33,7 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0x87ff) AM_WRITE(news_fgram_w) AM_BASE(&news_fgram)
AM_RANGE(0x8800, 0x8fff) AM_WRITE(news_bgram_w) AM_BASE(&news_bgram)
AM_RANGE(0x9000, 0x91ff) AM_WRITE(paletteram_xxxxRRRRGGGGBBBB_be_w) AM_BASE(&paletteram)
- AM_RANGE(0xc002, 0xc002) AM_WRITE(okim6295_data_0_w) /* ?? */
+ AM_RANGE(0xc002, 0xc002) AM_DEVWRITE(SOUND, "oki", okim6295_w) /* ?? */
AM_RANGE(0xc003, 0xc003) AM_WRITE(news_bgpic_w)
AM_RANGE(0xe000, 0xffff) AM_WRITE(SMH_RAM)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/nightgal.c b/src/mame/drivers/nightgal.c
index beb5c3e76cf..6fa824bd676 100644
--- a/src/mame/drivers/nightgal.c
+++ b/src/mame/drivers/nightgal.c
@@ -313,46 +313,46 @@ static WRITE8_HANDLER( mux_w )
// printf("%02x\n",mux_data);
}
-static READ8_HANDLER( input_1p_r )
+static READ8_DEVICE_HANDLER( input_1p_r )
{
static UINT8 cr_clear;
- cr_clear = input_port_read(space->machine, "CR_CLEAR");
+ cr_clear = input_port_read(device->machine, "CR_CLEAR");
switch(mux_data)
{
- case 0x01: return input_port_read(space->machine, "PL1_1") | cr_clear;
- case 0x02: return input_port_read(space->machine, "PL1_2") | cr_clear;
- case 0x04: return input_port_read(space->machine, "PL1_3") | cr_clear;
- case 0x08: return input_port_read(space->machine, "PL1_4") | cr_clear;
- case 0x10: return input_port_read(space->machine, "PL1_5") | cr_clear;
- case 0x20: return input_port_read(space->machine, "PL1_6") | cr_clear;
+ case 0x01: return input_port_read(device->machine, "PL1_1") | cr_clear;
+ case 0x02: return input_port_read(device->machine, "PL1_2") | cr_clear;
+ case 0x04: return input_port_read(device->machine, "PL1_3") | cr_clear;
+ case 0x08: return input_port_read(device->machine, "PL1_4") | cr_clear;
+ case 0x10: return input_port_read(device->machine, "PL1_5") | cr_clear;
+ case 0x20: return input_port_read(device->machine, "PL1_6") | cr_clear;
}
// printf("%04x\n",mux_data);
- return (input_port_read(space->machine, "PL1_1") & input_port_read(space->machine, "PL1_2") & input_port_read(space->machine, "PL1_3") &
- input_port_read(space->machine, "PL1_4") & input_port_read(space->machine, "PL1_5") & input_port_read(space->machine, "PL1_6")) | cr_clear;//input_port_read(space->machine, "PL1_0") && ;
+ return (input_port_read(device->machine, "PL1_1") & input_port_read(device->machine, "PL1_2") & input_port_read(device->machine, "PL1_3") &
+ input_port_read(device->machine, "PL1_4") & input_port_read(device->machine, "PL1_5") & input_port_read(device->machine, "PL1_6")) | cr_clear;//input_port_read(device->machine, "PL1_0") && ;
}
-static READ8_HANDLER( input_2p_r )
+static READ8_DEVICE_HANDLER( input_2p_r )
{
static UINT8 coin_port;
- coin_port = input_port_read(space->machine, "COINS");
+ coin_port = input_port_read(device->machine, "COINS");
switch(mux_data)
{
- case 0x01: return input_port_read(space->machine, "PL2_1") | coin_port;
- case 0x02: return input_port_read(space->machine, "PL2_2") | coin_port;
- case 0x04: return input_port_read(space->machine, "PL2_3") | coin_port;
- case 0x08: return input_port_read(space->machine, "PL2_4") | coin_port;
- case 0x10: return input_port_read(space->machine, "PL2_5") | coin_port;
- case 0x20: return input_port_read(space->machine, "PL2_6") | coin_port;
+ case 0x01: return input_port_read(device->machine, "PL2_1") | coin_port;
+ case 0x02: return input_port_read(device->machine, "PL2_2") | coin_port;
+ case 0x04: return input_port_read(device->machine, "PL2_3") | coin_port;
+ case 0x08: return input_port_read(device->machine, "PL2_4") | coin_port;
+ case 0x10: return input_port_read(device->machine, "PL2_5") | coin_port;
+ case 0x20: return input_port_read(device->machine, "PL2_6") | coin_port;
}
// printf("%04x\n",mux_data);
- return (input_port_read(space->machine, "PL2_1") & input_port_read(space->machine, "PL2_2") & input_port_read(space->machine, "PL2_3") &
- input_port_read(space->machine, "PL2_4") & input_port_read(space->machine, "PL2_5") & input_port_read(space->machine, "PL2_6")) | coin_port;//input_port_read(space->machine, "PL1_0") && ;
+ return (input_port_read(device->machine, "PL2_1") & input_port_read(device->machine, "PL2_2") & input_port_read(device->machine, "PL2_3") &
+ input_port_read(device->machine, "PL2_4") & input_port_read(device->machine, "PL2_5") & input_port_read(device->machine, "PL2_6")) | coin_port;//input_port_read(device->machine, "PL1_0") && ;
}
@@ -376,9 +376,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( nightgal_io, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x01,0x01) AM_READ(ay8910_read_port_0_r) //ay read port
- AM_RANGE(0x02,0x02) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x03,0x03) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x01,0x01) AM_DEVREAD(SOUND, "ay", ay8910_r) //ay read port
+ AM_RANGE(0x02,0x03) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
// AM_RANGE(0x10,0x10) AM_WRITE(output_w)
AM_RANGE(0x10,0x10) AM_READ_PORT("DSWC")
AM_RANGE(0x11,0x11) AM_READ_PORT("SYSA")
@@ -417,8 +416,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sexygal_io, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00,0x00) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x01,0x01) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
+ AM_RANGE(0x00,0x01) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
// AM_RANGE(0x10,0x10) AM_WRITE(output_w)
AM_RANGE(0x10,0x10) AM_READ_PORT("DSWC")
AM_RANGE(0x11,0x11) AM_READ_PORT("SYSA")
@@ -672,10 +670,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_1p_r,
- input_2p_r,
- NULL,
- NULL
+ DEVCB_HANDLER(input_1p_r),
+ DEVCB_HANDLER(input_2p_r),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static MACHINE_DRIVER_START( nightgal )
diff --git a/src/mame/drivers/ninjakd2.c b/src/mame/drivers/ninjakd2.c
index 68058ef45bd..edb02b7435f 100644
--- a/src/mame/drivers/ninjakd2.c
+++ b/src/mame/drivers/ninjakd2.c
@@ -219,6 +219,7 @@ static SAMPLES_START( ninjakd2_init_samples )
static WRITE8_HANDLER( ninjakd2_pcm_play_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
const UINT8* const rom = memory_region(space->machine, "samples");
// only Ninja Kid II uses this
@@ -236,9 +237,9 @@ static WRITE8_HANDLER( ninjakd2_pcm_play_w )
++end;
if (end - start)
- sample_start_raw(0, &ninjakd2_sampledata[start], end - start, NE555_FREQUENCY, 0);
+ sample_start_raw(samples, 0, &ninjakd2_sampledata[start], end - start, NE555_FREQUENCY, 0);
else
- sample_stop(0);
+ sample_stop(samples, 0);
}
}
@@ -470,10 +471,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( ninjakd2_sound_io, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ym2203_control_port_1_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "2203.1", ym2203_w)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "2203.2", ym2203_w)
ADDRESS_MAP_END
@@ -896,9 +895,9 @@ GFXDECODE_END
*
*************************************/
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface ym2203_config =
@@ -906,7 +905,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
irqhandler
};
diff --git a/src/mame/drivers/ninjaw.c b/src/mame/drivers/ninjaw.c
index 14b9b4acb5d..aa4a6614ec7 100644
--- a/src/mame/drivers/ninjaw.c
+++ b/src/mame/drivers/ninjaw.c
@@ -271,10 +271,11 @@ static READ16_HANDLER( ninjaw_sound_r )
static int ninjaw_pandata[4];
static WRITE8_HANDLER( ninjaw_pancontrol )
{
- offset = offset&3;
- ninjaw_pandata[offset] = (float)data * (100.f / 255.0f);
- //popmessage(" pan %02x %02x %02x %02x", ninjaw_pandata[0], ninjaw_pandata[1], ninjaw_pandata[2], ninjaw_pandata[3] );
- flt_volume_set_volume(offset, ninjaw_pandata[offset] / 100.0);
+ static const char *fltname[] = { "2610.1.l", "2610.1.r", "2610.2.l", "2610.2.r" };
+ offset = offset&3;
+ ninjaw_pandata[offset] = (float)data * (100.f / 255.0f);
+ //popmessage(" pan %02x %02x %02x %02x", ninjaw_pandata[0], ninjaw_pandata[1], ninjaw_pandata[2], ninjaw_pandata[3] );
+ flt_volume_set_volume(devtag_get_device(space->machine, SOUND, fltname[offset]), ninjaw_pandata[offset] / 100.0);
}
@@ -409,9 +410,7 @@ static ADDRESS_MAP_START( z80_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM)
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK10)
AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_READ(ym2610_status_port_0_a_r)
- AM_RANGE(0xe001, 0xe001) AM_READ(ym2610_read_port_0_r)
- AM_RANGE(0xe002, 0xe002) AM_READ(ym2610_status_port_0_b_r)
+ AM_RANGE(0xe000, 0xe003) AM_DEVREAD(SOUND, "ym", ym2610_r)
AM_RANGE(0xe200, 0xe200) AM_READ(SMH_NOP)
AM_RANGE(0xe201, 0xe201) AM_READ(taitosound_slave_comm_r)
AM_RANGE(0xea00, 0xea00) AM_READ(SMH_NOP)
@@ -420,10 +419,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( z80_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xdfff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ym2610_control_port_0_a_w)
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ym2610_data_port_0_a_w)
- AM_RANGE(0xe002, 0xe002) AM_WRITE(ym2610_control_port_0_b_w)
- AM_RANGE(0xe003, 0xe003) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0xe000, 0xe003) AM_DEVWRITE(SOUND, "ym", ym2610_w)
AM_RANGE(0xe200, 0xe200) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xe201, 0xe201) AM_WRITE(taitosound_slave_comm_w)
AM_RANGE(0xe400, 0xe403) AM_WRITE(ninjaw_pancontrol) /* pan */
@@ -569,9 +565,9 @@ GFXDECODE_END
**************************************************************/
/* handler called by the YM2610 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface ym2610_config =
@@ -585,7 +581,7 @@ static const ym2610_interface ym2610_config =
**************************************************************/
#if 0
-static int subwoofer_sh_start(const sound_config *msound)
+static DEVICE_START( subwoofer )
{
/* Adjust the lowpass filter of the first three YM2610 channels */
@@ -599,12 +595,20 @@ static int subwoofer_sh_start(const sound_config *msound)
return 0;
}
-static const custom_sound_interface subwoofer_interface =
+static DEVICE_GET_INFO( subwoofer )
{
- subwoofer_sh_start,
- 0, /* none */
- 0 /* none */
-};
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(subwoofer); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Subwoofer"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
+}
+
+#define SOUND_SUBWOOFER DEVICE_GET_INFO_NAME(subwoofer)
#endif
@@ -687,7 +691,7 @@ static MACHINE_DRIVER_START( ninjaw )
MDRV_SOUND_ADD("2610.2.r", FILTER_VOLUME, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.0)
-// MDRV_SOUND_ADD("subwoofer", CUSTOM, subwoofer_interface)
+// MDRV_SOUND_ADD("subwoofer", SUBWOOFER, 0)
MACHINE_DRIVER_END
@@ -760,7 +764,7 @@ static MACHINE_DRIVER_START( darius2 )
MDRV_SOUND_ADD("2610.2.r", FILTER_VOLUME, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.0)
-// MDRV_SOUND_ADD("subwoofer", CUSTOM, subwoofer_interface)
+// MDRV_SOUND_ADD("subwoofer", SUBWOOFER, 0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/niyanpai.c b/src/mame/drivers/niyanpai.c
index 409f89033d6..d7fbf798c51 100644
--- a/src/mame/drivers/niyanpai.c
+++ b/src/mame/drivers/niyanpai.c
@@ -46,11 +46,9 @@ Memo:
#define SIGNED_DAC 0 // 0:unsigned DAC, 1:signed DAC
#if SIGNED_DAC
-#define DAC_0_WRITE dac_0_signed_data_w
-#define DAC_1_WRITE dac_1_signed_data_w
+#define DAC_WRITE dac_signed_w
#else
-#define DAC_0_WRITE dac_0_data_w
-#define DAC_1_WRITE dac_1_data_w
+#define DAC_WRITE dac_w
#endif
@@ -124,10 +122,10 @@ static WRITE8_HANDLER( tmpz84c011_pio_w)
niyanpai_soundbank_w(space->machine, data & 0x03);
break;
case 1: /* PB_0 */
- DAC_1_WRITE(space, 0, data);
+ DAC_WRITE(devtag_get_device(space->machine, SOUND, "dac2"), 0, data);
break;
case 2: /* PC_0 */
- DAC_0_WRITE(space, 0, data);
+ DAC_WRITE(devtag_get_device(space->machine, SOUND, "dac1"), 0, data);
break;
case 3: /* PD_0 */
break;
@@ -479,8 +477,7 @@ static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x56, 0x56) AM_READWRITE(tmpz84c011_0_dir_pc_r, tmpz84c011_0_dir_pc_w)
AM_RANGE(0x34, 0x34) AM_READWRITE(tmpz84c011_0_dir_pd_r, tmpz84c011_0_dir_pd_w)
AM_RANGE(0x44, 0x44) AM_READWRITE(tmpz84c011_0_dir_pe_r, tmpz84c011_0_dir_pe_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "ym", ym3812_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/nmg5.c b/src/mame/drivers/nmg5.c
index a0a8be45d06..1b3a312a15c 100644
--- a/src/mame/drivers/nmg5.c
+++ b/src/mame/drivers/nmg5.c
@@ -278,9 +278,9 @@ static WRITE16_HANDLER( priority_reg_w )
popmessage("unknown priority_reg value = %d\n",priority_reg);
}
-static WRITE8_HANDLER( oki_banking_w )
+static WRITE8_DEVICE_HANDLER( oki_banking_w )
{
- okim6295_set_bank_base(0, (data & 1) ? 0x40000 : 0 );
+ okim6295_set_bank_base(device, (data & 1) ? 0x40000 : 0 );
}
/*******************************************************************
@@ -346,11 +346,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(oki_banking_w)
- AM_RANGE(0x10, 0x10) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0x11, 0x11) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x00, 0x00) AM_DEVWRITE(SOUND, "oki", oki_banking_w)
+ AM_RANGE(0x10, 0x11) AM_DEVREADWRITE(SOUND, "ym", ym3812_r, ym3812_w)
AM_RANGE(0x18, 0x18) AM_READ(soundlatch_r)
- AM_RANGE(0x1c, 0x1c) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x1c, 0x1c) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
ADDRESS_MAP_END
static INPUT_PORTS_START( nmg5 )
@@ -958,9 +957,9 @@ static GFXDECODE_START( pclubys )
GFXDECODE_END
-static void soundirq(running_machine *machine, int state)
+static void soundirq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1], 0, state);
+ cpu_set_input_line(device->machine->cpu[1], 0, state);
}
static const ym3812_interface ym3812_intf =
diff --git a/src/mame/drivers/nmk16.c b/src/mame/drivers/nmk16.c
index d61645e1ae4..d7d462a14b8 100644
--- a/src/mame/drivers/nmk16.c
+++ b/src/mame/drivers/nmk16.c
@@ -376,24 +376,23 @@ static ADDRESS_MAP_START( tharrier_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_READ(SMH_ROM)
AM_RANGE(0xc000, 0xc7ff) AM_READ(SMH_RAM)
AM_RANGE(0xf000, 0xf000) AM_READ(soundlatch_r)
- AM_RANGE(0xf400, 0xf400) AM_READ(okim6295_status_0_r)
- AM_RANGE(0xf500, 0xf500) AM_READ(okim6295_status_1_r)
+ AM_RANGE(0xf400, 0xf400) AM_DEVREAD(SOUND, "oki1", okim6295_r)
+ AM_RANGE(0xf500, 0xf500) AM_DEVREAD(SOUND, "oki2", okim6295_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( tharrier_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xc7ff) AM_WRITE(SMH_RAM)
AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch2_w)
- AM_RANGE(0xf400, 0xf400) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0xf500, 0xf500) AM_WRITE(okim6295_data_1_w)
+ AM_RANGE(0xf400, 0xf400) AM_DEVWRITE(SOUND, "oki1", okim6295_w)
+ AM_RANGE(0xf500, 0xf500) AM_DEVWRITE(SOUND, "oki2", okim6295_w)
AM_RANGE(0xf600, 0xf600) AM_WRITE(tharrier_oki6295_bankswitch_0_w)
AM_RANGE(0xf700, 0xf700) AM_WRITE(tharrier_oki6295_bankswitch_1_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( tharrier_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( tharrier_readmem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -1002,7 +1001,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( ssmissin_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM)
- AM_RANGE(0x9800, 0x9800) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x9800, 0x9800) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -1010,7 +1009,7 @@ static ADDRESS_MAP_START( ssmissin_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
AM_RANGE(0x9000, 0x9000) AM_WRITE(ssmissin_soundbank_w)
- AM_RANGE(0x9800, 0x9800) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0x9800, 0x9800) AM_DEVWRITE(SOUND, "oki", okim6295_w)
ADDRESS_MAP_END
@@ -1150,10 +1149,9 @@ static WRITE8_HANDLER( raphero_sound_rombank_w )
static ADDRESS_MAP_START( raphero_sound_mem_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE( 0x0000, 0x7fff ) AM_ROM
AM_RANGE( 0x8000, 0xbfff ) AM_READ( SMH_BANK1 )
- AM_RANGE( 0xc000, 0xc000 ) AM_READWRITE( ym2203_status_port_0_r, ym2203_control_port_0_w )
- AM_RANGE( 0xc001, 0xc001 ) AM_READWRITE( ym2203_read_port_0_r, ym2203_write_port_0_w )
- AM_RANGE( 0xc800, 0xc800 ) AM_READWRITE( okim6295_status_0_r, okim6295_data_0_w )
- AM_RANGE( 0xc808, 0xc808 ) AM_READWRITE( okim6295_status_1_r, okim6295_data_1_w )
+ AM_RANGE( 0xc000, 0xc001 ) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w )
+ AM_RANGE( 0xc800, 0xc800 ) AM_DEVREADWRITE( SOUND, "oki1", okim6295_r, okim6295_w )
+ AM_RANGE( 0xc808, 0xc808 ) AM_DEVREADWRITE( SOUND, "oki2", okim6295_r, okim6295_w )
AM_RANGE( 0xc810, 0xc817 ) AM_WRITE( NMK112_okibank_w )
// AM_RANGE( 0xc810, 0xc817 ) AM_WRITE( okibank_w )
AM_RANGE( 0xd000, 0xd000 ) AM_WRITE( raphero_sound_rombank_w )
@@ -1178,10 +1176,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( macross2_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
- AM_RANGE(0x80, 0x80) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
- AM_RANGE(0x88, 0x88) AM_READWRITE(okim6295_status_1_r, okim6295_data_1_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
+ AM_RANGE(0x80, 0x80) AM_DEVREADWRITE(SOUND, "oki1", okim6295_r, okim6295_w)
+ AM_RANGE(0x88, 0x88) AM_DEVREADWRITE(SOUND, "oki2", okim6295_r, okim6295_w)
AM_RANGE(0x90, 0x97) AM_WRITE(NMK112_okibank_w)
ADDRESS_MAP_END
@@ -1191,8 +1188,8 @@ static ADDRESS_MAP_START( bjtwin_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x080002, 0x080003) AM_READ_PORT("IN1")
AM_RANGE(0x080008, 0x080009) AM_READ_PORT("DSW1")
AM_RANGE(0x08000a, 0x08000b) AM_READ_PORT("DSW2")
- AM_RANGE(0x084000, 0x084001) AM_READ(okim6295_status_0_lsb_r)
- AM_RANGE(0x084010, 0x084011) AM_READ(okim6295_status_1_lsb_r)
+ AM_RANGE(0x084000, 0x084001) AM_DEVREAD8(SOUND, "oki1", okim6295_r, 0x00ff)
+ AM_RANGE(0x084010, 0x084011) AM_DEVREAD8(SOUND, "oki2", okim6295_r, 0x00ff)
AM_RANGE(0x088000, 0x0887ff) AM_READ(SMH_RAM)
AM_RANGE(0x09c000, 0x09cfff) AM_READ(nmk_bgvideoram_r)
AM_RANGE(0x09d000, 0x09dfff) AM_READ(nmk_bgvideoram_r) /* mirror */
@@ -1201,8 +1198,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( bjtwin_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_WRITE(SMH_ROM)
AM_RANGE(0x080014, 0x080015) AM_WRITE(nmk_flipscreen_w)
- AM_RANGE(0x084000, 0x084001) AM_WRITE(okim6295_data_0_lsb_w)
- AM_RANGE(0x084010, 0x084011) AM_WRITE(okim6295_data_1_lsb_w)
+ AM_RANGE(0x084000, 0x084001) AM_DEVWRITE8(SOUND, "oki1", okim6295_w, 0x00ff)
+ AM_RANGE(0x084010, 0x084011) AM_DEVWRITE8(SOUND, "oki2", okim6295_w, 0x00ff)
AM_RANGE(0x084020, 0x08402f) AM_WRITE(NMK112_okibank_lsb_w)
AM_RANGE(0x088000, 0x0887ff) AM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE(&paletteram16)
AM_RANGE(0x094000, 0x094001) AM_WRITE(nmk_tilebank_w)
@@ -3568,14 +3565,14 @@ static const ym2203_interface ym2203_nmk004_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
NMK004_irq
};
-static void ym2203_irqhandler(running_machine *machine, int irq)
+static void ym2203_irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface ym2203_config =
@@ -3583,7 +3580,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
ym2203_irqhandler
};
@@ -4096,7 +4093,7 @@ static MACHINE_DRIVER_START( ssmissin )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("oki1", OKIM6295, 8000000/8) /* 1 Mhz, pin 7 high */
+ MDRV_SOUND_ADD("oki", OKIM6295, 8000000/8) /* 1 Mhz, pin 7 high */
MDRV_SOUND_CONFIG(okim6295_interface_pin7high)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
@@ -4790,12 +4787,12 @@ static WRITE16_HANDLER( twinactn_flipscreen_w )
***************************************************************************/
-static WRITE8_HANDLER( spec2k_oki1_banking_w )
+static WRITE8_DEVICE_HANDLER( spec2k_oki1_banking_w )
{
if(data == 0xfe)
- okim6295_set_bank_base(1, 0);
+ okim6295_set_bank_base(device, 0);
else if(data == 0xff)
- okim6295_set_bank_base(1, 0x40000);
+ okim6295_set_bank_base(device, 0x40000);
}
static ADDRESS_MAP_START( afega_sound_cpu, ADDRESS_SPACE_PROGRAM, 8 )
@@ -4804,28 +4801,27 @@ static ADDRESS_MAP_START( afega_sound_cpu, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_ROM
AM_RANGE(0xf000, 0xf7ff) AM_RAM // RAM
AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r) // From Main CPU
- AM_RANGE(0xf808, 0xf808) AM_WRITE(ym2151_register_port_0_w) // YM2151
- AM_RANGE(0xf809, 0xf809) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w) // YM2151
- AM_RANGE(0xf80a, 0xf80a) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w) // M6295
+ AM_RANGE(0xf808, 0xf809) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w) // YM2151
+ AM_RANGE(0xf80a, 0xf80a) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w) // M6295
ADDRESS_MAP_END
static ADDRESS_MAP_START( firehawk_sound_cpu, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_ROM
AM_RANGE(0xf000, 0xf7ff) AM_RAM
AM_RANGE(0xfff0, 0xfff0) AM_READ(soundlatch_r)
- AM_RANGE(0xfff2, 0xfff2) AM_WRITE(spec2k_oki1_banking_w )
- AM_RANGE(0xfff8, 0xfff8) AM_READWRITE(okim6295_status_1_r, okim6295_data_1_w)
- AM_RANGE(0xfffa, 0xfffa) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0xfff2, 0xfff2) AM_DEVWRITE(SOUND, "oki2", spec2k_oki1_banking_w )
+ AM_RANGE(0xfff8, 0xfff8) AM_DEVREADWRITE(SOUND, "oki2", okim6295_r, okim6295_w)
+ AM_RANGE(0xfffa, 0xfffa) AM_DEVREADWRITE(SOUND, "oki1", okim6295_r, okim6295_w)
AM_RANGE(0xf800, 0xffff) AM_RAM // not used, only tested
ADDRESS_MAP_END
-static WRITE8_HANDLER( twinactn_oki_bank_w )
+static WRITE8_DEVICE_HANDLER( twinactn_oki_bank_w )
{
- okim6295_set_bank_base(0, (data & 3) * 0x40000);
+ okim6295_set_bank_base(device, (data & 3) * 0x40000);
if (data & (~3))
- logerror("%04x: invalid oki bank %02x\n", cpu_get_pc(space->cpu), data);
+ logerror("%s: invalid oki bank %02x\n", cpuexec_describe_context(device->machine), data);
// logerror("%04x: oki bank %02x\n", cpu_get_pc(space->cpu), data);
}
@@ -4833,8 +4829,8 @@ static WRITE8_HANDLER( twinactn_oki_bank_w )
static ADDRESS_MAP_START( twinactn_sound_cpu, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
- AM_RANGE(0x9000, 0x9000) AM_WRITE(twinactn_oki_bank_w)
- AM_RANGE(0x9800, 0x9800) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x9000, 0x9000) AM_DEVWRITE(SOUND, "oki", twinactn_oki_bank_w)
+ AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r) // From Main CPU
ADDRESS_MAP_END
@@ -4918,9 +4914,9 @@ GFXDECODE_END
***************************************************************************/
-static void irq_handler(running_machine *machine, int irq)
+static void irq_handler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2151_interface afega_ym2151_intf =
@@ -4963,7 +4959,7 @@ static MACHINE_DRIVER_START( stagger1 )
MDRV_SOUND_ROUTE(0, "left", 0.30)
MDRV_SOUND_ROUTE(1, "right", 0.30)
- MDRV_SOUND_ADD("oki1", OKIM6295, XTAL_4MHz/4) /* verified on pcb */
+ MDRV_SOUND_ADD("oki", OKIM6295, XTAL_4MHz/4) /* verified on pcb */
MDRV_SOUND_CONFIG(okim6295_interface_pin7high) /* verified on pcb */
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.70)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.70)
@@ -5073,7 +5069,7 @@ static MACHINE_DRIVER_START( twinactn )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("oki1", OKIM6295, 1000000)
+ MDRV_SOUND_ADD("oki", OKIM6295, 1000000)
MDRV_SOUND_CONFIG(okim6295_interface_pin7high)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/norautp.c b/src/mame/drivers/norautp.c
index 4f76dd4eda1..2034040da80 100644
--- a/src/mame/drivers/norautp.c
+++ b/src/mame/drivers/norautp.c
@@ -263,18 +263,15 @@ static WRITE8_DEVICE_HANDLER( ccounter_w )
coin_counter_w(0, data & 0x20); /* Coin1 */
coin_counter_w(1, data & 0x10); /* Coin2 */
coin_counter_w(2, data & 0x08); /* Payout */
-
}
static WRITE8_DEVICE_HANDLER( sndlamp_w )
{
-
output_set_lamp_value(8, (data >> 0) & 1); /* Start? */
output_set_lamp_value(9, (data >> 1) & 1); /* Bet */
/* the 4 MSB are for discrete (or DAC) sound */
- dac_data_w(0, (data & 0xf0)); /* Sound DAC? */
-
+ dac_data_w(devtag_get_device(device->machine, SOUND, "dac"), (data & 0xf0)); /* Sound DAC? */
}
/*game waits for bit 7 (0x80) to be set.*/
diff --git a/src/mame/drivers/nova2001.c b/src/mame/drivers/nova2001.c
index 01bc2e21531..8f2d4299dfb 100644
--- a/src/mame/drivers/nova2001.c
+++ b/src/mame/drivers/nova2001.c
@@ -179,10 +179,10 @@ static ADDRESS_MAP_START( nova2001_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xa800, 0xafff) AM_RAM_WRITE(nova2001_bg_videoram_w) AM_BASE(&nova2001_bg_videoram)
AM_RANGE(0xb000, 0xb7ff) AM_RAM AM_BASE(&spriteram)
AM_RANGE(0xb800, 0xbfff) AM_WRITE(nova2001_flipscreen_w)
- AM_RANGE(0xc000, 0xc000) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0xc001, 0xc001) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
- AM_RANGE(0xc002, 0xc002) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xc003, 0xc003) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0xc000, 0xc000) AM_DEVREADWRITE(SOUND, "ay1", ay8910_r, ay8910_data_w)
+ AM_RANGE(0xc001, 0xc001) AM_DEVREADWRITE(SOUND, "ay2", ay8910_r, ay8910_data_w)
+ AM_RANGE(0xc002, 0xc002) AM_DEVWRITE(SOUND, "ay1", ay8910_address_w)
+ AM_RANGE(0xc003, 0xc003) AM_DEVWRITE(SOUND, "ay2", ay8910_address_w)
AM_RANGE(0xc004, 0xc004) AM_READ(watchdog_reset_r)
AM_RANGE(0xc006, 0xc006) AM_READ_PORT("IN0")
AM_RANGE(0xc007, 0xc007) AM_READ_PORT("IN1")
@@ -194,10 +194,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( ninjakun_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_ROM
AM_RANGE(0x2000, 0x7fff) AM_ROM
- AM_RANGE(0x8000, 0x8000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x8001, 0x8001) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x8002, 0x8002) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x8003, 0x8003) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
+ AM_RANGE(0x8000, 0x8001) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x8001, 0x8001) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0x8002, 0x8003) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x8003, 0x8003) AM_DEVREAD(SOUND, "ay2", ay8910_r)
AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0")
AM_RANGE(0xa001, 0xa001) AM_READ_PORT("IN1")
AM_RANGE(0xa002, 0xa002) AM_READ_PORT("IN2") AM_WRITE(ninjakun_cpu1_io_A002_w)
@@ -213,10 +213,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( ninjakun_cpu2_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_ROM
AM_RANGE(0x2000, 0x7fff) AM_ROM AM_REGION("main", 0x2000)
- AM_RANGE(0x8000, 0x8000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x8001, 0x8001) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x8002, 0x8002) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x8003, 0x8003) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
+ AM_RANGE(0x8000, 0x8001) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x8001, 0x8001) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0x8002, 0x8002) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x8003, 0x8003) AM_DEVREAD(SOUND, "ay2", ay8910_r)
AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0")
AM_RANGE(0xa001, 0xa001) AM_READ_PORT("IN1")
AM_RANGE(0xa002, 0xa002) AM_READ_PORT("IN2") AM_WRITE(ninjakun_cpu2_io_A002_w)
@@ -234,10 +234,10 @@ static ADDRESS_MAP_START( pkunwar_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM AM_BASE(&spriteram)
AM_RANGE(0x8800, 0x8fff) AM_RAM_WRITE(nova2001_bg_videoram_w) AM_BASE(&nova2001_bg_videoram)
- AM_RANGE(0xa000, 0xa000) AM_WRITE(&ay8910_control_port_0_w)
- AM_RANGE(0xa001, 0xa001) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0xa002, 0xa002) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0xa003, 0xa003) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
+ AM_RANGE(0xa000, 0xa001) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0xa001, 0xa001) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0xa002, 0xa002) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0xa003, 0xa003) AM_DEVREAD(SOUND, "ay2", ay8910_r)
AM_RANGE(0xc000, 0xc7ff) AM_RAM
AM_RANGE(0xe000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -256,20 +256,20 @@ static ADDRESS_MAP_START( raiders5_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xa000, 0xa000) AM_WRITE(nova2001_scroll_x_w)
AM_RANGE(0xa001, 0xa001) AM_WRITE(nova2001_scroll_y_w)
AM_RANGE(0xa002, 0xa002) AM_WRITE(pkunwar_flipscreen_w)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xc001, 0xc001) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0xc002, 0xc002) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0xc003, 0xc003) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0xc001, 0xc001) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0xc002, 0xc002) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0xc003, 0xc003) AM_DEVREAD(SOUND, "ay2", ay8910_r)
AM_RANGE(0xd000, 0xd1ff) AM_RAM_WRITE(ninjakun_paletteram_w) AM_BASE(&paletteram)
AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE(1)
ADDRESS_MAP_END
static ADDRESS_MAP_START( raiders5_cpu2_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM
- AM_RANGE(0x8000, 0x8000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x8001, 0x8001) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x8002, 0x8002) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x8003, 0x8003) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
+ AM_RANGE(0x8000, 0x8001) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x8001, 0x8001) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0x8002, 0x8003) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x8003, 0x8003) AM_DEVREAD(SOUND, "ay2", ay8910_r)
AM_RANGE(0x9000, 0x9000) AM_READ(SMH_NOP) /* unknown */
AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_SHARE(1)
AM_RANGE(0xc000, 0xc000) AM_READ(SMH_NOP) /* unknown */
@@ -656,40 +656,40 @@ static const ay8910_interface nova2001_ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- nova2001_scroll_x_w,
- nova2001_scroll_y_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_MEMORY_HANDLER("main", PROGRAM, nova2001_scroll_x_w),
+ DEVCB_MEMORY_HANDLER("main", PROGRAM, nova2001_scroll_y_w)
};
static const ay8910_interface nova2001_ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_3_r,
- input_port_4_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface pkunwar_ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r,
- input_port_1_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("IN0"),
+ DEVCB_INPUT_PORT("IN1"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface pkunwar_ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_2_r,
- input_port_3_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("IN2"),
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/nss.c b/src/mame/drivers/nss.c
index 874dfd3c3de..a54e66d0360 100644
--- a/src/mame/drivers/nss.c
+++ b/src/mame/drivers/nss.c
@@ -409,9 +409,6 @@ static INPUT_PORTS_START( snes )
PORT_DIPSETTING( 0x80, DEF_STR( On ) )
INPUT_PORTS_END
-static const custom_sound_interface snes_sound_interface =
-{ snes_sh_start };
-
static MACHINE_DRIVER_START( snes )
/* basic machine hardware */
MDRV_CPU_ADD("main", G65816, 3580000) /* 2.68Mhz, also 3.58Mhz */
@@ -436,8 +433,7 @@ static MACHINE_DRIVER_START( snes )
/* sound hardware */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("snes", CUSTOM, 0)
- MDRV_SOUND_CONFIG(snes_sound_interface)
+ MDRV_SOUND_ADD("snes", SNES, 0)
MDRV_SOUND_ROUTE(0, "left", 1.00)
MDRV_SOUND_ROUTE(1, "right", 1.00)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/nwk-tr.c b/src/mame/drivers/nwk-tr.c
index 78b21f3de3a..6e14d86b613 100644
--- a/src/mame/drivers/nwk-tr.c
+++ b/src/mame/drivers/nwk-tr.c
@@ -926,7 +926,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_memmap, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_ROM
AM_RANGE(0x100000, 0x10ffff) AM_RAM /* Work RAM */
- AM_RANGE(0x200000, 0x200fff) AM_READWRITE(rf5c400_0_r, rf5c400_0_w) /* Ricoh RF5C400 */
+ AM_RANGE(0x200000, 0x200fff) AM_DEVREADWRITE(SOUND, "rf", rf5c400_r, rf5c400_w) /* Ricoh RF5C400 */
AM_RANGE(0x300000, 0x30000f) AM_READWRITE(K056800_sound_r, K056800_sound_w)
AM_RANGE(0x600000, 0x600001) AM_NOP
ADDRESS_MAP_END
diff --git a/src/mame/drivers/nycaptor.c b/src/mame/drivers/nycaptor.c
index 5064319013a..c41f9ae770c 100644
--- a/src/mame/drivers/nycaptor.c
+++ b/src/mame/drivers/nycaptor.c
@@ -258,7 +258,7 @@ static WRITE8_HANDLER( nmi_enable_w )
}
}
-static WRITE8_HANDLER(unk_w)
+static WRITE8_DEVICE_HANDLER(unk_w)
{
}
@@ -267,10 +267,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- unk_w,
- unk_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(unk_w),
+ DEVCB_HANDLER(unk_w)
};
static const msm5232_interface msm5232_config =
@@ -368,11 +368,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xc7ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xc800, 0xc800) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xc801, 0xc801) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xc802, 0xc802) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0xc803, 0xc803) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0xc900, 0xc90d) AM_WRITE(msm5232_0_w)
+ AM_RANGE(0xc800, 0xc801) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0xc802, 0xc803) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0xc900, 0xc90d) AM_DEVWRITE(SOUND, "msm", msm5232_w)
AM_RANGE(0xca00, 0xca00) AM_WRITE(SMH_NOP)
AM_RANGE(0xcb00, 0xcb00) AM_WRITE(SMH_NOP)
AM_RANGE(0xcc00, 0xcc00) AM_WRITE(SMH_NOP)
diff --git a/src/mame/drivers/nyny.c b/src/mame/drivers/nyny.c
index d57adc4e926..5e8f5461410 100644
--- a/src/mame/drivers/nyny.c
+++ b/src/mame/drivers/nyny.c
@@ -442,7 +442,7 @@ static WRITE8_HANDLER( audio_1_answer_w )
}
-static WRITE8_HANDLER( nyny_ay8910_37_port_a_w )
+static WRITE8_DEVICE_HANDLER( nyny_ay8910_37_port_a_w )
{
/* not sure what this does */
@@ -450,20 +450,14 @@ static WRITE8_HANDLER( nyny_ay8910_37_port_a_w )
}
-static WRITE8_HANDLER( nyny_ay8910_37_port_b_w )
-{
- dac_data_w(0, data);
-}
-
-
static const ay8910_interface ay8910_37_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- nyny_ay8910_37_port_a_w,
- nyny_ay8910_37_port_b_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(nyny_ay8910_37_port_a_w),
+ DEVCB_DEVICE_HANDLER(SOUND, "dac", dac_w)
};
@@ -471,10 +465,10 @@ static const ay8910_interface ay8910_64_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_3_r,
- input_port_2_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("SW2"),
+ DEVCB_INPUT_PORT("SW1"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
@@ -543,10 +537,10 @@ static ADDRESS_MAP_START( nyny_audio_1_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0080, 0x0fff) AM_NOP
AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x0fff) AM_READWRITE(soundlatch_r, audio_1_answer_w)
AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x0fff) AM_READ_PORT("SW3")
- AM_RANGE(0x3000, 0x3000) AM_MIRROR(0x0ffc) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x3001, 0x3001) AM_MIRROR(0x0ffc) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x3002, 0x3002) AM_MIRROR(0x0ffc) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
- AM_RANGE(0x3003, 0x3003) AM_MIRROR(0x0ffc) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0x3000, 0x3000) AM_MIRROR(0x0ffc) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0x3000, 0x3001) AM_MIRROR(0x0ffc) AM_DEVWRITE(SOUND, "ay1", ay8910_data_address_w)
+ AM_RANGE(0x3002, 0x3002) AM_MIRROR(0x0ffc) AM_DEVREAD(SOUND, "ay2", ay8910_r)
+ AM_RANGE(0x3002, 0x3003) AM_MIRROR(0x0ffc) AM_DEVWRITE(SOUND, "ay2", ay8910_data_address_w)
AM_RANGE(0x4000, 0x4fff) AM_NOP
AM_RANGE(0x5000, 0x57ff) AM_MIRROR(0x0800) AM_ROM
AM_RANGE(0x6000, 0x67ff) AM_MIRROR(0x0800) AM_ROM
@@ -559,8 +553,8 @@ static ADDRESS_MAP_START( nyny_audio_2_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x007f) AM_RAM /* internal RAM */
AM_RANGE(0x0080, 0x0fff) AM_NOP
AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x0fff) AM_READ(soundlatch2_r)
- AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x0ffe) AM_READWRITE(ay8910_read_port_2_r, ay8910_write_port_2_w)
- AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x0ffe) AM_WRITE(ay8910_control_port_2_w)
+ AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x0ffe) AM_DEVREAD(SOUND, "ay3", ay8910_r)
+ AM_RANGE(0x2000, 0x2001) AM_MIRROR(0x0ffe) AM_DEVWRITE(SOUND, "ay3", ay8910_data_address_w)
AM_RANGE(0x3000, 0x6fff) AM_NOP
AM_RANGE(0x7000, 0x77ff) AM_MIRROR(0x0800) AM_ROM
ADDRESS_MAP_END
diff --git a/src/mame/drivers/ohmygod.c b/src/mame/drivers/ohmygod.c
index 5b4f737b7db..708d5ba3901 100644
--- a/src/mame/drivers/ohmygod.c
+++ b/src/mame/drivers/ohmygod.c
@@ -73,7 +73,7 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x800002, 0x800003) AM_READ_PORT("P2")
AM_RANGE(0xa00000, 0xa00001) AM_READ_PORT("DSW1")
AM_RANGE(0xa00002, 0xa00003) AM_READ_PORT("DSW2")
- AM_RANGE(0xb00000, 0xb00001) AM_READ(okim6295_status_0_lsb_r)
+ AM_RANGE(0xb00000, 0xb00001) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff)
AM_RANGE(0xc00000, 0xc00001) AM_READ(watchdog_reset16_r)
ADDRESS_MAP_END
@@ -89,7 +89,7 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x704000, 0x707fff) AM_WRITE(SMH_RAM)
AM_RANGE(0x708000, 0x70ffff) AM_WRITE(SMH_RAM) /* work RAM */
AM_RANGE(0x900000, 0x900001) AM_WRITE(ohmygod_ctrl_w)
- AM_RANGE(0xb00000, 0xb00001) AM_WRITE(okim6295_data_0_lsb_w)
+ AM_RANGE(0xb00000, 0xb00001) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff)
AM_RANGE(0xd00000, 0xd00001) AM_WRITE(ohmygod_spritebank_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/ojankohs.c b/src/mame/drivers/ojankohs.c
index c8f64dcaea4..813978fc5a1 100644
--- a/src/mame/drivers/ojankohs.c
+++ b/src/mame/drivers/ojankohs.c
@@ -88,15 +88,15 @@ static WRITE8_HANDLER( ojankoy_rombank_w )
ojankohs_adpcm_reset = ((data & 0x20) >> 5);
if (!ojankohs_adpcm_reset) ojankohs_vclk_left = 0;
- msm5205_reset_w(0, !ojankohs_adpcm_reset);
+ msm5205_reset_w(devtag_get_device(space->machine, SOUND, "msm"), !ojankohs_adpcm_reset);
}
-static WRITE8_HANDLER( ojankohs_adpcm_reset_w )
+static WRITE8_DEVICE_HANDLER( ojankohs_adpcm_reset_w )
{
ojankohs_adpcm_reset = (data & 0x01);
ojankohs_vclk_left = 0;
- msm5205_reset_w(0, !ojankohs_adpcm_reset);
+ msm5205_reset_w(device, !ojankohs_adpcm_reset);
}
static WRITE8_HANDLER( ojankohs_msm5205_w )
@@ -113,7 +113,7 @@ static void ojankohs_adpcm_int(const device_config *device)
/* clock the data through */
if (ojankohs_vclk_left) {
- msm5205_data_w(0, (ojankohs_adpcm_data >> 4));
+ msm5205_data_w(device, (ojankohs_adpcm_data >> 4));
ojankohs_adpcm_data <<= 4;
ojankohs_vclk_left--;
}
@@ -131,7 +131,7 @@ static WRITE8_HANDLER( ojankoc_ctrl_w )
memory_set_bankptr(space->machine, 1, &BANKROM[bank_address]);
ojankohs_adpcm_reset = ((data & 0x10) >> 4);
- msm5205_reset_w(0, (!(data & 0x10) >> 4));
+ msm5205_reset_w(devtag_get_device(space->machine, SOUND, "msm"), (!(data & 0x10) >> 4));
ojankoc_flipscreen(space, data);
}
@@ -184,32 +184,22 @@ static READ8_HANDLER( ojankoc_keymatrix_r )
return (ret & 0x3f) | (input_port_read(space->machine, offset ? "IN1" : "IN0") & 0xc0);
}
-static READ8_HANDLER( ojankohs_ay8910_0_r )
+static READ8_DEVICE_HANDLER( ojankohs_ay8910_0_r )
{
// DIPSW 1
- return (((input_port_read(space->machine, "DSW1") & 0x01) << 7) | ((input_port_read(space->machine, "DSW1") & 0x02) << 5) |
- ((input_port_read(space->machine, "DSW1") & 0x04) << 3) | ((input_port_read(space->machine, "DSW1") & 0x08) << 1) |
- ((input_port_read(space->machine, "DSW1") & 0x10) >> 1) | ((input_port_read(space->machine, "DSW1") & 0x20) >> 3) |
- ((input_port_read(space->machine, "DSW1") & 0x40) >> 5) | ((input_port_read(space->machine, "DSW1") & 0x80) >> 7));
+ return (((input_port_read(device->machine, "DSW1") & 0x01) << 7) | ((input_port_read(device->machine, "DSW1") & 0x02) << 5) |
+ ((input_port_read(device->machine, "DSW1") & 0x04) << 3) | ((input_port_read(device->machine, "DSW1") & 0x08) << 1) |
+ ((input_port_read(device->machine, "DSW1") & 0x10) >> 1) | ((input_port_read(device->machine, "DSW1") & 0x20) >> 3) |
+ ((input_port_read(device->machine, "DSW1") & 0x40) >> 5) | ((input_port_read(device->machine, "DSW1") & 0x80) >> 7));
}
-static READ8_HANDLER( ojankohs_ay8910_1_r )
+static READ8_DEVICE_HANDLER( ojankohs_ay8910_1_r )
{
// DIPSW 1
- return (((input_port_read(space->machine, "DSW2") & 0x01) << 7) | ((input_port_read(space->machine, "DSW2") & 0x02) << 5) |
- ((input_port_read(space->machine, "DSW2") & 0x04) << 3) | ((input_port_read(space->machine, "DSW2") & 0x08) << 1) |
- ((input_port_read(space->machine, "DSW2") & 0x10) >> 1) | ((input_port_read(space->machine, "DSW2") & 0x20) >> 3) |
- ((input_port_read(space->machine, "DSW2") & 0x40) >> 5) | ((input_port_read(space->machine, "DSW2") & 0x80) >> 7));
-}
-
-static READ8_HANDLER( ojankoy_ay8910_0_r )
-{
- return input_port_read(space->machine, "DSW1"); // DIPSW 1
-}
-
-static READ8_HANDLER( ojankoy_ay8910_1_r )
-{
- return input_port_read(space->machine, "DSW2"); // DIPSW 2
+ return (((input_port_read(device->machine, "DSW2") & 0x01) << 7) | ((input_port_read(device->machine, "DSW2") & 0x02) << 5) |
+ ((input_port_read(device->machine, "DSW2") & 0x04) << 3) | ((input_port_read(device->machine, "DSW2") & 0x08) << 1) |
+ ((input_port_read(device->machine, "DSW2") & 0x10) >> 1) | ((input_port_read(device->machine, "DSW2") & 0x20) >> 3) |
+ ((input_port_read(device->machine, "DSW2") & 0x40) >> 5) | ((input_port_read(device->machine, "DSW2") & 0x80) >> 7));
}
static READ8_HANDLER( ccasino_dipsw3_r )
@@ -285,11 +275,11 @@ static ADDRESS_MAP_START( ojankohs_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0") AM_WRITE(ojankohs_portselect_w)
AM_RANGE(0x01, 0x01) AM_READWRITE(ojankohs_keymatrix_r, ojankohs_rombank_w)
AM_RANGE(0x02, 0x02) AM_READ_PORT("IN1") AM_WRITE(ojankohs_gfxreg_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ojankohs_adpcm_reset_w)
+ AM_RANGE(0x03, 0x03) AM_DEVWRITE(SOUND, "msm", ojankohs_adpcm_reset_w)
AM_RANGE(0x04, 0x04) AM_WRITE(ojankohs_flipscreen_w)
AM_RANGE(0x05, 0x05) AM_WRITE(ojankohs_msm5205_w)
- AM_RANGE(0x06, 0x06) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x07, 0x07) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x06, 0x06) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x06, 0x07) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
AM_RANGE(0x10, 0x10) AM_WRITE(SMH_NOP) // unknown
AM_RANGE(0x11, 0x11) AM_WRITE(SMH_NOP) // unknown
ADDRESS_MAP_END
@@ -301,8 +291,8 @@ static ADDRESS_MAP_START( ojankoy_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x02, 0x02) AM_READ_PORT("IN1") AM_WRITE(ojankoy_coinctr_w)
AM_RANGE(0x04, 0x04) AM_WRITE(ojankohs_flipscreen_w)
AM_RANGE(0x05, 0x05) AM_WRITE(ojankohs_msm5205_w)
- AM_RANGE(0x06, 0x06) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x07, 0x07) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x06, 0x06) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x06, 0x07) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( ccasino_io_map, ADDRESS_SPACE_IO, 8 )
@@ -310,11 +300,11 @@ static ADDRESS_MAP_START( ccasino_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0") AM_WRITE(ojankohs_portselect_w)
AM_RANGE(0x01, 0x01) AM_READWRITE(ojankohs_keymatrix_r, ojankohs_rombank_w)
AM_RANGE(0x02, 0x02) AM_READ_PORT("IN1") AM_WRITE(ccasino_coinctr_w)
- AM_RANGE(0x03, 0x03) AM_READWRITE(ccasino_dipsw3_r, ojankohs_adpcm_reset_w)
+ AM_RANGE(0x03, 0x03) AM_READ(ccasino_dipsw3_r) AM_DEVWRITE(SOUND, "msm", ojankohs_adpcm_reset_w)
AM_RANGE(0x04, 0x04) AM_READWRITE(ccasino_dipsw4_r, ojankohs_flipscreen_w)
AM_RANGE(0x05, 0x05) AM_WRITE(ojankohs_msm5205_w)
- AM_RANGE(0x06, 0x06) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x07, 0x07) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x06, 0x06) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x06, 0x07) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
AM_RANGE(0x08, 0x0f) AM_WRITE(ccasino_palette_w) // 16bit address access
AM_RANGE(0x10, 0x10) AM_WRITE(SMH_NOP)
AM_RANGE(0x11, 0x11) AM_WRITE(SMH_NOP)
@@ -327,8 +317,8 @@ static ADDRESS_MAP_START( ojankoc_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0xfb, 0xfb) AM_WRITE(ojankoc_ctrl_w)
AM_RANGE(0xfc, 0xfd) AM_READ(ojankoc_keymatrix_r)
AM_RANGE(0xfd, 0xfd) AM_WRITE(ojankohs_portselect_w)
- AM_RANGE(0xfe, 0xfe) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xff, 0xff) AM_READWRITE(ay8910_read_port_0_r, ay8910_control_port_0_w)
+ AM_RANGE(0xfe, 0xff) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
+ AM_RANGE(0xff, 0xff) AM_DEVREAD(SOUND, "ay", ay8910_r)
ADDRESS_MAP_END
@@ -822,24 +812,24 @@ static const ay8910_interface ojankohs_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- ojankohs_ay8910_0_r, /* read port #0 */
- ojankohs_ay8910_1_r /* read port #1 */
+ DEVCB_HANDLER(ojankohs_ay8910_0_r), /* read port #0 */
+ DEVCB_HANDLER(ojankohs_ay8910_1_r) /* read port #1 */
};
static const ay8910_interface ojankoy_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- ojankoy_ay8910_0_r, /* read port #0 */
- ojankoy_ay8910_1_r, /* read port #1 */
+ DEVCB_INPUT_PORT("DSW1"), /* read port #0 */
+ DEVCB_INPUT_PORT("DSW2"), /* read port #1 */
};
static const ay8910_interface ojankoc_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r, /* read port #0 */
- input_port_1_r /* read port #1 */
+ DEVCB_INPUT_PORT("DSW1"), /* read port #0 */
+ DEVCB_INPUT_PORT("DSW2"), /* read port #1 */
};
static const msm5205_interface msm5205_config =
diff --git a/src/mame/drivers/olibochu.c b/src/mame/drivers/olibochu.c
index 2fe6fb5e6ef..428dba9e8de 100644
--- a/src/mame/drivers/olibochu.c
+++ b/src/mame/drivers/olibochu.c
@@ -204,14 +204,13 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_READ(SMH_ROM)
AM_RANGE(0x6000, 0x63ff) AM_READ(SMH_RAM)
- AM_RANGE(0x7000, 0x7000) AM_READ(soundlatch_r)
+ AM_RANGE(0x7000, 0x7000) AM_READ(soundlatch_r) /* likely ay8910 input port, not direct */
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x6000, 0x63ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x7000, 0x7000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x7001, 0x7001) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x7000, 0x7001) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/omegrace.c b/src/mame/drivers/omegrace.c
index 1714d2ada07..11ec6f102a8 100644
--- a/src/mame/drivers/omegrace.c
+++ b/src/mame/drivers/omegrace.c
@@ -368,10 +368,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_port, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(soundlatch_r, ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x02, 0x02) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r) /* likely ay8910 input port, not direct */
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x02, 0x03) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/oneshot.c b/src/mame/drivers/oneshot.c
index b6703443adc..19528bd4a56 100644
--- a/src/mame/drivers/oneshot.c
+++ b/src/mame/drivers/oneshot.c
@@ -97,11 +97,11 @@ static READ16_HANDLER( oneshot_gun_y_p2_r )
return gun_y_p2;
}
-static WRITE16_HANDLER( soundbank_w )
+static WRITE16_DEVICE_HANDLER( soundbank_w )
{
if (ACCESSING_BITS_0_7)
{
- okim6295_set_bank_base(0, 0x40000 * ((data & 0x03) ^ 0x03));
+ okim6295_set_bank_base(device, 0x40000 * ((data & 0x03) ^ 0x03));
}
}
@@ -135,24 +135,23 @@ static ADDRESS_MAP_START( oneshot_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x182000, 0x182fff) AM_WRITE(oneshot_bg_videoram_w) AM_BASE(&oneshot_bg_videoram) // credits etc.
AM_RANGE(0x188000, 0x18800f) AM_WRITE(SMH_RAM) AM_BASE(&oneshot_scroll) // scroll registers???
AM_RANGE(0x190010, 0x190011) AM_WRITE(soundlatch_word_w)
- AM_RANGE(0x190018, 0x190019) AM_WRITE(soundbank_w)
+ AM_RANGE(0x190018, 0x190019) AM_DEVWRITE(SOUND, "oki", soundbank_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( snd_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x8000) AM_READ(soundlatch_r)
AM_RANGE(0x8001, 0x87ff) AM_READ(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_READ(ym3812_status_port_0_r)
- AM_RANGE(0xe010, 0xe010) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0xe000, 0xe001) AM_DEVREAD(SOUND, "ym", ym3812_r)
+ AM_RANGE(0xe010, 0xe010) AM_DEVREAD(SOUND, "oki", okim6295_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( snd_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x8000) AM_WRITE(soundlatch_w)
AM_RANGE(0x8001, 0x87ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ym3812_write_port_0_w)
- AM_RANGE(0xe010, 0xe010) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0xe000, 0xe001) AM_DEVWRITE(SOUND, "ym", ym3812_w)
+ AM_RANGE(0xe010, 0xe010) AM_DEVWRITE(SOUND, "oki", okim6295_w)
ADDRESS_MAP_END
static INPUT_PORTS_START( oneshot )
@@ -351,9 +350,9 @@ static GFXDECODE_START( oneshot )
GFXDECODE_ENTRY( "gfx1", 0, oneshot8x8_layout, 0x00, 4 ) /* sprites */
GFXDECODE_END
-static void irq_handler(running_machine *machine, int irq)
+static void irq_handler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym3812_interface ym3812_config =
diff --git a/src/mame/drivers/onetwo.c b/src/mame/drivers/onetwo.c
index 6f3476b0e63..715b206cc27 100644
--- a/src/mame/drivers/onetwo.c
+++ b/src/mame/drivers/onetwo.c
@@ -134,9 +134,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_cpu_io, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0x20, 0x20) AM_WRITE(ym3812_write_port_0_w)
- AM_RANGE(0x40, 0x40) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x00, 0x00) AM_DEVREADWRITE(SOUND, "ym", ym3812_status_port_r, ym3812_control_port_w)
+ AM_RANGE(0x20, 0x20) AM_DEVWRITE(SOUND, "ym", ym3812_write_port_w)
+ AM_RANGE(0x40, 0x40) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0xc0, 0xc0) AM_WRITE(soundlatch_clear_w)
ADDRESS_MAP_END
@@ -264,9 +264,9 @@ static VIDEO_UPDATE( onetwo )
return 0;
}
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1],0,linestate);
+ cpu_set_input_line(device->machine->cpu[1],0,linestate);
}
static const ym3812_interface ym3812_config =
diff --git a/src/mame/drivers/opwolf.c b/src/mame/drivers/opwolf.c
index 22ba255c035..9669cb53be7 100644
--- a/src/mame/drivers/opwolf.c
+++ b/src/mame/drivers/opwolf.c
@@ -191,9 +191,9 @@ static READ8_HANDLER( z80_input2_r )
SOUND
******************************************************/
-static WRITE8_HANDLER( sound_bankswitch_w )
+static WRITE8_DEVICE_HANDLER( sound_bankswitch_w )
{
- memory_set_bank(space->machine, 10, (data-1) & 0x03);
+ memory_set_bank(device->machine, 10, (data-1) & 0x03);
}
/***********************************************************
@@ -290,7 +290,7 @@ static ADDRESS_MAP_START( z80_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM)
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK10)
AM_RANGE(0x8000, 0x8fff) AM_READ(SMH_RAM)
- AM_RANGE(0x9001, 0x9001) AM_READ(ym2151_status_port_0_r)
+ AM_RANGE(0x9000, 0x9001) AM_DEVREAD(SOUND, "ym", ym2151_r)
AM_RANGE(0x9002, 0x9100) AM_READ(SMH_RAM)
AM_RANGE(0xa001, 0xa001) AM_READ(taitosound_slave_comm_r)
ADDRESS_MAP_END
@@ -322,8 +322,8 @@ static MACHINE_RESET( opwolf )
adpcm_end[0] = adpcm_end[1] = 0;
adpcm_data[0] = adpcm_data[1] = -1;
- msm5205_reset_w(0, 1);
- msm5205_reset_w(1, 1);
+ msm5205_reset_w(devtag_get_device(machine, SOUND, "msm1"), 1);
+ msm5205_reset_w(devtag_get_device(machine, SOUND, "msm2"), 1);
}
static void opwolf_msm5205_vck(const device_config *device)
@@ -331,20 +331,20 @@ static void opwolf_msm5205_vck(const device_config *device)
int chip = (strcmp(device->tag, "msm1") == 0) ? 0 : 1;
if (adpcm_data[chip] != -1)
{
- msm5205_data_w(chip, adpcm_data[chip] & 0x0f);
+ msm5205_data_w(device, adpcm_data[chip] & 0x0f);
adpcm_data[chip] = -1;
if (adpcm_pos[chip] == adpcm_end[chip])
- msm5205_reset_w(chip, 1);
+ msm5205_reset_w(device, 1);
}
else
{
adpcm_data[chip] = memory_region(device->machine, "adpcm")[adpcm_pos[chip]];
adpcm_pos[chip] = (adpcm_pos[chip] + 1) & 0x7ffff;
- msm5205_data_w(chip, adpcm_data[chip] >> 4);
+ msm5205_data_w(device, adpcm_data[chip] >> 4);
}
}
-static WRITE8_HANDLER( opwolf_adpcm_b_w )
+static WRITE8_DEVICE_HANDLER( opwolf_adpcm_b_w )
{
int start;
int end;
@@ -359,14 +359,14 @@ static WRITE8_HANDLER( opwolf_adpcm_b_w )
end *=16;
adpcm_pos[0] = start;
adpcm_end[0] = end;
- msm5205_reset_w(0, 0);
+ msm5205_reset_w(device, 0);
}
// logerror("CPU #1 b00%i-data=%2x pc=%4x\n",offset,data,cpu_get_pc(space->cpu) );
}
-static WRITE8_HANDLER( opwolf_adpcm_c_w )
+static WRITE8_DEVICE_HANDLER( opwolf_adpcm_c_w )
{
int start;
int end;
@@ -381,7 +381,7 @@ static WRITE8_HANDLER( opwolf_adpcm_c_w )
end *=16;
adpcm_pos[1] = start;
adpcm_end[1] = end;
- msm5205_reset_w(1, 0);
+ msm5205_reset_w(device, 0);
}
// logerror("CPU #1 c00%i-data=%2x pc=%4x\n",offset,data,cpu_get_pc(space->cpu) );
@@ -402,12 +402,11 @@ static WRITE8_HANDLER( opwolf_adpcm_e_w )
static ADDRESS_MAP_START( z80_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x8fff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x9000, 0x9000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x9001, 0x9001) AM_WRITE(ym2151_data_port_0_w)
+ AM_RANGE(0x9000, 0x9001) AM_DEVWRITE(SOUND, "ym", ym2151_w)
AM_RANGE(0xa000, 0xa000) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xa001, 0xa001) AM_WRITE(taitosound_slave_comm_w)
- AM_RANGE(0xb000, 0xb006) AM_WRITE(opwolf_adpcm_b_w)
- AM_RANGE(0xc000, 0xc006) AM_WRITE(opwolf_adpcm_c_w)
+ AM_RANGE(0xb000, 0xb006) AM_DEVWRITE(SOUND, "msm1", opwolf_adpcm_b_w)
+ AM_RANGE(0xc000, 0xc006) AM_DEVWRITE(SOUND, "msm2", opwolf_adpcm_c_w)
AM_RANGE(0xd000, 0xd000) AM_WRITE(opwolf_adpcm_d_w)
AM_RANGE(0xe000, 0xe000) AM_WRITE(opwolf_adpcm_e_w)
ADDRESS_MAP_END
@@ -551,9 +550,9 @@ GFXDECODE_END
/* handler called by the YM2151 emulator when the internal timers cause an IRQ */
-static void irq_handler(running_machine *machine, int irq)
+static void irq_handler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
diff --git a/src/mame/drivers/orbit.c b/src/mame/drivers/orbit.c
index 06ef9cadf61..15c93b2cd40 100644
--- a/src/mame/drivers/orbit.c
+++ b/src/mame/drivers/orbit.c
@@ -66,7 +66,7 @@ static INTERRUPT_GEN( orbit_interrupt )
static void update_misc_flags(running_machine *machine, UINT8 val)
{
- const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const device_config *discrete = devtag_get_device(machine, SOUND, "discrete");
orbit_misc_flags = val;
@@ -79,7 +79,7 @@ static void update_misc_flags(running_machine *machine, UINT8 val)
/* BIT6 => HYPER LED */
/* BIT7 => WARNING SND */
- discrete_sound_w(space, ORBIT_WARNING_EN, orbit_misc_flags & 0x80);
+ discrete_sound_w(discrete, ORBIT_WARNING_EN, orbit_misc_flags & 0x80);
set_led_status(0, orbit_misc_flags & 0x08);
set_led_status(1, orbit_misc_flags & 0x40);
@@ -130,11 +130,11 @@ static ADDRESS_MAP_START( orbit_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x2800, 0x2800) AM_MIRROR(0x07ff) AM_READ_PORT("BUTTONS")
AM_RANGE(0x3000, 0x33bf) AM_MIRROR(0x0400) AM_RAM_WRITE(orbit_playfield_w) AM_BASE(&orbit_playfield_ram)
AM_RANGE(0x33c0, 0x33ff) AM_MIRROR(0x0400) AM_RAM AM_BASE(&orbit_sprite_ram)
- AM_RANGE(0x3800, 0x3800) AM_MIRROR(0x00ff) AM_WRITE(orbit_note_w)
- AM_RANGE(0x3900, 0x3900) AM_MIRROR(0x00ff) AM_WRITE(orbit_noise_amp_w)
- AM_RANGE(0x3a00, 0x3a00) AM_MIRROR(0x00ff) AM_WRITE(orbit_note_amp_w)
+ AM_RANGE(0x3800, 0x3800) AM_MIRROR(0x00ff) AM_DEVWRITE(SOUND, "discrete", orbit_note_w)
+ AM_RANGE(0x3900, 0x3900) AM_MIRROR(0x00ff) AM_DEVWRITE(SOUND, "discrete", orbit_noise_amp_w)
+ AM_RANGE(0x3a00, 0x3a00) AM_MIRROR(0x00ff) AM_DEVWRITE(SOUND, "discrete", orbit_note_amp_w)
AM_RANGE(0x3c00, 0x3c0f) AM_MIRROR(0x00f0) AM_WRITE(orbit_misc_w)
- AM_RANGE(0x3e00, 0x3e00) AM_MIRROR(0x00ff) AM_WRITE(orbit_noise_rst_w)
+ AM_RANGE(0x3e00, 0x3e00) AM_MIRROR(0x00ff) AM_DEVWRITE(SOUND, "discrete", orbit_noise_rst_w)
AM_RANGE(0x3f00, 0x3f00) AM_MIRROR(0x00ff) AM_WRITE(watchdog_reset_w)
AM_RANGE(0x6000, 0x7fff) AM_ROM
ADDRESS_MAP_END
diff --git a/src/mame/drivers/othldrby.c b/src/mame/drivers/othldrby.c
index 9f8b99e0774..5cadaa95423 100644
--- a/src/mame/drivers/othldrby.c
+++ b/src/mame/drivers/othldrby.c
@@ -43,10 +43,10 @@ static READ16_HANDLER( pap )
}
-static WRITE16_HANDLER( oki_bankswitch_w )
+static WRITE16_DEVICE_HANDLER( oki_bankswitch_w )
{
if (ACCESSING_BITS_0_7)
- okim6295_set_bank_base(0, (data & 1) * 0x40000);
+ okim6295_set_bank_base(device, (data & 1) * 0x40000);
}
static WRITE16_HANDLER( coinctrl_w )
@@ -101,7 +101,7 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x300004, 0x300007) AM_READ(othldrby_videoram_r)
AM_RANGE(0x30000c, 0x30000d) AM_READ(pip) // vblank?
AM_RANGE(0x400000, 0x400fff) AM_READ(SMH_RAM)
- AM_RANGE(0x600000, 0x600001) AM_READ(okim6295_status_0_lsb_r)
+ AM_RANGE(0x600000, 0x600001) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff)
AM_RANGE(0x700000, 0x700001) AM_READ(pap) // scanline???
AM_RANGE(0x700004, 0x700005) AM_READ_PORT("DSW1")
AM_RANGE(0x700008, 0x700009) AM_READ_PORT("DSW2")
@@ -119,8 +119,8 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x300008, 0x300009) AM_WRITE(othldrby_vreg_addr_w)
AM_RANGE(0x30000c, 0x30000f) AM_WRITE(othldrby_vreg_w)
AM_RANGE(0x400000, 0x400fff) AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)
- AM_RANGE(0x600000, 0x600001) AM_WRITE(okim6295_data_0_lsb_w)
- AM_RANGE(0x700030, 0x700031) AM_WRITE(oki_bankswitch_w)
+ AM_RANGE(0x600000, 0x600001) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff)
+ AM_RANGE(0x700030, 0x700031) AM_DEVWRITE(SOUND, "oki", oki_bankswitch_w)
AM_RANGE(0x700034, 0x700035) AM_WRITE(coinctrl_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/othunder.c b/src/mame/drivers/othunder.c
index 3c150dca032..f013ee567a9 100644
--- a/src/mame/drivers/othunder.c
+++ b/src/mame/drivers/othunder.c
@@ -475,20 +475,20 @@ static WRITE8_HANDLER( othunder_TC0310FAM_w )
because we are using the AY-3-8910 emulation. */
volr = (pan[0] + pan[2]) * 100 / (2 * 0x1f);
voll = (pan[1] + pan[3]) * 100 / (2 * 0x1f);
- flt_volume_set_volume(0, voll / 100.0);
- flt_volume_set_volume(1, volr / 100.0);
+ flt_volume_set_volume(devtag_get_device(space->machine, SOUND, "2610.0l"), voll / 100.0);
+ flt_volume_set_volume(devtag_get_device(space->machine, SOUND, "2610.0r"), volr / 100.0);
/* CH1 */
volr = pan[0] * 100 / 0x1f;
voll = pan[1] * 100 / 0x1f;
- flt_volume_set_volume(2, voll / 100.0);
- flt_volume_set_volume(3, volr / 100.0);
+ flt_volume_set_volume(devtag_get_device(space->machine, SOUND, "2610.1l"), voll / 100.0);
+ flt_volume_set_volume(devtag_get_device(space->machine, SOUND, "2610.1r"), volr / 100.0);
/* CH2 */
volr = pan[2] * 100 / 0x1f;
voll = pan[3] * 100 / 0x1f;
- flt_volume_set_volume(4, voll / 100.0);
- flt_volume_set_volume(5, volr / 100.0);
+ flt_volume_set_volume(devtag_get_device(space->machine, SOUND, "2610.2l"), voll / 100.0);
+ flt_volume_set_volume(devtag_get_device(space->machine, SOUND, "2610.2r"), volr / 100.0);
}
@@ -518,10 +518,7 @@ static ADDRESS_MAP_START( z80_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM
AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(10)
AM_RANGE(0xc000, 0xdfff) AM_RAM
- AM_RANGE(0xe000, 0xe000) AM_READWRITE(ym2610_status_port_0_a_r, ym2610_control_port_0_a_w)
- AM_RANGE(0xe001, 0xe001) AM_READWRITE(ym2610_read_port_0_r, ym2610_data_port_0_a_w)
- AM_RANGE(0xe002, 0xe002) AM_READWRITE(ym2610_status_port_0_b_r, ym2610_control_port_0_b_w)
- AM_RANGE(0xe003, 0xe003) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0xe000, 0xe003) AM_DEVREADWRITE(SOUND, "ym", ym2610_r, ym2610_w)
AM_RANGE(0xe200, 0xe200) AM_READWRITE(SMH_NOP, taitosound_slave_port_w)
AM_RANGE(0xe201, 0xe201) AM_READWRITE(taitosound_slave_comm_r, taitosound_slave_comm_w)
AM_RANGE(0xe400, 0xe403) AM_WRITE(othunder_TC0310FAM_w) /* pan */
@@ -674,9 +671,9 @@ GFXDECODE_END
**************************************************************/
/* handler called by the YM2610 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface ym2610_config =
diff --git a/src/mame/drivers/overdriv.c b/src/mame/drivers/overdriv.c
index 32b97ffbf25..41a48296cea 100644
--- a/src/mame/drivers/overdriv.c
+++ b/src/mame/drivers/overdriv.c
@@ -215,14 +215,9 @@ static WRITE16_HANDLER( sharedram_w )
-static READ16_HANDLER( overdriv_sound_0_r )
+static READ8_DEVICE_HANDLER( overdriv_sound_r )
{
- return k053260_0_r(space,2 + offset);
-}
-
-static READ16_HANDLER( overdriv_sound_1_r )
-{
- return k053260_1_r(space,2 + offset);
+ return k053260_r(device,2 + offset);
}
static WRITE16_HANDLER( overdriv_soundirq_w )
@@ -250,8 +245,8 @@ static ADDRESS_MAP_START( overdriv_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x0c0000, 0x0c0001) AM_READ_PORT("INPUTS")
AM_RANGE(0x0c0002, 0x0c0003) AM_READ_PORT("SYSTEM")
AM_RANGE(0x180000, 0x180001) AM_READ_PORT("PADDLE")
- AM_RANGE(0x1d8000, 0x1d8003) AM_READ(overdriv_sound_0_r) /* K053260 */
- AM_RANGE(0x1e0000, 0x1e0003) AM_READ(overdriv_sound_1_r) /* K053260 */
+ AM_RANGE(0x1d8000, 0x1d8003) AM_DEVREAD8(SOUND, "konami1", overdriv_sound_r, 0x00ff) /* K053260 */
+ AM_RANGE(0x1e0000, 0x1e0003) AM_DEVREAD8(SOUND, "konami2", overdriv_sound_r, 0x00ff) /* K053260 */
AM_RANGE(0x200000, 0x203fff) AM_READ(sharedram_r)
AM_RANGE(0x210000, 0x210fff) AM_READ(K051316_0_msb_r)
AM_RANGE(0x218000, 0x218fff) AM_READ(K051316_1_msb_r)
@@ -269,8 +264,8 @@ static ADDRESS_MAP_START( overdriv_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x1c0000, 0x1c001f) AM_WRITE(K051316_ctrl_0_msb_w)
AM_RANGE(0x1c8000, 0x1c801f) AM_WRITE(K051316_ctrl_1_msb_w)
AM_RANGE(0x1d0000, 0x1d001f) AM_WRITE(K053251_msb_w)
- AM_RANGE(0x1d8000, 0x1d8003) AM_WRITE(k053260_0_lsb_w)
- AM_RANGE(0x1e0000, 0x1e0003) AM_WRITE(k053260_1_lsb_w)
+ AM_RANGE(0x1d8000, 0x1d8003) AM_DEVWRITE8(SOUND, "konami1", k053260_w, 0x00ff)
+ AM_RANGE(0x1e0000, 0x1e0003) AM_DEVWRITE8(SOUND, "konami2", k053260_w, 0x00ff)
AM_RANGE(0x1e8000, 0x1e8001) AM_WRITE(overdriv_soundirq_w)
AM_RANGE(0x1f0000, 0x1f0001) AM_WRITE(cpuA_ctrl_w) /* halt cpu B, coin counter, start lamp, other? */
AM_RANGE(0x1f8000, 0x1f8001) AM_WRITE(eeprom_w)
@@ -313,18 +308,17 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( overdriv_s_readmem, ADDRESS_SPACE_PROGRAM, 8 )
- AM_RANGE(0x0201, 0x0201) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0x0400, 0x042f) AM_READ(k053260_0_r)
- AM_RANGE(0x0600, 0x062f) AM_READ(k053260_1_r)
+ AM_RANGE(0x0200, 0x0201) AM_DEVREAD(SOUND, "ym", ym2151_r)
+ AM_RANGE(0x0400, 0x042f) AM_DEVREAD(SOUND, "konami1", k053260_r)
+ AM_RANGE(0x0600, 0x062f) AM_DEVREAD(SOUND, "konami2", k053260_r)
AM_RANGE(0x0800, 0x0fff) AM_READ(SMH_RAM)
AM_RANGE(0x1000, 0xffff) AM_READ(SMH_ROM)
ADDRESS_MAP_END
static ADDRESS_MAP_START( overdriv_s_writemem, ADDRESS_SPACE_PROGRAM, 8 )
- AM_RANGE(0x0200, 0x0200) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x0201, 0x0201) AM_WRITE(ym2151_data_port_0_w)
- AM_RANGE(0x0400, 0x042f) AM_WRITE(k053260_0_w)
- AM_RANGE(0x0600, 0x062f) AM_WRITE(k053260_1_w)
+ AM_RANGE(0x0200, 0x0201) AM_DEVWRITE(SOUND, "ym", ym2151_w)
+ AM_RANGE(0x0400, 0x042f) AM_DEVWRITE(SOUND, "konami1", k053260_w)
+ AM_RANGE(0x0600, 0x062f) AM_DEVWRITE(SOUND, "konami2", k053260_w)
AM_RANGE(0x0800, 0x0fff) AM_WRITE(SMH_RAM)
AM_RANGE(0x1000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/pacland.c b/src/mame/drivers/pacland.c
index 0806d577a1f..67f67043303 100644
--- a/src/mame/drivers/pacland.c
+++ b/src/mame/drivers/pacland.c
@@ -256,7 +256,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x3a00, 0x3a01) AM_WRITE(pacland_scroll1_w)
AM_RANGE(0x3c00, 0x3c00) AM_WRITE(pacland_bankswitch_w)
AM_RANGE(0x4000, 0x5fff) AM_READ(SMH_BANK1)
- AM_RANGE(0x6800, 0x6bff) AM_READWRITE(namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */
+ AM_RANGE(0x6800, 0x6bff) AM_DEVREADWRITE(SOUND, "namco", namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */
AM_RANGE(0x7000, 0x7fff) AM_WRITE(pacland_irq_1_ctrl_w)
AM_RANGE(0x7800, 0x7fff) AM_READ(watchdog_reset_r)
AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM)
@@ -267,7 +267,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( mcu_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x001f) AM_READWRITE(hd63701_internal_registers_r, hd63701_internal_registers_w)
AM_RANGE(0x0080, 0x00ff) AM_RAM
- AM_RANGE(0x1000, 0x13ff) AM_READWRITE(namcos1_cus30_r, namcos1_cus30_w) AM_BASE(&namco_wavedata) /* PSG device, shared RAM */
+ AM_RANGE(0x1000, 0x13ff) AM_DEVREADWRITE(SOUND, "namco", namcos1_cus30_r, namcos1_cus30_w) AM_BASE(&namco_wavedata) /* PSG device, shared RAM */
AM_RANGE(0x2000, 0x3fff) AM_WRITE(watchdog_reset_w) /* watchdog? */
AM_RANGE(0x4000, 0x7fff) AM_WRITE(pacland_irq_2_ctrl_w)
AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_ROM)
diff --git a/src/mame/drivers/pacman.c b/src/mame/drivers/pacman.c
index 380669810f4..6acf7726306 100644
--- a/src/mame/drivers/pacman.c
+++ b/src/mame/drivers/pacman.c
@@ -528,11 +528,11 @@ static WRITE8_HANDLER( alibaba_sound_w )
/* since the sound region in Ali Baba is not contiguous, translate the
offset into the 0-0x1f range */
if (offset < 0x10)
- pacman_sound_w(space, offset, data);
+ pacman_sound_w(devtag_get_device(space->machine, SOUND, "namco"), offset, data);
else if (offset < 0x20)
spriteram_2[offset - 0x10] = data;
else
- pacman_sound_w(space, offset - 0x10, data);
+ pacman_sound_w(devtag_get_device(space->machine, SOUND, "namco"), offset - 0x10, data);
}
@@ -897,13 +897,13 @@ static ADDRESS_MAP_START( pacman_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4c00, 0x4fef) AM_MIRROR(0xa000) AM_RAM
AM_RANGE(0x4ff0, 0x4fff) AM_MIRROR(0xa000) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0x5000, 0x5000) AM_MIRROR(0xaf38) AM_WRITE(interrupt_enable_w)
- AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_WRITE(pacman_sound_enable_w)
+ AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE(SOUND, "namco", pacman_sound_enable_w)
AM_RANGE(0x5002, 0x5002) AM_MIRROR(0xaf38) AM_WRITE(SMH_NOP)
AM_RANGE(0x5003, 0x5003) AM_MIRROR(0xaf38) AM_WRITE(pacman_flipscreen_w)
AM_RANGE(0x5004, 0x5005) AM_MIRROR(0xaf38) AM_WRITE(SMH_NOP) // AM_WRITE(pacman_leds_w)
AM_RANGE(0x5006, 0x5006) AM_MIRROR(0xaf38) AM_WRITE(SMH_NOP) // AM_WRITE(pacman_coin_lockout_global_w)
AM_RANGE(0x5007, 0x5007) AM_MIRROR(0xaf38) AM_WRITE(pacman_coin_counter_w)
- AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_WRITE(pacman_sound_w) AM_BASE(&pacman_soundregs)
+ AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_DEVWRITE(SOUND, "namco", pacman_sound_w) AM_BASE(&pacman_soundregs)
AM_RANGE(0x5060, 0x506f) AM_MIRROR(0xaf00) AM_WRITE(SMH_RAM) AM_BASE(&spriteram_2)
AM_RANGE(0x5070, 0x507f) AM_MIRROR(0xaf00) AM_WRITE(SMH_NOP)
AM_RANGE(0x5080, 0x5080) AM_MIRROR(0xaf3f) AM_WRITE(SMH_NOP)
@@ -924,13 +924,13 @@ static ADDRESS_MAP_START( mspacman_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4c00, 0x4fef) AM_MIRROR(0xa000) AM_RAM
AM_RANGE(0x4ff0, 0x4fff) AM_MIRROR(0xa000) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0x5000, 0x5000) AM_MIRROR(0xaf38) AM_WRITE(interrupt_enable_w)
- AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_WRITE(pacman_sound_enable_w)
+ AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE(SOUND, "namco", pacman_sound_enable_w)
AM_RANGE(0x5002, 0x5002) AM_MIRROR(0xaf38) AM_WRITE(SMH_NOP)
AM_RANGE(0x5003, 0x5003) AM_MIRROR(0xaf38) AM_WRITE(pacman_flipscreen_w)
AM_RANGE(0x5004, 0x5005) AM_MIRROR(0xaf38) AM_WRITE(SMH_NOP) // AM_WRITE(pacman_leds_w)
AM_RANGE(0x5006, 0x5006) AM_MIRROR(0xaf38) AM_WRITE(pacman_coin_lockout_global_w)
AM_RANGE(0x5007, 0x5007) AM_MIRROR(0xaf38) AM_WRITE(pacman_coin_counter_w)
- AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_WRITE(pacman_sound_w) AM_BASE(&pacman_soundregs)
+ AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_DEVWRITE(SOUND, "namco", pacman_sound_w) AM_BASE(&pacman_soundregs)
AM_RANGE(0x5060, 0x506f) AM_MIRROR(0xaf00) AM_WRITE(SMH_RAM) AM_BASE(&spriteram_2)
AM_RANGE(0x5070, 0x507f) AM_MIRROR(0xaf00) AM_WRITE(SMH_NOP)
AM_RANGE(0x5080, 0x5080) AM_MIRROR(0xaf3f) AM_WRITE(SMH_NOP)
@@ -964,13 +964,13 @@ static ADDRESS_MAP_START( woodpek_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4c00, 0x4fef) AM_MIRROR(0xa000) AM_RAM
AM_RANGE(0x4ff0, 0x4fff) AM_MIRROR(0xa000) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0x5000, 0x5000) AM_MIRROR(0xaf38) AM_WRITE(interrupt_enable_w)
- AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_WRITE(pacman_sound_enable_w)
+ AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE(SOUND, "namco", pacman_sound_enable_w)
AM_RANGE(0x5002, 0x5002) AM_MIRROR(0xaf38) AM_WRITE(SMH_NOP)
AM_RANGE(0x5003, 0x5003) AM_MIRROR(0xaf38) AM_WRITE(pacman_flipscreen_w)
AM_RANGE(0x5004, 0x5005) AM_MIRROR(0xaf38) AM_WRITE(SMH_NOP) // AM_WRITE(pacman_leds_w)
AM_RANGE(0x5006, 0x5006) AM_MIRROR(0xaf38) AM_WRITE(SMH_NOP) // AM_WRITE(pacman_coin_lockout_global_w)
AM_RANGE(0x5007, 0x5007) AM_MIRROR(0xaf38) AM_WRITE(pacman_coin_counter_w)
- AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_WRITE(pacman_sound_w) AM_BASE(&pacman_soundregs)
+ AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_DEVWRITE(SOUND, "namco", pacman_sound_w) AM_BASE(&pacman_soundregs)
AM_RANGE(0x5060, 0x506f) AM_MIRROR(0xaf00) AM_WRITE(SMH_RAM) AM_BASE(&spriteram_2)
AM_RANGE(0x5070, 0x507f) AM_MIRROR(0xaf00) AM_WRITE(SMH_NOP)
AM_RANGE(0x5080, 0x5080) AM_MIRROR(0xaf3f) AM_WRITE(SMH_NOP)
@@ -999,7 +999,7 @@ static ADDRESS_MAP_START( alibaba_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x5060, 0x506f) AM_MIRROR(0xaf00) AM_WRITE(SMH_RAM) AM_BASE(&spriteram_2) /* actually at 5050-505f, here to point to free RAM */
AM_RANGE(0x5070, 0x507f) AM_MIRROR(0xaf00) AM_WRITE(SMH_NOP)
AM_RANGE(0x5080, 0x5080) AM_MIRROR(0xaf3f) AM_WRITE(SMH_NOP)
- AM_RANGE(0x50c0, 0x50c0) AM_MIRROR(0xaf00) AM_WRITE(pacman_sound_enable_w)
+ AM_RANGE(0x50c0, 0x50c0) AM_MIRROR(0xaf00) AM_DEVWRITE(SOUND, "namco", pacman_sound_enable_w)
AM_RANGE(0x50c1, 0x50c1) AM_MIRROR(0xaf00) AM_WRITE(pacman_flipscreen_w)
AM_RANGE(0x50c2, 0x50c2) AM_MIRROR(0xaf00) AM_WRITE(interrupt_enable_w)
AM_RANGE(0x50c3, 0x50ff) AM_MIRROR(0xaf00) AM_WRITE(SMH_NOP)
@@ -1022,13 +1022,13 @@ static ADDRESS_MAP_START( dremshpr_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4800, 0x4fef) AM_MIRROR(0xa000) AM_RAM
AM_RANGE(0x4ff0, 0x4fff) AM_MIRROR(0xa000) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0x5000, 0x5000) AM_MIRROR(0xaf38) AM_WRITE(interrupt_enable_w)
-// AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_WRITE(pacman_sound_enable_w)
+// AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE(SOUND, "namco", pacman_sound_enable_w)
AM_RANGE(0x5002, 0x5002) AM_MIRROR(0xaf38) AM_WRITE(SMH_NOP) /* unknown */
AM_RANGE(0x5003, 0x5003) AM_MIRROR(0xaf38) AM_WRITE(pacman_flipscreen_w)
AM_RANGE(0x5004, 0x5005) AM_MIRROR(0xaf38) AM_WRITE(SMH_NOP) // AM_WRITE(pacman_leds_w)
AM_RANGE(0x5006, 0x5006) AM_MIRROR(0xaf38) AM_WRITE(SMH_NOP) // AM_WRITE(pacman_coin_lockout_global_w)
AM_RANGE(0x5007, 0x5007) AM_MIRROR(0xaf38) AM_WRITE(pacman_coin_counter_w)
-// AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_WRITE(pacman_sound_w) AM_BASE(&pacman_soundregs)
+// AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_DEVWRITE(SOUND, "namco", pacman_sound_w) AM_BASE(&pacman_soundregs)
AM_RANGE(0x5060, 0x506f) AM_MIRROR(0xaf00) AM_WRITE(SMH_RAM) AM_BASE(&spriteram_2)
AM_RANGE(0x5070, 0x507f) AM_MIRROR(0xaf00) AM_WRITE(SMH_NOP)
AM_RANGE(0x5080, 0x5080) AM_MIRROR(0xaf3f) AM_WRITE(SMH_NOP)
@@ -1049,13 +1049,13 @@ static ADDRESS_MAP_START( epos_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4c00, 0x4fef) AM_MIRROR(0xa000) AM_RAM
AM_RANGE(0x4ff0, 0x4fff) AM_MIRROR(0xa000) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0x5000, 0x5000) AM_MIRROR(0xaf38) AM_WRITE(interrupt_enable_w)
- AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_WRITE(pacman_sound_enable_w)
+ AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE(SOUND, "namco", pacman_sound_enable_w)
AM_RANGE(0x5002, 0x5002) AM_MIRROR(0xaf38) AM_WRITE(SMH_NOP)
AM_RANGE(0x5003, 0x5003) AM_MIRROR(0xaf38) AM_WRITE(pacman_flipscreen_w)
AM_RANGE(0x5004, 0x5005) AM_MIRROR(0xaf38) AM_WRITE(SMH_NOP) // AM_WRITE(pacman_leds_w)
AM_RANGE(0x5006, 0x5006) AM_MIRROR(0xaf38) AM_WRITE(SMH_NOP) // AM_WRITE(pacman_coin_lockout_global_w)
AM_RANGE(0x5007, 0x5007) AM_MIRROR(0xaf38) AM_WRITE(pacman_coin_counter_w)
- AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_WRITE(pacman_sound_w) AM_BASE(&pacman_soundregs)
+ AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_DEVWRITE(SOUND, "namco", pacman_sound_w) AM_BASE(&pacman_soundregs)
AM_RANGE(0x5060, 0x506f) AM_MIRROR(0xaf00) AM_WRITE(SMH_RAM) AM_BASE(&spriteram_2)
AM_RANGE(0x5070, 0x507f) AM_MIRROR(0xaf00) AM_WRITE(SMH_NOP)
AM_RANGE(0x5080, 0x5080) AM_MIRROR(0xaf3f) AM_WRITE(SMH_NOP)
@@ -1132,10 +1132,10 @@ static ADDRESS_MAP_START( rocktrv2_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4400, 0x47ff) AM_READWRITE(SMH_RAM,pacman_colorram_w) AM_BASE(&colorram)
AM_RANGE(0x4c00, 0x4fff) AM_RAM
AM_RANGE(0x5000, 0x5000) AM_WRITE(interrupt_enable_w)
- AM_RANGE(0x5001, 0x5001) AM_WRITE(pacman_sound_enable_w)
+ AM_RANGE(0x5001, 0x5001) AM_DEVWRITE(SOUND, "namco", pacman_sound_enable_w)
AM_RANGE(0x5003, 0x5003) AM_WRITE(pacman_flipscreen_w)
AM_RANGE(0x5007, 0x5007) AM_WRITE(pacman_coin_counter_w)
- AM_RANGE(0x5040, 0x505f) AM_WRITE(pacman_sound_w) AM_BASE(&pacman_soundregs)
+ AM_RANGE(0x5040, 0x505f) AM_DEVWRITE(SOUND, "namco", pacman_sound_w) AM_BASE(&pacman_soundregs)
AM_RANGE(0x50c0, 0x50c0) AM_WRITE(watchdog_reset_w)
AM_RANGE(0x5fe0, 0x5fe3) AM_WRITE(rocktrv2_prot_data_w) AM_BASE(&rocktrv2_prot_data)
AM_RANGE(0x5ff0, 0x5ff0) AM_WRITE(rocktrv2_question_bank_w)
@@ -1159,10 +1159,10 @@ static ADDRESS_MAP_START( bigbucks_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4400, 0x47ff) AM_READWRITE(SMH_RAM,pacman_colorram_w) AM_BASE(&colorram)
AM_RANGE(0x4c00, 0x4fff) AM_RAM
AM_RANGE(0x5000, 0x5000) AM_WRITE(interrupt_enable_w)
- AM_RANGE(0x5001, 0x5001) AM_WRITE(pacman_sound_enable_w)
+ AM_RANGE(0x5001, 0x5001) AM_DEVWRITE(SOUND, "namco", pacman_sound_enable_w)
AM_RANGE(0x5003, 0x5003) AM_WRITE(pacman_flipscreen_w)
AM_RANGE(0x5007, 0x5007) AM_WRITE(SMH_NOP) /*?*/
- AM_RANGE(0x5040, 0x505f) AM_WRITE(pacman_sound_w) AM_BASE(&pacman_soundregs)
+ AM_RANGE(0x5040, 0x505f) AM_DEVWRITE(SOUND, "namco", pacman_sound_w) AM_BASE(&pacman_soundregs)
AM_RANGE(0x50c0, 0x50c0) AM_WRITE(watchdog_reset_w)
AM_RANGE(0x5000, 0x503f) AM_READ_PORT("IN0") /* IN0 */
AM_RANGE(0x5040, 0x507f) AM_READ_PORT("IN1") /* IN1 */
@@ -1182,13 +1182,13 @@ static ADDRESS_MAP_START( mschamp_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4c00, 0x4fef) AM_MIRROR(0xa000) AM_RAM
AM_RANGE(0x4ff0, 0x4fff) AM_MIRROR(0xa000) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0x5000, 0x5000) AM_MIRROR(0xaf38) AM_WRITE(interrupt_enable_w)
- AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_WRITE(pacman_sound_enable_w)
+ AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE(SOUND, "namco", pacman_sound_enable_w)
AM_RANGE(0x5002, 0x5002) AM_MIRROR(0xaf38) AM_WRITE(SMH_NOP)
AM_RANGE(0x5003, 0x5003) AM_MIRROR(0xaf38) AM_WRITE(pacman_flipscreen_w)
AM_RANGE(0x5004, 0x5005) AM_MIRROR(0xaf38) AM_WRITE(SMH_NOP) // AM_WRITE(pacman_leds_w)
AM_RANGE(0x5006, 0x5006) AM_MIRROR(0xaf38) AM_WRITE(SMH_NOP) // AM_WRITE(pacman_coin_lockout_global_w)
AM_RANGE(0x5007, 0x5007) AM_MIRROR(0xaf38) AM_WRITE(pacman_coin_counter_w)
- AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_WRITE(pacman_sound_w) AM_BASE(&pacman_soundregs)
+ AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_DEVWRITE(SOUND, "namco", pacman_sound_w) AM_BASE(&pacman_soundregs)
AM_RANGE(0x5060, 0x506f) AM_MIRROR(0xaf00) AM_WRITE(SMH_RAM) AM_BASE(&spriteram_2)
AM_RANGE(0x5070, 0x507f) AM_MIRROR(0xaf00) AM_WRITE(SMH_NOP)
AM_RANGE(0x5080, 0x5080) AM_MIRROR(0xaf3f) AM_WRITE(SMH_NOP)
@@ -1209,7 +1209,7 @@ static ADDRESS_MAP_START( crushs_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4c00, 0x4fef) AM_MIRROR(0xa000) AM_RAM
AM_RANGE(0x4ff0, 0x4fff) AM_MIRROR(0xa000) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0x5000, 0x5000) AM_MIRROR(0xaf38) AM_WRITE(interrupt_enable_w)
- AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_WRITE(pacman_sound_enable_w)
+ AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE(SOUND, "namco", pacman_sound_enable_w)
AM_RANGE(0x5002, 0x5002) AM_MIRROR(0xaf38) AM_WRITE(SMH_NOP)
AM_RANGE(0x5003, 0x5003) AM_MIRROR(0xaf38) AM_WRITE(pacman_flipscreen_w)
AM_RANGE(0x5004, 0x5005) AM_MIRROR(0xaf38) AM_WRITE(SMH_NOP) // AM_WRITE(pacman_leds_w)
@@ -1239,14 +1239,13 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( vanvan_writeport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x01, 0x01) AM_WRITE(sn76496_0_w)
- AM_RANGE(0x02, 0x02) AM_WRITE(sn76496_1_w)
+ AM_RANGE(0x01, 0x01) AM_DEVWRITE(SOUND, "namco", sn76496_w)
+ AM_RANGE(0x02, 0x02) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( dremshpr_writeport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x06, 0x06) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x07, 0x07) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x06, 0x07) AM_DEVWRITE(SOUND, "namco", ay8910_data_address_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( piranha_writeport, ADDRESS_SPACE_IO, 8 )
@@ -1297,7 +1296,7 @@ static ADDRESS_MAP_START( porky_readport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_END
static ADDRESS_MAP_START( s2650games_writeport, ADDRESS_SPACE_IO, 8 )
- AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_WRITE(sn76496_0_w)
+ AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_DEVWRITE(SOUND, "namco", sn76496_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( crushs_readport, ADDRESS_SPACE_IO, 8 )
@@ -1308,8 +1307,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( crushs_writeport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "namco", ay8910_data_address_w)
ADDRESS_MAP_END
@@ -3313,7 +3311,7 @@ static MACHINE_DRIVER_START( vanvan )
/* sound hardware */
MDRV_SOUND_REPLACE("namco", SN76496, 1789750)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
- MDRV_SOUND_ADD("sn", SN76496, 1789750)
+ MDRV_SOUND_ADD("sn2", SN76496, 1789750)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
MACHINE_DRIVER_END
@@ -3429,10 +3427,10 @@ static const ay8910_interface crushs_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- NULL,
- NULL
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
static MACHINE_DRIVER_START( crushs )
diff --git a/src/mame/drivers/pandoras.c b/src/mame/drivers/pandoras.c
index c351720c44f..50a9df13007 100644
--- a/src/mame/drivers/pandoras.c
+++ b/src/mame/drivers/pandoras.c
@@ -166,14 +166,14 @@ static ADDRESS_MAP_START( pandoras_readmem_snd, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_READ(SMH_ROM) /* ROM */
AM_RANGE(0x2000, 0x23ff) AM_READ(SMH_RAM) /* RAM */
AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_r) /* soundlatch_r */
- AM_RANGE(0x6001, 0x6001) AM_READ(ay8910_read_port_0_r) /* AY-8910 */
+ AM_RANGE(0x6001, 0x6001) AM_DEVREAD(SOUND, "ay", ay8910_r) /* AY-8910 */
ADDRESS_MAP_END
static ADDRESS_MAP_START( pandoras_writemem_snd, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_WRITE(SMH_ROM) /* ROM */
AM_RANGE(0x2000, 0x23ff) AM_WRITE(SMH_RAM) /* RAM */
- AM_RANGE(0x6000, 0x6000) AM_WRITE(ay8910_control_port_0_w)/* AY-8910 */
- AM_RANGE(0x6002, 0x6002) AM_WRITE(ay8910_write_port_0_w) /* AY-8910 */
+ AM_RANGE(0x6000, 0x6000) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)/* AY-8910 */
+ AM_RANGE(0x6002, 0x6002) AM_DEVWRITE(SOUND, "ay", ay8910_data_w) /* AY-8910 */
AM_RANGE(0x8000, 0x8000) AM_WRITE(pandoras_i8039_irqtrigger_w)/* cause INT on the 8039 */
AM_RANGE(0xa000, 0xa000) AM_WRITE(soundlatch2_w) /* sound command to the 8039 */
ADDRESS_MAP_END
@@ -188,7 +188,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( i8039_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0xff) AM_READ(soundlatch2_r)
- AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(dac_0_data_w)
+ AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE(SOUND, "dac", dac_w)
AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(i8039_irqen_and_status_w)
ADDRESS_MAP_END
@@ -354,24 +354,24 @@ static MACHINE_RESET( pandoras )
irq_enable_a = irq_enable_b = 0;
}
-static READ8_HANDLER( pandoras_portA_r )
+static READ8_DEVICE_HANDLER( pandoras_portA_r )
{
return i8039_status;
}
-static READ8_HANDLER( pandoras_portB_r )
+static READ8_DEVICE_HANDLER( pandoras_portB_r )
{
- return (cputag_get_total_cycles(space->machine, "audio") / 512) & 0x0f;
+ return (cputag_get_total_cycles(device->machine, "audio") / 512) & 0x0f;
}
static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- pandoras_portA_r, // not used
- pandoras_portB_r,
- NULL,
- NULL
+ DEVCB_HANDLER(pandoras_portA_r), // not used
+ DEVCB_HANDLER(pandoras_portB_r),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static MACHINE_DRIVER_START( pandoras )
diff --git a/src/mame/drivers/paradise.c b/src/mame/drivers/paradise.c
index af10b0a013b..a7e0cb1a1aa 100644
--- a/src/mame/drivers/paradise.c
+++ b/src/mame/drivers/paradise.c
@@ -55,12 +55,11 @@ static WRITE8_HANDLER( paradise_rombank_w )
memory_set_bankptr(space->machine, 1, memory_region(space->machine, "main") + bank * 0x4000);
}
-static WRITE8_HANDLER( paradise_okibank_w )
+static WRITE8_DEVICE_HANDLER( paradise_okibank_w )
{
- if (data & ~0x02) logerror("CPU #0 - PC %04X: unknown oki bank bits %02X\n",cpu_get_pc(space->cpu),data);
+ if (data & ~0x02) logerror("%s: unknown oki bank bits %02X\n",cpuexec_describe_context(device->machine),data);
- if (sndti_exists(SOUND_OKIM6295, 1))
- okim6295_set_bank_base(1, (data & 0x02) ? 0x40000 : 0);
+ okim6295_set_bank_base(device, (data & 0x02) ? 0x40000 : 0);
}
static WRITE8_HANDLER( torus_coin_counter_w )
@@ -102,14 +101,29 @@ static ADDRESS_MAP_START( paradise_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x2001, 0x2001) AM_WRITE(paradise_flipscreen_w ) // Flip Screen
AM_RANGE(0x2004, 0x2004) AM_WRITE(paradise_palbank_w ) // Layers palette bank
AM_RANGE(0x2006, 0x2006) AM_WRITE(paradise_rombank_w ) // ROM bank
- AM_RANGE(0x2007, 0x2007) AM_WRITE(paradise_okibank_w ) // OKI 1 samples bank
- AM_RANGE(0x2010, 0x2010) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w) // OKI 0
+ AM_RANGE(0x2007, 0x2007) AM_DEVWRITE(SOUND, "oki2", paradise_okibank_w ) // OKI 1 samples bank
+ AM_RANGE(0x2010, 0x2010) AM_DEVREADWRITE(SOUND, "oki1", okim6295_r, okim6295_w) // OKI 0
+ AM_RANGE(0x2020, 0x2020) AM_READ_PORT("DSW1" )
+ AM_RANGE(0x2021, 0x2021) AM_READ_PORT("DSW2" )
+ AM_RANGE(0x2022, 0x2022) AM_READ_PORT("P1" )
+ AM_RANGE(0x2023, 0x2023) AM_READ_PORT("P2" )
+ AM_RANGE(0x2024, 0x2024) AM_READ_PORT("SYSTEM" )
+ AM_RANGE(0x2030, 0x2030) AM_DEVREADWRITE(SOUND, "oki2", okim6295_r, okim6295_w) // OKI 1
+ AM_RANGE(0x8000, 0xffff) AM_RAM_WRITE(paradise_pixmap_w ) AM_BASE(&videoram) // Pixmap
+ADDRESS_MAP_END
+
+static ADDRESS_MAP_START( torus_io_map, ADDRESS_SPACE_IO, 8 )
+ AM_RANGE(0x0000, 0x17ff) AM_RAM_WRITE(paradise_palette_w) AM_BASE(&paletteram) // Palette
+ AM_RANGE(0x1800, 0x1800) AM_WRITE(paradise_priority_w ) // Layers priority
+ AM_RANGE(0x2001, 0x2001) AM_WRITE(paradise_flipscreen_w ) // Flip Screen
+ AM_RANGE(0x2004, 0x2004) AM_WRITE(paradise_palbank_w ) // Layers palette bank
+ AM_RANGE(0x2006, 0x2006) AM_WRITE(paradise_rombank_w ) // ROM bank
+ AM_RANGE(0x2010, 0x2010) AM_DEVREADWRITE(SOUND, "oki1", okim6295_r, okim6295_w) // OKI 0
AM_RANGE(0x2020, 0x2020) AM_READ_PORT("DSW1" )
AM_RANGE(0x2021, 0x2021) AM_READ_PORT("DSW2" )
AM_RANGE(0x2022, 0x2022) AM_READ_PORT("P1" )
AM_RANGE(0x2023, 0x2023) AM_READ_PORT("P2" )
AM_RANGE(0x2024, 0x2024) AM_READ_PORT("SYSTEM" )
- AM_RANGE(0x2030, 0x2030) AM_READWRITE(okim6295_status_1_r, okim6295_data_1_w) // OKI 1
AM_RANGE(0x8000, 0xffff) AM_RAM_WRITE(paradise_pixmap_w ) AM_BASE(&videoram) // Pixmap
ADDRESS_MAP_END
@@ -572,6 +586,7 @@ static MACHINE_DRIVER_START( torus )
MDRV_IMPORT_FROM(paradise)
MDRV_CPU_MODIFY("main")
MDRV_CPU_PROGRAM_MAP(torus_map,0)
+ MDRV_CPU_IO_MAP(torus_io_map,0)
MDRV_GFXDECODE(torus)
@@ -585,6 +600,7 @@ static MACHINE_DRIVER_START( madball )
MDRV_IMPORT_FROM(paradise)
MDRV_CPU_MODIFY("main")
MDRV_CPU_PROGRAM_MAP(torus_map,0)
+ MDRV_CPU_IO_MAP(torus_io_map,0)
MDRV_GFXDECODE(madball)
diff --git a/src/mame/drivers/paranoia.c b/src/mame/drivers/paranoia.c
index 8a38562ba56..5a79a2be101 100644
--- a/src/mame/drivers/paranoia.c
+++ b/src/mame/drivers/paranoia.c
@@ -59,7 +59,7 @@ static ADDRESS_MAP_START( pce_mem , ADDRESS_SPACE_PROGRAM, 8)
AM_RANGE( 0x1F0000, 0x1F1FFF) AM_RAM AM_MIRROR(0x6000) AM_BASE( &pce_user_ram )
AM_RANGE( 0x1FE000, 0x1FE3FF) AM_READWRITE( vdc_0_r, vdc_0_w )
AM_RANGE( 0x1FE400, 0x1FE7FF) AM_READWRITE( vce_r, vce_w )
- AM_RANGE( 0x1FE800, 0x1FEBFF) AM_READWRITE( c6280_r, c6280_0_w )
+ AM_RANGE( 0x1FE800, 0x1FEBFF) AM_DEVREADWRITE( SOUND, "main", c6280_r, c6280_w )
AM_RANGE( 0x1FEC00, 0x1FEFFF) AM_READWRITE( h6280_timer_r, h6280_timer_w )
AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE( pce_joystick_r, pce_joystick_w )
AM_RANGE( 0x1FF400, 0x1FF7FF) AM_READWRITE( h6280_irq_status_r, h6280_irq_status_w )
@@ -161,7 +161,7 @@ static MACHINE_DRIVER_START( paranoia )
MDRV_VIDEO_UPDATE( pce )
MDRV_SPEAKER_STANDARD_STEREO("left","right")
- MDRV_SOUND_ADD("huc", C6280, PCE_MAIN_CLOCK/6)
+ MDRV_SOUND_ADD("main", C6280, PCE_MAIN_CLOCK/6)
MDRV_SOUND_ROUTE(0, "left", 1.00)
MDRV_SOUND_ROUTE(1, "right", 1.00)
diff --git a/src/mame/drivers/parodius.c b/src/mame/drivers/parodius.c
index ba59b16517f..183c940bbba 100644
--- a/src/mame/drivers/parodius.c
+++ b/src/mame/drivers/parodius.c
@@ -93,9 +93,9 @@ static WRITE8_HANDLER( parodius_3fc0_w )
/* other bits unknown */
}
-static READ8_HANDLER( parodius_sound_r )
+static READ8_DEVICE_HANDLER( parodius_sound_r )
{
- return k053260_0_r(space,2 + offset);
+ return k053260_r(device,2 + offset);
}
static WRITE8_HANDLER( parodius_sh_irqtrigger_w )
@@ -138,7 +138,7 @@ static ADDRESS_MAP_START( parodius_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x3f90, 0x3f90) AM_READ_PORT("DSW2")
AM_RANGE(0x3fa0, 0x3faf) AM_READ(K053244_r)
AM_RANGE(0x3fc0, 0x3fc0) AM_READ(watchdog_reset_r)
- AM_RANGE(0x3fcc, 0x3fcd) AM_READ(parodius_sound_r) /* K053260 */
+ AM_RANGE(0x3fcc, 0x3fcd) AM_DEVREAD(SOUND, "konami", parodius_sound_r) /* K053260 */
AM_RANGE(0x2000, 0x27ff) AM_READ(parodius_052109_053245_r)
AM_RANGE(0x2000, 0x5fff) AM_READ(K052109_r)
AM_RANGE(0x6000, 0x9fff) AM_READ(SMH_BANK1) /* banked ROM */
@@ -153,7 +153,7 @@ static ADDRESS_MAP_START( parodius_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x3fc0, 0x3fc0) AM_WRITE(parodius_3fc0_w)
AM_RANGE(0x3fc4, 0x3fc4) AM_WRITE(parodius_videobank_w)
AM_RANGE(0x3fc8, 0x3fc8) AM_WRITE(parodius_sh_irqtrigger_w)
- AM_RANGE(0x3fcc, 0x3fcd) AM_WRITE(k053260_0_w)
+ AM_RANGE(0x3fcc, 0x3fcd) AM_DEVWRITE(SOUND, "konami", k053260_w)
AM_RANGE(0x2000, 0x27ff) AM_WRITE(parodius_052109_053245_w)
AM_RANGE(0x2000, 0x5fff) AM_WRITE(K052109_w)
AM_RANGE(0x6000, 0x9fff) AM_WRITE(SMH_ROM) /* banked ROM */
@@ -163,17 +163,16 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( parodius_readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_READ(SMH_ROM)
AM_RANGE(0xf000, 0xf7ff) AM_READ(SMH_RAM)
- AM_RANGE(0xf801, 0xf801) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0xfc00, 0xfc2f) AM_READ(k053260_0_r)
+ AM_RANGE(0xf800, 0xf801) AM_DEVREAD(SOUND, "ym", ym2151_r)
+ AM_RANGE(0xfc00, 0xfc2f) AM_DEVREAD(SOUND, "konami", k053260_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( parodius_writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_WRITE(SMH_ROM)
AM_RANGE(0xf000, 0xf7ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xf800, 0xf800) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xf801, 0xf801) AM_WRITE(ym2151_data_port_0_w)
+ AM_RANGE(0xf800, 0xf801) AM_DEVWRITE(SOUND, "ym", ym2151_w)
AM_RANGE(0xfa00, 0xfa00) AM_WRITE(sound_arm_nmi_w)
- AM_RANGE(0xfc00, 0xfc2f) AM_WRITE(k053260_0_w)
+ AM_RANGE(0xfc00, 0xfc2f) AM_DEVWRITE(SOUND, "konami", k053260_w)
ADDRESS_MAP_END
/***************************************************************************
diff --git a/src/mame/drivers/pasha2.c b/src/mame/drivers/pasha2.c
index 4c1b7b1dc98..e1d61074a90 100644
--- a/src/mame/drivers/pasha2.c
+++ b/src/mame/drivers/pasha2.c
@@ -160,44 +160,24 @@ static WRITE16_HANDLER( bitmap_1_w )
COMBINE_DATA(&bitmap1[offset + vbuffer*0x20000/2]);
}
-static READ16_HANDLER( oki_0_r )
+static READ16_DEVICE_HANDLER( oki_r )
{
if(offset)
- return okim6295_status_0_r(space, 0);
+ return okim6295_r(device, 0);
else
return 0;
}
-static WRITE16_HANDLER( oki_0_w )
+static WRITE16_DEVICE_HANDLER( oki_w )
{
if(offset)
- okim6295_data_0_w(space, 0, data);
+ okim6295_w(device, 0, data);
}
-static WRITE16_HANDLER( oki_1_w )
+static WRITE16_DEVICE_HANDLER( oki_bank_w )
{
if(offset)
- okim6295_data_1_w(space, 0, data);
-}
-
-static READ16_HANDLER( oki_1_r )
-{
- if(offset)
- return okim6295_status_1_r(space, 0);
- else
- return 0;
-}
-
-static WRITE16_HANDLER( oki_0_bank_w )
-{
- if(offset)
- okim6295_set_bank_base(0, (data & 1) * 0x40000);
-}
-
-static WRITE16_HANDLER( oki_1_bank_w )
-{
- if(offset)
- okim6295_set_bank_base(1, (data & 1) * 0x40000);
+ okim6295_set_bank_base(device, (data & 1) * 0x40000);
}
static WRITE16_HANDLER( pasha2_lamps_w )
@@ -240,10 +220,10 @@ static ADDRESS_MAP_START( pasha2_io, ADDRESS_SPACE_IO, 16 )
AM_RANGE(0x80, 0x83) AM_READ_PORT("INPUTS")
AM_RANGE(0xa0, 0xa3) AM_WRITENOP //soundlatch?
AM_RANGE(0xc0, 0xc3) AM_WRITE(pasha2_misc_w)
- AM_RANGE(0xe0, 0xe3) AM_READWRITE(oki_0_r, oki_0_w)
- AM_RANGE(0xe4, 0xe7) AM_READWRITE(oki_1_r, oki_1_w)
- AM_RANGE(0xe8, 0xeb) AM_WRITE(oki_0_bank_w)
- AM_RANGE(0xec, 0xef) AM_WRITE(oki_1_bank_w)
+ AM_RANGE(0xe0, 0xe3) AM_DEVREADWRITE(SOUND, "oki1", oki_r, oki_w)
+ AM_RANGE(0xe4, 0xe7) AM_DEVREADWRITE(SOUND, "oki2", oki_r, oki_w)
+ AM_RANGE(0xe8, 0xeb) AM_DEVWRITE(SOUND, "oki1", oki_bank_w)
+ AM_RANGE(0xec, 0xef) AM_DEVWRITE(SOUND, "oki2", oki_bank_w)
ADDRESS_MAP_END
static INPUT_PORTS_START( pasha2 )
diff --git a/src/mame/drivers/pass.c b/src/mame/drivers/pass.c
index 9300a60113a..1ffa67bc48d 100644
--- a/src/mame/drivers/pass.c
+++ b/src/mame/drivers/pass.c
@@ -157,9 +157,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( pass_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r)
- AM_RANGE(0x70, 0x70) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x71, 0x71) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0x70, 0x71) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
+ AM_RANGE(0x80, 0x80) AM_DEVWRITE(SOUND, "oki", okim6295_w)
AM_RANGE(0xc0, 0xc0) AM_WRITE(soundlatch_clear_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/pastelg.c b/src/mame/drivers/pastelg.c
index fc623ed4623..47aad29a51d 100644
--- a/src/mame/drivers/pastelg.c
+++ b/src/mame/drivers/pastelg.c
@@ -29,9 +29,9 @@ Memo:
#define SIGNED_DAC 0 // 0:unsigned DAC, 1:signed DAC
#if SIGNED_DAC
-#define DAC_0_WRITE dac_0_signed_data_w
+#define DAC_WRITE dac_signed_w
#else
-#define DAC_0_WRITE dac_0_data_w
+#define DAC_WRITE dac_w
#endif
@@ -68,16 +68,15 @@ static ADDRESS_MAP_START( pastelg_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
// AM_RANGE(0x00, 0x00) AM_WRITE(SMH_NOP)
AM_RANGE(0x00, 0x7f) AM_READ(nb1413m3_sndrom_r)
- AM_RANGE(0x81, 0x81) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x82, 0x82) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x83, 0x83) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x81, 0x81) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x82, 0x83) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
AM_RANGE(0x90, 0x90) AM_READ_PORT("SYSTEM")
AM_RANGE(0x90, 0x96) AM_WRITE(pastelg_blitter_w)
AM_RANGE(0xa0, 0xa0) AM_READWRITE(nb1413m3_inputport1_r, nb1413m3_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_READWRITE(nb1413m3_inputport2_r, pastelg_romsel_w)
AM_RANGE(0xc0, 0xc0) AM_READ(pastelg_sndrom_r)
AM_RANGE(0xc0, 0xcf) AM_WRITE(pastelg_clut_w)
- AM_RANGE(0xd0, 0xd0) AM_READWRITE(SMH_NOP, DAC_0_WRITE) // unknown
+ AM_RANGE(0xd0, 0xd0) AM_READNOP AM_DEVWRITE(SOUND, "dac", DAC_WRITE) // unknown
AM_RANGE(0xe0, 0xe0) AM_READ_PORT("DSWC")
ADDRESS_MAP_END
@@ -118,16 +117,15 @@ static WRITE8_HANDLER( threeds_inputportsel_w )
static ADDRESS_MAP_START( threeds_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x81, 0x81) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x82, 0x82) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x83, 0x83) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x81, 0x81) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x82, 0x83) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
AM_RANGE(0x90, 0x90) AM_READ_PORT("SYSTEM") AM_WRITE( threeds_romsel_w )
AM_RANGE(0xf0, 0xf6) AM_WRITE(pastelg_blitter_w)
AM_RANGE(0xa0, 0xa0) AM_READWRITE(threeds_inputport1_r, threeds_inputportsel_w)
AM_RANGE(0xb0, 0xb0) AM_READ(threeds_inputport2_r)
AM_RANGE(0xc0, 0xcf) AM_WRITE(pastelg_clut_w)
AM_RANGE(0xc0, 0xc0) AM_READ_PORT("DSWC")
- AM_RANGE(0xd0, 0xd0) AM_READWRITE(SMH_NOP, DAC_0_WRITE) // unknown
+ AM_RANGE(0xd0, 0xd0) AM_READNOP AM_DEVWRITE(SOUND, "dac", DAC_WRITE) // unknown
ADDRESS_MAP_END
static INPUT_PORTS_START( pastelg )
@@ -392,10 +390,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_1_r,
- input_port_0_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSWB"),
+ DEVCB_INPUT_PORT("DSWA"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/pbaction.c b/src/mame/drivers/pbaction.c
index 0f2ce9debe5..9eeb59d4ed4 100644
--- a/src/mame/drivers/pbaction.c
+++ b/src/mame/drivers/pbaction.c
@@ -138,12 +138,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x10, 0x10) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x11, 0x11) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x20, 0x20) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x21, 0x21) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x30, 0x30) AM_WRITE(ay8910_control_port_2_w)
- AM_RANGE(0x31, 0x31) AM_WRITE(ay8910_write_port_2_w)
+ AM_RANGE(0x10, 0x11) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x20, 0x21) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x30, 0x31) AM_DEVWRITE(SOUND, "ay3", ay8910_address_data_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/pcktgal.c b/src/mame/drivers/pcktgal.c
index b4cf256e902..24d739ad0ec 100644
--- a/src/mame/drivers/pcktgal.c
+++ b/src/mame/drivers/pcktgal.c
@@ -55,7 +55,7 @@ static void pcktgal_adpcm_int(const device_config *device)
{
static int toggle;
- msm5205_data_w(0,msm5205next >> 4);
+ msm5205_data_w(device,msm5205next >> 4);
msm5205next<<=4;
toggle = 1 - toggle;
@@ -68,9 +68,9 @@ static WRITE8_HANDLER( pcktgal_adpcm_data_w )
msm5205next=data;
}
-static READ8_HANDLER( pcktgal_adpcm_reset_r )
+static READ8_DEVICE_HANDLER( pcktgal_adpcm_reset_r )
{
- msm5205_reset_w(0,0);
+ msm5205_reset_w(device,0);
return 0;
}
@@ -102,17 +102,15 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_READ(SMH_RAM)
AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r)
- AM_RANGE(0x3400, 0x3400) AM_READ(pcktgal_adpcm_reset_r) /* ? not sure */
+ AM_RANGE(0x3400, 0x3400) AM_DEVREAD(SOUND, "msm", pcktgal_adpcm_reset_r) /* ? not sure */
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK3)
AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x0800, 0x0800) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x0801, 0x0801) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0x1000, 0x1000) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x1001, 0x1001) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x0800, 0x0801) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x1000, 0x1001) AM_DEVWRITE(SOUND, "ym2", ym3812_w)
AM_RANGE(0x1800, 0x1800) AM_WRITE(pcktgal_adpcm_data_w) /* ADPCM data for the MSM5205 chip */
AM_RANGE(0x2000, 0x2000) AM_WRITE(pcktgal_sound_bank_w)
AM_RANGE(0x4000, 0xffff) AM_WRITE(SMH_ROM)
diff --git a/src/mame/drivers/pcxt.c b/src/mame/drivers/pcxt.c
index 7e61f8429e1..1326e6040cd 100644
--- a/src/mame/drivers/pcxt.c
+++ b/src/mame/drivers/pcxt.c
@@ -455,11 +455,13 @@ static READ8_DEVICE_HANDLER( port_c_r )
static WRITE8_DEVICE_HANDLER( port_b_w )
{
port_b_data = data;
-// hc55516_digit_w(0, data);
+// const device_config *beep = devtag_get_device(device->machine, SOUND, "beep");
+// const device_config *cvsd = devtag_get_device(device->machine, SOUND, "cvsd");
+// hc55516_digit_w(cvsd, data);
// popmessage("%02x\n",data);
-// beep_set_state(0, 0);
-// beep_set_state(0, 1);
-// beep_set_frequency(0, port_b_data);
+// beep_set_state(beep, 0);
+// beep_set_state(beep, 1);
+// beep_set_frequency(beep, port_b_data);
}
static WRITE8_DEVICE_HANDLER( wss_1_w )
diff --git a/src/mame/drivers/pengo.c b/src/mame/drivers/pengo.c
index 06d9aca75ca..889a29b99a1 100644
--- a/src/mame/drivers/pengo.c
+++ b/src/mame/drivers/pengo.c
@@ -102,12 +102,12 @@ static ADDRESS_MAP_START( pengo_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8400, 0x87ff) AM_RAM_WRITE(pacman_colorram_w) AM_BASE(&colorram)
AM_RANGE(0x8800, 0x8fef) AM_RAM
AM_RANGE(0x8ff0, 0x8fff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
- AM_RANGE(0x9000, 0x901f) AM_WRITE(pacman_sound_w) AM_BASE(&pacman_soundregs)
+ AM_RANGE(0x9000, 0x901f) AM_DEVWRITE(SOUND, "namco", pacman_sound_w) AM_BASE(&pacman_soundregs)
AM_RANGE(0x9020, 0x902f) AM_WRITE(SMH_RAM) AM_BASE(&spriteram_2)
AM_RANGE(0x9000, 0x903f) AM_READ_PORT("DSW1")
AM_RANGE(0x9040, 0x907f) AM_READ_PORT("DSW0")
AM_RANGE(0x9040, 0x9040) AM_WRITE(interrupt_enable_w)
- AM_RANGE(0x9041, 0x9041) AM_WRITE(pacman_sound_enable_w)
+ AM_RANGE(0x9041, 0x9041) AM_DEVWRITE(SOUND, "namco", pacman_sound_enable_w)
AM_RANGE(0x9042, 0x9042) AM_WRITE(pengo_palettebank_w)
AM_RANGE(0x9043, 0x9043) AM_WRITE(pacman_flipscreen_w)
AM_RANGE(0x9044, 0x9045) AM_WRITE(SMH_NOP) /* coin counters */
@@ -124,12 +124,12 @@ static ADDRESS_MAP_START( jrpacmbl_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0x87ff) AM_RAM_WRITE(jrpacman_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size)
AM_RANGE(0x8800, 0x8fef) AM_RAM
AM_RANGE(0x8ff0, 0x8fff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
- AM_RANGE(0x9000, 0x901f) AM_WRITE(pacman_sound_w) AM_BASE(&pacman_soundregs)
+ AM_RANGE(0x9000, 0x901f) AM_DEVWRITE(SOUND, "namco", pacman_sound_w) AM_BASE(&pacman_soundregs)
AM_RANGE(0x9020, 0x902f) AM_WRITE(SMH_RAM) AM_BASE(&spriteram_2)
AM_RANGE(0x9030, 0x9030) AM_WRITE(jrpacman_scroll_w)
AM_RANGE(0x9040, 0x904f) AM_READ_PORT("DSW")
AM_RANGE(0x9040, 0x9040) AM_WRITE(interrupt_enable_w)
- AM_RANGE(0x9041, 0x9041) AM_WRITE(pacman_sound_enable_w)
+ AM_RANGE(0x9041, 0x9041) AM_DEVWRITE(SOUND, "namco", pacman_sound_enable_w)
AM_RANGE(0x9042, 0x9042) AM_WRITE(pengo_palettebank_w)
AM_RANGE(0x9043, 0x9043) AM_WRITE(pacman_flipscreen_w)
AM_RANGE(0x9044, 0x9044) AM_WRITE(jrpacman_bgpriority_w)
diff --git a/src/mame/drivers/peplus.c b/src/mame/drivers/peplus.c
index 4c4b744c29d..90ad100b7ca 100644
--- a/src/mame/drivers/peplus.c
+++ b/src/mame/drivers/peplus.c
@@ -739,8 +739,8 @@ static ADDRESS_MAP_START( peplus_iomap, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x3000, 0x3fff) AM_READWRITE(peplus_s3000_r, peplus_s3000_w) AM_BASE(&s3000_ram)
// Sound and Dipswitches
- AM_RANGE(0x4000, 0x4000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x4004, 0x4004) AM_READ_PORT("SW1") AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x4000, 0x4000) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
+ AM_RANGE(0x4004, 0x4004) AM_READ_PORT("SW1")/* likely ay8910 input port, not direct */ AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
// Superboard Data
AM_RANGE(0x5000, 0x5fff) AM_READWRITE(peplus_s5000_r, peplus_s5000_w) AM_BASE(&s5000_ram)
@@ -1042,8 +1042,9 @@ static MACHINE_DRIVER_START( peplus )
MDRV_VIDEO_UPDATE(peplus)
// sound hardware
- MDRV_SOUND_ADD("ay", AY8912, SOUND_CLOCK)
MDRV_SPEAKER_STANDARD_MONO("mono")
+
+ MDRV_SOUND_ADD("ay", AY8912, SOUND_CLOCK)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/pgm.c b/src/mame/drivers/pgm.c
index b5b9916c49e..f635e815f06 100644
--- a/src/mame/drivers/pgm.c
+++ b/src/mame/drivers/pgm.c
@@ -397,7 +397,7 @@ static WRITE16_HANDLER ( z80_reset_w )
if (PGMLOGERROR) logerror("Z80: reset %04x @ %04x (%06x)\n", data, mem_mask, cpu_get_pc(space->cpu));
if(data == 0x5050) {
- sndti_reset(SOUND_ICS2115, 0);
+ devtag_reset(space->machine, SOUND, "ics");
cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_HALT, CLEAR_LINE);
cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, PULSE_LINE);
if(0) {
@@ -435,9 +435,9 @@ static WRITE8_HANDLER( z80_l3_w )
soundlatch3_w(space, 0, data);
}
-static void sound_irq(running_machine *machine, int level)
+static void sound_irq(const device_config *device, int level)
{
- cpu_set_input_line(machine->cpu[1], 0, level);
+ cpu_set_input_line(device->machine->cpu[1], 0, level);
}
static const ics2115_interface pgm_ics2115_interface = {
@@ -702,7 +702,7 @@ static ADDRESS_MAP_START( z80_mem, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END
static ADDRESS_MAP_START( z80_io, ADDRESS_SPACE_IO, 8 )
- AM_RANGE(0x8000, 0x8003) AM_READWRITE(ics2115_r, ics2115_w)
+ AM_RANGE(0x8000, 0x8003) AM_DEVREADWRITE(SOUND, "ics", ics2115_r, ics2115_w)
AM_RANGE(0x8100, 0x81ff) AM_READWRITE(soundlatch3_r, z80_l3_w)
AM_RANGE(0x8200, 0x82ff) AM_READWRITE(soundlatch_r, soundlatch_w)
AM_RANGE(0x8400, 0x84ff) AM_READWRITE(soundlatch2_r, soundlatch2_w)
diff --git a/src/mame/drivers/phoenix.c b/src/mame/drivers/phoenix.c
index a3abbd39258..a13309e6144 100644
--- a/src/mame/drivers/phoenix.c
+++ b/src/mame/drivers/phoenix.c
@@ -34,7 +34,6 @@ Pleiads:
#include "sound/tms36xx.h"
#include "cpu/i8085/i8085.h"
#include "sound/ay8910.h"
-#include "sound/custom.h"
#include "phoenix.h"
@@ -43,8 +42,8 @@ static ADDRESS_MAP_START( phoenix_memory_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4000, 0x4fff) AM_READWRITE(SMH_BANK1, phoenix_videoram_w) /* 2 pages selected by bit 0 of the video register */
AM_RANGE(0x5000, 0x53ff) AM_WRITE(phoenix_videoreg_w)
AM_RANGE(0x5800, 0x5bff) AM_WRITE(phoenix_scroll_w)
- AM_RANGE(0x6000, 0x63ff) AM_WRITE(phoenix_sound_control_a_w)
- AM_RANGE(0x6800, 0x6bff) AM_WRITE(phoenix_sound_control_b_w)
+ AM_RANGE(0x6000, 0x63ff) AM_DEVWRITE(SOUND, "discrete", phoenix_sound_control_a_w)
+ AM_RANGE(0x6800, 0x6bff) AM_DEVWRITE(SOUND, "discrete", phoenix_sound_control_b_w)
AM_RANGE(0x7000, 0x73ff) AM_READ_PORT("IN0") /* IN0 or IN1 */
AM_RANGE(0x7800, 0x7bff) AM_READ_PORT("DSW0") /* DSW */
ADDRESS_MAP_END
@@ -65,8 +64,8 @@ static ADDRESS_MAP_START( survival_memory_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4000, 0x4fff) AM_READWRITE(SMH_BANK1, phoenix_videoram_w) /* 2 pages selected by bit 0 of the video register */
AM_RANGE(0x5000, 0x53ff) AM_WRITE(phoenix_videoreg_w)
AM_RANGE(0x5800, 0x5bff) AM_WRITE(phoenix_scroll_w)
- AM_RANGE(0x6800, 0x68ff) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x6900, 0x69ff) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
+ AM_RANGE(0x6800, 0x68ff) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
+ AM_RANGE(0x6900, 0x69ff) AM_DEVREADWRITE(SOUND, "ay", ay8910_r, ay8910_data_w)
AM_RANGE(0x7000, 0x73ff) AM_READ(survival_input_port_0_r) /* IN0 or IN1 */
AM_RANGE(0x7800, 0x7bff) AM_READ_PORT("DSW0") /* DSW */
ADDRESS_MAP_END
@@ -398,11 +397,6 @@ static const tms36xx_interface phoenix_tms36xx_interface =
0.21 /* tune speed (time between beats) */
};
-static const custom_sound_interface phoenix_custom_interface =
-{
- phoenix_sh_start
-};
-
static const tms36xx_interface pleiads_tms36xx_interface =
{
TMS3615, /* TMS36xx subtype(s) */
@@ -415,19 +409,14 @@ static const tms36xx_interface pleiads_tms36xx_interface =
{0.33,0.33,0,0.33,0,0.33}
};
-static const custom_sound_interface pleiads_custom_interface =
-{
- pleiads_sh_start
-};
-
static const ay8910_interface survival_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- survival_protection_r,
- NULL,
- NULL
+ DEVCB_NULL,
+ DEVCB_HANDLER(survival_protection_r),
+ DEVCB_NULL,
+ DEVCB_NULL
};
@@ -467,8 +456,7 @@ static MACHINE_DRIVER_START( phoenix )
MDRV_SOUND_CONFIG(phoenix_tms36xx_interface)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
- MDRV_SOUND_ADD("cust", CUSTOM, 0)
- MDRV_SOUND_CONFIG(phoenix_custom_interface)
+ MDRV_SOUND_ADD("cust", PHOENIX, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.4)
MDRV_SOUND_ADD("discrete", DISCRETE, 120000)
@@ -494,8 +482,7 @@ static MACHINE_DRIVER_START( pleiads )
MDRV_SOUND_CONFIG(pleiads_tms36xx_interface)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
- MDRV_SOUND_REPLACE("cust", CUSTOM, 0)
- MDRV_SOUND_CONFIG(pleiads_custom_interface)
+ MDRV_SOUND_REPLACE("cust", PLEIADS, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
MDRV_SOUND_REMOVE("discrete")
diff --git a/src/mame/drivers/pingpong.c b/src/mame/drivers/pingpong.c
index 111ded57b21..c237fdb8ff6 100644
--- a/src/mame/drivers/pingpong.c
+++ b/src/mame/drivers/pingpong.c
@@ -104,7 +104,7 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x9053, 0x97ff) AM_WRITE(SMH_RAM)
AM_RANGE(0xa000, 0xa000) AM_WRITE(coin_w) /* coin counters + irq enables */
AM_RANGE(0xa200, 0xa200) AM_WRITE(SMH_NOP) /* SN76496 data latch */
- AM_RANGE(0xa400, 0xa400) AM_WRITE(sn76496_0_w) /* trigger read */
+ AM_RANGE(0xa400, 0xa400) AM_DEVWRITE(SOUND, "sn", sn76496_w) /* trigger read */
AM_RANGE(0xa600, 0xa600) AM_WRITE(watchdog_reset_w)
ADDRESS_MAP_END
@@ -125,7 +125,7 @@ static ADDRESS_MAP_START( merlinmm_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xa100, 0xa100) AM_READ_PORT("IN2")
AM_RANGE(0xa180, 0xa180) AM_READ_PORT("IN3")
AM_RANGE(0xa200, 0xa200) AM_WRITE(SMH_NOP) /* SN76496 data latch */
- AM_RANGE(0xa400, 0xa400) AM_WRITE(sn76496_0_w) /* trigger read */
+ AM_RANGE(0xa400, 0xa400) AM_DEVWRITE(SOUND, "sn", sn76496_w) /* trigger read */
AM_RANGE(0xa600, 0xa600) AM_WRITE(watchdog_reset_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/pipedrm.c b/src/mame/drivers/pipedrm.c
index 02cd9d9aed9..1b38b59d4d7 100644
--- a/src/mame/drivers/pipedrm.c
+++ b/src/mame/drivers/pipedrm.c
@@ -265,23 +265,15 @@ static ADDRESS_MAP_START( sound_portmap, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x04, 0x04) AM_WRITE(sound_bankswitch_w)
AM_RANGE(0x16, 0x16) AM_READ(sound_command_r)
AM_RANGE(0x17, 0x17) AM_WRITE(pending_command_clear_w)
- AM_RANGE(0x18, 0x18) AM_READWRITE(ym2610_status_port_0_a_r, ym2610_control_port_0_a_w)
- AM_RANGE(0x19, 0x19) AM_WRITE(ym2610_data_port_0_a_w)
- AM_RANGE(0x1a, 0x1a) AM_READWRITE(ym2610_status_port_0_b_r, ym2610_control_port_0_b_w)
- AM_RANGE(0x1b, 0x1b) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE(SOUND, "ym", ym2610_r, ym2610_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( hatris_sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x02, 0x02) AM_WRITE(ym2608_control_port_0_b_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ym2608_data_port_0_b_w)
+ AM_RANGE(0x00, 0x03) AM_MIRROR(0x08) AM_DEVREADWRITE(SOUND, "ym", ym2608_r, ym2608_w)
AM_RANGE(0x04, 0x04) AM_READ(sound_command_r)
AM_RANGE(0x05, 0x05) AM_READWRITE(pending_command_r, pending_command_clear_w)
- AM_RANGE(0x08, 0x08) AM_READWRITE(ym2608_status_port_0_a_r, ym2608_control_port_0_a_w)
- AM_RANGE(0x09, 0x09) AM_WRITE(ym2608_data_port_0_a_w)
- AM_RANGE(0x0a, 0x0a) AM_READWRITE(ym2608_status_port_0_b_r, ym2608_control_port_0_b_w)
- AM_RANGE(0x0b, 0x0b) AM_WRITE(ym2608_data_port_0_b_w)
ADDRESS_MAP_END
@@ -524,9 +516,9 @@ GFXDECODE_END
*
*************************************/
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
}
@@ -535,7 +527,7 @@ static const ym2608_interface ym2608_config =
{
AY8910_LEGACY_OUTPUT | AY8910_SINGLE_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
irqhandler
};
diff --git a/src/mame/drivers/pipeline.c b/src/mame/drivers/pipeline.c
index 8485be963ef..31bca8cfa97 100644
--- a/src/mame/drivers/pipeline.c
+++ b/src/mame/drivers/pipeline.c
@@ -339,7 +339,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
NULL
};
diff --git a/src/mame/drivers/pirates.c b/src/mame/drivers/pirates.c
index c9038ff5679..9ecf04aa0fb 100644
--- a/src/mame/drivers/pirates.c
+++ b/src/mame/drivers/pirates.c
@@ -135,7 +135,7 @@ static WRITE16_HANDLER( pirates_out_w )
eeprom_set_clock_line((data & 0x02) ? ASSERT_LINE : CLEAR_LINE);
/* bit 6 selects oki bank */
- okim6295_set_bank_base(0, (data & 0x40) ? 0x40000 : 0x00000);
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki"), (data & 0x40) ? 0x40000 : 0x00000);
/* bit 7 used (function unknown) */
}
@@ -185,7 +185,7 @@ static ADDRESS_MAP_START( pirates_readmem, ADDRESS_SPACE_PROGRAM, 16 )
// AM_RANGE(0x500000, 0x5007ff) AM_READ(SMH_RAM)
AM_RANGE(0x800000, 0x803fff) AM_READ(SMH_RAM)
// AM_RANGE(0x900000, 0x903fff) AM_READ(SMH_RAM)
- AM_RANGE(0xa00000, 0xa00001) AM_READ(okim6295_status_0_lsb_r)
+ AM_RANGE(0xa00000, 0xa00001) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff)
ADDRESS_MAP_END
static ADDRESS_MAP_START( pirates_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -202,7 +202,7 @@ static ADDRESS_MAP_START( pirates_writemem, ADDRESS_SPACE_PROGRAM, 16 )
// AM_RANGE(0x902580, 0x902a7f) AM_WRITE(SMH_RAM) // more of tilemaps ?
AM_RANGE(0x902a80, 0x904187) AM_WRITE(pirates_bg_tileram_w) AM_BASE(&pirates_bg_tileram)
// AM_RANGE(0x903c80, 0x904187) AM_WRITE(SMH_RAM) // more of tilemaps ?
- AM_RANGE(0xa00000, 0xa00001) AM_WRITE(okim6295_data_0_lsb_w)
+ AM_RANGE(0xa00000, 0xa00001) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/pitnrun.c b/src/mame/drivers/pitnrun.c
index 2a74d13d0aa..4a24c79c18c 100644
--- a/src/mame/drivers/pitnrun.c
+++ b/src/mame/drivers/pitnrun.c
@@ -131,10 +131,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(soundlatch_clear_w)
- AM_RANGE(0x8c, 0x8c) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x8d, 0x8d) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x8e, 0x8e) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x8f, 0x8f) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
+ AM_RANGE(0x8c, 0x8d) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x8e, 0x8f) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x8f, 0x8f) AM_DEVREAD(SOUND, "ay1", ay8910_r)
AM_RANGE(0x90, 0x96) AM_WRITE(SMH_NOP)
AM_RANGE(0x97, 0x97) AM_WRITE(SMH_NOP)
AM_RANGE(0x98, 0x98) AM_WRITE(SMH_NOP)
@@ -241,10 +240,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r,
- soundlatch_r,
- NULL,
- NULL
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r),
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static GFXDECODE_START( pitnrun )
diff --git a/src/mame/drivers/pkscram.c b/src/mame/drivers/pkscram.c
index 27dbc3460ec..2033ea66d9d 100644
--- a/src/mame/drivers/pkscram.c
+++ b/src/mame/drivers/pkscram.c
@@ -45,20 +45,6 @@ static WRITE16_HANDLER( pkscramble_bgtilemap_w )
tilemap_mark_tile_dirty(bg_tilemap, offset >> 1);
}
-static WRITE16_HANDLER( pkscramble_YM2203_w )
-{
- switch (offset)
- {
- case 0: ym2203_control_port_0_w(space,0,data & 0xff);break;
- case 1: ym2203_write_port_0_w(space,0,data & 0xff);break;
- }
-}
-
-static READ16_HANDLER( pkscramble_YM2203_r )
-{
- return ym2203_status_port_0_r(space,0);
-}
-
// input bit 0x20 in port1 should stay low until bit 0x20 is written here, then
// it should stay high for some time (currently we cheat keeping the input always active)
static WRITE16_HANDLER( pkscramble_output_w )
@@ -112,8 +98,7 @@ static ADDRESS_MAP_START( pkscramble_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x049018, 0x049019) AM_WRITENOP
AM_RANGE(0x04901c, 0x04901d) AM_WRITENOP
AM_RANGE(0x049020, 0x049021) AM_WRITENOP
- AM_RANGE(0x04900c, 0x04900d) AM_READ(pkscramble_YM2203_r)
- AM_RANGE(0x04900c, 0x04900f) AM_WRITE(pkscramble_YM2203_w)
+ AM_RANGE(0x04900c, 0x04900f) AM_DEVREADWRITE8(SOUND, "ym", ym2203_r, ym2203_w, 0x00ff)
AM_RANGE(0x052086, 0x052087) AM_WRITENOP
ADDRESS_MAP_END
@@ -258,10 +243,10 @@ static GFXDECODE_START( pkscram )
GFXDECODE_ENTRY( "gfx1", 0, tiles8x8_layout, 0, 0x80 )
GFXDECODE_END
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
if(out & 0x10)
- cpu_set_input_line(machine->cpu[0],2,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[0],2,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface ym2203_config =
@@ -269,7 +254,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
irqhandler
};
diff --git a/src/mame/drivers/pktgaldx.c b/src/mame/drivers/pktgaldx.c
index 5a8b9d94862..f6be71547dd 100644
--- a/src/mame/drivers/pktgaldx.c
+++ b/src/mame/drivers/pktgaldx.c
@@ -70,9 +70,9 @@ extern UINT16* pcktgaldb_sprites;
/**********************************************************************************/
-static WRITE16_HANDLER(pktgaldx_oki_bank_w)
+static WRITE16_DEVICE_HANDLER(pktgaldx_oki_bank_w)
{
- okim6295_set_bank_base(1, (data & 3) * 0x40000);
+ okim6295_set_bank_base(device, (data & 3) * 0x40000);
}
/**********************************************************************************/
@@ -88,13 +88,13 @@ static ADDRESS_MAP_START( pktgaldx_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x120000, 0x1207ff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
AM_RANGE(0x130000, 0x130fff) AM_RAM_WRITE(deco16_nonbuffered_palette_w) AM_BASE(&paletteram16)
- AM_RANGE(0x140000, 0x14000f) AM_WRITE(okim6295_data_0_lsb_w)
- AM_RANGE(0x140006, 0x140007) AM_READ(okim6295_status_0_lsb_r)
- AM_RANGE(0x150000, 0x15000f) AM_WRITE(okim6295_data_1_lsb_w)
- AM_RANGE(0x150006, 0x150007) AM_READ(okim6295_status_1_lsb_r)
+ AM_RANGE(0x140000, 0x14000f) AM_DEVWRITE8(SOUND, "oki1", okim6295_w, 0x00ff)
+ AM_RANGE(0x140006, 0x140007) AM_DEVREAD8(SOUND, "oki1", okim6295_r, 0x00ff)
+ AM_RANGE(0x150000, 0x15000f) AM_DEVWRITE8(SOUND, "oki2", okim6295_w, 0x00ff)
+ AM_RANGE(0x150006, 0x150007) AM_DEVREAD8(SOUND, "oki2", okim6295_r, 0x00ff)
AM_RANGE(0x161800, 0x16180f) AM_WRITE(SMH_RAM) AM_BASE(&deco16_pf12_control)
- AM_RANGE(0x164800, 0x164801) AM_WRITE(pktgaldx_oki_bank_w)
+ AM_RANGE(0x164800, 0x164801) AM_DEVWRITE(SOUND, "oki2", pktgaldx_oki_bank_w)
AM_RANGE(0x167800, 0x167fff) AM_READ(deco16_104_pktgaldx_prot_r) AM_WRITE(deco16_104_pktgaldx_prot_w) AM_BASE(&deco16_prot_ram)
AM_RANGE(0x170000, 0x17ffff) AM_RAM
ADDRESS_MAP_END
diff --git a/src/mame/drivers/playch10.c b/src/mame/drivers/playch10.c
index 86c963849e4..9eb7589bca1 100644
--- a/src/mame/drivers/playch10.c
+++ b/src/mame/drivers/playch10.c
@@ -361,19 +361,19 @@ static WRITE8_HANDLER( time_w )
popmessage("Time: %d%d%d%d",timedata[3],timedata[2],timedata[1],timedata[0]);
}
-static READ8_HANDLER( psg_4015_r )
+static READ8_DEVICE_HANDLER( psg_4015_r )
{
- return nes_psg_0_r(space, 0x15);
+ return nes_psg_r(device, 0x15);
}
-static WRITE8_HANDLER( psg_4015_w )
+static WRITE8_DEVICE_HANDLER( psg_4015_w )
{
- nes_psg_0_w(space, 0x15, data);
+ nes_psg_w(device, 0x15, data);
}
-static WRITE8_HANDLER( psg_4017_w )
+static WRITE8_DEVICE_HANDLER( psg_4017_w )
{
- nes_psg_0_w(space, 0x17, data);
+ nes_psg_w(device, 0x17, data);
}
/******************************************************************************/
@@ -408,12 +408,12 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( cart_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM AM_MIRROR(0x1800) AM_BASE(&work_ram)
AM_RANGE(0x2000, 0x3fff) AM_READWRITE(ppu2c0x_0_r, ppu2c0x_0_w)
- AM_RANGE(0x4011, 0x4011) AM_WRITE(dac_0_data_w)
- AM_RANGE(0x4000, 0x4013) AM_READWRITE(nes_psg_0_r, nes_psg_0_w)
+ AM_RANGE(0x4011, 0x4011) AM_DEVWRITE(SOUND, "dac", dac_w)
+ AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE(SOUND, "nes", nes_psg_r, nes_psg_w)
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_w)
- AM_RANGE(0x4015, 0x4015) AM_READWRITE(psg_4015_r, psg_4015_w) /* PSG status / first control register */
+ AM_RANGE(0x4015, 0x4015) AM_DEVREADWRITE(SOUND, "nes", psg_4015_r, psg_4015_w) /* PSG status / first control register */
AM_RANGE(0x4016, 0x4016) AM_READWRITE(pc10_in0_r, pc10_in0_w)
- AM_RANGE(0x4017, 0x4017) AM_READWRITE(pc10_in1_r, psg_4017_w) /* IN1 - input port 2 / PSG second control register */
+ AM_RANGE(0x4017, 0x4017) AM_READ(pc10_in1_r) AM_DEVWRITE(SOUND, "nes", psg_4017_w) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
diff --git a/src/mame/drivers/playmark.c b/src/mame/drivers/playmark.c
index 457462f779c..4111dcdb05e 100644
--- a/src/mame/drivers/playmark.c
+++ b/src/mame/drivers/playmark.c
@@ -158,7 +158,7 @@ static READ8_HANDLER( playmark_snd_command_r )
// logerror("PortB reading %02x from the 68K\n",data);
}
else if ((playmark_oki_control & 0x38) == 0x28) {
- data = (okim6295_status_0_r(space,0) & 0x0f);
+ data = (okim6295_r(devtag_get_device(space->machine, SOUND, "oki"),0) & 0x0f);
// logerror("PortB reading %02x from the OKI status port\n",data);
}
@@ -176,7 +176,7 @@ static READ8_HANDLER( playmark_snd_flag_r )
}
-static WRITE8_HANDLER( playmark_oki_banking_w )
+static WRITE8_DEVICE_HANDLER( playmark_oki_banking_w )
{
static int old_bank = 0;
@@ -184,9 +184,9 @@ static WRITE8_HANDLER( playmark_oki_banking_w )
{
old_bank = data & 7;
- if(((old_bank - 1) * 0x40000) < memory_region_length(space->machine, "oki"))
+ if(((old_bank - 1) * 0x40000) < memory_region_length(device->machine, "oki"))
{
- okim6295_set_bank_base(0, 0x40000 * (old_bank - 1));
+ okim6295_set_bank_base(device, 0x40000 * (old_bank - 1));
}
}
}
@@ -196,7 +196,7 @@ static WRITE8_HANDLER( playmark_oki_w )
playmark_oki_command = data;
}
-static WRITE8_HANDLER( playmark_snd_control_w )
+static WRITE8_DEVICE_HANDLER( playmark_snd_control_w )
{
/* This port controls communications to and from the 68K, and the OKI
device.
@@ -216,7 +216,7 @@ static WRITE8_HANDLER( playmark_snd_control_w )
if ((data & 0x38) == 0x18)
{
// logerror("Writing %02x to OKI1, PortC=%02x, Code=%02x\n",playmark_oki_command,playmark_oki_control,playmark_snd_command);
- okim6295_data_0_w(space, 0, playmark_oki_command);
+ okim6295_w(device, 0, playmark_oki_command);
}
}
@@ -341,9 +341,9 @@ ADDRESS_MAP_END
/* $000 - 07F PIC16C57 Internal Data RAM */
static ADDRESS_MAP_START( playmark_sound_io_map, ADDRESS_SPACE_IO, 8 )
- AM_RANGE(0x00, 0x00) AM_WRITE(playmark_oki_banking_w)
+ AM_RANGE(0x00, 0x00) AM_DEVWRITE(SOUND, "oki", playmark_oki_banking_w)
AM_RANGE(0x01, 0x01) AM_READWRITE(playmark_snd_command_r, playmark_oki_w)
- AM_RANGE(0x02, 0x02) AM_READWRITE(playmark_snd_flag_r, playmark_snd_control_w)
+ AM_RANGE(0x02, 0x02) AM_READ(playmark_snd_flag_r) AM_DEVWRITE(SOUND, "oki", playmark_snd_control_w)
AM_RANGE(PIC16C5x_T0, PIC16C5x_T0) AM_READ(PIC16C5X_T0_clk_r)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/plygonet.c b/src/mame/drivers/plygonet.c
index ef4c8d2ae78..89ef68f0867 100644
--- a/src/mame/drivers/plygonet.c
+++ b/src/mame/drivers/plygonet.c
@@ -584,9 +584,9 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK2)
AM_RANGE(0x0000, 0xbfff) AM_WRITE(SMH_NOP)
AM_RANGE(0xc000, 0xdfff) AM_RAM
- AM_RANGE(0xe000, 0xe22f) AM_READWRITE(k054539_0_r, k054539_0_w)
+ AM_RANGE(0xe000, 0xe22f) AM_DEVREADWRITE(SOUND, "konami1", k054539_r, k054539_w)
AM_RANGE(0xe230, 0xe3ff) AM_RAM
- AM_RANGE(0xe400, 0xe62f) AM_READWRITE(k054539_1_r, k054539_1_w)
+ AM_RANGE(0xe400, 0xe62f) AM_DEVREADWRITE(SOUND, "konami2", k054539_r, k054539_w)
AM_RANGE(0xe630, 0xe7ff) AM_RAM
AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch3_w)
AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_r)
diff --git a/src/mame/drivers/pokechmp.c b/src/mame/drivers/pokechmp.c
index 17475893ec0..a72219b5b91 100644
--- a/src/mame/drivers/pokechmp.c
+++ b/src/mame/drivers/pokechmp.c
@@ -145,7 +145,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_READ(SMH_RAM)
- AM_RANGE(0x2800, 0x2800) AM_READ(okim6295_status_0_r ) // extra
+ AM_RANGE(0x2800, 0x2800) AM_DEVREAD(SOUND, "oki", okim6295_r) // extra
AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r)
// AM_RANGE(0x3400, 0x3400) AM_READ(pokechmp_adpcm_reset_r) /* ? not sure */
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK3)
@@ -154,13 +154,11 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x0800, 0x0800) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x0801, 0x0801) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0x1000, 0x1000) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x1001, 0x1001) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x0800, 0x0801) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x1000, 0x1001) AM_DEVWRITE(SOUND, "ym2", ym3812_w)
AM_RANGE(0x1800, 0x1800) AM_WRITE(SMH_NOP) /* MSM5205 chip on Pocket Gal, not connected here? */
// AM_RANGE(0x2000, 0x2000) AM_WRITE(pokechmp_sound_bank_w)/ * might still be sound bank */
- AM_RANGE(0x2800, 0x2800) AM_WRITE(okim6295_data_0_w) // extra
+ AM_RANGE(0x2800, 0x2800) AM_DEVWRITE(SOUND, "oki", okim6295_w) // extra
AM_RANGE(0x4000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/polepos.c b/src/mame/drivers/polepos.c
index 2a7398630cf..873900b30f6 100644
--- a/src/mame/drivers/polepos.c
+++ b/src/mame/drivers/polepos.c
@@ -217,7 +217,6 @@ Notes:
#include "machine/namcoio.h"
#include "sound/namco.h"
#include "sound/namco52.h"
-#include "sound/custom.h"
#include "sound/samples.h"
#include "audio/namco54.h"
#include "polepos.h"
@@ -300,7 +299,7 @@ static WRITE8_HANDLER( polepos_latch_w )
break;
case 0x02: /* CLSON */
- polepos_sound_enable(bit);
+ polepos_sound_enable(devtag_get_device(space->machine, SOUND, "namco"),bit);
if (!bit)
{
polepos_engine_sound_lsb_w(space,0,0);
@@ -410,7 +409,7 @@ static ADDRESS_MAP_START( z80_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0x83ff) AM_READ(SMH_RAM) /* Sound Memory */
AM_RANGE(0x8000, 0x83bf) AM_WRITE(SMH_RAM) /* Sound Memory */
- AM_RANGE(0x83c0, 0x83ff) AM_WRITE(polepos_sound_w) AM_BASE(&polepos_soundregs)/* Sound data */
+ AM_RANGE(0x83c0, 0x83ff) AM_DEVWRITE(SOUND, "namco", polepos_sound_w) AM_BASE(&polepos_soundregs)/* Sound data */
AM_RANGE(0x9000, 0x90ff) AM_READWRITE(namco_06xx_0_data_r, namco_06xx_0_data_w)
AM_RANGE(0x9100, 0x9100) AM_READWRITE(namco_06xx_0_ctrl_r, namco_06xx_0_ctrl_w)
@@ -826,13 +825,6 @@ static const namco_52xx_interface namco_52xx_config =
.5 /* Combined gain of both filters */
};
-static const custom_sound_interface custom_interface =
-{
- polepos_sh_start,
- NULL,
- polepos_sh_reset
-};
-
/*********************************************************************
* Machine driver
@@ -890,7 +882,7 @@ static MACHINE_DRIVER_START( polepos )
MDRV_SOUND_ROUTE(0, "left", 0.80)
MDRV_SOUND_ROUTE(1, "right", 0.80)
- MDRV_SOUND_ADD("namco2", NAMCO_52XX, 24576000/16) /* 1.536 MHz */
+ MDRV_SOUND_ADD("namco52", NAMCO_52XX, 24576000/16) /* 1.536 MHz */
MDRV_SOUND_CONFIG(namco_52xx_config)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.80)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.80)
@@ -902,8 +894,7 @@ static MACHINE_DRIVER_START( polepos )
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.90)
/* engine sound */
- MDRV_SOUND_ADD("polepos", CUSTOM, 0)
- MDRV_SOUND_CONFIG(custom_interface)
+ MDRV_SOUND_ADD("polepos", POLEPOS, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.90 * 0.77)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.90 * 0.77)
MACHINE_DRIVER_END
@@ -987,7 +978,7 @@ ROM_START( polepos )
ROM_LOAD( "136014.110", 0x0000, 0x2000, CRC(b5ad4d5f) SHA1(c07e77a050200d6fe9952031f971ca35f4d15ff8) ) /* engine sound */
ROM_LOAD( "136014.111", 0x2000, 0x2000, CRC(8fdd2f6f) SHA1(3818dc94c60cd78c4212ab7a4367cf3d98166ee6) ) /* engine sound */
- ROM_REGION( 0x8000, "namco2", 0 )
+ ROM_REGION( 0x8000, "namco52", 0 )
ROM_LOAD( "pp1_11.2e", 0x0000, 0x2000, CRC(45b9bfeb) SHA1(ff8c690471944d414931fb88666594ef608997f8) ) /* voice */
ROM_LOAD( "pp1_12.2f", 0x2000, 0x2000, CRC(a31b4be5) SHA1(38298093bb97ea8647fe187359cae05b65e1c616) ) /* voice */
ROM_LOAD( "pp1_13.1e", 0x4000, 0x2000, CRC(a4237466) SHA1(88a397276038cc2fc05f2c18472e6b7cef167f2e) ) /* voice */
@@ -1067,7 +1058,7 @@ ROM_START( poleposa )
ROM_LOAD( "136014.110", 0x0000, 0x2000, CRC(b5ad4d5f) SHA1(c07e77a050200d6fe9952031f971ca35f4d15ff8) ) /* engine sound */
ROM_LOAD( "136014.111", 0x2000, 0x2000, CRC(8fdd2f6f) SHA1(3818dc94c60cd78c4212ab7a4367cf3d98166ee6) ) /* engine sound */
- ROM_REGION( 0x6000, "namco2", 0 )
+ ROM_REGION( 0x6000, "namco52", 0 )
ROM_LOAD( "136014.106", 0x0000, 0x2000, CRC(5b4cf05e) SHA1(52342572940489175607bbf5b6cfd05ee9b0f004) ) /* voice */
/* unknown or unused (P)ROM data */
@@ -1144,7 +1135,7 @@ ROM_START( polepos1 )
ROM_LOAD( "136014.110", 0x0000, 0x2000, CRC(b5ad4d5f) SHA1(c07e77a050200d6fe9952031f971ca35f4d15ff8) ) /* engine sound */
ROM_LOAD( "136014.111", 0x2000, 0x2000, CRC(8fdd2f6f) SHA1(3818dc94c60cd78c4212ab7a4367cf3d98166ee6) ) /* engine sound */
- ROM_REGION( 0x6000, "namco2", 0 )
+ ROM_REGION( 0x6000, "namco52", 0 )
ROM_LOAD( "136014.106", 0x0000, 0x2000, CRC(5b4cf05e) SHA1(52342572940489175607bbf5b6cfd05ee9b0f004) ) /* voice */
/* unknown or unused (P)ROM data */
@@ -1319,7 +1310,7 @@ ROM_START( topracer )
ROM_LOAD( "136014.110", 0x0000, 0x2000, CRC(b5ad4d5f) SHA1(c07e77a050200d6fe9952031f971ca35f4d15ff8) ) /* engine sound */
ROM_LOAD( "136014.111", 0x2000, 0x2000, CRC(8fdd2f6f) SHA1(3818dc94c60cd78c4212ab7a4367cf3d98166ee6) ) /* engine sound */
- ROM_REGION( 0x6000, "namco2", 0 )
+ ROM_REGION( 0x6000, "namco52", 0 )
ROM_LOAD( "136014.106", 0x0000, 0x2000, CRC(5b4cf05e) SHA1(52342572940489175607bbf5b6cfd05ee9b0f004) ) /* voice */
/* unknown or unused (P)ROM data */
@@ -1396,7 +1387,7 @@ ROM_START( topracra )
ROM_LOAD( "136014.110", 0x0000, 0x2000, CRC(b5ad4d5f) SHA1(c07e77a050200d6fe9952031f971ca35f4d15ff8) ) /* engine sound */
ROM_LOAD( "136014.111", 0x2000, 0x2000, CRC(8fdd2f6f) SHA1(3818dc94c60cd78c4212ab7a4367cf3d98166ee6) ) /* engine sound */
- ROM_REGION( 0x8000, "namco2", 0 )
+ ROM_REGION( 0x8000, "namco52", 0 )
ROM_LOAD( "pp1_11.2e", 0x0000, 0x2000, CRC(45b9bfeb) SHA1(ff8c690471944d414931fb88666594ef608997f8) ) /* voice */
ROM_LOAD( "pp1_12.2f", 0x2000, 0x2000, CRC(a31b4be5) SHA1(38298093bb97ea8647fe187359cae05b65e1c616) ) /* voice */
ROM_LOAD( "pp1_13.1e", 0x4000, 0x2000, CRC(a4237466) SHA1(88a397276038cc2fc05f2c18472e6b7cef167f2e) ) /* voice */
@@ -1476,7 +1467,7 @@ ROM_START( topracrb )
ROM_LOAD( "tr15.a8", 0x0000, 0x2000, CRC(b5ad4d5f) SHA1(c07e77a050200d6fe9952031f971ca35f4d15ff8) ) /* engine sound */
ROM_LOAD( "tr16.b9", 0x2000, 0x2000, CRC(8fdd2f6f) SHA1(3818dc94c60cd78c4212ab7a4367cf3d98166ee6) ) /* engine sound */
- ROM_REGION( 0x6000, "namco2", 0 )
+ ROM_REGION( 0x6000, "namco52", 0 )
ROM_LOAD( "tr11.b1", 0x0000, 0x2000, CRC(5b4cf05e) SHA1(52342572940489175607bbf5b6cfd05ee9b0f004) ) /* voice */
/* unknown or unused (P)ROM data */
@@ -1557,7 +1548,7 @@ ROM_START( polepos2 )
ROM_LOAD( "136014.181", 0x0000, 0x2000, CRC(7d93bc1c) SHA1(dad7c0aa24aef593c84e21f7f8858ca7ada86364) ) /* engine sound */
ROM_LOAD( "136014.182", 0x2000, 0x2000, CRC(7d93bc1c) SHA1(dad7c0aa24aef593c84e21f7f8858ca7ada86364) ) /* engine sound */
- ROM_REGION( 0x8000, "namco2", 0 )
+ ROM_REGION( 0x8000, "namco52", 0 )
ROM_LOAD( "pp1_11.2e", 0x0000, 0x2000, CRC(45b9bfeb) SHA1(ff8c690471944d414931fb88666594ef608997f8) ) /* voice */
ROM_LOAD( "pp1_12.2f", 0x2000, 0x2000, CRC(a31b4be5) SHA1(38298093bb97ea8647fe187359cae05b65e1c616) ) /* voice */
ROM_LOAD( "pp1_13.1e", 0x4000, 0x2000, CRC(a4237466) SHA1(88a397276038cc2fc05f2c18472e6b7cef167f2e) ) /* voice */
@@ -1641,7 +1632,7 @@ ROM_START( poleps2a )
ROM_LOAD( "136014.181", 0x0000, 0x2000, CRC(7d93bc1c) SHA1(dad7c0aa24aef593c84e21f7f8858ca7ada86364) ) /* engine sound */
ROM_LOAD( "136014.182", 0x2000, 0x2000, CRC(7d93bc1c) SHA1(dad7c0aa24aef593c84e21f7f8858ca7ada86364) ) /* engine sound */
- ROM_REGION( 0x6000, "namco2", 0 )
+ ROM_REGION( 0x6000, "namco52", 0 )
ROM_LOAD( "136014.106", 0x0000, 0x2000, CRC(5b4cf05e) SHA1(52342572940489175607bbf5b6cfd05ee9b0f004) ) /* voice */
/* unknown or unused (P)ROM data */
@@ -1724,7 +1715,7 @@ ROM_START( poleps2b )
ROM_LOAD( "136014.181", 0x0000, 0x2000, CRC(7d93bc1c) SHA1(dad7c0aa24aef593c84e21f7f8858ca7ada86364) ) /* engine sound */
ROM_LOAD( "136014.182", 0x2000, 0x2000, CRC(7d93bc1c) SHA1(dad7c0aa24aef593c84e21f7f8858ca7ada86364) ) /* engine sound */
- ROM_REGION( 0x6000, "namco2", 0 )
+ ROM_REGION( 0x6000, "namco52", 0 )
ROM_LOAD( "136014.106", 0x0000, 0x2000, CRC(5b4cf05e) SHA1(52342572940489175607bbf5b6cfd05ee9b0f004) ) /* voice */
/* unknown or unused (P)ROM data */
diff --git a/src/mame/drivers/policetr.c b/src/mame/drivers/policetr.c
index 5ea8573ee2a..f49b36816d1 100644
--- a/src/mame/drivers/policetr.c
+++ b/src/mame/drivers/policetr.c
@@ -163,8 +163,9 @@ static WRITE32_HANDLER( control_w )
/* toggling BSMT off then on causes a reset */
if (!(old & 0x80000000) && (control_data & 0x80000000))
{
- bsmt2000_data_0_w(space, bsmt_data_bank, 0, 0xffff);
- sndti_reset(SOUND_BSMT2000, 0);
+ const device_config *device = devtag_get_device(space->machine, SOUND, "bmst");
+ bsmt2000_data_w(device, bsmt_data_bank, 0, 0xffff);
+ device_reset(device);
}
/* log any unknown bits */
@@ -180,16 +181,16 @@ static WRITE32_HANDLER( control_w )
*
*************************************/
-static WRITE32_HANDLER( bsmt2000_reg_w )
+static WRITE32_DEVICE_HANDLER( policetr_bsmt2000_reg_w )
{
if (control_data & 0x80000000)
- bsmt2000_data_0_w(space, bsmt_reg, data & 0xffff, mem_mask & 0xffff);
+ bsmt2000_data_w(device, bsmt_reg, data & 0xffff, mem_mask & 0xffff);
else
COMBINE_DATA(&bsmt_data_offset);
}
-static WRITE32_HANDLER( bsmt2000_data_w )
+static WRITE32_HANDLER( policetr_bsmt2000_data_w )
{
if (control_data & 0x80000000)
COMBINE_DATA(&bsmt_reg);
@@ -281,8 +282,8 @@ static ADDRESS_MAP_START( policetr_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x00400000, 0x00400003) AM_READ(policetr_video_r)
AM_RANGE(0x00500000, 0x00500003) AM_WRITENOP // copies ROM here at startup, plus checksum
AM_RANGE(0x00600000, 0x00600003) AM_READ(bsmt2000_data_r)
- AM_RANGE(0x00700000, 0x00700003) AM_WRITE(bsmt2000_reg_w)
- AM_RANGE(0x00800000, 0x00800003) AM_WRITE(bsmt2000_data_w)
+ AM_RANGE(0x00700000, 0x00700003) AM_DEVWRITE(SOUND, "bsmt", policetr_bsmt2000_reg_w)
+ AM_RANGE(0x00800000, 0x00800003) AM_WRITE(policetr_bsmt2000_data_w)
AM_RANGE(0x00900000, 0x00900003) AM_WRITE(policetr_palette_offset_w)
AM_RANGE(0x00920000, 0x00920003) AM_WRITE(policetr_palette_data_w)
AM_RANGE(0x00a00000, 0x00a00003) AM_WRITE(control_w)
@@ -296,13 +297,13 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sshooter_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x00000000, 0x0001ffff) AM_RAM AM_BASE(&policetr_rambase)
- AM_RANGE(0x00200000, 0x00200003) AM_WRITE(bsmt2000_data_w)
+ AM_RANGE(0x00200000, 0x00200003) AM_WRITE(policetr_bsmt2000_data_w)
AM_RANGE(0x00300000, 0x00300003) AM_WRITE(policetr_palette_offset_w)
AM_RANGE(0x00320000, 0x00320003) AM_WRITE(policetr_palette_data_w)
AM_RANGE(0x00400000, 0x00400003) AM_READ(policetr_video_r)
AM_RANGE(0x00500000, 0x00500003) AM_WRITENOP // copies ROM here at startup, plus checksum
AM_RANGE(0x00600000, 0x00600003) AM_READ(bsmt2000_data_r)
- AM_RANGE(0x00700000, 0x00700003) AM_WRITE(bsmt2000_reg_w)
+ AM_RANGE(0x00700000, 0x00700003) AM_DEVWRITE(SOUND, "bsmt", policetr_bsmt2000_reg_w)
AM_RANGE(0x00800000, 0x0080000f) AM_WRITE(policetr_video_w)
AM_RANGE(0x00a00000, 0x00a00003) AM_WRITE(control_w)
AM_RANGE(0x00a00000, 0x00a00003) AM_READ_PORT("IN0")
diff --git a/src/mame/drivers/polyplay.c b/src/mame/drivers/polyplay.c
index 9137e6d3d06..93719811494 100644
--- a/src/mame/drivers/polyplay.c
+++ b/src/mame/drivers/polyplay.c
@@ -119,9 +119,9 @@ static MACHINE_RESET( polyplay )
channel2_const = 0;
polyplay_set_channel1(0);
- polyplay_play_channel1(0);
+ polyplay_play_channel1(machine, 0);
polyplay_set_channel2(0);
- polyplay_play_channel2(0);
+ polyplay_play_channel2(machine, 0);
polyplay_timer = timer_alloc(machine, polyplay_timer_callback, NULL);
}
@@ -192,7 +192,7 @@ static WRITE8_HANDLER( polyplay_sound_channel )
polyplay_set_channel1(0);
}
channel1_const = 0;
- polyplay_play_channel1(data*prescale1);
+ polyplay_play_channel1(space->machine, data*prescale1);
}
else {
@@ -203,7 +203,7 @@ static WRITE8_HANDLER( polyplay_sound_channel )
}
if ((data == 0x41) || (data == 0x65) || (data == 0x45)) {
polyplay_set_channel1(0);
- polyplay_play_channel1(0);
+ polyplay_play_channel1(space->machine, 0);
}
}
break;
@@ -213,7 +213,7 @@ static WRITE8_HANDLER( polyplay_sound_channel )
polyplay_set_channel2(0);
}
channel2_const = 0;
- polyplay_play_channel2(data*prescale2);
+ polyplay_play_channel2(space->machine, data*prescale2);
}
else {
@@ -224,7 +224,7 @@ static WRITE8_HANDLER( polyplay_sound_channel )
}
if ((data == 0x41) || (data == 0x65) || (data == 0x45)) {
polyplay_set_channel2(0);
- polyplay_play_channel2(0);
+ polyplay_play_channel2(space->machine, 0);
}
}
break;
diff --git a/src/mame/drivers/poolshrk.c b/src/mame/drivers/poolshrk.c
index 618b3af355b..bb6f0d7c9e6 100644
--- a/src/mame/drivers/poolshrk.c
+++ b/src/mame/drivers/poolshrk.c
@@ -105,12 +105,12 @@ static ADDRESS_MAP_START( poolshrk_cpu_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0800, 0x080f) AM_MIRROR(0x23f0) AM_WRITE(SMH_RAM) AM_BASE(&poolshrk_hpos_ram)
AM_RANGE(0x0c00, 0x0c0f) AM_MIRROR(0x23f0) AM_WRITE(SMH_RAM) AM_BASE(&poolshrk_vpos_ram)
AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x2000) AM_READWRITE(poolshrk_input_r, poolshrk_watchdog_w)
- AM_RANGE(0x1400, 0x17ff) AM_MIRROR(0x2000) AM_WRITE(poolshrk_scratch_sound_w)
- AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x2000) AM_WRITE(poolshrk_score_sound_w)
- AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x2000) AM_WRITE(poolshrk_click_sound_w)
+ AM_RANGE(0x1400, 0x17ff) AM_MIRROR(0x2000) AM_DEVWRITE(SOUND, "discrete", poolshrk_scratch_sound_w)
+ AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x2000) AM_DEVWRITE(SOUND, "discrete", poolshrk_score_sound_w)
+ AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x2000) AM_DEVWRITE(SOUND, "discrete", poolshrk_click_sound_w)
AM_RANGE(0x4000, 0x4000) AM_NOP /* diagnostic ROM location */
AM_RANGE(0x6000, 0x63ff) AM_WRITE(poolshrk_da_latch_w)
- AM_RANGE(0x6400, 0x67ff) AM_WRITE(poolshrk_bump_sound_w)
+ AM_RANGE(0x6400, 0x67ff) AM_DEVWRITE(SOUND, "discrete", poolshrk_bump_sound_w)
AM_RANGE(0x6800, 0x6bff) AM_READ(poolshrk_irq_reset_r)
AM_RANGE(0x6c00, 0x6fff) AM_WRITE(poolshrk_led_w)
AM_RANGE(0x7000, 0x7fff) AM_ROM
diff --git a/src/mame/drivers/popeye.c b/src/mame/drivers/popeye.c
index 0ffd48a31e6..c7c915ebdca 100644
--- a/src/mame/drivers/popeye.c
+++ b/src/mame/drivers/popeye.c
@@ -147,10 +147,11 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READ_PORT("P1") AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READ_PORT("P2") AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0x00, 0x00) AM_READ_PORT("P1")
+ AM_RANGE(0x01, 0x01) AM_READ_PORT("P2")
AM_RANGE(0x02, 0x02) AM_READ_PORT("IN0")
- AM_RANGE(0x03, 0x03) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0x03, 0x03) AM_DEVREAD(SOUND, "ay", ay8910_r)
ADDRESS_MAP_END
@@ -434,22 +435,22 @@ GFXDECODE_END
static int dswbit;
-static WRITE8_HANDLER( popeye_portB_w )
+static WRITE8_DEVICE_HANDLER( popeye_portB_w )
{
/* bit 0 flips screen */
- flip_screen_set(space->machine, data & 1);
+ flip_screen_set(device->machine, data & 1);
/* bits 1-3 select DSW1 bit to read */
dswbit = (data & 0x0e) >> 1;
}
-static READ8_HANDLER( popeye_portA_r )
+static READ8_DEVICE_HANDLER( popeye_portA_r )
{
int res;
- res = input_port_read(space->machine, "DSW0");
- res |= (input_port_read(space->machine, "DSW1") << (7-dswbit)) & 0x80;
+ res = input_port_read(device->machine, "DSW0");
+ res |= (input_port_read(device->machine, "DSW1") << (7-dswbit)) & 0x80;
return res;
}
@@ -458,10 +459,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- popeye_portA_r,
- NULL,
- NULL,
- popeye_portB_w
+ DEVCB_HANDLER(popeye_portA_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(popeye_portB_w)
};
diff --git a/src/mame/drivers/popper.c b/src/mame/drivers/popper.c
index 12d53109c3e..93f11037042 100644
--- a/src/mame/drivers/popper.c
+++ b/src/mame/drivers/popper.c
@@ -199,11 +199,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( popper_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_WRITE(SMH_ROM)
- AM_RANGE(0x8000, 0x8000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x8001, 0x8001) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x8000, 0x8001) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
AM_RANGE(0x8002, 0x8002) AM_WRITE(SMH_NOP) //?? same writes as 0x8000 (mostly)
- AM_RANGE(0xa000, 0xa000) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0xa001, 0xa001) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0xa000, 0xa001) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
AM_RANGE(0xa002, 0xa002) AM_WRITE(SMH_NOP) //?? same writes as 0xa000
AM_RANGE(0xd800, 0xdfff) AM_WRITE(popper_sharedram_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/powerbal.c b/src/mame/drivers/powerbal.c
index e10868b0729..de6dbe6f4cc 100644
--- a/src/mame/drivers/powerbal.c
+++ b/src/mame/drivers/powerbal.c
@@ -89,14 +89,14 @@ static WRITE16_HANDLER( tile_banking_w )
}
}
-static WRITE16_HANDLER( oki_banking )
+static WRITE16_DEVICE_HANDLER( oki_banking )
{
if(data & 3)
{
int addr = 0x40000 * ((data & 3) - 1);
- if(addr < memory_region_length(space->machine, "oki"))
- okim6295_set_bank_base(0, addr);
+ if(addr < memory_region_length(device->machine, "oki"))
+ okim6295_set_bank_base(device, addr);
}
}
@@ -112,8 +112,8 @@ static ADDRESS_MAP_START( magicstk_main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x0c2014, 0x0c2015) AM_READ_PORT("IN2") AM_WRITE(magicstk_coin_eeprom_w)
AM_RANGE(0x0c2016, 0x0c2017) AM_READ_PORT("DSW1")
AM_RANGE(0x0c2018, 0x0c2019) AM_READ_PORT("DSW2")
- AM_RANGE(0x0c201c, 0x0c201d) AM_WRITE(oki_banking)
- AM_RANGE(0x0c201e, 0x0c201f) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x0c201c, 0x0c201d) AM_DEVWRITE(SOUND, "oki", oki_banking)
+ AM_RANGE(0x0c201e, 0x0c201f) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x0c4000, 0x0c4001) AM_WRITENOP
AM_RANGE(0x0e0000, 0x0fffff) AM_RAM
AM_RANGE(0x100000, 0x100fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
@@ -132,8 +132,8 @@ static ADDRESS_MAP_START( powerbal_main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x0c2014, 0x0c2015) AM_READ_PORT("IN2")
AM_RANGE(0x0c2016, 0x0c2017) AM_READ_PORT("DSW1")
AM_RANGE(0x0c2018, 0x0c2019) AM_READ_PORT("DSW2")
- AM_RANGE(0x0c201c, 0x0c201d) AM_WRITE(oki_banking)
- AM_RANGE(0x0c201e, 0x0c201f) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x0c201c, 0x0c201d) AM_DEVWRITE(SOUND, "oki", oki_banking)
+ AM_RANGE(0x0c201e, 0x0c201f) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x0c4000, 0x0c4001) AM_WRITENOP
AM_RANGE(0x0f0000, 0x0fffff) AM_RAM
AM_RANGE(0x101000, 0x101fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
diff --git a/src/mame/drivers/powerins.c b/src/mame/drivers/powerins.c
index e943c03a55c..2cd51c4e4c6 100644
--- a/src/mame/drivers/powerins.c
+++ b/src/mame/drivers/powerins.c
@@ -93,7 +93,7 @@ static ADDRESS_MAP_START( powerins_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x100002, 0x100003) AM_READ_PORT("P1_P2")
AM_RANGE(0x100008, 0x100009) AM_READ_PORT("DSW1")
AM_RANGE(0x10000a, 0x10000b) AM_READ_PORT("DSW2")
- AM_RANGE(0x10003e, 0x10003f) AM_READ(okim6295_status_0_lsb_r) // OKI Status (used by powerina)
+ AM_RANGE(0x10003e, 0x10003f) AM_DEVREAD8(SOUND, "oki1", okim6295_r, 0x00ff) // OKI Status (used by powerina)
AM_RANGE(0x120000, 0x120fff) AM_READ(SMH_RAM ) // Palette
AM_RANGE(0x130000, 0x130007) AM_READ(SMH_RAM ) // VRAM 0 Control
AM_RANGE(0x140000, 0x143fff) AM_READ(SMH_RAM ) // VRAM 0
@@ -108,7 +108,7 @@ static ADDRESS_MAP_START( powerins_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x100018, 0x100019) AM_WRITE(powerins_tilebank_w ) // Tiles Banking (VRAM 0)
AM_RANGE(0x10001e, 0x10001f) AM_WRITE(powerins_soundlatch_w ) // Sound Latch
AM_RANGE(0x100030, 0x100031) AM_WRITE(powerins_okibank_w ) // Sound
- AM_RANGE(0x10003e, 0x10003f) AM_WRITE(okim6295_data_0_lsb_w ) // used by powerina
+ AM_RANGE(0x10003e, 0x10003f) AM_DEVWRITE8(SOUND, "oki1", okim6295_w, 0x00ff ) // used by powerina
AM_RANGE(0x120000, 0x120fff) AM_WRITE(powerins_paletteram16_w) AM_BASE(&paletteram16 ) // Palette
AM_RANGE(0x130000, 0x130007) AM_WRITE(SMH_RAM) AM_BASE(&powerins_vctrl_0 ) // VRAM 0 Control
AM_RANGE(0x140000, 0x143fff) AM_WRITE(powerins_vram_0_w) AM_BASE(&powerins_vram_0 ) // VRAM 0
@@ -136,10 +136,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( powerins_io_snd, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
- AM_RANGE(0x80, 0x80) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
- AM_RANGE(0x88, 0x88) AM_READWRITE(okim6295_status_1_r, okim6295_data_1_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym2203", ym2203_r, ym2203_w)
+ AM_RANGE(0x80, 0x80) AM_DEVREADWRITE(SOUND, "oki1", okim6295_r, okim6295_w)
+ AM_RANGE(0x88, 0x88) AM_DEVREADWRITE(SOUND, "oki2", okim6295_r, okim6295_w)
AM_RANGE(0x90, 0x97) AM_WRITE(NMK112_okibank_w)
ADDRESS_MAP_END
@@ -147,8 +146,8 @@ static ADDRESS_MAP_START( powerinb_io_snd, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_READWRITE(powerinb_fake_ym2203_r, SMH_NOP)
AM_RANGE(0x01, 0x01) AM_NOP
- AM_RANGE(0x80, 0x80) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
- AM_RANGE(0x88, 0x88) AM_READWRITE(okim6295_status_1_r, okim6295_data_1_w)
+ AM_RANGE(0x80, 0x80) AM_DEVREADWRITE(SOUND, "oki1", okim6295_r, okim6295_w)
+ AM_RANGE(0x88, 0x88) AM_DEVREADWRITE(SOUND, "oki2", okim6295_r, okim6295_w)
AM_RANGE(0x90, 0x97) AM_WRITE(NMK112_okibank_w)
ADDRESS_MAP_END
@@ -334,9 +333,9 @@ static MACHINE_RESET( powerins )
}
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface ym2203_config =
@@ -344,7 +343,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL,
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,
},
irqhandler
};
diff --git a/src/mame/drivers/ppmast93.c b/src/mame/drivers/ppmast93.c
index 012a63856df..abf4c4a2491 100644
--- a/src/mame/drivers/ppmast93.c
+++ b/src/mame/drivers/ppmast93.c
@@ -195,9 +195,9 @@ static WRITE8_HANDLER(ppmast_sound_w)
{
switch(offset&0xff)
{
- case 0: ym2413_register_port_0_w(space,0,data); break;
- case 1: ym2413_data_port_0_w(space,0,data); break;
- case 2: dac_0_data_w(space,0,data);break;
+ case 0:
+ case 1: ym2413_w(devtag_get_device(space->machine, SOUND, "ym"),offset,data); break;
+ case 2: dac_data_w(devtag_get_device(space->machine, SOUND, "dac"),data);break;
default: logerror("%x %x - %x\n",offset,data,cpu_get_previouspc(space->cpu));
}
}
diff --git a/src/mame/drivers/prehisle.c b/src/mame/drivers/prehisle.c
index c66735335f2..8fabf5eb4c4 100644
--- a/src/mame/drivers/prehisle.c
+++ b/src/mame/drivers/prehisle.c
@@ -48,11 +48,16 @@ ADDRESS_MAP_END
/******************************************************************************/
-static WRITE8_HANDLER( D7759_write_port_0_w )
+static WRITE8_DEVICE_HANDLER( D7759_write_port_0_w )
{
- upd7759_port_w(offset,data);
- upd7759_start_w (0,0);
- upd7759_start_w (0,1);
+ upd7759_port_w(device, 0, data);
+ upd7759_start_w(device, 0);
+ upd7759_start_w(device, 1);
+}
+
+static WRITE8_DEVICE_HANDLER( D7759_upd_reset_w )
+{
+ upd7759_reset_w(device, data & 1);
}
static ADDRESS_MAP_START( prehisle_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
@@ -64,10 +69,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( prehisle_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0x20, 0x20) AM_WRITE(ym3812_write_port_0_w)
- AM_RANGE(0x40, 0x40) AM_WRITE(D7759_write_port_0_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(upd7759_0_reset_w)
+ AM_RANGE(0x00, 0x00) AM_DEVREADWRITE(SOUND, "ym", ym3812_status_port_r, ym3812_control_port_w)
+ AM_RANGE(0x20, 0x20) AM_DEVWRITE(SOUND, "ym", ym3812_write_port_w)
+ AM_RANGE(0x40, 0x40) AM_DEVWRITE(SOUND, "upd", D7759_write_port_0_w)
+ AM_RANGE(0x80, 0x80) AM_DEVWRITE(SOUND, "upd", D7759_upd_reset_w)
ADDRESS_MAP_END
/******************************************************************************/
@@ -195,9 +200,9 @@ GFXDECODE_END
/******************************************************************************/
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym3812_interface ym3812_config =
diff --git a/src/mame/drivers/progolf.c b/src/mame/drivers/progolf.c
index 1b9ab5e3df1..f300c74ff64 100644
--- a/src/mame/drivers/progolf.c
+++ b/src/mame/drivers/progolf.c
@@ -68,10 +68,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_cpu, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_RAM
- AM_RANGE(0x4000, 0x4fff) AM_READWRITE(ay8910_read_port_0_r,ay8910_write_port_0_w)
- AM_RANGE(0x5000, 0x5fff) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x6000, 0x6fff) AM_READWRITE(ay8910_read_port_1_r,ay8910_write_port_1_w)
- AM_RANGE(0x7000, 0x7fff) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0x4000, 0x4fff) AM_DEVREADWRITE(SOUND, "ay1", ay8910_r, ay8910_data_w)
+ AM_RANGE(0x5000, 0x5fff) AM_DEVWRITE(SOUND, "ay1", ay8910_address_w)
+ AM_RANGE(0x6000, 0x6fff) AM_DEVREADWRITE(SOUND, "ay2", ay8910_r, ay8910_data_w)
+ AM_RANGE(0x7000, 0x7fff) AM_DEVWRITE(SOUND, "ay2", ay8910_address_w)
// AM_RANGE(0x8000, 0x8fff) AM_WRITE(interrupt_enable_w) //???
AM_RANGE(0x9000, 0xafff) AM_READ(soundlatch_r)
AM_RANGE(0xf000, 0xffff) AM_ROM
diff --git a/src/mame/drivers/psikyo.c b/src/mame/drivers/psikyo.c
index 76a0f5d8066..52f43c90394 100644
--- a/src/mame/drivers/psikyo.c
+++ b/src/mame/drivers/psikyo.c
@@ -376,9 +376,9 @@ ADDRESS_MAP_END
***************************************************************************/
-static void sound_irq( running_machine *machine, int irq )
+static void sound_irq( const device_config *device, int irq )
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static READ8_HANDLER( psikyo_soundlatch_r )
@@ -418,10 +418,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sngkace_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym2610_status_port_0_a_r, ym2610_control_port_0_a_w )
- AM_RANGE(0x01, 0x01) AM_WRITE(ym2610_data_port_0_a_w )
- AM_RANGE(0x02, 0x02) AM_READWRITE(ym2610_status_port_0_b_r, ym2610_control_port_0_b_w )
- AM_RANGE(0x03, 0x03) AM_WRITE(ym2610_data_port_0_b_w )
+ AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(SOUND, "ym", ym2610_r, ym2610_w )
AM_RANGE(0x04, 0x04) AM_WRITE(sngkace_sound_bankswitch_w )
AM_RANGE(0x08, 0x08) AM_READ(psikyo_soundlatch_r )
AM_RANGE(0x0c, 0x0c) AM_WRITE(psikyo_clear_nmi_w )
@@ -457,10 +454,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( gunbird_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(gunbird_sound_bankswitch_w )
- AM_RANGE(0x04, 0x04) AM_READWRITE(ym2610_status_port_0_a_r, ym2610_control_port_0_a_w )
- AM_RANGE(0x05, 0x05) AM_WRITE(ym2610_data_port_0_a_w )
- AM_RANGE(0x06, 0x06) AM_READWRITE(ym2610_status_port_0_b_r, ym2610_control_port_0_b_w )
- AM_RANGE(0x07, 0x07) AM_WRITE(ym2610_data_port_0_b_w )
+ AM_RANGE(0x04, 0x07) AM_DEVREADWRITE(SOUND, "ym", ym2610_r, ym2610_w )
AM_RANGE(0x08, 0x08) AM_READ(psikyo_soundlatch_r )
AM_RANGE(0x0c, 0x0c) AM_WRITE(psikyo_clear_nmi_w )
ADDRESS_MAP_END
@@ -473,12 +467,7 @@ static ADDRESS_MAP_START( s1945_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(gunbird_sound_bankswitch_w )
AM_RANGE(0x02, 0x03) AM_WRITE(SMH_NOP )
- AM_RANGE(0x08, 0x08) AM_READWRITE(ymf278b_status_port_0_r, ymf278b_control_port_0_a_w )
- AM_RANGE(0x09, 0x09) AM_WRITE(ymf278b_data_port_0_a_w )
- AM_RANGE(0x0a, 0x0a) AM_WRITE(ymf278b_control_port_0_b_w )
- AM_RANGE(0x0b, 0x0b) AM_WRITE(ymf278b_data_port_0_b_w )
- AM_RANGE(0x0c, 0x0c) AM_WRITE(ymf278b_control_port_0_c_w )
- AM_RANGE(0x0d, 0x0d) AM_WRITE(ymf278b_data_port_0_c_w )
+ AM_RANGE(0x08, 0x0d) AM_DEVREADWRITE(SOUND, "ymf", ymf278b_r, ymf278b_w )
AM_RANGE(0x10, 0x10) AM_READ(psikyo_soundlatch_r )
AM_RANGE(0x18, 0x18) AM_WRITE(psikyo_clear_nmi_w )
ADDRESS_MAP_END
@@ -1312,12 +1301,12 @@ MACHINE_DRIVER_END
***************************************************************************/
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
if (linestate)
- cpu_set_input_line(machine->cpu[1], 0, ASSERT_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, ASSERT_LINE);
else
- cpu_set_input_line(machine->cpu[1], 0, CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, CLEAR_LINE);
}
static const ymf278b_interface ymf278b_config =
diff --git a/src/mame/drivers/psikyo4.c b/src/mame/drivers/psikyo4.c
index 302215132b4..a44e256add8 100644
--- a/src/mame/drivers/psikyo4.c
+++ b/src/mame/drivers/psikyo4.c
@@ -363,54 +363,6 @@ static READ32_HANDLER( ps4_sample_r ) /* Send sample data for test */
}
#endif
-static READ32_HANDLER( psh_ymf_fm_r )
-{
- return ymf278b_status_port_0_r(space, 0)<<24; /* Also, bit 0 being high indicates not ready to send sample data for test */
-}
-
-static WRITE32_HANDLER( psh_ymf_fm_w )
-{
- if (ACCESSING_BITS_24_31) // FM bank 1 address (OPL2/OPL3 compatible)
- {
- ymf278b_control_port_0_a_w(space, 0, data>>24);
- }
-
- if (ACCESSING_BITS_16_23) // FM bank 1 data
- {
- ymf278b_data_port_0_a_w(space, 0, data>>16);
- }
-
- if (ACCESSING_BITS_8_15) // FM bank 2 address (OPL3/YMF 262 extended)
- {
- ymf278b_control_port_0_b_w(space, 0, data>>8);
- }
-
- if (ACCESSING_BITS_0_7) // FM bank 2 data
- {
- ymf278b_data_port_0_b_w(space, 0, data);
- }
-}
-
-static WRITE32_HANDLER( psh_ymf_pcm_w )
-{
- if (ACCESSING_BITS_24_31) // PCM address (OPL4/YMF 278B extended)
- {
- ymf278b_control_port_0_c_w(space, 0, data>>24);
-
-#if ROMTEST
- if (data>>24 == 0x06) // Reset Sample reading (They always write this code immediately before reading data)
- {
- sample_offs = 0;
- }
-#endif
- }
-
- if (ACCESSING_BITS_16_23) // PCM data
- {
- ymf278b_data_port_0_c_w(space, 0, data>>16);
- }
-}
-
#define PCM_BANK_NO(n) ((ps4_io_select[0] >> (n * 4 + 24)) & 0x07)
static void set_hotgmck_pcm_bank(running_machine *machine, int n)
@@ -447,7 +399,7 @@ static ADDRESS_MAP_START( ps4_readmem, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x03003fe4, 0x03003fe7) AM_READ(SMH_NOP) // also writes to this address - might be vblank?
// AM_RANGE(0x03003fe8, 0x03003fef) AM_READ(SMH_RAM) // vid regs?
AM_RANGE(0x03004000, 0x03005fff) AM_READ(SMH_RAM)
- AM_RANGE(0x05000000, 0x05000003) AM_READ(psh_ymf_fm_r) // read YMF status
+ AM_RANGE(0x05000000, 0x05000003) AM_DEVREAD8(SOUND, "ymf", ymf278b_r, 0xffffffff) // read YMF status
AM_RANGE(0x05800000, 0x05800003) AM_READ_PORT("P1_P2")
AM_RANGE(0x05800004, 0x05800007) AM_READ_PORT("P3_P4")
AM_RANGE(0x06000000, 0x060fffff) AM_READ(SMH_RAM) // main RAM (1 meg)
@@ -469,18 +421,17 @@ static ADDRESS_MAP_START( ps4_writemem, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x03003ff8, 0x03003ffb) AM_WRITE(ps4_screen2_brt_w) // screen 2 brightness
AM_RANGE(0x03003ffc, 0x03003fff) AM_WRITE(ps4_bgpen_2_dword_w) AM_BASE(&bgpen_2) // screen 2 clear colour
AM_RANGE(0x03004000, 0x03005fff) AM_WRITE(ps4_paletteram32_RRRRRRRRGGGGGGGGBBBBBBBBxxxxxxxx_dword_w) AM_BASE(&paletteram32) // palette
- AM_RANGE(0x05000000, 0x05000003) AM_WRITE(psh_ymf_fm_w) // first 2 OPL4 register banks
- AM_RANGE(0x05000004, 0x05000007) AM_WRITE(psh_ymf_pcm_w) // third OPL4 register bank
+ AM_RANGE(0x05000000, 0x05000007) AM_DEVWRITE8(SOUND, "ymf", ymf278b_w, 0xffffffff)
AM_RANGE(0x05800008, 0x0580000b) AM_WRITE(SMH_RAM) AM_BASE(&ps4_io_select) // Used by Mahjong games to choose input (also maps normal loderndf inputs to offsets)
AM_RANGE(0x06000000, 0x060fffff) AM_WRITE(SMH_RAM) AM_BASE(&ps4_ram) // work RAM
ADDRESS_MAP_END
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
if (linestate)
- cpu_set_input_line(machine->cpu[0], 12, ASSERT_LINE);
+ cpu_set_input_line(device->machine->cpu[0], 12, ASSERT_LINE);
else
- cpu_set_input_line(machine->cpu[0], 12, CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[0], 12, CLEAR_LINE);
}
static const ymf278b_interface ymf278b_config =
diff --git a/src/mame/drivers/psikyosh.c b/src/mame/drivers/psikyosh.c
index 9a73e21a64c..64b9cd03089 100644
--- a/src/mame/drivers/psikyosh.c
+++ b/src/mame/drivers/psikyosh.c
@@ -478,53 +478,6 @@ static READ32_HANDLER( psh_sample_r ) /* Send sample data for test */
}
#endif
-static READ32_HANDLER( psh_ymf_fm_r )
-{
- return ymf278b_status_port_0_r(space,0)<<24; /* Also, bit 0 being high indicates not ready to send sample data for test */
-}
-
-static WRITE32_HANDLER( psh_ymf_fm_w )
-{
- if (ACCESSING_BITS_24_31) // FM bank 1 address (OPL2/OPL3 compatible)
- {
- ymf278b_control_port_0_a_w(space, 0, data>>24);
- }
-
- if (ACCESSING_BITS_16_23) // FM bank 1 data
- {
- ymf278b_data_port_0_a_w(space, 0, data>>16);
- }
-
- if (ACCESSING_BITS_8_15) // FM bank 2 address (OPL3/YMF 262 extended)
- {
- ymf278b_control_port_0_b_w(space, 0, data>>8);
- }
-
- if (ACCESSING_BITS_0_7) // FM bank 2 data
- {
- ymf278b_data_port_0_b_w(space, 0, data);
- }
-}
-
-static WRITE32_HANDLER( psh_ymf_pcm_w )
-{
- if (ACCESSING_BITS_24_31) // PCM address (OPL4/YMF 278B extended)
- {
- ymf278b_control_port_0_c_w(space, 0, data>>24);
-
-#if ROMTEST
- if (data>>24 == 0x06) // Reset Sample reading (They always write this code immediately before reading data)
- {
- sample_offs = 0;
- }
-#endif
- }
-
- if (ACCESSING_BITS_16_23) // PCM data
- {
- ymf278b_data_port_0_c_w(space, 0, data>>16);
- }
-}
static ADDRESS_MAP_START( ps3v1_readmem, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x00000000, 0x000fffff) AM_READ(SMH_ROM) // program ROM (1 meg)
@@ -535,7 +488,7 @@ static ADDRESS_MAP_START( ps3v1_readmem, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x03050000, 0x030501ff) AM_READ(SMH_RAM)
AM_RANGE(0x0305ffdc, 0x0305ffdf) AM_READ(SMH_NOP) // also writes to this address - might be vblank reads?
AM_RANGE(0x0305ffe0, 0x0305ffff) AM_READ(SMH_RAM) // video registers
- AM_RANGE(0x05000000, 0x05000003) AM_READ(psh_ymf_fm_r) // read YMF status
+ AM_RANGE(0x05000000, 0x05000003) AM_DEVREAD8(SOUND, "ymf", ymf278b_r, 0xffffffff) // read YMF status
AM_RANGE(0x05800000, 0x05800003) AM_READ_PORT("INPUTS")
AM_RANGE(0x05800004, 0x05800007) AM_READ(psh_eeprom_r)
AM_RANGE(0x06000000, 0x060fffff) AM_READ(SMH_RAM) // main RAM (1 meg)
@@ -556,8 +509,7 @@ static ADDRESS_MAP_START( ps3v1_writemem, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x03050000, 0x030501ff) AM_WRITE(SMH_RAM) AM_BASE(&psikyosh_zoomram) // a gradient sometimes ...
AM_RANGE(0x0305ffdc, 0x0305ffdf) AM_WRITE(psikyosh_irqctrl_w)
AM_RANGE(0x0305ffe0, 0x0305ffff) AM_WRITE(psikyosh_vidregs_w) AM_BASE(&psikyosh_vidregs) // video registers
- AM_RANGE(0x05000000, 0x05000003) AM_WRITE(psh_ymf_fm_w) // first 2 OPL4 register banks
- AM_RANGE(0x05000004, 0x05000007) AM_WRITE(psh_ymf_pcm_w) // third OPL4 register bank
+ AM_RANGE(0x05000000, 0x05000007) AM_DEVWRITE8(SOUND, "ymf", ymf278b_w, 0xffffffff)
AM_RANGE(0x05800004, 0x05800007) AM_WRITE(psh_eeprom_w)
AM_RANGE(0x06000000, 0x060fffff) AM_WRITE(SMH_RAM) AM_BASE(&psh_ram) // work RAM
ADDRESS_MAP_END
@@ -566,7 +518,7 @@ static ADDRESS_MAP_START( ps5_readmem, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x00000000, 0x000fffff) AM_READ(SMH_ROM) // program ROM (1 meg)
AM_RANGE(0x03000000, 0x03000003) AM_READ_PORT("INPUTS")
AM_RANGE(0x03000004, 0x03000007) AM_READ_PORT("JP4")
- AM_RANGE(0x03100000, 0x03100003) AM_READ(psh_ymf_fm_r)
+ AM_RANGE(0x03100000, 0x03100003) AM_DEVREAD8(SOUND, "ymf", ymf278b_r, 0xffffffff)
AM_RANGE(0x04000000, 0x04003fff) AM_READ(SMH_RAM) // sprites
AM_RANGE(0x04004000, 0x0400ffff) AM_READ(SMH_RAM)
AM_RANGE(0x04040000, 0x04044fff) AM_READ(SMH_RAM)
@@ -585,8 +537,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( ps5_writemem, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x00000000, 0x000fffff) AM_WRITE(SMH_ROM) // program ROM (1 meg)
AM_RANGE(0x03000004, 0x03000007) AM_WRITE(psh_eeprom_w)
- AM_RANGE(0x03100000, 0x03100003) AM_WRITE(psh_ymf_fm_w) // first 2 OPL4 register banks
- AM_RANGE(0x03100004, 0x03100007) AM_WRITE(psh_ymf_pcm_w) // third OPL4 register bank
+ AM_RANGE(0x03100000, 0x03100007) AM_DEVWRITE8(SOUND, "ymf", ymf278b_w, 0xffffffff)
AM_RANGE(0x04000000, 0x04003fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram32) AM_SIZE(&spriteram_size)
AM_RANGE(0x04004000, 0x0400ffff) AM_WRITE(SMH_RAM) AM_BASE(&psikyosh_bgram) // backgrounds
AM_RANGE(0x04040000, 0x04044fff) AM_WRITE(paletteram32_RRRRRRRRGGGGGGGGBBBBBBBBxxxxxxxx_dword_w) AM_BASE(&paletteram32)
@@ -597,12 +548,12 @@ static ADDRESS_MAP_START( ps5_writemem, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x06000000, 0x060fffff) AM_WRITE(SMH_RAM) AM_BASE(&psh_ram)
ADDRESS_MAP_END
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
if (linestate)
- cpu_set_input_line(machine->cpu[0], 12, ASSERT_LINE);
+ cpu_set_input_line(device->machine->cpu[0], 12, ASSERT_LINE);
else
- cpu_set_input_line(machine->cpu[0], 12, CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[0], 12, CLEAR_LINE);
}
static const ymf278b_interface ymf278b_config =
diff --git a/src/mame/drivers/psychic5.c b/src/mame/drivers/psychic5.c
index 72d0ccb9b10..402f7b11bd7 100644
--- a/src/mame/drivers/psychic5.c
+++ b/src/mame/drivers/psychic5.c
@@ -448,10 +448,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( psychic5_soundport_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ym2203_control_port_1_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "ym2", ym2203_w)
ADDRESS_MAP_END
@@ -483,10 +481,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( bombsa_soundport_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
- AM_RANGE(0x80, 0x80) AM_READWRITE(ym2203_status_port_1_r, ym2203_control_port_1_w)
- AM_RANGE(0x81, 0x81) AM_READWRITE(ym2203_read_port_1_r, ym2203_write_port_1_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym1", ym2203_r, ym2203_w)
+ AM_RANGE(0x80, 0x81) AM_DEVREADWRITE(SOUND, "ym2", ym2203_r, ym2203_w)
ADDRESS_MAP_END
@@ -666,9 +662,9 @@ GFXDECODE_END
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface ym2203_config =
@@ -676,7 +672,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
irqhandler
};
diff --git a/src/mame/drivers/pturn.c b/src/mame/drivers/pturn.c
index 6bd9cdf83a8..45903ed3e91 100644
--- a/src/mame/drivers/pturn.c
+++ b/src/mame/drivers/pturn.c
@@ -312,10 +312,8 @@ static ADDRESS_MAP_START( sub_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x2000, 0x23ff) AM_RAM
AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r) AM_WRITE(nmi_sub_enable_w)
AM_RANGE(0x4000, 0x4000) AM_RAM
- AM_RANGE(0x5000, 0x5000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x5001, 0x5001) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x6000, 0x6000) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x6001, 0x6001) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0x5000, 0x5001) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x6000, 0x6001) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
ADDRESS_MAP_END
static const gfx_layout charlayout =
diff --git a/src/mame/drivers/puckpkmn.c b/src/mame/drivers/puckpkmn.c
index d99d13df26b..3f489df7188 100644
--- a/src/mame/drivers/puckpkmn.c
+++ b/src/mame/drivers/puckpkmn.c
@@ -125,26 +125,6 @@ static INPUT_PORTS_START( puckpkmn )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
INPUT_PORTS_END
-static READ16_HANDLER( puckpkmn_YM3438_r )
-{
- return ym3438_status_port_0_a_r(space, 0) << 8;
-}
-
-static WRITE16_HANDLER( puckpkmn_YM3438_w )
-{
- switch (offset)
- {
- case 0:
- if (ACCESSING_BITS_8_15) ym3438_control_port_0_a_w (space, 0, (data >> 8) & 0xff);
- else ym3438_data_port_0_a_w (space, 0, (data >> 0) & 0xff);
- break;
- case 1:
- if (ACCESSING_BITS_8_15) ym3438_control_port_0_b_w (space, 0, (data >> 8) & 0xff);
- else ym3438_data_port_0_b_w (space, 0, (data >> 0) & 0xff);
- break;
- }
-}
-
static ADDRESS_MAP_START( puckpkmn_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x1fffff) AM_READ(SMH_ROM) /* Main 68k Program Roms */
@@ -153,8 +133,8 @@ static ADDRESS_MAP_START( puckpkmn_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x700014, 0x700015) AM_READ_PORT("UNK")
AM_RANGE(0x700016, 0x700017) AM_READ_PORT("DSW1")
AM_RANGE(0x700018, 0x700019) AM_READ_PORT("DSW2")
- AM_RANGE(0x700022, 0x700023) AM_READ(okim6295_status_0_lsb_r) /* M6295 Sound Chip Status Register */
- AM_RANGE(0xa04000, 0xa04001) AM_READ(puckpkmn_YM3438_r) /* Ym3438 Sound Chip Status Register */
+ AM_RANGE(0x700022, 0x700023) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff) /* M6295 Sound Chip Status Register */
+ AM_RANGE(0xa04000, 0xa04003) AM_DEVREAD8(SOUND, "ym", ym3438_r, 0xffff) /* Ym3438 Sound Chip Status Register */
AM_RANGE(0xc00000, 0xc0001f) AM_READ(genesis_vdp_r) /* VDP Access */
AM_RANGE(0xe00000, 0xe1ffff) AM_READ(SMH_BANK1) /* VDP sees the roms here */
AM_RANGE(0xfe0000, 0xfeffff) AM_READ(SMH_BANK2) /* VDP sees the ram here */
@@ -168,8 +148,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( puckpkmn_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x1fffff) AM_WRITE(SMH_ROM) /* Main 68k Program Roms */
- AM_RANGE(0x700022, 0x700023) AM_WRITE(okim6295_data_0_lsb_w) /* M6295 Sound Chip Writes */
- AM_RANGE(0xa04000, 0xa04003) AM_WRITE(puckpkmn_YM3438_w) /* Ym3438 Sound Chip Writes */
+ AM_RANGE(0x700022, 0x700023) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff) /* M6295 Sound Chip Writes */
+ AM_RANGE(0xa04000, 0xa04003) AM_DEVWRITE8(SOUND, "ym", ym3438_w, 0xffff) /* Ym3438 Sound Chip Writes */
AM_RANGE(0xc00000, 0xc0001f) AM_WRITE(genesis_vdp_w) /* VDP Access */
AM_RANGE(0xff0000, 0xffffff) AM_WRITE(SMH_RAM) AM_BASE(&main_ram) /* Main Ram */
diff --git a/src/mame/drivers/punchout.c b/src/mame/drivers/punchout.c
index 28ac3c2b56b..e280f13116b 100644
--- a/src/mame/drivers/punchout.c
+++ b/src/mame/drivers/punchout.c
@@ -140,22 +140,22 @@ DRIVER_INIT( armwrest );
static CUSTOM_INPUT( punchout_vlm5030_busy_r )
{
/* bit 4 of DSW1 is busy pin level */
- return (vlm5030_bsy()) ? 0x00 : 0x01;
+ return (vlm5030_bsy(devtag_get_device(field->port->machine, SOUND, "vlm"))) ? 0x00 : 0x01;
}
-static WRITE8_HANDLER( punchout_speech_reset_w )
+static WRITE8_DEVICE_HANDLER( punchout_speech_reset_w )
{
- vlm5030_rst( data&0x01 );
+ vlm5030_rst( device, data&0x01 );
}
-static WRITE8_HANDLER( punchout_speech_st_w )
+static WRITE8_DEVICE_HANDLER( punchout_speech_st_w )
{
- vlm5030_st( data&0x01 );
+ vlm5030_st( device, data&0x01 );
}
-static WRITE8_HANDLER( punchout_speech_vcu_w )
+static WRITE8_DEVICE_HANDLER( punchout_speech_vcu_w )
{
- vlm5030_vcu( data & 0x01 );
+ vlm5030_vcu( device, data & 0x01 );
}
static WRITE8_HANDLER( punchout_2a03_reset_w )
@@ -427,16 +427,16 @@ static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0x01) AM_WRITE(SMH_NOP) /* the 2A03 #1 is not present */
AM_RANGE(0x02, 0x02) AM_READ_PORT("DSW2") AM_WRITE(soundlatch_w)
AM_RANGE(0x03, 0x03) AM_READ_PORT("DSW1") AM_WRITE(soundlatch2_w)
- AM_RANGE(0x04, 0x04) AM_WRITE(vlm5030_data_w) /* VLM5030 */
+ AM_RANGE(0x04, 0x04) AM_DEVWRITE(SOUND, "vlm", vlm5030_data_w) /* VLM5030 */
AM_RANGE(0x05, 0x05) AM_WRITE(SMH_NOP) /* unused */
AM_RANGE(0x06, 0x06) AM_WRITE(SMH_NOP)
AM_RANGE(0x08, 0x08) AM_WRITE(interrupt_enable_w)
AM_RANGE(0x09, 0x09) AM_WRITE(SMH_NOP) /* watchdog reset, seldom used because 08 clears the watchdog as well */
AM_RANGE(0x0a, 0x0a) AM_WRITE(SMH_NOP) /* ?? */
AM_RANGE(0x0b, 0x0b) AM_WRITE(punchout_2a03_reset_w)
- AM_RANGE(0x0c, 0x0c) AM_WRITE(punchout_speech_reset_w) /* VLM5030 */
- AM_RANGE(0x0d, 0x0d) AM_WRITE(punchout_speech_st_w) /* VLM5030 */
- AM_RANGE(0x0e, 0x0e) AM_WRITE(punchout_speech_vcu_w) /* VLM5030 */
+ AM_RANGE(0x0c, 0x0c) AM_DEVWRITE(SOUND, "vlm", punchout_speech_reset_w) /* VLM5030 */
+ AM_RANGE(0x0d, 0x0d) AM_DEVWRITE(SOUND, "vlm", punchout_speech_st_w) /* VLM5030 */
+ AM_RANGE(0x0e, 0x0e) AM_DEVWRITE(SOUND, "vlm", punchout_speech_vcu_w) /* VLM5030 */
AM_RANGE(0x0f, 0x0f) AM_WRITE(SMH_NOP) /* enable NVRAM ? */
/* protection ports - Super Punchout only (move to install handler?) */
@@ -459,13 +459,13 @@ static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_READ(SMH_RAM)
AM_RANGE(0x4016, 0x4016) AM_READ(soundlatch_r)
AM_RANGE(0x4017, 0x4017) AM_READ(soundlatch2_r)
- AM_RANGE(0x4000, 0x4017) AM_READ(nes_psg_0_r)
+ AM_RANGE(0x4000, 0x4017) AM_DEVREAD(SOUND, "nes", nes_psg_r)
AM_RANGE(0xe000, 0xffff) AM_READ(SMH_ROM)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x4000, 0x4017) AM_WRITE(nes_psg_0_w)
+ AM_RANGE(0x4000, 0x4017) AM_DEVWRITE(SOUND, "nes", nes_psg_w)
AM_RANGE(0xe000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/pushman.c b/src/mame/drivers/pushman.c
index dcb20612313..73ece8aa310 100644
--- a/src/mame/drivers/pushman.c
+++ b/src/mame/drivers/pushman.c
@@ -195,10 +195,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ym2203_control_port_1_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "ym2", ym2203_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( bballs_readmem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -433,9 +431,9 @@ GFXDECODE_END
/******************************************************************************/
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface ym2203_config =
@@ -443,7 +441,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL,
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,
},
irqhandler
};
diff --git a/src/mame/drivers/qdrmfgp.c b/src/mame/drivers/qdrmfgp.c
index 2e9b8fbe490..4efaca87fa6 100644
--- a/src/mame/drivers/qdrmfgp.c
+++ b/src/mame/drivers/qdrmfgp.c
@@ -85,11 +85,12 @@ static WRITE16_HANDLER( gp_control_w )
int vol = generic_nvram16[0x10] & 0xff;
if (vol)
{
+ const device_config *k054539 = devtag_get_device(space->machine, SOUND, "konami");
int i;
double gain = vol / 90.0;
for (i=0; i<8; i++)
- k054539_set_gain(0, i, gain);
+ k054539_set_gain(k054539, i, gain);
}
}
}
@@ -114,11 +115,12 @@ static WRITE16_HANDLER( gp2_control_w )
int vol = generic_nvram16[0x8] & 0xff;
if (vol)
{
+ const device_config *k054539 = devtag_get_device(space->machine, SOUND, "konami");
int i;
double gain = vol / 90.0;
for (i=0; i<8; i++)
- k054539_set_gain(0, i, gain);
+ k054539_set_gain(k054539, i, gain);
}
}
}
@@ -191,20 +193,6 @@ static WRITE16_HANDLER( sndram_w )
}
}
-static READ16_HANDLER( k054539_word_r )
-{
- if (ACCESSING_BITS_0_7)
- return k054539_0_r(space, offset);
-
- return 0;
-}
-
-static WRITE16_HANDLER( k054539_word_w )
-{
- if (ACCESSING_BITS_0_7)
- k054539_0_w(space, offset, data);
-}
-
/*************/
#define IDE_STD_OFFSET (0x1f0/2)
@@ -347,7 +335,7 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x320000, 0x32001f) AM_READ(K053252_word_r) /* ccu */
AM_RANGE(0x330000, 0x330001) AM_READ_PORT("SENSOR") /* battery power & service sw */
AM_RANGE(0x340000, 0x340001) AM_READ_PORT("340000") /* inputport */
- AM_RANGE(0x800000, 0x80045f) AM_READ(k054539_word_r) /* sound regs */
+ AM_RANGE(0x800000, 0x80045f) AM_DEVREAD8(SOUND, "konami", k054539_r, 0x00ff) /* sound regs */
AM_RANGE(0x880000, 0x881fff) AM_READ(K056832_ram_word_r) /* vram */
AM_RANGE(0x882000, 0x883fff) AM_READ(K056832_ram_word_r) /* vram (mirror) */
AM_RANGE(0x900000, 0x901fff) AM_READ(v_rom_r) /* gfxrom through */
@@ -367,7 +355,7 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x360000, 0x360001) AM_WRITE(SMH_NOP) /* unknown */
AM_RANGE(0x370000, 0x370001) AM_WRITE(gp_control_w) /* control reg */
AM_RANGE(0x380000, 0x380001) AM_WRITE(SMH_NOP) /* Watchdog */
- AM_RANGE(0x800000, 0x80045f) AM_WRITE(k054539_word_w) /* sound regs */
+ AM_RANGE(0x800000, 0x80045f) AM_DEVWRITE8(SOUND, "konami", k054539_w, 0x00ff) /* sound regs */
AM_RANGE(0x880000, 0x881fff) AM_WRITE(K056832_ram_word_w) /* vram */
AM_RANGE(0x882000, 0x883fff) AM_WRITE(K056832_ram_word_w) /* vram (mirror) */
AM_RANGE(0xa00000, 0xa0000f) AM_DEVWRITE(IDE_CONTROLLER, "ide", ide_std_w) /* IDE control regs */
@@ -384,7 +372,7 @@ static ADDRESS_MAP_START( gp2_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x320000, 0x32001f) AM_READ(K053252_word_r) /* ccu */
AM_RANGE(0x330000, 0x330001) AM_READ_PORT("SENSOR") /* battery power & service */
AM_RANGE(0x340000, 0x340001) AM_READ_PORT("340000") /* inputport */
- AM_RANGE(0x800000, 0x80045f) AM_READ(k054539_word_r) /* sound regs */
+ AM_RANGE(0x800000, 0x80045f) AM_DEVREAD8(SOUND, "konami", k054539_r, 0x00ff) /* sound regs */
AM_RANGE(0x880000, 0x881fff) AM_READ(gp2_vram_r) /* vram */
AM_RANGE(0x89f000, 0x8a0fff) AM_READ(gp2_vram_mirror_r) /* vram (mirror) */
AM_RANGE(0x900000, 0x901fff) AM_READ(v_rom_r) /* gfxrom through */
@@ -404,7 +392,7 @@ static ADDRESS_MAP_START( gp2_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x360000, 0x360001) AM_WRITE(SMH_NOP) /* unknown */
AM_RANGE(0x370000, 0x370001) AM_WRITE(gp2_control_w) /* control reg */
AM_RANGE(0x380000, 0x380001) AM_WRITE(SMH_NOP) /* Watchdog */
- AM_RANGE(0x800000, 0x80045f) AM_WRITE(k054539_word_w) /* sound regs */
+ AM_RANGE(0x800000, 0x80045f) AM_DEVWRITE8(SOUND, "konami", k054539_w, 0x00ff) /* sound regs */
AM_RANGE(0x880000, 0x881fff) AM_WRITE(gp2_vram_w) /* vram */
AM_RANGE(0x89f000, 0x8a0fff) AM_WRITE(gp2_vram_mirror_w) /* vram (mirror) */
AM_RANGE(0xa00000, 0xa0000f) AM_DEVWRITE(IDE_CONTROLLER, "ide", ide_std_w) /* IDE control regs */
@@ -599,10 +587,10 @@ INPUT_PORTS_END
*
*************************************/
-static void sound_irq(running_machine *machine)
+static void sound_irq(const device_config *device)
{
if (control & 0x0001)
- cpu_set_input_line(machine->cpu[0], 1, HOLD_LINE);
+ cpu_set_input_line(device->machine->cpu[0], 1, HOLD_LINE);
}
static const k054539_interface k054539_config =
diff --git a/src/mame/drivers/quantum.c b/src/mame/drivers/quantum.c
index c2b35cb773d..a28f9015854 100644
--- a/src/mame/drivers/quantum.c
+++ b/src/mame/drivers/quantum.c
@@ -65,15 +65,15 @@ static READ16_HANDLER( trackball_r )
}
-static READ8_HANDLER( input_1_r )
+static READ8_DEVICE_HANDLER( input_1_r )
{
- return (input_port_read(space->machine, "DSW0") << (7 - (offset - POT0_C))) & 0x80;
+ return (input_port_read(device->machine, "DSW0") << (7 - (offset - POT0_C))) & 0x80;
}
-static READ8_HANDLER( input_2_r )
+static READ8_DEVICE_HANDLER( input_2_r )
{
- return (input_port_read(space->machine, "DSW1") << (7 - (offset - POT0_C))) & 0x80;
+ return (input_port_read(device->machine, "DSW1") << (7 - (offset - POT0_C))) & 0x80;
}
@@ -108,30 +108,6 @@ static WRITE16_HANDLER( led_w )
/*************************************
*
- * POKEY I/O
- *
- *************************************/
-
-static WRITE16_HANDLER( pokey_word_w )
-{
- if (offset & 0x10) /* A5 selects chip */
- pokey2_w(space, offset & 0x0f, data);
- else
- pokey1_w(space, offset & 0x0f, data);
-}
-
-
-static READ16_HANDLER( pokey_word_r )
-{
- if (offset & 0x10)
- return pokey2_r(space, offset & 0x0f);
- else
- return pokey1_r(space, offset & 0x0f);
-}
-
-
-/*************************************
- *
* Main CPU memory handlers
*
*************************************/
@@ -140,7 +116,8 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x013fff) AM_ROM
AM_RANGE(0x018000, 0x01cfff) AM_RAM
AM_RANGE(0x800000, 0x801fff) AM_RAM AM_BASE(&quantum_vectorram) AM_SIZE(&vectorram_size)
- AM_RANGE(0x840000, 0x84003f) AM_READWRITE(pokey_word_r, pokey_word_w)
+ AM_RANGE(0x840000, 0x84001f) AM_DEVREADWRITE8(SOUND, "pokey1", pokey_r, pokey_w, 0x00ff)
+ AM_RANGE(0x840020, 0x84003f) AM_DEVREADWRITE8(SOUND, "pokey2", pokey_r, pokey_w, 0x00ff)
AM_RANGE(0x900000, 0x9001ff) AM_RAM AM_BASE(&generic_nvram16) AM_SIZE(&generic_nvram_size)
AM_RANGE(0x940000, 0x940001) AM_READ(trackball_r) /* trackball */
AM_RANGE(0x948000, 0x948001) AM_READ_PORT("SYSTEM")
@@ -214,12 +191,30 @@ INPUT_PORTS_END
static const pokey_interface pokey_interface_1 =
{
- { input_1_r,input_1_r,input_1_r,input_1_r,input_1_r,input_1_r,input_1_r,input_1_r }
+ {
+ DEVCB_HANDLER(input_1_r),
+ DEVCB_HANDLER(input_1_r),
+ DEVCB_HANDLER(input_1_r),
+ DEVCB_HANDLER(input_1_r),
+ DEVCB_HANDLER(input_1_r),
+ DEVCB_HANDLER(input_1_r),
+ DEVCB_HANDLER(input_1_r),
+ DEVCB_HANDLER(input_1_r)
+ }
};
static const pokey_interface pokey_interface_2 =
{
- { input_2_r,input_2_r,input_2_r,input_2_r,input_2_r,input_2_r,input_2_r,input_2_r }
+ {
+ DEVCB_HANDLER(input_2_r),
+ DEVCB_HANDLER(input_2_r),
+ DEVCB_HANDLER(input_2_r),
+ DEVCB_HANDLER(input_2_r),
+ DEVCB_HANDLER(input_2_r),
+ DEVCB_HANDLER(input_2_r),
+ DEVCB_HANDLER(input_2_r),
+ DEVCB_HANDLER(input_2_r)
+ }
};
diff --git a/src/mame/drivers/quasar.c b/src/mame/drivers/quasar.c
index 50ecc8087f9..e71cc95a566 100644
--- a/src/mame/drivers/quasar.c
+++ b/src/mame/drivers/quasar.c
@@ -148,11 +148,6 @@ static READ8_HANDLER( audio_t1_r )
return (soundlatch_r(space, 0) == 0);
}
-static WRITE8_HANDLER( audio_dac_w )
-{
- dac_0_signed_data_w(space, 0, data);
-}
-
// memory map taken from the manual
static ADDRESS_MAP_START( quasar, ADDRESS_SPACE_PROGRAM, 8 )
@@ -190,7 +185,7 @@ static ADDRESS_MAP_START( sound_portmap, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0x7f) AM_RAM
AM_RANGE(0x80, 0x80) AM_READ(quasar_sh_command_r)
AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(audio_t1_r)
- AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(audio_dac_w)
+ AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE(SOUND, "dac", dac_signed_w)
ADDRESS_MAP_END
/************************************************************************
diff --git a/src/mame/drivers/quizdna.c b/src/mame/drivers/quizdna.c
index 5589ead7fa4..27230c800bb 100644
--- a/src/mame/drivers/quizdna.c
+++ b/src/mame/drivers/quizdna.c
@@ -78,9 +78,8 @@ static ADDRESS_MAP_START( quizdna_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x91, 0x91) AM_READ_PORT("SERVICE")
AM_RANGE(0xc0, 0xc0) AM_WRITE(quizdna_rombank_w)
AM_RANGE(0xd0, 0xd0) AM_WRITE(quizdna_screen_ctrl_w)
- AM_RANGE(0xe0, 0xe0) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0xe1, 0xe1) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
- AM_RANGE(0xf0, 0xf0) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0xe0, 0xe1) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
+ AM_RANGE(0xf0, 0xf0) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( gakupara_io_map, ADDRESS_SPACE_IO, 8 )
@@ -94,9 +93,8 @@ static ADDRESS_MAP_START( gakupara_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x91, 0x91) AM_READ_PORT("SERVICE")
AM_RANGE(0xc0, 0xc0) AM_WRITE(quizdna_rombank_w)
AM_RANGE(0xd0, 0xd0) AM_WRITE(quizdna_screen_ctrl_w)
- AM_RANGE(0xe0, 0xe0) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0xe1, 0xe1) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
- AM_RANGE(0xf0, 0xf0) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0xe0, 0xe1) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
+ AM_RANGE(0xf0, 0xf0) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( gekiretu_io_map, ADDRESS_SPACE_IO, 8 )
@@ -110,9 +108,8 @@ static ADDRESS_MAP_START( gekiretu_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x91, 0x91) AM_READ_PORT("SERVICE")
AM_RANGE(0xc0, 0xc0) AM_WRITE(gekiretu_rombank_w)
AM_RANGE(0xd0, 0xd0) AM_WRITE(quizdna_screen_ctrl_w)
- AM_RANGE(0xe0, 0xe0) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0xe1, 0xe1) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
- AM_RANGE(0xf0, 0xf0) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0xe0, 0xe1) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
+ AM_RANGE(0xf0, 0xf0) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
ADDRESS_MAP_END
@@ -450,10 +447,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_1_r,
- input_port_0_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW3"),
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_NULL,
+ DEVCB_NULL
},
NULL
};
diff --git a/src/mame/drivers/quizo.c b/src/mame/drivers/quizo.c
index ff32745f067..97961375884 100644
--- a/src/mame/drivers/quizo.c
+++ b/src/mame/drivers/quizo.c
@@ -128,8 +128,7 @@ static ADDRESS_MAP_START( portmap, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0")
AM_RANGE(0x10, 0x10) AM_READ_PORT("IN1")
AM_RANGE(0x40, 0x40) AM_READ_PORT("IN2")
- AM_RANGE(0x50, 0x50) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x51, 0x51) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x50, 0x51) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
AM_RANGE(0x60, 0x60) AM_WRITE(port60_w)
AM_RANGE(0x70, 0x70) AM_WRITE(port70_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/quizpani.c b/src/mame/drivers/quizpani.c
index 5f62881d195..12c23523573 100644
--- a/src/mame/drivers/quizpani.c
+++ b/src/mame/drivers/quizpani.c
@@ -53,7 +53,7 @@ static ADDRESS_MAP_START( quizpani_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x100002, 0x100003) AM_READ_PORT("P1_P2")
AM_RANGE(0x100008, 0x100009) AM_READ_PORT("DSW1")
AM_RANGE(0x10000a, 0x10000b) AM_READ_PORT("DSW2")
- AM_RANGE(0x104000, 0x104001) AM_READ(okim6295_status_0_lsb_r)
+ AM_RANGE(0x104000, 0x104001) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff)
AM_RANGE(0x108000, 0x1083ff) AM_READ(SMH_RAM)
AM_RANGE(0x110000, 0x113fff) AM_READ(SMH_RAM)
AM_RANGE(0x180000, 0x18ffff) AM_READ(SMH_RAM)
@@ -65,7 +65,7 @@ static ADDRESS_MAP_START( quizpani_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x100014, 0x100015) AM_WRITE(SMH_NOP)
AM_RANGE(0x100016, 0x100017) AM_WRITE(SMH_NOP) /* IRQ eanble? */
AM_RANGE(0x100018, 0x100019) AM_WRITE(quizpani_tilesbank_w)
- AM_RANGE(0x104000, 0x104001) AM_WRITE(okim6295_data_0_lsb_w)
+ AM_RANGE(0x104000, 0x104001) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff)
AM_RANGE(0x104020, 0x104027) AM_WRITE(NMK112_okibank_lsb_w)
AM_RANGE(0x108000, 0x1083ff) AM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE(&paletteram16)
AM_RANGE(0x108400, 0x1085ff) AM_WRITE(SMH_NOP)
diff --git a/src/mame/drivers/quizpun2.c b/src/mame/drivers/quizpun2.c
index 7c69b6faabb..b462c71c7a1 100644
--- a/src/mame/drivers/quizpun2.c
+++ b/src/mame/drivers/quizpun2.c
@@ -327,8 +327,7 @@ static ADDRESS_MAP_START( quizpun2_sound_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE( 0x00, 0x00 ) AM_WRITE( SMH_NOP ) // IRQ end
AM_RANGE( 0x20, 0x20 ) AM_WRITE( SMH_NOP ) // NMI end
AM_RANGE( 0x40, 0x40 ) AM_READ( soundlatch_r )
- AM_RANGE( 0x60, 0x60 ) AM_READWRITE( ym2203_status_port_0_r, ym2203_control_port_0_w )
- AM_RANGE( 0x61, 0x61 ) AM_WRITE ( ym2203_write_port_0_w )
+ AM_RANGE( 0x60, 0x61 ) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w )
ADDRESS_MAP_END
diff --git a/src/mame/drivers/r2dtank.c b/src/mame/drivers/r2dtank.c
index 804258c8dbd..8f1b27b855a 100644
--- a/src/mame/drivers/r2dtank.c
+++ b/src/mame/drivers/r2dtank.c
@@ -148,14 +148,10 @@ static READ8_HANDLER( AY8910_port_r )
UINT8 ret = 0;
if (AY8910_selected & 0x08)
-{
- ret = ay8910_read_port_0_r(space, offset);
-if (LOG_AUDIO_COMM) logerror("%08X CPU#1 AY8910 #0 Port Read: %x\n", cpu_get_pc(space->cpu), ret);}
+ ret = ay8910_r(devtag_get_device(space->machine, SOUND, "ay1"), 0);
if (AY8910_selected & 0x10)
-{
- ret = ay8910_read_port_1_r(space, offset);
-if (LOG_AUDIO_COMM) logerror("%08X CPU#1 AY8910 #1 Port Read: %x\n", cpu_get_pc(space->cpu), ret);}
+ ret = ay8910_r(devtag_get_device(space->machine, SOUND, "ay2"), 0);
return ret;
}
@@ -163,29 +159,11 @@ if (LOG_AUDIO_COMM) logerror("%08X CPU#1 AY8910 #1 Port Read: %x\n", cpu_get_p
static WRITE8_HANDLER( AY8910_port_w )
{
- if (AY8910_selected & 0x04)
- {
- if (AY8910_selected & 0x08)
-{if (LOG_AUDIO_COMM) logerror("%08X CPU#1 AY8910 #0 Control Write: %x\n", cpu_get_pc(space->cpu), data);
- ay8910_control_port_0_w(space, offset, data);
-}
- if (AY8910_selected & 0x10)
-{if (LOG_AUDIO_COMM) logerror("%08X CPU#1 AY8910 #1 Control Write: %x\n", cpu_get_pc(space->cpu), data);
- ay8910_control_port_1_w(space, offset, data);
-}
- }
- else
- {
- if (AY8910_selected & 0x08)
-{if (LOG_AUDIO_COMM) logerror("%08X CPU#1 AY8910 #0 Port Write: %x\n", cpu_get_pc(space->cpu), data);
- ay8910_write_port_0_w(space, offset, data);
-}
+ if (AY8910_selected & 0x08)
+ ay8910_data_address_w(devtag_get_device(space->machine, SOUND, "ay1"), AY8910_selected >> 2, data);
- if (AY8910_selected & 0x10)
-{if (LOG_AUDIO_COMM) logerror("%08X CPU#1 AY8910 #1 Port Write: %x\n", cpu_get_pc(space->cpu), data);
- ay8910_write_port_1_w(space, offset, data);
-}
- }
+ if (AY8910_selected & 0x10)
+ ay8910_data_address_w(devtag_get_device(space->machine, SOUND, "ay2"), AY8910_selected >> 2, data);
}
@@ -193,10 +171,10 @@ static const ay8910_interface ay8910_1_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_3_r,
- NULL,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSWB"),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
@@ -204,10 +182,10 @@ static const ay8910_interface ay8910_2_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_1_r,
- input_port_2_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("IN1"),
+ DEVCB_INPUT_PORT("DSWA"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/raiden2.c b/src/mame/drivers/raiden2.c
index 0133651942a..d42ef40e22d 100644
--- a/src/mame/drivers/raiden2.c
+++ b/src/mame/drivers/raiden2.c
@@ -1992,17 +1992,6 @@ static READ16_HANDLER( r2_playerin_r )
{
return input_port_read(space->machine, "INPUT");
}
-static READ16_HANDLER( rdx_v33_oki_r )
-{
- return okim6295_status_0_r(space,0);
-}
-
-static WRITE16_HANDLER( rdx_v33_oki_w )
-{
- if (ACCESSING_BITS_0_7) okim6295_data_0_w(space, 0, data & 0x00ff);
- if (ACCESSING_BITS_8_15) logerror("rdx_v33_oki_w MSB %04x\n",data);
-}
-
static READ16_HANDLER( rdx_v33_unknown_r )
{
return 0x00;
@@ -2052,7 +2041,7 @@ static ADDRESS_MAP_START( rdx_v33_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x00762, 0x00763) AM_READ(rdx_v33_unknown2_r)
- AM_RANGE(0x00780, 0x00781) AM_READWRITE(rdx_v33_oki_r, rdx_v33_oki_w) // single OKI chip on this version
+ AM_RANGE(0x00780, 0x00781) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff) // single OKI chip on this version
AM_RANGE(0x00800, 0x0087f) AM_RAM // copies eeprom here?
AM_RANGE(0x00880, 0x0bfff) AM_RAM
diff --git a/src/mame/drivers/rainbow.c b/src/mame/drivers/rainbow.c
index b6018d6a904..ae019725b30 100644
--- a/src/mame/drivers/rainbow.c
+++ b/src/mame/drivers/rainbow.c
@@ -347,9 +347,9 @@ ADDRESS_MAP_END
Jumping uses two YM2203's
***********************************************************/
-static WRITE8_HANDLER( bankswitch_w )
+static WRITE8_DEVICE_HANDLER( bankswitch_w )
{
- memory_set_bankptr(space->machine, 5, memory_region(space->machine, "audio") + ((data - 1) & 3) * 0x4000 + 0x10000);
+ memory_set_bankptr(device->machine, 5, memory_region(device->machine, "audio") + ((data - 1) & 3) * 0x4000 + 0x10000);
}
static READ8_HANDLER( jumping_latch_r )
@@ -362,7 +362,7 @@ static ADDRESS_MAP_START( rainbow_s_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM)
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK5)
AM_RANGE(0x8000, 0x8fff) AM_READ(SMH_RAM)
- AM_RANGE(0x9001, 0x9001) AM_READ(ym2151_status_port_0_r)
+ AM_RANGE(0x9000, 0x9001) AM_DEVREAD(SOUND, "ym", ym2151_r)
AM_RANGE(0x9002, 0x9100) AM_READ(SMH_RAM)
AM_RANGE(0xa001, 0xa001) AM_READ(taitosound_slave_comm_r)
ADDRESS_MAP_END
@@ -370,8 +370,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( rainbow_s_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x8fff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x9000, 0x9000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x9001, 0x9001) AM_WRITE(ym2151_data_port_0_w)
+ AM_RANGE(0x9000, 0x9001) AM_DEVWRITE(SOUND, "ym", ym2151_w)
AM_RANGE(0xa000, 0xa000) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xa001, 0xa001) AM_WRITE(taitosound_slave_comm_w)
ADDRESS_MAP_END
@@ -379,8 +378,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( jumping_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x8fff) AM_READ(SMH_RAM)
- AM_RANGE(0xb000, 0xb000) AM_READ(ym2203_status_port_0_r)
- AM_RANGE(0xb400, 0xb400) AM_READ(ym2203_status_port_1_r)
+ AM_RANGE(0xb000, 0xb001) AM_DEVREAD(SOUND, "ym1", ym2203_r)
+ AM_RANGE(0xb400, 0xb401) AM_DEVREAD(SOUND, "ym2", ym2203_r)
AM_RANGE(0xb800, 0xb800) AM_READ(jumping_latch_r)
AM_RANGE(0xc000, 0xffff) AM_READ(SMH_ROM)
ADDRESS_MAP_END
@@ -388,10 +387,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( jumping_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x8fff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xb000, 0xb000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xb001, 0xb001) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0xb400, 0xb400) AM_WRITE(ym2203_control_port_1_w)
- AM_RANGE(0xb401, 0xb401) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0xb000, 0xb001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0xb400, 0xb401) AM_DEVWRITE(SOUND, "ym2", ym2203_w)
AM_RANGE(0xbc00, 0xbc00) AM_WRITE(SMH_NOP) /* looks like a bankswitch, but sound works with or without it */
ADDRESS_MAP_END
@@ -592,9 +589,9 @@ GFXDECODE_END
/* handler called by the YM2151 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/rallyx.c b/src/mame/drivers/rallyx.c
index 6fa22acb790..8c6c460b46b 100644
--- a/src/mame/drivers/rallyx.c
+++ b/src/mame/drivers/rallyx.c
@@ -221,10 +221,11 @@ static WRITE8_HANDLER( rallyx_interrupt_vector_w )
static WRITE8_HANDLER( rallyx_bang_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
static int last;
if (data == 0 && last != 0)
- sample_start(0,0,0);
+ sample_start(samples,0,0,0);
last = data;
}
@@ -248,7 +249,7 @@ static WRITE8_HANDLER( rallyx_latch_w )
case 0x02: /* SOUND ON */
/* this doesn't work in New Rally X so I'm not supporting it */
-// pacman_sound_enable_w(0,bit);
+// pacman_sound_enable_w(devtag_get_device(space->machine, SOUND, "namco"),bit);
break;
case 0x03: /* FLIP */
@@ -324,7 +325,7 @@ static ADDRESS_MAP_START( rallyx_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xa100, 0xa100) AM_READ_PORT("DSW")
AM_RANGE(0xa000, 0xa00f) AM_WRITE(SMH_RAM) AM_BASE(&rallyx_radarattr)
AM_RANGE(0xa080, 0xa080) AM_WRITE(watchdog_reset_w)
- AM_RANGE(0xa100, 0xa11f) AM_WRITE(pacman_sound_w) AM_BASE(&namco_soundregs)
+ AM_RANGE(0xa100, 0xa11f) AM_DEVWRITE(SOUND, "namco", pacman_sound_w) AM_BASE(&namco_soundregs)
AM_RANGE(0xa130, 0xa130) AM_WRITE(rallyx_scrollx_w)
AM_RANGE(0xa140, 0xa140) AM_WRITE(rallyx_scrolly_w)
AM_RANGE(0xa170, 0xa170) AM_WRITE(SMH_NOP) /* ? */
diff --git a/src/mame/drivers/rampart.c b/src/mame/drivers/rampart.c
index a15d531b449..2fecb1ff954 100644
--- a/src/mame/drivers/rampart.c
+++ b/src/mame/drivers/rampart.c
@@ -72,45 +72,6 @@ static MACHINE_RESET( rampart )
/*************************************
*
- * MSM5295 I/O
- *
- *************************************/
-
-static READ16_HANDLER( adpcm_r )
-{
- return (okim6295_status_0_r(space, offset) << 8) | 0x00ff;
-}
-
-
-static WRITE16_HANDLER( adpcm_w )
-{
- if (ACCESSING_BITS_8_15)
- okim6295_data_0_w(space, offset, (data >> 8) & 0xff);
-}
-
-
-
-/*************************************
- *
- * YM2413 I/O
- *
- *************************************/
-
-static WRITE16_HANDLER( ym2413_w )
-{
- if (ACCESSING_BITS_8_15)
- {
- if (offset & 1)
- ym2413_data_port_0_w(space, 0, (data >> 8) & 0xff);
- else
- ym2413_register_port_0_w(space, 0, (data >> 8) & 0xff);
- }
-}
-
-
-
-/*************************************
- *
* Latch write
*
*************************************/
@@ -147,10 +108,10 @@ static WRITE16_HANDLER( latch_w )
{
atarigen_set_oki6295_vol(space->machine, (data & 0x0020) ? 100 : 0);
if (!(data & 0x0010))
- sndti_reset(SOUND_OKIM6295, 0);
+ devtag_reset(space->machine, SOUND, "oki");
atarigen_set_ym2413_vol(space->machine, ((data >> 1) & 7) * 100 / 7);
if (!(data & 0x0001))
- sndti_reset(SOUND_YM2413, 0);
+ devtag_reset(space->machine, SOUND, "ym");
}
}
@@ -174,8 +135,8 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x3e0800, 0x3e3f3f) AM_MIRROR(0x010000) AM_RAM
AM_RANGE(0x3e3f40, 0x3e3f7f) AM_MIRROR(0x010000) AM_RAM_WRITE(atarimo_0_slipram_w) AM_BASE(&atarimo_0_slipram)
AM_RANGE(0x3e3f80, 0x3effff) AM_MIRROR(0x010000) AM_RAM
- AM_RANGE(0x460000, 0x460001) AM_MIRROR(0x019ffe) AM_READWRITE(adpcm_r, adpcm_w)
- AM_RANGE(0x480000, 0x480003) AM_MIRROR(0x019ffc) AM_WRITE(ym2413_w)
+ AM_RANGE(0x460000, 0x460001) AM_MIRROR(0x019ffe) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0xff00)
+ AM_RANGE(0x480000, 0x480003) AM_MIRROR(0x019ffc) AM_DEVWRITE8(SOUND, "ym", ym2413_w, 0xff00)
AM_RANGE(0x500000, 0x500fff) AM_MIRROR(0x019000) AM_READWRITE(atarigen_eeprom_r, atarigen_eeprom_w) AM_BASE(&atarigen_eeprom) AM_SIZE(&atarigen_eeprom_size)
AM_RANGE(0x5a6000, 0x5a6001) AM_MIRROR(0x019ffe) AM_WRITE(atarigen_eeprom_enable_w)
AM_RANGE(0x640000, 0x640001) AM_MIRROR(0x019ffe) AM_WRITE(latch_w)
diff --git a/src/mame/drivers/rastan.c b/src/mame/drivers/rastan.c
index c0ba6ae0561..0c3ac4ae66a 100644
--- a/src/mame/drivers/rastan.c
+++ b/src/mame/drivers/rastan.c
@@ -176,7 +176,7 @@ static int adpcm_pos;
static int adpcm_data;
-static WRITE8_HANDLER( rastan_bankswitch_w )
+static WRITE8_DEVICE_HANDLER( rastan_bankswitch_w )
{
int offs;
@@ -184,7 +184,7 @@ static WRITE8_HANDLER( rastan_bankswitch_w )
if (data == 0) offs = 0x0000;
else offs = (data-1) * 0x4000 + 0x10000;
- memory_set_bankptr(space->machine, 1, memory_region(space->machine, "audio") + offs );
+ memory_set_bankptr(device->machine, 1, memory_region(device->machine, "audio") + offs );
}
@@ -192,14 +192,14 @@ static void rastan_msm5205_vck(const device_config *device)
{
if (adpcm_data != -1)
{
- msm5205_data_w(0, adpcm_data & 0x0f);
+ msm5205_data_w(device, adpcm_data & 0x0f);
adpcm_data = -1;
}
else
{
adpcm_data = memory_region(device->machine, "adpcm")[adpcm_pos];
adpcm_pos = (adpcm_pos + 1) & 0xffff;
- msm5205_data_w(0, adpcm_data >> 4);
+ msm5205_data_w(device, adpcm_data >> 4);
}
}
@@ -208,14 +208,14 @@ static WRITE8_HANDLER( rastan_msm5205_address_w )
adpcm_pos = (adpcm_pos & 0x00ff) | (data << 8);
}
-static WRITE8_HANDLER( rastan_msm5205_start_w )
+static WRITE8_DEVICE_HANDLER( rastan_msm5205_start_w )
{
- msm5205_reset_w(0, 0);
+ msm5205_reset_w(device, 0);
}
-static WRITE8_HANDLER( rastan_msm5205_stop_w )
+static WRITE8_DEVICE_HANDLER( rastan_msm5205_stop_w )
{
- msm5205_reset_w(0, 1);
+ msm5205_reset_w(device, 1);
adpcm_pos &= 0xff00;
}
@@ -248,13 +248,12 @@ static ADDRESS_MAP_START( rastan_s_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM
AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(1)
AM_RANGE(0x8000, 0x8fff) AM_RAM
- AM_RANGE(0x9000, 0x9000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x9001, 0x9001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x9000, 0x9001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0xa000, 0xa000) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xa001, 0xa001) AM_READWRITE(taitosound_slave_comm_r, taitosound_slave_comm_w)
AM_RANGE(0xb000, 0xb000) AM_WRITE(rastan_msm5205_address_w)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(rastan_msm5205_start_w)
- AM_RANGE(0xd000, 0xd000) AM_WRITE(rastan_msm5205_stop_w)
+ AM_RANGE(0xc000, 0xc000) AM_DEVWRITE(SOUND, "msm", rastan_msm5205_start_w)
+ AM_RANGE(0xd000, 0xd000) AM_DEVWRITE(SOUND, "msm", rastan_msm5205_stop_w)
ADDRESS_MAP_END
@@ -358,9 +357,9 @@ GFXDECODE_END
/* handler called by the YM2151 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/rcasino.c b/src/mame/drivers/rcasino.c
index fda007fa2f5..8c923d74ec4 100644
--- a/src/mame/drivers/rcasino.c
+++ b/src/mame/drivers/rcasino.c
@@ -178,9 +178,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( rcasino_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x01, 0x01) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x02, 0x02) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x01, 0x01) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x02, 0x03) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
AM_RANGE(0x10, 0x10) AM_READ_PORT("IN0") AM_WRITE(rcasino_port_10_w)
// AM_RANGE(0x11, 0x11) AM_READ_PORT("IN1") AM_WRITE(rcasino_port_11_w)
AM_RANGE(0x11, 0x11) AM_READWRITE(rcasino_port_11_r, rcasino_port_11_w)
@@ -288,10 +287,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_2_r, // DSW1
- input_port_3_r, // DSW2
- 0,
- 0
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static MACHINE_DRIVER_START( rcasino )
diff --git a/src/mame/drivers/re900.c b/src/mame/drivers/re900.c
index f2b5a5c3b30..287ef51b5ae 100644
--- a/src/mame/drivers/re900.c
+++ b/src/mame/drivers/re900.c
@@ -88,9 +88,9 @@ static UINT8 psg_pa, psg_pb = 0, mux_data = 0, ledant = 0, player = 1, stat_a= 1
* Read Handlers *
****************/
-static READ8_HANDLER (re_psg_portA_r)
+static READ8_DEVICE_HANDLER (re_psg_portA_r)
{
- if ((input_port_read(space->machine, "IN0") & 0x01) == 0)
+ if ((input_port_read(device->machine, "IN0") & 0x01) == 0)
{
output_set_lamp_value(0,1); // Operator Key ON
}
@@ -100,10 +100,10 @@ static READ8_HANDLER (re_psg_portA_r)
output_set_lamp_value(0,0); // Operator Key OFF
}
- return input_port_read(space->machine, "IN0");
+ return input_port_read(device->machine, "IN0");
}
-static READ8_HANDLER (re_psg_portB_r)
+static READ8_DEVICE_HANDLER (re_psg_portB_r)
{
UINT8 retval = 0xff;
logerror("llamada a re_psg_portB_r\n");
@@ -111,7 +111,7 @@ static READ8_HANDLER (re_psg_portB_r)
output_set_lamp_value(player,1);
- if (input_port_read(space->machine, "IN_S"))
+ if (input_port_read(device->machine, "IN_S"))
{
if (!stat_a)
{
@@ -142,27 +142,17 @@ static READ8_HANDLER (re_psg_portB_r)
/* "INA": Unified port to share the player Keys among all players - Key In & Key Out have their own buttons on keyboard. */
switch( mux_data )
{
- case 0x01: retval = (input_port_read(space->machine, "IN6") | 0x80 ) - (( player == 6 ) ? (input_port_read(space->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 6 */
- case 0x02: retval = (input_port_read(space->machine, "IN5") | 0x80 ) - (( player == 5 ) ? (input_port_read(space->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 5 */
- case 0x04: retval = (input_port_read(space->machine, "IN4") | 0x80 ) - (( player == 4 ) ? (input_port_read(space->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 4 */
- case 0x08: retval = (input_port_read(space->machine, "IN3") | 0x80 ) - (( player == 3 ) ? (input_port_read(space->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 3 */
- case 0x10: retval = (input_port_read(space->machine, "IN2") | 0x80 ) - (( player == 2 ) ? (input_port_read(space->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 2 */
- case 0x20: retval = (input_port_read(space->machine, "IN1") | 0x80 ) - (( player == 1 ) ? (input_port_read(space->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 1 */
+ case 0x01: retval = (input_port_read(device->machine, "IN6") | 0x80 ) - (( player == 6 ) ? (input_port_read(device->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 6 */
+ case 0x02: retval = (input_port_read(device->machine, "IN5") | 0x80 ) - (( player == 5 ) ? (input_port_read(device->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 5 */
+ case 0x04: retval = (input_port_read(device->machine, "IN4") | 0x80 ) - (( player == 4 ) ? (input_port_read(device->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 4 */
+ case 0x08: retval = (input_port_read(device->machine, "IN3") | 0x80 ) - (( player == 3 ) ? (input_port_read(device->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 3 */
+ case 0x10: retval = (input_port_read(device->machine, "IN2") | 0x80 ) - (( player == 2 ) ? (input_port_read(device->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 2 */
+ case 0x20: retval = (input_port_read(device->machine, "IN1") | 0x80 ) - (( player == 1 ) ? (input_port_read(device->machine, "INA") | 0x80 ) ^ 0xff: 0x00 ); break; /* Player 1 */
}
return retval;
}
-static READ8_HANDLER (bs94_portA_r)
-{
- return input_port_read(space->machine, "IN0");
-}
-
-static READ8_HANDLER (bs94_portB_r)
-{
- return input_port_read(space->machine, "IN1");
-}
-
static READ8_HANDLER (rom_r)
{
return re900_rom[offset];
@@ -173,13 +163,13 @@ static READ8_HANDLER (rom_r)
* Write Handlers *
***********************/
-static WRITE8_HANDLER (re_mux_port_A_w)
+static WRITE8_DEVICE_HANDLER (re_mux_port_A_w)
{
psg_pa = data;
mux_data = ((data >> 2) & 0x3f) ^ 0x3f;
}
-static WRITE8_HANDLER (re_mux_port_B_w)
+static WRITE8_DEVICE_HANDLER (re_mux_port_B_w)
{
UINT8 led;
psg_pb = data;
@@ -222,9 +212,8 @@ static ADDRESS_MAP_START( mem_io, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0xc000, 0xdfff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
AM_RANGE(0xe000, 0xe000) AM_WRITE(TMS9928A_vram_w)
AM_RANGE(0xe001, 0xe001) AM_WRITE(TMS9928A_register_w)
- AM_RANGE(0xe800, 0xe800) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xe801, 0xe801) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xe802, 0xe802) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0xe800, 0xe801) AM_DEVWRITE(SOUND, "ay_re900", ay8910_address_data_w)
+ AM_RANGE(0xe802, 0xe802) AM_DEVREAD(SOUND, "ay_re900", ay8910_r)
AM_RANGE(0xe000, 0xefff) AM_WRITE(re900_watchdog_reset_w)
AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P0) AM_WRITE(cpu_port_0_w)
AM_RANGE(MCS51_PORT_P2, MCS51_PORT_P2) AM_NOP
@@ -378,20 +367,20 @@ static const ay8910_interface ay8910_re900 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- re_psg_portA_r,
- re_psg_portB_r,
- re_mux_port_A_w,
- re_mux_port_B_w
+ DEVCB_HANDLER(re_psg_portA_r),
+ DEVCB_HANDLER(re_psg_portB_r),
+ DEVCB_HANDLER(re_mux_port_A_w),
+ DEVCB_HANDLER(re_mux_port_B_w)
};
static const ay8910_interface ay8910_bs94 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- bs94_portA_r,
- bs94_portB_r,
- 0,
- 0
+ DEVCB_INPUT_PORT("IN0"),
+ DEVCB_INPUT_PORT("IN1"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
/***************************
diff --git a/src/mame/drivers/realbrk.c b/src/mame/drivers/realbrk.c
index bc97c46bf4a..ccddbce35d3 100644
--- a/src/mame/drivers/realbrk.c
+++ b/src/mame/drivers/realbrk.c
@@ -164,16 +164,14 @@ static ADDRESS_MAP_START( base_mem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x604000, 0x604fff) AM_READWRITE(SMH_RAM,realbrk_vram_2_w) AM_BASE(&realbrk_vram_2 ) // Text (2)
AM_RANGE(0x606000, 0x60600f) AM_READWRITE(SMH_RAM,realbrk_vregs_w) AM_BASE(&realbrk_vregs ) // Scroll + Video Regs
AM_RANGE(0x605000, 0x61ffff) AM_RAM //
- AM_RANGE(0x800000, 0x800001) AM_WRITE(ymz280b_register_0_msb_w ) // YMZ280
- AM_RANGE(0x800002, 0x800003) AM_READWRITE(ymz280b_status_0_msb_r,ymz280b_data_0_msb_w) //
+ AM_RANGE(0x800000, 0x800003) AM_DEVREADWRITE8(SOUND, "ymz", ymz280b_r, ymz280b_w, 0xff00) // YMZ280
AM_RANGE(0xfe0000, 0xfeffff) AM_RAM // RAM
AM_RANGE(0xfffc00, 0xffffff) AM_READWRITE(SMH_RAM,tmp68301_regs_w) AM_BASE(&tmp68301_regs ) // TMP68301 Registers
ADDRESS_MAP_END
/*realbrk specific memory map*/
static ADDRESS_MAP_START( realbrk_mem, ADDRESS_SPACE_PROGRAM, 16 )
- AM_RANGE(0x800008, 0x800009) AM_WRITE(ym2413_register_port_0_lsb_w ) // YM2413
- AM_RANGE(0x80000a, 0x80000b) AM_WRITE(ym2413_data_port_0_lsb_w ) //
+ AM_RANGE(0x800008, 0x80000b) AM_DEVWRITE8(SOUND, "ym", ym2413_w, 0x00ff) //
AM_RANGE(0xc00000, 0xc00001) AM_READ_PORT("IN0") // P1 & P2 (Inputs)
AM_RANGE(0xc00002, 0xc00003) AM_READ_PORT("IN1") // Coins
AM_RANGE(0xc00004, 0xc00005) AM_READWRITE(realbrk_dsw_r,SMH_RAM) AM_BASE(&realbrk_dsw_select) // DSW select
@@ -183,16 +181,14 @@ ADDRESS_MAP_END
/*pkgnsh specific memory map*/
static ADDRESS_MAP_START( pkgnsh_mem, ADDRESS_SPACE_PROGRAM, 16 )
- AM_RANGE(0x800008, 0x800009) AM_WRITE(ym2413_register_port_0_msb_w ) // YM2413
- AM_RANGE(0x80000a, 0x80000b) AM_WRITE(ym2413_data_port_0_msb_w ) //
+ AM_RANGE(0x800008, 0x80000b) AM_DEVWRITE8(SOUND, "ym", ym2413_w, 0xff00 ) // YM2413
AM_RANGE(0xc00000, 0xc00013) AM_READ(pkgnsh_input_r ) // P1 & P2 (Inputs)
AM_RANGE(0xff0000, 0xfffbff) AM_READWRITE(backup_ram_r,backup_ram_w) AM_BASE(&backup_ram) // RAM
ADDRESS_MAP_END
/*pkgnshdx specific memory map*/
static ADDRESS_MAP_START( pkgnshdx_mem, ADDRESS_SPACE_PROGRAM, 16)
- AM_RANGE(0x800008, 0x800009) AM_WRITE(ym2413_register_port_0_lsb_w ) // YM2413
- AM_RANGE(0x80000a, 0x80000b) AM_WRITE(ym2413_data_port_0_lsb_w ) //
+ AM_RANGE(0x800008, 0x80000b) AM_DEVWRITE8(SOUND, "ym", ym2413_w, 0x00ff) //
AM_RANGE(0xc00000, 0xc00013) AM_READ(pkgnshdx_input_r ) // P1 & P2 (Inputs)
AM_RANGE(0xc00004, 0xc00005) AM_WRITE(SMH_RAM) AM_BASE(&realbrk_dsw_select) // DSW select
AM_RANGE(0xff0000, 0xfffbff) AM_READWRITE(backup_ram_dx_r,backup_ram_w) AM_BASE(&backup_ram) // RAM
@@ -202,8 +198,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( dai2kaku_mem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x605000, 0x6053ff) AM_READWRITE(SMH_RAM,SMH_RAM) AM_BASE(&realbrk_vram_0ras) // rasterinfo (0)
AM_RANGE(0x605400, 0x6057ff) AM_READWRITE(SMH_RAM,SMH_RAM) AM_BASE(&realbrk_vram_1ras) // rasterinfo (1)
- AM_RANGE(0x800008, 0x800009) AM_WRITE(ym2413_register_port_0_lsb_w ) // YM2413
- AM_RANGE(0x80000a, 0x80000b) AM_WRITE(ym2413_data_port_0_lsb_w ) //
+ AM_RANGE(0x800008, 0x80000b) AM_DEVWRITE8(SOUND, "ym", ym2413_w, 0x00ff) //
AM_RANGE(0xc00000, 0xc00001) AM_READ_PORT("IN0") // P1 & P2 (Inputs)
AM_RANGE(0xc00002, 0xc00003) AM_READ_PORT("IN1") // Coins
AM_RANGE(0xc00004, 0xc00005) AM_READWRITE(realbrk_dsw_r,SMH_RAM) AM_BASE(&realbrk_dsw_select) // DSW select
diff --git a/src/mame/drivers/relief.c b/src/mame/drivers/relief.c
index f10d7c32513..39abacd87d0 100644
--- a/src/mame/drivers/relief.c
+++ b/src/mame/drivers/relief.c
@@ -81,7 +81,7 @@ static MACHINE_RESET( relief )
atarigen_interrupt_reset(update_interrupts);
atarivc_reset(machine->primary_screen, atarivc_eof_data, 2);
- okim6295_set_bank_base(0, 0);
+ okim6295_set_bank_base(devtag_get_device(machine, SOUND, "oki"), 0);
ym2413_volume = 15;
overall_volume = 127;
adpcm_bank_base = 0;
@@ -122,7 +122,7 @@ static WRITE16_HANDLER( audio_control_w )
if (ACCESSING_BITS_8_15)
adpcm_bank_base = (0x100000 * ((data >> 8) & 1)) | (adpcm_bank_base & 0x0c0000);
- okim6295_set_bank_base(0, adpcm_bank_base);
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki"), adpcm_bank_base);
}
@@ -140,45 +140,6 @@ static WRITE16_HANDLER( audio_volume_w )
/*************************************
*
- * MSM5295 I/O
- *
- *************************************/
-
-static READ16_HANDLER( adpcm_r )
-{
- return okim6295_status_0_r(space, offset) | 0xff00;
-}
-
-
-static WRITE16_HANDLER( adpcm_w )
-{
- if (ACCESSING_BITS_0_7)
- okim6295_data_0_w(space, offset, data & 0xff);
-}
-
-
-
-/*************************************
- *
- * YM2413 I/O
- *
- *************************************/
-
-static WRITE16_HANDLER( ym2413_w )
-{
- if (ACCESSING_BITS_0_7)
- {
- if (offset & 1)
- ym2413_data_port_0_w(space, 0, data & 0xff);
- else
- ym2413_register_port_0_w(space, 0, data & 0xff);
- }
-}
-
-
-
-/*************************************
- *
* Main CPU memory handlers
*
*************************************/
@@ -187,8 +148,8 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0x3fffff)
AM_RANGE(0x000000, 0x07ffff) AM_ROM
- AM_RANGE(0x140000, 0x140003) AM_WRITE(ym2413_w)
- AM_RANGE(0x140010, 0x140011) AM_READWRITE(adpcm_r, adpcm_w)
+ AM_RANGE(0x140000, 0x140003) AM_DEVWRITE8(SOUND, "ym", ym2413_w, 0x00ff)
+ AM_RANGE(0x140010, 0x140011) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x140020, 0x140021) AM_WRITE(audio_volume_w)
AM_RANGE(0x140030, 0x140031) AM_WRITE(audio_control_w)
AM_RANGE(0x180000, 0x180fff) AM_READWRITE(atarigen_eeprom_upper_r, atarigen_eeprom_w) AM_BASE(&atarigen_eeprom) AM_SIZE(&atarigen_eeprom_size)
diff --git a/src/mame/drivers/renegade.c b/src/mame/drivers/renegade.c
index 4ef9de80fd6..5ed998d1a5a 100644
--- a/src/mame/drivers/renegade.c
+++ b/src/mame/drivers/renegade.c
@@ -104,9 +104,8 @@ $8000 - $ffff ROM
#include "deprecat.h"
#include "cpu/m6502/m6502.h"
#include "cpu/m6809/m6809.h"
-#include "sound/3812intf.h"
+#include "sound/3526intf.h"
#include "sound/okim6295.h"
-#include "sound/custom.h"
extern VIDEO_UPDATE( renegade );
extern VIDEO_START( renegade );
@@ -165,17 +164,32 @@ static STREAM_UPDATE( renegade_adpcm_callback )
}
}
-static CUSTOM_START( renegade_adpcm_start )
+static DEVICE_START( renegade_adpcm )
{
running_machine *machine = device->machine;
struct renegade_adpcm_state *state = &renegade_adpcm;
state->playing = 0;
- state->stream = stream_create(device, 0, 1, clock, state, renegade_adpcm_callback);
+ state->stream = stream_create(device, 0, 1, device->clock, state, renegade_adpcm_callback);
state->base = memory_region(machine, "adpcm");
reset_adpcm(&state->adpcm);
- return state;
}
+static DEVICE_GET_INFO( renegade_adpcm )
+{
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(renegade_adpcm);break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Renegade Custom ADPCM"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
+}
+
+#define SOUND_RENEGADE_ADPCM DEVICE_GET_INFO_NAME(renegade_adpcm)
+
+
static WRITE8_HANDLER( adpcm_play_w )
{
int offs;
@@ -555,7 +569,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_READ(SMH_RAM)
AM_RANGE(0x1000, 0x1000) AM_READ(soundlatch_r)
- AM_RANGE(0x2801, 0x2801) AM_READ(ym3526_status_port_0_r)
+ AM_RANGE(0x2800, 0x2801) AM_DEVREAD(SOUND, "ym", ym3526_r)
AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM)
ADDRESS_MAP_END
@@ -563,8 +577,7 @@ static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_WRITE(SMH_RAM)
AM_RANGE(0x1800, 0x1800) AM_WRITE(SMH_NOP) // this gets written the same values as 0x2000
AM_RANGE(0x2000, 0x2000) AM_WRITE(adpcm_play_w)
- AM_RANGE(0x2800, 0x2800) AM_WRITE(ym3526_control_port_0_w)
- AM_RANGE(0x2801, 0x2801) AM_WRITE(ym3526_write_port_0_w)
+ AM_RANGE(0x2800, 0x2801) AM_DEVWRITE(SOUND, "ym", ym3526_w)
AM_RANGE(0x3000, 0x3000) AM_WRITE(SMH_NOP) /* adpcm related? stereo pan? */
AM_RANGE(0x8000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
@@ -764,9 +777,9 @@ GFXDECODE_END
/* handler called by the 3526 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1], M6809_FIRQ_LINE, linestate);
+ cpu_set_input_line(device->machine->cpu[1], M6809_FIRQ_LINE, linestate);
}
static const ym3526_interface ym3526_config =
@@ -774,11 +787,6 @@ static const ym3526_interface ym3526_config =
irqhandler
};
-static const custom_sound_interface adpcm_interface =
-{
- renegade_adpcm_start
-};
-
static MACHINE_RESET( renegade )
{
@@ -821,8 +829,7 @@ static MACHINE_DRIVER_START( renegade )
MDRV_SOUND_CONFIG(ym3526_config)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
- MDRV_SOUND_ADD("adpcm", CUSTOM, 8000)
- MDRV_SOUND_CONFIG(adpcm_interface)
+ MDRV_SOUND_ADD("adpcm", RENEGADE_ADPCM, 8000)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/retofinv.c b/src/mame/drivers/retofinv.c
index 8bd321b2d13..216166bbb38 100644
--- a/src/mame/drivers/retofinv.c
+++ b/src/mame/drivers/retofinv.c
@@ -143,8 +143,8 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x2000, 0x27ff) AM_RAM
AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_r)
AM_RANGE(0x6000, 0x6000) AM_WRITE(cpu2_m6000_w)
- AM_RANGE(0x8000, 0x8000) AM_WRITE(sn76496_0_w)
- AM_RANGE(0xa000, 0xa000) AM_WRITE(sn76496_1_w)
+ AM_RANGE(0x8000, 0x8000) AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0xa000, 0xa000) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
AM_RANGE(0xe000, 0xffff) AM_ROM /* space for diagnostic ROM */
ADDRESS_MAP_END
diff --git a/src/mame/drivers/rmhaihai.c b/src/mame/drivers/rmhaihai.c
index c465d189589..f5afbf7c890 100644
--- a/src/mame/drivers/rmhaihai.c
+++ b/src/mame/drivers/rmhaihai.c
@@ -134,11 +134,11 @@ static READ8_HANDLER( samples_r )
return memory_region(space->machine, "adpcm")[offset];
}
-static WRITE8_HANDLER( adpcm_w )
+static WRITE8_DEVICE_HANDLER( adpcm_w )
{
- msm5205_data_w(0,data); /* bit0..3 */
- msm5205_reset_w(0,(data>>5)&1); /* bit 5 */
- msm5205_vclk_w (0,(data>>4)&1); /* bit4 */
+ msm5205_data_w(device,data); /* bit0..3 */
+ msm5205_reset_w(device,(data>>5)&1); /* bit 5 */
+ msm5205_vclk_w (device,(data>>4)&1); /* bit4 */
}
static WRITE8_HANDLER( ctrl_w )
@@ -203,9 +203,9 @@ static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(samples_r)
AM_RANGE(0x8000, 0x8000) AM_READWRITE(keyboard_r, SMH_NOP) // ??
AM_RANGE(0x8001, 0x8001) AM_READWRITE(SMH_NOP, keyboard_w) // ??
- AM_RANGE(0x8020, 0x8020) AM_READWRITE(ay8910_read_port_0_r, ay8910_control_port_0_w)
- AM_RANGE(0x8021, 0x8021) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x8040, 0x8040) AM_WRITE(adpcm_w)
+ AM_RANGE(0x8020, 0x8020) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x8020, 0x8021) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0x8040, 0x8040) AM_DEVWRITE(SOUND, "msm", adpcm_w)
AM_RANGE(0x8060, 0x8060) AM_WRITE(ctrl_w)
AM_RANGE(0x8080, 0x8080) AM_WRITE(SMH_NOP) // ??
AM_RANGE(0xbc04, 0xbc04) AM_WRITE(SMH_NOP) // ??
@@ -216,9 +216,9 @@ static ADDRESS_MAP_START( themj_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(samples_r)
AM_RANGE(0x8000, 0x8000) AM_READWRITE(keyboard_r, SMH_NOP) // ??
AM_RANGE(0x8001, 0x8001) AM_READWRITE(SMH_NOP, keyboard_w) // ??
- AM_RANGE(0x8020, 0x8020) AM_READWRITE(ay8910_read_port_0_r, ay8910_control_port_0_w)
- AM_RANGE(0x8021, 0x8021) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x8040, 0x8040) AM_WRITE(adpcm_w)
+ AM_RANGE(0x8020, 0x8020) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x8020, 0x8021) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0x8040, 0x8040) AM_DEVWRITE(SOUND, "msm", adpcm_w)
AM_RANGE(0x8060, 0x8060) AM_WRITE(ctrl_w)
AM_RANGE(0x8080, 0x8080) AM_WRITE(SMH_NOP) // ??
AM_RANGE(0x80a0, 0x80a0) AM_WRITE(themj_rombank_w)
@@ -429,8 +429,8 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r,
- input_port_1_r
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_INPUT_PORT("DSW1")
};
static const msm5205_interface msm5205_config =
diff --git a/src/mame/drivers/rockola.c b/src/mame/drivers/rockola.c
index 53ad4f39896..2dc0fc7ae91 100644
--- a/src/mame/drivers/rockola.c
+++ b/src/mame/drivers/rockola.c
@@ -267,7 +267,6 @@ Stephh's notes (based on the games M6502 code and some tests) :
#include "cpu/m6502/m6502.h"
#include "video/mc6845.h"
#include "sound/sn76477.h"
-#include "sound/custom.h"
#include "sound/samples.h"
#include "rockola.h"
@@ -849,8 +848,7 @@ static MACHINE_DRIVER_START( sasuke )
// sound hardware
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("rockola", CUSTOM, 0)
- MDRV_SOUND_CONFIG(custom_interface)
+ MDRV_SOUND_ADD("rockola", ROCKOLA, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MDRV_SOUND_ADD("samples", SAMPLES, 0)
@@ -924,8 +922,7 @@ static MACHINE_DRIVER_START( vanguard )
// sound hardware
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("rockola", CUSTOM, 0)
- MDRV_SOUND_CONFIG(custom_interface)
+ MDRV_SOUND_ADD("rockola", ROCKOLA, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MDRV_SOUND_ADD("samples", SAMPLES, 0)
diff --git a/src/mame/drivers/rockrage.c b/src/mame/drivers/rockrage.c
index 6ad2a81438b..1817fbee727 100644
--- a/src/mame/drivers/rockrage.c
+++ b/src/mame/drivers/rockrage.c
@@ -90,14 +90,14 @@ static WRITE8_HANDLER( rockrage_sh_irqtrigger_w )
cpu_set_input_line(space->machine->cpu[1],M6809_IRQ_LINE,HOLD_LINE);
}
-static READ8_HANDLER( rockrage_VLM5030_busy_r ) {
- return ( vlm5030_bsy() ? 1 : 0 );
+static READ8_DEVICE_HANDLER( rockrage_VLM5030_busy_r ) {
+ return ( vlm5030_bsy(device) ? 1 : 0 );
}
-static WRITE8_HANDLER( rockrage_speech_w ) {
+static WRITE8_DEVICE_HANDLER( rockrage_speech_w ) {
/* bit2 = data bus enable */
- vlm5030_rst( ( data >> 1 ) & 0x01 );
- vlm5030_st( ( data >> 0 ) & 0x01 );
+ vlm5030_rst( device, ( data >> 1 ) & 0x01 );
+ vlm5030_st( device, ( data >> 0 ) & 0x01 );
}
static ADDRESS_MAP_START( rockrage_readmem, ADDRESS_SPACE_PROGRAM, 8 )
@@ -131,18 +131,17 @@ static ADDRESS_MAP_START( rockrage_writemem, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END
static ADDRESS_MAP_START( rockrage_readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
- AM_RANGE(0x3000, 0x3000) AM_READ(rockrage_VLM5030_busy_r)/* VLM5030 */
+ AM_RANGE(0x3000, 0x3000) AM_DEVREAD(SOUND, "vlm", rockrage_VLM5030_busy_r)/* VLM5030 */
AM_RANGE(0x5000, 0x5000) AM_READ(soundlatch_r) /* soundlatch_r */
- AM_RANGE(0x6001, 0x6001) AM_READ(ym2151_status_port_0_r) /* YM 2151 */
+ AM_RANGE(0x6000, 0x6001) AM_DEVREAD(SOUND, "ym", ym2151_r) /* YM 2151 */
AM_RANGE(0x7000, 0x77ff) AM_READ(SMH_RAM) /* RAM */
AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) /* ROM */
ADDRESS_MAP_END
static ADDRESS_MAP_START( rockrage_writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
- AM_RANGE(0x2000, 0x2000) AM_WRITE(vlm5030_data_w) /* VLM5030 */
- AM_RANGE(0x4000, 0x4000) AM_WRITE(rockrage_speech_w) /* VLM5030 */
- AM_RANGE(0x6000, 0x6000) AM_WRITE(ym2151_register_port_0_w) /* YM 2151 */
- AM_RANGE(0x6001, 0x6001) AM_WRITE(ym2151_data_port_0_w) /* YM 2151 */
+ AM_RANGE(0x2000, 0x2000) AM_DEVWRITE(SOUND, "vlm", vlm5030_data_w) /* VLM5030 */
+ AM_RANGE(0x4000, 0x4000) AM_DEVWRITE(SOUND, "vlm", rockrage_speech_w) /* VLM5030 */
+ AM_RANGE(0x6000, 0x6001) AM_DEVWRITE(SOUND, "ym", ym2151_w) /* YM 2151 */
AM_RANGE(0x7000, 0x77ff) AM_WRITE(SMH_RAM) /* RAM */
AM_RANGE(0x8000, 0xffff) AM_WRITE(SMH_ROM) /* ROM */
ADDRESS_MAP_END
diff --git a/src/mame/drivers/rohga.c b/src/mame/drivers/rohga.c
index c2633622e4c..f0e1ee05baf 100644
--- a/src/mame/drivers/rohga.c
+++ b/src/mame/drivers/rohga.c
@@ -325,9 +325,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_READ(SMH_ROM)
AM_RANGE(0x100000, 0x100001) AM_READ(SMH_NOP)
- AM_RANGE(0x110000, 0x110001) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0x120000, 0x120001) AM_READ(okim6295_status_0_r)
- AM_RANGE(0x130000, 0x130001) AM_READ(okim6295_status_1_r)
+ AM_RANGE(0x110000, 0x110001) AM_DEVREAD(SOUND, "ym", ym2151_r)
+ AM_RANGE(0x120000, 0x120001) AM_DEVREAD(SOUND, "oki1", okim6295_r)
+ AM_RANGE(0x130000, 0x130001) AM_DEVREAD(SOUND, "oki2", okim6295_r)
AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
AM_RANGE(0x1f0000, 0x1f1fff) AM_READ(SMH_BANK8)
ADDRESS_MAP_END
@@ -335,9 +335,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_WRITE(SMH_ROM)
AM_RANGE(0x100000, 0x100001) AM_WRITE(SMH_NOP)
- AM_RANGE(0x110000, 0x110001) AM_WRITE(ym2151_word_0_w)
- AM_RANGE(0x120000, 0x120001) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0x130000, 0x130001) AM_WRITE(okim6295_data_1_w)
+ AM_RANGE(0x110000, 0x110001) AM_DEVWRITE(SOUND, "ym", ym2151_w)
+ AM_RANGE(0x120000, 0x120001) AM_DEVWRITE(SOUND, "oki1", okim6295_w)
+ AM_RANGE(0x130000, 0x130001) AM_DEVWRITE(SOUND, "oki2", okim6295_w)
AM_RANGE(0x1f0000, 0x1f1fff) AM_WRITE(SMH_BANK8)
AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w)
AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w)
@@ -789,15 +789,15 @@ GFXDECODE_END
/**********************************************************************************/
-static void sound_irq(running_machine *machine, int state)
+static void sound_irq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1],1,state); /* IRQ 2 */
+ cpu_set_input_line(device->machine->cpu[1],1,state); /* IRQ 2 */
}
-static WRITE8_HANDLER( sound_bankswitch_w )
+static WRITE8_DEVICE_HANDLER( sound_bankswitch_w )
{
- okim6295_set_bank_base(0, ((data & 1)>>0) * 0x40000);
- okim6295_set_bank_base(1, ((data & 2)>>1) * 0x40000);
+ okim6295_set_bank_base(devtag_get_device(device->machine, SOUND, "oki1"), ((data & 1)>>0) * 0x40000);
+ okim6295_set_bank_base(devtag_get_device(device->machine, SOUND, "oki2"), ((data & 2)>>1) * 0x40000);
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/rollerg.c b/src/mame/drivers/rollerg.c
index 570d9df3822..bf5617dc352 100644
--- a/src/mame/drivers/rollerg.c
+++ b/src/mame/drivers/rollerg.c
@@ -48,11 +48,11 @@ static READ8_HANDLER( rollerg_K051316_r )
else return K051316_0_r(space, offset);
}
-static READ8_HANDLER( rollerg_sound_r )
+static READ8_DEVICE_HANDLER( rollerg_sound_r )
{
/* If the sound CPU is running, read the status, otherwise
just make it pass the test */
- return k053260_0_r(space, 2 + offset);
+ return k053260_r(device, 2 + offset);
}
static WRITE8_HANDLER( soundirq_w )
@@ -78,7 +78,7 @@ static READ8_HANDLER( pip_r )
static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0020, 0x0020) AM_READ(watchdog_reset_r)
- AM_RANGE(0x0030, 0x0031) AM_READ(rollerg_sound_r) /* K053260 */
+ AM_RANGE(0x0030, 0x0031) AM_DEVREAD(SOUND, "konami", rollerg_sound_r) /* K053260 */
AM_RANGE(0x0050, 0x0050) AM_READ_PORT("P1")
AM_RANGE(0x0051, 0x0051) AM_READ_PORT("P2")
AM_RANGE(0x0052, 0x0052) AM_READ_PORT("DSW3")
@@ -97,7 +97,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0010, 0x0010) AM_WRITE(rollerg_0010_w)
AM_RANGE(0x0020, 0x0020) AM_WRITE(watchdog_reset_w)
- AM_RANGE(0x0030, 0x0031) AM_WRITE(k053260_0_w)
+ AM_RANGE(0x0030, 0x0031) AM_DEVWRITE(SOUND, "konami", k053260_w)
AM_RANGE(0x0040, 0x0040) AM_WRITE(soundirq_w)
AM_RANGE(0x0100, 0x010f) AM_WRITE(SMH_NOP) /* 053252? */
AM_RANGE(0x0200, 0x020f) AM_WRITE(K051316_ctrl_0_w)
@@ -112,16 +112,15 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM)
- AM_RANGE(0xa000, 0xa02f) AM_READ(k053260_0_r)
- AM_RANGE(0xc000, 0xc000) AM_READ(ym3812_status_port_0_r)
+ AM_RANGE(0xa000, 0xa02f) AM_DEVREAD(SOUND, "konami", k053260_r)
+ AM_RANGE(0xc000, 0xc001) AM_DEVREAD(SOUND, "ym", ym3812_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xa000, 0xa02f) AM_WRITE(k053260_0_w)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0xa000, 0xa02f) AM_DEVWRITE(SOUND, "konami", k053260_w)
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ym", ym3812_w)
AM_RANGE(0xfc00, 0xfc00) AM_WRITE(sound_arm_nmi_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/rollrace.c b/src/mame/drivers/rollrace.c
index e3ca3e67e72..884b878b86f 100644
--- a/src/mame/drivers/rollrace.c
+++ b/src/mame/drivers/rollrace.c
@@ -82,12 +82,9 @@ static ADDRESS_MAP_START( writemem_snd, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x2000, 0x2fff) AM_WRITE(SMH_RAM)
AM_RANGE(0x3000, 0x3000) AM_WRITE(interrupt_enable_w)
- AM_RANGE(0x4000, 0x4000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x4001, 0x4001) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x5000, 0x5000) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x5001, 0x5001) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x6000, 0x6000) AM_WRITE(ay8910_control_port_2_w)
- AM_RANGE(0x6001, 0x6001) AM_WRITE(ay8910_write_port_2_w)
+ AM_RANGE(0x4000, 0x4001) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x5000, 0x5001) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x6000, 0x6001) AM_DEVWRITE(SOUND, "ay3", ay8910_address_data_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/route16.c b/src/mame/drivers/route16.c
index b5084eff303..dc5d9d10d25 100644
--- a/src/mame/drivers/route16.c
+++ b/src/mame/drivers/route16.c
@@ -130,7 +130,7 @@ static WRITE8_HANDLER( route16_sharedram_w )
*
*************************************/
-static WRITE8_HANDLER( stratvox_sn76477_w )
+static WRITE8_DEVICE_HANDLER( stratvox_sn76477_w )
{
/***************************************************************
* AY8910 output bits are connected to...
@@ -143,13 +143,13 @@ static WRITE8_HANDLER( stratvox_sn76477_w )
* 1 - SN76477 vco
* 0 - SN76477 enable
***************************************************************/
- sn76477_enable_w(0, (data >> 0) & 1);
- sn76477_vco_w(0, (data >> 1) & 1);
- sn76477_envelope_1_w(0, (data >> 2) & 1);
- sn76477_envelope_2_w(0, (data >> 3) & 1);
- sn76477_mixer_a_w(0, (data >> 4) & 1);
- sn76477_mixer_b_w(0, (data >> 5) & 1);
- sn76477_mixer_c_w(0, (data >> 6) & 1);
+ sn76477_enable_w(device, (data >> 0) & 1);
+ sn76477_vco_w(device, (data >> 1) & 1);
+ sn76477_envelope_1_w(device, (data >> 2) & 1);
+ sn76477_envelope_2_w(device, (data >> 3) & 1);
+ sn76477_mixer_a_w(device, (data >> 4) & 1);
+ sn76477_mixer_b_w(device, (data >> 5) & 1);
+ sn76477_mixer_c_w(device, (data >> 6) & 1);
}
@@ -274,8 +274,8 @@ static ADDRESS_MAP_START( ttmahjng_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4800, 0x4800) AM_READ_PORT("DSW") AM_WRITE(route16_out0_w)
AM_RANGE(0x5000, 0x5000) AM_READ_PORT("IN0") AM_WRITE(route16_out1_w)
AM_RANGE(0x5800, 0x5800) AM_READWRITE(ttmahjng_input_port_matrix_r, ttmahjng_input_port_matrix_w)
- AM_RANGE(0x6800, 0x6800) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x6900, 0x6900) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x6800, 0x6800) AM_DEVWRITE(SOUND, "ay8910", ay8910_data_w)
+ AM_RANGE(0x6900, 0x6900) AM_DEVWRITE(SOUND, "ay8910", ay8910_address_w)
AM_RANGE(0x8000, 0xbfff) AM_RAM AM_BASE(&route16_videoram1) AM_SIZE(&route16_videoram_size)
ADDRESS_MAP_END
@@ -289,7 +289,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( stratvox_cpu2_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_ROM
- AM_RANGE(0x2800, 0x2800) AM_WRITE(dac_0_data_w)
+ AM_RANGE(0x2800, 0x2800) AM_DEVWRITE(SOUND, "dac", dac_w)
AM_RANGE(0x4000, 0x43ff) AM_READWRITE(sharedram_r, sharedram_w)
AM_RANGE(0x8000, 0xbfff) AM_RAM AM_BASE(&route16_videoram2)
ADDRESS_MAP_END
@@ -297,8 +297,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( cpu1_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0x1ff)
- AM_RANGE(0x0000, 0x0000) AM_MIRROR(0x00ff) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x0100, 0x0100) AM_MIRROR(0x00ff) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x0000, 0x0000) AM_MIRROR(0x00ff) AM_DEVWRITE(SOUND, "ay8910", ay8910_data_w)
+ AM_RANGE(0x0100, 0x0100) AM_MIRROR(0x00ff) AM_DEVWRITE(SOUND, "ay8910", ay8910_address_w)
ADDRESS_MAP_END
@@ -572,10 +572,10 @@ static const ay8910_interface stratvox_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- stratvox_sn76477_w, /* SN76477 commands (not used in Route 16?) */
- NULL
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_DEVICE_HANDLER(SOUND, "sn", stratvox_sn76477_w), /* SN76477 commands (not used in Route 16?) */
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/royalmah.c b/src/mame/drivers/royalmah.c
index a18beeb7bfe..a4b7e77c8c2 100644
--- a/src/mame/drivers/royalmah.c
+++ b/src/mame/drivers/royalmah.c
@@ -225,28 +225,28 @@ static WRITE8_HANDLER( input_port_select_w )
input_port_select = data;
}
-static READ8_HANDLER( royalmah_player_1_port_r )
+static READ8_DEVICE_HANDLER( royalmah_player_1_port_r )
{
- int ret = (input_port_read(space->machine, "KEY0") & 0xc0) | 0x3f;
+ int ret = (input_port_read(device->machine, "KEY0") & 0xc0) | 0x3f;
- if ((input_port_select & 0x01) == 0) ret &= input_port_read(space->machine, "KEY0");
- if ((input_port_select & 0x02) == 0) ret &= input_port_read(space->machine, "KEY1");
- if ((input_port_select & 0x04) == 0) ret &= input_port_read(space->machine, "KEY2");
- if ((input_port_select & 0x08) == 0) ret &= input_port_read(space->machine, "KEY3");
- if ((input_port_select & 0x10) == 0) ret &= input_port_read(space->machine, "KEY4");
+ if ((input_port_select & 0x01) == 0) ret &= input_port_read(device->machine, "KEY0");
+ if ((input_port_select & 0x02) == 0) ret &= input_port_read(device->machine, "KEY1");
+ if ((input_port_select & 0x04) == 0) ret &= input_port_read(device->machine, "KEY2");
+ if ((input_port_select & 0x08) == 0) ret &= input_port_read(device->machine, "KEY3");
+ if ((input_port_select & 0x10) == 0) ret &= input_port_read(device->machine, "KEY4");
return ret;
}
-static READ8_HANDLER( royalmah_player_2_port_r )
+static READ8_DEVICE_HANDLER( royalmah_player_2_port_r )
{
- int ret = (input_port_read(space->machine, "KEY5") & 0xc0) | 0x3f;
+ int ret = (input_port_read(device->machine, "KEY5") & 0xc0) | 0x3f;
- if ((input_port_select & 0x01) == 0) ret &= input_port_read(space->machine, "KEY5");
- if ((input_port_select & 0x02) == 0) ret &= input_port_read(space->machine, "KEY6");
- if ((input_port_select & 0x04) == 0) ret &= input_port_read(space->machine, "KEY7");
- if ((input_port_select & 0x08) == 0) ret &= input_port_read(space->machine, "KEY8");
- if ((input_port_select & 0x10) == 0) ret &= input_port_read(space->machine, "KEY9");
+ if ((input_port_select & 0x01) == 0) ret &= input_port_read(device->machine, "KEY5");
+ if ((input_port_select & 0x02) == 0) ret &= input_port_read(device->machine, "KEY6");
+ if ((input_port_select & 0x04) == 0) ret &= input_port_read(device->machine, "KEY7");
+ if ((input_port_select & 0x08) == 0) ret &= input_port_read(device->machine, "KEY8");
+ if ((input_port_select & 0x10) == 0) ret &= input_port_read(device->machine, "KEY9");
return ret;
}
@@ -382,18 +382,16 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( royalmah_iomap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE( 0x01, 0x01 ) AM_READ( ay8910_read_port_0_r )
- AM_RANGE( 0x02, 0x02 ) AM_WRITE( ay8910_write_port_0_w )
- AM_RANGE( 0x03, 0x03 ) AM_WRITE( ay8910_control_port_0_w )
+ AM_RANGE( 0x01, 0x01 ) AM_DEVREAD( SOUND, "ay", ay8910_r )
+ AM_RANGE( 0x02, 0x03 ) AM_DEVWRITE( SOUND, "ay", ay8910_data_address_w )
AM_RANGE( 0x10, 0x10 ) AM_READ_PORT("DSW1") AM_WRITE( royalmah_palbank_w )
AM_RANGE( 0x11, 0x11 ) AM_READ_PORT("SYSTEM") AM_WRITE( input_port_select_w )
ADDRESS_MAP_END
static ADDRESS_MAP_START( ippatsu_iomap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE( 0x01, 0x01 ) AM_READ( ay8910_read_port_0_r )
- AM_RANGE( 0x02, 0x02 ) AM_WRITE( ay8910_write_port_0_w )
- AM_RANGE( 0x03, 0x03 ) AM_WRITE( ay8910_control_port_0_w )
+ AM_RANGE( 0x01, 0x01 ) AM_DEVREAD( SOUND, "ay", ay8910_r )
+ AM_RANGE( 0x02, 0x03 ) AM_DEVWRITE( SOUND, "ay", ay8910_data_address_w )
AM_RANGE( 0x10, 0x10 ) AM_READ_PORT("DSW1") AM_WRITE( royalmah_palbank_w )
AM_RANGE( 0x11, 0x11 ) AM_READ_PORT("SYSTEM") AM_WRITE( input_port_select_w )
AM_RANGE( 0x12, 0x12 ) AM_READ_PORT("DSW2")
@@ -402,9 +400,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( suzume_iomap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE( 0x01, 0x01 ) AM_READ( ay8910_read_port_0_r )
- AM_RANGE( 0x02, 0x02 ) AM_WRITE( ay8910_write_port_0_w )
- AM_RANGE( 0x03, 0x03 ) AM_WRITE( ay8910_control_port_0_w )
+ AM_RANGE( 0x01, 0x01 ) AM_DEVREAD( SOUND, "ay", ay8910_r )
+ AM_RANGE( 0x02, 0x03 ) AM_DEVWRITE( SOUND, "ay", ay8910_data_address_w )
AM_RANGE( 0x10, 0x10 ) AM_READ_PORT("DSW1") AM_WRITE( royalmah_palbank_w )
AM_RANGE( 0x11, 0x11 ) AM_READ_PORT("SYSTEM") AM_WRITE( input_port_select_w )
AM_RANGE( 0x80, 0x80 ) AM_READ( suzume_dsw_r )
@@ -413,9 +410,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( dondenmj_iomap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE( 0x01, 0x01 ) AM_READ( ay8910_read_port_0_r )
- AM_RANGE( 0x02, 0x02 ) AM_WRITE( ay8910_write_port_0_w )
- AM_RANGE( 0x03, 0x03 ) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE( 0x01, 0x01 ) AM_DEVREAD( SOUND, "ay", ay8910_r )
+ AM_RANGE( 0x02, 0x03 ) AM_DEVWRITE( SOUND, "ay", ay8910_data_address_w)
AM_RANGE( 0x10, 0x10 ) AM_READ_PORT("DSW1") AM_WRITE( royalmah_palbank_w )
AM_RANGE( 0x11, 0x11 ) AM_READ_PORT("SYSTEM") AM_WRITE( input_port_select_w )
AM_RANGE( 0x85, 0x85 ) AM_READ_PORT("DSW2") // DSW2
@@ -425,9 +421,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( mjdiplob_iomap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE( 0x01, 0x01 ) AM_READ( ay8910_read_port_0_r )
- AM_RANGE( 0x02, 0x02 ) AM_WRITE( ay8910_write_port_0_w )
- AM_RANGE( 0x03, 0x03 ) AM_WRITE( ay8910_control_port_0_w )
+ AM_RANGE( 0x01, 0x01 ) AM_DEVREAD( SOUND, "ay", ay8910_r )
+ AM_RANGE( 0x02, 0x03 ) AM_DEVWRITE( SOUND, "ay", ay8910_data_address_w )
AM_RANGE( 0x10, 0x10 ) AM_READ_PORT("DSW1") AM_WRITE( royalmah_palbank_w )
AM_RANGE( 0x11, 0x11 ) AM_READ_PORT("SYSTEM") AM_WRITE( input_port_select_w )
AM_RANGE( 0x61, 0x61 ) AM_WRITE(tontonb_bank_w)
@@ -437,9 +432,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( tontonb_iomap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE( 0x01, 0x01 ) AM_READ( ay8910_read_port_0_r )
- AM_RANGE( 0x02, 0x02 ) AM_WRITE( ay8910_write_port_0_w )
- AM_RANGE( 0x03, 0x03 ) AM_WRITE( ay8910_control_port_0_w )
+ AM_RANGE( 0x01, 0x01 ) AM_DEVREAD( SOUND, "ay", ay8910_r )
+ AM_RANGE( 0x02, 0x03 ) AM_DEVWRITE( SOUND, "ay", ay8910_data_address_w )
AM_RANGE( 0x10, 0x10 ) AM_READ_PORT("DSW1") AM_WRITE( royalmah_palbank_w )
AM_RANGE( 0x11, 0x11 ) AM_READ_PORT("SYSTEM") AM_WRITE( input_port_select_w )
AM_RANGE( 0x44, 0x44 ) AM_WRITE( tontonb_bank_w )
@@ -449,9 +443,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( majs101b_iomap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE( 0x01, 0x01 ) AM_READ( ay8910_read_port_0_r )
- AM_RANGE( 0x02, 0x02 ) AM_WRITE( ay8910_write_port_0_w )
- AM_RANGE( 0x03, 0x03 ) AM_WRITE( ay8910_control_port_0_w )
+ AM_RANGE( 0x01, 0x01 ) AM_DEVREAD( SOUND, "ay", ay8910_r )
+ AM_RANGE( 0x02, 0x03 ) AM_DEVWRITE( SOUND, "ay", ay8910_data_address_w )
AM_RANGE( 0x10, 0x10 ) AM_READ_PORT("DSW1") AM_WRITE( royalmah_palbank_w )
AM_RANGE( 0x11, 0x11 ) AM_READ_PORT("SYSTEM") AM_WRITE( input_port_select_w )
AM_RANGE( 0x00, 0x00 ) AM_READWRITE( majs101b_dsw_r, dynax_bank_w )
@@ -459,9 +452,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( mjderngr_iomap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE( 0x01, 0x01 ) AM_READ( ay8910_read_port_0_r )
- AM_RANGE( 0x02, 0x02 ) AM_WRITE( ay8910_write_port_0_w )
- AM_RANGE( 0x03, 0x03 ) AM_WRITE( ay8910_control_port_0_w )
+ AM_RANGE( 0x01, 0x01 ) AM_DEVREAD( SOUND, "ay", ay8910_r )
+ AM_RANGE( 0x02, 0x03 ) AM_DEVWRITE( SOUND, "ay", ay8910_data_address_w )
// AM_RANGE( 0x10, 0x10 ) AM_READ_PORT("DSW1")
AM_RANGE( 0x10, 0x10 ) AM_WRITE( mjderngr_coin_w ) // palette bank is set separately
AM_RANGE( 0x11, 0x11 ) AM_READ_PORT("SYSTEM") AM_WRITE( input_port_select_w )
@@ -474,9 +466,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( mjapinky_iomap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE( 0x00, 0x00 ) AM_WRITE( mjapinky_bank_w )
- AM_RANGE( 0x01, 0x01 ) AM_READ( ay8910_read_port_0_r )
- AM_RANGE( 0x02, 0x02 ) AM_WRITE( ay8910_write_port_0_w )
- AM_RANGE( 0x03, 0x03 ) AM_WRITE( ay8910_control_port_0_w )
+ AM_RANGE( 0x01, 0x01 ) AM_DEVREAD( SOUND, "ay", ay8910_r )
+ AM_RANGE( 0x02, 0x03 ) AM_DEVWRITE( SOUND, "ay", ay8910_data_address_w )
AM_RANGE( 0x04, 0x04 ) AM_READ_PORT("DSW2")
AM_RANGE( 0x10, 0x10 ) AM_READ_PORT("DSW1") AM_WRITE( mjapinky_palbank_w )
AM_RANGE( 0x11, 0x11 ) AM_READ_PORT("SYSTEM") AM_WRITE( input_port_select_w )
@@ -571,9 +562,8 @@ static ADDRESS_MAP_START( janptr96_iomap, ADDRESS_SPACE_IO, 8 )
AM_RANGE( 0x20, 0x20 ) AM_READWRITE( janptr96_unknown_r, janptr96_rambank_w )
AM_RANGE( 0x50, 0x50 ) AM_WRITE( mjderngr_palbank_w )
AM_RANGE( 0x60, 0x6f ) AM_DEVREADWRITE(MSM6242, "rtc", msm6242_r, msm6242_w)
- AM_RANGE( 0x81, 0x81 ) AM_READ( ay8910_read_port_0_r )
- AM_RANGE( 0x82, 0x82 ) AM_WRITE( ay8910_write_port_0_w )
- AM_RANGE( 0x83, 0x83 ) AM_WRITE( ay8910_control_port_0_w )
+ AM_RANGE( 0x81, 0x81 ) AM_DEVREAD( SOUND, "ay", ay8910_r )
+ AM_RANGE( 0x82, 0x83 ) AM_DEVWRITE( SOUND, "ay", ay8910_data_address_w )
AM_RANGE( 0x93, 0x93 ) AM_WRITE( input_port_select_w )
AM_RANGE( 0xd8, 0xd8 ) AM_WRITE( janptr96_coin_counter_w )
AM_RANGE( 0xd9, 0xd9 ) AM_READ_PORT("SYSTEM")
@@ -603,7 +593,7 @@ static READ8_HANDLER( mjifb_rom_io_r )
{
case 0x8000: return input_port_read(space->machine, "DSW4"); // dsw 4
case 0x8200: return input_port_read(space->machine, "DSW3"); // dsw 3
- case 0x9001: return ay8910_read_port_0_r(space, 0); // inputs
+ case 0x9001: return ay8910_r(devtag_get_device(space->machine,SOUND,"ay"), 0); // inputs
case 0x9011: return input_port_read(space->machine, "SYSTEM");
}
@@ -624,8 +614,8 @@ static WRITE8_HANDLER( mjifb_rom_io_w )
switch(offset)
{
case 0x8e00: palette_base = data & 0x1f; return;
- case 0x9002: ay8910_write_port_0_w(space,0,data); return;
- case 0x9003: ay8910_control_port_0_w(space,0,data); return;
+ case 0x9002: ay8910_data_w(devtag_get_device(space->machine,SOUND,"ay"),0,data); return;
+ case 0x9003: ay8910_address_w(devtag_get_device(space->machine,SOUND,"ay"),0,data); return;
case 0x9010:
mjifb_coin_counter_w(space,0,data);
return;
@@ -710,7 +700,7 @@ static READ8_HANDLER( mjdejavu_rom_io_r )
{
case 0x8000: return input_port_read(space->machine, "DSW2"); // dsw 2
case 0x8001: return input_port_read(space->machine, "DSW1"); // dsw 1
- case 0x9001: return ay8910_read_port_0_r(space, 0); // inputs
+ case 0x9001: return ay8910_r(devtag_get_device(space->machine,SOUND,"ay"), 0); // inputs
case 0x9011: return input_port_read(space->machine, "SYSTEM");
}
@@ -730,8 +720,8 @@ static WRITE8_HANDLER( mjdejavu_rom_io_w )
switch(offset)
{
case 0x8802: palette_base = data & 0x1f; return;
- case 0x9002: ay8910_write_port_0_w(space,0,data); return;
- case 0x9003: ay8910_control_port_0_w(space,0,data); return;
+ case 0x9002: ay8910_data_w(devtag_get_device(space->machine,SOUND,"ay"),0,data); return;
+ case 0x9003: ay8910_address_w(devtag_get_device(space->machine,SOUND,"ay"),0,data); return;
case 0x9010: mjifb_coin_counter_w(space,0,data); return;
case 0x9011: input_port_select_w(space,0,data); return;
case 0x9013:
@@ -777,9 +767,8 @@ static WRITE8_HANDLER( mjtensin_6ff3_w )
static ADDRESS_MAP_START( mjtensin_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE( 0x0000, 0x5fff ) AM_ROM
AM_RANGE( 0x6000, 0x6fbf ) AM_RAM
- AM_RANGE( 0x6fc1, 0x6fc1 ) AM_READ( ay8910_read_port_0_r )
- AM_RANGE( 0x6fc2, 0x6fc2 ) AM_WRITE( ay8910_write_port_0_w )
- AM_RANGE( 0x6fc3, 0x6fc3 ) AM_WRITE( ay8910_control_port_0_w )
+ AM_RANGE( 0x6fc1, 0x6fc1 ) AM_DEVREAD( SOUND, "ay", ay8910_r )
+ AM_RANGE( 0x6fc2, 0x6fc3 ) AM_DEVWRITE( SOUND, "ay", ay8910_data_address_w )
AM_RANGE( 0x6fd0, 0x6fd0 ) AM_WRITE( janptr96_coin_counter_w )
AM_RANGE( 0x6fd1, 0x6fd1 ) AM_READ_PORT("SYSTEM") AM_WRITE( input_port_select_w )
AM_RANGE( 0x6fe0, 0x6fef ) AM_DEVREADWRITE(MSM6242, "rtc", msm6242_r, msm6242_w)
@@ -846,9 +835,8 @@ static WRITE8_HANDLER( cafetime_7fe3_w )
static ADDRESS_MAP_START( cafetime_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE( 0x0000, 0x5fff ) AM_ROM
AM_RANGE( 0x6000, 0x7eff ) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
- AM_RANGE( 0x7fc1, 0x7fc1 ) AM_READ( ay8910_read_port_0_r )
- AM_RANGE( 0x7fc2, 0x7fc2 ) AM_WRITE( ay8910_write_port_0_w )
- AM_RANGE( 0x7fc3, 0x7fc3 ) AM_WRITE( ay8910_control_port_0_w )
+ AM_RANGE( 0x7fc1, 0x7fc1 ) AM_DEVREAD( SOUND, "ay", ay8910_r )
+ AM_RANGE( 0x7fc2, 0x7fc3 ) AM_DEVWRITE( SOUND, "ay", ay8910_data_address_w )
AM_RANGE( 0x7fd0, 0x7fd0 ) AM_WRITE( janptr96_coin_counter_w )
AM_RANGE( 0x7fd1, 0x7fd1 ) AM_READ_PORT("SYSTEM") AM_WRITENOP
AM_RANGE( 0x7fd3, 0x7fd3 ) AM_WRITE( input_port_select_w )
@@ -2234,8 +2222,8 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- royalmah_player_1_port_r,
- royalmah_player_2_port_r
+ DEVCB_HANDLER(royalmah_player_1_port_r),
+ DEVCB_HANDLER(royalmah_player_2_port_r)
};
static MACHINE_DRIVER_START( royalmah )
diff --git a/src/mame/drivers/rpunch.c b/src/mame/drivers/rpunch.c
index bee7bbb0caf..e293b31e6d4 100644
--- a/src/mame/drivers/rpunch.c
+++ b/src/mame/drivers/rpunch.c
@@ -144,10 +144,10 @@ WRITE16_HANDLER( rpunch_crtc_register_w );
*
*************************************/
-static void ym2151_irq_gen(running_machine *machine, int state)
+static void ym2151_irq_gen(const device_config *device, int state)
{
ym2151_irq = state;
- cpu_set_input_line(machine->cpu[1], 0, (ym2151_irq | sound_busy) ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, (ym2151_irq | sound_busy) ? ASSERT_LINE : CLEAR_LINE);
}
@@ -213,23 +213,23 @@ static READ16_HANDLER( sound_busy_r )
*
*************************************/
-static WRITE8_HANDLER( upd_control_w )
+static WRITE8_DEVICE_HANDLER( upd_control_w )
{
if ((data & 1) != upd_rom_bank)
{
- UINT8 *snd = memory_region(space->machine, "upd");
+ UINT8 *snd = memory_region(device->machine, "upd");
upd_rom_bank = data & 1;
memcpy(snd, snd + 0x20000 * (upd_rom_bank + 1), 0x20000);
}
- upd7759_reset_w(0, data >> 7);
+ upd7759_reset_w(device, data >> 7);
}
-static WRITE8_HANDLER( upd_data_w )
+static WRITE8_DEVICE_HANDLER( upd_data_w )
{
- upd7759_port_w(0, data);
- upd7759_start_w(0, 0);
- upd7759_start_w(0, 1);
+ upd7759_port_w(device, 0, data);
+ upd7759_start_w(device, 0);
+ upd7759_start_w(device, 1);
}
@@ -281,7 +281,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_READ(SMH_ROM)
- AM_RANGE(0xf000, 0xf001) AM_READ(ym2151_status_port_0_r)
+ AM_RANGE(0xf000, 0xf001) AM_DEVREAD(SOUND, "ym", ym2151_r)
AM_RANGE(0xf200, 0xf200) AM_READ(sound_command_r)
AM_RANGE(0xf800, 0xffff) AM_READ(SMH_RAM)
ADDRESS_MAP_END
@@ -289,10 +289,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_WRITE(SMH_ROM)
- AM_RANGE(0xf000, 0xf000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xf001, 0xf001) AM_WRITE(ym2151_data_port_0_w)
- AM_RANGE(0xf400, 0xf400) AM_WRITE(upd_control_w)
- AM_RANGE(0xf600, 0xf600) AM_WRITE(upd_data_w)
+ AM_RANGE(0xf000, 0xf001) AM_DEVWRITE(SOUND, "ym", ym2151_w)
+ AM_RANGE(0xf400, 0xf400) AM_DEVWRITE(SOUND, "upd", upd_control_w)
+ AM_RANGE(0xf600, 0xf600) AM_DEVWRITE(SOUND, "upd", upd_data_w)
AM_RANGE(0xf800, 0xffff) AM_WRITE(SMH_RAM)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/runaway.c b/src/mame/drivers/runaway.c
index 38b791a1175..e656fb4a7ab 100644
--- a/src/mame/drivers/runaway.c
+++ b/src/mame/drivers/runaway.c
@@ -67,9 +67,9 @@ static READ8_HANDLER( runaway_input_r )
}
-static READ8_HANDLER( runaway_pot_r )
+static READ8_DEVICE_HANDLER( runaway_pot_r )
{
- return (input_port_read(space->machine, "7000") << (7 - offset)) & 0x80;
+ return (input_port_read(device->machine, "7000") << (7 - offset)) & 0x80;
}
@@ -91,8 +91,8 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x3000, 0x3007) AM_READ(runaway_input_r)
AM_RANGE(0x4000, 0x4000) AM_READ_PORT("4000")
AM_RANGE(0x5000, 0x5000) AM_READ(atari_vg_earom_r)
- AM_RANGE(0x6000, 0x600f) AM_READ(pokey1_r)
- AM_RANGE(0x7000, 0x700f) AM_READ(pokey2_r)
+ AM_RANGE(0x6000, 0x600f) AM_DEVREAD(SOUND, "pokey1", pokey_r)
+ AM_RANGE(0x7000, 0x700f) AM_DEVREAD(SOUND, "pokey2", pokey_r)
AM_RANGE(0x8000, 0xcfff) AM_READ(SMH_ROM)
AM_RANGE(0xf000, 0xffff) AM_READ(SMH_ROM) /* for the interrupt vectors */
ADDRESS_MAP_END
@@ -110,8 +110,8 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x2001, 0x2001) AM_WRITE(SMH_NOP) /* coin counter? */
AM_RANGE(0x2003, 0x2004) AM_WRITE(runaway_led_w)
AM_RANGE(0x2005, 0x2005) AM_WRITE(runaway_tile_bank_w)
- AM_RANGE(0x6000, 0x600f) AM_WRITE(pokey1_w)
- AM_RANGE(0x7000, 0x700f) AM_WRITE(pokey2_w)
+ AM_RANGE(0x6000, 0x600f) AM_DEVWRITE(SOUND, "pokey1", pokey_w)
+ AM_RANGE(0x7000, 0x700f) AM_DEVWRITE(SOUND, "pokey2", pokey_w)
AM_RANGE(0x8000, 0xcfff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
@@ -340,13 +340,22 @@ GFXDECODE_END
static const pokey_interface pokey_interface_1 =
{
- { 0 },
- input_port_3_r
+ { DEVCB_NULL },
+ DEVCB_INPUT_PORT("6008")
};
static const pokey_interface pokey_interface_2 =
{
- { runaway_pot_r,runaway_pot_r,runaway_pot_r,runaway_pot_r,runaway_pot_r,runaway_pot_r,runaway_pot_r,runaway_pot_r }
+ {
+ DEVCB_HANDLER(runaway_pot_r),
+ DEVCB_HANDLER(runaway_pot_r),
+ DEVCB_HANDLER(runaway_pot_r),
+ DEVCB_HANDLER(runaway_pot_r),
+ DEVCB_HANDLER(runaway_pot_r),
+ DEVCB_HANDLER(runaway_pot_r),
+ DEVCB_HANDLER(runaway_pot_r),
+ DEVCB_HANDLER(runaway_pot_r)
+ }
};
diff --git a/src/mame/drivers/rungun.c b/src/mame/drivers/rungun.c
index 287ad555399..04a80181da5 100644
--- a/src/mame/drivers/rungun.c
+++ b/src/mame/drivers/rungun.c
@@ -277,9 +277,9 @@ static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK2)
AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM)
- AM_RANGE(0xe000, 0xe22f) AM_READ(k054539_0_r)
+ AM_RANGE(0xe000, 0xe22f) AM_DEVREAD(SOUND, "konami1", k054539_r)
AM_RANGE(0xe230, 0xe3ff) AM_READ(SMH_RAM)
- AM_RANGE(0xe400, 0xe62f) AM_READ(k054539_1_r)
+ AM_RANGE(0xe400, 0xe62f) AM_DEVREAD(SOUND, "konami2", k054539_r)
AM_RANGE(0xe630, 0xe7ff) AM_READ(SMH_RAM)
AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_r)
AM_RANGE(0xf003, 0xf003) AM_READ(soundlatch2_r)
@@ -288,9 +288,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xdfff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xe000, 0xe22f) AM_WRITE(k054539_0_w)
+ AM_RANGE(0xe000, 0xe22f) AM_DEVWRITE(SOUND, "konami1", k054539_w)
AM_RANGE(0xe230, 0xe3ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xe400, 0xe62f) AM_WRITE(k054539_1_w)
+ AM_RANGE(0xe400, 0xe62f) AM_DEVWRITE(SOUND, "konami2", k054539_w)
AM_RANGE(0xe630, 0xe7ff) AM_WRITE(SMH_RAM)
AM_RANGE(0xf000, 0xf000) AM_WRITE(sound_status_w)
AM_RANGE(0xf800, 0xf800) AM_WRITE(z80ctrl_w)
@@ -641,7 +641,7 @@ static DRIVER_INIT( rng )
static MACHINE_RESET( rng )
{
- k054539_init_flags(0, K054539_REVERSE_STEREO);
+ k054539_init_flags(devtag_get_device(machine, SOUND, "konami"), K054539_REVERSE_STEREO);
memset(rng_sysreg, 0, 0x20);
diff --git a/src/mame/drivers/sandscrp.c b/src/mame/drivers/sandscrp.c
index 3bddf62b196..43f032b910a 100644
--- a/src/mame/drivers/sandscrp.c
+++ b/src/mame/drivers/sandscrp.c
@@ -272,9 +272,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sandscrp_soundport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(sandscrp_bankswitch_w) // ROM Bank
- AM_RANGE(0x02, 0x02) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w) // YM2203
- AM_RANGE(0x03, 0x03) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w) // PORTA/B read
- AM_RANGE(0x04, 0x04) AM_WRITE(okim6295_data_0_w) // OKIM6295
+ AM_RANGE(0x02, 0x03) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w) // PORTA/B read
+ AM_RANGE(0x04, 0x04) AM_DEVWRITE(SOUND, "oki", okim6295_w) // OKIM6295
AM_RANGE(0x06, 0x06) AM_WRITE(sandscrp_soundlatch_w) //
AM_RANGE(0x07, 0x07) AM_READ(sandscrp_soundlatch_r) //
AM_RANGE(0x08, 0x08) AM_READ(sandscrp_latchstatus_r) //
@@ -413,9 +412,9 @@ GFXDECODE_END
/* YM3014B + YM2203C */
-static void irq_handler(running_machine *machine, int irq)
+static void irq_handler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface ym2203_intf_sandscrp =
@@ -423,10 +422,10 @@ static const ym2203_interface ym2203_intf_sandscrp =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_4_r, /* Port A Read - DSW 1 */
- input_port_5_r, /* Port B Read - DSW 2 */
- NULL, /* Port A Write */
- NULL, /* Port B Write */
+ DEVCB_INPUT_PORT("DSW1"), /* Port A Read */
+ DEVCB_INPUT_PORT("DSW2"), /* Port B Read */
+ DEVCB_NULL, /* Port A Write */
+ DEVCB_NULL, /* Port B Write */
},
irq_handler /* IRQ handler */
};
diff --git a/src/mame/drivers/sangho.c b/src/mame/drivers/sangho.c
index 011900184b3..09f9374a032 100644
--- a/src/mame/drivers/sangho.c
+++ b/src/mame/drivers/sangho.c
@@ -78,8 +78,7 @@ static WRITE8_HANDLER(pzlestar_bank_w)
static ADDRESS_MAP_START( pzlestar_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE( 0x7c, 0x7c) AM_WRITE( ym2413_register_port_0_w )
- AM_RANGE( 0x7d, 0x7d) AM_WRITE( ym2413_data_port_0_w )
+ AM_RANGE( 0x7c, 0x7d) AM_DEVWRITE( SOUND, "ym", ym2413_w )
AM_RANGE( 0x91, 0x91) AM_WRITE( pzlestar_bank_w )
AM_RANGE( 0x98, 0x98) AM_READWRITE( v9938_0_vram_r, v9938_0_vram_w )
AM_RANGE( 0x99, 0x99) AM_READWRITE( v9938_0_status_r, v9938_0_command_w )
@@ -101,8 +100,7 @@ static ADDRESS_MAP_START( sexyboom_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE( 0xf1, 0xf1) AM_READ( v9938_0_status_r )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE( 0x7c, 0x7c) AM_WRITE( ym2413_register_port_0_w )
- AM_RANGE( 0x7d, 0x7d) AM_WRITE( ym2413_data_port_0_w )
+ AM_RANGE( 0x7c, 0x7d) AM_DEVWRITE( SOUND, "ym", ym2413_w )
AM_RANGE( 0xf0, 0xf0) AM_WRITE( v9938_0_vram_w )
AM_RANGE( 0xf1, 0xf1) AM_WRITE( v9938_0_command_w )
AM_RANGE( 0xf2, 0xf2) AM_WRITE( v9938_0_palette_w )
diff --git a/src/mame/drivers/sauro.c b/src/mame/drivers/sauro.c
index 704c8221219..7159553c0f7 100644
--- a/src/mame/drivers/sauro.c
+++ b/src/mame/drivers/sauro.c
@@ -130,9 +130,9 @@ static WRITE8_HANDLER( flip_screen_w )
flip_screen_set(space->machine, data);
}
-static WRITE8_HANDLER( adpcm_w )
+static WRITE8_DEVICE_HANDLER( adpcm_w )
{
- sp0256_ALD_w(space, 0, data);
+ sp0256_ALD_w(device, 0, data);
}
static ADDRESS_MAP_START( sauro_readmem, ADDRESS_SPACE_PROGRAM, 8 )
@@ -185,9 +185,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sauro_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ym3812_write_port_0_w)
- AM_RANGE(0xa000, 0xa000) AM_WRITE(adpcm_w)
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ym", ym3812_w)
+ AM_RANGE(0xa000, 0xa000) AM_DEVWRITE(SOUND, "speech", adpcm_w)
AM_RANGE(0xe000, 0xe006) AM_WRITE(SMH_NOP) /* echo from write to e0000 */
AM_RANGE(0xe00e, 0xe00f) AM_WRITE(SMH_NOP)
ADDRESS_MAP_END
@@ -209,8 +208,7 @@ static ADDRESS_MAP_START( trckydoc_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xec00, 0xefff) AM_WRITE(trckydoc_spriteram_mirror_w) // it clears sprites from the screen by writing here to set some of the attributes
AM_RANGE(0xf000, 0xf3ff) AM_WRITE(tecfri_videoram_w) AM_BASE(&tecfri_videoram)
AM_RANGE(0xf400, 0xf7ff) AM_WRITE(tecfri_colorram_w) AM_BASE(&tecfri_colorram)
- AM_RANGE(0xf820, 0xf820) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0xf821, 0xf821) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0xf820, 0xf821) AM_DEVWRITE(SOUND, "ym", ym3812_w)
AM_RANGE(0xf830, 0xf830) AM_WRITE(tecfri_scroll_bg_w)
AM_RANGE(0xf838, 0xf838) AM_WRITE(SMH_NOP) /* only written at startup */
AM_RANGE(0xf839, 0xf839) AM_WRITE(flip_screen_w)
diff --git a/src/mame/drivers/sbasketb.c b/src/mame/drivers/sbasketb.c
index 3fc13cc7629..6dfde153327 100644
--- a/src/mame/drivers/sbasketb.c
+++ b/src/mame/drivers/sbasketb.c
@@ -61,8 +61,8 @@ VIDEO_START( sbasketb );
VIDEO_UPDATE( sbasketb );
WRITE8_HANDLER( konami_SN76496_latch_w );
-WRITE8_HANDLER( konami_SN76496_0_w );
-WRITE8_HANDLER( hyperspt_sound_w );
+WRITE8_DEVICE_HANDLER( konami_SN76496_w );
+WRITE8_DEVICE_HANDLER( hyperspt_sound_w );
READ8_HANDLER( hyperspt_sh_timer_r );
@@ -115,11 +115,11 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4000, 0x43ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xa000, 0xa000) AM_WRITE(vlm5030_data_w) /* speech data */
- AM_RANGE(0xc000, 0xdfff) AM_WRITE(hyperspt_sound_w) /* speech and output controll */
- AM_RANGE(0xe000, 0xe000) AM_WRITE(dac_0_data_w)
+ AM_RANGE(0xa000, 0xa000) AM_DEVWRITE(SOUND, "vlm", vlm5030_data_w) /* speech data */
+ AM_RANGE(0xc000, 0xdfff) AM_DEVWRITE(SOUND, "vlm", hyperspt_sound_w) /* speech and output controll */
+ AM_RANGE(0xe000, 0xe000) AM_DEVWRITE(SOUND, "dac", dac_w)
AM_RANGE(0xe001, 0xe001) AM_WRITE(konami_SN76496_latch_w) /* Loads the snd command into the snd latch */
- AM_RANGE(0xe002, 0xe002) AM_WRITE(konami_SN76496_0_w) /* This address triggers the SN chip to read the data port. */
+ AM_RANGE(0xe002, 0xe002) AM_DEVWRITE(SOUND, "sn", konami_SN76496_w) /* This address triggers the SN chip to read the data port. */
ADDRESS_MAP_END
diff --git a/src/mame/drivers/sbowling.c b/src/mame/drivers/sbowling.c
index 01ac41308c1..87c1f2ab530 100644
--- a/src/mame/drivers/sbowling.c
+++ b/src/mame/drivers/sbowling.c
@@ -187,8 +187,8 @@ static READ8_HANDLER (controls_r)
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x2fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_RAM_WRITE(sbw_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size)
- AM_RANGE(0xf800, 0xf800) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xf801, 0xf801) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
+ AM_RANGE(0xf800, 0xf801) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0xf801, 0xf801) AM_DEVREAD(SOUND, "ay", ay8910_r)
AM_RANGE(0xfc00, 0xffff) AM_RAM
ADDRESS_MAP_END
diff --git a/src/mame/drivers/sbrkout.c b/src/mame/drivers/sbrkout.c
index ac6a5b533a5..37b1687e063 100644
--- a/src/mame/drivers/sbrkout.c
+++ b/src/mame/drivers/sbrkout.c
@@ -120,7 +120,7 @@ static TIMER_CALLBACK( scanline_callback )
cpu_set_input_line(machine->cpu[0], 0, ASSERT_LINE);
/* update the DAC state */
- dac_data_w(0, (videoram[0x380 + 0x11] & (scanline >> 2)) ? 255 : 0);
+ dac_data_w(devtag_get_device(machine, SOUND, "dac"), (videoram[0x380 + 0x11] & (scanline >> 2)) ? 255 : 0);
/* on the VBLANK, read the pot and schedule an interrupt time for it */
if (scanline == video_screen_get_visible_area(machine->primary_screen)->max_y + 1)
diff --git a/src/mame/drivers/sbugger.c b/src/mame/drivers/sbugger.c
index b88c207dbef..6c36af9111d 100644
--- a/src/mame/drivers/sbugger.c
+++ b/src/mame/drivers/sbugger.c
@@ -138,8 +138,8 @@ static ADDRESS_MAP_START( readport, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0xe4, 0xe4) AM_WRITENOP // 8156 timer reg1 (write 7f = CNT length)
AM_RANGE(0xe5, 0xe5) AM_WRITENOP // 8156 timer reg2 (write c0 = timer mode - automatic reload, i.e. single pulse every time TC is reached)
- AM_RANGE(0xe8, 0xe8) AM_WRITE(sn76496_0_w)
- AM_RANGE(0xe9, 0xe9) AM_WRITE(sn76496_1_w)
+ AM_RANGE(0xe8, 0xe8) AM_DEVWRITE(SOUND, "sn76489.1", sn76496_w)
+ AM_RANGE(0xe9, 0xe9) AM_DEVWRITE(SOUND, "sn76489.2", sn76496_w)
ADDRESS_MAP_END
/* gfx decode */
diff --git a/src/mame/drivers/scobra.c b/src/mame/drivers/scobra.c
index 5d7b018d83a..87538efb4a0 100644
--- a/src/mame/drivers/scobra.c
+++ b/src/mame/drivers/scobra.c
@@ -74,10 +74,10 @@ static const ay8910_interface hustler_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r,
- frogger_portB_r,
- NULL,
- NULL
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r),
+ DEVCB_HANDLER(frogger_portB_r),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static READ8_DEVICE_HANDLER(scobra_type2_ppi8255_r)
@@ -406,10 +406,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( scobra_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x10, 0x10) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x20, 0x20) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x40, 0x40) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x80, 0x80) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
+ AM_RANGE(0x10, 0x10) AM_DEVWRITE(SOUND, "ay1", ay8910_address_w)
+ AM_RANGE(0x20, 0x20) AM_DEVREADWRITE(SOUND, "ay1", ay8910_r, ay8910_data_w)
+ AM_RANGE(0x40, 0x40) AM_DEVWRITE(SOUND, "ay2", ay8910_address_w)
+ AM_RANGE(0x80, 0x80) AM_DEVREADWRITE(SOUND, "ay2", ay8910_r, ay8910_data_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( hustler_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
@@ -425,15 +425,15 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( hustler_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x40, 0x40) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x40, 0x40) AM_DEVREADWRITE(SOUND, "ay", ay8910_r, ay8910_data_w)
+ AM_RANGE(0x80, 0x80) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( hustlerb_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x40, 0x40) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x80, 0x80) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
+ AM_RANGE(0x40, 0x40) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
+ AM_RANGE(0x80, 0x80) AM_DEVREADWRITE(SOUND, "ay", ay8910_r, ay8910_data_w)
ADDRESS_MAP_END
/* stratgyx coinage DIPs are spread accross two input ports */
@@ -923,10 +923,10 @@ static const ay8910_interface scobra_ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r,
- scramble_portB_r,
- NULL,
- NULL
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r),
+ DEVCB_HANDLER(scramble_portB_r),
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/scotrsht.c b/src/mame/drivers/scotrsht.c
index f36b0ea461d..26a282d9355 100644
--- a/src/mame/drivers/scotrsht.c
+++ b/src/mame/drivers/scotrsht.c
@@ -100,8 +100,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( scotrsht_sound_port, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/scramble.c b/src/mame/drivers/scramble.c
index 49731a4c143..c0a25bf791d 100644
--- a/src/mame/drivers/scramble.c
+++ b/src/mame/drivers/scramble.c
@@ -349,18 +349,18 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( triplep_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ay8910_read_port_0_r, ay8910_control_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "8910.1", ay8910_data_address_w)
+ AM_RANGE(0x01, 0x01) AM_DEVREAD(SOUND, "8910.1", ay8910_r)
AM_RANGE(0x02, 0x02) AM_READ(triplep_pip_r)
AM_RANGE(0x03, 0x03) AM_READ(triplep_pap_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( hotshock_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x10, 0x10) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x20, 0x20) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x40, 0x40) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0x10, 0x10) AM_DEVWRITE(SOUND, "8910.1", ay8910_address_w)
+ AM_RANGE(0x20, 0x20) AM_DEVREADWRITE(SOUND, "8910.1", ay8910_r, ay8910_data_w)
+ AM_RANGE(0x40, 0x40) AM_DEVREADWRITE(SOUND, "8910.2", ay8910_r, ay8910_data_w)
+ AM_RANGE(0x80, 0x80) AM_DEVWRITE(SOUND, "8910.2", ay8910_address_w)
ADDRESS_MAP_END
static READ8_HANDLER( hncholms_prot_r )
@@ -1224,28 +1224,28 @@ static const ay8910_interface scramble_ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r,
- scramble_portB_r,
- NULL,
- NULL
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r),
+ DEVCB_HANDLER(scramble_portB_r),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface hotshock_ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- hotshock_soundlatch_r,
- scramble_portB_r,
- NULL,
- NULL
+ DEVCB_HANDLER(hotshock_soundlatch_r),
+ DEVCB_HANDLER(scramble_portB_r),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface triplep_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
};
@@ -1304,10 +1304,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( scramble_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x10, 0x10) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x20, 0x20) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x40, 0x40) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x80, 0x80) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
+ AM_RANGE(0x10, 0x10) AM_DEVWRITE(SOUND, "8910.1", ay8910_address_w)
+ AM_RANGE(0x20, 0x20) AM_DEVREADWRITE(SOUND, "8910.1", ay8910_r, ay8910_data_w)
+ AM_RANGE(0x40, 0x40) AM_DEVWRITE(SOUND, "8910.2", ay8910_address_w)
+ AM_RANGE(0x80, 0x80) AM_DEVREADWRITE(SOUND, "8910.2", ay8910_r, ay8910_data_w)
ADDRESS_MAP_END
static MACHINE_DRIVER_START( scramble )
diff --git a/src/mame/drivers/scregg.c b/src/mame/drivers/scregg.c
index 6636ca12120..ac840e31598 100644
--- a/src/mame/drivers/scregg.c
+++ b/src/mame/drivers/scregg.c
@@ -75,10 +75,8 @@ static ADDRESS_MAP_START( dommy_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x2800, 0x2bff) AM_WRITE(btime_mirrorvideoram_w)
AM_RANGE(0x4000, 0x4000) AM_WRITE(SMH_NOP)
AM_RANGE(0x4001, 0x4001) AM_WRITE(btime_video_control_w)
- AM_RANGE(0x4004, 0x4004) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x4005, 0x4005) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x4006, 0x4006) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x4007, 0x4007) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0x4004, 0x4005) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x4006, 0x4007) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
AM_RANGE(0xa000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
@@ -103,10 +101,8 @@ static ADDRESS_MAP_START( eggs_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1c00, 0x1fff) AM_WRITE(btime_mirrorcolorram_w)
AM_RANGE(0x2000, 0x2000) AM_WRITE(btime_video_control_w)
AM_RANGE(0x2001, 0x2001) AM_WRITE(SMH_NOP)
- AM_RANGE(0x2004, 0x2004) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x2005, 0x2005) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x2006, 0x2006) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x2007, 0x2007) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0x2004, 0x2005) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x2006, 0x2007) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
AM_RANGE(0x3000, 0x7fff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/sderby.c b/src/mame/drivers/sderby.c
index f005d7fa3ed..980bfab7205 100644
--- a/src/mame/drivers/sderby.c
+++ b/src/mame/drivers/sderby.c
@@ -295,7 +295,7 @@ static ADDRESS_MAP_START( sderby_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x200000, 0x200fff) AM_RAM AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
AM_RANGE(0x308000, 0x30800d) AM_READ(sderby_input_r)
AM_RANGE(0x308008, 0x308009) AM_WRITE(sderby_out_w) /* output port */
- AM_RANGE(0x30800e, 0x30800f) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x30800e, 0x30800f) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x380000, 0x380fff) AM_WRITE(paletteram16_RRRRRGGGGGBBBBBx_word_w) AM_BASE(&paletteram16)
AM_RANGE(0x500000, 0x500001) AM_WRITE(SMH_NOP) /* unknown... write 0x01 in game, and 0x00 on reset */
AM_RANGE(0xd00000, 0xd007ff) AM_RAM AM_BASE(&generic_nvram16) AM_SIZE(&generic_nvram_size)
@@ -314,7 +314,7 @@ static ADDRESS_MAP_START( spacewin_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x300000, 0x300001) AM_WRITE(SMH_NOP) /* unknown... write 0x01 in game, and 0x00 on reset */
AM_RANGE(0x308000, 0x30800d) AM_READ(sderby_input_r)
AM_RANGE(0x308008, 0x308009) AM_WRITE(scmatto_out_w) /* output port */
- AM_RANGE(0x30800e, 0x30800f) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x30800e, 0x30800f) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x380000, 0x380fff) AM_WRITE(paletteram16_RRRRRGGGGGBBBBBx_word_w) AM_BASE(&paletteram16)
AM_RANGE(0xd00000, 0xd001ff) AM_RAM
AM_RANGE(0x800000, 0x800fff) AM_RAM AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
@@ -334,7 +334,7 @@ static ADDRESS_MAP_START( roulette_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x708000, 0x708009) AM_READ(roulette_input_r)
AM_RANGE(0x708006, 0x708007) AM_WRITE(roulette_out_w)
- AM_RANGE(0x70800a, 0x70800b) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x70800a, 0x70800b) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x70800c, 0x70800d) AM_WRITE(SMH_NOP) /* watchdog?? (0x0003) */
AM_RANGE(0x70800e, 0x70800f) AM_READWRITE(rprot_r, rprot_w) /* MCU communication */
AM_RANGE(0x780000, 0x780fff) AM_WRITE(paletteram16_RRRRRGGGGGBBBBBx_word_w) AM_BASE(&paletteram16)
diff --git a/src/mame/drivers/segac2.c b/src/mame/drivers/segac2.c
index 3e69c1a13f7..e2597a3d17b 100644
--- a/src/mame/drivers/segac2.c
+++ b/src/mame/drivers/segac2.c
@@ -171,40 +171,8 @@ static MACHINE_RESET( segac2 )
******************************************************************************/
-/* handle reads from the YM3438 */
-static READ16_HANDLER( ym3438_r )
-{
- switch (offset)
- {
- case 0: return ym3438_status_port_0_a_r(space, 0);
- case 1: return ym3438_read_port_0_r(space, 0);
- case 2: return ym3438_status_port_0_b_r(space, 0);
- }
- return 0xff;
-}
-
-
-/* handle writes to the YM3438 */
-static WRITE16_HANDLER( ym3438_w )
-{
- /* only works if we're accessing the low byte */
- if (ACCESSING_BITS_0_7)
- {
- static UINT8 last_port;
-
- switch (offset)
- {
- case 0: ym3438_control_port_0_a_w(space, 0, data & 0xff); last_port = data; break;
- case 1: ym3438_data_port_0_a_w(space, 0, data & 0xff); break;
- case 2: ym3438_control_port_0_b_w(space, 0, data & 0xff); last_port = data; break;
- case 3: ym3438_data_port_0_b_w(space, 0, data & 0xff); break;
- }
- }
-}
-
-
/* handle writes to the UPD7759 */
-static WRITE16_HANDLER( segac2_upd7759_w )
+static WRITE16_DEVICE_HANDLER( segac2_upd7759_w )
{
/* make sure we have a UPD chip */
if (!sound_banks)
@@ -213,9 +181,9 @@ static WRITE16_HANDLER( segac2_upd7759_w )
/* only works if we're accessing the low byte */
if (ACCESSING_BITS_0_7)
{
- upd7759_port_w(0, data & 0xff);
- upd7759_start_w(0, 0);
- upd7759_start_w(0, 1);
+ upd7759_port_w(device, 0, data & 0xff);
+ upd7759_start_w(device, 0);
+ upd7759_start_w(device, 1);
}
}
@@ -373,7 +341,7 @@ static READ16_HANDLER( io_chip_r )
/* otherwise, return an input port */
if (offset == 0x04/2 && sound_banks)
- return (input_port_read(space->machine, portnames[offset]) & 0xbf) | (upd7759_0_busy_r(space,0) << 6);
+ return (input_port_read(space->machine, portnames[offset]) & 0xbf) | (upd7759_busy_r(devtag_get_device(space->machine, SOUND, "upd")) << 6);
return input_port_read(space->machine, portnames[offset]);
/* 'SEGA' protection */
@@ -460,15 +428,19 @@ static WRITE16_HANDLER( io_chip_w )
}
if (sound_banks > 1)
{
+ const device_config *upd = devtag_get_device(space->machine, SOUND, "upd");
newbank = (data >> 2) & (sound_banks - 1);
- upd7759_set_bank_base(0, newbank * 0x20000);
+ upd7759_set_bank_base(upd, newbank * 0x20000);
}
break;
/* CNT register */
case 0x1c/2:
if (sound_banks > 1)
- upd7759_reset_w(0, (data >> 1) & 1);
+ {
+ const device_config *upd = devtag_get_device(space->machine, SOUND, "upd");
+ upd7759_reset_w(upd, (data >> 1) & 1);
+ }
break;
}
}
@@ -653,8 +625,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x800000, 0x800001) AM_MIRROR(0x13fdfe) AM_READWRITE(prot_r, prot_w)
AM_RANGE(0x800200, 0x800201) AM_MIRROR(0x13fdfe) AM_WRITE(control_w)
AM_RANGE(0x840000, 0x84001f) AM_MIRROR(0x13fee0) AM_READWRITE(io_chip_r, io_chip_w)
- AM_RANGE(0x840100, 0x840107) AM_MIRROR(0x13fef8) AM_READWRITE(ym3438_r, ym3438_w)
- AM_RANGE(0x880000, 0x880001) AM_MIRROR(0x13fefe) AM_WRITE(segac2_upd7759_w)
+ AM_RANGE(0x840100, 0x840107) AM_MIRROR(0x13fef8) AM_DEVREADWRITE8(SOUND, "ym", ym3438_r, ym3438_w, 0x00ff)
AM_RANGE(0x880100, 0x880101) AM_MIRROR(0x13fefe) AM_WRITE(counter_timer_w)
AM_RANGE(0x8c0000, 0x8c0fff) AM_MIRROR(0x13f000) AM_READWRITE(palette_r, palette_w) AM_BASE(&paletteram16)
AM_RANGE(0xc00000, 0xc0001f) AM_MIRROR(0x18ff00) AM_READWRITE(megadriv_vdp_r, megadriv_vdp_w)
@@ -1341,10 +1312,10 @@ INPUT_PORTS_END
Sound interfaces
******************************************************************************/
-static void segac2_irq2_interrupt(running_machine *machine, int state)
+static void segac2_irq2_interrupt(const device_config *device, int state)
{
//printf("sound irq %d\n", state);
- cpu_set_input_line(machine->cpu[0], 2, state ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[0], 2, state ? ASSERT_LINE : CLEAR_LINE);
}
static const ym3438_interface ym3438_intf =
{
@@ -1395,7 +1366,6 @@ static MACHINE_DRIVER_START( segac )
MDRV_CPU_ADD("main", M68000, XL2_CLOCK/6)
MDRV_CPU_PROGRAM_MAP(main_map,0)
-
MDRV_MACHINE_START(segac2)
MDRV_MACHINE_RESET(segac2)
MDRV_NVRAM_HANDLER(generic_randfill)
@@ -1849,6 +1819,8 @@ it should be, otherwise I don't see how the formula could be computed.
static void segac2_common_init(running_machine* machine, int (*func)(int in))
{
+ const device_config *upd = devtag_get_device(machine, SOUND, "upd");
+
DRIVER_INIT_CALL( megadriv_c2 );
prot_func = func;
@@ -1857,6 +1829,9 @@ static void segac2_common_init(running_machine* machine, int (*func)(int in))
genesis_has_z80 = 0;
genesis_always_irq6 = 1;
genesis_other_hacks = 0;
+
+ if (upd != NULL)
+ memory_install_write16_device_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), upd, 0x880000, 0x880001, 0, 0x13fefe, segac2_upd7759_w);
}
diff --git a/src/mame/drivers/segae.c b/src/mame/drivers/segae.c
index 07d842b0b6f..ec8123c2f02 100644
--- a/src/mame/drivers/segae.c
+++ b/src/mame/drivers/segae.c
@@ -984,7 +984,7 @@ WRITE8_HANDLER( sms_vdp_ctrl_w )
WRITE8_HANDLER( sms_sn76496_w )
{
- sn76496_0_w(space, 0, data & 0xff);
+ sn76496_w(devtag_get_device(space->machine, SOUND, "sn1"), 0, data & 0xff);
}
static void draw_tile_line(int drawxpos, int tileline, UINT16 tiledata, UINT8* linebuf, struct sms_vdp* chip)
@@ -2159,7 +2159,7 @@ static WRITE8_HANDLER( systeme_bank_w )
static WRITE8_HANDLER( sms_sn76496_2_w )
{
- sn76496_1_w(space, 0, data & 0xff);
+ sn76496_w(devtag_get_device(space->machine, SOUND, "sn2"), 0, data & 0xff);
}
static void init_ports_systeme(running_machine *machine)
diff --git a/src/mame/drivers/segag80r.c b/src/mame/drivers/segag80r.c
index 18a1532cfb7..0adda30c57a 100644
--- a/src/mame/drivers/segag80r.c
+++ b/src/mame/drivers/segag80r.c
@@ -311,15 +311,9 @@ static WRITE8_DEVICE_HANDLER( sindbadm_misc_w )
/* the data lines are flipped */
-static WRITE8_HANDLER( sindbadm_SN76496_0_w )
+static WRITE8_DEVICE_HANDLER( sindbadm_SN76496_w )
{
- sn76496_0_w(space, offset, BITSWAP8(data, 0,1,2,3,4,5,6,7));
-}
-
-
-static WRITE8_HANDLER( sindbadm_SN76496_1_w )
-{
- sn76496_1_w(space, offset, BITSWAP8(data, 0,1,2,3,4,5,6,7));
+ sn76496_w(device, offset, BITSWAP8(data, 0,1,2,3,4,5,6,7));
}
@@ -397,8 +391,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sindbadm_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_MIRROR(0x1800) AM_RAM
- AM_RANGE(0xa000, 0xa003) AM_MIRROR(0x1ffc) AM_WRITE(sindbadm_SN76496_0_w)
- AM_RANGE(0xc000, 0xc003) AM_MIRROR(0x1ffc) AM_WRITE(sindbadm_SN76496_1_w)
+ AM_RANGE(0xa000, 0xa003) AM_MIRROR(0x1ffc) AM_DEVWRITE(SOUND, "sn1", sindbadm_SN76496_w)
+ AM_RANGE(0xc000, 0xc003) AM_MIRROR(0x1ffc) AM_DEVWRITE(SOUND, "sn2", sindbadm_SN76496_w)
AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x1fff) AM_READ(soundlatch_r)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/segag80v.c b/src/mame/drivers/segag80v.c
index 8d9d11dda29..08d9a12d247 100644
--- a/src/mame/drivers/segag80v.c
+++ b/src/mame/drivers/segag80v.c
@@ -1318,98 +1318,112 @@ ROM_END
static DRIVER_INIT( elim2 )
{
+ const address_space *iospace = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO);
+
/* configure security */
sega_security(70);
/* configure sound */
has_usb = FALSE;
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3e, 0x3e, 0, 0, elim1_sh_w);
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3f, 0x3f, 0, 0, elim2_sh_w);
+ memory_install_write8_handler(iospace, 0x3e, 0x3e, 0, 0, elim1_sh_w);
+ memory_install_write8_handler(iospace, 0x3f, 0x3f, 0, 0, elim2_sh_w);
}
static DRIVER_INIT( elim4 )
{
+ const address_space *iospace = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO);
+
/* configure security */
sega_security(76);
/* configure sound */
has_usb = FALSE;
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3e, 0x3e, 0, 0, elim1_sh_w);
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3f, 0x3f, 0, 0, elim2_sh_w);
+ memory_install_write8_handler(iospace, 0x3e, 0x3e, 0, 0, elim1_sh_w);
+ memory_install_write8_handler(iospace, 0x3f, 0x3f, 0, 0, elim2_sh_w);
/* configure inputs */
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf8, 0xf8, 0, 0, spinner_select_w);
- memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xfc, 0xfc, 0, 0, elim4_input_r);
+ memory_install_write8_handler(iospace, 0xf8, 0xf8, 0, 0, spinner_select_w);
+ memory_install_read8_handler(iospace, 0xfc, 0xfc, 0, 0, elim4_input_r);
}
static DRIVER_INIT( spacfury )
{
+ const address_space *iospace = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO);
+
/* configure security */
sega_security(64);
/* configure sound */
has_usb = FALSE;
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x38, 0x38, 0, 0, sega_speech_data_w);
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3b, 0x3b, 0, 0, sega_speech_control_w);
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3e, 0x3e, 0, 0, spacfury1_sh_w);
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3f, 0x3f, 0, 0, spacfury2_sh_w);
+ memory_install_write8_handler(iospace, 0x38, 0x38, 0, 0, sega_speech_data_w);
+ memory_install_write8_handler(iospace, 0x3b, 0x3b, 0, 0, sega_speech_control_w);
+ memory_install_write8_handler(iospace, 0x3e, 0x3e, 0, 0, spacfury1_sh_w);
+ memory_install_write8_handler(iospace, 0x3f, 0x3f, 0, 0, spacfury2_sh_w);
}
static DRIVER_INIT( zektor )
{
+ const address_space *iospace = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO);
+ const device_config *ay = devtag_get_device(machine, SOUND, "ay");
+
/* configure security */
sega_security(82);
/* configure sound */
has_usb = FALSE;
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x38, 0x38, 0, 0, sega_speech_data_w);
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3b, 0x3b, 0, 0, sega_speech_control_w);
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3c, 0x3c, 0, 0, ay8910_control_port_0_w);
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3d, 0x3d, 0, 0, ay8910_write_port_0_w);
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3e, 0x3e, 0, 0, zektor1_sh_w);
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3f, 0x3f, 0, 0, zektor2_sh_w);
+ memory_install_write8_handler(iospace, 0x38, 0x38, 0, 0, sega_speech_data_w);
+ memory_install_write8_handler(iospace, 0x3b, 0x3b, 0, 0, sega_speech_control_w);
+ memory_install_write8_device_handler(iospace, ay, 0x3c, 0x3d, 0, 0, ay8910_address_data_w);
+ memory_install_write8_handler(iospace, 0x3e, 0x3e, 0, 0, zektor1_sh_w);
+ memory_install_write8_handler(iospace, 0x3f, 0x3f, 0, 0, zektor2_sh_w);
/* configure inputs */
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf8, 0xf8, 0, 0, spinner_select_w);
- memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xfc, 0xfc, 0, 0, spinner_input_r);
+ memory_install_write8_handler(iospace, 0xf8, 0xf8, 0, 0, spinner_select_w);
+ memory_install_read8_handler(iospace, 0xfc, 0xfc, 0, 0, spinner_input_r);
}
static DRIVER_INIT( tacscan )
{
+ const address_space *pgmspace = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const address_space *iospace = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO);
+
/* configure security */
sega_security(76);
/* configure sound */
has_usb = TRUE;
- memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3f, 0x3f, 0, 0, sega_usb_status_r, sega_usb_data_w);
- memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd000, 0xdfff, 0, 0, sega_usb_ram_r, usb_ram_w);
+ memory_install_readwrite8_handler(iospace, 0x3f, 0x3f, 0, 0, sega_usb_status_r, sega_usb_data_w);
+ memory_install_readwrite8_handler(pgmspace, 0xd000, 0xdfff, 0, 0, sega_usb_ram_r, usb_ram_w);
/* configure inputs */
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf8, 0xf8, 0, 0, spinner_select_w);
- memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xfc, 0xfc, 0, 0, spinner_input_r);
+ memory_install_write8_handler(iospace, 0xf8, 0xf8, 0, 0, spinner_select_w);
+ memory_install_read8_handler(iospace, 0xfc, 0xfc, 0, 0, spinner_input_r);
}
static DRIVER_INIT( startrek )
{
+ const address_space *pgmspace = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const address_space *iospace = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO);
+
/* configure security */
sega_security(64);
/* configure sound */
has_usb = TRUE;
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x38, 0x38, 0, 0, sega_speech_data_w);
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3b, 0x3b, 0, 0, sega_speech_control_w);
+ memory_install_write8_handler(iospace, 0x38, 0x38, 0, 0, sega_speech_data_w);
+ memory_install_write8_handler(iospace, 0x3b, 0x3b, 0, 0, sega_speech_control_w);
- memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3f, 0x3f, 0, 0, sega_usb_status_r, sega_usb_data_w);
- memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd000, 0xdfff, 0, 0, sega_usb_ram_r, usb_ram_w);
+ memory_install_readwrite8_handler(iospace, 0x3f, 0x3f, 0, 0, sega_usb_status_r, sega_usb_data_w);
+ memory_install_readwrite8_handler(pgmspace, 0xd000, 0xdfff, 0, 0, sega_usb_ram_r, usb_ram_w);
/* configure inputs */
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf8, 0xf8, 0, 0, spinner_select_w);
- memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xfc, 0xfc, 0, 0, spinner_input_r);
+ memory_install_write8_handler(iospace, 0xf8, 0xf8, 0, 0, spinner_select_w);
+ memory_install_read8_handler(iospace, 0xfc, 0xfc, 0, 0, spinner_input_r);
}
diff --git a/src/mame/drivers/segahang.c b/src/mame/drivers/segahang.c
index 7de6ffca6f7..b75888c1c67 100644
--- a/src/mame/drivers/segahang.c
+++ b/src/mame/drivers/segahang.c
@@ -366,9 +366,9 @@ static void sharrier_i8751_sim(running_machine *machine)
*
*************************************/
-static void sound_irq(running_machine *machine, int irq)
+static void sound_irq(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[2], 0, irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[2], 0, irq ? ASSERT_LINE : CLEAR_LINE);
}
@@ -443,9 +443,8 @@ static ADDRESS_MAP_START( sound_map_2203, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0xc000, 0xc7ff) AM_MIRROR(0x0800) AM_RAM
- AM_RANGE(0xd000, 0xd000) AM_MIRROR(0x0ffe) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0xd001, 0xd001) AM_MIRROR(0x0ffe) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0xe000, 0xe0ff) AM_MIRROR(0x0f00) AM_READWRITE(sega_pcm_r, sega_pcm_w)
+ AM_RANGE(0xd000, 0xd001) AM_MIRROR(0x0ffe) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
+ AM_RANGE(0xe000, 0xe0ff) AM_MIRROR(0x0f00) AM_DEVREADWRITE(SOUND, "pcm", sega_pcm_r, sega_pcm_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_portmap_2203, ADDRESS_SPACE_IO, 8 )
@@ -458,26 +457,23 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map_2151, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x0000, 0x7fff) AM_ROM
- AM_RANGE(0xf000, 0xf0ff) AM_MIRROR(0x700) AM_READWRITE(sega_pcm_r, sega_pcm_w)
+ AM_RANGE(0xf000, 0xf0ff) AM_MIRROR(0x700) AM_DEVREADWRITE(SOUND, "pcm", sega_pcm_r, sega_pcm_w)
AM_RANGE(0xf800, 0xffff) AM_RAM
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_portmap_2151, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_MIRROR(0x3e) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x01, 0x01) AM_MIRROR(0x3e) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_MIRROR(0x3e) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_READ(sound_data_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_portmap_2203x2, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_MIRROR(0x3e) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_MIRROR(0x3e) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_MIRROR(0x3e) AM_DEVREADWRITE(SOUND, "ym1", ym2203_r, ym2203_w)
AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_READ(sound_data_r)
- AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x3e) AM_READWRITE(ym2203_status_port_1_r, ym2203_control_port_1_w)
- AM_RANGE(0xc1, 0xc1) AM_MIRROR(0x3e) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0xc0, 0xc1) AM_MIRROR(0x3e) AM_DEVREADWRITE(SOUND, "ym2", ym2203_r, ym2203_w)
ADDRESS_MAP_END
@@ -822,7 +818,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
sound_irq
};
diff --git a/src/mame/drivers/segald.c b/src/mame/drivers/segald.c
index 5c845c90a7c..49b23693e56 100644
--- a/src/mame/drivers/segald.c
+++ b/src/mame/drivers/segald.c
@@ -356,8 +356,7 @@ static MACHINE_DRIVER_START( astron )
/* sound hardare */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("ldsound", CUSTOM, 0)
- MDRV_SOUND_CONFIG(laserdisc_custom_interface)
+ MDRV_SOUND_ADD("ldsound", LASERDISC, 0)
MDRV_SOUND_ROUTE(0, "left", 1.0)
MDRV_SOUND_ROUTE(1, "right", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/segaorun.c b/src/mame/drivers/segaorun.c
index de9df2f2704..cefa56756bd 100644
--- a/src/mame/drivers/segaorun.c
+++ b/src/mame/drivers/segaorun.c
@@ -544,15 +544,14 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x0000, 0xefff) AM_ROM
- AM_RANGE(0xf000, 0xf0ff) AM_MIRROR(0x0700) AM_READWRITE(sega_pcm_r, sega_pcm_w)
+ AM_RANGE(0xf000, 0xf0ff) AM_MIRROR(0x0700) AM_DEVREADWRITE(SOUND, "pcm", sega_pcm_r, sega_pcm_w)
AM_RANGE(0xf800, 0xffff) AM_RAM
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_MIRROR(0x3e) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x01, 0x01) AM_MIRROR(0x3e) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_MIRROR(0x3e) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_READ(sound_data_r)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/segas16a.c b/src/mame/drivers/segas16a.c
index 6426860104b..09498bfc331 100644
--- a/src/mame/drivers/segas16a.c
+++ b/src/mame/drivers/segas16a.c
@@ -424,7 +424,7 @@ static WRITE8_HANDLER( n7751_command_w )
}
-static WRITE8_HANDLER( n7751_control_w )
+static WRITE8_DEVICE_HANDLER( n7751_control_w )
{
/*
YM2151 output port
@@ -432,9 +432,9 @@ static WRITE8_HANDLER( n7751_control_w )
D1 = /RESET line on 7751
D0 = /IRQ line on 7751
*/
- cpu_set_input_line(space->machine->cpu[2], INPUT_LINE_RESET, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE);
- cpu_set_input_line(space->machine->cpu[2], 0, (data & 0x02) ? CLEAR_LINE : ASSERT_LINE);
- cpuexec_boost_interleave(space->machine, attotime_zero, ATTOTIME_IN_USEC(100));
+ cpu_set_input_line(device->machine->cpu[2], INPUT_LINE_RESET, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE);
+ cpu_set_input_line(device->machine->cpu[2], 0, (data & 0x02) ? CLEAR_LINE : ASSERT_LINE);
+ cpuexec_boost_interleave(device->machine, attotime_zero, ATTOTIME_IN_USEC(100));
}
@@ -841,8 +841,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_MIRROR(0x3e) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x01, 0x01) AM_MIRROR(0x3e) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_MIRROR(0x3e) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x80, 0x80) AM_MIRROR(0x3f) AM_WRITE(n7751_command_w)
AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x3f) AM_READ(sound_data_r)
ADDRESS_MAP_END
@@ -858,7 +857,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( n7751_portmap, ADDRESS_SPACE_IO, 8 )
AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READ(n7751_rom_r)
AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(n7751_t1_r)
- AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(dac_0_data_w)
+ AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE(SOUND, "dac", dac_w)
AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_DEVREADWRITE(I8243, "n7751_8243", n7751_p2_r, n7751_p2_w)
AM_RANGE(MCS48_PORT_PROG, MCS48_PORT_PROG) AM_DEVWRITE(I8243, "n7751_8243", i8243_prog_w)
ADDRESS_MAP_END
@@ -1802,7 +1801,7 @@ static MACHINE_DRIVER_START( system16a )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("2151", YM2151, 4000000)
+ MDRV_SOUND_ADD("ym", YM2151, 4000000)
MDRV_SOUND_CONFIG(ym2151_config)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.43)
@@ -1816,7 +1815,7 @@ static MACHINE_DRIVER_START( system16a_no7751 )
MDRV_CPU_REMOVE("n7751")
MDRV_SOUND_REMOVE("dac")
- MDRV_SOUND_REPLACE("2151", YM2151, 4000000)
+ MDRV_SOUND_REPLACE("ym", YM2151, 4000000)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/segas16b.c b/src/mame/drivers/segas16b.c
index e21790cfb5b..6995b2fee99 100644
--- a/src/mame/drivers/segas16b.c
+++ b/src/mame/drivers/segas16b.c
@@ -1274,17 +1274,17 @@ static WRITE16_HANDLER( unknown_rgn2_w )
*
*************************************/
-static WRITE8_HANDLER( upd7759_control_w )
+static WRITE8_DEVICE_HANDLER( upd7759_control_w )
{
- int size = memory_region_length(space->machine, "sound") - 0x10000;
+ int size = memory_region_length(device->machine, "sound") - 0x10000;
if (size > 0)
{
int bankoffs = 0;
/* it is important to write in this order: if the /START line goes low
at the same time /RESET goes low, no sample should be started */
- upd7759_start_w(0, data & 0x80);
- upd7759_reset_w(0, data & 0x40);
+ upd7759_start_w(device, data & 0x80);
+ upd7759_reset_w(device, data & 0x40);
/* banking depends on the ROM board */
switch (rom_board)
@@ -1333,14 +1333,14 @@ static WRITE8_HANDLER( upd7759_control_w )
bankoffs += (data & 0x07) * 0x04000;
break;
}
- memory_set_bankptr(space->machine, 1, memory_region(space->machine, "sound") + 0x10000 + (bankoffs % size));
+ memory_set_bankptr(device->machine, 1, memory_region(device->machine, "sound") + 0x10000 + (bankoffs % size));
}
}
-static READ8_HANDLER( upd7759_status_r )
+static READ8_DEVICE_HANDLER( upd7759_status_r )
{
- return upd7759_busy_r(0) << 7;
+ return upd7759_busy_r(device) << 7;
}
@@ -1558,12 +1558,7 @@ static void wrestwar_i8751_sim(running_machine *machine)
static WRITE16_HANDLER( atomicp_sound_w )
{
- if (ACCESSING_BITS_8_15)
- switch (offset & 1)
- {
- case 0: ym2413_register_port_0_w(space, 0, data >> 8); break;
- case 1: ym2413_data_port_0_w(space, 0, data >> 8); break;
- }
+ ym2413_w(devtag_get_device(space->machine, SOUND, "ym"), offset, data >> 8);
}
@@ -1790,10 +1785,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_MIRROR(0x3e) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x01, 0x01) AM_MIRROR(0x3e) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
- AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_WRITE(upd7759_control_w)
- AM_RANGE(0x80, 0x80) AM_MIRROR(0x3f) AM_READWRITE(upd7759_status_r, upd7759_0_port_w)
+ AM_RANGE(0x00, 0x01) AM_MIRROR(0x3e) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_DEVWRITE(SOUND, "upd", upd7759_control_w)
+ AM_RANGE(0x80, 0x80) AM_MIRROR(0x3f) AM_DEVREADWRITE(SOUND, "upd", upd7759_status_r, upd7759_port_w)
AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x3f) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -3271,10 +3265,10 @@ static MACHINE_DRIVER_START( system16b )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("2151", YM2151, MASTER_CLOCK_8MHz/2)
+ MDRV_SOUND_ADD("ym", YM2151, MASTER_CLOCK_8MHz/2)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.43)
- MDRV_SOUND_ADD("7759", UPD7759, UPD7759_STANDARD_CLOCK)
+ MDRV_SOUND_ADD("upd", UPD7759, UPD7759_STANDARD_CLOCK)
MDRV_SOUND_CONFIG(upd7759_config)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.48)
MACHINE_DRIVER_END
@@ -3306,10 +3300,10 @@ static MACHINE_DRIVER_START( atomicp )
MDRV_MACHINE_RESET(atomicp)
/* sound hardware */
- MDRV_SOUND_REPLACE("2151", YM2413, 5000000) /* 20MHz OSC divided by 4 */
+ MDRV_SOUND_REPLACE("ym", YM2413, 5000000) /* 20MHz OSC divided by 4 */
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
- MDRV_SOUND_REMOVE("7759")
+ MDRV_SOUND_REMOVE("upd")
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/segas18.c b/src/mame/drivers/segas18.c
index 5e120439e73..88cf1f30d03 100644
--- a/src/mame/drivers/segas18.c
+++ b/src/mame/drivers/segas18.c
@@ -605,22 +605,16 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x0000, 0x9fff) AM_ROM AM_REGION("sound", 0x10000)
AM_RANGE(0xa000, 0xbfff) AM_ROMBANK(1)
- AM_RANGE(0xc000, 0xc00f) AM_MIRROR(0x0ff0) AM_READWRITE(rf5c68_r, rf5c68_reg_w)
- AM_RANGE(0xd000, 0xdfff) AM_READWRITE(rf5c68_r, rf5c68_w)
+ AM_RANGE(0xc000, 0xc00f) AM_MIRROR(0x0ff0) AM_DEVWRITE(SOUND, "rf", rf5c68_w)
+ AM_RANGE(0xd000, 0xdfff) AM_DEVREADWRITE(SOUND, "rf", rf5c68_mem_r, rf5c68_mem_w)
AM_RANGE(0xe000, 0xffff) AM_RAM
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x80, 0x80) AM_MIRROR(0x0c) AM_READWRITE(ym3438_status_port_0_a_r, ym3438_control_port_0_a_w)
- AM_RANGE(0x81, 0x81) AM_MIRROR(0x0c) AM_WRITE(ym3438_data_port_0_a_w)
- AM_RANGE(0x82, 0x82) AM_MIRROR(0x0c) AM_WRITE(ym3438_control_port_0_b_w)
- AM_RANGE(0x83, 0x83) AM_MIRROR(0x0c) AM_WRITE(ym3438_data_port_0_b_w)
- AM_RANGE(0x90, 0x90) AM_MIRROR(0x0c) AM_READWRITE(ym3438_status_port_1_a_r, ym3438_control_port_1_a_w)
- AM_RANGE(0x91, 0x91) AM_MIRROR(0x0c) AM_WRITE(ym3438_data_port_1_a_w)
- AM_RANGE(0x92, 0x92) AM_MIRROR(0x0c) AM_WRITE(ym3438_control_port_1_b_w)
- AM_RANGE(0x93, 0x93) AM_MIRROR(0x0c) AM_WRITE(ym3438_data_port_1_b_w)
+ AM_RANGE(0x80, 0x83) AM_MIRROR(0x0c) AM_DEVREADWRITE(SOUND, "ym1", ym3438_r, ym3438_w)
+ AM_RANGE(0x90, 0x93) AM_MIRROR(0x0c) AM_DEVREADWRITE(SOUND, "ym2", ym3438_r, ym3438_w)
AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x1f) AM_WRITE(soundbank_w)
AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x1f) AM_READWRITE(soundlatch_r, mcu_data_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/segas24.c b/src/mame/drivers/segas24.c
index 3241d013cc1..b03b7b406e1 100644
--- a/src/mame/drivers/segas24.c
+++ b/src/mame/drivers/segas24.c
@@ -591,8 +591,6 @@ static UINT8 mahmajn_io_r(running_machine *machine, int port)
static void mahmajn_io_w(running_machine *machine, int port, UINT8 data)
{
- const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
-
switch(port)
{
case 3:
@@ -600,7 +598,7 @@ static void mahmajn_io_w(running_machine *machine, int port, UINT8 data)
cur_input_line = (cur_input_line + 1) & 7;
break;
case 7: // DAC
- dac_0_signed_data_w(space, 0, data);
+ dac_signed_data_w(devtag_get_device(machine, SOUND, "dac"), data);
break;
default:
fprintf(stderr, "Port %d : %02x\n", port, data & 0xff);
@@ -609,14 +607,12 @@ static void mahmajn_io_w(running_machine *machine, int port, UINT8 data)
static void hotrod_io_w(running_machine *machine, int port, UINT8 data)
{
- const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
-
switch(port)
{
case 3: // Lamps
break;
case 7: // DAC
- dac_0_signed_data_w(space,0, data);
+ dac_signed_data_w(devtag_get_device(machine, SOUND, "dac"), data);
break;
default:
fprintf(stderr, "Port %d : %02x\n", port, data & 0xff);
@@ -703,7 +699,7 @@ static void reset_reset(running_machine *machine)
cpu_set_input_line(machine->cpu[1], INPUT_LINE_HALT, ASSERT_LINE);
}
if(changed & 4)
- sndti_reset(SOUND_YM2151, 0);
+ devtag_reset(machine, SOUND, "ym");
prev_resetcontrol = resetcontrol;
}
@@ -742,25 +738,6 @@ static WRITE16_HANDLER( curbank_w )
}
-// YM2151
-
-static READ16_HANDLER( ym_status_r )
-{
- return ym2151_status_port_0_r(space, 0);
-}
-
-static WRITE16_HANDLER( ym_register_w )
-{
- if(ACCESSING_BITS_0_7)
- ym2151_register_port_0_w(space, 0, data);
-}
-
-static WRITE16_HANDLER( ym_data_w )
-{
- if(ACCESSING_BITS_0_7)
- ym2151_data_port_0_w(space, 0, data);
-}
-
// Protection magic latch
@@ -965,11 +942,11 @@ static INTERRUPT_GEN(irq_vbl)
}
}
-static void irq_ym(running_machine *machine, int irq)
+static void irq_ym(const device_config *device, int irq)
{
irq_yms = irq;
- cpu_set_input_line(machine->cpu[0], IRQ_YM2151+1, irq_yms && (irq_allow0 & (1 << IRQ_YM2151)) ? ASSERT_LINE : CLEAR_LINE);
- cpu_set_input_line(machine->cpu[1], IRQ_YM2151+1, irq_yms && (irq_allow1 & (1 << IRQ_YM2151)) ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[0], IRQ_YM2151+1, irq_yms && (irq_allow0 & (1 << IRQ_YM2151)) ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], IRQ_YM2151+1, irq_yms && (irq_allow1 & (1 << IRQ_YM2151)) ? ASSERT_LINE : CLEAR_LINE);
}
@@ -1036,8 +1013,7 @@ static ADDRESS_MAP_START( system24_cpu1_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x404000, 0x40401f) AM_MIRROR(0x1fbfe0) AM_READWRITE(sys24_mixer_r, sys24_mixer_w)
AM_RANGE(0x600000, 0x63ffff) AM_MIRROR(0x180000) AM_READWRITE(sys24_sprite_r, sys24_sprite_w)
AM_RANGE(0x800000, 0x80007f) AM_MIRROR(0x1ffe00) AM_READWRITE(system24temp_sys16_io_r, system24temp_sys16_io_w)
- AM_RANGE(0x800100, 0x800101) AM_MIRROR(0x1ffe00) AM_WRITE(ym_register_w)
- AM_RANGE(0x800102, 0x800103) AM_MIRROR(0x1ffe00) AM_READWRITE(ym_status_r, ym_data_w)
+ AM_RANGE(0x800100, 0x800103) AM_MIRROR(0x1ffe00) AM_DEVREADWRITE8(SOUND, "ym", ym2151_r, ym2151_w, 0x00ff)
AM_RANGE(0xa00000, 0xa00007) AM_MIRROR(0x0ffff8) AM_READWRITE(irq_r, irq_w)
AM_RANGE(0xb00000, 0xb00007) AM_MIRROR(0x07fff0) AM_READWRITE(fdc_r, fdc_w)
AM_RANGE(0xb00008, 0xb0000f) AM_MIRROR(0x07fff0) AM_READWRITE(fdc_status_r, fdc_ctrl_w)
@@ -1074,8 +1050,7 @@ static ADDRESS_MAP_START( system24_cpu2_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x404000, 0x40401f) AM_MIRROR(0x1fbfe0) AM_READWRITE(sys24_mixer_r, sys24_mixer_w)
AM_RANGE(0x600000, 0x63ffff) AM_MIRROR(0x180000) AM_READWRITE(sys24_sprite_r, sys24_sprite_w)
AM_RANGE(0x800000, 0x80007f) AM_MIRROR(0x1ffe00) AM_READWRITE(system24temp_sys16_io_r, system24temp_sys16_io_w)
- AM_RANGE(0x800100, 0x800101) AM_MIRROR(0x1ffe00) AM_WRITE(ym_register_w)
- AM_RANGE(0x800102, 0x800103) AM_MIRROR(0x1ffe00) AM_READWRITE(ym_status_r, ym_data_w)
+ AM_RANGE(0x800100, 0x800103) AM_MIRROR(0x1ffe00) AM_DEVREADWRITE8(SOUND, "ym", ym2151_r, ym2151_w, 0x00ff)
AM_RANGE(0xa00000, 0xa00007) AM_MIRROR(0x0ffff8) AM_READWRITE(irq_r, irq_w)
AM_RANGE(0xb00000, 0xb00007) AM_MIRROR(0x07fff0) AM_READWRITE(fdc_r, fdc_w)
AM_RANGE(0xb00008, 0xb0000f) AM_MIRROR(0x07fff0) AM_READWRITE(fdc_status_r, fdc_ctrl_w)
diff --git a/src/mame/drivers/segas32.c b/src/mame/drivers/segas32.c
index 3651e80c9f5..4854ef3b4de 100644
--- a/src/mame/drivers/segas32.c
+++ b/src/mame/drivers/segas32.c
@@ -1092,12 +1092,12 @@ static WRITE8_HANDLER( sound_int_control_hi_w )
}
-static void ym3438_irq_handler(running_machine *machine, int state)
+static void ym3438_irq_handler(const device_config *device, int state)
{
if (state)
- signal_sound_irq(machine, SOUND_IRQ_YM3438);
+ signal_sound_irq(device->machine, SOUND_IRQ_YM3438);
else
- clear_sound_irq(machine, SOUND_IRQ_YM3438);
+ clear_sound_irq(device->machine, SOUND_IRQ_YM3438);
}
@@ -1122,15 +1122,15 @@ static WRITE8_HANDLER( sound_bank_hi_w )
}
-static WRITE8_HANDLER( multipcm_bank_w )
+static WRITE8_DEVICE_HANDLER( multipcm_bank_w )
{
- multi_pcm_set_bank(0, 0x80000 * ((data >> 3) & 7), 0x80000 * (data & 7));
+ multipcm_set_bank(device, 0x80000 * ((data >> 3) & 7), 0x80000 * (data & 7));
}
-static WRITE8_HANDLER( scross_bank_w )
+static WRITE8_DEVICE_HANDLER( scross_bank_w )
{
- multi_pcm_set_bank(0, 0x80000 * (data & 7), 0x80000 * (data & 7));
+ multipcm_set_bank(device, 0x80000 * (data & 7), 0x80000 * (data & 7));
}
@@ -1234,22 +1234,16 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( system32_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x9fff) AM_ROM AM_REGION("sound", 0x100000)
AM_RANGE(0xa000, 0xbfff) AM_ROMBANK(1)
- AM_RANGE(0xc000, 0xc00f) AM_MIRROR(0x0ff0) AM_WRITE(rf5c68_reg_w)
- AM_RANGE(0xd000, 0xdfff) AM_READWRITE(rf5c68_r, rf5c68_w)
+ AM_RANGE(0xc000, 0xc00f) AM_MIRROR(0x0ff0) AM_DEVWRITE(SOUND, "rf", rf5c68_w)
+ AM_RANGE(0xd000, 0xdfff) AM_DEVREADWRITE(SOUND, "rf", rf5c68_mem_r, rf5c68_mem_w)
AM_RANGE(0xe000, 0xffff) AM_RAM AM_BASE(&z80_shared_ram)
ADDRESS_MAP_END
static ADDRESS_MAP_START( system32_sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x80, 0x80) AM_MIRROR(0x0c) AM_READWRITE(ym3438_status_port_0_a_r, ym3438_control_port_0_a_w)
- AM_RANGE(0x81, 0x81) AM_MIRROR(0x0c) AM_WRITE(ym3438_data_port_0_a_w)
- AM_RANGE(0x82, 0x82) AM_MIRROR(0x0c) AM_WRITE(ym3438_control_port_0_b_w)
- AM_RANGE(0x83, 0x83) AM_MIRROR(0x0c) AM_WRITE(ym3438_data_port_0_b_w)
- AM_RANGE(0x90, 0x90) AM_MIRROR(0x0c) AM_READWRITE(ym3438_status_port_1_a_r, ym3438_control_port_1_a_w)
- AM_RANGE(0x91, 0x91) AM_MIRROR(0x0c) AM_WRITE(ym3438_data_port_1_a_w)
- AM_RANGE(0x92, 0x92) AM_MIRROR(0x0c) AM_WRITE(ym3438_control_port_1_b_w)
- AM_RANGE(0x93, 0x93) AM_MIRROR(0x0c) AM_WRITE(ym3438_data_port_1_b_w)
+ AM_RANGE(0x80, 0x83) AM_MIRROR(0x0c) AM_DEVREADWRITE(SOUND, "ym1", ym3438_r, ym3438_w)
+ AM_RANGE(0x90, 0x93) AM_MIRROR(0x0c) AM_DEVREADWRITE(SOUND, "ym2", ym3438_r, ym3438_w)
AM_RANGE(0xa0, 0xaf) AM_WRITE(sound_bank_lo_w)
AM_RANGE(0xb0, 0xbf) AM_WRITE(sound_bank_hi_w)
AM_RANGE(0xc0, 0xcf) AM_WRITE(sound_int_control_lo_w)
@@ -1261,19 +1255,16 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( multi32_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x9fff) AM_ROM AM_REGION("sound", 0x100000)
AM_RANGE(0xa000, 0xbfff) AM_ROMBANK(1)
- AM_RANGE(0xc000, 0xdfff) AM_READWRITE(multi_pcm_reg_0_r, multi_pcm_reg_0_w)
+ AM_RANGE(0xc000, 0xdfff) AM_DEVREADWRITE(SOUND, "sega", multipcm_r, multipcm_w)
AM_RANGE(0xe000, 0xffff) AM_RAM AM_BASE(&z80_shared_ram)
ADDRESS_MAP_END
static ADDRESS_MAP_START( multi32_sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x80, 0x80) AM_MIRROR(0x0c) AM_READWRITE(ym3438_status_port_0_a_r, ym3438_control_port_0_a_w)
- AM_RANGE(0x81, 0x81) AM_MIRROR(0x0c) AM_WRITE(ym3438_data_port_0_a_w)
- AM_RANGE(0x82, 0x82) AM_MIRROR(0x0c) AM_WRITE(ym3438_control_port_0_b_w)
- AM_RANGE(0x83, 0x83) AM_MIRROR(0x0c) AM_WRITE(ym3438_data_port_0_b_w)
+ AM_RANGE(0x80, 0x83) AM_MIRROR(0x0c) AM_DEVREADWRITE(SOUND, "ym", ym3438_r, ym3438_w)
AM_RANGE(0xa0, 0xaf) AM_WRITE(sound_bank_lo_w)
- AM_RANGE(0xb0, 0xbf) AM_WRITE(multipcm_bank_w)
+ AM_RANGE(0xb0, 0xbf) AM_DEVWRITE(SOUND, "sega", multipcm_bank_w)
AM_RANGE(0xc0, 0xcf) AM_WRITE(sound_int_control_lo_w)
AM_RANGE(0xd0, 0xd3) AM_MIRROR(0x04) AM_WRITE(sound_int_control_hi_w)
AM_RANGE(0xf1, 0xf1) AM_READWRITE(sound_dummy_r, sound_dummy_w)
@@ -3947,8 +3938,9 @@ static DRIVER_INIT( radr )
static DRIVER_INIT( scross )
{
+ const device_config *multipcm = devtag_get_device(machine, SOUND, "sega");
segas32_common_init(analog_custom_io_r, analog_custom_io_w, NULL);
- memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xb0, 0xbf, 0, 0, scross_bank_w);
+ memory_install_write8_device_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), multipcm, 0xb0, 0xbf, 0, 0, scross_bank_w);
}
diff --git a/src/mame/drivers/segaxbd.c b/src/mame/drivers/segaxbd.c
index f969251be3c..d1134fc9771 100644
--- a/src/mame/drivers/segaxbd.c
+++ b/src/mame/drivers/segaxbd.c
@@ -390,9 +390,9 @@ static void sound_data_w(running_machine *machine, UINT8 data)
}
-static void sound_cpu_irq(running_machine *machine, int state)
+static void sound_cpu_irq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[2], 0, state);
+ cpu_set_input_line(device->machine->cpu[2], 0, state);
}
@@ -786,15 +786,14 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x0000, 0xefff) AM_ROM
- AM_RANGE(0xf000, 0xf0ff) AM_MIRROR(0x0700) AM_READWRITE(sega_pcm_r, sega_pcm_w)
+ AM_RANGE(0xf000, 0xf0ff) AM_MIRROR(0x0700) AM_DEVREADWRITE(SOUND, "pcm", sega_pcm_r, sega_pcm_w)
AM_RANGE(0xf800, 0xffff) AM_RAM
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_MIRROR(0x3e) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x01, 0x01) AM_MIRROR(0x3e) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_MIRROR(0x3e) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_READ(sound_data_r)
ADDRESS_MAP_END
@@ -1367,7 +1366,7 @@ static MACHINE_DRIVER_START( xboard )
/* sound hardware */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("2151", YM2151, SOUND_CLOCK/4)
+ MDRV_SOUND_ADD("ym", YM2151, SOUND_CLOCK/4)
MDRV_SOUND_CONFIG(ym2151_config)
MDRV_SOUND_ROUTE(0, "left", 0.43)
MDRV_SOUND_ROUTE(1, "right", 0.43)
diff --git a/src/mame/drivers/segaybd.c b/src/mame/drivers/segaybd.c
index 88612a886b7..aa0c17ee125 100644
--- a/src/mame/drivers/segaybd.c
+++ b/src/mame/drivers/segaybd.c
@@ -205,9 +205,9 @@ static MACHINE_RESET( yboard )
*
*************************************/
-static void sound_cpu_irq(running_machine *machine, int state)
+static void sound_cpu_irq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[3], 0, state);
+ cpu_set_input_line(device->machine->cpu[3], 0, state);
}
@@ -451,15 +451,14 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x0000, 0xefff) AM_ROM
- AM_RANGE(0xf000, 0xf0ff) AM_MIRROR(0x0700) AM_READWRITE(sega_pcm_r, sega_pcm_w)
+ AM_RANGE(0xf000, 0xf0ff) AM_MIRROR(0x0700) AM_DEVREADWRITE(SOUND, "pcm", sega_pcm_r, sega_pcm_w)
AM_RANGE(0xf800, 0xffff) AM_RAM
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_MIRROR(0x3e) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x01, 0x01) AM_MIRROR(0x3e) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_MIRROR(0x3e) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_READ(sound_data_r)
ADDRESS_MAP_END
@@ -998,7 +997,7 @@ static MACHINE_DRIVER_START( yboard )
/* sound hardware */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("2151", YM2151, SOUND_CLOCK/8)
+ MDRV_SOUND_ADD("ym", YM2151, SOUND_CLOCK/8)
MDRV_SOUND_CONFIG(ym2151_config)
MDRV_SOUND_ROUTE(0, "left", 0.43)
MDRV_SOUND_ROUTE(1, "right", 0.43)
diff --git a/src/mame/drivers/seibuspi.c b/src/mame/drivers/seibuspi.c
index d11f278de34..d9316d56589 100644
--- a/src/mame/drivers/seibuspi.c
+++ b/src/mame/drivers/seibuspi.c
@@ -851,6 +851,8 @@ static WRITE32_HANDLER( ds2404_clk_w )
static WRITE32_HANDLER( eeprom_w )
{
+ const device_config *oki2 = devtag_get_device(space->machine, SOUND, "oki2");
+
// tile banks
if( ACCESSING_BITS_16_23 ) {
rf2_set_layer_banks(data >> 16);
@@ -860,8 +862,8 @@ static WRITE32_HANDLER( eeprom_w )
}
// oki banking
- if (sndti_exists(SOUND_OKIM6295, 1))
- okim6295_set_bank_base(1, (data & 0x4000000) ? 0x40000 : 0);
+ if (oki2 != NULL)
+ okim6295_set_bank_base(oki2, (data & 0x4000000) ? 0x40000 : 0);
}
static WRITE32_HANDLER( z80_prg_fifo_w )
@@ -908,30 +910,6 @@ static READ32_HANDLER( spi_controls2_r )
return 0xffffffff;
}
-static READ32_HANDLER( spi_6295_0_r )
-{
- return okim6295_status_0_r(space, 0);
-}
-
-static READ32_HANDLER( spi_6295_1_r )
-{
- return okim6295_status_1_r(space, 0);
-}
-
-static WRITE32_HANDLER( spi_6295_0_w )
-{
- if( ACCESSING_BITS_0_7 ) {
- okim6295_data_0_w(space, 0, data & 0xff);
- }
-}
-
-static WRITE32_HANDLER( spi_6295_1_w )
-{
- if( ACCESSING_BITS_0_7 ) {
- okim6295_data_1_w(space, 0, data & 0xff);
- }
-}
-
/********************************************************************/
static READ8_HANDLER( z80_soundfifo_r )
@@ -1046,7 +1024,7 @@ static ADDRESS_MAP_START( spisound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x400b, 0x400b) AM_WRITENOP /* Unknown */
AM_RANGE(0x4013, 0x4013) AM_READ(z80_coin_r)
AM_RANGE(0x401b, 0x401b) AM_WRITE(z80_bank_w) /* control register: bits 0-2 = bank @ 8000, bit 3 = watchdog? */
- AM_RANGE(0x6000, 0x600f) AM_READWRITE(ymf271_0_r, ymf271_0_w)
+ AM_RANGE(0x6000, 0x600f) AM_DEVREADWRITE(SOUND, "ymf", ymf271_r, ymf271_w)
AM_RANGE(0x8000, 0xffff) AM_ROMBANK(4)
ADDRESS_MAP_END
@@ -1077,18 +1055,18 @@ static WRITE8_DEVICE_HANDLER( flashrom_write )
}
}
-static void irqhandler(running_machine *machine, int state)
+static void irqhandler(const device_config *device, int state)
{
if (state)
- cpu_set_input_line_and_vector(machine->cpu[1], 0, ASSERT_LINE, 0xd7); // IRQ is RST10
+ cpu_set_input_line_and_vector(device->machine->cpu[1], 0, ASSERT_LINE, 0xd7); // IRQ is RST10
else
- cpu_set_input_line(machine->cpu[1], 0, CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, CLEAR_LINE);
}
static const ymf271_interface ymf271_config =
{
- flashrom_read,
- flashrom_write,
+ DEVCB_HANDLER(flashrom_read),
+ DEVCB_HANDLER(flashrom_write),
irqhandler
};
@@ -1112,8 +1090,8 @@ static ADDRESS_MAP_START( seibu386_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x0000068c, 0x0000068f) AM_WRITE(eeprom_w)
AM_RANGE(0x00000800, 0x0003ffff) AM_RAM AM_BASE(&spimainram)
AM_RANGE(0x00200000, 0x003fffff) AM_ROM AM_SHARE(2)
- AM_RANGE(0x01200000, 0x01200003) AM_READWRITE(spi_6295_0_r, spi_6295_0_w)
- AM_RANGE(0x01200004, 0x01200007) AM_READWRITE(spi_6295_1_r, spi_6295_1_w)
+ AM_RANGE(0x01200000, 0x01200003) AM_DEVREADWRITE8(SOUND, "oki1", okim6295_r, okim6295_w, 0x000000ff)
+ AM_RANGE(0x01200004, 0x01200007) AM_DEVREADWRITE8(SOUND, "oki2", okim6295_r, okim6295_w, 0x000000ff)
AM_RANGE(0xffe00000, 0xffffffff) AM_ROM AM_REGION("user1", 0) AM_SHARE(2) /* ROM location in real-mode */
ADDRESS_MAP_END
diff --git a/src/mame/drivers/seicross.c b/src/mame/drivers/seicross.c
index 5ead6f34648..8ea1ca696e0 100644
--- a/src/mame/drivers/seicross.c
+++ b/src/mame/drivers/seicross.c
@@ -91,16 +91,16 @@ static MACHINE_RESET( friskyt )
-static READ8_HANDLER( friskyt_portB_r )
+static READ8_DEVICE_HANDLER( friskyt_portB_r )
{
- return (portb & 0x9f) | (input_port_read_safe(space->machine, "DEBUG", 0) & 0x60);
+ return (portb & 0x9f) | (input_port_read_safe(device->machine, "DEBUG", 0) & 0x60);
}
-static WRITE8_HANDLER( friskyt_portB_w )
+static WRITE8_DEVICE_HANDLER( friskyt_portB_w )
{
//logerror("PC %04x: 8910 port B = %02x\n",cpu_get_pc(space->cpu),data);
/* bit 0 is IRQ enable */
- cpu_interrupt_enable(space->machine->cpu[0],data & 1);
+ cpu_interrupt_enable(device->machine->cpu[0],data & 1);
/* bit 1 flips screen */
@@ -108,8 +108,8 @@ static WRITE8_HANDLER( friskyt_portB_w )
if (((portb & 4) == 0) && (data & 4))
{
/* reset and start the protection mcu */
- cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, PULSE_LINE);
- cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_HALT, CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_RESET, PULSE_LINE);
+ cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_HALT, CLEAR_LINE);
}
/* other bits unknown */
@@ -133,19 +133,15 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( main_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x04, 0x04) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x08, 0x08) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x09, 0x09) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x0c, 0x0c) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0x00, 0x01) AM_MIRROR(0x08) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0x04, 0x04) AM_MIRROR(0x08) AM_DEVREAD(SOUND, "ay", ay8910_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( mcu_nvram_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x007f) AM_RAM
AM_RANGE(0x1000, 0x10ff) AM_RAM AM_BASE(&nvram) AM_SIZE(&nvram_size)
- AM_RANGE(0x2000, 0x2000) AM_WRITE(dac_0_data_w)
+ AM_RANGE(0x2000, 0x2000) AM_DEVWRITE(SOUND, "dac", dac_w)
AM_RANGE(0x8000, 0xf7ff) AM_ROM
AM_RANGE(0xf800, 0xffff) AM_RAM AM_SHARE(1)
ADDRESS_MAP_END
@@ -155,7 +151,7 @@ static ADDRESS_MAP_START( mcu_no_nvram_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1003, 0x1003) AM_READ_PORT("DSW1") /* DSW1 */
AM_RANGE(0x1005, 0x1005) AM_READ_PORT("DSW2") /* DSW2 */
AM_RANGE(0x1006, 0x1006) AM_READ_PORT("DSW3") /* DSW3 */
- AM_RANGE(0x2000, 0x2000) AM_WRITE(dac_0_data_w)
+ AM_RANGE(0x2000, 0x2000) AM_DEVWRITE(SOUND, "dac", dac_w)
AM_RANGE(0x8000, 0xf7ff) AM_ROM
AM_RANGE(0xf800, 0xffff) AM_RAM AM_SHARE(1)
ADDRESS_MAP_END
@@ -394,10 +390,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- friskyt_portB_r,
- NULL,
- friskyt_portB_w
+ DEVCB_NULL,
+ DEVCB_HANDLER(friskyt_portB_r),
+ DEVCB_NULL,
+ DEVCB_HANDLER(friskyt_portB_w)
};
diff --git a/src/mame/drivers/senjyo.c b/src/mame/drivers/senjyo.c
index f9fa7abfa5e..e6ce2603a6a 100644
--- a/src/mame/drivers/senjyo.c
+++ b/src/mame/drivers/senjyo.c
@@ -176,9 +176,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x4000, 0x43ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x8000, 0x8000) AM_WRITE(sn76496_0_w)
- AM_RANGE(0x9000, 0x9000) AM_WRITE(sn76496_1_w)
- AM_RANGE(0xa000, 0xa000) AM_WRITE(sn76496_2_w)
+ AM_RANGE(0x8000, 0x8000) AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0x9000, 0x9000) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
+ AM_RANGE(0xa000, 0xa000) AM_DEVWRITE(SOUND, "sn3", sn76496_w)
AM_RANGE(0xd000, 0xd000) AM_WRITE(senjyo_volume_w)
#if 0
AM_RANGE(0xe000, 0xe000) AM_WRITE(unknown)
@@ -241,9 +241,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( starforb_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x4000, 0x43ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x8000, 0x8000) AM_WRITE(sn76496_0_w)
- AM_RANGE(0x9000, 0x9000) AM_WRITE(sn76496_1_w)
- AM_RANGE(0xa000, 0xa000) AM_WRITE(sn76496_2_w)
+ AM_RANGE(0x8000, 0x8000) AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0x9000, 0x9000) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
+ AM_RANGE(0xa000, 0xa000) AM_DEVWRITE(SOUND, "sn3", sn76496_w)
AM_RANGE(0xd000, 0xd000) AM_WRITE(senjyo_volume_w)
#if 0
AM_RANGE(0xe000, 0xe000) AM_WRITE(unknown)
diff --git a/src/mame/drivers/seta.c b/src/mame/drivers/seta.c
index 47a6852c09b..daefa202cf0 100644
--- a/src/mame/drivers/seta.c
+++ b/src/mame/drivers/seta.c
@@ -1427,9 +1427,9 @@ static const x1_010_interface seta_sound_intf2 =
0x1000, /* address */
};
-static void utoukond_ym3438_interrupt(running_machine *machine, int linestate)
+static void utoukond_ym3438_interrupt(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1], INPUT_LINE_NMI, linestate);
+ cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_NMI, linestate);
}
static const ym3438_interface utoukond_ym3438_intf =
@@ -1533,14 +1533,14 @@ static READ16_HANDLER( seta_dsw_r )
/* DSW reading for 8 bit CPUs */
-static READ8_HANDLER( dsw1_r )
+static READ8_DEVICE_HANDLER( dsw1_r )
{
- return (input_port_read(space->machine, "DSW") >> 8) & 0xff;
+ return (input_port_read(device->machine, "DSW") >> 8) & 0xff;
}
-static READ8_HANDLER( dsw2_r )
+static READ8_DEVICE_HANDLER( dsw2_r )
{
- return (input_port_read(space->machine, "DSW") >> 0) & 0xff;
+ return (input_port_read(device->machine, "DSW") >> 0) & 0xff;
}
@@ -1622,7 +1622,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( downtown_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x09ffff) AM_READ(SMH_ROM ) // ROM
- AM_RANGE(0x100000, 0x103fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0x100000, 0x103fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
AM_RANGE(0x200000, 0x200001) AM_READ(SMH_NOP ) // watchdog? (twineagl)
AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r ) // DSW
AM_RANGE(0x700000, 0x7003ff) AM_READ(SMH_RAM ) // Palette
@@ -1636,7 +1636,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( downtown_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x09ffff) AM_WRITE(SMH_ROM ) // ROM
- AM_RANGE(0x100000, 0x103fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0x100000, 0x103fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
AM_RANGE(0x200000, 0x200001) AM_WRITE(SMH_NOP ) // watchdog?
AM_RANGE(0x300000, 0x300001) AM_WRITE(SMH_NOP ) // IRQ enable/acknowledge?
AM_RANGE(0x400000, 0x400007) AM_WRITE(twineagl_tilebank_w ) // special tile banking to animate water in twineagl
@@ -1827,7 +1827,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( atehate_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0x900000, 0x9fffff) AM_READ(SMH_RAM ) // RAM
- AM_RANGE(0x100000, 0x103fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0x100000, 0x103fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r ) // DSW
AM_RANGE(0x700000, 0x7003ff) AM_READ(SMH_RAM ) // Palette
AM_RANGE(0xa00000, 0xa00607) AM_READ(SMH_RAM ) // Sprites Y
@@ -1841,7 +1841,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( atehate_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0fffff) AM_WRITE(SMH_ROM ) // ROM
AM_RANGE(0x900000, 0x9fffff) AM_WRITE(SMH_RAM ) // RAM
- AM_RANGE(0x100000, 0x103fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0x100000, 0x103fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
AM_RANGE(0x200000, 0x200001) AM_WRITE(SMH_NOP ) // ? watchdog ?
AM_RANGE(0x300000, 0x300001) AM_WRITE(SMH_NOP ) // ? 0 (irq ack lev 2?)
AM_RANGE(0x500000, 0x500001) AM_WRITE(SMH_NOP ) // ? (end of lev 1: bit 4 goes 1,0,1)
@@ -1877,7 +1877,7 @@ static ADDRESS_MAP_START( blandia_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xb04000, 0xb0ffff) AM_READ(SMH_RAM ) // (jjsquawk)
AM_RANGE(0xb80000, 0xb83fff) AM_READ(SMH_RAM ) // VRAM 2&3
AM_RANGE(0xb84000, 0xb8ffff) AM_READ(SMH_RAM ) // (jjsquawk)
- AM_RANGE(0xc00000, 0xc03fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0xc00000, 0xc03fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
ADDRESS_MAP_END
static ADDRESS_MAP_START( blandia_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -1898,7 +1898,7 @@ static ADDRESS_MAP_START( blandia_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xb04000, 0xb0ffff) AM_WRITE(SMH_RAM ) // (jjsquawk)
AM_RANGE(0xb80000, 0xb83fff) AM_WRITE(seta_vram_2_w) AM_BASE(&seta_vram_2 ) // VRAM 2
AM_RANGE(0xb84000, 0xb8ffff) AM_WRITE(SMH_RAM ) // (jjsquawk)
- AM_RANGE(0xc00000, 0xc03fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0xc00000, 0xc03fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
AM_RANGE(0xd00000, 0xd00007) AM_WRITE(SMH_NOP ) // ?
AM_RANGE(0xe00000, 0xe00001) AM_WRITE(SMH_NOP ) // ? VBlank IRQ Ack
AM_RANGE(0xf00000, 0xf00001) AM_WRITE(SMH_NOP ) // ? Sound IRQ Ack
@@ -1932,7 +1932,7 @@ static ADDRESS_MAP_START( blandiap_readmem, ADDRESS_SPACE_PROGRAM, 16 )
/**/AM_RANGE(0xa00000, 0xa00607) AM_READ(SMH_RAM ) // Sprites Y
/**/AM_RANGE(0xa80000, 0xa80001) AM_READ(SMH_RAM ) // ? 0x4000
AM_RANGE(0xb00000, 0xb03fff) AM_READ(SMH_RAM ) // Sprites Code + X + Attr
- AM_RANGE(0xc00000, 0xc03fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0xc00000, 0xc03fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
ADDRESS_MAP_END
static ADDRESS_MAP_START( blandiap_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -1953,7 +1953,7 @@ static ADDRESS_MAP_START( blandiap_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xa00000, 0xa00607) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16 ) // Sprites Y
AM_RANGE(0xa80000, 0xa80001) AM_WRITE(SMH_RAM ) // ? 0x4000
AM_RANGE(0xb00000, 0xb03fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16_2 ) // Sprites Code + X + Attr
- AM_RANGE(0xc00000, 0xc03fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0xc00000, 0xc03fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
AM_RANGE(0xd00000, 0xd00007) AM_WRITE(SMH_NOP ) // ?
AM_RANGE(0xe00000, 0xe00001) AM_WRITE(SMH_NOP ) // ? VBlank IRQ Ack
AM_RANGE(0xf00000, 0xf00001) AM_WRITE(SMH_NOP ) // ? Sound IRQ Ack
@@ -2030,7 +2030,7 @@ static ADDRESS_MAP_START( wrofaero_readmem, ADDRESS_SPACE_PROGRAM, 16 )
/**/AM_RANGE(0xa00000, 0xa00607) AM_READ(SMH_RAM ) // Sprites Y
/**/AM_RANGE(0xa80000, 0xa80001) AM_READ(SMH_RAM ) // ? 0x4000
AM_RANGE(0xb00000, 0xb03fff) AM_READ(SMH_RAM ) // Sprites Code + X + Attr
- AM_RANGE(0xc00000, 0xc03fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0xc00000, 0xc03fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
ADDRESS_MAP_END
static ADDRESS_MAP_START( wrofaero_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -2051,7 +2051,7 @@ static ADDRESS_MAP_START( wrofaero_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xa00000, 0xa00607) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16 ) // Sprites Y
AM_RANGE(0xa80000, 0xa80001) AM_WRITE(SMH_RAM ) // ? 0x4000
AM_RANGE(0xb00000, 0xb03fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16_2 ) // Sprites Code + X + Attr
- AM_RANGE(0xc00000, 0xc03fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0xc00000, 0xc03fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
#if __uPD71054_TIMER
AM_RANGE(0xd00000, 0xd00007) AM_WRITE(timer_regs_w ) // ?
#else
@@ -2078,7 +2078,7 @@ static ADDRESS_MAP_START( jjsquawb_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xa0a000, 0xa0a607) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16 ) // RZ: Sprites Y
AM_RANGE(0xa80000, 0xa80001) AM_WRITE(SMH_RAM ) // ? 0x4000
AM_RANGE(0xb0c000, 0xb0ffff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16_2 ) // RZ: Sprites Code + X + Attr
- AM_RANGE(0xc00000, 0xc03fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0xc00000, 0xc03fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
#if __uPD71054_TIMER
AM_RANGE(0xd00000, 0xd00007) AM_WRITE(timer_regs_w ) // ?
#else
@@ -2104,7 +2104,7 @@ static ADDRESS_MAP_START( orbs_readmem, ADDRESS_SPACE_PROGRAM, 16 )
//AM_RANGE(0x600000, 0x60000f) AM_READ(krzybowl_input_r ) // P1
AM_RANGE(0x8000f0, 0x8000f1) AM_READ(SMH_RAM ) // NVRAM
AM_RANGE(0x800100, 0x8001ff) AM_READ(SMH_RAM ) // NVRAM
- AM_RANGE(0xa00000, 0xa03fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0xa00000, 0xa03fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
AM_RANGE(0xb00000, 0xb003ff) AM_READ(SMH_RAM ) // Palette
AM_RANGE(0xc00000, 0xc03fff) AM_READ(SMH_RAM ) // Sprites Code + X + Attr
/**/AM_RANGE(0xd00000, 0xd00001) AM_READ(SMH_RAM ) // ? 0x4000
@@ -2117,7 +2117,7 @@ static ADDRESS_MAP_START( orbs_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x400000, 0x400001) AM_WRITE(SMH_NOP ) // ?
AM_RANGE(0x8000f0, 0x8000f1) AM_WRITE(SMH_RAM ) // NVRAM
AM_RANGE(0x800100, 0x8001ff) AM_WRITE(SMH_RAM ) // NVRAM
- AM_RANGE(0xa00000, 0xa03fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0xa00000, 0xa03fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
AM_RANGE(0xb00000, 0xb003ff) AM_WRITE(SMH_RAM) AM_BASE(&paletteram16 ) AM_SIZE(&seta_paletteram_size) // Palette
AM_RANGE(0xc00000, 0xc03fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16_2 ) // Sprites Code + X + Attr
AM_RANGE(0xd00000, 0xd00001) AM_WRITE(SMH_RAM ) // ? 0x4000
@@ -2139,7 +2139,7 @@ static ADDRESS_MAP_START( blockcar_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x500000, 0x500001) AM_READ_PORT("P1") // P1
AM_RANGE(0x500002, 0x500003) AM_READ_PORT("P2") // P2
AM_RANGE(0x500004, 0x500005) AM_READ_PORT("COINS") // Coins
- AM_RANGE(0xa00000, 0xa03fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0xa00000, 0xa03fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
AM_RANGE(0xb00000, 0xb003ff) AM_READ(SMH_RAM ) // Palette
AM_RANGE(0xc00000, 0xc03fff) AM_READ(SMH_RAM ) // Sprites Code + X + Attr
/**/AM_RANGE(0xd00000, 0xd00001) AM_READ(SMH_RAM ) // ? 0x4000
@@ -2154,7 +2154,7 @@ static ADDRESS_MAP_START( blockcar_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x100000, 0x100001) AM_WRITE(SMH_NOP ) // ? 1 (start of interrupts, main loop: watchdog?)
AM_RANGE(0x200000, 0x200001) AM_WRITE(SMH_NOP ) // ? 0/1 (IRQ acknowledge?)
AM_RANGE(0x400000, 0x400001) AM_WRITE(seta_vregs_w) AM_BASE(&seta_vregs ) // Coin Lockout + Sound Enable (bit 4?)
- AM_RANGE(0xa00000, 0xa03fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0xa00000, 0xa03fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
AM_RANGE(0xb00000, 0xb003ff) AM_WRITE(SMH_RAM) AM_BASE(&paletteram16 ) AM_SIZE(&seta_paletteram_size) // Palette
AM_RANGE(0xc00000, 0xc03fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16_2 ) // Sprites Code + X + Attr
AM_RANGE(0xd00000, 0xd00001) AM_WRITE(SMH_RAM ) // ? 0x4000
@@ -2188,7 +2188,7 @@ static ADDRESS_MAP_START( daioh_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xa80000, 0xa80001) AM_READ(SMH_RAM ) // ? 0x4000
AM_RANGE(0xb00000, 0xb03fff) AM_READ(SMH_RAM ) // Sprites Code + X + Attr
AM_RANGE(0xb04000, 0xb13fff) AM_READ(SMH_RAM ) //
- AM_RANGE(0xc00000, 0xc03fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0xc00000, 0xc03fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
ADDRESS_MAP_END
static ADDRESS_MAP_START( daioh_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -2208,7 +2208,7 @@ static ADDRESS_MAP_START( daioh_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xa80000, 0xa80001) AM_WRITE(SMH_RAM ) // ? 0x4000
AM_RANGE(0xb00000, 0xb03fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16_2 ) // Sprites Code + X + Attr
AM_RANGE(0xb04000, 0xb13fff) AM_WRITE(SMH_RAM ) //
- AM_RANGE(0xc00000, 0xc03fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0xc00000, 0xc03fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
AM_RANGE(0xe00000, 0xe00001) AM_WRITE(SMH_NOP ) //
ADDRESS_MAP_END
@@ -2221,7 +2221,7 @@ static ADDRESS_MAP_START( drgnunit_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0bffff) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0xf00000, 0xf0ffff) AM_READ(SMH_RAM ) // RAM (qzkklogy)
AM_RANGE(0xffc000, 0xffffff) AM_READ(SMH_RAM ) // RAM (drgnunit,stg)
- AM_RANGE(0x100000, 0x103fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0x100000, 0x103fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r ) // DSW
AM_RANGE(0x700000, 0x7003ff) AM_READ(SMH_RAM ) // Palette
AM_RANGE(0x900000, 0x901fff) AM_READ(SMH_RAM ) // VRAM
@@ -2239,7 +2239,7 @@ static ADDRESS_MAP_START( drgnunit_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x0bffff) AM_WRITE(SMH_ROM ) // ROM
AM_RANGE(0xf00000, 0xf0ffff) AM_WRITE(SMH_RAM ) // RAM (qzkklogy)
AM_RANGE(0xffc000, 0xffffff) AM_WRITE(SMH_RAM ) // RAM (drgnunit,stg)
- AM_RANGE(0x100000, 0x103fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0x100000, 0x103fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
AM_RANGE(0x200000, 0x200001) AM_WRITE(SMH_NOP ) // Watchdog
AM_RANGE(0x300000, 0x300001) AM_WRITE(SMH_NOP ) // ? IRQ Ack
AM_RANGE(0x500000, 0x500001) AM_WRITE(seta_vregs_w) AM_BASE(&seta_vregs ) // Coin Lockout + Video Registers
@@ -2280,7 +2280,7 @@ static ADDRESS_MAP_START( extdwnhl_readmem, ADDRESS_SPACE_PROGRAM, 16 )
/**/AM_RANGE(0xa80000, 0xa80001) AM_READ(SMH_RAM ) // ? 0x4000
AM_RANGE(0xb00000, 0xb03fff) AM_READ(SMH_RAM ) // Sprites Code + X + Attr
AM_RANGE(0xb04000, 0xb13fff) AM_READ(SMH_RAM ) //
- AM_RANGE(0xe00000, 0xe03fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0xe00000, 0xe03fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
ADDRESS_MAP_END
static ADDRESS_MAP_START( extdwnhl_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -2303,7 +2303,7 @@ static ADDRESS_MAP_START( extdwnhl_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xa80000, 0xa80001) AM_WRITE(SMH_RAM ) // ? 0x4000
AM_RANGE(0xb00000, 0xb03fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16_2 ) // Sprites Code + X + Attr
AM_RANGE(0xb04000, 0xb13fff) AM_WRITE(SMH_RAM ) //
- AM_RANGE(0xe00000, 0xe03fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0xe00000, 0xe03fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
ADDRESS_MAP_END
/***************************************************************************
@@ -2330,7 +2330,7 @@ static ADDRESS_MAP_START( kamenrid_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xa00000, 0xa00607) AM_READ(SMH_RAM ) // Sprites Y
AM_RANGE(0xb00000, 0xb03fff) AM_READ(SMH_RAM ) // Sprites Code + X + Attr
AM_RANGE(0xb04000, 0xb07fff) AM_READ(SMH_RAM ) // tested
- AM_RANGE(0xd00000, 0xd03fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0xd00000, 0xd03fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
ADDRESS_MAP_END
static ADDRESS_MAP_START( kamenrid_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -2357,7 +2357,7 @@ static ADDRESS_MAP_START( kamenrid_writemem, ADDRESS_SPACE_PROGRAM, 16 )
#else
AM_RANGE(0xc00000, 0xc00007) AM_WRITE(SMH_NOP ) // ?
#endif
- AM_RANGE(0xd00000, 0xd03fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0xd00000, 0xd03fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
ADDRESS_MAP_END
/* almast identical to kamenrid */
@@ -2375,7 +2375,7 @@ static ADDRESS_MAP_START( madshark_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x882000, 0x883fff) AM_READ(SMH_RAM ) // VRAM 3
AM_RANGE(0xa00000, 0xa00607) AM_READ(SMH_RAM ) // Sprites Y
AM_RANGE(0xb00000, 0xb03fff) AM_READ(SMH_RAM ) // Sprites Code + X + Attr
- AM_RANGE(0xd00000, 0xd03fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0xd00000, 0xd03fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
ADDRESS_MAP_END
static ADDRESS_MAP_START( madshark_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -2397,7 +2397,7 @@ static ADDRESS_MAP_START( madshark_writemem, ADDRESS_SPACE_PROGRAM, 16 )
#else
AM_RANGE(0xc00000, 0xc00007) AM_WRITE(SMH_NOP ) // ?
#endif
- AM_RANGE(0xd00000, 0xd03fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0xd00000, 0xd03fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
ADDRESS_MAP_END
@@ -2442,7 +2442,7 @@ static ADDRESS_MAP_START( krzybowl_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x600000, 0x60000f) AM_READ(krzybowl_input_r ) // P1
AM_RANGE(0x8000f0, 0x8000f1) AM_READ(SMH_RAM ) // NVRAM
AM_RANGE(0x800100, 0x8001ff) AM_READ(SMH_RAM ) // NVRAM
- AM_RANGE(0xa00000, 0xa03fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0xa00000, 0xa03fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
AM_RANGE(0xb00000, 0xb003ff) AM_READ(SMH_RAM ) // Palette
AM_RANGE(0xc00000, 0xc03fff) AM_READ(SMH_RAM ) // Sprites Code + X + Attr
/**/AM_RANGE(0xd00000, 0xd00001) AM_READ(SMH_RAM ) // ? 0x4000
@@ -2455,7 +2455,7 @@ static ADDRESS_MAP_START( krzybowl_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x400000, 0x400001) AM_WRITE(SMH_NOP ) // ?
AM_RANGE(0x8000f0, 0x8000f1) AM_WRITE(SMH_RAM ) // NVRAM
AM_RANGE(0x800100, 0x8001ff) AM_WRITE(SMH_RAM ) // NVRAM
- AM_RANGE(0xa00000, 0xa03fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0xa00000, 0xa03fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
AM_RANGE(0xb00000, 0xb003ff) AM_WRITE(SMH_RAM) AM_BASE(&paletteram16 ) AM_SIZE(&seta_paletteram_size) // Palette
AM_RANGE(0xc00000, 0xc03fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16_2 ) // Sprites Code + X + Attr
AM_RANGE(0xd00000, 0xd00001) AM_WRITE(SMH_RAM ) // ? 0x4000
@@ -2495,7 +2495,7 @@ static ADDRESS_MAP_START( msgundam_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xa80000, 0xa83fff) AM_READ(SMH_RAM ) // VRAM 2&3
AM_RANGE(0xb00000, 0xb00005) AM_READ(SMH_RAM ) // VRAM 0&1 Ctrl
AM_RANGE(0xb80000, 0xb80005) AM_READ(SMH_RAM ) // VRAM 1&2 Ctrl
- AM_RANGE(0xc00000, 0xc03fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0xc00000, 0xc03fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
ADDRESS_MAP_END
static ADDRESS_MAP_START( msgundam_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -2517,7 +2517,7 @@ static ADDRESS_MAP_START( msgundam_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xa80000, 0xa83fff) AM_WRITE(seta_vram_2_w) AM_BASE(&seta_vram_2 ) // VRAM 2
AM_RANGE(0xb00000, 0xb00005) AM_WRITE(SMH_RAM) AM_BASE(&seta_vctrl_0 ) // VRAM 0&1 Ctrl
AM_RANGE(0xb80000, 0xb80005) AM_WRITE(SMH_RAM) AM_BASE(&seta_vctrl_2 ) // VRAM 2&3 Ctrl
- AM_RANGE(0xc00000, 0xc03fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0xc00000, 0xc03fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
#if __uPD71054_TIMER
AM_RANGE(0xd00000, 0xd00007) AM_WRITE(timer_regs_w ) // ?
#else
@@ -2542,7 +2542,7 @@ static ADDRESS_MAP_START( oisipuzl_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x400000, 0x400001) AM_READ_PORT("P1") // P1
AM_RANGE(0x400002, 0x400003) AM_READ_PORT("P2") // P2
AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS") // Coins
- AM_RANGE(0x700000, 0x703fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0x700000, 0x703fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
AM_RANGE(0x800000, 0x803fff) AM_READ(SMH_RAM ) // VRAM 0&1
AM_RANGE(0x880000, 0x883fff) AM_READ(SMH_RAM ) // VRAM 2&3
/**/AM_RANGE(0x900000, 0x900005) AM_READ(SMH_RAM ) // VRAM 0&1 Ctrl
@@ -2559,7 +2559,7 @@ static ADDRESS_MAP_START( oisipuzl_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x200000, 0x20ffff) AM_WRITE(SMH_RAM ) // RAM
AM_RANGE(0x400000, 0x400001) AM_WRITE(SMH_NOP ) // ? IRQ Ack
AM_RANGE(0x500000, 0x500005) AM_WRITE(seta_vregs_w) AM_BASE(&seta_vregs ) // Coin Lockout + Video Registers
- AM_RANGE(0x700000, 0x703fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0x700000, 0x703fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
AM_RANGE(0x800000, 0x803fff) AM_WRITE(seta_vram_0_w) AM_BASE(&seta_vram_0 ) // VRAM 0
AM_RANGE(0x880000, 0x883fff) AM_WRITE(seta_vram_2_w) AM_BASE(&seta_vram_2 ) // VRAM 2
AM_RANGE(0x900000, 0x900005) AM_WRITE(SMH_RAM) AM_BASE(&seta_vctrl_0 ) // VRAM 0&1 Ctrl
@@ -2584,7 +2584,7 @@ static ADDRESS_MAP_START( triplfun_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x400000, 0x400001) AM_READ_PORT("P1") // P1
AM_RANGE(0x400002, 0x400003) AM_READ_PORT("P2") // P2
AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS") // Coins
- AM_RANGE(0x500006, 0x500007) AM_READ(okim6295_status_0_lsb_r) // tfun sound
+ AM_RANGE(0x500006, 0x500007) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff) // tfun sound
AM_RANGE(0x700000, 0x703fff) AM_READ(SMH_RAM ) // old sound
AM_RANGE(0x800000, 0x803fff) AM_READ(SMH_RAM ) // VRAM 0&1
AM_RANGE(0x880000, 0x883fff) AM_READ(SMH_RAM ) // VRAM 2&3
@@ -2602,7 +2602,7 @@ static ADDRESS_MAP_START( triplfun_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x200000, 0x20ffff) AM_WRITE(SMH_RAM ) // RAM
AM_RANGE(0x400000, 0x400001) AM_WRITE(SMH_NOP ) // ? IRQ Ack
AM_RANGE(0x500000, 0x500005) AM_WRITE(seta_vregs_w) AM_BASE(&seta_vregs ) // Coin Lockout + Video Registers
- AM_RANGE(0x500006, 0x500007) AM_WRITE(okim6295_data_0_lsb_w) // tfun sound
+ AM_RANGE(0x500006, 0x500007) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff) // tfun sound
AM_RANGE(0x700000, 0x703fff) AM_WRITE(SMH_RAM ) // old sound
AM_RANGE(0x800000, 0x803fff) AM_WRITE(seta_vram_0_w) AM_BASE(&seta_vram_0 ) // VRAM 0
AM_RANGE(0x880000, 0x883fff) AM_WRITE(seta_vram_2_w) AM_BASE(&seta_vram_2 ) // VRAM 2
@@ -2661,7 +2661,7 @@ static ADDRESS_MAP_START( kiwame_readmem, ADDRESS_SPACE_PROGRAM, 16 )
/**/AM_RANGE(0x900000, 0x900001) AM_READ(SMH_RAM ) // ? 0x4000
/**/AM_RANGE(0xa00000, 0xa00607) AM_READ(SMH_RAM ) // Sprites Y
AM_RANGE(0xb00000, 0xb003ff) AM_READ(SMH_RAM ) // Palette
- AM_RANGE(0xc00000, 0xc03fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0xc00000, 0xc03fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
AM_RANGE(0xd00000, 0xd00009) AM_READ(kiwame_input_r )
AM_RANGE(0xe00000, 0xe00003) AM_READ(seta_dsw_r ) // DSW
ADDRESS_MAP_END
@@ -2674,7 +2674,7 @@ static ADDRESS_MAP_START( kiwame_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x900000, 0x900001) AM_WRITE(SMH_RAM ) // ? 0x4000
AM_RANGE(0xa00000, 0xa00607) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16 ) // Sprites Y
AM_RANGE(0xb00000, 0xb003ff) AM_WRITE(SMH_RAM) AM_BASE(&paletteram16 ) AM_SIZE(&seta_paletteram_size) // Palette
- AM_RANGE(0xc00000, 0xc03fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0xc00000, 0xc03fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
ADDRESS_MAP_END
@@ -2697,7 +2697,7 @@ static WRITE16_HANDLER( thunderl_protection_w )
static ADDRESS_MAP_START( thunderl_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x00ffff) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0xffc000, 0xffffff) AM_READ(SMH_RAM ) // RAM
- AM_RANGE(0x100000, 0x103fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0x100000, 0x103fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r ) // DSW
AM_RANGE(0x700000, 0x7003ff) AM_READ(SMH_RAM ) // Palette
AM_RANGE(0xb00000, 0xb00001) AM_READ_PORT("P1") // P1
@@ -2715,7 +2715,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( thunderl_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x00ffff) AM_WRITE(SMH_ROM ) // ROM
AM_RANGE(0xffc000, 0xffffff) AM_WRITE(SMH_RAM ) // RAM
- AM_RANGE(0x100000, 0x103fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0x100000, 0x103fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
AM_RANGE(0x200000, 0x200001) AM_WRITE(SMH_NOP ) // ?
AM_RANGE(0x300000, 0x300001) AM_WRITE(SMH_NOP ) // ?
AM_RANGE(0x400000, 0x40ffff) AM_WRITE(thunderl_protection_w ) // Protection (not in wits)
@@ -2745,17 +2745,48 @@ static WRITE16_HANDLER( wiggie_soundlatch_w )
}
+static ADDRESS_MAP_START( wiggie_readmem, ADDRESS_SPACE_PROGRAM, 16 )
+ AM_RANGE(0x000000, 0x00ffff) AM_READ(SMH_ROM ) // ROM
+ AM_RANGE(0xffc000, 0xffffff) AM_READ(SMH_RAM ) // RAM
+ AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r ) // DSW
+ AM_RANGE(0x700000, 0x7003ff) AM_READ(SMH_RAM ) // Palette
+ AM_RANGE(0xb00000, 0xb00001) AM_READ_PORT("P1") // P1
+ AM_RANGE(0xb00002, 0xb00003) AM_READ_PORT("P2") // P2
+ AM_RANGE(0xb00004, 0xb00005) AM_READ_PORT("COINS") // Coins
+ AM_RANGE(0xb0000c, 0xb0000d) AM_READ(thunderl_protection_r ) // Protection (not in wits)
+ AM_RANGE(0xb00008, 0xb00009) AM_READ_PORT("P3") // P3 (wits)
+ AM_RANGE(0xb0000a, 0xb0000b) AM_READ_PORT("P4") // P4 (wits)
+/**/AM_RANGE(0xc00000, 0xc00001) AM_READ(SMH_RAM ) // ? 0x4000
+/**/AM_RANGE(0xd00000, 0xd00607) AM_READ(SMH_RAM ) // Sprites Y
+ AM_RANGE(0xe00000, 0xe03fff) AM_READ(SMH_RAM ) // Sprites Code + X + Attr
+ AM_RANGE(0xe04000, 0xe07fff) AM_READ(SMH_RAM ) // (wits)
+ADDRESS_MAP_END
+
+static ADDRESS_MAP_START( wiggie_writemem, ADDRESS_SPACE_PROGRAM, 16 )
+ AM_RANGE(0x000000, 0x00ffff) AM_WRITE(SMH_ROM ) // ROM
+ AM_RANGE(0xffc000, 0xffffff) AM_WRITE(SMH_RAM ) // RAM
+ AM_RANGE(0x200000, 0x200001) AM_WRITE(SMH_NOP ) // ?
+ AM_RANGE(0x300000, 0x300001) AM_WRITE(SMH_NOP ) // ?
+ AM_RANGE(0x400000, 0x40ffff) AM_WRITE(thunderl_protection_w ) // Protection (not in wits)
+ AM_RANGE(0x500000, 0x500001) AM_WRITE(seta_vregs_w) AM_BASE(&seta_vregs ) // Coin Lockout
+ AM_RANGE(0x700000, 0x7003ff) AM_WRITE(SMH_RAM) AM_BASE(&paletteram16 ) AM_SIZE(&seta_paletteram_size) // Palette
+ AM_RANGE(0xc00000, 0xc00001) AM_WRITE(SMH_RAM ) // ? 0x4000
+ AM_RANGE(0xd00000, 0xd00607) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16 ) // Sprites Y
+ AM_RANGE(0xe00000, 0xe03fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16_2 ) // Sprites Code + X + Attr
+ AM_RANGE(0xe04000, 0xe07fff) AM_WRITE(SMH_RAM ) // (wits)
+ADDRESS_MAP_END
+
static ADDRESS_MAP_START( wiggie_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM)
- AM_RANGE(0x9800, 0x9800) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x9800, 0x9800) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0xa000, 0xa000) AM_READ(wiggie_soundlatch_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( wiggie_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x9800, 0x9800) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0x9800, 0x9800) AM_DEVWRITE(SOUND, "oki", okim6295_w)
ADDRESS_MAP_END
/***************************************************************************
@@ -2774,7 +2805,7 @@ static ADDRESS_MAP_START( umanclub_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xa00000, 0xa00607) AM_READ(SMH_RAM ) // Sprites Y
/**/AM_RANGE(0xa80000, 0xa80001) AM_READ(SMH_RAM ) // ? 0x4000
AM_RANGE(0xb00000, 0xb03fff) AM_READ(SMH_RAM ) // Sprites Code + X + Attr
- AM_RANGE(0xc00000, 0xc03fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0xc00000, 0xc03fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
ADDRESS_MAP_END
static ADDRESS_MAP_START( umanclub_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -2788,7 +2819,7 @@ static ADDRESS_MAP_START( umanclub_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xa00000, 0xa00607) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16 ) // Sprites Y
AM_RANGE(0xa80000, 0xa80001) AM_WRITE(SMH_RAM ) // ? 0x4000
AM_RANGE(0xb00000, 0xb03fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16_2 ) // Sprites Code + X + Attr
- AM_RANGE(0xc00000, 0xc03fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0xc00000, 0xc03fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
ADDRESS_MAP_END
/***************************************************************************
@@ -2872,7 +2903,7 @@ static ADDRESS_MAP_START( tndrcade_sub_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1000, 0x1000) AM_READ_PORT("P1") // P1
AM_RANGE(0x1001, 0x1001) AM_READ_PORT("P2") // P2
AM_RANGE(0x1002, 0x1002) AM_READ_PORT("COINS") // Coins
- AM_RANGE(0x2001, 0x2001) AM_READ(ym2203_read_port_0_r )
+ AM_RANGE(0x2000, 0x2001) AM_DEVREAD(SOUND, "ym1", ym2203_r )
AM_RANGE(0x5000, 0x57ff) AM_READ(SMH_RAM ) // Shared RAM
AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1 ) // Banked ROM
@@ -2882,10 +2913,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( tndrcade_sub_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x01ff) AM_WRITE(SMH_RAM ) // RAM
AM_RANGE(0x1000, 0x1000) AM_WRITE(sub_bankswitch_lockout_w ) // ROM Bank + Coin Lockout
- AM_RANGE(0x2000, 0x2000) AM_WRITE(ym2203_control_port_0_w )
- AM_RANGE(0x2001, 0x2001) AM_WRITE(ym2203_write_port_0_w )
- AM_RANGE(0x3000, 0x3000) AM_WRITE(ym3812_control_port_0_w )
- AM_RANGE(0x3001, 0x3001) AM_WRITE(ym3812_write_port_0_w )
+ AM_RANGE(0x2000, 0x2001) AM_DEVWRITE(SOUND, "ym1", ym2203_w )
+ AM_RANGE(0x3000, 0x3000) AM_DEVWRITE(SOUND, "ym2", ym3812_w )
AM_RANGE(0x5000, 0x57ff) AM_WRITE(SMH_RAM) AM_BASE(&sharedram ) // Shared RAM
AM_RANGE(0x6000, 0xffff) AM_WRITE(SMH_ROM ) // ROM
ADDRESS_MAP_END
@@ -2978,14 +3007,14 @@ static WRITE8_HANDLER( calibr50_soundlatch2_w )
}
static ADDRESS_MAP_START( calibr50_sub_readmem, ADDRESS_SPACE_PROGRAM, 8 )
- AM_RANGE(0x0000, 0x1fff) AM_READ(seta_sound_r ) // Sound
+ AM_RANGE(0x0000, 0x1fff) AM_DEVREAD(SOUND, "x1", seta_sound_r ) // Sound
AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_r ) // From Main CPU
AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1 ) // Banked ROM
AM_RANGE(0xc000, 0xffff) AM_READ(SMH_ROM ) // ROM
ADDRESS_MAP_END
static ADDRESS_MAP_START( calibr50_sub_writemem, ADDRESS_SPACE_PROGRAM, 8 )
- AM_RANGE(0x0000, 0x1fff) AM_WRITE(seta_sound_w ) // Sound
+ AM_RANGE(0x0000, 0x1fff) AM_DEVWRITE(SOUND, "x1", seta_sound_w ) // Sound
AM_RANGE(0x4000, 0x4000) AM_WRITE(sub_bankswitch_w ) // Bankswitching
AM_RANGE(0x8000, 0xbfff) AM_WRITE(SMH_ROM ) // Banked ROM
AM_RANGE(0xc000, 0xc000) AM_WRITE(calibr50_soundlatch2_w ) // To Main CPU
@@ -3027,20 +3056,17 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( utoukond_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xdfff) AM_READ(SMH_ROM)
AM_RANGE(0xe000, 0xefff) AM_READ(SMH_RAM)
- AM_RANGE(0xf000, 0xffff) AM_READ(seta_sound_r)
+ AM_RANGE(0xf000, 0xffff) AM_DEVREAD(SOUND, "x1", seta_sound_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( utoukond_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xdfff) AM_WRITE(SMH_ROM)
AM_RANGE(0xe000, 0xefff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xf000, 0xffff) AM_WRITE(seta_sound_w)
+ AM_RANGE(0xf000, 0xffff) AM_DEVWRITE(SOUND, "x1", seta_sound_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( utoukond_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym3438_status_port_0_a_r, ym3438_control_port_0_a_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym3438_data_port_0_a_w)
- AM_RANGE(0x02, 0x02) AM_WRITE(ym3438_control_port_0_b_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ym3438_data_port_0_b_w)
+ AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(SOUND, "ym", ym3438_r, ym3438_w)
AM_RANGE(0x80, 0x80) AM_WRITE(SMH_NOP) //?
AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -3075,7 +3101,7 @@ static ADDRESS_MAP_START( pairlove_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x500002, 0x500003) AM_READ_PORT("P2") // P2
AM_RANGE(0x500004, 0x500005) AM_READ_PORT("COINS") // Coins
AM_RANGE(0x900000, 0x9001ff) AM_READ(pairlove_prot_r)
- AM_RANGE(0xa00000, 0xa03fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0xa00000, 0xa03fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
AM_RANGE(0xb00000, 0xb00fff) AM_READ(SMH_RAM ) // Palette
AM_RANGE(0xc00000, 0xc03fff) AM_READ(SMH_RAM ) // Sprites Code + X + Attr
AM_RANGE(0xd00000, 0xd00001) AM_READ(SMH_RAM ) // ? 0x4000
@@ -3089,7 +3115,7 @@ static ADDRESS_MAP_START( pairlove_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x200000, 0x200001) AM_WRITE(SMH_NOP ) // ? 0/1 (IRQ acknowledge?)
AM_RANGE(0x400000, 0x400001) AM_WRITE(seta_vregs_w) AM_BASE(&seta_vregs ) // Coin Lockout + Sound Enable (bit 4?)
AM_RANGE(0x900000, 0x9001ff) AM_WRITE(pairlove_prot_w)
- AM_RANGE(0xa00000, 0xa03fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0xa00000, 0xa03fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
AM_RANGE(0xb00000, 0xb00fff) AM_WRITE(SMH_RAM) AM_BASE(&paletteram16 ) AM_SIZE(&seta_paletteram_size) // Palette
AM_RANGE(0xc00000, 0xc03fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16_2 ) // Sprites Code + X + Attr
AM_RANGE(0xd00000, 0xd00001) AM_WRITE(SMH_RAM ) // ? 0x4000
@@ -3102,9 +3128,6 @@ ADDRESS_MAP_END
Crazy Fight
***************************************************************************/
-static WRITE16_HANDLER( YM3812_control_port_0_lsb_w ) { if (ACCESSING_BITS_0_7) ym3812_control_port_0_w(space, 0, data & 0xff); }
-static WRITE16_HANDLER( YM3812_write_port_0_lsb_w ) { if (ACCESSING_BITS_0_7) ym3812_write_port_0_w(space, 0, data & 0xff); }
-
static ADDRESS_MAP_START( crazyfgt_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_ROM
AM_RANGE(0x400000, 0x40ffff) AM_RAM
@@ -3115,9 +3138,8 @@ static ADDRESS_MAP_START( crazyfgt_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x620000, 0x620003) AM_WRITENOP // protection
AM_RANGE(0x630000, 0x630003) AM_READ(seta_dsw_r)
AM_RANGE(0x640400, 0x640fff) AM_WRITE(SMH_RAM) AM_BASE(&paletteram16 ) AM_SIZE(&seta_paletteram_size) // Palette
- AM_RANGE(0x650000, 0x650001) AM_WRITE(YM3812_control_port_0_lsb_w)
- AM_RANGE(0x650002, 0x650003) AM_WRITE(YM3812_write_port_0_lsb_w)
- AM_RANGE(0x658000, 0x658001) AM_WRITE(okim6295_data_0_lsb_w)
+ AM_RANGE(0x650000, 0x650003) AM_DEVWRITE8(SOUND, "ym", ym3812_w, 0x00ff)
+ AM_RANGE(0x658000, 0x658001) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff)
AM_RANGE(0x670000, 0x670001) AM_READNOP // watchdog?
AM_RANGE(0x800000, 0x803fff) AM_WRITE(seta_vram_2_w) AM_BASE(&seta_vram_2) // VRAM 2
AM_RANGE(0x880000, 0x883fff) AM_WRITE(seta_vram_0_w) AM_BASE(&seta_vram_0) // VRAM 0
@@ -3181,7 +3203,7 @@ static ADDRESS_MAP_START( inttoote_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x800000, 0x80001f) AM_DEVREADWRITE8(MSM6242, "rtc", msm6242_r, msm6242_w, 0x00ff) // 6242RTC
- AM_RANGE(0x900000, 0x903fff) AM_READWRITE( seta_sound_word_r, seta_sound_word_w ) // Sound
+ AM_RANGE(0x900000, 0x903fff) AM_DEVREADWRITE( SOUND, "x1", seta_sound_word_r, seta_sound_word_w ) // Sound
AM_RANGE(0xa00000, 0xa00005) AM_WRITE(SMH_RAM) AM_BASE(&seta_vctrl_0 ) // VRAM 0&1 Ctrl
AM_RANGE(0xb00000, 0xb03fff) AM_READWRITE(SMH_RAM,seta_vram_0_w) AM_BASE(&seta_vram_0 ) // VRAM 0&1
@@ -6720,10 +6742,10 @@ static const ym2203_interface tndrcade_ym2203_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- dsw1_r, /* input A: DSW 1 */
- dsw2_r, /* input B: DSW 2 */
- NULL,
- NULL
+ DEVCB_HANDLER(dsw1_r), /* input A: DSW 1 */
+ DEVCB_HANDLER(dsw2_r), /* input B: DSW 2 */
+ DEVCB_NULL,
+ DEVCB_NULL
},
NULL
};
@@ -7868,7 +7890,7 @@ static MACHINE_DRIVER_START( wiggie )
/* basic machine hardware */
MDRV_CPU_ADD("main", M68000, 16000000/2) /* 8 MHz */
- MDRV_CPU_PROGRAM_MAP(thunderl_readmem,thunderl_writemem)
+ MDRV_CPU_PROGRAM_MAP(wiggie_readmem,wiggie_writemem)
MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
MDRV_CPU_ADD("audio", Z80, 16000000/4) /* 4 MHz */
diff --git a/src/mame/drivers/seta2.c b/src/mame/drivers/seta2.c
index 63e19c4a74d..6f361f9729f 100644
--- a/src/mame/drivers/seta2.c
+++ b/src/mame/drivers/seta2.c
@@ -566,7 +566,7 @@ static ADDRESS_MAP_START( grdians_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x700002, 0x700003) AM_READ_PORT("P2") // P2
AM_RANGE(0x700004, 0x700005) AM_READ_PORT("SYSTEM") // Coins
AM_RANGE(0x70000c, 0x70000d) AM_READ(watchdog_reset16_r ) // Watchdog
- AM_RANGE(0xb00000, 0xb03fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0xb00000, 0xb03fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
AM_RANGE(0xc00000, 0xc3ffff) AM_READ(SMH_RAM ) // Sprites
AM_RANGE(0xc40000, 0xc4ffff) AM_READ(SMH_RAM ) // Palette
AM_RANGE(0xfffc00, 0xffffff) AM_READ(SMH_RAM ) // TMP68301 Registers
@@ -577,7 +577,7 @@ static ADDRESS_MAP_START( grdians_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x200000, 0x20ffff) AM_WRITE(SMH_RAM ) // RAM
AM_RANGE(0x304000, 0x30ffff) AM_WRITE(SMH_RAM ) // ? seems tile data
AM_RANGE(0x800000, 0x800001) AM_WRITE(grdians_lockout_w )
- AM_RANGE(0xb00000, 0xb03fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0xb00000, 0xb03fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
AM_RANGE(0xc00000, 0xc3ffff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size ) // Sprites
AM_RANGE(0xc40000, 0xc4ffff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16 ) // Palette
AM_RANGE(0xc50000, 0xc5ffff) AM_WRITE(SMH_RAM ) // cleared
@@ -637,7 +637,7 @@ static ADDRESS_MAP_START( gundamex_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x700004, 0x700005) AM_READ_PORT("SYSTEM") // Coins
AM_RANGE(0x700008, 0x700009) AM_READ_PORT("IN0") // P1
AM_RANGE(0x70000a, 0x70000b) AM_READ_PORT("IN1") // P2
- AM_RANGE(0xb00000, 0xb03fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0xb00000, 0xb03fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
AM_RANGE(0xfffd0a, 0xfffd0b) AM_READ(gundamex_eeprom_r ) // parallel data register
ADDRESS_MAP_END
@@ -647,7 +647,7 @@ static ADDRESS_MAP_START( gundamex_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x500000, 0x57ffff) AM_WRITE(SMH_ROM ) // ROM
AM_RANGE(0x70000c, 0x70000d) AM_WRITE(watchdog_reset16_w )
AM_RANGE(0x800000, 0x800001) AM_WRITE(grdians_lockout_w )
- AM_RANGE(0xb00000, 0xb03fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0xb00000, 0xb03fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
AM_RANGE(0xc00000, 0xc3ffff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size ) // Sprites
AM_RANGE(0xc40000, 0xc4ffff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16 ) // Palette
AM_RANGE(0xc50000, 0xc5ffff) AM_WRITE(SMH_RAM ) // cleared
@@ -691,7 +691,7 @@ static ADDRESS_MAP_START( mj4simai_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x600100, 0x600101) AM_READ_PORT("SYSTEM") //
AM_RANGE(0x600300, 0x600301) AM_READ_PORT("DSW1") // DSW 1
AM_RANGE(0x600302, 0x600303) AM_READ_PORT("DSW2") // DSW 2
- AM_RANGE(0xb00000, 0xb03fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0xb00000, 0xb03fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
AM_RANGE(0xc00000, 0xc3ffff) AM_READ(SMH_RAM ) // Sprites
AM_RANGE(0xc40000, 0xc4ffff) AM_READ(SMH_RAM ) // Palette
AM_RANGE(0xfffc00, 0xffffff) AM_READ(SMH_RAM ) // TMP68301 Registers
@@ -703,7 +703,7 @@ static ADDRESS_MAP_START( mj4simai_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x600004, 0x600005) AM_WRITE(mj4simai_keyboard_w ) // select keyboard row to read
AM_RANGE(0x600200, 0x600201) AM_WRITE(SMH_NOP ) // Leds? Coins?
AM_RANGE(0x600300, 0x60030f) AM_WRITE(seta2_sound_bank_w ) // Samples Banks
- AM_RANGE(0xb00000, 0xb03fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0xb00000, 0xb03fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
AM_RANGE(0xc00000, 0xc3ffff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size ) // Sprites
AM_RANGE(0xc40000, 0xc4ffff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16 ) // Palette
AM_RANGE(0xc60000, 0xc6003f) AM_WRITE(seta2_vregs_w) AM_BASE(&seta2_vregs ) // Video Registers
@@ -724,7 +724,7 @@ static ADDRESS_MAP_START( myangel_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x700006, 0x700007) AM_READ(watchdog_reset16_r ) // Watchdog
AM_RANGE(0x700300, 0x700301) AM_READ_PORT("DSW1") // DSW 1
AM_RANGE(0x700302, 0x700303) AM_READ_PORT("DSW2") // DSW 2
- AM_RANGE(0xb00000, 0xb03fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0xb00000, 0xb03fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
AM_RANGE(0xc00000, 0xc3ffff) AM_READ(SMH_RAM ) // Sprites
AM_RANGE(0xc40000, 0xc4ffff) AM_READ(SMH_RAM ) // Palette
AM_RANGE(0xfffc00, 0xffffff) AM_READ(SMH_RAM ) // TMP68301 Registers
@@ -735,7 +735,7 @@ static ADDRESS_MAP_START( myangel_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x200000, 0x20ffff) AM_WRITE(SMH_RAM ) // RAM
AM_RANGE(0x700200, 0x700201) AM_WRITE(SMH_NOP ) // Leds? Coins?
AM_RANGE(0x700310, 0x70031f) AM_WRITE(seta2_sound_bank_w ) // Samples Banks
- AM_RANGE(0xb00000, 0xb03fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0xb00000, 0xb03fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
AM_RANGE(0xc00000, 0xc3ffff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size ) // Sprites
AM_RANGE(0xc40000, 0xc4ffff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16 ) // Palette
AM_RANGE(0xc60000, 0xc6003f) AM_WRITE(seta2_vregs_w) AM_BASE(&seta2_vregs ) // Video Registers
@@ -756,7 +756,7 @@ static ADDRESS_MAP_START( myangel2_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x600006, 0x600007) AM_READ(watchdog_reset16_r ) // Watchdog
AM_RANGE(0x600300, 0x600301) AM_READ_PORT("DSW1") // DSW 1
AM_RANGE(0x600302, 0x600303) AM_READ_PORT("DSW2") // DSW 2
- AM_RANGE(0xb00000, 0xb03fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0xb00000, 0xb03fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
AM_RANGE(0xd00000, 0xd3ffff) AM_READ(SMH_RAM ) // Sprites
AM_RANGE(0xd40000, 0xd4ffff) AM_READ(SMH_RAM ) // Palette
AM_RANGE(0xfffc00, 0xffffff) AM_READ(SMH_RAM ) // TMP68301 Registers
@@ -767,7 +767,7 @@ static ADDRESS_MAP_START( myangel2_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x200000, 0x20ffff) AM_WRITE(SMH_RAM ) // RAM
AM_RANGE(0x600200, 0x600201) AM_WRITE(SMH_NOP ) // Leds? Coins?
AM_RANGE(0x600300, 0x60030f) AM_WRITE(seta2_sound_bank_w ) // Samples Banks
- AM_RANGE(0xb00000, 0xb03fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0xb00000, 0xb03fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
AM_RANGE(0xd00000, 0xd3ffff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size ) // Sprites
AM_RANGE(0xd40000, 0xd4ffff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16 ) // Palette
AM_RANGE(0xd60000, 0xd6003f) AM_WRITE(seta2_vregs_w) AM_BASE(&seta2_vregs ) // Video Registers
@@ -813,7 +813,7 @@ static ADDRESS_MAP_START( pzlbowl_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x700000, 0x700001) AM_READ(pzlbowl_protection_r ) // Protection
AM_RANGE(0x800000, 0x83ffff) AM_READ(SMH_RAM ) // Sprites
AM_RANGE(0x840000, 0x84ffff) AM_READ(SMH_RAM ) // Palette
- AM_RANGE(0x900000, 0x903fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0x900000, 0x903fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
AM_RANGE(0xfffc00, 0xffffff) AM_READ(SMH_RAM ) // TMP68301 Registers
ADDRESS_MAP_END
@@ -825,7 +825,7 @@ static ADDRESS_MAP_START( pzlbowl_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x800000, 0x83ffff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size ) // Sprites
AM_RANGE(0x840000, 0x84ffff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16 ) // Palette
AM_RANGE(0x860000, 0x86003f) AM_WRITE(seta2_vregs_w) AM_BASE(&seta2_vregs ) // Video Registers
- AM_RANGE(0x900000, 0x903fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0x900000, 0x903fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
AM_RANGE(0xfffc00, 0xffffff) AM_WRITE(tmp68301_regs_w) AM_BASE(&tmp68301_regs ) // TMP68301 Registers
ADDRESS_MAP_END
@@ -848,7 +848,7 @@ static ADDRESS_MAP_START( penbros_readmem, ADDRESS_SPACE_PROGRAM, 16 )
// AM_RANGE(0x700000, 0x700001) AM_READ(pzlbowl_protection_r ) // Protection
AM_RANGE(0xb00000, 0xb3ffff) AM_READ(SMH_RAM ) // Sprites
AM_RANGE(0xb40000, 0xb4ffff) AM_READ(SMH_RAM ) // Palette
- AM_RANGE(0xa00000, 0xa03fff) AM_READ(seta_sound_word_r ) // Sound
+ AM_RANGE(0xa00000, 0xa03fff) AM_DEVREAD(SOUND, "x1", seta_sound_word_r ) // Sound
AM_RANGE(0xfffc00, 0xffffff) AM_READ(SMH_RAM ) // TMP68301 Registers
ADDRESS_MAP_END
@@ -862,7 +862,7 @@ static ADDRESS_MAP_START( penbros_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xb00000, 0xb3ffff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size ) // Sprites
AM_RANGE(0xb40000, 0xb4ffff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16 ) // Palette
AM_RANGE(0xb60000, 0xb6003f) AM_WRITE(seta2_vregs_w) AM_BASE(&seta2_vregs ) // Video Registers
- AM_RANGE(0xa00000, 0xa03fff) AM_WRITE(seta_sound_word_w ) // Sound
+ AM_RANGE(0xa00000, 0xa03fff) AM_DEVWRITE(SOUND, "x1", seta_sound_word_w ) // Sound
AM_RANGE(0xfffc00, 0xffffff) AM_WRITE(tmp68301_regs_w) AM_BASE(&tmp68301_regs ) // TMP68301 Registers
ADDRESS_MAP_END
@@ -916,7 +916,7 @@ static ADDRESS_MAP_START( samshoot_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE( 0x840000, 0x84ffff ) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16) // Palette
AM_RANGE( 0x860000, 0x86003f ) AM_WRITE(seta2_vregs_w) AM_BASE(&seta2_vregs) // Video Registers
- AM_RANGE( 0x900000, 0x903fff ) AM_READWRITE( seta_sound_word_r, seta_sound_word_w ) // Sound
+ AM_RANGE( 0x900000, 0x903fff ) AM_DEVREADWRITE( SOUND, "x1", seta_sound_word_r, seta_sound_word_w ) // Sound
AM_RANGE( 0xfffd0a, 0xfffd0b ) AM_READ_PORT("DSW2") // parallel data register (DSW 2)
AM_RANGE( 0xfffc00, 0xffffff ) AM_READWRITE( SMH_RAM, tmp68301_regs_w) AM_BASE(&tmp68301_regs ) // TMP68301 Registers
diff --git a/src/mame/drivers/sf.c b/src/mame/drivers/sf.c
index 5d6c188dc50..ac76e8f3f28 100644
--- a/src/mame/drivers/sf.c
+++ b/src/mame/drivers/sf.c
@@ -180,13 +180,13 @@ static WRITE8_HANDLER( sound2_bank_w )
}
-static WRITE8_HANDLER( msm5205_w )
+static WRITE8_DEVICE_HANDLER( msm5205_w )
{
- msm5205_reset_w(offset,(data>>7)&1);
+ msm5205_reset_w(device,(data>>7)&1);
/* ?? bit 6?? */
- msm5205_data_w(offset,data);
- msm5205_vclk_w(offset,1);
- msm5205_vclk_w(offset,0);
+ msm5205_data_w(device,data);
+ msm5205_vclk_w(device,1);
+ msm5205_vclk_w(device,0);
}
@@ -254,14 +254,13 @@ static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0xc000, 0xc7ff) AM_READ(SMH_RAM)
AM_RANGE(0xc800, 0xc800) AM_READ(soundlatch_r)
- AM_RANGE(0xe001, 0xe001) AM_READ(ym2151_status_port_0_r)
+ AM_RANGE(0xe000, 0xe001) AM_DEVREAD(SOUND, "ym", ym2151_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xc7ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ym2151_data_port_0_w)
+ AM_RANGE(0xe000, 0xe001) AM_DEVWRITE(SOUND, "ym", ym2151_w)
ADDRESS_MAP_END
@@ -278,7 +277,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound2_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x01) AM_WRITE(msm5205_w)
+ AM_RANGE(0x00, 0x00) AM_DEVWRITE(SOUND, "msm1", msm5205_w)
+ AM_RANGE(0x01, 0x01) AM_DEVWRITE(SOUND, "msm2", msm5205_w)
AM_RANGE(0x01, 0x01) AM_READ(soundlatch_r)
AM_RANGE(0x02, 0x02) AM_WRITE(sound2_bank_w)
ADDRESS_MAP_END
@@ -793,9 +793,9 @@ GFXDECODE_END
-static void irq_handler(running_machine *machine, int irq)
+static void irq_handler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/sfkick.c b/src/mame/drivers/sfkick.c
index 1e9431b41de..bada6c08c47 100644
--- a/src/mame/drivers/sfkick.c
+++ b/src/mame/drivers/sfkick.c
@@ -330,8 +330,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START (sound_io, ADDRESS_SPACE_IO, 8)
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r)
- AM_RANGE(0x04, 0x04) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x05, 0x05) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
+ AM_RANGE(0x04, 0x05) AM_DEVREADWRITE(SOUND, "ym1", ym2203_r, ym2203_w)
ADDRESS_MAP_END
static WRITE8_DEVICE_HANDLER ( ppi_port_c_w )
@@ -443,9 +442,9 @@ static INTERRUPT_GEN( sfkick_interrupt )
{
v9938_interrupt(device->machine, 0);
}
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line_and_vector(machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE, 0xff);
+ cpu_set_input_line_and_vector(device->machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE, 0xff);
}
static const ym2203_interface ym2203_config =
@@ -453,7 +452,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- 0,0,0,0,
+ DEVCB_NULL,DEVCB_NULL,DEVCB_NULL,DEVCB_NULL,
},
irqhandler
};
diff --git a/src/mame/drivers/sg1000a.c b/src/mame/drivers/sg1000a.c
index 2155bf894b6..019d37bfd40 100644
--- a/src/mame/drivers/sg1000a.c
+++ b/src/mame/drivers/sg1000a.c
@@ -132,7 +132,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x7f, 0x7f) AM_WRITE(sn76496_0_w)
+ AM_RANGE(0x7f, 0x7f) AM_DEVWRITE(SOUND, "sn", sn76496_w)
AM_RANGE(0xbe, 0xbe) AM_READWRITE(TMS9928A_vram_r, TMS9928A_vram_w)
AM_RANGE(0xbf, 0xbf) AM_READWRITE(TMS9928A_register_r, TMS9928A_register_w)
AM_RANGE(0xdc, 0xdf) AM_DEVREADWRITE(PPI8255, "ppi8255", ppi8255_r, ppi8255_w)
diff --git a/src/mame/drivers/shadfrce.c b/src/mame/drivers/shadfrce.c
index 146be2338a1..cd1c3da1414 100644
--- a/src/mame/drivers/shadfrce.c
+++ b/src/mame/drivers/shadfrce.c
@@ -349,19 +349,18 @@ ADDRESS_MAP_END
/* and the sound cpu */
-static WRITE8_HANDLER( oki_bankswitch_w )
+static WRITE8_DEVICE_HANDLER( oki_bankswitch_w )
{
- okim6295_set_bank_base(0, (data & 1) * 0x40000);
+ okim6295_set_bank_base(device, (data & 1) * 0x40000);
}
static ADDRESS_MAP_START( shadfrce_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xc7ff) AM_RAM
- AM_RANGE(0xc800, 0xc800) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xc801, 0xc801) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
- AM_RANGE(0xd800, 0xd800) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0xc800, 0xc801) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0xd800, 0xd800) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
- AM_RANGE(0xe800, 0xe800) AM_WRITE(oki_bankswitch_w)
+ AM_RANGE(0xe800, 0xe800) AM_DEVWRITE(SOUND, "oki", oki_bankswitch_w)
AM_RANGE(0xf000, 0xffff) AM_RAM
ADDRESS_MAP_END
@@ -502,9 +501,9 @@ GFXDECODE_END
/* Machine Driver Bits */
-static void irq_handler(running_machine *machine, int irq)
+static void irq_handler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE );
+ cpu_set_input_line(device->machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE );
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/shangha3.c b/src/mame/drivers/shangha3.c
index 0ab77fe7ff8..947d59f7ad9 100644
--- a/src/mame/drivers/shangha3.c
+++ b/src/mame/drivers/shangha3.c
@@ -91,7 +91,7 @@ static WRITE16_HANDLER( heberpop_coinctrl_w )
if (ACCESSING_BITS_0_7)
{
/* the sound ROM bank is selected by the main CPU! */
- okim6295_set_bank_base(0,(data & 0x08) ? 0x40000 : 0x00000);
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki"),(data & 0x08) ? 0x40000 : 0x00000);
coin_lockout_w(0,~data & 0x04);
coin_lockout_w(1,~data & 0x04);
@@ -105,7 +105,7 @@ static WRITE16_HANDLER( blocken_coinctrl_w )
if (ACCESSING_BITS_0_7)
{
/* the sound ROM bank is selected by the main CPU! */
- okim6295_set_bank_base(0, ((data >> 4) & 3) * 0x40000);
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki"), ((data >> 4) & 3) * 0x40000);
coin_lockout_w(0,~data & 0x04);
coin_lockout_w(1,~data & 0x04);
@@ -131,9 +131,9 @@ static ADDRESS_MAP_START( shangha3_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x100000, 0x100fff) AM_READ(SMH_RAM)
AM_RANGE(0x200000, 0x200001) AM_READ_PORT("INPUTS")
AM_RANGE(0x200002, 0x200003) AM_READ_PORT("SYSTEM")
- AM_RANGE(0x20001e, 0x20001f) AM_READ(ay8910_read_port_0_lsb_r)
+ AM_RANGE(0x20001e, 0x20001f) AM_DEVREAD8(SOUND, "ay", ay8910_r, 0x00ff)
AM_RANGE(0x20004e, 0x20004f) AM_READ(shangha3_prot_r)
- AM_RANGE(0x20006e, 0x20006f) AM_READ(okim6295_status_0_lsb_r)
+ AM_RANGE(0x20006e, 0x20006f) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff)
AM_RANGE(0x300000, 0x30ffff) AM_READ(SMH_RAM)
ADDRESS_MAP_END
@@ -143,10 +143,10 @@ static ADDRESS_MAP_START( shangha3_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x200008, 0x200009) AM_WRITE(shangha3_blitter_go_w)
AM_RANGE(0x20000a, 0x20000b) AM_WRITE(SMH_NOP) /* irq ack? */
AM_RANGE(0x20000c, 0x20000d) AM_WRITE(shangha3_coinctrl_w)
- AM_RANGE(0x20002e, 0x20002f) AM_WRITE(ay8910_write_port_0_lsb_w)
- AM_RANGE(0x20003e, 0x20003f) AM_WRITE(ay8910_control_port_0_lsb_w)
+ AM_RANGE(0x20002e, 0x20002f) AM_DEVWRITE8(SOUND, "ay", ay8910_data_w, 0x00ff)
+ AM_RANGE(0x20003e, 0x20003f) AM_DEVWRITE8(SOUND, "ay", ay8910_address_w, 0x00ff)
AM_RANGE(0x20004e, 0x20004f) AM_WRITE(shangha3_prot_w)
- AM_RANGE(0x20006e, 0x20006f) AM_WRITE(okim6295_data_0_lsb_w)
+ AM_RANGE(0x20006e, 0x20006f) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff)
AM_RANGE(0x300000, 0x30ffff) AM_WRITE(SMH_RAM) AM_BASE(&shangha3_ram) AM_SIZE(&shangha3_ram_size) /* gfx & work ram */
AM_RANGE(0x340000, 0x340001) AM_WRITE(shangha3_flipscreen_w)
AM_RANGE(0x360000, 0x360001) AM_WRITE(shangha3_gfxlist_addr_w)
@@ -211,11 +211,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( heberpop_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym3438_status_port_0_a_r, ym3438_control_port_0_a_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym3438_data_port_0_a_w)
- AM_RANGE(0x02, 0x02) AM_WRITE(ym3438_control_port_0_b_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ym3438_data_port_0_b_w)
- AM_RANGE(0x80, 0x80) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(SOUND, "ym", ym3438_r, ym3438_w)
+ AM_RANGE(0x80, 0x80) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -489,15 +486,15 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_3_r,
- input_port_2_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1], INPUT_LINE_NMI, linestate);
+ cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_NMI, linestate);
}
static const ym3438_interface ym3438_config =
diff --git a/src/mame/drivers/shanghai.c b/src/mame/drivers/shanghai.c
index 6b466570ca2..f1917543b29 100644
--- a/src/mame/drivers/shanghai.c
+++ b/src/mame/drivers/shanghai.c
@@ -136,8 +136,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( shanghai_portmap, ADDRESS_SPACE_IO, 16 )
AM_RANGE(0x00, 0x01) AM_READWRITE(HD63484_status_r, HD63484_address_w)
AM_RANGE(0x02, 0x03) AM_READWRITE(HD63484_data_r, HD63484_data_w)
- AM_RANGE(0x20, 0x21) AM_READWRITE(ym2203_status_port_0_lsb_r, ym2203_control_port_0_lsb_w)
- AM_RANGE(0x22, 0x23) AM_READWRITE(ym2203_read_port_0_lsb_r, ym2203_write_port_0_lsb_w)
+ AM_RANGE(0x20, 0x23) AM_DEVREADWRITE8(SOUND, "ym", ym2203_r, ym2203_w, 0x00ff)
AM_RANGE(0x40, 0x41) AM_READ_PORT("P1")
AM_RANGE(0x44, 0x45) AM_READ_PORT("P2")
AM_RANGE(0x48, 0x49) AM_READ_PORT("SYSTEM")
@@ -151,8 +150,7 @@ static ADDRESS_MAP_START( shangha2_portmap, ADDRESS_SPACE_IO, 16 )
AM_RANGE(0x20, 0x21) AM_READ_PORT("SYSTEM")
AM_RANGE(0x30, 0x31) AM_READWRITE(HD63484_status_r, HD63484_address_w)
AM_RANGE(0x32, 0x33) AM_READWRITE(HD63484_data_r, HD63484_data_w)
- AM_RANGE(0x40, 0x41) AM_READWRITE(ym2203_status_port_0_lsb_r, ym2203_control_port_0_lsb_w)
- AM_RANGE(0x42, 0x43) AM_READWRITE(ym2203_read_port_0_lsb_r, ym2203_write_port_0_lsb_w)
+ AM_RANGE(0x40, 0x43) AM_DEVREADWRITE8(SOUND, "ym", ym2203_r, ym2203_w, 0x00ff)
AM_RANGE(0x50, 0x51) AM_WRITE(shanghai_coin_w)
ADDRESS_MAP_END
@@ -402,10 +400,10 @@ static const ym2203_interface sh_ym2203_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_3_r,
- input_port_4_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_NULL,
+ DEVCB_NULL
},
NULL
};
@@ -416,8 +414,8 @@ static const ym2203_interface kothello_ym2203_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_4_r,
- NULL, NULL, NULL
+ DEVCB_INPUT_PORT("DSW"),
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
seibu_ym2203_irqhandler
};
diff --git a/src/mame/drivers/shangkid.c b/src/mame/drivers/shangkid.c
index 4c7d76ccfa7..7524eb8f3fb 100644
--- a/src/mame/drivers/shangkid.c
+++ b/src/mame/drivers/shangkid.c
@@ -67,7 +67,6 @@ VIDEO_UPDATE( dynamski );
/***************************************************************************************/
static UINT8 bbx_sound_enable;
-static UINT8 bbx_AY8910_control;
static UINT8 sound_latch;
/***************************************************************************************/
@@ -99,58 +98,31 @@ static WRITE8_HANDLER( shangkid_sound_enable_w )
bbx_sound_enable = data;
}
-static WRITE8_HANDLER( shangkid_bbx_AY8910_control_w )
+static WRITE8_DEVICE_HANDLER( chinhero_ay8910_porta_w )
{
- bbx_AY8910_control = data;
- ay8910_control_port_0_w( space, offset, data );
+ if( bbx_sound_enable )
+ {
+ if( data == 0x01 )
+ /* 0->1 transition triggers interrupt on Sound CPU */
+ cpu_set_input_line(device->machine->cpu[2], 0, HOLD_LINE );
+ }
}
-static WRITE8_HANDLER( chinhero_bbx_AY8910_write_w )
+static WRITE8_DEVICE_HANDLER( shangkid_ay8910_porta_w )
{
- switch( bbx_AY8910_control )
+ if( bbx_sound_enable )
{
- case 0x0e:
- if( bbx_sound_enable )
- {
- if( data == 0x01 )
- /* 0->1 transition triggers interrupt on Sound CPU */
- cpu_set_input_line(space->machine->cpu[2], 0, HOLD_LINE );
- }
- break;
-
- case 0x0f:
- sound_latch = data;
- break;
-
- default:
- ay8910_write_port_0_w( space, offset, data );
- break;
+ if( data == 0x01 )
+ /* 0->1 transition triggers interrupt on Sound CPU */
+ cpu_set_input_line(device->machine->cpu[2], 0, HOLD_LINE );
}
+ else
+ memory_set_bank(device->machine, 2, data ? 0 : 1);
}
-static WRITE8_HANDLER( shangkid_bbx_AY8910_write_w )
+static WRITE8_DEVICE_HANDLER( ay8910_portb_w )
{
- switch( bbx_AY8910_control )
- {
- case 0x0e:
- if( bbx_sound_enable )
- {
- if( data == 0x01 )
- /* 0->1 transition triggers interrupt on Sound CPU */
- cpu_set_input_line(space->machine->cpu[2], 0, HOLD_LINE );
- }
- else
- memory_set_bank(space->machine, 2, data ? 0 : 1);
- break;
-
- case 0x0f:
- sound_latch = data;
- break;
-
- default:
- ay8910_write_port_0_w( space, offset, data );
- break;
- }
+ sound_latch = data;
}
/***************************************************************************************/
@@ -352,14 +324,12 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( chinhero_bbx_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(shangkid_bbx_AY8910_control_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(chinhero_bbx_AY8910_write_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( shangkid_bbx_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(shangkid_bbx_AY8910_control_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(shangkid_bbx_AY8910_write_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
ADDRESS_MAP_END
/***************************************************************************************/
@@ -376,11 +346,33 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(shangkid_soundlatch_r, dac_0_data_w)
+ AM_RANGE(0x00, 0x00) AM_READ(shangkid_soundlatch_r) AM_DEVWRITE(SOUND, "dac", dac_w)
ADDRESS_MAP_END
/***************************************************************************************/
+static const ay8910_interface chinhero_ay8910_interface =
+{
+ AY8910_LEGACY_OUTPUT,
+ AY8910_DEFAULT_LOADS,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(chinhero_ay8910_porta_w),
+ DEVCB_HANDLER(ay8910_portb_w)
+};
+
+
+static const ay8910_interface shangkid_ay8910_interface =
+{
+ AY8910_LEGACY_OUTPUT,
+ AY8910_DEFAULT_LOADS,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(shangkid_ay8910_porta_w),
+ DEVCB_HANDLER(ay8910_portb_w)
+};
+
+
static MACHINE_DRIVER_START( chinhero )
/* basic machine hardware */
@@ -423,6 +415,7 @@ static MACHINE_DRIVER_START( chinhero )
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MDRV_SOUND_ADD("ay", AY8910, XTAL_18_432MHz/12) /* verified on pcb */
+ MDRV_SOUND_CONFIG(chinhero_ay8910_interface)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
MACHINE_DRIVER_END
@@ -445,6 +438,9 @@ static MACHINE_DRIVER_START( shangkid )
/* video hardware */
MDRV_GFXDECODE(shangkid)
+
+ MDRV_SOUND_MODIFY("ay")
+ MDRV_SOUND_CONFIG(shangkid_ay8910_interface)
MACHINE_DRIVER_END
@@ -467,8 +463,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( dynamski_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
/* ports are reversed */
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
ADDRESS_MAP_END
static MACHINE_DRIVER_START( dynamski )
diff --git a/src/mame/drivers/shaolins.c b/src/mame/drivers/shaolins.c
index 747c0d6327c..7dc3426eece 100644
--- a/src/mame/drivers/shaolins.c
+++ b/src/mame/drivers/shaolins.c
@@ -54,8 +54,8 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0000) AM_WRITE(shaolins_nmi_w) /* bit 0 = flip screen, bit 1 = nmi enable, bit 2 = ? */
/* bit 3, bit 4 = coin counters */
AM_RANGE(0x0100, 0x0100) AM_WRITE(watchdog_reset_w)
- AM_RANGE(0x0300, 0x0300) AM_WRITE(sn76496_0_w) /* trigger chip to read from latch. The program always */
- AM_RANGE(0x0400, 0x0400) AM_WRITE(sn76496_1_w) /* writes the same number as the latch, so we don't */
+ AM_RANGE(0x0300, 0x0300) AM_DEVWRITE(SOUND, "sn1", sn76496_w) /* trigger chip to read from latch. The program always */
+ AM_RANGE(0x0400, 0x0400) AM_DEVWRITE(SOUND, "sn2", sn76496_w) /* writes the same number as the latch, so we don't */
/* bother emulating them. */
AM_RANGE(0x0800, 0x0800) AM_WRITE(SMH_NOP) /* latch for 76496 #0 */
AM_RANGE(0x1000, 0x1000) AM_WRITE(SMH_NOP) /* latch for 76496 #1 */
diff --git a/src/mame/drivers/shisen.c b/src/mame/drivers/shisen.c
index aac7701fad2..e0899e2430a 100644
--- a/src/mame/drivers/shisen.c
+++ b/src/mame/drivers/shisen.c
@@ -83,11 +83,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x80, 0x80) AM_READ(soundlatch_r)
AM_RANGE(0x80, 0x81) AM_WRITE(shisen_sample_addr_w)
- AM_RANGE(0x82, 0x82) AM_WRITE(m72_sample_w)
+ AM_RANGE(0x82, 0x82) AM_DEVWRITE(SOUND, "dac", m72_sample_w)
AM_RANGE(0x83, 0x83) AM_WRITE(m72_sound_irq_ack_w)
AM_RANGE(0x84, 0x84) AM_READ(m72_sample_r)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/shootout.c b/src/mame/drivers/shootout.c
index c42124173eb..e8eff497ba4 100644
--- a/src/mame/drivers/shootout.c
+++ b/src/mame/drivers/shootout.c
@@ -108,7 +108,7 @@ static ADDRESS_MAP_START( readmem_alt, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1002, 0x1002) AM_READ_PORT("P2")
AM_RANGE(0x1003, 0x1003) AM_READ_PORT("DSW2")
AM_RANGE(0x2000, 0x21ff) AM_READ(SMH_RAM)
- AM_RANGE(0x2800, 0x2800) AM_READ(ym2203_status_port_0_r)
+ AM_RANGE(0x2800, 0x2801) AM_DEVREAD(SOUND, "ym", ym2203_r)
AM_RANGE(0x3000, 0x37ff) AM_READ(SMH_RAM) /* foreground */
AM_RANGE(0x3800, 0x3fff) AM_READ(SMH_RAM) /* background */
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1)
@@ -119,8 +119,7 @@ static ADDRESS_MAP_START( writemem_alt, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_WRITE(SMH_RAM)
AM_RANGE(0x1800, 0x1800) AM_WRITE(shootout_coin_counter_w)
AM_RANGE(0x2000, 0x21ff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
- AM_RANGE(0x2800, 0x2800) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x2801, 0x2801) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0x2800, 0x2801) AM_DEVWRITE(SOUND, "ym", ym2203_w)
AM_RANGE(0x3000, 0x37ff) AM_WRITE(shootout_textram_w) AM_BASE(&shootout_textram)
AM_RANGE(0x3800, 0x3fff) AM_WRITE(shootout_videoram_w) AM_BASE(&videoram)
AM_RANGE(0x4000, 0xffff) AM_WRITE(SMH_ROM)
@@ -130,15 +129,14 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_READ(SMH_RAM)
- AM_RANGE(0x4000, 0x4000) AM_READ(ym2203_status_port_0_r)
+ AM_RANGE(0x4000, 0x4001) AM_DEVREAD(SOUND, "ym", ym2203_r)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
AM_RANGE(0xc000, 0xffff) AM_READ(SMH_ROM)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x4000, 0x4000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x4001, 0x4001) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0x4000, 0x4001) AM_DEVWRITE(SOUND, "ym", ym2203_w)
AM_RANGE(0xd000, 0xd000) AM_WRITE(interrupt_enable_w)
AM_RANGE(0xc000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
@@ -262,14 +260,14 @@ static GFXDECODE_START( shootout )
GFXDECODE_ENTRY( "gfx3", 0, tile_layout, 0, 16 ) /* tiles */
GFXDECODE_END
-static void shootout_snd_irq(running_machine *machine, int linestate)
+static void shootout_snd_irq(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1],0,linestate);
+ cpu_set_input_line(device->machine->cpu[1],0,linestate);
}
-static void shootout_snd2_irq(running_machine *machine, int linestate)
+static void shootout_snd2_irq(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[0],0,linestate);
+ cpu_set_input_line(device->machine->cpu[0],0,linestate);
}
static const ym2203_interface ym2203_config =
@@ -277,7 +275,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
shootout_snd_irq
};
@@ -287,10 +285,10 @@ static const ym2203_interface ym2203_interface2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- shootout_bankswitch_w,
- shootout_flipscreen_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_MEMORY_HANDLER("main", PROGRAM, shootout_bankswitch_w),
+ DEVCB_MEMORY_HANDLER("main", PROGRAM, shootout_flipscreen_w)
},
shootout_snd2_irq
};
diff --git a/src/mame/drivers/shougi.c b/src/mame/drivers/shougi.c
index 638dae50ad1..5a4b71711cb 100644
--- a/src/mame/drivers/shougi.c
+++ b/src/mame/drivers/shougi.c
@@ -278,8 +278,8 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x5000, 0x5000) AM_READ_PORT("P1")
AM_RANGE(0x5800, 0x5800) AM_READ_PORT("P2") AM_WRITE(shougi_watchdog_reset_w) /* game won't boot if watchdog doesn't work */
- AM_RANGE(0x6000, 0x6000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x6800, 0x6800) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x6000, 0x6000) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
+ AM_RANGE(0x6800, 0x6800) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
AM_RANGE(0x7000, 0x73ff) AM_RAM AM_SHARE(1) /* 2114 x 2 (0x400 x 4bit each) */
AM_RANGE(0x7800, 0x7bff) AM_RAM AM_SHARE(2) /* 2114 x 2 (0x400 x 4bit each) */
diff --git a/src/mame/drivers/shuuz.c b/src/mame/drivers/shuuz.c
index f44895cdf32..c3742c611d8 100644
--- a/src/mame/drivers/shuuz.c
+++ b/src/mame/drivers/shuuz.c
@@ -107,26 +107,6 @@ static READ16_HANDLER( leta_r )
/*************************************
*
- * MSM5295 I/O
- *
- *************************************/
-
-static READ16_HANDLER( adpcm_r )
-{
- return okim6295_status_0_r(space, offset) | 0xff00;
-}
-
-
-static WRITE16_HANDLER( adpcm_w )
-{
- if (ACCESSING_BITS_0_7)
- okim6295_data_0_w(space, offset, data & 0xff);
-}
-
-
-
-/*************************************
- *
* Additional I/O
*
*************************************/
@@ -157,7 +137,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x103000, 0x103003) AM_READ(leta_r)
AM_RANGE(0x105000, 0x105001) AM_READWRITE(special_port0_r, latch_w)
AM_RANGE(0x105002, 0x105003) AM_READ_PORT("BUTTONS")
- AM_RANGE(0x106000, 0x106001) AM_READWRITE(adpcm_r, adpcm_w)
+ AM_RANGE(0x106000, 0x106001) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x107000, 0x107007) AM_NOP
AM_RANGE(0x3e0000, 0x3e087f) AM_RAM_WRITE(atarigen_666_paletteram_w) AM_BASE(&paletteram16)
AM_RANGE(0x3effc0, 0x3effff) AM_READWRITE(shuuz_atarivc_r, shuuz_atarivc_w) AM_BASE(&atarivc_data)
diff --git a/src/mame/drivers/sidearms.c b/src/mame/drivers/sidearms.c
index 599d0c534cc..d332514e91d 100644
--- a/src/mame/drivers/sidearms.c
+++ b/src/mame/drivers/sidearms.c
@@ -149,17 +149,15 @@ static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0xc000, 0xc7ff) AM_READ(SMH_RAM)
AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_r)
- AM_RANGE(0xf000, 0xf000) AM_READ(ym2203_status_port_0_r)
- AM_RANGE(0xf002, 0xf002) AM_READ(ym2203_status_port_1_r)
+ AM_RANGE(0xf000, 0xf001) AM_DEVREAD(SOUND, "ym1", ym2203_r)
+ AM_RANGE(0xf002, 0xf003) AM_DEVREAD(SOUND, "ym2", ym2203_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xc7ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xf000, 0xf000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xf001, 0xf001) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0xf002, 0xf002) AM_WRITE(ym2203_control_port_1_w)
- AM_RANGE(0xf003, 0xf003) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0xf000, 0xf001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0xf002, 0xf003) AM_DEVWRITE(SOUND, "ym2", ym2203_w)
ADDRESS_MAP_END
/* Whizz */
@@ -229,8 +227,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( whizz_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x40, 0x40) AM_WRITE(SMH_NOP)
AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -692,9 +689,9 @@ static GFXDECODE_START( turtship )
GFXDECODE_END
/* handler called by the 2203 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface ym2203_config =
@@ -702,7 +699,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL,
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,
},
irqhandler
};
diff --git a/src/mame/drivers/sidepckt.c b/src/mame/drivers/sidepckt.c
index c0ae386587d..7d5d35fb596 100644
--- a/src/mame/drivers/sidepckt.c
+++ b/src/mame/drivers/sidepckt.c
@@ -17,7 +17,7 @@ i8751 protection simluation and other fixes by Bryan McPhail, 15/10/00.
#include "cpu/m6809/m6809.h"
#include "cpu/m6502/m6502.h"
#include "sound/2203intf.h"
-#include "sound/3812intf.h"
+#include "sound/3526intf.h"
/* from video */
PALETTE_INIT( sidepckt );
@@ -168,10 +168,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x1000, 0x1000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x1001, 0x1001) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0x2000, 0x2000) AM_WRITE(ym3526_control_port_0_w)
- AM_RANGE(0x2001, 0x2001) AM_WRITE(ym3526_write_port_0_w)
+ AM_RANGE(0x1000, 0x1001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x2000, 0x2001) AM_DEVWRITE(SOUND, "ym2", ym3526_w)
AM_RANGE(0x8000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
@@ -277,9 +275,9 @@ GFXDECODE_END
/* handler called by the 3526 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1],0,linestate);
+ cpu_set_input_line(device->machine->cpu[1],0,linestate);
}
static const ym3526_interface ym3526_config =
diff --git a/src/mame/drivers/silkroad.c b/src/mame/drivers/silkroad.c
index 0597143cb36..76d17fb1d6c 100644
--- a/src/mame/drivers/silkroad.c
+++ b/src/mame/drivers/silkroad.c
@@ -140,62 +140,13 @@ static WRITE32_HANDLER( paletteram32_xRRRRRGGGGGBBBBB_dword_w )
palette_set_color_rgb(space->machine,offset,pal5bit(paletteram32[offset] >> (10+16)),pal5bit(paletteram32[offset] >> (5+16)),pal5bit(paletteram32[offset] >> (0+16)));
}
-/* sound I/O */
-
-static READ32_HANDLER(silk_6295_0_r)
-{
- return okim6295_status_0_r(space, 0)<<16;
-}
-
-static WRITE32_HANDLER(silk_6295_0_w)
-{
- if (ACCESSING_BITS_16_23)
- {
- okim6295_data_0_w(space, 0, (data>>16) & 0xff);
- }
-}
-
-static READ32_HANDLER(silk_6295_1_r)
-{
- return okim6295_status_1_r(space, 0)<<16;
-}
-
-static WRITE32_HANDLER(silk_6295_1_w)
-{
- if (ACCESSING_BITS_16_23)
- {
- okim6295_data_1_w(space, 0, (data>>16) & 0xff);
- }
-}
-
-static READ32_HANDLER(silk_ym_r)
-{
- return ym2151_status_port_0_r(space, 0)<<16;
-}
-
-static WRITE32_HANDLER(silk_ym_regport_w)
-{
- if (ACCESSING_BITS_16_23)
- {
- ym2151_register_port_0_w(space, 0, (data>>16) & 0xff);
- }
-}
-
-static WRITE32_HANDLER(silk_ym_dataport_w)
-{
- if (ACCESSING_BITS_16_23)
- {
- ym2151_data_port_0_w(space, 0, (data>>16) & 0xff);
- }
-}
-
-static WRITE32_HANDLER(silk_6295_0_bank_w)
+static WRITE32_DEVICE_HANDLER(silk_6295_bank_w)
{
if (ACCESSING_BITS_24_31)
{
int bank = (data & 0x3000000) >> 24;
if(bank < 3)
- okim6295_set_bank_base(0, 0x40000 * (bank));
+ okim6295_set_bank_base(device, 0x40000 * (bank));
}
}
@@ -217,11 +168,10 @@ static ADDRESS_MAP_START( cpu_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x808000, 0x80bfff) AM_RAM_WRITE(silkroad_fgram3_w) AM_BASE(&silkroad_vidram3) // higher layer
AM_RANGE(0xc00000, 0xc00003) AM_READ_PORT("INPUTS")
AM_RANGE(0xc00004, 0xc00007) AM_READ_PORT("DSW")
- AM_RANGE(0xc00024, 0xc00027) AM_READWRITE(silk_6295_0_r, silk_6295_0_w)
- AM_RANGE(0xc00028, 0xc0002b) AM_WRITE(silk_ym_regport_w)
- AM_RANGE(0xc0002c, 0xc0002f) AM_READWRITE(silk_ym_r, silk_ym_dataport_w)
- AM_RANGE(0xc00030, 0xc00033) AM_READWRITE(silk_6295_1_r, silk_6295_1_w)
- AM_RANGE(0xc00034, 0xc00037) AM_WRITE(silk_6295_0_bank_w)
+ AM_RANGE(0xC00024, 0xC00027) AM_DEVREAD8(SOUND, "oki1", okim6295_r, 0x00ff0000)
+ AM_RANGE(0xC00028, 0xC0002f) AM_DEVREAD8(SOUND, "ym", ym2151_r, 0x00ff0000)
+ AM_RANGE(0xC00030, 0xC00033) AM_DEVREAD8(SOUND, "oki2", okim6295_r, 0x00ff0000)
+ AM_RANGE(0xc00034, 0xc00037) AM_DEVWRITE(SOUND, "oki1", silk_6295_bank_w)
AM_RANGE(0xc00038, 0xc0003b) AM_WRITE(silk_coin_counter_w)
AM_RANGE(0xc0010c, 0xc00123) AM_WRITE(SMH_RAM) AM_BASE(&silkroad_regs)
AM_RANGE(0xfe0000, 0xffffff) AM_RAM
diff --git a/src/mame/drivers/simpl156.c b/src/mame/drivers/simpl156.c
index 5816b24066b..3d97a8c6047 100644
--- a/src/mame/drivers/simpl156.c
+++ b/src/mame/drivers/simpl156.c
@@ -180,7 +180,7 @@ static WRITE32_HANDLER( simpl156_eeprom_w )
okibank = data & 0x07;
- okim6295_set_bank_base(1, 0x40000 * (data & 0x7) );
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "okimusic"), 0x40000 * (data & 0x7) );
eeprom_set_clock_line((data & 0x20) ? ASSERT_LINE : CLEAR_LINE);
eeprom_write_bit(data & 0x10);
@@ -188,26 +188,6 @@ static WRITE32_HANDLER( simpl156_eeprom_w )
}
-static READ32_HANDLER( oki_r )
-{
- return okim6295_status_0_r(space, 0);
-}
-
-static WRITE32_HANDLER( oki_w )
-{
- okim6295_data_0_w(space, 0, data & 0xff);
-}
-
-static READ32_HANDLER( oki2_r )
-{
- return okim6295_status_1_r(space, 0);
-}
-
-static WRITE32_HANDLER( oki2_w )
-{
- okim6295_data_1_w(space, 0, data & 0xff);
-}
-
/* we need to throw away bits for all ram accesses as the devices are connected as 16-bit */
static READ32_HANDLER( simpl156_spriteram_r )
@@ -321,8 +301,8 @@ static ADDRESS_MAP_START( joemacr_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x160000, 0x161fff) AM_READWRITE(simpl156_pf1_rowscroll_r, simpl156_pf1_rowscroll_w)
AM_RANGE(0x164000, 0x165fff) AM_READWRITE(simpl156_pf2_rowscroll_r, simpl156_pf2_rowscroll_w)
AM_RANGE(0x170000, 0x170003) AM_RAM_WRITE(SMH_NOP) // ?
- AM_RANGE(0x180000, 0x180003) AM_READWRITE(oki_r,oki_w)
- AM_RANGE(0x1c0000, 0x1c0003) AM_READWRITE(oki2_r,oki2_w)
+ AM_RANGE(0x180000, 0x180003) AM_DEVREADWRITE8(SOUND, "okisfx", okim6295_r, okim6295_w, 0x000000ff)
+ AM_RANGE(0x1c0000, 0x1c0003) AM_DEVREADWRITE8(SOUND, "okimusic", okim6295_r, okim6295_w, 0x000000ff)
AM_RANGE(0x200000, 0x200003) AM_READ(simpl156_inputs_read)
AM_RANGE(0x201000, 0x201fff) AM_RAM AM_BASE(&simpl156_systemram) // work ram (32-bit)
ADDRESS_MAP_END
@@ -333,7 +313,7 @@ static ADDRESS_MAP_START( chainrec_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x000000, 0x07ffff) AM_ROM // rom (32-bit)
AM_RANGE(0x200000, 0x200003) AM_READ(simpl156_inputs_read)
AM_RANGE(0x201000, 0x201fff) AM_RAM AM_BASE(&simpl156_systemram) // work ram (32-bit)
- AM_RANGE(0x3c0000, 0x3c0003) AM_READWRITE(oki2_r,oki2_w)
+ AM_RANGE(0x3c0000, 0x3c0003) AM_DEVREADWRITE8(SOUND, "okimusic", okim6295_r, okim6295_w, 0x000000ff)
AM_RANGE(0x400000, 0x407fff) AM_READWRITE(simpl156_mainram_r, simpl156_mainram_w) AM_BASE(&simpl156_mainram) // main ram?
AM_RANGE(0x410000, 0x411fff) AM_READWRITE(simpl156_spriteram_r, simpl156_spriteram_w) AM_BASE(&spriteram32) AM_SIZE(&spriteram_size)
AM_RANGE(0x420000, 0x420fff) AM_READWRITE(simpl156_palette_r,simpl156_palette_w)
@@ -345,7 +325,7 @@ static ADDRESS_MAP_START( chainrec_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x460000, 0x461fff) AM_READWRITE(simpl156_pf1_rowscroll_r, simpl156_pf1_rowscroll_w)
AM_RANGE(0x464000, 0x465fff) AM_READWRITE(simpl156_pf2_rowscroll_r, simpl156_pf2_rowscroll_w)
AM_RANGE(0x470000, 0x470003) AM_RAM_WRITE(SMH_NOP) // ??
- AM_RANGE(0x480000, 0x480003) AM_READWRITE(oki_r,oki_w)
+ AM_RANGE(0x480000, 0x480003) AM_DEVREADWRITE8(SOUND, "okisfx", okim6295_r, okim6295_w, 0x000000ff)
ADDRESS_MAP_END
@@ -354,7 +334,7 @@ static ADDRESS_MAP_START( magdrop_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x000000, 0x07ffff) AM_ROM
AM_RANGE(0x200000, 0x200003) AM_READ(simpl156_inputs_read)
AM_RANGE(0x201000, 0x201fff) AM_RAM AM_BASE(&simpl156_systemram) // work ram (32-bit)
- AM_RANGE(0x340000, 0x340003) AM_READWRITE(oki2_r,oki2_w)
+ AM_RANGE(0x340000, 0x340003) AM_DEVREADWRITE8(SOUND, "okimusic", okim6295_r, okim6295_w, 0x000000ff)
AM_RANGE(0x380000, 0x387fff) AM_READWRITE(simpl156_mainram_r, simpl156_mainram_w) AM_BASE(&simpl156_mainram) // main ram?
AM_RANGE(0x390000, 0x391fff) AM_READWRITE(simpl156_spriteram_r, simpl156_spriteram_w) AM_BASE(&spriteram32) AM_SIZE(&spriteram_size)
AM_RANGE(0x3a0000, 0x3a0fff) AM_READWRITE(simpl156_palette_r,simpl156_palette_w)
@@ -366,7 +346,7 @@ static ADDRESS_MAP_START( magdrop_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x3e0000, 0x3e1fff) AM_READWRITE(simpl156_pf1_rowscroll_r, simpl156_pf1_rowscroll_w)
AM_RANGE(0x3e4000, 0x3e5fff) AM_READWRITE(simpl156_pf2_rowscroll_r, simpl156_pf2_rowscroll_w)
AM_RANGE(0x3f0000, 0x3f0003) AM_RAM_WRITE(SMH_NOP) //?
- AM_RANGE(0x400000, 0x400003) AM_READWRITE(oki_r,oki_w)
+ AM_RANGE(0x400000, 0x400003) AM_DEVREADWRITE8(SOUND, "okisfx", okim6295_r, okim6295_w, 0x000000ff)
ADDRESS_MAP_END
@@ -375,7 +355,7 @@ static ADDRESS_MAP_START( magdropp_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x000000, 0x07ffff) AM_ROM
AM_RANGE(0x200000, 0x200003) AM_READ(simpl156_inputs_read)
AM_RANGE(0x201000, 0x201fff) AM_RAM AM_BASE(&simpl156_systemram) // work ram (32-bit)
- AM_RANGE(0x4c0000, 0x4c0003) AM_READWRITE(oki2_r,oki2_w)
+ AM_RANGE(0x4c0000, 0x4c0003) AM_DEVREADWRITE8(SOUND, "okimusic", okim6295_r, okim6295_w, 0x000000ff)
AM_RANGE(0x680000, 0x687fff) AM_READWRITE(simpl156_mainram_r, simpl156_mainram_w) AM_BASE(&simpl156_mainram) // main ram?
AM_RANGE(0x690000, 0x691fff) AM_READWRITE(simpl156_spriteram_r, simpl156_spriteram_w) AM_BASE(&spriteram32) AM_SIZE(&spriteram_size)
AM_RANGE(0x6a0000, 0x6a0fff) AM_READWRITE(simpl156_palette_r,simpl156_palette_w)
@@ -387,15 +367,15 @@ static ADDRESS_MAP_START( magdropp_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x6e0000, 0x6e1fff) AM_READWRITE(simpl156_pf1_rowscroll_r, simpl156_pf1_rowscroll_w)
AM_RANGE(0x6e4000, 0x6e5fff) AM_READWRITE(simpl156_pf2_rowscroll_r, simpl156_pf2_rowscroll_w)
AM_RANGE(0x6f0000, 0x6f0003) AM_RAM_WRITE(SMH_NOP) // ?
- AM_RANGE(0x780000, 0x780003) AM_READWRITE(oki_r,oki_w)
+ AM_RANGE(0x780000, 0x780003) AM_DEVREADWRITE8(SOUND, "okisfx", okim6295_r, okim6295_w, 0x000000ff)
ADDRESS_MAP_END
/* Mitchell MT5601-0 PCB (prtytime, charlien, osman) */
static ADDRESS_MAP_START( mitchell156_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x000000, 0x07ffff) AM_ROM
- AM_RANGE(0x100000, 0x100003) AM_READWRITE(oki_r,oki_w)
- AM_RANGE(0x140000, 0x140003) AM_READWRITE(oki2_r,oki2_w)
+ AM_RANGE(0x100000, 0x100003) AM_DEVREADWRITE8(SOUND, "okisfx", okim6295_r, okim6295_w, 0x000000ff)
+ AM_RANGE(0x140000, 0x140003) AM_DEVREADWRITE8(SOUND, "okimusic", okim6295_r, okim6295_w, 0x000000ff)
AM_RANGE(0x180000, 0x187fff) AM_READWRITE(simpl156_mainram_r, simpl156_mainram_w) AM_BASE(&simpl156_mainram) // main ram
AM_RANGE(0x190000, 0x191fff) AM_READWRITE(simpl156_spriteram_r, simpl156_spriteram_w) AM_BASE(&spriteram32) AM_SIZE(&spriteram_size)
AM_RANGE(0x1a0000, 0x1a0fff) AM_READWRITE(simpl156_palette_r,simpl156_palette_w)
diff --git a/src/mame/drivers/simpsons.c b/src/mame/drivers/simpsons.c
index 99a7e3e299c..2b60e8acfce 100644
--- a/src/mame/drivers/simpsons.c
+++ b/src/mame/drivers/simpsons.c
@@ -94,7 +94,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1fc0, 0x1fc0) AM_WRITE(simpsons_coin_counter_w)
AM_RANGE(0x1fc2, 0x1fc2) AM_WRITE(simpsons_eeprom_w)
AM_RANGE(0x1fc4, 0x1fc4) AM_READ(simpsons_sound_interrupt_r)
- AM_RANGE(0x1fc6, 0x1fc7) AM_READWRITE(simpsons_sound_r, k053260_0_w)
+ AM_RANGE(0x1fc6, 0x1fc7) AM_DEVREADWRITE(SOUND, "konami", simpsons_sound_r, k053260_w)
AM_RANGE(0x1fc8, 0x1fc9) AM_READ(K053246_r)
AM_RANGE(0x1fca, 0x1fca) AM_READ(watchdog_reset_r)
AM_RANGE(0x2000, 0x3fff) AM_RAMBANK(4)
@@ -136,10 +136,9 @@ static ADDRESS_MAP_START( z80_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(2)
AM_RANGE(0xf000, 0xf7ff) AM_RAM
- AM_RANGE(0xf800, 0xf800) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xf801, 0xf801) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0xf800, 0xf801) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0xfa00, 0xfa00) AM_WRITE(z80_arm_nmi_w)
- AM_RANGE(0xfc00, 0xfc2f) AM_READWRITE(k053260_0_r, k053260_0_w)
+ AM_RANGE(0xfc00, 0xfc2f) AM_DEVREADWRITE(SOUND, "konami", k053260_r, k053260_w)
AM_RANGE(0xfe00, 0xfe00) AM_WRITE(z80_bankswitch_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/skyarmy.c b/src/mame/drivers/skyarmy.c
index 3024e5b9355..7147dd47be2 100644
--- a/src/mame/drivers/skyarmy.c
+++ b/src/mame/drivers/skyarmy.c
@@ -252,9 +252,8 @@ GFXDECODE_END
static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x04, 0x04) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x05, 0x05) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x06, 0x06) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0x04, 0x05) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0x06, 0x06) AM_DEVREAD(SOUND, "ay", ay8910_r)
ADDRESS_MAP_END
static MACHINE_DRIVER_START( skyarmy )
diff --git a/src/mame/drivers/skydiver.c b/src/mame/drivers/skydiver.c
index b028e068cf4..0a4ab1259e9 100644
--- a/src/mame/drivers/skydiver.c
+++ b/src/mame/drivers/skydiver.c
@@ -147,14 +147,14 @@ static WRITE8_HANDLER( skydiver_nmion_w )
static INTERRUPT_GEN( skydiver_interrupt )
{
- const address_space *space = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
+ const device_config *discrete = devtag_get_device(device->machine, SOUND, "discrete");
/* Convert range data to divide value and write to sound */
- discrete_sound_w(space, SKYDIVER_RANGE_DATA, (0x01 << (~skydiver_videoram[0x394] & 0x07)) & 0xff); // Range 0-2
+ discrete_sound_w(discrete, SKYDIVER_RANGE_DATA, (0x01 << (~skydiver_videoram[0x394] & 0x07)) & 0xff); // Range 0-2
- discrete_sound_w(space, SKYDIVER_RANGE3_EN, skydiver_videoram[0x394] & 0x08); // Range 3 - note disable
- discrete_sound_w(space, SKYDIVER_NOTE_DATA, ~skydiver_videoram[0x395] & 0xff); // Note - freq
- discrete_sound_w(space, SKYDIVER_NOISE_DATA, skydiver_videoram[0x396] & 0x0f); // NAM - Noise Amplitude
+ discrete_sound_w(discrete, SKYDIVER_RANGE3_EN, skydiver_videoram[0x394] & 0x08); // Range 3 - note disable
+ discrete_sound_w(discrete, SKYDIVER_NOTE_DATA, ~skydiver_videoram[0x395] & 0xff); // Note - freq
+ discrete_sound_w(discrete, SKYDIVER_NOISE_DATA, skydiver_videoram[0x396] & 0x0f); // NAM - Noise Amplitude
if (skydiver_nmion)
cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
@@ -168,14 +168,14 @@ static INTERRUPT_GEN( skydiver_interrupt )
*
*************************************/
-static WRITE8_HANDLER( skydiver_sound_enable_w )
+static WRITE8_DEVICE_HANDLER( skydiver_sound_enable_w )
{
- discrete_sound_w(space, SKYDIVER_SOUND_EN, offset);
+ discrete_sound_w(device, SKYDIVER_SOUND_EN, offset);
}
-static WRITE8_HANDLER( skydiver_whistle_w )
+static WRITE8_DEVICE_HANDLER( skydiver_whistle_w )
{
- discrete_sound_w(space, NODE_RELATIVE(SKYDIVER_WHISTLE1_EN, (offset >> 1)), offset & 0x01);
+ discrete_sound_w(device, NODE_RELATIVE(SKYDIVER_WHISTLE1_EN, (offset >> 1)), offset & 0x01);
}
@@ -197,11 +197,11 @@ static ADDRESS_MAP_START( skydiver_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0806, 0x0807) AM_MIRROR(0x47f0) AM_WRITE(skydiver_start_lamp_2_w)
AM_RANGE(0x0808, 0x0809) AM_MIRROR(0x47f0) AM_WRITE(skydiver_lamp_y_w)
AM_RANGE(0x080a, 0x080b) AM_MIRROR(0x47f0) AM_WRITE(skydiver_lamp_d_w)
- AM_RANGE(0x080c, 0x080d) AM_MIRROR(0x47f0) AM_WRITE(skydiver_sound_enable_w)
+ AM_RANGE(0x080c, 0x080d) AM_MIRROR(0x47f0) AM_DEVWRITE(SOUND, "discrete", skydiver_sound_enable_w)
// AM_RANGE(0x1000, 0x1001) AM_MIRROR(0x47f0) AM_WRITE(skydiver_jump1_lamps_w)
AM_RANGE(0x1002, 0x1003) AM_MIRROR(0x47f0) AM_WRITE(skydiver_coin_lockout_w)
// AM_RANGE(0x1006, 0x1007) AM_MIRROR(0x47f0) AM_WRITE(skydiver_jump2_lamps_w)
- AM_RANGE(0x1008, 0x100b) AM_MIRROR(0x47f0) AM_WRITE(skydiver_whistle_w)
+ AM_RANGE(0x1008, 0x100b) AM_MIRROR(0x47f0) AM_DEVWRITE(SOUND, "discrete", skydiver_whistle_w)
AM_RANGE(0x100c, 0x100d) AM_MIRROR(0x47f0) AM_WRITE(skydiver_nmion_w)
AM_RANGE(0x100e, 0x100f) AM_MIRROR(0x47f0) AM_WRITE(skydiver_width_w)
AM_RANGE(0x1800, 0x1800) AM_MIRROR(0x47e0) AM_READ_PORT("IN0")
diff --git a/src/mame/drivers/skyfox.c b/src/mame/drivers/skyfox.c
index 4a9096a38a8..a09146a4379 100644
--- a/src/mame/drivers/skyfox.c
+++ b/src/mame/drivers/skyfox.c
@@ -88,8 +88,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( skyfox_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM ) // RAM
- AM_RANGE(0xa001, 0xa001) AM_READ(ym2203_read_port_0_r ) // YM2203 #1
-// AM_RANGE(0xc001, 0xc001) AM_READ(ym2203_read_port_1_r ) // YM2203 #2
+ AM_RANGE(0xa000, 0xa001) AM_DEVREAD(SOUND, "ym1", ym2203_r) // YM2203 #1
+// AM_RANGE(0xc000, 0xc001) AM_DEVREAD(SOUND, "ym2", ym2203_r ) // YM2203 #2
AM_RANGE(0xb000, 0xb000) AM_READ(soundlatch_r ) // From Main CPU
ADDRESS_MAP_END
@@ -97,11 +97,9 @@ static ADDRESS_MAP_START( skyfox_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM ) // ROM
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM ) // RAM
// AM_RANGE(0x9000, 0x9001) AM_WRITE(SMH_NOP ) // ??
- AM_RANGE(0xa000, 0xa000) AM_WRITE(ym2203_control_port_0_w ) // YM2203 #1
- AM_RANGE(0xa001, 0xa001) AM_WRITE(ym2203_write_port_0_w ) //
+ AM_RANGE(0xa000, 0xa001) AM_DEVWRITE(SOUND, "ym1", ym2203_w ) //
// AM_RANGE(0xb000, 0xb001) AM_WRITE(SMH_NOP ) // ??
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym2203_control_port_1_w ) // YM2203 #2
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ym2203_write_port_1_w ) //
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ym2", ym2203_w ) //
ADDRESS_MAP_END
diff --git a/src/mame/drivers/skykid.c b/src/mame/drivers/skykid.c
index eef7390eded..54f81dbf6c3 100644
--- a/src/mame/drivers/skykid.c
+++ b/src/mame/drivers/skykid.c
@@ -121,7 +121,7 @@ static ADDRESS_MAP_START( skykid_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4800, 0x5fff) AM_RAM AM_BASE(&skykid_spriteram) /* RAM + Sprite RAM */
AM_RANGE(0x6000, 0x60ff) AM_WRITE(skykid_scroll_y_w) /* Y scroll register map */
AM_RANGE(0x6200, 0x63ff) AM_WRITE(skykid_scroll_x_w) /* X scroll register map */
- AM_RANGE(0x6800, 0x6bff) AM_READWRITE(namcos1_cus30_r,namcos1_cus30_w) AM_BASE(&namco_wavedata)/* PSG device, shared RAM */
+ AM_RANGE(0x6800, 0x6bff) AM_DEVREADWRITE(SOUND, "namco", namcos1_cus30_r,namcos1_cus30_w) AM_BASE(&namco_wavedata)/* PSG device, shared RAM */
AM_RANGE(0x7000, 0x7fff) AM_WRITE(skykid_irq_1_ctrl_w) /* IRQ control */
AM_RANGE(0x7800, 0x7fff) AM_READ(watchdog_reset_r) /* watchdog reset */
AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM) /* ROM */
@@ -133,7 +133,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( mcu_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x001f) AM_READWRITE(hd63701_internal_registers_r, hd63701_internal_registers_w)
AM_RANGE(0x0080, 0x00ff) AM_RAM
- AM_RANGE(0x1000, 0x13ff) AM_READWRITE(namcos1_cus30_r, namcos1_cus30_w) AM_BASE(&namco_wavedata) /* PSG device, shared RAM */
+ AM_RANGE(0x1000, 0x13ff) AM_DEVREADWRITE(SOUND, "namco", namcos1_cus30_r, namcos1_cus30_w) AM_BASE(&namco_wavedata) /* PSG device, shared RAM */
AM_RANGE(0x2000, 0x3fff) AM_WRITE(watchdog_reset_w) /* watchdog? */
AM_RANGE(0x4000, 0x7fff) AM_WRITE(skykid_irq_2_ctrl_w)
AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_ROM)
diff --git a/src/mame/drivers/skylncr.c b/src/mame/drivers/skylncr.c
index 2bddd274dd8..f286f0fe9c0 100644
--- a/src/mame/drivers/skylncr.c
+++ b/src/mame/drivers/skylncr.c
@@ -377,8 +377,8 @@ static ADDRESS_MAP_START( io_map_skylncr, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x20, 0x20) AM_WRITE( skylncr_coin_w )
- AM_RANGE(0x30, 0x30) AM_WRITE( ay8910_control_port_0_w )
- AM_RANGE(0x31, 0x31) AM_READWRITE( ay8910_read_port_0_r , ay8910_write_port_0_w )
+ AM_RANGE(0x30, 0x31) AM_DEVWRITE( SOUND, "ay", ay8910_address_data_w )
+ AM_RANGE(0x31, 0x31) AM_DEVREAD( SOUND, "ay", ay8910_r )
AM_RANGE(0x40, 0x41) AM_WRITE( skylncr_paletteram_w )
AM_RANGE(0x50, 0x51) AM_WRITE( skylncr_paletteram2_w )
@@ -638,10 +638,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_6_r,
- input_port_7_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW3"),
+ DEVCB_INPUT_PORT("DSW4"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/slapfght.c b/src/mame/drivers/slapfght.c
index e93768c5b84..ee7ff56b8d1 100644
--- a/src/mame/drivers/slapfght.c
+++ b/src/mame/drivers/slapfght.c
@@ -560,26 +560,26 @@ static ADDRESS_MAP_START( perfrman_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_READ(SMH_ROM)
AM_RANGE(0x8800, 0x880f) AM_READ(slapfight_dpram_r)
AM_RANGE(0x8810, 0x8fff) AM_READ(SMH_BANK1)
- AM_RANGE(0xa081, 0xa081) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0xa091, 0xa091) AM_READ(ay8910_read_port_1_r)
+ AM_RANGE(0xa081, 0xa081) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0xa091, 0xa091) AM_DEVREAD(SOUND, "ay2", ay8910_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( perfrman_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8800, 0x880f) AM_WRITE(slapfight_dpram_w)
AM_RANGE(0x8810, 0x8fff) AM_WRITE(SMH_BANK1) /* Shared RAM with main CPU */
- AM_RANGE(0xa080, 0xa080) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xa082, 0xa082) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xa090, 0xa090) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0xa092, 0xa092) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0xa080, 0xa080) AM_DEVWRITE(SOUND, "ay1", ay8910_address_w)
+ AM_RANGE(0xa082, 0xa082) AM_DEVWRITE(SOUND, "ay1", ay8910_data_w)
+ AM_RANGE(0xa090, 0xa090) AM_DEVWRITE(SOUND, "ay2", ay8910_address_w)
+ AM_RANGE(0xa092, 0xa092) AM_DEVWRITE(SOUND, "ay2", ay8910_data_w)
AM_RANGE(0xa0e0, 0xa0e0) AM_WRITE(getstar_sh_intenable_w) /* maybe a0f0 also -LE */
// AM_RANGE(0xa0f0, 0xa0f0) AM_WRITE(SMH_NOP)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_READ(SMH_ROM)
- AM_RANGE(0xa081, 0xa081) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0xa091, 0xa091) AM_READ(ay8910_read_port_1_r)
+ AM_RANGE(0xa081, 0xa081) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0xa091, 0xa091) AM_DEVREAD(SOUND, "ay2", ay8910_r)
AM_RANGE(0xc800, 0xc80f) AM_READ(slapfight_dpram_r)
AM_RANGE(0xc810, 0xcfff) AM_READ(SMH_RAM)
AM_RANGE(0xd000, 0xffff) AM_READ(SMH_RAM)
@@ -587,10 +587,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_WRITE(SMH_ROM)
- AM_RANGE(0xa080, 0xa080) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xa082, 0xa082) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xa090, 0xa090) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0xa092, 0xa092) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0xa080, 0xa080) AM_DEVWRITE(SOUND, "ay1", ay8910_address_w)
+ AM_RANGE(0xa082, 0xa082) AM_DEVWRITE(SOUND, "ay1", ay8910_data_w)
+ AM_RANGE(0xa090, 0xa090) AM_DEVWRITE(SOUND, "ay2", ay8910_address_w)
+ AM_RANGE(0xa092, 0xa092) AM_DEVWRITE(SOUND, "ay2", ay8910_data_w)
AM_RANGE(0xa0e0, 0xa0e0) AM_WRITE(getstar_sh_intenable_w) /* maybe a0f0 also -LE */
AM_RANGE(0xc800, 0xc80f) AM_WRITE(slapfight_dpram_w)
AM_RANGE(0xc810, 0xcfff) AM_WRITE(SMH_RAM)
@@ -899,20 +899,20 @@ static const ay8910_interface ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r,
- input_port_1_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("IN0"),
+ DEVCB_INPUT_PORT("IN1"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_2_r,
- input_port_3_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static VIDEO_EOF( perfrman )
diff --git a/src/mame/drivers/slapshot.c b/src/mame/drivers/slapshot.c
index ecda90462a9..a844b45340d 100644
--- a/src/mame/drivers/slapshot.c
+++ b/src/mame/drivers/slapshot.c
@@ -315,9 +315,7 @@ static ADDRESS_MAP_START( z80_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM)
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK10)
AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_READ(ym2610_status_port_0_a_r)
- AM_RANGE(0xe001, 0xe001) AM_READ(ym2610_read_port_0_r)
- AM_RANGE(0xe002, 0xe002) AM_READ(ym2610_status_port_0_b_r)
+ AM_RANGE(0xe000, 0xe003) AM_DEVREAD(SOUND, "ym", ym2610_r)
AM_RANGE(0xe200, 0xe200) AM_READ(SMH_NOP)
AM_RANGE(0xe201, 0xe201) AM_READ(taitosound_slave_comm_r)
AM_RANGE(0xea00, 0xea00) AM_READ(SMH_NOP)
@@ -326,10 +324,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( z80_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xdfff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ym2610_control_port_0_a_w)
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ym2610_data_port_0_a_w)
- AM_RANGE(0xe002, 0xe002) AM_WRITE(ym2610_control_port_0_b_w)
- AM_RANGE(0xe003, 0xe003) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0xe000, 0xe003) AM_DEVWRITE(SOUND, "ym", ym2610_w)
AM_RANGE(0xe200, 0xe200) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xe201, 0xe201) AM_WRITE(taitosound_slave_comm_w)
AM_RANGE(0xe400, 0xe403) AM_WRITE(SMH_NOP) /* pan */
@@ -511,9 +506,9 @@ GFXDECODE_END
**************************************************************/
/* handler called by the YM2610 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface ym2610_config =
diff --git a/src/mame/drivers/sliver.c b/src/mame/drivers/sliver.c
index 1b7e9de3ea5..b4bc1580b39 100644
--- a/src/mame/drivers/sliver.c
+++ b/src/mame/drivers/sliver.c
@@ -437,7 +437,7 @@ static ADDRESS_MAP_START( soundmem_prg, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END
static ADDRESS_MAP_START( soundmem_io, ADDRESS_SPACE_IO, 8 )
- AM_RANGE(0x0100, 0x0100) AM_READWRITE( okim6295_status_0_r, okim6295_data_0_w )
+ AM_RANGE(0x0100, 0x0100) AM_DEVREADWRITE( SOUND, "oki", okim6295_r, okim6295_w )
AM_RANGE(0x0101, 0x0101) AM_READ(soundlatch_r)
/* ports */
AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_WRITE( oki_setbank )
diff --git a/src/mame/drivers/slotcarn.c b/src/mame/drivers/slotcarn.c
index 96d875b93e1..7b4feb4abb0 100644
--- a/src/mame/drivers/slotcarn.c
+++ b/src/mame/drivers/slotcarn.c
@@ -172,8 +172,8 @@ static ADDRESS_MAP_START( slotcarn_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x7000, 0xafff) AM_ROM // spielbud
- AM_RANGE(0xb000, 0xb000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xb100, 0xb100) AM_READWRITE(ay8910_read_port_0_r,ay8910_write_port_0_w)
+ AM_RANGE(0xb000, 0xb000) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
+ AM_RANGE(0xb100, 0xb100) AM_DEVREADWRITE(SOUND, "ay", ay8910_r, ay8910_data_w)
AM_RANGE(0xb800, 0xb803) AM_DEVREADWRITE(PPI8255, "ppi8255_0", ppi8255_r, ppi8255_w) /* Input Ports */
AM_RANGE(0xba00, 0xba03) AM_DEVREADWRITE(PPI8255, "ppi8255_1", ppi8255_r, ppi8255_w) /* Input Ports */
@@ -194,8 +194,8 @@ ADDRESS_MAP_END
// spielbud - is the ay mirrored, or are there now 2?
static ADDRESS_MAP_START( spielbud_io_map, ADDRESS_SPACE_IO, 8 )
- AM_RANGE(0xb000, 0xb000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xb100, 0xb100) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0xb000, 0xb000) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
+ AM_RANGE(0xb100, 0xb100) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
ADDRESS_MAP_END
/********************************
@@ -578,10 +578,10 @@ static const ay8910_interface scarn_ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- input_port_6_r, /* DSW2 */
- NULL,
- NULL
+ DEVCB_NULL,
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/sms.c b/src/mame/drivers/sms.c
index 5bb0adeb8b7..bd452ccc0ae 100644
--- a/src/mame/drivers/sms.c
+++ b/src/mame/drivers/sms.c
@@ -502,8 +502,7 @@ static ADDRESS_MAP_START( sub_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_ROM
AM_RANGE(0x2000, 0x27ff) AM_RAM
AM_RANGE(0x3100, 0x3103) AM_DEVREADWRITE(PPI8255, "ppi8255_1", ppi8255_r, ppi8255_w)
- AM_RANGE(0x3381, 0x3381) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x3382, 0x3382) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x3381, 0x3382) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
AM_RANGE(0x3400, 0x3400) AM_READ(z80_8088_r)
AM_RANGE(0x3500, 0x3501) AM_READWRITE(p03_r, p03_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/snesb.c b/src/mame/drivers/snesb.c
index b8624127b1d..08717cc6d68 100644
--- a/src/mame/drivers/snesb.c
+++ b/src/mame/drivers/snesb.c
@@ -541,9 +541,6 @@ static INPUT_PORTS_START( sblast2b )
INPUT_PORTS_END
-static const custom_sound_interface snes_sound_interface =
-{ snes_sh_start };
-
static MACHINE_DRIVER_START( kinstb )
/* basic machine hardware */
MDRV_CPU_ADD("main", G65816, 3580000) /* 2.68Mhz, also 3.58Mhz */
@@ -569,8 +566,7 @@ static MACHINE_DRIVER_START( kinstb )
/* sound hardware */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("snes", CUSTOM, 0)
- MDRV_SOUND_CONFIG(snes_sound_interface)
+ MDRV_SOUND_ADD("snes", SNES, 0)
MDRV_SOUND_ROUTE(0, "left", 1.00)
MDRV_SOUND_ROUTE(1, "right", 1.00)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/snk.c b/src/mame/drivers/snk.c
index f7a2c743b42..ac1cf6eef04 100644
--- a/src/mame/drivers/snk.c
+++ b/src/mame/drivers/snk.c
@@ -262,7 +262,9 @@ TODO:
#include "snk.h"
#include "sound/snkwave.h"
#include "sound/ay8910.h"
+#include "sound/3526intf.h"
#include "sound/3812intf.h"
+#include "sound/8950intf.h"
static int countryc_trackball;
@@ -444,16 +446,16 @@ static TIMER_CALLBACK( sndirq_update_callback )
-static void ymirq_callback_1(running_machine *machine, int irq)
+static void ymirq_callback_1(const device_config *device, int irq)
{
if (irq)
- timer_call_after_resynch(machine, NULL, YM1IRQ_ASSERT, sndirq_update_callback);
+ timer_call_after_resynch(device->machine, NULL, YM1IRQ_ASSERT, sndirq_update_callback);
}
-static void ymirq_callback_2(running_machine *machine, int irq)
+static void ymirq_callback_2(const device_config *device, int irq)
{
if (irq)
- timer_call_after_resynch(machine, NULL, YM2IRQ_ASSERT, sndirq_update_callback);
+ timer_call_after_resynch(device->machine, NULL, YM2IRQ_ASSERT, sndirq_update_callback);
}
@@ -1326,11 +1328,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( marvins_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM
AM_RANGE(0x4000, 0x4000) AM_READ(marvins_soundlatch_r)
- AM_RANGE(0x8000, 0x8000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x8001, 0x8001) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x8002, 0x8007) AM_WRITE(snkwave_w)
- AM_RANGE(0x8008, 0x8008) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x8009, 0x8009) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0x8000, 0x8001) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x8002, 0x8007) AM_DEVWRITE(SOUND, "wave", snkwave_w)
+ AM_RANGE(0x8008, 0x8009) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
AM_RANGE(0xa000, 0xa000) AM_READ(marvins_sound_nmi_ack_r)
AM_RANGE(0xe000, 0xe7ff) AM_RAM
ADDRESS_MAP_END
@@ -1346,11 +1346,9 @@ static ADDRESS_MAP_START( jcross_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0x87ff) AM_RAM
AM_RANGE(0xa000, 0xa000) AM_READ(sgladiat_soundlatch_r)
AM_RANGE(0xc000, 0xc000) AM_READ(sgladiat_sound_nmi_ack_r)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0xe000, 0xe001) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
AM_RANGE(0xe002, 0xe003) AM_WRITENOP // ? always FFFF, snkwave leftover?
- AM_RANGE(0xe004, 0xe004) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0xe005, 0xe005) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0xe004, 0xe005) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( jcross_sound_portmap, ADDRESS_SPACE_IO, 8 )
@@ -1364,11 +1362,9 @@ static ADDRESS_MAP_START( hal21_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0x87ff) AM_RAM
AM_RANGE(0xa000, 0xa000) AM_READ(sgladiat_soundlatch_r)
AM_RANGE(0xc000, 0xc000) AM_READ(sgladiat_sound_nmi_ack_r)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0xe000, 0xe001) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
// AM_RANGE(0xe002, 0xe002) AM_WRITENOP // bitfielded(0-5) details unknown. Filter enable?
- AM_RANGE(0xe008, 0xe008) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0xe009, 0xe009) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0xe008, 0xe009) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( hal21_sound_portmap, ADDRESS_SPACE_IO, 8 )
@@ -1382,8 +1378,7 @@ static ADDRESS_MAP_START( tnk3_YM3526_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0x87ff) AM_RAM
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
AM_RANGE(0xc000, 0xc000) AM_READ(tnk3_busy_clear_r)
- AM_RANGE(0xe000, 0xe000) AM_READWRITE(ym3526_status_port_0_r, ym3526_control_port_0_w)
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ym3526_write_port_0_w)
+ AM_RANGE(0xe000, 0xe001) AM_DEVREADWRITE(SOUND, "ym1", ym3526_r, ym3526_w)
AM_RANGE(0xe004, 0xe004) AM_READ(tnk3_cmdirq_ack_r)
AM_RANGE(0xe006, 0xe006) AM_READ(tnk3_ymirq_ack_r)
ADDRESS_MAP_END
@@ -1393,8 +1388,7 @@ static ADDRESS_MAP_START( aso_YM3526_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xc000, 0xc7ff) AM_RAM
AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_r)
AM_RANGE(0xe000, 0xe000) AM_READ(tnk3_busy_clear_r)
- AM_RANGE(0xf000, 0xf000) AM_READWRITE(ym3526_status_port_0_r, ym3526_control_port_0_w)
- AM_RANGE(0xf001, 0xf001) AM_WRITE(ym3526_write_port_0_w)
+ AM_RANGE(0xf000, 0xf001) AM_DEVREADWRITE(SOUND, "ym1", ym3526_r, ym3526_w)
// AM_RANGE(0xf002, 0xf002) AM_READNOP unknown
AM_RANGE(0xf004, 0xf004) AM_READ(tnk3_cmdirq_ack_r)
AM_RANGE(0xf006, 0xf006) AM_READ(tnk3_ymirq_ack_r)
@@ -1404,10 +1398,10 @@ static ADDRESS_MAP_START( YM3526_YM3526_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xcfff) AM_RAM
AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
- AM_RANGE(0xe800, 0xe800) AM_READWRITE(ym3526_status_port_0_r, ym3526_control_port_0_w)
- AM_RANGE(0xec00, 0xec00) AM_WRITE(ym3526_write_port_0_w)
- AM_RANGE(0xf000, 0xf000) AM_READWRITE(ym3526_status_port_1_r, ym3526_control_port_1_w)
- AM_RANGE(0xf400, 0xf400) AM_WRITE(ym3526_write_port_1_w)
+ AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE(SOUND, "ym1", ym3526_status_port_r, ym3526_control_port_w)
+ AM_RANGE(0xec00, 0xec00) AM_DEVWRITE(SOUND, "ym1", ym3526_write_port_w)
+ AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE(SOUND, "ym2", ym3526_status_port_r, ym3526_control_port_w)
+ AM_RANGE(0xf400, 0xf400) AM_DEVWRITE(SOUND, "ym2", ym3526_write_port_w)
AM_RANGE(0xf800, 0xf800) AM_READWRITE(snk_sound_status_r, snk_sound_status_w)
ADDRESS_MAP_END
@@ -1415,8 +1409,8 @@ static ADDRESS_MAP_START( YM3812_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xcfff) AM_RAM
AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
- AM_RANGE(0xe800, 0xe800) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0xec00, 0xec00) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE(SOUND, "ym1", ym3812_status_port_r, ym3812_control_port_w)
+ AM_RANGE(0xec00, 0xec00) AM_DEVWRITE(SOUND, "ym1", ym3812_write_port_w)
AM_RANGE(0xf800, 0xf800) AM_READWRITE(snk_sound_status_r, snk_sound_status_w)
ADDRESS_MAP_END
@@ -1424,10 +1418,10 @@ static ADDRESS_MAP_START( YM3526_Y8950_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xcfff) AM_RAM
AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
- AM_RANGE(0xe800, 0xe800) AM_READWRITE(ym3526_status_port_0_r, ym3526_control_port_0_w)
- AM_RANGE(0xec00, 0xec00) AM_WRITE(ym3526_write_port_0_w)
- AM_RANGE(0xf000, 0xf000) AM_READWRITE(y8950_status_port_0_r, y8950_control_port_0_w)
- AM_RANGE(0xf400, 0xf400) AM_WRITE(y8950_write_port_0_w)
+ AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE(SOUND, "ym1", ym3526_status_port_r, ym3526_control_port_w)
+ AM_RANGE(0xec00, 0xec00) AM_DEVWRITE(SOUND, "ym1", ym3526_write_port_w)
+ AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE(SOUND, "ym2", y8950_status_port_r, y8950_control_port_w)
+ AM_RANGE(0xf400, 0xf400) AM_DEVWRITE(SOUND, "ym2", y8950_write_port_w)
AM_RANGE(0xf800, 0xf800) AM_READWRITE(snk_sound_status_r, snk_sound_status_w)
ADDRESS_MAP_END
@@ -1435,10 +1429,10 @@ static ADDRESS_MAP_START( YM3812_Y8950_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xcfff) AM_RAM
AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
- AM_RANGE(0xe800, 0xe800) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0xec00, 0xec00) AM_WRITE(ym3812_write_port_0_w)
- AM_RANGE(0xf000, 0xf000) AM_READWRITE(y8950_status_port_0_r, y8950_control_port_0_w)
- AM_RANGE(0xf400, 0xf400) AM_WRITE(y8950_write_port_0_w)
+ AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE(SOUND, "ym1", ym3812_status_port_r, ym3812_control_port_w)
+ AM_RANGE(0xec00, 0xec00) AM_DEVWRITE(SOUND, "ym1", ym3812_write_port_w)
+ AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE(SOUND, "ym2", y8950_status_port_r, y8950_control_port_w)
+ AM_RANGE(0xf400, 0xf400) AM_DEVWRITE(SOUND, "ym2", y8950_write_port_w)
AM_RANGE(0xf800, 0xf800) AM_READWRITE(snk_sound_status_r, snk_sound_status_w)
ADDRESS_MAP_END
@@ -1446,8 +1440,8 @@ static ADDRESS_MAP_START( Y8950_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xcfff) AM_RAM
AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
- AM_RANGE(0xf000, 0xf000) AM_READWRITE(y8950_status_port_0_r, y8950_control_port_0_w)
- AM_RANGE(0xf400, 0xf400) AM_WRITE(y8950_write_port_0_w)
+ AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE(SOUND, "ym2", y8950_status_port_r, y8950_control_port_w)
+ AM_RANGE(0xf400, 0xf400) AM_DEVWRITE(SOUND, "ym2", y8950_write_port_w)
AM_RANGE(0xf800, 0xf800) AM_READWRITE(snk_sound_status_r, snk_sound_status_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/snk68.c b/src/mame/drivers/snk68.c
index 72d9f0e7ed8..3c6d5968af4 100644
--- a/src/mame/drivers/snk68.c
+++ b/src/mame/drivers/snk68.c
@@ -173,19 +173,24 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r) AM_WRITE(sound_status_w)
ADDRESS_MAP_END
-static WRITE8_HANDLER( D7759_write_port_0_w )
+static WRITE8_DEVICE_HANDLER( D7759_write_port_0_w )
{
- upd7759_port_w(offset,data);
- upd7759_start_w(0,0);
- upd7759_start_w(0,1);
+ upd7759_port_w(device, 0, data);
+ upd7759_start_w(device, 0);
+ upd7759_start_w(device, 1);
+}
+
+static WRITE8_DEVICE_HANDLER( D7759_upd_reset_w )
+{
+ upd7759_reset_w(device, data & 1);
}
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0x20, 0x20) AM_WRITE(ym3812_write_port_0_w)
- AM_RANGE(0x40, 0x40) AM_WRITE(D7759_write_port_0_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(upd7759_0_reset_w)
+ AM_RANGE(0x00, 0x00) AM_DEVREADWRITE(SOUND, "ym", ym3812_status_port_r, ym3812_control_port_w)
+ AM_RANGE(0x20, 0x20) AM_DEVWRITE(SOUND, "ym", ym3812_write_port_w)
+ AM_RANGE(0x40, 0x40) AM_DEVWRITE(SOUND, "upd", D7759_write_port_0_w)
+ AM_RANGE(0x80, 0x80) AM_DEVWRITE(SOUND, "upd", D7759_upd_reset_w)
ADDRESS_MAP_END
/******************************************************************************/
@@ -580,9 +585,9 @@ GFXDECODE_END
/******************************************************************************/
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym3812_interface ym3812_config =
diff --git a/src/mame/drivers/snookr10.c b/src/mame/drivers/snookr10.c
index 5d7e3ce3ded..424f3f34bfc 100644
--- a/src/mame/drivers/snookr10.c
+++ b/src/mame/drivers/snookr10.c
@@ -506,7 +506,7 @@ static WRITE8_HANDLER( output_port_1_w )
static ADDRESS_MAP_START( snookr10_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
- AM_RANGE(0x1000, 0x1000) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x1000, 0x1000) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0x3000, 0x3000) AM_READ_PORT("IN0") /* IN0 */
AM_RANGE(0x3001, 0x3001) AM_READ_PORT("IN1") /* IN1 */
AM_RANGE(0x3002, 0x3002) AM_READ_PORT("IN2") /* IN2 */
@@ -521,7 +521,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( tenballs_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
- AM_RANGE(0x1000, 0x1000) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x1000, 0x1000) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0x4000, 0x4000) AM_READ_PORT("IN0") /* IN0 */
AM_RANGE(0x4001, 0x4001) AM_READ_PORT("IN1") /* IN1 */
AM_RANGE(0x4002, 0x4002) AM_READ_PORT("IN2") /* IN2 */
diff --git a/src/mame/drivers/snowbros.c b/src/mame/drivers/snowbros.c
index 70cf0265366..38eb61b75a0 100644
--- a/src/mame/drivers/snowbros.c
+++ b/src/mame/drivers/snowbros.c
@@ -111,8 +111,8 @@ static INTERRUPT_GEN( snowbros_interrupt )
static INTERRUPT_GEN( snowbro3_interrupt )
{
- const address_space *space = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
- int status = okim6295_status_0_r(space,0);
+ const device_config *adpcm = devtag_get_device(device->machine, SOUND, "oki");
+ int status = okim6295_r(adpcm,0);
cpu_set_input_line(device, cpu_getiloops(device) + 2, HOLD_LINE); /* IRQs 4, 3, and 2 */
@@ -120,8 +120,8 @@ static INTERRUPT_GEN( snowbro3_interrupt )
{
if ((status&0x08)==0x00)
{
- okim6295_data_0_w(space,0,0x80|sb3_music);
- okim6295_data_0_w(space,0,0x00|0x82);
+ okim6295_w(adpcm,0,0x80|sb3_music);
+ okim6295_w(adpcm,0,0x00|0x82);
}
}
@@ -129,7 +129,7 @@ static INTERRUPT_GEN( snowbro3_interrupt )
{
if ((status&0x08)==0x08)
{
- okim6295_data_0_w(space,0,0x40); /* Stop playing music */
+ okim6295_w(adpcm,0,0x40); /* Stop playing music */
}
}
@@ -197,8 +197,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x02, 0x02) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x02, 0x03) AM_DEVREADWRITE(SOUND, "ym", ym3812_r, ym3812_w)
AM_RANGE(0x04, 0x04) AM_READWRITE(soundlatch_r, soundlatch_w) /* goes back to the main CPU, checked during boot */
ADDRESS_MAP_END
@@ -256,19 +255,18 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( honeydol_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM)
- AM_RANGE(0xe010, 0xe010) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0xe010, 0xe010) AM_DEVREAD(SOUND, "oki", okim6295_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( honeydol_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xe010, 0xe010) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0xe010, 0xe010) AM_DEVWRITE(SOUND, "oki", okim6295_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( honeydol_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x02, 0x02) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w) // not connected?
- AM_RANGE(0x03, 0x03) AM_WRITE(ym3812_write_port_0_w) // not connected?
+ AM_RANGE(0x02, 0x03) AM_DEVREADWRITE(SOUND, "ym", ym3812_r, ym3812_w) // not connected?
AM_RANGE(0x04, 0x04) AM_READWRITE(soundlatch_r, soundlatch_w) /* goes back to the main CPU, checked during boot */
ADDRESS_MAP_END
@@ -311,29 +309,29 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( twinadv_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM)
-// AM_RANGE(0xe010, 0xe010) AM_READ(okim6295_status_0_r)
+// AM_RANGE(0xe010, 0xe010) AM_DEVREAD(SOUND, "oki", okim6295_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( twinadv_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
-// AM_RANGE(0xe010, 0xe010) AM_WRITE(okim6295_data_0_w)
+// AM_RANGE(0xe010, 0xe010) AM_DEVWRITE(SOUND, "oki", okim6295_w)
ADDRESS_MAP_END
-static WRITE8_HANDLER( twinadv_oki_bank_w )
+static WRITE8_DEVICE_HANDLER( twinadv_oki_bank_w )
{
int bank = (data &0x02)>>1;
if (data&0xfd) logerror ("Unused bank bits! %02x\n",data);
- okim6295_set_bank_base(0, bank * 0x40000);
+ okim6295_set_bank_base(device, bank * 0x40000);
}
static ADDRESS_MAP_START( twinadv_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x02, 0x02) AM_READWRITE(soundlatch_r, soundlatch_w) // back to 68k?
- AM_RANGE(0x04, 0x04) AM_WRITE(twinadv_oki_bank_w) // oki bank?
- AM_RANGE(0x06, 0x06) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x04, 0x04) AM_DEVWRITE(SOUND, "oki", twinadv_oki_bank_w) // oki bank?
+ AM_RANGE(0x06, 0x06) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
ADDRESS_MAP_END
@@ -372,16 +370,15 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( hyperpac_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xcfff) AM_READ(SMH_ROM)
AM_RANGE(0xd000, 0xd7ff) AM_READ(SMH_RAM)
- AM_RANGE(0xf001, 0xf001) AM_READ(ym2151_status_port_0_r)
+ AM_RANGE(0xf000, 0xf001) AM_DEVREAD(SOUND, "ym", ym2151_r)
AM_RANGE(0xf008, 0xf008) AM_READ(soundlatch_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( hyperpac_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xcfff) AM_WRITE(SMH_ROM)
AM_RANGE(0xd000, 0xd7ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xf000, 0xf000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xf001, 0xf001) AM_WRITE(ym2151_data_port_0_w)
- AM_RANGE(0xf002, 0xf002) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0xf000, 0xf001) AM_DEVWRITE(SOUND, "ym", ym2151_w)
+ AM_RANGE(0xf002, 0xf002) AM_DEVWRITE(SOUND, "oki", okim6295_w)
// AM_RANGE(0xf006, 0xf006) ???
ADDRESS_MAP_END
@@ -433,35 +430,35 @@ static void sb3_play_music(running_machine *machine, int data)
}
}
-static void sb3_play_sound (const address_space *space, int data)
+static void sb3_play_sound (const device_config *device, int data)
{
- int status = okim6295_status_0_r(space,0);
+ int status = okim6295_r(device,0);
if ((status&0x01)==0x00)
{
- okim6295_data_0_w(space,0,0x80|data);
- okim6295_data_0_w(space,0,0x00|0x12);
+ okim6295_w(device,0,0x80|data);
+ okim6295_w(device,0,0x00|0x12);
}
else if ((status&0x02)==0x00)
{
- okim6295_data_0_w(space,0,0x80|data);
- okim6295_data_0_w(space,0,0x00|0x22);
+ okim6295_w(device,0,0x80|data);
+ okim6295_w(device,0,0x00|0x22);
}
else if ((status&0x04)==0x00)
{
- okim6295_data_0_w(space,0,0x80|data);
- okim6295_data_0_w(space,0,0x00|0x42);
+ okim6295_w(device,0,0x80|data);
+ okim6295_w(device,0,0x00|0x42);
}
}
-static WRITE16_HANDLER( sb3_sound_w )
+static WRITE16_DEVICE_HANDLER( sb3_sound_w )
{
if (data == 0x00fe)
{
sb3_music_is_playing = 0;
- okim6295_data_0_w(space,0,0x78); /* Stop sounds */
+ okim6295_w(device,0,0x78); /* Stop sounds */
}
else /* the alternating 0x00-0x2f or 0x30-0x5f might be something to do with the channels */
{
@@ -469,22 +466,22 @@ static WRITE16_HANDLER( sb3_sound_w )
if (data <= 0x21)
{
- sb3_play_sound(space, data);
+ sb3_play_sound(device, data);
}
if (data>=0x22 && data<=0x31)
{
- sb3_play_music(space->machine, data);
+ sb3_play_music(device->machine, data);
}
if ((data>=0x30) && (data<=0x51))
{
- sb3_play_sound(space, data-0x30);
+ sb3_play_sound(device, data-0x30);
}
if (data>=0x52 && data<=0x5f)
{
- sb3_play_music(space->machine, data-0x30);
+ sb3_play_music(device->machine, data-0x30);
}
}
@@ -507,7 +504,7 @@ static ADDRESS_MAP_START( writemem3, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE( 0x000000, 0x03ffff) AM_WRITE(SMH_ROM)
AM_RANGE( 0x100000, 0x103fff) AM_WRITE(SMH_RAM)
AM_RANGE( 0x200000, 0x200001) AM_WRITE(watchdog_reset16_w)
- AM_RANGE( 0x300000, 0x300001) AM_WRITE(sb3_sound_w) // ?
+ AM_RANGE( 0x300000, 0x300001) AM_DEVWRITE(SOUND, "oki", sb3_sound_w) // ?
AM_RANGE( 0x400000, 0x400001) AM_WRITE(snowbros_flipscreen_w)
AM_RANGE( 0x600000, 0x6003ff) AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE (&paletteram16)
AM_RANGE( 0x700000, 0x7021ff) AM_WRITE(SMH_RAM) AM_BASE( &spriteram16) AM_SIZE( &spriteram_size )
@@ -1495,9 +1492,9 @@ static GFXDECODE_START( hyperpac )
GFXDECODE_END
/* handler called by the 3812/2151 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
/* SnowBros Sound */
@@ -1562,7 +1559,7 @@ static MACHINE_DRIVER_START( snowbros )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("3812", YM3812, 3000000)
+ MDRV_SOUND_ADD("ym", YM3812, 3000000)
MDRV_SOUND_CONFIG(ym3812_config)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
@@ -1594,7 +1591,7 @@ static MACHINE_DRIVER_START( semicom )
MDRV_GFXDECODE(hyperpac)
/* sound hardware */
- MDRV_SOUND_REPLACE("3812", YM2151, 4000000)
+ MDRV_SOUND_REPLACE("ym", YM2151, 4000000)
MDRV_SOUND_CONFIG(ym2151_config)
MDRV_SOUND_ROUTE(0, "mono", 0.10)
MDRV_SOUND_ROUTE(1, "mono", 0.10)
@@ -1658,7 +1655,7 @@ static MACHINE_DRIVER_START( honeydol )
/* sound hardware */
- MDRV_SOUND_ADD("3812", YM3812, 3000000)
+ MDRV_SOUND_ADD("ym", YM3812, 3000000)
MDRV_SOUND_CONFIG(ym3812_config)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
@@ -1731,7 +1728,7 @@ static MACHINE_DRIVER_START( finalttr )
MDRV_MACHINE_RESET ( finalttr )
- MDRV_SOUND_REPLACE("3812", YM2151, 4000000)
+ MDRV_SOUND_REPLACE("ym", YM2151, 4000000)
MDRV_SOUND_CONFIG(ym2151_config)
MDRV_SOUND_ROUTE(0, "mono", 0.08)
MDRV_SOUND_ROUTE(1, "mono", 0.08)
diff --git a/src/mame/drivers/solomon.c b/src/mame/drivers/solomon.c
index 7ac305f9a3a..334559662eb 100644
--- a/src/mame/drivers/solomon.c
+++ b/src/mame/drivers/solomon.c
@@ -80,12 +80,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x10, 0x10) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x11, 0x11) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x20, 0x20) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x21, 0x21) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x30, 0x30) AM_WRITE(ay8910_control_port_2_w)
- AM_RANGE(0x31, 0x31) AM_WRITE(ay8910_write_port_2_w)
+ AM_RANGE(0x10, 0x11) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x20, 0x21) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x30, 0x31) AM_DEVWRITE(SOUND, "ay3", ay8910_address_data_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/sonson.c b/src/mame/drivers/sonson.c
index ac89d7d0e29..085fe85032c 100644
--- a/src/mame/drivers/sonson.c
+++ b/src/mame/drivers/sonson.c
@@ -99,10 +99,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM
- AM_RANGE(0x2000, 0x2000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x2001, 0x2001) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x4000, 0x4000) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x4001, 0x4001) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0x2000, 0x2001) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x4000, 0x4001) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
AM_RANGE(0xe000, 0xffff) AM_ROM
ADDRESS_MAP_END
diff --git a/src/mame/drivers/sothello.c b/src/mame/drivers/sothello.c
index 21b96512163..ebfd2cc9f23 100644
--- a/src/mame/drivers/sothello.c
+++ b/src/mame/drivers/sothello.c
@@ -125,9 +125,8 @@ static ADDRESS_MAP_START( maincpu_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE( 0x33, 0x33) AM_READ(soundcpu_status_r)
AM_RANGE( 0x40, 0x4f) AM_WRITE(soundlatch_w)
AM_RANGE( 0x50, 0x50) AM_WRITE(bank_w)
- AM_RANGE( 0x60, 0x60) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE( 0x61, 0x61) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
- AM_RANGE( 0x62, 0x62) AM_READ(ym2203_status_port_0_r) /* not sure, but the A1 line is ignored, code @ $8b8 */
+ AM_RANGE( 0x60, 0x61) AM_MIRROR(0x02) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
+ /* not sure, but the A1 line is ignored, code @ $8b8 */
AM_RANGE( 0x70, 0x70) AM_WRITE( v9938_0_vram_w ) AM_READ( v9938_0_vram_r )
AM_RANGE( 0x71, 0x71) AM_WRITE( v9938_0_command_w ) AM_READ( v9938_0_status_r )
AM_RANGE( 0x72, 0x72) AM_WRITE( v9938_0_palette_w )
@@ -136,7 +135,7 @@ ADDRESS_MAP_END
/* sound Z80 */
-static WRITE8_HANDLER(msm_cfg_w)
+static WRITE8_DEVICE_HANDLER(msm_cfg_w)
{
/*
bit 0 = RESET
@@ -144,8 +143,8 @@ static WRITE8_HANDLER(msm_cfg_w)
bit 2 = S2 1
bit 3 = S1 2
*/
- msm5205_playmode_w(0, BITSWAP8((data>>1), 7,6,5,4,3,0,1,2)); /* or maybe 7,6,5,4,3,0,2,1 ??? */
- msm5205_reset_w(0,data&1);
+ msm5205_playmode_w(device, BITSWAP8((data>>1), 7,6,5,4,3,0,1,2)); /* or maybe 7,6,5,4,3,0,2,1 ??? */
+ msm5205_reset_w(device,data&1);
}
static WRITE8_HANDLER( msm_data_w )
@@ -178,7 +177,7 @@ static ADDRESS_MAP_START( soundcpu_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r)
AM_RANGE(0x01, 0x01) AM_WRITE(msm_data_w)
- AM_RANGE(0x02, 0x02) AM_WRITE(msm_cfg_w)
+ AM_RANGE(0x02, 0x02) AM_DEVWRITE(SOUND, "msm", msm_cfg_w)
AM_RANGE(0x03, 0x03) AM_WRITE(soundcpu_busyflag_set_w)
AM_RANGE(0x04, 0x04) AM_WRITE(soundcpu_busyflag_reset_w)
AM_RANGE(0x05, 0x05) AM_WRITE(soundcpu_int_clear_w)
@@ -291,9 +290,9 @@ INPUT_PORTS_START( sothello )
INPUT_PORTS_END
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[2],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[2],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static void sothello_vdp_interrupt(running_machine *machine, int i)
@@ -309,7 +308,7 @@ static INTERRUPT_GEN( sothello_interrupt )
static void adpcm_int(const device_config *device)
{
/* only 4 bits are used */
- msm5205_data_w( 0, msm_data & 0x0f );
+ msm5205_data_w( device, msm_data & 0x0f );
cpu_set_input_line(device->machine->cpu[1], 0, ASSERT_LINE );
}
@@ -337,10 +336,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_3_r, /* DSW-1 connected to port */
- input_port_4_r, /* DSW-2 connected to port */
- NULL,
- NULL,
+ DEVCB_INPUT_PORT("DSWA"),
+ DEVCB_INPUT_PORT("DSWB"),
+ DEVCB_NULL,
+ DEVCB_NULL,
},
irqhandler
};
@@ -378,7 +377,7 @@ static MACHINE_DRIVER_START( sothello )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("ym1", YM2203, YM_CLOCK)
+ MDRV_SOUND_ADD("ym", YM2203, YM_CLOCK)
MDRV_SOUND_CONFIG(ym2203_config)
MDRV_SOUND_ROUTE(0, "mono", 0.25)
MDRV_SOUND_ROUTE(1, "mono", 0.25)
diff --git a/src/mame/drivers/spacefb.c b/src/mame/drivers/spacefb.c
index 5b228f0df8d..529803c59c0 100644
--- a/src/mame/drivers/spacefb.c
+++ b/src/mame/drivers/spacefb.c
@@ -229,7 +229,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( spacefb_audio_io_map, ADDRESS_SPACE_IO, 8 )
- AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(dac_0_data_w)
+ AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE(SOUND, "dac", dac_w)
AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READ(spacefb_audio_p2_r)
AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(spacefb_audio_t0_r)
AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(spacefb_audio_t1_r)
diff --git a/src/mame/drivers/spbactn.c b/src/mame/drivers/spbactn.c
index d2dc64526f3..6ce6be26307 100644
--- a/src/mame/drivers/spbactn.c
+++ b/src/mame/drivers/spbactn.c
@@ -203,7 +203,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_READ(SMH_ROM)
AM_RANGE(0xf000, 0xf7ff) AM_READ(SMH_RAM)
- AM_RANGE(0xf800, 0xf800) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0xf800, 0xf800) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0xfc00, 0xfc00) AM_READ(SMH_NOP) /* irq ack ?? */
AM_RANGE(0xfc20, 0xfc20) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -211,9 +211,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_WRITE(SMH_ROM)
AM_RANGE(0xf000, 0xf7ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xf800, 0xf800) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0xf810, 0xf810) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0xf811, 0xf811) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0xf800, 0xf800) AM_DEVWRITE(SOUND, "oki", okim6295_w)
+ AM_RANGE(0xf810, 0xf811) AM_DEVWRITE(SOUND, "ym", ym3812_w)
AM_RANGE(0xfc00, 0xfc00) AM_WRITE(SMH_NOP) /* irq ack ?? */
ADDRESS_MAP_END
@@ -343,9 +342,9 @@ static GFXDECODE_START( spbactn )
GFXDECODE_ENTRY( "gfx3", 0, spritelayout, 0x0000, 16 + 384 )
GFXDECODE_END
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1],0,linestate);
+ cpu_set_input_line(device->machine->cpu[1],0,linestate);
}
static const ym3812_interface ym3812_config =
diff --git a/src/mame/drivers/spcforce.c b/src/mame/drivers/spcforce.c
index c8639017fce..447bf9272c4 100644
--- a/src/mame/drivers/spcforce.c
+++ b/src/mame/drivers/spcforce.c
@@ -60,9 +60,9 @@ static WRITE8_HANDLER( spcforce_SN76496_select_w )
{
spcforce_SN76496_select = data;
- if (~data & 0x40) sn76496_0_w(space, 0, spcforce_SN76496_latch);
- if (~data & 0x20) sn76496_1_w(space, 0, spcforce_SN76496_latch);
- if (~data & 0x10) sn76496_2_w(space, 0, spcforce_SN76496_latch);
+ if (~data & 0x40) sn76496_w(devtag_get_device(space->machine, SOUND, "sn1"), 0, spcforce_SN76496_latch);
+ if (~data & 0x20) sn76496_w(devtag_get_device(space->machine, SOUND, "sn2"), 0, spcforce_SN76496_latch);
+ if (~data & 0x10) sn76496_w(devtag_get_device(space->machine, SOUND, "sn3"), 0, spcforce_SN76496_latch);
}
static READ8_HANDLER( spcforce_t0_r )
diff --git a/src/mame/drivers/spdodgeb.c b/src/mame/drivers/spdodgeb.c
index 12be8d8e6d9..c22138dbd1a 100644
--- a/src/mame/drivers/spdodgeb.c
+++ b/src/mame/drivers/spdodgeb.c
@@ -61,12 +61,13 @@ static WRITE8_HANDLER( sound_command_w )
static WRITE8_HANDLER( spd_adpcm_w )
{
int chip = offset & 1;
+ const device_config *adpcm = devtag_get_device(space->machine, SOUND, (chip == 0) ? "msm1" : "msm2");
switch (offset/2)
{
case 3:
adpcm_idle[chip] = 1;
- msm5205_reset_w(chip,1);
+ msm5205_reset_w(adpcm,1);
break;
case 2:
@@ -79,7 +80,7 @@ static WRITE8_HANDLER( spd_adpcm_w )
case 0:
adpcm_idle[chip] = 0;
- msm5205_reset_w(chip,0);
+ msm5205_reset_w(adpcm,0);
break;
}
}
@@ -90,11 +91,11 @@ static void spd_adpcm_int(const device_config *device)
if (adpcm_pos[chip] >= adpcm_end[chip] || adpcm_pos[chip] >= 0x10000)
{
adpcm_idle[chip] = 1;
- msm5205_reset_w(chip,1);
+ msm5205_reset_w(device,1);
}
else if (adpcm_data[chip] != -1)
{
- msm5205_data_w(chip,adpcm_data[chip] & 0x0f);
+ msm5205_data_w(device,adpcm_data[chip] & 0x0f);
adpcm_data[chip] = -1;
}
else
@@ -102,7 +103,7 @@ static void spd_adpcm_int(const device_config *device)
UINT8 *ROM = memory_region(device->machine, "adpcm") + 0x10000 * chip;
adpcm_data[chip] = ROM[adpcm_pos[chip]++];
- msm5205_data_w(chip,adpcm_data[chip] >> 4);
+ msm5205_data_w(device,adpcm_data[chip] >> 4);
}
}
@@ -299,8 +300,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x2800, 0x2800) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x2801, 0x2801) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x2800, 0x2801) AM_DEVWRITE(SOUND, "ym", ym3812_w)
AM_RANGE(0x3800, 0x3807) AM_WRITE(spd_adpcm_w)
AM_RANGE(0x8000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
@@ -413,9 +413,9 @@ static GFXDECODE_START( spdodgeb )
GFXDECODE_END
-static void irq_handler(running_machine *machine, int irq)
+static void irq_handler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],M6809_FIRQ_LINE,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],M6809_FIRQ_LINE,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym3812_interface ym3812_config =
diff --git a/src/mame/drivers/speedatk.c b/src/mame/drivers/speedatk.c
index 00cd4e80d17..7753a628dcf 100644
--- a/src/mame/drivers/speedatk.c
+++ b/src/mame/drivers/speedatk.c
@@ -185,8 +185,8 @@ static ADDRESS_MAP_START( speedatk_io, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x01) AM_WRITE(speedatk_videoregs_w) // HD46505SP video registers
AM_RANGE(0x24, 0x24) AM_WRITE(SMH_NOP) //video timing
- AM_RANGE(0x40, 0x40) AM_READ_PORT("DSW") AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x41, 0x41) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x40, 0x40) AM_READ_PORT("DSW") /* likely ay8910 input port, not direct */
+ AM_RANGE(0x40, 0x41) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
/*Used only during attract mode,unknown meaning.*/
AM_RANGE(0x60, 0x60) AM_READWRITE(SMH_NOP,SMH_NOP)//write the result to $62/$65
AM_RANGE(0x61, 0x61) AM_READ(SMH_NOP)//write the result to $66
diff --git a/src/mame/drivers/speedbal.c b/src/mame/drivers/speedbal.c
index 743f24b2d37..1b6f423648e 100644
--- a/src/mame/drivers/speedbal.c
+++ b/src/mame/drivers/speedbal.c
@@ -101,8 +101,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_cpu_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym3812_r, ym3812_w)
AM_RANGE(0x40, 0x40) AM_WRITENOP
AM_RANGE(0x80, 0x80) AM_WRITENOP
AM_RANGE(0x82, 0x82) AM_WRITENOP
diff --git a/src/mame/drivers/speedspn.c b/src/mame/drivers/speedspn.c
index 32ff6e4a1f2..5123ea6a1a6 100644
--- a/src/mame/drivers/speedspn.c
+++ b/src/mame/drivers/speedspn.c
@@ -107,9 +107,9 @@ static WRITE8_HANDLER(speedspn_sound_w)
cpu_set_input_line(space->machine->cpu[1],0,HOLD_LINE);
}
-static WRITE8_HANDLER( oki_banking_w )
+static WRITE8_DEVICE_HANDLER( oki_banking_w )
{
- okim6295_set_bank_base(0, 0x40000 * (data & 3));
+ okim6295_set_bank_base(device, 0x40000 * (data & 3));
}
/*** MEMORY MAPS *************************************************************/
@@ -155,15 +155,15 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( readmem2, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM)
- AM_RANGE(0x9800, 0x9800) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x9800, 0x9800) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem2, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x9000, 0x9000) AM_WRITE(oki_banking_w)
- AM_RANGE(0x9800, 0x9800) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0x9000, 0x9000) AM_DEVWRITE(SOUND, "oki", oki_banking_w)
+ AM_RANGE(0x9800, 0x9800) AM_DEVWRITE(SOUND, "oki", okim6295_w)
ADDRESS_MAP_END
/*** INPUT PORT **************************************************************/
diff --git a/src/mame/drivers/speglsht.c b/src/mame/drivers/speglsht.c
index a15e35a3430..557c9b3e03d 100644
--- a/src/mame/drivers/speglsht.c
+++ b/src/mame/drivers/speglsht.c
@@ -122,7 +122,7 @@ static ADDRESS_MAP_START( st0016_mem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xd000, 0xdfff) AM_READ(st0016_sprite2_ram_r) AM_WRITE(st0016_sprite2_ram_w)
AM_RANGE(0xe000, 0xe7ff) AM_RAM
AM_RANGE(0xe800, 0xe87f) AM_RAM
- AM_RANGE(0xe900, 0xe9ff) AM_RAM_WRITE(st0016_snd_w) AM_BASE(&st0016_sound_regs)
+ AM_RANGE(0xe900, 0xe9ff) AM_DEVREADWRITE(SOUND, "st", st0016_snd_r, st0016_snd_w)
AM_RANGE(0xea00, 0xebff) AM_READ(st0016_palette_ram_r) AM_WRITE(st0016_palette_ram_w)
AM_RANGE(0xec00, 0xec1f) AM_READ(st0016_character_ram_r) AM_WRITE(st0016_character_ram_w)
AM_RANGE(0xf000, 0xffff) AM_RAM AM_BASE(&shared)
diff --git a/src/mame/drivers/splash.c b/src/mame/drivers/splash.c
index 37229123a90..2185e796114 100644
--- a/src/mame/drivers/splash.c
+++ b/src/mame/drivers/splash.c
@@ -135,7 +135,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( splash_readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xd7ff) AM_READ(SMH_ROM) /* ROM */
AM_RANGE(0xe800, 0xe800) AM_READ(soundlatch_r) /* Sound latch */
- AM_RANGE(0xf000, 0xf000) AM_READ(ym3812_status_port_0_r) /* YM3812 */
+ AM_RANGE(0xf000, 0xf001) AM_DEVREAD(SOUND, "ym", ym3812_r) /* YM3812 */
AM_RANGE(0xf800, 0xffff) AM_READ(SMH_RAM) /* RAM */
ADDRESS_MAP_END
@@ -145,7 +145,7 @@ static WRITE8_HANDLER( splash_adpcm_data_w ){
static void splash_msm5205_int(const device_config *device)
{
- msm5205_data_w(0,adpcm_data >> 4);
+ msm5205_data_w(device,adpcm_data >> 4);
adpcm_data = (adpcm_data << 4) & 0xf0;
}
@@ -154,8 +154,7 @@ static ADDRESS_MAP_START( splash_writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xd7ff) AM_WRITE(SMH_ROM) /* ROM */
AM_RANGE(0xd800, 0xd800) AM_WRITE(splash_adpcm_data_w) /* ADPCM data for the MSM5205 chip */
// AM_RANGE(0xe000, 0xe000) AM_WRITE(SMH_NOP) /* ??? */
- AM_RANGE(0xf000, 0xf000) AM_WRITE(ym3812_control_port_0_w) /* YM3812 */
- AM_RANGE(0xf001, 0xf001) AM_WRITE(ym3812_write_port_0_w) /* YM3812 */
+ AM_RANGE(0xf000, 0xf001) AM_DEVWRITE(SOUND, "ym", ym3812_w) /* YM3812 */
AM_RANGE(0xf800, 0xffff) AM_WRITE(SMH_RAM) /* RAM */
ADDRESS_MAP_END
@@ -213,8 +212,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( roldf_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x12, 0x12) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x13, 0x13) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0x12, 0x13) AM_DEVWRITE(SOUND, "ym", ym2203_w)
AM_RANGE(0x40, 0x40) AM_NOP /* NMI ack */
AM_RANGE(0x70, 0x70) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -472,7 +470,7 @@ static MACHINE_DRIVER_START( splash )
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
MACHINE_DRIVER_END
-static void ym_irq(running_machine *machine, int state)
+static void ym_irq(const device_config *device, int state)
{
logerror("2203 IRQ: %d\n", state);
}
@@ -482,7 +480,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
ym_irq
};
diff --git a/src/mame/drivers/spoker.c b/src/mame/drivers/spoker.c
index 9e6cfcf46de..6470d5e385c 100644
--- a/src/mame/drivers/spoker.c
+++ b/src/mame/drivers/spoker.c
@@ -208,10 +208,9 @@ static ADDRESS_MAP_START( spoker_portmap, ADDRESS_SPACE_IO, 8 )
AM_RANGE( 0x6492, 0x6492 ) AM_WRITE( spoker_leds_w )
AM_RANGE( 0x64a0, 0x64a0 ) AM_READ_PORT( "BUTTONS2" )
- AM_RANGE( 0x64b0, 0x64b0 ) AM_WRITE( ym2413_register_port_0_w )
- AM_RANGE( 0x64b1, 0x64b1 ) AM_WRITE( ym2413_data_port_0_w )
+ AM_RANGE( 0x64b0, 0x64b1 ) AM_DEVWRITE( SOUND, "ym", ym2413_w )
- AM_RANGE( 0x64c0, 0x64c0 ) AM_READWRITE( okim6295_status_0_r, okim6295_data_0_w )
+ AM_RANGE( 0x64c0, 0x64c0 ) AM_DEVREADWRITE( SOUND, "oki", okim6295_r, okim6295_w )
AM_RANGE( 0x64d0, 0x64d1 ) AM_READWRITE( spoker_magic_r, spoker_magic_w ) // DSW1-5
diff --git a/src/mame/drivers/spool99.c b/src/mame/drivers/spool99.c
index efecb6b0eb8..f3edff68666 100644
--- a/src/mame/drivers/spool99.c
+++ b/src/mame/drivers/spool99.c
@@ -156,7 +156,7 @@ static READ8_HANDLER( spool99_io_r )
// case 0xafe5: return 1;
// case 0xafe6: return 1;
case 0xafe7: return eeprom_read_bit();
- case 0xaff8: return okim6295_status_0_r(space,0);
+ case 0xaff8: return okim6295_r(devtag_get_device(space->machine, SOUND, "oki"),0);
}
}
// printf("%04x %d\n",offset+0xaf00,io_switch);
@@ -188,7 +188,7 @@ static ADDRESS_MAP_START( spool99_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xafed, 0xafed) AM_WRITE(eeprom_resetline_w )
AM_RANGE(0xafee, 0xafee) AM_WRITE(eeprom_clockline_w )
AM_RANGE(0xafef, 0xafef) AM_WRITE(eeprom_dataline_w )
- AM_RANGE(0xaff8, 0xaff8) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0xaff8, 0xaff8) AM_DEVWRITE(SOUND, "oki", okim6295_w)
AM_RANGE(0xb000, 0xb3ff) AM_RAM AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_le_w) AM_BASE(&paletteram) // palette
diff --git a/src/mame/drivers/sprcros2.c b/src/mame/drivers/sprcros2.c
index e22ba7729d0..ab2cd6b6748 100644
--- a/src/mame/drivers/sprcros2.c
+++ b/src/mame/drivers/sprcros2.c
@@ -141,9 +141,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READ_PORT("P1") AM_WRITE(sn76496_0_w)
- AM_RANGE(0x01, 0x01) AM_READ_PORT("P2") AM_WRITE(sn76496_1_w)
- AM_RANGE(0x02, 0x02) AM_READ_PORT("EXTRA") AM_WRITE(sn76496_2_w)
+ AM_RANGE(0x00, 0x00) AM_READ_PORT("P1") AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0x01, 0x01) AM_READ_PORT("P2") AM_DEVWRITE(SOUND, "sn2", sn76496_w)
+ AM_RANGE(0x02, 0x02) AM_READ_PORT("EXTRA") AM_DEVWRITE(SOUND, "sn3", sn76496_w)
AM_RANGE(0x04, 0x04) AM_READ_PORT("DSW1")
AM_RANGE(0x05, 0x05) AM_READ_PORT("DSW2")
AM_RANGE(0x07, 0x07) AM_WRITE(sprcros2_m_port7_w)
diff --git a/src/mame/drivers/sprint2.c b/src/mame/drivers/sprint2.c
index 75c3683271d..faf734de334 100644
--- a/src/mame/drivers/sprint2.c
+++ b/src/mame/drivers/sprint2.c
@@ -71,7 +71,7 @@ static int service_mode(running_machine *machine)
static INTERRUPT_GEN( sprint2 )
{
- const address_space *space = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
+ const device_config *discrete = devtag_get_device(device->machine, SOUND, "discrete");
static UINT8 dial[2];
/* handle steering wheels */
@@ -105,9 +105,9 @@ static INTERRUPT_GEN( sprint2 )
}
}
- discrete_sound_w(space, SPRINT2_MOTORSND1_DATA, sprint2_video_ram[0x394] & 15); // also DOMINOS_FREQ_DATA
- discrete_sound_w(space, SPRINT2_MOTORSND2_DATA, sprint2_video_ram[0x395] & 15);
- discrete_sound_w(space, SPRINT2_CRASHSND_DATA, sprint2_video_ram[0x396] & 15); // also DOMINOS_AMP_DATA
+ discrete_sound_w(discrete, SPRINT2_MOTORSND1_DATA, sprint2_video_ram[0x394] & 15); // also DOMINOS_FREQ_DATA
+ discrete_sound_w(discrete, SPRINT2_MOTORSND2_DATA, sprint2_video_ram[0x395] & 15);
+ discrete_sound_w(discrete, SPRINT2_CRASHSND_DATA, sprint2_video_ram[0x396] & 15); // also DOMINOS_AMP_DATA
/* interrupts and watchdog are disabled during service mode */
@@ -209,30 +209,30 @@ static WRITE8_HANDLER( sprint2_wram_w )
}
-static WRITE8_HANDLER( sprint2_attract_w )
+static WRITE8_DEVICE_HANDLER( sprint2_attract_w )
{
attract = offset & 1;
// also DOMINOS_ATTRACT_EN
- discrete_sound_w(space, SPRINT2_ATTRACT_EN, attract);
+ discrete_sound_w(device, SPRINT2_ATTRACT_EN, attract);
}
-static WRITE8_HANDLER( sprint2_noise_reset_w )
+static WRITE8_DEVICE_HANDLER( sprint2_noise_reset_w )
{
- discrete_sound_w(space, SPRINT2_NOISE_RESET, 0);
+ discrete_sound_w(device, SPRINT2_NOISE_RESET, 0);
}
-static WRITE8_HANDLER( sprint2_skid1_w )
+static WRITE8_DEVICE_HANDLER( sprint2_skid1_w )
{
// also DOMINOS_TUMBLE_EN
- discrete_sound_w(space, SPRINT2_SKIDSND1_EN, offset & 1);
+ discrete_sound_w(device, SPRINT2_SKIDSND1_EN, offset & 1);
}
-static WRITE8_HANDLER( sprint2_skid2_w )
+static WRITE8_DEVICE_HANDLER( sprint2_skid2_w )
{
- discrete_sound_w(space, SPRINT2_SKIDSND2_EN, offset & 1);
+ discrete_sound_w(device, SPRINT2_SKIDSND2_EN, offset & 1);
}
@@ -267,9 +267,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x03ff) AM_WRITE(sprint2_wram_w)
AM_RANGE(0x0400, 0x07ff) AM_WRITE(sprint2_video_ram_w) AM_BASE(&sprint2_video_ram)
- AM_RANGE(0x0c00, 0x0c0f) AM_WRITE(sprint2_attract_w)
- AM_RANGE(0x0c10, 0x0c1f) AM_WRITE(sprint2_skid1_w)
- AM_RANGE(0x0c20, 0x0c2f) AM_WRITE(sprint2_skid2_w)
+ AM_RANGE(0x0c00, 0x0c0f) AM_DEVWRITE(SOUND, "discrete", sprint2_attract_w)
+ AM_RANGE(0x0c10, 0x0c1f) AM_DEVWRITE(SOUND, "discrete", sprint2_skid1_w)
+ AM_RANGE(0x0c20, 0x0c2f) AM_DEVWRITE(SOUND, "discrete", sprint2_skid2_w)
AM_RANGE(0x0c30, 0x0c3f) AM_WRITE(sprint2_lamp1_w)
AM_RANGE(0x0c40, 0x0c4f) AM_WRITE(sprint2_lamp2_w)
AM_RANGE(0x0c60, 0x0c6f) AM_WRITE(SMH_NOP) /* SPARE */
@@ -278,7 +278,7 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0d80, 0x0dff) AM_WRITE(sprint2_collision_reset2_w)
AM_RANGE(0x0e00, 0x0e7f) AM_WRITE(sprint2_steering_reset1_w)
AM_RANGE(0x0e80, 0x0eff) AM_WRITE(sprint2_steering_reset2_w)
- AM_RANGE(0x0f00, 0x0f7f) AM_WRITE(sprint2_noise_reset_w)
+ AM_RANGE(0x0f00, 0x0f7f) AM_DEVWRITE(SOUND, "discrete", sprint2_noise_reset_w)
AM_RANGE(0x2000, 0x3fff) AM_WRITE(SMH_ROM)
AM_RANGE(0xe000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
@@ -541,8 +541,10 @@ static MACHINE_DRIVER_START( sprint1 )
MDRV_SPEAKER_REMOVE("left")
MDRV_SPEAKER_REMOVE("right")
MDRV_SPEAKER_STANDARD_MONO("mono")
+
+ MDRV_SOUND_REMOVE("discrete")
- MDRV_SOUND_REPLACE("discrete", DISCRETE, 0)
+ MDRV_SOUND_ADD("discrete", DISCRETE, 0)
MDRV_SOUND_CONFIG_DISCRETE(sprint1)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
@@ -557,7 +559,9 @@ static MACHINE_DRIVER_START( dominos )
MDRV_SPEAKER_REMOVE("right")
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_REPLACE("discrete", DISCRETE, 0)
+ MDRV_SOUND_REMOVE("discrete")
+
+ MDRV_SOUND_ADD("discrete", DISCRETE, 0)
MDRV_SOUND_CONFIG_DISCRETE(dominos)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/sprint4.c b/src/mame/drivers/sprint4.c
index cebc145c039..24c1c4f31f7 100644
--- a/src/mame/drivers/sprint4.c
+++ b/src/mame/drivers/sprint4.c
@@ -199,41 +199,41 @@ static WRITE8_HANDLER( sprint4_lockout_w )
#endif
-static WRITE8_HANDLER( sprint4_screech_1_w )
+static WRITE8_DEVICE_HANDLER( sprint4_screech_1_w )
{
- discrete_sound_w(space, SPRINT4_SCREECH_EN_1, offset & 1);
+ discrete_sound_w(device, SPRINT4_SCREECH_EN_1, offset & 1);
}
-static WRITE8_HANDLER( sprint4_screech_2_w )
+static WRITE8_DEVICE_HANDLER( sprint4_screech_2_w )
{
- discrete_sound_w(space, SPRINT4_SCREECH_EN_2, offset & 1);
+ discrete_sound_w(device, SPRINT4_SCREECH_EN_2, offset & 1);
}
-static WRITE8_HANDLER( sprint4_screech_3_w )
+static WRITE8_DEVICE_HANDLER( sprint4_screech_3_w )
{
- discrete_sound_w(space, SPRINT4_SCREECH_EN_3, offset & 1);
+ discrete_sound_w(device, SPRINT4_SCREECH_EN_3, offset & 1);
}
-static WRITE8_HANDLER( sprint4_screech_4_w )
+static WRITE8_DEVICE_HANDLER( sprint4_screech_4_w )
{
- discrete_sound_w(space, SPRINT4_SCREECH_EN_4, offset & 1);
+ discrete_sound_w(device, SPRINT4_SCREECH_EN_4, offset & 1);
}
-static WRITE8_HANDLER( sprint4_bang_w )
+static WRITE8_DEVICE_HANDLER( sprint4_bang_w )
{
- discrete_sound_w(space, SPRINT4_BANG_DATA, data & 0x0f);
+ discrete_sound_w(device, SPRINT4_BANG_DATA, data & 0x0f);
}
-static WRITE8_HANDLER( sprint4_attract_w )
+static WRITE8_DEVICE_HANDLER( sprint4_attract_w )
{
- discrete_sound_w(space, SPRINT4_ATTRACT_EN, data & 1);
+ discrete_sound_w(device, SPRINT4_ATTRACT_EN, data & 1);
}
@@ -252,16 +252,16 @@ static ADDRESS_MAP_START( sprint4_cpu_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1000, 0x17ff) AM_READ_PORT("IN0")
AM_RANGE(0x1800, 0x1fff) AM_READ_PORT("IN1")
- AM_RANGE(0x0000, 0x0000) AM_MIRROR(0x71f) AM_WRITE(sprint4_attract_w)
+ AM_RANGE(0x0000, 0x0000) AM_MIRROR(0x71f) AM_DEVWRITE(SOUND, "discrete", sprint4_attract_w)
AM_RANGE(0x0020, 0x0027) AM_MIRROR(0x718) AM_WRITE(sprint4_collision_reset_w)
AM_RANGE(0x0040, 0x0041) AM_MIRROR(0x718) AM_WRITE(sprint4_da_latch_w)
- AM_RANGE(0x0042, 0x0043) AM_MIRROR(0x718) AM_WRITE(sprint4_bang_w)
+ AM_RANGE(0x0042, 0x0043) AM_MIRROR(0x718) AM_DEVWRITE(SOUND, "discrete", sprint4_bang_w)
AM_RANGE(0x0044, 0x0045) AM_MIRROR(0x718) AM_WRITE(watchdog_reset_w)
AM_RANGE(0x0060, 0x0067) AM_MIRROR(0x710) AM_WRITE(sprint4_lamp_w)
- AM_RANGE(0x0068, 0x0069) AM_MIRROR(0x710) AM_WRITE(sprint4_screech_1_w)
- AM_RANGE(0x006a, 0x006b) AM_MIRROR(0x710) AM_WRITE(sprint4_screech_2_w)
- AM_RANGE(0x006c, 0x006d) AM_MIRROR(0x710) AM_WRITE(sprint4_screech_3_w)
- AM_RANGE(0x006e, 0x006f) AM_MIRROR(0x710) AM_WRITE(sprint4_screech_4_w)
+ AM_RANGE(0x0068, 0x0069) AM_MIRROR(0x710) AM_DEVWRITE(SOUND, "discrete", sprint4_screech_1_w)
+ AM_RANGE(0x006a, 0x006b) AM_MIRROR(0x710) AM_DEVWRITE(SOUND, "discrete", sprint4_screech_2_w)
+ AM_RANGE(0x006c, 0x006d) AM_MIRROR(0x710) AM_DEVWRITE(SOUND, "discrete", sprint4_screech_3_w)
+ AM_RANGE(0x006e, 0x006f) AM_MIRROR(0x710) AM_DEVWRITE(SOUND, "discrete", sprint4_screech_4_w)
AM_RANGE(0x2000, 0x27ff) AM_NOP /* diagnostic ROM */
AM_RANGE(0x2800, 0x3fff) AM_ROM
diff --git a/src/mame/drivers/spy.c b/src/mame/drivers/spy.c
index 8e3da616a2e..432c384f6e4 100644
--- a/src/mame/drivers/spy.c
+++ b/src/mame/drivers/spy.c
@@ -343,10 +343,10 @@ static WRITE8_HANDLER( sound_bank_w )
bank_A = (data >> 0) & 0x03;
bank_B = (data >> 2) & 0x03;
- k007232_set_bank(0,bank_A,bank_B);
+ k007232_set_bank(devtag_get_device(space->machine, SOUND, "konami1"),bank_A,bank_B);
bank_A = (data >> 4) & 0x03;
bank_B = (data >> 6) & 0x03;
- k007232_set_bank(1,bank_A,bank_B);
+ k007232_set_bank(devtag_get_device(space->machine, SOUND, "konami2"),bank_A,bank_B);
}
@@ -380,9 +380,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( spy_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM)
- AM_RANGE(0xa000, 0xa00d) AM_READ(k007232_read_port_0_r)
- AM_RANGE(0xb000, 0xb00d) AM_READ(k007232_read_port_1_r)
- AM_RANGE(0xc000, 0xc000) AM_READ(ym3812_status_port_0_r)
+ AM_RANGE(0xa000, 0xa00d) AM_DEVREAD(SOUND, "konami1", k007232_r)
+ AM_RANGE(0xb000, 0xb00d) AM_DEVREAD(SOUND, "konami2", k007232_r)
+ AM_RANGE(0xc000, 0xc001) AM_DEVREAD(SOUND, "ym", ym3812_r)
AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -390,10 +390,9 @@ static ADDRESS_MAP_START( spy_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
AM_RANGE(0x9000, 0x9000) AM_WRITE(sound_bank_w)
- AM_RANGE(0xa000, 0xa00d) AM_WRITE(k007232_write_port_0_w)
- AM_RANGE(0xb000, 0xb00d) AM_WRITE(k007232_write_port_1_w)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0xa000, 0xa00d) AM_DEVWRITE(SOUND, "konami1", k007232_w)
+ AM_RANGE(0xb000, 0xb00d) AM_DEVWRITE(SOUND, "konami2", k007232_w)
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ym", ym3812_w)
ADDRESS_MAP_END
@@ -497,16 +496,16 @@ INPUT_PORTS_END
-static void volume_callback0(int v)
+static void volume_callback0(const device_config *device, int v)
{
- k007232_set_volume(0,0,(v >> 4) * 0x11,0);
- k007232_set_volume(0,1,0,(v & 0x0f) * 0x11);
+ k007232_set_volume(device,0,(v >> 4) * 0x11,0);
+ k007232_set_volume(device,1,0,(v & 0x0f) * 0x11);
}
-static void volume_callback1(int v)
+static void volume_callback1(const device_config *device, int v)
{
- k007232_set_volume(1,0,(v >> 4) * 0x11,0);
- k007232_set_volume(1,1,0,(v & 0x0f) * 0x11);
+ k007232_set_volume(device,0,(v >> 4) * 0x11,0);
+ k007232_set_volume(device,1,0,(v & 0x0f) * 0x11);
}
static const k007232_interface k007232_interface_1 =
@@ -520,9 +519,9 @@ static const k007232_interface k007232_interface_2 =
};
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1], INPUT_LINE_NMI, linestate);
+ cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_NMI, linestate);
}
static const ym3812_interface ym3812_config =
diff --git a/src/mame/drivers/srmp2.c b/src/mame/drivers/srmp2.c
index 897de713a00..9082c3407c1 100644
--- a/src/mame/drivers/srmp2.c
+++ b/src/mame/drivers/srmp2.c
@@ -191,7 +191,7 @@ static WRITE16_HANDLER( mjyuugi_adpcm_bank_w )
}
-static WRITE16_HANDLER( srmp2_adpcm_code_w )
+static WRITE16_DEVICE_HANDLER( srmp2_adpcm_code_w )
{
/*
- Received data may be playing ADPCM number.
@@ -200,7 +200,7 @@ static WRITE16_HANDLER( srmp2_adpcm_code_w )
table and plays the ADPCM for itself.
*/
- UINT8 *ROM = memory_region(space->machine, "adpcm");
+ UINT8 *ROM = memory_region(device->machine, "adpcm");
srmp2_adpcm_sptr = (ROM[((srmp2_adpcm_bank * 0x10000) + (data << 2) + 0)] << 8);
srmp2_adpcm_eptr = (ROM[((srmp2_adpcm_bank * 0x10000) + (data << 2) + 1)] << 8);
@@ -209,12 +209,12 @@ static WRITE16_HANDLER( srmp2_adpcm_code_w )
srmp2_adpcm_sptr += (srmp2_adpcm_bank * 0x10000);
srmp2_adpcm_eptr += (srmp2_adpcm_bank * 0x10000);
- msm5205_reset_w(0, 0);
+ msm5205_reset_w(device, 0);
srmp2_adpcm_data = -1;
}
-static WRITE8_HANDLER( srmp3_adpcm_code_w )
+static WRITE8_DEVICE_HANDLER( srmp3_adpcm_code_w )
{
/*
- Received data may be playing ADPCM number.
@@ -223,7 +223,7 @@ static WRITE8_HANDLER( srmp3_adpcm_code_w )
table and plays the ADPCM for itself.
*/
- UINT8 *ROM = memory_region(space->machine, "adpcm");
+ UINT8 *ROM = memory_region(device->machine, "adpcm");
srmp2_adpcm_sptr = (ROM[((srmp2_adpcm_bank * 0x10000) + (data << 2) + 0)] << 8);
srmp2_adpcm_eptr = (ROM[((srmp2_adpcm_bank * 0x10000) + (data << 2) + 1)] << 8);
@@ -232,7 +232,7 @@ static WRITE8_HANDLER( srmp3_adpcm_code_w )
srmp2_adpcm_sptr += (srmp2_adpcm_bank * 0x10000);
srmp2_adpcm_eptr += (srmp2_adpcm_bank * 0x10000);
- msm5205_reset_w(0, 0);
+ msm5205_reset_w(device, 0);
srmp2_adpcm_data = -1;
}
@@ -249,25 +249,25 @@ static void srmp2_adpcm_int(const device_config *device)
if (srmp2_adpcm_sptr >= srmp2_adpcm_eptr)
{
- msm5205_reset_w(0, 1);
+ msm5205_reset_w(device, 1);
srmp2_adpcm_data = 0;
srmp2_adpcm_sptr = 0;
}
else
{
- msm5205_data_w(0, ((srmp2_adpcm_data >> 4) & 0x0f));
+ msm5205_data_w(device, ((srmp2_adpcm_data >> 4) & 0x0f));
}
}
else
{
- msm5205_data_w(0, ((srmp2_adpcm_data >> 0) & 0x0f));
+ msm5205_data_w(device, ((srmp2_adpcm_data >> 0) & 0x0f));
srmp2_adpcm_sptr++;
srmp2_adpcm_data = -1;
}
}
else
{
- msm5205_reset_w(0, 1);
+ msm5205_reset_w(device, 1);
}
}
@@ -396,7 +396,7 @@ static ADDRESS_MAP_START( srmp2_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xa00002, 0xa00003) AM_READ(srmp2_input_2_r) /* I/O port 2 */
AM_RANGE(0xb00000, 0xb00001) AM_READ(srmp2_cchip_status_0_r) /* Custom chip status ??? */
AM_RANGE(0xb00002, 0xb00003) AM_READ(srmp2_cchip_status_1_r) /* Custom chip status ??? */
- AM_RANGE(0xf00000, 0xf00001) AM_READ(ay8910_read_port_0_lsb_r)
+ AM_RANGE(0xf00000, 0xf00001) AM_DEVREAD8(SOUND, "ay", ay8910_r, 0x00ff)
ADDRESS_MAP_END
static ADDRESS_MAP_START( srmp2_writemem, ADDRESS_SPACE_PROGRAM, 16 )
@@ -409,12 +409,11 @@ static ADDRESS_MAP_START( srmp2_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x900000, 0x900001) AM_WRITE(SMH_NOP) /* ??? */
AM_RANGE(0xa00000, 0xa00001) AM_WRITE(srmp2_input_1_w) /* I/O ??? */
AM_RANGE(0xa00002, 0xa00003) AM_WRITE(srmp2_input_2_w) /* I/O ??? */
- AM_RANGE(0xb00000, 0xb00001) AM_WRITE(srmp2_adpcm_code_w) /* ADPCM number */
+ AM_RANGE(0xb00000, 0xb00001) AM_DEVWRITE(SOUND, "msm", srmp2_adpcm_code_w) /* ADPCM number */
AM_RANGE(0xc00000, 0xc00001) AM_WRITE(SMH_NOP) /* ??? */
AM_RANGE(0xd00000, 0xd00001) AM_WRITE(SMH_NOP) /* ??? */
AM_RANGE(0xe00000, 0xe00001) AM_WRITE(SMH_NOP) /* ??? */
- AM_RANGE(0xf00000, 0xf00001) AM_WRITE(ay8910_control_port_0_lsb_w)
- AM_RANGE(0xf00002, 0xf00003) AM_WRITE(ay8910_write_port_0_lsb_w)
+ AM_RANGE(0xf00000, 0xf00003) AM_DEVWRITE8(SOUND, "ay", ay8910_address_data_w, 0x00ff)
ADDRESS_MAP_END
@@ -432,7 +431,7 @@ static ADDRESS_MAP_START( mjyuugi_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x900002, 0x900003) AM_READ(srmp2_input_2_r) /* I/O port 2 */
AM_RANGE(0xa00000, 0xa00001) AM_READ(srmp2_cchip_status_0_r) /* custom chip status ??? */
AM_RANGE(0xa00002, 0xa00003) AM_READ(srmp2_cchip_status_1_r) /* custom chip status ??? */
- AM_RANGE(0xb00000, 0xb00001) AM_READ(ay8910_read_port_0_lsb_r)
+ AM_RANGE(0xb00000, 0xb00001) AM_DEVREAD8(SOUND, "ay", ay8910_r, 0x00ff)
AM_RANGE(0xd00000, 0xd00609) AM_READ(SMH_RAM) /* Sprites Y */
AM_RANGE(0xd02000, 0xd023ff) AM_READ(SMH_RAM) /* ??? */
AM_RANGE(0xe00000, 0xe03fff) AM_READ(SMH_RAM) /* Sprites Code + X + Attr */
@@ -446,9 +445,8 @@ static ADDRESS_MAP_START( mjyuugi_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x700000, 0x7003ff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16)
AM_RANGE(0x900000, 0x900001) AM_WRITE(srmp2_input_1_w) /* I/O ??? */
AM_RANGE(0x900002, 0x900003) AM_WRITE(srmp2_input_2_w) /* I/O ??? */
- AM_RANGE(0xa00000, 0xa00001) AM_WRITE(srmp2_adpcm_code_w) /* ADPCM number */
- AM_RANGE(0xb00000, 0xb00001) AM_WRITE(ay8910_control_port_0_lsb_w)
- AM_RANGE(0xb00002, 0xb00003) AM_WRITE(ay8910_write_port_0_lsb_w)
+ AM_RANGE(0xa00000, 0xa00001) AM_DEVWRITE(SOUND, "msm", srmp2_adpcm_code_w) /* ADPCM number */
+ AM_RANGE(0xb00000, 0xb00003) AM_DEVWRITE8(SOUND, "ay", ay8910_address_data_w, 0x00ff)
AM_RANGE(0xc00000, 0xc00001) AM_WRITE(SMH_NOP) /* ??? */
AM_RANGE(0xd00000, 0xd00609) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) /* Sprites Y */
AM_RANGE(0xd02000, 0xd023ff) AM_WRITE(SMH_RAM) /* ??? only writes $00fa */
@@ -589,13 +587,12 @@ static ADDRESS_MAP_START( srmp3_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x20, 0x20) AM_WRITE(SMH_NOP) /* elapsed interrupt signal */
AM_RANGE(0x40, 0x40) AM_READ_PORT("SYSTEM") AM_WRITE(srmp3_flags_w) /* coin, service | GFX bank, counter, lockout */
AM_RANGE(0x60, 0x60) AM_WRITE(srmp3_rombank_w) /* ROM bank select */
- AM_RANGE(0xa0, 0xa0) AM_WRITE(srmp3_adpcm_code_w) /* ADPCM number */
+ AM_RANGE(0xa0, 0xa0) AM_DEVWRITE(SOUND, "msm", srmp3_adpcm_code_w) /* ADPCM number */
AM_RANGE(0xa1, 0xa1) AM_READ(srmp3_cchip_status_0_r) /* custom chip status ??? */
AM_RANGE(0xc0, 0xc0) AM_READWRITE(srmp3_input_r, srmp3_input_1_w) /* key matrix | I/O ??? */
AM_RANGE(0xc1, 0xc1) AM_READWRITE(srmp3_cchip_status_1_r, srmp3_input_2_w) /* custom chip status ??? | I/O ??? */
- AM_RANGE(0xe0, 0xe0) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xe1, 0xe1) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xe2, 0xe2) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0xe0, 0xe1) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0xe2, 0xe2) AM_DEVREAD(SOUND, "ay", ay8910_r)
ADDRESS_MAP_END
@@ -1023,10 +1020,10 @@ static const ay8910_interface srmp2_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_2_r, /* Input A: DSW 2 */
- input_port_1_r, /* Input B: DSW 1 */
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/srmp5.c b/src/mame/drivers/srmp5.c
index 19a21fb01f6..5c1a0ef5aab 100644
--- a/src/mame/drivers/srmp5.c
+++ b/src/mame/drivers/srmp5.c
@@ -331,7 +331,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( st0016_mem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1)
- AM_RANGE(0xe900, 0xe9ff) AM_RAM_WRITE(st0016_snd_w) AM_BASE(&st0016_sound_regs)
+ AM_RANGE(0xe900, 0xe9ff) AM_DEVREADWRITE(SOUND, "st", st0016_snd_r, st0016_snd_w)
AM_RANGE(0xec00, 0xec1f) AM_READ(st0016_character_ram_r) AM_WRITE(st0016_character_ram_w)
AM_RANGE(0xf000, 0xffff) AM_RAM
ADDRESS_MAP_END
diff --git a/src/mame/drivers/srmp6.c b/src/mame/drivers/srmp6.c
index 483a37f246f..61e776f332c 100644
--- a/src/mame/drivers/srmp6.c
+++ b/src/mame/drivers/srmp6.c
@@ -528,8 +528,8 @@ static ADDRESS_MAP_START( srmp6, ADDRESS_SPACE_PROGRAM, 16 )
// AM_RANGE(0x5fff00, 0x5fffff) AM_WRITE(dma_w) AM_BASE(&dmaram)
AM_RANGE(0x4c0000, 0x4c006f) AM_READWRITE(video_regs_r, video_regs_w) AM_BASE(&video_regs) // ? gfx regs ST-0026 NiLe
- AM_RANGE(0x4e0000, 0x4e00ff) AM_READWRITE(nile_snd_r, nile_snd_w) AM_BASE(&nile_sound_regs)
- AM_RANGE(0x4e0100, 0x4e0101) AM_READWRITE(nile_sndctrl_r, nile_sndctrl_w)
+ AM_RANGE(0x4e0000, 0x4e00ff) AM_DEVREADWRITE(SOUND, "nile", nile_snd_r, nile_snd_w) AM_BASE(&nile_sound_regs)
+ AM_RANGE(0x4e0100, 0x4e0101) AM_DEVREADWRITE(SOUND, "nile", nile_sndctrl_r, nile_sndctrl_w)
// AM_RANGE(0x4e0110, 0x4e0111) AM_NOP // ? accessed once ($268dc, written $b.w)
// AM_RANGE(0x5fff00, 0x5fff1f) AM_RAM // ? see routine $5ca8, video_regs related ???
diff --git a/src/mame/drivers/srumbler.c b/src/mame/drivers/srumbler.c
index ef6e8448fc5..5e656094794 100644
--- a/src/mame/drivers/srumbler.c
+++ b/src/mame/drivers/srumbler.c
@@ -120,10 +120,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xc000, 0xc7ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x8000, 0x8000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x8001, 0x8001) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0xa000, 0xa000) AM_WRITE(ym2203_control_port_1_w)
- AM_RANGE(0xa001, 0xa001) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0x8000, 0x8001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0xa000, 0xa001) AM_DEVWRITE(SOUND, "ym2", ym2203_w)
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/sshangha.c b/src/mame/drivers/sshangha.c
index 687188c45bf..d07989a93b6 100644
--- a/src/mame/drivers/sshangha.c
+++ b/src/mame/drivers/sshangha.c
@@ -190,15 +190,14 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
- AM_RANGE(0xc000, 0xc000) AM_READ(ym2203_status_port_0_r)
+ AM_RANGE(0xc000, 0xc001) AM_DEVREAD(SOUND, "ym", ym2203_r)
AM_RANGE(0xf800, 0xffff) AM_READ(SMH_RAM)
// AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ym", ym2203_w)
AM_RANGE(0xf800, 0xffff) AM_WRITE(SMH_RAM)
ADDRESS_MAP_END
@@ -324,9 +323,9 @@ GFXDECODE_END
/******************************************************************************/
-static void irqhandler(running_machine *machine, int state)
+static void irqhandler(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1],0,state);
+ cpu_set_input_line(device->machine->cpu[1],0,state);
}
static const ym2203_interface ym2203_config =
@@ -334,7 +333,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
irqhandler
};
diff --git a/src/mame/drivers/ssingles.c b/src/mame/drivers/ssingles.c
index 18e9fbc8405..b055acb4295 100644
--- a/src/mame/drivers/ssingles.c
+++ b/src/mame/drivers/ssingles.c
@@ -173,11 +173,11 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( ssingles_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x04, 0x04) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x06, 0x06) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0x00, 0x00) AM_DEVWRITE(SOUND, "ay1", ay8910_address_w)
+ AM_RANGE(0x04, 0x04) AM_DEVWRITE(SOUND, "ay1", ay8910_data_w)
+ AM_RANGE(0x06, 0x06) AM_DEVWRITE(SOUND, "ay2", ay8910_address_w)
AM_RANGE(0x08, 0x08) AM_READNOP
- AM_RANGE(0x0a, 0x0a) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0x0a, 0x0a) AM_DEVWRITE(SOUND, "ay2", ay8910_data_w)
AM_RANGE(0x16, 0x16) AM_READ_PORT("DSW0")
AM_RANGE(0x18, 0x18) AM_READ_PORT("DSW1")
AM_RANGE(0x1c, 0x1c) AM_READ_PORT("INPUTS")
diff --git a/src/mame/drivers/sslam.c b/src/mame/drivers/sslam.c
index f3d635d326b..319032412f3 100644
--- a/src/mame/drivers/sslam.c
+++ b/src/mame/drivers/sslam.c
@@ -242,9 +242,9 @@ VIDEO_UPDATE(powerbls);
static TIMER_CALLBACK( music_playback )
{
int pattern = 0;
- const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const device_config *device = devtag_get_device(machine, SOUND, "oki");
- if ((okim6295_status_0_r(space,0) & 0x08) == 0)
+ if ((okim6295_r(device,0) & 0x08) == 0)
{
if (sslam_bar != 0) {
sslam_bar += 1;
@@ -265,8 +265,8 @@ static TIMER_CALLBACK( music_playback )
}
if (pattern) {
logerror("Changing bar in music track to pattern %02x\n",pattern);
- okim6295_data_0_w(space,0,(0x80 | pattern));
- okim6295_data_0_w(space,0,0x81);
+ okim6295_w(device,0,(0x80 | pattern));
+ okim6295_w(device,0,0x81);
}
}
// {
@@ -276,9 +276,9 @@ static TIMER_CALLBACK( music_playback )
}
-static void sslam_play(const address_space *space, int track, int data)
+static void sslam_play(const device_config *device, int track, int data)
{
- int status = okim6295_status_0_r(space,0);
+ int status = okim6295_r(device,0);
if (data < 0x80) {
if (track) {
@@ -286,24 +286,24 @@ static void sslam_play(const address_space *space, int track, int data)
sslam_track = data;
sslam_bar = 1;
if (status & 0x08)
- okim6295_data_0_w(space,0,0x40);
- okim6295_data_0_w(space,0,(0x80 | data));
- okim6295_data_0_w(space,0,0x81);
+ okim6295_w(device,0,0x40);
+ okim6295_w(device,0,(0x80 | data));
+ okim6295_w(device,0,0x81);
timer_adjust_periodic(music_timer, ATTOTIME_IN_MSEC(4), 0, ATTOTIME_IN_HZ(250)); /* 250Hz for smooth sequencing */
}
}
else {
if ((status & 0x01) == 0) {
- okim6295_data_0_w(space,0,(0x80 | data));
- okim6295_data_0_w(space,0,0x11);
+ okim6295_w(device,0,(0x80 | data));
+ okim6295_w(device,0,0x11);
}
else if ((status & 0x02) == 0) {
- okim6295_data_0_w(space,0,(0x80 | data));
- okim6295_data_0_w(space,0,0x21);
+ okim6295_w(device,0,(0x80 | data));
+ okim6295_w(device,0,0x21);
}
else if ((status & 0x04) == 0) {
- okim6295_data_0_w(space,0,(0x80 | data));
- okim6295_data_0_w(space,0,0x41);
+ okim6295_w(device,0,(0x80 | data));
+ okim6295_w(device,0,0x41);
}
}
}
@@ -315,20 +315,20 @@ static void sslam_play(const address_space *space, int track, int data)
sslam_bar = 0;
}
data &= 0x7f;
- okim6295_data_0_w(space,0,data);
+ okim6295_w(device,0,data);
}
}
-static WRITE16_HANDLER( sslam_snd_w )
+static WRITE16_DEVICE_HANDLER( sslam_snd_w )
{
if (ACCESSING_BITS_0_7)
{
- logerror("PC:%06x Writing %04x to Sound CPU\n",cpu_get_previouspc(space->cpu),data);
+ logerror("%s Writing %04x to Sound CPU\n",cpuexec_describe_context(device->machine),data);
if (data >= 0x40) {
if (data == 0xfe) {
/* This should reset the sound MCU and stop audio playback, but here, it */
/* chops the first coin insert. So let's only stop any playing melodies. */
- sslam_play(space, 1, (0x80 | 0x40)); /* Stop playing the melody */
+ sslam_play(device, 1, (0x80 | 0x40)); /* Stop playing the melody */
}
else {
logerror("Unknown command (%02x) sent to the Sound controller\n",data);
@@ -348,13 +348,13 @@ static WRITE16_HANDLER( sslam_snd_w )
else if (sslam_sound >= 0x70) {
/* These vocals are in bank 1, but a bug in the actual MCU doesn't set the bank */
// if (sslam_snd_bank != 1)
-// okim6295_set_bank_base(0, (1 * 0x40000));
+// okim6295_set_bank_base(device, (1 * 0x40000));
// sslam_snd_bank = 1;
- sslam_play(space, 0, sslam_sound);
+ sslam_play(device, 0, sslam_sound);
}
else if (sslam_sound >= 0x69) {
if (sslam_snd_bank != 2)
- okim6295_set_bank_base(0, (2 * 0x40000));
+ okim6295_set_bank_base(device, (2 * 0x40000));
sslam_snd_bank = 2;
switch (sslam_sound)
{
@@ -363,18 +363,18 @@ static WRITE16_HANDLER( sslam_snd_w )
case 0x6c: sslam_melody = 7; break;
default: sslam_melody = 0; sslam_bar = 0; break; /* Invalid */
}
- sslam_play(space, sslam_melody, sslam_sound);
+ sslam_play(device, sslam_melody, sslam_sound);
}
else if (sslam_sound >= 0x65) {
if (sslam_snd_bank != 1)
- okim6295_set_bank_base(0, (1 * 0x40000));
+ okim6295_set_bank_base(device, (1 * 0x40000));
sslam_snd_bank = 1;
sslam_melody = 4;
- sslam_play(space, sslam_melody, sslam_sound);
+ sslam_play(device, sslam_melody, sslam_sound);
}
else if (sslam_sound >= 0x60) {
if (sslam_snd_bank != 0)
- okim6295_set_bank_base(0, (0 * 0x40000));
+ okim6295_set_bank_base(device, (0 * 0x40000));
sslam_snd_bank = 0;
switch (sslam_sound)
{
@@ -383,10 +383,10 @@ static WRITE16_HANDLER( sslam_snd_w )
case 0x64: sslam_melody = 3; break;
default: sslam_melody = 0; sslam_bar = 0; break; /* Invalid */
}
- sslam_play(space, sslam_melody, sslam_sound);
+ sslam_play(device, sslam_melody, sslam_sound);
}
else {
- sslam_play(space, 0, sslam_sound);
+ sslam_play(device, 0, sslam_sound);
}
}
}
@@ -421,7 +421,7 @@ static ADDRESS_MAP_START( sslam_program_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x300018, 0x300019) AM_READ_PORT("IN4")
AM_RANGE(0x30001a, 0x30001b) AM_READ_PORT("DSW1")
AM_RANGE(0x30001c, 0x30001d) AM_READ_PORT("DSW2")
- AM_RANGE(0x30001e, 0x30001f) AM_WRITE(sslam_snd_w)
+ AM_RANGE(0x30001e, 0x30001f) AM_DEVWRITE(SOUND, "oki", sslam_snd_w)
AM_RANGE(0xf00000, 0xffffff) AM_RAM /* Main RAM */
AM_RANGE(0x000000, 0xffffff) AM_ROM /* I don't honestly know where the rom is mirrored .. so all unmapped reads / writes go to rom */
@@ -458,7 +458,7 @@ static READ8_HANDLER( playmark_snd_command_r )
data = soundlatch_r(space,0);
}
else if ((playmark_oki_control & 0x38) == 0x28) {
- data = (okim6295_status_0_r(space,0) & 0x0f);
+ data = (okim6295_r(devtag_get_device(space->machine, SOUND, "oki"),0) & 0x0f);
}
return data;
@@ -478,13 +478,13 @@ static WRITE8_HANDLER( playmark_snd_control_w )
if(playmark_oki_bank != ((data & 3) - 1))
{
playmark_oki_bank = (data & 3) - 1;
- okim6295_set_bank_base(0, 0x40000 * playmark_oki_bank);
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki"), 0x40000 * playmark_oki_bank);
}
}
if ((data & 0x38) == 0x18)
{
- okim6295_data_0_w(space, 0, playmark_oki_command);
+ okim6295_w(devtag_get_device(space->machine, SOUND, "oki"), 0, playmark_oki_command);
}
// !(data & 0x80) -> sound enable
diff --git a/src/mame/drivers/ssozumo.c b/src/mame/drivers/ssozumo.c
index 1e420d7a0bb..95e91b5a18b 100644
--- a/src/mame/drivers/ssozumo.c
+++ b/src/mame/drivers/ssozumo.c
@@ -101,11 +101,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x01ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x2000, 0x2000) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x2001, 0x2001) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x2002, 0x2002) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x2003, 0x2003) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x2004, 0x2004) AM_WRITE(dac_0_signed_data_w)
+ AM_RANGE(0x2000, 0x2001) AM_DEVWRITE(SOUND, "ay1", ay8910_data_address_w)
+ AM_RANGE(0x2002, 0x2003) AM_DEVWRITE(SOUND, "ay2", ay8910_data_address_w)
+ AM_RANGE(0x2004, 0x2004) AM_DEVWRITE(SOUND, "dac", dac_signed_w)
AM_RANGE(0x2005, 0x2005) AM_WRITE(interrupt_enable_w)
AM_RANGE(0x4000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/ssrj.c b/src/mame/drivers/ssrj.c
index 9399b63d541..9a1ba00cefe 100644
--- a/src/mame/drivers/ssrj.c
+++ b/src/mame/drivers/ssrj.c
@@ -74,7 +74,7 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xf000, 0xf000) AM_READ_PORT("IN0")
AM_RANGE(0xf001, 0xf001) AM_READ(ssrj_wheel_r)
AM_RANGE(0xf002, 0xf002) AM_READ_PORT("IN2")
- AM_RANGE(0xf401, 0xf401) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0xf401, 0xf401) AM_DEVREAD(SOUND, "ay", ay8910_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
@@ -86,8 +86,7 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xe000, 0xe7ff) AM_WRITE(SMH_RAM)
AM_RANGE(0xe800, 0xefff) AM_WRITE(SMH_RAM) AM_BASE(&ssrj_scrollram)
AM_RANGE(0xf003, 0xf003) AM_WRITE(SMH_NOP) /* unknown */
- AM_RANGE(0xf401, 0xf401) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xf400, 0xf400) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0xf400, 0xf401) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
AM_RANGE(0xfc00, 0xfc00) AM_WRITE(SMH_NOP) /* unknown */
AM_RANGE(0xf800, 0xf800) AM_WRITE(SMH_NOP) /* wheel ? */
ADDRESS_MAP_END
@@ -155,10 +154,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, /* not used ? */
- input_port_3_r,
- NULL,
- NULL
+ DEVCB_NULL, /* not used ? */
+ DEVCB_INPUT_PORT("IN3"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/ssv.c b/src/mame/drivers/ssv.c
index 1f3ef26188c..44f0c54c4a0 100644
--- a/src/mame/drivers/ssv.c
+++ b/src/mame/drivers/ssv.c
@@ -435,7 +435,7 @@ static READ16_HANDLER( fake_r ) { return ssv_scroll[offset]; }
AM_RANGE(0x21000a, 0x21000b) AM_READ_PORT("P2") \
AM_RANGE(0x21000c, 0x21000d) AM_READ_PORT("SYSTEM") \
AM_RANGE(0x21000e, 0x21000f) AM_READ(SMH_NOP ) /* */ \
- AM_RANGE(0x300000, 0x30007f) AM_READ(es5506_data_0_word_r ) /* Sound */ \
+ AM_RANGE(0x300000, 0x30007f) AM_DEVREAD8(SOUND, "ensoniq", es5506_r, 0x00ff ) /* Sound */ \
AM_RANGE(0x482000, 0x482fff) AM_RAM_WRITE(dsp_w) AM_BASE(&dsp_ram) \
AM_RANGE(_ROM, 0xffffff) AM_READ(SMH_BANK1 ) /* ROM */ \
//AM_RANGE(0x990000, 0x99007f) AM_READ(fake_r)
@@ -451,7 +451,7 @@ static READ16_HANDLER( fake_r ) { return ssv_scroll[offset]; }
AM_RANGE(0x230000, 0x230071) AM_WRITE(SMH_RAM) AM_BASE(&ssv_irq_vectors) /* IRQ Vectors */ \
AM_RANGE(0x240000, 0x240071) AM_WRITE(ssv_irq_ack_w ) /* IRQ Ack */ \
AM_RANGE(0x260000, 0x260001) AM_WRITE(ssv_irq_enable_w) /* IRQ Enable */ \
- AM_RANGE(0x300000, 0x30007f) AM_WRITE(es5506_data_0_word_w) /* Sound */ \
+ AM_RANGE(0x300000, 0x30007f) AM_DEVWRITE8(SOUND, "ensoniq", es5506_w, 0x00ff) /* Sound */ \
//AM_RANGE(0x990000, 0x99007f) AM_WRITE(ssv_scroll_w)
@@ -835,10 +835,11 @@ static WRITE16_HANDLER( srmp7_sound_bank_w )
{
if (ACCESSING_BITS_0_7)
{
+ const device_config *device = devtag_get_device(space->machine, SOUND, "ensoniq");
int bank = 0x400000/2 * (data & 1); // UINT16 address
int voice;
for (voice = 0; voice < 32; voice++)
- es5506_voice_bank_0_w(voice, bank);
+ es5506_voice_bank_w(device, voice, bank);
}
// popmessage("%04X",data);
}
diff --git a/src/mame/drivers/st0016.c b/src/mame/drivers/st0016.c
index 6006d3d8c84..b4929ed7572 100644
--- a/src/mame/drivers/st0016.c
+++ b/src/mame/drivers/st0016.c
@@ -34,7 +34,7 @@ static ADDRESS_MAP_START( st0016_mem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xd000, 0xdfff) AM_READ(st0016_sprite2_ram_r) AM_WRITE(st0016_sprite2_ram_w)
AM_RANGE(0xe000, 0xe7ff) AM_RAM
AM_RANGE(0xe800, 0xe87f) AM_RAM /* common ram */
- AM_RANGE(0xe900, 0xe9ff) AM_RAM_WRITE(st0016_snd_w) AM_BASE(&st0016_sound_regs) /* sound regs 8 x $20 bytes, see notes */
+ AM_RANGE(0xe900, 0xe9ff) AM_DEVREADWRITE(SOUND, "st", st0016_snd_r, st0016_snd_w) /* sound regs 8 x $20 bytes, see notes */
AM_RANGE(0xea00, 0xebff) AM_READ(st0016_palette_ram_r) AM_WRITE(st0016_palette_ram_w)
AM_RANGE(0xec00, 0xec1f) AM_READ(st0016_character_ram_r) AM_WRITE(st0016_character_ram_w)
AM_RANGE(0xf000, 0xffff) AM_RAM /* work ram */
diff --git a/src/mame/drivers/stadhero.c b/src/mame/drivers/stadhero.c
index d388a2c451b..34042635934 100644
--- a/src/mame/drivers/stadhero.c
+++ b/src/mame/drivers/stadhero.c
@@ -78,36 +78,12 @@ ADDRESS_MAP_END
/******************************************************************************/
-static WRITE8_HANDLER( YM3812_w )
-{
- switch (offset) {
- case 0:
- ym3812_control_port_0_w(space,0,data);
- break;
- case 1:
- ym3812_write_port_0_w(space,0,data);
- break;
- }
-}
-
-static WRITE8_HANDLER( YM2203_w )
-{
- switch (offset) {
- case 0:
- ym2203_control_port_0_w(space,0,data);
- break;
- case 1:
- ym2203_write_port_0_w(space,0,data);
- break;
- }
-}
-
static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x05ff) AM_RAM
- AM_RANGE(0x0800, 0x0801) AM_WRITE(YM2203_w)
- AM_RANGE(0x1000, 0x1001) AM_WRITE(YM3812_w)
+ AM_RANGE(0x0800, 0x0801) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x1000, 0x1001) AM_DEVWRITE(SOUND, "ym2", ym3812_w)
AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r)
- AM_RANGE(0x3800, 0x3800) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x3800, 0x3800) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -231,9 +207,9 @@ GFXDECODE_END
/******************************************************************************/
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1],0,linestate);
+ cpu_set_input_line(device->machine->cpu[1],0,linestate);
}
static const ym3812_interface ym3812_config =
diff --git a/src/mame/drivers/starshp1.c b/src/mame/drivers/starshp1.c
index 34dbd47b42f..e341cbdfd68 100644
--- a/src/mame/drivers/starshp1.c
+++ b/src/mame/drivers/starshp1.c
@@ -23,7 +23,7 @@ static INTERRUPT_GEN( starshp1_interrupt )
}
-static WRITE8_HANDLER( starshp1_audio_w )
+static WRITE8_DEVICE_HANDLER( starshp1_audio_w )
{
data &= 1;
@@ -31,26 +31,26 @@ static WRITE8_HANDLER( starshp1_audio_w )
{
case 0:
starshp1_attract = data;
- discrete_sound_w(space, STARSHP1_ATTRACT, data);
+ discrete_sound_w(device, STARSHP1_ATTRACT, data);
break;
case 1:
starshp1_phasor = data;
- discrete_sound_w(space, STARSHP1_PHASOR_ON, data);
+ discrete_sound_w(device, STARSHP1_PHASOR_ON, data);
break;
case 2:
- discrete_sound_w(space, STARSHP1_KICKER, data);
+ discrete_sound_w(device, STARSHP1_KICKER, data);
break;
case 3:
- discrete_sound_w(space, STARSHP1_SL1, data);
+ discrete_sound_w(device, STARSHP1_SL1, data);
break;
case 4:
- discrete_sound_w(space, STARSHP1_SL2, data);
+ discrete_sound_w(device, STARSHP1_SL2, data);
break;
case 5:
- discrete_sound_w(space, STARSHP1_MOLVL, data);
+ discrete_sound_w(device, STARSHP1_MOLVL, data);
break;
case 6:
- discrete_sound_w(space, STARSHP1_NOISE_FREQ, data);
+ discrete_sound_w(device, STARSHP1_NOISE_FREQ, data);
break;
}
@@ -101,7 +101,7 @@ static WRITE8_HANDLER( starshp1_analog_in_w )
}
-static WRITE8_HANDLER( starshp1_analog_out_w )
+static WRITE8_DEVICE_HANDLER( starshp1_analog_out_w )
{
switch (offset & 7)
{
@@ -109,13 +109,13 @@ static WRITE8_HANDLER( starshp1_analog_out_w )
starshp1_ship_size = data;
break;
case 2:
- discrete_sound_w(space, STARSHP1_NOISE_AMPLITUDE, data);
+ discrete_sound_w(device, STARSHP1_NOISE_AMPLITUDE, data);
break;
case 3:
- discrete_sound_w(space, STARSHP1_TONE_PITCH, data);
+ discrete_sound_w(device, STARSHP1_TONE_PITCH, data);
break;
case 4:
- discrete_sound_w(space, STARSHP1_MOTOR_SPEED, data);
+ discrete_sound_w(device, STARSHP1_MOTOR_SPEED, data);
break;
case 5:
starshp1_circle_hpos = data;
@@ -186,8 +186,8 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xd800, 0xd80f) AM_WRITE(starshp1_collision_reset_w)
AM_RANGE(0xdc00, 0xdc0f) AM_WRITE(starshp1_misc_w)
AM_RANGE(0xdd00, 0xdd0f) AM_WRITE(starshp1_analog_in_w)
- AM_RANGE(0xde00, 0xde0f) AM_WRITE(starshp1_audio_w)
- AM_RANGE(0xdf00, 0xdf0f) AM_WRITE(starshp1_analog_out_w)
+ AM_RANGE(0xde00, 0xde0f) AM_DEVWRITE(SOUND, "discrete", starshp1_audio_w)
+ AM_RANGE(0xdf00, 0xdf0f) AM_DEVWRITE(SOUND, "discrete", starshp1_analog_out_w)
AM_RANGE(0xf000, 0xffff) AM_WRITE(SMH_ROM)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/statriv2.c b/src/mame/drivers/statriv2.c
index 814a1ba6ddc..9764d3e3675 100644
--- a/src/mame/drivers/statriv2.c
+++ b/src/mame/drivers/statriv2.c
@@ -338,7 +338,7 @@ static ADDRESS_MAP_START( statriv2_readport, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x20, 0x20) AM_READ_PORT("IN0")
AM_RANGE(0x21, 0x21) AM_READ_PORT("IN1")
AM_RANGE(0x2b, 0x2b) AM_READ(statriv2_questions_read) // question data
- AM_RANGE(0xb1, 0xb1) AM_READ(ay8910_read_port_0_r) // ???
+ AM_RANGE(0xb1, 0xb1) AM_DEVREAD(SOUND, "ay", ay8910_r) // ???
AM_RANGE(0xce, 0xce) AM_READ(SMH_NOP) // ???
ADDRESS_MAP_END
@@ -347,8 +347,7 @@ static ADDRESS_MAP_START( statriv2_writeport, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x23, 0x23) AM_WRITE(SMH_NOP) // ???
AM_RANGE(0x29, 0x29) AM_WRITE(question_offset_low_w)
AM_RANGE(0x2a, 0x2a) AM_WRITE(question_offset_high_w)
- AM_RANGE(0xb0, 0xb0) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xb1, 0xb1) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0xb0, 0xb1) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
AM_RANGE(0xc0, 0xcf) AM_WRITE(SMH_NOP) // ???
ADDRESS_MAP_END
@@ -356,7 +355,7 @@ static ADDRESS_MAP_START( statriv4_readport, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x20, 0x20) AM_READ_PORT("IN0")
AM_RANGE(0x21, 0x21) AM_READ_PORT("IN1")
AM_RANGE(0x28, 0x28) AM_READ(statriv2_questions_read) // question data
- AM_RANGE(0xb1, 0xb1) AM_READ(ay8910_read_port_0_r) // ???
+ AM_RANGE(0xb1, 0xb1) AM_DEVREAD(SOUND, "ay", ay8910_r) // ???
AM_RANGE(0xce, 0xce) AM_READ(SMH_NOP) // ???
ADDRESS_MAP_END
@@ -365,8 +364,7 @@ static ADDRESS_MAP_START( statriv4_writeport, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x23, 0x23) AM_WRITE(SMH_NOP) // ???
AM_RANGE(0x29, 0x29) AM_WRITE(question_offset_high_w)
AM_RANGE(0x2a, 0x2a) AM_WRITE(question_offset_low_w)
- AM_RANGE(0xb0, 0xb0) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xb1, 0xb1) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0xb0, 0xb1) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
AM_RANGE(0xc0, 0xcf) AM_WRITE(SMH_NOP) // ???
ADDRESS_MAP_END
@@ -374,7 +372,7 @@ static ADDRESS_MAP_START( supertr2_readport, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x20, 0x20) AM_READ_PORT("IN0")
AM_RANGE(0x21, 0x21) AM_READ_PORT("IN1")
AM_RANGE(0x28, 0x28) AM_READ(supertr2_questions_read) // question data
- AM_RANGE(0xb1, 0xb1) AM_READ(ay8910_read_port_0_r) // ???
+ AM_RANGE(0xb1, 0xb1) AM_DEVREAD(SOUND, "ay", ay8910_r) // ???
AM_RANGE(0xce, 0xce) AM_READ(SMH_NOP) // ???
ADDRESS_MAP_END
@@ -384,8 +382,7 @@ static ADDRESS_MAP_START( supertr2_writeport, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x28, 0x28) AM_WRITE(question_offset_low_w)
AM_RANGE(0x29, 0x29) AM_WRITE(question_offset_med_w)
AM_RANGE(0x2a, 0x2a) AM_WRITE(question_offset_high_w)
- AM_RANGE(0xb0, 0xb0) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xb1, 0xb1) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0xb0, 0xb1) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
AM_RANGE(0xc0, 0xcf) AM_WRITE(SMH_NOP) // ???
ADDRESS_MAP_END
@@ -394,8 +391,7 @@ static ADDRESS_MAP_START( trivquiz_writeport, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x23, 0x23) AM_WRITE(SMH_NOP) // ???
AM_RANGE(0x28, 0x28) AM_WRITE(question_offset_low_w)
AM_RANGE(0x29, 0x29) AM_WRITE(question_offset_high_w)
- AM_RANGE(0xb0, 0xb0) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xb1, 0xb1) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0xb0, 0xb1) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
AM_RANGE(0xc0, 0xcf) AM_WRITE(SMH_NOP) // ???
ADDRESS_MAP_END
@@ -403,7 +399,7 @@ static ADDRESS_MAP_START( trivquiz_readport, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x20, 0x20) AM_READ_PORT("IN0")
AM_RANGE(0x21, 0x21) AM_READ_PORT("IN1")
AM_RANGE(0x2a, 0x2a) AM_READ(statriv2_questions_read) // question data
- AM_RANGE(0xb1, 0xb1) AM_READ(ay8910_read_port_0_r) // ???
+ AM_RANGE(0xb1, 0xb1) AM_DEVREAD(SOUND, "ay", ay8910_r) // ???
AM_RANGE(0xce, 0xce) AM_READ(SMH_NOP) // ???
ADDRESS_MAP_END
@@ -411,7 +407,7 @@ static ADDRESS_MAP_START( supertr3_readport, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x20, 0x20) AM_READ_PORT("IN0")
AM_RANGE(0x21, 0x21) AM_READ_PORT("IN1")
AM_RANGE(0x28, 0x28) AM_READ(supertr3_questions_read) // question data
- AM_RANGE(0xb1, 0xb1) AM_READ(ay8910_read_port_0_r) // ???
+ AM_RANGE(0xb1, 0xb1) AM_DEVREAD(SOUND, "ay", ay8910_r) // ???
AM_RANGE(0xce, 0xce) AM_READ(SMH_NOP) // ???
ADDRESS_MAP_END
@@ -419,15 +415,15 @@ static ADDRESS_MAP_START( hangman_readport, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x20, 0x20) AM_READ_PORT("IN0")
AM_RANGE(0x21, 0x21) AM_READ_PORT("IN1")
AM_RANGE(0x28, 0x28) AM_READ(hangman_questions_read) // question data
- AM_RANGE(0xb1, 0xb1) AM_READ(ay8910_read_port_0_r) // ???
+ AM_RANGE(0xb1, 0xb1) AM_DEVREAD(SOUND, "ay", ay8910_r) // ???
AM_RANGE(0xce, 0xce) AM_READ(SMH_NOP) // ???
ADDRESS_MAP_END
static ADDRESS_MAP_START( statusbj_io, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x20, 0x23) AM_DEVREADWRITE(PPI8255, "ppi8255_0", ppi8255_r, ppi8255_w)
- AM_RANGE(0xb0, 0xb0) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xb1, 0xb1) AM_READWRITE(ay8910_read_port_0_r,ay8910_write_port_0_w)
+ AM_RANGE(0xb0, 0xb1) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0xb1, 0xb1) AM_DEVREAD(SOUND, "ay", ay8910_r)
AM_RANGE(0xc0, 0xcf) AM_READWRITE(SMH_NOP, SMH_NOP) /* 9927 CRT controller? */
// AM_RANGE(0xce,0xce) AM_READ(test_r)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/stfight.c b/src/mame/drivers/stfight.c
index e2018f5e8b0..57eede70d4b 100644
--- a/src/mame/drivers/stfight.c
+++ b/src/mame/drivers/stfight.c
@@ -254,7 +254,7 @@ static ADDRESS_MAP_START( writemem_cpu1, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xc000, 0xc0ff) AM_WRITE(SMH_RAM) AM_BASE(&paletteram)
AM_RANGE(0xc100, 0xc1ff) AM_WRITE(SMH_RAM) AM_BASE(&paletteram_2)
AM_RANGE(0xc500, 0xc500) AM_WRITE(stfight_fm_w) /* play fm sound */
- AM_RANGE(0xc600, 0xc600) AM_WRITE(stfight_adpcm_control_w) /* voice control */
+ AM_RANGE(0xc600, 0xc600) AM_DEVWRITE(SOUND, "msm", stfight_adpcm_control_w) /* voice control */
AM_RANGE(0xc700, 0xc700) AM_WRITE(stfight_coin_w) /* coin mech */
AM_RANGE(0xc804, 0xc806) AM_WRITE(SMH_NOP) /* TBD */
AM_RANGE(0xc807, 0xc807) AM_WRITE(stfight_sprite_bank_w)
@@ -268,8 +268,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( readmem_cpu2, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
- AM_RANGE(0xc001, 0xc001) AM_READ(ym2203_read_port_0_r)
- AM_RANGE(0xc801, 0xc801) AM_READ(ym2203_read_port_1_r)
+ AM_RANGE(0xc000, 0xc001) AM_DEVREAD(SOUND, "ym1", ym2203_r)
+ AM_RANGE(0xc800, 0xc801) AM_DEVREAD(SOUND, "ym2", ym2203_r)
AM_RANGE(0xf000, 0xf000) AM_READ(stfight_fm_r)
AM_RANGE(0xf800, 0xffff) AM_READ(SMH_RAM)
@@ -277,10 +277,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem_cpu2, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0xc800, 0xc800) AM_WRITE(ym2203_control_port_1_w)
- AM_RANGE(0xc801, 0xc801) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0xc800, 0xc801) AM_DEVWRITE(SOUND, "ym2", ym2203_w)
AM_RANGE(0xe800, 0xe800) AM_WRITE(stfight_e800_w)
AM_RANGE(0xf800, 0xffff) AM_WRITE(SMH_RAM)
diff --git a/src/mame/drivers/stlforce.c b/src/mame/drivers/stlforce.c
index e6cb9f75b10..1efaf5e90e1 100644
--- a/src/mame/drivers/stlforce.c
+++ b/src/mame/drivers/stlforce.c
@@ -95,9 +95,9 @@ static WRITE16_HANDLER( eeprom_w )
}
}
-static WRITE16_HANDLER( oki_bank_w )
+static WRITE16_DEVICE_HANDLER( oki_bank_w )
{
- okim6295_set_bank_base(0, 0x40000 * ((data>>8) & 3));
+ okim6295_set_bank_base(device, 0x40000 * ((data>>8) & 3));
}
static ADDRESS_MAP_START( stlforce_map, ADDRESS_SPACE_PROGRAM, 16 )
@@ -118,9 +118,9 @@ static ADDRESS_MAP_START( stlforce_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x400000, 0x400001) AM_READ_PORT("INPUT")
AM_RANGE(0x400002, 0x400003) AM_READ_PORT("SYSTEM")
AM_RANGE(0x400010, 0x400011) AM_WRITE(eeprom_w)
- AM_RANGE(0x400012, 0x400013) AM_WRITE(oki_bank_w)
+ AM_RANGE(0x400012, 0x400013) AM_DEVWRITE(SOUND, "oki", oki_bank_w)
AM_RANGE(0x40001e, 0x40001f) AM_WRITENOP // sprites buffer commands
- AM_RANGE(0x410000, 0x410001) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x410000, 0x410001) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
ADDRESS_MAP_END
static INPUT_PORTS_START( stlforce )
diff --git a/src/mame/drivers/strnskil.c b/src/mame/drivers/strnskil.c
index 23fa070b18d..53e083a099f 100644
--- a/src/mame/drivers/strnskil.c
+++ b/src/mame/drivers/strnskil.c
@@ -126,8 +126,8 @@ static ADDRESS_MAP_START( strnskil_writemem2, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xc000, 0xc7ff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0xc800, 0xcfff) AM_WRITE(SMH_RAM) AM_SHARE(1)
- AM_RANGE(0xd801, 0xd801) AM_WRITE(sn76496_0_w)
- AM_RANGE(0xd802, 0xd802) AM_WRITE(sn76496_1_w)
+ AM_RANGE(0xd801, 0xd801) AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0xd802, 0xd802) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/stv.c b/src/mame/drivers/stv.c
index f3184fd4abb..c8a578e62f7 100644
--- a/src/mame/drivers/stv.c
+++ b/src/mame/drivers/stv.c
@@ -1952,19 +1952,6 @@ static READ32_HANDLER( stv_sh2_soundram_r )
return (sound_ram[offset*2]<<16)|sound_ram[offset*2+1];
}
-static READ32_HANDLER( stv_scsp_regs_r32 )
-{
- offset <<= 1;
- return (scsp_0_r(space, offset+1, 0xffff) | (scsp_0_r(space, offset, 0xffff)<<16));
-}
-
-static WRITE32_HANDLER( stv_scsp_regs_w32 )
-{
- offset <<= 1;
- scsp_0_w(space, offset, data>>16, mem_mask >> 16);
- scsp_0_w(space, offset+1, data, mem_mask);
-}
-
/* communication,SLAVE CPU acquires data from the MASTER CPU and triggers an irq. *
* Enter into Radiant Silver Gun specific menu for a test... */
static WRITE32_HANDLER( minit_w )
@@ -2005,7 +1992,7 @@ static ADDRESS_MAP_START( stv_mem, ADDRESS_SPACE_PROGRAM, 32 )
/* Sound */
AM_RANGE(0x05a00000, 0x05a7ffff) AM_READWRITE(stv_sh2_soundram_r, stv_sh2_soundram_w)
//AM_RANGE(0x05a80000, 0x05afffff) AM_READ(stv_sh2_random_r)
- AM_RANGE(0x05b00000, 0x05b00fff) AM_READWRITE(stv_scsp_regs_r32, stv_scsp_regs_w32)
+ AM_RANGE(0x05b00000, 0x05b00fff) AM_DEVREADWRITE16(SOUND, "scsp", scsp_r, scsp_w, 0xffffffff)
/* VDP1 */
AM_RANGE(0x05c00000, 0x05c7ffff) AM_READWRITE(stv_vdp1_vram_r, stv_vdp1_vram_w)
AM_RANGE(0x05c80000, 0x05cbffff) AM_READWRITE(stv_vdp1_framebuffer0_r, stv_vdp1_framebuffer0_w)
@@ -2021,7 +2008,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_mem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_RAM AM_BASE(&sound_ram)
- AM_RANGE(0x100000, 0x100fff) AM_READWRITE(scsp_0_r, scsp_0_w)
+ AM_RANGE(0x100000, 0x100fff) AM_DEVREADWRITE(SOUND, "scsp", scsp_r, scsp_w)
ADDRESS_MAP_END
#define STV_PLAYER_INPUTS(_n_, _b1_, _b2_, _b3_) \
@@ -2472,7 +2459,7 @@ static const sh2_cpu_core sh2_conf_slave = { 1, NULL };
static int scsp_last_line = 0;
-static void scsp_irq(running_machine *machine, int irq)
+static void scsp_irq(const device_config *device, int irq)
{
// don't bother the 68k if it's off
if (!en_68k)
@@ -2483,15 +2470,15 @@ static void scsp_irq(running_machine *machine, int irq)
if (irq > 0)
{
scsp_last_line = irq;
- cpu_set_input_line(machine->cpu[2], irq, ASSERT_LINE);
+ cpu_set_input_line(device->machine->cpu[2], irq, ASSERT_LINE);
}
else if (irq < 0)
{
- cpu_set_input_line(machine->cpu[2], -irq, CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[2], -irq, CLEAR_LINE);
}
else
{
- cpu_set_input_line(machine->cpu[2], scsp_last_line, CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[2], scsp_last_line, CLEAR_LINE);
}
}
@@ -2503,7 +2490,7 @@ static const scsp_interface scsp_config =
static MACHINE_START( stv )
{
- SCSP_set_ram_base(0, sound_ram);
+ scsp_set_ram_base(devtag_get_device(machine, SOUND, "scsp"), sound_ram);
// save states
state_save_register_global_pointer(machine, smpc_ram, 0x80);
diff --git a/src/mame/drivers/subs.c b/src/mame/drivers/subs.c
index 16b852ddc86..826dfdac77d 100644
--- a/src/mame/drivers/subs.c
+++ b/src/mame/drivers/subs.c
@@ -58,16 +58,16 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
- AM_RANGE(0x0000, 0x0000) AM_WRITE(subs_noise_reset_w)
+ AM_RANGE(0x0000, 0x0000) AM_DEVWRITE(SOUND, "discrete", subs_noise_reset_w)
AM_RANGE(0x0020, 0x0020) AM_WRITE(subs_steer_reset_w)
// AM_RANGE(0x0040, 0x0040) AM_WRITE(subs_timer_reset_w)
AM_RANGE(0x0060, 0x0061) AM_WRITE(subs_lamp1_w)
AM_RANGE(0x0062, 0x0063) AM_WRITE(subs_lamp2_w)
- AM_RANGE(0x0064, 0x0065) AM_WRITE(subs_sonar2_w)
- AM_RANGE(0x0066, 0x0067) AM_WRITE(subs_sonar1_w)
+ AM_RANGE(0x0064, 0x0065) AM_DEVWRITE(SOUND, "discrete", subs_sonar2_w)
+ AM_RANGE(0x0066, 0x0067) AM_DEVWRITE(SOUND, "discrete", subs_sonar1_w)
// Schematics show crash and explode reversed. But this is proper.
- AM_RANGE(0x0068, 0x0069) AM_WRITE(subs_explode_w)
- AM_RANGE(0x006a, 0x006b) AM_WRITE(subs_crash_w)
+ AM_RANGE(0x0068, 0x0069) AM_DEVWRITE(SOUND, "discrete", subs_explode_w)
+ AM_RANGE(0x006a, 0x006b) AM_DEVWRITE(SOUND, "discrete", subs_crash_w)
AM_RANGE(0x006c, 0x006d) AM_WRITE(subs_invert1_w)
AM_RANGE(0x006e, 0x006f) AM_WRITE(subs_invert2_w)
AM_RANGE(0x0090, 0x009f) AM_WRITE(SMH_RAM) AM_BASE(&spriteram)
diff --git a/src/mame/drivers/subsino.c b/src/mame/drivers/subsino.c
index 4e6797cee28..a0ff31802ce 100644
--- a/src/mame/drivers/subsino.c
+++ b/src/mame/drivers/subsino.c
@@ -120,10 +120,9 @@ static ADDRESS_MAP_START( srider_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE( 0x0d00c, 0x0d00c ) AM_READ_PORT( "INC" )
- AM_RANGE( 0x0d016, 0x0d016 ) AM_WRITE( ym3812_control_port_0_w )
- AM_RANGE( 0x0d017, 0x0d017 ) AM_WRITE( ym3812_write_port_0_w )
+ AM_RANGE( 0x0d016, 0x0d017 ) AM_DEVWRITE( SOUND, "ym", ym3812_w )
- AM_RANGE( 0x0d018, 0x0d018 ) AM_WRITE( okim6295_data_0_w )
+ AM_RANGE( 0x0d018, 0x0d018 ) AM_DEVWRITE( SOUND, "oki", okim6295_w )
AM_RANGE( 0x0d01b, 0x0d01b ) AM_WRITE( subsino_tiles_offset_w )
diff --git a/src/mame/drivers/suna16.c b/src/mame/drivers/suna16.c
index 4ac2abd7c17..ec9ec363a65 100644
--- a/src/mame/drivers/suna16.c
+++ b/src/mame/drivers/suna16.c
@@ -28,7 +28,7 @@ Year + Game By Board Hardware
#include "sound/dac.h"
#include "sound/2151intf.h"
#include "sound/ay8910.h"
-#include "sound/3812intf.h"
+#include "sound/3526intf.h"
/* Variables and functions defined in video: */
@@ -254,15 +254,14 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( bssoccer_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0xf000, 0xf7ff) AM_READ(SMH_RAM ) // RAM
- AM_RANGE(0xf801, 0xf801) AM_READ(ym2151_status_port_0_r ) // YM2151
+ AM_RANGE(0xf800, 0xf801) AM_DEVREAD(SOUND, "ym", ym2151_r ) // YM2151
AM_RANGE(0xfc00, 0xfc00) AM_READ(soundlatch_r ) // From Main CPU
ADDRESS_MAP_END
static ADDRESS_MAP_START( bssoccer_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM ) // ROM
AM_RANGE(0xf000, 0xf7ff) AM_WRITE(SMH_RAM ) // RAM
- AM_RANGE(0xf800, 0xf800) AM_WRITE(ym2151_register_port_0_w ) // YM2151
- AM_RANGE(0xf801, 0xf801) AM_WRITE(ym2151_data_port_0_w ) //
+ AM_RANGE(0xf800, 0xf801) AM_DEVWRITE(SOUND, "ym", ym2151_w ) // YM2151
AM_RANGE(0xfd00, 0xfd00) AM_WRITE(soundlatch2_w ) // To PCM Z80 #1
AM_RANGE(0xfe00, 0xfe00) AM_WRITE(soundlatch3_w ) // To PCM Z80 #2
ADDRESS_MAP_END
@@ -274,15 +273,14 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( uballoon_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0xf000, 0xf7ff) AM_READ(SMH_RAM ) // RAM
- AM_RANGE(0xf801, 0xf801) AM_READ(ym2151_status_port_0_r ) // YM2151
+ AM_RANGE(0xf800, 0xf801) AM_DEVREAD(SOUND, "ym", ym2151_r ) // YM2151
AM_RANGE(0xfc00, 0xfc00) AM_READ(soundlatch_r ) // From Main CPU
ADDRESS_MAP_END
static ADDRESS_MAP_START( uballoon_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_WRITE(SMH_ROM ) // ROM
AM_RANGE(0xf000, 0xf7ff) AM_WRITE(SMH_RAM ) // RAM
- AM_RANGE(0xf800, 0xf800) AM_WRITE(ym2151_register_port_0_w ) // YM2151
- AM_RANGE(0xf801, 0xf801) AM_WRITE(ym2151_data_port_0_w ) //
+ AM_RANGE(0xf800, 0xf801) AM_DEVWRITE(SOUND, "ym", ym2151_w ) // YM2151
AM_RANGE(0xfc00, 0xfc00) AM_WRITE(soundlatch2_w ) // To PCM Z80
ADDRESS_MAP_END
@@ -293,15 +291,14 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sunaq_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xe82f) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0xe830, 0xf7ff) AM_READ(SMH_RAM ) // RAM
- AM_RANGE(0xf801, 0xf801) AM_READ(ym2151_status_port_0_r ) // YM2151
+ AM_RANGE(0xf800, 0xf801) AM_DEVREAD(SOUND, "ym", ym2151_r ) // YM2151
AM_RANGE(0xfc00, 0xfc00) AM_READ(soundlatch_r ) // From Main CPU
ADDRESS_MAP_END
static ADDRESS_MAP_START( sunaq_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xe82f) AM_WRITE(SMH_ROM ) // ROM
AM_RANGE(0xe830, 0xf7ff) AM_WRITE(SMH_RAM ) // RAM (writes to efxx, could be a program bug tho)
- AM_RANGE(0xf800, 0xf800) AM_WRITE(ym2151_register_port_0_w ) // YM2151
- AM_RANGE(0xf801, 0xf801) AM_WRITE(ym2151_data_port_0_w ) //
+ AM_RANGE(0xf800, 0xf801) AM_DEVWRITE(SOUND, "ym", ym2151_w ) // YM2151
AM_RANGE(0xfc00, 0xfc00) AM_WRITE(soundlatch2_w ) // To PCM Z80
ADDRESS_MAP_END
@@ -311,10 +308,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( bestbest_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE( 0x0000, 0xbfff ) AM_ROM // ROM
- AM_RANGE( 0xc000, 0xc000 ) AM_WRITE( ym3526_control_port_0_w ) // YM3526
- AM_RANGE( 0xc001, 0xc001 ) AM_WRITE( ym3526_write_port_0_w ) //
- AM_RANGE( 0xc002, 0xc002 ) AM_WRITE( ay8910_control_port_0_w ) // AY8910
- AM_RANGE( 0xc003, 0xc003 ) AM_WRITE( ay8910_write_port_0_w ) //
+ AM_RANGE( 0xc000, 0xc001 ) AM_DEVWRITE( SOUND, "ym", ym3526_w ) //
+ AM_RANGE( 0xc002, 0xc003 ) AM_DEVWRITE( SOUND, "ay", ay8910_address_data_w ) // AY8910
AM_RANGE( 0xe000, 0xe7ff ) AM_RAM // RAM
AM_RANGE( 0xf000, 0xf000 ) AM_WRITE( soundlatch2_w ) // To PCM Z80
AM_RANGE( 0xf800, 0xf800 ) AM_READ ( soundlatch_r ) // From Main CPU
@@ -379,12 +374,12 @@ ADDRESS_MAP_END
static WRITE8_HANDLER( bssoccer_DAC_1_w )
{
- dac_data_w( 0 + (offset & 1), (data & 0xf) * 0x11 );
+ dac_data_w( devtag_get_device(space->machine, SOUND, (offset & 1) ? "dac2" : "dac1"), (data & 0xf) * 0x11 );
}
static WRITE8_HANDLER( bssoccer_DAC_2_w )
{
- dac_data_w( 2 + (offset & 1), (data & 0xf) * 0x11 );
+ dac_data_w( devtag_get_device(space->machine, SOUND, (offset & 1) ? "dac4" : "dac3"), (data & 0xf) * 0x11 );
}
static ADDRESS_MAP_START( bssoccer_pcm_1_io_map, ADDRESS_SPACE_IO, 8 )
@@ -998,9 +993,9 @@ MACHINE_DRIVER_END
Best Of Best
***************************************************************************/
-static void bestbest_ym3526_irqhandler(running_machine *machine, int state)
+static void bestbest_ym3526_irqhandler(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1], INPUT_LINE_IRQ0, state);
+ cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_IRQ0, state);
}
static const ym3526_interface bestbest_ym3526_interface =
@@ -1008,7 +1003,7 @@ static const ym3526_interface bestbest_ym3526_interface =
bestbest_ym3526_irqhandler
};
-static WRITE8_HANDLER( bestbest_ay8910_port_a_w )
+static WRITE8_DEVICE_HANDLER( bestbest_ay8910_port_a_w )
{
// ?
}
@@ -1017,8 +1012,8 @@ static const ay8910_interface bestbest_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL,
- bestbest_ay8910_port_a_w, NULL
+ DEVCB_NULL, DEVCB_NULL,
+ DEVCB_HANDLER(bestbest_ay8910_port_a_w), DEVCB_NULL
};
static MACHINE_DRIVER_START( bestbest )
diff --git a/src/mame/drivers/suna8.c b/src/mame/drivers/suna8.c
index c2603e4a5a8..0cca6051d84 100644
--- a/src/mame/drivers/suna8.c
+++ b/src/mame/drivers/suna8.c
@@ -964,7 +964,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( hardhead_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0xc000, 0xc7ff) AM_READ(SMH_RAM ) // RAM
- AM_RANGE(0xc800, 0xc800) AM_READ(ym3812_status_port_0_r ) // ? unsure
+ AM_RANGE(0xc800, 0xc800) AM_DEVREAD(SOUND, "ym", ym3812_status_port_r) // ? unsure
AM_RANGE(0xd800, 0xd800) AM_READ(soundlatch_r ) // From Main CPU
ADDRESS_MAP_END
@@ -972,10 +972,8 @@ static ADDRESS_MAP_START( hardhead_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM ) // ROM
AM_RANGE(0xc000, 0xc7ff) AM_WRITE(SMH_RAM ) // RAM
AM_RANGE(0xd000, 0xd000) AM_WRITE(soundlatch2_w ) //
- AM_RANGE(0xa000, 0xa000) AM_WRITE(ym3812_control_port_0_w ) // YM3812
- AM_RANGE(0xa001, 0xa001) AM_WRITE(ym3812_write_port_0_w )
- AM_RANGE(0xa002, 0xa002) AM_WRITE(ay8910_control_port_0_w ) // AY8910
- AM_RANGE(0xa003, 0xa003) AM_WRITE(ay8910_write_port_0_w )
+ AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE(SOUND, "ym", ym3812_r, ym3812_w)
+ AM_RANGE(0xa002, 0xa003) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w )
ADDRESS_MAP_END
@@ -999,10 +997,8 @@ static ADDRESS_MAP_START( rranger_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM ) // ROM
AM_RANGE(0xc000, 0xc7ff) AM_WRITE(SMH_RAM ) // RAM
AM_RANGE(0xd000, 0xd000) AM_WRITE(soundlatch2_w ) //
- AM_RANGE(0xa000, 0xa000) AM_WRITE(ym2203_control_port_0_w ) // YM2203
- AM_RANGE(0xa001, 0xa001) AM_WRITE(ym2203_write_port_0_w )
- AM_RANGE(0xa002, 0xa002) AM_WRITE(ym2203_control_port_1_w ) // AY8910
- AM_RANGE(0xa003, 0xa003) AM_WRITE(ym2203_write_port_1_w )
+ AM_RANGE(0xa000, 0xa001) AM_DEVWRITE(SOUND, "ym1", ym2203_w )
+ AM_RANGE(0xa002, 0xa003) AM_DEVWRITE(SOUND, "ym2", ym2203_w )
ADDRESS_MAP_END
@@ -1018,10 +1014,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( brickzn_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_WRITE(SMH_ROM ) // ROM
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym3812_control_port_0_w ) // YM3812
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ym3812_write_port_0_w )
- AM_RANGE(0xc002, 0xc002) AM_WRITE(ay8910_control_port_0_w ) // AY8910
- AM_RANGE(0xc003, 0xc003) AM_WRITE(ay8910_write_port_0_w )
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ym", ym3812_w )
+ AM_RANGE(0xc002, 0xc003) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w )
AM_RANGE(0xe000, 0xe7ff) AM_WRITE(SMH_RAM ) // RAM
AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch2_w ) // To PCM CPU
ADDRESS_MAP_END
@@ -1039,7 +1033,8 @@ ADDRESS_MAP_END
static WRITE8_HANDLER( brickzn_pcm_w )
{
- dac_signed_data_w( offset, (data & 0xf) * 0x11 );
+ static const char *dacs[] = { "dac1", "dac2", "dac3", "dac4" };
+ dac_signed_data_w( devtag_get_device(space->machine, SOUND, dacs[offset & 3]), (data & 0xf) * 0x11 );
}
@@ -1451,9 +1446,9 @@ GFXDECODE_END
***************************************************************************/
-static void soundirq(running_machine *machine, int state)
+static void soundirq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1], 0, state);
+ cpu_set_input_line(device->machine->cpu[1], 0, state);
}
/* In games with only 2 CPUs, port A&B of the AY8910 are used
@@ -1469,10 +1464,10 @@ static const ay8910_interface hardhead_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- suna8_play_samples_w,
- suna8_samples_number_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_DEVICE_HANDLER(SOUND, "samples", suna8_play_samples_w),
+ DEVCB_DEVICE_HANDLER(SOUND, "samples", suna8_samples_number_w)
};
static const samples_interface suna8_samples_interface =
@@ -1688,10 +1683,10 @@ static const ay8910_interface starfigh_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- suna8_play_samples_w,
- suna8_samples_number_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_DEVICE_HANDLER(SOUND, "samples", suna8_play_samples_w),
+ DEVCB_DEVICE_HANDLER(SOUND, "samples", suna8_samples_number_w)
};
static MACHINE_DRIVER_START( starfigh )
diff --git a/src/mame/drivers/supbtime.c b/src/mame/drivers/supbtime.c
index 62a74bf2937..d8835760367 100644
--- a/src/mame/drivers/supbtime.c
+++ b/src/mame/drivers/supbtime.c
@@ -117,24 +117,12 @@ ADDRESS_MAP_END
/******************************************************************************/
-static WRITE8_HANDLER( YM2151_w )
-{
- switch (offset) {
- case 0:
- ym2151_register_port_0_w(space,0,data);
- break;
- case 1:
- ym2151_data_port_0_w(space,0,data);
- break;
- }
-}
-
/* Physical memory map (21 bits) */
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_READ(SMH_ROM)
AM_RANGE(0x100000, 0x100001) AM_READ(SMH_NOP)
- AM_RANGE(0x110000, 0x110001) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0x120000, 0x120001) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x110000, 0x110001) AM_DEVREAD(SOUND, "ym", ym2151_r)
+ AM_RANGE(0x120000, 0x120001) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0x130000, 0x130001) AM_READ(SMH_NOP) /* This board only has 1 oki chip */
AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
AM_RANGE(0x1f0000, 0x1f1fff) AM_READ(SMH_BANK8)
@@ -143,8 +131,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_WRITE(SMH_ROM)
AM_RANGE(0x100000, 0x100001) AM_WRITE(SMH_NOP) /* YM2203 - this board doesn't have one */
- AM_RANGE(0x110000, 0x110001) AM_WRITE(YM2151_w)
- AM_RANGE(0x120000, 0x120001) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0x110000, 0x110001) AM_DEVWRITE(SOUND, "ym", ym2151_w)
+ AM_RANGE(0x120000, 0x120001) AM_DEVWRITE(SOUND, "oki", okim6295_w)
AM_RANGE(0x130000, 0x130001) AM_WRITE(SMH_NOP)
AM_RANGE(0x1f0000, 0x1f1fff) AM_WRITE(SMH_BANK8)
AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w)
@@ -353,9 +341,9 @@ GFXDECODE_END
/******************************************************************************/
-static void sound_irq(running_machine *machine, int state)
+static void sound_irq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1],1,state); /* IRQ 2 */
+ cpu_set_input_line(device->machine->cpu[1],1,state); /* IRQ 2 */
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/supdrapo.c b/src/mame/drivers/supdrapo.c
index 0ccc067ffff..63593888e74 100644
--- a/src/mame/drivers/supdrapo.c
+++ b/src/mame/drivers/supdrapo.c
@@ -58,8 +58,7 @@ static ADDRESS_MAP_START( sdpoker_mem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8006, 0x8006) AM_READ_PORT("IN5") //dips?
AM_RANGE(0x9000, 0x90ff) AM_RAM
AM_RANGE(0x9400, 0x9400) AM_READ(sdpoker_rng_r)
- AM_RANGE(0x9800, 0x9800) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x9801, 0x9801) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x9800, 0x9801) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
ADDRESS_MAP_END
static INPUT_PORTS_START( supdrapo )
diff --git a/src/mame/drivers/superdq.c b/src/mame/drivers/superdq.c
index 44f78124d97..5cd8a67f8ea 100644
--- a/src/mame/drivers/superdq.c
+++ b/src/mame/drivers/superdq.c
@@ -24,7 +24,6 @@
#include "cpu/z80/z80.h"
#include "render.h"
#include "sound/sn76496.h"
-#include "sound/custom.h"
#include "machine/laserdsc.h"
#include "video/resnet.h"
@@ -187,7 +186,7 @@ static ADDRESS_MAP_START( superdq_io, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1")
AM_RANGE(0x02, 0x02) AM_READ_PORT("DSW1")
AM_RANGE(0x03, 0x03) AM_READ_PORT("DSW2")
- AM_RANGE(0x04, 0x04) AM_READWRITE(superdq_ld_r,sn76496_0_w)
+ AM_RANGE(0x04, 0x04) AM_READ(superdq_ld_r) AM_DEVWRITE(SOUND, "sn", sn76496_w)
AM_RANGE(0x08, 0x08) AM_WRITE(superdq_io_w)
AM_RANGE(0x0c, 0x0d) AM_NOP /* HD46505S */
ADDRESS_MAP_END
@@ -326,8 +325,7 @@ static MACHINE_DRIVER_START( superdq )
MDRV_SOUND_ADD("sn", SN76496, MASTER_CLOCK/8)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.8)
- MDRV_SOUND_ADD("ldsound", CUSTOM, 0)
- MDRV_SOUND_CONFIG(laserdisc_custom_interface)
+ MDRV_SOUND_ADD("ldsound", LASERDISC, 0)
MDRV_SOUND_ROUTE(0, "left", 1.0)
MDRV_SOUND_ROUTE(1, "right", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/superqix.c b/src/mame/drivers/superqix.c
index 391c745517c..e98e87b9eec 100644
--- a/src/mame/drivers/superqix.c
+++ b/src/mame/drivers/superqix.c
@@ -149,6 +149,7 @@ static SAMPLES_START( pbillian_sh_start )
static WRITE8_HANDLER( pbillian_sample_trigger_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
int start,end;
start = data << 7;
@@ -157,7 +158,7 @@ static WRITE8_HANDLER( pbillian_sample_trigger_w )
while (end < 0x8000 && samplebuf[end] != (0xff^0x80))
end++;
- sample_start_raw(0, samplebuf + start, end - start, 5000, 0); // 5khz ?
+ sample_start_raw(samples, 0, samplebuf + start, end - start, 5000, 0); // 5khz ?
}
@@ -195,13 +196,13 @@ The MCU acts this way:
static UINT8 port1, port3, port3_latch, from_mcu, from_z80, portb;
static int from_mcu_pending, from_z80_pending, invert_coin_lockout;
-static READ8_HANDLER( in4_mcu_r )
+static READ8_DEVICE_HANDLER( in4_mcu_r )
{
// logerror("%04x: in4_mcu_r\n",cpu_get_pc(space->cpu));
- return input_port_read(space->machine, "P2") | (from_mcu_pending << 6) | (from_z80_pending << 7);
+ return input_port_read(device->machine, "P2") | (from_mcu_pending << 6) | (from_z80_pending << 7);
}
-static READ8_HANDLER( sqix_from_mcu_r )
+static READ8_DEVICE_HANDLER( sqix_from_mcu_r )
{
// logerror("%04x: read mcu answer (%02x)\n",cpu_get_pc(space->cpu),from_mcu);
return from_mcu;
@@ -220,7 +221,7 @@ static READ8_HANDLER( mcu_acknowledge_r )
return 0;
}
-static WRITE8_HANDLER( sqix_z80_mcu_w )
+static WRITE8_DEVICE_HANDLER( sqix_z80_mcu_w )
{
// logerror("%04x: sqix_z80_mcu_w %02x\n",cpu_get_pc(space->cpu),data);
portb = data;
@@ -298,9 +299,9 @@ static READ8_HANDLER( nmi_ack_r )
return 0;
}
-static READ8_HANDLER( bootleg_in0_r )
+static READ8_DEVICE_HANDLER( bootleg_in0_r )
{
- return BITSWAP8(input_port_read(space->machine, "DSW1"), 0,1,2,3,4,5,6,7);
+ return BITSWAP8(input_port_read(device->machine, "DSW1"), 0,1,2,3,4,5,6,7);
}
static WRITE8_HANDLER( bootleg_flipscreen_w )
@@ -449,10 +450,10 @@ logerror("%04x: z80 reads answer %02x\n",cpu_get_pc(space->cpu),from_mcu);
return from_mcu;
}
-static READ8_HANDLER(hotsmash_ay_port_a_r)
+static READ8_DEVICE_HANDLER(hotsmash_ay_port_a_r)
{
//logerror("%04x: ay_port_a_r and mcu_pending is %d\n",cpu_get_pc(space->cpu),from_mcu_pending);
- return input_port_read(space->machine, "SYSTEM") | ((from_mcu_pending^1) << 7);
+ return input_port_read(device->machine, "SYSTEM") | ((from_mcu_pending^1) << 7);
}
/**************************************************************************
@@ -484,11 +485,11 @@ static READ8_HANDLER(pbillian_from_mcu_r)
return 0;
}
-static READ8_HANDLER(pbillian_ay_port_a_r)
+static READ8_DEVICE_HANDLER(pbillian_ay_port_a_r)
{
// logerror("%04x: ay_port_a_r\n",cpu_get_pc(space->cpu));
/* bits 76------ MCU status bits */
- return (mame_rand(space->machine) & 0xc0) | input_port_read(space->machine, "BUTTONS");
+ return (mame_rand(device->machine) & 0xc0) | input_port_read(device->machine, "BUTTONS");
}
@@ -538,9 +539,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( pbillian_port_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x0000, 0x01ff) AM_RAM_WRITE(paletteram_BBGGRRII_w) AM_BASE(&paletteram)
- AM_RANGE(0x0401, 0x0401) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x0402, 0x0402) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x0403, 0x0403) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x0401, 0x0401) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x0402, 0x0403) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
AM_RANGE(0x0408, 0x0408) AM_READ(pbillian_from_mcu_r)
AM_RANGE(0x0408, 0x0408) AM_WRITE(pbillian_z80_mcu_w)
AM_RANGE(0x0410, 0x0410) AM_WRITE(pbillian_0410_w)
@@ -552,9 +552,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( hotsmash_port_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x0000, 0x01ff) AM_RAM_WRITE(paletteram_BBGGRRII_w) AM_BASE(&paletteram)
- AM_RANGE(0x0401, 0x0401) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x0402, 0x0402) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x0403, 0x0403) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x0401, 0x0401) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x0402, 0x0403) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
AM_RANGE(0x0408, 0x0408) AM_READ(hotsmash_from_mcu_r)
AM_RANGE(0x0408, 0x0408) AM_WRITE(hotsmash_z80_mcu_w)
AM_RANGE(0x0410, 0x0410) AM_WRITE(pbillian_0410_w)
@@ -566,12 +565,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sqix_port_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x0000, 0x00ff) AM_RAM_WRITE(paletteram_BBGGRRII_w) AM_BASE(&paletteram)
- AM_RANGE(0x0401, 0x0401) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x0402, 0x0402) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x0403, 0x0403) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x0405, 0x0405) AM_READ(ay8910_read_port_1_r)
- AM_RANGE(0x0406, 0x0406) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x0407, 0x0407) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0x0401, 0x0401) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0x0402, 0x0403) AM_DEVWRITE(SOUND, "ay1", ay8910_data_address_w)
+ AM_RANGE(0x0405, 0x0405) AM_DEVREAD(SOUND, "ay2", ay8910_r)
+ AM_RANGE(0x0406, 0x0407) AM_DEVWRITE(SOUND, "ay2", ay8910_data_address_w)
AM_RANGE(0x0408, 0x0408) AM_READ(mcu_acknowledge_r)
AM_RANGE(0x0410, 0x0410) AM_WRITE(superqix_0410_w) /* ROM bank, NMI enable, tile bank */
AM_RANGE(0x0418, 0x0418) AM_READ(nmi_ack_r)
@@ -581,12 +578,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( bootleg_port_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x0000, 0x00ff) AM_RAM_WRITE(paletteram_BBGGRRII_w) AM_BASE(&paletteram)
- AM_RANGE(0x0401, 0x0401) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x0402, 0x0402) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x0403, 0x0403) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x0405, 0x0405) AM_READ(ay8910_read_port_1_r)
- AM_RANGE(0x0406, 0x0406) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x0407, 0x0407) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0x0401, 0x0401) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0x0402, 0x0403) AM_DEVWRITE(SOUND, "ay1", ay8910_data_address_w)
+ AM_RANGE(0x0405, 0x0405) AM_DEVREAD(SOUND, "ay2", ay8910_r)
+ AM_RANGE(0x0406, 0x0407) AM_DEVWRITE(SOUND, "ay2", ay8910_data_address_w)
AM_RANGE(0x0408, 0x0408) AM_WRITE(bootleg_flipscreen_w)
AM_RANGE(0x0410, 0x0410) AM_WRITE(superqix_0410_w) /* ROM bank, NMI enable, tile bank */
AM_RANGE(0x0418, 0x0418) AM_READ_PORT("SYSTEM")
@@ -907,60 +902,60 @@ static const ay8910_interface pbillian_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- pbillian_ay_port_a_r, /* port Aread */
- input_port_2_r, /* port Bread */
- NULL,
- NULL
+ DEVCB_HANDLER(pbillian_ay_port_a_r), /* port Aread */
+ DEVCB_INPUT_PORT("SYSTEM"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface hotsmash_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- hotsmash_ay_port_a_r, /* port Aread */
- input_port_2_r, /* port Bread */
- NULL,
- NULL
+ DEVCB_HANDLER(hotsmash_ay_port_a_r), /* port Aread */
+ DEVCB_INPUT_PORT("SYSTEM"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface sqix_ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_3_r, /* port Aread */
- in4_mcu_r, /* port Bread */
- NULL,
- NULL
+ DEVCB_INPUT_PORT("P1"),
+ DEVCB_HANDLER(in4_mcu_r), /* port Bread */
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface sqix_ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_1_r, /* port Aread */
- sqix_from_mcu_r, /* port Bread */
- NULL, /* port Awrite */
- sqix_z80_mcu_w /* port Bwrite */
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_HANDLER(sqix_from_mcu_r), /* port Bread */
+ DEVCB_NULL, /* port Awrite */
+ DEVCB_HANDLER(sqix_z80_mcu_w) /* port Bwrite */
};
static const ay8910_interface bootleg_ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_3_r, /* port Aread */
- input_port_4_r, /* port Bread */
- NULL,
- NULL
+ DEVCB_INPUT_PORT("P1"),
+ DEVCB_INPUT_PORT("P2"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface bootleg_ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_1_r, /* port Aread */
- bootleg_in0_r, /* port Bread */
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_HANDLER(bootleg_in0_r), /* port Bread */
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/supertnk.c b/src/mame/drivers/supertnk.c
index 09347475679..e18df7a7a37 100644
--- a/src/mame/drivers/supertnk.c
+++ b/src/mame/drivers/supertnk.c
@@ -296,8 +296,9 @@ static ADDRESS_MAP_START( supertnk_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1800, 0x1bff) AM_RAM
AM_RANGE(0x1efc, 0x1efc) AM_READ_PORT("JOYS")
AM_RANGE(0x1efd, 0x1efd) AM_READ_PORT("INPUTS")
- AM_RANGE(0x1efe, 0x1efe) AM_READ_PORT("DSW") AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x1eff, 0x1eff) AM_READ_PORT("UNK") AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x1efe, 0x1eff) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0x1efe, 0x1efe) AM_READ_PORT("DSW")
+ AM_RANGE(0x1eff, 0x1eff) AM_READ_PORT("UNK")
AM_RANGE(0x2000, 0x3fff) AM_READWRITE(supertnk_videoram_r, supertnk_videoram_w) AM_SIZE(&supertnk_videoram_size)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/suprgolf.c b/src/mame/drivers/suprgolf.c
index f00c2b10fe0..4cab9e89931 100644
--- a/src/mame/drivers/suprgolf.c
+++ b/src/mame/drivers/suprgolf.c
@@ -105,8 +105,7 @@ static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x05, 0x05) AM_READ_PORT("IN4") AM_WRITE(rom_bank_select_w)
AM_RANGE(0x06, 0x06) AM_READ(suprgolf_random) // game locks up or crashes? if this doesn't return right values?
- AM_RANGE(0x08, 0x08) AM_READ(ym2203_status_port_0_r) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x09, 0x09) AM_READ(ym2203_read_port_0_r) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0x08, 0x09) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
ADDRESS_MAP_END
static INPUT_PORTS_START( suprgolf )
@@ -247,19 +246,19 @@ static INPUT_PORTS_START( suprgolf )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
INPUT_PORTS_END
-static WRITE8_HANDLER( suprgolf_writeA )
+static WRITE8_DEVICE_HANDLER( suprgolf_writeA )
{
mame_printf_debug("ymwA\n");
}
-static WRITE8_HANDLER( suprgolf_writeB )
+static WRITE8_DEVICE_HANDLER( suprgolf_writeB )
{
mame_printf_debug("ymwA\n");
}
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
-// cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+// cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface ym2203_config =
@@ -267,10 +266,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_5_r,
- input_port_6_r,
- suprgolf_writeA,
- suprgolf_writeB,
+ DEVCB_INPUT_PORT("DSW0"),
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_HANDLER(suprgolf_writeA),
+ DEVCB_HANDLER(suprgolf_writeB),
},
irqhandler
};
diff --git a/src/mame/drivers/suprloco.c b/src/mame/drivers/suprloco.c
index e03ecaffddd..46baf4e80e9 100644
--- a/src/mame/drivers/suprloco.c
+++ b/src/mame/drivers/suprloco.c
@@ -58,8 +58,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
- AM_RANGE(0xa000, 0xa003) AM_WRITE(sn76496_0_w)
- AM_RANGE(0xc000, 0xc003) AM_WRITE(sn76496_1_w)
+ AM_RANGE(0xa000, 0xa003) AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0xc000, 0xc003) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/suprnova.c b/src/mame/drivers/suprnova.c
index 47ef5d4f7ae..014e584aca6 100644
--- a/src/mame/drivers/suprnova.c
+++ b/src/mame/drivers/suprnova.c
@@ -762,14 +762,6 @@ static WRITE32_HANDLER( skns_v3t_w )
btiles[offset*4+3] = (data & 0x000000ff) >> 0;
}
-static WRITE32_HANDLER( skns_ymz280_w )
-{
- if (ACCESSING_BITS_24_31)
- ymz280b_register_0_w(space,offset,(data >> 24) & 0xff);
- if (ACCESSING_BITS_16_23)
- ymz280b_data_0_w(space,offset,(data >> 16) & 0xff);
-}
-
static ADDRESS_MAP_START( skns_readmem, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x00000000, 0x0007ffff) AM_READ(SMH_ROM) /* BIOS ROM */
AM_RANGE(0x00400000, 0x00400003) AM_READ_PORT("400000")
@@ -798,7 +790,7 @@ static ADDRESS_MAP_START( skns_writemem, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x00000000, 0x0007ffff) AM_WRITE(SMH_ROM) /* BIOS ROM */
AM_RANGE(0x00400000, 0x0040000f) AM_WRITE(skns_io_w) /* I/O Write */
AM_RANGE(0x00800000, 0x00801fff) AM_WRITE(SMH_RAM) AM_BASE(&generic_nvram32) AM_SIZE(&generic_nvram_size) /* 'backup' RAM */
- AM_RANGE(0x00c00000, 0x00c00003) AM_WRITE(skns_ymz280_w) /* ymz280_w (sound) */
+ AM_RANGE(0x00c00000, 0x00c00003) AM_DEVWRITE8(SOUND, "ymz", ymz280b_w, 0xffff0000) /* ymz280_w (sound) */
AM_RANGE(0x01000000, 0x0100000f) AM_WRITE(skns_msm6242_w)
AM_RANGE(0x01800000, 0x01800003) AM_WRITE(skns_hit2_w)
AM_RANGE(0x02000000, 0x02003fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram32) AM_SIZE(&spriteram_size) /* sprite ram */
diff --git a/src/mame/drivers/suprridr.c b/src/mame/drivers/suprridr.c
index 8deaa400eb3..b4c251d293c 100644
--- a/src/mame/drivers/suprridr.c
+++ b/src/mame/drivers/suprridr.c
@@ -128,7 +128,7 @@ static WRITE8_HANDLER( sound_data_w )
}
-static READ8_HANDLER( sound_data_r )
+static READ8_DEVICE_HANDLER( sound_data_r )
{
return sound_data;
}
@@ -205,10 +205,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(sound_irq_ack_w)
- AM_RANGE(0x8c, 0x8c) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x8d, 0x8d) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x8e, 0x8e) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x8f, 0x8f) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
+ AM_RANGE(0x8c, 0x8d) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x8d, 0x8d) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0x8e, 0x8f) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x8f, 0x8f) AM_DEVREAD(SOUND, "ay2", ay8910_r)
ADDRESS_MAP_END
@@ -340,10 +340,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- sound_data_r,
- NULL,
- NULL,
- NULL
+ DEVCB_HANDLER(sound_data_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/suprslam.c b/src/mame/drivers/suprslam.c
index d4f5d65d1ee..45dc68a1e50 100644
--- a/src/mame/drivers/suprslam.c
+++ b/src/mame/drivers/suprslam.c
@@ -182,10 +182,7 @@ static ADDRESS_MAP_START( suprslam_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(suprslam_sh_bankswitch_w)
AM_RANGE(0x04, 0x04) AM_READWRITE(soundlatch_r, pending_command_clear_w)
- AM_RANGE(0x08, 0x08) AM_READWRITE(ym2610_status_port_0_a_r, ym2610_control_port_0_a_w)
- AM_RANGE(0x09, 0x09) AM_WRITE(ym2610_data_port_0_a_w)
- AM_RANGE(0x0a, 0x0a) AM_READWRITE(ym2610_status_port_0_b_r, ym2610_control_port_0_b_w)
- AM_RANGE(0x0b, 0x0b) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE(SOUND, "ym", ym2610_r, ym2610_w)
ADDRESS_MAP_END
/*** INPUT PORTS *************************************************************/
@@ -305,9 +302,9 @@ GFXDECODE_END
/*** MORE SOUND **************************************************************/
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface ym2610_config =
diff --git a/src/mame/drivers/surpratk.c b/src/mame/drivers/surpratk.c
index 93105e77632..520f7d92013 100644
--- a/src/mame/drivers/surpratk.c
+++ b/src/mame/drivers/surpratk.c
@@ -93,7 +93,7 @@ static ADDRESS_MAP_START( surpratk_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x5f8e, 0x5f8e) AM_READ_PORT("DSW3")
AM_RANGE(0x5f8f, 0x5f8f) AM_READ_PORT("DSW1")
AM_RANGE(0x5f90, 0x5f90) AM_READ_PORT("DSW2")
-// AM_RANGE(0x5f91, 0x5f91) AM_READ(ym2151_status_port_0_r) /* ? */
+// AM_RANGE(0x5f91, 0x5f91) AM_DEVREAD(SOUND, "ym", ym2151_status_port_r) /* ? */
AM_RANGE(0x5fa0, 0x5faf) AM_READ(K053244_r)
AM_RANGE(0x5fc0, 0x5fc0) AM_READ(watchdog_reset_r)
AM_RANGE(0x4000, 0x7fff) AM_READ(K052109_r)
@@ -107,8 +107,7 @@ static ADDRESS_MAP_START( surpratk_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x5fa0, 0x5faf) AM_WRITE(K053244_w)
AM_RANGE(0x5fb0, 0x5fbf) AM_WRITE(K053251_w)
AM_RANGE(0x5fc0, 0x5fc0) AM_WRITE(surpratk_5fc0_w)
- AM_RANGE(0x5fd0, 0x5fd0) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x5fd1, 0x5fd1) AM_WRITE(ym2151_data_port_0_w)
+ AM_RANGE(0x5fd0, 0x5fd1) AM_DEVWRITE(SOUND, "ym", ym2151_w)
AM_RANGE(0x5fc4, 0x5fc4) AM_WRITE(surpratk_videobank_w)
AM_RANGE(0x4000, 0x7fff) AM_WRITE(K052109_w)
AM_RANGE(0x8000, 0xffff) AM_WRITE(SMH_ROM) /* ROM */
@@ -221,9 +220,9 @@ INPUT_PORTS_END
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[0],KONAMI_FIRQ_LINE,linestate);
+ cpu_set_input_line(device->machine->cpu[0],KONAMI_FIRQ_LINE,linestate);
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/system1.c b/src/mame/drivers/system1.c
index 67a15ee24d5..82dbb094fa8 100644
--- a/src/mame/drivers/system1.c
+++ b/src/mame/drivers/system1.c
@@ -428,8 +428,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_MIRROR(0x1800) AM_RAM
- AM_RANGE(0xa000, 0xa003) AM_MIRROR(0x1ffc) AM_WRITE(sn76496_0_w) /* Choplifter writes to the four addresses */
- AM_RANGE(0xc000, 0xc003) AM_MIRROR(0x1ffc) AM_WRITE(sn76496_1_w) /* in sequence */
+ AM_RANGE(0xa000, 0xa003) AM_MIRROR(0x1ffc) AM_DEVWRITE(SOUND, "sn1", sn76496_w) /* Choplifter writes to the four addresses */
+ AM_RANGE(0xc000, 0xc003) AM_MIRROR(0x1ffc) AM_DEVWRITE(SOUND, "sn2", sn76496_w) /* in sequence */
AM_RANGE(0xe000, 0xe000) AM_MIRROR(0x1fff) AM_READ(soundlatch_r)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/system16.c b/src/mame/drivers/system16.c
index 49db39fe8f4..210456392af 100644
--- a/src/mame/drivers/system16.c
+++ b/src/mame/drivers/system16.c
@@ -251,7 +251,7 @@ static WRITE8_HANDLER( tturfbl_msm5205_data_w )
static void tturfbl_msm5205_callback(const device_config *device)
{
- msm5205_data_w(0, (sample_buffer >> 4) & 0x0F);
+ msm5205_data_w(device, (sample_buffer >> 4) & 0x0F);
sample_buffer <<= 4;
sample_select ^= 1;
if(sample_select == 0)
@@ -321,14 +321,13 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( tturfbl_sound_readport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x01, 0x01) AM_READ(ym2151_status_port_0_r)
+ AM_RANGE(0x00, 0x01) AM_DEVREAD(SOUND, "ym", ym2151_r)
AM_RANGE(0x80, 0x80) AM_READ(SMH_NOP)
ADDRESS_MAP_END
static ADDRESS_MAP_START( tturfbl_sound_writeport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym2151_data_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ym", ym2151_w)
AM_RANGE(0x40, 0x40) AM_WRITE(SMH_NOP)
AM_RANGE(0x80, 0x80) AM_WRITE(SMH_NOP)
ADDRESS_MAP_END
@@ -348,14 +347,13 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x01, 0x01) AM_READ(ym2151_status_port_0_r)
+ AM_RANGE(0x00, 0x01) AM_DEVREAD(SOUND, "ym", ym2151_r)
AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writeport, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym2151_data_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ym", ym2151_w)
ADDRESS_MAP_END
@@ -368,22 +366,21 @@ static ADDRESS_MAP_START( sound_readmem_7759, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END
-static WRITE8_HANDLER( upd7759_bank_w ) //*
+static WRITE8_DEVICE_HANDLER( upd7759_bank_w ) //*
{
- int offs, size = memory_region_length(space->machine, "sound") - 0x10000;
+ int offs, size = memory_region_length(device->machine, "sound") - 0x10000;
- upd7759_reset_w(0, data & 0x40);
+ upd7759_reset_w(device, data & 0x40);
offs = 0x10000 + (data * 0x4000) % size;
- memory_set_bankptr(space->machine, 1, memory_region(space->machine, "sound") + offs);
+ memory_set_bankptr(device->machine, 1, memory_region(device->machine, "sound") + offs);
}
static ADDRESS_MAP_START( sound_writeport_7759, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym2151_data_port_0_w)
- AM_RANGE(0x40, 0x40) AM_WRITE(upd7759_bank_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(upd7759_0_port_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ym", ym2151_w)
+ AM_RANGE(0x40, 0x40) AM_DEVWRITE(SOUND, "7759", upd7759_bank_w)
+ AM_RANGE(0x80, 0x80) AM_DEVWRITE(SOUND, "7759", upd7759_port_w)
ADDRESS_MAP_END
@@ -452,7 +449,7 @@ static MACHINE_DRIVER_START( system16 )
/* sound hardware */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("2151", YM2151, 4000000)
+ MDRV_SOUND_ADD("ym", YM2151, 4000000)
MDRV_SOUND_ROUTE(0, "left", 0.32)
MDRV_SOUND_ROUTE(1, "right", 0.32)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/system18.c b/src/mame/drivers/system18.c
index 08e83d488be..c75c54e93b8 100644
--- a/src/mame/drivers/system18.c
+++ b/src/mame/drivers/system18.c
@@ -170,7 +170,7 @@ static WRITE8_HANDLER( shdancbl_msm5205_data_w )
static void shdancbl_msm5205_callback(const device_config *device)
{
- msm5205_data_w(0, sample_buffer & 0x0F);
+ msm5205_data_w(device, sample_buffer & 0x0F);
sample_buffer >>= 4;
sample_select ^= 1;
if(sample_select == 0)
@@ -227,14 +227,8 @@ static ADDRESS_MAP_START( shdancbl_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0xbfff) AM_READ(shdancbl_soundbank_r)
AM_RANGE(0xc400, 0xc400) AM_READ(soundlatch_r)
- AM_RANGE(0xcc00, 0xcc00) AM_READ(ym3438_status_port_0_a_r)
- AM_RANGE(0xcc01, 0xcc01) AM_READ(ym3438_status_port_0_b_r)
- AM_RANGE(0xcc02, 0xcc02) AM_READ(ym3438_status_port_0_b_r)
- AM_RANGE(0xcc03, 0xcc03) AM_READ(ym3438_status_port_0_b_r)
- AM_RANGE(0xd000, 0xd000) AM_READ(ym3438_status_port_1_a_r)
- AM_RANGE(0xd001, 0xd001) AM_READ(ym3438_status_port_1_b_r)
- AM_RANGE(0xd002, 0xd002) AM_READ(ym3438_status_port_1_b_r)
- AM_RANGE(0xd003, 0xd003) AM_READ(ym3438_status_port_1_b_r)
+ AM_RANGE(0xcc00, 0xcc03) AM_DEVREAD(SOUND, "3438.0", ym3438_r)
+ AM_RANGE(0xd000, 0xd003) AM_DEVREAD(SOUND, "3438.1", ym3438_r)
AM_RANGE(0xdf00, 0xdfff) AM_READ(SMH_NOP)
AM_RANGE(0xe000, 0xffff) AM_READ(SMH_RAM)
ADDRESS_MAP_END
@@ -244,14 +238,8 @@ static ADDRESS_MAP_START(shdancbl_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0xbfff) AM_WRITE(SMH_NOP) /* ROM bank */
AM_RANGE(0xc000, 0xc00f) AM_WRITE(SMH_NOP)
AM_RANGE(0xc800, 0xc800) AM_WRITE(shdancbl_msm5205_data_w)
- AM_RANGE(0xcc00, 0xcc00) AM_WRITE(ym3438_control_port_0_a_w)
- AM_RANGE(0xcc01, 0xcc01) AM_WRITE(ym3438_data_port_0_a_w)
- AM_RANGE(0xcc02, 0xcc02) AM_WRITE(ym3438_control_port_0_b_w)
- AM_RANGE(0xcc03, 0xcc03) AM_WRITE(ym3438_data_port_0_b_w)
- AM_RANGE(0xd000, 0xd000) AM_WRITE(ym3438_control_port_1_a_w)
- AM_RANGE(0xd001, 0xd001) AM_WRITE(ym3438_data_port_1_a_w)
- AM_RANGE(0xd002, 0xd002) AM_WRITE(ym3438_control_port_1_b_w)
- AM_RANGE(0xd003, 0xd003) AM_WRITE(ym3438_data_port_1_b_w)
+ AM_RANGE(0xcc00, 0xcc03) AM_DEVWRITE(SOUND, "3438.0", ym3438_w)
+ AM_RANGE(0xd000, 0xd003) AM_DEVWRITE(SOUND, "3438.1", ym3438_w)
AM_RANGE(0xd400, 0xd400) AM_WRITE(shdancbl_bankctrl_w)
AM_RANGE(0xdf00, 0xdfff) AM_WRITE(SMH_NOP)
AM_RANGE(0xe000, 0xffff) AM_WRITE(SMH_RAM)
@@ -278,15 +266,15 @@ static ADDRESS_MAP_START( sound_readmem_18, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x9fff) AM_READ(SMH_ROM)
AM_RANGE(0xa000, 0xbfff) AM_READ(system18_bank_r)
/**** D/A register ****/
- AM_RANGE(0xd000, 0xdfff) AM_READ(rf5c68_r)
+ AM_RANGE(0xd000, 0xdfff) AM_DEVREAD(SOUND, "5c68", rf5c68_mem_r)
AM_RANGE(0xe000, 0xffff) AM_READ(SMH_RAM)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem_18, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_WRITE(SMH_ROM)
/**** D/A register ****/
- AM_RANGE(0xc000, 0xc008) AM_WRITE(rf5c68_reg_w)
- AM_RANGE(0xd000, 0xdfff) AM_WRITE(rf5c68_w)
+ AM_RANGE(0xc000, 0xc008) AM_DEVWRITE(SOUND, "5c68", rf5c68_w)
+ AM_RANGE(0xd000, 0xdfff) AM_DEVWRITE(SOUND, "5c68", rf5c68_mem_w)
AM_RANGE(0xe000, 0xffff) AM_WRITE(SMH_RAM) //??
ADDRESS_MAP_END
@@ -304,17 +292,8 @@ static WRITE8_HANDLER( sys18_soundbank_w )
static ADDRESS_MAP_START( sound_18_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x80, 0x80) AM_READWRITE(ym3438_status_port_0_a_r, ym3438_control_port_0_a_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ym3438_data_port_0_a_w)
-// AM_RANGE(0x82, 0x82) AM_READ(ym3438_status_port_0_b_r)
- AM_RANGE(0x82, 0x82) AM_WRITE(ym3438_control_port_0_b_w)
- AM_RANGE(0x83, 0x83) AM_WRITE(ym3438_data_port_0_b_w)
-// AM_RANGE(0x90, 0x90) AM_READ(ym3438_status_port_1_a_r)
- AM_RANGE(0x90, 0x90) AM_WRITE(ym3438_control_port_1_a_w)
- AM_RANGE(0x91, 0x91) AM_WRITE(ym3438_data_port_1_a_w)
-// AM_RANGE(0x92, 0x92) AM_READ(ym3438_status_port_1_b_r)
- AM_RANGE(0x92, 0x92) AM_WRITE(ym3438_control_port_1_b_w)
- AM_RANGE(0x93, 0x93) AM_WRITE(ym3438_data_port_1_b_w)
+ AM_RANGE(0x80, 0x83) AM_DEVREADWRITE(SOUND, "3438.0", ym3438_r, ym3438_w)
+ AM_RANGE(0x90, 0x93) AM_DEVREADWRITE(SOUND, "3438.1", ym3438_r, ym3438_w)
AM_RANGE(0xa0, 0xa0) AM_WRITE(sys18_soundbank_w)
AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_r)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/tagteam.c b/src/mame/drivers/tagteam.c
index 0f1ee869a85..0f17d8ccef7 100644
--- a/src/mame/drivers/tagteam.c
+++ b/src/mame/drivers/tagteam.c
@@ -68,11 +68,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x03ff) AM_RAM
- AM_RANGE(0x2000, 0x2000) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x2001, 0x2001) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x2002, 0x2002) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x2003, 0x2003) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x2004, 0x2004) AM_WRITE(dac_0_data_w)
+ AM_RANGE(0x2000, 0x2001) AM_DEVWRITE(SOUND, "ay1", ay8910_data_address_w)
+ AM_RANGE(0x2002, 0x2003) AM_DEVWRITE(SOUND, "ay2", ay8910_data_address_w)
+ AM_RANGE(0x2004, 0x2004) AM_DEVWRITE(SOUND, "dac", dac_w)
AM_RANGE(0x2005, 0x2005) AM_WRITE(interrupt_enable_w)
AM_RANGE(0x2007, 0x2007) AM_READ(soundlatch_r)
AM_RANGE(0x4000, 0xffff) AM_READ(SMH_ROM)
diff --git a/src/mame/drivers/tail2nos.c b/src/mame/drivers/tail2nos.c
index 6c92501b2a8..585c2dd9235 100644
--- a/src/mame/drivers/tail2nos.c
+++ b/src/mame/drivers/tail2nos.c
@@ -63,9 +63,9 @@ static WRITE16_HANDLER( tail2nos_K051316_ctrl_0_w )
K051316_ctrl_0_w(space,offset,data & 0xff);
}
-static WRITE8_HANDLER( sound_bankswitch_w )
+static WRITE8_DEVICE_HANDLER( sound_bankswitch_w )
{
- memory_set_bankptr(space->machine, 3,memory_region(space->machine, "audio") + 0x10000 + (data & 0x01) * 0x8000);
+ memory_set_bankptr(device->machine, 3,memory_region(device->machine, "audio") + 0x10000 + (data & 0x01) * 0x8000);
}
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
@@ -94,13 +94,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_port_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x07, 0x07) AM_READWRITE(soundlatch_r, SMH_NOP) /* the write is a clear pending command */
- AM_RANGE(0x08, 0x08) AM_WRITE(ym2608_control_port_0_a_w)
- AM_RANGE(0x09, 0x09) AM_WRITE(ym2608_data_port_0_a_w)
- AM_RANGE(0x0a, 0x0a) AM_WRITE(ym2608_control_port_0_b_w)
- AM_RANGE(0x0b, 0x0b) AM_WRITE(ym2608_data_port_0_b_w)
+ AM_RANGE(0x08, 0x0b) AM_DEVWRITE(SOUND, "ym", ym2608_w)
#if 0
- AM_RANGE(0x18, 0x18) AM_READ(ym2610_status_port_0_a_r)
- AM_RANGE(0x1a, 0x1a) AM_READ(ym2610_status_port_0_b_r)
+ AM_RANGE(0x18, 0x1b) AM_DEVREAD(SOUND, "ym", ym2608_r)
#endif
ADDRESS_MAP_END
@@ -217,9 +213,9 @@ GFXDECODE_END
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2608_interface ym2608_config =
@@ -227,10 +223,10 @@ static const ym2608_interface ym2608_config =
{
AY8910_LEGACY_OUTPUT | AY8910_SINGLE_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- NULL,
- sound_bankswitch_w,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(sound_bankswitch_w)
},
irqhandler
};
diff --git a/src/mame/drivers/taito_b.c b/src/mame/drivers/taito_b.c
index c3fa1fa5fd0..395cb826d93 100644
--- a/src/mame/drivers/taito_b.c
+++ b/src/mame/drivers/taito_b.c
@@ -968,15 +968,14 @@ static ADDRESS_MAP_START( masterw_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM)
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1)
AM_RANGE(0x8000, 0x8fff) AM_READ(SMH_RAM)
- AM_RANGE(0x9000, 0x9000) AM_READ(ym2203_status_port_0_r)
+ AM_RANGE(0x9000, 0x9001) AM_DEVREAD(SOUND, "ym", ym2203_r)
AM_RANGE(0xa001, 0xa001) AM_READ(taitosound_slave_comm_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( masterw_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x8fff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x9000, 0x9000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x9001, 0x9001) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0x9000, 0x9001) AM_DEVWRITE(SOUND, "ym", ym2203_w)
AM_RANGE(0xa000, 0xa000) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xa001, 0xa001) AM_WRITE(taitosound_slave_comm_w)
ADDRESS_MAP_END
@@ -985,9 +984,7 @@ static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM)
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1)
AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_READ(ym2610_status_port_0_a_r)
- AM_RANGE(0xe001, 0xe001) AM_READ(ym2610_read_port_0_r)
- AM_RANGE(0xe002, 0xe002) AM_READ(ym2610_status_port_0_b_r)
+ AM_RANGE(0xe000, 0xe003) AM_DEVREAD(SOUND, "ym", ym2610_r)
AM_RANGE(0xe200, 0xe200) AM_READ(SMH_NOP)
AM_RANGE(0xe201, 0xe201) AM_READ(taitosound_slave_comm_r)
AM_RANGE(0xea00, 0xea00) AM_READ(SMH_NOP)
@@ -996,10 +993,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xdfff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ym2610_control_port_0_a_w)
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ym2610_data_port_0_a_w)
- AM_RANGE(0xe002, 0xe002) AM_WRITE(ym2610_control_port_0_b_w)
- AM_RANGE(0xe003, 0xe003) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0xe000, 0xe003) AM_DEVWRITE(SOUND, "ym", ym2610_w)
AM_RANGE(0xe200, 0xe200) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xe201, 0xe201) AM_WRITE(taitosound_slave_comm_w)
AM_RANGE(0xe400, 0xe403) AM_WRITE(SMH_NOP) /* pan */
@@ -1013,17 +1007,16 @@ static ADDRESS_MAP_START( viofight_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM)
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1)
AM_RANGE(0x8000, 0x8fff) AM_READ(SMH_RAM)
- AM_RANGE(0x9000, 0x9000) AM_READ(ym2203_status_port_0_r)
- AM_RANGE(0xb000, 0xb000) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x9000, 0x9001) AM_DEVREAD(SOUND, "ym", ym2203_r)
+ AM_RANGE(0xb000, 0xb000) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0xa001, 0xa001) AM_READ(taitosound_slave_comm_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( viofight_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x8fff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x9000, 0x9000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x9001, 0x9001) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0xb000, 0xb001) AM_WRITE(okim6295_data_0_w) /* yes, both addresses for the same chip */
+ AM_RANGE(0x9000, 0x9001) AM_DEVWRITE(SOUND, "ym", ym2203_w)
+ AM_RANGE(0xb000, 0xb001) AM_DEVWRITE(SOUND, "oki", okim6295_w) /* yes, both addresses for the same chip */
AM_RANGE(0xa000, 0xa000) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xa001, 0xa001) AM_WRITE(taitosound_slave_comm_w)
ADDRESS_MAP_END
@@ -2353,9 +2346,9 @@ GFXDECODE_END
/* handler called by the YM2610 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface ym2610_config =
@@ -2368,10 +2361,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- bankswitch_w,
- NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, bankswitch_w),
+ DEVCB_NULL,
},
irqhandler
};
@@ -2391,10 +2384,10 @@ static void mb87078_gain_changed(running_machine *machine, int channel, int perc
{
if (channel==1)
{
- sound_type type = machine->config->sound[0].type;
- sndti_set_output_gain(type, 0, 0, percent / 100.0);
- sndti_set_output_gain(type, 1, 0, percent / 100.0);
- sndti_set_output_gain(type, 2, 0, percent / 100.0);
+ const device_config *ym = devtag_get_device(machine, SOUND, "ym");
+ sound_set_output_gain(ym, 0, percent / 100.0);
+ sound_set_output_gain(ym, 1, percent / 100.0);
+ sound_set_output_gain(ym, 2, percent / 100.0);
//popmessage("MB87078 gain ch#%i percent=%i",channel,percent);
}
}
diff --git a/src/mame/drivers/taito_f2.c b/src/mame/drivers/taito_f2.c
index 4a8848a3d52..7a53a5a3a23 100644
--- a/src/mame/drivers/taito_f2.c
+++ b/src/mame/drivers/taito_f2.c
@@ -846,9 +846,9 @@ static READ8_HANDLER( driveout_sound_command_r)
static INT32 oki_bank = 0;
-static void reset_driveout_sound_region(void)
+static void reset_driveout_sound_region(running_machine *machine)
{
- okim6295_set_bank_base(0, oki_bank*0x40000);
+ okim6295_set_bank_base(devtag_get_device(machine, SOUND, "oki"), oki_bank*0x40000);
}
static WRITE8_HANDLER (oki_bank_w)
@@ -857,7 +857,7 @@ static WRITE8_HANDLER (oki_bank_w)
{
oki_bank = (data&3);
}
- reset_driveout_sound_region();
+ reset_driveout_sound_region(space->machine);
}
static WRITE16_HANDLER ( driveout_sound_command_w )
@@ -1668,9 +1668,7 @@ static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM)
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK2)
AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_READ(ym2610_status_port_0_a_r)
- AM_RANGE(0xe001, 0xe001) AM_READ(ym2610_read_port_0_r)
- AM_RANGE(0xe002, 0xe002) AM_READ(ym2610_status_port_0_b_r)
+ AM_RANGE(0xe000, 0xe003) AM_DEVREAD(SOUND, "ym", ym2610_r)
AM_RANGE(0xe200, 0xe200) AM_READ(SMH_NOP)
AM_RANGE(0xe201, 0xe201) AM_READ(taitosound_slave_comm_r)
AM_RANGE(0xea00, 0xea00) AM_READ(SMH_NOP)
@@ -1679,10 +1677,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xdfff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ym2610_control_port_0_a_w)
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ym2610_data_port_0_a_w)
- AM_RANGE(0xe002, 0xe002) AM_WRITE(ym2610_control_port_0_b_w)
- AM_RANGE(0xe003, 0xe003) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0xe000, 0xe003) AM_DEVWRITE(SOUND, "ym", ym2610_w)
AM_RANGE(0xe200, 0xe200) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xe201, 0xe201) AM_WRITE(taitosound_slave_comm_w)
AM_RANGE(0xe400, 0xe403) AM_WRITE(SMH_NOP) /* pan */
@@ -1698,28 +1693,27 @@ static ADDRESS_MAP_START( camltrya_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) // I can't see a bank control, but there ARE some bytes past 0x8000
// AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1)
AM_RANGE(0x8000, 0x8fff) AM_READ(SMH_RAM)
- AM_RANGE(0x9000, 0x9000) AM_READ(ym2203_status_port_0_r)
+ AM_RANGE(0x9000, 0x9001) AM_DEVREAD(SOUND, "ym", ym2203_r)
AM_RANGE(0xa001, 0xa001) AM_READ(taitosound_slave_comm_r)
- AM_RANGE(0xb000, 0xb000) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0xb000, 0xb000) AM_DEVREAD(SOUND, "oki", okim6295_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( camltrya_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x8fff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x9000, 0x9000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x9001, 0x9001) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0x9000, 0x9001) AM_DEVWRITE(SOUND, "ym", ym2203_w)
AM_RANGE(0xa000, 0xa000) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xa001, 0xa001) AM_WRITE(taitosound_slave_comm_w)
// AM_RANGE(0xb000, 0xb000) AM_WRITE(unknown_w) // probably controlling sample player?
- AM_RANGE(0xb000, 0xb000) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0xb001, 0xb001) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0xb000, 0xb000) AM_DEVWRITE(SOUND, "oki", okim6295_w)
+ AM_RANGE(0xb001, 0xb001) AM_DEVWRITE(SOUND, "oki", okim6295_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( driveout_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM)
- AM_RANGE(0x9800, 0x9800) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x9800, 0x9800) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0xa000, 0xa000) AM_READ(driveout_sound_command_r)
ADDRESS_MAP_END
@@ -1727,7 +1721,7 @@ static ADDRESS_MAP_START( driveout_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
AM_RANGE(0x9000, 0x9000) AM_WRITE(oki_bank_w)
- AM_RANGE(0x9800, 0x9800) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0x9800, 0x9800) AM_DEVWRITE(SOUND, "oki", okim6295_w)
ADDRESS_MAP_END
/***********************************************************
@@ -3659,9 +3653,9 @@ GFXDECODE_END
/* handler called by the YM2610 emulator when the internal timers cause an IRQ */
-static void irq_handler(running_machine *machine, int irq)
+static void irq_handler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface ym2610_config =
@@ -3670,7 +3664,7 @@ static const ym2610_interface ym2610_config =
};
-static WRITE8_HANDLER( camltrya_porta_w )
+static WRITE8_DEVICE_HANDLER( camltrya_porta_w )
{
// Implement //
}
@@ -3680,10 +3674,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, /* portA read */
- NULL,
- camltrya_porta_w, /* portA write - not implemented */
- NULL, /* portB write */
+ DEVCB_NULL, /* portA read */
+ DEVCB_NULL,
+ DEVCB_HANDLER(camltrya_porta_w), /* portA write - not implemented */
+ DEVCB_NULL, /* portB write */
},
irq_handler
};
@@ -5807,7 +5801,7 @@ static DRIVER_INIT( mjnquest )
static STATE_POSTLOAD( driveout_postload )
{
- reset_driveout_sound_region();
+ reset_driveout_sound_region(machine);
}
static DRIVER_INIT( driveout )
diff --git a/src/mame/drivers/taito_f3.c b/src/mame/drivers/taito_f3.c
index 89254a3910c..41300e7c2a8 100644
--- a/src/mame/drivers/taito_f3.c
+++ b/src/mame/drivers/taito_f3.c
@@ -3613,18 +3613,18 @@ static DRIVER_INIT( bubsymph )
}
-static READ32_HANDLER( bubsympb_oki_r )
+static READ32_DEVICE_HANDLER( bubsympb_oki_r )
{
- return okim6295_status_0_r(space,0);
+ return okim6295_r(device,0);
}
-static WRITE32_HANDLER( bubsympb_oki_w )
+static WRITE32_DEVICE_HANDLER( bubsympb_oki_w )
{
//printf("write %08x %08x\n",data,mem_mask);
- if (ACCESSING_BITS_0_7) okim6295_data_0_w(space,0,data&0xff);
- //if (mem_mask==0x000000ff) okim6295_data_0_w(space,0,data&0xff);
+ if (ACCESSING_BITS_0_7) okim6295_w(device,0,data&0xff);
+ //if (mem_mask==0x000000ff) okim6295_w(device,0,data&0xff);
if (ACCESSING_BITS_16_23)
{
- UINT8 *snd = memory_region(space->machine, "oki");
+ UINT8 *snd = memory_region(device->machine, "oki");
int bank = (data & 0x000f0000) >> 16;
// almost certainly wrong
memcpy(snd+0x30000, snd+0x80000+0x30000+bank*0x10000, 0x10000);
@@ -3638,6 +3638,7 @@ static WRITE32_HANDLER( bubsympb_oki_w )
static DRIVER_INIT( bubsympb )
{
+ const device_config *oki = devtag_get_device(machine, SOUND, "oki");
f3_game=BUBSYMPH;
//tile_decode(machine);
@@ -3660,8 +3661,8 @@ static DRIVER_INIT( bubsympb )
}
}
- memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4a001c, 0x4a001f, 0, 0, bubsympb_oki_r );
- memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4a001c, 0x4a001f, 0, 0, bubsympb_oki_w );
+ memory_install_read32_device_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), oki, 0x4a001c, 0x4a001f, 0, 0, bubsympb_oki_r );
+ memory_install_write32_device_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), oki, 0x4a001c, 0x4a001f, 0, 0, bubsympb_oki_w );
}
diff --git a/src/mame/drivers/taito_h.c b/src/mame/drivers/taito_h.c
index 252bd475346..121d61e7a1e 100644
--- a/src/mame/drivers/taito_h.c
+++ b/src/mame/drivers/taito_h.c
@@ -160,9 +160,9 @@ VIDEO_UPDATE( dleague );
***************************************************************************/
/* Handler called by the YM2610 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface ym2610_config =
@@ -331,9 +331,7 @@ static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM)
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1)
AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_READ(ym2610_status_port_0_a_r)
- AM_RANGE(0xe001, 0xe001) AM_READ(ym2610_read_port_0_r)
- AM_RANGE(0xe002, 0xe002) AM_READ(ym2610_status_port_0_b_r)
+ AM_RANGE(0xe000, 0xe003) AM_DEVREAD(SOUND, "ym", ym2610_r)
AM_RANGE(0xe200, 0xe200) AM_READ(SMH_NOP)
AM_RANGE(0xe201, 0xe201) AM_READ(taitosound_slave_comm_r)
AM_RANGE(0xea00, 0xea00) AM_READ(SMH_NOP)
@@ -342,10 +340,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xdfff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ym2610_control_port_0_a_w)
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ym2610_data_port_0_a_w)
- AM_RANGE(0xe002, 0xe002) AM_WRITE(ym2610_control_port_0_b_w)
- AM_RANGE(0xe003, 0xe003) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0xe000, 0xe003) AM_DEVWRITE(SOUND, "ym", ym2610_w)
AM_RANGE(0xe200, 0xe200) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xe201, 0xe201) AM_WRITE(taitosound_slave_comm_w)
AM_RANGE(0xe400, 0xe403) AM_WRITE(SMH_NOP) /* pan control */
diff --git a/src/mame/drivers/taito_l.c b/src/mame/drivers/taito_l.c
index ad1665ebbb4..be164222801 100644
--- a/src/mame/drivers/taito_l.c
+++ b/src/mame/drivers/taito_l.c
@@ -95,10 +95,10 @@ static UINT8 *palette_ram;
static UINT8 *empty_ram;
static UINT8 *shared_ram;
-static read8_space_func porte0_r;
-static read8_space_func porte1_r;
-static read8_space_func portf0_r;
-static read8_space_func portf1_r;
+static const char *porte0_tag;
+static const char *porte1_tag;
+static const char *portf0_tag;
+static const char *portf1_tag;
static int adpcm_pos;
static int adpcm_data;
@@ -176,92 +176,92 @@ static void machine_init(running_machine *machine)
static MACHINE_RESET( fhawk )
{
machine_init(machine);
- porte0_r = 0;
- porte1_r = 0;
- portf0_r = 0;
- portf1_r = 0;
+ porte0_tag = NULL;
+ porte1_tag = NULL;
+ portf0_tag = NULL;
+ portf1_tag = NULL;
}
static MACHINE_RESET( raimais )
{
machine_init(machine);
- porte0_r = 0;
- porte1_r = 0;
- portf0_r = 0;
- portf1_r = 0;
+ porte0_tag = NULL;
+ porte1_tag = NULL;
+ portf0_tag = NULL;
+ portf1_tag = NULL;
}
static MACHINE_RESET( champwr )
{
machine_init(machine);
- porte0_r = 0;
- porte1_r = 0;
- portf0_r = 0;
- portf1_r = 0;
+ porte0_tag = NULL;
+ porte1_tag = NULL;
+ portf0_tag = NULL;
+ portf1_tag = NULL;
}
static MACHINE_RESET( kurikint )
{
machine_init(machine);
- porte0_r = 0;
- porte1_r = 0;
- portf0_r = 0;
- portf1_r = 0;
+ porte0_tag = NULL;
+ porte1_tag = NULL;
+ portf0_tag = NULL;
+ portf1_tag = NULL;
}
static MACHINE_RESET( evilston )
{
machine_init(machine);
- porte0_r = 0;
- porte1_r = 0;
- portf0_r = 0;
- portf1_r = 0;
+ porte0_tag = NULL;
+ porte1_tag = NULL;
+ portf0_tag = NULL;
+ portf1_tag = NULL;
}
static MACHINE_RESET( puzznic )
{
machine_init(machine);
- porte0_r = input_port_0_r;
- porte1_r = input_port_1_r;
- portf0_r = input_port_2_r;
- portf1_r = input_port_3_r;
+ porte0_tag = "DSWA";
+ porte1_tag = "DSWB";
+ portf0_tag = "IN0";
+ portf1_tag = "IN1";
}
static MACHINE_RESET( plotting )
{
machine_init(machine);
- porte0_r = input_port_0_r;
- porte1_r = input_port_1_r;
- portf0_r = input_port_2_r;
- portf1_r = input_port_3_r;
+ porte0_tag = "DSWA";
+ porte1_tag = "DSWB";
+ portf0_tag = "IN0";
+ portf1_tag = "IN1";
}
static MACHINE_RESET( palamed )
{
machine_init(machine);
- porte0_r = input_port_0_r;
- porte1_r = 0;
- portf0_r = input_port_1_r;
- portf1_r = 0;
+ porte0_tag = "DSWA";
+ porte1_tag = NULL;
+ portf0_tag = "DSWB";
+ portf1_tag = NULL;
}
static MACHINE_RESET( cachat )
{
machine_init(machine);
- porte0_r = input_port_0_r;
- porte1_r = 0;
- portf0_r = input_port_1_r;
- portf1_r = 0;
+ porte0_tag = "DSWA";
+ porte1_tag = NULL;
+ portf0_tag = "DSWB";
+ portf1_tag = NULL;
}
static MACHINE_RESET( horshoes )
{
machine_init(machine);
- porte0_r = input_port_0_r;
- porte1_r = input_port_1_r;
- portf0_r = input_port_2_r;
- portf1_r = input_port_3_r;
+ porte0_tag = "DSWA";
+ porte1_tag = "DSWB";
+ portf0_tag = "IN0";
+ portf1_tag = "IN1";
}
@@ -448,28 +448,20 @@ static WRITE8_HANDLER( control2_w )
coin_counter_w(1,data & 0x08);
}
-static READ8_HANDLER( portA_r )
+static READ8_DEVICE_HANDLER( portA_r )
{
- if (extport == 0) return porte0_r(space,0);
- else return porte1_r(space,0);
+ return input_port_read(device->machine, (extport == 0) ? porte0_tag : porte1_tag);
}
-static READ8_HANDLER( portB_r )
+static READ8_DEVICE_HANDLER( portB_r )
{
- if (extport == 0) return portf0_r(space,0);
- else return portf1_r(space,0);
+ return input_port_read(device->machine, (extport == 0) ? portf0_tag : portf1_tag);
}
-static READ8_HANDLER( ym2203_data0_r )
+static READ8_DEVICE_HANDLER( extport_select_and_ym2203_r )
{
- extport = 0;
- return ym2203_read_port_0_r(space,offset);
-}
-
-static READ8_HANDLER( ym2203_data1_r )
-{
- extport = 1;
- return ym2203_read_port_0_r(space,offset);
+ extport = (offset >> 1) & 1;
+ return ym2203_r(device, offset & 1);
}
static const UINT8 puzznic_mcu_reply[] = { 0x50, 0x1f, 0xb6, 0xba, 0x06, 0x03, 0x47, 0x05, 0x00 };
@@ -570,14 +562,14 @@ static void champwr_msm5205_vck(const device_config *device)
{
if (adpcm_data != -1)
{
- msm5205_data_w(0, adpcm_data & 0x0f);
+ msm5205_data_w(device, adpcm_data & 0x0f);
adpcm_data = -1;
}
else
{
adpcm_data = memory_region(device->machine, "adpcm")[adpcm_pos];
adpcm_pos = (adpcm_pos + 1) & 0x1ffff;
- msm5205_data_w(0, adpcm_data >> 4);
+ msm5205_data_w(device, adpcm_data >> 4);
}
}
@@ -591,20 +583,20 @@ static WRITE8_HANDLER( champwr_msm5205_hi_w )
adpcm_pos = ((adpcm_pos & 0x00ffff) | (data << 16)) & 0x1ffff;
}
-static WRITE8_HANDLER( champwr_msm5205_start_w )
+static WRITE8_DEVICE_HANDLER( champwr_msm5205_start_w )
{
- msm5205_reset_w(0, 0);
+ msm5205_reset_w(device, 0);
}
-static WRITE8_HANDLER( champwr_msm5205_stop_w )
+static WRITE8_DEVICE_HANDLER( champwr_msm5205_stop_w )
{
- msm5205_reset_w(0, 1);
+ msm5205_reset_w(device, 1);
adpcm_pos &= 0x1ff00;
}
-static WRITE8_HANDLER( champwr_msm5205_volume_w )
+static WRITE8_DEVICE_HANDLER( champwr_msm5205_volume_w )
{
- sndti_set_output_gain(SOUND_MSM5205, 0, 0, data / 255.0);
+ sound_set_output_gain(device, 0, data / 255.0);
}
@@ -673,14 +665,11 @@ static READ8_HANDLER( horshoes_trackx_hi_r )
AM_RANGE(0xff08, 0xff08) AM_WRITE(rombankswitch_w)
#define COMMON_SINGLE_READ \
- AM_RANGE(0xa000, 0xa000) AM_READ(ym2203_status_port_0_r) \
- AM_RANGE(0xa001, 0xa001) AM_READ(ym2203_data0_r) \
- AM_RANGE(0xa003, 0xa003) AM_READ(ym2203_data1_r) \
+ AM_RANGE(0xa000, 0xa001) AM_DEVREAD(SOUND, "ym", extport_select_and_ym2203_r) \
AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_RAM)
#define COMMON_SINGLE_WRITE \
- AM_RANGE(0xa000, 0xa000) AM_WRITE(ym2203_control_port_0_w) \
- AM_RANGE(0xa001, 0xa001) AM_WRITE(ym2203_write_port_0_w) \
+ AM_RANGE(0xa000, 0xa001) AM_DEVWRITE(SOUND, "ym", ym2203_w) \
AM_RANGE(0x8000, 0x9fff) AM_WRITE(SMH_RAM)
@@ -727,7 +716,7 @@ static ADDRESS_MAP_START( fhawk_3_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_RAM)
AM_RANGE(0xe000, 0xe000) AM_READ(SMH_NOP)
AM_RANGE(0xe001, 0xe001) AM_READ(taitosound_slave_comm_r)
- AM_RANGE(0xf000, 0xf000) AM_READ(ym2203_status_port_0_r)
+ AM_RANGE(0xf000, 0xf001) AM_DEVREAD(SOUND, "ym", ym2203_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( fhawk_3_writemem, ADDRESS_SPACE_PROGRAM, 8 )
@@ -735,8 +724,7 @@ static ADDRESS_MAP_START( fhawk_3_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0x9fff) AM_WRITE(SMH_RAM)
AM_RANGE(0xe000, 0xe000) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xe001, 0xe001) AM_WRITE(taitosound_slave_comm_w)
- AM_RANGE(0xf000, 0xf000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xf001, 0xf001) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0xf000, 0xf001) AM_DEVWRITE(SOUND, "ym", ym2203_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( raimais_readmem, ADDRESS_SPACE_PROGRAM, 8 )
@@ -775,9 +763,7 @@ static ADDRESS_MAP_START( raimais_3_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM)
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK7)
AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_READ(ym2610_status_port_0_a_r)
- AM_RANGE(0xe001, 0xe001) AM_READ(ym2610_read_port_0_r)
- AM_RANGE(0xe002, 0xe002) AM_READ(ym2610_status_port_0_b_r)
+ AM_RANGE(0xe000, 0xe003) AM_DEVREAD(SOUND, "ym", ym2610_r)
AM_RANGE(0xe200, 0xe200) AM_READ(SMH_NOP)
AM_RANGE(0xe201, 0xe201) AM_READ(taitosound_slave_comm_r)
ADDRESS_MAP_END
@@ -793,10 +779,7 @@ static WRITE8_HANDLER( sound_bankswitch_w )
static ADDRESS_MAP_START( raimais_3_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xdfff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ym2610_control_port_0_a_w)
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ym2610_data_port_0_a_w)
- AM_RANGE(0xe002, 0xe002) AM_WRITE(ym2610_control_port_0_b_w)
- AM_RANGE(0xe003, 0xe003) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0xe000, 0xe003) AM_DEVWRITE(SOUND, "ym", ym2610_w)
AM_RANGE(0xe200, 0xe200) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xe201, 0xe201) AM_WRITE(taitosound_slave_comm_w)
AM_RANGE(0xe400, 0xe403) AM_WRITE(SMH_NOP) /* pan */
@@ -849,7 +832,7 @@ static ADDRESS_MAP_START( champwr_3_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM)
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK7)
AM_RANGE(0x8000, 0x8fff) AM_READ(SMH_RAM)
- AM_RANGE(0x9000, 0x9000) AM_READ(ym2203_status_port_0_r)
+ AM_RANGE(0x9000, 0x9001) AM_DEVREAD(SOUND, "ym", ym2203_r)
AM_RANGE(0xa000, 0xa000) AM_READ(SMH_NOP)
AM_RANGE(0xa001, 0xa001) AM_READ(taitosound_slave_comm_r)
ADDRESS_MAP_END
@@ -857,14 +840,13 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( champwr_3_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x8fff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x9000, 0x9000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x9001, 0x9001) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0x9000, 0x9001) AM_DEVWRITE(SOUND, "ym", ym2203_w)
AM_RANGE(0xa000, 0xa000) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xa001, 0xa001) AM_WRITE(taitosound_slave_comm_w)
AM_RANGE(0xb000, 0xb000) AM_WRITE(champwr_msm5205_hi_w)
AM_RANGE(0xc000, 0xc000) AM_WRITE(champwr_msm5205_lo_w)
- AM_RANGE(0xd000, 0xd000) AM_WRITE(champwr_msm5205_start_w)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(champwr_msm5205_stop_w)
+ AM_RANGE(0xd000, 0xd000) AM_DEVWRITE(SOUND, "msm", champwr_msm5205_start_w)
+ AM_RANGE(0xe000, 0xe000) AM_DEVWRITE(SOUND, "msm", champwr_msm5205_stop_w)
ADDRESS_MAP_END
@@ -889,7 +871,7 @@ static ADDRESS_MAP_START( kurikint_2_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM)
AM_RANGE(0xe000, 0xe7ff) AM_READ(shared_r)
- AM_RANGE(0xe800, 0xe800) AM_READ(ym2203_status_port_0_r)
+ AM_RANGE(0xe800, 0xe801) AM_DEVREAD(SOUND, "ym", ym2203_r)
#if 0
AM_RANGE(0xd000, 0xd000) AM_READ_PORT("DSWA")
AM_RANGE(0xd001, 0xd001) AM_READ_PORT("DSWB")
@@ -903,8 +885,7 @@ static ADDRESS_MAP_START( kurikint_2_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xdfff) AM_WRITE(SMH_RAM)
AM_RANGE(0xe000, 0xe7ff) AM_WRITE(shared_w)
- AM_RANGE(0xe800, 0xe800) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xe801, 0xe801) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0xe800, 0xe801) AM_DEVWRITE(SOUND, "ym", ym2203_w)
#if 0
AM_RANGE(0xc000, 0xc000) AM_WRITE(rombank2switch_w)
#endif
@@ -1053,7 +1034,7 @@ static ADDRESS_MAP_START( evilston_2_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_READ(SMH_ROM)
AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM)
AM_RANGE(0xe000, 0xe7ff) AM_READ(shared_r)//shared_r },
- AM_RANGE(0xe800, 0xe800) AM_READ(ym2203_status_port_0_r)
+ AM_RANGE(0xe800, 0xe801) AM_DEVREAD(SOUND, "ym", ym2203_r)
AM_RANGE(0xf000, 0xf7ff) AM_READ(SMH_BANK7)
ADDRESS_MAP_END
@@ -1061,8 +1042,7 @@ static ADDRESS_MAP_START( evilston_2_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xdfff) AM_WRITE(SMH_RAM)
AM_RANGE(0xe000, 0xe7ff) AM_WRITE(shared_w)
- AM_RANGE(0xe800, 0xe800) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xe801, 0xe801) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0xe800, 0xe801) AM_DEVWRITE(SOUND, "ym", ym2203_w)
ADDRESS_MAP_END
@@ -2030,21 +2010,21 @@ GFXDECODE_END
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
-static WRITE8_HANDLER( portA_w )
+static WRITE8_DEVICE_HANDLER( portA_w )
{
if (cur_bank != (data & 0x03) )
{
int bankaddress;
- UINT8 *RAM = memory_region(space->machine, "audio");
+ UINT8 *RAM = memory_region(device->machine, "audio");
cur_bank = data & 0x03;
bankaddress = 0x10000 + (cur_bank-1) * 0x4000;
- memory_set_bankptr(space->machine, 7,&RAM[bankaddress]);
+ memory_set_bankptr(device->machine, 7,&RAM[bankaddress]);
//logerror ("YM2203 bank change val=%02x pc=%04x\n",cur_bank, cpu_get_pc(space->cpu) );
}
}
@@ -2054,10 +2034,10 @@ static const ym2203_interface ym2203_interface_triple =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- portA_w,
- NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(portA_w),
+ DEVCB_NULL,
},
irqhandler
};
@@ -2067,10 +2047,10 @@ static const ym2203_interface ym2203_interface_champwr =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- portA_w,
- champwr_msm5205_volume_w,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(portA_w),
+ DEVCB_DEVICE_HANDLER(SOUND, "msm", champwr_msm5205_volume_w),
},
irqhandler
};
@@ -2092,10 +2072,10 @@ static const ym2203_interface ym2203_interface_single =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- portA_r,
- portB_r,
- NULL,
- NULL
+ DEVCB_HANDLER(portA_r),
+ DEVCB_HANDLER(portB_r),
+ DEVCB_NULL,
+ DEVCB_NULL
},
NULL
};
diff --git a/src/mame/drivers/taito_x.c b/src/mame/drivers/taito_x.c
index 405f7a4db4c..a2a96264158 100644
--- a/src/mame/drivers/taito_x.c
+++ b/src/mame/drivers/taito_x.c
@@ -522,9 +522,7 @@ static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM)
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK2)
AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_READ(ym2610_status_port_0_a_r)
- AM_RANGE(0xe001, 0xe001) AM_READ(ym2610_read_port_0_r)
- AM_RANGE(0xe002, 0xe002) AM_READ(ym2610_status_port_0_b_r)
+ AM_RANGE(0xe000, 0xe003) AM_DEVREAD(SOUND, "ym", ym2610_r)
AM_RANGE(0xe200, 0xe200) AM_READ(SMH_NOP)
AM_RANGE(0xe201, 0xe201) AM_READ(taitosound_slave_comm_r)
AM_RANGE(0xea00, 0xea00) AM_READ(SMH_NOP)
@@ -533,10 +531,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xdfff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ym2610_control_port_0_a_w)
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ym2610_data_port_0_a_w)
- AM_RANGE(0xe002, 0xe002) AM_WRITE(ym2610_control_port_0_b_w)
- AM_RANGE(0xe003, 0xe003) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0xe000, 0xe003) AM_DEVWRITE(SOUND, "ym", ym2610_w)
AM_RANGE(0xe200, 0xe200) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xe201, 0xe201) AM_WRITE(taitosound_slave_comm_w)
AM_RANGE(0xe400, 0xe403) AM_WRITE(SMH_NOP) /* pan */
@@ -549,7 +544,7 @@ static ADDRESS_MAP_START( daisenpu_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM)
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK2)
AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM)
- AM_RANGE(0xe000, 0xe001) AM_READ(ym2151_status_port_0_r)
+ AM_RANGE(0xe000, 0xe001) AM_DEVREAD(SOUND, "ym", ym2151_r)
AM_RANGE(0xe200, 0xe200) AM_READ(SMH_NOP)
AM_RANGE(0xe201, 0xe201) AM_READ(taitosound_slave_comm_r)
AM_RANGE(0xea00, 0xea00) AM_READ(SMH_NOP)
@@ -558,8 +553,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( daisenpu_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xdfff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ym2151_data_port_0_w)
+ AM_RANGE(0xe000, 0xe001) AM_DEVWRITE(SOUND, "ym", ym2151_w)
AM_RANGE(0xe200, 0xe200) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xe201, 0xe201) AM_WRITE(taitosound_slave_comm_w)
AM_RANGE(0xe400, 0xe403) AM_WRITE(SMH_NOP) /* pan */
@@ -572,10 +566,7 @@ static ADDRESS_MAP_START( ballbros_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM)
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK2)
AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_READ(ym2610_status_port_0_a_r)
- AM_RANGE(0xe001, 0xe001) AM_READ(ym2610_read_port_0_r)
- AM_RANGE(0xe002, 0xe002) AM_READ(ym2610_status_port_0_b_r)
- AM_RANGE(0xe003, 0xe003) AM_READ(ym2610_read_port_0_r)
+ AM_RANGE(0xe000, 0xe003) AM_DEVREAD(SOUND, "ym", ym2610_r)
AM_RANGE(0xe200, 0xe200) AM_READ(SMH_NOP)
AM_RANGE(0xe200, 0xe200) AM_READ(SMH_NOP)
AM_RANGE(0xe201, 0xe201) AM_READ(taitosound_slave_comm_r)
@@ -585,10 +576,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( ballbros_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xdfff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ym2610_control_port_0_a_w)
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ym2610_data_port_0_a_w)
- AM_RANGE(0xe002, 0xe002) AM_WRITE(ym2610_control_port_0_b_w)
- AM_RANGE(0xe003, 0xe003) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0xe000, 0xe003) AM_DEVWRITE(SOUND, "ym", ym2610_w)
AM_RANGE(0xe200, 0xe200) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xe201, 0xe201) AM_WRITE(taitosound_slave_comm_w)
AM_RANGE(0xe400, 0xe403) AM_WRITE(SMH_NOP) /* pan */
@@ -966,9 +954,9 @@ GFXDECODE_END
/**************************************************************************/
/* handler called by the YM2610 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface ym2610_config =
diff --git a/src/mame/drivers/taito_z.c b/src/mame/drivers/taito_z.c
index 7c95caf16f4..16eef36a6ff 100644
--- a/src/mame/drivers/taito_z.c
+++ b/src/mame/drivers/taito_z.c
@@ -1482,6 +1482,8 @@ static READ16_HANDLER( taitoz_msb_sound_r )
/**** sound pan control ****/
static WRITE8_HANDLER( taitoz_pancontrol )
{
+ static const char *fltname[] = { "2610.1.r", "2610.1.l", "2610.2.r", "2610.2.l" };
+
// static UINT8 taitoz_pandata[4];
offset = offset&3;
@@ -1489,7 +1491,7 @@ static WRITE8_HANDLER( taitoz_pancontrol )
// taitoz_pandata[offset] = data;
// popmessage(" pan %02x %02x %02x %02x", taitoz_pandata[0], taitoz_pandata[1], taitoz_pandata[2], taitoz_pandata[3] );
- flt_volume_set_volume(offset, data / 255.0f);
+ flt_volume_set_volume(devtag_get_device(space->machine, SOUND, fltname[offset & 3]), data / 255.0f);
}
static WRITE16_HANDLER( spacegun_pancontrol )
@@ -1694,9 +1696,7 @@ static ADDRESS_MAP_START( bshark_cpub_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x108000, 0x10bfff) AM_READ(SMH_RAM)
AM_RANGE(0x110000, 0x113fff) AM_READ(sharedram_r)
// AM_RANGE(0x40000a, 0x40000b) AM_READ(taitoz_unknown_r) // ???
- AM_RANGE(0x600000, 0x600001) AM_READ(ym2610_status_port_0_a_lsb_r)
- AM_RANGE(0x600002, 0x600003) AM_READ(ym2610_read_port_0_lsb_r)
- AM_RANGE(0x600004, 0x600005) AM_READ(ym2610_status_port_0_b_lsb_r)
+ AM_RANGE(0x600000, 0x600007) AM_DEVREAD8(SOUND, "ym", ym2610_r, 0x00ff)
AM_RANGE(0x60000c, 0x60000d) AM_READ(SMH_NOP)
AM_RANGE(0x60000e, 0x60000f) AM_READ(SMH_NOP)
AM_RANGE(0x800000, 0x801fff) AM_READ(TC0150ROD_word_r) /* "root ram" */
@@ -1707,10 +1707,7 @@ static ADDRESS_MAP_START( bshark_cpub_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x108000, 0x10bfff) AM_WRITE(SMH_RAM)
AM_RANGE(0x110000, 0x113fff) AM_WRITE(sharedram_w)
AM_RANGE(0x400000, 0x400007) AM_WRITE(spacegun_pancontrol) /* pan */
- AM_RANGE(0x600000, 0x600001) AM_WRITE(ym2610_control_port_0_a_lsb_w)
- AM_RANGE(0x600002, 0x600003) AM_WRITE(ym2610_data_port_0_a_lsb_w)
- AM_RANGE(0x600004, 0x600005) AM_WRITE(ym2610_control_port_0_b_lsb_w)
- AM_RANGE(0x600006, 0x600007) AM_WRITE(ym2610_data_port_0_b_lsb_w)
+ AM_RANGE(0x600000, 0x600007) AM_DEVWRITE8(SOUND, "ym", ym2610_w, 0x00ff)
AM_RANGE(0x60000c, 0x60000d) AM_WRITE(SMH_NOP) // interrupt controller?
AM_RANGE(0x60000e, 0x60000f) AM_WRITE(SMH_NOP)
AM_RANGE(0x800000, 0x801fff) AM_WRITE(TC0150ROD_word_w) /* "root ram" */
@@ -1876,9 +1873,7 @@ static ADDRESS_MAP_START( spacegun_cpub_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x20c000, 0x20ffff) AM_READ(SMH_RAM) /* local CPUB ram */
AM_RANGE(0x210000, 0x21ffff) AM_READ(sharedram_r)
AM_RANGE(0x800000, 0x80000f) AM_READ(spacegun_input_bypass_r)
- AM_RANGE(0xc00000, 0xc00001) AM_READ(ym2610_status_port_0_a_lsb_r)
- AM_RANGE(0xc00002, 0xc00003) AM_READ(ym2610_read_port_0_lsb_r)
- AM_RANGE(0xc00004, 0xc00005) AM_READ(ym2610_status_port_0_b_lsb_r)
+ AM_RANGE(0xc00000, 0xc00007) AM_DEVREAD8(SOUND, "ym", ym2610_r, 0x00ff)
AM_RANGE(0xc0000c, 0xc0000d) AM_READ(SMH_NOP)
AM_RANGE(0xc0000e, 0xc0000f) AM_READ(SMH_NOP)
AM_RANGE(0xf00000, 0xf00007) AM_READ(spacegun_lightgun_r)
@@ -1889,10 +1884,7 @@ static ADDRESS_MAP_START( spacegun_cpub_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x20c000, 0x20ffff) AM_WRITE(SMH_RAM)
AM_RANGE(0x210000, 0x21ffff) AM_WRITE(sharedram_w)
AM_RANGE(0x800000, 0x80000f) AM_WRITE(spacegun_output_bypass_w)
- AM_RANGE(0xc00000, 0xc00001) AM_WRITE(ym2610_control_port_0_a_lsb_w)
- AM_RANGE(0xc00002, 0xc00003) AM_WRITE(ym2610_data_port_0_a_lsb_w)
- AM_RANGE(0xc00004, 0xc00005) AM_WRITE(ym2610_control_port_0_b_lsb_w)
- AM_RANGE(0xc00006, 0xc00007) AM_WRITE(ym2610_data_port_0_b_lsb_w)
+ AM_RANGE(0xc00000, 0xc00007) AM_DEVWRITE8(SOUND, "ym", ym2610_w, 0x00ff)
AM_RANGE(0xc0000c, 0xc0000d) AM_WRITE(SMH_NOP) // interrupt controller?
AM_RANGE(0xc0000e, 0xc0000f) AM_WRITE(SMH_NOP)
AM_RANGE(0xc20000, 0xc20007) AM_WRITE(spacegun_pancontrol) /* pan */
@@ -1998,9 +1990,7 @@ static ADDRESS_MAP_START( z80_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM)
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK10)
AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_READ(ym2610_status_port_0_a_r)
- AM_RANGE(0xe001, 0xe001) AM_READ(ym2610_read_port_0_r)
- AM_RANGE(0xe002, 0xe002) AM_READ(ym2610_status_port_0_b_r)
+ AM_RANGE(0xe000, 0xe003) AM_DEVREAD(SOUND, "ym", ym2610_r)
AM_RANGE(0xe200, 0xe200) AM_READ(SMH_NOP)
AM_RANGE(0xe201, 0xe201) AM_READ(taitosound_slave_comm_r)
AM_RANGE(0xea00, 0xea00) AM_READ(SMH_NOP)
@@ -2009,10 +1999,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( z80_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xdfff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ym2610_control_port_0_a_w)
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ym2610_data_port_0_a_w)
- AM_RANGE(0xe002, 0xe002) AM_WRITE(ym2610_control_port_0_b_w)
- AM_RANGE(0xe003, 0xe003) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0xe000, 0xe003) AM_DEVWRITE(SOUND, "ym", ym2610_w)
AM_RANGE(0xe200, 0xe200) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xe201, 0xe201) AM_WRITE(taitosound_slave_comm_w)
AM_RANGE(0xe400, 0xe403) AM_WRITE(taitoz_pancontrol) /* pan */
@@ -3043,16 +3030,16 @@ Interface B is for games which lack a Z80 (Spacegun, Bshark).
**************************************************************/
/* handler called by the YM2610 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq) // assumes Z80 sandwiched between 68Ks
+static void irqhandler(const device_config *device, int irq) // assumes Z80 sandwiched between 68Ks
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
/* handler called by the YM2610 emulator when the internal timers cause an IRQ */
-static void irqhandlerb(running_machine *machine, int irq)
+static void irqhandlerb(const device_config *device, int irq)
{
// DG: this is probably specific to Z80 and wrong?
-// cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+// cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface ym2610_config =
@@ -3071,7 +3058,7 @@ static const ym2610_interface ym2610_interfaceb =
**************************************************************/
#if 0
-static int subwoofer_sh_start(const sound_config *msound)
+static DEVICE_START( subwoofer )
{
/* Adjust the lowpass filter of the first three YM2610 channels */
@@ -3081,16 +3068,20 @@ static int subwoofer_sh_start(const sound_config *msound)
mixer_set_lowpass_frequency(0,20);
mixer_set_lowpass_frequency(1,20);
mixer_set_lowpass_frequency(2,20);
-
- return 0;
}
-static const custom_sound_interface subwoofer_interface =
+static DEVICE_GET_INFO( subwoofer )
{
- subwoofer_sh_start,
- 0, /* none */
- 0 /* none */
-};
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(subwoofer); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Subwoofer"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
+}
#endif
@@ -3180,7 +3171,7 @@ static MACHINE_DRIVER_START( contcirc )
MDRV_SOUND_ADD("2610.2.l", FILTER_VOLUME, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "front", 1.0)
-// MDRV_SOUND_ADD("subwoofer", CUSTOM, subwoofer_interface)
+// MDRV_SOUND_ADD("subwoofer", SUBWOOFER, 0)
MACHINE_DRIVER_END
@@ -3291,7 +3282,7 @@ static MACHINE_DRIVER_START( enforce )
MDRV_SOUND_ADD("2610.2.l", FILTER_VOLUME, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 1.0)
-// MDRV_SOUND_ADD("subwoofer", CUSTOM, subwoofer_interface)
+// MDRV_SOUND_ADD("subwoofer", SUBWOOFER, 0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/taitoair.c b/src/mame/drivers/taitoair.c
index add15d8282a..92ae21cf3c7 100644
--- a/src/mame/drivers/taitoair.c
+++ b/src/mame/drivers/taitoair.c
@@ -399,10 +399,7 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM
AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(1)
AM_RANGE(0xc000, 0xdfff) AM_RAM
- AM_RANGE(0xe000, 0xe000) AM_READWRITE(ym2610_status_port_0_a_r, ym2610_control_port_0_a_w)
- AM_RANGE(0xe001, 0xe001) AM_READWRITE(ym2610_read_port_0_r, ym2610_data_port_0_a_w)
- AM_RANGE(0xe002, 0xe002) AM_READWRITE(ym2610_status_port_0_b_r, ym2610_control_port_0_b_w)
- AM_RANGE(0xe003, 0xe003) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0xe000, 0xe003) AM_DEVREADWRITE(SOUND, "ym", ym2610_r, ym2610_w)
AM_RANGE(0xe200, 0xe200) AM_READWRITE(SMH_NOP, taitosound_slave_port_w)
AM_RANGE(0xe201, 0xe201) AM_READWRITE(taitosound_slave_comm_r, taitosound_slave_comm_w)
AM_RANGE(0xe400, 0xe403) AM_WRITE(SMH_NOP) /* pan control */
@@ -583,9 +580,9 @@ GFXDECODE_END
************************************************************/
/* Handler called by the YM2610 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface airsys_ym2610_interface =
diff --git a/src/mame/drivers/taitosj.c b/src/mame/drivers/taitosj.c
index f1b0573c6ae..11b5d60393b 100644
--- a/src/mame/drivers/taitosj.c
+++ b/src/mame/drivers/taitosj.c
@@ -173,7 +173,7 @@ TODO:
static UINT8 sndnmi_disable;
-static WRITE8_HANDLER( taitosj_sndnmi_msk_w )
+static WRITE8_DEVICE_HANDLER( taitosj_sndnmi_msk_w )
{
sndnmi_disable = data & 0x01;
}
@@ -186,7 +186,7 @@ static WRITE8_HANDLER( taitosj_soundcommand_w )
static UINT8 input_port_4_f0;
-static WRITE8_HANDLER( input_port_4_f0_w )
+static WRITE8_DEVICE_HANDLER( input_port_4_f0_w )
{
input_port_4_f0 = data >> 4;
}
@@ -220,8 +220,8 @@ static ADDRESS_MAP_START( taitosj_main_nomcu_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xd40b, 0xd40b) AM_MIRROR(0x00f0) AM_READ_PORT("IN2")
AM_RANGE(0xd40c, 0xd40c) AM_MIRROR(0x00f0) AM_READ_PORT("IN3") /* Service */
AM_RANGE(0xd40d, 0xd40d) AM_MIRROR(0x00f0) AM_READ_PORT("IN4")
- AM_RANGE(0xd40e, 0xd40e) AM_MIRROR(0x00f0) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xd40f, 0xd40f) AM_MIRROR(0x00f0) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w) /* DSW2 and DSW3 */
+ AM_RANGE(0xd40e, 0xd40f) AM_MIRROR(0x00f0) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0xd40f, 0xd40f) AM_MIRROR(0x00f0) AM_DEVREAD(SOUND, "ay1", ay8910_r) /* DSW2 and DSW3 */
AM_RANGE(0xd500, 0xd505) AM_MIRROR(0x00f0) AM_WRITE(SMH_RAM) AM_BASE(&taitosj_scroll)
AM_RANGE(0xd506, 0xd507) AM_MIRROR(0x00f0) AM_WRITE(SMH_RAM) AM_BASE(&taitosj_colorbank)
AM_RANGE(0xd508, 0xd508) AM_MIRROR(0x00f0) AM_WRITE(taitosj_collision_reg_clear_w)
@@ -260,8 +260,8 @@ static ADDRESS_MAP_START( taitosj_main_mcu_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xd40b, 0xd40b) AM_MIRROR(0x00f0) AM_READ_PORT("IN2")
AM_RANGE(0xd40c, 0xd40c) AM_MIRROR(0x00f0) AM_READ_PORT("IN3") /* Service */
AM_RANGE(0xd40d, 0xd40d) AM_MIRROR(0x00f0) AM_READ_PORT("IN4")
- AM_RANGE(0xd40e, 0xd40e) AM_MIRROR(0x00f0) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xd40f, 0xd40f) AM_MIRROR(0x00f0) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w) /* DSW2 and DSW3 */
+ AM_RANGE(0xd40e, 0xd40f) AM_MIRROR(0x00f0) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0xd40f, 0xd40f) AM_MIRROR(0x00f0) AM_DEVREAD(SOUND, "ay1", ay8910_r) /* DSW2 and DSW3 */
AM_RANGE(0xd500, 0xd505) AM_MIRROR(0x00f0) AM_WRITE(SMH_RAM) AM_BASE(&taitosj_scroll)
AM_RANGE(0xd506, 0xd507) AM_MIRROR(0x00f0) AM_WRITE(SMH_RAM) AM_BASE(&taitosj_colorbank)
AM_RANGE(0xd508, 0xd508) AM_MIRROR(0x00f0) AM_WRITE(taitosj_collision_reg_clear_w)
@@ -326,8 +326,8 @@ static ADDRESS_MAP_START( kikstart_main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xd40b, 0xd40b) AM_MIRROR(0x00f0) AM_READ_PORT("IN2")
AM_RANGE(0xd40c, 0xd40c) AM_MIRROR(0x00f0) AM_READ_PORT("IN3") /* Service */
AM_RANGE(0xd40d, 0xd40d) AM_MIRROR(0x00f0) AM_READ_PORT("IN4")
- AM_RANGE(0xd40e, 0xd40e) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xd40f, 0xd40f) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w) /* DSW2 and DSW3 */
+ AM_RANGE(0xd40e, 0xd40f) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0xd40f, 0xd40f) AM_DEVREAD(SOUND, "ay1", ay8910_r) /* DSW2 and DSW3 */
AM_RANGE(0xd508, 0xd508) AM_WRITE(taitosj_collision_reg_clear_w)
AM_RANGE(0xd509, 0xd50a) AM_WRITE(SMH_RAM) AM_BASE(&taitosj_gfxpointer)
AM_RANGE(0xd50b, 0xd50b) AM_WRITE(taitosj_soundcommand_w)
@@ -342,12 +342,12 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( taitosj_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM
AM_RANGE(0x4000, 0x43ff) AM_RAM
- AM_RANGE(0x4800, 0x4800) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x4801, 0x4801) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
- AM_RANGE(0x4802, 0x4802) AM_WRITE(ay8910_control_port_2_w)
- AM_RANGE(0x4803, 0x4803) AM_READWRITE(ay8910_read_port_2_r, ay8910_write_port_2_w)
- AM_RANGE(0x4804, 0x4804) AM_WRITE(ay8910_control_port_3_w)
- AM_RANGE(0x4805, 0x4805) AM_READWRITE(ay8910_read_port_3_r, ay8910_write_port_3_w)
+ AM_RANGE(0x4800, 0x4801) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x4801, 0x4801) AM_DEVREAD(SOUND, "ay2", ay8910_r)
+ AM_RANGE(0x4802, 0x4803) AM_DEVWRITE(SOUND, "ay3", ay8910_address_data_w)
+ AM_RANGE(0x4803, 0x4803) AM_DEVREAD(SOUND, "ay3", ay8910_r)
+ AM_RANGE(0x4804, 0x4805) AM_DEVWRITE(SOUND, "ay4", ay8910_address_data_w)
+ AM_RANGE(0x4805, 0x4805) AM_DEVREAD(SOUND, "ay4", ay8910_r)
AM_RANGE(0x5000, 0x5000) AM_READ(soundlatch_r)
AM_RANGE(0xe000, 0xefff) AM_ROM /* space for diagnostic ROM */
ADDRESS_MAP_END
@@ -1762,16 +1762,16 @@ static const UINT8 voltable[256] =
static INT8 dac_out;
static UINT8 dac_vol;
-static WRITE8_HANDLER( dac_out_w )
+static WRITE8_DEVICE_HANDLER( dac_out_w )
{
dac_out = data - 0x80;
- dac_signed_data_16_w(0,dac_out * dac_vol + 0x8000);
+ dac_signed_data_16_w(device,dac_out * dac_vol + 0x8000);
}
-static WRITE8_HANDLER( dac_vol_w )
+static WRITE8_DEVICE_HANDLER( dac_vol_w )
{
dac_vol = voltable[data];
- dac_signed_data_16_w(0,dac_out * dac_vol + 0x8000);
+ dac_signed_data_16_w(device,dac_out * dac_vol + 0x8000);
}
@@ -1779,40 +1779,40 @@ static const ay8910_interface ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_6_r,
- input_port_7_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_INPUT_PORT("DSW3"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- dac_out_w, /* port Awrite */
- dac_vol_w /* port Bwrite */
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_DEVICE_HANDLER(SOUND, "dac", dac_out_w), /* port Awrite */
+ DEVCB_DEVICE_HANDLER(SOUND, "dac", dac_vol_w) /* port Bwrite */
};
static const ay8910_interface ay8910_interface_3 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- input_port_4_f0_w,
- NULL
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(input_port_4_f0_w),
+ DEVCB_NULL
};
static const ay8910_interface ay8910_interface_4 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- NULL,
- taitosj_sndnmi_msk_w /* port Bwrite */
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(taitosj_sndnmi_msk_w) /* port Bwrite */
};
diff --git a/src/mame/drivers/tank8.c b/src/mame/drivers/tank8.c
index 5c269e1c846..2fc71a1d0cb 100644
--- a/src/mame/drivers/tank8.c
+++ b/src/mame/drivers/tank8.c
@@ -44,53 +44,53 @@ static WRITE8_HANDLER( tank8_int_reset_w )
cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
}
-static WRITE8_HANDLER( tank8_crash_w )
+static WRITE8_DEVICE_HANDLER( tank8_crash_w )
{
- discrete_sound_w(space, TANK8_CRASH_EN, data);
+ discrete_sound_w(device, TANK8_CRASH_EN, data);
}
-static WRITE8_HANDLER( tank8_explosion_w )
+static WRITE8_DEVICE_HANDLER( tank8_explosion_w )
{
- discrete_sound_w(space, TANK8_EXPLOSION_EN, data);
+ discrete_sound_w(device, TANK8_EXPLOSION_EN, data);
}
-static WRITE8_HANDLER( tank8_bugle_w )
+static WRITE8_DEVICE_HANDLER( tank8_bugle_w )
{
- discrete_sound_w(space, TANK8_BUGLE_EN, data);
+ discrete_sound_w(device, TANK8_BUGLE_EN, data);
}
-static WRITE8_HANDLER( tank8_bug_w )
+static WRITE8_DEVICE_HANDLER( tank8_bug_w )
{
/* D0 and D1 determine the on/off time off the square wave */
switch(data & 3) {
case 0:
- discrete_sound_w(space, TANK8_BUGLE_DATA1,8.0);
- discrete_sound_w(space, TANK8_BUGLE_DATA2,4.0);
+ discrete_sound_w(device, TANK8_BUGLE_DATA1,8.0);
+ discrete_sound_w(device, TANK8_BUGLE_DATA2,4.0);
break;
case 1:
- discrete_sound_w(space, TANK8_BUGLE_DATA1,8.0);
- discrete_sound_w(space, TANK8_BUGLE_DATA2,7.0);
+ discrete_sound_w(device, TANK8_BUGLE_DATA1,8.0);
+ discrete_sound_w(device, TANK8_BUGLE_DATA2,7.0);
break;
case 2:
- discrete_sound_w(space, TANK8_BUGLE_DATA1,8.0);
- discrete_sound_w(space, TANK8_BUGLE_DATA2,2.0);
+ discrete_sound_w(device, TANK8_BUGLE_DATA1,8.0);
+ discrete_sound_w(device, TANK8_BUGLE_DATA2,2.0);
break;
case 3:
- discrete_sound_w(space, TANK8_BUGLE_DATA1,16.0);
- discrete_sound_w(space, TANK8_BUGLE_DATA2,4.0);
+ discrete_sound_w(device, TANK8_BUGLE_DATA1,16.0);
+ discrete_sound_w(device, TANK8_BUGLE_DATA2,4.0);
break;
}
}
-static WRITE8_HANDLER( tank8_attract_w )
+static WRITE8_DEVICE_HANDLER( tank8_attract_w )
{
- discrete_sound_w(space, TANK8_ATTRACT_EN, data);
+ discrete_sound_w(device, TANK8_ATTRACT_EN, data);
}
-static WRITE8_HANDLER( tank8_motor_w )
+static WRITE8_DEVICE_HANDLER( tank8_motor_w )
{
- discrete_sound_w(space, NODE_RELATIVE(TANK8_MOTOR1_EN, offset), data);
+ discrete_sound_w(device, NODE_RELATIVE(TANK8_MOTOR1_EN, offset), data);
}
static ADDRESS_MAP_START( tank8_cpu_map, ADDRESS_SPACE_PROGRAM, 8 )
@@ -120,13 +120,13 @@ static ADDRESS_MAP_START( tank8_cpu_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1c30, 0x1c37) AM_WRITE(tank8_lockout_w)
AM_RANGE(0x1d00, 0x1d00) AM_WRITE(tank8_int_reset_w)
- AM_RANGE(0x1d01, 0x1d01) AM_WRITE(tank8_crash_w)
- AM_RANGE(0x1d02, 0x1d02) AM_WRITE(tank8_explosion_w)
- AM_RANGE(0x1d03, 0x1d03) AM_WRITE(tank8_bugle_w)
- AM_RANGE(0x1d04, 0x1d04) AM_WRITE(tank8_bug_w)
+ AM_RANGE(0x1d01, 0x1d01) AM_DEVWRITE(SOUND, "discrete", tank8_crash_w)
+ AM_RANGE(0x1d02, 0x1d02) AM_DEVWRITE(SOUND, "discrete", tank8_explosion_w)
+ AM_RANGE(0x1d03, 0x1d03) AM_DEVWRITE(SOUND, "discrete", tank8_bugle_w)
+ AM_RANGE(0x1d04, 0x1d04) AM_DEVWRITE(SOUND, "discrete", tank8_bug_w)
AM_RANGE(0x1d05, 0x1d05) AM_WRITE(SMH_RAM) AM_BASE(&tank8_team)
- AM_RANGE(0x1d06, 0x1d06) AM_WRITE(tank8_attract_w)
- AM_RANGE(0x1e00, 0x1e07) AM_WRITE(tank8_motor_w)
+ AM_RANGE(0x1d06, 0x1d06) AM_DEVWRITE(SOUND, "discrete", tank8_attract_w)
+ AM_RANGE(0x1e00, 0x1e07) AM_DEVWRITE(SOUND, "discrete", tank8_motor_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/tankbatt.c b/src/mame/drivers/tankbatt.c
index 22f7a7c5b5c..42eeaabe3c6 100644
--- a/src/mame/drivers/tankbatt.c
+++ b/src/mame/drivers/tankbatt.c
@@ -110,7 +110,7 @@ static WRITE8_HANDLER( tankbatt_interrupt_enable_w )
cpu_set_input_line(space->machine->cpu[0], INPUT_LINE_NMI, CLEAR_LINE);
}
/* hack - turn off the engine noise if the normal game nmi's are disabled */
- if (data) sample_stop (2);
+ if (data) sample_stop (devtag_get_device(space->machine, SOUND, "samples"), 2);
// interrupt_enable_w (offset, !data);
}
@@ -128,25 +128,32 @@ static WRITE8_HANDLER( tankbatt_demo_interrupt_enable_w )
static WRITE8_HANDLER( tankbatt_sh_expl_w )
{
if (tankbatt_sound_enable)
- sample_start (1, 3, 0);
+ {
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
+ sample_start (samples, 1, 3, 0);
+ }
}
static WRITE8_HANDLER( tankbatt_sh_engine_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
if (tankbatt_sound_enable)
{
if (data)
- sample_start (2, 2, 1);
+ sample_start (samples, 2, 2, 1);
else
- sample_start (2, 1, 1);
+ sample_start (samples, 2, 1, 1);
}
- else sample_stop (2);
+ else sample_stop (samples, 2);
}
static WRITE8_HANDLER( tankbatt_sh_fire_w )
{
if (tankbatt_sound_enable)
- sample_start (0, 0, 0);
+ {
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
+ sample_start (samples, 0, 0, 0);
+ }
}
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
diff --git a/src/mame/drivers/tankbust.c b/src/mame/drivers/tankbust.c
index ddea501a53d..0e0d7efbb26 100644
--- a/src/mame/drivers/tankbust.c
+++ b/src/mame/drivers/tankbust.c
@@ -50,14 +50,14 @@ static WRITE8_HANDLER( tankbust_soundlatch_w )
timer_call_after_resynch(space->machine, NULL, data,soundlatch_callback);
}
-static READ8_HANDLER( tankbust_soundlatch_r )
+static READ8_DEVICE_HANDLER( tankbust_soundlatch_r )
{
return latch;
}
//port B of ay8910#0
static UINT32 timer1=0;
-static READ8_HANDLER( tankbust_soundtimer_r )
+static READ8_DEVICE_HANDLER( tankbust_soundtimer_r )
{
int ret;
@@ -213,12 +213,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( port_map_cpu2, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x10, 0x10) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x30, 0x30) AM_READ(ay8910_read_port_1_r)
- AM_RANGE(0x30, 0x30) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x40, 0x40) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xc0, 0xc0) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0xc0, 0xc0) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x10, 0x10) AM_DEVWRITE(SOUND, "ay2", ay8910_data_w)
+ AM_RANGE(0x30, 0x30) AM_DEVREADWRITE(SOUND, "ay2", ay8910_r, ay8910_address_w)
+ AM_RANGE(0x40, 0x40) AM_DEVWRITE(SOUND, "ay1", ay8910_data_w)
+ AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE(SOUND, "ay1", ay8910_r, ay8910_address_w)
ADDRESS_MAP_END
@@ -328,10 +326,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- tankbust_soundlatch_r,
- tankbust_soundtimer_r,
- NULL,
- NULL
+ DEVCB_HANDLER(tankbust_soundlatch_r),
+ DEVCB_HANDLER(tankbust_soundtimer_r),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static MACHINE_RESET( tankbust )
diff --git a/src/mame/drivers/taotaido.c b/src/mame/drivers/taotaido.c
index 195c2716edf..dfe9830e70e 100644
--- a/src/mame/drivers/taotaido.c
+++ b/src/mame/drivers/taotaido.c
@@ -139,10 +139,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_port_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym2610_status_port_0_a_r, ym2610_control_port_0_a_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym2610_data_port_0_a_w)
- AM_RANGE(0x02, 0x02) AM_READWRITE(ym2610_status_port_0_b_r, ym2610_control_port_0_b_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(SOUND, "ym", ym2610_r, ym2610_w)
AM_RANGE(0x04, 0x04) AM_WRITE(taotaido_sh_bankswitch_w)
AM_RANGE(0x08, 0x08) AM_WRITE(pending_command_clear_w)
AM_RANGE(0x0c, 0x0c) AM_READ(soundlatch_r)
@@ -309,9 +306,9 @@ static GFXDECODE_START( taotaido )
GFXDECODE_ENTRY( "gfx2", 0, taotaido_layout, 0x300, 256 ) /* bg tiles */
GFXDECODE_END
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface ym2610_config =
diff --git a/src/mame/drivers/targeth.c b/src/mame/drivers/targeth.c
index 2594af17a62..b10078ba2b8 100644
--- a/src/mame/drivers/targeth.c
+++ b/src/mame/drivers/targeth.c
@@ -86,7 +86,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x700008, 0x700009) AM_READ_PORT("SERVICE") /* Service & Guns Reload? */
AM_RANGE(0x70000a, 0x70001b) AM_WRITE(SMH_NOP) /* ??? Guns reload related? */
AM_RANGE(0x70000c, 0x70000d) AM_WRITE(OKIM6295_bankswitch_w) /* OKI6295 bankswitch */
- AM_RANGE(0x70000e, 0x70000f) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w) /* OKI6295 status register */
+ AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff) /* OKI6295 status register */
AM_RANGE(0x70002a, 0x70003b) AM_WRITE(targeth_coin_counter_w) /* Coin counters */
AM_RANGE(0xfe0000, 0xfeffff) AM_RAM /* Work RAM (partially shared with DS5002FP) */
ADDRESS_MAP_END
diff --git a/src/mame/drivers/tatsumi.c b/src/mame/drivers/tatsumi.c
index b312b155097..65133786cc5 100644
--- a/src/mame/drivers/tatsumi.c
+++ b/src/mame/drivers/tatsumi.c
@@ -217,9 +217,8 @@ static ADDRESS_MAP_START( apache3_v20_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x00000, 0x01fff) AM_RAM
AM_RANGE(0x04000, 0x04003) AM_NOP // piu select .. ?
AM_RANGE(0x06000, 0x06001) AM_READ_PORT("IN0") // esw
- AM_RANGE(0x08000, 0x08000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x08001, 0x08001) AM_READWRITE(tatsumi_hack_ym2151_r, ym2151_data_port_0_w)
- AM_RANGE(0x0a000, 0x0a000) AM_READWRITE(tatsumi_hack_oki_r, okim6295_data_0_w)
+ AM_RANGE(0x08000, 0x08001) AM_DEVREADWRITE(SOUND, "ym", tatsumi_hack_ym2151_r, ym2151_w)
+ AM_RANGE(0x0a000, 0x0a000) AM_DEVREADWRITE(SOUND, "oki", tatsumi_hack_oki_r, okim6295_w)
AM_RANGE(0x0e000, 0x0e007) AM_READWRITE(apache3_adc_r, apache3_adc_w) //adc select
AM_RANGE(0xf0000, 0xfffff) AM_ROM
ADDRESS_MAP_END
@@ -262,9 +261,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( roundup5_z80_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xdfff) AM_ROM
AM_RANGE(0xe000, 0xffef) AM_RAM
- AM_RANGE(0xfff0, 0xfff0) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xfff1, 0xfff1) AM_READWRITE(tatsumi_hack_ym2151_r, ym2151_data_port_0_w)
- AM_RANGE(0xfff4, 0xfff4) AM_READWRITE(tatsumi_hack_oki_r, okim6295_data_0_w)
+ AM_RANGE(0xfff0, 0xfff1) AM_DEVREADWRITE(SOUND, "ym", tatsumi_hack_ym2151_r, ym2151_w)
+ AM_RANGE(0xfff4, 0xfff4) AM_DEVREADWRITE(SOUND, "oki", tatsumi_hack_oki_r, okim6295_w)
AM_RANGE(0xfff8, 0xfff8) AM_READ_PORT("IN0")
AM_RANGE(0xfff9, 0xfff9) AM_READ_PORT("IN1")
AM_RANGE(0xfffc, 0xfffc) AM_READ_PORT("STICKX")
@@ -320,9 +318,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( cyclwarr_z80_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xdfff) AM_ROM
AM_RANGE(0xe000, 0xffef) AM_RAM
- AM_RANGE(0xfff0, 0xfff0) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xfff1, 0xfff1) AM_READWRITE(tatsumi_hack_ym2151_r, ym2151_data_port_0_w)
- AM_RANGE(0xfff4, 0xfff4) AM_READWRITE(tatsumi_hack_oki_r, okim6295_data_0_w)
+ AM_RANGE(0xfff0, 0xfff1) AM_DEVREADWRITE(SOUND, "ym", tatsumi_hack_ym2151_r, ym2151_w)
+ AM_RANGE(0xfff4, 0xfff4) AM_DEVREADWRITE(SOUND, "oki", tatsumi_hack_oki_r, okim6295_w)
AM_RANGE(0xfffc, 0xfffc) AM_READ(soundlatch_r)
AM_RANGE(0xfffe, 0xfffe) AM_WRITE(SMH_NOP)
ADDRESS_MAP_END
@@ -818,9 +815,9 @@ GFXDECODE_END
/******************************************************************************/
-static void sound_irq(running_machine *machine, int state)
+static void sound_irq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[2], INPUT_LINE_IRQ0, state);
+ cpu_set_input_line(device->machine->cpu[2], INPUT_LINE_IRQ0, state);
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/taxidrvr.c b/src/mame/drivers/taxidrvr.c
index 37b08397a1c..5d9f9a07c30 100644
--- a/src/mame/drivers/taxidrvr.c
+++ b/src/mame/drivers/taxidrvr.c
@@ -76,19 +76,19 @@ static WRITE8_DEVICE_HANDLER( p1c_w )
s3 = (data & 2) >> 1;
}
-static READ8_HANDLER( p8910_0a_r )
+static READ8_DEVICE_HANDLER( p8910_0a_r )
{
return latchA;
}
-static READ8_HANDLER( p8910_1a_r )
+static READ8_DEVICE_HANDLER( p8910_1a_r )
{
return s3;
}
/* note that a lot of writes happen with port B set as input. I think this is a bug in the
original, since it works anyway even if the communication is flawed. */
-static WRITE8_HANDLER( p8910_0b_w )
+static WRITE8_DEVICE_HANDLER( p8910_0b_w )
{
s4 = data & 1;
}
@@ -183,10 +183,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( cpu3_port_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x02, 0x02) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x03, 0x03) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x01, 0x01) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0x02, 0x03) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x03, 0x03) AM_DEVREAD(SOUND, "ay2", ay8910_r)
ADDRESS_MAP_END
@@ -340,20 +340,20 @@ static const ay8910_interface ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- p8910_0a_r,
- NULL,
- NULL,
- p8910_0b_w
+ DEVCB_HANDLER(p8910_0a_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(p8910_0b_w)
};
static const ay8910_interface ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- p8910_1a_r,
- NULL,
- NULL,
- NULL
+ DEVCB_HANDLER(p8910_1a_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/tbowl.c b/src/mame/drivers/tbowl.c
index f3294b31560..be0a26c56bc 100644
--- a/src/mame/drivers/tbowl.c
+++ b/src/mame/drivers/tbowl.c
@@ -163,8 +163,9 @@ ADDRESS_MAP_END
static WRITE8_HANDLER( tbowl_adpcm_start_w )
{
+ const device_config *adpcm = devtag_get_device(space->machine, SOUND, (offset & 1) ? "msm2" : "msm1");
adpcm_pos[offset & 1] = data << 8;
- msm5205_reset_w(offset & 1,0);
+ msm5205_reset_w(adpcm,0);
}
static WRITE8_HANDLER( tbowl_adpcm_end_w )
@@ -174,7 +175,8 @@ static WRITE8_HANDLER( tbowl_adpcm_end_w )
static WRITE8_HANDLER( tbowl_adpcm_vol_w )
{
- msm5205_set_volume(offset & 1, (data & 0x7f) * 100 / 0x7f);
+ const device_config *adpcm = devtag_get_device(space->machine, SOUND, (offset & 1) ? "msm2" : "msm1");
+ msm5205_set_volume(adpcm, (data & 0x7f) * 100 / 0x7f);
}
static void tbowl_adpcm_int(const device_config *device)
@@ -182,10 +184,10 @@ static void tbowl_adpcm_int(const device_config *device)
int num = (strcmp(device->tag, "msm1") == 0) ? 0 : 1;
if (adpcm_pos[num] >= adpcm_end[num] ||
adpcm_pos[num] >= memory_region_length(device->machine, "adpcm")/2)
- msm5205_reset_w(num,1);
+ msm5205_reset_w(device,1);
else if (adpcm_data[num] != -1)
{
- msm5205_data_w(num,adpcm_data[num] & 0x0f);
+ msm5205_data_w(device,adpcm_data[num] & 0x0f);
adpcm_data[num] = -1;
}
else
@@ -193,17 +195,15 @@ static void tbowl_adpcm_int(const device_config *device)
UINT8 *ROM = memory_region(device->machine, "adpcm") + 0x10000 * num;
adpcm_data[num] = ROM[adpcm_pos[num]++];
- msm5205_data_w(num,adpcm_data[num] >> 4);
+ msm5205_data_w(device,adpcm_data[num] >> 4);
}
}
static ADDRESS_MAP_START( 6206A_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0xc000, 0xc7ff) AM_RAM
- AM_RANGE(0xd000, 0xd000) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0xd001, 0xd001) AM_WRITE(ym3812_write_port_0_w)
- AM_RANGE(0xd800, 0xd800) AM_WRITE(ym3812_control_port_1_w)
- AM_RANGE(0xd801, 0xd801) AM_WRITE(ym3812_write_port_1_w)
+ AM_RANGE(0xd000, 0xd001) AM_DEVWRITE(SOUND, "ym1", ym3812_w)
+ AM_RANGE(0xd800, 0xd801) AM_DEVWRITE(SOUND, "ym2", ym3812_w)
AM_RANGE(0xe000, 0xe001) AM_WRITE(tbowl_adpcm_end_w)
AM_RANGE(0xe002, 0xe003) AM_WRITE(tbowl_adpcm_start_w)
AM_RANGE(0xe004, 0xe005) AM_WRITE(tbowl_adpcm_vol_w)
@@ -442,12 +442,12 @@ GFXDECODE_END
*/
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[2],0,linestate);
+ cpu_set_input_line(device->machine->cpu[2],0,linestate);
}
-static const ym3526_interface ym3526_config =
+static const ym3812_interface ym3812_config =
{
irqhandler
};
@@ -523,7 +523,7 @@ static MACHINE_DRIVER_START( tbowl )
MDRV_SPEAKER_STANDARD_MONO("mono")
MDRV_SOUND_ADD("ym1", YM3812, 4000000)
- MDRV_SOUND_CONFIG(ym3526_config)
+ MDRV_SOUND_CONFIG(ym3812_config)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
MDRV_SOUND_ADD("ym2", YM3812, 4000000)
diff --git a/src/mame/drivers/tceptor.c b/src/mame/drivers/tceptor.c
index 708c65c4992..9ab44a3c1c3 100644
--- a/src/mame/drivers/tceptor.c
+++ b/src/mame/drivers/tceptor.c
@@ -109,9 +109,9 @@ static WRITE8_HANDLER( mcu_irq_disable_w )
}
-static WRITE8_HANDLER( voice_w )
+static WRITE8_DEVICE_HANDLER( voice_w )
{
- dac_signed_data_16_w(0, data ? (data + 1) * 0x100 : 0x8000);
+ dac_signed_data_16_w(device, data ? (data + 1) * 0x100 : 0x8000);
}
@@ -180,7 +180,7 @@ static ADDRESS_MAP_START( m6809_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(tceptor_tile_ram_w) AM_BASE(&tceptor_tile_ram)
AM_RANGE(0x1c00, 0x1fff) AM_RAM_WRITE(tceptor_tile_attr_w) AM_BASE(&tceptor_tile_attr)
AM_RANGE(0x2000, 0x3fff) AM_RAM_WRITE(tceptor_bg_ram_w) AM_BASE(&tceptor_bg_ram) // background (VIEW RAM)
- AM_RANGE(0x4000, 0x43ff) AM_READWRITE(namcos1_cus30_r, namcos1_cus30_w)
+ AM_RANGE(0x4000, 0x43ff) AM_DEVREADWRITE(SOUND, "namco", namcos1_cus30_r, namcos1_cus30_w)
AM_RANGE(0x4800, 0x4800) AM_WRITE(SMH_NOP) // 3D scope left/right?
AM_RANGE(0x4f00, 0x4f00) AM_READ(SMH_NOP) // unknown
AM_RANGE(0x4f01, 0x4f01) AM_READ_PORT("PEDAL") // analog input (accel)
@@ -200,8 +200,7 @@ static ADDRESS_MAP_START( m6502_a_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0100, 0x01ff) AM_RAM
AM_RANGE(0x0200, 0x02ff) AM_RAM
AM_RANGE(0x0300, 0x030f) AM_RAM
- AM_RANGE(0x2000, 0x2000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x2001, 0x2001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x2000, 0x2001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x3000, 0x30ff) AM_RAM AM_SHARE(3)
AM_RANGE(0x3c01, 0x3c01) AM_WRITE(SMH_RAM)
AM_RANGE(0x8000, 0xffff) AM_ROM
@@ -211,7 +210,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( m6502_b_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x00ff) AM_RAM AM_SHARE(2)
AM_RANGE(0x0100, 0x01ff) AM_RAM
- AM_RANGE(0x4000, 0x4000) AM_WRITE(voice_w) // voice data
+ AM_RANGE(0x4000, 0x4000) AM_DEVWRITE(SOUND, "dac", voice_w) // voice data
AM_RANGE(0x5000, 0x5000) AM_WRITE(SMH_RAM) // voice ctrl??
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -232,7 +231,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( mcu_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x001f) AM_READWRITE(hd63701_internal_registers_r, hd63701_internal_registers_w)
AM_RANGE(0x0080, 0x00ff) AM_RAM
- AM_RANGE(0x1000, 0x13ff) AM_READWRITE(namcos1_cus30_r, namcos1_cus30_w) AM_BASE(&namco_wavedata)
+ AM_RANGE(0x1000, 0x13ff) AM_DEVREADWRITE(SOUND, "namco", namcos1_cus30_r, namcos1_cus30_w) AM_BASE(&namco_wavedata)
AM_RANGE(0x1400, 0x154d) AM_RAM
AM_RANGE(0x17c0, 0x17ff) AM_RAM
AM_RANGE(0x2000, 0x20ff) AM_RAM AM_SHARE(3)
diff --git a/src/mame/drivers/tecmo.c b/src/mame/drivers/tecmo.c
index 448957d0135..98c1520f4cb 100644
--- a/src/mame/drivers/tecmo.c
+++ b/src/mame/drivers/tecmo.c
@@ -84,27 +84,27 @@ static WRITE8_HANDLER( tecmo_sound_command_w )
cpu_set_input_line(space->machine->cpu[1],INPUT_LINE_NMI,PULSE_LINE);
}
-static WRITE8_HANDLER( tecmo_adpcm_start_w )
+static WRITE8_DEVICE_HANDLER( tecmo_adpcm_start_w )
{
adpcm_pos = data << 8;
- msm5205_reset_w(0,0);
+ msm5205_reset_w(device,0);
}
static WRITE8_HANDLER( tecmo_adpcm_end_w )
{
adpcm_end = (data + 1) << 8;
}
-static WRITE8_HANDLER( tecmo_adpcm_vol_w )
+static WRITE8_DEVICE_HANDLER( tecmo_adpcm_vol_w )
{
- msm5205_set_volume(0,(data & 0x0f) * 100 / 15);
+ msm5205_set_volume(device,(data & 0x0f) * 100 / 15);
}
static void tecmo_adpcm_int(const device_config *device)
{
if (adpcm_pos >= adpcm_end ||
adpcm_pos >= memory_region_length(device->machine, "adpcm"))
- msm5205_reset_w(0,1);
+ msm5205_reset_w(device,1);
else if (adpcm_data != -1)
{
- msm5205_data_w(0,adpcm_data & 0x0f);
+ msm5205_data_w(device,adpcm_data & 0x0f);
adpcm_data = -1;
}
else
@@ -112,7 +112,7 @@ static void tecmo_adpcm_int(const device_config *device)
UINT8 *ROM = memory_region(device->machine, "adpcm");
adpcm_data = ROM[adpcm_pos++];
- msm5205_data_w(0,adpcm_data >> 4);
+ msm5205_data_w(device,adpcm_data >> 4);
}
}
@@ -196,11 +196,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( rygar_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x4000, 0x47ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x8000, 0x8000) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x8001, 0x8001) AM_WRITE(ym3812_write_port_0_w)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(tecmo_adpcm_start_w)
+ AM_RANGE(0x8000, 0x8001) AM_DEVWRITE(SOUND, "ym", ym3812_w)
+ AM_RANGE(0xc000, 0xc000) AM_DEVWRITE(SOUND, "msm", tecmo_adpcm_start_w)
AM_RANGE(0xd000, 0xd000) AM_WRITE(tecmo_adpcm_end_w)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(tecmo_adpcm_vol_w)
+ AM_RANGE(0xe000, 0xe000) AM_DEVWRITE(SOUND, "msm", tecmo_adpcm_vol_w)
AM_RANGE(0xf000, 0xf000) AM_WRITE(SMH_NOP) /* NMI acknowledge */
ADDRESS_MAP_END
@@ -215,11 +214,10 @@ static ADDRESS_MAP_START( tecmo_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
/* writes code to this area */
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xa000, 0xa000) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0xa001, 0xa001) AM_WRITE(ym3812_write_port_0_w)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(tecmo_adpcm_start_w)
+ AM_RANGE(0xa000, 0xa001) AM_DEVWRITE(SOUND, "ym", ym3812_w)
+ AM_RANGE(0xc000, 0xc000) AM_DEVWRITE(SOUND, "msm", tecmo_adpcm_start_w)
AM_RANGE(0xc400, 0xc400) AM_WRITE(tecmo_adpcm_end_w)
- AM_RANGE(0xc800, 0xc800) AM_WRITE(tecmo_adpcm_vol_w)
+ AM_RANGE(0xc800, 0xc800) AM_DEVWRITE(SOUND, "msm", tecmo_adpcm_vol_w)
AM_RANGE(0xcc00, 0xcc00) AM_WRITE(SMH_NOP) /* NMI acknowledge */
ADDRESS_MAP_END
@@ -542,12 +540,12 @@ GFXDECODE_END
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1],0,linestate);
+ cpu_set_input_line(device->machine->cpu[1],0,linestate);
}
-static const ym3526_interface ym3526_config =
+static const ym3812_interface ym3812_config =
{
irqhandler
};
@@ -596,7 +594,7 @@ static MACHINE_DRIVER_START( rygar )
MDRV_SPEAKER_STANDARD_MONO("mono")
MDRV_SOUND_ADD("ym", YM3812, XTAL_4MHz) /* verified on pcb */
- MDRV_SOUND_CONFIG(ym3526_config)
+ MDRV_SOUND_CONFIG(ym3812_config)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD("msm", MSM5205, XTAL_400kHz) /* verified on pcb, even if schematics shows a 384khz resonator */
diff --git a/src/mame/drivers/tecmo16.c b/src/mame/drivers/tecmo16.c
index 88df925fcd5..f1dc1801da3 100644
--- a/src/mame/drivers/tecmo16.c
+++ b/src/mame/drivers/tecmo16.c
@@ -148,8 +148,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_READ(SMH_ROM)
AM_RANGE(0xf000, 0xfbff) AM_READ(SMH_RAM) /* Sound RAM */
- AM_RANGE(0xfc00, 0xfc00) AM_READ(okim6295_status_0_r)
- AM_RANGE(0xfc05, 0xfc05) AM_READ(ym2151_status_port_0_r)
+ AM_RANGE(0xfc00, 0xfc00) AM_DEVREAD(SOUND, "oki", okim6295_r)
+ AM_RANGE(0xfc04, 0xfc05) AM_DEVREAD(SOUND, "ym", ym2151_r)
AM_RANGE(0xfc08, 0xfc08) AM_READ(soundlatch_r)
AM_RANGE(0xfc0c, 0xfc0c) AM_READ(SMH_NOP)
AM_RANGE(0xfffe, 0xffff) AM_READ(SMH_RAM)
@@ -158,9 +158,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_WRITE(SMH_ROM)
AM_RANGE(0xf000, 0xfbff) AM_WRITE(SMH_RAM) /* Sound RAM */
- AM_RANGE(0xfc00, 0xfc00) AM_WRITE(okim6295_data_0_w)
- AM_RANGE(0xfc04, 0xfc04) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xfc05, 0xfc05) AM_WRITE(ym2151_data_port_0_w)
+ AM_RANGE(0xfc00, 0xfc00) AM_DEVWRITE(SOUND, "oki", okim6295_w)
+ AM_RANGE(0xfc04, 0xfc05) AM_DEVWRITE(SOUND, "ym", ym2151_w)
AM_RANGE(0xfc0c, 0xfc0c) AM_WRITE(SMH_NOP)
AM_RANGE(0xfffe, 0xffff) AM_WRITE(SMH_RAM)
ADDRESS_MAP_END
@@ -425,9 +424,9 @@ GFXDECODE_END
/******************************************************************************/
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/tecmosys.c b/src/mame/drivers/tecmosys.c
index 6ac2fd177e7..6ca9dfd39b8 100644
--- a/src/mame/drivers/tecmosys.c
+++ b/src/mame/drivers/tecmosys.c
@@ -566,17 +566,13 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ymf262_status_0_r, ymf262_register_a_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ymf262_data_a_0_w)
- AM_RANGE(0x02, 0x02) AM_WRITE(ymf262_register_b_0_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ymf262_data_b_0_w)
- AM_RANGE(0x10, 0x10) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(SOUND, "ymf", ymf262_r, ymf262_w)
+ AM_RANGE(0x10, 0x10) AM_DEVWRITE(SOUND, "oki", okim6295_w)
AM_RANGE(0x20, 0x20) AM_WRITE(tecmosys_oki_bank_w)
AM_RANGE(0x30, 0x30) AM_WRITE(deroon_bankswitch_w)
AM_RANGE(0x40, 0x40) AM_READ(soundlatch_r)
AM_RANGE(0x50, 0x50) AM_WRITE(soundlatch2_w)
- AM_RANGE(0x60, 0x60) AM_READWRITE(ymz280b_status_0_r, ymz280b_register_0_w)
- AM_RANGE(0x61, 0x61) AM_WRITE(ymz280b_data_0_w)
+ AM_RANGE(0x60, 0x61) AM_DEVREADWRITE(SOUND, "ymz", ymz280b_r, ymz280b_w)
ADDRESS_MAP_END
@@ -889,10 +885,10 @@ static VIDEO_UPDATE(deroon)
*/
-static void sound_irq(running_machine *machine, int irq)
+static void sound_irq(const device_config *device, int irq)
{
/* IRQ */
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ymf262_interface tecmosys_ymf262_interface =
diff --git a/src/mame/drivers/tehkanwc.c b/src/mame/drivers/tehkanwc.c
index 5493a6b0f3f..8ad2ab2d841 100644
--- a/src/mame/drivers/tehkanwc.c
+++ b/src/mame/drivers/tehkanwc.c
@@ -181,29 +181,29 @@ static WRITE8_HANDLER( sound_answer_w )
static int msm_data_offs;
-static READ8_HANDLER( tehkanwc_portA_r )
+static READ8_DEVICE_HANDLER( tehkanwc_portA_r )
{
return msm_data_offs & 0xff;
}
-static READ8_HANDLER( tehkanwc_portB_r )
+static READ8_DEVICE_HANDLER( tehkanwc_portB_r )
{
return (msm_data_offs >> 8) & 0xff;
}
-static WRITE8_HANDLER( tehkanwc_portA_w )
+static WRITE8_DEVICE_HANDLER( tehkanwc_portA_w )
{
msm_data_offs = (msm_data_offs & 0xff00) | data;
}
-static WRITE8_HANDLER( tehkanwc_portB_w )
+static WRITE8_DEVICE_HANDLER( tehkanwc_portB_w )
{
msm_data_offs = (msm_data_offs & 0x00ff) | (data << 8);
}
-static WRITE8_HANDLER( msm_reset_w )
+static WRITE8_DEVICE_HANDLER( msm_reset_w )
{
- msm5205_reset_w(0,data ? 0 : 1);
+ msm5205_reset_w(device,data ? 0 : 1);
}
static void tehkanwc_adpcm_int(const device_config *device)
@@ -214,10 +214,10 @@ static void tehkanwc_adpcm_int(const device_config *device)
int msm_data = SAMPLES[msm_data_offs & 0x7fff];
if (toggle == 0)
- msm5205_data_w(0,(msm_data >> 4) & 0x0f);
+ msm5205_data_w(device,(msm_data >> 4) & 0x0f);
else
{
- msm5205_data_w(0,msm_data & 0x0f);
+ msm5205_data_w(device,msm_data & 0x0f);
msm_data_offs++;
}
@@ -272,7 +272,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_mem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM
AM_RANGE(0x4000, 0x47ff) AM_RAM
- AM_RANGE(0x8001, 0x8001) AM_WRITE(msm_reset_w)/* MSM51xx reset */
+ AM_RANGE(0x8001, 0x8001) AM_DEVWRITE(SOUND, "msm", msm_reset_w)/* MSM51xx reset */
AM_RANGE(0x8002, 0x8002) AM_WRITE(SMH_NOP) /* ?? written in the IRQ handler */
AM_RANGE(0x8003, 0x8003) AM_WRITE(SMH_NOP) /* ?? written in the NMI handler */
AM_RANGE(0xc000, 0xc000) AM_READWRITE(soundlatch_r, sound_answer_w)
@@ -280,10 +280,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_port, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x02, 0x02) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0x00, 0x00) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay1", ay8910_data_address_w)
+ AM_RANGE(0x02, 0x02) AM_DEVREAD(SOUND, "ay2", ay8910_r)
+ AM_RANGE(0x02, 0x03) AM_DEVWRITE(SOUND, "ay2", ay8910_data_address_w)
ADDRESS_MAP_END
@@ -633,20 +633,20 @@ static const ay8910_interface ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- tehkanwc_portA_w,
- tehkanwc_portB_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(tehkanwc_portA_w),
+ DEVCB_HANDLER(tehkanwc_portB_w)
};
static const ay8910_interface ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- tehkanwc_portA_r,
- tehkanwc_portB_r,
- NULL,
- NULL
+ DEVCB_HANDLER(tehkanwc_portA_r),
+ DEVCB_HANDLER(tehkanwc_portB_r),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const msm5205_interface msm5205_config =
diff --git a/src/mame/drivers/tempest.c b/src/mame/drivers/tempest.c
index 829f0a0c38e..c82322ebc4f 100644
--- a/src/mame/drivers/tempest.c
+++ b/src/mame/drivers/tempest.c
@@ -334,15 +334,15 @@ static CUSTOM_INPUT( clock_r )
}
-static READ8_HANDLER( input_port_1_bit_r )
+static READ8_DEVICE_HANDLER( input_port_1_bit_r )
{
- return (input_port_read(space->machine, "IN1/DSW0") & (1 << offset)) ? 0 : 228;
+ return (input_port_read(device->machine, "IN1/DSW0") & (1 << offset)) ? 0 : 228;
}
-static READ8_HANDLER( input_port_2_bit_r )
+static READ8_DEVICE_HANDLER( input_port_2_bit_r )
{
- return (input_port_read(space->machine, "IN2") & (1 << offset)) ? 0 : 228;
+ return (input_port_read(device->machine, "IN2") & (1 << offset)) ? 0 : 228;
}
@@ -397,8 +397,8 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x6060, 0x6060) AM_READ(mb_lo_r)
AM_RANGE(0x6070, 0x6070) AM_READ(mb_hi_r)
AM_RANGE(0x6080, 0x609f) AM_WRITE(mb_go_w)
- AM_RANGE(0x60c0, 0x60cf) AM_READWRITE(pokey1_r, pokey1_w)
- AM_RANGE(0x60d0, 0x60df) AM_READWRITE(pokey2_r, pokey2_w)
+ AM_RANGE(0x60c0, 0x60cf) AM_DEVREADWRITE(SOUND, "pokey1", pokey_r, pokey_w)
+ AM_RANGE(0x60d0, 0x60df) AM_DEVREADWRITE(SOUND, "pokey2", pokey_r, pokey_w)
AM_RANGE(0x60e0, 0x60e0) AM_WRITE(tempest_led_w)
AM_RANGE(0x9000, 0xdfff) AM_ROM
AM_RANGE(0xf000, 0xffff) AM_ROM /* for the reset / interrupt vectors */
@@ -531,14 +531,30 @@ INPUT_PORTS_END
static const pokey_interface pokey_interface_1 =
{
- { input_port_1_bit_r,input_port_1_bit_r,input_port_1_bit_r,input_port_1_bit_r,
- input_port_1_bit_r,input_port_1_bit_r,input_port_1_bit_r,input_port_1_bit_r }
+ {
+ DEVCB_HANDLER(input_port_1_bit_r),
+ DEVCB_HANDLER(input_port_1_bit_r),
+ DEVCB_HANDLER(input_port_1_bit_r),
+ DEVCB_HANDLER(input_port_1_bit_r),
+ DEVCB_HANDLER(input_port_1_bit_r),
+ DEVCB_HANDLER(input_port_1_bit_r),
+ DEVCB_HANDLER(input_port_1_bit_r),
+ DEVCB_HANDLER(input_port_1_bit_r)
+ }
};
static const pokey_interface pokey_interface_2 =
{
- { input_port_2_bit_r,input_port_2_bit_r,input_port_2_bit_r,input_port_2_bit_r,
- input_port_2_bit_r,input_port_2_bit_r,input_port_2_bit_r,input_port_2_bit_r }
+ {
+ DEVCB_HANDLER(input_port_2_bit_r),
+ DEVCB_HANDLER(input_port_2_bit_r),
+ DEVCB_HANDLER(input_port_2_bit_r),
+ DEVCB_HANDLER(input_port_2_bit_r),
+ DEVCB_HANDLER(input_port_2_bit_r),
+ DEVCB_HANDLER(input_port_2_bit_r),
+ DEVCB_HANDLER(input_port_2_bit_r),
+ DEVCB_HANDLER(input_port_2_bit_r)
+ }
};
diff --git a/src/mame/drivers/terracre.c b/src/mame/drivers/terracre.c
index 6c7631171da..0c2d9df802f 100644
--- a/src/mame/drivers/terracre.c
+++ b/src/mame/drivers/terracre.c
@@ -86,7 +86,7 @@ AT-2
#include "cpu/z80/z80.h"
#include "sound/dac.h"
#include "sound/2203intf.h"
-#include "sound/3812intf.h"
+#include "sound/3526intf.h"
static const UINT16 *mpProtData;
static UINT8 mAmazonProtCmd;
@@ -266,20 +266,18 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_3526_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym3526_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym3526_write_port_0_w)
- AM_RANGE(0x02, 0x02) AM_WRITE(dac_0_signed_data_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(dac_1_signed_data_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ym", ym3526_w)
+ AM_RANGE(0x02, 0x02) AM_DEVWRITE(SOUND, "dac1", dac_signed_w)
+ AM_RANGE(0x03, 0x03) AM_DEVWRITE(SOUND, "dac2", dac_signed_w)
AM_RANGE(0x04, 0x04) AM_READ(soundlatch_clear_r)
AM_RANGE(0x06, 0x06) AM_READ(soundlatch_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_2203_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0x02, 0x02) AM_WRITE(dac_0_signed_data_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(dac_1_signed_data_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x02, 0x02) AM_DEVWRITE(SOUND, "dac1", dac_signed_w)
+ AM_RANGE(0x03, 0x03) AM_DEVWRITE(SOUND, "dac2", dac_signed_w)
AM_RANGE(0x04, 0x04) AM_READ(soundlatch_clear_r)
AM_RANGE(0x06, 0x06) AM_READ(soundlatch_r)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/tetrisp2.c b/src/mame/drivers/tetrisp2.c
index d9c0ec420a2..8d45e564666 100644
--- a/src/mame/drivers/tetrisp2.c
+++ b/src/mame/drivers/tetrisp2.c
@@ -104,20 +104,6 @@ static WRITE16_HANDLER( rocknms_sub_systemregs_w )
***************************************************************************/
-static READ16_HANDLER( tetrisp2_sound_r )
-{
- return ymz280b_status_0_r(space,offset);
-}
-
-static WRITE16_HANDLER( tetrisp2_sound_w )
-{
- if (ACCESSING_BITS_0_7)
- {
- if (offset) ymz280b_data_0_w (space, offset, data & 0xff);
- else ymz280b_register_0_w (space, offset, data & 0xff);
- }
-}
-
static READ16_HANDLER( rockn_adpcmbank_r )
{
return ((rockn_adpcmbank & 0xf0ff) | (rockn_protectdata << 8));
@@ -334,7 +320,7 @@ static ADDRESS_MAP_START( tetrisp2_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x500000, 0x50ffff) AM_READ(SMH_RAM ) // Line
AM_RANGE(0x600000, 0x60ffff) AM_READ(SMH_RAM ) // Rotation
AM_RANGE(0x650000, 0x651fff) AM_READ(SMH_RAM ) // Rotation (mirror)
- AM_RANGE(0x800002, 0x800003) AM_READ(tetrisp2_sound_r ) // Sound
+ AM_RANGE(0x800002, 0x800003) AM_DEVREAD8(SOUND, "ymz", ymz280b_r, 0x00ff) // Sound
AM_RANGE(0x900000, 0x903fff) AM_READ(tetrisp2_nvram_r ) // NVRAM
AM_RANGE(0x904000, 0x907fff) AM_READ(tetrisp2_nvram_r ) // NVRAM (mirror)
AM_RANGE(0xbe0000, 0xbe0001) AM_READ(SMH_NOP ) // INT-level1 dummy read
@@ -357,7 +343,7 @@ static ADDRESS_MAP_START( tetrisp2_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x500000, 0x50ffff) AM_WRITE(SMH_RAM ) // Line
AM_RANGE(0x600000, 0x60ffff) AM_WRITE(tetrisp2_vram_rot_w) AM_BASE(&tetrisp2_vram_rot ) // Rotation
AM_RANGE(0x650000, 0x651fff) AM_WRITE(tetrisp2_vram_rot_w ) // Rotation (mirror)
- AM_RANGE(0x800000, 0x800003) AM_WRITE(tetrisp2_sound_w ) // Sound
+ AM_RANGE(0x800000, 0x800003) AM_DEVWRITE8(SOUND, "ymz", ymz280b_w, 0x00ff ) // Sound
AM_RANGE(0x900000, 0x903fff) AM_WRITE(tetrisp2_nvram_w) AM_BASE(&tetrisp2_nvram) AM_SIZE(&tetrisp2_nvram_size ) // NVRAM
AM_RANGE(0x904000, 0x907fff) AM_WRITE(tetrisp2_nvram_w ) // NVRAM (mirror)
AM_RANGE(0xb00000, 0xb00001) AM_WRITE(tetrisp2_coincounter_w ) // Coin Counter
@@ -412,7 +398,7 @@ static ADDRESS_MAP_START( nndmseal_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x600000, 0x60ffff) AM_RAM_WRITE(tetrisp2_vram_rot_w) AM_BASE(&tetrisp2_vram_rot ) // Rotation
AM_RANGE(0x650000, 0x651fff) AM_RAM_WRITE(tetrisp2_vram_rot_w) // Rotation (mirror)
- AM_RANGE(0x800000, 0x800003) AM_READWRITE( okim6295_status_0_lsb_r, okim6295_data_0_lsb_w ) // Sound
+ AM_RANGE(0x800000, 0x800003) AM_DEVREADWRITE8( SOUND, "oki", okim6295_r, okim6295_w, 0x00ff ) // Sound
AM_RANGE(0x900000, 0x903fff) AM_READWRITE(tetrisp2_nvram_r, tetrisp2_nvram_w) AM_BASE(&tetrisp2_nvram) AM_SIZE(&tetrisp2_nvram_size ) // NVRAM
@@ -454,7 +440,7 @@ static ADDRESS_MAP_START( rockn1_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x600000, 0x60ffff) AM_READ(SMH_RAM ) // Rotation
AM_RANGE(0x900000, 0x903fff) AM_READ(rockn_nvram_r ) // NVRAM
AM_RANGE(0xa30000, 0xa30001) AM_READ(rockn_soundvolume_r ) // Sound Volume
- AM_RANGE(0xa40002, 0xa40003) AM_READ(tetrisp2_sound_r ) // Sound
+ AM_RANGE(0xa40002, 0xa40003) AM_DEVREAD8(SOUND, "ymz", ymz280b_r, 0x00ff) // Sound
AM_RANGE(0xa44000, 0xa44001) AM_READ(rockn_adpcmbank_r ) // Sound Bank
AM_RANGE(0xbe0000, 0xbe0001) AM_READ(SMH_NOP ) // INT-level1 dummy read
AM_RANGE(0xbe0002, 0xbe0003) AM_READ_PORT("PLAYERS") // Inputs
@@ -477,7 +463,7 @@ static ADDRESS_MAP_START( rockn1_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x600000, 0x60ffff) AM_WRITE(tetrisp2_vram_rot_w) AM_BASE(&tetrisp2_vram_rot ) // Rotation
AM_RANGE(0x900000, 0x903fff) AM_WRITE(tetrisp2_nvram_w) AM_BASE(&tetrisp2_nvram) AM_SIZE(&tetrisp2_nvram_size ) // NVRAM
AM_RANGE(0xa30000, 0xa30001) AM_WRITE(rockn_soundvolume_w ) // Sound Volume
- AM_RANGE(0xa40000, 0xa40003) AM_WRITE(tetrisp2_sound_w ) // Sound
+ AM_RANGE(0xa40000, 0xa40003) AM_DEVWRITE8(SOUND, "ymz", ymz280b_w, 0x00ff ) // Sound
AM_RANGE(0xa44000, 0xa44001) AM_WRITE(rockn_adpcmbank_w ) // Sound Bank
AM_RANGE(0xa48000, 0xa48001) AM_WRITE(SMH_NOP ) // YMZ280 Reset
AM_RANGE(0xb00000, 0xb00001) AM_WRITE(tetrisp2_coincounter_w ) // Coin Counter
@@ -505,7 +491,7 @@ static ADDRESS_MAP_START( rockn2_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x808000, 0x809fff) AM_READ(SMH_RAM ) // ???
AM_RANGE(0x900000, 0x903fff) AM_READ(rockn_nvram_r ) // NVRAM
AM_RANGE(0xa30000, 0xa30001) AM_READ(rockn_soundvolume_r ) // Sound Volume
- AM_RANGE(0xa40002, 0xa40003) AM_READ(tetrisp2_sound_r ) // Sound
+ AM_RANGE(0xa40002, 0xa40003) AM_DEVREAD8(SOUND, "ymz", ymz280b_r, 0x00ff) // Sound
AM_RANGE(0xa44000, 0xa44001) AM_READ(rockn_adpcmbank_r ) // Sound Bank
AM_RANGE(0xbe0000, 0xbe0001) AM_READ(SMH_NOP ) // INT-level1 dummy read
AM_RANGE(0xbe0002, 0xbe0003) AM_READ_PORT("PLAYERS") // Inputs
@@ -528,7 +514,7 @@ static ADDRESS_MAP_START( rockn2_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x808000, 0x809fff) AM_WRITE(SMH_RAM ) // ???
AM_RANGE(0x900000, 0x903fff) AM_WRITE(tetrisp2_nvram_w) AM_BASE(&tetrisp2_nvram) AM_SIZE(&tetrisp2_nvram_size ) // NVRAM
AM_RANGE(0xa30000, 0xa30001) AM_WRITE(rockn_soundvolume_w ) // Sound Volume
- AM_RANGE(0xa40000, 0xa40003) AM_WRITE(tetrisp2_sound_w ) // Sound
+ AM_RANGE(0xa40000, 0xa40003) AM_DEVWRITE8(SOUND, "ymz", ymz280b_w, 0x00ff ) // Sound
AM_RANGE(0xa44000, 0xa44001) AM_WRITE(rockn2_adpcmbank_w ) // Sound Bank
AM_RANGE(0xa48000, 0xa48001) AM_WRITE(SMH_NOP ) // YMZ280 Reset
AM_RANGE(0xb00000, 0xb00001) AM_WRITE(tetrisp2_coincounter_w ) // Coin Counter
@@ -556,7 +542,7 @@ static ADDRESS_MAP_START( rocknms_main_readmem, ADDRESS_SPACE_PROGRAM, 16 )
// AM_RANGE(0x808000, 0x809fff) AM_READ(SMH_RAM ) // ???
AM_RANGE(0x900000, 0x903fff) AM_READ(rockn_nvram_r ) // NVRAM
AM_RANGE(0xa30000, 0xa30001) AM_READ(rockn_soundvolume_r ) // Sound Volume
- AM_RANGE(0xa40002, 0xa40003) AM_READ(tetrisp2_sound_r ) // Sound
+ AM_RANGE(0xa40002, 0xa40003) AM_DEVREAD8(SOUND, "ymz", ymz280b_r, 0x00ff) // Sound
AM_RANGE(0xa44000, 0xa44001) AM_READ(rockn_adpcmbank_r ) // Sound Bank
AM_RANGE(0xbe0000, 0xbe0001) AM_READ(SMH_NOP ) // INT-level1 dummy read
AM_RANGE(0xbe0002, 0xbe0003) AM_READ_PORT("PLAYERS")
@@ -579,8 +565,8 @@ static ADDRESS_MAP_START( rocknms_main_writemem, ADDRESS_SPACE_PROGRAM, 16 )
// AM_RANGE(0x808000, 0x809fff) AM_WRITE(SMH_RAM ) // ???
AM_RANGE(0x900000, 0x903fff) AM_WRITE(tetrisp2_nvram_w) AM_BASE(&tetrisp2_nvram) AM_SIZE(&tetrisp2_nvram_size ) // NVRAM
AM_RANGE(0xa30000, 0xa30001) AM_WRITE(rockn_soundvolume_w ) // Sound Volume
- AM_RANGE(0xa40000, 0xa40003) AM_WRITE(tetrisp2_sound_w ) // Sound
- AM_RANGE(0xa44000, 0xa44001) AM_WRITE(rockn_adpcmbank_w ) // Sound Bank
+ AM_RANGE(0xa40000, 0xa40003) AM_DEVWRITE8(SOUND, "ymz", ymz280b_w, 0x00ff ) // Sound
+ AM_RANGE(0xa44000, 0xa44001) AM_WRITE(rockn_adpcmbank_w ) // Sound Bank
AM_RANGE(0xa48000, 0xa48001) AM_WRITE(SMH_NOP ) // YMZ280 Reset
AM_RANGE(0xa00000, 0xa00001) AM_WRITE(rocknms_main2sub_w ) // MAIN -> SUB Communication
AM_RANGE(0xb00000, 0xb00001) AM_WRITE(tetrisp2_coincounter_w ) // Coin Counter
@@ -627,7 +613,7 @@ static ADDRESS_MAP_START( rocknms_sub_writemem, ADDRESS_SPACE_PROGRAM, 16 )
// AM_RANGE(0x808000, 0x809fff) AM_WRITE(SMH_RAM ) // ???
AM_RANGE(0x900000, 0x907fff) AM_WRITE(SMH_RAM ) // NVRAM
AM_RANGE(0xa30000, 0xa30001) AM_WRITE(rockn_soundvolume_w ) // Sound Volume
- AM_RANGE(0xa40000, 0xa40003) AM_WRITE(tetrisp2_sound_w ) // Sound
+ AM_RANGE(0xa40000, 0xa40003) AM_DEVWRITE8(SOUND, "ymz", ymz280b_w, 0x00ff ) // Sound
AM_RANGE(0xa44000, 0xa44001) AM_WRITE(rockn_adpcmbank_w ) // Sound Bank
AM_RANGE(0xa48000, 0xa48001) AM_WRITE(SMH_NOP ) // YMZ280 Reset
AM_RANGE(0xb00000, 0xb00001) AM_WRITE(rocknms_sub2main_w ) // MAIN <- SUB Communication
diff --git a/src/mame/drivers/thayers.c b/src/mame/drivers/thayers.c
index 8eda2b5a8a3..8ea5e4054a8 100644
--- a/src/mame/drivers/thayers.c
+++ b/src/mame/drivers/thayers.c
@@ -779,8 +779,7 @@ static MACHINE_DRIVER_START( thayers )
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
// SSI 263 @ 2MHz
- MDRV_SOUND_ADD("ldsound", CUSTOM, 0)
- MDRV_SOUND_CONFIG(laserdisc_custom_interface)
+ MDRV_SOUND_ADD("ldsound", LASERDISC, 0)
MDRV_SOUND_ROUTE(0, "left", 1.0)
MDRV_SOUND_ROUTE(1, "right", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/thedeep.c b/src/mame/drivers/thedeep.c
index 16ee39b78ee..fe1ffceab4f 100644
--- a/src/mame/drivers/thedeep.c
+++ b/src/mame/drivers/thedeep.c
@@ -179,8 +179,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM
- AM_RANGE(0x0800, 0x0800) AM_WRITE(ym2203_control_port_0_w ) // YM2203
- AM_RANGE(0x0801, 0x0801) AM_WRITE(ym2203_write_port_0_w ) //
+ AM_RANGE(0x0800, 0x0801) AM_DEVWRITE(SOUND, "ym", ym2203_w ) //
AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r ) // From Main CPU
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -307,9 +306,9 @@ GFXDECODE_END
***************************************************************************/
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface thedeep_ym2203_intf =
@@ -317,7 +316,7 @@ static const ym2203_interface thedeep_ym2203_intf =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
irqhandler
};
diff --git a/src/mame/drivers/thepit.c b/src/mame/drivers/thepit.c
index 7cca4c16a0f..f04296e9466 100644
--- a/src/mame/drivers/thepit.c
+++ b/src/mame/drivers/thepit.c
@@ -216,10 +216,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( audio_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(soundlatch_clear_w)
- AM_RANGE(0x8c, 0x8c) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x8d, 0x8d) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x8e, 0x8e) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x8f, 0x8f) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
+ AM_RANGE(0x8c, 0x8d) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x8e, 0x8f) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
ADDRESS_MAP_END
@@ -641,10 +639,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r,
- NULL,
- NULL,
- NULL
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/thief.c b/src/mame/drivers/thief.c
index 0afeb4404cc..bd8b841f8fe 100644
--- a/src/mame/drivers/thief.c
+++ b/src/mame/drivers/thief.c
@@ -76,35 +76,35 @@ enum
kTalkTrack, kCrashTrack
};
-static void tape_set_audio( int track, int bOn )
+static void tape_set_audio( const device_config *samples, int track, int bOn )
{
- sample_set_volume( track, bOn ? 1.0 : 0.0 );
+ sample_set_volume(samples, track, bOn ? 1.0 : 0.0 );
}
-static void tape_set_motor( int bOn )
+static void tape_set_motor( const device_config *samples, int bOn )
{
if( bOn )
{
/* If talk track is not playing, start it. */
- if (! sample_playing( kTalkTrack ))
- sample_start( 0, kTalkTrack, 1 );
+ if (! sample_playing(samples, kTalkTrack ))
+ sample_start( samples, 0, kTalkTrack, 1 );
/* Resume playback of talk track. */
- sample_set_pause( kTalkTrack, 0);
+ sample_set_pause( samples, kTalkTrack, 0);
/* If crash track is not playing, start it. */
- if (! sample_playing( kCrashTrack ))
- sample_start( 1, kCrashTrack, 1 );
+ if (! sample_playing(samples, kCrashTrack ))
+ sample_start( samples, 1, kCrashTrack, 1 );
/* Resume playback of crash track. */
- sample_set_pause( kCrashTrack, 0);
+ sample_set_pause( samples, kCrashTrack, 0);
}
else
{
/* Pause both the talk and crash tracks. */
- sample_set_pause( kTalkTrack, 1 );
- sample_set_pause( kCrashTrack, 1 );
+ sample_set_pause( samples, kTalkTrack, 1 );
+ sample_set_pause( samples, kCrashTrack, 1 );
}
}
@@ -115,7 +115,7 @@ static WRITE8_HANDLER( thief_input_select_w )
thief_input_select = data;
}
-static WRITE8_HANDLER( tape_control_w )
+static WRITE8_DEVICE_HANDLER( tape_control_w )
{
switch( data )
{
@@ -129,27 +129,27 @@ static WRITE8_HANDLER( tape_control_w )
break;
case 0x08: /* talk track on */
- tape_set_audio( kTalkTrack, 1 );
+ tape_set_audio( device, kTalkTrack, 1 );
break;
case 0x09: /* talk track off */
- tape_set_audio( kTalkTrack, 0 );
+ tape_set_audio( device, kTalkTrack, 0 );
break;
case 0x0a: /* motor on */
- tape_set_motor( 1 );
+ tape_set_motor( device, 1 );
break;
case 0x0b: /* motor off */
- tape_set_motor( 0 );
+ tape_set_motor( device, 0 );
break;
case 0x0c: /* crash track on */
- tape_set_audio( kCrashTrack, 1 );
+ tape_set_audio( device, kCrashTrack, 1 );
break;
case 0x0d: /* crash track off */
- tape_set_audio( kCrashTrack, 0 );
+ tape_set_audio( device, kCrashTrack, 0 );
break;
}
}
@@ -192,11 +192,11 @@ static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x10, 0x10) AM_WRITE(thief_video_control_w)
AM_RANGE(0x30, 0x30) AM_WRITE(thief_input_select_w) /* 8255 */
AM_RANGE(0x31, 0x31) AM_READ(thief_io_r) /* 8255 */
- AM_RANGE(0x33, 0x33) AM_WRITE(tape_control_w)
- AM_RANGE(0x40, 0x40) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x41, 0x41) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x42, 0x42) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x43, 0x43) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
+ AM_RANGE(0x33, 0x33) AM_DEVWRITE(SOUND, "samples", tape_control_w)
+ AM_RANGE(0x40, 0x41) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x41, 0x41) AM_DEVREAD(SOUND, "ay1", ay8910_r)
+ AM_RANGE(0x42, 0x43) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x43, 0x43) AM_DEVREAD(SOUND, "ay2", ay8910_r)
AM_RANGE(0x50, 0x50) AM_WRITE(thief_color_plane_w)
AM_RANGE(0x60, 0x6f) AM_WRITE(thief_vtcsel_w)
AM_RANGE(0x70, 0x7f) AM_WRITE(thief_color_map_w)
diff --git a/src/mame/drivers/thoop2.c b/src/mame/drivers/thoop2.c
index d0109791d70..92cb261241a 100644
--- a/src/mame/drivers/thoop2.c
+++ b/src/mame/drivers/thoop2.c
@@ -64,7 +64,7 @@ static ADDRESS_MAP_START( thoop2_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x700004, 0x700005) AM_READ_PORT("P1")
AM_RANGE(0x700006, 0x700007) AM_READ_PORT("P2")
AM_RANGE(0x700008, 0x700009) AM_READ_PORT("SYSTEM")
- AM_RANGE(0x70000e, 0x70000f) AM_READ(okim6295_status_0_lsb_r)/* OKI6295 status register */
+ AM_RANGE(0x70000e, 0x70000f) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff)/* OKI6295 status register */
AM_RANGE(0xfe0000, 0xfeffff) AM_READ(SMH_RAM) /* Work RAM (partially shared with DS5002FP) */
ADDRESS_MAP_END
@@ -104,7 +104,7 @@ static ADDRESS_MAP_START( thoop2_writemem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x200000, 0x2007ff) AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)/* Palette */
AM_RANGE(0x440000, 0x440fff) AM_WRITE(SMH_RAM) AM_BASE(&thoop2_spriteram) /* Sprite RAM */
AM_RANGE(0x70000c, 0x70000d) AM_WRITE(OKIM6295_bankswitch_w) /* OKI6295 bankswitch */
- AM_RANGE(0x70000e, 0x70000f) AM_WRITE(okim6295_data_0_lsb_w) /* OKI6295 data register */
+ AM_RANGE(0x70000e, 0x70000f) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff) /* OKI6295 data register */
AM_RANGE(0x70000a, 0x70005b) AM_WRITE(thoop2_coin_w) /* Coin Counters + Coin Lockout */
AM_RANGE(0xfe0000, 0xfeffff) AM_WRITE(SMH_RAM) /* Work RAM (partially shared with DS5002FP) */
ADDRESS_MAP_END
diff --git a/src/mame/drivers/thunderx.c b/src/mame/drivers/thunderx.c
index 0a455d33e6a..7f9bc394dc9 100644
--- a/src/mame/drivers/thunderx.c
+++ b/src/mame/drivers/thunderx.c
@@ -358,14 +358,14 @@ static WRITE8_HANDLER( thunderx_sh_irqtrigger_w )
cpu_set_input_line_and_vector(space->machine->cpu[1],0,HOLD_LINE,0xff);
}
-static WRITE8_HANDLER( scontra_snd_bankswitch_w )
+static WRITE8_DEVICE_HANDLER( scontra_snd_bankswitch_w )
{
/* b3-b2: bank for chanel B */
/* b1-b0: bank for chanel A */
int bank_A = (data & 0x03);
int bank_B = ((data >> 2) & 0x03);
- k007232_set_bank( 0, bank_A, bank_B );
+ k007232_set_bank( device, bank_A, bank_B );
}
/***************************************************************************/
@@ -431,31 +431,29 @@ static ADDRESS_MAP_START( scontra_readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) /* ROM */
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM) /* RAM */
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r) /* soundlatch_r */
- AM_RANGE(0xb000, 0xb00d) AM_READ(k007232_read_port_0_r) /* 007232 registers */
- AM_RANGE(0xc001, 0xc001) AM_READ(ym2151_status_port_0_r) /* YM2151 */
+ AM_RANGE(0xb000, 0xb00d) AM_DEVREAD(SOUND, "konami", k007232_r) /* 007232 registers */
+ AM_RANGE(0xc000, 0xc001) AM_DEVREAD(SOUND, "ym", ym2151_r) /* YM2151 */
ADDRESS_MAP_END
static ADDRESS_MAP_START( scontra_writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM) /* ROM */
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM) /* RAM */
- AM_RANGE(0xb000, 0xb00d) AM_WRITE(k007232_write_port_0_w) /* 007232 registers */
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym2151_register_port_0_w) /* YM2151 */
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ym2151_data_port_0_w) /* YM2151 */
- AM_RANGE(0xf000, 0xf000) AM_WRITE(scontra_snd_bankswitch_w) /* 007232 bank select */
+ AM_RANGE(0xb000, 0xb00d) AM_DEVWRITE(SOUND, "konami", k007232_w) /* 007232 registers */
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ym", ym2151_w) /* YM2151 */
+ AM_RANGE(0xf000, 0xf000) AM_DEVWRITE(SOUND, "konami", scontra_snd_bankswitch_w) /* 007232 bank select */
ADDRESS_MAP_END
static ADDRESS_MAP_START( thunderx_readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
- AM_RANGE(0xc001, 0xc001) AM_READ(ym2151_status_port_0_r)
+ AM_RANGE(0xc000, 0xc001) AM_DEVREAD(SOUND, "ym", ym2151_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( thunderx_writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ym2151_data_port_0_w)
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ym", ym2151_w)
ADDRESS_MAP_END
/***************************************************************************
@@ -680,10 +678,10 @@ INPUT_PORTS_END
***************************************************************************/
-static void volume_callback(int v)
+static void volume_callback(const device_config *device, int v)
{
- k007232_set_volume(0,0,(v >> 4) * 0x11,0);
- k007232_set_volume(0,1,0,(v & 0x0f) * 0x11);
+ k007232_set_volume(device,0,(v >> 4) * 0x11,0);
+ k007232_set_volume(device,1,0,(v & 0x0f) * 0x11);
}
static const k007232_interface k007232_config =
diff --git a/src/mame/drivers/tiamc1.c b/src/mame/drivers/tiamc1.c
index 7f4a240cd7a..5dbc9008cb4 100644
--- a/src/mame/drivers/tiamc1.c
+++ b/src/mame/drivers/tiamc1.c
@@ -221,11 +221,6 @@ static GFXDECODE_START( tiamc1 )
GFXDECODE_ENTRY( "gfx1", 0x0000, sprites16x16_layout, 0, 16 )
GFXDECODE_END
-static const custom_sound_interface tiamc1_custom_interface =
-{
- tiamc1_sh_start
-};
-
static MACHINE_DRIVER_START( tiamc1 )
/* basic machine hardware */
@@ -255,8 +250,7 @@ static MACHINE_DRIVER_START( tiamc1 )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("2x8253", CUSTOM, 16000000/9)
- MDRV_SOUND_CONFIG(tiamc1_custom_interface)
+ MDRV_SOUND_ADD("2x8253", TIAMC1, 16000000/9)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/tickee.c b/src/mame/drivers/tickee.c
index 1eecc68cc05..ba866b15c97 100644
--- a/src/mame/drivers/tickee.c
+++ b/src/mame/drivers/tickee.c
@@ -159,14 +159,16 @@ static MACHINE_RESET( tickee )
*
*************************************/
-static READ8_HANDLER( port1_r )
+static READ8_DEVICE_HANDLER( port1_r )
{
- return input_port_read(space->machine, "IN0") | (ticket_dispenser_0_r(space, 0) >> 5) | (ticket_dispenser_1_r(space, 0) >> 6);
+ const address_space *space = cputag_get_address_space(device->machine, "main", ADDRESS_SPACE_PROGRAM);
+ return input_port_read(device->machine, "IN0") | (ticket_dispenser_0_r(space, 0) >> 5) | (ticket_dispenser_1_r(space, 0) >> 6);
}
-static READ8_HANDLER( port2_r )
+static READ8_DEVICE_HANDLER( port2_r )
{
- return input_port_read(space->machine, "IN2") | (ticket_dispenser_0_r(space, 0) >> 5) | (ticket_dispenser_1_r(space, 0) >> 6);
+ const address_space *space = cputag_get_address_space(device->machine, "main", ADDRESS_SPACE_PROGRAM);
+ return input_port_read(device->machine, "IN2") | (ticket_dispenser_0_r(space, 0) >> 5) | (ticket_dispenser_1_r(space, 0) >> 6);
}
@@ -213,10 +215,10 @@ static ADDRESS_MAP_START( tickee_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x02000000, 0x02ffffff) AM_ROM AM_REGION("user1", 0)
AM_RANGE(0x04000000, 0x04003fff) AM_RAM AM_BASE(&generic_nvram16) AM_SIZE(&generic_nvram_size)
AM_RANGE(0x04100000, 0x041000ff) AM_READWRITE(tlc34076_lsb_r, tlc34076_lsb_w)
- AM_RANGE(0x04200000, 0x0420000f) AM_READWRITE(ay8910_read_port_0_lsb_r, ay8910_control_port_0_lsb_w)
- AM_RANGE(0x04200010, 0x0420001f) AM_WRITE(ay8910_write_port_0_lsb_w)
- AM_RANGE(0x04200100, 0x0420010f) AM_READWRITE(ay8910_read_port_1_lsb_r, ay8910_control_port_1_lsb_w)
- AM_RANGE(0x04200110, 0x0420011f) AM_WRITE(ay8910_write_port_1_lsb_w)
+ AM_RANGE(0x04200000, 0x0420000f) AM_DEVREAD8(SOUND, "ym1", ay8910_r, 0x00ff)
+ AM_RANGE(0x04200000, 0x0420001f) AM_DEVWRITE8(SOUND, "ym1", ay8910_address_data_w, 0x00ff)
+ AM_RANGE(0x04200100, 0x0420010f) AM_DEVREAD8(SOUND, "ym2", ay8910_r, 0x00ff)
+ AM_RANGE(0x04200100, 0x0420011f) AM_DEVWRITE8(SOUND, "ym2", ay8910_address_data_w, 0x00ff)
AM_RANGE(0x04400000, 0x0440007f) AM_WRITE(tickee_control_w) AM_BASE(&tickee_control)
AM_RANGE(0x04400040, 0x0440004f) AM_READ_PORT("IN2")
AM_RANGE(0xc0000000, 0xc00001ff) AM_READWRITE(tms34010_io_register_r, tms34010_io_register_w)
@@ -231,10 +233,10 @@ static ADDRESS_MAP_START( ghoshunt_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x02000000, 0x02ffffff) AM_ROM AM_REGION("user1", 0)
AM_RANGE(0x04100000, 0x04103fff) AM_RAM AM_BASE(&generic_nvram16) AM_SIZE(&generic_nvram_size)
AM_RANGE(0x04200000, 0x042000ff) AM_READWRITE(tlc34076_lsb_r, tlc34076_lsb_w)
- AM_RANGE(0x04300000, 0x0430000f) AM_READWRITE(ay8910_read_port_0_lsb_r, ay8910_control_port_0_lsb_w)
- AM_RANGE(0x04300010, 0x0430001f) AM_WRITE(ay8910_write_port_0_lsb_w)
- AM_RANGE(0x04300100, 0x0430010f) AM_READWRITE(ay8910_read_port_1_lsb_r, ay8910_control_port_1_lsb_w)
- AM_RANGE(0x04300110, 0x0430011f) AM_WRITE(ay8910_write_port_1_lsb_w)
+ AM_RANGE(0x04300000, 0x0430000f) AM_DEVREAD8(SOUND, "ym1", ay8910_r, 0x00ff)
+ AM_RANGE(0x04300000, 0x0430001f) AM_DEVWRITE8(SOUND, "ym1", ay8910_address_data_w, 0x00ff)
+ AM_RANGE(0x04300100, 0x0430010f) AM_DEVREAD8(SOUND, "ym2", ay8910_r, 0x00ff)
+ AM_RANGE(0x04300100, 0x0430011f) AM_DEVWRITE8(SOUND, "ym2", ay8910_address_data_w, 0x00ff)
AM_RANGE(0x04500000, 0x0450007f) AM_WRITE(tickee_control_w) AM_BASE(&tickee_control)
AM_RANGE(0xc0000000, 0xc00001ff) AM_READWRITE(tms34010_io_register_r, tms34010_io_register_w)
AM_RANGE(0xc0000240, 0xc000025f) AM_WRITENOP /* seems to be a bug in their code */
@@ -378,20 +380,20 @@ static const ay8910_interface ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r,
- input_port_2_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW"),
+ DEVCB_INPUT_PORT("IN1"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
static const ay8910_interface ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- port1_r,
- port2_r,
- NULL,
- NULL
+ DEVCB_HANDLER(port1_r),
+ DEVCB_HANDLER(port2_r),
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/tigeroad.c b/src/mame/drivers/tigeroad.c
index 40caef6118c..f03a25c1021 100644
--- a/src/mame/drivers/tigeroad.c
+++ b/src/mame/drivers/tigeroad.c
@@ -162,12 +162,12 @@ static WRITE16_HANDLER( tigeroad_soundcmd_w )
soundlatch_w(space,offset,data >> 8);
}
-static WRITE8_HANDLER( msm5205_w )
+static WRITE8_DEVICE_HANDLER( msm5205_w )
{
- msm5205_reset_w(offset,(data>>7)&1);
- msm5205_data_w(offset,data);
- msm5205_vclk_w(offset,1);
- msm5205_vclk_w(offset,0);
+ msm5205_reset_w(device,(data>>7)&1);
+ msm5205_data_w(device,data);
+ msm5205_vclk_w(device,1);
+ msm5205_vclk_w(device,0);
}
@@ -191,10 +191,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
- AM_RANGE(0x8000, 0x8000) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x8001, 0x8001) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0xa000, 0xa000) AM_READWRITE(ym2203_status_port_1_r, ym2203_control_port_1_w)
- AM_RANGE(0xa001, 0xa001) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0x8000, 0x8001) AM_DEVREADWRITE(SOUND, "ym1", ym2203_r, ym2203_w)
+ AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE(SOUND, "ym2", ym2203_r, ym2203_w)
AM_RANGE(0xc000, 0xc7ff) AM_RAM
AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -211,7 +209,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sample_port_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_READ(soundlatch2_r)
- AM_RANGE(0x01, 0x01) AM_WRITE(msm5205_w)
+ AM_RANGE(0x01, 0x01) AM_DEVWRITE(SOUND, "msm", msm5205_w)
ADDRESS_MAP_END
@@ -501,9 +499,9 @@ GFXDECODE_END
/* handler called by the 2203 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface ym2203_config =
@@ -511,7 +509,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL,
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,
},
irqhandler
};
diff --git a/src/mame/drivers/timelimt.c b/src/mame/drivers/timelimt.c
index 369a3519d0e..c246308b9f4 100644
--- a/src/mame/drivers/timelimt.c
+++ b/src/mame/drivers/timelimt.c
@@ -101,12 +101,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(soundlatch_clear_w)
- AM_RANGE(0x8c, 0x8c) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x8c, 0x8d) AM_READ(ay8910_read_port_0_r)
- AM_RANGE(0x8d, 0x8d) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x8e, 0x8e) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x8e, 0x8f) AM_READ(ay8910_read_port_1_r)
- AM_RANGE(0x8f, 0x8f) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0x8c, 0x8d) AM_DEVREADWRITE(SOUND, "ay1", ay8910_r, ay8910_address_data_w)
+ AM_RANGE(0x8e, 0x8f) AM_DEVREADWRITE(SOUND, "ay2", ay8910_r, ay8910_address_data_w)
ADDRESS_MAP_END
/***************************************************************************/
@@ -245,10 +241,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- soundlatch_r,
- NULL,
- NULL,
- NULL
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
static INTERRUPT_GEN( timelimt_irq ) {
diff --git a/src/mame/drivers/tmaster.c b/src/mame/drivers/tmaster.c
index 61bf993a86c..2f414d897bd 100644
--- a/src/mame/drivers/tmaster.c
+++ b/src/mame/drivers/tmaster.c
@@ -124,13 +124,13 @@ static struct
***************************************************************************/
static int okibank;
-static WRITE16_HANDLER( tmaster_oki_bank_w )
+static WRITE16_DEVICE_HANDLER( tmaster_oki_bank_w )
{
if (ACCESSING_BITS_8_15)
{
// data & 0x0800?
okibank = ((data >> 8) & 3);
- okim6295_set_bank_base(0, okibank * 0x40000);
+ okim6295_set_bank_base(device, okibank * 0x40000);
}
if (ACCESSING_BITS_0_7)
@@ -443,7 +443,7 @@ static ADDRESS_MAP_START( tmaster_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE( 0x300020, 0x30003f ) AM_DEVREADWRITE8( DUART68681, "duart68681", duart68681_r, duart68681_w, 0xff )
- AM_RANGE( 0x300040, 0x300041 ) AM_WRITE( tmaster_oki_bank_w )
+ AM_RANGE( 0x300040, 0x300041 ) AM_DEVWRITE( SOUND, "oki", tmaster_oki_bank_w )
AM_RANGE( 0x300070, 0x300071 ) AM_WRITE( tmaster_addr_w )
@@ -454,7 +454,7 @@ static ADDRESS_MAP_START( tmaster_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE( 0x600000, 0x600fff ) AM_READWRITE( SMH_RAM, paletteram16_xBBBBBGGGGGRRRRR_word_w ) AM_BASE(&paletteram16) // looks like palettes, maybe
- AM_RANGE( 0x800000, 0x800001 ) AM_READWRITE( okim6295_status_0_lsb_r, okim6295_data_0_lsb_w )
+ AM_RANGE( 0x800000, 0x800001 ) AM_DEVREADWRITE8( SOUND, "oki", okim6295_r, okim6295_w, 0x00ff )
AM_RANGE( 0x800010, 0x800011 ) AM_WRITE( tmaster_color_w )
ADDRESS_MAP_END
@@ -617,7 +617,7 @@ static ADDRESS_MAP_START( galgames_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE( 0x800020, 0x80003f ) AM_NOP // ?
AM_RANGE( 0x900000, 0x900001 ) AM_WRITE( watchdog_reset16_w )
- AM_RANGE( 0xa00000, 0xa00001 ) AM_READWRITE( okim6295_status_0_lsb_r, okim6295_data_0_lsb_w )
+ AM_RANGE( 0xa00000, 0xa00001 ) AM_DEVREADWRITE8( SOUND, "oki", okim6295_r, okim6295_w, 0x00ff )
AM_RANGE( 0xb00000, 0xb7ffff ) AM_READWRITE( galgames_okiram_r, galgames_okiram_w ) // (only low bytes tested) 4x N341024SJ-15
AM_RANGE( 0xc00000, 0xc00001 ) AM_WRITE( galgames_palette_offset_w )
diff --git a/src/mame/drivers/tmnt.c b/src/mame/drivers/tmnt.c
index 0e060cba1e6..74894b5bb0f 100644
--- a/src/mame/drivers/tmnt.c
+++ b/src/mame/drivers/tmnt.c
@@ -198,34 +198,19 @@ static WRITE16_HANDLER( tmnt_sound_command_w )
soundlatch_w(space,0,data & 0xff);
}
-static READ16_HANDLER( punkshot_sound_r )
+static READ8_DEVICE_HANDLER( punkshot_sound_r )
{
/* If the sound CPU is running, read the status, otherwise
just make it pass the test */
- return k053260_0_r(space,2 + offset);
+ return k053260_r(device,2 + offset);
}
-static READ16_HANDLER( blswhstl_sound_r )
+static WRITE8_DEVICE_HANDLER( glfgreat_sound_w )
{
- /* If the sound CPU is running, read the status, otherwise
- just make it pass the test */
- return k053260_0_r(space,2 + offset);
-}
-
-static READ16_HANDLER( glfgreat_sound_r )
-{
- /* If the sound CPU is running, read the status, otherwise
- just make it pass the test */
- return k053260_0_r(space,2 + offset) << 8;
-}
-
-static WRITE16_HANDLER( glfgreat_sound_w )
-{
- if (ACCESSING_BITS_8_15)
- k053260_0_w(space, offset, (data >> 8) & 0xff);
+ k053260_w(device, offset, data);
if (offset)
- cpu_set_input_line_and_vector(space->machine->cpu[1],0,HOLD_LINE,0xff);
+ cpu_set_input_line_and_vector(device->machine->cpu[1],0,HOLD_LINE,0xff);
}
static READ16_HANDLER( prmrsocr_sound_r )
@@ -256,11 +241,6 @@ static WRITE8_HANDLER( prmrsocr_audio_bankswitch_w )
}
-static READ16_HANDLER( tmnt2_sound_r )
-{
- return k053260_0_r(space, 2 + offset);
-}
-
static READ8_HANDLER( tmnt_sres_r )
{
return tmnt_soundlatch;
@@ -268,18 +248,31 @@ static READ8_HANDLER( tmnt_sres_r )
static WRITE8_HANDLER( tmnt_sres_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
+ const device_config *upd = devtag_get_device(space->machine, SOUND, "upd");
+
/* bit 1 resets the UPD7795C sound chip */
- upd7759_reset_w(0, data & 2);
+ upd7759_reset_w(upd, data & 2);
/* bit 2 plays the title music */
if (data & 0x04)
{
- if (!sample_playing(0)) sample_start_raw(0,sampledata,0x40000,20000,0);
+ if (!sample_playing(samples, 0)) sample_start_raw(samples,0,sampledata,0x40000,20000,0);
}
- else sample_stop(0);
+ else sample_stop(samples, 0);
tmnt_soundlatch = data;
}
+static WRITE8_DEVICE_HANDLER( tmnt_upd_start_w )
+{
+ upd7759_start_w(device, data & 1);
+}
+
+static READ8_DEVICE_HANDLER( tmnt_upd_busy_r )
+{
+ return upd7759_busy_r(device) ? 1 : 0;
+}
+
static SAMPLES_START( tmnt_decode_sample )
{
@@ -639,23 +632,6 @@ static WRITE16_HANDLER( prmrsocr_eeprom_w )
}
}
-static READ16_HANDLER( cuebrick_snd_r )
-{
- return ym2151_status_port_0_r(space,0)<<8;
-}
-
-static WRITE16_HANDLER( cuebrick_snd_w )
-{
- if (offset)
- {
- ym2151_data_port_0_w(space, 0, data>>8);
- }
- else
- {
- ym2151_register_port_0_w(space, 0, data>>8);
- }
-}
-
static READ16_HANDLER( cuebrick_nv_r )
{
return cuebrick_nvram[offset + (cuebrick_nvram_bank*0x400/2)];
@@ -685,7 +661,7 @@ static ADDRESS_MAP_START( cuebrick_main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x0a0018, 0x0a0019) AM_READ_PORT("DSW3")
AM_RANGE(0x0b0000, 0x0b03ff) AM_READWRITE(cuebrick_nv_r, cuebrick_nv_w)
AM_RANGE(0x0b0400, 0x0b0401) AM_WRITE(cuebrick_nvbank_w)
- AM_RANGE(0x0c0000, 0x0c0003) AM_READWRITE(cuebrick_snd_r, cuebrick_snd_w)
+ AM_RANGE(0x0c0000, 0x0c0003) AM_DEVREADWRITE8(SOUND, "ym", ym2151_r, ym2151_w, 0xff00)
AM_RANGE(0x100000, 0x107fff) AM_READWRITE(K052109_word_noA12_r, K052109_word_noA12_w)
AM_RANGE(0x140000, 0x140007) AM_READWRITE(K051937_word_r, K051937_word_w)
AM_RANGE(0x140400, 0x1407ff) AM_READWRITE(K051960_word_r, K051960_word_w)
@@ -744,8 +720,8 @@ static ADDRESS_MAP_START( punkshot_main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x0a0004, 0x0a0005) AM_READ_PORT("P3/P4")
AM_RANGE(0x0a0006, 0x0a0007) AM_READ_PORT("P1/P2")
AM_RANGE(0x0a0020, 0x0a0021) AM_WRITE(punkshot_0a0020_w)
- AM_RANGE(0x0a0040, 0x0a0043) AM_READ(punkshot_sound_r) /* K053260 */
- AM_RANGE(0x0a0040, 0x0a0041) AM_WRITE(k053260_0_lsb_w)
+ AM_RANGE(0x0a0040, 0x0a0043) AM_DEVREAD8(SOUND, "konami", punkshot_sound_r, 0x00ff) /* K053260 */
+ AM_RANGE(0x0a0040, 0x0a0041) AM_DEVWRITE8(SOUND, "konami", k053260_w, 0x00ff)
AM_RANGE(0x0a0060, 0x0a007f) AM_WRITE(K053251_lsb_w)
AM_RANGE(0x0a0080, 0x0a0081) AM_WRITE(watchdog_reset16_w)
AM_RANGE(0x100000, 0x107fff) AM_READWRITE(K052109_word_noA12_r, punkshot_K052109_word_noA12_w)
@@ -766,8 +742,8 @@ static ADDRESS_MAP_START( lgtnfght_main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x0a0008, 0x0a0009) AM_READ_PORT("DSW2")
AM_RANGE(0x0a0010, 0x0a0011) AM_READ_PORT("DSW3")
AM_RANGE(0x0a0018, 0x0a0019) AM_WRITE(lgtnfght_0a0018_w)
- AM_RANGE(0x0a0020, 0x0a0023) AM_READ(punkshot_sound_r) /* K053260 */
- AM_RANGE(0x0a0020, 0x0a0021) AM_WRITE(k053260_0_lsb_w)
+ AM_RANGE(0x0a0020, 0x0a0023) AM_DEVREAD8(SOUND, "konami", punkshot_sound_r, 0x00ff) /* K053260 */
+ AM_RANGE(0x0a0020, 0x0a0021) AM_DEVWRITE8(SOUND, "konami", k053260_w, 0x00ff)
AM_RANGE(0x0a0028, 0x0a0029) AM_WRITE(watchdog_reset16_w)
AM_RANGE(0x0b0000, 0x0b3fff) AM_READWRITE(K053245_scattered_word_r, K053245_scattered_word_w) AM_BASE(&spriteram16)
AM_RANGE(0x0c0000, 0x0c001f) AM_READWRITE(K053244_word_noA1_r, K053244_word_noA1_w)
@@ -797,8 +773,8 @@ static ADDRESS_MAP_START( blswhstl_main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x700200, 0x700201) AM_WRITE(blswhstl_eeprom_w)
AM_RANGE(0x700300, 0x700301) AM_WRITE(blswhstl_700300_w)
AM_RANGE(0x700400, 0x700401) AM_WRITE(watchdog_reset16_w)
- AM_RANGE(0x780600, 0x780603) AM_READ(blswhstl_sound_r) /* K053260 */
- AM_RANGE(0x780600, 0x780601) AM_WRITE(k053260_0_lsb_w)
+ AM_RANGE(0x780600, 0x780603) AM_DEVREAD8(SOUND, "konami", k053260_r, 0x00ff) /* K053260 */
+ AM_RANGE(0x780600, 0x780601) AM_DEVWRITE8(SOUND, "konami", k053260_w, 0x00ff)
AM_RANGE(0x780604, 0x780605) AM_WRITE(ssriders_soundkludge_w)
AM_RANGE(0x780700, 0x78071f) AM_WRITE(K053251_lsb_w)
ADDRESS_MAP_END
@@ -821,7 +797,7 @@ static ADDRESS_MAP_START( glfgreat_main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x121000, 0x121001) AM_READ(glfgreat_ball_r) /* returns the color of the center pixel of the roz layer */
AM_RANGE(0x122000, 0x122001) AM_WRITE(glfgreat_122000_w)
AM_RANGE(0x124000, 0x124001) AM_WRITE(watchdog_reset16_w)
- AM_RANGE(0x125000, 0x125003) AM_READWRITE(glfgreat_sound_r, glfgreat_sound_w) /* K053260 */
+ AM_RANGE(0x125000, 0x125003) AM_DEVREADWRITE8(SOUND, "konami", punkshot_sound_r, glfgreat_sound_w, 0xff00) /* K053260 */
AM_RANGE(0x200000, 0x207fff) AM_READWRITE(K052109_word_noA12_r, K052109_word_noA12_w)
AM_RANGE(0x300000, 0x3fffff) AM_READ(glfgreat_rom_r)
ADDRESS_MAP_END
@@ -1098,8 +1074,8 @@ static ADDRESS_MAP_START( tmnt2_main_map, ADDRESS_SPACE_PROGRAM, 16 )
// AM_RANGE(0x1c0800, 0x1c0801) AM_READ(ssriders_protection_r) /* protection device */
AM_RANGE(0x1c0800, 0x1c081f) AM_WRITE(tmnt2_1c0800_w) AM_BASE(&tmnt2_1c0800) /* protection device */
AM_RANGE(0x5a0000, 0x5a001f) AM_READWRITE(K053244_word_noA1_r, K053244_word_noA1_w)
- AM_RANGE(0x5c0600, 0x5c0603) AM_READ(tmnt2_sound_r) /* K053260 */
- AM_RANGE(0x5c0600, 0x5c0601) AM_WRITE(k053260_0_lsb_w)
+ AM_RANGE(0x5c0600, 0x5c0603) AM_DEVREAD8(SOUND, "konami", punkshot_sound_r, 0x00ff) /* K053260 */
+ AM_RANGE(0x5c0600, 0x5c0601) AM_DEVWRITE8(SOUND, "konami", k053260_w, 0x00ff)
AM_RANGE(0x5c0604, 0x5c0605) AM_WRITE(ssriders_soundkludge_w)
AM_RANGE(0x5c0700, 0x5c071f) AM_WRITE(K053251_lsb_w)
AM_RANGE(0x600000, 0x603fff) AM_READWRITE(K052109_word_r, K052109_word_w)
@@ -1124,8 +1100,8 @@ static ADDRESS_MAP_START( ssriders_main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x1c0800, 0x1c0801) AM_READ(ssriders_protection_r)
AM_RANGE(0x1c0800, 0x1c0803) AM_WRITE(ssriders_protection_w)
AM_RANGE(0x5a0000, 0x5a001f) AM_READWRITE(K053244_word_noA1_r, K053244_word_noA1_w)
- AM_RANGE(0x5c0600, 0x5c0603) AM_READ(punkshot_sound_r) /* K053260 */
- AM_RANGE(0x5c0600, 0x5c0601) AM_WRITE(k053260_0_lsb_w)
+ AM_RANGE(0x5c0600, 0x5c0603) AM_DEVREAD8(SOUND, "konami", punkshot_sound_r, 0x00ff) /* K053260 */
+ AM_RANGE(0x5c0600, 0x5c0601) AM_DEVWRITE8(SOUND, "konami", k053260_w, 0x00ff)
AM_RANGE(0x5c0604, 0x5c0605) AM_WRITE(ssriders_soundkludge_w)
AM_RANGE(0x5c0700, 0x5c071f) AM_WRITE(K053251_lsb_w)
AM_RANGE(0x600000, 0x603fff) AM_READWRITE(K052109_word_r, K052109_word_w)
@@ -1153,7 +1129,7 @@ static ADDRESS_MAP_START( sunsetbl_main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xc00200, 0xc00201) AM_WRITE(ssriders_eeprom_w) /* EEPROM and gfx control */
AM_RANGE(0xc00404, 0xc00405) AM_READ_PORT("COINS")
AM_RANGE(0xc00406, 0xc00407) AM_READ(sunsetbl_eeprom_r)
- AM_RANGE(0xc00600, 0xc00601) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0xc00600, 0xc00601) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x75d288, 0x75d289) AM_READ(SMH_NOP) // read repeatedly in some test menus (PC=181f2)
ADDRESS_MAP_END
@@ -1163,8 +1139,8 @@ static ADDRESS_MAP_START( thndrx2_main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x100000, 0x103fff) AM_RAM /* main RAM */
AM_RANGE(0x200000, 0x200fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)
AM_RANGE(0x300000, 0x30001f) AM_WRITE(K053251_lsb_w)
- AM_RANGE(0x400000, 0x400003) AM_READ(punkshot_sound_r) /* K053260 */
- AM_RANGE(0x400000, 0x400001) AM_WRITE(k053260_0_lsb_w)
+ AM_RANGE(0x400000, 0x400003) AM_DEVREAD8(SOUND, "konami", punkshot_sound_r, 0x00ff) /* K053260 */
+ AM_RANGE(0x400000, 0x400001) AM_DEVWRITE8(SOUND, "konami", k053260_w, 0x00ff)
AM_RANGE(0x500000, 0x50003f) AM_READWRITE(K054000_lsb_r, K054000_lsb_w)
AM_RANGE(0x500100, 0x500101) AM_WRITE(thndrx2_eeprom_w)
AM_RANGE(0x500200, 0x500201) AM_READ(thndrx2_in0_r)
@@ -1181,9 +1157,8 @@ static ADDRESS_MAP_START( mia_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
- AM_RANGE(0xb000, 0xb00d) AM_READWRITE(k007232_read_port_0_r, k007232_write_port_0_w)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xc001, 0xc001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0xb000, 0xb00d) AM_DEVREADWRITE(SOUND, "konami", k007232_r, k007232_w)
+ AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
ADDRESS_MAP_END
@@ -1192,38 +1167,35 @@ static ADDRESS_MAP_START( tmnt_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0x87ff) AM_RAM
AM_RANGE(0x9000, 0x9000) AM_READWRITE(tmnt_sres_r, tmnt_sres_w) /* title music & UPD7759C reset */
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
- AM_RANGE(0xb000, 0xb00d) AM_READWRITE(k007232_read_port_0_r, k007232_write_port_0_w)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xc001, 0xc001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
- AM_RANGE(0xd000, 0xd000) AM_WRITE(upd7759_0_port_w)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(upd7759_0_start_w)
- AM_RANGE(0xf000, 0xf000) AM_READ(upd7759_0_busy_r)
+ AM_RANGE(0xb000, 0xb00d) AM_DEVREADWRITE(SOUND, "konami", k007232_r, k007232_w)
+ AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0xd000, 0xd000) AM_DEVWRITE(SOUND, "upd", upd7759_port_w)
+ AM_RANGE(0xe000, 0xe000) AM_DEVWRITE(SOUND, "upd", tmnt_upd_start_w)
+ AM_RANGE(0xf000, 0xf000) AM_DEVREAD(SOUND, "upd", tmnt_upd_busy_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( punkshot_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0xf000, 0xf7ff) AM_RAM
- AM_RANGE(0xf800, 0xf800) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xf801, 0xf801) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0xf800, 0xf801) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0xfa00, 0xfa00) AM_WRITE(sound_arm_nmi_w)
- AM_RANGE(0xfc00, 0xfc2f) AM_READWRITE(k053260_0_r, k053260_0_w)
+ AM_RANGE(0xfc00, 0xfc2f) AM_DEVREADWRITE(SOUND, "konami", k053260_r, k053260_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( lgtnfght_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
- AM_RANGE(0xa000, 0xa000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xa001, 0xa001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
- AM_RANGE(0xc000, 0xc02f) AM_READWRITE(k053260_0_r, k053260_0_w)
+ AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0xc000, 0xc02f) AM_DEVREADWRITE(SOUND, "konami", k053260_r, k053260_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( glfgreat_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0xf000, 0xf7ff) AM_RAM
- AM_RANGE(0xf800, 0xf82f) AM_READWRITE(k053260_0_r, k053260_0_w)
+ AM_RANGE(0xf800, 0xf82f) AM_DEVREADWRITE(SOUND, "konami", k053260_r, k053260_w)
AM_RANGE(0xfa00, 0xfa00) AM_WRITE(sound_arm_nmi_w)
ADDRESS_MAP_END
@@ -1231,9 +1203,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( ssriders_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_ROM
AM_RANGE(0xf000, 0xf7ff) AM_RAM
- AM_RANGE(0xf800, 0xf800) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xf801, 0xf801) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
- AM_RANGE(0xfa00, 0xfa2f) AM_READWRITE(k053260_0_r, k053260_0_w)
+ AM_RANGE(0xf800, 0xf801) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0xfa00, 0xfa2f) AM_DEVREADWRITE(SOUND, "konami", k053260_r, k053260_w)
AM_RANGE(0xfc00, 0xfc00) AM_WRITE(sound_arm_nmi_w)
ADDRESS_MAP_END
@@ -1241,28 +1212,27 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( thndrx2_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_ROM
AM_RANGE(0xf000, 0xf7ff) AM_RAM
- AM_RANGE(0xf800, 0xf800) AM_MIRROR(0x0010) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xf801, 0xf801) AM_MIRROR(0x0010) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0xf800, 0xf801) AM_MIRROR(0x0010) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0xfa00, 0xfa00) AM_WRITE(sound_arm_nmi_w)
- AM_RANGE(0xfc00, 0xfc2f) AM_READWRITE(k053260_0_r, k053260_0_w)
+ AM_RANGE(0xfc00, 0xfc2f) AM_DEVREADWRITE(SOUND, "konami", k053260_r, k053260_w)
ADDRESS_MAP_END
-static READ8_HANDLER( k054539_0_ctrl_r )
+static READ8_DEVICE_HANDLER( k054539_ctrl_r )
{
- return k054539_0_r(space,0x200+offset);
+ return k054539_r(device,0x200+offset);
}
-static WRITE8_HANDLER( k054539_0_ctrl_w )
+static WRITE8_DEVICE_HANDLER( k054539_ctrl_w )
{
- k054539_0_w(space,0x200+offset,data);
+ k054539_w(device,0x200+offset,data);
}
static ADDRESS_MAP_START( prmrsocr_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK1, SMH_ROM)
AM_RANGE(0xc000, 0xdfff) AM_RAM
- AM_RANGE(0xe000, 0xe0ff) AM_READWRITE(k054539_0_r, k054539_0_w)
- AM_RANGE(0xe100, 0xe12f) AM_READWRITE(k054539_0_ctrl_r, k054539_0_ctrl_w)
+ AM_RANGE(0xe000, 0xe0ff) AM_DEVREADWRITE(SOUND, "konami", k054539_r, k054539_w)
+ AM_RANGE(0xe100, 0xe12f) AM_DEVREADWRITE(SOUND, "konami", k054539_ctrl_r, k054539_ctrl_w)
AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch3_w)
AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_r)
AM_RANGE(0xf003, 0xf003) AM_READ(soundlatch2_r)
@@ -2255,7 +2225,7 @@ static INPUT_PORTS_START( prmrsocr )
INPUT_PORTS_END
-static void cuebrick_irq_handler(running_machine *machine, int state)
+static void cuebrick_irq_handler(const device_config *device, int state)
{
cuebrick_snd_irqlatch = state;
}
@@ -2265,10 +2235,10 @@ static const ym2151_interface ym2151_interface_cbj =
cuebrick_irq_handler
};
-static void volume_callback(int v)
+static void volume_callback(const device_config *device, int v)
{
- k007232_set_volume(0,0,(v >> 4) * 0x11,0);
- k007232_set_volume(0,1,0,(v & 0x0f) * 0x11);
+ k007232_set_volume(device,0,(v >> 4) * 0x11,0);
+ k007232_set_volume(device,1,0,(v & 0x0f) * 0x11);
}
static const k007232_interface k007232_config =
@@ -2357,10 +2327,10 @@ MACHINE_DRIVER_END
static MACHINE_RESET( tmnt )
{
- const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const device_config *upd = devtag_get_device(machine, SOUND, "upd");
/* the UPD7759 control flip-flops are cleared: /ST is 1, /RESET is 0 */
- upd7759_0_start_w(space, 0, 0);
- upd7759_0_reset_w(space, 0, 1);
+ upd7759_start_w(upd, 0);
+ upd7759_reset_w(upd, 1);
}
static MACHINE_DRIVER_START( tmnt )
@@ -2582,9 +2552,9 @@ static MACHINE_DRIVER_START( glfgreat )
MACHINE_DRIVER_END
-static void sound_nmi(running_machine *machine)
+static void sound_nmi(const device_config *device)
{
- cpu_set_input_line(machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE);
+ cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE);
}
static const k054539_interface k054539_config =
diff --git a/src/mame/drivers/tnzs.c b/src/mame/drivers/tnzs.c
index 4ccbd11a8b9..b05355b8389 100644
--- a/src/mame/drivers/tnzs.c
+++ b/src/mame/drivers/tnzs.c
@@ -682,12 +682,12 @@ static SAMPLES_START( kageki_init_samples )
static int kageki_csport_sel = 0;
-static READ8_HANDLER( kageki_csport_r )
+static READ8_DEVICE_HANDLER( kageki_csport_r )
{
int dsw, dsw1, dsw2;
- dsw1 = input_port_read(space->machine, "DSWA");
- dsw2 = input_port_read(space->machine, "DSWB");
+ dsw1 = input_port_read(device->machine, "DSWA");
+ dsw2 = input_port_read(device->machine, "DSWB");
switch (kageki_csport_sel)
{
@@ -711,7 +711,7 @@ static READ8_HANDLER( kageki_csport_r )
return (dsw & 0xff);
}
-static WRITE8_HANDLER( kageki_csport_w )
+static WRITE8_DEVICE_HANDLER( kageki_csport_w )
{
char mess[80];
@@ -723,32 +723,32 @@ static WRITE8_HANDLER( kageki_csport_w )
if (data > MAX_SAMPLES)
{
// stop samples
- sample_stop(0);
+ sample_stop(device, 0);
sprintf(mess, "VOICE:%02X STOP", data);
} else {
// play samples
- sample_start_raw(0, sampledata[data], samplesize[data], 7000, 0);
+ sample_start_raw(device, 0, sampledata[data], samplesize[data], 7000, 0);
sprintf(mess, "VOICE:%02X PLAY", data);
}
// popmessage(mess);
}
}
-static WRITE8_HANDLER( kabukiz_sound_bank_w )
+static WRITE8_DEVICE_HANDLER( kabukiz_sound_bank_w )
{
// to avoid the write when the sound chip is initialized
if(data != 0xff)
{
- UINT8 *ROM = memory_region(space->machine, "audio");
- memory_set_bankptr(space->machine, 3, &ROM[0x10000 + 0x4000 * (data & 0x07)]);
+ UINT8 *ROM = memory_region(device->machine, "audio");
+ memory_set_bankptr(device->machine, 3, &ROM[0x10000 + 0x4000 * (data & 0x07)]);
}
}
-static WRITE8_HANDLER( kabukiz_sample_w )
+static WRITE8_DEVICE_HANDLER( kabukiz_sample_w )
{
// to avoid the write when the sound chip is initialized
if(data != 0xff)
- dac_0_data_w(space, 0, data);
+ dac_data_w(device, data);
}
static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
@@ -794,8 +794,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sub_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_BANK2)
- AM_RANGE(0xb000, 0xb000) AM_READ(ym2203_status_port_0_r)
- AM_RANGE(0xb001, 0xb001) AM_READ(ym2203_read_port_0_r)
+ AM_RANGE(0xb000, 0xb001) AM_DEVREAD(SOUND, "ym", ym2203_r)
AM_RANGE(0xc000, 0xc001) AM_READ(tnzs_mcu_r) /* plain input ports in insectx (memory handler */
/* changed in insectx_init() ) */
AM_RANGE(0xd000, 0xdfff) AM_READ(SMH_RAM)
@@ -808,8 +807,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sub_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x9fff) AM_WRITE(SMH_ROM)
AM_RANGE(0xa000, 0xa000) AM_WRITE(tnzs_bankswitch1_w)
- AM_RANGE(0xb000, 0xb000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xb001, 0xb001) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0xb000, 0xb001) AM_DEVWRITE(SOUND, "ym", ym2203_w)
AM_RANGE(0xc000, 0xc001) AM_WRITE(tnzs_mcu_w) /* not present in insectx */
AM_RANGE(0xd000, 0xdfff) AM_WRITE(SMH_RAM)
AM_RANGE(0xe000, 0xefff) AM_WRITE(tnzs_sharedram_w)
@@ -818,8 +816,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( kageki_sub_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_BANK2)
- AM_RANGE(0xb000, 0xb000) AM_READ(ym2203_status_port_0_r)
- AM_RANGE(0xb001, 0xb001) AM_READ(ym2203_read_port_0_r)
+ AM_RANGE(0xb000, 0xb001) AM_DEVREAD(SOUND, "ym", ym2203_r)
AM_RANGE(0xc000, 0xc000) AM_READ_PORT("IN0")
AM_RANGE(0xc001, 0xc001) AM_READ_PORT("IN1")
AM_RANGE(0xc002, 0xc002) AM_READ_PORT("IN2")
@@ -830,8 +827,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( kageki_sub_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x9fff) AM_WRITE(SMH_ROM)
AM_RANGE(0xa000, 0xa000) AM_WRITE(tnzs_bankswitch1_w)
- AM_RANGE(0xb000, 0xb000) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0xb001, 0xb001) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0xb000, 0xb001) AM_DEVWRITE(SOUND, "ym", ym2203_w)
AM_RANGE(0xd000, 0xdfff) AM_WRITE(SMH_RAM)
AM_RANGE(0xe000, 0xefff) AM_WRITE(tnzs_sharedram_w)
ADDRESS_MAP_END
@@ -888,8 +884,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( tnzsb_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
AM_RANGE(0x02, 0x02) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -945,8 +940,7 @@ static ADDRESS_MAP_START( jpopnics_sub_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0x9fff) AM_READWRITE(SMH_BANK2, SMH_ROM)
AM_RANGE(0xa000, 0xa000) AM_WRITE(jpopnics_subbankswitch_w)
- AM_RANGE(0xb000, 0xb000) AM_READ_PORT("IN0") AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xb001, 0xb001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0xb000, 0xb001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0xc000, 0xc000) AM_READ_PORT("IN1")
AM_RANGE(0xc001, 0xc001) AM_READ_PORT("IN2")
AM_RANGE(0xc600, 0xc600) AM_READ_PORT("DSWA")
@@ -1580,19 +1574,19 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r, /* DSW1 connected to port A */
- input_port_1_r, /* DSW2 connected to port B */
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSWA"),
+ DEVCB_INPUT_PORT("DSWB"),
+ DEVCB_NULL,
+ DEVCB_NULL
},
NULL
};
/* handler called by the 2203 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[2], INPUT_LINE_NMI, irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[2], INPUT_LINE_NMI, irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface kageki_ym2203_interface =
@@ -1600,10 +1594,10 @@ static const ym2203_interface kageki_ym2203_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- kageki_csport_r,
- NULL,
- NULL,
- kageki_csport_w
+ DEVCB_HANDLER(kageki_csport_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_DEVICE_HANDLER(SOUND, "samples", kageki_csport_w)
},
};
@@ -1612,7 +1606,7 @@ static const ym2203_interface ym2203b_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
irqhandler
};
@@ -1622,10 +1616,10 @@ static const ym2203_interface kabukiz_ym2203_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- kabukiz_sound_bank_w,
- kabukiz_sample_w,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(kabukiz_sound_bank_w),
+ DEVCB_DEVICE_HANDLER(SOUND, "dac", kabukiz_sample_w)
},
irqhandler
};
@@ -1875,7 +1869,7 @@ static MACHINE_DRIVER_START( tnzsb )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("ym2203", YM2203, XTAL_12MHz/4) /* verified on pcb */
+ MDRV_SOUND_ADD("ym", YM2203, XTAL_12MHz/4) /* verified on pcb */
MDRV_SOUND_CONFIG(ym2203b_interface)
MDRV_SOUND_ROUTE(0, "mono", 1.0)
MDRV_SOUND_ROUTE(1, "mono", 1.0)
@@ -1895,7 +1889,7 @@ static MACHINE_DRIVER_START( kabukiz )
MDRV_CPU_MODIFY("audio")
MDRV_CPU_PROGRAM_MAP(kabukiz_cpu2_map,0)
- MDRV_SOUND_MODIFY("ym2203")
+ MDRV_SOUND_MODIFY("ym")
MDRV_SOUND_CONFIG(kabukiz_ym2203_interface)
MDRV_SOUND_ROUTE(0, "mono", 1.0)
MDRV_SOUND_ROUTE(1, "mono", 1.0)
diff --git a/src/mame/drivers/toaplan1.c b/src/mame/drivers/toaplan1.c
index 1fc3ba33371..a68c56d9403 100644
--- a/src/mame/drivers/toaplan1.c
+++ b/src/mame/drivers/toaplan1.c
@@ -282,8 +282,7 @@ static ADDRESS_MAP_START( rallybik_sound_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x30, 0x30) AM_WRITE(rallybik_coin_w) /* Coin counter/lockout */
AM_RANGE(0x40, 0x40) AM_READ_PORT("DSWA")
AM_RANGE(0x50, 0x50) AM_READ_PORT("DSWB")
- AM_RANGE(0x60, 0x60) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0x61, 0x61) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x60, 0x61) AM_DEVREADWRITE(SOUND, "ym", ym3812_r, ym3812_w)
AM_RANGE(0x70, 0x70) AM_READ_PORT("TJUMP")
ADDRESS_MAP_END
@@ -295,8 +294,7 @@ static ADDRESS_MAP_START( truxton_sound_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x30, 0x30) AM_WRITE(toaplan1_coin_w) /* Coin counter/lockout */
AM_RANGE(0x40, 0x40) AM_READ_PORT("DSWA")
AM_RANGE(0x50, 0x50) AM_READ_PORT("DSWB")
- AM_RANGE(0x60, 0x60) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0x61, 0x61) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x60, 0x61) AM_DEVREADWRITE(SOUND, "ym", ym3812_r, ym3812_w)
AM_RANGE(0x70, 0x70) AM_READ_PORT("TJUMP")
ADDRESS_MAP_END
@@ -309,8 +307,7 @@ static ADDRESS_MAP_START( hellfire_sound_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x40, 0x40) AM_READ_PORT("P1")
AM_RANGE(0x50, 0x50) AM_READ_PORT("P2")
AM_RANGE(0x60, 0x60) AM_READ_PORT("SYSTEM")
- AM_RANGE(0x70, 0x70) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0x71, 0x71) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x70, 0x71) AM_DEVREADWRITE(SOUND, "ym", ym3812_r, ym3812_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( zerowing_sound_io_map, ADDRESS_SPACE_IO, 8 )
@@ -322,14 +319,12 @@ static ADDRESS_MAP_START( zerowing_sound_io_map, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x80, 0x80) AM_READ_PORT("SYSTEM")
AM_RANGE(0x88, 0x88) AM_READ_PORT("TJUMP")
AM_RANGE(0xa0, 0xa0) AM_WRITE(toaplan1_coin_w) /* Coin counter/lockout */
- AM_RANGE(0xa8, 0xa8) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0xa9, 0xa9) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0xa8, 0xa9) AM_DEVREADWRITE(SOUND, "ym", ym3812_r, ym3812_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( demonwld_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym3812_r, ym3812_w)
AM_RANGE(0x20, 0x20) AM_READ_PORT("TJUMP")
AM_RANGE(0x40, 0x40) AM_WRITE(toaplan1_coin_w) /* Coin counter/lockout */
AM_RANGE(0x60, 0x60) AM_READ_PORT("SYSTEM")
@@ -341,8 +336,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( outzone_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym3812_r, ym3812_w)
AM_RANGE(0x04, 0x04) AM_WRITE(toaplan1_coin_w) /* Coin counter/lockout */
AM_RANGE(0x08, 0x08) AM_READ_PORT("DSWA")
AM_RANGE(0x0c, 0x0c) AM_READ_PORT("DSWB")
@@ -1228,9 +1222,9 @@ static GFXDECODE_START( vm )
GFXDECODE_END
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1],0,linestate);
+ cpu_set_input_line(device->machine->cpu[1],0,linestate);
}
static const ym3812_interface ym3812_config =
diff --git a/src/mame/drivers/toaplan2.c b/src/mame/drivers/toaplan2.c
index d347f1b363f..6b200facde6 100644
--- a/src/mame/drivers/toaplan2.c
+++ b/src/mame/drivers/toaplan2.c
@@ -634,7 +634,7 @@ static WRITE16_HANDLER( shippumd_coin_word_w )
if (ACCESSING_BITS_0_7)
{
toaplan2_coin_w(space, offset, data & 0xff);
- okim6295_set_bank_base(0, (((data & 0x10) >> 4) * 0x40000));
+ okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki"), (((data & 0x10) >> 4) * 0x40000));
}
if (ACCESSING_BITS_8_15 && (data & 0xff00) )
{
@@ -851,7 +851,7 @@ static WRITE16_HANDLER( dogyuun_snd_cpu_w )
if (ACCESSING_BITS_0_7)
{
mcu_data = data;
- dogyuun_okisnd_w(space, data);
+ dogyuun_okisnd_w(devtag_get_device(space->machine, SOUND, "oki"), data);
}
logerror("PC:%06x Writing command (%04x) to the NEC V25+ secondary CPU port\n",cpu_get_previouspc(space->cpu),mcu_data);
}
@@ -870,7 +870,7 @@ static WRITE16_HANDLER( kbash_snd_cpu_w )
{
if (ACCESSING_BITS_0_7)
{
- kbash_okisnd_w(space, data);
+ kbash_okisnd_w(devtag_get_device(space->machine, SOUND, "oki"), data);
}
logerror("PC:%06x Writing Sound command (%04x) to the NEC V25+ secondary CPU\n",cpu_get_previouspc(space->cpu),data);
}
@@ -907,7 +907,7 @@ static WRITE16_HANDLER( fixeight_sec_cpu_w )
if (mcu_data & 0xff00)
{
mcu_data = (mcu_data & 0xff00) | (data & 0xff);
- fixeight_okisnd_w(space, data);
+ fixeight_okisnd_w(devtag_get_device(space->machine, SOUND, "oki"), data);
}
else if (mcu_data == 0xff00)
{
@@ -951,7 +951,7 @@ static WRITE16_HANDLER( batsugun_snd_cpu_w )
if (ACCESSING_BITS_0_7)
{
mcu_data = data;
- batsugun_okisnd_w(space, data);
+ batsugun_okisnd_w(devtag_get_device(space->machine, SOUND, "oki"), data);
}
logerror("PC:%06x Writing command (%04x) to the NEC V25+ secondary CPU port %02x\n",cpu_get_previouspc(space->cpu),mcu_data,(offset*2));
}
@@ -969,22 +969,22 @@ static WRITE16_HANDLER( V25_sharedram_w )
}
}
-static WRITE16_HANDLER( oki_bankswitch_w )
+static WRITE16_DEVICE_HANDLER( oki_bankswitch_w )
{
if (ACCESSING_BITS_0_7)
{
- okim6295_set_bank_base(0, (data & 1) * 0x40000);
+ okim6295_set_bank_base(device, (data & 1) * 0x40000);
}
}
-static WRITE16_HANDLER( fixeighb_oki_bankswitch_w )
+static WRITE16_DEVICE_HANDLER( fixeighb_oki_bankswitch_w )
{
if (ACCESSING_BITS_0_7)
{
data &= 7;
if (data <= 4)
{
- UINT8 *fixeighb_oki = memory_region(space->machine, "oki");
+ UINT8 *fixeighb_oki = memory_region(device->machine, "oki");
memcpy(&fixeighb_oki[0x30000], &fixeighb_oki[(data * 0x10000) + 0x40000], 0x10000);
}
}
@@ -1287,7 +1287,7 @@ static WRITE16_HANDLER( bbakraid_nvram_w )
}
-static void bbakraid_irqhandler(running_machine *machine, int state)
+static void bbakraid_irqhandler(const device_config *device, int state)
{
/* Not used ??? Connected to a test pin (TP082) */
logerror("YMZ280 is generating an interrupt. State=%08x\n",state);
@@ -1411,9 +1411,9 @@ static ADDRESS_MAP_START( kbash2_68k_mem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x200010, 0x200011) AM_READ_PORT("IN1")
AM_RANGE(0x200014, 0x200015) AM_READ_PORT("IN2")
AM_RANGE(0x200018, 0x200019) AM_READ_PORT("SYS")
- AM_RANGE(0x200020, 0x200021) AM_READWRITE(okim6295_status_1_lsb_r, okim6295_data_1_lsb_w)
- AM_RANGE(0x200024, 0x200025) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
- AM_RANGE(0x200028, 0x200029) AM_WRITE(oki_bankswitch_w)
+ AM_RANGE(0x200020, 0x200021) AM_DEVREADWRITE8(SOUND, "oki2", okim6295_r, okim6295_w, 0x00ff)
+ AM_RANGE(0x200024, 0x200025) AM_DEVREADWRITE8(SOUND, "oki1", okim6295_r, okim6295_w, 0x00ff)
+ AM_RANGE(0x200028, 0x200029) AM_DEVWRITE(SOUND, "oki1", oki_bankswitch_w)
AM_RANGE(0x20002c, 0x20002d) AM_READ(video_count_r)
AM_RANGE(0x300000, 0x300001) AM_WRITE(toaplan2_0_voffs_w) /* VideoRAM selector/offset */
AM_RANGE(0x300004, 0x300007) AM_READWRITE(toaplan2_0_videoram16_r, toaplan2_0_videoram16_w) /* Tile/Sprite VideoRAM */
@@ -1444,9 +1444,8 @@ static ADDRESS_MAP_START( truxton2_68k_mem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x700006, 0x700007) AM_READ_PORT("IN1")
AM_RANGE(0x700008, 0x700009) AM_READ_PORT("IN2")
AM_RANGE(0x70000a, 0x70000b) AM_READ_PORT("SYS")
- AM_RANGE(0x700010, 0x700011) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
- AM_RANGE(0x700014, 0x700015) AM_WRITE(ym2151_register_port_0_lsb_w)
- AM_RANGE(0x700016, 0x700017) AM_READWRITE(ym2151_status_port_0_lsb_r, ym2151_data_port_0_lsb_w)
+ AM_RANGE(0x700010, 0x700011) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
+ AM_RANGE(0x700014, 0x700017) AM_DEVREADWRITE8(SOUND, "ym", ym2151_r, ym2151_w, 0x00ff)
AM_RANGE(0x70001e, 0x70001f) AM_WRITE(toaplan2_coin_word_w) /* Coin count/lock */
ADDRESS_MAP_END
@@ -1547,8 +1546,8 @@ static ADDRESS_MAP_START( fixeighb_68k_mem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x200008, 0x200009) AM_READ_PORT("IN3")
AM_RANGE(0x20000c, 0x20000d) AM_READ_PORT("DSWB")
AM_RANGE(0x200010, 0x200011) AM_READ_PORT("SYS")
- AM_RANGE(0x200014, 0x200015) AM_WRITE(fixeighb_oki_bankswitch_w) /* Sound banking. Code at $4084c, $5070 */
- AM_RANGE(0x200018, 0x200019) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x200014, 0x200015) AM_DEVWRITE(SOUND, "oki", fixeighb_oki_bankswitch_w) /* Sound banking. Code at $4084c, $5070 */
+ AM_RANGE(0x200018, 0x200019) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x20001c, 0x20001d) AM_READ_PORT("DSWA")
AM_RANGE(0x300000, 0x300001) AM_WRITE(toaplan2_0_voffs_w) /* VideoRAM selector/offset */
AM_RANGE(0x300004, 0x300007) AM_READWRITE(toaplan2_0_videoram16_r, toaplan2_0_videoram16_w) /* Tile/Sprite VideoRAM */
@@ -1683,9 +1682,8 @@ static ADDRESS_MAP_START( snowbro2_68k_mem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x300008, 0x300009) AM_WRITE(toaplan2_0_scroll_reg_select_w)
AM_RANGE(0x30000c, 0x30000d) AM_READWRITE(toaplan2_inputport_0_word_r, toaplan2_0_scroll_reg_data_w) /* VBlank */
AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)
- AM_RANGE(0x500000, 0x500001) AM_WRITE(ym2151_register_port_0_lsb_w)
- AM_RANGE(0x500002, 0x500003) AM_READWRITE(ym2151_status_port_0_lsb_r, ym2151_data_port_0_lsb_w)
- AM_RANGE(0x600000, 0x600001) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x500000, 0x500003) AM_DEVREADWRITE8(SOUND, "ym", ym2151_r, ym2151_w, 0x00ff)
+ AM_RANGE(0x600000, 0x600001) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x700000, 0x700001) AM_READ_PORT("JMPR")
AM_RANGE(0x700004, 0x700005) AM_READ_PORT("DSWA")
AM_RANGE(0x700008, 0x700009) AM_READ_PORT("DSWB")
@@ -1694,7 +1692,7 @@ static ADDRESS_MAP_START( snowbro2_68k_mem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x700014, 0x700015) AM_READ_PORT("IN3")
AM_RANGE(0x700018, 0x700019) AM_READ_PORT("IN4")
AM_RANGE(0x70001c, 0x70001d) AM_READ_PORT("SYS")
- AM_RANGE(0x700030, 0x700031) AM_WRITE(oki_bankswitch_w) /* Sample bank switch */
+ AM_RANGE(0x700030, 0x700031) AM_DEVWRITE(SOUND, "oki", oki_bankswitch_w) /* Sample bank switch */
AM_RANGE(0x700034, 0x700035) AM_WRITE(toaplan2_coin_word_w) /* Coin count/lock */
ADDRESS_MAP_END
@@ -1844,17 +1842,15 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_z80_mem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM AM_BASE(&toaplan2_shared_ram)
- AM_RANGE(0xe000, 0xe000) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0xe001, 0xe001) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0xe000, 0xe001) AM_DEVREADWRITE(SOUND, "ym", ym3812_r, ym3812_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( raizing_sound_z80_mem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xdfff) AM_RAM AM_BASE(&raizing_shared_ram)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xe001, 0xe001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
- AM_RANGE(0xe004, 0xe004) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0xe000, 0xe001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0xe004, 0xe004) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0xe00e, 0xe00e) AM_WRITE(toaplan2_coin_w)
ADDRESS_MAP_END
@@ -1863,9 +1859,8 @@ static ADDRESS_MAP_START( bgaregga_sound_z80_mem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1)
AM_RANGE(0xc000, 0xdfff) AM_RAM AM_BASE(&raizing_shared_ram)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xe001, 0xe001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
- AM_RANGE(0xe004, 0xe004) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0xe000, 0xe001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0xe004, 0xe004) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0xe006, 0xe006) AM_WRITE(raizing_okim6295_bankselect_0)
AM_RANGE(0xe008, 0xe008) AM_WRITE(raizing_okim6295_bankselect_1)
AM_RANGE(0xe00a, 0xe00a) AM_WRITE(bgaregga_bankswitch_w)
@@ -1890,10 +1885,9 @@ static ADDRESS_MAP_START( batrider_sound_z80_port, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x46, 0x46) AM_WRITE(raizing_clear_nmi_w)
AM_RANGE(0x48, 0x48) AM_READ(soundlatch_r)
AM_RANGE(0x4a, 0x4a) AM_READ(soundlatch2_r)
- AM_RANGE(0x80, 0x80) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x81, 0x81) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
- AM_RANGE(0x82, 0x82) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
- AM_RANGE(0x84, 0x84) AM_READWRITE(okim6295_status_1_r, okim6295_data_1_w)
+ AM_RANGE(0x80, 0x81) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0x82, 0x82) AM_DEVREADWRITE(SOUND, "oki1", okim6295_r, okim6295_w)
+ AM_RANGE(0x84, 0x84) AM_DEVREADWRITE(SOUND, "oki2", okim6295_r, okim6295_w)
AM_RANGE(0x88, 0x88) AM_WRITE(batrider_bankswitch_w)
AM_RANGE(0xc0, 0xc0) AM_WRITE(raizing_okim6295_bankselect_0)
AM_RANGE(0xc2, 0xc2) AM_WRITE(raizing_okim6295_bankselect_1)
@@ -1917,8 +1911,7 @@ static ADDRESS_MAP_START( bbakraid_sound_z80_port, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x46, 0x46) AM_WRITE(raizing_clear_nmi_w)
AM_RANGE(0x48, 0x48) AM_READ(soundlatch_r)
AM_RANGE(0x4a, 0x4a) AM_READ(soundlatch2_r)
- AM_RANGE(0x80, 0x80) AM_WRITE(ymz280b_register_0_w)
- AM_RANGE(0x81, 0x81) AM_READWRITE(ymz280b_status_0_r, ymz280b_data_0_w)
+ AM_RANGE(0x80, 0x81) AM_DEVREADWRITE(SOUND, "ymz", ymz280b_r, ymz280b_w)
ADDRESS_MAP_END
@@ -1938,10 +1931,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( V25_mem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x00000, 0x03fff) AM_ROM
// AM_RANGE(0x00000, 0x007ff) AM_RAM /* External shared RAM (Banked) */
- AM_RANGE(0x04000, 0x04000) AM_READWRITE(ym2151_status_port_0_r, ym2151_register_port_0_w)
- AM_RANGE(0x04001, 0x04001) AM_WRITE(ym2151_data_port_0_w)
- AM_RANGE(0x04002, 0x04002) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
-// AM_RANGE(0x04004, 0x04004) AM_WRITE(oki_bankswitch_w)
+ AM_RANGE(0x04000, 0x04001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0x04002, 0x04002) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
+// AM_RANGE(0x04004, 0x04004) AM_DEVWRITE(SOUND, "oki", oki_bankswitch_w)
AM_RANGE(0x04008, 0x04008) AM_READ_PORT("IN1")
AM_RANGE(0x0400a, 0x0400a) AM_READ_PORT("IN2")
AM_RANGE(0x0400c, 0x0400c) AM_READ_PORT("SYS")
@@ -1969,8 +1961,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( V25_rambased_mem, ADDRESS_SPACE_PROGRAM, 8 )
- AM_RANGE(0x00000, 0x00000) AM_WRITE( ym2151_register_port_0_w )
- AM_RANGE(0x00001, 0x00001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x00000, 0x00001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x07800, 0x07fff) AM_RAM AM_SHARE(6)
@@ -3349,9 +3340,9 @@ static GFXDECODE_START( fixeighb )
GFXDECODE_ENTRY( "gfx2", 0, fixeighblayout , 0, 128 )
GFXDECODE_END
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1],0,linestate);
+ cpu_set_input_line(device->machine->cpu[1],0,linestate);
}
static const ym3812_interface ym3812_config =
@@ -3845,7 +3836,7 @@ static MACHINE_RESET(batsugun)
#endif
}
-static void batsugun_ym2151_irqhandler(running_machine *machine, int linestate)
+static void batsugun_ym2151_irqhandler(const device_config *device, int linestate)
{
logerror("batsugun_ym2151_irqhandler %02x\n",linestate);
// update_irq_lines(machine, linestate ? assert : clear);
diff --git a/src/mame/drivers/toki.c b/src/mame/drivers/toki.c
index 949990ecc2d..1ddc2e5ce12 100644
--- a/src/mame/drivers/toki.c
+++ b/src/mame/drivers/toki.c
@@ -77,7 +77,7 @@ static void toki_adpcm_int (const device_config *device)
{
static int toggle=0;
- msm5205_data_w (0,msm5205next);
+ msm5205_data_w (device,msm5205next);
msm5205next>>=4;
toggle ^= 1;
@@ -85,17 +85,17 @@ static void toki_adpcm_int (const device_config *device)
cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE);
}
-static WRITE8_HANDLER( toki_adpcm_control_w )
+static WRITE8_DEVICE_HANDLER( toki_adpcm_control_w )
{
int bankaddress;
- UINT8 *RAM = memory_region(space->machine, "audio");
+ UINT8 *RAM = memory_region(device->machine, "audio");
/* the code writes either 2 or 3 in the bottom two bits */
bankaddress = 0x10000 + (data & 0x01) * 0x4000;
- memory_set_bankptr(space->machine, 1,&RAM[bankaddress]);
+ memory_set_bankptr(device->machine, 1,&RAM[bankaddress]);
- msm5205_reset_w(0,data & 0x08);
+ msm5205_reset_w(device,data & 0x08);
}
static WRITE8_HANDLER( toki_adpcm_data_w )
@@ -150,12 +150,9 @@ static ADDRESS_MAP_START( tokib_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1)
AM_RANGE(0x0000, 0xbfff) AM_WRITE(SMH_ROM)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(toki_adpcm_control_w) /* MSM5205 + ROM bank */
+ AM_RANGE(0xe000, 0xe000) AM_DEVWRITE(SOUND, "msm", toki_adpcm_control_w) /* MSM5205 + ROM bank */
AM_RANGE(0xe400, 0xe400) AM_WRITE(toki_adpcm_data_w)
- AM_RANGE(0xec00, 0xec00) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0xec01, 0xec01) AM_WRITE(ym3812_write_port_0_w)
- AM_RANGE(0xec08, 0xec08) AM_WRITE(ym3812_control_port_0_w) /* mirror address, it seems */
- AM_RANGE(0xec09, 0xec09) AM_WRITE(ym3812_write_port_0_w) /* mirror address, it seems */
+ AM_RANGE(0xec00, 0xec01) AM_MIRROR(0x0008) AM_DEVREADWRITE(SOUND, "ym", ym3812_r, ym3812_w)
AM_RANGE(0xf000, 0xf7ff) AM_RAM
AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/topspeed.c b/src/mame/drivers/topspeed.c
index 96247ad8ce2..d38218ce7d5 100644
--- a/src/mame/drivers/topspeed.c
+++ b/src/mame/drivers/topspeed.c
@@ -409,36 +409,36 @@ static void reset_sound_region(running_machine *machine)
memory_set_bankptr(machine, 10, memory_region(machine, "audio") + (banknum * 0x4000) + 0x10000 );
}
-static WRITE8_HANDLER( sound_bankswitch_w ) /* assumes Z80 sandwiched between 68Ks */
+static WRITE8_DEVICE_HANDLER( sound_bankswitch_w ) /* assumes Z80 sandwiched between 68Ks */
{
banknum = (data - 1) & 7;
- reset_sound_region(space->machine);
+ reset_sound_region(device->machine);
}
static void topspeed_msm5205_vck(const device_config *device)
{
if (adpcm_data != -1)
{
- msm5205_data_w(0, adpcm_data & 0x0f);
+ msm5205_data_w(device, adpcm_data & 0x0f);
adpcm_data = -1;
}
else
{
adpcm_data = memory_region(device->machine, "adpcm")[adpcm_pos];
adpcm_pos = (adpcm_pos + 1) & 0x1ffff;
- msm5205_data_w(0, adpcm_data >> 4);
+ msm5205_data_w(device, adpcm_data >> 4);
}
}
-static WRITE8_HANDLER( topspeed_msm5205_address_w )
+static WRITE8_DEVICE_HANDLER( topspeed_msm5205_address_w )
{
adpcm_pos = (adpcm_pos & 0x00ff) | (data << 8);
- msm5205_reset_w(0, 0);
+ msm5205_reset_w(device, 0);
}
-static WRITE8_HANDLER( topspeed_msm5205_stop_w )
+static WRITE8_DEVICE_HANDLER( topspeed_msm5205_stop_w )
{
- msm5205_reset_w(0, 1);
+ msm5205_reset_w(device, 1);
adpcm_pos &= 0xff00;
}
@@ -507,20 +507,19 @@ static ADDRESS_MAP_START( z80_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM)
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK10)
AM_RANGE(0x8000, 0x8fff) AM_READ(SMH_RAM)
- AM_RANGE(0x9001, 0x9001) AM_READ(ym2151_status_port_0_r)
+ AM_RANGE(0x9000, 0x9001) AM_DEVREAD(SOUND, "ym", ym2151_r)
AM_RANGE(0xa001, 0xa001) AM_READ(taitosound_slave_comm_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( z80_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x8fff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x9000, 0x9000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x9001, 0x9001) AM_WRITE(ym2151_data_port_0_w)
+ AM_RANGE(0x9000, 0x9001) AM_DEVWRITE(SOUND, "ym", ym2151_w)
AM_RANGE(0xa000, 0xa000) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0xa001, 0xa001) AM_WRITE(taitosound_slave_comm_w)
- AM_RANGE(0xb000, 0xb000) AM_WRITE(topspeed_msm5205_address_w)
+ AM_RANGE(0xb000, 0xb000) AM_DEVWRITE(SOUND, "msm", topspeed_msm5205_address_w)
// AM_RANGE(0xb400, 0xb400) // msm5205 start? doesn't seem to work right
- AM_RANGE(0xb800, 0xb800) AM_WRITE(topspeed_msm5205_stop_w)
+ AM_RANGE(0xb800, 0xb800) AM_DEVWRITE(SOUND, "msm", topspeed_msm5205_stop_w)
// AM_RANGE(0xc000, 0xc000) // ??
// AM_RANGE(0xc400, 0xc400) // ??
// AM_RANGE(0xc800, 0xc800) // ??
@@ -654,9 +653,9 @@ GFXDECODE_END
/* handler called by the YM2151 emulator when the internal timers cause an IRQ */
-static void irq_handler(running_machine *machine, int irq) /* assumes Z80 sandwiched between 68Ks */
+static void irq_handler(const device_config *device, int irq) /* assumes Z80 sandwiched between 68Ks */
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/toratora.c b/src/mame/drivers/toratora.c
index 023400404e3..f7184824781 100644
--- a/src/mame/drivers/toratora.c
+++ b/src/mame/drivers/toratora.c
@@ -199,14 +199,14 @@ static const sn76477_interface sn76477_intf =
};
-static void port_a_u2_u3_w(int which, UINT8 data)
+static void port_a_u2_u3_w(const device_config *device, UINT8 data)
{
- sn76477_vco_voltage_w(which, 2.35 * (data & 0x7f) / 128.0);
- sn76477_enable_w(which, (data >> 7) & 0x01);
+ sn76477_vco_voltage_w(device, 2.35 * (data & 0x7f) / 128.0);
+ sn76477_enable_w(device, (data >> 7) & 0x01);
}
-static void port_b_u2_u3_w(int which, UINT8 data)
+static void port_b_u2_u3_w(const device_config *device, UINT8 data)
{
static const double resistances[] =
{
@@ -220,54 +220,54 @@ static void port_b_u2_u3_w(int which, UINT8 data)
RES_K(47)
};
- sn76477_mixer_a_w (which, (data >> 0) & 0x01);
- sn76477_mixer_b_w (which, (data >> 1) & 0x01);
- sn76477_mixer_c_w (which, (data >> 2) & 0x01);
- sn76477_envelope_1_w (which, (data >> 3) & 0x01);
- sn76477_envelope_2_w (which, (data >> 4) & 0x01);
- sn76477_amplitude_res_w(which, resistances[(data >> 5)] * 2); /* the *2 shouldn't be neccassary, but... */
+ sn76477_mixer_a_w (device, (data >> 0) & 0x01);
+ sn76477_mixer_b_w (device, (data >> 1) & 0x01);
+ sn76477_mixer_c_w (device, (data >> 2) & 0x01);
+ sn76477_envelope_1_w (device, (data >> 3) & 0x01);
+ sn76477_envelope_2_w (device, (data >> 4) & 0x01);
+ sn76477_amplitude_res_w(device, resistances[(data >> 5)] * 2); /* the *2 shouldn't be neccassary, but... */
}
-static void ca2_u2_u3_w(int which, UINT8 data)
+static void ca2_u2_u3_w(const device_config *device, UINT8 data)
{
- sn76477_vco_w(which, data);
+ sn76477_vco_w(device, data);
}
static WRITE8_HANDLER( port_a_u2_w )
{
- port_a_u2_u3_w(0, data);
+ port_a_u2_u3_w(devtag_get_device(space->machine, SOUND, "sn1"), data);
}
static WRITE8_HANDLER( port_a_u3_w )
{
- port_a_u2_u3_w(1, data);
+ port_a_u2_u3_w(devtag_get_device(space->machine, SOUND, "sn2"), data);
}
static WRITE8_HANDLER( port_b_u2_w )
{
- port_b_u2_u3_w(0, data);
+ port_b_u2_u3_w(devtag_get_device(space->machine, SOUND, "sn1"), data);
}
static WRITE8_HANDLER( port_b_u3_w )
{
- port_b_u2_u3_w(1, data);
+ port_b_u2_u3_w(devtag_get_device(space->machine, SOUND, "sn2"), data);
}
static WRITE8_HANDLER( ca2_u2_w )
{
- ca2_u2_u3_w(0, data);
+ ca2_u2_u3_w(devtag_get_device(space->machine, SOUND, "sn1"), data);
}
static WRITE8_HANDLER( ca2_u3_w )
{
- ca2_u2_u3_w(1, data);
+ ca2_u2_u3_w(devtag_get_device(space->machine, SOUND, "sn2"), data);
}
diff --git a/src/mame/drivers/toypop.c b/src/mame/drivers/toypop.c
index 09d79970065..34b5ab1a6ab 100644
--- a/src/mame/drivers/toypop.c
+++ b/src/mame/drivers/toypop.c
@@ -135,10 +135,10 @@ static READ8_HANDLER( toypop_sound_sharedram_r )
return namco_soundregs[offset];
}
-static WRITE8_HANDLER( toypop_sound_sharedram_w )
+static WRITE8_DEVICE_HANDLER( toypop_sound_sharedram_w )
{
if (offset < 0x40)
- namco_15xx_w(space,offset,data);
+ namco_15xx_w(device,offset,data);
else
namco_soundregs[offset] = data;
}
@@ -277,7 +277,7 @@ static ADDRESS_MAP_START( writemem_mainCPU_liblrabl, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1800, 0x1f7f) AM_WRITE(SMH_RAM) /* general RAM, area 3 */
AM_RANGE(0x1f80, 0x1fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram_3) /* sprite RAM, area 3 */
AM_RANGE(0x2800, 0x2fff) AM_WRITE(SMH_RAM) AM_BASE(&toypop_m68000_sharedram) /* shared RAM with the 68000 CPU */
- AM_RANGE(0x6000, 0x63ff) AM_WRITE(toypop_sound_sharedram_w) /* shared RAM with sound CPU */
+ AM_RANGE(0x6000, 0x63ff) AM_DEVWRITE(SOUND, "namco", toypop_sound_sharedram_w) /* shared RAM with sound CPU */
AM_RANGE(0x6800, 0x683f) AM_WRITE(namcoio_w) /* custom I/O */
AM_RANGE(0x7000, 0x7000) AM_WRITE(toypop_main_interrupt_enable_w) /* enable interrupt */
AM_RANGE(0x7800, 0x7800) AM_WRITE(toypop_main_interrupt_disable_w) /* disable interrupt */
@@ -299,7 +299,7 @@ static ADDRESS_MAP_START( writemem_mainCPU_toypop, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1f80, 0x1fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram_3) /* sprite RAM, area 3 */
AM_RANGE(0x2800, 0x2fff) AM_WRITE(SMH_RAM) AM_BASE(&toypop_m68000_sharedram) /* shared RAM with the 68000 CPU */
AM_RANGE(0x6000, 0x603f) AM_WRITE(namcoio_w) /* custom I/O */
- AM_RANGE(0x6800, 0x6bff) AM_WRITE(toypop_sound_sharedram_w) /* shared RAM with sound CPU */
+ AM_RANGE(0x6800, 0x6bff) AM_DEVWRITE(SOUND, "namco", toypop_sound_sharedram_w) /* shared RAM with sound CPU */
AM_RANGE(0x7000, 0x7000) AM_WRITE(toypop_main_interrupt_disable_w) /* disable interrupt */
AM_RANGE(0x8000, 0x8000) AM_WRITE(toypop_m68000_clear_w) /* reset 68000 */
AM_RANGE(0x8800, 0x8800) AM_WRITE(toypop_m68000_assert_w) /* reset 68000 */
@@ -322,7 +322,7 @@ static ADDRESS_MAP_START( readmem_soundCPU, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem_soundCPU, ADDRESS_SPACE_PROGRAM, 8 )
- AM_RANGE(0x0000, 0x03ff) AM_WRITE(toypop_sound_sharedram_w) AM_BASE(&namco_soundregs) /* shared RAM with the main CPU + sound registers */
+ AM_RANGE(0x0000, 0x03ff) AM_DEVWRITE(SOUND, "namco", toypop_sound_sharedram_w) AM_BASE(&namco_soundregs) /* shared RAM with the main CPU + sound registers */
AM_RANGE(0x2000, 0x2000) AM_WRITE(toypop_sound_interrupt_disable_w) /* ??? toypop doesn't write here */
AM_RANGE(0x4000, 0x4000) AM_WRITE(toypop_sound_interrupt_enable_acknowledge_w)
AM_RANGE(0x6000, 0x6000) AM_WRITE(watchdog_reset_w)
diff --git a/src/mame/drivers/tp84.c b/src/mame/drivers/tp84.c
index d3dc52b94db..6872b537b83 100644
--- a/src/mame/drivers/tp84.c
+++ b/src/mame/drivers/tp84.c
@@ -109,23 +109,23 @@ static WRITE8_HANDLER( tp84_filter_w )
C = 0;
if (offset & 0x008) C += 47000; /* 47000pF = 0.047uF */
if (offset & 0x010) C += 470000; /* 470000pF = 0.47uF */
- filter_rc_set_RC(0,FLT_RC_LOWPASS,1000,2200,1000,CAP_P(C));
+ filter_rc_set_RC(devtag_get_device(space->machine, SOUND, "filter1"),FLT_RC_LOWPASS,1000,2200,1000,CAP_P(C));
/* 76489 #1 (optional) */
C = 0;
if (offset & 0x020) C += 47000; /* 47000pF = 0.047uF */
if (offset & 0x040) C += 470000; /* 470000pF = 0.47uF */
-// filter_rc_set_RC(1,1000,2200,1000,C);
+// filter_rc_set_RC(devtag_get_device(space->machine, SOUND, "filter2"),1000,2200,1000,C);
/* 76489 #2 */
C = 0;
if (offset & 0x080) C += 470000; /* 470000pF = 0.47uF */
- filter_rc_set_RC(1,FLT_RC_LOWPASS,1000,2200,1000,CAP_P(C));
+ filter_rc_set_RC(devtag_get_device(space->machine, SOUND, "filter2"),FLT_RC_LOWPASS,1000,2200,1000,CAP_P(C));
/* 76489 #3 */
C = 0;
if (offset & 0x100) C += 470000; /* 470000pF = 0.47uF */
- filter_rc_set_RC(2,FLT_RC_LOWPASS,1000,2200,1000,CAP_P(C));
+ filter_rc_set_RC(devtag_get_device(space->machine, SOUND, "filter3"),FLT_RC_LOWPASS,1000,2200,1000,CAP_P(C));
}
static WRITE8_HANDLER( tp84_sh_irqtrigger_w )
@@ -196,9 +196,9 @@ static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0x8000) AM_READ(tp84_sh_timer_r)
AM_RANGE(0xa000, 0xa1ff) AM_WRITE(tp84_filter_w)
AM_RANGE(0xc000, 0xc000) AM_WRITE(SMH_NOP)
- AM_RANGE(0xc001, 0xc001) AM_WRITE(sn76496_0_w)
- AM_RANGE(0xc003, 0xc003) AM_WRITE(sn76496_1_w)
- AM_RANGE(0xc004, 0xc004) AM_WRITE(sn76496_2_w)
+ AM_RANGE(0xc001, 0xc001) AM_DEVWRITE(SOUND, "sn1", sn76496_w)
+ AM_RANGE(0xc003, 0xc003) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
+ AM_RANGE(0xc004, 0xc004) AM_DEVWRITE(SOUND, "sn3", sn76496_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/trackfld.c b/src/mame/drivers/trackfld.c
index 2d24ebf19cb..79dcebf69d8 100644
--- a/src/mame/drivers/trackfld.c
+++ b/src/mame/drivers/trackfld.c
@@ -42,8 +42,8 @@ VIDEO_UPDATE( trackfld );
WRITE8_HANDLER( konami_sh_irqtrigger_w );
READ8_HANDLER( trackfld_sh_timer_r );
-READ8_HANDLER( trackfld_speech_r );
-WRITE8_HANDLER( trackfld_sound_w );
+READ8_DEVICE_HANDLER( trackfld_speech_r );
+WRITE8_DEVICE_HANDLER( trackfld_sound_w );
READ8_HANDLER( hyprolyb_speech_r );
WRITE8_HANDLER( hyprolyb_ADPCM_data_w );
@@ -259,23 +259,23 @@ static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0x8000) AM_READ(trackfld_sh_timer_r)
AM_RANGE(0xc000, 0xc000) AM_READ(SMH_NOP) // reaktor reads here
AM_RANGE(0xe001, 0xe001) AM_READ(SMH_NOP) // reaktor reads here
- AM_RANGE(0xe002, 0xe002) AM_READ(trackfld_speech_r)
+ AM_RANGE(0xe002, 0xe002) AM_DEVREAD(SOUND, "vlm", trackfld_speech_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x4000, 0x43ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xa000, 0xa000) AM_WRITE(sn76496_0_w) /* Loads the snd command into the snd latch */
+ AM_RANGE(0xa000, 0xa000) AM_DEVWRITE(SOUND, "sn", sn76496_w) /* Loads the snd command into the snd latch */
AM_RANGE(0xc000, 0xc000) AM_WRITE(SMH_NOP) /* This address triggers the SN chip to read the data port. */
- AM_RANGE(0xe000, 0xe000) AM_WRITE(dac_0_data_w)
+ AM_RANGE(0xe000, 0xe000) AM_DEVWRITE(SOUND, "dac", dac_w)
/* There are lots more addresses which are used for setting a two bit volume
controls for speech and music
Currently these are un-supported by Mame
*/
AM_RANGE(0xe001, 0xe001) AM_WRITE(SMH_NOP) /* watch dog ? */
- AM_RANGE(0xe004, 0xe004) AM_WRITE(vlm5030_data_w)
- AM_RANGE(0xe000, 0xefff) AM_WRITE(trackfld_sound_w) /* e003 speech control */
+ AM_RANGE(0xe004, 0xe004) AM_DEVWRITE(SOUND, "vlm", vlm5030_data_w)
+ AM_RANGE(0xe000, 0xefff) AM_DEVWRITE(SOUND, "vlm", trackfld_sound_w) /* e003 speech control */
ADDRESS_MAP_END
static ADDRESS_MAP_START( hyprolyb_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
@@ -289,9 +289,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( hyprolyb_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x4000, 0x43ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xa000, 0xa000) AM_WRITE(sn76496_0_w) /* Loads the snd command into the snd latch */
+ AM_RANGE(0xa000, 0xa000) AM_DEVWRITE(SOUND, "sn", sn76496_w) /* Loads the snd command into the snd latch */
AM_RANGE(0xc000, 0xc000) AM_WRITE(SMH_NOP) /* This address triggers the SN chip to read the data port. */
- AM_RANGE(0xe000, 0xe000) AM_WRITE(dac_0_data_w)
+ AM_RANGE(0xe000, 0xe000) AM_DEVWRITE(SOUND, "dac", dac_w)
/* There are lots more addresses which are used for setting a two bit volume
controls for speech and music
diff --git a/src/mame/drivers/triplhnt.c b/src/mame/drivers/triplhnt.c
index e2510430295..4fbc17e8b58 100644
--- a/src/mame/drivers/triplhnt.c
+++ b/src/mame/drivers/triplhnt.c
@@ -38,7 +38,8 @@ void triplhnt_set_collision(running_machine *machine, int code)
static void triplhnt_update_misc(running_machine *machine, int offset)
{
- const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const device_config *samples = devtag_get_device(machine, SOUND, "samples");
+ const device_config *discrete = devtag_get_device(machine, SOUND, "discrete");
UINT8 is_witch_hunt;
UINT8 bit = offset >> 1;
@@ -73,22 +74,22 @@ static void triplhnt_update_misc(running_machine *machine, int offset)
coin_lockout_w(0, !(triplhnt_misc_flags & 0x08));
coin_lockout_w(1, !(triplhnt_misc_flags & 0x08));
- discrete_sound_w(space, TRIPLHNT_SCREECH_EN, triplhnt_misc_flags & 0x04); // screech
- discrete_sound_w(space, TRIPLHNT_LAMP_EN, triplhnt_misc_flags & 0x02); // Lamp is used to reset noise
- discrete_sound_w(space, TRIPLHNT_BEAR_EN, triplhnt_misc_flags & 0x80); // bear
+ discrete_sound_w(discrete, TRIPLHNT_SCREECH_EN, triplhnt_misc_flags & 0x04); // screech
+ discrete_sound_w(discrete, TRIPLHNT_LAMP_EN, triplhnt_misc_flags & 0x02); // Lamp is used to reset noise
+ discrete_sound_w(discrete, TRIPLHNT_BEAR_EN, triplhnt_misc_flags & 0x80); // bear
is_witch_hunt = input_port_read(machine, "0C09") == 0x40;
bit = ~triplhnt_misc_flags & 0x40;
/* if we're not playing the sample yet, start it */
- if (!sample_playing(0))
- sample_start(0, 0, 1);
- if (!sample_playing(1))
- sample_start(1, 1, 1);
+ if (!sample_playing(samples, 0))
+ sample_start(samples, 0, 0, 1);
+ if (!sample_playing(samples, 1))
+ sample_start(samples, 1, 1, 1);
/* bit 6 turns cassette on/off */
- sample_set_pause(0, is_witch_hunt || bit);
- sample_set_pause(1, !is_witch_hunt || bit);
+ sample_set_pause(samples, 0, is_witch_hunt || bit);
+ sample_set_pause(samples, 1, !is_witch_hunt || bit);
}
diff --git a/src/mame/drivers/truco.c b/src/mame/drivers/truco.c
index 0f2d26b82f1..4331c56ea97 100644
--- a/src/mame/drivers/truco.c
+++ b/src/mame/drivers/truco.c
@@ -35,7 +35,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x7c00, 0x7fff) AM_RAM AM_BASE(&battery_ram) /* battery backed ram */
AM_RANGE(0x8000, 0x8000) AM_READ_PORT("P1") AM_WRITENOP /* controls (and irq ack?) */
AM_RANGE(0x8001, 0x8001) AM_READWRITE(SMH_NOP, SMH_NOP) /* unknown */
- AM_RANGE(0x8002, 0x8002) AM_READ_PORT("DSW") AM_WRITE(dac_0_data_w) /* dipswitches */
+ AM_RANGE(0x8002, 0x8002) AM_READ_PORT("DSW") AM_DEVWRITE(SOUND, "dac", dac_w) /* dipswitches */
AM_RANGE(0x8003, 0x8007) AM_READWRITE(SMH_NOP, SMH_NOP) /* unknown */
AM_RANGE(0x8008, 0xffff) AM_ROM
ADDRESS_MAP_END
diff --git a/src/mame/drivers/trucocl.c b/src/mame/drivers/trucocl.c
index ecd60c22cc6..16c719d22b1 100644
--- a/src/mame/drivers/trucocl.c
+++ b/src/mame/drivers/trucocl.c
@@ -57,9 +57,9 @@ static TIMER_CALLBACK( dac_irq )
cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE );
}
-static WRITE8_HANDLER( audio_dac_w)
+static WRITE8_DEVICE_HANDLER( audio_dac_w)
{
- UINT8 *rom = memory_region(space->machine, "main");
+ UINT8 *rom = memory_region(device->machine, "main");
int dac_address = ( data & 0xf0 ) << 8;
int sel = ( ( (~data) >> 1 ) & 2 ) | ( data & 1 );
@@ -81,9 +81,9 @@ static WRITE8_HANDLER( audio_dac_w)
dac_address += 0x10000;
- dac_data_w( 0, rom[dac_address+cur_dac_address_index] );
+ dac_data_w( device, rom[dac_address+cur_dac_address_index] );
- timer_set( space->machine, ATTOTIME_IN_HZ( 16000 ), NULL, 0, dac_irq );
+ timer_set( device->machine, ATTOTIME_IN_HZ( 16000 ), NULL, 0, dac_irq );
}
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
@@ -93,7 +93,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4c00, 0x4fff) AM_RAM
AM_RANGE(0x5000, 0x5000) AM_WRITE(irq_enable_w)
AM_RANGE(0x5000, 0x503f) AM_READ_PORT("IN0")
- AM_RANGE(0x5080, 0x5080) AM_WRITE(audio_dac_w)
+ AM_RANGE(0x5080, 0x5080) AM_DEVWRITE(SOUND, "dac", audio_dac_w)
AM_RANGE(0x50c0, 0x50c0) AM_WRITE(watchdog_reset_w)
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
diff --git a/src/mame/drivers/trvmadns.c b/src/mame/drivers/trvmadns.c
index 590592b42fc..325aaa4f9bf 100644
--- a/src/mame/drivers/trvmadns.c
+++ b/src/mame/drivers/trvmadns.c
@@ -210,8 +210,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
AM_RANGE(0x02, 0x02) AM_READ_PORT("IN0")
AM_RANGE(0x80, 0x80) AM_WRITE(trvmadns_banking_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/trvquest.c b/src/mame/drivers/trvquest.c
index dfd171c9eb9..4b2e02dcce9 100644
--- a/src/mame/drivers/trvquest.c
+++ b/src/mame/drivers/trvquest.c
@@ -63,10 +63,8 @@ static ADDRESS_MAP_START( cpu_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x3800, 0x380f) AM_DEVREADWRITE(VIA6522, "via6522_1", via_r, via_w)
AM_RANGE(0x3810, 0x381f) AM_DEVREADWRITE(VIA6522, "via6522_2", via_r, via_w)
AM_RANGE(0x3820, 0x382f) AM_DEVREADWRITE(VIA6522, "via6522_0", via_r, via_w)
- AM_RANGE(0x3830, 0x3830) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x3831, 0x3831) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x3840, 0x3840) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x3841, 0x3841) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0x3830, 0x3831) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x3840, 0x3841) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
AM_RANGE(0x3850, 0x3850) AM_READNOP //watchdog_reset_r ?
AM_RANGE(0x8000, 0x9fff) AM_READ(trvquest_question_r)
AM_RANGE(0xa000, 0xa000) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(gameplan_state, trvquest_question)
diff --git a/src/mame/drivers/tryout.c b/src/mame/drivers/tryout.c
index 67a2ee350a3..7778a4ca33e 100644
--- a/src/mame/drivers/tryout.c
+++ b/src/mame/drivers/tryout.c
@@ -77,8 +77,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_cpu, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM
- AM_RANGE(0x4000, 0x4000) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x4001, 0x4001) AM_WRITE(ym2203_write_port_0_w)
+ AM_RANGE(0x4000, 0x4001) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
AM_RANGE(0xd000, 0xd000) AM_WRITE(tryout_sound_irq_ack_w)
AM_RANGE(0xc000, 0xffff) AM_ROM
diff --git a/src/mame/drivers/tsamurai.c b/src/mame/drivers/tsamurai.c
index 9f495cb1f2e..6ceda10a627 100644
--- a/src/mame/drivers/tsamurai.c
+++ b/src/mame/drivers/tsamurai.c
@@ -227,8 +227,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( z80_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( z80_m660_io_map, ADDRESS_SPACE_IO, 8 )
@@ -240,8 +239,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( vsgongf_audio_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
ADDRESS_MAP_END
static READ8_HANDLER( sound_command1_r )
@@ -249,20 +247,10 @@ static READ8_HANDLER( sound_command1_r )
return sound_command1;
}
-static WRITE8_HANDLER( sound_out1_w )
-{
- dac_data_w(0,data);
-}
-
static READ8_HANDLER( sound_command2_r ){
return sound_command2;
}
-static WRITE8_HANDLER( sound_out2_w )
-{
- dac_data_w(1,data);
-}
-
static READ8_HANDLER( sound_command3_r ){
return sound_command3;
}
@@ -277,7 +265,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem_sound1, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x6001, 0x6001) AM_WRITE(SMH_NOP) /* ? - probably clear IRQ */
- AM_RANGE(0x6002, 0x6002) AM_WRITE(sound_out1_w)
+ AM_RANGE(0x6002, 0x6002) AM_DEVWRITE(SOUND, "dac1", dac_w)
AM_RANGE(0x7f00, 0x7fff) AM_WRITE(SMH_RAM)
ADDRESS_MAP_END
@@ -292,7 +280,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem_sound2, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x6001, 0x6001) AM_WRITE(SMH_NOP) /* ? - probably clear IRQ */
- AM_RANGE(0x6002, 0x6002) AM_WRITE(sound_out2_w)
+ AM_RANGE(0x6002, 0x6002) AM_DEVWRITE(SOUND, "dac2", dac_w)
AM_RANGE(0x7f00, 0x7fff) AM_WRITE(SMH_RAM)
ADDRESS_MAP_END
@@ -307,7 +295,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem_sound1_m660, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc001, 0xc001) AM_WRITE(SMH_NOP) /* ? - probably clear IRQ */
- AM_RANGE(0xc002, 0xc002) AM_WRITE(sound_out1_w)
+ AM_RANGE(0xc002, 0xc002) AM_DEVWRITE(SOUND, "dac1", dac_w)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
ADDRESS_MAP_END
@@ -322,7 +310,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem_sound2_m660, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc001, 0xc001) AM_WRITE(SMH_NOP) /* ? - probably clear IRQ */
- AM_RANGE(0xc002, 0xc002) AM_WRITE(sound_out2_w)
+ AM_RANGE(0xc002, 0xc002) AM_DEVWRITE(SOUND, "dac2", dac_w)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
ADDRESS_MAP_END
@@ -330,8 +318,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound3_m660_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( readmem_sound3_m660, ADDRESS_SPACE_PROGRAM, 8 )
@@ -430,7 +417,7 @@ static ADDRESS_MAP_START( writemem_sound_vsgongf, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x6000, 0x63ff) AM_WRITE(SMH_RAM) /* work RAM */
AM_RANGE(0x8000, 0x8000) AM_WRITE(vsgongf_sound_nmi_enable_w) /* NMI enable */
- AM_RANGE(0xa000, 0xa000) AM_WRITE(sound_out1_w)
+ AM_RANGE(0xa000, 0xa000) AM_DEVWRITE(SOUND, "dac", dac_w)
ADDRESS_MAP_END
/*******************************************************************************/
diff --git a/src/mame/drivers/tubep.c b/src/mame/drivers/tubep.c
index 91e18151db4..1661d2f848f 100644
--- a/src/mame/drivers/tubep.c
+++ b/src/mame/drivers/tubep.c
@@ -259,12 +259,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( tubep_sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x02, 0x02) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x03, 0x03) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x04, 0x04) AM_WRITE(ay8910_control_port_2_w)
- AM_RANGE(0x05, 0x05) AM_WRITE(ay8910_write_port_2_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x02, 0x03) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x04, 0x05) AM_DEVWRITE(SOUND, "ay3", ay8910_address_data_w)
AM_RANGE(0x06, 0x06) AM_READ(tubep_soundlatch_r)
AM_RANGE(0x07, 0x07) AM_WRITE(tubep_sound_unknown)
ADDRESS_MAP_END
@@ -542,24 +539,24 @@ static READ8_HANDLER( rjammer_soundlatch_r )
}
-static WRITE8_HANDLER( rjammer_voice_startstop_w )
+static WRITE8_DEVICE_HANDLER( rjammer_voice_startstop_w )
{
/* bit 0 of data selects voice start/stop (reset pin on MSM5205)*/
// 0 -stop; 1-start
- msm5205_reset_w (0, (data&1)^1 );
+ msm5205_reset_w (device, (data&1)^1 );
return;
}
-static WRITE8_HANDLER( rjammer_voice_frequency_select_w )
+static WRITE8_DEVICE_HANDLER( rjammer_voice_frequency_select_w )
{
/* bit 0 of data selects voice frequency on MSM5205 */
// 0 -4 KHz; 1- 8KHz
if (data&1)
- msm5205_playmode_w(0,MSM5205_S48_4B); /* 8 KHz */
+ msm5205_playmode_w(device,MSM5205_S48_4B); /* 8 KHz */
else
- msm5205_playmode_w(0,MSM5205_S96_4B); /* 4 KHz */
+ msm5205_playmode_w(device,MSM5205_S96_4B); /* 4 KHz */
return;
}
@@ -571,12 +568,12 @@ static void rjammer_adpcm_vck (const device_config *device)
if (ls74==1)
{
- msm5205_data_w(0, (ls377>>0) & 15 );
+ msm5205_data_w(device, (ls377>>0) & 15 );
cpu_set_input_line(device->machine->cpu[2], 0, ASSERT_LINE );
}
else
{
- msm5205_data_w(0, (ls377>>4) & 15 );
+ msm5205_data_w(device, (ls377>>4) & 15 );
}
}
@@ -616,40 +613,37 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( rjammer_sound_portmap, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_READ(rjammer_soundlatch_r)
- AM_RANGE(0x10, 0x10) AM_WRITE(rjammer_voice_startstop_w)
- AM_RANGE(0x18, 0x18) AM_WRITE(rjammer_voice_frequency_select_w)
+ AM_RANGE(0x10, 0x10) AM_DEVWRITE(SOUND, "msm", rjammer_voice_startstop_w)
+ AM_RANGE(0x18, 0x18) AM_DEVWRITE(SOUND, "msm", rjammer_voice_frequency_select_w)
AM_RANGE(0x80, 0x80) AM_WRITE(rjammer_voice_input_w)
- AM_RANGE(0x90, 0x90) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x91, 0x91) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x92, 0x92) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0x93, 0x93) AM_WRITE(ay8910_write_port_1_w)
- AM_RANGE(0x94, 0x94) AM_WRITE(ay8910_control_port_2_w)
- AM_RANGE(0x95, 0x95) AM_WRITE(ay8910_write_port_2_w)
+ AM_RANGE(0x90, 0x91) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0x92, 0x93) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
+ AM_RANGE(0x94, 0x95) AM_DEVWRITE(SOUND, "ay3", ay8910_address_data_w)
AM_RANGE(0x96, 0x96) AM_WRITE(rjammer_voice_intensity_control_w)
ADDRESS_MAP_END
-static WRITE8_HANDLER( ay8910_portA_0_w )
+static WRITE8_DEVICE_HANDLER( ay8910_portA_0_w )
{
//analog sound control
}
-static WRITE8_HANDLER( ay8910_portB_0_w )
+static WRITE8_DEVICE_HANDLER( ay8910_portB_0_w )
{
//analog sound control
}
-static WRITE8_HANDLER( ay8910_portA_1_w )
+static WRITE8_DEVICE_HANDLER( ay8910_portA_1_w )
{
//analog sound control
}
-static WRITE8_HANDLER( ay8910_portB_1_w )
+static WRITE8_DEVICE_HANDLER( ay8910_portB_1_w )
{
//analog sound control
}
-static WRITE8_HANDLER( ay8910_portA_2_w )
+static WRITE8_DEVICE_HANDLER( ay8910_portA_2_w )
{
//analog sound control
}
-static WRITE8_HANDLER( ay8910_portB_2_w )
+static WRITE8_DEVICE_HANDLER( ay8910_portB_2_w )
{
//analog sound control
}
@@ -860,30 +854,30 @@ static const ay8910_interface ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- ay8910_portA_0_w, /* write port A */
- ay8910_portB_0_w /* write port B */
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(ay8910_portA_0_w), /* write port A */
+ DEVCB_HANDLER(ay8910_portB_0_w) /* write port B */
};
static const ay8910_interface ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- ay8910_portA_1_w, /* write port A */
- ay8910_portB_1_w /* write port B */
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(ay8910_portA_1_w), /* write port A */
+ DEVCB_HANDLER(ay8910_portB_1_w) /* write port B */
};
static const ay8910_interface ay8910_interface_3 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- ay8910_portA_2_w, /* write port A */
- ay8910_portB_2_w /* write port B */
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(ay8910_portA_2_w), /* write port A */
+ DEVCB_HANDLER(ay8910_portB_2_w) /* write port B */
};
static const msm5205_interface msm5205_config =
diff --git a/src/mame/drivers/tugboat.c b/src/mame/drivers/tugboat.c
index bd54e5be4fc..c43ecc99151 100644
--- a/src/mame/drivers/tugboat.c
+++ b/src/mame/drivers/tugboat.c
@@ -187,8 +187,7 @@ static MACHINE_RESET( tugboat )
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x01ff) AM_RAM AM_BASE(&tugboat_ram)
- AM_RANGE(0x1060, 0x1060) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x1061, 0x1061) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x1060, 0x1061) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
AM_RANGE(0x10a0, 0x10a1) AM_WRITE(tugboat_hd46505_0_w) /* scrolling is performed changing the start_addr register (0C/0D) */
AM_RANGE(0x10c0, 0x10c1) AM_WRITE(tugboat_hd46505_1_w)
AM_RANGE(0x11e4, 0x11e7) AM_READWRITE(pia_0_r, pia_0_w)
diff --git a/src/mame/drivers/tumbleb.c b/src/mame/drivers/tumbleb.c
index 72d6cf2b215..7c26fed049b 100644
--- a/src/mame/drivers/tumbleb.c
+++ b/src/mame/drivers/tumbleb.c
@@ -328,16 +328,16 @@ UINT16* suprtrio_control;
/******************************************************************************/
-static WRITE16_HANDLER( tumblepb_oki_w )
+static WRITE16_DEVICE_HANDLER( tumblepb_oki_w )
{
if (mem_mask==0xffff)
{
- okim6295_data_0_w(space,0,data&0xff);
+ okim6295_w(device,0,data&0xff);
//printf("tumbleb_oki_w %04x %04x\n",data,mem_mask);
}
else
{
- okim6295_data_0_w(space,0,(data>>8)&0xff);
+ okim6295_w(device,0,(data>>8)&0xff);
//printf("tumbleb_oki_w %04x %04x\n",data,mem_mask);
}
/* STUFF IN OTHER BYTE TOO..*/
@@ -456,16 +456,16 @@ static int tumblep_music_command;
static int tumblep_music_bank;
static int tumbleb2_music_is_playing;
-static void tumbleb2_playmusic(const address_space *space)
+static void tumbleb2_playmusic(const device_config *device)
{
- int status = okim6295_status_0_r(space,0);
+ int status = okim6295_r(device,0);
if (tumbleb2_music_is_playing)
{
if ((status&0x08)==0x00)
{
- okim6295_data_0_w(space,0,0x80|tumblep_music_command);
- okim6295_data_0_w(space,0,0x00|0x82);
+ okim6295_w(device,0,0x80|tumblep_music_command);
+ okim6295_w(device,0,0x00|0x82);
}
}
}
@@ -474,7 +474,7 @@ static void tumbleb2_playmusic(const address_space *space)
static INTERRUPT_GEN( tumbleb2_interrupt )
{
cpu_set_input_line(device, 6, HOLD_LINE);
- tumbleb2_playmusic(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM));
+ tumbleb2_playmusic(devtag_get_device(device->machine, SOUND, "oki"));
}
static const int tumbleb_sound_lookup[256] = {
@@ -504,24 +504,24 @@ static void tumbleb2_set_music_bank(running_machine *machine, int bank)
memcpy(&oki[0x38000], &oki[0x80000+0x38000+0x8000*bank],0x8000);
}
-static void tumbleb2_play_sound (const address_space *space, int data)
+static void tumbleb2_play_sound (const device_config *device, int data)
{
- int status = okim6295_status_0_r(space,0);
+ int status = okim6295_r(device,0);
if ((status&0x01)==0x00)
{
- okim6295_data_0_w(space,0,0x80|data);
- okim6295_data_0_w(space,0,0x00|0x12);
+ okim6295_w(device,0,0x80|data);
+ okim6295_w(device,0,0x00|0x12);
}
else if ((status&0x02)==0x00)
{
- okim6295_data_0_w(space,0,0x80|data);
- okim6295_data_0_w(space,0,0x00|0x22);
+ okim6295_w(device,0,0x80|data);
+ okim6295_w(device,0,0x00|0x22);
}
else if ((status&0x04)==0x00)
{
- okim6295_data_0_w(space,0,0x80|data);
- okim6295_data_0_w(space,0,0x00|0x42);
+ okim6295_w(device,0,0x80|data);
+ okim6295_w(device,0,0x00|0x42);
}
}
@@ -537,15 +537,15 @@ static void tumbleb2_play_sound (const address_space *space, int data)
// bank 7 = how to play?
// bank 8 = boss???
-static void process_tumbleb2_music_command(const address_space *space, int data)
+static void process_tumbleb2_music_command(const device_config *device, int data)
{
- int status = okim6295_status_0_r(space,0);
+ int status = okim6295_r(device,0);
if (data == 1) // stop?
{
if ((status&0x08)==0x08)
{
- okim6295_data_0_w(space,0,0x40); /* Stop playing music */
+ okim6295_w(device,0,0x40); /* Stop playing music */
tumbleb2_music_is_playing = 0;
}
}
@@ -554,7 +554,7 @@ static void process_tumbleb2_music_command(const address_space *space, int data)
if (tumbleb2_music_is_playing != data)
{
tumbleb2_music_is_playing = data;
- okim6295_data_0_w(space,0,0x40); // stop the current music
+ okim6295_w(device,0,0x40); // stop the current music
switch (data)
{
case 0x04: // map screen
@@ -627,8 +627,8 @@ static void process_tumbleb2_music_command(const address_space *space, int data)
tumblep_music_command = 0x38;
break;
}
- tumbleb2_set_music_bank(space->machine, tumblep_music_bank);
- tumbleb2_playmusic(space);
+ tumbleb2_set_music_bank(device->machine, tumblep_music_bank);
+ tumbleb2_playmusic(device);
}
@@ -637,7 +637,7 @@ static void process_tumbleb2_music_command(const address_space *space, int data)
}
-static WRITE16_HANDLER(tumbleb2_soundmcu_w)
+static WRITE16_DEVICE_HANDLER( tumbleb2_soundmcu_w )
{
int sound;
@@ -650,11 +650,11 @@ static WRITE16_HANDLER(tumbleb2_soundmcu_w)
}
else if (sound == -2)
{
- process_tumbleb2_music_command(space, data);
+ process_tumbleb2_music_command(device, data);
}
else
{
- tumbleb2_play_sound(space, sound);
+ tumbleb2_play_sound(device, sound);
}
}
@@ -667,7 +667,7 @@ static ADDRESS_MAP_START( tumblepopb_main_map, ADDRESS_SPACE_PROGRAM, 16 )
#else
AM_RANGE(0x000000, 0x07ffff) AM_WRITE(SMH_ROM)
#endif
- AM_RANGE(0x100000, 0x100001) AM_READWRITE(tumblepb_prot_r, tumblepb_oki_w)
+ AM_RANGE(0x100000, 0x100001) AM_READ(tumblepb_prot_r) AM_DEVWRITE(SOUND, "oki", tumblepb_oki_w)
AM_RANGE(0x120000, 0x123fff) AM_RAM AM_BASE(&tumblepb_mainram)
AM_RANGE(0x140000, 0x1407ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE(&paletteram16)
AM_RANGE(0x160000, 0x1607ff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) /* Bootleg sprite buffer */
@@ -691,9 +691,8 @@ static ADDRESS_MAP_START( fncywld_main_map, ADDRESS_SPACE_PROGRAM, 16 )
#else
AM_RANGE(0x000000, 0x0fffff) AM_WRITE(SMH_ROM)
#endif
- AM_RANGE(0x100000, 0x100001) AM_READWRITE(ym2151_status_port_0_lsb_r, ym2151_register_port_0_lsb_w)
- AM_RANGE(0x100002, 0x100003) AM_READWRITE(SMH_NOP, ym2151_data_port_0_lsb_w)
- AM_RANGE(0x100004, 0x100005) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w)
+ AM_RANGE(0x100000, 0x100003) AM_DEVREADWRITE8(SOUND, "ym", ym2151_r, ym2151_w, 0x00ff)
+ AM_RANGE(0x100004, 0x100005) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff)
AM_RANGE(0x140000, 0x140fff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_BASE(&paletteram16)
AM_RANGE(0x160000, 0x1607ff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) /* sprites */
AM_RANGE(0x160800, 0x16080f) AM_WRITE(SMH_RAM) /* goes slightly past the end of spriteram? */
@@ -786,20 +785,6 @@ ADDRESS_MAP_END
/******************************************************************************/
-#ifdef UNUSED_FUNCTION
-static WRITE8_HANDLER( YM2151_w )
-{
- switch (offset) {
- case 0:
- ym2151_register_port_0_w(0,data);
- break;
- case 1:
- ym2151_data_port_0_w(0,data);
- break;
- }
-}
-#endif
-
static WRITE16_HANDLER( semicom_soundcmd_w )
{
if (ACCESSING_BITS_0_7)
@@ -821,9 +806,17 @@ static WRITE8_HANDLER( oki_sound_bank_w )
static ADDRESS_MAP_START( semicom_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xcfff) AM_ROM
AM_RANGE(0xd000, 0xd7ff) AM_RAM
- AM_RANGE(0xf000, 0xf000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xf001, 0xf001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
- AM_RANGE(0xf002, 0xf002) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0xf000, 0xf001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0xf002, 0xf002) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
+// AM_RANGE(0xf006, 0xf006) ??
+ AM_RANGE(0xf008, 0xf008) AM_READ(soundlatch_r)
+ AM_RANGE(0xf00e, 0xf00e) AM_WRITE(oki_sound_bank_w)
+ADDRESS_MAP_END
+
+static ADDRESS_MAP_START( suprtrio_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
+ AM_RANGE(0x0000, 0xcfff) AM_ROM
+ AM_RANGE(0xd000, 0xd7ff) AM_RAM
+ AM_RANGE(0xf002, 0xf002) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
// AM_RANGE(0xf006, 0xf006) ??
AM_RANGE(0xf008, 0xf008) AM_READ(soundlatch_r)
AM_RANGE(0xf00e, 0xf00e) AM_WRITE(oki_sound_bank_w)
@@ -848,9 +841,8 @@ static READ8_HANDLER(jumppop_z80latch_r)
static ADDRESS_MAP_START( jumppop_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym3812_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym3812_write_port_0_w)
- AM_RANGE(0x02, 0x02) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ym", ym3812_w)
+ AM_RANGE(0x02, 0x02) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0x03, 0x03) AM_READ(jumppop_z80latch_r)
AM_RANGE(0x04, 0x04) AM_NOP
AM_RANGE(0x05, 0x05) AM_WRITE(jumppop_z80_bank_w)
@@ -891,7 +883,7 @@ static ADDRESS_MAP_START( jumpkids_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
AM_RANGE(0x9000, 0x9000) AM_WRITE(jumpkids_oki_bank_w)
- AM_RANGE(0x9800, 0x9800) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -2127,9 +2119,9 @@ MACHINE_DRIVER_END
-static void semicom_irqhandler(running_machine *machine, int irq)
+static void semicom_irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
@@ -2178,7 +2170,7 @@ static MACHINE_DRIVER_START( htchctch )
/* sound hardware - same as hyperpac */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("ym2151", YM2151, 3427190)
+ MDRV_SOUND_ADD("ym", YM2151, 3427190)
MDRV_SOUND_CONFIG(semicom_ym2151_interface)
MDRV_SOUND_ROUTE(0, "left", 0.10)
MDRV_SOUND_ROUTE(1, "right", 0.10)
@@ -2198,7 +2190,7 @@ static MACHINE_DRIVER_START( bcstory )
MDRV_IMPORT_FROM(htchctch)
MDRV_VIDEO_UPDATE( bcstory )
- MDRV_SOUND_REPLACE("ym2151", YM2151, 3427190)
+ MDRV_SOUND_REPLACE("ym", YM2151, 3427190)
MDRV_SOUND_CONFIG(semicom_ym2151_interface)
MDRV_SOUND_ROUTE(0, "left", 0.10)
MDRV_SOUND_ROUTE(1, "right", 0.10)
@@ -2219,7 +2211,7 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( metlsavr )
MDRV_IMPORT_FROM(cookbib)
- MDRV_SOUND_REPLACE("ym2151", YM2151, 3427190)
+ MDRV_SOUND_REPLACE("ym", YM2151, 3427190)
MDRV_SOUND_CONFIG(semicom_ym2151_interface)
MDRV_SOUND_ROUTE(0, "left", 0.10)
MDRV_SOUND_ROUTE(1, "right", 0.10)
@@ -2270,7 +2262,7 @@ static MACHINE_DRIVER_START( suprtrio )
MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
MDRV_CPU_ADD("audio", Z80, 8000000)
- MDRV_CPU_PROGRAM_MAP(semicom_sound_map,0)
+ MDRV_CPU_PROGRAM_MAP(suprtrio_sound_map,0)
/* video hardware */
MDRV_SCREEN_ADD("main", RASTER)
@@ -3292,13 +3284,15 @@ static DRIVER_INIT( tumblepb )
static DRIVER_INIT( tumbleb2 )
{
+ const device_config *oki = devtag_get_device(machine, SOUND, "oki");
+
tumblepb_gfx1_rearrange(machine);
#if TUMBLEP_HACK
tumblepb_patch_code(machine, 0x000132);
#endif
- memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x100000, 0x100001, 0, 0, tumbleb2_soundmcu_w );
+ memory_install_write16_device_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), oki, 0x100000, 0x100001, 0, 0, tumbleb2_soundmcu_w );
}
diff --git a/src/mame/drivers/tumblep.c b/src/mame/drivers/tumblep.c
index 4fc4268e3d3..dbee8b42023 100644
--- a/src/mame/drivers/tumblep.c
+++ b/src/mame/drivers/tumblep.c
@@ -58,9 +58,9 @@ extern UINT16 *tumblep_pf1_data,*tumblep_pf2_data;
/******************************************************************************/
#ifdef UNUSED_FUNCTION
-static WRITE16_HANDLER( tumblep_oki_w )
+static WRITE16_DEVICE_HANDLER( tumblep_oki_w )
{
- okim6295_data_0_w(0,data&0xff);
+ okim6295_w(0,data&0xff);
/* STUFF IN OTHER BYTE TOO..*/
}
@@ -128,24 +128,12 @@ ADDRESS_MAP_END
/******************************************************************************/
-static WRITE8_HANDLER( YM2151_w )
-{
- switch (offset) {
- case 0:
- ym2151_register_port_0_w(space,0,data);
- break;
- case 1:
- ym2151_data_port_0_w(space,0,data);
- break;
- }
-}
-
/* Physical memory map (21 bits) */
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_ROM
AM_RANGE(0x100000, 0x100001) AM_NOP /* YM2203 - this board doesn't have one */
- AM_RANGE(0x110000, 0x110001) AM_READWRITE(ym2151_status_port_0_r, YM2151_w)
- AM_RANGE(0x120000, 0x120001) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x110000, 0x110001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0x130000, 0x130001) AM_NOP /* This board only has 1 oki chip */
AM_RANGE(0x140000, 0x140001) AM_READ(soundlatch_r)
AM_RANGE(0x1f0000, 0x1f1fff) AM_READWRITE(SMH_BANK8, SMH_BANK8)
@@ -286,9 +274,9 @@ GFXDECODE_END
/***************************************************************************/
-static void sound_irq(running_machine *machine, int state)
+static void sound_irq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1],1,state); /* IRQ 2 */
+ cpu_set_input_line(device->machine->cpu[1],1,state); /* IRQ 2 */
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/tunhunt.c b/src/mame/drivers/tunhunt.c
index 20520ce03a2..8050e71205b 100644
--- a/src/mame/drivers/tunhunt.c
+++ b/src/mame/drivers/tunhunt.c
@@ -103,39 +103,33 @@ static READ8_HANDLER( tunhunt_button_r )
}
-static READ8_HANDLER( dsw1_r )
+static READ8_DEVICE_HANDLER( dsw2_0r )
{
- return input_port_read(space->machine, "DSW")&0xff;
+ return (input_port_read(device->machine, "DSW")&0x0100)?0x80:0x00;
}
-static READ8_HANDLER( dsw2_0r )
+static READ8_DEVICE_HANDLER( dsw2_1r )
{
- return (input_port_read(space->machine, "DSW")&0x0100)?0x80:0x00;
+ return (input_port_read(device->machine, "DSW")&0x0200)?0x80:0x00;
}
-static READ8_HANDLER( dsw2_1r )
+static READ8_DEVICE_HANDLER( dsw2_2r )
{
- return (input_port_read(space->machine, "DSW")&0x0200)?0x80:0x00;
+ return (input_port_read(device->machine, "DSW")&0x0400)?0x80:0x00;
}
-static READ8_HANDLER( dsw2_2r )
+static READ8_DEVICE_HANDLER( dsw2_3r )
{
- return (input_port_read(space->machine, "DSW")&0x0400)?0x80:0x00;
+ return (input_port_read(device->machine, "DSW")&0x0800)?0x80:0x00;
}
-static READ8_HANDLER( dsw2_3r )
+static READ8_DEVICE_HANDLER( dsw2_4r )
{
- return (input_port_read(space->machine, "DSW")&0x0800)?0x80:0x00;
-}
-
-
-static READ8_HANDLER( dsw2_4r )
-{
- return (input_port_read(space->machine, "DSW")&0x1000)?0x80:0x00;
+ return (input_port_read(device->machine, "DSW")&0x1000)?0x80:0x00;
}
@@ -161,8 +155,8 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x2400, 0x2400) AM_WRITE(SMH_NOP) /* INT ACK */
AM_RANGE(0x2800, 0x2800) AM_WRITE(tunhunt_control_w)
AM_RANGE(0x2c00, 0x2fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram)
- AM_RANGE(0x3000, 0x300f) AM_READWRITE(pokey1_r, pokey1_w)
- AM_RANGE(0x4000, 0x400f) AM_READWRITE(pokey2_r, pokey2_w)
+ AM_RANGE(0x3000, 0x300f) AM_DEVREADWRITE(SOUND, "pokey1", pokey_r, pokey_w)
+ AM_RANGE(0x4000, 0x400f) AM_DEVREADWRITE(SOUND, "pokey2", pokey_r, pokey_w)
AM_RANGE(0x5000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0xfffa, 0xffff) AM_READ(SMH_ROM)
AM_RANGE(0x5000, 0xffff) AM_WRITE(SMH_ROM)
@@ -291,13 +285,21 @@ GFXDECODE_END
static const pokey_interface pokey_interface_1 =
{
- { 0 },
- dsw1_r
+ { DEVCB_NULL },
+ DEVCB_INPUT_PORT("DSW")
};
static const pokey_interface pokey_interface_2 =
{
- { input_port_1_r,input_port_2_r,dsw2_0r,dsw2_1r,dsw2_2r,dsw2_3r,dsw2_4r }
+ {
+ DEVCB_INPUT_PORT("IN1"),
+ DEVCB_INPUT_PORT("IN2"),
+ DEVCB_HANDLER(dsw2_0r),
+ DEVCB_HANDLER(dsw2_1r),
+ DEVCB_HANDLER(dsw2_2r),
+ DEVCB_HANDLER(dsw2_3r),
+ DEVCB_HANDLER(dsw2_4r)
+ }
};
diff --git a/src/mame/drivers/twin16.c b/src/mame/drivers/twin16.c
index c786326758a..566a98f6b3a 100644
--- a/src/mame/drivers/twin16.c
+++ b/src/mame/drivers/twin16.c
@@ -224,10 +224,20 @@ static READ8_HANDLER( twin16_sres_r )
static WRITE8_HANDLER( twin16_sres_w )
{
/* bit 1 resets the UPD7795C sound chip */
- upd7759_reset_w(0, data & 0x02);
+ upd7759_reset_w(devtag_get_device(space->machine, SOUND, "upd"), data & 0x02);
twin16_soundlatch = data;
}
+static WRITE8_DEVICE_HANDLER( twin16_upd_start_w )
+{
+ upd7759_start_w(device, data & 1);
+}
+
+static READ8_DEVICE_HANDLER( twin16_upd_busy_r )
+{
+ return upd7759_busy_r(device) ? 1 : 0;
+}
+
static READ16_HANDLER( cuebrckj_nvram_r )
{
return cuebrckj_nvram[offset + (cuebrckj_nvram_bank * 0x400 / 2)];
@@ -250,12 +260,11 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0x8fff) AM_RAM
AM_RANGE(0x9000, 0x9000) AM_READWRITE(twin16_sres_r, twin16_sres_w)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
- AM_RANGE(0xb000, 0xb00d) AM_READWRITE(k007232_read_port_0_r, k007232_write_port_0_w)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xc001, 0xc001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
- AM_RANGE(0xd000, 0xd000) AM_WRITE(upd7759_0_port_w)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(upd7759_0_start_w)
- AM_RANGE(0xf000, 0xf000) AM_READWRITE(upd7759_0_busy_r, SMH_NOP) // ??? write ???
+ AM_RANGE(0xb000, 0xb00d) AM_DEVREADWRITE(SOUND, "konami", k007232_r, k007232_w)
+ AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0xd000, 0xd000) AM_DEVWRITE(SOUND, "upd", upd7759_port_w)
+ AM_RANGE(0xe000, 0xe000) AM_DEVWRITE(SOUND, "upd", twin16_upd_start_w)
+ AM_RANGE(0xf000, 0xf000) AM_DEVREAD(SOUND, "upd", twin16_upd_busy_r) AM_WRITENOP // ??? write ???
ADDRESS_MAP_END
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
@@ -867,10 +876,10 @@ GFXDECODE_END
/* Sound Interfaces */
-static void volume_callback(int v)
+static void volume_callback(const device_config *device, int v)
{
- k007232_set_volume(0,0,(v >> 4) * 0x11,0);
- k007232_set_volume(0,1,0,(v & 0x0f) * 0x11);
+ k007232_set_volume(device,0,(v >> 4) * 0x11,0);
+ k007232_set_volume(device,1,0,(v & 0x0f) * 0x11);
}
static const k007232_interface k007232_config =
diff --git a/src/mame/drivers/twincobr.c b/src/mame/drivers/twincobr.c
index d4fd41af7bf..80eaf2f9702 100644
--- a/src/mame/drivers/twincobr.c
+++ b/src/mame/drivers/twincobr.c
@@ -237,8 +237,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym3812_r, ym3812_w)
AM_RANGE(0x10, 0x10) AM_READ_PORT("SYSTEM") /* Twin Cobra - Coin/Start */
AM_RANGE(0x20, 0x20) AM_WRITE(twincobr_coin_w) /* Twin Cobra coin count-lockout */
AM_RANGE(0x40, 0x40) AM_READ_PORT("DSWA")
@@ -689,9 +688,9 @@ GFXDECODE_END
/* handler called by the 3812 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1],0,linestate);
+ cpu_set_input_line(device->machine->cpu[1],0,linestate);
}
static const ym3812_interface ym3812_config =
diff --git a/src/mame/drivers/twins.c b/src/mame/drivers/twins.c
index 999e9f47469..4c03fa5dbc8 100644
--- a/src/mame/drivers/twins.c
+++ b/src/mame/drivers/twins.c
@@ -85,8 +85,8 @@ static ADDRESS_MAP_START( twins_map, ADDRESS_SPACE_PROGRAM, 16 )
ADDRESS_MAP_END
static ADDRESS_MAP_START( twins_io, ADDRESS_SPACE_IO, 16 )
- AM_RANGE(0x0000, 0x0001) AM_WRITE(ay8910_control_port_0_lsb_w)
- AM_RANGE(0x0002, 0x0003) AM_READ(ay8910_read_port_0_lsb_r) AM_WRITE(ay8910_write_port_0_lsb_w)
+ AM_RANGE(0x0000, 0x0003) AM_DEVWRITE8(SOUND, "ay", ay8910_address_data_w, 0x00ff)
+ AM_RANGE(0x0002, 0x0003) AM_DEVREAD8(SOUND, "ay", ay8910_r, 0x00ff)
AM_RANGE(0x0004, 0x0005) AM_READWRITE(twins_port4_r, twins_port4_w)
AM_RANGE(0x0006, 0x0007) AM_WRITE(port6_pal0_w)
AM_RANGE(0x000e, 0x000f) AM_WRITE(porte_paloff0_w)
@@ -162,8 +162,8 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r,
- input_port_1_r
+ DEVCB_INPUT_PORT("P1"),
+ DEVCB_INPUT_PORT("P2")
};
static MACHINE_DRIVER_START( twins )
@@ -248,8 +248,8 @@ static ADDRESS_MAP_START( twinsa_io, ADDRESS_SPACE_IO, 16 )
AM_RANGE(0x0000, 0x0001) AM_READWRITE(twinsa_unk_r, porte_paloff0_w)
AM_RANGE(0x0002, 0x0003) AM_WRITE(porte_paloff0_w)
AM_RANGE(0x0004, 0x0005) AM_WRITE(twinsa_port4_w) // palette on this set
- AM_RANGE(0x0008, 0x0009) AM_WRITE(ay8910_control_port_0_lsb_w)
- AM_RANGE(0x0010, 0x0011) AM_READWRITE(ay8910_read_port_0_lsb_r, ay8910_write_port_0_lsb_w)
+ AM_RANGE(0x0008, 0x0009) AM_DEVWRITE8(SOUND, "ay", ay8910_address_w, 0x00ff)
+ AM_RANGE(0x0010, 0x0011) AM_DEVREADWRITE8(SOUND, "ay", ay8910_r, ay8910_data_w, 0x00ff)
AM_RANGE(0x0018, 0x0019) AM_READ(twins_port4_r) AM_WRITE(twins_port4_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/tx1.c b/src/mame/drivers/tx1.c
index dfe5aeeb8f4..03c1f90c83d 100644
--- a/src/mame/drivers/tx1.c
+++ b/src/mame/drivers/tx1.c
@@ -44,7 +44,6 @@
#include "cpu/z80/z80.h"
#include "cpu/i86/i86.h"
#include "sound/ay8910.h"
-#include "sound/custom.h"
#include "rendlay.h"
#include "tx1.h"
@@ -546,8 +545,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( tx1_sound_io, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x40, 0x40) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x41, 0x41) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x40, 0x41) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
ADDRESS_MAP_END
@@ -625,10 +623,10 @@ ADDRESS_MAP_END
/* Common */
static ADDRESS_MAP_START( buggyboy_sound_io, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x40, 0x40) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x41, 0x41) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x80, 0x80) AM_READWRITE(ay8910_read_port_1_r, ay8910_write_port_1_w)
- AM_RANGE(0x81, 0x81) AM_WRITE(ay8910_control_port_1_w)
+ AM_RANGE(0x40, 0x40) AM_DEVREAD(SOUND, "ym1", ay8910_r)
+ AM_RANGE(0x40, 0x41) AM_DEVWRITE(SOUND, "ym1", ay8910_data_address_w)
+ AM_RANGE(0x80, 0x80) AM_DEVREAD(SOUND, "ym2", ay8910_r)
+ AM_RANGE(0x80, 0x81) AM_DEVWRITE(SOUND, "ym2", ay8910_data_address_w)
ADDRESS_MAP_END
@@ -642,10 +640,10 @@ static const ay8910_interface tx1_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- tx1_ay8910_a_w,
- tx1_ay8910_b_w,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(tx1_ay8910_a_w),
+ DEVCB_HANDLER(tx1_ay8910_b_w),
};
@@ -653,20 +651,20 @@ static const ay8910_interface buggyboy_ym2149_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- bb_ym1_a_w,
- NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(bb_ym1_a_w),
+ DEVCB_NULL,
};
static const ay8910_interface buggyboy_ym2149_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- bb_ym2_a_w,
- bb_ym2_b_w,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(bb_ym2_a_w),
+ DEVCB_HANDLER(bb_ym2_b_w),
};
@@ -675,10 +673,10 @@ static const ay8910_interface buggybjr_ym2149_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_1_r,
- input_port_2_r,
- NULL,
- NULL,
+ DEVCB_INPUT_PORT("YM2149_IC19_A"),
+ DEVCB_INPUT_PORT("YM2149_IC19_B"),
+ DEVCB_NULL,
+ DEVCB_NULL,
};
/* YM2149 IC24 */
@@ -686,24 +684,10 @@ static const ay8910_interface buggybjr_ym2149_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- bb_ym2_a_w,
- bb_ym2_b_w,
-};
-
-static const custom_sound_interface tx1_custom_interface =
-{
- tx1_sh_start,
- NULL,
- tx1_sh_reset
-};
-
-static const custom_sound_interface bb_custom_interface =
-{
- buggyboy_sh_start,
- NULL,
- buggyboy_sh_reset
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(bb_ym2_a_w),
+ DEVCB_HANDLER(bb_ym2_b_w),
};
@@ -761,8 +745,7 @@ static MACHINE_DRIVER_START( tx1 )
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "frontleft", 0.1)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "frontright", 0.1)
- MDRV_SOUND_ADD("tx1", CUSTOM, 0)
- MDRV_SOUND_CONFIG(tx1_custom_interface)
+ MDRV_SOUND_ADD("tx1", TX1, 0)
MDRV_SOUND_ROUTE(0, "frontleft", 0.2)
MDRV_SOUND_ROUTE(1, "frontright", 0.2)
MACHINE_DRIVER_END
@@ -817,8 +800,7 @@ static MACHINE_DRIVER_START( buggyboy )
MDRV_SOUND_CONFIG(buggyboy_ym2149_interface_2)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "frontright", 0.15)
- MDRV_SOUND_ADD("buggyboy", CUSTOM, 0)
- MDRV_SOUND_CONFIG(bb_custom_interface)
+ MDRV_SOUND_ADD("buggyboy", BUGGYBOY, 0)
MDRV_SOUND_ROUTE(0, "frontleft", 0.2)
MDRV_SOUND_ROUTE(1, "frontright", 0.2)
MACHINE_DRIVER_END
@@ -869,8 +851,7 @@ static MACHINE_DRIVER_START( buggybjr )
MDRV_SOUND_CONFIG(buggybjr_ym2149_interface_2)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "frontright", 0.15)
- MDRV_SOUND_ADD("buggyboy", CUSTOM, 0)
- MDRV_SOUND_CONFIG(bb_custom_interface)
+ MDRV_SOUND_ADD("buggyboy", BUGGYBOY, 0)
MDRV_SOUND_ROUTE(0, "frontleft", 0.2)
MDRV_SOUND_ROUTE(1, "frontright", 0.2)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/uapce.c b/src/mame/drivers/uapce.c
index a39baab3736..246f72d7bb5 100644
--- a/src/mame/drivers/uapce.c
+++ b/src/mame/drivers/uapce.c
@@ -168,7 +168,7 @@ static ADDRESS_MAP_START( pce_mem , ADDRESS_SPACE_PROGRAM, 8)
AM_RANGE( 0x1F0000, 0x1F1FFF) AM_RAM AM_MIRROR(0x6000) AM_BASE( &pce_user_ram )
AM_RANGE( 0x1FE000, 0x1FE3FF) AM_READWRITE( vdc_0_r, vdc_0_w )
AM_RANGE( 0x1FE400, 0x1FE7FF) AM_READWRITE( vce_r, vce_w )
- AM_RANGE( 0x1FE800, 0x1FEBFF) AM_READWRITE( c6280_r, c6280_0_w )
+ AM_RANGE( 0x1FE800, 0x1FEBFF) AM_DEVREADWRITE( SOUND, "main", c6280_r, c6280_w )
AM_RANGE( 0x1FEC00, 0x1FEFFF) AM_READWRITE( h6280_timer_r, h6280_timer_w )
AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE( pce_joystick_r, pce_joystick_w )
AM_RANGE( 0x1FF400, 0x1FF7FF) AM_READWRITE( h6280_irq_status_r, h6280_irq_status_w )
@@ -206,7 +206,7 @@ static MACHINE_DRIVER_START( uapce )
MDRV_VIDEO_UPDATE( pce )
MDRV_SPEAKER_STANDARD_STEREO("left","right")
- MDRV_SOUND_ADD("huc", C6280, PCE_MAIN_CLOCK/6)
+ MDRV_SOUND_ADD("main", C6280, PCE_MAIN_CLOCK/6)
MDRV_SOUND_ROUTE(0, "left", 1.00)
MDRV_SOUND_ROUTE(1, "right", 1.00)
diff --git a/src/mame/drivers/ultraman.c b/src/mame/drivers/ultraman.c
index 7ac4cc89e2c..553b121f986 100644
--- a/src/mame/drivers/ultraman.c
+++ b/src/mame/drivers/ultraman.c
@@ -137,9 +137,8 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0xbfff) AM_RAM
AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_r) /* Sound latch read */
// AM_RANGE(0xd000, 0xd000) AM_WRITE(SMH_NOP) /* ??? */
- AM_RANGE(0xe000, 0xe000) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w) /* M6295 */
- AM_RANGE(0xf000, 0xf000) AM_WRITE(ym2151_register_port_0_w) /* YM2151 */
- AM_RANGE(0xf001, 0xf001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w) /* YM2151 */
+ AM_RANGE(0xe000, 0xe000) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w) /* M6295 */
+ AM_RANGE(0xf000, 0xf001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w) /* YM2151 */
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
diff --git a/src/mame/drivers/ultratnk.c b/src/mame/drivers/ultratnk.c
index 984a726d1b7..5bf3ef40474 100644
--- a/src/mame/drivers/ultratnk.c
+++ b/src/mame/drivers/ultratnk.c
@@ -128,21 +128,21 @@ static WRITE8_HANDLER( ultratnk_lockout_w )
}
-static WRITE8_HANDLER( ultratnk_fire_1_w )
+static WRITE8_DEVICE_HANDLER( ultratnk_fire_1_w )
{
- discrete_sound_w(space, ULTRATNK_FIRE_EN_1, offset & 1);
+ discrete_sound_w(device, ULTRATNK_FIRE_EN_1, offset & 1);
}
-static WRITE8_HANDLER( ultratnk_fire_2_w )
+static WRITE8_DEVICE_HANDLER( ultratnk_fire_2_w )
{
- discrete_sound_w(space, ULTRATNK_FIRE_EN_2, offset & 1);
+ discrete_sound_w(device, ULTRATNK_FIRE_EN_2, offset & 1);
}
-static WRITE8_HANDLER( ultratnk_attract_w )
+static WRITE8_DEVICE_HANDLER( ultratnk_attract_w )
{
- discrete_sound_w(space, ULTRATNK_ATTRACT_EN, data & 1);
+ discrete_sound_w(device, ULTRATNK_ATTRACT_EN, data & 1);
}
-static WRITE8_HANDLER( ultratnk_explosion_w )
+static WRITE8_DEVICE_HANDLER( ultratnk_explosion_w )
{
- discrete_sound_w(space, ULTRATNK_EXPLOSION_DATA, data & 15);
+ discrete_sound_w(device, ULTRATNK_EXPLOSION_DATA, data & 15);
}
@@ -162,16 +162,16 @@ static ADDRESS_MAP_START( ultratnk_cpu_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x2040, 0x2047) AM_MIRROR(0x718) AM_READ(ultratnk_collision_r)
AM_RANGE(0x2060, 0x2063) AM_MIRROR(0x71c) AM_READ(ultratnk_options_r)
- AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x71f) AM_WRITE(ultratnk_attract_w)
+ AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x71f) AM_DEVWRITE(SOUND, "discrete", ultratnk_attract_w)
AM_RANGE(0x2020, 0x2027) AM_MIRROR(0x718) AM_WRITE(ultratnk_collision_reset_w)
AM_RANGE(0x2040, 0x2041) AM_MIRROR(0x718) AM_WRITE(ultratnk_da_latch_w)
- AM_RANGE(0x2042, 0x2043) AM_MIRROR(0x718) AM_WRITE(ultratnk_explosion_w)
+ AM_RANGE(0x2042, 0x2043) AM_MIRROR(0x718) AM_DEVWRITE(SOUND, "discrete", ultratnk_explosion_w)
AM_RANGE(0x2044, 0x2045) AM_MIRROR(0x718) AM_WRITE(watchdog_reset_w)
AM_RANGE(0x2066, 0x2067) AM_MIRROR(0x710) AM_WRITE(ultratnk_lockout_w)
AM_RANGE(0x2068, 0x2069) AM_MIRROR(0x710) AM_WRITE(ultratnk_led_1_w)
AM_RANGE(0x206a, 0x206b) AM_MIRROR(0x710) AM_WRITE(ultratnk_led_2_w)
- AM_RANGE(0x206c, 0x206d) AM_MIRROR(0x710) AM_WRITE(ultratnk_fire_2_w)
- AM_RANGE(0x206e, 0x206f) AM_MIRROR(0x710) AM_WRITE(ultratnk_fire_1_w)
+ AM_RANGE(0x206c, 0x206d) AM_MIRROR(0x710) AM_DEVWRITE(SOUND, "discrete", ultratnk_fire_2_w)
+ AM_RANGE(0x206e, 0x206f) AM_MIRROR(0x710) AM_DEVWRITE(SOUND, "discrete", ultratnk_fire_1_w)
AM_RANGE(0x2800, 0x2fff) AM_NOP /* diagnostic ROM */
AM_RANGE(0x3000, 0x3fff) AM_ROM
diff --git a/src/mame/drivers/ultrsprt.c b/src/mame/drivers/ultrsprt.c
index 274ec963ee6..cbc52ce00ff 100644
--- a/src/mame/drivers/ultrsprt.c
+++ b/src/mame/drivers/ultrsprt.c
@@ -117,31 +117,6 @@ ADDRESS_MAP_END
/*****************************************************************************/
-static READ16_HANDLER( sound_r )
-{
- UINT16 r = 0;
- int reg = offset * 2;
-
- if (ACCESSING_BITS_8_15)
- r |= k054539_0_r(space, reg+0) << 8;
-
- if (ACCESSING_BITS_0_7)
- r |= k054539_0_r(space, reg+1) << 0;
-
- return r;
-}
-
-static WRITE16_HANDLER( sound_w )
-{
- int reg = offset * 2;
-
- if (ACCESSING_BITS_8_15)
- k054539_0_w(space, reg+0, (data >> 8) & 0xff);
-
- if (ACCESSING_BITS_0_7)
- k054539_0_w(space, reg+1, (data >> 0) & 0xff);
-}
-
static READ16_HANDLER( K056800_68k_r )
{
UINT16 r = 0;
@@ -169,7 +144,7 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x00100000, 0x00101fff) AM_RAM
AM_RANGE(0x00200000, 0x00200007) AM_WRITE(K056800_68k_w)
AM_RANGE(0x00200008, 0x0020000f) AM_READ(K056800_68k_r)
- AM_RANGE(0x00400000, 0x004002ff) AM_READWRITE(sound_r, sound_w)
+ AM_RANGE(0x00400000, 0x004002ff) AM_DEVREADWRITE8(SOUND, "konami", k054539_r, k054539_w, 0xffff)
ADDRESS_MAP_END
/*****************************************************************************/
diff --git a/src/mame/drivers/unico.c b/src/mame/drivers/unico.c
index 18bb15a89de..6197ac65ece 100644
--- a/src/mame/drivers/unico.c
+++ b/src/mame/drivers/unico.c
@@ -38,11 +38,6 @@ Year + Game PCB Notes
***************************************************************************/
-static READ16_HANDLER ( YM3812_status_port_0_msb_r ) { return ym3812_status_port_0_r(space,0) << 8; }
-static WRITE16_HANDLER( YM3812_register_port_0_msb_w ) { if (ACCESSING_BITS_8_15) ym3812_control_port_0_w(space,0,data >> 8); }
-static WRITE16_HANDLER( YM3812_data_port_0_msb_w ) { if (ACCESSING_BITS_8_15) ym3812_write_port_0_w(space,0,data >> 8); }
-
-
/*
Lines starting with an empty comment in the following MemoryReadAddress
arrays are there for debug (e.g. the game does not read from those ranges
@@ -53,12 +48,12 @@ static WRITE16_HANDLER( YM3812_data_port_0_msb_w ) { if (ACCESSING_BITS_8_15) y
Burglar X
***************************************************************************/
-static WRITE16_HANDLER( burglarx_sound_bank_w )
+static WRITE16_DEVICE_HANDLER( burglarx_sound_bank_w )
{
if (ACCESSING_BITS_8_15)
{
int bank = (data >> 8 ) & 1;
- okim6295_set_bank_base(0, 0x40000 * bank );
+ okim6295_set_bank_base(device, 0x40000 * bank );
}
}
@@ -69,8 +64,8 @@ static ADDRESS_MAP_START( readmem_burglarx, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x800018, 0x800019) AM_READ_PORT("SYSTEM")
AM_RANGE(0x80001a, 0x80001b) AM_READ_PORT("DSW1")
AM_RANGE(0x80001c, 0x80001d) AM_READ_PORT("DSW2")
- AM_RANGE(0x800188, 0x800189) AM_READ(okim6295_status_0_lsb_r ) // Sound
- AM_RANGE(0x80018c, 0x80018d) AM_READ(YM3812_status_port_0_msb_r ) //
+ AM_RANGE(0x800188, 0x800189) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff ) // Sound
+ AM_RANGE(0x80018c, 0x80018d) AM_DEVREAD8(SOUND, "ym", ym3812_r, 0xff00 )//
/**/AM_RANGE(0x904000, 0x907fff) AM_READ(SMH_RAM ) // Layers
/**/AM_RANGE(0x908000, 0x90bfff) AM_READ(SMH_RAM ) //
/**/AM_RANGE(0x90c000, 0x90ffff) AM_READ(SMH_RAM ) //
@@ -89,10 +84,9 @@ static ADDRESS_MAP_START( writemem_burglarx, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x800114, 0x800115) AM_WRITE(SMH_RAM) AM_BASE(&unico_scrollx_2 ) //
AM_RANGE(0x800116, 0x800117) AM_WRITE(SMH_RAM) AM_BASE(&unico_scrollx_1 ) //
AM_RANGE(0x800120, 0x800121) AM_WRITE(SMH_RAM) AM_BASE(&unico_scrolly_1 ) //
- AM_RANGE(0x800188, 0x800189) AM_WRITE(okim6295_data_0_lsb_w ) // Sound
- AM_RANGE(0x80018a, 0x80018b) AM_WRITE(YM3812_data_port_0_msb_w ) //
- AM_RANGE(0x80018c, 0x80018d) AM_WRITE(YM3812_register_port_0_msb_w ) //
- AM_RANGE(0x80018e, 0x80018f) AM_WRITE(burglarx_sound_bank_w ) //
+ AM_RANGE(0x800188, 0x800189) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff ) // Sound
+ AM_RANGE(0x80018a, 0x80018d) AM_DEVWRITE8(SOUND, "ym", ym3812_w, 0xff00 ) //
+ AM_RANGE(0x80018e, 0x80018f) AM_DEVWRITE(SOUND, "oki", burglarx_sound_bank_w ) //
AM_RANGE(0x8001e0, 0x8001e1) AM_WRITE(SMH_RAM ) // ? IRQ Ack
AM_RANGE(0x904000, 0x907fff) AM_WRITE(unico_vram_1_w) AM_BASE(&unico_vram_1 ) // Layers
AM_RANGE(0x908000, 0x90bfff) AM_WRITE(unico_vram_2_w) AM_BASE(&unico_vram_2 ) //
@@ -177,8 +171,8 @@ static ADDRESS_MAP_START( readmem_zeropnt, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x800174, 0x800175) AM_READ(unico_gunx_0_msb_r ) //
AM_RANGE(0x800178, 0x800179) AM_READ(unico_guny_1_msb_r ) //
AM_RANGE(0x80017c, 0x80017d) AM_READ(unico_gunx_1_msb_r ) //
- AM_RANGE(0x800188, 0x800189) AM_READ(okim6295_status_0_lsb_r ) // Sound
- AM_RANGE(0x80018c, 0x80018d) AM_READ(YM3812_status_port_0_msb_r ) //
+ AM_RANGE(0x800188, 0x800189) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff ) // Sound
+ AM_RANGE(0x80018c, 0x80018d) AM_DEVREAD8(SOUND, "ym", ym3812_status_port_r, 0xff00 ) //
/**/AM_RANGE(0x904000, 0x907fff) AM_READ(SMH_RAM ) // Layers
/**/AM_RANGE(0x908000, 0x90bfff) AM_READ(SMH_RAM ) //
/**/AM_RANGE(0x90c000, 0x90ffff) AM_READ(SMH_RAM ) //
@@ -197,9 +191,9 @@ static ADDRESS_MAP_START( writemem_zeropnt, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x800114, 0x800115) AM_WRITE(SMH_RAM) AM_BASE(&unico_scrollx_2 ) //
AM_RANGE(0x800116, 0x800117) AM_WRITE(SMH_RAM) AM_BASE(&unico_scrollx_1 ) //
AM_RANGE(0x800120, 0x800121) AM_WRITE(SMH_RAM) AM_BASE(&unico_scrolly_1 ) //
- AM_RANGE(0x800188, 0x800189) AM_WRITE(okim6295_data_0_lsb_w ) // Sound
- AM_RANGE(0x80018a, 0x80018b) AM_WRITE(YM3812_data_port_0_msb_w ) //
- AM_RANGE(0x80018c, 0x80018d) AM_WRITE(YM3812_register_port_0_msb_w ) //
+ AM_RANGE(0x800188, 0x800189) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff ) // Sound
+ AM_RANGE(0x80018a, 0x80018b) AM_DEVWRITE8(SOUND, "ym", ym3812_write_port_w, 0xff00 ) //
+ AM_RANGE(0x80018c, 0x80018d) AM_DEVWRITE8(SOUND, "ym", ym3812_control_port_w, 0xff00 ) //
AM_RANGE(0x80018e, 0x80018f) AM_WRITE(zeropnt_sound_bank_w ) //
AM_RANGE(0x8001e0, 0x8001e1) AM_WRITE(SMH_RAM ) // ? IRQ Ack
AM_RANGE(0x904000, 0x907fff) AM_WRITE(unico_vram_1_w) AM_BASE(&unico_vram_1 ) // Layers
@@ -220,15 +214,6 @@ static READ32_HANDLER( zeropnt2_guny_0_msb_r ) { return (unico_guny_0_msb_r(spa
static READ32_HANDLER( zeropnt2_gunx_1_msb_r ) { return (unico_gunx_1_msb_r(space,0,0xffff)-0x0800) << 16; }
static READ32_HANDLER( zeropnt2_guny_1_msb_r ) { return (unico_guny_1_msb_r(space,0,0xffff)+0x0800) << 16; }
-static READ32_HANDLER ( zeropnt2_oki0_r ) { return okim6295_status_0_r(space,0) << 16; }
-static READ32_HANDLER ( zeropnt2_oki1_r ) { return okim6295_status_1_r(space,0) << 16; }
-static WRITE32_HANDLER( zeropnt2_oki0_w ) { if (ACCESSING_BITS_16_23) okim6295_data_0_w(space,0,(data >> 16) & 0xff); }
-static WRITE32_HANDLER( zeropnt2_oki1_w ) { if (ACCESSING_BITS_16_23) okim6295_data_1_w(space,0,(data >> 16) & 0xff); }
-
-static READ32_HANDLER( zeropnt2_ym2151_status_r ) { return ym2151_status_port_0_r(space,0) << 16; }
-static WRITE32_HANDLER( zeropnt2_ym2151_reg_w ) { if (ACCESSING_BITS_16_23) ym2151_register_port_0_w(space,0,(data >> 16) & 0xff); }
-static WRITE32_HANDLER( zeropnt2_ym2151_data_w ) { if (ACCESSING_BITS_16_23) ym2151_data_port_0_w(space,0,(data >> 16) & 0xff); }
-
static WRITE32_HANDLER( zeropnt2_sound_bank_w )
{
if (ACCESSING_BITS_24_31)
@@ -271,9 +256,9 @@ static WRITE32_HANDLER( zeropnt2_eeprom_w )
static ADDRESS_MAP_START( readmem_zeropnt2, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x000000, 0x1fffff) AM_READ(SMH_ROM ) // ROM
AM_RANGE(0x800018, 0x80001b) AM_READ_PORT("SYSTEM")
- AM_RANGE(0x800024, 0x800027) AM_READ(zeropnt2_oki0_r ) // Sound
- AM_RANGE(0x80002c, 0x80002f) AM_READ(zeropnt2_ym2151_status_r ) //
- AM_RANGE(0x800030, 0x800033) AM_READ(zeropnt2_oki1_r ) //
+ AM_RANGE(0x800024, 0x800027) AM_DEVREAD8(SOUND, "oki1", okim6295_r, 0x00ff0000 ) // Sound
+ AM_RANGE(0x800028, 0x80002f) AM_DEVREAD8(SOUND, "ym", ym2151_r, 0x00ff0000 ) //
+ AM_RANGE(0x800030, 0x800033) AM_DEVREAD8(SOUND, "oki2", okim6295_r, 0x00ff0000 ) //
AM_RANGE(0x800140, 0x800143) AM_READ(zeropnt2_guny_0_msb_r ) // Light Guns
AM_RANGE(0x800144, 0x800147) AM_READ(zeropnt2_gunx_0_msb_r ) //
AM_RANGE(0x800148, 0x80014b) AM_READ(zeropnt2_guny_1_msb_r ) //
@@ -292,10 +277,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem_zeropnt2, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x000000, 0x1fffff) AM_WRITE(SMH_ROM ) // ROM
- AM_RANGE(0x800024, 0x800027) AM_WRITE(zeropnt2_oki0_w ) // Sound
- AM_RANGE(0x800028, 0x80002b) AM_WRITE(zeropnt2_ym2151_reg_w ) //
- AM_RANGE(0x80002c, 0x80002f) AM_WRITE(zeropnt2_ym2151_data_w ) //
- AM_RANGE(0x800030, 0x800033) AM_WRITE(zeropnt2_oki1_w ) //
+ AM_RANGE(0x800024, 0x800027) AM_DEVWRITE8(SOUND, "oki1", okim6295_w, 0x00ff0000 ) // Sound
+ AM_RANGE(0x800028, 0x80002f) AM_DEVWRITE8(SOUND, "ym", ym2151_w, 0x00ff0000) //
+ AM_RANGE(0x800030, 0x800033) AM_DEVWRITE8(SOUND, "oki2", okim6295_w, 0x00ff0000 ) //
AM_RANGE(0x800034, 0x800037) AM_WRITE(zeropnt2_sound_bank_w ) //
AM_RANGE(0x800038, 0x80003b) AM_WRITE(zeropnt2_leds_w ) // ?
AM_RANGE(0x80010c, 0x800123) AM_WRITE(SMH_RAM) AM_BASE(&unico_scroll32 ) // Scroll
diff --git a/src/mame/drivers/upscope.c b/src/mame/drivers/upscope.c
index 54fc0b606f4..128d95f39c4 100644
--- a/src/mame/drivers/upscope.c
+++ b/src/mame/drivers/upscope.c
@@ -270,19 +270,6 @@ INPUT_PORTS_END
/*************************************
*
- * Sound definitions
- *
- *************************************/
-
-static const custom_sound_interface amiga_custom_interface =
-{
- amiga_sh_start
-};
-
-
-
-/*************************************
- *
* Machine driver
*
*************************************/
@@ -335,8 +322,7 @@ static MACHINE_DRIVER_START( upscope )
/* sound hardware */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
- MDRV_SOUND_ADD("amiga", CUSTOM, 3579545)
- MDRV_SOUND_CONFIG(amiga_custom_interface)
+ MDRV_SOUND_ADD("amiga", AMIGA, 3579545)
MDRV_SOUND_ROUTE(0, "right", 0.50)
MDRV_SOUND_ROUTE(1, "left", 0.50)
MDRV_SOUND_ROUTE(2, "left", 0.50)
diff --git a/src/mame/drivers/usgames.c b/src/mame/drivers/usgames.c
index 113731a66bd..5686fd4a5c7 100644
--- a/src/mame/drivers/usgames.c
+++ b/src/mame/drivers/usgames.c
@@ -80,8 +80,7 @@ static ADDRESS_MAP_START( usgames_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x2041, 0x2041) AM_DEVWRITE(MC6845, "crtc", mc6845_register_w)
AM_RANGE(0x2060, 0x2060) AM_WRITE(usgames_rombank_w)
AM_RANGE(0x2070, 0x2070) AM_READ_PORT("UNK2")
- AM_RANGE(0x2400, 0x2400) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x2401, 0x2401) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x2400, 0x2401) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(usgames_charram_w) AM_BASE(&usgames_charram)
AM_RANGE(0x3000, 0x3fff) AM_RAM_WRITE(usgames_videoram_w) AM_BASE(&usgames_videoram)
AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK1, SMH_ROM)
@@ -91,8 +90,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( usg185_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
- AM_RANGE(0x2000, 0x2000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x2001, 0x2001) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x2000, 0x2001) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
AM_RANGE(0x2400, 0x2400) AM_READ_PORT("DSW")
AM_RANGE(0x2410, 0x2410) AM_READ_PORT("INPUTS")
AM_RANGE(0x2420, 0x2420) AM_WRITE(lamps1_w)
diff --git a/src/mame/drivers/vamphalf.c b/src/mame/drivers/vamphalf.c
index d8e8d14f796..42db4cc4f36 100644
--- a/src/mame/drivers/vamphalf.c
+++ b/src/mame/drivers/vamphalf.c
@@ -43,74 +43,18 @@ static UINT16 semicom_prot_data[2];
static UINT16 finalgdr_backupram_bank = 1;
static UINT8 *finalgdr_backupram;
-static READ16_HANDLER( oki_r )
+static READ16_DEVICE_HANDLER( oki_r )
{
if(offset)
- return okim6295_status_0_r(space, 0);
+ return okim6295_r(device, 0);
else
return 0;
}
-static WRITE16_HANDLER( oki_w )
+static WRITE16_DEVICE_HANDLER( oki_w )
{
if(offset)
- okim6295_data_0_w(space, 0, data);
-}
-
-static READ32_HANDLER( oki32_r )
-{
- return okim6295_status_0_r(space, 0) << 8;
-}
-
-static WRITE32_HANDLER( oki32_w )
-{
- okim6295_data_0_w(space, 0, (data >> 8) & 0xff);
-}
-
-static READ32_HANDLER( oki32_2_r )
-{
- return okim6295_status_1_r(space, 0) << 8;
-}
-
-static WRITE32_HANDLER( oki32_2_w )
-{
- okim6295_data_1_w(space, 0, (data >> 8) & 0xff);
-}
-
-
-static READ16_HANDLER( ym2151_status_r )
-{
- if(offset)
- return ym2151_status_port_0_r(space, 0);
- else
- return 0;
-}
-
-static WRITE16_HANDLER( ym2151_data_w )
-{
- if(offset)
- ym2151_data_port_0_w(space, 0, data);
-}
-
-static WRITE16_HANDLER( ym2151_register_w )
-{
- if(offset)
- ym2151_register_port_0_w(space, 0, data);
-}
-
-static READ32_HANDLER( ym2151_status32_r )
-{
- return ym2151_status_port_0_r(space, 0) << 8;
-}
-
-static WRITE32_HANDLER( ym2151_data32_w )
-{
- ym2151_data_port_0_w(space, 0, (data >> 8) & 0xff);
-}
-
-static WRITE32_HANDLER( ym2151_register32_w )
-{
- ym2151_register_port_0_w(space, 0, (data >> 8) & 0xff);
+ okim6295_w(device, 0, data);
}
static READ16_HANDLER( eeprom_r )
@@ -210,9 +154,9 @@ F94B
semicom_prot_idx = 8;
}
-static WRITE32_HANDLER( finalgdr_oki_bank_w )
+static WRITE32_DEVICE_HANDLER( finalgdr_oki_bank_w )
{
- okim6295_set_bank_base(0, 0x40000 * ((data & 0x300) >> 8));
+ okim6295_set_bank_base(device, 0x40000 * ((data & 0x300) >> 8));
}
static WRITE32_HANDLER( finalgdr_backupram_bank_w )
@@ -248,9 +192,9 @@ static WRITE32_HANDLER( finalgdr_prize_w )
}
}
-static WRITE32_HANDLER( aoh_oki_2_bank_w )
+static WRITE32_DEVICE_HANDLER( aoh_oki_bank_w )
{
- okim6295_set_bank_base(1, 0x40000 * (data & 0x3));
+ okim6295_set_bank_base(device, 0x40000 * (data & 0x3));
}
static ADDRESS_MAP_START( common_map, ADDRESS_SPACE_PROGRAM, 16 )
@@ -268,9 +212,9 @@ static ADDRESS_MAP_START( common_32bit_map, ADDRESS_SPACE_PROGRAM, 32 )
ADDRESS_MAP_END
static ADDRESS_MAP_START( vamphalf_io, ADDRESS_SPACE_IO, 16 )
- AM_RANGE(0x0c0, 0x0c3) AM_READWRITE(oki_r, oki_w)
- AM_RANGE(0x140, 0x143) AM_WRITE(ym2151_register_w)
- AM_RANGE(0x144, 0x147) AM_READWRITE(ym2151_status_r, ym2151_data_w)
+ AM_RANGE(0x0c0, 0x0c3) AM_DEVREADWRITE(SOUND, "oki", oki_r, oki_w)
+ AM_RANGE(0x140, 0x143) AM_DEVWRITE8(SOUND, "ym", ym2151_register_port_w, 0x00ff)
+ AM_RANGE(0x146, 0x147) AM_DEVREADWRITE8(SOUND, "ym", ym2151_status_port_r, ym2151_data_port_w, 0x00ff)
AM_RANGE(0x1c0, 0x1c3) AM_READ(eeprom_r)
AM_RANGE(0x240, 0x243) AM_WRITE(flipscreen_w)
AM_RANGE(0x600, 0x603) AM_READ_PORT("SYSTEM")
@@ -291,9 +235,9 @@ static ADDRESS_MAP_START( coolmini_io, ADDRESS_SPACE_IO, 16 )
AM_RANGE(0x300, 0x303) AM_READ_PORT("SYSTEM")
AM_RANGE(0x304, 0x307) AM_READ_PORT("P1_P2")
AM_RANGE(0x308, 0x30b) AM_WRITE(eeprom_w)
- AM_RANGE(0x4c0, 0x4c3) AM_READWRITE(oki_r, oki_w)
- AM_RANGE(0x540, 0x543) AM_WRITE(ym2151_register_w)
- AM_RANGE(0x544, 0x547) AM_READWRITE(ym2151_status_r, ym2151_data_w)
+ AM_RANGE(0x4c0, 0x4c3) AM_DEVREADWRITE(SOUND, "oki", oki_r, oki_w)
+ AM_RANGE(0x540, 0x543) AM_DEVWRITE8(SOUND, "ym", ym2151_register_port_w, 0x00ff)
+ AM_RANGE(0x546, 0x547) AM_DEVREADWRITE8(SOUND, "ym", ym2151_status_port_r, ym2151_data_port_w, 0x00ff)
AM_RANGE(0x7c0, 0x7c3) AM_READ(eeprom_r)
ADDRESS_MAP_END
@@ -301,9 +245,9 @@ static ADDRESS_MAP_START( suplup_io, ADDRESS_SPACE_IO, 16 )
AM_RANGE(0x020, 0x023) AM_WRITE(eeprom_w)
AM_RANGE(0x040, 0x043) AM_READ_PORT("P1_P2")
AM_RANGE(0x060, 0x063) AM_READ_PORT("SYSTEM")
- AM_RANGE(0x080, 0x083) AM_READWRITE(oki_r, oki_w)
- AM_RANGE(0x0c0, 0x0c3) AM_WRITE(ym2151_register_w)
- AM_RANGE(0x0c4, 0x0c7) AM_READWRITE(ym2151_status_r, ym2151_data_w)
+ AM_RANGE(0x080, 0x083) AM_DEVREADWRITE(SOUND, "oki", oki_r, oki_w)
+ AM_RANGE(0x0c0, 0x0c3) AM_DEVWRITE8(SOUND, "ym", ym2151_register_port_w, 0x00ff)
+ AM_RANGE(0x0c4, 0x0c7) AM_DEVREADWRITE8(SOUND, "ym", ym2151_status_port_r, ym2151_data_port_w, 0x00ff)
AM_RANGE(0x100, 0x103) AM_READ(eeprom_r)
ADDRESS_MAP_END
@@ -321,10 +265,9 @@ static ADDRESS_MAP_START( finalgdr_io, ADDRESS_SPACE_IO, 32 )
AM_RANGE(0x2400, 0x2403) AM_READ(finalgdr_prot_r)
AM_RANGE(0x2800, 0x2803) AM_WRITE(finalgdr_backupram_bank_w)
AM_RANGE(0x2c00, 0x2dff) AM_READWRITE(finalgdr_backupram_r, finalgdr_backupram_w)
- AM_RANGE(0x3000, 0x3003) AM_WRITE(ym2151_register32_w)
- AM_RANGE(0x3004, 0x3007) AM_READWRITE(ym2151_status32_r, ym2151_data32_w)
+ AM_RANGE(0x3000, 0x3007) AM_DEVREADWRITE8(SOUND, "ym", ym2151_r, ym2151_w, 0x0000ff00)
AM_RANGE(0x3800, 0x3803) AM_READ_PORT("P1_P2")
- AM_RANGE(0x3400, 0x3403) AM_READWRITE(oki32_r, oki32_w)
+ AM_RANGE(0x3400, 0x3403) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x0000ff00)
AM_RANGE(0x3c00, 0x3c03) AM_READ_PORT("SYSTEM")
AM_RANGE(0x4400, 0x4403) AM_READ(eeprom32_r)
AM_RANGE(0x6000, 0x6003) AM_READNOP //?
@@ -332,7 +275,7 @@ static ADDRESS_MAP_START( finalgdr_io, ADDRESS_SPACE_IO, 32 )
AM_RANGE(0x6040, 0x6043) AM_WRITE(finalgdr_prot_w)
//AM_RANGE(0x6080, 0x6083) AM_WRITE(flipscreen32_w) //?
AM_RANGE(0x6060, 0x6063) AM_WRITE(finalgdr_prize_w)
- AM_RANGE(0x60a0, 0x60a3) AM_WRITE(finalgdr_oki_bank_w)
+ AM_RANGE(0x60a0, 0x60a3) AM_DEVWRITE(SOUND, "oki", finalgdr_oki_bank_w)
ADDRESS_MAP_END
@@ -347,11 +290,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( aoh_io, ADDRESS_SPACE_IO, 32 )
AM_RANGE(0x0480, 0x0483) AM_WRITE(eeprom32_w)
- AM_RANGE(0x0620, 0x0623) AM_READWRITE(oki32_2_r, oki32_2_w)
- AM_RANGE(0x0660, 0x0663) AM_READWRITE(oki32_r, oki32_w)
- AM_RANGE(0x0640, 0x0643) AM_WRITE(ym2151_register32_w)
- AM_RANGE(0x0644, 0x0647) AM_READWRITE(ym2151_status32_r, ym2151_data32_w)
- AM_RANGE(0x0680, 0x0683) AM_WRITE(aoh_oki_2_bank_w)
+ AM_RANGE(0x0620, 0x0623) AM_DEVREADWRITE8(SOUND, "oki_2", okim6295_r, okim6295_w, 0x0000ff00)
+ AM_RANGE(0x0660, 0x0663) AM_DEVREADWRITE8(SOUND, "oki_1", okim6295_r, okim6295_w, 0x0000ff00)
+ AM_RANGE(0x0640, 0x0647) AM_DEVREADWRITE8(SOUND, "ym", ym2151_r, ym2151_w, 0x0000ff00)
+ AM_RANGE(0x0680, 0x0683) AM_DEVWRITE(SOUND, "oki_2", aoh_oki_bank_w)
ADDRESS_MAP_END
/*
diff --git a/src/mame/drivers/vaportra.c b/src/mame/drivers/vaportra.c
index 45810fc7188..6aa07d2746c 100644
--- a/src/mame/drivers/vaportra.c
+++ b/src/mame/drivers/vaportra.c
@@ -79,36 +79,12 @@ static READ8_HANDLER( vaportra_soundlatch_r )
return soundlatch_r(space, offset);
}
-static WRITE8_HANDLER( YM2151_w )
-{
- switch (offset) {
- case 0:
- ym2151_register_port_0_w(space,0,data);
- break;
- case 1:
- ym2151_data_port_0_w(space,0,data);
- break;
- }
-}
-
-static WRITE8_HANDLER( YM2203_w )
-{
- switch (offset) {
- case 0:
- ym2203_control_port_0_w(space,0,data);
- break;
- case 1:
- ym2203_write_port_0_w(space,0,data);
- break;
- }
-}
-
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x000000, 0x00ffff) AM_ROM
- AM_RANGE(0x100000, 0x100001) AM_READWRITE(ym2203_status_port_0_r, YM2203_w)
- AM_RANGE(0x110000, 0x110001) AM_READWRITE(ym2151_status_port_0_r, YM2151_w)
- AM_RANGE(0x120000, 0x120001) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
- AM_RANGE(0x130000, 0x130001) AM_READWRITE(okim6295_status_1_r, okim6295_data_1_w)
+ AM_RANGE(0x100000, 0x100001) AM_DEVREADWRITE(SOUND, "ym1", ym2203_r, ym2203_w)
+ AM_RANGE(0x110000, 0x110001) AM_DEVREADWRITE(SOUND, "ym2", ym2151_r, ym2151_w)
+ AM_RANGE(0x120000, 0x120001) AM_DEVREADWRITE(SOUND, "oki1", okim6295_r, okim6295_w)
+ AM_RANGE(0x130000, 0x130001) AM_DEVREADWRITE(SOUND, "oki2", okim6295_r, okim6295_w)
AM_RANGE(0x140000, 0x140001) AM_READ(vaportra_soundlatch_r)
AM_RANGE(0x1f0000, 0x1f1fff) AM_READWRITE(SMH_BANK8,SMH_BANK8) /* ??? LOOKUP ??? */
AM_RANGE(0x1fec00, 0x1fec01) AM_WRITE(h6280_timer_w)
@@ -228,9 +204,9 @@ GFXDECODE_END
/******************************************************************************/
-static void sound_irq(running_machine *machine, int state)
+static void sound_irq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1],1,state); /* IRQ 2 */
+ cpu_set_input_line(device->machine->cpu[1],1,state); /* IRQ 2 */
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/vastar.c b/src/mame/drivers/vastar.c
index bd9181133ea..9b806876a62 100644
--- a/src/mame/drivers/vastar.c
+++ b/src/mame/drivers/vastar.c
@@ -153,9 +153,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( cpu2_port_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x02, 0x02) AM_READ(ay8910_read_port_0_r)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
+ AM_RANGE(0x02, 0x02) AM_DEVREAD(SOUND, "ay", ay8910_r)
ADDRESS_MAP_END
@@ -297,10 +296,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_3_r,
- input_port_4_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
diff --git a/src/mame/drivers/vball.c b/src/mame/drivers/vball.c
index bb18f006415..7f2a8a0dd53 100644
--- a/src/mame/drivers/vball.c
+++ b/src/mame/drivers/vball.c
@@ -248,17 +248,16 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM)
- AM_RANGE(0x8801, 0x8801) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0x9800, 0x9800) AM_READ(okim6295_status_0_r)
+ AM_RANGE(0x8800, 0x8801) AM_DEVREAD(SOUND, "ym", ym2151_r)
+ AM_RANGE(0x9800, 0x9800) AM_DEVREAD(SOUND, "oki", okim6295_r)
AM_RANGE(0xA000, 0xA000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM)
AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0x8800, 0x8800) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x8801, 0x8801) AM_WRITE(ym2151_data_port_0_w)
- AM_RANGE(0x9800, 0x9803) AM_WRITE(okim6295_data_0_w)
+ AM_RANGE(0x8800, 0x8801) AM_DEVWRITE(SOUND, "ym", ym2151_w)
+ AM_RANGE(0x9800, 0x9803) AM_DEVWRITE(SOUND, "oki", okim6295_w)
ADDRESS_MAP_END
@@ -423,9 +422,9 @@ static GFXDECODE_START( vb )
GFXDECODE_END
-static void vball_irq_handler(running_machine *machine, int irq)
+static void vball_irq_handler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1], 0 , irq ? ASSERT_LINE : CLEAR_LINE );
+ cpu_set_input_line(device->machine->cpu[1], 0 , irq ? ASSERT_LINE : CLEAR_LINE );
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/vcombat.c b/src/mame/drivers/vcombat.c
index 44673b373ae..612c531dcdf 100644
--- a/src/mame/drivers/vcombat.c
+++ b/src/mame/drivers/vcombat.c
@@ -300,10 +300,10 @@ static WRITE16_HANDLER( crtc_w )
crtc_select ^= 1;
}
-static WRITE16_HANDLER( dac_w )
+static WRITE16_DEVICE_HANDLER( vcombat_dac_w )
{
INT16 newval = ((INT16)data - 0x6000) << 2;
- dac_signed_data_16_w(0, newval + 0x8000);
+ dac_signed_data_16_w(device, newval + 0x8000);
}
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
@@ -366,7 +366,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x03ffff) AM_ROM
AM_RANGE(0x080000, 0x08ffff) AM_RAM
- AM_RANGE(0x0c0000, 0x0c0001) AM_WRITE(dac_w)
+ AM_RANGE(0x0c0000, 0x0c0001) AM_DEVWRITE(SOUND, "dac", vcombat_dac_w)
AM_RANGE(0x140000, 0x140001) AM_READ(sound_resetmain_r) /* Ping M0's reset line */
AM_RANGE(0x180000, 0x180001) AM_RAM AM_SHARE(4) /* M1<-M0 */
AM_RANGE(0x1c0000, 0x1c0001) AM_RAM AM_SHARE(5) /* M1->M0 */
diff --git a/src/mame/drivers/vendetta.c b/src/mame/drivers/vendetta.c
index cb27e0e1ee4..71cae63f944 100644
--- a/src/mame/drivers/vendetta.c
+++ b/src/mame/drivers/vendetta.c
@@ -259,9 +259,9 @@ static READ8_HANDLER( vendetta_sound_interrupt_r )
return 0x00;
}
-static READ8_HANDLER( vendetta_sound_r )
+static READ8_DEVICE_HANDLER( vendetta_sound_r )
{
- return k053260_0_r(space, 2 + offset);
+ return k053260_r(device, 2 + offset);
}
/********************************************/
@@ -277,7 +277,7 @@ static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x5fd0, 0x5fd0) AM_READ(vendetta_eeprom_r) /* vblank, service */
AM_RANGE(0x5fd1, 0x5fd1) AM_READ_PORT("SERVICE")
AM_RANGE(0x5fe4, 0x5fe4) AM_READ(vendetta_sound_interrupt_r)
- AM_RANGE(0x5fe6, 0x5fe7) AM_READ(vendetta_sound_r)
+ AM_RANGE(0x5fe6, 0x5fe7) AM_DEVREAD(SOUND, "konami", vendetta_sound_r)
AM_RANGE(0x5fe8, 0x5fe9) AM_READ(K053246_r)
AM_RANGE(0x5fea, 0x5fea) AM_READ(watchdog_reset_r)
/* what is the desired effect of overlapping these memory regions anyway? */
@@ -296,7 +296,7 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x5fe0, 0x5fe0) AM_WRITE(vendetta_5fe0_w)
AM_RANGE(0x5fe2, 0x5fe2) AM_WRITE(vendetta_eeprom_w)
AM_RANGE(0x5fe4, 0x5fe4) AM_WRITE(z80_irq_w)
- AM_RANGE(0x5fe6, 0x5fe7) AM_WRITE(k053260_0_w)
+ AM_RANGE(0x5fe6, 0x5fe7) AM_DEVWRITE(SOUND, "konami", k053260_w)
/* what is the desired effect of overlapping these memory regions anyway? */
AM_RANGE(0x4000, 0x4fff) AM_WRITE(SMH_BANK3)
AM_RANGE(0x6000, 0x6fff) AM_WRITE(SMH_BANK2)
@@ -313,7 +313,7 @@ static ADDRESS_MAP_START( esckids_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x3f92, 0x3f92) AM_READ(vendetta_eeprom_r) // vblank, TEST SW on PCB
AM_RANGE(0x3f93, 0x3f93) AM_READ_PORT("SERVICE")
AM_RANGE(0x3fd4, 0x3fd4) AM_READ(vendetta_sound_interrupt_r) // Sound
- AM_RANGE(0x3fd6, 0x3fd7) AM_READ(vendetta_sound_r) // Sound
+ AM_RANGE(0x3fd6, 0x3fd7) AM_DEVREAD(SOUND, "konami", vendetta_sound_r) // Sound
AM_RANGE(0x3fd8, 0x3fd9) AM_READ(K053246_r) // 053246 (Sprite)
/* what is the desired effect of overlapping these memory regions anyway? */
AM_RANGE(0x2000, 0x2fff) AM_READ(SMH_BANK3) // 052109 (Tilemap) 0x0000-0x0fff
@@ -331,7 +331,7 @@ static ADDRESS_MAP_START( esckids_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x3fd0, 0x3fd0) AM_WRITE(vendetta_5fe0_w) // Coin Counter, 052109 RMRD, 053246 OBJCHA
AM_RANGE(0x3fd2, 0x3fd2) AM_WRITE(vendetta_eeprom_w) // EEPROM, Video banking
AM_RANGE(0x3fd4, 0x3fd4) AM_WRITE(z80_irq_w) // Sound
- AM_RANGE(0x3fd6, 0x3fd7) AM_WRITE(k053260_0_w) // Sound
+ AM_RANGE(0x3fd6, 0x3fd7) AM_DEVWRITE(SOUND, "konami", k053260_w) // Sound
AM_RANGE(0x3fda, 0x3fda) AM_WRITE(SMH_NOP) // Not Emulated (Watchdog ???)
/* what is the desired effect of overlapping these memory regions anyway? */
AM_RANGE(0x2000, 0x2fff) AM_WRITE(SMH_BANK3) // 052109 (Tilemap) 0x0000-0x0fff
@@ -345,17 +345,16 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_READ(SMH_ROM)
AM_RANGE(0xf000, 0xf7ff) AM_READ(SMH_RAM)
- AM_RANGE(0xf801, 0xf801) AM_READ(ym2151_status_port_0_r)
- AM_RANGE(0xfc00, 0xfc2f) AM_READ(k053260_0_r)
+ AM_RANGE(0xf800, 0xf801) AM_DEVREAD(SOUND, "ym", ym2151_r)
+ AM_RANGE(0xfc00, 0xfc2f) AM_DEVREAD(SOUND, "konami", k053260_r)
ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xefff) AM_WRITE(SMH_ROM)
AM_RANGE(0xf000, 0xf7ff) AM_WRITE(SMH_RAM)
- AM_RANGE(0xf800, 0xf800) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xf801, 0xf801) AM_WRITE(ym2151_data_port_0_w)
+ AM_RANGE(0xf800, 0xf801) AM_DEVWRITE(SOUND, "ym", ym2151_w)
AM_RANGE(0xfa00, 0xfa00) AM_WRITE(z80_arm_nmi_w)
- AM_RANGE(0xfc00, 0xfc2f) AM_WRITE(k053260_0_w)
+ AM_RANGE(0xfc00, 0xfc2f) AM_DEVWRITE(SOUND, "konami", k053260_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/videopin.c b/src/mame/drivers/videopin.c
index 9caabd039fd..92616ee5335 100644
--- a/src/mame/drivers/videopin.c
+++ b/src/mame/drivers/videopin.c
@@ -22,8 +22,8 @@ static attotime time_released;
static UINT8 prev = 0;
static UINT8 mask = 0;
-static WRITE8_HANDLER(videopin_out1_w);
-static WRITE8_HANDLER(videopin_out2_w);
+static WRITE8_DEVICE_HANDLER(videopin_out1_w);
+static WRITE8_DEVICE_HANDLER(videopin_out2_w);
static void update_plunger(running_machine *machine)
@@ -66,14 +66,14 @@ static TIMER_CALLBACK( interrupt_callback )
static MACHINE_RESET( videopin )
{
- const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const device_config *discrete = devtag_get_device(machine, SOUND, "discrete");
timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, 32, 0), NULL, 32, interrupt_callback);
/* both output latches are cleared on reset */
- videopin_out1_w(space, 0, 0);
- videopin_out2_w(space, 0, 0);
+ videopin_out1_w(discrete, 0, 0);
+ videopin_out2_w(discrete, 0, 0);
}
@@ -138,7 +138,7 @@ static WRITE8_HANDLER( videopin_led_w )
}
-static WRITE8_HANDLER( videopin_out1_w )
+static WRITE8_DEVICE_HANDLER( videopin_out1_w )
{
/* D0 => OCTAVE0 */
/* D1 => OCTACE1 */
@@ -152,16 +152,16 @@ static WRITE8_HANDLER( videopin_out1_w )
mask = ~data & 0x10;
if (mask)
- cpu_set_input_line(space->machine->cpu[0], INPUT_LINE_NMI, CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_NMI, CLEAR_LINE);
coin_lockout_global_w(~data & 0x08);
/* Convert octave data to divide value and write to sound */
- discrete_sound_w(space, VIDEOPIN_OCTAVE_DATA, (0x01 << (~data & 0x07)) & 0xfe);
+ discrete_sound_w(device, VIDEOPIN_OCTAVE_DATA, (0x01 << (~data & 0x07)) & 0xfe);
}
-static WRITE8_HANDLER( videopin_out2_w )
+static WRITE8_DEVICE_HANDLER( videopin_out2_w )
{
/* D0 => VOL0 */
/* D1 => VOL1 */
@@ -174,17 +174,17 @@ static WRITE8_HANDLER( videopin_out2_w )
coin_counter_w(0, data & 0x10);
- discrete_sound_w(space, VIDEOPIN_BELL_EN, data & 0x40); // Bell
- discrete_sound_w(space, VIDEOPIN_BONG_EN, data & 0x20); // Bong
- discrete_sound_w(space, VIDEOPIN_ATTRACT_EN, data & 0x80); // Attract
- discrete_sound_w(space, VIDEOPIN_VOL_DATA, data & 0x07); // Vol0,1,2
+ discrete_sound_w(device, VIDEOPIN_BELL_EN, data & 0x40); // Bell
+ discrete_sound_w(device, VIDEOPIN_BONG_EN, data & 0x20); // Bong
+ discrete_sound_w(device, VIDEOPIN_ATTRACT_EN, data & 0x80); // Attract
+ discrete_sound_w(device, VIDEOPIN_VOL_DATA, data & 0x07); // Vol0,1,2
}
-static WRITE8_HANDLER( videopin_note_dvsr_w )
+static WRITE8_DEVICE_HANDLER( videopin_note_dvsr_w )
{
/* note data */
- discrete_sound_w(space, VIDEOPIN_NOTE_DATA, ~data &0xff);
+ discrete_sound_w(device, VIDEOPIN_NOTE_DATA, ~data &0xff);
}
@@ -197,12 +197,12 @@ static WRITE8_HANDLER( videopin_note_dvsr_w )
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x01ff) AM_RAM
AM_RANGE(0x0200, 0x07ff) AM_RAM_WRITE(videopin_video_ram_w) AM_BASE(&videopin_video_ram)
- AM_RANGE(0x0800, 0x0800) AM_READWRITE(videopin_misc_r, videopin_note_dvsr_w)
+ AM_RANGE(0x0800, 0x0800) AM_READ(videopin_misc_r) AM_DEVWRITE(SOUND, "discrete", videopin_note_dvsr_w)
AM_RANGE(0x0801, 0x0801) AM_WRITE(videopin_led_w)
AM_RANGE(0x0802, 0x0802) AM_WRITE(watchdog_reset_w)
AM_RANGE(0x0804, 0x0804) AM_WRITE(videopin_ball_w)
- AM_RANGE(0x0805, 0x0805) AM_WRITE(videopin_out1_w)
- AM_RANGE(0x0806, 0x0806) AM_WRITE(videopin_out2_w)
+ AM_RANGE(0x0805, 0x0805) AM_DEVWRITE(SOUND, "discrete", videopin_out1_w)
+ AM_RANGE(0x0806, 0x0806) AM_DEVWRITE(SOUND, "discrete", videopin_out2_w)
AM_RANGE(0x1000, 0x1000) AM_READ_PORT("IN0")
AM_RANGE(0x1800, 0x1800) AM_READ_PORT("DSW")
AM_RANGE(0x2000, 0x3fff) AM_ROM
diff --git a/src/mame/drivers/videopkr.c b/src/mame/drivers/videopkr.c
index ac84621dc18..eaf39912441 100644
--- a/src/mame/drivers/videopkr.c
+++ b/src/mame/drivers/videopkr.c
@@ -813,18 +813,18 @@ static READ8_HANDLER(baby_sound_p2_r)
return sbp2;
}
-static WRITE8_HANDLER(baby_sound_p2_w)
+static WRITE8_DEVICE_HANDLER(baby_sound_p2_w)
{
sbp2 = data;
- dac_0_data_w(space, 0, data);
+ dac_data_w(device, data);
}
-static READ8_HANDLER(baby_sound_p3_r)
+static READ8_DEVICE_HANDLER(baby_sound_p3_r)
{
return sbp3;
}
-static WRITE8_HANDLER(baby_sound_p3_w)
+static WRITE8_DEVICE_HANDLER(baby_sound_p3_w)
{
UINT8 lmp_ports, ay_intf;
sbp3 = data;
@@ -836,7 +836,7 @@ static WRITE8_HANDLER(baby_sound_p3_w)
if (!(sbp3 & 0x10))
{
- ay8910_reset_ym(sndti_token(SOUND_AY8910, 0));
+ device_reset(device);
logerror("AY3-8910: Reset\n");
}
@@ -847,11 +847,11 @@ static WRITE8_HANDLER(baby_sound_p3_w)
case 0x00: break;
case 0x01: break;
case 0x02: break;
- case 0x03: ay8910_write_port_0_w(space, 1, sbp0); break;
+ case 0x03: ay8910_data_w(device, 1, sbp0); break;
case 0x04: break;
- case 0x05: sbp0 = ay8910_read_port_0_r(space, sbp0); break;
+ case 0x05: sbp0 = ay8910_r(device, sbp0); break;
case 0x06: break;
- case 0x07: ay8910_control_port_0_w(space, 0, sbp0); break;
+ case 0x07: ay8910_address_w(device, 0, sbp0); break;
}
}
@@ -891,7 +891,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( i8039_sound_port, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x00 , 0xff ) AM_READWRITE(sound_io_r, sound_io_w)
- AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(dac_0_data_w)
+ AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_DEVWRITE(SOUND, "dac", dac_w)
AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(sound_p2_r, sound_p2_w)
ADDRESS_MAP_END
@@ -905,8 +905,8 @@ static ADDRESS_MAP_START( i8051_sound_port, ADDRESS_SPACE_IO, 8 )
/* ports */
AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P0) AM_READWRITE(baby_sound_p0_r, baby_sound_p0_w)
AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_READWRITE(baby_sound_p1_r, baby_sound_p1_w)
- AM_RANGE(MCS51_PORT_P2, MCS51_PORT_P2) AM_READWRITE(baby_sound_p2_r, baby_sound_p2_w)
- AM_RANGE(MCS51_PORT_P3, MCS51_PORT_P3) AM_READWRITE(baby_sound_p3_r, baby_sound_p3_w)
+ AM_RANGE(MCS51_PORT_P2, MCS51_PORT_P2) AM_READ(baby_sound_p2_r) AM_DEVWRITE(SOUND, "dac", baby_sound_p2_w)
+ AM_RANGE(MCS51_PORT_P3, MCS51_PORT_P3) AM_DEVREADWRITE(SOUND, "ay", baby_sound_p3_r, baby_sound_p3_w)
ADDRESS_MAP_END
@@ -1145,10 +1145,10 @@ static const ay8910_interface ay8910_config =
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
/* no ports used */
- NULL,
- NULL,
- NULL,
- NULL
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
/************************
@@ -1187,7 +1187,7 @@ static MACHINE_DRIVER_START( videopkr )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("sound", DAC, 0)
+ MDRV_SOUND_ADD("dac", DAC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.55)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/vigilant.c b/src/mame/drivers/vigilant.c
index 8d9bd72fba5..46469367865 100644
--- a/src/mame/drivers/vigilant.c
+++ b/src/mame/drivers/vigilant.c
@@ -120,23 +120,20 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0x80, 0x81) AM_READWRITE(soundlatch_r, vigilant_sample_addr_w) /* STL / STH */
- AM_RANGE(0x82, 0x82) AM_WRITE(m72_sample_w) /* COUNT UP */
+ AM_RANGE(0x82, 0x82) AM_DEVWRITE(SOUND, "dac", m72_sample_w) /* COUNT UP */
AM_RANGE(0x83, 0x83) AM_WRITE(m72_sound_irq_ack_w) /* IRQ clear */
AM_RANGE(0x84, 0x84) AM_READ(m72_sample_r) /* S ROM C */
ADDRESS_MAP_END
static ADDRESS_MAP_START( buccanrs_sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
- AM_RANGE(0x02, 0x02) AM_READWRITE(ym2203_status_port_1_r, ym2203_control_port_1_w)
- AM_RANGE(0x03, 0x03) AM_READWRITE(ym2203_read_port_1_r, ym2203_write_port_1_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym1", ym2203_r, ym2203_w)
+ AM_RANGE(0x02, 0x03) AM_DEVREADWRITE(SOUND, "ym2", ym2203_r, ym2203_w)
AM_RANGE(0x80, 0x80) AM_READ(soundlatch_r) /* SDRE */
AM_RANGE(0x80, 0x81) AM_WRITE(vigilant_sample_addr_w) /* STL / STH */
- AM_RANGE(0x82, 0x82) AM_WRITE(m72_sample_w) /* COUNT UP */
+ AM_RANGE(0x82, 0x82) AM_DEVWRITE(SOUND, "dac", m72_sample_w) /* COUNT UP */
AM_RANGE(0x83, 0x83) AM_WRITE(m72_sound_irq_ack_w) /* IRQ clear */
AM_RANGE(0x84, 0x84) AM_READ(m72_sample_r) /* S ROM C */
ADDRESS_MAP_END
@@ -521,7 +518,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
m72_ym2151_irq_handler
};
diff --git a/src/mame/drivers/vmetal.c b/src/mame/drivers/vmetal.c
index 0109b60808c..dc18c731812 100644
--- a/src/mame/drivers/vmetal.c
+++ b/src/mame/drivers/vmetal.c
@@ -153,7 +153,7 @@ static READ16_HANDLER ( varia_dips_bit3_r ) { return ((input_port_read(space->ma
static READ16_HANDLER ( varia_dips_bit2_r ) { return ((input_port_read(space->machine, "DSW2") & 0x02) << 6) | ((input_port_read(space->machine, "DSW1") & 0x02) << 5); }
static READ16_HANDLER ( varia_dips_bit1_r ) { return ((input_port_read(space->machine, "DSW2") & 0x01) << 7) | ((input_port_read(space->machine, "DSW1") & 0x01) << 6); }
-static WRITE16_HANDLER( vmetal_control_w )
+static WRITE8_DEVICE_HANDLER( vmetal_control_w )
{
/* Lower nibble is the coin control bits shown in
service mode, but in game mode they're different */
@@ -163,20 +163,20 @@ static WRITE16_HANDLER( vmetal_control_w )
coin_lockout_w(1,data & 0x02); /* never activated in game mode?? */
if ((data & 0x40) == 0)
- sndti_reset(SOUND_ES8712, 0);
+ device_reset(device);
else
- es8712_play(0);
+ es8712_play(device);
if (data & 0x10)
- es8712_set_bank_base(0, 0x100000);
+ es8712_set_bank_base(device, 0x100000);
else
- es8712_set_bank_base(0, 0x000000);
+ es8712_set_bank_base(device, 0x000000);
if (data & 0xa0)
- logerror("PC:%06x - Writing unknown bits %04x to $200000\n",cpu_get_previouspc(space->cpu),data);
+ logerror("%s:Writing unknown bits %04x to $200000\n",cpuexec_describe_context(device->machine),data);
}
-static WRITE16_HANDLER( vmetal_es8712_w )
+static WRITE8_DEVICE_HANDLER( vmetal_es8712_w )
{
/* Many samples in the ADPCM ROM are actually not used.
@@ -208,8 +208,8 @@ static WRITE16_HANDLER( vmetal_es8712_w )
16 002a 000e 0083 00ee 000f 0069 0069 0e832a-0f69ee
*/
- es8712_data_0_lsb_w(space, offset, data, mem_mask);
- logerror("PC:%06x - Writing %04x to ES8712 offset %02x\n",cpu_get_previouspc(space->cpu),data,offset);
+ es8712_w(device, offset, data);
+ logerror("%s:Writing %04x to ES8712 offset %02x\n",cpuexec_describe_context(device->machine),data,offset);
}
@@ -228,7 +228,7 @@ static ADDRESS_MAP_START( varia_program_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x178800, 0x1796ff) AM_RAM AM_BASE(&vmetal_videoregs)
AM_RANGE(0x179700, 0x179713) AM_WRITE(SMH_RAM) AM_BASE(&metro_videoregs ) // Video Registers
- AM_RANGE(0x200000, 0x200001) AM_READ_PORT("P1_P2") AM_WRITE(vmetal_control_w)
+ AM_RANGE(0x200000, 0x200001) AM_READ_PORT("P1_P2") AM_DEVWRITE8(SOUND, "es", vmetal_control_w, 0x00ff)
AM_RANGE(0x200002, 0x200003) AM_READ_PORT("SYSTEM")
/* i have no idea whats meant to be going on here .. it seems to read one bit of the dips from some of them, protection ??? */
@@ -250,9 +250,9 @@ static ADDRESS_MAP_START( varia_program_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x31fffc, 0x31fffd) AM_READ(varia_dips_bit1_r ) // 0x40 = dip1-1 , 0x80 = dip2-1
AM_RANGE(0x31fffe, 0x31ffff) AM_READ(varia_random ) // nothing?
- AM_RANGE(0x400000, 0x400001) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w )
- AM_RANGE(0x400002, 0x400003) AM_WRITE(okim6295_data_0_lsb_w ) // Volume/channel info
- AM_RANGE(0x500000, 0x50000d) AM_WRITE(vmetal_es8712_w)
+ AM_RANGE(0x400000, 0x400001) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff )
+ AM_RANGE(0x400002, 0x400003) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff) // Volume/channel info
+ AM_RANGE(0x500000, 0x50000d) AM_DEVWRITE8(SOUND, "es", vmetal_es8712_w, 0x00ff)
AM_RANGE(0xff0000, 0xffffff) AM_RAM
ADDRESS_MAP_END
diff --git a/src/mame/drivers/volfied.c b/src/mame/drivers/volfied.c
index c005a3e5f94..0f8183f261c 100644
--- a/src/mame/drivers/volfied.c
+++ b/src/mame/drivers/volfied.c
@@ -91,8 +91,7 @@ static ADDRESS_MAP_START( z80_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0x87ff) AM_RAM
AM_RANGE(0x8800, 0x8800) AM_WRITE(taitosound_slave_port_w)
AM_RANGE(0x8801, 0x8801) AM_READWRITE(taitosound_slave_comm_r, taitosound_slave_comm_w)
- AM_RANGE(0x9000, 0x9000) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x9001, 0x9001) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
+ AM_RANGE(0x9000, 0x9001) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
AM_RANGE(0x9800, 0x9800) AM_WRITE(SMH_NOP) /* ? */
ADDRESS_MAP_END
@@ -216,9 +215,9 @@ GFXDECODE_END
/* handler called by the YM2203 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface ym2203_config =
@@ -226,10 +225,10 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_0_r, /* DSW A */
- input_port_1_r, /* DSW B */
- NULL,
- NULL,
+ DEVCB_INPUT_PORT("DSWA"),
+ DEVCB_INPUT_PORT("DSWB"),
+ DEVCB_NULL,
+ DEVCB_NULL,
},
irqhandler
};
diff --git a/src/mame/drivers/vroulet.c b/src/mame/drivers/vroulet.c
index 58560a76cd3..822a995523b 100644
--- a/src/mame/drivers/vroulet.c
+++ b/src/mame/drivers/vroulet.c
@@ -114,8 +114,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( vroulet_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x00, 0x00) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay", ay8910_data_address_w)
AM_RANGE(0x10, 0x13) AM_DEVREADWRITE(PPI8255, "ppi8255_0", ppi8255_r, ppi8255_w)
AM_RANGE(0x80, 0x83) AM_DEVREADWRITE(PPI8255, "ppi8255_1", ppi8255_r, ppi8255_w)
ADDRESS_MAP_END
@@ -223,10 +223,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_3_r,// DSWA
- input_port_4_r,// DSWB
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSWA"),
+ DEVCB_INPUT_PORT("DSWB"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
/* PPI8255 Interface */
diff --git a/src/mame/drivers/vsnes.c b/src/mame/drivers/vsnes.c
index ee1152914de..07db65cae1b 100644
--- a/src/mame/drivers/vsnes.c
+++ b/src/mame/drivers/vsnes.c
@@ -186,45 +186,30 @@ static WRITE8_HANDLER( vsnes_coin_counter_1_w )
}
/******************************************************************************/
-static READ8_HANDLER( psg_4015_r )
+static READ8_DEVICE_HANDLER( psg_4015_r )
{
- return nes_psg_0_r(space, 0x15);
+ return nes_psg_r(device, 0x15);
}
-static WRITE8_HANDLER( psg_4015_w )
+static WRITE8_DEVICE_HANDLER( psg_4015_w )
{
- nes_psg_0_w(space, 0x15, data);
+ nes_psg_w(device, 0x15, data);
}
-static WRITE8_HANDLER( psg_4017_w )
+static WRITE8_DEVICE_HANDLER( psg_4017_w )
{
- nes_psg_0_w(space, 0x17, data);
-}
-
-static READ8_HANDLER( psg1_4015_r )
-{
- return nes_psg_1_r(space, 0x15);
-}
-
-static WRITE8_HANDLER( psg1_4015_w )
-{
- nes_psg_1_w(space, 0x15, data);
-}
-
-static WRITE8_HANDLER( psg1_4017_w )
-{
- nes_psg_1_w(space, 0x17, data);
+ nes_psg_w(device, 0x17, data);
}
static ADDRESS_MAP_START( vsnes_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x1800) AM_RAM AM_BASE(&work_ram)
AM_RANGE(0x2000, 0x3fff) AM_READWRITE(ppu2c0x_0_r, ppu2c0x_0_w)
- AM_RANGE(0x4011, 0x4011) AM_WRITE(dac_0_data_w)
- AM_RANGE(0x4000, 0x4013) AM_READWRITE(nes_psg_0_r, nes_psg_0_w)
+ AM_RANGE(0x4011, 0x4011) AM_DEVWRITE(SOUND, "dac1", dac_w)
+ AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE(SOUND, "nes1", nes_psg_r, nes_psg_w)
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_0_w)
- AM_RANGE(0x4015, 0x4015) AM_READWRITE(psg_4015_r, psg_4015_w) /* PSG status / first control register */
+ AM_RANGE(0x4015, 0x4015) AM_DEVREADWRITE(SOUND, "nes1", psg_4015_r, psg_4015_w) /* PSG status / first control register */
AM_RANGE(0x4016, 0x4016) AM_READWRITE(vsnes_in0_r, vsnes_in0_w)
- AM_RANGE(0x4017, 0x4017) AM_READWRITE(vsnes_in1_r, psg_4017_w) /* IN1 - input port 2 / PSG second control register */
+ AM_RANGE(0x4017, 0x4017) AM_READ(vsnes_in1_r) AM_DEVWRITE(SOUND, "nes1", psg_4017_w) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x4020, 0x4020) AM_READWRITE(vsnes_coin_counter_r, vsnes_coin_counter_w)
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -232,12 +217,12 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( vsnes_cpu2_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x1800) AM_RAM AM_BASE(&work_ram_1)
AM_RANGE(0x2000, 0x3fff) AM_READWRITE(ppu2c0x_1_r, ppu2c0x_1_w)
- AM_RANGE(0x4011, 0x4011) AM_WRITE(dac_1_data_w)
- AM_RANGE(0x4000, 0x4013) AM_READWRITE(nes_psg_1_r, nes_psg_1_w)
+ AM_RANGE(0x4011, 0x4011) AM_DEVWRITE(SOUND, "dac2", dac_w)
+ AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE(SOUND, "nes2", nes_psg_r, nes_psg_w)
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_1_w)
- AM_RANGE(0x4015, 0x4015) AM_READWRITE(psg1_4015_r, psg1_4015_w) /* PSG status / first control register */
+ AM_RANGE(0x4015, 0x4015) AM_DEVREADWRITE(SOUND, "nes2", psg_4015_r, psg_4015_w) /* PSG status / first control register */
AM_RANGE(0x4016, 0x4016) AM_READWRITE(vsnes_in0_1_r, vsnes_in0_1_w)
- AM_RANGE(0x4017, 0x4017) AM_READWRITE(vsnes_in1_1_r, psg1_4017_w) /* IN1 - input port 2 / PSG second control register */
+ AM_RANGE(0x4017, 0x4017) AM_READ(vsnes_in1_1_r) AM_DEVWRITE(SOUND, "nes2", psg_4017_w) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x4020, 0x4020) AM_WRITE(vsnes_coin_counter_1_w)
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -1800,11 +1785,11 @@ static MACHINE_DRIVER_START( vsnes )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("nes", NES, N2A03_DEFAULTCLOCK)
+ MDRV_SOUND_ADD("nes1", NES, N2A03_DEFAULTCLOCK)
MDRV_SOUND_CONFIG(nes_interface_1)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
- MDRV_SOUND_ADD("dac", DAC, 0)
+ MDRV_SOUND_ADD("dac1", DAC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/vulgus.c b/src/mame/drivers/vulgus.c
index bb506589034..ab4f5723b21 100644
--- a/src/mame/drivers/vulgus.c
+++ b/src/mame/drivers/vulgus.c
@@ -91,10 +91,8 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4000, 0x47ff) AM_RAM
AM_RANGE(0x4000, 0x47ff) AM_WRITE(SMH_RAM)
AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
- AM_RANGE(0x8000, 0x8000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x8001, 0x8001) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ay8910_control_port_1_w)
- AM_RANGE(0xc001, 0xc001) AM_WRITE(ay8910_write_port_1_w)
+ AM_RANGE(0x8000, 0x8001) AM_DEVWRITE(SOUND, "ay1", ay8910_address_data_w)
+ AM_RANGE(0xc000, 0xc001) AM_DEVWRITE(SOUND, "ay2", ay8910_address_data_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/wallc.c b/src/mame/drivers/wallc.c
index 3852ee22ac4..fe07980c83b 100644
--- a/src/mame/drivers/wallc.c
+++ b/src/mame/drivers/wallc.c
@@ -155,8 +155,8 @@ static ADDRESS_MAP_START( wallc_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xb000, 0xb000) AM_WRITENOP
AM_RANGE(0xb100, 0xb100) AM_WRITE(wallc_coin_counter_w)
AM_RANGE(0xb200, 0xb200) AM_WRITENOP
- AM_RANGE(0xb500, 0xb500) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0xb600, 0xb600) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0xb500, 0xb500) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
+ AM_RANGE(0xb600, 0xb600) AM_DEVWRITE(SOUND, "ay", ay8910_data_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/wardner.c b/src/mame/drivers/wardner.c
index 19fe7ed8eba..5c7e51a0788 100644
--- a/src/mame/drivers/wardner.c
+++ b/src/mame/drivers/wardner.c
@@ -235,8 +235,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ym3812_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE(SOUND, "ym", ym3812_r, ym3812_w)
ADDRESS_MAP_END
@@ -416,9 +415,9 @@ static const gfx_layout spritelayout =
/* handler called by the 3812 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int linestate)
+static void irqhandler(const device_config *device, int linestate)
{
- cpu_set_input_line(machine->cpu[1],0,linestate);
+ cpu_set_input_line(device->machine->cpu[1],0,linestate);
}
static const ym3812_interface ym3812_config =
diff --git a/src/mame/drivers/warpwarp.c b/src/mame/drivers/warpwarp.c
index b210acddcd4..008730ce71b 100644
--- a/src/mame/drivers/warpwarp.c
+++ b/src/mame/drivers/warpwarp.c
@@ -128,7 +128,6 @@ TODO:
#include "driver.h"
#include "cpu/i8085/i8085.h"
-#include "sound/custom.h"
#include "warpwarp.h"
#include "geebee.lh"
#include "sos.lh"
@@ -721,17 +720,6 @@ static GFXDECODE_START( color )
GFXDECODE_END
-static const custom_sound_interface geebee_custom_interface =
-{
- geebee_sh_start
-};
-
-static const custom_sound_interface warpwarp_custom_interface =
-{
- warpwarp_sh_start
-};
-
-
static MACHINE_DRIVER_START( geebee )
@@ -756,8 +744,7 @@ static MACHINE_DRIVER_START( geebee )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("geebee", CUSTOM, 0)
- MDRV_SOUND_CONFIG(geebee_custom_interface)
+ MDRV_SOUND_ADD("geebee", GEEBEE, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
@@ -796,8 +783,7 @@ static MACHINE_DRIVER_START( bombbee )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("warpwarp", CUSTOM, 0)
- MDRV_SOUND_CONFIG(warpwarp_custom_interface)
+ MDRV_SOUND_ADD("warpwarp", WARPWARP, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/warriorb.c b/src/mame/drivers/warriorb.c
index 532462cd129..d8bad641edf 100644
--- a/src/mame/drivers/warriorb.c
+++ b/src/mame/drivers/warriorb.c
@@ -198,12 +198,14 @@ static int ninjaw_pandata[4]; /**** sound pan control ****/
static WRITE8_HANDLER( warriorb_pancontrol )
{
+ static const char *fltname[] = { "2610.1.l", "2610.1.r", "2610.2.l", "2610.2.r" };
+
offset = offset&3;
ninjaw_pandata[offset] = (data<<1) + data; /* original volume*3 */
// popmessage(" pan %02x %02x %02x %02x", ninjaw_pandata[0], ninjaw_pandata[1], ninjaw_pandata[2], ninjaw_pandata[3] );
- flt_volume_set_volume(offset, ninjaw_pandata[offset] / 100.0);
+ flt_volume_set_volume(devtag_get_device(space->machine, SOUND, fltname[offset & 3]), ninjaw_pandata[offset] / 100.0);
}
@@ -249,10 +251,7 @@ static ADDRESS_MAP_START( z80_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM
AM_RANGE(0x4000, 0x7fff) AM_READWRITE(SMH_BANK10, SMH_ROM)
AM_RANGE(0xc000, 0xdfff) AM_RAM
- AM_RANGE(0xe000, 0xe000) AM_READWRITE(ym2610_status_port_0_a_r, ym2610_control_port_0_a_w)
- AM_RANGE(0xe001, 0xe001) AM_READWRITE(ym2610_read_port_0_r, ym2610_data_port_0_a_w)
- AM_RANGE(0xe002, 0xe002) AM_READWRITE(ym2610_status_port_0_b_r, ym2610_control_port_0_b_w)
- AM_RANGE(0xe003, 0xe003) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0xe000, 0xe003) AM_DEVREADWRITE(SOUND, "ym", ym2610_r, ym2610_w)
AM_RANGE(0xe200, 0xe200) AM_READWRITE(SMH_NOP, taitosound_slave_port_w)
AM_RANGE(0xe201, 0xe201) AM_READWRITE(taitosound_slave_comm_r, taitosound_slave_comm_w)
AM_RANGE(0xe400, 0xe403) AM_WRITE(warriorb_pancontrol) /* pan */
@@ -401,9 +400,9 @@ GFXDECODE_END
**************************************************************/
/* handler called by the YM2610 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface ym2610_config =
@@ -417,23 +416,27 @@ static const ym2610_interface ym2610_config =
**************************************************************/
#if 0
-static int subwoofer_sh_start(const sound_config *msound)
+static DEVICE_START( subwoofer )
{
/* Adjust the lowpass filter of the first three YM2610 channels */
mixer_set_lowpass_frequency(0,20);
mixer_set_lowpass_frequency(1,20);
mixer_set_lowpass_frequency(2,20);
-
- return 0;
}
-static const custom_sound_interface subwoofer_interface =
+static DEVICE_GET_INFO( subwoofer )
{
- subwoofer_sh_start,
- 0, /* none */
- 0 /* none */
-};
+ switch (state)
+ {
+ /* --- the following bits of info are returned as pointers to data or functions --- */
+ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(subwoofer); break;
+
+ /* --- the following bits of info are returned as NULL-terminated strings --- */
+ case DEVINFO_STR_NAME: strcpy(info->s, "Subwoofer"); break;
+ case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
+ }
+}
#endif
diff --git a/src/mame/drivers/wc90.c b/src/mame/drivers/wc90.c
index 028c2c47906..86c9fe5b67e 100644
--- a/src/mame/drivers/wc90.c
+++ b/src/mame/drivers/wc90.c
@@ -144,10 +144,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_ROM
AM_RANGE(0xf000, 0xf7ff) AM_RAM
- AM_RANGE(0xf800, 0xf800) AM_READWRITE(ym2608_status_port_0_a_r, ym2608_control_port_0_a_w)
- AM_RANGE(0xf801, 0xf801) AM_WRITE(ym2608_data_port_0_a_w)
- AM_RANGE(0xf802, 0xf802) AM_READWRITE(ym2608_status_port_0_b_r, ym2608_control_port_0_b_w)
- AM_RANGE(0xf803, 0xf803) AM_WRITE(ym2608_data_port_0_b_w)
+ AM_RANGE(0xf800, 0xf803) AM_DEVREADWRITE(SOUND, "ym", ym2608_r, ym2608_w)
AM_RANGE(0xfc00, 0xfc00) AM_READ(SMH_NOP) /* ??? adpcm ??? */
AM_RANGE(0xfc10, 0xfc10) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -283,9 +280,9 @@ GFXDECODE_END
/* handler called by the 2608 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[2],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[2],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2608_interface ym2608_config =
@@ -293,7 +290,7 @@ static const ym2608_interface ym2608_config =
{
AY8910_LEGACY_OUTPUT | AY8910_SINGLE_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
irqhandler
};
diff --git a/src/mame/drivers/wc90b.c b/src/mame/drivers/wc90b.c
index 90e724ee69c..51a8262cbd2 100644
--- a/src/mame/drivers/wc90b.c
+++ b/src/mame/drivers/wc90b.c
@@ -144,16 +144,16 @@ static WRITE8_HANDLER( wc90b_sound_command_w )
cpu_set_input_line(space->machine->cpu[2],0,HOLD_LINE);
}
-static WRITE8_HANDLER( adpcm_control_w )
+static WRITE8_DEVICE_HANDLER( adpcm_control_w )
{
int bankaddress;
- UINT8 *RAM = memory_region(space->machine, "sub");
+ UINT8 *RAM = memory_region(device->machine, "sub");
/* the code writes either 2 or 3 in the bottom two bits */
bankaddress = 0x10000 + (data & 0x01) * 0x4000;
- memory_set_bankptr(space->machine, 3,&RAM[bankaddress]);
+ memory_set_bankptr(device->machine, 3,&RAM[bankaddress]);
- msm5205_reset_w(0,data & 0x08);
+ msm5205_reset_w(device,data & 0x08);
}
static WRITE8_HANDLER( adpcm_data_w )
@@ -197,10 +197,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_cpu, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(3)
- AM_RANGE(0xe000, 0xe000) AM_WRITE(adpcm_control_w)
+ AM_RANGE(0xe000, 0xe000) AM_DEVWRITE(SOUND, "msm", adpcm_control_w)
AM_RANGE(0xe400, 0xe400) AM_WRITE(adpcm_data_w)
- AM_RANGE(0xe800, 0xe800) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0xe801, 0xe801) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
+ AM_RANGE(0xe800, 0xe801) AM_DEVREADWRITE(SOUND, "ym", ym2203_r, ym2203_w)
AM_RANGE(0xf000, 0xf7ff) AM_RAM
AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -347,9 +346,9 @@ GFXDECODE_END
/* handler called by the 2203 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[2], INPUT_LINE_NMI, irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[2], INPUT_LINE_NMI, irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface ym2203_config =
@@ -357,7 +356,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
irqhandler
};
@@ -366,7 +365,7 @@ static void adpcm_int(const device_config *device)
{
static int toggle = 0;
- msm5205_data_w (0,msm5205next);
+ msm5205_data_w (device,msm5205next);
msm5205next>>=4;
toggle ^= 1;
diff --git a/src/mame/drivers/wecleman.c b/src/mame/drivers/wecleman.c
index 2f809a5388a..e43d5ea5ee6 100644
--- a/src/mame/drivers/wecleman.c
+++ b/src/mame/drivers/wecleman.c
@@ -685,9 +685,9 @@ static WRITE8_HANDLER( multiply_w )
** sample playing ends when a byte with bit 7 set is reached **/
-static WRITE8_HANDLER( wecleman_K00723216_bank_w )
+static WRITE8_DEVICE_HANDLER( wecleman_K00723216_bank_w )
{
- k007232_set_bank( 0, 0, ~data&1 ); //* (wecleman062gre)
+ k007232_set_bank(device, 0, ~data&1 ); //* (wecleman062gre)
}
static ADDRESS_MAP_START( wecleman_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
@@ -698,10 +698,9 @@ static ADDRESS_MAP_START( wecleman_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x9000, 0x9001) AM_WRITE(multiply_w) // Protection
AM_RANGE(0x9006, 0x9006) AM_WRITE(SMH_NOP) // ?
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r) // From main CPU
- AM_RANGE(0xb000, 0xb00d) AM_READWRITE(k007232_read_port_0_r, k007232_write_port_0_w) // K007232 (Reading offset 5/b triggers the sample)
- AM_RANGE(0xc000, 0xc000) AM_WRITE(ym2151_register_port_0_w) // YM2151
- AM_RANGE(0xc001, 0xc001) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
- AM_RANGE(0xf000, 0xf000) AM_WRITE(wecleman_K00723216_bank_w) // Samples banking
+ AM_RANGE(0xb000, 0xb00d) AM_DEVREADWRITE(SOUND, "konami", k007232_r, k007232_w) // K007232 (Reading offset 5/b triggers the sample)
+ AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0xf000, 0xf000) AM_DEVWRITE(SOUND, "konami", wecleman_K00723216_bank_w) // Samples banking
ADDRESS_MAP_END
@@ -721,8 +720,14 @@ static WRITE16_HANDLER( hotchase_soundlatch_w )
static WRITE8_HANDLER( hotchase_sound_control_w )
{
+ const device_config *sound[3];
+
int reg[8];
+ sound[0] = devtag_get_device(space->machine, SOUND, "konami1");
+ sound[1] = devtag_get_device(space->machine, SOUND, "konami2");
+ sound[2] = devtag_get_device(space->machine, SOUND, "konami3");
+
reg[offset] = data;
switch (offset)
@@ -738,7 +743,7 @@ static WRITE8_HANDLER( hotchase_sound_control_w )
++------ chip select ( 0:chip 1, 1:chip2, 2:chip3)
data&0x0f left volume (data>>4)&0x0f right volume
*/
- k007232_set_volume( offset>>1, offset&1, (data&0x0f) * 0x08, (data>>4) * 0x08 );
+ k007232_set_volume( sound[offset>>1], offset&1, (data&0x0f) * 0x08, (data>>4) * 0x08 );
break;
case 0x06: /* Bankswitch for chips 0 & 1 */
@@ -750,8 +755,8 @@ static WRITE8_HANDLER( hotchase_sound_control_w )
// bit 6: chip 2 - ch0 ?
// bit 7: chip 2 - ch1 ?
- k007232_set_bank( 0, bank0_a, bank0_b );
- k007232_set_bank( 1, bank1_a, bank1_b );
+ k007232_set_bank( sound[0], bank0_a, bank0_b );
+ k007232_set_bank( sound[1], bank1_a, bank1_b );
}
break;
@@ -760,7 +765,7 @@ static WRITE8_HANDLER( hotchase_sound_control_w )
int bank2_a = (data >> 0) & 7;
int bank2_b = (data >> 3) & 7;
- k007232_set_bank( 2, bank2_a, bank2_b );
+ k007232_set_bank( sound[2], bank2_a, bank2_b );
}
break;
}
@@ -768,26 +773,21 @@ static WRITE8_HANDLER( hotchase_sound_control_w )
/* Read and write handlers for one K007232 chip:
even and odd register are mapped swapped */
-#define HOTCHASE_k007232_RW(_chip_) \
-static READ8_HANDLER( hotchase_k007232_##_chip_##_r ) \
-{ \
- return k007232_read_port_##_chip_##_r(space, offset ^ 1); \
-} \
-static WRITE8_HANDLER( hotchase_k007232_##_chip_##_w ) \
-{ \
- k007232_write_port_##_chip_##_w(space, offset ^ 1, data); \
-} \
-
-/* 3 x K007232 */
-HOTCHASE_k007232_RW(0)
-HOTCHASE_k007232_RW(1)
-HOTCHASE_k007232_RW(2)
+static READ8_DEVICE_HANDLER( hotchase_k007232_r )
+{
+ return k007232_r(device, offset ^ 1);
+}
+
+static WRITE8_DEVICE_HANDLER( hotchase_k007232_w )
+{
+ k007232_w(device, offset ^ 1, data);
+}
static ADDRESS_MAP_START( hotchase_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM
- AM_RANGE(0x1000, 0x100d) AM_READWRITE(hotchase_k007232_0_r, hotchase_k007232_0_w) // 3 x K007232
- AM_RANGE(0x2000, 0x200d) AM_READWRITE(hotchase_k007232_1_r, hotchase_k007232_1_w)
- AM_RANGE(0x3000, 0x300d) AM_READWRITE(hotchase_k007232_2_r, hotchase_k007232_2_w)
+ AM_RANGE(0x1000, 0x100d) AM_DEVREADWRITE(SOUND, "konami1", hotchase_k007232_r, hotchase_k007232_w) // 3 x K007232
+ AM_RANGE(0x2000, 0x200d) AM_DEVREADWRITE(SOUND, "konami2", hotchase_k007232_r, hotchase_k007232_w)
+ AM_RANGE(0x3000, 0x300d) AM_DEVREADWRITE(SOUND, "konami3", hotchase_k007232_r, hotchase_k007232_w)
AM_RANGE(0x4000, 0x4007) AM_WRITE(hotchase_sound_control_w) // Sound volume, banking, etc.
AM_RANGE(0x5000, 0x5000) AM_WRITE(SMH_NOP) // ? (written with 0 on IRQ, 1 on FIRQ)
AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r) // From main CPU (Read on IRQ)
@@ -1074,7 +1074,7 @@ static INTERRUPT_GEN( wecleman_interrupt )
static MACHINE_RESET( wecleman )
{
- k007232_set_bank( 0, 0, 1 );
+ k007232_set_bank( devtag_get_device(machine, SOUND, "konami"), 0, 1 );
}
static MACHINE_DRIVER_START( wecleman )
diff --git a/src/mame/drivers/welltris.c b/src/mame/drivers/welltris.c
index 3de19b00e3b..734a2620651 100644
--- a/src/mame/drivers/welltris.c
+++ b/src/mame/drivers/welltris.c
@@ -397,10 +397,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_port_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_WRITE(welltris_sh_bankswitch_w)
- AM_RANGE(0x08, 0x08) AM_READWRITE(ym2610_status_port_0_a_r,ym2610_control_port_0_a_w)
- AM_RANGE(0x09, 0x09) AM_WRITE(ym2610_data_port_0_a_w)
- AM_RANGE(0x0a, 0x0a) AM_READWRITE(ym2610_status_port_0_b_r,ym2610_control_port_0_b_w)
- AM_RANGE(0x0b, 0x0b) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE(SOUND, "ym", ym2610_r, ym2610_w)
AM_RANGE(0x10, 0x10) AM_READ(soundlatch_r)
AM_RANGE(0x18, 0x18) AM_WRITE(pending_command_clear_w)
ADDRESS_MAP_END
@@ -689,9 +686,9 @@ GFXDECODE_END
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface ym2610_config =
diff --git a/src/mame/drivers/wgp.c b/src/mame/drivers/wgp.c
index 89ed86db6a5..9d3200860f2 100644
--- a/src/mame/drivers/wgp.c
+++ b/src/mame/drivers/wgp.c
@@ -691,10 +691,7 @@ static ADDRESS_MAP_START( z80_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK10) /* Fallthrough */
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0xc000, 0xdfff) AM_RAM
- AM_RANGE(0xe000, 0xe000) AM_READWRITE(ym2610_status_port_0_a_r,ym2610_control_port_0_a_w)
- AM_RANGE(0xe001, 0xe001) AM_READWRITE(ym2610_read_port_0_r,ym2610_data_port_0_a_w)
- AM_RANGE(0xe002, 0xe002) AM_READWRITE(ym2610_status_port_0_b_r,ym2610_control_port_0_b_w)
- AM_RANGE(0xe003, 0xe003) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0xe000, 0xe003) AM_DEVREADWRITE(SOUND, "ym", ym2610_r, ym2610_w)
AM_RANGE(0xe200, 0xe200) AM_READWRITE(SMH_NOP,taitosound_slave_port_w)
AM_RANGE(0xe201, 0xe201) AM_READWRITE(taitosound_slave_comm_r,taitosound_slave_comm_w)
AM_RANGE(0xe400, 0xe403) AM_WRITE(SMH_NOP) /* pan */
@@ -914,9 +911,9 @@ GFXDECODE_END
**************************************************************/
/* handler called by the YM2610 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq) // assumes Z80 sandwiched between 68Ks
+static void irqhandler(const device_config *device, int irq) // assumes Z80 sandwiched between 68Ks
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface ym2610_config =
diff --git a/src/mame/drivers/williams.c b/src/mame/drivers/williams.c
index 2cb350c674b..f9e4d4d9aca 100644
--- a/src/mame/drivers/williams.c
+++ b/src/mame/drivers/williams.c
@@ -1447,7 +1447,7 @@ static MACHINE_DRIVER_START( defender )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("dac", DAC, 0)
+ MDRV_SOUND_ADD("wmsdac", DAC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
/* pia */
diff --git a/src/mame/drivers/wink.c b/src/mame/drivers/wink.c
index df3bd5492cc..8bdb1a9e61e 100644
--- a/src/mame/drivers/wink.c
+++ b/src/mame/drivers/wink.c
@@ -133,8 +133,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( wink_sound_io, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READWRITE(ay8910_read_port_0_r, ay8910_write_port_0_w)
- AM_RANGE(0x80, 0x80) AM_WRITE(ay8910_control_port_0_w)
+ AM_RANGE(0x00, 0x00) AM_DEVREADWRITE(SOUND, "ay", ay8910_r, ay8910_data_w)
+ AM_RANGE(0x80, 0x80) AM_DEVWRITE(SOUND, "ay", ay8910_address_w)
ADDRESS_MAP_END
static INPUT_PORTS_START( wink )
@@ -294,7 +294,7 @@ static GFXDECODE_START( wink )
GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 4 )
GFXDECODE_END
-static READ8_HANDLER( sound_r )
+static READ8_DEVICE_HANDLER( sound_r )
{
return sound_flag;
}
@@ -303,10 +303,10 @@ static const ay8910_interface ay8912_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- sound_r,
- NULL,
- NULL,
- NULL
+ DEVCB_HANDLER(sound_r),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
};
//AY portA is fed by an input clock at 15625 Hz
diff --git a/src/mame/drivers/wiping.c b/src/mame/drivers/wiping.c
index d0afca0c42c..09fc22c8aec 100644
--- a/src/mame/drivers/wiping.c
+++ b/src/mame/drivers/wiping.c
@@ -35,7 +35,6 @@ dip: 6.7 7.7
***************************************************************************/
#include "driver.h"
#include "cpu/z80/z80.h"
-#include "sound/custom.h"
WRITE8_HANDLER( wiping_flipscreen_w );
@@ -43,7 +42,10 @@ PALETTE_INIT( wiping );
VIDEO_UPDATE( wiping );
extern UINT8 *wiping_soundregs;
-CUSTOM_START( wiping_sh_start );
+
+DEVICE_GET_INFO( wiping_sound );
+#define SOUND_WIPING DEVICE_GET_INFO_NAME(wiping_sound)
+
WRITE8_HANDLER( wiping_sound_w );
@@ -287,13 +289,6 @@ GFXDECODE_END
-static const custom_sound_interface custom_interface =
-{
- wiping_sh_start
-};
-
-
-
static MACHINE_DRIVER_START( wiping )
/* basic machine hardware */
@@ -322,8 +317,7 @@ static MACHINE_DRIVER_START( wiping )
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
- MDRV_SOUND_ADD("wiping", CUSTOM, 0)
- MDRV_SOUND_CONFIG(custom_interface)
+ MDRV_SOUND_ADD("wiping", WIPING, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/witch.c b/src/mame/drivers/witch.c
index 1dc596ec620..528186e19b3 100644
--- a/src/mame/drivers/witch.c
+++ b/src/mame/drivers/witch.c
@@ -400,29 +400,26 @@ static READ8_HANDLER(prot_read_700x)
* Status from ES8712?
* BIT1 is zero when no sample is playing?
*/
-static READ8_HANDLER(read_8010) { return 0x00; }
+static READ8_DEVICE_HANDLER(read_8010) { return 0x00; }
-static WRITE8_HANDLER(xscroll_w)
+static WRITE8_DEVICE_HANDLER(xscroll_w)
{
scrollx=data;
}
-static WRITE8_HANDLER(yscroll_w)
+static WRITE8_DEVICE_HANDLER(yscroll_w)
{
scrolly=data;
}
-static READ8_HANDLER(portA_r) { return input_port_read(space->machine, "YM_PortA"); }
-static READ8_HANDLER(portB_r) { return input_port_read(space->machine, "YM_PortB");}
-
static const ym2203_interface ym2203_interface_0 =
{
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- portA_r,
- portB_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("YM_PortA"),
+ DEVCB_INPUT_PORT("YM_PortB"),
+ DEVCB_NULL,
+ DEVCB_NULL
},
NULL
};
@@ -432,10 +429,10 @@ static const ym2203_interface ym2203_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- xscroll_w,
- yscroll_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(xscroll_w),
+ DEVCB_HANDLER(yscroll_w)
},
NULL
};
@@ -443,10 +440,8 @@ static const ym2203_interface ym2203_interface_1 =
static ADDRESS_MAP_START( map_main, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, UNBANKED_SIZE-1) AM_ROM
AM_RANGE(UNBANKED_SIZE, 0x7fff) AM_READ(SMH_BANK1)
- AM_RANGE(0x8000, 0x8000) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x8001, 0x8001) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
- AM_RANGE(0x8008, 0x8008) AM_READWRITE(ym2203_status_port_1_r, ym2203_control_port_1_w)
- AM_RANGE(0x8009, 0x8009) AM_READWRITE(ym2203_read_port_1_r, ym2203_write_port_1_w)
+ AM_RANGE(0x8000, 0x8001) AM_DEVREADWRITE(SOUND, "ym1", ym2203_r, ym2203_w)
+ AM_RANGE(0x8008, 0x8009) AM_DEVREADWRITE(SOUND, "ym2", ym2203_r, ym2203_w)
AM_RANGE(0xa000, 0xa00f) AM_READWRITE(read_a00x, write_a00x)
AM_RANGE(0xc000, 0xc3ff) AM_READWRITE(gfx0_vram_r, gfx0_vram_w) AM_BASE(&gfx0_vram)
AM_RANGE(0xc400, 0xc7ff) AM_READWRITE(gfx0_cram_r, gfx0_cram_w) AM_BASE(&gfx0_cram)
@@ -463,11 +458,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( map_sub, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
- AM_RANGE(0x8000, 0x8000) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x8001, 0x8001) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
- AM_RANGE(0x8008, 0x8008) AM_READWRITE(ym2203_status_port_1_r, ym2203_control_port_1_w)
- AM_RANGE(0x8009, 0x8009) AM_READWRITE(ym2203_read_port_1_r, ym2203_write_port_1_w)
- AM_RANGE(0x8010, 0x8016) AM_READWRITE(read_8010, es8712_data_0_w)
+ AM_RANGE(0x8000, 0x8001) AM_DEVREADWRITE(SOUND, "ym1", ym2203_r, ym2203_w)
+ AM_RANGE(0x8008, 0x8009) AM_DEVREADWRITE(SOUND, "ym2", ym2203_r, ym2203_w)
+ AM_RANGE(0x8010, 0x8016) AM_DEVREADWRITE(SOUND, "es", read_8010, es8712_w)
AM_RANGE(0xa000, 0xa00f) AM_READWRITE(read_a00x, write_a00x)
AM_RANGE(0xf000, 0xf0ff) AM_RAM AM_SHARE(1)
AM_RANGE(0xf180, 0xffff) AM_RAM AM_SHARE(2)
diff --git a/src/mame/drivers/wiz.c b/src/mame/drivers/wiz.c
index c1780f9009e..93985fb5a8f 100644
--- a/src/mame/drivers/wiz.c
+++ b/src/mame/drivers/wiz.c
@@ -189,6 +189,8 @@ static int dsc0, dsc1;
static WRITE8_HANDLER( sound_command_w )
{
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+
switch (offset)
{
// 0x90 triggers a jump to non-existant address(development system?) and must be filtered
@@ -198,14 +200,14 @@ static WRITE8_HANDLER( sound_command_w )
// explosion sound trigger(analog?)
case 0x08:
- discrete_sound_w(space, STINGER_BOOM_EN1, dsc1);
- discrete_sound_w(space, STINGER_BOOM_EN2, dsc1^=1);
+ discrete_sound_w(discrete, STINGER_BOOM_EN1, dsc1);
+ discrete_sound_w(discrete, STINGER_BOOM_EN2, dsc1^=1);
break;
// player shot sound trigger(analog?)
case 0x0a:
- discrete_sound_w(space, STINGER_SHOT_EN1, dsc0);
- discrete_sound_w(space, STINGER_SHOT_EN2, dsc0^=1);
+ discrete_sound_w(discrete, STINGER_SHOT_EN1, dsc0);
+ discrete_sound_w(discrete, STINGER_SHOT_EN2, dsc0^=1);
break;
}
}
@@ -261,12 +263,18 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_ROM
AM_RANGE(0x2000, 0x23ff) AM_RAM
AM_RANGE(0x3000, 0x3000) AM_READWRITE(soundlatch_r,interrupt_enable_w) /* Stinger/Scion */
- AM_RANGE(0x4000, 0x4000) AM_WRITE(ay8910_control_port_2_w)
- AM_RANGE(0x4001, 0x4001) AM_WRITE(ay8910_write_port_2_w)
- AM_RANGE(0x5000, 0x5000) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x5001, 0x5001) AM_WRITE(ay8910_write_port_0_w)
- AM_RANGE(0x6000, 0x6000) AM_WRITE(ay8910_control_port_1_w) /* Wiz only */
- AM_RANGE(0x6001, 0x6001) AM_WRITE(ay8910_write_port_1_w) /* Wiz only */
+ AM_RANGE(0x4000, 0x4001) AM_DEVWRITE(SOUND, "8910.3", ay8910_address_data_w)
+ AM_RANGE(0x5000, 0x5001) AM_DEVWRITE(SOUND, "8910.1", ay8910_address_data_w)
+ AM_RANGE(0x6000, 0x6001) AM_DEVWRITE(SOUND, "8910.2", ay8910_address_data_w) /* Wiz only */
+ AM_RANGE(0x7000, 0x7000) AM_READWRITE(soundlatch_r,interrupt_enable_w) /* Wiz */
+ADDRESS_MAP_END
+
+static ADDRESS_MAP_START( stinger_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
+ AM_RANGE(0x0000, 0x1fff) AM_ROM
+ AM_RANGE(0x2000, 0x23ff) AM_RAM
+ AM_RANGE(0x3000, 0x3000) AM_READWRITE(soundlatch_r,interrupt_enable_w) /* Stinger/Scion */
+ AM_RANGE(0x5000, 0x5001) AM_DEVWRITE(SOUND, "8910.1", ay8910_address_data_w)
+ AM_RANGE(0x6000, 0x6001) AM_DEVWRITE(SOUND, "8910.2", ay8910_address_data_w) /* Wiz only */
AM_RANGE(0x7000, 0x7000) AM_READWRITE(soundlatch_r,interrupt_enable_w) /* Wiz */
ADDRESS_MAP_END
@@ -733,6 +741,9 @@ static MACHINE_DRIVER_START( stinger )
/* basic machine hardware */
MDRV_IMPORT_FROM(wiz)
+
+ MDRV_CPU_MODIFY("audio")
+ MDRV_CPU_PROGRAM_MAP(stinger_sound_map,0)
/* video hardware */
MDRV_GFXDECODE(stinger)
diff --git a/src/mame/drivers/wldarrow.c b/src/mame/drivers/wldarrow.c
index 1ad13359e46..82df22e9491 100644
--- a/src/mame/drivers/wldarrow.c
+++ b/src/mame/drivers/wldarrow.c
@@ -128,27 +128,27 @@ static WRITE8_HANDLER( counter_w )
*
*************************************/
-static WRITE8_HANDLER( wldarrow_dac_1_w )
+static WRITE8_DEVICE_HANDLER( wldarrow_dac_1_w )
{
- dac_data_w(0, 0x00);
+ dac_data_w(device, 0x00);
}
-static WRITE8_HANDLER( wldarrow_dac_2_w )
+static WRITE8_DEVICE_HANDLER( wldarrow_dac_2_w )
{
- dac_data_w(0, 0x55);
+ dac_data_w(device, 0x55);
}
-static WRITE8_HANDLER( wldarrow_dac_3_w )
+static WRITE8_DEVICE_HANDLER( wldarrow_dac_3_w )
{
- dac_data_w(0, 0xaa);
+ dac_data_w(device, 0xaa);
}
-static WRITE8_HANDLER( wldarrow_dac_4_w )
+static WRITE8_DEVICE_HANDLER( wldarrow_dac_4_w )
{
- dac_data_w(0, 0xff);
+ dac_data_w(device, 0xff);
}
@@ -166,13 +166,13 @@ static ADDRESS_MAP_START( wldarrow_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x6000, 0x7fff) AM_RAM AM_BASE(&wldarrow_videoram_1)
AM_RANGE(0x8000, 0x9fff) AM_RAM AM_BASE(&wldarrow_videoram_2)
AM_RANGE(0xcd00, 0xcdff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
- AM_RANGE(0xf000, 0xf000) AM_READ_PORT("BITSW") AM_WRITE(wldarrow_dac_1_w)
+ AM_RANGE(0xf000, 0xf000) AM_READ_PORT("BITSW") AM_DEVWRITE(SOUND, "dac", wldarrow_dac_1_w)
AM_RANGE(0xf004, 0xf004) AM_READ_PORT("IN1") AM_WRITE(lights_1_w)
AM_RANGE(0xf006, 0xf006) AM_READ_PORT("IN2") AM_WRITE(lights_2_w)
AM_RANGE(0xf008, 0xf008) AM_WRITE(counter_w)
- AM_RANGE(0xf00f, 0xf00f) AM_WRITE(wldarrow_dac_2_w)
- AM_RANGE(0xf0f0, 0xf0f0) AM_WRITE(wldarrow_dac_3_w)
- AM_RANGE(0xf0ff, 0xf0ff) AM_WRITE(wldarrow_dac_4_w)
+ AM_RANGE(0xf00f, 0xf00f) AM_DEVWRITE(SOUND, "dac", wldarrow_dac_2_w)
+ AM_RANGE(0xf0f0, 0xf0f0) AM_DEVWRITE(SOUND, "dac", wldarrow_dac_3_w)
+ AM_RANGE(0xf0ff, 0xf0ff) AM_DEVWRITE(SOUND, "dac", wldarrow_dac_4_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/wolfpack.c b/src/mame/drivers/wolfpack.c
index 83d1c512f16..f4c318653f5 100644
--- a/src/mame/drivers/wolfpack.c
+++ b/src/mame/drivers/wolfpack.c
@@ -61,6 +61,7 @@ static CUSTOM_INPUT( wolfpack_dial_r )
static READ8_HANDLER( wolfpack_misc_r )
{
+ const device_config *device = devtag_get_device(space->machine, SOUND, "speech");
UINT8 val = 0;
/* BIT0 => SPEECH BUSY */
@@ -72,7 +73,7 @@ static READ8_HANDLER( wolfpack_misc_r )
/* BIT6 => UNUSED */
/* BIT7 => VBLANK */
- if (!s14001a_bsy_0_r())
+ if (!s14001a_bsy_r(device))
val |= 0x01;
if (!wolfpack_collision)
@@ -96,17 +97,17 @@ static WRITE8_HANDLER( wolfpack_lamp_flash_w ) {}
static WRITE8_HANDLER( wolfpack_warning_light_w ) {}
static WRITE8_HANDLER( wolfpack_audamp_w ) {}
-static WRITE8_HANDLER( wolfpack_word_w )
+static WRITE8_DEVICE_HANDLER( wolfpack_word_w )
{
/* latch word from bus into temp register, and place on s14001a input bus */
/* there is no real need for a temp register at all, since the bus 'register' acts as one */
- s14001a_reg_0_w(data & 0x1f); /* SA0 (IN5) is pulled low according to the schematic, so its 0x1f and not 0x3f as one would expect */
+ s14001a_reg_w(device, data & 0x1f); /* SA0 (IN5) is pulled low according to the schematic, so its 0x1f and not 0x3f as one would expect */
}
-static WRITE8_HANDLER( wolfpack_start_speech_w )
+static WRITE8_DEVICE_HANDLER( wolfpack_start_speech_w )
{
- s14001a_set_volume(15); /* hack, should be executed just once during game init, or defaulted to this in the s14001a core */
- s14001a_rst_0_w(data&1);
+ s14001a_set_volume(device, 15); /* hack, should be executed just once during game init, or defaulted to this in the s14001a core */
+ s14001a_rst_w(device, data&1);
}
@@ -137,7 +138,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x2001, 0x2001) AM_WRITE(wolfpack_sonar_ping_w)
AM_RANGE(0x2002, 0x2002) AM_WRITE(wolfpack_sirlat_w)
AM_RANGE(0x2003, 0x2003) AM_WRITE(wolfpack_pt_sound_w)
- AM_RANGE(0x2004, 0x2004) AM_WRITE(wolfpack_start_speech_w)
+ AM_RANGE(0x2004, 0x2004) AM_DEVWRITE(SOUND, "speech", wolfpack_start_speech_w)
AM_RANGE(0x2005, 0x2005) AM_WRITE(wolfpack_launch_torpedo_w)
AM_RANGE(0x2006, 0x2006) AM_WRITE(wolfpack_low_explo_w)
AM_RANGE(0x2007, 0x2007) AM_WRITE(wolfpack_screw_cont_w)
@@ -152,7 +153,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x3000, 0x3000) AM_WRITE(wolfpack_audamp_w)
AM_RANGE(0x3001, 0x3001) AM_WRITE(wolfpack_pt_horz_w)
AM_RANGE(0x3003, 0x3003) AM_WRITE(wolfpack_pt_pic_w)
- AM_RANGE(0x3004, 0x3004) AM_WRITE(wolfpack_word_w)
+ AM_RANGE(0x3004, 0x3004) AM_DEVWRITE(SOUND, "speech", wolfpack_word_w)
AM_RANGE(0x3007, 0x3007) AM_WRITE(wolfpack_coldetres_w)
AM_RANGE(0x4000, 0x4000) AM_WRITE(wolfpack_ship_h_w)
AM_RANGE(0x4001, 0x4001) AM_WRITE(wolfpack_torpedo_pic_w)
diff --git a/src/mame/drivers/wrally.c b/src/mame/drivers/wrally.c
index 952d6c6222c..f2519655a67 100644
--- a/src/mame/drivers/wrally.c
+++ b/src/mame/drivers/wrally.c
@@ -114,7 +114,7 @@ static ADDRESS_MAP_START( wrally_readmem, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x700004, 0x700005) AM_READ_PORT("WHEEL")
AM_RANGE(0x700008, 0x700009) AM_READ_PORT("SYSTEM")
AM_RANGE(0x70000c, 0x70000d) AM_WRITE(OKIM6295_bankswitch_w) /* OKI6295 bankswitch */
- AM_RANGE(0x70000e, 0x70000f) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w) /* OKI6295 status/data register */
+ AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff) /* OKI6295 status/data register */
AM_RANGE(0x70000a, 0x70001b) AM_WRITE(wrally_coin_lockout_w) /* Coin lockouts */
AM_RANGE(0x70002a, 0x70003b) AM_WRITE(wrally_coin_counter_w) /* Coin counters */
AM_RANGE(0x70004a, 0x70004b) AM_WRITE(SMH_NOP) /* Sound muting */
diff --git a/src/mame/drivers/wwfsstar.c b/src/mame/drivers/wwfsstar.c
index 6f83f100898..3b0c13e118d 100644
--- a/src/mame/drivers/wwfsstar.c
+++ b/src/mame/drivers/wwfsstar.c
@@ -189,9 +189,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
- AM_RANGE(0x8800, 0x8800) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0x8801, 0x8801) AM_READWRITE(ym2151_status_port_0_r,ym2151_data_port_0_w)
- AM_RANGE(0x9800, 0x9800) AM_READWRITE(okim6295_status_0_r,okim6295_data_0_w)
+ AM_RANGE(0x8800, 0x8801) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
@@ -420,9 +419,9 @@ GFXDECODE_END
Straight from Ddragon 3
*******************************************************************************/
-static void wwfsstar_ymirq_handler(running_machine *machine, int irq)
+static void wwfsstar_ymirq_handler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1], 0 , irq ? ASSERT_LINE : CLEAR_LINE );
+ cpu_set_input_line(device->machine->cpu[1], 0 , irq ? ASSERT_LINE : CLEAR_LINE );
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/wwfwfest.c b/src/mame/drivers/wwfwfest.c
index e53c0cacaad..9a256ca9ba6 100644
--- a/src/mame/drivers/wwfwfest.c
+++ b/src/mame/drivers/wwfwfest.c
@@ -53,7 +53,7 @@ static READ16_HANDLER( wwfwfest_paletteram16_xxxxBBBBGGGGRRRR_word_r );
static WRITE16_HANDLER( wwfwfest_paletteram16_xxxxBBBBGGGGRRRR_word_w );
static WRITE16_HANDLER( wwfwfest_1410_write ); /* priority write */
static WRITE16_HANDLER( wwfwfest_scroll_write ); /* scrolling write */
-static WRITE8_HANDLER( oki_bankswitch_w );
+static WRITE8_DEVICE_HANDLER( oki_bankswitch_w );
static WRITE16_HANDLER ( wwfwfest_soundwrite );
static WRITE16_HANDLER ( wwfwfest_flipscreen_w );
static WRITE16_HANDLER ( wwfwfest_irq_ack_w );
@@ -88,11 +88,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xc7ff) AM_RAM
- AM_RANGE(0xc800, 0xc800) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xc801, 0xc801) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
- AM_RANGE(0xd800, 0xd800) AM_READWRITE(okim6295_status_0_r,okim6295_data_0_w)
+ AM_RANGE(0xc800, 0xc801) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
+ AM_RANGE(0xd800, 0xd800) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
- AM_RANGE(0xe800, 0xe800) AM_WRITE(oki_bankswitch_w)
+ AM_RANGE(0xe800, 0xe800) AM_DEVWRITE(SOUND, "oki", oki_bankswitch_w)
ADDRESS_MAP_END
/*******************************************************************************
@@ -159,9 +158,9 @@ static WRITE16_HANDLER( wwfwfest_scroll_write )
/*- Sound Related (from dd3) -*/
-static WRITE8_HANDLER( oki_bankswitch_w )
+static WRITE8_DEVICE_HANDLER( oki_bankswitch_w )
{
- okim6295_set_bank_base(0, (data & 1) * 0x40000);
+ okim6295_set_bank_base(device, (data & 1) * 0x40000);
}
static WRITE16_HANDLER ( wwfwfest_soundwrite )
@@ -370,9 +369,9 @@ static TIMER_DEVICE_CALLBACK( wwfwfest_scanline )
Straight from Ddragon 3 with some adjusted volumes
*******************************************************************************/
-static void dd3_ymirq_handler(running_machine *machine, int irq)
+static void dd3_ymirq_handler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1], 0 , irq ? ASSERT_LINE : CLEAR_LINE );
+ cpu_set_input_line(device->machine->cpu[1], 0 , irq ? ASSERT_LINE : CLEAR_LINE );
}
static const ym2151_interface ym2151_config =
diff --git a/src/mame/drivers/xain.c b/src/mame/drivers/xain.c
index 5a9beb32d93..a0f65710ab6 100644
--- a/src/mame/drivers/xain.c
+++ b/src/mame/drivers/xain.c
@@ -338,10 +338,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM
AM_RANGE(0x1000, 0x1000) AM_READ(soundlatch_r)
- AM_RANGE(0x2800, 0x2800) AM_WRITE(ym2203_control_port_0_w)
- AM_RANGE(0x2801, 0x2801) AM_WRITE(ym2203_write_port_0_w)
- AM_RANGE(0x3000, 0x3000) AM_WRITE(ym2203_control_port_1_w)
- AM_RANGE(0x3001, 0x3001) AM_WRITE(ym2203_write_port_1_w)
+ AM_RANGE(0x2800, 0x2801) AM_DEVWRITE(SOUND, "ym1", ym2203_w)
+ AM_RANGE(0x3000, 0x3001) AM_DEVWRITE(SOUND, "ym2", ym2203_w)
AM_RANGE(0x4000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -454,9 +452,9 @@ GFXDECODE_END
/* handler called by the 2203 emulator when the internal timers cause an IRQ */
-static void irqhandler(running_machine *machine, int irq)
+static void irqhandler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[2],M6809_FIRQ_LINE,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[2],M6809_FIRQ_LINE,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface ym2203_config =
@@ -464,7 +462,7 @@ static const ym2203_interface ym2203_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL, NULL, NULL, NULL
+ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
},
irqhandler
};
diff --git a/src/mame/drivers/xexex.c b/src/mame/drivers/xexex.c
index 9f3bef6ed37..0ec25e4d811 100644
--- a/src/mame/drivers/xexex.c
+++ b/src/mame/drivers/xexex.c
@@ -291,12 +291,12 @@ static WRITE8_HANDLER( sound_bankswitch_w )
reset_sound_region(space->machine);
}
-static void ym_set_mixing(double left, double right)
+static void ym_set_mixing(const device_config *device, double left, double right)
{
- flt_volume_set_volume(0, (71.0*left)/55.0);
- flt_volume_set_volume(1, (71.0*right)/55.0);
- flt_volume_set_volume(2, (71.0*left)/55.0);
- flt_volume_set_volume(3, (71.0*right)/55.0);
+ flt_volume_set_volume(devtag_get_device(device->machine, SOUND, "filter1l"), (71.0*left)/55.0);
+ flt_volume_set_volume(devtag_get_device(device->machine, SOUND, "filter1r"), (71.0*right)/55.0);
+ flt_volume_set_volume(devtag_get_device(device->machine, SOUND, "filter2l"), (71.0*left)/55.0);
+ flt_volume_set_volume(devtag_get_device(device->machine, SOUND, "filter2r"), (71.0*right)/55.0);
}
static TIMER_CALLBACK( dmaend_callback )
@@ -395,9 +395,8 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK2)
AM_RANGE(0x0000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xdfff) AM_RAM
- AM_RANGE(0xe000, 0xe22f) AM_READWRITE(k054539_0_r, k054539_0_w)
- AM_RANGE(0xec00, 0xec00) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xec01, 0xec01) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0xe000, 0xe22f) AM_DEVREADWRITE(SOUND, "konami", k054539_r, k054539_w)
+ AM_RANGE(0xec00, 0xec01) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch3_w)
AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_r)
AM_RANGE(0xf003, 0xf003) AM_READ(soundlatch2_r)
@@ -607,7 +606,7 @@ static MACHINE_RESET( xexex )
suspension_active = 0;
resume_trigger = 0;
frame = -1;
- k054539_init_flags(0, K054539_REVERSE_STEREO);
+ k054539_init_flags(devtag_get_device(machine, SOUND, "konami"), K054539_REVERSE_STEREO);
}
static STATE_POSTLOAD( xexex_postload )
diff --git a/src/mame/drivers/xmen.c b/src/mame/drivers/xmen.c
index c94ccabbc8b..fc15dae4666 100644
--- a/src/mame/drivers/xmen.c
+++ b/src/mame/drivers/xmen.c
@@ -181,9 +181,8 @@ static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK4)
AM_RANGE(0x8000, 0xbfff) AM_WRITE(SMH_ROM)
AM_RANGE(0xc000, 0xdfff) AM_RAM
- AM_RANGE(0xe000, 0xe22f) AM_READWRITE(k054539_0_r, k054539_0_w)
- AM_RANGE(0xe800, 0xe800) AM_WRITE(ym2151_register_port_0_w)
- AM_RANGE(0xec01, 0xec01) AM_READWRITE(ym2151_status_port_0_r, ym2151_data_port_0_w)
+ AM_RANGE(0xe000, 0xe22f) AM_DEVREADWRITE(SOUND, "konami", k054539_r, k054539_w)
+ AM_RANGE(0xe800, 0xe801) AM_MIRROR(0x0400) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w)
AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch2_w)
AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_r)
AM_RANGE(0xf800, 0xf800) AM_WRITE(sound_bankswitch_w)
diff --git a/src/mame/drivers/xorworld.c b/src/mame/drivers/xorworld.c
index 1352867e745..8d5177ca083 100644
--- a/src/mame/drivers/xorworld.c
+++ b/src/mame/drivers/xorworld.c
@@ -98,8 +98,8 @@ static ADDRESS_MAP_START( xorworld_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x200000, 0x200001) AM_READ_PORT("P1")
AM_RANGE(0x400000, 0x400001) AM_READ_PORT("P2")
AM_RANGE(0x600000, 0x600001) AM_READ_PORT("DSW")
- AM_RANGE(0x800000, 0x800001) AM_WRITE(saa1099_write_port_0_lsb_w)
- AM_RANGE(0x800002, 0x800003) AM_WRITE(saa1099_control_port_0_lsb_w)
+ AM_RANGE(0x800000, 0x800001) AM_DEVWRITE8(SOUND, "saa", saa1099_data_w, 0x00ff)
+ AM_RANGE(0x800002, 0x800003) AM_DEVWRITE8(SOUND, "saa", saa1099_control_w, 0x00ff)
AM_RANGE(0xa00008, 0xa00009) AM_WRITE(eeprom_chip_select_w)
AM_RANGE(0xa0000a, 0xa0000b) AM_WRITE(eeprom_serial_clock_w)
AM_RANGE(0xa0000c, 0xa0000d) AM_WRITE(eeprom_data_w)
diff --git a/src/mame/drivers/xtheball.c b/src/mame/drivers/xtheball.c
index 23d2f147c8d..77ee85638db 100644
--- a/src/mame/drivers/xtheball.c
+++ b/src/mame/drivers/xtheball.c
@@ -119,20 +119,6 @@ static void xtheball_from_shiftreg(const address_space *space, UINT32 address, U
/*************************************
*
- * Sound data access
- *
- *************************************/
-
-static WRITE16_HANDLER( dac_w )
-{
- if (ACCESSING_BITS_8_15)
- dac_data_w(0, data >> 8);
-}
-
-
-
-/*************************************
- *
* Output ports
*
*************************************/
@@ -249,7 +235,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x03040160, 0x0304016f) AM_READ_PORT("SERVICE")
AM_RANGE(0x03040170, 0x0304017f) AM_READ_PORT("SERVICE1")
AM_RANGE(0x03040180, 0x0304018f) AM_READ(analogy_watchdog_r)
- AM_RANGE(0x03060000, 0x0306000f) AM_WRITE(dac_w)
+ AM_RANGE(0x03060000, 0x0306000f) AM_DEVWRITE8(SOUND, "dac", dac_w, 0xff00)
AM_RANGE(0x04000000, 0x057fffff) AM_ROM AM_REGION("user2", 0)
AM_RANGE(0xc0000000, 0xc00001ff) AM_READWRITE(tms34010_io_register_r, tms34010_io_register_w)
AM_RANGE(0xfff80000, 0xffffffff) AM_ROM AM_REGION("user1", 0)
diff --git a/src/mame/drivers/xxmissio.c b/src/mame/drivers/xxmissio.c
index 3536ee43049..d5fbadabcf5 100644
--- a/src/mame/drivers/xxmissio.c
+++ b/src/mame/drivers/xxmissio.c
@@ -23,8 +23,8 @@ extern UINT8 *xxmissio_spriteram;
static UINT8 xxmissio_status;
-WRITE8_HANDLER( xxmissio_scroll_x_w );
-WRITE8_HANDLER( xxmissio_scroll_y_w );
+WRITE8_DEVICE_HANDLER( xxmissio_scroll_x_w );
+WRITE8_DEVICE_HANDLER( xxmissio_scroll_y_w );
WRITE8_HANDLER( xxmissio_flipscreen_w );
READ8_HANDLER( xxmissio_bgram_r );
@@ -104,10 +104,8 @@ static MACHINE_START( xxmissio )
static ADDRESS_MAP_START( map1, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
- AM_RANGE(0x8000, 0x8000) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x8001, 0x8001) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
- AM_RANGE(0x8002, 0x8002) AM_READWRITE(ym2203_status_port_1_r, ym2203_control_port_1_w)
- AM_RANGE(0x8003, 0x8003) AM_READWRITE(ym2203_read_port_1_r, ym2203_write_port_1_w)
+ AM_RANGE(0x8000, 0x8001) AM_DEVREADWRITE(SOUND, "ym1", ym2203_r, ym2203_w)
+ AM_RANGE(0x8002, 0x8003) AM_DEVREADWRITE(SOUND, "ym2", ym2203_r, ym2203_w)
AM_RANGE(0xa000, 0xa000) AM_READ_PORT("P1")
AM_RANGE(0xa001, 0xa001) AM_READ_PORT("P2")
@@ -130,10 +128,8 @@ static ADDRESS_MAP_START( map2, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x3fff) AM_ROM
AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(1)
- AM_RANGE(0x8000, 0x8000) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
- AM_RANGE(0x8001, 0x8001) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
- AM_RANGE(0x8002, 0x8002) AM_READWRITE(ym2203_status_port_1_r, ym2203_control_port_1_w)
- AM_RANGE(0x8003, 0x8003) AM_READWRITE(ym2203_read_port_1_r, ym2203_write_port_1_w)
+ AM_RANGE(0x8000, 0x8001) AM_DEVREADWRITE(SOUND, "ym1", ym2203_r, ym2203_w)
+ AM_RANGE(0x8002, 0x8003) AM_DEVREADWRITE(SOUND, "ym2", ym2203_r, ym2203_w)
AM_RANGE(0x8006, 0x8006) AM_WRITE(xxmissio_bank_sel_w)
AM_RANGE(0xa000, 0xa000) AM_READ_PORT("P1")
@@ -286,10 +282,10 @@ static const ym2203_interface ym2203_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- input_port_2_r,
- input_port_3_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_NULL,
+ DEVCB_NULL
},
NULL
};
@@ -299,10 +295,10 @@ static const ym2203_interface ym2203_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- NULL,
- xxmissio_scroll_x_w,
- xxmissio_scroll_y_w
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_HANDLER(xxmissio_scroll_x_w),
+ DEVCB_HANDLER(xxmissio_scroll_y_w)
},
NULL
};
diff --git a/src/mame/drivers/xyonix.c b/src/mame/drivers/xyonix.c
index 8f3e3f1f675..1ba064c0542 100644
--- a/src/mame/drivers/xyonix.c
+++ b/src/mame/drivers/xyonix.c
@@ -148,8 +148,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( port_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x20, 0x20) AM_READWRITE(SMH_NOP, sn76496_0_w) /* SN76496 ready signal */
- AM_RANGE(0x21, 0x21) AM_READWRITE(SMH_NOP, sn76496_1_w)
+ AM_RANGE(0x20, 0x20) AM_READNOP AM_DEVWRITE(SOUND, "sn1", sn76496_w) /* SN76496 ready signal */
+ AM_RANGE(0x21, 0x21) AM_READNOP AM_DEVWRITE(SOUND, "sn2", sn76496_w)
AM_RANGE(0x40, 0x40) AM_WRITE(SMH_NOP) /* NMI ack? */
AM_RANGE(0x50, 0x50) AM_WRITE(xyonix_irqack_w)
AM_RANGE(0x60, 0x61) AM_WRITE(SMH_NOP) /* mc6845 */
diff --git a/src/mame/drivers/yiear.c b/src/mame/drivers/yiear.c
index fc56f9147ec..be261a5176f 100644
--- a/src/mame/drivers/yiear.c
+++ b/src/mame/drivers/yiear.c
@@ -63,20 +63,20 @@ extern VIDEO_UPDATE( yiear );
/* in audio/trackfld.c */
extern WRITE8_HANDLER( konami_SN76496_latch_w );
-extern WRITE8_HANDLER( konami_SN76496_0_w );
+extern WRITE8_DEVICE_HANDLER( konami_SN76496_w );
-static READ8_HANDLER( yiear_speech_r )
+static READ8_DEVICE_HANDLER( yiear_speech_r )
{
- if (vlm5030_bsy()) return 1;
+ if (vlm5030_bsy(device)) return 1;
else return 0;
}
-static WRITE8_HANDLER( yiear_VLM5030_control_w )
+static WRITE8_DEVICE_HANDLER( yiear_VLM5030_control_w )
{
/* bit 0 is latch direction */
- vlm5030_st( ( data >> 1 ) & 1 );
- vlm5030_rst( ( data >> 2 ) & 1 );
+ vlm5030_st( device, ( data >> 1 ) & 1 );
+ vlm5030_rst( device, ( data >> 2 ) & 1 );
}
static INTERRUPT_GEN( yiear_nmi_interrupt )
@@ -87,12 +87,12 @@ static INTERRUPT_GEN( yiear_nmi_interrupt )
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
- AM_RANGE(0x0000, 0x0000) AM_READ(yiear_speech_r)
+ AM_RANGE(0x0000, 0x0000) AM_DEVREAD(SOUND, "vlm", yiear_speech_r)
AM_RANGE(0x4000, 0x4000) AM_WRITE(yiear_control_w)
AM_RANGE(0x4800, 0x4800) AM_WRITE(konami_SN76496_latch_w)
- AM_RANGE(0x4900, 0x4900) AM_WRITE(konami_SN76496_0_w)
- AM_RANGE(0x4a00, 0x4a00) AM_WRITE(yiear_VLM5030_control_w)
- AM_RANGE(0x4b00, 0x4b00) AM_WRITE(vlm5030_data_w)
+ AM_RANGE(0x4900, 0x4900) AM_DEVWRITE(SOUND, "sn", konami_SN76496_w)
+ AM_RANGE(0x4a00, 0x4a00) AM_DEVWRITE(SOUND, "vlm", yiear_VLM5030_control_w)
+ AM_RANGE(0x4b00, 0x4b00) AM_DEVWRITE(SOUND, "vlm", vlm5030_data_w)
AM_RANGE(0x4c00, 0x4c00) AM_READ_PORT("DSW1")
AM_RANGE(0x4d00, 0x4d00) AM_READ_PORT("DSW2")
AM_RANGE(0x4e00, 0x4e00) AM_READ_PORT("SYSTEM")
diff --git a/src/mame/drivers/yumefuda.c b/src/mame/drivers/yumefuda.c
index f707f1387d8..0b2e52ce4ed 100644
--- a/src/mame/drivers/yumefuda.c
+++ b/src/mame/drivers/yumefuda.c
@@ -210,24 +210,14 @@ static WRITE8_HANDLER( yumefuda_videoregs_w )
}
}
-static READ8_HANDLER( in7_r )
-{
- return input_port_read(space->machine, "DSW1");
-}
-
-static READ8_HANDLER( in8_r )
-{
- return input_port_read(space->machine, "DSW2");
-}
-
static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- in7_r,
- in8_r,
- NULL,
- NULL
+ DEVCB_INPUT_PORT("DSW1"),
+ DEVCB_INPUT_PORT("DSW2"),
+ DEVCB_NULL,
+ DEVCB_NULL
};
/***************************************************************************************/
@@ -248,8 +238,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( port_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x01) AM_WRITE(yumefuda_videoregs_w) // HD46505SP video registers
- AM_RANGE(0x40, 0x40) AM_READWRITE(ay8910_read_port_0_r, ay8910_control_port_0_w)
- AM_RANGE(0x41, 0x41) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x40, 0x40) AM_DEVREAD(SOUND, "ay", ay8910_r)
+ AM_RANGE(0x40, 0x41) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
AM_RANGE(0x80, 0x80) AM_WRITE(mux_w)
AM_RANGE(0x81, 0x81) AM_READ(eeprom_r)
AM_RANGE(0x82, 0x82) AM_READ(mux_r)
diff --git a/src/mame/drivers/yunsun16.c b/src/mame/drivers/yunsun16.c
index ff7a4af4d6a..377242472ec 100644
--- a/src/mame/drivers/yunsun16.c
+++ b/src/mame/drivers/yunsun16.c
@@ -140,7 +140,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x800114, 0x800117) AM_RAM AM_BASE(&yunsun16_scroll_0 ) // Scrolling
AM_RANGE(0x800154, 0x800155) AM_RAM AM_BASE(&yunsun16_priority ) // Priority
AM_RANGE(0x800180, 0x800181) AM_WRITE(yunsun16_sound_bank_w ) // Sound
- AM_RANGE(0x800188, 0x800189) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w ) // Sound
+ AM_RANGE(0x800188, 0x800189) AM_DEVREADWRITE8(SOUND, "oki", okim6295_r, okim6295_w, 0x00ff ) // Sound
AM_RANGE(0x8001fe, 0x8001ff) AM_WRITE(SMH_NOP ) // ? 0 (during int)
AM_RANGE(0x900000, 0x903fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16) // Palette
AM_RANGE(0x908000, 0x90bfff) AM_RAM_WRITE(yunsun16_vram_1_w) AM_BASE(&yunsun16_vram_1 ) // Layer 1
@@ -187,10 +187,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_port_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x10, 0x10) AM_READWRITE(ym3812_status_port_0_r, ym3812_control_port_0_w ) // YM3812
- AM_RANGE(0x11, 0x11) AM_WRITE(ym3812_write_port_0_w )
+ AM_RANGE(0x10, 0x11) AM_DEVREADWRITE(SOUND, "ym", ym3812_r, ym3812_w )
AM_RANGE(0x18, 0x18) AM_READ(soundlatch_r ) // From Main CPU
- AM_RANGE(0x1c, 0x1c) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w ) // M6295
+ AM_RANGE(0x1c, 0x1c) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w ) // M6295
ADDRESS_MAP_END
@@ -572,9 +571,9 @@ GFXDECODE_END
Magic Bubble
***************************************************************************/
-static void soundirq(running_machine *machine, int state)
+static void soundirq(const device_config *device, int state)
{
- cpu_set_input_line(machine->cpu[1], 0, state);
+ cpu_set_input_line(device->machine->cpu[1], 0, state);
}
static const ym3812_interface magicbub_ym3812_intf =
diff --git a/src/mame/drivers/yunsung8.c b/src/mame/drivers/yunsung8.c
index bcd712e960f..d54417f1153 100644
--- a/src/mame/drivers/yunsung8.c
+++ b/src/mame/drivers/yunsung8.c
@@ -130,19 +130,19 @@ ADDRESS_MAP_END
static int adpcm;
-static WRITE8_HANDLER( yunsung8_sound_bankswitch_w )
+static WRITE8_DEVICE_HANDLER( yunsung8_sound_bankswitch_w )
{
- UINT8 *RAM = memory_region(space->machine, "audio");
+ UINT8 *RAM = memory_region(device->machine, "audio");
int bank = data & 7;
- if ( bank != (data&(~0x20)) ) logerror("CPU #1 - PC %04X: Bank %02X\n",cpu_get_pc(space->cpu),data);
+ if ( bank != (data&(~0x20)) ) logerror("%s: Bank %02X\n",cpuexec_describe_context(device->machine),data);
if (bank < 3) RAM = &RAM[0x4000 * bank];
else RAM = &RAM[0x4000 * (bank-3) + 0x10000];
- memory_set_bankptr(space->machine, 2, RAM);
+ memory_set_bankptr(device->machine, 2, RAM);
- msm5205_reset_w(0,data & 0x20);
+ msm5205_reset_w(device,data & 0x20);
}
static WRITE8_HANDLER( yunsung8_adpcm_w )
@@ -156,10 +156,9 @@ static WRITE8_HANDLER( yunsung8_adpcm_w )
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_READWRITE(SMH_BANK2,SMH_ROM ) // Banked ROM
- AM_RANGE(0xe000, 0xe000) AM_WRITE(yunsung8_sound_bankswitch_w ) // ROM Bank
+ AM_RANGE(0xe000, 0xe000) AM_DEVWRITE(SOUND, "msm", yunsung8_sound_bankswitch_w ) // ROM Bank
AM_RANGE(0xe400, 0xe400) AM_WRITE(yunsung8_adpcm_w )
- AM_RANGE(0xec00, 0xec00) AM_WRITE(ym3812_control_port_0_w ) // YM3812
- AM_RANGE(0xec01, 0xec01) AM_WRITE(ym3812_write_port_0_w )
+ AM_RANGE(0xec00, 0xec01) AM_DEVWRITE(SOUND, "ym", ym3812_w )
AM_RANGE(0xf000, 0xf7ff) AM_RAM
AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r ) // From Main CPU
ADDRESS_MAP_END
@@ -489,7 +488,7 @@ static void yunsung8_adpcm_int(const device_config *device)
{
static int toggle=0;
- msm5205_data_w (0,adpcm>>4);
+ msm5205_data_w (device,adpcm>>4);
adpcm<<=4;
toggle ^= 1;
diff --git a/src/mame/drivers/zaccaria.c b/src/mame/drivers/zaccaria.c
index feee1f563ca..5b561e28955 100644
--- a/src/mame/drivers/zaccaria.c
+++ b/src/mame/drivers/zaccaria.c
@@ -87,7 +87,7 @@ static READ8_HANDLER( zaccaria_dsw_r )
-static WRITE8_HANDLER( ay8910_port0a_w )
+static WRITE8_DEVICE_HANDLER( ay8910_port0a_w )
{
// bits 0-2 go to a weird kind of DAC ??
// bits 3-4 control the analog drum emulation on 8910 #0 ch. A
@@ -96,10 +96,10 @@ static WRITE8_HANDLER( ay8910_port0a_w )
{
/* TODO: is this right? it sound awful */
static const int table[4] = { 0x05, 0x1b, 0x0b, 0x55 };
- dac_signed_data_w(0,table[(data & 0x06) >> 1]);
+ dac_signed_data_w(devtag_get_device(device->machine, SOUND, "dac1"),table[(data & 0x06) >> 1]);
}
else
- dac_signed_data_w(0,0x80);
+ dac_signed_data_w(devtag_get_device(device->machine, SOUND, "dac1"),0x80);
}
@@ -110,10 +110,7 @@ static int active_8910, port0a, acs;
static READ8_HANDLER( zaccaria_port0a_r )
{
- if (active_8910 == 0)
- return ay8910_read_port_0_r(space,0);
- else
- return ay8910_read_port_1_r(space,0);
+ return ay8910_r(devtag_get_device(space->machine, SOUND, (active_8910 == 0) ? "ay1" : "ay2"), 0);
}
static WRITE8_HANDLER( zaccaria_port0a_w )
@@ -130,10 +127,7 @@ static WRITE8_HANDLER( zaccaria_port0b_w )
if ((last & 0x02) == 0x02 && (data & 0x02) == 0x00)
{
/* bit 0 goes to the 8910 #0 BC1 pin */
- if (last & 0x01)
- ay8910_control_port_0_w(space,0,port0a);
- else
- ay8910_write_port_0_w(space,0,port0a);
+ ay8910_data_address_w(devtag_get_device(space->machine, SOUND, "ay1"), last, port0a);
}
else if ((last & 0x02) == 0x00 && (data & 0x02) == 0x02)
{
@@ -145,10 +139,7 @@ static WRITE8_HANDLER( zaccaria_port0b_w )
if ((last & 0x08) == 0x08 && (data & 0x08) == 0x00)
{
/* bit 2 goes to the 8910 #1 BC1 pin */
- if (last & 0x04)
- ay8910_control_port_1_w(space,0,port0a);
- else
- ay8910_write_port_1_w(space,0,port0a);
+ ay8910_data_address_w(devtag_get_device(space->machine, SOUND, "ay2"), last >> 2, port0a);
}
else if ((last & 0x08) == 0x00 && (data & 0x08) == 0x08)
{
@@ -175,7 +166,8 @@ static int port1a,port1b;
static READ8_HANDLER( zaccaria_port1a_r )
{
- if (~port1b & 1) return tms5220_status_r(space,0);
+ const device_config *tms = devtag_get_device(space->machine, SOUND, "tms");
+ if (~port1b & 1) return tms5220_status_r(tms,0);
else return port1a;
}
@@ -186,12 +178,13 @@ static WRITE8_HANDLER( zaccaria_port1a_w )
static WRITE8_HANDLER( zaccaria_port1b_w )
{
+ const device_config *tms = devtag_get_device(space->machine, SOUND, "tms");
port1b = data;
// bit 0 = /RS
// bit 1 = /WS
- if (~data & 2) tms5220_data_w(space,0,port1a);
+ if (~data & 2) tms5220_data_w(tms,0,port1a);
// bit 3 = "ACS" (goes, inverted, to input port 6 bit 3)
acs = ~data & 0x08;
@@ -212,9 +205,9 @@ return counter;
}
-static void tms5220_irq_handler(running_machine *machine, int state)
+static void tms5220_irq_handler(const device_config *device, int state)
{
- const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
pia_1_cb1_w(space,0,state ? 0 : 1);
}
@@ -270,9 +263,9 @@ static WRITE8_HANDLER( sound1_command_w )
soundlatch2_w(space,0,data);
}
-static WRITE8_HANDLER( mc1408_data_w )
+static WRITE8_DEVICE_HANDLER( mc1408_data_w )
{
- dac_data_w(1,data);
+ dac_data_w(device,data);
}
@@ -363,7 +356,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map_2, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x007f) AM_RAM
AM_RANGE(0x0090, 0x0093) AM_READWRITE(pia_1_r, pia_1_w)
- AM_RANGE(0x1000, 0x1000) AM_WRITE(mc1408_data_w) /* MC1408 */
+ AM_RANGE(0x1000, 0x1000) AM_DEVWRITE(SOUND, "dac2", mc1408_data_w) /* MC1408 */
AM_RANGE(0x1400, 0x1400) AM_WRITE(sound1_command_w)
AM_RANGE(0x1800, 0x1800) AM_READ(soundlatch_r)
AM_RANGE(0xa000, 0xbfff) AM_ROM
@@ -554,10 +547,10 @@ static const ay8910_interface ay8910_config =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
- NULL,
- soundlatch2_r,
- ay8910_port0a_w,
- NULL
+ DEVCB_NULL,
+ DEVCB_MEMORY_HANDLER("audio", PROGRAM, soundlatch2_r),
+ DEVCB_HANDLER(ay8910_port0a_w),
+ DEVCB_NULL
};
static const tms5220_interface tms5220_config =
diff --git a/src/mame/drivers/zaxxon.c b/src/mame/drivers/zaxxon.c
index ed3e1bfb6e7..f178dff5f26 100644
--- a/src/mame/drivers/zaxxon.c
+++ b/src/mame/drivers/zaxxon.c
@@ -541,9 +541,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( congo_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_ROM
AM_RANGE(0x4000, 0x47ff) AM_MIRROR(0x1800) AM_RAM
- AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x1fff) AM_WRITE(sn76496_0_w)
+ AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x1fff) AM_DEVWRITE(SOUND, "sn1", sn76496_w)
AM_RANGE(0x8000, 0x8003) AM_MIRROR(0x1ffc) AM_DEVREADWRITE(PPI8255, "ppi8255", ppi8255_r, ppi8255_w)
- AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x1fff) AM_WRITE(sn76496_1_w)
+ AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x1fff) AM_DEVWRITE(SOUND, "sn2", sn76496_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/zerozone.c b/src/mame/drivers/zerozone.c
index d0daa220fb0..ca604b31315 100644
--- a/src/mame/drivers/zerozone.c
+++ b/src/mame/drivers/zerozone.c
@@ -82,7 +82,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
- AM_RANGE(0x9800, 0x9800) AM_READWRITE(okim6295_status_0_r, okim6295_data_0_w)
+ AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w)
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/zn.c b/src/mame/drivers/zn.c
index ed875f4d176..a569db03275 100644
--- a/src/mame/drivers/zn.c
+++ b/src/mame/drivers/zn.c
@@ -360,7 +360,7 @@ static ADDRESS_MAP_START( zn_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x1f800000, 0x1f8003ff) AM_RAM /* scratchpad */
AM_RANGE(0x1f801000, 0x1f80100f) AM_RAM /* ?? */
AM_RANGE(0x1f801010, 0x1f801013) AM_NOP
- AM_RANGE(0x1f801014, 0x1f801017) AM_READWRITE(psx_spu_delay_r, psx_spu_delay_w)
+ AM_RANGE(0x1f801014, 0x1f801017) AM_DEVREADWRITE(SOUND, "spu", psx_spu_delay_r, psx_spu_delay_w)
AM_RANGE(0x1f801018, 0x1f80101f) AM_NOP
AM_RANGE(0x1f801020, 0x1f801023) AM_READWRITE(psx_com_delay_r, psx_com_delay_w)
AM_RANGE(0x1f801024, 0x1f80102f) AM_NOP
@@ -371,7 +371,7 @@ static ADDRESS_MAP_START( zn_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x1f801100, 0x1f80112f) AM_READWRITE(psx_counter_r, psx_counter_w)
AM_RANGE(0x1f801810, 0x1f801817) AM_READWRITE(psx_gpu_r, psx_gpu_w)
AM_RANGE(0x1f801820, 0x1f801827) AM_READWRITE(psx_mdec_r, psx_mdec_w)
- AM_RANGE(0x1f801c00, 0x1f801dff) AM_READWRITE(psx_spu_r, psx_spu_w)
+ AM_RANGE(0x1f801c00, 0x1f801dff) AM_DEVREADWRITE(SOUND, "spu", psx_spu_r, psx_spu_w)
AM_RANGE(0x1f802020, 0x1f802033) AM_RAM /* ?? */
AM_RANGE(0x1f802040, 0x1f802043) AM_WRITENOP
AM_RANGE(0x1fa00000, 0x1fa00003) AM_READ_PORT("P1")
@@ -422,10 +422,15 @@ static void zn_driver_init( running_machine *machine )
dip_timer = timer_alloc(machine, dip_timer_fired, NULL );
}
+static void psx_spu_irq(const device_config *device, UINT32 data)
+{
+ psx_irq_set(device->machine, data);
+}
+
static const psx_spu_interface psxspu_interface =
{
&g_p_n_psxram,
- psx_irq_set,
+ psx_spu_irq,
psx_dma_install_read_handler,
psx_dma_install_write_handler
};
@@ -680,11 +685,9 @@ static MACHINE_RESET( coh1000c )
static ADDRESS_MAP_START( qsound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(10) /* banked (contains music data) */
- AM_RANGE(0xd000, 0xd000) AM_WRITE(qsound_data_h_w)
- AM_RANGE(0xd001, 0xd001) AM_WRITE(qsound_data_l_w)
- AM_RANGE(0xd002, 0xd002) AM_WRITE(qsound_cmd_w)
+ AM_RANGE(0xd000, 0xd002) AM_DEVWRITE(SOUND, "qsound", qsound_w)
AM_RANGE(0xd003, 0xd003) AM_WRITE(qsound_bankswitch_w)
- AM_RANGE(0xd007, 0xd007) AM_READ(qsound_status_r)
+ AM_RANGE(0xd007, 0xd007) AM_DEVREAD(SOUND, "qsound", qsound_r)
AM_RANGE(0xf000, 0xffff) AM_RAM
ADDRESS_MAP_END
@@ -1196,10 +1199,7 @@ static ADDRESS_MAP_START( fx1a_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK10) /* Fallthrough */
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0xc000, 0xdfff) AM_RAM
- AM_RANGE(0xe000, 0xe000) AM_READWRITE(ym2610_status_port_0_a_r, ym2610_control_port_0_a_w)
- AM_RANGE(0xe001, 0xe001) AM_READWRITE(ym2610_read_port_0_r, ym2610_data_port_0_a_w)
- AM_RANGE(0xe002, 0xe002) AM_READWRITE(ym2610_status_port_0_b_r, ym2610_control_port_0_b_w)
- AM_RANGE(0xe003, 0xe003) AM_WRITE(ym2610_data_port_0_b_w)
+ AM_RANGE(0xe000, 0xe003) AM_DEVREADWRITE(SOUND, "ym", ym2610_r, ym2610_w)
AM_RANGE(0xe200, 0xe200) AM_READWRITE(SMH_NOP, taitosound_slave_port_w)
AM_RANGE(0xe201, 0xe201) AM_READWRITE(taitosound_slave_comm_r, taitosound_slave_comm_w)
AM_RANGE(0xe400, 0xe403) AM_WRITE(SMH_NOP) /* pan */
@@ -1209,9 +1209,9 @@ static ADDRESS_MAP_START( fx1a_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END
/* handler called by the YM2610 emulator when the internal timers cause an IRQ */
-static void irq_handler(running_machine *machine, int irq)
+static void irq_handler(const device_config *device, int irq)
{
- cpu_set_input_line(machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2610_interface ym2610_config =
@@ -1826,26 +1826,11 @@ static MACHINE_RESET( coh1002e )
zn_machine_init(machine);
}
-static READ16_HANDLER( psarc_ymf_r )
-{
- return ymf271_0_r(space,0);
-}
-
-static WRITE16_HANDLER( psarc_ymf_w )
-{
- ymf271_0_w(space, offset, data);
-}
-
-static READ16_HANDLER( psarc_latch_r )
-{
- return soundlatch_r(space,0);
-}
-
static ADDRESS_MAP_START( psarc_snd_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_ROM
AM_RANGE(0x080000, 0x0fffff) AM_RAM
- AM_RANGE(0x100000, 0x10001f) AM_READWRITE( psarc_ymf_r, psarc_ymf_w )
- AM_RANGE(0x180008, 0x180009) AM_READ( psarc_latch_r )
+ AM_RANGE(0x100000, 0x10001f) AM_DEVREADWRITE8( SOUND, "ymf", ymf271_r, ymf271_w, 0x00ff )
+ AM_RANGE(0x180008, 0x180009) AM_READ8( soundlatch_r, 0x00ff )
AM_RANGE(0x000000, 0x07ffff) AM_WRITENOP
AM_RANGE(0x100020, 0xffffff) AM_WRITENOP
ADDRESS_MAP_END
@@ -2756,8 +2741,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( cbaj_z80_port_map, ADDRESS_SPACE_IO, 8)
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE( 0x84, 0x84 ) AM_READWRITE( ymz280b_status_0_r, ymz280b_register_0_w )
- AM_RANGE( 0x85, 0x85 ) AM_READWRITE( ymz280b_status_0_r, ymz280b_data_0_w )
+ AM_RANGE( 0x84, 0x85 ) AM_DEVREADWRITE( SOUND, "ymz", ymz280b_r, ymz280b_w )
AM_RANGE( 0x90, 0x90 ) AM_READWRITE( cbaj_z80_latch_r, cbaj_z80_latch_w )
AM_RANGE( 0x91, 0x91 ) AM_READ( cbaj_z80_ready_r )
ADDRESS_MAP_END
diff --git a/src/mame/drivers/zodiack.c b/src/mame/drivers/zodiack.c
index dae48ab1058..5742b6f4457 100644
--- a/src/mame/drivers/zodiack.c
+++ b/src/mame/drivers/zodiack.c
@@ -80,8 +80,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(ay8910_control_port_0_w)
- AM_RANGE(0x01, 0x01) AM_WRITE(ay8910_write_port_0_w)
+ AM_RANGE(0x00, 0x01) AM_DEVWRITE(SOUND, "ay", ay8910_address_data_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/zr107.c b/src/mame/drivers/zr107.c
index fed17616aac..1ceb60ec4b9 100644
--- a/src/mame/drivers/zr107.c
+++ b/src/mame/drivers/zr107.c
@@ -520,9 +520,9 @@ static READ16_HANDLER( dual539_r )
UINT16 ret = 0;
if (ACCESSING_BITS_0_7)
- ret |= k054539_1_r(space, offset);
+ ret |= k054539_r(devtag_get_device(space->machine, SOUND, "konami2"), offset);
if (ACCESSING_BITS_8_15)
- ret |= k054539_0_r(space, offset)<<8;
+ ret |= k054539_r(devtag_get_device(space->machine, SOUND, "konami1"), offset)<<8;
return ret;
}
@@ -530,9 +530,9 @@ static READ16_HANDLER( dual539_r )
static WRITE16_HANDLER( dual539_w )
{
if (ACCESSING_BITS_0_7)
- k054539_1_w(space, offset, data);
+ k054539_w(devtag_get_device(space->machine, SOUND, "konami2"), offset, data);
if (ACCESSING_BITS_8_15)
- k054539_0_w(space, offset, data>>8);
+ k054539_w(devtag_get_device(space->machine, SOUND, "konami1"), offset, data>>8);
}
static ADDRESS_MAP_START( sound_memmap, ADDRESS_SPACE_PROGRAM, 16 )
diff --git a/src/mame/includes/8080bw.h b/src/mame/includes/8080bw.h
index c5149589d1e..4716f228aba 100644
--- a/src/mame/includes/8080bw.h
+++ b/src/mame/includes/8080bw.h
@@ -5,7 +5,6 @@
*************************************************************************/
#include "sound/discrete.h"
-#include "sound/custom.h"
#include "sound/sn76477.h"
#include "sound/samples.h"
@@ -39,12 +38,12 @@ WRITE8_HANDLER( ballbomb_sh_port_2_w );
WRITE8_HANDLER( indianbt_sh_port_1_w );
WRITE8_HANDLER( indianbt_sh_port_2_w );
-WRITE8_HANDLER( indianbt_sh_port_3_w );
+WRITE8_DEVICE_HANDLER( indianbt_sh_port_3_w );
DISCRETE_SOUND_EXTERN( indianbt );
-WRITE8_HANDLER( polaris_sh_port_1_w );
-WRITE8_HANDLER( polaris_sh_port_2_w );
-WRITE8_HANDLER( polaris_sh_port_3_w );
+WRITE8_DEVICE_HANDLER( polaris_sh_port_1_w );
+WRITE8_DEVICE_HANDLER( polaris_sh_port_2_w );
+WRITE8_DEVICE_HANDLER( polaris_sh_port_3_w );
DISCRETE_SOUND_EXTERN( polaris );
MACHINE_RESET( schaser );
diff --git a/src/mame/includes/amiga.h b/src/mame/includes/amiga.h
index d5d5c85a8fc..35acb3932d2 100644
--- a/src/mame/includes/amiga.h
+++ b/src/mame/includes/amiga.h
@@ -10,8 +10,6 @@ Ernesto Corvi & Mariusz Wojcieszek
#ifndef __AMIGA_H__
#define __AMIGA_H__
-#include "sound/custom.h"
-
/* A bit of a trick here: some registers are 32-bit. In order to efficiently */
/* read them on both big-endian and little-endian systems, we store the custom */
@@ -391,7 +389,9 @@ const amiga_machine_interface *amiga_get_interface(void);
/*----------- defined in audio/amiga.c -----------*/
-CUSTOM_START( amiga_sh_start );
+DEVICE_GET_INFO( amiga_sound );
+#define SOUND_AMIGA DEVICE_GET_INFO_NAME(amiga_sound)
+
void amiga_audio_update(void);
void amiga_audio_data_w(int which, UINT16 data);
diff --git a/src/mame/includes/asteroid.h b/src/mame/includes/asteroid.h
index 9713d4594d6..2218da74b33 100644
--- a/src/mame/includes/asteroid.h
+++ b/src/mame/includes/asteroid.h
@@ -30,16 +30,16 @@ extern UINT8 *asteroid_ram1, *asteroid_ram2;
DISCRETE_SOUND_EXTERN( asteroid );
DISCRETE_SOUND_EXTERN( astdelux );
-WRITE8_HANDLER( asteroid_explode_w );
-WRITE8_HANDLER( asteroid_thump_w );
-WRITE8_HANDLER( asteroid_sounds_w );
-WRITE8_HANDLER( asteroid_noise_reset_w );
-WRITE8_HANDLER( astdelux_sounds_w );
+WRITE8_DEVICE_HANDLER( asteroid_explode_w );
+WRITE8_DEVICE_HANDLER( asteroid_thump_w );
+WRITE8_DEVICE_HANDLER( asteroid_sounds_w );
+WRITE8_DEVICE_HANDLER( asteroid_noise_reset_w );
+WRITE8_DEVICE_HANDLER( astdelux_sounds_w );
/*----------- defined in audio/llander.c -----------*/
DISCRETE_SOUND_EXTERN( llander );
-WRITE8_HANDLER( llander_snd_reset_w );
-WRITE8_HANDLER( llander_sounds_w );
+WRITE8_DEVICE_HANDLER( llander_snd_reset_w );
+WRITE8_DEVICE_HANDLER( llander_sounds_w );
diff --git a/src/mame/includes/astrocde.h b/src/mame/includes/astrocde.h
index 1f168bc3330..a5c7de1c5fc 100644
--- a/src/mame/includes/astrocde.h
+++ b/src/mame/includes/astrocde.h
@@ -4,8 +4,6 @@
***************************************************************************/
-#include "sound/custom.h"
-
#define ASTROCADE_CLOCK (XTAL_14_31818MHz/2)
#define AC_SOUND_PRESENT (0x01)
diff --git a/src/mame/includes/atari.h b/src/mame/includes/atari.h
index 66c9beb9dae..b6e81ab696b 100644
--- a/src/mame/includes/atari.h
+++ b/src/mame/includes/atari.h
@@ -50,7 +50,7 @@ DEVICE_IMAGE_UNLOAD( a5200_cart );
READ8_HANDLER ( atari_serin_r );
WRITE8_HANDLER ( atari_serout_w );
-void atari_interrupt_cb(running_machine *machine, int mask);
+void atari_interrupt_cb(const device_config *device, int mask);
void a800_handle_keyboard(running_machine *machine);
void a5200_handle_keypads(running_machine *machine);
diff --git a/src/mame/includes/attckufo.h b/src/mame/includes/attckufo.h
index 886567d4eef..ea279a4a16d 100644
--- a/src/mame/includes/attckufo.h
+++ b/src/mame/includes/attckufo.h
@@ -1,9 +1,9 @@
-#include "sound/custom.h"
-
/*----------- defined in audio/attckufo.c -----------*/
void attckufo_soundport_w (int offset, int data);
-CUSTOM_START( attckufo_custom_start );
+
+DEVICE_GET_INFO( attckufo_sound );
+#define SOUND_ATTCKUFO DEVICE_GET_INFO_NAME(attckufo_sound)
/*----------- defined in video/attckufo.c -----------*/
diff --git a/src/mame/includes/avalnche.h b/src/mame/includes/avalnche.h
index ff9add56208..f2bfca78f4c 100644
--- a/src/mame/includes/avalnche.h
+++ b/src/mame/includes/avalnche.h
@@ -10,6 +10,6 @@
/*----------- defined in audio/avalnche.c -----------*/
DISCRETE_SOUND_EXTERN( avalnche );
-WRITE8_HANDLER( avalnche_noise_amplitude_w );
-WRITE8_HANDLER( avalnche_attract_enable_w );
-WRITE8_HANDLER( avalnche_audio_w );
+WRITE8_DEVICE_HANDLER( avalnche_noise_amplitude_w );
+WRITE8_DEVICE_HANDLER( avalnche_attract_enable_w );
+WRITE8_DEVICE_HANDLER( avalnche_audio_w );
diff --git a/src/mame/includes/blockade.h b/src/mame/includes/blockade.h
index a6469f09b34..e3c58f7b777 100644
--- a/src/mame/includes/blockade.h
+++ b/src/mame/includes/blockade.h
@@ -15,6 +15,6 @@ VIDEO_UPDATE( blockade );
extern const samples_interface blockade_samples_interface;
DISCRETE_SOUND_EXTERN( blockade );
-WRITE8_HANDLER( blockade_sound_freq_w );
+WRITE8_DEVICE_HANDLER( blockade_sound_freq_w );
WRITE8_HANDLER( blockade_env_on_w );
WRITE8_HANDLER( blockade_env_off_w );
diff --git a/src/mame/includes/bsktball.h b/src/mame/includes/bsktball.h
index b9d170c9ab6..695732e4050 100644
--- a/src/mame/includes/bsktball.h
+++ b/src/mame/includes/bsktball.h
@@ -26,9 +26,9 @@ WRITE8_HANDLER( bsktball_led2_w );
/*----------- defined in audio/bsktball.c -----------*/
-WRITE8_HANDLER( bsktball_bounce_w );
-WRITE8_HANDLER( bsktball_note_w );
-WRITE8_HANDLER( bsktball_noise_reset_w );
+WRITE8_DEVICE_HANDLER( bsktball_bounce_w );
+WRITE8_DEVICE_HANDLER( bsktball_note_w );
+WRITE8_DEVICE_HANDLER( bsktball_noise_reset_w );
DISCRETE_SOUND_EXTERN( bsktball );
diff --git a/src/mame/includes/bzone.h b/src/mame/includes/bzone.h
index 393f378fd90..bb04bdcfb2c 100644
--- a/src/mame/includes/bzone.h
+++ b/src/mame/includes/bzone.h
@@ -4,8 +4,6 @@
*************************************************************************/
-#include "sound/custom.h"
-
/*----------- defined in drivers/bzone.c -----------*/
@@ -16,12 +14,14 @@ extern UINT8 rb_input_select;
WRITE8_HANDLER( bzone_sounds_w );
-CUSTOM_START( bzone_sh_start );
+DEVICE_GET_INFO( bzone_sound );
+#define SOUND_BZONE DEVICE_GET_INFO_NAME(bzone_sound)
/*----------- defined in audio/redbaron.c -----------*/
WRITE8_HANDLER( redbaron_sounds_w );
-WRITE8_HANDLER( redbaron_pokey_w );
+WRITE8_DEVICE_HANDLER( redbaron_pokey_w );
-CUSTOM_START( redbaron_sh_start );
+DEVICE_GET_INFO( redbaron_sound );
+#define SOUND_REDBARON DEVICE_GET_INFO_NAME(redbaron_sound)
diff --git a/src/mame/includes/canyon.h b/src/mame/includes/canyon.h
index d16d50f0bba..579fafbba1f 100644
--- a/src/mame/includes/canyon.h
+++ b/src/mame/includes/canyon.h
@@ -18,10 +18,10 @@
/*----------- defined in audio/canyon.c -----------*/
-WRITE8_HANDLER( canyon_motor_w );
-WRITE8_HANDLER( canyon_explode_w );
-WRITE8_HANDLER( canyon_attract_w );
-WRITE8_HANDLER( canyon_whistle_w );
+WRITE8_DEVICE_HANDLER( canyon_motor_w );
+WRITE8_DEVICE_HANDLER( canyon_explode_w );
+WRITE8_DEVICE_HANDLER( canyon_attract_w );
+WRITE8_DEVICE_HANDLER( canyon_whistle_w );
DISCRETE_SOUND_EXTERN( canyon );
diff --git a/src/mame/includes/cchasm.h b/src/mame/includes/cchasm.h
index 1c43b16e74b..d76e68dcf36 100644
--- a/src/mame/includes/cchasm.h
+++ b/src/mame/includes/cchasm.h
@@ -4,7 +4,6 @@
*************************************************************************/
-#include "sound/custom.h"
#include "machine/z80ctc.h"
/*----------- defined in machine/cchasm.c -----------*/
@@ -15,8 +14,9 @@ WRITE16_HANDLER( cchasm_led_w );
extern z80ctc_interface cchasm_ctc_intf;
-READ8_HANDLER( cchasm_snd_io_r );
-WRITE8_HANDLER( cchasm_snd_io_w );
+READ8_HANDLER( cchasm_coin_sound_r );
+READ8_HANDLER( cchasm_soundlatch2_r );
+WRITE8_HANDLER( cchasm_soundlatch4_w );
WRITE16_HANDLER( cchasm_io_w );
READ16_HANDLER( cchasm_io_r );
diff --git a/src/mame/includes/cps3.h b/src/mame/includes/cps3.h
index acdc4ab93bd..171f18308bc 100644
--- a/src/mame/includes/cps3.h
+++ b/src/mame/includes/cps3.h
@@ -4,11 +4,10 @@
****************************************************************************/
-#include "sound/custom.h"
-
/*----------- defined in audio/cps3.c -----------*/
-CUSTOM_START( cps3_sh_start );
+DEVICE_GET_INFO( cps3_sound );
+#define SOUND_CPS3 DEVICE_GET_INFO_NAME(cps3_sound)
WRITE32_HANDLER( cps3_sound_w );
READ32_HANDLER( cps3_sound_r );
diff --git a/src/mame/includes/crbaloon.h b/src/mame/includes/crbaloon.h
index 506dccd4464..edde7ea4840 100644
--- a/src/mame/includes/crbaloon.h
+++ b/src/mame/includes/crbaloon.h
@@ -10,12 +10,12 @@ Crazy Ballooon
/*----------- defined in audio/crbaloon.c -----------*/
-void crbaloon_audio_set_music_freq(const address_space *space, UINT8 freq);
-void crbaloon_audio_set_music_enable(const address_space *space, int enabled);
-void crbaloon_audio_set_explosion_enable(int enabled);
-void crbaloon_audio_set_breath_enable(int enabled);
-void crbaloon_audio_set_appear_enable(int enabled);
-void crbaloon_audio_set_laugh_enable(const address_space *space, int enabled);
+WRITE8_DEVICE_HANDLER( crbaloon_audio_set_music_freq );
+WRITE8_DEVICE_HANDLER( crbaloon_audio_set_music_enable );
+void crbaloon_audio_set_explosion_enable(const device_config *sn, int enabled);
+void crbaloon_audio_set_breath_enable(const device_config *sn, int enabled);
+void crbaloon_audio_set_appear_enable(const device_config *sn, int enabled);
+WRITE8_DEVICE_HANDLER( crbaloon_audio_set_laugh_enable );
MACHINE_DRIVER_EXTERN( crbaloon_audio );
diff --git a/src/mame/includes/dc.h b/src/mame/includes/dc.h
index 4e7f72c1f0d..9884ea9aee2 100644
--- a/src/mame/includes/dc.h
+++ b/src/mame/includes/dc.h
@@ -23,11 +23,11 @@ READ64_HANDLER( dc_modem_r );
WRITE64_HANDLER( dc_modem_w );
READ64_HANDLER( dc_rtc_r );
WRITE64_HANDLER( dc_rtc_w );
-READ64_HANDLER( dc_aica_reg_r );
-WRITE64_HANDLER( dc_aica_reg_w );
+READ64_DEVICE_HANDLER( dc_aica_reg_r );
+WRITE64_DEVICE_HANDLER( dc_aica_reg_w );
-READ32_HANDLER( dc_arm_aica_r );
-WRITE32_HANDLER( dc_arm_aica_w );
+READ32_DEVICE_HANDLER( dc_arm_aica_r );
+WRITE32_DEVICE_HANDLER( dc_arm_aica_w );
MACHINE_START( dc );
MACHINE_RESET( dc );
diff --git a/src/mame/includes/exidy.h b/src/mame/includes/exidy.h
index 26a0da86f44..38c23f538de 100644
--- a/src/mame/includes/exidy.h
+++ b/src/mame/includes/exidy.h
@@ -4,9 +4,6 @@
*************************************************************************/
-#include "sound/custom.h"
-
-
#define EXIDY_MASTER_CLOCK (XTAL_11_289MHz)
#define EXIDY_CPU_CLOCK (EXIDY_MASTER_CLOCK / 16)
#define EXIDY_PIXEL_CLOCK (EXIDY_MASTER_CLOCK / 2)
@@ -24,8 +21,8 @@
/*----------- defined in audio/exidy.c -----------*/
-CUSTOM_START( exidy_sh6840_sh_start );
-CUSTOM_RESET( exidy_sh6840_sh_reset );
+DEVICE_GET_INFO( exidy_sound );
+#define SOUND_EXIDY DEVICE_GET_INFO_NAME( exidy_sound )
WRITE8_HANDLER( exidy_sh6840_w );
WRITE8_HANDLER( exidy_sfxctrl_w );
diff --git a/src/mame/includes/exidy440.h b/src/mame/includes/exidy440.h
index dbb928f96ba..bd249360b7c 100644
--- a/src/mame/includes/exidy440.h
+++ b/src/mame/includes/exidy440.h
@@ -4,9 +4,6 @@
*************************************************************************/
-#include "sound/custom.h"
-
-
#define EXIDY440_MASTER_CLOCK (XTAL_12_9792MHz)
diff --git a/src/mame/includes/firetrk.h b/src/mame/includes/firetrk.h
index fe53b8027ca..abae885e098 100644
--- a/src/mame/includes/firetrk.h
+++ b/src/mame/includes/firetrk.h
@@ -32,14 +32,14 @@ Atari Fire Truck + Super Bug + Monte Carlo driver
/*----------- defined in audio/firetrk.c -----------*/
-WRITE8_HANDLER( firetrk_skid_reset_w );
-WRITE8_HANDLER( montecar_skid_reset_w );
-WRITE8_HANDLER( firetrk_crash_snd_w );
-WRITE8_HANDLER( firetrk_skid_snd_w );
-WRITE8_HANDLER( firetrk_motor_snd_w );
-WRITE8_HANDLER( superbug_motor_snd_w );
-WRITE8_HANDLER( firetrk_xtndply_w );
-WRITE8_HANDLER( superbug_asr_w );
+WRITE8_DEVICE_HANDLER( firetrk_skid_reset_w );
+WRITE8_DEVICE_HANDLER( montecar_skid_reset_w );
+WRITE8_DEVICE_HANDLER( firetrk_crash_snd_w );
+WRITE8_DEVICE_HANDLER( firetrk_skid_snd_w );
+WRITE8_DEVICE_HANDLER( firetrk_motor_snd_w );
+WRITE8_DEVICE_HANDLER( superbug_motor_snd_w );
+WRITE8_DEVICE_HANDLER( firetrk_xtndply_w );
+WRITE8_DEVICE_HANDLER( superbug_asr_w );
DISCRETE_SOUND_EXTERN( firetrk );
DISCRETE_SOUND_EXTERN( superbug );
diff --git a/src/mame/includes/flower.h b/src/mame/includes/flower.h
index 38a9b7870d2..5bafc158d2c 100644
--- a/src/mame/includes/flower.h
+++ b/src/mame/includes/flower.h
@@ -1,12 +1,12 @@
-#include "sound/custom.h"
-
/*----------- defined in audio/flower.c -----------*/
extern UINT8 *flower_soundregs1,*flower_soundregs2;
WRITE8_HANDLER( flower_sound1_w );
WRITE8_HANDLER( flower_sound2_w );
-CUSTOM_START( flower_sh_start );
+
+DEVICE_GET_INFO( flower_sound );
+#define SOUND_FLOWER DEVICE_GET_INFO_NAME(flower_sound)
/*----------- defined in video/flower.c -----------*/
diff --git a/src/mame/includes/galaxold.h b/src/mame/includes/galaxold.h
index 97441451d16..d2d566ffe1d 100644
--- a/src/mame/includes/galaxold.h
+++ b/src/mame/includes/galaxold.h
@@ -195,10 +195,10 @@ void sfx_sh_init(running_machine *machine);
WRITE8_HANDLER( scramble_filter_w );
WRITE8_HANDLER( frogger_filter_w );
-READ8_HANDLER( scramble_portB_r );
-READ8_HANDLER( frogger_portB_r );
+READ8_DEVICE_HANDLER( scramble_portB_r );
+READ8_DEVICE_HANDLER( frogger_portB_r );
-READ8_HANDLER( hotshock_soundlatch_r );
+READ8_DEVICE_HANDLER( hotshock_soundlatch_r );
WRITE8_DEVICE_HANDLER( scramble_sh_irqtrigger_w );
WRITE8_HANDLER( sfx_sh_irqtrigger_w );
diff --git a/src/mame/includes/genesis.h b/src/mame/includes/genesis.h
index 5e8d3a42f47..7f0176b45b4 100644
--- a/src/mame/includes/genesis.h
+++ b/src/mame/includes/genesis.h
@@ -32,7 +32,7 @@ extern WRITE16_HANDLER(genesis_ctrl_w);
extern WRITE16_HANDLER ( genesis_68k_to_z80_w );
extern READ16_HANDLER ( genesis_68k_to_z80_r );
extern INTERRUPT_GEN( genesis_vblank_interrupt );
-extern void genesis_irq2_interrupt(running_machine *machine, int state);
+extern void genesis_irq2_interrupt(const device_config *device, int state);
/*----------- defined in video/genesis.c -----------*/
diff --git a/src/mame/includes/gomoku.h b/src/mame/includes/gomoku.h
index 4dd8babc38c..cc0d8b1e244 100644
--- a/src/mame/includes/gomoku.h
+++ b/src/mame/includes/gomoku.h
@@ -1,5 +1,3 @@
-#include "sound/custom.h"
-
/*----------- defined in audio/gomoku.c -----------*/
extern UINT8 *gomoku_soundregs1;
@@ -7,7 +5,9 @@ extern UINT8 *gomoku_soundregs2;
WRITE8_HANDLER( gomoku_sound1_w );
WRITE8_HANDLER( gomoku_sound2_w );
-CUSTOM_START( gomoku_sh_start );
+
+DEVICE_GET_INFO( gomoku_sound );
+#define SOUND_GOMOKU DEVICE_GET_INFO_NAME(gomoku_sound)
/*----------- defined in video/gomoku.c -----------*/
diff --git a/src/mame/includes/gridlee.h b/src/mame/includes/gridlee.h
index d312aeae9d3..28708c98580 100644
--- a/src/mame/includes/gridlee.h
+++ b/src/mame/includes/gridlee.h
@@ -6,13 +6,13 @@
***************************************************************************/
-#include "sound/custom.h"
-
/*----------- defined in audio/gridlee.c -----------*/
WRITE8_HANDLER( gridlee_sound_w );
-CUSTOM_START( gridlee_sh_start );
+
+DEVICE_GET_INFO( gridlee_sound );
+#define SOUND_GRIDLEE DEVICE_GET_INFO_NAME(gridlee_sound)
/*----------- defined in video/gridlee.c -----------*/
diff --git a/src/mame/includes/harddriv.h b/src/mame/includes/harddriv.h
index 4b6a7f116ef..0708f950862 100644
--- a/src/mame/includes/harddriv.h
+++ b/src/mame/includes/harddriv.h
@@ -202,7 +202,7 @@ WRITE16_HANDLER( hdsnd68k_320com_w );
READ16_HANDLER( hdsnddsp_get_bio );
-WRITE16_HANDLER( hdsnddsp_dac_w );
+WRITE16_DEVICE_HANDLER( hdsnddsp_dac_w );
WRITE16_HANDLER( hdsnddsp_comport_w );
WRITE16_HANDLER( hdsnddsp_mute_w );
WRITE16_HANDLER( hdsnddsp_gen68kirq_w );
diff --git a/src/mame/includes/leland.h b/src/mame/includes/leland.h
index ffd4be1b7b5..d29f5b92f68 100644
--- a/src/mame/includes/leland.h
+++ b/src/mame/includes/leland.h
@@ -4,8 +4,6 @@
*************************************************************************/
-#include "sound/custom.h"
-
#define LELAND_BATTERY_RAM_SIZE 0x4000
#define ATAXX_EXTRA_TRAM_SIZE 0x800
@@ -87,8 +85,8 @@ READ8_HANDLER( leland_gated_paletteram_r );
WRITE8_HANDLER( ataxx_paletteram_and_misc_w );
READ8_HANDLER( ataxx_paletteram_and_misc_r );
-READ8_HANDLER( leland_sound_port_r );
-WRITE8_HANDLER( leland_sound_port_w );
+READ8_DEVICE_HANDLER( leland_sound_port_r );
+WRITE8_DEVICE_HANDLER( leland_sound_port_w );
WRITE8_HANDLER( leland_slave_small_banksw_w );
WRITE8_HANDLER( leland_slave_large_banksw_w );
@@ -101,10 +99,15 @@ void leland_rotate_memory(running_machine *machine, const char *cpuname);
/*----------- defined in audio/leland.c -----------*/
-CUSTOM_START( leland_sh_start );
+DEVICE_GET_INFO( leland_sound );
+#define SOUND_LELAND DEVICE_GET_INFO_NAME(leland_sound)
+
+DEVICE_GET_INFO( leland_80186_sound );
+#define SOUND_LELAND_80186 DEVICE_GET_INFO_NAME(leland_80186_sound)
+
+DEVICE_GET_INFO( redline_80186_sound );
+#define SOUND_REDLINE_80186 DEVICE_GET_INFO_NAME(redline_80186_sound)
-CUSTOM_START( leland_80186_sh_start );
-CUSTOM_START( redline_80186_sh_start );
void leland_dac_update(int dacnum, UINT8 sample);
void leland_80186_sound_init(void);
@@ -127,7 +130,7 @@ ADDRESS_MAP_EXTERN(ataxx_80186_map_io, 16);
extern UINT8 *ataxx_qram;
WRITE8_HANDLER( leland_scroll_w );
-WRITE8_HANDLER( leland_gfx_port_w );
+WRITE8_DEVICE_HANDLER( leland_gfx_port_w );
WRITE8_HANDLER( leland_master_video_addr_w );
WRITE8_HANDLER( leland_mvram_port_w );
diff --git a/src/mame/includes/mario.h b/src/mame/includes/mario.h
index 317b52590b8..6d745592bc6 100644
--- a/src/mame/includes/mario.h
+++ b/src/mame/includes/mario.h
@@ -72,8 +72,8 @@ VIDEO_UPDATE( mario );
/*----------- defined in audio/mario.c -----------*/
-WRITE8_HANDLER( mario_sh1_w );
-WRITE8_HANDLER( mario_sh2_w );
+WRITE8_DEVICE_HANDLER( mario_sh1_w );
+WRITE8_DEVICE_HANDLER( mario_sh2_w );
WRITE8_HANDLER( mario_sh3_w );
WRITE8_HANDLER( mario_sh_tuneselect_w );
diff --git a/src/mame/includes/meadows.h b/src/mame/includes/meadows.h
index 1f9fa547fd3..e294c043e49 100644
--- a/src/mame/includes/meadows.h
+++ b/src/mame/includes/meadows.h
@@ -9,7 +9,7 @@
/*----------- defined in audio/meadows.c -----------*/
SAMPLES_START( meadows_sh_start );
-void meadows_sh_dac_w(int data);
+void meadows_sh_dac_w(running_machine *machine, int data);
void meadows_sh_update(running_machine *machine);
extern UINT8 meadows_0c00;
extern UINT8 meadows_0c01;
diff --git a/src/mame/includes/mw8080bw.h b/src/mame/includes/mw8080bw.h
index d8222dba7b5..7c1d241487d 100644
--- a/src/mame/includes/mw8080bw.h
+++ b/src/mame/includes/mw8080bw.h
@@ -97,8 +97,8 @@ MACHINE_RESET( mw8080bw );
/*----------- defined in audio/mw8080bw.c -----------*/
-WRITE8_HANDLER( midway_tone_generator_lo_w );
-WRITE8_HANDLER( midway_tone_generator_hi_w );
+WRITE8_DEVICE_HANDLER( midway_tone_generator_lo_w );
+WRITE8_DEVICE_HANDLER( midway_tone_generator_hi_w );
MACHINE_DRIVER_EXTERN( seawolf_audio );
WRITE8_HANDLER( seawolf_audio_w );
@@ -107,27 +107,27 @@ MACHINE_DRIVER_EXTERN( gunfight_audio );
WRITE8_HANDLER( gunfight_audio_w );
MACHINE_DRIVER_EXTERN( tornbase_audio );
-WRITE8_HANDLER( tornbase_audio_w );
+WRITE8_DEVICE_HANDLER( tornbase_audio_w );
MACHINE_DRIVER_EXTERN( zzzap_audio );
WRITE8_HANDLER( zzzap_audio_1_w );
WRITE8_HANDLER( zzzap_audio_2_w );
MACHINE_DRIVER_EXTERN( maze_audio );
-void maze_write_discrete(running_machine *machine, UINT8 maze_tone_timing_state);
+void maze_write_discrete(const device_config *device, UINT8 maze_tone_timing_state);
MACHINE_DRIVER_EXTERN( boothill_audio );
-WRITE8_HANDLER( boothill_audio_w );
+WRITE8_DEVICE_HANDLER( boothill_audio_w );
MACHINE_DRIVER_EXTERN( checkmat_audio );
-WRITE8_HANDLER( checkmat_audio_w );
+WRITE8_DEVICE_HANDLER( checkmat_audio_w );
MACHINE_DRIVER_EXTERN( desertgu_audio );
-WRITE8_HANDLER( desertgu_audio_1_w );
-WRITE8_HANDLER( desertgu_audio_2_w );
+WRITE8_DEVICE_HANDLER( desertgu_audio_1_w );
+WRITE8_DEVICE_HANDLER( desertgu_audio_2_w );
MACHINE_DRIVER_EXTERN( dplay_audio );
-WRITE8_HANDLER( dplay_audio_w );
+WRITE8_DEVICE_HANDLER( dplay_audio_w );
MACHINE_DRIVER_EXTERN( gmissile_audio );
WRITE8_HANDLER( gmissile_audio_1_w );
@@ -140,7 +140,7 @@ WRITE8_HANDLER( m4_audio_2_w );
MACHINE_DRIVER_EXTERN( clowns_audio );
WRITE8_HANDLER( clowns_audio_1_w );
-WRITE8_HANDLER( clowns_audio_2_w );
+WRITE8_DEVICE_HANDLER( clowns_audio_2_w );
MACHINE_DRIVER_EXTERN( shuffle_audio );
WRITE8_HANDLER( shuffle_audio_1_w );
@@ -150,16 +150,16 @@ MACHINE_DRIVER_EXTERN( dogpatch_audio );
WRITE8_HANDLER( dogpatch_audio_w );
MACHINE_DRIVER_EXTERN( spcenctr_audio );
-WRITE8_HANDLER( spcenctr_audio_1_w );
-WRITE8_HANDLER( spcenctr_audio_2_w );
-WRITE8_HANDLER( spcenctr_audio_3_w );
+WRITE8_DEVICE_HANDLER( spcenctr_audio_1_w );
+WRITE8_DEVICE_HANDLER( spcenctr_audio_2_w );
+WRITE8_DEVICE_HANDLER( spcenctr_audio_3_w );
MACHINE_DRIVER_EXTERN( phantom2_audio );
WRITE8_HANDLER( phantom2_audio_1_w );
WRITE8_HANDLER( phantom2_audio_2_w );
MACHINE_DRIVER_EXTERN( bowler_audio );
-WRITE8_HANDLER( bowler_audio_1_w );
+WRITE8_DEVICE_HANDLER( bowler_audio_1_w );
WRITE8_HANDLER( bowler_audio_2_w );
WRITE8_HANDLER( bowler_audio_3_w );
WRITE8_HANDLER( bowler_audio_4_w );
@@ -168,17 +168,17 @@ WRITE8_HANDLER( bowler_audio_6_w );
MACHINE_DRIVER_EXTERN( invaders_samples_audio );
MACHINE_DRIVER_EXTERN( invaders_audio );
-WRITE8_HANDLER( invaders_audio_1_w );
-WRITE8_HANDLER( invaders_audio_2_w );
+WRITE8_DEVICE_HANDLER( invaders_audio_1_w );
+WRITE8_DEVICE_HANDLER( invaders_audio_2_w );
MACHINE_DRIVER_EXTERN( blueshrk_audio );
-WRITE8_HANDLER( blueshrk_audio_w );
+WRITE8_DEVICE_HANDLER( blueshrk_audio_w );
MACHINE_DRIVER_EXTERN( invad2ct_audio );
-WRITE8_HANDLER( invad2ct_audio_1_w );
-WRITE8_HANDLER( invad2ct_audio_2_w );
-WRITE8_HANDLER( invad2ct_audio_3_w );
-WRITE8_HANDLER( invad2ct_audio_4_w );
+WRITE8_DEVICE_HANDLER( invad2ct_audio_1_w );
+WRITE8_DEVICE_HANDLER( invad2ct_audio_2_w );
+WRITE8_DEVICE_HANDLER( invad2ct_audio_3_w );
+WRITE8_DEVICE_HANDLER( invad2ct_audio_4_w );
diff --git a/src/mame/includes/orbit.h b/src/mame/includes/orbit.h
index 5bf78e85cf5..615b8aba2be 100644
--- a/src/mame/includes/orbit.h
+++ b/src/mame/includes/orbit.h
@@ -18,10 +18,10 @@
/*----------- defined in audio/orbit.c -----------*/
-WRITE8_HANDLER( orbit_note_w );
-WRITE8_HANDLER( orbit_note_amp_w );
-WRITE8_HANDLER( orbit_noise_amp_w );
-WRITE8_HANDLER( orbit_noise_rst_w );
+WRITE8_DEVICE_HANDLER( orbit_note_w );
+WRITE8_DEVICE_HANDLER( orbit_note_amp_w );
+WRITE8_DEVICE_HANDLER( orbit_noise_amp_w );
+WRITE8_DEVICE_HANDLER( orbit_noise_rst_w );
DISCRETE_SOUND_EXTERN( orbit );
diff --git a/src/mame/includes/phoenix.h b/src/mame/includes/phoenix.h
index 519daf4018b..9cc6bcfab35 100644
--- a/src/mame/includes/phoenix.h
+++ b/src/mame/includes/phoenix.h
@@ -1,5 +1,4 @@
#include "sound/discrete.h"
-#include "sound/custom.h"
/*----------- video timing -----------*/
@@ -21,10 +20,11 @@ SOUND_START( phoenix );
DISCRETE_SOUND_EXTERN( phoenix );
-WRITE8_HANDLER( phoenix_sound_control_a_w );
-WRITE8_HANDLER( phoenix_sound_control_b_w );
+WRITE8_DEVICE_HANDLER( phoenix_sound_control_a_w );
+WRITE8_DEVICE_HANDLER( phoenix_sound_control_b_w );
-CUSTOM_START( phoenix_sh_start );
+DEVICE_GET_INFO( phoenix_sound );
+#define SOUND_PHOENIX DEVICE_GET_INFO_NAME(phoenix_sound)
/*----------- defined in audio/pleiads.c -----------*/
@@ -32,9 +32,14 @@ WRITE8_HANDLER( pleiads_sound_control_a_w );
WRITE8_HANDLER( pleiads_sound_control_b_w );
WRITE8_HANDLER( pleiads_sound_control_c_w );
-CUSTOM_START( pleiads_sh_start );
-CUSTOM_START( naughtyb_sh_start );
-CUSTOM_START( popflame_sh_start );
+DEVICE_GET_INFO( pleiads_sound );
+#define SOUND_PLEIADS DEVICE_GET_INFO_NAME(pleiads_sound)
+
+DEVICE_GET_INFO( naughtyb_sound );
+#define SOUND_NAUGHTYB DEVICE_GET_INFO_NAME(naughtyb_sound)
+
+DEVICE_GET_INFO( popflame_sound );
+#define SOUND_POPFLAME DEVICE_GET_INFO_NAME(popflame_sound)
/*----------- defined in video/naughtyb.c -----------*/
@@ -66,7 +71,7 @@ WRITE8_HANDLER( phoenix_scroll_w );
CUSTOM_INPUT( player_input_r );
CUSTOM_INPUT( pleiads_protection_r );
READ8_HANDLER( survival_input_port_0_r );
-READ8_HANDLER( survival_protection_r );
+READ8_DEVICE_HANDLER( survival_protection_r );
int survival_sid_callback( const device_config *device );
diff --git a/src/mame/includes/polepos.h b/src/mame/includes/polepos.h
index a0b8b7b9633..810777782a9 100644
--- a/src/mame/includes/polepos.h
+++ b/src/mame/includes/polepos.h
@@ -5,13 +5,13 @@
*************************************************************************/
#include "sound/discrete.h"
-#include "sound/custom.h"
/*----------- defined in audio/polepos.c -----------*/
-CUSTOM_START( polepos_sh_start );
-CUSTOM_RESET( polepos_sh_reset );
+DEVICE_GET_INFO( polepos_sound );
+#define SOUND_POLEPOS DEVICE_GET_INFO_NAME(polepos_sound)
+
WRITE8_HANDLER( polepos_engine_sound_lsb_w );
WRITE8_HANDLER( polepos_engine_sound_msb_w );
diff --git a/src/mame/includes/polyplay.h b/src/mame/includes/polyplay.h
index 7618c28fb2f..898bd29ff8a 100644
--- a/src/mame/includes/polyplay.h
+++ b/src/mame/includes/polyplay.h
@@ -4,8 +4,8 @@
void polyplay_set_channel1(int active);
void polyplay_set_channel2(int active);
-void polyplay_play_channel1(int data);
-void polyplay_play_channel2(int data);
+void polyplay_play_channel1(running_machine *machine, int data);
+void polyplay_play_channel2(running_machine *machine, int data);
SAMPLES_START( polyplay_sh_start );
diff --git a/src/mame/includes/poolshrk.h b/src/mame/includes/poolshrk.h
index b0cc7b65ead..33b786dbd69 100644
--- a/src/mame/includes/poolshrk.h
+++ b/src/mame/includes/poolshrk.h
@@ -10,10 +10,10 @@
/*----------- defined in audio/poolshrk.c -----------*/
-WRITE8_HANDLER( poolshrk_scratch_sound_w );
-WRITE8_HANDLER( poolshrk_score_sound_w );
-WRITE8_HANDLER( poolshrk_click_sound_w );
-WRITE8_HANDLER( poolshrk_bump_sound_w );
+WRITE8_DEVICE_HANDLER( poolshrk_scratch_sound_w );
+WRITE8_DEVICE_HANDLER( poolshrk_score_sound_w );
+WRITE8_DEVICE_HANDLER( poolshrk_click_sound_w );
+WRITE8_DEVICE_HANDLER( poolshrk_bump_sound_w );
DISCRETE_SOUND_EXTERN( poolshrk );
diff --git a/src/mame/includes/rockola.h b/src/mame/includes/rockola.h
index 6bce305330c..76bec491ca5 100644
--- a/src/mame/includes/rockola.h
+++ b/src/mame/includes/rockola.h
@@ -9,7 +9,6 @@
/*----------- defined in audio/rockola.c -----------*/
-extern const custom_sound_interface custom_interface;
extern const samples_interface sasuke_samples_interface;
extern const samples_interface vanguard_samples_interface;
extern const samples_interface fantasy_samples_interface;
@@ -28,7 +27,9 @@ extern WRITE8_HANDLER( vanguard_speech_w );
extern WRITE8_HANDLER( fantasy_sound_w );
extern WRITE8_HANDLER( fantasy_speech_w );
-CUSTOM_START( rockola_sh_start );
+DEVICE_GET_INFO( rockola_sound );
+#define SOUND_ROCKOLA DEVICE_GET_INFO_NAME(rockola_sound)
+
void rockola_set_music_clock(double clock_time);
void rockola_set_music_freq(int freq);
int rockola_music0_playing(void);
diff --git a/src/mame/includes/segag80v.h b/src/mame/includes/segag80v.h
index 0984c0bb5da..bcd71802976 100644
--- a/src/mame/includes/segag80v.h
+++ b/src/mame/includes/segag80v.h
@@ -4,8 +4,6 @@
*************************************************************************/
-#include "sound/custom.h"
-
/*----------- defined in audio/segag80v.c -----------*/
diff --git a/src/mame/includes/simpsons.h b/src/mame/includes/simpsons.h
index 540f5bc9e8b..3f3336fc118 100644
--- a/src/mame/includes/simpsons.h
+++ b/src/mame/includes/simpsons.h
@@ -6,7 +6,7 @@ READ8_HANDLER( simpsons_eeprom_r );
WRITE8_HANDLER( simpsons_eeprom_w );
WRITE8_HANDLER( simpsons_coin_counter_w );
READ8_HANDLER( simpsons_sound_interrupt_r );
-READ8_HANDLER( simpsons_sound_r );
+READ8_DEVICE_HANDLER( simpsons_sound_r );
MACHINE_RESET( simpsons );
NVRAM_HANDLER( simpsons );
diff --git a/src/mame/includes/snes.h b/src/mame/includes/snes.h
index f1073e2d52f..f2854d1b031 100644
--- a/src/mame/includes/snes.h
+++ b/src/mame/includes/snes.h
@@ -2,7 +2,6 @@
#define _SNES_H_
#include "streams.h"
-#include "sound/custom.h"
/*
SNES timing theory:
@@ -493,7 +492,9 @@ extern WRITE8_HANDLER( spc_io_w );
extern READ8_HANDLER( spc_ram_r );
extern WRITE8_HANDLER( spc_ram_w );
extern READ8_HANDLER( spc_ipl_r );
-extern CUSTOM_START( snes_sh_start );
+extern DEVICE_GET_INFO( snes_sound );
+#define SOUND_SNES DEVICE_GET_INFO_NAME( snes_sound )
+
extern STREAM_UPDATE( snes_sh_update );
/* Stuff from OpenSPC 0.3.99 by Brad Martin */
diff --git a/src/mame/includes/stfight.h b/src/mame/includes/stfight.h
index 3eb32fd8262..273251dec55 100644
--- a/src/mame/includes/stfight.h
+++ b/src/mame/includes/stfight.h
@@ -11,7 +11,7 @@ WRITE8_HANDLER( stfight_coin_w );
WRITE8_HANDLER( stfight_e800_w );
READ8_HANDLER( stfight_fm_r );
void stfight_adpcm_int(const device_config *device);
-WRITE8_HANDLER( stfight_adpcm_control_w );
+WRITE8_DEVICE_HANDLER( stfight_adpcm_control_w );
/*----------- defined in video/stfight.c -----------*/
diff --git a/src/mame/includes/subs.h b/src/mame/includes/subs.h
index 1aec4a944f4..47b7de4d5a4 100644
--- a/src/mame/includes/subs.h
+++ b/src/mame/includes/subs.h
@@ -30,11 +30,11 @@ WRITE8_HANDLER( subs_lamp2_w );
/*----------- defined in audio/subs.c -----------*/
-WRITE8_HANDLER( subs_noise_reset_w );
-WRITE8_HANDLER( subs_sonar2_w );
-WRITE8_HANDLER( subs_sonar1_w );
-WRITE8_HANDLER( subs_crash_w );
-WRITE8_HANDLER( subs_explode_w );
+WRITE8_DEVICE_HANDLER( subs_noise_reset_w );
+WRITE8_DEVICE_HANDLER( subs_sonar2_w );
+WRITE8_DEVICE_HANDLER( subs_sonar1_w );
+WRITE8_DEVICE_HANDLER( subs_crash_w );
+WRITE8_DEVICE_HANDLER( subs_explode_w );
DISCRETE_SOUND_EXTERN( subs );
diff --git a/src/mame/includes/suna8.h b/src/mame/includes/suna8.h
index bf6749edc9a..0dbc9d4f293 100644
--- a/src/mame/includes/suna8.h
+++ b/src/mame/includes/suna8.h
@@ -2,8 +2,8 @@
/*----------- defined in audio/suna8.c -----------*/
-WRITE8_HANDLER( suna8_play_samples_w );
-WRITE8_HANDLER( suna8_samples_number_w );
+WRITE8_DEVICE_HANDLER( suna8_play_samples_w );
+WRITE8_DEVICE_HANDLER( suna8_samples_number_w );
SAMPLES_START( suna8_sh_start );
diff --git a/src/mame/includes/tatsumi.h b/src/mame/includes/tatsumi.h
index 8b34719c0e0..4383d37b019 100644
--- a/src/mame/includes/tatsumi.h
+++ b/src/mame/includes/tatsumi.h
@@ -32,8 +32,8 @@ WRITE16_HANDLER( apache3_a0000_w );
WRITE16_HANDLER( roundup5_d0000_w );
WRITE16_HANDLER( roundup5_e0000_w );
-READ8_HANDLER(tatsumi_hack_ym2151_r);
-READ8_HANDLER(tatsumi_hack_oki_r);
+READ8_DEVICE_HANDLER(tatsumi_hack_ym2151_r);
+READ8_DEVICE_HANDLER(tatsumi_hack_oki_r);
extern UINT16 *tatsumi_68k_ram;
extern UINT8 *apache3_z80_ram;
diff --git a/src/mame/includes/tiamc1.h b/src/mame/includes/tiamc1.h
index 6cd5b77d8c1..8e3007d2b48 100644
--- a/src/mame/includes/tiamc1.h
+++ b/src/mame/includes/tiamc1.h
@@ -1,8 +1,8 @@
-#include "sound/custom.h"
-
/*----------- defined in audio/tiamc1.c -----------*/
-CUSTOM_START( tiamc1_sh_start );
+DEVICE_GET_INFO( tiamc1_sound );
+#define SOUND_TIAMC1 DEVICE_GET_INFO_NAME(tiamc1_sound)
+
WRITE8_HANDLER( tiamc1_timer0_w );
WRITE8_HANDLER( tiamc1_timer1_w );
WRITE8_HANDLER( tiamc1_timer1_gate_w );
diff --git a/src/mame/includes/toaplan2.h b/src/mame/includes/toaplan2.h
index efb465742c1..048abb1d999 100644
--- a/src/mame/includes/toaplan2.h
+++ b/src/mame/includes/toaplan2.h
@@ -1,9 +1,9 @@
/*----------- defined in audio/toaplan2.c -----------*/
-void dogyuun_okisnd_w(const address_space *space, int data);
-void kbash_okisnd_w(const address_space *space, int data);
-void fixeight_okisnd_w(const address_space *space, int data);
-void batsugun_okisnd_w(const address_space *space, int data);
+void dogyuun_okisnd_w(const device_config *device, int data);
+void kbash_okisnd_w(const device_config *device, int data);
+void fixeight_okisnd_w(const device_config *device, int data);
+void batsugun_okisnd_w(const device_config *device, int data);
/*----------- defined in drivers/toaplan2.c -----------*/
diff --git a/src/mame/includes/tx1.h b/src/mame/includes/tx1.h
index f458bd76cfb..f2782bc5218 100644
--- a/src/mame/includes/tx1.h
+++ b/src/mame/includes/tx1.h
@@ -4,7 +4,6 @@
*************************************************************************/
#include "machine/8255ppi.h"
-#include "sound/custom.h"
#define TX1_PIXEL_CLOCK (XTAL_18MHz / 3)
#define TX1_HBSTART 256
@@ -53,16 +52,16 @@ MACHINE_START( buggyboy );
READ8_HANDLER( tx1_pit8253_r );
WRITE8_HANDLER( tx1_pit8253_w );
-WRITE8_HANDLER( bb_ym1_a_w );
-WRITE8_HANDLER( bb_ym2_a_w );
-WRITE8_HANDLER( bb_ym2_b_w );
-CUSTOM_START( buggyboy_sh_start );
-CUSTOM_RESET( buggyboy_sh_reset );
+WRITE8_DEVICE_HANDLER( bb_ym1_a_w );
+WRITE8_DEVICE_HANDLER( bb_ym2_a_w );
+WRITE8_DEVICE_HANDLER( bb_ym2_b_w );
+DEVICE_GET_INFO( buggyboy_sound );
+#define SOUND_BUGGYBOY DEVICE_GET_INFO_NAME(buggyboy_sound)
-WRITE8_HANDLER( tx1_ay8910_a_w );
-WRITE8_HANDLER( tx1_ay8910_b_w );
-CUSTOM_START( tx1_sh_start );
-CUSTOM_RESET( tx1_sh_reset );
+WRITE8_DEVICE_HANDLER( tx1_ay8910_a_w );
+WRITE8_DEVICE_HANDLER( tx1_ay8910_b_w );
+DEVICE_GET_INFO( tx1_sound );
+#define SOUND_TX1 DEVICE_GET_INFO_NAME(tx1_sound)
/*----------- defined in video/tx1.c -----------*/
diff --git a/src/mame/includes/warpwarp.h b/src/mame/includes/warpwarp.h
index be1027f4a9f..1d8896e8f96 100644
--- a/src/mame/includes/warpwarp.h
+++ b/src/mame/includes/warpwarp.h
@@ -1,5 +1,3 @@
-#include "sound/custom.h"
-
/*----------- defined in video/warpwarp.c -----------*/
extern UINT8 *geebee_videoram,*warpwarp_videoram;
@@ -25,7 +23,8 @@ WRITE8_HANDLER( geebee_videoram_w );
/*----------- defined in audio/geebee.c -----------*/
WRITE8_HANDLER( geebee_sound_w );
-CUSTOM_START( geebee_sh_start );
+DEVICE_GET_INFO( geebee_sound );
+#define SOUND_GEEBEE DEVICE_GET_INFO_NAME(geebee_sound)
/*----------- defined in audio/warpwarp.c -----------*/
@@ -33,4 +32,5 @@ CUSTOM_START( geebee_sh_start );
WRITE8_HANDLER( warpwarp_sound_w );
WRITE8_HANDLER( warpwarp_music1_w );
WRITE8_HANDLER( warpwarp_music2_w );
-CUSTOM_START( warpwarp_sh_start );
+DEVICE_GET_INFO( warpwarp_sound );
+#define SOUND_WARPWARP DEVICE_GET_INFO_NAME(warpwarp_sound)
diff --git a/src/mame/machine/archimds.c b/src/mame/machine/archimds.c
index 4fe1fb9b22a..3d1b526772b 100644
--- a/src/mame/machine/archimds.c
+++ b/src/mame/machine/archimds.c
@@ -593,7 +593,7 @@ WRITE32_HANDLER(memc_w)
else
{
timer_adjust_oneshot(snd_timer, attotime_never, 0);
- dac_signed_data_w(0, 0x80);
+ dac_signed_data_w(devtag_get_device(space->machine, SOUND, "dac"), 0x80);
}
break;
diff --git a/src/mame/machine/atari.c b/src/mame/machine/atari.c
index a3b475ee30c..99742fc9a61 100644
--- a/src/mame/machine/atari.c
+++ b/src/mame/machine/atari.c
@@ -39,7 +39,7 @@ static void a600xl_mmu(running_machine *machine, UINT8 new_mmu);
static void pokey_reset(running_machine *machine);
-void atari_interrupt_cb(running_machine *machine, int mask)
+void atari_interrupt_cb(const device_config *device, int mask)
{
if (VERBOSE_POKEY)
@@ -68,7 +68,7 @@ void atari_interrupt_cb(running_machine *machine, int mask)
logerror("atari interrupt_cb TIMR1\n");
}
- cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE);
+ cpu_set_input_line(device->machine->cpu[0], 0, HOLD_LINE);
}
/**************************************************************
@@ -517,6 +517,7 @@ static const UINT8 keys[64][4] = {
void a800_handle_keyboard(running_machine *machine)
{
+ const device_config *pokey = devtag_get_device(machine, SOUND, "pokey");
static int atari_last = 0xff;
int i, modifiers, atari_code;
char tag[64];
@@ -544,16 +545,16 @@ void a800_handle_keyboard(running_machine *machine)
atari_last = atari_code;
if( (atari_code & 0x3f) == AKEY_BREAK )
{
- pokey1_break_w(atari_code & 0x40);
+ pokey_break_w(pokey, atari_code & 0x40);
return;
}
- pokey1_kbcode_w(atari_code, 1);
+ pokey_kbcode_w(pokey, atari_code, 1);
return;
}
}
}
/* remove key pressed status bit from skstat */
- pokey1_kbcode_w(AKEY_NONE, 0);
+ pokey_kbcode_w(pokey, AKEY_NONE, 0);
atari_last = AKEY_NONE;
}
@@ -562,6 +563,7 @@ void a800_handle_keyboard(running_machine *machine)
/* absolutely no clue what to do here :((( */
void a5200_handle_keypads(running_machine *machine)
{
+ const device_config *pokey = devtag_get_device(machine, SOUND, "pokey");
int i, modifiers;
static int atari_last = 0xff;
@@ -585,10 +587,10 @@ void a5200_handle_keypads(running_machine *machine)
atari_last = i;
if( i == 0 )
{
- pokey1_break_w(i & 0x40);
+ pokey_break_w(pokey, i & 0x40);
return;
}
- pokey1_kbcode_w((i << 1) | 0x21, 1);
+ pokey_kbcode_w(pokey, (i << 1) | 0x21, 1);
return;
}
}
@@ -598,16 +600,16 @@ void a5200_handle_keypads(running_machine *machine)
{
if (atari_last == 0xFE)
return;
- pokey1_kbcode_w(0x61, 1);
- //pokey1_break_w(0x40);
+ pokey_kbcode_w(pokey, 0x61, 1);
+ //pokey_break_w(pokey, 0x40);
atari_last = 0xFE;
return;
}
else if (atari_last == 0xFE)
- pokey1_kbcode_w(0x21, 1);
+ pokey_kbcode_w(pokey, 0x21, 1);
/* remove key pressed status bit from skstat */
- pokey1_kbcode_w(0xFF, 0);
+ pokey_kbcode_w(pokey, 0xFF, 0);
atari_last = 0xff;
}
@@ -691,8 +693,8 @@ static void a800_setbank(running_machine *machine, int n)
static void pokey_reset(running_machine *machine)
{
- const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
- pokey1_w(space,15,0);
+ const device_config *pokey = devtag_get_device(machine, SOUND, "pokey");
+ pokey_w(pokey,15,0);
}
@@ -716,10 +718,11 @@ static UINT8 console_read(const address_space *space)
static void console_write(const address_space *space, UINT8 data)
{
+ const device_config *dac = devtag_get_device(space->machine, SOUND, "dac");
if (data & 0x08)
- dac_data_w(0, -120);
+ dac_data_w(dac, -120);
else
- dac_data_w(0, +120);
+ dac_data_w(dac, +120);
}
@@ -744,7 +747,7 @@ static void atari_machine_start(running_machine *machine, int type, const pia682
memset(&gtia_intf, 0, sizeof(gtia_intf));
if (input_port_by_tag(machine->portconfig, "console") != NULL)
gtia_intf.console_read = console_read;
- if (sndti_exists(SOUND_DAC, 0))
+ if (devtag_get_device(machine, SOUND, "dac") != NULL)
gtia_intf.console_write = console_write;
gtia_init(machine, &gtia_intf);
diff --git a/src/mame/machine/atarifb.c b/src/mame/machine/atarifb.c
index b3dabdfe625..1e5c3d5533d 100644
--- a/src/mame/machine/atarifb.c
+++ b/src/mame/machine/atarifb.c
@@ -18,23 +18,27 @@ static int sign_x_4, sign_y_4;
WRITE8_HANDLER( atarifb_out1_w )
{
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+
CTRLD = data;
- discrete_sound_w(space, ATARIFB_WHISTLE_EN, data & 0x01); // Whistle
- discrete_sound_w(space, ATARIFB_HIT_EN, data & 0x02); // Hit
- discrete_sound_w(space, ATARIFB_ATTRACT_EN, data & 0x10); // Attract
- discrete_sound_w(space, ATARIFB_NOISE_EN, data & 0x04); // Noise Enable / Kicker
+ discrete_sound_w(discrete, ATARIFB_WHISTLE_EN, data & 0x01); // Whistle
+ discrete_sound_w(discrete, ATARIFB_HIT_EN, data & 0x02); // Hit
+ discrete_sound_w(discrete, ATARIFB_ATTRACT_EN, data & 0x10); // Attract
+ discrete_sound_w(discrete, ATARIFB_NOISE_EN, data & 0x04); // Noise Enable / Kicker
}
WRITE8_HANDLER( atarifb4_out1_w )
{
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+
CTRLD = data;
- discrete_sound_w(space, ATARIFB_WHISTLE_EN, data & 0x01); // Whistle
- discrete_sound_w(space, ATARIFB_HIT_EN, data & 0x02); // Hit
- discrete_sound_w(space, ATARIFB_ATTRACT_EN, data & 0x10); // Attract
- discrete_sound_w(space, ATARIFB_NOISE_EN, data & 0x04); // Noise Enable / Kicker
+ discrete_sound_w(discrete, ATARIFB_WHISTLE_EN, data & 0x01); // Whistle
+ discrete_sound_w(discrete, ATARIFB_HIT_EN, data & 0x02); // Hit
+ discrete_sound_w(discrete, ATARIFB_ATTRACT_EN, data & 0x10); // Attract
+ discrete_sound_w(discrete, ATARIFB_NOISE_EN, data & 0x04); // Noise Enable / Kicker
coin_counter_w (1, data & 0x80);
}
@@ -42,12 +46,14 @@ WRITE8_HANDLER( atarifb4_out1_w )
WRITE8_HANDLER( abaseb_out1_w )
{
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+
CTRLD = data;
- discrete_sound_w(space, ATARIFB_WHISTLE_EN, data & 0x01); // Whistle
- discrete_sound_w(space, ATARIFB_HIT_EN, data & 0x02); // Hit
- discrete_sound_w(space, ATARIFB_ATTRACT_EN, data & 0x10); // Attract
- discrete_sound_w(space, ATARIFB_NOISE_EN, data & 0x04); // Noise Enable / Kicker
+ discrete_sound_w(discrete, ATARIFB_WHISTLE_EN, data & 0x01); // Whistle
+ discrete_sound_w(discrete, ATARIFB_HIT_EN, data & 0x02); // Hit
+ discrete_sound_w(discrete, ATARIFB_ATTRACT_EN, data & 0x10); // Attract
+ discrete_sound_w(discrete, ATARIFB_NOISE_EN, data & 0x04); // Noise Enable / Kicker
if (data & 0x80)
{
@@ -66,6 +72,8 @@ WRITE8_HANDLER( abaseb_out1_w )
WRITE8_HANDLER( soccer_out1_w )
{
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+
CTRLD = data;
/* bit 0 = whistle */
@@ -76,10 +84,10 @@ WRITE8_HANDLER( soccer_out1_w )
/* bit 5-6 = trackball CTRL bits */
/* bit 7 = Rule LED */
- discrete_sound_w(space, ATARIFB_WHISTLE_EN, data & 0x01); // Whistle
- discrete_sound_w(space, ATARIFB_HIT_EN, data & 0x02); // Hit
- discrete_sound_w(space, ATARIFB_ATTRACT_EN, data & 0x10); // Attract
- discrete_sound_w(space, ATARIFB_NOISE_EN, data & 0x04); // Noise Enable / Kicker
+ discrete_sound_w(discrete, ATARIFB_WHISTLE_EN, data & 0x01); // Whistle
+ discrete_sound_w(discrete, ATARIFB_HIT_EN, data & 0x02); // Hit
+ discrete_sound_w(discrete, ATARIFB_ATTRACT_EN, data & 0x10); // Attract
+ discrete_sound_w(discrete, ATARIFB_NOISE_EN, data & 0x04); // Noise Enable / Kicker
// set_led_status(0,data & 0x10); // !!!!!!!!!! Is this correct????
set_led_status(1,data & 0x80);
@@ -88,7 +96,9 @@ WRITE8_HANDLER( soccer_out1_w )
WRITE8_HANDLER( atarifb_out2_w )
{
- discrete_sound_w(space, ATARIFB_CROWD_DATA, data & 0x0f); // Crowd
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+
+ discrete_sound_w(discrete, ATARIFB_CROWD_DATA, data & 0x0f); // Crowd
coin_counter_w (0, data & 0x10);
}
@@ -96,7 +106,9 @@ WRITE8_HANDLER( atarifb_out2_w )
WRITE8_HANDLER( soccer_out2_w )
{
- discrete_sound_w(space, ATARIFB_CROWD_DATA, data & 0x0f); // Crowd
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+
+ discrete_sound_w(discrete, ATARIFB_CROWD_DATA, data & 0x0f); // Crowd
coin_counter_w (0, data & 0x10);
coin_counter_w (1, data & 0x20);
diff --git a/src/mame/machine/atarigen.c b/src/mame/machine/atarigen.c
index f7971556863..8ec2a4b8893 100644
--- a/src/mame/machine/atarigen.c
+++ b/src/mame/machine/atarigen.c
@@ -672,10 +672,10 @@ WRITE8_HANDLER( atarigen_6502_irq_ack_w )
IRQ line.
---------------------------------------------------------------*/
-void atarigen_ym2151_irq_gen(running_machine *machine, int irq)
+void atarigen_ym2151_irq_gen(const device_config *device, int irq)
{
ym2151_int = irq;
- update_6502_irq(machine);
+ update_6502_irq(device->machine);
}
@@ -874,17 +874,11 @@ static TIMER_CALLBACK( delayed_6502_sound_w )
void atarigen_set_vol(running_machine *machine, int volume, sound_type type)
{
- int sndindex = 0;
- int ch;
-
- for (ch = 0; ch < MAX_SOUND; ch++)
- if (machine->config->sound[ch].type == type)
- {
- int output;
- for (output = 0; output < 2; output++)
- sndti_set_output_gain(type, sndindex, output, volume / 100.0);
- sndindex++;
- }
+ const device_config *device;
+
+ for (device = sound_first(machine->config); device != NULL; device = sound_next(device))
+ if (sound_get_type(device) == type)
+ sound_set_output_gain(device, ALL_OUTPUTS, volume / 100.0);
}
diff --git a/src/mame/machine/atarigen.h b/src/mame/machine/atarigen.h
index 3b52dee7927..5b74e118233 100644
--- a/src/mame/machine/atarigen.h
+++ b/src/mame/machine/atarigen.h
@@ -151,7 +151,7 @@ INTERRUPT_GEN( atarigen_6502_irq_gen );
READ8_HANDLER( atarigen_6502_irq_ack_r );
WRITE8_HANDLER( atarigen_6502_irq_ack_w );
-void atarigen_ym2151_irq_gen(running_machine *machine, int irq);
+void atarigen_ym2151_irq_gen(const device_config *device, int irq);
WRITE16_HANDLER( atarigen_sound_w );
READ16_HANDLER( atarigen_sound_r );
diff --git a/src/mame/machine/balsente.c b/src/mame/machine/balsente.c
index f8576871e7c..f93e7309cc8 100644
--- a/src/mame/machine/balsente.c
+++ b/src/mame/machine/balsente.c
@@ -184,9 +184,13 @@ MACHINE_RESET( balsente )
/* reset the noise generator */
memset(noise_position, 0, sizeof(noise_position));
+ /* find the CEM devices */
for (i = 0; i < ARRAY_LENGTH(cem_device); i++)
{
- cem_device[i]=NULL;
+ char name[10];
+ sprintf(name, "cem%d", i+1);
+ cem_device[i] = devtag_get_device(machine, SOUND, name);
+ assert(cem_device[i] != NULL);
}
/* point the banks to bank 0 */
@@ -962,17 +966,17 @@ static void update_counter_0_timer(void)
/* find the counter with the maximum frequency */
/* this is used to calibrate the timers at startup */
for (i = 0; i < 6; i++)
- if (cem3394_get_parameter(i, CEM3394_FINAL_GAIN) < 10.0)
+ if (cem3394_get_parameter(cem_device[i], CEM3394_FINAL_GAIN) < 10.0)
{
double tempfreq;
/* if the filter resonance is high, then they're calibrating the filter frequency */
- if (cem3394_get_parameter(i, CEM3394_FILTER_RESONANCE) > 0.9)
- tempfreq = cem3394_get_parameter(i, CEM3394_FILTER_FREQENCY);
+ if (cem3394_get_parameter(cem_device[i], CEM3394_FILTER_RESONANCE) > 0.9)
+ tempfreq = cem3394_get_parameter(cem_device[i], CEM3394_FILTER_FREQENCY);
/* otherwise, they're calibrating the VCO frequency */
else
- tempfreq = cem3394_get_parameter(i, CEM3394_VCO_FREQUENCY);
+ tempfreq = cem3394_get_parameter(cem_device[i], CEM3394_VCO_FREQUENCY);
if (tempfreq > maxfreq) maxfreq = tempfreq;
}
@@ -1017,7 +1021,7 @@ WRITE8_HANDLER( balsente_counter_control_w )
{
int ch;
for (ch = 0; ch < 6; ch++)
- sndti_set_output_gain(SOUND_CEM3394, ch, 0, (data & 0x01) ? 1.0 : 0);
+ sound_set_output_gain(cem_device[ch], 0, (data & 0x01) ? 1.0 : 0);
}
/* bit D1 is hooked to counter 0's gate */
@@ -1081,14 +1085,14 @@ WRITE8_HANDLER( balsente_chip_select_w )
double temp = 0;
/* remember the previous value */
- temp = cem3394_get_parameter(i, reg);
+ temp = cem3394_get_parameter(cem_device[i], reg);
/* set the voltage */
- cem3394_set_voltage(i, reg, voltage);
+ cem3394_set_voltage(cem_device[i], reg, voltage);
/* only log changes */
#if LOG_CEM_WRITES
- if (temp != cem3394_get_parameter(i, reg))
+ if (temp != cem3394_get_parameter(cem_device[i], reg))
{
static const char *const names[] =
{
diff --git a/src/mame/machine/cubocd32.c b/src/mame/machine/cubocd32.c
index 2e703cc258e..003278ecf1b 100644
--- a/src/mame/machine/cubocd32.c
+++ b/src/mame/machine/cubocd32.c
@@ -277,35 +277,35 @@ static const char* get_akiko_reg_name(int reg)
*
************************************/
-static void akiko_cdda_stop( void )
+static void akiko_cdda_stop( running_machine *machine )
{
- int cddanum = cdda_num_from_cdrom(akiko.cdrom);
+ const device_config *cdda = cdda_from_cdrom(machine, akiko.cdrom);
- if (cddanum != -1)
+ if (cdda != NULL)
{
- cdda_stop_audio(cddanum);
+ cdda_stop_audio(cdda);
timer_reset( akiko.frame_timer, attotime_never );
}
}
-static void akiko_cdda_play( UINT32 lba, UINT32 num_blocks )
+static void akiko_cdda_play( running_machine *machine, UINT32 lba, UINT32 num_blocks )
{
- int cddanum = cdda_num_from_cdrom(akiko.cdrom);
- if (cddanum != -1)
+ const device_config *cdda = cdda_from_cdrom(machine, akiko.cdrom);
+ if (cdda != NULL)
{
- cdda_start_audio(cddanum, lba, num_blocks);
+ cdda_start_audio(cdda, lba, num_blocks);
timer_adjust_oneshot( akiko.frame_timer, ATTOTIME_IN_HZ( 75 ), 0 );
}
}
-static void akiko_cdda_pause( int pause )
+static void akiko_cdda_pause( running_machine *machine, int pause )
{
- int cddanum = cdda_num_from_cdrom(akiko.cdrom);
- if (cddanum != -1)
+ const device_config *cdda = cdda_from_cdrom(machine, akiko.cdrom);
+ if (cdda != NULL)
{
- if (cdda_audio_active(cddanum) && cdda_audio_paused(cddanum) != pause )
+ if (cdda_audio_active(cdda) && cdda_audio_paused(cdda) != pause )
{
- cdda_pause_audio(cddanum, pause);
+ cdda_pause_audio(cdda, pause);
if ( pause )
{
@@ -319,19 +319,19 @@ static void akiko_cdda_pause( int pause )
}
}
-static UINT8 akiko_cdda_getstatus( UINT32 *lba )
+static UINT8 akiko_cdda_getstatus( running_machine *machine, UINT32 *lba )
{
- int cddanum = cdda_num_from_cdrom(akiko.cdrom);
+ const device_config *cdda = cdda_from_cdrom(machine, akiko.cdrom);
if ( lba ) *lba = 0;
- if (cddanum != -1)
+ if (cdda != NULL)
{
- if (cdda_audio_active(cddanum))
+ if (cdda_audio_active(cdda))
{
- if ( lba ) *lba = cdda_get_audio_lba(cddanum);
+ if ( lba ) *lba = cdda_get_audio_lba(cdda);
- if (cdda_audio_paused(cddanum))
+ if (cdda_audio_paused(cdda))
{
return 0x12; /* audio paused */
}
@@ -340,7 +340,7 @@ static UINT8 akiko_cdda_getstatus( UINT32 *lba )
return 0x11; /* audio in progress */
}
}
- else if (cdda_audio_ended(cddanum))
+ else if (cdda_audio_ended(cdda))
{
return 0x13; /* audio ended */
}
@@ -362,13 +362,13 @@ static void akiko_set_cd_status( running_machine *machine, UINT32 status )
static TIMER_CALLBACK(akiko_frame_proc)
{
- int cddanum = cdda_num_from_cdrom(akiko.cdrom);
+ const device_config *cdda = cdda_from_cdrom(machine, akiko.cdrom);
(void)param;
- if (cddanum != -1)
+ if (cdda != NULL)
{
- UINT8 s = akiko_cdda_getstatus(NULL);
+ UINT8 s = akiko_cdda_getstatus(machine, NULL);
if ( s == 0x11 )
{
@@ -532,7 +532,7 @@ static TIMER_CALLBACK( akiko_cd_delayed_cmd )
if ( akiko.cdrom_status[0] & 0x10000000 )
return;
- cddastatus = akiko_cdda_getstatus(NULL);
+ cddastatus = akiko_cdda_getstatus(machine, NULL);
if ( cddastatus == 0x11 || cddastatus == 0x12 )
return;
@@ -589,10 +589,10 @@ static void akiko_update_cdrom(const address_space *space)
{
resp[1] = 0x00;
- if ( akiko_cdda_getstatus(NULL) == 0x11 )
+ if ( akiko_cdda_getstatus(space->machine, NULL) == 0x11 )
resp[1] = 0x08;
- akiko_cdda_pause( 1 );
+ akiko_cdda_pause( space->machine, 1 );
akiko.cdrom_cmd_start = (akiko.cdrom_cmd_start+2) & 0xff;
@@ -602,10 +602,10 @@ static void akiko_update_cdrom(const address_space *space)
{
resp[1] = 0x00;
- if ( akiko_cdda_getstatus(NULL) == 0x11 )
+ if ( akiko_cdda_getstatus(space->machine, NULL) == 0x11 )
resp[1] = 0x08;
- akiko_cdda_pause( 0 );
+ akiko_cdda_pause( space->machine, 0 );
akiko.cdrom_cmd_start = (akiko.cdrom_cmd_start+2) & 0xff;
@@ -635,7 +635,7 @@ static void akiko_update_cdrom(const address_space *space)
startpos = lba_from_triplet( &cmdbuf[1] );
endpos = lba_from_triplet( &cmdbuf[4] );
- akiko_cdda_stop();
+ akiko_cdda_stop(space->machine);
resp[1] = 0x00;
@@ -651,7 +651,7 @@ static void akiko_update_cdrom(const address_space *space)
else if ( cmdbuf[10] & 0x04 )
{
logerror( "AKIKO CD: Audio Play - start lba: %08x - end lba: %08x\n", startpos, endpos );
- akiko_cdda_play( startpos, endpos - startpos );
+ akiko_cdda_play( space->machine, startpos, endpos - startpos );
resp[1] = 0x08;
}
else
@@ -688,7 +688,7 @@ static void akiko_update_cdrom(const address_space *space)
resp[1] = 0x00;
- (void)akiko_cdda_getstatus( &lba );
+ (void)akiko_cdda_getstatus( space->machine, &lba );
if ( lba > 0 )
{
@@ -757,7 +757,7 @@ READ32_HANDLER(amiga_akiko32_r)
switch( offset )
{
case 0x00/4: /* ID */
- if ( akiko.cdrom != NULL ) cdda_set_cdrom(0, akiko.cdrom);
+ if ( akiko.cdrom != NULL ) cdda_set_cdrom(devtag_get_device(space->machine, SOUND, "cdda"), akiko.cdrom);
return 0x0000cafe;
case 0x04/4: /* CDROM STATUS 1 */
diff --git a/src/mame/machine/dc.c b/src/mame/machine/dc.c
index ac041f1deb1..be34a849b10 100644
--- a/src/mame/machine/dc.c
+++ b/src/mame/machine/dc.c
@@ -918,25 +918,25 @@ MACHINE_RESET( dc )
maple0x86data1[19]=0x8a;
}
-READ64_HANDLER( dc_aica_reg_r )
+READ64_DEVICE_HANDLER( dc_aica_reg_r )
{
int reg;
UINT64 shift;
- reg = decode_reg32_64(space->machine, offset, mem_mask, &shift);
+ reg = decode_reg32_64(device->machine, offset, mem_mask, &shift);
// mame_printf_verbose("AICA REG: [%08x] read %llx, mask %llx\n", 0x700000+reg*4, (UINT64)offset, mem_mask);
- return (UINT64) aica_0_r(space, offset*2, 0xffff)<<shift;
+ return (UINT64) aica_r(device, offset*2, 0xffff)<<shift;
}
-WRITE64_HANDLER( dc_aica_reg_w )
+WRITE64_DEVICE_HANDLER( dc_aica_reg_w )
{
int reg;
UINT64 shift;
UINT32 dat;
- reg = decode_reg32_64(space->machine, offset, mem_mask, &shift);
+ reg = decode_reg32_64(device->machine, offset, mem_mask, &shift);
dat = (UINT32)(data >> shift);
if (reg == (0x2c00/4))
@@ -944,27 +944,27 @@ WRITE64_HANDLER( dc_aica_reg_w )
if (dat & 1)
{
/* halt the ARM7 */
- cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, ASSERT_LINE);
+ cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_RESET, ASSERT_LINE);
}
else
{
/* it's alive ! */
- cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, CLEAR_LINE);
+ cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_RESET, CLEAR_LINE);
}
}
- aica_0_w(space, offset*2, dat, shift ? ((mem_mask>>32)&0xffff) : (mem_mask & 0xffff));
+ aica_w(device, offset*2, dat, shift ? ((mem_mask>>32)&0xffff) : (mem_mask & 0xffff));
// mame_printf_verbose("AICA REG: [%08x=%x] write %llx to %x, mask %llx\n", 0x700000+reg*4, dat, data, offset, mem_mask);
}
-READ32_HANDLER( dc_arm_aica_r )
+READ32_DEVICE_HANDLER( dc_arm_aica_r )
{
- return aica_0_r(space, offset*2, 0xffff) & 0xffff;
+ return aica_r(device, offset*2, 0xffff) & 0xffff;
}
-WRITE32_HANDLER( dc_arm_aica_w )
+WRITE32_DEVICE_HANDLER( dc_arm_aica_w )
{
- aica_0_w(space, offset*2, data, mem_mask&0xffff);
+ aica_w(device, offset*2, data, mem_mask&0xffff);
}
diff --git a/src/mame/machine/gaplus.c b/src/mame/machine/gaplus.c
index e080483a66a..c7871339458 100644
--- a/src/mame/machine/gaplus.c
+++ b/src/mame/machine/gaplus.c
@@ -22,8 +22,9 @@ UINT8 *gaplus_customio_3;
WRITE8_HANDLER( gaplus_customio_3_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
if ((offset == 0x09) && (data >= 0x0f))
- sample_start(0,0,0);
+ sample_start(samples,0,0,0);
gaplus_customio_3[offset] = data;
}
diff --git a/src/mame/machine/leland.c b/src/mame/machine/leland.c
index 34a8b0057a6..5e6acf43f63 100644
--- a/src/mame/machine/leland.c
+++ b/src/mame/machine/leland.c
@@ -374,12 +374,11 @@ MACHINE_START( leland )
MACHINE_RESET( leland )
{
- const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
timer_adjust_oneshot(master_int_timer, video_screen_get_time_until_pos(machine->primary_screen, 8, 0), 8);
/* reset globals */
leland_gfx_control = 0x00;
- leland_sound_port_w(space, 0, 0xff);
+ leland_sound_port_w(devtag_get_device(machine, SOUND, "ay8910.1"), 0, 0xff);
wcol_enable = 0;
dangerz_x = 512;
@@ -1170,7 +1169,7 @@ READ8_HANDLER( leland_master_input_r )
case 0x03: /* /IGID */
case 0x13:
- result = ay8910_read_port_0_r(space, offset);
+ result = ay8910_r(devtag_get_device(space->machine, SOUND, "ay8910.1"), offset);
break;
case 0x10: /* /GIN0 */
@@ -1209,11 +1208,8 @@ WRITE8_HANDLER( leland_master_output_w )
break;
case 0x0a: /* /OGIA */
- ay8910_control_port_0_w(space, 0, data);
- break;
-
case 0x0b: /* /OGID */
- ay8910_write_port_0_w(space, 0, data);
+ ay8910_address_data_w(devtag_get_device(space->machine, SOUND, "ay8910.1"), offset, data);
break;
case 0x0c: /* /BKXL */
@@ -1371,16 +1367,16 @@ READ8_HANDLER( ataxx_paletteram_and_misc_r )
*
*************************************/
-READ8_HANDLER( leland_sound_port_r )
+READ8_DEVICE_HANDLER( leland_sound_port_r )
{
return leland_gfx_control;
}
-WRITE8_HANDLER( leland_sound_port_w )
+WRITE8_DEVICE_HANDLER( leland_sound_port_w )
{
/* update the graphics banking */
- leland_gfx_port_w(space, 0, data);
+ leland_gfx_port_w(device, 0, data);
/* set the new value */
leland_gfx_control = data;
@@ -1389,9 +1385,9 @@ WRITE8_HANDLER( leland_sound_port_w )
/* some bankswitching occurs here */
if (LOG_BANKSWITCHING_M)
if ((sound_port_bank ^ data) & 0x24)
- logerror("%04X:sound_port_bank = %02X\n", cpu_get_pc(space->cpu), data & 0x24);
+ logerror("%s:sound_port_bank = %02X\n", cpuexec_describe_context(device->machine), data & 0x24);
sound_port_bank = data & 0x24;
- (*leland_update_master_bank)(space->machine);
+ (*leland_update_master_bank)(device->machine);
}
diff --git a/src/mame/machine/mhavoc.c b/src/mame/machine/mhavoc.c
index d113ff831c8..f40f8ccef39 100644
--- a/src/mame/machine/mhavoc.c
+++ b/src/mame/machine/mhavoc.c
@@ -220,7 +220,7 @@ WRITE8_HANDLER( mhavoc_rom_banksel_w )
CUSTOM_INPUT( tms5220_r )
{
- return tms5220_ready_r() ? 0 : 1;
+ return tms5220_ready_r(devtag_get_device(field->port->machine, SOUND, "tms")) ? 0 : 1;
}
CUSTOM_INPUT( mhavoc_bit67_r )
diff --git a/src/mame/machine/n64.c b/src/mame/machine/n64.c
index 89b9701a91b..586fa69e65c 100644
--- a/src/mame/machine/n64.c
+++ b/src/mame/machine/n64.c
@@ -2,7 +2,6 @@
#include "driver.h"
#include "cpu/mips/mips3.h"
-#include "sound/custom.h"
#include "streams.h"
#include "includes/n64.h"
#include "sound/dmadac.h"
@@ -18,6 +17,8 @@ static UINT32 mi_version;
static UINT32 mi_interrupt = 0;
static UINT32 mi_intr_mask = 0;
+static const device_config *dmadac[2];
+
void signal_rcp_interrupt(running_machine *machine, int interrupt)
{
if (mi_intr_mask & interrupt)
@@ -712,7 +713,7 @@ static emu_timer *audio_timer;
#define AUDIO_DMA_DEPTH 2
-static void start_audio_dma(void);
+static void start_audio_dma(running_machine *machine);
typedef struct
{
@@ -756,7 +757,7 @@ static void audio_fifo_push(running_machine *machine, UINT32 address, UINT32 len
if (! (ai_status & 0x40000000))
{
signal_rcp_interrupt(machine, AI_INTERRUPT);
- start_audio_dma();
+ start_audio_dma(machine);
}
}
@@ -794,7 +795,7 @@ static AUDIO_DMA *audio_fifo_get_top(void)
}
}
-static void start_audio_dma(void)
+static void start_audio_dma(running_machine *machine)
{
INT16 *ram = (INT16*)rdram;
AUDIO_DMA *current = audio_fifo_get_top();
@@ -811,7 +812,9 @@ static void start_audio_dma(void)
// mame_printf_debug("DACDMA: %x for %x bytes\n", current->address, current->length);
- dmadac_transfer(0, 2, 2, 2, current->length/4, ram);
+ dmadac[0] = devtag_get_device(machine, SOUND, "dac1");
+ dmadac[1] = devtag_get_device(machine, SOUND, "dac2");
+ dmadac_transfer(&dmadac[0], 2, 2, 2, current->length/4, ram);
ai_status |= 0x40000000;
@@ -827,7 +830,7 @@ static TIMER_CALLBACK( audio_timer_callback )
// keep playing if there's another DMA queued
if (audio_fifo_get_top() != NULL)
{
- start_audio_dma();
+ start_audio_dma(machine);
signal_rcp_interrupt(machine, AI_INTERRUPT);
}
else
@@ -894,9 +897,9 @@ WRITE32_HANDLER( n64_ai_reg_w )
case 0x10/4: // AI_DACRATE_REG
ai_dacrate = data & 0x3fff;
- dmadac_set_frequency(0, 2, (double)DACRATE_NTSC / (double)(ai_dacrate+1));
+ dmadac_set_frequency(&dmadac[0], 2, (double)DACRATE_NTSC / (double)(ai_dacrate+1));
printf( "frequency: %f\n", (double)DACRATE_NTSC / (double)(ai_dacrate+1) );
- dmadac_enable(0, 2, 1);
+ dmadac_enable(&dmadac[0], 2, 1);
break;
case 0x14/4: // AI_BITRATE_REG
diff --git a/src/mame/machine/namcoio.c b/src/mame/machine/namcoio.c
index 67107cf09c2..c3be67294a8 100644
--- a/src/mame/machine/namcoio.c
+++ b/src/mame/machine/namcoio.c
@@ -931,7 +931,7 @@ static void namco_06xx_data_write(running_machine *machine,int chipnum,UINT8 dat
case NAMCOIO_50XX: namco_50xx_write(machine, data); break;
case NAMCOIO_50XX_2: namco_50xx_2_write(machine, data); break;
case NAMCOIO_51XX: namcoio_51XX_write(machine,chipnum,data); break;
- case NAMCOIO_52XX: namcoio_52xx_write(data); break;
+ case NAMCOIO_52XX: namcoio_52xx_write(devtag_get_device(machine, SOUND, "namco52"), data); break;
case NAMCOIO_54XX: namco_54xx_write(machine, data); break;
default:
logerror("%s: custom IO type %d unsupported write\n",cpuexec_describe_context(machine),io[chipnum].type);
diff --git a/src/mame/machine/namcos1.c b/src/mame/machine/namcos1.c
index a9173636df5..50ceeec061d 100644
--- a/src/mame/machine/namcos1.c
+++ b/src/mame/machine/namcos1.c
@@ -627,7 +627,7 @@ static READ8_HANDLER( soundram_r )
offset &= 0x3ff;
/* CUS 30 */
- return namcos1_cus30_r(space,offset);
+ return namcos1_cus30_r(devtag_get_device(space->machine, SOUND, "namco"),offset);
}
else
{
@@ -645,7 +645,7 @@ static WRITE8_HANDLER( soundram_w )
offset &= 0x3ff;
/* CUS 30 */
- namcos1_cus30_w(space,offset,data);
+ namcos1_cus30_w(devtag_get_device(space->machine, SOUND, "namco"),offset,data);
}
else
{
diff --git a/src/mame/machine/nitedrvr.c b/src/mame/machine/nitedrvr.c
index cd9e9ad6cd5..96eabc4e015 100644
--- a/src/mame/machine/nitedrvr.c
+++ b/src/mame/machine/nitedrvr.c
@@ -211,9 +211,10 @@ D5 = SKID2
***************************************************************************/
WRITE8_HANDLER( nitedrvr_out0_w )
{
- discrete_sound_w(space, NITEDRVR_MOTOR_DATA, data & 0x0f); // Motor freq data
- discrete_sound_w(space, NITEDRVR_SKID1_EN, data & 0x10); // Skid1 enable
- discrete_sound_w(space, NITEDRVR_SKID2_EN, data & 0x20); // Skid2 enable
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+ discrete_sound_w(discrete, NITEDRVR_MOTOR_DATA, data & 0x0f); // Motor freq data
+ discrete_sound_w(discrete, NITEDRVR_SKID1_EN, data & 0x10); // Skid1 enable
+ discrete_sound_w(discrete, NITEDRVR_SKID2_EN, data & 0x20); // Skid2 enable
}
/***************************************************************************
@@ -228,11 +229,13 @@ D5 = Spare (Not used)
***************************************************************************/
WRITE8_HANDLER( nitedrvr_out1_w )
{
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
+
set_led_status(0,data & 0x10);
nitedrvr_crash_en = data & 0x01;
- discrete_sound_w(space, NITEDRVR_CRASH_EN, nitedrvr_crash_en); // Crash enable
- discrete_sound_w(space, NITEDRVR_ATTRACT_EN, data & 0x02); // Attract enable (sound disable)
+ discrete_sound_w(discrete, NITEDRVR_CRASH_EN, nitedrvr_crash_en); // Crash enable
+ discrete_sound_w(discrete, NITEDRVR_ATTRACT_EN, data & 0x02); // Attract enable (sound disable)
if (!nitedrvr_crash_en)
{
@@ -243,7 +246,7 @@ WRITE8_HANDLER( nitedrvr_out1_w )
palette_set_color(space->machine,1,MAKE_RGB(0x00,0x00,0x00)); /* BLACK */
palette_set_color(space->machine,0,MAKE_RGB(0xff,0xff,0xff)); /* WHITE */
}
- discrete_sound_w(space, NITEDRVR_BANG_DATA, nitedrvr_crash_data_en ? nitedrvr_crash_data : 0); // Crash Volume
+ discrete_sound_w(discrete, NITEDRVR_BANG_DATA, nitedrvr_crash_data_en ? nitedrvr_crash_data : 0); // Crash Volume
}
@@ -251,10 +254,10 @@ static TIMER_CALLBACK( nitedrvr_crash_toggle_callback )
{
if (nitedrvr_crash_en && nitedrvr_crash_data_en)
{
- const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const device_config *discrete = devtag_get_device(machine, SOUND, "discrete");
nitedrvr_crash_data--;
- discrete_sound_w(space, NITEDRVR_BANG_DATA, nitedrvr_crash_data); // Crash Volume
+ discrete_sound_w(discrete, NITEDRVR_BANG_DATA, nitedrvr_crash_data); // Crash Volume
if (!nitedrvr_crash_data) nitedrvr_crash_data_en = 0; // Done counting?
if (nitedrvr_crash_data & 0x01)
{
diff --git a/src/mame/machine/nmk004.c b/src/mame/machine/nmk004.c
index 546198329eb..6c47dba9294 100644
--- a/src/mame/machine/nmk004.c
+++ b/src/mame/machine/nmk004.c
@@ -95,6 +95,11 @@ static struct
UINT8 to_main; // answer to main CPU
int protection_check;
+ running_machine *machine;
+ const device_config *ymdevice;
+ const device_config *oki1device;
+ const device_config *oki2device;
+
/* C001 */ UINT8 last_command; // last command received
/* C016 */ UINT8 oki_playing; // bitmap of active Oki channels
/* C020-C19F */ struct fm_control fm_control[FM_CHANNELS];
@@ -133,20 +138,18 @@ static UINT16 read16(int address)
*****************************/
-static void oki_play_sample(const address_space *space, int sample_no)
+static void oki_play_sample(int sample_no)
{
UINT16 table_start = (sample_no & 0x80) ? read16(SAMPLE_TABLE_1) : read16(SAMPLE_TABLE_0);
UINT8 byte1 = read8(table_start + 2 * (sample_no & 0x7f) + 0);
UINT8 byte2 = read8(table_start + 2 * (sample_no & 0x7f) + 1);
int chip = (byte1 & 0x80) >> 7;
+ const device_config *okidevice = (chip) ? NMK004_state.oki2device : NMK004_state.oki1device;
if ((byte1 & 0x7f) == 0)
{
// stop all channels
- if (chip == 0)
- okim6295_data_0_w(space, 0, 0x78 );
- else
- okim6295_data_1_w(space, 0, 0x78 );
+ okim6295_w(okidevice, 0, 0x78 );
}
else
{
@@ -160,37 +163,26 @@ static void oki_play_sample(const address_space *space, int sample_no)
NMK004_state.oki_playing |= 1 << (ch + 4*chip);
// stop channel
- if (chip == 0)
- okim6295_data_0_w(space, 0, (0x08 << ch) );
- else
- okim6295_data_1_w(space, 0, (0x08 << ch) );
+ okim6295_w(okidevice, 0, (0x08 << ch) );
if (sample != 0)
{
- UINT8 *rom = memory_region(space->machine, (chip == 0) ? "oki1" : "oki2");
+ UINT8 *rom = memory_region(NMK004_state.machine, (chip == 0) ? "oki1" : "oki2");
int bank = (byte2 & 0x0c) >> 2;
int vol = (byte2 & 0x70) >> 4;
if (bank != 3)
memcpy(rom + 0x20000,rom + 0x40000 + bank * 0x20000,0x20000);
- if (chip == 0)
- {
- okim6295_data_0_w(space, 0, 0x80 | sample );
- okim6295_data_0_w(space, 0, (0x10 << ch) | vol );
- }
- else
- {
- okim6295_data_1_w(space, 0, 0x80 | sample );
- okim6295_data_1_w(space, 0, (0x10 << ch) | vol );
- }
+ okim6295_w(okidevice, 0, 0x80 | sample );
+ okim6295_w(okidevice, 0, (0x10 << ch) | vol );
}
}
}
-static void oki_update_state(const address_space *space)
+static void oki_update_state(void)
{
- NMK004_state.oki_playing = ((okim6295_status_1_r(space, 0) & 0x0f) << 4) | (okim6295_status_0_r(space, 0) & 0x0f);
+ NMK004_state.oki_playing = ((okim6295_r(NMK004_state.oki2device, 0) & 0x0f) << 4) | (okim6295_r(NMK004_state.oki1device, 0) & 0x0f);
}
@@ -201,7 +193,7 @@ static void oki_update_state(const address_space *space)
*****************************/
-static void effects_update(const address_space *space, int channel)
+static void effects_update(int channel)
{
struct effects_control *effects = &NMK004_state.effects_control[channel];
@@ -233,7 +225,7 @@ static void effects_update(const address_space *space, int channel)
switch (token)
{
case 0xef: // play sample
- oki_play_sample(space, read8(effects->current++));
+ oki_play_sample(read8(effects->current++));
break;
case 0xf6: // jump
@@ -308,7 +300,7 @@ static void effects_update(const address_space *space, int channel)
*****************************/
-static void fm_update(const address_space *space, int channel)
+static void fm_update(int channel)
{
struct fm_control *fm = &NMK004_state.fm_control[channel];
@@ -348,7 +340,7 @@ static void fm_update(const address_space *space, int channel)
switch (token)
{
// case 0xef: // play sample
-// oki_play_sample(machine, read8(fm->current++));
+// oki_play_sample(read8(fm->current++));
// break;
case 0xf0: // slot (for keyon ym2203 command)
@@ -356,8 +348,8 @@ static void fm_update(const address_space *space, int channel)
fm->slot = read8(fm->current++);
if (channel < 3 || !(NMK004_state.fm_control[channel-3].flags & FM_FLAG_ACTIVE))
{
- ym2203_control_port_0_w(space, 0, 0x28); // keyon/off
- ym2203_write_port_0_w(space, 0, channel % 3);
+ ym2203_control_port_w(NMK004_state.ymdevice, 0, 0x28); // keyon/off
+ ym2203_write_port_w(NMK004_state.ymdevice, 0, channel % 3);
}
break;
@@ -585,7 +577,7 @@ popmessage("%02x %02x%02x%02x%02x %02x %02x%02x%02x%02x %02x %02x%02x%02x%02x",
}
-static void fm_voices_update(const address_space *space )
+static void fm_voices_update(void)
{
static const int ym2203_registers[0x18] =
{
@@ -605,8 +597,8 @@ static void fm_voices_update(const address_space *space )
for (i = 0; i < 0x18; i++)
{
- ym2203_control_port_0_w(space, 0, ym2203_registers[i] + channel);
- ym2203_write_port_0_w(space, 0, fm1->voice_params[i]);
+ ym2203_control_port_w(NMK004_state.ymdevice, 0, ym2203_registers[i] + channel);
+ ym2203_write_port_w(NMK004_state.ymdevice, 0, fm1->voice_params[i]);
}
}
@@ -618,8 +610,8 @@ static void fm_voices_update(const address_space *space )
{
for (i = 0; i < 0x18; i++)
{
- ym2203_control_port_0_w(space, 0, ym2203_registers[i] + channel);
- ym2203_write_port_0_w(space, 0, fm2->voice_params[i]);
+ ym2203_control_port_w(NMK004_state.ymdevice, 0, ym2203_registers[i] + channel);
+ ym2203_write_port_w(NMK004_state.ymdevice, 0, fm2->voice_params[i]);
}
}
}
@@ -627,25 +619,25 @@ static void fm_voices_update(const address_space *space )
if (fm1->flags & FM_FLAG_ACTIVE)
{
- ym2203_control_port_0_w(space, 0, 0xb0 + channel); // self-feedback
- ym2203_write_port_0_w(space, 0, fm1->self_feedback);
+ ym2203_control_port_w(NMK004_state.ymdevice, 0, 0xb0 + channel); // self-feedback
+ ym2203_write_port_w(NMK004_state.ymdevice, 0, fm1->self_feedback);
- ym2203_control_port_0_w(space, 0, 0xa4 + channel); // F-number
- ym2203_write_port_0_w(space, 0, fm1->f_number >> 8);
+ ym2203_control_port_w(NMK004_state.ymdevice, 0, 0xa4 + channel); // F-number
+ ym2203_write_port_w(NMK004_state.ymdevice, 0, fm1->f_number >> 8);
- ym2203_control_port_0_w(space, 0, 0xa0 + channel); // F-number
- ym2203_write_port_0_w(space, 0, fm1->f_number & 0xff);
+ ym2203_control_port_w(NMK004_state.ymdevice, 0, 0xa0 + channel); // F-number
+ ym2203_write_port_w(NMK004_state.ymdevice, 0, fm1->f_number & 0xff);
}
else
{
- ym2203_control_port_0_w(space, 0, 0xb0 + channel); // self-feedback
- ym2203_write_port_0_w(space, 0, fm2->self_feedback);
+ ym2203_control_port_w(NMK004_state.ymdevice, 0, 0xb0 + channel); // self-feedback
+ ym2203_write_port_w(NMK004_state.ymdevice, 0, fm2->self_feedback);
- ym2203_control_port_0_w(space, 0, 0xa4 + channel); // F-number
- ym2203_write_port_0_w(space, 0, fm2->f_number >> 8);
+ ym2203_control_port_w(NMK004_state.ymdevice, 0, 0xa4 + channel); // F-number
+ ym2203_write_port_w(NMK004_state.ymdevice, 0, fm2->f_number >> 8);
- ym2203_control_port_0_w(space, 0, 0xa0 + channel); // F-number
- ym2203_write_port_0_w(space, 0, fm2->f_number & 0xff);
+ ym2203_control_port_w(NMK004_state.ymdevice, 0, 0xa0 + channel); // F-number
+ ym2203_write_port_w(NMK004_state.ymdevice, 0, fm2->f_number & 0xff);
}
@@ -654,8 +646,8 @@ static void fm_voices_update(const address_space *space )
{
fm1->flags &= ~FM_FLAG_MUST_SEND_KEYON;
- ym2203_control_port_0_w(space, 0, 0x28); // keyon/off
- ym2203_write_port_0_w(space, 0, fm1->slot | channel);
+ ym2203_control_port_w(NMK004_state.ymdevice, 0, 0x28); // keyon/off
+ ym2203_write_port_w(NMK004_state.ymdevice, 0, fm1->slot | channel);
}
if (fm2->flags & FM_FLAG_MUST_SEND_KEYON)
@@ -664,8 +656,8 @@ static void fm_voices_update(const address_space *space )
if (!(fm1->flags & FM_FLAG_ACTIVE))
{
- ym2203_control_port_0_w(space, 0, 0x28); // keyon/off
- ym2203_write_port_0_w(space, 0, fm2->slot | channel);
+ ym2203_control_port_w(NMK004_state.ymdevice, 0, 0x28); // keyon/off
+ ym2203_write_port_w(NMK004_state.ymdevice, 0, fm2->slot | channel);
}
}
}
@@ -679,7 +671,7 @@ static void fm_voices_update(const address_space *space )
*****************************/
-static void psg_update(const address_space *space, int channel)
+static void psg_update(int channel)
{
struct psg_control *psg = &NMK004_state.psg_control[channel];
@@ -703,11 +695,11 @@ static void psg_update(const address_space *space, int channel)
psg->flags &= ~PSG_FLAG_NOISE_NOT_ENABLED;
// enable noise, disable tone on this channel
- ym2203_control_port_0_w(space, 0, 0x07);
- enable = ym2203_read_port_0_r(space, 0);
+ ym2203_control_port_w(NMK004_state.ymdevice, 0, 0x07);
+ enable = ym2203_read_port_r(NMK004_state.ymdevice, 0);
enable |= (0x01 << channel); // disable tone
enable &= ~(0x08 << channel); // enable noise
- ym2203_write_port_0_w(space, 0, enable);
+ ym2203_write_port_w(NMK004_state.ymdevice, 0, enable);
}
@@ -741,11 +733,11 @@ static void psg_update(const address_space *space, int channel)
psg->flags &= ~PSG_FLAG_NOISE_NOT_ENABLED;
// enable noise, disable tone on this channel
- ym2203_control_port_0_w(space, 0, 0x07);
- enable = ym2203_read_port_0_r(space, 0);
+ ym2203_control_port_w(NMK004_state.ymdevice, 0, 0x07);
+ enable = ym2203_read_port_r(NMK004_state.ymdevice, 0);
enable |= (0x01 << channel); // disable tone
enable &= ~(0x08 << channel); // enable noise
- ym2203_write_port_0_w(space, 0, enable);
+ ym2203_write_port_w(NMK004_state.ymdevice, 0, enable);
break;
case 0xf2: // set volume shape
@@ -790,8 +782,8 @@ static void psg_update(const address_space *space, int channel)
psg->volume_shape = 0;
// mute channel
- ym2203_control_port_0_w(space, 0, 8 + channel);
- ym2203_write_port_0_w(space, 0, 0);
+ ym2203_control_port_w(NMK004_state.ymdevice, 0, 8 + channel);
+ ym2203_write_port_w(NMK004_state.ymdevice, 0, 0);
return;
}
}
@@ -831,10 +823,10 @@ static void psg_update(const address_space *space, int channel)
period >>= octave;
- ym2203_control_port_0_w(space, 0, 2 * channel + 1);
- ym2203_write_port_0_w(space, 0, (period & 0x0f00) >> 8);
- ym2203_control_port_0_w(space, 0, 2 * channel + 0);
- ym2203_write_port_0_w(space, 0, (period & 0x00ff));
+ ym2203_control_port_w(NMK004_state.ymdevice, 0, 2 * channel + 1);
+ ym2203_write_port_w(NMK004_state.ymdevice, 0, (period & 0x0f00) >> 8);
+ ym2203_control_port_w(NMK004_state.ymdevice, 0, 2 * channel + 0);
+ ym2203_write_port_w(NMK004_state.ymdevice, 0, (period & 0x00ff));
psg->note_period_hi_bits = (period & 0x0f00) >> 8;
}
@@ -847,15 +839,15 @@ static void psg_update(const address_space *space, int channel)
psg->flags |= PSG_FLAG_NOISE_NOT_ENABLED;
// disable noise, enable tone on this channel
- ym2203_control_port_0_w(space, 0, 0x07);
- enable = ym2203_read_port_0_r(space, 0);
+ ym2203_control_port_w(NMK004_state.ymdevice, 0, 0x07);
+ enable = ym2203_read_port_r(NMK004_state.ymdevice, 0);
enable &= ~(0x01 << channel); // enable tone
enable |= (0x08 << channel); // disable noise
- ym2203_write_port_0_w(space, 0, enable);
+ ym2203_write_port_w(NMK004_state.ymdevice, 0, enable);
}
- ym2203_control_port_0_w(space, 0, 0x06); // noise period
- ym2203_write_port_0_w(space, 0, psg->note);
+ ym2203_control_port_w(NMK004_state.ymdevice, 0, 0x06); // noise period
+ ym2203_write_port_w(NMK004_state.ymdevice, 0, psg->note);
psg->note_period_hi_bits = psg->note;
}
}
@@ -880,8 +872,8 @@ static void psg_update(const address_space *space, int channel)
volume = 0;
// set volume
- ym2203_control_port_0_w(space, 0, 8 + channel);
- ym2203_write_port_0_w(space, 0, volume & 0x0f);
+ ym2203_control_port_w(NMK004_state.ymdevice, 0, 8 + channel);
+ ym2203_write_port_w(NMK004_state.ymdevice, 0, volume & 0x0f);
}
}
}
@@ -894,7 +886,7 @@ static void psg_update(const address_space *space, int channel)
*****************************/
-static void get_command(const address_space *space)
+static void get_command(void)
{
static const UINT8 from_main[] =
{
@@ -931,7 +923,7 @@ static void get_command(const address_space *space)
if ((cmd_table & 0xff00) == 0)
{
- oki_play_sample(space, cmd_table);
+ oki_play_sample(cmd_table);
}
else
{
@@ -979,39 +971,38 @@ static void get_command(const address_space *space)
-static void update_music(const address_space *space)
+static void update_music(void)
{
int channel;
for (channel = 0; channel < FM_CHANNELS; channel++)
- fm_update(space, channel);
- fm_voices_update(space);
+ fm_update(channel);
+ fm_voices_update();
for (channel = 0; channel < PSG_CHANNELS; channel++)
- psg_update(space, channel);
+ psg_update(channel);
for (channel = 0; channel < EFFECTS_CHANNELS; channel++)
- effects_update(space, channel);
+ effects_update(channel);
}
-void NMK004_irq(running_machine *machine, int irq)
+void NMK004_irq(const device_config *device, int irq)
{
if (irq)
{
- const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
- int status = ym2203_status_port_0_r(space,0);
+ int status = ym2203_status_port_r(device,0);
if (status & 1) // timer A expired
{
- oki_update_state(space);
- get_command(space);
- update_music(space);
+ oki_update_state();
+ get_command();
+ update_music();
// restart timer
- ym2203_control_port_0_w(space, 0, 0x27);
- ym2203_write_port_0_w(space, 0, 0x15);
+ ym2203_control_port_w(device, 0, 0x27);
+ ym2203_write_port_w(device, 0, 0x15);
}
}
}
@@ -1019,7 +1010,6 @@ void NMK004_irq(running_machine *machine, int irq)
static TIMER_CALLBACK( real_nmk004_init )
{
- const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
static const UINT8 ym2203_init[] =
{
0x07,0x38,0x08,0x00,0x09,0x00,0x0A,0x00,0x24,0xB3,0x25,0x00,0x26,0xF9,0x27,0x15,
@@ -1032,18 +1022,18 @@ static TIMER_CALLBACK( real_nmk004_init )
NMK004_state.rom = memory_region(machine, "audio");
- ym2203_control_port_0_w(space, 0, 0x2f);
+ ym2203_control_port_w(NMK004_state.ymdevice, 0, 0x2f);
i = 0;
while (ym2203_init[i] != 0xff)
{
- ym2203_control_port_0_w(space, 0, ym2203_init[i++]);
- ym2203_write_port_0_w(space, 0, ym2203_init[i++]);
+ ym2203_control_port_w(NMK004_state.ymdevice, 0, ym2203_init[i++]);
+ ym2203_write_port_w(NMK004_state.ymdevice, 0, ym2203_init[i++]);
}
NMK004_state.oki_playing = 0;
- oki_play_sample(space, 0);
+ oki_play_sample(0);
NMK004_state.protection_check = 0;
}
@@ -1052,6 +1042,11 @@ void NMK004_init(running_machine *machine)
{
/* we have to do this via a timer because we get called before the sound reset */
timer_call_after_resynch(machine, NULL, 0, real_nmk004_init);
+
+ NMK004_state.machine = machine;
+ NMK004_state.ymdevice = devtag_get_device(machine, SOUND, "ym");
+ NMK004_state.oki1device = devtag_get_device(machine, SOUND, "oki1");
+ NMK004_state.oki2device = devtag_get_device(machine, SOUND, "oki2");
}
@@ -1059,18 +1054,18 @@ WRITE16_HANDLER( NMK004_w )
{
if (ACCESSING_BITS_0_7)
{
-logerror("%06x: NMK004_w %02x\n",cpu_get_pc(space->cpu),data);
+//logerror("%06x: NMK004_w %02x\n",cpu_get_pc(space->cpu),data);
NMK004_state.from_main = data & 0xff;
}
}
READ16_HANDLER( NMK004_r )
{
-static int last;
+//static int last;
int res = NMK004_state.to_main;
-if (res != last) logerror("%06x: NMK004_r %02x\n",cpu_get_pc(space->cpu),res);
-last = res;
+//if (res != last) logerror("%06x: NMK004_r %02x\n",cpu_get_pc(space->cpu),res);
+//last = res;
return res;
}
diff --git a/src/mame/machine/nmk004.h b/src/mame/machine/nmk004.h
index cc1b5b23777..0c776be76d1 100644
--- a/src/mame/machine/nmk004.h
+++ b/src/mame/machine/nmk004.h
@@ -1,4 +1,4 @@
void NMK004_init(running_machine *machine);
-void NMK004_irq(running_machine *machine, int irq);
+void NMK004_irq(const device_config *device, int irq);
READ16_HANDLER( NMK004_r );
WRITE16_HANDLER( NMK004_w );
diff --git a/src/mame/machine/qix.c b/src/mame/machine/qix.c
index 364fd4f17da..23adecf251a 100644
--- a/src/mame/machine/qix.c
+++ b/src/mame/machine/qix.c
@@ -571,7 +571,7 @@ static WRITE8_HANDLER( slither_coinctl_w )
static WRITE8_HANDLER( slither_76489_0_w )
{
/* write to the sound chip */
- sn76496_0_w(space, 0, data);
+ sn76496_w(devtag_get_device(space->machine, SOUND, "sn1"), 0, data);
/* clock the ready line going back into CB1 */
pia_1_cb1_w(space, 0, 0);
@@ -582,7 +582,7 @@ static WRITE8_HANDLER( slither_76489_0_w )
static WRITE8_HANDLER( slither_76489_1_w )
{
/* write to the sound chip */
- sn76496_1_w(space, 0, data);
+ sn76496_w(devtag_get_device(space->machine, SOUND, "sn2"), 0, data);
/* clock the ready line going back into CB1 */
pia_2_cb1_w(space, 0, 0);
diff --git a/src/mame/machine/simpsons.c b/src/mame/machine/simpsons.c
index d40ce36a1a4..60fabe1652b 100644
--- a/src/mame/machine/simpsons.c
+++ b/src/mame/machine/simpsons.c
@@ -102,9 +102,9 @@ READ8_HANDLER( simpsons_sound_interrupt_r )
return 0x00;
}
-READ8_HANDLER( simpsons_sound_r )
+READ8_DEVICE_HANDLER( simpsons_sound_r )
{
- return k053260_0_r(space, 2 + offset);
+ return k053260_r(device, 2 + offset);
}
diff --git a/src/mame/machine/stfight.c b/src/mame/machine/stfight.c
index cc8fa45c7e1..f5aa74cfef4 100644
--- a/src/mame/machine/stfight.c
+++ b/src/mame/machine/stfight.c
@@ -205,22 +205,22 @@ void stfight_adpcm_int(const device_config *device)
// finished playing sample?
if( adpcm_data_offs == adpcm_data_end )
{
- msm5205_reset_w( 0, 1 );
+ msm5205_reset_w( device, 1 );
return;
}
if( toggle == 0 )
- msm5205_data_w( 0, ( adpcm_data >> 4 ) & 0x0f );
+ msm5205_data_w( device, ( adpcm_data >> 4 ) & 0x0f );
else
{
- msm5205_data_w( 0, adpcm_data & 0x0f );
+ msm5205_data_w( device, adpcm_data & 0x0f );
adpcm_data_offs++;
}
toggle ^= 1;
}
-WRITE8_HANDLER( stfight_adpcm_control_w )
+WRITE8_DEVICE_HANDLER( stfight_adpcm_control_w )
{
if( data < 0x08 )
{
@@ -228,7 +228,7 @@ WRITE8_HANDLER( stfight_adpcm_control_w )
adpcm_data_end = sampleLimits[data+1];
}
- msm5205_reset_w( 0, data & 0x08 ? 1 : 0 );
+ msm5205_reset_w( device, data & 0x08 ? 1 : 0 );
}
WRITE8_HANDLER( stfight_e800_w )
diff --git a/src/mame/machine/tatsumi.c b/src/mame/machine/tatsumi.c
index 7f1b97415bf..dc90cffff74 100644
--- a/src/mame/machine/tatsumi.c
+++ b/src/mame/machine/tatsumi.c
@@ -340,9 +340,10 @@ WRITE16_HANDLER( tatsumi_v30_68000_w )
// Todo: Current YM2151 doesn't seem to raise the busy flag quickly enough for the
// self-test in Tatsumi games. Needs fixed, but hack it here for now.
-READ8_HANDLER(tatsumi_hack_ym2151_r)
+READ8_DEVICE_HANDLER(tatsumi_hack_ym2151_r)
{
- int r=ym2151_status_port_0_r(space,0);
+ const address_space *space = cputag_get_address_space(device->machine, "audio", ADDRESS_SPACE_PROGRAM);
+ int r=ym2151_status_port_r(device,0);
if (cpu_get_pc(space->cpu)==0x2aca || cpu_get_pc(space->cpu)==0x29fe
|| cpu_get_pc(space->cpu)==0xf9721
@@ -353,9 +354,10 @@ READ8_HANDLER(tatsumi_hack_ym2151_r)
// Todo: Tatsumi self-test fails if OKI doesn't respond (when sound off).
// Mame really should emulate the OKI status reads even with Mame sound off.
-READ8_HANDLER(tatsumi_hack_oki_r)
+READ8_DEVICE_HANDLER(tatsumi_hack_oki_r)
{
- int r=okim6295_status_0_r(space,0);
+ const address_space *space = cputag_get_address_space(device->machine, "audio", ADDRESS_SPACE_PROGRAM);
+ int r=okim6295_r(device,0);
if (cpu_get_pc(space->cpu)==0x2b70 || cpu_get_pc(space->cpu)==0x2bb5
|| cpu_get_pc(space->cpu)==0x2acc
diff --git a/src/mame/machine/toaplan1.c b/src/mame/machine/toaplan1.c
index 6b3698ce985..1536f8fced4 100644
--- a/src/mame/machine/toaplan1.c
+++ b/src/mame/machine/toaplan1.c
@@ -232,8 +232,7 @@ WRITE16_HANDLER( toaplan1_reset_sound )
if (ACCESSING_BITS_0_7 && (data == 0))
{
logerror("PC:%04x Resetting Sound CPU and Sound chip (%08x)\n",cpu_get_previouspc(space->cpu),data);
- if (space->machine->config->sound[0].type == SOUND_YM3812)
- sndti_reset(SOUND_YM3812, 0);
+ devtag_reset(space->machine, SOUND, "ym");
if (space->machine->cpu[1] != NULL && cpu_get_type(space->machine->cpu[1]) == CPU_Z80)
cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, PULSE_LINE);
}
diff --git a/src/mame/machine/williams.c b/src/mame/machine/williams.c
index d1b26a80f81..c4dc2437275 100644
--- a/src/mame/machine/williams.c
+++ b/src/mame/machine/williams.c
@@ -126,7 +126,7 @@ const pia6821_interface williams_pia_1_intf =
const pia6821_interface williams_snd_pia_intf =
{
/*inputs : A/B,CA/B1,CA/B2 */ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,
- /*outputs: A/B,CA/B2 */ DEVCB_MEMORY_HANDLER("main", PROGRAM, dac_0_data_w), DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,
+ /*outputs: A/B,CA/B2 */ DEVCB_DEVICE_HANDLER(SOUND, "wmsdac", dac_w), DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,
/*irqs : A/B */ DEVCB_LINE(williams_snd_irq), DEVCB_LINE(williams_snd_irq)
};
@@ -150,7 +150,7 @@ const pia6821_interface lottofun_pia_0_intf =
const pia6821_interface sinistar_snd_pia_intf =
{
/*inputs : A/B,CA/B1,CA/B2 */ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,
- /*outputs: A/B,CA/B2 */ DEVCB_MEMORY_HANDLER("main", PROGRAM, dac_0_data_w), DEVCB_NULL, DEVCB_MEMORY_HANDLER("main", PROGRAM, hc55516_0_digit_w), DEVCB_MEMORY_HANDLER("main", PROGRAM, hc55516_0_clock_w),
+ /*outputs: A/B,CA/B2 */ DEVCB_DEVICE_HANDLER(SOUND, "wmsdac", dac_w), DEVCB_NULL, DEVCB_DEVICE_LINE(SOUND, "cvsd", hc55516_digit_w), DEVCB_DEVICE_LINE(SOUND, "cvsd", hc55516_clock_w),
/*irqs : A/B */ DEVCB_LINE(williams_snd_irq), DEVCB_LINE(williams_snd_irq)
};
@@ -198,7 +198,7 @@ const pia6821_interface williams2_pia_1_intf =
const pia6821_interface williams2_snd_pia_intf =
{
/*inputs : A/B,CA/B1,CA/B2 */ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,
- /*outputs: A/B,CA/B2 */ DEVCB_DEVICE_HANDLER(PIA6821, "pia_1", pia_portb_w), DEVCB_MEMORY_HANDLER("main", PROGRAM, dac_0_data_w), DEVCB_DEVICE_HANDLER(PIA6821, "pia_1", pia_cb1_w), DEVCB_NULL,
+ /*outputs: A/B,CA/B2 */ DEVCB_DEVICE_HANDLER(PIA6821, "pia_1", pia_portb_w), DEVCB_DEVICE_HANDLER(SOUND, "wmsdac", dac_w), DEVCB_DEVICE_HANDLER(PIA6821, "pia_1", pia_cb1_w), DEVCB_NULL,
/*irqs : A/B */ DEVCB_LINE(williams_snd_irq), DEVCB_LINE(williams_snd_irq)
};
@@ -246,7 +246,7 @@ const pia6821_interface tshoot_pia_1_intf =
const pia6821_interface tshoot_snd_pia_intf =
{
/*inputs : A/B,CA/B1,CA/B2 */ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,
- /*outputs: A/B,CA/B2 */ DEVCB_DEVICE_HANDLER(PIA6821, "pia_1", pia_portb_w), DEVCB_MEMORY_HANDLER("main", PROGRAM, dac_0_data_w), DEVCB_DEVICE_HANDLER(PIA6821, "pia_1", pia_cb1_w), DEVCB_HANDLER(tshoot_maxvol_w),
+ /*outputs: A/B,CA/B2 */ DEVCB_DEVICE_HANDLER(PIA6821, "pia_1", pia_portb_w), DEVCB_DEVICE_HANDLER(SOUND, "wmsdac", dac_w), DEVCB_DEVICE_HANDLER(PIA6821, "pia_1", pia_cb1_w), DEVCB_HANDLER(tshoot_maxvol_w),
/*irqs : A/B */ DEVCB_LINE(williams_snd_irq), DEVCB_LINE(williams_snd_irq)
};
diff --git a/src/mame/machine/xevious.c b/src/mame/machine/xevious.c
index b0a6f5fb551..1746afda9c2 100644
--- a/src/mame/machine/xevious.c
+++ b/src/mame/machine/xevious.c
@@ -154,11 +154,12 @@ WRITE8_HANDLER( battles_noise_sound_w )
{
logerror("CPU3 %04x: 50%02x Write = %02x\n",cpu_get_pc(space->cpu),offset,data);
if( (battles_sound_played == 0) && (data == 0xFF) ){
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
if( customio[0] == 0x40 ){
- sample_start (0, 0, 0);
+ sample_start (samples, 0, 0, 0);
}
else{
- sample_start (0, 1, 0);
+ sample_start (samples, 0, 1, 0);
}
}
battles_sound_played = data;
diff --git a/src/mame/video/astrocde.c b/src/mame/video/astrocde.c
index 7985aad57ce..8c6f934f07c 100644
--- a/src/mame/video/astrocde.c
+++ b/src/mame/video/astrocde.c
@@ -646,7 +646,7 @@ WRITE8_HANDLER( astrocade_data_chip_register_w )
case 0x17: /* noise volume register */
case 0x18: /* sound block transfer */
if (astrocade_video_config & AC_SOUND_PRESENT)
- astrocade_sound1_w(space, offset, data);
+ astrocade_sound_w(devtag_get_device(space->machine, SOUND, "astrocade1"), offset, data);
break;
case 0x19: /* expand register */
diff --git a/src/mame/video/attckufo.c b/src/mame/video/attckufo.c
index 258628246e8..d97118b29e3 100644
--- a/src/mame/video/attckufo.c
+++ b/src/mame/video/attckufo.c
@@ -12,7 +12,6 @@
***************************************************************************/
#include "driver.h"
-#include "sound/custom.h"
#include "includes/attckufo.h"
#define MAX_LINES 261
diff --git a/src/mame/video/cheekyms.c b/src/mame/video/cheekyms.c
index 7070cf3097b..8660095913a 100644
--- a/src/mame/video/cheekyms.c
+++ b/src/mame/video/cheekyms.c
@@ -50,7 +50,7 @@ WRITE8_HANDLER( cheekyms_port_40_w )
{
/* the lower bits probably trigger sound samples */
- dac_data_w(0, data ? 0x80 : 0);
+ dac_data_w(devtag_get_device(space->machine, SOUND, "dac"), data ? 0x80 : 0);
}
diff --git a/src/mame/video/dday.c b/src/mame/video/dday.c
index 4c9ed45b683..1d2cd06914f 100644
--- a/src/mame/video/dday.c
+++ b/src/mame/video/dday.c
@@ -297,7 +297,7 @@ WRITE8_HANDLER( dday_control_w )
/* bit 4 is sound enable */
if (!(data & 0x10) && (control & 0x10))
- sndti_reset(SOUND_AY8910, 0);
+ devtag_reset(space->machine, SOUND, "ay");
sound_global_enable(data & 0x10);
diff --git a/src/mame/video/genesis.c b/src/mame/video/genesis.c
index 584f459b0a7..ee5c062a86e 100644
--- a/src/mame/video/genesis.c
+++ b/src/mame/video/genesis.c
@@ -361,6 +361,7 @@ READ16_HANDLER( genesis_vdp_r )
WRITE16_HANDLER( genesis_vdp_w )
{
+ const device_config *device;
switch (offset)
{
case 0x00: /* Write data */
@@ -393,8 +394,9 @@ WRITE16_HANDLER( genesis_vdp_w )
case 0x09:
case 0x0a:
case 0x0b:
- if (ACCESSING_BITS_0_7 && sndti_exists(SOUND_SN76496, 0))
- sn76496_0_w(space, 0, data & 0xff);
+ device = devtag_get_device(space->machine, SOUND, "sn");
+ if (device != NULL && ACCESSING_BITS_0_7)
+ sn76496_w(device, 0, data & 0xff);
break;
}
}
diff --git a/src/mame/video/hanaawas.c b/src/mame/video/hanaawas.c
index 915916835a0..9ecfa8d26b6 100644
--- a/src/mame/video/hanaawas.c
+++ b/src/mame/video/hanaawas.c
@@ -78,12 +78,12 @@ WRITE8_HANDLER( hanaawas_colorram_w )
tilemap_mark_tile_dirty(bg_tilemap, (offset + (flip_screen_get(space->machine) ? -1 : 1)) & 0x03ff);
}
-WRITE8_HANDLER( hanaawas_portB_w )
+WRITE8_DEVICE_HANDLER( hanaawas_portB_w )
{
/* bit 7 is flip screen */
- if (flip_screen_get(space->machine) != (~data & 0x80))
+ if (flip_screen_get(device->machine) != (~data & 0x80))
{
- flip_screen_set(space->machine, ~data & 0x80);
+ flip_screen_set(device->machine, ~data & 0x80);
tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
}
}
diff --git a/src/mame/video/homerun.c b/src/mame/video/homerun.c
index 44ff681d154..4da05fdc3af 100644
--- a/src/mame/video/homerun.c
+++ b/src/mame/video/homerun.c
@@ -9,9 +9,9 @@ UINT8 *homerun_videoram;
#define half_screen 116
-WRITE8_HANDLER(homerun_banking_w)
+WRITE8_DEVICE_HANDLER(homerun_banking_w)
{
- if(video_screen_get_vpos(space->machine->primary_screen)>half_screen)
+ if(video_screen_get_vpos(device->machine->primary_screen)>half_screen)
homerun_gc_down=data&3;
else
homerun_gc_up=data&3;
@@ -20,9 +20,9 @@ WRITE8_HANDLER(homerun_banking_w)
data>>=5;
if(!data)
- memory_set_bankptr(space->machine, 1, memory_region(space->machine, "main") );
+ memory_set_bankptr(device->machine, 1, memory_region(device->machine, "main") );
else
- memory_set_bankptr(space->machine, 1, memory_region(space->machine, "main") + 0x10000 + (((data-1)&0x7)*0x4000 ));
+ memory_set_bankptr(device->machine, 1, memory_region(device->machine, "main") + 0x10000 + (((data-1)&0x7)*0x4000 ));
}
WRITE8_HANDLER( homerun_videoram_w )
diff --git a/src/mame/video/leland.c b/src/mame/video/leland.c
index 3b06ef32f27..1d673166bc5 100644
--- a/src/mame/video/leland.c
+++ b/src/mame/video/leland.c
@@ -150,9 +150,9 @@ WRITE8_HANDLER( leland_scroll_w )
}
-WRITE8_HANDLER( leland_gfx_port_w )
+WRITE8_DEVICE_HANDLER( leland_gfx_port_w )
{
- video_screen_update_partial(space->machine->primary_screen, video_screen_get_vpos(space->machine->primary_screen));
+ video_screen_update_partial(device->machine->primary_screen, video_screen_get_vpos(device->machine->primary_screen));
gfxbank = data;
}
diff --git a/src/mame/video/mitchell.c b/src/mame/video/mitchell.c
index 3c24d6efc41..2993e8cf6cd 100644
--- a/src/mame/video/mitchell.c
+++ b/src/mame/video/mitchell.c
@@ -152,6 +152,7 @@ static int paletteram_bank;
WRITE8_HANDLER( pang_gfxctrl_w )
{
+ const device_config *oki = devtag_get_device(space->machine, SOUND, "oki");
logerror("PC %04x: pang_gfxctrl_w %02x\n",cpu_get_pc(space->cpu),data);
{
#if 0
@@ -176,7 +177,7 @@ logerror("PC %04x: pang_gfxctrl_w %02x\n",cpu_get_pc(space->cpu),data);
/* bit 3 is unknown (used, e.g. marukin pulses it on the title screen) */
/* bit 4 selects OKI M6295 bank */
- if (sndti_exists(SOUND_OKIM6295,0)) okim6295_set_bank_base(0, (data & 0x10) ? 0x40000 : 0x00000);
+ if (oki != NULL && sound_get_type(oki) == SOUND_OKIM6295) okim6295_set_bank_base(oki, (data & 0x10) ? 0x40000 : 0x00000);
/* bit 5 is palette RAM bank selector (doesn't apply to mgakuen) */
paletteram_bank = data & 0x20;
@@ -211,7 +212,7 @@ logerror("PC %04x: pang_gfxctrl_w %02x\n",cpu_get_pc(space->cpu),data);
/* bit 3 is unknown (used, e.g. marukin pulses it on the title screen) */
/* bit 4 selects OKI M6295 bank */
-// okim6295_set_bank_base(0, (data & 0x10) ? 0x40000 : 0x00000);
+// okim6295_set_bank_base(devtag_get_device(space->machine, SOUND, "oki"), (data & 0x10) ? 0x40000 : 0x00000);
/* not here.. it has its own z80 + sound banking */
/* bit 5 is palette RAM bank selector (doesn't apply to mgakuen) */
diff --git a/src/mame/video/phoenix.c b/src/mame/video/phoenix.c
index 0b07cc91479..fdbce853c17 100644
--- a/src/mame/video/phoenix.c
+++ b/src/mame/video/phoenix.c
@@ -430,7 +430,7 @@ READ8_HANDLER( survival_input_port_0_r )
return survival_input_latches[0];
}
-READ8_HANDLER( survival_protection_r )
+READ8_DEVICE_HANDLER( survival_protection_r )
{
return survival_protection_value;
}
diff --git a/src/mame/video/seta.c b/src/mame/video/seta.c
index 36e014ff6a2..0e2e3ce214e 100644
--- a/src/mame/video/seta.c
+++ b/src/mame/video/seta.c
@@ -279,9 +279,10 @@ WRITE16_HANDLER( seta_vregs_w )
---- ---- ---- ---0 Coin #0 Counter */
if (ACCESSING_BITS_0_7)
{
+ const device_config *x1_010 = devtag_get_device(space->machine, SOUND, "x1");
seta_coin_lockout_w (space->machine, data & 0x0f);
- if (sndti_exists(SOUND_X1_010, 0))
- seta_sound_enable_w (data & 0x20);
+ if (x1_010 != NULL)
+ seta_sound_enable_w (x1_010, data & 0x20);
coin_counter_w(0,data & 0x01);
coin_counter_w(1,data & 0x02);
}
diff --git a/src/mame/video/skydiver.c b/src/mame/video/skydiver.c
index b20cbee1d5b..cc2ea5dde23 100644
--- a/src/mame/video/skydiver.c
+++ b/src/mame/video/skydiver.c
@@ -130,6 +130,7 @@ WRITE8_HANDLER( skydiver_lamp_d_w )
WRITE8_HANDLER( skydiver_2000_201F_w )
{
+ const device_config *discrete = devtag_get_device(space->machine, SOUND, "discrete");
int bit = offset & 0x01;
watchdog_reset_w(space,0,0);
@@ -149,13 +150,13 @@ WRITE8_HANDLER( skydiver_2000_201F_w )
output_set_value("lampr", bit);
break;
case (0x0a):
- discrete_sound_w(space, SKYDIVER_OCT1_EN, bit);
+ discrete_sound_w(discrete, SKYDIVER_OCT1_EN, bit);
break;
case (0x0c):
- discrete_sound_w(space, SKYDIVER_OCT2_EN, bit);
+ discrete_sound_w(discrete, SKYDIVER_OCT2_EN, bit);
break;
case (0x0e):
- discrete_sound_w(space, SKYDIVER_NOISE_RST, bit);
+ discrete_sound_w(discrete, SKYDIVER_NOISE_RST, bit);
break;
}
}
diff --git a/src/mame/video/sprint4.c b/src/mame/video/sprint4.c
index 6fd03fdcbab..5bbef7e4bbf 100644
--- a/src/mame/video/sprint4.c
+++ b/src/mame/video/sprint4.c
@@ -95,7 +95,7 @@ VIDEO_EOF( sprint4 )
/* check for sprite-playfield collisions */
- const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const device_config *discrete = devtag_get_device(machine, SOUND, "discrete");
for (i = 0; i < 4; i++)
{
@@ -138,10 +138,10 @@ VIDEO_EOF( sprint4 )
/* update sound status */
- discrete_sound_w(space, SPRINT4_MOTOR_DATA_1, videoram[0x391] & 15);
- discrete_sound_w(space, SPRINT4_MOTOR_DATA_2, videoram[0x393] & 15);
- discrete_sound_w(space, SPRINT4_MOTOR_DATA_3, videoram[0x395] & 15);
- discrete_sound_w(space, SPRINT4_MOTOR_DATA_4, videoram[0x397] & 15);
+ discrete_sound_w(discrete, SPRINT4_MOTOR_DATA_1, videoram[0x391] & 15);
+ discrete_sound_w(discrete, SPRINT4_MOTOR_DATA_2, videoram[0x393] & 15);
+ discrete_sound_w(discrete, SPRINT4_MOTOR_DATA_3, videoram[0x395] & 15);
+ discrete_sound_w(discrete, SPRINT4_MOTOR_DATA_4, videoram[0x397] & 15);
}
diff --git a/src/mame/video/starcrus.c b/src/mame/video/starcrus.c
index 80ddb8bd3c6..71a3d429b19 100644
--- a/src/mame/video/starcrus.c
+++ b/src/mame/video/starcrus.c
@@ -64,6 +64,8 @@ VIDEO_START( starcrus )
WRITE8_HANDLER( starcrus_ship_parm_1_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
+
s1_sprite = data&0x1f;
engine1_on = ((data&0x20)>>5)^0x01;
@@ -72,7 +74,7 @@ WRITE8_HANDLER( starcrus_ship_parm_1_w )
if (starcrus_engine_sound_playing == 0)
{
starcrus_engine_sound_playing = 1;
- sample_start(0,0,1); /* engine sample */
+ sample_start(samples, 0,0,1); /* engine sample */
}
}
@@ -81,13 +83,15 @@ WRITE8_HANDLER( starcrus_ship_parm_1_w )
if (starcrus_engine_sound_playing == 1)
{
starcrus_engine_sound_playing = 0;
- sample_stop(0);
+ sample_stop(samples, 0);
}
}
}
WRITE8_HANDLER( starcrus_ship_parm_2_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
+
s2_sprite = data&0x1f;
set_led_status(2,~data & 0x80); /* game over lamp */
coin_counter_w(0, ((data&0x40)>>6)^0x01); /* coin counter */
@@ -98,7 +102,7 @@ WRITE8_HANDLER( starcrus_ship_parm_2_w )
if (starcrus_engine_sound_playing == 0)
{
starcrus_engine_sound_playing = 1;
- sample_start(0,0,1); /* engine sample */
+ sample_start(samples,0,0,1); /* engine sample */
}
}
else
@@ -106,7 +110,7 @@ WRITE8_HANDLER( starcrus_ship_parm_2_w )
if (starcrus_engine_sound_playing == 1)
{
starcrus_engine_sound_playing = 0;
- sample_stop(0);
+ sample_stop(samples,0);
}
}
@@ -114,6 +118,8 @@ WRITE8_HANDLER( starcrus_ship_parm_2_w )
WRITE8_HANDLER( starcrus_proj_parm_1_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
+
p1_sprite = data&0x0f;
launch1_on = ((data&0x20)>>5)^0x01;
explode1_on = ((data&0x10)>>4)^0x01;
@@ -123,7 +129,7 @@ WRITE8_HANDLER( starcrus_proj_parm_1_w )
if (starcrus_explode_sound_playing == 0)
{
starcrus_explode_sound_playing = 1;
- sample_start(1,1,1); /* explosion initial sample */
+ sample_start(samples, 1,1,1); /* explosion initial sample */
}
}
else
@@ -131,7 +137,7 @@ WRITE8_HANDLER( starcrus_proj_parm_1_w )
if (starcrus_explode_sound_playing == 1)
{
starcrus_explode_sound_playing = 0;
- sample_start(1,2,0); /* explosion ending sample */
+ sample_start(samples, 1,2,0); /* explosion ending sample */
}
}
@@ -140,7 +146,7 @@ WRITE8_HANDLER( starcrus_proj_parm_1_w )
if (starcrus_launch1_sound_playing == 0)
{
starcrus_launch1_sound_playing = 1;
- sample_start(2,3,0); /* launch sample */
+ sample_start(samples, 2,3,0); /* launch sample */
}
}
else
@@ -151,6 +157,8 @@ WRITE8_HANDLER( starcrus_proj_parm_1_w )
WRITE8_HANDLER( starcrus_proj_parm_2_w )
{
+ const device_config *samples = devtag_get_device(space->machine, SOUND, "samples");
+
p2_sprite = data&0x0f;
launch2_on = ((data&0x20)>>5)^0x01;
explode2_on = ((data&0x10)>>4)^0x01;
@@ -160,7 +168,7 @@ WRITE8_HANDLER( starcrus_proj_parm_2_w )
if (starcrus_explode_sound_playing == 0)
{
starcrus_explode_sound_playing = 1;
- sample_start(1,1,1); /* explosion initial sample */
+ sample_start(samples, 1,1,1); /* explosion initial sample */
}
}
else
@@ -168,7 +176,7 @@ WRITE8_HANDLER( starcrus_proj_parm_2_w )
if (starcrus_explode_sound_playing == 1)
{
starcrus_explode_sound_playing = 0;
- sample_start(1,2,0); /* explosion ending sample */
+ sample_start(samples, 1,2,0); /* explosion ending sample */
}
}
@@ -177,7 +185,7 @@ WRITE8_HANDLER( starcrus_proj_parm_2_w )
if (starcrus_launch2_sound_playing == 0)
{
starcrus_launch2_sound_playing = 1;
- sample_start(3,3,0); /* launch sample */
+ sample_start(samples, 3,3,0); /* launch sample */
}
}
else
diff --git a/src/mame/video/subs.c b/src/mame/video/subs.c
index 8952f501fa3..3ef22c4ef2d 100644
--- a/src/mame/video/subs.c
+++ b/src/mame/video/subs.c
@@ -43,7 +43,7 @@ VIDEO_UPDATE( subs )
const device_config *left_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "left");
const device_config *right_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "right");
- const address_space *space = cpu_get_address_space(screen->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const device_config *discrete = devtag_get_device(screen->machine, SOUND, "discrete");
/* for every character in the Video RAM, check if it has been modified */
/* since last time and update it accordingly. */
@@ -149,7 +149,7 @@ VIDEO_UPDATE( subs )
}
/* Update sound */
- discrete_sound_w(space, SUBS_LAUNCH_DATA, spriteram[5] & 0x0f); // Launch data
- discrete_sound_w(space, SUBS_CRASH_DATA, spriteram[5] >> 4); // Crash/explode data
+ discrete_sound_w(discrete, SUBS_LAUNCH_DATA, spriteram[5] & 0x0f); // Launch data
+ discrete_sound_w(discrete, SUBS_CRASH_DATA, spriteram[5] >> 4); // Crash/explode data
return 0;
}
diff --git a/src/mame/video/tia.c b/src/mame/video/tia.c
index 28848fabb60..23b709ef33e 100644
--- a/src/mame/video/tia.c
+++ b/src/mame/video/tia.c
@@ -1863,7 +1863,7 @@ WRITE8_HANDLER( tia_w )
case 0x18: /* AUDF1 */
case 0x19: /* AUDV0 */
case 0x1A: /* AUDV1 */
- tia_sound_w(space, offset, data);
+ tia_sound_w(devtag_get_device(space->machine, SOUND, "tia"), offset, data);
break;
case 0x1B:
diff --git a/src/mame/video/toaplan2.c b/src/mame/video/toaplan2.c
index 1d8a35e5d90..1c15ba04122 100644
--- a/src/mame/video/toaplan2.c
+++ b/src/mame/video/toaplan2.c
@@ -1004,10 +1004,9 @@ static void toaplan2_scroll_reg_data_w(running_machine *machine, offs_t offset,
if ((toaplan2_sub_cpu == CPU_2_Z80) && (data == 3))
{
/* HACK! When tilted, sound CPU needs to be reset. */
- if (machine->config->sound[0].type == SOUND_YM3812)
{
cpu_set_input_line(machine->cpu[1], INPUT_LINE_RESET, PULSE_LINE);
- sndti_reset(SOUND_YM3812, 0);
+ devtag_reset(machine, SOUND, "ym");
}
}
diff --git a/src/mame/video/triplhnt.c b/src/mame/video/triplhnt.c
index 313c8fe8bde..efa5084e20d 100644
--- a/src/mame/video/triplhnt.c
+++ b/src/mame/video/triplhnt.c
@@ -130,7 +130,7 @@ static void draw_sprites(running_machine *machine, bitmap_t* bitmap, const recta
VIDEO_UPDATE( triplhnt )
{
- const address_space *space = cpu_get_address_space(screen->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const device_config *discrete = devtag_get_device(screen->machine, SOUND, "discrete");
tilemap_mark_all_tiles_dirty(bg_tilemap);
@@ -138,7 +138,7 @@ VIDEO_UPDATE( triplhnt )
draw_sprites(screen->machine, bitmap, cliprect);
- discrete_sound_w(space, TRIPLHNT_BEAR_ROAR_DATA, triplhnt_playfield_ram[0xfa] & 15);
- discrete_sound_w(space, TRIPLHNT_SHOT_DATA, triplhnt_playfield_ram[0xfc] & 15);
+ discrete_sound_w(discrete, TRIPLHNT_BEAR_ROAR_DATA, triplhnt_playfield_ram[0xfa] & 15);
+ discrete_sound_w(discrete, TRIPLHNT_SHOT_DATA, triplhnt_playfield_ram[0xfc] & 15);
return 0;
}
diff --git a/src/mame/video/ultratnk.c b/src/mame/video/ultratnk.c
index c5f45978eca..852f859bbe4 100644
--- a/src/mame/video/ultratnk.c
+++ b/src/mame/video/ultratnk.c
@@ -96,7 +96,7 @@ VIDEO_EOF( ultratnk )
{
int i;
UINT16 BG = colortable_entry_get_value(machine->colortable, 0);
- const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
+ const device_config *discrete = devtag_get_device(machine, SOUND, "discrete");
/* check for sprite-playfield collisions */
@@ -141,8 +141,8 @@ VIDEO_EOF( ultratnk )
/* update sound status */
- discrete_sound_w(space, ULTRATNK_MOTOR_DATA_1, videoram[0x391] & 15);
- discrete_sound_w(space, ULTRATNK_MOTOR_DATA_2, videoram[0x393] & 15);
+ discrete_sound_w(discrete, ULTRATNK_MOTOR_DATA_1, videoram[0x391] & 15);
+ discrete_sound_w(discrete, ULTRATNK_MOTOR_DATA_2, videoram[0x393] & 15);
}
diff --git a/src/mame/video/xxmissio.c b/src/mame/video/xxmissio.c
index 804b232f858..603aa3cf268 100644
--- a/src/mame/video/xxmissio.c
+++ b/src/mame/video/xxmissio.c
@@ -21,11 +21,11 @@ static UINT8 yscroll;
static UINT8 flipscreen;
-WRITE8_HANDLER( xxmissio_scroll_x_w )
+WRITE8_DEVICE_HANDLER( xxmissio_scroll_x_w )
{
xscroll = data;
}
-WRITE8_HANDLER( xxmissio_scroll_y_w )
+WRITE8_DEVICE_HANDLER( xxmissio_scroll_y_w )
{
yscroll = data;
}