Previous 15994 Revisions Next

r1878 Sunday 9th March, 2008 at 23:29:30 UTC by Nathan Woods
Updated to MAME 0.123u4 core
[docs]messnew.txt
[src/build]png2bdc.c
[src/emu]cheat.c config.c config.h cpuexec.c cpuexec.h cpuintrf.h deprecat.h devintrf.c devintrf.h drawgfx.c drawgfx.h driver.h eigccppc.h eigccx86.h emu.mak info.c inptport.c inptport.h input.c input.h mame.c mame.h mamecore.h mconfig.c mconfig.h memconv.h memory.c memory.h output.c output.h render.c render.h rendersw.c rendfont.c rendfont.h rendlay.c rendutil.c rendutil.h sound.c sound.h state.c state.h streams.c streams.h tilemap.c tilemap.h timer.c timer.h ui.c uigfx.c uimenu.c uimenu.h validity.c video.c video.h watchdog.c* watchdog.h*
[src/emu/cpu]drcfe.c drcfe.h
[src/emu/cpu/adsp2100]2100ops.c adsp2100.c
[src/emu/cpu/alph8201]alph8201.c
[src/emu/cpu/arm7]arm7core.c arm7core.h
[src/emu/cpu/ccpu]ccpu.c ccpu.h
[src/emu/cpu/dsp32]dsp32.c
[src/emu/cpu/dsp56k]dsp56k.c
[src/emu/cpu/g65816]g65816.c g65816cm.h g65816op.h
[src/emu/cpu/h6280]h6280.c
[src/emu/cpu/i8051]i8051.c
[src/emu/cpu/i8085]i8085.c
[src/emu/cpu/i86]i86.c i86time.c
[src/emu/cpu/m6502]m4510.c m6502.c m6509.c m65ce02.c ops02.h
[src/emu/cpu/m6800]m6800.c
[src/emu/cpu/m68000]m68kcpu.c
[src/emu/cpu/m6805]m6805.c
[src/emu/cpu/mc68hc11]mc68hc11.c
[src/emu/cpu/mips]mdrc64.c
[src/emu/cpu/powerpc]ppc.c ppc602.c ppc603.c
[src/emu/cpu/rsp]rsp.c rsp.h
[src/emu/cpu/sh2]sh2.c
[src/emu/cpu/sh4]sh4.c
[src/emu/cpu/sharc]sharcops.c
[src/emu/cpu/spc700]spc700.c
[src/emu/cpu/tms32025]tms32025.c
[src/emu/cpu/tms32031]32031ops.c tms32031.c
[src/emu/cpu/tms34010]tms34010.c tms34010.h
[src/emu/cpu/tms7000]tms7000.c
[src/emu/cpu/z8000]z8000.c
[src/emu/cpu/z80gb]z80gb.c z80gb.h
[src/emu/debug]debugcpu.c debugcpu.h
[src/emu/drivers]xtal.h
[src/emu/machine]6522via.c 6522via.h 6532riot.c 6532riot.h 6821pia.c 6821pia.h 6840ptm.c 6840ptm.h 8042kbdc.c 8237dma.c 8255ppi.c 8255ppi.h 8257dma.c laserdsc.c laserdsc.h mc146818.c msm6242.c pc16552d.c pci.c pic8259.c pit8253.c pit8253.h z80ctc.c z80ctc.h z80dma.c z80dma.h z80sio.c z80sio.h
[src/emu/sound]2151intf.c 2151intf.h 2203intf.c 2203intf.h 2413intf.c 2608intf.h 3812intf.c 3812intf.h aica.c aicalfo.c ay8910.c ay8910.h cdda.c disc_dev.c disc_flt.c disc_inp.c disc_mth.c disc_wav.c es5503.c es5503.h k053260.c k053260.h namco.c pokey.c pokey.h scsp.c sp0256.c tms5220r.c upd7759.c x1_010.c ym2151.c ym2151.h ymf271.c ymf271.h ymz280b.c ymz280b.h
[src/emu/video]cdp1869.c generic.c generic.h mc6845.c mc6845.h poly.c poly.h s2636.c s2636.h tlc34076.c tms34061.c tms34061.h tms9928a.c v9938.c vector.c vooddefs.h voodoo.c voodoo.h
[src/lib/util]cdrom.c chd.h png.c
[src/mame]mame.mak mamedriv.c
[src/mame/audio]8080bw.c amiga.c asteroid.c atarijsa.c avalnche.c aztarac.c blockade.c bsktball.c cage.c canyon.c carnival.c cchasm.c cinemat.c circus.c crbaloon.c dcs.c dkong.c exidy.c exidy440.c firetrk.c gottlieb.c irem.c jaguar.c jedi.c leland.c llander.c m72.c mario.c mcr.c mcr.h mw8080bw.c namco54.c namcoc7x.h orbit.c phoenix.c poolshrk.c qix.c redalert.c redbaron.c rockola.c scramble.c seibu.c snes.c spiders.c starwars.c subs.c taitosnd.c toaplan2.c trackfld.c vicdual.c williams.c
[src/mame/drivers]1942.c 1943.c 1945kiii.c 20pacgal.c 2mindril.c 39in1.c 40love.c 4enraya.c 8080bw.c 88games.c acefruit.c acommand.c actfancr.c aeroboto.c aerofgt.c airbustr.c ajax.c aleck64.c alg.c aliens.c alpha68k.c ambush.c amidar.c ampoker2.c amspdwy.c angelkds.c appoooh.c aquarium.c arabian.c arcadecl.c arcadia.c argus.c arkanoid.c armedf.c ashnojoe.c asterix.c astinvad.c astrocde.c astrof.c asuka.c atarifb.c atarig1.c atarig42.c atarigt.c atarigx2.c atarisy1.c atarisy2.c atetris.c attckufo.c avalnche.c aztarac.c backfire.c badlands.c bagman.c balsente.c bankp.c baraduke.c battlane.c battlera.c battlex.c battlnts.c bbusters.c beathead.c beezer.c berzerk.c bestleag.c bfcobra.c bfm_sc2.c bigevglf.c bigfghtr.c bigstrkb.c bionicc.c bishi.c bishjan.c bking.c bladestl.c blktiger.c blmbycar.c blockade.c blockhl.c blockout.c bloodbro.c blstroid.c blueprnt.c bmcbowl.c bnstars.c bogeyman.c bombjack.c boogwing.c bottom9.c brkthru.c bsktball.c btime.c btoads.c bublbobl.c buggychl.c bwing.c cabal.c calomega.c calorie.c canyon.c capbowl.c carjmbre.c carpolo.c carrera.c cave.c cbasebal.c cbuster.c cclimber.c centiped.c chaknpop.c cham24.c champbas.c champbwl.c changela.c cheekyms.c cherrym.c cherrym2.c chinagat.c chinsan.c chqflag.c cidelsa.c cinemat.c circus.c circusc.c cischeat.c citycon.c clayshoo.c cliffhgr.c cloak.c clshroad.c cninja.c cntsteer.c coinmstr.c combatsc.c commando.c compgolf.c contra.c coolpool.c coolridr.c cop01.c cosmic.c couple.c cowrace.c cps1.c cps2.c cps3.c crbaloon.c crgolf.c crimfght.c crospang.c crshrace.c crystal.c cshooter.c csk.c cubocd32.c cultures.c cvs.c cyberbal.c cybertnk.c dacholer.c dambustr.c darius.c darkhors.c darkmist.c darkseal.c dassault.c dblewing.c dbz.c dcheese.c dcon.c ddayjlc.c ddealer.c ddenlovr.c ddragon.c ddragon3.c ddrible.c ddz.c deadang.c dec0.c dec8.c deco156.c deco32.c deco_mlc.c decocass.c deniam.c destroyr.c dgpix.c dietgo.c discoboy.c diverboy.c djboy.c djmain.c dkong.c dlair.c dmndrby.c docastle.c dogfgt.c dominob.c dooyong.c dorachan.c dotrikun.c dragrace.c dreamwld.c drgnmst.c dribling.c drmicro.c drtomy.c drw80pkr.c dunhuang.c dwarfd.c dynadice.c dynax.c dynduke.c egghunt.c enigma2.c eolith.c eolith16.c epos.c eprom.c equites.c ertictac.c esd16.c esh.c espial.c ettrivia.c exctsccr.c exedexes.c exerion.c exidy.c exidy440.c expro02.c exprraid.c exterm.c exzisus.c f-32.c f1gp.c fantland.c fastfred.c fastlane.c fcombat.c fcrash.c filetto.c finalizr.c findout.c firebeat.c firetrap.c firetrk.c fitfight.c flkatck.c flower.c flstory.c flyball.c foodf.c fortecar.c freekick.c frogger.c fromanc2.c fromance.c funkybee.c funkyjet.c funworld.c funybubl.c fuukifg2.c gaelco.c gaelco2.c gaelco3d.c gaiden.c galaga.c galaxia.c galaxian.c galivan.c galpani2.c galpani3.c galpanic.c galspnbl.c gamecstl.c gameplan.c gaplus.c gauntlet.c gberet.c gbusters.c gcpinbal.c genesis.c getrivia.c ghosteo.c gijoe.c ginganin.c gladiatr.c glass.c gng.c go2000.c goal92.c goindol.c goldstar.c gomoku.c good.c goodejan.c gotcha.c gottlieb.c gotya.c gpworld.c gradius3.c grchamp.c groundfx.c gstream.c gstriker.c gsword.c gticlub.c gtipoker.c gumbo.c gunbustr.c gundealr.c gunpey.c gunsmoke.c gyruss.c hal21.c halleys.c hanaawas.c hanaroku.c harddriv.c hcastle.c hexa.c hexion.c higemaru.c hitme.c hnayayoi.c hng64.c holeland.c homedata.c homerun.c hornet.c hotblock.c hshavoc.c hyhoo.c hyperspt.c hyprduel.c igs_180.c igs_blit.c igs_m027.c igs_m68.c ikki.c imolagp.c intrscti.c inufuku.c iqblock.c ironhors.c istellar.c itech32.c itech8.c jack.c jackal.c jackpool.c jailbrek.c jalmah.c jchan.c jcross.c jedi.c jollyjgr.c jongkyo.c jrpacman.c junofrst.c kaneko16.c kangaroo.c karnov.c kchamp.c kickgoal.c kingobox.c kingpin.c kinst.c kinstb.c klax.c kncljoe.c koikoi.c konamigq.c konamigv.c konamigx.c konamim2.c kopunch.c ksayakyu.c ksys573.c kyugo.c labyrunr.c ladybug.c ladyfrog.c laserbas.c laserbat.c lasso.c lastduel.c lastfght.c lazercmd.c legionna.c leland.c lemmings.c lethal.c lethalj.c lgp.c liberate.c liberatr.c limenko.c littlerb.c lkage.c lockon.c looping.c lordgun.c lsasquad.c ltcasino.c lucky8.c lvcards.c lwings.c m10.c m107.c m52.c m57.c m58.c m62.c m72.c m79amb.c m90.c m92.c macrossp.c macs.c madalien.c madmotor.c magic10.c magicfly.c magmax.c mainevt.c mainsnk.c mappy.c marineb.c marinedt.c mario.c markham.c marvins.c mastboy.c matmania.c maxaflex.c mayumi.c mazerbla.c mcatadv.c mcr.c mcr3.c mcr68.c meadows.c mediagx.c megadriv.c megaplay.c megasys1.c megazone.c meijinsn.c merit.c meritm.c mermaid.c metlclsh.c metro.c mexico86.c mhavoc.c micro3d.c midas.c midvunit.c midzeus.c mikie.c miniboy7.c minivadr.c mirage.c mirax.c missb2.c missile.c mitchell.c mjkjidai.c mjsister.c mjsiyoub.c mlanding.c model1.c model2.c model3.c mogura.c mole.c momoko.c moo.c mosaic.c mouser.c mpu4.c mpu4drvr.c mquake.c mrdo.c mrflea.c mrjong.c ms32.c msisaac.c mugsmash.c multigam.c munchmo.c murogem.c mustache.c mw8080bw.c mwarr.c mystston.c mystwarr.c n8080.c namcofl.c namcoic.c namcona1.c namconb1.c namcond1.c namcos1.c namcos10.c namcos11.c namcos12.c namcos2.c namcos21.c namcos22.c namcos23.c namcos86.c naomi.c naughtyb.c nbmj8688.c nbmj8891.c nbmj8991.c nbmj9195.c nemesis.c neogeo.c news.c ninjakd2.c ninjaw.c nitedrvr.c niyanpai.c nmg5.c nmk16.c nova2001.c nss.c nwk-tr.c nycaptor.c nyny.c ohmygod.c ojankohs.c olibochu.c omegrace.c oneshot.c onetwo.c opwolf.c orbit.c othldrby.c othunder.c overdriv.c pacland.c pacman.c pandoras.c panicr.c paradise.c paranoia.c parodius.c pasha2.c pass.c pastelg.c pbaction.c pcktgal.c pengo.c peplus.c pgm.c pingpong.c pipedrm.c pipeline.c pirates.c pitnrun.c pkscram.c pktgaldx.c playch10.c playmark.c plygonet.c pmpoker.c pntnpuzl.c pokechmp.c polepos.c policetr.c polyplay.c poolshrk.c pooyan.c popeye.c popper.c portrait.c powerbal.c powerins.c ppmast93.c prehisle.c progolf.c psikyo.c psikyo4.c psikyosh.c psychic5.c pturn.c puckpkmn.c punchout.c pushman.c qdrmfgp.c qix.c quantum.c quasar.c quizdna.c quizo.c quizpani.c r2dtank.c rabbit.c raiden.c raiden2.c rainbow.c rallyx.c rampart.c rastan.c rbmk.c rcasino.c rcorsair.c realbrk.c redalert.c redclash.c relief.c renegade.c retofinv.c rmhaihai.c rockola.c rockrage.c rocnrope.c rohga.c rollerg.c rollrace.c rotaryf.c route16.c royalmah.c rungun.c safarir.c sandscrp.c sangho.c sauro.c sbasketb.c sbowling.c sbugger.c scobra.c scotrsht.c scramble.c scregg.c sderby.c seattle.c segac2.c segae.c segag80r.c segag80v.c segahang.c segald.c segaorun.c segas16a.c segas16b.c segas18.c segas24.c segas32.c segaxbd.c segaybd.c seibuspi.c seicross.c sengokmj.c senjyo.c seta.c seta2.c sf.c sfkick.c sg1000a.c sgladiat.c shadfrce.c shangha3.c shanghai.c shangkid.c shaolins.c shisen.c shootout.c shougi.c shuuz.c sidearms.c sidepckt.c silkroad.c simpl156.c simpsons.c skullxbo.c skyarmy.c skydiver.c skyfox.c skykid.c skylncr.c skyraid.c slapfght.c slapshot.c sliver.c smstrv.c snk.c snk68.c snowbros.c solomon.c sonson.c spacefb.c spaceg.c spbactn.c spcforce.c spdodgeb.c speedatk.c speedbal.c speedspn.c speglsht.c spiders.c splash.c sprcros2.c sprint2.c sprint4.c spy.c srmp2.c srmp5.c srmp6.c srumbler.c ssfindo.c sshangha.c ssingles.c sslam.c ssozumo.c sspeedr.c ssrj.c sstrangr.c ssv.c st0016.c stactics.c stadhero.c starcrus.c starfire.c starshp1.c starwars.c statriv2.c steaser.c stepstag.c stfight.c stlforce.c strnskil.c stv.c subs.c suna16.c suna8.c supbtime.c supdrapo.c superchs.c superdq.c superqix.c supertnk.c suprgolf.c suprloco.c suprnova.c suprridr.c suprslam.c surpratk.c system1.c system16.c system18.c tagteam.c tail2nos.c taito_b.c taito_f2.c taito_f3.c taito_h.c taito_l.c taito_x.c taito_z.c taitoair.c taitojc.c taitosj.c taitowlf.c talbot.c tank8.c tankbatt.c tankbust.c taotaido.c targeth.c tatsumi.c tattack.c taxidrvr.c tbowl.c tceptor.c tecmo.c tecmo16.c tecmosys.c tehkanwc.c terracre.c tetrisp2.c thayers.c thedeep.c thepit.c thief.c thoop2.c thunderj.c thunderx.c tiamc1.c tickee.c tigeroad.c timelimt.c timeplt.c tmaster.c tmnt.c tnzs.c toaplan1.c toaplan2.c toki.c topshoot.c topspeed.c toratora.c toypop.c tp84.c trackfld.c travrusa.c triplhnt.c truco.c trucocl.c trvmadns.c trvquest.c tryout.c tsamurai.c ttchamp.c tubep.c tugboat.c tumbleb.c tumblep.c tunhunt.c turbo.c turbosub.c tutankhm.c twin16.c twincobr.c twins.c uapce.c ultraman.c ultratnk.c ultrsprt.c undrfire.c unico.c upscope.c usgames.c vamphalf.c vaportra.c vastar.c vball.c vcombat.c vegaeo.c vegas.c vendetta.c vicdual.c victory.c videopin.c vigilant.c viper.c vmetal.c volfied.c vroulet.c vsnes.c vulgus.c wallc.c wardner.c warpwarp.c warriorb.c wc90.c wc90b.c wecleman.c welltris.c wgp.c wheelfir.c wilytowr.c wink.c wiping.c witch.c wiz.c wrally.c wwfsstar.c wwfwfest.c xain.c xexex.c xmen.c xorworld.c xtheball.c xxmissio.c xybots.c xyonix.c yiear.c yumefuda.c yunsun16.c yunsung8.c zac2650.c zaccaria.c zaxxon.c zerozone.c zn.c zodiack.c zr107.c
[src/mame/includes]amiga.h artmagic.h atari.h btoads.h cinemat.h crbaloon.h cvs.h dc.h deco16ic.h dkong.h exidy440.h exterm.h firetrk.h grchamp.h harddriv.h jpmimpct.h kaneko16.h lethalj.h madalien.h midtunit.h midyunit.h mw8080bw.h mystston.h* namcoic.h rampart.h segas24.h snk.h stactics.h thunderj.h
[src/mame/machine]ajax.c amiga.c arkanoid.c asic65.c asteroid.c atari.c atarifb.c atarigen.c atarigen.h bagman.c balsente.c beezer.c bsktball.c bublbobl.c copsnrob.c cubocd32.c daikaiju.c dc.c dec0.c decocass.c decoprot.c equites.c galaxian.c harddriv.c irobot.c kaneko16.c konamigx.c konamigx.h konppc.c konppc.h leland.c lsasquad.c mcr.c mhavoc.c midwayic.c midwunit.c midyunit.c namcoio.c namcoio.h namcos1.c namcos2.c nb1413m3.c nitedrvr.c nmk004.c nmk112.c pcshare.c playch10.c psx.c qix.c r2crypt.c scramble.c segaic16.c segaic16.h segas24.c simpsons.c slapfght.c snes.c stfight.c stvcd.c subs.c tait8741.c tait8741.h taitosj.c tatsumi.c ticket.c tnzs.c toaplan1.c vertigo.c vsnes.c williams.c
[src/mame/video]1942.c 1943.c 20pacgal.c 40love.c 8080bw.c actfancr.c aeroboto.c aerofgt.c airbustr.c alpha68k.c ambush.c amiga.c amspdwy.c angelkds.c appoooh.c aquarium.c arcadecl.c argus.c arkanoid.c armedf.c artmagic.c astrocde.c atari.c atarifb.c atarig42.c atarigt.c atarigx2.c atarimo.c atarimo.h atarirle.c atarirle.h atarisy1.c atarisy2.c avgdvg.c badlands.c bagman.c balsente.c bankp.c baraduke.c batman.c battlane.c battlera.c battlex.c bbusters.c beezer.c bigevglf.c bigstrkb.c bionicc.c bking.c blktiger.c blmbycar.c blockade.c bloodbro.c blstroid.c blueprnt.c bogeyman.c bombjack.c boogwing.c bosco.c boxer.c brkthru.c bsktball.c btime.c btoads.c buggychl.c bwing.c cabal.c calomega.c canyon.c capbowl.c carpolo.c cave.c cbasebal.c cbuster.c ccastles.c cclimber.c centiped.c chaknpop.c champbas.c changela.c cheekyms.c cinemat.c circus.c circusc.c cischeat.c citycon.c cloak.c cloud9.c clshroad.c cninja.c combatsc.c commando.c compgolf.c contra.c cop01.c cosmic.c cps1.c crbaloon.c crospang.c crshrace.c cvs.c cyberbal.c darius.c darkseal.c dassault.c dc.c dcheese.c dcon.c dday.c ddragon.c ddragon3.c ddrible.c deadang.c dec0.c dec8.c deco16ic.c deco32.c deco_mlc.c decocass.c deniam.c dietgo.c digdug.c diverboy.c djmain.c dkong.c docastle.c dogfgt.c dooyong.c drgnmst.c dynax.c dynduke.c eolith.c eprom.c equites.c esd16.c espial.c exctsccr.c exedexes.c exerion.c exidy.c exidy440.c exprraid.c exterm.c f1gp.c fantland.c fastfred.c fgoal.c firetrap.c firetrk.c fitfight.c flkatck.c flower.c flstory.c freekick.c fromance.c funkybee.c funkyjet.c funworld.c funybubl.c fuukifg2.c fuukifg3.c gaelco.c gaelco2.c gaelco3d.c gaiden.c galaga.c galaxian.c galivan.c galpani2.c galpanic.c galspnbl.c gameplan.c gaplus.c gauntlet.c gberet.c gcpinbal.c genesis.c ginganin.c gladiatr.c glass.c gng.c goal92.c goindol.c goldstar.c gomoku.c goodejan.c gotcha.c gottlieb.c gotya.c gradius3.c grchamp.c groundfx.c gstriker.c gsword.c gtia.c gticlub.c gticlub.h gunbustr.c gunsmoke.c gyruss.c harddriv.c hcastle.c higemaru.c hnayayoi.c hng64.c holeland.c homedata.c homerun.c hyhoo.c hyperspt.c hyprduel.c ikki.c inufuku.c ironhors.c itech32.c itech8.c jack.c jackal.c jaguar.c jailbrek.c jalblend.c jcross.c jedi.c jpmimpct.c kan_pand.c kan_pand.h kaneko16.c karnov.c kchamp.c kickgoal.c kingobox.c klax.c kncljoe.c konamigx.c konamiic.c konamiic.h ksayakyu.c kyugo.c ladybug.c ladyfrog.c lasso.c lastduel.c lazercmd.c legionna.c lemmings.c lethalj.c liberate.c liberatr.c lkage.c lockon.c lordgun.c lsasquad.c lwings.c m10.c m107.c m3raster.c m52.c m57.c m58.c m62.c m72.c m90.c m92.c macrossp.c madalien.c madmotor.c mainsnk.c malzak.c mappy.c mario.c markham.c marvins.c matmania.c mcatadv.c mcr.c mcr3.c mcr68.c meadows.c megasys1.c mermaid.c metlclsh.c metro.c midtunit.c midvunit.c midyunit.c midzeus.c midzeus2.c mikie.c mitchell.c mjkjidai.c mjsister.c model1.c model2.c model2rd.c model3.c momoko.c mrdo.c mrflea.c mrjong.c ms32.c msisaac.c mugsmash.c munchmo.c mustache.c mystston.c n8080.c namcofl.c namcona1.c namconb1.c namcos1.c namcos2.c namcos21.c namcos22.c namcos86.c naughtyb.c nbmj8688.c nbmj8891.c nbmj8991.c nbmj9195.c nemesis.c neogeo.c ninjakd2.c ninjaw.c nitedrvr.c niyanpai.c nmk16.c nova2001.c nycaptor.c offtwall.c ohmygod.c ojankohs.c oneshot.c orbit.c othldrby.c othunder.c pacland.c pandoras.c paradise.c pastelg.c pbaction.c pcktgal.c pgm.c phoenix.c pingpong.c pirates.c pitnrun.c pktgaldx.c playmark.c pokechmp.c polepos.c pooyan.c popeye.c popper.c portrait.c powerins.c ppu2c0x.c ppu2c0x.h prehisle.c psikyo.c psikyo4.c psikyosh.c psx.c psychic5.c punchout.c pushman.c qix.c quasar.c quizdna.c raiden.c rallyx.c rampart.c realbrk.c redclash.c relief.c renegade.c retofinv.c rockola.c rocnrope.c rohga.c route16.c rpunch.c sauro.c sbasketb.c scotrsht.c sderby.c segag80r.c segaic16.c segaic16.h segaic24.c segaic24.h segas18.c segas32.c segaybd.c seibuspi.c seicross.c sengokmj.c senjyo.c seta.c seta2.c sf.c shadfrce.c shangha3.c shangkid.c shaolins.c shootout.c shuuz.c sidearms.c sidepckt.c silkroad.c simpl156.c simpsons.c skullxbo.c skydiver.c skyfox.c skykid.c skyraid.c slapfght.c slapshot.c snes.c snk.c snk68.c solomon.c sonson.c spacefb.c spbactn.c spdodgeb.c speedbal.c speedspn.c splash.c sprcros2.c sprint2.c sprint4.c sprint8.c srmp2.c srumbler.c sshangha.c sslam.c ssozumo.c sspeedr.c ssrj.c ssv.c st0016.c stactics.c stadhero.c starcrus.c starshp1.c stfight.c stlforce.c strnskil.c stvvdp1.c stvvdp2.c subs.c suna16.c suna8.c supbtime.c superchs.c superqix.c suprloco.c suprnova.c suprslam.c system1.c system16.c tagteam.c tail2nos.c taito_b.c taito_f2.c taito_f3.c taito_h.c taito_l.c taito_z.c taitoair.c taitoic.c taitoic.h taitojc.c taitosj.c tank8.c tankbatt.c tankbust.c taotaido.c targeth.c tatsumi.c tbowl.c tceptor.c tecmo.c tecmo16.c tehkanwc.c terracre.c tetrisp2.c thedeep.c thepit.c thief.c thoop2.c thunderj.c tia.c tia.h tiamc1.c tigeroad.c timelimt.c timeplt.c tmnt.c tnzs.c toaplan1.c toaplan2.c toki.c toobin.c topspeed.c toypop.c tp84.c trackfld.c travrusa.c triplhnt.c tryout.c tsamurai.c tumbleb.c tumblep.c tunhunt.c turbo.c twin16.c twincobr.c tx1.c ultratnk.c undrfire.c unico.c usgames.c vaportra.c vastar.c vball.c vdc.c vigilant.c vindictr.c volfied.c vulgus.c warpwarp.c warriorb.c wc90.c wc90b.c wecleman.c welltris.c wgp.c wiz.c wolfpack.c wrally.c wwfsstar.c wwfwfest.c xain.c xevious.c xmen.c xorworld.c xxmissio.c xybots.c ygv608.c yiear.c yunsun16.c zac2650.c zaccaria.c zaxxon.c zodiack.c
[src/mess]compcfg.c mess.mak mslegacy.c
[src/mess/audio]cgenie.c dave.c intv.c mea8000.c mea8000.h pc.c
[src/mess/devices]coco_fdc.c thomflop.c
[src/mess/drivers]a2600.c a310.c a7800.c abc80.c abc80x.c acrnsys1.c adam.c amiga.c amstrad.c apexc.c apf.c apple1.c apple2.c aquarius.c astrocde.c at.c atari.c atarist.c avigo.c bbc.c bbcbc.c bebox.c c128.c c16.c c64.c c65.c cbmb.c cgenie.c coco.c coleco.c compis.c concept.c coupe.c crvision.c dc.c einstein.c electron.c enterp.c ex800.c exelv.c exidy.c galaxy.c gamecom.c gb.c geneve.c gmaster.c intv.c ip20.c ip22.c jupiter.c kaypro.c kc.c kim1.c lisa.c lynx.c mbee.c microtan.c mk2.c mpf1.c msx.c mtx.c n64.c nc.c nes.c osi.c p2000t.c pc.c pc8801.c pce.c pcw.c pcw16.c pdp1.c pet.c pokemini.c primo.c psx.c ql.c saturn.c sg1000.c snes.c sord.c spectrum.c ssystem3.c svi318.c svision.c ti99_2.c ti99_4p.c ti99_4x.c ti99_8.c tm990189.c tmc1800.c tmc600.c trs80.c tutor.c tx0.c vc20.c vtech2.c wswan.c x68k.c z88.c
[src/mess/includes]amstr_pc.h apple2.h c128.h c16.h c64.h c65.h cbmb.h coco.h cococart.h gb.h hp48.h microtan.h pc1251.h pc1350.h pc1401.h pc1403.h pet.h svi318.h vc20tape.h
[src/mess/machine]68901mfp.c 68901mfp.h 994x_ser.c 99_dsk.c 99_hsgpl.c 99_ide.c 99_peb.c 99_peb.h 99_usbsm.c a7800.c adam.c aim65.c amigacd.c amigacrt.c amigafdc.c amigakbd.c amstr_pc.c amstrad.c apple2.c apple2gs.c apple3.c at.c atom.c bbc.c bebox.c c128.c c16.c c64.c c65.c cgenie.c coco.c coleco.c compis.c concept.c coupe.c cybiko.c dgn_beta.c europc.c gamecom.c gb.c geneve.c hp48.c i82439tx.c i8271.c ibmpc.c ins8154.c ins8154.h intv.c kaypro.c kc.c kim1.c lisa.c lviv.c lynx.c mac.c mc10.c mc6846.c mc6846.h mc6850.c mc6850.h microtan.c mpc105.c msx.c msx_slot.c mtx.c mz700.c nec765.c nes_mmc.c nes_mmc.h odyssey2.c oric.c osborne1.c pc.c pc8801.c pc_fdc.c pc_hdc.c pc_joy.c pclpt.c pet.c pmd85.c rp5c15.h sms.c spectrum.c svi318.c sym1.c thomson.c ti85.c ti99_4x.c trs80.c uart8250.c vc1541.c vc20.c vc20tape.c vectrex.c vtech2.c wd17xx.c wswan.c z80dart.c z80dart.h zx.c
[src/mess/video]aim65.c amstrad.c astrocde.c cbmb.c cirrus.c coco.c gb.c kaypro.c m6847.c newport.c pc8801.c pc_aga.c pc_cga.c pc_cga.h pc_mda.c pc_t1t.c pc_vga.c pc_vga.h pc_video.c ted7360.c ted7360.h vc4000.c vectrex.c vic4567.c x68k.c
[src/osd]osdcomm.h
[src/osd/windows]drawd3d.c video.c
[src/osd/winui]mui_audit.c
[src/tools]chdman.c makemeta.c

src/build/png2bdc.c
r1877r1878
344344               break;
345345            }
346346
347         /* print info */
348//          printf("  Character %X - width = %d\n", chstart, colend - colstart + 1);
349
350         /* allocate a bitmap */
351         ch->bitmap = bitmap_alloc(colend - colstart + 1, font->height, BITMAP_FORMAT_ARGB32);
352         if (ch->bitmap == NULL)
347         // skip char which code is already registered
348         if (ch->width <= 0)
353349         {
354            fprintf(stderr, "Error allocating character bitmap (%dx%d)\n", colend - colstart + 1, font->height);
355            continue;
356         }
350            /* print info */
351//              printf("  Character %X - width = %d\n", chstart, colend - colstart + 1);
357352
358         /* plot the character */
359         for (y = rowstart; y <= rowend; y++)
360            for (x = colstart; x <= colend; x++)
361               *BITMAP_ADDR32(ch->bitmap, y - rowstart, x - colstart) = pixel_is_set(bitmap, y, x) ? 0xffffffff : 0x00000000;
353            /* allocate a bitmap */
354            ch->bitmap = bitmap_alloc(colend - colstart + 1, font->height, BITMAP_FORMAT_ARGB32);
355            if (ch->bitmap == NULL)
356            {
357               fprintf(stderr, "Error allocating character bitmap (%dx%d)\n", colend - colstart + 1, font->height);
358               continue;
359            }
362360
363         /* set the character parameters */
364         ch->width = colend - colstart + 1;
365         ch->xoffs = 0;
366         ch->yoffs = font->yoffs;
367         ch->bmwidth = ch->bitmap->width;
368         ch->bmheight = ch->bitmap->height;
361            /* plot the character */
362            for (y = rowstart; y <= rowend; y++)
363               for (x = colstart; x <= colend; x++)
364                  *BITMAP_ADDR32(ch->bitmap, y - rowstart, x - colstart) = pixel_is_set(bitmap, y, x) ? 0xffffffff : 0x00000000;
369365
366            /* set the character parameters */
367            ch->width = colend - colstart + 1;
368            ch->xoffs = 0;
369            ch->yoffs = font->yoffs;
370            ch->bmwidth = ch->bitmap->width;
371            ch->bmheight = ch->bitmap->height;
372         }
373
370374         /* next character */
371375         chstart++;
372376         colstart = colend + 1;
src/mame/audio/cchasm.c
r1877r1878
2222    switch (offset & 0x61 )
2323    {
2424    case 0x00:
25        coin = (input_port_3_r (offset) >> 4) & 0x7;
25        coin = (input_port_3_r (machine, offset) >> 4) & 0x7;
2626        if (coin != 0x7) coin |= 0x8;
2727        return sound_flags | coin;
2828
2929    case 0x01:
30        return AY8910_read_port_0_r (offset);
30        return AY8910_read_port_0_r (machine, offset);
3131
3232    case 0x21:
33        return AY8910_read_port_1_r (offset);
33        return AY8910_read_port_1_r (machine, offset);
3434
3535    case 0x40:
36        return soundlatch_r (offset);
36        return soundlatch_r (machine, offset);
3737
3838    case 0x41:
3939        sound_flags &= ~0x80;
40        z80ctc_0_trg2_w (0, 0);
41        return soundlatch2_r (offset);
40        z80ctc_0_trg2_w (machine, 0, 0);
41        return soundlatch2_r (machine, offset);
4242    default:
4343        logerror("Read from unmapped internal IO device at 0x%x\n", offset + 0x6000);
4444        return 0;
r1877r1878
5050    switch (offset & 0x61 )
5151    {
5252    case 0x00:
53        AY8910_control_port_0_w (offset, data);
53        AY8910_control_port_0_w (machine, offset, data);
5454        break;
5555
5656    case 0x01:
57        AY8910_write_port_0_w (offset, data);
57        AY8910_write_port_0_w (machine, offset, data);
5858        break;
5959
6060    case 0x20:
61        AY8910_control_port_1_w (offset, data);
61        AY8910_control_port_1_w (machine, offset, data);
6262        break;
6363
6464    case 0x21:
65        AY8910_write_port_1_w (offset, data);
65        AY8910_write_port_1_w (machine, offset, data);
6666        break;
6767
6868    case 0x40:
69        soundlatch3_w (offset, data);
69        soundlatch3_w (machine, offset, data);
7070        break;
7171
7272    case 0x41:
7373        sound_flags |= 0x40;
74        soundlatch4_w (offset, data);
75        cpunum_set_input_line(Machine, 0, 1, HOLD_LINE);
74        soundlatch4_w (machine, offset, data);
75        cpunum_set_input_line(machine, 0, 1, HOLD_LINE);
7676        break;
7777
7878    case 0x61:
79        z80ctc_0_trg0_w (0, 0);
79        z80ctc_0_trg0_w (machine, 0, 0);
8080        break;
8181
8282    default:
r1877r1878
9494      switch (offset & 0xf)
9595      {
9696      case 0:
97         soundlatch_w (offset, data);
97         soundlatch_w (machine, offset, data);
9898         break;
9999      case 1:
100100         sound_flags |= 0x80;
101         soundlatch2_w (offset, data);
102         z80ctc_0_trg2_w (0, 1);
103         cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
101         soundlatch2_w (machine, offset, data);
102         z80ctc_0_trg2_w (machine, 0, 1);
103         cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
104104         break;
105105      case 2:
106106         led = data;
r1877r1878
114114   switch (offset & 0xf)
115115   {
116116   case 0x0:
117      return soundlatch3_r (offset) << 8;
117      return soundlatch3_r (machine, offset) << 8;
118118   case 0x1:
119119      sound_flags &= ~0x40;
120      return soundlatch4_r (offset) << 8;
120      return soundlatch4_r (machine,offset) << 8;
121121   case 0x2:
122      return (sound_flags| (input_port_3_r (offset) & 0x07) | 0x08) << 8;
122      return (sound_flags| (input_port_3_r (machine, offset) & 0x07) | 0x08) << 8;
123123   case 0x5:
124      return input_port_2_r (offset) << 8;
124      return input_port_2_r (machine, offset) << 8;
125125   case 0x8:
126      return input_port_1_r (offset) << 8;
126      return input_port_1_r (machine, offset) << 8;
127127   default:
128128      return 0xff << 8;
129129   }
r1877r1878
139139
140140static WRITE8_HANDLER( ctc_timer_1_w )
141141{
142
143142    if (data) /* rising edge */
144143    {
145144        output[0] ^= 0x7f;
r1877r1878
150149
151150static WRITE8_HANDLER( ctc_timer_2_w )
152151{
153
154152    if (data) /* rising edge */
155153    {
156154        output[1] ^= 0x7f;
r1877r1878
171169
172170static TIMER_CALLBACK( cchasm_sh_update )
173171{
174    if ((input_port_3_r (0) & 0x70) != 0x70)
175        z80ctc_0_trg0_w (0, 1);
172    if ((input_port_3_r (machine, 0) & 0x70) != 0x70)
173        z80ctc_0_trg0_w (machine, 0, 1);
176174}
177175
178176SOUND_START( cchasm )
src/mame/audio/qix.c
r1877r1878
2222
2323WRITE8_HANDLER( qix_dac_w )
2424{
25   discrete_sound_w(QIX_DAC_DATA, data);
25   discrete_sound_w(machine, QIX_DAC_DATA, data);
2626}
2727
2828WRITE8_HANDLER( qix_vol_w )
2929{
30   discrete_sound_w(QIX_VOL_DATA, data);
30   discrete_sound_w(machine, QIX_VOL_DATA, data);
3131}
3232
3333
src/mame/audio/snes.c
r1877r1878
146146
147147/* Original SPC DSP took samples 32000 times a second, which is once every
148148   (1024000/32000 = 32) cycles. */
149#ifdef UNUSED_DEFINITION
149150static const int               TS_CYC = CPU_RATE / SAMP_FREQ;
151#endif
150152
151153/* Ptrs to Gaussian table */
152154static const int *const G1 = &gauss[ 256 ];
r1877r1878
12261228      case 0x2:      /* Register address */
12271229         return spc_ram[0xf2];
12281230      case 0x3:      /* Register data */
1229         return snes_dsp_io_r( spc_ram[0xf2] );
1231         return snes_dsp_io_r( machine, spc_ram[0xf2] );
12301232      case 0x4:      /* Port 0 */
12311233      case 0x5:      /* Port 1 */
12321234      case 0x6:      /* Port 2 */
r1877r1878
13011303      case 0x2:      /* Register address */
13021304         break;
13031305      case 0x3:      /* Register data */
1304         snes_dsp_io_w( spc_ram[0xf2], data );
1306         snes_dsp_io_w( machine, spc_ram[0xf2], data );
13051307         break;
13061308      case 0x4:      /* Port 0 */
13071309      case 0x5:      /* Port 1 */
src/mame/audio/jaguar.c
r1877r1878
144144
145145#include "driver.h"
146146#include "deprecat.h"
147#include "memconv.h"
147148#include "includes/jaguar.h"
148149#include "cpu/jaguar/jaguar.h"
149150#include "sound/dac.h"
r1877r1878
340341
341342READ32_HANDLER( jaguar_jerry_regs32_r )
342343{
343   return (jaguar_jerry_regs_r(offset * 2, 0) << 16) | jaguar_jerry_regs_r(offset * 2 + 1, 0);
344   return read32be_with_16be_handler(jaguar_jerry_regs_r, machine, offset, mem_mask);
344345}
345346
346347
347348WRITE32_HANDLER( jaguar_jerry_regs32_w )
348349{
349   if (ACCESSING_MSW32)
350      jaguar_jerry_regs_w(offset * 2, data >> 16, mem_mask >> 16);
351   if (ACCESSING_LSW32)
352      jaguar_jerry_regs_w(offset * 2 + 1, data, mem_mask);
350   write32be_with_16be_handler(jaguar_jerry_regs_w, machine, offset, data, mem_mask);
353351}
354352
355353
src/mame/audio/spiders.c
r1877r1878
179179
180180WRITE8_HANDLER( spiders_audio_a_w )
181181{
182   discrete_sound_w(SPIDER_WEB_SOUND_MOD_DATA, 1 + (data & 4) * 8 + (data & 2) * 4 + (data & 1) * 2);
182   discrete_sound_w(machine, SPIDER_WEB_SOUND_MOD_DATA, 1 + (data & 4) * 8 + (data & 2) * 4 + (data & 1) * 2);
183183}
184184
185185WRITE8_HANDLER( spiders_audio_b_w )
186186{
187   discrete_sound_w(SPIDERS_WEB_SOUND_DATA, data);
187   discrete_sound_w(machine, SPIDERS_WEB_SOUND_DATA, data);
188188}
189189
190190
191191WRITE8_HANDLER( spiders_audio_ctrl_w )
192192{
193   discrete_sound_w(SPIDERS_FIRE_EN, data & 0x10 ? 1 : 0);
194   discrete_sound_w(SPIDERS_EXP_EN, data & 0x08 ? 1 : 0);
195   discrete_sound_w(SPIDERS_SUPER_WEB_EXPL_EN, data & 0x04 ? 1 : 0);
196   discrete_sound_w(SPIDERS_SUPER_WEB_EN, data & 0x02 ? 1 : 0);
197   discrete_sound_w(SPIDERS_X_EN, data & 0x01 ? 1 : 0);
193   discrete_sound_w(machine, SPIDERS_FIRE_EN, data & 0x10 ? 1 : 0);
194   discrete_sound_w(machine, SPIDERS_EXP_EN, data & 0x08 ? 1 : 0);
195   discrete_sound_w(machine, SPIDERS_SUPER_WEB_EXPL_EN, data & 0x04 ? 1 : 0);
196   discrete_sound_w(machine, SPIDERS_SUPER_WEB_EN, data & 0x02 ? 1 : 0);
197   discrete_sound_w(machine, SPIDERS_X_EN, data & 0x01 ? 1 : 0);
198198}
199199
200200
src/mame/audio/phoenix.c
r1877r1878
387387
388388WRITE8_HANDLER( phoenix_sound_control_a_w )
389389{
390   discrete_sound_w(PHOENIX_EFFECT_2_DATA, data & 0x0f);
391   discrete_sound_w(PHOENIX_EFFECT_2_FREQ, (data & 0x30) >> 4);
390   discrete_sound_w(machine, PHOENIX_EFFECT_2_DATA, data & 0x0f);
391   discrete_sound_w(machine, PHOENIX_EFFECT_2_FREQ, (data & 0x30) >> 4);
392392//  discrete_sound_w(PHOENIX_EFFECT_3_EN  , data & 0x40);
393393//  discrete_sound_w(PHOENIX_EFFECT_4_EN  , data & 0x80);
394394
r1877r1878
418418
419419WRITE8_HANDLER( phoenix_sound_control_b_w )
420420{
421   discrete_sound_w(PHOENIX_EFFECT_1_DATA, data & 0x0f);
422   discrete_sound_w(PHOENIX_EFFECT_1_FILT, data & 0x20);
423   discrete_sound_w(PHOENIX_EFFECT_1_FREQ, data & 0x10);
421   discrete_sound_w(machine, PHOENIX_EFFECT_1_DATA, data & 0x0f);
422   discrete_sound_w(machine, PHOENIX_EFFECT_1_FILT, data & 0x20);
423   discrete_sound_w(machine, PHOENIX_EFFECT_1_FREQ, data & 0x10);
424424
425425   /* update the tune that the MM6221AA is playing */
426426   mm6221aa_tune_w(0, data >> 6);
src/mame/audio/amiga.c
r1877r1878
8383
8484static TIMER_CALLBACK( signal_irq )
8585{
86   amiga_custom_w(REG_INTREQ, 0x8000 | (0x80 << param), 0);
86   amiga_custom_w(machine, REG_INTREQ, 0x8000 | (0x80 << param), 0);
8787}
8888
8989
src/mame/audio/cinemat.c
r1877r1878
871871        target_pitch = 0x10000 + (target_pitch << 12);
872872
873873        /* once per frame slide the pitch toward the target */
874        if (cpu_getcurrentframe() > last_frame)
874        if (video_screen_get_frame_number(0) > last_frame)
875875        {
876876            if (current_pitch > target_pitch)
877877                current_pitch -= 300;
878878            if (current_pitch < target_pitch)
879879                current_pitch += 200;
880880            sample_set_freq(4, current_pitch);
881            last_frame = cpu_getcurrentframe();
881            last_frame = video_screen_get_frame_number(0);
882882        }
883883
884884      /* remember the previous value */
r1877r1878
974974         target_volume = 0;
975975
976976      /* ramp the thrust volume */
977        if (sample_playing(2) && cpu_getcurrentframe() > last_frame)
977        if (sample_playing(2) && video_screen_get_frame_number(0) > last_frame)
978978        {
979979            if (current_volume > target_volume)
980980                current_volume -= 0.078f;
r1877r1878
984984                sample_set_volume(2, current_volume);
985985            else
986986                sample_stop(2);
987            last_frame = cpu_getcurrentframe();
987            last_frame = video_screen_get_frame_number(0);
988988        }
989989
990990      /* fire - falling edge */
r1877r1878
12511251        target_pitch = 0x10000 + (target_pitch << 12);
12521252
12531253        /* once per frame slide the pitch toward the target */
1254        if (cpu_getcurrentframe() > last_frame)
1254        if (video_screen_get_frame_number(0) > last_frame)
12551255        {
12561256            if (current_pitch > target_pitch)
12571257                current_pitch -= 300;
12581258            if (current_pitch < target_pitch)
12591259                current_pitch += 200;
12601260            sample_set_freq(4, current_pitch);
1261            last_frame = cpu_getcurrentframe();
1261            last_frame = video_screen_get_frame_number(0);
12621262        }
12631263
12641264      /* remember the previous value */
r1877r1878
13631363        target_pitch = 0x10000 + (target_pitch << 12);
13641364
13651365        /* once per frame slide the pitch toward the target */
1366        if (cpu_getcurrentframe() > last_frame)
1366        if (video_screen_get_frame_number(0) > last_frame)
13671367        {
13681368            if (current_pitch > target_pitch)
13691369                current_pitch -= 300;
13701370            if (current_pitch < target_pitch)
13711371                current_pitch += 200;
13721372            sample_set_freq(4, current_pitch);
1373            last_frame = cpu_getcurrentframe();
1373            last_frame = video_screen_get_frame_number(0);
13741374        }
13751375
13761376      /* remember the previous value */
src/mame/audio/toaplan2.c
r1877r1878
7070/*78*/  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
7171};
7272
73static void play_oki_sound(int game_sound, int data)
73static void play_oki_sound(running_machine *machine, int game_sound, int data)
7474{
75   int status = OKIM6295_status_0_r(0);
75   int status = OKIM6295_status_0_r(machine,0);
7676
7777   logerror("Playing sample %02x from command %02x\n",game_sound,data);
7878
7979   if (game_sound != 0)
8080   {
8181      if ((status & 0x01) == 0) {
82         OKIM6295_data_0_w(0,(0x80 | game_sound));
83         OKIM6295_data_0_w(0,0x11);
82         OKIM6295_data_0_w(machine,0,(0x80 | game_sound));
83         OKIM6295_data_0_w(machine,0,0x11);
8484      }
8585      else if ((status & 0x02) == 0) {
86         OKIM6295_data_0_w(0,(0x80 | game_sound));
87         OKIM6295_data_0_w(0,0x21);
86         OKIM6295_data_0_w(machine,0,(0x80 | game_sound));
87         OKIM6295_data_0_w(machine,0,0x21);
8888      }
8989      else if ((status & 0x04) == 0) {
90         OKIM6295_data_0_w(0,(0x80 | game_sound));
91         OKIM6295_data_0_w(0,0x41);
90         OKIM6295_data_0_w(machine,0,(0x80 | game_sound));
91         OKIM6295_data_0_w(machine,0,0x41);
9292      }
9393      else if ((status & 0x08) == 0) {
94         OKIM6295_data_0_w(0,(0x80 | game_sound));
95         OKIM6295_data_0_w(0,0x81);
94         OKIM6295_data_0_w(machine,0,(0x80 | game_sound));
95         OKIM6295_data_0_w(machine,0,0x81);
9696      }
9797   }
9898}
9999
100void dogyuun_okisnd_w(int data)
100void dogyuun_okisnd_w(running_machine *machine, int data)
101101{
102102   /* Need a board to determine the sound commands */
103103//  popmessage("Writing %04x to Sound CPU",data);
104104}
105105
106void kbash_okisnd_w(int data)
106void kbash_okisnd_w(running_machine *machine, int data)
107107{
108108//  popmessage("Writing %04x to Sound CPU",data);
109109
110110   if (data == 0)
111111   {
112      OKIM6295_data_0_w(0,0x78);      /* Stop playing effects */
112      OKIM6295_data_0_w(machine,0,0x78);      /* Stop playing effects */
113113   }
114114   else if ((data > 0) && (data < 128))
115115   {
116      play_oki_sound(kbash_cmd_snd[data], data);
116      play_oki_sound(machine, kbash_cmd_snd[data], data);
117117   }
118118}
119119
120void fixeight_okisnd_w(int data)
120void fixeight_okisnd_w(running_machine *machine, int data)
121121{
122122//  popmessage("Writing %04x to Sound CPU",data);
123123
124124   if (data == 0)
125125   {
126      OKIM6295_data_0_w(0,0x78);      /* Stop playing effects */
126      OKIM6295_data_0_w(machine,0,0x78);      /* Stop playing effects */
127127   }
128128   else if ((data > 0) && (data < 128))
129129   {
130      play_oki_sound(fixeight_cmd_snd[data], data);
130      play_oki_sound(machine, fixeight_cmd_snd[data], data);
131131   }
132132}
133133
134void batsugun_okisnd_w(int data)
134void batsugun_okisnd_w(running_machine *machine, int data)
135135{
136136//  popmessage("Writing %04x to Sound CPU",data);
137137
138138   if (data == 0)
139139   {
140      OKIM6295_data_0_w(0,0x78);      /* Stop playing effects */
140      OKIM6295_data_0_w(machine,0,0x78);      /* Stop playing effects */
141141   }
142142   else if ((data > 0) && (data < 64))
143143   {
144      play_oki_sound(batsugun_cmd_snd[data], data);
144      play_oki_sound(machine, batsugun_cmd_snd[data], data);
145145   }
146146}
src/mame/audio/llander.c
r1877r1878
8282WRITE8_HANDLER( llander_snd_reset_w )
8383{
8484   /* Resets the LFSR that is used for the white noise generator       */
85   discrete_sound_w(LLANDER_NOISE_RESET, 0);            /* Reset */
85   discrete_sound_w(machine, LLANDER_NOISE_RESET, 0);            /* Reset */
8686}
8787
8888WRITE8_HANDLER( llander_sounds_w )
8989{
90   discrete_sound_w(LLANDER_THRUST_DATA, data & 0x07);      /* Thrust volume */
91   discrete_sound_w(LLANDER_TONE3K_EN, data & 0x10);      /* Tone 3KHz enable */
92   discrete_sound_w(LLANDER_TONE6K_EN, data & 0x20);      /* Tone 6KHz enable */
93   discrete_sound_w(LLANDER_EXPLOD_EN, data & 0x08);      /* Explosion */
90   discrete_sound_w(machine, LLANDER_THRUST_DATA, data & 0x07);      /* Thrust volume */
91   discrete_sound_w(machine, LLANDER_TONE3K_EN, data & 0x10);      /* Tone 3KHz enable */
92   discrete_sound_w(machine, LLANDER_TONE6K_EN, data & 0x20);      /* Tone 6KHz enable */
93   discrete_sound_w(machine, LLANDER_EXPLOD_EN, data & 0x08);      /* Explosion */
9494}
9595
src/mame/audio/avalnche.c
r1877r1878
2323
2424WRITE8_HANDLER( avalnche_noise_amplitude_w )
2525{
26   discrete_sound_w(AVALNCHE_SOUNDLVL_DATA, data & 0x3f);
26   discrete_sound_w(machine, AVALNCHE_SOUNDLVL_DATA, data & 0x3f);
2727}
2828
2929
3030WRITE8_HANDLER( avalnche_attract_enable_w )
3131{
32   discrete_sound_w(AVALNCHE_ATTRACT_EN, data & 0x01);
32   discrete_sound_w(machine, AVALNCHE_ATTRACT_EN, data & 0x01);
3333}
3434
3535
r1877r1878
4040   switch (offset & 0x07)
4141   {
4242   case 0x00:      /* AUD0 */
43      discrete_sound_w(AVALNCHE_AUD0_EN, bit);
43      discrete_sound_w(machine, AVALNCHE_AUD0_EN, bit);
4444      break;
4545
4646   case 0x01:      /* AUD1 */
47      discrete_sound_w(AVALNCHE_AUD1_EN, bit);
47      discrete_sound_w(machine, AVALNCHE_AUD1_EN, bit);
4848      break;
4949
5050   case 0x02:      /* AUD2 */
5151   default:
52      discrete_sound_w(AVALNCHE_AUD2_EN, bit);
52      discrete_sound_w(machine, AVALNCHE_AUD2_EN, bit);
5353      break;
5454   }
5555}
src/mame/audio/canyon.c
r1877r1878
1616
1717WRITE8_HANDLER( canyon_motor_w )
1818{
19   discrete_sound_w(CANYON_MOTOR1_DATA + (offset & 0x01), data & 0x0f);
19   discrete_sound_w(machine, CANYON_MOTOR1_DATA + (offset & 0x01), data & 0x0f);
2020}
2121
2222
2323WRITE8_HANDLER( canyon_explode_w )
2424{
25   discrete_sound_w(CANYON_EXPLODE_DATA, data >> 4);
25   discrete_sound_w(machine, CANYON_EXPLODE_DATA, data >> 4);
2626}
2727
2828
2929WRITE8_HANDLER( canyon_attract_w )
3030{
31   discrete_sound_w(CANYON_ATTRACT1_EN + (offset & 0x01), offset & 0x02);
31   discrete_sound_w(machine, CANYON_ATTRACT1_EN + (offset & 0x01), offset & 0x02);
3232}
3333
3434
3535WRITE8_HANDLER( canyon_whistle_w )
3636{
37   discrete_sound_w(CANYON_WHISTLE1_EN + (offset & 0x01), offset & 0x02);
37   discrete_sound_w(machine, CANYON_WHISTLE1_EN + (offset & 0x01), offset & 0x02);
3838}
3939
4040
src/mame/audio/circus.c
r1877r1878
185185         switch ((data & 0x70) >> 4)
186186         {
187187            case 0 : /* All Off */
188               discrete_sound_w(CIRCUS_MUSIC_BIT, 0);
188               discrete_sound_w(machine, CIRCUS_MUSIC_BIT, 0);
189189               break;
190190
191191            case 1 : /* Music */
192               discrete_sound_w(CIRCUS_MUSIC_BIT, 1);
192               discrete_sound_w(machine, CIRCUS_MUSIC_BIT, 1);
193193               break;
194194
195195            case 2 : /* Circus = Pop; Rip Cord = Splash */
r1877r1878
218218         break;
219219
220220      case 2:   /* robotbwl */
221         discrete_sound_w(ROBOTBWL_MUSIC_BIT, data & 0x08);   /* Footsteps */
221         discrete_sound_w(machine, ROBOTBWL_MUSIC_BIT, data & 0x08);   /* Footsteps */
222222
223223         if (data & 0x40)   /* Hit */
224224            sample_start (0, 0, 0);
r1877r1878
243243         switch ((data & 0x70) >> 4)
244244         {
245245            case 0 : /* All Off */
246               discrete_sound_w(CRASH_MUSIC_BIT, 0);
246               discrete_sound_w(machine, CRASH_MUSIC_BIT, 0);
247247               break;
248248
249249            case 1 : /* Music */
250               discrete_sound_w(CRASH_MUSIC_BIT, 1);
250               discrete_sound_w(machine, CRASH_MUSIC_BIT, 1);
251251               break;
252252
253253            case 2 : /* Crash */
r1877r1878
255255               break;
256256
257257            case 3 : /* Normal Video and Beep */
258               discrete_sound_w(CRASH_BEEPER_EN, 0);
258               discrete_sound_w(machine, CRASH_BEEPER_EN, 0);
259259               break;
260260
261261            case 4 : /* Skid */
262262               break;
263263
264264            case 5 : /* Invert Video and Beep */
265               discrete_sound_w(CRASH_BEEPER_EN, 0);
265               discrete_sound_w(machine, CRASH_BEEPER_EN, 0);
266266               break;
267267
268268            case 6 : /* Hi Motor */
src/mame/audio/trackfld.c
r1877r1878
105105
106106WRITE8_HANDLER( konami_SN76496_0_w )
107107{
108    SN76496_0_w(offset, SN76496_latch);
108    SN76496_0_w(machine, offset, SN76496_latch);
109109}
110110
111111
src/mame/audio/redbaron.c
r1877r1878
5959WRITE8_HANDLER( redbaron_pokey_w )
6060{
6161    if( latch & 0x20 )
62        pokey1_w (offset, data);
62        pokey1_w(machine, offset, data);
6363}
6464
6565static void redbaron_sound_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
src/mame/audio/atarijsa.c
r1877r1878
208208         break;
209209
210210      case 0x002:      /* /RDP */
211         result = atarigen_6502_sound_r(offset);
211         result = atarigen_6502_sound_r(machine, offset);
212212         break;
213213
214214      case 0x004:      /* /RDIO */
r1877r1878
230230         break;
231231
232232      case 0x006:      /* /IRQACK */
233         atarigen_6502_irq_ack_r(0);
233         atarigen_6502_irq_ack_r(machine, 0);
234234         break;
235235
236236      case 0x200:      /* /VOICE */
r1877r1878
256256         break;
257257
258258      case 0x006:      /* /IRQACK */
259         atarigen_6502_irq_ack_r(0);
259         atarigen_6502_irq_ack_r(machine, 0);
260260         break;
261261
262262      case 0x200:      /* /VOICE */
r1877r1878
264264         break;
265265
266266      case 0x202:      /* /WRP */
267         atarigen_6502_sound_w(offset, data);
267         atarigen_6502_sound_w(machine, offset, data);
268268         break;
269269
270270      case 0x204:      /* WRIO */
r1877r1878
284284            int count;
285285
286286            if (((data ^ last_ctl) & 0x02) && (data & 0x02))
287               tms5220_data_w(0, speech_data);
287               tms5220_data_w(machine, 0, speech_data);
288288            count = 5 | ((data >> 2) & 2);
289289            tms5220_set_frequency(JSA_MASTER_CLOCK*2 / (16 - count));
290290         }
r1877r1878
308308         tms5220_volume = ((data >> 6) & 3) * 100 / 3;
309309         pokey_volume = ((data >> 4) & 3) * 100 / 3;
310310         ym2151_volume = ((data >> 1) & 7) * 100 / 7;
311         update_all_volumes(Machine);
311         update_all_volumes(machine);
312312         break;
313313   }
314314}
r1877r1878
329329   {
330330      case 0x000:      /* /RDV */
331331         if (has_oki6295)
332            result = OKIM6295_status_0_r(offset);
332            result = OKIM6295_status_0_r(machine, offset);
333333         else
334334            logerror("atarijsa: Unknown read at %04X\n", offset & 0x206);
335335         break;
336336
337337      case 0x002:      /* /RDP */
338         result = atarigen_6502_sound_r(offset);
338         result = atarigen_6502_sound_r(machine, offset);
339339         break;
340340
341341      case 0x004:      /* /RDIO */
r1877r1878
356356         break;
357357
358358      case 0x006:      /* /IRQACK */
359         atarigen_6502_irq_ack_r(0);
359         atarigen_6502_irq_ack_r(machine, 0);
360360         break;
361361
362362      case 0x200:      /* /WRV */
r1877r1878
382382         break;
383383
384384      case 0x006:      /* /IRQACK */
385         atarigen_6502_irq_ack_r(0);
385         atarigen_6502_irq_ack_r(machine, 0);
386386         break;
387387
388388      case 0x200:      /* /WRV */
389389         if (has_oki6295)
390            OKIM6295_data_0_w(offset, data);
390            OKIM6295_data_0_w(machine, offset, data);
391391         else
392392            logerror("atarijsa: Unknown write (%02X) at %04X\n", data & 0xff, offset & 0x206);
393393         break;
394394
395395      case 0x202:      /* /WRP */
396         atarigen_6502_sound_w(offset, data);
396         atarigen_6502_sound_w(machine, offset, data);
397397         break;
398398
399399      case 0x204:      /* /WRIO */
r1877r1878
429429            */
430430         ym2151_volume = ((data >> 1) & 7) * 100 / 7;
431431         oki6295_volume = 50 + (data & 1) * 50;
432         update_all_volumes(Machine);
432         update_all_volumes(machine);
433433         break;
434434   }
435435}
r1877r1878
450450   {
451451      case 0x000:      /* /RDV */
452452         if (has_oki6295)
453            result = OKIM6295_status_0_r(offset);
453            result = OKIM6295_status_0_r(machine, offset);
454454         break;
455455
456456      case 0x002:      /* /RDP */
457         result = atarigen_6502_sound_r(offset);
457         result = atarigen_6502_sound_r(machine, offset);
458458         break;
459459
460460      case 0x004:      /* /RDIO */
r1877r1878
475475         break;
476476
477477      case 0x006:      /* /IRQACK */
478         atarigen_6502_irq_ack_r(0);
478         atarigen_6502_irq_ack_r(machine, 0);
479479         break;
480480
481481      case 0x200:      /* /WRV */
r1877r1878
496496   {
497497      case 0x000:      /* /RDV */
498498         overall_volume = data * 100 / 127;
499         update_all_volumes(Machine);
499         update_all_volumes(machine);
500500         break;
501501
502502      case 0x002:      /* /RDP */
r1877r1878
505505         break;
506506
507507      case 0x006:      /* /IRQACK */
508         atarigen_6502_irq_ack_r(0);
508         atarigen_6502_irq_ack_r(machine, 0);
509509         break;
510510
511511      case 0x200:      /* /WRV */
512512         if (has_oki6295)
513            OKIM6295_data_0_w(offset, data);
513            OKIM6295_data_0_w(machine, offset, data);
514514         break;
515515
516516      case 0x202:      /* /WRP */
517         atarigen_6502_sound_w(offset, data);
517         atarigen_6502_sound_w(machine, offset, data);
518518         break;
519519
520520      case 0x204:      /* /WRIO */
r1877r1878
561561         /* update the volumes */
562562         ym2151_volume = ((data >> 1) & 7) * 100 / 7;
563563         oki6295_volume = 50 + (data & 1) * 50;
564         update_all_volumes(Machine);
564         update_all_volumes(machine);
565565         break;
566566   }
567567}
r1877r1878
584584         if (has_oki6295)
585585         {
586586            if (offset & 1)
587               result = OKIM6295_status_1_r(offset);
587               result = OKIM6295_status_1_r(machine, offset);
588588            else
589               result = OKIM6295_status_0_r(offset);
589               result = OKIM6295_status_0_r(machine, offset);
590590         }
591591         break;
592592
593593      case 0x002:      /* /RDP */
594         result = atarigen_6502_sound_r(offset);
594         result = atarigen_6502_sound_r(machine, offset);
595595         break;
596596
597597      case 0x004:      /* /RDIO */
r1877r1878
612612         break;
613613
614614      case 0x006:      /* /IRQACK */
615         atarigen_6502_irq_ack_r(0);
615         atarigen_6502_irq_ack_r(machine, 0);
616616         break;
617617
618618      case 0x200:      /* /WRV */
r1877r1878
633633   {
634634      case 0x000:      /* /RDV */
635635         overall_volume = data * 100 / 127;
636         update_all_volumes(Machine);
636         update_all_volumes(machine);
637637         break;
638638
639639      case 0x002:      /* /RDP */
r1877r1878
642642         break;
643643
644644      case 0x006:      /* /IRQACK */
645         atarigen_6502_irq_ack_r(0);
645         atarigen_6502_irq_ack_r(machine, 0);
646646         break;
647647
648648      case 0x200:      /* /WRV */
649649         if (has_oki6295)
650650         {
651651            if (offset & 1)
652               OKIM6295_data_1_w(offset, data);
652               OKIM6295_data_1_w(machine, offset, data);
653653            else
654               OKIM6295_data_0_w(offset, data);
654               OKIM6295_data_0_w(machine, offset, data);
655655         }
656656         break;
657657
658658      case 0x202:      /* /WRP */
659         atarigen_6502_sound_w(offset, data);
659         atarigen_6502_sound_w(machine, offset, data);
660660         break;
661661
662662      case 0x204:      /* /WRIO */
r1877r1878
704704         /* update the volumes */
705705         ym2151_volume = ((data >> 1) & 7) * 100 / 7;
706706         oki6295_volume = 50 + (data & 1) * 50;
707         update_all_volumes(Machine);
707         update_all_volumes(machine);
708708         break;
709709   }
710710}
src/mame/audio/cage.c
r1877r1878
483483{
484484   if (LOG_COMM)
485485      logerror("%06X:Data from CAGE = %04X\n", activecpu_get_pc(), data);
486   soundlatch_word_w(0, data, mem_mask);
486   soundlatch_word_w(machine, 0, data, mem_mask);
487487   cage_to_cpu_ready = 1;
488488   update_control_lines();
489489}
r1877r1878
503503UINT16 main_from_cage_r(void)
504504{
505505   if (LOG_COMM)
506      logerror("%06X:main read data = %04X\n", activecpu_get_pc(), soundlatch_word_r(0, 0));
506      logerror("%06X:main read data = %04X\n", activecpu_get_pc(), soundlatch_word_r(Machine, 0, 0));
507507   cage_to_cpu_ready = 0;
508508   update_control_lines();
509   return soundlatch_word_r(0, 0);
509   return soundlatch_word_r(Machine, 0, 0);
510510}
511511
512512
src/mame/audio/crbaloon.c
r1877r1878
3030
3131
3232
33void crbaloon_audio_set_music_freq(UINT8 freq)
33void crbaloon_audio_set_music_freq(running_machine *machine, UINT8 freq)
3434{
35   discrete_sound_w(CRBALOON_MUSIC_DATA, freq);
35   discrete_sound_w(machine, CRBALOON_MUSIC_DATA, freq);
3636}
3737
3838
39void crbaloon_audio_set_music_enable(int enabled)
39void crbaloon_audio_set_music_enable(running_machine *machine, int enabled)
4040{
41   discrete_sound_w(CRBALOON_MUSIC_EN, enabled);
41   discrete_sound_w(machine, CRBALOON_MUSIC_EN, enabled);
4242}
4343
4444
r1877r1878
6464}
6565
6666
67void crbaloon_audio_set_laugh_enable(int enabled)
67void crbaloon_audio_set_laugh_enable(running_machine *machine, int enabled)
6868{
69   discrete_sound_w(CRBALOON_LAUGH_EN, enabled);
69   discrete_sound_w(machine, CRBALOON_LAUGH_EN, enabled);
7070}
7171
7272
src/mame/audio/namco54.c
r1877r1878
7676{
7777   UINT8 out = (data & 0x0f);
7878   if (data & 0x10)
79      discrete_sound_w(NAMCO_54XX_1_DATA, out);
79      discrete_sound_w(machine, NAMCO_54XX_1_DATA, out);
8080   else
81      discrete_sound_w(NAMCO_54XX_0_DATA, out);
81      discrete_sound_w(machine, NAMCO_54XX_0_DATA, out);
8282}
8383
8484static WRITE8_HANDLER( namco_54xx_R1_w )
8585{
8686   UINT8 out = (data & 0x0f);
8787
88   discrete_sound_w(NAMCO_54XX_2_DATA, out);
88   discrete_sound_w(machine, NAMCO_54XX_2_DATA, out);
8989}
9090
9191
src/mame/audio/asteroid.c
r1877r1878
280280
281281WRITE8_HANDLER( asteroid_explode_w )
282282{
283   discrete_sound_w(ASTEROID_EXPLODE_DATA,(data&0x3c)>>2);            // Volume
283   discrete_sound_w(machine,ASTEROID_EXPLODE_DATA,(data&0x3c)>>2);            // Volume
284284   /* We will modify the pitch data to send the divider value. */
285285   switch ((data&0xc0))
286286   {
r1877r1878
297297         data = 5;
298298         break;
299299   }
300   discrete_sound_w(ASTEROID_EXPLODE_PITCH, data);
300   discrete_sound_w(machine,ASTEROID_EXPLODE_PITCH, data);
301301}
302302
303303WRITE8_HANDLER( asteroid_thump_w )
304304{
305   discrete_sound_w(ASTEROID_THUMP_EN,   data & 0x10);
306   discrete_sound_w(ASTEROID_THUMP_DATA, data & 0x0f);
305   discrete_sound_w(machine, ASTEROID_THUMP_EN,   data & 0x10);
306   discrete_sound_w(machine, ASTEROID_THUMP_DATA, data & 0x0f);
307307}
308308
309309WRITE8_HANDLER( asteroid_sounds_w )
310310{
311   discrete_sound_w(ASTEROID_SAUCER_SND_EN + offset, data & 0x80);
311   discrete_sound_w(machine, ASTEROID_SAUCER_SND_EN + offset, data & 0x80);
312312}
313313
314314WRITE8_HANDLER( astdelux_sounds_w )
315315{
316316   /* Only ever activates the thrusters in Astdelux */
317   discrete_sound_w(ASTEROID_THRUST_EN, data & 0x80);
317   discrete_sound_w(machine, ASTEROID_THRUST_EN, data & 0x80);
318318}
319319
320320WRITE8_HANDLER( asteroid_noise_reset_w )
321321{
322   discrete_sound_w(ASTEROID_NOISE_RESET, 0);
322   discrete_sound_w(machine, ASTEROID_NOISE_RESET, 0);
323323}
src/mame/audio/exidy440.c
r1877r1878
7373
7474
7575/* globals */
76UINT8 exidy440_sound_command;
77UINT8 exidy440_sound_command_ack;
76UINT8 *exidy440_sound_command;
77UINT8  exidy440_sound_command_ack;
7878
7979/* local allocated storage */
8080static UINT8 *sound_banks;
r1877r1878
136136   int i, length;
137137
138138   /* reset the system */
139   exidy440_sound_command = 0;
139   *exidy440_sound_command = 0;
140140   exidy440_sound_command_ack = 1;
141   state_save_register_global(exidy440_sound_command);
142141   state_save_register_global(exidy440_sound_command_ack);
143142
144143   /* reset the 6844 */
r1877r1878
343342   cpunum_set_input_line(Machine, 1, 1, CLEAR_LINE);
344343   exidy440_sound_command_ack = 1;
345344
346   return exidy440_sound_command;
345   return *exidy440_sound_command;
347346}
348347
349348
r1877r1878
932931
933932   MDRV_CPU_ADD(M6809, EXIDY440_AUDIO_CLOCK)
934933   MDRV_CPU_PROGRAM_MAP(exidy440_audio_map,0)
935   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
934   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
936935
937936   MDRV_SPEAKER_STANDARD_STEREO("left", "right")
938937
src/mame/audio/mcr.c
r1877r1878
6363static UINT8 ssio_ayvolume_lookup[16];
6464static UINT8 ssio_custom_input_mask[5];
6565static UINT8 ssio_custom_output_mask[2];
66static read8_handler ssio_custom_input[5];
67static write8_handler ssio_custom_output[2];
66static read8_machine_func ssio_custom_input[5];
67static write8_machine_func ssio_custom_output[2];
6868
6969/* Chip Squeak Deluxe-specific globals */
7070static UINT8 csdeluxe_sound_cpu;
r1877r1878
417417   UINT8 result = readinputportbytag_safe(port[offset], 0xff);
418418   if (ssio_custom_input[offset])
419419      result = (result & ~ssio_custom_input_mask[offset]) |
420               ((*ssio_custom_input[offset])(offset) & ssio_custom_input_mask[offset]);
420               ((*ssio_custom_input[offset])(machine, offset) & ssio_custom_input_mask[offset]);
421421   return result;
422422}
423423
r1877r1878
425425{
426426   int which = offset >> 2;
427427   if (which == 0)
428      mcr_control_port_w(offset, data);
428      mcr_control_port_w(machine, offset, data);
429429   if (ssio_custom_output[which])
430      (*ssio_custom_output[which])(offset, data & ssio_custom_output_mask[which]);
430      (*ssio_custom_output[which])(machine, offset, data & ssio_custom_output_mask[which]);
431431}
432432
433void ssio_set_custom_input(int which, int mask, read8_handler handler)
433void ssio_set_custom_input(int which, int mask, read8_machine_func handler)
434434{
435435   ssio_custom_input[which] = handler;
436436   ssio_custom_input_mask[which] = mask;
437437}
438438
439void ssio_set_custom_output(int which, int mask, write8_handler handler)
439void ssio_set_custom_output(int which, int mask, write8_machine_func handler)
440440{
441441   ssio_custom_output[which/4] = handler;
442442   ssio_custom_output_mask[which/4] = mask;
r1877r1878
535535
536536static TIMER_CALLBACK( csdeluxe_delayed_data_w )
537537{
538   pia_0_portb_w(0, param & 0x0f);
539   pia_0_ca1_w(0, ~param & 0x10);
538   pia_0_portb_w(machine, 0, param & 0x0f);
539   pia_0_ca1_w(machine, 0, ~param & 0x10);
540540
541541   /* oftentimes games will write one nibble at a time; the sync on this is very */
542542   /* important, so we boost the interleave briefly while this happens */
r1877r1878
550550   /* using the MOVEP instruction outputs the same value on the high and */
551551   /* low bytes. */
552552   if (ACCESSING_MSB)
553      return pia_0_alt_r(offset) << 8;
553      return pia_0_alt_r(machine, offset) << 8;
554554   else
555      return pia_0_alt_r(offset);
555      return pia_0_alt_r(machine, offset);
556556}
557557
558558static WRITE16_HANDLER( csdeluxe_pia_w )
559559{
560560   if (ACCESSING_MSB)
561      pia_0_alt_w(offset, data >> 8);
561      pia_0_alt_w(machine, offset, data >> 8);
562562   else
563      pia_0_alt_w(offset, data);
563      pia_0_alt_w(machine, offset, data);
564564}
565565
566566
r1877r1878
657657
658658static TIMER_CALLBACK( soundsgood_delayed_data_w )
659659{
660   pia_1_portb_w(0, (param >> 1) & 0x0f);
661   pia_1_ca1_w(0, ~param & 0x01);
660   pia_1_portb_w(machine, 0, (param >> 1) & 0x0f);
661   pia_1_ca1_w(machine, 0, ~param & 0x01);
662662
663663   /* oftentimes games will write one nibble at a time; the sync on this is very */
664664   /* important, so we boost the interleave briefly while this happens */
r1877r1878
750750
751751static TIMER_CALLBACK( turbocs_delayed_data_w )
752752{
753   pia_0_portb_w(0, (param >> 1) & 0x0f);
754   pia_0_ca1_w(0, ~param & 0x01);
753   pia_0_portb_w(machine, 0, (param >> 1) & 0x0f);
754   pia_0_ca1_w(machine, 0, ~param & 0x01);
755755
756756   /* oftentimes games will write one nibble at a time; the sync on this is very */
757757   /* important, so we boost the interleave briefly while this happens */
r1877r1878
853853   /* write strobe -- pass the current command to the TMS5200 */
854854   if (((data ^ squawkntalk_tms_strobes) & 0x02) && !(data & 0x02))
855855   {
856      tms5220_data_w(offset, squawkntalk_tms_command);
856      tms5220_data_w(machine, offset, squawkntalk_tms_command);
857857
858858      /* DoT expects the ready line to transition on a command/write here, so we oblige */
859      pia_1_ca2_w(0, 1);
860      pia_1_ca2_w(0, 0);
859      pia_1_ca2_w(machine, 0, 1);
860      pia_1_ca2_w(machine, 0, 0);
861861   }
862862
863863   /* read strobe -- read the current status from the TMS5200 */
864864   else if (((data ^ squawkntalk_tms_strobes) & 0x01) && !(data & 0x01))
865865   {
866      pia_1_porta_w(0, tms5220_status_r(offset));
866      pia_1_porta_w(machine, 0, tms5220_status_r(machine, offset));
867867
868868      /* DoT expects the ready line to transition on a command/write here, so we oblige */
869      pia_1_ca2_w(0, 1);
870      pia_1_ca2_w(0, 0);
869      pia_1_ca2_w(machine, 0, 1);
870      pia_1_ca2_w(machine, 0, 0);
871871   }
872872
873873   /* remember the state */
r1877r1878
883883
884884static TIMER_CALLBACK( squawkntalk_delayed_data_w )
885885{
886   pia_0_porta_w(0, ~param & 0x0f);
887   pia_0_cb1_w(0, ~param & 0x10);
886   pia_0_porta_w(machine, 0, ~param & 0x0f);
887   pia_0_cb1_w(machine, 0, ~param & 0x10);
888888}
889889
890890
src/mame/audio/aztarac.c
r1877r1878
2121   if (ACCESSING_LSB)
2222   {
2323      data &= 0xff;
24      soundlatch_w(offset, data);
24      soundlatch_w(machine, offset, data);
2525      sound_status ^= 0x21;
2626      if (sound_status & 0x20)
27         cpunum_set_input_line(Machine, 1, 0, HOLD_LINE);
27         cpunum_set_input_line(machine, 1, 0, HOLD_LINE);
2828   }
2929}
3030
r1877r1878
3232{
3333    sound_status |= 0x01;
3434    sound_status &= ~0x20;
35    return soundlatch_r(offset);
35    return soundlatch_r(machine,offset);
3636}
3737
3838READ8_HANDLER( aztarac_snd_status_r )
src/mame/audio/taitosnd.c
r1877r1878
266266WRITE16_HANDLER( taitosound_port16_lsb_w )
267267{
268268   if (ACCESSING_LSB)
269      taitosound_port_w(0,data & 0xff);
269      taitosound_port_w(machine,0,data & 0xff);
270270}
271271WRITE16_HANDLER( taitosound_comm16_lsb_w )
272272{
273273   if (ACCESSING_LSB)
274      taitosound_comm_w(0,data & 0xff);
274      taitosound_comm_w(machine,0,data & 0xff);
275275}
276276READ16_HANDLER( taitosound_comm16_lsb_r )
277277{
278   return taitosound_comm_r(0);
278   return taitosound_comm_r(machine,0);
279279}
280280
281281
282282WRITE16_HANDLER( taitosound_port16_msb_w )
283283{
284284   if (ACCESSING_MSB)
285      taitosound_port_w(0,data >> 8);
285      taitosound_port_w(machine,0,data >> 8);
286286}
287287WRITE16_HANDLER( taitosound_comm16_msb_w )
288288{
289289   if (ACCESSING_MSB)
290      taitosound_comm_w(0,data >> 8);
290      taitosound_comm_w(machine,0,data >> 8);
291291}
292292READ16_HANDLER( taitosound_comm16_msb_r )
293293{
294   return taitosound_comm_r(0) << 8;
294   return taitosound_comm_r(machine,0) << 8;
295295}
296296
src/mame/audio/mcr.h
r1877r1878
2020READ8_HANDLER( ssio_input_port_r );
2121WRITE8_HANDLER( ssio_output_port_w );
2222void ssio_reset_w(int state);
23void ssio_set_custom_input(int which, int mask, read8_handler handler);
24void ssio_set_custom_output(int which, int mask, write8_handler handler);
23void ssio_set_custom_input(int which, int mask, read8_machine_func handler);
24void ssio_set_custom_output(int which, int mask, write8_machine_func handler);
2525
2626WRITE8_HANDLER( csdeluxe_data_w );
2727READ8_HANDLER( csdeluxe_status_r );
src/mame/audio/vicdual.c
r1877r1878
150150   int new_croak = data & 0x08;
151151   int new_buzzz = data & 0x10;
152152
153//  discrete_sound_w(FROGS_HOP_EN, data & 0x01);
154//  discrete_sound_w(FROGS_JUMP_EN, data & 0x02);
155   discrete_sound_w(FROGS_TONGUE_EN, data & 0x04);
156//  discrete_sound_w(FROGS_CAPTURE_EN, data & 0x08);
157//  discrete_sound_w(FROGS_FLY_EN, data & 0x10);
158//  discrete_sound_w(FROGS_SPLASH_EN, data & 0x80);
153//  discrete_sound_w(machine, FROGS_HOP_EN, data & 0x01);
154//  discrete_sound_w(machine, FROGS_JUMP_EN, data & 0x02);
155   discrete_sound_w(machine, FROGS_TONGUE_EN, data & 0x04);
156//  discrete_sound_w(machine, FROGS_CAPTURE_EN, data & 0x08);
157//  discrete_sound_w(machine, FROGS_FLY_EN, data & 0x10);
158//  discrete_sound_w(machine, FROGS_SPLASH_EN, data & 0x80);
159159
160160   if (data & 0x01)
161161      sample_start (3, 3, 0);   // Hop
r1877r1878
447447{
448448   if (!sndti_exists(SOUND_DISCRETE, 0))
449449      return;
450   discrete_sound_w(HEADON_HISPEED_PC_EN, data & 0x01);
451   discrete_sound_w(HEADON_SCREECH1_EN, data & 0x02);
452   discrete_sound_w(HEADON_CRASH_EN, data & 0x04);
453   discrete_sound_w(HEADON_HISPEED_CC_EN, data & 0x08);
454   discrete_sound_w(HEADON_SCREECH2_EN, data & 0x10);
455   discrete_sound_w(HEADON_BONUS_EN, data & 0x20);
456   discrete_sound_w(HEADON_CAR_ON_EN, data & 0x40);
450   discrete_sound_w(machine, HEADON_HISPEED_PC_EN, data & 0x01);
451   discrete_sound_w(machine, HEADON_SCREECH1_EN, data & 0x02);
452   discrete_sound_w(machine, HEADON_CRASH_EN, data & 0x04);
453   discrete_sound_w(machine, HEADON_HISPEED_CC_EN, data & 0x08);
454   discrete_sound_w(machine, HEADON_SCREECH2_EN, data & 0x10);
455   discrete_sound_w(machine, HEADON_BONUS_EN, data & 0x20);
456   discrete_sound_w(machine, HEADON_CAR_ON_EN, data & 0x40);
457457
458458}
459459
r1877r1878
461461{
462462   if (!sndti_exists(SOUND_DISCRETE, 0))
463463      return;
464   discrete_sound_w(HEADON_HISPEED_PC_EN, data & 0x10);
465   discrete_sound_w(HEADON_SCREECH1_EN, data & 0x08);
466   discrete_sound_w(HEADON_CRASH_EN, data & 0x80);
467   discrete_sound_w(HEADON_HISPEED_CC_EN, data & 0x40);
468   discrete_sound_w(HEADON_SCREECH2_EN, data & 0x04);
469   discrete_sound_w(HEADON_BONUS_EN, data & 0x02);
470   discrete_sound_w(HEADON_CAR_ON_EN, data & 0x20);
464   discrete_sound_w(machine, HEADON_HISPEED_PC_EN, data & 0x10);
465   discrete_sound_w(machine, HEADON_SCREECH1_EN, data & 0x08);
466   discrete_sound_w(machine, HEADON_CRASH_EN, data & 0x80);
467   discrete_sound_w(machine, HEADON_HISPEED_CC_EN, data & 0x40);
468   discrete_sound_w(machine, HEADON_SCREECH2_EN, data & 0x04);
469   discrete_sound_w(machine, HEADON_BONUS_EN, data & 0x02);
470   discrete_sound_w(machine, HEADON_CAR_ON_EN, data & 0x20);
471471
472472}
473473
src/mame/audio/rockola.c
r1877r1878
715715      tone_channels[2].base = 0x1000 + ((data & 0x70) << 4);
716716      tone_channels[2].mask = 0xff;
717717
718      rockola_flipscreen_w(0, data);
718      rockola_flipscreen_w(machine, 0, data);
719719      break;
720720   }
721721}
src/mame/audio/irem.c
r1877r1878
3838WRITE8_HANDLER( irem_sound_cmd_w )
3939{
4040   if ((data & 0x80) == 0)
41      soundlatch_w(0, data & 0x7f);
41      soundlatch_w(machine, 0, data & 0x7f);
4242   else
43      cpunum_set_input_line(Machine, 1, 0, ASSERT_LINE);
43      cpunum_set_input_line(machine, 1, 0, ASSERT_LINE);
4444}
4545
4646
r1877r1878
5959
6060static WRITE8_HANDLER( m6803_port2_w )
6161{
62
6263   /* write latch */
6364   if ((port2 & 0x01) && !(data & 0x01))
6465   {
r1877r1878
6768      {
6869         /* PSG 0 or 1? */
6970         if (port2 & 0x08)
70            AY8910_control_port_0_w(0,port1);
71            AY8910_control_port_0_w(machine, 0, port1);
7172         if (port2 & 0x10)
72            AY8910_control_port_1_w(0,port1);
73            AY8910_control_port_1_w(machine, 0, port1);
7374      }
7475      else
7576      {
7677         /* PSG 0 or 1? */
7778         if (port2 & 0x08)
78            AY8910_write_port_0_w(0,port1);
79            AY8910_write_port_0_w(machine, 0, port1);
7980         if (port2 & 0x10)
80            AY8910_write_port_1_w(0,port1);
81            AY8910_write_port_1_w(machine, 0, port1);
8182      }
8283   }
8384   port2 = data;
r1877r1878
9596{
9697   /* PSG 0 or 1? */
9798   if (port2 & 0x08)
98      return AY8910_read_port_0_r(0);
99      return AY8910_read_port_0_r(machine, 0);
99100   if (port2 & 0x10)
100      return AY8910_read_port_1_r(0);
101      return AY8910_read_port_1_r(machine, 0);
101102   return 0xff;
102103}
103104
src/mame/audio/bsktball.c
r1877r1878
1212***************************************************************************/
1313WRITE8_HANDLER( bsktball_bounce_w )
1414{
15   discrete_sound_w(BSKTBALL_CROWD_DATA, data & 0x0f);   // Crowd
16   discrete_sound_w(BSKTBALL_BOUNCE_EN, data & 0x10);   // Bounce
15   discrete_sound_w(machine, BSKTBALL_CROWD_DATA, data & 0x0f);   // Crowd
16   discrete_sound_w(machine, BSKTBALL_BOUNCE_EN, data & 0x10);   // Bounce
1717}
1818
1919WRITE8_HANDLER( bsktball_note_w )
2020{
21   discrete_sound_w(BSKTBALL_NOTE_DATA, data);   // Note
21   discrete_sound_w(machine, BSKTBALL_NOTE_DATA, data);   // Note
2222}
2323
2424WRITE8_HANDLER( bsktball_noise_reset_w )
2525{
26   discrete_sound_w(BSKTBALL_NOISE_EN, offset & 0x01);
26   discrete_sound_w(machine, BSKTBALL_NOISE_EN, offset & 0x01);
2727}
2828
2929
src/mame/audio/leland.c
r1877r1878
12701270
12711271   /* handle partials */
12721272   if (!ACCESSING_MSB)
1273      data = (i80186_internal_port_r(offset, 0) & 0xff00) | (data & 0x00ff);
1273      data = (i80186_internal_port_r(machine, offset, 0) & 0xff00) | (data & 0x00ff);
12741274   else if (!ACCESSING_LSB)
1275      data = (i80186_internal_port_r(offset, 0) & 0x00ff) | (data & 0xff00);
1275      data = (i80186_internal_port_r(machine, offset, 0) & 0x00ff) | (data & 0xff00);
12761276
12771277   switch (offset)
12781278   {
r1877r1878
19311931      case 0x01:
19321932      case 0x02:
19331933         if (ACCESSING_LSB)
1934            dac_w(offset, data, 0xff00);
1934            dac_w(machine, offset, data, 0xff00);
19351935         return;
19361936
19371937      case 0x03:
1938         dac_w(0, ((data << 13) & 0xe000) | ((data << 10) & 0x1c00) | ((data << 7) & 0x0300), 0x00ff);
1939         dac_w(2, ((data << 10) & 0xe000) | ((data <<  7) & 0x1c00) | ((data << 4) & 0x0300), 0x00ff);
1940         dac_w(4, ((data <<  8) & 0xc000) | ((data <<  6) & 0x3000) | ((data << 4) & 0x0c00) | ((data << 2) & 0x0300), 0x00ff);
1938         dac_w(machine, 0, ((data << 13) & 0xe000) | ((data << 10) & 0x1c00) | ((data << 7) & 0x0300), 0x00ff);
1939         dac_w(machine, 2, ((data << 10) & 0xe000) | ((data <<  7) & 0x1c00) | ((data << 4) & 0x0300), 0x00ff);
1940         dac_w(machine, 4, ((data <<  8) & 0xc000) | ((data <<  6) & 0x3000) | ((data << 4) & 0x0c00) | ((data << 2) & 0x0300), 0x00ff);
19411941         return;
19421942   }
19431943
r1877r1878
19721972            return;
19731973
19741974         case 0x21:
1975            dac_w(offset - 0x21 + 7, data, mem_mask);
1975            dac_w(machine, offset - 0x21 + 7, data, mem_mask);
19761976            return;
19771977      }
19781978   }
r1877r1878
20072007            return ((clock_active << 1) & 0x7e);
20082008
20092009      case 1:
2010         return main_to_sound_comm_r(offset, mem_mask);
2010         return main_to_sound_comm_r(machine, offset, mem_mask);
20112011
20122012      case 2:
2013         return pit8254_r(offset, mem_mask);
2013         return pit8254_r(machine, offset, mem_mask);
20142014
20152015      case 3:
20162016         if (!has_ym2151)
2017            return pit8254_r(offset | 0x40, mem_mask);
2017            return pit8254_r(machine, offset | 0x40, mem_mask);
20182018         else
2019            return YM2151_status_port_0_lsb_r(offset, mem_mask);
2019            return YM2151_status_port_0_lsb_r(machine, offset, mem_mask);
20202020
20212021      case 4:
20222022         if (is_redline)
2023            return pit8254_r(offset | 0x80, mem_mask);
2023            return pit8254_r(machine, offset | 0x80, mem_mask);
20242024         else
20252025            logerror("%05X:Unexpected peripheral read %d/%02X\n", activecpu_get_pc(), select, offset*2);
20262026         break;
r1877r1878
20412041   switch (select)
20422042   {
20432043      case 1:
2044         sound_to_main_comm_w(offset, data, mem_mask);
2044         sound_to_main_comm_w(machine, offset, data, mem_mask);
20452045         break;
20462046
20472047      case 2:
2048         pit8254_w(offset, data, mem_mask);
2048         pit8254_w(machine, offset, data, mem_mask);
20492049         break;
20502050
20512051      case 3:
20522052         if (!has_ym2151)
2053            pit8254_w(offset | 0x40, data, mem_mask);
2053            pit8254_w(machine, offset | 0x40, data, mem_mask);
20542054         else if (offset == 0)
2055            YM2151_register_port_0_lsb_w(offset, data, mem_mask);
2055            YM2151_register_port_0_lsb_w(machine, offset, data, mem_mask);
20562056         else if (offset == 1)
2057            YM2151_data_port_0_lsb_w(offset, data, mem_mask);
2057            YM2151_data_port_0_lsb_w(machine, offset, data, mem_mask);
20582058         break;
20592059
20602060      case 4:
20612061         if (is_redline)
2062            pit8254_w(offset | 0x80, data, mem_mask);
2062            pit8254_w(machine, offset | 0x80, data, mem_mask);
20632063         else
2064            dac_10bit_w(offset, data, mem_mask);
2064            dac_10bit_w(machine, offset, data, mem_mask);
20652065         break;
20662066
20672067      case 5:   /* Ataxx/WSF/Indy Heat only */
2068         ataxx_dac_control(offset, data, mem_mask);
2068         ataxx_dac_control(machine, offset, data, mem_mask);
20692069         break;
20702070
20712071      default:
r1877r1878
20892089               ((data & 0x02) << 5) |
20902090               ((data & 0x04) << 3) |
20912091               ((data & 0x08) << 1);
2092   leland_80186_control_w(offset, modified);
2092   leland_80186_control_w(machine, offset, modified);
20932093}
20942094
20952095
src/mame/audio/carnival.c
r1877r1878
274274         break;
275275
276276      case PSG_BC_WRITE:
277         AY8910_write_port_0_w( 0, psgData );
277         AY8910_write_port_0_w( machine, 0, psgData );
278278         break;
279279
280280      case PSG_BC_LATCH_ADDRESS:
281         AY8910_control_port_0_w( 0, psgData );
281         AY8910_control_port_0_w( machine, 0, psgData );
282282         break;
283283      }
284284   }
src/mame/audio/poolshrk.c
r1877r1878
158158
159159WRITE8_HANDLER( poolshrk_scratch_sound_w )
160160{
161   discrete_sound_w(POOLSHRK_SCRATCH_SND, offset & 1);
161   discrete_sound_w(machine, POOLSHRK_SCRATCH_SND, offset & 1);
162162}
163163
164164WRITE8_HANDLER( poolshrk_score_sound_w )
165165{
166   discrete_sound_w(POOLSHRK_SCORE_EN, 1); /* this will trigger the sound code for 1 sample */
166   discrete_sound_w(machine, POOLSHRK_SCORE_EN, 1); /* this will trigger the sound code for 1 sample */
167167}
168168
169169WRITE8_HANDLER( poolshrk_click_sound_w )
170170{
171   discrete_sound_w(POOLSHRK_CLICK_EN, 1); /* this will trigger the sound code for 1 sample */
171   discrete_sound_w(machine, POOLSHRK_CLICK_EN, 1); /* this will trigger the sound code for 1 sample */
172172}
173173
174174WRITE8_HANDLER( poolshrk_bump_sound_w )
175175{
176   discrete_sound_w(POOLSHRK_BUMP_EN, offset & 1);
176   discrete_sound_w(machine, POOLSHRK_BUMP_EN, offset & 1);
177177}
src/mame/audio/dkong.c
r1877r1878
11#include "driver.h"
2#include "deprecat.h"
32#include "cpu/i8039/i8039.h"
43#include "cpu/m6502/m6502.h"
54#include "sound/nes_apu.h"
r1877r1878
3635
3736/* Needed for dkongjr ... FIXME */
3837//#define I8035_T_R(N) ((portT >> (N)) & 1)
39#define I8035_T_R(N) ((soundlatch2_r(0) >> (N)) & 1)
40#define I8035_T_W_AL(N,D) do { state->portT = ACTIVELOW_PORT_BIT(state->portT,N,D); soundlatch2_w(0, state->portT); } while (0)
38#define I8035_T_R(M,N) ((soundlatch2_r(machine,0) >> (N)) & 1)
39#define I8035_T_W_AL(M,N,D) do { state->portT = ACTIVELOW_PORT_BIT(state->portT,N,D); soundlatch2_w(machine, 0, state->portT); } while (0)
4140
42#define I8035_P1_R() (soundlatch3_r(0))
43#define I8035_P2_R() (soundlatch4_r(0))
44#define I8035_P1_W(D) soundlatch3_w(0,D)
45#define I8035_P2_W(D) soundlatch4_w(0,D)
41#define I8035_P1_R(M) (soundlatch3_r(M,0))
42#define I8035_P2_R(M) (soundlatch4_r(M,0))
43#define I8035_P1_W(M,D) soundlatch3_w(M,0,D)
44#define I8035_P2_W(M,D) soundlatch4_w(M,0,D)
4645
47#define I8035_P1_W_AL(B,D) I8035_P1_W(ACTIVELOW_PORT_BIT(I8035_P1_R(),B,(D)))
48#define I8035_P2_W_AL(B,D) I8035_P2_W(ACTIVELOW_PORT_BIT(I8035_P2_R(),B,(D)))
46#define I8035_P1_W_AL(M,B,D) I8035_P1_W(M,ACTIVELOW_PORT_BIT(I8035_P1_R(M),B,(D)))
47#define I8035_P2_W_AL(M,B,D) I8035_P2_W(M,ACTIVELOW_PORT_BIT(I8035_P2_R(M),B,(D)))
4948
5049
5150/****************************************************************
r1877r1878
331330   DISCRETE_INVERTER_OSC(NODE_51,1,0,DK_R47,DK_R48,DK_C30,0,&dkong_inverter_osc_desc_walk)
332331
333332   DISCRETE_TRANSFORM3(NODE_52,1,DS_SOUND0,DK_R46,R_SERIE(DK_R44,DK_R45),"01*2+")
334   DISCRETE_MIXER4(NODE_54, 1, NODE_50, NODE_51, DK_SUP_V, 0,&dkong_rc_jump_desc)
333   DISCRETE_MIXER4(NODE_54, 1, NODE_50, NODE_51, DK_SUP_V, 0,&dkong_rc_walk_desc)
335334
336335    /* 555 Voltage controlled */
337336    DISCRETE_555_ASTABLE_CV(NODE_55, 1, RES_K(47), RES_K(27), CAP_N(33), NODE_54, &dkong_555_vco_desc)
r1877r1878
499498 * For the walk circuit, the voltage does not matter */
500499
501500static const discrete_555_desc radarscp_555_vco_desc =
502   {DISC_555_OUT_DC | DISC_555_OUT_SQW,
501   {DISC_555_OUT_DC | DISC_555_OUT_ENERGY,
503502      DK_SUP_V,
504503      DK_SUP_V-0.5,DK_SUP_V*0.66,DK_SUP_V*0.33
505504   };
r1877r1878
589588   DISCRETE_MIXER3(NODE_42, 1, NODE_41, DK_SUP_V, 0,&radarscp_mixer_desc_0)
590589
591590    /* 555 Voltage controlled */
592    DISCRETE_555_ASTABLE_CV(NODE_43, DS_SOUND6, RES_K(47), RES_K(27), RS_C49, NODE_42, &dkong_555_vco_desc)
591    DISCRETE_555_ASTABLE_CV(NODE_43, DS_SOUND6, RES_K(47), RES_K(27), RS_C49, NODE_42, &radarscp_555_vco_desc)
593592
594593   DISCRETE_RCDISC_MODULATED(NODE_44,1,DS_SOUND0_INV,NODE_43,RS_R39,RS_R18,RS_R37,RS_R38,RS_C22,DK_SUP_V)
595594   DISCRETE_CRFILTER(NODE_45, 1, NODE_44, RS_R15+RS_R16, RS_C33)
r1877r1878
605604
606605   DISCRETE_MIXER3(NODE_53, 1, NODE_51, DK_SUP_V, 0,&radarscp_mixer_desc_7)
607606    /* 555 Voltage controlled */
608    DISCRETE_555_ASTABLE_CV(NODE_54, DS_SOUND7, RES_K(47), RES_K(27), RS_C48, NODE_53, &dkong_555_vco_desc)
607    DISCRETE_555_ASTABLE_CV(NODE_54, DS_SOUND7, RES_K(47), RES_K(27), RS_C48, NODE_53, &radarscp_555_vco_desc)
609608
610609    DISCRETE_RCINTEGRATE(NODE_55,1,NODE_52,RS_R46, RS_R46,0,RS_C45,DK_SUP_V,DISC_RC_INTEGRATE_TYPE1)
611610    DISCRETE_TRANSFORM4(NODE_56, 1, NODE_55, DS_SOUND7,NODE_54,2.5, "01*23<*")
r1877r1878
895894   state->page = 0x47;
896895   state->portT = 0;
897896
898   I8035_T_W_AL(0,0);
899   I8035_T_W_AL(1,0);
900   I8035_P1_W(0xFF);
901   I8035_P2_W(0xFF);
902   soundlatch_w(0,0x0F);
897   I8035_T_W_AL(machine,0,0);
898   I8035_T_W_AL(machine,1,0);
899   I8035_P1_W(machine,0xFF);
900   I8035_P2_W(machine,0xFF);
901   soundlatch_w(machine,0,0x0F);
903902}
904903
905904static SOUND_RESET( dkongjr )
906905{
907906   SOUND_RESET_CALL(dkong);
908   soundlatch_w(0,0x00);
907   soundlatch_w(machine,0,0x00);
909908}
910909
911910/****************************************************************
r1877r1878
10041003{
10051004   logerror("PA Write %x\n", data);
10061005
1007   tms5110_CTL_w(0, data & 0x0f);
1008   tms5110_PDC_w(0, (data>>4) & 0x01);
1006   tms5110_CTL_w(machine, 0, data & 0x0f);
1007   tms5110_PDC_w(machine, 0, (data>>4) & 0x01);
10091008   // FIXME 0x20 is CS
10101009}
10111010
r1877r1878
10171016
10181017static READ8_HANDLER( dkong_sh_p1_r )
10191018{
1020   return I8035_P1_R();
1019   return I8035_P1_R(machine);
10211020}
10221021
10231022static READ8_HANDLER( dkong_sh_p2_r )
10241023{
1025   return I8035_P2_R();
1024   return I8035_P2_R(machine);
10261025}
10271026
10281027static READ8_HANDLER( dkong_sh_t0_r )
10291028{
1030   return I8035_T_R(0);
1029   return I8035_T_R(machine,0);
10311030}
10321031
10331032static READ8_HANDLER( dkong_sh_t1_r )
10341033{
1035   return I8035_T_R(1);
1034   return I8035_T_R(machine,1);
10361035}
10371036
10381037static WRITE8_HANDLER( dkong_voice_w )
r1877r1878
10531052
10541053static READ8_HANDLER( dkong_sh_tune_r )
10551054{
1056   dkong_state *state = Machine->driver_data;
1055   dkong_state *state = machine->driver_data;
10571056   UINT8 *SND = memory_region(REGION_CPU2);
10581057
10591058   if ( state->page & 0x40 )
10601059   {
1061      return (soundlatch_r(0) & 0x0F) | (dkong_voice_status_r(0)<<4);
1060      return (soundlatch_r(machine,0) & 0x0F) | (dkong_voice_status_r(machine,0)<<4);
10621061   }
10631062   else
10641063   {
r1877r1878
10691068
10701069static READ8_HANDLER( dkongjr_sh_tune_r )
10711070{
1072   return soundlatch_r(0) & 0x01F;
1071   return soundlatch_r(machine,0) & 0x01F;
10731072}
10741073
10751074static WRITE8_HANDLER( dkong_sh_p1_w )
10761075{
1077   discrete_sound_w(DS_DAC,data);
1076   discrete_sound_w(machine,DS_DAC,data);
10781077}
10791078
10801079
r1877r1878
10821081{
10831082   int r;
10841083
1085   r = (I8035_P1_R() & 0x80) | (tms5110_status_r(0)<<6);
1084   r = (I8035_P1_R(machine) & 0x80) | (tms5110_status_r(machine,0)<<6);
10861085   return r;
10871086}
10881087
10891088static WRITE8_HANDLER( dkong_sh_p2_w )
10901089{
1091   dkong_state *state = Machine->driver_data;
1090   dkong_state *state = machine->driver_data;
10921091
10931092   /*   If P2.Bit7 -> is apparently an external signal decay or other output control
10941093     *   If P2.Bit6 -> activates the external compressed sample ROM (not radarsc1)
r1877r1878
10981097     */
10991098
11001099   state->mcustatus = ((~data & 0x10) >> 4);
1101   radarsc1_ansn_w(0, (data & 0x20) >> 5);
1100   radarsc1_ansn_w(machine, 0, (data & 0x20) >> 5);
11021101   state->page = (data & 0x47);
11031102
1104   discrete_sound_w(DS_DAC_DISCHARGE, (data & 0x80) ? 0 : 1 );
1103   discrete_sound_w(machine,DS_DAC_DISCHARGE, (data & 0x80) ? 0 : 1 );
11051104}
11061105
11071106
r1877r1878
11131112
11141113WRITE8_HANDLER( dkongjr_sh_test6_w )
11151114{
1116   I8035_P2_W_AL(6,data & 1);
1115   I8035_P2_W_AL(machine,6,data & 1);
11171116}
11181117
11191118
11201119WRITE8_HANDLER( dkongjr_sh_tuneselect_w )
11211120{
1122   soundlatch_w(offset,data);
1121   soundlatch_w(machine,offset,data);
11231122}
11241123
11251124READ8_HANDLER( dkong_audio_status_r )
11261125{
1127   dkong_state *state = Machine->driver_data;
1126   dkong_state *state = machine->driver_data;
11281127
11291128   return state->mcustatus;
11301129}
r1877r1878
11321131WRITE8_HANDLER( dkong_audio_irq_w )
11331132{
11341133   if (data)
1135      cpunum_set_input_line(Machine, 1, 0, ASSERT_LINE);
1134      cpunum_set_input_line(machine, 1, 0, ASSERT_LINE);
11361135   else
1137      cpunum_set_input_line(Machine, 1, 0, CLEAR_LINE);
1136      cpunum_set_input_line(machine, 1, 0, CLEAR_LINE);
11381137}
11391138
11401139WRITE8_HANDLER( dkong_snd_disc_w )
11411140{
1142   dkong_state *state = Machine->driver_data;
1141   dkong_state *state = machine->driver_data;
11431142
11441143   switch (offset)
11451144   {
11461145      case 0:
1147         discrete_sound_w(DS_SOUND0_INP,data & 1);
1146         discrete_sound_w(machine,DS_SOUND0_INP,data & 1);
11481147         break;
11491148      case 1:
1150         discrete_sound_w(DS_SOUND1_INP,data & 1);
1149         discrete_sound_w(machine,DS_SOUND1_INP,data & 1);
11511150         break;
11521151      case 2:
1153         discrete_sound_w(DS_SOUND2_INP,data & 1);
1154         radarscp_snd02_w(0, data & 1);
1152         discrete_sound_w(machine,DS_SOUND2_INP,data & 1);
1153         radarscp_snd02_w(machine, 0, data & 1);
11551154         break;
11561155      case 3:
11571156         if (state->hardware_type == HARDWARE_TRS01)
11581157            //SOUND3 ==> PA7
1159            I8035_P1_W_AL(7,data & 1);
1158            I8035_P1_W_AL(machine,7,data & 1);
11601159         else
1161            I8035_P2_W_AL(5,data & 1);
1160            I8035_P2_W_AL(machine,5,data & 1);
11621161         break;
11631162      case 4:
1164         I8035_T_W_AL(1, data & 1);
1163         I8035_T_W_AL(machine, 1, data & 1);
11651164         break;
11661165      case 5:
1167         I8035_T_W_AL(0, data & 1);
1166         I8035_T_W_AL(machine, 0, data & 1);
11681167         break;
11691168      case 6:
1170         discrete_sound_w(DS_SOUND6_INP,data & 1);
1169         discrete_sound_w(machine,DS_SOUND6_INP,data & 1);
11711170         break;
11721171      case 7:
1173         discrete_sound_w(DS_SOUND7_INP,data & 1);
1172         discrete_sound_w(machine,DS_SOUND7_INP,data & 1);
11741173         break;
11751174    }
11761175   return;
r1877r1878
11781177
11791178WRITE8_HANDLER( dkong_sh_tuneselect_w )
11801179{
1181   soundlatch_w(offset,data ^ 0x0f);
1180   soundlatch_w(machine,offset,data ^ 0x0f);
11821181}
11831182
11841183WRITE8_HANDLER( dkongjr_snd_w1 )
11851184{
1186   dkong_state *state = Machine->driver_data;
1185   dkong_state *state = machine->driver_data;
11871186
11881187   switch (offset)
11891188   {
11901189      case 0:         /* climb */
1191         discrete_sound_w(DS_SOUND0_INP,data & 1);
1190         discrete_sound_w(machine,DS_SOUND0_INP,data & 1);
11921191         break;
11931192      case 1:         /* jump */
1194         discrete_sound_w(DS_SOUND1_INP,data & 1);
1193         discrete_sound_w(machine,DS_SOUND1_INP,data & 1);
11951194         break;
11961195      case 2:         /* land */
1197         discrete_sound_w(DS_SOUND2_INP,data & 1);
1196         discrete_sound_w(machine,DS_SOUND2_INP,data & 1);
11981197         break;
11991198      case 3: /* Port 3 write ==> PB 5 */
1200         I8035_P2_W_AL(5,data & 1);
1199         I8035_P2_W_AL(machine,5,data & 1);
12011200         break;
12021201      case 4:         /* Port 4 write */
1203         I8035_T_W_AL(1, data & 1);
1202         I8035_T_W_AL(machine,1, data & 1);
12041203         break;
12051204      case 5:         /* Port 5 write */
1206         I8035_T_W_AL(0, data & 1);
1205         I8035_T_W_AL(machine,0, data & 1);
12071206         break;
12081207      case 6:         /* Port 6 write ==> PB 4 */
1209         I8035_P2_W_AL(4,data & 1);
1208         I8035_P2_W_AL(machine,4,data & 1);
12101209         break;
12111210      case 7:         /* walk */
1212         discrete_sound_w(DS_SOUND7_INP,data & 1);
1211         discrete_sound_w(machine,DS_SOUND7_INP,data & 1);
12131212         break;
12141213   }
12151214}
r1877r1878
12191218   switch (offset)
12201219   {
12211220   case 0:         /* S9 - drop */
1222      discrete_sound_w(DS_SOUND9_INP,data & 1);
1221      discrete_sound_w(machine,DS_SOUND9_INP,data & 1);
12231222      break;
12241223   }
12251224}
r1877r1878
13581357
13591358   MDRV_CPU_ADD_TAG("n2a03a", N2A03,N2A03_DEFAULTCLOCK)
13601359   MDRV_CPU_PROGRAM_MAP(dkong3_sound1_map, 0)
1361   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
1360   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
13621361
13631362   MDRV_CPU_ADD_TAG("n2a03b", N2A03,N2A03_DEFAULTCLOCK)
13641363   MDRV_CPU_PROGRAM_MAP(dkong3_sound2_map, 0)
1365   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
1364   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
13661365
13671366   MDRV_SPEAKER_STANDARD_MONO("mono")
13681367   MDRV_SOUND_ADD(NES, N2A03_DEFAULTCLOCK)
src/mame/audio/blockade.c
r1877r1878
3636
3737WRITE8_HANDLER( blockade_sound_freq_w )
3838{
39   discrete_sound_w(BLOCKADE_NOTE_DATA, data);
39   discrete_sound_w(machine,BLOCKADE_NOTE_DATA, data);
4040    return;
4141}
4242
src/mame/audio/m72.c
r1877r1878
125125{
126126   if (ACCESSING_LSB)
127127   {
128      soundlatch_w(offset,data);
128      soundlatch_w(machine,offset,data);
129129      timer_call_after_resynch(NULL, Z80_ASSERT,setvector_callback);
130130   }
131131}
132132
133133WRITE8_HANDLER( m72_sound_command_byte_w )
134134{
135   soundlatch_w(offset,data);
135   soundlatch_w(machine,offset,data);
136136   timer_call_after_resynch(NULL, Z80_ASSERT,setvector_callback);
137137}
138138
src/mame/audio/firetrk.c
r1877r1878
1111
1212WRITE8_HANDLER( firetrk_skid_reset_w )
1313{
14   if (GAME_IS_FIRETRUCK || GAME_IS_SUPERBUG)
15   {
16      firetrk_skid[0] = 0;
17      firetrk_skid[1] = 0;
18   }
14   firetrk_skid[0] = 0;
15   firetrk_skid[1] = 0;
1916
20   // also SUPERBUG_SKID_EN and MONTECAR_SKID_EN
21   discrete_sound_w(FIRETRUCK_SKID_EN, 1);
17   // also SUPERBUG_SKID_EN
18   discrete_sound_w(machine, FIRETRUCK_SKID_EN, 1);
2219}
2320
2421
22WRITE8_HANDLER( montecar_skid_reset_w )
23{
24   discrete_sound_w(machine, MONTECAR_SKID_EN, 1);
25}
26
27
2528WRITE8_HANDLER( firetrk_crash_snd_w )
2629{
2730   // also SUPERBUG_CRASH_DATA and MONTECAR_CRASH_DATA
28   discrete_sound_w(FIRETRUCK_CRASH_DATA, data >> 4);
31   discrete_sound_w(machine, FIRETRUCK_CRASH_DATA, data >> 4);
2932}
3033
3134
3235WRITE8_HANDLER( firetrk_skid_snd_w )
3336{
3437   // also SUPERBUG_SKID_EN and MONTECAR_SKID_EN
35   discrete_sound_w(FIRETRUCK_SKID_EN, 0);
38   discrete_sound_w(machine, FIRETRUCK_SKID_EN, 0);
3639}
3740
3841
3942WRITE8_HANDLER( firetrk_motor_snd_w )
4043{
41   if (GAME_IS_FIRETRUCK || GAME_IS_MONTECARLO)
42   {
43      // also MONTECAR_DRONE_MOTOR_DATA
44      discrete_sound_w(FIRETRUCK_SIREN_DATA, data >> 4);
45   }
44   // also MONTECAR_DRONE_MOTOR_DATA
45   discrete_sound_w(machine, FIRETRUCK_SIREN_DATA, data >> 4);
4646
47      // also SUPERBUG_SPEED_DATA and MONTECAR_MOTOR_DATA
48      discrete_sound_w(FIRETRUCK_MOTOR_DATA, data & 0x0f);
47   // also MONTECAR_MOTOR_DATA
48   discrete_sound_w(machine, FIRETRUCK_MOTOR_DATA, data & 0x0f);
4949}
5050
5151
52WRITE8_HANDLER( firetrk_xtndply_w )
52WRITE8_HANDLER( superbug_motor_snd_w )
5353{
54   discrete_sound_w(FIRETRUCK_XTNDPLY_EN, data);
54   discrete_sound_w(machine, SUPERBUG_SPEED_DATA, data & 0x0f);
5555}
5656
5757
58WRITE8_HANDLER( firetrk_asr_w )
58WRITE8_HANDLER( firetrk_xtndply_w )
5959{
60   if (GAME_IS_SUPERBUG)
61   {
62      discrete_sound_w(SUPERBUG_ASR_EN, 1);   /* ASR */
63   }
60   discrete_sound_w(machine, FIRETRUCK_XTNDPLY_EN, data);
6461}
6562
6663
67WRITE8_HANDLER( firetrk_out2_w )
64WRITE8_HANDLER( superbug_asr_w )
6865{
69   firetrk_set_flash(data & 0x80);
70
71   if (GAME_IS_MONTECARLO)
72   {
73      discrete_sound_w(MONTECAR_BEEPER_EN, data & 0x10);   /* Beep */
74      discrete_sound_w(MONTECAR_DRONE_LOUD_DATA, data & 0x0f);   /* Drone Motor Volume */
75   }
66popmessage("ASR");
67      discrete_sound_w(machine, SUPERBUG_ASR_EN, 1);   /* ASR */
7668}
7769
7870
src/mame/audio/seibu.c
r1877r1878
459459
460460READ8_HANDLER( seibu_main_v30_r )
461461{
462   return seibu_main_word_r(offset/2,0) >> (8 * (offset & 1));
462   return seibu_main_word_r(machine,offset/2,0) >> (8 * (offset & 1));
463463}
464464
465465WRITE8_HANDLER( seibu_main_v30_w )
466466{
467   seibu_main_word_w(offset/2,data << (8 * (offset & 1)),0xff00 >> (8 * (offset & 1)));
467   seibu_main_word_w(machine,offset/2,data << (8 * (offset & 1)),0xff00 >> (8 * (offset & 1)));
468468}
469469
470470WRITE16_HANDLER( seibu_main_mustb_w )
src/mame/audio/orbit.c
r1877r1878
1515
1616WRITE8_HANDLER( orbit_note_w )
1717{
18   discrete_sound_w(ORBIT_NOTE_FREQ, (~data) & 0xff);
18   discrete_sound_w(machine, ORBIT_NOTE_FREQ, (~data) & 0xff);
1919}
2020
2121WRITE8_HANDLER( orbit_note_amp_w )
2222{
23   discrete_sound_w(ORBIT_ANOTE1_AMP, data & 0x0f);
24   discrete_sound_w(ORBIT_ANOTE2_AMP, data >> 4);
23   discrete_sound_w(machine, ORBIT_ANOTE1_AMP, data & 0x0f);
24   discrete_sound_w(machine, ORBIT_ANOTE2_AMP, data >> 4);
2525}
2626
2727WRITE8_HANDLER( orbit_noise_amp_w )
2828{
29   discrete_sound_w(ORBIT_NOISE1_AMP, data & 0x0f);
30   discrete_sound_w(ORBIT_NOISE2_AMP, data >> 4);
29   discrete_sound_w(machine, ORBIT_NOISE1_AMP, data & 0x0f);
30   discrete_sound_w(machine, ORBIT_NOISE2_AMP, data >> 4);
3131}
3232
3333WRITE8_HANDLER( orbit_noise_rst_w )
3434{
35   discrete_sound_w(ORBIT_NOISE_EN, 0);
35   discrete_sound_w(machine, ORBIT_NOISE_EN, 0);
3636}
3737
3838
src/mame/audio/williams.c
r1877r1878
487487   /* going high halts the CPU */
488488   if (state)
489489   {
490      cvsd_bank_select_w(0, 0);
490      cvsd_bank_select_w(Machine, 0, 0);
491491      init_audio_state(Machine);
492492      cpunum_set_input_line(Machine, sound_cpunum, INPUT_LINE_RESET, ASSERT_LINE);
493493   }
r1877r1878
516516
517517static READ8_HANDLER( narc_command_r )
518518{
519   cpunum_set_input_line(Machine, sound_cpunum, M6809_IRQ_LINE, CLEAR_LINE);
519   cpunum_set_input_line(machine, sound_cpunum, M6809_IRQ_LINE, CLEAR_LINE);
520520   williams_sound_int_state = 0;
521   return soundlatch_r(0);
521   return soundlatch_r(machine, 0);
522522}
523523
524524
525525static WRITE8_HANDLER( narc_command2_w )
526526{
527   soundlatch2_w(0, data & 0xff);
528   cpunum_set_input_line(Machine, soundalt_cpunum, M6809_FIRQ_LINE, ASSERT_LINE);
527   soundlatch2_w(machine, 0, data & 0xff);
528   cpunum_set_input_line(machine, soundalt_cpunum, M6809_FIRQ_LINE, ASSERT_LINE);
529529}
530530
531531
532532static READ8_HANDLER( narc_command2_r )
533533{
534   cpunum_set_input_line(Machine, soundalt_cpunum, M6809_FIRQ_LINE, CLEAR_LINE);
535   return soundlatch2_r(0);
534   cpunum_set_input_line(machine, soundalt_cpunum, M6809_FIRQ_LINE, CLEAR_LINE);
535   return soundlatch2_r(machine, 0);
536536}
537537
538538
r1877r1878
577577
578578void williams_narc_data_w(int data)
579579{
580   soundlatch_w(0, data & 0xff);
580   soundlatch_w(Machine, 0, data & 0xff);
581581   cpunum_set_input_line(Machine, sound_cpunum, INPUT_LINE_NMI, (data & 0x100) ? CLEAR_LINE : ASSERT_LINE);
582582   if (!(data & 0x200))
583583   {
r1877r1878
592592   /* going high halts the CPU */
593593   if (state)
594594   {
595      narc_master_bank_select_w(0, 0);
596      narc_slave_bank_select_w(0, 0);
595      narc_master_bank_select_w(Machine, 0, 0);
596      narc_slave_bank_select_w(Machine, 0, 0);
597597      init_audio_state(Machine);
598598      cpunum_set_input_line(Machine, sound_cpunum, INPUT_LINE_RESET, ASSERT_LINE);
599599      cpunum_set_input_line(Machine, soundalt_cpunum, INPUT_LINE_RESET, ASSERT_LINE);
r1877r1878
638638
639639static READ8_HANDLER( adpcm_command_r )
640640{
641   cpunum_set_input_line(Machine, sound_cpunum, M6809_IRQ_LINE, CLEAR_LINE);
641   cpunum_set_input_line(machine, sound_cpunum, M6809_IRQ_LINE, CLEAR_LINE);
642642
643643   /* don't clear the external IRQ state for a short while; this allows the
644644       self-tests to pass */
645645   timer_set(ATTOTIME_IN_USEC(10), NULL, 0, clear_irq_state);
646   return soundlatch_r(0);
646   return soundlatch_r(machine, 0);
647647}
648648
649649
r1877r1878
661661
662662void williams_adpcm_data_w(int data)
663663{
664   soundlatch_w(0, data & 0xff);
664   soundlatch_w(Machine, 0, data & 0xff);
665665   if (!(data & 0x200))
666666   {
667667      cpunum_set_input_line(Machine, sound_cpunum, M6809_IRQ_LINE, ASSERT_LINE);
r1877r1878
676676   /* going high halts the CPU */
677677   if (state)
678678   {
679      adpcm_bank_select_w(0, 0);
679      adpcm_bank_select_w(Machine, 0, 0);
680680      init_audio_state(Machine);
681681      cpunum_set_input_line(Machine, sound_cpunum, INPUT_LINE_RESET, ASSERT_LINE);
682682   }
src/mame/audio/namcoc7x.h
r1877r1878
3737   MDRV_CPU_ADD_TAG("mcu", M37702, clock)   \
3838   MDRV_CPU_PROGRAM_MAP(namcoc7x_mcu_map, 0)   \
3939   MDRV_CPU_IO_MAP(namcoc7x_mcu_io, 0)   \
40   MDRV_CPU_VBLANK_INT(namcoc7x_interrupt, 2)
40   MDRV_CPU_VBLANK_INT_HACK(namcoc7x_interrupt, 2)
4141
4242#define NAMCO_C7X_MCU_SHARED(clock)   \
4343   MDRV_CPU_ADD_TAG("mcu", M37702, clock)   \
4444   MDRV_CPU_PROGRAM_MAP(namcoc7x_mcu_share_map, 0)   \
4545   MDRV_CPU_IO_MAP(namcoc7x_mcu_io, 0)   \
46   MDRV_CPU_VBLANK_INT(namcoc7x_interrupt, 2)
46   MDRV_CPU_VBLANK_INT_HACK(namcoc7x_interrupt, 2)
4747
4848#define NAMCO_C7X_SOUND(clock)   \
4949   MDRV_SPEAKER_STANDARD_STEREO("left", "right")   \
src/mame/audio/scramble.c
r1877r1878
157157
158158WRITE8_HANDLER( hotshock_sh_irqtrigger_w )
159159{
160   cpunum_set_input_line(Machine, 1, 0, ASSERT_LINE);
160   cpunum_set_input_line(machine, 1, 0, ASSERT_LINE);
161161}
162162
163163READ8_HANDLER( hotshock_soundlatch_r )
164164{
165   cpunum_set_input_line(Machine, 1, 0, CLEAR_LINE);
166   return soundlatch_r(0);
165   cpunum_set_input_line(machine, 1, 0, CLEAR_LINE);
166   return soundlatch_r(machine,0);
167167}
168168
169169static void filter_w(int chip, int channel, int data)
r1877r1878
323323   if (ctrl & 0x40)
324324      speech_rom_address = 0;
325325
326   tms5110_CTL_w(0, ctrl & 0x04 ? TMS5110_CMD_SPEAK : TMS5110_CMD_RESET);
327   tms5110_PDC_w(0, ctrl & 0x02 ? 0 : 1);
326   tms5110_CTL_w(machine, 0, ctrl & 0x04 ? TMS5110_CMD_SPEAK : TMS5110_CMD_RESET);
327   tms5110_PDC_w(machine, 0, ctrl & 0x02 ? 0 : 1);
328328
329329   if (!(ctrl & 0x80))
330330      timer_set(ATTOTIME_IN_HZ(AD2083_TMS5110_CLOCK / 2),NULL,1,ad2083_step);
src/mame/audio/redalert.c
r1877r1878
7777WRITE8_HANDLER( redalert_audio_command_w )
7878{
7979   /* the byte is connected to port A of the AY8910 */
80   soundlatch_w(0, data);
80   soundlatch_w(machine, 0, data);
8181
8282   /* D7 is also connected to the NMI input of the CPU -
8383       the NMI is actually toggled by a 74121 */
8484   if ((data & 0x80) == 0x00)
85      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
85      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
8686}
8787
8888
r1877r1878
9797
9898      /* BC1=1, BDIR=0 : read from PSG */
9999      case 0x01:
100         ay8910_latch_1 = AY8910_read_port_0_r(0);
100         ay8910_latch_1 = AY8910_read_port_0_r(machine, 0);
101101         break;
102102
103103      /* BC1=0, BDIR=1 : write to PSG */
104104      case 0x02:
105         AY8910_write_port_0_w(0, ay8910_latch_2);
105         AY8910_write_port_0_w(machine, 0, ay8910_latch_2);
106106         break;
107107
108108      /* BC1=1, BDIR=1 : latch address */
109109      default:
110110      case 0x03:
111         AY8910_control_port_0_w(0, ay8910_latch_2);
111         AY8910_control_port_0_w(machine, 0, ay8910_latch_2);
112112         break;
113113   }
114114}
r1877r1878
159159
160160WRITE8_HANDLER( redalert_voice_command_w )
161161{
162   soundlatch2_w(0, (data & 0x78) >> 3);
163
164   cpunum_set_input_line(Machine, 2, I8085_RST75_LINE, (~data & 0x80) ? ASSERT_LINE : CLEAR_LINE);
162   soundlatch2_w(machine, 0, (data & 0x78) >> 3);
163   cpunum_set_input_line(machine, 2, I8085_RST75_LINE, (~data & 0x80) ? ASSERT_LINE : CLEAR_LINE);
165164}
166165
167166
r1877r1878
248247WRITE8_HANDLER( demoneye_audio_command_w )
249248{
250249   /* the byte is connected to port A of the AY8910 */
251   soundlatch_w(0, data);
252
253   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
250   soundlatch_w(machine, 0, data);
251   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
254252}
255253
256254
r1877r1878
272270   {
273271      case 0x00:
274272         if (ay8910_latch_1 & 0x10)
275            AY8910_write_port_0_w(0, data);
273            AY8910_write_port_0_w(machine, 0, data);
276274
277275         if (ay8910_latch_1 & 0x20)
278            AY8910_write_port_1_w(0, data);
276            AY8910_write_port_1_w(machine, 0, data);
279277
280278         break;
281279
282280      case 0x01:
283281         if (ay8910_latch_1 & 0x10)
284            ay8910_latch_2 = AY8910_read_port_0_r(0);
282            ay8910_latch_2 = AY8910_read_port_0_r(machine, 0);
285283
286284         if (ay8910_latch_1 & 0x20)
287            ay8910_latch_2 = AY8910_read_port_1_r(0);
285            ay8910_latch_2 = AY8910_read_port_1_r(machine, 0);
288286
289287         break;
290288
291289      case 0x03:
292290         if (ay8910_latch_1 & 0x10)
293            AY8910_control_port_0_w(0, data);
291            AY8910_control_port_0_w(machine, 0, data);
294292
295293         if (ay8910_latch_1 & 0x20)
296            AY8910_control_port_1_w(0, data);
294            AY8910_control_port_1_w(machine, 0, data);
297295
298296         break;
299297
src/mame/audio/starwars.c
r1877r1878
9797         return 0;
9898   }
9999
100   return 0; /* will never execute this */
101100}
102101
103102
r1877r1878
120119         {
121120            port_A = (port_A&(~port_A_ddr))|(data&port_A_ddr);
122121            if ((port_A&0x01)==0)
123               tms5220_data_w(0,port_B);
122               tms5220_data_w(machine,0,port_B);
124123         }
125124         else
126125            port_A = (port_A&(~port_A_ddr))|(data&port_A_ddr);
r1877r1878
166165         return;
167166   }
168167
169   return; /* will never execute this */
170
171168}
172169
173170
src/mame/audio/mario.c
r1877r1878
11#include "driver.h"
2#include "deprecat.h"
32#include "cpu/i8039/i8039.h"
43#include "sound/dac.h"
54#include "sound/ay8910.h"
r1877r1878
1817#define ACTIVELOW_PORT_BIT(P,A,D)   ((P & (~(1 << A))) | ((D ^ 1) << A))
1918#define ACTIVEHIGH_PORT_BIT(P,A,D)   ((P & (~(1 << A))) | (D << A))
2019
21#define I8035_T_R(N) ((soundlatch2_r(0) >> (N)) & 1)
22#define I8035_T_W_AH(N,D) do { state->portT = ACTIVEHIGH_PORT_BIT(state->portT,N,D); soundlatch2_w(0, state->portT); } while (0)
20#define I8035_T_R(M,N) ((soundlatch2_r(M,0) >> (N)) & 1)
21#define I8035_T_W_AH(M,N,D) do { state->portT = ACTIVEHIGH_PORT_BIT(state->portT,N,D); soundlatch2_w(M, 0, state->portT); } while (0)
2322
24#define I8035_P1_R() (soundlatch3_r(0))
25#define I8035_P2_R() (soundlatch4_r(0))
26#define I8035_P1_W(D) soundlatch3_w(0,D)
27#define I8035_P2_W(D) soundlatch4_w(0,D)
23#define I8035_P1_R(M) (soundlatch3_r(M,0))
24#define I8035_P2_R(M) (soundlatch4_r(M,0))
25#define I8035_P1_W(M,D) soundlatch3_w(M,0,D)
26#define I8035_P2_W(M,D) soundlatch4_w(M,0,D)
2827
29#define I8035_P1_W_AH(B,D) I8035_P1_W(ACTIVEHIGH_PORT_BIT(I8035_P1_R(),B,(D)))
30#define I8035_P2_W_AH(B,D) I8035_P2_W(ACTIVEHIGH_PORT_BIT(I8035_P2_R(),B,(D)))
28#define I8035_P1_W_AH(M,B,D) I8035_P1_W(M,ACTIVEHIGH_PORT_BIT(I8035_P1_R(M),B,(D)))
29#define I8035_P2_W_AH(M,B,D) I8035_P2_W(M,ACTIVEHIGH_PORT_BIT(I8035_P2_R(M),B,(D)))
3130
3231/****************************************************************
3332 *
r1877r1878
251250{
252251   mario_state   *state = machine->driver_data;
253252
254   soundlatch_clear_w(0,0);
255   soundlatch2_clear_w(0,0);
256   soundlatch3_clear_w(0,0);
257   soundlatch4_clear_w(0,0);
258   I8035_P1_W(0x00); /* Input port */
259   I8035_P2_W(0xff); /* Port is in high impedance state after reset */
253   soundlatch_clear_w(machine,0,0);
254   soundlatch2_clear_w(machine,0,0);
255   soundlatch3_clear_w(machine,0,0);
256   soundlatch4_clear_w(machine,0,0);
257   I8035_P1_W(machine,0x00); /* Input port */
258   I8035_P2_W(machine,0xff); /* Port is in high impedance state after reset */
260259
261260   state->last = 0;
262261}
r1877r1878
269268
270269static READ8_HANDLER( mario_sh_p1_r )
271270{
272   return I8035_P1_R();
271   return I8035_P1_R(machine);
273272}
274273
275274static READ8_HANDLER( mario_sh_p2_r )
276275{
277   return I8035_P2_R() & 0xEF; /* Bit 4 connected to GND! */
276   return I8035_P2_R(machine) & 0xEF; /* Bit 4 connected to GND! */
278277}
279278
280279static READ8_HANDLER( mario_sh_t0_r )
281280{
282   return I8035_T_R(0);
281   return I8035_T_R(machine,0);
283282}
284283
285284static READ8_HANDLER( mario_sh_t1_r )
286285{
287   return I8035_T_R(1);
286   return I8035_T_R(machine,1);
288287}
289288
290289static READ8_HANDLER( mario_sh_ea_r )
r1877r1878
292291#if USE_8039
293292   return 1;
294293#else
295   int p2 = (I8035_P2_R() >> 5) & 1;
294   int p2 = (I8035_P2_R(machine) >> 5) & 1;
296295   return p2 ^ 1;
297296#endif
298297}
r1877r1878
301300{
302301   UINT8 *SND = memory_region(REGION_CPU2);
303302   UINT16 mask = memory_region_length(REGION_CPU2)-1;
304   UINT8 p2 = I8035_P2_R();
303   UINT8 p2 = I8035_P2_R(machine);
305304
306305   if ((p2 >> 7) & 1)
307      return soundlatch_r(offset);
306      return soundlatch_r(machine,offset);
308307   else
309308      return (SND[(0x1000 + (p2 & 0x0f)*256+offset) & mask]);
310309}
311310
312311static WRITE8_HANDLER( mario_sh_sound_w )
313312{
314   discrete_sound_w(DS_DAC,data);
313   discrete_sound_w(machine,DS_DAC,data);
315314}
316315
317316static WRITE8_HANDLER( mario_sh_p1_w )
318317{
319   I8035_P1_W(data);
318   I8035_P1_W(machine,data);
320319}
321320
322321static WRITE8_HANDLER( mario_sh_p2_w )
323322{
324   I8035_P2_W(data);
323   I8035_P2_W(machine,data);
325324}
326325
327326/****************************************************************
r1877r1878
332331
333332WRITE8_HANDLER( masao_sh_irqtrigger_w )
334333{
335   mario_state   *state = Machine->driver_data;
334   mario_state   *state = machine->driver_data;
336335
337336   if (state->last == 1 && data == 0)
338337   {
339338      /* setting bit 0 high then low triggers IRQ on the sound CPU */
340      cpunum_set_input_line_and_vector(Machine, 1,0,HOLD_LINE,0xff);
339      cpunum_set_input_line_and_vector(machine, 1,0,HOLD_LINE,0xff);
341340   }
342341
343342   state->last = data;
r1877r1878
345344
346345WRITE8_HANDLER( mario_sh_tuneselect_w )
347346{
348   soundlatch_w(offset,data);
347   soundlatch_w(machine,offset,data);
349348}
350349
351350/* Mario running sample */
352351WRITE8_HANDLER( mario_sh1_w )
353352{
354   discrete_sound_w(DS_SOUND0_INP,data & 1);
353   discrete_sound_w(machine,DS_SOUND0_INP,data & 1);
355354}
356355
357356/* Luigi running sample */
358357WRITE8_HANDLER( mario_sh2_w )
359358{
360   discrete_sound_w(DS_SOUND1_INP,data & 1);
359   discrete_sound_w(machine,DS_SOUND1_INP,data & 1);
361360}
362361
363362/* Misc samples */
364363WRITE8_HANDLER( mario_sh3_w )
365364{
366   mario_state   *state = Machine->driver_data;
365   mario_state   *state = machine->driver_data;
367366
368367   switch (offset)
369368   {
370369      case 0: /* death */
371370         if (data)
372            cpunum_set_input_line(Machine, 1,0,ASSERT_LINE);
371            cpunum_set_input_line(machine, 1,0,ASSERT_LINE);
373372         else
374            cpunum_set_input_line(Machine, 1,0,CLEAR_LINE);
373            cpunum_set_input_line(machine, 1,0,CLEAR_LINE);
375374         break;
376375      case 1: /* get coin */
377         I8035_T_W_AH(0,data & 1);
376         I8035_T_W_AH(machine,0,data & 1);
378377         break;
379378      case 2: /* ice */
380         I8035_T_W_AH(1,data & 1);
379         I8035_T_W_AH(machine,1,data & 1);
381380         break;
382381      case 3: /* crab */
383         I8035_P1_W_AH(0,data & 1);
382         I8035_P1_W_AH(machine,0,data & 1);
384383         break;
385384      case 4: /* turtle */
386         I8035_P1_W_AH(1,data & 1);
385         I8035_P1_W_AH(machine,1,data & 1);
387386         break;
388387      case 5: /* fly */
389         I8035_P1_W_AH(2,data & 1);
388         I8035_P1_W_AH(machine,2,data & 1);
390389         break;
391390      case 6: /* coin */
392         I8035_P1_W_AH(3,data & 1);
391         I8035_P1_W_AH(machine,3,data & 1);
393392         break;
394393      case 7: /* skid */
395         discrete_sound_w(DS_SOUND7_INP,data & 1);
394         discrete_sound_w(machine,DS_SOUND7_INP,data & 1);
396395         break;
397396   }
398397}
src/mame/audio/gottlieb.c
r1877r1878
7676         }
7777      }
7878
79      soundlatch_w(offset,data);
79      soundlatch_w(machine,offset,data);
8080
8181      switch (cpu_gettotalcpu())
8282      {
8383      case 2:
8484         /* Revision 1 sound board */
85         cpunum_set_input_line(Machine, 1,M6502_IRQ_LINE,HOLD_LINE);
85         cpunum_set_input_line(machine, 1,M6502_IRQ_LINE,HOLD_LINE);
8686         break;
8787      case 3:
8888      case 4:
8989         /* Revision 2 & 3 sound board */
90         cpunum_set_input_line(Machine, cpu_gettotalcpu()-1,M6502_IRQ_LINE,HOLD_LINE);
91         cpunum_set_input_line(Machine, cpu_gettotalcpu()-2,M6502_IRQ_LINE,HOLD_LINE);
90         cpunum_set_input_line(machine, cpu_gettotalcpu()-1,M6502_IRQ_LINE,HOLD_LINE);
91         cpunum_set_input_line(machine, cpu_gettotalcpu()-2,M6502_IRQ_LINE,HOLD_LINE);
9292         break;
9393      }
9494   }
r1877r1878
175175{
176176    switch (offset) {
177177   case 0: /* port A */
178      return soundlatch_r(0) ^ 0xff;   /* invert command */
178      return soundlatch_r(machine,0) ^ 0xff;   /* invert command */
179179   case 2: /* port B */
180180      return 0x40;    /* say that PB6 is 1 (test SW1 not pressed) */
181181   case 5: /* interrupt register */
r1877r1878
253253{
254254   static int last;
255255
256   common_sound_control_w(offset, data);
256   common_sound_control_w(machine, offset, data);
257257
258258   /* bit 2 goes to 8913 BDIR pin  */
259259   if ((last & 0x04) == 0x04 && (data & 0x04) == 0x00)
r1877r1878
263263      {
264264         /* bit 4 goes to the 8913 BC1 pin */
265265         if (data & 0x10)
266            AY8910_control_port_0_w(0,psg_latch);
266            AY8910_control_port_0_w(machine,0,psg_latch);
267267         else
268            AY8910_write_port_0_w(0,psg_latch);
268            AY8910_write_port_0_w(machine,0,psg_latch);
269269      }
270270      else
271271      {
272272         /* bit 4 goes to the 8913 BC1 pin */
273273         if (data & 0x10)
274            AY8910_control_port_1_w(0,psg_latch);
274            AY8910_control_port_1_w(machine,0,psg_latch);
275275         else
276            AY8910_write_port_1_w(0,psg_latch);
276            AY8910_write_port_1_w(machine,0,psg_latch);
277277      }
278278   }
279279
r1877r1878
282282   /* bit 6 = speech chip DATA PRESENT pin; high then low to make the chip read data */
283283   if ((last & 0x40) == 0x40 && (data & 0x40) == 0x00)
284284   {
285      sp0250_w(0,sp0250_latch);
285      sp0250_w(machine,0,sp0250_latch);
286286   }
287287
288288   /* bit 7 goes to the speech chip RESET pin */
src/mame/audio/dcs.c
r1877r1878
15721572static READ16_HANDLER( input_latch_r )
15731573{
15741574   if (dcs.auto_ack)
1575      input_latch_ack_w(0,0,0);
1575      input_latch_ack_w(machine,0,0,0);
15761576   if (LOG_DCS_IO)
15771577      logerror("%08X:input_latch_r(%04X)\n", activecpu_get_pc(), dcs.input_data);
15781578   return dcs.input_data;
r1877r1878
20802080      timer_set(ATTOTIME_IN_USEC(1), NULL, param, s1_ack_callback2);
20812081      return;
20822082   }
2083   output_latch_w(0, 0x000a, 0);
2083   output_latch_w(machine, 0, 0x000a, 0);
20842084}
20852085
20862086
r1877r1878
20922092      timer_set(ATTOTIME_IN_USEC(1), NULL, param, s1_ack_callback1);
20932093      return;
20942094   }
2095   output_latch_w(0, param, 0);
2095   output_latch_w(machine, 0, param, 0);
20962096
20972097   /* chain to the next word we need to write back */
20982098   timer_set(ATTOTIME_IN_USEC(1), NULL, 0, s1_ack_callback2);
r1877r1878
22302230      timer_set(ATTOTIME_IN_USEC(1), NULL, param, s2_ack_callback);
22312231      return;
22322232   }
2233   output_latch_w(0, param, 0);
2234   output_control_w(0, (dcs.output_control & ~0xff00) | 0x0300, 0);
2233   output_latch_w(machine, 0, param, 0);
2234   output_control_w(machine, 0, (dcs.output_control & ~0xff00) | 0x0300, 0);
22352235}
22362236
22372237
src/mame/audio/jedi.c
r1877r1878
9595
9696static READ8_HANDLER( audio_latch_r )
9797{
98   jedi_state *state = Machine->driver_data;
98   jedi_state *state = machine->driver_data;
9999
100100   *state->audio_comm_stat &= ~0x80;
101101   return state->audio_latch;
r1877r1878
104104
105105CUSTOM_INPUT( jedi_audio_comm_stat_r )
106106{
107   jedi_state *state = Machine->driver_data;
108
107   jedi_state *state = machine->driver_data;
109108   return *state->audio_comm_stat >> 6;
110109}
111110
r1877r1878
119118
120119READ8_HANDLER( jedi_audio_ack_latch_r )
121120{
122   jedi_state *state = Machine->driver_data;
121   jedi_state *state = machine->driver_data;
123122
124123   *state->audio_comm_stat &= ~0x40;
125124   return state->audio_ack_latch;
r1877r1878
128127
129128static WRITE8_HANDLER( audio_ack_latch_w )
130129{
131   jedi_state *state = Machine->driver_data;
130   jedi_state *state = machine->driver_data;
132131
133132   state->audio_ack_latch = data;
134133   *state->audio_comm_stat |= 0x40;
r1877r1878
144143
145144static WRITE8_HANDLER( speech_strobe_w )
146145{
147   jedi_state *state = Machine->driver_data;
146   jedi_state *state = machine->driver_data;
148147   int new_speech_strobe_state = (~offset >> 8) & 1;
149148
150149   if ((new_speech_strobe_state != state->speech_strobe_state) && new_speech_strobe_state)
151      tms5220_data_w(0, *state->speech_data);
150      tms5220_data_w(machine, 0, *state->speech_data);
152151   state->speech_strobe_state = new_speech_strobe_state;
153152}
154153
src/mame/audio/subs.c
r1877r1878
1414
1515WRITE8_HANDLER( subs_sonar1_w )
1616{
17   discrete_sound_w(SUBS_SONAR1_EN, offset & 0x01);
17   discrete_sound_w(machine, SUBS_SONAR1_EN, offset & 0x01);
1818}
1919
2020WRITE8_HANDLER( subs_sonar2_w )
2121{
22   discrete_sound_w(SUBS_SONAR2_EN, offset & 0x01);
22   discrete_sound_w(machine, SUBS_SONAR2_EN, offset & 0x01);
2323}
2424
2525WRITE8_HANDLER( subs_crash_w )
2626{
27   discrete_sound_w(SUBS_CRASH_EN, offset & 0x01);
27   discrete_sound_w(machine, SUBS_CRASH_EN, offset & 0x01);
2828}
2929
3030WRITE8_HANDLER( subs_explode_w )
3131{
32   discrete_sound_w(SUBS_EXPLODE_EN, offset & 0x01);
32   discrete_sound_w(machine, SUBS_EXPLODE_EN, offset & 0x01);
3333}
3434
3535WRITE8_HANDLER( subs_noise_reset_w )
3636{
3737   /* Pulse noise reset */
38   discrete_sound_w(SUBS_NOISE_RESET, 0);
38   discrete_sound_w(machine, SUBS_NOISE_RESET, 0);
3939}
4040
4141
src/mame/audio/exidy.c
r1877r1878
460460            {
461461               if (!(data & 0x01) && (riot_portb_data & 0x01))
462462               {
463                  riot_porta_data = tms5220_status_r(0);
463                  riot_porta_data = tms5220_status_r(machine, 0);
464464                  logerror("(%f)%04X:TMS5220 status read = %02X\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), riot_porta_data);
465465               }
466466               if (!(data & 0x02) && (riot_portb_data & 0x02))
467467               {
468468                  logerror("(%f)%04X:TMS5220 data write = %02X\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), riot_porta_data);
469                  tms5220_data_w(0, riot_porta_data);
469                  tms5220_data_w(machine, 0, riot_porta_data);
470470               }
471471            }
472472            riot_portb_data = (riot_portb_data & ~riot_portb_ddr) | (data & riot_portb_ddr);
src/mame/audio/8080bw.c
r1877r1878
160160WRITE8_HANDLER( cosmo_sh_port_2_w )
161161{
162162   /* inverted flip screen bit */
163   invadpt2_sh_port_2_w(offset, data ^ 0x20);
163   invadpt2_sh_port_2_w(machine, offset, data ^ 0x20);
164164}
165165
166166
r1877r1878
277277
278278WRITE8_HANDLER( indianbt_sh_port_3_w )
279279{
280   discrete_sound_w(INDIANBT_MUSIC_DATA, data);
280   discrete_sound_w(machine, INDIANBT_MUSIC_DATA, data);
281281}
282282
283283
r1877r1878
595595
596596WRITE8_HANDLER( polaris_sh_port_1_w )
597597{
598   discrete_sound_w(POLARIS_MUSIC_DATA, data);
598   discrete_sound_w(machine, POLARIS_MUSIC_DATA, data);
599599}
600600
601601WRITE8_HANDLER( polaris_sh_port_2_w )
602602{
603603   /* 0x01 - SX0 - Shot */
604   discrete_sound_w(POLARIS_SX0_EN, data & 0x01);
604   discrete_sound_w(machine, POLARIS_SX0_EN, data & 0x01);
605605
606606   /* 0x02 - SX1 - Ship Hit (Sub) */
607   discrete_sound_w(POLARIS_SX1_EN, data & 0x02);
607   discrete_sound_w(machine, POLARIS_SX1_EN, data & 0x02);
608608
609609   /* 0x04 - SX2 - Ship */
610   discrete_sound_w(POLARIS_SX2_EN, data & 0x04);
610   discrete_sound_w(machine, POLARIS_SX2_EN, data & 0x04);
611611
612612   /* 0x08 - SX3 - Explosion */
613   discrete_sound_w(POLARIS_SX3_EN, data & 0x08);
613   discrete_sound_w(machine, POLARIS_SX3_EN, data & 0x08);
614614
615615   /* 0x10 - SX4 */
616616
617617   /* 0x20 - SX5 - Sound Enable */
618   discrete_sound_w(POLARIS_SX5_EN, data & 0x20);
618   discrete_sound_w(machine, POLARIS_SX5_EN, data & 0x20);
619619}
620620
621621WRITE8_HANDLER( polaris_sh_port_3_w )
622622{
623
623624   coin_lockout_global_w(data & 0x04);  /* SX8 */
624625
625626   c8080bw_flip_screen_w(data & 0x20);  /* SX11 */
626627
627628   /* 0x01 - SX6 - Plane Down */
628   discrete_sound_w(POLARIS_SX6_EN, data & 0x01);
629   discrete_sound_w(machine, POLARIS_SX6_EN, data & 0x01);
629630
630631   /* 0x02 - SX7 - Plane Up */
631   discrete_sound_w(POLARIS_SX7_EN, data & 0x02);
632   discrete_sound_w(machine, POLARIS_SX7_EN, data & 0x02);
632633
633634   /* 0x08 - SX9 - Hit */
634   discrete_sound_w(POLARIS_SX9_EN, data & 0x08);
635   discrete_sound_w(machine, POLARIS_SX9_EN, data & 0x08);
635636
636637   /* 0x10 - SX10 - Hit */
637   discrete_sound_w(POLARIS_SX10_EN, data & 0x10);
638   discrete_sound_w(machine, POLARIS_SX10_EN, data & 0x10);
638639}
639640
640641
r1877r1878
783784       bit 4 - Effect Sound C (SX4)
784785       bit 5 - Explosion (SX5) */
785786
786   discrete_sound_w(SCHASER_DOT_EN, data & 0x01);
787   discrete_sound_w(SCHASER_DOT_SEL, data & 0x02);
787   discrete_sound_w(machine, SCHASER_DOT_EN, data & 0x01);
788   discrete_sound_w(machine, SCHASER_DOT_SEL, data & 0x02);
788789
789790   /* The effect is a variable rate 555 timer.  A diode/resistor array is used to
790791     * select the frequency.  Because of the diode voltage drop, we can not use the
r1877r1878
844845       bit 4 - Field Control B (SX10)
845846       bit 5 - Flip Screen */
846847
847   discrete_sound_w(SCHASER_MUSIC_BIT, data & 0x01);
848   discrete_sound_w(machine, SCHASER_MUSIC_BIT, data & 0x01);
848849
849   discrete_sound_w(SCHASER_SND_EN, data & 0x02);
850   discrete_sound_w(machine, SCHASER_SND_EN, data & 0x02);
850851   sound_global_enable(data & 0x02);
851852
852853   coin_lockout_global_w(data & 0x04);
r1877r1878
892893{
893894   schaser_effect_555_is_low = 0;
894895   timer_adjust_oneshot(schaser_effect_555_timer, attotime_never, 0);
895   schaser_sh_port_1_w(0, 0);
896   schaser_sh_port_2_w(0, 0);
896   schaser_sh_port_1_w(machine, 0, 0);
897   schaser_sh_port_2_w(machine, 0, 0);
897898   schaser_effect_555_time_remain = attotime_zero;
898899
899900   MACHINE_RESET_CALL(mw8080bw);
src/mame/audio/mw8080bw.c
r1877r1878
6666
6767WRITE8_HANDLER( midway_tone_generator_lo_w )
6868{
69   discrete_sound_w(MIDWAY_TONE_EN, (data >> 0) & 0x01);
69   discrete_sound_w(machine, MIDWAY_TONE_EN, (data >> 0) & 0x01);
7070
71   discrete_sound_w(MIDWAY_TONE_DATA_L, (data >> 1) & 0x1f);
71   discrete_sound_w(machine, MIDWAY_TONE_DATA_L, (data >> 1) & 0x1f);
7272
7373   /* D6 and D7 are not connected */
7474}
r1877r1878
7676
7777WRITE8_HANDLER( midway_tone_generator_hi_w )
7878{
79   discrete_sound_w(MIDWAY_TONE_DATA_H, data & 0x3f);
79   discrete_sound_w(machine, MIDWAY_TONE_DATA_H, data & 0x3f);
8080
8181   /* D6 and D7 are not connected */
8282}
r1877r1878
311311
312312WRITE8_HANDLER( tornbase_audio_w )
313313{
314   discrete_sound_w(TORNBASE_TONE_240_EN, (data >> 0) & 0x01);
314   discrete_sound_w(machine, TORNBASE_TONE_240_EN, (data >> 0) & 0x01);
315315
316   discrete_sound_w(TORNBASE_TONE_960_EN, (data >> 1) & 0x01);
316   discrete_sound_w(machine, TORNBASE_TONE_960_EN, (data >> 1) & 0x01);
317317
318   discrete_sound_w(TORNBASE_TONE_120_EN, (data >> 2) & 0x01);
318   discrete_sound_w(machine, TORNBASE_TONE_120_EN, (data >> 2) & 0x01);
319319
320320   /* if (data & 0x08)  enable SIREN sound */
321321
r1877r1878
567567MACHINE_DRIVER_END
568568
569569
570void maze_write_discrete(UINT8 maze_tone_timing_state)
570void maze_write_discrete(running_machine *machine, UINT8 maze_tone_timing_state)
571571{
572572   /* controls need to be active low */
573573   int controls = ~readinputport(0) & 0xff;
574574
575   discrete_sound_w(MAZE_TONE_TIMING, maze_tone_timing_state);
576   discrete_sound_w(MAZE_P1_DATA, controls & 0x0f);
577   discrete_sound_w(MAZE_P2_DATA, (controls >> 4) & 0x0f);
578   discrete_sound_w(MAZE_JOYSTICK_IN_USE, controls != 0xff);
575   discrete_sound_w(machine, MAZE_TONE_TIMING, maze_tone_timing_state);
576   discrete_sound_w(machine, MAZE_P1_DATA, controls & 0x0f);
577   discrete_sound_w(machine, MAZE_P2_DATA, (controls >> 4) & 0x0f);
578   discrete_sound_w(machine, MAZE_JOYSTICK_IN_USE, controls != 0xff);
579579
580580   /* The coin line is connected directly to the discrete circuit. */
581581   /* We can't really do that, so updating it with the tone timing is close enough. */
582582   /* A better option might be to update it at vblank or set a timer to do it. */
583583   /* The only noticeable difference doing it here, is that the controls don't */
584584   /* imediately start making tones if pressed right after the coin is inserted. */
585   discrete_sound_w(MAZE_COIN, (~readinputport(1) >> 3) & 0x01);
585   discrete_sound_w(machine, MAZE_COIN, (~readinputport(1) >> 3) & 0x01);
586586}
587587
588588
r1877r1878
809809
810810   coin_counter_w(0, (data >> 2) & 0x01);
811811
812   discrete_sound_w(BOOTHILL_GAME_ON_EN, (data >> 3) & 0x01);
812   discrete_sound_w(machine, BOOTHILL_GAME_ON_EN, (data >> 3) & 0x01);
813813
814   discrete_sound_w(BOOTHILL_LEFT_SHOT_EN, (data >> 4) & 0x01);
814   discrete_sound_w(machine, BOOTHILL_LEFT_SHOT_EN, (data >> 4) & 0x01);
815815
816   discrete_sound_w(BOOTHILL_RIGHT_SHOT_EN, (data >> 5) & 0x01);
816   discrete_sound_w(machine, BOOTHILL_RIGHT_SHOT_EN, (data >> 5) & 0x01);
817817
818   discrete_sound_w(BOOTHILL_LEFT_HIT_EN, (data >> 6) & 0x01);
818   discrete_sound_w(machine, BOOTHILL_LEFT_HIT_EN, (data >> 6) & 0x01);
819819
820   discrete_sound_w(BOOTHILL_RIGHT_HIT_EN, (data >> 7) & 0x01);
820   discrete_sound_w(machine, BOOTHILL_RIGHT_HIT_EN, (data >> 7) & 0x01);
821821}
822822
823823
r1877r1878
10411041
10421042WRITE8_HANDLER( checkmat_audio_w )
10431043{
1044   discrete_sound_w(CHECKMAT_TONE_EN, data & 0x01);
1044   discrete_sound_w(machine, CHECKMAT_TONE_EN, data & 0x01);
10451045
1046   discrete_sound_w(CHECKMAT_BOOM_EN, (data >> 1) & 0x01);
1046   discrete_sound_w(machine, CHECKMAT_BOOM_EN, (data >> 1) & 0x01);
10471047
10481048   coin_counter_w(0, (data >> 2) & 0x01);
10491049
10501050   sound_global_enable((data >> 3) & 0x01);
10511051
1052   discrete_sound_w(CHECKMAT_TONE_DATA_45, (data >> 4) & 0x03);
1053   discrete_sound_w(CHECKMAT_TONE_DATA_67, (data >> 6) & 0x03);
1052   discrete_sound_w(machine, CHECKMAT_TONE_DATA_45, (data >> 4) & 0x03);
1053   discrete_sound_w(machine, CHECKMAT_TONE_DATA_67, (data >> 6) & 0x03);
10541054}
10551055
10561056
r1877r1878
12841284
12851285   coin_counter_w(0, (data >> 2) & 0x01);
12861286
1287   discrete_sound_w(DESERTGU_GAME_ON_EN, (data >> 3) & 0x01);
1287   discrete_sound_w(machine, DESERTGU_GAME_ON_EN, (data >> 3) & 0x01);
12881288
1289   discrete_sound_w(DESERTGU_RIFLE_SHOT_EN, (data >> 4) & 0x01);
1289   discrete_sound_w(machine, DESERTGU_RIFLE_SHOT_EN, (data >> 4) & 0x01);
12901290
1291   discrete_sound_w(DESERTGU_BOTTLE_HIT_EN, (data >> 5) & 0x01);
1291   discrete_sound_w(machine, DESERTGU_BOTTLE_HIT_EN, (data >> 5) & 0x01);
12921292
1293   discrete_sound_w(DESERTGU_ROAD_RUNNER_HIT_EN, (data >> 6) & 0x01);
1293   discrete_sound_w(machine, DESERTGU_ROAD_RUNNER_HIT_EN, (data >> 6) & 0x01);
12941294
1295   discrete_sound_w(DESERTGU_CREATURE_HIT_EN, (data >> 7) & 0x01);
1295   discrete_sound_w(machine, DESERTGU_CREATURE_HIT_EN, (data >> 7) & 0x01);
12961296}
12971297
12981298
12991299WRITE8_HANDLER( desertgu_audio_2_w )
13001300{
1301   discrete_sound_w(DESERTGU_ROADRUNNER_BEEP_BEEP_EN, (data >> 0) & 0x01);
1301   discrete_sound_w(machine, DESERTGU_ROADRUNNER_BEEP_BEEP_EN, (data >> 0) & 0x01);
13021302
1303   discrete_sound_w(DESERTGU_TRIGGER_CLICK_EN, (data >> 1) & 0x01);
1303   discrete_sound_w(machine, DESERTGU_TRIGGER_CLICK_EN, (data >> 1) & 0x01);
13041304
13051305   output_set_value("KICKER", (data >> 2) & 0x01);
13061306
r1877r1878
15741574
15751575WRITE8_HANDLER( dplay_audio_w )
15761576{
1577   discrete_sound_w(DPLAY_TONE_ON_EN, (data >> 0) & 0x01);
1577   discrete_sound_w(machine, DPLAY_TONE_ON_EN, (data >> 0) & 0x01);
15781578
1579   discrete_sound_w(DPLAY_CHEER_EN, (data >> 1) & 0x01);
1579   discrete_sound_w(machine, DPLAY_CHEER_EN, (data >> 1) & 0x01);
15801580
1581   discrete_sound_w(DPLAY_SIREN_EN, (data >> 2) & 0x01);
1581   discrete_sound_w(machine, DPLAY_SIREN_EN, (data >> 2) & 0x01);
15821582
1583   discrete_sound_w(DPLAY_WHISTLE_EN, (data >> 3) & 0x01);
1583   discrete_sound_w(machine, DPLAY_WHISTLE_EN, (data >> 3) & 0x01);
15841584
1585   discrete_sound_w(DPLAY_GAME_ON_EN, (data >> 4) & 0x01);
1585   discrete_sound_w(machine, DPLAY_GAME_ON_EN, (data >> 4) & 0x01);
15861586
15871587   coin_counter_w(0, (data >> 5) & 0x01);
15881588
r1877r1878
20282028{
20292029   UINT8 rising_bits = data & ~port_2_last;
20302030
2031   discrete_sound_w(CLOWNS_POP_BOTTOM_EN, (data >> 0) & 0x01);
2031   discrete_sound_w(machine, CLOWNS_POP_BOTTOM_EN, (data >> 0) & 0x01);
20322032
2033   discrete_sound_w(CLOWNS_POP_MIDDLE_EN, (data >> 1) & 0x01);
2033   discrete_sound_w(machine, CLOWNS_POP_MIDDLE_EN, (data >> 1) & 0x01);
20342034
2035   discrete_sound_w(CLOWNS_POP_TOP_EN, (data >> 2) & 0x01);
2035   discrete_sound_w(machine, CLOWNS_POP_TOP_EN, (data >> 2) & 0x01);
20362036
20372037   sound_global_enable((data >> 3) & 0x01);
20382038
2039   discrete_sound_w(CLOWNS_SPRINGBOARD_HIT_EN, (data >> 4) & 0x01);
2039   discrete_sound_w(machine, CLOWNS_SPRINGBOARD_HIT_EN, (data >> 4) & 0x01);
20402040
20412041   if (rising_bits & 0x20) sample_start_n(0, 0, 0, 0);  /* springboard miss */
20422042
r1877r1878
27052705   /* D1 is marked as 'OPTIONAL SWITCH VIDEO FOR COCKTAIL',
27062706       but it is never set by the software */
27072707
2708   discrete_sound_w(SPCENCTR_CRASH_EN, (data >> 2) & 0x01);
2708   discrete_sound_w(machine, SPCENCTR_CRASH_EN, (data >> 2) & 0x01);
27092709
27102710   /* D3-D7 are not connected */
27112711}
r1877r1878
27152715{
27162716   /* set WIND SOUND FREQ(data & 0x0f)  0, if no wind */
27172717
2718   discrete_sound_w(SPCENCTR_EXPLOSION_EN, (data >> 4) & 0x01);
2718   discrete_sound_w(machine, SPCENCTR_EXPLOSION_EN, (data >> 4) & 0x01);
27192719
2720   discrete_sound_w(SPCENCTR_PLAYER_SHOT_EN, (data >> 5) & 0x01);
2720   discrete_sound_w(machine, SPCENCTR_PLAYER_SHOT_EN, (data >> 5) & 0x01);
27212721
27222722   /* D6 and D7 are not connected */
27232723
r1877r1878
27292729{
27302730   /* if (data & 0x01)  enable SCREECH (hit the sides) sound */
27312731
2732   discrete_sound_w(SPCENCTR_ENEMY_SHIP_SHOT_EN, (data >> 1) & 0x01);
2732   discrete_sound_w(machine, SPCENCTR_ENEMY_SHIP_SHOT_EN, (data >> 1) & 0x01);
27332733
27342734   spcenctr_set_strobe_state((data >> 2) & 0x01);
27352735
27362736   output_set_value("LAMP", (data >> 3) & 0x01);
27372737
2738   discrete_sound_w(SPCENCTR_BONUS_EN, (data >> 4) & 0x01);
2738   discrete_sound_w(machine, SPCENCTR_BONUS_EN, (data >> 4) & 0x01);
27392739
27402740   SN76477_enable_w(0, (data >> 5) & 0x01);   /* saucer sound */
27412741
r1877r1878
29122912
29132913   sound_global_enable((data >> 2) & 0x01);
29142914
2915   discrete_sound_w(BOWLER_FOWL_EN, (data >> 3) & 0x01);
2915   discrete_sound_w(machine, BOWLER_FOWL_EN, (data >> 3) & 0x01);
29162916
29172917   /* D4 - appears to be a screen flip, but it's
29182918            shown unconnected on the schematics for both the
r1877r1878
36423642{
36433643   SN76477_enable_w(0, (~data >> 0) & 0x01);   /* saucer sound */
36443644
3645   discrete_sound_w(INVADERS_NODE(INVADERS_MISSILE_EN, 1), data & 0x02);
3646   discrete_sound_w(INVADERS_NODE(INVADERS_EXPLOSION_EN, 1), data & 0x04);
3647   discrete_sound_w(INVADERS_NODE(INVADERS_INVADER_HIT_EN, 1), data & 0x08);
3648   discrete_sound_w(INVADERS_NODE(INVADERS_BONUS_MISSLE_BASE_EN, 1), data & 0x10);
3645   discrete_sound_w(machine, INVADERS_NODE(INVADERS_MISSILE_EN, 1), data & 0x02);
3646   discrete_sound_w(machine, INVADERS_NODE(INVADERS_EXPLOSION_EN, 1), data & 0x04);
3647   discrete_sound_w(machine, INVADERS_NODE(INVADERS_INVADER_HIT_EN, 1), data & 0x08);
3648   discrete_sound_w(machine, INVADERS_NODE(INVADERS_BONUS_MISSLE_BASE_EN, 1), data & 0x10);
36493649
36503650   sound_global_enable(data & 0x20);
36513651
r1877r1878
36553655
36563656WRITE8_HANDLER( invaders_audio_2_w )
36573657{
3658   discrete_sound_w(INVADERS_NODE(INVADERS_FLEET_DATA, 1), data & 0x0f);
3659   discrete_sound_w(INVADERS_NODE(INVADERS_SAUCER_HIT_EN, 1), data & 0x10);
3658   discrete_sound_w(machine, INVADERS_NODE(INVADERS_FLEET_DATA, 1), data & 0x0f);
3659   discrete_sound_w(machine, INVADERS_NODE(INVADERS_SAUCER_HIT_EN, 1), data & 0x10);
36603660
36613661   /* the flip screen line is only connected on the cocktail PCB */
36623662   if (invaders_is_cabinet_cocktail())
r1877r1878
37923792
37933793WRITE8_HANDLER( blueshrk_audio_w )
37943794{
3795   discrete_sound_w(BLUESHRK_GAME_ON_EN, (data >> 0) & 0x01);
3795   discrete_sound_w(machine, BLUESHRK_GAME_ON_EN, (data >> 0) & 0x01);
37963796
37973797   /* discrete_sound_w(BLUESHRK_SHOT_EN, (data >> 1) & 0x01); */
37983798
3799   discrete_sound_w(BLUESHRK_HIT_EN, (data >> 2) & 0x01);
3799   discrete_sound_w(machine, BLUESHRK_HIT_EN, (data >> 2) & 0x01);
38003800
38013801   /* discrete_sound_w(BLUESHRK_SHARK_EN, (data >> 3) & 0x01); */
38023802
r1877r1878
40224022{
40234023   SN76477_enable_w(0, (~data >> 0) & 0x01);   /* saucer sound */
40244024
4025   discrete_sound_w(INVADERS_NODE(INVADERS_MISSILE_EN, 1), data & 0x02);
4026   discrete_sound_w(INVADERS_NODE(INVADERS_EXPLOSION_EN, 1), data & 0x04);
4027   discrete_sound_w(INVADERS_NODE(INVADERS_INVADER_HIT_EN, 1), data & 0x08);
4028   discrete_sound_w(INVADERS_NODE(INVADERS_BONUS_MISSLE_BASE_EN, 1), data & 0x10);
4025   discrete_sound_w(machine, INVADERS_NODE(INVADERS_MISSILE_EN, 1), data & 0x02);
4026   discrete_sound_w(machine, INVADERS_NODE(INVADERS_EXPLOSION_EN, 1), data & 0x04);
4027   discrete_sound_w(machine, INVADERS_NODE(INVADERS_INVADER_HIT_EN, 1), data & 0x08);
4028   discrete_sound_w(machine, INVADERS_NODE(INVADERS_BONUS_MISSLE_BASE_EN, 1), data & 0x10);
40294029
40304030   sound_global_enable(data & 0x20);
40314031
r1877r1878
40354035
40364036WRITE8_HANDLER( invad2ct_audio_2_w )
40374037{
4038   discrete_sound_w(INVADERS_NODE(INVADERS_FLEET_DATA, 1), data & 0x0f);
4039   discrete_sound_w(INVADERS_NODE(INVADERS_SAUCER_HIT_EN, 1), data & 0x10);
4038   discrete_sound_w(machine, INVADERS_NODE(INVADERS_FLEET_DATA, 1), data & 0x0f);
4039   discrete_sound_w(machine, INVADERS_NODE(INVADERS_SAUCER_HIT_EN, 1), data & 0x10);
40404040
40414041   /* D5-D7 are not connected */
40424042}
r1877r1878
40464046{
40474047   SN76477_enable_w(1, (~data >> 0) & 0x01);   /* saucer sound */
40484048
4049   discrete_sound_w(INVADERS_NODE(INVADERS_MISSILE_EN, 2), data & 0x02);
4050   discrete_sound_w(INVADERS_NODE(INVADERS_EXPLOSION_EN, 2), data & 0x04);
4051   discrete_sound_w(INVADERS_NODE(INVADERS_INVADER_HIT_EN, 2), data & 0x08);
4052   discrete_sound_w(INVADERS_NODE(INVADERS_BONUS_MISSLE_BASE_EN, 2), data & 0x10);
4049   discrete_sound_w(machine, INVADERS_NODE(INVADERS_MISSILE_EN, 2), data & 0x02);
4050   discrete_sound_w(machine, INVADERS_NODE(INVADERS_EXPLOSION_EN, 2), data & 0x04);
4051   discrete_sound_w(machine, INVADERS_NODE(INVADERS_INVADER_HIT_EN, 2), data & 0x08);
4052   discrete_sound_w(machine, INVADERS_NODE(INVADERS_BONUS_MISSLE_BASE_EN, 2), data & 0x10);
40534053
40544054   /* D5-D7 are not connected */
40554055}
r1877r1878
40574057
40584058WRITE8_HANDLER( invad2ct_audio_4_w )
40594059{
4060   discrete_sound_w(INVADERS_NODE(INVADERS_FLEET_DATA, 2), data & 0x0f);
4061   discrete_sound_w(INVADERS_NODE(INVADERS_SAUCER_HIT_EN, 2), data & 0x10);
4060   discrete_sound_w(machine, INVADERS_NODE(INVADERS_FLEET_DATA, 2), data & 0x0f);
4061   discrete_sound_w(machine, INVADERS_NODE(INVADERS_SAUCER_HIT_EN, 2), data & 0x10);
40624062
40634063   /* D5-D7 are not connected */
40644064}
src/mame/machine/cubocd32.c
r1877r1878
11#include "driver.h"
2#include "deprecat.h"
23#include "includes/amiga.h"
34#include "cdrom.h"
45#include "coreutil.h"
r1877r1878
360361#if LOG_AKIKO_CD
361362      logerror( "Akiko CD IRQ\n" );
362363#endif
363      amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_PORTS, 0);
364      amiga_custom_w(Machine, REG_INTREQ, 0x8000 | INTENA_PORTS, 0);
364365   }
365366}
366367
src/mame/machine/nmk004.c
r1877r1878
11#include "driver.h"
2#include "deprecat.h"
23#include "nmk004.h"
34#include "sound/2203intf.h"
45#include "sound/okim6295.h"
r1877r1878
133134
134135*****************************/
135136
136static void oki_play_sample(int sample_no)
137static void oki_play_sample(running_machine *machine, int sample_no)
137138{
138139   UINT16 table_start = (sample_no & 0x80) ? read16(SAMPLE_TABLE_1) : read16(SAMPLE_TABLE_0);
139140   UINT8 byte1 = read8(table_start + 2 * (sample_no & 0x7f) + 0);
r1877r1878
144145   {
145146      // stop all channels
146147      if (chip == 0)
147         OKIM6295_data_0_w(0, 0x78 );
148         OKIM6295_data_0_w(machine, 0, 0x78 );
148149      else
149         OKIM6295_data_1_w(0, 0x78 );
150         OKIM6295_data_1_w(machine, 0, 0x78 );
150151   }
151152   else
152153   {
r1877r1878
161162
162163      // stop channel
163164      if (chip == 0)
164         OKIM6295_data_0_w(0, (0x08 << ch) );
165         OKIM6295_data_0_w(machine, 0, (0x08 << ch) );
165166      else
166         OKIM6295_data_1_w(0, (0x08 << ch) );
167         OKIM6295_data_1_w(machine, 0, (0x08 << ch) );
167168
168169      if (sample != 0)
169170      {
r1877r1878
176177
177178         if (chip == 0)
178179         {
179            OKIM6295_data_0_w(0, 0x80 | sample );
180            OKIM6295_data_0_w(0, (0x10 << ch) | vol );
180            OKIM6295_data_0_w(machine, 0, 0x80 | sample );
181            OKIM6295_data_0_w(machine, 0, (0x10 << ch) | vol );
181182         }
182183         else
183184         {
184            OKIM6295_data_1_w(0, 0x80 | sample );
185            OKIM6295_data_1_w(0, (0x10 << ch) | vol );
185            OKIM6295_data_1_w(machine, 0, 0x80 | sample );
186            OKIM6295_data_1_w(machine, 0, (0x10 << ch) | vol );
186187         }
187188      }
188189   }
189190}
190191
191static void oki_update_state(void)
192static void oki_update_state(running_machine *machine)
192193{
193   NMK004_state.oki_playing = ((OKIM6295_status_1_r(0) & 0x0f) << 4) | (OKIM6295_status_0_r(0) & 0x0f);
194   NMK004_state.oki_playing = ((OKIM6295_status_1_r(machine, 0) & 0x0f) << 4) | (OKIM6295_status_0_r(machine, 0) & 0x0f);
194195}
195196
196197
r1877r1878
201202
202203*****************************/
203204
204static void effects_update(int channel)
205static void effects_update(running_machine *machine, int channel)
205206{
206207   struct effects_control *effects = &NMK004_state.effects_control[channel];
207208
r1877r1878
233234               switch (token)
234235               {
235236                  case 0xef:   // play sample
236                     oki_play_sample(read8(effects->current++));
237                     oki_play_sample(machine, read8(effects->current++));
237238                     break;
238239
239240                  case 0xf6:   // jump
r1877r1878
308309
309310*****************************/
310311
311static void fm_update(int channel)
312static void fm_update(running_machine *machine, int channel)
312313{
313314   struct fm_control *fm = &NMK004_state.fm_control[channel];
314315
r1877r1878
348349               switch (token)
349350               {
350351//                      case 0xef:  // play sample
351//                          oki_play_sample(read8(fm->current++));
352//                          oki_play_sample(machine, read8(fm->current++));
352353//                          break;
353354
354355                  case 0xf0:   // slot (for keyon ym2203 command)
r1877r1878
356357                     fm->slot = read8(fm->current++);
357358                     if (channel < 3 || !(NMK004_state.fm_control[channel-3].flags & FM_FLAG_ACTIVE))
358359                     {
359                        YM2203_control_port_0_w(0, 0x28);   // keyon/off
360                        YM2203_write_port_0_w(0, channel % 3);
360                        YM2203_control_port_0_w(machine, 0, 0x28);   // keyon/off
361                        YM2203_write_port_0_w(machine, 0, channel % 3);
361362                     }
362363                     break;
363364
r1877r1878
585586}
586587
587588
588static void fm_voices_update(void)
589static void fm_voices_update(running_machine *machine)
589590{
590591   static const int ym2203_registers[0x18] =
591592   {
r1877r1878
605606
606607         for (i = 0; i < 0x18; i++)
607608         {
608            YM2203_control_port_0_w(0, ym2203_registers[i] + channel);
609            YM2203_write_port_0_w(0, fm1->voice_params[i]);
609            YM2203_control_port_0_w(machine, 0, ym2203_registers[i] + channel);
610            YM2203_write_port_0_w(machine, 0, fm1->voice_params[i]);
610611         }
611612      }
612613
r1877r1878
618619         {
619620            for (i = 0; i < 0x18; i++)
620621            {
621               YM2203_control_port_0_w(0, ym2203_registers[i] + channel);
622               YM2203_write_port_0_w(0, fm2->voice_params[i]);
622               YM2203_control_port_0_w(machine, 0, ym2203_registers[i] + channel);
623               YM2203_write_port_0_w(machine, 0, fm2->voice_params[i]);
623624            }
624625         }
625626      }
r1877r1878
627628
628629      if (fm1->flags & FM_FLAG_ACTIVE)
629630      {
630         YM2203_control_port_0_w(0, 0xb0 + channel);   // self-feedback
631         YM2203_write_port_0_w(0, fm1->self_feedback);
631         YM2203_control_port_0_w(machine, 0, 0xb0 + channel);   // self-feedback
632         YM2203_write_port_0_w(machine, 0, fm1->self_feedback);
632633
633         YM2203_control_port_0_w(0, 0xa4 + channel);   // F-number
634         YM2203_write_port_0_w(0, fm1->f_number >> 8);
634         YM2203_control_port_0_w(machine, 0, 0xa4 + channel);   // F-number
635         YM2203_write_port_0_w(machine, 0, fm1->f_number >> 8);
635636
636         YM2203_control_port_0_w(0, 0xa0 + channel);   // F-number
637         YM2203_write_port_0_w(0, fm1->f_number & 0xff);
637         YM2203_control_port_0_w(machine, 0, 0xa0 + channel);   // F-number
638         YM2203_write_port_0_w(machine, 0, fm1->f_number & 0xff);
638639      }
639640      else
640641      {
641         YM2203_control_port_0_w(0, 0xb0 + channel);   // self-feedback
642         YM2203_write_port_0_w(0, fm2->self_feedback);
642         YM2203_control_port_0_w(machine, 0, 0xb0 + channel);   // self-feedback
643         YM2203_write_port_0_w(machine, 0, fm2->self_feedback);
643644
644         YM2203_control_port_0_w(0, 0xa4 + channel);   // F-number
645         YM2203_write_port_0_w(0, fm2->f_number >> 8);
645         YM2203_control_port_0_w(machine, 0, 0xa4 + channel);   // F-number
646         YM2203_write_port_0_w(machine, 0, fm2->f_number >> 8);
646647
647         YM2203_control_port_0_w(0, 0xa0 + channel);   // F-number
648         YM2203_write_port_0_w(0, fm2->f_number & 0xff);
648         YM2203_control_port_0_w(machine, 0, 0xa0 + channel);   // F-number
649         YM2203_write_port_0_w(machine, 0, fm2->f_number & 0xff);
649650      }
650651
651652
r1877r1878
654655      {
655656         fm1->flags &= ~FM_FLAG_MUST_SEND_KEYON;
656657
657         YM2203_control_port_0_w(0, 0x28);   // keyon/off
658         YM2203_write_port_0_w(0, fm1->slot | channel);
658         YM2203_control_port_0_w(machine, 0, 0x28);   // keyon/off
659         YM2203_write_port_0_w(machine, 0, fm1->slot | channel);
659660      }
660661
661662      if (fm2->flags & FM_FLAG_MUST_SEND_KEYON)
r1877r1878
664665
665666         if (!(fm1->flags & FM_FLAG_ACTIVE))
666667         {
667            YM2203_control_port_0_w(0, 0x28);   // keyon/off
668            YM2203_write_port_0_w(0, fm2->slot | channel);
668            YM2203_control_port_0_w(machine, 0, 0x28);   // keyon/off
669            YM2203_write_port_0_w(machine, 0, fm2->slot | channel);
669670         }
670671      }
671672   }
r1877r1878
679680
680681*****************************/
681682
682static void psg_update(int channel)
683static void psg_update(running_machine *machine, int channel)
683684{
684685   struct psg_control *psg = &NMK004_state.psg_control[channel];
685686
r1877r1878
703704         psg->flags &= ~PSG_FLAG_NOISE_NOT_ENABLED;
704705
705706         // enable noise, disable tone on this channel
706         YM2203_control_port_0_w(0, 0x07);
707         enable = YM2203_read_port_0_r(0);
707         YM2203_control_port_0_w(machine, 0, 0x07);
708         enable = YM2203_read_port_0_r(machine, 0);
708709         enable |=  (0x01 << channel);   // disable tone
709710         enable &= ~(0x08 << channel);   // enable noise
710         YM2203_write_port_0_w(0, enable);
711         YM2203_write_port_0_w(machine, 0, enable);
711712      }
712713
713714
r1877r1878
741742                     psg->flags &= ~PSG_FLAG_NOISE_NOT_ENABLED;
742743
743744                     // enable noise, disable tone on this channel
744                     YM2203_control_port_0_w(0, 0x07);
745                     enable = YM2203_read_port_0_r(0);
745                     YM2203_control_port_0_w(machine, 0, 0x07);
746                     enable = YM2203_read_port_0_r(machine, 0);
746747                     enable |=  (0x01 << channel);   // disable tone
747748                     enable &= ~(0x08 << channel);   // enable noise
748                     YM2203_write_port_0_w(0, enable);
749                     YM2203_write_port_0_w(machine, 0, enable);
749750                     break;
750751
751752                  case 0xf2:   // set volume shape
r1877r1878
790791                     psg->volume_shape = 0;
791792
792793                     // mute channel
793                     YM2203_control_port_0_w(0, 8 + channel);
794                     YM2203_write_port_0_w(0, 0);
794                     YM2203_control_port_0_w(machine, 0, 8 + channel);
795                     YM2203_write_port_0_w(machine, 0, 0);
795796                     return;
796797               }
797798            }
r1877r1878
831832
832833               period >>= octave;
833834
834               YM2203_control_port_0_w(0, 2 * channel + 1);
835               YM2203_write_port_0_w(0, (period & 0x0f00) >> 8);
836               YM2203_control_port_0_w(0, 2 * channel + 0);
837               YM2203_write_port_0_w(0, (period & 0x00ff));
835               YM2203_control_port_0_w(machine, 0, 2 * channel + 1);
836               YM2203_write_port_0_w(machine, 0, (period & 0x0f00) >> 8);
837               YM2203_control_port_0_w(machine, 0, 2 * channel + 0);
838               YM2203_write_port_0_w(machine, 0, (period & 0x00ff));
838839
839840               psg->note_period_hi_bits = (period & 0x0f00) >> 8;
840841            }
r1877r1878
847848                  psg->flags |= PSG_FLAG_NOISE_NOT_ENABLED;
848849
849850                  // disable noise, enable tone on this channel
850                  YM2203_control_port_0_w(0, 0x07);
851                  enable = YM2203_read_port_0_r(0);
851                  YM2203_control_port_0_w(machine, 0, 0x07);
852                  enable = YM2203_read_port_0_r(machine, 0);
852853                  enable &= ~(0x01 << channel);   // enable tone
853854                  enable |=  (0x08 << channel);   // disable noise
854                  YM2203_write_port_0_w(0, enable);
855                  YM2203_write_port_0_w(machine, 0, enable);
855856               }
856857
857               YM2203_control_port_0_w(0, 0x06);   // noise period
858               YM2203_write_port_0_w(0, psg->note);
858               YM2203_control_port_0_w(machine, 0, 0x06);   // noise period
859               YM2203_write_port_0_w(machine, 0, psg->note);
859860               psg->note_period_hi_bits = psg->note;
860861            }
861862         }
r1877r1878
880881            volume = 0;
881882
882883         // set volume
883         YM2203_control_port_0_w(0, 8 + channel);
884         YM2203_write_port_0_w(0, volume & 0x0f);
884         YM2203_control_port_0_w(machine, 0, 8 + channel);
885         YM2203_write_port_0_w(machine, 0, volume & 0x0f);
885886      }
886887   }
887888}
r1877r1878
894895
895896*****************************/
896897
897static void get_command(void)
898static void get_command(running_machine *machine)
898899{
899900   static const UINT8 from_main[] =
900901   {
r1877r1878
931932
932933      if ((cmd_table & 0xff00) == 0)
933934      {
934         oki_play_sample(cmd_table);
935         oki_play_sample(machine, cmd_table);
935936      }
936937      else
937938      {
r1877r1878
979980
980981
981982
982static void update_music(void)
983static void update_music(running_machine *machine)
983984{
984985   int channel;
985986
986987   for (channel = 0; channel < FM_CHANNELS; channel++)
987      fm_update(channel);
988   fm_voices_update();
988      fm_update(machine, channel);
989   fm_voices_update(machine);
989990
990991   for (channel = 0; channel < PSG_CHANNELS; channel++)
991      psg_update(channel);
992      psg_update(machine, channel);
992993
993994   for (channel = 0; channel < EFFECTS_CHANNELS; channel++)
994      effects_update(channel);
995      effects_update(machine, channel);
995996}
996997
997998
r1877r1878
10021003
10031004   if (!irq) return;
10041005
1005   status = YM2203_status_port_0_r(0);
1006   status = YM2203_status_port_0_r(Machine,0);
10061007
10071008   if (status & 1)   // timer A expired
10081009   {
1009      oki_update_state();
1010      get_command();
1011      update_music();
1010      oki_update_state(Machine);
1011      get_command(Machine);
1012      update_music(Machine);
10121013
10131014      // restart timer
1014      YM2203_control_port_0_w(0, 0x27);
1015      YM2203_write_port_0_w(0, 0x15);
1015      YM2203_control_port_0_w(Machine, 0, 0x27);
1016      YM2203_write_port_0_w(Machine, 0, 0x15);
10161017   }
10171018}
10181019
r1877r1878
10311032
10321033   NMK004_state.rom = memory_region(REGION_CPU2);
10331034
1034   YM2203_control_port_0_w(0, 0x2f);
1035   YM2203_control_port_0_w(machine, 0, 0x2f);
10351036
10361037   i = 0;
10371038   while (ym2203_init[i] != 0xff)
10381039   {
1039      YM2203_control_port_0_w(0, ym2203_init[i++]);
1040      YM2203_write_port_0_w(0, ym2203_init[i++]);
1040      YM2203_control_port_0_w(machine, 0, ym2203_init[i++]);
1041      YM2203_write_port_0_w(machine, 0, ym2203_init[i++]);
10411042   }
10421043
10431044   NMK004_state.oki_playing = 0;
10441045
1045   oki_play_sample(0);
1046   oki_play_sample(machine, 0);
10461047
10471048   NMK004_state.protection_check = 0;
10481049}
src/mame/machine/playch10.c
r1877r1878
4444
4545   /* reset the security chip */
4646   RP5H01_enable_w( 0, 0 );
47   RP5H01_0_reset_w( 0, 0 );
48   RP5H01_0_reset_w( 0, 1 );
47   RP5H01_0_reset_w( machine, 0, 0 );
48   RP5H01_0_reset_w( machine, 0, 1 );
4949   RP5H01_enable_w( 0, 1 );
5050
5151   /* reset the ppu */
r1877r1878
142142   /* we only support a single cart connected at slot 0 */
143143   if ( cart_sel == 0 )
144144   {
145      RP5H01_0_enable_w( 0, 0 );
145      RP5H01_0_enable_w( machine, 0, 0 );
146146      data |= ( ( ~RP5H01_counter_r( 0 ) ) << 4 ) & 0x10;   /* D4 */
147147      data |= ( ( RP5H01_data_r( 0 ) ) << 3 ) & 0x08;      /* D3 */
148      RP5H01_0_enable_w( 0, 1 );
148      RP5H01_0_enable_w( machine, 0, 1 );
149149   }
150150   return data;
151151}
r1877r1878
155155   /* we only support a single cart connected at slot 0 */
156156   if ( cart_sel == 0 )
157157   {
158      RP5H01_0_enable_w( 0, 0 );
159      RP5H01_0_test_w( 0, data & 0x10 );      /* D4 */
160      RP5H01_0_clock_w( 0, data & 0x08 );      /* D3 */
161      RP5H01_0_reset_w( 0, ~data & 0x01 );   /* D0 */
162      RP5H01_0_enable_w( 0, 1 );
158      RP5H01_0_enable_w( machine, 0, 0 );
159      RP5H01_0_test_w( machine, 0, data & 0x10 );      /* D4 */
160      RP5H01_0_clock_w( machine, 0, data & 0x08 );      /* D3 */
161      RP5H01_0_reset_w( machine, 0, ~data & 0x01 );   /* D0 */
162      RP5H01_0_enable_w( machine, 0, 1 );
163163
164164      /* this thing gets dense at some point                      */
165165      /* it wants to jump and execute an opcode at $ffff, wich    */
166166      /* is the actual protection memory area                     */
167167      /* setting the whole 0x2000 region every time is a waste    */
168168      /* so we just set $ffff with the current value              */
169      memory_region( REGION_CPU1 )[0xffff] = pc10_prot_r(0);
169      memory_region( REGION_CPU1 )[0xffff] = pc10_prot_r(machine,0);
170170   }
171171}
172172
src/mame/machine/bublbobl.c
r1877r1878
105105
106106WRITE8_HANDLER( bublbobl_sound_command_w )
107107{
108   soundlatch_w(offset,data);
108   soundlatch_w(machine,offset,data);
109109   timer_call_after_resynch(NULL, data,nmi_callback);
110110}
111111
src/mame/machine/galaxian.c
r1877r1878
271271WRITE8_HANDLER( kingball_sound2_w )
272272{
273273   kingball_sound = (kingball_sound & ~0x02) | (data << 1);
274   soundlatch_w (0, kingball_sound | 0xf0);
274   soundlatch_w (machine, 0, kingball_sound | 0xf0);
275275}
276276
277277
r1877r1878
313313WRITE8_HANDLER( _4in1_bank_w )
314314{
315315   _4in1_bank = data & 0x03;
316   galaxian_gfxbank_w(0, _4in1_bank);
316   galaxian_gfxbank_w(machine, 0, _4in1_bank);
317317   memory_set_bank(1, _4in1_bank);
318318}
319319
r1877r1878
334334
335335   memory_set_bank(1, game);
336336
337   galaxian_gfxbank_w(0, gmgalax_selected_game);
337   galaxian_gfxbank_w(Machine, 0, gmgalax_selected_game);
338338}
339339
340340READ8_HANDLER( gmgalax_input_port_0_r )
r1877r1878
520520   /* games are banked at 0x0000 - 0x3fff */
521521   memory_configure_bank(1, 0, 4, &RAM[0x10000], 0x4000);
522522
523   _4in1_bank_w(0, 0); /* set the initial CPU bank */
523   _4in1_bank_w(machine, 0, 0); /* set the initial CPU bank */
524524
525525   state_save_register_global(_4in1_bank);
526526}
r1877r1878
544544
545545   state_save_register_global(gmgalax_selected_game);
546546
547   gmgalax_select_game(input_port_6_r(0) & 0x01);
547   gmgalax_select_game(input_port_6_r(machine, 0) & 0x01);
548548}
549549
550550INTERRUPT_GEN( gmgalax_vh_interrupt )
551551{
552552   // reset the cpu if the selected game changed
553   int new_game = input_port_6_r(0) & 0x01;
553   int new_game = input_port_6_r(machine, 0) & 0x01;
554554
555555   if (gmgalax_selected_game != new_game)
556556   {
557557      gmgalax_select_game(new_game);
558558
559559      /* Ghost Muncher never clears this */
560      galaxian_stars_enable_w(0, 0);
560      galaxian_stars_enable_w(machine, 0, 0);
561561
562562      cpunum_set_input_line(machine, 0, INPUT_LINE_RESET, ASSERT_LINE);
563563   }
src/mame/machine/asic65.c
r1877r1878
158158      else if (!state && asic65_reset_state)
159159      {
160160         if (asic65_command != -1)
161            asic65_data_w(1, asic65_command, 0);
161            asic65_data_w(Machine, 1, asic65_command, 0);
162162      }
163163
164164      /* update the state */
src/mame/machine/tnzs.c
r1877r1878
7878
7979   switch (tnzs_input_select & 0x0f)
8080   {
81      case 0x0a:   data = input_port_4_r(0); break;
82      case 0x0c:   data = input_port_2_r(0); break;
83      case 0x0d:   data = input_port_3_r(0); break;
81      case 0x0a:   data = input_port_4_r(machine,0); break;
82      case 0x0c:   data = input_port_2_r(machine,0); break;
83      case 0x0d:   data = input_port_3_r(machine,0); break;
8484      default:   data = 0xff; break;
8585   }
8686
r1877r1878
9191
9292READ8_HANDLER( tnzs_port2_r )
9393{
94   int data = input_port_4_r(0);
94   int data = input_port_4_r(machine,0);
9595
9696//  logerror("I8742:%04x  Read %02x from port 2\n", activecpu_get_previouspc(), data);
9797
r1877r1878
613613   {
614614      case MCU_TNZS:
615615      case MCU_CHUKATAI:
616         return mcu_tnzs_r(offset);
616         return mcu_tnzs_r(machine,offset);
617617         break;
618618      case MCU_ARKANOID:
619         return mcu_arknoid2_r(offset);
619         return mcu_arknoid2_r(machine,offset);
620620         break;
621621      case MCU_EXTRMATN:
622622      case MCU_DRTOPPEL:
623623      case MCU_PLUMPOP:
624         return mcu_extrmatn_r(offset);
624         return mcu_extrmatn_r(machine,offset);
625625         break;
626626      default:
627627         return 0xff;
r1877r1878
635635   {
636636      case MCU_TNZS:
637637      case MCU_CHUKATAI:
638         mcu_tnzs_w(offset,data);
638         mcu_tnzs_w(machine,offset,data);
639639         break;
640640      case MCU_ARKANOID:
641         mcu_arknoid2_w(offset,data);
641         mcu_arknoid2_w(machine,offset,data);
642642         break;
643643      case MCU_EXTRMATN:
644644      case MCU_DRTOPPEL:
645645      case MCU_PLUMPOP:
646         mcu_extrmatn_w(offset,data);
646         mcu_extrmatn_w(machine,offset,data);
647647         break;
648648      default:
649649         break;
src/mame/machine/atari.c
r1877r1878
129129
130130void a600xl_mmu(UINT8 new_mmu)
131131{
132   read8_handler rbank2;
133   write8_handler wbank2;
132   read8_machine_func rbank2;
133   write8_machine_func wbank2;
134134
135135   /* check if self-test ROM changed */
136136   if ( new_mmu & 0x80 )
r1877r1878
153153
154154void a800xl_mmu(UINT8 new_mmu)
155155{
156   read8_handler rbank1, rbank2, rbank3, rbank4;
157   write8_handler wbank1, wbank2, wbank3, wbank4;
156   read8_machine_func rbank1, rbank2, rbank3, rbank4;
157   write8_machine_func wbank1, wbank2, wbank3, wbank4;
158158   UINT8 *base1, *base2, *base3, *base4;
159159
160160   /* check if memory C000-FFFF changed */
r1877r1878
697697
698698static void pokey_reset(running_machine *machine)
699699{
700   pokey1_w(15,0);
700   pokey1_w(machine,15,0);
701701}
702702
703703
src/mame/machine/midyunit.c
r1877r1878
463463
464464/********************** Terminator 2 **********************/
465465
466static void term2_init_common(write16_handler hack_w)
466static void term2_init_common(write16_machine_func hack_w)
467467{
468468   /* protection */
469469   static const struct protection_data term2_protection_data =
r1877r1878
579579            break;
580580
581581         case SOUND_YAWDIM:
582            soundlatch_w(0, data);
582            soundlatch_w(machine, 0, data);
583583            cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
584584            break;
585585      }
src/mame/machine/slapfght.c
r1877r1878
7777/* Disable and clear hardware interrupt */
7878WRITE8_HANDLER( slapfight_port_06_w )
7979{
80   interrupt_enable_w(0,0);
80   interrupt_enable_w(machine,0,0);
8181}
8282
8383/* Enable hardware interrupt */
8484WRITE8_HANDLER( slapfight_port_07_w )
8585{
86   interrupt_enable_w(0,1);
86   interrupt_enable_w(machine,0,1);
8787}
8888
8989WRITE8_HANDLER( slapfight_port_08_w )
src/mame/machine/asteroid.c
r1877r1878
170170
171171MACHINE_RESET( asteroid )
172172{
173   asteroid_bank_switch_w (0,0);
174   avgdvg_reset_w (0,0);
173   asteroid_bank_switch_w(machine,0,0);
174   avgdvg_reset_w(machine,0,0);
175175}
176176
177177
src/mame/machine/mhavoc.c
r1877r1878
9292   memory_configure_bank(2, 0, 4,  memory_region(REGION_CPU1) + 0x10000, 0x2000);
9393
9494   /* reset RAM/ROM banks to 0 */
95   mhavoc_ram_banksel_w(0, 0);
96   mhavoc_rom_banksel_w(0, 0);
95   mhavoc_ram_banksel_w(machine, 0, 0);
96   mhavoc_rom_banksel_w(machine, 0, 0);
9797
9898   /* reset alpha comm status */
9999   alpha_data = 0;
src/mame/machine/equites.c
r1877r1878
329329WRITE8_HANDLER(equites_5232_w)
330330{
331331   if (offset < 0x08 && data) data |= 0x80; // gets around a current 5232 emulation restriction
332   MSM5232_0_w(offset, data);
332   MSM5232_0_w(machine, offset, data);
333333}
334334
335335WRITE8_HANDLER(equites_8910control_w)
336336{
337   AY8910_control_port_0_w(0, data);
337   AY8910_control_port_0_w(machine, 0, data);
338338}
339339
340340WRITE8_HANDLER(equites_8910data_w)
341341{
342   AY8910_write_port_0_w(0, data);
342   AY8910_write_port_0_w(machine, 0, data);
343343}
344344
345345static WRITE8_HANDLER(equites_8910porta_w)
src/mame/machine/decocass.c
r1877r1878
2828static UINT8 tape_crc16_lsb[256];
2929static UINT8 tape_crc16_msb[256];
3030
31static read8_handler decocass_dongle_r;
32static write8_handler decocass_dongle_w;
31static read8_machine_func decocass_dongle_r;
32static write8_machine_func decocass_dongle_w;
3333
3434static UINT8 decocass_reset;
3535static UINT8 i8041_p1;
r1877r1878
104104WRITE8_HANDLER( decocass_sound_command_w )
105105{
106106   LOG(2,("CPU #%d sound command -> $%02x\n", cpu_getactivecpu(), data));
107   soundlatch_w(0,data);
107   soundlatch_w(machine,0,data);
108108   decocass_sound_ack |= 0x80;
109109   /* remove snd cpu data ack bit. i don't see it in the schems, but... */
110110   decocass_sound_ack &= ~0x40;
111   cpunum_set_input_line(Machine, 1, M6502_IRQ_LINE, ASSERT_LINE);
111   cpunum_set_input_line(machine, 1, M6502_IRQ_LINE, ASSERT_LINE);
112112}
113113
114114READ8_HANDLER( decocass_sound_data_r )
115115{
116   UINT8 data = soundlatch2_r(0);
116   UINT8 data = soundlatch2_r(machine, 0);
117117   LOG(2,("CPU #%d sound data    <- $%02x\n", cpu_getactivecpu(), data));
118118   return data;
119119}
r1877r1878
128128WRITE8_HANDLER( decocass_sound_data_w )
129129{
130130   LOG(2,("CPU #%d sound data    -> $%02x\n", cpu_getactivecpu(), data));
131   soundlatch2_w(0, data);
131   soundlatch2_w(machine, 0, data);
132132   decocass_sound_ack |= 0x40;
133133}
134134
135135READ8_HANDLER( decocass_sound_command_r )
136136{
137   UINT8 data = soundlatch_r(0);
137   UINT8 data = soundlatch_r(machine, 0);
138138   LOG(4,("CPU #%d sound command <- $%02x\n", cpu_getactivecpu(), data));
139139   cpunum_set_input_line(Machine, 1, M6502_IRQ_LINE, CLEAR_LINE);
140140   decocass_sound_ack &= ~0x80;
r1877r1878
176176
177177WRITE8_HANDLER( decocass_nmi_reset_w )
178178{
179   cpunum_set_input_line(Machine, 0, INPUT_LINE_NMI, CLEAR_LINE );
179   cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, CLEAR_LINE );
180180}
181181
182182WRITE8_HANDLER( decocass_quadrature_decoder_reset_w )
183183{
184184   /* just latch the analog controls here */
185   decocass_quadrature_decoder[0] = input_port_3_r(0);
186   decocass_quadrature_decoder[1] = input_port_4_r(0);
187   decocass_quadrature_decoder[2] = input_port_5_r(0);
188   decocass_quadrature_decoder[3] = input_port_6_r(0);
185   decocass_quadrature_decoder[0] = input_port_3_r(machine, 0);
186   decocass_quadrature_decoder[1] = input_port_4_r(machine, 0);
187   decocass_quadrature_decoder[2] = input_port_5_r(machine, 0);
188   decocass_quadrature_decoder[3] = input_port_6_r(machine, 0);
189189}
190190
191191WRITE8_HANDLER( decocass_adc_w )
r1877r1878
15251525   else
15261526   {
15271527      if (decocass_dongle_r)
1528         data = (*decocass_dongle_r)(offset);
1528         data = (*decocass_dongle_r)(machine, offset);
15291529      else
15301530         data = 0xff;
15311531   }
r1877r1878
15361536{
15371537   if (decocass_dongle_w)
15381538   {
1539      (*decocass_dongle_w)(offset, data);
1539      (*decocass_dongle_w)(machine, offset, data);
15401540      return;
15411541   }
15421542
r1877r1878
15811581{
15821582   /* don't allow writes to the ROMs */
15831583   if (!de0091_enable)
1584      decocass_charram_w(offset, data);
1584      decocass_charram_w(machine, offset, data);
15851585}
15861586
15871587/***************************************************************************
src/mame/machine/copsnrob.c
r1877r1878
2525    default:
2626    case 0x00:
2727        current_car_image = copsnrob_carimage[0];
28        keys = input_port_4_r(0);
28        keys = input_port_4_r(machine,0);
2929        break;
3030    case 0x04:
3131        current_car_image = copsnrob_carimage[1];
32        keys = input_port_5_r(0);
32        keys = input_port_5_r(machine,0);
3333        break;
3434    case 0x08:
3535        current_car_image = copsnrob_carimage[2];
36        keys = input_port_6_r(0);
36        keys = input_port_6_r(machine,0);
3737        break;
3838    case 0x0c:
3939        current_car_image = copsnrob_carimage[3];
40        keys = input_port_7_r(0);
40        keys = input_port_7_r(machine,0);
41        break;
4142    }
4243
4344    if (current_car_image < 7)
src/mame/machine/konppc.c
r1877r1878
560560   }
561561   else
562562   {
563      voodoo_0_w(offset ^ 0x80000, data, mem_mask);
563      voodoo_0_w(machine, offset ^ 0x80000, data, mem_mask);
564564   }
565565}
566566
r1877r1878
577577   }
578578   else
579579   {
580      voodoo_1_w(offset ^ 0x80000, data, mem_mask);
580      voodoo_1_w(machine, offset ^ 0x80000, data, mem_mask);
581581   }
582582}
583583
r1877r1878
589589   }
590590   else
591591   {
592      return voodoo_0_r(offset, mem_mask);
592      return voodoo_0_r(machine, offset, mem_mask);
593593   }
594594}
595595
r1877r1878
601601   }
602602   else
603603   {
604      return voodoo_1_r(offset, mem_mask);
604      return voodoo_1_r(machine, offset, mem_mask);
605605   }
606606}
607607
r1877r1878
618618   }
619619   else
620620   {
621      voodoo_0_w(offset, data, mem_mask);
621      voodoo_0_w(machine, offset, data, mem_mask);
622622   }
623623}
624624
r1877r1878
635635   }
636636   else
637637   {
638      voodoo_1_w(offset, data, mem_mask);
638      voodoo_1_w(machine, offset, data, mem_mask);
639639   }
640640}
641641
r1877r1878
643643
644644#define LED_ON      0xff00ff00
645645
646void draw_7segment_led(mame_bitmap *bitmap, int x, int y, UINT8 value)
646void draw_7segment_led(bitmap_t *bitmap, int x, int y, UINT8 value)
647647{
648648   if ((value & 0x7f) == 0x7f)
649649   {
src/mame/machine/irobot.c
r1877r1878
209209   /* set an initial timer to go off on scanline 0 */
210210   timer_set(video_screen_get_time_until_pos(0, 0, 0), NULL, 0, scanline_callback);
211211
212   irobot_rom_banksel_w(0,0);
213   irobot_out0_w(0,0);
212   irobot_rom_banksel_w(machine,0,0);
213   irobot_out0_w(machine,0,0);
214214   irobot_combase = comRAM[0];
215215   irobot_combase_mb = comRAM[1];
216216   irobot_outx = 0;
src/mame/machine/leland.c
r1877r1878
372372
373373   /* reset globals */
374374   leland_gfx_control = 0x00;
375   leland_sound_port_w(0, 0xff);
375   leland_sound_port_w(machine, 0, 0xff);
376376   wcol_enable = 0;
377377
378378   dangerz_x = 512;
r1877r1878
515515   (*leland_update_master_bank)();
516516
517517   /* sound control is in the rest */
518   leland_80186_control_w(offset, data);
518   leland_80186_control_w(machine, offset, data);
519519}
520520
521521
r1877r1878
11561156
11571157      case 0x02:   /* /GIN2 */
11581158      case 0x12:
1159         cpunum_set_input_line(Machine, 0, INPUT_LINE_NMI, CLEAR_LINE);
1159         cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, CLEAR_LINE);
11601160         break;
11611161
11621162      case 0x03:   /* /IGID */
11631163      case 0x13:
1164         result = AY8910_read_port_0_r(offset);
1164         result = AY8910_read_port_0_r(machine, offset);
11651165         break;
11661166
11671167      case 0x10:   /* /GIN0 */
r1877r1878
11871187   switch (offset)
11881188   {
11891189      case 0x09:   /* /MCONT */
1190         cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE);
1190         cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE);
11911191         wcol_enable = (data & 0x02);
1192         cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, (data & 0x04) ? CLEAR_LINE : ASSERT_LINE);
1193         cpunum_set_input_line(Machine, 1, 0, (data & 0x08) ? CLEAR_LINE : ASSERT_LINE);
1192         cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, (data & 0x04) ? CLEAR_LINE : ASSERT_LINE);
1193         cpunum_set_input_line(machine, 1, 0, (data & 0x08) ? CLEAR_LINE : ASSERT_LINE);
11941194
11951195         if (LOG_EEPROM) logerror("%04X:EE write %d%d%d\n", safe_activecpu_get_pc(),
11961196               (data >> 6) & 1, (data >> 5) & 1, (data >> 4) & 1);
r1877r1878
12001200         break;
12011201
12021202      case 0x0a:   /* /OGIA */
1203         AY8910_control_port_0_w(0, data);
1203         AY8910_control_port_0_w(machine, 0, data);
12041204         break;
12051205
12061206      case 0x0b:   /* /OGID */
1207         AY8910_write_port_0_w(0, data);
1207         AY8910_write_port_0_w(machine, 0, data);
12081208         break;
12091209
12101210      case 0x0c:   /* /BKXL */
12111211      case 0x0d:   /* /BKXH */
12121212      case 0x0e:   /* /BKYL */
12131213      case 0x0f:   /* /BKYH */
1214         leland_scroll_w(offset - 0x0c, data);
1214         leland_scroll_w(machine, offset - 0x0c, data);
12151215         break;
12161216
12171217      default:
r1877r1878
12531253      case 0x01:   /* /BKXH */
12541254      case 0x02:   /* /BKYL */
12551255      case 0x03:   /* /BKYH */
1256         leland_scroll_w(offset, data);
1256         leland_scroll_w(machine, offset, data);
12571257         break;
12581258
12591259      case 0x04:   /* /MBNK */
r1877r1878
12651265         break;
12661266
12671267      case 0x05:   /* /SLV0 */
1268         cpunum_set_input_line(Machine, 1, 0, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE);
1269         cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, (data & 0x04) ? CLEAR_LINE : ASSERT_LINE);
1270         cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
1268         cpunum_set_input_line(machine, 1, 0, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE);
1269         cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, (data & 0x04) ? CLEAR_LINE : ASSERT_LINE);
1270         cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
12711271         break;
12721272
12731273      case 0x08:   /*  */
r1877r1878
12911291WRITE8_HANDLER( leland_gated_paletteram_w )
12921292{
12931293   if (wcol_enable)
1294      paletteram_BBGGGRRR_w(offset, data);
1294      paletteram_BBGGGRRR_w(machine, offset, data);
12951295}
12961296
12971297
r1877r1878
13061306WRITE8_HANDLER( ataxx_paletteram_and_misc_w )
13071307{
13081308   if (wcol_enable)
1309      paletteram_xxxxRRRRGGGGBBBB_le_w(offset, data);
1309      paletteram_xxxxRRRRGGGGBBBB_le_w(machine, offset, data);
13101310   else if (offset == 0x7f8 || offset == 0x7f9)
1311      leland_master_video_addr_w(offset - 0x7f8, data);
1311      leland_master_video_addr_w(machine, offset - 0x7f8, data);
13121312   else if (offset == 0x7fc)
13131313   {
13141314      xrom1_addr = (xrom1_addr & 0xff00) | (data & 0x00ff);
r1877r1878
13711371WRITE8_HANDLER( leland_sound_port_w )
13721372{
13731373    /* update the graphics banking */
1374      leland_gfx_port_w(0, data);
1374      leland_gfx_port_w(machine, 0, data);
13751375
13761376   /* set the new value */
13771377    leland_gfx_control = data;
src/mame/machine/konppc.h
r1877r1878
3939WRITE32_HANDLER(nwk_voodoo_0_w);
4040WRITE32_HANDLER(nwk_voodoo_1_w);
4141
42void draw_7segment_led(mame_bitmap *bitmap, int x, int y, UINT8 value);
42void draw_7segment_led(bitmap_t *bitmap, int x, int y, UINT8 value);
4343
4444#endif
src/mame/machine/midwayic.c
r1877r1878
250250}
251251
252252
253#ifdef UNUSED_FUNCTON
253254INLINE UINT8 unmake_bcd(UINT8 data)
254255{
255256   return ((data & 0xf0) >> 4) * 10 + (data & 0x0f);
256257}
258#endif
257259
258
259260static TIMER_CALLBACK( reset_timer )
260261{
261262   pic.time_just_written = 0;
r1877r1878
852853{
853854   UINT32 result = 0;
854855   if ((mem_mask & 0x0000ffff) != 0x0000ffff)
855      result |= midway_ioasic_r(offset*2, 0xffff0000) & 0xffff;
856      result |= midway_ioasic_r(machine, offset*2, 0xffff0000) & 0xffff;
856857   if ((mem_mask & 0xffff0000) != 0xffff0000)
857      result |= (midway_ioasic_r(offset*2+1, 0xffff0000) & 0xffff) << 16;
858      result |= (midway_ioasic_r(machine, offset*2+1, 0xffff0000) & 0xffff) << 16;
858859   return result;
859860}
860861
r1877r1878
948949WRITE32_HANDLER( midway_ioasic_packed_w )
949950{
950951   if ((mem_mask & 0x0000ffff) != 0x0000ffff)
951      midway_ioasic_w(offset*2, data & 0xffff, 0xffff0000);
952      midway_ioasic_w(machine, offset*2, data & 0xffff, 0xffff0000);
952953   if ((mem_mask & 0xffff0000) != 0xffff0000)
953      midway_ioasic_w(offset*2+1, data >> 16, 0xffff0000);
954      midway_ioasic_w(machine, offset*2+1, data >> 16, 0xffff0000);
954955}
955956
956957
r1877r1878
10741075
10751076   /* offset 0 is a special case */
10761077   if (offset == 0)
1077      result = ide_controller32_0_r(ideoffs, 0xffff0000);
1078      result = ide_controller32_0_r(machine, ideoffs, 0xffff0000);
10781079
10791080   /* everything else is byte-sized */
10801081   else
1081      result = ide_controller32_0_r(ideoffs, ~(0xff << shift)) >> shift;
1082      result = ide_controller32_0_r(machine, ideoffs, ~(0xff << shift)) >> shift;
10821083   return result;
10831084}
10841085
r1877r1878
10911092
10921093   /* offset 0 is a special case */
10931094   if (offset == 0)
1094      ide_controller32_0_w(ideoffs, data, 0xffff0000);
1095      ide_controller32_0_w(machine, ideoffs, data, 0xffff0000);
10951096
10961097   /* everything else is byte-sized */
10971098   else
1098      ide_controller32_0_w(ideoffs, data << shift, ~(0xff << shift));
1099      ide_controller32_0_w(machine, ideoffs, data << shift, ~(0xff << shift));
10991100}
src/mame/machine/segas24.c
r1877r1878
2424     range
2525*/
2626
27static UINT8  (*system24temp_sys16_io_io_r)(int port);
28static void   (*system24temp_sys16_io_io_w)(int port, UINT8 data);
27static UINT8  (*system24temp_sys16_io_io_r)(running_machine *machine, int port);
28static void   (*system24temp_sys16_io_io_w)(running_machine *machine, int port, UINT8 data);
2929static void   (*system24temp_sys16_io_cnt_w)(UINT8 data);
3030static READ16_HANDLER ((*system24temp_sys16_io_iod_r));
3131static WRITE16_HANDLER((*system24temp_sys16_io_iod_w));
3232static UINT8 system24temp_sys16_io_cnt, system24temp_sys16_io_dir;
3333
34void system24temp_sys16_io_set_callbacks(UINT8 (*io_r)(int port),
35                       void  (*io_w)(int port, UINT8 data),
34void system24temp_sys16_io_set_callbacks(UINT8 (*io_r)(running_machine *machine, int port),
35                       void  (*io_w)(running_machine *machine, int port, UINT8 data),
3636                       void  (*cnt_w)(UINT8 data),
3737                       READ16_HANDLER ((*iod_r)),
3838                       WRITE16_HANDLER((*iod_w)))
r1877r1878
5050{
5151   //  logerror("IO read %02x (%d:%x)\n", offset, cpu_getactivecpu(), activecpu_get_pc());
5252   if(offset < 8)
53      return system24temp_sys16_io_io_r ? system24temp_sys16_io_io_r(offset) : 0xff;
53      return system24temp_sys16_io_io_r ? system24temp_sys16_io_io_r(machine,offset) : 0xff;
5454   else if (offset < 0x20) {
5555      switch(offset) {
5656      case 0x8:
r1877r1878
7070         return 0xff;
7171      }
7272   } else
73      return system24temp_sys16_io_iod_r ? system24temp_sys16_io_iod_r(offset & 0x1f, mem_mask) : 0xff;
73      return system24temp_sys16_io_iod_r ? system24temp_sys16_io_iod_r(machine, offset & 0x1f, mem_mask) : 0xff;
7474}
7575
7676READ32_HANDLER(system24temp_sys16_io_dword_r)
7777{
78   return system24temp_sys16_io_r(2*offset, mem_mask)|(system24temp_sys16_io_r(2*offset+1, mem_mask>>16)<<16);
78   return system24temp_sys16_io_r(machine, 2*offset, mem_mask)|(system24temp_sys16_io_r(machine,2*offset+1, mem_mask>>16)<<16);
7979}
8080
8181
r1877r1878
8888            return;
8989         }
9090         if(system24temp_sys16_io_io_w)
91            system24temp_sys16_io_io_w(offset, data);
91            system24temp_sys16_io_io_w(machine, offset, data);
9292      } else if (offset < 0x20) {
9393         switch(offset) {
9494         case 0xe:
r1877r1878
105105      }
106106   }
107107   if(offset >= 0x20 && system24temp_sys16_io_iod_w)
108      system24temp_sys16_io_iod_w(offset & 0x1f, data, mem_mask);
108      system24temp_sys16_io_iod_w(machine, offset & 0x1f, data, mem_mask);
109109}
src/mame/machine/konamigx.c
r1877r1878
146146
147147READ16_HANDLER( tms57002_data_word_r )
148148{
149   return(tms57002_data_r(0));
149   return(tms57002_data_r(machine,0));
150150}
151151
152152READ16_HANDLER( tms57002_status_word_r )
153153{
154   return(tms57002_status_r(0));
154   return(tms57002_status_r(machine,0));
155155}
156156
157157WRITE16_HANDLER( tms57002_control_word_w )
158158{
159   tms57002_control_w(0, data);
159   tms57002_control_w(machine, 0, data);
160160}
161161
162162WRITE16_HANDLER( tms57002_data_word_w )
163163{
164   tms57002_data_w(0, data);
164   tms57002_data_w(machine, 0, data);
165165}
166166
167167
r1877r1878
208208   cliprect->max_y = maxy;
209209}
210210
211INLINE void K053936GP_copyroz32clip( mame_bitmap *dst_bitmap, mame_bitmap *src_bitmap,
211INLINE void K053936GP_copyroz32clip( bitmap_t *dst_bitmap, bitmap_t *src_bitmap,
212212      const rectangle *dst_cliprect, const rectangle *src_cliprect,
213213      UINT32 _startx,UINT32 _starty,int _incxx,int _incxy,int _incyx,int _incyy,
214214      int tilebpp, int blend, int clip )
r1877r1878
359359
360360// adpoted from generic K053936_zoom_draw()
361361static void K053936GP_zoom_draw(int chip, UINT16 *ctrl, UINT16 *linectrl,
362      mame_bitmap *bitmap, const rectangle *cliprect, tilemap *tmap,
362      bitmap_t *bitmap, const rectangle *cliprect, tilemap *tmap,
363363      int tilebpp, int blend)
364364{
365   mame_bitmap *src_bitmap;
365   bitmap_t *src_bitmap;
366366   rectangle *src_cliprect;
367367   UINT16 *lineaddr;
368368
r1877r1878
427427   }
428428}
429429
430void K053936GP_0_zoom_draw(mame_bitmap *bitmap, const rectangle *cliprect,
430void K053936GP_0_zoom_draw(bitmap_t *bitmap, const rectangle *cliprect,
431431      tilemap *tmap, int tilebpp, int blend)
432432{
433433   K053936GP_zoom_draw(0,K053936_0_ctrl,K053936_0_linectrl,bitmap,cliprect,tmap,tilebpp,blend);
434434}
435435
436void K053936GP_1_zoom_draw(mame_bitmap *bitmap, const rectangle *cliprect,
436void K053936GP_1_zoom_draw(bitmap_t *bitmap, const rectangle *cliprect,
437437      tilemap *tmap, int tilebpp, int blend)
438438{
439439   K053936GP_zoom_draw(1,K053936_1_ctrl,K053936_1_linectrl,bitmap,cliprect,tmap,tilebpp,blend);
r1877r1878
457457    pri     : 0 = topmost, 255 = backmost (pixel priority)
458458*/
459459
460INLINE void zdrawgfxzoom32GP( mame_bitmap *bitmap, const gfx_element *gfx, const rectangle *cliprect,
460INLINE void zdrawgfxzoom32GP( bitmap_t *bitmap, const gfx_element *gfx, const rectangle *cliprect,
461461      UINT32 code, UINT32 color, int flipx, int flipy, int sx, int sy,
462462      int scalex, int scaley, int alpha, int drawmode, int zcode, int pri)
463463{
r1877r1878
12261226   if (gx_objdma && gx_spriteram && K053247_ram) memcpy(gx_spriteram, K053247_ram, 0x1000);
12271227}
12281228
1229void konamigx_mixer(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect,
1229void konamigx_mixer(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect,
12301230               tilemap *sub1, int sub1flags,
12311231               tilemap *sub2, int sub2flags,
12321232               int mixerflags)
src/mame/machine/toaplan1.c
r1877r1878
160160{
161161   /* Bit 0x80 is secondary CPU (HD647180) ready signal */
162162   logerror("PC:%04x Warning !!! IO reading from $14000a\n",activecpu_get_previouspc());
163   return (0x80 | input_port_6_word_r(0,0)) & 0xff;
163   return (0x80 | input_port_6_word_r(machine,0,0)) & 0xff;
164164}
165165
166166READ16_HANDLER( vimana_input_port_5_word_r )
167167{
168168   int data, p;
169169
170   p = input_port_5_word_r(0,0);
170   p = input_port_5_word_r(machine,0,0);
171171   vimana_latch ^= p;
172172   data = (vimana_latch & p );
173173
r1877r1878
283283{
284284   if (ACCESSING_LSB)
285285   {
286      toaplan1_coin_w(offset, data & 0xff);
286      toaplan1_coin_w(machine, offset, data & 0xff);
287287   }
288288   if (ACCESSING_MSB && (data&0xff00))
289289   {
src/mame/machine/daikaiju.c
r1877r1878
258258         }
259259         return n;
260260      }
261      return 0;
262261
263262      case MCU_ADDRESS1:
264263      {
r1877r1878
277276            return address>>8;
278277         }
279278      }
280      return 0;
281279
282280      case MCU_ADDRESS2:
283281      {
r1877r1878
296294            return address>>8;
297295         }
298296      }
299      return 0;
300297
301298      case MCU_MESSAGE:
302299         return daikaiju_buffer[1];
r1877r1878
342339
343340READ8_HANDLER( daikaiju_mcu_status_r )
344341{
345   int res = input_port_3_r(0);
342   int res = input_port_3_r(machine,0);
346343
347344   res^=mame_rand(Machine)&3;
348345   res |=((lsasquad_sound_pending & 0x02)^2)<<3; //inverted flag
src/mame/machine/konamigx.h
r1877r1878
2121void K053936GP_set_offset(int chip, int xoffs, int yoffs);
2222void K053936GP_clip_enable(int chip, int status);
2323void K053936GP_set_cliprect(int chip, int minx, int maxx, int miny, int maxy);
24void K053936GP_0_zoom_draw(mame_bitmap *bitmap, const rectangle *cliprect, tilemap *tmap, int tilebpp, int blend);
25void K053936GP_1_zoom_draw(mame_bitmap *bitmap, const rectangle *cliprect, tilemap *tmap, int tilebpp, int blend);
24void K053936GP_0_zoom_draw(bitmap_t *bitmap, const rectangle *cliprect, tilemap *tmap, int tilebpp, int blend);
25void K053936GP_1_zoom_draw(bitmap_t *bitmap, const rectangle *cliprect, tilemap *tmap, int tilebpp, int blend);
2626
2727
2828
r1877r1878
8383#define GXSUB_5BPP       0x05   //  32 colors
8484#define GXSUB_8BPP       0x08   // 256 colors
8585
86void konamigx_mixer(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect,
86void konamigx_mixer(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect,
8787               tilemap *sub1, int sub1flags,
8888               tilemap *sub2, int sub2flags,
8989               int mixerflags);
src/mame/machine/stvcd.c
r1877r1878
457457         break;
458458   }
459459
460   return 0xffff;
461460}
462461
463462static UINT32 cd_readLong(UINT32 addr)
src/mame/machine/ticket.c
r1877r1878
6666***************************************************************************/
6767READ8_HANDLER( ticket_dispenser_r )
6868{
69   return ticket_dispenser_0_r(offset);
69   return ticket_dispenser_0_r(machine, offset);
7070}
7171
7272READ8_HANDLER( ticket_dispenser_0_r )
r1877r1878
8686***************************************************************************/
8787WRITE8_HANDLER( ticket_dispenser_w )
8888{
89   ticket_dispenser_0_w(offset, data);
89   ticket_dispenser_0_w(machine, offset, data);
9090}
9191
9292WRITE8_HANDLER( ticket_dispenser_0_w )
src/mame/machine/namcoio.c
r1877r1878
146146struct namcoio
147147{
148148   INT32 type;
149   read8_handler in[4];
150   write8_handler out[2];
149   read8_machine_func in[4];
150   write8_machine_func out[2];
151151   INT32 reset;
152152   INT32 lastcoins,lastbuttons;
153153   INT32 credits;
r1877r1878
165165static READ8_HANDLER( nop_r ) { return 0x0f; }
166166static WRITE8_HANDLER( nop_w ) { }
167167
168#define READ_PORT(n)   (io[chip].in[n](0) & 0x0f)
169#define WRITE_PORT(n,d)   io[chip].out[n](0,(d) & 0x0f)
168#define READ_PORT(m,n)   (io[chip].in[n](m,0) & 0x0f)
169#define WRITE_PORT(m,n,d)   io[chip].out[n](m,0,(d) & 0x0f)
170170
171171
172172
r1877r1878
18418407: nop
185185*/
186186
187static void namcoio_51XX_write(int chip,int data)
187static void namcoio_51XX_write(running_machine *machine,int chip,int data)
188188{
189189   data &= 0x07;
190190
r1877r1878
282282{    0xf, 0xe, 0xd, 0x5, 0xc, 0x9, 0x7, 0x6, 0xb, 0x3, 0xa, 0x4, 0x1, 0x2, 0x0, 0x8 };
283283
284284
285static UINT8 namcoio_51XX_read(int chip)
285static UINT8 namcoio_51XX_read(running_machine *machine, int chip)
286286{
287287   LOG(("%04x: custom 51XX read\n",activecpu_get_pc()));
288288
r1877r1878
291291      switch ((io[chip].in_count++) % 3)
292292      {
293293         default:
294         case 0: return READ_PORT(0) | (READ_PORT(1) << 4);
295         case 1: return READ_PORT(2) | (READ_PORT(3) << 4);
294         case 0: return READ_PORT(machine,0) | (READ_PORT(machine,1) << 4);
295         case 1: return READ_PORT(machine,2) | (READ_PORT(machine,3) << 4);
296296         case 2: return 0;   // nothing?
297297      }
298298   }
r1877r1878
305305            {
306306               int in,toggle;
307307
308               in = ~(READ_PORT(0) | (READ_PORT(1) << 4));
308               in = ~(READ_PORT(machine,0) | (READ_PORT(machine,1) << 4));
309309               toggle = in ^ io[chip].lastcoins;
310310               io[chip].lastcoins = in;
311311
r1877r1878
313313               {
314314                  if (io[chip].credits >= 99)
315315                  {
316                     WRITE_PORT(1,1);   // coin lockout
316                     WRITE_PORT(machine,1,1);   // coin lockout
317317                  }
318318                  else
319319                  {
320                     WRITE_PORT(1,0);   // coin lockout
320                     WRITE_PORT(machine,1,0);   // coin lockout
321321                     /* check if the user inserted a coin */
322322                     if (toggle & in & 0x10)
323323                     {
324324                        io[chip].coins[0]++;
325                        WRITE_PORT(0,0x04);   // coin counter
326                        WRITE_PORT(0,0x0c);
325                        WRITE_PORT(machine,0,0x04);   // coin counter
326                        WRITE_PORT(machine,0,0x0c);
327327                        if (io[chip].coins[0] >= io[chip].coins_per_cred[0])
328328                        {
329329                           io[chip].credits += io[chip].creds_per_coin[0];
r1877r1878
333333                     if (toggle & in & 0x20)
334334                     {
335335                        io[chip].coins[1]++;
336                        WRITE_PORT(0,0x08);   // coin counter
337                        WRITE_PORT(0,0x0c);
336                        WRITE_PORT(machine,0,0x08);   // coin counter
337                        WRITE_PORT(machine,0,0x0c);
338338                        if (io[chip].coins[1] >= io[chip].coins_per_cred[1])
339339                        {
340340                           io[chip].credits += io[chip].creds_per_coin[1];
r1877r1878
351351
352352               if (io[chip].mode == 1)
353353               {
354                  int on = (cpu_getcurrentframe() & 0x10) >> 4;
354                  int on = (video_screen_get_frame_number(0) & 0x10) >> 4;
355355
356356                  if (io[chip].credits >= 2)
357                     WRITE_PORT(0,0x0c | 3*on);   // lamps
357                     WRITE_PORT(machine,0,0x0c | 3*on);   // lamps
358358                  else if (io[chip].credits >= 1)
359                     WRITE_PORT(0,0x0c | 2*on);   // lamps
359                     WRITE_PORT(machine,0,0x0c | 2*on);   // lamps
360360                  else
361                     WRITE_PORT(0,0x0c);   // lamps off
361                     WRITE_PORT(machine,0,0x0c);   // lamps off
362362
363363                  /* check for 1 player start button */
364364                  if (toggle & in & 0x04)
r1877r1878
367367                     {
368368                        io[chip].credits--;
369369                        io[chip].mode = 2;
370                        WRITE_PORT(0,0x0c);   // lamps off
370                        WRITE_PORT(machine,0,0x0c);   // lamps off
371371                     }
372372                  }
373373                  /* check for 2 players start button */
r1877r1878
377377                     {
378378                        io[chip].credits -= 2;
379379                        io[chip].mode = 2;
380                        WRITE_PORT(0,0x0c);   // lamps off
380                        WRITE_PORT(machine,0,0x0c);   // lamps off
381381                     }
382382                  }
383383               }
r1877r1878
390390
391391         case 1:
392392            {
393               int joy = READ_PORT(2) & 0x0f;
393               int joy = READ_PORT(machine,2) & 0x0f;
394394               int in,toggle;
395395
396               in = ~READ_PORT(0);
396               in = ~READ_PORT(machine,0);
397397               toggle = in ^ io[chip].lastbuttons;
398398               io[chip].lastbuttons = (io[chip].lastbuttons & 2) | (in & 1);
399399
r1877r1878
409409
410410         case 2:
411411            {
412               int joy = READ_PORT(3) & 0x0f;
412               int joy = READ_PORT(machine,3) & 0x0f;
413413               int in,toggle;
414414
415               in = ~READ_PORT(0);
415               in = ~READ_PORT(machine,0);
416416               toggle = in ^ io[chip].lastbuttons;
417417               io[chip].lastbuttons = (io[chip].lastbuttons & 1) | (in & 2);
418418
r1877r1878
439439#define IORAM_WRITE(offset,data) {namcoio_ram[chip * 0x10 + (offset)] = (data) & 0x0f;}
440440
441441
442static void handle_coins(int chip,int swap)
442static void handle_coins(running_machine *machine,int chip,int swap)
443443{
444444   int val,toggled;
445445   int credit_add = 0;
r1877r1878
448448
449449//popmessage("%x %x %x %x %x %x %x %x",IORAM_READ(8),IORAM_READ(9),IORAM_READ(10),IORAM_READ(11),IORAM_READ(12),IORAM_READ(13),IORAM_READ(14),IORAM_READ(15));
450450
451   val = ~READ_PORT(0);   // pins 38-41
451   val = ~READ_PORT(machine,0);   // pins 38-41
452452   toggled = val ^ io[chip].lastcoins;
453453   io[chip].lastcoins = val;
454454
r1877r1878
480480      credit_add = 1;
481481   }
482482
483   val = ~READ_PORT(3);   // pins 30-33
483   val = ~READ_PORT(machine,3);   // pins 30-33
484484   toggled = val ^ io[chip].lastbuttons;
485485   io[chip].lastbuttons = val;
486486
r1877r1878
504504   IORAM_WRITE(1 ^ swap, io[chip].credits % 10);   // BCD credits
505505   IORAM_WRITE(2 ^ swap, credit_add);   // credit increment (coin inputs)
506506   IORAM_WRITE(3 ^ swap, credit_sub);   // credit decrement (start buttons)
507   IORAM_WRITE(4, ~READ_PORT(1));   // pins 22-25
507   IORAM_WRITE(4, ~READ_PORT(machine,1));   // pins 22-25
508508   button = ((val & 0x05) << 1) | (val & toggled & 0x05);
509509   IORAM_WRITE(5, button);   // pins 30 & 32 normal and impulse
510   IORAM_WRITE(6, ~READ_PORT(2));   // pins 26-29
510   IORAM_WRITE(6, ~READ_PORT(machine,2));   // pins 26-29
511511   button = (val & 0x0a) | ((val & toggled & 0x0a) >> 1);
512512   IORAM_WRITE(7, button);   // pins 31 & 33 normal and impulse
513513}
514514
515515
516516
517static void namco_customio_56XX_run(int chip)
517static void namco_customio_56XX_run(running_machine *machine, int chip)
518518{
519519   LOG(("execute 56XX %d mode %d\n",chip,IORAM_READ(8)));
520520
r1877r1878
524524         break;
525525
526526      case 1:   // read switch inputs
527         IORAM_WRITE(0, ~READ_PORT(0));   // pins 38-41
528         IORAM_WRITE(1, ~READ_PORT(1));   // pins 22-25
529         IORAM_WRITE(2, ~READ_PORT(2));   // pins 26-29
530         IORAM_WRITE(3, ~READ_PORT(3));   // pins 30-33
527         IORAM_WRITE(0, ~READ_PORT(machine,0));   // pins 38-41
528         IORAM_WRITE(1, ~READ_PORT(machine,1));   // pins 22-25
529         IORAM_WRITE(2, ~READ_PORT(machine,2));   // pins 26-29
530         IORAM_WRITE(3, ~READ_PORT(machine,3));   // pins 30-33
531531
532532//popmessage("%x %x %x %x %x %x %x %x",IORAM_READ(8),IORAM_READ(9),IORAM_READ(10),IORAM_READ(11),IORAM_READ(12),IORAM_READ(13),IORAM_READ(14),IORAM_READ(15));
533533
534         WRITE_PORT(0,IORAM_READ(9));   // output to pins 13-16 (motos, pacnpal, gaplus)
535         WRITE_PORT(1,IORAM_READ(10));   // output to pins 17-20 (gaplus)
534         WRITE_PORT(machine,0,IORAM_READ(9));   // output to pins 13-16 (motos, pacnpal, gaplus)
535         WRITE_PORT(machine,1,IORAM_READ(10));   // output to pins 17-20 (gaplus)
536536         break;
537537
538538      case 2:   // initialize coinage settings
r1877r1878
547547
548548      case 4:   // druaga, digdug chip #1: read dip switches and inputs
549549            // superpac chip #0: process coin and start inputs, read switch inputs
550         handle_coins(chip,0);
550         handle_coins(machine,chip,0);
551551         break;
552552
553553      case 7:   // bootup check (liblrabl only)
r1877r1878
575575         break;
576576
577577      case 9:   // read dip switches and inputs
578         WRITE_PORT(0,0);   // set pin 13 = 0
579         IORAM_WRITE(0, ~READ_PORT(0));   // pins 38-41, pin 13 = 0
580         IORAM_WRITE(2, ~READ_PORT(1));   // pins 22-25, pin 13 = 0
581         IORAM_WRITE(4, ~READ_PORT(2));   // pins 26-29, pin 13 = 0
582         IORAM_WRITE(6, ~READ_PORT(3));   // pins 30-33, pin 13 = 0
583         WRITE_PORT(0,1);   // set pin 13 = 1
584         IORAM_WRITE(1, ~READ_PORT(0));   // pins 38-41, pin 13 = 1
585         IORAM_WRITE(3, ~READ_PORT(1));   // pins 22-25, pin 13 = 1
586         IORAM_WRITE(5, ~READ_PORT(2));   // pins 26-29, pin 13 = 1
587         IORAM_WRITE(7, ~READ_PORT(3));   // pins 30-33, pin 13 = 1
578         WRITE_PORT(machine,0,0);   // set pin 13 = 0
579         IORAM_WRITE(0, ~READ_PORT(machine,0));   // pins 38-41, pin 13 = 0
580         IORAM_WRITE(2, ~READ_PORT(machine,1));   // pins 22-25, pin 13 = 0
581         IORAM_WRITE(4, ~READ_PORT(machine,2));   // pins 26-29, pin 13 = 0
582         IORAM_WRITE(6, ~READ_PORT(machine,3));   // pins 30-33, pin 13 = 0
583         WRITE_PORT(machine,0,1);   // set pin 13 = 1
584         IORAM_WRITE(1, ~READ_PORT(machine,0));   // pins 38-41, pin 13 = 1
585         IORAM_WRITE(3, ~READ_PORT(machine,1));   // pins 22-25, pin 13 = 1
586         IORAM_WRITE(5, ~READ_PORT(machine,2));   // pins 26-29, pin 13 = 1
587         IORAM_WRITE(7, ~READ_PORT(machine,3));   // pins 30-33, pin 13 = 1
588588         break;
589589
590590      default:
r1877r1878
594594
595595
596596
597static void namco_customio_59XX_run(int chip)
597static void namco_customio_59XX_run(running_machine *machine, int chip)
598598{
599599   LOG(("execute 59XX %d mode %d\n",chip,IORAM_READ(8)));
600600
r1877r1878
604604         break;
605605
606606      case 3:   // pacnpal chip #1: read dip switches and inputs
607         IORAM_WRITE(4, ~READ_PORT(0));   // pins 38-41, pin 13 = 0 ?
608         IORAM_WRITE(5, ~READ_PORT(2));   // pins 26-29 ?
609         IORAM_WRITE(6, ~READ_PORT(1));   // pins 22-25 ?
610         IORAM_WRITE(7, ~READ_PORT(3));   // pins 30-33
607         IORAM_WRITE(4, ~READ_PORT(machine,0));   // pins 38-41, pin 13 = 0 ?
608         IORAM_WRITE(5, ~READ_PORT(machine,2));   // pins 26-29 ?
609         IORAM_WRITE(6, ~READ_PORT(machine,1));   // pins 22-25 ?
610         IORAM_WRITE(7, ~READ_PORT(machine,3));   // pins 30-33
611611         break;
612612
613613      default:
r1877r1878
617617
618618
619619
620static void namco_customio_58XX_run(int chip)
620static void namco_customio_58XX_run(running_machine *machine, int chip)
621621{
622622   LOG(("execute 58XX %d mode %d\n",chip,IORAM_READ(8)));
623623
r1877r1878
627627         break;
628628
629629      case 1:   // read switch inputs
630         IORAM_WRITE(4, ~READ_PORT(0));   // pins 38-41
631         IORAM_WRITE(5, ~READ_PORT(1));   // pins 22-25
632         IORAM_WRITE(6, ~READ_PORT(2));   // pins 26-29
633         IORAM_WRITE(7, ~READ_PORT(3));   // pins 30-33
630         IORAM_WRITE(4, ~READ_PORT(machine,0));   // pins 38-41
631         IORAM_WRITE(5, ~READ_PORT(machine,1));   // pins 22-25
632         IORAM_WRITE(6, ~READ_PORT(machine,2));   // pins 26-29
633         IORAM_WRITE(7, ~READ_PORT(machine,3));   // pins 30-33
634634
635635//popmessage("%x %x %x %x %x %x %x %x",IORAM_READ(8),IORAM_READ(9),IORAM_READ(10),IORAM_READ(11),IORAM_READ(12),IORAM_READ(13),IORAM_READ(14),IORAM_READ(15));
636636
637         WRITE_PORT(0,IORAM_READ(9));   // output to pins 13-16 (toypop)
638         WRITE_PORT(1,IORAM_READ(10));   // output to pins 17-20 (toypop)
637         WRITE_PORT(machine,0,IORAM_READ(9));   // output to pins 13-16 (toypop)
638         WRITE_PORT(machine,1,IORAM_READ(10));   // output to pins 17-20 (toypop)
639639         break;
640640
641641      case 2:   // initialize coinage settings
r1877r1878
649649         break;
650650
651651      case 3:   // process coin and start inputs, read switch inputs
652         handle_coins(chip,2);
652         handle_coins(machine,chip,2);
653653         break;
654654
655655      case 4:   // read dip switches and inputs
656         WRITE_PORT(0,0);   // set pin 13 = 0
657         IORAM_WRITE(0, ~READ_PORT(0));   // pins 38-41, pin 13 = 0
658         IORAM_WRITE(2, ~READ_PORT(1));   // pins 22-25, pin 13 = 0
659         IORAM_WRITE(4, ~READ_PORT(2));   // pins 26-29, pin 13 = 0
660         IORAM_WRITE(6, ~READ_PORT(3));   // pins 30-33, pin 13 = 0
661         WRITE_PORT(0,1);   // set pin 13 = 1
662         IORAM_WRITE(1, ~READ_PORT(0));   // pins 38-41, pin 13 = 1
663         IORAM_WRITE(3, ~READ_PORT(1));   // pins 22-25, pin 13 = 1
664         IORAM_WRITE(5, ~READ_PORT(2));   // pins 26-29, pin 13 = 1
665         IORAM_WRITE(7, ~READ_PORT(3));   // pins 30-33, pin 13 = 1
656         WRITE_PORT(machine,0,0);   // set pin 13 = 0
657         IORAM_WRITE(0, ~READ_PORT(machine,0));   // pins 38-41, pin 13 = 0
658         IORAM_WRITE(2, ~READ_PORT(machine,1));   // pins 22-25, pin 13 = 0
659         IORAM_WRITE(4, ~READ_PORT(machine,2));   // pins 26-29, pin 13 = 0
660         IORAM_WRITE(6, ~READ_PORT(machine,3));   // pins 30-33, pin 13 = 0
661         WRITE_PORT(machine,0,1);   // set pin 13 = 1
662         IORAM_WRITE(1, ~READ_PORT(machine,0));   // pins 38-41, pin 13 = 1
663         IORAM_WRITE(3, ~READ_PORT(machine,1));   // pins 22-25, pin 13 = 1
664         IORAM_WRITE(5, ~READ_PORT(machine,2));   // pins 26-29, pin 13 = 1
665         IORAM_WRITE(7, ~READ_PORT(machine,3));   // pins 30-33, pin 13 = 1
666666         break;
667667
668668      case 5:   // bootup check
r1877r1878
766766   switch (io[param].type)
767767   {
768768      case NAMCOIO_56XX:
769         namco_customio_56XX_run(param);
769         namco_customio_56XX_run(machine, param);
770770         break;
771771      case NAMCOIO_58XX:
772         namco_customio_58XX_run(param);
772         namco_customio_58XX_run(machine, param);
773773         break;
774774      case NAMCOIO_59XX:
775         namco_customio_59XX_run(param);
775         namco_customio_59XX_run(machine, param);
776776         break;
777777   }
778778}
r1877r1878
867867
868868
869869
870static UINT8 namcoio_53XX_digdug_read(int chip)
870static UINT8 namcoio_53XX_digdug_read(running_machine *machine, int chip)
871871{
872872   LOG(("%04x: custom 53XX read\n",activecpu_get_pc()));
873873
874874   switch ((io[chip].in_count++) % 2)
875875   {
876876      default:
877      case 0: return READ_PORT(0) | (READ_PORT(1) << 4);
878      case 1: return READ_PORT(2) | (READ_PORT(3) << 4);
877      case 0: return READ_PORT(machine,0) | (READ_PORT(machine,1) << 4);
878      case 1: return READ_PORT(machine,2) | (READ_PORT(machine,3) << 4);
879879   }
880880}
881881
882882
883static UINT8 namcoio_53XX_polepos_read(int chip)
883static UINT8 namcoio_53XX_polepos_read(running_machine *machine,int chip)
884884{
885885   LOG(("%04x: custom 53XX read\n",activecpu_get_pc()));
886886
887887   switch ((io[chip].in_count++) % 8)
888888   {
889      case 0: return READ_PORT(0) | (READ_PORT(1) << 4);   // steering
890      case 4: return READ_PORT(2) | (READ_PORT(3) << 4);   // dip switches
889      case 0: return READ_PORT(machine,0) | (READ_PORT(machine,1) << 4);   // steering
890      case 4: return READ_PORT(machine,2) | (READ_PORT(machine,3) << 4);   // dip switches
891891      default: return 0xff;   // polepos2 hangs if 0 is returned
892892   }
893893}
894894
895895
896static UINT8 namco_06xx_data_read(int chipnum)
896static UINT8 namco_06xx_data_read(running_machine *machine, int chipnum)
897897{
898898   LOG(("forwarding read to chip %d\n",chipnum%3));
899899
r1877r1878
901901   {
902902      case NAMCOIO_50XX:   return namco_50xx_read();
903903      case NAMCOIO_50XX_2: return namco_50xx_2_read();
904      case NAMCOIO_51XX: return namcoio_51XX_read(chipnum);
905      case NAMCOIO_53XX_DIGDUG:  return namcoio_53XX_digdug_read(chipnum);
906      case NAMCOIO_53XX_POLEPOS: return namcoio_53XX_polepos_read(chipnum);
904      case NAMCOIO_51XX: return namcoio_51XX_read(machine, chipnum);
905      case NAMCOIO_53XX_DIGDUG:  return namcoio_53XX_digdug_read(machine, chipnum);
906      case NAMCOIO_53XX_POLEPOS: return namcoio_53XX_polepos_read(machine, chipnum);
907907      default:
908908         logerror("%04x: custom IO type %d unsupported read\n",activecpu_get_pc(),io[chipnum].type);
909909         return 0xff;
r1877r1878
911911}
912912
913913
914static void namco_06xx_data_write(int chipnum,UINT8 data)
914static void namco_06xx_data_write(running_machine *machine,int chipnum,UINT8 data)
915915{
916916   LOG(("forwarding write to chip %d\n",chipnum%3));
917917
r1877r1878
919919   {
920920      case NAMCOIO_50XX:   namco_50xx_write(data); break;
921921      case NAMCOIO_50XX_2: namco_50xx_2_write(data); break;
922      case NAMCOIO_51XX:   namcoio_51XX_write(chipnum,data); break;
922      case NAMCOIO_51XX:   namcoio_51XX_write(machine,chipnum,data); break;
923923      case NAMCOIO_52XX:   namcoio_52XX_write(data); break;
924924      case NAMCOIO_54XX:   namco_54xx_write(data); break;
925925      default:
r1877r1878
944944}
945945
946946
947static UINT8 namco_06xx_data_r(int chip,int offset)
947static UINT8 namco_06xx_data_r(running_machine *machine,int chip,int offset)
948948{
949949   LOG(("%04x: 06XX #%d read offset %d\n",activecpu_get_pc(),chip,offset));
950950
r1877r1878
956956
957957   switch (customio_command[chip] & 0xf)
958958   {
959      case 0x1: return namco_06xx_data_read(4*chip + 0); break;
960      case 0x2: return namco_06xx_data_read(4*chip + 1); break;
961      case 0x4: return namco_06xx_data_read(4*chip + 2); break;
962      case 0x8: return namco_06xx_data_read(4*chip + 3); break;
959      case 0x1: return namco_06xx_data_read(machine, 4*chip + 0); break;
960      case 0x2: return namco_06xx_data_read(machine, 4*chip + 1); break;
961      case 0x4: return namco_06xx_data_read(machine, 4*chip + 2); break;
962      case 0x8: return namco_06xx_data_read(machine, 4*chip + 3); break;
963963      default:
964964         logerror("%04x: 06XX #%d read in unsupported mode %02x\n",activecpu_get_pc(),chip,customio_command[chip]);
965965         return 0xff;
r1877r1878
967967}
968968
969969
970static void namco_06xx_data_w(int chip,int offset,int data)
970static void namco_06xx_data_w(running_machine *machine,int chip,int offset,int data)
971971{
972972   LOG(("%04x: 06XX #%d write offset %d = %02x\n",activecpu_get_pc(),chip,offset,data));
973973
r1877r1878
979979
980980   switch (customio_command[chip] & 0xf)
981981   {
982      case 0x1: namco_06xx_data_write(4*chip + 0,data); break;
983      case 0x2: namco_06xx_data_write(4*chip + 1,data); break;
984      case 0x4: namco_06xx_data_write(4*chip + 2,data); break;
985      case 0x8: namco_06xx_data_write(4*chip + 3,data); break;
982      case 0x1: namco_06xx_data_write(machine,4*chip + 0,data); break;
983      case 0x2: namco_06xx_data_write(machine,4*chip + 1,data); break;
984      case 0x4: namco_06xx_data_write(machine,4*chip + 2,data); break;
985      case 0x8: namco_06xx_data_write(machine,4*chip + 3,data); break;
986986      default:
987987         logerror("%04x: 06XX #%d write in unsupported mode %02x\n",activecpu_get_pc(),chip,customio_command[chip]);
988988         break;
r1877r1878
10341034
10351035
10361036
1037READ8_HANDLER( namco_06xx_0_data_r )      { return namco_06xx_data_r(0,offset); }
1038READ8_HANDLER( namco_06xx_1_data_r )      { return namco_06xx_data_r(1,offset); }
1039WRITE8_HANDLER( namco_06xx_0_data_w )   { namco_06xx_data_w(0,offset,data); }
1040WRITE8_HANDLER( namco_06xx_1_data_w )   { namco_06xx_data_w(1,offset,data); }
1037READ8_HANDLER( namco_06xx_0_data_r )      { return namco_06xx_data_r(machine,0,offset); }
1038READ8_HANDLER( namco_06xx_1_data_r )      { return namco_06xx_data_r(machine,1,offset); }
1039WRITE8_HANDLER( namco_06xx_0_data_w )   { namco_06xx_data_w(machine,0,offset,data); }
1040WRITE8_HANDLER( namco_06xx_1_data_w )   { namco_06xx_data_w(machine,1,offset,data); }
10411041READ8_HANDLER( namco_06xx_0_ctrl_r )      { return namco_06xx_ctrl_r(0); }
10421042READ8_HANDLER( namco_06xx_1_ctrl_r )      { return namco_06xx_ctrl_r(1); }
10431043WRITE8_HANDLER( namco_06xx_0_ctrl_w )   { namco_06xx_ctrl_w(0,data); }
src/mame/machine/dc.c
r1877r1878
118118   MAPLE_STATUS = 0x21,
119119};
120120
121UINT32 sysctrl_regs[0x200/4];
121UINT32 dc_sysctrl_regs[0x200/4];
122UINT32 dc_coin_counts[2];
122123static UINT32 maple_regs[0x100/4];
123124static UINT32 dc_rtcregister[4];
124125static UINT32 g1bus_regs[0x100/4];
125126extern UINT32 dma_offset;
126127static UINT8 maple0x86data1[0x80];
127128static UINT8 maple0x86data2[0x400];
128static UINT32 coin_counts[8];
129129
130130static const UINT32 maple0x82answer[]=
131131{
r1877r1878
163163{
164164   UINT32 ln,lx,le;
165165
166   ln=sysctrl_regs[SB_ISTNRM] & sysctrl_regs[SB_IML6NRM];
167   lx=sysctrl_regs[SB_ISTEXT] & sysctrl_regs[SB_IML6EXT];
168   le=sysctrl_regs[SB_ISTERR] & sysctrl_regs[SB_IML6ERR];
166   ln=dc_sysctrl_regs[SB_ISTNRM] & dc_sysctrl_regs[SB_IML6NRM];
167   lx=dc_sysctrl_regs[SB_ISTEXT] & dc_sysctrl_regs[SB_IML6EXT];
168   le=dc_sysctrl_regs[SB_ISTERR] & dc_sysctrl_regs[SB_IML6ERR];
169169   if (ln | lx | le)
170170   {
171171      return 6;
172172   }
173173
174   ln=sysctrl_regs[SB_ISTNRM] & sysctrl_regs[SB_IML4NRM];
175   lx=sysctrl_regs[SB_ISTEXT] & sysctrl_regs[SB_IML4EXT];
176   le=sysctrl_regs[SB_ISTERR] & sysctrl_regs[SB_IML4ERR];
174   ln=dc_sysctrl_regs[SB_ISTNRM] & dc_sysctrl_regs[SB_IML4NRM];
175   lx=dc_sysctrl_regs[SB_ISTEXT] & dc_sysctrl_regs[SB_IML4EXT];
176   le=dc_sysctrl_regs[SB_ISTERR] & dc_sysctrl_regs[SB_IML4ERR];
177177   if (ln | lx | le)
178178   {
179179      return 4;
180180   }
181181
182   ln=sysctrl_regs[SB_ISTNRM] & sysctrl_regs[SB_IML2NRM];
183   lx=sysctrl_regs[SB_ISTEXT] & sysctrl_regs[SB_IML2EXT];
184   le=sysctrl_regs[SB_ISTERR] & sysctrl_regs[SB_IML2ERR];
182   ln=dc_sysctrl_regs[SB_ISTNRM] & dc_sysctrl_regs[SB_IML2NRM];
183   lx=dc_sysctrl_regs[SB_ISTEXT] & dc_sysctrl_regs[SB_IML2EXT];
184   le=dc_sysctrl_regs[SB_ISTERR] & dc_sysctrl_regs[SB_IML2ERR];
185185   if (ln | lx | le)
186186   {
187187      return 2;
r1877r1878
194194{
195195int level;
196196
197   if (sysctrl_regs[SB_ISTERR])
197   if (dc_sysctrl_regs[SB_ISTERR])
198198   {
199      sysctrl_regs[SB_ISTNRM] |= 0x80000000;
199      dc_sysctrl_regs[SB_ISTNRM] |= IST_ERROR;
200200   }
201201   else
202202   {
203      sysctrl_regs[SB_ISTNRM] &= 0x7fffffff;
203      dc_sysctrl_regs[SB_ISTNRM] &= ~IST_ERROR;
204204   }
205205
206   if (sysctrl_regs[SB_ISTEXT])
206   if (dc_sysctrl_regs[SB_ISTEXT])
207207   {
208      sysctrl_regs[SB_ISTNRM] |= 0x40000000;
208      dc_sysctrl_regs[SB_ISTNRM] |= IST_G1G2EXTSTAT;
209209   }
210210   else
211211   {
212      sysctrl_regs[SB_ISTNRM] &= 0xbfffffff;
212      dc_sysctrl_regs[SB_ISTNRM] &= ~IST_G1G2EXTSTAT;
213213   }
214214
215215   level=compute_interrupt_level();
216   cpunum_set_info_int(0,CPUINFO_INT_SH4_IRLn_INPUT,15-level);
216   cpunum_set_info_int(0, CPUINFO_INT_SH4_IRLn_INPUT, 15-level);
217217}
218218
219219READ64_HANDLER( dc_sysctrl_r )
r1877r1878
226226   #if DEBUG_SYSCTRL
227227   if ((reg != 0x40) && (reg != 0x41) && (reg != 0x42) && (reg != 0x23) && (reg > 2))   // filter out IRQ status reads
228228   {
229      mame_printf_verbose("SYSCTRL: [%08x] read %x @ %x (reg %x: %s), mask %llx (PC=%x)\n", 0x5f6800+reg*4, sysctrl_regs[reg], offset, reg, sysctrl_names[reg], mem_mask, activecpu_get_pc());
229      mame_printf_verbose("SYSCTRL: [%08x] read %x @ %x (reg %x: %s), mask %llx (PC=%x)\n", 0x5f6800+reg*4, dc_sysctrl_regs[reg], offset, reg, sysctrl_names[reg], mem_mask, activecpu_get_pc());
230230   }
231231   #endif
232232
233   return (UINT64)sysctrl_regs[reg] << shift;
233   return (UINT64)dc_sysctrl_regs[reg] << shift;
234234}
235235
236236WRITE64_HANDLER( dc_sysctrl_w )
r1877r1878
242242
243243   reg = decode_reg_64(offset, mem_mask, &shift);
244244   dat = (UINT32)(data >> shift);
245   old = sysctrl_regs[reg];
246   sysctrl_regs[reg] = dat; // 5f6800+off*4=dat
245   old = dc_sysctrl_regs[reg];
246   dc_sysctrl_regs[reg] = dat; // 5f6800+off*4=dat
247247   switch (reg)
248248   {
249249      case SB_C2DST:
250         ddtdata.destination=sysctrl_regs[SB_C2DSTAT];
251         ddtdata.length=sysctrl_regs[SB_C2DLEN];
250         ddtdata.destination=dc_sysctrl_regs[SB_C2DSTAT];
251         ddtdata.length=dc_sysctrl_regs[SB_C2DLEN];
252252         ddtdata.size=1;
253253         ddtdata.direction=0;
254254         ddtdata.channel=2;
255255         ddtdata.mode=25; //011001
256256         cpunum_set_info_ptr(0,CPUINFO_PTR_SH4_EXTERNAL_DDT_DMA,&ddtdata);
257257         #if DEBUG_SYSCTRL
258         mame_printf_verbose("SYSCTRL: Ch2 dma %x from %08x to %08x (lmmode0=%d lmmode1=%d)\n", sysctrl_regs[SB_C2DLEN], ddtdata.source-ddtdata.length, sysctrl_regs[SB_C2DSTAT],sysctrl_regs[SB_LMMODE0],sysctrl_regs[SB_LMMODE1]);
258         mame_printf_verbose("SYSCTRL: Ch2 dma %x from %08x to %08x (lmmode0=%d lmmode1=%d)\n", dc_sysctrl_regs[SB_C2DLEN], ddtdata.source-ddtdata.length, dc_sysctrl_regs[SB_C2DSTAT],dc_sysctrl_regs[SB_LMMODE0],dc_sysctrl_regs[SB_LMMODE1]);
259259         #endif
260         sysctrl_regs[SB_C2DSTAT]=sysctrl_regs[SB_C2DSTAT]+ddtdata.length;
261         sysctrl_regs[SB_C2DLEN]=0;
262         sysctrl_regs[SB_C2DST]=0;
263         sysctrl_regs[SB_ISTNRM] |= (1 << 19);
260         dc_sysctrl_regs[SB_C2DSTAT]=dc_sysctrl_regs[SB_C2DSTAT]+ddtdata.length;
261         dc_sysctrl_regs[SB_C2DLEN]=0;
262         dc_sysctrl_regs[SB_C2DST]=0;
263         dc_sysctrl_regs[SB_ISTNRM] |= IST_DMA_CH2;
264264         break;
265265
266266      case SB_ISTNRM:
267         sysctrl_regs[SB_ISTNRM] = old & ~(dat | 0xC0000000); // bits 31,30 ro
267         dc_sysctrl_regs[SB_ISTNRM] = old & ~(dat | 0xC0000000); // bits 31,30 ro
268268         break;
269269
270270      case SB_ISTEXT:
271         sysctrl_regs[SB_ISTEXT] = old;
271         dc_sysctrl_regs[SB_ISTEXT] = old;
272272         break;
273273
274274      case SB_ISTERR:
275         sysctrl_regs[SB_ISTERR] = old & ~dat;
275         dc_sysctrl_regs[SB_ISTERR] = old & ~dat;
276276         break;
277277   }
278278   update_interrupt_status();
r1877r1878
530530                                    maple0x86data2[pos+14]=readinputportbytag("IN4"); // bits 2Ppush3 2Ppush4 2Ppush5 2Ppush6 2Ppush7 2Ppush8 ...
531531                                    // second function
532532                                    maple0x86data2[pos+15]=1; // report
533                                    maple0x86data2[pos+16]=(coin_counts[0] >> 8) & 0xff; // 1CONDITION, 1SLOT COIN(bit13-8)
534                                    maple0x86data2[pos+17]=coin_counts[0] & 0xff; // 1SLOT COIN(bit7-0)
535                                    maple0x86data2[pos+18]=(coin_counts[1] >> 8) & 0xff; // 2CONDITION, 2SLOT COIN(bit13-8)
536                                    maple0x86data2[pos+19]=coin_counts[1] & 0xff; // 2SLOT COIN(bit7-0)
533                                    maple0x86data2[pos+16]=(dc_coin_counts[0] >> 8) & 0xff; // 1CONDITION, 1SLOT COIN(bit13-8)
534                                    maple0x86data2[pos+17]=dc_coin_counts[0] & 0xff; // 1SLOT COIN(bit7-0)
535                                    maple0x86data2[pos+18]=(dc_coin_counts[1] >> 8) & 0xff; // 2CONDITION, 2SLOT COIN(bit13-8)
536                                    maple0x86data2[pos+19]=dc_coin_counts[1] & 0xff; // 2SLOT COIN(bit7-0)
537537                                    // third function
538538                                    maple0x86data2[pos+20]=1; // report
539539                                    maple0x86data2[pos+21]=0xff; // channel 1 bits 7-0
r1877r1878
620620   }
621621}
622622
623static void coin_slots_callback(void *param, UINT32 oldval, UINT32 newval)
623INPUT_CHANGED( dc_coin_slots_callback )
624624{
625UINT32 a,b,c;
625   UINT32 *counter = param;
626626
627   c = (newval ^ oldval) & newval;
628   b = 1;
629   for (a=0;a < 2;a++)
630   {
631      if (c & b)
632         coin_counts[a]++;
633      b = b << 1;
634   }
627   /* check for a 0 -> 1 transition */
628   if (!oldval && newval)
629      *counter += 1;
635630}
636631
637632READ64_HANDLER( dc_gdrom_r )
r1877r1878
717712         mame_printf_verbose("G1CTRL: transfer %x from ROM %08x to sdram %08x\n", g1bus_regs[SB_GDLEN], dma_offset, g1bus_regs[SB_GDSTAR]);
718713         cpunum_set_info_ptr(0, CPUINFO_PTR_SH4_EXTERNAL_DDT_DMA, &ddtdata);
719714         g1bus_regs[SB_GDST]=0;
720         sysctrl_regs[SB_ISTNRM] |= (1 << 14);
715         dc_sysctrl_regs[SB_ISTNRM] |= IST_DMA_GDROM;
721716      }
722717      break;
723718   }
r1877r1878
813808
814809MACHINE_START( dc )
815810{
816   input_port_set_changed_callback(port_tag_to_index("COINS"), 0x03, coin_slots_callback, NULL);
817811}
818812
819813MACHINE_RESET( dc )
r1877r1878
823817   /* halt the ARM7 */
824818   cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, ASSERT_LINE);
825819
826   memset(sysctrl_regs, 0, sizeof(sysctrl_regs));
820   memset(dc_sysctrl_regs, 0, sizeof(dc_sysctrl_regs));
827821   memset(maple_regs, 0, sizeof(maple_regs));
828822   memset(dc_rtcregister, 0, sizeof(dc_rtcregister));
829   memset(coin_counts, 0, sizeof(coin_counts));
823   memset(dc_coin_counts, 0, sizeof(dc_coin_counts));
830824
831   sysctrl_regs[SB_SBREV] = 0x0b;
825   dc_sysctrl_regs[SB_SBREV] = 0x0b;
832826   for (a=0;a < 0x80;a++)
833827      maple0x86data1[a]=0x11+a;
834828
r1877r1878
848842
849843//  mame_printf_verbose("AICA REG: [%08x] read %llx, mask %llx\n", 0x700000+reg*4, (UINT64)offset, mem_mask);
850844
851   return (UINT64) AICA_0_r(offset*2, 0x0000)<<shift;
845   return (UINT64) AICA_0_r(machine, offset*2, 0x0000)<<shift;
852846}
853847
854848WRITE64_HANDLER( dc_aica_reg_w )
r1877r1878
874868      }
875869        }
876870
877   AICA_0_w(offset*2, dat, shift ? ((mem_mask>>32)&0xffff) : (mem_mask & 0xffff));
871   AICA_0_w(machine, offset*2, dat, shift ? ((mem_mask>>32)&0xffff) : (mem_mask & 0xffff));
878872
879873//  mame_printf_verbose("AICA REG: [%08x=%x] write %llx to %x, mask %llx\n", 0x700000+reg*4, dat, data, offset, mem_mask);
880874}
881875
882876READ32_HANDLER( dc_arm_aica_r )
883877{
884   return AICA_0_r(offset*2, 0x0000);
878   return AICA_0_r(machine, offset*2, 0x0000);
885879}
886880
887881WRITE32_HANDLER( dc_arm_aica_w )
888882{
889   AICA_0_w(offset*2, data, mem_mask&0xffff);
883   AICA_0_w(machine, offset*2, data, mem_mask&0xffff);
890884}
891885
src/mame/machine/scramble.c
r1877r1878
259259   cavelon_banksw();
260260
261261   if      ((offset >= 0x0100) && (offset <= 0x0103))
262      return ppi8255_0_r(offset - 0x0100);
262      return ppi8255_0_r(machine, offset - 0x0100);
263263   else if ((offset >= 0x0200) && (offset <= 0x0203))
264      return ppi8255_1_r(offset - 0x0200);
264      return ppi8255_1_r(machine, offset - 0x0200);
265265
266266   return 0xff;
267267}
r1877r1878
271271   cavelon_banksw();
272272
273273   if      ((offset >= 0x0100) && (offset <= 0x0103))
274      ppi8255_0_w(offset - 0x0100, data);
274      ppi8255_0_w(machine, offset - 0x0100, data);
275275   else if ((offset >= 0x0200) && (offset <= 0x0203))
276      ppi8255_1_w(offset - 0x0200, data);
276      ppi8255_1_w(machine, offset - 0x0200, data);
277277}
278278
279279
src/mame/machine/namcoio.h
r1877r1878
2323
2424struct namcoio_interface
2525{
26   read8_handler in[4];   /* read handlers for ports A-D */
27   write8_handler out[2];   /* write handlers for ports A-B */
26   read8_machine_func in[4];   /* read handlers for ports A-D */
27   write8_machine_func out[2];   /* write handlers for ports A-B */
2828};
2929
3030
src/mame/machine/namcos1.c
r1877r1878
3232/* Bank handler definitions */
3333typedef struct
3434{
35   read8_handler bank_handler_r;
36   write8_handler bank_handler_w;
35   read8_machine_func bank_handler_r;
36   write8_machine_func bank_handler_w;
3737   int           bank_offset;
3838   UINT8 *bank_pointer;
3939} bankhandler;
r1877r1878
4242static bankhandler namcos1_bank_element[NAMCOS1_MAX_BANK];
4343static bankhandler namcos1_active_bank[16];
4444
45static READ8_HANDLER( bank1_r )  { return (*namcos1_active_bank[0].bank_handler_r )(offset + namcos1_active_bank[0].bank_offset); }
46static READ8_HANDLER( bank2_r )  { return (*namcos1_active_bank[1].bank_handler_r )(offset + namcos1_active_bank[1].bank_offset); }
47static READ8_HANDLER( bank3_r )  { return (*namcos1_active_bank[2].bank_handler_r )(offset + namcos1_active_bank[2].bank_offset); }
48static READ8_HANDLER( bank4_r )  { return (*namcos1_active_bank[3].bank_handler_r )(offset + namcos1_active_bank[3].bank_offset); }
49static READ8_HANDLER( bank5_r )  { return (*namcos1_active_bank[4].bank_handler_r )(offset + namcos1_active_bank[4].bank_offset); }
50static READ8_HANDLER( bank6_r )  { return (*namcos1_active_bank[5].bank_handler_r )(offset + namcos1_active_bank[5].bank_offset); }
51static READ8_HANDLER( bank7_r )  { return (*namcos1_active_bank[6].bank_handler_r )(offset + namcos1_active_bank[6].bank_offset); }
52static READ8_HANDLER( bank8_r )  { return (*namcos1_active_bank[7].bank_handler_r )(offset + namcos1_active_bank[7].bank_offset); }
53static READ8_HANDLER( bank9_r )  { return (*namcos1_active_bank[8].bank_handler_r )(offset + namcos1_active_bank[8].bank_offset); }
54static READ8_HANDLER( bank10_r ) { return (*namcos1_active_bank[9].bank_handler_r )(offset + namcos1_active_bank[9].bank_offset); }
55static READ8_HANDLER( bank11_r ) { return (*namcos1_active_bank[10].bank_handler_r)(offset + namcos1_active_bank[10].bank_offset); }
56static READ8_HANDLER( bank12_r ) { return (*namcos1_active_bank[11].bank_handler_r)(offset + namcos1_active_bank[11].bank_offset); }
57static READ8_HANDLER( bank13_r ) { return (*namcos1_active_bank[12].bank_handler_r)(offset + namcos1_active_bank[12].bank_offset); }
58static READ8_HANDLER( bank14_r ) { return (*namcos1_active_bank[13].bank_handler_r)(offset + namcos1_active_bank[13].bank_offset); }
59static READ8_HANDLER( bank15_r ) { return (*namcos1_active_bank[14].bank_handler_r)(offset + namcos1_active_bank[14].bank_offset); }
60static READ8_HANDLER( bank16_r ) { return (*namcos1_active_bank[15].bank_handler_r)(offset + namcos1_active_bank[15].bank_offset); }
45static READ8_HANDLER( bank1_r )  { return (*namcos1_active_bank[0].bank_handler_r )(machine, offset + namcos1_active_bank[0].bank_offset); }
46static READ8_HANDLER( bank2_r )  { return (*namcos1_active_bank[1].bank_handler_r )(machine, offset + namcos1_active_bank[1].bank_offset); }
47static READ8_HANDLER( bank3_r )  { return (*namcos1_active_bank[2].bank_handler_r )(machine, offset + namcos1_active_bank[2].bank_offset); }
48static READ8_HANDLER( bank4_r )  { return (*namcos1_active_bank[3].bank_handler_r )(machine, offset + namcos1_active_bank[3].bank_offset); }
49static READ8_HANDLER( bank5_r )  { return (*namcos1_active_bank[4].bank_handler_r )(machine, offset + namcos1_active_bank[4].bank_offset); }
50static READ8_HANDLER( bank6_r )  { return (*namcos1_active_bank[5].bank_handler_r )(machine, offset + namcos1_active_bank[5].bank_offset); }
51static READ8_HANDLER( bank7_r )  { return (*namcos1_active_bank[6].bank_handler_r )(machine, offset + namcos1_active_bank[6].bank_offset); }
52static READ8_HANDLER( bank8_r )  { return (*namcos1_active_bank[7].bank_handler_r )(machine, offset + namcos1_active_bank[7].bank_offset); }
53static READ8_HANDLER( bank9_r )  { return (*namcos1_active_bank[8].bank_handler_r )(machine, offset + namcos1_active_bank[8].bank_offset); }
54static READ8_HANDLER( bank10_r ) { return (*namcos1_active_bank[9].bank_handler_r )(machine, offset + namcos1_active_bank[9].bank_offset); }
55static READ8_HANDLER( bank11_r ) { return (*namcos1_active_bank[10].bank_handler_r)(machine, offset + namcos1_active_bank[10].bank_offset); }
56static READ8_HANDLER( bank12_r ) { return (*namcos1_active_bank[11].bank_handler_r)(machine, offset + namcos1_active_bank[11].bank_offset); }
57static READ8_HANDLER( bank13_r ) { return (*namcos1_active_bank[12].bank_handler_r)(machine, offset + namcos1_active_bank[12].bank_offset); }
58static READ8_HANDLER( bank14_r ) { return (*namcos1_active_bank[13].bank_handler_r)(machine, offset + namcos1_active_bank[13].bank_offset); }
59static READ8_HANDLER( bank15_r ) { return (*namcos1_active_bank[14].bank_handler_r)(machine, offset + namcos1_active_bank[14].bank_offset); }
60static READ8_HANDLER( bank16_r ) { return (*namcos1_active_bank[15].bank_handler_r)(machine, offset + namcos1_active_bank[15].bank_offset); }
6161
62static WRITE8_HANDLER( bank1_w )  { (*namcos1_active_bank[0].bank_handler_w )(offset + namcos1_active_bank[0].bank_offset, data); }
63static WRITE8_HANDLER( bank2_w )  { (*namcos1_active_bank[1].bank_handler_w )(offset + namcos1_active_bank[1].bank_offset, data); }
64static WRITE8_HANDLER( bank3_w )  { (*namcos1_active_bank[2].bank_handler_w )(offset + namcos1_active_bank[2].bank_offset, data); }
65static WRITE8_HANDLER( bank4_w )  { (*namcos1_active_bank[3].bank_handler_w )(offset + namcos1_active_bank[3].bank_offset, data); }
66static WRITE8_HANDLER( bank5_w )  { (*namcos1_active_bank[4].bank_handler_w )(offset + namcos1_active_bank[4].bank_offset, data); }
67static WRITE8_HANDLER( bank6_w )  { (*namcos1_active_bank[5].bank_handler_w )(offset + namcos1_active_bank[5].bank_offset, data); }
68static WRITE8_HANDLER( bank7_w )  { (*namcos1_active_bank[6].bank_handler_w )(offset + namcos1_active_bank[6].bank_offset, data); }
69static WRITE8_HANDLER( bank8_w )  { (*namcos1_active_bank[7].bank_handler_w )(offset + namcos1_active_bank[7].bank_offset, data); }
70static WRITE8_HANDLER( bank9_w )  { (*namcos1_active_bank[8].bank_handler_w )(offset + namcos1_active_bank[8].bank_offset, data); }
71static WRITE8_HANDLER( bank10_w ) { (*namcos1_active_bank[9].bank_handler_w )(offset + namcos1_active_bank[9].bank_offset, data); }
72static WRITE8_HANDLER( bank11_w ) { (*namcos1_active_bank[10].bank_handler_w)(offset + namcos1_active_bank[10].bank_offset, data); }
73static WRITE8_HANDLER( bank12_w ) { (*namcos1_active_bank[11].bank_handler_w)(offset + namcos1_active_bank[11].bank_offset, data); }
74static WRITE8_HANDLER( bank13_w ) { (*namcos1_active_bank[12].bank_handler_w)(offset + namcos1_active_bank[12].bank_offset, data); }
75static WRITE8_HANDLER( bank14_w ) { (*namcos1_active_bank[13].bank_handler_w)(offset + namcos1_active_bank[13].bank_offset, data); }
76static WRITE8_HANDLER( bank15_w ) { (*namcos1_active_bank[14].bank_handler_w)(offset + namcos1_active_bank[14].bank_offset, data); }
77static WRITE8_HANDLER( bank16_w ) { (*namcos1_active_bank[15].bank_handler_w)(offset + namcos1_active_bank[15].bank_offset, data); }
62static WRITE8_HANDLER( bank1_w )  { (*namcos1_active_bank[0].bank_handler_w )(machine, offset + namcos1_active_bank[0].bank_offset, data); }
63static WRITE8_HANDLER( bank2_w )  { (*namcos1_active_bank[1].bank_handler_w )(machine, offset + namcos1_active_bank[1].bank_offset, data); }
64static WRITE8_HANDLER( bank3_w )  { (*namcos1_active_bank[2].bank_handler_w )(machine, offset + namcos1_active_bank[2].bank_offset, data); }
65static WRITE8_HANDLER( bank4_w )  { (*namcos1_active_bank[3].bank_handler_w )(machine, offset + namcos1_active_bank[3].bank_offset, data); }
66static WRITE8_HANDLER( bank5_w )  { (*namcos1_active_bank[4].bank_handler_w )(machine, offset + namcos1_active_bank[4].bank_offset, data); }
67static WRITE8_HANDLER( bank6_w )  { (*namcos1_active_bank[5].bank_handler_w )(machine, offset + namcos1_active_bank[5].bank_offset, data); }
68static WRITE8_HANDLER( bank7_w )  { (*namcos1_active_bank[6].bank_handler_w )(machine, offset + namcos1_active_bank[6].bank_offset, data); }
69static WRITE8_HANDLER( bank8_w )  { (*namcos1_active_bank[7].bank_handler_w )(machine, offset + namcos1_active_bank[7].bank_offset, data); }
70static WRITE8_HANDLER( bank9_w )  { (*namcos1_active_bank[8].bank_handler_w )(machine, offset + namcos1_active_bank[8].bank_offset, data); }
71static WRITE8_HANDLER( bank10_w ) { (*namcos1_active_bank[9].bank_handler_w )(machine, offset + namcos1_active_bank[9].bank_offset, data); }
72static WRITE8_HANDLER( bank11_w ) { (*namcos1_active_bank[10].bank_handler_w)(machine, offset + namcos1_active_bank[10].bank_offset, data); }
73static WRITE8_HANDLER( bank12_w ) { (*namcos1_active_bank[11].bank_handler_w)(machine, offset + namcos1_active_bank[11].bank_offset, data); }
74static WRITE8_HANDLER( bank13_w ) { (*namcos1_active_bank[12].bank_handler_w)(machine, offset + namcos1_active_bank[12].bank_offset, data); }
75static WRITE8_HANDLER( bank14_w ) { (*namcos1_active_bank[13].bank_handler_w)(machine, offset + namcos1_active_bank[13].bank_offset, data); }
76static WRITE8_HANDLER( bank15_w ) { (*namcos1_active_bank[14].bank_handler_w)(machine, offset + namcos1_active_bank[14].bank_offset, data); }
77static WRITE8_HANDLER( bank16_w ) { (*namcos1_active_bank[15].bank_handler_w)(machine, offset + namcos1_active_bank[15].bank_offset, data); }
7878
79static const read8_handler ram_bank_handler_r[16] =
79static const read8_machine_func ram_bank_handler_r[16] =
8080{
8181   MRA8_BANK1 ,MRA8_BANK2 ,MRA8_BANK3 ,MRA8_BANK4 ,
8282   MRA8_BANK5 ,MRA8_BANK6 ,MRA8_BANK7 ,MRA8_BANK8 ,
r1877r1878
8484   MRA8_BANK13,MRA8_BANK14,MRA8_BANK15,MRA8_BANK16
8585};
8686
87static const write8_handler ram_bank_handler_w[16] =
87static const write8_machine_func ram_bank_handler_w[16] =
8888{
8989   MWA8_BANK1 ,MWA8_BANK2 ,MWA8_BANK3 ,MWA8_BANK4 ,
9090   MWA8_BANK5 ,MWA8_BANK6 ,MWA8_BANK7 ,MWA8_BANK8 ,
r1877r1878
9292   MWA8_BANK13,MWA8_BANK14,MWA8_BANK15,MWA8_BANK16
9393};
9494
95static const read8_handler io_bank_handler_r[16] =
95static const read8_machine_func io_bank_handler_r[16] =
9696{
9797   bank1_r, bank2_r, bank3_r, bank4_r,
9898   bank5_r, bank6_r, bank7_r, bank8_r,
r1877r1878
100100   bank13_r, bank14_r, bank15_r, bank16_r
101101};
102102
103static const write8_handler io_bank_handler_w[16] =
103static const write8_machine_func io_bank_handler_w[16] =
104104{
105105   bank1_w, bank2_w, bank3_w, bank4_w,
106106   bank5_w, bank6_w, bank7_w, bank8_w,
r1877r1878
599599   if (wdog == 7 || !namcos1_reset)
600600   {
601601      wdog = 0;
602      watchdog_reset_w(0,0);
602      watchdog_reset_w(machine,0,0);
603603   }
604604}
605605
r1877r1878
612612      offset &= 0x3ff;
613613
614614      /* CUS 30 */
615      return namcos1_cus30_r(offset);
615      return namcos1_cus30_r(machine,offset);
616616   }
617617   else
618618   {
r1877r1878
630630      offset &= 0x3ff;
631631
632632      /* CUS 30 */
633      namcos1_cus30_w(offset,data);
633      namcos1_cus30_w(machine,offset,data);
634634   }
635635   else
636636   {
r1877r1878
755755*                                                                              *
756756*******************************************************************************/
757757
758static void namcos1_install_bank(int start,int end,read8_handler hr,write8_handler hw,
758static void namcos1_install_bank(int start,int end,read8_machine_func hr,write8_machine_func hw,
759759           int offset,UINT8 *pointer)
760760{
761761   int i;
r1877r1878
772772
773773
774774
775static void namcos1_build_banks(read8_handler key_r,write8_handler key_w)
775static void namcos1_build_banks(read8_machine_func key_r,write8_machine_func key_w)
776776{
777777   int i;
778778
r1877r1878
944944struct namcos1_specific
945945{
946946   /* keychip */
947   read8_handler key_r;
948   write8_handler key_w;
947   read8_machine_func key_r;
948   write8_machine_func key_w;
949949   int key_id;
950950   int key_reg1;
951951   int key_reg2;
src/mame/machine/segaic16.c
r1877r1878
177177      offs_t region_size = region_size_map[chip->regs[rgn->regbase] & 3];
178178      offs_t region_base = (chip->regs[rgn->regbase + 1] << 16) & ~region_size;
179179      offs_t region_start = region_base + (rgn->regoffs & region_size);
180      read16_handler read = rgn->read;
180      read16_machine_func read = rgn->read;
181181      int banknum = 0;
182182
183183      /* skip non-ROM regions */
r1877r1878
343343      offs_t region_mirror = rgn->mirror & region_size;
344344      offs_t region_start = region_base + (rgn->regoffs & region_size);
345345      offs_t region_end = region_start + ((rgn->length - 1 < region_size) ? rgn->length - 1 : region_size);
346      write16_handler write = rgn->write;
347      read16_handler read = rgn->read;
346      write16_machine_func write = rgn->write;
347      read16_machine_func read = rgn->read;
348348      int banknum = 0;
349349
350350      /* check for mapping to banks */
r1877r1878
411411
412412READ16_HANDLER( segaic16_memory_mapper_lsb_r )
413413{
414   return memory_mapper_r(&memory_mapper, offset, segaic16_open_bus_r(0,0));
414   return memory_mapper_r(&memory_mapper, offset, segaic16_open_bus_r(machine,0,0));
415415}
416416
417417
src/mame/machine/segaic16.h
r1877r1878
1515   offs_t         length;            /* length in bytes of this entry */
1616   offs_t         mirror;            /* maximal mirror values (will be truncated) */
1717   offs_t         romoffset;         /* offset within REGION_CPU0, or ~0 for independent entries */
18   read16_handler   read;            /* read handler */
19   write16_handler   write;            /* write handler */
18   read16_machine_func   read;            /* read handler */
19   write16_machine_func   write;            /* write handler */
2020   UINT16 **      base;            /* pointer to memory base */
2121   const char *   name;            /* friendly name for debugging */
2222};
src/mame/machine/stfight.c
r1877r1878
8282MACHINE_RESET( stfight )
8383{
8484    // initialise rom bank
85    stfight_bank_w( 0, 0 );
85    stfight_bank_w( machine, 0, 0 );
8686}
8787
8888// It's entirely possible that this bank is never switched out
src/mame/machine/nmk112.c
r1877r1878
5656{
5757   if (ACCESSING_LSB)
5858   {
59      NMK112_okibank_w(offset, data & 0xff);
59      NMK112_okibank_w(machine, offset, data & 0xff);
6060   }
6161}
src/mame/machine/tait8741.c
r1877r1878
4747   UINT8 pending4a;
4848   int serial_out;
4949   int coins;
50   read8_handler portHandler;
50   read8_machine_func portHandler;
5151}I8741;
5252
5353static const struct TAITO8741interface *intf;
r1877r1878
122122}
123123
124124/* 8741 update */
125static void taito8741_update(int num)
125static void taito8741_update(running_machine *machine, int num)
126126{
127127   I8741 *st,*sst;
128128   int next = num;
r1877r1878
177177               else
178178               { /* port select */
179179                  st->parallelselect = data & 0x07;
180                  taito8741_hostdata_w(st,st->portHandler ? st->portHandler(st->parallelselect) : 0);
180                  taito8741_hostdata_w(st,st->portHandler ? st->portHandler(machine,st->parallelselect) : 0);
181181               }
182182            }
183183         }
r1877r1878
188188         case -1: /* no command data */
189189            break;
190190         case 0x00: /* read from parallel port */
191            taito8741_hostdata_w(st,st->portHandler ? st->portHandler(0) : 0 );
191            taito8741_hostdata_w(st,st->portHandler ? st->portHandler(machine,0) : 0 );
192192            break;
193193         case 0x01: /* read receive buffer 0 */
194194         case 0x02: /* read receive buffer 1 */
r1877r1878
201201            taito8741_hostdata_w(st,st->rxd[data-1]);
202202            break;
203203         case 0x08:   /* latch received serial data */
204            st->txd[0] = st->portHandler ? st->portHandler(0) : 0;
204            st->txd[0] = st->portHandler ? st->portHandler(machine,0) : 0;
205205            if( sst )
206206            {
207207               timer_call_after_resynch(NULL, num, taito8741_serial_tx);
r1877r1878
272272}
273273
274274/* read status port */
275static int I8741_status_r(int num)
275static int I8741_status_r(running_machine *machine, int num)
276276{
277277   I8741 *st = &taito8741[num];
278   taito8741_update(num);
278   taito8741_update(machine, num);
279279   LOG(("8741-%d ST Read %02x PC=%04x\n",num,st->status,activecpu_get_pc()));
280280   return st->status;
281281}
282282
283283/* read data port */
284static int I8741_data_r(int num)
284static int I8741_data_r(running_machine *machine, int num)
285285{
286286   I8741 *st = &taito8741[num];
287287   int ret = st->toData;
r1877r1878
289289   LOG(("8741-%d DATA Read %02x PC=%04x\n",num,ret,activecpu_get_pc()));
290290
291291   /* update chip */
292   taito8741_update(num);
292   taito8741_update(machine, num);
293293
294294   switch( st->mode )
295295   {
296296   case TAITO8741_PORT: /* parallel data */
297      taito8741_hostdata_w(st,st->portHandler ? st->portHandler(st->parallelselect) : 0);
297      taito8741_hostdata_w(st,st->portHandler ? st->portHandler(machine, st->parallelselect) : 0);
298298      break;
299299   }
300300   return ret;
301301}
302302
303303/* Write data port */
304static void I8741_data_w(int num, int data)
304static void I8741_data_w(running_machine *machine, int num, int data)
305305{
306306   I8741 *st = &taito8741[num];
307307   LOG(("8741-%d DATA Write %02x PC=%04x\n",num,data,activecpu_get_pc()));
308308   st->fromData = data;
309309   st->status |= 0x02;
310310   /* update chip */
311   taito8741_update(num);
311   taito8741_update(machine, num);
312312}
313313
314314/* Write command port */
315static void I8741_command_w(int num, int data)
315static void I8741_command_w(running_machine *machine, int num, int data)
316316{
317317   I8741 *st = &taito8741[num];
318318   LOG(("8741-%d CMD Write %02x PC=%04x\n",num,data,activecpu_get_pc()));
319319   st->fromCmd = data;
320320   st->status |= 0x04;
321321   /* update chip */
322   taito8741_update(num);
322   taito8741_update(machine,num);
323323}
324324
325325/* Write port handler */
326326WRITE8_HANDLER( TAITO8741_0_w )
327327{
328   if(offset&1) I8741_command_w(0,data);
329   else         I8741_data_w(0,data);
328   if(offset&1) I8741_command_w(machine,0,data);
329   else         I8741_data_w(machine,0,data);
330330}
331331WRITE8_HANDLER( TAITO8741_1_w )
332332{
333   if(offset&1) I8741_command_w(1,data);
334   else         I8741_data_w(1,data);
333   if(offset&1) I8741_command_w(machine,1,data);
334   else         I8741_data_w(machine,1,data);
335335}
336336WRITE8_HANDLER( TAITO8741_2_w )
337337{
338   if(offset&1) I8741_command_w(2,data);
339   else         I8741_data_w(2,data);
338   if(offset&1) I8741_command_w(machine,2,data);
339   else         I8741_data_w(machine,2,data);
340340}
341341WRITE8_HANDLER( TAITO8741_3_w )
342342{
343   if(offset&1) I8741_command_w(3,data);
344   else         I8741_data_w(3,data);
343   if(offset&1) I8741_command_w(machine,3,data);
344   else         I8741_data_w(machine,3,data);
345345}
346346
347347/* Read port handler */
348348READ8_HANDLER( TAITO8741_0_r )
349349{
350   if(offset&1) return I8741_status_r(0);
351   return I8741_data_r(0);
350   if(offset&1) return I8741_status_r(machine,0);
351   return I8741_data_r(machine,0);
352352}
353353READ8_HANDLER( TAITO8741_1_r )
354354{
355   if(offset&1) return I8741_status_r(1);
356   return I8741_data_r(1);
355   if(offset&1) return I8741_status_r(machine,1);
356   return I8741_data_r(machine,1);
357357}
358358READ8_HANDLER( TAITO8741_2_r )
359359{
360   if(offset&1) return I8741_status_r(2);
361   return I8741_data_r(2);
360   if(offset&1) return I8741_status_r(machine,2);
361   return I8741_data_r(machine,2);
362362}
363363READ8_HANDLER( TAITO8741_3_r )
364364{
365   if(offset&1) return I8741_status_r(3);
366   return I8741_data_r(3);
365   if(offset&1) return I8741_status_r(machine,3);
366   return I8741_data_r(machine,3);
367367}
368368/****************************************************************************
369369
r1877r1878
389389
390390   UINT8 rst;
391391
392   read8_handler initReadPort;
392   read8_machine_func initReadPort;
393393}JV8741;
394394
395395static JV8741 i8741[4];
r1877r1878
442442   }
443443}
444444
445static void josvolly_8741_w(int num,int offset,int data)
445static void josvolly_8741_w(running_machine *machine,int num,int offset,int data)
446446{
447447   JV8741 *mcu = &i8741[num];
448448
r1877r1878
470470         break;
471471      case 2:
472472#if 1
473         mcu->rxd = input_port_4_r(0);  /* DSW2 */
473         mcu->rxd = input_port_4_r(machine,0);  /* DSW2 */
474474         mcu->sts |= 0x01; /* RD ready */
475475#endif
476476         break;
r1877r1878
496496      {
497497         if(josvolly_nmi_enable)
498498         {
499            cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
499            cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
500500            josvolly_nmi_enable = 0;
501501         }
502502      }
r1877r1878
505505   josvolly_8741_do(num);
506506}
507507
508static INT8 josvolly_8741_r(int num,int offset)
508static INT8 josvolly_8741_r(running_machine *machine,int num,int offset)
509509{
510510   JV8741 *mcu = &i8741[num];
511511   int ret;
r1877r1878
513513   if(offset==1)
514514   {
515515      if(mcu->rst)
516         mcu->rxd = (mcu->initReadPort)(0); /* port in */
516         mcu->rxd = (mcu->initReadPort)(machine,0); /* port in */
517517      ret = mcu->sts;
518518      LOG(("PC=%04X 8741[%d]       SR %02X\n",activecpu_get_pc(),num,ret));
519519   }
r1877r1878
528528   return ret;
529529}
530530
531WRITE8_HANDLER( josvolly_8741_0_w ){ josvolly_8741_w(0,offset,data); }
532READ8_HANDLER( josvolly_8741_0_r ) { return josvolly_8741_r(0,offset); }
533WRITE8_HANDLER( josvolly_8741_1_w ) { josvolly_8741_w(1,offset,data); }
534READ8_HANDLER( josvolly_8741_1_r ) { return josvolly_8741_r(1,offset); }
531WRITE8_HANDLER( josvolly_8741_0_w ){ josvolly_8741_w(machine,0,offset,data); }
532READ8_HANDLER( josvolly_8741_0_r ) { return josvolly_8741_r(machine,0,offset); }
533WRITE8_HANDLER( josvolly_8741_1_w ) { josvolly_8741_w(machine,1,offset,data); }
534READ8_HANDLER( josvolly_8741_1_r ) { return josvolly_8741_r(machine,1,offset); }
src/mame/machine/tait8741.h
r1877r1878
1717   int num;
1818   int mode[MAX_TAITO8741];            /* program select */
1919   int serial_connect[MAX_TAITO8741];   /* serial port connection */
20   read8_handler portHandler_r[MAX_TAITO8741]; /* parallel port handler */
20   read8_machine_func portHandler_r[MAX_TAITO8741]; /* parallel port handler */
2121};
2222
2323int  TAITO8741_start(const struct TAITO8741interface *taito8741intf);
src/mame/machine/balsente.c
r1877r1878
177177   grudge_steering_result = 0;
178178
179179   /* reset the 6850 chips */
180   balsente_m6850_w(0, 3);
181   balsente_m6850_sound_w(0, 3);
180   balsente_m6850_w(machine, 0, 3);
181   balsente_m6850_sound_w(machine, 0, 3);
182182
183183   /* reset the noise generator */
184184   memset(noise_position, 0, sizeof(noise_position));
r1877r1878
11011101   if ((chip_select & 0x3f) != 0x3f)
11021102   {
11031103      UINT8 temp = chip_select;
1104      balsente_chip_select_w(0, 0x3f);
1105      balsente_chip_select_w(0, temp);
1104      balsente_chip_select_w(machine, 0, 0x3f);
1105      balsente_chip_select_w(machine, 0, temp);
11061106   }
11071107}
11081108
src/mame/machine/vsnes.c
r1877r1878
280280   /* bit 1 ( data & 2 ) enables writes to extra ram, we ignore it */
281281
282282   /* move along */
283   vsnes_in0_w( offset, data );
283   vsnes_in0_w( machine, offset, data );
284284}
285285
286286/* Most games switch VROM Banks in controller 0 write */
r1877r1878
295295{
296296   /* This PPU has registers mapped at $2000 and $2001 inverted */
297297   /* and no remapped color */
298
299298   if ( offset == 0 )
300299   {
301      ppu2c0x_0_w( 1, data );
300      ppu2c0x_0_w( machine, 1, data );
302301      return;
303302   }
304303
305   ppu2c0x_0_w( 0, data );
304   ppu2c0x_0_w( machine, 0, data );
306305}
307306
308307/**********************************************************************************/
r1877r1878
498497static READ8_HANDLER( vsgshoe_security_r )
499498{
500499   /* low part must be 0x1c */
501   return ppu2c0x_0_r( 2 ) | 0x1c;
500   return ppu2c0x_0_r( machine, 2 ) | 0x1c;
502501}
503502
504503static WRITE8_HANDLER( vsgshoe_gun_in0_w )
r1877r1878
512511      memcpy (&memory_region( REGION_CPU1 )[0x08000], &memory_region( REGION_CPU1 )[addr], 0x2000);
513512   }
514513
515   gun_in0_w(offset, data);
514   gun_in0_w(machine, offset, data);
516515}
517516
518517DRIVER_INIT( vsgshoe )
r1877r1878
773772static READ8_HANDLER( topgun_security_r )
774773{
775774   /* low part must be 0x1b */
776   return ppu2c0x_0_r( 2 ) | 0x1b;
775   return ppu2c0x_0_r( machine, 2 ) | 0x1b;
777776}
778777
779778DRIVER_INIT( topgun )
r1877r1878
12121211static READ8_HANDLER( jajamaru_security_r )
12131212{
12141213   /* low part must be 0x40 */
1215   return ppu2c0x_0_r( 2 ) | 0x40;
1214   return ppu2c0x_0_r( machine, 2 ) | 0x40;
12161215}
12171216
12181217DRIVER_INIT( jajamaru )
r1877r1878
12391238static READ8_HANDLER( mightybj_security_r )
12401239{
12411240   /* low part must be 0x3d */
1242   return ppu2c0x_0_r( 2 ) | 0x3d;
1241   return ppu2c0x_0_r( machine, 2 ) | 0x3d;
12431242}
12441243
12451244DRIVER_INIT( mightybj )
r1877r1878
12671266
12681267   /* move along */
12691268   if ( cpu_getactivecpu() == 0 )
1270      vsnes_in0_w( offset, data );
1269      vsnes_in0_w( machine, offset, data );
12711270   else
1272      vsnes_in0_1_w( offset, data );
1271      vsnes_in0_1_w( machine, offset, data );
12731272}
12741273
12751274DRIVER_INIT( vstennis )
src/mame/machine/qix.c
r1877r1878
263263
264264static TIMER_CALLBACK( vblank_stop )
265265{
266   pia_3_cb1_w(0, 0);
266   pia_3_cb1_w(machine, 0, 0);
267267}
268268
269269
270270INTERRUPT_GEN( qix_vblank_start )
271271{
272   pia_3_cb1_w(0, 1);
272   pia_3_cb1_w(machine, 0, 1);
273273   timer_set(video_screen_get_time_until_pos(0, 0, 0), NULL, 0, vblank_stop);
274274}
275275
r1877r1878
285285{
286286   memory_set_bank(1, (data >> 2) & 1);
287287   /* not necessary, but technically correct */
288   qix_palettebank_w(offset, data);
288   qix_palettebank_w(machine, offset, data);
289289}
290290
291291
r1877r1878
364364
365365static TIMER_CALLBACK( deferred_pia_4_porta_w )
366366{
367   pia_4_porta_w(0, param);
367   pia_4_porta_w(machine, 0, param);
368368}
369369
370370
r1877r1878
532532
533533static TIMER_CALLBACK( pia_0_w_callback )
534534{
535   pia_0_w(param >> 8, param & 0xff);
535   pia_0_w(machine, param >> 8, param & 0xff);
536536}
537537
538538
r1877r1878
575575static WRITE8_HANDLER( slither_76489_0_w )
576576{
577577   /* write to the sound chip */
578   SN76496_0_w(0, data);
578   SN76496_0_w(machine, 0, data);
579579
580580   /* clock the ready line going back into CB1 */
581   pia_1_cb1_w(0, 0);
582   pia_1_cb1_w(0, 1);
581   pia_1_cb1_w(machine, 0, 0);
582   pia_1_cb1_w(machine, 0, 1);
583583}
584584
585585
586586static WRITE8_HANDLER( slither_76489_1_w )
587587{
588588   /* write to the sound chip */
589   SN76496_1_w(0, data);
589   SN76496_1_w(machine, 0, data);
590590
591591   /* clock the ready line going back into CB1 */
592   pia_2_cb1_w(0, 0);
593   pia_2_cb1_w(0, 1);
592   pia_2_cb1_w(machine, 0, 0);
593   pia_2_cb1_w(machine, 0, 1);
594594}
595595
596596
src/mame/machine/snes.c
r1877r1878
276276   timer_adjust_oneshot(snes_scanline_timer, video_screen_get_time_until_pos(0, nextscan, 0), 0);
277277}
278278
279static void snes_init_ram(void)
279static void snes_init_ram(running_machine *machine)
280280{
281281   int i;
282282
r1877r1878
333333   timer_adjust_oneshot(snes_hblank_timer, video_screen_get_time_until_pos(0, ((snes_ram[STAT78] & 0x10) == SNES_NTSC) ? SNES_VTOTAL_NTSC-1 : SNES_VTOTAL_PAL-1, hblank_offset), 0);
334334
335335   // check if DSP1 is present (maybe not 100%?)
336   has_dsp1 = ((snes_r_bank1(0xffd6) >= 3) && (snes_r_bank1(0xffd6) <= 5)) ? 1 : 0;
336   has_dsp1 = ((snes_r_bank1(machine,0xffd6) >= 3) && (snes_r_bank1(machine,0xffd6) <= 5)) ? 1 : 0;
337337
338338   // init frame counter so first line is 0
339339   if( ATTOSECONDS_TO_HZ(Machine->screen[0].refresh) >= 59 )
r1877r1878
376376
377377MACHINE_RESET( snes )
378378{
379   snes_init_ram();
379   snes_init_ram(machine);
380380
381381   /* Set STAT78 to NTSC or PAL */
382382   if( ATTOSECONDS_TO_HZ(machine->screen[0].refresh) >= 59.0f )
r1877r1878
449449   }
450450   else if( address >= 0x2000 && address <= 0x5fff )   /* I/O */
451451   {
452      return snes_r_io( address );
452      return snes_r_io( machine, address );
453453   }
454454   else if( address >= 0x6000 && address <= 0x7fff )   /* Reserved */
455455   {
r1877r1878
499499   if( address <= 0x1fff )                        /* Mirror of Low RAM */
500500      return program_read_byte(0x7e0000 + address );
501501   else if( address >= 0x2000 && address <= 0x5fff )   /* I/O */
502      return snes_r_io( address );
502      return snes_r_io( machine, address );
503503   else if( address >= 0x6000 && address <= 0x7fff )
504504   {
505505      if( snes_cart.mode == SNES_MODE_20 )
r1877r1878
600600   if( address <= 0x1fff )                        /* Mirror of Low RAM */
601601      program_write_byte(0x7e0000 + address, data );
602602   else if( address >= 0x2000 && address <= 0x5fff )   /* I/O */
603      snes_w_io( address, data );
603      snes_w_io( machine, address, data );
604604   else if( address >= 0x6000 && address <= 0x7fff )   /* Reserved */
605605      if( snes_cart.mode == SNES_MODE_20 )
606606      logerror( "Attempt to write to reserved address: %X\n", offset );
r1877r1878
627627   if( address <= 0x1fff )                        /* Mirror of Low RAM */
628628      program_write_byte(0x7e0000 + address, data );
629629   else if( address >= 0x2000 && address <= 0x5fff )   /* I/O */
630      snes_w_io( address, data );
630      snes_w_io( machine, address, data );
631631   else if( address >= 0x6000 && address <= 0x7fff )
632632   {
633633      if( snes_cart.mode == SNES_MODE_20 )         /* Reserved */
r1877r1878
666666   if( snes_cart.mode == SNES_MODE_20 )
667667   {
668668      if( offset <= 0x2fffff )
669         snes_w_bank1( offset, data );
669         snes_w_bank1( machine, offset, data );
670670      else if( offset >= 0x300000 && offset <= 0x3fffff )
671         snes_w_bank2( offset - 0x300000, data );
671         snes_w_bank2( machine, offset - 0x300000, data );
672672   }
673673   else /* MODE_21 */
674674   {
675675      if( offset <= 0x2fffff )
676         snes_w_bank1( offset, data );
676         snes_w_bank1( machine, offset, data );
677677      else if( offset >= 0x300000 && offset <= 0x3fffff )
678         snes_w_bank2( offset - 0x300000, data );
678         snes_w_bank2( machine, offset - 0x300000, data );
679679      else
680680         logerror( "Attempt to write to ROM address: %X\n", offset );
681681   }
r1877r1878
15771577   }
15781578
15791579   /* Find the amount of sram */
1580   snes_cart.sram = snes_r_bank1(0x00ffd8);
1580   snes_cart.sram = snes_r_bank1(machine,0x00ffd8);
15811581   if( snes_cart.sram > 0 )
15821582   {
15831583      snes_cart.sram = ((1 << (snes_cart.sram + 3)) / 8);
r1877r1878
16171617   }
16181618
16191619   /* Find the amount of sram */
1620   snes_cart.sram = snes_r_bank1(0x00ffd8);
1620   snes_cart.sram = snes_r_bank1(machine,0x00ffd8);
16211621   if( snes_cart.sram > 0 )
16221622   {
16231623      snes_cart.sram = ((1 << (snes_cart.sram + 3)) / 8);
src/mame/machine/taitosj.c
r1877r1878
5151{
5252   /* set the default ROM bank (many games only have one bank and */
5353   /* never write to the bank selector register) */
54    taitosj_bankswitch_w(0, 0);
54    taitosj_bankswitch_w(machine, 0, 0);
5555
5656
5757   zaccept = 1;
r1877r1878
311311
312312WRITE8_HANDLER( alpinea_bankswitch_w )
313313{
314    taitosj_bankswitch_w(offset, data);
314    taitosj_bankswitch_w(machine, offset, data);
315315   protection_value = data >> 2;
316316}
317317
318318READ8_HANDLER( alpine_port_2_r )
319319{
320   return input_port_2_r(offset) | protection_value;
320   return input_port_2_r(machine,offset) | protection_value;
321321}
src/mame/machine/amiga.c
r1877r1878
4343#define BLITTER_NASTY_DELAY         16
4444
4545
46
4647/*************************************
4748 *
4849 *  Type definitions
r1877r1878
178179static void amiga_cia_1_irq(int state);
179180static TIMER_CALLBACK( amiga_irq_proc );
180181static TIMER_CALLBACK( amiga_blitter_proc );
182static TIMER_CALLBACK( scanline_callback );
181183
184
185
182186/*************************************
183187 *
184188 *  Chipmem 16/32 bit access
r1877r1878
247251}
248252
249253
254
250255/*************************************
251256 *
252257 *  Machine config/reset
r1877r1878
315320   }
316321   else
317322   {
318      amiga_cia_w(0x1001/2, 1, 0);
323      amiga_cia_w(Machine, 0x1001/2, 1, 0);
319324   }
320325
321326   if (activecpu_get_pc() < 0x80000)
r1877r1878
340345   }
341346   else
342347   {
343      amiga_cia_w(0x1001/2, 1, 0);
348      amiga_cia_w(machine, 0x1001/2, 1, 0);
344349   }
345350
346351   /* call the system-specific callback */
347352   if (amiga_intf->reset_callback)
348353      (*amiga_intf->reset_callback)();
354
355   /* start the scanline timer */
356   timer_set(video_screen_get_time_until_pos(0, 0, 0), NULL, 0, scanline_callback);
349357}
350358
351359
r1877r1878
356364 *
357365 *************************************/
358366
359INTERRUPT_GEN( amiga_scanline_callback )
367static TIMER_CALLBACK( scanline_callback )
360368{
361   int scanline = machine->screen[0].height - 1 - cpu_getiloops();
369   int scanline = param;
362370
363371   /* on the first scanline, we do some extra bookkeeping */
364372   if (scanline == 0)
365373   {
366374      /* signal VBLANK IRQ */
367      amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_VERTB, 0);
375      amiga_custom_w(machine, REG_INTREQ, 0x8000 | INTENA_VERTB, 0);
368376
369377      /* clock the first CIA TOD */
370378      cia_clock_tod(0);
r1877r1878
377385   /* on every scanline, clock the second CIA TOD */
378386   cia_clock_tod(1);
379387
380   /* render this scanline */
381   amiga_render_scanline(scanline);
388   /* render up to this scanline */
389   if (scanline < machine->screen[0].visarea.min_y)
390      amiga_render_scanline(machine, NULL, scanline);
391   else
392      video_screen_update_partial(0, scanline);
382393
383394   /* force a sound update */
384395   amiga_audio_update();
396
397   /* set timer for next line */
398   scanline = (scanline + 1) % machine->screen[0].height;
399   timer_set(video_screen_get_time_until_pos(0, scanline, 0), NULL, scanline, scanline_callback);
385400}
386401
387402
r1877r1878
432447      cpunum_set_input_line(Machine, 0, 7, CLEAR_LINE);
433448}
434449
450
435451static TIMER_CALLBACK( amiga_irq_proc )
436452{
437453   update_irqs();
438454   timer_reset( amiga_irq_timer, attotime_never);
439455}
440456
457
458
441459/*************************************
442460 *
443461 *  Standard joystick conversion
r1877r1878
966984   CUSTOM_REG(REG_DMACON) &= ~0x4000;
967985
968986   /* signal an interrupt */
969   amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_BLIT, 0);
987   amiga_custom_w(machine, REG_INTREQ, 0x8000 | INTENA_BLIT, 0);
970988
971989   /* reset the blitter timer */
972990   timer_reset( amiga_blitter_timer, attotime_never);
r1877r1878
11191137
11201138static void amiga_cia_0_irq(int state)
11211139{
1122   amiga_custom_w(REG_INTREQ, (state ? 0x8000 : 0x0000) | INTENA_PORTS, 0);
1140   amiga_custom_w(Machine, REG_INTREQ, (state ? 0x8000 : 0x0000) | INTENA_PORTS, 0);
11231141}
11241142
11251143
11261144static void amiga_cia_1_irq(int state)
11271145{
1128   amiga_custom_w(REG_INTREQ, (state ? 0x8000 : 0x0000) | INTENA_EXTER, 0);
1146   amiga_custom_w(Machine, REG_INTREQ, (state ? 0x8000 : 0x0000) | INTENA_EXTER, 0);
11291147}
11301148
11311149
r1877r1878
12701288   CUSTOM_REG(REG_SERDATR) |= 0x3000;
12711289
12721290   /* signal an interrupt */
1273   amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_TBE, 0);
1291   amiga_custom_w(machine, REG_INTREQ, 0x8000 | INTENA_TBE, 0);
12741292}
12751293
12761294
r1877r1878
15061524   }
15071525
15081526   /* signal an interrupt */
1509   amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_RBF, 0);
1527   amiga_custom_w(Machine, REG_INTREQ, 0x8000 | INTENA_RBF, 0);
15101528}
15111529
15121530
src/mame/machine/vertigo.c
r1877r1878
161161
162162static TIMER_CALLBACK( sound_command_w )
163163{
164   exidy440_sound_command = param;
164   *exidy440_sound_command = param;
165165   exidy440_sound_command_ack = 0;
166166   cpunum_set_input_line(machine, 1, INPUT_LINE_IRQ1, ASSERT_LINE);
167167
src/mame/machine/pcshare.c
r1877r1878
264264
265265
266266
267READ16_HANDLER(pc_page16le_r) { return read16le_with_read8_handler(pc_page_r, offset, mem_mask); }
268WRITE16_HANDLER(pc_page16le_w) { write16le_with_write8_handler(pc_page_w, offset, data, mem_mask); }
267READ16_HANDLER(pc_page16le_r) { return read16le_with_read8_handler(pc_page_r, machine, offset, mem_mask); }
268WRITE16_HANDLER(pc_page16le_w) { write16le_with_write8_handler(pc_page_w, machine, offset, data, mem_mask); }
269269
270270
271271
r1877r1878
319319
320320READ32_HANDLER(at_page32_r)
321321{
322   return read32le_with_read8_handler(at_page8_r, offset, mem_mask);
322   return read32le_with_read8_handler(at_page8_r, machine, offset, mem_mask);
323323}
324324
325325
326326
327327WRITE32_HANDLER(at_page32_w)
328328{
329   write32le_with_write8_handler(at_page8_w, offset, data, mem_mask);
329   write32le_with_write8_handler(at_page8_w, machine, offset, data, mem_mask);
330330}
331331
332332
src/mame/machine/atarigen.c
r1877r1878
6565    STATIC VARIABLES
6666***************************************************************************/
6767
68static atarigen_int_callback update_int_callback;
68static atarigen_int_func update_int_callback;
6969static emu_timer * scanline_interrupt_timer;
7070
7171static UINT8          eeprom_unlocked;
r1877r1878
8181static UINT8          timed_int;
8282static UINT8          ym2151_int;
8383
84static atarigen_scanline_callback scanline_callback;
84static atarigen_scanline_func scanline_callback;
8585static UINT32          scanlines_per_callback;
8686
8787static UINT32          actual_vc_latch0;
r1877r1878
114114
115115static TIMER_CALLBACK( scanline_timer_callback );
116116
117static void atarivc_common_w(int scrnum, offs_t offset, UINT16 newword);
117static void atarivc_common_w(running_machine *machine, int scrnum, offs_t offset, UINT16 newword);
118118
119119static TIMER_CALLBACK( unhalt_cpu );
120120
r1877r1878
131131    the interrupt sources.
132132---------------------------------------------------------------*/
133133
134void atarigen_interrupt_reset(atarigen_int_callback update_int)
134void atarigen_interrupt_reset(atarigen_int_func update_int)
135135{
136136   int i;
137137
r1877r1878
656656READ16_HANDLER( atarigen_sound_r )
657657{
658658   atarigen_sound_to_cpu_ready = 0;
659   atarigen_sound_int_ack_w(0, 0, 0);
659   atarigen_sound_int_ack_w(machine, 0, 0, 0);
660660   return atarigen_sound_to_cpu | 0xff00;
661661}
662662
663663READ16_HANDLER( atarigen_sound_upper_r )
664664{
665665   atarigen_sound_to_cpu_ready = 0;
666   atarigen_sound_int_ack_w(0, 0, 0);
666   atarigen_sound_int_ack_w(machine, 0, 0, 0);
667667   return (atarigen_sound_to_cpu << 8) | 0x00ff;
668668}
669669
670670READ32_HANDLER( atarigen_sound_upper32_r )
671671{
672672   atarigen_sound_to_cpu_ready = 0;
673   atarigen_sound_int_ack32_w(0, 0, 0);
673   atarigen_sound_int_ack32_w(machine, 0, 0, 0);
674674   return (atarigen_sound_to_cpu << 24) | 0x00ffffff;
675675}
676676
r1877r1878
731731
732732   /* reset the sound write state */
733733   atarigen_sound_to_cpu_ready = 0;
734   atarigen_sound_int_ack_w(0, 0, 0);
734   atarigen_sound_int_ack_w(machine, 0, 0, 0);
735735
736736   /* allocate a high frequency timer until a response is generated */
737737   /* the main CPU is *very* sensistive to the timing of the response */
r1877r1878
845845    atarigen_scanline_timer_reset: Sets up the scanline timer.
846846---------------------------------------------------------------*/
847847
848void atarigen_scanline_timer_reset(int scrnum, atarigen_scanline_callback update_graphics, int frequency)
848void atarigen_scanline_timer_reset(int scrnum, atarigen_scanline_func update_graphics, int frequency)
849849{
850850   /* set the scanline callback */
851851   scanline_callback = update_graphics;
r1877r1878
899899   /* echo all the commands to the video controller */
900900   for (i = 0; i < 0x1c; i++)
901901      if (atarivc_eof_data[i])
902         atarivc_common_w(scrnum, i, atarivc_eof_data[i]);
902         atarivc_common_w(machine, scrnum, i, atarivc_eof_data[i]);
903903
904904   /* update the scroll positions */
905905   atarimo_set_xscroll(0, atarivc_state.mo_xscroll);
r1877r1878
969969   int newword = oldword;
970970
971971   COMBINE_DATA(&newword);
972   atarivc_common_w(0, offset, newword);    /* need to support scrnum */
972   atarivc_common_w(machine, 0, offset, newword);    /* need to support scrnum */
973973}
974974
975975
r1877r1878
979979    write.
980980---------------------------------------------------------------*/
981981
982static void atarivc_common_w(int scrnum, offs_t offset, UINT16 newword)
982static void atarivc_common_w(running_machine *machine, int scrnum, offs_t offset, UINT16 newword)
983983{
984984   int oldword = atarivc_data[offset];
985985   atarivc_data[offset] = newword;
r1877r1878
10701070
10711071      /* scanline IRQ ack here */
10721072      case 0x1e:
1073         atarigen_scanline_int_ack_w(0, 0, 0);
1073         atarigen_scanline_int_ack_w(machine, 0, 0, 0);
10741074         break;
10751075
10761076      /* log anything else */
src/mame/machine/atarigen.h
r1877r1878
2828    TYPES & STRUCTURES
2929***************************************************************************/
3030
31typedef void (*atarigen_int_callback)(running_machine *machine);
31typedef void (*atarigen_int_func)(running_machine *machine);
3232
33typedef void (*atarigen_scanline_callback)(running_machine *machine, int scrnum, int scanline);
33typedef void (*atarigen_scanline_func)(running_machine *machine, int scrnum, int scanline);
3434
3535struct atarivc_state_desc
3636{
r1877r1878
9595    INTERRUPT HANDLING
9696---------------------------------------------------------------*/
9797
98void atarigen_interrupt_reset(atarigen_int_callback update_int);
98void atarigen_interrupt_reset(atarigen_int_func update_int);
9999void atarigen_update_interrupts(void);
100100
101101void atarigen_scanline_int_set(int scrnum, int scanline);
r1877r1878
218218    VIDEO HELPERS
219219---------------------------------------------------------------*/
220220
221void atarigen_scanline_timer_reset(int scrnum, atarigen_scanline_callback update_graphics, int frequency);
221void atarigen_scanline_timer_reset(int scrnum, atarigen_scanline_func update_graphics, int frequency);
222222int atarigen_get_hblank(running_machine *machine, int scrnum);
223223WRITE16_HANDLER( atarigen_halt_until_hblank_0_w );
224224WRITE16_HANDLER( atarigen_666_paletteram_w );
src/mame/machine/midwunit.c
r1877r1878
191191         return readinputport(offset);
192192
193193      case 4:
194         return (midway_serial_pic_status_r() << 12) | midwunit_sound_state_r(0,0);
194         return (midway_serial_pic_status_r() << 12) | midwunit_sound_state_r(machine,0,0);
195195
196196      default:
197197         logerror("%08X:Unknown I/O read from %d\n", activecpu_get_pc(), offset);
r1877r1878
281281         /* non-loopback case: bit 0 means data ready, bit 2 means ok to send */
282282         else
283283         {
284            int temp = midwunit_sound_state_r(0, 0);
284            int temp = midwunit_sound_state_r(machine, 0, 0);
285285            result |= (temp & 0x800) >> 9;
286286            result |= (~temp & 0x400) >> 10;
287287            timer_call_after_resynch(NULL, 0, 0);
r1877r1878
296296
297297         /* non-loopback case: read from the DCS system */
298298         else
299            result = midwunit_sound_r(0, 0);
299            result = midwunit_sound_r(machine, 0, 0);
300300         break;
301301
302302      case 5:   /* register 5 seems to be like 3, but with in/out swapped */
r1877r1878
308308         /* non-loopback case: bit 0 means data ready, bit 2 means ok to send */
309309         else
310310         {
311            int temp = midwunit_sound_state_r(0, 0);
311            int temp = midwunit_sound_state_r(machine, 0, 0);
312312            result |= (temp & 0x800) >> 11;
313313            result |= (~temp & 0x400) >> 8;
314314            timer_call_after_resynch(NULL, 0, 0);
r1877r1878
344344
345345         /* non-loopback case: send to the DCS system */
346346         else
347            midwunit_sound_w(0, data, mem_mask);
347            midwunit_sound_w(machine, 0, data, mem_mask);
348348         break;
349349
350350      case 5:   /* register 5 write seems to reset things */
src/mame/machine/namcos2.c
r1877r1878
105105   mFinalLapProtCount = 0;
106106
107107   /* Initialise the bank select in the sound CPU */
108   namcos2_sound_bankselect_w(0,0); /* Page in bank 0 */
108   namcos2_sound_bankselect_w(machine,0,0); /* Page in bank 0 */
109109
110110   cpunum_set_input_line(machine, CPU_SOUND, INPUT_LINE_RESET, ASSERT_LINE );
111111
r1877r1878
743743      switch((data>>2)&0x07)
744744      {
745745      case 0:
746         namcos2_mcu_analog_data=input_port_2_r(0);
746         namcos2_mcu_analog_data=input_port_2_r(machine,0);
747747         break;
748748      case 1:
749         namcos2_mcu_analog_data=input_port_3_r(0);
749         namcos2_mcu_analog_data=input_port_3_r(machine,0);
750750         break;
751751      case 2:
752         namcos2_mcu_analog_data=input_port_4_r(0);
752         namcos2_mcu_analog_data=input_port_4_r(machine,0);
753753         break;
754754      case 3:
755         namcos2_mcu_analog_data=input_port_5_r(0);
755         namcos2_mcu_analog_data=input_port_5_r(machine,0);
756756         break;
757757      case 4:
758         namcos2_mcu_analog_data=input_port_6_r(0);
758         namcos2_mcu_analog_data=input_port_6_r(machine,0);
759759         break;
760760      case 5:
761         namcos2_mcu_analog_data=input_port_7_r(0);
761         namcos2_mcu_analog_data=input_port_7_r(machine,0);
762762         break;
763763      case 6:
764         namcos2_mcu_analog_data=input_port_8_r(0);
764         namcos2_mcu_analog_data=input_port_8_r(machine,0);
765765         break;
766766      case 7:
767         namcos2_mcu_analog_data=input_port_9_r(0);
767         namcos2_mcu_analog_data=input_port_9_r(machine,0);
768768         break;
769769      }
770770#if 0
r1877r1878
820820   int data=0;
821821
822822   /* Read/convert the bits one at a time */
823   if(input_port_2_r(0)>threshold) data|=0x01;
824   if(input_port_3_r(0)>threshold) data|=0x02;
825   if(input_port_4_r(0)>threshold) data|=0x04;
826   if(input_port_5_r(0)>threshold) data|=0x08;
827   if(input_port_6_r(0)>threshold) data|=0x10;
828   if(input_port_7_r(0)>threshold) data|=0x20;
829   if(input_port_8_r(0)>threshold) data|=0x40;
830   if(input_port_9_r(0)>threshold) data|=0x80;
823   if(input_port_2_r(machine,0)>threshold) data|=0x01;
824   if(input_port_3_r(machine,0)>threshold) data|=0x02;
825   if(input_port_4_r(machine,0)>threshold) data|=0x04;
826   if(input_port_5_r(machine,0)>threshold) data|=0x08;
827   if(input_port_6_r(machine,0)>threshold) data|=0x10;
828   if(input_port_7_r(machine,0)>threshold) data|=0x20;
829   if(input_port_8_r(machine,0)>threshold) data|=0x40;
830   if(input_port_9_r(machine,0)>threshold) data|=0x80;
831831
832832   /* Return the result */
833833   return data;
src/mame/machine/decoprot.c
r1877r1878
110110WRITE16_HANDLER( deco16_104_prot_w ) /* Wizard Fire */
111111{
112112   if (offset==(0x150/2)) {
113      soundlatch_w(0,data&0xff);
114      cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
113      soundlatch_w(machine,0,data&0xff);
114      cpunum_set_input_line(machine, 1,0,HOLD_LINE);
115115      return;
116116   }
117117
r1877r1878
228228WRITE16_HANDLER( deco16_60_prot_w ) /* Edward Randy */
229229{
230230   if (offset==(0x64/2)) {
231      soundlatch_w(0,data&0xff);
232      cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
231      soundlatch_w(machine,0,data&0xff);
232      cpunum_set_input_line(machine, 1,0,HOLD_LINE);
233233   }
234234
235235   COMBINE_DATA(&deco16_prot_ram[offset]);
r1877r1878
417417WRITE16_HANDLER( deco16_66_prot_w ) /* Mutant Fighter */
418418{
419419   if (offset==(0x64/2)) {
420      soundlatch_w(0,data&0xff);
421      cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
420      soundlatch_w(machine,0,data&0xff);
421      cpunum_set_input_line(machine, 1,0,HOLD_LINE);
422422      return;
423423   }
424424
r1877r1878
603603WRITE16_HANDLER( deco16_104_cninja_prot_w )
604604{
605605   if (offset==(0xa8/2)) {
606      soundlatch_w(0,data&0xff);
607      cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
606      soundlatch_w(machine,0,data&0xff);
607      cpunum_set_input_line(machine, 1,0,HOLD_LINE);
608608      return;
609609   }
610610
r1877r1878
665665   COMBINE_DATA(&deco16_prot_ram[offset]);
666666
667667   if (offset == (0x10a >> 1)) {
668      soundlatch_w(0,data&0xff);
669      cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
668      soundlatch_w(machine,0,data&0xff);
669      cpunum_set_input_line(machine, 1,0,HOLD_LINE);
670670      return;
671671   }
672672}
r1877r1878
778778        There doesn't appear to be any way to detect what bank is currently selected - it
779779        seems game code must maintain this state (if it matters).
780780    */
781
782781   if (decoprot_buffer_ram_selected)
783782      COMBINE_DATA(&decoprot_buffer_ram[offset]);
784783   else
785784      COMBINE_DATA(&deco16_prot_ram[offset]);
786785
787786   if (offset==(0xa8/2)) {
788      soundlatch_w(0,data&0xff);
789      cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
787      soundlatch_w(machine,0,data&0xff);
788      cpunum_set_input_line(machine, 1,0,HOLD_LINE);
790789      return;
791790   }
792791
r1877r1878
12141213   const int sndport=0x260;
12151214   const int xorport=0x340;
12161215   const int maskport=0x6c0;
1217
12181216   if (writeport==sndport) {
1219      soundlatch_w(0,data&0xff);
1220      cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
1217      soundlatch_w(machine,0,data&0xff);
1218      cpunum_set_input_line(machine, 1,0,HOLD_LINE);
12211219      return;
12221220   }
12231221
r1877r1878
16441642   decoprot_last_write=addr;
16451643   decoprot_last_write_val=data>>16;
16461644
1647   deco16_146_core_prot_w(addr, data>>16, mem_mask>>16);
1645   deco16_146_core_prot_w(machine, addr, data>>16, mem_mask>>16);
16481646}
16491647
16501648READ32_HANDLER( deco16_146_fghthist_prot_r )
r1877r1878
16691667   }
16701668   decoprot_last_write=-1;
16711669
1672   val=deco16_146_core_prot_r(addr, mem_mask>>16);
1670   val=deco16_146_core_prot_r(machine, addr, mem_mask>>16);
16731671
16741672   if (addr!=0x7b6 && addr!=0x1c && addr!=0x1e0 && addr!=0x1d4
16751673      && addr!=0x2c4 && addr!=0x7a4 && addr!=0x30 // confirmed
r1877r1878
17161714WRITE16_HANDLER( deco16_146_nitroball_prot_w )
17171715{
17181716   UINT16 addr=BITSWAP16(offset<<1, 0, 0, 0, 0, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
1719
1720   deco16_146_core_prot_w(addr, data, mem_mask);
1717   deco16_146_core_prot_w(machine, addr, data, mem_mask);
17211718}
17221719
17231720READ16_HANDLER( deco16_146_nitroball_prot_r )
17241721{
17251722   UINT16 addr=BITSWAP16(offset<<1, 0, 0, 0, 0, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
1726
1727   return deco16_146_core_prot_r(addr, mem_mask);
1723   return deco16_146_core_prot_r(machine, addr, mem_mask);
17281724}
17291725
17301726/**********************************************************************************/
r1877r1878
17331729{
17341730   switch (offset * 2)
17351731   {
1736   case 0x298: return input_port_0_word_r(0, 0);
1737   case 0x342: return input_port_1_word_r(0, 0);
1738   case 0x506: return input_port_2_word_r(0, 0);
1732   case 0x298: return input_port_0_word_r(machine, 0, 0);
1733   case 0x342: return input_port_1_word_r(machine, 0, 0);
1734   case 0x506: return input_port_2_word_r(machine, 0, 0);
17391735   }
17401736
17411737   logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",activecpu_get_pc(),offset<<1);
r1877r1878
17461742WRITE16_HANDLER( dietgo_104_prot_w )
17471743{
17481744   if (offset==(0x380/2)) {
1749      soundlatch_w(0,data&0xff);
1750      cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
1745      soundlatch_w(machine,0,data&0xff);
1746      cpunum_set_input_line(machine, 1,0,HOLD_LINE);
17511747      return;
17521748   }
17531749   logerror("Protection PC %06x: warning - write unmapped memory address %04x %04x\n",activecpu_get_pc(),offset<<1,data);
r1877r1878
17581754READ16_HANDLER( deco16_104_pktgaldx_prot_r )
17591755{
17601756   const UINT16* prot_ram=deco16_prot_ram;
1761
17621757   switch (offset * 2)
17631758   {
1764   case 0x5b2: return input_port_0_word_r(0, 0);
1765   case 0x44c: return input_port_1_word_r(0, 0);
1766   case 0x042: return input_port_2_word_r(0, 0);
1759   case 0x5b2: return input_port_0_word_r(machine, 0, 0);
1760   case 0x44c: return input_port_1_word_r(machine, 0, 0);
1761   case 0x042: return input_port_2_word_r(machine, 0, 0);
17671762
17681763   case 0x510: return DECO_PORT(0);
17691764   case 0x51a: return DECO_PORT(2);
src/mame/machine/mcr.c
r1877r1878
6262static UINT8 v493_irq_state;
6363static UINT8 v493_irq_vector;
6464
65static timer_callback v493_callback;
65static timer_fired_func v493_callback;
6666
6767static UINT8 zwackery_sound_data;
6868
r1877r1878
424424{
425425   /* CTC line 2 is connected to VBLANK, which is once every 1/2 frame */
426426   /* for the 30Hz interlaced display */
427   z80ctc_0_trg2_w(0, 1);
428   z80ctc_0_trg2_w(0, 0);
427   z80ctc_0_trg2_w(machine, 0, 1);
428   z80ctc_0_trg2_w(machine, 0, 0);
429429
430430   /* CTC line 3 is connected to 493, which is signalled once every */
431431   /* frame at 30Hz */
432432   if (cpu_getiloops() == 0)
433433   {
434      z80ctc_0_trg3_w(0, 1);
435      z80ctc_0_trg3_w(0, 0);
434      z80ctc_0_trg3_w(machine, 0, 1);
435      z80ctc_0_trg3_w(machine, 0, 0);
436436   }
437437}
438438
r1877r1878
443443   /* frame at 30Hz */
444444   if (cpu_getiloops() == 0)
445445   {
446      z80ctc_1_trg3_w(0, 1);
447      z80ctc_1_trg3_w(0, 0);
446      z80ctc_1_trg3_w(machine, 0, 1);
447      z80ctc_1_trg3_w(machine, 0, 0);
448448   }
449449}
450450
r1877r1878
585585WRITE8_HANDLER( zwackery_pia_2_w )
586586{
587587   /* bit 7 is the watchdog */
588   if (!(data & 0x80)) watchdog_reset_w(offset, data);
588   if (!(data & 0x80)) watchdog_reset_w(machine, offset, data);
589589
590590   /* bits 5 and 6 control hflip/vflip */
591591   /* bits 3 and 4 control coin counters? */
r1877r1878
601601
602602WRITE8_HANDLER( zwackery_ca2_w )
603603{
604   csdeluxe_data_w(offset, (data << 4) | zwackery_sound_data);
604   csdeluxe_data_w(machine, offset, (data << 4) | zwackery_sound_data);
605605}
606606
607607
r1877r1878
614614
615615static TIMER_CALLBACK( zwackery_493_off_callback )
616616{
617   pia_2_ca1_w(0, 0);
617   pia_2_ca1_w(machine, 0, 0);
618618}
619619
620620
621621static TIMER_CALLBACK( zwackery_493_callback )
622622{
623   pia_2_ca1_w(0, 1);
623   pia_2_ca1_w(machine, 0, 1);
624624   timer_set(video_screen_get_scan_period(0), NULL, 0, zwackery_493_off_callback);
625625}
626626
r1877r1878
903903WRITE16_HANDLER( mcr68_6840_upper_w )
904904{
905905   if (ACCESSING_MSB)
906      mcr68_6840_w_common(offset, (data >> 8) & 0xff);
906      mcr68_6840_w_common(machine, offset, (data >> 8) & 0xff);
907907}
908908
909909
910910WRITE16_HANDLER( mcr68_6840_lower_w )
911911{
912912   if (ACCESSING_LSB)
913      mcr68_6840_w_common(offset, data & 0xff);
913      mcr68_6840_w_common(machine, offset, data & 0xff);
914914}
915915
916916
917917READ16_HANDLER( mcr68_6840_upper_r )
918918{
919   return (mcr68_6840_r_common(offset,0) << 8) | 0x00ff;
919   return (mcr68_6840_r_common(machine,offset,0) << 8) | 0x00ff;
920920}
921921
922922
923923READ16_HANDLER( mcr68_6840_lower_r )
924924{
925   return mcr68_6840_r_common(offset,0) | 0xff00;
925   return mcr68_6840_r_common(machine,offset,0) | 0xff00;
926926}
927927
928928
r1877r1878
10231023
10241024WRITE8_HANDLER( mcr_ipu_watchdog_w )
10251025{
1026   mcr_ipu_watchdog_r(0);
1026   mcr_ipu_watchdog_r(machine,0);
10271027}
src/mame/machine/tatsumi.c
r1877r1878
350350// self-test in Tatsumi games.  Needs fixed, but hack it here for now.
351351READ8_HANDLER(tatsumi_hack_ym2151_r)
352352{
353   int r=YM2151_status_port_0_r(0);
353   int r=YM2151_status_port_0_r(machine,0);
354354
355355   if (activecpu_get_pc()==0x2aca || activecpu_get_pc()==0x29fe
356356      || activecpu_get_pc()==0xf9721
r1877r1878
363363// Mame really should emulate the OKI status reads even with Mame sound off.
364364READ8_HANDLER(tatsumi_hack_oki_r)
365365{
366   int r=OKIM6295_status_0_r(0);
366   int r=OKIM6295_status_0_r(machine,0);
367367
368368   if (activecpu_get_pc()==0x2b70 || activecpu_get_pc()==0x2bb5
369369      || activecpu_get_pc()==0x2acc
src/mame/machine/arkanoid.c
r1877r1878
121121
122122READ8_HANDLER( arkanoid_68705_input_0_r )
123123{
124   int res = input_port_0_r(offset) & 0x3f;
124   int res = input_port_0_r(machine,offset) & 0x3f;
125125
126126   /* bit 0x40 comes from the sticky bit */
127127   if (!z80write) res |= 0x40;
r1877r1878
136136{
137137   if (arkanoid_paddle_select)
138138   {
139      arkanoid_paddle_value = input_port_3_r(offset);
139      arkanoid_paddle_value = input_port_3_r(machine,offset);
140140   }
141141   else
142142   {
143      arkanoid_paddle_value = input_port_2_r(offset);
143      arkanoid_paddle_value = input_port_2_r(machine,offset);
144144   }
145145
146146   return arkanoid_paddle_value;
src/mame/machine/bsktball.c
r1877r1878
7373   int p2_vert;
7474   int temp;
7575
76   p1_horiz = input_port_0_r(offset);
77   p1_vert  = input_port_1_r(offset);
78   p2_horiz = input_port_2_r(offset);
79   p2_vert  = input_port_3_r(offset);
76   p1_horiz = input_port_0_r(machine, offset);
77   p1_vert  = input_port_1_r(machine, offset);
78   p2_horiz = input_port_2_r(machine, offset);
79   p2_vert  = input_port_3_r(machine, offset);
8080
8181   /* Set direction bits */
8282
r1877r1878
146146   }
147147   else
148148   {
149      temp = input_port_4_r(offset) & 0x0F;
149      temp = input_port_4_r(machine, offset) & 0x0F;
150150      /* Remap button 1 back to the Start button */
151151      /* NOTE:  This is an ADDED feature, not a part of the original hardware! */
152152      temp = (temp) & (temp>>2);
src/mame/machine/harddriv.c
r1877r1878
737737   }
738738
739739   /* detect changes to HEBLNK and HSBLNK and force an update before they change */
740   if ((offset == REG_HEBLNK || offset == REG_HSBLNK) && data != tms34010_io_register_r(offset, 0))
740   if ((offset == REG_HEBLNK || offset == REG_HSBLNK) && data != tms34010_io_register_r(machine, offset, 0))
741741      video_screen_update_partial(0, video_screen_get_vpos(0) - 1);
742742
743   tms34010_io_register_w(offset, data, mem_mask);
743   tms34010_io_register_w(machine, offset, data, mem_mask);
744744}
745745
746746
src/mame/machine/psx.c
r1877r1878
3636UINT32 *g_p_n_psxram;
3737size_t g_n_psxramsize;
3838
39#ifdef UNUSED_FUNCTON
3940INLINE void psxwriteword( UINT32 n_address, UINT16 n_data )
4041{
4142   *( (UINT16 *)( (UINT8 *)g_p_n_psxram + WORD_XOR_LE( n_address ) ) ) = n_data;
4243}
44#endif
4345
4446INLINE UINT16 psxreadword( UINT32 n_address )
4547{
src/mame/machine/dec0.c
r1877r1878
168168{
169169   switch (slyspy_state) {
170170      case 0x3:
171         dec0_pf1_data_w(offset,data,mem_mask);
171         dec0_pf1_data_w(machine,offset,data,mem_mask);
172172         return;
173173      case 0x2:
174         dec0_pf2_data_w(offset,data,mem_mask);
174         dec0_pf2_data_w(machine,offset,data,mem_mask);
175175         return;
176176      case 0x0:
177         if (offset<0x8) dec0_pf2_control_0_w(offset,data,mem_mask);
178         else if (offset<0x10) dec0_pf2_control_1_w(offset-0x8,data,mem_mask);
177         if (offset<0x8) dec0_pf2_control_0_w(machine,offset,data,mem_mask);
178         else if (offset<0x10) dec0_pf2_control_1_w(machine,offset-0x8,data,mem_mask);
179179         return;
180180   }
181181   logerror("Wrote to 240000 %02x at %04x %04x (Trap %02x)\n",offset,activecpu_get_pc(),data,slyspy_state);
r1877r1878
185185{
186186   switch (slyspy_state) {
187187      case 0x2: /* Trap A */
188         dec0_pf1_data_w(offset,data,mem_mask);
188         dec0_pf1_data_w(machine,offset,data,mem_mask);
189189         return;
190190      case 0x0: /* Trap C */
191191         if (offset<0x40) COMBINE_DATA(&dec0_pf2_colscroll[offset]);
r1877r1878
199199{
200200   switch (slyspy_state) {
201201      case 0x0:
202         dec0_pf2_data_w(offset,data,mem_mask);
202         dec0_pf2_data_w(machine,offset,data,mem_mask);
203203         return;
204204   }
205205   logerror("Wrote to 246000 %02x at %04x %04x (Trap %02x)\n",offset,activecpu_get_pc(),data,slyspy_state);
r1877r1878
209209{
210210   switch (slyspy_state) {
211211      case 0x1:
212         dec0_pf1_data_w(offset,data,mem_mask);
212         dec0_pf1_data_w(machine,offset,data,mem_mask);
213213         return;
214214      case 0x3:
215         dec0_pf2_data_w(offset,data,mem_mask);
215         dec0_pf2_data_w(machine,offset,data,mem_mask);
216216         return;
217217      case 0x0:
218         if (offset<0x8) dec0_pf1_control_0_w(offset,data,mem_mask);
219         else if (offset<0x10) dec0_pf1_control_1_w(offset-0x8,data,mem_mask);
218         if (offset<0x8) dec0_pf1_control_0_w(machine,offset,data,mem_mask);
219         else if (offset<0x10) dec0_pf1_control_1_w(machine,offset-0x8,data,mem_mask);
220220         return;
221221   }
222222   logerror("Wrote to 248000 %02x at %04x %04x (Trap %02x)\n",offset,activecpu_get_pc(),data,slyspy_state);
r1877r1878
226226{
227227   switch (slyspy_state) {
228228      case 0x1: /* Trap 9 */
229         dec0_pf2_data_w(offset,data,mem_mask);
229         dec0_pf2_data_w(machine,offset,data,mem_mask);
230230         return;
231231      case 0x0: /* Trap C */
232232         if (offset<0x40) COMBINE_DATA(&dec0_pf1_colscroll[offset]);
r1877r1878
241241   switch (slyspy_state) {
242242      case 0x2:
243243      case 0x0:
244         dec0_pf1_data_w(offset,data,mem_mask);
244         dec0_pf1_data_w(machine,offset,data,mem_mask);
245245         return;
246246   }
247247   logerror("Wrote to 24e000 %02x at %04x %04x (Trap %02x)\n",offset,activecpu_get_pc(),data,slyspy_state);
src/mame/machine/beezer.c
r1877r1878
7070      switch (data & 0x03)
7171      {
7272      case 0:
73         pbus = input_port_0_r(0);
73         pbus = input_port_0_r(machine,0);
7474         break;
7575      case 1:
76         pbus = input_port_1_r(0) | (input_port_2_r(0) << 4);
76         pbus = input_port_1_r(machine,0) | (input_port_2_r(machine,0) << 4);
7777         break;
7878      case 2:
79         pbus = input_port_3_r(0);
79         pbus = input_port_3_r(machine,0);
8080         break;
8181      case 3:
8282         pbus = 0xff;
src/mame/machine/lsasquad.c
r1877r1878
181181
182182READ8_HANDLER( lsasquad_mcu_status_r )
183183{
184   int res = input_port_3_r(0);
184   int res = input_port_3_r(machine,0);
185185
186186   /* bit 0 = when 1, mcu is ready to receive data from main cpu */
187187   /* bit 1 = when 0, mcu has sent data to the main cpu */
src/mame/machine/kaneko16.c
r1877r1878
5151   switch (offset)
5252   {
5353      case 0x00/2: // watchdog
54         return watchdog_reset_r(0);
54         return watchdog_reset_r(machine,0);
5555
5656      case 0x02/2: // unknown (yet!), used by *MANY* games !!!
5757         //popmessage("unknown collision reg");
src/mame/machine/williams.c
r1877r1878
268268   int scanline = param;
269269
270270   /* the IRQ signal comes into CB1, and is set to VA11 */
271   pia_1_cb1_w(0, scanline & 0x20);
271   pia_1_cb1_w(machine, 0, scanline & 0x20);
272272
273273   /* set a timer for the next update */
274274   scanline += 0x20;
r1877r1878
280280static TIMER_CALLBACK( williams_count240_off_callback )
281281{
282282   /* the COUNT240 signal comes into CA1, and is set to the logical AND of VA10-VA13 */
283   pia_1_ca1_w(0, 0);
283   pia_1_ca1_w(machine, 0, 0);
284284}
285285
286286
287287static TIMER_CALLBACK( williams_count240_callback )
288288{
289289   /* the COUNT240 signal comes into CA1, and is set to the logical AND of VA10-VA13 */
290   pia_1_ca1_w(0, 1);
290   pia_1_ca1_w(machine, 0, 1);
291291
292292   /* set a timer to turn it off once the scanline counter resets */
293293   timer_set(video_screen_get_time_until_pos(0, 0, 0), NULL, 0, williams_count240_off_callback);
r1877r1878
396396   int scanline = param;
397397
398398   /* the IRQ signal comes into CB1, and is set to VA11 */
399   pia_0_cb1_w(0, scanline & 0x20);
400   pia_1_ca1_w(0, scanline & 0x20);
399   pia_0_cb1_w(machine, 0, scanline & 0x20);
400   pia_1_ca1_w(machine, 0, scanline & 0x20);
401401
402402   /* set a timer for the next update */
403403   scanline += 0x20;
r1877r1878
409409static TIMER_CALLBACK( williams2_endscreen_off_callback )
410410{
411411   /* the /ENDSCREEN signal comes into CA1 */
412   pia_0_ca1_w(0, 1);
412   pia_0_ca1_w(machine, 0, 1);
413413}
414414
415415
416416static TIMER_CALLBACK( williams2_endscreen_callback )
417417{
418418   /* the /ENDSCREEN signal comes into CA1 */
419   pia_0_ca1_w(0, 0);
419   pia_0_ca1_w(machine, 0, 0);
420420
421421   /* set a timer to turn it off once the scanline counter resets */
422422   timer_set(video_screen_get_time_until_pos(0, 8, 0), NULL, 0, williams2_endscreen_off_callback);
r1877r1878
435435
436436static void williams2_postload(void)
437437{
438   williams2_bank_select_w(0, vram_bank);
438   williams2_bank_select_w(Machine, 0, vram_bank);
439439}
440440
441441
r1877r1878
449449   memory_configure_bank(1, 1, 4, memory_region(REGION_CPU1) + 0x10000, 0x10000);
450450
451451   /* make sure our banking is reset */
452   williams2_bank_select_w(0, 0);
452   williams2_bank_select_w(machine, 0, 0);
453453
454454   /* set a timer to go off every 16 scanlines, to toggle the VA11 line and update the screen */
455455   scanline_timer = timer_alloc(williams2_va11_callback, NULL);
r1877r1878
526526
527527static TIMER_CALLBACK( williams_deferred_snd_cmd_w )
528528{
529   pia_2_portb_w(0, param);
530   pia_2_cb1_w(0, (param == 0xff) ? 0 : 1);
529   pia_2_portb_w(machine, 0, param);
530   pia_2_cb1_w(machine, 0, (param == 0xff) ? 0 : 1);
531531}
532532
533533WRITE8_HANDLER( williams_snd_cmd_w )
r1877r1878
544544
545545static TIMER_CALLBACK( williams2_deferred_snd_cmd_w )
546546{
547   pia_2_porta_w(0, param);
547   pia_2_porta_w(machine, 0, param);
548548}
549549
550550static WRITE8_HANDLER( williams2_snd_cmd_w )
r1877r1878
613613READ8_HANDLER( williams_input_port_49way_0_5_r )
614614{
615615   if (port_select)
616      return williams_49way_port_0_r(0);
616      return williams_49way_port_0_r(machine,0);
617617   else
618618      return readinputport(5);
619619}
r1877r1878
651651{
652652   /* yes, the data bits are checked for this specific value */
653653   if (data == 0x39)
654      watchdog_reset_w(0,0);
654      watchdog_reset_w(machine,0,0);
655655}
656656
657657
r1877r1878
659659{
660660   /* yes, the data bits are checked for this specific value */
661661   if ((data & 0x3f) == 0x14)
662      watchdog_reset_w(0,0);
662      watchdog_reset_w(machine,0,0);
663663}
664664
665665
r1877r1878
713713
714714static void defender_postload(void)
715715{
716   defender_bank_select_w(0, vram_bank);
716   defender_bank_select_w(Machine, 0, vram_bank);
717717}
718718
719719
r1877r1878
723723
724724   /* configure the banking and make sure it is reset to 0 */
725725   memory_configure_bank(1, 0, 9, &memory_region(REGION_CPU1)[0x10000], 0x1000);
726   defender_bank_select_w(0, 0);
726   defender_bank_select_w(machine, 0, 0);
727727
728728   state_save_register_func_postload(defender_postload);
729729}
r1877r1878
799799WRITE8_HANDLER( sinistar_vram_select_w )
800800{
801801   /* low two bits are standard */
802   williams_vram_select_w(offset, data);
802   williams_vram_select_w(machine, offset, data);
803803
804804   /* window enable from bit 2 (clips to 0x7400) */
805805   williams_blitter_window_enable = data & 0x04;
r1877r1878
866866static READ8_HANDLER( lottofun_input_port_0_r )
867867{
868868   /* merge in the ticket dispenser status */
869   return input_port_0_r(offset) | ticket_dispenser_r(offset);
869   return input_port_0_r(machine,offset) | ticket_dispenser_r(machine,offset);
870870}
871871
872872
r1877r1878
880880static READ8_HANDLER( tshoot_input_port_0_3_r )
881881{
882882   /* merge in the gun inputs with the standard data */
883   int data = williams_input_port_0_3_r(offset);
883   int data = williams_input_port_0_3_r(machine, offset);
884884   int gun = (data & 0x3f) ^ ((data & 0x3f) >> 1);
885885   return (data & 0xc0) | gun;
886886}
r1877r1878
943943
944944static TIMER_CALLBACK( joust2_deferred_snd_cmd_w )
945945{
946   pia_2_porta_w(0, param & 0xff);
946   pia_2_porta_w(machine, 0, param & 0xff);
947947}
948948
949949
950950static WRITE8_HANDLER( joust2_pia_3_cb1_w )
951951{
952952   joust2_current_sound_data = (joust2_current_sound_data & ~0x100) | ((data << 8) & 0x100);
953   pia_3_cb1_w(offset, data);
953   pia_3_cb1_w(machine, offset, data);
954954}
955955
956956
src/mame/machine/r2crypt.c
r1877r1878
7878static const UINT32 xmap_high_15[8] = { 0x1c6f2b4f, 0x9eebe281, 0x784b85d8, 0x401d6412, 0x0370ae0a, 0xa791d0b3, 0x89d290ea, 0x4666f009 };
7979static const UINT32 xmap_high_16[8] = { 0xbe2beb93, 0xac9284fb, 0xa629fdbf, 0x82fe33dc, 0x75f1a31b, 0xee1f4f24, 0xaecc7e1e, 0xcd9b419e };
8080
81#ifdef UNUSED_DEFINITION
8182static const UINT32 zmap_0[8] = { 0x08b01003, 0xed4037ec, 0x9a3a3044, 0x0daf5851, 0xa7725210, 0x0c1822ed, 0xbf726fe6, 0x6e783ea0 };
8283static const UINT32 zmap_1[8] = { 0xc6783a02, 0x1e8239df, 0xa53d108b, 0xcc5784a1, 0x9bbb0123, 0xcc2c11dd, 0xbfb9bfda, 0x5db43f53 };
84#endif
8385
8486static const UINT32 zmap_2[32] = {
8587  0x1b301017, 0x02310910, 0x04404644, 0x08042024, 0x050a3aa4, 0xb6087024, 0xa2204208, 0x1c9d9228,
src/mame/machine/nb1413m3.c
r1877r1878
339339WRITE8_HANDLER( nb1413m3_sndrombank1_w )
340340{
341341   // if (data & 0x02) coin counter ?
342   nb1413m3_outcoin_w(0, data);            // (data & 0x04) >> 2;
342   nb1413m3_outcoin_w(machine, 0, data);            // (data & 0x04) >> 2;
343343   nb1413m3_nmi_enable = ((data & 0x20) >> 5);
344344   nb1413m3_sndrombank1 = (((data & 0xc0) >> 5) | ((data & 0x10) >> 4));
345345}
r1877r1878
381381   switch (nb1413m3_type)
382382   {
383383      case NB1413M3_PASTELG:
384         return ((input_port_3_r(0) & 0xfe) | (nb1413m3_busyflag & 0x01));
384         return ((input_port_3_r(machine,0) & 0xfe) | (nb1413m3_busyflag & 0x01));
385385      case NB1413M3_TAIWANMB:
386         return ((input_port_3_r(0) & 0xfc) | ((nb1413m3_outcoin_flag & 0x01) << 1) | (nb1413m3_busyflag & 0x01));
386         return ((input_port_3_r(machine,0) & 0xfc) | ((nb1413m3_outcoin_flag & 0x01) << 1) | (nb1413m3_busyflag & 0x01));
387387      case NB1413M3_HYHOO:
388388      case NB1413M3_HYHOO2:
389         return ((input_port_2_r(0) & 0xfe) | (nb1413m3_busyflag & 0x01));
389         return ((input_port_2_r(machine,0) & 0xfe) | (nb1413m3_busyflag & 0x01));
390390      default:
391         return ((input_port_2_r(0) & 0xfc) | ((nb1413m3_outcoin_flag & 0x01) << 1) | (nb1413m3_busyflag & 0x01));
391         return ((input_port_2_r(machine,0) & 0xfc) | ((nb1413m3_outcoin_flag & 0x01) << 1) | (nb1413m3_busyflag & 0x01));
392392   }
393393}
394394
r1877r1878
537537      case NB1413M3_MAIKO:
538538      case NB1413M3_MMAIKO:
539539      case NB1413M3_HANAOJI:
540         return ((input_port_13_r(0) & 0xfd) | ((nb1413m3_outcoin_flag & 0x01) << 1));
540         return ((input_port_13_r(machine,0) & 0xfd) | ((nb1413m3_outcoin_flag & 0x01) << 1));
541541         break;
542542      default:
543543         return 0xff;
src/mame/machine/atarifb.c
r1877r1878
2020{
2121   CTRLD = data;
2222
23   discrete_sound_w(ATARIFB_WHISTLE_EN,  data & 0x01);      // Whistle
24   discrete_sound_w(ATARIFB_HIT_EN,  data & 0x02);         // Hit
25   discrete_sound_w(ATARIFB_ATTRACT_EN, data & 0x10);      // Attract
26   discrete_sound_w(ATARIFB_NOISE_EN,  data & 0x04);      // Noise Enable / Kicker
23   discrete_sound_w(machine, ATARIFB_WHISTLE_EN,  data & 0x01);      // Whistle
24   discrete_sound_w(machine, ATARIFB_HIT_EN,  data & 0x02);         // Hit
25   discrete_sound_w(machine, ATARIFB_ATTRACT_EN, data & 0x10);      // Attract
26   discrete_sound_w(machine, ATARIFB_NOISE_EN,  data & 0x04);      // Noise Enable / Kicker
2727}
2828
2929
r1877r1878
3131{
3232   CTRLD = data;
3333
34   discrete_sound_w(ATARIFB_WHISTLE_EN,  data & 0x01);      // Whistle
35   discrete_sound_w(ATARIFB_HIT_EN,  data & 0x02);         // Hit
36   discrete_sound_w(ATARIFB_ATTRACT_EN, data & 0x10);      // Attract
37   discrete_sound_w(ATARIFB_NOISE_EN,  data & 0x04);      // Noise Enable / Kicker
34   discrete_sound_w(machine, ATARIFB_WHISTLE_EN,  data & 0x01);      // Whistle
35   discrete_sound_w(machine, ATARIFB_HIT_EN,  data & 0x02);         // Hit
36   discrete_sound_w(machine, ATARIFB_ATTRACT_EN, data & 0x10);      // Attract
37   discrete_sound_w(machine, ATARIFB_NOISE_EN,  data & 0x04);      // Noise Enable / Kicker
3838
3939   coin_counter_w (1, data & 0x80);
4040}
r1877r1878
4444{
4545   CTRLD = data;
4646
47   discrete_sound_w(ATARIFB_WHISTLE_EN,  data & 0x01);      // Whistle
48   discrete_sound_w(ATARIFB_HIT_EN,  data & 0x02);         // Hit
49   discrete_sound_w(ATARIFB_ATTRACT_EN, data & 0x10);      // Attract
50   discrete_sound_w(ATARIFB_NOISE_EN,  data & 0x04);      // Noise Enable / Kicker
47   discrete_sound_w(machine, ATARIFB_WHISTLE_EN,  data & 0x01);      // Whistle
48   discrete_sound_w(machine, ATARIFB_HIT_EN,  data & 0x02);         // Hit
49   discrete_sound_w(machine, ATARIFB_ATTRACT_EN, data & 0x10);      // Attract
50   discrete_sound_w(machine, ATARIFB_NOISE_EN,  data & 0x04);      // Noise Enable / Kicker
5151
5252   if (data & 0x80)
5353   {
5454      /* Invert video */
55      palette_set_color(Machine,1,MAKE_RGB(0x00,0x00,0x00)); /* black  */
56      palette_set_color(Machine,0,MAKE_RGB(0xff,0xff,0xff)); /* white  */
55      palette_set_color(machine,1,MAKE_RGB(0x00,0x00,0x00)); /* black  */
56      palette_set_color(machine,0,MAKE_RGB(0xff,0xff,0xff)); /* white  */
5757   }
5858   else
5959   {
6060      /* Regular video */
61      palette_set_color(Machine,0,MAKE_RGB(0x00,0x00,0x00)); /* black  */
62      palette_set_color(Machine,1,MAKE_RGB(0xff,0xff,0xff)); /* white  */
61      palette_set_color(machine,0,MAKE_RGB(0x00,0x00,0x00)); /* black  */
62      palette_set_color(machine,1,MAKE_RGB(0xff,0xff,0xff)); /* white  */
6363   }
6464}
6565
r1877r1878
7676   /* bit 5-6 = trackball CTRL bits */
7777   /* bit 7 = Rule LED */
7878
79   discrete_sound_w(ATARIFB_WHISTLE_EN,  data & 0x01);      // Whistle
80   discrete_sound_w(ATARIFB_HIT_EN,  data & 0x02);         // Hit
81   discrete_sound_w(ATARIFB_ATTRACT_EN, data & 0x10);      // Attract
82   discrete_sound_w(ATARIFB_NOISE_EN,  data & 0x04);      // Noise Enable / Kicker
79   discrete_sound_w(machine, ATARIFB_WHISTLE_EN,  data & 0x01);      // Whistle
80   discrete_sound_w(machine, ATARIFB_HIT_EN,  data & 0x02);         // Hit
81   discrete_sound_w(machine, ATARIFB_ATTRACT_EN, data & 0x10);      // Attract
82   discrete_sound_w(machine, ATARIFB_NOISE_EN,  data & 0x04);      // Noise Enable / Kicker
8383
8484//  set_led_status(0,data & 0x10);  // !!!!!!!!!! Is this correct????
8585   set_led_status(1,data & 0x80);
r1877r1878
8888
8989WRITE8_HANDLER( atarifb_out2_w )
9090{
91   discrete_sound_w(ATARIFB_CROWD_DATA, data & 0x0f);   // Crowd
91   discrete_sound_w(machine, ATARIFB_CROWD_DATA, data & 0x0f);   // Crowd
9292
9393   coin_counter_w (0, data & 0x10);
9494}
r1877r1878
9696
9797WRITE8_HANDLER( soccer_out2_w )
9898{
99   discrete_sound_w(ATARIFB_CROWD_DATA, data & 0x0f);   // Crowd
99   discrete_sound_w(machine, ATARIFB_CROWD_DATA, data & 0x0f);   // Crowd
100100
101101   coin_counter_w (0, data & 0x10);
102102   coin_counter_w (1, data & 0x20);
r1877r1878
152152           (sign_x_2 >> 6) |
153153           (sign_y_1 >> 5) |
154154           (sign_x_1 >> 4) |
155           input_port_0_r(offset);
155           input_port_0_r(machine, offset);
156156      return val;
157157   }
158158   else
r1877r1878
184184{
185185   if ((CTRLD & 0x20)==0x00)
186186   {
187      return input_port_1_r(offset);
187      return input_port_1_r(machine, offset);
188188   }
189189   else
190190   {
r1877r1878
282282{
283283   if ((CTRLD & 0x40)==0x00)
284284   {
285      return input_port_2_r(offset);
285      return input_port_2_r(machine, offset);
286286   }
287287   else if ((CTRLD & 0x60) == 0x60)
288288   /* LD1 and LD2 both high, return Team 2 right player (player 3) */
src/mame/machine/simpsons.c
r1877r1878
102102
103103READ8_HANDLER( simpsons_sound_interrupt_r )
104104{
105   cpunum_set_input_line_and_vector(Machine, 1, 0, HOLD_LINE, 0xff );
105   cpunum_set_input_line_and_vector(machine, 1, 0, HOLD_LINE, 0xff );
106106   return 0x00;
107107}
108108
109109READ8_HANDLER( simpsons_sound_r )
110110{
111   return K053260_0_r(2 + offset);
111   return K053260_0_r(machine, 2 + offset);
112112}
113113
114114
src/mame/machine/subs.c
r1877r1878
2929INTERRUPT_GEN( subs_interrupt )
3030{
3131   /* only do NMI interrupt if not in TEST mode */
32   if ((input_port_2_r(0) & 0x40)==0x40)
32   if ((input_port_2_r(machine, 0) & 0x40)==0x40)
3333      cpunum_set_input_line(machine, 0,INPUT_LINE_NMI,PULSE_LINE);
3434}
3535
r1877r1878
4040If D6 is high, it moved left.  If D6 is low, it moved right.
4141Be sure to keep returning a direction until steer_reset is called.
4242***************************************************************************/
43static int subs_steering_1(void)
43static int subs_steering_1(running_machine *machine)
4444{
4545   static int last_val=0;
4646   int this_val;
4747   int delta;
4848
49   this_val=input_port_3_r(0);
49   this_val=input_port_3_r(machine, 0);
5050
5151   delta=this_val-last_val;
5252   last_val=this_val;
r1877r1878
6969   return subs_steering_val1;
7070}
7171
72static int subs_steering_2(void)
72static int subs_steering_2(running_machine *machine)
7373{
7474   static int last_val=0;
7575   int this_val;
7676   int delta;
7777
78   this_val=input_port_4_r(0);
78   this_val=input_port_4_r(machine,0);
7979
8080   delta=this_val-last_val;
8181   last_val=this_val;
r1877r1878
112112***************************************************************************/
113113READ8_HANDLER( subs_control_r )
114114{
115   int inport = input_port_1_r(offset);
115   int inport = input_port_1_r(machine, offset);
116116
117117   switch (offset & 0x07)
118118   {
r1877r1878
120120      case 0x01:      return ((inport & 0x02) << 6);   /* diag hold */
121121      case 0x02:      return ((inport & 0x04) << 5);   /* slam */
122122      case 0x03:      return ((inport & 0x08) << 4);   /* spare */
123      case 0x04:      return ((subs_steering_1() & 0x40) << 1);   /* steer dir 1 */
124      case 0x05:      return ((subs_steering_1() & 0x80) << 0);   /* steer flag 1 */
125      case 0x06:      return ((subs_steering_2() & 0x40) << 1);   /* steer dir 2 */
126      case 0x07:      return ((subs_steering_2() & 0x80) << 0);   /* steer flag 2 */
123      case 0x04:      return ((subs_steering_1(machine) & 0x40) << 1);   /* steer dir 1 */
124      case 0x05:      return ((subs_steering_1(machine) & 0x80) << 0);   /* steer flag 1 */
125      case 0x06:      return ((subs_steering_2(machine) & 0x40) << 1);   /* steer dir 2 */
126      case 0x07:      return ((subs_steering_2(machine) & 0x80) << 0);   /* steer flag 2 */
127127   }
128128
129129   return 0;
r1877r1878
134134***************************************************************************/
135135READ8_HANDLER( subs_coin_r )
136136{
137   int inport = input_port_2_r(offset);
137   int inport = input_port_2_r(machine, offset);
138138
139139   switch (offset & 0x07)
140140   {
r1877r1878
156156***************************************************************************/
157157READ8_HANDLER( subs_options_r )
158158{
159   int opts = input_port_0_r(offset);
159   int opts = input_port_0_r(machine, offset);
160160
161161   switch (offset & 0x03)
162162   {
src/mame/machine/ajax.c
r1877r1878
140140   switch ((offset & 0x01c0) >> 6){
141141      case 0x00:   /* NSFIRQ + AFR */
142142         if (offset)
143            watchdog_reset_w(0, data);
143            watchdog_reset_w(machine, 0, data);
144144         else{
145145            if (firq_enable)   /* Cause interrupt on slave CPU */
146               cpunum_set_input_line(Machine, 1, M6809_FIRQ_LINE, HOLD_LINE);
146               cpunum_set_input_line(machine, 1, M6809_FIRQ_LINE, HOLD_LINE);
147147         }
148148         break;
149149      case 0x01:   /* Cause interrupt on audio CPU */
150         cpunum_set_input_line(Machine, 2, 0, HOLD_LINE);
150         cpunum_set_input_line(machine, 2, 0, HOLD_LINE);
151151         break;
152152      case 0x02:   /* Sound command number */
153         soundlatch_w(offset,data);
153         soundlatch_w(machine,offset,data);
154154         break;
155155      case 0x03:   /* Bankswitch + coin counters + priority*/
156         ajax_bankswitch_w(0, data);
156         ajax_bankswitch_w(machine, 0, data);
157157         break;
158158      case 0x05:   /* Lamps + Joystick vibration + Control panel quaking */
159         ajax_lamps_w(0, data);
159         ajax_lamps_w(machine, 0, data);
160160         break;
161161
162162      default:
src/mame/machine/bagman.c
r1877r1878
218218
219219MACHINE_RESET( bagman )
220220{
221   bagman_pal16r6_w(0,1);   /*pin 2*/
222   bagman_pal16r6_w(1,1);   /*pin 3*/
223   bagman_pal16r6_w(2,1);   /*pin 4*/
224   bagman_pal16r6_w(3,1);   /*pin 5*/
225   bagman_pal16r6_w(4,1);   /*pin 6*/
226   bagman_pal16r6_w(5,1);   /*pin 7*/
227   bagman_pal16r6_w(6,1);   /*pin 8*/
228   bagman_pal16r6_w(7,1);   /*pin 9*/
221   bagman_pal16r6_w(machine,0,1);   /*pin 2*/
222   bagman_pal16r6_w(machine,1,1);   /*pin 3*/
223   bagman_pal16r6_w(machine,2,1);   /*pin 4*/
224   bagman_pal16r6_w(machine,3,1);   /*pin 5*/
225   bagman_pal16r6_w(machine,4,1);   /*pin 6*/
226   bagman_pal16r6_w(machine,5,1);   /*pin 7*/
227   bagman_pal16r6_w(machine,6,1);   /*pin 8*/
228   bagman_pal16r6_w(machine,7,1);   /*pin 9*/
229229   update_pal();
230230}
231231
src/mame/machine/nitedrvr.c
r1877r1878
212212***************************************************************************/
213213WRITE8_HANDLER( nitedrvr_out0_w )
214214{
215   discrete_sound_w(NITEDRVR_MOTOR_DATA, data & 0x0f);   // Motor freq data
216   discrete_sound_w(NITEDRVR_SKID1_EN, data & 0x10);   // Skid1 enable
217   discrete_sound_w(NITEDRVR_SKID2_EN, data & 0x20);   // Skid2 enable
215   discrete_sound_w(machine, NITEDRVR_MOTOR_DATA, data & 0x0f);   // Motor freq data
216   discrete_sound_w(machine, NITEDRVR_SKID1_EN, data & 0x10);   // Skid1 enable
217   discrete_sound_w(machine, NITEDRVR_SKID2_EN, data & 0x20);   // Skid2 enable
218218}
219219
220220/***************************************************************************
r1877r1878
232232   set_led_status(0,data & 0x10);
233233
234234   nitedrvr_crash_en = data & 0x01;
235   discrete_sound_w(NITEDRVR_CRASH_EN, nitedrvr_crash_en);   // Crash enable
236   discrete_sound_w(NITEDRVR_ATTRACT_EN, data & 0x02);      // Attract enable (sound disable)
235   discrete_sound_w(machine, NITEDRVR_CRASH_EN, nitedrvr_crash_en);   // Crash enable
236   discrete_sound_w(machine, NITEDRVR_ATTRACT_EN, data & 0x02);      // Attract enable (sound disable)
237237
238238   if (!nitedrvr_crash_en)
239239   {
r1877r1878
241241      nitedrvr_crash_data_en = 1;
242242      nitedrvr_crash_data = 0x0f;
243243      /* Invert video */
244      palette_set_color(Machine,1,MAKE_RGB(0x00,0x00,0x00)); /* BLACK */
245      palette_set_color(Machine,0,MAKE_RGB(0xff,0xff,0xff)); /* WHITE */
244      palette_set_color(machine,1,MAKE_RGB(0x00,0x00,0x00)); /* BLACK */
245      palette_set_color(machine,0,MAKE_RGB(0xff,0xff,0xff)); /* WHITE */
246246   }
247   discrete_sound_w(NITEDRVR_BANG_DATA, nitedrvr_crash_data_en ? nitedrvr_crash_data : 0);   // Crash Volume
247   discrete_sound_w(machine, NITEDRVR_BANG_DATA, nitedrvr_crash_data_en ? nitedrvr_crash_data : 0);   // Crash Volume
248248}
249249
250250
r1877r1878
253253   if (nitedrvr_crash_en && nitedrvr_crash_data_en)
254254   {
255255      nitedrvr_crash_data--;
256      discrete_sound_w(NITEDRVR_BANG_DATA, nitedrvr_crash_data);   // Crash Volume
256      discrete_sound_w(machine, NITEDRVR_BANG_DATA, nitedrvr_crash_data);   // Crash Volume
257257      if (!nitedrvr_crash_data) nitedrvr_crash_data_en = 0;   // Done counting?
258258      if (nitedrvr_crash_data & 0x01)
259259      {
src/mame/mamedriv.c
r1877r1878
938938   DRIVER( dkongjrj )   /* (c) 1982 Nintendo */
939939   DRIVER( dkngjnrj )   /* (c) 1982 Nintendo */
940940   DRIVER( dkongjrb )   /* bootleg */
941   DRIVER( dkngjnrb )   /* (c) 1982 Nintendo of America */
941   DRIVER( dkongjre )   /* (c) 1982 Nintendo of America */
942942   DRIVER( dkong3 )   /* (c) 1983 Nintendo of America */
943943   DRIVER( dkong3j )   /* (c) 1983 Nintendo */
944944   DRIVER( dkong3b )   /* bootleg */
src/mame/includes/mw8080bw.h
r1877r1878
9393WRITE8_HANDLER( zzzap_audio_2_w );
9494
9595MACHINE_DRIVER_EXTERN( maze_audio );
96void maze_write_discrete(UINT8 maze_tone_timing_state);
96void maze_write_discrete(running_machine *machine, UINT8 maze_tone_timing_state);
9797
9898MACHINE_DRIVER_EXTERN( boothill_audio );
9999WRITE8_HANDLER( boothill_audio_w );
src/mame/includes/stactics.h
r1877r1878
2727   UINT8  y_scroll_d;
2828   UINT8  y_scroll_e;
2929   UINT8  y_scroll_f;
30   UINT8  vblank_count;
30   UINT8  frame_count;
3131   UINT8  shot_standby;
3232   UINT8  shot_arrive;
3333   UINT16 beam_state;
r1877r1878
4545WRITE8_HANDLER( stactics_speed_latch_w );
4646WRITE8_HANDLER( stactics_shot_trigger_w );
4747WRITE8_HANDLER( stactics_shot_flag_clear_w );
48CUSTOM_INPUT( stactics_get_vblank_count_d3 );
48CUSTOM_INPUT( stactics_get_frame_count_d3 );
4949CUSTOM_INPUT( stactics_get_shot_standby );
5050CUSTOM_INPUT( stactics_get_not_shot_arrive );
5151
src/mame/includes/lethalj.h
r1877r1878
1212
1313WRITE16_HANDLER( lethalj_blitter_w );
1414
15void lethalj_scanline_update(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params);
15void lethalj_scanline_update(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params);
src/mame/includes/cvs.h
r1877r1878
4040
4141/*----------- defined in video/cvs.c -----------*/
4242
43extern mame_bitmap *cvs_collision_background;
43extern bitmap_t *cvs_collision_background;
4444extern int cvs_collision_register;
4545
4646PALETTE_INIT( cvs );
src/mame/includes/snk.h
r1877r1878
3636extern VIDEO_UPDATE( gwar );
3737extern VIDEO_UPDATE( sgladiat );
3838
39void tnk3_draw_text( running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int bank, UINT8 *source );
40void tnk3_draw_status( running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int bank, UINT8 *source );
39void tnk3_draw_text( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int bank, UINT8 *source );
40void tnk3_draw_status( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int bank, UINT8 *source );
4141
4242// note: compare tdfever which does blinking in software with tdfeverj which does it in hardware
4343extern int snk_blink_parity;
src/mame/includes/atari.h
r1877r1878
589589   FUNC(40); FUNC(41); FUNC(42); FUNC(43); \
590590   FUNC(44); FUNC(45); FUNC(46); FUNC(47);
591591
592typedef void (*renderer_function)(VIDEO *video);
592typedef void (*atari_renderer_func)(VIDEO *video);
593593
594594/*----------- defined in video/antic.c -----------*/
595595
src/mame/includes/mystston.h
r0r1878
1/***************************************************************************
2
3    Technos Mysterious Stones hardware
4
5    driver by Nicola Salmoria
6
7***************************************************************************/
8
9
10#define   MYSTSTON_MASTER_CLOCK   (XTAL_12MHz)
11
12
13typedef struct _mystston_state mystston_state;
14struct _mystston_state
15{
16   /* machine state */
17   UINT8 *ay8910_data;
18   UINT8 *ay8910_select;
19
20   /* video state */
21   tilemap *fg_tilemap;
22   tilemap *bg_tilemap;
23   emu_timer *interrupt_timer;
24   UINT8 *bg_videoram;
25   UINT8 *fg_videoram;
26   UINT8 *spriteram;
27   UINT8 *paletteram;
28   UINT8 *scroll;
29   UINT8 *video_control;
30};
31
32
33/*----------- defined in drivers/mystston.c -----------*/
34
35void mystston_on_scanline_interrupt(running_machine *machine);
36
37
38/*----------- defined in video/mystston.c -----------*/
39
40MACHINE_DRIVER_EXTERN( mystston_video );
41WRITE8_HANDLER( mystston_video_control_w );
src/mame/includes/midyunit.h
r1877r1878
6161READ16_HANDLER( midyunit_dma_r );
6262WRITE16_HANDLER( midyunit_dma_w );
6363
64void midyunit_scanline_update(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params);
64void midyunit_scanline_update(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params);
src/mame/includes/rampart.h
r1877r1878
1010VIDEO_START( rampart );
1111VIDEO_UPDATE( rampart );
1212
13void rampart_bitmap_render(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect);
13void rampart_bitmap_render(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
1414
1515extern UINT16 *rampart_bitmap;
src/mame/includes/artmagic.h
r1877r1878
1919READ16_HANDLER( artmagic_blitter_r );
2020WRITE16_HANDLER( artmagic_blitter_w );
2121
22void artmagic_scanline(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params);
22void artmagic_scanline(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params);
src/mame/includes/deco16ic.h
r1877r1878
2929void deco16_set_tilemap_colour_mask(int tmap, int mask);
3030void deco16_set_tilemap_transparency_mask(int tmap, int mask);
3131
32void deco16_tilemap_1_draw(mame_bitmap *bitmap, const rectangle *cliprect, int flags, UINT32 priority);
33void deco16_tilemap_2_draw(mame_bitmap *bitmap, const rectangle *cliprect, int flags, UINT32 priority);
34void deco16_tilemap_3_draw(mame_bitmap *bitmap, const rectangle *cliprect, int flags, UINT32 priority);
35void deco16_tilemap_4_draw(mame_bitmap *bitmap, const rectangle *cliprect, int flags, UINT32 priority);
32void deco16_tilemap_1_draw(bitmap_t *bitmap, const rectangle *cliprect, int flags, UINT32 priority);
33void deco16_tilemap_2_draw(bitmap_t *bitmap, const rectangle *cliprect, int flags, UINT32 priority);
34void deco16_tilemap_3_draw(bitmap_t *bitmap, const rectangle *cliprect, int flags, UINT32 priority);
35void deco16_tilemap_4_draw(bitmap_t *bitmap, const rectangle *cliprect, int flags, UINT32 priority);
3636
37void deco16_tilemap_34_combine_draw(mame_bitmap *bitmap, const rectangle *cliprect, int flags, UINT32 priority);
37void deco16_tilemap_34_combine_draw(bitmap_t *bitmap, const rectangle *cliprect, int flags, UINT32 priority);
3838
3939void deco16_clear_sprite_priority_bitmap(void);
40void deco16_pdrawgfx(mame_bitmap *dest,const gfx_element *gfx,
40void deco16_pdrawgfx(bitmap_t *dest,const gfx_element *gfx,
4141      UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
4242      const rectangle *clip,int transparency,int transparent_color,UINT32 pri_mask,UINT32 sprite_mask,UINT8 write_pri);
4343
r1877r1878
5656
5757READ16_HANDLER( deco16_71_r );
5858
59void deco16_print_debug_info(mame_bitmap *bitmap);
59void deco16_print_debug_info(bitmap_t *bitmap);
src/mame/includes/exterm.h
r1877r1878
1010extern UINT16 *exterm_slave_videoram;
1111
1212PALETTE_INIT( exterm );
13void exterm_scanline_update(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params);
13void exterm_scanline_update(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params);
1414
1515void exterm_to_shiftreg_master(UINT32 address, UINT16* shiftreg);
1616void exterm_from_shiftreg_master(UINT32 address, UINT16* shiftreg);
src/mame/includes/firetrk.h
r1877r1878
2929#define MONTECAR_BEEPER_EN         FIRETRUCK_XTNDPLY_EN
3030#define MONTECAR_ATTRACT_INV      FIRETRUCK_ATTRACT_EN
3131
32#define GAME_IS_FIRETRUCK   (firetrk_game == 1)
33#define GAME_IS_SUPERBUG    (firetrk_game == 2)
34#define GAME_IS_MONTECARLO  (firetrk_game == 3)
3532
36
37/*----------- defined in drivers/firetrk.c -----------*/
38
39extern int firetrk_game;
40
41extern UINT32 firetrk_color1_mask;
42extern UINT32 firetrk_color2_mask;
43
44
4533/*----------- defined in audio/firetrk.c -----------*/
4634
4735WRITE8_HANDLER( firetrk_skid_reset_w );
36WRITE8_HANDLER( montecar_skid_reset_w );
4837WRITE8_HANDLER( firetrk_crash_snd_w );
4938WRITE8_HANDLER( firetrk_skid_snd_w );
5039WRITE8_HANDLER( firetrk_motor_snd_w );
40WRITE8_HANDLER( superbug_motor_snd_w );
5141WRITE8_HANDLER( firetrk_xtndply_w );
52WRITE8_HANDLER( firetrk_asr_w );
53WRITE8_HANDLER( firetrk_out2_w );
42WRITE8_HANDLER( superbug_asr_w );
5443
5544DISCRETE_SOUND_EXTERN( firetrk );
5645DISCRETE_SOUND_EXTERN( superbug );
r1877r1878
5948
6049/*----------- defined in video/firetrk.c -----------*/
6150
62extern VIDEO_UPDATE( firetrk );
63extern VIDEO_START( firetrk );
64extern VIDEO_EOF( firetrk );
51PALETTE_INIT( firetrk );
52PALETTE_INIT( montecar );
53VIDEO_START( firetrk );
54VIDEO_START( superbug );
55VIDEO_START( montecar );
56VIDEO_UPDATE( firetrk );
57VIDEO_UPDATE( superbug );
58VIDEO_UPDATE( montecar );
6559
66extern WRITE8_HANDLER( firetrk_vert_w );
67extern WRITE8_HANDLER( firetrk_horz_w );
68extern WRITE8_HANDLER( firetrk_drone_hpos_w );
69extern WRITE8_HANDLER( firetrk_drone_vpos_w );
70extern WRITE8_HANDLER( firetrk_drone_rot_w );
71extern WRITE8_HANDLER( firetrk_playfield_w );
72extern WRITE8_HANDLER( firetrk_car_rot_w );
60extern UINT8 *firetrk_alpha_num_ram;
61extern UINT8 *firetrk_playfield_ram;
62extern UINT8 *firetrk_scroll_x;
63extern UINT8 *firetrk_scroll_y;
64extern UINT8 *firetrk_car_rot;
65extern UINT8 *firetrk_drone_rot;
66extern UINT8 *firetrk_drone_x;
67extern UINT8 *firetrk_drone_y;
68extern UINT8 *firetrk_blink;
69extern UINT8  firetrk_flash;
7370
74extern void firetrk_set_flash(int flag);
75extern void firetrk_set_blink(int flag);
76
77extern UINT8* firetrk_alpha_num_ram;
78extern UINT8* firetrk_playfield_ram;
79
80extern int firetrk_crash[2];
81extern int firetrk_skid[2];
71extern UINT8 firetrk_crash[2];
72extern UINT8 firetrk_skid[2];
src/mame/includes/segas24.h
r1877r1878
1111READ16_HANDLER( system24temp_sys16_shared_ram_r );
1212WRITE16_HANDLER( system24temp_sys16_shared_ram_w );
1313
14void system24temp_sys16_io_set_callbacks(UINT8 (*io_r)(int port),
15                     void  (*io_w)(int port, UINT8 data),
14void system24temp_sys16_io_set_callbacks(UINT8 (*io_r)(running_machine *machine, int port),
15                     void  (*io_w)(running_machine *machine, int port, UINT8 data),
1616                     void  (*cnt_w)(UINT8 data),
1717                     READ16_HANDLER ((*iod_r)),
1818                     WRITE16_HANDLER((*iod_w)));
src/mame/includes/namcoic.h
r1877r1878
9393void namco_tilemap_init(
9494      int gfxbank, void *pMaskROM,
9595      void (*cb)( UINT16 code, int *gfx, int *mask) );
96void namco_tilemap_draw( mame_bitmap *bitmap, const rectangle *cliprect, int pri );
96void namco_tilemap_draw( bitmap_t *bitmap, const rectangle *cliprect, int pri );
9797void namco_tilemap_invalidate( void );
9898WRITE16_HANDLER( namco_tilemapvideoram16_w );
9999READ16_HANDLER( namco_tilemapvideoram16_r );
r1877r1878
113113/***********************************************************************************/
114114
115115/* Namco System II Sprite Rendering */
116void namcos2_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri, int control );
116void namcos2_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri, int control );
117117
118void namcos2_draw_sprites_metalhawk(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri );
118void namcos2_draw_sprites_metalhawk(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri );
119119
120120/***********************************************************************************/
121121/* C355 Motion Object Emulation */
122122
123123/* for palXOR, supply either 0x0 (normal) or 0xf (palette mapping reversed) */
124124void namco_obj_init( int gfxbank, int palXOR, int (*code2tile)( int code ) );
125void namco_obj_draw(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri );
125void namco_obj_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri );
126126
127127WRITE16_HANDLER( namco_obj16_w );
128128READ16_HANDLER( namco_obj16_r );
r1877r1878
142142/* C169 ROZ Layer Emulation */
143143
144144void namco_roz_init( int gfxbank, int maskregion );
145void namco_roz_draw( mame_bitmap *bitmap, const rectangle *cliprect, int pri );
145void namco_roz_draw( bitmap_t *bitmap, const rectangle *cliprect, int pri );
146146
147147READ16_HANDLER( namco_rozcontrol16_r );
148148WRITE16_HANDLER( namco_rozcontrol16_w );
r1877r1878
167167
168168void namco_road_init(running_machine *machine, int gfxbank );
169169void namco_road_set_transparent_color(pen_t pen);
170void namco_road_draw(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri );
170void namco_road_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri );
171171
172172READ16_HANDLER( namco_road16_r );
173173WRITE16_HANDLER( namco_road16_w );
src/mame/includes/jpmimpct.h
r1877r1878
1313
1414void jpmimpct_to_shiftreg(UINT32 address, UINT16 *shiftreg);
1515void jpmimpct_from_shiftreg(UINT32 address, UINT16 *shiftreg);
16void jpmimpct_scanline_update(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params);
16void jpmimpct_scanline_update(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params);
1717
1818VIDEO_START( jpmimpct );
src/mame/includes/thunderj.h
r1877r1878
1111VIDEO_START( thunderj );
1212VIDEO_UPDATE( thunderj );
1313
14void thunderj_mark_high_palette(mame_bitmap *bitmap, UINT16 *pf, UINT16 *mo, int x, int y);
14void thunderj_mark_high_palette(bitmap_t *bitmap, UINT16 *pf, UINT16 *mo, int x, int y);
src/mame/includes/dc.h
r1877r1878
3434
3535int compute_interrupt_level(void);
3636void update_interrupt_status(void);
37INPUT_CHANGED( dc_coin_slots_callback );
3738
38extern UINT32 sysctrl_regs[0x200/4];
39extern UINT32 dc_sysctrl_regs[0x200/4];
40extern UINT32 dc_coin_counts[2];
3941
4042                      /*address*/
4143#define SB_C2DSTAT   ((0x005F6800-0x005F6800)/4)
r1877r1878
124126#define TA_NEXT_OPB      ((0x005F8134-0x005F8000)/4)
125127#define TA_ITP_CURRENT   ((0x005F8138-0x005F8000)/4)
126128
129#define IST_EOR_VIDEO   0x00000001
130#define IST_EOR_ISP   0x00000002
131#define IST_EOR_TSP   0x00000004
132#define IST_VBL_IN   0x00000008
133#define IST_VBL_OUT   0x00000010
134#define IST_HBL_IN   0x00000020
135#define IST_EOXFER_YUV   0x00000040
136#define IST_EOXFER_OPLST 0x00000080
137#define IST_EOXFER_OPMV 0x00000100
138#define IST_EOXFER_TRLST 0x00000200
139#define IST_EOXFER_TRMV 0x00000400
140#define IST_DMA_PVR   0x00000800
141#define IST_DMA_MAPLE   0x00001000
142#define IST_DMA_MAPLEVB 0x00002000
143#define IST_DMA_GDROM   0x00004000
144#define IST_DMA_AICA   0x00008000
145#define IST_DMA_EXT1   0x00010000
146#define IST_DMA_EXT2   0x00020000
147#define IST_DMA_DEV   0x00040000
148#define IST_DMA_CH2   0x00080000
149#define IST_DMA_SORT   0x00100000
150#define IST_G1G2EXTSTAT 0x40000000
151#define IST_ERROR   0x80000000
152
127153#endif
src/mame/includes/midtunit.h
r1877r1878
6060READ16_HANDLER( midtunit_dma_r );
6161WRITE16_HANDLER( midtunit_dma_w );
6262
63void midtunit_scanline_update(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params);
64void midxunit_scanline_update(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params);
63void midtunit_scanline_update(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params);
64void midxunit_scanline_update(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params);
src/mame/includes/amiga.h
r1877r1878
377377void amiga_machine_config(const amiga_machine_interface *intf);
378378
379379MACHINE_RESET( amiga );
380INTERRUPT_GEN( amiga_scanline_callback );
381380
382381CUSTOM_INPUT( amiga_joystick_convert );
383382
r1877r1878
408407
409408PALETTE_INIT( amiga );
410409VIDEO_START( amiga );
410VIDEO_UPDATE( amiga );
411411
412412UINT32 amiga_gethvpos(void);
413413void copper_setpc(UINT32 pc);
414414void amiga_set_genlock_color(UINT16 color);
415void amiga_render_scanline(int scanline);
415void amiga_render_scanline(running_machine *machine, bitmap_t *bitmap, int scanline);
416416void amiga_sprite_dma_reset(int which);
417417void amiga_sprite_enable_comparitor(int which, int enable);
418418
src/mame/includes/cinemat.h
r1877r1878
4242VIDEO_START( cinemat_64level );
4343VIDEO_START( cinemat_color );
4444VIDEO_START( cinemat_qb3color );
45VIDEO_EOF( cinemat );
45VIDEO_UPDATE( cinemat );
4646
4747VIDEO_UPDATE( spacewar );
src/mame/includes/grchamp.h
r1877r1878
2929   UINT8 *      rightram;
3030   UINT8 *      spriteram;
3131
32   mame_bitmap *work_bitmap;
32   bitmap_t *   work_bitmap;
3333   tilemap *   text_tilemap;
3434   tilemap *   left_tilemap;
3535   tilemap *   center_tilemap;
src/mame/includes/crbaloon.h
r1877r1878
1010
1111/*----------- defined in audio/crbaloon.c -----------*/
1212
13void crbaloon_audio_set_music_freq(UINT8 freq);
14void crbaloon_audio_set_music_enable(int enabled);
13void crbaloon_audio_set_music_freq(running_machine *machine, UINT8 freq);
14void crbaloon_audio_set_music_enable(running_machine *machine, int enabled);
1515void crbaloon_audio_set_explosion_enable(int enabled);
1616void crbaloon_audio_set_breath_enable(int enabled);
1717void crbaloon_audio_set_appear_enable(int enabled);
18void crbaloon_audio_set_laugh_enable(int enabled);
18void crbaloon_audio_set_laugh_enable(running_machine *machine, int enabled);
1919
2020MACHINE_DRIVER_EXTERN( crbaloon_audio );
2121
src/mame/includes/exidy440.h
r1877r1878
88
99
1010#define EXIDY440_MASTER_CLOCK      (XTAL_12_9792MHz)
11#define EXIDY440_MAIN_CPU_CLOCK      (EXIDY440_MASTER_CLOCK / 8)
12#define EXIDY440_PIXEL_CLOCK      (EXIDY440_MASTER_CLOCK / 2)
13#define EXIDY440_HTOTAL            (0x1a0)
14#define EXIDY440_HBEND            (0x000)
15#define EXIDY440_HBSTART         (0x140)
16#define EXIDY440_HSEND            (0x178)
17#define EXIDY440_HSSTART         (0x160)
18#define EXIDY440_VTOTAL            (0x104)
19#define EXIDY440_VBEND            (0x000)
20#define EXIDY440_VBSTART         (0x0f0)
21#define EXIDY440_VSEND            (0x0f8)
22#define EXIDY440_VSSTART         (0x0f0)
2311
24/* Top Secret has a larger VBLANK area */
25#define TOPSECEX_VBSTART         (0x0ec)
2612
27
2813/*----------- defined in drivers/exidy440.c -----------*/
2914
30extern UINT8 exidy440_topsecret;
3115void exidy440_bank_select(UINT8 bank);
3216
3317
3418/*----------- defined in audio/exidy440.c -----------*/
3519
36extern UINT8 exidy440_sound_command;
37extern UINT8 exidy440_sound_command_ack;
20extern UINT8 *exidy440_sound_command;
21extern UINT8  exidy440_sound_command_ack;
3822
3923MACHINE_DRIVER_EXTERN( exidy440_audio );
4024
r1877r1878
4327
4428extern UINT8 *exidy440_imageram;
4529extern UINT8 *exidy440_scanline;
46extern UINT8 exidy440_firq_vblank;
47extern UINT8 exidy440_firq_beam;
48extern UINT8 topsecex_yscroll;
30extern UINT8  exidy440_firq_vblank;
31extern UINT8  exidy440_firq_beam;
32extern UINT8 *topsecex_yscroll;
4933
5034INTERRUPT_GEN( exidy440_vblank_interrupt );
5135
52VIDEO_START( exidy440 );
53VIDEO_EOF( exidy440 );
54VIDEO_UPDATE( exidy440 );
55
5636READ8_HANDLER( exidy440_videoram_r );
5737WRITE8_HANDLER( exidy440_videoram_w );
5838READ8_HANDLER( exidy440_paletteram_r );
r1877r1878
6242READ8_HANDLER( exidy440_vertical_pos_r );
6343READ8_HANDLER( exidy440_horizontal_pos_r );
6444WRITE8_HANDLER( exidy440_interrupt_clear_w );
45
46MACHINE_DRIVER_EXTERN( exidy440_video );
47MACHINE_DRIVER_EXTERN( topsecex_video );
src/mame/includes/btoads.h
r1877r1878
3737void btoads_to_shiftreg(UINT32 address, UINT16 *shiftreg);
3838void btoads_from_shiftreg(UINT32 address, UINT16 *shiftreg);
3939
40void btoads_scanline_update(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params);
40void btoads_scanline_update(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params);
src/mame/includes/dkong.h
r1877r1878
6767   /* video state */
6868   tilemap *bg_tilemap;
6969
70   mame_bitmap *   bg_bits;
70   bitmap_t *      bg_bits;
7171   const UINT8 *   color_codes;
7272   emu_timer *      scanline_timer;
7373   INT8          vidhw;         /* Selected video hardware RS Conversion / TKG04 */
src/mame/includes/harddriv.h
r1877r1878
241241READ16_HANDLER( hdgsp_paletteram_hi_r );
242242WRITE16_HANDLER( hdgsp_paletteram_hi_w );
243243
244void harddriv_scanline_driver(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params);
245void harddriv_scanline_multisync(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params);
244void harddriv_scanline_driver(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params);
245void harddriv_scanline_multisync(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params);
src/mame/includes/madalien.h
r1877r1878
2121extern UINT8 *madalien_edge2_pos;
2222extern UINT8 *madalien_headlight_pos;
2323
24WRITE8_HANDLER( madalien_mc6845_address_w );
25READ8_HANDLER( madalien_mc6845_register_r );
26WRITE8_HANDLER( madalien_mc6845_register_w );
27
2824MACHINE_DRIVER_EXTERN( madalien_video );
src/mame/includes/kaneko16.h
r1877r1878
6464READ16_HANDLER ( kaneko16_sprites_regs_r );
6565WRITE16_HANDLER( kaneko16_sprites_regs_w );
6666
67void kaneko16_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect);
67void kaneko16_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
6868
6969/* Pixel Layer: */
7070
src/mame/mame.mak
r1877r1878
926926
927927$(MAMEOBJ)/midw8080.a: \
928928   $(DRIVERS)/8080bw.o $(AUDIO)/8080bw.o $(VIDEO)/8080bw.o \
929   $(DRIVERS)/m79amb.o $(VIDEO)/m79amb.o \
929   $(DRIVERS)/m79amb.o \
930930   $(DRIVERS)/mw8080bw.o $(MACHINE)/mw8080bw.o $(AUDIO)/mw8080bw.o $(VIDEO)/mw8080bw.o \
931931   $(DRIVERS)/rotaryf.o \
932932   $(DRIVERS)/sspeedr.o $(VIDEO)/sspeedr.o \
src/mame/video/targeth.c
r1877r1878
106106      3  | xx------ -------- | not used?
107107*/
108108
109static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
109static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
110110{
111111   int i;
112112   const gfx_element *gfx = machine->gfx[0];
src/mame/video/nycaptor.c
r1877r1878
101101      return;
102102
103103   if (offset & 0x100)
104      paletteram_xxxxBBBBGGGGRRRR_split2_w((offset & 0xff) + (palette_bank << 8),data);
104      paletteram_xxxxBBBBGGGGRRRR_split2_w(machine, (offset & 0xff) + (palette_bank << 8),data);
105105   else
106      paletteram_xxxxBBBBGGGGRRRR_split1_w((offset & 0xff) + (palette_bank << 8),data);
106      paletteram_xxxxBBBBGGGGRRRR_split1_w(machine, (offset & 0xff) + (palette_bank << 8),data);
107107}
108108
109109READ8_HANDLER( nycaptor_palette_r )
r1877r1878
145145   tilemap_set_scrolly(bg_tilemap, offset, data );
146146}
147147
148static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect,int pri)
148static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect,int pri)
149149{
150150   int i;
151151   for (i=0;i<0x20;i++)
src/mame/video/mitchell.c
r1877r1878
119119
120120WRITE8_HANDLER( pang_videoram_w )
121121{
122   if (video_bank) mgakuen_objram_w(offset,data);
123   else mgakuen_videoram_w(offset,data);
122   if (video_bank) mgakuen_objram_w(machine,offset,data);
123   else mgakuen_videoram_w(machine,offset,data);
124124}
125125
126126READ8_HANDLER( pang_videoram_r )
127127{
128   if (video_bank) return mgakuen_objram_r(offset);
129   else return mgakuen_videoram_r(offset);
128   if (video_bank) return mgakuen_objram_r(machine,offset);
129   else return mgakuen_videoram_r(machine,offset);
130130}
131131
132132/***************************************************************************
r1877r1878
223223
224224WRITE8_HANDLER( pang_paletteram_w )
225225{
226   if (paletteram_bank) paletteram_xxxxRRRRGGGGBBBB_le_w(offset + 0x800,data);
227   else paletteram_xxxxRRRRGGGGBBBB_le_w(offset,data);
226   if (paletteram_bank) paletteram_xxxxRRRRGGGGBBBB_le_w(machine,offset + 0x800,data);
227   else paletteram_xxxxRRRRGGGGBBBB_le_w(machine,offset,data);
228228}
229229
230230READ8_HANDLER( pang_paletteram_r )
r1877r1878
235235
236236WRITE8_HANDLER( mgakuen_paletteram_w )
237237{
238   paletteram_xxxxRRRRGGGGBBBB_le_w(offset,data);
238   paletteram_xxxxRRRRGGGGBBBB_le_w(machine,offset,data);
239239}
240240
241241READ8_HANDLER( mgakuen_paletteram_r )
r1877r1878
251251
252252***************************************************************************/
253253
254static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
254static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
255255{
256256   int offs,sx,sy;
257257
src/mame/video/galspnbl.c
r1877r1878
11#include "driver.h"
2#include "deprecat.h"
32
43
5UINT16 *galspnbl_bgvideoram,*galspnbl_videoram,*galspnbl_colorram;
6static int screenscroll;
4UINT16 *galspnbl_bgvideoram;
5UINT16 *galspnbl_videoram;
6UINT16 *galspnbl_colorram;
7UINT16 *galspnbl_scroll;
78
89
9
1010PALETTE_INIT( galspnbl )
1111{
1212   int i;
r1877r1878
1818
1919
2020
21WRITE16_HANDLER( galspnbl_bgvideoram_w )
22{
23   int sx,sy;
24
25
26   data = COMBINE_DATA(&galspnbl_bgvideoram[offset]);
27
28   sx = offset % 512;
29   sy = offset / 512;
30
31   *BITMAP_ADDR16(tmpbitmap, sy, sx) = 1024 + (data >> 1);
32}
33
34WRITE16_HANDLER( galspnbl_scroll_w )
35{
36   if (ACCESSING_LSB)
37      screenscroll = 4-(data & 0xff);
38}
39
40
41
4221/* sprite format (see also Ninja Gaiden):
4322 *
4423 *  word        bit                 usage
r1877r1878
5534 *    4    | xxxxxxxxxxxxxxxx | x position
5635 *    5,6,7|                  | unused
5736 */
58static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
37static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority)
5938{
6039   int offs;
6140   static const UINT8 layout[8][8] =
r1877r1878
7655      int col,row;
7756
7857      attr = spriteram16[offs];
79      if ((attr & 0x0004) && ((attr & 0x0040) == 0 || (cpu_getcurrentframe() & 1))
58      if ((attr & 0x0004) && ((attr & 0x0040) == 0 || (video_screen_get_frame_number(0) & 1))
8059//              && ((attr & 0x0030) >> 4) == priority)
8160            && ((attr & 0x0020) >> 5) == priority)
8261      {
r1877r1878
8463         color = spriteram16[offs+2];
8564         size = 1 << (color & 0x0003); // 1,2,4,8
8665         color = (color & 0x00f0) >> 4;
87         sx = spriteram16[offs+4] + screenscroll;
66//          sx = spriteram16[offs+4] + screenscroll;
67         sx = spriteram16[offs+4];
8868         sy = spriteram16[offs+3];
8969         flipx = attr & 0x0001;
9070         flipy = attr & 0x0002;
r1877r1878
10888}
10989
11090
91static void draw_background(bitmap_t *bitmap, const rectangle *cliprect)
92{
93   offs_t offs;
94
95//  int screenscroll = 4 - (galspnbl_scroll[0] & 0xff);
96
97   for (offs = 0; offs < 0x20000; offs++)
98   {
99      int y = offs >> 9;
100      int x = offs & 0x1ff;
101
102      *BITMAP_ADDR16(bitmap, y, x) = 1024 + (galspnbl_bgvideoram[offs] >> 1);
103   }
104}
105
106
111107VIDEO_UPDATE( galspnbl )
112108{
113109   int offs;
114110
111   draw_background(bitmap, cliprect);
115112
116   /* copy the temporary bitmap to the screen */
117   copyscrollbitmap(bitmap,tmpbitmap,1,&screenscroll,0,0,cliprect);
118
119113   draw_sprites(machine,bitmap,cliprect,0);
120114
121115   for (offs = 0;offs < 0x1000/2;offs++)
r1877r1878
135129               code,
136130               color,
137131               0,0,
138               16*sx + screenscroll,8*sy,
132//                  16*sx + screenscroll,8*sy,
133               16*sx,8*sy,
139134               cliprect,TRANSPARENCY_PEN,0);
140135      }
141136   }
src/mame/video/xevious.c
r1877r1878
424424
425425***************************************************************************/
426426
427static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
427static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
428428{
429429   int offs,sx,sy;
430430
src/mame/video/blktiger.c
r1877r1878
195195
196196***************************************************************************/
197197
198static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
198static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
199199{
200200   int offs;
201201
r1877r1878
245245
246246VIDEO_EOF( blktiger )
247247{
248   buffer_spriteram_w(0,0);
248   buffer_spriteram_w(machine,0,0);
249249}
src/mame/video/dynduke.c
r1877r1878
132132   }
133133}
134134
135static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int pri)
135static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int pri)
136136{
137137   int offs,fx,fy,x,y,color,sprite;
138138
r1877r1878
169169   }
170170}
171171
172static void draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri )
172static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri )
173173{
174174   /* The transparency / palette handling on the background layer is very strange */
175   mame_bitmap *bm = tilemap_get_pixmap(bg_layer);
175   bitmap_t *bm = tilemap_get_pixmap(bg_layer);
176176   int scrolly, scrollx;
177177   int x,y;
178178
r1877r1878
245245
246246VIDEO_EOF( dynduke )
247247{
248   buffer_spriteram16_w(0,0,0); // Could be a memory location instead
248   buffer_spriteram16_w(machine,0,0,0); // Could be a memory location instead
249249}
src/mame/video/deco_mlc.c
r1877r1878
1313
1414extern int mlc_raster_table[9][256];
1515extern UINT32 mlc_clipper[32];
16static mame_bitmap *temp_bitmap;
16static bitmap_t *temp_bitmap;
1717static UINT32 colour_mask, *mlc_buffered_spriteram;
1818UINT32 *mlc_vram, *mlc_clip_ram;
1919
r1877r1878
3535}
3636
3737#ifdef UNUSED_FUNCTION
38static void blitRaster(mame_bitmap *bitmap, int rasterMode)
38static void blitRaster(bitmap_t *bitmap, int rasterMode)
3939{
4040   int x,y;
4141   for (y=0; y<256; y++) //todo
r1877r1878
6363}
6464#endif
6565
66static void mlc_drawgfxzoom(mame_bitmap *dest_bmp,const gfx_element *gfx,
66static void mlc_drawgfxzoom(bitmap_t *dest_bmp,const gfx_element *gfx,
6767      UINT32 code1,UINT32 code2, UINT32 color,int flipx,int flipy,int sx,int sy,
6868      const rectangle *clip,int transparency,int transparent_color,int use8bpp,
6969      int scalex, int scaley)
r1877r1878
226226   }
227227}
228228
229static void draw_sprites(running_machine* machine, mame_bitmap *bitmap,const rectangle *cliprect)
229static void draw_sprites(running_machine* machine, bitmap_t *bitmap,const rectangle *cliprect)
230230{
231231   UINT32 *index_ptr=0;
232232   int offs,fx=0,fy=0,x,y,color,colorOffset,sprite,indx,h,w,bx,by,fx1,fy1;
r1877r1878
252252   {
253253      if ((mlc_spriteram[offs+0]&0x8000)==0)
254254         continue;
255      if ((mlc_spriteram[offs+1]&0x2000) && (cpu_getcurrentframe() & 1))
255      if ((mlc_spriteram[offs+1]&0x2000) && (video_screen_get_frame_number(0) & 1))
256256         continue;
257257
258258      /*
src/mame/video/tunhunt.c
r1877r1878
196196   }
197197}
198198
199static void draw_motion_object(mame_bitmap *bitmap, const rectangle *cliprect)
199static void draw_motion_object(bitmap_t *bitmap, const rectangle *cliprect)
200200{
201201/*
202202 *      VSTRLO  0x1202
r1877r1878
265265   );
266266}
267267
268static void draw_box(mame_bitmap *bitmap, const rectangle *cliprect)
268static void draw_box(bitmap_t *bitmap, const rectangle *cliprect)
269269{
270270/*
271271    This is unnecessarily slow, but the box priorities aren't completely understood,
r1877r1878
318318
319319/* "shell" graphics are 16x16 pixel tiles used for player shots and targeting cursor */
320320static void draw_shell(running_machine *machine,
321      mame_bitmap *bitmap,
321      bitmap_t *bitmap,
322322      const rectangle *cliprect,
323323      int picture_code,
324324      int hposition,
src/mame/video/tryout.c
r1877r1878
183183   tilemap_set_transparent_pen(fg_tilemap,0);
184184}
185185
186static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
186static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
187187{
188188   int offs,fx,fy,x,y,color,sprite,inc;
189189
src/mame/video/madmotor.c
r1877r1878
77***************************************************************************/
88
99#include "driver.h"
10#include "deprecat.h"
1110
1211UINT16 *madmotor_pf1_rowscroll;
1312UINT16 *madmotor_pf1_data,*madmotor_pf2_data,*madmotor_pf3_data;
r1877r1878
191190
192191/******************************************************************************/
193192
194static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int pri_mask,int pri_val)
193static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int pri_mask,int pri_val)
195194{
196195   int offs;
197196
r1877r1878
244243         for (y = 0;y < h;y++)
245244         {
246245            if ((color & pri_mask) == pri_val &&
247                     (!flash || (cpu_getcurrentframe() & 1)))
246                     (!flash || (video_screen_get_frame_number(0) & 1)))
248247               drawgfx(bitmap,machine->gfx[3],
249248                     code - y * incy + h * x,
250249                     color,
src/mame/video/eprom.c
r1877r1878
188188VIDEO_UPDATE( eprom )
189189{
190190   struct atarimo_rect_list rectlist;
191   mame_bitmap *mobitmap;
191   bitmap_t *mobitmap;
192192   int x, y, r;
193193
194194   /* draw the playfield */
r1877r1878
334334VIDEO_UPDATE( guts )
335335{
336336   struct atarimo_rect_list rectlist;
337   mame_bitmap *mobitmap;
337   bitmap_t *mobitmap;
338338   int x, y, r;
339339
340340   /* draw the playfield */
src/mame/video/skyfox.c
r1877r1878
6767   switch (offset)
6868   {
6969      case 0:   skyfox_bg_ctrl = data;   break;
70      case 1:   soundlatch_w(0,data);   break;
70      case 1:   soundlatch_w(machine,0,data);   break;
7171      case 2:   break;
7272      case 3:   break;
7373      case 4:   break;
r1877r1878
164164
165165***************************************************************************/
166166
167static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
167static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
168168{
169169   int offs;
170170
r1877r1878
243243
244244***************************************************************************/
245245
246static void draw_background(mame_bitmap *bitmap, const rectangle *cliprect)
246static void draw_background(bitmap_t *bitmap, const rectangle *cliprect)
247247{
248248   UINT8 *RAM   =   memory_region(REGION_GFX2);
249249   int x,y,i;
src/mame/video/rocnrope.c
r1877r1878
118118   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
119119}
120120
121static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
121static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
122122{
123123   int offs;
124124
src/mame/video/aerofgt.c
r1877r1878
294294
295295***************************************************************************/
296296
297static void aerofgt_draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int priority)
297static void aerofgt_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int priority)
298298{
299299   int offs;
300300
r1877r1878
366366   }
367367}
368368
369static void turbofrc_draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int chip,int chip_disabled_pri)
369static void turbofrc_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int chip,int chip_disabled_pri)
370370{
371371   int attr_start,base,first;
372372
r1877r1878
441441   }
442442}
443443
444static void pspikesb_draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
444static void pspikesb_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
445445{
446446   int i;
447447
r1877r1878
476476   }
477477}
478478
479static void aerfboot_draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
479static void aerfboot_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
480480{
481481   int attr_start;//,base,first;
482482
r1877r1878
546546   }
547547}
548548
549static void wbbc97_draw_bitmap(mame_bitmap *bitmap)
549static void wbbc97_draw_bitmap(bitmap_t *bitmap)
550550{
551551   int x,y,count;
552552   int color;
src/mame/video/fgoal.c
r1877r1878
77#include "driver.h"
88#include "includes/fgoal.h"
99
10static mame_bitmap *fgbitmap;
11static mame_bitmap *bgbitmap;
10static bitmap_t *fgbitmap;
11static bitmap_t *bgbitmap;
1212
1313static UINT8 xpos;
1414static UINT8 ypos;
src/mame/video/docastle.c
r1877r1878
125125   video_start_common(machine, 0xff00);
126126}
127127
128static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
128static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
129129{
130130   int offs;
131131
src/mame/video/mystston.c
r1877r1878
11/***************************************************************************
22
3    video.c
3    Technos Mysterious Stones hardware
44
5    Functions to emulate the video hardware of the machine.
5    driver by Nicola Salmoria
66
77    There are only a few differences between the video hardware of Mysterious
88    Stones and Mat Mania. The tile bank select bit is different and the sprite
r1877r1878
1313***************************************************************************/
1414
1515#include "driver.h"
16#include "video/resnet.h"
17#include "mystston.h"
1618
1719
18UINT8 *mystston_videoram2;
1920
20static int mystston_fgcolor, mystston_bgpage;
21/*************************************
22 *
23 *  Video timing constants
24 *
25 *************************************/
2126
22static tilemap *fg_tilemap, *bg_tilemap;
27#define PIXEL_CLOCK      (MYSTSTON_MASTER_CLOCK / 2)
28#define HTOTAL         (0x140)
29#define HBEND         (0x000)
30#define HBSTART         (0x100)
31#define VTOTAL         (0x110)    /* counts from 0x08-0xff, then from 0xe8-0xff */
32#define VBEND         (0x008)
33#define VBSTART         (0x0f8)
34#define FIRST_INT_VPOS   (0x008)
35#define INT_HPOS      (0x100)
2336
24/***************************************************************************
2537
26  Convert the color PROMs into a more useable format.
2738
28  Mysterious Stones has both palette RAM and a PROM. The PROM is used for
29  text.
39/*************************************
40 *
41 *  Scanline interrupt system
42 *
43 *  There is an interrupt every 16
44 *  scanlines, starting with 8.
45 *
46 *************************************/
3047
31***************************************************************************/
32
33PALETTE_INIT( mystston )
48static TIMER_CALLBACK( interrupt_callback )
3449{
35   int i;
50   mystston_state *state = machine->driver_data;
51   int scanline = param;
3652
37   for (i = 0; i < 32; i++)
38   {
39      int bit0, bit1, bit2, r, g, b;
53   mystston_on_scanline_interrupt(machine);
4054
41      // red component
55   scanline = scanline + 16;
56   if (scanline >= VTOTAL)
57      scanline = FIRST_INT_VPOS;
4258
43      bit0 = (*color_prom >> 0) & 0x01;
44      bit1 = (*color_prom >> 1) & 0x01;
45      bit2 = (*color_prom >> 2) & 0x01;
59   /* the vertical synch chain is clocked by H256 -- this is probably not important, but oh well */
60   timer_adjust_oneshot(state->interrupt_timer, video_screen_get_time_until_pos(0, scanline - 1, INT_HPOS), scanline);
61}
4662
47      r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
4863
49      // green component
5064
51      bit0 = (*color_prom >> 3) & 0x01;
52      bit1 = (*color_prom >> 4) & 0x01;
53      bit2 = (*color_prom >> 5) & 0x01;
65/*************************************
66 *
67 *  Palette handling
68 *
69 *************************************/
5470
55      g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
71static void set_palette(running_machine *machine, mystston_state *state)
72{
73   int i;
74   static const int resistances_rg[3] = { 4700, 3300, 1500 };
75   static const int resistances_b [2] = { 3300, 1500 };
76   double weights_rg[3], weights_b[2];
5677
57      // blue component
78   UINT8 *color_prom = memory_region(REGION_PROMS);
5879
59      bit0 = 0;
60      bit1 = (*color_prom >> 6) & 0x01;
61      bit2 = (*color_prom >> 7) & 0x01;
80   compute_resistor_weights(0,   255, -1.0,
81         3, resistances_rg, weights_rg, 0, 1000,
82         2, resistances_b,  weights_b,  0, 1000,
83         0, 0, 0, 0, 0);
6284
63      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
85   for (i = 0; i < 0x40; i++)
86   {
87      UINT8 data;
88      int r, g, b;
89      int bit0, bit1, bit2;
6490
65      palette_set_color(machine, i + 24, MAKE_RGB(r, g, b));   // first 24 colors are from RAM
91      /* first half is dynamic, second half is from the PROM */
92      if (i & 0x20)
93         data = color_prom[i & 0x1f];
94      else
95         data = state->paletteram[i];
6696
67      color_prom++;
97      /* red component */
98      bit0 = (data >> 0) & 0x01;
99      bit1 = (data >> 1) & 0x01;
100      bit2 = (data >> 2) & 0x01;
101      r = combine_3_weights(weights_rg, bit0, bit1, bit2);
102
103      /* green component */
104      bit0 = (data >> 3) & 0x01;
105      bit1 = (data >> 4) & 0x01;
106      bit2 = (data >> 5) & 0x01;
107      g = combine_3_weights(weights_rg, bit0, bit1, bit2);
108
109      /* blue component */
110      bit0 = (data >> 6) & 0x01;
111      bit1 = (data >> 7) & 0x01;
112      b = combine_2_weights(weights_b, bit0, bit1);
113
114      palette_set_color(machine, i, MAKE_RGB(r, g, b));
68115   }
69116}
70117
71WRITE8_HANDLER( mystston_videoram_w )
72{
73   videoram[offset] = data;
74   tilemap_mark_tile_dirty(fg_tilemap, offset & 0x3ff);
75}
76118
77WRITE8_HANDLER( mystston_videoram2_w )
78{
79   mystston_videoram2[offset] = data;
80   tilemap_mark_tile_dirty(bg_tilemap, offset & 0x1ff);
81}
82119
83WRITE8_HANDLER( mystston_scroll_w )
84{
85   tilemap_set_scrolly(bg_tilemap, 0, data);
86}
120/*************************************
121 *
122 *  Video control register
123 *
124 *************************************/
87125
88WRITE8_HANDLER( mystston_control_w )
126WRITE8_HANDLER( mystston_video_control_w )
89127{
90   // bits 0 and 1 are foreground text color
91   if (mystston_fgcolor != ((data & 0x01) << 1) + ((data & 0x02) >> 1))
92   {
93      mystston_fgcolor = ((data & 0x01) << 1) + ((data & 0x02) >> 1);
94      tilemap_mark_all_tiles_dirty(fg_tilemap);
95   }
128   mystston_state *state = machine->driver_data;
96129
97   // bit 2 is background page select
98   mystston_bgpage = (data & 0x04) ? 1:0;
130   *state->video_control = data;
99131
100   // bits 4 and 5 are coin counters in flipped order
132   /* D0-D1 - foreground text color */
133   /* D2 - background page select */
134   /* D3 - unused */
135
136   /* D4-D5 - coin counters in flipped order */
101137   coin_counter_w(0, data & 0x20);
102138   coin_counter_w(1, data & 0x10);
103139
104   // bit 7 is screen flip
105   flip_screen_set((data & 0x80) ^ ((readinputport(3) & 0x20) ? 0x80:0));
140   /* D6 - unused */
141   /* D7 - screen flip */
106142}
107143
144
145
146/*************************************
147 *
148 *  Tilemap callbacks
149 *
150 *************************************/
151
108152static TILE_GET_INFO( get_bg_tile_info )
109153{
110   int code = mystston_videoram2[tile_index] + ((mystston_videoram2[tile_index + 0x200] & 0x01) << 8);
154   mystston_state *state = machine->driver_data;
155
156   int page = (*state->video_control & 0x04) << 8;
157   int code = ((state->bg_videoram[page | 0x200 | tile_index] & 0x01) << 8) | state->bg_videoram[page | tile_index];
111158   int flags = (tile_index & 0x10) ? TILE_FLIPY : 0;
112159
113160   SET_TILE_INFO(1, code, 0, flags);
114161}
115162
163
116164static TILE_GET_INFO( get_fg_tile_info )
117165{
118   int code = videoram[tile_index] + ((videoram[tile_index + 0x400] & 0x07) << 8);
119   int color = mystston_fgcolor;
166   mystston_state *state = machine->driver_data;
120167
168   int code = ((state->fg_videoram[0x400 | tile_index] & 0x07) << 8) | state->fg_videoram[tile_index];
169   int color = ((*state->video_control & 0x01) << 1) | ((*state->video_control & 0x02) >> 1);
170
121171   SET_TILE_INFO(0, code, color, 0);
122172}
123173
124VIDEO_START( mystston )
125{
126   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_cols_flip_x,
127       16, 16, 16, 32);
128174
129   fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_cols_flip_x,
130       8, 8, 32, 32);
131175
132   tilemap_set_transparent_pen(fg_tilemap, 0);
133}
176/*************************************
177 *
178 *  Sprite drawing
179 *
180 *************************************/
134181
135static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
182static void draw_sprites(mystston_state *state, gfx_element **gfx, bitmap_t *bitmap, const rectangle *cliprect, int flip)
136183{
137184   int offs;
138185
139   for (offs = 0; offs < spriteram_size; offs += 4)
186   for (offs = 0; offs < 0x60; offs += 4)
140187   {
141      int attr = spriteram[offs];
188      int attr = state->spriteram[offs];
142189
143190      if (attr & 0x01)
144191      {
145         int code = spriteram[offs + 1] + ((attr & 0x10) << 4);
192         int code = ((attr & 0x10) << 4) | state->spriteram[offs + 1];
146193         int color = (attr & 0x08) >> 3;
147194         int flipx = attr & 0x04;
148195         int flipy = attr & 0x02;
149         int sx = 240 - spriteram[offs + 3];
150         int sy = (240 - spriteram[offs + 2]) & 0xff;
196         int x = 240 - state->spriteram[offs + 3];
197         int y = (240 - state->spriteram[offs + 2]) & 0xff;
151198
152         if (flip_screen_get())
199         if (flip)
153200         {
154            sx = 240 - sx;
155            sy = 240 - sy;
201            x = 240 - x;
202            y = 240 - y;
156203            flipx = !flipx;
157204            flipy = !flipy;
158205         }
159206
160         drawgfx(bitmap,machine->gfx[2],   code, color, flipx, flipy,
161            sx, sy, cliprect, TRANSPARENCY_PEN, 0);
207         drawgfx(bitmap, gfx[2],   code, color, flipx, flipy, x, y, cliprect, TRANSPARENCY_PEN, 0);
162208      }
163209   }
164210}
165211
166VIDEO_UPDATE( mystston )
212
213
214/*************************************
215 *
216 *  Start
217 *
218 *************************************/
219
220static VIDEO_START( mystston )
167221{
168   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
169   draw_sprites(machine, bitmap, cliprect);
170   tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0);
222   mystston_state *state = machine->driver_data;
223
224   state->bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_cols_flip_x, 16, 16, 16, 32);
225
226   state->fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_cols_flip_x,  8,  8, 32, 32);
227   tilemap_set_transparent_pen(state->fg_tilemap, 0);
228
229   /* create the interrupt timer */
230   state->interrupt_timer = timer_alloc(interrupt_callback, NULL);
231}
232
233
234
235/*************************************
236 *
237 *  Reset
238 *
239 *************************************/
240
241static VIDEO_RESET( mystston )
242{
243   mystston_state *state = machine->driver_data;
244
245   timer_adjust_oneshot(state->interrupt_timer, video_screen_get_time_until_pos(0, FIRST_INT_VPOS - 1, INT_HPOS), FIRST_INT_VPOS);
246}
247
248
249
250/*************************************
251 *
252 *  Update
253 *
254 *************************************/
255
256static VIDEO_UPDATE( mystston )
257{
258   mystston_state *state = machine->driver_data;
259
260   int flip = (*state->video_control & 0x80) ^ ((readinputportbytag("DSW1") & 0x20) << 2);
261
262   set_palette(machine, state);
263
264   tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
265   tilemap_set_scrolly(state->bg_tilemap, 0, *state->scroll);
266   tilemap_set_flip(ALL_TILEMAPS, flip ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
267
268   tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
269   draw_sprites(state, machine->gfx, bitmap, cliprect, flip);
270   tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
271
171272   return 0;
172273}
274
275
276
277/*************************************
278 *
279 *  Graphics decoding
280 *
281 *************************************/
282
283static const gfx_layout charlayout =
284{
285   8,8,
286   RGN_FRAC(1,3),
287   3,
288   { RGN_FRAC(2,3), RGN_FRAC(1,3), RGN_FRAC(0,3) },
289   { 0, 1, 2, 3, 4, 5, 6, 7 },
290   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
291   8*8
292};
293
294
295static const gfx_layout spritelayout =
296{
297   16,16,
298   RGN_FRAC(1,3),
299   3,
300   { RGN_FRAC(2,3), RGN_FRAC(1,3), RGN_FRAC(0,3) },
301   { 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7,
302     16*0+0, 16*0+1, 16*0+2, 16*0+3, 16*0+4, 16*0+5, 16*0+6, 16*0+7 },
303   { 0*8, 1*8,  2*8,  3*8,  4*8,  5*8,  6*8,  7*8,
304     8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
305   32*8
306};
307
308
309static GFXDECODE_START( mystston )
310   GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout,   4*8, 4 )
311   GFXDECODE_ENTRY( REGION_GFX2, 0, spritelayout, 2*8, 1 )
312   GFXDECODE_ENTRY( REGION_GFX1, 0, spritelayout, 0*8, 2 )
313GFXDECODE_END
314
315
316
317/*************************************
318 *
319 *  Machine driver
320 *
321 *************************************/
322
323MACHINE_DRIVER_START( mystston_video )
324
325   MDRV_VIDEO_START(mystston)
326   MDRV_VIDEO_RESET(mystston)
327   MDRV_VIDEO_UPDATE(mystston)
328
329   MDRV_GFXDECODE(mystston)
330   MDRV_PALETTE_LENGTH(0x40)
331
332   MDRV_SCREEN_ADD("main", RASTER)
333   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
334   MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
335MACHINE_DRIVER_END
src/mame/video/mainsnk.c
r1877r1878
112112   tilemap_set_scrollx( me_bg_tilemap, 0, -mainsnk_offset );
113113}
114114
115static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int scrollx, int scrolly )
115static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int scrollx, int scrolly )
116116{
117117   const gfx_element *gfx = machine->gfx[1];
118118   const UINT8 *source, *finish;
r1877r1878
142142}
143143
144144
145static void draw_status(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect,int dx,int off )
145static void draw_status(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect,int dx,int off )
146146{
147147   const UINT8 *base = mainsnk_fgram+off;
148148   const gfx_element *gfx = machine->gfx[0];
src/mame/video/midyunit.c
r1877r1878
565565}
566566
567567
568void midyunit_scanline_update(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params)
568void midyunit_scanline_update(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params)
569569{
570570   UINT16 *src = &local_videoram[(params->rowaddr << 9) & 0x3fe00];
571571   UINT16 *dest = BITMAP_ADDR16(bitmap, scanline, 0);
src/mame/video/ygv608.c
r1877r1878
4949static tilemap *tilemap_B_cache_16[3];
5050static tilemap *tilemap_A = NULL;
5151static tilemap *tilemap_B = NULL;
52static mame_bitmap *work_bitmap = NULL;
52static bitmap_t *work_bitmap = NULL;
5353
5454static void HandleYGV608Reset( void );
5555static void HandleRomTransfers( void );
r1877r1878
538538   add_exit_callback(machine, ygv608_exit);
539539}
540540
541static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
541static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
542542{
543543#ifdef _ENABLE_SPRITES
544544
src/mame/video/rampart.c
r1877r1878
8383VIDEO_UPDATE( rampart )
8484{
8585   struct atarimo_rect_list rectlist;
86   mame_bitmap *mobitmap;
86   bitmap_t *mobitmap;
8787   int x, y, r;
8888
8989   /* draw the playfield */
r1877r1878
117117 *
118118 *************************************/
119119
120void rampart_bitmap_render(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
120void rampart_bitmap_render(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
121121{
122122   int x, y;
123123
src/mame/video/senjyo.c
r1877r1878
185185
186186***************************************************************************/
187187
188static void draw_bgbitmap(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
188static void draw_bgbitmap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
189189{
190190   int x,y,pen,strwid,count;
191191
r1877r1878
219219   }
220220}
221221
222static void draw_radar(mame_bitmap *bitmap,const rectangle *cliprect)
222static void draw_radar(bitmap_t *bitmap,const rectangle *cliprect)
223223{
224224   int offs,x;
225225
r1877r1878
244244         }
245245}
246246
247static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int priority)
247static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int priority)
248248{
249249   int offs;
250250
src/mame/video/stvvdp1.c
r1877r1878
549549   if ( color > 0x1f ) color = 0x1f;
550550
551551   return color;
552};
552}
553553
554554static UINT16 stv_vdp1_apply_gouraud_shading( int x, int y, UINT16 pix )
555555{
r1877r1878
880880   {
881881      stv_framebuffer_draw_lines[y][x] = pix | sprite_colorbank;
882882   }
883};
883}
884884
885885static void drawpixel_4bpp_notrans(int x, int y, int patterndata, int offsetcnt)
886886{
src/mame/video/yiear.c
r1877r1878
8383
8484   /* bit 2 is IRQ enable */
8585
86   interrupt_enable_w(0, data & 0x04);
86   interrupt_enable_w(machine, 0, data & 0x04);
8787
8888   /* bits 3 and 4 are coin counters */
8989
r1877r1878
108108       8, 8, 32, 32);
109109}
110110
111static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
111static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
112112{
113113   int offs;
114114
src/mame/video/nbmj9195.c
r1877r1878
3535static int nb19010_busyctr;
3636static int nb19010_busyflag;
3737
38static mame_bitmap *nbmj9195_tmpbitmap[VRAM_MAX];
38static bitmap_t *nbmj9195_tmpbitmap[VRAM_MAX];
3939static UINT16 *nbmj9195_videoram[VRAM_MAX];
4040static UINT16 *nbmj9195_videoworkram[VRAM_MAX];
4141static UINT8 *nbmj9195_palette, *nbmj9195_nb22090_palette;
src/mame/video/sonson.c
r1877r1878
132132   tilemap_set_scroll_rows(bg_tilemap, 32);
133133}
134134
135static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
135static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
136136{
137137   int offs;
138138
src/mame/video/sslam.c
r1877r1878
99
1010static int sprites_x_offset;
1111
12static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
12static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
1313{
1414   const gfx_element *gfx = machine->gfx[0];
1515   UINT16 *source = sslam_spriteram;
src/mame/video/simpl156.c
r1877r1878
33*/
44
55#include "driver.h"
6#include "deprecat.h"
76#include "deco16ic.h"
87
98/*
r1877r1878
3635
3736/* spriteram is really 16-bit.. this can be changed to use 16-bit ram like the tilemaps
3837 its the same sprite chip Data East used on many, many 16-bit era titles */
39static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
38static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
4039{
4140   int offs;
4241
r1877r1878
5150
5251      y = spriteram32[offs]&0xffff;
5352      flash=y&0x1000;
54      if (flash && (cpu_getcurrentframe() & 1)) continue;
53      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
5554
5655      x = spriteram32[offs+2]&0xffff;
5756      colour = (x >>9) & 0x1f;
src/mame/video/hcastle.c
r1877r1878
177177   {
178178      tilemap_set_flip(fg_tilemap, (data & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
179179   }
180   K007121_ctrl_0_w(offset,data);
180   K007121_ctrl_0_w(machine,offset,data);
181181}
182182
183183WRITE8_HANDLER( hcastle_pf2_control_w )
r1877r1878
193193   {
194194      tilemap_set_flip(bg_tilemap, (data & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
195195   }
196   K007121_ctrl_1_w(offset,data);
196   K007121_ctrl_1_w(machine,offset,data);
197197}
198198
199199/*****************************************************************************/
200200
201static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT8 *sbank, int bank )
201static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8 *sbank, int bank )
202202{
203203   int bank_base = (bank == 0) ? 0x4000 * (gfx_bank & 1) : 0;
204204   K007121_sprites_draw(bank,bitmap,machine->gfx,machine->colortable,cliprect,sbank,(K007121_ctrlram[bank][6]&0x30)*2,0,bank_base,-1);
src/mame/video/deadang.c
r1877r1878
8181   tilemap_set_transparent_pen(text_layer, 15);
8282}
8383
84static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
84static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
8585{
8686   int offs,fx,fy,x,y,color,sprite,pri;
8787
src/mame/video/artmagic.c
r1877r1878
346346 *
347347 *************************************/
348348
349void artmagic_scanline(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params)
349void artmagic_scanline(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params)
350350{
351351   offs_t offset = (params->rowaddr << 12) & 0x7ff000;
352352   UINT16 *vram = address_to_vram(&offset);
src/mame/video/twincobr.c
r1877r1878
290290WRITE8_HANDLER( wardner_txlayer_w )
291291{
292292   int shift = 8 * (offset & 1);
293   twincobr_txoffs_w(offset / 2, data << shift, 0xff00 >> shift);
293   twincobr_txoffs_w(machine, offset / 2, data << shift, 0xff00 >> shift);
294294}
295295
296296WRITE8_HANDLER( wardner_bglayer_w )
297297{
298298   int shift = 8 * (offset & 1);
299   twincobr_bgoffs_w(offset / 2, data << shift, 0xff00 >> shift);
299   twincobr_bgoffs_w(machine, offset / 2, data << shift, 0xff00 >> shift);
300300}
301301
302302WRITE8_HANDLER( wardner_fglayer_w )
303303{
304304   int shift = 8 * (offset & 1);
305   twincobr_fgoffs_w(offset / 2, data << shift, 0xff00 >> shift);
305   twincobr_fgoffs_w(machine, offset / 2, data << shift, 0xff00 >> shift);
306306}
307307
308308WRITE8_HANDLER( wardner_txscroll_w )
309309{
310310   int shift = 8 * (offset & 1);
311   twincobr_txscroll_w(offset / 2, data << shift, 0xff00 >> shift);
311   twincobr_txscroll_w(machine, offset / 2, data << shift, 0xff00 >> shift);
312312}
313313
314314WRITE8_HANDLER( wardner_bgscroll_w )
315315{
316316   int shift = 8 * (offset & 1);
317   twincobr_bgscroll_w(offset / 2, data << shift, 0xff00 >> shift);
317   twincobr_bgscroll_w(machine, offset / 2, data << shift, 0xff00 >> shift);
318318}
319319
320320WRITE8_HANDLER( wardner_fgscroll_w )
321321{
322322   int shift = 8 * (offset & 1);
323   twincobr_fgscroll_w(offset / 2, data << shift, 0xff00 >> shift);
323   twincobr_fgscroll_w(machine, offset / 2, data << shift, 0xff00 >> shift);
324324}
325325
326326WRITE8_HANDLER( wardner_exscroll_w )   /* Extra unused video layer */
r1877r1878
338338{
339339   int shift = 8 * (offset & 1);
340340   switch (offset/2) {
341      case 0: return twincobr_txram_r(0,0) >> shift; break;
342      case 1: return twincobr_bgram_r(0,0) >> shift; break;
343      case 2: return twincobr_fgram_r(0,0) >> shift; break;
341      case 0: return twincobr_txram_r(machine,0,0) >> shift; break;
342      case 1: return twincobr_bgram_r(machine,0,0) >> shift; break;
343      case 2: return twincobr_fgram_r(machine,0,0) >> shift; break;
344344   }
345345   return 0;
346346}
r1877r1878
349349{
350350   int shift = 8 * (offset & 1);
351351   switch (offset/2) {
352      case 0: twincobr_txram_w(0,data << shift, 0xff00 >> shift); break;
353      case 1: twincobr_bgram_w(0,data << shift, 0xff00 >> shift); break;
354      case 2: twincobr_fgram_w(0,data << shift, 0xff00 >> shift); break;
352      case 0: twincobr_txram_w(machine,0,data << shift, 0xff00 >> shift); break;
353      case 1: twincobr_bgram_w(machine,0,data << shift, 0xff00 >> shift); break;
354      case 2: twincobr_fgram_w(machine,0,data << shift, 0xff00 >> shift); break;
355355   }
356356}
357357
r1877r1878
417417   if ( input_code_pressed(KEYCODE_M) )
418418   {
419419      offs_t tile_voffs;
420      int tcode[3];
420      int tcode[4];
421421      while (input_code_pressed(KEYCODE_M)) ;
422422      logerror("Scrolls             BG-X BG-Y  FG-X FG-Y  TX-X  TX-Y\n");
423423      logerror("------>             %04x %04x  %04x %04x  %04x  %04x\n",bgscrollx,bgscrolly,fgscrollx,fgscrolly,txscrollx,txscrolly);
r1877r1878
454454    Sprite Handlers
455455***************************************************************************/
456456
457static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority )
457static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority )
458458{
459459   int offs;
460460
r1877r1878
489489
490490
491491/***************************************************************************
492    Draw the game screen in the given mame_bitmap.
492    Draw the game screen in the given bitmap_t.
493493***************************************************************************/
494494
495495VIDEO_UPDATE( toaplan0 )
r1877r1878
517517   /* Spriteram is always 1 frame ahead, suggesting spriteram buffering.
518518        There are no CPU output registers that control this so we
519519        assume it happens automatically every frame, at the end of vblank */
520   buffer_spriteram16_w(0,0,0);
520   buffer_spriteram16_w(machine,0,0,0);
521521}
src/mame/video/bking.c
r1877r1878
3131static int controller;
3232static int hit;
3333
34static mame_bitmap* helper0;
35static mame_bitmap* helper1;
34static bitmap_t *helper0;
35static bitmap_t *helper1;
3636
37static tilemap* bg_tilemap;
37static tilemap *bg_tilemap;
3838
3939
4040/***************************************************************************
src/mame/video/galpani2.c
r1877r1878
3030UINT16 *galpani2_bg8_0_scrollx, *galpani2_bg8_1_scrollx;
3131UINT16 *galpani2_bg8_0_scrolly, *galpani2_bg8_1_scrolly;
3232
33static mame_bitmap *galpani2_bg8_bitmap_0, *galpani2_bg8_bitmap_1;
33static bitmap_t *galpani2_bg8_bitmap_0, *galpani2_bg8_bitmap_1;
3434
3535#define galpani2_BG8_REGS_R( _n_ ) \
3636READ16_HANDLER( galpani2_bg8_regs_##_n_##_r ) \
r1877r1878
9898
9999UINT16 *galpani2_bg15;
100100
101static mame_bitmap *galpani2_bg15_bitmap;
101static bitmap_t *galpani2_bg15_bitmap;
102102
103103/* 8 horizontal pages of 256x256 pixels? */
104104WRITE16_HANDLER( galpani2_bg15_w )
src/mame/video/thief.c
r1877r1878
196196            if( addr<0x2000*3 ) data = gfx_rom[addr];
197197         }
198198         offs = (y*32+x/8+i)&0x1fff;
199         old_data = thief_videoram_r( offs );
199         old_data = thief_videoram_r( machine,offs );
200200         if( xor_blit ){
201            thief_videoram_w( offs, old_data^(data>>xoffset) );
201            thief_videoram_w( machine,offs, old_data^(data>>xoffset) );
202202         }
203203         else {
204            thief_videoram_w( offs,
204            thief_videoram_w( machine,offs,
205205               (old_data&(0xff00>>xoffset)) | (data>>xoffset)
206206            );
207207         }
208208         offs = (offs+1)&0x1fff;
209         old_data = thief_videoram_r( offs );
209         old_data = thief_videoram_r( machine,offs );
210210         if( xor_blit ){
211            thief_videoram_w( offs, old_data^((data<<(8-xoffset))&0xff) );
211            thief_videoram_w( machine,offs, old_data^((data<<(8-xoffset))&0xff) );
212212         }
213213         else {
214            thief_videoram_w( offs,
214            thief_videoram_w( machine,offs,
215215               (old_data&(0xff>>xoffset)) | ((data<<(8-xoffset))&0xff)
216216            );
217217         }
src/mame/video/ccastles.c
r1877r1878
1818 *************************************/
1919
2020static double rweights[3], gweights[3], bweights[3];
21static mame_bitmap *spritebitmap;
21static bitmap_t *spritebitmap;
2222
2323static UINT8 video_control[8];
2424static UINT8 bitmode_addr[2];
src/mame/video/ddragon3.c
r1877r1878
128128 *   6,7| unused
129129 */
130130
131static void draw_sprites(running_machine* machine, mame_bitmap *bitmap, const rectangle *cliprect)
131static void draw_sprites(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect)
132132{
133133   UINT16 *source = spriteram16;
134134   UINT16 *finish = source + 0x800;
src/mame/video/sprint2.c
r1877r1878
1010UINT8* sprint2_video_ram;
1111
1212static tilemap* bg_tilemap;
13static mame_bitmap* helper;
13static bitmap_t* helper;
1414
1515static int collision[2];
1616
src/mame/video/exterm.c
r1877r1878
6767 *
6868 *************************************/
6969
70void exterm_scanline_update(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params)
70void exterm_scanline_update(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params)
7171{
7272   UINT16 *bgsrc = &exterm_master_videoram[(params->rowaddr << 8) & 0xff00];
7373   UINT16 *fgsrc = NULL;
src/mame/video/orbit.c
r1877r1878
5353}
5454
5555
56static void draw_sprites(running_machine *machine, mame_bitmap* bitmap, const rectangle* cliprect)
56static void draw_sprites(running_machine *machine, bitmap_t* bitmap, const rectangle* cliprect)
5757{
5858   const UINT8* p = orbit_sprite_ram;
5959
src/mame/video/ambush.c
r1877r1878
4949}
5050
5151
52static void draw_chars(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
52static void draw_chars(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority)
5353{
5454   int offs, transparency;
5555
src/mame/video/seibuspi.c
r1877r1878
233233   COMBINE_DATA( &video_dma_address );
234234}
235235
236static void draw_blend_gfx(mame_bitmap *bitmap, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, int sx, int sy)
236static void draw_blend_gfx(bitmap_t *bitmap, const rectangle *cliprect, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, int sx, int sy)
237237{
238238   UINT8 *dp;
239239   int i, j;
r1877r1878
355355   { 7*16, 6*16, 5*16, 4*16, 3*16, 2*16, 1*16, 0*16 }
356356};
357357
358static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri_mask)
358static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri_mask)
359359{
360360   INT16 xpos, ypos;
361361   int tile_num, color;
r1877r1878
562562#endif
563563
564564
565static void combine_tilemap(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, tilemap *tile, int x, int y, int opaque, INT16 *rowscroll)
565static void combine_tilemap(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, tilemap *tile, int x, int y, int opaque, INT16 *rowscroll)
566566{
567567   int i,j;
568568   UINT16 *s;
569569   UINT16 *d;
570570   UINT8 *t;
571571   UINT32 xscroll_mask, yscroll_mask;
572   mame_bitmap *pen_bitmap;
573   mame_bitmap *flags_bitmap;
572   bitmap_t *pen_bitmap;
573   bitmap_t *flags_bitmap;
574574
575575   pen_bitmap = tilemap_get_pixmap(tile);
576576   flags_bitmap = tilemap_get_flagsmap(tile);
src/mame/video/sauro.c
r1877r1878
9696   palette_bank = 0;
9797}
9898
99static void sauro_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
99static void sauro_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
100100{
101101   int offs,code,sx,sy,color,flipx;
102102
r1877r1878
163163       8, 8, 32, 32);
164164}
165165
166static void trckydoc_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
166static void trckydoc_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
167167{
168168   int offs,code,sy,color,flipx,sx;
169169
src/mame/video/gaplus.c
r1877r1878
239239
240240***************************************************************************/
241241
242static void starfield_render(running_machine *machine, mame_bitmap *bitmap)
242static void starfield_render(running_machine *machine, bitmap_t *bitmap)
243243{
244244   int i;
245245   int width, height;
r1877r1878
266266   }
267267}
268268
269static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
269static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
270270{
271271   int offs;
272272
src/mame/video/midtunit.c
r1877r1878
306306WRITE16_HANDLER( midxunit_paletteram_w )
307307{
308308   if (!(offset & 1))
309      midtunit_paletteram_w(offset / 2, data, mem_mask);
309      midtunit_paletteram_w(machine, offset / 2, data, mem_mask);
310310}
311311
312312
r1877r1878
808808 *
809809 *************************************/
810810
811void midtunit_scanline_update(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params)
811void midtunit_scanline_update(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params)
812812{
813813   UINT16 *src = &local_videoram[(params->rowaddr << 9) & 0x3fe00];
814814   UINT16 *dest = BITMAP_ADDR16(bitmap, scanline, 0);
r1877r1878
820820      dest[x] = src[coladdr++ & 0x1ff] & 0x7fff;
821821}
822822
823void midxunit_scanline_update(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params)
823void midxunit_scanline_update(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params)
824824{
825825   UINT32 fulladdr = ((params->rowaddr << 16) | params->coladdr) >> 3;
826826   UINT16 *src = &local_videoram[fulladdr & 0x3fe00];
src/mame/video/carpolo.c
r1877r1878
4949#define RIGHT_BORDER      (239)
5050
5151
52static mame_bitmap *sprite_sprite_collision_bitmap1;
53static mame_bitmap *sprite_sprite_collision_bitmap2;
54static mame_bitmap *sprite_goal_collision_bitmap1;
55static mame_bitmap *sprite_goal_collision_bitmap2;
56static mame_bitmap *sprite_border_collision_bitmap;
52static bitmap_t *sprite_sprite_collision_bitmap1;
53static bitmap_t *sprite_sprite_collision_bitmap2;
54static bitmap_t *sprite_goal_collision_bitmap1;
55static bitmap_t *sprite_goal_collision_bitmap2;
56static bitmap_t *sprite_border_collision_bitmap;
5757
5858
5959/***************************************************************************
r1877r1878
176176 *
177177 *************************************/
178178
179static void draw_alpha_line(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect,
179static void draw_alpha_line(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect,
180180                        int alpha_line, int video_line)
181181{
182182   int x;
r1877r1878
207207}
208208
209209
210static void draw_sprite(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect,
210static void draw_sprite(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect,
211211                  UINT8 x, UINT8 y, int bank, int code, int col)
212212{
213213   int remapped_code, flipy;
src/mame/video/system1.c
r1877r1878
2626static UINT8 *bg_dirtybuffer;
2727
2828static int scrollx_row[32];
29static mame_bitmap *tmp_bitmap;
29static bitmap_t *tmp_bitmap;
3030
3131//static int system1_pixel_mode = 0
3232static UINT8 system1_background_memory,system1_video_mode=0;
r1877r1878
179179}
180180
181181
182#ifdef UNUSED_FUNCTON
182183INLINE int get_sprite_bottom_y(int spr_number)
183184{
184185   return  spriteram[0x10 * spr_number + SPR_Y_BOTTOM];
185186}
187#endif
186188
187INLINE void draw_pixel(mame_bitmap *bitmap,
189INLINE void draw_pixel(bitmap_t *bitmap,
188190                    int x,int y,int x_flipped,int y_flipped,
189191                    int spr_number,int color)
190192{
r1877r1878
252254   system1_sprites_collisionram[offset] = 0x7e;
253255}
254256
255static void draw_sprite(mame_bitmap *bitmap,int spr_number)
257static void draw_sprite(bitmap_t *bitmap,int spr_number)
256258{
257259   int sy,row,height,src,bank;
258260   UINT8 *sprite_base;
r1877r1878
334336}
335337
336338
337static void draw_sprites(mame_bitmap *bitmap)
339static void draw_sprites(bitmap_t *bitmap)
338340{
339341   int spr_number,sprite_bottom_y,sprite_top_y;
340342   UINT8 *sprite_base;
r1877r1878
361363}
362364
363365
364static int system1_draw_fg(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
366static int system1_draw_fg(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority)
365367{
366368   int sx,sy,offs;
367369   int drawn = 0;
r1877r1878
406408   return drawn;
407409}
408410
409static void system1_draw_bg(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
411static void system1_draw_bg(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority)
410412{
411413   int sx,sy,offs;
412414   int background_scrollx_flip, background_scrolly_flip;
r1877r1878
554556   scrollx_row[offset/2] = (system1_scrollx_ram[offset & ~1] >> 1) + ((system1_scrollx_ram[offset | 1] & 1) << 7);
555557}
556558
557static void chplft_draw_bg(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
559static void chplft_draw_bg(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority)
558560{
559561   int sx,sy,offs;
560562   int choplifter_scroll_x_on = (system1_scrollx_ram[0] == 0xe5 && system1_scrollx_ram[1] == 0xff) ? 0 : 1;
r1877r1878
711713   wbml_paged_videoram[0x1000*wbml_videoram_bank + offset] = data;
712714}
713715
714static void wbml_draw_bg(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int trasp)
716static void wbml_draw_bg(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int trasp)
715717{
716718   int page;
717719
r1877r1878
767769   } /* next page */
768770}
769771
770static void wbml_draw_fg(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
772static void wbml_draw_fg(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
771773{
772774   int offs;
773775
r1877r1878
812814}
813815
814816/* same as wbml but with rows scroll */
815static void ufosensi_draw_bg(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int trasp)
817static void ufosensi_draw_bg(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int trasp)
816818{
817819   int page;
818820
src/mame/video/powerins.c
r1877r1878
267267#define SIGN_EXTEND_POS(_var_)   {_var_ &= 0x3ff; if (_var_ > 0x1ff) _var_ -= 0x400;}
268268
269269
270static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
270static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
271271{
272272   UINT16 *source = spriteram16 + 0x8000/2;
273273   UINT16 *finish = spriteram16 + 0x9000/2;
src/mame/video/niyanpai.c
r1877r1878
2727static int nb19010_busyctr;
2828static int nb19010_busyflag;
2929
30static mame_bitmap *niyanpai_tmpbitmap[VRAM_MAX];
30static bitmap_t *niyanpai_tmpbitmap[VRAM_MAX];
3131static UINT16 *niyanpai_videoram[VRAM_MAX];
3232static UINT16 *niyanpai_videoworkram[VRAM_MAX];
3333static UINT16 *niyanpai_palette;
src/mame/video/stvvdp2.c
r1877r1878
103103static int stv_vdp2_window_process(int x,int y);
104104static int stv_vdp2_apply_window_on_layer(rectangle *cliprect);
105105static void stv_vdp2_get_window0_coordinates(UINT16 *s_x, UINT16 *e_x, UINT16 *s_y, UINT16 *e_y);
106static void stv_vdp2_check_tilemap(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect);
107static mame_bitmap *stv_vdp2_roz_bitmap[2];
106static void stv_vdp2_check_tilemap(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
107static bitmap_t *stv_vdp2_roz_bitmap[2];
108108
109109enum
110110{
r1877r1878
23572357
23582358}
23592359
2360static void stv_vdp2_drawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
2360static void stv_vdp2_drawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx,
23612361      UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
23622362      const rectangle *clip,int transparency,int transparent_color,int scalex, int scaley,
23632363      int sprite_screen_width, int sprite_screen_height)
r1877r1878
26902690   *rgb = (_r << 10) |  (_g << 5) | _b;
26912691}
26922692
2693static void stv_vdp2_drawgfx_rgb555( mame_bitmap *dest_bmp, UINT32 code, int flipx, int flipy,
2693static void stv_vdp2_drawgfx_rgb555( bitmap_t *dest_bmp, UINT32 code, int flipx, int flipy,
26942694                            int sx, int sy, const rectangle *clip, int transparency)
26952695{
26962696   rectangle myclip;
r1877r1878
28152815
28162816}
28172817
2818static void stv_vdp2_draw_basic_bitmap(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
2818static void stv_vdp2_draw_basic_bitmap(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
28192819{
28202820//  if(LOG_VDP2) logerror ("bitmap enable %02x size %08x depth %08x\n", stv2_current_tilemap.layer_name, stv2_current_tilemap.bitmap_size, stv2_current_tilemap.colour_depth);
28212821//  popmessage ("bitmap enable %02x size %08x depth %08x number %02x", stv2_current_tilemap.layer_name, stv2_current_tilemap.bitmap_size, stv2_current_tilemap.colour_depth,stv2_current_tilemap.bitmap_palette_number);
r1877r1878
33013301   *_map = map;
33023302}
33033303
3304static void stv_vdp2_draw_basic_tilemap(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
3304static void stv_vdp2_draw_basic_tilemap(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
33053305{
33063306   /* hopefully this is easier to follow than it is efficient .. */
33073307
r1877r1878
37903790   }
37913791
37923792
3793static void stv_vdp2_check_tilemap_with_linescroll(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
3793static void stv_vdp2_check_tilemap_with_linescroll(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
37943794{
37953795   rectangle mycliprect;
37963796   int cur_line = cliprect->min_y;
r1877r1878
39213921   }
39223922}
39233923
3924static void stv_vdp2_check_tilemap(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
3924static void stv_vdp2_check_tilemap(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
39253925{
39263926   /* the idea is here we check the tilemap capabilities / whats enabled and call an appropriate tilemap drawing routine, or
39273927      at the very list throw up a few errors if the tilemaps want to do something we don't support yet */
r1877r1878
39673967   }
39683968}
39693969
3970static void stv_vdp2_copy_roz_bitmap(mame_bitmap *bitmap,
3971                            mame_bitmap *roz_bitmap,
3970static void stv_vdp2_copy_roz_bitmap(bitmap_t *bitmap,
3971                            bitmap_t *roz_bitmap,
39723972                            const rectangle *cliprect,
39733973                            int iRP,
39743974                            int planesizex,
r1877r1878
43344334   }
43354335}
43364336
4337static void stv_vdp2_draw_NBG0(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
4337static void stv_vdp2_draw_NBG0(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
43384338{
43394339   /*
43404340       Colours           : 16, 256, 2048, 32768, 16770000
r1877r1878
44244424   stv_vdp2_check_tilemap(machine, bitmap, cliprect);
44254425}
44264426
4427static void stv_vdp2_draw_NBG1(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
4427static void stv_vdp2_draw_NBG1(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
44284428{
44294429   /*
44304430       Colours           : 16, 256, 2048, 32768
r1877r1878
45144514   stv_vdp2_check_tilemap(machine, bitmap, cliprect);
45154515}
45164516
4517static void stv_vdp2_draw_NBG2(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
4517static void stv_vdp2_draw_NBG2(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
45184518{
45194519   /*
45204520       NBG2 is the first of the 2 more basic tilemaps, it has exactly the same capabilities as NBG3
r1877r1878
46144614   stv_vdp2_check_tilemap(machine, bitmap, cliprect);
46154615}
46164616
4617static void stv_vdp2_draw_NBG3(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
4617static void stv_vdp2_draw_NBG3(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
46184618{
46194619   /*
46204620       NBG3 is the second of the 2 more basic tilemaps, it has exactly the same capabilities as NBG2
r1877r1878
47154715}
47164716
47174717
4718static void stv_vdp2_draw_rotation_screen(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int iRP)
4718static void stv_vdp2_draw_rotation_screen(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int iRP)
47194719{
47204720   rectangle roz_clip_rect, mycliprect;
47214721   int planesizex = 0, planesizey = 0, planerenderedsizex, planerenderedsizey;
r1877r1878
49004900
49014901}
49024902
4903static void stv_vdp2_draw_RBG0(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
4903static void stv_vdp2_draw_RBG0(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
49044904{
49054905   /*
49064906       Colours           : 16, 256, 2048, 32768, 16770000
r1877r1878
50005000
50015001}
50025002
5003static void stv_vdp2_draw_back(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
5003static void stv_vdp2_draw_back(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
50045004{
50055005   int xcnt,ycnt;
50065006   UINT8* gfxdata = stv_vdp2_gfx_decode;
r1877r1878
56325632static UINT8   stv_sprite_priorities_in_fb_line[512][8];
56335633
56345634
5635static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT8 pri)
5635static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8 pri)
56365636{
56375637   int x,y,r,g,b;
56385638   int i;
src/mame/video/exedexes.c
r1877r1878
183183   colortable_configure_tilemap_groups(machine->colortable, tx_tilemap, machine->gfx[0], 0xcf);
184184}
185185
186static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
186static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority)
187187{
188188   int offs;
189189
r1877r1878
243243
244244VIDEO_EOF( exedexes )
245245{
246   buffer_spriteram_w(0,0);
246   buffer_spriteram_w(machine,0,0);
247247}
src/mame/video/jedi.c
r1877r1878
8989}
9090
9191
92static void do_pen_lookup(jedi_state *state, mame_bitmap *bitmap, const rectangle *cliprect)
92static void do_pen_lookup(jedi_state *state, bitmap_t *bitmap, const rectangle *cliprect)
9393{
9494   int y, x;
9595   pen_t pens[NUM_PENS];
r1877r1878
111111
112112WRITE8_HANDLER( jedi_vscroll_w )
113113{
114   jedi_state *state = Machine->driver_data;
114   jedi_state *state = machine->driver_data;
115115
116116   state->vscroll = data | (offset << 8);
117117}
r1877r1878
119119
120120WRITE8_HANDLER( jedi_hscroll_w )
121121{
122   jedi_state *state = Machine->driver_data;
122   jedi_state *state = machine->driver_data;
123123
124124   state->hscroll = data | (offset << 8);
125125}
r1877r1878
133133 *
134134 *************************************/
135135
136static void draw_background_and_text(jedi_state *state, mame_bitmap *bitmap, const rectangle *cliprect)
136static void draw_background_and_text(jedi_state *state, bitmap_t *bitmap, const rectangle *cliprect)
137137{
138138   int y;
139139   int background_line_buffer[0x200];   /* RAM chip at 2A */
r1877r1878
233233 *
234234 *************************************/
235235
236static void draw_sprites(jedi_state *state, mame_bitmap *bitmap, const rectangle *cliprect)
236static void draw_sprites(jedi_state *state, bitmap_t *bitmap, const rectangle *cliprect)
237237{
238238   offs_t offs;
239239   UINT8 *spriteram = state->spriteram;
src/mame/video/suprnova.c
r1877r1878
325325      old2 += 0x40;            \
326326   }
327327
328static void blit_nf_z(mame_bitmap *bitmap, const rectangle *cliprect, const UINT8 *src, int x, int y, int sx, int sy, UINT16 zx, UINT16 zy, int colour)
328static void blit_nf_z(bitmap_t *bitmap, const rectangle *cliprect, const UINT8 *src, int x, int y, int sx, int sy, UINT16 zx, UINT16 zy, int colour)
329329{
330330   z_decls(sx);
331331   z_clamp_x_min();
r1877r1878
339339   }
340340}
341341
342static void blit_fy_z(mame_bitmap *bitmap, const rectangle *cliprect, const UINT8 *src, int x, int y, int sx, int sy, UINT16 zx, UINT16 zy, int colour)
342static void blit_fy_z(bitmap_t *bitmap, const rectangle *cliprect, const UINT8 *src, int x, int y, int sx, int sy, UINT16 zx, UINT16 zy, int colour)
343343{
344344   z_decls(sx);
345345   z_clamp_x_min();
r1877r1878
353353   }
354354}
355355
356static void blit_fx_z(mame_bitmap *bitmap, const rectangle *cliprect, const UINT8 *src, int x, int y, int sx, int sy, UINT16 zx, UINT16 zy, int colour)
356static void blit_fx_z(bitmap_t *bitmap, const rectangle *cliprect, const UINT8 *src, int x, int y, int sx, int sy, UINT16 zx, UINT16 zy, int colour)
357357{
358358   z_decls(sx);
359359   z_clamp_x_max();
r1877r1878
367367   }
368368}
369369
370static void blit_fxy_z(mame_bitmap *bitmap, const rectangle *cliprect, const UINT8 *src, int x, int y, int sx, int sy, UINT16 zx, UINT16 zy, int colour)
370static void blit_fxy_z(bitmap_t *bitmap, const rectangle *cliprect, const UINT8 *src, int x, int y, int sx, int sy, UINT16 zx, UINT16 zy, int colour)
371371{
372372   z_decls(sx);
373373   z_clamp_x_max();
r1877r1878
381381   }
382382}
383383
384static void (*const blit_z[4])(mame_bitmap *bitmap, const rectangle *cliprect, const UINT8 *src, int x, int y, int sx, int sy, UINT16 zx, UINT16 zy, int colour) = {
384static void (*const blit_z[4])(bitmap_t *bitmap, const rectangle *cliprect, const UINT8 *src, int x, int y, int sx, int sy, UINT16 zx, UINT16 zy, int colour) = {
385385   blit_nf_z,
386386   blit_fy_z,
387387   blit_fx_z,
388388   blit_fxy_z,
389389};
390390
391void skns_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
391void skns_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
392392{
393393   /*- SPR RAM Format -**
394394
r1877r1878
766766   machine->gfx[3]->color_granularity=256;
767767}
768768
769static void supernova_draw_a( mame_bitmap *bitmap, const rectangle *cliprect, int tran )
769static void supernova_draw_a( bitmap_t *bitmap, const rectangle *cliprect, int tran )
770770{
771771      int enable_a  = (skns_v3_regs[0x10/4] >> 0) & 0x0001;
772772   UINT32 startx,starty;
r1877r1878
818818   }
819819}
820820
821static void supernova_draw_b( mame_bitmap *bitmap, const rectangle *cliprect, int tran )
821static void supernova_draw_b( bitmap_t *bitmap, const rectangle *cliprect, int tran )
822822{
823823      int enable_b  = (skns_v3_regs[0x34/4] >> 0) & 0x0001;
824824   UINT32 startx,starty;
r1877r1878
970970
971971VIDEO_EOF(skns)
972972{
973   buffer_spriteram32_w(0,0,0);
973   buffer_spriteram32_w(machine,0,0,0);
974974}
src/mame/video/seta2.c
r1877r1878
158158
159159***************************************************************************/
160160
161static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
161static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
162162{
163163   /* Sprites list */
164164
src/mame/video/namcofl.c
r1877r1878
1414/* nth_word32 is a general-purpose utility function, which allows us to
1515 * read from 32-bit aligned memory as if it were an array of 16 bit words.
1616 */
17#ifdef UNUSED_FUNCTON
1718INLINE UINT16
1819nth_word32( const UINT32 *source, int which )
1920{
r1877r1878
2829      return (*source)>>16;
2930   }
3031}
32#endif
3133
3234/* nth_byte32 is a general-purpose utility function, which allows us to
3335 * read from 32-bit aligned memory as if it were an array of bytes.
3436 */
37#ifdef UNUSED_FUNCTON
3538INLINE UINT8
3639nth_byte32( const UINT32 *pSource, int which )
3740{
r1877r1878
4649      default: return data&0xff;
4750      }
4851} /* nth_byte32 */
52#endif
4953
5054static void namcofl_install_palette(running_machine *machine)
5155{
src/mame/video/flkatck.c
r1877r1878
112112         break;
113113   }
114114
115   K007121_ctrl_0_w(offset,data);
115   K007121_ctrl_0_w(machine,offset,data);
116116}
117117
118118
src/mame/video/dynax.c
r1877r1878
123123}
124124WRITE8_HANDLER( tenkai_blit_dest_w )
125125{
126   dynax_blit_dest_w(0, BITSWAP8(data, 7,6,5,4, 0,1,2,3));
126   dynax_blit_dest_w(machine, 0, BITSWAP8(data, 7,6,5,4, 0,1,2,3));
127127}
128128
129129/* Background Color */
r1877r1878
656656      case 3:   blit_src   =   (blit_src & 0xffff00) | (data << 0); break;
657657      case 4: blit_src   =   (blit_src & 0xff00ff) | (data << 8); break;
658658      case 5: blit_src   =   (blit_src & 0x00ffff) | (data <<16); break;
659      case 6: dynax_blit_scroll_w(0,data); break;
659      case 6: dynax_blit_scroll_w(machine,0,data); break;
660660   }
661661}
662662
r1877r1878
671671      case 3:   blit_src   =   (blit_src & 0xffff00) | (data << 0); break;
672672      case 4: blit_src   =   (blit_src & 0xff00ff) | (data << 8); break;
673673      case 5: blit_src   =   (blit_src & 0x00ffff) | (data <<16); break;
674      case 6: tenkai_blit_scroll_w(0,data); break;
674      case 6: tenkai_blit_scroll_w(machine,0,data); break;
675675   }
676676}
677677
r1877r1878
686686      case 3:   blit_src   =   (blit_src & 0xffff00) | (data << 0); break;
687687      case 4: blit_src   =   (blit_src & 0xff00ff) | (data << 8); break;
688688      case 5: blit_src   =   (blit_src & 0x00ffff) | (data <<16); break;
689      case 6: dynax_blit_scroll_w(0,data); break;
689      case 6: dynax_blit_scroll_w(machine,0,data); break;
690690   }
691691}
692692
r1877r1878
700700      case 3:   blit2_src   =   (blit2_src & 0xffff00) | (data << 0); break;
701701      case 4: blit2_src   =   (blit2_src & 0xff00ff) | (data << 8); break;
702702      case 5: blit2_src   =   (blit2_src & 0x00ffff) | (data <<16); break;
703      case 6: dynax_blit2_scroll_w(0,data); break;
703      case 6: dynax_blit2_scroll_w(machine,0,data); break;
704704   }
705705}
706706
r1877r1878
848848
849849***************************************************************************/
850850
851static void hanamai_copylayer(mame_bitmap *bitmap,const rectangle *cliprect,int i)
851static void hanamai_copylayer(bitmap_t *bitmap,const rectangle *cliprect,int i)
852852{
853853   int color;
854854   int scrollx,scrolly;
r1877r1878
913913}
914914
915915
916static void jantouki_copylayer(mame_bitmap *bitmap,const rectangle *cliprect,int i, int y)
916static void jantouki_copylayer(bitmap_t *bitmap,const rectangle *cliprect,int i, int y)
917917{
918918   int color,scrollx,scrolly,palettes,palbank;
919919
r1877r1878
982982}
983983
984984
985static void mjdialq2_copylayer(mame_bitmap *bitmap,const rectangle *cliprect,int i)
985static void mjdialq2_copylayer(bitmap_t *bitmap,const rectangle *cliprect,int i)
986986{
987987   int color;
988988   int scrollx,scrolly;
r1877r1878
10721072    I,O        -  Change palette (-,+)
10731073    J,K & N,M  -  Change "tile"  (-,+, slow & fast)
10741074    R          -  move "tile" to the next 1/8th of the gfx  */
1075static int debug_viewer(mame_bitmap *bitmap,const rectangle *cliprect)
1075static int debug_viewer(bitmap_t *bitmap,const rectangle *cliprect)
10761076{
10771077#ifdef MAME_DEBUG
10781078   static int toggle;
r1877r1878
12521252
12531253// htengoku uses the mixer chip from ddenlovr
12541254
1255static mame_bitmap *framebuffer;
1255static bitmap_t *framebuffer;
12561256
12571257VIDEO_START(htengoku)
12581258{
src/mame/video/shootout.c
r1877r1878
7777      tilemap_set_transparent_pen( foreground, 0 );
7878}
7979
80static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int bank_bits ){
80static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int bank_bits ){
8181   static int bFlicker;
8282   const gfx_element *gfx = machine->gfx[1];
8383   const UINT8 *source = spriteram+127*4;
src/mame/video/contra.c
r1877r1878
236236   if (offset == 7)
237237      tilemap_set_flip(fg_tilemap,(data & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
238238
239   K007121_ctrl_0_w(offset,data);
239   K007121_ctrl_0_w(machine,offset,data);
240240}
241241
242242WRITE8_HANDLER( contra_K007121_ctrl_1_w )
r1877r1878
256256   if (offset == 7)
257257      tilemap_set_flip(bg_tilemap,(data & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
258258
259   K007121_ctrl_1_w(offset,data);
259   K007121_ctrl_1_w(machine,offset,data);
260260}
261261
262262
r1877r1878
267267
268268***************************************************************************/
269269
270static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int bank )
270static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int bank )
271271{
272272   const UINT8 *source;
273273   int base_color = (K007121_ctrlram[bank][6]&0x30)*2;
src/mame/video/paradise.c
r1877r1878
185185   paradise_priority = data;
186186}
187187
188static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
188static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
189189{
190190   int i;
191191   for (i = 0; i < spriteram_size ; i += paradise_sprite_inc)
src/mame/video/volfied.c
r1877r1878
7070                SCREEN REFRESH
7171*******************************************************/
7272
73static void refresh_pixel_layer(running_machine *machine, mame_bitmap *bitmap)
73static void refresh_pixel_layer(running_machine *machine, bitmap_t *bitmap)
7474{
7575   int x, y;
7676
src/mame/video/balsente.c
r1877r1878
127127      sprite_data = sprite_bank[(data & 0x80 >> 7) ^ 1];
128128   }
129129
130   shrike_shared_6809_w( 1, data );
130   shrike_shared_6809_w( machine, 1, data );
131131}
132132
133133
r1877r1878
138138 *
139139 *************************************/
140140
141static void draw_one_sprite(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT8 *sprite)
141static void draw_one_sprite(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8 *sprite)
142142{
143143   int flags = sprite[0];
144144   int image = sprite[1] | ((flags & 7) << 8);
src/mame/video/itech32.c
r1877r1878
14101410
14111411WRITE16_HANDLER( bloodstm_video_w )
14121412{
1413   itech32_video_w(offset / 2, data, mem_mask);
1413   itech32_video_w(machine, offset / 2, data, mem_mask);
14141414}
14151415
14161416
14171417READ16_HANDLER( bloodstm_video_r )
14181418{
1419   return itech32_video_r(offset / 2,0);
1419   return itech32_video_r(machine, offset / 2,0);
14201420}
14211421
14221422
14231423WRITE32_HANDLER( itech020_video_w )
14241424{
14251425   if (ACCESSING_MSW32)
1426      itech32_video_w(offset, data >> 16, mem_mask >> 16);
1426      itech32_video_w(machine, offset, data >> 16, mem_mask >> 16);
14271427   else
1428      itech32_video_w(offset, data, mem_mask);
1428      itech32_video_w(machine, offset, data, mem_mask);
14291429}
14301430
14311431
r1877r1878
14381438
14391439READ32_HANDLER( itech020_video_r )
14401440{
1441   int result = itech32_video_r(offset,0);
1441   int result = itech32_video_r(machine,offset,0);
14421442   return (result << 16) | result;
14431443}
14441444
src/mame/video/chaknpop.c
r1877r1878
203203  Screen refresh
204204***************************************************************************/
205205
206static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
206static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
207207{
208208   int offs;
209209
r1877r1878
238238   }
239239}
240240
241static void draw_bitmap(mame_bitmap *bitmap, const rectangle *cliprect)
241static void draw_bitmap(bitmap_t *bitmap, const rectangle *cliprect)
242242{
243243   int dx = flip_x ? -1 : 1;
244244   int offs, i;
src/mame/video/fitfight.c
r1877r1878
1616
1717extern char bbprot_kludge;
1818
19static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int layer )
19static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int layer )
2020{
2121   const gfx_element *gfx = machine->gfx[3];
2222   UINT16 *source = fitfight_spriteram;
src/mame/video/sspeedr.c
r1877r1878
9393}
9494
9595
96static void draw_track(mame_bitmap* bitmap)
96static void draw_track(bitmap_t* bitmap)
9797{
9898   const UINT8* p = memory_region(REGION_GFX3);
9999
r1877r1878
181181}
182182
183183
184static void draw_drones(running_machine *machine, mame_bitmap* bitmap, const rectangle* cliprect)
184static void draw_drones(running_machine *machine, bitmap_t* bitmap, const rectangle* cliprect)
185185{
186186   static const UINT8 code[6] =
187187   {
r1877r1878
221221}
222222
223223
224static void draw_driver(running_machine *machine, mame_bitmap* bitmap, const rectangle* cliprect)
224static void draw_driver(running_machine *machine, bitmap_t* bitmap, const rectangle* cliprect)
225225{
226226   int x;
227227   int y;
src/mame/video/terracre.c
r1877r1878
3232   SET_TILE_INFO( 0,data&0xff,0,0 );
3333}
3434
35static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
35static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
3636{
3737   const UINT8 *spritepalettebank = memory_region(REGION_USER1);
3838   const gfx_element *pGfx = machine->gfx[2];
src/mame/video/amiga.c
r1877r1878
155155
156156   /* reset the genlock color */
157157   genlock_color = 0xffff;
158
159   VIDEO_START_CALL(generic_bitmapped);
160158}
161159
162160
r1877r1878
212210}
213211
214212
215static int copper_execute_next(int xpos)
213static int copper_execute_next(running_machine *machine, int xpos)
216214{
217215   int word0, word1;
218216
r1877r1878
226224      if (LOG_COPPER)
227225         logerror("%02X.%02X: Write to %s = %04x\n", last_scanline, xpos / 2, amiga_custom_names[copper_pending_offset & 0xff], copper_pending_data);
228226
229      amiga_custom_w(copper_pending_offset, copper_pending_data, 0);
227      amiga_custom_w(machine, copper_pending_offset, copper_pending_data, 0);
230228      copper_pending_offset = 0;
231229   }
232230
r1877r1878
609607 *
610608 *************************************/
611609
612void amiga_render_scanline(int scanline)
610void amiga_render_scanline(running_machine *machine, bitmap_t *bitmap, int scanline)
613611{
614612   UINT16 save_color0 = CUSTOM_REG(REG_COLOR00);
615613   int ddf_start_pixel = 0, ddf_stop_pixel = 0;
r1877r1878
620618   int planes = 0;
621619
622620   int x;
623   UINT16 *dst;
621   UINT16 *dst = NULL;
624622   int ebitoffs = 0, obitoffs = 0;
625623   int ecolmask = 0, ocolmask = 0;
626624   int edelay = 0, odelay = 0;
r1877r1878
640638   update_sprite_dma(scanline);
641639
642640   /* start of a new line, signal we're not done with it and fill up vars */
643   dst = BITMAP_ADDR16(tmpbitmap, scanline, 0);
641   if (bitmap != NULL)
642      dst = BITMAP_ADDR16(bitmap, scanline, 0);
644643
645644   /* all sprites off at the start of the line */
646645   memset(sprite_remain, 0, sizeof(sprite_remain));
r1877r1878
660659      {
661660         /* execute the next batch, restoring and re-saving color 0 around it */
662661         CUSTOM_REG(REG_COLOR00) = save_color0;
663         next_copper_x = copper_execute_next(x);
662         next_copper_x = copper_execute_next(machine, x);
664663         save_color0 = CUSTOM_REG(REG_COLOR00);
665664         if (genlock_color != 0xffff)
666665            CUSTOM_REG(REG_COLOR00) = genlock_color;
r1877r1878
697696      }
698697
699698      /* clear the target pixels to the background color as a starting point */
700      dst[x*2+0] =
701      dst[x*2+1] = CUSTOM_REG(REG_COLOR00);
699      if (dst != NULL)
700         dst[x*2+0] =
701         dst[x*2+1] = CUSTOM_REG(REG_COLOR00);
702702
703703      /* if we hit the first fetch pixel, reset the counters and latch the delays */
704704      if (x == ddf_start_pixel)
r1877r1878
838838            CUSTOM_REG(REG_CLXDAT) |= 0x001;
839839
840840         /* if we are within the display region, render */
841         if (x >= hstart && x < hstop)
841         if (dst != NULL && x >= hstart && x < hstop)
842842         {
843843            /* hold-and-modify mode -- assume low-res (hi-res not supported by the hardware) */
844844            if (ham)
r1877r1878
921921   }
922922
923923#if 0
924   if ( cpu_getcurrentframe() % 64 == 0 && scanline == 100 )
924   if ( video_screen_get_frame_number(0) % 64 == 0 && scanline == 100 )
925925   {
926926      const char *m_lores = "LORES";
927927      const char *m_hires = "HIRES";
r1877r1878
960960   CUSTOM_REG(REG_COLOR00) = save_color0;
961961
962962#if GUESS_COPPER_OFFSET
963   if (cpu_getcurrentframe() % 64 == 0 && scanline == 0)
963   if (video_screen_get_frame_number(0) % 64 == 0 && scanline == 0)
964964   {
965965      if (input_code_pressed(KEYCODE_Q))
966966         popmessage("%d", wait_offset -= 1);
r1877r1878
969969   }
970970#endif
971971}
972
973
974
975/*************************************
976 *
977 *  Update
978 *
979 *************************************/
980
981VIDEO_UPDATE( amiga )
982{
983   int y;
984
985   /* render each scanline in the visible region */
986   for (y = cliprect->min_y; y <= cliprect->max_y; y++)
987      amiga_render_scanline(machine, bitmap, y);
988
989   return 0;
990}
src/mame/video/undrfire.c
r1877r1878
8080
8181***************************************************************/
8282
83static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,const int *primasks,int x_offs,int y_offs)
83static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,const int *primasks,int x_offs,int y_offs)
8484{
8585   UINT16 *spritemap = (UINT16 *)memory_region(REGION_USER1);
8686   int offs, data, tilenum, color, flipx, flipy;
r1877r1878
349349   /* See if we should draw artificial gun targets */
350350   /* (not yet implemented...) */
351351
352   if (input_port_7_word_r(0,0) & 0x1)   /* Fake DSW */
352   if (input_port_7_word_r(machine,0,0) & 0x1)   /* Fake DSW */
353353   {
354354      popmessage("Gunsights on");
355355   }
src/mame/video/malzak.c
r1877r1878
7070   int code, colour;
7171   int sx, sy;
7272   int x,y;
73   mame_bitmap *s2636_0_bitmap;
74   mame_bitmap *s2636_1_bitmap;
73   bitmap_t *s2636_0_bitmap;
74   bitmap_t *s2636_1_bitmap;
7575
7676   fillbitmap(bitmap,0,0);
7777
src/mame/video/deco32.c
r1877r1878
1616static int deco32_pf1_flip,deco32_pf2_flip,deco32_pf3_flip,deco32_pf4_flip;
1717static int deco32_pf2_colourbank,deco32_pf4_colourbank,deco32_pri;
1818
19static mame_bitmap *sprite0_mix_bitmap, *sprite1_mix_bitmap, *tilemap_alpha_bitmap;
19static bitmap_t *sprite0_mix_bitmap, *sprite1_mix_bitmap, *tilemap_alpha_bitmap;
2020
2121static UINT32 dragngun_sprite_ctrl;
2222static int deco32_ace_ram_dirty, has_ace_ram;
r1877r1878
193193
194194/******************************************************************************/
195195
196static void captaven_draw_sprites(running_machine* machine, mame_bitmap *bitmap, const rectangle *cliprect, const UINT32 *spritedata, int gfxbank)
196static void captaven_draw_sprites(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT32 *spritedata, int gfxbank)
197197{
198198   int offs;
199199
r1877r1878
232232
233233      sx = spritedata[offs+1];
234234
235      if ((sy&0x2000) && (cpu_getcurrentframe() & 1)) continue;
235      if ((sy&0x2000) && (video_screen_get_frame_number(0) & 1)) continue;
236236
237237      colour = (spritedata[offs+2] >>0) & 0x1f;
238238
r1877r1878
278278   }
279279}
280280
281static void fghthist_draw_sprites(running_machine* machine, mame_bitmap *bitmap, const rectangle *cliprect, const UINT32 *spritedata, int gfxbank, int mask, int colourmask)
281static void fghthist_draw_sprites(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT32 *spritedata, int gfxbank, int mask, int colourmask)
282282{
283283   int offs;
284284
r1877r1878
291291
292292      y = spritedata[offs];
293293      flash=y&0x1000;
294      if (flash && (cpu_getcurrentframe() & 1)) continue;
294      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
295295
296296      trans=TRANSPARENCY_PEN;
297297      x = spritedata[offs+2];
r1877r1878
344344    Bottom 8 bits per pixel is palettised sprite data, top 8 is
345345    colour/alpha/priority.
346346*/
347static void deco32_draw_sprite(mame_bitmap *dest,const gfx_element *gfx,
347static void deco32_draw_sprite(bitmap_t *dest,const gfx_element *gfx,
348348      UINT32 code,UINT32 priority,int flipx,int flipy,int sx,int sy,
349349      const rectangle *clip)
350350{
r1877r1878
393393}
394394
395395// Merge with Tattass & Fghthist sprite routines later
396static void nslasher_draw_sprites(running_machine* machine, mame_bitmap *bitmap, const rectangle *cliprect, const UINT32 *spritedata, int gfxbank)
396static void nslasher_draw_sprites(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT32 *spritedata, int gfxbank)
397397{
398398   int offs;
399399
r1877r1878
407407
408408      y = spritedata[offs];
409409      flash=y&0x1000;
410      if (flash && (cpu_getcurrentframe() & 1)) continue;
410      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
411411
412412      trans=TRANSPARENCY_PEN;
413413      x = spritedata[offs+2];
r1877r1878
455455   }
456456}
457457
458INLINE void dragngun_drawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
458INLINE void dragngun_drawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx,
459459      UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
460460      const rectangle *clip,int transparency,int transparent_color,
461      int scalex, int scaley,mame_bitmap *pri_buffer,UINT32 pri_mask, int sprite_screen_width, int  sprite_screen_height )
461      int scalex, int scaley,bitmap_t *pri_buffer,UINT32 pri_mask, int sprite_screen_width, int  sprite_screen_height )
462462{
463463   rectangle myclip;
464464
r1877r1878
655655   }
656656}
657657
658static void dragngun_draw_sprites(running_machine* machine, mame_bitmap *bitmap, const rectangle *cliprect, const UINT32 *spritedata)
658static void dragngun_draw_sprites(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT32 *spritedata)
659659{
660660   const UINT32 *layout_ram;
661661   const UINT32 *lookup_ram;
r1877r1878
10731073}
10741074
10751075#if 0
1076static void print_debug_info(mame_bitmap *bitmap)
1076static void print_debug_info(bitmap_t *bitmap)
10771077{
10781078   int j;
10791079   char buf[64*5];
r1877r1878
10911091
10921092#endif
10931093
1094static void tilemap_raster_draw(mame_bitmap *bitmap, const rectangle *cliprect, int flags, int pri)
1094static void tilemap_raster_draw(bitmap_t *bitmap, const rectangle *cliprect, int flags, int pri)
10951095{
10961096   int ptr=0,sx0,sy0,sx1,sy1,start,end=0;
10971097   rectangle clip;
r1877r1878
11241124   }
11251125}
11261126
1127static void combined_tilemap_draw(running_machine* machine, mame_bitmap *bitmap, const rectangle *cliprect)
1127static void combined_tilemap_draw(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect)
11281128{
1129   const mame_bitmap *bitmap0 = tilemap_get_pixmap(pf3_tilemap);
1130   const mame_bitmap *bitmap1 = tilemap_get_pixmap(pf4_tilemap);
1129   const bitmap_t *bitmap0 = tilemap_get_pixmap(pf3_tilemap);
1130   const bitmap_t *bitmap1 = tilemap_get_pixmap(pf4_tilemap);
11311131   int x,y,p;
11321132
11331133   const UINT16 width_mask=0x3ff;
r1877r1878
14121412    blending support - it can't be done in-place on the final framebuffer
14131413    without a lot of support bitmaps.
14141414*/
1415static void mixDualAlphaSprites(running_machine* machine, mame_bitmap *bitmap, const rectangle *cliprect, const gfx_element *gfx0, const gfx_element *gfx1, int mixAlphaTilemap)
1415static void mixDualAlphaSprites(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect, const gfx_element *gfx0, const gfx_element *gfx1, int mixAlphaTilemap)
14161416{
14171417   const pen_t *pal0 = &machine->pens[gfx0->color_base];
14181418   const pen_t *pal1 = &machine->pens[gfx1->color_base];
src/mame/video/midzeus.c
r1877r1878
203203   }
204204}
205205
206#ifdef UNUSED_FUNCTON
206207INLINE void waveram_plot_check_depth_nowrite(int y, int x, UINT16 color, UINT16 depth)
207208{
208209   if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y)
r1877r1878
212213         WAVERAM_WRITEPIX(zeus_renderbase, y, x, color);
213214   }
214215}
216#endif
215217
216218
217
218219/*************************************
219220 *
220221 *  Inlines for texel accesses
r1877r1878
10581059
10591060static void zeus_draw_quad(const UINT32 *databuffer, UINT32 texdata, int logit)
10601061{
1061   poly_draw_scanline callback;
1062   poly_draw_scanline_func callback;
10621063   poly_extra_data *extra;
10631064   poly_vertex clipvert[8];
10641065   poly_vertex vert[4];
src/mame/video/argus.c
r1877r1878
159159static UINT8* bomba_otherram;
160160
161161static int valtric_mosaic=0;
162static mame_bitmap *mosaicbitmap;
162static bitmap_t *mosaicbitmap;
163163
164164
165165/***************************************************************************
r1877r1878
11101110
11111111}
11121112
1113static void argus_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
1113static void argus_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority)
11141114{
11151115   int offs;
11161116
r1877r1878
11661166   }
11671167}
11681168
1169static void valtric_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
1169static void valtric_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
11701170{
11711171   int offs;
11721172
r1877r1878
12191219   }
12201220}
12211221
1222static void butasan_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
1222static void butasan_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
12231223{
12241224   int offs;
12251225
r1877r1878
14641464}
14651465#endif
14661466
1467static void bombsa_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
1467static void bombsa_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
14681468{
14691469   int offs;
14701470
src/mame/video/grchamp.c
r1877r1878
118118}
119119
120120#if 0
121static int collision_check(running_machine *machine, grchamp_state *state, mame_bitmap *bitmap, int which )
121static int collision_check(running_machine *machine, grchamp_state *state, bitmap_t *bitmap, int which )
122122{
123123   int bgcolor = machine->pens[0];
124124   int sprite_transp = machine->pens[0x24];
r1877r1878
170170   return result?(1<<which):0;
171171}
172172
173static void draw_fog(grchamp_state *state, mame_bitmap *bitmap, const rectangle *cliprect, int fog)
173static void draw_fog(grchamp_state *state, bitmap_t *bitmap, const rectangle *cliprect, int fog)
174174{
175175   int x,y,offs;
176176
r1877r1878
187187   }
188188}
189189
190static void draw_sprites(running_machine *machine, grchamp_state *state, mame_bitmap *bitmap, const rectangle *cliprect)
190static void draw_sprites(running_machine *machine, grchamp_state *state, bitmap_t *bitmap, const rectangle *cliprect)
191191{
192192   const gfx_element *gfx = machine->gfx[5];
193193   int bank = (state->cpu0_out[0] & 0x20) ? 0x40 : 0x00;
r1877r1878
373373   const UINT8 *amedata = memory_region(REGION_GFX5);
374374   const UINT8 *headdata = memory_region(REGION_GFX6);
375375   const UINT8 *pldata = memory_region(REGION_GFX7);
376   mame_bitmap *lpixmap = tilemap_get_pixmap(state->left_tilemap);
377   mame_bitmap *rpixmap = tilemap_get_pixmap(state->right_tilemap);
378   mame_bitmap *cpixmap = tilemap_get_pixmap(state->center_tilemap);
376   bitmap_t *lpixmap = tilemap_get_pixmap(state->left_tilemap);
377   bitmap_t *rpixmap = tilemap_get_pixmap(state->right_tilemap);
378   bitmap_t *cpixmap = tilemap_get_pixmap(state->center_tilemap);
379379   int lrxscroll, cxscroll, lyscroll, ryscroll, cyscroll;
380380   int bgcolor = state->cpu1_out[3] & 0x10;
381381   int amebase = state->cpu0_out[4] >> 4;
r1877r1878
401401   for (y = cliprect->min_y; y <= cliprect->max_y; y++)
402402   {
403403      /* select either left or right tilemaps based on Y */
404      mame_bitmap *lrpixmap = (y < 128) ? lpixmap : rpixmap;
404      bitmap_t *lrpixmap = (y < 128) ? lpixmap : rpixmap;
405405      int lryscroll = (y < 128) ? lyscroll : ryscroll;
406406
407407      /* get source/dest pointers */
src/mame/video/lkage.c
r1877r1878
9494} /* VIDEO_START( lkage ) */
9595
9696
97static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
97static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
9898{
9999   const UINT8 *source = spriteram;
100100   const UINT8 *finish = source+0x60;
src/mame/video/goodejan.c
r1877r1878
3333   SET_TILE_INFO(2, (tile & 0xfff) + 0x3000, color, 0);
3434}
3535
36static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int pri)
36static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int pri)
3737{
3838   int offs,fx,fy,x,y,color,sprite;
3939   int dx,dy,ax,ay;
src/mame/video/gaiden.c
r1877r1878
55***************************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
98
109UINT16 *gaiden_videoram,*gaiden_videoram2,*gaiden_videoram3;
1110int gaiden_sprite_sizey;
1211//int raiga_alpha;
1312
1413static tilemap *text_layer,*foreground,*background;
15static mame_bitmap *sprite_bitmap, *tile_bitmap_bg, *tile_bitmap_fg;
14static bitmap_t *sprite_bitmap, *tile_bitmap_bg, *tile_bitmap_fg;
1615
1716/***************************************************************************
1817
r1877r1878
219218   changes?) it appears that the sprite drawing is no longer putting the correct raw data
220219   in the bitmaps? */
221220static void blendbitmaps(running_machine *machine,
222      mame_bitmap *dest,mame_bitmap *src1,mame_bitmap *src2,mame_bitmap *src3,
221      bitmap_t *dest,bitmap_t *src1,bitmap_t *src2,bitmap_t *src3,
223222      int sx,int sy,const rectangle *cliprect)
224223{
225224   int y,x;
r1877r1878
276275
277276#define NUM_SPRITES 256
278277
279static void gaiden_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
278static void gaiden_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
280279{
281280   static const UINT8 layout[8][8] =
282281   {
r1877r1878
317316         int ypos = source[3] & 0x01ff;
318317         int xpos = source[4] & 0x01ff;
319318
320         if ((attributes & 0x20) && (cpu_getcurrentframe() & 1))
319         if ((attributes & 0x20) && (video_screen_get_frame_number(0) & 1))
321320            goto skip_sprite;
322321
323322         color = (color >> 4) & 0x0f;
r1877r1878
375374}
376375
377376
378static void raiga_draw_sprites(running_machine *machine, mame_bitmap *bitmap_bg, mame_bitmap *bitmap_fg, mame_bitmap *bitmap_sp, const rectangle *cliprect)
377static void raiga_draw_sprites(running_machine *machine, bitmap_t *bitmap_bg, bitmap_t *bitmap_fg, bitmap_t *bitmap_sp, const rectangle *cliprect)
379378{
380379   static const UINT8 layout[8][8] =
381380   {
r1877r1878
472471         }
473472         else
474473         {
475            mame_bitmap *bitmap = (priority >= 2) ? bitmap_bg : bitmap_fg;
474            bitmap_t *bitmap = (priority >= 2) ? bitmap_bg : bitmap_fg;
476475
477476            for (row = 0; row < sizey; row++)
478477            {
r1877r1878
516515 *         |---------x------- | x position (high bit)
517516 */
518517
519static void drgnbowl_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
518static void drgnbowl_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
520519{
521520   int i, code, color, x, y, flipx, flipy, priority_mask;
522521
src/mame/video/zaxxon.c
r1877r1878
124124 *
125125 *************************************/
126126
127static void video_start_common(running_machine *machine, tile_get_info_callback fg_tile_info)
127static void video_start_common(running_machine *machine, tile_get_info_func fg_tile_info)
128128{
129129   /* reset globals */
130130   bg_enable = 0;
r1877r1878
304304 *
305305 *************************************/
306306
307static void draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int skew)
307static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int skew)
308308{
309309   /* only draw if enabled */
310310   if (bg_enable)
311311   {
312      mame_bitmap *pixmap = tilemap_get_pixmap(bg_tilemap);
312      bitmap_t *pixmap = tilemap_get_pixmap(bg_tilemap);
313313      int colorbase = bg_color + (congo_color_bank << 8);
314314      int xmask = pixmap->width - 1;
315315      int ymask = pixmap->height - 1;
r1877r1878
420420}
421421
422422
423static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT16 flipxmask, UINT16 flipymask)
423static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16 flipxmask, UINT16 flipymask)
424424{
425425   int flipmask = flip_screen_get() ? 0xff : 0x00;
426426   int offs;
src/mame/video/shangkid.c
r1877r1878
5959   tilemap_mark_tile_dirty( background, offset&0x7ff );
6060}
6161
62static void draw_sprite(running_machine *machine, const UINT8 *source, mame_bitmap *bitmap, const rectangle *cliprect ){
62static void draw_sprite(running_machine *machine, const UINT8 *source, bitmap_t *bitmap, const rectangle *cliprect ){
6363   const gfx_element *gfx;
6464   int transparent_pen;
6565   int bank_index;
r1877r1878
152152   }
153153}
154154
155static void shangkid_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
155static void shangkid_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
156156{
157157   const UINT8 *source, *finish;
158158
r1877r1878
213213}
214214
215215
216static void dynamski_draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri )
216static void dynamski_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri )
217217{
218218   int i;
219219   int sx,sy;
r1877r1878
267267   }
268268}
269269
270static void dynamski_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
270static void dynamski_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
271271{
272272   int i;
273273   int sx,sy;
src/mame/video/trackfld.c
r1877r1878
188188   tilemap_set_scroll_rows(bg_tilemap, 32);
189189}
190190
191static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
191static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
192192{
193193   int offs;
194194
src/mame/video/fastfred.c
r1877r1878
1313
1414extern UINT8 galaxian_stars_on;
1515void galaxian_init_stars(running_machine *machine, int colors_offset);
16void galaxian_draw_stars(running_machine *machine, mame_bitmap *bitmap);
16void galaxian_draw_stars(running_machine *machine, bitmap_t *bitmap);
1717
1818UINT8 *fastfred_videoram;
1919UINT8 *fastfred_spriteram;
r1877r1878
249249 *
250250 *************************************/
251251
252static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
252static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
253253{
254254   int offs;
255255
src/mame/video/karnov.c
r1877r1878
77#include "driver.h"
88
99static UINT8 *dirty_f;
10static mame_bitmap *bitmap_f;
10static bitmap_t *bitmap_f;
1111UINT16 karnov_scroll[2], *karnov_pf_data;
1212static tilemap *fix_tilemap;
1313static int flipscreen;
r1877r1878
7878   tilemap_set_flip(ALL_TILEMAPS,flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
7979}
8080
81static void draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
81static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
8282{
8383   int my,mx,offs,color,tile,fx,fy;
8484   int scrollx=karnov_scroll[0];
r1877r1878
139139   copyscrollbitmap(bitmap,bitmap_f,1,&scrollx,1,&scrolly,cliprect);
140140}
141141
142static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
142static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
143143{
144144   int offs;
145145
src/mame/video/lwings.c
r1877r1878
183183   return sx || sy;
184184}
185185
186static void lwings_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
186static void lwings_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
187187{
188188   int offs;
189189
r1877r1878
220220   }
221221}
222222
223static void trojan_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
223static void trojan_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
224224{
225225   int offs;
226226
r1877r1878
289289
290290VIDEO_EOF( lwings )
291291{
292   buffer_spriteram_w(0,0);
292   buffer_spriteram_w(machine,0,0);
293293}
src/mame/video/punchout.c
r1877r1878
308308
309309
310310
311static void draw_big_sprite(mame_bitmap *bitmap, const rectangle *cliprect)
311static void draw_big_sprite(bitmap_t *bitmap, const rectangle *cliprect)
312312{
313313   int zoom;
314314
r1877r1878
349349}
350350
351351
352static void armwrest_draw_big_sprite(mame_bitmap *bitmap, const rectangle *cliprect)
352static void armwrest_draw_big_sprite(bitmap_t *bitmap, const rectangle *cliprect)
353353{
354354   int zoom;
355355
r1877r1878
394394   }
395395}
396396
397static void drawbs2(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
397static void drawbs2(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
398398{
399399   int sx,sy;
400400   int incxx;
src/mame/video/tecmo.c
r1877r1878
162162
163163***************************************************************************/
164164
165static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
165static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
166166{
167167   int offs;
168168   static const UINT8 layout[8][8] =
src/mame/video/segaybd.c
r1877r1878
1616 *
1717 *************************************/
1818
19static mame_bitmap *yboard_bitmap;
19static bitmap_t *yboard_bitmap;
2020
2121
2222
src/mame/video/galpanic.c
r1877r1878
55UINT16 *galpanic_bgvideoram,*galpanic_fgvideoram;
66size_t galpanic_fgvideoram_size;
77
8static mame_bitmap *sprites_bitmap;
8static bitmap_t *sprites_bitmap;
99
1010VIDEO_START( galpanic )
1111{
r1877r1878
4949}
5050
5151
52static void comad_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
52static void comad_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
5353{
5454   int offs;
5555   int sx=0, sy=0;
r1877r1878
8686   }
8787}
8888
89static void draw_fgbitmap(mame_bitmap *bitmap, const rectangle *cliprect)
89static void draw_fgbitmap(bitmap_t *bitmap, const rectangle *cliprect)
9090{
9191   int offs;
9292
src/mame/video/shuuz.c
r1877r1878
9090VIDEO_UPDATE( shuuz )
9191{
9292   struct atarimo_rect_list rectlist;
93   mame_bitmap *mobitmap;
93   bitmap_t *mobitmap;
9494   int x, y, r;
9595
9696   /* draw the playfield */
src/mame/video/cclimber.c
r1877r1878
495495}
496496
497497
498static void draw_playfield(mame_bitmap *bitmap, const rectangle *cliprect)
498static void draw_playfield(bitmap_t *bitmap, const rectangle *cliprect)
499499{
500500   int i;
501501
r1877r1878
509509}
510510
511511
512static void cclimber_draw_bigsprite(mame_bitmap *bitmap, const rectangle *cliprect)
512static void cclimber_draw_bigsprite(bitmap_t *bitmap, const rectangle *cliprect)
513513{
514514   UINT8 x = cclimber_bigsprite_control[3] - 8;
515515   UINT8 y = cclimber_bigsprite_control[2];
r1877r1878
534534}
535535
536536
537static void toprollr_draw_bigsprite(mame_bitmap *bitmap, const rectangle *cliprect)
537static void toprollr_draw_bigsprite(bitmap_t *bitmap, const rectangle *cliprect)
538538{
539539   UINT8 x = cclimber_bigsprite_control[3] - 8;
540540   UINT8 y = cclimber_bigsprite_control[2];
r1877r1878
550550}
551551
552552
553static void cclimber_draw_sprites(mame_bitmap *bitmap, gfx_element **gfx, const rectangle *cliprect)
553static void cclimber_draw_sprites(bitmap_t *bitmap, gfx_element **gfx, const rectangle *cliprect)
554554{
555555   int offs;
556556
r1877r1878
587587}
588588
589589
590static void swimmer_draw_sprites(mame_bitmap *bitmap, gfx_element **gfx, const rectangle *cliprect)
590static void swimmer_draw_sprites(bitmap_t *bitmap, gfx_element **gfx, const rectangle *cliprect)
591591{
592592   int offs;
593593
src/mame/video/xorworld.c
r1877r1878
9191      1  | xxxx---- -------- | sprite color
9292*/
9393
94static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
94static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
9595{
9696   int i;
9797
src/mame/video/speedspn.c
r1877r1878
5858}
5959
6060
61static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
61static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
6262{
6363   const gfx_element *gfx = machine->gfx[1];
6464   UINT8 *source = speedspn_vidram+ 0x1000;
src/mame/video/cloak.c
r1877r1878
184184   state_save_register_func_postload(set_current_bitmap_videoram_pointer);
185185}
186186
187static void draw_bitmap(mame_bitmap *bitmap, const rectangle *cliprect)
187static void draw_bitmap(bitmap_t *bitmap, const rectangle *cliprect)
188188{
189189   int x, y;
190190
r1877r1878
198198      }
199199}
200200
201static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
201static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
202202{
203203   int offs;
204204
src/mame/video/gticlub.c
r1877r1878
2121// defined in drivers/nwk-tr.c
2222int K001604_vh_start(running_machine *machine, int chip);
2323void K001604_tile_update(running_machine *machine, int chip);
24void K001604_draw_front_layer(int chip, mame_bitmap *bitmap, const rectangle *cliprect);
25void K001604_draw_back_layer(int chip, mame_bitmap *bitmap, const rectangle *cliprect);
24void K001604_draw_front_layer(int chip, bitmap_t *bitmap, const rectangle *cliprect);
25void K001604_draw_back_layer(int chip, bitmap_t *bitmap, const rectangle *cliprect);
2626
2727extern UINT8 gticlub_led_reg0;
2828extern UINT8 gticlub_led_reg1;
r1877r1878
155155static const int decode_y_zr107[16] = {  0, 8, 32, 40, 4, 12, 36, 44, 64, 72, 96, 104, 68, 76, 100, 108 };
156156
157157static UINT32 K001005_status = 0;
158static mame_bitmap *K001005_bitmap[2];
159static mame_bitmap *K001005_zbuffer;
158static bitmap_t *K001005_bitmap[2];
159static bitmap_t *K001005_zbuffer;
160160static rectangle K001005_cliprect;
161161
162162static void render_polygons(void);
r1877r1878
429429static void draw_scanline(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
430430{
431431   const poly_extra_data *extra = extradata;
432   mame_bitmap *destmap = dest;
432   bitmap_t *destmap = dest;
433433   float z = extent->param[0].start;
434434   float dz = extent->param[0].dpdx;
435435   UINT32 *fb = BITMAP_ADDR32(destmap, scanline, 0);
r1877r1878
457457static void draw_scanline_tex(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
458458{
459459   const poly_extra_data *extra = extradata;
460   mame_bitmap *destmap = dest;
460   bitmap_t *destmap = dest;
461461   UINT8 *texrom = memory_region(REGION_GFX1) + (extra->texture_page * 0x40000);
462462   int pal_chip = (extra->texture_palette & 0x8) ? 1 : 0;
463463   int palette_index = (extra->texture_palette & 0x7) * 256;
r1877r1878
911911   }
912912}
913913
914void K001005_draw(mame_bitmap *bitmap, const rectangle *cliprect)
914void K001005_draw(bitmap_t *bitmap, const rectangle *cliprect)
915915{
916916   int i, j;
917917
src/mame/video/namcona1.c
r1877r1878
220220{
221221   int i;
222222   gfx_element *gfx0,*gfx1;
223   static const tile_get_info_callback get_info[4] =
223   static const tile_get_info_func get_info[4] =
224224   { tilemap_get_info0, tilemap_get_info1, tilemap_get_info2, tilemap_get_info3 };
225225
226226   for( i=0; i<NAMCONA1_NUM_TILEMAPS; i++ )
r1877r1878
249249/*************************************************************************/
250250
251251static void pdraw_masked_tile(running_machine *machine,
252      mame_bitmap *bitmap,
252      bitmap_t *bitmap,
253253      const rectangle *cliprect,
254254      unsigned code,
255255      int color,
r1877r1878
387387} /* pdraw_masked_tile */
388388
389389static void pdraw_opaque_tile(running_machine *machine,
390      mame_bitmap *bitmap,
390      bitmap_t *bitmap,
391391      const rectangle *cliprect,
392392      unsigned code,
393393      int color,
r1877r1878
460460
461461static const UINT8 pri_mask[8] = { 0x00,0x01,0x03,0x07,0x0f,0x1f,0x3f,0x7f };
462462
463static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
463static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
464464{
465465   int which;
466466   const UINT16 *source = spriteram16;
467467   void (*drawtile)(running_machine *,
468      mame_bitmap *,
468      bitmap_t *,
469469      const rectangle *,
470470      unsigned code,
471471      int color,
r1877r1878
557557   } /* next x */
558558} /* draw_pixel_line */
559559
560static void draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int which, int primask )
560static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int which, int primask )
561561{
562562   /*          scrollx lineselect
563563     *  tmap0   ffe000  ffe200
src/mame/video/bsktball.c
r1877r1878
3333       8, 8, 32, 32);
3434}
3535
36static void draw_sprites(running_machine *machine,  mame_bitmap *bitmap, const rectangle *cliprect)
36static void draw_sprites(running_machine *machine,  bitmap_t *bitmap, const rectangle *cliprect)
3737{
3838   int motion;
3939
src/mame/video/armedf.c
r1877r1878
228228
229229***************************************************************************/
230230
231static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority )
231static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority )
232232{
233233   int offs;
234234
r1877r1878
351351
352352VIDEO_EOF( armedf )
353353{
354   buffer_spriteram16_w(0,0,0);
354   buffer_spriteram16_w(machine,0,0,0);
355355}
src/mame/video/gticlub.h
r1877r1878
1void K001005_draw(mame_bitmap *bitmap, const rectangle *cliprect);
1void K001005_draw(bitmap_t *bitmap, const rectangle *cliprect);
22void K001005_swap_buffers(void);
33void K001005_init(void);
44void K001005_preprocess_texture_data(UINT8 *rom, int length, int gticlub);
src/mame/video/dkong.c
r1877r1878
88***************************************************************************/
99
1010#include "driver.h"
11#include "deprecat.h"
1211#include "video/resnet.h"
1312#include "includes/dkong.h"
1413
r1877r1878
472471
473472WRITE8_HANDLER( dkong_videoram_w )
474473{
475   dkong_state *state = Machine->driver_data;
474   dkong_state *state = machine->driver_data;
476475
477476   if (state->video_ram[offset] != data)
478477   {
r1877r1878
483482
484483WRITE8_HANDLER( radarscp_snd02_w )
485484{
486   dkong_state *state = Machine->driver_data;
485   dkong_state *state = machine->driver_data;
487486
488487   state->snd02_enable = data & 0x01;
489488}
490489
491490WRITE8_HANDLER( radarsc1_ansn_w )
492491{
493   dkong_state *state = Machine->driver_data;
492   dkong_state *state = machine->driver_data;
494493
495494   state->sig_ansn = data & 0x01;
496495}
497496
498497WRITE8_HANDLER( dkongjr_gfxbank_w )
499498{
500   dkong_state *state = Machine->driver_data;
499   dkong_state *state = machine->driver_data;
501500
502501   if (state->gfx_bank != (data & 0x01))
503502   {
r1877r1878
508507
509508WRITE8_HANDLER( dkong3_gfxbank_w )
510509{
511   dkong_state *state = Machine->driver_data;
510   dkong_state *state = machine->driver_data;
512511
513512   if (state->gfx_bank != (~data & 0x01))
514513   {
r1877r1878
519518
520519WRITE8_HANDLER( dkong_palettebank_w )
521520{
522   dkong_state *state = Machine->driver_data;
521   dkong_state *state = machine->driver_data;
523522   int newbank;
524523
525524   newbank = state->palette_bank;
r1877r1878
538537
539538WRITE8_HANDLER( radarscp_grid_enable_w )
540539{
541   dkong_state *state = Machine->driver_data;
540   dkong_state *state = machine->driver_data;
542541
543542   state->grid_on = data & 0x01;
544543}
545544
546545WRITE8_HANDLER( radarscp_grid_color_w )
547546{
548   dkong_state *state = Machine->driver_data;
547   dkong_state *state = machine->driver_data;
549548
550549   state->grid_col = (data & 0x07) ^ 0x07;
551550   //popmessage("Gridcol: %d", state->grid_col);
r1877r1878
553552
554553WRITE8_HANDLER( dkong_flipscreen_w )
555554{
556   dkong_state *state = Machine->driver_data;
555   dkong_state *state = machine->driver_data;
557556
558557   state->flip = ~data & 0x01;
559558}
560559
561560WRITE8_HANDLER( dkong_spritebank_w )
562561{
563   dkong_state *state = Machine->driver_data;
562   dkong_state *state = machine->driver_data;
564563
565564   state->sprite_bank = data & 0x01;
566565}
567566
568567/***************************************************************************
569568
570  Draw the game screen in the given mame_bitmap.
569  Draw the game screen in the given bitmap_t.
571570
572571***************************************************************************/
573572
574static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT32 mask_bank, UINT32 shift_bits)
573static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT32 mask_bank, UINT32 shift_bits)
575574{
576575   dkong_state *state = machine->driver_data;
577576   int offs;
r1877r1878
699698   if (line_cnt>=512)
700699      line_cnt=512-VTOTAL;
701700
702   if ( ( !(line_cnt & 0x40) && ((line_cnt+1) & 0x40) ) && (mame_rand(Machine) > RAND_MAX/2))
701   if ( ( !(line_cnt & 0x40) && ((line_cnt+1) & 0x40) ) && (mame_rand(machine) > RAND_MAX/2))
703702      state->sig30Hz = (1-state->sig30Hz);
704703
705704   state->rflip_sig = state->snd02_enable & state->sig30Hz;
r1877r1878
762761
763762}
764763
765static void radarscp_draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
764static void radarscp_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
766765{
767766   dkong_state *state = machine->driver_data;
768767   const UINT8    *htable = NULL;
src/mame/video/sprint4.c
r1877r1878
99
1010static tilemap* playfield;
1111
12static mame_bitmap* helper;
12static bitmap_t* helper;
1313
1414int sprint4_collision[4];
1515
r1877r1878
136136
137137   /* update sound status */
138138
139   discrete_sound_w(SPRINT4_MOTOR_DATA_1, videoram[0x391] & 15);
140   discrete_sound_w(SPRINT4_MOTOR_DATA_2, videoram[0x393] & 15);
141   discrete_sound_w(SPRINT4_MOTOR_DATA_3, videoram[0x395] & 15);
142   discrete_sound_w(SPRINT4_MOTOR_DATA_4, videoram[0x397] & 15);
139   discrete_sound_w(machine, SPRINT4_MOTOR_DATA_1, videoram[0x391] & 15);
140   discrete_sound_w(machine, SPRINT4_MOTOR_DATA_2, videoram[0x393] & 15);
141   discrete_sound_w(machine, SPRINT4_MOTOR_DATA_3, videoram[0x395] & 15);
142   discrete_sound_w(machine, SPRINT4_MOTOR_DATA_4, videoram[0x397] & 15);
143143}
144144
145145
src/mame/video/appoooh.c
r1877r1878
180180WRITE8_HANDLER( appoooh_out_w )
181181{
182182   /* bit 0 controls NMI */
183   interrupt_enable_w(0,data & 0x01);
183   interrupt_enable_w(machine,0,data & 0x01);
184184
185185   /* bit 1 flip screen */
186186   flip_screen_set(data & 0x02);
r1877r1878
203203   /* bit 7 unknown (used) */
204204}
205205
206static void appoooh_draw_sprites(mame_bitmap *dest_bmp,
206static void appoooh_draw_sprites(bitmap_t *dest_bmp,
207207      const rectangle *cliprect,
208208        const gfx_element *gfx,
209209        UINT8 *sprite)
r1877r1878
236236    }
237237}
238238
239static void robowres_draw_sprites(mame_bitmap *dest_bmp,
239static void robowres_draw_sprites(bitmap_t *dest_bmp,
240240      const rectangle *cliprect,
241241        const gfx_element *gfx,
242242        UINT8 *sprite)
src/mame/video/skyraid.c
r1877r1878
1212UINT8* skyraid_pos_ram;
1313UINT8* skyraid_obj_ram;
1414
15static mame_bitmap *helper;
15static bitmap_t *helper;
1616
1717
1818VIDEO_START( skyraid )
r1877r1878
2121}
2222
2323
24static void draw_text(running_machine *machine, mame_bitmap* bitmap, const rectangle* cliprect)
24static void draw_text(running_machine *machine, bitmap_t* bitmap, const rectangle* cliprect)
2525{
2626   const UINT8* p = skyraid_alpha_num_ram;
2727
r1877r1878
4040}
4141
4242
43static void draw_terrain(mame_bitmap* bitmap, const rectangle *cliprect)
43static void draw_terrain(bitmap_t* bitmap, const rectangle *cliprect)
4444{
4545   const UINT8* p = memory_region(REGION_USER1);
4646
r1877r1878
7575}
7676
7777
78static void draw_sprites(running_machine *machine, mame_bitmap* bitmap, const rectangle* cliprect)
78static void draw_sprites(running_machine *machine, bitmap_t* bitmap, const rectangle* cliprect)
7979{
8080   int i;
8181
r1877r1878
9696}
9797
9898
99static void draw_missiles(running_machine *machine, mame_bitmap* bitmap, const rectangle* cliprect)
99static void draw_missiles(running_machine *machine, bitmap_t* bitmap, const rectangle* cliprect)
100100{
101101   int i;
102102
r1877r1878
118118}
119119
120120
121static void draw_trapezoid(mame_bitmap* dst, mame_bitmap* src)
121static void draw_trapezoid(bitmap_t* dst, bitmap_t* src)
122122{
123123   const UINT8* p = memory_region(REGION_USER2);
124124
src/mame/video/travrusa.c
r1877r1878
290290
291291***************************************************************************/
292292
293static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
293static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
294294{
295295   int offs;
296296   static const rectangle spritevisiblearea =
src/mame/video/psx.c
r1877r1878
272272#if defined( MAME_DEBUG )
273273
274274#define DEBUG_COORDS ( 10 )
275static mame_bitmap *debugmesh;
275static bitmap_t *debugmesh;
276276static int m_b_debugclear;
277277static int m_b_debugmesh;
278278static int m_n_debugskip;
r1877r1878
507507#endif
508508}
509509
510static int DebugMeshDisplay( mame_bitmap *bitmap, const rectangle *cliprect )
510static int DebugMeshDisplay( bitmap_t *bitmap, const rectangle *cliprect )
511511{
512512   if( m_b_debugmesh )
513513   {
r1877r1878
517517   return m_b_debugmesh;
518518}
519519
520static int DebugTextureDisplay( mame_bitmap *bitmap )
520static int DebugTextureDisplay( bitmap_t *bitmap )
521521{
522522   UINT32 n_y;
523523
r1877r1878
39153915
39163916void psx_gpu_reset( void )
39173917{
3918   psx_gpu_w( 1, 0, 0 );
3918   psx_gpu_w( Machine, 1, 0, 0 );
39193919}
39203920
39213921void psx_lightgun_set( int n_x, int n_y )
src/mame/video/metlclsh.c
r1877r1878
172172
173173***************************************************************************/
174174
175static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
175static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
176176{
177177   gfx_element *gfx = machine->gfx[0];
178178   int offs;
src/mame/video/beezer.c
r1877r1878
88INTERRUPT_GEN( beezer_interrupt )
99{
1010   scanline = (scanline + 1) % 0x80;
11   via_0_ca2_w (0, scanline & 0x10);
11   via_0_ca2_w (machine, 0, scanline & 0x10);
1212   if ((scanline & 0x78) == 0x78)
1313      cpunum_set_input_line(machine, 0, M6809_FIRQ_LINE, ASSERT_LINE);
1414   else
src/mame/video/vdc.c
r1877r1878
4747   pair   vce_address;         /* Current address in the palette */
4848   pair   vce_data[512];         /* Palette data */
4949   int      current_bitmap_line;   /* The current line in the display we are on */
50   mame_bitmap   *bmp;
50   bitmap_t   *bmp;
5151}VCE;
5252
5353typedef struct {
r1877r1878
7878static void pce_refresh_line(int which, int line, int external_input, UINT8 *drawn, UINT16 *line_buffer);
7979static void pce_refresh_sprites(running_machine *machine, int which, int line, UINT8 *drawn, UINT16 *line_buffer);
8080static void vdc_do_dma(int which);
81static void vpc_init( void );
81static void vpc_init( running_machine *machine );
8282
8383INTERRUPT_GEN( pce_interrupt )
8484{
r1877r1878
366366   vdc[0].inc = 1;
367367   vdc[1].inc = 1;
368368
369   vpc_init();
369   vpc_init(machine);
370370}
371371
372372
r1877r1878
10691069   return data;
10701070}
10711071
1072static void vpc_init( void ) {
1073   vpc_w( 0, 0x11 );
1074   vpc_w( 1, 0x11 );
1072static void vpc_init( running_machine *machine ) {
1073   vpc_w( machine, 0, 0x11 );
1074   vpc_w( machine, 1, 0x11 );
10751075   vpc.window1.w = 0;
10761076   vpc.window2.w = 0;
10771077   vpc.vdc_select = 0;
r1877r1878
10791079
10801080WRITE8_HANDLER( sgx_vdc_w ) {
10811081   if ( vpc.vdc_select ) {
1082      vdc_1_w( offset, data );
1082      vdc_1_w( machine, offset, data );
10831083   } else {
1084      vdc_0_w( offset, data );
1084      vdc_0_w( machine, offset, data );
10851085   }
10861086}
10871087
10881088READ8_HANDLER( sgx_vdc_r ) {
1089   return ( vpc.vdc_select ) ? vdc_1_r( offset ) : vdc_0_r( offset );
1089   return ( vpc.vdc_select ) ? vdc_1_r( machine, offset ) : vdc_0_r( machine, offset );
10901090}
10911091
src/mame/video/kaneko16.c
r1877r1878
5656
5757
5858UINT16 *kaneko16_bg15_select, *kaneko16_bg15_reg;
59static mame_bitmap *kaneko16_bg15_bitmap;
60static mame_bitmap *sprites_bitmap; /* bitmap used for to keep sprites on screen (mgcrystl 1st boss) */
59static bitmap_t *kaneko16_bg15_bitmap;
60static bitmap_t *sprites_bitmap; /* bitmap used for to keep sprites on screen (mgcrystl 1st boss) */
6161
6262struct tempsprite
6363{
r1877r1878
391391}
392392
393393// custom function to draw a single sprite. needed to keep correct sprites - sprites and sprites - tilemaps priorities
394static void kaneko16_draw_sprites_custom(running_machine *machine, mame_bitmap *dest_bmp,const gfx_element *gfx,
394static void kaneko16_draw_sprites_custom(running_machine *machine, bitmap_t *dest_bmp,const gfx_element *gfx,
395395      UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
396396      const rectangle *clip,int priority)
397397{
r1877r1878
491491
492492/* Build a list of sprites to display & draw them */
493493
494void kaneko16_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
494void kaneko16_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
495495{
496496   /* Sprites *must* be parsed from the first in RAM to the last,
497497       because of the multisprite feature. But they *must* be drawn
r1877r1878
802802
803803***************************************************************************/
804804
805static void kaneko16_prepare_first_tilemap_chip(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
805static void kaneko16_prepare_first_tilemap_chip(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
806806{
807807   /* Set Up FIRST Tilemap chip */
808808   int layers_flip_0;
r1877r1878
842842
843843}
844844
845static void kaneko16_prepare_second_tilemap_chip(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
845static void kaneko16_prepare_second_tilemap_chip(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
846846{
847847   /* Set Up SECOND Tilemap chip */
848848   int layers_flip_1 = 0;
r1877r1878
881881   }
882882}
883883
884static void kaneko16_render_first_tilemap_chip(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri)
884static void kaneko16_render_first_tilemap_chip(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri)
885885{
886886   tilemap_draw_primask(bitmap,cliprect, kaneko16_tmap_0, pri, pri, 0);
887887   tilemap_draw_primask(bitmap,cliprect, kaneko16_tmap_1, pri, pri, 0);
888888}
889889
890static void kaneko16_render_second_tilemap_chip(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri)
890static void kaneko16_render_second_tilemap_chip(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri)
891891{
892892   if (kaneko16_tmap_2)
893893   {
r1877r1878
896896   }
897897}
898898
899static void kaneko16_render_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
899static void kaneko16_render_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
900900{
901901   /* Sprites last (rendered with pdrawgfx, so they can slip
902902       in between the layers) */
r1877r1878
914914   }
915915}
916916
917static void kaneko16_render_15bpp_bitmap(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
917static void kaneko16_render_15bpp_bitmap(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
918918{
919919   if (kaneko16_bg15_bitmap)
920920   {
r1877r1878
934934   }
935935}
936936
937static void kaneko16_fill_bitmap(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
937static void kaneko16_fill_bitmap(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
938938{
939939   if(kaneko16_sprite_type == 1)
940940      fillbitmap(bitmap,0x7f00,cliprect);
src/mame/video/goldstar.c
r1877r1878
1414size_t goldstar_video_size;
1515UINT8 *goldstar_scroll1, *goldstar_scroll2, *goldstar_scroll3;
1616
17static mame_bitmap *tmpbitmap1, *tmpbitmap2, *tmpbitmap3, *tmpbitmap4;
17static bitmap_t *tmpbitmap1, *tmpbitmap2, *tmpbitmap3, *tmpbitmap4;
1818static int bgcolor;
1919
2020
src/mame/video/wc90.c
r1877r1878
172172   { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }
173173};
174174
175static void draw_sprite_16x16(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int code,
175static void draw_sprite_16x16(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int code,
176176                       int sx, int sy, int bank, int flags ) {
177177   WC90_DRAW_SPRITE( code, sx, sy );
178178}
179179
180static void draw_sprite_16x32(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int code,
180static void draw_sprite_16x32(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int code,
181181                       int sx, int sy, int bank, int flags ) {
182182   if ( bank & 2 ) {
183183      WC90_DRAW_SPRITE( code+1, sx, sy+16 );
r1877r1878
188188   }
189189}
190190
191static void draw_sprite_16x64(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int code,
191static void draw_sprite_16x64(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int code,
192192                       int sx, int sy, int bank, int flags ) {
193193   if ( bank & 2 ) {
194194      WC90_DRAW_SPRITE( code+3, sx, sy+48 );
r1877r1878
203203   }
204204}
205205
206static void draw_sprite_32x16(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int code,
206static void draw_sprite_32x16(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int code,
207207                       int sx, int sy, int bank, int flags ) {
208208   if ( bank & 1 ) {
209209      WC90_DRAW_SPRITE( code+1, sx+16, sy );
r1877r1878
214214   }
215215}
216216
217static void draw_sprite_32x32(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int code,
217static void draw_sprite_32x32(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int code,
218218                       int sx, int sy, int bank, int flags ) {
219219
220220   const char *p = p32x32[ bank&3 ];
r1877r1878
225225   WC90_DRAW_SPRITE( code+p[3], sx+16, sy+16 );
226226}
227227
228static void draw_sprite_32x64(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int code,
228static void draw_sprite_32x64(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int code,
229229                       int sx, int sy, int bank, int flags ) {
230230
231231   const char *p = p32x64[ bank&3 ];
r1877r1878
240240   WC90_DRAW_SPRITE( code+p[7], sx+16, sy+48 );
241241}
242242
243static void draw_sprite_64x16(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int code,
243static void draw_sprite_64x16(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int code,
244244                       int sx, int sy, int bank, int flags ) {
245245   if ( bank & 1 ) {
246246      WC90_DRAW_SPRITE( code+3, sx+48, sy );
r1877r1878
255255   }
256256}
257257
258static void draw_sprite_64x32(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int code,
258static void draw_sprite_64x32(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int code,
259259                       int sx, int sy, int bank, int flags ) {
260260
261261   const char *p = p64x32[ bank&3 ];
r1877r1878
270270   WC90_DRAW_SPRITE( code+p[7], sx+48, sy+16 );
271271}
272272
273static void draw_sprite_64x64(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int code,
273static void draw_sprite_64x64(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int code,
274274                       int sx, int sy, int bank, int flags ) {
275275
276276   const char *p = p64x64[ bank&3 ];
r1877r1878
294294   WC90_DRAW_SPRITE( code+p[15], sx+48, sy+48 );
295295}
296296
297static void draw_sprite_invalid(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int code,
297static void draw_sprite_invalid(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int code,
298298                                 int sx, int sy, int bank, int flags ) {
299299   logerror("8 pixel sprite size not supported\n" );
300300}
301301
302typedef void (*draw_sprites_procdef)(running_machine *, mame_bitmap *, const rectangle *, int, int, int, int, int );
302typedef void (*draw_sprites_func)(running_machine *, bitmap_t *, const rectangle *, int, int, int, int, int );
303303
304static const draw_sprites_procdef draw_sprites_proc[16] = {
304static const draw_sprites_func draw_sprites_proc[16] = {
305305   draw_sprite_invalid,   /* 0000 = 08x08 */
306306   draw_sprite_invalid,   /* 0001 = 16x08 */
307307   draw_sprite_invalid,   /* 0010 = 32x08 */
r1877r1878
320320   draw_sprite_64x64      /* 1111 = 64x64 */
321321};
322322
323static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority )
323static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority )
324324{
325325   int offs, sx,sy, flags, which;
326326
src/mame/video/gauntlet.c
r1877r1878
190190VIDEO_UPDATE( gauntlet )
191191{
192192   struct atarimo_rect_list rectlist;
193   mame_bitmap *mobitmap;
193   bitmap_t *mobitmap;
194194   int x, y, r;
195195
196196   /* draw the playfield */
src/mame/video/ms32.c
r1877r1878
239239
240240/* SPRITES based on tetrisp2 for now, readd priority bits later */
241241
242static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT32 *sprram_top, size_t sprram_size)
242static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT32 *sprram_top, size_t sprram_size)
243243{
244244/***************************************************************************
245245
r1877r1878
379379
380380
381381
382static void draw_roz(mame_bitmap *bitmap, const rectangle *cliprect,int priority)
382static void draw_roz(bitmap_t *bitmap, const rectangle *cliprect,int priority)
383383{
384384   /* TODO: registers 0x40/4 / 0x44/4 and 0x50/4 / 0x54/4 are used, meaning unknown */
385385
src/mame/video/darkseal.c
r1877r1878
164164
165165/******************************************************************************/
166166
167static void draw_sprites(running_machine* machine, mame_bitmap *bitmap, const rectangle *cliprect)
167static void draw_sprites(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect)
168168{
169169   int offs;
170170
r1877r1878
179179      x = buffered_spriteram16[offs+2];
180180
181181      flash=y&0x1000;
182      if (flash && (cpu_getcurrentframe() & 1)) continue;
182      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
183183
184184      colour = (x >> 9) &0x1f;
185185
r1877r1878
251251
252252WRITE16_HANDLER( darkseal_pf3b_data_w ) /* Mirror */
253253{
254   darkseal_pf3_data_w(offset+0x800,data,mem_mask);
254   darkseal_pf3_data_w(machine,offset+0x800,data,mem_mask);
255255}
256256
257257WRITE16_HANDLER( darkseal_control_0_w )
src/mame/video/20pacgal.c
r1877r1878
5656}
5757
5858
59 static void do_pen_lookup(const _20pacgal_state *state, mame_bitmap *bitmap, const rectangle *cliprect)
59 static void do_pen_lookup(const _20pacgal_state *state, bitmap_t *bitmap, const rectangle *cliprect)
6060{
6161   int y, x;
6262   pen_t pens[NUM_PENS];
r1877r1878
7676 *
7777 *************************************/
7878
79static void draw_sprite(const _20pacgal_state *state, mame_bitmap *bitmap, int y, int x,
79static void draw_sprite(const _20pacgal_state *state, bitmap_t *bitmap, int y, int x,
8080                  UINT8 code, UINT8 color, int flip_y, int flip_x)
8181{
8282   int sy;
r1877r1878
145145}
146146
147147
148static void draw_sprites(const _20pacgal_state *state, mame_bitmap *bitmap)
148static void draw_sprites(const _20pacgal_state *state, bitmap_t *bitmap)
149149{
150150   int offs;
151151
r1877r1878
197197 *
198198 *************************************/
199199
200static void draw_chars(const _20pacgal_state *state, mame_bitmap *bitmap)
200static void draw_chars(const _20pacgal_state *state, bitmap_t *bitmap)
201201{
202202   offs_t offs;
203203
src/mame/video/seicross.c
r1877r1878
9393   tilemap_set_scroll_cols(bg_tilemap, 32);
9494}
9595
96static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
96static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
9797{
9898   int offs;
9999
src/mame/video/spbactn.c
r1877r1878
44#include "driver.h"
55
66extern UINT16 *spbactn_bgvideoram, *spbactn_fgvideoram, *spbactn_spvideoram;
7static mame_bitmap *tile_bitmap_bg, *tile_bitmap_fg;
7static bitmap_t *tile_bitmap_bg, *tile_bitmap_fg;
88
99/* mix & blend the paletted 16-bit tile and sprite bitmaps into an RGB 32-bit bitmap */
1010static void blendbitmaps(running_machine *machine,
11      mame_bitmap *dest,mame_bitmap *src1,mame_bitmap *src2,
11      bitmap_t *dest,bitmap_t *src1,bitmap_t *src2,
1212      int sx,int sy,const rectangle *clip)
1313{
1414   int ox;
r1877r1878
103103}
104104
105105/* from gals pinball (which was in turn from ninja gaiden) */
106static int draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
106static int draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority)
107107{
108108   static const UINT8 layout[8][8] =
109109   {
src/mame/video/system16.c
r1877r1878
9494#include "video/resnet.h"
9595
9696/* video/segac2.c */
97extern void update_system18_vdp( mame_bitmap *bitmap, const rectangle *cliprect );
97extern void update_system18_vdp( bitmap_t *bitmap, const rectangle *cliprect );
9898extern void start_system18_vdp(void);
9999extern READ16_HANDLER( segac2_vdp_r );
100100extern WRITE16_HANDLER( segac2_vdp_w );
r1877r1878
198198*/
199199
200200static void draw_sprite(running_machine *machine,
201   mame_bitmap *bitmap,
201   bitmap_t *bitmap,
202202   const rectangle *cliprect,
203203   const UINT8 *addr, int pitch,
204204   pen_t pen_base,
r1877r1878
338338   }
339339}
340340
341static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int b3d ) //*
341static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int b3d ) //*
342342{
343343   pen_t pen_base = machine->gfx[0]->color_base;
344344   const UINT8 *base_gfx = memory_region(REGION_GFX2);
src/mame/video/atarimo.c
r1877r1878
2929   gfx_element   gfxelement[MAX_GFX_ELEMENTS]; /* local copy of graphics elements */
3030   int               gfxgranularity[MAX_GFX_ELEMENTS];
3131
32   mame_bitmap *bitmap;            /* temporary bitmap to render to */
32   bitmap_t          *bitmap;         /* temporary bitmap to render to */
3333
3434   int               linked;            /* are the entries linked? */
3535   int               split;            /* are entries split or together? */
r1877r1878
8484
8585   struct atarimo_mask specialmask;      /* mask for the special value */
8686   int               specialvalue;      /* resulting value to indicate "special" */
87   atarimo_special_cb   specialcb;         /* callback routine for special entries */
87   atarimo_special_func   specialcb;         /* callback routine for special entries */
8888   int               codehighshift;      /* shift count for the upper code */
8989
9090   struct atarimo_entry *spriteram;      /* pointer to sprite RAM */
r1877r1878
646646    destination bitmap.
647647---------------------------------------------------------------*/
648648
649mame_bitmap *atarimo_render(running_machine *machine, int map, const rectangle *cliprect, struct atarimo_rect_list *rectlist)
649bitmap_t *atarimo_render(running_machine *machine, int map, const rectangle *cliprect, struct atarimo_rect_list *rectlist)
650650{
651651   struct atarimo_data *mo = &atarimo[map];
652652   int startband, stopband, band, i;
r1877r1878
754754{
755755   int gfxindex = mo->gfxlookup[EXTRACT_DATA(entry, mo->gfxmask)];
756756   const gfx_element *gfx = &mo->gfxelement[gfxindex];
757   mame_bitmap *bitmap = mo->bitmap;
757   bitmap_t *bitmap = mo->bitmap;
758758   int x, y, sx, sy;
759759
760760   /* extract data from the various words */
src/mame/video/deniam.c
r1877r1878
202202 *   c  | ---------------- | zoomy like in System 16?
203203 *   e  | ---------------- |
204204 */
205static void draw_sprites(mame_bitmap *bitmap, const rectangle *cliprect)
205static void draw_sprites(bitmap_t *bitmap, const rectangle *cliprect)
206206{
207207   int offs;
208208
src/mame/video/atarimo.h
r1877r1878
3232##########################################################################*/
3333
3434/* callback for special processing */
35typedef int (*atarimo_special_cb)(mame_bitmap *bitmap, const rectangle *clip, int code, int color, int xpos, int ypos, rectangle *mobounds);
35typedef int (*atarimo_special_func)(bitmap_t *bitmap, const rectangle *clip, int code, int color, int xpos, int ypos, rectangle *mobounds);
3636
3737/* description for a four-word mask */
3838struct atarimo_entry
r1877r1878
7575
7676   struct atarimo_entry specialmask;      /* mask for the special value */
7777   UINT16         specialvalue;      /* resulting value to indicate "special" */
78   atarimo_special_cb   specialcb;         /* callback routine for special entries */
78   atarimo_special_func   specialcb;         /* callback routine for special entries */
7979};
8080
8181/* rectangle list */
r1877r1878
9797UINT8 *atarimo_get_gfx_lookup(int map, int *size);
9898
9999/* core processing */
100mame_bitmap *atarimo_render(running_machine *machine, int map, const rectangle *cliprect, struct atarimo_rect_list *rectlist);
100bitmap_t *atarimo_render(running_machine *machine, int map, const rectangle *cliprect, struct atarimo_rect_list *rectlist);
101101
102102/* atrribute setters */
103103void atarimo_set_bank(int map, int bank);
src/mame/video/mcr3.c
r1877r1878
189189 *
190190 *************************************/
191191
192static void mcr3_update_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int color_mask, int code_xor, int dx, int dy)
192static void mcr3_update_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int color_mask, int code_xor, int dx, int dy)
193193{
194194   int offs;
195195
src/mame/video/stadhero.c
r1877r1878
1010***************************************************************************/
1111
1212#include "driver.h"
13#include "deprecat.h"
1413
1514UINT16 *stadhero_pf1_data;
1615static UINT16 *stadhero_pf2_data;
r1877r1878
2120
2221/******************************************************************************/
2322
24static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int pri_mask,int pri_val)
23static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int pri_mask,int pri_val)
2524{
2625   int offs;
2726
r1877r1878
3736      if ((colour & pri_mask) != pri_val) continue;
3837
3938      flash=x&0x800;
40      if (flash && (cpu_getcurrentframe() & 1)) continue;
39      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
4140
4241      fx = y & 0x2000;
4342      fy = y & 0x4000;
src/mame/video/prehisle.c
r1877r1878
110110   state_save_register_global(invert_controls);
111111}
112112
113static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int foreground )
113static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int foreground )
114114{
115115   int offs;
116116
src/mame/video/simpsons.c
r1877r1878
5959
6060static READ8_HANDLER( simpsons_K052109_r )
6161{
62   return K052109_r(offset + 0x2000);
62   return K052109_r(machine,offset + 0x2000);
6363}
6464
6565static WRITE8_HANDLER( simpsons_K052109_w )
6666{
67   K052109_w(offset + 0x2000,data);
67   K052109_w(machine,offset + 0x2000,data);
6868}
6969
7070static READ8_HANDLER( simpsons_K053247_r )
src/mame/video/marvins.c
r1877r1878
230230**
231231***************************************************************************/
232232
233static void draw_status(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
233static void draw_status(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
234234{
235235   const UINT8 *base = videoram+0x400;
236236   const gfx_element *gfx = machine->gfx[0];
r1877r1878
261261   }
262262}
263263
264static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int scrollx, int scrolly,
264static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int scrollx, int scrolly,
265265      int priority, UINT8 sprite_partition )
266266{
267267   const gfx_element *gfx = machine->gfx[3];
r1877r1878
406406      if( scroll_attributes & 1 ) sprite_scrollx += 256;
407407      if( scroll_attributes & 2 ) fg_scrollx += 256;
408408
409      marvins_palette_bank_w(0, program_read_byte(0xc800+madcrash_vreg));
409      marvins_palette_bank_w(machine, 0, program_read_byte(0xc800+madcrash_vreg));
410410      update_palette(machine, 1);
411411
412412      if( flipscreen != (attributes&0x80) )
src/mame/video/wwfsstar.c
r1877r1878
106106 sprite colour marking could probably be improved..
107107*******************************************************************************/
108108
109static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
109static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
110110{
111111   /*- SPR RAM Format -**
112112
src/mame/video/polepos.c
r1877r1878
351351
352352***************************************************************************/
353353
354static void draw_road(mame_bitmap *bitmap)
354static void draw_road(bitmap_t *bitmap)
355355{
356356   const UINT8 *road_control = memory_region(REGION_GFX5);
357357   const UINT8 *road_bits1 = memory_region(REGION_GFX5) + 0x2000;
r1877r1878
426426   }
427427}
428428
429static void zoom_sprite(running_machine *machine, mame_bitmap *bitmap,int big,
429static void zoom_sprite(running_machine *machine, bitmap_t *bitmap,int big,
430430      UINT32 code,UINT32 color,int flipx,int sx,int sy,
431431      int sizex,int sizey)
432432{
r1877r1878
477477   }
478478}
479479
480static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
480static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
481481{
482482   UINT16 *posmem = &polepos_sprite16_memory[0x380];
483483   UINT16 *sizmem = &polepos_sprite16_memory[0x780];
src/mame/video/model1.c
r1877r1878
11#include "driver.h"
2#include "deprecat.h"
32#include "video/segaic24.h"
43
54#define LOG_TGP_VIDEO 0
r1877r1878
142141}
143142
144143
145static void draw_hline(mame_bitmap *bitmap, int x1, int x2, int y, int color)
144static void draw_hline(bitmap_t *bitmap, int x1, int x2, int y, int color)
146145{
147146   UINT16 *base = BITMAP_ADDR16(bitmap, y, 0);
148147   while(x1 <= x2) {
r1877r1878
151150   }
152151}
153152
154static void draw_hline_moired(mame_bitmap *bitmap, int x1, int x2, int y, int color)
153static void draw_hline_moired(bitmap_t *bitmap, int x1, int x2, int y, int color)
155154{
156155   UINT16 *base = BITMAP_ADDR16(bitmap, y, 0);
157156   while(x1 <= x2) {
r1877r1878
161160   }
162161}
163162
164static void fill_slope(mame_bitmap *bitmap, int color, INT32 x1, INT32 x2, INT32 sl1, INT32 sl2, INT32 y1, INT32 y2, INT32 *nx1, INT32 *nx2)
163static void fill_slope(bitmap_t *bitmap, int color, INT32 x1, INT32 x2, INT32 sl1, INT32 sl2, INT32 y1, INT32 y2, INT32 *nx1, INT32 *nx2)
165164{
166165   if(y1 > view.y2)
167166      return;
r1877r1878
221220   *nx2 = x2;
222221}
223222
224static void fill_line(mame_bitmap *bitmap, int color, INT32 y, INT32 x1, INT32 x2)
223static void fill_line(bitmap_t *bitmap, int color, INT32 y, INT32 x1, INT32 x2)
225224{
226225   int xx1 = x1>>FRAC_SHIFT;
227226   int xx2 = x2>>FRAC_SHIFT;
r1877r1878
242241   }
243242}
244243
245static void fill_quad(mame_bitmap *bitmap, const struct quad *q)
244static void fill_quad(bitmap_t *bitmap, const struct quad *q)
246245{
247246   INT32 sl1, sl2, cury, limy, x1, x2;
248247   int pmin, pmax, i, ps1, ps2;
r1877r1878
343342      fill_line(bitmap, color, cury, x1, x2);
344343}
345344#if 0
346static void draw_line(mame_bitmap *bitmap, int color, int x1, int y1, int x2, int y2)
345static void draw_line(bitmap_t *bitmap, int color, int x1, int y1, int x2, int y2)
347346{
348347   int s1x, s1y, s2x, s2y;
349348   int d1, d2;
r1877r1878
440439}
441440
442441
443static void draw_quads(mame_bitmap *bitmap, const rectangle *cliprect)
442static void draw_quads(bitmap_t *bitmap, const rectangle *cliprect)
444443{
445444   int count = quadpt - quaddb;
446445   int i;
r1877r1878
694693   return m;
695694}
696695
696#ifdef UNUSED_DEFINITION
697697static const UINT8 num_of_times[]={1,1,1,1,2,2,2,3};
698#endif
698699static float compute_specular(struct vector *normal, struct vector *light,float diffuse,int lmode)
699700{
700701#if 0
r1877r1878
11081109   return list+2;
11091110}
11101111
1111static void draw_objects(mame_bitmap *bitmap, const rectangle *cliprect)
1112static void draw_objects(bitmap_t *bitmap, const rectangle *cliprect)
11121113{
11131114   if(quadpt != quaddb) {
11141115      LOG_TGP(("VIDEO: sort&draw\n"));
r1877r1878
11201121   pointpt = pointdb;
11211122}
11221123
1123static UINT16 *draw_direct(UINT16 *list, mame_bitmap *bitmap, const rectangle *cliprect)
1124static UINT16 *draw_direct(UINT16 *list, bitmap_t *bitmap, const rectangle *cliprect)
11241125{
11251126   UINT16 *res;
11261127
r1877r1878
11521153
11531154static void end_frame(void)
11541155{
1155   if((listctl[0] & 4) && (cpu_getcurrentframe() & 1))
1156   if((listctl[0] & 4) && (video_screen_get_frame_number(0) & 1))
11561157      listctl[0] ^= 0x40;
11571158}
11581159
r1877r1878
11701171   LOG_TGP(("VIDEO: control=%08x\n", (listctl[1]<<16)|listctl[0]));
11711172}
11721173
1173static void tgp_render(mame_bitmap *bitmap, const rectangle *cliprect)
1174static void tgp_render(bitmap_t *bitmap, const rectangle *cliprect)
11741175{
11751176   render_done = 1;
11761177   if((listctl[1] & 0x1f) == 0x1f) {
src/mame/video/actfancr.c
r1877r1878
55*******************************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
98
109
1110static UINT8 actfancr_control_1[0x20],actfancr_control_2[0x20];
r1877r1878
175174      x = buffered_spriteram[offs+4]+(buffered_spriteram[offs+5]<<8);
176175      colour = ((x & 0xf000) >> 12);
177176      flash=x&0x800;
178      if (flash && (cpu_getcurrentframe() & 1)) continue;
177      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
179178
180179      fx = y & 0x2000;
181180      fy = y & 0x4000;
r1877r1878
260259      x = buffered_spriteram[offs+4]+(buffered_spriteram[offs+5]<<8);
261260      colour = ((x & 0xf000) >> 12);
262261      flash=x&0x800;
263      if (flash && (cpu_getcurrentframe() & 1)) continue;
262      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
264263
265264      fx = y & 0x2000;
266265      fy = y & 0x4000;
src/mame/video/taito_b.c
r1877r1878
1010static UINT16 bg_rambank[2],fg_rambank[2],tx_rambank;
1111
1212/* framebuffer is a raw bitmap, remapped as a last step */
13static mame_bitmap *framebuffer[2],*pixel_bitmap;
13static bitmap_t *framebuffer[2],*pixel_bitmap;
1414
1515static UINT16 pixel_scroll[2];
1616
r1877r1878
157157   COMBINE_DATA(&pixel_scroll[offset]);
158158}
159159
160static void hitice_clear_pixel_bitmap(void)
160static void hitice_clear_pixel_bitmap(running_machine *machine)
161161{
162162   int i;
163163
164164    for (i = 0;i < 0x40000;i++)
165      hitice_pixelram_w(i,0,0);
165      hitice_pixelram_w(machine,i,0,0);
166166}
167167
168168static TILE_GET_INFO( get_bg_tile_info )
r1877r1878
285285VIDEO_RESET( hitice )
286286{
287287   /* kludge: clear the bitmap on startup */
288   hitice_clear_pixel_bitmap();
288   hitice_clear_pixel_bitmap(machine);
289289}
290290
291291
r1877r1878
327327}
328328
329329
330static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
330static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
331331{
332332/*  Sprite format: (16 bytes per sprite)
333333  offs:             bits:
r1877r1878
450450}
451451
452452
453static void TC0180VCU_tilemap_draw(mame_bitmap *bitmap,const rectangle *cliprect,tilemap *tmap,int plane)
453static void TC0180VCU_tilemap_draw(bitmap_t *bitmap,const rectangle *cliprect,tilemap *tmap,int plane)
454454{
455455/*plane = 0 fg tilemap*/
456456/*plane = 1 bg tilemap*/
r1877r1878
491491}
492492
493493
494static void draw_framebuffer(mame_bitmap *bitmap,const rectangle *cliprect,int priority)
494static void draw_framebuffer(bitmap_t *bitmap,const rectangle *cliprect,int priority)
495495{
496496  rectangle myclip = *cliprect;
497497  int x,y;
src/mame/video/jackal.c
r1877r1878
8585   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
8686}
8787
88static void draw_background( mame_bitmap *bitmap, const rectangle *cliprect )
88static void draw_background( bitmap_t *bitmap, const rectangle *cliprect )
8989{
9090   UINT8 *RAM = memory_region(REGION_CPU1);
9191   int i;
r1877r1878
124124
125125#define DRAW_SPRITE(bank, code, sx, sy) drawgfx(bitmap, machine->gfx[bank], code, color, flipx, flipy, sx, sy, cliprect, TRANSPARENCY_PEN, 0);
126126
127static void draw_sprites_region(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, const UINT8 *sram, int length, int bank )
127static void draw_sprites_region(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT8 *sram, int length, int bank )
128128{
129129   int offs;
130130
r1877r1878
206206   }
207207}
208208
209static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
209static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
210210{
211211   UINT8 *RAM = memory_region(REGION_CPU1);
212212   UINT8 *sr, *ss;
src/mame/video/tank8.c
r1877r1878
55***************************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
9#include "includes/tank8.h"
8#include "tank8.h"
109
1110
1211UINT8 *tank8_video_ram;
r1877r1878
1716
1817static tilemap *tank8_tilemap;
1918
20static mame_bitmap *helper1;
21static mame_bitmap *helper2;
22static mame_bitmap *helper3;
19static bitmap_t *helper1;
20static bitmap_t *helper2;
21static bitmap_t *helper3;
2322
2423
2524
r1877r1878
140139}
141140
142141
143static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
142static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
144143{
145144   int i;
146145
r1877r1878
163162}
164163
165164
166static void draw_bullets(mame_bitmap *bitmap, const rectangle *cliprect)
165static void draw_bullets(bitmap_t *bitmap, const rectangle *cliprect)
167166{
168167   int i;
169168
r1877r1878
235234      const UINT16* p2 = BITMAP_ADDR16(helper2, y, 0);
236235      const UINT16* p3 = BITMAP_ADDR16(helper3, y, 0);
237236
238      if (y % 2 != cpu_getcurrentframe() % 2)
237      if (y % 2 != video_screen_get_frame_number(0) % 2)
239238         continue; /* video display is interlaced */
240239
241240      for (x = clip->min_x; x <= clip->max_x; x++)
src/mame/video/taitoic.c
r1877r1878
542542/* These scanline drawing routines lifted from Taito F3: optimise / merge ? */
543543
544544INLINE void taitoic_drawscanline(
545      mame_bitmap *bitmap,int x,int y,
545      bitmap_t *bitmap,int x,int y,
546546      const UINT16 *src,int transparent,UINT32 orient,int pri, const rectangle *cliprect)
547547{
548548   UINT16 *dsti = BITMAP_ADDR16(bitmap, y, x);
r1877r1878
578578/* Note: various assumptions are made in these routines, typically that
579579   only CPU#0 is of interest. If in doubt, check the routine. */
580580
581static int has_write_handler(int cpunum, write16_handler handler)
581static int has_write_handler(int cpunum, write16_machine_func handler)
582582{
583583   const address_map *map;
584584   for (map = memory_get_map(cpunum, ADDRESS_SPACE_PROGRAM); map && !IS_AMENTRY_END(map); map++)
r1877r1878
755755   common_get_PC080SN_fg_tile_info(machine,tileinfo,tile_index,PC080SN_bg_ram[1][1],PC080SN_bg_gfx[1]);
756756}
757757
758static const tile_get_info_callback PC080SN_get_tile_info[PC080SN_MAX_CHIPS][2] =
758static const tile_get_info_func PC080SN_get_tile_info[PC080SN_MAX_CHIPS][2] =
759759{
760760   { PC080SN_get_bg_tile_info_0, PC080SN_get_fg_tile_info_0 },
761761   { PC080SN_get_bg_tile_info_1, PC080SN_get_fg_tile_info_1 }
r1877r1878
10691069}
10701070
10711071
1072static void topspeed_custom_draw(mame_bitmap *bitmap,const rectangle *cliprect,int chip,int layer,int flags,
1072static void topspeed_custom_draw(bitmap_t *bitmap,const rectangle *cliprect,int chip,int layer,int flags,
10731073                     UINT32 priority,UINT16 *color_ctrl_ram)
10741074{
10751075   UINT16 *dst16,*src16;
10761076   UINT8 *tsrc;
10771077   UINT16 scanline[1024];   /* won't be called by a wide-screen game, but just in case... */
10781078
1079   mame_bitmap *srcbitmap = tilemap_get_pixmap(PC080SN_tilemap[chip][layer]);
1080   mame_bitmap *flagsbitmap = tilemap_get_flagsmap(PC080SN_tilemap[chip][layer]);
1079   bitmap_t *srcbitmap = tilemap_get_pixmap(PC080SN_tilemap[chip][layer]);
1080   bitmap_t *flagsbitmap = tilemap_get_flagsmap(PC080SN_tilemap[chip][layer]);
10811081
10821082   UINT16 a,color;
10831083   int sx,x_index;
r1877r1878
11601160}
11611161
11621162
1163void PC080SN_tilemap_draw(mame_bitmap *bitmap,const rectangle *cliprect,int chip,int layer,int flags,UINT32 priority)
1163void PC080SN_tilemap_draw(bitmap_t *bitmap,const rectangle *cliprect,int chip,int layer,int flags,UINT32 priority)
11641164{
11651165   tilemap_draw(bitmap,cliprect,PC080SN_tilemap[chip][layer],flags,priority);
11661166}
11671167
1168void PC080SN_tilemap_draw_offset(mame_bitmap *bitmap,const rectangle *cliprect,int chip,int layer,int flags,UINT32 priority,int xoffs,int yoffs)
1168void PC080SN_tilemap_draw_offset(bitmap_t *bitmap,const rectangle *cliprect,int chip,int layer,int flags,UINT32 priority,int xoffs,int yoffs)
11691169{
11701170   int basedx = -16 - PC080SN_xoffs;
11711171   int basedxflip = -16 + PC080SN_xoffs;
r1877r1878
11791179   tilemap_set_scrolldy(PC080SN_tilemap[chip][layer], basedy, basedyflip);
11801180}
11811181
1182void PC080SN_tilemap_draw_special(mame_bitmap *bitmap,const rectangle *cliprect,int chip,int layer,int flags,UINT32 priority,UINT16 *ram)
1182void PC080SN_tilemap_draw_special(bitmap_t *bitmap,const rectangle *cliprect,int chip,int layer,int flags,UINT32 priority,UINT16 *ram)
11831183{
11841184   topspeed_custom_draw(bitmap,cliprect,chip,layer,flags,priority,ram);
11851185}
r1877r1878
12761276}
12771277
12781278
1279void PC090OJ_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect,int pri_type)
1279void PC090OJ_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect,int pri_type)
12801280{
12811281   int offs,priority=0;
12821282   int sprite_colbank = (PC090OJ_sprite_ctrl & 0xf) << 4;   /* top nibble */
r1877r1878
16951695   else if (offset < 0x20800/2)   /* sprite ram */
16961696   {}
16971697   else if (offset < 0x20fff/2)
1698      TC0080VCO_scrollram_w(offset-(0x20800/2),TC0080VCO_ram[offset],mem_mask);
1698      TC0080VCO_scrollram_w(machine,offset-(0x20800/2),TC0080VCO_ram[offset],mem_mask);
16991699}
17001700
17011701
r1877r1878
17601760
17611761/* NB: orientation_flipx code in following routine has not been tested */
17621762
1763static void TC0080VCO_bg0_tilemap_draw(mame_bitmap *bitmap,const rectangle *cliprect,int flags,UINT32 priority)
1763static void TC0080VCO_bg0_tilemap_draw(bitmap_t *bitmap,const rectangle *cliprect,int flags,UINT32 priority)
17641764{
17651765   UINT16 zoom = TC0080VCO_scroll_ram[6];
17661766   int zx, zy;
r1877r1878
17771777      UINT16 *dst16,*src16;
17781778      UINT8 *tsrc;
17791779      UINT16 scanline[512];
1780      mame_bitmap *srcbitmap = tilemap_get_pixmap(TC0080VCO_tilemap[0]);
1781      mame_bitmap *flagsbitmap = tilemap_get_flagsmap(TC0080VCO_tilemap[0]);
1780      bitmap_t *srcbitmap = tilemap_get_pixmap(TC0080VCO_tilemap[0]);
1781      bitmap_t *flagsbitmap = tilemap_get_flagsmap(TC0080VCO_tilemap[0]);
17821782
17831783      int sx,zoomx,zoomy;
17841784      int dx,ex,dy,ey;
r1877r1878
19141914}
19151915
19161916
1917static void TC0080VCO_bg1_tilemap_draw(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int flags,UINT32 priority)
1917static void TC0080VCO_bg1_tilemap_draw(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int flags,UINT32 priority)
19181918{
19191919   UINT8 layer=1;
19201920   UINT16 zoom = TC0080VCO_scroll_ram[6+layer];
r1877r1878
19371937      int sx,sy;
19381938
19391939      /* shouldn't we set no_clip before doing this (see TC0480SCP) ? */
1940      mame_bitmap *srcbitmap = tilemap_get_pixmap(TC0080VCO_tilemap[layer]);
1940      bitmap_t *srcbitmap = tilemap_get_pixmap(TC0080VCO_tilemap[layer]);
19411941
19421942      if (zoomx < 63)
19431943      {
r1877r1878
19901990}
19911991
19921992
1993void TC0080VCO_tilemap_draw(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int layer,int flags,UINT32 priority)
1993void TC0080VCO_tilemap_draw(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int layer,int flags,UINT32 priority)
19941994{
19951995   int disable = 0x00;   /* possibly layer disable bits do exist ?? */
19961996
r1877r1878
21652165
21662166/* This array changes with TC0100SCN_MAX_CHIPS */
21672167
2168static const tile_get_info_callback TC0100SCN_get_tile_info[TC0100SCN_MAX_CHIPS][3] =
2168static const tile_get_info_func TC0100SCN_get_tile_info[TC0100SCN_MAX_CHIPS][3] =
21692169{
21702170   { TC0100SCN_get_bg_tile_info_0, TC0100SCN_get_fg_tile_info_0, TC0100SCN_get_tx_tile_info_0 },
21712171   { TC0100SCN_get_bg_tile_info_1, TC0100SCN_get_fg_tile_info_1, TC0100SCN_get_tx_tile_info_1 },
r1877r1878
24922492
24932493WRITE16_HANDLER( TC0100SCN_dual_screen_w )
24942494{
2495   TC0100SCN_word_0_w(offset,data,mem_mask);
2496   TC0100SCN_word_1_w(offset,data,mem_mask);
2495   TC0100SCN_word_0_w(machine,offset,data,mem_mask);
2496   TC0100SCN_word_1_w(machine,offset,data,mem_mask);
24972497}
24982498
24992499WRITE16_HANDLER( TC0100SCN_triple_screen_w )
25002500{
2501   TC0100SCN_word_0_w(offset,data,mem_mask);
2502   TC0100SCN_word_1_w(offset,data,mem_mask);
2503   TC0100SCN_word_2_w(offset,data,mem_mask);
2501   TC0100SCN_word_0_w(machine,offset,data,mem_mask);
2502   TC0100SCN_word_1_w(machine,offset,data,mem_mask);
2503   TC0100SCN_word_2_w(machine,offset,data,mem_mask);
25042504}
25052505
25062506
r1877r1878
26052605
26062606READ32_HANDLER( TC0100SCN_ctrl_long_r )
26072607{
2608   return (TC0100SCN_ctrl_word_0_r(offset*2,0)<<16)|TC0100SCN_ctrl_word_0_r(offset*2+1,0);
2608   return (TC0100SCN_ctrl_word_0_r(machine,offset*2,0)<<16)|TC0100SCN_ctrl_word_0_r(machine,offset*2+1,0);
26092609}
26102610
26112611WRITE32_HANDLER( TC0100SCN_ctrl_long_w )
r1877r1878
26162616
26172617READ32_HANDLER( TC0100SCN_long_r )
26182618{
2619   return (TC0100SCN_word_0_r(offset*2,0)<<16)|TC0100SCN_word_0_r(offset*2+1,0);
2619   return (TC0100SCN_word_0_r(machine,offset*2,0)<<16)|TC0100SCN_word_0_r(machine,offset*2+1,0);
26202620}
26212621
26222622WRITE32_HANDLER( TC0100SCN_long_w )
26232623{
26242624   if (((mem_mask & 0xff000000) == 0) || ((mem_mask & 0x00ff0000) == 0))
26252625   {
2626      int oldword = TC0100SCN_word_0_r(offset*2,0);
2626      int oldword = TC0100SCN_word_0_r(machine,offset*2,0);
26272627      int newword = data>>16;
26282628      if ((mem_mask & 0x00ff0000) != 0)
26292629         newword |= (oldword &0x00ff);
26302630      if ((mem_mask & 0xff000000) != 0)
26312631         newword |= (oldword &0xff00);
2632      TC0100SCN_word_0_w(offset*2,newword,0);
2632      TC0100SCN_word_0_w(machine,offset*2,newword,0);
26332633   }
26342634   if (((mem_mask & 0x0000ff00) == 0) || ((mem_mask & 0x000000ff) == 0))
26352635   {
2636      int oldword = TC0100SCN_word_0_r((offset*2)+1,0);
2636      int oldword = TC0100SCN_word_0_r(machine,(offset*2)+1,0);
26372637      int newword = data&0xffff;
26382638      if ((mem_mask & 0x000000ff) != 0)
26392639         newword |= (oldword &0x00ff);
26402640      if ((mem_mask & 0x0000ff00) != 0)
26412641         newword |= (oldword &0xff00);
2642      TC0100SCN_word_0_w((offset*2)+1,newword,0);
2642      TC0100SCN_word_0_w(machine,(offset*2)+1,newword,0);
26432643   }
26442644}
26452645
r1877r1878
26872687   }
26882688}
26892689
2690static void TC0100SCN_tilemap_draw_fg(mame_bitmap *bitmap,const rectangle *cliprect, int chip, tilemap* tmap ,int flags, UINT32 priority)
2690static void TC0100SCN_tilemap_draw_fg(bitmap_t *bitmap,const rectangle *cliprect, int chip, tilemap* tmap ,int flags, UINT32 priority)
26912691{
2692   const mame_bitmap *src_bitmap = tilemap_get_pixmap(tmap);
2692   const bitmap_t *src_bitmap = tilemap_get_pixmap(tmap);
26932693   int width_mask, height_mask, x, y, p;
26942694   int column_offset, src_x=0, src_y=0;
26952695   int scrollx_delta = - tilemap_get_scrolldx( tmap );
r1877r1878
27302730   }
27312731}
27322732
2733int TC0100SCN_tilemap_draw(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int chip,int layer,int flags,UINT32 priority)
2733int TC0100SCN_tilemap_draw(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int chip,int layer,int flags,UINT32 priority)
27342734{
27352735   int disable = TC0100SCN_ctrl[chip][6] & 0xf7;
27362736   rectangle clip = *cliprect;
r1877r1878
28102810
28112811READ16_HANDLER( TC0430GRW_word_r )
28122812{
2813   return TC0280GRD_word_r(offset,mem_mask);
2813   return TC0280GRD_word_r(machine,offset,mem_mask);
28142814}
28152815
28162816WRITE16_HANDLER( TC0280GRD_word_w )
r1877r1878
28212821
28222822WRITE16_HANDLER( TC0430GRW_word_w )
28232823{
2824   TC0280GRD_word_w(offset,data,mem_mask);
2824   TC0280GRD_word_w(machine,offset,data,mem_mask);
28252825}
28262826
28272827WRITE16_HANDLER( TC0280GRD_ctrl_word_w )
r1877r1878
28312831
28322832WRITE16_HANDLER( TC0430GRW_ctrl_word_w )
28332833{
2834   TC0280GRD_ctrl_word_w(offset,data,mem_mask);
2834   TC0280GRD_ctrl_word_w(machine,offset,data,mem_mask);
28352835}
28362836
28372837void TC0280GRD_tilemap_update(int base_color)
r1877r1878
28482848   TC0280GRD_tilemap_update(base_color);
28492849}
28502850
2851static void zoom_draw(mame_bitmap *bitmap,const rectangle *cliprect,int xoffset,int yoffset,UINT32 priority,int xmultiply)
2851static void zoom_draw(bitmap_t *bitmap,const rectangle *cliprect,int xoffset,int yoffset,UINT32 priority,int xmultiply)
28522852{
28532853   UINT32 startx,starty;
28542854   int incxx,incxy,incyx,incyy;
r1877r1878
28752875         0,priority);
28762876}
28772877
2878void TC0280GRD_zoom_draw(mame_bitmap *bitmap,const rectangle *cliprect,int xoffset,int yoffset,UINT32 priority)
2878void TC0280GRD_zoom_draw(bitmap_t *bitmap,const rectangle *cliprect,int xoffset,int yoffset,UINT32 priority)
28792879{
28802880   zoom_draw(bitmap,cliprect,xoffset,yoffset,priority,2);
28812881}
28822882
2883void TC0430GRW_zoom_draw(mame_bitmap *bitmap,const rectangle *cliprect,int xoffset,int yoffset,UINT32 priority)
2883void TC0430GRW_zoom_draw(bitmap_t *bitmap,const rectangle *cliprect,int xoffset,int yoffset,UINT32 priority)
28842884{
28852885   zoom_draw(bitmap,cliprect,xoffset,yoffset,priority,1);
28862886}
r1877r1878
29142914{
29152915   if (ACCESSING_LSB)
29162916   {
2917      TC0360PRI_w(offset,data & 0xff);
2917      TC0360PRI_w(machine,offset,data & 0xff);
29182918#if 0
29192919if (data & 0xff00)
29202920{ logerror("CPU #0 PC %06x: warning - write %02x to MSB of TC0360PRI address %02x\n",activecpu_get_pc(),data,offset); }
r1877r1878
29282928{
29292929   if (ACCESSING_MSB)
29302930   {
2931      TC0360PRI_w(offset,(data >> 8) & 0xff);
2931      TC0360PRI_w(machine,offset,(data >> 8) & 0xff);
29322932#if 0
29332933if (data & 0xff)
29342934{ logerror("CPU #0 PC %06x: warning - write %02x to LSB of TC0360PRI address %02x\n",activecpu_get_pc(),data,offset); }
r1877r1878
30133013   common_get_tc0480tx_tile_info(machine,tileinfo,tile_index,TC0480SCP_tx_ram,TC0480SCP_tx_gfx);
30143014}
30153015
3016static const tile_get_info_callback tc480_get_tile_info[5] =
3016static const tile_get_info_func tc480_get_tile_info[5] =
30173017{
30183018   TC0480SCP_get_bg0_tile_info, TC0480SCP_get_bg1_tile_info,
30193019   TC0480SCP_get_bg2_tile_info, TC0480SCP_get_bg3_tile_info,
r1877r1878
32703270
32713271READ32_HANDLER( TC0480SCP_ctrl_long_r )
32723272{
3273   return (TC0480SCP_ctrl_word_r(offset*2,0)<<16)|TC0480SCP_ctrl_word_r(offset*2+1,0);
3273   return (TC0480SCP_ctrl_word_r(machine,offset*2,0)<<16)|TC0480SCP_ctrl_word_r(machine,offset*2+1,0);
32743274}
32753275
32763276/* TODO: byte access ? */
32773277
32783278WRITE32_HANDLER( TC0480SCP_ctrl_long_w )
32793279{
3280   if (ACCESSING_MSW32) TC0480SCP_ctrl_word_w(offset*2,data>>16,mem_mask>>16);
3281   if (ACCESSING_LSW32) TC0480SCP_ctrl_word_w((offset*2)+1,data&0xffff,mem_mask&0xffff);
3280   if (ACCESSING_MSW32) TC0480SCP_ctrl_word_w(machine,offset*2,data>>16,mem_mask>>16);
3281   if (ACCESSING_LSW32) TC0480SCP_ctrl_word_w(machine,(offset*2)+1,data&0xffff,mem_mask&0xffff);
32823282}
32833283
32843284READ32_HANDLER( TC0480SCP_long_r )
32853285{
3286   return (TC0480SCP_word_r(offset*2,0)<<16)|TC0480SCP_word_r(offset*2+1,0);
3286   return (TC0480SCP_word_r(machine,offset*2,0)<<16)|TC0480SCP_word_r(machine,offset*2+1,0);
32873287}
32883288
32893289WRITE32_HANDLER( TC0480SCP_long_w )
32903290{
32913291   if (((mem_mask & 0xff000000) == 0) || ((mem_mask & 0x00ff0000) == 0))
32923292   {
3293      int oldword = TC0480SCP_word_r(offset*2,0);
3293      int oldword = TC0480SCP_word_r(machine,offset*2,0);
32943294      int newword = data>>16;
32953295      if ((mem_mask & 0x00ff0000) != 0)
32963296         newword |= (oldword &0x00ff);
32973297      if ((mem_mask & 0xff000000) != 0)
32983298         newword |= (oldword &0xff00);
3299      TC0480SCP_word_w(offset*2,newword,0);
3299      TC0480SCP_word_w(machine,offset*2,newword,0);
33003300   }
33013301   if (((mem_mask & 0x0000ff00) == 0) || ((mem_mask & 0x000000ff) == 0))
33023302   {
3303      int oldword = TC0480SCP_word_r((offset*2)+1,0);
3303      int oldword = TC0480SCP_word_r(machine,(offset*2)+1,0);
33043304      int newword = data&0xffff;
33053305      if ((mem_mask & 0x000000ff) != 0)
33063306         newword |= (oldword &0x00ff);
33073307      if ((mem_mask & 0x0000ff00) != 0)
33083308         newword |= (oldword &0xff00);
3309      TC0480SCP_word_w((offset*2)+1,newword,0);
3309      TC0480SCP_word_w(machine,(offset*2)+1,newword,0);
33103310   }
33113311}
33123312
r1877r1878
35913591
35923592**********************************************************************/
35933593
3594static void TC0480SCP_bg01_draw(mame_bitmap *bitmap,const rectangle *cliprect,int layer,int flags,UINT32 priority)
3594static void TC0480SCP_bg01_draw(bitmap_t *bitmap,const rectangle *cliprect,int layer,int flags,UINT32 priority)
35953595{
35963596   /* X-axis zoom offers expansion only: 0 = no zoom, 0xff = max
35973597       Y-axis zoom offers expansion/compression: 0x7f = no zoom, 0xff = max
r1877r1878
36113611      UINT8 *tsrc;
36123612      UINT16 scanline[512];
36133613      UINT32 sx;
3614      mame_bitmap *srcbitmap = tilemap_get_pixmap(TC0480SCP_tilemap[layer][TC0480SCP_dblwidth]);
3615      mame_bitmap *flagsbitmap = tilemap_get_flagsmap
3614      bitmap_t *srcbitmap = tilemap_get_pixmap(TC0480SCP_tilemap[layer][TC0480SCP_dblwidth]);
3615      bitmap_t *flagsbitmap = tilemap_get_flagsmap
36163616                     (TC0480SCP_tilemap[layer][TC0480SCP_dblwidth]);
36173617      int flip = TC0480SCP_pri_reg & 0x40;
36183618      int i,y,y_index,src_y_index,row_index;
r1877r1878
37423742
37433743****************************************************************/
37443744
3745static void TC0480SCP_bg23_draw(mame_bitmap *bitmap,const rectangle *cliprect,int layer,int flags,UINT32 priority)
3745static void TC0480SCP_bg23_draw(bitmap_t *bitmap,const rectangle *cliprect,int layer,int flags,UINT32 priority)
37463746{
3747   mame_bitmap *srcbitmap = tilemap_get_pixmap(TC0480SCP_tilemap[layer][TC0480SCP_dblwidth]);
3748   mame_bitmap *flagsbitmap = tilemap_get_flagsmap
3747   bitmap_t *srcbitmap = tilemap_get_pixmap(TC0480SCP_tilemap[layer][TC0480SCP_dblwidth]);
3748   bitmap_t *flagsbitmap = tilemap_get_flagsmap
37493749                  (TC0480SCP_tilemap[layer][TC0480SCP_dblwidth]);
37503750
37513751   UINT16 *dst16,*src16;
3752   UINT16 *tsrc;
3752   UINT8 *tsrc;
37533753   int i,y,y_index,src_y_index,row_index,row_zoom;
37543754   int sx,x_index,x_step;
37553755   UINT32 zoomx,zoomy;
r1877r1878
38313831      }
38323832
38333833      src16 = BITMAP_ADDR16(srcbitmap, src_y_index, 0);
3834      tsrc  = BITMAP_ADDR16(flagsbitmap, src_y_index, 0);
3834      tsrc  = BITMAP_ADDR8(flagsbitmap, src_y_index, 0);
38353835      dst16 = scanline;
38363836
38373837      if (flags & TILEMAP_DRAW_OPAQUE)
r1877r1878
38683868
38693869
38703870
3871void TC0480SCP_tilemap_draw(mame_bitmap *bitmap,const rectangle *cliprect,int layer,int flags,UINT32 priority)
3871void TC0480SCP_tilemap_draw(bitmap_t *bitmap,const rectangle *cliprect,int layer,int flags,UINT32 priority)
38723872{
38733873   /* no layer disable bits */
38743874
r1877r1878
41004100
41014101******************************************************************************/
41024102
4103void TC0150ROD_draw(mame_bitmap *bitmap,const rectangle *cliprect,int y_offs,int palette_offs,int type,int road_trans,UINT32 low_priority,UINT32 high_priority)
4103void TC0150ROD_draw(bitmap_t *bitmap,const rectangle *cliprect,int y_offs,int palette_offs,int type,int road_trans,UINT32 low_priority,UINT32 high_priority)
41044104{
41054105#ifdef MAME_DEBUG
41064106   static int dislayer[6];   /* Road Layer toggles to help get road correct */
r1877r1878
49404940   switch (offset)
49414941   {
49424942      case 0x00:   /* IN00-07 (DSA) */
4943         return input_port_0_r(0);
4943         return input_port_0_r(machine,0);
49444944
49454945      case 0x01:   /* IN08-15 (DSB) */
4946         return input_port_1_r(0);
4946         return input_port_1_r(machine,0);
49474947
49484948      case 0x02:   /* IN16-23 (1P) */
4949         return input_port_2_r(0);
4949         return input_port_2_r(machine,0);
49504950
49514951      case 0x03:   /* IN24-31 (2P) */
4952         return input_port_3_r(0);
4952         return input_port_3_r(machine,0);
49534953
49544954      case 0x04:   /* coin counters and lockout */
49554955         return TC0220IOC_regs[4];
49564956
49574957      case 0x07:   /* INB0-7 (coin) */
4958         return input_port_4_r(0);
4958         return input_port_4_r(machine,0);
49594959
49604960      default:
49614961logerror("PC %06x: warning - read TC0220IOC address %02x\n",activecpu_get_pc(),offset);
r1877r1878
49704970   switch (offset)
49714971   {
49724972      case 0x00:
4973         watchdog_reset_w(offset,data);
4973         watchdog_reset(machine);
49744974         break;
49754975
49764976      case 0x04:   /* coin counters and lockout, hi nibble irrelevant */
r1877r1878
50025002
50035003READ8_HANDLER( TC0220IOC_portreg_r )
50045004{
5005   return TC0220IOC_r(TC0220IOC_port);
5005   return TC0220IOC_r(machine, TC0220IOC_port);
50065006}
50075007
50085008WRITE8_HANDLER( TC0220IOC_portreg_w )
50095009{
5010   TC0220IOC_w(TC0220IOC_port, data);
5010   TC0220IOC_w(machine, TC0220IOC_port, data);
50115011}
50125012
50135013READ16_HANDLER( TC0220IOC_halfword_port_r )
50145014{
5015   return TC0220IOC_port_r( offset );
5015   return TC0220IOC_port_r( machine, offset );
50165016}
50175017
50185018WRITE16_HANDLER( TC0220IOC_halfword_port_w )
50195019{
50205020   if (ACCESSING_LSB)
5021      TC0220IOC_port_w( offset, data & 0xff );
5021      TC0220IOC_port_w( machine, offset, data & 0xff );
50225022}
50235023
50245024READ16_HANDLER( TC0220IOC_halfword_portreg_r )
50255025{
5026   return TC0220IOC_portreg_r( offset );
5026   return TC0220IOC_portreg_r( machine, offset );
50275027}
50285028
50295029WRITE16_HANDLER( TC0220IOC_halfword_portreg_w )
50305030{
50315031   if (ACCESSING_LSB)
5032      TC0220IOC_portreg_w( offset, data & 0xff );
5032      TC0220IOC_portreg_w( machine, offset, data & 0xff );
50335033}
50345034
50355035READ16_HANDLER( TC0220IOC_halfword_byteswap_port_r )
50365036{
5037   return TC0220IOC_port_r( offset ) << 8;
5037   return TC0220IOC_port_r( machine, offset ) << 8;
50385038}
50395039
50405040WRITE16_HANDLER( TC0220IOC_halfword_byteswap_port_w )
50415041{
50425042   if (ACCESSING_MSB)
5043      TC0220IOC_port_w( offset, (data>>8) & 0xff );
5043      TC0220IOC_port_w( machine, offset, (data>>8) & 0xff );
50445044}
50455045
50465046READ16_HANDLER( TC0220IOC_halfword_byteswap_portreg_r )
50475047{
5048   return TC0220IOC_portreg_r( offset )<<8;
5048   return TC0220IOC_portreg_r( machine, offset )<<8;
50495049}
50505050
50515051WRITE16_HANDLER( TC0220IOC_halfword_byteswap_portreg_w )
50525052{
50535053   if (ACCESSING_MSB)
5054      TC0220IOC_portreg_w( offset, (data>>8) & 0xff );
5054      TC0220IOC_portreg_w( machine, offset, (data>>8) & 0xff );
50555055}
50565056
50575057READ16_HANDLER( TC0220IOC_halfword_r )
50585058{
5059   return TC0220IOC_r(offset);
5059   return TC0220IOC_r(machine,offset);
50605060}
50615061
50625062WRITE16_HANDLER( TC0220IOC_halfword_w )
50635063{
50645064   if (ACCESSING_LSB)
5065      TC0220IOC_w(offset,data & 0xff);
5065      TC0220IOC_w(machine,offset,data & 0xff);
50665066   else
50675067   {
50685068      /* qtorimon writes here the coin counters - bug? */
5069      TC0220IOC_w(offset,(data >> 8) & 0xff);
5069      TC0220IOC_w(machine,offset,(data >> 8) & 0xff);
50705070
50715071      if (offset)      /* ainferno writes watchdog in msb */
50725072logerror("CPU #0 PC %06x: warning - write to MSB of TC0220IOC address %02x\n",activecpu_get_pc(),offset);
r1877r1878
50755075
50765076READ16_HANDLER( TC0220IOC_halfword_byteswap_r )
50775077{
5078   return TC0220IOC_halfword_r(offset,mem_mask) << 8;
5078   return TC0220IOC_halfword_r(machine,offset,mem_mask) << 8;
50795079}
50805080
50815081WRITE16_HANDLER( TC0220IOC_halfword_byteswap_w )
50825082{
50835083   if (ACCESSING_MSB)
5084      TC0220IOC_w(offset,(data >> 8) & 0xff);
5084      TC0220IOC_w(machine,offset,(data >> 8) & 0xff);
50855085   else
50865086   {
5087      TC0220IOC_w(offset,data & 0xff);
5087      TC0220IOC_w(machine,offset,data & 0xff);
50885088
50895089logerror("CPU #0 PC %06x: warning - write to LSB of TC0220IOC address %02x\n",activecpu_get_pc(),offset);
50905090   }
r1877r1878
51015101   switch (offset)
51025102   {
51035103      case 0x00:   /* DSA */
5104         return input_port_0_r(0);
5104         return input_port_0_r(machine,0);
51055105
51065106      case 0x01:   /* DSB */
5107         return input_port_1_r(0);
5107         return input_port_1_r(machine,0);
51085108
51095109      case 0x02:   /* 1P */
5110         return input_port_2_r(0);
5110         return input_port_2_r(machine,0);
51115111
51125112      case 0x03:   /* 2P */
5113         return input_port_3_r(0);
5113         return input_port_3_r(machine,0);
51145114
51155115      case 0x04:   /* coin counters and lockout */
51165116         return TC0510NIO_regs[4];
51175117
51185118      case 0x07:   /* coin */
5119         return input_port_4_r(0);
5119         return input_port_4_r(machine,0);
51205120
51215121      default:
51225122logerror("PC %06x: warning - read TC0510NIO address %02x\n",activecpu_get_pc(),offset);
r1877r1878
51315131   switch (offset)
51325132   {
51335133      case 0x00:
5134         watchdog_reset_w(offset,data);
5134         watchdog_reset(machine);
51355135         break;
51365136
51375137      case 0x04:   /* coin counters and lockout */
r1877r1878
51495149
51505150READ16_HANDLER( TC0510NIO_halfword_r )
51515151{
5152   return TC0510NIO_r(offset);
5152   return TC0510NIO_r(machine,offset);
51535153}
51545154
51555155WRITE16_HANDLER( TC0510NIO_halfword_w )
51565156{
51575157   if (ACCESSING_LSB)
5158      TC0510NIO_w(offset,data & 0xff);
5158      TC0510NIO_w(machine,offset,data & 0xff);
51595159   else
51605160   {
51615161      /* driftout writes the coin counters here - bug? */
51625162logerror("CPU #0 PC %06x: warning - write to MSB of TC0510NIO address %02x\n",activecpu_get_pc(),offset);
5163      TC0510NIO_w(offset,(data >> 8) & 0xff);
5163      TC0510NIO_w(machine,offset,(data >> 8) & 0xff);
51645164   }
51655165}
51665166
51675167READ16_HANDLER( TC0510NIO_halfword_wordswap_r )
51685168{
5169   return TC0510NIO_halfword_r(offset ^ 1,mem_mask);
5169   return TC0510NIO_halfword_r(machine,offset ^ 1,mem_mask);
51705170}
51715171
51725172WRITE16_HANDLER( TC0510NIO_halfword_wordswap_w )
51735173{
5174   TC0510NIO_halfword_w(offset ^ 1,data,mem_mask);
5174   TC0510NIO_halfword_w(machine,offset ^ 1,data,mem_mask);
51755175}
51765176
51775177
r1877r1878
51845184   switch (offset)
51855185   {
51865186      case 0x00:   /* DSA */
5187         return input_port_0_r(0);
5187         return input_port_0_r(machine,0);
51885188
51895189      case 0x01:   /* DSB */
5190         return input_port_1_r(0);
5190         return input_port_1_r(machine,0);
51915191
51925192      case 0x02:   /* 1P */
5193         return input_port_2_r(0);
5193         return input_port_2_r(machine,0);
51945194
51955195      case 0x03:   /* 2P */
5196         return input_port_3_r(0);
5196         return input_port_3_r(machine,0);
51975197
51985198      case 0x04:   /* coin counters and lockout */
51995199         return TC0640FIO_regs[4];
52005200
52015201      case 0x07:   /* coin */
5202         return input_port_4_r(0);
5202         return input_port_4_r(machine,0);
52035203
52045204      default:
52055205logerror("PC %06x: warning - read TC0640FIO address %02x\n",activecpu_get_pc(),offset);
r1877r1878
52145214   switch (offset)
52155215   {
52165216      case 0x00:
5217         watchdog_reset_w(offset,data);
5217         watchdog_reset(machine);
52185218         break;
52195219
52205220      case 0x04:   /* coin counters and lockout */
r1877r1878
52325232
52335233READ16_HANDLER( TC0640FIO_halfword_r )
52345234{
5235   return TC0640FIO_r(offset);
5235   return TC0640FIO_r(machine,offset);
52365236}
52375237
52385238WRITE16_HANDLER( TC0640FIO_halfword_w )
52395239{
52405240   if (ACCESSING_LSB)
5241      TC0640FIO_w(offset,data & 0xff);
5241      TC0640FIO_w(machine,offset,data & 0xff);
52425242   else
52435243   {
5244      TC0640FIO_w(offset,(data >> 8) & 0xff);
5244      TC0640FIO_w(machine,offset,(data >> 8) & 0xff);
52455245logerror("CPU #0 PC %06x: warning - write to MSB of TC0640FIO address %02x\n",activecpu_get_pc(),offset);
52465246   }
52475247}
52485248
52495249READ16_HANDLER( TC0640FIO_halfword_byteswap_r )
52505250{
5251   return TC0640FIO_halfword_r(offset,mem_mask) << 8;
5251   return TC0640FIO_halfword_r(machine,offset,mem_mask) << 8;
52525252}
52535253
52545254WRITE16_HANDLER( TC0640FIO_halfword_byteswap_w )
52555255{
52565256   if (ACCESSING_MSB)
5257      TC0640FIO_w(offset,(data >> 8) & 0xff);
5257      TC0640FIO_w(machine,offset,(data >> 8) & 0xff);
52585258   else
52595259   {
5260      TC0640FIO_w(offset,data & 0xff);
5260      TC0640FIO_w(machine,offset,data & 0xff);
52615261logerror("CPU #0 PC %06x: warning - write to LSB of TC0640FIO address %02x\n",activecpu_get_pc(),offset);
52625262   }
52635263}
src/mame/video/namcos86.c
r1877r1878
26226215   xxxxxxxx  Y position
263263*/
264264
265static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
265static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
266266{
267267   const UINT8 *source = &spriteram[0x0800-0x20];   /* the last is NOT a sprite */
268268   const UINT8 *finish = &spriteram[0];
src/mame/video/suna8.c
r1877r1878
203203
204204***************************************************************************/
205205
206static void draw_normal_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
206static void draw_normal_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
207207{
208208   int i;
209209   int mx = 0;   // multisprite x counter
r1877r1878
334334   }
335335}
336336
337static void draw_text_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
337static void draw_text_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
338338{
339339   int i;
340340
src/mame/video/vaportra.c
r1877r1878
7878
7979/******************************************************************************/
8080
81static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri)
81static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri)
8282{
8383   int offs,priority_value;
8484
r1877r1878
9898      if (!pri && !(colour>=priority_value)) continue;
9999
100100      flash=x&0x800;
101      if (flash && (cpu_getcurrentframe() & 1)) continue;
101      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
102102
103103      fx = y & 0x2000;
104104      fy = y & 0x4000;
src/mame/video/btime.c
r1877r1878
2626static UINT8 btime_palette = 0;
2727static UINT8 bnj_scroll1 = 0;
2828static UINT8 bnj_scroll2 = 0;
29static mame_bitmap *background_bitmap;
29static bitmap_t *background_bitmap;
3030static UINT8 lnc_sound_interrupt_enabled = 0;
3131
3232/***************************************************************************
r1877r1878
156156WRITE8_HANDLER( btime_paletteram_w )
157157{
158158    /* RGB output is inverted */
159    paletteram_BBGGGRRR_w(offset,~data);
159    paletteram_BBGGGRRR_w(machine,offset,~data);
160160}
161161
162162WRITE8_HANDLER( lnc_videoram_w )
r1877r1878
210210    y = offset % 32;
211211    offset = 32 * y + x;
212212
213    lnc_videoram_w(offset,data);
213    lnc_videoram_w(machine,offset,data);
214214}
215215
216216WRITE8_HANDLER( btime_mirrorcolorram_w )
r1877r1878
289289    /* For now we just check 0x40 in DSW1, and ignore the write if we */
290290    /* are in upright controls mode. */
291291
292    if (input_port_3_r(0) & 0x40) /* cocktail mode */
293        btime_video_control_w(offset, data);
292    if (input_port_3_r(machine, 0) & 0x40) /* cocktail mode */
293        btime_video_control_w(machine, offset, data);
294294}
295295
296296WRITE8_HANDLER( lnc_video_control_w )
r1877r1878
299299    // figure out how NMI's are disabled by the sound processor
300300    lnc_sound_interrupt_enabled = data & 0x08;
301301
302    bnj_video_control_w(offset, data & 0x01);
302    bnj_video_control_w(machine, offset, data & 0x01);
303303}
304304
305305WRITE8_HANDLER( disco_video_control_w )
306306{
307307   btime_palette = (data >> 2) & 0x03;
308308
309   if (!(input_port_3_r(0) & 0x40)) /* cocktail mode */
309   if (!(input_port_3_r(machine,0) & 0x40)) /* cocktail mode */
310310   {
311311      flip_screen_set(data & 0x01);
312312   }
r1877r1878
320320}
321321
322322
323static void draw_chars(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT8 transparency, UINT8 color, int priority)
323static void draw_chars(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8 transparency, UINT8 color, int priority)
324324{
325325    offs_t offs;
326326
r1877r1878
349349    }
350350}
351351
352static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT8 color,
352static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8 color,
353353                         UINT8 sprite_y_adjust, UINT8 sprite_y_adjust_flip_screen,
354354                         UINT8 *sprite_ram, offs_t interleave)
355355{
r1877r1878
401401}
402402
403403
404static void draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT8* tmap, UINT8 color)
404static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8* tmap, UINT8 color)
405405{
406406    int i;
407407
src/mame/video/taitoic.h
r1877r1878
3131void PC080SN_set_scroll(int chip,int tilemap_num,int scrollx,int scrolly);
3232void PC080SN_set_trans_pen(int chip,int tilemap_num,int pen);
3333void PC080SN_tilemap_update(void);
34void PC080SN_tilemap_draw(mame_bitmap *bitmap,const rectangle *cliprect,int chip,int layer,int flags,UINT32 priority);
35void PC080SN_tilemap_draw_offset(mame_bitmap *bitmap,const rectangle *cliprect,int chip,int layer,int flags,UINT32 priority,int xoffs,int yoffs);
34void PC080SN_tilemap_draw(bitmap_t *bitmap,const rectangle *cliprect,int chip,int layer,int flags,UINT32 priority);
35void PC080SN_tilemap_draw_offset(bitmap_t *bitmap,const rectangle *cliprect,int chip,int layer,int flags,UINT32 priority,int xoffs,int yoffs);
3636
3737/* For Topspeed */
38void PC080SN_tilemap_draw_special(mame_bitmap *bitmap,const rectangle *cliprect,int chip,int layer,int flags,UINT32 priority,UINT16 *ram);
38void PC080SN_tilemap_draw_special(bitmap_t *bitmap,const rectangle *cliprect,int chip,int layer,int flags,UINT32 priority,UINT16 *ram);
3939
4040
4141/***************************************************************************/
r1877r1878
4646WRITE16_HANDLER( PC090OJ_word_0_w );
4747
4848void PC090OJ_eof_callback(void);
49void PC090OJ_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect,int pri_type);
49void PC090OJ_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect,int pri_type);
5050
5151extern UINT16 PC090OJ_sprite_ctrl;
5252
r1877r1878
5959WRITE16_HANDLER( TC0080VCO_word_w );
6060
6161void TC0080VCO_tilemap_update(running_machine *machine);
62void TC0080VCO_tilemap_draw(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int layer,int flags,UINT32 priority);
62void TC0080VCO_tilemap_draw(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int layer,int flags,UINT32 priority);
6363
6464
6565/***************************************************************************/
r1877r1878
108108WRITE16_HANDLER( TC0100SCN_triple_screen_w );
109109
110110void TC0100SCN_tilemap_update(running_machine *machine);
111int TC0100SCN_tilemap_draw(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int chip,int layer,int flags,UINT32 priority);
111int TC0100SCN_tilemap_draw(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int chip,int layer,int flags,UINT32 priority);
112112
113113/* returns 0 or 1 depending on the lowest priority tilemap set in the internal
114114   register. Use this function to draw tilemaps in the correct order. */
r1877r1878
122122WRITE16_HANDLER( TC0280GRD_word_w );
123123WRITE16_HANDLER( TC0280GRD_ctrl_word_w );
124124void TC0280GRD_tilemap_update(int base_color);
125void TC0280GRD_zoom_draw(mame_bitmap *bitmap,const rectangle *cliprect,int xoffset,int yoffset,UINT32 priority);
125void TC0280GRD_zoom_draw(bitmap_t *bitmap,const rectangle *cliprect,int xoffset,int yoffset,UINT32 priority);
126126
127127void TC0430GRW_vh_start(int gfxnum);
128128READ16_HANDLER ( TC0430GRW_word_r );
129129WRITE16_HANDLER( TC0430GRW_word_w );
130130WRITE16_HANDLER( TC0430GRW_ctrl_word_w );
131131void TC0430GRW_tilemap_update(int base_color);
132void TC0430GRW_zoom_draw(mame_bitmap *bitmap,const rectangle *cliprect,int xoffset,int yoffset,UINT32 priority);
132void TC0430GRW_zoom_draw(bitmap_t *bitmap,const rectangle *cliprect,int xoffset,int yoffset,UINT32 priority);
133133
134134
135135/***************************************************************************/
r1877r1878
151151WRITE32_HANDLER( TC0480SCP_ctrl_long_w );
152152
153153void TC0480SCP_tilemap_update(running_machine *machine);
154void TC0480SCP_tilemap_draw(mame_bitmap *bitmap,const rectangle *cliprect,int layer,int flags,UINT32 priority);
154void TC0480SCP_tilemap_draw(bitmap_t *bitmap,const rectangle *cliprect,int layer,int flags,UINT32 priority);
155155
156156/* Returns the priority order of the bg tilemaps set in the internal
157157   register. The order in which the four layers should be drawn is
r1877r1878
167167READ16_HANDLER( TC0150ROD_word_r );
168168WRITE16_HANDLER( TC0150ROD_word_w );
169169void TC0150ROD_vh_start(void);
170void TC0150ROD_draw(mame_bitmap *bitmap,const rectangle *cliprect,int y_offs,int palette_offs,int type,int road_trans,UINT32 low_priority,UINT32 high_priority);
170void TC0150ROD_draw(bitmap_t *bitmap,const rectangle *cliprect,int y_offs,int palette_offs,int type,int road_trans,UINT32 low_priority,UINT32 high_priority);
171171
172172
173173/***************************************************************************/
src/mame/video/nova2001.c
r1877r1878
5555{
5656   int i;
5757
58   paletteram_BBGGRRII_w(offset,data);
58   paletteram_BBGGRRII_w(machine,offset,data);
5959
6060   // expand the sprite palette to full length
6161   if (offset < 16)
6262   {
63      paletteram_BBGGRRII_w(0x200 + offset * 16 + 1, data);
63      paletteram_BBGGRRII_w(machine, 0x200 + offset * 16 + 1, data);
6464
6565      if (offset != 1)
6666      {
6767         for (i = 0; i < 16; i++)
6868         {
69            paletteram_BBGGRRII_w(0x200 + offset + i * 16, data);
69            paletteram_BBGGRRII_w(machine, 0x200 + offset + i * 16, data);
7070         }
7171      }
7272   }
r1877r1878
257257 *
258258 *************************************/
259259
260static void nova2001_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
260static void nova2001_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
261261{
262262   const gfx_element *gfx = machine->gfx[0];
263263   int offs;
r1877r1878
294294   }
295295}
296296
297static void pkunwar_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
297static void pkunwar_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
298298{
299299   const gfx_element *gfx = machine->gfx[0];
300300   int offs;
src/mame/video/cps1.c
r1877r1878
177177***************************************************************************/
178178
179179#include "driver.h"
180#include "deprecat.h"
181180#include "cps1.h"
182181
183182#define VERBOSE 0
r1877r1878
538537
539538   /* Pang 3 EEPROM interface */
540539   if (cps1_game_config->kludge == 5 && offset == 0x7a/2)
541      return cps1_eeprom_port_r(0,mem_mask);
540      return cps1_eeprom_port_r(machine,0,mem_mask);
542541
543542   return cps1_output[offset];
544543}
r1877r1878
548547   /* Pang 3 EEPROM interface */
549548   if (cps1_game_config->kludge == 5 && offset == 0x7a/2)
550549   {
551      cps1_eeprom_port_w(0,data,mem_mask);
550      cps1_eeprom_port_w(machine,0,data,mem_mask);
552551      return;
553552   }
554553
r1877r1878
13021301}
13031302
13041303
1305static void cps1_render_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
1304static void cps1_render_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
13061305{
13071306#define DRAWSPRITE(CODE,COLOR,FLIPX,FLIPY,SX,SY)               \
13081307{                                                   \
1309   if (flip_screen_get())                                    \
1308   if (flip_screen_get())                                 \
13101309      pdrawgfx(bitmap,machine->gfx[2],                     \
13111310            CODE,                                    \
13121311            COLOR,                                    \
r1877r1878
15451544#undef DRAWSPRITE
15461545}
15471546
1548static void cps2_render_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int *primasks)
1547static void cps2_render_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int *primasks)
15491548{
15501549#define DRAWSPRITE(CODE,COLOR,FLIPX,FLIPY,SX,SY)                           \
15511550{                                                               \
1552   if (flip_screen_get())                                                \
1551   if (flip_screen_get())                                             \
15531552      pdrawgfx(bitmap,machine->gfx[2],                                 \
15541553            CODE,                                                \
15551554            COLOR,                                                \
r1877r1878
16921691
16931692
16941693
1695static void cps1_render_stars(mame_bitmap *bitmap,const rectangle *cliprect)
1694static void cps1_render_stars(bitmap_t *bitmap,const rectangle *cliprect)
16961695{
16971696   int offs;
16981697   UINT8 *stars_rom = memory_region(REGION_GFX2);
r1877r1878
17221721               sy = 255 - sy;
17231722            }
17241723
1725            col = ((col & 0xe0) >> 1) + (cpu_getcurrentframe()/16 & 0x0f);
1724            col = ((col & 0xe0) >> 1) + (video_screen_get_frame_number(0)/16 & 0x0f);
17261725
17271726            if (sx >= cliprect->min_x && sx <= cliprect->max_x &&
17281727               sy >= cliprect->min_y && sy <= cliprect->max_y)
r1877r1878
17481747               sy = 255 - sy;
17491748            }
17501749
1751            col = ((col & 0xe0) >> 1) + (cpu_getcurrentframe()/16 & 0x0f);
1750            col = ((col & 0xe0) >> 1) + (video_screen_get_frame_number(0)/16 & 0x0f);
17521751
17531752            if (sx >= cliprect->min_x && sx <= cliprect->max_x &&
17541753               sy >= cliprect->min_y && sy <= cliprect->max_y)
r1877r1878
17591758}
17601759
17611760
1762static void cps1_render_layer(running_machine *machine,mame_bitmap *bitmap,const rectangle *cliprect,int layer,int primask)
1761static void cps1_render_layer(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect,int layer,int primask)
17631762{
17641763   switch (layer)
17651764   {
r1877r1878
17741773   }
17751774}
17761775
1777static void cps1_render_high_layer(mame_bitmap *bitmap, const rectangle *cliprect, int layer)
1776static void cps1_render_high_layer(bitmap_t *bitmap, const rectangle *cliprect, int layer)
17781777{
17791778   switch (layer)
17801779   {
src/mame/video/starcrus.c
r1877r1878
44#include "driver.h"
55#include "sound/samples.h"
66
7static mame_bitmap *ship1_vid;
8static mame_bitmap *ship2_vid;
9static mame_bitmap *proj1_vid;
10static mame_bitmap *proj2_vid;
7static bitmap_t *ship1_vid;
8static bitmap_t *ship2_vid;
9static bitmap_t *proj1_vid;
10static bitmap_t *proj2_vid;
1111
1212static int s1_x = 0;
1313static int s1_y = 0;
src/mame/video/yunsun16.c
r1877r1878
144144
145145***************************************************************************/
146146
147static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
147static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
148148{
149149   int offs;
150150
src/mame/video/wiz.c
r1877r1878
116116   flipy = data;
117117}
118118
119static void draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int bank, int colortype)
119static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int bank, int colortype)
120120{
121121   int offs;
122122
r1877r1878
156156   }
157157}
158158
159static void draw_foreground(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int colortype)
159static void draw_foreground(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int colortype)
160160{
161161   int offs;
162162
r1877r1878
195195   }
196196}
197197
198static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,
198static void draw_sprites(running_machine *machine, bitmap_t *bitmap,
199199                   const rectangle *cliprect, UINT8* sprite_ram,
200200                         int bank)
201201{
src/mame/video/stactics.c
r1877r1878
9494{
9595   stactics_state *state = Machine->driver_data;
9696
97   switch (offset >> 8)
97   if (data & 0x01)
9898   {
99      case 4:  // Page D
100         if (data & 0x01)
101            state->y_scroll_d = offset & 0xff;
102         break;
103
104      case 5:  // Page E
105         if (data & 0x01)
106            state->y_scroll_e = offset & 0xff;
107         break;
108
109      case 6:  // Page F
110         if (data & 0x01)
111            state->y_scroll_f = offset & 0xff;
112         break;
113    }
99      switch (offset >> 8)
100      {
101         case 4: state->y_scroll_d = offset & 0xff; break;
102         case 5: state->y_scroll_e = offset & 0xff; break;
103         case 6: state->y_scroll_f = offset & 0xff; break;
104      }
105   }
114106}
115107
116108
117109
118110/*************************************
119111 *
120 *  VBLANK counter
112 *  Frane counter
121113 *
122114 *************************************/
123115
124CUSTOM_INPUT( stactics_get_vblank_count_d3 )
116CUSTOM_INPUT( stactics_get_frame_count_d3 )
125117{
126   stactics_state *state = Machine->driver_data;
118   stactics_state *state = machine->driver_data;
127119
128   return (state->vblank_count >> 3) & 0x01;
120   return (state->frame_count >> 3) & 0x01;
129121}
130122
131123
r1877r1878
181173
182174CUSTOM_INPUT( stactics_get_shot_standby )
183175{
184   stactics_state *state = Machine->driver_data;
176   stactics_state *state = machine->driver_data;
185177
186178   return state->shot_standby;
187179}
r1877r1878
189181
190182CUSTOM_INPUT( stactics_get_not_shot_arrive )
191183{
192   stactics_state *state = Machine->driver_data;
184   stactics_state *state = machine->driver_data;
193185
194186   return !state->shot_arrive;
195187}
r1877r1878
245237}
246238
247239
248static void draw_background(stactics_state *state, mame_bitmap *bitmap, const rectangle *cliprect)
240static void draw_background(stactics_state *state, bitmap_t *bitmap, const rectangle *cliprect)
249241{
250242   int y;
251243
r1877r1878
382374   state->y_scroll_e = 0;
383375   state->y_scroll_f = 0;
384376
377   state->frame_count = 0;
385378   state->shot_standby = 1;
386379   state->shot_arrive = 0;
387380   state->beam_state = 0;
388381   state->old_beam_state = 0;
389   state->vblank_count = 0;
390382}
391383
392384
r1877r1878
405397   draw_background(state, bitmap, cliprect);
406398   update_artwork(state);
407399
408   state->vblank_count = (state->vblank_count + 1) & 0x0f;
400   state->frame_count = (state->frame_count + 1) & 0x0f;
409401
410402   return 0;
411403}
src/mame/video/mermaid.c
r1877r1878
149149   tilemap_set_transparent_pen(fg_tilemap, 0);
150150}
151151
152static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
152static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
153153{
154154   int offs;
155155
src/mame/video/gaelco3d.c
r1877r1878
3131#define IS_POLYEND(x)      (((x) ^ ((x) >> 1)) & 0x4000)
3232
3333
34static mame_bitmap *screenbits;
35static mame_bitmap *zbuffer;
34static bitmap_t *screenbits;
35static bitmap_t *zbuffer;
3636static rgb_t *palette;
3737static UINT32 *polydata_buffer;
3838static UINT32 polydata_count;
r1877r1878
219219static void render_noz_noperspective(void *destbase, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
220220{
221221   const poly_extra_data *extra = extradata;
222   mame_bitmap *bitmap = destbase;
222   bitmap_t *bitmap = destbase;
223223   float zbase = recip_approx(extra->ooz_base);
224224   float uoz_step = extra->uoz_dx * zbase;
225225   float voz_step = extra->voz_dx * zbase;
r1877r1878
260260static void render_normal(void *destbase, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
261261{
262262   const poly_extra_data *extra = extradata;
263   mame_bitmap *bitmap = destbase;
263   bitmap_t *bitmap = destbase;
264264   float ooz_dx = extra->ooz_dx;
265265   float uoz_dx = extra->uoz_dx;
266266   float voz_dx = extra->voz_dx;
r1877r1878
312312static void render_alphablend(void *destbase, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
313313{
314314   const poly_extra_data *extra = extradata;
315   mame_bitmap *bitmap = destbase;
315   bitmap_t *bitmap = destbase;
316316   float ooz_dx = extra->ooz_dx;
317317   float uoz_dx = extra->uoz_dx;
318318   float voz_dx = extra->voz_dx;
src/mame/video/lethalj.c
r1877r1878
179179 *
180180 *************************************/
181181
182void lethalj_scanline_update(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params)
182void lethalj_scanline_update(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params)
183183{
184184   UINT16 *src = &screenram[(vispage << 17) | ((params->rowaddr << 9) & 0x3fe00)];
185185   UINT16 *dest = BITMAP_ADDR16(bitmap, scanline, 0);
src/mame/video/dcon.c
r1877r1878
143143   dcon_gfx_bank_select = 0;
144144}
145145
146static void draw_sprites(running_machine* machine, mame_bitmap *bitmap,const rectangle *cliprect)
146static void draw_sprites(running_machine* machine, bitmap_t *bitmap,const rectangle *cliprect)
147147{
148148   int offs,fx,fy,x,y,color,sprite;
149149   int dx,dy,ax,ay,inc,pri_mask = 0;
src/mame/video/kickgoal.c
r1877r1878
8484
8585
8686
87static void kickgoal_draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
87static void kickgoal_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
8888{
8989   const gfx_element *gfx = machine->gfx[1];
9090   int offs;
r1877r1878
209209}
210210
211211
212static void actionhw_draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
212static void actionhw_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
213213{
214214   const gfx_element *gfx = machine->gfx[1];
215215   int offs;
src/mame/video/itech8.c
r1877r1878
213213
214214WRITE8_HANDLER( itech8_palette_w )
215215{
216   tlc34076_w(offset/2, data);
216   tlc34076_w(machine, offset/2, data);
217217}
218218
219219
r1877r1878
305305 *
306306 *************************************/
307307
308static void perform_blit(void)
308static void perform_blit(running_machine *machine)
309309{
310310   offs_t addr = tms_state.regs[TMS34061_XYADDRESS] | ((tms_state.regs[TMS34061_XYOFFSET] & 0x300) << 8);
311311   UINT8 shift = (BLITTER_FLAGS & BLITFLAG_SHIFT) ? 4 : 0;
r1877r1878
314314   int xdir = (BLITTER_FLAGS & BLITFLAG_XFLIP) ? -1 : 1;
315315   int xflip = (BLITTER_FLAGS & BLITFLAG_XFLIP);
316316   int rle = (BLITTER_FLAGS & BLITFLAG_RLE);
317   int color = tms34061_latch_r(0);
317   int color = tms34061_latch_r(machine, 0);
318318   int width = BLITTER_WIDTH;
319319   int height = BLITTER_HEIGHT;
320320   UINT8 transmaskhi, transmasklo;
r1877r1878
514514      }
515515
516516      /* perform the blit */
517      perform_blit();
517      perform_blit(machine);
518518      blit_in_progress = 1;
519519
520520      /* set a timer to go off when we're done */
r1877r1878
544544      col ^= 2;
545545
546546   /* Row address (RA0-RA8) is not dependent on the offset */
547   tms34061_w(col, 0xff, func, data);
547   tms34061_w(machine, col, 0xff, func, data);
548548}
549549
550550
r1877r1878
559559      col ^= 2;
560560
561561   /* Row address (RA0-RA8) is not dependent on the offset */
562   return tms34061_r(col, 0xff, func);
562   return tms34061_r(machine, col, 0xff, func);
563563}
564564
565565
src/mame/video/galaxian.c
r1877r1878
106106static emu_timer *stars_scroll_timer;
107107static UINT8 timer_adjusted;
108108       void galaxian_init_stars(running_machine *machine, int colors_offset);
109static void (*draw_stars)(running_machine *, mame_bitmap *);      /* function to call to draw the star layer */
110static void     noop_draw_stars(running_machine *machine, mame_bitmap *bitmap);
111       void galaxian_draw_stars(running_machine *machine, mame_bitmap *bitmap);
112static       void scramble_draw_stars(running_machine *machine, mame_bitmap *bitmap);
113static void   rescue_draw_stars(running_machine *machine, mame_bitmap *bitmap);
114static void  mariner_draw_stars(running_machine *machine, mame_bitmap *bitmap);
115static void  jumpbug_draw_stars(running_machine *machine, mame_bitmap *bitmap);
109static void (*draw_stars)(running_machine *, bitmap_t *);      /* function to call to draw the star layer */
110static void     noop_draw_stars(running_machine *machine, bitmap_t *bitmap);
111       void galaxian_draw_stars(running_machine *machine, bitmap_t *bitmap);
112static       void scramble_draw_stars(running_machine *machine, bitmap_t *bitmap);
113static void   rescue_draw_stars(running_machine *machine, bitmap_t *bitmap);
114static void  mariner_draw_stars(running_machine *machine, bitmap_t *bitmap);
115static void  jumpbug_draw_stars(running_machine *machine, bitmap_t *bitmap);
116116static void start_stars_blink_timer(double ra, double rb, double c);
117117static void start_stars_scroll_timer(void);
118118
119119/* bullets circuit */
120120static UINT8 darkplnt_bullet_color;
121static void (*draw_bullets)(running_machine *, mame_bitmap *,int,int,int);   /* function to call to draw a bullet */
122static void galaxian_draw_bullets(running_machine *machine, mame_bitmap *bitmap, int offs, int x, int y);
123static void gteikob2_draw_bullets(running_machine *machine, mame_bitmap *bitmap, int offs, int x, int y);
124static void scramble_draw_bullets(running_machine *machine, mame_bitmap *bitmap, int offs, int x, int y);
125static void   theend_draw_bullets(running_machine *machine, mame_bitmap *bitmap, int offs, int x, int y);
126static void darkplnt_draw_bullets(running_machine *machine, mame_bitmap *bitmap, int offs, int x, int y);
127static void dambustr_draw_bullets(running_machine *machine, mame_bitmap *bitmap, int offs, int x, int y);
121static void (*draw_bullets)(running_machine *, bitmap_t *,int,int,int);   /* function to call to draw a bullet */
122static void galaxian_draw_bullets(running_machine *machine, bitmap_t *bitmap, int offs, int x, int y);
123static void gteikob2_draw_bullets(running_machine *machine, bitmap_t *bitmap, int offs, int x, int y);
124static void scramble_draw_bullets(running_machine *machine, bitmap_t *bitmap, int offs, int x, int y);
125static void   theend_draw_bullets(running_machine *machine, bitmap_t *bitmap, int offs, int x, int y);
126static void darkplnt_draw_bullets(running_machine *machine, bitmap_t *bitmap, int offs, int x, int y);
127static void dambustr_draw_bullets(running_machine *machine, bitmap_t *bitmap, int offs, int x, int y);
128128
129129/* background circuit */
130130static UINT8 background_enable;
131131static UINT8 background_red, background_green, background_blue;
132static void (*draw_background)(running_machine *, mame_bitmap *);   /* function to call to draw the background */
133static void galaxian_draw_background(running_machine *machine, mame_bitmap *bitmap);
134static void scramble_draw_background(running_machine *machine, mame_bitmap *bitmap);
135static void  turtles_draw_background(running_machine *machine, mame_bitmap *bitmap);
136static void  mariner_draw_background(running_machine *machine, mame_bitmap *bitmap);
137static void  frogger_draw_background(running_machine *machine, mame_bitmap *bitmap);
138static void stratgyx_draw_background(running_machine *machine, mame_bitmap *bitmap);
139static void  minefld_draw_background(running_machine *machine, mame_bitmap *bitmap);
140static void   rescue_draw_background(running_machine *machine, mame_bitmap *bitmap);
141static void dambustr_draw_background(running_machine *machine, mame_bitmap *bitmap);
132static void (*draw_background)(running_machine *, bitmap_t *);   /* function to call to draw the background */
133static void galaxian_draw_background(running_machine *machine, bitmap_t *bitmap);
134static void scramble_draw_background(running_machine *machine, bitmap_t *bitmap);
135static void  turtles_draw_background(running_machine *machine, bitmap_t *bitmap);
136static void  mariner_draw_background(running_machine *machine, bitmap_t *bitmap);
137static void  frogger_draw_background(running_machine *machine, bitmap_t *bitmap);
138static void stratgyx_draw_background(running_machine *machine, bitmap_t *bitmap);
139static void  minefld_draw_background(running_machine *machine, bitmap_t *bitmap);
140static void   rescue_draw_background(running_machine *machine, bitmap_t *bitmap);
141static void dambustr_draw_background(running_machine *machine, bitmap_t *bitmap);
142142
143143static UINT16 rockclim_v;
144144static UINT16 rockclim_h;
r1877r1878
147147static int dambustr_bg_color_2;
148148static int dambustr_bg_priority;
149149static int dambustr_char_bank;
150static mame_bitmap *dambustr_tmpbitmap;
150static bitmap_t *dambustr_tmpbitmap;
151151
152152
153153
r1877r1878
512512   state_save_register_global(background_blue);
513513}
514514
515static void video_start_common(running_machine *machine, tilemap_mapper_callback get_memory_offset)
515static void video_start_common(running_machine *machine, tilemap_mapper_func get_memory_offset)
516516{
517517   bg_tilemap = tilemap_create(get_tile_info,get_memory_offset,8,8,32,32);
518518
r1877r1878
805805   modify_spritecode = batman2_modify_spritecode;
806806}
807807
808static void rockclim_draw_background(running_machine *machine, mame_bitmap *bitmap)
808static void rockclim_draw_background(running_machine *machine, bitmap_t *bitmap)
809809{
810810   tilemap_draw(bitmap,0,rockclim_tilemap, 0,0);
811811}
r1877r1878
10911091
10921092WRITE8_HANDLER( gteikob2_flip_screen_x_w )
10931093{
1094   galaxian_flip_screen_x_w(offset, ~data);
1094   galaxian_flip_screen_x_w(machine, offset, ~data);
10951095}
10961096
10971097WRITE8_HANDLER( gteikob2_flip_screen_y_w )
10981098{
1099   galaxian_flip_screen_y_w(offset, ~data);
1099   galaxian_flip_screen_y_w(machine, offset, ~data);
11001100}
11011101
11021102
11031103WRITE8_HANDLER( hotshock_flip_screen_w )
11041104{
1105   galaxian_flip_screen_x_w(offset, data);
1106   galaxian_flip_screen_y_w(offset, data);
1105   galaxian_flip_screen_x_w(machine, offset, data);
1106   galaxian_flip_screen_y_w(machine, offset, data);
11071107}
11081108
11091109
r1877r1878
14031403
14041404/* bullet drawing functions */
14051405
1406static void galaxian_draw_bullets(running_machine *machine, mame_bitmap *bitmap, int offs, int x, int y)
1406static void galaxian_draw_bullets(running_machine *machine, bitmap_t *bitmap, int offs, int x, int y)
14071407{
14081408   int i;
14091409
r1877r1878
14261426   }
14271427}
14281428
1429static void gteikob2_draw_bullets(running_machine *machine, mame_bitmap *bitmap, int offs, int x, int y)
1429static void gteikob2_draw_bullets(running_machine *machine, bitmap_t *bitmap, int offs, int x, int y)
14301430{
14311431   galaxian_draw_bullets(machine, bitmap, offs, 260 - x, y);
14321432}
14331433
1434static void scramble_draw_bullets(running_machine *machine, mame_bitmap *bitmap, int offs, int x, int y)
1434static void scramble_draw_bullets(running_machine *machine, bitmap_t *bitmap, int offs, int x, int y)
14351435{
14361436   if (flipscreen_x)  x++;
14371437
r1877r1878
14451445   }
14461446}
14471447
1448static void darkplnt_draw_bullets(running_machine *machine, mame_bitmap *bitmap, int offs, int x, int y)
1448static void darkplnt_draw_bullets(running_machine *machine, bitmap_t *bitmap, int offs, int x, int y)
14491449{
14501450   if (flipscreen_x)  x++;
14511451
r1877r1878
14581458   }
14591459}
14601460
1461static void theend_draw_bullets(running_machine *machine, mame_bitmap *bitmap, int offs, int x, int y)
1461static void theend_draw_bullets(running_machine *machine, bitmap_t *bitmap, int offs, int x, int y)
14621462{
14631463   int i;
14641464
r1877r1878
14761476   }
14771477}
14781478
1479static void dambustr_draw_bullets(running_machine *machine, mame_bitmap *bitmap, int offs, int x, int y)
1479static void dambustr_draw_bullets(running_machine *machine, bitmap_t *bitmap, int offs, int x, int y)
14801480{
14811481   int i, color;
14821482
r1877r1878
15091509
15101510/* background drawing functions */
15111511
1512static void galaxian_draw_background(running_machine *machine, mame_bitmap *bitmap)
1512static void galaxian_draw_background(running_machine *machine, bitmap_t *bitmap)
15131513{
15141514   /* plain black background */
15151515   fillbitmap(bitmap,0,&machine->screen[0].visarea);
15161516}
15171517
1518static void scramble_draw_background(running_machine *machine, mame_bitmap *bitmap)
1518static void scramble_draw_background(running_machine *machine, bitmap_t *bitmap)
15191519{
15201520   if (background_enable)
15211521      fillbitmap(bitmap,BACKGROUND_COLOR_BASE,&machine->screen[0].visarea);
r1877r1878
15231523      fillbitmap(bitmap,0,&machine->screen[0].visarea);
15241524}
15251525
1526static void turtles_draw_background(running_machine *machine, mame_bitmap *bitmap)
1526static void turtles_draw_background(running_machine *machine, bitmap_t *bitmap)
15271527{
15281528   int color = (background_blue << 2) | (background_green << 1) | background_red;
15291529
15301530   fillbitmap(bitmap,BACKGROUND_COLOR_BASE + color,&machine->screen[0].visarea);
15311531}
15321532
1533static void frogger_draw_background(running_machine *machine, mame_bitmap *bitmap)
1533static void frogger_draw_background(running_machine *machine, bitmap_t *bitmap)
15341534{
15351535   /* color split point verified on real machine */
15361536   if (flipscreen_x)
r1877r1878
15451545   }
15461546}
15471547
1548static void stratgyx_draw_background(running_machine *machine, mame_bitmap *bitmap)
1548static void stratgyx_draw_background(running_machine *machine, bitmap_t *bitmap)
15491549{
15501550   UINT8 x;
15511551   UINT8 *prom;
r1877r1878
15801580   }
15811581}
15821582
1583static void minefld_draw_background(running_machine *machine, mame_bitmap *bitmap)
1583static void minefld_draw_background(running_machine *machine, bitmap_t *bitmap)
15841584{
15851585   if (background_enable)
15861586   {
r1877r1878
15991599      fillbitmap(bitmap,0,&machine->screen[0].visarea);
16001600}
16011601
1602static void rescue_draw_background(running_machine *machine, mame_bitmap *bitmap)
1602static void rescue_draw_background(running_machine *machine, bitmap_t *bitmap)
16031603{
16041604   if (background_enable)
16051605   {
r1877r1878
16171617      fillbitmap(bitmap,0,&machine->screen[0].visarea);
16181618}
16191619
1620static void mariner_draw_background(running_machine *machine, mame_bitmap *bitmap)
1620static void mariner_draw_background(running_machine *machine, bitmap_t *bitmap)
16211621{
16221622   UINT8 x;
16231623   UINT8 *prom;
r1877r1878
16591659   }
16601660}
16611661
1662static void dambustr_draw_background(running_machine *machine, mame_bitmap *bitmap)
1662static void dambustr_draw_background(running_machine *machine, bitmap_t *bitmap)
16631663{
16641664   int col1 = BACKGROUND_COLOR_BASE + dambustr_bg_color_1;
16651665   int col2 = BACKGROUND_COLOR_BASE + dambustr_bg_color_2;
r1877r1878
16771677
16781678}
16791679
1680static void dambustr_draw_upper_background(mame_bitmap *bitmap)
1680static void dambustr_draw_upper_background(bitmap_t *bitmap)
16811681{
16821682   static rectangle clip = { 0, 0, 0, 0 };
16831683
r1877r1878
17741774   }
17751775}
17761776
1777static void plot_star(running_machine *machine, mame_bitmap *bitmap, int x, int y, int color)
1777static void plot_star(running_machine *machine, bitmap_t *bitmap, int x, int y, int color)
17781778{
17791779   if (y < machine->screen[0].visarea.min_y ||
17801780      y > machine->screen[0].visarea.max_y ||
r1877r1878
17921792   *BITMAP_ADDR16(bitmap, y, x) = stars_colors_start + color;
17931793}
17941794
1795static void noop_draw_stars(running_machine *machine, mame_bitmap *bitmap)
1795static void noop_draw_stars(running_machine *machine, bitmap_t *bitmap)
17961796{
17971797}
17981798
1799void galaxian_draw_stars(running_machine *machine, mame_bitmap *bitmap)
1799void galaxian_draw_stars(running_machine *machine, bitmap_t *bitmap)
18001800{
18011801   int offs;
18021802
r1877r1878
18231823   }
18241824}
18251825
1826static void scramble_draw_stars(running_machine *machine, mame_bitmap *bitmap)
1826static void scramble_draw_stars(running_machine *machine, bitmap_t *bitmap)
18271827{
18281828   int offs;
18291829
r1877r1878
18671867   }
18681868}
18691869
1870static void rescue_draw_stars(running_machine *machine, mame_bitmap *bitmap)
1870static void rescue_draw_stars(running_machine *machine, bitmap_t *bitmap)
18711871{
18721872   int offs;
18731873
r1877r1878
19131913   }
19141914}
19151915
1916static void mariner_draw_stars(running_machine *machine, mame_bitmap *bitmap)
1916static void mariner_draw_stars(running_machine *machine, bitmap_t *bitmap)
19171917{
19181918   int offs;
19191919   UINT8 *prom;
r1877r1878
19481948   }
19491949}
19501950
1951static void jumpbug_draw_stars(running_machine *machine, mame_bitmap *bitmap)
1951static void jumpbug_draw_stars(running_machine *machine, bitmap_t *bitmap)
19521952{
19531953   int offs;
19541954
r1877r1878
20562056   SET_TILE_INFO(2, code, 0, 0);
20572057}
20582058
2059static void draw_bullets_common(running_machine *machine, mame_bitmap *bitmap)
2059static void draw_bullets_common(running_machine *machine, bitmap_t *bitmap)
20602060{
20612061   int offs;
20622062
r1877r1878
20792079}
20802080
20812081
2082static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, UINT8 *spriteram, size_t spriteram_size)
2082static void draw_sprites(running_machine *machine, bitmap_t *bitmap, UINT8 *spriteram, size_t spriteram_size)
20832083{
20842084   int offs;
20852085
src/mame/video/othldrby.c
r1877r1878
132132
133133***************************************************************************/
134134
135static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int priority)
135static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int priority)
136136{
137137   int offs;
138138
src/mame/video/bbusters.c
r1877r1878
146146   return gfx->gfxdata + ((source_base+(dy%16)) * gfx->line_modulo);
147147}
148148
149static void bbusters_draw_block(running_machine *machine, mame_bitmap *dest,int x,int y,int size,int flipx,int flipy,UINT32 sprite,int color,int bank,int block)
149static void bbusters_draw_block(running_machine *machine, bitmap_t *dest,int x,int y,int size,int flipx,int flipy,UINT32 sprite,int color,int bank,int block)
150150{
151151   pen_t pen_base = machine->gfx[bank]->color_base + machine->gfx[bank]->color_granularity * (color % machine->gfx[bank]->total_colors);
152152   UINT32 xinc=(scale_line_count * 0x10000 ) / size;
r1877r1878
191191   }
192192}
193193
194static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const UINT16 *source, int bank, int colval, int colmask)
194static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const UINT16 *source, int bank, int colval, int colmask)
195195{
196196   const UINT8 *scale_table=memory_region(REGION_USER1);
197197   int offs;
src/mame/video/gstriker.c
r1877r1878
8888   VS920A[numchip].gfx_region = gfx_region;
8989}
9090
91static void VS920A_draw(int numchip, mame_bitmap* screen, const rectangle* cliprect, int priority)
91static void VS920A_draw(int numchip, bitmap_t* screen, const rectangle* cliprect, int priority)
9292{
9393   VS920A_cur_chip = &VS920A[numchip];
9494
r1877r1878
242242}
243243
244244/* THIS IS STILL WRONG! */
245static void MB60553_draw(running_machine *machine, int numchip, mame_bitmap* screen, const rectangle* cliprect, int priority)
245static void MB60553_draw(running_machine *machine, int numchip, bitmap_t* screen, const rectangle* cliprect, int priority)
246246{
247247   int line;
248248   rectangle clip;
r1877r1878
389389tCG10103 CG10103[MAX_CG10103];
390390static tCG10103* CG10103_cur_chip;
391391
392static void CG10103_draw_sprite(running_machine *machine, mame_bitmap* screen, const rectangle* cliprect, UINT16* spr, int drawpri)
392static void CG10103_draw_sprite(running_machine *machine, bitmap_t* screen, const rectangle* cliprect, UINT16* spr, int drawpri)
393393{
394394   int ypos = spr[0] & 0x1FF;
395395   int xpos = (spr[1] & 0x1FF);
r1877r1878
465465}
466466
467467
468static void CG10103_draw(running_machine *machine, int numchip, mame_bitmap* screen, const rectangle* cliprect, int priority)
468static void CG10103_draw(running_machine *machine, int numchip, bitmap_t* screen, const rectangle* cliprect, int priority)
469469{
470470   UINT16* splist;
471471   int i;
src/mame/video/snk.c
r1877r1878
7272
7373/**************************************************************************************/
7474
75static void tnk3_draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int scrollx, int scrolly,
75static void tnk3_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int scrollx, int scrolly,
7676               int x_size, int y_size, int bg_type )
7777{
7878   const gfx_element *gfx = machine->gfx[1];
r1877r1878
108108   copyscrollbitmap(bitmap,tmpbitmap,1,&scrollx,1,&scrolly,cliprect);
109109}
110110
111void tnk3_draw_text(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int bank, UINT8 *source )
111void tnk3_draw_text(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int bank, UINT8 *source )
112112{
113113   const gfx_element *gfx = machine->gfx[0];
114114
r1877r1878
134134   }
135135}
136136
137static void tnk3_draw_status_main(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int bank, UINT8 *source, int start )
137static void tnk3_draw_status_main(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int bank, UINT8 *source, int start )
138138{
139139   const gfx_element *gfx = machine->gfx[0];
140140
r1877r1878
158158   }
159159}
160160
161void tnk3_draw_status(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int bank, UINT8 *source )
161void tnk3_draw_status(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int bank, UINT8 *source )
162162{
163163   tnk3_draw_status_main(machine,bitmap,cliprect,bank,source, 0);
164164   tnk3_draw_status_main(machine,bitmap,cliprect,bank,source,30);
165165}
166166
167static void tnk3_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int xscroll, int yscroll )
167static void tnk3_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int xscroll, int yscroll )
168168{
169169   const gfx_element *gfx = machine->gfx[2];
170170
r1877r1878
244244   tmpbitmap = auto_bitmap_alloc( 512, 256, machine->screen[0].format );
245245}
246246
247static void sgladiat_draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int scrollx, int scrolly )
247static void sgladiat_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int scrollx, int scrolly )
248248{
249249   const gfx_element *gfx = machine->gfx[1];
250250
r1877r1878
290290
291291/**************************************************************************************/
292292
293static void ikari_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int start, int xscroll, int yscroll,
293static void ikari_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int start, int xscroll, int yscroll,
294294            UINT8 *source, int mode )
295295{
296296   gfx_element *gfx = machine->gfx[mode];
r1877r1878
360360
361361/**************************************************************/
362362
363static void tdfever_draw_bg(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int xscroll, int yscroll )
363static void tdfever_draw_bg(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int xscroll, int yscroll )
364364{
365365   const UINT8 *source = snk_rambase + 0x000;
366366   const gfx_element *gfx = machine->gfx[1];
r1877r1878
413413    -xx-x--- (bank number)
414414    x------- (x offset bit8)
415415*/
416static void tdfever_draw_sp(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int xscroll, int yscroll, int mode )
416static void tdfever_draw_sp(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int xscroll, int yscroll, int mode )
417417{
418418   const UINT8 *source = snk_rambase + ((mode==2)?0x1800:0x1000);
419419   const gfx_element *gfx = machine->gfx[(mode==1)?3:2];
r1877r1878
467467   }
468468}
469469
470static void tdfever_draw_tx(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int attributes, int dx, int dy, int base )
470static void tdfever_draw_tx(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int attributes, int dx, int dy, int base )
471471{
472472   const UINT8 *source = snk_rambase - 0xd000 + base;
473473   const gfx_element *gfx = machine->gfx[0];
src/mame/video/hyprduel.c
r1877r1878
127127
128128
129129/* 8x8x4 tiles only */
130#ifdef UNUSED_FUNCTON
130131INLINE void get_tile_info(running_machine *machine,tile_data *tileinfo,int tile_index,int layer,UINT16 *vram)
131132{
132133   UINT16 code;
r1877r1878
159160            (((tile & 0x0ff00000) >> 20) ^ 0x0f) + 0x100,
160161            TILE_FLIPXY((code & 0x6000) >> 13));
161162}
163#endif
162164
163
164165/* 8x8x4 or 8x8x8 tiles. It's the tile's color that decides: if its low 4
165166   bits are high ($f,$1f,$2f etc) the tile is 8bpp, otherwise it's 4bpp */
166167INLINE void get_tile_info_8bit(running_machine *machine,tile_data *tileinfo,int tile_index,int layer,UINT16 *vram)
r1877r1878
204205
205206/* 16x16x4 or 16x16x8 tiles. It's the tile's color that decides: if its low 4
206207   bits are high ($f,$1f,$2f etc) the tile is 8bpp, otherwise it's 4bpp */
208#ifdef UNUSED_FUNCTON
207209INLINE void get_tile_info_16x16_8bit(running_machine *machine,tile_data *tileinfo,int tile_index,int layer,UINT16 *vram)
208210{
209211   UINT16 code;
r1877r1878
242244            (((tile & 0x0ff00000) >> 20) ^ 0x0f) + 0x100,
243245            TILE_FLIPXY((code & 0x6000) >> 13));
244246}
247#endif
245248
246
247249INLINE void hyprduel_vram_w(offs_t offset,UINT16 data,UINT16 mem_mask,int layer,UINT16 *vram)
248250{
249251   COMBINE_DATA(&vram[offset]);
r1877r1878
390392
391393/* Draw sprites */
392394
393static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
395static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
394396{
395397   const int region      =   REGION_GFX1;
396398
r1877r1878
542544***************************************************************************/
543545
544546/* Draw all the layers that match the given priority */
545static void draw_layers(mame_bitmap *bitmap, const rectangle *cliprect, int pri, int layers_ctrl)
547static void draw_layers(bitmap_t *bitmap, const rectangle *cliprect, int pri, int layers_ctrl)
546548{
547549   UINT16 layers_pri = hyprduel_videoregs[0x10/2];
548550   int layer;
src/mame/video/namconb1.c
r1877r1878
158158} /* handle_mcu */
159159
160160static void
161video_update_common(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int bROZ )
161video_update_common(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int bROZ )
162162{
163163   int pri;
164164   handle_mcu();
src/mame/video/arcadecl.c
r1877r1878
9595   if (has_mo)
9696   {
9797      struct atarimo_rect_list rectlist;
98      mame_bitmap *mobitmap;
98      bitmap_t *mobitmap;
9999      int x, y, r;
100100
101101      mobitmap = atarimo_render(machine, 0, cliprect, &rectlist);
src/mame/video/flstory.c
r1877r1878
7474WRITE8_HANDLER( flstory_palette_w )
7575{
7676   if (offset & 0x100)
77      paletteram_xxxxBBBBGGGGRRRR_split2_w((offset & 0xff) + (palette_bank << 8),data);
77      paletteram_xxxxBBBBGGGGRRRR_split2_w(machine, (offset & 0xff) + (palette_bank << 8),data);
7878   else
79      paletteram_xxxxBBBBGGGGRRRR_split1_w((offset & 0xff) + (palette_bank << 8),data);
79      paletteram_xxxxBBBBGGGGRRRR_split1_w(machine, (offset & 0xff) + (palette_bank << 8),data);
8080}
8181
8282READ8_HANDLER( flstory_palette_r )
r1877r1878
137137}
138138
139139
140static void flstory_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri)
140static void flstory_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri)
141141{
142142   int i;
143143
r1877r1878
194194   return 0;
195195}
196196
197static void victnine_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
197static void victnine_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
198198{
199199   int i;
200200
src/mame/video/suprslam.c
r1877r1878
99static tilemap *suprslam_screen_tilemap, *suprslam_bg_tilemap;
1010
1111/* todo, fix zooming correctly, its _not_ like aerofgt */
12static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
12static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
1313{
1414   /* SPRITE INFO
1515
src/mame/video/calomega.c
r1877r1878
5050   SET_TILE_INFO(bank, code, color, 0);
5151}
5252
53WRITE8_HANDLER( calomega_mc6845_address_w )
54{
55   mc6845_address_w(mc6845, data);
56}
57
58READ8_HANDLER( calomega_mc6845_register_r )
59{
60   return mc6845_register_r(mc6845);
61}
62
63WRITE8_HANDLER( calomega_mc6845_register_w )
64{
65   mc6845_register_w(mc6845, data);
66}
67
6853VIDEO_START( calomega )
6954{
7055   mc6845 = devtag_get_token(machine, MC6845, "crtc");
src/mame/video/strnskil.c
r1877r1878
8080   tilemap_set_scroll_rows(bg_tilemap, 32);
8181}
8282
83static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
83static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
8484{
8585   int offs;
8686
src/mame/video/cosmic.c
r1877r1878
77***************************************************************************/
88
99#include "driver.h"
10#include "deprecat.h"
1110
1211
1312static pen_t (*map_color)(UINT8 x, UINT8 y);
r1877r1878
249248}
250249
251250
252static void draw_bitmap(mame_bitmap *bitmap, const rectangle *cliprect)
251static void draw_bitmap(bitmap_t *bitmap, const rectangle *cliprect)
253252{
254253   offs_t offs;
255254
r1877r1878
280279}
281280
282281
283static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int color_mask, int extra_sprites)
282static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int color_mask, int extra_sprites)
284283{
285284   int offs;
286285
r1877r1878
315314}
316315
317316
318static void cosmica_draw_starfield(mame_bitmap *bitmap, const rectangle *cliprect)
317static void cosmica_draw_starfield(bitmap_t *bitmap, const rectangle *cliprect)
319318{
320319   UINT8 y = 0;
321320   UINT8 map = 0;
r1877r1878
334333         int hc, hb_;
335334
336335         if (flip_screen_get())
337            x1 = x - cpu_getcurrentframe();
336            x1 = x - video_screen_get_frame_number(0);
338337         else
339            x1 = x + cpu_getcurrentframe();
338            x1 = x + video_screen_get_frame_number(0);
340339
341340         hc  = (x1 >> 2) & 0x01;
342341         hb_ = (x  >> 5) & 0x01;  /* not a bug, this one is the real x */
r1877r1878
364363}
365364
366365
367static void devzone_draw_grid(mame_bitmap *bitmap, const rectangle *cliprect)
366static void devzone_draw_grid(bitmap_t *bitmap, const rectangle *cliprect)
368367{
369368   UINT8 y;
370369   UINT8 *horz_PROM = memory_region(REGION_USER2);
r1877r1878
422421}
423422
424423
425static void nomnlnd_draw_background(mame_bitmap *bitmap, const rectangle *cliprect)
424static void nomnlnd_draw_background(bitmap_t *bitmap, const rectangle *cliprect)
426425{
427426   UINT8 y = 0;
428   UINT8 water = cpu_getcurrentframe();
427   UINT8 water = video_screen_get_frame_number(0);
429428   UINT8 *PROM = memory_region(REGION_USER2);
430429
431430   /* all positioning is via logic gates:
src/mame/video/tia.c
r1877r1878
107107static UINT8 REFLECT;      /* Should playfield be reflected or not */
108108static UINT8 NUSIZx_changed;
109109
110static mame_bitmap *helper[3];
110static bitmap_t *helper[3];
111111
112112static UINT16 screen_height;
113113
r1877r1878
123123   { 1, 4, 0 }
124124};
125125
126static read16_handler   tia_read_input_port;
127static read8_handler   tia_get_databus;
128static write16_handler   tia_vsync_callback;
126static read16_machine_func   tia_read_input_port;
127static read8_machine_func   tia_get_databus;
128static write16_machine_func   tia_vsync_callback;
129129
130130static void extend_palette(running_machine *machine) {
131131   int   i,j;
r1877r1878
877877               Machine->screen[0].height);
878878
879879         if ( tia_vsync_callback ) {
880            tia_vsync_callback( 0, curr_y, 0xFFFF );
880            tia_vsync_callback( machine, 0, curr_y, 0xFFFF );
881881         }
882882
883883         prev_y = 0;
r1877r1878
13611361
13621362static WRITE8_HANDLER( HMCLR_w )
13631363{
1364   HMP0_w( offset, 0 );
1365   HMP1_w( offset, 0 );
1366   HMM0_w( offset, 0 );
1367   HMM1_w( offset, 0 );
1368   HMBL_w( offset, 0 );
1364   HMP0_w( machine, offset, 0 );
1365   HMP1_w( machine, offset, 0 );
1366   HMM0_w( machine, offset, 0 );
1367   HMM1_w( machine, offset, 0 );
1368   HMBL_w( machine, offset, 0 );
13691369}
13701370
13711371
r1877r1878
16501650{
16511651   UINT64 elapsed = activecpu_gettotalcycles() - paddle_cycles;
16521652   int input = TIA_INPUT_PORT_ALWAYS_ON;
1653
16541653   if ( tia_read_input_port )
16551654   {
1656      input = tia_read_input_port(offset & 3, 0xFFFF);
1655      input = tia_read_input_port(machine, offset & 3, 0xFFFF);
16571656   }
16581657
16591658   if ( input == TIA_INPUT_PORT_ALWAYS_ON )
r1877r1878
16761675
16771676   if ( tia_get_databus )
16781677   {
1679      data = tia_get_databus(offset) & 0x3f;
1678      data = tia_get_databus(machine, offset) & 0x3f;
16801679   }
16811680
16821681   if (!(offset & 0x8))
r1877r1878
17031702   case 0x7:
17041703      return data | CXPPMM;
17051704   case 0x8:
1706      return data | INPT_r(0);
1705      return data | INPT_r(machine,0);
17071706   case 0x9:
1708      return data | INPT_r(1);
1707      return data | INPT_r(machine,1);
17091708   case 0xA:
1710      return data | INPT_r(2);
1709      return data | INPT_r(machine,2);
17111710   case 0xB:
1712      return data | INPT_r(3);
1711      return data | INPT_r(machine,3);
17131712   case 0xC:
17141713      {
1715         int   button = tia_read_input_port ? ( tia_read_input_port(4,0xFFFF) & 0x80 ) : 0x80;
1714         int   button = tia_read_input_port ? ( tia_read_input_port(machine,4,0xFFFF) & 0x80 ) : 0x80;
17161715         INPT4 = ( VBLANK & 0x40) ? ( INPT4 & button ) : button;
17171716      }
17181717      return data | INPT4;
17191718   case 0xD:
17201719      {
1721         int button = tia_read_input_port ? ( tia_read_input_port(5,0xFFFF) & 0x80 ) : 0x80;
1720         int button = tia_read_input_port ? ( tia_read_input_port(machine,5,0xFFFF) & 0x80 ) : 0x80;
17221721         INPT5 = ( VBLANK & 0x40) ? ( INPT5 & button ) : button;
17231722      }
17241723      return data | INPT5;
r1877r1878
17781777       0,   // HMCLR
17791778       0,   // CXCLR
17801779   };
1781
17821780   int curr_x = current_x();
17831781   int curr_y = current_y();
17841782
r1877r1878
17971795   switch (offset)
17981796   {
17991797   case 0x00:
1800      VSYNC_w(offset, data);
1798      VSYNC_w(machine, offset, data);
18011799      break;
18021800   case 0x01:
1803      VBLANK_w(offset, data);
1801      VBLANK_w(machine, offset, data);
18041802      break;
18051803   case 0x02:
1806      WSYNC_w(offset, data);
1804      WSYNC_w(machine, offset, data);
18071805      break;
18081806   case 0x03:
1809      RSYNC_w(offset, data);
1807      RSYNC_w(machine, offset, data);
18101808      break;
18111809   case 0x04:
1812      NUSIZ0_w(offset, data);
1810      NUSIZ0_w(machine, offset, data);
18131811      break;
18141812   case 0x05:
1815      NUSIZ1_w(offset, data);
1813      NUSIZ1_w(machine, offset, data);
18161814      break;
18171815   case 0x06:
18181816      COLUP0 = data;
r1877r1878
18271825      COLUBK = data;
18281826      break;
18291827   case 0x0A:
1830      CTRLPF_w(offset, data);
1828      CTRLPF_w(machine, offset, data);
18311829      break;
18321830   case 0x0B:
18331831      REFP0 = data;
r1877r1878
18451843      PF2 = data;
18461844      break;
18471845   case 0x10:
1848      RESP0_w(offset, data);
1846      RESP0_w(machine, offset, data);
18491847      break;
18501848   case 0x11:
1851      RESP1_w(offset, data);
1849      RESP1_w(machine, offset, data);
18521850      break;
18531851   case 0x12:
1854      RESM0_w(offset, data);
1852      RESM0_w(machine, offset, data);
18551853      break;
18561854   case 0x13:
1857      RESM1_w(offset, data);
1855      RESM1_w(machine, offset, data);
18581856      break;
18591857   case 0x14:
1860      RESBL_w(offset, data);
1858      RESBL_w(machine, offset, data);
18611859      break;
18621860
18631861   case 0x15: /* AUDC0 */
r1877r1878
18661864   case 0x18: /* AUDF1 */
18671865   case 0x19: /* AUDV0 */
18681866   case 0x1A: /* AUDV1 */
1869      tia_sound_w(offset, data);
1867      tia_sound_w(machine, offset, data);
18701868      break;
18711869
18721870   case 0x1B:
1873      GRP0_w(offset, data);
1871      GRP0_w(machine, offset, data);
18741872      break;
18751873   case 0x1C:
1876      GRP1_w(offset, data);
1874      GRP1_w(machine, offset, data);
18771875      break;
18781876   case 0x1D:
18791877      ENAM0 = data;
r1877r1878
18851883      ENABL = data;
18861884      break;
18871885   case 0x20:
1888      HMP0_w(offset, data);
1886      HMP0_w(machine, offset, data);
18891887      break;
18901888   case 0x21:
1891      HMP1_w(offset, data);
1889      HMP1_w(machine, offset, data);
18921890      break;
18931891   case 0x22:
1894      HMM0_w(offset, data);
1892      HMM0_w(machine, offset, data);
18951893      break;
18961894   case 0x23:
1897      HMM1_w(offset, data);
1895      HMM1_w(machine, offset, data);
18981896      break;
18991897   case 0x24:
1900      HMBL_w(offset, data);
1898      HMBL_w(machine, offset, data);
19011899      break;
19021900   case 0x25:
19031901      VDELP0 = data;
r1877r1878
19091907      VDELBL = data;
19101908      break;
19111909   case 0x28:
1912      RESMP0_w(offset, data);
1910      RESMP0_w(machine, offset, data);
19131911      break;
19141912   case 0x29:
1915      RESMP1_w(offset, data);
1913      RESMP1_w(machine, offset, data);
19161914      break;
19171915   case 0x2A:
1918      HMOVE_w(offset, data);
1916      HMOVE_w(machine, offset, data);
19191917      break;
19201918   case 0x2B:
1921      HMCLR_w(offset, data);
1919      HMCLR_w(machine, offset, data);
19221920      break;
19231921   case 0x2C:
1924      CXCLR_w(offset, 0);
1922      CXCLR_w(machine, offset, 0);
19251923      break;
19261924   }
19271925}
src/mame/video/shaolins.c
r1877r1878
149149   tilemap_set_scroll_cols(bg_tilemap, 32);
150150}
151151
152static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
152static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
153153{
154154   int offs;
155155
src/mame/video/model2.c
r1877r1878
922922
923923/***********************************************************************************************/
924924
925static const poly_draw_scanline render_funcs[8] =
925static const poly_draw_scanline_func render_funcs[8] =
926926{
927927   model2_3d_render_0,   /* checker = 0, textured = 0, translucent = 0 */
928928   model2_3d_render_1,   /* checker = 0, textured = 0, translucent = 1 */
r1877r1878
934934   model2_3d_render_7   /* checker = 1, textured = 1, translucent = 1 */
935935};
936936
937static void model2_3d_render( mame_bitmap *bitmap, triangle *tri, const rectangle *cliprect )
937static void model2_3d_render( bitmap_t *bitmap, triangle *tri, const rectangle *cliprect )
938938{
939939   poly_extra_data *extra = poly_get_extra_data(poly);
940940   UINT8      renderer;
src/mame/video/tia.h
r1877r1878
77#define TIA_MAX_SCREEN_HEIGHT         342
88
99struct tia_interface {
10   read16_handler   read_input_port;
11   read8_handler   databus_contents;
12   write16_handler   vsync_callback;
10   read16_machine_func   read_input_port;
11   read8_machine_func   databus_contents;
12   write16_machine_func   vsync_callback;
1313};
1414
1515PALETTE_INIT( tia_NTSC );
src/mame/video/sshangha.c
r1877r1878
3030   palette_set_color(Machine,offset/2,MAKE_RGB(r,g,b));
3131}
3232
33static void sshangha_tilemap_draw(mame_bitmap *bitmap, const rectangle *cliprect)
33static void sshangha_tilemap_draw(bitmap_t *bitmap, const rectangle *cliprect)
3434{
35   const mame_bitmap *bitmap0 = tilemap_get_pixmap(pf1_16x16_tilemap);
36   const mame_bitmap *bitmap1 = tilemap_get_pixmap(pf2_tilemap);
35   const bitmap_t *bitmap0 = tilemap_get_pixmap(pf1_16x16_tilemap);
36   const bitmap_t *bitmap1 = tilemap_get_pixmap(pf2_tilemap);
3737   int x,y,p;
3838
3939   for (y=0; y<240; y++) {
r1877r1878
5555
5656/******************************************************************************/
5757
58static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT16 *spritesrc, UINT16 pmask, UINT16 pval)
58static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16 *spritesrc, UINT16 pmask, UINT16 pval)
5959{
6060   int offs;
6161
r1877r1878
7171
7272      y = spritesrc[offs];
7373      flash=y&0x1000;
74      if (flash && (cpu_getcurrentframe() & 1)) continue;
74      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
7575
7676      x = spritesrc[offs+2];
7777      colour = (x >>9) & 0x1f;
src/mame/video/kyugo.c
r1877r1878
162162 *
163163 *************************************/
164164
165static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
165static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
166166{
167167   /* sprite information is scattered through memory */
168168   /* and uses a portion of the text layer memory (outside the visible area) */
src/mame/video/segaic24.c
r1877r1878
191191   }
192192}
193193
194static void sys24_tile_draw_rect(running_machine *machine, mame_bitmap *bm, mame_bitmap *tm, mame_bitmap *dm, const UINT16 *mask,
194static void sys24_tile_draw_rect(running_machine *machine, bitmap_t *bm, bitmap_t *tm, bitmap_t *dm, const UINT16 *mask,
195195                         UINT16 tpri, UINT8 lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2)
196196{
197197   int y;
r1877r1878
325325// about sprite priority hence the lack of support for the
326326// priority_bitmap
327327
328static void sys24_tile_draw_rect_rgb(running_machine *machine, mame_bitmap *bm, mame_bitmap *tm, mame_bitmap *dm, const UINT16 *mask,
328static void sys24_tile_draw_rect_rgb(running_machine *machine, bitmap_t *bm, bitmap_t *tm, bitmap_t *dm, const UINT16 *mask,
329329                            UINT16 tpri, UINT8 lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2)
330330{
331331   int y;
r1877r1878
437437   }
438438}
439439
440void sys24_tile_draw(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int layer, int lpri, int flags)
440void sys24_tile_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int layer, int lpri, int flags)
441441{
442442   UINT16 hscr = sys24_tile_ram[0x5000+(layer >> 1)];
443443   UINT16 vscr = sys24_tile_ram[0x5004+(layer >> 1)];
r1877r1878
511511      };
512512
513513   } else {
514      mame_bitmap *bm, *tm;
515      void (*draw)(running_machine *machine, mame_bitmap *, mame_bitmap *, mame_bitmap *, const UINT16 *,
514      bitmap_t *bm, *tm;
515      void (*draw)(running_machine *machine, bitmap_t *, bitmap_t *, bitmap_t *, const UINT16 *,
516516                UINT16, UINT8, int, int, int, int, int, int, int);
517517      int win = layer & 1;
518518
r1877r1878
604604
605605READ32_HANDLER(sys24_tile32_r)
606606{
607   return sys24_tile_r(offset*2, mem_mask&0xffff) | sys24_tile_r((offset*2)+1, mem_mask>>16)<<16;
607   return sys24_tile_r(machine, offset*2, mem_mask&0xffff) | sys24_tile_r(machine, (offset*2)+1, mem_mask>>16)<<16;
608608}
609609
610610READ32_HANDLER(sys24_char32_r)
611611{
612   return sys24_char_r(offset*2, mem_mask&0xffff) | sys24_char_r((offset*2)+1, mem_mask>>16)<<16;
612   return sys24_char_r(machine, offset*2, mem_mask&0xffff) | sys24_char_r(machine, (offset*2)+1, mem_mask>>16)<<16;
613613}
614614
615615WRITE32_HANDLER(sys24_tile32_w)
616616{
617   sys24_tile_w(offset*2, data&0xffff, mem_mask&0xffff);
618   sys24_tile_w((offset*2)+1, data>>16, mem_mask>>16);
617   sys24_tile_w(machine, offset*2, data&0xffff, mem_mask&0xffff);
618   sys24_tile_w(machine, (offset*2)+1, data>>16, mem_mask>>16);
619619}
620620
621621WRITE32_HANDLER(sys24_char32_w)
622622{
623   sys24_char_w(offset*2, data&0xffff, mem_mask&0xffff);
624   sys24_char_w((offset*2)+1, data>>16, mem_mask>>16);
623   sys24_char_w(machine,offset*2, data&0xffff, mem_mask&0xffff);
624   sys24_char_w(machine,(offset*2)+1, data>>16, mem_mask>>16);
625625}
626626
627627// - System 24
r1877r1878
656656    0   11------    --------
657657*/
658658
659void sys24_sprite_draw(mame_bitmap *bitmap, const rectangle *cliprect, const int *spri)
659void sys24_sprite_draw(bitmap_t *bitmap, const rectangle *cliprect, const int *spri)
660660{
661661   UINT16 curspr = 0;
662662   int countspr = 0;
src/mame/video/popeye.c
r1877r1878
1414static UINT8 *popeye_bitmapram;
1515static size_t popeye_bitmapram_size = 0x2000;
1616
17static mame_bitmap *tmpbitmap2;
17static bitmap_t *tmpbitmap2;
1818static int invertmask;
1919static int bitmap_type;
2020enum { TYPE_SKYSKIPR, TYPE_POPEYE };
r1877r1878
233233   if (data & 0x80)
234234      offset |= 0x40;
235235
236   popeye_bitmap_w(offset,data);
236   popeye_bitmap_w(machine,offset,data);
237237}
238238
239239static TILE_GET_INFO( get_fg_tile_info )
r1877r1878
272272   tilemap_set_transparent_pen(fg_tilemap, 0);
273273}
274274
275static void draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
275static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
276276{
277277   int offs;
278278   static int lastflip = 0;
r1877r1878
280280   if (lastflip != flip_screen_get())
281281   {
282282      for (offs = 0;offs < popeye_bitmapram_size;offs++)
283         popeye_bitmap_w(offs,popeye_bitmapram[offs]);
283         popeye_bitmap_w(machine,offs,popeye_bitmapram[offs]);
284284
285285      lastflip = flip_screen_get();
286286   }
r1877r1878
309309   }
310310}
311311
312static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
312static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
313313{
314314   int offs;
315315
src/mame/video/lazercmd.c
r1877r1878
2727/* plot a bitmap marker */
2828/* hardware has 2 marker sizes 2x2 and 4x2 selected by jumper */
2929/* meadows lanes normaly use 2x2 pixels and lazer command uses either */
30static void plot_pattern(running_machine *machine, mame_bitmap *bitmap, int x, int y)
30static void plot_pattern(running_machine *machine, bitmap_t *bitmap, int x, int y)
3131{
3232   int xbit, ybit, size;
3333
3434    size = 2;
35   if (input_port_2_r(0) & 0x40)
35   if (input_port_2_r(machine,0) & 0x40)
3636    {
3737      size = 4;
3838    }
r1877r1878
5757{
5858   int i,x,y;
5959
60   int video_inverted = input_port_2_r(0) & 0x20;
60   int video_inverted = input_port_2_r(machine,0) & 0x20;
6161
6262   /* The first row of characters are invisible */
6363   for (i = 0; i < (VERT_RES - 1) * HORZ_RES; i++)
src/mame/video/blockade.c
r1877r1878
88   videoram[offset] = data;
99   tilemap_mark_tile_dirty(bg_tilemap, offset);
1010
11   if (input_port_3_r(0) & 0x80)
11   if (input_port_3_r(machine,0) & 0x80)
1212   {
1313      logerror("blockade_videoram_w: scanline %d\n", video_screen_get_vpos(0));
1414      cpu_spinuntil_int();
src/mame/video/segaic24.h
r1877r1878
1212//  System24
1313void sys24_tile_vh_start(running_machine *machine, UINT16 tile_mask);
1414void sys24_tile_update(running_machine *machine);
15void sys24_tile_draw(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int layer, int pri, int flags);
15void sys24_tile_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int layer, int pri, int flags);
1616
1717READ16_HANDLER(sys24_tile_r);
1818READ16_HANDLER(sys24_char_r);
r1877r1878
2727// Sprites
2828//  System24
2929void sys24_sprite_vh_start(void);
30void sys24_sprite_draw(mame_bitmap *bitmap, const rectangle *cliprect, const int *spri);
30void sys24_sprite_draw(bitmap_t *bitmap, const rectangle *cliprect, const int *spri);
3131
3232WRITE16_HANDLER (sys24_sprite_w);
3333READ16_HANDLER (sys24_sprite_r);
src/mame/video/compgolf.c
r1877r1878
8888-----x-- -------- -------- -------- Flip X
8989-------- -------- -------- -------- Flip Y(used?)
9090*/
91static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
91static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
9292{
9393   int offs,fx,fy,x,y,color,sprite;
9494
src/mame/video/lordgun.c
r1877r1878
218218
219219***************************************************************************/
220220
221static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
221static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
222222{
223223   UINT16 *s      =   spriteram16;
224224   UINT16 *end      =   spriteram16 + spriteram_size/2;
src/mame/video/pushman.c
r1877r1878
8282
8383***************************************************************************/
8484
85static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
85static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
8686{
8787   int offs,x,y,color,sprite,flipx,flipy;
8888
src/mame/video/lemmings.c
r1877r1878
1313***************************************************************************/
1414
1515#include "driver.h"
16#include "deprecat.h"
1716#include "lemmings.h"
1817
1918UINT16 *lemmings_pixel_0_data,*lemmings_pixel_1_data,*lemmings_vram_data,*lemmings_control_data;
2019static UINT16 *sprite_triple_buffer_0,*sprite_triple_buffer_1;
2120static UINT8 *vram_buffer, *vram_dirty;
22static mame_bitmap *bitmap0;
21static bitmap_t *bitmap0;
2322static tilemap *vram_tilemap;
2423
2524/******************************************************************************/
2625
27static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT16 *spritedata, int gfxbank, UINT16 pri)
26static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16 *spritedata, int gfxbank, UINT16 pri)
2827{
2928   int offs;
3029
r1877r1878
3938
4039      y = spritedata[offs];
4140      flash=y&0x1000;
42      if (flash && (cpu_getcurrentframe() & 1)) continue;
41      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
4342
4443      x = spritedata[offs+2];
4544      colour = (x >>9) & 0xf;
src/mame/video/espial.c
r1877r1878
163163 *
164164 *************************************/
165165
166static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
166static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
167167{
168168   int offs;
169169
src/mame/video/hyperspt.c
r1877r1878
128128   tilemap_set_scroll_rows(bg_tilemap, 32);
129129}
130130
131static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
131static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
132132{
133133   int offs;
134134
src/mame/video/tiamc1.c
r1877r1878
154154   state_save_register_global(tiamc1_bg_hshift);
155155}
156156
157static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
157static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
158158{
159159   int offs;
160160
src/mame/video/toaplan1.c
r1877r1878
119119
120120
121121#include "driver.h"
122#include "deprecat.h"
122123#include "toaplan1.h"
123124#include "cpu/m68000/m68000.h"
124125
r1877r1878
318319
319320static void rallybik_flipscreen(void)
320321{
321   rallybik_bcu_flipscreen_w(0, bcu_flipscreen, 0);
322   rallybik_bcu_flipscreen_w(Machine, 0, bcu_flipscreen, 0);
322323}
323324
324325static void toaplan1_flipscreen(void)
325326{
326   toaplan1_bcu_flipscreen_w(0, bcu_flipscreen, 0);
327   toaplan1_bcu_flipscreen_w(Machine, 0, bcu_flipscreen, 0);
327328}
328329
329330
r1877r1878
531532WRITE16_HANDLER( toaplan1_colorram1_w )
532533{
533534   COMBINE_DATA(&toaplan1_colorram1[offset]);
534   paletteram16_xBBBBBGGGGGRRRRR_word_w(offset, data, mem_mask);
535   paletteram16_xBBBBBGGGGGRRRRR_word_w(machine,offset, data, mem_mask);
535536}
536537
537538/* sprite palette */
r1877r1878
543544WRITE16_HANDLER( toaplan1_colorram2_w )
544545{
545546   COMBINE_DATA(&toaplan1_colorram2[offset]);
546   paletteram16_xBBBBBGGGGGRRRRR_word_w(offset+(toaplan1_colorram1_size/2), data, mem_mask);
547   paletteram16_xBBBBBGGGGGRRRRR_word_w(machine,offset+(toaplan1_colorram1_size/2), data, mem_mask);
547548}
548549
549550READ16_HANDLER( toaplan1_spriteram16_r )
r1877r1878
599600   if (toaplan1_unk_reset_port && toaplan1_reset)
600601   {
601602      toaplan1_reset = 0;
602      toaplan1_reset_sound(0,0,0);
603      toaplan1_reset_sound(machine,0,0,0);
603604   }
604605}
605606
r1877r1878
649650
650651READ16_HANDLER( rallybik_tileram16_r )
651652{
652   UINT16 data = toaplan1_tileram16_r(offset, mem_mask);
653   UINT16 data = toaplan1_tileram16_r(machine, offset, mem_mask);
653654
654655   if (offset == 0)   /* some bit lines may be stuck to others */
655656   {
r1877r1878
941942***************************************************************************/
942943
943944// custom function to draw a single sprite. needed to keep correct sprites - sprites and sprites - tilemaps priorities
944static void toaplan1_draw_sprite_custom(mame_bitmap *dest_bmp,const gfx_element *gfx,
945static void toaplan1_draw_sprite_custom(bitmap_t *dest_bmp,const gfx_element *gfx,
945946      UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
946947      const rectangle *clip,int priority)
947948{
r1877r1878
10401041}
10411042
10421043
1043static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
1044static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
10441045{
10451046   UINT16 *source = (UINT16 *)(buffered_spriteram16);
10461047   UINT16 *size   = (UINT16 *)(toaplan1_buffered_spritesizeram16);
r1877r1878
11061107}
11071108
11081109
1109static void rallybik_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority )
1110static void rallybik_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority )
11101111{
11111112   int offs;
11121113
r1877r1878
11401141
11411142
11421143/***************************************************************************
1143    Draw the game screen in the given mame_bitmap.
1144    Draw the game screen in the given bitmap_t.
11441145***************************************************************************/
11451146
11461147VIDEO_UPDATE( rallybik )
r1877r1878
12291230
12301231VIDEO_EOF( rallybik )
12311232{
1232   buffer_spriteram16_w(0, 0, 0);
1233   buffer_spriteram16_w(machine, 0, 0, 0);
12331234}
12341235
12351236VIDEO_EOF( toaplan1 )
12361237{
1237   buffer_spriteram16_w(0, 0, 0);
1238   buffer_spriteram16_w(machine, 0, 0, 0);
12381239   memcpy(toaplan1_buffered_spritesizeram16, toaplan1_spritesizeram16, TOAPLAN1_SPRITESIZERAM_SIZE);
12391240}
12401241
12411242VIDEO_EOF( samesame )
12421243{
1243   buffer_spriteram16_w(0, 0, 0);
1244   buffer_spriteram16_w(machine, 0, 0, 0);
12441245   memcpy(toaplan1_buffered_spritesizeram16, toaplan1_spritesizeram16, TOAPLAN1_SPRITESIZERAM_SIZE);
12451246   cpunum_set_input_line(machine, 0, MC68000_IRQ_2, HOLD_LINE);   /* Frame done */
12461247}
src/mame/video/segag80r.c
r1877r1878
450450   }
451451
452452   /* handle everything else */
453   segag80r_videoram_w(offset, data);
453   segag80r_videoram_w(machine, offset, data);
454454}
455455
456456
r1877r1878
519519   }
520520
521521   /* handle everything else */
522   segag80r_videoram_w(offset, data);
522   segag80r_videoram_w(machine, offset, data);
523523}
524524
525525
r1877r1878
602602   }
603603
604604   /* handle everything else */
605   segag80r_videoram_w(offset, data);
605   segag80r_videoram_w(machine, offset, data);
606606}
607607
608608
r1877r1878
645645 *
646646 *************************************/
647647
648static void draw_videoram(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, const UINT8 *transparent_pens)
648static void draw_videoram(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT8 *transparent_pens)
649649{
650650   int flipmask = video_flip ? 0x1f : 0x00;
651651   int x, y;
r1877r1878
680680 *
681681 *************************************/
682682
683static void draw_background_spaceod(mame_bitmap *bitmap, const rectangle *cliprect)
683static void draw_background_spaceod(bitmap_t *bitmap, const rectangle *cliprect)
684684{
685   mame_bitmap *pixmap = tilemap_get_pixmap(!(spaceod_bg_control & 0x02) ? spaceod_bg_htilemap : spaceod_bg_vtilemap);
685   bitmap_t *pixmap = tilemap_get_pixmap(!(spaceod_bg_control & 0x02) ? spaceod_bg_htilemap : spaceod_bg_vtilemap);
686686   int flipmask = (spaceod_bg_control & 0x01) ? 0xff : 0x00;
687687   int xoffset = (spaceod_bg_control & 0x02) ? 0x10 : 0x00;
688688   int xmask = pixmap->width - 1;
r1877r1878
737737 *
738738 *************************************/
739739
740static void draw_background_page_scroll(mame_bitmap *bitmap, const rectangle *cliprect)
740static void draw_background_page_scroll(bitmap_t *bitmap, const rectangle *cliprect)
741741{
742   mame_bitmap *pixmap = tilemap_get_pixmap(bg_tilemap);
742   bitmap_t *pixmap = tilemap_get_pixmap(bg_tilemap);
743743   int flipmask = (video_control & 0x08) ? 0xff : 0x00;
744744   int xmask = pixmap->width - 1;
745745   int ymask = pixmap->height - 1;
r1877r1878
777777 *
778778 *************************************/
779779
780static void draw_background_full_scroll(mame_bitmap *bitmap, const rectangle *cliprect)
780static void draw_background_full_scroll(bitmap_t *bitmap, const rectangle *cliprect)
781781{
782   mame_bitmap *pixmap = tilemap_get_pixmap(bg_tilemap);
782   bitmap_t *pixmap = tilemap_get_pixmap(bg_tilemap);
783783   int flipmask = (video_control & 0x08) ? 0x3ff : 0x000;
784784   int xmask = pixmap->width - 1;
785785   int ymask = pixmap->height - 1;
src/mame/video/hnayayoi.c
r1877r1878
214214}
215215
216216
217static void draw_layer_interleaved(mame_bitmap *bitmap, const rectangle *cliprect,
217static void draw_layer_interleaved(bitmap_t *bitmap, const rectangle *cliprect,
218218      int left_pixmap, int right_pixmap, int palbase, int transp)
219219{
220220   int county,countx,pen,offs;
src/mame/video/tmnt.c
r1877r1878
345345      last = data & 0x08;
346346
347347      /* bit 5 = irq enable */
348      interrupt_enable_w(0,data & 0x20);
348      interrupt_enable_w(machine,0,data & 0x20);
349349
350350      /* bit 7 = enable char ROM reading through the video RAM */
351351      K052109_set_RMRD_line((data & 0x80) ? ASSERT_LINE : CLEAR_LINE);
src/mame/video/jpmimpct.c
r1877r1878
116116 *
117117 *************************************/
118118
119void jpmimpct_scanline_update(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params)
119void jpmimpct_scanline_update(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params)
120120{
121121   UINT16 *vram = &tms_vram[(params->rowaddr << 8) & 0x3ff00];
122122   UINT32 *dest = BITMAP_ADDR32(bitmap, scanline, 0);
src/mame/video/zodiack.c
r1877r1878
134134   flip_screen_set_no_update(0);
135135}
136136
137static void draw_bullets(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
137static void draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
138138{
139139   int offs;
140140
r1877r1878
161161   }
162162}
163163
164static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
164static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
165165{
166166   int offs;
167167
src/mame/video/dc.c
r1877r1878
2626static int start_render_received;
2727static int alloc_ctrl_OPB_Mode, alloc_ctrl_PT_OPB, alloc_ctrl_TM_OPB, alloc_ctrl_T_OPB, alloc_ctrl_ZM_OPB, alloc_ctrl_O_OPB;
2828
29static emu_timer *vbout_timer;
30
2931static struct testsprites
3032{
3133   int positionx, positiony;
r1877r1878
301303            a = 1 << 21;
302304            break;
303305         }
304         sysctrl_regs[SB_ISTNRM] |= a;
306         dc_sysctrl_regs[SB_ISTNRM] |= a;
305307         update_interrupt_status();
306308         tafifo_listtype= -1; // no list being received
307309      }
r1877r1878
607609         pvr_parameterconfig[a] = pvr_parameterconfig[a-1];
608610}
609611
612TIMER_CALLBACK(vbout)
613{
614   dc_sysctrl_regs[SB_ISTNRM] |= IST_VBL_OUT; // V Blank-out interrupt
615   update_interrupt_status();
616
617   timer_adjust_oneshot(vbout_timer, attotime_never, 0);
618}
619
610620VIDEO_START(dc)
611621{
612622   memset(pvrctrl_regs, 0, sizeof(pvrctrl_regs));
r1877r1878
627637   testsprites_size=0;
628638   toerasesprites=0;
629639   computedilated();
640
641   vbout_timer = timer_alloc(vbout, 0);
642   timer_adjust_oneshot(vbout_timer, attotime_never, 0);
630643}
631644
632645VIDEO_UPDATE(dc)
633646{
634   int a;
635
636647   if (pvrta_regs[VO_CONTROL] & (1 << 3))
637648   {
638649      fillbitmap(bitmap,pvrta_regs[VO_BORDER_COL] & 0xFFFFFF,cliprect);
r1877r1878
644655   if (start_render_received)
645656   {
646657      start_render_received=0;
647      a=4; // tsp end
648      sysctrl_regs[SB_ISTNRM] |= a;
658      dc_sysctrl_regs[SB_ISTNRM] |= IST_EOR_TSP;   // TSP end of render
649659      update_interrupt_status();
650660   }
651661   return 0;
r1877r1878
653663
654664void dc_vblank(void)
655665{
656   sysctrl_regs[SB_ISTNRM] |= 0x08; // V Blank-in interrupt
666   dc_sysctrl_regs[SB_ISTNRM] |= IST_VBL_IN; // V Blank-in interrupt
657667   update_interrupt_status();
668
669   timer_adjust_oneshot(vbout_timer, video_screen_get_time_until_pos(0, 0, 0), 0);
658670}
659671
src/mame/video/taitojc.c
r1877r1878
33#include "video/poly.h"
44
55UINT8 *taitojc_texture;
6static mame_bitmap *framebuffer;
7static mame_bitmap *zbuffer;
6static bitmap_t *framebuffer;
7static bitmap_t *zbuffer;
88
99extern UINT32 *taitojc_vram;
1010extern UINT32 *taitojc_objlist;
r1877r1878
103103// 0x01:   -------- --x----- -------- --------   Priority (0 = below 3D, 1 = above 3D)
104104// 0x01:   -------- -------- -xxxxxxx xxxxxxxx   VRAM data address
105105
106static void draw_object(mame_bitmap *bitmap, const rectangle *cliprect, UINT32 w1, UINT32 w2)
106static void draw_object(bitmap_t *bitmap, const rectangle *cliprect, UINT32 w1, UINT32 w2)
107107{
108108   int x, y, width, height, palette;
109109   int i, j;
r1877r1878
315315
316316static void render_solid_scan(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
317317{
318   mame_bitmap *destmap = dest;
318   bitmap_t *destmap = dest;
319319   float z = extent->param[0].start;
320320   int color = extent->param[1].start;
321321   float dz = extent->param[0].dpdx;
r1877r1878
339339
340340static void render_shade_scan(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
341341{
342   mame_bitmap *destmap = dest;
342   bitmap_t *destmap = dest;
343343   float z = extent->param[0].start;
344344   float color = extent->param[1].start;
345345   float dz = extent->param[0].dpdx;
r1877r1878
367367static void render_texture_scan(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
368368{
369369   const poly_extra_data *extra = extradata;
370   mame_bitmap *destmap = dest;
370   bitmap_t *destmap = dest;
371371   float z = extent->param[0].start;
372372   float u = extent->param[1].start;
373373   float v = extent->param[2].start;
src/mame/video/pitnrun.c
r1877r1878
2424static int pitnrun_scroll;
2525static int pitnrun_char_bank;
2626static int pitnrun_color_select;
27static mame_bitmap *tmp_bitmap[4];
27static bitmap_t *tmp_bitmap[4];
2828static tilemap *bg, *fg;
2929UINT8* pitnrun_videoram2;
3030
r1877r1878
187187   pitnrun_spotlights();
188188}
189189
190static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
190static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
191191{
192192   int sx, sy, flipx, flipy, offs,pal;
193193
src/mame/video/segaic16.c
r1877r1878
408408   struct tilemap_callback_info tilemap_info[16];   /* callback info for 16 tilemap pages */
409409   struct tilemap_callback_info textmap_info;      /* callback info for a single textmap page */
410410   void         (*reset)(struct tilemap_info *info);/* reset callback */
411   void         (*draw_layer)(running_machine *machine, struct tilemap_info *info, mame_bitmap *bitmap, const rectangle *cliprect, int which, int flags, int priority);
411   void         (*draw_layer)(running_machine *machine, struct tilemap_info *info, bitmap_t *bitmap, const rectangle *cliprect, int which, int flags, int priority);
412412   UINT16 *      textram;                  /* pointer to textram pointer */
413413   UINT16 *      tileram;                  /* pointer to tileram pointer */
414414};
r1877r1878
424424   UINT16         colorbase;                  /* base color index */
425425   INT32         ramsize;                  /* size of sprite RAM */
426426   INT32         xoffs;                     /* X scroll offset */
427   void         (*draw)(struct sprite_info *info, mame_bitmap *bitmap, const rectangle *cliprect);
427   void         (*draw)(struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect);
428428   UINT16 *      spriteram;                  /* pointer to spriteram pointer */
429429   UINT16 *      buffer;                     /* buffered spriteram for those that use it */
430430};
r1877r1878
439439   UINT16         colorbase2;                  /* color base for road background data */
440440   UINT16         colorbase3;                  /* color base for sky data */
441441   INT32         xoffs;                     /* X scroll offset */
442   void         (*draw)(struct road_info *info, mame_bitmap *bitmap, const rectangle *cliprect, int priority);
442   void         (*draw)(struct road_info *info, bitmap_t *bitmap, const rectangle *cliprect, int priority);
443443   UINT16 *      roadram;                  /* pointer to roadram pointer */
444444   UINT16 *      buffer;                     /* buffered roadram pointer */
445445   UINT8 *         gfx;                     /* expanded road graphics */
r1877r1878
605605 *
606606 *************************************/
607607
608static void segaic16_draw_virtual_tilemap(running_machine *machine, struct tilemap_info *info, mame_bitmap *bitmap, const rectangle *cliprect, UINT16 pages, UINT16 xscroll, UINT16 yscroll, UINT32 flags, UINT32 priority)
608static void segaic16_draw_virtual_tilemap(running_machine *machine, struct tilemap_info *info, bitmap_t *bitmap, const rectangle *cliprect, UINT16 pages, UINT16 xscroll, UINT16 yscroll, UINT32 flags, UINT32 priority)
609609{
610610   int leftmin = -1, leftmax = -1, rightmin = -1, rightmax = -1;
611611   int topmin = -1, topmax = -1, bottommin = -1, bottommax = -1;
r1877r1878
828828}
829829
830830
831static void segaic16_tilemap_16a_draw_layer(running_machine *machine, struct tilemap_info *info, mame_bitmap *bitmap, const rectangle *cliprect, int which, int flags, int priority)
831static void segaic16_tilemap_16a_draw_layer(running_machine *machine, struct tilemap_info *info, bitmap_t *bitmap, const rectangle *cliprect, int which, int flags, int priority)
832832{
833833   UINT16 *textram = info->textram;
834834
r1877r1878
10701070}
10711071
10721072
1073static void segaic16_tilemap_16b_draw_layer(running_machine *machine, struct tilemap_info *info, mame_bitmap *bitmap, const rectangle *cliprect, int which, int flags, int priority)
1073static void segaic16_tilemap_16b_draw_layer(running_machine *machine, struct tilemap_info *info, bitmap_t *bitmap, const rectangle *cliprect, int which, int flags, int priority)
10741074{
10751075   UINT16 *textram = info->textram;
10761076   UINT16 xscroll, yscroll, pages;
r1877r1878
12001200void segaic16_tilemap_init(int which, int type, int colorbase, int xoffs, int numbanks)
12011201{
12021202   struct tilemap_info *info = &bg_tilemap[which];
1203   tile_get_info_callback get_text_info;
1204   tile_get_info_callback get_tile_info;
1203   tile_get_info_func get_text_info;
1204   tile_get_info_func get_tile_info;
12051205   int pagenum;
12061206   int i;
12071207
r1877r1878
13041304 *
13051305 *************************************/
13061306
1307void segaic16_tilemap_draw(running_machine *machine, int which, mame_bitmap *bitmap, const rectangle *cliprect, int map, int priority, int priority_mark)
1307void segaic16_tilemap_draw(running_machine *machine, int which, bitmap_t *bitmap, const rectangle *cliprect, int map, int priority, int priority_mark)
13081308{
13091309   struct tilemap_info *info = &bg_tilemap[which];
13101310
r1877r1878
14931493      pri[x] = 0xff;                                          \
14941494   }                                                      \
14951495
1496static void segaic16_sprites_hangon_draw(struct sprite_info *info, mame_bitmap *bitmap, const rectangle *cliprect)
1496static void segaic16_sprites_hangon_draw(struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect)
14971497{
14981498   UINT8 numbanks = memory_region_length(REGION_GFX2) / 0x10000;
14991499   const UINT16 *spritebase = (const UINT16 *)memory_region(REGION_GFX2);
r1877r1878
16571657      pri[x] = 0xff;                                          \
16581658   }                                                      \
16591659
1660static void segaic16_sprites_sharrier_draw(struct sprite_info *info, mame_bitmap *bitmap, const rectangle *cliprect)
1660static void segaic16_sprites_sharrier_draw(struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect)
16611661{
16621662   UINT8 numbanks = memory_region_length(REGION_GFX2) / 0x20000;
16631663   const UINT32 *spritebase = (const UINT32 *)memory_region(REGION_GFX2);
r1877r1878
18271827      pri[x] = 0xff;                                          \
18281828   }                                                      \
18291829
1830static void segaic16_sprites_16a_draw(struct sprite_info *info, mame_bitmap *bitmap, const rectangle *cliprect)
1830static void segaic16_sprites_16a_draw(struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect)
18311831{
18321832   UINT8 numbanks = memory_region_length(REGION_GFX2) / 0x10000;
18331833   const UINT16 *spritebase = (const UINT16 *)memory_region(REGION_GFX2);
r1877r1878
19821982      pri[x] = 0xff;                                          \
19831983   }                                                      \
19841984
1985static void segaic16_sprites_16b_draw(struct sprite_info *info, mame_bitmap *bitmap, const rectangle *cliprect)
1985static void segaic16_sprites_16b_draw(struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect)
19861986{
19871987   UINT8 numbanks;
19881988   const UINT16 *spritebase;
r1877r1878
21402140      pri[x] = 0;                                             \
21412141   }                                                      \
21422142
2143static void segaic16_sprites_yboard_16b_draw(struct sprite_info *info, mame_bitmap *bitmap, const rectangle *cliprect)
2143static void segaic16_sprites_yboard_16b_draw(struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect)
21442144{
21452145   UINT8 numbanks = memory_region_length(REGION_GFX2) / 0x20000;
21462146   const UINT16 *spritebase = (const UINT16 *)memory_region(REGION_GFX2);
r1877r1878
23172317      pri[x] = 0xff;                                          \
23182318   }                                                      \
23192319
2320static void segaic16_sprites_outrun_draw(struct sprite_info *info, mame_bitmap *bitmap, const rectangle *cliprect)
2320static void segaic16_sprites_outrun_draw(struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect)
23212321{
23222322   UINT8 numbanks = memory_region_length(REGION_GFX2) / 0x40000;
23232323   const UINT32 *spritebase = (const UINT32 *)memory_region(REGION_GFX2);
r1877r1878
24782478   if (x >= minx && x <= maxx && ind < 0x1fe)                        \
24792479      dest[x] = ind | colorpri;                                 \
24802480
2481static void segaic16_sprites_yboard_draw(struct sprite_info *info, mame_bitmap *bitmap, const rectangle *cliprect)
2481static void segaic16_sprites_yboard_draw(struct sprite_info *info, bitmap_t *bitmap, const rectangle *cliprect)
24822482{
24832483   UINT8 numbanks = memory_region_length(REGION_GFX1) / 0x80000;
24842484   const UINT64 *spritebase = (const UINT64 *)memory_region(REGION_GFX1);
r1877r1878
27412741 *
27422742 *************************************/
27432743
2744void segaic16_sprites_draw(int which, mame_bitmap *bitmap, const rectangle *cliprect)
2744void segaic16_sprites_draw(int which, bitmap_t *bitmap, const rectangle *cliprect)
27452745{
27462746   struct sprite_info *info = &sprites[which];
27472747   (*info->draw)(info, bitmap, cliprect);
r1877r1878
29092909}
29102910
29112911
2912static void segaic16_road_hangon_draw(struct road_info *info, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
2912static void segaic16_road_hangon_draw(struct road_info *info, bitmap_t *bitmap, const rectangle *cliprect, int priority)
29132913{
29142914   UINT16 *roadram = info->roadram;
29152915   int x, y;
r1877r1878
31773177}
31783178
31793179
3180static void segaic16_road_outrun_draw(struct road_info *info, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
3180static void segaic16_road_outrun_draw(struct road_info *info, bitmap_t *bitmap, const rectangle *cliprect, int priority)
31813181{
31823182   UINT16 *roadram = info->buffer;
31833183   int x, y;
r1877r1878
34033403 *
34043404 *************************************/
34053405
3406void segaic16_road_draw(int which, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
3406void segaic16_road_draw(int which, bitmap_t *bitmap, const rectangle *cliprect, int priority)
34073407{
34083408   struct road_info *info = &road[which];
34093409   (*info->draw)(info, bitmap, cliprect, priority);
r1877r1878
35033503 *
35043504 *************************************/
35053505
3506void segaic16_rotate_draw(int which, mame_bitmap *bitmap, const rectangle *cliprect, mame_bitmap *srcbitmap)
3506void segaic16_rotate_draw(int which, bitmap_t *bitmap, const rectangle *cliprect, bitmap_t *srcbitmap)
35073507{
35083508   struct rotate_info *info = &rotate[which];
35093509   INT32 currx = (info->buffer[0x3f0] << 16) | info->buffer[0x3f1];
src/mame/video/midzeus2.c
r1877r1878
169169   return WAVERAM_BLOCK1(blocknum);
170170}
171171
172#ifdef UNUSED_FUNCTON
172173INLINE void *waveram0_ptr_from_texture_addr(UINT32 addr, int width)
173174{
174175   UINT32 blocknum = ((addr & ~1) * width) / 8;
175176   return WAVERAM_BLOCK0(blocknum);
176177}
178#endif
177179
178180
179
180181/*************************************
181182 *
182183 *  Inlines for rendering
183184 *
184185 *************************************/
185186
187#ifdef UNUSED_FUNCTON
186188INLINE void waveram_plot(int y, int x, UINT32 color)
187189{
188190   if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y)
189191      WAVERAM_WRITEPIX(zeus_renderbase, y, x, color);
190192}
193#endif
191194
192195INLINE void waveram_plot_depth(int y, int x, UINT32 color, UINT16 depth)
193196{
r1877r1878
198201   }
199202}
200203
204#ifdef UNUSED_FUNCTON
201205INLINE void waveram_plot_check_depth(int y, int x, UINT32 color, UINT16 depth)
202206{
203207   if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y)
r1877r1878
210214      }
211215   }
212216}
217#endif
213218
219#ifdef UNUSED_FUNCTON
214220INLINE void waveram_plot_check_depth_nowrite(int y, int x, UINT32 color, UINT16 depth)
215221{
216222   if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y)
r1877r1878
220226         WAVERAM_WRITEPIX(zeus_renderbase, y, x, color);
221227   }
222228}
229#endif
223230
224231
225
226232/*************************************
227233 *
228234 *  Inlines for texel accesses
r1877r1878
236242}
237243
238244
245#ifdef UNUSED_FUNCTON
239246INLINE UINT8 get_texel_4bit(const void *base, int y, int x, int width)
240247{
241248   UINT32 byteoffs = (y / 2) * (width * 2) + ((x / 8) << 3) + ((y & 1) << 2) + ((x / 2) & 3);
242249   return (WAVERAM_READ8(base, byteoffs) >> (4 * (x & 1))) & 0x0f;
243250}
251#endif
244252
245253
246
247254/*************************************
248255 *
249256 *  Video startup
r1877r1878
10361043
10371044static void zeus_draw_quad(const UINT32 *databuffer, UINT32 texoffs, int logit)
10381045{
1039   poly_draw_scanline callback;
1046   poly_draw_scanline_func callback;
10401047   poly_extra_data *extra;
10411048   poly_vertex clipvert[8];
10421049   poly_vertex vert[4];
src/mame/video/liberatr.c
r1877r1878
305305}
306306
307307
308static void liberatr_draw_planet(mame_bitmap *bitmap, pen_t *pens)
308static void liberatr_draw_planet(bitmap_t *bitmap, pen_t *pens)
309309{
310310   UINT8 latitude;
311311
r1877r1878
345345}
346346
347347
348static void liberatr_draw_bitmap(running_machine *machine, mame_bitmap *bitmap, pen_t *pens)
348static void liberatr_draw_bitmap(running_machine *machine, bitmap_t *bitmap, pen_t *pens)
349349{
350350   offs_t offs;
351351
src/mame/video/tehkanwc.c
r1877r1878
119119   bit 7 = enable (0 = display off)
120120 */
121121
122static void gridiron_draw_led(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT8 led,int player)
122static void gridiron_draw_led(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8 led,int player)
123123{
124124   int i;
125125
r1877r1878
155155else logerror("unknown LED %02x for player %d\n",led,player);
156156}
157157
158static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
158static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
159159{
160160   int offs;
161161
src/mame/video/bionicc.c
r1877r1878
135135    when intensity is zero the colour is not reduced to pure black, (the sky should stay
136136    at dark blue rather than absolute black) */
137137   data = COMBINE_DATA(&paletteram16[offset]);
138   paletteram16_RRRRGGGGBBBBIIII_word_w(offset,(data & 0xfff0) | ((data & 0x0007) << 1) | 1, 0);
138   paletteram16_RRRRGGGGBBBBIIII_word_w(machine,offset,(data & 0xfff0) | ((data & 0x0007) << 1) | 1, 0);
139139}
140140
141141WRITE16_HANDLER( bionicc_scroll_w )
r1877r1878
183183
184184***************************************************************************/
185185
186static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
186static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
187187{
188188   int offs;
189189   const gfx_element *gfx = machine->gfx[3];
r1877r1878
231231
232232VIDEO_EOF( bionicc )
233233{
234   buffer_spriteram16_w(0,0,0);
234   buffer_spriteram16_w(machine,0,0,0);
235235}
src/mame/video/segaic16.h
r1877r1878
3434
3535void segaic16_tilemap_init(int which, int type, int colorbase, int xoffs, int numbanks);
3636void segaic16_tilemap_reset(int which);
37void segaic16_tilemap_draw(running_machine *machine, int which, mame_bitmap *bitmap, const rectangle *cliprect, int map, int priority, int priority_mark);
37void segaic16_tilemap_draw(running_machine *machine, int which, bitmap_t *bitmap, const rectangle *cliprect, int map, int priority, int priority_mark);
3838void segaic16_tilemap_set_bank(int which, int banknum, int offset);
3939void segaic16_tilemap_set_flip(int which, int flip);
4040void segaic16_tilemap_set_rowscroll(int which, int enable);
r1877r1878
5656#define SEGAIC16_SPRITES_YBOARD_16B   7
5757
5858void segaic16_sprites_init(int which, int type, int colorbase, int xoffs);
59void segaic16_sprites_draw(int which, mame_bitmap *bitmap, const rectangle *cliprect);
59void segaic16_sprites_draw(int which, bitmap_t *bitmap, const rectangle *cliprect);
6060void segaic16_sprites_set_bank(int which, int banknum, int offset);
6161void segaic16_sprites_set_flip(int which, int flip);
6262void segaic16_sprites_set_shadow(int which, int shadow);
r1877r1878
7575#define SEGAIC16_ROAD_FOREGROUND   1
7676
7777void segaic16_road_init(int which, int type, int colorbase1, int colorbase2, int colorbase3, int xoffs);
78void segaic16_road_draw(int which, mame_bitmap *bitmap, const rectangle *cliprect, int priority);
78void segaic16_road_draw(int which, bitmap_t *bitmap, const rectangle *cliprect, int priority);
7979READ16_HANDLER( segaic16_road_control_0_r );
8080WRITE16_HANDLER( segaic16_road_control_0_w );
8181
r1877r1878
8585#define SEGAIC16_ROTATE_YBOARD      0
8686
8787void segaic16_rotate_init(int which, int type, int colorbase);
88void segaic16_rotate_draw(int which, mame_bitmap *bitmap, const rectangle *cliprect, mame_bitmap *srcbitmap);
88void segaic16_rotate_draw(int which, bitmap_t *bitmap, const rectangle *cliprect, bitmap_t *srcbitmap);
8989READ16_HANDLER( segaic16_rotate_control_0_r );
src/mame/video/citycon.c
r1877r1878
108108
109109
110110
111static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
111static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
112112{
113113   int offs;
114114
src/mame/video/psikyo.c
r1877r1878
289289
290290***************************************************************************/
291291
292static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int trans_pen)
292static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int trans_pen)
293293{
294294   /* tile layers 0 & 1 have priorities 1 & 2 */
295295   static const int pri[] = { 0, 0xfc, 0xff, 0xff };
src/mame/video/playmark.c
r1877r1878
328328
329329***************************************************************************/
330330
331static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int codeshift)
331static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int codeshift)
332332{
333333   int offs, start_offset = spriteram_size/2 - 4;
334334   int height = machine->gfx[0]->height;
r1877r1878
369369   }
370370}
371371
372static void draw_bitmap(mame_bitmap *bitmap, const rectangle *cliprect)
372static void draw_bitmap(bitmap_t *bitmap, const rectangle *cliprect)
373373{
374374   int x,y,count;
375375   int color;
src/mame/video/esd16.c
r1877r1878
179179
180180***************************************************************************/
181181
182static void esd16_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
182static void esd16_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
183183{
184184   int offs;
185185
r1877r1878
235235}
236236
237237/* note, check if i can re-merge this with the other or if its really different */
238static void hedpanic_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
238static void hedpanic_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
239239{
240240   int offs;
241241
src/mame/video/pgm.c
r1877r1878
112112   }
113113}
114114/* this just loops over our decoded bitmap and puts it on the screen */
115static void draw_sprite_new_zoomed(int wide, int high, int xpos, int ypos, int palt, int boffset, int flip, mame_bitmap* bitmap, UINT32 xzoom, int xgrow, UINT32 yzoom, int ygrow )
115static void draw_sprite_new_zoomed(int wide, int high, int xpos, int ypos, int palt, int boffset, int flip, bitmap_t* bitmap, UINT32 xzoom, int xgrow, UINT32 yzoom, int ygrow )
116116{
117117   int ycnt;
118118   int ydrawpos;
r1877r1878
183183
184184static UINT16 *pgm_sprite_source;
185185
186static void draw_sprites(int priority, mame_bitmap* bitmap)
186static void draw_sprites(int priority, bitmap_t* bitmap)
187187{
188188   /* ZZZZ Zxxx xxxx xxxx
189189       zzzz z-yy yyyy yyyy
src/mame/video/namcos21.c
r1877r1878
100100} /* namcos21_ClearPolyFrameBuffer */
101101
102102static void
103CopyVisiblePolyFrameBuffer( mame_bitmap *bitmap, const rectangle *clip, int zlo, int zhi )
103CopyVisiblePolyFrameBuffer( bitmap_t *bitmap, const rectangle *clip, int zlo, int zhi )
104104{ /* blit the visible framebuffer */
105105   int sy;
106106   for( sy=clip->min_y; sy<=clip->max_y; sy++ )
src/mame/video/model3.c
r1877r1878
106106
107107static int real3d_display_list = 0;
108108
109static mame_bitmap *bitmap3d;
110static mame_bitmap *zbuffer;
109static bitmap_t *bitmap3d;
110static bitmap_t *zbuffer;
111111static rectangle clip3d;
112112static rectangle *screen_clip;
113113
r1877r1878
178178   init_matrix_stack();
179179}
180180
181static void draw_tile_4bit(mame_bitmap *bitmap, int tx, int ty, int tilenum)
181static void draw_tile_4bit(bitmap_t *bitmap, int tx, int ty, int tilenum)
182182{
183183   int x, y;
184184   UINT8 *tile_base = (UINT8*)m3_char_ram;
r1877r1878
213213   }
214214}
215215
216static void draw_tile_8bit(mame_bitmap *bitmap, int tx, int ty, int tilenum)
216static void draw_tile_8bit(bitmap_t *bitmap, int tx, int ty, int tilenum)
217217{
218218   int x, y;
219219   UINT8 *tile_base = (UINT8*)m3_char_ram;
r1877r1878
244244   }
245245}
246246#if 0
247static void draw_texture_sheet(mame_bitmap *bitmap, const rectangle *cliprect)
247static void draw_texture_sheet(bitmap_t *bitmap, const rectangle *cliprect)
248248{
249249   int x,y;
250250   for(y = cliprect->min_y; y <= cliprect->max_y; y++)
r1877r1878
262262}
263263#endif
264264
265static void draw_layer(mame_bitmap *bitmap, const rectangle *cliprect, int layer, int bitdepth)
265static void draw_layer(bitmap_t *bitmap, const rectangle *cliprect, int layer, int bitdepth)
266266{
267267   int x, y;
268268   int tile_index = 0;
r1877r1878
337337}
338338
339339#ifdef UNUSED_FUNCTION
340static void copy_screen(mame_bitmap *bitmap, const rectangle *cliprect)
340static void copy_screen(bitmap_t *bitmap, const rectangle *cliprect)
341341{
342342   int x,y;
343343   for(y=cliprect->min_y; y <= cliprect->max_y; y++) {
r1877r1878
707707   }
708708}
709709
710#ifdef UNUSED_FUNCTON
710711INLINE void write_texture8(int xpos, int ypos, int width, int height, int page, UINT16 *data)
711712{
712713   int x,y,i,j;
r1877r1878
729730      }
730731   }
731732}
733#endif
732734
733735static void real3d_upload_texture(UINT32 header, UINT32 *data)
734736{
r1877r1878
882884/*****************************************************************************/
883885/* matrix and vector operations */
884886
887#ifdef UNUSED_FUNCTON
885888INLINE float dot_product(VECTOR a, VECTOR b)
886889{
887890   return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);
888891}
892#endif
889893
890894INLINE float dot_product3(VECTOR3 a, VECTOR3 b)
891895{
r1877r1878
10571061   return clip_verts;
10581062}
10591063
1064#ifdef UNUSED_DEFINITION
10601065static const int num_bits[16] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 };
1066#endif
10611067
10621068static MATRIX coordinate_system;
10631069static float viewport_focal_length = 300;
r1877r1878
10711077static void render_one(TRIANGLE *tri)
10721078{
10731079   poly_extra_data *extra = poly_get_extra_data(poly);
1074   poly_draw_scanline callback = NULL;
1080   poly_draw_scanline_func callback = NULL;
10751081
10761082   tri->v[0].pz = 1.0f / tri->v[0].pz;
10771083   tri->v[1].pz = 1.0f / tri->v[1].pz;
r1877r1878
13121318      }
13131319      return &culling_ram[address];
13141320   }
1315   return NULL;
13161321}
13171322
13181323static void load_matrix(int matrix_num, MATRIX *out)
src/mame/video/gameplan.c
r1877r1878
144144static TIMER_CALLBACK( clear_screen_done_callback )
145145{
146146   /* indicate that the we are done clearing the screen */
147   via_0_ca1_w(0, 0);
147   via_0_ca1_w(machine, 0, 0);
148148}
149149
150150
151151static WRITE8_HANDLER( video_command_trigger_w )
152152{
153   gameplan_state *state = Machine->driver_data;
153   gameplan_state *state = machine->driver_data;
154154
155155   if (data == 0)
156156   {
r1877r1878
193193      /* clear screen */
194194      case 3:
195195         /* indicate that the we are busy */
196         via_0_ca1_w(0, 1);
196         via_0_ca1_w(machine, 0, 1);
197197
198198         memset(state->videoram, state->video_data & 0x0f, state->videoram_size);
199199
r1877r1878
265265   gameplan_state *state = machine->driver_data;
266266
267267   /* !VBLANK is connected to CA1 */
268   via_0_ca1_w(0, (UINT8)param);
268   via_0_ca1_w(machine, 0, (UINT8)param);
269269
270270   if (param)
271271      timer_adjust_oneshot(state->via_0_ca1_timer, video_screen_get_time_until_pos(0, VBSTART, 0), 0);
src/mame/video/ikki.c
r1877r1878
1212
1313UINT8 *ikki_scroll;
1414
15static mame_bitmap *sprite_bitmap;
15static bitmap_t *sprite_bitmap;
1616static UINT8 ikki_flipscreen;
1717static int punch_through_pen;
1818
r1877r1878
6565}
6666
6767
68static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
68static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
6969{
7070   int y;
7171   offs_t offs;
src/mame/video/capbowl.c
r1877r1878
6767      col ^= 2;
6868
6969   /* Row address (RA0-RA8) is not dependent on the offset */
70   tms34061_w(col, *capbowl_rowaddress, func, data);
70   tms34061_w(machine, col, *capbowl_rowaddress, func, data);
7171}
7272
7373
r1877r1878
8282      col ^= 2;
8383
8484   /* Row address (RA0-RA8) is not dependent on the offset */
85   return tms34061_r(col, *capbowl_rowaddress, func);
85   return tms34061_r(machine, col, *capbowl_rowaddress, func);
8686}
8787
8888
src/mame/video/darius.c
r1877r1878
6969
7070/***************************************************************************/
7171
72static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int primask, int x_offs, int y_offs)
72static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int primask, int x_offs, int y_offs)
7373{
7474   int offs,curx,cury;
7575   UINT16 code,data,sx,sy;
src/mame/video/cbasebal.c
r1877r1878
138138
139139***************************************************************************/
140140
141static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
141static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
142142{
143143   int offs,sx,sy;
144144
src/mame/video/st0016.c
r1877r1878
2020static int st0016_ramgfx;
2121
2222//super eagle shot
23static mame_bitmap *speglsht_bitmap;
23static bitmap_t *speglsht_bitmap;
2424extern UINT32 *speglsht_framebuffer;
2525extern UINT32  speglsht_videoreg;
2626
r1877r1878
196196         if( srcadr < (memory_region_length(REGION_CPU1)-0x10000) && (dstadr < ST0016_MAX_CHAR_BANK*ST0016_CHAR_BANK_SIZE))
197197         {
198198            st0016_char_bank=dstadr>>5;
199            st0016_character_ram_w(dstadr&0x1f,memory_region(REGION_CPU1)[0x10000+srcadr]);
199            st0016_character_ram_w(machine,dstadr&0x1f,memory_region(REGION_CPU1)[0x10000+srcadr]);
200200            srcadr++;
201201            dstadr++;
202202            length--;
r1877r1878
212212   }
213213}
214214
215static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
215static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
216216{
217217   /*
218218    object ram :
r1877r1878
421421static void st0016_postload(void)
422422{
423423   int i;
424   st0016_rom_bank_w(0,st0016_rom_bank);
424   st0016_rom_bank_w(Machine,0,st0016_rom_bank);
425425   for(i=0;i<ST0016_MAX_CHAR_BANK;i++)
426426      decodechar(Machine->gfx[st0016_ramgfx], i,(UINT8 *) st0016_charram);
427427}
r1877r1878
503503}
504504
505505
506static void draw_bgmap(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect, int priority)
506static void draw_bgmap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect, int priority)
507507{
508508   int j;
509509   //for(j=0x40-8;j>=0;j-=8)
src/mame/video/sbasketb.c
r1877r1878
135135   tilemap_set_scroll_cols(bg_tilemap, 32);
136136}
137137
138static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
138static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
139139{
140140   int offs = (*sbasketb_spriteram_select & 0x01) * 0x100;
141141   int i;
src/mame/video/funkyjet.c
r1877r1878
55***************************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
98#include "deco16ic.h"
109
1110/******************************************************************************/
r1877r1878
1514   deco16_1_video_init();
1615}
1716
18static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
17static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
1918{
2019   int offs;
2120
r1877r1878
2726
2827      y = spriteram16[offs];
2928      flash=y&0x1000;
30      if (flash && (cpu_getcurrentframe() & 1)) continue;
29      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
3130
3231      x = spriteram16[offs+2];
3332      colour = (x >>9) & 0x1f;
src/mame/video/qix.c
r1877r1878
1919 *
2020 *************************************/
2121
22static void qix_display_enable_changed(running_machine *machine, mc6845_t *mc6845, int display_enabled);
22static MC6845_BEGIN_UPDATE( begin_update );
23static MC6845_UPDATE_ROW( update_row );
24static MC6845_ON_DE_CHANGED( display_enable_changed );
2325
24static void *qix_begin_update(running_machine *machine, mc6845_t *mc6845, mame_bitmap *bitmap, const rectangle *cliprect);
2526
26static void qix_update_row(running_machine *machine,
27                     mc6845_t *mc6845,
28                     mame_bitmap *bitmap,
29                     const rectangle *cliprect,
30                     UINT16 ma,
31                     UINT8 ra,
32                     UINT16 y,
33                     UINT8 x_count,
34                     INT8 cursor_x,
35                     void *param);
3627
37
38
3928/*************************************
4029 *
4130 *  Start
r1877r1878
6756 *
6857 *************************************/
6958
70static void qix_display_enable_changed(running_machine *machine, mc6845_t *mc6845, int display_enabled)
59static MC6845_ON_DE_CHANGED( display_enable_changed )
7160{
7261   qix_state *state = machine->driver_data;
7362
r1877r1878
299288
300289/*************************************
301290 *
302 *  M6845 access
303 *
304 *************************************/
305
306static WRITE8_HANDLER( qix_mc6845_address_w )
307{
308   qix_state *state = Machine->driver_data;
309
310   mc6845_address_w(state->mc6845, data);
311}
312
313
314static READ8_HANDLER( qix_mc6845_register_r )
315{
316   qix_state *state = Machine->driver_data;
317
318   return mc6845_register_r(state->mc6845);
319}
320
321
322static WRITE8_HANDLER( qix_mc6845_register_w )
323{
324   qix_state *state = Machine->driver_data;
325
326   mc6845_register_w(state->mc6845, data);
327}
328
329
330
331/*************************************
332 *
333291 *  M6845 callbacks for updating
334292 *  the screen
335293 *
336294 *************************************/
337295
338static void *qix_begin_update(running_machine *machine, mc6845_t *mc6845, mame_bitmap *bitmap, const rectangle *cliprect)
296static MC6845_BEGIN_UPDATE( begin_update )
339297{
340298   qix_state *state = machine->driver_data;
341299
r1877r1878
353311}
354312
355313
356static void qix_update_row(running_machine *machine, mc6845_t *mc6845, mame_bitmap *bitmap, const rectangle *cliprect,
357                     UINT16 ma, UINT8 ra, UINT16 y, UINT8 x_count, INT8 cursor_x, void *param)
314static MC6845_UPDATE_ROW( update_row )
315
358316{
359317   qix_state *state = machine->driver_data;
360318   UINT16 x;
r1877r1878
408366   AM_RANGE(0x9400, 0x9400) AM_MIRROR(0x03fc) AM_READWRITE(qix_addresslatch_r, qix_addresslatch_w)
409367   AM_RANGE(0x9402, 0x9403) AM_MIRROR(0x03fc) AM_WRITE(MWA8_RAM) AM_BASE_MEMBER(qix_state, videoram_address)
410368   AM_RANGE(0x9800, 0x9800) AM_MIRROR(0x03ff) AM_READ(MRA8_RAM) AM_BASE_MEMBER(qix_state, scanline_latch)
411   AM_RANGE(0x9c00, 0x9c00) AM_MIRROR(0x03fe) AM_WRITE(qix_mc6845_address_w)
412   AM_RANGE(0x9c01, 0x9c01) AM_MIRROR(0x03fe) AM_READWRITE(qix_mc6845_register_r, qix_mc6845_register_w)
369   AM_RANGE(0x9c00, 0x9c00) AM_MIRROR(0x03fe) AM_DEVWRITE(MC6845, "vid-u18", mc6845_address_w)
370   AM_RANGE(0x9c01, 0x9c01) AM_MIRROR(0x03fe) AM_DEVREADWRITE(MC6845, "vid-u18", mc6845_register_r, mc6845_register_w)
413371   AM_RANGE(0xa000, 0xffff) AM_ROM
414372ADDRESS_MAP_END
415373
r1877r1878
426384   AM_RANGE(0x9400, 0x9400) AM_MIRROR(0x03fc) AM_READWRITE(qix_addresslatch_r, qix_addresslatch_w)
427385   AM_RANGE(0x9402, 0x9403) AM_MIRROR(0x03fc) AM_WRITE(MWA8_RAM) AM_BASE_MEMBER(qix_state, videoram_address)
428386   AM_RANGE(0x9800, 0x9800) AM_MIRROR(0x03ff) AM_READ(MRA8_RAM) AM_BASE_MEMBER(qix_state, scanline_latch)
429   AM_RANGE(0x9c00, 0x9c00) AM_MIRROR(0x03fe) AM_WRITE(qix_mc6845_address_w)
430   AM_RANGE(0x9c01, 0x9c01) AM_MIRROR(0x03fe) AM_READWRITE(qix_mc6845_register_r, qix_mc6845_register_w)
387   AM_RANGE(0x9c00, 0x9c00) AM_MIRROR(0x03fe) AM_DEVWRITE(MC6845, "vid-u18", mc6845_address_w)
388   AM_RANGE(0x9c01, 0x9c01) AM_MIRROR(0x03fe) AM_DEVREADWRITE(MC6845, "vid-u18", mc6845_register_r, mc6845_register_w)
431389   AM_RANGE(0xa000, 0xbfff) AM_ROMBANK(1)
432390   AM_RANGE(0xc000, 0xffff) AM_ROM
433391ADDRESS_MAP_END
r1877r1878
445403   AM_RANGE(0x9401, 0x9401) AM_MIRROR(0x03fc) AM_WRITE(MWA8_RAM) AM_BASE_MEMBER(qix_state, videoram_mask)
446404   AM_RANGE(0x9402, 0x9403) AM_MIRROR(0x03fc) AM_WRITE(MWA8_RAM) AM_BASE_MEMBER(qix_state, videoram_address)
447405   AM_RANGE(0x9800, 0x9800) AM_MIRROR(0x03ff) AM_READ(MRA8_RAM) AM_BASE_MEMBER(qix_state, scanline_latch)
448   AM_RANGE(0x9c00, 0x9c00) AM_MIRROR(0x03fe) AM_WRITE(qix_mc6845_address_w)
449   AM_RANGE(0x9c01, 0x9c01) AM_MIRROR(0x03fe) AM_READWRITE(qix_mc6845_register_r, qix_mc6845_register_w)
406   AM_RANGE(0x9c00, 0x9c00) AM_MIRROR(0x03fe) AM_DEVWRITE(MC6845, "vid-u18", mc6845_address_w)
407   AM_RANGE(0x9c01, 0x9c01) AM_MIRROR(0x03fe) AM_DEVREADWRITE(MC6845, "vid-u18", mc6845_register_r, mc6845_register_w)
450408   AM_RANGE(0xa000, 0xffff) AM_ROM
451409ADDRESS_MAP_END
452410
r1877r1878
460418
461419static const mc6845_interface mc6845_intf =
462420{
463   0,                     /* screen we are acting on */
464   QIX_CHARACTER_CLOCK,       /* the clock (pin 21) of the chip */
465   8,                     /* number of pixels per video memory address */
466   qix_begin_update,         /* before pixel update callback */
467   qix_update_row,            /* row update callback */
468   0,                     /* after pixel update callback */
469   qix_display_enable_changed   /* call back for display state changes */
421   0,                  /* screen we are acting on */
422   QIX_CHARACTER_CLOCK,    /* the clock (pin 21) of the chip */
423   8,                  /* number of pixels per video memory address */
424   begin_update,         /* before pixel update callback */
425   update_row,            /* row update callback */
426   NULL,               /* after pixel update callback */
427   display_enable_changed,   /* callback for display state changes */
428   NULL,               /* HSYNC callback */
429   NULL               /* VSYNC callback */
470430};
471431
472432
src/mame/video/ksayakyu.c
r1877r1878
6363   SET_TILE_INFO(0,code,((attr>>2)&7),flags);
6464}
6565
66static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
66static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
6767{
6868   const UINT8 *source = spriteram+spriteram_size-4;
6969   const UINT8 *finish = spriteram;
src/mame/video/ironhors.c
r1877r1878
152152   tilemap_set_scroll_rows(bg_tilemap, 32);
153153}
154154
155static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
155static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
156156{
157157   int offs;
158158   UINT8 *sr;
src/mame/video/atarirle.c
r1877r1878
9090   atarirle_info *   info;            /* list of info records */
9191   atarirle_entry *spriteram;         /* pointer to sprite RAM */
9292
93   mame_bitmap *   vram[2][2];         /* pointers to VRAM bitmaps and backbuffers */
93   bitmap_t *      vram[2][2];         /* pointers to VRAM bitmaps and backbuffers */
9494   int            partial_scanline;   /* partial update scanline */
9595
9696   UINT8         control_bits;      /* current control bits */
r1877r1878
141141static void prescan_rle(const atarirle_data *mo, int which);
142142static void sort_and_render(atarirle_data *mo);
143143static void compute_checksum(atarirle_data *mo);
144static void draw_rle(atarirle_data *mo, mame_bitmap *bitmap, int code, int color, int hflip, int vflip,
144static void draw_rle(atarirle_data *mo, bitmap_t *bitmap, int code, int color, int hflip, int vflip,
145145      int x, int y, int xscale, int yscale, const rectangle *clip);
146static void draw_rle_zoom(mame_bitmap *bitmap, const atarirle_info *gfx,
146static void draw_rle_zoom(bitmap_t *bitmap, const atarirle_info *gfx,
147147      UINT32 palette, int sx, int sy, int scalex, int scaley,
148148      const rectangle *clip);
149static void draw_rle_zoom_hflip(mame_bitmap *bitmap, const atarirle_info *gfx,
149static void draw_rle_zoom_hflip(bitmap_t *bitmap, const atarirle_info *gfx,
150150      UINT32 palette, int sx, int sy, int scalex, int scaley,
151151      const rectangle *clip);
152152
r1877r1878
162162    two.
163163---------------------------------------------------------------*/
164164
165#ifdef UNUSED_FUNCTON
165166INLINE int compute_log(int value)
166167{
167168   int log = 0;
r1877r1878
174175      return -1;
175176   return log;
176177}
178#endif
177179
178
179180/*---------------------------------------------------------------
180181    round_to_powerof2: Rounds a number up to the nearest
181182    power of 2. Even powers of 2 are rounded up to the
r1877r1878
200201    value into the result, packing the bits along the way.
201202---------------------------------------------------------------*/
202203
204#ifdef UNUSED_FUNCTON
203205INLINE int collapse_bits(int value, int mask)
204206{
205207   int testmask, ormask;
r1877r1878
214216      }
215217   return result;
216218}
219#endif
217220
218
219221/*---------------------------------------------------------------
220222    convert_mask: Converts a 4-word mask into a word index,
221223    shift, and adjusted mask. Returns 0 if invalid.
r1877r1878
523525    atarirle_get_vram: Return the VRAM bitmap.
524526---------------------------------------------------------------*/
525527
526mame_bitmap *atarirle_get_vram(int map, int idx)
528bitmap_t *atarirle_get_vram(int map, int idx)
527529{
528530   atarirle_data *mo = &atarirle[map];
529531//logerror("atarirle_get_vram (frame %d)\n", (mo->control_bits & ATARIRLE_CONTROL_FRAME) >> 2);
r1877r1878
731733
732734static void sort_and_render(atarirle_data *mo)
733735{
734   mame_bitmap *bitmap1 = mo->vram[0][(~mo->control_bits & ATARIRLE_CONTROL_FRAME) >> 2];
735   mame_bitmap *bitmap2 = mo->vram[1][(~mo->control_bits & ATARIRLE_CONTROL_FRAME) >> 2];
736   bitmap_t *bitmap1 = mo->vram[0][(~mo->control_bits & ATARIRLE_CONTROL_FRAME) >> 2];
737   bitmap_t *bitmap2 = mo->vram[1][(~mo->control_bits & ATARIRLE_CONTROL_FRAME) >> 2];
736738   atarirle_entry *obj = mo->spriteram;
737739   mo_sort_entry sort_entry[256];
738740   mo_sort_entry *list_head[256];
r1877r1878
903905    object.
904906---------------------------------------------------------------*/
905907
906void draw_rle(atarirle_data *mo, mame_bitmap *bitmap, int code, int color, int hflip, int vflip,
908void draw_rle(atarirle_data *mo, bitmap_t *bitmap, int code, int color, int hflip, int vflip,
907909   int x, int y, int xscale, int yscale, const rectangle *clip)
908910{
909911   UINT32 palettebase = mo->palettebase + color;
r1877r1878
944946    bitmap.
945947---------------------------------------------------------------*/
946948
947void draw_rle_zoom(mame_bitmap *bitmap, const atarirle_info *gfx,
949void draw_rle_zoom(bitmap_t *bitmap, const atarirle_info *gfx,
948950      UINT32 palette, int sx, int sy, int scalex, int scaley,
949951      const rectangle *clip)
950952{
r1877r1878
11341136    16-bit bitmap with horizontal flip.
11351137---------------------------------------------------------------*/
11361138
1137void draw_rle_zoom_hflip(mame_bitmap *bitmap, const atarirle_info *gfx,
1139void draw_rle_zoom_hflip(bitmap_t *bitmap, const atarirle_info *gfx,
11381140      UINT32 palette, int sx, int sy, int scalex, int scaley,
11391141      const rectangle *clip)
11401142{
src/mame/video/battlex.c
r1877r1878
8282       8, 8, 64, 32);
8383}
8484
85static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
85static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
8686{
8787   const gfx_element *gfx = machine->gfx[1];
8888   UINT8 *source = spriteram;
src/mame/video/skullxbo.c
r1877r1878
237237VIDEO_UPDATE( skullxbo )
238238{
239239   struct atarimo_rect_list rectlist;
240   mame_bitmap *mobitmap;
240   bitmap_t *mobitmap;
241241   int x, y, r;
242242
243243   /* draw the playfield */
src/mame/video/mrflea.c
r1877r1878
3434   spriteram[offset] = data;
3535}
3636
37static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
37static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
3838{
3939   const gfx_element *gfx = machine->gfx[0];
4040   const UINT8 *source = spriteram;
r1877r1878
6363   }
6464}
6565
66static void draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
66static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
6767{
6868   const UINT8 *source = videoram;
6969   const gfx_element *gfx = machine->gfx[1];
src/mame/video/atarirle.h
r1877r1878
8686WRITE32_HANDLER( atarirle_0_spriteram32_w );
8787
8888/* render helpers */
89mame_bitmap *atarirle_get_vram(int map, int idx);
89bitmap_t *atarirle_get_vram(int map, int idx);
9090
9191
9292
src/mame/video/snes.c
r1877r1878
100100static struct DEBUGOPTS debug_options  = {5, {0,0,0,0,0,0}, 0, 0, 0};
101101/*                                    red   green  blue    purple  yellow cyan    grey    white */
102102static const UINT16 dbg_mode_colours[8] = { 0x1f, 0x3e0, 0x7c00, 0x7c1f, 0x3ff, 0x7fe0, 0x4210, 0x7fff };
103static UINT8 snes_dbg_video(mame_bitmap *bitmap, UINT16 curline);
103static UINT8 snes_dbg_video(bitmap_t *bitmap, UINT16 curline);
104104#endif /* SNES_DBG_video */
105105
106106/* Forward declarations */
r1877r1878
17831783 *
17841784 * Redraw the current line.
17851785 *********************************************/
1786static void snes_refresh_scanline(mame_bitmap *bitmap, UINT16 curline )
1786static void snes_refresh_scanline(bitmap_t *bitmap, UINT16 curline )
17871787{
17881788   UINT16 ii;
17891789   int x;
r1877r1878
18891889
18901890#ifdef SNES_DBG_video
18911891
1892static void snes_dbg_draw_maps(mame_bitmap *bitmap, UINT32 tmap, UINT8 bpl, UINT16 curline, UINT8 layer )
1892static void snes_dbg_draw_maps(bitmap_t *bitmap, UINT32 tmap, UINT8 bpl, UINT16 curline, UINT8 layer )
18931893{
18941894   UINT32 tile, addr = tmap;
18951895   UINT16 ii, vflip, hflip, pal;
r1877r1878
19301930   //ui_draw_text( str, 0, 227 );
19311931}
19321932
1933static void snes_dbg_draw_all_tiles(mame_bitmap *bitmap, UINT32 tileaddr, UINT8 bpl, UINT16 pal )
1933static void snes_dbg_draw_all_tiles(bitmap_t *bitmap, UINT32 tileaddr, UINT8 bpl, UINT16 pal )
19341934{
19351935   UINT16 ii, jj, kk;
19361936   UINT32 addr = tileaddr;
r1877r1878
19691969   //ui_draw_text( str, 0, 227 );
19701970}
19711971
1972static UINT8 snes_dbg_video(mame_bitmap *bitmap, UINT16 curline )
1972static UINT8 snes_dbg_video(bitmap_t *bitmap, UINT16 curline )
19731973{
19741974   UINT16 ii;
19751975
src/mame/video/glass.c
r1877r1878
1313UINT16 *glass_videoram;
1414
1515static tilemap *pant[2];
16static mame_bitmap *screen_bitmap;
16static bitmap_t *screen_bitmap;
1717
1818static int glass_blitter_serial_buffer[5];
1919static int current_command = 0;
r1877r1878
163163      3  | xxxxxxxx xxxxxxxx | sprite code
164164*/
165165
166static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
166static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
167167{
168168   int i;
169169   const gfx_element *gfx = machine->gfx[0];
src/mame/video/mcatadv.c
r1877r1878
6060}
6161
6262
63static void draw_sprites( mame_bitmap *bitmap, const rectangle *cliprect )
63static void draw_sprites( bitmap_t *bitmap, const rectangle *cliprect )
6464{
6565   UINT16 *source = spriteram_old;
6666   UINT16 *finish = source + (spriteram_size/2)/2;
r1877r1878
156156   }
157157}
158158
159static void mcatadv_draw_tilemap_part(UINT16* current_scroll, UINT16* current_videoram1, int i, tilemap* current_tilemap, mame_bitmap *bitmap, const rectangle *cliprect)
159static void mcatadv_draw_tilemap_part(UINT16* current_scroll, UINT16* current_videoram1, int i, tilemap* current_tilemap, bitmap_t *bitmap, const rectangle *cliprect)
160160{
161161   int flip;
162162   UINT32 drawline;
src/mame/video/cinemat.c
r1877r1878
220220 *
221221 *************************************/
222222
223VIDEO_EOF( cinemat )
223VIDEO_UPDATE( cinemat )
224224{
225   VIDEO_UPDATE_CALL(vector);
225226   vector_clear_list();
227
228   cpuintrf_push_context(0);
229   ccpu_wdt_timer_trigger();
230   cpuintrf_pop_context();
231
232   return 0;
226233}
227234
228235
r1877r1878
237244{
238245   int sw_option = readinputportbytag("INPUTS");
239246
240   VIDEO_UPDATE_CALL(vector);
247   VIDEO_UPDATE_CALL(cinemat);
241248
242249   /* set the state of the artwork */
243250   output_set_value("pressed3", (~sw_option >> 0) & 1);
src/mame/video/toaplan2.c
r1877r1878
12561256    Sprite Handlers
12571257***************************************************************************/
12581258
1259static void draw_sprites( mame_bitmap *bitmap, const rectangle *cliprect, int controller, int priority_to_display, int bank_sel )
1259static void draw_sprites( bitmap_t *bitmap, const rectangle *cliprect, int controller, int priority_to_display, int bank_sel )
12601260{
12611261   const gfx_element *gfx = Machine->gfx[ ((controller*2)+1) ];
12621262
r1877r1878
14161416}
14171417
14181418/***************************************************************************
1419    Draw the game screen in the given mame_bitmap.
1419    Draw the game screen in the given bitmap_t.
14201420***************************************************************************/
14211421
14221422VIDEO_UPDATE( toaplan2_0 )
src/mame/video/mjkjidai.c
r1877r1878
5656//  logerror("%04x: port c0 = %02x\n",activecpu_get_pc(),data);
5757
5858   /* bit 0 = NMI enable */
59   interrupt_enable_w(0,data & 1);
59   interrupt_enable_w(machine,0,data & 1);
6060
6161   /* bit 1 = flip screen */
6262   flip_screen_set(data & 0x02);
r1877r1878
8787
8888***************************************************************************/
8989
90static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
90static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
9191{
9292   int offs;
9393
src/mame/video/jailbrek.c
r1877r1878
6666   tilemap_set_scrolldx(bg_tilemap, 0, 396 - 256);
6767}
6868
69static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
69static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
7070{
7171   int i;
7272
src/mame/video/gaelco.c
r1877r1878
123123      3  | xxxxxxxx xxxxxx-- | sprite code
124124*/
125125
126static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
126static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
127127{
128128   int i, x, y, ex, ey;
129129   const gfx_element *gfx = machine->gfx[0];
src/mame/video/bankp.c
r1877r1878
124124   /* bits 2-3 unknown (2 is used) */
125125
126126   /* bit 4 controls NMI */
127   interrupt_enable_w(0,(data & 0x10)>>4);
127   interrupt_enable_w(machine,0,(data & 0x10)>>4);
128128
129129   /* bit 5 controls screen flip */
130130   flip_screen_set(data & 0x20);
src/mame/video/tankbust.c
r1877r1878
184184    offset  3   xxxxxxxx    x position (8 LSB bits)
185185*/
186186
187static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
187static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
188188{
189189   int offs;
190190
src/mame/video/wecleman.c
r1877r1878
198198}
199199
200200// draws a 8bpp palette sprites on a 16bpp direct RGB target (sub-par implementation)
201static void do_blit_zoom16(mame_bitmap *bitmap, const rectangle *cliprect, struct sprite *sprite)
201static void do_blit_zoom16(bitmap_t *bitmap, const rectangle *cliprect, struct sprite *sprite)
202202{
203203#define PRECISION_X 20
204204#define PRECISION_Y 20
r1877r1878
332332   }
333333}
334334
335static void sprite_draw(mame_bitmap *bitmap, const rectangle *cliprect)
335static void sprite_draw(bitmap_t *bitmap, const rectangle *cliprect)
336336{
337337   int i;
338338
r1877r1878
535535
536536------------------------------------------------------------------------*/
537537
538static void wecleman_draw_road(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
538static void wecleman_draw_road(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority)
539539{
540540// must be powers of 2
541541#define XSIZE 512
r1877r1878
644644------------------------------------------------------------------------*/
645645
646646// blends two 8x8x16bpp direct RGB tilemaps
647static void draw_cloud(running_machine *machine, mame_bitmap *bitmap,
647static void draw_cloud(running_machine *machine, bitmap_t *bitmap,
648648             gfx_element *gfx,
649649             UINT16 *tm_base,
650650             int x0, int y0,            // target coordinate
r1877r1878
780780
781781------------------------------------------------------------------------*/
782782
783static void hotchase_draw_road(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
783static void hotchase_draw_road(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
784784{
785785/* Referred to what's in the ROMs */
786786#define XSIZE 512
src/mame/video/pastelg.c
r1877r1878
100100{
101101   pastelg_gfxrom = ((data & 0xc0) >> 6);
102102   pastelg_palbank = ((data & 0x10) >> 4);
103   nb1413m3_sndrombank1_w(0, data);
103   nb1413m3_sndrombank1_w(machine, 0, data);
104104
105105   if ((pastelg_gfxrom << 16) > (memory_region_length(REGION_GFX1) - 1))
106106   {
src/mame/video/crbaloon.c
r1877r1878
9898
9999
100100
101static void draw_sprite_and_check_collision(running_machine *machine, mame_bitmap *bitmap)
101static void draw_sprite_and_check_collision(running_machine *machine, bitmap_t *bitmap)
102102{
103103   int y;
104104   UINT8 code = crbaloon_spriteram[0] & 0x0f;
src/mame/video/portrait.c
r1877r1878
9090}
9191#endif
9292
93static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
93static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
9494{
9595   UINT8 *source = spriteram;
9696   UINT8 *finish = source + 0x200;
src/mame/video/bosco.c
r1877r1878
211211
212212***************************************************************************/
213213
214static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
214static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
215215{
216216   int offs;
217217
r1877r1878
235235}
236236
237237
238static void draw_bullets(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
238static void draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
239239{
240240   int offs;
241241
r1877r1878
257257}
258258
259259
260static void draw_stars(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
260static void draw_stars(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
261261{
262262   if (1)
263263   {
src/mame/video/munchmo.c
r1877r1878
6262   tmpbitmap = auto_bitmap_alloc(512,512,machine->screen[0].format);
6363}
6464
65static void draw_status(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
65static void draw_status(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
6666{
6767   const gfx_element *gfx = machine->gfx[0];
6868   int row;
r1877r1878
8989   }
9090}
9191
92static void draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
92static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
9393{
9494/*
9595    ROM B1.2C contains 256 tilemaps defining 4x4 configurations of
r1877r1878
128128   }
129129}
130130
131static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
131static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
132132{
133133   int scroll = mnchmobl_vreg[6];
134134   int flags = mnchmobl_vreg[7];               /*   XB?????? */
src/mame/video/funkybee.c
r1877r1878
9393       8, 8, 32, 32);
9494}
9595
96static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
96static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
9797{
9898   int offs;
9999
r1877r1878
122122   }
123123}
124124
125static void draw_columns(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
125static void draw_columns(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
126126{
127127   int offs;
128128
src/mame/video/btoads.c
r1877r1878
149149
150150WRITE16_HANDLER( btoads_paletteram_w )
151151{
152   tlc34076_lsb_w(offset/2, data, mem_mask);
152   tlc34076_lsb_w(machine, offset/2, data, mem_mask);
153153}
154154
155155
156156READ16_HANDLER( btoads_paletteram_r )
157157{
158   return tlc34076_lsb_r(offset/2, mem_mask);
158   return tlc34076_lsb_r(machine, offset/2, mem_mask);
159159}
160160
161161
r1877r1878
342342 *
343343 *************************************/
344344
345void btoads_scanline_update(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params)
345void btoads_scanline_update(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params)
346346{
347347   UINT32 fulladdr = ((params->rowaddr << 16) | params->coladdr) >> 4;
348348   UINT16 *bg0_base = &btoads_vram_bg0[(fulladdr + (yscroll0 << 10)) & 0x3fc00];
src/mame/video/tetrisp2.c
r1877r1878
379379
380380***************************************************************************/
381381
382static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT16 *sprram_top, size_t sprram_size, int gfxnum)
382static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16 *sprram_top, size_t sprram_size, int gfxnum)
383383{
384384   int x, y, tx, ty, sx, sy, flipx, flipy;
385385   int xsize, ysize, xnum, ynum;
src/mame/video/lastduel.c
r1877r1878
186186
187187***************************************************************************/
188188
189static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri)
189static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri)
190190{
191191   int offs;
192192
r1877r1878
249249   /* Spriteram is always 1 frame ahead, suggesting buffering.  I can't find
250250        a register to control this so I assume it happens automatically
251251        every frame at the end of vblank */
252   buffer_spriteram16_w(0,0,0);
252   buffer_spriteram16_w(machine,0,0,0);
253253}
src/mame/video/alpha68k.c
r1877r1878
7676
7777/******************************************************************************/
7878//AT
79static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int j, int s, int e)
79static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int j, int s, int e)
8080{
8181   int offs,mx,my,color,tile,fx,fy,i;
8282
r1877r1878
215215   }
216216}
217217
218static void draw_sprites_V(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int j, int s, int e, int fx_mask, int fy_mask, int sprite_mask)
218static void draw_sprites_V(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int j, int s, int e, int fx_mask, int fy_mask, int sprite_mask)
219219{
220220   int offs,mx,my,color,tile,fx,fy,i;
221221
r1877r1878
322322
323323/******************************************************************************/
324324//AT
325static void draw_sprites_I(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int c, int d, int yshift)
325static void draw_sprites_I(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int c, int d, int yshift)
326326{
327327   int data, offs, mx, my, tile, color, fy, i;
328328   UINT8 *color_prom = memory_region(REGION_USER1);
r1877r1878
428428   *bank = (data>>11 & 4) | (data>>10 & 3);
429429}
430430
431static void kyros_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int c,int d)
431static void kyros_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int c,int d)
432432{
433433   int offs,mx,my,color,tile,i,bank,fy,fx;
434434   int data;
r1877r1878
490490
491491/******************************************************************************/
492492
493static void sstingry_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int c,int d)
493static void sstingry_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int c,int d)
494494{
495495//AT
496496   int data,offs,mx,my,color,tile,i,bank,fy,fx;
src/mame/video/drgnmst.c
r1877r1878
6868   tilemap_mark_tile_dirty(drgnmst_md_tilemap,offset/2);
6969}
7070
71static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
71static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
7272{
7373   const gfx_element *gfx = machine->gfx[0];
7474   UINT16 *source = spriteram16;
src/mame/video/boxer.c
r1877r1878
1010UINT8* boxer_sprite_ram;
1111
1212
13static void draw_boxer(running_machine *machine, mame_bitmap* bitmap, const rectangle* cliprect)
13static void draw_boxer(running_machine *machine, bitmap_t* bitmap, const rectangle* cliprect)
1414{
1515   int n;
1616
src/mame/video/cischeat.c
r1877r1878
225225      case 0x0004/2 : return readinputport(3);   // Motor Limit Switches
226226      case 0x0006/2 : return readinputport(4);   // DSW 1 & 2
227227
228      case 0x0008/2 :   return soundlatch2_word_r(0,0);   // From sound cpu
228      case 0x0008/2 :   return soundlatch2_word_r(machine,0,0);   // From sound cpu
229229
230230      case 0x0010/2 :
231231         switch (cischeat_ip_select & 0x3)
r1877r1878
274274         break;
275275
276276      case 0x000a/2   :   // to sound cpu
277         soundlatch_word_w(0,new_data,0);
277         soundlatch_word_w(machine,0,new_data,0);
278278         break;
279279
280280      case 0x000c/2   :   break;   // ??
r1877r1878
332332         }
333333
334334      case 0x2200/2 : return readinputport(5);   // DSW 3 (4 bits)
335      case 0x2300/2 : return soundlatch2_r(0);   // From sound cpu
335      case 0x2300/2 : return soundlatch2_r(machine,0);   // From sound cpu
336336
337337      default:   SHOW_READ_ERROR("vreg %04X read!",offset*2);
338338               return megasys1_vregs[offset];
r1877r1878
386386      case 0x2208/2   : break;   // watchdog reset
387387
388388      case 0x2300/2   :   /* Sound CPU: reads latch during int 4, and stores command */
389                     soundlatch_word_w(0,new_data,0);
390                     cpunum_set_input_line(Machine, 3,4,HOLD_LINE);
389                     soundlatch_word_w(machine,0,new_data,0);
390                     cpunum_set_input_line(machine, 3,4,HOLD_LINE);
391391                     break;
392392
393393      /* Not sure about this one.. */
394      case 0x2308/2   :   cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, (new_data & 2) ? ASSERT_LINE : CLEAR_LINE );
395                     cpunum_set_input_line(Machine, 2, INPUT_LINE_RESET, (new_data & 2) ? ASSERT_LINE : CLEAR_LINE );
396                     cpunum_set_input_line(Machine, 3, INPUT_LINE_RESET, (new_data & 1) ? ASSERT_LINE : CLEAR_LINE );
394      case 0x2308/2   :   cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, (new_data & 2) ? ASSERT_LINE : CLEAR_LINE );
395                     cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, (new_data & 2) ? ASSERT_LINE : CLEAR_LINE );
396                     cpunum_set_input_line(machine, 3, INPUT_LINE_RESET, (new_data & 1) ? ASSERT_LINE : CLEAR_LINE );
397397                     break;
398398
399399      default: SHOW_WRITE_ERROR("vreg %04X <- %04X",offset*2,data);
r1877r1878
422422                         (read_shift()<<5);   // Buttons
423423
424424      case 0x0006/2 :   return readinputport(3);   // ? Read at boot only
425      case 0x0008/2 :   return soundlatch2_r(0);   // From sound cpu
425      case 0x0008/2 :   return soundlatch2_r(machine,0);   // From sound cpu
426426
427427      case 0x000c/2 :   return readinputport(4);   // DSW 3
428428
r1877r1878
445445         return (f1gpstr2_ioready[0]&1) ? 0xff : 0xf0;
446446
447447      default:
448         return f1gpstar_vregs_r(offset,mem_mask);
448         return f1gpstar_vregs_r(machine,offset,mem_mask);
449449   }
450450}
451451
r1877r1878
464464
465465      case 0x0004/2 :   return readinputport(1); // Buttons
466466
467      case 0x0008/2 :   return soundlatch2_r(0); // From sound cpu
467      case 0x0008/2 :   return soundlatch2_r(machine,0); // From sound cpu
468468
469469      case 0x0010/2 :   // X, Y
470470         return readinputport(2) | (readinputport(3)<<8);
r1877r1878
505505      case 0x0014/2   :   break;
506506
507507      /* Usually written in sequence, but not always */
508      case 0x0008/2   :   soundlatch_word_w(0,new_data,0);   break;
509      case 0x0018/2   :   cpunum_set_input_line(Machine, 3,4,HOLD_LINE);   break;
508      case 0x0008/2   :   soundlatch_word_w(machine,0,new_data,0);   break;
509      case 0x0018/2   :   cpunum_set_input_line(machine, 3,4,HOLD_LINE);   break;
510510
511511      case 0x0010/2   :   break;
512512
r1877r1878
526526      case 0x2208/2   : break;   // watchdog reset
527527
528528      /* Not sure about this one. Values: $10 then 0, $7 then 0 */
529      case 0x2308/2   :   cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, (new_data & 1) ? ASSERT_LINE : CLEAR_LINE );
530                     cpunum_set_input_line(Machine, 2, INPUT_LINE_RESET, (new_data & 2) ? ASSERT_LINE : CLEAR_LINE );
531                     cpunum_set_input_line(Machine, 3, INPUT_LINE_RESET, (new_data & 4) ? ASSERT_LINE : CLEAR_LINE );
529      case 0x2308/2   :   cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, (new_data & 1) ? ASSERT_LINE : CLEAR_LINE );
530                     cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, (new_data & 2) ? ASSERT_LINE : CLEAR_LINE );
531                     cpunum_set_input_line(machine, 3, INPUT_LINE_RESET, (new_data & 4) ? ASSERT_LINE : CLEAR_LINE );
532532                     break;
533533
534534      default:      SHOW_WRITE_ERROR("vreg %04X <- %04X",offset*2,data);
r1877r1878
548548      case 0x0000/2   :
549549         if (ACCESSING_LSB)
550550         {
551            cpunum_set_input_line(Machine, 4,4,(new_data & 4)?ASSERT_LINE:CLEAR_LINE);
552            cpunum_set_input_line(Machine, 4,2,(new_data & 2)?ASSERT_LINE:CLEAR_LINE);
551            cpunum_set_input_line(machine, 4,4,(new_data & 4)?ASSERT_LINE:CLEAR_LINE);
552            cpunum_set_input_line(machine, 4,2,(new_data & 2)?ASSERT_LINE:CLEAR_LINE);
553553         }
554554         break;
555555
556556      default:
557         f1gpstar_vregs_w(offset,data,mem_mask);
557         f1gpstar_vregs_w(machine,offset,data,mem_mask);
558         break;
558559   }
559560}
560561
r1877r1878
583584      case 0x100/2+1 : MEGASYS1_VREG_SCROLL(2,y)      break;
584585      case 0x100/2+2 : megasys1_set_vreg_flag(2,new_data);break;
585586
586      case 0x208/2   : watchdog_reset_w(0,0);   break;
587      case 0x208/2   : watchdog_reset_w(machine,0,0);   break;
587588
588589      default: SHOW_WRITE_ERROR("vreg %04X <- %04X",offset*2,data);
589590   }
r1877r1878
628629/*  Draw the road in the given bitmap. The priority1 and priority2 parameters
629630    specify the range of lines to draw  */
630631
631static void cischeat_draw_road(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int road_num, int priority1, int priority2, int transparency)
632static void cischeat_draw_road(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int road_num, int priority1, int priority2, int transparency)
632633{
633634   int curr_code,sx,sy;
634635   int min_priority, max_priority;
r1877r1878
718719/*  Draw the road in the given bitmap. The priority1 and priority2 parameters
719720    specify the range of lines to draw  */
720721
721static void f1gpstar_draw_road(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int road_num, int priority1, int priority2, int transparency)
722static void f1gpstar_draw_road(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int road_num, int priority1, int priority2, int transparency)
722723{
723724   int sx,sy;
724725   int xstart;
r1877r1878
834835    sprites whose priority nibble is between 0 and 15 and whose
835836    colour code's high bit is set.  */
836837
837static void cischeat_draw_sprites(running_machine *machine, mame_bitmap *bitmap , const rectangle *cliprect, int priority1, int priority2)
838static void cischeat_draw_sprites(running_machine *machine, bitmap_t *bitmap , const rectangle *cliprect, int priority1, int priority2)
838839{
839840   int x, sx, flipx, xzoom, xscale, xdim, xnum, xstart, xend, xinc;
840841   int y, sy, flipy, yzoom, yscale, ydim, ynum, ystart, yend, yinc;
r1877r1878
989990
990991***************************************************************************/
991992
992static void bigrun_draw_sprites(running_machine *machine, mame_bitmap *bitmap , const rectangle *cliprect, int priority1, int priority2)
993static void bigrun_draw_sprites(running_machine *machine, bitmap_t *bitmap , const rectangle *cliprect, int priority1, int priority2)
993994{
994995   int x, sx, flipx, xzoom, xscale, xdim, xnum, xstart, xend, xinc;
995996   int y, sy, flipy, yzoom, yscale, ydim, ynum, ystart, yend, yinc;
r1877r1878
13491350#if 1
13501351   popmessage("Cmd: %04X Pos:%04X Lim:%04X Inp:%04X",
13511352                  scudhamm_motor_command,
1352                  scudhamm_motor_pos_r(0,0),
1353                  scudhamm_motor_status_r(0,0),
1354                  scudhamm_analog_r(0,0) );
1353                  scudhamm_motor_pos_r(machine,0,0),
1354                  scudhamm_motor_status_r(machine,0,0),
1355                  scudhamm_analog_r(machine,0,0) );
13551356#endif
13561357
13571358}
src/mame/video/freekick.c
r1877r1878
3030   tilemap_mark_tile_dirty(freek_tilemap,offset&0x3ff);
3131}
3232
33static void gigas_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
33static void gigas_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
3434{
3535   int offs;
3636
r1877r1878
6565}
6666
6767
68static void pbillrd_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
68static void pbillrd_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
6969{
7070   int offs;
7171
r1877r1878
101101
102102
103103
104static void freekick_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
104static void freekick_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
105105{
106106   int offs;
107107
src/mame/video/namcos22.c
r1877r1878
277277   float du = extent->param[1].dpdx;
278278   float dv = extent->param[2].dpdx;
279279   float di = extent->param[3].dpdx;
280   mame_bitmap *bitmap = dest;
280   bitmap_t *bitmap = dest;
281281   const poly_extra_data *extra = extradata;
282282   int bn = extra->bn * 0x1000;
283283   const pen_t *pens = &Machine->pens[(extra->color&0x7f)<<8];
r1877r1878
384384   }
385385} /* renderscanline_uvi_full */
386386
387static void poly3d_DrawQuad(running_machine *machine, mame_bitmap *bitmap, int textureBank, int color, Poly3dVertex pv[4], UINT16 flags, int direct, int cmode )
387static void poly3d_DrawQuad(running_machine *machine, bitmap_t *bitmap, int textureBank, int color, Poly3dVertex pv[4], UINT16 flags, int direct, int cmode )
388388{
389389   poly_extra_data *extra;
390390   poly_vertex v[4], clipv[5];
r1877r1878
489489   int y_index = extent->param[1].start * 65536.0f;
490490   int dx = extent->param[0].dpdx * 65536.0f;
491491   const poly_extra_data *extra = extradata;
492   mame_bitmap *destmap = destbase;
492   bitmap_t *destmap = destbase;
493493   const pen_t *pal = &Machine->pens[extra->color];
494494   int prioverchar = extra->prioverchar;
495495   int z = extra->z;
r1877r1878
556556
557557static void
558558mydrawgfxzoom(
559   mame_bitmap *dest_bmp,const gfx_element *gfx,
559   bitmap_t *dest_bmp,const gfx_element *gfx,
560560   UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
561561   const rectangle *clip,int transparency,int transparent_color,
562562   int scalex, int scaley, int z, int prioverchar, int alpha )
r1877r1878
607607} /* mydrawgfxzoom */
608608
609609static void
610ApplyGamma( mame_bitmap *bitmap )
610ApplyGamma( bitmap_t *bitmap )
611611{
612612   int x,y;
613613   if( mbSuperSystem22 )
r1877r1878
654654} /* ApplyGamma */
655655
656656static void
657poly3d_Draw3dSprite( mame_bitmap *bitmap, gfx_element *gfx, int tileNumber, int color, int sx, int sy, int width, int height, int translucency, int zc, UINT32 pri )
657poly3d_Draw3dSprite( bitmap_t *bitmap, gfx_element *gfx, int tileNumber, int color, int sx, int sy, int width, int height, int translucency, int zc, UINT32 pri )
658658{
659659   int flipx = 0;
660660   int flipy = 0;
r1877r1878
900900} /* NewSceneNode */
901901
902902
903static void RenderSprite(running_machine *machine, mame_bitmap *bitmap, struct SceneNode *node )
903static void RenderSprite(running_machine *machine, bitmap_t *bitmap, struct SceneNode *node )
904904{
905905   int tile = node->data.sprite.tile;
906906   int col,row;
r1877r1878
935935   } /* next row */
936936} /* RenderSprite */
937937
938static void RenderSceneHelper(running_machine *machine, mame_bitmap *bitmap, struct SceneNode *node )
938static void RenderSceneHelper(running_machine *machine, bitmap_t *bitmap, struct SceneNode *node )
939939{
940940   if( node )
941941   {
r1877r1878
988988   }
989989} /* RenderSceneHelper */
990990
991static void RenderScene(running_machine *machine, mame_bitmap *bitmap )
991static void RenderScene(running_machine *machine, bitmap_t *bitmap )
992992{
993993   struct SceneNode *node = &mSceneRoot;
994994   int i;
r1877r1878
12481248
12491249static void
12501250DrawSpritesHelper(
1251   mame_bitmap *bitmap,
1251   bitmap_t *bitmap,
12521252   const rectangle *cliprect,
12531253   const UINT32 *pSource,
12541254   const UINT32 *pPal,
r1877r1878
13431343} /* DrawSpritesHelper */
13441344
13451345static void
1346DrawSprites( mame_bitmap *bitmap, const rectangle *cliprect )
1346DrawSprites( bitmap_t *bitmap, const rectangle *cliprect )
13471347{
13481348/*
13491349// time crisis:
r1877r1878
15361536}
15371537
15381538static void
1539DrawTranslucentCharacters( mame_bitmap *bitmap, const rectangle *cliprect )
1539DrawTranslucentCharacters( bitmap_t *bitmap, const rectangle *cliprect )
15401540{
15411541   alpha_set_level( 0xff-mixer.text_translucency ); /* ? */
15421542   tilemap_draw( bitmap, cliprect, bgtilemap, TILEMAP_DRAW_ALPHA|1, 0 );
15431543}
15441544
1545static void DrawCharacterLayer(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
1545static void DrawCharacterLayer(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
15461546{
15471547   unsigned i;
15481548   INT32 dx = namcos22_tilemapattr[0]>>16;
r1877r1878
16471647 */
16481648static void
16491649BlitQuadHelper(
1650      mame_bitmap *bitmap,
1650      bitmap_t *bitmap,
16511651      unsigned color,
16521652      unsigned addr,
16531653      float m[4][4],
r1877r1878
18131813} /* RegisterNormals */
18141814
18151815static void
1816BlitQuads( mame_bitmap *bitmap, INT32 addr, float m[4][4], INT32 base )
1816BlitQuads( bitmap_t *bitmap, INT32 addr, float m[4][4], INT32 base )
18171817{
18181818   int numAdditionalNormals = 0;
18191819   int chunkLength = GetPolyData(addr++);
r1877r1878
19181918} /* BlitQuads */
19191919
19201920static void
1921BlitPolyObject( mame_bitmap *bitmap, int code, float M[4][4] )
1921BlitPolyObject( bitmap_t *bitmap, int code, float M[4][4] )
19221922{
19231923   unsigned addr1 = GetPolyData(code);
19241924   mLitSurfaceCount = 0;
r1877r1878
20362036} /* HandleBB0003 */
20372037
20382038static void
2039Handle200002( mame_bitmap *bitmap, const INT32 *pSource )
2039Handle200002( bitmap_t *bitmap, const INT32 *pSource )
20402040{
20412041   if( mPrimitiveID>=0x45 )
20422042   {
r1877r1878
21022102} /* Handle233002 */
21032103
21042104static void
2105SimulateSlaveDSP( mame_bitmap *bitmap )
2105SimulateSlaveDSP( bitmap_t *bitmap )
21062106{
21072107   const INT32 *pSource = 0x300 + (INT32 *)namcos22_polygonram;
21082108   INT16 len;
r1877r1878
21672167} /* SimulateSlaveDSP */
21682168
21692169static void
2170DrawPolygons( mame_bitmap *bitmap )
2170DrawPolygons( bitmap_t *bitmap )
21712171{
21722172   if( mbDSPisActive )
21732173   {
src/mame/video/redclash.c
r1877r1878
173173   tilemap_set_transparent_pen(fg_tilemap, 0);
174174}
175175
176static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
176static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
177177{
178178   int i, offs;
179179
r1877r1878
260260   }
261261}
262262
263static void draw_bullets(mame_bitmap *bitmap, const rectangle *cliprect )
263static void draw_bullets(bitmap_t *bitmap, const rectangle *cliprect )
264264{
265265   int offs;
266266
r1877r1878
357357/* Space Raider doesn't use the Va bit, and it is also set up to */
358358/* window the stars to a certain x range */
359359
360void redclash_draw_stars(mame_bitmap *bitmap, const rectangle *cliprect, UINT8 palette_offset, UINT8 sraider, UINT8 firstx, UINT8 lastx)
360void redclash_draw_stars(bitmap_t *bitmap, const rectangle *cliprect, UINT8 palette_offset, UINT8 sraider, UINT8 firstx, UINT8 lastx)
361361{
362362   int i;
363363   UINT8 tempbit, feedback, star_color, xloc, yloc;
src/mame/video/xybots.c
r1877r1878
103103VIDEO_UPDATE( xybots )
104104{
105105   struct atarimo_rect_list rectlist;
106   mame_bitmap *mobitmap;
106   bitmap_t *mobitmap;
107107   int x, y, r;
108108
109109   /* draw the playfield */
src/mame/video/rockola.c
r1877r1878
115115}
116116
117117
118WRITE8_HANDLER( rockola_mc6845_address_w )
119{
120   mc6845_address_w(mc6845, data);
121}
122
123
124WRITE8_HANDLER( rockola_mc6845_register_w )
125{
126   mc6845_register_w(mc6845, data);
127}
128
129
130118WRITE8_HANDLER( rockola_flipscreen_w )
131119{
132120   int bank;
r1877r1878
275263   /* it controls only IRQs, not NMIs. Here I am affecting both, which */
276264   /* is wrong. */
277265
278   interrupt_enable_w(0,data & 0x02);
266   interrupt_enable_w(machine,0,data & 0x02);
279267
280268   /* other bits unused */
281269}
src/mame/video/centiped.c
r1877r1878
443443
444444VIDEO_UPDATE( warlords )
445445{
446   int upright_mode = input_port_0_r(0) & 0x80;
446   int upright_mode = input_port_0_r(machine, 0) & 0x80;
447447   int offs;
448448
449449   /* if the cocktail/upright switch flipped, force refresh */
src/mame/video/atarisy1.c
r1877r1878
380380          ((offset & 0xc0) == 0x40 && (newword == 0xffff || oldword == 0xffff)))
381381      {
382382         /* if the timer is in the active bank, update the display list */
383         atarimo_0_spriteram_w(offset, data, 0);
383         atarimo_0_spriteram_w(machine, offset, data, 0);
384384         update_timers(video_screen_get_vpos(0));
385385      }
386386
r1877r1878
393393   }
394394
395395   /* let the MO handler do the basic work */
396   atarimo_0_spriteram_w(offset, data, 0);
396   atarimo_0_spriteram_w(machine, offset, data, 0);
397397}
398398
399399
r1877r1878
407407static TIMER_CALLBACK( int3off_callback )
408408{
409409   /* clear the state */
410   atarigen_scanline_int_ack_w(0, 0, 0);
410   atarigen_scanline_int_ack_w(machine, 0, 0, 0);
411411}
412412
413413
r1877r1878
515515VIDEO_UPDATE( atarisy1 )
516516{
517517   struct atarimo_rect_list rectlist;
518   mame_bitmap *mobitmap;
518   bitmap_t *mobitmap;
519519   int x, y, r;
520520
521521   /* draw the playfield */
src/mame/video/wgp.c
r1877r1878
363363     2, 2, 3, 3,
364364     2, 2, 3, 3 };
365365
366static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int y_offs)
366static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int y_offs)
367367{
368368   int offs,i,j,k;
369369   int x,y,curx,cury;
r1877r1878
506506*********************************************************/
507507
508508INLINE void bryan2_drawscanline(
509      mame_bitmap *bitmap,int x,int y,int length,
509      bitmap_t *bitmap,int x,int y,int length,
510510      const UINT16 *src,int transparent,UINT32 orient,int pri)
511511{
512512   UINT16 *dsti = BITMAP_ADDR16(bitmap, y, x);
r1877r1878
532532
533533
534534
535static void wgp_piv_layer_draw(mame_bitmap *bitmap,const rectangle *cliprect,int layer,int flags,UINT32 priority)
535static void wgp_piv_layer_draw(bitmap_t *bitmap,const rectangle *cliprect,int layer,int flags,UINT32 priority)
536536{
537   mame_bitmap *srcbitmap = tilemap_get_pixmap(wgp_piv_tilemap[layer]);
538   mame_bitmap *flagsbitmap = tilemap_get_flagsmap(wgp_piv_tilemap[layer]);
537   bitmap_t *srcbitmap = tilemap_get_pixmap(wgp_piv_tilemap[layer]);
538   bitmap_t *flagsbitmap = tilemap_get_flagsmap(wgp_piv_tilemap[layer]);
539539
540540   UINT16 *dst16,*src16;
541541   UINT8 *tsrc;
src/mame/video/welltris.c
r1877r1878
4040
4141
4242/* Sprite Drawing is pretty much the same as fromance.c */
43static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
43static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
4444{
4545   static const UINT8 zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 };
4646   int offs;
r1877r1878
223223   tilemap_set_transparent_pen(char_tilemap, 15);
224224}
225225
226static void draw_background(mame_bitmap *bitmap, const rectangle *cliprect)
226static void draw_background(bitmap_t *bitmap, const rectangle *cliprect)
227227{
228228   int x, y;
229229   int pixdata;
src/mame/video/sprint8.c
r1877r1878
1616static tilemap* tilemap1;
1717static tilemap* tilemap2;
1818
19static mame_bitmap* helper1;
20static mame_bitmap* helper2;
19static bitmap_t* helper1;
20static bitmap_t* helper2;
2121
2222
2323PALETTE_INIT( sprint8 )
r1877r1878
136136}
137137
138138
139static void draw_sprites(running_machine *machine, mame_bitmap* bitmap, const rectangle *cliprect)
139static void draw_sprites(running_machine *machine, bitmap_t* bitmap, const rectangle *cliprect)
140140{
141141   int i;
142142
src/mame/video/dec0.c
r1877r1878
148148
149149/******************************************************************************/
150150
151static void draw_sprites(running_machine* machine, mame_bitmap *bitmap,const rectangle *cliprect,int pri_mask,int pri_val)
151static void draw_sprites(running_machine* machine, bitmap_t *bitmap,const rectangle *cliprect,int pri_mask,int pri_val)
152152{
153153   int offs;
154154
r1877r1878
164164      if ((colour & pri_mask) != pri_val) continue;
165165
166166      flash=x&0x800;
167      if (flash && (cpu_getcurrentframe() & 1)) continue;
167      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
168168
169169      fx = y & 0x2000;
170170      fy = y & 0x4000;
r1877r1878
216216
217217/******************************************************************************/
218218
219static void custom_tilemap_draw(mame_bitmap *bitmap,
219static void custom_tilemap_draw(bitmap_t *bitmap,
220220                        const rectangle *cliprect,
221221                        tilemap *tilemap_ptr,
222222                        const UINT16 *rowscroll_ptr,
r1877r1878
225225                        const UINT16 *control1,
226226                        int flags)
227227{
228   const mame_bitmap *src_bitmap = tilemap_get_pixmap(tilemap_ptr);
228   const bitmap_t *src_bitmap = tilemap_get_pixmap(tilemap_ptr);
229229   int x, y, p;
230230   int column_offset=0, src_x=0, src_y=0;
231231   UINT32 scrollx=control1[0];
r1877r1878
295295
296296/******************************************************************************/
297297
298static void dec0_pf1_draw(mame_bitmap *bitmap,const rectangle *cliprect,int flags)
298static void dec0_pf1_draw(bitmap_t *bitmap,const rectangle *cliprect,int flags)
299299{
300300   switch (dec0_pf1_control_0[3]&0x3) {
301301      case 0:   /* 4x1 */
r1877r1878
311311   };
312312}
313313
314static void dec0_pf2_draw(mame_bitmap *bitmap,const rectangle *cliprect,int flags)
314static void dec0_pf2_draw(bitmap_t *bitmap,const rectangle *cliprect,int flags)
315315{
316316   switch (dec0_pf2_control_0[3]&0x3) {
317317      case 0:   /* 4x1 */
r1877r1878
327327   };
328328}
329329
330static void dec0_pf3_draw(mame_bitmap *bitmap,const rectangle *cliprect,int flags)
330static void dec0_pf3_draw(bitmap_t *bitmap,const rectangle *cliprect,int flags)
331331{
332332   switch (dec0_pf3_control_0[3]&0x3) {
333333      case 0:   /* 4x1 */
r1877r1878
611611   offset&=0xffe;
612612   myword=buffer[offset] + (buffer[offset+1]<<8);
613613
614   if (offset<0x10) dec0_pf3_control_0_w(offset/2,myword,0);
615   else dec0_pf3_control_1_w((offset-0x10)/2,myword,0);
614   if (offset<0x10) dec0_pf3_control_0_w(machine,offset/2,myword,0);
615   else dec0_pf3_control_1_w(machine,(offset-0x10)/2,myword,0);
616616}
617617
618618WRITE8_HANDLER( dec0_pf3_data_8bit_w )
src/mame/video/ssv.c
r1877r1878
144144
145145static int shadow_pen_mask, shadow_pen_shift;
146146
147static void ssv_drawgfx(   mame_bitmap *bitmap, const gfx_element *gfx,
147static void ssv_drawgfx(   bitmap_t *bitmap, const gfx_element *gfx,
148148               UINT32 code,UINT32 color,int flipx,int flipy,int x0,int y0,
149149               const rectangle *cliprect, int shadow   )
150150{
r1877r1878
591591
592592/* Draw a tilemap sprite */
593593
594static void draw_row(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int sx, int sy, int scroll)
594static void draw_row(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int sx, int sy, int scroll)
595595{
596596   rectangle clip;
597597   int attr, code, color, mode, size, page, shadow;
r1877r1878
716716
717717/* Draw the "background layer" using multiple tilemap sprites */
718718
719static void draw_layer(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int  nr)
719static void draw_layer(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int  nr)
720720{
721721   int sy;
722722   for ( sy = 0; sy <= machine->screen[0].visarea.max_y; sy += 0x40 )
r1877r1878
725725
726726/* Draw sprites in the sprites list */
727727
728static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
728static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
729729{
730730   /* Sprites list */
731731
r1877r1878
994994        E.h                             Unused
995995
996996*/
997static void gdfs_draw_zooming_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
997static void gdfs_draw_zooming_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority)
998998{
999999   /* Sprites list */
10001000
src/mame/video/taitoair.c
r1877r1878
8787  Screen refresh
8888***************************************************************************/
8989
90static void draw_sprites(mame_bitmap *bitmap, const rectangle *cliprect, int priority)
90static void draw_sprites(bitmap_t *bitmap, const rectangle *cliprect, int priority)
9191{
9292   /* Y chain size is 16/32?/64/64? pixels. X chain size
9393       is always 64 pixels. */
r1877r1878
217217   int col;
218218};
219219
220static void fill_slope(mame_bitmap *bitmap, int color, INT32 x1, INT32 x2, INT32 sl1, INT32 sl2, INT32 y1, INT32 y2, INT32 *nx1, INT32 *nx2)
220static void fill_slope(bitmap_t *bitmap, int color, INT32 x1, INT32 x2, INT32 sl1, INT32 sl2, INT32 y1, INT32 y2, INT32 *nx1, INT32 *nx2)
221221{
222222   if(y1 > view.y2)
223223      return;
r1877r1878
280280   *nx2 = x2;
281281}
282282
283static void fill_poly(mame_bitmap *bitmap, const struct poly *q)
283static void fill_poly(bitmap_t *bitmap, const struct poly *q)
284284{
285285   INT32 sl1, sl2, cury, limy, x1, x2;
286286   int pmin, pmax, i, ps1, ps2;
src/mame/video/atarig42.c
r1877r1878
236236
237237   /* copy the motion objects on top */
238238   {
239      mame_bitmap *mo_bitmap = atarirle_get_vram(0, 0);
239      bitmap_t *mo_bitmap = atarirle_get_vram(0, 0);
240240      int left   = cliprect->min_x;
241241      int top      = cliprect->min_y;
242242      int right   = cliprect->max_x + 1;
src/mame/video/tceptor.c
r1877r1878
44 */
55
66#include "driver.h"
7#include "deprecat.h"
87#include "namcoic.h"
98
109#define TX_TILE_OFFSET_CENTER   (32 * 2)
r1877r1878
3231static INT32 bg1_scroll_x, bg1_scroll_y;
3332static INT32 bg2_scroll_x, bg2_scroll_y;
3433
35static mame_bitmap *temp_bitmap;
34static bitmap_t *temp_bitmap;
3635
3736static UINT16 *tceptor_sprite_ram_buffered;
3837
r1877r1878
474473    z: zoom y
475474*/
476475
477static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int sprite_priority)
476static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int sprite_priority)
478477{
479478   UINT16 *mem1 = &tceptor_sprite_ram_buffered[0x000/2];
480479   UINT16 *mem2 = &tceptor_sprite_ram_buffered[0x100/2];
r1877r1878
562561
563562   if (screen)
564563   {
565      int frame = cpu_getcurrentframe();
564      int frame = video_screen_get_frame_number(screen);
566565
567566      if ((frame & 1) == 1 && screen == 1)
568567         return UPDATE_HAS_NOT_CHANGED;
src/mame/video/cop01.c
r1877r1878
166166
167167***************************************************************************/
168168
169static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
169static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
170170{
171171   int offs,code,attr,sx,sy,flipx,flipy,color;
172172
src/mame/video/vindictr.c
r1877r1878
225225VIDEO_UPDATE( vindictr )
226226{
227227   struct atarimo_rect_list rectlist;
228   mame_bitmap *mobitmap;
228   bitmap_t *mobitmap;
229229   int x, y, r;
230230
231231   /* draw the playfield */
src/mame/video/aquarium.c
r1877r1878
1414extern UINT16 *aquarium_bak_videoram;
1515
1616/* gcpinbal.c modified */
17static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int y_offs)
17static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int y_offs)
1818{
1919   int offs,chain_pos;
2020   int x,y,curx,cury;
src/mame/video/metro.c
r1877r1878
554554
555555/* Draw sprites */
556556
557void metro_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
557void metro_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
558558{
559559   const int region      =   REGION_GFX1;
560560
r1877r1878
728728
729729***************************************************************************/
730730
731static void draw_tilemap(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, tilemap *tmap, UINT32 flags, UINT32 priority,
731static void draw_tilemap(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, tilemap *tmap, UINT32 flags, UINT32 priority,
732732                     int sx, int sy, int wx, int wy)   // scroll & window values
733733{
734734#if 1
r1877r1878
788788
789789
790790/* Draw all the layers that match the given priority */
791static void draw_layers(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri, int layers_ctrl)
791static void draw_layers(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri, int layers_ctrl)
792792{
793793   UINT16 layers_pri = metro_videoregs[0x10/2];
794794   int layer;
src/mame/video/angelkds.c
r1877r1878
139139
140140*/
141141
142static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int enable_n)
142static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int enable_n)
143143{
144144   const UINT8 *source = spriteram+0x100-4;
145145   const UINT8 *finish = spriteram;
src/mame/video/circusc.c
r1877r1878
165165
166166***************************************************************************/
167167
168static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
168static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
169169{
170170   int offs;
171171   UINT8 *sr;
src/mame/video/mikie.c
r1877r1878
135135       8, 8, 32, 32);
136136}
137137
138static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
138static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
139139{
140140   int offs;
141141
src/mame/video/midvunit.c
r1877r1878
306306   poly_extra_data *extra = poly_get_extra_data(poly);
307307   UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000];
308308   int textured = ((dma_data[0] & 0x300) == 0x100);
309   poly_draw_scanline callback;
309   poly_draw_scanline_func callback;
310310   poly_vertex vert[4];
311311
312312   /* if we're rendering to the same page we're viewing, it has changed */
src/mame/video/usgames.c
r1877r1878
7272}
7373
7474
75WRITE8_HANDLER( usgames_mc6845_address_w )
76{
77   mc6845_address_w(mc6845, data);
78}
79
80
81WRITE8_HANDLER( usgames_mc6845_register_w )
82{
83   mc6845_register_w(mc6845, data);
84}
85
86
8775VIDEO_UPDATE(usgames)
8876{
8977   tilemap_draw(bitmap,cliprect,usgames_tilemap,0,0);
src/mame/video/suna16.c
r1877r1878
117117
118118***************************************************************************/
119119
120static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT16 *sprites, int gfx)
120static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16 *sprites, int gfx)
121121{
122122   int offs;
123123
src/mame/video/zaccaria.c
r1877r1878
204204
205205***************************************************************************/
206206
207static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
207static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
208208{
209209   int offs;
210210   rectangle clip = *cliprect;
src/mame/video/shadfrce.c
r1877r1878
100100
101101
102102
103static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
103static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
104104{
105105
106106   /* | ---- ---- hhhf Fe-Y | ---- ---- yyyy yyyy | ---- ---- TTTT TTTT | ---- ---- tttt tttt |
src/mame/video/speedbal.c
r1877r1878
8282 *                                   *
8383 *************************************/
8484
85static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
85static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
8686{
8787   int x,y,code,color,offset,flipx,flipy;
8888
src/mame/video/tagteam.c
r1877r1878
8787   y = offset % 32;
8888   offset = 32 * y + x;
8989
90   tagteam_videoram_w(offset,data);
90   tagteam_videoram_w(machine,offset,data);
9191}
9292
9393WRITE8_HANDLER( tagteam_mirrorcolorram_w )
r1877r1878
9999   y = offset % 32;
100100   offset = 32 * y + x;
101101
102   tagteam_colorram_w(offset,data);
102   tagteam_colorram_w(machine,offset,data);
103103}
104104
105105WRITE8_HANDLER( tagteam_control_w )
r1877r1878
133133       8, 8, 32, 32);
134134}
135135
136static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
136static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
137137{
138138   int offs;
139139
src/mame/video/eolith.c
r1877r1878
11#include "driver.h"
22
33int eolith_buffer = 0;
4static mame_bitmap *bitmaps[2];
4static bitmap_t *bitmaps[2];
55static UINT32 *eo_vram;
66
77static void plot_pixel_rgb(int x, int y, int color)
r1877r1878
2525   switch(mem_mask)
2626   {
2727      case 0:
28         eolith_vram_w(offset,data,0x0000ffff);
29         eolith_vram_w(offset,data,0xffff0000);
28         eolith_vram_w(machine,offset,data,0x0000ffff);
29         eolith_vram_w(machine,offset,data,0xffff0000);
3030         return;
3131
3232      case 0xffff:
src/mame/video/gtia.c
r1877r1878
157157   int i;
158158    /* reset the GTIA read/write/helper registers */
159159   for (i = 0; i < 32; i++)
160      atari_gtia_w(i,0);
160      atari_gtia_w(machine,i,0);
161161    memset(&gtia.r, 0, sizeof(gtia.r));
162162   if (is_ntsc())
163163      gtia.r.pal = 0xff;
src/mame/video/bigevglf.c
r1877r1878
1919static UINT8 *vidram;
2020
2121
22static mame_bitmap *tmp_bitmap[4];
22static bitmap_t *tmp_bitmap[4];
2323
2424WRITE8_HANDLER(bigevglf_palette_w)
2525{
r1877r1878
6969   vidram = auto_malloc(0x100*0x100 * 4);
7070}
7171
72static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
72static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
7373{
7474   int i,j;
7575   for (i = 0xc0-4; i >= 0; i-=4)
src/mame/video/bagman.c
r1877r1878
107107       8, 8, 32, 32);
108108}
109109
110static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
110static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
111111{
112112   int offs;
113113
src/mame/video/inufuku.c
r1877r1878
6868
6969******************************************************************************/
7070
71static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
71static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
7272{
7373   int offs;
7474
src/mame/video/commando.c
r1877r1878
9797   tilemap_set_transparent_pen(fg_tilemap, 3);
9898}
9999
100static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
100static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
101101{
102102   int offs;
103103
r1877r1878
137137
138138VIDEO_EOF( commando )
139139{
140   buffer_spriteram_w(0, 0);
140   buffer_spriteram_w(machine, 0, 0);
141141}
src/mame/video/atarisy2.c
r1877r1878
302302      /* force an update if the link of object 0 is about to change */
303303      if (offs == 0x0c03)
304304         video_screen_update_partial(0, video_screen_get_vpos(0));
305      atarimo_0_spriteram_w(offs - 0x0c00, data, mem_mask);
305      atarimo_0_spriteram_w(machine, offs - 0x0c00, data, mem_mask);
306306   }
307307
308308   /* playfieldram? */
r1877r1878
331331VIDEO_UPDATE( atarisy2 )
332332{
333333   struct atarimo_rect_list rectlist;
334   mame_bitmap *mobitmap;
334   bitmap_t *mobitmap;
335335   int x, y, r;
336336
337337   /* draw the playfield */
src/mame/video/ninjakd2.c
r1877r1878
66
77static int sprite_overdraw_enabled;
88static int next_sprite_overdraw_enabled;
9static mame_bitmap *sp_bitmap;
9static bitmap_t *sp_bitmap;
1010// in robokid and omegaf big sprites are laid out differently in ROM
1111static int robokid_sprites;
1212
r1877r1878
335335 *
336336 *************************************/
337337
338static void draw_sprites(running_machine* const machine, mame_bitmap* const bitmap, const rectangle* const cliprect)
338static void draw_sprites(running_machine* const machine, bitmap_t* const bitmap, const rectangle* const cliprect)
339339{
340340   const gfx_element* const gfx = machine->gfx[1];
341341   int const big_xshift = robokid_sprites ? 1 : 0;
r1877r1878
437437}
438438
439439
440static void erase_sprites(running_machine* const machine, mame_bitmap* const bitmap, const rectangle* const cliprect)
440static void erase_sprites(running_machine* const machine, bitmap_t* const bitmap, const rectangle* const cliprect)
441441{
442442   // if sprite overdraw is disabled, clear the sprite framebuffer
443443   // if sprite overdraw is enabled, only clear palettes 0-B, and leave C-F on screen
src/mame/video/mjsister.c
r1877r1878
1616int mjsister_vrambank;
1717int mjsister_colorbank;
1818
19static mame_bitmap *mjsister_tmpbitmap0, *mjsister_tmpbitmap1;
19static bitmap_t *mjsister_tmpbitmap0, *mjsister_tmpbitmap1;
2020static UINT8 *mjsister_videoram0, *mjsister_videoram1;
2121
2222/****************************************************************************/
src/mame/video/skydiver.c
r1877r1878
1818MACHINE_RESET( skydiver )
1919{
2020   /* reset all latches */
21   skydiver_start_lamp_1_w(0, 0);
22   skydiver_start_lamp_2_w(0, 0);
23   skydiver_lamp_s_w(0, 0);
24   skydiver_lamp_k_w(0, 0);
25   skydiver_lamp_y_w(0, 0);
26   skydiver_lamp_d_w(0, 0);
21   skydiver_start_lamp_1_w(machine, 0, 0);
22   skydiver_start_lamp_2_w(machine, 0, 0);
23   skydiver_lamp_s_w(machine, 0, 0);
24   skydiver_lamp_k_w(machine, 0, 0);
25   skydiver_lamp_y_w(machine, 0, 0);
26   skydiver_lamp_d_w(machine, 0, 0);
2727   output_set_value("lampi", 0);
2828   output_set_value("lampv", 0);
2929   output_set_value("lampe", 0);
3030   output_set_value("lampr", 0);
31   skydiver_width_w(0, 0);
32   skydiver_coin_lockout_w(0, 0);
31   skydiver_width_w(machine, 0, 0);
32   skydiver_coin_lockout_w(machine, 0, 0);
3333}
3434
3535
r1877r1878
130130{
131131   int bit = offset & 0x01;
132132
133   watchdog_reset_w(0,0);
133   watchdog_reset_w(machine,0,0);
134134
135135   switch (offset & 0x0e)
136136   {
r1877r1878
147147         output_set_value("lampr", bit);
148148         break;
149149      case (0x0a):
150         discrete_sound_w(SKYDIVER_OCT1_EN, bit);
150         discrete_sound_w(machine, SKYDIVER_OCT1_EN, bit);
151151         break;
152152      case (0x0c):
153         discrete_sound_w(SKYDIVER_OCT2_EN, bit);
153         discrete_sound_w(machine, SKYDIVER_OCT2_EN, bit);
154154         break;
155155      case (0x0e):
156         discrete_sound_w(SKYDIVER_NOISE_RST, bit);
156         discrete_sound_w(machine, SKYDIVER_NOISE_RST, bit);
157157         break;
158158   }
159159}
r1877r1878
165165 *
166166 *************************************/
167167
168static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
168static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
169169{
170170   int pic;
171171
src/mame/video/m52.c
r1877r1878
298298 *
299299 *************************************/
300300
301static void draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int xpos, int ypos, int image)
301static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int xpos, int ypos, int image)
302302{
303303   rectangle rect;
304304
src/mame/video/spacefb.c
r1877r1878
205205
206206static void draw_starfield(running_machine *machine,
207207                     int scrnum,
208                     mame_bitmap *bitmap,
208                     bitmap_t *bitmap,
209209                     const rectangle *cliprect)
210210{
211211   int y;
r1877r1878
314314}
315315
316316
317static void draw_bullet(offs_t offs, pen_t pen, mame_bitmap *bitmap, const rectangle *cliprect)
317static void draw_bullet(offs_t offs, pen_t pen, bitmap_t *bitmap, const rectangle *cliprect)
318318{
319319   UINT8 sy;
320320
r1877r1878
365365}
366366
367367
368static void draw_sprite(offs_t offs, pen_t *pens, mame_bitmap *bitmap, const rectangle *cliprect)
368static void draw_sprite(offs_t offs, pen_t *pens, bitmap_t *bitmap, const rectangle *cliprect)
369369{
370370   UINT8 sy;
371371
r1877r1878
422422}
423423
424424
425static void draw_objects(mame_bitmap *bitmap, const rectangle *cliprect)
425static void draw_objects(bitmap_t *bitmap, const rectangle *cliprect)
426426{
427427   pen_t sprite_pens[NUM_SPRITE_PENS];
428428
src/mame/video/warpwarp.c
r1877r1878
218218
219219***************************************************************************/
220220
221INLINE void geebee_plot(mame_bitmap *bitmap, const rectangle *cliprect, int x, int y, pen_t pen)
221INLINE void geebee_plot(bitmap_t *bitmap, const rectangle *cliprect, int x, int y, pen_t pen)
222222{
223223   if (x >= cliprect->min_x && x <= cliprect->max_x && y >= cliprect->min_y && y <= cliprect->max_y)
224224      *BITMAP_ADDR16(bitmap, y, x) = pen;
225225}
226226
227static void draw_ball(mame_bitmap *bitmap, const rectangle *cliprect,pen_t pen)
227static void draw_ball(bitmap_t *bitmap, const rectangle *cliprect,pen_t pen)
228228{
229229   if (warpwarp_ball_on)
230230   {
src/mame/video/cbuster.c
r1877r1878
6666
6767/******************************************************************************/
6868
69static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri)
69static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri)
7070{
7171   int offs;
7272
r1877r1878
8787      if (x&0x2000) colour+=64;
8888
8989      flash=y&0x1000;
90      if (flash && (cpu_getcurrentframe() & 1)) continue;
90      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
9191
9292      fx = y & 0x2000;
9393      fy = y & 0x4000;
src/mame/video/jaguar.c
r1877r1878
136136
137137#include "driver.h"
138138#include "deprecat.h"
139#include "memconv.h"
139140#include "profiler.h"
140141#include "machine/atarigen.h"
141142#include "cpu/mips/r3000.h"
r1877r1878
196197static emu_timer *object_timer;
197198static UINT8 cpu_irq_state;
198199
199static mame_bitmap *screen_bitmap;
200static bitmap_t *screen_bitmap;
200201
201202static pen_t *pen_table;
202203
r1877r1878
706707
707708READ32_HANDLER( jaguar_tom_regs32_r )
708709{
709   return (jaguar_tom_regs_r(offset * 2, 0) << 16) | jaguar_tom_regs_r(offset * 2 + 1, 0);
710   return read32be_with_16be_handler(jaguar_tom_regs_r, machine, offset, mem_mask);
710711}
711712
712713
713714WRITE32_HANDLER( jaguar_tom_regs32_w )
714715{
715   if (ACCESSING_MSW32)
716      jaguar_tom_regs_w(offset * 2, data >> 16, mem_mask >> 16);
717   if (ACCESSING_LSW32)
718      jaguar_tom_regs_w(offset * 2 + 1, data, mem_mask);
716   write32be_with_16be_handler(jaguar_tom_regs_w, machine, offset, data, mem_mask);
719717}
720718
721719
src/mame/video/jalblend.c
r1877r1878
6565   return MAKE_RGB((UINT8)finalR,(UINT8)finalG,(UINT8)finalB) ;
6666}
6767
68static void jal_blend_drawgfx( mame_bitmap *dest_bmp,const gfx_element *gfx,
68static void jal_blend_drawgfx( bitmap_t *dest_bmp,const gfx_element *gfx,
6969                        UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy,
7070                        const rectangle *clip,int transparency,int transparent_color)
7171{
src/mame/video/gng.c
r1877r1878
114114
115115***************************************************************************/
116116
117static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
117static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
118118{
119119   const gfx_element *gfx = machine->gfx[2];
120120   int offs;
r1877r1878
156156
157157VIDEO_EOF( gng )
158158{
159   buffer_spriteram_w(0,0);
159   buffer_spriteram_w(machine,0,0);
160160}
src/mame/video/ojankohs.c
r1877r1878
2020static int ojankohs_scrollx, ojankohs_scrolly;
2121static tilemap *ojankohs_tilemap;
2222static int ojankoc_screen_refresh;
23static mame_bitmap *ojankoc_tmpbitmap;
23static bitmap_t *ojankoc_tmpbitmap;
2424
2525WRITE8_HANDLER( ojankoc_videoram_w );
2626
r1877r1878
209209
210210******************************************************************************/
211211
212void ojankoc_flipscreen(int data)
212void ojankoc_flipscreen(running_machine *machine, int data)
213213{
214214   static int ojankoc_flipscreen_old = 0;
215215   int x, y;
r1877r1878
223223      for (x = 0; x < 0x100; x++) {
224224         color1 = ojankohs_videoram[0x0000 + ((y * 256) + x)];
225225         color2 = ojankohs_videoram[0x3fff - ((y * 256) + x)];
226         ojankoc_videoram_w(0x0000 + ((y * 256) + x), color2);
227         ojankoc_videoram_w(0x3fff - ((y * 256) + x), color1);
226         ojankoc_videoram_w(machine, 0x0000 + ((y * 256) + x), color2);
227         ojankoc_videoram_w(machine, 0x3fff - ((y * 256) + x), color1);
228228
229229         color1 = ojankohs_videoram[0x4000 + ((y * 256) + x)];
230230         color2 = ojankohs_videoram[0x7fff - ((y * 256) + x)];
231         ojankoc_videoram_w(0x4000 + ((y * 256) + x), color2);
232         ojankoc_videoram_w(0x7fff - ((y * 256) + x), color1);
231         ojankoc_videoram_w(machine, 0x4000 + ((y * 256) + x), color2);
232         ojankoc_videoram_w(machine, 0x7fff - ((y * 256) + x), color1);
233233      }
234234   }
235235
r1877r1878
324324   {
325325      /* redraw bitmap */
326326      for (offs = 0; offs < 0x8000; offs++) {
327         ojankoc_videoram_w(offs, ojankohs_videoram[offs]);
327         ojankoc_videoram_w(machine, offs, ojankohs_videoram[offs]);
328328      }
329329      ojankoc_screen_refresh = 0;
330330   }
src/mame/video/n8080.c
r1877r1878
55***************************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
98#include "includes/n8080.h"
109
1110int spacefev_red_screen;
r1877r1878
194193                  6, /* cyan    */
195194               };
196195
197               int cycle = cpu_getcurrentframe() / 32;
196               int cycle = video_screen_get_frame_number(0) / 32;
198197
199198               color = ufo_color[cycle % 6];
200199            }
r1877r1878
369368
370369VIDEO_EOF( helifire )
371370{
372   int n = (cpu_getcurrentframe() >> 1) % sizeof helifire_LSFR;
371   int n = (video_screen_get_frame_number(0) >> 1) % sizeof helifire_LSFR;
373372
374373   int i;
375374
r1877r1878
386385            G |= B;
387386         }
388387
389         if (cpu_getcurrentframe() & 0x04)
388         if (video_screen_get_frame_number(0) & 0x04)
390389         {
391390            R |= G;
392391         }
src/mame/video/nbmj8891.c
r1877r1878
2424static int nbmj8891_screen_refresh;
2525static int gfxdraw_mode;
2626
27static mame_bitmap *nbmj8891_tmpbitmap0, *nbmj8891_tmpbitmap1;
27static bitmap_t *nbmj8891_tmpbitmap0, *nbmj8891_tmpbitmap1;
2828static UINT8 *nbmj8891_videoram0, *nbmj8891_videoram1;
2929static UINT8 *nbmj8891_palette;
3030static UINT8 *nbmj8891_clut;
src/mame/video/wc90b.c
r1877r1878
104104
105105***************************************************************************/
106106
107static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority ){
107static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority ){
108108  int offs;
109109
110110  /* draw all visible sprites of specified priority */
src/mame/video/kncljoe.c
r1877r1878
193193
194194***************************************************************************/
195195
196static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
196static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
197197{
198198   rectangle clip = *cliprect;
199199   const gfx_element *gfx = machine->gfx[1 + sprite_bank];
src/mame/video/holeland.c
r1877r1878
102102}
103103
104104
105static void holeland_draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
105static void holeland_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
106106{
107107   int offs,code,sx,sy,color,flipx, flipy;
108108
r1877r1878
141141   }
142142}
143143
144static void crzrally_draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
144static void crzrally_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
145145{
146146   int offs,code,sx,sy,color,flipx, flipy;
147147
src/mame/video/liberate.c
r1877r1878
1818static UINT8 deco16_io_ram[16];
1919
2020#if 0
21void debug_print(mame_bitmap *bitmap)
21void debug_print(bitmap_t *bitmap)
2222{
2323   int i,j;
2424   char buf[20*16];
r1877r1878
100100         /* Todo */
101101         break;
102102      case 8: /* Irq ack */
103         cpunum_set_input_line(Machine, 0,DECO16_IRQ_LINE,CLEAR_LINE);
103         cpunum_set_input_line(machine, 0,DECO16_IRQ_LINE,CLEAR_LINE);
104104         break;
105105      case 9: /* Sound */
106         soundlatch_w(0,data);
107         cpunum_set_input_line(Machine, 1,M6502_IRQ_LINE,HOLD_LINE);
106         soundlatch_w(machine,0,data);
107         cpunum_set_input_line(machine, 1,M6502_IRQ_LINE,HOLD_LINE);
108108         break;
109109   }
110110}
r1877r1878
147147WRITE8_HANDLER( prosport_paletteram_w )
148148{
149149   /* RGB output is inverted */
150   paletteram_BBGGGRRR_w(offset,~data);
150   paletteram_BBGGGRRR_w(machine,offset,~data);
151151}
152152
153153PALETTE_INIT( liberate )
r1877r1878
182182
183183/***************************************************************************/
184184
185static void liberate_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
185static void liberate_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
186186{
187187   int offs;
188188
r1877r1878
248248   }
249249}
250250
251static void prosport_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
251static void prosport_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
252252{
253253   int offs,multi,fx,fy,sx,sy,sy2,code,code2,color;
254254
r1877r1878
303303   }
304304}
305305
306static void boomrang_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri)
306static void boomrang_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri)
307307{
308308   int offs,multi,fx,fy,sx,sy,sy2,code,code2,color;
309309
src/mame/video/spdodgeb.c
r1877r1878
155155               (which+order),color+ 8 * sprite_palbank,flipx,flipy,sx,sy, \
156156               cliprect,TRANSPARENCY_PEN,0);
157157
158static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
158static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
159159{
160160   const gfx_element *gfx = machine->gfx[1];
161161   UINT8 *src;
src/mame/video/gunsmoke.c
r1877r1878
149149   state_save_register_global(sprite3bank);
150150}
151151
152static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
152static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
153153{
154154   int offs;
155155
src/mame/video/cvs.c
r1877r1878
2020
2121
2222static s2636_t *s2636_0, *s2636_1, *s2636_2;
23static mame_bitmap *background_bitmap;
24mame_bitmap *cvs_collision_background;
25static mame_bitmap *scrolled_collision_background;
23static bitmap_t *background_bitmap;
24bitmap_t *cvs_collision_background;
25static bitmap_t *scrolled_collision_background;
2626
2727int cvs_collision_register;
2828
r1877r1878
210210   offs_t offs;
211211   int scroll[8];
212212   UINT8 character_banking_mode;
213   mame_bitmap *s2636_0_bitmap;
214   mame_bitmap *s2636_1_bitmap;
215   mame_bitmap *s2636_2_bitmap;
213   bitmap_t *s2636_0_bitmap;
214   bitmap_t *s2636_1_bitmap;
215   bitmap_t *s2636_2_bitmap;
216216
217217   set_pens(machine->colortable);
218218
src/mame/video/turbo.c
r1877r1878
398398VIDEO_UPDATE( turbo )
399399{
400400   turbo_state *state = machine->driver_data;
401   mame_bitmap *fgpixmap = tilemap_get_pixmap(state->fg_tilemap);
401   bitmap_t *fgpixmap = tilemap_get_pixmap(state->fg_tilemap);
402402   const UINT8 *road_gfxdata = memory_region(REGION_GFX3);
403403   const UINT8 *prom_base = memory_region(REGION_PROMS);
404404   const UINT8 *pr1114 = prom_base + 0x000;
r1877r1878
753753VIDEO_UPDATE( subroc3d )
754754{
755755   turbo_state *state = machine->driver_data;
756   mame_bitmap *fgpixmap = tilemap_get_pixmap(state->fg_tilemap);
756   bitmap_t *fgpixmap = tilemap_get_pixmap(state->fg_tilemap);
757757   const UINT8 *prom_base = memory_region(REGION_PROMS);
758758   const UINT8 *pr1419 = prom_base + 0x000;
759759   const UINT8 *pr1620 = prom_base + 0x200;
r1877r1878
972972VIDEO_UPDATE( buckrog )
973973{
974974   turbo_state *state = machine->driver_data;
975   mame_bitmap *fgpixmap = tilemap_get_pixmap(state->fg_tilemap);
975   bitmap_t *fgpixmap = tilemap_get_pixmap(state->fg_tilemap);
976976   const UINT8 *bgcolor = memory_region(REGION_GFX3);
977977   const UINT8 *prom_base = memory_region(REGION_PROMS);
978978   const UINT8 *pr5194 = prom_base + 0x000;
src/mame/video/seta.c
r1877r1878
710710***************************************************************************/
711711
712712
713static void draw_sprites_map(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
713static void draw_sprites_map(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
714714{
715715   int offs, col;
716716   int xoffs, yoffs;
r1877r1878
814814
815815
816816
817static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
817static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
818818{
819819   int offs;
820820   int xoffs, yoffs;
src/mame/video/tnzs.c
r1877r1878
4545
4646
4747
48static void draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT8 *m)
48static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8 *m)
4949{
5050   int x,y,column,tot,flag;
5151   int scrollx, scrolly;
r1877r1878
131131
132132
133133static void draw_foreground(running_machine *machine,
134                     mame_bitmap *bitmap,
134                     bitmap_t *bitmap,
135135                     const rectangle *cliprect,
136136                      UINT8 *char_pointer,
137137                      UINT8 *x_pointer,
src/mame/video/tp84.c
r1877r1878
88
99#include "driver.h"
1010#include "video/resnet.h"
11#include "deprecat.h"
1211
13UINT8 *tp84_videoram2, *tp84_colorram2;
1412
15static int col0;
13UINT8 *tp84_bg_videoram;
14UINT8 *tp84_bg_colorram;
15UINT8 *tp84_fg_videoram;
16UINT8 *tp84_fg_colorram;
17UINT8 *tp84_spriteram;
18UINT8 *tp84_scroll_x;
19UINT8 *tp84_scroll_y;
20UINT8 *tp84_palette_bank;
21UINT8 *tp84_flipscreen_x;
22UINT8 *tp84_flipscreen_y;
1623
17/*
18sprites are multiplexed, so we have to buffer the spriteram
19scanline by scanline.
20*/
21static UINT8 *sprite_mux_buffer;
22static int scanline;
23
2424static tilemap *bg_tilemap, *fg_tilemap;
2525
26
2627/*
2728-The colortable is divided in 2 part:
2829 -The characters colors
r1877r1878
3031
3132-The characters colors are indexed like this:
3233 -2 bits from the characters
33 -4 bits from the attribute in colorram
34 -2 bits from col0 (d3-d4)
35 -3 bits from col0 (d0-d1-d2)
34 -4 bits from the attribute in tp84_bg_colorram
35 -2 bits from palette_bank (d3-d4)
36 -3 bits from palette_bank (d0-d1-d2)
3637-So, there is 2048 bytes for the characters
3738
3839-The sprites colors are indexed like this:
3940 -4 bits from the sprites (16 colors)
4041 -4 bits from the attribute of the sprites
41 -3 bits from col0 (d0-d1-d2)
42 -3 bits from palette_bank (d0-d1-d2)
4243-So, there is 2048 bytes for the sprites
4344
4445*/
r1877r1878
5354PALETTE_INIT( tp84 )
5455{
5556   static const int resistances[4] = { 1000, 470, 220, 100 };
56   double rweights[4], gweights[4], bweights[4];
57   double weights[4];
5758   int i;
5859
5960   /* compute the color output resistor weights */
6061   compute_resistor_weights(0,   255, -1.0,
61         4, resistances, rweights, 470, 0,
62         4, resistances, gweights, 470, 0,
63         4, resistances, bweights, 470, 0);
62         4, resistances, weights, 470, 0,
63         0, 0, 0, 0, 0,
64         0, 0, 0, 0, 0);
6465
6566   /* allocate the colortable */
6667   machine->colortable = colortable_alloc(machine, 0x100);
r1877r1878
7677      bit1 = (color_prom[i + 0x000] >> 1) & 0x01;
7778      bit2 = (color_prom[i + 0x000] >> 2) & 0x01;
7879      bit3 = (color_prom[i + 0x000] >> 3) & 0x01;
79      r = combine_4_weights(rweights, bit0, bit1, bit2, bit3);
80      r = combine_4_weights(weights, bit0, bit1, bit2, bit3);
8081
8182      /* green component */
8283      bit0 = (color_prom[i + 0x100] >> 0) & 0x01;
8384      bit1 = (color_prom[i + 0x100] >> 1) & 0x01;
8485      bit2 = (color_prom[i + 0x100] >> 2) & 0x01;
8586      bit3 = (color_prom[i + 0x100] >> 3) & 0x01;
86      g = combine_4_weights(gweights, bit0, bit1, bit2, bit3);
87      g = combine_4_weights(weights, bit0, bit1, bit2, bit3);
8788
8889      /* blue component */
8990      bit0 = (color_prom[i + 0x200] >> 0) & 0x01;
9091      bit1 = (color_prom[i + 0x200] >> 1) & 0x01;
9192      bit2 = (color_prom[i + 0x200] >> 2) & 0x01;
9293      bit3 = (color_prom[i + 0x200] >> 3) & 0x01;
93      b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
94      b = combine_4_weights(weights, bit0, bit1, bit2, bit3);
9495
9596      colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
9697   }
r1877r1878
112113}
113114
114115
115WRITE8_HANDLER( tp84_videoram_w )
116WRITE8_HANDLER( tp84_spriteram_w )
116117{
117   videoram[offset] = data;
118   tilemap_mark_tile_dirty(bg_tilemap, offset);
118   /* the game multiplexes the sprites, so update now */
119   video_screen_update_now(0);
120   tp84_spriteram[offset] = data;
119121}
120122
121WRITE8_HANDLER( tp84_colorram_w )
122{
123   colorram[offset] = data;
124   tilemap_mark_tile_dirty(bg_tilemap, offset);
125}
126123
127WRITE8_HANDLER( tp84_videoram2_w )
128{
129   tp84_videoram2[offset] = data;
130   tilemap_mark_tile_dirty(fg_tilemap, offset);
131}
132
133WRITE8_HANDLER( tp84_colorram2_w )
134{
135   tp84_colorram2[offset] = data;
136   tilemap_mark_tile_dirty(fg_tilemap, offset);
137}
138
139WRITE8_HANDLER( tp84_scroll_x_w )
140{
141   tilemap_set_scrollx(bg_tilemap, 0, data);
142}
143
144WRITE8_HANDLER( tp84_scroll_y_w )
145{
146   tilemap_set_scrolly(bg_tilemap, 0, data);
147}
148
149WRITE8_HANDLER( tp84_flipscreen_x_w )
150{
151   flip_screen_x_set(data & 0x01);
152}
153
154WRITE8_HANDLER( tp84_flipscreen_y_w )
155{
156   flip_screen_y_set(data & 0x01);
157}
158
159/*****
160  col0 is a register to index the color Proms
161*****/
162WRITE8_HANDLER( tp84_col0_w )
163{
164   if (col0 != data)
165   {
166      col0 = data;
167      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
168   }
169}
170
171/* Return the current video scan line */
172124READ8_HANDLER( tp84_scanline_r )
173125{
174   return scanline;
126   /* reads 1V - 128V */
127   return video_screen_get_vpos(0);
175128}
176129
130
177131static TILE_GET_INFO( get_bg_tile_info )
178132{
179   int coloffs = ((col0 & 0x18) << 1) + ((col0 & 0x07) << 6);
180   int attr = colorram[tile_index];
181   int code = videoram[tile_index] + ((attr & 0x30) << 4);
182   int color = (attr & 0x0f) + coloffs;
183   int flags = ((attr & 0x40) ? TILE_FLIPX : 0) | ((attr & 0x80) ? TILE_FLIPY : 0);
133   int code = ((tp84_bg_colorram[tile_index] & 0x30) << 4) | tp84_bg_videoram[tile_index];
134   int color = ((*tp84_palette_bank & 0x07) << 6) |
135            ((*tp84_palette_bank & 0x18) << 1) |
136            (tp84_bg_colorram[tile_index] & 0x0f);
137   int flags = TILE_FLIPYX(tp84_bg_colorram[tile_index] >> 6);
184138
185139   SET_TILE_INFO(0, code, color, flags);
186140}
187141
188142static TILE_GET_INFO( get_fg_tile_info )
189143{
190   int coloffs = ((col0 & 0x18) << 1) + ((col0 & 0x07) << 6);
191   int attr = tp84_colorram2[tile_index];
192   int code = tp84_videoram2[tile_index]+ ((attr & 0x30) << 4);
193   int color = (attr & 0x0f) + coloffs;
194   int flags = ((attr & 0x40) ? TILE_FLIPX : 0) | ((attr & 0x80) ? TILE_FLIPY : 0) | TILE_FORCE_LAYER0;
144   int code = ((tp84_fg_colorram[tile_index] & 0x30) << 4) | tp84_fg_videoram[tile_index];
145   int color = ((*tp84_palette_bank & 0x07) << 6) |
146            ((*tp84_palette_bank & 0x18) << 1) |
147            (tp84_fg_colorram[tile_index] & 0x0f);
148   int flags = TILE_FLIPYX(tp84_fg_colorram[tile_index] >> 6);
195149
196150   SET_TILE_INFO(0, code, color, flags);
197151}
198152
153
199154VIDEO_START( tp84 )
200155{
201   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,
202       8, 8, 32, 32);
203
204   fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_rows,
205       8, 8, 32, 32);
206
207   tilemap_set_transparent_pen(fg_tilemap, 0);
208
209   sprite_mux_buffer = auto_malloc(256 * spriteram_size);
156   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
157   fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
210158}
211159
212static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
160
161static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
213162{
214   const gfx_element *gfx = machine->gfx[1];
215163   int offs;
216   int line;
217   int coloffset = ((col0&0x07) << 4);
164   int palette_base = ((*tp84_palette_bank & 0x07) << 4);
218165
219   for (line = cliprect->min_y; line <= cliprect->max_y; line++)
166   for (offs = 0x5c; offs >= 0; offs -= 4)
220167   {
221      UINT8 *sr;
222      rectangle clip = *cliprect;
168      int x = tp84_spriteram[offs];
169      int y = 240 - tp84_spriteram[offs + 3];
223170
224      sr = sprite_mux_buffer + line * spriteram_size;
225      clip.min_y = clip.max_y = line;
171      int code = tp84_spriteram[offs + 1];
172      int color = palette_base | (tp84_spriteram[offs + 2] & 0x0f);
173      int flip_x = ~tp84_spriteram[offs + 2] & 0x40;
174      int flip_y =  tp84_spriteram[offs + 2] & 0x80;
226175
227      for (offs = spriteram_size - 4;offs >= 0;offs -= 4)
228      {
229         int code,color,sx,sy,flipx,flipy;
176      drawgfx(bitmap, machine->gfx[1], code, color, flip_x, flip_y, x, y, cliprect, TRANSPARENCY_PENS,
177            colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, palette_base));
230178
231         sx = sr[offs];
232         sy = 240 - sr[offs + 3];
233
234         if (sy > line-16 && sy <= line)
235         {
236            code = sr[offs + 1];
237            color = (sr[offs + 2] & 0x0f) + coloffset;
238            flipx = ~sr[offs + 2] & 0x40;
239            flipy = sr[offs + 2] & 0x80;
240
241            drawgfx(bitmap,gfx,
242                  code,
243                  color,
244                  flipx,flipy,
245                  sx,sy,
246                  &clip,TRANSPARENCY_PENS,
247                  colortable_get_transpen_mask(machine->colortable, gfx, color, coloffset));
248         }
249      }
250179   }
251180}
252181
182
253183VIDEO_UPDATE( tp84 )
254184{
255   rectangle clip;
185   rectangle clip = *cliprect;
256186
187   if (cliprect->min_y == machine->screen[screen].visarea.min_y)
188   {
189      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
190
191      tilemap_set_scrollx(bg_tilemap, 0, *tp84_scroll_x);
192      tilemap_set_scrolly(bg_tilemap, 0, *tp84_scroll_y);
193
194      tilemap_set_flip(ALL_TILEMAPS, ((*tp84_flipscreen_x & 0x01) ? TILEMAP_FLIPX : 0) |
195                              ((*tp84_flipscreen_y & 0x01) ? TILEMAP_FLIPY : 0));
196   }
197
257198   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
258199   draw_sprites(machine, bitmap, cliprect);
259200
260   /* draw top fg_tilemap status layer part */
201   /* draw top status region */
261202   clip.min_x = machine->screen[0].visarea.min_x;
262   clip.max_x = machine->screen[0].visarea.min_x+15;
263   clip.min_y = machine->screen[0].visarea.min_y;
264   clip.max_y = machine->screen[0].visarea.max_y;
203   clip.max_x = machine->screen[0].visarea.min_x + 15;
265204   tilemap_draw(bitmap, &clip, fg_tilemap, 0, 0);
266205
267   /* the middle part of fg_tilemap seems to be used as normal ram and is skipped */
268
269   /* draw bottom fg_tilemap status layer part */
270   clip.min_x = machine->screen[0].visarea.max_x-15;
206   /* draw bottom status region */
207   clip.min_x = machine->screen[0].visarea.max_x - 15;
271208   clip.max_x = machine->screen[0].visarea.max_x;
272   clip.min_y = machine->screen[0].visarea.min_y;
273   clip.max_y = machine->screen[0].visarea.max_y;
274209   tilemap_draw(bitmap, &clip, fg_tilemap, 0, 0);
210
275211   return 0;
276212}
277
278INTERRUPT_GEN( tp84_6809_interrupt )
279{
280   scanline = 255 - cpu_getiloops();
281
282   memcpy(sprite_mux_buffer + scanline * spriteram_size,spriteram,spriteram_size);
283
284   if (scanline == 255)
285      irq0_line_hold(machine, cpunum);
286}
src/mame/video/rohga.c
r1877r1878
55***************************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
98#include "deco16ic.h"
109
1110static UINT16 * rohga_spriteram;
r1877r1878
7069
7170/******************************************************************************/
7271
73static void rohga_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, const UINT16 *spriteptr, int is_schmeisr)
72static void rohga_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT16 *spriteptr, int is_schmeisr)
7473{
7574   int offs;
7675
r1877r1878
9291
9392      y = spriteptr[offs];
9493      flash=y&0x1000;
95      if (flash && (cpu_getcurrentframe() & 1)) continue;
94      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
9695
9796      // Sprite colour is different between Rohga (6bpp) and Schmeisr (4bpp plus wire mods on pcb)
9897      if (is_schmeisr)
r1877r1878
147146   }
148147}
149148
150static void wizdfire_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT16 *spriteptr, int mode, int bank)
149static void wizdfire_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16 *spriteptr, int mode, int bank)
151150{
152151   int offs;
153152
r1877r1878
191190
192191      y = spriteptr[offs];
193192      flash=y&0x1000;
194      if (flash && (cpu_getcurrentframe() & 1)) continue;
193      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
195194      colour = (x >> 9) &0x1f;
196195
197196      if (bank==4 && colour&0x10) {
r1877r1878
244243   }
245244}
246245
247static void nitrobal_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, const UINT16 *spriteptr, int gfxbank)
246static void nitrobal_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT16 *spriteptr, int gfxbank)
248247{
249248   int offs,end,inc;
250249
r1877r1878
298297      w = (spriteptr[offs+2]&0x0f00)>> 8;
299298
300299      sy = spriteptr[offs];
301      if ((sy&0x2000) && (cpu_getcurrentframe() & 1)) {
300      if ((sy&0x2000) && (video_screen_get_frame_number(0) & 1)) {
302301         offs+=inc;
303302         continue;
304303      }
r1877r1878
436435
437436/******************************************************************************/
438437
439static void update_rohga(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int is_schmeisr)
438static void update_rohga(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int is_schmeisr)
440439{
441440   /* Update playfields */
442441   flip_screen_set( deco16_pf12_control[0]&0x80 );
src/mame/video/vball.c
r1877r1878
114114               (which+order),color,flipx,flipy,sx,sy, \
115115               cliprect,TRANSPARENCY_PEN,0);
116116
117static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
117static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
118118{
119119   const gfx_element *gfx = machine->gfx[1];
120120   UINT8 *src = spriteram;
src/mame/video/higemaru.c
r1877r1878
100100   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
101101}
102102
103static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
103static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
104104{
105105   int offs;
106106
src/mame/video/batman.c
r1877r1878
196196VIDEO_UPDATE( batman )
197197{
198198   struct atarimo_rect_list rectlist;
199   mame_bitmap *mobitmap;
199   bitmap_t *mobitmap;
200200   int x, y, r;
201201
202202   /* draw the playfield */
src/mame/video/nemesis.c
r1877r1878
241241   tilemap_flip = 0;
242242}
243243
244static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
244static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
245245{
246246   /*
247247     *  16 bytes per sprite, in memory from 56000-56fff
src/mame/video/cheekyms.c
r1877r1878
22 Universal Cheeky Mouse Driver
33 (c)Lee Taylor May 1998, All rights reserved.
44
5 For use only in offical Mame releases.
5 For use only in offical MAME releases.
66 Not to be distrabuted as part of any commerical work.
77***************************************************************************
88Functions to emulate the video hardware of the machine.
r1877r1878
1212#include "sound/dac.h"
1313
1414
15static int man_scroll = -1;
16static UINT8 sprites[0x20];
17static int char_palette = 0;
15UINT8 *cheekyms_videoram;
16UINT8 *cheekyms_spriteram;
17UINT8 *cheekyms_port_80;
1818
19static tilemap *cheekyms_tilemap;
1920
21
22/* bit 3 and 7 of the char color PROMs are used for something -- not currently emulated -
23   thus GAME_IMPERFECT_GRAPHICS */
24
2025PALETTE_INIT( cheekyms )
2126{
2227   int i,j,bit,r,g,b;
r1877r1878
4146}
4247
4348
44WRITE8_HANDLER( cheekyms_sprite_w )
49WRITE8_HANDLER( cheekyms_port_40_w )
4550{
46   sprites[offset] = data;
51   /* the lower bits probably trigger sound samples */
52
53   DAC_data_w(0, data ? 0x80 : 0);
4754}
4855
4956
50WRITE8_HANDLER( cheekyms_port_40_w )
57WRITE8_HANDLER( cheekyms_port_80_w )
5158{
52   static int last_dac = -1;
59   /* d0-d1 - sound enables, not sure which bit is which */
60   /* d3-d5 - man scroll amount */
61   /* d6 - palette select (selects either 0 = PROM M9, 1 = PROM M8) */
62   /* d7 - screen flip */
63   *cheekyms_port_80 = data;
5364
54   /* The lower bits probably trigger sound samples */
65   /* d2 - interrupt enable */
66   interrupt_enable_w(machine, offset, data & 0x04);
67}
5568
56   if (last_dac != (data & 0x80))
57   {
58      last_dac = data & 0x80;
5969
60      DAC_data_w(0, last_dac ? 0x80 : 0);
61   }
62}
6370
64
65WRITE8_HANDLER( cheekyms_port_80_w )
71static TILE_GET_INFO( cheekyms_get_tile_info )
6672{
67   /* Bits 0-1 Sound enables, not sure which bit is which */
73   int color;
6874
69   /* Bit 2 is interrupt enable */
70   interrupt_enable_w(offset, data & 0x04);
75   int x = tile_index & 0x1f;
76   int y = tile_index >> 5;
77   int code = cheekyms_videoram[tile_index];
78   int palette = (*cheekyms_port_80 >> 2) & 0x10;
7179
72   /* Bit 3-5 Man scroll amount */
73   man_scroll = (data >> 3) & 0x07;
80   if (x >= 0x1e)
81   {
82      if (y < 0x0c)
83         color = 0x15;
84      else if (y < 0x14)
85         color = 0x16;
86      else
87         color = 0x14;
88   }
89   else
90   {
91      if ((y == 0x04) || (y == 0x1b))
92         color = palette | 0x0c;
93      else
94         color = palette | (x >> 1);
95   }
7496
75   /* Bit 6 is palette select (Selects either 0 = PROM M9, 1 = PROM M8) */
76   char_palette = (data >> 2) & 0x10;
77
78   /* Bit 7 is screen flip */
79   flip_screen_set(data & 0x80);
97   SET_TILE_INFO(0, code, color, 0);
8098}
8199
82100
83
84VIDEO_UPDATE( cheekyms )
101VIDEO_START( cheekyms )
85102{
86   int offs;
103   cheekyms_tilemap = tilemap_create(cheekyms_get_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
104   tilemap_set_transparent_pen(cheekyms_tilemap, 0);
105}
87106
88107
89   fillbitmap(bitmap,0,cliprect);
108static void draw_sprites(gfx_element **gfx, bitmap_t *bitmap, const rectangle *cliprect, int flip)
109{
110   offs_t offs;
90111
91   /* Draw the sprites first, because they're supposed to appear below
92       the characters */
93   for (offs = 0; offs < sizeof(sprites)/sizeof(sprites[0]); offs += 4)
112   for (offs = 0; offs < 0x20; offs += 4)
94113   {
95      int v1, sx, sy, col, code;
114      int x, y, code, color;
96115
97      v1  = sprites[offs + 0];
98      sy  = sprites[offs + 1];
99      sx  = 256 - sprites[offs + 2];
100      col = (~sprites[offs + 3] & 0x07);
116      if ((cheekyms_spriteram[offs + 3] & 0x08) == 0x00) continue;
101117
102      if (!(sprites[offs + 3] & 0x08)) continue;
118      x  = 256 - cheekyms_spriteram[offs + 2];
119      y  = cheekyms_spriteram[offs + 1];
120      code =  (~cheekyms_spriteram[offs + 0] & 0x0f) << 1;
121      color = (~cheekyms_spriteram[offs + 3] & 0x07);
103122
104      code = (~v1 << 1) & 0x1f;
105
106      if (v1 & 0x80)
123      if (cheekyms_spriteram[offs + 0] & 0x80)
107124      {
108         if (!flip_screen_get())
125         if (!flip)
109126            code++;
110127
111         drawgfx(bitmap,machine->gfx[1],
112               code,
113               col,
114               0,0,
115               sx,sy,
116               cliprect,TRANSPARENCY_PEN,0);
128         drawgfx(bitmap, gfx[1], code, color, 0, 0, x, y, cliprect, TRANSPARENCY_PEN, 0);
117129      }
118130      else
119131      {
120         drawgfx(bitmap,machine->gfx[1],
121               code + 0x20,
122               col,
123               0,0,
124               sx,sy,
125               cliprect,TRANSPARENCY_PEN,0);
126
127         drawgfx(bitmap,machine->gfx[1],
128               code + 0x21,
129               col,
130               0,0,
131               sx + 8*(v1 & 2),sy + 8*(~v1 & 2),
132               cliprect,TRANSPARENCY_PEN,0);
132         if (cheekyms_spriteram[offs + 0] & 0x02)
133         {
134            drawgfx(bitmap, gfx[1], code | 0x20, color, 0, 0,        x, y, cliprect, TRANSPARENCY_PEN, 0);
135            drawgfx(bitmap, gfx[1], code | 0x21, color, 0, 0, 0x10 + x, y, cliprect, TRANSPARENCY_PEN, 0);
136         }
137         else
138         {
139            drawgfx(bitmap, gfx[1], code | 0x20, color, 0, 0, x,        y, cliprect, TRANSPARENCY_PEN, 0);
140            drawgfx(bitmap, gfx[1], code | 0x21, color, 0, 0, x, 0x10 + y, cliprect, TRANSPARENCY_PEN, 0);
141         }
133142      }
134143   }
144}
135145
136146
137   for (offs = videoram_size - 1;offs >= 0;offs--)
138   {
139      int sx,sy,man_area,color;
147VIDEO_UPDATE( cheekyms )
148{
149   #define SCROLL_X_MIN  8
150   #define SCROLL_X_MAX  12
151   #define SCROLL_Y_MIN  6
152   #define SCROLL_Y_MAX  25
140153
141      sx = offs % 32;
142      sy = offs / 32;
154   const rectangle clip_no_scroll_top      = {                   0*8,                  32*8-1,                0*8,     SCROLL_Y_MIN*8-1 };
155   const rectangle clip_no_scroll_bottom   = {                   0*8,                  32*8-1, (SCROLL_Y_MAX+1)*8,               32*8-1 };
156   const rectangle clip_no_scroll_left_nf  = {                   0*8,        SCROLL_X_MIN*8-1,     SCROLL_Y_MIN*8, (SCROLL_Y_MAX+1)*8-1 };
157   const rectangle clip_no_scroll_right_nf = {    (SCROLL_X_MAX+1)*8,                  32*8-1,     SCROLL_Y_MIN*8, (SCROLL_Y_MAX+1)*8-1 };
158   const rectangle clip_no_scroll_left_f   = {   (32-SCROLL_X_MIN)*8,                  32*8-1,     SCROLL_Y_MIN*8, (SCROLL_Y_MAX+1)*8-1 };
159   const rectangle clip_no_scroll_right_f  = {                   0*8, (32-SCROLL_X_MAX-1)*8-1,     SCROLL_Y_MIN*8, (SCROLL_Y_MAX+1)*8-1 };
160   const rectangle clip_scroll_nf          = {        SCROLL_X_MIN*8,                  13*8-1,     SCROLL_Y_MIN*8, (SCROLL_Y_MAX+1)*8-1 };
161   const rectangle clip_scroll_f           = { (32-SCROLL_X_MAX-1)*8,   (32-SCROLL_X_MIN)*8-1,     SCROLL_Y_MIN*8, (SCROLL_Y_MAX+1)*8-1 };
143162
163   int flip = *cheekyms_port_80 & 0x80;
144164
145      man_area = ((sy >=  6) && (sy <= 26) && (sx >=  8) && (sx <= 12));
165   tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
166   tilemap_set_flip(ALL_TILEMAPS, flip ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
146167
147      if (sx >= 30)
148      {
149         if (sy < 12)
150            color = 0x15;
151         else if (sy < 20)
152            color = 0x16;
153         else
154            color = 0x14;
155      }
156      else
157      {
158         color = ((sx >> 1) & 0x0f) + char_palette;
159         if (sy == 4 || sy == 27)
160            color = 0xc + char_palette;
161      }
168   fillbitmap(bitmap, 0, cliprect);
162169
163      if (flip_screen_get())
164      {
165         sx = 31 - sx;
166         sy = 31 - sy;
167      }
170   /* sprites go under the playfield */
171   draw_sprites(machine->gfx, bitmap, cliprect, flip);
168172
169      drawgfx(bitmap,machine->gfx[0],
170            videoram[offs],
171            color,
172            flip_screen_get(),flip_screen_get(),
173            8*sx, 8*sy - (man_area ? man_scroll : 0),
174            cliprect,TRANSPARENCY_PEN,0);
173   /* draw the non-scrolling parts of the playfield first */
174   tilemap_set_scrolly(cheekyms_tilemap, 0, 0);
175   tilemap_draw(bitmap, &clip_no_scroll_top,    cheekyms_tilemap, 0, 0);
176   tilemap_draw(bitmap, &clip_no_scroll_bottom, cheekyms_tilemap, 0, 0);
177
178   if (flip)
179   {
180      tilemap_draw(bitmap, &clip_no_scroll_left_f,   cheekyms_tilemap, 0, 0);
181      tilemap_draw(bitmap, &clip_no_scroll_right_f,  cheekyms_tilemap, 0, 0);
175182   }
183   else
184   {
185      tilemap_draw(bitmap, &clip_no_scroll_left_nf,  cheekyms_tilemap, 0, 0);
186      tilemap_draw(bitmap, &clip_no_scroll_right_nf, cheekyms_tilemap, 0, 0);
187   }
176188
189   /* now the scrolling part */
190   if (flip)
191   {
192      tilemap_set_scrolly(cheekyms_tilemap, 0, -((*cheekyms_port_80 >> 3) & 0x07));
193      tilemap_draw(bitmap, &clip_scroll_f,  cheekyms_tilemap, 0, 0);
194   }
195   else
196   {
197      tilemap_set_scrolly(cheekyms_tilemap, 0, (*cheekyms_port_80 >> 3) & 0x07);
198      tilemap_draw(bitmap, &clip_scroll_nf, cheekyms_tilemap, 0, 0);
199   }
200
177201   return 0;
178202}
src/mame/video/timelimt.c
r1877r1878
113113}
114114
115115
116static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
116static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
117117{
118118   int offs;
119119
src/mame/video/warriorb.c
r1877r1878
4040            SPRITE DRAW ROUTINE
4141************************************************************/
4242
43static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int x_offs,int y_offs)
43static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int x_offs,int y_offs)
4444{
4545   int offs, data, data2, tilenum, color, flipx, flipy;
4646   int x, y, priority, pri_mask;
src/mame/video/deco16ic.c
r1877r1878
163163static tilemap *pf1_tilemap_16x16,*pf2_tilemap_16x16,*pf3_tilemap_16x16,*pf4_tilemap_16x16;
164164static tilemap *pf1_tilemap_8x8,*pf2_tilemap_8x8;
165165
166static mame_bitmap *sprite_priority_bitmap;
166static bitmap_t *sprite_priority_bitmap;
167167
168168static UINT8 *dirty_palette;
169169static int deco16_pf1_bank,deco16_pf2_bank,deco16_pf3_bank,deco16_pf4_bank;
r1877r1878
175175static int (*deco16_bank_callback_2)(const int bank);
176176static int (*deco16_bank_callback_3)(const int bank);
177177static int (*deco16_bank_callback_4)(const int bank);
178static void custom_tilemap_draw(mame_bitmap *bitmap,tilemap *tilemap0_8x8,tilemap *tilemap0_16x16,
178static void custom_tilemap_draw(bitmap_t *bitmap,tilemap *tilemap0_8x8,tilemap *tilemap0_16x16,
179179   tilemap *tilemap1_8x8,tilemap *tilemap1_16x16, const UINT16 *rowscroll_ptr,const UINT16 scrollx,
180180   const UINT16 scrolly,const UINT16 control0, const UINT16 control1,int combine_mask,int combine_shift,int trans_mask,int flags,UINT32 priority);
181181
r1877r1878
796796
797797/*****************************************************************************************/
798798
799void deco16_print_debug_info(mame_bitmap *bitmap)
799void deco16_print_debug_info(bitmap_t *bitmap)
800800{
801801   char buf[64*5];
802802
r1877r1878
831831}
832832
833833/* A special pdrawgfx z-buffered sprite renderer that is needed to properly draw multiple sprite sources with alpha */
834void deco16_pdrawgfx(mame_bitmap *dest,const gfx_element *gfx,
834void deco16_pdrawgfx(bitmap_t *dest,const gfx_element *gfx,
835835      UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
836836      const rectangle *clip,int transparency,int transparent_color,UINT32 pri_mask,UINT32 sprite_mask,UINT8 write_pri)
837837{
r1877r1878
896896
897897/*****************************************************************************************/
898898
899void deco16_tilemap_1_draw(mame_bitmap *bitmap, const rectangle *cliprect, int flags, UINT32 priority)
899void deco16_tilemap_1_draw(bitmap_t *bitmap, const rectangle *cliprect, int flags, UINT32 priority)
900900{
901901   if (use_custom_pf1)
902902   {
r1877r1878
909909   }
910910}
911911
912void deco16_tilemap_2_draw(mame_bitmap *bitmap, const rectangle *cliprect, int flags, UINT32 priority)
912void deco16_tilemap_2_draw(bitmap_t *bitmap, const rectangle *cliprect, int flags, UINT32 priority)
913913{
914914   if (use_custom_pf2)
915915   {
r1877r1878
922922   }
923923}
924924
925void deco16_tilemap_3_draw(mame_bitmap *bitmap, const rectangle *cliprect, int flags, UINT32 priority)
925void deco16_tilemap_3_draw(bitmap_t *bitmap, const rectangle *cliprect, int flags, UINT32 priority)
926926{
927927   if (use_custom_pf3) custom_tilemap_draw(bitmap,0,pf3_tilemap_16x16,0,0,pf3_rowscroll_ptr,deco16_pf34_control[1], deco16_pf34_control[2], deco16_pf34_control[5]&0xff, deco16_pf34_control[6]&0xff, 0, 0, deco16_pf3_trans_mask, flags, priority);
928928   else if (pf3_tilemap_16x16) tilemap_draw(bitmap,cliprect,pf3_tilemap_16x16,flags,priority);
929929}
930930
931void deco16_tilemap_4_draw(mame_bitmap *bitmap, const rectangle *cliprect, int flags, UINT32 priority)
931void deco16_tilemap_4_draw(bitmap_t *bitmap, const rectangle *cliprect, int flags, UINT32 priority)
932932{
933933   if (use_custom_pf4) custom_tilemap_draw(bitmap,0,pf4_tilemap_16x16,0,0,pf4_rowscroll_ptr,deco16_pf34_control[3], deco16_pf34_control[4], deco16_pf34_control[5]>>8, deco16_pf34_control[6]>>8, 0, 0, deco16_pf4_trans_mask, flags, priority);
934934   else if (pf4_tilemap_16x16) tilemap_draw(bitmap,cliprect,pf4_tilemap_16x16,flags,priority);
r1877r1878
937937/*****************************************************************************************/
938938
939939// Combines the output of two 4BPP tilemaps into an 8BPP tilemap
940void deco16_tilemap_34_combine_draw(mame_bitmap *bitmap, const rectangle *cliprect, int flags, UINT32 priority)
940void deco16_tilemap_34_combine_draw(bitmap_t *bitmap, const rectangle *cliprect, int flags, UINT32 priority)
941941{
942942   custom_tilemap_draw(bitmap,0,pf3_tilemap_16x16,0,pf4_tilemap_16x16,pf3_rowscroll_ptr,deco16_pf34_control[1], deco16_pf34_control[2], deco16_pf34_control[5]&0xff, deco16_pf34_control[6]&0xff, 0xf, 4, 0xff, flags, priority);
943943}
r1877r1878
953953*/
954954
955955static void custom_tilemap_draw(
956   mame_bitmap *bitmap,
956   bitmap_t *bitmap,
957957   tilemap *tilemap0_8x8,
958958   tilemap *tilemap0_16x16,
959959   tilemap *tilemap1_8x8,
r1877r1878
971971{
972972   tilemap *tilemap0 = (control1&0x80) ? tilemap0_8x8 : tilemap0_16x16;
973973   tilemap *tilemap1 = (control1&0x80) ? tilemap1_8x8 : tilemap1_16x16;
974   const mame_bitmap *src_bitmap0 = tilemap0 ? tilemap_get_pixmap(tilemap0) : NULL;
975   const mame_bitmap *src_bitmap1 = tilemap1 ? tilemap_get_pixmap(tilemap1) : NULL;
974   const bitmap_t *src_bitmap0 = tilemap0 ? tilemap_get_pixmap(tilemap0) : NULL;
975   const bitmap_t *src_bitmap1 = tilemap1 ? tilemap_get_pixmap(tilemap1) : NULL;
976976   int width_mask, height_mask, x, y, p;
977977   int column_offset, src_x=0, src_y=0;
978978   int   row_type=1 << ((control0>>3)&0xf);
src/mame/video/goal92.c
r1877r1878
8989   SET_TILE_INFO(region,tile,color,0);
9090}
9191
92static void draw_sprites(running_machine *machine,mame_bitmap *bitmap,const rectangle *cliprect,int pri)
92static void draw_sprites(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect,int pri)
9393{
9494   int offs,fx,fy,x,y,color,sprite;
9595
src/mame/video/1942.c
r1877r1878
198198
199199***************************************************************************/
200200
201static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
201static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
202202{
203203   int offs;
204204
src/mame/video/raiden.c
r1877r1878
100100   }
101101}
102102
103static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int pri_mask)
103static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int pri_mask)
104104{
105105   int offs,fx,fy,x,y,color,sprite;
106106
src/mame/video/bloodbro.c
r1877r1878
143143   -------X XXXXXXXX
144144   -------- YYYYYYYY */
145145
146static void bloodbro_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
146static void bloodbro_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
147147{
148148   int offs;
149149   for (offs = 0;offs < spriteram_size/2;offs += 4)
r1877r1878
190190   -------X XXXXXXXX
191191*/
192192
193static void weststry_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
193static void weststry_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
194194{
195195   int offs;
196196
src/mame/video/bombjack.c
r1877r1878
7676   state_save_register_global(background_image);
7777}
7878
79static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
79static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
8080{
8181   int offs;
8282
src/mame/video/rallyx.c
r1877r1878
482482
483483
484484
485static void plot_star(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int x, int y, int color)
485static void plot_star(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int x, int y, int color)
486486{
487487   if (y < cliprect->min_y ||
488488      y > cliprect->max_y ||
r1877r1878
500500      *BITMAP_ADDR16(bitmap, y, x) = STARS_COLOR_BASE + color;
501501}
502502
503static void draw_stars(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
503static void draw_stars(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
504504{
505505   int offs;
506506
r1877r1878
515515}
516516
517517
518static void rallyx_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int displacement )
518static void rallyx_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int displacement )
519519{
520520   int offs;
521521
r1877r1878
539539   }
540540}
541541
542static void locomotn_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int displacement )
542static void locomotn_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int displacement )
543543{
544544   int offs;
545545
r1877r1878
564564   }
565565}
566566
567static void rallyx_draw_bullets(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int transparency )
567static void rallyx_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int transparency )
568568{
569569   int offs;
570570
r1877r1878
585585   }
586586}
587587
588static void jungler_draw_bullets(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int transparency )
588static void jungler_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int transparency )
589589{
590590   int offs;
591591
r1877r1878
605605   }
606606}
607607
608static void locomotn_draw_bullets(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int transparency )
608static void locomotn_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int transparency )
609609{
610610   int offs;
611611
src/mame/video/unico.c
r1877r1878
217217
218218***************************************************************************/
219219
220static void unico_draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
220static void unico_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
221221{
222222   int offs;
223223
r1877r1878
270270   }
271271}
272272
273static void zeropnt2_draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
273static void zeropnt2_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
274274{
275275   int offs;
276276
src/mame/video/gcpinbal.c
r1877r1878
193193
194194****************************************************************/
195195
196static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int y_offs)
196static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int y_offs)
197197{
198198   int offs,chain_pos;
199199   int x,y,curx,cury;
src/mame/video/realbrk.c
r1877r1878
2525
2626//UINT16 *realbrk_vram_0, *realbrk_vram_1, *realbrk_vram_2, *realbrk_vregs;
2727UINT16 *realbrk_vram_0, *realbrk_vram_1, *realbrk_vram_2, *realbrk_vregs, *realbrk_vram_0ras, *realbrk_vram_1ras;
28static mame_bitmap *tmpbitmap0 = NULL;
29static mame_bitmap *tmpbitmap1 = NULL;
28static bitmap_t *tmpbitmap0 = NULL;
29static bitmap_t *tmpbitmap1 = NULL;
3030
3131static int disable_video;
3232
r1877r1878
228228
229229***************************************************************************/
230230
231static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
231static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
232232{
233233   int offs;
234234
r1877r1878
395395
396396/* DaiDaiKakumei */
397397/* layer : 0== bghigh<spr    1== bglow<spr<bghigh     2==spr<bglow    3==boarder */
398static void dai2kaku_draw_sprites( mame_bitmap *bitmap,const rectangle *cliprect, int layer)
398static void dai2kaku_draw_sprites( bitmap_t *bitmap,const rectangle *cliprect, int layer)
399399{
400400   int offs;
401401
src/mame/video/diverboy.c
r1877r1878
11/* Diver Boy - Video Hardware */
22
33#include "driver.h"
4#include "deprecat.h"
54
65UINT16 *diverboy_spriteram;
76size_t diverboy_spriteram_size;
r1877r1878
1110{
1211}
1312
14static void draw_sprites(running_machine* machine, mame_bitmap *bitmap, const rectangle *cliprect )
13static void draw_sprites(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect )
1514{
1615   UINT16 *source = diverboy_spriteram;
1716   UINT16 *finish = source + (diverboy_spriteram_size/2);
r1877r1878
3231
3332      bank = (source[1]&0x0002) >> 1;
3433
35      if (!flash || (cpu_getcurrentframe() & 1))
34      if (!flash || (video_screen_get_frame_number(0) & 1))
3635      {
3736         drawgfx(bitmap,machine->gfx[bank],
3837               number,
src/mame/video/superchs.c
r1877r1878
6767
6868********************************************************/
6969
70static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,const int *primasks,int x_offs,int y_offs)
70static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,const int *primasks,int x_offs,int y_offs)
7171{
7272   UINT16 *spritemap = (UINT16 *)memory_region(REGION_USER1);
7373   int offs, data, tilenum, color, flipx, flipy;
src/mame/video/battlera.c
r1877r1878
1414static int HuC6270_registers[20];
1515static int VDC_register,vram_ptr;
1616static UINT8 *HuC6270_vram,*tile_dirty,*sprite_dirty,*vram_dirty;
17static mame_bitmap *tile_bitmap,*front_bitmap;
17static bitmap_t *tile_bitmap,*front_bitmap;
1818
1919static int current_scanline,inc_value;
2020static int irq_enable,rcr_enable,sb_enable,bb_enable,bldwolf_vblank;
r1877r1878
243243
244244/******************************************************************************/
245245
246static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *clip,int pri)
246static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *clip,int pri)
247247{
248248   int offs,my,mx,code,code2,fx,fy,cgy=0,cgx,colour,i,yinc;
249249
r1877r1878
307307
308308}
309309
310static void screenrefresh(running_machine *machine, mame_bitmap *bitmap,const rectangle *clip)
310static void screenrefresh(running_machine *machine, bitmap_t *bitmap,const rectangle *clip)
311311{
312312   int offs,code,scrollx,scrolly,mx,my;
313313
src/mame/video/flower.c
r1877r1878
2727      colortable_entry_set_value(machine->colortable, i, i);
2828}
2929
30static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
30static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
3131{
3232   const gfx_element *gfx = machine->gfx[1];
3333   UINT8 *source = spriteram + 0x200;
src/mame/video/xain.c
r1877r1878
168168
169169***************************************************************************/
170170
171static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
171static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
172172{
173173   int offs;
174174
src/mame/video/namcos1.c
r1877r1878
27427415   xxxxxxxx  Y position
275275*/
276276
277static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
277static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
278278{
279279   const UINT8 *source = &spriteram[0x0800-0x20];   /* the last is NOT a sprite */
280280   const UINT8 *finish = &spriteram[0];
src/mame/video/mrdo.c
r1877r1878
225225
226226***************************************************************************/
227227
228static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
228static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
229229{
230230   int offs;
231231
src/mame/video/m62.c
r1877r1878
340340}
341341
342342
343static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int colormask, int prioritymask, int priority)
343static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int colormask, int prioritymask, int priority)
344344{
345345   int offs;
346346
r1877r1878
399399   }
400400}
401401
402static void m62_start( tile_get_info_callback tile_get_info, int rows, int cols, int x1, int y1, int x2, int y2 )
402static void m62_start( tile_get_info_func tile_get_info, int rows, int cols, int x1, int y1, int x2, int y2 )
403403{
404404   m62_background = tilemap_create( tile_get_info, tilemap_scan_rows,  x1, y1, x2, y2 );
405405
r1877r1878
418418   }
419419}
420420
421static void m62_textlayer( tile_get_info_callback tile_get_info, int rows, int cols, int x1, int y1, int x2, int y2 )
421static void m62_textlayer( tile_get_info_func tile_get_info, int rows, int cols, int x1, int y1, int x2, int y2 )
422422{
423423   m62_foreground = tilemap_create( tile_get_info, tilemap_scan_rows,  x1, y1, x2, y2 );
424424
r1877r1878
800800
801801WRITE8_HANDLER( spelunk2_gfxport_w )
802802{
803   m62_hscroll_high_w(0,(data&2)>>1);
804   m62_vscroll_high_w(0,(data&1));
803   m62_hscroll_high_w(machine,0,(data&2)>>1);
804   m62_vscroll_high_w(machine,0,(data&1));
805805   if (spelunkr_palbank != ((data & 0x0c) >> 2))
806806   {
807807      spelunkr_palbank = (data & 0x0c) >> 2;
src/mame/video/astrocde.c
r1877r1878
55***************************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
98#include "cpu/z80/z80.h"
109#include "includes/astrocde.h"
1110#include "sound/astrocde.h"
12#include <math.h> /* for sin() and cos() */
13#include "osd_cpu.h"
1411#include "video/resnet.h"
1512
1613
r1877r1878
312309
313310   /* compute the starting point of sparkle for the current frame */
314311   if (astrocade_video_config & AC_STARS)
315      sparklebase = ((UINT64)cpu_getcurrentframe() * (UINT64)(machine->screen[0].width * machine->screen[0].height)) % RNG_PERIOD;
312      sparklebase = (video_screen_get_frame_number(0) * (UINT64)(machine->screen[0].width * machine->screen[0].height)) % RNG_PERIOD;
316313
317314   /* iterate over scanlines */
318315   for (y = cliprect->min_y; y <= cliprect->max_y; y++)
r1877r1878
623620      case 0x17:   /* noise volume register */
624621      case 0x18:   /* sound block transfer */
625622         if (astrocade_video_config & AC_SOUND_PRESENT)
626            astrocade_sound1_w(offset, data);
623            astrocade_sound1_w(machine, offset, data);
627624         break;
628625
629626      case 0x19:   /* expand register */
src/mame/video/toki.c
r1877r1878
3939
4040VIDEO_EOF( toki )
4141{
42   buffer_spriteram16_w(0,0,0);
42   buffer_spriteram16_w(machine,0,0,0);
4343}
4444
4545VIDEO_EOF( tokib )
4646{
47   buffer_spriteram16_w(0,0,0);
47   buffer_spriteram16_w(machine,0,0,0);
4848}
4949
5050static TILE_GET_INFO( get_text_tile_info )
r1877r1878
176176***************************************************************************/
177177
178178
179static void toki_draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
179static void toki_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
180180{
181181   int x,y,xoffs,yoffs,tile,flipx,flipy,color,offs;
182182   UINT16 *sprite_word;
r1877r1878
220220}
221221
222222
223static void tokib_draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
223static void tokib_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
224224{
225225   int x,y,tile,flipx,color,offs;
226226   UINT16 *sprite_word;
src/mame/video/40love.c
r1877r1878
1616static UINT8 *fortyl_pixram1;
1717static UINT8 *fortyl_pixram2;
1818
19static mame_bitmap *pixel_bitmap1;
20static mame_bitmap *pixel_bitmap2;
19static bitmap_t *pixel_bitmap1;
20static bitmap_t *pixel_bitmap2;
2121
2222static tilemap *background;
2323
r1877r1878
256256    offset  3   xxxxxxxx    x position
257257*/
258258
259static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
259static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
260260{
261261   int offs;
262262
r1877r1878
319319   }
320320}
321321
322static void draw_pixram( mame_bitmap *bitmap, const rectangle *cliprect )
322static void draw_pixram( bitmap_t *bitmap, const rectangle *cliprect )
323323{
324324   int offs;
325325   int f = fortyl_flipscreen ^ 1;
src/mame/video/renegade.c
r1877r1878
8080   state_save_register_func_postload(all_tiles_dirty);
8181}
8282
83static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
83static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
8484{
8585   UINT8 *source = spriteram;
8686   UINT8 *finish = source + 96 * 4;
src/mame/video/galaga.c
r1877r1878
494494
495495***************************************************************************/
496496
497static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
497static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
498498{
499499   int offs;
500500
r1877r1878
542542}
543543
544544
545static void draw_stars(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
545static void draw_stars(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
546546{
547547   /* draw the stars */
548548
src/mame/video/lasso.c
r1877r1878
249249      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
250250   }
251251
252   lasso_flip_screen_w(offset, data);
252   lasso_flip_screen_w(machine, offset, data);
253253}
254254
255255WRITE8_HANDLER( wwjgtin_video_control_w )
r1877r1878
263263      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
264264   }
265265
266   lasso_flip_screen_w(offset, data);
266   lasso_flip_screen_w(machine, offset, data);
267267}
268268
269269WRITE8_HANDLER( pinbo_video_control_w )
r1877r1878
271271   /* no need to dirty the tilemap -- only the sprites use the global bank */
272272   gfxbank = (data & 0x0c) >> 2;
273273
274   lasso_flip_screen_w(offset, data);
274   lasso_flip_screen_w(machine, offset, data);
275275}
276276
277277
r1877r1878
281281 *
282282 *************************************/
283283
284static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int reverse )
284static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int reverse )
285285{
286286   const UINT8 *finish, *source;
287287   int inc;
r1877r1878
340340}
341341
342342
343static void draw_lasso(mame_bitmap *bitmap, const rectangle *cliprect)
343static void draw_lasso(bitmap_t *bitmap, const rectangle *cliprect)
344344{
345345   offs_t offs;
346346   pen_t pen = 0x3f;
src/mame/video/nbmj8688.c
r1877r1878
2323static int mjsikaku_screen_refresh;
2424static int mjsikaku_gfxmode;
2525
26static mame_bitmap *mjsikaku_tmpbitmap;
26static bitmap_t *mjsikaku_tmpbitmap;
2727static UINT16 *mjsikaku_videoram;
2828static UINT8 *nbmj8688_clut;
2929
r1877r1878
198198WRITE8_HANDLER( secolove_romsel_w )
199199{
200200   mjsikaku_gfxrom = ((data & 0xc0) >> 4) + (data & 0x03);
201   mjsikaku_gfxflag2_w(0, data);
201   mjsikaku_gfxflag2_w(machine, 0, data);
202202
203203   if ((mjsikaku_gfxrom << 17) > (memory_region_length(REGION_GFX1) - 1))
204204   {
r1877r1878
212212WRITE8_HANDLER( crystalg_romsel_w )
213213{
214214   mjsikaku_gfxrom = (data & 0x03);
215   mjsikaku_gfxflag2_w(0, data);
215   mjsikaku_gfxflag2_w(machine, 0, data);
216216
217217   if ((mjsikaku_gfxrom << 17) > (memory_region_length(REGION_GFX1) - 1))
218218   {
r1877r1878
226226WRITE8_HANDLER( seiha_romsel_w )
227227{
228228   mjsikaku_gfxrom = (data & 0x1f);
229   mjsikaku_gfxflag3_w(0, data);
229   mjsikaku_gfxflag3_w(machine, 0, data);
230230
231231   if ((mjsikaku_gfxrom << 17) > (memory_region_length(REGION_GFX1) - 1))
232232   {
src/mame/video/psychic5.c
r1877r1878
171171         switch(offset)
172172         {
173173            case 0x00:
174               val = input_port_0_r(0);
174               val = input_port_0_r(machine,0);
175175               break;
176176            case 0x01:
177               val = input_port_1_r(0);
177               val = input_port_1_r(machine,0);
178178               break;
179179            case 0x02:
180               val = input_port_2_r(0);
180               val = input_port_2_r(machine,0);
181181               break;
182182            case 0x03:
183               val = input_port_3_r(0);
183               val = input_port_3_r(machine,0);
184184               break;
185185            case 0x04:
186               val = input_port_4_r(0);
186               val = input_port_4_r(machine,0);
187187               break;
188188            default:
189189               val = ps5_io_ram[offset];
r1877r1878
199199         return psychic5_fg_videoram[offset & 0xfff];
200200      }
201201   }
202   return 0;
203202}
204203
205204WRITE8_HANDLER( psychic5_paged_ram_w )
r1877r1878
207206   if (!ps5_vram_page)
208207   {
209208      if (offset < 0x1000)
210         psychic5_bg_videoram_w(offset,data);
209         psychic5_bg_videoram_w(machine,offset,data);
211210      else
212211         ps5_dummy_bg_ram[offset & 0xfff] = data;
213212   }
r1877r1878
239238      }
240239      else
241240      {
242         psychic5_fg_videoram_w(offset & 0xfff, data);
241         psychic5_fg_videoram_w(machine, offset & 0xfff, data);
243242      }
244243   }
245244}
r1877r1878
294293#define DRAW_SPRITE(code, sx, sy) jal_blend_drawgfx(bitmap, machine->gfx[0], code, color, flipx, flipy, sx, sy, cliprect, TRANSPARENCY_PEN, 15);
295294/* #define DRAW_SPRITE(code, sx, sy) drawgfx(bitmap, machine->gfx[0], code, color, flipx, flipy, sx, sy, cliprect, TRANSPARENCY_PEN, 15); */
296295
297static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
296static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
298297{
299298   int offs;
300299
r1877r1878
362361   }
363362}
364363
365static void draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
364static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
366365{
367366   int bg_scrollx = (ps5_io_ram[BG_SCROLLX_LSB] + ((ps5_io_ram[BG_SCROLLX_MSB] & 0x03) << 8)) & 0x3ff;
368367   int bg_scrolly = (ps5_io_ram[BG_SCROLLY_LSB] + ((ps5_io_ram[BG_SCROLLY_MSB] & 0x01) << 8)) & 0x1ff;
src/mame/video/taito_h.c
r1877r1878
9797  Screen refresh
9898***************************************************************************/
9999
100static void syvalion_draw_sprites(mame_bitmap *bitmap,const rectangle *cliprect)
100static void syvalion_draw_sprites(bitmap_t *bitmap,const rectangle *cliprect)
101101{
102102   /* Y chain size is 16/32?/64/64? pixels. X chain size
103103       is always 64 pixels. */
r1877r1878
190190   }
191191}
192192
193static void recordbr_draw_sprites(mame_bitmap *bitmap, const rectangle *cliprect, int priority)
193static void recordbr_draw_sprites(bitmap_t *bitmap, const rectangle *cliprect, int priority)
194194{
195195   /* Y chain size is 16/32?/64/64? pixels. X chain size
196196       is always 64 pixels. */
r1877r1878
302302   }
303303}
304304
305static void dleague_draw_sprites(mame_bitmap *bitmap, const rectangle *cliprect, int priority)
305static void dleague_draw_sprites(bitmap_t *bitmap, const rectangle *cliprect, int priority)
306306{
307307   /* Y chain size is 16/32?/64/64? pixels. X chain size
308308       is always 64 pixels. */
src/mame/video/othunder.c
r1877r1878
8383********************************************************/
8484
8585
86static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,const int *primasks,int y_offs)
86static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,const int *primasks,int y_offs)
8787{
8888   UINT16 *spritemap = (UINT16 *)memory_region(REGION_USER1);
8989   UINT16 tile_mask = (machine->gfx[0]->total_elements) - 1;
src/mame/video/8080bw.c
r1877r1878
7979}
8080
8181
82INLINE void set_pixel(mame_bitmap *bitmap, UINT8 y, UINT8 x, pen_t *pens, UINT8 color)
82INLINE void set_pixel(bitmap_t *bitmap, UINT8 y, UINT8 x, pen_t *pens, UINT8 color)
8383{
8484   if (y >= MW8080BW_VCOUNTER_START_NO_VBLANK)
8585   {
r1877r1878
9191}
9292
9393
94INLINE void set_8_pixels(mame_bitmap *bitmap, UINT8 y, UINT8 x, UINT8 data,
94INLINE void set_8_pixels(bitmap_t *bitmap, UINT8 y, UINT8 x, UINT8 data,
9595                    pen_t *pens, UINT8 fore_color, UINT8 back_color)
9696{
9797   int i;
r1877r1878
107107
108108
109109/* this is needed as this driver doesn't emulate the shift register like mw8080bw does */
110static void clear_extra_columns(mame_bitmap *bitmap, pen_t *pens, UINT8 color)
110static void clear_extra_columns(bitmap_t *bitmap, pen_t *pens, UINT8 color)
111111{
112112   UINT8 x;
113113
src/mame/video/ginganin.c
r1877r1878
181181      tilemap_set_flip(ALL_TILEMAPS,flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
182182      break;
183183   case 7:
184      soundlatch_w(0,data);
184      soundlatch_w(machine,0,data);
185185      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
186186      break;
187187   default:
r1877r1878
211211
212212------------------------------------------------------------------------ */
213213
214static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
214static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
215215{
216216int offs;
217217
src/mame/video/tail2nos.c
r1877r1878
135135
136136***************************************************************************/
137137
138static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
138static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
139139{
140140   int offs;
141141
src/mame/video/quasar.c
r1877r1878
112112VIDEO_UPDATE( quasar )
113113{
114114   int offs;
115   mame_bitmap *s2636_0_bitmap;
116   mame_bitmap *s2636_1_bitmap;
117   mame_bitmap *s2636_2_bitmap;
115   bitmap_t *s2636_0_bitmap;
116   bitmap_t *s2636_1_bitmap;
117   bitmap_t *s2636_2_bitmap;
118118
119119   /* for every character in the video RAM */
120120   for (offs = 0; offs < 0x0400; offs++)
src/mame/video/mrjong.c
r1877r1878
101101   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows_flip_xy, 8, 8, 32, 32);
102102}
103103
104static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
104static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
105105{
106106   int offs;
107107
src/mame/video/slapshot.c
r1877r1878
7474            SPRITE DRAW ROUTINES
7575************************************************************/
7676
77static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int *primasks,int y_offset)
77static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int *primasks,int y_offset)
7878{
7979   /*
8080        Sprite format:
src/mame/video/1943.c
r1877r1878
193193   tilemap_set_transparent_pen(fg_tilemap, 0);
194194}
195195
196static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
196static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority)
197197{
198198   int offs;
199199
src/mame/video/psikyo4.c
r1877r1878
3232extern UINT32 *psikyo4_vidregs;
3333
3434/* --- SPRITES --- */
35static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT32 scr )
35static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT32 scr )
3636{
3737   /*- Sprite Format 0x0000 - 0x2bff -**
3838
src/mame/video/pacland.c
r1877r1878
3434static const UINT8 *pacland_color_prom;
3535
3636static tilemap *bg_tilemap, *fg_tilemap;
37static mame_bitmap *fg_bitmap;
37static bitmap_t *fg_bitmap;
3838
3939static UINT32 *transmask[3];
4040
r1877r1878
286286***************************************************************************/
287287
288288/* the sprite generator IC is the same as Mappy */
289static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int whichmask)
289static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int whichmask)
290290{
291291   int offs;
292292
r1877r1878
343343}
344344
345345
346static void draw_fg(mame_bitmap *bitmap, const rectangle *cliprect, int priority )
346static void draw_fg(bitmap_t *bitmap, const rectangle *cliprect, int priority )
347347{
348348   int y, x;
349349
src/mame/video/cninja.c
r1877r1878
55****************************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
98#include "deco16ic.h"
109#include "cninja.h"
1110
r1877r1878
105104   deco16_raster_display_position=0;
106105}
107106
108static void raster_pf3_draw(mame_bitmap *bitmap, const rectangle *cliprect, int flags, int pri)
107static void raster_pf3_draw(bitmap_t *bitmap, const rectangle *cliprect, int flags, int pri)
109108{
110109   tilemap *tmap=deco16_get_tilemap(2,0);
111110   int ptr=0,start,end=0;
r1877r1878
151150
152151/******************************************************************************/
153152
154static void cninja_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
153static void cninja_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
155154{
156155   int offs;
157156
r1877r1878
174173
175174      y = buffered_spriteram16[offs];
176175      flash=y&0x1000;
177      if (flash && (cpu_getcurrentframe() & 1)) continue;
176      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
178177      colour = (x >> 9) &0x1f;
179178
180179      fx = y & 0x2000;
r1877r1878
220219   }
221220}
222221
223static void robocop2_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
222static void robocop2_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
224223{
225224   int offs;
226225
r1877r1878
242241
243242      y = buffered_spriteram16[offs];
244243      flash=y&0x1000;
245      if (flash && (cpu_getcurrentframe() & 1)) continue;
244      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
246245      colour = (x >> 9) &0x1f;
247246
248247      fx = y & 0x2000;
r1877r1878
288287   }
289288}
290289
291static void mutantf_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, const UINT16 *spriteptr, int gfxbank)
290static void mutantf_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT16 *spriteptr, int gfxbank)
292291{
293292   int offs,end,inc;
294293
r1877r1878
340339      w = (spriteptr[offs+2]&0x0f00)>> 8;
341340
342341      sy = spriteptr[offs];
343      if ((sy&0x2000) && (cpu_getcurrentframe() & 1)) {
342      if ((sy&0x2000) && (video_screen_get_frame_number(0) & 1)) {
344343         offs+=inc;
345344         continue;
346345      }
src/mame/video/jcross.c
r1877r1878
109109**
110110***************************************************************************/
111111
112static void draw_status(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
112static void draw_status(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
113113{
114114   const UINT8 *base =  jcr_textram + 0x400;
115115   const gfx_element *gfx = machine->gfx[0];
r1877r1878
136136   }
137137}
138138
139static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int scrollx, int scrolly )
139static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int scrollx, int scrolly )
140140{
141141   const gfx_element *gfx = machine->gfx[3];
142142   const UINT8 *source, *finish;
src/mame/video/popper.c
r1877r1878
177177   state_save_register_global(popper_gfx_bank);
178178}
179179
180static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
180static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
181181{
182182   int offs,sx,sy,flipx,flipy;
183183
src/mame/video/ddrible.c
r1877r1878
180180
181181***************************************************************************/
182182
183static void draw_sprites(running_machine* machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT8* source, int lenght, int gfxset, int flipscreen )
183static void draw_sprites(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8* source, int lenght, int gfxset, int flipscreen )
184184{
185185   gfx_element *gfx = machine->gfx[gfxset];
186186   const UINT8 *finish = source + lenght;
src/mame/video/ladyfrog.c
r1877r1878
5353WRITE8_HANDLER( ladyfrog_palette_w )
5454{
5555   if (offset & 0x100)
56      paletteram_xxxxBBBBGGGGRRRR_split2_w((offset & 0xff) + (palette_bank << 8),data);
56      paletteram_xxxxBBBBGGGGRRRR_split2_w(machine, (offset & 0xff) + (palette_bank << 8),data);
5757   else
58      paletteram_xxxxBBBBGGGGRRRR_split1_w((offset & 0xff) + (palette_bank << 8),data);
58      paletteram_xxxxBBBBGGGGRRRR_split1_w(machine, (offset & 0xff) + (palette_bank << 8),data);
5959}
6060
6161READ8_HANDLER( ladyfrog_palette_r )
r1877r1878
9797   tilemap_set_scrolly(bg_tilemap, offset, data );
9898}
9999
100static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
100static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
101101{
102102   int i;
103103   for (i=0;i<0x20;i++)
src/mame/video/sidearms.c
r1877r1878
172172   flipon = charon = staron = objon = bgon = 0;
173173}
174174
175static void draw_sprites_region(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int start_offset, int end_offset )
175static void draw_sprites_region(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int start_offset, int end_offset )
176176{
177177   const gfx_element *gfx = machine->gfx[2];
178178   int offs, attr, color, code, x, y, flipx, flipy;
r1877r1878
204204   }
205205}
206206
207static void sidearms_draw_starfield( mame_bitmap *bitmap )
207static void sidearms_draw_starfield( bitmap_t *bitmap )
208208{
209209   int x, y, i;
210210   UINT32 hadd_283, vadd_283, _hflop_74a_n, _hcount_191, _vcount_191;
r1877r1878
327327#endif
328328}
329329
330static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
330static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
331331{
332332   if (sidearms_gameid == 2 || sidearms_gameid == 3) // Dyger and Whizz have simple front-to-back sprite priority
333333      draw_sprites_region(machine, bitmap, cliprect, 0x0000, 0x1000);
r1877r1878
360360
361361VIDEO_EOF( sidearms )
362362{
363   buffer_spriteram_w(0, 0);
363   buffer_spriteram_w(machine, 0, 0);
364364}
src/mame/video/model2rd.c
r1877r1878
5656/* non-textured render path */
5757static void MODEL2_FUNC_NAME(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
5858{
59#if !defined( MODEL2_TRANSLUCENT)
5960   const poly_extra_data *extra = extradata;
60   mame_bitmap *destmap = dest;
61   bitmap_t *destmap = dest;
6162   UINT32 *p = BITMAP_ADDR32(destmap, scanline, 0);
6263
6364   /* extract color information */
r1877r1878
7172   UINT8   luma;
7273   UINT32   tr, tg, tb;
7374   int      x;
74
75#endif
7576   /* if it's translucent, there's nothing to render */
7677#if defined( MODEL2_TRANSLUCENT)
7778   return;
78#endif
79#else
7980
8081   luma = lumaram[BYTE_XOR_LE(lumabase + (0xf << 3))] & 0x3F;
8182
r1877r1878
101102#else
102103      p[x] = color;
103104#endif
105#endif
104106}
105107
106108#else
r1877r1878
108110static void MODEL2_FUNC_NAME(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
109111{
110112   const poly_extra_data *extra = extradata;
111   mame_bitmap *destmap = dest;
113   bitmap_t *destmap = dest;
112114   UINT32 *p = BITMAP_ADDR32(destmap, scanline, 0);
113115
114116   UINT32   tex_width = extra->texwidth;
src/mame/video/jack.c
r1877r1878
2525WRITE8_HANDLER( jack_paletteram_w )
2626{
2727   /* RGB output is inverted */
28   paletteram_BBGGGRRR_w(offset,~data);
28   paletteram_BBGGGRRR_w(machine,offset,~data);
2929}
3030
3131READ8_HANDLER( jack_flipscreen_r )
r1877r1878
5858   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_cols_flipy,  8, 8, 32, 32);
5959}
6060
61static void jack_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
61static void jack_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
6262{
6363   int offs;
6464
r1877r1878
139139   bg_tilemap = tilemap_create(joinem_get_bg_tile_info, tilemap_scan_cols_flipy,  8, 8, 32, 32);
140140}
141141
142static void joinem_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
142static void joinem_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
143143{
144144   int offs;
145145
src/mame/video/tumblep.c
r1877r1878
1414***************************************************************************/
1515
1616#include "driver.h"
17#include "deprecat.h"
1817#include "deco16ic.h"
1918
20static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
19static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
2120{
2221   int offs;
2322
r1877r1878
3029
3130      y = spriteram16[offs];
3231      flash=y&0x1000;
33      if (flash && (cpu_getcurrentframe() & 1)) continue;
32      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
3433
3534      x = spriteram16[offs+2];
3635      colour = (x >>9) & 0x1f;
src/mame/video/dogfgt.c
r1877r1878
66
77static UINT8 *bitmapram;
88static int bm_plane;
9static mame_bitmap *pixbitmap;
9static bitmap_t *pixbitmap;
1010static int pixcolor;
1111static tilemap *bg_tilemap;
1212
r1877r1878
143143      return;
144144   }
145145
146   internal_bitmapram_w(offset + BITMAPRAM_SIZE/3 * bm_plane,data);
146   internal_bitmapram_w(machine,offset + BITMAPRAM_SIZE/3 * bm_plane,data);
147147}
148148
149149WRITE8_HANDLER( dogfgt_bgvideoram_w )
r1877r1878
185185
186186***************************************************************************/
187187
188static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
188static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
189189{
190190   int offs;
191191
r1877r1878
230230      lastpixcolor = pixcolor;
231231
232232      for (offs = 0;offs < BITMAPRAM_SIZE;offs++)
233         internal_bitmapram_w(offs,bitmapram[offs]);
233         internal_bitmapram_w(machine,offs,bitmapram[offs]);
234234   }
235235
236236
src/mame/video/dietgo.c
r1877r1878
11#include "driver.h"
2#include "deprecat.h"
32#include "deco16ic.h"
43
5static void draw_sprites(running_machine* machine, mame_bitmap *bitmap,const rectangle *cliprect)
4static void draw_sprites(running_machine* machine, bitmap_t *bitmap,const rectangle *cliprect)
65{
76   int offs;
87
r1877r1878
1514
1615      y = spriteram16[offs];
1716      flash=y&0x1000;
18      if (flash && (cpu_getcurrentframe() & 1)) continue;
17      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
1918
2019      x = spriteram16[offs+2];
2120      colour = (x >>9) & 0x1f;
src/mame/video/taitosj.c
r1877r1878
3131UINT8 *taitosj_video_priority;
3232UINT8 *taitosj_collision_reg;
3333UINT8 *kikstart_scrollram;
34static mame_bitmap *taitosj_layer_bitmap[3];
35static mame_bitmap *sprite_sprite_collbitmap1,*sprite_sprite_collbitmap2;
36static mame_bitmap *sprite_layer_collbitmap1;
37static mame_bitmap *sprite_layer_collbitmap2[3];
34static bitmap_t *taitosj_layer_bitmap[3];
35static bitmap_t *sprite_sprite_collbitmap1,*sprite_sprite_collbitmap2;
36static bitmap_t *sprite_layer_collbitmap1;
37static bitmap_t *sprite_layer_collbitmap2[3];
3838static UINT8 dirtycharacter1[256],dirtycharacter2[256];
3939static UINT8 dirtysprite1[64],dirtysprite2[64];
4040
4141static const int layer_enable_mask[3] = { 0x10, 0x20, 0x40 };
4242
43typedef void (*copy_layer_func_t)(running_machine *, mame_bitmap *,
43typedef void (*copy_layer_func_t)(running_machine *, bitmap_t *,
4444                          const rectangle *, int, int *, rectangle *);
4545
4646
r1877r1878
268268
269269WRITE8_HANDLER( junglhbr_characterram_w )
270270{
271   taitosj_characterram_w(offset, data ^ 0xfc);
271   taitosj_characterram_w(machine, offset, data ^ 0xfc);
272272}
273273
274274
r1877r1878
613613}
614614
615615
616static void draw_sprites(running_machine *machine, mame_bitmap *bitmap)
616static void draw_sprites(running_machine *machine, bitmap_t *bitmap)
617617{
618618   /*
619619       sprite visibility area is missing 4 pixels from the sides, surely to reduce
r1877r1878
679679}
680680
681681
682static void taitosj_copy_layer(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect,
682static void taitosj_copy_layer(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect,
683683                        int which, int *sprites_on, rectangle *sprite_areas)
684684{
685685   static const int fudge1[3] = { 3,  1, -1 };
r1877r1878
717717}
718718
719719
720static void kikstart_copy_layer(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect,
720static void kikstart_copy_layer(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect,
721721                        int which, int *sprites_on, rectangle *sprite_areas)
722722{
723723   if (*taitosj_video_mode & layer_enable_mask[which])
r1877r1878
755755}
756756
757757
758static void copy_layer(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect,
758static void copy_layer(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect,
759759                  copy_layer_func_t copy_layer_func, int which, int *sprites_on, rectangle *sprite_areas)
760760{
761761   if (which == 0)
r1877r1878
765765}
766766
767767
768static void copy_layers(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect,
768static void copy_layers(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect,
769769                  copy_layer_func_t copy_layer_func, int *sprites_on, rectangle *sprite_areas)
770770{
771771   int i = 0;
r1877r1878
792792}
793793
794794
795static int video_update_common(running_machine *machine, mame_bitmap *bitmap,
795static int video_update_common(running_machine *machine, bitmap_t *bitmap,
796796                        const rectangle *cliprect, copy_layer_func_t copy_layer_func)
797797{
798798   int sprites_on[0x20];          /* 1 if sprite is active */
src/mame/video/vigilant.c
r1877r1878
3636
3737static int rear_refresh=1;
3838
39static mame_bitmap *bg_bitmap;
39static bitmap_t *bg_bitmap;
4040
4141
4242VIDEO_START( vigilant )
r1877r1878
170170 ???
171171 **************************************************************************/
172172
173static void draw_foreground(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority, int opaque )
173static void draw_foreground(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority, int opaque )
174174{
175175   int offs;
176176   int scroll = -(horiz_scroll_low + horiz_scroll_high);
r1877r1878
218218
219219
220220
221static void draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
221static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
222222{
223223   int scrollx = 0x17a + 16*8 - (rear_horiz_scroll_low + rear_horiz_scroll_high);
224224
r1877r1878
233233}
234234
235235
236static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
236static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
237237{
238238   int offs;
239239
src/mame/video/avgdvg.c
r1877r1878
12421242
12431243WRITE16_HANDLER( avgdvg_go_word_w )
12441244{
1245   avgdvg_go_w(offset, data);
1245   avgdvg_go_w(machine, offset, data);
12461246}
12471247
12481248
r1877r1878
12601260
12611261WRITE16_HANDLER( avgdvg_reset_word_w )
12621262{
1263   avgdvg_reset_w (0,0);
1263   avgdvg_reset_w (machine,0,0);
12641264}
12651265
12661266MACHINE_RESET( avgdvg )
12671267{
1268   avgdvg_reset_w (0,0);
1268   avgdvg_reset_w (machine,0,0);
12691269}
12701270
12711271
src/mame/video/kingobox.c
r1877r1878
209209   tilemap_set_transparent_pen(fg_tilemap, 0);
210210}
211211
212static void kingofb_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
212static void kingofb_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
213213{
214214   int offs;
215215
r1877r1878
275275   tilemap_set_transparent_pen(fg_tilemap, 0);
276276}
277277
278static void ringking_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
278static void ringking_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
279279{
280280   int offs;
281281
src/mame/video/nbmj8991.c
r1877r1878
2222static int nbmj8991_clutsel;
2323static int nbmj8991_screen_refresh;
2424
25static mame_bitmap *nbmj8991_tmpbitmap;
25static bitmap_t *nbmj8991_tmpbitmap;
2626static UINT8 *nbmj8991_videoram;
2727static UINT8 *nbmj8991_clut;
2828
src/mame/video/galivan.c
r1877r1878
277277
278278      for (offs = 0; offs < videoram_size; offs++)
279279      {
280         galivan_videoram_w(offs, 0x20);
280         galivan_videoram_w(machine, offs, 0x20);
281281      }
282282      for (offs = 0; offs < videoram_size; offs++)
283283      {
284         galivan_colorram_w(offs, 0x03);
284         galivan_colorram_w(machine, offs, 0x03);
285285      }
286286   }
287287
r1877r1878
348348
349349***************************************************************************/
350350
351static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
351static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
352352{
353353   const UINT8 *spritepalettebank = memory_region(REGION_USER1);
354354   int offs;
src/mame/video/tsamurai.c
r1877r1878
135135
136136***************************************************************************/
137137
138static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
138static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
139139{
140140   gfx_element *gfx = machine->gfx[2];
141141   const UINT8 *source = spriteram+32*4-4;
src/mame/video/canyon.c
r1877r1878
3434}
3535
3636
37static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle* cliprect)
37static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle* cliprect)
3838{
3939   int i;
4040
r1877r1878
5656}
5757
5858
59static void draw_bombs(mame_bitmap *bitmap, const rectangle* cliprect)
59static void draw_bombs(bitmap_t *bitmap, const rectangle* cliprect)
6060{
6161   int i;
6262
src/mame/video/splash.c
r1877r1878
8989   tilemap_mark_tile_dirty(bg_tilemap[offset >> 11],((offset << 1) & 0x0fff) >> 1);
9090}
9191
92static void draw_bitmap(mame_bitmap *bitmap,const rectangle *cliprect)
92static void draw_bitmap(bitmap_t *bitmap,const rectangle *cliprect)
9393{
9494   int sx,sy,color,count,colxor,bitswap;
9595   colxor = 0; /* splash and some bitmap modes in roldfrog */
r1877r1878
216216      400| xxxxxxxx -------- | unused
217217*/
218218
219static void splash_draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
219static void splash_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
220220{
221221   int i;
222222   const gfx_element *gfx = machine->gfx[1];
r1877r1878
237237   }
238238}
239239
240static void funystrp_draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
240static void funystrp_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
241241{
242242   int i;
243243   const gfx_element *gfx = machine->gfx[1];
src/mame/video/f1gp.c
r1877r1878
191191
192192***************************************************************************/
193193
194static void f1gp_draw_sprites(running_machine *machine,mame_bitmap *bitmap,const rectangle *cliprect,int chip,int primask)
194static void f1gp_draw_sprites(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect,int chip,int primask)
195195{
196196   int attr_start,first;
197197   UINT16 *spram = chip ? f1gp_spr2vram : f1gp_spr1vram;
r1877r1878
262262   }
263263}
264264
265static void f1gpb_draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
265static void f1gpb_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
266266{
267267   int attr_start, start_offset = spriteram_size/2 - 4;
268268
r1877r1878
417417}
418418
419419
420static void f1gp2_draw_sprites(running_machine *machine,mame_bitmap *bitmap,const rectangle *cliprect)
420static void f1gp2_draw_sprites(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect)
421421{
422422   int offs;
423423
src/mame/video/namcos2.c
r1877r1878
7373
7474static void
7575DrawRozHelper(
76   mame_bitmap *bitmap,
76   bitmap_t *bitmap,
7777   tilemap *tmap,
7878   const rectangle *clip,
7979   const struct RozParam *rozInfo )
r1877r1878
8383   if( bitmap->bpp == 16 )
8484   {
8585      UINT32 size_mask = rozInfo->size-1;
86      mame_bitmap *srcbitmap = tilemap_get_pixmap( tmap );
87      mame_bitmap *flagsbitmap = tilemap_get_flagsmap( tmap );
86      bitmap_t *srcbitmap = tilemap_get_pixmap( tmap );
87      bitmap_t *flagsbitmap = tilemap_get_flagsmap( tmap );
8888      UINT32 startx = rozInfo->startx + clip->min_x * rozInfo->incxx + clip->min_y * rozInfo->incyx;
8989      UINT32 starty = rozInfo->starty + clip->min_x * rozInfo->incxy + clip->min_y * rozInfo->incyy;
9090      int sx = clip->min_x;
r1877r1878
138138} /* DrawRozHelper */
139139
140140static void
141DrawROZ(mame_bitmap *bitmap,const rectangle *cliprect)
141DrawROZ(bitmap_t *bitmap,const rectangle *cliprect)
142142{
143143   const int xoffset = 38,yoffset = 0;
144144   struct RozParam rozParam;
src/mame/video/route16.c
r1877r1878
132132 *  The Stratovox video connections have been verified from the schematics
133133 */
134134
135static int video_update_stratvox_ttmahjng(mame_bitmap *bitmap,
135static int video_update_stratvox_ttmahjng(bitmap_t *bitmap,
136136                                const rectangle *cliprect,
137137                                pen_t (*make_pen)(UINT8))
138138{
src/mame/video/exidy440.c
r1877r1878
88#include "deprecat.h"
99#include "exidy440.h"
1010
11#define SPRITE_COUNT      40
1211
12#define PIXEL_CLOCK         (EXIDY440_MASTER_CLOCK / 2)
13#define HTOTAL            (0x1a0)
14#define HBEND            (0x000)
15#define HBSTART            (0x140)
16#define HSEND            (0x178)
17#define HSSTART            (0x160)
18#define VTOTAL            (0x104)
19#define VBEND            (0x000)
20#define VBSTART            (0x0f0)
21#define VSEND            (0x0f8)
22#define VSSTART            (0x0f0)
1323
24/* Top Secret has a larger VBLANK area */
25#define TOPSECEX_VBSTART   (0x0ec)
26
27#define SPRITE_COUNT      (0x28)
28
29
1430/* globals */
1531UINT8 *exidy440_scanline;
1632UINT8 *exidy440_imageram;
17UINT8 exidy440_firq_vblank;
18UINT8 exidy440_firq_beam;
19UINT8 topsecex_yscroll;
33UINT8  exidy440_firq_vblank;
34UINT8  exidy440_firq_beam;
35UINT8 *topsecex_yscroll;
2036
2137/* local allocated storage */
2238static UINT8 exidy440_latched_x;
r1877r1878
3046static UINT8 palettebank_vis;
3147
3248/* function prototypes */
33static void exidy440_update_firq(void);
49static void exidy440_update_firq(running_machine *machine);
3450
3551
3652
r1877r1878
4056 *
4157 *************************************/
4258
43VIDEO_START( exidy440 )
59static VIDEO_START( exidy440 )
4460{
4561   /* reset the system */
4662   firq_enable = 0;
r1877r1878
5066   exidy440_firq_vblank = 0;
5167   exidy440_firq_beam = 0;
5268
53   /* reset Top Secret scroll position */
54   topsecex_yscroll = 0;
55
5669   /* allocate a buffer for VRAM */
5770   local_videoram = auto_malloc(256 * 256 * 2);
5871   memset(local_videoram, 0, 256 * 256 * 2);
r1877r1878
6376}
6477
6578
79static VIDEO_START( topsecex )
80{
81   VIDEO_START_CALL(exidy440);
6682
83   *topsecex_yscroll = 0;
84}
85
86
87
6788/*************************************
6889 *
6990 *  Video RAM read/write
r1877r1878
133154{
134155   /* clear the FIRQ on a read here */
135156   exidy440_firq_beam = 0;
136   exidy440_update_firq();
157   exidy440_update_firq(Machine);
137158
138159   /* according to the schems, this value is only latched on an FIRQ
139160     * caused by collision or beam */
r1877r1878
187208   palettebank_vis = data & 1;
188209
189210   /* update the FIRQ in case we enabled something */
190   exidy440_update_firq();
211   exidy440_update_firq(Machine);
191212
192213   /* if we're swapping palettes, change all the colors */
193214   if (oldvis != palettebank_vis)
r1877r1878
210231{
211232   /* clear the VBLANK FIRQ on a write here */
212233   exidy440_firq_vblank = 0;
213   exidy440_update_firq();
234   exidy440_update_firq(Machine);
214235}
215236
216237
r1877r1878
221242 *
222243 *************************************/
223244
224static void exidy440_update_firq(void)
245static void exidy440_update_firq(running_machine *machine)
225246{
226247   if (exidy440_firq_vblank || (firq_enable && exidy440_firq_beam))
227      cpunum_set_input_line(Machine, 0, 1, ASSERT_LINE);
248      cpunum_set_input_line(machine, 0, 1, ASSERT_LINE);
228249   else
229      cpunum_set_input_line(Machine, 0, 1, CLEAR_LINE);
250      cpunum_set_input_line(machine, 0, 1, CLEAR_LINE);
230251}
231252
232253
r1877r1878
234255{
235256   /* set the FIRQ line on a VBLANK */
236257   exidy440_firq_vblank = 1;
237   exidy440_update_firq();
258   exidy440_update_firq(machine);
238259}
239260
240261
r1877r1878
251272   if (firq_select && firq_enable)
252273   {
253274      exidy440_firq_beam = 1;
254      exidy440_update_firq();
275      exidy440_update_firq(machine);
255276   }
256277
257278   /* round the x value to the nearest byte */
r1877r1878
268289   if (!firq_select && firq_enable)
269290   {
270291      exidy440_firq_beam = 1;
271      exidy440_update_firq();
292      exidy440_update_firq(machine);
272293   }
273294
274295   /* round the x value to the nearest byte */
r1877r1878
286307 *
287308 *************************************/
288309
289static void draw_sprites(mame_bitmap *bitmap, const rectangle *cliprect, int scroll_offset)
310static void draw_sprites(bitmap_t *bitmap, const rectangle *cliprect, int scroll_offset, int check_collision)
290311{
291312   int i;
292313
293314   /* get a pointer to the palette to look for collision flags */
294315   UINT8 *palette = &local_paletteram[palettebank_vis * 512];
316   int count = 0;
295317
296   /* start the count high for topsecret, which doesn't use collision flags */
297   int count = exidy440_topsecret ? 128 : 0;
298
299318   /* draw the sprite images, checking for collisions along the way */
300319   UINT8 *sprite = spriteram + (SPRITE_COUNT - 1) * 4;
301320
r1877r1878
323342      for (y = 0; y < 16; y++, yoffs--, sy--)
324343      {
325344         /* wrap at the top and bottom of the screen */
326         if (sy >= EXIDY440_VBSTART)
327            sy -= (EXIDY440_VBSTART - EXIDY440_VBEND);
328         else if (sy < EXIDY440_VBEND)
329            sy += (EXIDY440_VBSTART - EXIDY440_VBEND);
345         if (sy >= VBSTART)
346            sy -= (VBSTART - VBEND);
347         else if (sy < VBEND)
348            sy += (VBSTART - VBEND);
330349
331350         /* stop if we get before the current scanline */
332351         if (yoffs < cliprect->min_y)
r1877r1878
347366               int pen;
348367
349368               /* left pixel */
350               if (left && EXIDY440_HBEND >= 0 && currx < EXIDY440_HBSTART)
369               if (left && HBEND >= 0 && currx < HBSTART)
351370               {
352371                  /* combine with the background */
353372                  pen = left | old[0];
354373                  *BITMAP_ADDR16(bitmap, yoffs, currx) = pen;
355374
356375                  /* check the collisions bit */
357                  if ((palette[2 * pen] & 0x80) && count++ < 128)
376                  if (check_collision && (palette[2 * pen] & 0x80) && (count++ < 128))
358377                     timer_set(video_screen_get_time_until_pos(0, yoffs, currx), NULL, currx, collide_firq_callback);
359378               }
360379               currx++;
361380
362381               /* right pixel */
363               if (right && EXIDY440_HBEND >= 0 && currx < EXIDY440_HBSTART)
382               if (right && HBEND >= 0 && currx < HBSTART)
364383               {
365384                  /* combine with the background */
366385                  pen = right | old[1];
367386                  *BITMAP_ADDR16(bitmap, yoffs, currx) = pen;
368387
369388                  /* check the collisions bit */
370                  if ((palette[2 * pen] & 0x80) && count++ < 128)
389                  if (check_collision && (palette[2 * pen] & 0x80) && (count++ < 128))
371390                     timer_set(video_screen_get_time_until_pos(0, yoffs, currx), NULL, currx, collide_firq_callback);
372391               }
373392               currx++;
r1877r1878
387406 *
388407 *************************************/
389408
390static void update_screen(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int scroll_offset)
409static void update_screen(bitmap_t *bitmap, const rectangle *cliprect, int scroll_offset, int check_collision)
391410{
392411   int y, sy;
393412
r1877r1878
396415   for (y = cliprect->min_y; y <= cliprect->max_y; y++, sy++)
397416   {
398417      /* wrap at the bottom of the screen */
399      if (sy >= EXIDY440_VBSTART)
400         sy -= (EXIDY440_VBSTART - EXIDY440_VBEND);
418      if (sy >= VBSTART)
419         sy -= (VBSTART - VBEND);
401420
402421      /* draw line */
403      draw_scanline8(bitmap, 0, y, (EXIDY440_HBSTART - EXIDY440_HBEND), &local_videoram[sy * 512], NULL, -1);
422      draw_scanline8(bitmap, 0, y, (HBSTART - HBEND), &local_videoram[sy * 512], NULL, -1);
404423   }
405424
406425   /* draw the sprites */
407   draw_sprites(bitmap, cliprect, scroll_offset);
426   draw_sprites(bitmap, cliprect, scroll_offset, check_collision);
408427}
409428
410429
r1877r1878
415434 *
416435 *************************************/
417436
418VIDEO_UPDATE( exidy440 )
437static VIDEO_UPDATE( exidy440 )
419438{
420439   /* redraw the screen */
421   if (exidy440_topsecret)
422      update_screen(machine, bitmap, cliprect, topsecex_yscroll);
423   else
424      update_screen(machine, bitmap, cliprect, 0);
440   update_screen(bitmap, cliprect, 0, TRUE);
425441
426   return 0;
427}
428
429
430
431/*************************************
432 *
433 *  Standard screen refresh callback
434 *
435 *************************************/
436
437VIDEO_EOF( exidy440 )
438{
439442   /* generate an interrupt once/frame for the beam */
440   if (!exidy440_topsecret)
443   if (cliprect->max_y == machine->screen[screen].visarea.max_y)
441444   {
442      attotime time;
443      attoseconds_t increment;
444      int beamx, beamy;
445445      int i;
446446
447      beamx = ((input_port_4_r(0) & 0xff) * (EXIDY440_HBSTART - EXIDY440_HBEND)) >> 8;
448      beamy = ((input_port_5_r(0) & 0xff) * (EXIDY440_VBSTART - EXIDY440_VBEND)) >> 8;
447      int beamx = ((input_port_4_r(machine, 0) & 0xff) * (HBSTART - HBEND)) >> 8;
448      int beamy = ((input_port_5_r(machine, 0) & 0xff) * (VBSTART - VBEND)) >> 8;
449449
450450      /* The timing of this FIRQ is very important. The games look for an FIRQ
451451            and then wait about 650 cycles, clear the old FIRQ, and wait a
r1877r1878
453453            From this, it appears that they are expecting to get beams over
454454            a 12 scanline period, and trying to pick roughly the middle one.
455455            This is how it is implemented. */
456      increment = attotime_to_attoseconds(video_screen_get_scan_period(0));
457      time = attotime_sub(video_screen_get_time_until_pos(0, beamy, beamx), attotime_make(0, increment * 6));
456      attoseconds_t increment = attotime_to_attoseconds(video_screen_get_scan_period(0));
457      attotime time = attotime_sub(video_screen_get_time_until_pos(0, beamy, beamx), attotime_make(0, increment * 6));
458458      for (i = 0; i <= 12; i++)
459459      {
460460         timer_set(time, NULL, beamx, beam_firq_callback);
461461         time = attotime_add(time, attotime_make(0, increment));
462462      }
463463   }
464
465   return 0;
464466}
467
468
469static VIDEO_UPDATE( topsecex )
470{
471   /* redraw the screen */
472   update_screen(bitmap, cliprect, *topsecex_yscroll, FALSE);
473
474   return 0;
475}
476
477
478
479/*************************************
480 *
481 *  Machine drivers
482 *
483 *************************************/
484
485MACHINE_DRIVER_START( exidy440_video )
486   MDRV_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
487   MDRV_VIDEO_START(exidy440)
488   MDRV_VIDEO_UPDATE(exidy440)
489   MDRV_PALETTE_LENGTH(256)
490
491   MDRV_SCREEN_ADD("main", RASTER)
492   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
493   MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
494MACHINE_DRIVER_END
495
496
497MACHINE_DRIVER_START( topsecex_video )
498   MDRV_VIDEO_ATTRIBUTES(0)
499   MDRV_VIDEO_START(topsecex)
500   MDRV_VIDEO_UPDATE(topsecex)
501
502   MDRV_SCREEN_MODIFY("main")
503   MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, TOPSECEX_VBSTART)
504MACHINE_DRIVER_END
src/mame/video/tx1.c
r1877r1878
8888size_t tx1_objram_size;
8989
9090static tilemap *tx1_tilemap;
91static mame_bitmap *tx1_bitmap;
91static bitmap_t *tx1_bitmap;
9292static render_texture *tx1_texture;
9393
9494WRITE16_HANDLER( tx1_vram_w )
r1877r1878
222222
223223
224224/* Preliminary */
225static void tx1_draw_objects(mame_bitmap *bitmap, const rectangle *cliprect)
225static void tx1_draw_objects(bitmap_t *bitmap, const rectangle *cliprect)
226226{
227227#define FRAC   16
228228
src/mame/video/dassault.c
r1877r1878
55****************************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
98#include "deco16ic.h"
109
1110/******************************************************************************/
1211
13static void draw_sprites(running_machine* machine, mame_bitmap *bitmap, const rectangle *cliprect, int pf_priority)
12static void draw_sprites(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect, int pf_priority)
1413{
1514   int x,y,sprite,colour,multi,fx,fy,inc,flash,mult;
1615   int offs, bank, gfxbank;
r1877r1878
4645
4746         y = spritebase[offs];
4847         flash=y&0x1000;
49         if (flash && (cpu_getcurrentframe() & 1)) continue;
48         if (flash && (video_screen_get_frame_number(0) & 1)) continue;
5049         colour = (x >> 9) &0x1f;
5150         if (y&0x8000) colour+=32;
5251
src/mame/video/pingpong.c
r1877r1878
120120   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
121121}
122122
123static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
123static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
124124{
125125   int offs;
126126
src/mame/video/ssrj.c
r1877r1878
240240}
241241
242242
243static void draw_objects(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
243static void draw_objects(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
244244{
245245   int i,j,k,x,y;
246246
src/mame/video/blstroid.c
r1877r1878
9999static TIMER_CALLBACK( irq_off )
100100{
101101   /* clear the interrupt */
102   atarigen_scanline_int_ack_w(0, 0, 0);
102   atarigen_scanline_int_ack_w(machine, 0, 0, 0);
103103}
104104
105105
r1877r1878
122122         attotime period_on;
123123         attotime period_off;
124124
125         /* fix me - the only thing this IRQ does it tweak the starting MO link */
125         /* FIXME: - the only thing this IRQ does it tweak the starting MO link */
126126         /* unfortunately, it does it too early for the given MOs! */
127127         /* perhaps it is not actually hooked up on the real PCB... */
128128         return;
r1877r1878
148148VIDEO_UPDATE( blstroid )
149149{
150150   struct atarimo_rect_list rectlist;
151   mame_bitmap *mobitmap;
151   bitmap_t *mobitmap;
152152   int x, y, r;
153153
154154   /* draw the playfield */
src/mame/video/gotya.c
r1877r1878
114114       8, 8, 64, 32);
115115}
116116
117static void draw_status_row(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int sx, int col)
117static void draw_status_row(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int sx, int col)
118118{
119119   int row;
120120
r1877r1878
146146   }
147147}
148148
149static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
149static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
150150{
151151   int offs;
152152
r1877r1878
171171   }
172172}
173173
174static void draw_status(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
174static void draw_status(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
175175{
176176   draw_status_row(machine, bitmap, cliprect, 0,  1);
177177   draw_status_row(machine, bitmap, cliprect, 1,  0);
src/mame/video/tatsumi.c
r1877r1878
55static tilemap *tx_layer;
66static tilemap *layer0, *layer1, *layer2, *layer3;
77
8static mame_bitmap *temp_bitmap;
8static bitmap_t *temp_bitmap;
99
1010UINT16 *roundup_r_ram, *roundup_p_ram, *roundup_l_ram;
1111UINT16 *cyclwarr_videoram0, *cyclwarr_videoram1;
r1877r1878
237237
238238/********************************************************************/
239239
240INLINE void roundupt_drawgfxzoomrotate( mame_bitmap *dest_bmp,const gfx_element *gfx,
240INLINE void roundupt_drawgfxzoomrotate( bitmap_t *dest_bmp,const gfx_element *gfx,
241241      UINT32 code,UINT32 color,int flipx,int flipy,UINT32 ssx,UINT32 ssy,
242242      const rectangle *clip, int scalex, int scaley, int rotate, int write_priority_only )
243243{
r1877r1878
453453   }
454454}
455455
456static void mycopyrozbitmap_core(mame_bitmap *bitmap,mame_bitmap *srcbitmap,
456static void mycopyrozbitmap_core(bitmap_t *bitmap,bitmap_t *srcbitmap,
457457      int dstx,int dsty, int srcwidth, int srcheight,int incxx,int incxy,int incyx,int incyy,
458458      const rectangle *clip,int transparency,int transparent_color)
459459{
r1877r1878
515515   }
516516}
517517
518static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int write_priority_only, int rambank)
518static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int write_priority_only, int rambank)
519519{
520520   int offs,fx,x,y,color;
521521   int w,h,index,lines,scale,rotate;
r1877r1878
686686   }
687687}
688688
689static void draw_sky(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect, int palette_base, int start_offset)
689static void draw_sky(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect, int palette_base, int start_offset)
690690{
691691   // all todo
692692   int x,y;
r1877r1878
708708   }
709709}
710710
711static void draw_road(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,mame_bitmap *shadow_bitmap)
711static void draw_road(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,bitmap_t *shadow_bitmap)
712712{
713713/*
7147140xf980 0x0008 0x8c80 0x4a00 - road right to below, width unknown (32 pixels guess)
r1877r1878
960960
961961/**********************************************************************/
962962
963static void draw_bg(running_machine *machine, mame_bitmap *dst, tilemap *src, const UINT16* scrollx, const UINT16* scrolly, const UINT16* tilemap_ram, int tile_bank, int xscroll_offset, int yscroll_offset, int xsize, int ysize)
963static void draw_bg(running_machine *machine, bitmap_t *dst, tilemap *src, const UINT16* scrollx, const UINT16* scrolly, const UINT16* tilemap_ram, int tile_bank, int xscroll_offset, int yscroll_offset, int xsize, int ysize)
964964{
965965   /*
966966        Each tile (0x4000 of them) has a lookup table in ROM to build an individual 3-bit palette
967967        from sets of 8 bit palettes!
968968    */
969969   const UINT8* tile_cluts = memory_region(REGION_GFX4);
970   const mame_bitmap *src_bitmap = tilemap_get_pixmap(src);
970   const bitmap_t *src_bitmap = tilemap_get_pixmap(src);
971971   int src_y_mask=ysize-1;
972972   int src_x_mask=xsize-1;
973973   int tile_y_mask=(ysize/8)-1;
src/mame/video/supbtime.c
r1877r1878
1313***************************************************************************/
1414
1515#include "driver.h"
16#include "deprecat.h"
1716#include "deco16ic.h"
1817
1918/******************************************************************************/
2019
21static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
20static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
2221{
2322   int offs;
2423
r1877r1878
3130
3231      y = spriteram16[offs];
3332      flash=y&0x1000;
34      if (flash && (cpu_getcurrentframe() & 1)) continue;
33      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
3534
3635      x = spriteram16[offs+2];
3736      colour = (x >>9) & 0x1f;
src/mame/video/konamiic.c
r1877r1878
11491149***************************************************************************/
11501150
11511151#include "driver.h"
1152#include "deprecat.h"
11531152#include "video/konamiic.h"
11541153
11551154#define VERBOSE 0
r1877r1878
12961295 *
12971296 */
12981297
1299void K007121_sprites_draw(int chip,mame_bitmap *bitmap,gfx_element **gfxs, colortable_t *ctable,
1298void K007121_sprites_draw(int chip,bitmap_t *bitmap,gfx_element **gfxs, colortable_t *ctable,
13001299                    const rectangle *cliprect, const UINT8 *source,int base_color,
13011300                    int global_x_offset,int bank_base, UINT32 pri_mask)
13021301{
r1877r1878
16741673   tilemap_set_enable(K007342_tilemap[tmap], enable);
16751674}
16761675
1677void K007342_tilemap_draw(mame_bitmap *bitmap,const rectangle *cliprect,int num,int flags,UINT32 priority)
1676void K007342_tilemap_draw(bitmap_t *bitmap,const rectangle *cliprect,int num,int flags,UINT32 priority)
16781677{
16791678   tilemap_draw(bitmap,cliprect,K007342_tilemap[num],flags,priority);
16801679}
r1877r1878
17411740 *   7  | xxxxxxxx | unused
17421741 */
17431742
1744void K007420_sprites_draw(mame_bitmap *bitmap,const rectangle *cliprect)
1743void K007420_sprites_draw(bitmap_t *bitmap,const rectangle *cliprect)
17451744{
17461745#define K007420_SPRITERAM_SIZE 0x200
17471746   int offs;
r1877r1878
22472246
22482247READ16_HANDLER( K052109_word_r )
22492248{
2250   return K052109_r(offset + 0x2000) | (K052109_r(offset) << 8);
2249   return K052109_r(machine,offset + 0x2000) | (K052109_r(machine,offset) << 8);
22512250}
22522251
22532252WRITE16_HANDLER( K052109_word_w )
22542253{
22552254   if (ACCESSING_MSB)
2256      K052109_w(offset,(data >> 8) & 0xff);
2255      K052109_w(machine,offset,(data >> 8) & 0xff);
22572256   if (ACCESSING_LSB)
2258      K052109_w(offset + 0x2000,data & 0xff);
2257      K052109_w(machine,offset + 0x2000,data & 0xff);
22592258}
22602259
22612260READ16_HANDLER(K052109_lsb_r)
22622261{
2263   return K052109_r(offset);
2262   return K052109_r(machine,offset);
22642263}
22652264
22662265WRITE16_HANDLER(K052109_lsb_w)
22672266{
22682267   if(ACCESSING_LSB)
2269      K052109_w(offset, data & 0xff);
2268      K052109_w(machine, offset, data & 0xff);
22702269}
22712270
22722271void K052109_set_RMRD_line(int state)
r1877r1878
26132612
26142613READ16_HANDLER( K051960_word_r )
26152614{
2616   return K051960_r(offset*2 + 1) | (K051960_r(offset*2) << 8);
2615   return K051960_r(machine,offset*2 + 1) | (K051960_r(machine,offset*2) << 8);
26172616}
26182617
26192618WRITE16_HANDLER( K051960_word_w )
26202619{
26212620   if (ACCESSING_MSB)
2622      K051960_w(offset*2,(data >> 8) & 0xff);
2621      K051960_w(machine,offset*2,(data >> 8) & 0xff);
26232622   if (ACCESSING_LSB)
2624      K051960_w(offset*2 + 1,data & 0xff);
2623      K051960_w(machine,offset*2 + 1,data & 0xff);
26252624}
26262625
26272626READ8_HANDLER( K051937_r )
r1877r1878
26862685
26872686READ16_HANDLER( K051937_word_r )
26882687{
2689   return K051937_r(offset*2 + 1) | (K051937_r(offset*2) << 8);
2688   return K051937_r(machine,offset*2 + 1) | (K051937_r(machine,offset*2) << 8);
26902689}
26912690
26922691WRITE16_HANDLER( K051937_word_w )
26932692{
26942693   if (ACCESSING_MSB)
2695      K051937_w(offset*2,(data >> 8) & 0xff);
2694      K051937_w(machine,offset*2,(data >> 8) & 0xff);
26962695   if (ACCESSING_LSB)
2697      K051937_w(offset*2 + 1,data & 0xff);
2696      K051937_w(machine,offset*2 + 1,data & 0xff);
26982697}
26992698
27002699
r1877r1878
27302729 * Note that Aliens also uses the shadow bit to select the second sprite bank.
27312730 */
27322731
2733void K051960_sprites_draw(mame_bitmap *bitmap,const rectangle *cliprect,int min_priority,int max_priority)
2732void K051960_sprites_draw(bitmap_t *bitmap,const rectangle *cliprect,int min_priority,int max_priority)
27342733{
27352734#define NUM_SPRITES 128
27362735   int offs,pri_code;
r1877r1878
29272926   if (K052109_RMRD_line == CLEAR_LINE)
29282927   {
29292928      if (offset >= 0x3800 && offset < 0x3808)
2930         return K051937_r(offset - 0x3800);
2929         return K051937_r(machine,offset - 0x3800);
29312930      else if (offset < 0x3c00)
2932         return K052109_r(offset);
2931         return K052109_r(machine,offset);
29332932      else
2934         return K051960_r(offset - 0x3c00);
2933         return K051960_r(machine,offset - 0x3c00);
29352934   }
2936   else return K052109_r(offset);
2935   else return K052109_r(machine,offset);
29372936}
29382937
29392938WRITE8_HANDLER( K052109_051960_w )
29402939{
29412940   if (offset >= 0x3800 && offset < 0x3808)
2942      K051937_w(offset - 0x3800,data);
2941      K051937_w(machine,offset - 0x3800,data);
29432942   else if (offset < 0x3c00)
2944      K052109_w(offset,data);
2943      K052109_w(machine,offset,data);
29452944   else
2946      K051960_w(offset - 0x3c00,data);
2945      K051960_w(machine,offset - 0x3c00,data);
29472946}
29482947
29492948
r1877r1878
31893188
31903189READ16_HANDLER( K053244_lsb_r )
31913190{
3192   return K053244_r(offset);
3191   return K053244_r(machine, offset);
31933192}
31943193
31953194WRITE16_HANDLER( K053244_lsb_w )
31963195{
31973196   if (ACCESSING_LSB)
3198      K053244_w(offset, data & 0xff);
3197      K053244_w(machine, offset, data & 0xff);
31993198}
32003199
32013200READ16_HANDLER( K053244_word_r )
32023201{
3203   return (K053244_r(offset*2)<<8)|K053244_r(offset*2+1);
3202   return (K053244_r(machine, offset*2)<<8)|K053244_r(machine, offset*2+1);
32043203}
32053204
32063205WRITE16_HANDLER( K053244_word_w )
32073206{
32083207   if (ACCESSING_MSB)
3209      K053244_w(offset*2, (data >> 8) & 0xff);
3208      K053244_w(machine, offset*2, (data >> 8) & 0xff);
32103209   if (ACCESSING_LSB)
3211      K053244_w(offset*2+1, data & 0xff);
3210      K053244_w(machine, offset*2+1, data & 0xff);
32123211}
32133212
32143213void K053244_bankselect(int chip, int bank)
r1877r1878
32443243 * The rest of the sprite remains normal.
32453244 */
32463245
3247void K053245_sprites_draw(int chip, mame_bitmap *bitmap,const rectangle *cliprect) //*
3246void K053245_sprites_draw(int chip, bitmap_t *bitmap,const rectangle *cliprect) //*
32483247{
32493248#define NUM_SPRITES 128
32503249   int offs,pri_code,i;
r1877r1878
34733472
34743473/* Lethal Enforcers has 2 of these chips hooked up in parallel to give 6bpp gfx.. lets cheat a
34753474  bit and make emulating it a little less messy by using a custom function instead */
3476void K053245_sprites_draw_lethal(running_machine *machine,int chip, mame_bitmap *bitmap,const rectangle *cliprect) //*
3475void K053245_sprites_draw_lethal(running_machine *machine,int chip, bitmap_t *bitmap,const rectangle *cliprect) //*
34773476{
34783477#define NUM_SPRITES 128
34793478   int offs,pri_code,i;
r1877r1878
41294128READ16_HANDLER( K053246_word_r )
41304129{
41314130   offset <<= 1;
4132   return K053246_r(offset + 1) | (K053246_r(offset) << 8);
4131   return K053246_r(machine, offset + 1) | (K053246_r(machine, offset) << 8);
41334132}
41344133
41354134WRITE16_HANDLER( K053246_word_w )
41364135{
41374136   if (ACCESSING_MSB)
4138      K053246_w(offset<<1,(data >> 8) & 0xff);
4137      K053246_w(machine, offset<<1,(data >> 8) & 0xff);
41394138   if (ACCESSING_LSB)
4140      K053246_w((offset<<1) + 1,data & 0xff);
4139      K053246_w(machine, (offset<<1) + 1,data & 0xff);
41414140}
41424141
41434142READ32_HANDLER( K053246_long_r )
41444143{
41454144   offset <<= 1;
4146   return (K053246_word_r(offset+1, 0xffff) | K053246_word_r(offset, 0xffff)<<16);
4145   return (K053246_word_r(machine, offset+1, 0xffff) | K053246_word_r(machine, offset, 0xffff)<<16);
41474146}
41484147
41494148WRITE32_HANDLER( K053246_long_w )
41504149{
41514150   offset <<= 1;
4152   K053246_word_w(offset, data>>16, mem_mask >> 16);
4153   K053246_word_w(offset+1, data, mem_mask);
4151   K053246_word_w(machine, offset, data>>16, mem_mask >> 16);
4152   K053246_word_w(machine, offset+1, data, mem_mask);
41544153}
41554154
41564155void K053246_set_OBJCHA_line(int state)
r1877r1878
41934192 * The rest of the sprite remains normal.
41944193 */
41954194
4196void K053247_sprites_draw(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect) //*
4195void K053247_sprites_draw(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect) //*
41974196{
41984197#define NUM_SPRITES 256
41994198
r1877r1878
46594658            8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
46604659      128*8
46614660   };
4662   static const tile_get_info_callback get_tile_info[3] = { K051316_get_tile_info0,K051316_get_tile_info1,K051316_get_tile_info2 };
4661   static const tile_get_info_func get_tile_info[3] = { K051316_get_tile_info0,K051316_get_tile_info1,K051316_get_tile_info2 };
46634662
46644663   /* find first empty slot to decode gfx */
46654664   for (gfx_index = 0; gfx_index < MAX_GFX_ELEMENTS; gfx_index++)
r1877r1878
48584857}
48594858
48604859
4861static void K051316_zoom_draw(int chip, mame_bitmap *bitmap,const rectangle *cliprect,int flags,UINT32 priority)
4860static void K051316_zoom_draw(int chip, bitmap_t *bitmap,const rectangle *cliprect,int flags,UINT32 priority)
48624861{
48634862   UINT32 startx,starty;
48644863   int incxx,incxy,incyx,incyy;
r1877r1878
49024901#endif
49034902}
49044903
4905void K051316_zoom_draw_0(mame_bitmap *bitmap,const rectangle *cliprect,int flags,UINT32 priority)
4904void K051316_zoom_draw_0(bitmap_t *bitmap,const rectangle *cliprect,int flags,UINT32 priority)
49064905{
49074906   K051316_zoom_draw(0,bitmap,cliprect,flags,priority);
49084907}
49094908
4910void K051316_zoom_draw_1(mame_bitmap *bitmap,const rectangle *cliprect,int flags,UINT32 priority)
4909void K051316_zoom_draw_1(bitmap_t *bitmap,const rectangle *cliprect,int flags,UINT32 priority)
49114910{
49124911   K051316_zoom_draw(1,bitmap,cliprect,flags,priority);
49134912}
49144913
4915void K051316_zoom_draw_2(mame_bitmap *bitmap,const rectangle *cliprect,int flags,UINT32 priority)
4914void K051316_zoom_draw_2(bitmap_t *bitmap,const rectangle *cliprect,int flags,UINT32 priority)
49164915{
49174916   K051316_zoom_draw(2,bitmap,cliprect,flags,priority);
49184917}
r1877r1878
49334932static int K053936_wraparound[K053936_MAX_CHIPS];
49344933
49354934
4936static void K053936_zoom_draw(int chip,UINT16 *ctrl,UINT16 *linectrl,mame_bitmap *bitmap,const rectangle *cliprect,tilemap *tmap,int flags,UINT32 priority)
4935static void K053936_zoom_draw(int chip,UINT16 *ctrl,UINT16 *linectrl,bitmap_t *bitmap,const rectangle *cliprect,tilemap *tmap,int flags,UINT32 priority)
49374936{
49384937   if (ctrl[0x07] & 0x0040)   /* "super" mode */
49394938   {
r1877r1878
50415040}
50425041
50435042
5044void K053936_0_zoom_draw(mame_bitmap *bitmap,const rectangle *cliprect,tilemap *tmap,int flags,UINT32 priority)
5043void K053936_0_zoom_draw(bitmap_t *bitmap,const rectangle *cliprect,tilemap *tmap,int flags,UINT32 priority)
50455044{
50465045   K053936_zoom_draw(0,K053936_0_ctrl,K053936_0_linectrl,bitmap,cliprect,tmap,flags,priority);
50475046}
50485047
5049void K053936_1_zoom_draw(mame_bitmap *bitmap,const rectangle *cliprect,tilemap *tmap,int flags,UINT32 priority)
5048void K053936_1_zoom_draw(bitmap_t *bitmap,const rectangle *cliprect,tilemap *tmap,int flags,UINT32 priority)
50505049{
50515050   K053936_zoom_draw(1,K053936_1_ctrl,K053936_1_linectrl,bitmap,cliprect,tmap,flags,priority);
50525051}
r1877r1878
51565155WRITE16_HANDLER( K053251_lsb_w )
51575156{
51585157   if (ACCESSING_LSB)
5159      K053251_w(offset, data & 0xff);
5158      K053251_w(machine, offset, data & 0xff);
51605159}
51615160
51625161WRITE16_HANDLER( K053251_msb_w )
51635162{
51645163   if (ACCESSING_MSB)
5165      K053251_w(offset, (data >> 8) & 0xff);
5164      K053251_w(machine, offset, (data >> 8) & 0xff);
51665165}
51675166
51685167int K053251_get_priority(int ci)
r1877r1878
52315230
52325231READ16_HANDLER( K054000_lsb_r )
52335232{
5234   return K054000_r(offset);
5233   return K054000_r(machine, offset);
52355234}
52365235
52375236WRITE16_HANDLER( K054000_lsb_w )
52385237{
52395238   if (ACCESSING_LSB)
5240      K054000_w(offset, data & 0xff);
5239      K054000_w(machine, offset, data & 0xff);
52415240}
52425241
52435242
r1877r1878
53475346#define K056832_PAGE_COUNT 16
53485347
53495348static tilemap *K056832_tilemap[K056832_PAGE_COUNT];
5350static mame_bitmap *K056832_pixmap[K056832_PAGE_COUNT];
5349static bitmap_t *K056832_pixmap[K056832_PAGE_COUNT];
53515350
53525351static UINT16 K056832_regs[0x20];   // 157/832 regs group 1
53535352static UINT16 K056832_regsb[4];   // 157/832 regs group 2, board dependent
r1877r1878
60346033      return K056832_rombase[addr+1] | (K056832_rombase[addr] << 8);
60356034   }
60366035
6037   return 0;
60386036}
60396037
60406038READ16_HANDLER( K056832_bishi_rom_word_r )
r1877r1878
60766074READ32_HANDLER( K056832_rom_long_r )
60776075{
60786076   offset <<= 1;
6079   return (K056832_rom_word_r(offset+1, 0xffff) | (K056832_rom_word_r(offset, 0xffff)<<16));
6077   return (K056832_rom_word_r(machine, offset+1, 0xffff) | (K056832_rom_word_r(machine, offset, 0xffff)<<16));
60806078}
60816079
60826080/* only one page is mapped to videoram at a time through a window */
r1877r1878
63856383   // if (ACCESSING_xxx) trick.  in particular, 8-bit writes
63866384   // are used to the tilemap bank register.
63876385   offset <<= 1;
6388   K056832_word_w(offset, data>>16, mem_mask >> 16);
6389   K056832_word_w(offset+1, data, mem_mask);
6386   K056832_word_w(machine, offset, data>>16, mem_mask >> 16);
6387   K056832_word_w(machine, offset+1, data, mem_mask);
63906388}
63916389
63926390WRITE16_HANDLER( K056832_b_word_w )
r1877r1878
63986396{
63996397   if (offset & 1)
64006398   {
6401      K056832_word_w((offset>>1), data, 0xff00);
6399      K056832_word_w(machine, (offset>>1), data, 0xff00);
64026400   }
64036401   else
64046402   {
6405      K056832_word_w((offset>>1), data<<8, 0x00ff);
6403      K056832_word_w(machine, (offset>>1), data<<8, 0x00ff);
64066404   }
64076405}
64086406
r1877r1878
64106408{
64116409   if (offset & 1)
64126410   {
6413      K056832_b_word_w((offset>>1), data, 0xff00);
6411      K056832_b_word_w(machine, (offset>>1), data, 0xff00);
64146412   }
64156413   else
64166414   {
6417      K056832_b_word_w((offset>>1), data<<8, 0x00ff);
6415      K056832_b_word_w(machine, (offset>>1), data<<8, 0x00ff);
64186416   }
64196417}
64206418
r1877r1878
64226420{
64236421   if (ACCESSING_MSW32)
64246422   {
6425      K056832_b_word_w(offset<<1, data>>16, mem_mask >> 16);
6423      K056832_b_word_w(machine, offset<<1, data>>16, mem_mask >> 16);
64266424   }
64276425   if (ACCESSING_LSW32)
64286426   {
6429      K056832_b_word_w((offset<<1)+1, data, mem_mask);
6427      K056832_b_word_w(machine, (offset<<1)+1, data, mem_mask);
64306428   }
64316429}
64326430
6433static int K056832_update_linemap(running_machine *machine, mame_bitmap *bitmap, int page, int flags)
6431static int K056832_update_linemap(running_machine *machine, bitmap_t *bitmap, int page, int flags)
64346432{
64356433#define LINE_WIDTH 512
64366434
r1877r1878
64416439
64426440   rectangle zerorect;
64436441   tilemap *tmap;
6444   mame_bitmap *pixmap, *xprmap;
6442   bitmap_t *pixmap, *xprmap;
64456443   UINT8 *xprdata;
64466444   const gfx_element *src_gfx;
64476445
r1877r1878
65366534#undef DRAW_PIX
65376535}
65386536
6539void K056832_tilemap_draw(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int layer, int flags, UINT32 priority)
6537void K056832_tilemap_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int layer, int flags, UINT32 priority)
65406538{
65416539   static int last_colorbase[K056832_PAGE_COUNT];
65426540
r1877r1878
68176815
68186816} // end of function
68196817
6820void K056832_tilemap_draw_dj(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int layer, int flags, UINT32 priority) //*
6818void K056832_tilemap_draw_dj(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int layer, int flags, UINT32 priority) //*
68216819{
68226820   static int last_colorbase[K056832_PAGE_COUNT];
68236821
r1877r1878
72437241WRITE32_HANDLER( K054338_long_w )
72447242{
72457243   offset <<= 1;
7246   K054338_word_w(offset, data>>16, mem_mask>>16);
7247   K054338_word_w(offset+1, data, mem_mask);
7244   K054338_word_w(machine, offset, data>>16, mem_mask>>16);
7245   K054338_word_w(machine, offset+1, data, mem_mask);
72487246}
72497247
72507248// returns a 16-bit '338 register
r1877r1878
72717269}
72727270
72737271// K054338 BG color fill
7274void K054338_fill_solid_bg(mame_bitmap *bitmap)
7272void K054338_fill_solid_bg(bitmap_t *bitmap)
72757273{
72767274   UINT32 bgcolor;
72777275   UINT32 *pLine;
r1877r1878
72917289}
72927290
72937291// Unified K054338/K055555 BG color fill
7294void K054338_fill_backcolor(running_machine *machine, mame_bitmap *bitmap, int mode) // (see p.67)
7292void K054338_fill_backcolor(running_machine *machine, bitmap_t *bitmap, int mode) // (see p.67)
72957293{
72967294   int clipx, clipy, clipw, cliph, i, dst_pitch;
72977295   int BGC_CBLK, BGC_SET;
r1877r1878
74677465
74687466   chip_ptr = &K053250_info.chip[chip];
74697467
7470   current_frame = cpu_getcurrentframe();
7468   current_frame = video_screen_get_frame_number(0);
74717469   last_frame = chip_ptr->frame;
74727470
74737471   if (limiter && current_frame == last_frame) return; // make sure we only do DMA transfer once per frame
r1877r1878
75927590#if 0
75937591
75947592static void K053250_pdraw_scanline8(
7595      mame_bitmap *bitmap,int x,int y,int length,
7593      bitmap_t *bitmap,int x,int y,int length,
75967594      const UINT8 *src,pen_t *pens,int transparent_pen,UINT32 orient,int pri)
75977595{
75987596   /* 8bpp destination */
r1877r1878
77657763   }
77667764}
77677765
7768void K053250_draw(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int chip, int colorbase, int pri)
7766void K053250_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int chip, int colorbase, int pri)
77697767{
77707768   static int pmode[2] = {-1,-1};
77717769   static int kc=-1, kk=0, kxx=-105, kyy=0;
r1877r1878
79677965#else
79687966
79697967// utility function to render a clipped scanline vertically or horizontally
7970INLINE void K053250_pdraw_scanline32(mame_bitmap *bitmap, const pen_t *palette, UINT8 *source,
7968INLINE void K053250_pdraw_scanline32(bitmap_t *bitmap, const pen_t *palette, UINT8 *source,
79717969      const rectangle *cliprect, int linepos, int scroll, int zoom,
79727970      UINT32 clipmask, UINT32 wrapmask, UINT32 orientation, int priority)
79737971{
r1877r1878
81348132#undef FIXPOINT_PRECISION_HALF
81358133}
81368134
8137void K053250_draw(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int chip, int colorbase, int flags, int priority)
8135void K053250_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int chip, int colorbase, int flags, int priority)
81388136{
81398137   struct K053250_CHIPTAG *chip_ptr;
81408138   UINT16 *line_ram;
r1877r1878
83758373WRITE32_HANDLER( K053252_long_w )
83768374{
83778375   offset <<= 1;
8378   K053252_word_w(offset, data>>16, mem_mask>>16);
8379   K053252_word_w(offset+1, data, mem_mask);
8376   K053252_word_w(machine, offset, data>>16, mem_mask>>16);
8377   K053252_word_w(machine, offset+1, data, mem_mask);
83808378}
83818379
83828380
r1877r1878
83948392READ32_HANDLER( K056832_long_r )
83958393{
83968394   offset <<= 1;
8397   return (K056832_word_r(offset+1, 0xffff) | K056832_word_r(offset, 0xffff)<<16);
8395   return (K056832_word_r(machine, offset+1, 0xffff) | K056832_word_r(machine, offset, 0xffff)<<16);
83988396}
83998397
84008398READ32_HANDLER( K053247_reg_long_r )
84018399{
84028400   offset <<= 1;
8403   return (K053247_reg_word_r(offset+1, 0xffff) | K053247_reg_word_r(offset, 0xffff)<<16);
8401   return (K053247_reg_word_r(machine, offset+1, 0xffff) | K053247_reg_word_r(machine, offset, 0xffff)<<16);
84048402}
84058403
84068404READ32_HANDLER( K055555_long_r )
84078405{
84088406   offset <<= 1;
8409   return (K055555_word_r(offset+1, 0xffff) | K055555_word_r(offset, 0xffff)<<16);
8407   return (K055555_word_r(machine, offset+1, 0xffff) | K055555_word_r(machine, offset, 0xffff)<<16);
84108408}
84118409
84128410READ16_HANDLER( K053244_reg_word_r ) { return(K053244_regs[0][offset*2]<<8|K053244_regs[0][offset*2+1]); }
src/mame/video/blmbycar.c
r1877r1878
167167
168168***************************************************************************/
169169
170static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
170static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
171171{
172172   UINT16 *source, *finish;
173173
src/mame/video/retofinv.c
r1877r1878
175175
176176***************************************************************************/
177177
178static void draw_sprites(running_machine *machine, mame_bitmap *bitmap)
178static void draw_sprites(running_machine *machine, bitmap_t *bitmap)
179179{
180180   int offs;
181181   static const rectangle spritevisiblearea =
src/mame/video/meadows.c
r1877r1878
6363
6464WRITE8_HANDLER( meadows_spriteram_w )
6565{
66   if (spriteram[offset] != data)
67      video_screen_update_partial(0, video_screen_get_vpos(0));
66   video_screen_update_now(0);
6867   spriteram[offset] = data;
6968}
7069
r1877r1878
7675 *
7776 *************************************/
7877
79static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *clip)
78static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *clip)
8079{
8180   int i;
8281
src/mame/video/konamiic.h
r1877r1878
1111void K007121_ctrl_w(int chip,int offset,int data);
1212WRITE8_HANDLER( K007121_ctrl_0_w );
1313WRITE8_HANDLER( K007121_ctrl_1_w );
14void K007121_sprites_draw(int chip,mame_bitmap *bitmap,gfx_element **gfxs, colortable_t *ctable,
14void K007121_sprites_draw(int chip,bitmap_t *bitmap,gfx_element **gfxs, colortable_t *ctable,
1515                    const rectangle *cliprect, const UINT8 *source,int base_color,
1616                    int global_x_offset,int bank_base, UINT32 pri_mask);
1717
r1877r1878
2424void K007342_tilemap_update(void);
2525WRITE8_HANDLER( K007342_vreg_w );
2626void K007342_tilemap_set_enable(int layer, int enable);
27void K007342_tilemap_draw(mame_bitmap *bitmap,const rectangle *cliprect,int num,int flags,UINT32 priority);
27void K007342_tilemap_draw(bitmap_t *bitmap,const rectangle *cliprect,int num,int flags,UINT32 priority);
2828int K007342_is_INT_enabled(void);
2929
3030
3131void K007420_vh_start(running_machine *machine, int gfxnum, void (*callback)(int *code,int *color));
3232READ8_HANDLER( K007420_r );
3333WRITE8_HANDLER( K007420_w );
34void K007420_sprites_draw(mame_bitmap *bitmap,const rectangle *cliprect);
34void K007420_sprites_draw(bitmap_t *bitmap,const rectangle *cliprect);
3535void K007420_set_banklimit(int limit);
3636
3737
r1877r1878
104104WRITE8_HANDLER( K051937_w );
105105READ16_HANDLER( K051937_word_r );
106106WRITE16_HANDLER( K051937_word_w );
107void K051960_sprites_draw(mame_bitmap *bitmap,const rectangle *cliprect,int min_priority,int max_priority);
107void K051960_sprites_draw(bitmap_t *bitmap,const rectangle *cliprect,int min_priority,int max_priority);
108108int K051960_is_IRQ_enabled(void);
109109int K051960_is_NMI_enabled(void);
110110void K051960_set_sprite_offsets(int dx, int dy);
r1877r1878
129129READ16_HANDLER( K053244_word_r );
130130WRITE16_HANDLER( K053244_word_w );
131131void K053244_bankselect(int chip, int bank);   /* used by TMNT2, Asterix and Premier Soccer for ROM testing */
132void K053245_sprites_draw(int chip, mame_bitmap *bitmap,const rectangle *cliprect);
133void K053245_sprites_draw_lethal(running_machine *machine, int chip, mame_bitmap *bitmap,const rectangle *cliprect); /* for lethal enforcers */
132void K053245_sprites_draw(int chip, bitmap_t *bitmap,const rectangle *cliprect);
133void K053245_sprites_draw_lethal(running_machine *machine, int chip, bitmap_t *bitmap,const rectangle *cliprect); /* for lethal enforcers */
134134void K053245_clear_buffer(int chip);
135135void K053245_set_SpriteOffset(int chip,int offsx, int offsy);
136136
r1877r1878
164164WRITE32_HANDLER( K053247_long_w );
165165WRITE16_HANDLER( K053247_reg_word_w ); // "OBJSET2" registers
166166WRITE32_HANDLER( K053247_reg_long_w );
167void K053247_sprites_draw(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect);
167void K053247_sprites_draw(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect);
168168int K053247_read_register(int regnum);
169169void K053247_set_SpriteOffset(int offsx, int offsy);
170170void K053247_wraparound_enable(int status);
r1877r1878
214214WRITE8_HANDLER( K051316_ctrl_0_w );
215215WRITE8_HANDLER( K051316_ctrl_1_w );
216216WRITE8_HANDLER( K051316_ctrl_2_w );
217void K051316_zoom_draw_0(mame_bitmap *bitmap,const rectangle *cliprect,int flags,UINT32 priority);
218void K051316_zoom_draw_1(mame_bitmap *bitmap,const rectangle *cliprect,int flags,UINT32 priority);
219void K051316_zoom_draw_2(mame_bitmap *bitmap,const rectangle *cliprect,int flags,UINT32 priority);
217void K051316_zoom_draw_0(bitmap_t *bitmap,const rectangle *cliprect,int flags,UINT32 priority);
218void K051316_zoom_draw_1(bitmap_t *bitmap,const rectangle *cliprect,int flags,UINT32 priority);
219void K051316_zoom_draw_2(bitmap_t *bitmap,const rectangle *cliprect,int flags,UINT32 priority);
220220void K051316_wraparound_enable(int chip, int status);
221221void K051316_set_offset(int chip, int xoffs, int yoffs);
222222
223223
224224extern UINT16 *K053936_0_ctrl,*K053936_0_linectrl;
225225extern UINT16 *K053936_1_ctrl,*K053936_1_linectrl;
226void K053936_0_zoom_draw(mame_bitmap *bitmap,const rectangle *cliprect,tilemap *tmap,int flags,UINT32 priority);
227void K053936_1_zoom_draw(mame_bitmap *bitmap,const rectangle *cliprect,tilemap *tmap,int flags,UINT32 priority);
226void K053936_0_zoom_draw(bitmap_t *bitmap,const rectangle *cliprect,tilemap *tmap,int flags,UINT32 priority);
227void K053936_1_zoom_draw(bitmap_t *bitmap,const rectangle *cliprect,tilemap *tmap,int flags,UINT32 priority);
228228void K053936_wraparound_enable(int chip, int status);
229229void K053936_set_offset(int chip, int xoffs, int yoffs);
230230
r1877r1878
284284WRITE8_HANDLER( K056832_b_w );
285285void K056832_mark_plane_dirty(int num);
286286void K056832_MarkAllTilemapsDirty(void);
287void K056832_tilemap_draw(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int num, int flags, UINT32 priority);
288void K056832_tilemap_draw_dj(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int layer, int flags, UINT32 priority);
287void K056832_tilemap_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int num, int flags, UINT32 priority);
288void K056832_tilemap_draw_dj(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int layer, int flags, UINT32 priority);
289289void K056832_set_LayerAssociation(int status);
290290int  K056832_get_LayerAssociation(void);
291291void K056832_set_LayerOffset(int layer, int offsx, int offsy);
r1877r1878
391391WRITE32_HANDLER( K054338_long_w );
392392int K054338_read_register(int reg);
393393void K054338_update_all_shadows(running_machine *machine);         // called at the beginning of VIDEO_UPDATE()
394void K054338_fill_solid_bg(mame_bitmap *bitmap);            // solid backcolor fill
395void K054338_fill_backcolor(running_machine *machine, mame_bitmap *bitmap, int mode);   // unified fill, 0=solid, 1=gradient
394void K054338_fill_solid_bg(bitmap_t *bitmap);            // solid backcolor fill
395void K054338_fill_backcolor(running_machine *machine, bitmap_t *bitmap, int mode);   // unified fill, 0=solid, 1=gradient
396396int  K054338_set_alpha_level(int pblend);                     // blend style 0-2
397397void K054338_invert_alpha(int invert);                        // 0=0x00(invis)-0x1f(solid), 1=0x1f(invis)-0x00(solod)
398398void K054338_export_config(int **shdRGB);
r1877r1878
427427#define K053250_WRAP500      0x01
428428#define K053250_OVERDRIVE   0x02
429429
430void K053250_draw(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int chip, int colorbase, int flags, int pri);
430void K053250_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int chip, int colorbase, int flags, int pri);
431431void K053250_set_LayerOffset(int chip, int offsx, int offsy);
432432void K053250_unpack_pixels(int region);
433433void K053250_dma(int chip, int limiter);
src/mame/video/bogeyman.c
r1877r1878
6464WRITE8_HANDLER( bogeyman_paletteram_w )
6565{
6666   /* RGB output is inverted */
67   paletteram_BBGGGRRR_w(offset, ~data);
67   paletteram_BBGGGRRR_w(machine, offset, ~data);
6868}
6969
7070static TILE_GET_INFO( get_bg_tile_info )
r1877r1878
9898   tilemap_set_transparent_pen(fg_tilemap, 0);
9999}
100100
101static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
101static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
102102{
103103   int offs;
104104
src/mame/video/harddriv.c
r1877r1878
460460}
461461
462462
463void harddriv_scanline_driver(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params)
463void harddriv_scanline_driver(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params)
464464{
465465   UINT8 *vram_base = &hdgsp_vram[(params->rowaddr << 12) & vram_mask];
466466   UINT16 *dest = BITMAP_ADDR16(bitmap, scanline, 0);
r1877r1878
475475}
476476
477477
478void harddriv_scanline_multisync(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params)
478void harddriv_scanline_multisync(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params)
479479{
480480   UINT8 *vram_base = &hdgsp_vram[(params->rowaddr << 11) & vram_mask];
481481   UINT16 *dest = BITMAP_ADDR16(bitmap, scanline, 0);
src/mame/video/srmp2.c
r1877r1878
4545}
4646
4747
48static void srmp2_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
48static void srmp2_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
4949{
5050/*
5151    Sprite RAM A:   spriteram16_2
r1877r1878
118118}
119119
120120
121static void srmp3_draw_sprites_map(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
121static void srmp3_draw_sprites_map(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
122122{
123123   int offs, col;
124124   int xoffs, yoffs;
r1877r1878
191191}
192192
193193
194static void srmp3_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
194static void srmp3_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
195195{
196196/*
197197    Sprite RAM A:   spriteram_2
r1877r1878
275275}
276276
277277
278static void mjyuugi_draw_sprites_map(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
278static void mjyuugi_draw_sprites_map(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
279279{
280280   int offs, col;
281281   int xoffs, yoffs;
r1877r1878
355355}
356356
357357
358static void mjyuugi_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
358static void mjyuugi_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
359359{
360360/*
361361    Sprite RAM A:   spriteram16_2
src/mame/video/m72.c
r1877r1878
401401
402402***************************************************************************/
403403
404static void m72_draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
404static void m72_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
405405{
406406   int offs;
407407
r1877r1878
454454   }
455455}
456456
457static void majtitle_draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
457static void majtitle_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
458458{
459459   int offs;
460460
src/mame/video/pokechmp.c
r1877r1878
3333       8, 8, 32, 32);
3434}
3535
36static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
36static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
3737{
3838   int offs;
3939
src/mame/video/ohmygod.c
r1877r1878
7979
8080***************************************************************************/
8181
82static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
82static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
8383{
8484   int offs;
8585
src/mame/video/snk68.c
r1877r1878
143143
144144***************************************************************************/
145145
146static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int j,int pos)
146static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int j,int pos)
147147{
148148   int offs,mx,my,color,tile,fx,fy,i;
149149
r1877r1878
217217}
218218
219219
220static void draw_sprites2(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int j, int z, int pos)
220static void draw_sprites2(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int j, int z, int pos)
221221{
222222   int offs,mx,my,color,tile,fx,fy,i;
223223
src/mame/video/madalien.c
r1877r1878
3131static tilemap *tilemap_edge1[4];
3232static tilemap *tilemap_edge2[4];
3333
34static mame_bitmap *headlight_bitmap;
34static bitmap_t *headlight_bitmap;
3535
3636
3737static PALETTE_INIT( madalien )
r1877r1878
8484}
8585
8686
87WRITE8_HANDLER( madalien_mc6845_address_w )
88{
89   mc6845_address_w(mc6845, data);
90}
91
92READ8_HANDLER( madalien_mc6845_register_r )
93{
94   return mc6845_register_r(mc6845);
95}
96
97WRITE8_HANDLER( madalien_mc6845_register_w )
98{
99   mc6845_register_w(mc6845, data);
100}
101
102
10387INLINE int scan_helper(int col, int row, int section)
10488{
10589   return (section << 8) | ((~col & 0x0f) << 3) | row;
r1877r1878
150134{
151135   int i;
152136
153   static const tilemap_mapper_callback scan_functions[4] =
137   static const tilemap_mapper_func scan_functions[4] =
154138   {
155139      scan_mode0, scan_mode1, scan_mode2, scan_mode3
156140   };
r1877r1878
185169}
186170
187171
188static void draw_edges(mame_bitmap *bitmap, const rectangle *cliprect, int flip, int scroll_mode)
172static void draw_edges(bitmap_t *bitmap, const rectangle *cliprect, int flip, int scroll_mode)
189173{
190174   rectangle clip_edge1;
191175   rectangle clip_edge2;
r1877r1878
223207}
224208
225209
226static void draw_headlight(mame_bitmap *bitmap, const rectangle *cliprect, int flip)
210static void draw_headlight(bitmap_t *bitmap, const rectangle *cliprect, int flip)
227211{
228212   if (BIT(*madalien_video_flags, 0))
229213   {
r1877r1878
258242}
259243
260244
261static void draw_foreground(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int flip)
245static void draw_foreground(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int flip)
262246{
263247   int i;
264248
r1877r1878
404388   NULL,             /* before pixel update callback */
405389   NULL,             /* row update callback */
406390   NULL,             /* after pixel update callback */
407   NULL              /* call back for display state changes */
391   NULL,             /* callback for display state changes */
392   NULL,           /* HSYNC callback */
393   NULL           /* VSYNC callback */
408394};
409395
410396
src/mame/video/aeroboto.c
r1877r1878
117117
118118***************************************************************************/
119119
120static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
120static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
121121{
122122   int offs;
123123
src/mame/video/firetrap.c
r1877r1878
209209
210210***************************************************************************/
211211
212static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
212static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
213213{
214214   int offs;
215215
src/mame/video/thedeep.c
r1877r1878
151151
152152***************************************************************************/
153153
154static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
154static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
155155{
156156   UINT8 *s = spriteram, *end = s + spriteram_size;
157157
src/mame/video/oneshot.c
r1877r1878
7676   tilemap_set_transparent_pen(oneshot_fg_tilemap,0);
7777}
7878
79static void draw_crosshairs( mame_bitmap *bitmap, const rectangle *cliprect )
79static void draw_crosshairs( bitmap_t *bitmap, const rectangle *cliprect )
8080{
8181    int xpos,ypos;
8282    /* get gun raw coordonates (player 1) */
r1877r1878
106106        gun_x_p2=0;
107107}
108108
109static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
109static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
110110{
111111   const UINT16 *source = oneshot_sprites;
112112   const UINT16 *finish = source+(0x1000/2);
src/mame/video/stlforce.c
r1877r1878
9595
9696/* sprites - quite a bit still needs doing .. */
9797
98static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
98static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
9999{
100100
101101   const UINT16 *source = stlforce_spriteram+0x0;
src/mame/video/topspeed.c
r1877r1878
3535
3636********************************************************************************/
3737
38static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
38static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
3939{
4040   int offs,map_offset,x,y,curx,cury,sprite_chunk;
4141   UINT16 *spritemap = topspeed_spritemap;
src/mame/video/amspdwy.c
r1877r1878
2121WRITE8_HANDLER( amspdwy_paletteram_w )
2222{
2323   data ^= 0xff;
24   paletteram_BBGGGRRR_w(offset,data);
24   paletteram_BBGGGRRR_w(machine,offset,data);
2525//  paletteram_RRRGGGBB_w(offset,data);
2626}
2727
r1877r1878
102102
103103***************************************************************************/
104104
105static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
105static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
106106{
107107   int i;
108108   int max_x = machine->screen[0].width  - 1;
src/mame/video/fantland.c
r1877r1878
6060
6161#include "driver.h"
6262
63static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
63static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
6464{
6565   UINT8   *indx_ram   =   spriteram + 0x2000,   // this ram contains indexes into offs_ram
6666         *offs_ram   =   spriteram + 0x2400,   // this ram contains x,y offsets or indexes into spriteram_2
src/mame/video/toobin.c
r1877r1878
215215      video_screen_update_partial(0, video_screen_get_vpos(0));
216216
217217   /* update the data */
218   atarimo_0_slipram_w(offset, data, mem_mask);
218   atarimo_0_slipram_w(machine, offset, data, mem_mask);
219219}
220220
221221
r1877r1878
229229VIDEO_UPDATE( toobin )
230230{
231231   struct atarimo_rect_list rectlist;
232   mame_bitmap *mobitmap;
232   bitmap_t *mobitmap;
233233   int x, y, r;
234234
235235   /* draw the playfield */
src/mame/video/srumbler.c
r1877r1878
112112
113113***************************************************************************/
114114
115static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
115static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
116116{
117117   int offs;
118118
r1877r1878
170170
171171VIDEO_EOF( srumbler )
172172{
173   buffer_spriteram_w(0,0);
173   buffer_spriteram_w(machine,0,0);
174174}
src/mame/video/legionna.c
r1877r1878
222222
223223*************************************************************************/
224224
225static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int pri)
225static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int pri)
226226{
227227   int offs,fx,fy,x,y,color,sprite,cur_pri;
228228   int dx,dy,ax,ay;
src/mame/video/pbaction.c
r1877r1878
8282   tilemap_set_transparent_pen(fg_tilemap, 0);
8383}
8484
85static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
85static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
8686{
8787   int offs;
8888
src/mame/video/mcr68.c
r1877r1878
186186 *
187187 *************************************/
188188
189static void mcr68_update_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
189static void mcr68_update_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority)
190190{
191191   rectangle sprite_clip = machine->screen[0].visarea;
192192   int offs;
r1877r1878
238238}
239239
240240
241static void zwackery_update_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
241static void zwackery_update_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority)
242242{
243243   int offs;
244244
src/mame/video/funworld.c
r1877r1878
125125   tilemap_mark_tile_dirty(bg_tilemap, offset);
126126}
127127
128WRITE8_HANDLER( funworld_mc6845_address_w )
129{
130   mc6845_address_w(mc6845, data);
131}
132
133READ8_HANDLER( funworld_mc6845_register_r )
134{
135   return mc6845_register_r(mc6845);
136}
137
138WRITE8_HANDLER( funworld_mc6845_register_w )
139{
140   mc6845_register_w(mc6845, data);
141}
142
143128/**** normal hardware limit ****
144129    - bits -
145130    7654 3210
src/mame/video/gsword.c
r1877r1878
163163       8, 8, 32, 64);
164164}
165165
166static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
166static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
167167{
168168   int offs;
169169
src/mame/video/mario.c
r1877r1878
77***************************************************************************/
88
99#include "driver.h"
10#include "deprecat.h"
1110#include "video/resnet.h"
1211
1312#include "includes/mario.h"
r1877r1878
8079
8180WRITE8_HANDLER( mario_videoram_w )
8281{
83   mario_state   *state = Machine->driver_data;
82   mario_state   *state = machine->driver_data;
8483
8584   state->videoram[offset] = data;
8685   tilemap_mark_tile_dirty(state->bg_tilemap, offset);
r1877r1878
8887
8988WRITE8_HANDLER( mario_gfxbank_w )
9089{
91   mario_state   *state = Machine->driver_data;
90   mario_state   *state = machine->driver_data;
9291
9392   if (state->gfx_bank != (data & 0x01))
9493   {
r1877r1878
9998
10099WRITE8_HANDLER( mario_palettebank_w )
101100{
102   mario_state   *state = Machine->driver_data;
101   mario_state   *state = machine->driver_data;
103102
104103   if (state->palette_bank != (data & 0x01))
105104   {
r1877r1878
110109
111110WRITE8_HANDLER( mario_scroll_w )
112111{
113   mario_state   *state = Machine->driver_data;
112   mario_state   *state = machine->driver_data;
114113
115114   state->gfx_scroll = data + 17;
116115}
117116
118117WRITE8_HANDLER( mario_flip_w )
119118{
120   mario_state   *state = Machine->driver_data;
119   mario_state   *state = machine->driver_data;
121120
122121   if (state->flip != (data & 0x01))
123122   {
r1877r1878
132131
133132static TILE_GET_INFO( get_bg_tile_info )
134133{
135   mario_state   *state = Machine->driver_data;
134   mario_state   *state = machine->driver_data;
136135   int code = state->videoram[tile_index] + 256 * state->gfx_bank;
137136   int color;
138137
r1877r1878
162161 * confirmed on mametests.org as being present on real PCB as well.
163162 */
164163
165static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
164static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
166165{
167   mario_state   *state = Machine->driver_data;
166   mario_state   *state = machine->driver_data;
168167   int offs;
169168
170169   for (offs = 0;offs < state->spriteram_size;offs += 4)
src/mame/video/xmen.c
r1877r1878
5454   K053247_vh_start(machine,REGION_GFX2,53,-2,NORMAL_PLANE_ORDER,xmen_sprite_callback);
5555}
5656
57static mame_bitmap * screen_right;
58static mame_bitmap * screen_left;
57static bitmap_t * screen_right;
58static bitmap_t * screen_left;
5959static UINT16 *K053247_ram;
6060
6161VIDEO_START( xmen6p )
r1877r1878
166166VIDEO_EOF( xmen6p )
167167{
168168   int layer[3];
169   mame_bitmap * renderbitmap;
169   bitmap_t * renderbitmap;
170170   rectangle cliprect;
171171   int offset;
172172
r1877r1878
198198      for (offset=0;offset<(0xc000/2);offset++)
199199      {
200200//          K052109_lsb_w
201         K052109_w(offset,xmen6p_tilemapright[offset]&0x00ff);
201         K052109_w(machine,offset,xmen6p_tilemapright[offset]&0x00ff);
202202      }
203203
204204
r1877r1878
217217      for (offset=0;offset<(0xc000/2);offset++)
218218      {
219219//          K052109_lsb_w
220         K052109_w(offset,xmen6p_tilemapleft[offset]&0x00ff);
220         K052109_w(machine,offset,xmen6p_tilemapleft[offset]&0x00ff);
221221      }
222222
223223
src/mame/video/atarifb.c
r1877r1878
106106
107107
108108
109static void draw_playfield_and_alpha(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect,
109static void draw_playfield_and_alpha(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect,
110110                            int playfield_x_offset, int playfield_y_offset)
111111{
112112   static const rectangle bigfield_area = {  4*8, 34*8-1, 0*8, 32*8-1 };
r1877r1878
123123}
124124
125125
126static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect,
126static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect,
127127                   int gfx, int is_soccer)
128128{
129129   static const rectangle bigfield_area = {  4*8, 34*8-1, 0*8, 32*8-1 };
src/mame/video/silkroad.c
r1877r1878
99static tilemap *fg_tilemap,*fg2_tilemap,*fg3_tilemap;
1010extern UINT32 *silkroad_vidram,*silkroad_vidram2,*silkroad_vidram3, *silkroad_sprram, *silkroad_regs;
1111
12static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri )
12static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri )
1313{
1414   const gfx_element *gfx = machine->gfx[0];
1515   UINT32 *source = silkroad_sprram;
src/mame/video/exprraid.c
r1877r1878
9292   tilemap_set_transparent_pen(fg_tilemap, 0);
9393}
9494
95static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
95static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
9696{
9797   int offs;
9898
src/mame/video/tecmo16.c
r1877r1878
1717UINT16 *tecmo16_charram;
1818
1919static tilemap *fg_tilemap,*bg_tilemap,*tx_tilemap;
20static mame_bitmap *sprite_bitmap, *tile_bitmap_bg, *tile_bitmap_fg;
20static bitmap_t *sprite_bitmap, *tile_bitmap_bg, *tile_bitmap_fg;
2121
2222static int flipscreen, game_is_riot;
2323
r1877r1878
212212
213213/* mix & blend the paletted 16-bit tile and sprite bitmaps into an RGB 32-bit bitmap */
214214static void blendbitmaps(running_machine *machine,
215      mame_bitmap *dest,mame_bitmap *src1,mame_bitmap *src2,mame_bitmap *src3,
215      bitmap_t *dest,bitmap_t *src1,bitmap_t *src2,bitmap_t *src3,
216216      int sx,int sy,const rectangle *clip)
217217{
218218   int ox;
r1877r1878
320320   }
321321}
322322
323static void draw_sprites(running_machine *machine, mame_bitmap *bitmap_bg, mame_bitmap *bitmap_fg, mame_bitmap *bitmap_sp, const rectangle *cliprect)
323static void draw_sprites(running_machine *machine, bitmap_t *bitmap_bg, bitmap_t *bitmap_fg, bitmap_t *bitmap_sp, const rectangle *cliprect)
324324{
325325   int offs;
326326   static const UINT8 layout[8][8] =
r1877r1878
335335      {42,43,46,47,58,59,62,63}
336336   };
337337
338   mame_bitmap *bitmap = bitmap_bg;
338   bitmap_t *bitmap = bitmap_bg;
339339
340340   for (offs = spriteram_size/2 - 8;offs >= 0;offs -= 8)
341341   {
src/mame/video/naughtyb.c
r1877r1878
125125WRITE8_HANDLER( naughtyb_videoreg_w )
126126{
127127   // bits 4+5 control the sound circuit
128   pleiads_sound_control_c_w(machine,offset,data);
128129
129   pleiads_sound_control_c_w(offset,data);
130
131130   naughtyb_cocktail =
132      ( ( input_port_2_r(0) & 0x80 ) &&   // cabinet == cocktail
131      ( ( input_port_2_r(machine,0) & 0x80 ) &&   // cabinet == cocktail
133132        ( data & 0x01 ) );            // handling player 2
134133   palreg  = (data >> 1) & 0x03;         // pallette sel is bit 1 & 2
135134   bankreg = (data >> 2) & 0x01;         // banksel is just bit 2
r1877r1878
138137WRITE8_HANDLER( popflame_videoreg_w )
139138{
140139   // bits 4+5 control the sound circuit
140   pleiads_sound_control_c_w(machine,offset,data);
141141
142   pleiads_sound_control_c_w(offset,data);
143
144142   naughtyb_cocktail =
145      ( ( input_port_2_r(0) & 0x80 ) &&   // cabinet == cocktail
143      ( ( input_port_2_r(machine,0) & 0x80 ) &&   // cabinet == cocktail
146144        ( data & 0x01 ) );            // handling player 2
147145   palreg  = (data >> 1) & 0x03;         // pallette sel is bit 1 & 2
148146   bankreg = (data >> 3) & 0x01;         // banksel is just bit 3
src/mame/video/toypop.c
r1877r1878
174174      toypop_bg_image[2*offset+1] = (data & 0xf) | ((data & 0xf0) << 4);
175175}
176176
177static void draw_background(mame_bitmap *bitmap)
177static void draw_background(bitmap_t *bitmap)
178178{
179179   int offs, x, y;
180180   UINT16 scanline[288];
r1877r1878
222222***************************************************************************/
223223
224224/* from mappy.c */
225void mappy_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int xoffs, int yoffs, int transcolor);
225void mappy_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int xoffs, int yoffs, int transcolor);
226226
227227
228228VIDEO_UPDATE( toypop )
src/mame/video/tumbleb.c
r1877r1878
1515***************************************************************************/
1616
1717#include "driver.h"
18#include "deprecat.h"
1918
2019static UINT16 tumblepb_control_0[8];
2120UINT16 *tumblepb_pf1_data,*tumblepb_pf2_data;
r1877r1878
3029
3130/******************************************************************************/
3231
33static void tumblepb_draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
32static void tumblepb_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
3433{
3534   int offs;
3635
r1877r1878
4342
4443      y = spriteram16[offs];
4544      flash=y&0x1000;
46      if (flash && (cpu_getcurrentframe() & 1)) continue;
45      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
4746
4847      x = spriteram16[offs+2];
4948      colour = (x >>9) & 0xf;
r1877r1878
9291   }
9392}
9493
95static void jumpkids_draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
94static void jumpkids_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
9695{
9796   int offs;
9897
r1877r1878
105104
106105      y = spriteram16[offs];
107106      flash=y&0x1000;
108      if (flash && (cpu_getcurrentframe() & 1)) continue;
107      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
109108
110109      x = spriteram16[offs+2];
111110      colour = (x >>9) & 0xf;
r1877r1878
154153   }
155154}
156155
157static void fncywld_draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
156static void fncywld_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
158157{
159158   int offs;
160159
r1877r1878
167166
168167      y = spriteram16[offs];
169168      flash=y&0x1000;
170      if (flash && (cpu_getcurrentframe() & 1)) continue;
169      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
171170
172171      x = spriteram16[offs+2];
173172      colour = (x >>9) & 0x3f;
src/mame/video/momoko.c
r1877r1878
6969}
7070/****************************************************************************/
7171
72static void momoko_draw_bg_pri(mame_bitmap *bitmap, int chr, int col, int flipx, int flipy, int x,int y, int pri)
72static void momoko_draw_bg_pri(bitmap_t *bitmap, int chr, int col, int flipx, int flipy, int x,int y, int pri)
7373{
7474   int xx,sx,sy,px,py,dot;
7575   UINT32 gfxadr;
src/mame/video/kchamp.c
r1877r1878
6565            3             XXXXXXXX
6666*/
6767
68static void kchamp_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
68static void kchamp_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
6969{
7070   int offs;
7171
r1877r1878
9393   }
9494}
9595
96static void kchampvs_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
96static void kchampvs_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
9797{
9898   int offs;
9999
src/mame/video/digdug.c
r1877r1878
254254   0*8, 28*8-1
255255};
256256
257static void draw_sprites(running_machine* machine, mame_bitmap *bitmap, const rectangle *cliprect )
257static void draw_sprites(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect )
258258{
259259   int offs;
260260
src/mame/video/ultratnk.c
r1877r1878
1010
1111static tilemap* playfield;
1212
13static mame_bitmap* helper;
13static bitmap_t* helper;
1414
1515int ultratnk_collision[4];
1616
r1877r1878
140140
141141   /* update sound status */
142142
143   discrete_sound_w(ULTRATNK_MOTOR_DATA_1, videoram[0x391] & 15);
144   discrete_sound_w(ULTRATNK_MOTOR_DATA_2, videoram[0x393] & 15);
143   discrete_sound_w(machine, ULTRATNK_MOTOR_DATA_1, videoram[0x391] & 15);
144   discrete_sound_w(machine, ULTRATNK_MOTOR_DATA_2, videoram[0x393] & 15);
145145}
146146
147147
src/mame/video/m90.c
r1877r1878
6666   state_save_register_global_array(m90_video_control_data);
6767}
6868
69static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
69static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
7070{
7171   int offs;
7272
r1877r1878
101101}
102102
103103#if 0
104static void bootleg_draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
104static void bootleg_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
105105{
106106   int offs;
107107
src/mame/video/scotrsht.c
r1877r1878
9494}
9595
9696/* Same as Jailbreak + palette bank */
97static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
97static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
9898{
9999   int i;
100100
src/mame/video/gunbustr.c
r1877r1878
6969
7070********************************************************/
7171
72static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,const int *primasks,int x_offs,int y_offs)
72static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,const int *primasks,int x_offs,int y_offs)
7373{
7474   UINT16 *spritemap = (UINT16 *)memory_region(REGION_USER1);
7575   int offs, data, tilenum, color, flipx, flipy;
src/mame/video/taito_z.c
r1877r1878
167167********************************************************/
168168
169169
170static void contcirc_draw_sprites_16x8(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int y_offs)
170static void contcirc_draw_sprites_16x8(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int y_offs)
171171{
172172   UINT16 *spritemap = (UINT16 *)memory_region(REGION_USER1);
173173   int offs, data, tilenum, color, flipx, flipy;
r1877r1878
259259
260260
261261
262static void chasehq_draw_sprites_16x16(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int y_offs)
262static void chasehq_draw_sprites_16x16(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int y_offs)
263263{
264264   UINT16 *spritemap = (UINT16 *)memory_region(REGION_USER1);
265265   int offs, data, tilenum, color, flipx, flipy;
r1877r1878
444444
445445
446446
447static void bshark_draw_sprites_16x8(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int y_offs)
447static void bshark_draw_sprites_16x8(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int y_offs)
448448{
449449   UINT16 *spritemap = (UINT16 *)memory_region(REGION_USER1);
450450   int offs, data, tilenum, color, flipx, flipy;
r1877r1878
537537
538538
539539
540static void sci_draw_sprites_16x8(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int y_offs)
540static void sci_draw_sprites_16x8(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int y_offs)
541541{
542542   UINT16 *spritemap = (UINT16 *)memory_region(REGION_USER1);
543543   int offs, start_offs, data, tilenum, color, flipx, flipy;
r1877r1878
639639
640640
641641
642static void aquajack_draw_sprites_16x8(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int y_offs)
642static void aquajack_draw_sprites_16x8(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int y_offs)
643643{
644644   UINT16 *spritemap = (UINT16 *)memory_region(REGION_USER1);
645645   int offs, data, tilenum, color, flipx, flipy;
r1877r1878
731731
732732
733733
734static void spacegun_draw_sprites_16x8(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int y_offs)
734static void spacegun_draw_sprites_16x8(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int y_offs)
735735{
736736   UINT16 *spritemap = (UINT16 *)memory_region(REGION_USER1);
737737   int offs, data, tilenum, color, flipx, flipy;
src/mame/video/phoenix.c
r1877r1878
234234      videoram_pg_index = data & 1;
235235      memory_set_bank(1, videoram_pg_index);
236236
237      cocktail_mode = videoram_pg_index && (input_port_3_r(0) & 0x01);
237      cocktail_mode = videoram_pg_index && (input_port_3_r(machine,0) & 0x01);
238238
239239      tilemap_set_flip(ALL_TILEMAPS, cocktail_mode ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
240240      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
r1877r1878
257257      videoram_pg_index = data & 1;
258258      memory_set_bank(1, videoram_pg_index);
259259
260      cocktail_mode = videoram_pg_index && (input_port_3_r(0) & 0x01);
260      cocktail_mode = videoram_pg_index && (input_port_3_r(machine,0) & 0x01);
261261
262262      tilemap_set_flip(ALL_TILEMAPS, cocktail_mode ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
263263      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
r1877r1878
280280   pleiads_protection_question = data & 0xfc;
281281
282282   /* send two bits to sound control C (not sure if they are there) */
283   pleiads_sound_control_c_w(offset, data);
283   pleiads_sound_control_c_w(machine, offset, data);
284284}
285285
286286
src/mame/video/msisaac.c
r1877r1878
157157  Display refresh
158158
159159***************************************************************************/
160static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
160static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
161161{
162162   const UINT8 *source = spriteram+32*4-4;
163163   const UINT8 *finish = spriteram; /* ? */
src/mame/video/markham.c
r1877r1878
7575   tilemap_set_scroll_rows(bg_tilemap, 32);
7676}
7777
78static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
78static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
7979{
8080   int offs;
8181
src/mame/video/superqix.c
r1877r1878
1313int pbillian_show_power;
1414
1515static int gfxbank;
16static mame_bitmap *fg_bitmap[2];
16static bitmap_t *fg_bitmap[2];
1717static int show_bitmap;
1818static tilemap *bg_tilemap;
1919
r1877r1878
130130   bankaddress = 0x10000 + ((data & 0x08) >> 3) * 0x4000;
131131   memory_set_bankptr(1,&rom[bankaddress]);
132132
133   interrupt_enable_w(0,data & 0x10);
133   interrupt_enable_w(machine,0,data & 0x10);
134134   flip_screen_set(data & 0x20);
135135}
136136
r1877r1878
150150   show_bitmap = (data & 0x04) >> 2;
151151
152152   /* bit 3 enables NMI */
153   interrupt_enable_w(offset,data & 0x08);
153   interrupt_enable_w(machine,offset,data & 0x08);
154154
155155   /* bits 4-5 control ROM bank */
156156   bankaddress = 0x10000 + ((data & 0x30) >> 4) * 0x4000;
r1877r1878
165165
166166***************************************************************************/
167167
168static void pbillian_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
168static void pbillian_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
169169{
170170   int offs;
171171
r1877r1878
192192   }
193193}
194194
195static void superqix_draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
195static void superqix_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
196196{
197197   int offs;
198198
src/mame/video/dday.c
r1877r1878
1717UINT8 *dday_colorram;
1818
1919static tilemap *fg_tilemap, *bg_tilemap, *text_tilemap, *sl_tilemap;
20static mame_bitmap *main_bitmap;
20static bitmap_t *main_bitmap;
2121static int control;
2222static int sl_image;
2323static int sl_enable;
r1877r1878
324324      /* apply shadow */
325325      int x, y;
326326
327      mame_bitmap *sl_bitmap = tilemap_get_pixmap(sl_tilemap);
327      bitmap_t *sl_bitmap = tilemap_get_pixmap(sl_tilemap);
328328
329329      for (x = cliprect->min_x; x <= cliprect->max_x; x++)
330330         for (y = cliprect->min_y; y <= cliprect->max_y; y++)
src/mame/video/cyberbal.c
r1877r1878
360360 *
361361 *************************************/
362362
363static void update_one_screen(running_machine* machine, int screen, mame_bitmap *bitmap, const rectangle *cliprect)
363static void update_one_screen(running_machine* machine, int screen, bitmap_t *bitmap, const rectangle *cliprect)
364364{
365365   struct atarimo_rect_list rectlist;
366366   rectangle tempclip = *cliprect;
367   mame_bitmap *mobitmap;
367   bitmap_t *mobitmap;
368368   int x, y, r, mooffset, temp;
369369
370370   /* draw the playfield */
src/mame/video/lockon.c
r1877r1878
4444static UINT16   scroll_h;
4545static UINT16   scroll_v;
4646
47static mame_bitmap   *front_buffer;
48static mame_bitmap   *back_buffer;
47static bitmap_t   *front_buffer;
48static bitmap_t   *back_buffer;
4949static emu_timer   *bufend_timer;
5050static emu_timer   *cursor_timer;
5151
r1877r1878
730730   if (carry) --CNT;                    \
731731} while(0)
732732
733static void rotate_draw(mame_bitmap *bitmap, const rectangle *cliprect)
733static void rotate_draw(bitmap_t *bitmap, const rectangle *cliprect)
734734{
735735   UINT32 y;
736736
r1877r1878
834834
835835*******************************************************************************************/
836836
837static void hud_draw(mame_bitmap *bitmap, const rectangle *cliprect)
837static void hud_draw(bitmap_t *bitmap, const rectangle *cliprect)
838838{
839839   UINT8   *tile_rom = memory_region(REGION_GFX3);
840840   UINT32   offs;
r1877r1878
977977VIDEO_EOF( lockon )
978978{
979979   /* Swap the frame buffers */
980   mame_bitmap *tmp = front_buffer;
980   bitmap_t *tmp = front_buffer;
981981   front_buffer = back_buffer;
982982   back_buffer = tmp;
983983
src/mame/video/mappy.c
r1877r1878
88static UINT8 mappy_scroll;
99static tilemap *bg_tilemap;
1010
11static mame_bitmap *sprite_bitmap;
11static bitmap_t *sprite_bitmap;
1212
1313
1414/***************************************************************************
r1877r1878
400400***************************************************************************/
401401
402402/* also used by toypop.c */
403void mappy_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int xoffs, int yoffs, int transcolor)
403void mappy_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int xoffs, int yoffs, int transcolor)
404404{
405405   int offs;
406406
r1877r1878
4754751   -------x  X position MSB
476476*/
477477
478static void phozon_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
478static void phozon_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
479479{
480480   int offs;
481481
src/mame/video/tigeroad.c
r1877r1878
6464   }
6565}
6666
67static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority )
67static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority )
6868{
6969   UINT16 *source = &buffered_spriteram16[spriteram_size/2] - 4;
7070   UINT16 *finish = buffered_spriteram16;
r1877r1878
166166
167167VIDEO_EOF( tigeroad )
168168{
169   buffer_spriteram16_w(0,0,0);
169   buffer_spriteram16_w(machine,0,0,0);
170170}
src/mame/video/atari.c
r1877r1878
796796   return 0;
797797}
798798
799static renderer_function antic_renderer = antic_mode_0_xx;
799static atari_renderer_func antic_renderer = antic_mode_0_xx;
800800
801801static void artifacts_gfx(UINT8 *src, UINT8 *dst, int width)
802802{
r1877r1878
10601060   return video_screen_get_hpos(0) * CYCLES_PER_LINE / Machine->screen[0].width;
10611061}
10621062
1063static void after(int cycles, timer_callback function, const char *funcname)
1063static void after(int cycles, timer_fired_func function, const char *funcname)
10641064{
10651065    attotime duration = attotime_make(0, attotime_to_attoseconds(video_screen_get_scan_period(0)) * cycles / CYCLES_PER_LINE);
10661066    (void)funcname;
r1877r1878
10831083}
10841084
10851085
1086static const renderer_function renderer[2][19][5] = {
1086static const atari_renderer_func renderer[2][19][5] = {
10871087   /*   no playfield    narrow          normal          wide         */
10881088   {
10891089      {antic_mode_0_xx,antic_mode_0_xx,antic_mode_0_xx,antic_mode_0_xx},
r1877r1878
11981198            if( antic.w.dmactl & DMA_MISSILE )
11991199            {
12001200                antic.steal_cycles += 1;
1201                atari_gtia_w(0x11, RDPMGFXD(3*256));
1201                atari_gtia_w(machine, 0x11, RDPMGFXD(3*256));
12021202            }
12031203            /* transport player data to GTIA ? */
12041204            if( antic.w.dmactl & DMA_PLAYER )
12051205            {
12061206                antic.steal_cycles += 4;
1207                atari_gtia_w(0x0d, RDPMGFXD(4*256));
1208                atari_gtia_w(0x0e, RDPMGFXD(5*256));
1209                atari_gtia_w(0x0f, RDPMGFXD(6*256));
1210                atari_gtia_w(0x10, RDPMGFXD(7*256));
1207                atari_gtia_w(machine, 0x0d, RDPMGFXD(4*256));
1208                atari_gtia_w(machine, 0x0e, RDPMGFXD(5*256));
1209                atari_gtia_w(machine, 0x0f, RDPMGFXD(6*256));
1210                atari_gtia_w(machine, 0x10, RDPMGFXD(7*256));
12111211            }
12121212        }
12131213        else
r1877r1878
12171217            {
12181218            if( (antic.scanline & 1) == 0 )     /* even line ? */
12191219               antic.steal_cycles += 1;
1220                atari_gtia_w(0x11, RDPMGFXS(3*128));
1220                atari_gtia_w(machine, 0x11, RDPMGFXS(3*128));
12211221            }
12221222            /* transport player data to GTIA ? */
12231223            if( antic.w.dmactl & DMA_PLAYER )
12241224            {
12251225            if( (antic.scanline & 1) == 0 )     /* even line ? */
12261226               antic.steal_cycles += 4;
1227                atari_gtia_w(0x0d, RDPMGFXS(4*128));
1228                atari_gtia_w(0x0e, RDPMGFXS(5*128));
1229                atari_gtia_w(0x0f, RDPMGFXS(6*128));
1230                atari_gtia_w(0x10, RDPMGFXS(7*128));
1227                atari_gtia_w(machine, 0x0d, RDPMGFXS(4*128));
1228                atari_gtia_w(machine, 0x0e, RDPMGFXS(5*128));
1229                atari_gtia_w(machine, 0x0f, RDPMGFXS(6*128));
1230                atari_gtia_w(machine, 0x10, RDPMGFXS(7*128));
12311231            }
12321232        }
12331233    }
src/mame/video/segas32.c
r1877r1878
206206
207207struct layer_info
208208{
209   mame_bitmap *   bitmap;
209   bitmap_t *   bitmap;
210210   UINT8 *               transparent;
211211};
212212
r1877r1878
568568WRITE32_HANDLER( multi32_videoram_w )
569569{
570570   if ((mem_mask & 0x0000ffff) != 0x0000ffff)
571      system32_videoram_w(offset*2+0, data, mem_mask);
571      system32_videoram_w(machine, offset*2+0, data, mem_mask);
572572   if ((mem_mask & 0xffff0000) != 0xffff0000)
573      system32_videoram_w(offset*2+1, data >> 16, mem_mask >> 16);
573      system32_videoram_w(machine, offset*2+1, data >> 16, mem_mask >> 16);
574574}
575575
576576
r1877r1878
648648
649649READ32_HANDLER( multi32_sprite_control_r )
650650{
651   return system32_sprite_control_r(offset*2+0, mem_mask) |
652         (system32_sprite_control_r(offset*2+1, mem_mask >> 16) << 16);
651   return system32_sprite_control_r(machine, offset*2+0, mem_mask) |
652         (system32_sprite_control_r(machine, offset*2+1, mem_mask >> 16) << 16);
653653}
654654
655655
656656WRITE32_HANDLER( multi32_sprite_control_w )
657657{
658658   if ((mem_mask & 0x0000ffff) != 0x0000ffff)
659      system32_sprite_control_w(offset*2+0, data, mem_mask);
659      system32_sprite_control_w(machine, offset*2+0, data, mem_mask);
660660   if ((mem_mask & 0xffff0000) != 0xffff0000)
661      system32_sprite_control_w(offset*2+1, data >> 16, mem_mask >> 16);
661      system32_sprite_control_w(machine, offset*2+1, data >> 16, mem_mask >> 16);
662662}
663663
664664
r1877r1878
943943static void update_tilemap_zoom(running_machine *machine, int scrnum, struct layer_info *layer, const rectangle *cliprect, int bgnum)
944944{
945945   int clipenable, clipout, clips, clipdraw_start;
946   mame_bitmap *bitmap = layer->bitmap;
946   bitmap_t *bitmap = layer->bitmap;
947947   struct extents_list clip_extents;
948948   tilemap *tilemaps[4];
949949   UINT32 srcx, srcx_start, srcy;
r1877r1878
10201020      /* optimize for the case where we are clipped out */
10211021      if (clipdraw || extents[1] <= cliprect->max_x)
10221022      {
1023         mame_bitmap *tm0, *tm1;
1023         bitmap_t *tm0, *tm1;
10241024         int transparent = 0;
10251025         UINT16 *src[2];
10261026
r1877r1878
10941094static void update_tilemap_rowscroll(running_machine *machine, int scrnum, struct layer_info *layer, const rectangle *cliprect, int bgnum)
10951095{
10961096   int clipenable, clipout, clips, clipdraw_start;
1097   mame_bitmap *bitmap = layer->bitmap;
1097   bitmap_t *bitmap = layer->bitmap;
10981098   struct extents_list clip_extents;
10991099   tilemap *tilemaps[4];
11001100   int rowscroll, rowselect;
r1877r1878
11451145      /* optimize for the case where we are clipped out */
11461146      if (clipdraw || extents[1] <= cliprect->max_x)
11471147      {
1148         mame_bitmap *tm0, *tm1;
1148         bitmap_t *tm0, *tm1;
11491149         int transparent = 0;
11501150         UINT16 *src[2];
11511151         int srcxstep;
r1877r1878
12431243
12441244static void update_tilemap_text(running_machine *machine, int scrnum, struct layer_info *layer, const rectangle *cliprect)
12451245{
1246   mame_bitmap *bitmap = layer->bitmap;
1246   bitmap_t *bitmap = layer->bitmap;
12471247   UINT16 *tilebase;
12481248   UINT16 *gfxbase;
12491249   int startx, starty;
r1877r1878
14011401static void update_bitmap(running_machine *machine, int scrnum, struct layer_info *layer, const rectangle *cliprect)
14021402{
14031403   int clipenable, clipout, clips, clipdraw_start;
1404   mame_bitmap *bitmap = layer->bitmap;
1404   bitmap_t *bitmap = layer->bitmap;
14051405   struct extents_list clip_extents;
14061406   int xscroll, yscroll;
14071407   int color;
r1877r1878
15031503
15041504static void update_background(struct layer_info *layer, const rectangle *cliprect)
15051505{
1506   mame_bitmap *bitmap = layer->bitmap;
1506   bitmap_t *bitmap = layer->bitmap;
15071507   int x, y;
15081508
15091509   for (y = cliprect->min_y; y <= cliprect->max_y; y++)
r1877r1878
16991699      { 0x1fff, 0x0fff, 0x07ff, 0x03ff }
17001700   };
17011701
1702   mame_bitmap *bitmap = layer_data[(!is_multi32 || !(data[3] & 0x0800)) ? MIXER_LAYER_SPRITES_2 : MIXER_LAYER_MULTISPR_2].bitmap;
1702   bitmap_t *bitmap = layer_data[(!is_multi32 || !(data[3] & 0x0800)) ? MIXER_LAYER_SPRITES_2 : MIXER_LAYER_MULTISPR_2].bitmap;
17031703   UINT8 numbanks = memory_region_length(REGION_GFX2) / 0x400000;
17041704   const UINT32 *spritebase = (const UINT32 *)memory_region(REGION_GFX2);
17051705
r1877r1878
20282028   return BITMAP_ADDR16(layer_data[layer].bitmap, scanline, 0);
20292029}
20302030
2031static void mix_all_layers(int which, int xoffs, mame_bitmap *bitmap, const rectangle *cliprect, UINT8 enablemask)
2031static void mix_all_layers(int which, int xoffs, bitmap_t *bitmap, const rectangle *cliprect, UINT8 enablemask)
20322032{
20332033   int blendenable = mixer_control[which][0x4e/2] & 0x0800;
20342034   int blendfactor = (mixer_control[which][0x4e/2] >> 8) & 7;
src/mame/video/badlands.c
r1877r1878
118118VIDEO_UPDATE( badlands )
119119{
120120   struct atarimo_rect_list rectlist;
121   mame_bitmap *mobitmap;
121   bitmap_t *mobitmap;
122122   int x, y, r;
123123
124124   /* draw the playfield */
src/mame/video/slapfght.c
r1877r1878
150150  Render the Sprites
151151
152152***************************************************************************/
153static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority_to_display )
153static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority_to_display )
154154{
155155   int offs;
156156
src/mame/video/psikyosh.c
r1877r1878
9595#include "psikyosh.h"
9696
9797/* Needed for psikyosh_drawgfxzoom */
98static mame_bitmap *zoom_bitmap, *z_bitmap;
98static bitmap_t *zoom_bitmap, *z_bitmap;
9999
100100/* Psikyo PS6406B */
101101/* --- BACKGROUNDS --- */
102102
103103/* 'Normal' layers, no line/columnscroll. No per-line effects */
104static void draw_bglayer(running_machine *machine, int layer, mame_bitmap *bitmap, const rectangle *cliprect )
104static void draw_bglayer(running_machine *machine, int layer, bitmap_t *bitmap, const rectangle *cliprect )
105105{
106106   gfx_element *gfx;
107107   int offs=0, sx, sy;
r1877r1878
167167
168168/* This is a complete bodge for the daraku text layers. There is not enough info to be sure how it is supposed to work */
169169/* It appears that there are row/column scroll values for 2 seperate layers, just drawing it twice using one of each of the sets of values for now */
170static void draw_bglayertext(running_machine *machine, int layer, mame_bitmap *bitmap, const rectangle *cliprect )
170static void draw_bglayertext(running_machine *machine, int layer, bitmap_t *bitmap, const rectangle *cliprect )
171171{
172172   gfx_element *gfx;
173173   int offs, sx, sy;
r1877r1878
257257
258258/* Row Scroll and/or Column Scroll/Zoom, has per-column Alpha/Bank/Priority. This isn't correct, just testing */
259259/* For now I'm just using the first alpha/bank/priority values and sodding the rest of it */
260static void draw_bglayerscroll(running_machine *machine, int layer, mame_bitmap *bitmap, const rectangle *cliprect )
260static void draw_bglayerscroll(running_machine *machine, int layer, bitmap_t *bitmap, const rectangle *cliprect )
261261{
262262   gfx_element *gfx;
263263   int offs, sx, sy;
r1877r1878
335335}
336336
337337/* 3 BG layers, with priority */
338static void draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT8 req_pri )
338static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8 req_pri )
339339{
340340   int i;
341341
r1877r1878
393393/* sx and sy is top-left of entire sprite regardless of flip */
394394/* Note that Level 5-4 of sbomberb boss is perfect! (Alpha blended zoomed) as well as S1945II logo */
395395/* pixel is only plotted if z is >= priority_buffer[y][x] */
396static void psikyosh_drawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
396static void psikyosh_drawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx,
397397      UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy,
398398      const rectangle *clip,int transparency,int transparent_color,
399399      int zoomx, int zoomy, int wide, int high, UINT32 z)
r1877r1878
930930
931931#define SPRITE_PRI(n) (((psikyosh_vidregs[2] << (4*n)) & 0xf0000000 ) >> 28)
932932
933static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT8 req_pri )
933static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8 req_pri )
934934{
935935   /*- Sprite Format 0x0000 - 0x37ff -**
936936
r1877r1878
10731073
10741074}
10751075
1076static void psikyosh_prelineblend( mame_bitmap *bitmap, const rectangle *cliprect )
1076static void psikyosh_prelineblend( bitmap_t *bitmap, const rectangle *cliprect )
10771077{
10781078   /* There are 224 values for pre-lineblending. Using one for every row currently */
10791079   /* I suspect that it should be blended against black by the amount specified as
r1877r1878
10971097   profiler_mark(PROFILER_END);
10981098}
10991099
1100static void psikyosh_postlineblend( mame_bitmap *bitmap, const rectangle *cliprect )
1100static void psikyosh_postlineblend( bitmap_t *bitmap, const rectangle *cliprect )
11011101{
11021102   /* There are 224 values for post-lineblending. Using one for every row currently */
11031103   UINT32 *dstline;
r1877r1878
11431143
11441144VIDEO_EOF( psikyosh )
11451145{
1146   buffer_spriteram32_w(0,0,0);
1146   buffer_spriteram32_w(machine,0,0,0);
11471147}
11481148
11491149/*popmessage   ("Regs %08x %08x %08x\n     %08x %08x %08x",
src/mame/video/quizdna.c
r1877r1878
136136   palette_set_color_rgb(Machine,offs/2,pal5bit(r),pal5bit(g),pal5bit(b));
137137}
138138
139static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
139static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
140140{
141141   int offs;
142142
src/mame/video/kan_pand.c
r1877r1878
5050
5151static UINT8* pandora_spriteram;
5252static UINT8 pandora_region;
53static mame_bitmap *pandora_sprites_bitmap; /* bitmap to render sprites to, Pandora seems to be frame'buffered' */
53static bitmap_t *pandora_sprites_bitmap; /* bitmap to render sprites to, Pandora seems to be frame'buffered' */
5454static int pandora_clear_bitmap;
5555static int pandora_xoffset, pandora_yoffset;
5656
r1877r1878
5959   pandora_clear_bitmap = clear;
6060}
6161
62void pandora_update(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
62void pandora_update(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
6363{
6464   if (!pandora_sprites_bitmap)
6565   {
r1877r1878
7171}
7272
7373
74static void pandora_draw(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
74static void pandora_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
7575{
7676
7777   int sx=0, sy=0, x=0, y=0, offs;
src/mame/video/boogwing.c
r1877r1878
11#include "driver.h"
2#include "deprecat.h"
32#include "deco16ic.h"
43
5static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect, UINT16* spriteram_base, int gfx_region)
4static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect, UINT16* spriteram_base, int gfx_region)
65{
76   int offs;
87   int flipscreen=!flip_screen_get();
r1877r1878
1716
1817      y = spriteram_base[offs];
1918      flash=y&0x1000;
20      if (flash && (cpu_getcurrentframe() & 1)) continue;
19      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
2120
2221      x = spriteram_base[offs+2];
2322      colour = (x >>9) & 0x1f;
src/mame/video/offtwall.c
r1877r1878
9090VIDEO_UPDATE( offtwall )
9191{
9292   struct atarimo_rect_list rectlist;
93   mame_bitmap *mobitmap;
93   bitmap_t *mobitmap;
9494   int x, y, r;
9595
9696   /* draw the playfield */
src/mame/video/equites.c
r1877r1878
278278      colortable_entry_set_value(machine->colortable, i, c);
279279}
280280
281static void equites_draw_scroll(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
281static void equites_draw_scroll(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
282282{
283283#define TILE_BANKBASE 1
284284
r1877r1878
326326#undef TILE_BANKBASE
327327}
328328
329static void equites_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
329static void equites_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
330330{
331331#define SPRITE_BANKBASE 3
332332#define SHIFTX -4
r1877r1878
402402   }
403403}
404404
405static void splndrbt_draw_scroll(running_machine *machine, mame_bitmap *bitmap)
405static void splndrbt_draw_scroll(running_machine *machine, bitmap_t *bitmap)
406406{
407407#define TILE_BANKBASE 1
408408
r1877r1878
436436}
437437
438438static void splndrbt_slantcopy(
439   mame_bitmap *src_bitmap,
440   mame_bitmap *dst_bitmap,
439   bitmap_t *src_bitmap,
440   bitmap_t *dst_bitmap,
441441   const rectangle *dst_clip,
442442   int src_x, int src_y,
443443   unsigned src_w, unsigned src_h,
r1877r1878
479479#undef WRAP
480480}
481481
482static void splndrbt_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *clip)
482static void splndrbt_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *clip)
483483{
484484#define SPRITE_BANKBASE 3
485485#define FP_ONE 0x10000
src/mame/video/kan_pand.h
r1877r1878
11/* kan_pand.h */
22
33void pandora_start(UINT8 region, int x, int y);
4void pandora_update(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect);
4void pandora_update(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
55void pandora_eof(running_machine *machine);
66void pandora_set_clear_bitmap(int clear);
77
src/mame/video/gradius3.c
r1877r1878
120120VIDEO_UPDATE( gradius3 )
121121{
122122   /* TODO: this kludge enforces the char banks. For some reason, they don't work otherwise. */
123   K052109_w(0x1d80,0x10);
124   K052109_w(0x1f00,0x32);
123   K052109_w(machine,0x1d80,0x10);
124   K052109_w(machine,0x1f00,0x32);
125125
126126   if (dirtygfx)
127127   {
src/mame/video/decocass.c
r1877r1878
149149    big object
150150 ********************************************/
151151
152static void draw_object(running_machine* machine, mame_bitmap *bitmap, const rectangle *cliprect)
152static void draw_object(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect)
153153{
154154   int sx, sy, color;
155155
r1877r1878
171171   drawgfx(bitmap, machine->gfx[3], 1, color, 0, 1, sx, sy - 64, cliprect, TRANSPARENCY_PEN, 0);
172172}
173173
174static void draw_center(mame_bitmap *bitmap, const rectangle *cliprect)
174static void draw_center(bitmap_t *bitmap, const rectangle *cliprect)
175175{
176176   int sx, sy, x, y, color;
177177
r1877r1878
408408    memory handlers
409409 ********************************************/
410410
411static void draw_sprites(running_machine* machine, mame_bitmap *bitmap, const rectangle *cliprect, int color,
411static void draw_sprites(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect, int color,
412412                  int sprite_y_adjust, int sprite_y_adjust_flip_screen,
413413                  UINT8 *sprite_ram, int interleave)
414414{
r1877r1878
459459}
460460
461461
462static void draw_missiles(mame_bitmap *bitmap, const rectangle *cliprect,
462static void draw_missiles(bitmap_t *bitmap, const rectangle *cliprect,
463463                  int missile_y_adjust, int missile_y_adjust_flip_screen,
464464                  UINT8 *missile_ram, int interleave)
465465{
r1877r1878
608608   int scrollx, scrolly_l, scrolly_r;
609609   rectangle clip;
610610
611   if (0xc0 != (input_port_2_r(0) & 0xc0))  /* coin slots assert an NMI */
611   if (0xc0 != (input_port_2_r(machine, 0) & 0xc0))  /* coin slots assert an NMI */
612612      cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, ASSERT_LINE);
613613
614614   if (0 == (watchdog_flip & 0x04))
615      watchdog_reset_w (0,0);
615      watchdog_reset_w (machine,0,0);
616616   else if (watchdog_count-- > 0)
617      watchdog_reset_w (0,0);
617      watchdog_reset_w (machine,0,0);
618618
619619#if TAPE_UI_DISPLAY
620620   if (tape_timer)
src/mame/video/fromance.c
r1877r1878
330330 *
331331 *************************************/
332332
333static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int draw_priority)
333static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int draw_priority)
334334{
335335   static const UINT8 zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 };
336336   int offs;
src/mame/video/skykid.c
r1877r1878
182182***************************************************************************/
183183
184184/* the sprite generator IC is the same as Mappy */
185static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
185static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
186186{
187187   int offs;
188188
src/mame/video/klax.c
r1877r1878
102102VIDEO_UPDATE( klax )
103103{
104104   struct atarimo_rect_list rectlist;
105   mame_bitmap *mobitmap;
105   bitmap_t *mobitmap;
106106   int x, y, r;
107107
108108   /* draw the playfield */
src/mame/video/gomoku.c
r1877r1878
1414static int gomoku_flipscreen;
1515static int gomoku_bg_dispsw;
1616static tilemap *fg_tilemap;
17static mame_bitmap *gomoku_bg_bitmap;
17static bitmap_t *gomoku_bg_bitmap;
1818
1919UINT8 *gomoku_videoram;
2020UINT8 *gomoku_colorram;
src/mame/video/djmain.c
r1877r1878
1212UINT32 *djmain_obj_ram;
1313
1414
15static void draw_sprites(running_machine* machine, mame_bitmap *bitmap, const rectangle *cliprect)
15static void draw_sprites(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect)
1616{
1717   int offs, pri_code;
1818   int sortedlist[NUM_SPRITES];
src/mame/video/firetrk.c
r1877r1878
77#include "driver.h"
88#include "firetrk.h"
99
10UINT8* firetrk_alpha_num_ram;
11UINT8* firetrk_playfield_ram;
1210
13int firetrk_skid[2];
14int firetrk_crash[2];
11UINT8 *firetrk_alpha_num_ram;
12UINT8 *firetrk_playfield_ram;
13UINT8 *firetrk_scroll_x;
14UINT8 *firetrk_scroll_y;
15UINT8 *firetrk_car_rot;
16UINT8 *firetrk_drone_rot;
17UINT8 *firetrk_drone_x;
18UINT8 *firetrk_drone_y;
19UINT8 *firetrk_blink;
20UINT8  firetrk_flash;
1521
16static mame_bitmap *helper1;
17static mame_bitmap *helper2;
22UINT8 firetrk_skid[2];
23UINT8 firetrk_crash[2];
1824
19static int blink;
20static int flash;
21static int drone_hpos;
22static int drone_vpos;
25static bitmap_t *helper1;
26static bitmap_t *helper2;
2327
24static const rectangle playfield_window = { 0x02A, 0x115, 0x000, 0x0FF };
28static UINT32 color1_mask;
29static UINT32 color2_mask;
2530
26struct sprite_data
27{
28   int layout;
29   int number;
30   int x;
31   int y;
32   int flipx;
33   int flipy;
34   int color;
35};
3631
37static struct sprite_data car[2];
32static const rectangle playfield_window = { 0x02a, 0x115, 0x000, 0x0ff };
3833
39static tilemap* tilemap1; /* for screen display */
40static tilemap* tilemap2; /* for collision detection */
34static tilemap *tilemap1; /* for screen display */
35static tilemap *tilemap2; /* for collision detection */
4136
4237
4338
44INLINE int arrow_code(int c)
39PALETTE_INIT( firetrk )
4540{
46   if (GAME_IS_FIRETRUCK)
41   int i;
42
43   static const UINT8 colortable_source[] =
4744   {
48      return (c & 0x3F) >= 0x4 && (c & 0x3F) <= 0xB;
49   }
50   if (GAME_IS_SUPERBUG)
45      0, 0, 1, 0,
46      2, 0, 3, 0,
47      3, 3, 2, 3,
48      1, 3, 0, 3,
49      0, 0, 1, 0,
50      2, 0, 0, 3,
51      3, 0, 0, 3
52   };
53   static const rgb_t palette_source[] =
5154   {
52      return (c & 0x3F) >= 0x8 && (c & 0x3F) <= 0xF;
53   }
55      RGB_BLACK,
56      MAKE_RGB(0x5b, 0x5b, 0x5b),
57      MAKE_RGB(0xa4, 0xa4, 0xa4),
58      RGB_WHITE
59   };
5460
55   return 0;
56}
61   color1_mask = color2_mask = 0;
5762
63   for (i = 0; i < ARRAY_LENGTH(colortable_source); i++)
64   {
65      UINT8 color = colortable_source[i];
5866
59void firetrk_set_flash(int flag)
60{
61   tilemap_mark_all_tiles_dirty(tilemap1);
67      if (color == 1)
68         color1_mask |= 1 << i;
69      else if (color == 2)
70         color2_mask |= 1 << i;
6271
63   if (GAME_IS_FIRETRUCK || GAME_IS_SUPERBUG)
64   {
65      if (flag)
66      {
67         car[0].color = 1;
68         car[1].color = 1;
69      }
70      else
71      {
72         car[0].color = 0;
73         car[1].color = 0;
74      }
72      palette_set_color(machine, i, palette_source[color]);
7573   }
74}
7675
77   flash = flag;
76
77static void prom_to_palette(running_machine *machine, int number, UINT8 val)
78{
79   palette_set_color(machine, number, MAKE_RGB(pal1bit(val >> 2), pal1bit(val >> 1), pal1bit(val >> 0)));
7880}
7981
8082
81void firetrk_set_blink(int flag)
83PALETTE_INIT( montecar )
8284{
83   int offset;
85   int i;
8486
85   for (offset = 0; offset < 0x100; offset++)
87   static const UINT8 colortable_source[] =
8688   {
87      if (arrow_code(firetrk_playfield_ram[offset]))
88      {
89         tilemap_mark_tile_dirty(tilemap1, offset);
90      }
91   }
89      0x00, 0x00, 0x00, 0x01,
90      0x00, 0x02, 0x00, 0x03,
91      0x03, 0x03, 0x03, 0x02,
92      0x03, 0x01, 0x03, 0x00,
93      0x00, 0x00, 0x02, 0x00,
94      0x02, 0x01, 0x02, 0x02,
95      0x00, 0x10, 0x20, 0x30,
96      0x00, 0x04, 0x08, 0x0c,
97      0x00, 0x44, 0x48, 0x4c,
98      0x00, 0x84, 0x88, 0x8c,
99      0x00, 0xc4, 0xc8, 0xcc
100   };
92101
93   blink = flag;
94}
102   /*
103     * The color PROM is addressed as follows:
104     *
105     *   A0 => PLAYFIELD 1
106     *   A1 => PLAYFIELD 2
107     *   A2 => DRONE 1
108     *   A3 => DRONE 2
109     *   A4 => CAR 1
110     *   A5 => CAR 2
111     *   A6 => DRONE COLOR 1
112     *   A7 => DRONE COLOR 2
113     *   A8 => PLAYFIELD WINDOW
114     *
115     * This driver hard-codes some behavior which actually depends
116     * on the PROM, like priorities, clipping and transparency.
117     *
118     */
95119
120   color1_mask = color2_mask = 0;
96121
97static TILE_GET_INFO( get_tile_info1 )
98{
99   UINT8 code = firetrk_playfield_ram[tile_index];
122   for (i = 0; i < ARRAY_LENGTH(colortable_source); i++)
123   {
124      UINT8 color = colortable_source[i];
100125
101   int color = code >> 6;
126      if (color == 1)
127         color1_mask |= 1 << i;
128      else if (color == 2)
129         color2_mask |= 1 << i;
102130
103   if (blink && arrow_code(code))
104   {
105      color = 0;
131      prom_to_palette(machine, i, color_prom[0x100 + colortable_source[i]]);
106132   }
107   if (flash)
108   {
109      color |= 4;
110   }
111133
112   SET_TILE_INFO(1, code & 0x3f, color, 0);
134   palette_set_color(machine, ARRAY_LENGTH(colortable_source) + 0, RGB_BLACK);
135   palette_set_color(machine, ARRAY_LENGTH(colortable_source) + 1, RGB_WHITE);
113136}
114137
115138
116static TILE_GET_INFO( get_tile_info2 )
139static TILE_GET_INFO( firetrk_get_tile_info1 )
117140{
118   UINT8 code = firetrk_playfield_ram[tile_index];
141   int code = firetrk_playfield_ram[tile_index] & 0x3f;
142   int color = (firetrk_playfield_ram[tile_index] >> 6) & 0x03;
119143
120   int color = 0;
144   if (*firetrk_blink && (code >= 0x04) && (code <= 0x0b))
145      color = 0;
121146
122   /* palette 1 for crash and palette 2 for skid */
147   if (firetrk_flash)
148      color = color | 0x04;
123149
124   if (GAME_IS_FIRETRUCK)
125   {
126      if ((code & 0x30) != 0x00 || (code & 0x0c) == 0x00)
127      {
128         color = 1;   /* palette 0, 1 */
129      }
130      if ((code & 0x3c) == 0x0c)
131      {
132         color = 2;   /* palette 0, 2 */
133      }
134   }
150   SET_TILE_INFO(1, code, color, 0);
151}
135152
136   if (GAME_IS_SUPERBUG)
137   {
138      if ((code & 0x30) != 0x00)
139      {
140         color = 1;   /* palette 0, 1 */
141      }
142      if ((code & 0x38) == 0x00)
143      {
144         color = 2;   /* palette 0, 2 */
145      }
146   }
147153
148   if (GAME_IS_MONTECARLO)
149   {
150      if ((code & 0xc0) == 0x40 || (code & 0xc0) == 0x80)
151      {
152         color = 2;   /* palette 2, 1 */
153      }
154      if ((code & 0xc0) == 0xc0)
155      {
156         color = 1;   /* palette 2, 0 */
157      }
158      if ((code & 0xc0) == 0x00)
159      {
160         color = 3;   /* palette 2, 2 */
161      }
162      if ((code & 0x30) == 0x30)
163      {
164         color = 0;   /* palette 0, 0 */
165      }
166   }
154static TILE_GET_INFO( superbug_get_tile_info1 )
155{
156   int code = firetrk_playfield_ram[tile_index] & 0x3f;
157   int color = (firetrk_playfield_ram[tile_index] >> 6) & 0x03;
167158
168   SET_TILE_INFO(2, code & 0x3f, color, 0);
169}
159   if (*firetrk_blink && (code >= 0x08) && (code <= 0x0f))
160      color = 0;
170161
162   if (firetrk_flash)
163      color = color | 0x04;
171164
172WRITE8_HANDLER( firetrk_vert_w )
173{
174   tilemap_set_scrolly(tilemap1, 0, data);
175   tilemap_set_scrolly(tilemap2, 0, data);
165   SET_TILE_INFO(1, code, color, 0);
176166}
177167
178168
179WRITE8_HANDLER( firetrk_horz_w )
169static TILE_GET_INFO( montecar_get_tile_info1 )
180170{
181   tilemap_set_scrollx(tilemap1, 0, data - 37);
182   tilemap_set_scrollx(tilemap2, 0, data - 37);
183}
171   int code = firetrk_playfield_ram[tile_index] & 0x3f;
172   int color = (firetrk_playfield_ram[tile_index] >> 6) & 0x03;
184173
174   if (firetrk_flash)
175      color = color | 0x04;
185176
186WRITE8_HANDLER( firetrk_drone_hpos_w )
187{
188   drone_hpos = data;
177   SET_TILE_INFO(1, code, color, 0);
189178}
190179
191180
192WRITE8_HANDLER( firetrk_drone_vpos_w )
181static TILE_GET_INFO( firetrk_get_tile_info2 )
193182{
194   drone_vpos = data;
183   UINT8 code = firetrk_playfield_ram[tile_index] & 0x3f;
184   int color = 0;
185
186   /* palette 1 for crash and palette 2 for skid */
187   if (((code & 0x30) != 0x00) || ((code & 0x0c) == 0x00))
188      color = 1;   /* palette 0, 1 */
189
190   if ((code & 0x3c) == 0x0c)
191      color = 2;   /* palette 0, 2 */
192
193   SET_TILE_INFO(2, code, color, 0);
195194}
196195
197196
198WRITE8_HANDLER( firetrk_car_rot_w )
197static TILE_GET_INFO( superbug_get_tile_info2 )
199198{
200   if (GAME_IS_FIRETRUCK)
201   {
202      car[0].number = data & 0x03;
199   UINT8 code = firetrk_playfield_ram[tile_index] & 0x3f;
200   int color = 0;
203201
204      if (data & 0x10) /* swap xy */
205      {
206         car[0].layout = 4;
207      }
208      else
209      {
210         car[0].layout = 3;
211      }
202   /* palette 1 for crash and palette 2 for skid */
203   if ((code & 0x30) != 0x00)
204      color = 1;   /* palette 0, 1 */
212205
213      car[0].flipx = data & 0x04;
214      car[0].flipy = data & 0x08;
215   }
206   if ((code & 0x38) == 0x00)
207      color = 2;   /* palette 0, 2 */
216208
217   if (GAME_IS_SUPERBUG)
218   {
219      car[0].number = (data & 0x03) ^ 3;
209   SET_TILE_INFO(2, code, color, 0);
210}
220211
221      if (data & 0x10) /* swap xy */
222      {
223         car[0].layout = 4;
224      }
225      else
226      {
227         car[0].layout = 3;
228      }
229212
230      car[0].flipx = data & 0x04;
231      car[0].flipy = data & 0x08;
232   }
213static TILE_GET_INFO( montecar_get_tile_info2 )
214{
215   UINT8 code = firetrk_playfield_ram[tile_index];
216   int color = 0;
233217
234   if (GAME_IS_MONTECARLO)
235   {
236      car[0].number = data & 0x07;
218   /* palette 1 for crash and palette 2 for skid */
219   if (((code & 0xc0) == 0x40) || ((code & 0xc0) == 0x80))
220      color = 2;   /* palette 2, 1 */
237221
238      if (data & 0x80)
239      {
240         car[1].color |= 2;
241      }
242      else
243      {
244         car[1].color &= ~2;
245      }
222   if ((code & 0xc0) == 0xc0)
223      color = 1;   /* palette 2, 0 */
246224
247      car[0].flipx = data & 0x10;
248      car[0].flipy = data & 0x08;
249   }
225   if ((code & 0xc0) == 0x00)
226      color = 3;   /* palette 2, 2 */
227
228   if ((code & 0x30) == 0x30)
229      color = 0;   /* palette 0, 0 */
230
231   SET_TILE_INFO(2, code & 0x3f, color, 0);
250232}
251233
252234
253WRITE8_HANDLER( firetrk_drone_rot_w )
235VIDEO_START( firetrk )
254236{
255   car[1].number = data & 0x07;
237   helper1 = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format);
238   helper2 = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format);
256239
257   if (GAME_IS_FIRETRUCK)
258   {
259      car[1].flipx = data & 0x08;
260      car[1].flipy = data & 0x10;
261   }
262
263   if (GAME_IS_MONTECARLO)
264   {
265      car[1].flipx = data & 0x10;
266      car[1].flipy = data & 0x08;
267
268      if (data & 0x80)
269      {
270         car[1].color |= 1;
271      }
272      else
273      {
274         car[1].color &= ~1;
275      }
276   }
240   tilemap1 = tilemap_create(firetrk_get_tile_info1, tilemap_scan_rows, 16, 16, 16, 16);
241   tilemap2 = tilemap_create(firetrk_get_tile_info2, tilemap_scan_rows, 16, 16, 16, 16);
277242}
278243
279244
280WRITE8_HANDLER( firetrk_playfield_w )
245VIDEO_START( superbug )
281246{
282   firetrk_playfield_ram[offset] = data;
283   tilemap_mark_tile_dirty(tilemap1, offset);
284   tilemap_mark_tile_dirty(tilemap2, offset);
247   helper1 = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format);
248   helper2 = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format);
249
250   tilemap1 = tilemap_create(superbug_get_tile_info1, tilemap_scan_rows, 16, 16, 16, 16);
251   tilemap2 = tilemap_create(superbug_get_tile_info2, tilemap_scan_rows, 16, 16, 16, 16);
285252}
286253
287254
288VIDEO_START( firetrk )
255VIDEO_START( montecar )
289256{
290257   helper1 = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format);
291258   helper2 = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format);
292259
293   tilemap1 = tilemap_create(get_tile_info1, tilemap_scan_rows,  16, 16, 16, 16);
294   tilemap2 = tilemap_create(get_tile_info2, tilemap_scan_rows,  16, 16, 16, 16);
260   tilemap1 = tilemap_create(montecar_get_tile_info1, tilemap_scan_rows, 16, 16, 16, 16);
261   tilemap2 = tilemap_create(montecar_get_tile_info2, tilemap_scan_rows, 16, 16, 16, 16);
262}
295263
296   memset(&car[0], 0, sizeof (struct sprite_data));
297   memset(&car[1], 0, sizeof (struct sprite_data));
298264
299   if (GAME_IS_FIRETRUCK)
265static void firetrk_draw_car(gfx_element **gfx, bitmap_t *bitmap, const rectangle *cliprect, int which, int flash)
266{
267   int gfx_bank, code, color, flip_x, flip_y, x, y;
268
269   if (which)
300270   {
301      car[0].layout = 3;
302      car[1].layout = 5;
271      gfx_bank = 5;
272      code = *firetrk_drone_rot & 0x07;
273      color = flash ? 1 : 0;
274      flip_x = *firetrk_drone_rot & 0x08;
275      flip_y = *firetrk_drone_rot & 0x10;
276      x = (flip_x ? *firetrk_drone_x - 63 : 192 - *firetrk_drone_x) + 36;
277      y =  flip_y ? *firetrk_drone_y - 63 : 192 - *firetrk_drone_y;
303278   }
304   if (GAME_IS_SUPERBUG)
279   else
305280   {
306      car[0].layout = 3;
307      car[1].layout = 0;
281      gfx_bank = (*firetrk_car_rot & 0x10) ? 4 : 3;
282      code = *firetrk_car_rot & 0x03;
283      color = flash ? 1 : 0;
284      flip_x = *firetrk_car_rot & 0x04;
285      flip_y = *firetrk_car_rot & 0x08;
286      x = 144;
287      y = 104;
308288   }
309   if (GAME_IS_MONTECARLO)
310   {
311      car[0].layout = 3;
312      car[1].layout = 4;
313   }
289
290   drawgfx(bitmap, gfx[gfx_bank], code, color, flip_x, flip_y, x, y, cliprect, TRANSPARENCY_PEN, 0);
314291}
315292
316293
317static void calc_car_positions(void)
294static void superbug_draw_car(gfx_element **gfx, bitmap_t *bitmap, const rectangle *cliprect, int flash)
318295{
319   car[0].x = 144;
320   car[0].y = 104;
296   int gfx_bank = (*firetrk_car_rot & 0x10) ? 4 : 3;
297   int code = ~*firetrk_car_rot & 0x03;
298   int color = flash ? 1 : 0;
299   int flip_x = *firetrk_car_rot & 0x04;
300   int flip_y = *firetrk_car_rot & 0x08;
321301
322   if (GAME_IS_FIRETRUCK)
323   {
324      car[1].x = car[1].flipx ? drone_hpos - 63 : 192 - drone_hpos;
325      car[1].y = car[1].flipy ? drone_vpos - 63 : 192 - drone_vpos;
302   drawgfx(bitmap, gfx[gfx_bank], code, color, flip_x, flip_y, 144, 104, cliprect, TRANSPARENCY_PEN, 0);
303}
326304
327      car[1].x += 36;
328   }
329305
330   if (GAME_IS_MONTECARLO)
331   {
332      car[1].x = car[1].flipx ? drone_hpos - 31 : 224 - drone_hpos;
333      car[1].y = car[1].flipy ? drone_vpos - 31 : 224 - drone_vpos;
306static void montecar_draw_car(gfx_element **gfx, bitmap_t *bitmap, const rectangle *cliprect, int which, int is_collision_detection)
307{
308   int gfx_bank, code, color, flip_x, flip_y, x, y;
334309
335      car[1].x += 34;
310   if (which)
311   {
312      gfx_bank = 4;
313      code = *firetrk_drone_rot & 0x07;
314      color = is_collision_detection ? 0 : (((*firetrk_car_rot & 0x80) >> 6) | ((*firetrk_drone_rot & 0x80) >> 7));
315      flip_x = *firetrk_drone_rot & 0x10;
316      flip_y = *firetrk_drone_rot & 0x08;
317      x = (flip_x ? *firetrk_drone_x - 31 : 224 - *firetrk_drone_x) + 34;
318      y =  flip_y ? *firetrk_drone_y - 31 : 224 - *firetrk_drone_y;
336319   }
320   else
321   {
322      gfx_bank = 3;
323      code = *firetrk_car_rot & 0x07;
324      color = 0;
325      flip_x = *firetrk_car_rot & 0x10;
326      flip_y = *firetrk_car_rot & 0x08;
327      x = 144;
328      y = 104;
329   }
330
331   drawgfx(bitmap, gfx[gfx_bank], code, color, flip_x, flip_y, x, y, cliprect, TRANSPARENCY_PEN, 0);
337332}
338333
339334
340static void draw_text(running_machine *machine, mame_bitmap* bitmap, const rectangle* cliprect)
335static void draw_text(gfx_element **gfx, bitmap_t *bitmap, const rectangle *cliprect, UINT8 *alpha_ram,
336                 int x, int count, int height)
341337{
342   const UINT8* p = firetrk_alpha_num_ram;
343
344338   int i;
345339
346   for (i = 0; i < 2; i++)
347   {
348      int x = 0;
349      int y = 0;
340   for (i = 0; i < count; i++)
341      drawgfx(bitmap, gfx[0], alpha_ram[i], 0, 0, 0, x, i * height, cliprect, TRANSPARENCY_NONE, 0);
342}
350343
351      if (GAME_IS_SUPERBUG || GAME_IS_FIRETRUCK)
352      {
353         x = (i == 0) ? 296 : 8;
354      }
355      if (GAME_IS_MONTECARLO)
356      {
357         x = (i == 0) ? 24 : 16;
358      }
359344
360      for (y = 0; y < 256; y += machine->gfx[0]->width)
345static void check_collision(int which)
346{
347   int y, x;
348
349   for (y = playfield_window.min_y; y <= playfield_window.max_y; y++)
350      for (x = playfield_window.min_x; x <= playfield_window.max_x; x++)
361351      {
362         drawgfx(bitmap, machine->gfx[0], *p++, 0, 0, 0,
363            x, y, cliprect, TRANSPARENCY_NONE, 0);
352         pen_t a = *BITMAP_ADDR16(helper1, y, x);
353         pen_t b = *BITMAP_ADDR16(helper2, y, x);
354
355         if (b != 0xff && (color1_mask >> a) & 1)
356            firetrk_crash[which] = 1;
357
358         if (b != 0xff && (color2_mask >> a) & 1)
359            firetrk_skid[which] = 1;
364360      }
365   }
366361}
367362
368363
369364VIDEO_UPDATE( firetrk )
370365{
371   int i;
366   tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
367   tilemap_set_scrollx(tilemap1, 0, *firetrk_scroll_x - 37);
368   tilemap_set_scrollx(tilemap2, 0, *firetrk_scroll_x - 37);
369   tilemap_set_scrolly(tilemap1, 0, *firetrk_scroll_y);
370   tilemap_set_scrolly(tilemap2, 0, *firetrk_scroll_y);
372371
372   fillbitmap(bitmap, 0, cliprect);
373373   tilemap_draw(bitmap, &playfield_window, tilemap1, 0, 0);
374   firetrk_draw_car(machine->gfx, bitmap, &playfield_window, 0, firetrk_flash);
375   firetrk_draw_car(machine->gfx, bitmap, &playfield_window, 1, firetrk_flash);
376   draw_text(machine->gfx, bitmap, cliprect, firetrk_alpha_num_ram + 0x00, 296, 0x10, 0x10);
377   draw_text(machine->gfx, bitmap, cliprect, firetrk_alpha_num_ram + 0x10,   8, 0x10, 0x10);
374378
375   calc_car_positions();
376
377   for (i = 1; i >= 0; i--)
379   if (cliprect->max_y == machine->screen[screen].visarea.max_y)
378380   {
379      if (GAME_IS_SUPERBUG && i == 1)
380      {
381         continue;
382      }
381      tilemap_draw(helper1, &playfield_window, tilemap2, 0, 0);
383382
384      drawgfx(bitmap,
385         machine->gfx[car[i].layout],
386         car[i].number,
387         car[i].color,
388         car[i].flipx,
389         car[i].flipy,
390         car[i].x,
391         car[i].y,
392         &playfield_window,
393         TRANSPARENCY_PEN, 0);
383      fillbitmap(helper2, 0xff, &playfield_window);
384      firetrk_draw_car(machine->gfx, helper2, &playfield_window, 0, FALSE);
385      check_collision(0);
386
387      fillbitmap(helper2, 0xff, &playfield_window);
388      firetrk_draw_car(machine->gfx, helper2, &playfield_window, 1, FALSE);
389      check_collision(1);
390
391      *firetrk_blink = FALSE;
394392   }
395393
396   draw_text(machine, bitmap, cliprect);
397394   return 0;
398395}
399396
400397
401VIDEO_EOF( firetrk )
398VIDEO_UPDATE( superbug )
402399{
403   int i;
400   tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
401   tilemap_set_scrollx(tilemap1, 0, *firetrk_scroll_x - 37);
402   tilemap_set_scrollx(tilemap2, 0, *firetrk_scroll_x - 37);
403   tilemap_set_scrolly(tilemap1, 0, *firetrk_scroll_y);
404   tilemap_set_scrolly(tilemap2, 0, *firetrk_scroll_y);
404405
405   tilemap_draw(helper1, &playfield_window, tilemap2, 0, 0);
406   fillbitmap(bitmap, 0, cliprect);
407   tilemap_draw(bitmap, &playfield_window, tilemap1, 0, 0);
408   superbug_draw_car(machine->gfx, bitmap, &playfield_window, firetrk_flash);
409   draw_text(machine->gfx, bitmap, cliprect, firetrk_alpha_num_ram + 0x00, 296, 0x10, 0x10);
410   draw_text(machine->gfx, bitmap, cliprect, firetrk_alpha_num_ram + 0x10,   8, 0x10, 0x10);
406411
407   calc_car_positions();
408
409   for (i = 1; i >= 0; i--)
412   if (cliprect->max_y == machine->screen[screen].visarea.max_y)
410413   {
411      int width = machine->gfx[car[i].layout]->width;
412      int height = machine->gfx[car[i].layout]->height;
414      tilemap_draw(helper1, &playfield_window, tilemap2, 0, 0);
413415
414      int x;
415      int y;
416      fillbitmap(helper2, 0xff, &playfield_window);
417      superbug_draw_car(machine->gfx, helper2, &playfield_window, FALSE);
418      check_collision(0);
416419
417      if (GAME_IS_SUPERBUG && i == 1)
418      {
419         continue;
420      }
420      *firetrk_blink = FALSE;
421   }
421422
422      fillbitmap(helper2, 0xff, NULL);
423      drawgfx(helper2,
424         machine->gfx[car[i].layout],
425         car[i].number,
426         0,
427         car[i].flipx,
428         car[i].flipy,
429         car[i].x,
430         car[i].y,
431         &playfield_window,
432         TRANSPARENCY_PEN, 0);
423   return 0;
424}
433425
434      for (y = car[i].y; y < car[i].y + height; y++)
435      {
436         for (x = car[i].x; x < car[i].x + width; x++)
437         {
438            pen_t a;
439            pen_t b;
440426
441            if (x < playfield_window.min_x)
442               continue;
443            if (x > playfield_window.max_x)
444               continue;
445            if (y < playfield_window.min_y)
446               continue;
447            if (y > playfield_window.max_y)
448               continue;
427VIDEO_UPDATE( montecar )
428{
429   tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
430   tilemap_set_scrollx(tilemap1, 0, *firetrk_scroll_x - 37);
431   tilemap_set_scrollx(tilemap2, 0, *firetrk_scroll_x - 37);
432   tilemap_set_scrolly(tilemap1, 0, *firetrk_scroll_y);
433   tilemap_set_scrolly(tilemap2, 0, *firetrk_scroll_y);
449434
450            a = *BITMAP_ADDR16(helper1, y, x);
451            b = *BITMAP_ADDR16(helper2, y, x);
435   fillbitmap(bitmap, 0x2c, cliprect);
436   tilemap_draw(bitmap, &playfield_window, tilemap1, 0, 0);
437   montecar_draw_car(machine->gfx, bitmap, &playfield_window, 0, FALSE);
438   montecar_draw_car(machine->gfx, bitmap, &playfield_window, 1, FALSE);
439   draw_text(machine->gfx, bitmap, cliprect, firetrk_alpha_num_ram + 0x00, 24, 0x20, 0x08);
440   draw_text(machine->gfx, bitmap, cliprect, firetrk_alpha_num_ram + 0x20, 16, 0x20, 0x08);
452441
453            if (b != 0xff && (firetrk_color1_mask >> a) & 1)
454            {
455               firetrk_crash[i] = 1;
456            }
457            if (b != 0xff && (firetrk_color2_mask >> a) & 1)
458            {
459               firetrk_skid[i] = 1;
460            }
461         }
462      }
463   }
464
465   if (blink)
442   if (cliprect->max_y == machine->screen[screen].visarea.max_y)
466443   {
467      firetrk_set_blink(0);
444      tilemap_draw(helper1, &playfield_window, tilemap2, 0, 0);
445
446      fillbitmap(helper2, 0xff, &playfield_window);
447      montecar_draw_car(machine->gfx, helper2, &playfield_window, 0, TRUE);
448      check_collision(0);
449
450      fillbitmap(helper2, 0xff, &playfield_window);
451      montecar_draw_car(machine->gfx, helper2, &playfield_window, 1, TRUE);
452      check_collision(1);
468453   }
454
455   return 0;
469456}
src/mame/video/m57.c
r1877r1878
172172 *
173173 *************************************/
174174
175static void draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
175static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
176176{
177177   int y;
178178
r1877r1878
187187 *
188188 *************************************/
189189
190static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
190static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
191191{
192192   int offs;
193193
src/mame/video/mustache.c
r1877r1878
9494   tilemap_set_scroll_rows(bg_tilemap, 4);
9595}
9696
97static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
97static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
9898{
9999   rectangle clip = *cliprect;
100100   const gfx_element *gfx = machine->gfx[1];
src/mame/video/neogeo.c
r1877r1878
280280}
281281
282282
283static void draw_fixed_layer(mame_bitmap *bitmap, int scanline)
283static void draw_fixed_layer(bitmap_t *bitmap, int scanline)
284284{
285285   int x;
286286
r1877r1878
809809
810810   /* accessing the LSB only is not mapped */
811811   if (mem_mask == 0xff00)
812      ret = neogeo_unmapped_r(0, 0) & 0x00ff;
812      ret = neogeo_unmapped_r(machine, 0, 0) & 0x00ff;
813813   else
814814   {
815815      switch (offset)
src/mame/video/konamigx.c
r1877r1878
420420   g = (paletteram32[offset] >> 8) & 0xff;
421421   b = (paletteram32[offset] >> 0) & 0xff;
422422
423   palette_set_color(Machine,offset,MAKE_RGB(r,g,b));
423   palette_set_color(machine,offset,MAKE_RGB(r,g,b));
424424}
425425
426426WRITE32_HANDLER( konamigx_palette2_w )
r1877r1878
437437   g = (paletteram32[offset] >> 8) & 0xff;
438438   b = (paletteram32[offset] >> 0) & 0xff;
439439
440   palette_set_color(Machine,offset,MAKE_RGB(r,g,b));
440   palette_set_color(machine,offset,MAKE_RGB(r,g,b));
441441}
442442
443443// main monitor for type 3
r1877r1878
447447
448448   paletteram16 = (UINT16 *)paletteram32;
449449   if (ACCESSING_MSW32)
450      paletteram16_xRRRRRGGGGGBBBBB_word_w(offset*2, data >> 16, mem_mask >> 16);
450      paletteram16_xRRRRRGGGGGBBBBB_word_w(machine, offset*2, data >> 16, mem_mask >> 16);
451451   if (ACCESSING_LSW32)
452      paletteram16_xRRRRRGGGGGBBBBB_word_w(offset*2+1, data, mem_mask);
452      paletteram16_xRRRRRGGGGGBBBBB_word_w(machine, offset*2+1, data, mem_mask);
453453}
454454
455455// sub monitor for type 3
r1877r1878
463463
464464   paletteram16 = (UINT16 *)paletteram32;
465465   if (ACCESSING_MSW32)
466      paletteram16_xRRRRRGGGGGBBBBB_word_w(offset*2, data >> 16, mem_mask >> 16);
466      paletteram16_xRRRRRGGGGGBBBBB_word_w(machine, offset*2, data >> 16, mem_mask >> 16);
467467   if (ACCESSING_LSW32)
468      paletteram16_xRRRRRGGGGGBBBBB_word_w(offset*2+1, data, mem_mask);
468      paletteram16_xRRRRRGGGGGBBBBB_word_w(machine, offset*2+1, data, mem_mask);
469469}
470470
471471WRITE32_HANDLER( konamigx_tilebank_w )
src/mame/video/sprcros2.c
r1877r1878
137137   colortable_configure_tilemap_groups(machine->colortable, sprcros2_fgtilemap, machine->gfx[2], 0);
138138}
139139
140static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
140static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
141141{
142142   int offs,sx,sy,color,flipx,flipy;
143143
src/mame/video/thunderj.c
r1877r1878
129129 *
130130 *************************************/
131131
132void thunderj_mark_high_palette(mame_bitmap *bitmap, UINT16 *pf, UINT16 *mo, int x, int y)
132void thunderj_mark_high_palette(bitmap_t *bitmap, UINT16 *pf, UINT16 *mo, int x, int y)
133133{
134134   #define START_MARKER   ((4 << ATARIMO_PRIORITY_SHIFT) | 2)
135135   #define END_MARKER      ((4 << ATARIMO_PRIORITY_SHIFT) | 4)
r1877r1878
155155VIDEO_UPDATE( thunderj )
156156{
157157   struct atarimo_rect_list rectlist;
158   mame_bitmap *mobitmap;
158   bitmap_t *mobitmap;
159159   int x, y, r;
160160
161161   /* draw the playfield */
src/mame/video/ladybug.c
r1877r1878
1717void redclash_set_stars_enable( UINT8 on );
1818void redclash_update_stars_state(void);
1919void redclash_set_stars_speed( UINT8 speed );
20void redclash_draw_stars(mame_bitmap *bitmap, const rectangle *cliprect, UINT8 palette_offset, UINT8 sraider, UINT8 firstx, UINT8 lastx);
20void redclash_draw_stars(bitmap_t *bitmap, const rectangle *cliprect, UINT8 palette_offset, UINT8 sraider, UINT8 firstx, UINT8 lastx);
2121
2222static tilemap *bg_tilemap;
2323static tilemap *grid_tilemap;
r1877r1878
307307   tilemap_set_transparent_pen(bg_tilemap, 0);
308308}
309309
310static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
310static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
311311{
312312   int offs;
313313
src/mame/video/combatsc.c
r1877r1878
340340
341341static WRITE8_HANDLER( combascb_sh_irqtrigger_w )
342342{
343   soundlatch_w(offset,data);
344   cpunum_set_input_line_and_vector(Machine, 1,0,HOLD_LINE,0xff);
343   soundlatch_w(machine,offset,data);
344   cpunum_set_input_line_and_vector(machine, 1,0,HOLD_LINE,0xff);
345345}
346346
347347static READ8_HANDLER( combascb_io_r )
r1877r1878
440440   memset( combasc_page[1], 0x00, 0x2000 );
441441
442442   combasc_bank_select = -1;
443   combasc_bankselect_w( 0,0 );
443   combasc_bankselect_w( machine,0,0 );
444444}
445445
446446WRITE8_HANDLER( combasc_pf_control_w )
r1877r1878
477477
478478***************************************************************************/
479479
480static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, const UINT8 *source,int circuit,UINT32 pri_mask)
480static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT8 *source,int circuit,UINT32 pri_mask)
481481{
482482   int base_color = (circuit*4)*16+(K007121_ctrlram[circuit][6]&0x10)*2;
483483
r1877r1878
600600
601601***************************************************************************/
602602
603static void bootleg_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, const UINT8 *source, int circuit )
603static void bootleg_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT8 *source, int circuit )
604604{
605605   const gfx_element *gfx = machine->gfx[circuit+2];
606606
src/mame/video/blueprnt.c
r1877r1878
8585   tilemap_set_scroll_cols(bg_tilemap, 32);
8686}
8787
88static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
88static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
8989{
9090   int offs;
9191
src/mame/video/ppu2c0x.c
r1877r1878
6565/* our chip state */
6666typedef struct {
6767   running_machine       *machine;            /* execution context */
68   mame_bitmap            *bitmap;            /* target bitmap */
68   bitmap_t            *bitmap;            /* target bitmap */
6969   UINT8               *videoram;            /* video ram */
7070   UINT8               *spriteram;            /* sprite ram */
7171   pen_t               *colortable;         /* color table modified at run time */
r1877r1878
385385static void draw_background(const int num, UINT8 *line_priority )
386386{
387387   /* cache some values locally */
388   mame_bitmap *bitmap = chips[num].bitmap;
388   bitmap_t *bitmap = chips[num].bitmap;
389389   const int *ppu_regs = &chips[num].regs[0];
390390   const int scanline = chips[num].scanline;
391391   const int refresh_data = chips[num].refresh_data;
r1877r1878
524524static void draw_sprites(const int num, UINT8 *line_priority )
525525{
526526   /* cache some values locally */
527   mame_bitmap *bitmap = chips[num].bitmap;
527   bitmap_t *bitmap = chips[num].bitmap;
528528   const int scanline = chips[num].scanline;
529529   const int gfx_bank = intf->gfx_layout_number[num];
530530   const int total_elements = chips[num].machine->gfx[gfx_bank]->total_elements;
r1877r1878
726726      draw_background(num, line_priority );
727727   else
728728   {
729      mame_bitmap *bitmap = chips[num].bitmap;
729      bitmap_t *bitmap = chips[num].bitmap;
730730      const int scanline = chips[num].scanline;
731731      UINT8 color_mask;
732732      UINT16 back_pen;
r1877r1878
777777      }
778778      else
779779      {
780         mame_bitmap *bitmap = this_ppu->bitmap;
780         bitmap_t *bitmap = this_ppu->bitmap;
781781         const int scanline = this_ppu->scanline;
782782         UINT8 color_mask;
783783         UINT16 back_pen;
r1877r1878
13351335 *  PPU Rendering
13361336 *
13371337 *************************************/
1338void ppu2c0x_render( int num, mame_bitmap *bitmap, int flipx, int flipy, int sx, int sy )
1338void ppu2c0x_render( int num, bitmap_t *bitmap, int flipx, int flipy, int sx, int sy )
13391339{
13401340   /* check bounds */
13411341   if ( num >= intf->num )
src/mame/video/buggychl.c
r1877r1878
99
1010static int *dirtychar;
1111
12static mame_bitmap *tmpbitmap1,*tmpbitmap2;
12static bitmap_t *tmpbitmap1,*tmpbitmap2;
1313static int sl_bank,bg_on,sky_on,sprite_color_base,bg_scrollx;
1414
1515
r1877r1878
8989
9090
9191
92static void draw_sky(mame_bitmap *bitmap, const rectangle *cliprect)
92static void draw_sky(bitmap_t *bitmap, const rectangle *cliprect)
9393{
9494   int x,y;
9595
r1877r1878
9999}
100100
101101
102static void draw_bg(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
102static void draw_bg(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
103103{
104104   int offs;
105105   int scroll[256];
r1877r1878
136136}
137137
138138
139static void draw_fg(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
139static void draw_fg(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
140140{
141141   int offs;
142142
r1877r1878
163163}
164164
165165
166static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
166static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
167167{
168168   int offs;
169169
src/mame/video/gotcha.c
r1877r1878
9696
9797
9898
99static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
99static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
100100{
101101   int offs;
102102
src/mame/video/starshp1.c
r1877r1878
3333
3434static UINT16 *LSFR;
3535
36static mame_bitmap *helper;
36static bitmap_t *helper;
3737
3838static tilemap *bg_tilemap;
3939
r1877r1878
169169}
170170
171171
172static void draw_starfield(mame_bitmap* bitmap)
172static void draw_starfield(bitmap_t* bitmap)
173173{
174174   /*
175175     * The LSFR is reset once per frame at the position of
r1877r1878
203203}
204204
205205
206static void draw_sprites(running_machine *machine, mame_bitmap* bitmap, const rectangle* cliprect)
206static void draw_sprites(running_machine *machine, bitmap_t* bitmap, const rectangle* cliprect)
207207{
208208   int i;
209209
r1877r1878
222222}
223223
224224
225static void draw_spaceship(running_machine *machine, mame_bitmap* bitmap, const rectangle* cliprect)
225static void draw_spaceship(running_machine *machine, bitmap_t* bitmap, const rectangle* cliprect)
226226{
227227   double scaler = -5 * log(1 - starshp1_ship_size / 256.0); /* ? */
228228
r1877r1878
248248}
249249
250250
251static void draw_phasor(mame_bitmap* bitmap)
251static void draw_phasor(bitmap_t* bitmap)
252252{
253253   int i;
254254
r1877r1878
277277}
278278
279279
280static void draw_circle_line(mame_bitmap *bitmap, int x, int y, int l)
280static void draw_circle_line(bitmap_t *bitmap, int x, int y, int l)
281281{
282282   if (y >= 0 && y <= bitmap->height - 1)
283283   {
r1877r1878
305305}
306306
307307
308static void draw_circle(mame_bitmap* bitmap)
308static void draw_circle(bitmap_t* bitmap)
309309{
310310   int cx = get_circle_hpos();
311311   int cy = get_circle_vpos();
r1877r1878
334334}
335335
336336
337static int spaceship_collision(mame_bitmap *bitmap, rectangle *rect)
337static int spaceship_collision(bitmap_t *bitmap, rectangle *rect)
338338{
339339   int x;
340340   int y;
src/mame/video/ppu2c0x.h
r1877r1878
103103void ppu2c0x_reset( int num, int scan_scale );
104104void ppu2c0x_set_videorom_bank( int num, int start_page, int num_pages, int bank, int bank_size );
105105void ppu2c0x_spriteram_dma(int num, const UINT8 page );
106void ppu2c0x_render( int num, mame_bitmap *bitmap, int flipx, int flipy, int sx, int sy );
106void ppu2c0x_render( int num, bitmap_t *bitmap, int flipx, int flipy, int sx, int sy );
107107int ppu2c0x_get_pixel( int num, int x, int y );
108108int ppu2c0x_get_colorbase( int num );
109109int ppu2c0x_get_current_scanline( int num );
src/mame/video/pandoras.c
r1877r1878
145145
146146***************************************************************************/
147147
148static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT8* sr)
148static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8* sr)
149149{
150150   int offs;
151151
src/mame/video/bigstrkb.c
r1877r1878
1010
1111/* Sprites */
1212
13static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
13static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
1414{
1515   /*- SPR RAM Format -**
1616
src/mame/video/taito_f2.c
r1877r1878
369369   spritebank_buffered[7] = spritebank_buffered[6] + 0x400;
370370}
371371
372static void taito_f2_tc360_spritemixdraw( mame_bitmap *dest_bmp,const gfx_element *gfx,
372static void taito_f2_tc360_spritemixdraw( bitmap_t *dest_bmp,const gfx_element *gfx,
373373      UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
374374      const rectangle *clip,int scalex, int scaley)
375375{
r1877r1878
517517   }
518518}
519519
520static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int *primasks,int uses_tc360_mixer)
520static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int *primasks,int uses_tc360_mixer)
521521{
522522   /*
523523        Sprite format:
r1877r1878
11241124
11251125
11261126
1127static void draw_roz_layer(mame_bitmap *bitmap,const rectangle *cliprect,UINT32 priority)
1127static void draw_roz_layer(bitmap_t *bitmap,const rectangle *cliprect,UINT32 priority)
11281128{
11291129   if (has_TC0280GRD())
11301130      TC0280GRD_zoom_draw(bitmap,cliprect,f2_pivot_xdisp,f2_pivot_ydisp,priority);
src/mame/video/gberet.c
r1877r1878
131131   tilemap_set_scroll_rows(bg_tilemap, 32);
132132}
133133
134static void gberet_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
134static void gberet_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
135135{
136136   int offs;
137137   UINT8 *sr;
r1877r1878
190190      tilemap_set_scrollx(bg_tilemap, offset, scroll + 64-8);
191191}
192192
193static void gberetb_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
193static void gberetb_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
194194{
195195   int offs;
196196
src/mame/video/stfight.c
r1877r1878
245245
246246***************************************************************************/
247247
248static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
248static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
249249{
250250   int offs,sx,sy;
251251
src/mame/video/gottlieb.c
r1877r1878
175175   gottlieb_video_start_common();
176176}
177177
178static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
178static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
179179{
180180    int offs;
181181
src/mame/video/ddragon.c
r1877r1878
161161               (which+order),color,flipx,flipy,sx,sy, \
162162               cliprect,TRANSPARENCY_PEN,0);
163163
164static void draw_sprites(running_machine* machine, mame_bitmap *bitmap,const rectangle *cliprect)
164static void draw_sprites(running_machine* machine, bitmap_t *bitmap,const rectangle *cliprect)
165165{
166166   const gfx_element *gfx = machine->gfx[1];
167167
src/mame/video/homedata.c
r1877r1878
4949
5050***************************************************************************/
5151
52static void mrokumei_handleblit( int rom_base )
52static void mrokumei_handleblit( running_machine *machine, int rom_base )
5353{
5454   int i;
5555   int DestParam;
r1877r1878
117117         } /* i!=0 */
118118
119119         if (data)   /* 00 is a nop */
120            mrokumei_videoram_w( BaseAddr + DestAddr, data );
120            mrokumei_videoram_w( machine, BaseAddr + DestAddr, data );
121121
122122         if (homedata_vreg[1] & 0x80)   /* flip screen */
123123         {
r1877r1878
136136   cpunum_set_input_line(Machine, 0,M6809_FIRQ_LINE,HOLD_LINE);
137137}
138138
139static void reikaids_handleblit( int rom_base )
139static void reikaids_handleblit( running_machine *machine, int rom_base )
140140{
141141   int i;
142142   UINT16 DestParam;
r1877r1878
221221                  addr ^= 0x007c;
222222               }
223223
224               reikaids_videoram_w( addr, dat );
224               reikaids_videoram_w( machine, addr, dat );
225225            }
226226         }
227227
r1877r1878
236236   cpunum_set_input_line(Machine, 0,M6809_FIRQ_LINE,HOLD_LINE);
237237}
238238
239static void pteacher_handleblit( int rom_base )
239static void pteacher_handleblit( running_machine *machine, int rom_base )
240240{
241241   int i;
242242   int DestParam;
r1877r1878
309309            if ((addr & 0x2080) == 0)
310310            {
311311               addr = ((addr & 0xc000) >> 2) | ((addr & 0x1f00) >> 1) | (addr & 0x7f);
312               pteacher_videoram_w( addr, data );
312               pteacher_videoram_w( machine, addr, data );
313313            }
314314         }
315315
r1877r1878
651651
652652WRITE8_HANDLER( mrokumei_blitter_start_w )
653653{
654   if (data & 0x80) mrokumei_handleblit(((blitter_bank & 0x04) >> 2) * 0x10000);
654   if (data & 0x80) mrokumei_handleblit(machine, ((blitter_bank & 0x04) >> 2) * 0x10000);
655655
656656   /* bit 0 = bank switch; used by hourouki to access the
657657       optional service mode ROM (not available in current dump) */
r1877r1878
659659
660660WRITE8_HANDLER( reikaids_blitter_start_w )
661661{
662   reikaids_handleblit((blitter_bank & 3) * 0x10000);
662   reikaids_handleblit(machine, (blitter_bank & 3) * 0x10000);
663663}
664664
665665WRITE8_HANDLER( pteacher_blitter_start_w )
666666{
667   pteacher_handleblit((blitter_bank >> 5) * 0x10000 & (memory_region_length(REGION_USER1) - 1));
667   pteacher_handleblit(machine, (blitter_bank >> 5) * 0x10000 & (memory_region_length(REGION_USER1) - 1));
668668}
669669
670670
src/mame/video/exidy.c
r1877r1878
2424static int is_2bpp;
2525static UINT8 int_condition;
2626
27static mame_bitmap *background_bitmap;
28static mame_bitmap *motion_object_1_vid;
29static mame_bitmap *motion_object_2_vid;
30static mame_bitmap *motion_object_2_clip;
27static bitmap_t *background_bitmap;
28static bitmap_t *motion_object_1_vid;
29static bitmap_t *motion_object_2_vid;
30static bitmap_t *motion_object_2_clip;
3131
3232
3333
r1877r1878
229229}
230230
231231
232static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
232static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
233233{
234234   /* draw sprite 2 first */
235235   int sprite_set_2 = ((*exidy_sprite_enable & 0x40) != 0);
src/mame/video/xxmissio.c
r1877r1878
5252
5353WRITE8_HANDLER( xxmissio_paletteram_w )
5454{
55   paletteram_BBGGRRII_w(offset,data);
55   paletteram_BBGGRRII_w(machine,offset,data);
5656}
5757
5858/****************************************************************************/
r1877r1878
8686}
8787
8888
89static void draw_sprites(mame_bitmap *bitmap, gfx_element **gfx, const rectangle *cliprect)
89static void draw_sprites(bitmap_t *bitmap, gfx_element **gfx, const rectangle *cliprect)
9090{
9191   int offs;
9292   int chr,col;
src/mame/video/mugsmash.c
r1877r1878
77extern UINT16 *mugsmash_videoram1, *mugsmash_videoram2, *mugs_spriteram;
88extern UINT16 *mugsmash_regs1, *mugsmash_regs2;
99
10static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
10static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
1111{
1212
1313   /* Each Sprite takes 16 bytes, 5 used? */
src/mame/video/pcktgal.c
r1877r1878
5959       8, 8, 32, 32);
6060}
6161
62static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
62static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
6363{
6464   int offs;
6565
src/mame/video/hyhoo.c
r1877r1878
2121static int hyhoo_highcolorflag;
2222static int hyhoo_flipscreen;
2323
24static mame_bitmap *hyhoo_tmpbitmap;
24static bitmap_t *hyhoo_tmpbitmap;
2525static void hyhoo_gfxdraw(void);
2626
2727
r1877r1878
3030   switch (offset)
3131   {
3232      case 0x00:   blitter_src_addr = (blitter_src_addr & 0xff00) | data;
33               nb1413m3_gfxradr_l_w(0, data); break;
33               nb1413m3_gfxradr_l_w(machine, 0, data); break;
3434      case 0x01:   blitter_src_addr = (blitter_src_addr & 0x00ff) | (data << 8);
35               nb1413m3_gfxradr_h_w(0, data); break;
35               nb1413m3_gfxradr_h_w(machine, 0, data); break;
3636      case 0x02:   blitter_destx = data; break;
3737      case 0x03:   blitter_desty = data; break;
3838      case 0x04:   blitter_sizex = data; break;
r1877r1878
5454{
5555   hyhoo_gfxrom = (((data & 0xc0) >> 4) + (data & 0x03));
5656   hyhoo_highcolorflag = data;
57   nb1413m3_gfxrombank_w(0, data);
57   nb1413m3_gfxrombank_w(machine, 0, data);
5858
5959   if ((0x20000 * hyhoo_gfxrom) > (memory_region_length(REGION_GFX1) - 1))
6060   {
src/mame/video/hng64.c
r1877r1878
3333static void SetIdentity(float *matrix) ;
3434
3535
36//static void plot(INT32 x, INT32 y, INT32 color, mame_bitmap *bitmap) ;
37//static void drawline2d(INT32 x0, INT32 y0, INT32 x1, INT32 y1, INT32 color, mame_bitmap *bitmap) ;
36//static void plot(INT32 x, INT32 y, INT32 color, bitmap_t *bitmap) ;
37//static void drawline2d(INT32 x0, INT32 y0, INT32 x1, INT32 y1, INT32 color, bitmap_t *bitmap) ;
3838
3939static float *depthBuffer ;
4040static struct polygon *polys ;
r1877r1878
7474/* xxxx---- | I think this part of UINT32 2 is interesting as more than just a list end marker (AJG)
7575 */
7676
77static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
77static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
7878{
7979   const gfx_element *gfx;
8080   UINT32 *source = hng64_spriteram;
r1877r1878
225225 *  Or maybe it switches from fading by scaling to fading using absolute addition and subtraction...
226226 *  Or maybe they set transition type (there seems to be a cute scaling-squares transition in there somewhere)...
227227 */
228static void transition_control(running_machine *machine, mame_bitmap *bitmap)
228static void transition_control(running_machine *machine, bitmap_t *bitmap)
229229{
230230   int i, j ;
231231
r1877r1878
356356
357357static void PerformFrustumClip(struct polygon *p) ;
358358
359//static void DrawWireframe(struct polygon *p, mame_bitmap *bitmap) ;
360static void DrawShaded(running_machine *machine, struct polygon *p, mame_bitmap *bitmap) ;
359//static void DrawWireframe(struct polygon *p, bitmap_t *bitmap) ;
360static void DrawShaded(running_machine *machine, struct polygon *p, bitmap_t *bitmap) ;
361361
362362
363static void draw3d(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
363static void draw3d(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
364364{
365365   int i,j,k,l,m ;
366366
r1877r1878
979979looks like the zoom center can move too..
980980not sure how these features are enabled up yet */
981981
982static int gatherPixelsForLine(mame_bitmap *tilemapBitmap,
982static int gatherPixelsForLine(bitmap_t *tilemapBitmap,
983983                        INT32 startX, INT32 startY, INT32 endX, INT32 endY,
984984                        UINT16 *penList)
985985{
r1877r1878
10471047}
10481048
10491049static void plotTilemap3Line(running_machine *machine,
1050                      mame_bitmap *tilemapBitmap,
1050                      bitmap_t *tilemapBitmap,
10511051                      INT32 startX, INT32 startY, INT32 endX, INT32 endY,
1052                      INT32 screenY, mame_bitmap *bitmap)
1052                      INT32 screenY, bitmap_t *bitmap)
10531053{
10541054   int i ;
10551055
r1877r1878
10881088   }
10891089}
10901090
1091static void hng64_drawtilemap3(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
1091static void hng64_drawtilemap3(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
10921092{
10931093   int i ;
10941094
1095   mame_bitmap *srcbitmap = tilemap_get_pixmap( hng64_tilemap3 );
1095   bitmap_t *srcbitmap = tilemap_get_pixmap( hng64_tilemap3 );
10961096
10971097//  usrintf_showmessage("%d", hng64_hackTm3Count) ;
10981098
r1877r1878
11461146//          0,0);
11471147}
11481148
1149static void hng64_drawtilemap2( mame_bitmap *bitmap, const rectangle *cliprect )
1149static void hng64_drawtilemap2( bitmap_t *bitmap, const rectangle *cliprect )
11501150{
11511151   int scrollbase,xscroll,yscroll,xzoom,yzoom;
11521152
r1877r1878
11751175         0,0);
11761176}
11771177
1178static void hng64_drawtilemap1( mame_bitmap *bitmap, const rectangle *cliprect )
1178static void hng64_drawtilemap1( bitmap_t *bitmap, const rectangle *cliprect )
11791179{
11801180   int scrollbase,xscroll,yscroll,xzoom,yzoom;
11811181
r1877r1878
14351435
14361436   case HNG64_NEAR:
14371437      return (v->clipCoords[2] <=  v->clipCoords[3]) ? 1 : 0;
1438      return 1 ;
1438
14391439   case HNG64_FAR:
14401440      return (v->clipCoords[2] >= -v->clipCoords[3]) ? 1 : 0;
1441      return 1 ;
1441
14421442   }
14431443
14441444   return 0 ;
r1877r1878
15691569/////////////////////////
15701570
15711571#ifdef UNUSED_FUNCTION
1572static void plot(INT32 x, INT32 y, INT32 color, mame_bitmap *bitmap)
1572static void plot(INT32 x, INT32 y, INT32 color, bitmap_t *bitmap)
15731573{
15741574   *BITMAP_ADDR32(bitmap, y, x) = MAKE_ARGB((UINT8)255, (UINT8)color, (UINT8)color, (UINT8)color) ;
15751575}
15761576
15771577// Stolen from http://en.wikipedia.org/wiki/Bresenham's_line_algorithm (no copyright denoted) - the non-optimized version
1578static void drawline2d(INT32 x0, INT32 y0, INT32 x1, INT32 y1, INT32 color, mame_bitmap *bitmap)
1578static void drawline2d(INT32 x0, INT32 y0, INT32 x1, INT32 y1, INT32 color, bitmap_t *bitmap)
15791579{
15801580#define SWAP(a,b) tmpswap = a; a = b; b = tmpswap;
15811581
r1877r1878
16321632}
16331633
16341634
1635static void DrawWireframe(struct polygon *p, mame_bitmap *bitmap)
1635static void DrawWireframe(struct polygon *p, bitmap_t *bitmap)
16361636{
16371637   int j;
16381638   for (j = 0; j < p->n; j++)
r1877r1878
16591659// polygon rendering //
16601660///////////////////////
16611661
1662static void RasterizeTriangle_SMOOTH_TEX_PC(running_machine *machine, mame_bitmap *Color,
1662static void RasterizeTriangle_SMOOTH_TEX_PC(running_machine *machine, bitmap_t *Color,
16631663                                     float A[4], float B[4], float C[4],
16641664                                     float Ca[3], float Cb[3], float Cc[3], // PER-VERTEX RGB COLORS
16651665                                     float Ta[2], float Tb[2], float Tc[2], // PER-VERTEX (S,T) TEX-COORDS
16661666                                     int Wrapping, int Filtering, int Function) ;
16671667
1668static void DrawShaded(running_machine *machine, struct polygon *p, mame_bitmap *bitmap)
1668static void DrawShaded(running_machine *machine, struct polygon *p, bitmap_t *bitmap)
16691669{
16701670   // The perspective-correct texture divide...
16711671   // !!! There is a very good chance the HNG64 hardware does not do perspective-correct texture-mapping !!!
r1877r1878
17011701/**                                                                 **/
17021702/**     Output: none                                                **/
17031703/*********************************************************************/
1704INLINE void FillSmoothTexPCHorizontalLine(running_machine *machine, mame_bitmap *Color,
1704INLINE void FillSmoothTexPCHorizontalLine(running_machine *machine, bitmap_t *Color,
17051705                 int Wrapping, int Filtering, int Function,
17061706                 int x_start, int x_end, int y, float z_start, float z_delta,
17071707                 float w_start, float w_delta, float r_start, float r_delta,
r1877r1878
17921792//   nearest and bilinear filtering: Filtering={0,1}
17931793//   replace and modulate application modes: Function={0,1}
17941794//---------------------------------------------------------------------------
1795static void RasterizeTriangle_SMOOTH_TEX_PC(running_machine *machine, mame_bitmap *Color,
1795static void RasterizeTriangle_SMOOTH_TEX_PC(running_machine *machine, bitmap_t *Color,
17961796                                     float A[4], float B[4], float C[4],
17971797                                     float Ca[3], float Cb[3], float Cc[3], // PER-VERTEX RGB COLORS
17981798                                     float Ta[2], float Tb[2], float Tc[2], // PER-VERTEX (S,T) TEX-COORDS
src/mame/video/solomon.c
r1877r1878
6868   tilemap_set_transparent_pen(fg_tilemap, 0);
6969}
7070
71static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
71static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
7272{
7373   int offs;
7474
src/mame/video/macrossp.c
r1877r1878
173173
174174
175175
176static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority )
176static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority )
177177{
178178   const gfx_element *gfx = machine->gfx[0];
179179//  UINT32 *source = macrossp_spriteram;
r1877r1878
299299}
300300
301301
302static void draw_layer(mame_bitmap *bitmap, const rectangle *cliprect, int layer)
302static void draw_layer(bitmap_t *bitmap, const rectangle *cliprect, int layer)
303303{
304304   tilemap *tm;
305305   UINT32 *vr;
src/mame/video/gladiatr.c
r1877r1878
199199
200200***************************************************************************/
201201
202static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
202static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
203203{
204204   int offs;
205205
r1877r1878
257257
258258   /* the fg layer just selects the upper palette bank on underlying pixels */
259259   {
260      mame_bitmap *flagsbitmap;
260      bitmap_t *flagsbitmap;
261261      int sx = cliprect->min_x;
262262      int sy = cliprect->min_y;
263263
src/mame/video/goindol.c
r1877r1878
9191
9292***************************************************************************/
9393
94static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int gfxbank, UINT8 *sprite_ram)
94static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int gfxbank, UINT8 *sprite_ram)
9595{
9696   int offs,sx,sy,tile,palette;
9797
src/mame/video/taito_l.c
r1877r1878
254254                 plgirs2 bullets and raimais big bosses.
255255*/
256256
257static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
257static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
258258{
259259   int offs;
260260
src/mame/video/groundfx.c
r1877r1878
8181
8282***************************************************************/
8383
84static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int do_hack,int x_offs,int y_offs)
84static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int do_hack,int x_offs,int y_offs)
8585{
8686   UINT16 *spritemap = (UINT16 *)memory_region(REGION_USER1);
8787   int offs, data, tilenum, color, flipx, flipy;
r1877r1878
261261        it's contents the usual way.
262262
263263    */
264   if (TC0100SCN_long_r(0x4090/4,0) || TC0480SCP_long_r(0x20/4,0)==0x240866) { /* Anything in text layer - really stupid hack */
264   if (TC0100SCN_long_r(machine,0x4090/4,0) || TC0480SCP_long_r(machine,0x20/4,0)==0x240866) { /* Anything in text layer - really stupid hack */
265265      TC0480SCP_tilemap_draw(bitmap,cliprect,layer[1],0,2);
266266      TC0480SCP_tilemap_draw(bitmap,cliprect,layer[2],0,4);
267267      TC0480SCP_tilemap_draw(bitmap,cliprect,layer[3],0,8);
268268//      TC0100SCN_tilemap_draw(machine,bitmap,cliprect,0,pivlayer[2],0,0);
269      if (TC0480SCP_long_r(0x20/4,0)!=0x240866) /* Stupid hack for start of race */
269      if (TC0480SCP_long_r(machine,0x20/4,0)!=0x240866) /* Stupid hack for start of race */
270270         TC0480SCP_tilemap_draw(bitmap,&hack_cliprect,layer[0],0,0);
271271      draw_sprites(machine,bitmap,cliprect,1,44,-574);
272272   } else {
src/mame/video/gyruss.c
r1877r1878
77***************************************************************************/
88
99#include "driver.h"
10#include "deprecat.h"
1110#include "video/resnet.h"
1211
1312
14static UINT8 flipscreen;
13UINT8 *gyruss_videoram;
14UINT8 *gyruss_colorram;
15UINT8 *gyruss_spriteram;
16UINT8 *gyruss_flipscreen;
1517
16/*
17sprites are multiplexed, so we have to buffer the spriteram
18scanline by scanline.
19*/
20static UINT8 *sprite_mux_buffer;
21static UINT32 scanline;
18static tilemap *gyruss_tilemap;
2219
2320
2421/***************************************************************************
r1877r1878
3936  bit 0 -- 1  kohm resistor  -- RED
4037
4138***************************************************************************/
39
4240PALETTE_INIT( gyruss )
4341{
4442   static const int resistances_rg[3] = { 1000, 470, 220 };
4543   static const int resistances_b [2] = { 470, 220 };
46   double rweights[3], gweights[3], bweights[2];
44   double weights_rg[3], weights_b[2];
4745   int i;
4846
4947   /* compute the color output resistor weights */
5048   compute_resistor_weights(0,   255, -1.0,
51         3, &resistances_rg[0], rweights, 470, 0,
52         3, &resistances_rg[0], gweights, 470, 0,
53         2, &resistances_b[0],  bweights, 470, 0);
49         3, resistances_rg, weights_rg, 470, 0,
50         2, resistances_b,  weights_b,  470, 0,
51         0, 0, 0, 0, 0);
5452
5553   /* allocate the colortable */
5654   machine->colortable = colortable_alloc(machine, 32);
r1877r1878
6563      bit0 = (color_prom[i] >> 0) & 0x01;
6664      bit1 = (color_prom[i] >> 1) & 0x01;
6765      bit2 = (color_prom[i] >> 2) & 0x01;
68      r = combine_3_weights(rweights, bit0, bit1, bit2);
66      r = combine_3_weights(weights_rg, bit0, bit1, bit2);
6967
7068      /* green component */
7169      bit0 = (color_prom[i] >> 3) & 0x01;
7270      bit1 = (color_prom[i] >> 4) & 0x01;
7371      bit2 = (color_prom[i] >> 5) & 0x01;
74      g = combine_3_weights(gweights, bit0, bit1, bit2);
72      g = combine_3_weights(weights_rg, bit0, bit1, bit2);
7573
7674      /* blue component */
7775      bit0 = (color_prom[i] >> 6) & 0x01;
7876      bit1 = (color_prom[i] >> 7) & 0x01;
79      b = combine_2_weights(bweights, bit0, bit1);
77      b = combine_2_weights(weights_b, bit0, bit1);
8078
8179      colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
8280   }
r1877r1878
10199
102100
103101
104VIDEO_START( gyruss )
102WRITE8_HANDLER( gyruss_spriteram_w )
105103{
106   sprite_mux_buffer = auto_malloc(256 * spriteram_size);
107
108   state_save_register_global(flipscreen);
109   state_save_register_global(scanline);
110   state_save_register_global_pointer(sprite_mux_buffer,256*spriteram_size);
104   video_screen_update_now(0);
105   gyruss_spriteram[offset] = data;
111106}
112107
113108
109static TILE_GET_INFO( gyruss_get_tile_info )
110{
111   int code = ((gyruss_colorram[tile_index] & 0x20) << 3) | gyruss_videoram[tile_index];
112   int color = gyruss_colorram[tile_index] & 0x0f;
113   int flags = TILE_FLIPYX(gyruss_colorram[tile_index] >> 6);
114114
115WRITE8_HANDLER( gyruss_flipscreen_w )
115   tileinfo->group = (gyruss_colorram[tile_index] & 0x10) ? 0 : 1;
116
117   SET_TILE_INFO(2, code, color, flags);
118}
119
120
121VIDEO_START( gyruss )
116122{
117   flipscreen = data & 1;
123   gyruss_tilemap = tilemap_create(gyruss_get_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
124   tilemap_set_transmask(gyruss_tilemap, 0, 0x00, 0);   /* opaque */
125   tilemap_set_transmask(gyruss_tilemap, 1, 0x0f, 0);  /* transparent */
118126}
119127
120128
121129
122/* Return the current video scan line */
123130READ8_HANDLER( gyruss_scanline_r )
124131{
125   return scanline;
132   /* reads 1V - 128V */
133   return video_screen_get_vpos(0);
126134}
127135
128136
129
130static void draw_sprites(running_machine *machine, mame_bitmap *bitmap)
137static void draw_sprites(gfx_element **gfx, bitmap_t *bitmap, const rectangle *cliprect)
131138{
132   rectangle clip = machine->screen[0].visarea;
133139   int offs;
134   int line;
135140
136
137   for (line = 0;line < 256;line++)
141   for (offs = 0xbc; offs >= 0; offs -= 4)
138142   {
139      UINT8 *sr;
143      int x = gyruss_spriteram[offs];
144      int y = 241 - gyruss_spriteram[offs + 3];
140145
141      sr = sprite_mux_buffer + line * spriteram_size;
142      clip.min_y = clip.max_y = line;
146      int gfx_bank = gyruss_spriteram[offs + 1] & 0x01;
147      int code = ((gyruss_spriteram[offs + 2] & 0x20) << 2) | ( gyruss_spriteram[offs + 1] >> 1);
148      int color = gyruss_spriteram[offs + 2] & 0x0f;
149      int flip_x = ~gyruss_spriteram[offs + 2] & 0x40;
150      int flip_y =  gyruss_spriteram[offs + 2] & 0x80;
143151
144      for (offs = spriteram_size - 4;offs >= 0;offs -= 4)
145      {
146         int sx,sy;
147
148         sx = sr[offs];
149         sy = 241 - sr[offs + 3];
150         if (sy > line-16 && sy <= line)
151         {
152            drawgfx(bitmap,machine->gfx[sr[offs + 1] & 1],
153                  sr[offs + 1]/2 + 4*(sr[offs + 2] & 0x20),
154                  sr[offs + 2] & 0x0f,
155                  !(sr[offs + 2] & 0x40),sr[offs + 2] & 0x80,
156                  sx,sy,
157                  &clip,TRANSPARENCY_PEN,0);
158         }
159      }
152      drawgfx(bitmap, gfx[gfx_bank], code, color, flip_x, flip_y, x, y, cliprect, TRANSPARENCY_PEN, 0);
160153   }
161154}
162155
163156
164157VIDEO_UPDATE( gyruss )
165158{
166   int offs;
167
168
169   /* for every character in the Video RAM, check if it has been modified */
170   /* since last time and update it accordingly. */
171   for (offs = videoram_size - 1;offs >= 0;offs--)
159   if (cliprect->min_y == machine->screen[screen].visarea.min_y)
172160   {
173      int sx,sy,flipx,flipy;
174
175      sx = offs % 32;
176      sy = offs / 32;
177      flipx = colorram[offs] & 0x40;
178      flipy = colorram[offs] & 0x80;
179      if (flipscreen)
180      {
181         sx = 31 - sx;
182         sy = 31 - sy;
183         flipx = !flipx;
184         flipy = !flipy;
185      }
186
187      drawgfx(bitmap,machine->gfx[2],
188            videoram[offs] + 8 * (colorram[offs] & 0x20),
189            colorram[offs] & 0x0f,
190            flipx,flipy,
191            8*sx,8*sy,
192            cliprect,TRANSPARENCY_NONE,0);
161      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
162      tilemap_set_flip(ALL_TILEMAPS, (*gyruss_flipscreen & 0x01) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
193163   }
194164
165   tilemap_draw(bitmap, cliprect, gyruss_tilemap, TILEMAP_DRAW_OPAQUE, 0);
166   draw_sprites(machine->gfx, bitmap, cliprect);
167   tilemap_draw(bitmap, cliprect, gyruss_tilemap, 0, 0);
195168
196   draw_sprites(machine, bitmap);
197
198
199   /* redraw the characters which have priority over sprites */
200   for (offs = videoram_size - 1;offs >= 0;offs--)
201   {
202      int sx,sy,flipx,flipy;
203
204
205      sx = offs % 32;
206      sy = offs / 32;
207      flipx = colorram[offs] & 0x40;
208      flipy = colorram[offs] & 0x80;
209      if (flipscreen)
210      {
211         sx = 31 - sx;
212         sy = 31 - sy;
213         flipx = !flipx;
214         flipy = !flipy;
215      }
216
217      if ((colorram[offs] & 0x10) != 0)
218         drawgfx(bitmap,machine->gfx[2],
219               videoram[offs] + 8 * (colorram[offs] & 0x20),
220               colorram[offs] & 0x0f,
221               flipx,flipy,
222               8*sx,8*sy,
223               cliprect,TRANSPARENCY_NONE,0);
224   }
225169   return 0;
226170}
227
228
229INTERRUPT_GEN( gyruss_6809_interrupt )
230{
231   scanline = 255 - cpu_getiloops();
232
233   memcpy(sprite_mux_buffer + scanline * spriteram_size,spriteram,spriteram_size);
234
235   if (scanline == 255)
236      irq0_line_hold(machine, cpunum);
237}
src/mame/video/cabal.c
r1877r1878
9898
9999********************************************************************/
100100
101static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
101static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
102102{
103103   int offs,data0,data1,data2;
104104
src/mame/video/suprloco.c
r1877r1878
158158
159159
160160
161INLINE void draw_pixel(mame_bitmap *bitmap,const rectangle *cliprect,int x,int y,int color)
161INLINE void draw_pixel(bitmap_t *bitmap,const rectangle *cliprect,int x,int y,int color)
162162{
163163   if (flip_screen_get())
164164   {
r1877r1878
176176}
177177
178178
179static void draw_sprite(mame_bitmap *bitmap,const rectangle *cliprect,int spr_number)
179static void draw_sprite(bitmap_t *bitmap,const rectangle *cliprect,int spr_number)
180180{
181181   int sx,sy,col,row,height,src,adjy,dy;
182182   UINT8 *spr_reg;
r1877r1878
247247   }
248248}
249249
250static void draw_sprites(mame_bitmap *bitmap, const rectangle *cliprect)
250static void draw_sprites(bitmap_t *bitmap, const rectangle *cliprect)
251251{
252252   int spr_number;
253253   UINT8 *spr_reg;
src/mame/video/m92.c
r1877r1878
9393   /* Sprite buffer - the data written doesn't matter (confirmed by several games) */
9494   if (offset==4)
9595   {
96      buffer_spriteram16_w(0,0,0);
96         buffer_spriteram16_w(machine,0,0,0);
9797      m92_sprite_buffer_busy = 0;
9898
9999      /* Pixel clock is 26.6666 MHz, we have 0x800 bytes, or 0x400 words
r1877r1878
134134
135135WRITE16_HANDLER( m92_paletteram_w )
136136{
137   paletteram16_xBBBBBGGGGGRRRRR_word_w(offset + 0x400 * m92_palette_bank, data, mem_mask);
137   paletteram16_xBBBBBGGGGGRRRRR_word_w(machine, offset + 0x400 * m92_palette_bank, data, mem_mask);
138138}
139139
140140/*****************************************************************************/
r1877r1878
296296
297297/*****************************************************************************/
298298
299static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
299static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
300300{
301301   int offs,k;
302302
r1877r1878
429429
430430/*****************************************************************************/
431431
432static void m92_screenrefresh(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
432static void m92_screenrefresh(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
433433{
434434   fillbitmap(priority_bitmap, 0, cliprect);
435435
src/mame/video/m58.c
r1877r1878
1313UINT8 *yard_scroll_x_high;
1414UINT8 *yard_scroll_y_low;
1515UINT8 *yard_score_panel_disabled;
16static mame_bitmap *scroll_panel_bitmap;
16static bitmap_t *scroll_panel_bitmap;
1717
1818static tilemap *bg_tilemap;
1919
r1877r1878
214214
215215#define DRAW_SPRITE(code, sy) drawgfx(bitmap, machine->gfx[1], code, color, flipx, flipy, sx, sy, cliprect, TRANSPARENCY_PENS, colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 512));
216216
217static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
217static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
218218{
219219   int offs;
220220
r1877r1878
267267 *
268268 *************************************/
269269
270static void draw_panel( running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
270static void draw_panel( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
271271{
272272   if (! *yard_score_panel_disabled)
273273   {
src/mame/video/thoop2.c
r1877r1878
150150      3  | xxxxxxxx xxxxxx-- | sprite code (low bits)
151151*/
152152
153static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri)
153static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri)
154154{
155155   int j, x, y, ex, ey;
156156   const gfx_element *gfx = machine->gfx[0];
src/mame/video/wwfwfest.c
r1877r1878
143143 sprite drawing could probably be improved a bit
144144*******************************************************************************/
145145
146static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
146static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
147147{
148148   /*- SPR RAM Format -**
149149
src/mame/video/pktgaldx.c
r1877r1878
11#include "driver.h"
2#include "deprecat.h"
32#include "deco16ic.h"
43
54UINT16* pcktgaldb_fgram;
65UINT16* pcktgaldb_sprites;
76
87
9static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
8static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
109{
1110   int offs;
1211   int flipscreen=!flip_screen_get();
r1877r1878
2019
2120      y = spriteram16[offs];
2221      flash=y&0x1000;
23      if (flash && (cpu_getcurrentframe() & 1)) continue;
22      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
2423
2524      x = spriteram16[offs+2];
2625      colour = (x >>9) & 0x1f;
src/mame/video/timeplt.c
r1877r1878
157157 *
158158 *************************************/
159159
160static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
160static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
161161{
162162   int offs;
163163
src/mame/video/atarigx2.c
r1877r1878
234234
235235   /* copy the motion objects on top */
236236   {
237      mame_bitmap *mo_bitmap = atarirle_get_vram(0, 0);
237      bitmap_t *mo_bitmap = atarirle_get_vram(0, 0);
238238      int left   = cliprect->min_x;
239239      int top      = cliprect->min_y;
240240      int right   = cliprect->max_x + 1;
src/mame/video/fuukifg2.c
r1877r1878
144144
145145***************************************************************************/
146146
147static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
147static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
148148{
149149   int offs;
150150
r1877r1878
268268***************************************************************************/
269269
270270/* Wrapper to handle bg and bg2 ttogether */
271static void fuuki16_draw_layer(mame_bitmap *bitmap, const rectangle *cliprect, int i, int flag, int pri)
271static void fuuki16_draw_layer(bitmap_t *bitmap, const rectangle *cliprect, int i, int flag, int pri)
272272{
273273   int buffer = (fuuki16_vregs[0x1e/2] & 0x40);
274274
src/mame/video/vulgus.c
r1877r1878
170170
171171***************************************************************************/
172172
173static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
173static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
174174{
175175   int offs;
176176
src/mame/video/sderby.c
r1877r1878
6464}
6565
6666
67static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int codeshift)
67static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int codeshift)
6868{
6969   int offs;
7070   int height = machine->gfx[0]->height;
src/mame/video/circus.c
r1877r1878
5151       8, 8, 32, 32);
5252}
5353
54static void draw_line(mame_bitmap *bitmap, const rectangle *cliprect, int x1, int y1, int x2, int y2, int dotted)
54static void draw_line(bitmap_t *bitmap, const rectangle *cliprect, int x1, int y1, int x2, int y2, int dotted)
5555{
5656   /* Draws horizontal and Vertical lines only! */
5757
r1877r1878
7272         *BITMAP_ADDR16(bitmap, y1, count) = 1;
7373}
7474
75static void draw_robot_box(mame_bitmap *bitmap, const rectangle *cliprect, int x, int y)
75static void draw_robot_box(bitmap_t *bitmap, const rectangle *cliprect, int x, int y)
7676{
7777   /* Box */
7878
r1877r1878
9292   draw_line(bitmap,cliprect,x+16,y,x+16,ey,0);
9393}
9494
95static void circus_draw_fg(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
95static void circus_draw_fg(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
9696{
9797   /* The sync generator hardware is used to   */
9898   /* draw the border and diving boards        */
r1877r1878
122122   return 0;
123123}
124124
125static void robotbwl_draw_scoreboard(mame_bitmap *bitmap, const rectangle *cliprect)
125static void robotbwl_draw_scoreboard(bitmap_t *bitmap, const rectangle *cliprect)
126126{
127127   int offs;
128128
r1877r1878
147147   draw_line(bitmap, cliprect, 39+152,137,47+152,137,0);
148148}
149149
150static void robotbwl_draw_bowling_alley(mame_bitmap *bitmap, const rectangle *cliprect)
150static void robotbwl_draw_bowling_alley(bitmap_t *bitmap, const rectangle *cliprect)
151151{
152152   draw_line(bitmap, cliprect, 103,17,103,205,0);
153153   draw_line(bitmap, cliprect, 111,17,111,203,1);
r1877r1878
155155   draw_line(bitmap, cliprect, 144,17,144,203,1);
156156}
157157
158static void robotbwl_draw_ball(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
158static void robotbwl_draw_ball(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
159159{
160160   drawgfx(bitmap,machine->gfx[1],
161161         clown_z,
r1877r1878
174174   return 0;
175175}
176176
177static void crash_draw_car(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
177static void crash_draw_car(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
178178{
179179   drawgfx(bitmap,machine->gfx[1],
180180      clown_z,
r1877r1878
191191   return 0;
192192}
193193
194static void ripcord_draw_skydiver(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
194static void ripcord_draw_skydiver(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
195195{
196196   const gfx_element *gfx;
197197   UINT8  *src_lineptr, *src_pixptr;
src/mame/video/zac2650.c
r1877r1878
99
1010
1111UINT8 *zac2650_s2636_0_ram;
12static mame_bitmap *spritebitmap;
12static bitmap_t *spritebitmap;
1313
1414static int CollisionBackground;
1515static int CollisionSprite;
r1877r1878
3737
3838READ8_HANDLER( tinvader_port_0_r )
3939{
40   return input_port_0_r(0) - CollisionBackground;
40   return input_port_0_r(machine,0) - CollisionBackground;
4141}
4242
4343/*****************************************/
r1877r1878
138138   tmpbitmap = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,machine->screen[0].format);
139139}
140140
141static void draw_sprites(running_machine *machine, mame_bitmap *bitmap)
141static void draw_sprites(running_machine *machine, bitmap_t *bitmap)
142142{
143143   int offs;
144144
src/mame/video/shangha3.c
r1877r1878
6969int shangha3_do_shadows;
7070
7171static UINT16 gfxlist_addr;
72static mame_bitmap *rawbitmap;
72static bitmap_t *rawbitmap;
7373
7474
7575
src/mame/video/vastar.c
r1877r1878
127127
128128***************************************************************************/
129129
130static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
130static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
131131{
132132   int offs;
133133
src/mame/video/taotaido.c
r1877r1878
3434/* sprites are like the other video system / psikyo games, we can merge this with aerofgt and plenty of other
3535   things eventually */
3636
37static void draw_sprite(running_machine *machine, UINT16 spriteno, mame_bitmap *bitmap, const rectangle *cliprect )
37static void draw_sprite(running_machine *machine, UINT16 spriteno, bitmap_t *bitmap, const rectangle *cliprect )
3838{
3939   /*- SPR RAM Format -**
4040
r1877r1878
118118   }
119119}
120120
121static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
121static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
122122{
123123   /* first part of sprite ram is the list of sprites to draw, terminated with 0x4000 */
124124   UINT16 *source = taotaido_spriteram_older;
src/mame/video/relief.c
r1877r1878
107107VIDEO_UPDATE( relief )
108108{
109109   struct atarimo_rect_list rectlist;
110   mame_bitmap *mobitmap;
110   bitmap_t *mobitmap;
111111   int x, y, r;
112112
113113   /* draw the playfield */
src/mame/video/taito_f3.c
r1877r1878
334334static struct f3_spritealpha_line_inf *sa_line_inf;
335335
336336
337static mame_bitmap *pri_alp_bitmap;
337static bitmap_t *pri_alp_bitmap;
338338/*
339339pri_alp_bitmap
340340---- ---1    sprite priority 0
r1877r1878
366366
367367/******************************************************************************/
368368
369static void print_debug_info(mame_bitmap *bitmap)
369static void print_debug_info(bitmap_t *bitmap)
370370{
371371   int l[16];
372372   char buf[64*16];
r1877r1878
13581358/*============================================================================*/
13591359
13601360INLINE void draw_scanlines(running_machine *machine,
1361      mame_bitmap *bitmap,int xsize,INT16 *draw_line_num,
1361      bitmap_t *bitmap,int xsize,INT16 *draw_line_num,
13621362      const struct f3_playfield_line_inf **line_t,
13631363      const int *sprite,
13641364      UINT32 orient,
r1877r1878
18701870static void get_line_ram_info(running_machine *machine, tilemap *tmap, int sx, int sy, int pos, UINT32 *f3_pf_data_n)
18711871{
18721872   struct f3_playfield_line_inf *line_t=&pf_line_inf[pos];
1873   const mame_bitmap *srcbitmap;
1874   const mame_bitmap *flagsbitmap;
1873   const bitmap_t *srcbitmap;
1874   const bitmap_t *flagsbitmap;
18751875
18761876   int y,y_start,y_end,y_inc;
18771877   int line_base,zoom_base,col_base,pri_base,inc;
r1877r1878
20912091{
20922092   const struct f3_spritealpha_line_inf *sprite_alpha_line_t=&sa_line_inf[0];
20932093   struct f3_playfield_line_inf *line_t=&pf_line_inf[4];
2094   const mame_bitmap *srcbitmap_pixel, *srcbitmap_vram;
2095   const mame_bitmap *flagsbitmap_pixel, *flagsbitmap_vram;
2094   const bitmap_t *srcbitmap_pixel, *srcbitmap_vram;
2095   const bitmap_t *flagsbitmap_pixel, *flagsbitmap_vram;
20962096
20972097   int y,y_start,y_end,y_inc;
20982098   int pri_base,inc;
r1877r1878
22152215
22162216/******************************************************************************/
22172217
2218static void scanline_draw(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
2218static void scanline_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
22192219{
22202220   int i,j,y,ys,ye;
22212221   int y_start,y_end,y_start_next,y_end_next;
r1877r1878
26372637   dest++;                  \
26382638   pri++;
26392639
2640INLINE void f3_drawgfx( mame_bitmap *dest_bmp,const gfx_element *gfx,
2640INLINE void f3_drawgfx( bitmap_t *dest_bmp,const gfx_element *gfx,
26412641      UINT32 code,
26422642      UINT32 color,
26432643      int flipx,int flipy,
r1877r1878
28002800#undef NEXT_P
28012801
28022802
2803INLINE void f3_drawgfxzoom(mame_bitmap *dest_bmp,const gfx_element *gfx,
2803INLINE void f3_drawgfxzoom(bitmap_t *dest_bmp,const gfx_element *gfx,
28042804      UINT32 code,
28052805      UINT32 color,
28062806      int flipx,int flipy,
r1877r1878
31983198#undef CALC_ZOOM
31993199
32003200
3201static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
3201static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
32023202{
32033203   const struct tempsprite *sprite_ptr;
32043204   const gfx_element *sprite_gfx = machine->gfx[2];
src/mame/video/gaelco2.c
r1877r1878
339339
340340***************************************************************************/
341341
342static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int mask, int xoffs)
342static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int mask, int xoffs)
343343{
344344   int j, x, y, ex, ey, px, py;
345345   const gfx_element *gfx = machine->gfx[0];
r1877r1878
507507VIDEO_EOF( gaelco2 )
508508{
509509   /* sprites are one frame ahead */
510   buffer_spriteram16_w(0, 0, 0);
510   buffer_spriteram16_w(machine, 0, 0, 0);
511511}
src/mame/video/homerun.c
r1877r1878
6666   homerun_tilemap = tilemap_create(get_homerun_tile_info,tilemap_scan_rows, 8, 8,64,64);
6767}
6868
69static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
69static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
7070{
7171   int offs;
7272   for (offs = spriteram_size-4; offs >=0; offs -= 4)
src/mame/video/champbas.c
r1877r1878
137137   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,  8, 8, 32, 32);
138138}
139139
140static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
140static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
141141{
142142   int offs;
143143
src/mame/video/baraduke.c
r1877r1878
214214
215215***************************************************************************/
216216
217static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int sprite_priority)
217static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int sprite_priority)
218218{
219219   const UINT8 *source = &spriteram[0];
220220   const UINT8 *finish = &spriteram[0x0800-16];   /* the last is NOT a sprite */
src/mame/video/ssozumo.c
r1877r1878
140140   tilemap_set_transparent_pen(fg_tilemap, 0);
141141}
142142
143static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
143static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
144144{
145145   int offs;
146146
src/mame/video/mcr.c
r1877r1878
240240 *
241241 *************************************/
242242
243static void render_sprites_91399(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
243static void render_sprites_91399(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
244244{
245245   const gfx_element *gfx = machine->gfx[1];
246246   int offs;
r1877r1878
311311 *
312312 *************************************/
313313
314static void render_sprites_91464(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int primask, int sprmask, int colormask)
314static void render_sprites_91464(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int primask, int sprmask, int colormask)
315315{
316316   const gfx_element *gfx = machine->gfx[1];
317317   int offs;
src/mame/video/m107.c
r1877r1878
153153
154154/*****************************************************************************/
155155
156static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri)
156static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri)
157157{
158158   int offs;
159159
r1877r1878
273273
274274/*****************************************************************************/
275275
276static void m107_screenrefresh(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
276static void m107_screenrefresh(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
277277{
278278   if ((~m107_control[0x0b] >> 7) & 1)
279279   {
src/mame/video/ninjaw.c
r1877r1878
5555            SPRITE DRAW ROUTINE
5656************************************************************/
5757
58static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int primask,int x_offs,int y_offs)
58static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int primask,int x_offs,int y_offs)
5959{
6060   int offs, data, tilenum, color, flipx, flipy;
6161   int x, y, priority, curx, cury;
src/mame/video/matmania.c
r1877r1878
2222UINT8 *matmania_videoram3,*matmania_colorram3;
2323size_t matmania_videoram3_size;
2424UINT8 *matmania_scroll;
25static mame_bitmap *tmpbitmap2;
25static bitmap_t *tmpbitmap2;
2626
2727UINT8 *matmania_pageselect;
2828
src/mame/video/arkanoid.c
r1877r1878
8989   state_save_register_global(palettebank);
9090}
9191
92static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
92static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
9393{
9494   int offs;
9595
src/mame/video/twin16.c
r1877r1878
8787}
8888
8989static void draw_sprite( /* slow slow slow, but it's ok for now */
90   mame_bitmap *bitmap,
90   bitmap_t *bitmap,
9191   const UINT16 *pen_data,
9292   int pal_base,
9393   int xpos, int ypos,
r1877r1878
196196
197197 */
198198
199static void draw_sprites( mame_bitmap *bitmap )
199static void draw_sprites( bitmap_t *bitmap )
200200{
201201   int count = 0;
202202
r1877r1878
282282   }
283283}
284284
285static void draw_layer( mame_bitmap *bitmap, int opaque ){
285static void draw_layer( bitmap_t *bitmap, int opaque ){
286286   const UINT16 *gfx_base;
287287   const UINT16 *source = videoram16;
288288   int i, xxor, yxor;
r1877r1878
440440
441441   need_process_spriteram = 1;
442442
443   buffer_spriteram16_w(0,0,0);
443   buffer_spriteram16_w(machine,0,0,0);
444444}
445445
446446VIDEO_UPDATE( twin16 )
src/mame/video/megasys1.c
r1877r1878
450450
451451      case 0x300/2   :   megasys1_screen_flag = new_data;
452452                     if (new_data & 0x10)
453                        cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, ASSERT_LINE);
453                        cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, ASSERT_LINE);
454454                     else
455                        cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, CLEAR_LINE);
455                        cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, CLEAR_LINE);
456456                     break;
457457
458      case 0x308/2   :   soundlatch_word_w(0,new_data,0);
459                     cpunum_set_input_line(Machine, 1,4,HOLD_LINE);
458      case 0x308/2   :   soundlatch_word_w(machine,0,new_data,0);
459                     cpunum_set_input_line(machine, 1,4,HOLD_LINE);
460460                     break;
461461
462462      default       :   SHOW_WRITE_ERROR("vreg %04X <- %04X",offset*2,data);
r1877r1878
472472{
473473   switch (offset)
474474   {
475      case 0x8000/2:   return soundlatch2_word_r(0,0);
475      case 0x8000/2:   return soundlatch2_word_r(machine,0,0);
476476      default:      return megasys1_vregs[offset];
477477   }
478478}
r1877r1878
501501
502502      case 0x2308/2   :   megasys1_screen_flag = new_data;
503503                     if (new_data & 0x10)
504                        cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, ASSERT_LINE);
504                        cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, ASSERT_LINE);
505505                     else
506                        cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, CLEAR_LINE);
506                        cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, CLEAR_LINE);
507507                     break;
508508
509509      case 0x8000/2   :   /* Cybattler reads sound latch on irq 2 */
510                     soundlatch_word_w(0,new_data,0);
511                     cpunum_set_input_line(Machine, 1,2,HOLD_LINE);
510                     soundlatch_word_w(machine,0,new_data,0);
511                     cpunum_set_input_line(machine, 1,2,HOLD_LINE);
512512                     break;
513513
514514      default:      SHOW_WRITE_ERROR("vreg %04X <- %04X",offset*2,data);
r1877r1878
572572    0C      Y position
573573    0E      Code                                            */
574574
575static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
575static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
576576{
577577   int color,code,sx,sy,flipx,flipy,attr,sprite,offs,color_mask;
578578
r1877r1878
923923
924924
925925/***************************************************************************
926              Draw the game screen in the given mame_bitmap.
926              Draw the game screen in the given bitmap_t.
927927***************************************************************************/
928928
929929
src/mame/video/crshrace.c
r1877r1878
9999
100100***************************************************************************/
101101
102static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
102static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
103103{
104104   int offs;
105105
r1877r1878
171171}
172172
173173
174static void draw_bg(mame_bitmap *bitmap,const rectangle *cliprect)
174static void draw_bg(bitmap_t *bitmap,const rectangle *cliprect)
175175{
176176   tilemap_draw(bitmap,cliprect,tilemap2,0,0);
177177}
178178
179179
180static void draw_fg(mame_bitmap *bitmap,const rectangle *cliprect)
180static void draw_fg(bitmap_t *bitmap,const rectangle *cliprect)
181181{
182182   K053936_0_zoom_draw(bitmap,cliprect,tilemap1,0,0);
183183}
r1877r1878
215215
216216VIDEO_EOF( crshrace )
217217{
218   buffer_spriteram16_w(0,0,0);
219   buffer_spriteram16_2_w(0,0,0);
218   buffer_spriteram16_w(machine,0,0,0);
219   buffer_spriteram16_2_w(machine,0,0,0);
220220}
src/mame/video/airbustr.c
r1877r1878
3636UINT8 *airbustr_videoram2, *airbustr_colorram2;
3737//int airbustr_clear_sprites;
3838static tilemap *bg_tilemap, *fg_tilemap;
39static mame_bitmap *sprites_bitmap;
39static bitmap_t *sprites_bitmap;
4040
4141WRITE8_HANDLER( airbustr_videoram_w )
4242{
src/mame/video/clshroad.c
r1877r1878
290290
291291***************************************************************************/
292292
293static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
293static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
294294{
295295   int i;
296296
src/mame/video/dcheese.c
r1877r1878
3131static UINT16 blitter_yparam[16];
3232static UINT16 blitter_vidparam[32];
3333
34static mame_bitmap *dstbitmap;
34static bitmap_t *dstbitmap;
3535static emu_timer *blitter_timer;
3636
3737
src/mame/video/bwing.c
r1877r1878
118118         }
119119
120120         #if BW_DEBUG
121            logerror("(%1d)%04x: w=%02x a=%04x f=%d\n",cpu_getactivecpu(),activecpu_get_pc(),data,0x1b00+offset,cpu_getcurrentframe());
121            logerror("(%1d)%04x: w=%02x a=%04x f=%d\n",cpu_getactivecpu(),activecpu_get_pc(),data,0x1b00+offset,video_screen_get_frame_number(0));
122122         #endif
123123      break;
124124   }
r1877r1878
228228//****************************************************************************
229229// Realtime
230230
231static void draw_sprites(running_machine *machine, mame_bitmap *bmp, const rectangle *clip, UINT8 *ram, int pri)
231static void draw_sprites(running_machine *machine, bitmap_t *bmp, const rectangle *clip, UINT8 *ram, int pri)
232232{
233233   int attrib, fx, fy, code, x, y, color, i;
234234   gfx_element *gfx = machine->gfx[1];
src/mame/video/sf.c
r1877r1878
130130   return nb ^ delta[(nb >> 3) & 3];
131131}
132132
133static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
133static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
134134{
135135   int offs;
136136
src/mame/video/sengokmj.c
r1877r1878
6161   SET_TILE_INFO(2, (tile & 0xfff) + 0x3000, color, 0);
6262}
6363
64static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int pri)
64static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int pri)
6565{
6666   int offs,fx,fy,x,y,color,sprite;
6767   int dx,dy,ax,ay;
src/mame/video/lsasquad.c
r1877r1878
44
55
66
7static void draw_layer(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT8 *scrollram)
7static void draw_layer(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8 *scrollram)
88{
99   int offs,scrollx,scrolly;
1010
r1877r1878
5050   }
5151}
5252
53static int draw_layer_daikaiju(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int offs, int  * previd, int type)
53static int draw_layer_daikaiju(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int  * previd, int type)
5454{
5555   int id,scrollx,scrolly,initoffs, globalscrollx;
5656   int stepx=0;
r1877r1878
140140   return offs;
141141}
142142
143static void drawbg(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int type)
143static void drawbg(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int type)
144144{
145145   int i=0;
146146   int id=-1;
r1877r1878
159159   }
160160}
161161
162static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
162static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
163163{
164164   int offs;
165165
src/mame/video/cave.c
r1877r1878
110110static int num_sprites;
111111static struct sprite_cave *sprite_cave;
112112static struct sprite_cave *sprite_table[MAX_PRIORITY][MAX_SPRITE_NUM+1];
113static mame_bitmap *sprite_zbuf;
113static bitmap_t *sprite_zbuf;
114114static UINT16 sprite_zbuf_baseval = 0x10000-MAX_SPRITE_NUM;
115115
116116static void (*get_sprite_info)(running_machine *machine);
r1877r1878
13041304***************************************************************************/
13051305
13061306INLINE void cave_tilemap_draw(
1307   mame_bitmap *bitmap, const rectangle *cliprect,
1307   bitmap_t *bitmap, const rectangle *cliprect,
13081308   tilemap *TILEMAP, UINT16 *VRAM, UINT16 *VCTRL,
13091309   UINT32 flags, UINT32 priority, UINT32 priority2 )
13101310{
r1877r1878
14241424   }
14251425}
14261426
1427static void cave_tilemap_0_draw( mame_bitmap *bitmap, const rectangle *cliprect, UINT32 flags, UINT32 priority, UINT32 priority2 )
1427static void cave_tilemap_0_draw( bitmap_t *bitmap, const rectangle *cliprect, UINT32 flags, UINT32 priority, UINT32 priority2 )
14281428{    cave_tilemap_draw( bitmap, cliprect, tilemap_0, cave_vram_0, cave_vctrl_0, flags, priority, priority2 );   }
1429static void cave_tilemap_1_draw( mame_bitmap *bitmap, const rectangle *cliprect, UINT32 flags, UINT32 priority, UINT32 priority2 )
1429static void cave_tilemap_1_draw( bitmap_t *bitmap, const rectangle *cliprect, UINT32 flags, UINT32 priority, UINT32 priority2 )
14301430{    cave_tilemap_draw( bitmap, cliprect, tilemap_1, cave_vram_1, cave_vctrl_1, flags, priority, priority2 );   }
1431static void cave_tilemap_2_draw( mame_bitmap *bitmap, const rectangle *cliprect, UINT32 flags, UINT32 priority, UINT32 priority2 )
1431static void cave_tilemap_2_draw( bitmap_t *bitmap, const rectangle *cliprect, UINT32 flags, UINT32 priority, UINT32 priority2 )
14321432{    cave_tilemap_draw( bitmap, cliprect, tilemap_2, cave_vram_2, cave_vctrl_2, flags, priority, priority2 );   }
1433static void cave_tilemap_3_draw( mame_bitmap *bitmap, const rectangle *cliprect, UINT32 flags, UINT32 priority, UINT32 priority2 )
1433static void cave_tilemap_3_draw( bitmap_t *bitmap, const rectangle *cliprect, UINT32 flags, UINT32 priority, UINT32 priority2 )
14341434{    cave_tilemap_draw( bitmap, cliprect, tilemap_3, cave_vram_3, cave_vctrl_3, flags, priority, priority2 );   }
14351435
14361436
src/mame/video/dooyong.c
r1877r1878
9494
9595WRITE16_HANDLER( dooyong_bgscroll16_w )
9696{
97   if (ACCESSING_LSB) dooyong_bgscroll8_w(offset, data & 0x00ff);
97   if (ACCESSING_LSB) dooyong_bgscroll8_w(machine, offset, data & 0x00ff);
9898}
9999
100100WRITE16_HANDLER( dooyong_bg2scroll16_w )
101101{
102   if (ACCESSING_LSB) dooyong_bg2scroll8_w(offset, data & 0x00ff);
102   if (ACCESSING_LSB) dooyong_bg2scroll8_w(machine, offset, data & 0x00ff);
103103}
104104
105105WRITE16_HANDLER( dooyong_fgscroll16_w )
106106{
107   if (ACCESSING_LSB) dooyong_fgscroll8_w(offset, data & 0x00ff);
107   if (ACCESSING_LSB) dooyong_fgscroll8_w(machine, offset, data & 0x00ff);
108108}
109109
110110WRITE16_HANDLER( dooyong_fg2scroll16_w )
111111{
112   if (ACCESSING_LSB) dooyong_fg2scroll8_w(offset, data & 0x00ff);
112   if (ACCESSING_LSB) dooyong_fg2scroll8_w(machine, offset, data & 0x00ff);
113113}
114114
115115
r1877r1878
344344}
345345
346346
347static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pollux_extensions)
347static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pollux_extensions)
348348{
349349   /* Sprites take 32 bytes each in memory:
350350                     MSB   LSB
r1877r1878
434434   }
435435}
436436
437static void rshark_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
437static void rshark_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
438438{
439439   /* Sprites take 8 16-bit words each in memory:
440440                  MSB             LSB
r1877r1878
866866
867867VIDEO_EOF( dooyong )
868868{
869   buffer_spriteram_w(0, 0);
869   buffer_spriteram_w(machine, 0, 0);
870870}
871871
872872VIDEO_EOF( rshark )
873873{
874   buffer_spriteram16_w(0, 0, 0);
874   buffer_spriteram16_w(machine, 0, 0, 0);
875875}
src/mame/video/brkthru.c
r1877r1878
163163
164164
165165#if 0
166static void show_register( mame_bitmap *bitmap, int x, int y, UINT32 data )
166static void show_register( bitmap_t *bitmap, int x, int y, UINT32 data )
167167{
168168   char buf[5];
169169
r1877r1878
173173#endif
174174
175175
176static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int prio )
176static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int prio )
177177{
178178   int offs;
179179   /* Draw the sprites. Note that it is important to draw them exactly in this */
src/mame/video/dec8.c
r1877r1878
244244/******************************************************************************/
245245
246246/* 'Karnov' sprites, used by Gondomania, Last Mission, Shackled, Ghostbusters */
247static void draw_sprites1(running_machine* machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
247static void draw_sprites1(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect, int priority)
248248{
249249   int offs,x,y,sprite,sprite2,colour,extra,fx,fy;
250250
r1877r1878
307307}
308308
309309/* 'Dec0' sprites, used by Cobra Command, Oscar */
310static void draw_sprites2(running_machine* machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
310static void draw_sprites2(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect, int priority)
311311{
312312   int offs,x,y,sprite,colour,multi,fx,fy,inc,flash,mult;
313313
r1877r1878
319319      x = buffered_spriteram[offs+5]+(buffered_spriteram[offs+4]<<8);
320320      colour = ((x & 0xf000) >> 12);
321321      flash=x&0x800;
322      if (flash && (cpu_getcurrentframe() & 1)) continue;
322      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
323323
324324      if (priority==1 &&  (colour&4)) continue;
325325      if (priority==2 && !(colour&4)) continue;
r1877r1878
370370   }
371371}
372372
373static void srdarwin_draw_sprites(running_machine* machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri)
373static void srdarwin_draw_sprites(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect, int pri)
374374{
375375   int offs;
376376
r1877r1878
420420
421421/* Draw character tiles, each game has different colour masks */
422422#if 0
423static void draw_characters(running_machine* machine, mame_bitmap *bitmap, const rectangle *cliprect, int mask, int shift)
423static void draw_characters(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect, int mask, int shift)
424424{
425425   int mx,my,tile,color,offs;
426426
src/mame/video/fuukifg3.c
r1877r1878
159159
160160***************************************************************************/
161161
162static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
162static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
163163{
164164   int offs;
165165
r1877r1878
300300***************************************************************************/
301301
302302/* Wrapper to handle bg and bg2 ttogether */
303static void fuuki32_draw_layer(mame_bitmap *bitmap, const rectangle *cliprect, int i, int flag, int pri)
303static void fuuki32_draw_layer(bitmap_t *bitmap, const rectangle *cliprect, int i, int flag, int pri)
304304{
305305   int buffer = ((fuuki32_vregs[0x1e/4]&0x0000ffff) & 0x40);
306306
src/mame/video/tbowl.c
r1877r1878
116116   tbowl_bg2yscroll = (tbowl_bg2yscroll & 0x00ff) | (data << 8);
117117}
118118
119static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect, int xscroll)
119static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect, int xscroll)
120120{
121121   int offs;
122122   static const UINT8 layout[8][8] =
src/mame/video/battlane.c
r1877r1878
1515static int battlane_video_ctrl;
1616extern int battlane_cpu_control;
1717
18static mame_bitmap *screen_bitmap;
18static bitmap_t *screen_bitmap;
1919
2020/*
2121    Video control register
r1877r1878
150150   screen_bitmap = auto_bitmap_alloc(32 * 8, 32 * 8, BITMAP_FORMAT_INDEXED8);
151151}
152152
153static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
153static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
154154{
155155   int offs, attr, code, color, sx, sy, flipx, flipy, dy;
156156
r1877r1878
215215   }
216216}
217217
218static void draw_fg_bitmap(running_machine *machine, mame_bitmap *bitmap )
218static void draw_fg_bitmap(running_machine *machine, bitmap_t *bitmap )
219219{
220220   int x, y, data;
221221
src/mame/video/atarigt.c
r1877r1878
5353 *
5454 *************************************/
5555
56static mame_bitmap *pf_bitmap;
57static mame_bitmap *an_bitmap;
56static bitmap_t *pf_bitmap;
57static bitmap_t *an_bitmap;
5858
5959static UINT8 playfield_tile_bank;
6060static UINT8 playfield_color_bank;
r1877r1878
559559
560560VIDEO_UPDATE( atarigt )
561561{
562   mame_bitmap *mo_bitmap = atarirle_get_vram(0, 0);
563   mame_bitmap *tm_bitmap = atarirle_get_vram(0, 1);
562   bitmap_t *mo_bitmap = atarirle_get_vram(0, 0);
563   bitmap_t *tm_bitmap = atarirle_get_vram(0, 1);
564564   int color_latch;
565565   int x, y;
566566
src/mame/video/genesis.c
r1877r1878
296296   return 0;
297297}
298298
299void update_system18_vdp( mame_bitmap *bitmap, const rectangle *cliprect )
299void update_system18_vdp( bitmap_t *bitmap, const rectangle *cliprect )
300300{
301301   int y;
302302
r1877r1878
400400      case 0x0a:
401401      case 0x0b:
402402         if (ACCESSING_LSB && sndti_exists(SOUND_SN76496, 0))
403            SN76496_0_w(0, data & 0xff);
403            SN76496_0_w(machine, 0, data & 0xff);
404404         break;
405405   }
406406}
src/mame/video/thepit.c
r1877r1878
219219       horizontal flip switch. (This is how the real PCB does it) */
220220   if (thepit_flip_screen_x)
221221   {
222      return input_port_3_r(offset);
222      return input_port_3_r(machine,offset);
223223   }
224224   else
225225   {
226      return input_port_0_r(offset);
226      return input_port_0_r(machine,offset);
227227   }
228228}
229229
r1877r1878
236236 *************************************/
237237
238238static void draw_sprites(running_machine *machine,
239                   mame_bitmap *bitmap,
239                   bitmap_t *bitmap,
240240                   const rectangle *cliprect,
241241                   int priority_to_draw)
242242{
src/mame/video/rpunch.c
r1877r1878
207207 *
208208 *************************************/
209209
210static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int start, int stop)
210static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int start, int stop)
211211{
212212   int offs;
213213
r1877r1878
243243 *
244244 *************************************/
245245
246static void draw_bitmap(mame_bitmap *bitmap, const rectangle *cliprect)
246static void draw_bitmap(bitmap_t *bitmap, const rectangle *cliprect)
247247{
248248   int colourbase;
249249   int xxx=512/4;
src/mame/video/cloud9.c
r1877r1878
1717 *************************************/
1818
1919static double rweights[3], gweights[3], bweights[3];
20static mame_bitmap *spritebitmap;
20static bitmap_t *spritebitmap;
2121
2222static UINT8 video_control[8];
2323static UINT8 bitmode_addr[2];
src/mame/video/m3raster.c
r1877r1878
22{
33   const poly_extra_data *extra = extradata;
44   const cached_texture *texture = extra->texture;
5   mame_bitmap *destmap = dest;
5   bitmap_t *destmap = dest;
66   UINT16 *p = BITMAP_ADDR16(destmap, scanline, 0);
77   UINT32 *d = BITMAP_ADDR32(zbuffer, scanline, 0);
88   float ooz = extent->param[0].start;
r1877r1878
5151{
5252   const poly_extra_data *extra = extradata;
5353   const cached_texture *texture = extra->texture;
54   mame_bitmap *destmap = dest;
54   bitmap_t *destmap = dest;
5555   UINT16 *p = BITMAP_ADDR16(destmap, scanline, 0);
5656   UINT32 *d = BITMAP_ADDR32(zbuffer, scanline, 0);
5757   float ooz = extent->param[0].start;
r1877r1878
106106{
107107   const poly_extra_data *extra = extradata;
108108   const cached_texture *texture = extra->texture;
109   mame_bitmap *destmap = dest;
109   bitmap_t *destmap = dest;
110110   UINT16 *p = BITMAP_ADDR16(destmap, scanline, 0);
111111   UINT32 *d = BITMAP_ADDR32(zbuffer, scanline, 0);
112112   float ooz = extent->param[0].start;
r1877r1878
164164{
165165   const poly_extra_data *extra = extradata;
166166   const cached_texture *texture = extra->texture;
167   mame_bitmap *destmap = dest;
167   bitmap_t *destmap = dest;
168168   UINT16 *p = BITMAP_ADDR16(destmap, scanline, 0);
169169   UINT32 *d = BITMAP_ADDR32(zbuffer, scanline, 0);
170170   float ooz = extent->param[0].start;
r1877r1878
223223static void draw_scanline_color(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
224224{
225225   const poly_extra_data *extra = extradata;
226   mame_bitmap *destmap = dest;
226   bitmap_t *destmap = dest;
227227   UINT16 *p = BITMAP_ADDR16(destmap, scanline, 0);
228228   UINT32 *d = BITMAP_ADDR32(zbuffer, scanline, 0);
229229   float ooz = extent->param[0].start;
src/mame/video/changela.c
r1877r1878
3232static UINT8* tree_ram;
3333static UINT32  mem_dev_selected; /* an offset within memory_devices area */
3434
35static mame_bitmap *obj0_bitmap, *river_bitmap, *tree0_bitmap, *tree1_bitmap;
35static bitmap_t *obj0_bitmap, *river_bitmap, *tree0_bitmap, *tree1_bitmap;
3636
3737static emu_timer* changela_scanline_timer;
3838static TIMER_CALLBACK( changela_scanline_callback );
r1877r1878
6464    Obj 0 - Sprite Layer
6565
6666***************************************************************************/
67static void draw_obj0(mame_bitmap *bitmap, int sy)
67static void draw_obj0(bitmap_t *bitmap, int sy)
6868{
6969   int sx, i;
7070
r1877r1878
125125    Obj 1 - Text Layer
126126
127127***************************************************************************/
128static void draw_obj1(mame_bitmap *bitmap)
128static void draw_obj1(bitmap_t *bitmap)
129129{
130130   int sx, sy;
131131
r1877r1878
188188    River Video Generator
189189
190190***************************************************************************/
191static void draw_river(mame_bitmap *bitmap, int sy)
191static void draw_river(bitmap_t *bitmap, int sy)
192192{
193193   int sx, i, j;
194194
r1877r1878
367367    Tree Generators
368368
369369***************************************************************************/
370static void draw_tree(mame_bitmap *bitmap, int sy, int tree_num)
370static void draw_tree(bitmap_t *bitmap, int sy, int tree_num)
371371{
372372   int sx, i, j;
373373
src/mame/video/triplhnt.c
r1877r1878
1717int triplhnt_sprite_zoom;
1818int triplhnt_sprite_bank;
1919
20static mame_bitmap* helper;
20static bitmap_t* helper;
2121static tilemap* bg_tilemap;
2222
2323
r1877r1878
4343}
4444
4545
46static void draw_sprites(running_machine *machine, mame_bitmap* bitmap, const rectangle* cliprect)
46static void draw_sprites(running_machine *machine, bitmap_t* bitmap, const rectangle* cliprect)
4747{
4848   int i;
4949
r1877r1878
142142
143143   draw_sprites(machine, bitmap, cliprect);
144144
145   discrete_sound_w(TRIPLHNT_BEAR_ROAR_DATA, triplhnt_playfield_ram[0xfa] & 15);
146   discrete_sound_w(TRIPLHNT_SHOT_DATA, triplhnt_playfield_ram[0xfc] & 15);
145   discrete_sound_w(machine, TRIPLHNT_BEAR_ROAR_DATA, triplhnt_playfield_ram[0xfa] & 15);
146   discrete_sound_w(machine, TRIPLHNT_SHOT_DATA, triplhnt_playfield_ram[0xfc] & 15);
147147   return 0;
148148}
src/mame/video/pooyan.c
r1877r1878
158158 *
159159 *************************************/
160160
161static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
161static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
162162{
163163   int offs;
164164
src/mame/video/sidepckt.c
r1877r1878
106106
107107***************************************************************************/
108108
109static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
109static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
110110{
111111   int offs;
112112
src/mame/video/wolfpack.c
r1877r1878
2727
2828static UINT8* LFSR;
2929
30static mame_bitmap* helper;
30static bitmap_t* helper;
3131
3232
3333PALETTE_INIT( wolfpack )
r1877r1878
140140}
141141
142142
143static void draw_ship(running_machine *machine, mame_bitmap* bitmap, const rectangle* cliprect)
143static void draw_ship(running_machine *machine, bitmap_t* bitmap, const rectangle* cliprect)
144144{
145145   static const UINT32 scaler[] =
146146   {
r1877r1878
176176}
177177
178178
179static void draw_torpedo(running_machine *machine, mame_bitmap* bitmap, const rectangle* cliprect)
179static void draw_torpedo(running_machine *machine, bitmap_t* bitmap, const rectangle* cliprect)
180180{
181181   int count = 0;
182182
r1877r1878
210210}
211211
212212
213static void draw_pt(running_machine *machine, mame_bitmap* bitmap, const rectangle* cliprect)
213static void draw_pt(running_machine *machine, bitmap_t* bitmap, const rectangle* cliprect)
214214{
215215   rectangle rect = *cliprect;
216216
r1877r1878
240240}
241241
242242
243static void draw_water(colortable_t *colortable, mame_bitmap* bitmap, const rectangle* cliprect)
243static void draw_water(colortable_t *colortable, bitmap_t* bitmap, const rectangle* cliprect)
244244{
245245   rectangle rect = *cliprect;
246246
src/mame/video/pirates.c
r1877r1878
7272
7373
7474
75static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
75static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
7676{
7777   const gfx_element *gfx = machine->gfx[1];
7878   UINT16 *source = pirates_spriteram + 4;
src/mame/video/tankbatt.c
r1877r1878
8080   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
8181}
8282
83static void draw_bullets(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
83static void draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
8484{
8585   int offs;
8686
src/mame/video/exerion.c
r1877r1878
9393   /* fg chars and sprites */
9494   for (i = 0; i < 0x200; i++)
9595   {
96      UINT8 ctabentry = 0x10 | (color_prom[(i & 0xc0) | ((i & 3) << 4) | ((i >> 2) & 0x0f)] & 0x0f);
96      UINT8 ctabentry = 0x10 | (color_prom[(i & 0x1c0) | ((i & 3) << 4) | ((i >> 2) & 0x0f)] & 0x0f);
9797      colortable_entry_set_value(machine->colortable, i, ctabentry);
9898   }
9999
r1877r1878
236236 *
237237 *************************************/
238238
239static void draw_background(mame_bitmap *bitmap, const rectangle *cliprect)
239static void draw_background(bitmap_t *bitmap, const rectangle *cliprect)
240240{
241241   int x, y;
242242
src/mame/video/wrally.c
r1877r1878
113113      preliminary
114114*/
115115
116static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
116static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
117117{
118118   int i, x, y, ex, ey;
119119   const gfx_element *gfx = machine->gfx[0];
src/mame/video/segas18.c
r1877r1878
2626 *
2727 *************************************/
2828
29static mame_bitmap *tempbitmap;
29static bitmap_t *tempbitmap;
3030
3131static UINT8 grayscale_enable;
3232static UINT8 vdp_enable;
r1877r1878
4141 *************************************/
4242
4343extern void start_system18_vdp(void);
44extern void update_system18_vdp(mame_bitmap *bitmap, const rectangle *cliprect);
44extern void update_system18_vdp(bitmap_t *bitmap, const rectangle *cliprect);
4545
4646
4747
r1877r1878
123123 *
124124 *************************************/
125125
126static void draw_vdp(mame_bitmap *bitmap, const rectangle *cliprect, int priority)
126static void draw_vdp(bitmap_t *bitmap, const rectangle *cliprect, int priority)
127127{
128128   int x, y;
129129
src/mame/video/crospang.c
r1877r1878
1010*/
1111
1212#include "driver.h"
13#include "deprecat.h"
1413
1514static int xsproff, ysproff; // sprite offsets
1615static tilemap *bg_layer,*fg_layer;
r1877r1878
126125*/
127126
128127/* jumpkids / tumbleb.c! */
129static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
128static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
130129{
131130   int offs;
132131   int flipscreen = 0;
r1877r1878
140139
141140      y = spriteram16[offs];
142141      flash=y&0x1000;
143      if (flash && (cpu_getcurrentframe() & 1)) continue;
142      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
144143
145144      x = spriteram16[offs+2];
146145      colour = (x >>9) & 0xf;
src/mame/video/subs.c
r1877r1878
158158   }
159159
160160   /* Update sound */
161   discrete_sound_w(SUBS_LAUNCH_DATA, spriteram[5] & 0x0f);   // Launch data
162   discrete_sound_w(SUBS_CRASH_DATA, spriteram[5] >> 4);      // Crash/explode data
161   discrete_sound_w(machine, SUBS_LAUNCH_DATA, spriteram[5] & 0x0f);   // Launch data
162   discrete_sound_w(machine, SUBS_CRASH_DATA, spriteram[5] >> 4);      // Crash/explode data
163163   return 0;
164164}
src/mame/video/exctsccr.c
r1877r1878
148148   timer_pulse(ATTOTIME_IN_HZ(75), NULL, 0, exctsccr_fm_callback); /* updates fm */
149149}
150150
151static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
151static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
152152{
153153   int offs;
154154   UINT8 *OBJ1, *OBJ2;
src/mame/video/funybubl.c
r1877r1878
3232{
3333}
3434
35static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
35static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
3636{
3737
3838
src/mame/video/nmk16.c
r1877r1878
2222static UINT8 bioship_scroll[4];
2323
2424static tilemap *bg_tilemap,*fg_tilemap,*tx_tilemap;
25static mame_bitmap *background_bitmap;
25static bitmap_t *background_bitmap;
2626extern UINT16* nmk16_mainram;
2727
2828/***************************************************************************
r1877r1878
423423
424424// manybloc uses extra flip bits on the sprites, but these break other games
425425
426static void nmk16_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
426static void nmk16_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority)
427427{
428428   int offs;
429429
r1877r1878
474474   }
475475}
476476
477static void nmk16_draw_sprites_flipsupported(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority)
477static void nmk16_draw_sprites_flipsupported(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority)
478478{
479479   int offs;
480480
r1877r1878
10401040
10411041***************************************************************************/
10421042
1043static void video_update(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect,
1043static void video_update(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect,
10441044   int dsw_flipscreen,         // 1 = Horizontal and vertical screen flip are hardwired to 2 dip switches
10451045   int xoffset, int yoffset,   // tilemap_0 offsets
10461046   int attr_mask            // "sprite active" mask
src/mame/video/nitedrvr.c
r1877r1878
2222   nitedrvr_hvc[offset & 0x3f] = data;
2323
2424   if ((offset & 0x30) == 0x30)
25      watchdog_reset_w(0, 0);
25      watchdog_reset_w(machine, 0, 0);
2626}
2727
2828static TILE_GET_INFO( get_bg_tile_info )
r1877r1878
3939   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
4040}
4141
42static void draw_box(mame_bitmap *bitmap, int bx, int by, int ex, int ey )
42static void draw_box(bitmap_t *bitmap, int bx, int by, int ex, int ey )
4343{
4444   int x, y;
4545
r1877r1878
5353   return;
5454}
5555
56static void draw_roadway(mame_bitmap *bitmap)
56static void draw_roadway(bitmap_t *bitmap)
5757{
5858   int roadway;
5959
src/mame/video/m10.c
r1877r1878
7878}
7979
8080
81INLINE void plot_pixel_m10(mame_bitmap *bm, int x, int y, int col)
81INLINE void plot_pixel_m10(bitmap_t *bm, int x, int y, int col)
8282{
8383   m10_state *state = Machine->driver_data;
8484
r1877r1878
127127
128128/***************************************************************************
129129
130  Draw the game screen in the given mame_bitmap.
130  Draw the game screen in the given bitmap_t.
131131
132132***************************************************************************/
133133VIDEO_UPDATE( m10 )
r1877r1878
167167
168168/***************************************************************************
169169
170  Draw the game screen in the given mame_bitmap.
170  Draw the game screen in the given bitmap_t.
171171
172172***************************************************************************/
173173VIDEO_UPDATE( m15 )
src/mame/drivers/bfcobra.c
r1877r1878
14971497   MDRV_CPU_ADD(Z80, Z80_XTAL)
14981498   MDRV_CPU_PROGRAM_MAP(z80_prog_map, 0)
14991499   MDRV_CPU_IO_MAP(z80_io_map, 0)
1500   MDRV_CPU_VBLANK_INT(vblank_gen, 1)
1500   MDRV_CPU_VBLANK_INT("main", vblank_gen)
15011501
15021502   MDRV_CPU_ADD(M6809, M6809_XTAL)
15031503   MDRV_CPU_PROGRAM_MAP(m6809_prog_map, 0)
src/mame/drivers/rcasino.c
r1877r1878
296296   MDRV_CPU_ADD(Z80, 8000000/2)   // ???
297297   MDRV_CPU_PROGRAM_MAP(rcasino_map, 0)
298298   MDRV_CPU_IO_MAP(rcasino_io_map, 0)
299   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
299   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
300300
301301   // video hardware
302302
src/mame/drivers/sbugger.c
r1877r1878
9898*/
9999
100100#include "driver.h"
101#include "deprecat.h"
101102#include "sound/sn76496.h"
102103
103104//arbitrary
r1877r1878
229230   MDRV_CPU_ADD(8085A, 6000000)        /* 3.00 MHz??? */
230231   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
231232   MDRV_CPU_IO_MAP(readport,0)
232   MDRV_CPU_VBLANK_INT(irq3_line_hold,NUM_INTS_FRAME)
233   MDRV_CPU_VBLANK_INT_HACK(irq3_line_hold,NUM_INTS_FRAME)
233234
234235   MDRV_GFXDECODE(sbugger)
235236
src/mame/drivers/targeth.c
r1877r1878
190190   /* basic machine hardware */
191191   MDRV_CPU_ADD(M68000,24000000/2)         /* 12 MHz */
192192   MDRV_CPU_PROGRAM_MAP(targeth_readmem,targeth_writemem)
193   MDRV_CPU_VBLANK_INT(targeth_interrupt,3)
193   MDRV_CPU_VBLANK_INT_HACK(targeth_interrupt,3)
194194
195195   /* video hardware */
196196   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/intrscti.c
r1877r1878
9292   MDRV_CPU_ADD(Z80,4000000)       /* ? MHz */
9393   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
9494   MDRV_CPU_IO_MAP(readport,0)
95   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
95   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
9696
9797   /* video hardware */
9898   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/nycaptor.c
r1877r1878
270270
271271static WRITE8_HANDLER( sound_command_w )
272272{
273   soundlatch_w(0,data);
273   soundlatch_w(machine,0,data);
274274   timer_call_after_resynch(NULL, data,nmi_callback);
275275}
276276
r1877r1878
800800   /* basic machine hardware */
801801   MDRV_CPU_ADD(Z80,8000000/2)      /* ??? */
802802   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
803   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
803   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
804804
805805   MDRV_CPU_ADD(Z80,8000000/2)
806806   MDRV_CPU_PROGRAM_MAP(readmem_sub,writemem_sub)
807   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   /* IRQ generated by ??? */
807   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   /* IRQ generated by ??? */
808808
809809   MDRV_CPU_ADD(Z80,8000000/2)
810810   /* audio CPU */
811811   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
812   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)   /* IRQ generated by ??? */
812   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)   /* IRQ generated by ??? */
813813
814814   MDRV_CPU_ADD(M68705,2000000)
815815   MDRV_CPU_PROGRAM_MAP(m68705_readmem,m68705_writemem)
r1877r1878
853853   MDRV_CPU_ADD(Z80,8000000/2)
854854
855855   MDRV_CPU_PROGRAM_MAP(cyclshtg_readmem,cyclshtg_writemem)
856   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
856   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
857857
858858   MDRV_CPU_ADD(Z80,8000000/2)
859859   MDRV_CPU_PROGRAM_MAP(cyclshtg_readmem_sub,cyclshtg_writemem_sub)
860   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
860   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
861861
862862   MDRV_CPU_ADD(Z80,8000000/2)
863863   /* audio CPU */
864864   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
865   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
865   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
866866
867867#ifdef USE_MCU
868868   MDRV_CPU_ADD(M68705,2000000)
r1877r1878
905905   MDRV_CPU_ADD(Z80,8000000/2)
906906
907907   MDRV_CPU_PROGRAM_MAP(bronx_readmem, bronx_writemem)
908   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
908   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
909909
910910   MDRV_CPU_ADD(Z80,8000000/2)
911911   MDRV_CPU_PROGRAM_MAP(bronx_readmem_sub, bronx_writemem_sub)
912912   MDRV_CPU_IO_MAP(bronx_io, 0)
913913
914   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
914   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
915915
916916   MDRV_CPU_ADD(Z80,8000000/2)
917917   /* audio CPU */
918918   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
919   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
919   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
920920
921921   MDRV_INTERLEAVE(2)
922922   MDRV_MACHINE_RESET(ta7630)
src/mame/drivers/mitchell.c
r1877r1878
193193      if (pang_port5_kludge)   /* hack... music doesn't work otherwise */
194194         bit ^= 0x08;
195195
196   return (input_port_0_r(0) & 0x76) | bit;
196   return (input_port_0_r(machine,0) & 0x76) | bit;
197197}
198198
199199static WRITE8_HANDLER( eeprom_cs_w )
r1877r1878
307307         return readinputport(1 + offset);
308308         break;
309309      case 1:   /* Mahjong games */
310         if (offset) return mahjong_input_r(offset-1);
310         if (offset) return mahjong_input_r(machine,offset-1);
311311         else return readinputport(1);
312312         break;
313313      case 2:   /* Block Block - dial control */
314         if (offset) return block_input_r(offset-1);
314         if (offset) return block_input_r(machine,offset-1);
315315         else return readinputport(1);
316316         break;
317317      case 3:   /* Super Pang - simulate START 1 press to initialize EEPROM */
r1877r1878
335335logerror("PC %04x: write %02x to port 01\n",activecpu_get_pc(),data);
336336         break;
337337      case 1:
338         mahjong_input_select_w(offset,data);
338         mahjong_input_select_w(machine,offset,data);
339339         break;
340340      case 2:
341         block_dial_control_w(offset,data);
341         block_dial_control_w(machine,offset,data);
342342         break;
343343   }
344344}
r1877r1878
483483
484484static WRITE8_HANDLER(mstworld_sound_w)
485485{
486   soundlatch_w(0,data);
487   cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
486   soundlatch_w(machine,0,data);
487   cpunum_set_input_line(machine, 1,0,HOLD_LINE);
488488}
489489
490490extern WRITE8_HANDLER( mstworld_gfxctrl_w );
r1877r1878
13311331   MDRV_CPU_ADD(Z80, 6000000)   /* ??? */
13321332   MDRV_CPU_PROGRAM_MAP(mgakuen_readmem,mgakuen_writemem)
13331333   MDRV_CPU_IO_MAP(readport,writeport)
1334   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)   /* ??? one extra irq seems to be needed for music (see input5_r) */
1334   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)   /* ??? one extra irq seems to be needed for music (see input5_r) */
13351335
13361336   /* video hardware */
13371337   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
13651365   MDRV_CPU_ADD_TAG("main",Z80, 8000000)   /* (verified on pcb) */
13661366   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
13671367   MDRV_CPU_IO_MAP(readport,writeport)
1368   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)   /* ??? one extra irq seems to be needed for music (see input5_r) */
1368   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)   /* ??? one extra irq seems to be needed for music (see input5_r) */
13691369
13701370   MDRV_NVRAM_HANDLER(mitchell)
13711371
r1877r1878
14361436   MDRV_CPU_MODIFY("main")
14371437   MDRV_CPU_PROGRAM_MAP(spangb_memmap,0)
14381438   MDRV_CPU_IO_MAP(spangb_portmap,0)
1439   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1439   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
14401440
14411441   MDRV_CPU_ADD_TAG("sound",Z80, 8000000)
14421442   MDRV_CPU_PROGRAM_MAP(spangb_sound_memmap,0 )
14431443   MDRV_CPU_IO_MAP(spangb_sound_portmap,0)
1444   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1445//  MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
1444   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
1445//  MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
14461446
14471447   MDRV_GFXDECODE(spangbl)
14481448
r1877r1878
14641464
14651465   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
14661466   MDRV_CPU_IO_MAP(mstworld_readport,mstworld_writeport)
1467   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1467   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
14681468
14691469   MDRV_CPU_ADD(Z80,6000000)       /* 6 MHz? */
14701470   /* audio CPU */
r1877r1878
14991499   MDRV_CPU_ADD(Z80, 8000000)   /* Super Pang says 8MHZ ORIGINAL BOARD */
15001500   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
15011501   MDRV_CPU_IO_MAP(readport,writeport)
1502   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)   /* ??? one extra irq seems to be needed for music (see input5_r) */
1502   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)   /* ??? one extra irq seems to be needed for music (see input5_r) */
15031503
15041504   MDRV_NVRAM_HANDLER(mitchell)
15051505
src/mame/drivers/rainbow.c
r1877r1878
618618   /* basic machine hardware */
619619   MDRV_CPU_ADD(M68000, XTAL_16MHz/2) /* verified on pcb */
620620   MDRV_CPU_PROGRAM_MAP(rainbow_readmem,rainbow_writemem)
621   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
621   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
622622
623623   MDRV_CPU_ADD(Z80, XTAL_16MHz/4) /* verified on pcb */
624624   MDRV_CPU_PROGRAM_MAP(rainbow_s_readmem,rainbow_s_writemem)
r1877r1878
654654   /* basic machine hardware */
655655   MDRV_CPU_ADD(M68000, 8000000)
656656   MDRV_CPU_PROGRAM_MAP(jumping_readmem,jumping_writemem)
657   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
657   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
658658
659659   MDRV_CPU_ADD(Z80, 4000000)
660660   MDRV_CPU_PROGRAM_MAP(jumping_sound_readmem,jumping_sound_writemem)
src/mame/drivers/galspnbl.c
r1877r1878
2525#include "sound/3812intf.h"
2626
2727
28extern UINT16 *galspnbl_bgvideoram,*galspnbl_videoram,*galspnbl_colorram;
28extern UINT16 *galspnbl_bgvideoram;
29extern UINT16 *galspnbl_videoram;
30extern UINT16 *galspnbl_colorram;
31extern UINT16 *galspnbl_scroll;
2932
3033PALETTE_INIT( galspnbl );
31WRITE16_HANDLER( galspnbl_bgvideoram_w );
32WRITE16_HANDLER( galspnbl_scroll_w );
3334VIDEO_UPDATE( galspnbl );
3435
3536
r1877r1878
3738{
3839   if (ACCESSING_LSB)
3940   {
40      soundlatch_w(offset,data & 0xff);
41      cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
41      soundlatch_w(machine,offset,data & 0xff);
42      cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
4243   }
4344}
4445
4546
46static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 16 )
47   AM_RANGE(0x000000, 0x3fffff) AM_READ(MRA16_ROM)
48   AM_RANGE(0x700000, 0x703fff) AM_READ(MRA16_RAM)   /* galspnbl */
49   AM_RANGE(0x708000, 0x70ffff) AM_READ(MRA16_RAM)   /* galspnbl */
50   AM_RANGE(0x800000, 0x803fff) AM_READ(MRA16_RAM)   /* hotpinbl */
51   AM_RANGE(0x808000, 0x80ffff) AM_READ(MRA16_RAM)   /* hotpinbl */
52   AM_RANGE(0x880000, 0x880fff) AM_READ(MRA16_RAM)
53   AM_RANGE(0x900000, 0x900fff) AM_READ(MRA16_RAM)
54   AM_RANGE(0x904000, 0x904fff) AM_READ(MRA16_RAM)
55   AM_RANGE(0x980000, 0x9bffff) AM_READ(MRA16_RAM)
56   AM_RANGE(0xa80000, 0xa80001) AM_READ(input_port_0_word_r)
57   AM_RANGE(0xa80010, 0xa80011) AM_READ(input_port_1_word_r)
58   AM_RANGE(0xa80020, 0xa80021) AM_READ(input_port_2_word_r)
59   AM_RANGE(0xa80030, 0xa80031) AM_READ(input_port_3_word_r)
60   AM_RANGE(0xa80040, 0xa80041) AM_READ(input_port_4_word_r)
61ADDRESS_MAP_END
62
63static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 16 )
64   AM_RANGE(0x000000, 0x3fffff) AM_WRITE(MWA16_ROM)
65   AM_RANGE(0x700000, 0x703fff) AM_WRITE(MWA16_RAM)   /* galspnbl work RAM */
66   AM_RANGE(0x708000, 0x70ffff) AM_WRITE(MWA16_RAM)   /* galspnbl work RAM, bitmaps are decompressed here */
67   AM_RANGE(0x800000, 0x803fff) AM_WRITE(MWA16_RAM)   /* hotpinbl work RAM */
68   AM_RANGE(0x808000, 0x80ffff) AM_WRITE(MWA16_RAM)   /* hotpinbl work RAM, bitmaps are decompressed here */
69   AM_RANGE(0x880000, 0x880fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
47static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
48   AM_RANGE(0x000000, 0x3fffff) AM_ROM
49   AM_RANGE(0x700000, 0x703fff) AM_RAM      /* galspnbl work RAM */
50   AM_RANGE(0x708000, 0x70ffff) AM_RAM      /* galspnbl work RAM, bitmaps are decompressed here */
51   AM_RANGE(0x800000, 0x803fff) AM_RAM      /* hotpinbl work RAM */
52   AM_RANGE(0x808000, 0x80ffff) AM_RAM      /* hotpinbl work RAM, bitmaps are decompressed here */
53   AM_RANGE(0x880000, 0x880fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
7054   AM_RANGE(0x8ff400, 0x8fffff) AM_WRITE(MWA16_NOP)   /* ??? */
71   AM_RANGE(0x900000, 0x900fff) AM_WRITE(MWA16_RAM) AM_BASE(&galspnbl_colorram)
55   AM_RANGE(0x900000, 0x900fff) AM_RAM AM_BASE(&galspnbl_colorram)
7256   AM_RANGE(0x901000, 0x903fff) AM_WRITE(MWA16_NOP)   /* ??? */
73   AM_RANGE(0x904000, 0x904fff) AM_WRITE(MWA16_RAM) AM_BASE(&galspnbl_videoram)
57   AM_RANGE(0x904000, 0x904fff) AM_RAM AM_BASE(&galspnbl_videoram)
7458   AM_RANGE(0x905000, 0x907fff) AM_WRITE(MWA16_NOP)   /* ??? */
75   AM_RANGE(0x980000, 0x9bffff) AM_WRITE(galspnbl_bgvideoram_w) AM_BASE(&galspnbl_bgvideoram)
59   AM_RANGE(0x980000, 0x9bffff) AM_RAM AM_BASE(&galspnbl_bgvideoram)
7660   AM_RANGE(0xa00000, 0xa00fff) AM_WRITE(MWA16_NOP)   /* more palette ? */
7761   AM_RANGE(0xa01000, 0xa017ff) AM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE(&paletteram16)
7862   AM_RANGE(0xa01800, 0xa027ff) AM_WRITE(MWA16_NOP)   /* more palette ? */
79   AM_RANGE(0xa80010, 0xa80011) AM_WRITE(soundcommand_w)
80   AM_RANGE(0xa80020, 0xa80021) AM_WRITE(MWA16_NOP)   /* could be watchdog, but causes resets when picture is shown */
81   AM_RANGE(0xa80030, 0xa80031) AM_WRITE(MWA16_NOP)   /* irq ack? */
82   AM_RANGE(0xa80050, 0xa80051) AM_WRITE(galspnbl_scroll_w)
63   AM_RANGE(0xa80000, 0xa80001) AM_READ(input_port_0_word_r)
64   AM_RANGE(0xa80010, 0xa80011) AM_READWRITE(input_port_1_word_r, soundcommand_w)
65   AM_RANGE(0xa80020, 0xa80021) AM_READWRITE(input_port_2_word_r, MWA16_NOP)   /* w - could be watchdog, but causes resets when picture is shown */
66   AM_RANGE(0xa80030, 0xa80031) AM_READWRITE(input_port_3_word_r, MWA16_NOP)   /* w - irq ack? */
67   AM_RANGE(0xa80040, 0xa80041) AM_READ(input_port_4_word_r)
68   AM_RANGE(0xa80050, 0xa80051) AM_WRITE(MWA16_RAM) AM_BASE(&galspnbl_scroll)   /* ??? */
8369ADDRESS_MAP_END
8470
85static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
86   AM_RANGE(0x0000, 0xefff) AM_READ(MRA8_ROM)
87   AM_RANGE(0xf000, 0xf7ff) AM_READ(MRA8_RAM)
88   AM_RANGE(0xf800, 0xf800) AM_READ(OKIM6295_status_0_r)
89   AM_RANGE(0xfc00, 0xfc00) AM_READ(MRA8_NOP)   /* irq ack ?? */
90   AM_RANGE(0xfc20, 0xfc20) AM_READ(soundlatch_r)
91ADDRESS_MAP_END
92
93static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
94   AM_RANGE(0x0000, 0xefff) AM_WRITE(MWA8_ROM)
95   AM_RANGE(0xf000, 0xf7ff) AM_WRITE(MWA8_RAM)
96   AM_RANGE(0xf800, 0xf800) AM_WRITE(OKIM6295_data_0_w)
71static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 )
72   AM_RANGE(0x0000, 0xefff) AM_ROM
73   AM_RANGE(0xf000, 0xf7ff) AM_RAM
74   AM_RANGE(0xf800, 0xf800) AM_READWRITE(OKIM6295_status_0_r, OKIM6295_data_0_w)
9775   AM_RANGE(0xf810, 0xf810) AM_WRITE(YM3812_control_port_0_w)
9876   AM_RANGE(0xf811, 0xf811) AM_WRITE(YM3812_write_port_0_w)
99   AM_RANGE(0xfc00, 0xfc00) AM_WRITE(MWA8_NOP)   /* irq ack ?? */
77   AM_RANGE(0xfc00, 0xfc00) AM_READWRITE(MRA8_NOP, MWA8_NOP)   /* irq ack ?? */
78   AM_RANGE(0xfc20, 0xfc20) AM_READ(soundlatch_r)
10079ADDRESS_MAP_END
10180
10281
r1877r1878
301280
302281   /* basic machine hardware */
303282   MDRV_CPU_ADD(M68000, 10000000)   /* 10 MHz ??? */
304   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
305   MDRV_CPU_VBLANK_INT(irq3_line_hold,1)/* also has vector for 6, but it does nothing */
283   MDRV_CPU_PROGRAM_MAP(main_map,0)
284   MDRV_CPU_VBLANK_INT("main", irq3_line_hold)/* also has vector for 6, but it does nothing */
306285
307286   MDRV_CPU_ADD(Z80, 4000000)
308287   /* audio CPU */   /* 4 MHz ??? */
309   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
288   MDRV_CPU_PROGRAM_MAP(audio_map,0)
310289                        /* NMI is caused by the main CPU */
311290
312291   /* video hardware */
r1877r1878
321300   MDRV_PALETTE_LENGTH(1024 + 32768)
322301
323302   MDRV_PALETTE_INIT(galspnbl)
324   MDRV_VIDEO_START(generic_bitmapped)
325303   MDRV_VIDEO_UPDATE(galspnbl)
326304
327305   /* sound hardware */
src/mame/drivers/blktiger.c
r1877r1878
255255   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz (?) */
256256   MDRV_CPU_PROGRAM_MAP(mem_map, 0)
257257   MDRV_CPU_IO_MAP(port_map, 0)
258   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
258   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
259259
260260   MDRV_CPU_ADD(Z80, 3000000)
261261   /* audio CPU */
src/mame/drivers/dynduke.c
r1877r1878
270270   // basic machine hardware
271271   MDRV_CPU_ADD_TAG("main", V30, 16000000/2) // NEC V30-8 CPU
272272   MDRV_CPU_PROGRAM_MAP(master_map, 0)
273   MDRV_CPU_VBLANK_INT(dynduke_interrupt, 1)
273   MDRV_CPU_VBLANK_INT("main", dynduke_interrupt)
274274
275275   MDRV_CPU_ADD(V30, 16000000/2) // NEC V30-8 CPU
276276   MDRV_CPU_PROGRAM_MAP(slave_map, 0)
277   MDRV_CPU_VBLANK_INT(dynduke_interrupt, 1)
277   MDRV_CPU_VBLANK_INT("main", dynduke_interrupt)
278278
279279   SEIBU_SOUND_SYSTEM_CPU(14318180/4)
280280
src/mame/drivers/deco_mlc.c
r1877r1878
168168static READ32_HANDLER( avengrs_sound_r )
169169{
170170   if (mem_mask==0x00ffffff) {
171      return YMZ280B_status_0_r(0)<<24;
171      return YMZ280B_status_0_r(machine,0)<<24;
172172   } else {
173173      logerror("%08x:  non-byte read from sound mask %08x\n",activecpu_get_pc(),mem_mask);
174174   }
r1877r1878
180180{
181181   if (mem_mask==0x00ffffff) {
182182      if (offset)
183         YMZ280B_data_0_w(0,data>>24);
183         YMZ280B_data_0_w(machine,0,data>>24);
184184      else
185         YMZ280B_register_0_w(0,data>>24);
185         YMZ280B_register_0_w(machine,0,data>>24);
186186   } else {
187187      logerror("%08x:  non-byte written to sound %08x mask %08x\n",activecpu_get_pc(),data,mem_mask);
188188   }
src/mame/drivers/tunhunt.c
r1877r1878
4949***************************************************************************/
5050
5151#include "driver.h"
52#include "deprecat.h"
5253#include "sound/pokey.h"
5354
5455
r1877r1878
319320   /* basic machine hardware */
320321   MDRV_CPU_ADD(M6502,2000000)      /* ??? */
321322   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
322   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)   /* ? probably wrong */
323   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)   /* ? probably wrong */
323324
324325   /* video hardware */
325326   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/tryout.c
r1877r1878
3535
3636static WRITE8_HANDLER( tryout_sound_w )
3737{
38   soundlatch_w(0,data);
39   cpunum_set_input_line(Machine, 1, 0, PULSE_LINE );
38   soundlatch_w(machine,0,data);
39   cpunum_set_input_line(machine, 1, 0, PULSE_LINE );
4040}
4141
4242static WRITE8_HANDLER( tryout_sound_irq_ack_w )
4343{
44   cpunum_set_input_line(Machine, 1, 0, CLEAR_LINE );
44   cpunum_set_input_line(machine, 1, 0, CLEAR_LINE );
4545}
4646
4747static WRITE8_HANDLER( tryout_bankswitch_w )
r1877r1878
183183
184184static INTERRUPT_GEN( tryout_interrupt )
185185{
186   if ((input_port_3_r(0) & 0x1c)!=0x1c)
186   if ((input_port_3_r(machine,0) & 0x1c)!=0x1c)
187187      cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, ASSERT_LINE);
188188}
189189
r1877r1878
191191   /* basic machine hardware */
192192   MDRV_CPU_ADD(M6502, 2000000)       /* ? */
193193   MDRV_CPU_PROGRAM_MAP(main_cpu,0)
194   MDRV_CPU_VBLANK_INT(tryout_interrupt,1)
194   MDRV_CPU_VBLANK_INT("main", tryout_interrupt)
195195
196196   MDRV_CPU_ADD(M6502, 1500000)      /* ? */
197197   /* audio CPU */
198198   MDRV_CPU_PROGRAM_MAP(sound_cpu,0)
199   MDRV_CPU_VBLANK_INT(nmi_line_pulse,16) /* ? */
199   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,16) /* ? */
200200
201201   /* video hardware */
202202   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/pasha2.c
r1877r1878
141141   switch(mem_mask)
142142   {
143143      case 0:
144         bitmap_1_w(offset,data,0x00ff);
145         bitmap_1_w(offset,data,0xff00);
144         bitmap_1_w(machine,offset,data,0x00ff);
145         bitmap_1_w(machine,offset,data,0xff00);
146146         return;
147147
148148      case 0x00ff:
r1877r1878
162162static READ16_HANDLER( oki_0_r )
163163{
164164   if(offset)
165      return OKIM6295_status_0_r(0);
165      return OKIM6295_status_0_r(machine, 0);
166166   else
167167      return 0;
168168}
r1877r1878
170170static WRITE16_HANDLER( oki_0_w )
171171{
172172   if(offset)
173      OKIM6295_data_0_w(0, data);
173      OKIM6295_data_0_w(machine, 0, data);
174174}
175175
176176static WRITE16_HANDLER( oki_1_w )
177177{
178178   if(offset)
179      OKIM6295_data_1_w(0, data);
179      OKIM6295_data_1_w(machine, 0, data);
180180}
181181
182182static READ16_HANDLER( oki_1_r )
183183{
184184   if(offset)
185      return OKIM6295_status_1_r(0);
185      return OKIM6295_status_1_r(machine, 0);
186186   else
187187      return 0;
188188}
r1877r1878
390390   MDRV_CPU_ADD(E116XT, 20000000*4)      /* 4x internal multiplier */
391391   MDRV_CPU_PROGRAM_MAP(pasha2_map,0)
392392   MDRV_CPU_IO_MAP(pasha2_io,0)
393   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
393   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
394394
395395   MDRV_NVRAM_HANDLER(93C46)
396396
src/mame/drivers/rungun.c
r1877r1878
119119                bit8 : freeze
120120                bit9 : joysticks layout(auto detect???)
121121            */
122         return(input_port_0_word_r(0, 0));
122         return(input_port_0_word_r(machine, 0, 0));
123123      break;
124124
125125      case 0x06/2:
r1877r1878
181181static WRITE16_HANDLER( sound_cmd1_w )
182182{
183183   if (ACCESSING_MSB)
184      soundlatch_w(0, data>>8);
184      soundlatch_w(machine, 0, data>>8);
185185}
186186
187187static WRITE16_HANDLER( sound_cmd2_w )
188188{
189189   if (ACCESSING_MSB)
190      soundlatch2_w(0, data>>8);
190      soundlatch2_w(machine, 0, data>>8);
191191}
192192
193193static WRITE16_HANDLER( sound_irq_w )
r1877r1878
331331   /* basic machine hardware */
332332   MDRV_CPU_ADD_TAG("main", M68000, 16000000)
333333   MDRV_CPU_PROGRAM_MAP(rngreadmem,rngwritemem)
334   MDRV_CPU_VBLANK_INT(rng_interrupt,1)
334   MDRV_CPU_VBLANK_INT("main", rng_interrupt)
335335
336336   MDRV_CPU_ADD_TAG("sound", Z80, 10000000) // 8Mhz (10Mhz is much safer in self-test due to heavy sync)
337337   /* audio CPU */
src/mame/drivers/crystal.c
r1877r1878
222222      if(IntPend&(1<<i))
223223      {
224224         return (IntHigh<<5)|i;
225         break;
226225      }
227226   }
228227   return 0;      //This should never happen
r1877r1878
618617{
619618}
620619
621static void plot_pixel_rgb(mame_bitmap *bitmap, int x, int y , int color)
620static void plot_pixel_rgb(bitmap_t *bitmap, int x, int y , int color)
622621{
623622   //565 to 555
624623   color=(color&0x1f)|((color>>1)&0x7fe0);
r1877r1878
824823static MACHINE_DRIVER_START( crystal )
825824   MDRV_CPU_ADD(SE3208, 43000000)
826825   MDRV_CPU_PROGRAM_MAP(crystal_mem,0)
827    MDRV_CPU_VBLANK_INT(crystal_interrupt,1)
826    MDRV_CPU_VBLANK_INT("main", crystal_interrupt)
828827
829828   MDRV_MACHINE_RESET(crystal)
830829
src/mame/drivers/madmotor.c
r1877r1878
4343{
4444   if (ACCESSING_LSB)
4545   {
46      soundlatch_w(0,data & 0xff);
47      cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
46      soundlatch_w(machine,0,data & 0xff);
47      cpunum_set_input_line(machine, 1,0,HOLD_LINE);
4848   }
4949}
5050
r1877r1878
8989{
9090   switch (offset) {
9191   case 0:
92      YM2151_register_port_0_w(0,data);
92      YM2151_register_port_0_w(machine,0,data);
9393      break;
9494   case 1:
95      YM2151_data_port_0_w(0,data);
95      YM2151_data_port_0_w(machine,0,data);
9696      break;
9797   }
9898}
r1877r1878
101101{
102102   switch (offset) {
103103   case 0:
104      YM2203_control_port_0_w(0,data);
104      YM2203_control_port_0_w(machine,0,data);
105105      break;
106106   case 1:
107      YM2203_write_port_0_w(0,data);
107      YM2203_write_port_0_w(machine,0,data);
108108      break;
109109   }
110110}
r1877r1878
287287   /* basic machine hardware */
288288   MDRV_CPU_ADD(M68000, 12000000) /* Custom chip 59, 24 MHz crystal */
289289   MDRV_CPU_PROGRAM_MAP(madmotor_readmem,madmotor_writemem)
290   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)/* VBL */
290   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)/* VBL */
291291
292292   MDRV_CPU_ADD(H6280, 8053000/2) /* Custom chip 45, Crystal near CPU is 8.053 MHz */
293293   /* audio CPU */
src/mame/drivers/eprom.c
r1877r1878
420420   /* basic machine hardware */
421421   MDRV_CPU_ADD(M68000, ATARI_CLOCK_14MHz/2)
422422   MDRV_CPU_PROGRAM_MAP(main_map,0)
423   MDRV_CPU_VBLANK_INT(atarigen_video_int_gen,1)
423   MDRV_CPU_VBLANK_INT("main", atarigen_video_int_gen)
424424
425425   MDRV_CPU_ADD(M68000, ATARI_CLOCK_14MHz/2)
426426   MDRV_CPU_PROGRAM_MAP(extra_map,0)
r1877r1878
454454   /* basic machine hardware */
455455   MDRV_CPU_ADD(M68000, ATARI_CLOCK_14MHz/2)
456456   MDRV_CPU_PROGRAM_MAP(main_map,0)
457   MDRV_CPU_VBLANK_INT(atarigen_video_int_gen,1)
457   MDRV_CPU_VBLANK_INT("main", atarigen_video_int_gen)
458458
459459   MDRV_INTERLEAVE(10)
460460
r1877r1878
484484   /* basic machine hardware */
485485   MDRV_CPU_ADD_TAG("main", M68000, ATARI_CLOCK_14MHz/2)
486486   MDRV_CPU_PROGRAM_MAP(guts_map,0)
487   MDRV_CPU_VBLANK_INT(atarigen_video_int_gen,1)
487   MDRV_CPU_VBLANK_INT("main", atarigen_video_int_gen)
488488
489489   MDRV_INTERLEAVE(10)
490490
src/mame/drivers/bublbobl.c
r1877r1878
736736   // basic machine hardware
737737   MDRV_CPU_ADD(Z80, MAIN_XTAL/4)   // 6 MHz
738738   MDRV_CPU_PROGRAM_MAP(tokio_map, 0)
739   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
739   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
740740
741741   MDRV_CPU_ADD(Z80, MAIN_XTAL/4)   // 6 MHz
742742   MDRV_CPU_PROGRAM_MAP(tokio_slave_map, 0)
743   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
743   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
744744
745745   MDRV_CPU_ADD(Z80, MAIN_XTAL/8)
746746   /* audio CPU */   // 3 MHz
r1877r1878
781781
782782   MDRV_CPU_ADD(Z80, MAIN_XTAL/4)   // 6 MHz
783783   MDRV_CPU_PROGRAM_MAP(slave_map, 0)
784   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
784   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
785785
786786   MDRV_CPU_ADD(Z80, MAIN_XTAL/8)
787787   /* audio CPU */   // 3 MHz
r1877r1878
789789
790790   MDRV_CPU_ADD_TAG("mcu", M6801, 4000000)   // actually 6801U4  // xtal is 4MHz, divided by 4 internally
791791   MDRV_CPU_PROGRAM_MAP(mcu_map, 0)
792   MDRV_CPU_VBLANK_INT(irq0_line_pulse, 1) // comes from the same clock that latches the INT pin on the second Z80
792   MDRV_CPU_VBLANK_INT("main", irq0_line_pulse) // comes from the same clock that latches the INT pin on the second Z80
793793
794794   MDRV_INTERLEAVE(100) // 100 CPU slices per frame - a high value to ensure proper synchronization of the CPUs
795795
r1877r1878
825825   // basic machine hardware
826826   MDRV_CPU_MODIFY("main")
827827   MDRV_CPU_PROGRAM_MAP(bootleg_map, 0)
828   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)   // interrupt mode 1, unlike Bubble Bobble
828   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   // interrupt mode 1, unlike Bubble Bobble
829829
830830   MDRV_CPU_REMOVE("mcu")
831831MACHINE_DRIVER_END
r1877r1878
837837
838838   MDRV_CPU_ADD_TAG("mcu", M68705, 4000000)   // xtal is 4MHz, divided by 4 internally
839839   MDRV_CPU_PROGRAM_MAP(bootlegmcu_map, 0)
840   MDRV_CPU_VBLANK_INT(bublbobl_m68705_interrupt, 2) // ??? should come from the same clock which latches the INT pin on the second Z80
840   MDRV_CPU_VBLANK_INT_HACK(bublbobl_m68705_interrupt, 2) // ??? should come from the same clock which latches the INT pin on the second Z80
841841MACHINE_DRIVER_END
842842
843843
src/mame/drivers/chinsan.c
r1877r1878
461461   MDRV_CPU_ADD(Z80,10000000/2)       /* ? MHz */
462462   MDRV_CPU_PROGRAM_MAP(chinsan_map,0)
463463   MDRV_CPU_IO_MAP(chinsan_io,0)
464   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
464   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
465465
466466   MDRV_MACHINE_RESET( chinsan )
467467
src/mame/drivers/skyfox.c
r1877r1878
256256   /* basic machine hardware */
257257   MDRV_CPU_ADD(Z80, 4000000)
258258   MDRV_CPU_PROGRAM_MAP(skyfox_readmem,skyfox_writemem)
259   MDRV_CPU_VBLANK_INT(skyfox_interrupt,1)      /* NMI caused by coin insertion */
259   MDRV_CPU_VBLANK_INT("main", skyfox_interrupt)      /* NMI caused by coin insertion */
260260
261261   MDRV_CPU_ADD(Z80, 1748000)
262262   /* audio CPU */
src/mame/drivers/cshooter.c
r1877r1878
9595
9696static void ar_coin_hack(void)
9797{
98   if(input_port_5_r(0)&1)
98   if(input_port_5_r(Machine,0)&1)
9999   {
100100      if(coin_stat==0)
101101      {
r1877r1878
221221   /* Even reads must return 0xff - Odd reads must return the contents of input port 5.
222222       Code at 0x5061 is executed once during P.O.S.T. where there is one read.
223223       Code at 0x50b4 is then executed each frame (not sure) where there are 2 reads. */
224
225   return ( (cshooter_counter++ & 1) ? 0xff : input_port_5_r(0) );
224   return ( (cshooter_counter++ & 1) ? 0xff : input_port_5_r(machine,0) );
226225}
227226
228227static WRITE8_HANDLER ( cshooter_c500_w )
r1877r1878
473472   MDRV_CPU_ADD(Z80,6000000)       /* ? MHz */
474473   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
475474   MDRV_CPU_IO_MAP(readport,writeport)
476   MDRV_CPU_VBLANK_INT(cshooter_interrupt,2)
475   MDRV_CPU_VBLANK_INT_HACK(cshooter_interrupt,2)
477476
478477   MDRV_CPU_ADD(Z80,6000000)       /* ? MHz */
479478   MDRV_CPU_PROGRAM_MAP(s_readmem,s_writemem)
r1877r1878
502501   MDRV_CPU_ADD(Z80,6000000)       /* ? MHz */
503502   MDRV_CPU_PROGRAM_MAP(arreadmem,arwritemem)
504503   MDRV_CPU_IO_MAP(readport,writeport)
505   MDRV_CPU_VBLANK_INT(cshooter_interrupt,2)
504   MDRV_CPU_VBLANK_INT_HACK(cshooter_interrupt,2)
506505
507506   MDRV_CPU_ADD(Z80,6000000)       /* ? MHz */
508507   MDRV_CPU_PROGRAM_MAP(s2_readmem,s2_writemem)
src/mame/drivers/aerofgt.c
r1877r1878
108108   if (ACCESSING_LSB)
109109   {
110110      pending_command = 1;
111      soundlatch_w(offset,data & 0xff);
112      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
111      soundlatch_w(machine,offset,data & 0xff);
112      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
113113   }
114114}
115115
r1877r1878
118118   if (ACCESSING_MSB)
119119   {
120120      pending_command = 1;
121      soundlatch_w(offset,(data >> 8) & 0xff);
122      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
121      soundlatch_w(machine,offset,(data >> 8) & 0xff);
122      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
123123   }
124124}
125125
r1877r1878
127127{
128128   if(data & 0x8000)
129129   {
130      soundlatch_w(0,data & 0xff);
131      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
130      soundlatch_w(machine,0,data & 0xff);
131      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
132132   }
133133}
134134
r1877r1878
151151
152152static MACHINE_RESET( aerofgt )
153153{
154   aerofgt_sh_bankswitch_w(0,0);   /* needed by spinlbrk */
154   aerofgt_sh_bankswitch_w(machine,0,0);   /* needed by spinlbrk */
155155}
156156
157157
r1877r1878
12641264   /* basic machine hardware */
12651265   MDRV_CPU_ADD(M68000,20000000/2)   /* 10 MHz (?) */
12661266   MDRV_CPU_PROGRAM_MAP(pspikes_map,0)
1267   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)/* all irq vectors are the same */
1267   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)/* all irq vectors are the same */
12681268
12691269   MDRV_CPU_ADD(Z80,8000000/2) /* 4 MHz ??? */
12701270   MDRV_CPU_PROGRAM_MAP(sound_map,0)
r1877r1878
13031303/* basic machine hardware */
13041304   MDRV_CPU_ADD(M68000,20000000/2)   /* 10 MHz (?) */
13051305   MDRV_CPU_PROGRAM_MAP(pallavol_map,0)
1306   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)/* all irq vectors are the same */
1306   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)/* all irq vectors are the same */
13071307
13081308   /* + Z80 for sound */
13091309
r1877r1878
13341334   /* basic machine hardware */
13351335   MDRV_CPU_ADD(M68000,20000000/2)   /* 10 MHz (?) */
13361336   MDRV_CPU_PROGRAM_MAP(pspikesb_map,0)
1337   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)/* all irq vectors are the same */
1337   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)/* all irq vectors are the same */
13381338
13391339   /* video hardware */
13401340   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
13621362   /* basic machine hardware */
13631363   MDRV_CPU_ADD(M68000,20000000/2)   /* 10 MHz (?) */
13641364   MDRV_CPU_PROGRAM_MAP(pspikesc_map,0)
1365   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)/* all irq vectors are the same */
1365   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)/* all irq vectors are the same */
13661366
13671367   /* video hardware */
13681368   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
13901390   /* basic machine hardware */
13911391   MDRV_CPU_ADD(M68000,20000000/2)   /* 10 MHz (?) */
13921392   MDRV_CPU_PROGRAM_MAP(karatblz_map,0)
1393   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
1393   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
13941394
13951395   MDRV_CPU_ADD(Z80,8000000/2) /* 4 MHz ??? */
13961396   MDRV_CPU_PROGRAM_MAP(sound_map,0)
r1877r1878
14281428   /* basic machine hardware */
14291429   MDRV_CPU_ADD(M68000,20000000/2)   /* 10 MHz (?) */
14301430   MDRV_CPU_PROGRAM_MAP(spinlbrk_map,0)
1431   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)/* there are vectors for 3 and 4 too */
1431   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)/* there are vectors for 3 and 4 too */
14321432
14331433   MDRV_CPU_ADD(Z80,8000000/2) /* 4 MHz ??? */
14341434   MDRV_CPU_PROGRAM_MAP(sound_map,0)
r1877r1878
14661466   /* basic machine hardware */
14671467   MDRV_CPU_ADD(M68000,20000000/2)   /* 10 MHz (verified on pcb) */
14681468   MDRV_CPU_PROGRAM_MAP(turbofrc_map,0)
1469   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)/* all irq vectors are the same */
1469   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)/* all irq vectors are the same */
14701470
14711471   MDRV_CPU_ADD(Z80,5000000) /* 5 MHz (verified on pcb) */
14721472   MDRV_CPU_PROGRAM_MAP(sound_map,0)
r1877r1878
15041504   /* basic machine hardware */
15051505   MDRV_CPU_ADD(M68000,20000000/2)   /* 10 MHz (?) */
15061506   MDRV_CPU_PROGRAM_MAP(aerofgtb_map,0)
1507   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)/* all irq vectors are the same */
1507   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)/* all irq vectors are the same */
15081508
15091509   MDRV_CPU_ADD(Z80,8000000/2) /* 4 MHz ??? */
15101510   MDRV_CPU_PROGRAM_MAP(sound_map,0)
r1877r1878
15431543   /* basic machine hardware */
15441544   MDRV_CPU_ADD(M68000,20000000/2)   /* 10 MHz (verified on pcb) */
15451545   MDRV_CPU_PROGRAM_MAP(aerofgt_map,0)
1546   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)/* all irq vectors are the same */
1546   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)/* all irq vectors are the same */
15471547
15481548   MDRV_CPU_ADD(Z80,5000000) /* 5 MHz (verified on pcb) */
15491549   MDRV_CPU_PROGRAM_MAP(sound_map,0)
r1877r1878
15821582   /* basic machine hardware */
15831583   MDRV_CPU_ADD(M68000,20000000/2)   /* 10 MHz (?) */
15841584   MDRV_CPU_PROGRAM_MAP(aerfboot_map,0)
1585   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
1585   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
15861586
15871587   MDRV_CPU_ADD(Z80,8000000/2) /* 4 MHz ??? */
15881588   MDRV_CPU_PROGRAM_MAP(aerfboot_sound_map,0)
r1877r1878
16141614   /* basic machine hardware */
16151615   MDRV_CPU_ADD(M68000,20000000/2)   /* 10 MHz (?) */
16161616   MDRV_CPU_PROGRAM_MAP(wbbc97_map,0)
1617   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)/* all irq vectors are the same */
1617   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)/* all irq vectors are the same */
16181618
16191619   MDRV_CPU_ADD(Z80,8000000/2) /* 4 MHz ??? */
16201620   MDRV_CPU_PROGRAM_MAP(wbbc97_sound_map,0)
src/mame/drivers/rocnrope.c
r1877r1878
223223   /* basic machine hardware */
224224   MDRV_CPU_ADD(M6809, 1600000)        /* 1.6 MHz??? Attract mode depends on this to work correctly */
225225   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
226   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
226   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
227227
228228   /* video hardware */
229229   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/coinmstr.c
r1877r1878
116116   question_adr[offset] = data;
117117}
118118
119static WRITE8_HANDLER( coinmstr_mc6845_address_w )
120{
121   mc6845_address_w(mc6845, data);
122}
123
124static WRITE8_HANDLER( coinmstr_mc6845_register_w )
125{
126   mc6845_register_w(mc6845, data);
127}
128
129119// Common memory map
130120
131121static ADDRESS_MAP_START( coinmstr_map, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
149139   AM_RANGE(0x50, 0x53) AM_READNOP
150140   AM_RANGE(0x50, 0x53) AM_WRITENOP
151141   AM_RANGE(0x58, 0x5b) AM_READWRITE(pia_2_r, pia_2_w)
152   AM_RANGE(0x70, 0x70) AM_WRITE(coinmstr_mc6845_address_w)
153   AM_RANGE(0x71, 0x71) AM_WRITE(coinmstr_mc6845_register_w)
142   AM_RANGE(0x70, 0x70) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
143   AM_RANGE(0x71, 0x71) AM_DEVWRITE(MC6845, "crtc", mc6845_register_w)
154144   AM_RANGE(0xc0, 0xc3) AM_READNOP
155145   AM_RANGE(0xc0, 0xc3) AM_WRITENOP
156146ADDRESS_MAP_END
r1877r1878
159149   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
160150   AM_RANGE(0x00, 0x00) AM_READ(question_r)
161151   AM_RANGE(0x00, 0x03) AM_WRITE(question_w)
162   AM_RANGE(0x40, 0x40) AM_WRITE(coinmstr_mc6845_address_w)
163   AM_RANGE(0x41, 0x41) AM_WRITE(coinmstr_mc6845_register_w)
152   AM_RANGE(0x40, 0x40) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
153   AM_RANGE(0x41, 0x41) AM_DEVWRITE(MC6845, "crtc", mc6845_register_w)
164154   AM_RANGE(0x48, 0x48) AM_WRITE(AY8910_control_port_0_w)
165155   AM_RANGE(0x49, 0x49) AM_READWRITE(AY8910_read_port_0_r, AY8910_write_port_0_w)
166156   AM_RANGE(0x50, 0x53) AM_READWRITE(pia_0_r, pia_0_w) //?
r1877r1878
176166   AM_RANGE(0x40, 0x41) AM_READNOP
177167   AM_RANGE(0x40, 0x43) AM_WRITENOP
178168   AM_RANGE(0x43, 0x43) AM_READNOP
179   AM_RANGE(0x48, 0x48) AM_WRITE(coinmstr_mc6845_address_w)
180   AM_RANGE(0x49, 0x49) AM_WRITE(coinmstr_mc6845_register_w)
169   AM_RANGE(0x48, 0x48) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
170   AM_RANGE(0x49, 0x49) AM_DEVWRITE(MC6845, "crtc", mc6845_register_w)
181171   AM_RANGE(0x50, 0x51) AM_READNOP
182172   AM_RANGE(0x50, 0x53) AM_WRITENOP
183173   AM_RANGE(0x53, 0x53) AM_READNOP
r1877r1878
637627static MACHINE_DRIVER_START( coinmstr )
638628   MDRV_CPU_ADD_TAG("cpu",Z80,8000000) // ?
639629   MDRV_CPU_PROGRAM_MAP(coinmstr_map,0)
640   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
630   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
641631
642632   /* video hardware */
643633   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/docastle.c
r1877r1878
126126*/
127127
128128#include "driver.h"
129#include "deprecat.h"
129130#include "sound/msm5205.h"
130131#include "sound/sn76496.h"
131132#include "includes/docastle.h"
r1877r1878
630631   MDRV_CPU_ADD_TAG("main", Z80, 3900000)   // make dip switches work in docastle and dorunrun
631632   MDRV_CPU_PROGRAM_MAP(docastle_map, 0)
632633   MDRV_CPU_IO_MAP(docastle_io_map, 0)
633   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
634   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
634635
635636   MDRV_CPU_ADD_TAG("slave", Z80, 4000000)   // 4 MHz
636637   MDRV_CPU_PROGRAM_MAP(docastle_map2, 0)
637   MDRV_CPU_VBLANK_INT(irq0_line_hold, 8)
638   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold, 8)
638639
639640   MDRV_CPU_ADD(Z80, 4000000)   // 4 MHz
640641   MDRV_CPU_PROGRAM_MAP(docastle_map3, 0)
641   MDRV_CPU_VBLANK_INT(nmi_line_pulse, 1)
642   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
642643
643644   // video hardware
644645
src/mame/drivers/expro02.c
r1877r1878
317317   /* basic machine hardware */
318318   MDRV_CPU_ADD_TAG("main", M68000, 12000000)
319319   MDRV_CPU_PROGRAM_MAP(galsnew,0)
320   MDRV_CPU_VBLANK_INT(galsnew_interrupt,3)
320   MDRV_CPU_VBLANK_INT_HACK(galsnew_interrupt,3)
321321
322322   /* CALC01 MCU @ 16Mhz (unknown type, simulated) */
323323
src/mame/drivers/ultrsprt.c
r1877r1878
137137
138138   if (ACCESSING_MSB16)
139139   {
140      r |= K054539_0_r(reg+0) << 8;
140      r |= K054539_0_r(machine, reg+0) << 8;
141141   }
142142   if (ACCESSING_LSB16)
143143   {
144      r |= K054539_0_r(reg+1) << 0;
144      r |= K054539_0_r(machine, reg+1) << 0;
145145   }
146146
147147   return r;
r1877r1878
153153
154154   if (ACCESSING_MSB16)
155155   {
156      K054539_0_w(reg+0, (data >> 8) & 0xff);
156      K054539_0_w(machine, reg+0, (data >> 8) & 0xff);
157157   }
158158   if (ACCESSING_LSB16)
159159   {
160      K054539_0_w(reg+1, (data >> 0) & 0xff);
160      K054539_0_w(machine, reg+1, (data >> 0) & 0xff);
161161   }
162162}
163163
r1877r1878
167167
168168   if (!(mem_mask & 0xff00))
169169   {
170      r |= K056800_sound_r((offset*2)+0, 0xffff) << 8;
170      r |= K056800_sound_r(machine, (offset*2)+0, 0xffff) << 8;
171171   }
172172   if (!(mem_mask & 0x00ff))
173173   {
174      r |= K056800_sound_r((offset*2)+1, 0xffff) << 0;
174      r |= K056800_sound_r(machine, (offset*2)+1, 0xffff) << 0;
175175   }
176176
177177   return r;
r1877r1878
181181{
182182   if (!(mem_mask & 0xff00))
183183   {
184      K056800_sound_w((offset*2)+0, (data >> 8) & 0xff, 0xffff);
184      K056800_sound_w(machine, (offset*2)+0, (data >> 8) & 0xff, 0xffff);
185185   }
186186   if (!(mem_mask & 0x00ff))
187187   {
188      K056800_sound_w((offset*2)+1, (data >> 0) & 0xff, 0xffff);
188      K056800_sound_w(machine, (offset*2)+1, (data >> 0) & 0xff, 0xffff);
189189   }
190190}
191191
r1877r1878
273273   MDRV_CPU_ADD(PPC403, 25000000)      /* PowerPC 403GA 25MHz */
274274   MDRV_CPU_CONFIG(ultrsprt_ppc_cfg)
275275   MDRV_CPU_PROGRAM_MAP(ultrsprt_map, 0)
276   MDRV_CPU_VBLANK_INT(ultrsprt_vblank, 1)
276   MDRV_CPU_VBLANK_INT("main", ultrsprt_vblank)
277277
278278   MDRV_CPU_ADD(M68000, 8000000)      /* Not sure about the frequency */
279279   MDRV_CPU_PROGRAM_MAP(sound_map, 0)
src/mame/drivers/mainsnk.c
r1877r1878
117117
118118static READ8_HANDLER( mainsnk_port_0_r )
119119{
120   int result = input_port_0_r( 0 );
120   int result = input_port_0_r( machine, 0 );
121121   if( !sound_cpu_ready ) result |= 0x20;
122122   return result;
123123}
r1877r1878
374374static MACHINE_DRIVER_START( mainsnk )
375375   MDRV_CPU_ADD(Z80, 3360000)
376376   MDRV_CPU_PROGRAM_MAP(main_map,0)
377   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
377   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
378378
379379   MDRV_CPU_ADD(Z80,4000000)
380380   /* audio CPU */
src/mame/drivers/mystston.c
r1877r1878
11/***************************************************************************
22
3Mysterious Stones
3    Technos Mysterious Stones hardware
44
5driver by Nicola Salmoria
5    driver by Nicola Salmoria
66
7Notes:
8- The subtitle of the two sets is slightly different:
9  "dr john s adventure" vs. "dr kick in adventure".
10  The Dr John's is a bug fix. See the routine at 4376/4384 for example. The
11  old set thrashes the Y register, the new one saves in on the stack. The
12  newer set also resets the sound chips more often.
7    Notes:
8        * The subtitle of the two sets is slightly different:
9          "Dr. John's Adventure" vs. "Dr. Kick in Adventure".
10          The Dr John's is a bug fix. See the routine at 4376/4384 for example.
11          The old set thrashes the Y register, the new one saves in on
12          the stack. The newer set also resets the audio chips more often.
1313
1414***************************************************************************/
1515
1616#include "driver.h"
17#include "deprecat.h"
1817#include "sound/ay8910.h"
18#include "mystston.h"
1919
2020
21extern UINT8 *mystston_videoram2;
2221
23extern WRITE8_HANDLER( mystston_videoram_w );
24extern WRITE8_HANDLER( mystston_videoram2_w );
25extern WRITE8_HANDLER( mystston_scroll_w );
26extern WRITE8_HANDLER( mystston_control_w );
22/*************************************
23 *
24 *  Clocks
25 *
26 *************************************/
2727
28extern PALETTE_INIT( mystston );
29extern VIDEO_START( mystston );
30extern VIDEO_UPDATE( mystston );
28#define CPU_CLOCK      (MYSTSTON_MASTER_CLOCK / 8)
29#define AY8910_CLOCK   (MYSTSTON_MASTER_CLOCK / 8)
3130
3231
33static int VBLK = 0x80;
34static int soundlatch;
3532
33/*************************************
34 *
35 *  Interrupt system
36 *
37 *************************************/
3638
37static WRITE8_HANDLER( mystston_soundlatch_w )
39void mystston_on_scanline_interrupt(running_machine *machine)
3840{
39   soundlatch = data;
41   cpunum_set_input_line(machine, 0, 0, ASSERT_LINE);
4042}
4143
42static WRITE8_HANDLER( mystston_soundcontrol_w )
44
45static WRITE8_HANDLER( irq_clear_w )
4346{
44   static int last;
47   cpunum_set_input_line(machine, 0, 0, CLEAR_LINE);
48}
4549
46   /* bit 5 goes to 8910 #0 BDIR pin  */
47   if ((last & 0x20) == 0x20 && (data & 0x20) == 0x00)
50
51
52/*************************************
53 *
54 *  Coin handling
55 *
56 *************************************/
57
58static INPUT_CHANGED( coin_inserted )
59{
60   /* coin insertion causes an NMI */
61   cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE);
62}
63
64
65
66/*************************************
67 *
68 *  AY-8910 memory interface
69 *
70 *************************************/
71
72static WRITE8_HANDLER( mystston_ay8910_select_w )
73{
74   mystston_state *state = machine->driver_data;
75
76   /* bit 5 goes to 8910 #0 BDIR pin */
77   if (((*state->ay8910_select & 0x20) == 0x20) && ((data & 0x20) == 0x00))
4878   {
4979      /* bit 4 goes to the 8910 #0 BC1 pin */
50      if (last & 0x10)
51         AY8910_control_port_0_w(0,soundlatch);
80      if (*state->ay8910_select & 0x10)
81         AY8910_control_port_0_w(machine, 0, *state->ay8910_data);
5282      else
53         AY8910_write_port_0_w(0,soundlatch);
83         AY8910_write_port_0_w(machine, 0, *state->ay8910_data);
5484   }
55   /* bit 7 goes to 8910 #1 BDIR pin  */
56   if ((last & 0x80) == 0x80 && (data & 0x80) == 0x00)
85
86   /* bit 7 goes to 8910 #1 BDIR pin */
87   if (((*state->ay8910_select & 0x80) == 0x80) && ((data & 0x80) == 0x00))
5788   {
5889      /* bit 6 goes to the 8910 #1 BC1 pin */
59      if (last & 0x40)
60         AY8910_control_port_1_w(0,soundlatch);
90      if (*state->ay8910_select & 0x40)
91         AY8910_control_port_1_w(machine, 0, *state->ay8910_data);
6192      else
62         AY8910_write_port_1_w(0,soundlatch);
93         AY8910_write_port_1_w(machine, 0, *state->ay8910_data);
6394   }
6495
65   last = data;
96   *state->ay8910_select = data;
6697}
6798
68static READ8_HANDLER( port3_r )
69{
70   int port = readinputport(3);
7199
72   return port | VBLK;
73}
74100
75static WRITE8_HANDLER( mystston_irq_reset_w )
76{
77   cpunum_set_input_line(Machine, 0, 0, CLEAR_LINE);
78}
101/*************************************
102 *
103 *  Memory map
104 *
105 *************************************/
79106
80
81static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
82   AM_RANGE(0x0000, 0x077f) AM_READ(MRA8_RAM)
83   AM_RANGE(0x0800, 0x0fff) AM_READ(MRA8_RAM)   /* work RAM? */
84   AM_RANGE(0x1000, 0x1fff) AM_READ(MRA8_RAM)
85   AM_RANGE(0x2000, 0x2000) AM_READ(input_port_0_r)
86   AM_RANGE(0x2010, 0x2010) AM_READ(input_port_1_r)
87   AM_RANGE(0x2020, 0x2020) AM_READ(input_port_2_r)
88   AM_RANGE(0x2030, 0x2030) AM_READ(port3_r)
89   AM_RANGE(0x4000, 0xffff) AM_READ(MRA8_ROM)
107static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
108   AM_RANGE(0x0000, 0x077f) AM_RAM
109   AM_RANGE(0x0780, 0x07df) AM_RAM AM_BASE_MEMBER(mystston_state, spriteram)
110   AM_RANGE(0x07e0, 0x0fff) AM_RAM
111   AM_RANGE(0x1000, 0x17ff) AM_RAM AM_BASE_MEMBER(mystston_state, fg_videoram)
112   AM_RANGE(0x1800, 0x1fff) AM_RAM AM_BASE_MEMBER(mystston_state, bg_videoram)
113   AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x1f8f) AM_READWRITE(port_tag_to_handler8("IN0"),  mystston_video_control_w) AM_BASE_MEMBER(mystston_state, video_control)
114   AM_RANGE(0x2010, 0x2010) AM_MIRROR(0x1f8f) AM_READWRITE(port_tag_to_handler8("IN1"),  irq_clear_w)
115   AM_RANGE(0x2020, 0x2020) AM_MIRROR(0x1f8f) AM_READWRITE(port_tag_to_handler8("DSW0"), MWA8_RAM) AM_BASE_MEMBER(mystston_state, scroll)
116   AM_RANGE(0x2030, 0x2030) AM_MIRROR(0x1f8f) AM_READWRITE(port_tag_to_handler8("DSW1"), MWA8_RAM) AM_BASE_MEMBER(mystston_state, ay8910_data)
117   AM_RANGE(0x2040, 0x2040) AM_MIRROR(0x1f8f) AM_READWRITE(MRA8_NOP, mystston_ay8910_select_w) AM_BASE_MEMBER(mystston_state, ay8910_select)
118   AM_RANGE(0x2050, 0x2050) AM_MIRROR(0x1f8f) AM_NOP
119   AM_RANGE(0x2060, 0x207f) AM_MIRROR(0x1f80) AM_RAM AM_BASE_MEMBER(mystston_state, paletteram)
120   AM_RANGE(0x4000, 0xffff) AM_ROM
90121ADDRESS_MAP_END
91122
92static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
93   AM_RANGE(0x0000, 0x077f) AM_WRITE(MWA8_RAM)
94   AM_RANGE(0x0780, 0x07df) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
95   AM_RANGE(0x07e0, 0x07ff) AM_WRITE(MWA8_RAM)
96   AM_RANGE(0x0800, 0x0fff) AM_WRITE(MWA8_RAM)   /* work RAM? */
97   AM_RANGE(0x1000, 0x17ff) AM_WRITE(mystston_videoram_w) AM_BASE(&videoram)
98   AM_RANGE(0x1800, 0x1bff) AM_WRITE(mystston_videoram2_w) AM_BASE(&mystston_videoram2)
99   AM_RANGE(0x1c00, 0x1fff) AM_WRITE(MWA8_RAM)   /* work RAM? This gets copied to videoram */
100   AM_RANGE(0x2000, 0x2000) AM_WRITE(mystston_control_w)   /* text color, flip screen & coin counters */
101   AM_RANGE(0x2010, 0x2010) AM_WRITE(mystston_irq_reset_w)
102   AM_RANGE(0x2020, 0x2020) AM_WRITE(mystston_scroll_w)
103   AM_RANGE(0x2030, 0x2030) AM_WRITE(mystston_soundlatch_w)
104   AM_RANGE(0x2040, 0x2040) AM_WRITE(mystston_soundcontrol_w)
105   AM_RANGE(0x2060, 0x2077) AM_WRITE(paletteram_BBGGGRRR_w) AM_BASE(&paletteram)
106   AM_RANGE(0x4000, 0xffff) AM_WRITE(MWA8_ROM)
107ADDRESS_MAP_END
108123
109124
125/*************************************
126 *
127 *  Input ports
128 *
129 *************************************/
130
110131static INPUT_PORTS_START( mystston )
111   PORT_START   /* IN0 */
132   PORT_START_TAG("IN0")
112133   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY
113134   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY
114135   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY
115136   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY
116137   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
117138   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
118   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1)
119   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(1)
139   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
140   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
120141
121   PORT_START   /* IN1 */
142   PORT_START_TAG("IN1")
122143   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL
123144   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL
124145   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_COCKTAIL
r1877r1878
128149   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
129150   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
130151
131   PORT_START   /* DSW1 */
152   PORT_START_TAG("DSW0")
132153   PORT_DIPNAME(0x01, 0x01, DEF_STR( Lives ) )
133154   PORT_DIPSETTING(   0x01, "3" )
134155   PORT_DIPSETTING(   0x00, "5" )
r1877r1878
154175   PORT_DIPSETTING(   0x80, DEF_STR( Off ) )
155176   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
156177
157   PORT_START   /* DSW2 */
178   PORT_START_TAG("DSW1")
158179   PORT_DIPNAME(0x03, 0x03, DEF_STR( Coin_A ) )
159180   PORT_DIPSETTING(   0x00, DEF_STR( 2C_1C ) )
160181   PORT_DIPSETTING(   0x03, DEF_STR( 1C_1C ) )
r1877r1878
174195   PORT_DIPNAME(0x40, 0x00, DEF_STR( Cabinet ) )
175196   PORT_DIPSETTING(   0x00, DEF_STR( Upright ) )
176197   PORT_DIPSETTING(   0x40, DEF_STR( Cocktail ) )
177   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL )   // VBLANK
198   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
178199INPUT_PORTS_END
179200
180201
181static const gfx_layout charlayout =
182{
183   8,8,
184   RGN_FRAC(1,3),
185   3,
186   { RGN_FRAC(2,3), RGN_FRAC(1,3), RGN_FRAC(0,3) },
187   { 0, 1, 2, 3, 4, 5, 6, 7 },
188   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
189   8*8
190};
191202
192static const gfx_layout spritelayout =
193{
194   16,16,
195   RGN_FRAC(1,3),
196   3,
197   { RGN_FRAC(2,3), RGN_FRAC(1,3), RGN_FRAC(0,3) },
198   { 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7,
199         0, 1, 2, 3, 4, 5, 6, 7 },
200   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
201         8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
202   32*8
203};
203/*************************************
204 *
205 *  Machine driver
206 *
207 *************************************/
204208
205static GFXDECODE_START( mystston )
206   GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout,   3*8, 4 )
207   GFXDECODE_ENTRY( REGION_GFX2, 0, spritelayout, 2*8, 1 )
208   GFXDECODE_ENTRY( REGION_GFX1, 0, spritelayout, 0*8, 2 )
209GFXDECODE_END
210
211
212static INTERRUPT_GEN( mystston_interrupt )
213{
214   int scanline = 271 - cpu_getiloops();
215   static int coin;
216
217   /* Inserting a coin triggers an NMI */
218   if ((readinputport(0) & 0xc0) != 0xc0)
219   {
220      if (coin == 0)
221      {
222         coin = 1;
223         nmi_line_pulse(machine, cpunum);
224         return;
225      }
226   }
227   else coin = 0;
228
229   /* VBLK is lowered on scanline 8 */
230   if (scanline == 8)
231      VBLK = 0;
232
233   /* VBLK is raised on scanline 248 */
234   if (scanline == 248)
235      VBLK = 0x80;
236
237   /* IMS is triggered every time VLOC line 3 is raised,
238       as VLOC counter starts at 16, effectively every 16 scanlines */
239   if ((scanline % 16) == 0)
240      cpunum_set_input_line(machine, 0, 0, ASSERT_LINE);
241}
242
243
244209static MACHINE_DRIVER_START( mystston )
245210
211   MDRV_DRIVER_DATA(mystston_state)
212
246213   /* basic machine hardware */
247   MDRV_CPU_ADD(M6502, 12000000/8)   // 1.5 MHz
248   MDRV_CPU_PROGRAM_MAP(readmem, writemem)
249   MDRV_CPU_VBLANK_INT(mystston_interrupt, 272)
214   MDRV_CPU_ADD(M6502, CPU_CLOCK)
215   MDRV_CPU_PROGRAM_MAP(main_map,0)
250216
251217   /* video hardware */
252   MDRV_SCREEN_ADD("main", RASTER)
253   MDRV_SCREEN_REFRESH_RATE(((12000000.0 / 256.0) / 3.0) / 272.0)
254   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
255   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
256   MDRV_SCREEN_SIZE(32*8, 32*8)
257   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
218   MDRV_IMPORT_FROM(mystston_video)
258219
259   MDRV_GFXDECODE(mystston)
260   MDRV_PALETTE_LENGTH(24+32)
261
262   MDRV_PALETTE_INIT(mystston)
263   MDRV_VIDEO_START(mystston)
264   MDRV_VIDEO_UPDATE(mystston)
265
266   /* sound hardware */
220   /* audio hardware */
267221   MDRV_SPEAKER_STANDARD_MONO("mono")
268222
269   MDRV_SOUND_ADD(AY8910, 12000000/8)
223   MDRV_SOUND_ADD(AY8910, AY8910_CLOCK)
270224   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
271225
272   MDRV_SOUND_ADD(AY8910, 12000000/8)
226   MDRV_SOUND_ADD(AY8910, AY8910_CLOCK)
273227   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
274228MACHINE_DRIVER_END
275229
276230
231
232/*************************************
233 *
234 *  ROM definitions
235 *
236 *************************************/
237
277238ROM_START( mystston )
278239   ROM_REGION( 0x10000, REGION_CPU1, 0 )
279240   ROM_LOAD( "rom6.bin",     0x4000, 0x2000, CRC(7bd9c6cd) SHA1(4d14edc783ba1a6c01d2fb9ea29ec85b8fec3c3b) )
r1877r1878
303264   ROM_LOAD( "ic61",         0x0000, 0x0020, CRC(e802d6cf) SHA1(233ceb9e3a91939e1925766a696bc65ab0dffa50) )
304265ROM_END
305266
267
306268ROM_START( myststno )
307269   ROM_REGION( 0x10000, REGION_CPU1, 0 )
308270   ROM_LOAD( "ms0",          0x4000, 0x2000, CRC(6dacc05f) SHA1(43054199901639516205c7ea145462d0abea8fb1) )
r1877r1878
333295ROM_END
334296
335297
336GAME( 1984, mystston, 0,        mystston, mystston, 0, ROT270, "Technos", "Mysterious Stones - Dr. John's Adventure", 0 )
337GAME( 1984, myststno, mystston, mystston, mystston, 0, ROT270, "Technos", "Mysterious Stones - Dr. Kick in Adventure", 0 )
298
299/*************************************
300 *
301 *  Game drivers
302 *
303 *************************************/
304
305GAME( 1984, mystston, 0,        mystston, mystston, 0, ROT270, "Technos", "Mysterious Stones - Dr. John's Adventure", GAME_SUPPORTS_SAVE )
306GAME( 1984, myststno, mystston, mystston, mystston, 0, ROT270, "Technos", "Mysterious Stones - Dr. Kick in Adventure", GAME_SUPPORTS_SAVE )
src/mame/drivers/hitme.c
r1877r1878
189189   attotime duration = attotime_make(0, ATTOSECONDS_PER_SECOND * 0.45 * 6.8e-6 * resistance * (data+1));
190190   timeout_time = attotime_add(timer_get_time(), duration);
191191
192   discrete_sound_w(HITME_DOWNCOUNT_VAL, data);
193   discrete_sound_w(HITME_OUT0, 1);
192   discrete_sound_w(machine, HITME_DOWNCOUNT_VAL, data);
193   discrete_sound_w(machine, HITME_OUT0, 1);
194194}
195195
196196
197197static WRITE8_HANDLER( output_port_1_w )
198198{
199   discrete_sound_w(HITME_ENABLE_VAL, data);
200   discrete_sound_w(HITME_OUT1, 1);
199   discrete_sound_w(machine, HITME_ENABLE_VAL, data);
200   discrete_sound_w(machine, HITME_OUT1, 1);
201201}
202202
203203
src/mame/drivers/rampart.c
r1877r1878
8686
8787static READ16_HANDLER( adpcm_r )
8888{
89   return (OKIM6295_status_0_r(offset) << 8) | 0x00ff;
89   return (OKIM6295_status_0_r(machine, offset) << 8) | 0x00ff;
9090}
9191
9292
9393static WRITE16_HANDLER( adpcm_w )
9494{
9595   if (ACCESSING_MSB)
96      OKIM6295_data_0_w(offset, (data >> 8) & 0xff);
96      OKIM6295_data_0_w(machine, offset, (data >> 8) & 0xff);
9797}
9898
9999
r1877r1878
109109   if (ACCESSING_MSB)
110110   {
111111      if (offset & 1)
112         YM2413_data_port_0_w(0, (data >> 8) & 0xff);
112         YM2413_data_port_0_w(machine, 0, (data >> 8) & 0xff);
113113      else
114         YM2413_register_port_0_w(0, (data >> 8) & 0xff);
114         YM2413_register_port_0_w(machine, 0, (data >> 8) & 0xff);
115115   }
116116}
117117
r1877r1878
385385   /* basic machine hardware */
386386   MDRV_CPU_ADD(M68000, MASTER_CLOCK/2)
387387   MDRV_CPU_PROGRAM_MAP(main_map, 0)
388   MDRV_CPU_VBLANK_INT(atarigen_video_int_gen,1)
388   MDRV_CPU_VBLANK_INT("main", atarigen_video_int_gen)
389389
390390   MDRV_MACHINE_RESET(rampart)
391391   MDRV_NVRAM_HANDLER(atarigen)
src/mame/drivers/senjyo.c
r1877r1878
664664   /* basic machine hardware */
665665   MDRV_CPU_ADD_TAG("main", Z80, 4000000)   /* 4 MHz? */
666666   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
667   MDRV_CPU_VBLANK_INT(senjyo_interrupt,1)
667   MDRV_CPU_VBLANK_INT("main", senjyo_interrupt)
668668
669669   MDRV_CPU_ADD_TAG("sub", Z80, 2000000)
670670   MDRV_CPU_CONFIG(daisy_chain)
src/mame/drivers/yiear.c
r1877r1878
8686}
8787
8888
89static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
89static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
9090   AM_RANGE(0x0000, 0x0000) AM_READ(yiear_speech_r)
91   AM_RANGE(0x4000, 0x4000) AM_WRITE(yiear_control_w)
92   AM_RANGE(0x4800, 0x4800) AM_WRITE(konami_SN76496_latch_w)
93   AM_RANGE(0x4900, 0x4900) AM_WRITE(konami_SN76496_0_w)
94   AM_RANGE(0x4a00, 0x4a00) AM_WRITE(yiear_VLM5030_control_w)
95   AM_RANGE(0x4b00, 0x4b00) AM_WRITE(VLM5030_data_w)
9196   AM_RANGE(0x4c00, 0x4c00) AM_READ(input_port_3_r)
9297   AM_RANGE(0x4d00, 0x4d00) AM_READ(input_port_4_r)
9398   AM_RANGE(0x4e00, 0x4e00) AM_READ(input_port_0_r)
9499   AM_RANGE(0x4e01, 0x4e01) AM_READ(input_port_1_r)
95100   AM_RANGE(0x4e02, 0x4e02) AM_READ(input_port_2_r)
96101   AM_RANGE(0x4e03, 0x4e03) AM_READ(input_port_5_r)
97   AM_RANGE(0x5000, 0x5fff) AM_READ(MRA8_RAM)
98   AM_RANGE(0x8000, 0xffff) AM_READ(MRA8_ROM)
99ADDRESS_MAP_END
100
101static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
102   AM_RANGE(0x4000, 0x4000) AM_WRITE(yiear_control_w)
103   AM_RANGE(0x4800, 0x4800) AM_WRITE(konami_SN76496_latch_w)
104   AM_RANGE(0x4900, 0x4900) AM_WRITE(konami_SN76496_0_w)
105   AM_RANGE(0x4a00, 0x4a00) AM_WRITE(yiear_VLM5030_control_w)
106   AM_RANGE(0x4b00, 0x4b00) AM_WRITE(VLM5030_data_w)
107102   AM_RANGE(0x4f00, 0x4f00) AM_WRITE(watchdog_reset_w)
108   AM_RANGE(0x5000, 0x502f) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
109   AM_RANGE(0x5030, 0x53ff) AM_WRITE(MWA8_RAM)
110   AM_RANGE(0x5400, 0x542f) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram_2)
111   AM_RANGE(0x5430, 0x57ff) AM_WRITE(MWA8_RAM)
103   AM_RANGE(0x5000, 0x502f) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
104   AM_RANGE(0x5400, 0x542f) AM_RAM AM_BASE(&spriteram_2)
112105   AM_RANGE(0x5800, 0x5fff) AM_WRITE(yiear_videoram_w) AM_BASE(&videoram)
113   AM_RANGE(0x8000, 0xffff) AM_WRITE(MWA8_ROM)
106   AM_RANGE(0x5000, 0x5fff) AM_RAM
107   AM_RANGE(0x8000, 0xffff) AM_ROM
114108ADDRESS_MAP_END
115109
116110
117111
112
118113static INPUT_PORTS_START( yiear )
119114   PORT_START   /* IN0 */
120115   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
r1877r1878
260255
261256   /* basic machine hardware */
262257   MDRV_CPU_ADD(M6809,18432000/16)   /* ???? */
263   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
264   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   /* vblank */
258   MDRV_CPU_PROGRAM_MAP(main_map,0)
259   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
265260   MDRV_CPU_PERIODIC_INT(yiear_nmi_interrupt,500)   /* music tempo (correct frequency unknown) */
266261
267262   /* video hardware */
src/mame/drivers/murogem.c
r1877r1878
101101static UINT8 *murogem_videoram;
102102
103103
104static WRITE8_HANDLER( murogem_mc6845_address_w )
105{
106   mc6845_address_w(mc6845, data);
107}
108
109static WRITE8_HANDLER( murogem_mc6845_register_w )
110{
111   mc6845_register_w(mc6845, data);
112}
113
114
115104static ADDRESS_MAP_START( murogem_map, ADDRESS_SPACE_PROGRAM, 8 )
116105   AM_RANGE(0x0000, 0x007f) AM_RAM
117   AM_RANGE(0x4000, 0x4000) AM_WRITE(murogem_mc6845_address_w)
118   AM_RANGE(0x4001, 0x4001) AM_WRITE(murogem_mc6845_register_w)
106   AM_RANGE(0x4000, 0x4000) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
107   AM_RANGE(0x4001, 0x4001) AM_DEVWRITE(MC6845, "crtc", mc6845_register_w)
119108   AM_RANGE(0x5000, 0x5000) AM_READ(input_port_0_r)
120109   AM_RANGE(0x5800, 0x5800) AM_READ(input_port_1_r)
121110   AM_RANGE(0x7000, 0x7000) AM_WRITE(MWA8_NOP) // sound? payout?
r1877r1878
213202   /* basic machine hardware */
214203   MDRV_CPU_ADD(M6802,8000000)       /* ? MHz */
215204   MDRV_CPU_PROGRAM_MAP(murogem_map,0)
216   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
205   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
217206
218207   /* video hardware */
219208   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/snowbros.c
r1877r1878
111111
112112static INTERRUPT_GEN( snowbro3_interrupt )
113113{
114   int status = OKIM6295_status_0_r(0);
114   int status = OKIM6295_status_0_r(machine,0);
115115
116116   cpunum_set_input_line(machine, 0, cpu_getiloops() + 2, HOLD_LINE);   /* IRQs 4, 3, and 2 */
117117
r1877r1878
119119   {
120120      if ((status&0x08)==0x00)
121121      {
122         OKIM6295_data_0_w(0,0x80|sb3_music);
123         OKIM6295_data_0_w(0,0x00|0x82);
122         OKIM6295_data_0_w(machine,0,0x80|sb3_music);
123         OKIM6295_data_0_w(machine,0,0x00|0x82);
124124      }
125125
126126   }
r1877r1878
128128   {
129129      if ((status&0x08)==0x08)
130130      {
131         OKIM6295_data_0_w(0,0x40);      /* Stop playing music */
131         OKIM6295_data_0_w(machine,0,0x40);      /* Stop playing music */
132132      }
133133   }
134134
r1877r1878
139139
140140static READ16_HANDLER( snowbros_68000_sound_r )
141141{
142   return soundlatch_r(offset);
142   return soundlatch_r(machine,offset);
143143}
144144
145145
r1877r1878
147147{
148148   if (ACCESSING_LSB)
149149   {
150      soundlatch_w(offset,data & 0xff);
151      cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
150      soundlatch_w(machine,offset,data & 0xff);
151      cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
152152   }
153153}
154154
155155static WRITE16_HANDLER( semicom_soundcmd_w )
156156{
157   if (ACCESSING_LSB) soundlatch_w(0,data & 0xff);
157   if (ACCESSING_LSB) soundlatch_w(machine,0,data & 0xff);
158158}
159159
160160
r1877r1878
289289{
290290   if (ACCESSING_LSB)
291291   {
292      soundlatch_w(offset,data & 0xff);
293      cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
292      soundlatch_w(machine,offset,data & 0xff);
293      cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
294294   }
295295}
296296
r1877r1878
453453   }
454454}
455455
456static void sb3_play_sound (int data)
456static void sb3_play_sound (running_machine *machine, int data)
457457{
458   int status = OKIM6295_status_0_r(0);
458   int status = OKIM6295_status_0_r(machine,0);
459459
460460   if ((status&0x01)==0x00)
461461   {
462      OKIM6295_data_0_w(0,0x80|data);
463      OKIM6295_data_0_w(0,0x00|0x12);
462      OKIM6295_data_0_w(machine,0,0x80|data);
463      OKIM6295_data_0_w(machine,0,0x00|0x12);
464464   }
465465   else if ((status&0x02)==0x00)
466466   {
467      OKIM6295_data_0_w(0,0x80|data);
468      OKIM6295_data_0_w(0,0x00|0x22);
467      OKIM6295_data_0_w(machine,0,0x80|data);
468      OKIM6295_data_0_w(machine,0,0x00|0x22);
469469   }
470470   else if ((status&0x04)==0x00)
471471   {
472      OKIM6295_data_0_w(0,0x80|data);
473      OKIM6295_data_0_w(0,0x00|0x42);
472      OKIM6295_data_0_w(machine,0,0x80|data);
473      OKIM6295_data_0_w(machine,0,0x00|0x42);
474474   }
475475
476476
r1877r1878
481481   if (data == 0x00fe)
482482   {
483483      sb3_music_is_playing = 0;
484      OKIM6295_data_0_w(0,0x78);      /* Stop sounds */
484      OKIM6295_data_0_w(machine,0,0x78);      /* Stop sounds */
485485   }
486486   else /* the alternating 0x00-0x2f or 0x30-0x5f might be something to do with the channels */
487487   {
r1877r1878
489489
490490      if (data <= 0x21)
491491      {
492         sb3_play_sound(data);
492         sb3_play_sound(machine, data);
493493      }
494494
495495      if (data>=0x22 && data<=0x31)
r1877r1878
499499
500500      if ((data>=0x30) && (data<=0x51))
501501      {
502         sb3_play_sound(data-0x30);
502         sb3_play_sound(machine, data-0x30);
503503      }
504504
505505      if (data>=0x52 && data<=0x5f)
r1877r1878
15581558   /* basic machine hardware */
15591559   MDRV_CPU_ADD_TAG("main", M68000, 8000000) /* 8 Mhz - confirmed */
15601560   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
1561   MDRV_CPU_VBLANK_INT(snowbros_interrupt,3)
1561   MDRV_CPU_VBLANK_INT_HACK(snowbros_interrupt,3)
15621562
15631563   MDRV_CPU_ADD_TAG("sound", Z80, 6000000) /* 6 MHz - confirmed */
15641564   /* audio CPU */
r1877r1878
16561656   /* basic machine hardware */
16571657   MDRV_CPU_ADD_TAG("main", M68000, 16000000)
16581658   MDRV_CPU_PROGRAM_MAP(honeydol_readmem,honeydol_writemem)
1659   MDRV_CPU_VBLANK_INT(snowbros_interrupt,3)
1659   MDRV_CPU_VBLANK_INT_HACK(snowbros_interrupt,3)
16601660
16611661   MDRV_CPU_ADD_TAG("sound", Z80, 4000000)
16621662   /* audio CPU */
r1877r1878
16961696   /* basic machine hardware */
16971697   MDRV_CPU_ADD_TAG("main", M68000, 16000000) // or 12
16981698   MDRV_CPU_PROGRAM_MAP(twinadv_readmem,twinadv_writemem)
1699   MDRV_CPU_VBLANK_INT(snowbros_interrupt,3)
1699   MDRV_CPU_VBLANK_INT_HACK(snowbros_interrupt,3)
17001700
17011701   MDRV_CPU_ADD_TAG("sound", Z80, 4000000)
17021702   /* audio CPU */
17031703   MDRV_CPU_PROGRAM_MAP(twinadv_sound_readmem,twinadv_sound_writemem)
17041704   MDRV_CPU_IO_MAP(twinadv_sound_readport,twinadv_sound_writeport)
1705   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1705   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
17061706
17071707   /* video hardware */
17081708   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
17771777   /* basic machine hardware */
17781778   MDRV_CPU_ADD(M68000, 16000000) /* 16mhz or 12mhz ? */
17791779   MDRV_CPU_PROGRAM_MAP(readmem3,writemem3)
1780   MDRV_CPU_VBLANK_INT(snowbro3_interrupt,3)
1780   MDRV_CPU_VBLANK_INT_HACK(snowbro3_interrupt,3)
17811781
17821782   /* video hardware */
17831783   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/mhavoc.c
r1877r1878
206206   int pokey_reg = (offset % 8) | control;
207207
208208   if (pokey_num == 0)
209      return pokey1_r(pokey_reg);
209      return pokey1_r(machine, pokey_reg);
210210   else
211      return pokey2_r(pokey_reg);
211      return pokey2_r(machine, pokey_reg);
212212}
213213
214214
r1877r1878
219219   int pokey_reg = (offset % 8) | control;
220220
221221   if (pokey_num == 0)
222      pokey1_w(pokey_reg, data);
222      pokey1_w(machine, pokey_reg, data);
223223   else
224      pokey2_w(pokey_reg, data);
224      pokey2_w(machine, pokey_reg, data);
225225}
226226
227227
r1877r1878
239239
240240static WRITE8_HANDLER( speech_strobe_w )
241241{
242   tms5220_data_w(0, speech_write_buffer);
242   tms5220_data_w(machine, 0, speech_write_buffer);
243243}
244244
245245/*************************************
src/mame/drivers/segaxbd.c
r1877r1878
172172
173173static TIMER_CALLBACK( delayed_sound_data_w )
174174{
175   soundlatch_w(0, param);
175   soundlatch_w(machine, 0, param);
176176   cpunum_set_input_line(machine, 2, INPUT_LINE_NMI, ASSERT_LINE);
177177}
178178
r1877r1878
191191
192192static READ8_HANDLER( sound_data_r )
193193{
194   cpunum_set_input_line(Machine, 2, INPUT_LINE_NMI, CLEAR_LINE);
195   return soundlatch_r(offset);
194   cpunum_set_input_line(machine, 2, INPUT_LINE_NMI, CLEAR_LINE);
195   return soundlatch_r(machine, offset);
196196}
197197
198198
r1877r1878
350350                D1: (CONT) - affects sprite hardware
351351                D0: Sound section reset (1= normal operation, 0= reset)
352352            */
353         if (((oldval ^ data) & 0x40) && !(data & 0x40)) watchdog_reset_w(0,0);
353         if (((oldval ^ data) & 0x40) && !(data & 0x40)) watchdog_reset_w(machine,0,0);
354354         segaic16_set_display_enable(data & 0x20);
355355         cpunum_set_input_line(Machine, 2, INPUT_LINE_RESET, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE);
356356         return;
src/mame/drivers/nbmj9195.c
r1877r1878
8686   memory_set_bankptr(1, &SNDROM[0x08000 + (0x8000 * (data & 0x03))]);
8787}
8888
89static int nbmj9195_sound_r(int offset)
89static int nbmj9195_sound_r(running_machine *machine, int offset)
9090{
91   return soundlatch_r(0);
91   return soundlatch_r(machine, 0);
9292}
9393
9494static WRITE8_HANDLER( nbmj9195_sound_w )
9595{
96   soundlatch_w(0, data);
96   soundlatch_w(machine, 0, data);
9797}
9898
99static void nbmj9195_soundclr_w(int offset, int data)
99static void nbmj9195_soundclr_w(running_machine *machine, int offset, int data)
100100{
101   soundlatch_clear_w(0, 0);
101   soundlatch_clear_w(machine, 0, 0);
102102}
103103
104104static void nbmj9195_outcoin_flag_w(int data)
r1877r1878
169169
170170static UINT8 pio_dir[5 * 2], pio_latch[5 * 2];
171171
172static int tmpz84c011_pio_r(int offset)
172static int tmpz84c011_pio_r(running_machine *machine, int offset)
173173{
174174   int portdata;
175175
r1877r1878
249249            portdata = 0xff;
250250            break;
251251         case 8:         /* PD_1 */
252            portdata = nbmj9195_sound_r(0);
252            portdata = nbmj9195_sound_r(machine, 0);
253253            break;
254254         case 9:         /* PE_1 */
255255            portdata = 0xff;
r1877r1878
334334            portdata = 0xff;
335335            break;
336336         case 8:         /* PD_1 */
337            portdata = nbmj9195_sound_r(0);
337            portdata = nbmj9195_sound_r(machine, 0);
338338            break;
339339         case 9:         /* PE_1 */
340340            portdata = 0xff;
r1877r1878
350350   return portdata;
351351}
352352
353static void tmpz84c011_pio_w(int offset, int data)
353static void tmpz84c011_pio_w(running_machine *machine, int offset, int data)
354354{
355355   if ((!strcmp(Machine->gamedrv->name, "imekura")) ||
356356      (!strcmp(Machine->gamedrv->name, "mscoutm")) ||
r1877r1878
377377            nbmj9195_soundbank_w(data);
378378            break;
379379         case 6:         /* PB_1 */
380            DAC_1_WRITE(0, data);
380            DAC_1_WRITE(machine, 0, data);
381381            break;
382382         case 7:         /* PC_1 */
383            DAC_0_WRITE(0, data);
383            DAC_0_WRITE(machine, 0, data);
384384            break;
385385         case 8:         /* PD_1 */
386386            break;
387387         case 9:         /* PE_1 */
388            if (!(data & 0x01)) nbmj9195_soundclr_w(0, 0);
388            if (!(data & 0x01)) nbmj9195_soundclr_w(machine, 0, 0);
389389            break;
390390
391391         default:
r1877r1878
415415            nbmj9195_soundbank_w(data);
416416            break;
417417         case 6:         /* PB_1 */
418            DAC_1_WRITE(0, data);
418            DAC_1_WRITE(machine, 0, data);
419419            break;
420420         case 7:         /* PC_1 */
421            DAC_0_WRITE(0, data);
421            DAC_0_WRITE(machine, 0, data);
422422            break;
423423         case 8:         /* PD_1 */
424424            break;
425425         case 9:         /* PE_1 */
426            if (!(data & 0x01)) nbmj9195_soundclr_w(0, 0);
426            if (!(data & 0x01)) nbmj9195_soundclr_w(machine, 0, 0);
427427            break;
428428
429429         default:
r1877r1878
437437/* CPU interface */
438438
439439/* device 0 */
440static READ8_HANDLER( tmpz84c011_0_pa_r )   { return (tmpz84c011_pio_r(0) & ~pio_dir[0]) | (pio_latch[0] & pio_dir[0]); }
441static READ8_HANDLER( tmpz84c011_0_pb_r )   { return (tmpz84c011_pio_r(1) & ~pio_dir[1]) | (pio_latch[1] & pio_dir[1]); }
442static READ8_HANDLER( tmpz84c011_0_pc_r )   { return (tmpz84c011_pio_r(2) & ~pio_dir[2]) | (pio_latch[2] & pio_dir[2]); }
443static READ8_HANDLER( tmpz84c011_0_pd_r )   { return (tmpz84c011_pio_r(3) & ~pio_dir[3]) | (pio_latch[3] & pio_dir[3]); }
444static READ8_HANDLER( tmpz84c011_0_pe_r )   { return (tmpz84c011_pio_r(4) & ~pio_dir[4]) | (pio_latch[4] & pio_dir[4]); }
440static READ8_HANDLER( tmpz84c011_0_pa_r )   { return (tmpz84c011_pio_r(machine,0) & ~pio_dir[0]) | (pio_latch[0] & pio_dir[0]); }
441static READ8_HANDLER( tmpz84c011_0_pb_r )   { return (tmpz84c011_pio_r(machine,1) & ~pio_dir[1]) | (pio_latch[1] & pio_dir[1]); }
442static READ8_HANDLER( tmpz84c011_0_pc_r )   { return (tmpz84c011_pio_r(machine,2) & ~pio_dir[2]) | (pio_latch[2] & pio_dir[2]); }
443static READ8_HANDLER( tmpz84c011_0_pd_r )   { return (tmpz84c011_pio_r(machine,3) & ~pio_dir[3]) | (pio_latch[3] & pio_dir[3]); }
444static READ8_HANDLER( tmpz84c011_0_pe_r )   { return (tmpz84c011_pio_r(machine,4) & ~pio_dir[4]) | (pio_latch[4] & pio_dir[4]); }
445445
446static WRITE8_HANDLER( tmpz84c011_0_pa_w )   { pio_latch[0] = data; tmpz84c011_pio_w(0, data); }
447static WRITE8_HANDLER( tmpz84c011_0_pb_w )   { pio_latch[1] = data; tmpz84c011_pio_w(1, data); }
448static WRITE8_HANDLER( tmpz84c011_0_pc_w )   { pio_latch[2] = data; tmpz84c011_pio_w(2, data); }
449static WRITE8_HANDLER( tmpz84c011_0_pd_w )   { pio_latch[3] = data; tmpz84c011_pio_w(3, data); }
450static WRITE8_HANDLER( tmpz84c011_0_pe_w )   { pio_latch[4] = data; tmpz84c011_pio_w(4, data); }
446static WRITE8_HANDLER( tmpz84c011_0_pa_w )   { pio_latch[0] = data; tmpz84c011_pio_w(machine, 0, data); }
447static WRITE8_HANDLER( tmpz84c011_0_pb_w )   { pio_latch[1] = data; tmpz84c011_pio_w(machine, 1, data); }
448static WRITE8_HANDLER( tmpz84c011_0_pc_w )   { pio_latch[2] = data; tmpz84c011_pio_w(machine, 2, data); }
449static WRITE8_HANDLER( tmpz84c011_0_pd_w )   { pio_latch[3] = data; tmpz84c011_pio_w(machine, 3, data); }
450static WRITE8_HANDLER( tmpz84c011_0_pe_w )   { pio_latch[4] = data; tmpz84c011_pio_w(machine, 4, data); }
451451
452452static READ8_HANDLER( tmpz84c011_0_dir_pa_r )   { return pio_dir[0]; }
453453static READ8_HANDLER( tmpz84c011_0_dir_pb_r )   { return pio_dir[1]; }
r1877r1878
462462static WRITE8_HANDLER( tmpz84c011_0_dir_pe_w )   { pio_dir[4] = data; }
463463
464464/* device 1 */
465static READ8_HANDLER( tmpz84c011_1_pa_r )   { return (tmpz84c011_pio_r(5) & ~pio_dir[5]) | (pio_latch[5] & pio_dir[5]); }
466static READ8_HANDLER( tmpz84c011_1_pb_r )   { return (tmpz84c011_pio_r(6) & ~pio_dir[6]) | (pio_latch[6] & pio_dir[6]); }
467static READ8_HANDLER( tmpz84c011_1_pc_r )   { return (tmpz84c011_pio_r(7) & ~pio_dir[7]) | (pio_latch[7] & pio_dir[7]); }
468static READ8_HANDLER( tmpz84c011_1_pd_r )   { return (tmpz84c011_pio_r(8) & ~pio_dir[8]) | (pio_latch[8] & pio_dir[8]); }
469static READ8_HANDLER( tmpz84c011_1_pe_r )   { return (tmpz84c011_pio_r(9) & ~pio_dir[9]) | (pio_latch[9] & pio_dir[9]); }
465static READ8_HANDLER( tmpz84c011_1_pa_r )   { return (tmpz84c011_pio_r(machine,5) & ~pio_dir[5]) | (pio_latch[5] & pio_dir[5]); }
466static READ8_HANDLER( tmpz84c011_1_pb_r )   { return (tmpz84c011_pio_r(machine,6) & ~pio_dir[6]) | (pio_latch[6] & pio_dir[6]); }
467static READ8_HANDLER( tmpz84c011_1_pc_r )   { return (tmpz84c011_pio_r(machine,7) & ~pio_dir[7]) | (pio_latch[7] & pio_dir[7]); }
468static READ8_HANDLER( tmpz84c011_1_pd_r )   { return (tmpz84c011_pio_r(machine,8) & ~pio_dir[8]) | (pio_latch[8] & pio_dir[8]); }
469static READ8_HANDLER( tmpz84c011_1_pe_r )   { return (tmpz84c011_pio_r(machine,9) & ~pio_dir[9]) | (pio_latch[9] & pio_dir[9]); }
470470
471static WRITE8_HANDLER( tmpz84c011_1_pa_w )   { pio_latch[5] = data; tmpz84c011_pio_w(5, data); }
472static WRITE8_HANDLER( tmpz84c011_1_pb_w )   { pio_latch[6] = data; tmpz84c011_pio_w(6, data); }
473static WRITE8_HANDLER( tmpz84c011_1_pc_w )   { pio_latch[7] = data; tmpz84c011_pio_w(7, data); }
474static WRITE8_HANDLER( tmpz84c011_1_pd_w )   { pio_latch[8] = data; tmpz84c011_pio_w(8, data); }
475static WRITE8_HANDLER( tmpz84c011_1_pe_w )   { pio_latch[9] = data; tmpz84c011_pio_w(9, data); }
471static WRITE8_HANDLER( tmpz84c011_1_pa_w )   { pio_latch[5] = data; tmpz84c011_pio_w(machine, 5, data); }
472static WRITE8_HANDLER( tmpz84c011_1_pb_w )   { pio_latch[6] = data; tmpz84c011_pio_w(machine, 6, data); }
473static WRITE8_HANDLER( tmpz84c011_1_pc_w )   { pio_latch[7] = data; tmpz84c011_pio_w(machine, 7, data); }
474static WRITE8_HANDLER( tmpz84c011_1_pd_w )   { pio_latch[8] = data; tmpz84c011_pio_w(machine, 8, data); }
475static WRITE8_HANDLER( tmpz84c011_1_pe_w )   { pio_latch[9] = data; tmpz84c011_pio_w(machine, 9, data); }
476476
477477static READ8_HANDLER( tmpz84c011_1_dir_pa_r )   { return pio_dir[5]; }
478478static READ8_HANDLER( tmpz84c011_1_dir_pb_r )   { return pio_dir[6]; }
r1877r1878
500500/* CTC of main cpu, ch0 trigger is vblank */
501501static INTERRUPT_GEN( ctc0_trg1 )
502502{
503   z80ctc_0_trg1_w(0, 1);
504   z80ctc_0_trg1_w(0, 0);
503   z80ctc_0_trg1_w(machine, 0, 1);
504   z80ctc_0_trg1_w(machine, 0, 0);
505505}
506506
507507static z80ctc_interface ctc_intf_1 =
r1877r1878
541541   for (i = 0; i < (5 * 2); i++)
542542   {
543543      pio_dir[i] = pio_latch[i] = 0;
544      tmpz84c011_pio_w(i, 0);
544      tmpz84c011_pio_w(machine, i, 0);
545545   }
546546}
547547
r1877r1878
41394139   MDRV_CPU_CONFIG(daisy_chain_main)
41404140   MDRV_CPU_PROGRAM_MAP(readmem_sailorws, writemem_sailorws)
41414141   MDRV_CPU_IO_MAP(readport_sailorws, writeport_sailorws)
4142   MDRV_CPU_VBLANK_INT(ctc0_trg1, 1)            /* vblank is connect to ctc triggfer */
4142   MDRV_CPU_VBLANK_INT("main", ctc0_trg1)            /* vblank is connect to ctc triggfer */
41434143
41444144   MDRV_CPU_ADD(Z80, 8000000/1)               /* TMPZ84C011, 8.00 MHz */
41454145   /* audio CPU */
src/mame/drivers/sonson.c
r1877r1878
240240   /* basic machine hardware */
241241   MDRV_CPU_ADD(M6809,12000000/6)   /* 2 MHz ??? */
242242   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
243   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
243   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
244244
245245   MDRV_CPU_ADD(M6809,12000000/6)
246246   /* audio CPU */   /* 2 MHz ??? */
247247   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
248   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)   /* FIRQs are triggered by the main CPU */
248   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)   /* FIRQs are triggered by the main CPU */
249249
250250
251251   /* video hardware */
src/mame/drivers/sslam.c
r1877r1878
243243{
244244   int pattern = 0;
245245
246   if ((OKIM6295_status_0_r(0) & 0x08) == 0)
246   if ((OKIM6295_status_0_r(machine,0) & 0x08) == 0)
247247   {
248248      if (sslam_bar != 0) {
249249         sslam_bar += 1;
r1877r1878
264264      }
265265      if (pattern) {
266266         logerror("Changing bar in music track to pattern %02x\n",pattern);
267         OKIM6295_data_0_w(0,(0x80 | pattern));
268         OKIM6295_data_0_w(0,0x81);
267         OKIM6295_data_0_w(machine,0,(0x80 | pattern));
268         OKIM6295_data_0_w(machine,0,0x81);
269269      }
270270   }
271271//  {
r1877r1878
275275}
276276
277277
278static void sslam_play(int track, int data)
278static void sslam_play(running_machine *machine, int track, int data)
279279{
280   int status = OKIM6295_status_0_r(0);
280   int status = OKIM6295_status_0_r(machine,0);
281281
282282   if (data < 0x80) {
283283      if (track) {
r1877r1878
285285            sslam_track  = data;
286286            sslam_bar = 1;
287287            if (status & 0x08)
288               OKIM6295_data_0_w(0,0x40);
289            OKIM6295_data_0_w(0,(0x80 | data));
290            OKIM6295_data_0_w(0,0x81);
288               OKIM6295_data_0_w(machine,0,0x40);
289            OKIM6295_data_0_w(machine,0,(0x80 | data));
290            OKIM6295_data_0_w(machine,0,0x81);
291291            timer_adjust_periodic(music_timer, ATTOTIME_IN_MSEC(4), 0, ATTOTIME_IN_HZ(250));   /* 250Hz for smooth sequencing */
292292         }
293293      }
294294      else {
295295         if ((status & 0x01) == 0) {
296            OKIM6295_data_0_w(0,(0x80 | data));
297            OKIM6295_data_0_w(0,0x11);
296            OKIM6295_data_0_w(machine,0,(0x80 | data));
297            OKIM6295_data_0_w(machine,0,0x11);
298298         }
299299         else if ((status & 0x02) == 0) {
300            OKIM6295_data_0_w(0,(0x80 | data));
301            OKIM6295_data_0_w(0,0x21);
300            OKIM6295_data_0_w(machine,0,(0x80 | data));
301            OKIM6295_data_0_w(machine,0,0x21);
302302         }
303303         else if ((status & 0x04) == 0) {
304            OKIM6295_data_0_w(0,(0x80 | data));
305            OKIM6295_data_0_w(0,0x41);
304            OKIM6295_data_0_w(machine,0,(0x80 | data));
305            OKIM6295_data_0_w(machine,0,0x41);
306306         }
307307      }
308308   }
r1877r1878
314314         sslam_bar = 0;
315315      }
316316      data &= 0x7f;
317      OKIM6295_data_0_w(0,data);
317      OKIM6295_data_0_w(machine,0,data);
318318   }
319319}
320320
r1877r1878
327327         if (data == 0xfe) {
328328            /* This should reset the sound MCU and stop audio playback, but here, it */
329329            /* chops the first coin insert. So let's only stop any playing melodies. */
330            sslam_play(1, (0x80 | 0x40));      /* Stop playing the melody */
330            sslam_play(machine, 1, (0x80 | 0x40));      /* Stop playing the melody */
331331         }
332332         else {
333333            logerror("Unknown command (%02x) sent to the Sound controller\n",data);
r1877r1878
349349//              if (sslam_snd_bank != 1)
350350//                  OKIM6295_set_bank_base(0, (1 * 0x40000));
351351//              sslam_snd_bank = 1;
352            sslam_play(0, sslam_sound);
352            sslam_play(machine, 0, sslam_sound);
353353         }
354354         else if (sslam_sound >= 0x69) {
355355            if (sslam_snd_bank != 2)
r1877r1878
362362               case 0x6c:   sslam_melody = 7; break;
363363               default:   sslam_melody = 0; sslam_bar = 0; break;   /* Invalid */
364364            }
365            sslam_play(sslam_melody, sslam_sound);
365            sslam_play(machine, sslam_melody, sslam_sound);
366366         }
367367         else if (sslam_sound >= 0x65) {
368368            if (sslam_snd_bank != 1)
369369               OKIM6295_set_bank_base(0, (1 * 0x40000));
370370            sslam_snd_bank = 1;
371371            sslam_melody = 4;
372            sslam_play(sslam_melody, sslam_sound);
372            sslam_play(machine, sslam_melody, sslam_sound);
373373         }
374374         else if (sslam_sound >= 0x60) {
375375            if (sslam_snd_bank != 0)
r1877r1878
382382               case 0x64:   sslam_melody = 3; break;
383383               default:   sslam_melody = 0; sslam_bar = 0; break;   /* Invalid */
384384            }
385            sslam_play(sslam_melody, sslam_sound);
385            sslam_play(machine, sslam_melody, sslam_sound);
386386         }
387387         else {
388            sslam_play(0, sslam_sound);
388            sslam_play(machine, 0, sslam_sound);
389389         }
390390      }
391391   }
r1877r1878
395395
396396static WRITE16_HANDLER( powerbls_sound_w )
397397{
398   soundlatch_w(0,data & 0xff);
399   cpunum_set_input_line(Machine, 1,I8051_INT1_LINE,PULSE_LINE);
398   soundlatch_w(machine,0,data & 0xff);
399   cpunum_set_input_line(machine, 1,I8051_INT1_LINE,PULSE_LINE);
400400}
401401
402402/* Memory Maps */
r1877r1878
454454   UINT8 data = 0;
455455
456456   if ((playmark_oki_control & 0x38) == 0x30) {
457      data = soundlatch_r(0);
457      data = soundlatch_r(machine,0);
458458   }
459459   else if ((playmark_oki_control & 0x38) == 0x28) {
460      data = (OKIM6295_status_0_r(0) & 0x0f);
460      data = (OKIM6295_status_0_r(machine,0) & 0x0f);
461461   }
462462
463463   return data;
r1877r1878
483483
484484   if ((data & 0x38) == 0x18)
485485   {
486      OKIM6295_data_0_w(0, playmark_oki_command);
486      OKIM6295_data_0_w(machine, 0, playmark_oki_command);
487487   }
488488
489489//  !(data & 0x80) -> sound enable
r1877r1878
731731   /* basic machine hardware */
732732   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
733733   MDRV_CPU_PROGRAM_MAP(sslam_program_map, 0)
734   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
734   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
735735
736736   MDRV_CPU_ADD(I8051, 12000000)
737737   MDRV_CPU_FLAGS(CPU_DISABLE)      /* Internal code is not dumped - 2 boards were protected */
r1877r1878
765765   /* basic machine hardware */
766766   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
767767   MDRV_CPU_PROGRAM_MAP(powerbls_map, 0)
768   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
768   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
769769
770770   MDRV_CPU_ADD(I8051, 12000000)
771771   MDRV_CPU_PROGRAM_MAP(sound_map,0)
src/mame/drivers/simpl156.c
r1877r1878
193193
194194static READ32_HANDLER( oki_r )
195195{
196   return OKIM6295_status_0_r(0);
196   return OKIM6295_status_0_r(machine, 0);
197197}
198198
199199static WRITE32_HANDLER( oki_w )
200200{
201   OKIM6295_data_0_w(0, data & 0xff);
201   OKIM6295_data_0_w(machine, 0, data & 0xff);
202202}
203203
204204static READ32_HANDLER( oki2_r )
205205{
206   return OKIM6295_status_1_r(0);
206   return OKIM6295_status_1_r(machine, 0);
207207}
208208
209209static WRITE32_HANDLER( oki2_w )
210210{
211   OKIM6295_data_1_w(0, data & 0xff);
211   OKIM6295_data_1_w(machine, 0, data & 0xff);
212212}
213213
214214/* we need to throw away bits for all ram accesses as the devices are connected as 16-bit */
r1877r1878
292292   data &=0x0000ffff;
293293   mem_mask &=0x0000ffff;
294294
295   deco16_pf1_data_w(offset,data,mem_mask);
295   deco16_pf1_data_w(machine,offset,data,mem_mask);
296296}
297297
298298static READ32_HANDLER( simpl156_pf2_data_r )
r1877r1878
305305{
306306   data &=0x0000ffff;
307307   mem_mask &=0x0000ffff;
308   deco16_pf2_data_w(offset,data,mem_mask);
308   deco16_pf2_data_w(machine,offset,data,mem_mask);
309309}
310310
311311/* Memory Map controled by PALs */
r1877r1878
484484
485485   MDRV_CPU_ADD_TAG("DE156", ARM, 28000000 /* /4 */)   /*DE156*/ /* 7.000 MHz */ /* measured at 7.. seems to need 28? */
486486   MDRV_CPU_PROGRAM_MAP(chainrec_map,0)
487   MDRV_CPU_VBLANK_INT(simpl156_vbl_interrupt,1)
487   MDRV_CPU_VBLANK_INT("main", simpl156_vbl_interrupt)
488488
489489   MDRV_NVRAM_HANDLER(simpl156) // 93C45
490490
src/mame/drivers/lgp.c
r1877r1878
345345   MDRV_CPU_ADD(Z80, CPU_PCB_CLOCK)
346346   MDRV_CPU_PROGRAM_MAP(main_program_map,0)
347347   MDRV_CPU_IO_MAP(main_io_map,0)
348   MDRV_CPU_VBLANK_INT(vblank_callback_lgp, 1)
348   MDRV_CPU_VBLANK_INT("main", vblank_callback_lgp)
349349
350350/*  sound cpu */
351351   MDRV_CPU_ADD(Z80, SOUND_PCB_CLOCK)
src/mame/drivers/hcastle.c
r1877r1878
269269   /* basic machine hardware */
270270   MDRV_CPU_ADD(KONAMI, 3000000)   /* Derived from 24 MHz clock */
271271   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
272   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
272   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
273273
274274   MDRV_CPU_ADD(Z80, 3579545)
275275   /* audio CPU */
src/mame/drivers/deadang.c
r1877r1878
281281   /* basic machine hardware */
282282   MDRV_CPU_ADD(V30,XTAL_16MHz/2) /* Sony 8623h9 CXQ70116D-8 (V30 compatible) */
283283   MDRV_CPU_PROGRAM_MAP(main_map,0)
284   MDRV_CPU_VBLANK_INT(deadang_interrupt,2)
284   MDRV_CPU_VBLANK_INT_HACK(deadang_interrupt,2)
285285
286286   MDRV_CPU_ADD(V30,XTAL_16MHz/2) /* Sony 8623h9 CXQ70116D-8 (V30 compatible) */
287287   MDRV_CPU_PROGRAM_MAP(sub_map,0)
288   MDRV_CPU_VBLANK_INT(deadang_interrupt,2)
288   MDRV_CPU_VBLANK_INT_HACK(deadang_interrupt,2)
289289
290290   SEIBU3A_SOUND_SYSTEM_CPU(XTAL_14_31818MHz/4)
291291
src/mame/drivers/cliffhgr.c
r1877r1878
9090
9191static render_texture *video_texture;
9292static render_texture *overlay_texture;
93static mame_bitmap *last_video_bitmap;
93static bitmap_t *last_video_bitmap;
9494
9595static emu_timer *irq_timer;
9696
r1877r1878
112112
113113   if (discinfo != NULL)
114114   {
115      mame_bitmap *vidbitmap;
115      bitmap_t *vidbitmap;
116116      rectangle fixedvis = *TMS9928A_get_visarea();
117117      fixedvis.max_x++;
118118      fixedvis.max_y++;
r1877r1878
205205   render_container_set_palette_alpha(render_container_get_screen(0), 1, overlay ? 0x00 : 0xff );
206206
207207   /* audio */
208   discrete_sound_w(CLIFF_ENABLE_SND_1, sound&1);
209   discrete_sound_w(CLIFF_ENABLE_SND_2, (sound>>1)&1);
208   discrete_sound_w(machine, CLIFF_ENABLE_SND_1, sound&1);
209   discrete_sound_w(machine, CLIFF_ENABLE_SND_2, (sound>>1)&1);
210210}
211211
212212#ifdef UNUSED_FUNCTION
r1877r1878
738738   MDRV_CPU_ADD(Z80, 4000000)       /* 4MHz */
739739   MDRV_CPU_PROGRAM_MAP(mainmem,0)
740740   MDRV_CPU_IO_MAP(mainport,0)
741   MDRV_CPU_VBLANK_INT(cliff_vsync,1)
741   MDRV_CPU_VBLANK_INT("main", cliff_vsync)
742742
743743   MDRV_MACHINE_START(cliffhgr)
744744   MDRV_MACHINE_RESET(cliffhgr)
src/mame/drivers/cntsteer.c
r1877r1878
9090   tilemap_set_flip(bg_tilemap, TILEMAP_FLIPX|TILEMAP_FLIPY);
9191}
9292
93static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri)
93static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri)
9494{
9595   int offs;
9696
r1877r1878
305305
306306static WRITE8_HANDLER( cntsteer_sound_w )
307307{
308    soundlatch_w(0,data);
308    soundlatch_w(machine,0,data);
309309}
310310
311311static WRITE8_HANDLER( zerotrgt_ctrl_w )
r1877r1878
564564INPUT_PORTS_END
565565
566566
567#ifdef UNUSED_DEFINITION
567568static INPUT_PORTS_START( zerotrgt )
568569   PORT_START
569570   PORT_DIPNAME( 0x01, 0x01, "0" )
r1877r1878
637638   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON5 )
638639   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 )
639640INPUT_PORTS_END
641#endif
640642
641643/***************************************************************************/
642644
r1877r1878
716718static MACHINE_DRIVER_START( cntsteer )
717719   MDRV_CPU_ADD(M6809, 2000000)       /* ? */
718720   MDRV_CPU_PROGRAM_MAP(gekitsui_cpu1_map,0)
719   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1) /* ? */
721   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse) /* ? */
720722
721723   MDRV_CPU_ADD(M6809, 2000000)       /* ? */
722724   MDRV_CPU_PROGRAM_MAP(gekitsui_cpu2_map,0)
723//  MDRV_CPU_VBLANK_INT(nmi_line_pulse,1) /* ? */
725//  MDRV_CPU_VBLANK_INT("main", nmi_line_pulse) /* ? */
724726
725727//  MDRV_CPU_ADD(M6502, 1500000)        /* ? */
726728//  /* audio CPU */
727729//  MDRV_CPU_PROGRAM_MAP(sound_map,0)
728//  MDRV_CPU_VBLANK_INT(nmi_line_pulse,16) /* ? */ // should be interrupt, 16?
730//  MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,16) /* ? */ // should be interrupt, 16?
729731
730732   /* video hardware */
731733   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
751753static MACHINE_DRIVER_START( zerotrgt )
752754   MDRV_CPU_ADD(M6809, 2000000)       /* ? */
753755   MDRV_CPU_PROGRAM_MAP(gekitsui_cpu1_map,0)
754   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1) /* ? */
756   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse) /* ? */
755757
756758   MDRV_CPU_ADD(M6809, 2000000)       /* ? */
757759   MDRV_CPU_PROGRAM_MAP(gekitsui_cpu2_map,0)
758//  MDRV_CPU_VBLANK_INT(nmi_line_pulse,1) /* ? */
760//  MDRV_CPU_VBLANK_INT("main", nmi_line_pulse) /* ? */
759761
760762   MDRV_CPU_ADD(M6502, 1500000)      /* ? */
761763   /* audio CPU */
762764   MDRV_CPU_PROGRAM_MAP(sound_map,0)
763   MDRV_CPU_VBLANK_INT(irq0_line_pulse,16) /* ? */ // should be interrupt, 16?
765   MDRV_CPU_VBLANK_INT_HACK(irq0_line_pulse,16) /* ? */ // should be interrupt, 16?
764766   MDRV_CPU_PERIODIC_INT(sound_interrupt, 1000)
765767
766768   /* video hardware */
src/mame/drivers/twincobr.c
r1877r1878
651651   /* basic machine hardware */
652652   MDRV_CPU_ADD(M68000,28000000/4)         /* 7.0MHz - Main board Crystal is 28MHz */
653653   MDRV_CPU_PROGRAM_MAP(main_program_map, 0)
654   MDRV_CPU_VBLANK_INT(twincobr_interrupt,1)
654   MDRV_CPU_VBLANK_INT("main", twincobr_interrupt)
655655
656656   MDRV_CPU_ADD(Z80,28000000/8)         /* 3.5MHz */
657657   MDRV_CPU_PROGRAM_MAP(sound_program_map, 0)
src/mame/drivers/hexion.c
r1877r1878
284284   /* basic machine hardware */
285285   MDRV_CPU_ADD(Z80,24000000/4)   /* Z80B 6 MHz */
286286   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
287   MDRV_CPU_VBLANK_INT(hexion_interrupt,3)   /* both IRQ and NMI are used */
287   MDRV_CPU_VBLANK_INT_HACK(hexion_interrupt,3)   /* both IRQ and NMI are used */
288288
289289   /* video hardware */
290290   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/bking.c
r1877r1878
8484   for (i = 0;i < 8;i++)
8585      if (data & (1 << i)) code |= 0x80 >> i;
8686
87   soundlatch_w(offset,code);
88   if (sndnmi_enable) cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
87   soundlatch_w(machine,offset,code);
88   if (sndnmi_enable) cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
8989}
9090
9191static WRITE8_HANDLER( bking3_addr_l_w )
r1877r1878
444444   MDRV_CPU_ADD_TAG("main_cpu", Z80, XTAL_12MHz/4)   /* 3 MHz */
445445   MDRV_CPU_PROGRAM_MAP(bking_map,0)
446446   MDRV_CPU_IO_MAP(bking_io_map,0)
447   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
447   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
448448
449449   MDRV_CPU_ADD(Z80, XTAL_6MHz/2)   /* 3 MHz */
450450   /* audio CPU */
src/mame/drivers/battlnts.c
r1877r1878
336336   /* basic machine hardware */
337337   MDRV_CPU_ADD(HD6309, 3000000*4)      /* ? */
338338   MDRV_CPU_PROGRAM_MAP(battlnts_readmem,battlnts_writemem)
339   MDRV_CPU_VBLANK_INT(battlnts_interrupt,1)
339   MDRV_CPU_VBLANK_INT("main", battlnts_interrupt)
340340
341341   MDRV_CPU_ADD(Z80, 3579545)
342342   /* audio CPU */      /* ? */
src/mame/drivers/dblewing.c
r1877r1878
1010*/
1111
1212#include "driver.h"
13#include "deprecat.h"
1413#include "cpu/m68000/m68000.h"
1514#include "decocrpt.h"
1615#include "deco16ic.h"
r1877r1878
5049
5150
5251
53static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
52static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
5453{
5554   int offs;
5655
r1877r1878
6362      y = spriteram16[offs];
6463      flash=y&0x1000;
6564      xsize = y&0x0800;
66      if (flash && (cpu_getcurrentframe() & 1)) continue;
65      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
6766
6867      x = spriteram16[offs+2];
6968      colour = (x >>9) & 0x1f;
r1877r1878
283282   if ((offset*2)==0x104) { dblwings_104_data = data; return; } // p1 inputs select screen  OK
284283   if ((offset*2)==0x200) { dblwings_200_data = data; return; }
285284   if ((offset*2)==0x28c) { dblwings_28c_data = data; return; }
286   if ((offset*2)==0x380) { soundlatch_w(0,data&0xff);   /*cpunum_set_input_line(Machine, 1,0,HOLD_LINE);*/ return; } // sound write
285   if ((offset*2)==0x380) { soundlatch_w(machine,0,data&0xff);   /*cpunum_set_input_line(Machine, 1,0,HOLD_LINE);*/ return; } // sound write
287286   if ((offset*2)==0x38e) { dblwings_38e_data = data; return; }
288287   if ((offset*2)==0x406) { dblwings_406_data = data; return; } // p2 inputs select screen  OK
289288   if ((offset*2)==0x408) { dblwings_408_data = data; return; } // 3rd player 1st level?
r1877r1878
543542   /* basic machine hardware */
544543   MDRV_CPU_ADD(M68000, 14000000)   /* DE102 */
545544   MDRV_CPU_PROGRAM_MAP(dblewing_map,0)
546   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
545   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
547546
548547   MDRV_CPU_ADD(Z80, 4000000)
549548   MDRV_CPU_PROGRAM_MAP(sound_map,0)
src/mame/drivers/galpani2.c
r1877r1878
462462   /* basic machine hardware */
463463   MDRV_CPU_ADD(M68000, 16000000)   /* 16MHz */
464464   MDRV_CPU_PROGRAM_MAP(galpani2_mem1, 0)
465   MDRV_CPU_VBLANK_INT(galpani2_interrupt,GALPANI2_INTERRUPTS_NUM)
465   MDRV_CPU_VBLANK_INT_HACK(galpani2_interrupt,GALPANI2_INTERRUPTS_NUM)
466466
467467   MDRV_CPU_ADD(M68000, 16000000)   /* 16MHz */
468468   MDRV_CPU_PROGRAM_MAP(galpani2_mem2, 0)
469   MDRV_CPU_VBLANK_INT(galpani2_interrupt2,GALPANI2_INTERRUPTS_NUM2)
469   MDRV_CPU_VBLANK_INT_HACK(galpani2_interrupt2,GALPANI2_INTERRUPTS_NUM2)
470470
471471   MDRV_MACHINE_RESET(galpani2)
472472   MDRV_NVRAM_HANDLER(93C46)
src/mame/drivers/arabian.c
r1877r1878
165165      /* error cases */
166166      default:
167167         logerror("Input Port %04X read.  PC=%04X\n", offset+0xd7f0, activecpu_get_pc());
168         return 0;
169168   }
170169   return 0;
171170}
r1877r1878
353352   MDRV_CPU_ADD(Z80, MAIN_OSC/4)
354353   MDRV_CPU_PROGRAM_MAP(main_map,0)
355354   MDRV_CPU_IO_MAP(main_io_map,0)
356   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
355   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
357356
358357   /* video hardware */
359358   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/labyrunr.c
r1877r1878
241241   /* basic machine hardware */
242242   MDRV_CPU_ADD(HD6309, 3000000*4)      /* 24MHz/8? */
243243   MDRV_CPU_PROGRAM_MAP(labyrunr_readmem,labyrunr_writemem)
244   MDRV_CPU_VBLANK_INT(labyrunr_interrupt,8)   /* 1 IRQ + 4 NMI (generated by 007121) */
244   MDRV_CPU_VBLANK_INT_HACK(labyrunr_interrupt,8)   /* 1 IRQ + 4 NMI (generated by 007121) */
245245
246246   /* video hardware */
247247   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/shougi.c
r1877r1878
221221
222222static WRITE8_HANDLER( shougi_watchdog_reset_w )
223223{
224   watchdog_reset_w(0,data);
224   watchdog_reset_w(machine,0,data);
225225}
226226
227227static WRITE8_HANDLER( shougi_mcu_halt_off_w )
r1877r1878
357357
358358   MDRV_CPU_ADD(Z80,10000000/4)
359359   MDRV_CPU_PROGRAM_MAP(main_map,0)
360   MDRV_CPU_VBLANK_INT(shougi_vblank_nmi,1)
360   MDRV_CPU_VBLANK_INT("main", shougi_vblank_nmi)
361361
362362   MDRV_CPU_ADD(Z80,10000000/4)
363363   MDRV_CPU_PROGRAM_MAP(sub_map,0)
src/mame/drivers/hornet.c
r1877r1878
367367   }
368368}
369369
370static void K037122_tile_draw(int chip, mame_bitmap *bitmap, const rectangle *cliprect)
370static void K037122_tile_draw(int chip, bitmap_t *bitmap, const rectangle *cliprect)
371371{
372372   if (K037122_reg[chip][0xc] & 0x10000)
373373   {
src/mame/drivers/thief.c
r1877r1878
5353static INTERRUPT_GEN( thief_interrupt )
5454{
5555   /* SLAM switch causes an NMI if it's pressed */
56   if( (input_port_3_r(0) & 0x10) == 0 )
56   if( (input_port_3_r(machine,0) & 0x10) == 0 )
5757      cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
5858   else
5959      cpunum_set_input_line(machine, 0, 0, HOLD_LINE);
r1877r1878
464464   MDRV_CPU_ADD(Z80, 4000000)        /* 4 MHz? */
465465   MDRV_CPU_PROGRAM_MAP(sharkatt_readmem,sharkatt_writemem)
466466   MDRV_CPU_IO_MAP(io_map,0)
467   MDRV_CPU_VBLANK_INT(thief_interrupt,1)
467   MDRV_CPU_VBLANK_INT("main", thief_interrupt)
468468
469469   /* video hardware */
470470   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
500500   MDRV_CPU_ADD(Z80, 4000000) /* 4 MHz? */
501501   MDRV_CPU_PROGRAM_MAP(thief_readmem,thief_writemem)
502502   MDRV_CPU_IO_MAP(io_map,0)
503   MDRV_CPU_VBLANK_INT(thief_interrupt,1)
503   MDRV_CPU_VBLANK_INT("main", thief_interrupt)
504504
505505   /* video hardware */
506506   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
536536   MDRV_CPU_ADD(Z80, 4000000) /* 4 MHz? */
537537   MDRV_CPU_PROGRAM_MAP(thief_readmem,thief_writemem)
538538   MDRV_CPU_IO_MAP(io_map,0)
539   MDRV_CPU_VBLANK_INT(thief_interrupt,1)
539   MDRV_CPU_VBLANK_INT("main", thief_interrupt)
540540
541541   /* video hardware */
542542   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/pipedrm.c
r1877r1878
155155   memory_set_bank(1, data & 0x7);
156156
157157   /* map to the fromance gfx register */
158   fromance_gfxreg_w(offset, ((data >> 6) & 0x01) |    /* flipscreen */
158   fromance_gfxreg_w(machine, offset, ((data >> 6) & 0x01) |    /* flipscreen */
159159                       ((~data >> 2) & 0x02));   /* videoram select */
160160}
161161
r1877r1878
559559   MDRV_CPU_ADD(Z80,12000000/2)
560560   MDRV_CPU_PROGRAM_MAP(main_map,0)
561561   MDRV_CPU_IO_MAP(main_portmap,0)
562   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
562   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
563563
564564   MDRV_CPU_ADD(Z80,14318000/4)
565565   /* audio CPU */
r1877r1878
599599   MDRV_CPU_ADD(Z80,12000000/2)
600600   MDRV_CPU_PROGRAM_MAP(main_map,0)
601601   MDRV_CPU_IO_MAP(main_portmap,0)
602   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
602   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
603603
604604   MDRV_CPU_ADD(Z80,14318000/4)
605605   /* audio CPU */
src/mame/drivers/ddragon3.c
r1877r1878
6464      break;
6565
6666      case 1: /* soundlatch_w */
67      soundlatch_w(1,reg[1]&0xff);
68      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE );
67      soundlatch_w(machine,1,reg[1]&0xff);
68      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE );
6969      break;
7070
7171      case 2:
r1877r1878
505505   /* basic machine hardware */
506506   MDRV_CPU_ADD_TAG("main", M68000, 12000000) // Guess
507507   MDRV_CPU_PROGRAM_MAP(readmem, writemem)
508   MDRV_CPU_VBLANK_INT(ddragon3_cpu_interrupt, 2)
508   MDRV_CPU_VBLANK_INT_HACK(ddragon3_cpu_interrupt, 2)
509509
510510   MDRV_CPU_ADD_TAG("audio", Z80, 3579545) // Guess
511511   /* audio CPU */
src/mame/drivers/sprint2.c
r1877r1878
103103      }
104104   }
105105
106   discrete_sound_w(SPRINT2_MOTORSND1_DATA, sprint2_video_ram[0x394] & 15);   // also DOMINOS_FREQ_DATA
107   discrete_sound_w(SPRINT2_MOTORSND2_DATA, sprint2_video_ram[0x395] & 15);
108   discrete_sound_w(SPRINT2_CRASHSND_DATA, sprint2_video_ram[0x396] & 15);   // also DOMINOS_AMP_DATA
106   discrete_sound_w(machine, SPRINT2_MOTORSND1_DATA, sprint2_video_ram[0x394] & 15);   // also DOMINOS_FREQ_DATA
107   discrete_sound_w(machine, SPRINT2_MOTORSND2_DATA, sprint2_video_ram[0x395] & 15);
108   discrete_sound_w(machine, SPRINT2_CRASHSND_DATA, sprint2_video_ram[0x396] & 15);   // also DOMINOS_AMP_DATA
109109
110110   /* interrupts and watchdog are disabled during service mode */
111111
r1877r1878
217217   attract = offset & 1;
218218
219219   // also DOMINOS_ATTRACT_EN
220   discrete_sound_w(SPRINT2_ATTRACT_EN, attract);
220   discrete_sound_w(machine, SPRINT2_ATTRACT_EN, attract);
221221}
222222
223223
224224static WRITE8_HANDLER( sprint2_noise_reset_w )
225225{
226   discrete_sound_w(SPRINT2_NOISE_RESET, 0);
226   discrete_sound_w(machine, SPRINT2_NOISE_RESET, 0);
227227}
228228
229229
230230static WRITE8_HANDLER( sprint2_skid1_w )
231231{
232232   // also DOMINOS_TUMBLE_EN
233   discrete_sound_w(SPRINT2_SKIDSND1_EN, offset & 1);
233   discrete_sound_w(machine, SPRINT2_SKIDSND1_EN, offset & 1);
234234}
235235
236236static WRITE8_HANDLER( sprint2_skid2_w )
237237{
238   discrete_sound_w(SPRINT2_SKIDSND2_EN, offset & 1);
238   discrete_sound_w(machine, SPRINT2_SKIDSND2_EN, offset & 1);
239239}
240240
241241
r1877r1878
508508   /* basic machine hardware */
509509   MDRV_CPU_ADD(M6502, 12096000 / 16)
510510   MDRV_CPU_PROGRAM_MAP(readmem, writemem)
511   MDRV_CPU_VBLANK_INT(sprint2, 1)
511   MDRV_CPU_VBLANK_INT("main", sprint2)
512512   MDRV_WATCHDOG_VBLANK_INIT(8)
513513
514514   /* video hardware */
src/mame/drivers/exterm.c
r1877r1878
135135 *
136136 *************************************/
137137
138static UINT16 exterm_trackball_port_r(int which, UINT16 mem_mask)
138static UINT16 exterm_trackball_port_r(running_machine *machine, int which, UINT16 mem_mask)
139139{
140140   UINT16 port;
141141
r1877r1878
156156   aimpos[which] = (aimpos[which] + trackball_diff) & 0x3f;
157157
158158   /* Combine it with the standard input bits */
159   port = which ? input_port_1_word_r(0, mem_mask) :
160               input_port_0_word_r(0, mem_mask);
159   port = which ? input_port_1_word_r(machine, 0, mem_mask) :
160               input_port_0_word_r(machine, 0, mem_mask);
161161
162162   return (port & 0xc0ff) | (aimpos[which] << 8);
163163}
r1877r1878
165165
166166static READ16_HANDLER( exterm_input_port_0_r )
167167{
168   return exterm_trackball_port_r(0, mem_mask);
168   return exterm_trackball_port_r(machine, 0, mem_mask);
169169}
170170
171171
172172static READ16_HANDLER( exterm_input_port_1_r )
173173{
174   return exterm_trackball_port_r(1, mem_mask);
174   return exterm_trackball_port_r(machine, 1, mem_mask);
175175}
176176
177177
r1877r1878
246246{
247247   /* bit 7 of the sound control selects which port */
248248   if (sound_control & 0x80)
249      YM2151_data_port_0_w(offset, data);
249      YM2151_data_port_0_w(machine, offset, data);
250250   else
251      YM2151_register_port_0_w(offset, data);
251      YM2151_register_port_0_w(machine, offset, data);
252252}
253253
254254
src/mame/drivers/dragrace.c
r1877r1878
55***************************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
89#include "dragrace.h"
910#include "sound/discrete.h"
1011
r1877r1878
3940   timer_pulse(video_screen_get_frame_period(0), NULL, 0, dragrace_frame_callback);
4041}
4142
42static void dragrace_update_misc_flags(void)
43static void dragrace_update_misc_flags(running_machine *machine)
4344{
4445   /* 0x0900 = set 3SPEED1         0x00000001
4546     * 0x0901 = set 4SPEED1         0x00000002
r1877r1878
7576   set_led_status(0, dragrace_misc_flags & 0x00008000);
7677   set_led_status(1, dragrace_misc_flags & 0x80000000);
7778
78   discrete_sound_w(DRAGRACE_MOTOR1_DATA,  ~dragrace_misc_flags & 0x0000001f);      // Speed1 data*
79   discrete_sound_w(DRAGRACE_EXPLODE1_EN, (dragrace_misc_flags & 0x00000020) ? 1: 0);   // Explosion1 enable
80   discrete_sound_w(DRAGRACE_SCREECH1_EN, (dragrace_misc_flags & 0x00000040) ? 1: 0);   // Screech1 enable
81   discrete_sound_w(DRAGRACE_KLEXPL1_EN, (dragrace_misc_flags & 0x00000200) ? 1: 0);   // KLEXPL1 enable
82   discrete_sound_w(DRAGRACE_MOTOR1_EN, (dragrace_misc_flags & 0x00000800) ? 1: 0);   // Motor1 enable
79   discrete_sound_w(machine, DRAGRACE_MOTOR1_DATA,  ~dragrace_misc_flags & 0x0000001f);      // Speed1 data*
80   discrete_sound_w(machine, DRAGRACE_EXPLODE1_EN, (dragrace_misc_flags & 0x00000020) ? 1: 0);   // Explosion1 enable
81   discrete_sound_w(machine, DRAGRACE_SCREECH1_EN, (dragrace_misc_flags & 0x00000040) ? 1: 0);   // Screech1 enable
82   discrete_sound_w(machine, DRAGRACE_KLEXPL1_EN, (dragrace_misc_flags & 0x00000200) ? 1: 0);   // KLEXPL1 enable
83   discrete_sound_w(machine, DRAGRACE_MOTOR1_EN, (dragrace_misc_flags & 0x00000800) ? 1: 0);   // Motor1 enable
8384
84   discrete_sound_w(DRAGRACE_MOTOR2_DATA, (~dragrace_misc_flags & 0x001f0000) >> 0x10);   // Speed2 data*
85   discrete_sound_w(DRAGRACE_EXPLODE2_EN, (dragrace_misc_flags & 0x00200000) ? 1: 0);   // Explosion2 enable
86   discrete_sound_w(DRAGRACE_SCREECH2_EN, (dragrace_misc_flags & 0x00400000) ? 1: 0);   // Screech2 enable
87   discrete_sound_w(DRAGRACE_KLEXPL2_EN, (dragrace_misc_flags & 0x02000000) ? 1: 0);   // KLEXPL2 enable
88   discrete_sound_w(DRAGRACE_MOTOR2_EN, (dragrace_misc_flags & 0x08000000) ? 1: 0);   // Motor2 enable
85   discrete_sound_w(machine, DRAGRACE_MOTOR2_DATA, (~dragrace_misc_flags & 0x001f0000) >> 0x10);   // Speed2 data*
86   discrete_sound_w(machine, DRAGRACE_EXPLODE2_EN, (dragrace_misc_flags & 0x00200000) ? 1: 0);   // Explosion2 enable
87   discrete_sound_w(machine, DRAGRACE_SCREECH2_EN, (dragrace_misc_flags & 0x00400000) ? 1: 0);   // Screech2 enable
88   discrete_sound_w(machine, DRAGRACE_KLEXPL2_EN, (dragrace_misc_flags & 0x02000000) ? 1: 0);   // KLEXPL2 enable
89   discrete_sound_w(machine, DRAGRACE_MOTOR2_EN, (dragrace_misc_flags & 0x08000000) ? 1: 0);   // Motor2 enable
8990
90   discrete_sound_w(DRAGRACE_ATTRACT_EN, (dragrace_misc_flags & 0x00001000) ? 1: 0);   // Attract enable
91   discrete_sound_w(DRAGRACE_LOTONE_EN, (dragrace_misc_flags & 0x00002000) ? 1: 0);   // LoTone enable
92   discrete_sound_w(DRAGRACE_HITONE_EN, (dragrace_misc_flags & 0x20000000) ? 1: 0);   // HiTone enable
91   discrete_sound_w(machine, DRAGRACE_ATTRACT_EN, (dragrace_misc_flags & 0x00001000) ? 1: 0);   // Attract enable
92   discrete_sound_w(machine, DRAGRACE_LOTONE_EN, (dragrace_misc_flags & 0x00002000) ? 1: 0);   // LoTone enable
93   discrete_sound_w(machine, DRAGRACE_HITONE_EN, (dragrace_misc_flags & 0x20000000) ? 1: 0);   // HiTone enable
9394}
9495
9596static WRITE8_HANDLER( dragrace_misc_w )
r1877r1878
101102   else
102103      dragrace_misc_flags &= (~mask);
103104   logerror("Set   %#6x, Mask=%#10x, Flag=%#10x, Data=%x\n", 0x0900+offset, mask, dragrace_misc_flags, data & 0x01);
104   dragrace_update_misc_flags();
105   }
105   dragrace_update_misc_flags(machine);
106}
106107
107108static WRITE8_HANDLER( dragrace_misc_clear_w )
108109{
r1877r1878
110111   UINT32 mask = 0xff << (((offset >> 3) & 0x03) * 8);
111112   dragrace_misc_flags &= (~mask);
112113   logerror("Clear %#6x, Mask=%#10x, Flag=%#10x, Data=%x\n", 0x0920+offset, mask, dragrace_misc_flags, data & 0x01);
113   dragrace_update_misc_flags();
114   dragrace_update_misc_flags(machine);
114115}
115116
116117static READ8_HANDLER( dragrace_input_r )
r1877r1878
326327   /* basic machine hardware */
327328   MDRV_CPU_ADD(M6800, 12096000 / 12)
328329   MDRV_CPU_PROGRAM_MAP(dragrace_readmem, dragrace_writemem)
329   MDRV_CPU_VBLANK_INT(irq0_line_hold, 4)
330   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold, 4)
330331   MDRV_WATCHDOG_VBLANK_INIT(8)
331332
332333   MDRV_MACHINE_RESET(dragrace)
src/mame/drivers/discoboy.c
r1877r1878
5454{
5555}
5656
57static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
57static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
5858{
5959   int flipscreen = 0;
6060   int offs,sx,sy;
r1877r1878
203203{
204204//  printf("unk discoboy_port_03_w %02x\n",data);
205205//  cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,HOLD_LINE);
206   soundlatch_w(0,data);
207   cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
206   soundlatch_w(machine,0,data);
207   cpunum_set_input_line(machine, 1,0,HOLD_LINE);
208208}
209209
210210static WRITE8_HANDLER( discoboy_port_06_w )
r1877r1878
477477   MDRV_CPU_ADD(Z80,12000000/2)       /* 6 MHz? */
478478   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
479479   MDRV_CPU_IO_MAP(readport,writeport)
480   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
480   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
481481
482482   MDRV_CPU_ADD(Z80,10000000/2)       /* 5 MHz? */
483483   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
484484   MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
485//  MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
486   MDRV_CPU_VBLANK_INT(nmi_line_pulse,32)
485//  MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
486   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,32)
487487
488488   /* video hardware */
489489   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/mediagx.c
r1877r1878
169169   }
170170}
171171
172static void draw_char(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, const gfx_element *gfx, int ch, int att, int x, int y)
172static void draw_char(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const gfx_element *gfx, int ch, int att, int x, int y)
173173{
174174   int i,j;
175175   UINT8 *dp;
r1877r1878
193193   }
194194}
195195
196static void draw_framebuffer(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
196static void draw_framebuffer(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
197197{
198198   int i, j;
199199   int width, height;
r1877r1878
284284   }
285285}
286286
287static void draw_cga(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
287static void draw_cga(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
288288{
289289   int i, j;
290290   const gfx_element *gfx = machine->gfx[0];
r1877r1878
352352
353353static READ8_HANDLER(at_dma8237_1_r)
354354{
355   return dma8237_1_r(offset / 2);
355   return dma8237_1_r(machine, offset / 2);
356356}
357357
358358static WRITE8_HANDLER(at_dma8237_1_w)
359359{
360   dma8237_1_w(offset / 2, data);
360   dma8237_1_w(machine, offset / 2, data);
361361}
362362
363363static READ32_HANDLER(at32_dma8237_1_r)
364364{
365   return read32le_with_read8_handler(at_dma8237_1_r, offset, mem_mask);
365   return read32le_with_read8_handler(at_dma8237_1_r, machine, offset, mem_mask);
366366}
367367
368368static WRITE32_HANDLER(at32_dma8237_1_w)
369369{
370   write32le_with_write8_handler(at_dma8237_1_w, offset, data, mem_mask);
370   write32le_with_write8_handler(at_dma8237_1_w, machine, offset, data, mem_mask);
371371}
372372
373373
374374
375375static READ32_HANDLER( ide0_r )
376376{
377   return ide_controller32_0_r(0x1f0/4 + offset, mem_mask);
377   return ide_controller32_0_r(machine, 0x1f0/4 + offset, mem_mask);
378378}
379379
380380static WRITE32_HANDLER( ide0_w )
381381{
382   ide_controller32_0_w(0x1f0/4 + offset, data, mem_mask);
382   ide_controller32_0_w(machine, 0x1f0/4 + offset, data, mem_mask);
383383}
384384
385385static READ32_HANDLER( fdc_r )
386386{
387   return ide_controller32_0_r(0x3f0/4 + offset, mem_mask);
387   return ide_controller32_0_r(machine, 0x3f0/4 + offset, mem_mask);
388388}
389389
390390static WRITE32_HANDLER( fdc_w )
391391{
392   ide_controller32_0_w(0x3f0/4 + offset, data, mem_mask);
392   ide_controller32_0_w(machine, 0x3f0/4 + offset, data, mem_mask);
393393}
394394
395395
r1877r1878
469469   // 0x20 - 0x21, PIC
470470   if ((mem_mask & 0x0000ffff) != 0xffff)
471471   {
472      r |= pic8259_32le_0_r(offset, mem_mask);
472      r |= pic8259_32le_0_r(machine, offset, mem_mask);
473473   }
474474
475475   // 0x22, 0x23, Cyrix configuration registers
r1877r1878
489489   // 0x20 - 0x21, PIC
490490   if ((mem_mask & 0x0000ffff) != 0xffff)
491491   {
492      pic8259_32le_0_w(offset, data, mem_mask);
492      pic8259_32le_0_w(machine, offset, data, mem_mask);
493493   }
494494
495495   // 0x22, 0x23, Cyrix configuration registers
r1877r1878
976976static READ32_HANDLER( speedup10_r ) { return generic_speedup(&speedup_table[10]); }
977977static READ32_HANDLER( speedup11_r ) { return generic_speedup(&speedup_table[11]); }
978978
979static const read32_handler speedup_handlers[] =
979static const read32_machine_func speedup_handlers[] =
980980{
981981   speedup0_r,      speedup1_r,      speedup2_r,      speedup3_r,
982982   speedup4_r,      speedup5_r,      speedup6_r,      speedup7_r,
src/mame/drivers/ambush.c
r1877r1878
176176   MDRV_CPU_ADD(Z80, 4000000)        /* 4.00 MHz??? */
177177   MDRV_CPU_PROGRAM_MAP(main_map,0)
178178   MDRV_CPU_IO_MAP(main_portmap,0)
179   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
179   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
180180
181181   /* video hardware */
182182   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/orbit.c
r1877r1878
3434}
3535
3636
37static void update_misc_flags(UINT8 val)
37static void update_misc_flags(running_machine *machine, UINT8 val)
3838{
3939   orbit_misc_flags = val;
4040
r1877r1878
4848   /* BIT7 => WARNING SND  */
4949
5050   orbit_nmi_enable = (orbit_misc_flags >> 2) & 1;
51   discrete_sound_w(ORBIT_WARNING_EN, orbit_misc_flags & 0x80);
51   discrete_sound_w(machine, ORBIT_WARNING_EN, orbit_misc_flags & 0x80);
5252
5353   set_led_status(0, orbit_misc_flags & 0x08);
5454   set_led_status(1, orbit_misc_flags & 0x40);
r1877r1878
6060
6161static MACHINE_RESET( orbit )
6262{
63   update_misc_flags(0);
63   update_misc_flags(machine, 0);
6464}
6565
6666
r1877r1878
7070
7171   if (offset & 1)
7272   {
73      update_misc_flags(orbit_misc_flags | (1 << bit));
73      update_misc_flags(machine, orbit_misc_flags | (1 << bit));
7474   }
7575   else
7676   {
77      update_misc_flags(orbit_misc_flags & ~(1 << bit));
77      update_misc_flags(machine, orbit_misc_flags & ~(1 << bit));
7878   }
7979}
8080
r1877r1878
264264   /* basic machine hardware */
265265   MDRV_CPU_ADD(M6800, 12096000 / 16)
266266   MDRV_CPU_PROGRAM_MAP(orbit_map, 0)
267   MDRV_CPU_VBLANK_INT(irq0_line_pulse, 1)
267   MDRV_CPU_VBLANK_INT("main", irq0_line_pulse)
268268   MDRV_CPU_PERIODIC_INT(orbit_interrupt, 240)
269269
270270   MDRV_MACHINE_RESET(orbit)
src/mame/drivers/policetr.c
r1877r1878
188188   /* toggling BSMT off then on causes a reset */
189189   if (!(old & 0x80000000) && (control_data & 0x80000000))
190190   {
191      BSMT2000_data_0_w(bsmt_data_bank, 0, 0);
191      BSMT2000_data_0_w(machine, bsmt_data_bank, 0, 0);
192192      sndti_reset(SOUND_BSMT2000, 0);
193193   }
194194
r1877r1878
208208static WRITE32_HANDLER( bsmt2000_reg_w )
209209{
210210   if (control_data & 0x80000000)
211      BSMT2000_data_0_w(bsmt_reg, data & 0xffff, mem_mask | 0xffff0000);
211      BSMT2000_data_0_w(machine, bsmt_reg, data & 0xffff, mem_mask | 0xffff0000);
212212   else
213213      COMBINE_DATA(&bsmt_data_offset);
214214}
r1877r1878
466466   MDRV_CPU_ADD_TAG("main", R3000BE, MASTER_CLOCK/2)
467467   MDRV_CPU_CONFIG(config)
468468   MDRV_CPU_PROGRAM_MAP(policetr_map,0)
469   MDRV_CPU_VBLANK_INT(irq4_gen,1)
469   MDRV_CPU_VBLANK_INT("main", irq4_gen)
470470
471471   MDRV_NVRAM_HANDLER(policetr)
472472
src/mame/drivers/seibuspi.c
r1877r1878
853853static WRITE32_HANDLER( ds2404_reset_w )
854854{
855855   if( ACCESSING_LSB32 ) {
856      DS2404_1W_reset_w(offset, data);
856      DS2404_1W_reset_w(machine, offset, data);
857857   }
858858}
859859
860860static READ32_HANDLER( ds2404_data_r )
861861{
862862   if( ACCESSING_LSB32 ) {
863      return DS2404_data_r(offset);
863      return DS2404_data_r(machine, offset);
864864   }
865865   return 0;
866866}
r1877r1878
868868static WRITE32_HANDLER( ds2404_data_w )
869869{
870870   if( ACCESSING_LSB32 ) {
871      DS2404_data_w(offset, data);
871      DS2404_data_w(machine, offset, data);
872872   }
873873}
874874
875875static WRITE32_HANDLER( ds2404_clk_w )
876876{
877877   if( ACCESSING_LSB32 ) {
878      DS2404_clk_w(offset, data);
878      DS2404_clk_w(machine, offset, data);
879879   }
880880}
881881
r1877r1878
938938
939939static READ32_HANDLER( spi_6295_0_r )
940940{
941   return OKIM6295_status_0_r(0);
941   return OKIM6295_status_0_r(machine, 0);
942942}
943943
944944static READ32_HANDLER( spi_6295_1_r )
945945{
946   return OKIM6295_status_1_r(0);
946   return OKIM6295_status_1_r(machine, 0);
947947}
948948
949949static WRITE32_HANDLER( spi_6295_0_w )
950950{
951951   if( ACCESSING_LSB32 ) {
952      OKIM6295_data_0_w(0, data & 0xff);
952      OKIM6295_data_0_w(machine, 0, data & 0xff);
953953   }
954954}
955955
956956static WRITE32_HANDLER( spi_6295_1_w )
957957{
958958   if( ACCESSING_LSB32 ) {
959      OKIM6295_data_1_w(0, data & 0xff);
959      OKIM6295_data_1_w(machine, 0, data & 0xff);
960960   }
961961}
962962
r1877r1878
17801780   /* basic machine hardware */
17811781   MDRV_CPU_ADD_TAG("main",I386, 50000000/2)   /* Intel 386DX, 25MHz */
17821782   MDRV_CPU_PROGRAM_MAP(spi_map, 0)
1783   MDRV_CPU_VBLANK_INT(spi_interrupt, 1)
1783   MDRV_CPU_VBLANK_INT("main", spi_interrupt)
17841784
17851785   MDRV_CPU_ADD_TAG("sound", Z80, 28636360/4)
17861786   /* audio CPU */
r1877r1878
20992099   /* basic machine hardware */
21002100   MDRV_CPU_ADD(I386, 40000000)   /* AMD 386DX, 40MHz */
21012101   MDRV_CPU_PROGRAM_MAP(seibu386_map, 0)
2102   MDRV_CPU_VBLANK_INT(spi_interrupt, 1)
2102   MDRV_CPU_VBLANK_INT("main", spi_interrupt)
21032103
21042104   MDRV_NVRAM_HANDLER(sxx2f)
21052105   MDRV_MACHINE_RESET(seibu386)
src/mame/drivers/coolpool.c
r1877r1878
7676 *
7777 *************************************/
7878
79static void amerdart_scanline(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params)
79static void amerdart_scanline(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params)
8080{
8181   UINT16 *vram = &vram_base[(params->rowaddr << 8) & 0xff00];
8282   UINT32 *dest = BITMAP_ADDR32(bitmap, scanline, 0);
r1877r1878
103103}
104104
105105
106static void coolpool_scanline(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params)
106static void coolpool_scanline(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params)
107107{
108108   UINT16 *vram = &vram_base[(params->rowaddr << 8) & 0x1ff00];
109109   UINT32 *dest = BITMAP_ADDR32(bitmap, scanline, 0);
r1877r1878
202202
203203static WRITE16_HANDLER( nvram_thrash_data_w )
204204{
205   nvram_data_w(offset, data, mem_mask);
206   nvram_thrash_w(offset, data, mem_mask);
205   nvram_data_w(machine, offset, data, mem_mask);
206   nvram_thrash_w(machine, offset, data, mem_mask);
207207}
208208
209209
src/mame/drivers/mwarr.c
r1877r1878
326326   tilemap_set_scroll_rows(mhigh_tilemap, 256);
327327}
328328
329static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
329static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
330330{
331331   const UINT16 *source = sprites_buffer+0x800-4;
332332   const UINT16 *finish = sprites_buffer;
r1877r1878
453453static MACHINE_DRIVER_START( mwarr )
454454   MDRV_CPU_ADD(M68000, 12000000)
455455   MDRV_CPU_PROGRAM_MAP(mwarr_map,0)
456   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
456   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
457457
458458   MDRV_GFXDECODE(mwarr)
459459
src/mame/drivers/sauro.c
r1877r1878
103103static WRITE8_HANDLER( sauro_sound_command_w )
104104{
105105   data |= 0x80;
106   soundlatch_w(offset, data);
106   soundlatch_w(machine, offset, data);
107107}
108108
109109static READ8_HANDLER( sauro_sound_command_r )
110110{
111   int ret   = soundlatch_r(offset);
112   soundlatch_clear_w(offset, 0);
111   int ret   = soundlatch_r(machine, offset);
112   soundlatch_clear_w(machine, offset, 0);
113113   return ret;
114114}
115115
r1877r1878
132132
133133static WRITE8_HANDLER( adpcm_w )
134134{
135   sp0256_ALD_w(0, data);
135   sp0256_ALD_w(machine, 0, data);
136136}
137137
138138static void lrq_callback(int state)
r1877r1878
363363static MACHINE_DRIVER_START( tecfri )
364364   /* basic machine hardware */
365365   MDRV_CPU_ADD_TAG("main", Z80, 4000000)        // 4 MHz???
366   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
366   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
367367
368368   /* video hardware */
369369   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
406406   MDRV_CPU_ADD(Z80, 4000000)   // 4 MHz?
407407   /* audio CPU */
408408   MDRV_CPU_PROGRAM_MAP(sauro_sound_readmem, sauro_sound_writemem)
409   MDRV_CPU_VBLANK_INT(sauro_interrupt, 8) // ?
409   MDRV_CPU_VBLANK_INT_HACK(sauro_interrupt, 8) // ?
410410
411411   MDRV_GFXDECODE(sauro)
412412
src/mame/drivers/gaplus.c
r1877r1878
264264static WRITE8_HANDLER( gaplus_snd_sharedram_w )
265265{
266266   if (offset < 0x40)
267      namco_15xx_w(offset,data);
267      namco_15xx_w(machine,offset,data);
268268   else
269269      namco_soundregs[offset] = data;
270270}
r1877r1878
758758   /* basic machine hardware */
759759   MDRV_CPU_ADD(M6809,   24576000/16)   /* 1.536 MHz */
760760   MDRV_CPU_PROGRAM_MAP(readmem_cpu1,writemem_cpu1)
761   MDRV_CPU_VBLANK_INT(gaplus_interrupt_1,1)
761   MDRV_CPU_VBLANK_INT("main", gaplus_interrupt_1)
762762
763763   MDRV_CPU_ADD(M6809,   24576000/16)   /* 1.536 MHz */
764764   MDRV_CPU_PROGRAM_MAP(readmem_cpu2,writemem_cpu2)
765   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
765   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
766766
767767   MDRV_CPU_ADD(M6809, 24576000/16)   /* 1.536 MHz */
768768   MDRV_CPU_PROGRAM_MAP(readmem_cpu3,writemem_cpu3)
769   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
769   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
770770
771771   MDRV_INTERLEAVE(100)   /* a high value to ensure proper synchronization of the CPUs */
772772   MDRV_MACHINE_RESET(gaplus)
src/mame/drivers/carpolo.c
r1877r1878
238238   /* basic machine hardware */
239239   MDRV_CPU_ADD(M6502,11289000/12)      /* 940.75 kHz */
240240   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
241   MDRV_CPU_VBLANK_INT(carpolo_timer_interrupt,1)   /* this not strictly VBLANK,
241   MDRV_CPU_VBLANK_INT("main", carpolo_timer_interrupt)   /* this not strictly VBLANK,
242242                                                       but it's supposed to happen 60
243243                                                       times a sec, so it's a good place */
244244   MDRV_MACHINE_START(carpolo)
src/mame/drivers/drmicro.c
r1877r1878
232232   MDRV_CPU_ADD(Z80,MCLK/6)   /* 3.072MHz? */
233233   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
234234   MDRV_CPU_IO_MAP(readport,writeport)
235   MDRV_CPU_VBLANK_INT(drmicro_interrupt,1)
235   MDRV_CPU_VBLANK_INT("main", drmicro_interrupt)
236236
237237   MDRV_INTERLEAVE(1)
238238
src/mame/drivers/speedatk.c
r1877r1878
270270   MDRV_CPU_ADD(Z80,12000000/2)
271271   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
272272   MDRV_CPU_IO_MAP(readport,writeport)
273   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
273   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
274274
275275   /* video hardware */
276276   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/vroulet.c
r1877r1878
258258   MDRV_CPU_ADD(Z80, 4000000)   //???
259259   MDRV_CPU_PROGRAM_MAP(vroulet_map, 0)
260260   MDRV_CPU_IO_MAP(vroulet_io_map, 0)
261   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
261   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
262262
263263   MDRV_MACHINE_RESET(vroulet)
264264
src/mame/drivers/twins.c
r1877r1878
168168   MDRV_CPU_ADD(V30, 8000000)
169169   MDRV_CPU_PROGRAM_MAP(twins_map, 0)
170170   MDRV_CPU_IO_MAP(twins_io,0)
171   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
171   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
172172
173173   /* video hardware */
174174   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
256256   MDRV_CPU_ADD(V30, XTAL_16MHz/2) /* verified on pcb */
257257   MDRV_CPU_PROGRAM_MAP(twins_map, 0)
258258   MDRV_CPU_IO_MAP(twinsa_io,0)
259   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
259   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
260260
261261   /* video hardware */
262262   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/system1.c
r1877r1878
9797static WRITE8_HANDLER( hvymetal_videomode_w )
9898{
9999   memory_set_bank(1, ((data & 0x04)>>2) + ((data & 0x40)>>5));
100   system1_videomode_w(0, data);
100   system1_videomode_w(machine, 0, data);
101101}
102102
103103static WRITE8_HANDLER( brain_videomode_w )
104104{
105105   memory_set_bank(1, ((data & 0x04)>>2) + ((data & 0x40)>>5));
106   system1_videomode_w(0, data);
106   system1_videomode_w(machine, 0, data);
107107}
108108
109109static WRITE8_HANDLER( chplft_videomode_w )
110110{
111111   memory_set_bank(1, (data & 0x0c)>>2);
112   system1_videomode_w(0, data);
112   system1_videomode_w(machine, 0, data);
113113}
114114
115115
116116static WRITE8_HANDLER( system1_soundport_w )
117117{
118   soundlatch_w(0,data);
119   cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
118   soundlatch_w(machine,0,data);
119   cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
120120   /* spin for a while to let the Z80 read the command (fixes hanging sound in Regulus) */
121121   cpu_spinuntil_time(ATTOTIME_IN_USEC(50));
122122}
r1877r1878
24862486   MDRV_CPU_ADD_TAG("main", Z80, 4000000)   /* My Hero has 2 OSCs 8 & 20 MHz (Cabbe Info) */
24872487   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
24882488   MDRV_CPU_IO_MAP(readport,writeport)
2489   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
2489   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
24902490
24912491   MDRV_CPU_ADD_TAG("sound", Z80, 4000000)
24922492   /* audio CPU */
24932493   MDRV_CPU_PROGRAM_MAP(sound_map,0)
2494   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)       /* NMIs are caused by the main CPU */
2494   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)       /* NMIs are caused by the main CPU */
24952495
24962496   MDRV_MACHINE_RESET(system1)
24972497
r1877r1878
47894789static WRITE8_HANDLER( dakkochn_port_15_w )
47904790{
47914791   dakkochn_control = data; // check if any control multiplex bits are in here!
4792   chplft_videomode_w(offset,data);
4792   chplft_videomode_w(machine,offset,data);
47934793}
47944794
47954795static DRIVER_INIT( dakkochn )
src/mame/drivers/cultures.c
r1877r1878
360360   MDRV_CPU_ADD(Z80, MCLK/2) /* 8.000 MHz */
361361   MDRV_CPU_PROGRAM_MAP(cultures_map,0)
362362   MDRV_CPU_IO_MAP(cultures_io_map,0)
363   MDRV_CPU_VBLANK_INT(cultures_interrupt,1)
363   MDRV_CPU_VBLANK_INT("main", cultures_interrupt)
364364
365365   /* video hardware */
366366   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/powerins.c
r1877r1878
7777{
7878   if (ACCESSING_LSB)
7979   {
80      soundlatch_w(0, data & 0xff);
80      soundlatch_w(machine, 0, data & 0xff);
8181   }
8282}
8383static READ8_HANDLER( powerinb_fake_ym2203_r )
r1877r1878
349349   /* basic machine hardware */
350350   MDRV_CPU_ADD(M68000, 12000000)   /* 12MHz */
351351   MDRV_CPU_PROGRAM_MAP(powerins_readmem,powerins_writemem)
352   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
352   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
353353
354354   MDRV_CPU_ADD_TAG("sound", Z80, 6000000) /* 6 MHz */
355355   /* audio CPU */
src/mame/drivers/quizo.c
r1877r1878
194194   MDRV_CPU_PROGRAM_MAP(memmap, 0)
195195   MDRV_CPU_IO_MAP(portmap, 0)
196196
197   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
197   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
198198
199199   /* video hardware */
200200   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/niyanpai.c
r1877r1878
8484   memory_set_bankptr(1, &SNDROM[0x08000 + (0x8000 * (data & 0x03))]);
8585}
8686
87static int niyanpai_sound_r(int offset)
87static int niyanpai_sound_r(running_machine *machine, int offset)
8888{
89   return soundlatch_r(0);
89   return soundlatch_r(machine, 0);
9090}
9191
9292static WRITE16_HANDLER( niyanpai_sound_w )
9393{
94   soundlatch_w(0, ((data >> 8) & 0xff));
94   soundlatch_w(machine, 0, ((data >> 8) & 0xff));
9595}
9696
97static void niyanpai_soundclr_w(int offset, int data)
97static void niyanpai_soundclr_w(running_machine *machine, int offset, int data)
9898{
99   soundlatch_clear_w(0, 0);
99   soundlatch_clear_w(machine, 0, 0);
100100}
101101
102102
103103/* TMPZ84C011 PIO emulation */
104104static UINT8 pio_dir[5], pio_latch[5];
105105
106static int tmpz84c011_pio_r(int offset)
106static int tmpz84c011_pio_r(running_machine *machine, int offset)
107107{
108108   int portdata;
109109
r1877r1878
119119         portdata = 0xff;
120120         break;
121121      case 3:         /* PD_0 */
122         portdata = niyanpai_sound_r(0);
122         portdata = niyanpai_sound_r(machine, 0);
123123         break;
124124      case 4:         /* PE_0 */
125125         portdata = 0xff;
r1877r1878
134134   return portdata;
135135}
136136
137static void tmpz84c011_pio_w(int offset, int data)
137static void tmpz84c011_pio_w(running_machine *machine, int offset, int data)
138138{
139139   switch (offset)
140140   {
r1877r1878
142142         niyanpai_soundbank_w(data & 0x03);
143143         break;
144144      case 1:         /* PB_0 */
145         DAC_1_WRITE(0, data);
145         DAC_1_WRITE(machine, 0, data);
146146         break;
147147      case 2:         /* PC_0 */
148         DAC_0_WRITE(0, data);
148         DAC_0_WRITE(machine, 0, data);
149149         break;
150150      case 3:         /* PD_0 */
151151         break;
152152      case 4:         /* PE_0 */
153         if (!(data & 0x01)) niyanpai_soundclr_w(0, 0);
153         if (!(data & 0x01)) niyanpai_soundclr_w(machine, 0, 0);
154154         break;
155155
156156      default:
r1877r1878
160160}
161161
162162/* CPU interface */
163static READ8_HANDLER( tmpz84c011_0_pa_r )   { return (tmpz84c011_pio_r(0) & ~pio_dir[0]) | (pio_latch[0] & pio_dir[0]); }
164static READ8_HANDLER( tmpz84c011_0_pb_r )   { return (tmpz84c011_pio_r(1) & ~pio_dir[1]) | (pio_latch[1] & pio_dir[1]); }
165static READ8_HANDLER( tmpz84c011_0_pc_r )   { return (tmpz84c011_pio_r(2) & ~pio_dir[2]) | (pio_latch[2] & pio_dir[2]); }
166static READ8_HANDLER( tmpz84c011_0_pd_r )   { return (tmpz84c011_pio_r(3) & ~pio_dir[3]) | (pio_latch[3] & pio_dir[3]); }
167static READ8_HANDLER( tmpz84c011_0_pe_r )   { return (tmpz84c011_pio_r(4) & ~pio_dir[4]) | (pio_latch[4] & pio_dir[4]); }
163static READ8_HANDLER( tmpz84c011_0_pa_r )   { return (tmpz84c011_pio_r(machine,0) & ~pio_dir[0]) | (pio_latch[0] & pio_dir[0]); }
164static READ8_HANDLER( tmpz84c011_0_pb_r )   { return (tmpz84c011_pio_r(machine,1) & ~pio_dir[1]) | (pio_latch[1] & pio_dir[1]); }
165static READ8_HANDLER( tmpz84c011_0_pc_r )   { return (tmpz84c011_pio_r(machine,2) & ~pio_dir[2]) | (pio_latch[2] & pio_dir[2]); }
166static READ8_HANDLER( tmpz84c011_0_pd_r )   { return (tmpz84c011_pio_r(machine,3) & ~pio_dir[3]) | (pio_latch[3] & pio_dir[3]); }
167static READ8_HANDLER( tmpz84c011_0_pe_r )   { return (tmpz84c011_pio_r(machine,4) & ~pio_dir[4]) | (pio_latch[4] & pio_dir[4]); }
168168
169static WRITE8_HANDLER( tmpz84c011_0_pa_w )   { pio_latch[0] = data; tmpz84c011_pio_w(0, data); }
170static WRITE8_HANDLER( tmpz84c011_0_pb_w )   { pio_latch[1] = data; tmpz84c011_pio_w(1, data); }
171static WRITE8_HANDLER( tmpz84c011_0_pc_w )   { pio_latch[2] = data; tmpz84c011_pio_w(2, data); }
172static WRITE8_HANDLER( tmpz84c011_0_pd_w )   { pio_latch[3] = data; tmpz84c011_pio_w(3, data); }
173static WRITE8_HANDLER( tmpz84c011_0_pe_w )   { pio_latch[4] = data; tmpz84c011_pio_w(4, data); }
169static WRITE8_HANDLER( tmpz84c011_0_pa_w )   { pio_latch[0] = data; tmpz84c011_pio_w(machine, 0, data); }
170static WRITE8_HANDLER( tmpz84c011_0_pb_w )   { pio_latch[1] = data; tmpz84c011_pio_w(machine, 1, data); }
171static WRITE8_HANDLER( tmpz84c011_0_pc_w )   { pio_latch[2] = data; tmpz84c011_pio_w(machine, 2, data); }
172static WRITE8_HANDLER( tmpz84c011_0_pd_w )   { pio_latch[3] = data; tmpz84c011_pio_w(machine, 3, data); }
173static WRITE8_HANDLER( tmpz84c011_0_pe_w )   { pio_latch[4] = data; tmpz84c011_pio_w(machine, 4, data); }
174174
175175static READ8_HANDLER( tmpz84c011_0_dir_pa_r )   { return pio_dir[0]; }
176176static READ8_HANDLER( tmpz84c011_0_dir_pb_r )   { return pio_dir[1]; }
r1877r1878
215215   for (i = 0; i < 5; i++)
216216   {
217217      pio_dir[i] = pio_latch[i] = 0;
218      tmpz84c011_pio_w(i, 0);
218      tmpz84c011_pio_w(machine, i, 0);
219219   }
220220}
221221
r1877r1878
295295   //  bit 2   motor on
296296   //  bit 3   coin lock
297297
298   if (tmp68301_parallel_interface_r(0x0005, 0x00ff) & 0x0004) musobana_outcoin_flag ^= 1;
298   if (tmp68301_parallel_interface_r(machine, 0x0005, 0x00ff) & 0x0004) musobana_outcoin_flag ^= 1;
299299   else musobana_outcoin_flag = 1;
300300
301301   return (((readinputport(2) & 0xdf) | ((musobana_outcoin_flag & 0x01) << 5)) << 8);
r1877r1878
852852   /* basic machine hardware */
853853   MDRV_CPU_ADD_TAG("main", M68000, 12288000/2)   /* TMP68301, 6.144 MHz */
854854   MDRV_CPU_PROGRAM_MAP(niyanpai_readmem,niyanpai_writemem)
855   MDRV_CPU_VBLANK_INT(niyanpai_interrupt,1)
855   MDRV_CPU_VBLANK_INT("main", niyanpai_interrupt)
856856
857857   MDRV_CPU_ADD(Z80, 8000000/1)               /* TMPZ84C011, 8.00 MHz */
858858   MDRV_CPU_CONFIG(daisy_chain_sound)
src/mame/drivers/exedexes.c
r1877r1878
225225   /* basic machine hardware */
226226   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz (?) */
227227   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
228   MDRV_CPU_VBLANK_INT(exedexes_interrupt,2)
228   MDRV_CPU_VBLANK_INT_HACK(exedexes_interrupt,2)
229229
230230   MDRV_CPU_ADD(Z80, 3000000)
231231   /* audio CPU */   /* 3 MHz ??? */
232232   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
233   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)
233   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)
234234
235235   /* video hardware */
236236   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
src/mame/drivers/jedi.c
r1877r1878
210210
211211static READ8_HANDLER( a2d_data_r )
212212{
213   jedi_state *state = Machine->driver_data;
213   jedi_state *state = machine->driver_data;
214214   UINT8 ret = 0;
215215
216216   switch (state->a2d_select)
r1877r1878
225225
226226static WRITE8_HANDLER( a2d_select_w )
227227{
228   jedi_state *state = Machine->driver_data;
228   jedi_state *state = machine->driver_data;
229229
230230   state->a2d_select = offset;
231231}
r1877r1878
246246
247247static WRITE8_HANDLER( nvram_data_w )
248248{
249   jedi_state *state = Machine->driver_data;
249   jedi_state *state = machine->driver_data;
250250
251251   if (state->nvram_enabled)
252252      generic_nvram[offset] = data;
r1877r1878
255255
256256static WRITE8_HANDLER( nvram_enable_w )
257257{
258   jedi_state *state = Machine->driver_data;
258   jedi_state *state = machine->driver_data;
259259
260260   state->nvram_enabled = ~offset & 1;
261261}
src/mame/drivers/bfm_sc2.c
r1877r1878
894894
895895static READ8_HANDLER( coin_input_r )
896896{
897   return input_port_0_r(0);
897   return input_port_0_r(machine, 0);
898898}
899899
900900///////////////////////////////////////////////////////////////////////////
r1877r1878
30003000
30013001   MDRV_CPU_ADD_TAG("adder2", M6809, MASTER_CLOCK/4 )   // adder2 board 6809 CPU at 2 Mhz
30023002   MDRV_CPU_PROGRAM_MAP(adder2_memmap,0)            // setup adder2 board memorymap
3003   MDRV_CPU_VBLANK_INT(adder2_vbl, 1)               // board has a VBL IRQ
3003   MDRV_CPU_VBLANK_INT("ADDER", adder2_vbl)         // board has a VBL IRQ
30043004
30053005   MDRV_SPEAKER_STANDARD_MONO("mono")
30063006   MDRV_SOUND_ADD(UPD7759, UPD7759_STANDARD_CLOCK)
src/mame/drivers/suprnova.c
r1877r1878
853853static WRITE32_HANDLER( skns_ymz280_w )
854854{
855855   if ((mem_mask & 0xff000000) == 0)
856      YMZ280B_register_0_w(offset,(data >> 24) & 0xff);
856      YMZ280B_register_0_w(machine,offset,(data >> 24) & 0xff);
857857   if ((mem_mask & 0x00ff0000) == 0)
858      YMZ280B_data_0_w(offset,(data >> 16) & 0xff);
858      YMZ280B_data_0_w(machine,offset,(data >> 16) & 0xff);
859859}
860860
861861static ADDRESS_MAP_START( skns_readmem, ADDRESS_SPACE_PROGRAM, 32 )
r1877r1878
951951static MACHINE_DRIVER_START(skns)
952952   MDRV_CPU_ADD(SH2,28638000)
953953   MDRV_CPU_PROGRAM_MAP(skns_readmem,skns_writemem)
954   MDRV_CPU_VBLANK_INT(skns_interrupt,2)
954   MDRV_CPU_VBLANK_INT_HACK(skns_interrupt,2)
955955
956956   MDRV_MACHINE_RESET(skns)
957957   MDRV_NVRAM_HANDLER(generic_1fill)
src/mame/drivers/seta2.c
r1877r1878
18141814   /* basic machine hardware */
18151815   MDRV_CPU_ADD_TAG("main",M68000,50000000/3)         /* !! TMP68301 @ 16.666666MHz !! */
18161816   MDRV_CPU_PROGRAM_MAP(mj4simai_readmem,mj4simai_writemem)
1817   MDRV_CPU_VBLANK_INT(seta2_interrupt,1)
1817   MDRV_CPU_VBLANK_INT("main", seta2_interrupt)
18181818
18191819   MDRV_MACHINE_RESET( tmp68301 )
18201820
r1877r1878
19291929   MDRV_IMPORT_FROM(mj4simai)
19301930   MDRV_CPU_MODIFY("main")
19311931   MDRV_CPU_PROGRAM_MAP(samshoot_map,0)
1932   MDRV_CPU_VBLANK_INT(samshoot_interrupt,2)
1932   MDRV_CPU_VBLANK_INT_HACK(samshoot_interrupt,2)
19331933
19341934   MDRV_NVRAM_HANDLER(generic_0fill)
19351935
src/mame/drivers/witch.c
r1877r1878
321321   case 0x02: return reg_a002;
322322   case 0x04: return readinputportbytag("A004");
323323  case 0x05: return readinputportbytag("A005");
324  case 0x0c: return input_port_0_r(0); // stats / reset
324  case 0x0c: return input_port_0_r(machine,0); // stats / reset
325325   case 0x0e: return readinputportbytag("A00E");// coin/reset
326326 }
327327
r1877r1878
331331    switch(reg_a002&0x3f)
332332    {
333333      case 0x3b:
334        return input_port_2_r(0);//bet10 / pay out
334        return input_port_2_r(machine,0);//bet10 / pay out
335335      case 0x3e:
336        return input_port_3_r(0);//TODO : trace f564
336        return input_port_3_r(machine,0);//TODO : trace f564
337337      case 0x3d:
338         return input_port_4_r(0);
338         return input_port_4_r(machine,0);
339339      default:
340340        logerror("A000 read with mux=0x%02x\n",reg_a002&0x3f);
341341    }
r1877r1878
691691  tilemap_set_palette_offset(gfx1_tilemap,0x200);
692692}
693693
694static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
694static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
695695{
696696   int i,sx,sy,tileno,flags,color;
697697   int flipx=0;
r1877r1878
770770   /* basic machine hardware */
771771   MDRV_CPU_ADD(Z80,8000000)       /* ? MHz */
772772   MDRV_CPU_PROGRAM_MAP(map_main, 0)
773   MDRV_CPU_VBLANK_INT(witch_main_interrupt,1)
773   MDRV_CPU_VBLANK_INT("main", witch_main_interrupt)
774774
775775   /* 2nd z80 */
776776   MDRV_CPU_ADD(Z80,8000000)       /* ? MHz */
777777   MDRV_CPU_PROGRAM_MAP(map_sub, 0)
778   MDRV_CPU_VBLANK_INT(witch_sub_interrupt,1)
778   MDRV_CPU_VBLANK_INT("main", witch_sub_interrupt)
779779
780780   MDRV_NVRAM_HANDLER(generic_0fill)
781781
src/mame/drivers/flkatck.c
r1877r1878
7878{
7979   switch ((offset & 0x1c) >> 2){
8080      case 0x04:   /* bankswitch */
81         flkatck_bankswitch_w(0, data);
81         flkatck_bankswitch_w(machine, 0, data);
8282         break;
8383      case 0x05:   /* sound code number */
84         soundlatch_w(0, data);
84         soundlatch_w(machine, 0, data);
8585         break;
8686      case 0x06:   /* Cause interrupt on audio CPU */
87         cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
87         cpunum_set_input_line(machine, 1,0,HOLD_LINE);
8888         break;
8989      case 0x07:   /* watchdog reset */
90         watchdog_reset_w(0, data);
90         watchdog_reset_w(machine, 0, data);
9191         break;
9292   }
9393}
r1877r1878
273273   /* basic machine hardware */
274274   MDRV_CPU_ADD(HD6309,3000000*4) /* HD63C09EP, 24/8 MHz */
275275   MDRV_CPU_PROGRAM_MAP(flkatck_readmem,flkatck_writemem)
276   MDRV_CPU_VBLANK_INT(flkatck_interrupt,1)
276   MDRV_CPU_VBLANK_INT("main", flkatck_interrupt)
277277
278278   MDRV_CPU_ADD(Z80,3579545)   /* NEC D780C-1, 3.579545 MHz */
279279   MDRV_CPU_PROGRAM_MAP(flkatck_readmem_sound,flkatck_writemem_sound)
src/mame/drivers/namcofl.c
r1877r1878
122122*/
123123
124124#include "driver.h"
125#include "deprecat.h"
125126#include "machine/eeprom.h"
126127#include "namconb1.h"
127128#include "namcos2.h"
src/mame/drivers/dynax.c
r1877r1878
295295static WRITE8_HANDLER( hnoridur_palbank_w )
296296{
297297   palbank = data & 0x0f;
298   dynax_blit_palbank_w(0,data);
298   dynax_blit_palbank_w(machine,0,data);
299299}
300300
301301static WRITE8_HANDLER( hnoridur_palette_w )
r1877r1878
338338static WRITE8_HANDLER( yarunara_palette_w )
339339{
340340   int addr = 512*palbank + offset;
341
342341   switch (hnoridur_bank)
343342   {
344343      case 0x10:
r1877r1878
346345         break;
347346
348347      case 0x1c:   // RTC
349         msm6242_w(offset,data);
348         msm6242_w(machine,offset,data);
350349         return;
351350
352351      default:
r1877r1878
360359      int r = br & 0x1f;
361360      int g = bg & 0x1f;
362361      int b = ((bg & 0xc0)>>3) | ((br & 0xe0)>>5);
363      palette_set_color_rgb(Machine, 256*palbank + ((offset&0xf)|((offset&0x1e0)>>1)) ,pal5bit(r),pal5bit(g),pal5bit(b));
362      palette_set_color_rgb(machine, 256*palbank + ((offset&0xf)|((offset&0x1e0)>>1)) ,pal5bit(r),pal5bit(g),pal5bit(b));
364363   }
365364}
366365
r1877r1878
444443
445444static WRITE8_HANDLER( yarunara_layer_half_w )
446445{
447   hanamai_layer_half_w(0,data >> 1);
446   hanamai_layer_half_w(machine,0,data >> 1);
448447}
449448static WRITE8_HANDLER( yarunara_layer_half2_w )
450449{
451   hnoridur_layer_half2_w(0,data >> 1);
450   hnoridur_layer_half2_w(machine,0,data >> 1);
452451}
453452
454453static ADDRESS_MAP_START( sprtmtch_mem_map, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
657656
658657static WRITE8_HANDLER( yarunara_flipscreen_w )
659658{
660   dynax_flipscreen_w(0,(data&2)?1:0);
659   dynax_flipscreen_w(machine,0,(data&2)?1:0);
661660}
662661
663662static WRITE8_HANDLER( yarunara_blit_romregion_w )
664663{
665664   switch(data)
666665   {
667      case 0x00:   dynax_blit_romregion_w(0,0);   return;
668      case 0x01:   dynax_blit_romregion_w(0,1);   return;
669      case 0x80:   dynax_blit_romregion_w(0,2);   return;
670      case 0x81:   dynax_blit_romregion_w(0,3);   return;
671      case 0x82:   dynax_blit_romregion_w(0,4);   return;   // mjcomv1
666      case 0x00:   dynax_blit_romregion_w(machine,0,0);   return;
667      case 0x01:   dynax_blit_romregion_w(machine,0,1);   return;
668      case 0x80:   dynax_blit_romregion_w(machine,0,2);   return;
669      case 0x81:   dynax_blit_romregion_w(machine,0,3);   return;
670      case 0x82:   dynax_blit_romregion_w(machine,0,4);   return;   // mjcomv1
672671   }
673672   logerror("%04x: unmapped romregion=%02X\n",activecpu_get_pc(),data);
674673}
r1877r1878
955954
956955static READ8_HANDLER( mjelctrn_keyboard_1_r )
957956{
958   return (hanamai_keyboard_1_r(0) & 0x3f) | (readinputport(15) ? 0x40 : 0);
957   return (hanamai_keyboard_1_r(machine,0) & 0x3f) | (readinputport(15) ? 0x40 : 0);
959958}
960959
961960static READ8_HANDLER( mjelctrn_dsw_r )
r1877r1878
10791078   {
10801079      case 0x00:   return readinputport(0);
10811080      case 0x01:   return 0xff;   //?
1082      case 0x02:   return 0xbf | ((htengoku_hopper && !(cpu_getcurrentframe()%10)) ? 0 : (1<<6));;   // bit 7 = blitter busy, bit 6 = hopper
1081      case 0x02:   return 0xbf | ((htengoku_hopper && !(video_screen_get_frame_number(0)%10)) ? 0 : (1<<6));;   // bit 7 = blitter busy, bit 6 = hopper
10831082      case 0x03:   return htengoku_coins;
10841083   }
10851084   logerror("%04x: coin_r with select = %02x\n",activecpu_get_pc(),htengoku_select);
r1877r1878
10981097{
10991098   switch(data)
11001099   {
1101      case 0x80:   dynax_blit_romregion_w(0,0);   return;
1102      case 0x81:   dynax_blit_romregion_w(0,1);   return;
1103      case 0x00:   dynax_blit_romregion_w(0,2);   return;
1100      case 0x80:   dynax_blit_romregion_w(machine,0,0);   return;
1101      case 0x81:   dynax_blit_romregion_w(machine,0,1);   return;
1102      case 0x00:   dynax_blit_romregion_w(machine,0,2);   return;
11041103   }
11051104   logerror("%04x: unmapped romregion=%02X\n",activecpu_get_pc(),data);
11061105}
r1877r1878
13281327   }
13291328   else if ( (rombank == 0x10) && (offset < 0x10) )
13301329   {
1331      return msm6242_r(offset);
1330      return msm6242_r(machine,offset);
13321331   }
13331332   else if (rombank == 0x12)
13341333   {
1335      return tenkai_palette_r(offset);
1334      return tenkai_palette_r(machine,offset);
13361335   }
13371336
13381337   logerror("%04x: unmapped offset %04X read with rombank=%02X\n",activecpu_get_pc(),offset,rombank);
r1877r1878
13431342{
13441343   if ( (rombank == 0x10) && (offset < 0x10) )
13451344   {
1346      msm6242_w(offset,data);
1345      msm6242_w(machine,offset,data);
13471346      return;
13481347   }
13491348   else if (rombank == 0x12)
13501349   {
1351      tenkai_palette_w(offset,data);
1350      tenkai_palette_w(machine,offset,data);
13521351      return;
13531352   }
13541353
r1877r1878
13751374{
13761375   switch(data)
13771376   {
1378      case 0x00:   dynax_blit_romregion_w(0,0);   return;
1379      case 0x83:   dynax_blit_romregion_w(0,1);   return;
1380      case 0x80:   dynax_blit_romregion_w(0,2);   return;
1377      case 0x00:   dynax_blit_romregion_w(machine,0,0);   return;
1378      case 0x83:   dynax_blit_romregion_w(machine,0,1);   return;
1379      case 0x80:   dynax_blit_romregion_w(machine,0,2);   return;
13811380   }
13821381   logerror("%04x: unmapped romregion=%02X\n",activecpu_get_pc(),data);
13831382}
r1877r1878
36053604   MDRV_CPU_ADD_TAG("main",Z80,22000000 / 4)   /* 5.5MHz */
36063605   MDRV_CPU_PROGRAM_MAP(sprtmtch_mem_map,0)
36073606   MDRV_CPU_IO_MAP(hanamai_io_map,0)
3608   MDRV_CPU_VBLANK_INT(sprtmtch_vblank_interrupt,1)   /* IM 0 needs an opcode on the data bus */
3607   MDRV_CPU_VBLANK_INT("main", sprtmtch_vblank_interrupt)   /* IM 0 needs an opcode on the data bus */
36093608
36103609   MDRV_MACHINE_RESET(adpcm)
36113610
r1877r1878
36603659   MDRV_CPU_ADD_TAG("main",Z80,22000000 / 4)   /* 5.5MHz */
36613660   MDRV_CPU_PROGRAM_MAP(hnoridur_mem_map,0)
36623661   MDRV_CPU_IO_MAP(hnoridur_io_map,0)
3663   MDRV_CPU_VBLANK_INT(sprtmtch_vblank_interrupt,1)   /* IM 0 needs an opcode on the data bus */
3662   MDRV_CPU_VBLANK_INT("main", sprtmtch_vblank_interrupt)   /* IM 0 needs an opcode on the data bus */
36643663
36653664   MDRV_MACHINE_RESET(adpcm)
36663665
r1877r1878
37143713   MDRV_CPU_ADD(Z80,22000000 / 4)   /* 5.5MHz */
37153714   MDRV_CPU_PROGRAM_MAP(sprtmtch_mem_map,0)
37163715   MDRV_CPU_IO_MAP(sprtmtch_io_map,0)
3717   MDRV_CPU_VBLANK_INT(sprtmtch_vblank_interrupt,1)   /* IM 0 needs an opcode on the data bus */
3716   MDRV_CPU_VBLANK_INT("main", sprtmtch_vblank_interrupt)   /* IM 0 needs an opcode on the data bus */
37183717
37193718   MDRV_NVRAM_HANDLER(generic_0fill)
37203719
r1877r1878
37543753   MDRV_CPU_ADD_TAG("main",Z80,24000000/4)   /* 6 MHz? */
37553754   MDRV_CPU_PROGRAM_MAP(sprtmtch_mem_map,0)
37563755   MDRV_CPU_IO_MAP(mjfriday_io_map,0)
3757   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
3756   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
37583757
37593758   MDRV_NVRAM_HANDLER(generic_0fill)
37603759
r1877r1878
38913890   MDRV_CPU_ADD_TAG("main",Z80,22000000 / 4)   /* 5.5MHz */
38923891   MDRV_CPU_PROGRAM_MAP(jantouki_mem_map,0)
38933892   MDRV_CPU_IO_MAP(jantouki_io_map,0)
3894   MDRV_CPU_VBLANK_INT(jantouki_vblank_interrupt, 1)   /* IM 0 needs an opcode on the data bus */
3893   MDRV_CPU_VBLANK_INT("top", jantouki_vblank_interrupt)   /* IM 0 needs an opcode on the data bus */
38953894
38963895   MDRV_CPU_ADD_TAG("sound",Z80,22000000 / 4)   /* 5.5MHz */
38973896   MDRV_CPU_PROGRAM_MAP(jantouki_sound_mem_map,0)
38983897   MDRV_CPU_IO_MAP(jantouki_sound_io_map,0)
3899   MDRV_CPU_VBLANK_INT(jantouki_sound_vblank_interrupt,1)   /* IM 0 needs an opcode on the data bus */
3898   MDRV_CPU_VBLANK_INT("top", jantouki_sound_vblank_interrupt)   /* IM 0 needs an opcode on the data bus */
39003899
39013900   MDRV_MACHINE_RESET(adpcm)
39023901
r1877r1878
39703969   MDRV_CPU_MODIFY("main")
39713970   MDRV_CPU_PROGRAM_MAP(nanajign_mem_map,0)
39723971   MDRV_CPU_IO_MAP(mjelctrn_io_map,0)
3973   MDRV_CPU_VBLANK_INT(mjelctrn_vblank_interrupt,1)   /* IM 2 needs a vector on the data bus */
3972   MDRV_CPU_VBLANK_INT("main", mjelctrn_vblank_interrupt)   /* IM 2 needs a vector on the data bus */
39743973
39753974   MDRV_VIDEO_START(mjelctrn)
39763975MACHINE_DRIVER_END
r1877r1878
40074006
40084007   MDRV_IMPORT_FROM( mjelctrn )
40094008   MDRV_CPU_MODIFY("main")
4010   MDRV_CPU_VBLANK_INT(neruton_vblank_interrupt,1+10)   /* IM 2 needs a vector on the data bus */
4009   MDRV_CPU_VBLANK_INT_HACK(neruton_vblank_interrupt,1+10)   /* IM 2 needs a vector on the data bus */
40114010
40124011   MDRV_VIDEO_START(neruton)
40134012MACHINE_DRIVER_END
r1877r1878
40324031
40334032   MDRV_IMPORT_FROM( neruton )
40344033   MDRV_CPU_MODIFY("main")
4035   MDRV_CPU_VBLANK_INT(majxtal7_vblank_interrupt,1)   /* IM 2 needs a vector on the data bus */
4034   MDRV_CPU_VBLANK_INT("main", majxtal7_vblank_interrupt)   /* IM 2 needs a vector on the data bus */
40364035
40374036MACHINE_DRIVER_END
40384037
r1877r1878
40544053   MDRV_CPU_ADD_TAG("main",Z80,20000000 / 4)
40554054   MDRV_CPU_PROGRAM_MAP(yarunara_mem_map,0)
40564055   MDRV_CPU_IO_MAP(htengoku_io_map,0)
4057   MDRV_CPU_VBLANK_INT(sprtmtch_vblank_interrupt,1)   /* IM 0 needs an opcode on the data bus */
4056   MDRV_CPU_VBLANK_INT("main", sprtmtch_vblank_interrupt)   /* IM 0 needs an opcode on the data bus */
40584057   MDRV_CPU_PERIODIC_INT(yarunara_clock_interrupt, 60)   // RTC
40594058
40604059   MDRV_NVRAM_HANDLER(generic_0fill)
r1877r1878
41124111   MDRV_CPU_ADD_TAG("main",TMP91640, 21472700 / 2)
41134112   MDRV_CPU_PROGRAM_MAP(tenkai_map,0)
41144113   MDRV_CPU_IO_MAP(tenkai_io_map,0)
4115   MDRV_CPU_VBLANK_INT(tenkai_interrupt,3)
4114   MDRV_CPU_VBLANK_INT_HACK(tenkai_interrupt,3)
41164115
41174116   MDRV_NVRAM_HANDLER(generic_0fill)
41184117
src/mame/drivers/shootout.c
r1877r1878
6161
6262static WRITE8_HANDLER( sound_cpu_command_w )
6363{
64   soundlatch_w( offset, data );
65   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE );
64   soundlatch_w( machine, offset, data );
65   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE );
6666}
6767
6868static WRITE8_HANDLER( shootout_flipscreen_w )
r1877r1878
305305   /* basic machine hardware */
306306   MDRV_CPU_ADD(M6502, 2000000)   /* 2 MHz? */
307307   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
308   MDRV_CPU_VBLANK_INT(shootout_interrupt,1) /* nmi's are triggered at coin up */
308   MDRV_CPU_VBLANK_INT("main", shootout_interrupt) /* nmi's are triggered at coin up */
309309
310310   MDRV_CPU_ADD(M6502, 1500000)
311311   /* audio CPU */
r1877r1878
340340   /* basic machine hardware */
341341   MDRV_CPU_ADD(M6502, 2000000)   /* 2 MHz? */
342342   MDRV_CPU_PROGRAM_MAP(readmem_alt,writemem_alt)
343   MDRV_CPU_VBLANK_INT(shootout_interrupt,1) /* nmi's are triggered at coin up */
343   MDRV_CPU_VBLANK_INT("main", shootout_interrupt) /* nmi's are triggered at coin up */
344344
345345   /* video hardware */
346346   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/contra.c
r1877r1878
6161
6262static WRITE8_HANDLER( cpu_sound_command_w )
6363{
64   soundlatch_w(offset,data);
64   soundlatch_w(machine,offset,data);
6565}
6666
6767
r1877r1878
249249   /* basic machine hardware */
250250    MDRV_CPU_ADD(M6809, 1500000)
251251   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
252   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
252   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
253253
254254    MDRV_CPU_ADD(M6809, 2000000)
255255   /* audio CPU */
src/mame/drivers/zn.c
r1877r1878
426426   /* basic machine hardware */
427427   MDRV_CPU_ADD_TAG( "MAIN", PSXCPU, XTAL_67_7376MHz )
428428   MDRV_CPU_PROGRAM_MAP( zn_map, 0 )
429   MDRV_CPU_VBLANK_INT( psx_vblank, 1 )
429   MDRV_CPU_VBLANK_INT("main", psx_vblank)
430430
431431   /* video hardware */
432432   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
462462   /* basic machine hardware */
463463   MDRV_CPU_ADD_TAG( "MAIN", PSXCPU, XTAL_100MHz )
464464   MDRV_CPU_PROGRAM_MAP( zn_map, 0 )
465   MDRV_CPU_VBLANK_INT( psx_vblank, 1 )
465   MDRV_CPU_VBLANK_INT("main", psx_vblank)
466466
467467   /* video hardware */
468468   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
624624
625625static WRITE32_HANDLER( zn_qsound_w )
626626{
627   soundlatch_w(0, data);
628   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
627   soundlatch_w(machine, 0, data);
628   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
629629}
630630
631631static DRIVER_INIT( coh1000c )
r1877r1878
691691   /* audio CPU */  /* 8MHz ?? */
692692   MDRV_CPU_PROGRAM_MAP( qsound_readmem, qsound_writemem )
693693   MDRV_CPU_IO_MAP( qsound_readport, 0 )
694   MDRV_CPU_VBLANK_INT( qsound_interrupt, 4 ) /* 4 interrupts per frame ?? */
694   MDRV_CPU_VBLANK_INT_HACK( qsound_interrupt, 4 ) /* 4 interrupts per frame ?? */
695695
696696   MDRV_MACHINE_RESET( coh1000c )
697697   MDRV_NVRAM_HANDLER( at28c16_0 )
r1877r1878
709709   /* audio CPU */  /* 8MHz ?? */
710710   MDRV_CPU_PROGRAM_MAP( qsound_readmem, qsound_writemem )
711711   MDRV_CPU_IO_MAP( qsound_readport, 0 )
712   MDRV_CPU_VBLANK_INT( qsound_interrupt, 4 ) /* 4 interrupts per frame ?? */
712   MDRV_CPU_VBLANK_INT_HACK( qsound_interrupt, 4 ) /* 4 interrupts per frame ?? */
713713
714714   MDRV_MACHINE_RESET( coh1000c )
715715   MDRV_NVRAM_HANDLER( at28c16_0 )
r1877r1878
893893   MDRV_CPU_ADD( Z80, 8000000 )
894894   MDRV_CPU_PROGRAM_MAP( qsound_readmem, qsound_writemem )
895895   MDRV_CPU_IO_MAP( qsound_readport, 0 )
896   MDRV_CPU_VBLANK_INT( qsound_interrupt, 4 ) /* 4 interrupts per frame ?? */
896   MDRV_CPU_VBLANK_INT_HACK( qsound_interrupt, 4 ) /* 4 interrupts per frame ?? */
897897
898898   MDRV_MACHINE_RESET( coh3002c )
899899   MDRV_NVRAM_HANDLER( at28c16_0 )
r1877r1878
11971197
11981198static READ32_HANDLER( taitofx1a_ymsound_r )
11991199{
1200   return taitosound_comm_r(0)<<16;
1200   return taitosound_comm_r(machine, 0)<<16;
12011201}
12021202
12031203static WRITE32_HANDLER( taitofx1a_ymsound_w )
12041204{
12051205   if (mem_mask == 0xffff0000)
12061206   {
1207      taitosound_port_w(0, data&0xff);
1207      taitosound_port_w(machine, 0, data&0xff);
12081208   }
12091209   else
12101210   {
1211      taitosound_comm_w(0, (data>>16)&0xff);
1211      taitosound_comm_w(machine, 0, (data>>16)&0xff);
12121212   }
12131213}
12141214
r1877r1878
13061306   MDRV_IMPORT_FROM( zn1_1mb_vram )
13071307
13081308   MDRV_CPU_MODIFY( "MAIN" )
1309   MDRV_CPU_VBLANK_INT( coh1000t_vblank, 1 )
1309   MDRV_CPU_VBLANK_INT("main", coh1000t_vblank)
13101310
13111311   MDRV_CPU_ADD( Z80, 16000000 / 4 )
13121312   /* audio CPU */   /* 4 MHz */
r1877r1878
13901390   MDRV_IMPORT_FROM( zn1_2mb_vram )
13911391
13921392   MDRV_CPU_MODIFY( "MAIN" )
1393   MDRV_CPU_VBLANK_INT( coh1000t_vblank, 1 )
1393   MDRV_CPU_VBLANK_INT("main", coh1000t_vblank)
13941394
13951395   MDRV_MACHINE_RESET( coh1000tb )
13961396   MDRV_NVRAM_HANDLER( coh1000tb )
r1877r1878
17051705   n_size <<= 2;
17061706   while( n_size > 0 )
17071707   {
1708      psxwritebyte( n_address, ide_controller32_0_r( 0x1f0 / 4, 0xffffff00 ) );
1708      psxwritebyte( n_address, ide_controller32_0_r( Machine, 0x1f0 / 4, 0xffffff00 ) );
17091709      n_address++;
17101710      n_size--;
17111711   }
r1877r1878
18991899
19001900static WRITE32_HANDLER( coh1002e_bank_w )
19011901{
1902   znsecsel_w( offset, data, mem_mask );
1902   znsecsel_w( machine, offset, data, mem_mask );
19031903
19041904   memory_set_bankptr( 1, memory_region( REGION_USER2 ) + ( ( data & 3 ) * 0x800000 ) );
19051905}
r1877r1878
19071907static WRITE32_HANDLER( coh1002e_latch_w )
19081908{
19091909   if (offset)
1910      cpunum_set_input_line(Machine, 1, 2, HOLD_LINE);   // irq 2 on the 68k
1910      cpunum_set_input_line(machine, 1, 2, HOLD_LINE);   // irq 2 on the 68k
19111911   else
1912      soundlatch_w(0, data);
1912      soundlatch_w(machine, 0, data);
19131913}
19141914
19151915static DRIVER_INIT( coh1002e )
r1877r1878
19291929
19301930static READ16_HANDLER( psarc_ymf_r )
19311931{
1932   return YMF271_0_r(0);
1932   return YMF271_0_r(machine,0);
19331933}
19341934
19351935static WRITE16_HANDLER( psarc_ymf_w )
19361936{
1937   YMF271_0_w(offset, data);
1937   YMF271_0_w(machine, offset, data);
19381938}
19391939
19401940static READ16_HANDLER( psarc_latch_r )
19411941{
1942   return soundlatch_r(0);
1942   return soundlatch_r(machine,0);
19431943}
19441944
19451945static ADDRESS_MAP_START( psarc_snd_map, ADDRESS_SPACE_PROGRAM, 16 )
r1877r1878
24862486   MDRV_IMPORT_FROM( zn1_2mb_vram )
24872487
24882488   MDRV_CPU_MODIFY( "MAIN" )
2489   MDRV_CPU_VBLANK_INT( coh1002v_vblank, 1 )
2489   MDRV_CPU_VBLANK_INT("main", coh1002v_vblank)
24902490
24912491   MDRV_MACHINE_RESET( coh1002v )
24922492   MDRV_NVRAM_HANDLER( at28c16_0 )
r1877r1878
26642664
26652665   cbaj_to_r3k &= ~2;
26662666
2667   return soundlatch2_r(0) | ready<<24;
2667   return soundlatch2_r(machine,0) | ready<<24;
26682668}
26692669
26702670static WRITE32_HANDLER( cbaj_z80_w )
r1877r1878
26982698static WRITE8_HANDLER( cbaj_z80_latch_w )
26992699{
27002700   cbaj_to_r3k |= 2;
2701   soundlatch2_w(0, data);
2701   soundlatch2_w(machine, 0, data);
27022702}
27032703
27042704static READ8_HANDLER( cbaj_z80_ready_r )
src/mame/drivers/paradise.c
r1877r1878
3030***************************************************************************/
3131
3232#include "driver.h"
33#include "deprecat.h"
3334#include "paradise.h"
3435#include "sound/okim6295.h"
3536
r1877r1878
539540   MDRV_CPU_ADD_TAG("main", Z80, XTAL_12MHz/2)         /* Z8400B - 6mhz Verified */
540541   MDRV_CPU_PROGRAM_MAP(paradise_map,0)
541542   MDRV_CPU_IO_MAP(paradise_readport,paradise_writeport)
542   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)   /* No nmi routine */
543   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)   /* No nmi routine */
543544
544545   /* video hardware */
545546   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/volfied.c
r1877r1878
265265   /* basic machine hardware */
266266   MDRV_CPU_ADD(M68000, 8000000)   /* 8MHz */
267267   MDRV_CPU_PROGRAM_MAP(volfied_readmem,volfied_writemem)
268   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
268   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
269269
270270   MDRV_CPU_ADD(Z80, 4000000)   /* sound CPU, required to run the game */
271271   MDRV_CPU_PROGRAM_MAP(z80_readmem,z80_writemem)
src/mame/drivers/dribling.c
r1877r1878
142142{
143143   /* bit 3 = watchdog */
144144   if (data & 0x08)
145      watchdog_reset_w(0, 0);
145      watchdog_reset(machine);
146146
147147   /* bit 2-0 = SH0-2 */
148148   sh = data & 0x07;
r1877r1878
159159static READ8_HANDLER( ioread )
160160{
161161   if (offset & 0x08)
162      return ppi8255_0_r(offset & 3);
162      return ppi8255_0_r(machine, offset & 3);
163163   else if (offset & 0x10)
164      return ppi8255_1_r(offset & 3);
164      return ppi8255_1_r(machine, offset & 3);
165165   return 0xff;
166166}
167167
r1877r1878
169169static WRITE8_HANDLER( iowrite )
170170{
171171   if (offset & 0x08)
172      ppi8255_0_w(offset & 3, data);
172      ppi8255_0_w(machine, offset & 3, data);
173173   else if (offset & 0x10)
174      ppi8255_1_w(offset & 3, data);
174      ppi8255_1_w(machine, offset & 3, data);
175175   else if (offset & 0x40)
176176   {
177177      dr = ds;
r1877r1878
301301   MDRV_CPU_ADD(Z80, 5000000)
302302   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
303303   MDRV_CPU_IO_MAP(readport,writeport)
304   MDRV_CPU_VBLANK_INT(dribling_irq_gen,1)
304   MDRV_CPU_VBLANK_INT("main", dribling_irq_gen)
305305
306306   MDRV_MACHINE_RESET(dribling)
307307
src/mame/drivers/frogger.c
r1877r1878
4343
4444static READ8_HANDLER(frogger_ppi8255_0_r)
4545{
46   return ppi8255_0_r(offset >> 1);
46   return ppi8255_0_r(machine, offset >> 1);
4747}
4848
4949static READ8_HANDLER(frogger_ppi8255_1_r)
5050{
51   return ppi8255_1_r(offset >> 1);
51   return ppi8255_1_r(machine, offset >> 1);
5252}
5353
5454static WRITE8_HANDLER(frogger_ppi8255_0_w)
5555{
56   ppi8255_0_w(offset >> 1, data);
56   ppi8255_0_w(machine, offset >> 1, data);
5757}
5858
5959static WRITE8_HANDLER(frogger_ppi8255_1_w)
6060{
61   ppi8255_1_w(offset >> 1, data);
61   ppi8255_1_w(machine, offset >> 1, data);
6262}
6363
6464
src/mame/drivers/balsente.c
r1877r1878
212212    9e0e W  -  R 1800e ($e,A3) : \
213213    9e0f W  -    1800f ($f,A3) : / partial pointer into SHM gfx data
214214
215***************************************************************************
216
217DIP locations verified for:
218    - stompin (manual)
219
215220***************************************************************************/
216221
217222#include "driver.h"
r1877r1878
297302 *
298303 *************************************/
299304
300#define UNUSED_ANALOG \
301   PORT_START\
302   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
303#define UNUSED_ANALOG_X2 UNUSED_ANALOG UNUSED_ANALOG
304#define UNUSED_ANALOG_X3 UNUSED_ANALOG_X2 UNUSED_ANALOG
305#define UNUSED_ANALOG_X4 UNUSED_ANALOG_X2 UNUSED_ANALOG_X2
305#define UNUSED_ANALOG PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
306306
307#define PLAYER1_ANALOG_JOYSTICK \
308   PORT_START\
309    PORT_BIT( 0xff, 0, IPT_AD_STICK_Y ) PORT_MINMAX(0x80,0x7f) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_PLAYER(1)\
310   PORT_START\
311    PORT_BIT( 0xff, 0, IPT_AD_STICK_X ) PORT_MINMAX(0x80,0x7f) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_REVERSE PORT_PLAYER(1)
307#define BALSENTE_COINAGE_ALT \
308   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Coinage ) )      PORT_DIPLOCATION("H1:1,2") \
309   PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) ) \
310   PORT_DIPSETTING(    0x01, DEF_STR( 1C_1C ) ) \
311   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) ) \
312   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
312313
313#define PLAYER2_ANALOG_JOYSTICK \
314   PORT_START\
315    PORT_BIT( 0xff, 0, IPT_AD_STICK_Y ) PORT_MINMAX(0x80,0x7f) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_PLAYER(2)\
316   PORT_START\
317    PORT_BIT( 0xff, 0, IPT_AD_STICK_X ) PORT_MINMAX(0x80,0x7f) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_REVERSE PORT_PLAYER(2)
314#define BALSENTE_COINAGE_ALT2 \
315   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("H1:1,2") \
316   PORT_DIPSETTING(    0x03, DEF_STR( 3C_1C ) ) \
317   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) ) \
318   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) ) \
319   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
318320
319#define PLAYER1_TRACKBALL \
320   PORT_START\
321    PORT_BIT( 0xff, 0, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_PLAYER(1)\
322   PORT_START\
323    PORT_BIT( 0xff, 0, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_REVERSE PORT_PLAYER(1)
321#define BALSENTE_PLAYERS_PER_COIN \
322   PORT_DIPNAME( 0x04, 0x04, "Players Per Credit" )   PORT_DIPLOCATION("H1:3") \
323   PORT_DIPSETTING(    0x00, "1" ) \
324   PORT_DIPSETTING(    0x04, "1 Or 2" )
324325
325#define PLAYER2_TRACKBALL \
326   PORT_START\
327    PORT_BIT( 0xff, 0, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_PLAYER(2)\
328   PORT_START\
329    PORT_BIT( 0xff, 0, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_REVERSE PORT_PLAYER(2)
330
331#define PLAYER1_DIAL \
332   PORT_START\
333    PORT_BIT( 0xff, 0, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_REVERSE PORT_PLAYER(1)
334
335#define PLAYER2_DIAL \
336   PORT_START\
337    PORT_BIT( 0xff, 0, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_REVERSE PORT_PLAYER(2)
338
339#define PLAYER1_WHEEL \
340   PORT_START\
341    PORT_BIT( 0xff, 0, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_PLAYER(1)
342
343#define PLAYER1_CROSSHAIRS \
344   PORT_START            /* fake analog X */\
345   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)\
346   PORT_START            /* fake analog Y */\
347   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10)
348
349
350326static INPUT_PORTS_START( sentetst )
351   PORT_START   /* IN0 */
352   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
327   PORT_START_TAG("IN0")
328   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )      PORT_DIPLOCATION("H1:1,2")
353329   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
354330   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
355331   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
356332   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
357   PORT_BIT( 0x7c, IP_ACTIVE_LOW, IPT_UNUSED )
358   PORT_DIPNAME( 0x80, 0x80, "High Scores" )
333   PORT_DIPUNUSED_DIPLOC( 0x04, 0x04, "H1:3" )
334   PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "H1:4" )
335   PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "H1:5" )
336   PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "H1:6" )
337   PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "H1:7" )
338   PORT_DIPNAME( 0x80, 0x80, "High Scores" )         PORT_DIPLOCATION("H1:8")
359339   PORT_DIPSETTING(    0x80, "Keep Top 5" )
360340   PORT_DIPSETTING(    0x00, "Keep All" )
361341
362   PORT_START   /* IN1 */
363   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Bonus_Life ) )
342   PORT_START_TAG("IN1")
343   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Bonus_Life ) )   PORT_DIPLOCATION("G1:1,2")
364344   PORT_DIPSETTING(    0x00, "Every 10,000" )
365345   PORT_DIPSETTING(    0x01, "Every 15,000" )
366346   PORT_DIPSETTING(    0x02, "Every 20,000" )
367347   PORT_DIPSETTING(    0x03, "Every 25,000" )
368   PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Lives ) )
348   PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Lives ) )      PORT_DIPLOCATION("G1:3,4")
369349   PORT_DIPSETTING(    0x00, "2" )
370350   PORT_DIPSETTING(    0x04, "3" )
371351   PORT_DIPSETTING(    0x08, "4" )
372352   PORT_DIPSETTING(    0x0c, "5" )
373   PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED )
374   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Difficulty ) )
353   PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "G1:5" )
354   PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "G1:6" )
355   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("G1:7")
375356   PORT_DIPSETTING(    0x40, DEF_STR( Easy ) )
376357   PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
377   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
358   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("G1:8")
378359   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
379360   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
380361
381   PORT_START   /* IN2 */
362   PORT_START_TAG("IN2")
382363   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(1)
383364   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(1)
384365   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(1)
r1877r1878
387368   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
388369   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
389370
390   PORT_START   /* IN3 */
371   PORT_START_TAG("IN3")
391372   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
392373   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
393374   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )
r1877r1878
395376   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
396377   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
397378
398   /* analog ports */
399   UNUSED_ANALOG_X2
400   PLAYER1_TRACKBALL
379   /* Analog ports */
380   PORT_START_TAG("AN0")
381   UNUSED_ANALOG
382
383   PORT_START_TAG("AN1")
384   UNUSED_ANALOG
385
386   /* Player 1 Trackball */
387   PORT_START_TAG("AN2")
388    PORT_BIT( 0xff, 0, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_PLAYER(1)
389
390   PORT_START_TAG("AN3")
391    PORT_BIT( 0xff, 0, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_REVERSE PORT_PLAYER(1)
401392INPUT_PORTS_END
402393
403394
404395static INPUT_PORTS_START( cshift )
405   PORT_START   /* IN0 */
406   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
407   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
408   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
409   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
410   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
411   PORT_BIT( 0x7c, IP_ACTIVE_LOW, IPT_UNUSED )
412   PORT_DIPNAME( 0x80, 0x80, "High Scores" )
413   PORT_DIPSETTING(    0x80, "Keep Top 5" )
414   PORT_DIPSETTING(    0x00, "Keep All" )
396   PORT_INCLUDE( sentetst )
415397
416   PORT_START   /* IN1 */
417   PORT_BIT( 0x03, IP_ACTIVE_LOW, IPT_UNUSED )
418   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Lives ) )
398   PORT_MODIFY("IN1")
399   PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "G1:1" )
400   PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "G1:2" )
401   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Lives ) )      PORT_DIPLOCATION("G1:3")
419402   PORT_DIPSETTING(    0x00, "2" )
420403   PORT_DIPSETTING(    0x04, "3" )
421   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
422   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
423   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
424   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
404   PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "G1:4" )
405   PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "G1:5" )
406   PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "G1:6" )
407   PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "G1:7" )
425408
426   PORT_START   /* IN2 */
409   PORT_MODIFY("IN2")
427410   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
428411   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
429412   PORT_BIT( 0x3c, IP_ACTIVE_LOW, IPT_UNUSED )
430   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
431   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
432413
433   PORT_START   /* IN3 */
434   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
435   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
414   PORT_MODIFY("IN3")
436415   PORT_BIT( 0x3c, IP_ACTIVE_LOW, IPT_UNUSED )
437   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
438   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
439416
440   /* analog ports */
441   UNUSED_ANALOG_X4
417   PORT_MODIFY("AN2")
418   UNUSED_ANALOG
419
420   PORT_MODIFY("AN3")
421   UNUSED_ANALOG
442422INPUT_PORTS_END
443423
444424
445425static INPUT_PORTS_START( gghost )
446   PORT_START   /* IN0 */
447   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
448   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
449   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
450   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
451   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
452   PORT_DIPNAME( 0x04, 0x04, "Players per Credit" )
453   PORT_DIPSETTING(    0x00, "1" )
454   PORT_DIPSETTING(    0x04, "1 or 2" )
455   PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNUSED )
426   PORT_INCLUDE( sentetst )
456427
457   PORT_START   /* IN1 */
458   PORT_DIPNAME( 0x07, 0x05, "Game Duration" )
459   PORT_DIPSETTING(    0x00, "9 points" )
460   PORT_DIPSETTING(    0x02, "11 points" )
461   PORT_DIPSETTING(    0x04, "15 points" )
462   PORT_DIPSETTING(    0x06, "21 points" )
463   PORT_DIPSETTING(    0x01, "timed, 1:15" )
464   PORT_DIPSETTING(    0x03, "timed, 1:30" )
465   PORT_DIPSETTING(    0x05, "timed, 2:00" )
466   PORT_DIPSETTING(    0x07, "timed, 2:30" )
467   PORT_BIT( 0x78, IP_ACTIVE_HIGH, IPT_UNUSED )
468   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
469   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
470   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
428   PORT_MODIFY("IN0")
429   BALSENTE_PLAYERS_PER_COIN
430   PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "H1:8" )
471431
472   PORT_START   /* IN2 */
432   PORT_MODIFY("IN1")
433   PORT_DIPNAME( 0x07, 0x05, "Game Duration" )         PORT_DIPLOCATION("G1:1,2,3")
434   PORT_DIPSETTING(    0x00, "9 Points" )
435   PORT_DIPSETTING(    0x02, "11 Points" )
436   PORT_DIPSETTING(    0x04, "15 Points" )
437   PORT_DIPSETTING(    0x06, "21 Points" )
438   PORT_DIPSETTING(    0x01, "Timed, 1:15" )
439   PORT_DIPSETTING(    0x03, "Timed, 1:30" )
440   PORT_DIPSETTING(    0x05, "Timed, 2:00" )
441   PORT_DIPSETTING(    0x07, "Timed, 2:30" )
442   PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "G1:5" )
443   PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "G1:4" )
444   PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "G1:3" )
445   PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "G1:2" )
446
447   PORT_MODIFY("IN2")
473448   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
474449   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
475450   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
476   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
477   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
478451
479   PORT_START   /* IN3 */
480   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
481   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
452   PORT_MODIFY("IN3")
482453   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
483454   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
484455   PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED )
485   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
486   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
487456
488   /* analog ports */
489   PLAYER2_TRACKBALL
490   PLAYER1_TRACKBALL
457   /* Player 2 Trackball */
458   PORT_MODIFY("AN0")
459    PORT_BIT( 0xff, 0, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_PLAYER(2)
460
461   PORT_MODIFY("AN1")
462    PORT_BIT( 0xff, 0, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_REVERSE PORT_PLAYER(2)
463
464   /* Player 1 Trackball */
465   PORT_MODIFY("AN2")
466    PORT_BIT( 0xff, 0, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_PLAYER(1)
467
468   PORT_MODIFY("AN3")
469    PORT_BIT( 0xff, 0, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_REVERSE PORT_PLAYER(1)
491470INPUT_PORTS_END
492471
493472
494473static INPUT_PORTS_START( hattrick )
495   PORT_START   /* IN0 */
496   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
497   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
498   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
499   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
500   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
501   PORT_DIPNAME( 0x04, 0x04, "Players Per Credit" )
502   PORT_DIPSETTING(    0x00, "1" )
503   PORT_DIPSETTING(    0x04, "1 or 2" )
504   PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNUSED )
474   PORT_INCLUDE( sentetst )
505475
506   PORT_START   /* IN1 */
507   PORT_DIPNAME( 0x07, 0x02, DEF_STR( Game_Time ) )
476   PORT_MODIFY("IN0")
477   BALSENTE_PLAYERS_PER_COIN
478   PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "H1:8" )
479
480   PORT_MODIFY("IN1")
481   PORT_DIPNAME( 0x07, 0x02, DEF_STR( Game_Time ) )   PORT_DIPLOCATION("G1:1,2,3")
508482   PORT_DIPSETTING(    0x00, "1:15" )
509483   PORT_DIPSETTING(    0x01, "1:30" )
510484   PORT_DIPSETTING(    0x02, "1:45" )
r1877r1878
513487   PORT_DIPSETTING(    0x05, "2:30" )
514488   PORT_DIPSETTING(    0x06, "2:45" )
515489   PORT_DIPSETTING(    0x07, "3:00" )
516   PORT_BIT( 0x78, IP_ACTIVE_HIGH, IPT_UNUSED )
517   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
518   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
519   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
490   PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "G1:4" )
491   PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "G1:5" )
492   PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "G1:6" )
493   PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "G1:7" )
520494
521   PORT_START   /* IN2 */
522   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
523   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
524   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
525   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
495   PORT_MODIFY("IN2")
526496   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
527497   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
528   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
529   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
530498
531   PORT_START   /* IN3 */
532   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
533   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
499   PORT_MODIFY("IN3")
534500   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
535501   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
536502   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
537503   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
538   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
539   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
540504
541   /* analog ports */
542   UNUSED_ANALOG_X4
505   PORT_MODIFY("AN2")
506   UNUSED_ANALOG
507
508   PORT_MODIFY("AN3")
509   UNUSED_ANALOG
543510INPUT_PORTS_END
544511
545512
546513static INPUT_PORTS_START( otwalls )
547   PORT_START   /* IN0 */
548   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
549   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
550   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
551   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
552   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
553   PORT_DIPNAME( 0x04, 0x04, "Players Per Credit" )
554   PORT_DIPSETTING(    0x00, "1" )
555   PORT_DIPSETTING(    0x04, "1 or 2" )
556   PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNUSED )
514   PORT_INCLUDE( sentetst )
557515
558   PORT_START   /* IN1 */
559   PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED )
560   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
561   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
562   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
516   PORT_MODIFY("IN0")
517   BALSENTE_PLAYERS_PER_COIN
518   PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "H1:8" )
563519
564   PORT_START   /* IN2 */
520   PORT_MODIFY("IN1")
521   PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "G1:1" )
522   PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "G1:2" )
523   PORT_DIPUNUSED_DIPLOC( 0x04, 0x04, "G1:3" )
524   PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "G1:4" )
525   PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "G1:7" )
526
527   PORT_MODIFY("IN2")
565528   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(2)
566529   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(2)
567530   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(1)
568531   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(1)
569   PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED )
570   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
571   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
572532
573   PORT_START   /* IN3 */
574   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
575   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
576   PORT_BIT( 0x3c, IP_ACTIVE_LOW, IPT_UNUSED )
577   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
578   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
533   PORT_MODIFY("IN3")
534   UNUSED_ANALOG
579535
580   /* analog ports */
581   UNUSED_ANALOG_X2
582   PLAYER1_DIAL
583   PLAYER2_DIAL
584INPUT_PORTS_END
536   /* Player 1 Dial */
537   PORT_MODIFY("AN2")
538    PORT_BIT( 0xff, 0, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_REVERSE PORT_PLAYER(1)
585539
586
587static INPUT_PORTS_START( snakepit )
588   PORT_START   /* IN0 */
589   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
590   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
591   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
592   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
593   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
594   PORT_BIT( 0x7c, IP_ACTIVE_LOW, IPT_UNUSED )
595   PORT_DIPNAME( 0x80, 0x80, "High Scores" )
596   PORT_DIPSETTING(    0x80, "Keep Top 5" )
597   PORT_DIPSETTING(    0x00, "Keep All" )
598
599   PORT_START   /* IN1 */
600   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Bonus_Life ) )
601   PORT_DIPSETTING(    0x00, "Every 10,000" )
602   PORT_DIPSETTING(    0x01, "Every 15,000" )
603   PORT_DIPSETTING(    0x02, "Every 20,000" )
604   PORT_DIPSETTING(    0x03, "Every 25,000" )
605   PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Lives ) )
606   PORT_DIPSETTING(    0x00, "2" )
607   PORT_DIPSETTING(    0x04, "3" )
608   PORT_DIPSETTING(    0x08, "4" )
609   PORT_DIPSETTING(    0x0c, "5" )
610   PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED )
611   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Difficulty ) )
612   PORT_DIPSETTING(    0x40, DEF_STR( Easy ) )
613   PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
614   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
615   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
616   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
617
618   PORT_START   /* IN2 */
619   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(1)
620   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(1)
621   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(1)
622   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(1)
623   PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED )
624   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
625   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
626
627   PORT_START   /* IN3 */
628   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
629   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
630   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )
631   PORT_BIT( 0x38, IP_ACTIVE_LOW, IPT_UNUSED )
632   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
633   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
634
635   /* analog ports */
636   UNUSED_ANALOG_X2
637   PLAYER1_TRACKBALL
540   /* Player 2 Dial */
541   PORT_MODIFY("AN3")
542    PORT_BIT( 0xff, 0, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_REVERSE PORT_PLAYER(2)
638543INPUT_PORTS_END
639544
640545
641546static INPUT_PORTS_START( snakjack )
642   PORT_START   /* IN0 */
643   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
644   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
645   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
646   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
647   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
648   PORT_BIT( 0x7c, IP_ACTIVE_LOW, IPT_UNUSED )
649   PORT_DIPNAME( 0x80, 0x80, "High Scores" )
650   PORT_DIPSETTING(    0x80, "Keep Top 5" )
651   PORT_DIPSETTING(    0x00, "Keep All" )
547   PORT_INCLUDE( sentetst )
652548
653   PORT_START   /* IN1 */
654   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Bonus_Life ) )
549   PORT_MODIFY("IN1")
550   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Bonus_Life ) )   PORT_DIPLOCATION("G1:1,2")
655551   PORT_DIPSETTING(    0x00, "Every 15,000" )
656552   PORT_DIPSETTING(    0x01, "Every 20,000" )
657553   PORT_DIPSETTING(    0x02, "Every 25,000" )
658554   PORT_DIPSETTING(    0x03, "Every 30,000" )
659   PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Lives ) )
660   PORT_DIPSETTING(    0x00, "2" )
661   PORT_DIPSETTING(    0x04, "3" )
662   PORT_DIPSETTING(    0x08, "4" )
663   PORT_DIPSETTING(    0x0c, "5" )
664   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
665   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
666   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
667   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
555   PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "G1:7" )
668556
669   PORT_START   /* IN2 */
670   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
671   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
672   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
673
674   PORT_START   /* IN3 */
675   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
676   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
677   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )
678   PORT_BIT( 0x38, IP_ACTIVE_LOW, IPT_UNUSED )
679   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
680   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
681
682   /* analog ports */
683   UNUSED_ANALOG_X2
684   PLAYER1_TRACKBALL
557   PORT_MODIFY("IN2")
558   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
685559INPUT_PORTS_END
686560
687561
688562static INPUT_PORTS_START( stocker )
689   PORT_START   /* IN0 */
690   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Coinage ) )
691   PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
692   PORT_DIPSETTING(    0x01, DEF_STR( 1C_1C ) )
693   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
694   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
695   PORT_DIPNAME( 0x1c, 0x00, "Bonus Coins" )
563   PORT_INCLUDE( sentetst )
564
565   PORT_MODIFY("IN0")
566   PORT_DIPNAME( 0x1c, 0x00, "Bonus Coins" )      PORT_DIPLOCATION("H1:3,4,5")
696567   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
697568   PORT_DIPSETTING(    0x04, "2 Coins = 1 Bonus" )
698569   PORT_DIPSETTING(    0x08, "3 Coins = 1 Bonus" )
r1877r1878
701572   PORT_DIPSETTING(    0x14, "5 Coins = 1 Bonus" )
702573   PORT_DIPSETTING(    0x18, "5 Coins = 2 Bonus" )
703574   PORT_DIPSETTING(    0x1c, "5 Coins = 3 Bonus" )
704   PORT_DIPNAME( 0x20, 0x00, "Left Coin Mech" )
575   PORT_DIPNAME( 0x20, 0x00, "Left Coin Mech" )   PORT_DIPLOCATION("H1:6")
705576   PORT_DIPSETTING(    0x00, "x1" )
706577   PORT_DIPSETTING(    0x20, "x2" )
707   PORT_DIPNAME( 0xc0, 0x00, "Right Coin Mech" )
578   PORT_DIPNAME( 0xc0, 0x00, "Right Coin Mech" )   PORT_DIPLOCATION("H1:7,8")
708579   PORT_DIPSETTING(    0x00, "x1" )
709580   PORT_DIPSETTING(    0x40, "x4" )
710581   PORT_DIPSETTING(    0x80, "x5" )
711582   PORT_DIPSETTING(    0xc0, "x6" )
712583
713   PORT_START   /* IN1 */
714   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
715   PORT_DIPNAME( 0x40, 0x40, "End of Game" )
584   PORT_MODIFY("IN1")
585   PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "G1:1" )
586   PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "G1:2" )
587   PORT_DIPUNUSED_DIPLOC( 0x04, 0x04, "G1:3" )
588   PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "G1:4" )
589   PORT_DIPNAME( 0x40, 0x40, "End Of Game" )      PORT_DIPLOCATION("G1:7")
716590   PORT_DIPSETTING(    0x40, DEF_STR( Normal ) )
717591   PORT_DIPSETTING(    0x00, "3 Tickets" )
718   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
719   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
720   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
721592
722   PORT_START   /* IN2 */
723   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
724   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
725   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
593   PORT_MODIFY("IN2")
594   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
726595
727   PORT_START   /* IN3 */
728   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
596   PORT_MODIFY("IN3")
729597   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
730   PORT_BIT( 0x3c, IP_ACTIVE_LOW, IPT_UNUSED )
731   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
732   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
598   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
733599
734   /* analog ports */
735   UNUSED_ANALOG_X3
736   PLAYER1_WHEEL
600   PORT_MODIFY("AN2")
601   UNUSED_ANALOG
602
603   /* Player 1 Wheel */
604   PORT_MODIFY("AN3")
605    PORT_BIT( 0xff, 0, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_PLAYER(1)
737606INPUT_PORTS_END
738607
739608
740609static INPUT_PORTS_START( triviag1 )
741   PORT_START   /* IN0 */
742   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
743   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
744   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
745   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
746   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
747   PORT_BIT( 0x1c, IP_ACTIVE_LOW, IPT_UNUSED )
748   PORT_DIPNAME( 0x20, 0x00, "Sound" )
610   PORT_INCLUDE( sentetst )
611
612   PORT_MODIFY("IN0")
613   PORT_DIPNAME( 0x20, 0x00, "Sound" )         PORT_DIPLOCATION("H1:6")
749614   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
750615   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
751   PORT_DIPNAME( 0x40, 0x00, "Sound Test" )
616   PORT_DIPNAME( 0x40, 0x00, "Sound Test" )   PORT_DIPLOCATION("H1:7")
752617   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
753618   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
754   PORT_DIPNAME( 0x80, 0x80, "High Scores" )
619   PORT_DIPNAME( 0x80, 0x80, "High Scores" )   PORT_DIPLOCATION("H1:8")
755620   PORT_DIPSETTING(    0x00, "Keep Top 5" )
756621   PORT_DIPSETTING(    0x80, "Keep Top 10" )
757622
758   PORT_START   /* IN1 */
759   PORT_BIT( 0x03, IP_ACTIVE_LOW, IPT_UNUSED )
760   PORT_DIPNAME( 0x0c, 0x04, "Guesses" )
623   PORT_MODIFY("IN1")
624   PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "G1:1" )
625   PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "G1:2" )
626   PORT_DIPNAME( 0x0c, 0x04, "Guesses" )      PORT_DIPLOCATION("G1:3,4")
761627   PORT_DIPSETTING(    0x00, "3" )
762628   PORT_DIPSETTING(    0x04, "4" )
763629   PORT_DIPSETTING(    0x08, "5" )
764630   PORT_DIPSETTING(    0x0c, "6" )
765   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
766   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
767   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
768   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
631   PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "G1:7" )
769632
770   PORT_START   /* IN2 */
771   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
772   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
773   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
774   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
633   PORT_MODIFY("IN2")
775634   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
776635   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
777   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
778   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
779636
780   PORT_START   /* IN3 */
781   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
782   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
637   PORT_MODIFY("IN3")
783638   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START3 )
784639   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START4 )
785   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Red Button")
786   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Green Button")
787   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
788   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
640   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Red Button")
641   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Green Button")
789642
790   /* analog ports */
791   UNUSED_ANALOG_X4
643   PORT_MODIFY("AN2")
644   UNUSED_ANALOG
645
646   PORT_MODIFY("AN3")
647   UNUSED_ANALOG
792648INPUT_PORTS_END
793649
794650
795651static INPUT_PORTS_START( triviaes )
796   PORT_START   /* IN0 */
797   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )
652   PORT_INCLUDE( triviag1 )
653
654   PORT_MODIFY("IN0")
655   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )   PORT_DIPLOCATION("H1:1,2")
798656   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
799657   PORT_DIPSETTING(    0x03, DEF_STR( Free_Play ) )
800658   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C) )
801659   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
802   PORT_BIT( 0x1c, IP_ACTIVE_LOW, IPT_UNUSED )
803   PORT_DIPNAME( 0x20, 0x00, "Sound" )
804   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
805   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
806   PORT_DIPNAME( 0x40, 0x00, "Sound Test" )
807   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
808   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
809   PORT_DIPNAME( 0x80, 0x80, "High Scores" )
810   PORT_DIPSETTING(    0x00, "Keep Top 5" )
811   PORT_DIPSETTING(    0x80, "Keep Top 10" )
812660
813   PORT_START   /* IN1 */
814   PORT_BIT( 0x03, IP_ACTIVE_LOW, IPT_UNUSED )
815   PORT_DIPNAME( 0x0c, 0x04, "Guesses" )
661   PORT_MODIFY("IN1")
662   PORT_DIPNAME( 0x0c, 0x04, "Guesses" )         PORT_DIPLOCATION("G1:3,4")
816663   PORT_DIPSETTING(    0x00, "2" )
817664   PORT_DIPSETTING(    0x04, "3" )
818665   PORT_DIPSETTING(    0x08, "4" )
819666   PORT_DIPSETTING(    0x0c, "5" )
820   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
821   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
822   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
823   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
824
825   PORT_START   /* IN2 */
826   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
827   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
828   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
829   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
830   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
831   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
832   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
833   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
834
835   PORT_START   /* IN3 */
836   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
837   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
838   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START3 )
839   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START4 )
840   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Red Button")
841   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Green Button")
842   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
843   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
844
845   /* analog ports */
846   UNUSED_ANALOG_X4
847667INPUT_PORTS_END
848668
849669
850670static INPUT_PORTS_START( gimeabrk )
851   PORT_START   /* IN0 */
852   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Coinage ) )
853   PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
854   PORT_DIPSETTING(    0x01, DEF_STR( 1C_1C ) )
855   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
856   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
857   PORT_DIPNAME( 0x1c, 0x00, "Bonus Coins" )
858   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
859   PORT_DIPSETTING(    0x04, "2 Coins = 1 Bonus" )
860   PORT_DIPSETTING(    0x08, "3 Coins = 1 Bonus" )
861   PORT_DIPSETTING(    0x0c, "4 Coins = 1 Bonus" )
862   PORT_DIPSETTING(    0x10, "4 Coins = 2 Bonus" )
863   PORT_DIPSETTING(    0x14, "5 Coins = 1 Bonus" )
864   PORT_DIPSETTING(    0x18, "5 Coins = 2 Bonus" )
865   PORT_DIPSETTING(    0x1c, "5 Coins = 3 Bonus" )
866   PORT_DIPNAME( 0x20, 0x00, "Left Coin Mech" )
867   PORT_DIPSETTING(    0x00, "x1" )
868   PORT_DIPSETTING(    0x20, "x2" )
869   PORT_DIPNAME( 0xc0, 0x00, "Right Coin Mech" )
870   PORT_DIPSETTING(    0x00, "x1" )
871   PORT_DIPSETTING(    0x40, "x4" )
872   PORT_DIPSETTING(    0x80, "x5" )
873   PORT_DIPSETTING(    0xc0, "x6" )
874   PORT_START   /* IN1 */
875   PORT_DIPNAME( 0x03, 0x01, "Bonus Shot" )
671   PORT_INCLUDE( stocker )
672
673   PORT_MODIFY("IN0")
674   BALSENTE_COINAGE_ALT
675
676   PORT_MODIFY("IN1")
677   PORT_DIPNAME( 0x03, 0x01, "Bonus Shot" )         PORT_DIPLOCATION("G1:1,2")
876678   PORT_DIPSETTING(    0x00, "Every 6 Balls" )
877679   PORT_DIPSETTING(    0x01, "Every 8 Balls" )
878680   PORT_DIPSETTING(    0x02, "Every 10 Balls" )
879681   PORT_DIPSETTING(    0x03, "Every 12 Balls" )
880   PORT_DIPNAME( 0x0c, 0x08, "Initial Shots" )
682   PORT_DIPNAME( 0x0c, 0x08, "Initial Shots" )         PORT_DIPLOCATION("G1:3,4")
881683   PORT_DIPSETTING(    0x00, "8" )
882684   PORT_DIPSETTING(    0x04, "10" )
883685   PORT_DIPSETTING(    0x08, "12" )
884686   PORT_DIPSETTING(    0x0c, "14" )
885   PORT_DIPNAME( 0x10, 0x00, "Players Per Credit" )
687   PORT_DIPNAME( 0x10, 0x00, "Players Per Credit" )   PORT_DIPLOCATION("G1:5")
886688   PORT_DIPSETTING(    0x00, "1" )
887   PORT_DIPSETTING(    0x10, "1 or 2" )
888   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Cabinet ) )
689   PORT_DIPSETTING(    0x10, "1 Or 2" )
690   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Cabinet ) )      PORT_DIPLOCATION("G1:6")
889691   PORT_DIPSETTING(    0x20, DEF_STR( Upright ) )
890692   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
891   PORT_DIPNAME( 0x40, 0x40, "High Scores" )
693   PORT_DIPNAME( 0x40, 0x40, "High Scores" )         PORT_DIPLOCATION("G1:7")
892694   PORT_DIPSETTING(    0x40, "Keep Top 5" )
893695   PORT_DIPSETTING(    0x00, "Keep All" )
894   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
895   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
896   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
897696
898   PORT_START   /* IN2 */
899   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
900   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
901   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
902
903   PORT_START   /* IN3 */
904   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
905   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
697   PORT_MODIFY("IN3")
906698   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
907699   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 )
908700   PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED )
909   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
910   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
911701
912   /* analog ports */
913   PLAYER1_TRACKBALL
914   UNUSED_ANALOG_X2
702   /* Player 1 Trackball */
703   PORT_MODIFY("AN0")
704    PORT_BIT( 0xff, 0, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_PLAYER(1)
705
706   PORT_MODIFY("AN1")
707    PORT_BIT( 0xff, 0, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_REVERSE PORT_PLAYER(1)
708
709   PORT_MODIFY("AN3")
710   UNUSED_ANALOG
915711INPUT_PORTS_END
916712
917713
918714static INPUT_PORTS_START( minigolf )
919   PORT_START   /* IN0 */
920   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )
921   PORT_DIPSETTING(    0x03, DEF_STR( 3C_1C ) )
922   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
923   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
924   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
925   PORT_DIPNAME( 0x1c, 0x00, "Bonus Coins" )
926   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
927   PORT_DIPSETTING(    0x04, "2 Coins = 1 Bonus" )
928   PORT_DIPSETTING(    0x08, "3 Coins = 1 Bonus" )
929   PORT_DIPSETTING(    0x0c, "4 Coins = 1 Bonus" )
930   PORT_DIPSETTING(    0x10, "4 Coins = 2 Bonus" )
931   PORT_DIPSETTING(    0x14, "5 Coins = 1 Bonus" )
932   PORT_DIPSETTING(    0x18, "5 Coins = 2 Bonus" )
933   PORT_DIPSETTING(    0x1c, "5 Coins = 3 Bonus" )
934   PORT_DIPNAME( 0x20, 0x00, "Left Coin Mech" )
935   PORT_DIPSETTING(    0x00, "x1" )
936   PORT_DIPSETTING(    0x20, "x2" )
937   PORT_DIPNAME( 0xc0, 0x00, "Right Coin Mech" )
938   PORT_DIPSETTING(    0x00, "x1" )
939   PORT_DIPSETTING(    0x40, "x4" )
940   PORT_DIPSETTING(    0x80, "x5" )
941   PORT_DIPSETTING(    0xc0, "x6" )
715   PORT_INCLUDE( stocker )
942716
943   PORT_START   /* IN1 */
944   PORT_DIPNAME( 0x01, 0x01, "Add-A-Coin" )
717   PORT_MODIFY("IN0")
718   BALSENTE_COINAGE_ALT2
719
720   PORT_MODIFY("IN1")
721   PORT_DIPNAME( 0x01, 0x01, "Add-A-Coin" )         PORT_DIPLOCATION("G1:1")
945722   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
946723   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
947   PORT_DIPNAME( 0x02, 0x02, "Display Kids" )
724   PORT_DIPNAME( 0x02, 0x02, "Display Kids" )         PORT_DIPLOCATION("G1:2")
948725   PORT_DIPSETTING(    0x02, DEF_STR( No ) )
949726   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
950   PORT_DIPNAME( 0x04, 0x04, "Kid on Left Located" )
727   PORT_DIPNAME( 0x04, 0x04, "Kid On Left Located" )   PORT_DIPLOCATION("G1:3")
951728   PORT_DIPSETTING(    0x04, DEF_STR( No ) )
952729   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
953   PORT_DIPNAME( 0x08, 0x08, "Kid on Right Located" )
730   PORT_DIPNAME( 0x08, 0x08, "Kid On Right Located" )   PORT_DIPLOCATION("G1:4")
954731   PORT_DIPSETTING(    0x08, DEF_STR( No ) )
955732   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
956   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
957   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
958   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
959   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
960   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
961   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
962   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
963   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
964   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
965   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
966   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
967   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
733   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "G1:5" )
734   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "G1:6" )
735   PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x40, "G1:7" )
968736
969   PORT_START   /* IN2 */
970   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
971   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
972   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
973
974   PORT_START   /* IN3 */
975   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
737   PORT_MODIFY("IN3")
976738   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
977739   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START3 )
978740   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START4 )
979741   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
980742   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
981   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
982   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
983743
984   /* analog ports */
985   UNUSED_ANALOG_X2
986   PLAYER1_TRACKBALL
744   /* Player 1 Trackball */
745   PORT_MODIFY("AN2")
746    PORT_BIT( 0xff, 0, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_PLAYER(1)
747
748   PORT_MODIFY("AN3")
749    PORT_BIT( 0xff, 0, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_REVERSE PORT_PLAYER(1)
987750INPUT_PORTS_END
988751
989752
990753static INPUT_PORTS_START( minigol2 )
991   PORT_START   /* IN0 */
992   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Coinage ) )
993   PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
994   PORT_DIPSETTING(    0x01, DEF_STR( 1C_1C ) )
995   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
996   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
997   PORT_DIPNAME( 0x1c, 0x00, "Bonus Coins" )
998   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
999   PORT_DIPSETTING(    0x04, "2 Coins = 1 Bonus" )
1000   PORT_DIPSETTING(    0x08, "3 Coins = 1 Bonus" )
1001   PORT_DIPSETTING(    0x0c, "4 Coins = 1 Bonus" )
1002   PORT_DIPSETTING(    0x10, "4 Coins = 2 Bonus" )
1003   PORT_DIPSETTING(    0x14, "5 Coins = 1 Bonus" )
1004   PORT_DIPSETTING(    0x18, "5 Coins = 2 Bonus" )
1005   PORT_DIPSETTING(    0x1c, "5 Coins = 3 Bonus" )
1006   PORT_DIPNAME( 0x20, 0x00, "Left Coin Mech" )
1007   PORT_DIPSETTING(    0x00, "x1" )
1008   PORT_DIPSETTING(    0x20, "x2" )
1009   PORT_DIPNAME( 0xc0, 0x00, "Right Coin Mech" )
1010   PORT_DIPSETTING(    0x00, "x1" )
1011   PORT_DIPSETTING(    0x40, "x4" )
1012   PORT_DIPSETTING(    0x80, "x5" )
1013   PORT_DIPSETTING(    0xc0, "x6" )
754   PORT_INCLUDE( minigolf )
1014755
1015   PORT_START   /* IN1 */
1016   PORT_DIPNAME( 0x01, 0x01, "Add-A-Coin" )
1017   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1018   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1019   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
1020   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1021   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1022   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
1023   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1024   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1025   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
1026   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1027   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1028   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1029   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1030   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1031   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
1032   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1033   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1034   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
1035   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1036   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1037   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
1038   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1039   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
756   PORT_MODIFY("IN0")
757   BALSENTE_COINAGE_ALT
1040758
1041   PORT_START   /* IN2 */
1042   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
1043   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
1044   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
1045
1046   PORT_START   /* IN3 */
1047   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1048   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
1049   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START3 )
1050   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START4 )
1051   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
1052   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
1053   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
1054   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
1055
1056   /* analog ports */
1057   UNUSED_ANALOG_X2
1058   PLAYER1_TRACKBALL
759   PORT_MODIFY("IN1")
760   PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "G1:2" )
761   PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "G1:3" )
762   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "G1:4" )
1059763INPUT_PORTS_END
1060764
1061765
1062766static INPUT_PORTS_START( toggle )
1063   PORT_START   /* IN0 */
1064   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
1065   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
1066   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
1067   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
1068   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
1069   PORT_BIT( 0x7c, IP_ACTIVE_LOW, IPT_UNUSED )
1070   PORT_DIPNAME( 0x80, 0x80, "High Scores" )
1071   PORT_DIPSETTING(    0x80, "Keep Top 5" )
1072   PORT_DIPSETTING(    0x00, "Keep All" )
767   PORT_INCLUDE( sentetst )
1073768
1074   PORT_START   /* IN1 */
1075   PORT_BIT( 0x03, IP_ACTIVE_LOW, IPT_UNUSED )
1076   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Lives ) )
769   PORT_MODIFY("IN1")
770   PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "G1:1" )
771   PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "G1:2" )
772   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Lives ) )   PORT_DIPLOCATION("G1:3")
1077773   PORT_DIPSETTING(    0x00, "2" )
1078774   PORT_DIPSETTING(    0x04, "3" )
1079   PORT_BIT( 0x78, IP_ACTIVE_LOW, IPT_UNUSED )
1080   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
1081   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1082   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
775   PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "G1:4" )
776   PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "G1:5" )
777   PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "G1:6" )
778   PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "G1:7" )
1083779
1084   PORT_START   /* IN2 */
1085   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
1086   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
1087   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
1088   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
780   PORT_MODIFY("IN2")
1089781   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
1090782   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
1091   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
1092   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
1093783
1094   PORT_START   /* IN3 */
1095   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1096   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
784   PORT_MODIFY("IN3")
1097785   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
1098786   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
1099787   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
1100788   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
1101   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
1102   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
1103789
1104   /* analog ports */
1105   UNUSED_ANALOG_X4
790   PORT_MODIFY("AN2")
791   UNUSED_ANALOG
792
793   PORT_MODIFY("AN3")
794   UNUSED_ANALOG
1106795INPUT_PORTS_END
1107796
1108797
1109798static INPUT_PORTS_START( nametune )
1110   PORT_START   /* IN0 */
1111   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )
799   PORT_INCLUDE( stocker )
800
801   PORT_MODIFY("IN0")
802   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )   PORT_DIPLOCATION("H1:1,2")
1112803   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
1113804   PORT_DIPSETTING(    0x03, DEF_STR( 3C_2C ) )
1114805   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
1115806   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
1116   PORT_DIPNAME( 0x1c, 0x00, "Bonus Coins" )
1117   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
1118   PORT_DIPSETTING(    0x04, "2 Coins = 1 Bonus" )
1119   PORT_DIPSETTING(    0x08, "3 Coins = 1 Bonus" )
1120   PORT_DIPSETTING(    0x0c, "4 Coins = 1 Bonus" )
1121   PORT_DIPSETTING(    0x10, "4 Coins = 2 Bonus" )
1122   PORT_DIPSETTING(    0x14, "5 Coins = 1 Bonus" )
1123   PORT_DIPSETTING(    0x18, "5 Coins = 2 Bonus" )
1124   PORT_DIPSETTING(    0x1c, "5 Coins = 3 Bonus" )
1125   PORT_DIPNAME( 0x20, 0x00, "Left Coin Mech" )
1126   PORT_DIPSETTING(    0x00, "x1" )
1127   PORT_DIPSETTING(    0x20, "x2" )
1128   PORT_DIPNAME( 0xc0, 0x00, "Right Coin Mech" )
1129   PORT_DIPSETTING(    0x00, "x1" )
1130   PORT_DIPSETTING(    0x40, "x4" )
1131   PORT_DIPSETTING(    0x80, "x5" )
1132   PORT_DIPSETTING(    0xc0, "x6" )
1133807
1134   PORT_START   /* IN1 */
1135   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
1136   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1137   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1138   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
1139   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1140   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1141   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
1142   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1143   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1144   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
1145   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1146   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1147   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1148   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1149   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1150   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
1151   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1152   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1153   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
1154   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1155   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1156   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
1157   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1158   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
808   PORT_MODIFY("IN1")
809   PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x01, "G1:1" )
810   PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "G1:2" )
811   PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "G1:3" )
812   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "G1:4" )
813   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "G1:5" )
814   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "G1:6" )
815   PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x40, "G1:7" )
1159816
1160   PORT_START   /* IN2 */
1161   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 Blue Button") PORT_PLAYER(1)
1162   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 Green Button") PORT_PLAYER(1)
1163   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Yellow Button") PORT_PLAYER(1)
1164   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Red Button") PORT_PLAYER(1)
817   PORT_MODIFY("IN2")
818   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 Blue Button") PORT_PLAYER(1)
819   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 Green Button") PORT_PLAYER(1)
820   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Yellow Button") PORT_PLAYER(1)
821   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Red Button") PORT_PLAYER(1)
1165822   PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED )
1166   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
1167   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
1168823
1169   PORT_START   /* IN3 */
1170   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
824   PORT_MODIFY("IN3")
1171825   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
1172   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Red Button") PORT_PLAYER(2)
1173   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Yellow Button") PORT_PLAYER(2)
1174   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P2 Green Button") PORT_PLAYER(2)
1175   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P2 Blue Button") PORT_PLAYER(2)
1176   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
1177   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK )
826   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Red Button") PORT_PLAYER(2)
827   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Yellow Button") PORT_PLAYER(2)
828   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P2 Green Button") PORT_PLAYER(2)
829   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P2 Blue Button") PORT_PLAYER(2)
1178830
1179   /* analog ports */
1180   UNUSED_ANALOG_X4
831   PORT_MODIFY("AN3")
832   UNUSED_ANALOG
1181833INPUT_PORTS_END
1182834
1183835
1184836static INPUT_PORTS_START( nstocker )
1185   PORT_START   /* IN0 */
1186   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )
1187   PORT_DIPSETTING(    0x03, DEF_STR( 3C_1C ) )
1188   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
1189   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
1190   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
1191   PORT_DIPNAME( 0x1c, 0x00, "Bonus Coins" )
1192   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
1193   PORT_DIPSETTING(    0x04, "2 Coins = 1 Bonus" )
1194   PORT_DIPSETTING(    0x08, "3 Coins = 1 Bonus" )
1195   PORT_DIPSETTING(    0x0c, "4 Coins = 1 Bonus" )
1196   PORT_DIPSETTING(    0x10, "4 Coins = 2 Bonus" )
1197   PORT_DIPSETTING(    0x14, "5 Coins = 1 Bonus" )
1198   PORT_DIPSETTING(    0x18, "5 Coins = 2 Bonus" )
1199   PORT_DIPSETTING(    0x1c, "5 Coins = 3 Bonus" )
1200   PORT_DIPNAME( 0x20, 0x00, "Left Coin Mech" )
1201   PORT_DIPSETTING(    0x00, "x1" )
1202   PORT_DIPSETTING(    0x20, "x2" )
1203   PORT_DIPNAME( 0xc0, 0x00, "Right Coin Mech" )
1204   PORT_DIPSETTING(    0x00, "x1" )
1205   PORT_DIPSETTING(    0x40, "x4" )
1206   PORT_DIPSETTING(    0x80, "x5" )
1207   PORT_DIPSETTING(    0xc0, "x6" )
837   PORT_INCLUDE( stocker )
1208838
1209   PORT_START   /* IN1 */
1210   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Difficulty ) )
839   PORT_MODIFY("IN0")
840   BALSENTE_COINAGE_ALT2
841
842   PORT_MODIFY("IN1")
843   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("G1:1")
1211844   PORT_DIPSETTING(    0x01, DEF_STR( Easy ) )
1212845   PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
1213   PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNUSED )
1214   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
1215   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1216   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
846   PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "G1:7" )
1217847
1218   PORT_START   /* IN2 */
1219   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
1220   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
1221   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
1222
1223   PORT_START   /* IN3 */
1224   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1225   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
1226   PORT_BIT( 0x3c, IP_ACTIVE_LOW, IPT_UNUSED )
1227   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
1228   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
1229
1230   /* analog ports */
1231   UNUSED_ANALOG_X3
1232   /* cheese alert -- we have to map this to player 2 so that it doesn't interfere with */
1233   /* the crosshair controls */
1234   PORT_START
848   /* cheese alert -- we have to map this to player 2 so that it doesn't interfere with
849       the crosshair controls */
850   PORT_MODIFY("AN3")
1235851    PORT_BIT( 0xff, 0, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20)
1236852                PORT_CODE_DEC(KEYCODE_S) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(KEYCODE_F) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_RESET PORT_PLAYER(2)
1237853
1238854   /* extra ports for shooters */
1239   PLAYER1_CROSSHAIRS
855   PORT_START /* fake analog X */
856   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
857
858   PORT_START /* fake analog Y */
859   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10)
1240860INPUT_PORTS_END
1241861
1242862
1243863static INPUT_PORTS_START( sfootbal )
1244   PORT_START   /* IN0 */
1245   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )
1246   PORT_DIPSETTING(    0x03, DEF_STR( 3C_1C ) )
1247   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
1248   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
1249   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
1250   PORT_DIPNAME( 0x1c, 0x00, "Bonus Coins" )
1251   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
1252   PORT_DIPSETTING(    0x04, "2 Coins = 1 Bonus" )
1253   PORT_DIPSETTING(    0x08, "3 Coins = 1 Bonus" )
1254   PORT_DIPSETTING(    0x0c, "4 Coins = 1 Bonus" )
1255   PORT_DIPSETTING(    0x10, "4 Coins = 2 Bonus" )
1256   PORT_DIPSETTING(    0x14, "5 Coins = 1 Bonus" )
1257   PORT_DIPSETTING(    0x18, "5 Coins = 2 Bonus" )
1258   PORT_DIPSETTING(    0x1c, "5 Coins = 3 Bonus" )
1259   PORT_DIPNAME( 0x20, 0x00, "Left Coin Mech" )
1260   PORT_DIPSETTING(    0x00, "x1" )
1261   PORT_DIPSETTING(    0x20, "x2" )
1262   PORT_DIPNAME( 0xc0, 0x00, "Right Coin Mech" )
1263   PORT_DIPSETTING(    0x00, "x1" )
1264   PORT_DIPSETTING(    0x40, "x4" )
1265   PORT_DIPSETTING(    0x80, "x5" )
1266   PORT_DIPSETTING(    0xc0, "x6" )
864   PORT_INCLUDE( stocker )
1267865
1268   PORT_START   /* IN1 */
1269   PORT_DIPNAME( 0x07, 0x03, "Game Duration" )
866   PORT_MODIFY("IN0")
867   BALSENTE_COINAGE_ALT2
868
869   PORT_MODIFY("IN1")
870   PORT_DIPNAME( 0x07, 0x03, DEF_STR( Game_Time ) )   PORT_DIPLOCATION("G1:1,2,3")
1270871   PORT_DIPSETTING(    0x00, "1:30" )
1271872   PORT_DIPSETTING(    0x01, "1:40" )
1272873   PORT_DIPSETTING(    0x02, "1:50" )
r1877r1878
1275876   PORT_DIPSETTING(    0x05, "2:40" )
1276877   PORT_DIPSETTING(    0x06, "3:00" )
1277878   PORT_DIPSETTING(    0x07, "3:30" )
1278   PORT_DIPNAME( 0x08, 0x00, "Players Per Credit" )
879   PORT_DIPNAME( 0x08, 0x00, "Players Per Credit" )   PORT_DIPLOCATION("G1:4")
1279880   PORT_DIPSETTING(    0x00, "1" )
1280   PORT_DIPSETTING(    0x08, "1 or 2" )
1281   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_UNUSED )
1282   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
1283   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1284   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
881   PORT_DIPSETTING(    0x08, "1 Or 2" )
882   PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "G1:7" )
1285883
1286   PORT_START   /* IN2 */
884   PORT_MODIFY("IN2")
1287885   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
1288886   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
1289   PORT_BIT( 0x3c, IP_ACTIVE_LOW, IPT_UNUSED )
1290   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
1291   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
887   PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )
1292888
1293   PORT_START   /* IN3 */
1294   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
889   PORT_MODIFY("IN3")
1295890   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
1296   PORT_BIT( 0x3c, IP_ACTIVE_LOW, IPT_UNUSED )
1297   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
1298   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
891   PORT_BIT( 0x38, IP_ACTIVE_LOW, IPT_UNUSED )
1299892
1300   /* analog ports */
1301   PLAYER2_ANALOG_JOYSTICK
1302   PLAYER1_ANALOG_JOYSTICK
893   /* Player 2 Analog Joystick */
894   PORT_MODIFY("AN0")
895    PORT_BIT( 0xff, 0, IPT_AD_STICK_Y ) PORT_MINMAX(0x80,0x7f) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_PLAYER(2)
896
897   PORT_MODIFY("AN1")
898    PORT_BIT( 0xff, 0, IPT_AD_STICK_X ) PORT_MINMAX(0x80,0x7f) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_REVERSE PORT_PLAYER(2)
899
900   /* Player 1 Analog Joystick */
901   PORT_MODIFY("AN2")
902    PORT_BIT( 0xff, 0, IPT_AD_STICK_Y ) PORT_MINMAX(0x80,0x7f) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_PLAYER(1)
903
904   PORT_MODIFY("AN3")
905    PORT_BIT( 0xff, 0, IPT_AD_STICK_X ) PORT_MINMAX(0x80,0x7f) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_REVERSE PORT_PLAYER(1)
1303906INPUT_PORTS_END
1304907
1305908
1306909static INPUT_PORTS_START( spiker )
1307   PORT_START   /* IN0 */
1308   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )
1309   PORT_DIPSETTING(    0x03, DEF_STR( 3C_1C ) )
1310   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
1311   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
1312   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
1313   PORT_DIPNAME( 0x1c, 0x00, "Bonus Coins" )
1314   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
1315   PORT_DIPSETTING(    0x04, "2 Coins = 1 Bonus" )
1316   PORT_DIPSETTING(    0x08, "3 Coins = 1 Bonus" )
1317   PORT_DIPSETTING(    0x0c, "4 Coins = 1 Bonus" )
1318   PORT_DIPSETTING(    0x10, "4 Coins = 2 Bonus" )
1319   PORT_DIPSETTING(    0x14, "5 Coins = 1 Bonus" )
1320   PORT_DIPSETTING(    0x18, "5 Coins = 2 Bonus" )
1321   PORT_DIPSETTING(    0x1c, "5 Coins = 3 Bonus" )
1322   PORT_DIPNAME( 0x20, 0x00, "Left Coin Mech" )
1323   PORT_DIPSETTING(    0x00, "x1" )
1324   PORT_DIPSETTING(    0x20, "x2" )
1325   PORT_DIPNAME( 0xc0, 0x00, "Right Coin Mech" )
1326   PORT_DIPSETTING(    0x00, "x1" )
1327   PORT_DIPSETTING(    0x40, "x4" )
1328   PORT_DIPSETTING(    0x80, "x5" )
1329   PORT_DIPSETTING(    0xc0, "x6" )
910   PORT_INCLUDE( stocker )
1330911
1331   PORT_START   /* IN1 */
1332   PORT_DIPNAME( 0x01, 0x00, "Game Duration" )
1333   PORT_DIPSETTING(    0x00, "11 points" )
1334   PORT_DIPSETTING(    0x01, "15 points" )
1335   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
1336   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1337   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1338   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
1339   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1340   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1341   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
1342   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1343   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1344   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1345   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1346   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1347   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
1348   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1349   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1350   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
1351   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1352   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1353   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
1354   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1355   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
912   PORT_MODIFY("IN0")
913   BALSENTE_COINAGE_ALT2
1356914
1357   PORT_START   /* IN2 */
1358   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
915   PORT_MODIFY("IN1")
916   PORT_DIPNAME( 0x01, 0x00, "Game Duration" )         PORT_DIPLOCATION("G1:1")
917   PORT_DIPSETTING(    0x00, "11 Points" )
918   PORT_DIPSETTING(    0x01, "15 Points" )
919   PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "G1:2" )
920   PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "G1:3" )
921   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "G1:4" )
922   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "G1:5" )
923   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "G1:6" )
924   PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x40, "G1:7" )
925
926   PORT_MODIFY("IN2")
1359927   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
1360928   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
1361   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
1362   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
1363929
1364   PORT_START   /* IN3 */
1365   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
930   PORT_MODIFY("IN3")
1366931   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
1367932   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
1368   PORT_BIT( 0x38, IP_ACTIVE_LOW, IPT_UNUSED )
1369   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
1370   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
1371933
1372   /* analog ports */
1373   PLAYER2_TRACKBALL
1374   PLAYER1_TRACKBALL
934   /* Player 2 Trackball */
935   PORT_MODIFY("AN0")
936    PORT_BIT( 0xff, 0, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_PLAYER(2)
937
938   PORT_MODIFY("AN1")
939    PORT_BIT( 0xff, 0, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_REVERSE PORT_PLAYER(2)
940
941   /* Player 1 Trackball */
942   PORT_MODIFY("AN2")
943    PORT_BIT( 0xff, 0, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_PLAYER(1)
944
945   PORT_MODIFY("AN3")
946    PORT_BIT( 0xff, 0, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_REVERSE PORT_PLAYER(1)
1375947INPUT_PORTS_END
1376948
1377949
1378950static INPUT_PORTS_START( stompin )
1379   PORT_START   /* IN0 */
1380   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )
1381   PORT_DIPSETTING(    0x03, DEF_STR( 3C_1C ) )
1382   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
1383   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
1384   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
1385   PORT_DIPNAME( 0x1c, 0x00, "Bonus Coins" )
1386   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
1387   PORT_DIPSETTING(    0x04, "2 Coins = 1 Bonus" )
1388   PORT_DIPSETTING(    0x08, "3 Coins = 1 Bonus" )
1389   PORT_DIPSETTING(    0x0c, "4 Coins = 1 Bonus" )
1390   PORT_DIPSETTING(    0x10, "4 Coins = 2 Bonus" )
1391   PORT_DIPSETTING(    0x14, "5 Coins = 1 Bonus" )
1392   PORT_DIPSETTING(    0x18, "5 Coins = 2 Bonus" )
1393   PORT_DIPSETTING(    0x1c, "5 Coins = 3 Bonus" )
1394   PORT_DIPNAME( 0x20, 0x00, "Left Coin Mech" )
1395   PORT_DIPSETTING(    0x00, "x1" )
1396   PORT_DIPSETTING(    0x20, "x2" )
1397   PORT_DIPNAME( 0xc0, 0x00, "Right Coin Mech" )
1398   PORT_DIPSETTING(    0x00, "x1" )
1399   PORT_DIPSETTING(    0x40, "x4" )
1400   PORT_DIPSETTING(    0x80, "x5" )
1401   PORT_DIPSETTING(    0xc0, "x6" )
951   PORT_INCLUDE( stocker )
952   /* Set H:1-8 all to OFF to enable Free Play */
953   PORT_MODIFY("IN0")
954   BALSENTE_COINAGE_ALT2
1402955
1403   PORT_START   /* IN1 */
1404   PORT_DIPNAME( 0x01, 0x00, "Display Kids" )
956   PORT_MODIFY("IN1")
957   PORT_DIPNAME( 0x01, 0x00, "Display Kids" )         PORT_DIPLOCATION("G1:1")
1405958   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
1406959   PORT_DIPSETTING(    0x01, DEF_STR( Yes ) )
1407   PORT_DIPNAME( 0x02, 0x02, "Kid on Right Located" )
960   PORT_DIPNAME( 0x02, 0x02, "Kid On Right Located" )   PORT_DIPLOCATION("G1:2")
1408961   PORT_DIPSETTING(    0x02, DEF_STR( No ) )
1409962   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
1410   PORT_DIPNAME( 0x04, 0x04, "Kid on Left Located" )
963   PORT_DIPNAME( 0x04, 0x04, "Kid On Left Located" )   PORT_DIPLOCATION("G1:3")
1411964   PORT_DIPSETTING(    0x04, DEF_STR( No ) )
1412965   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
1413   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
1414   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1415   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1416   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1417   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1418   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1419   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) )
966   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("G1:6")
1420967   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1421968   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
1422   PORT_DIPNAME( 0x40, 0x00, "Bee In Game" )
969   PORT_DIPNAME( 0x40, 0x00, "Bee In Game" )         PORT_DIPLOCATION("G1:7")
1423970   PORT_DIPSETTING(    0x40, DEF_STR( No ) )
1424971   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
1425   PORT_DIPNAME( 0x80, 0x00, "Bug Generation" )
972   PORT_DIPNAME( 0x80, 0x00, "Bug Generation" )      PORT_DIPLOCATION("G1:8")
1426973   PORT_DIPSETTING(    0x00, "Regular" )
1427974   PORT_DIPSETTING(    0x80, DEF_STR( None ) )
1428975
1429   PORT_START   /* IN2 */
976   PORT_MODIFY("IN2")
1430977   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(1)
1431978   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(1)
1432979   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(1)
1433980   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(1)
1434   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
1435   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
1436   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
1437   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
1438981
1439   PORT_START   /* IN3 */
1440   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1441   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
982   PORT_MODIFY("IN3")
1442983   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(1)
1443984   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(1)
1444985   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(1)
1445986   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(1)
1446   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
1447   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
1448987
1449   /* "analog" ports */
1450   PORT_START
988   PORT_MODIFY("AN0")
1451989   PORT_BIT( 0x1f, IP_ACTIVE_LOW, IPT_UNUSED )
1452990   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Top-Right") PORT_CODE(KEYCODE_9_PAD) PORT_PLAYER(1)
1453991   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Top") PORT_CODE(KEYCODE_8_PAD) PORT_PLAYER(1)
1454992   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Top-Left") PORT_CODE(KEYCODE_7_PAD) PORT_PLAYER(1)
1455993
1456   PORT_START
994   PORT_MODIFY("AN1")
1457995   PORT_BIT( 0x1f, IP_ACTIVE_LOW, IPT_UNUSED )
1458996   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Right") PORT_CODE(KEYCODE_6_PAD) PORT_PLAYER(1)
1459997   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
1460998   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Left") PORT_CODE(KEYCODE_4_PAD) PORT_PLAYER(1)
1461999
1462   PORT_START
1000   PORT_MODIFY("AN2")
14631001   PORT_BIT( 0x1f, IP_ACTIVE_LOW, IPT_UNUSED )
14641002   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Bot-Right") PORT_CODE(KEYCODE_3_PAD) PORT_PLAYER(1)
14651003   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Bottom") PORT_CODE(KEYCODE_2_PAD) PORT_PLAYER(1)
14661004   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("Bot-Left") PORT_CODE(KEYCODE_1_PAD) PORT_PLAYER(1)
14671005
1006   PORT_MODIFY("AN3")
14681007   UNUSED_ANALOG
14691008INPUT_PORTS_END
14701009
14711010
14721011static INPUT_PORTS_START( grudge )
1473   PORT_START   /* IN0 */
1474   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Unknown ) )
1012   PORT_INCLUDE( sentetst )
1013
1014   PORT_MODIFY("IN0")
1015   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Unknown ) )      PORT_DIPLOCATION("H1:1,2")
14751016   PORT_DIPSETTING(    0x00, "0" )
14761017   PORT_DIPSETTING(    0x01, "1" )
14771018   PORT_DIPSETTING(    0x02, "2" )
14781019   PORT_DIPSETTING(    0x03, "3" )
1479   PORT_BIT( 0x7c, IP_ACTIVE_LOW, IPT_UNUSED )
1480   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
1020   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )      PORT_DIPLOCATION("H1:8")
14811021   PORT_DIPSETTING(    0x00, "0" )
14821022   PORT_DIPSETTING(    0x80, "1" )
14831023
1484   PORT_START   /* IN1 */
1485   PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED )
1486   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Players ) )
1024   PORT_MODIFY("IN1")
1025   PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "G1:1" )
1026   PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "G1:2" )
1027   PORT_DIPUNUSED_DIPLOC( 0x04, 0x04, "G1:3" )
1028   PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "G1:4" )
1029   PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "G1:7" )
1030   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Players ) )      PORT_DIPLOCATION("G1:8")
14871031   PORT_DIPSETTING(    0x80, "2" )
14881032   PORT_DIPSETTING(    0x00, "3" )
14891033
1490   PORT_START   /* IN2 */
1034   PORT_MODIFY("IN2")
14911035   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
14921036   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
14931037   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 )
r1877r1878
14951039   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
14961040   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
14971041   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN3 )
1498   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
14991042
1500   PORT_START   /* IN3 */
1501   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1502   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
1043   PORT_MODIFY("IN3")
15031044   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START3 )
15041045   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
15051046   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
15061047   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
1507   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
1508   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
15091048
1510   /* analog ports */
1511   PORT_START
1049   PORT_MODIFY("AN0")
15121050    PORT_BIT( 0xff, 0, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(20) PORT_PLAYER(1)
1513   PORT_START
1051
1052   PORT_MODIFY("AN1")
15141053    PORT_BIT( 0xff, 0, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(20) PORT_PLAYER(2)
1515   PORT_START
1054
1055   PORT_MODIFY("AN2")
15161056    PORT_BIT( 0xff, 0, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(20) PORT_PLAYER(3)
1057
1058   PORT_MODIFY("AN3")
15171059   UNUSED_ANALOG
15181060INPUT_PORTS_END
15191061
15201062
15211063static INPUT_PORTS_START( rescraid )
1522   PORT_START   /* IN0 */
1523   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )
1524   PORT_DIPSETTING(    0x03, DEF_STR( 3C_1C ) )
1525   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
1526   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
1527   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
1528   PORT_DIPNAME( 0x1c, 0x00, "Bonus Coins" )
1529   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
1530   PORT_DIPSETTING(    0x04, "2 Coins = 1 Bonus" )
1531   PORT_DIPSETTING(    0x08, "3 Coins = 1 Bonus" )
1532   PORT_DIPSETTING(    0x0c, "4 Coins = 1 Bonus" )
1533   PORT_DIPSETTING(    0x10, "4 Coins = 2 Bonus" )
1534   PORT_DIPSETTING(    0x14, "5 Coins = 1 Bonus" )
1535   PORT_DIPSETTING(    0x18, "5 Coins = 2 Bonus" )
1536   PORT_DIPSETTING(    0x1c, "5 Coins = 3 Bonus" )
1537   PORT_DIPNAME( 0x20, 0x00, "Left Coin Mech" )
1538   PORT_DIPSETTING(    0x00, "x1" )
1539   PORT_DIPSETTING(    0x20, "x2" )
1540   PORT_DIPNAME( 0xc0, 0x00, "Right Coin Mech" )
1541   PORT_DIPSETTING(    0x00, "x1" )
1542   PORT_DIPSETTING(    0x40, "x4" )
1543   PORT_DIPSETTING(    0x80, "x5" )
1544   PORT_DIPSETTING(    0xc0, "x6" )
1064   PORT_INCLUDE( stocker )
15451065
1546   PORT_START   /* IN1 */
1547   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Lives ) )
1066   PORT_MODIFY("IN0")
1067   BALSENTE_COINAGE_ALT2
1068
1069   PORT_MODIFY("IN1")
1070   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Lives ) )      PORT_DIPLOCATION("G1:1")
15481071   PORT_DIPSETTING(    0x00, "4" )
15491072   PORT_DIPSETTING(    0x01, "5" )
1550   PORT_DIPNAME( 0x0c, 0x04, "Minimum Game Time" )
1073   PORT_DIPNAME( 0x0c, 0x04, "Minimum Game Time" )      PORT_DIPLOCATION("G1:3,4")
15511074   PORT_DIPSETTING(    0x08, "45" )
15521075   PORT_DIPSETTING(    0x04, "60" )
15531076   PORT_DIPSETTING(    0x00, "90" )
15541077   PORT_DIPSETTING(    0x0c, "120" )
1555   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1556   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1557   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1558   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
1559   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1560   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1561   PORT_DIPNAME( 0x40, 0x40, "Keep High Scores" )
1078   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "G1:5" )
1079   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "G1:6" )
1080   PORT_DIPNAME( 0x40, 0x40, "Keep High Scores" )      PORT_DIPLOCATION("G1:7")
15621081   PORT_DIPSETTING(    0x40, DEF_STR( No ) )
15631082   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
1564   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
1565   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1566   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
15671083
1568   PORT_START   /* IN2 */
1084   PORT_MODIFY("IN2")
15691085   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(1)
15701086   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(1)
15711087   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(1)
15721088   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(1)
15731089   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
15741090   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
1575   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
1576   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
15771091
1578   PORT_START   /* IN3 */
1579   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1092   PORT_MODIFY("IN3")
15801093   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
15811094   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(1)
15821095   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(1)
15831096   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(1)
15841097   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(1)
1585   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
1586   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
15871098
1588   /* analog ports */
1589   UNUSED_ANALOG_X4
1099   PORT_MODIFY("AN3")
1100   UNUSED_ANALOG
15901101INPUT_PORTS_END
15911102
15921103
15931104static INPUT_PORTS_START( shrike )
1594   PORT_START   /* IN0 */
1595   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ))
1105   PORT_INCLUDE( sentetst )
1106
1107   PORT_MODIFY("IN0")
1108   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ))   PORT_DIPLOCATION("H1:1,2")
15961109   PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ))
15971110   PORT_DIPSETTING(    0x01, DEF_STR( 3C_1C ))
15981111   PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ))
15991112   PORT_DIPSETTING(    0x03, DEF_STR( Free_Play ))
1600   PORT_BIT( 0x3c, IP_ACTIVE_LOW, IPT_UNUSED )
1601   PORT_DIPNAME( 0x40, 0x40, "Reset High Scores" )
1113   PORT_DIPNAME( 0x40, 0x40, "Reset High Scores" )   PORT_DIPLOCATION("H1:7")
16021114   PORT_DIPSETTING(    0x40, DEF_STR( No ))
16031115   PORT_DIPSETTING(    0x00, DEF_STR( Yes ))
1604   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
1116   PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "H1:8" )
16051117
1606   PORT_START   /* IN1 */
1607   PORT_DIPNAME( 0x03, 0x03, "Minimum Game Time" )
1118   PORT_MODIFY("IN1")
1119   PORT_DIPNAME( 0x03, 0x03, "Minimum Game Time" )   PORT_DIPLOCATION("G1:1,2")
16081120   PORT_DIPSETTING(    0x00, "1:00" )
16091121   PORT_DIPSETTING(    0x01, "1:30" )
16101122   PORT_DIPSETTING(    0x02, "2:00" )
16111123   PORT_DIPSETTING(    0x03, "2:30" )
1612   PORT_BIT( 0x7c, IP_ACTIVE_LOW, IPT_UNUSED )
1613   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ))
1614   PORT_DIPSETTING(    0x80, DEF_STR( Off ))
1615   PORT_DIPSETTING(    0x00, DEF_STR( On ))
1124   PORT_DIPUNUSED_DIPLOC( 0x04, 0x04, "G1:3" )
1125   PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "G1:4" )
1126   PORT_DIPUNUSED_DIPLOC( 0x40, 0x20, "G1:7" )
16161127
1617   PORT_START   /* IN2 */
1128   PORT_MODIFY("IN2")
16181129   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
16191130   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
16201131   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
16211132   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
1622   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
1623   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
1624   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
1625   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
16261133
1627   PORT_START   /* IN3 */
1628   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1629   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
1630   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
1631   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
1632   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
1134   PORT_MODIFY("IN3")
1135   PORT_BIT( 0x1c, IP_ACTIVE_LOW, IPT_UNUSED )
16331136   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1) // carpet switch
1634   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
1635   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
16361137
1637   /* analog ports */
1638   PORT_START
1138   PORT_MODIFY("AN0")
16391139   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_PLAYER(1)
1640   PORT_START
1140
1141   PORT_MODIFY("AN1")
16411142   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_PLAYER(1)
1642   UNUSED_ANALOG_X2
1143
1144   PORT_MODIFY("AN2")
1145   UNUSED_ANALOG
1146
1147   PORT_MODIFY("AN3")
1148   UNUSED_ANALOG
16431149INPUT_PORTS_END
16441150
16451151
r1877r1878
16701176   /* basic machine hardware */
16711177   MDRV_CPU_ADD(M6809, 5000000/4)
16721178   MDRV_CPU_PROGRAM_MAP(cpu1_map,0)
1673   MDRV_CPU_VBLANK_INT(balsente_update_analog_inputs,1)
1179   MDRV_CPU_VBLANK_INT("main", balsente_update_analog_inputs)
16741180
16751181   MDRV_CPU_ADD(Z80, 4000000)
16761182   /* audio CPU */
r1877r1878
24871993 *
24881994 *************************************/
24891995
2490GAME( 1984, sentetst, 0,        balsente, sentetst, sentetst, ROT0, "Bally/Sente", "Sente Diagnostic Cartridge", GAME_SUPPORTS_SAVE )
2491GAME( 1984, cshift,   0,        balsente, cshift,   cshift,   ROT0, "Bally/Sente", "Chicken Shift", GAME_SUPPORTS_SAVE )
2492GAME( 1984, gghost,   0,        balsente, gghost,   gghost,   ROT0, "Bally/Sente", "Goalie Ghost", GAME_SUPPORTS_SAVE )
2493GAME( 1984, hattrick, 0,        balsente, hattrick, hattrick, ROT0, "Bally/Sente", "Hat Trick", GAME_SUPPORTS_SAVE )
2494GAME( 1984, otwalls,  0,        balsente, otwalls,  otwalls,  ROT0, "Bally/Sente", "Off the Wall (Sente)", GAME_SUPPORTS_SAVE )
2495GAME( 1984, snakepit, 0,        balsente, snakepit, snakepit, ROT0, "Bally/Sente", "Snake Pit", GAME_SUPPORTS_SAVE )
2496GAME( 1984, snakjack, 0,        balsente, snakjack, snakjack, ROT0, "Bally/Sente", "Snacks'n Jaxson", GAME_SUPPORTS_SAVE )
2497GAME( 1984, stocker,  0,        balsente, stocker,  stocker,  ROT0, "Bally/Sente", "Stocker", GAME_SUPPORTS_SAVE )
2498GAME( 1984, triviag1, 0,        balsente, triviag1, triviag1, ROT0, "Bally/Sente", "Trivial Pursuit (Genus I) (set 1)", GAME_SUPPORTS_SAVE )
2499GAME( 1984, trivia12, 0,        balsente, triviag1, triviag1, ROT0, "Bally/Sente", "Trivial Pursuit (Genus I) (set 2)", GAME_SUPPORTS_SAVE )
2500GAME( 1984, triviag2, 0,        balsente, triviag1, triviag2, ROT0, "Bally/Sente", "Trivial Pursuit (Genus II)", GAME_SUPPORTS_SAVE )
2501GAME( 1984, triviasp, 0,        balsente, triviag1, triviag2, ROT0, "Bally/Sente", "Trivial Pursuit (All Star Sports Edition)", GAME_SUPPORTS_SAVE )
2502GAME( 1984, triviayp, 0,        balsente, triviag1, triviag2, ROT0, "Bally/Sente", "Trivial Pursuit (Young Players Edition)", GAME_SUPPORTS_SAVE )
2503GAME( 1984, triviabb, 0,        balsente, triviag1, triviag2, ROT0, "Bally/Sente", "Trivial Pursuit (Baby Boomer Edition)", GAME_SUPPORTS_SAVE )
2504GAME( 1987, triviaes, 0,        balsente, triviaes, triviaes, ROT0, "Bally/Sente", "Trivial Pursuit (Spanish Edition)", GAME_SUPPORTS_SAVE )
2505GAME( 1985, gimeabrk, 0,        balsente, gimeabrk, gimeabrk, ROT0, "Bally/Sente", "Gimme A Break", GAME_SUPPORTS_SAVE )
2506GAME( 1985, minigolf, 0,        balsente, minigolf, minigolf, ROT0, "Bally/Sente", "Mini Golf (set 1)", GAME_SUPPORTS_SAVE )
2507GAME( 1985, minigol2, minigolf, balsente, minigol2, minigol2, ROT0, "Bally/Sente", "Mini Golf (set 2)", GAME_SUPPORTS_SAVE )
2508GAME( 1985, toggle,   0,        balsente, toggle,   toggle,   ROT0, "Bally/Sente", "Toggle (prototype)", GAME_SUPPORTS_SAVE )
2509GAME( 1986, nametune, 0,        balsente, nametune, nametune, ROT0, "Bally/Sente", "Name That Tune", GAME_SUPPORTS_SAVE )
2510GAME( 1986, nstocker, 0,        balsente, nstocker, nstocker, ROT0, "Bally/Sente", "Night Stocker (set 1)", GAME_SUPPORTS_SAVE )
2511GAME( 1986, nstockr2, 0,        balsente, nstocker, nstocker, ROT0, "Bally/Sente", "Night Stocker (set 2)", GAME_SUPPORTS_SAVE )
2512GAME( 1986, sfootbal, 0,        balsente, sfootbal, sfootbal, ROT0, "Bally/Sente", "Street Football", GAME_SUPPORTS_SAVE )
2513GAME( 1986, spiker,   0,        balsente, spiker,   spiker,   ROT0, "Bally/Sente", "Spiker", GAME_SUPPORTS_SAVE )
2514GAME( 1986, stompin,  0,        balsente, stompin,  stompin,  ROT0, "Bally/Sente", "Stompin'", GAME_SUPPORTS_SAVE )
1996GAME( 1984, sentetst, 0,        balsente, sentetst, sentetst, ROT0, "Bally/Sente",  "Sente Diagnostic Cartridge", GAME_SUPPORTS_SAVE )
1997GAME( 1984, cshift,   0,        balsente, cshift,   cshift,   ROT0, "Bally/Sente",  "Chicken Shift", GAME_SUPPORTS_SAVE )
1998GAME( 1984, gghost,   0,        balsente, gghost,   gghost,   ROT0, "Bally/Sente",  "Goalie Ghost", GAME_SUPPORTS_SAVE )
1999GAME( 1984, hattrick, 0,        balsente, hattrick, hattrick, ROT0, "Bally/Sente",  "Hat Trick", GAME_SUPPORTS_SAVE )
2000GAME( 1984, otwalls,  0,        balsente, otwalls,  otwalls,  ROT0, "Bally/Sente",  "Off the Wall (Sente)", GAME_SUPPORTS_SAVE )
2001GAME( 1984, snakepit, 0,        balsente, sentetst, snakepit, ROT0, "Bally/Sente",  "Snake Pit", GAME_SUPPORTS_SAVE )
2002GAME( 1984, snakjack, 0,        balsente, snakjack, snakjack, ROT0, "Bally/Sente",  "Snacks'n Jaxson", GAME_SUPPORTS_SAVE )
2003GAME( 1984, stocker,  0,        balsente, stocker,  stocker,  ROT0, "Bally/Sente",  "Stocker", GAME_SUPPORTS_SAVE )
2004GAME( 1984, triviag1, 0,        balsente, triviag1, triviag1, ROT0, "Bally/Sente",  "Trivial Pursuit (Genus I) (set 1)", GAME_SUPPORTS_SAVE )
2005GAME( 1984, trivia12, 0,        balsente, triviag1, triviag1, ROT0, "Bally/Sente",  "Trivial Pursuit (Genus I) (set 2)", GAME_SUPPORTS_SAVE )
2006GAME( 1984, triviag2, 0,        balsente, triviag1, triviag2, ROT0, "Bally/Sente",  "Trivial Pursuit (Genus II)", GAME_SUPPORTS_SAVE )
2007GAME( 1984, triviasp, 0,        balsente, triviag1, triviag2, ROT0, "Bally/Sente",  "Trivial Pursuit (All Star Sports Edition)", GAME_SUPPORTS_SAVE )
2008GAME( 1984, triviayp, 0,        balsente, triviag1, triviag2, ROT0, "Bally/Sente",  "Trivial Pursuit (Young Players Edition)", GAME_SUPPORTS_SAVE )
2009GAME( 1984, triviabb, 0,        balsente, triviag1, triviag2, ROT0, "Bally/Sente",  "Trivial Pursuit (Baby Boomer Edition)", GAME_SUPPORTS_SAVE )
2010GAME( 1987, triviaes, 0,        balsente, triviaes, triviaes, ROT0, "Bally/Sente",  "Trivial Pursuit (Spanish Edition)", GAME_SUPPORTS_SAVE )
2011GAME( 1985, gimeabrk, 0,        balsente, gimeabrk, gimeabrk, ROT0, "Bally/Sente",  "Gimme A Break", GAME_SUPPORTS_SAVE )
2012GAME( 1985, minigolf, 0,        balsente, minigolf, minigolf, ROT0, "Bally/Sente",  "Mini Golf (set 1)", GAME_SUPPORTS_SAVE )
2013GAME( 1985, minigol2, minigolf, balsente, minigol2, minigol2, ROT0, "Bally/Sente",  "Mini Golf (set 2)", GAME_SUPPORTS_SAVE )
2014GAME( 1985, toggle,   0,        balsente, toggle,   toggle,   ROT0, "Bally/Sente",  "Toggle (prototype)", GAME_SUPPORTS_SAVE )
2015GAME( 1986, nametune, 0,        balsente, nametune, nametune, ROT0, "Bally/Sente",  "Name That Tune", GAME_SUPPORTS_SAVE )
2016GAME( 1986, nstocker, 0,        balsente, nstocker, nstocker, ROT0, "Bally/Sente",  "Night Stocker (set 1)", GAME_SUPPORTS_SAVE )
2017GAME( 1986, nstockr2, 0,        balsente, nstocker, nstocker, ROT0, "Bally/Sente",  "Night Stocker (set 2)", GAME_SUPPORTS_SAVE )
2018GAME( 1986, sfootbal, 0,        balsente, sfootbal, sfootbal, ROT0, "Bally/Sente",  "Street Football", GAME_SUPPORTS_SAVE )
2019GAME( 1986, spiker,   0,        balsente, spiker,   spiker,   ROT0, "Bally/Sente",  "Spiker", GAME_SUPPORTS_SAVE )
2020GAME( 1986, stompin,  0,        balsente, stompin,  stompin,  ROT0, "Bally/Sente",  "Stompin'", GAME_SUPPORTS_SAVE )
25152021GAME( 1987, rescraid, 0,        balsente, rescraid, rescraid, ROT0, "Bally/Midway", "Rescue Raider", GAME_SUPPORTS_SAVE )
25162022GAME( 1987, rescrdsa, rescraid, balsente, rescraid, rescraid, ROT0, "Bally/Midway", "Rescue Raider (stand-alone)", GAME_SUPPORTS_SAVE )
25172023GAME( 198?, grudge,   0,        balsente, grudge,   grudge,   ROT0, "Bally/Midway", "Grudge Match (prototype)", GAME_SUPPORTS_SAVE )
2518GAME( 198?, shrike,   0,        shrike,   shrike,   shrike,   ROT0, "Bally/Sente", "Shrike Avenger (prototype)", GAME_SUPPORTS_SAVE )
2024GAME( 198?, shrike,   0,        shrike,   shrike,   shrike,   ROT0, "Bally/Sente", "Shrike Avenger (prototype)", GAME_SUPPORTS_SAVE )
src/mame/drivers/megadriv.c
r1877r1878
9292static emu_timer* scanline_timer;
9393static emu_timer* irq6_on_timer;
9494static emu_timer* irq4_on_timer;
95static mame_bitmap* render_bitmap;
95static bitmap_t* render_bitmap;
9696//emu_timer* vblankirq_off_timer;
9797
9898
r1877r1878
889889
890890static WRITE16_HANDLER( megadriv_vdp_w )
891891{
892
893
894892   switch (offset<<1)
895893   {
896894      case 0x00:
r1877r1878
925923      case 0x12:
926924      case 0x14:
927925      case 0x16:
928         if (ACCESSING_LSB) SN76496_0_w(0, data & 0xff);
929         //if (ACCESSING_MSB) SN76496_0_w(0, (data >>8) & 0xff);
926         if (ACCESSING_LSB) SN76496_0_w(machine, 0, data & 0xff);
927         //if (ACCESSING_MSB) SN76496_0_w(machine, 0, (data >>8) & 0xff);
930928         break;
931929
932930      default:
r1877r1878
13341332      switch (offset)
13351333      {
13361334         case 0:
1337            if (ACCESSING_MSB)    return YM2612_status_port_0_A_r(0) << 8;
1338            else              return YM2612_status_port_0_A_r(0);
1335            if (ACCESSING_MSB)    return YM2612_status_port_0_A_r(machine, 0) << 8;
1336            else              return YM2612_status_port_0_A_r(machine, 0);
13391337            break;
13401338         case 1:
1341            if (ACCESSING_MSB)   return YM2612_status_port_0_A_r(0) << 8;
1342            else             return YM2612_status_port_0_A_r(0);
1339            if (ACCESSING_MSB)   return YM2612_status_port_0_A_r(machine, 0) << 8;
1340            else             return YM2612_status_port_0_A_r(machine, 0);
13431341            break;
13441342      }
13451343   }
r1877r1878
13621360      switch (offset)
13631361      {
13641362         case 0:
1365            if (ACCESSING_MSB)   YM2612_control_port_0_A_w   (0,   (data >> 8) & 0xff);
1366            else             YM2612_data_port_0_A_w      (0,   (data >> 0) & 0xff);
1363            if (ACCESSING_MSB)   YM2612_control_port_0_A_w   (machine, 0,   (data >> 8) & 0xff);
1364            else             YM2612_data_port_0_A_w      (machine, 0,   (data >> 0) & 0xff);
13671365            break;
13681366         case 1:
1369            if (ACCESSING_MSB)   YM2612_control_port_0_B_w   (0,   (data >> 8) & 0xff);
1370            else             YM2612_data_port_0_B_w      (0,   (data >> 0) & 0xff);
1367            if (ACCESSING_MSB)   YM2612_control_port_0_B_w   (machine, 0,   (data >> 8) & 0xff);
1368            else             YM2612_data_port_0_B_w      (machine, 0,   (data >> 0) & 0xff);
13711369            break;
13721370      }
13731371   }
r1877r1878
13811379{
13821380   switch (offset)
13831381   {
1384      case 0: return YM2612_status_port_0_A_r(0);
1385      case 1: return YM2612_status_port_0_A_r(0);
1386      case 2: return YM2612_status_port_0_A_r(0);
1387      case 3: return YM2612_status_port_0_A_r(0);
1382      case 0: return YM2612_status_port_0_A_r(machine,0);
1383      case 1: return YM2612_status_port_0_A_r(machine,0);
1384      case 2: return YM2612_status_port_0_A_r(machine,0);
1385      case 3: return YM2612_status_port_0_A_r(machine,0);
13881386
13891387   }
13901388
r1877r1878
13961394   //mame_printf_debug("megadriv_z80_YM2612_write %02x %02x\n",offset,data);
13971395   switch (offset)
13981396   {
1399      case 0: YM2612_control_port_0_A_w(0, data); break;
1400      case 1: YM2612_data_port_0_A_w(0, data); break;
1401      case 2: YM2612_control_port_0_B_w(0, data); break;
1402      case 3: YM2612_data_port_0_B_w(0, data); break;
1397      case 0: YM2612_control_port_0_A_w(machine, 0, data); break;
1398      case 1: YM2612_data_port_0_A_w(machine, 0, data); break;
1399      case 2: YM2612_control_port_0_B_w(machine, 0, data); break;
1400      case 3: YM2612_data_port_0_B_w(machine, 0, data); break;
14031401   }
14041402}
14051403
r1877r1878
23732371
23742372static WRITE8_HANDLER( megadriv_z80_vdp_write )
23752373{
2376
2377
23782374   switch (offset)
23792375   {
23802376      case 0x11:
23812377      case 0x13:
23822378      case 0x15:
23832379      case 0x17:
2384         SN76496_0_w(0, data);
2380         SN76496_0_w(machine, 0, data);
23852381         break;
23862382
23872383      default:
r1877r1878
24122408   else if (fulladdress == 0xc00011)
24132409   {
24142410      /* quite a few early games write here, most of the later ones don't */
2415      SN76496_0_w(0, data);
2411      SN76496_0_w(machine, 0, data);
24162412   }
24172413   else
24182414   {
src/mame/drivers/galpani3.c
r1877r1878
9797   skns_spc_regs = auto_malloc (0x40);
9898}
9999
100extern void skns_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect );
100extern void skns_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect );
101101
102102
103103static VIDEO_UPDATE(galpani3)
r1877r1878
373373static MACHINE_DRIVER_START( galpani3 )
374374   MDRV_CPU_ADD_TAG("main", M68000, 16000000)    // ? (from which clock?)
375375   MDRV_CPU_PROGRAM_MAP(galpani3_map,0)
376   MDRV_CPU_VBLANK_INT(galpani3_vblank, 3)
376   MDRV_CPU_VBLANK_INT_HACK(galpani3_vblank, 3)
377377
378378
379379   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/itech32.c
r1877r1878
1010        * Time Killers (2 sets)
1111        * Bloodstorm (4 sets)
1212        * Hard Yardage (2 sets)
13        * Pairs (2 sets)
13        * Pairs (3 sets)
1414        * Driver's Edge (1 set)
1515        * World Class Bowling (8 sets)
1616        * Street Fighter: The Movie (4 sets)
r1877r1878
2323        * Golden Tee Classic (3 Sets)
2424
2525    Known issues:
26        * volume controls don't work in the Golden Tee games
26        * volume controls do not work in the Golden Tee games
2727        * Driver's Edge accesses many uninitialized RAM locations;
2828            requires hack to make steering in attract mode work
2929
r1877r1878
466466
467467static READ32_HANDLER( trackball32_4bit_combined_r )
468468{
469   return trackball32_4bit_r(offset, mem_mask) |
470         (trackball32_4bit_p2_r(offset, mem_mask) << 8);
469   return trackball32_4bit_r(machine, offset, mem_mask) |
470         (trackball32_4bit_p2_r(machine, offset, mem_mask) << 8);
471471}
472472
473473
r1877r1878
601601   set_led_status(1, data & 0x01);
602602   set_led_status(2, data & 0x02);
603603   set_led_status(3, data & 0x04);
604   ticket_dispenser_w(0, (data & 0x10) << 3);
604   ticket_dispenser_w(machine, 0, (data & 0x10) << 3);
605605   coin_counter_w(0, (data & 0x20) >> 5);
606606}
607607
r1877r1878
619619   /* bit 4 controls the ticket dispenser */
620620   /* bit 5 controls the coin counter */
621621   /* bit 6 controls the diagnostic sound LED */
622   ticket_dispenser_w(0, (data & 0x10) << 3);
622   ticket_dispenser_w(machine, 0, (data & 0x10) << 3);
623623   coin_counter_w(0, (data & 0x20) >> 5);
624624}
625625
r1877r1878
759759
760760static READ32_HANDLER( input_port_0_msw_r )
761761{
762   return input_port_0_word_r(offset,0) << 16;
762   return input_port_0_word_r(machine,offset,0) << 16;
763763}
764764
765765static READ32_HANDLER( input_port_1_msw_r )
766766{
767   return input_port_1_word_r(offset,0) << 16;
767   return input_port_1_word_r(machine,offset,0) << 16;
768768}
769769
770770static READ32_HANDLER( input_port_2_msw_r )
771771{
772   return input_port_2_word_r(offset,0) << 16;
772   return input_port_2_word_r(machine,offset,0) << 16;
773773}
774774
775775static READ32_HANDLER( input_port_3_msw_r )
776776{
777   return input_port_3_word_r(offset,0) << 16;
777   return input_port_3_word_r(machine,offset,0) << 16;
778778}
779779
780780static READ32_HANDLER( input_port_4_msw_r )
781781{
782   return special_port4_r(offset,0) << 16;
782   return special_port4_r(machine,offset,0) << 16;
783783}
784784
785785static WRITE32_HANDLER( int1_ack32_w )
786786{
787   int1_ack_w(offset, data, mem_mask);
787   int1_ack_w(machine, offset, data, mem_mask);
788788}
789789
790790
r1877r1878
12621262   PORT_BIT( 0x00f0, IP_ACTIVE_LOW, IPT_UNUSED )
12631263
12641264   PORT_START_TAG("TRACKX1")
1265    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_REVERSE PORT_PLAYER(1)
1265   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_REVERSE PORT_PLAYER(1)
12661266
12671267   PORT_START_TAG("TRACKY1")
1268    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_PLAYER(1)
1268   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_PLAYER(1)
12691269INPUT_PORTS_END
12701270
12711271
r1877r1878
12881288   PORT_DIPSETTING(      0x0040, DEF_STR( On ) )
12891289
12901290   PORT_START_TAG("TRACKX2")
1291    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_REVERSE PORT_COCKTAIL PORT_PLAYER(2)
1291   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_REVERSE PORT_COCKTAIL PORT_PLAYER(2)
12921292
12931293   PORT_START_TAG("TRACKY2")
1294    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_COCKTAIL PORT_PLAYER(2)
1294   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_COCKTAIL PORT_PLAYER(2)
12951295INPUT_PORTS_END
12961296
12971297
r1877r1878
13471347   PORT_DIPSETTING(      0x0020, DEF_STR( Cocktail ) )
13481348
13491349   PORT_START_TAG("TRACKX1")
1350    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_REVERSE PORT_PLAYER(1)
1350   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_REVERSE PORT_PLAYER(1)
13511351
13521352   PORT_START_TAG("TRACKY1")
1353    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_PLAYER(1)
1353   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_PLAYER(1)
13541354
13551355   PORT_START_TAG("TRACKX2")
1356    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_REVERSE PORT_COCKTAIL PORT_PLAYER(2)
1356   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_REVERSE PORT_COCKTAIL PORT_PLAYER(2)
13571357
13581358   PORT_START_TAG("TRACKY2")
1359    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_COCKTAIL PORT_PLAYER(2)
1359   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_COCKTAIL PORT_PLAYER(2)
13601360INPUT_PORTS_END
13611361
13621362
r1877r1878
13831383   PORT_DIPSETTING(      0x0040, DEF_STR( On ) )
13841384
13851385   PORT_START_TAG("TRACKX1")
1386    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_REVERSE PORT_PLAYER(1)
1386   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_REVERSE PORT_PLAYER(1)
13871387
13881388   PORT_START_TAG("TRACKY1")
1389    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_PLAYER(1)
1389   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_PLAYER(1)
13901390
13911391   PORT_START_TAG("TRACKX2")
1392    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_REVERSE PORT_COCKTAIL PORT_PLAYER(2)
1392   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_REVERSE PORT_COCKTAIL PORT_PLAYER(2)
13931393
13941394   PORT_START_TAG("TRACKY2")
1395    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_COCKTAIL PORT_PLAYER(2)
1395   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_COCKTAIL PORT_PLAYER(2)
13961396INPUT_PORTS_END
13971397
13981398
r1877r1878
14231423   PORT_DIPSETTING(      0x0040, "Two Trackballs" )
14241424
14251425   PORT_START_TAG("TRACKX1")
1426    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_REVERSE PORT_PLAYER(1)
1426   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_REVERSE PORT_PLAYER(1)
14271427
14281428   PORT_START_TAG("TRACKY1")
1429    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_PLAYER(1)
1429   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_PLAYER(1)
14301430
14311431   PORT_START_TAG("TRACKX2")
1432    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_REVERSE PORT_COCKTAIL PORT_PLAYER(2)
1432   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_REVERSE PORT_COCKTAIL PORT_PLAYER(2)
14331433
14341434   PORT_START_TAG("TRACKY2")
1435    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_COCKTAIL PORT_PLAYER(2)
1435   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_COCKTAIL PORT_PLAYER(2)
14361436INPUT_PORTS_END
14371437
14381438
r1877r1878
15611561   /* basic machine hardware */
15621562   MDRV_CPU_ADD_TAG("main", M68000, CPU_CLOCK)
15631563   MDRV_CPU_PROGRAM_MAP(timekill_map,0)
1564   MDRV_CPU_VBLANK_INT(generate_int1,1)
1564   MDRV_CPU_VBLANK_INT("main", generate_int1)
15651565
15661566   MDRV_CPU_ADD_TAG("sound", M6809, SOUND_CLOCK/8)
15671567   MDRV_CPU_PROGRAM_MAP(sound_map,0)
r1877r1878
16091609
16101610   MDRV_CPU_REPLACE("main", M68EC020, CPU020_CLOCK)
16111611   MDRV_CPU_PROGRAM_MAP(drivedge_map,0)
1612   MDRV_CPU_VBLANK_INT(NULL,0)
1612   MDRV_CPU_VBLANK_INT_HACK(NULL,0)
16131613
16141614   MDRV_CPU_ADD(TMS32031, TMS_CLOCK)
16151615   MDRV_CPU_PROGRAM_MAP(drivedge_tms1_map,0)
r1877r1878
16341634
16351635   MDRV_CPU_MODIFY("sound")
16361636   MDRV_CPU_PROGRAM_MAP(sound_020_map,0)
1637   MDRV_CPU_VBLANK_INT(irq1_line_assert,4)
1637   MDRV_CPU_VBLANK_INT_HACK(irq1_line_assert,4)
16381638
16391639   MDRV_NVRAM_HANDLER(itech020)
16401640MACHINE_DRIVER_END
r1877r1878
20452045
20462046ROM_START( wcbwl140 )   /* Version 1.40 Tournament (PCB P/N 1082 Rev 2) */
20472047   ROM_REGION32_BE( CODE_SIZE, REGION_USER1, 0 )
2048   ROM_LOAD32_BYTE( "wcbtprm0.140", 0x00000, 0x20000, CRC(9d31ceb1) SHA1(d147976a763ba1e18d861351b12c5d275b94a562) )
2049   ROM_LOAD32_BYTE( "wcbtprm1.140", 0x00001, 0x20000, CRC(c6669452) SHA1(ba58da7bee5120682e2306454da287c969014899) )
2050   ROM_LOAD32_BYTE( "wcbtprm2.140", 0x00002, 0x20000, CRC(d2fc4d09) SHA1(17983759ad6137a2e67b8414ea58880865311534) )
2051   ROM_LOAD32_BYTE( "wcbtprm3.140", 0x00003, 0x20000, CRC(c41258a4) SHA1(182e8a25bdb126a4de8a44a1c26fd8b66f06d66e) )
2048   ROM_LOAD32_BYTE( "wcbfprm0.140", 0x00000, 0x20000, CRC(9d31ceb1) SHA1(d147976a763ba1e18d861351b12c5d275b94a562) ) /* Labeled "WCBF PROM0 1.40" ect */
2049   ROM_LOAD32_BYTE( "wcbfprm1.140", 0x00001, 0x20000, CRC(c6669452) SHA1(ba58da7bee5120682e2306454da287c969014899) )
2050   ROM_LOAD32_BYTE( "wcbfprm2.140", 0x00002, 0x20000, CRC(d2fc4d09) SHA1(17983759ad6137a2e67b8414ea58880865311534) )
2051   ROM_LOAD32_BYTE( "wcbfprm3.140", 0x00003, 0x20000, CRC(c41258a4) SHA1(182e8a25bdb126a4de8a44a1c26fd8b66f06d66e) )
20522052
20532053   ROM_REGION( 0x28000, REGION_CPU2, 0 )
20542054   ROM_LOAD( "wcb_snd.u88", 0x10000, 0x18000, CRC(e97a6d28) SHA1(96d7b7856918abcc460083f2a46582ba2a689288) ) /* Actual version is 4.01 but may be labeled V4.0 or V4.01 */
r1877r1878
21762176
21772177
21782178ROM_START( wcbwl15 )   /* Version 1.5 (3-tier board set: P/N 1059 Rev 3, P/N 1079 Rev 1 & P/N 1060 Rev 0) */
2179   /* v1.0 for this platform have been confirmed, but not dumped */
2179   /* v1.0 for this platform has been confirmed, but not dumped */
21802180   ROM_REGION16_BE( 0x80000, REGION_USER1, 0 )
21812181   ROM_LOAD16_BYTE( "wcb_v15.u83", 0x00000, 0x20000, CRC(3ca9ab85) SHA1(364946dceb3f7279b7d67d9d685a98ba7f4901aa) ) /* Labeled as "WCB V1.5 (U83)" */
21822182   ROM_LOAD16_BYTE( "wcb_v15.u88", 0x00001, 0x20000, CRC(d43e6fad) SHA1(fd72f6945e7f5ef86dc28503749d18086dd29906) ) /* Labeled as "WCB V1.5 (U88)" */
r1877r1878
31043104ROM_END
31053105
31063106
3107ROM_START( gt97t240 ) /* Version 2.40 Tournament Edition (PCB P/N 1082 Rev 2) */
3107ROM_START( gt97t243 ) /* Version 2.43 Tournament Edition (PCB P/N 1082 Rev 2) */
31083108   ROM_REGION32_BE( CODE_SIZE, REGION_USER1, 0 )
3109   ROM_LOAD32_BYTE( "gt97prm0.240", 0x00000, 0x100000, CRC(88a386d0) SHA1(003dbf784125b1a442f85e18f8161695dcacc3a8) )
3110   ROM_LOAD32_BYTE( "gt97prm1.240", 0x00001, 0x100000, CRC(b0d751aa) SHA1(7e6ab9c2bb0bd4f50360655c59f48c44f6135f4f) )
3111   ROM_LOAD32_BYTE( "gt97prm2.240", 0x00002, 0x100000, CRC(451be534) SHA1(2f78cdba607c4b936b5cbdb520757d038d9aa7a3) )
3112   ROM_LOAD32_BYTE( "gt97prm3.240", 0x00003, 0x100000, CRC(70da8ca5) SHA1(baf56d04c5d75165fc9f3269650847e46bbbe2d3) )
3109   ROM_LOAD32_BYTE( "gt97prm0.243", 0x00000, 0x100000, CRC(b8de60f1) SHA1(06b1f8b9d0b878d5a19e6756957e2df19e013ad6) )
3110   ROM_LOAD32_BYTE( "gt97prm1.243", 0x00001, 0x100000, CRC(8152e5d3) SHA1(2a4f8acc6a4e33864c97d5974e2230b1cf3632ea) )
3111   ROM_LOAD32_BYTE( "gt97prm2.243", 0x00002, 0x100000, CRC(b80061be) SHA1(9a6a6281690b3bd2eabb081467bfda074639fa6a) )
3112   ROM_LOAD32_BYTE( "gt97prm3.243", 0x00003, 0x100000, CRC(d184968d) SHA1(eecd4e9d060e4b8feabca715d3d7f9738641cfcc) )
31133113
31143114   ROM_REGION( 0x28000, REGION_CPU2, 0 )
31153115   ROM_LOAD( "gt_nr.u88", 0x10000, 0x18000, CRC(2cee9e98) SHA1(02edac7abab2335c1cd824d1d9b26aa32238a2de) )
r1877r1878
31353135ROM_END
31363136
31373137
3138ROM_START( gt97t243 ) /* Version 2.43 Tournament Edition (PCB P/N 1082 Rev 2) */
3138ROM_START( gt97t240 ) /* Version 2.40 Tournament Edition (PCB P/N 1082 Rev 2) */
31393139   ROM_REGION32_BE( CODE_SIZE, REGION_USER1, 0 )
3140   ROM_LOAD32_BYTE( "gt97prm0.243", 0x00000, 0x100000, CRC(b8de60f1) SHA1(06b1f8b9d0b878d5a19e6756957e2df19e013ad6) )
3141   ROM_LOAD32_BYTE( "gt97prm1.243", 0x00001, 0x100000, CRC(8152e5d3) SHA1(2a4f8acc6a4e33864c97d5974e2230b1cf3632ea) )
3142   ROM_LOAD32_BYTE( "gt97prm2.243", 0x00002, 0x100000, CRC(b80061be) SHA1(9a6a6281690b3bd2eabb081467bfda074639fa6a) )
3143   ROM_LOAD32_BYTE( "gt97prm3.243", 0x00003, 0x100000, CRC(d184968d) SHA1(eecd4e9d060e4b8feabca715d3d7f9738641cfcc) )
3140   ROM_LOAD32_BYTE( "gt97prm0.240", 0x00000, 0x100000, CRC(88a386d0) SHA1(003dbf784125b1a442f85e18f8161695dcacc3a8) )
3141   ROM_LOAD32_BYTE( "gt97prm1.240", 0x00001, 0x100000, CRC(b0d751aa) SHA1(7e6ab9c2bb0bd4f50360655c59f48c44f6135f4f) )
3142   ROM_LOAD32_BYTE( "gt97prm2.240", 0x00002, 0x100000, CRC(451be534) SHA1(2f78cdba607c4b936b5cbdb520757d038d9aa7a3) )
3143   ROM_LOAD32_BYTE( "gt97prm3.240", 0x00003, 0x100000, CRC(70da8ca5) SHA1(baf56d04c5d75165fc9f3269650847e46bbbe2d3) )
31443144
31453145   ROM_REGION( 0x28000, REGION_CPU2, 0 )
31463146   ROM_LOAD( "gt_nr.u88", 0x10000, 0x18000, CRC(2cee9e98) SHA1(02edac7abab2335c1cd824d1d9b26aa32238a2de) )
r1877r1878
38073807   init_shuffle_bowl_common(machine, 0x1116);
38083808}
38093809
3810static DRIVER_INIT( wcbowlt )   /* PIC 16C54 labeled as ITBWL-4 */
3810static DRIVER_INIT( wcbowlt )   /* PIC 16C54 labeled as ITBWL-3 */
38113811{
3812   /* Tournament Version */
3812   /* Tournament Version, Same protection memory address as WCB Deluxe, but uses the standard WCB pic ITBWL-3 */
38133813   init_shuffle_bowl_common(machine, 0x111a);
38143814
38153815   timekeeper_init( 0, TIMEKEEPER_M48T02, NULL );
r1877r1878
38323832{
38333833   /*
38343834        This is the 3 tier PCB with the short ROM board:
3835        Known GT versions on this board:  GT3D v1.4 through v1.92S
3835        Known (dumped) GT versions on this board:  GT3D v1.4 through v1.92S
38363836
38373837        Hacked versions of this PCB have been found with GT97
38383838        through GTClassic. This is _NOT_ a factory modification
r1877r1878
38593859static DRIVER_INIT( aamat )
38603860{
38613861   /*
3862        Tournament Version
3862        Tournament Version - So install needed handler for the TimeKeeper ram
38633863    */
38643864   DRIVER_INIT_CALL(aama);
38653865   timekeeper_init( 0, TIMEKEEPER_M48T02, NULL );
r1877r1878
39093909        move.b      680002,d0       ; Read protection result
39103910        andi.b      #$C0,d0
39113911        cmpi.b      #$80,d0
3912Label1  bne.s       Label1          ; Infinite loop if retsult isn't 0x80
3912Label1  bne.s       Label1          ; Infinite loop if result isn't 0x80
39133913        rts                         ; Otherwise just return to the game :-)
39143914
39153915    */
r1877r1878
39483948GAME( 1997, shufshot, 0,        sftm,     shufshot, shufshot, ROT0, "Strata/Incredible Technologies", "Shuffleshot (v1.40)" , 0) /* PIC 16C54 labeled as ITSHF-1 */
39493949GAME( 1997, sshot139, shufshot, sftm,     shufshot, shufshot, ROT0, "Strata/Incredible Technologies", "Shuffleshot (v1.39)" , 0) /* PIC 16C54 labeled as ITSHF-1 */
39503950GAME( 1997, sshot137, shufshot, sftm,     shufbowl, shufshot, ROT0, "Strata/Incredible Technologies", "Shuffleshot (v1.37)" , 0) /* PIC 16C54 labeled as ITSHF-1 */
3951GAME( 1997, wcbwl140, wcbowldx, tourny,   wcbowldx, wcbowlt,  ROT0, "Incredible Technologies",        "World Class Bowling Tournament (v1.40)" , 0) /* PIC 16C54 labeled as ITBWL-4 */
3951GAME( 1997, wcbwl140, wcbowldx, tourny,   wcbowldx, wcbowlt,  ROT0, "Incredible Technologies",        "World Class Bowling Tournament (v1.40)" , 0) /* PIC 16C54 labeled as ITBWL-3 */
39523952GAME( 1999, wcbowldx, 0,        sftm,     wcbowldx, shufshot, ROT0, "Incredible Technologies",        "World Class Bowling Deluxe (v2.00)" , 0) /* PIC 16C54 labeled as ITBWL-4 */
39533953
39543954/*
r1877r1878
39693969        Sound P/N 1078 Rev 1 or P/N 1066 Rev 2
39703970    n = Non-tournament (AAMA 676266+) PCB P/N 1082 Rev 2 - Applies only for GT3D
39713971    t = Tournament PCB P/N 1082 Rev 2, with necessary chips on board:
3972        Philips SCN68681 (DUART) & ST Timekeeper (M48T02-120PC1)
3972        Philips SCN68681 (DUART) & ST Timekeeper (M48T02-120PC1) with an additional 3.6864MHz OSC
39733973
39743974    NOTE: Due to various different upgrade packages from IT, the 3 tier boards can end up with any combination
39753975        of rom boards and sound boards.  For historical reasons, GTG3 3 tier S versions will use the oldest
r1877r1878
40094009GAME( 1997, gt97v121, gt97,     sftm,    gt97o, aama,     ROT0, "Incredible Technologies", "Golden Tee '97 (v1.21)" , 0) /* PIC 16C54 labeled as ITGFS-3 */
40104010GAME( 1997, gt97s121, gt97,     sftm,    gt97s, s_ver,    ROT0, "Incredible Technologies", "Golden Tee '97 (v1.21S)" , 0) /* PIC 16C54 labeled as ITGFM-3 */
40114011GAME( 1997, gt97v120, gt97,     sftm,    gt97o, aama,     ROT0, "Incredible Technologies", "Golden Tee '97 (v1.20)" , 0) /* PIC 16C54 labeled as ITGFS-3 */
4012GAME( 1997, gt97t243, gt97,     tourny,  gt97o, aamat,    ROT0, "Incredible Technologies", "Golden Tee '97 Tournament (v2.43)" , 0) /* PIC 16C54 labeled as ITGFS-3 */
40124013GAME( 1997, gt97t240, gt97,     tourny,  gt97o, aamat,    ROT0, "Incredible Technologies", "Golden Tee '97 Tournament (v2.40)" , 0) /* PIC 16C54 labeled as ITGFS-3 */
4013GAME( 1997, gt97t243, gt97,     tourny,  gt97o, aamat,    ROT0, "Incredible Technologies", "Golden Tee '97 Tournament (v2.43)" , 0) /* PIC 16C54 labeled as ITGFS-3 */
40144014
40154015GAME( 1998, gt98,     0,        sftm,    aama,  aama,     ROT0, "Incredible Technologies", "Golden Tee '98 (v1.10)" , 0) /* PIC 16C54 labeled as ITGF98 */
40164016GAME( 1998, gt98v100, gt98,     sftm,    gt98,  aama,     ROT0, "Incredible Technologies", "Golden Tee '98 (v1.00)" , 0) /* PIC 16C54 labeled as ITGF98 */
src/mame/drivers/mexico86.c
r1877r1878
4545***************************************************************************/
4646
4747#include "driver.h"
48#include "deprecat.h"
4849#include "cpu/z80/z80.h"
4950#include "cpu/m6805/m6805.h"
5051#include "sound/2203intf.h"
r1877r1878
7172//AT
7273static READ8_HANDLER( kiki_2203_r )
7374{
74   return(YM2203_status_port_0_r(0) & 0x7f);
75   return(YM2203_status_port_0_r(machine,0) & 0x7f);
7576}
7677//ZT
7778
r1877r1878
385386
386387   MDRV_CPU_ADD(Z80, 24000000/4)      /* 6 MHz, Uses clock divided 24MHz OSC */
387388   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
388   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
389   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
389390
390391   MDRV_CPU_ADD_TAG("mcu", M68705, 4000000) /* xtal is 4MHz, divided by 4 internally */
391392   MDRV_CPU_PROGRAM_MAP(m68705_readmem,m68705_writemem)
392   MDRV_CPU_VBLANK_INT(mexico86_m68705_interrupt,2)
393   MDRV_CPU_VBLANK_INT_HACK(mexico86_m68705_interrupt,2)
393394
394395   MDRV_CPU_ADD_TAG("sub", Z80, 8000000/2)      /* 4 MHz, Uses 8Mhz OSC */
395396   MDRV_CPU_PROGRAM_MAP(sub_cpu_map,0)
396   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
397   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
397398
398399   MDRV_INTERLEAVE(100)    /* 100 CPU slices per frame - an high value to ensure proper */
399400                     /* synchronization of the CPUs */
r1877r1878
441442   MDRV_IMPORT_FROM(knightb)
442443
443444   MDRV_CPU_MODIFY("main")
444   MDRV_CPU_VBLANK_INT(kikikai_interrupt, 1) // IRQs should be triggered by the MCU, but we don't have it
445   MDRV_CPU_VBLANK_INT("main", kikikai_interrupt) // IRQs should be triggered by the MCU, but we don't have it
445446
446447   MDRV_CPU_REMOVE("mcu")   // we don't have code for the 68701
447448
src/mame/drivers/chaknpop.c
r1877r1878
289289   MDRV_CPU_ADD(Z80, 2350000)
290290   //MDRV_CPU_ADD(Z80, 2760000)
291291   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
292   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
292   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
293293
294294   MDRV_MACHINE_RESET(chaknpop)
295295
src/mame/drivers/fitfight.c
r1877r1878
753753static MACHINE_DRIVER_START( fitfight )
754754   MDRV_CPU_ADD_TAG("main",M68000, 12000000)
755755   MDRV_CPU_PROGRAM_MAP(fitfight_main_map,0)
756   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
756   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
757757
758758   MDRV_CPU_ADD(UPD7810, 12000000)
759759   /* audio CPU */
760760   MDRV_CPU_CONFIG(sound_cpu_config)
761761   MDRV_CPU_PROGRAM_MAP(snd_mem, 0)
762762   MDRV_CPU_IO_MAP(snd_io, 0)
763   MDRV_CPU_VBLANK_INT(snd_irq,1)
763   MDRV_CPU_VBLANK_INT("main", snd_irq)
764764
765765   MDRV_GFXDECODE(fitfight)
766766
r1877r1878
787787static MACHINE_DRIVER_START( bbprot )
788788   MDRV_CPU_ADD_TAG("main",M68000, 12000000)
789789   MDRV_CPU_PROGRAM_MAP(bbprot_main_map,0)
790   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
790   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
791791
792792   MDRV_GFXDECODE(prot)
793793
src/mame/drivers/sspeedr.c
r1877r1878
223223   MDRV_CPU_ADD(Z80, 19968000 / 8)
224224   MDRV_CPU_PROGRAM_MAP(readmem, writemem)
225225   MDRV_CPU_IO_MAP(readport, writeport)
226   MDRV_CPU_VBLANK_INT(irq0_line_assert, 1)
226   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
227227
228228   /* video hardware */
229229   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/filetto.c
r1877r1878
8989#define RES_320x200 0
9090#define RES_640x200 1
9191
92static void cga_alphanumeric_tilemap(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,UINT16 size,UINT32 map_offs);
92static void cga_alphanumeric_tilemap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,UINT16 size,UINT32 map_offs);
9393
9494static VIDEO_START( filetto )
9595{
r1877r1878
109109
110110
111111/*Basic Graphic mode */
112static void cga_graphic_bitmap(running_machine *machine,mame_bitmap *bitmap,const rectangle *cliprect,UINT16 size,UINT32 map_offs)
112static void cga_graphic_bitmap(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect,UINT16 size,UINT32 map_offs)
113113{
114114   static UINT16 x,y,pen = 0;
115115   static UINT32 offs;
r1877r1878
197197
198198
199199
200static void cga_alphanumeric_tilemap(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,UINT16 size,UINT32 map_offs)
200static void cga_alphanumeric_tilemap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,UINT16 size,UINT32 map_offs)
201201{
202202   static UINT32 offs,x,y,max_x,max_y;
203203
r1877r1878
738738   MDRV_CPU_ADD_TAG("main", I8088, 8000000)
739739   MDRV_CPU_PROGRAM_MAP(filetto_map,0)
740740   MDRV_CPU_IO_MAP(filetto_io,0)
741   MDRV_CPU_VBLANK_INT(filetto_irq,200)
741   MDRV_CPU_VBLANK_INT_HACK(filetto_irq,200)
742742
743743   MDRV_GFXDECODE(filetto)
744744
src/mame/drivers/ashnojoe.c
r1877r1878
102102   //if it returns 1 there's no sound. is it used to sync the game and sound?
103103   //or just a debug enable/disble register?
104104   return 0;
105   return 1;
105   //return 1;
106106}
107107
108108static WRITE16_HANDLER( ashnojoe_soundlatch_w )
109109{
110110   if(ACCESSING_LSB)
111111   {
112      soundlatch_w(0,data & 0xff);
112      soundlatch_w(machine,0,data & 0xff);
113113      //needed?
114      cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
114      cpunum_set_input_line(machine, 1,0,HOLD_LINE);
115115   }
116116}
117117
r1877r1878
143143   int ret = 0;
144144   ret ^= 1;
145145   return ret;
146   return 1;
147   return 0;
148   return mame_rand(Machine);
146   /* FIXME: earlier attemts to remove ?
147    return 1;
148    return 0;
149    return mame_rand(Machine);
150    */
149151}
150152
151153static WRITE8_HANDLER( adpcm_data_w )
r1877r1878
335337   /* basic machine hardware */
336338   MDRV_CPU_ADD(M68000, 8000000) /* 8 MHz (verified on pcb) */
337339   MDRV_CPU_PROGRAM_MAP(ashnojoe_map,0)
338   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
340   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
339341
340342   MDRV_CPU_ADD(Z80, 4000000) /* 4 MHz (verified on pcb) */
341343   MDRV_CPU_PROGRAM_MAP(sound_map,0)
src/mame/drivers/terracre.c
r1877r1878
8181*/
8282
8383#include "driver.h"
84#include "deprecat.h"
8485#include "cpu/z80/z80.h"
8586#include "sound/dac.h"
8687#include "sound/2203intf.h"
r1877r1878
158159
159160static WRITE16_HANDLER( amazon_sound_w )
160161{
161   soundlatch_w(0,((data & 0x7f) << 1) | 1);
162   soundlatch_w(machine,0,((data & 0x7f) << 1) | 1);
162163}
163164
164165static READ8_HANDLER( soundlatch_clear_r )
165166{
166   soundlatch_clear_w(0,0);
167   soundlatch_clear_w(machine,0,0);
167168   return 0;
168169}
169170
r1877r1878
604605static MACHINE_DRIVER_START( amazon )
605606   MDRV_CPU_ADD(M68000, 8000000 )
606607   MDRV_CPU_PROGRAM_MAP(amazon_readmem,amazon_writemem)
607   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
608   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
608609
609610   MDRV_CPU_ADD(Z80, 4000000)
610611   /* audio CPU */   /* 4 MHz???? */
611612   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
612613   MDRV_CPU_IO_MAP(sound_readport,sound_writeport_3526)
613   MDRV_CPU_VBLANK_INT(irq0_line_hold,128)   /* ??? */
614   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,128)   /* ??? */
614615
615616   MDRV_MACHINE_START(amazon)
616617
r1877r1878
644645static MACHINE_DRIVER_START( ym3526 )
645646   MDRV_CPU_ADD(M68000, 8000000 )
646647   MDRV_CPU_PROGRAM_MAP(terracre_readmem,terracre_writemem)
647   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
648   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
648649
649650   MDRV_CPU_ADD(Z80, 4000000)
650651   /* audio CPU */   /* 4 MHz???? */
651652   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
652653   MDRV_CPU_IO_MAP(sound_readport,sound_writeport_3526)
653   MDRV_CPU_VBLANK_INT(irq0_line_hold,128)   /* ??? */
654   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,128)   /* ??? */
654655
655656
656657   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
682683static MACHINE_DRIVER_START( ym2203 )
683684   MDRV_CPU_ADD(M68000, 8000000) /* 8 MHz?? */
684685   MDRV_CPU_PROGRAM_MAP(terracre_readmem,terracre_writemem)
685   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
686   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
686687
687688   MDRV_CPU_ADD(Z80, 4000000)
688689   /* audio CPU */   /* 4 MHz???? */
689690   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
690691   MDRV_CPU_IO_MAP(sound_readport,sound_writeport_2203)
691   MDRV_CPU_VBLANK_INT(irq0_line_hold,128)   /* ??? */
692   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,128)   /* ??? */
692693
693694
694695   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/findout.c
r1877r1878
6666
6767static READ8_HANDLER( port1_r )
6868{
69   return input_port_1_r(0) | (ticket_dispenser_0_r(0) >> 5);
69   return input_port_1_r(machine, 0) | (ticket_dispenser_0_r(machine, 0) >> 5);
7070}
7171
7272static WRITE8_HANDLER( lamps_w )
r1877r1878
9090   set_led_status(9,data & 0x08);
9191
9292   /* bit 5 - ticket out in trivia games */
93   ticket_dispenser_w(0, (data & 0x20)<< 2);
93   ticket_dispenser_w(machine, 0, (data & 0x20)<< 2);
9494
9595   /* bit 6 enables NMI */
96   interrupt_enable_w(0,data & 0x40);
96   interrupt_enable_w(machine, 0,data & 0x40);
9797
9898   /* bit 7 goes directly to the sound amplifier */
9999   DAC_data_w(0,((data & 0x80) >> 7) * 255);
r1877r1878
446446   /* basic machine hardware */
447447   MDRV_CPU_ADD(Z80,4000000)   /* 4 MHz */
448448   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
449   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
449   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
450450
451451   MDRV_MACHINE_RESET(findout)
452452   MDRV_NVRAM_HANDLER(generic_0fill)
src/mame/drivers/minivadr.c
r1877r1878
7272   /* basic machine hardware */
7373   MDRV_CPU_ADD(Z80,24000000 / 6)       /* 4 MHz ? */
7474   MDRV_CPU_PROGRAM_MAP(minivadr_map,0)
75   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
75   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
7676
7777   /* video hardware */
7878   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/mouser.c
r1877r1878
202202   /* basic machine hardware */
203203   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz ? */
204204   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
205   MDRV_CPU_VBLANK_INT(mouser_nmi_interrupt,1) /* NMI is masked externally */
205   MDRV_CPU_VBLANK_INT("main", mouser_nmi_interrupt) /* NMI is masked externally */
206206
207207   MDRV_CPU_ADD(Z80, 4000000)   /* ??? */
208208   MDRV_CPU_PROGRAM_MAP(readmem2,writemem2)
209209   MDRV_CPU_IO_MAP(readport2,writeport2)
210210   /* audio CPU */
211   MDRV_CPU_VBLANK_INT(nmi_line_pulse,4) /* ??? This controls the sound tempo */
211   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,4) /* ??? This controls the sound tempo */
212212
213213   /* video hardware */
214214   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/undrfire.c
r1877r1878
222222   {
223223      case 0x00:
224224      {
225         return (input_port_0_word_r(0,0) << 16) | input_port_1_word_r(0,0) |
225         return (input_port_0_word_r(machine,0,0) << 16) | input_port_1_word_r(machine,0,0) |
226226              (EEPROM_read_bit() << 7) | frame_counter;
227227      }
228228
229229      case 0x01:
230230      {
231         return input_port_2_word_r(0,0) | (coin_word << 16);
231         return input_port_2_word_r(machine,0,0) | (coin_word << 16);
232232      }
233233    }
234234
r1877r1878
243243      {
244244         if (ACCESSING_MSB32)   /* $500000 is watchdog */
245245         {
246            watchdog_reset_w(0,data >> 24);
246            watchdog_reset(machine);
247247         }
248248
249249         if (ACCESSING_LSB32)
r1877r1878
313313
314314      case 0x00:   /* P1 */
315315      {
316         x = input_port_3_word_r(0,0) << 6;
317         y = input_port_4_word_r(0,0) << 6;
316         x = input_port_3_word_r(machine,0,0) << 6;
317         y = input_port_4_word_r(machine,0,0) << 6;
318318
319319         return ((x << 24) &0xff000000) | ((x << 8) &0xff0000)
320320             | ((y << 8) &0xff00) | ((y >> 8) &0xff) ;
r1877r1878
322322
323323      case 0x01:   /* P2 */
324324      {
325         x = input_port_5_word_r(0,0) << 6;
326         y = input_port_6_word_r(0,0) << 6;
325         x = input_port_5_word_r(machine,0,0) << 6;
326         y = input_port_6_word_r(machine,0,0) << 6;
327327
328328         return ((x << 24) &0xff000000) | ((x << 8) &0xff0000)
329329             | ((y << 8) &0xff00) | ((y >> 8) &0xff) ;
r1877r1878
551551   /* basic machine hardware */
552552   MDRV_CPU_ADD(M68EC020, 16000000)   /* 16 MHz */
553553   MDRV_CPU_PROGRAM_MAP(undrfire_readmem,undrfire_writemem)
554   MDRV_CPU_VBLANK_INT(undrfire_interrupt,1)
554   MDRV_CPU_VBLANK_INT("main", undrfire_interrupt)
555555
556556   TAITO_F3_SOUND_SYSTEM_CPU(16000000)
557557
src/mame/drivers/deco32.c
r1877r1878
316316
317317static WRITE32_HANDLER( deco32_sound_w )
318318{
319   soundlatch_w(0,data & 0xff);
320   cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
319   soundlatch_w(machine,0,data & 0xff);
320   cpunum_set_input_line(machine, 1,0,HOLD_LINE);
321321}
322322
323323static READ32_HANDLER( deco32_71_r )
r1877r1878
445445
446446static READ32_HANDLER(dragngun_oki_2_r)
447447{
448   return OKIM6295_status_2_r(0);
448   return OKIM6295_status_2_r(machine, 0);
449449}
450450
451451static WRITE32_HANDLER(dragngun_oki_2_w)
452452{
453   OKIM6295_data_2_w(0,data&0xff);
453   OKIM6295_data_2_w(machine, 0, data&0xff);
454454}
455455
456456/**********************************************************************************/
r1877r1878
477477      /* 'Swap bits 0 and 3 to correct for design error from BSMT schematic' */
478478      int soundcommand = (data>>16)&0xff;
479479      soundcommand = BITSWAP8(soundcommand,7,6,5,4,0,2,1,3);
480      soundlatch_w(0,soundcommand);
480      soundlatch_w(machine,0,soundcommand);
481481   }
482482}
483483
r1877r1878
603603   }
604604
605605   /* Playfield control - Only written in full word memory accesses */
606   deco32_pri_w(0,data&0x3,0); /* Bit 0 - layer priority toggle, Bit 1 - BG2/3 Joint mode (8bpp) */
606   deco32_pri_w(machine,0,data&0x3,0); /* Bit 0 - layer priority toggle, Bit 1 - BG2/3 Joint mode (8bpp) */
607607
608608   /* Sound board reset control */
609609   if (data&0x80)
r1877r1878
641641      EEPROM_write_bit(data & 0x10);
642642      EEPROM_set_cs_line((data & 0x40) ? CLEAR_LINE : ASSERT_LINE);
643643
644      deco32_pri_w(0,data&0x3,0); /* Bit 0 - layer priority toggle, Bit 1 - BG2/3 Joint mode (8bpp) */
644      deco32_pri_w(machine,0,data&0x3,0); /* Bit 0 - layer priority toggle, Bit 1 - BG2/3 Joint mode (8bpp) */
645645   }
646646}
647647
r1877r1878
654654   if (offset==0x700/4) {
655655
656656      /* bit 1 of nslasher_sound_irq specifies IRQ command writes */
657      soundlatch_w(0,(data>>16)&0xff);
657      soundlatch_w(machine,0,(data>>16)&0xff);
658658      nslasher_sound_irq |= 0x02;
659      cpunum_set_input_line(Machine, 1, 0, (nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE);
659      cpunum_set_input_line(machine, 1, 0, (nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE);
660660   }
661661}
662662
r1877r1878
11331133
11341134static WRITE8_HANDLER(deco32_bsmt1_w)
11351135{
1136   BSMT2000_data_0_w(offset^ 0xff, ((bsmt_latch<<8)|data), 0);
1137   cpunum_set_input_line(Machine, 1, M6809_IRQ_LINE, HOLD_LINE); /* BSMT is ready */
1136   BSMT2000_data_0_w(machine, offset^ 0xff, ((bsmt_latch<<8)|data), 0);
1137   cpunum_set_input_line(machine, 1, M6809_IRQ_LINE, HOLD_LINE); /* BSMT is ready */
11381138}
11391139
11401140static READ8_HANDLER(deco32_bsmt_status_r)
r1877r1878
11801180{
11811181   /* bit 1 of nslasher_sound_irq specifies IRQ command writes */
11821182   nslasher_sound_irq &= ~0x02;
1183   cpunum_set_input_line(Machine, 1, 0, (nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE);
1184   return soundlatch_r(0);
1183   cpunum_set_input_line(machine, 1, 0, (nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE);
1184   return soundlatch_r(machine,0);
11851185}
11861186
11871187static ADDRESS_MAP_START( nslasher_sound, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
18771877   /* basic machine hardware */
18781878   MDRV_CPU_ADD(ARM, 28000000/4)
18791879   MDRV_CPU_PROGRAM_MAP(captaven_readmem,captaven_writemem)
1880   MDRV_CPU_VBLANK_INT(deco32_vbl_interrupt,1)
1880   MDRV_CPU_VBLANK_INT("main", deco32_vbl_interrupt)
18811881
18821882   MDRV_CPU_ADD(H6280, 32220000/8)
18831883   /* audio CPU */
r1877r1878
19251925   /* basic machine hardware */
19261926   MDRV_CPU_ADD(ARM, 28000000/4)
19271927   MDRV_CPU_PROGRAM_MAP(fghthist_readmem,fghthist_writemem)
1928   MDRV_CPU_VBLANK_INT(deco32_vbl_interrupt,1)
1928   MDRV_CPU_VBLANK_INT("main", deco32_vbl_interrupt)
19291929
19301930   MDRV_CPU_ADD(H6280, 32220000/8)
19311931   /* audio CPU */
r1877r1878
19721972   /* basic machine hardware */
19731973   MDRV_CPU_ADD(ARM, 28000000/4)
19741974   MDRV_CPU_PROGRAM_MAP(fghthsta_memmap,0)
1975   MDRV_CPU_VBLANK_INT(deco32_vbl_interrupt,1)
1975   MDRV_CPU_VBLANK_INT("main", deco32_vbl_interrupt)
19761976
19771977   MDRV_CPU_ADD(H6280, 32220000/8) /* audio CPU */
19781978   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
r1877r1878
20182018   /* basic machine hardware */
20192019   MDRV_CPU_ADD(ARM, 28000000/4)
20202020   MDRV_CPU_PROGRAM_MAP(dragngun_readmem,dragngun_writemem)
2021   MDRV_CPU_VBLANK_INT(deco32_vbl_interrupt,1)
2021   MDRV_CPU_VBLANK_INT("main", deco32_vbl_interrupt)
20222022
20232023   MDRV_CPU_ADD(H6280, 32220000/8)
20242024   /* audio CPU */
r1877r1878
20722072   /* basic machine hardware */
20732073   MDRV_CPU_ADD(ARM, 28000000/4)
20742074   MDRV_CPU_PROGRAM_MAP(lockload_readmem,lockload_writemem)
2075   MDRV_CPU_VBLANK_INT(deco32_vbl_interrupt,2) // From 2
2075   MDRV_CPU_VBLANK_INT_HACK(deco32_vbl_interrupt,2) // From 2
20762076
20772077   MDRV_CPU_ADD(H6280, 32220000/8)
20782078   /* audio CPU */
r1877r1878
21262126   /* basic machine hardware */
21272127   MDRV_CPU_ADD(ARM, 28000000/4) /* Unconfirmed */
21282128   MDRV_CPU_PROGRAM_MAP(tattass_readmem,tattass_writemem)
2129   MDRV_CPU_VBLANK_INT(deco32_vbl_interrupt,1)
2129   MDRV_CPU_VBLANK_INT("main", deco32_vbl_interrupt)
21302130
21312131   MDRV_CPU_ADD(M6809, 2000000)
21322132   /* audio CPU */
r1877r1878
21642164   /* basic machine hardware */
21652165   MDRV_CPU_ADD(ARM, 28322000/4)
21662166   MDRV_CPU_PROGRAM_MAP(nslasher_readmem,nslasher_writemem)
2167   MDRV_CPU_VBLANK_INT(deco32_vbl_interrupt,1)
2167   MDRV_CPU_VBLANK_INT("main", deco32_vbl_interrupt)
21682168
21692169   MDRV_CPU_ADD(Z80, 32220000/9)
21702170   MDRV_CPU_PROGRAM_MAP(nslasher_sound,0)
src/mame/drivers/midzeus.c
r1877r1878
164164
165165static READ32_HANDLER( timekeeper_r )
166166{
167   return timekeeper_0_r(offset) | 0xffffff00;
167   return timekeeper_0_r(machine, offset) | 0xffffff00;
168168}
169169
170170
171171static WRITE32_HANDLER( timekeeper_w )
172172{
173173   if (bitlatch[2] && !cmos_protected)
174      timekeeper_0_w(offset, data);
174      timekeeper_0_w(machine, offset, data);
175175   else
176176      logerror("%06X:timekeeper_w with bitlatch[2] = %d, cmos_protected = %d\n", activecpu_get_pc(), bitlatch[2], cmos_protected);
177177   cmos_protected = TRUE;
r1877r1878
11161116   /* basic machine hardware */
11171117   MDRV_CPU_ADD_TAG("main", TMS32032, CPU_CLOCK)
11181118   MDRV_CPU_PROGRAM_MAP(zeus_map,0)
1119   MDRV_CPU_VBLANK_INT(display_irq,1)
1119   MDRV_CPU_VBLANK_INT("main", display_irq)
11201120
11211121   MDRV_MACHINE_START(midzeus)
11221122   MDRV_MACHINE_RESET(midzeus)
r1877r1878
11421142   /* basic machine hardware */
11431143   MDRV_CPU_ADD_TAG("main", TMS32032, CPU_CLOCK)
11441144   MDRV_CPU_PROGRAM_MAP(zeus2_map,0)
1145   MDRV_CPU_VBLANK_INT(display_irq,1)
1145   MDRV_CPU_VBLANK_INT("main", display_irq)
11461146
11471147   MDRV_MACHINE_START(midzeus2)
11481148   MDRV_MACHINE_RESET(midzeus)
src/mame/drivers/grchamp.c
r1877r1878
118118
119119static WRITE8_HANDLER( cpu0_outputs_w )
120120{
121   grchamp_state *state = Machine->driver_data;
121   grchamp_state *state = machine->driver_data;
122122   UINT8 diff = data ^ state->cpu0_out[offset];
123123   state->cpu0_out[offset] = data;
124124
r1877r1878
133133         /* bit 6: FOG OUT */
134134         /* bit 7: RADARON */
135135         if ((diff & 0x01) && !(data & 0x01))
136            cpunum_set_input_line(Machine, 0, 0, CLEAR_LINE);
136            cpunum_set_input_line(machine, 0, 0, CLEAR_LINE);
137137         if ((diff & 0x02) && !(data & 0x02))
138138            state->collide = state->collmode = 0;
139139         break;
r1877r1878
186186         break;
187187
188188      case 0x0d:   /* OUT13 */
189         watchdog_reset(Machine);
189         watchdog_reset(machine);
190190         break;
191191
192192      case 0x0e:   /* OUT14 */
193193         /* O-21 connector */
194         soundlatch_w(0, data);
195         cpunum_set_input_line(Machine, 2, INPUT_LINE_NMI, PULSE_LINE);
194         soundlatch_w(machine, 0, data);
195         cpunum_set_input_line(machine, 2, INPUT_LINE_NMI, PULSE_LINE);
196196         break;
197197   }
198198}
r1877r1878
245245
246246static WRITE8_HANDLER( cpu1_outputs_w )
247247{
248   grchamp_state *state = Machine->driver_data;
248   grchamp_state *state = machine->driver_data;
249249   UINT8 diff = data ^ state->cpu1_out[offset];
250250   state->cpu1_out[offset] = data;
251251
r1877r1878
272272      case 0x04:   /* OUT4 */
273273         /* bit 0:   interrupt enable for CPU 1 */
274274         if ((diff & 0x01) && !(data & 0x01))
275            cpunum_set_input_line(Machine, 1, 0, CLEAR_LINE);
275            cpunum_set_input_line(machine, 1, 0, CLEAR_LINE);
276276         break;
277277
278278      case 0x05:   /* OUT5 - unused */
r1877r1878
308308         /* bit 2-4: ATTACK UP 1-3 */
309309         /* bit 5-6: SIFT 1-2 */
310310         /* bit 7:   ENGINE CS */
311         discrete_sound_w(GRCHAMP_ENGINE_CS_EN, data & 0x80);
312         discrete_sound_w(GRCHAMP_SIFT_DATA, (data >> 5) & 0x03);
313         discrete_sound_w(GRCHAMP_ATTACK_UP_DATA, (data >> 2) & 0x07);
314         discrete_sound_w(GRCHAMP_IDLING_EN, data & 0x02);
315         discrete_sound_w(GRCHAMP_FOG_EN, data & 0x01);
311         discrete_sound_w(machine, GRCHAMP_ENGINE_CS_EN, data & 0x80);
312         discrete_sound_w(machine, GRCHAMP_SIFT_DATA, (data >> 5) & 0x03);
313         discrete_sound_w(machine, GRCHAMP_ATTACK_UP_DATA, (data >> 2) & 0x07);
314         discrete_sound_w(machine, GRCHAMP_IDLING_EN, data & 0x02);
315         discrete_sound_w(machine, GRCHAMP_FOG_EN, data & 0x01);
316316         break;
317317
318318      case 0x0d: /* OUTD */
319319         /* bit 0-3: ATTACK SPEED 1-4 */
320320         /* bit 4-7: PLAYER SPEED 1-4 */
321         discrete_sound_w(GRCHAMP_PLAYER_SPEED_DATA, (data >> 4) & 0x0f);
322         discrete_sound_w(GRCHAMP_ATTACK_SPEED_DATA,  data & 0x0f);
321         discrete_sound_w(machine, GRCHAMP_PLAYER_SPEED_DATA, (data >> 4) & 0x0f);
322         discrete_sound_w(machine, GRCHAMP_ATTACK_SPEED_DATA,  data & 0x0f);
323323         break;
324324
325325      default:
r1877r1878
424424
425425static WRITE8_HANDLER( grchamp_portA_0_w )
426426{
427   discrete_sound_w(GRCHAMP_A_DATA, data);
427   discrete_sound_w(machine, GRCHAMP_A_DATA, data);
428428}
429429
430430static WRITE8_HANDLER( grchamp_portB_0_w )
431431{
432   discrete_sound_w(GRCHAMP_B_DATA, 255-data);
432   discrete_sound_w(machine, GRCHAMP_B_DATA, 255-data);
433433}
434434
435435static WRITE8_HANDLER( grchamp_portA_2_w )
r1877r1878
675675   MDRV_CPU_ADD(Z80, PIXEL_CLOCK/2)
676676   MDRV_CPU_PROGRAM_MAP(main_map,0)
677677   MDRV_CPU_IO_MAP(main_portmap,0)
678   MDRV_CPU_VBLANK_INT(grchamp_cpu0_interrupt,1)
678   MDRV_CPU_VBLANK_INT("main", grchamp_cpu0_interrupt)
679679
680680   /* GAME BOARD */
681681   MDRV_CPU_ADD(Z80, PIXEL_CLOCK/2)
682682   MDRV_CPU_PROGRAM_MAP(sub_map,0)
683683   MDRV_CPU_IO_MAP(sub_portmap,0)
684   MDRV_CPU_VBLANK_INT(grchamp_cpu1_interrupt,1)
684   MDRV_CPU_VBLANK_INT("main", grchamp_cpu1_interrupt)
685685
686686   /* SOUND BOARD */
687687   MDRV_CPU_ADD(Z80, SOUND_CLOCK/2)
src/mame/drivers/argus.c
r1877r1878
220220   {
221221      if (offset < 0x0800)      /* BG0 RAM */
222222      {
223         return butasan_bg0ram_r( offset );
223         return butasan_bg0ram_r( machine, offset );
224224      }
225225      else if (offset < 0x1000)   /* Back BG0 RAM */
226226      {
227         return butasan_bg0backram_r( offset - 0x0800 );
227         return butasan_bg0backram_r( machine, offset - 0x0800 );
228228      }
229229   }
230230   else
231231   {
232232      if (offset < 0x0800)      /* Text RAM */
233233      {
234         return butasan_txram_r( offset );
234         return butasan_txram_r( machine, offset );
235235      }
236236      else if (offset < 0x1000)   /* Back text RAM */
237237      {
238         return butasan_txbackram_r( offset - 0x0800 );
238         return butasan_txbackram_r( machine, offset - 0x0800 );
239239      }
240240   }
241241
r1877r1878
248248   {
249249      if (offset < 0x0800)      /* BG0 RAM */
250250      {
251         butasan_bg0ram_w( offset, data );
251         butasan_bg0ram_w( machine, offset, data );
252252      }
253253      else if (offset < 0x1000)   /* Back BG0 RAM */
254254      {
255         butasan_bg0backram_w( offset - 0x0800, data );
255         butasan_bg0backram_w( machine, offset - 0x0800, data );
256256      }
257257   }
258258
r1877r1878
260260   {
261261      if (offset < 0x0800)      /* Text RAM */
262262      {
263         butasan_txram_w( offset, data );
263         butasan_txram_w( machine, offset, data );
264264      }
265265      else if (offset < 0x1000)   /* Back text RAM */
266266      {
267         butasan_txbackram_w( offset - 0x0800, data );
267         butasan_txbackram_w( machine, offset - 0x0800, data );
268268      }
269269   }
270270}
r1877r1878
773773   /* basic machine hardware */
774774   MDRV_CPU_ADD(Z80, 5000000)         /* 4 MHz */
775775   MDRV_CPU_PROGRAM_MAP(argus_readmem,argus_writemem)
776   MDRV_CPU_VBLANK_INT(argus_interrupt,2)
776   MDRV_CPU_VBLANK_INT_HACK(argus_interrupt,2)
777777
778778   MDRV_CPU_ADD(Z80, 5000000)
779779   /* audio CPU */         /* 4 MHz */
r1877r1878
811811   /* basic machine hardware */
812812   MDRV_CPU_ADD(Z80, 5000000)         /* 5 MHz */
813813   MDRV_CPU_PROGRAM_MAP(valtric_readmem,valtric_writemem)
814   MDRV_CPU_VBLANK_INT(argus_interrupt,2)
814   MDRV_CPU_VBLANK_INT_HACK(argus_interrupt,2)
815815
816816   MDRV_CPU_ADD(Z80, 5000000)
817817   /* audio CPU */         /* 5 MHz */
r1877r1878
855855   /* basic machine hardware */
856856   MDRV_CPU_ADD(Z80, 5000000)         /* 5 MHz */
857857   MDRV_CPU_PROGRAM_MAP(butasan_readmem,butasan_writemem)
858   MDRV_CPU_VBLANK_INT(argus_interrupt,2)
858   MDRV_CPU_VBLANK_INT_HACK(argus_interrupt,2)
859859
860860   MDRV_CPU_ADD(Z80, 5000000)
861861   /* audio CPU */         /* 5 MHz */
r1877r1878
899899   /* basic machine hardware */
900900   MDRV_CPU_ADD(Z80, 5000000)         /* 5 MHz */
901901   MDRV_CPU_PROGRAM_MAP(bombsa_readmem,bombsa_writemem)
902   MDRV_CPU_VBLANK_INT(argus_interrupt,2)
902   MDRV_CPU_VBLANK_INT_HACK(argus_interrupt,2)
903903
904904   MDRV_CPU_ADD(Z80, 12000000 / 2)
905905   /* audio CPU */                  /* 6 MHz */            /* maybe CPU speeds are reversed? Probably not (ajg) */
src/mame/drivers/drw80pkr.c
r1877r1878
223223   MDRV_CPU_ADD_TAG("main", I8039, 7864300)
224224   MDRV_CPU_PROGRAM_MAP(drw80pkr_map, 0)
225225    MDRV_CPU_IO_MAP(drw80pkr_io_map, 0)
226   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
226   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
227227
228228   // video hardware
229229
src/mame/drivers/lkage.c
r1877r1878
6262
6363static WRITE8_HANDLER( lkage_sound_command_w )
6464{
65   soundlatch_w(offset,data);
65   soundlatch_w(machine,offset,data);
6666   timer_call_after_resynch(NULL, data,nmi_callback);
6767}
6868
r1877r1878
328328   MDRV_CPU_ADD(Z80,6000000)
329329   MDRV_CPU_PROGRAM_MAP(lkage,0)
330330   MDRV_CPU_IO_MAP(readport,0)
331   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
331   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
332332
333333   MDRV_CPU_ADD(Z80, 6000000)
334334   MDRV_CPU_PROGRAM_MAP(readmem_sound,writemem_sound)
r1877r1878
373373   MDRV_CPU_ADD(Z80,6000000)
374374   MDRV_CPU_PROGRAM_MAP(lkage,0)
375375   MDRV_CPU_IO_MAP(readport,0)
376   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
376   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
377377
378378   MDRV_CPU_ADD(Z80, 6000000)
379379   MDRV_CPU_PROGRAM_MAP(readmem_sound,writemem_sound)
src/mame/drivers/superdq.c
r1877r1878
3636
3737static render_texture *video_texture;
3838static render_texture *overlay_texture;
39static mame_bitmap *last_video_bitmap;
39static bitmap_t *last_video_bitmap;
4040
4141static void video_cleanup(running_machine *machine)
4242{
r1877r1878
6666
6767   if (!video_skip_this_frame() && discinfo != NULL)
6868   {
69      mame_bitmap *vidbitmap;
69      bitmap_t *vidbitmap;
7070      rectangle fixedvis = machine->screen[screen].visarea;
7171      fixedvis.max_x++;
7272      fixedvis.max_y++;
r1877r1878
338338   MDRV_CPU_ADD(Z80, MASTER_CLOCK/8)
339339   MDRV_CPU_PROGRAM_MAP(superdq_map,0)
340340   MDRV_CPU_IO_MAP(superdq_io,0)
341   MDRV_CPU_VBLANK_INT(superdq_vblank, 1)
341   MDRV_CPU_VBLANK_INT("main", superdq_vblank)
342342
343343   MDRV_MACHINE_START(superdq)
344344
src/mame/drivers/goodejan.c
r1877r1878
278278   MDRV_CPU_ADD(V30, GOODEJAN_MHZ2/2)
279279   MDRV_CPU_PROGRAM_MAP(goodejan_map,0)
280280   MDRV_CPU_IO_MAP(goodejan_io_map,0)
281   MDRV_CPU_VBLANK_INT(goodejan_interrupt,2)
281   MDRV_CPU_VBLANK_INT_HACK(goodejan_interrupt,2)
282282
283283   SEIBU_SOUND_SYSTEM_CPU(GOODEJAN_MHZ1/2)
284284
src/mame/drivers/bestleag.c
r1877r1878
8484      include several similiarities with other Playmark games (including
8585      the sprite end code and the data being offset (i.e. spriteram starting from 0x16/2))
8686*/
87static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
87static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
8888{
8989
9090   /*
r1877r1878
315315static MACHINE_DRIVER_START( bestleag )
316316   MDRV_CPU_ADD(M68000, 12000000)
317317   MDRV_CPU_PROGRAM_MAP(bestleag_map,0)
318   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
318   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
319319
320320
321321   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/gaiden.c
r1877r1878
163163
164164static WRITE16_HANDLER( gaiden_sound_command_w )
165165{
166   if (ACCESSING_LSB) soundlatch_w(0,data & 0xff);   /* Ninja Gaiden */
167   if (ACCESSING_MSB) soundlatch_w(0,data >> 8);   /* Tecmo Knight */
168   cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
166   if (ACCESSING_LSB) soundlatch_w(machine,0,data & 0xff);   /* Ninja Gaiden */
167   if (ACCESSING_MSB) soundlatch_w(machine,0,data >> 8);   /* Tecmo Knight */
168   cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
169169}
170170
171171static WRITE16_HANDLER( drgnbowl_sound_command_w )
172172{
173173   if (ACCESSING_MSB)
174174   {
175      soundlatch_w(0,data >> 8);
176      cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
175      soundlatch_w(machine,0,data >> 8);
176      cpunum_set_input_line(machine, 1,0,HOLD_LINE);
177177   }
178178}
179179
r1877r1878
972972   /* basic machine hardware */
973973   MDRV_CPU_ADD(M68000, 18432000/2)   /* 9.216 MHz */
974974   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
975   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
975   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)
976976
977977   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz */
978978   /* audio CPU */
r1877r1878
10321032   /* basic machine hardware */
10331033   MDRV_CPU_ADD(M68000, 20000000/2)   /* 10 MHz */
10341034   MDRV_CPU_PROGRAM_MAP(drgnbowl_map,0)
1035   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
1035   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)
10361036
10371037   MDRV_CPU_ADD(Z80, 12000000/2)   /* 6 MHz */
10381038   /* audio CPU */
src/mame/drivers/zaxxon.c
r1877r1878
355355 *
356356 *************************************/
357357
358static void service_switch(void *param, UINT32 oldval, UINT32 newval)
358static INPUT_CHANGED( service_switch )
359359{
360360   /* pressing the service switch sends an NMI */
361361   if (newval)
362      cpunum_set_input_line(Machine, 0, INPUT_LINE_NMI, PULSE_LINE);
362      cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
363363}
364364
365365
r1877r1878
387387
388388static MACHINE_START( zaxxon )
389389{
390   /* request a callback if the service switch is pressed */
391   input_port_set_changed_callback(port_tag_to_index("SERVICESW"), 0x01, service_switch, NULL);
392
393390   /* register for save states */
394391   state_save_register_global(int_enabled);
395392}
r1877r1878
567564   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_IMPULSE(1)
568565
569566   PORT_START_TAG("SERVICESW")
570   PORT_SERVICE_NO_TOGGLE( 0x01, IP_ACTIVE_HIGH )
567   PORT_SERVICE_NO_TOGGLE( 0x01, IP_ACTIVE_HIGH ) PORT_CHANGED(service_switch, 0)
571568
572569   PORT_START_TAG("DSW02")
573570   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW1:!1,!2")
r1877r1878
935932   /* basic machine hardware */
936933   MDRV_CPU_ADD_TAG("main", Z80, MASTER_CLOCK/16)
937934   MDRV_CPU_PROGRAM_MAP(zaxxon_map, 0)
938   MDRV_CPU_VBLANK_INT(vblank_int, 1)
935   MDRV_CPU_VBLANK_INT("main", vblank_int)
939936
940937   MDRV_MACHINE_START(zaxxon)
941938
src/mame/drivers/shangkid.c
r1877r1878
103103static WRITE8_HANDLER( shangkid_bbx_AY8910_control_w )
104104{
105105   bbx_AY8910_control = data;
106   AY8910_control_port_0_w( offset, data );
106   AY8910_control_port_0_w( machine, offset, data );
107107}
108108
109109static WRITE8_HANDLER( chinhero_bbx_AY8910_write_w )
r1877r1878
124124      break;
125125
126126   default:
127      AY8910_write_port_0_w( offset, data );
127      AY8910_write_port_0_w( machine, offset, data );
128128      break;
129129   }
130130}
r1877r1878
149149      break;
150150
151151   default:
152      AY8910_write_port_0_w( offset, data );
152      AY8910_write_port_0_w( machine, offset, data );
153153      break;
154154   }
155155}
r1877r1878
387387   /* basic machine hardware */
388388   MDRV_CPU_ADD_TAG("main", Z80, XTAL_18_432MHz/6) /* verified on pcb */
389389   MDRV_CPU_PROGRAM_MAP(chinhero_main_map,0)
390   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
390   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
391391
392392   MDRV_CPU_ADD_TAG("bbx", Z80, XTAL_18_432MHz/6) /* verified on pcb */
393393   MDRV_CPU_PROGRAM_MAP(chinhero_bbx_map,0)
394394   MDRV_CPU_IO_MAP(chinhero_bbx_portmap,0)
395   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
395   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
396396
397397   MDRV_CPU_ADD_TAG("audio", Z80, XTAL_18_432MHz/6) /* verified on pcb */
398398   MDRV_CPU_PROGRAM_MAP(chinhero_sound_map,0)
r1877r1878
478478   MDRV_CPU_ADD(Z80, 3000000) /* ? */
479479   MDRV_CPU_PROGRAM_MAP(dynamski_map,0)
480480   MDRV_CPU_IO_MAP(dynamski_portmap,0)
481   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
481   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
482482
483483   /* video hardware */
484484   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/aleck64.c
r1877r1878
430430   MDRV_CPU_ADD(R4600BE, 93750000)
431431   MDRV_CPU_CONFIG(config)
432432   MDRV_CPU_PROGRAM_MAP(n64_map, 0)
433   MDRV_CPU_VBLANK_INT( n64_vblank, 1 )
433   MDRV_CPU_VBLANK_INT("main", n64_vblank)
434434
435435   MDRV_CPU_ADD(RSP, 62500000)
436436   MDRV_CPU_CONFIG(n64_rsp_config)
src/mame/drivers/trackfld.c
r1877r1878
863863   /* basic machine hardware */
864864   MDRV_CPU_ADD_TAG("main", M6809, 2048000)        /* 1.400 MHz ??? */
865865   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
866   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
866   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
867867
868868   MDRV_CPU_ADD(Z80,14318180/4)
869869   /* audio CPU */   /* Z80 Clock is derived from a 14.31818 MHz crystal */
r1877r1878
907907   /* basic machine hardware */
908908   MDRV_CPU_ADD(M6809, 2048000)        /* 1.400 MHz ??? */
909909   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
910   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
910   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
911911
912912   MDRV_CPU_ADD(Z80,14318180/4)
913913   /* audio CPU */   /* Z80 Clock is derived from a 14.31818 MHz crystal */
r1877r1878
962962   // right cpu?
963963   MDRV_CPU_REPLACE("main",M6800,2048000)      /* 1.400 MHz ??? */
964964   MDRV_CPU_PROGRAM_MAP(wizzquiz_map,0)
965   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
965   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
966966
967967   MDRV_NVRAM_HANDLER(generic_0fill)
968968MACHINE_DRIVER_END
r1877r1878
974974   MDRV_CPU_REPLACE("main",Z80,18432000/6)
975975   MDRV_CPU_PROGRAM_MAP(reaktor_readmem,reaktor_writemem)
976976   MDRV_CPU_IO_MAP(reaktor_readport,reaktor_writeport)
977   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
977   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
978978MACHINE_DRIVER_END
979979
980980
src/mame/drivers/fastfred.c
r1877r1878
66***************************************************************************/
77
88#include "driver.h"
9#include "deprecat.h"
910#include "fastfred.h"
1011#include "sound/ay8910.h"
1112
r1877r1878
558559   /* basic machine hardware */
559560   MDRV_CPU_ADD_TAG("main", Z80, CLOCK/6)     /* 3.072 MHz */
560561   MDRV_CPU_PROGRAM_MAP(fastfred_map,0)
561   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
562   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
562563
563564   MDRV_CPU_ADD_TAG("audio", Z80, CLOCK/12)
564565   /* audio CPU */    /* 1.536 MHz */
565566   MDRV_CPU_PROGRAM_MAP(sound_map,0)
566   MDRV_CPU_VBLANK_INT(nmi_line_pulse,4)
567   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,4)
567568
568569   /* video hardware */
569570   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/astrof.c
r1877r1878
123123 *
124124 *************************************/
125125
126static INTERRUPT_GEN( coin_nmi )
126static INPUT_CHANGED( coin_inserted )
127127{
128   UINT32 coin = readinputportbytag("COIN");
129   UINT32 service = readinputportbytag("SERVICE");
128   /* coin insertion causes an NMI */
129   cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, newval ? ASSERT_LINE : CLEAR_LINE);
130   coin_counter_w(0, newval);
131}
130132
131   /* both the coin input and the serice credit generates an NMI */
132   if (coin || service)
133      cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
134133
135   /* the coin input is also connected to the coin counter */
136   if (coin)
137   {
138      coin_counter_w(0, 1);
139      coin_counter_w(0, 0);
140   }
134static INPUT_CHANGED( service_coin_inserted )
135{
136   /* service coin insertion causes an NMI */
137   cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, newval ? ASSERT_LINE : CLEAR_LINE);
141138}
142139
143140
r1877r1878
311308}
312309
313310
314static void video_update_common(mame_bitmap *bitmap, const rectangle *cliprect, pen_t *pens)
311static void video_update_common(bitmap_t *bitmap, const rectangle *cliprect, pen_t *pens)
315312{
316313   offs_t offs;
317314
r1877r1878
614611   PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNUSED )
615612
616613   PORT_START_TAG("COIN")
617   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
614   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
615   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_CHANGED(service_coin_inserted, 0)
618616   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
619617
620   PORT_START_TAG("SERVICE")
621   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_IMPULSE(1)
622   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
623
624618   PORT_START_TAG("FLIP")
625619   PORT_DIPNAME( 0x01, 0x00, "Flip Screen for Player 2" )
626620   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
r1877r1878
676670   PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNUSED )
677671
678672   PORT_START_TAG("COIN")
679   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
673   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
674   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_CHANGED(service_coin_inserted, 0)
680675   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
681676
682   PORT_START_TAG("SERVICE")
683   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_IMPULSE(1)
684   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
685
686677   PORT_START_TAG("FLIP")
687678   PORT_DIPNAME( 0x01, 0x00, "Flip Screen for Player 2" ) PORT_DIPLOCATION("SW:8")
688679   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
r1877r1878
739730   PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNUSED )
740731
741732   PORT_START_TAG("COIN")
742   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
733   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
734   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_CHANGED(service_coin_inserted, 0)
743735   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
744736
745   PORT_START_TAG("SERVICE")
746   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_IMPULSE(1)
747   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
748
749737   PORT_START_TAG("FLIP")
750738   PORT_DIPNAME( 0x01, 0x00, "Flip Screen for Player 2" )
751739   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
r1877r1878
802790   PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNUSED )
803791
804792   PORT_START_TAG("COIN")
805   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
793   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
794   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_CHANGED(service_coin_inserted, 0)
806795   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
807796
808   PORT_START_TAG("SERVICE")
809   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_IMPULSE(1)
810   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
811
812797   PORT_START_TAG("FLIP")
813798   PORT_DIPNAME( 0x01, 0x00, "Flip Screen for Player 2" )
814799   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
r1877r1878
856841   PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_VBLANK )
857842
858843   PORT_START_TAG("COIN")
859   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
844   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
845   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_CHANGED(service_coin_inserted, 0)
860846   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
861847
862   PORT_START_TAG("SERVICE")
863   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_IMPULSE(1)
864   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
865
866848   PORT_START_TAG("FLIP")
867849   PORT_CONFNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
868850   PORT_CONFSETTING(    0x00, DEF_STR( Upright ) )
r1877r1878
882864
883865   /* basic machine hardware */
884866   MDRV_CPU_ADD_TAG("main", M6502, MAIN_CPU_CLOCK)
885   MDRV_CPU_VBLANK_INT(coin_nmi,1)
886867
887868   MDRV_MACHINE_RESET(astrof)
888869
r1877r1878
892873   MDRV_SCREEN_ADD("main", RASTER)
893874   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
894875   MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
895
896876MACHINE_DRIVER_END
897877
898878
r1877r1878
910890
911891   /* audio hardware */
912892   MDRV_IMPORT_FROM(astrof_audio)
913
914893MACHINE_DRIVER_END
915894
916895
r1877r1878
921900
922901   MDRV_MACHINE_START(abattle)
923902   MDRV_MACHINE_RESET(abattle)
924
925903MACHINE_DRIVER_END
926904
927905
r1877r1878
939917
940918   /* audio hardware */
941919   MDRV_IMPORT_FROM(spfghmk2_audio)
942
943920MACHINE_DRIVER_END
944921
945922
r1877r1878
957934
958935   /* audio hardware */
959936   MDRV_IMPORT_FROM(tomahawk_audio)
960
961937MACHINE_DRIVER_END
962938
963939
src/mame/drivers/karnov.c
r1877r1878
262262   /* Mnemonics filled in from the schematics, brackets are my comments */
263263   switch (offset<<1) {
264264      case 0: /* SECLR (Interrupt ack for Level 6 i8751 interrupt) */
265         cpunum_set_input_line(Machine, 0,6,CLEAR_LINE);
265         cpunum_set_input_line(machine, 0,6,CLEAR_LINE);
266266
267267         if (i8751_needs_ack) {
268268            /* If a command and coin insert happen at once, then the i8751 will queue the
269269                    coin command until the previous command is ACK'd */
270270            if (i8751_coin_pending) {
271271               i8751_return=i8751_coin_pending;
272               cpunum_set_input_line(Machine, 0,6,HOLD_LINE);
272               cpunum_set_input_line(machine, 0,6,HOLD_LINE);
273273               i8751_coin_pending=0;
274274            } else if (i8751_command_queue) {
275275               /* Pending control command - just write it back as SECREQ */
276276               i8751_needs_ack=0;
277               karnov_control_w(3,i8751_command_queue,0xffff);
277               karnov_control_w(machine,3,i8751_command_queue,0xffff);
278278               i8751_command_queue=0;
279279            } else {
280280               i8751_needs_ack=0;
r1877r1878
283283         return;
284284
285285      case 2: /* SONREQ (Sound CPU byte) */
286         soundlatch_w(0,data&0xff);
287         cpunum_set_input_line (Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
286         soundlatch_w(machine,0,data&0xff);
287         cpunum_set_input_line (machine, 1, INPUT_LINE_NMI, PULSE_LINE);
288288         break;
289289
290290      case 4: /* DM (DMA to buffer spriteram) */
291         buffer_spriteram16_w(0,0,0);
291         buffer_spriteram16_w(machine,0,0,0);
292292         break;
293293
294294      case 6: /* SECREQ (Interrupt & Data to i8751) */
r1877r1878
689689   /* basic machine hardware */
690690   MDRV_CPU_ADD(M68000, 10000000)   /* 10 MHz */
691691   MDRV_CPU_PROGRAM_MAP(karnov_readmem,karnov_writemem)
692   MDRV_CPU_VBLANK_INT(karnov_interrupt,1)
692   MDRV_CPU_VBLANK_INT("main", karnov_interrupt)
693693
694694   MDRV_CPU_ADD(M6502, 1500000)
695695   /* audio CPU */   /* Accurate */
r1877r1878
731731   /* basic machine hardware */
732732   MDRV_CPU_ADD(M68000, 10000000)   /* 10 MHz */
733733   MDRV_CPU_PROGRAM_MAP(karnov_readmem,karnov_writemem)
734   MDRV_CPU_VBLANK_INT(karnov_interrupt,1)
734   MDRV_CPU_VBLANK_INT("main", karnov_interrupt)
735735
736736   MDRV_CPU_ADD(M6502, 1500000)
737737   /* audio CPU */   /* Accurate */
src/mame/drivers/lwings.c
r1877r1878
4646***************************************************************************/
4747
4848#include "driver.h"
49#include "deprecat.h"
4950#include "lwings.h"
5051#include "sound/2203intf.h"
5152#include "sound/msm5205.h"
r1877r1878
8788   memory_set_bankptr(1,&RAM[0x10000 + bank*0x4000]);
8889
8990   /* bit 3 enables NMI */
90   interrupt_enable_w(0,data & 0x08);
91   interrupt_enable_w(machine,0,data & 0x08);
9192
9293   /* bits 6 and 7 are coin counters */
9394   coin_counter_w(1,data & 0x40);
r1877r1878
9697
9798static INTERRUPT_GEN( lwings_interrupt )
9899{
99   if (interrupt_enable_r(0))
100   if (interrupt_enable_r(machine, 0))
100101      cpunum_set_input_line_and_vector(machine, 0,0,HOLD_LINE,0xd7); /* RST 10h */
101102}
102103
r1877r1878
124125   else if( pc == 0x0445 )
125126   {
126127      avengers_soundstate = 0x80;
127      soundlatch_w( 0, data );
128      soundlatch_w( machine, 0, data );
128129   }
129130}
130131
r1877r1878
855856   /* basic machine hardware */
856857   MDRV_CPU_ADD(Z80, 6000000)        /* 4 MHz (?) */
857858   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
858   MDRV_CPU_VBLANK_INT(lwings_interrupt,1)
859   MDRV_CPU_VBLANK_INT("main", lwings_interrupt)
859860
860861   MDRV_CPU_ADD(Z80, 4000000)
861862   /* audio CPU */
862863   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
863   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)
864   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)
864865
865866   /* video hardware */
866867   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
r1877r1878
901902   /* basic machine hardware */
902903   MDRV_CPU_ADD(Z80, 6000000)        /* 4 MHz (?) */
903904   MDRV_CPU_PROGRAM_MAP(readmem,trojan_writemem)
904   MDRV_CPU_VBLANK_INT(lwings_interrupt,1)
905   MDRV_CPU_VBLANK_INT("main", lwings_interrupt)
905906
906907   MDRV_CPU_ADD(Z80, 4000000)
907908   /* audio CPU */
908909   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
909   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)
910   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)
910911
911912   MDRV_CPU_ADD(Z80, 4000000) // 3.579545 Mhz (?)
912913   /* audio CPU */   /* ? */
r1877r1878
957958   /* basic machine hardware */
958959   MDRV_CPU_ADD(Z80, 6000000) //AT: (avengers37b16gre)
959960   MDRV_CPU_PROGRAM_MAP(avengers_readmem,avengers_writemem)
960   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1) // RST 38h triggered by software
961   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse) // RST 38h triggered by software
961962
962963   MDRV_CPU_ADD(Z80, 4000000)
963964   /* audio CPU */
964965   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
965   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)
966   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)
966967
967968   MDRV_CPU_ADD(Z80, 4000000) // 3.579545 Mhz (?)
968969   /* audio CPU */   /* ? */
src/mame/drivers/xtheball.c
r1877r1878
4545 *
4646 *************************************/
4747
48static void xtheball_scanline_update(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params)
48static void xtheball_scanline_update(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params)
4949{
5050   UINT16 *srcbg = &vram_bg[(params->rowaddr << 8) & 0xff00];
5151   UINT32 *dest = BITMAP_ADDR32(bitmap, scanline, 0);
r1877r1878
148148         switch (offset)
149149         {
150150            case 7:
151               ticket_dispenser_w(0, data << 7);
151               ticket_dispenser_w(machine, 0, data << 7);
152152               break;
153153
154154            case 8:
r1877r1878
208208static READ16_HANDLER( port0_r )
209209{
210210   int result = readinputport(0);
211   result ^= ticket_dispenser_r(0) >> 3;
211   result ^= ticket_dispenser_r(machine,0) >> 3;
212212   return result;
213213}
214214
r1877r1878
222222static READ16_HANDLER( analogy_watchdog_r )
223223{
224224   /* doubles as a watchdog address */
225   watchdog_reset_w(0,0);
225   watchdog_reset_w(machine,0,0);
226226   return (readinputportbytag("ANALOGY") << 8) | 0x00ff;
227227}
228228
src/mame/drivers/maxaflex.c
r1877r1878
223223   output_set_digit_value(2, 0x00);
224224}
225225
226static INTERRUPT_GEN( supervisor_board_check_coin_input )
226static INPUT_CHANGED( coin_inserted )
227227{
228   if ( !readinputport(4) )
229   {
228   if (!newval)
230229      cpunum_set_input_line(machine, 1, M6805_IRQ_LINE, HOLD_LINE );
231   }
232230}
233231
234232int atari_input_disabled(void)
r1877r1878
308306
309307   /* Max-A-Flex specific ports */
310308   PORT_START   /* IN4 coin */
311   PORT_BIT(0x1, IP_ACTIVE_LOW, IPT_COIN1 )
309   PORT_BIT(0x1, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
312310
313311   PORT_START   /* IN5 DSW */
314312   PORT_DIPNAME(0xf, 0x9, "Coin/Time" )
r1877r1878
433431   /* basic machine hardware */
434432   MDRV_CPU_ADD_TAG("main", M6502, FREQ_17_EXACT)
435433   MDRV_CPU_PROGRAM_MAP(a600xl_mem, 0)
436   MDRV_CPU_VBLANK_INT(a800xl_interrupt, TOTAL_LINES_60HZ)
434   MDRV_CPU_VBLANK_INT_HACK(a800xl_interrupt, TOTAL_LINES_60HZ)
437435
438436   MDRV_CPU_ADD(M68705, 3579545)
439437   MDRV_CPU_PROGRAM_MAP(mcu_mem,0)
440   MDRV_CPU_PERIODIC_INT( supervisor_board_check_coin_input, 10 )
441438
442439   /* video hardware */
443440   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/punchout.c
r1877r1878
136136
137137static READ8_HANDLER( punchout_input_3_r )
138138{
139   int data = input_port_3_r(offset);
139   int data = input_port_3_r(machine, offset);
140140   /* bit 4 is busy pin level */
141141   if( VLM5030_BSY() ) data &= ~0x10;
142142   else data |= 0x10;
r1877r1878
305305}
306306
307307static READ8_HANDLER( spunchout_prot_0_r ) {
308   return spunchout_prot_r( 0 );
308   return spunchout_prot_r( machine, 0 );
309309}
310310
311311static WRITE8_HANDLER( spunchout_prot_0_w ) {
312   spunchout_prot_w( 0, data );
312   spunchout_prot_w( machine, 0, data );
313313}
314314
315315static READ8_HANDLER( spunchout_prot_1_r ) {
316   return spunchout_prot_r( 1 );
316   return spunchout_prot_r( machine, 1 );
317317}
318318
319319static WRITE8_HANDLER( spunchout_prot_1_w ) {
320   spunchout_prot_w( 1, data );
320   spunchout_prot_w( machine, 1, data );
321321}
322322
323323static READ8_HANDLER( spunchout_prot_2_r ) {
324   return spunchout_prot_r( 2 );
324   return spunchout_prot_r( machine, 2 );
325325}
326326
327327static WRITE8_HANDLER( spunchout_prot_2_w ) {
328   spunchout_prot_w( 2, data );
328   spunchout_prot_w( machine, 2, data );
329329}
330330
331331static READ8_HANDLER( spunchout_prot_3_r ) {
332   return spunchout_prot_r( 3 );
332   return spunchout_prot_r( machine, 3 );
333333}
334334
335335static WRITE8_HANDLER( spunchout_prot_3_w ) {
336   spunchout_prot_w( 3, data );
336   spunchout_prot_w( machine, 3, data );
337337}
338338
339339static READ8_HANDLER( spunchout_prot_5_r ) {
340   return spunchout_prot_r( 5 );
340   return spunchout_prot_r( machine, 5 );
341341}
342342
343343static WRITE8_HANDLER( spunchout_prot_5_w ) {
344   spunchout_prot_w( 5, data );
344   spunchout_prot_w( machine, 5, data );
345345}
346346
347347
348348static READ8_HANDLER( spunchout_prot_6_r ) {
349   return spunchout_prot_r( 6 );
349   return spunchout_prot_r( machine, 6 );
350350}
351351
352352static WRITE8_HANDLER( spunchout_prot_6_w ) {
353   spunchout_prot_w( 6, data );
353   spunchout_prot_w( machine, 6, data );
354354}
355355
356356static READ8_HANDLER( spunchout_prot_9_r ) {
357   return spunchout_prot_r( 9 );
357   return spunchout_prot_r( machine, 9 );
358358}
359359
360360static READ8_HANDLER( spunchout_prot_b_r ) {
361   return spunchout_prot_r( 11 );
361   return spunchout_prot_r( machine, 11 );
362362}
363363
364364static WRITE8_HANDLER( spunchout_prot_b_w ) {
365   spunchout_prot_w( 11, data );
365   spunchout_prot_w( machine, 11, data );
366366}
367367
368368static READ8_HANDLER( spunchout_prot_c_r ) {
369   return spunchout_prot_r( 12 );
369   return spunchout_prot_r( machine, 12 );
370370}
371371
372372static WRITE8_HANDLER( spunchout_prot_d_w ) {
373   spunchout_prot_w( 13, data );
373   spunchout_prot_w( machine, 13, data );
374374}
375375
376376static READ8_HANDLER( spunchout_prot_a_r ) {
377   return spunchout_prot_r( 10 );
377   return spunchout_prot_r( machine, 10 );
378378}
379379
380380static WRITE8_HANDLER( spunchout_prot_a_w ) {
381   spunchout_prot_w( 10, data );
381   spunchout_prot_w( machine, 10, data );
382382}
383383
384384#if 0
385385static READ8_HANDLER( spunchout_prot_f_r ) {
386   return spunchout_prot_r( 15 );
386   return spunchout_prot_r( machine, 15 );
387387}
388388#endif
389389
390390static WRITE8_HANDLER( spunchout_prot_f_w ) {
391   spunchout_prot_w( 15, data );
391   spunchout_prot_w( machine, 15, data );
392392}
393393
394394
r1877r1878
787787   MDRV_CPU_ADD_TAG("main", Z80, 8000000/2)   /* 4 MHz */
788788   MDRV_CPU_PROGRAM_MAP(punchout_map,0)
789789   MDRV_CPU_IO_MAP(readport,writeport)
790   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
790   MDRV_CPU_VBLANK_INT("top", nmi_line_pulse)
791791
792792   MDRV_CPU_ADD(N2A03, N2A03_DEFAULTCLOCK)
793793   /* audio CPU */
794794   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
795   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
795   MDRV_CPU_VBLANK_INT("top", nmi_line_pulse)
796796
797797   MDRV_NVRAM_HANDLER(generic_0fill)
798798
src/mame/drivers/vegas.c
r1877r1878
484484{
485485   offs_t         start;
486486   offs_t         end;
487   read32_handler   read;
488   write32_handler   write;
487   read32_machine_func   read;
488   write32_machine_func   write;
489489   const char *   rdname;
490490   const char *   wrname;
491491} dynamic[MAX_DYNAMIC_ADDRESSES];
r1877r1878
10861086      case NREG_BAR7:
10871087      case NREG_BAR8:
10881088      case NREG_BARB:
1089         result = pci_bridge_r(offset & 0x3f, mem_mask);
1089         result = pci_bridge_r(machine, offset & 0x3f, mem_mask);
10901090         break;
10911091
10921092   }
r1877r1878
12351235      case NREG_BAR7:
12361236      case NREG_BAR8:
12371237      case NREG_BARB:
1238         pci_bridge_w(offset & 0x3f, data, mem_mask);
1238         pci_bridge_w(machine, offset & 0x3f, data, mem_mask);
12391239         break;
12401240
12411241      case NREG_DCS2:
r1877r1878
14821482
14831483static READ32_HANDLER( ide_main_r )
14841484{
1485   return ide_controller32_0_r(0x1f0/4 + offset, mem_mask);
1485   return ide_controller32_0_r(machine, 0x1f0/4 + offset, mem_mask);
14861486}
14871487
14881488
14891489static WRITE32_HANDLER( ide_main_w )
14901490{
1491   ide_controller32_0_w(0x1f0/4 + offset, data, mem_mask);
1491   ide_controller32_0_w(machine, 0x1f0/4 + offset, data, mem_mask);
14921492}
14931493
14941494
14951495static READ32_HANDLER( ide_alt_r )
14961496{
1497   return ide_controller32_0_r(0x3f4/4 + offset, mem_mask);
1497   return ide_controller32_0_r(machine, 0x3f4/4 + offset, mem_mask);
14981498}
14991499
15001500
15011501static WRITE32_HANDLER( ide_alt_w )
15021502{
1503   ide_controller32_0_w(0x3f4/4 + offset, data, mem_mask);
1503   ide_controller32_0_w(machine, 0x3f4/4 + offset, data, mem_mask);
15041504}
15051505
15061506
r1877r1878
15081508{
15091509   UINT32 result = 0;
15101510   if ((mem_mask & 0x0000ffff) != 0x0000ffff)
1511      result |= smc91c94_r(offset * 2 + 0, mem_mask);
1511      result |= smc91c94_r(machine, offset * 2 + 0, mem_mask);
15121512   if ((mem_mask & 0xffff0000) != 0xffff0000)
1513      result |= smc91c94_r(offset * 2 + 1, mem_mask >> 16) << 16;
1513      result |= smc91c94_r(machine, offset * 2 + 1, mem_mask >> 16) << 16;
15141514   return result;
15151515}
15161516
r1877r1878
15181518static WRITE32_HANDLER( ethernet_w )
15191519{
15201520   if ((mem_mask & 0x0000ffff) != 0x0000ffff)
1521      smc91c94_w(offset * 2 + 0, data, mem_mask);
1521      smc91c94_w(machine, offset * 2 + 0, data, mem_mask);
15221522   if ((mem_mask & 0xffff0000) != 0xffff0000)
1523      smc91c94_w(offset * 2 + 1, data >> 16, mem_mask >> 16);
1523      smc91c94_w(machine, offset * 2 + 1, data >> 16, mem_mask >> 16);
15241524}
15251525
15261526
r1877r1878
15391539
15401540#define add_dynamic_address(s,e,r,w)   _add_dynamic_address(s,e,r,w,#r,#w)
15411541
1542INLINE void _add_dynamic_address(offs_t start, offs_t end, read32_handler read, write32_handler write, const char *rdname, const char *wrname)
1542INLINE void _add_dynamic_address(offs_t start, offs_t end, read32_machine_func read, write32_machine_func write, const char *rdname, const char *wrname)
15431543{
15441544   dynamic[dynamic_count].start = start;
15451545   dynamic[dynamic_count].end = end;
src/mame/drivers/kopunch.c
r1877r1878
1818{
1919   if (cpu_getiloops() == 0)
2020   {
21      if (~input_port_1_r(0) & 0x80)   /* coin 1 */
21      if (~input_port_1_r(machine,0) & 0x80)   /* coin 1 */
2222      {
2323         cpunum_set_input_line_and_vector(machine, 0,0,HOLD_LINE,0xf7);   /* RST 30h */
2424         return;
2525      }
26      else if (~input_port_1_r(0) & 0x08)   /* coin 2 */
26      else if (~input_port_1_r(machine,0) & 0x08)   /* coin 2 */
2727      {
2828         cpunum_set_input_line_and_vector(machine, 0,0,HOLD_LINE,0xef);   /* RST 28h */
2929         return;
r1877r1878
3737{
3838   /* port 31 + low 3 bits of port 32 contain the punch strength */
3939   if (offset == 0)
40      return mame_rand(Machine);
40      return mame_rand(machine);
4141   else
42      return (mame_rand(Machine) & 0x07) | input_port_1_r(0);
42      return (mame_rand(machine) & 0x07) | input_port_1_r(machine,0);
4343}
4444
4545static WRITE8_HANDLER( kopunch_lamp_w )
r1877r1878
168168   MDRV_CPU_ADD(8080, 4000000)   /* 4 MHz ???? appears to use 8080 instructions, not z80 */
169169   MDRV_CPU_PROGRAM_MAP(kopunch_map,0)
170170   MDRV_CPU_IO_MAP(kopunch_io_map,0)
171   MDRV_CPU_VBLANK_INT(kopunch_interrupt,4)   /* ??? */
171   MDRV_CPU_VBLANK_INT_HACK(kopunch_interrupt,4)   /* ??? */
172172
173173   /* video hardware */
174174   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/tecmo.c
r1877r1878
7979
8080static WRITE8_HANDLER( tecmo_sound_command_w )
8181{
82   soundlatch_w(offset,data);
83   cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
82   soundlatch_w(machine,offset,data);
83   cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
8484}
8585
8686static int adpcm_pos,adpcm_end;
r1877r1878
568568   /* basic machine hardware */
569569   MDRV_CPU_ADD_TAG("main", Z80, 4000000)
570570   MDRV_CPU_PROGRAM_MAP(readmem,rygar_writemem)
571   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
571   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
572572
573573   MDRV_CPU_ADD_TAG("sound", Z80, 4000000)
574574   /* audio CPU */
src/mame/drivers/news.c
r1877r1878
123123   /* basic machine hardware */
124124   MDRV_CPU_ADD(Z80,8000000)       /* ? MHz */
125125   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
126   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
126   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
127127
128128   /* video hardware */
129129   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/galpanic.c
r1877r1878
212212   for(i = 0; i < 8; i++)
213213   {
214214      // or offset + i * 0x2000 ?
215      galpanic_bgvideoram_w(offset * 8 + i, data, mem_mask);
215      galpanic_bgvideoram_w(machine, offset * 8 + i, data, mem_mask);
216216   }
217217}
218218
r1877r1878
930930static MACHINE_DRIVER_START( galpanic )
931931
932932   /* basic machine hardware */
933   MDRV_CPU_ADD_TAG("main", M68000, 8000000)
933   MDRV_CPU_ADD_TAG("main", M68000, XTAL_12MHz) /* verified on pcb */
934934   MDRV_CPU_PROGRAM_MAP(galpanic,0)
935   MDRV_CPU_VBLANK_INT(galpanic_interrupt,2)
935   MDRV_CPU_VBLANK_INT_HACK(galpanic_interrupt,2)
936936
937937   /* video hardware */
938938   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
953953   /* sound hardware */
954954   MDRV_SPEAKER_STANDARD_MONO("mono")
955955
956   MDRV_SOUND_ADD_TAG("oki", OKIM6295, 1584000)
957   MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) // clock frequency & pin 7 not verified
956   MDRV_SOUND_ADD_TAG("oki", OKIM6295, XTAL_12MHz/6) /* verified on pcb */
957   MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low) /* verified on pcb */
958958   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
959959MACHINE_DRIVER_END
960960
r1877r1878
986986   MDRV_IMPORT_FROM(comad)
987987   MDRV_CPU_REPLACE("main", M68000, 12000000)   /* ? */
988988   MDRV_CPU_PROGRAM_MAP(supmodel_readmem,supmodel_writemem)
989   MDRV_CPU_VBLANK_INT(galpanic_interrupt,2)
989   MDRV_CPU_VBLANK_INT_HACK(galpanic_interrupt,2)
990990
991991   /* video hardware */
992992   MDRV_VIDEO_UPDATE(comad)
r1877r1878
10171017   MDRV_IMPORT_FROM(comad)
10181018   MDRV_CPU_REPLACE("main", M68000, 12000000)   /* ? */
10191019   MDRV_CPU_PROGRAM_MAP(galhustl_readmem,galhustl_writemem)
1020   MDRV_CPU_VBLANK_INT(galhustl_interrupt,3)
1020   MDRV_CPU_VBLANK_INT_HACK(galhustl_interrupt,3)
10211021
10221022   /* video hardware */
10231023   MDRV_VIDEO_UPDATE(comad)
r1877r1878
10341034   MDRV_IMPORT_FROM(comad)
10351035   MDRV_CPU_REPLACE("main", M68000, 12000000)   /* ? */
10361036   MDRV_CPU_PROGRAM_MAP(zipzap_readmem,zipzap_writemem)
1037   MDRV_CPU_VBLANK_INT(galhustl_interrupt,3)
1037   MDRV_CPU_VBLANK_INT_HACK(galhustl_interrupt,3)
10381038
10391039   /* video hardware */
10401040   MDRV_VIDEO_UPDATE(comad)
src/mame/drivers/finalizr.c
r1877r1878
407407   /* basic machine hardware */
408408   MDRV_CPU_ADD(M6809,18432000/6)   /* ??? */
409409   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
410   MDRV_CPU_VBLANK_INT(finalizr_interrupt,16)   /* 1 IRQ + 8 NMI (generated by a custom IC) */
410   MDRV_CPU_VBLANK_INT_HACK(finalizr_interrupt,16)   /* 1 IRQ + 8 NMI (generated by a custom IC) */
411411
412412   MDRV_CPU_ADD(I8039,18432000/2)   /* 9.216MHz clkin ?? */
413413   /* audio CPU */   /* DAC */
src/mame/drivers/segaybd.c
r1877r1878
210210
211211static TIMER_CALLBACK( delayed_sound_data_w )
212212{
213   soundlatch_w(0, param);
213   soundlatch_w(machine, 0, param);
214214   cpunum_set_input_line(machine, 3, INPUT_LINE_NMI, ASSERT_LINE);
215215}
216216
r1877r1878
224224
225225static READ8_HANDLER( sound_data_r )
226226{
227   cpunum_set_input_line(Machine, 3, INPUT_LINE_NMI, CLEAR_LINE);
228   return soundlatch_r(offset);
227   cpunum_set_input_line(machine, 3, INPUT_LINE_NMI, CLEAR_LINE);
228   return soundlatch_r(machine,offset);
229229}
230230
231231
r1877r1878
314314                D1-D0 = ADC0-1
315315            */
316316         segaic16_set_display_enable(data & 0x80);
317         if (((old ^ data) & 0x20) && !(data & 0x20)) watchdog_reset_w(0,0);
317         if (((old ^ data) & 0x20) && !(data & 0x20)) watchdog_reset_w(machine,0,0);
318318         cpunum_set_input_line(Machine, 3, INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
319319         cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, (data & 0x08) ? ASSERT_LINE : CLEAR_LINE);
320320         cpunum_set_input_line(Machine, 2, INPUT_LINE_RESET, (data & 0x04) ? ASSERT_LINE : CLEAR_LINE);
src/mame/drivers/shuuz.c
r1877r1878
102102
103103static READ16_HANDLER( adpcm_r )
104104{
105   return OKIM6295_status_0_r(offset) | 0xff00;
105   return OKIM6295_status_0_r(machine, offset) | 0xff00;
106106}
107107
108108
109109static WRITE16_HANDLER( adpcm_w )
110110{
111111   if (ACCESSING_LSB)
112      OKIM6295_data_0_w(offset, data & 0xff);
112      OKIM6295_data_0_w(machine, offset, data & 0xff);
113113}
114114
115115
src/mame/drivers/cclimber.c
r1877r1878
205205
206206static WRITE8_HANDLER( swimmer_sh_soundlatch_w )
207207{
208   soundlatch_w(offset,data);
209   cpunum_set_input_line_and_vector(Machine, 1,0,HOLD_LINE,0xff);
208   soundlatch_w(machine,offset,data);
209   cpunum_set_input_line_and_vector(machine, 1,0,HOLD_LINE,0xff);
210210}
211211
212212
r1877r1878
10701070   MDRV_CPU_ADD_TAG("main", Z80, MASTER_CLOCK/3/2)   /* 3.072 MHz */
10711071   MDRV_CPU_PROGRAM_MAP(cclimber_map,0)
10721072   MDRV_CPU_IO_MAP(cclimber_portmap,0)
1073   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
1073   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
10741074
10751075   MDRV_MACHINE_RESET(cclimber)
10761076
r1877r1878
11731173   /* basic machine hardware */
11741174   MDRV_CPU_ADD(Z80, 3072000)   /* 3.072 MHz */
11751175   MDRV_CPU_PROGRAM_MAP(swimmer_map,0)
1176   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
1176   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
11771177
11781178   MDRV_CPU_ADD(Z80,4000000/2)
11791179   MDRV_CPU_PROGRAM_MAP(swimmer_audio_map,0)
src/mame/drivers/xorworld.c
r1877r1878
208208   // basic machine hardware
209209   MDRV_CPU_ADD(M68000, 10000000)   // 10 MHz
210210   MDRV_CPU_PROGRAM_MAP(xorworld_map, 0)
211   MDRV_CPU_VBLANK_INT(xorworld_interrupt, 4)   // 1 IRQ2 + 1 IRQ4 + 1 IRQ6
211   MDRV_CPU_VBLANK_INT_HACK(xorworld_interrupt, 4)   // 1 IRQ2 + 1 IRQ4 + 1 IRQ6
212212
213213   MDRV_INTERLEAVE(1)
214214
src/mame/drivers/speedspn.c
r1877r1878
103103
104104static WRITE8_HANDLER(speedspn_sound_w)
105105{
106   soundlatch_w(1,data);
107   cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
106   soundlatch_w(machine,1,data);
107   cpunum_set_input_line(machine, 1,0,HOLD_LINE);
108108}
109109
110110static WRITE8_HANDLER( oki_banking_w )
r1877r1878
306306   MDRV_CPU_ADD_TAG("main",Z80,6000000)       /* 6 MHz */
307307   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
308308   MDRV_CPU_IO_MAP(readport, writeport)
309   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
309   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
310310
311311   MDRV_CPU_ADD(Z80,6000000)       /* 6 MHz */
312312   /* audio CPU */
src/mame/drivers/enigma2.c
r1877r1878
566566   MDRV_CPU_PROGRAM_MAP(engima2_main_cpu_map,0)
567567
568568   MDRV_CPU_ADD(Z80, 2500000)
569   MDRV_CPU_VBLANK_INT(irq0_line_hold,8)
569   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,8)
570570   MDRV_CPU_PROGRAM_MAP(engima2_audio_cpu_map,0)
571571
572572   MDRV_MACHINE_START(enigma2)
r1877r1878
596596   MDRV_CPU_IO_MAP(engima2a_main_cpu_io_map,0)
597597
598598   MDRV_CPU_ADD(Z80, 2500000)
599   MDRV_CPU_VBLANK_INT(irq0_line_hold,8)
599   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,8)
600600   MDRV_CPU_PROGRAM_MAP(engima2_audio_cpu_map,0)
601601
602602   MDRV_MACHINE_START(enigma2)
src/mame/drivers/cowrace.c
r1877r1878
164164   MDRV_CPU_ADD(Z80, 4000000)
165165   MDRV_CPU_PROGRAM_MAP(mem_map_cowrace,0)
166166   MDRV_CPU_IO_MAP(io_map_cowrace,0)
167   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
167   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
168168
169169   MDRV_CPU_ADD(Z80, 4000000)
170170   MDRV_CPU_PROGRAM_MAP(mem_map_sound_cowrace,0)
171171   MDRV_CPU_IO_MAP(io_map_sound_cowrace,0)
172   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   // NMI by main CPU
172   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   // NMI by main CPU
173173
174174   /* video hardware */
175175   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/segaorun.c
r1877r1878
4343static UINT8 irq2_state;
4444static UINT8 vblank_irq_state;
4545
46static read16_handler custom_io_r;
47static write16_handler custom_io_w;
46static read16_machine_func custom_io_r;
47static write16_machine_func custom_io_w;
4848
4949static const UINT8 *custom_map;
5050
r1877r1878
122122
123123static TIMER_CALLBACK( delayed_sound_data_w )
124124{
125   soundlatch_w(0, param);
125   soundlatch_w(machine, 0, param);
126126   cpunum_set_input_line(machine, 2, INPUT_LINE_NMI, ASSERT_LINE);
127127}
128128
r1877r1878
135135
136136static READ8_HANDLER( sound_data_r )
137137{
138   cpunum_set_input_line(Machine, 2, INPUT_LINE_NMI, CLEAR_LINE);
139   return soundlatch_r(offset);
138   cpunum_set_input_line(machine, 2, INPUT_LINE_NMI, CLEAR_LINE);
139   return soundlatch_r(machine,offset);
140140}
141141
142142
r1877r1878
348348    */
349349   segaic16_set_display_enable(data & 0x20);
350350   adc_select = (data >> 2) & 7;
351   cpunum_set_input_line(Machine, 2, INPUT_LINE_RESET, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE);
351   cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE);
352352}
353353
354354
r1877r1878
362362static READ16_HANDLER( misc_io_r )
363363{
364364   if (custom_io_r)
365      return custom_io_r(offset, mem_mask);
365      return custom_io_r(machine, offset, mem_mask);
366366   logerror("%06X:misc_io_r - unknown read access to address %04X\n", activecpu_get_pc(), offset * 2);
367   return segaic16_open_bus_r(0,0);
367   return segaic16_open_bus_r(machine,0,0);
368368}
369369
370370
r1877r1878
372372{
373373   if (custom_io_w)
374374   {
375      custom_io_w(offset, data, mem_mask);
375      custom_io_w(machine, offset, data, mem_mask);
376376      return;
377377   }
378378   logerror("%06X:misc_io_w - unknown write access to address %04X = %04X & %04X\n", activecpu_get_pc(), offset * 2, data, mem_mask ^ 0xffff);
r1877r1878
385385   switch (offset & 0x70/2)
386386   {
387387      case 0x00/2:
388         return ppi8255_0_r(offset & 3);
388         return ppi8255_0_r(machine, offset & 3);
389389
390390      case 0x10/2:
391391         return readinputport(offset & 3);
r1877r1878
397397      }
398398
399399      case 0x60/2:
400         return watchdog_reset_r(0);
400         return watchdog_reset_r(machine,0);
401401   }
402402
403403   logerror("%06X:outrun_custom_io_r - unknown read access to address %04X\n", activecpu_get_pc(), offset * 2);
404   return segaic16_open_bus_r(0,0);
404   return segaic16_open_bus_r(machine,0,0);
405405}
406406
407407
r1877r1878
412412   {
413413      case 0x00/2:
414414         if (ACCESSING_LSB)
415            ppi8255_0_w(offset & 3, data);
415            ppi8255_0_w(machine, offset & 3, data);
416416         return;
417417
418418      case 0x20/2:
r1877r1878
431431         return;
432432
433433      case 0x60/2:
434         watchdog_reset_w(0,0);
434         watchdog_reset_w(machine,0,0);
435435         return;
436436
437437      case 0x70/2:
438         segaic16_sprites_draw_0_w(offset, data, mem_mask);
438         segaic16_sprites_draw_0_w(machine, offset, data, mem_mask);
439439         return;
440440   }
441441   logerror("%06X:misc_io_w - unknown write access to address %04X = %04X & %04X\n", activecpu_get_pc(), offset * 2, data, mem_mask ^ 0xffff);
r1877r1878
460460      }
461461   }
462462   logerror("%06X:misc_io_r - unknown read access to address %04X\n", activecpu_get_pc(), offset * 2);
463   return segaic16_open_bus_r(0,0);
463   return segaic16_open_bus_r(machine,0,0);
464464}
465465
466466
r1877r1878
482482         /* Output port:
483483                D0: Sound section reset (1= normal operation, 0= reset)
484484            */
485         cpunum_set_input_line(Machine, 2, INPUT_LINE_RESET, (data & 1) ? CLEAR_LINE : ASSERT_LINE);
485         cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, (data & 1) ? CLEAR_LINE : ASSERT_LINE);
486486         return;
487487
488488      case 0x3000/2:
489         watchdog_reset_w(0,0);
489         watchdog_reset_w(machine,0,0);
490490         return;
491491
492492      case 0x3020/2:
src/mame/drivers/koikoi.c
r1877r1878
7373   if(inputcnt<0){      return 0;   }
7474   if(!inputcnt)
7575   {
76      int key=input_port_2_word_r(0,0);
76      int key=input_port_2_word_r(machine,0,0);
7777      int keyval=0; //we must return 0 (0x2 in 2nd read) to clear 4 bit at $6600 and allow next read
7878
7979      if(key)
r1877r1878
104104{
105105   if(!offset)
106106   {
107         return input_port_1_r(0)^ioram[4]; //coin
107         return input_port_1_r(machine,0)^ioram[4]; //coin
108108   }
109109   return 0;
110110}
r1877r1878
252252   MDRV_CPU_ADD(Z80,KOIKOI_CRYSTAL/4)   /* ?? */
253253   MDRV_CPU_PROGRAM_MAP(readmem, 0)
254254   MDRV_CPU_IO_MAP(readport, 0)
255   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
255   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
256256
257257   /* video hardware */
258258   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/hexa.c
r1877r1878
134134   /* basic machine hardware */
135135   MDRV_CPU_ADD(Z80, 4000000)      /* 4 MHz ??????? */
136136   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
137   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
137   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
138138
139139   /* video hardware */
140140   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/gticlub.c
r1877r1878
5454
5555int K001604_vh_start(running_machine *machine, int chip);
5656void K001604_tile_update(int chip);
57void K001604_draw_front_layer(int chip, mame_bitmap *bitmap, const rectangle *cliprect);
58void K001604_draw_back_layer(int chip, mame_bitmap *bitmap, const rectangle *cliprect);
57void K001604_draw_front_layer(int chip, bitmap_t *bitmap, const rectangle *cliprect);
58void K001604_draw_back_layer(int chip, bitmap_t *bitmap, const rectangle *cliprect);
5959READ32_HANDLER(K001604_tile_r);
6060READ32_HANDLER(K001604_char_r);
6161WRITE32_HANDLER(K001604_tile_w);
r1877r1878
755755   MDRV_CPU_ADD(PPC403, 64000000/2)   /* PowerPC 403GA 32MHz */
756756   MDRV_CPU_CONFIG(gticlub_ppc_cfg)
757757   MDRV_CPU_PROGRAM_MAP(gticlub_map, 0)
758   MDRV_CPU_VBLANK_INT(gticlub_vblank, 1)
758   MDRV_CPU_VBLANK_INT("main", gticlub_vblank)
759759
760760   MDRV_CPU_ADD(M68000, 64000000/4)   /* 16MHz */
761761   MDRV_CPU_PROGRAM_MAP(sound_memmap, 0)
src/mame/drivers/cloak.c
r1877r1878
337337   /* basic machine hardware */
338338   MDRV_CPU_ADD(M6502,1000000)      /* 1 MHz ???? */
339339   MDRV_CPU_PROGRAM_MAP(master_map,0)
340   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)
340   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)
341341
342342   MDRV_CPU_ADD(M6502,1250000)      /* 1.25 MHz ???? */
343343   MDRV_CPU_PROGRAM_MAP(slave_map,0)
344   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
344   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
345345
346346   MDRV_INTERLEAVE(5)
347347
src/mame/drivers/mazerbla.c
r1877r1878
100100}
101101
102102
103static mame_bitmap * tmpbitmaps[4];
103static bitmap_t * tmpbitmaps[4];
104104
105105static VIDEO_START( mazerbla )
106106{
r1877r1878
15021502and cleared on ANY port access.
15031503but handled differently for now
15041504*/
1505   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1505   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
15061506
15071507   /* synchronization forced on the fly */
15081508
r1877r1878
15441544and cleared on ANY port access.
15451545but handled differently for now
15461546*/
1547   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1547   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
15481548
15491549   MDRV_MACHINE_RESET(greatgun)
15501550
src/mame/drivers/foodf.c
r1877r1878
180180      /* bit 1 = UPDATE */
181181
182182      if (!(data & 0x04))
183         atarigen_scanline_int_ack_w(0,0,0);
183         atarigen_scanline_int_ack_w(machine,0,0,0);
184184      if (!(data & 0x08))
185         atarigen_video_int_ack_w(0,0,0);
185         atarigen_video_int_ack_w(machine,0,0,0);
186186
187187      output_set_led_value(0, (data >> 4) & 1);
188188      output_set_led_value(1, (data >> 5) & 1);
r1877r1878
219219 *
220220 *************************************/
221221
222static READ16_HANDLER( pokey1_word_r ) { return pokey1_r(offset); }
223static READ16_HANDLER( pokey2_word_r ) { return pokey2_r(offset); }
224static READ16_HANDLER( pokey3_word_r ) { return pokey3_r(offset); }
222static READ16_HANDLER( pokey1_word_r ) { return pokey1_r(machine, offset); }
223static READ16_HANDLER( pokey2_word_r ) { return pokey2_r(machine, offset); }
224static READ16_HANDLER( pokey3_word_r ) { return pokey3_r(machine, offset); }
225225
226static WRITE16_HANDLER( pokey1_word_w ) { if (ACCESSING_LSB) pokey1_w(offset, data & 0xff); }
227static WRITE16_HANDLER( pokey2_word_w ) { if (ACCESSING_LSB) pokey2_w(offset, data & 0xff); }
228static WRITE16_HANDLER( pokey3_word_w ) { if (ACCESSING_LSB) pokey3_w(offset, data & 0xff); }
226static WRITE16_HANDLER( pokey1_word_w ) { if (ACCESSING_LSB) pokey1_w(machine, offset, data & 0xff); }
227static WRITE16_HANDLER( pokey2_word_w ) { if (ACCESSING_LSB) pokey2_w(machine, offset, data & 0xff); }
228static WRITE16_HANDLER( pokey3_word_w ) { if (ACCESSING_LSB) pokey3_w(machine, offset, data & 0xff); }
229229
230230
231231
r1877r1878
374374   /* basic machine hardware */
375375   MDRV_CPU_ADD(M68000, MASTER_CLOCK/2)
376376   MDRV_CPU_PROGRAM_MAP(main_map,0)
377   MDRV_CPU_VBLANK_INT(atarigen_video_int_gen,1)
377   MDRV_CPU_VBLANK_INT("main", atarigen_video_int_gen)
378378
379379   MDRV_MACHINE_START(foodf)
380380   MDRV_MACHINE_RESET(foodf)
src/mame/drivers/namcona1.c
r1877r1878
813813} /* namcona1_vreg_r */
814814
815815static int
816transfer_dword( UINT32 dest, UINT32 source )
816transfer_dword( running_machine *machine, UINT32 dest, UINT32 source )
817817{
818818   UINT16 data;
819819
r1877r1878
836836   }
837837   if( dest>=0xf00000 && dest<=0xf02000 )
838838   {
839      namcona1_paletteram_w( (dest-0xf00000)/2, data, 0x0000 );
839      namcona1_paletteram_w( machine, (dest-0xf00000)/2, data, 0x0000 );
840840   }
841841   else if( dest>=0xf40000 && dest<=0xf80000 )
842842   {
843      namcona1_gfxram_w( (dest-0xf40000)/2, data, 0x0000 );
843      namcona1_gfxram_w( machine, (dest-0xf40000)/2, data, 0x0000 );
844844   }
845845   else if( dest>=0xff0000 && dest<0xff8000 )
846846   {
847      namcona1_videoram_w( (dest-0xff0000)/2, data, 0x0000 );
847      namcona1_videoram_w( machine, (dest-0xff0000)/2, data, 0x0000 );
848848   }
849849   else if( dest>=0xff8000 && dest<=0xffdfff )
850850   {
r1877r1878
957957$efff80:    0048 0177 0020 0100 0000 00fd 0000 GFXE
958958*/
959959
960static void namcona1_blit( void )
960static void namcona1_blit( running_machine *machine )
961961{
962962   int src0 = namcona1_vreg[0x0];
963963   int src1 = namcona1_vreg[0x1];
r1877r1878
10091009
10101010   while( num_bytes>0 )
10111011   {
1012      if( transfer_dword(
1012      if( transfer_dword(machine,
10131013         dst_baseaddr + dest_offset,
10141014         src_baseaddr + source_offset ) )
10151015      {
r1877r1878
10411041   switch( offset )
10421042   {
10431043   case 0x18/2:
1044      namcona1_blit();
1044      namcona1_blit(machine);
10451045      /* see also 0x1e */
10461046      break;
10471047
r1877r1878
11541154
11551155static READ16_HANDLER(snd_r)
11561156{
1157   return C140_r(offset*2+1) | C140_r(offset*2)<<8;
1157   return C140_r(machine,offset*2+1) | C140_r(machine,offset*2)<<8;
11581158}
11591159
11601160static WRITE16_HANDLER(snd_w)
11611161{
11621162   if (ACCESSING_LSB16)
11631163   {
1164      C140_w((offset*2)+1, data);
1164      C140_w(machine,(offset*2)+1, data);
11651165   }
11661166
11671167   if (ACCESSING_MSB16)
11681168   {
1169      C140_w((offset*2), data>>8);
1169      C140_w(machine,(offset*2), data>>8);
11701170   }
11711171}
11721172
r1877r1878
13461346   /* basic machine hardware */
13471347   MDRV_CPU_ADD(M68000, 50113000/4)
13481348   MDRV_CPU_PROGRAM_MAP(namcona1_mcu_readmem,namcona1_mcu_writemem)
1349   MDRV_CPU_VBLANK_INT(namcona1_interrupt,5)
1349   MDRV_CPU_VBLANK_INT_HACK(namcona1_interrupt,5)
13501350
13511351   MDRV_CPU_ADD(M37710, 50113000/4)
13521352   MDRV_CPU_PROGRAM_MAP(namcona1_mcu_map, 0)
13531353   MDRV_CPU_IO_MAP( namcona1_mcu_io_map, 0 )
1354   MDRV_CPU_VBLANK_INT(mcu_interrupt, 2)
1354   MDRV_CPU_VBLANK_INT_HACK(mcu_interrupt, 2)
13551355
13561356   MDRV_NVRAM_HANDLER(namcosna1)
13571357   MDRV_MACHINE_START(namcona1)
r1877r1878
14451445   /* basic machine hardware */
14461446   MDRV_CPU_ADD(M68000, 50113000/4)
14471447   MDRV_CPU_PROGRAM_MAP(namcona2_readmem,namcona2_writemem)
1448   MDRV_CPU_VBLANK_INT(namcona1_interrupt,5)
1448   MDRV_CPU_VBLANK_INT_HACK(namcona1_interrupt,5)
14491449
14501450   MDRV_NVRAM_HANDLER(namcosna1)
14511451   MDRV_INTERLEAVE(40)
src/mame/drivers/bsktball.c
r1877r1878
2222***************************************************************************/
2323
2424#include "driver.h"
25#include "deprecat.h"
2526#include "bsktball.h"
2627#include "sound/discrete.h"
2728
r1877r1878
210211   /* basic machine hardware */
211212   MDRV_CPU_ADD(M6502,750000)
212213   MDRV_CPU_PROGRAM_MAP(main_map,0)
213   MDRV_CPU_VBLANK_INT(bsktball_interrupt,8)
214   MDRV_CPU_VBLANK_INT_HACK(bsktball_interrupt,8)
214215
215216   /* video hardware */
216217   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/armedf.c
r1877r1878
226226      int i;
227227      for (i = 0; i < 0x1000; i++)
228228      {
229         armedf_text_videoram_w(i, ' ', 0);
229         armedf_text_videoram_w(machine,i, ' ', 0);
230230      }
231231   }
232232}
r1877r1878
234234static WRITE16_HANDLER( sound_command_w )
235235{
236236   if (ACCESSING_LSB)
237      soundlatch_w(0,((data & 0x7f) << 1) | 1);
237      soundlatch_w(machine,0,((data & 0x7f) << 1) | 1);
238238}
239239
240240#ifdef UNUSED_FUNCTION
r1877r1878
446446
447447static READ8_HANDLER( soundlatch_clear_r )
448448{
449   soundlatch_clear_w(0,0);
449   soundlatch_clear_w(machine,0,0);
450450   return 0;
451451}
452452
r1877r1878
762762   /* basic machine hardware */
763763   MDRV_CPU_ADD(M68000, 8000000) /* 8 MHz?? */
764764   MDRV_CPU_PROGRAM_MAP(terraf_readmem,terraf_writemem)
765   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
765   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
766766
767767   MDRV_CPU_ADD(Z80, 3072000)
768768   /* audio CPU */   /* 3.072 MHz???? */
769769   MDRV_CPU_PROGRAM_MAP(soundreadmem,soundwritemem)
770770   MDRV_CPU_IO_MAP(readport,writeport)
771   MDRV_CPU_VBLANK_INT(irq0_line_hold,128)
771   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,128)
772772
773773   /* video hardware */
774774   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
r1877r1878
804804   /* basic machine hardware */
805805   MDRV_CPU_ADD(M68000, 8000000) /* 8 MHz?? */
806806   MDRV_CPU_PROGRAM_MAP(kodure_readmem,kodure_writemem)
807   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
807   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
808808
809809   MDRV_CPU_ADD(Z80, 3072000)
810810   /* audio CPU */   /* 3.072 MHz???? */
811811   MDRV_CPU_PROGRAM_MAP(soundreadmem,soundwritemem)
812812   MDRV_CPU_IO_MAP(readport,writeport)
813   MDRV_CPU_VBLANK_INT(irq0_line_hold,128)
813   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,128)
814814
815815   /* video hardware */
816816   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
r1877r1878
846846   /* basic machine hardware */
847847   MDRV_CPU_ADD(M68000, 8000000) /* 8 MHz?? */
848848   MDRV_CPU_PROGRAM_MAP(armedf_readmem,armedf_writemem)
849   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
849   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
850850
851851   MDRV_CPU_ADD(Z80, 3072000)
852852   /* audio CPU */   /* 3.072 MHz???? */
853853   MDRV_CPU_PROGRAM_MAP(soundreadmem,soundwritemem)
854854   MDRV_CPU_IO_MAP(readport,writeport)
855   MDRV_CPU_VBLANK_INT(irq0_line_hold,128)
855   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,128)
856856
857857   /* video hardware */
858858   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
r1877r1878
888888   /* basic machine hardware */
889889   MDRV_CPU_ADD(M68000, 8000000) /* 8 MHz?? */
890890   MDRV_CPU_PROGRAM_MAP(cclimbr2_readmem,cclimbr2_writemem)
891   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
891   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
892892
893893   MDRV_CPU_ADD(Z80, 3072000)
894894   /* audio CPU */   /* 3.072 MHz???? */
895895   MDRV_CPU_PROGRAM_MAP(cclimbr2_soundreadmem,cclimbr2_soundwritemem)
896896   MDRV_CPU_IO_MAP(readport,writeport)
897   MDRV_CPU_VBLANK_INT(irq0_line_hold,128)
897   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,128)
898898
899899   /* video hardware */
900900   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
r1877r1878
930930   /* basic machine hardware */
931931   MDRV_CPU_ADD(M68000, 8000000) /* 8 MHz?? */
932932   MDRV_CPU_PROGRAM_MAP(cclimbr2_readmem,legion_writemem)
933   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
933   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
934934
935935   MDRV_CPU_ADD(Z80, 3072000)
936936   /* audio CPU */   /* 3.072 MHz???? */
937937   MDRV_CPU_PROGRAM_MAP(cclimbr2_soundreadmem,cclimbr2_soundwritemem)
938938   MDRV_CPU_IO_MAP(readport,writeport)
939   MDRV_CPU_VBLANK_INT(irq0_line_hold,128)
939   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,128)
940940
941941   /* video hardware */
942942   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
r1877r1878
972972   /* basic machine hardware */
973973   MDRV_CPU_ADD(M68000, 8000000) /* 8 MHz?? */
974974   MDRV_CPU_PROGRAM_MAP(cclimbr2_readmem,legiono_writemem)
975   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
975   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
976976
977977   MDRV_CPU_ADD(Z80, 3072000)
978978   /* audio CPU */   /* 3.072 MHz???? */
979979   MDRV_CPU_PROGRAM_MAP(cclimbr2_soundreadmem,cclimbr2_soundwritemem)
980980   MDRV_CPU_IO_MAP(readport,writeport)
981   MDRV_CPU_VBLANK_INT(irq0_line_hold,128)
981   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,128)
982982
983983   /* video hardware */
984984   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
src/mame/drivers/acefruit.c
r1877r1878
549549   MDRV_CPU_PROGRAM_MAP(acefruit_map,0)
550550   MDRV_CPU_IO_MAP(acefruit_io,0)
551551   MDRV_GFXDECODE(acefruit)
552   MDRV_CPU_VBLANK_INT(acefruit_vblank,1)
552   MDRV_CPU_VBLANK_INT("main", acefruit_vblank)
553553
554554   /* video hardware */
555555   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/dkong.c
r1877r1878
249249    Jul 27 99 Chad Hendrickson
250250    * Added cocktail mode flipscreen
251251
252Donkey Kong Junior Notes
253========================
254
255    DJR-03  Donkey Kong Modification Kits                 02-23-83
256    --------------------------------------------------------------
257    Nintendo Service Department Bulletin # DJR-03         02-23-83
258    GAME: Donkey Kong Junior
259    SUBJECT: Play Time
260
261    It has come to our attention that play time on Donkey Kong
262    Junior is, in some cases, excessive, while in other cases
263    there is concern over the ability of players to learn the
264    game and thereby retain an interest in playing.
265
266    We are making available, through our Nintendo Distributors,
267    two EPROM change kits, designated DJR1-E and DJR1-P.
268
269    The E kit consists of four (4) chips and is an easier version
270    of the program.  it presents the board sequence in a way which
271    familiarizes the players with the game faster.  The board
272    order is vines, springboard, Mario's hideout and keys.
273
274    The P kit is a more difficult version consisting of two chips.
275    The order remains the same while more and faster
276    obstacles (snapjaws, nitpickers, etc.) are presented.
277    --------------------------------------------------------------
278
279    E-Kit - roms
280    ------------------------------------------------
281    Filename    Label          Type   Loc/PCB  CSum
282    ----------- -------------- ------ -------  ---- --
283    2732.5Ae    DJR1-C-5A e    2732   5A(CPU)  68E9
284    2764.5Be    DJR1-C-5B e    2764   5B(CPU)  B0CF
285    2764.5Ce    DJR1-C-5C e    2764   5C(CPU)  FC64
286    2764.5Ee    DJR1-C-5E e    2764   5E(CPU)  7CC6
287    ------------------------------------------------
288
289    P-Kit roms (Still looking for these, suffix is
290    more than likely P. :)
291    ------------------------------------------------
292    Filename    Label          Type   Loc/PCB  CSum
293    ----------- -------------- ------ -------  ---- --
294    empty       ---------      ----   5A(CPU)  ----
295    2764.5Bp    DJR1-C-5B p    2764   5B(CPU)  1B58
296    2764.5Cp    DJR1-C-5C p    2764   5C(CPU)  F4FE
297    ------------------------------------------------
298
252299***************************************************************************/
253300
254301#include "driver.h"
255#include "deprecat.h"
256302#include "cpu/s2650/s2650.h"
257303#include "cpu/m6502/m6502.h"
258304#include "includes/dkong.h"
259305#include "machine/8257dma.h"
260306#include "machine/z80dma.h"
261307
308#include "deprecat.h"
309
262310/*************************************
263311 *
264312 *  Defines
r1877r1878
278326static void hb_dma_write_byte(int channel, offs_t offset, UINT8 data);
279327static UINT8 dk_dma_read_byte(int channel, offs_t offset);
280328static void dk_dma_write_byte(int channel, offs_t offset, UINT8 data);
281static UINT8 dk3_dma_read_byte(offs_t offset);
282static void dk3_dma_write_byte(offs_t offset, UINT8 data);
329static Z80DMA_READ(dk3_dma_read_byte);
330static Z80DMA_WRITE(dk3_dma_write_byte);
283331static UINT8 p8257_ctl_r(void);
284332static void p8257_ctl_w(UINT8 data);
285333
r1877r1878
289337 *
290338 *************************************/
291339
292static const struct z80dma_interface dk3_dma =
340static z80dma_interface dk3_dma =
293341{
294342   0,
295343   CLOCK_1H,
r1877r1878
395443
396444static MACHINE_START( dkong3 )
397445{
398   MACHINE_START_CALL(dkong2b);
399   z80dma_init(1);
400   z80dma_config(0, &dk3_dma);
446   dkong_state *state = machine->driver_data;
447
448   state->hardware_type = HARDWARE_TKG04;
401449}
402450
403451static MACHINE_RESET( dkong )
404452{
405
406453   dma8257_reset();
407
408454}
409455
410static MACHINE_RESET( dkong3 )
411{
412
413   z80dma_reset();
414
415}
416
417456static MACHINE_RESET( strtheat )
418457{
419458   dkong_state *state = machine->driver_data;
r1877r1878
464503   cpuintrf_pop_context();
465504}
466505
467static UINT8 dk3_dma_read_byte(offs_t offset)
506static Z80DMA_READ( dk3_dma_read_byte )
468507{
469508   UINT8 result;
470509
r1877r1878
475514   return result;
476515}
477516
478static void dk3_dma_write_byte(offs_t offset, UINT8 data)
517static Z80DMA_WRITE( dk3_dma_write_byte )
479518{
480519   cpuintrf_push_context(0);
481520   program_write_byte(offset, data);
r1877r1878
566605      dkongjr_snd_w2(ui_snd-8, (readinputportbytag("TST") & 0x02)>>1);
567606#endif
568607
569   r = (readinputportbytag("IN2") & 0xBF) | (dkong_audio_status_r(0) << 6);
608   r = (readinputportbytag("IN2") & 0xBF) | (dkong_audio_status_r(machine,0) << 6);
570609   coin_counter_w(offset, r >> 7);
571610   if (r & 0x10)
572611      r = (r & ~0x10) | 0x80; /* service ==> coint */
r1877r1878
594633
595634static READ8_HANDLER( epos_decrypt_rom )
596635{
597   dkong_state *state = Machine->driver_data;
636   dkong_state *state = machine->driver_data;
598637
599638   if (offset & 0x01)
600639   {
r1877r1878
623662
624663static WRITE8_HANDLER( hunchbkd_data_w )
625664{
626   dkong_state *state = Machine->driver_data;
665   dkong_state *state = machine->driver_data;
627666
628667   state->hunchloopback = data;
629668}
630669
631670static READ8_HANDLER( hunchbkd_port0_r )
632671{
633   dkong_state *state = Machine->driver_data;
672   dkong_state *state = machine->driver_data;
634673#if DEBUG_PROTECTION
635674   logerror("port 0 : pc = %4x\n",activecpu_get_pc());
636675#endif
r1877r1878
647686
648687static READ8_HANDLER( hunchbkd_port1_r )
649688{
650   dkong_state *state = Machine->driver_data;
689   dkong_state *state = machine->driver_data;
651690
652691   return state->hunchloopback;
653692}
r1877r1878
701740{
702741   if (data & 1)
703742   {
704      cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, CLEAR_LINE);
705      cpunum_set_input_line(Machine, 2, INPUT_LINE_RESET, CLEAR_LINE);
743      cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, CLEAR_LINE);
744      cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, CLEAR_LINE);
706745   }
707746   else
708747   {
709      cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, ASSERT_LINE);
710      cpunum_set_input_line(Machine, 2, INPUT_LINE_RESET, ASSERT_LINE);
748      cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, ASSERT_LINE);
749      cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, ASSERT_LINE);
711750   }
712751}
713752
r1877r1878
15581597   /* basic machine hardware */
15591598   MDRV_CPU_ADD_TAG("main", Z80, CLOCK_1H)
15601599   MDRV_CPU_PROGRAM_MAP(dkong_map, 0)
1561   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
1600   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
15621601
15631602   MDRV_MACHINE_START(dkong2b)
15641603   MDRV_MACHINE_RESET(dkong)
r1877r1878
16251664   MDRV_CPU_REPLACE("main", S2650, CLOCK_1H / 2)   /* ??? */
16261665   MDRV_CPU_PROGRAM_MAP(hunchbkd_map, 0)
16271666   MDRV_CPU_IO_MAP(hunchbkd_io_map, 0)
1628   MDRV_CPU_VBLANK_INT(hunchbkd_interrupt,1)
1667   MDRV_CPU_VBLANK_INT("main", hunchbkd_interrupt)
16291668
16301669   MDRV_MACHINE_START(hunchbkd)
16311670
r1877r1878
16401679   MDRV_CPU_ADD_TAG("main", Z80, XTAL_8MHz / 2)   /* verified in schematics */
16411680   MDRV_CPU_PROGRAM_MAP(dkong3_map, 0)
16421681   MDRV_CPU_IO_MAP(0, dkong3_io_map)
1643   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
1682   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
16441683
16451684   MDRV_MACHINE_START(dkong3)
1646   MDRV_MACHINE_RESET(dkong3)
16471685
1686   MDRV_DEVICE_ADD(Z80DMA_DEV_0_TAG, Z80DMA)
1687   MDRV_DEVICE_CONFIG(dk3_dma)
1688
16481689   /* video hardware */
16491690   MDRV_SCREEN_ADD("main", RASTER)
16501691   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
r1877r1878
21132154   ROM_LOAD( "v-2n.bpr",  0x0200, 0x0100, CRC(dbf185bf) SHA1(2697a991a4afdf079dd0b7e732f71c7618f43b70) )   /* character color codes on a per-column basis */
21142155ROM_END
21152156
2116ROM_START( dkngjnrb )
2157ROM_START( dkongjre )
21172158   ROM_REGION( 0x10000, REGION_CPU1, 0 )
21182159   ROM_LOAD( "djr1-c.5b",    0x0000, 0x1000, CRC(ffe9e1a5) SHA1(715dc79d85169b4c1faf43458592e69b434afefd) )
21192160   ROM_CONTINUE(             0x3000, 0x1000 )
r1877r1878
28072848GAME( 1982, dkongjrj, dkongjr,  dkongjr,  dkongjr,        0,  ROT90, "Nintendo", "Donkey Kong Jr. (Japan)", GAME_SUPPORTS_SAVE )
28082849GAME( 1982, dkngjnrj, dkongjr,  dkongjr,  dkongjr,        0,  ROT90, "Nintendo", "Donkey Kong Junior (Japan?)", GAME_SUPPORTS_SAVE )
28092850GAME( 1982, dkongjrb, dkongjr,  dkongjr,  dkongjr,        0,  ROT90, "bootleg", "Donkey Kong Jr. (bootleg)", GAME_SUPPORTS_SAVE )
2810GAME( 1982, dkngjnrb, dkongjr,  dkongjr,  dkongjr,        0,  ROT90, "Nintendo of America", "Donkey Kong Junior (bootleg?)", GAME_SUPPORTS_SAVE )
2851GAME( 1982, dkongjre, dkongjr,  dkongjr,  dkongjr,        0,  ROT90, "Nintendo of America", "Donkey Kong Junior (Easy)", GAME_SUPPORTS_SAVE )
28112852
28122853GAME( 1983, dkong3,   0,        dkong3,   dkong3,         0,  ROT90, "Nintendo of America", "Donkey Kong 3 (US)", GAME_SUPPORTS_SAVE )
28132854GAME( 1983, dkong3j,  dkong3,   dkong3,   dkong3,         0,  ROT90, "Nintendo", "Donkey Kong 3 (Japan)", GAME_SUPPORTS_SAVE )
src/mame/drivers/sprint4.c
r1877r1878
200200
201201static WRITE8_HANDLER( sprint4_screech_1_w )
202202{
203   discrete_sound_w(SPRINT4_SCREECH_EN_1, offset & 1);
203   discrete_sound_w(machine, SPRINT4_SCREECH_EN_1, offset & 1);
204204}
205205
206206
207207static WRITE8_HANDLER( sprint4_screech_2_w )
208208{
209   discrete_sound_w(SPRINT4_SCREECH_EN_2, offset & 1);
209   discrete_sound_w(machine, SPRINT4_SCREECH_EN_2, offset & 1);
210210}
211211
212212
213213static WRITE8_HANDLER( sprint4_screech_3_w )
214214{
215   discrete_sound_w(SPRINT4_SCREECH_EN_3, offset & 1);
215   discrete_sound_w(machine, SPRINT4_SCREECH_EN_3, offset & 1);
216216}
217217
218218
219219static WRITE8_HANDLER( sprint4_screech_4_w )
220220{
221   discrete_sound_w(SPRINT4_SCREECH_EN_4, offset & 1);
221   discrete_sound_w(machine, SPRINT4_SCREECH_EN_4, offset & 1);
222222}
223223
224224
r1877r1878
226226
227227static WRITE8_HANDLER( sprint4_bang_w )
228228{
229   discrete_sound_w(SPRINT4_BANG_DATA, data & 0x0f);
229   discrete_sound_w(machine, SPRINT4_BANG_DATA, data & 0x0f);
230230}
231231
232232
233233static WRITE8_HANDLER( sprint4_attract_w )
234234{
235   discrete_sound_w(SPRINT4_ATTRACT_EN, data & 1);
235   discrete_sound_w(machine, SPRINT4_ATTRACT_EN, data & 1);
236236}
237237
238238
src/mame/drivers/appoooh.c
r1877r1878
216216   MDRV_CPU_ADD(Z80,18432000/6)   /* ??? the main xtal is 18.432 MHz */
217217   MDRV_CPU_PROGRAM_MAP(main_map,0)
218218   MDRV_CPU_IO_MAP(main_portmap,0)
219   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
219   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
220220
221221   /* video hardware */
222222   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
418418   MDRV_CPU_ADD(Z80,18432000/6)   /* ??? the main xtal is 18.432 MHz */
419419   MDRV_CPU_PROGRAM_MAP(main_map,0)
420420   MDRV_CPU_IO_MAP(main_portmap,0)
421   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
421   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
422422
423423   /* video hardware */
424424   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/skyraid.c
r1877r1878
263263   /* basic machine hardware */
264264   MDRV_CPU_ADD(M6502, 12096000 / 12)
265265   MDRV_CPU_PROGRAM_MAP(skyraid_readmem, skyraid_writemem)
266   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
266   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
267267
268268   /* video hardware */
269269   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/travrusa.c
r1877r1878
328328   /* basic machine hardware */
329329   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz (?) */
330330   MDRV_CPU_PROGRAM_MAP(main_map,0)
331   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
331   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
332332
333333   /* video hardware */
334334   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/hanaroku.c
r1877r1878
4040{
4141}
4242
43static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
43static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
4444{
4545   int i;
4646
r1877r1878
238238static MACHINE_DRIVER_START( hanaroku )
239239   MDRV_CPU_ADD(Z80,6000000)       /* ? MHz */
240240   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
241   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
241   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
242242
243243   /* video hardware */
244244   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/metlclsh.c
r1877r1878
320320
321321   MDRV_CPU_ADD(M6809, 1500000)        // ?
322322   MDRV_CPU_PROGRAM_MAP(metlclsh_readmem2, metlclsh_writemem2)
323   MDRV_CPU_VBLANK_INT(metlclsh_interrupt2,2)
323   MDRV_CPU_VBLANK_INT_HACK(metlclsh_interrupt2,2)
324324   // IRQ by cpu #1, NMI by coins insertion
325325
326326   MDRV_MACHINE_RESET(metlclsh)
src/mame/drivers/aliens.c
r1877r1878
4444static WRITE8_HANDLER( bankedram_w )
4545{
4646   if (palette_selected)
47      paletteram_xBBBBBGGGGGRRRRR_be_w(offset,data);
47      paletteram_xBBBBBGGGGGRRRRR_be_w(machine,offset,data);
4848   else
4949      ram[offset] = data;
5050}
r1877r1878
7373
7474static WRITE8_HANDLER( aliens_sh_irqtrigger_w )
7575{
76   soundlatch_w(offset,data);
77   cpunum_set_input_line_and_vector(Machine, 1, 0, HOLD_LINE, 0xff);
76   soundlatch_w(machine,offset,data);
77   cpunum_set_input_line_and_vector(machine, 1, 0, HOLD_LINE, 0xff);
7878}
7979
8080static WRITE8_HANDLER( aliens_snd_bankswitch_w )
r1877r1878
238238   /* basic machine hardware */
239239   MDRV_CPU_ADD(KONAMI, 3000000)      /* ? */
240240   MDRV_CPU_PROGRAM_MAP(aliens_map,0)
241   MDRV_CPU_VBLANK_INT(aliens_interrupt,1)
241   MDRV_CPU_VBLANK_INT("main", aliens_interrupt)
242242
243243   MDRV_CPU_ADD(Z80, 3579545)
244244   MDRV_CPU_PROGRAM_MAP(aliens_sound_map,0)
src/mame/drivers/beezer.c
r1877r1878
77*/
88
99#include "driver.h"
10#include "deprecat.h"
1011#include "machine/6522via.h"
1112#include "cpu/m6809/m6809.h"
1213#include "sound/dac.h"
r1877r1878
9293   /* basic machine hardware */
9394   MDRV_CPU_ADD(M6809, 1000000)        /* 1 MHz */
9495   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
95   MDRV_CPU_VBLANK_INT(beezer_interrupt,128)
96   MDRV_CPU_VBLANK_INT_HACK(beezer_interrupt,128)
9697
9798   MDRV_CPU_ADD(M6809, 1000000)        /* 1 MHz */
9899   MDRV_CPU_PROGRAM_MAP(readmem_sound,writemem_sound)
src/mame/drivers/88games.c
r1877r1878
4040   else
4141   {
4242      if (zoomreadroms)
43         return K051316_rom_0_r(offset);
43         return K051316_rom_0_r(machine,offset);
4444      else
45         return K051316_0_r(offset);
45         return K051316_0_r(machine,offset);
4646   }
4747}
4848
4949static WRITE8_HANDLER( bankedram_w )
5050{
5151   if (videobank) ram[offset] = data;
52   else K051316_0_w(offset,data);
52   else K051316_0_w(machine,offset,data);
5353}
5454
5555static WRITE8_HANDLER( k88games_5f84_w )
r1877r1878
279279   /* basic machine hardware */
280280   MDRV_CPU_ADD(KONAMI, 3000000) /* ? */
281281   MDRV_CPU_PROGRAM_MAP(main_map,0)
282   MDRV_CPU_VBLANK_INT(k88games_interrupt,1)
282   MDRV_CPU_VBLANK_INT("main", k88games_interrupt)
283283
284284   MDRV_CPU_ADD(Z80, 3579545)
285285   MDRV_CPU_PROGRAM_MAP(sound_map,0)
src/mame/drivers/ddenlovr.c
r1877r1878
104104
105105
106106UINT8 *ddenlovr_pixmap[8];
107static mame_bitmap *framebuffer;
107static bitmap_t *framebuffer;
108108static int extra_layers;
109109
110110
r1877r1878
236236static WRITE16_HANDLER( ddenlovr16_bgcolor_w )
237237{
238238   if (ACCESSING_LSB)
239      ddenlovr_bgcolor_w(offset,data);
239      ddenlovr_bgcolor_w(machine,offset,data);
240240}
241241
242242
r1877r1878
253253static WRITE16_HANDLER( ddenlovr16_priority_w )
254254{
255255   if (ACCESSING_LSB)
256      ddenlovr_priority_w(offset,data);
256      ddenlovr_priority_w(machine,offset,data);
257257}
258258
259259
r1877r1878
271271static WRITE16_HANDLER( ddenlovr16_layer_enable_w )
272272{
273273   if (ACCESSING_LSB)
274      ddenlovr_layer_enable_w(offset,data);
274      ddenlovr_layer_enable_w(machine,offset,data);
275275}
276276
277277
r1877r1878
10621062         break;
10631063
10641064      case 0xe4:
1065         ddenlovr_priority_w(0,data);
1065         ddenlovr_priority_w(machine,0,data);
10661066         break;
10671067
10681068      case 0xe6:
1069         ddenlovr_layer_enable_w(0,data);
1069         ddenlovr_layer_enable_w(machine,0,data);
10701070         break;
10711071
10721072      case 0xe8:
r1877r1878
11711171
11721172static READ16_HANDLER( ddenlovr_gfxrom_r )
11731173{
1174   return rongrong_gfxrom_r(offset);
1174   return rongrong_gfxrom_r(machine, offset);
11751175}
11761176
11771177
11781178
1179static void copylayer(mame_bitmap *bitmap,const rectangle *cliprect,int layer)
1179static void copylayer(bitmap_t *bitmap,const rectangle *cliprect,int layer)
11801180{
11811181   int x,y;
11821182   int scrollx = ddenlovr_scroll[layer/4*8 + (layer%4) + 0];
r1877r1878
13581358   /* what were they smoking??? */
13591359   b = ((d1 & 0xe0) >> 5) | (d2 & 0xc0) >> 3;
13601360
1361   palette_set_color_rgb(Machine,indx,pal5bit(r),pal5bit(g),pal5bit(b));
1361   palette_set_color_rgb(machine,indx,pal5bit(r),pal5bit(g),pal5bit(b));
13621362}
13631363
13641364static WRITE16_HANDLER( ddenlovr_palette_w )
13651365{
13661366   if (ACCESSING_LSB)
1367      rongrong_palette_w(offset,data & 0xff);
1367      rongrong_palette_w(machine,offset,data & 0xff);
13681368}
13691369
13701370
r1877r1878
14711471
14721472static READ16_HANDLER( unk16_r )
14731473{
1474   return unk_r(offset);
1474   return unk_r(machine,offset);
14751475}
14761476
14771477
r1877r1878
19651965
19661966static WRITE8_HANDLER( mmpanic_soundlatch_w )
19671967{
1968   soundlatch_w(0,data);
1969   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
1968   soundlatch_w(machine,0,data);
1969   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
19701970}
19711971
19721972static WRITE8_HANDLER( mmpanic_blitter_w )
r1877r1878
25032503
25042504static WRITE8_HANDLER( mjchuuka_blitter_w )
25052505{
2506   hanakanz_blitter_reg_w(0,offset >> 8);
2507   hanakanz_blitter_data_w(0,data);
2506   hanakanz_blitter_reg_w(machine,0,offset >> 8);
2507   hanakanz_blitter_data_w(machine,0,data);
25082508}
25092509
25102510static UINT8 mjchuuka_romdata[2];
r1877r1878
26022602
26032603static ADDRESS_MAP_START( mjchuuka_writeport, ADDRESS_SPACE_IO, 8 )   // 16 bit I/O
26042604   AM_RANGE(0x1c, 0x1c) AM_MIRROR(0xff00) AM_WRITE( hanakanz_rombank_w         )
2605   AM_SPACE(0x20, 0xff)                   AM_WRITE( mjchuuka_blitter_w         )
2606   AM_SPACE(0x21, 0xff)                   AM_WRITE( mjchuuka_palette_w         )
2605   AM_RANGE(0x20, 0x20) AM_MIRROR(0xff00) AM_MASK(0xff00) AM_WRITE( mjchuuka_blitter_w         )
2606   AM_RANGE(0x21, 0x21) AM_MIRROR(0xff00) AM_MASK(0xff00) AM_WRITE( mjchuuka_palette_w         )
26072607   AM_RANGE(0x40, 0x40) AM_MIRROR(0xff00) AM_WRITE( mjchuuka_coincounter_w      )
26082608   AM_RANGE(0x41, 0x41) AM_MIRROR(0xff00) AM_WRITE( hanakanz_keyb_w         )
26092609   AM_RANGE(0x80, 0x80) AM_MIRROR(0xff00) AM_WRITE( OKIM6295_data_0_w         )
r1877r1878
27632763{
27642764   UINT8 *rom = memory_region(REGION_CPU1);
27652765   if (hginga_rombank & 0x10)
2766      return hanakanz_rand_r(0);
2766      return hanakanz_rand_r(machine,0);
27672767   return rom[0x10000 + 0x8000 * (hginga_rombank & 0x7) + 0xf601 - 0x8000];
27682768}
27692769
r1877r1878
29312931
29322932static UINT8 hgokou_player_r(int player)
29332933{
2934   UINT8 hopper_bit = ((hgokou_hopper && !(cpu_getcurrentframe()%10)) ? 0 : (1<<6));
2934   UINT8 hopper_bit = ((hgokou_hopper && !(video_screen_get_frame_number(0)%10)) ? 0 : (1<<6));
29352935
29362936   if (!(ddenlovr_select2 & 0x01))   return readinputport(player * 5 + 1) | hopper_bit;
29372937   if (!(ddenlovr_select2 & 0x02))   return readinputport(player * 5 + 2) | hopper_bit;
r1877r1878
29852985{
29862986   UINT8 *rom = memory_region(REGION_CPU1);
29872987   if (hginga_rombank == 0)
2988      return hanakanz_rand_r(0);
2988      return hanakanz_rand_r(machine,0);
29892989   return rom[0x10000 + 0x8000 * (hginga_rombank & 0x7) + 0xe601 - 0x8000];
29902990}
29912991
r1877r1878
59315931   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
59325932INPUT_PORTS_END
59335933
5934#ifdef UNUSED_DEFINITION
59345935static INPUT_PORTS_START( mjmyuniv )
59355936   PORT_START   // IN0 - Coins + Service Keys
59365937   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE3   )   // medal out
r1877r1878
61116112   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
61126113   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
61136114INPUT_PORTS_END
6115#endif
61146116
61156117static INPUT_PORTS_START( akamaru )
61166118   PORT_START   // IN0 - Player 1
r1877r1878
65236525   /* basic machine hardware */
65246526   MDRV_CPU_ADD_TAG("main",M68000,24000000 / 2)
65256527   MDRV_CPU_PROGRAM_MAP(ddenlovr_readmem,ddenlovr_writemem)
6526   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
6528   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
65276529
65286530   /* video hardware */
65296531   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
66386640   MDRV_CPU_ADD_TAG("main", Z80, 8000000)   /* ? */
66396641   MDRV_CPU_PROGRAM_MAP(quizchq_readmem,quizchq_writemem)
66406642   MDRV_CPU_IO_MAP(quizchq_readport,quizchq_writeport)
6641   MDRV_CPU_VBLANK_INT(quizchq_irq,1)
6643   MDRV_CPU_VBLANK_INT("main", quizchq_irq)
66426644
66436645   /* video hardware */
66446646   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
67086710   MDRV_CPU_ADD_TAG("main", Z80, 8000000)
67096711   MDRV_CPU_PROGRAM_MAP(mmpanic_readmem,mmpanic_writemem)
67106712   MDRV_CPU_IO_MAP(mmpanic_readport,mmpanic_writeport)
6711   MDRV_CPU_VBLANK_INT(mmpanic_irq,1)
6713   MDRV_CPU_VBLANK_INT("main", mmpanic_irq)
67126714
67136715   MDRV_CPU_ADD_TAG("sound", Z80, 3579545)
67146716   MDRV_CPU_PROGRAM_MAP(mmpanic_sound_readmem,mmpanic_sound_writemem)
67156717   MDRV_CPU_IO_MAP(mmpanic_sound_readport,mmpanic_sound_writeport)
6716   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   // NMI by main cpu
6718   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   // NMI by main cpu
67176719
67186720   /* video hardware */
67196721   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
67776779   MDRV_CPU_ADD_TAG("main",Z80,8000000)   // TMPZ84C015BF-8
67786780   MDRV_CPU_PROGRAM_MAP(hanakanz_readmem,hanakanz_writemem)
67796781   MDRV_CPU_IO_MAP(hanakanz_readport,hanakanz_writeport)
6780   MDRV_CPU_VBLANK_INT(hanakanz_irq,1)
6782   MDRV_CPU_VBLANK_INT("main", hanakanz_irq)
67816783
67826784   /* video hardware */
67836785   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
68506852   MDRV_IMPORT_FROM( hanakanz )
68516853   MDRV_CPU_MODIFY("main")
68526854   MDRV_CPU_IO_MAP(mjchuuka_readport,mjchuuka_writeport)
6853   MDRV_CPU_VBLANK_INT(mjchuuka_irq,1)
6855   MDRV_CPU_VBLANK_INT("main", mjchuuka_irq)
68546856
68556857   MDRV_SOUND_ADD(AY8910, 1789772)
68566858   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
r1877r1878
68636865   MDRV_CPU_MODIFY("main")
68646866   MDRV_CPU_PROGRAM_MAP(funkyfig_readmem,funkyfig_writemem)
68656867   MDRV_CPU_IO_MAP(funkyfig_readport,funkyfig_writeport)
6866   MDRV_CPU_VBLANK_INT(mjchuuka_irq,1)
6868   MDRV_CPU_VBLANK_INT("main", mjchuuka_irq)
68676869
68686870   MDRV_CPU_MODIFY("sound")
68696871   MDRV_CPU_IO_MAP(funkyfig_sound_readport,mmpanic_sound_writeport)
r1877r1878
69226924   MDRV_CPU_MODIFY("main")
69236925   MDRV_CPU_PROGRAM_MAP(mjmyster_readmem,mjmyster_writemem)
69246926   MDRV_CPU_IO_MAP(mjmyster_readport,mjmyster_writeport)
6925   MDRV_CPU_VBLANK_INT(mjmyster_irq, 2)
6927   MDRV_CPU_VBLANK_INT_HACK(mjmyster_irq, 2)
69266928   MDRV_CPU_PERIODIC_INT(rtc_nmi_irq, 1)
69276929
69286930   MDRV_SOUND_ADD(AY8910, 3579545)
r1877r1878
69696971   MDRV_CPU_MODIFY("main")
69706972   MDRV_CPU_PROGRAM_MAP(hginga_readmem,hginga_writemem)
69716973   MDRV_CPU_IO_MAP(hginga_readport,hginga_writeport)
6972   MDRV_CPU_VBLANK_INT(hginga_irq, 1)
6974   MDRV_CPU_VBLANK_INT("main", hginga_irq)
69736975
69746976   MDRV_SOUND_ADD(AY8910, 3579545)
69756977   MDRV_SOUND_CONFIG(hginga_ay8910_interface)
r1877r1878
69826984   MDRV_CPU_MODIFY("main")
69836985   MDRV_CPU_PROGRAM_MAP(hgokou_readmem,hgokou_writemem)
69846986   MDRV_CPU_IO_MAP(hgokou_readport,hgokou_writeport)
6985   MDRV_CPU_VBLANK_INT(hginga_irq, 1)
6987   MDRV_CPU_VBLANK_INT("main", hginga_irq)
69866988
69876989   MDRV_SOUND_ADD(AY8910, 3579545)
69886990   MDRV_SOUND_CONFIG(hginga_ay8910_interface)
r1877r1878
70037005   MDRV_CPU_MODIFY("main")
70047006   MDRV_CPU_PROGRAM_MAP(mjmyster_readmem,mjmyster_writemem)
70057007   MDRV_CPU_IO_MAP(mjmyster_readport,mjmyster_writeport)
7006   MDRV_CPU_VBLANK_INT(mjmyster_irq, 2)
7008   MDRV_CPU_VBLANK_INT_HACK(mjmyster_irq, 2)
70077009   MDRV_CPU_PERIODIC_INT(rtc_nmi_irq, 1)
70087010
70097011   MDRV_SOUND_ADD(AY8910, 1789772)
r1877r1878
70167018   MDRV_IMPORT_FROM( quizchq )
70177019   MDRV_CPU_MODIFY("main")
70187020   MDRV_CPU_IO_MAP(mjmyster_readport,mjmyster_writeport)
7019   MDRV_CPU_VBLANK_INT(mjmyster_irq, 2)
7021   MDRV_CPU_VBLANK_INT_HACK(mjmyster_irq, 2)
70207022   MDRV_CPU_PERIODIC_INT(rtc_nmi_irq, 1)
70217023
70227024   MDRV_SOUND_ADD(AY8910, 1789772)
r1877r1878
70477049   MDRV_CPU_MODIFY("main")
70487050   MDRV_CPU_PROGRAM_MAP(rongrong_readmem,rongrong_writemem)
70497051   MDRV_CPU_IO_MAP(mjflove_readport,mjflove_writeport)
7050   MDRV_CPU_VBLANK_INT(mjflove_irq, 2)
7052   MDRV_CPU_VBLANK_INT_HACK(mjflove_irq, 2)
70517053
70527054   MDRV_VIDEO_START(mjflove)   // blitter commands in the roms are shuffled around
70537055
r1877r1878
70687070   MDRV_CPU_MODIFY("main")
70697071   MDRV_CPU_PROGRAM_MAP(hparadis_readmem,hparadis_writemem)
70707072   MDRV_CPU_IO_MAP(hparadis_readport,hparadis_writeport)
7071   MDRV_CPU_VBLANK_INT(hparadis_irq, 1)
7073   MDRV_CPU_VBLANK_INT("main", hparadis_irq)
70727074MACHINE_DRIVER_END
70737075
70747076
src/mame/drivers/chinagat.c
r1877r1878
147147
148148static WRITE8_HANDLER( chinagat_cpu_sound_cmd_w )
149149{
150   soundlatch_w( offset, data );
151   cpunum_set_input_line(Machine, 2, sound_irq, (sound_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE );
150   soundlatch_w( machine, offset, data );
151   cpunum_set_input_line(machine, 2, sound_irq, (sound_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE );
152152}
153153
154154static READ8_HANDLER( saiyugb1_mcu_command_r )
r1877r1878
495495   /* basic machine hardware */
496496   MDRV_CPU_ADD(HD6309,12000000/2)      /* 1.5 MHz (12MHz oscillator ???) */
497497   MDRV_CPU_PROGRAM_MAP(main_map,0)
498   MDRV_CPU_VBLANK_INT(chinagat_interrupt,1)
498   MDRV_CPU_VBLANK_INT("main", chinagat_interrupt)
499499
500500   MDRV_CPU_ADD(HD6309,12000000/2)      /* 1.5 MHz (12MHz oscillator ???) */
501501   MDRV_CPU_PROGRAM_MAP(sub_map,0)
r1877r1878
539539   /* basic machine hardware */
540540   MDRV_CPU_ADD(M6809,12000000/8)      /* 68B09EP 1.5 MHz (12MHz oscillator) */
541541   MDRV_CPU_PROGRAM_MAP(main_map,0)
542   MDRV_CPU_VBLANK_INT(chinagat_interrupt,1)
542   MDRV_CPU_VBLANK_INT("main", chinagat_interrupt)
543543
544544   MDRV_CPU_ADD(M6809,12000000/8)      /* 68B09EP 1.5 MHz (12MHz oscillator) */
545545   MDRV_CPU_PROGRAM_MAP(sub_map,0)
r1877r1878
587587   /* basic machine hardware */
588588   MDRV_CPU_ADD(M6809,12000000/8)      /* 1.5 MHz (12MHz oscillator) */
589589   MDRV_CPU_PROGRAM_MAP(main_map,0)
590   MDRV_CPU_VBLANK_INT(chinagat_interrupt,1)
590   MDRV_CPU_VBLANK_INT("main", chinagat_interrupt)
591591
592592   MDRV_CPU_ADD(M6809,12000000/8)      /* 1.5 MHz (12MHz oscillator) */
593593   MDRV_CPU_PROGRAM_MAP(sub_map,0)
src/mame/drivers/kaneko16.c
r1877r1878
272272{
273273   if (ACCESSING_MSB)
274274   {
275      soundlatch_w(0, (data & 0xff00) >> 8 );
276      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
275      soundlatch_w(machine, 0, (data & 0xff00) >> 8 );
276      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
277277   }
278278}
279279
r1877r1878
282282static READ16_HANDLER( kaneko16_YM2149_0_r )
283283{
284284   /* Each 2149 register is mapped to a different address */
285   AY8910_control_port_0_w(0,offset);
286   return AY8910_read_port_0_r(0);
285   AY8910_control_port_0_w(machine,0,offset);
286   return AY8910_read_port_0_r(machine,0);
287287}
288288static READ16_HANDLER( kaneko16_YM2149_1_r )
289289{
290290   /* Each 2149 register is mapped to a different address */
291   AY8910_control_port_1_w(0,offset);
292   return AY8910_read_port_1_r(0);
291   AY8910_control_port_1_w(machine,0,offset);
292   return AY8910_read_port_1_r(machine,0);
293293}
294294
295295static WRITE16_HANDLER( kaneko16_YM2149_0_w )
296296{
297297   /* Each 2149 register is mapped to a different address */
298   AY8910_control_port_0_w(0,offset);
298   AY8910_control_port_0_w(machine,0,offset);
299299   /* The registers are mapped to odd addresses, except one! */
300   if (ACCESSING_LSB)   AY8910_write_port_0_w(0, data       & 0xff);
301   else            AY8910_write_port_0_w(0,(data >> 8) & 0xff);
300   if (ACCESSING_LSB)   AY8910_write_port_0_w(machine,0, data       & 0xff);
301   else            AY8910_write_port_0_w(machine,0,(data >> 8) & 0xff);
302302}
303303static WRITE16_HANDLER( kaneko16_YM2149_1_w )
304304{
305305   /* Each 2149 register is mapped to a different address */
306   AY8910_control_port_1_w(0,offset);
306   AY8910_control_port_1_w(machine,0,offset);
307307   /* The registers are mapped to odd addresses, except one! */
308   if (ACCESSING_LSB)   AY8910_write_port_1_w(0, data       & 0xff);
309   else            AY8910_write_port_1_w(0,(data >> 8) & 0xff);
308   if (ACCESSING_LSB)   AY8910_write_port_1_w(machine,0, data       & 0xff);
309   else            AY8910_write_port_1_w(machine,0,(data >> 8) & 0xff);
310310}
311311
312312
r1877r1878
631631{
632632   if (ACCESSING_LSB)
633633   {
634      OKIM6295_data_0_w(0,data);
634      OKIM6295_data_0_w(machine,0,data);
635635//      logerror("CPU #0 PC %06X : OKI0 <- %08X\n",activecpu_get_pc(),data);
636636   }
637637}
r1877r1878
640640{
641641   if (ACCESSING_LSB)
642642   {
643      OKIM6295_data_1_w(0,data);
643      OKIM6295_data_1_w(machine,0,data);
644644//      logerror("CPU #0 PC %06X : OKI1 <- %08X\n",activecpu_get_pc(),data);
645645   }
646646}
r1877r1878
16801680   /* basic machine hardware */
16811681   MDRV_CPU_ADD(M68000, 12000000)   /* MC68000P12 */
16821682   MDRV_CPU_PROGRAM_MAP(berlwall,0)
1683   MDRV_CPU_VBLANK_INT(kaneko16_interrupt,KANEKO16_INTERRUPTS_NUM)
1683   MDRV_CPU_VBLANK_INT_HACK(kaneko16_interrupt,KANEKO16_INTERRUPTS_NUM)
16841684
16851685   MDRV_MACHINE_RESET(berlwall)
16861686
r1877r1878
17271727   /* basic machine hardware */
17281728   MDRV_CPU_ADD(M68000, XTAL_12MHz) /* verified on pcb */
17291729   MDRV_CPU_PROGRAM_MAP(bakubrkr,0)
1730   MDRV_CPU_VBLANK_INT(kaneko16_interrupt,KANEKO16_INTERRUPTS_NUM)
1730   MDRV_CPU_VBLANK_INT_HACK(kaneko16_interrupt,KANEKO16_INTERRUPTS_NUM)
17311731
17321732   MDRV_MACHINE_RESET(bakubrkr)
17331733   MDRV_NVRAM_HANDLER(93C46)
r1877r1878
17831783   /* basic machine hardware */
17841784   MDRV_CPU_ADD(M68000,12000000)   /* TMP68HC000-12 */
17851785   MDRV_CPU_PROGRAM_MAP(blazeon,0)
1786   MDRV_CPU_VBLANK_INT(kaneko16_interrupt,KANEKO16_INTERRUPTS_NUM)
1786   MDRV_CPU_VBLANK_INT_HACK(kaneko16_interrupt,KANEKO16_INTERRUPTS_NUM)
17871787
17881788   MDRV_CPU_ADD(Z80,4000000)   /* D780C-2 */
17891789   MDRV_CPU_PROGRAM_MAP(blazeon_soundmem,0)
r1877r1878
18341834static MACHINE_DRIVER_START( gtmr )
18351835
18361836   /* basic machine hardware */
1837   MDRV_CPU_ADD_TAG("gtmr", M68000, 16000000)   /* ? Most likely a 68000-HC16 */
1837   MDRV_CPU_ADD_TAG("gtmr", M68000, XTAL_16MHz)   /* verified on pcb */
18381838   MDRV_CPU_PROGRAM_MAP(gtmr_readmem,gtmr_writemem)
1839   MDRV_CPU_VBLANK_INT(kaneko16_interrupt,KANEKO16_INTERRUPTS_NUM)
1839   MDRV_CPU_VBLANK_INT_HACK(kaneko16_interrupt,KANEKO16_INTERRUPTS_NUM)
18401840
18411841   MDRV_MACHINE_RESET(gtmr)
18421842
r1877r1878
18591859   /* sound hardware */
18601860   MDRV_SPEAKER_STANDARD_MONO("mono")
18611861
1862   MDRV_SOUND_ADD(OKIM6295, 1980000)
1863   MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low) // clock frequency & pin 7 not verified
1862   MDRV_SOUND_ADD(OKIM6295, XTAL_16MHz/8)   /* verified on pcb */
1863   MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low) /* verified on pcb */
18641864   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
18651865
1866   MDRV_SOUND_ADD(OKIM6295, 1980000)
1867   MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7low) // clock frequency & pin 7 not verified
1866   MDRV_SOUND_ADD(OKIM6295, XTAL_16MHz/8)   /* verified on pcb */
1867   MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7low) /* verified on pcb */
18681868   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
18691869MACHINE_DRIVER_END
18701870
r1877r1878
19141914   MDRV_IMPORT_FROM(gtmr)
19151915   MDRV_CPU_MODIFY("gtmr")
19161916   MDRV_CPU_PROGRAM_MAP(bonkadv,0)
1917   MDRV_CPU_VBLANK_INT(kaneko16_interrupt,KANEKO16_INTERRUPTS_NUM + 1 ) // comment above
1917   MDRV_CPU_VBLANK_INT_HACK(kaneko16_interrupt,KANEKO16_INTERRUPTS_NUM + 1 ) // comment above
19181918
19191919   MDRV_MACHINE_RESET( bonkadv )
19201920MACHINE_DRIVER_END
r1877r1878
19281928   /* basic machine hardware */
19291929   MDRV_CPU_ADD(M68000, XTAL_12MHz) /* verified on pcb */
19301930   MDRV_CPU_PROGRAM_MAP(mgcrystl,0)
1931   MDRV_CPU_VBLANK_INT(kaneko16_interrupt,KANEKO16_INTERRUPTS_NUM)
1931   MDRV_CPU_VBLANK_INT_HACK(kaneko16_interrupt,KANEKO16_INTERRUPTS_NUM)
19321932
19331933   MDRV_MACHINE_RESET(mgcrystl)
19341934   MDRV_NVRAM_HANDLER(93C46)
r1877r1878
19981998   /* basic machine hardware */
19991999   MDRV_CPU_ADD(M68000, 12000000)
20002000   MDRV_CPU_PROGRAM_MAP(shogwarr,0)
2001   MDRV_CPU_VBLANK_INT(shogwarr_interrupt,SHOGWARR_INTERRUPTS_NUM)
2001   MDRV_CPU_VBLANK_INT_HACK(shogwarr_interrupt,SHOGWARR_INTERRUPTS_NUM)
20022002
20032003   MDRV_MACHINE_RESET(shogwarr)
20042004
src/mame/drivers/goldstar.c
r1877r1878
287287   MDRV_CPU_ADD(Z80, 3579545)//(4000000?)
288288   MDRV_CPU_PROGRAM_MAP(map,0)
289289   MDRV_CPU_IO_MAP(readport,0)
290   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
290   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
291291
292292   /* video hardware */
293293   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
323323   MDRV_CPU_ADD(Z80, 3579545)//(4000000?)
324324   MDRV_CPU_PROGRAM_MAP(map,0)
325325   MDRV_CPU_IO_MAP(readport,0)
326   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
326   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
327327
328328   /* video hardware */
329329   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
358358   MDRV_CPU_ADD(Z80, 3579545)//(4000000?)
359359   MDRV_CPU_PROGRAM_MAP(map,0)
360360   MDRV_CPU_IO_MAP(readport,0)
361   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
361   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
362362
363363   /* video hardware */
364364   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/dbz.c
r1877r1878
130130
131131static WRITE16_HANDLER( dbz_sound_command_w )
132132{
133   soundlatch_w(0, data>>8);
133   soundlatch_w(machine, 0, data>>8);
134134}
135135
136136static WRITE16_HANDLER( dbz_sound_cause_nmi )
r1877r1878
439439   /* basic machine hardware */
440440   MDRV_CPU_ADD(M68000, 16000000)
441441   MDRV_CPU_PROGRAM_MAP(dbz_readmem,dbz_writemem)
442   MDRV_CPU_VBLANK_INT(dbz_interrupt,2)
442   MDRV_CPU_VBLANK_INT_HACK(dbz_interrupt,2)
443443
444444   MDRV_CPU_ADD(Z80, 4000000)
445445   /* audio CPU */
src/mame/drivers/cybertnk.c
r1877r1878
565565static MACHINE_DRIVER_START( cybertnk )
566566   MDRV_CPU_ADD(M68000,20000000/2)
567567   MDRV_CPU_PROGRAM_MAP(master_mem,0)
568   MDRV_CPU_VBLANK_INT(master_irq,2)
568   MDRV_CPU_VBLANK_INT_HACK(master_irq,2)
569569
570570   MDRV_CPU_ADD(M68000,20000000/2)
571571   MDRV_CPU_PROGRAM_MAP(slave_mem,0)
572   MDRV_CPU_VBLANK_INT(slave_irq,2)
572   MDRV_CPU_VBLANK_INT_HACK(slave_irq,2)
573573
574574   MDRV_CPU_ADD(Z80,3579500)
575575   MDRV_CPU_PROGRAM_MAP(sound_mem,0)
src/mame/drivers/namcos10.c
r1877r1878
379379   /* basic machine hardware */
380380   MDRV_CPU_ADD( PSXCPU, XTAL_101_4912MHz )
381381   MDRV_CPU_PROGRAM_MAP( namcos10_map, 0 )
382   MDRV_CPU_VBLANK_INT( psx_vblank, 1 )
382   MDRV_CPU_VBLANK_INT("main", psx_vblank)
383383
384384   MDRV_MACHINE_RESET( namcos10 )
385385
src/mame/drivers/wc90.c
r1877r1878
110110
111111static WRITE8_HANDLER( wc90_sound_command_w )
112112{
113   soundlatch_w(offset,data);
114   cpunum_set_input_line(Machine, 2,INPUT_LINE_NMI,PULSE_LINE);
113   soundlatch_w(machine,offset,data);
114   cpunum_set_input_line(machine, 2,INPUT_LINE_NMI,PULSE_LINE);
115115}
116116
117117
r1877r1878
348348   /* basic machine hardware */
349349   MDRV_CPU_ADD(Z80, 6000000)   /* 6.0 MHz ??? */
350350   MDRV_CPU_PROGRAM_MAP(wc90_readmem1,wc90_writemem1)
351   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
351   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
352352
353353   MDRV_CPU_ADD(Z80, 6000000)   /* 6.0 MHz ??? */
354354   MDRV_CPU_PROGRAM_MAP(wc90_readmem2,wc90_writemem2)
355   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
355   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
356356
357357   MDRV_CPU_ADD(Z80, 4000000)
358358   /* audio CPU */   /* 4 MHz ???? */
src/mame/drivers/gauntlet.c
r1877r1878
168168   if (scanline & 32)
169169      atarigen_6502_irq_gen(machine, 0);
170170   else
171      atarigen_6502_irq_ack_r(0);
171      atarigen_6502_irq_ack_r(machine, 0);
172172}
173173
174174
r1877r1878
273273
274274      case 1:   /* speech write, bit D7, active low */
275275         if (((data ^ last_speech_write) & 0x80) && (data & 0x80))
276            tms5220_data_w(0, speech_val);
276            tms5220_data_w(machine, 0, speech_val);
277277         last_speech_write = data;
278278         break;
279279
r1877r1878
532532   /* basic machine hardware */
533533   MDRV_CPU_ADD(M68010, ATARI_CLOCK_14MHz/2)
534534   MDRV_CPU_PROGRAM_MAP(main_map,0)
535   MDRV_CPU_VBLANK_INT(atarigen_video_int_gen,1)
535   MDRV_CPU_VBLANK_INT("main", atarigen_video_int_gen)
536536
537537   MDRV_CPU_ADD(M6502, ATARI_CLOCK_14MHz/8)
538538   MDRV_CPU_PROGRAM_MAP(sound_map,0)
src/mame/drivers/ms32.c
r1877r1878
275275
276276static WRITE32_HANDLER( ms32_sound_w )
277277{
278   soundlatch_w(0, data & 0xff);
279   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, ASSERT_LINE);
278   soundlatch_w(machine,0, data & 0xff);
279   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, ASSERT_LINE);
280280
281281   // give the Z80 time to respond
282282   cpu_spinuntil_time(ATTOTIME_IN_USEC(40));
r1877r1878
13061306
13071307static READ8_HANDLER( latch_r )
13081308{
1309   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, CLEAR_LINE);
1310   return soundlatch_r(0)^0xff;
1309   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, CLEAR_LINE);
1310   return soundlatch_r(machine,0)^0xff;
13111311}
13121312
13131313static WRITE8_HANDLER( ms32_snd_bank_w )
r1877r1878
13661366   /* basic machine hardware */
13671367   MDRV_CPU_ADD(V70, 20000000) // 20MHz
13681368   MDRV_CPU_PROGRAM_MAP(ms32_readmem,ms32_writemem)
1369   MDRV_CPU_VBLANK_INT(ms32_interrupt,32)
1369   MDRV_CPU_VBLANK_INT_HACK(ms32_interrupt,32)
13701370
13711371   MDRV_CPU_ADD(Z80, 4000000)
13721372   /* audio CPU */
src/mame/drivers/mpu4.c
r1877r1878
454454   memory_set_bank(1,data & 0x07);
455455}
456456
457static READ8_HANDLER( bankswitch_r )
458{
459   return memory_get_bank(1);
460}
461
457462// IC2 6840 PTM handler ///////////////////////////////////////////////////////
458463
459464static WRITE8_HANDLER( ic2_o1_callback )
r1877r1878
715720*/
716721/* PSG function selected */
717722
718static void update_ay(void)
723static void update_ay(running_machine *machine)
719724{
720725   if (!pia_get_output_cb2(2))
721726   {
r1877r1878
733738           }
734739           case 0x02:
735740         {/* CA2 = 0 CB2 = 1? : Write to selected PSG register and write data to Port A */
736              AY8910_write_port_0_w(0, pia_get_output_a(3));
741              AY8910_write_port_0_w(machine, 0, pia_get_output_a(3));
737742            LOG(("AY Chip Write \n"));
738743            break;
739744           }
740745           case 0x03:
741746         {/* 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.*/
742              AY8910_control_port_0_w(0, pia_get_output_a(3));
747              AY8910_control_port_0_w(machine, 0, pia_get_output_a(3));
743748            LOG(("AY Chip Select \n"));
744749            break;
745750           }
r1877r1878
754759
755760static WRITE8_HANDLER( pia_ic5_cb2_w )
756761{
757    update_ay();
762    update_ay(machine);
758763}
759764
760765static const pia6821_interface pia_ic5_intf =
r1877r1878
789794   if (mod_number <4)
790795   {
791796        aydata = data;
792       update_ay();
797       update_ay(machine);
793798   }
794799}
795800
r1877r1878
800805   {
801806      if ( data ) ay8913_address |=  0x01;
802807      else        ay8913_address &= ~0x01;
803      update_ay();
808      update_ay(machine);
804809   }
805810}
806811
r1877r1878
811816   {
812817      if ( data ) ay8913_address |=  0x02;
813818      else        ay8913_address &= ~0x02;
814      update_ay();
819      update_ay(machine);
815820   }
816821}
817822
r1877r1878
13251330   AM_RANGE(0x0800, 0x0810) AM_WRITE(characteriser_w)
13261331   AM_RANGE(0x0800, 0x0810) AM_READ( characteriser_r)
13271332
1328   AM_RANGE(0x0850, 0x0850) AM_WRITE(bankswitch_w)   // write bank (rom page select)
1333   AM_RANGE(0x0850, 0x0850) AM_READWRITE(bankswitch_r,bankswitch_w)   // write bank (rom page select)
13291334
13301335//  AM_RANGE(0x08E0, 0x08E7) AM_READ( 68681_duart_r)
13311336//  AM_RANGE(0x08E0, 0x08E7) AM_WRITE( 68681_duart_w)
src/mame/drivers/skylncr.c
r1877r1878
429429   MDRV_CPU_ADD(Z80, 12000000/4)
430430   MDRV_CPU_PROGRAM_MAP(mem_map_skylncr,0)
431431   MDRV_CPU_IO_MAP(io_map_skylncr,0)
432   MDRV_CPU_VBLANK_INT(skylncr_vblank_interrupt,1)
432   MDRV_CPU_VBLANK_INT("main", skylncr_vblank_interrupt)
433433
434434   /* video hardware */
435435   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/darkseal.c
r1877r1878
3838{
3939   switch (offset<<1) {
4040    case 6: /* DMA flag */
41      buffer_spriteram16_w(0,0,0);
41      buffer_spriteram16_w(machine,0,0,0);
4242      return;
4343    case 8: /* Sound CPU write */
44      soundlatch_w(0,data & 0xff);
45      cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
44      soundlatch_w(machine,0,data & 0xff);
45      cpunum_set_input_line(machine, 1,0,HOLD_LINE);
4646       return;
4747     case 0xa: /* IRQ Ack (VBL) */
4848      return;
r1877r1878
102102{
103103   switch (offset) {
104104   case 0:
105      YM2151_register_port_0_w(0,data);
105      YM2151_register_port_0_w(machine,0,data);
106106      break;
107107   case 1:
108      YM2151_data_port_0_w(0,data);
108      YM2151_data_port_0_w(machine,0,data);
109109      break;
110110   }
111111}
r1877r1878
114114{
115115   switch (offset) {
116116   case 0:
117      YM2203_control_port_0_w(0,data);
117      YM2203_control_port_0_w(machine,0,data);
118118      break;
119119   case 1:
120      YM2203_write_port_0_w(0,data);
120      YM2203_write_port_0_w(machine,0,data);
121121      break;
122122   }
123123}
r1877r1878
289289   /* basic machine hardware */
290290   MDRV_CPU_ADD(M68000,12000000) /* Custom chip 59 */
291291   MDRV_CPU_PROGRAM_MAP(darkseal_readmem,darkseal_writemem)
292   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)/* VBL */
292   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)/* VBL */
293293
294294   MDRV_CPU_ADD(H6280, 32220000/4) /* Custom chip 45, Audio section crystal is 32.220 MHz */
295295   /* audio CPU */
src/mame/drivers/20pacgal.c
r1877r1878
291291   MDRV_CPU_ADD(Z180, MAIN_CPU_CLOCK)
292292   MDRV_CPU_PROGRAM_MAP(20pacgal_map,0)
293293   MDRV_CPU_IO_MAP(20pacgal_io_map,0)
294   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
294   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
295295
296296   MDRV_NVRAM_HANDLER(eeprom)
297297
src/mame/drivers/seicross.c
r1877r1878
404404   MDRV_CPU_ADD(Z80, 3072000)   /* 3.072 MHz? */
405405   MDRV_CPU_PROGRAM_MAP(main_map,0)
406406   MDRV_CPU_IO_MAP(main_portmap,0)
407   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
407   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
408408
409409   MDRV_CPU_ADD_TAG("mcu", NSC8105, 6000000)   /* ??? */
410410   MDRV_CPU_PROGRAM_MAP(mcu_nvram_map,0)
src/mame/drivers/spbactn.c
r1877r1878
139139{
140140   if (ACCESSING_LSB)
141141   {
142      soundlatch_w(offset,data & 0xff);
143      cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
142      soundlatch_w(machine,offset,data & 0xff);
143      cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
144144   }
145145}
146146
r1877r1878
356356   /* basic machine hardware */
357357   MDRV_CPU_ADD(M68000, 12000000)
358358   MDRV_CPU_PROGRAM_MAP(spbactn_readmem,spbactn_writemem)
359   MDRV_CPU_VBLANK_INT(irq3_line_hold,1)
359   MDRV_CPU_VBLANK_INT("main", irq3_line_hold)
360360
361361   MDRV_CPU_ADD(Z80, 4000000)
362362   /* audio CPU */   /* 4 MHz ??? */
src/mame/drivers/system16.c
r1877r1878
411411{
412412   if( ACCESSING_LSB )
413413{
414      soundlatch_w( 0,data&0xff );
415      cpunum_set_input_line(Machine, 1, 0, HOLD_LINE );
414      soundlatch_w( machine,0,data&0xff );
415      cpunum_set_input_line(machine, 1, 0, HOLD_LINE );
416416   }
417417}
418418
r1877r1878
420420{
421421   if( ACCESSING_LSB )
422422{
423      soundlatch_w( 0,data&0xff );
424      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
423      soundlatch_w( machine,0,data&0xff );
424      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
425425   }
426426}
427427
r1877r1878
450450
451451   /* basic machine hardware */
452452   MDRV_CPU_ADD_TAG("main", M68000, 10000000)
453   MDRV_CPU_VBLANK_INT(sys16_interrupt,1)
453   MDRV_CPU_VBLANK_INT("main", sys16_interrupt)
454454
455455   MDRV_CPU_ADD_TAG("sound", Z80, 4000000)
456456   /* audio CPU */
r1877r1878
577577
578578/***************************************************************************/
579579
580#ifdef UNUSED_DEFINITION
580581static INPUT_PORTS_START( aliensyn )
581582   SYS16_JOY1
582583   SYS16_JOY2
r1877r1878
604605   PORT_DIPSETTING(    0x40, DEF_STR( Hard ) )
605606   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
606607INPUT_PORTS_END
607
608#endif
608609/****************************************************************************/
609610
610611
r1877r1878
12041205}
12051206static READ16_HANDLER( ga_io_service_r )
12061207{
1207   return (input_port_2_word_r(0,0) << 8) | (sys16_workingram[0x2c96/2] & 0x00ff);
1208   return (input_port_2_word_r(machine,0,0) << 8) | (sys16_workingram[0x2c96/2] & 0x00ff);
12081209}
12091210
12101211static ADDRESS_MAP_START( goldnaxe_readmem, ADDRESS_SPACE_PROGRAM, 16 )
r1877r1878
12291230   COMBINE_DATA( &sys16_workingram[(0xecfc-0xc000)/2] );
12301231   if( ACCESSING_MSB )
12311232{
1232      soundlatch_w( 0,data>>8 );
1233      soundlatch_w( machine,0,data>>8 );
12331234      cpunum_set_input_line(Machine, 1, 0, HOLD_LINE );
12341235   }
12351236}
r1877r1878
13991400
14001401static READ16_HANDLER( passht4b_service_r )
14011402{
1402   UINT16 val=input_port_2_word_r(offset,0);
1403   UINT16 val=input_port_2_word_r(machine,offset,0);
14031404   if(!(readinputport(0) & 0x40)) val&=0xef;
14041405   if(!(readinputport(1) & 0x40)) val&=0xdf;
14051406   if(!(readinputport(5) & 0x40)) val&=0xbf;
r1877r1878
19071908/***************************************************************************/
19081909
19091910static READ16_HANDLER( tt_io_player1_r )
1910{ return input_port_0_r( offset ) << 8; }
1911{ return input_port_0_r( machine, offset ) << 8; }
19111912static READ16_HANDLER( tt_io_player2_r )
1912{ return input_port_1_r( offset ) << 8; }
1913{ return input_port_1_r( machine, offset ) << 8; }
19131914static READ16_HANDLER( tt_io_service_r )
1914{ return input_port_2_r( offset ) << 8; }
1915{ return input_port_2_r( machine, offset ) << 8; }
19151916
19161917
19171918
r1877r1878
25232524
25242525
25252526// pre16
2527#ifdef UNUSED_DEFINITION
25262528ROM_START( mjleague )
25272529   ROM_REGION( 0x030000, REGION_CPU1, 0 ) /* 68000 code */
25282530   ROM_LOAD16_BYTE( "epr-7404.09b", 0x000000, 0x8000, CRC(ec1655b5) SHA1(5c1df364fa9733daa4478c5f88298089e4963c33) )
r1877r1878
25612563   ROM_LOAD( "epr-7064.03a", 0x10000, 0x8000, CRC(159f6636) SHA1(66fa3f3e95a6ef3d3ff4ded09c05ab1131d9fbbb) )
25622564   ROM_LOAD( "epr-7066.04a", 0x18000, 0x8000, CRC(f5cfa91f) SHA1(c85d68cbcd03fe1436bed12235c033610acc11ee) )
25632565ROM_END
2566#endif
25642567
25652568ROM_START( passht4b )
25662569   ROM_REGION( 0x20000, REGION_CPU1, 0 ) /* 68000 code */
src/mame/drivers/deniam.c
r1877r1878
5656{
5757   if (ACCESSING_MSB)
5858   {
59      soundlatch_w(offset,(data >> 8) & 0xff);
60      cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
59      soundlatch_w(machine,offset,(data >> 8) & 0xff);
60      cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
6161   }
6262}
6363
r1877r1878
8181static WRITE16_HANDLER( YM3812_control_port_0_msb_w )
8282{
8383   if (ACCESSING_MSB)
84      YM3812_control_port_0_w(0,(data >> 8) & 0xff);
84      YM3812_control_port_0_w(machine,0,(data >> 8) & 0xff);
8585}
8686
8787static WRITE16_HANDLER( YM3812_write_port_0_msb_w )
8888{
8989   if (ACCESSING_MSB)
90      YM3812_write_port_0_w(0,(data >> 8) & 0xff);
90      YM3812_write_port_0_w(machine,0,(data >> 8) & 0xff);
9191}
9292
9393
r1877r1878
324324   /* basic machine hardware */
325325   MDRV_CPU_ADD(M68000,25000000/2)   /* ??? */
326326   MDRV_CPU_PROGRAM_MAP(deniam16b_readmem,deniam16b_writemem)
327   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
327   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
328328
329329   MDRV_CPU_ADD(Z80,25000000/4)   /* (makes logicpro music tempo correct) */
330330   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
r1877r1878
363363   /* basic machine hardware */
364364   MDRV_CPU_ADD(M68000,25000000/2)   /* ??? */
365365   MDRV_CPU_PROGRAM_MAP(deniam16c_readmem,deniam16c_writemem)
366   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
366   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
367367
368368   MDRV_MACHINE_RESET(deniam)
369369
src/mame/drivers/nyny.c
r1877r1878
139139   /* update the different PIA pins from the input ports */
140140
141141   /* CA1 - copy of PA0 (COIN1) */
142   pia_1_ca1_w(0, input_port_0_r(0) & 0x01);
142   pia_1_ca1_w(machine, 0, input_port_0_r(machine, 0) & 0x01);
143143
144144   /* CA2 - copy of PA1 (SERVICE1) */
145   pia_1_ca2_w(0, input_port_0_r(0) & 0x02);
145   pia_1_ca2_w(machine, 0, input_port_0_r(machine, 0) & 0x02);
146146
147147   /* CB1 - (crosshatch) */
148   pia_1_cb1_w(0, input_port_5_r(0));
148   pia_1_cb1_w(machine, 0, input_port_5_r(machine, 0));
149149
150150   /* CB2 - NOT CONNECTED */
151151}
r1877r1878
181181   star_enable = data & 0x10;
182182
183183   /* bits 5-7 go to the music board connector */
184   audio_2_command_w(0, data & 0xe0);
184   audio_2_command_w(machine, 0, data & 0xe0);
185185}
186186
187187
r1877r1878
208208
209209static void ic48_1_74123_output_changed(int output)
210210{
211   pia_2_ca1_w(0, output);
211   pia_2_ca1_w(Machine, 0, output);
212212}
213213
214214
r1877r1878
270270#define NUM_PENS   (8)
271271
272272
273static WRITE8_HANDLER( nyny_mc6845_address_w )
274{
275   mc6845_address_w(mc6845, data);
276}
277
278
279static WRITE8_HANDLER( nyny_mc6845_register_w )
280{
281   mc6845_register_w(mc6845, data);
282}
283
284
285273static WRITE8_HANDLER( flipscreen_w )
286274{
287275   flipscreen = data ? 0 : 1;
288276}
289277
290278
291static void *nyny_begin_update(running_machine *machine, mc6845_t *mc6845, mame_bitmap *bitmap, const rectangle *cliprect)
279static MC6845_BEGIN_UPDATE( begin_update )
292280{
293281   /* create the pens */
294282   offs_t i;
r1877r1878
303291}
304292
305293
306static void nyny_update_row(running_machine *machine, mc6845_t *mc6845, mame_bitmap *bitmap, const rectangle *cliprect,
307                     UINT16 ma, UINT8 ra, UINT16 y, UINT8 x_count, INT8 cursor_x, void *param)
294static MC6845_UPDATE_ROW( update_row )
308295{
309296   UINT8 cx;
310297
r1877r1878
373360}
374361
375362
376static void nyny_end_update(running_machine *machine, mc6845_t *mc6845, mame_bitmap *bitmap, const rectangle *cliprect, void *param)
363static MC6845_END_UPDATE( end_update )
377364{
378365   /* draw the star field into the bitmap */
379366   int y;
r1877r1878
409396}
410397
411398
412static void nyny_display_enable_changed(running_machine *machine, mc6845_t *mc6845, int display_enabled)
399static MC6845_ON_DE_CHANGED( display_enable_changed )
413400{
414401   TTL74123_A_w(0, display_enabled);
415402}
r1877r1878
417404
418405static const mc6845_interface mc6845_intf =
419406{
420   0,                     /* screen we are acting on */
421   CRTC_CLOCK,             /* the clock (pin 21) of the chip */
422   8,                     /* number of pixels per video memory address */
423   nyny_begin_update,         /* before pixel update callback */
424   nyny_update_row,         /* row update callback */
425   nyny_end_update,         /* after pixel update callback */
426   nyny_display_enable_changed   /* call back for display state changes */
407   0,                  /* screen we are acting on */
408   CRTC_CLOCK,          /* the clock (pin 21) of the chip */
409   8,                  /* number of pixels per video memory address */
410   begin_update,         /* before pixel update callback */
411   update_row,            /* row update callback */
412   end_update,            /* after pixel update callback */
413   display_enable_changed,   /* callback for display state changes */
414   NULL,               /* HSYNC callback */
415   NULL               /* VSYNC callback */
427416};
428417
429418
r1877r1878
450439
451440static WRITE8_HANDLER( audio_1_command_w )
452441{
453   soundlatch_w(0, data);
454   cpunum_set_input_line(Machine, 1, M6802_IRQ_LINE, HOLD_LINE);
442   soundlatch_w(machine, 0, data);
443   cpunum_set_input_line(machine, 1, M6802_IRQ_LINE, HOLD_LINE);
455444}
456445
457446
458447static WRITE8_HANDLER( audio_1_answer_w )
459448{
460   soundlatch3_w(0, data);
461   cpunum_set_input_line(Machine, 0, M6809_IRQ_LINE, HOLD_LINE);
449   soundlatch3_w(machine, 0, data);
450   cpunum_set_input_line(machine, 0, M6809_IRQ_LINE, HOLD_LINE);
462451}
463452
464453
r1877r1878
501490
502491static WRITE8_HANDLER( audio_2_command_w )
503492{
504   soundlatch2_w(0, (data & 0x60) >> 5);
505   cpunum_set_input_line(Machine, 2, M6802_IRQ_LINE, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
493   soundlatch2_w(machine, 0, (data & 0x60) >> 5);
494   cpunum_set_input_line(machine, 2, M6802_IRQ_LINE, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
506495}
507496
508497
r1877r1878
518507   UINT8 ret = 0;
519508
520509   /* the address bits are directly connected to the chip selects */
521   if (offset & 0x04)  ret = pia_1_r(offset & 0x03);
522   if (offset & 0x08)  ret = pia_2_alt_r(offset & 0x03);
510   if (offset & 0x04)  ret = pia_1_r(machine, offset & 0x03);
511   if (offset & 0x08)  ret = pia_2_alt_r(machine, offset & 0x03);
523512
524513   return ret;
525514}
r1877r1878
528517static WRITE8_HANDLER( nyny_pia_1_2_w )
529518{
530519   /* the address bits are directly connected to the chip selects */
531   if (offset & 0x04)  pia_1_w(offset & 0x03, data);
532   if (offset & 0x08)  pia_2_alt_w(offset & 0x03, data);
520   if (offset & 0x04)  pia_1_w(machine, offset & 0x03, data);
521   if (offset & 0x08)  pia_2_alt_w(machine, offset & 0x03, data);
533522}
534523
535524
r1877r1878
540529   AM_RANGE(0x6000, 0x7fff) AM_RAM AM_BASE(&nyny_colorram_2)
541530   AM_RANGE(0x8000, 0x9fff) AM_RAM
542531   AM_RANGE(0xa000, 0xa0ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) /* SRAM (coin counter, shown when holding F2) */
543   AM_RANGE(0xa100, 0xa100) AM_MIRROR(0x00fe) AM_WRITE(nyny_mc6845_address_w)
544   AM_RANGE(0xa101, 0xa101) AM_MIRROR(0x00fe) AM_WRITE(nyny_mc6845_register_w)
532   AM_RANGE(0xa100, 0xa100) AM_MIRROR(0x00fe) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
533   AM_RANGE(0xa101, 0xa101) AM_MIRROR(0x00fe) AM_DEVWRITE(MC6845, "crtc", mc6845_register_w)
545534   AM_RANGE(0xa200, 0xa20f) AM_MIRROR(0x00f0) AM_READWRITE(nyny_pia_1_2_r, nyny_pia_1_2_w)
546535   AM_RANGE(0xa300, 0xa300) AM_MIRROR(0x00ff) AM_READWRITE(soundlatch3_r, audio_1_command_w)
547536   AM_RANGE(0xa400, 0xa7ff) AM_NOP
src/mame/drivers/limenko.c
r1877r1878
9494
9595static WRITE32_HANDLER( spotty_soundlatch_w )
9696{
97   soundlatch_w(0, (data >> 16) & 0xff);
97   soundlatch_w(machine, 0, (data >> 16) & 0xff);
9898}
9999
100100/*****************************************************************************************************
r1877r1878
189189}
190190
191191// sprites aren't tile based (except for 8x8 ones)
192static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
192static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
193193{
194194   int i;
195195   int sprites_on_screen = (limenko_videoreg[0] & 0x1ff0000) >> 16;
r1877r1878
479479   MDRV_CPU_ADD(E132XN, 20000000*4)   /* 4x internal multiplier */
480480   MDRV_CPU_PROGRAM_MAP(limenko_map,0)
481481   MDRV_CPU_IO_MAP(limenko_io_map,0)
482   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
482   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
483483
484484   MDRV_NVRAM_HANDLER(93C46)
485485
r1877r1878
504504   MDRV_CPU_ADD(GMS30C2232, 20000000)   /* 20 MHz, no internal multiplier */
505505   MDRV_CPU_PROGRAM_MAP(spotty_map,0)
506506   MDRV_CPU_IO_MAP(spotty_io_map,0)
507   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
507   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
508508
509509   MDRV_CPU_ADD(I8051, 4000000)   /* 4 MHz */
510510   MDRV_CPU_PROGRAM_MAP(spotty_sound_prg_map, 0)
src/mame/drivers/redalert.c
r1877r1878
105105
106106static WRITE8_HANDLER( redalert_interrupt_clear_w )
107107{
108   redalert_interrupt_clear_r(0);
108   redalert_interrupt_clear_r(machine, 0);
109109}
110110
111111
r1877r1878
275275   /* basic machine hardware */
276276   MDRV_CPU_ADD(M6502, MAIN_CPU_CLOCK)
277277   MDRV_CPU_PROGRAM_MAP(redalert_main_map,0)
278   MDRV_CPU_VBLANK_INT(redalert_vblank_interrupt,1)
278   MDRV_CPU_VBLANK_INT("main", redalert_vblank_interrupt)
279279
280280   /* video hardware */
281281   MDRV_IMPORT_FROM(redalert_video)
r1877r1878
290290   /* basic machine hardware */
291291   MDRV_CPU_ADD(M6502, MAIN_CPU_CLOCK)
292292   MDRV_CPU_PROGRAM_MAP(demoneye_main_map,0)
293   MDRV_CPU_VBLANK_INT(redalert_vblank_interrupt,1)
293   MDRV_CPU_VBLANK_INT("main", redalert_vblank_interrupt)
294294
295295   /* video hardware */
296296   MDRV_IMPORT_FROM(demoneye_video)
src/mame/drivers/mcr3.c
r1877r1878
137137   if (data & 0x40) input_mux = 1;
138138
139139   /* low 5 bits control the turbo CS */
140   turbocs_data_w(offset, data);
140   turbocs_data_w(machine, offset, data);
141141}
142142
143143
r1877r1878
204204   maxrpm_adc_control = data & 0x0f;
205205
206206   /* remaining bits go to standard connections */
207   mcrmono_control_port_w(offset, data);
207   mcrmono_control_port_w(machine, offset, data);
208208}
209209
210210
211211static WRITE8_HANDLER( maxrpm_op6_w )
212212{
213213   static const char *const inputs[] = { "MONO.IP1", "MONO.IP1.ALT1", "MONO.IP1.ALT2", "MONO.IP1.ALT3" };
214
215214   /*
216215        Reflective Sensor Control:
217216            4 bits of input from OP5 are routed to a transceiver at U2, and
r1877r1878
241240      maxrpm_adc_select = (maxrpm_adc_control >> 1) & 3;
242241
243242   /* low 5 bits control the turbo CS */
244   turbocs_data_w(offset, data);
243   turbocs_data_w(machine, offset, data);
245244}
246245
247246
r1877r1878
254253
255254static READ8_HANDLER( rampage_ip4_r )
256255{
257   return readinputportbytag("MONO.IP4") | (soundsgood_status_r(0) << 7);
256   return readinputportbytag("MONO.IP4") | (soundsgood_status_r(machine,0) << 7);
258257}
259258
260259
r1877r1878
264263   soundsgood_reset_w((~data >> 5) & 1);
265264
266265   /* low 5 bits go directly to the Sounds Good board */
267   soundsgood_data_w(offset, data);
266   soundsgood_data_w(machine, offset, data);
268267}
269268
270269
r1877r1878
277276
278277static READ8_HANDLER( powerdrv_ip2_r )
279278{
280   return readinputportbytag("MONO.IP2") | (soundsgood_status_r(0) << 7);
279   return readinputportbytag("MONO.IP2") | (soundsgood_status_r(machine, 0) << 7);
281280}
282281
283282
r1877r1878
298297   set_led_status(2, (data >> 1) & 1);
299298
300299   /* remaining bits go to standard connections */
301   mcrmono_control_port_w(offset, data);
300   mcrmono_control_port_w(machine, offset, data);
302301}
303302
304303
r1877r1878
308307   soundsgood_reset_w((~data >> 5) & 1);
309308
310309   /* low 5 bits go directly to the Sounds Good board */
311   soundsgood_data_w(offset, data);
310   soundsgood_data_w(machine, offset, data);
312311}
313312
314313
r1877r1878
322321static READ8_HANDLER( stargrds_ip0_r )
323322{
324323   UINT8 result = readinputportbytag(input_mux ? "MONO.IP0.ALT" : "MONO.IP0");
325   return result | ((soundsgood_status_r(0) << 4) & 0x10);
324   return result | ((soundsgood_status_r(machine, 0) << 4) & 0x10);
326325}
327326
328327
r1877r1878
339338   set_led_status(2, (data >> 4) & 1);
340339
341340   /* remaining bits go to standard connections */
342   mcrmono_control_port_w(offset, data);
341   mcrmono_control_port_w(machine, offset, data);
343342}
344343
345344
r1877r1878
349348   soundsgood_reset_w((~data >> 6) & 1);
350349
351350   /* unline the other games, the STROBE is in the high bit instead of the low bit */
352   soundsgood_data_w(offset, (data << 1) | (data >> 7));
351   soundsgood_data_w(machine, offset, (data << 1) | (data >> 7));
353352}
354353
355354
r1877r1878
362361
363362static READ8_HANDLER( spyhunt_ip1_r )
364363{
365   return readinputportbytag("SSIO.IP1") | (csdeluxe_status_r(0) << 5);
364   return readinputportbytag("SSIO.IP1") | (csdeluxe_status_r(machine, 0) << 5);
366365}
367366
368367
r1877r1878
406405   last_op4 = data;
407406
408407   /* low 5 bits go to control the Chip Squeak Deluxe */
409   csdeluxe_data_w(offset, data);
408   csdeluxe_data_w(machine, offset, data);
410409}
411410
412411
r1877r1878
423422   if (input_mux)
424423      return readinputportbytag("SSIO.IP2.ALT");
425424
426   return readinputportbytag("SSIO.IP2") + 5 * (cpu_getcurrentframe() & 1);
425   return readinputportbytag("SSIO.IP2") + 5 * (video_screen_get_frame_number(0) & 1);
427426}
428427
429428
r1877r1878
10551054   /* basic machine hardware */
10561055   MDRV_CPU_ADD_TAG("main", Z80, MASTER_CLOCK/4)
10571056   MDRV_CPU_CONFIG(mcr_daisy_chain)
1058   MDRV_CPU_VBLANK_INT(mcr_interrupt,2)
1057   MDRV_CPU_VBLANK_INT_HACK(mcr_interrupt,2)
10591058
10601059   MDRV_WATCHDOG_VBLANK_INIT(16)
10611060   MDRV_MACHINE_START(mcr)
src/mame/drivers/pipeline.c
r1877r1878
357357
358358   MDRV_CPU_ADD(Z80, 7372800/2)
359359   MDRV_CPU_PROGRAM_MAP(cpu0_mem, 0)
360   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
360   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
361361
362362   MDRV_CPU_ADD(Z80, 7372800/2)
363363   MDRV_CPU_CONFIG(daisy_chain_sound)
src/mame/drivers/pengo.c
r1877r1878
348348   /* basic machine hardware */
349349   MDRV_CPU_ADD_TAG("main", Z80, MASTER_CLOCK/6)
350350   MDRV_CPU_PROGRAM_MAP(pengo_map,0)
351   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
351   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
352352
353353   /* video hardware */
354354   MDRV_GFXDECODE(pengo)
src/mame/drivers/stadhero.c
r1877r1878
5252      case 4: /* Interrupt ack (VBL - IRQ 5) */
5353         break;
5454      case 6: /* 6502 sound cpu */
55         soundlatch_w(0,data & 0xff);
56         cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
55         soundlatch_w(machine,0,data & 0xff);
56         cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
5757         break;
5858      default:
5959         logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",activecpu_get_pc(),data,0x30c010+offset);
r1877r1878
8282{
8383   switch (offset) {
8484   case 0:
85      YM3812_control_port_0_w(0,data);
85      YM3812_control_port_0_w(machine,0,data);
8686      break;
8787   case 1:
88      YM3812_write_port_0_w(0,data);
88      YM3812_write_port_0_w(machine,0,data);
8989      break;
9090   }
9191}
r1877r1878
9494{
9595   switch (offset) {
9696   case 0:
97      YM2203_control_port_0_w(0,data);
97      YM2203_control_port_0_w(machine,0,data);
9898      break;
9999   case 1:
100      YM2203_write_port_0_w(0,data);
100      YM2203_write_port_0_w(machine,0,data);
101101      break;
102102   }
103103}
r1877r1878
259259   /* basic machine hardware */
260260   MDRV_CPU_ADD(M68000, 10000000)
261261   MDRV_CPU_PROGRAM_MAP(main_map,0)
262   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)/* VBL */
262   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)/* VBL */
263263
264264   MDRV_CPU_ADD(M6502, 1500000)
265265   /* audio CPU */
src/mame/drivers/prehisle.c
r1877r1878
2929
3030static WRITE16_HANDLER( prehisle_sound16_w )
3131{
32   soundlatch_w(0, data & 0xff);
33   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
32   soundlatch_w(machine, 0, data & 0xff);
33   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
3434}
3535
3636/*******************************************************************************/
r1877r1878
237237   /* basic machine hardware */
238238   MDRV_CPU_ADD(M68000, 12000000)
239239   MDRV_CPU_PROGRAM_MAP(prehisle_readmem,prehisle_writemem)
240   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
240   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
241241
242242   MDRV_CPU_ADD(Z80, 4000000)
243243   /* audio CPU */
r1877r1878
261261   /* sound hardware */
262262   MDRV_SPEAKER_STANDARD_MONO("mono")
263263
264   MDRV_SOUND_ADD(YM3812, 4000000)
264   MDRV_SOUND_ADD(YM3812, XTAL_4MHz)   /* verified on pcb */
265265   MDRV_SOUND_CONFIG(ym3812_interface)
266266   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
267267
src/mame/drivers/simpsons.c
r1877r1878
279279   /* basic machine hardware */
280280   MDRV_CPU_ADD(KONAMI, XTAL_24MHz/2/4) /* pin 18 of konami cpu is 12Mhz, while pin 17 is 3mhz. Clock probably divided internally by 4  */
281281   MDRV_CPU_PROGRAM_MAP(main_map,0)
282   MDRV_CPU_VBLANK_INT(simpsons_irq,1)   /* IRQ triggered by the 052109, FIRQ by the sprite hardware */
282   MDRV_CPU_VBLANK_INT("main", simpsons_irq)   /* IRQ triggered by the 052109, FIRQ by the sprite hardware */
283283
284284   MDRV_CPU_ADD(Z80, XTAL_3_579545MHz)   /* verified on pcb */
285285   MDRV_CPU_PROGRAM_MAP(z80_map,0)
src/mame/drivers/marvins.c
r1877r1878
110110static WRITE8_HANDLER( sound_command_w )
111111{
112112   sound_cpu_busy = snk_sound_busy_bit;
113   soundlatch_w(0, data);
114   cpunum_set_input_line(Machine, 2, 0, HOLD_LINE);
113   soundlatch_w(machine, 0, data);
114   cpunum_set_input_line(machine, 2, 0, HOLD_LINE);
115115}
116116
117117static READ8_HANDLER( sound_command_r )
118118{
119119   sound_cpu_busy = 0;
120   return(soundlatch_r(0));
120   return(soundlatch_r(machine,0));
121121}
122122
123123static READ8_HANDLER( sound_nmi_ack_r )
r1877r1878
129129/* this input port has one of its bits mapped to sound CPU status */
130130static READ8_HANDLER( marvins_port_0_r )
131131{
132   return(input_port_0_r(0) | sound_cpu_busy);
132   return(input_port_0_r(machine,0) | sound_cpu_busy);
133133}
134134
135135static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
513513   /* basic machine hardware */
514514   MDRV_CPU_ADD(Z80, 3360000)   /* 3.36 MHz */
515515   MDRV_CPU_PROGRAM_MAP(marvins_cpuA_map,0)
516   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
516   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
517517
518518   MDRV_CPU_ADD(Z80, 3360000)   /* 3.36 MHz */
519519   MDRV_CPU_PROGRAM_MAP(marvins_cpuB_map,0)
520   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
520   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
521521
522522   MDRV_CPU_ADD(Z80, 4000000)   /* 4.0 MHz */
523523   /* audio CPU */
r1877r1878
563563   /* basic machine hardware */
564564   MDRV_CPU_ADD_TAG("main", Z80, 3360000)   /* 3.36 MHz */
565565   MDRV_CPU_PROGRAM_MAP(madcrash_cpuA_map,0)
566   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
566   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
567567
568568   MDRV_CPU_ADD_TAG("sub", Z80, 3360000)   /* 3.36 MHz */
569569   MDRV_CPU_PROGRAM_MAP(madcrash_cpuB_map,0)
570   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
570   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
571571
572572   MDRV_CPU_ADD(Z80, 4000000)   /* 4.0 MHz */
573573   /* audio CPU */
r1877r1878
614614   MDRV_IMPORT_FROM( vangrd2 )
615615
616616   MDRV_CPU_MODIFY("main")
617   MDRV_CPU_VBLANK_INT(0, 0)
617   MDRV_CPU_VBLANK_INT_HACK(0, 0)
618618
619619   MDRV_CPU_MODIFY("sub")
620   MDRV_CPU_VBLANK_INT(snk_irq_BA, 1)
620   MDRV_CPU_VBLANK_INT("main", snk_irq_BA)
621621
622622   MDRV_INTERLEAVE(300)
623623
src/mame/drivers/wwfsstar.c
r1877r1878
144144
145145static WRITE16_HANDLER ( wwfsstar_soundwrite )
146146{
147   soundlatch_w(1,data & 0xff);
148   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE );
147   soundlatch_w(machine,1,data & 0xff);
148   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE );
149149}
150150
151151static WRITE16_HANDLER( wwfsstar_flipscreen_w )
r1877r1878
362362   /* basic machine hardware */
363363   MDRV_CPU_ADD(M68000, 10000000)
364364   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
365   MDRV_CPU_VBLANK_INT(wwfsstars_interrupt,272)
365   MDRV_CPU_VBLANK_INT_HACK(wwfsstars_interrupt,272)
366366
367367   MDRV_CPU_ADD(Z80, 3579545)
368368   MDRV_CPU_PROGRAM_MAP(readmem_sound,writemem_sound)
src/mame/drivers/model1.c
r1877r1878
822822static WRITE16_HANDLER(p_w)
823823{
824824   UINT16 old = paletteram16[offset];
825   paletteram16_xBBBBBGGGGGRRRRR_word_w(offset, data, mem_mask);
825   paletteram16_xBBBBBGGGGGRRRRR_word_w(machine, offset, data, mem_mask);
826826   if(0 && paletteram16[offset] != old)
827827      logerror("XVIDEO: p_w %x, %04x @ %04x (%x)\n", offset, data, mem_mask, activecpu_get_pc());
828828}
r1877r1878
10001000
10011001static READ16_HANDLER( m1_snd_mpcm0_r )
10021002{
1003   return MultiPCM_reg_0_r(0);
1003   return MultiPCM_reg_0_r(machine, 0);
10041004}
10051005
10061006static WRITE16_HANDLER( m1_snd_mpcm0_w )
10071007{
1008   MultiPCM_reg_0_w(offset, data);
1008   MultiPCM_reg_0_w(machine, offset, data);
10091009}
10101010
10111011static WRITE16_HANDLER( m1_snd_mpcm0_bnk_w )
r1877r1878
10151015
10161016static READ16_HANDLER( m1_snd_mpcm1_r )
10171017{
1018   return MultiPCM_reg_1_r(0);
1018   return MultiPCM_reg_1_r(machine, 0);
10191019}
10201020
10211021static WRITE16_HANDLER( m1_snd_mpcm1_w )
10221022{
1023   MultiPCM_reg_1_w(offset, data);
1023   MultiPCM_reg_1_w(machine, offset, data);
10241024}
10251025
10261026static WRITE16_HANDLER( m1_snd_mpcm1_bnk_w )
r1877r1878
10301030
10311031static READ16_HANDLER( m1_snd_ym_r )
10321032{
1033   return YM3438_status_port_0_A_r(0);
1033   return YM3438_status_port_0_A_r(machine, 0);
10341034}
10351035
10361036static WRITE16_HANDLER( m1_snd_ym_w )
r1877r1878
10381038   switch (offset)
10391039   {
10401040      case 0:
1041         YM3438_control_port_0_A_w(0, data);
1041         YM3438_control_port_0_A_w(machine, 0, data);
10421042         break;
10431043
10441044      case 1:
1045         YM3438_data_port_0_A_w(0, data);
1045         YM3438_data_port_0_A_w(machine, 0, data);
10461046         break;
10471047
10481048      case 2:
1049         YM3438_control_port_0_B_w(0, data);
1049         YM3438_control_port_0_B_w(machine, 0, data);
10501050         break;
10511051
10521052      case 3:
1053         YM3438_data_port_0_B_w(0, data);
1053         YM3438_data_port_0_B_w(machine, 0, data);
10541054         break;
10551055   }
10561056}
r1877r1878
15341534   MDRV_CPU_ADD(V60, 16000000)
15351535   MDRV_CPU_PROGRAM_MAP(model1_mem, 0)
15361536   MDRV_CPU_IO_MAP(model1_io, 0)
1537   MDRV_CPU_VBLANK_INT(model1_interrupt, 2)
1537   MDRV_CPU_VBLANK_INT_HACK(model1_interrupt, 2)
15381538
15391539   MDRV_CPU_ADD(M68000, 10000000)   // verified on real h/w
15401540   MDRV_CPU_PROGRAM_MAP(model1_snd, 0)
r1877r1878
15801580   MDRV_CPU_ADD(V60, 16000000)
15811581   MDRV_CPU_PROGRAM_MAP(model1_vr_mem, 0)
15821582   MDRV_CPU_IO_MAP(model1_vr_io, 0)
1583   MDRV_CPU_VBLANK_INT(model1_interrupt, 2)
1583   MDRV_CPU_VBLANK_INT_HACK(model1_interrupt, 2)
15841584
15851585   MDRV_CPU_ADD(M68000, 10000000)   // verified on real h/w
15861586   MDRV_CPU_PROGRAM_MAP(model1_snd, 0)
src/mame/drivers/actfancr.c
r1877r1878
8484
8585static WRITE8_HANDLER( actfancr_sound_w )
8686{
87   soundlatch_w(0,data & 0xff);
88   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
87   soundlatch_w(machine,0,data & 0xff);
88   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
8989}
9090
9191/******************************************************************************/
r1877r1878
352352   /* basic machine hardware */
353353   MDRV_CPU_ADD(H6280,21477200/3) /* Should be accurate */
354354   MDRV_CPU_PROGRAM_MAP(actfan_map,0)
355   MDRV_CPU_VBLANK_INT(irq0_line_hold,1) /* VBL */
355   MDRV_CPU_VBLANK_INT("main", irq0_line_hold) /* VBL */
356356
357357   MDRV_CPU_ADD(M6502, 1500000)
358358   /* audio CPU */ /* Should be accurate */
r1877r1878
396396   /* basic machine hardware */
397397   MDRV_CPU_ADD(H6280,XTAL_21_4772MHz/3) /* XIN=21.4772Mhz, verified on pcb */
398398   MDRV_CPU_PROGRAM_MAP(triothep_map,0)
399   MDRV_CPU_VBLANK_INT(irq0_line_hold,1) /* VBL */
399   MDRV_CPU_VBLANK_INT("main", irq0_line_hold) /* VBL */
400400
401401   MDRV_CPU_ADD(M6502, XTAL_12MHz/8) /* verified on pcb */
402402   /* audio CPU */ /* Should be accurate */
src/mame/drivers/polepos.c
r1877r1878
327327      case 0x00:   /* IRQON */
328328         cpu_interrupt_enable(0,bit);
329329         if (!bit)
330            cpunum_set_input_line(Machine, 0, 0, CLEAR_LINE);
330            cpunum_set_input_line(machine, 0, 0, CLEAR_LINE);
331331         break;
332332
333333      case 0x01:   /* IOSEL */
r1877r1878
338338         polepos_sound_enable(bit);
339339         if (!bit)
340340         {
341            polepos_engine_sound_lsb_w(0,0);
342            polepos_engine_sound_msb_w(0,0);
341            polepos_engine_sound_lsb_w(machine,0,0);
342            polepos_engine_sound_msb_w(machine,0,0);
343343         }
344344         break;
345345
r1877r1878
348348         break;
349349
350350      case 0x04:   /* RESB */
351         cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE);
351         cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE);
352352         break;
353353
354354      case 0x05:   /* RESA */
355         cpunum_set_input_line(Machine, 2, INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE);
355         cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE);
356356         break;
357357
358358      case 0x06:   /* SB0 */
r1877r1878
360360         break;
361361
362362      case 0x07:   /* CHACL */
363         polepos_chacl_w(offset,data);
363         polepos_chacl_w(machine,offset,data);
364364         break;
365365   }
366366}
r1877r1878
417417
418418   /* Reset all latches */
419419   for (i = 0;i < 8;i++)
420      polepos_latch_w(i,0);
420      polepos_latch_w(machine,i,0);
421421
422422   namco_06xx_init(0, 0,
423423      NAMCOIO_51XX, &intf0,
r1877r1878
882882   MDRV_CPU_ADD(Z80, 24576000/8)   /* 3.072 MHz */
883883   MDRV_CPU_PROGRAM_MAP(z80_map,0)
884884   MDRV_CPU_IO_MAP(z80_io,0)
885   MDRV_CPU_VBLANK_INT(irq0_line_assert,2)   /* 64V */
885   MDRV_CPU_VBLANK_INT_HACK(irq0_line_assert,2)   /* 64V */
886886
887887   MDRV_CPU_ADD(Z8000, 24576000/8)   /* 3.072 MHz */
888888   MDRV_CPU_PROGRAM_MAP(z8002_map,0)
889   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
889   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
890890
891891   MDRV_CPU_ADD(Z8000, 24576000/8)   /* 3.072 MHz */
892892   MDRV_CPU_PROGRAM_MAP(z8002_map,0)
893   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
893   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
894894
895895   MDRV_CPU_ADD_TAG(CPUTAG_54XX, MB8844, 18432000/12/6)   /* 1.536 MHz, internally divided by 6 */
896896   MDRV_CPU_PROGRAM_MAP(namco_54xx_map_program,0)
src/mame/drivers/taito_b.c
r1877r1878
328328
329329static READ16_HANDLER( tracky1_hi_r )
330330{
331   return input_port_5_word_r(0,0);
331   return input_port_5_word_r(machine,0,0);
332332}
333333static READ16_HANDLER( tracky1_lo_r )
334334{
335   return (input_port_5_word_r(0,0) & 0xff) <<8;
335   return (input_port_5_word_r(machine,0,0) & 0xff) <<8;
336336}
337337static READ16_HANDLER( trackx1_hi_r )
338338{
339   return input_port_6_word_r(0,0);
339   return input_port_6_word_r(machine,0,0);
340340}
341341static READ16_HANDLER( trackx1_lo_r )
342342{
343   return (input_port_6_word_r(0,0) & 0xff) <<8;
343   return (input_port_6_word_r(machine,0,0) & 0xff) <<8;
344344}
345345static READ16_HANDLER( tracky2_hi_r )
346346{
347   return input_port_7_word_r(0,0);
347   return input_port_7_word_r(machine,0,0);
348348}
349349static READ16_HANDLER( tracky2_lo_r )
350350{
351   return (input_port_7_word_r(0,0) & 0xff) <<8;
351   return (input_port_7_word_r(machine,0,0) & 0xff) <<8;
352352}
353353static READ16_HANDLER( trackx2_hi_r )
354354{
355   return input_port_8_word_r(0,0);
355   return input_port_8_word_r(machine,0,0);
356356}
357357static READ16_HANDLER( trackx2_lo_r )
358358{
359   return (input_port_8_word_r(0,0) & 0xff) <<8;
359   return (input_port_8_word_r(machine,0,0) & 0xff) <<8;
360360}
361361
362362
r1877r1878
413413   int res;
414414
415415   res = (EEPROM_read_bit() & 0x01);
416   res |= input_port_1_word_r(0,0) & 0xfe; /* coin inputs */
416   res |= input_port_1_word_r(machine,0,0) & 0xfe; /* coin inputs */
417417
418418   return res;
419419}
r1877r1878
482482   switch (offset)
483483   {
484484      case 0x01:
485         return eeprom_r(0,mem_mask) << 8;
485         return eeprom_r(machine,0,mem_mask) << 8;
486486
487487      default:
488         return TC0640FIO_r( offset ) << 8;
488         return TC0640FIO_r( machine,offset ) << 8;
489489   }
490490}
491491
r1877r1878
26412641   /* basic machine hardware */
26422642   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
26432643   MDRV_CPU_PROGRAM_MAP(rastsag2_readmem,rastsag2_writemem)
2644   MDRV_CPU_VBLANK_INT(rastansaga2_interrupt,1)
2644   MDRV_CPU_VBLANK_INT("main", rastansaga2_interrupt)
26452645
26462646   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz */
26472647   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
r1877r1878
26792679   /* basic machine hardware */
26802680   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
26812681   MDRV_CPU_PROGRAM_MAP(rastsag2_readmem,rastsag2_writemem)
2682   MDRV_CPU_VBLANK_INT(rastansaga2_interrupt,1)
2682   MDRV_CPU_VBLANK_INT("main", rastansaga2_interrupt)
26832683
26842684   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz */
26852685   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
r1877r1878
27172717   /* basic machine hardware */
27182718   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
27192719   MDRV_CPU_PROGRAM_MAP(crimec_readmem,crimec_writemem)
2720   MDRV_CPU_VBLANK_INT(crimec_interrupt,1)
2720   MDRV_CPU_VBLANK_INT("main", crimec_interrupt)
27212721
27222722   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz */
27232723   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
r1877r1878
27552755   /* basic machine hardware */
27562756   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz ???*/
27572757   MDRV_CPU_PROGRAM_MAP(tetrist_readmem,tetrist_writemem)
2758   MDRV_CPU_VBLANK_INT(rastansaga2_interrupt,1)
2758   MDRV_CPU_VBLANK_INT("main", rastansaga2_interrupt)
27592759
27602760   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz */
27612761   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
r1877r1878
27922792   /* basic machine hardware */
27932793   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
27942794   MDRV_CPU_PROGRAM_MAP(tetrista_readmem,tetrista_writemem)
2795   MDRV_CPU_VBLANK_INT(masterw_interrupt,1)
2795   MDRV_CPU_VBLANK_INT("main", masterw_interrupt)
27962796
27972797   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz */
27982798   MDRV_CPU_PROGRAM_MAP(masterw_sound_readmem,masterw_sound_writemem)
r1877r1878
28302830   /* basic machine hardware */
28312831   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
28322832   MDRV_CPU_PROGRAM_MAP(hitice_readmem, hitice_writemem)
2833   MDRV_CPU_VBLANK_INT(hitice_interrupt,1)
2833   MDRV_CPU_VBLANK_INT("main", hitice_interrupt)
28342834
28352835   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz */
28362836   MDRV_CPU_PROGRAM_MAP(viofight_sound_readmem, viofight_sound_writemem)
r1877r1878
28742874   /* basic machine hardware */
28752875   MDRV_CPU_ADD(M68000, XTAL_24MHz/2)   /* verified on pcb */
28762876   MDRV_CPU_PROGRAM_MAP(rambo3_readmem,rambo3_writemem)
2877   MDRV_CPU_VBLANK_INT(rambo3_interrupt,1)
2877   MDRV_CPU_VBLANK_INT("main", rambo3_interrupt)
28782878
28792879   MDRV_CPU_ADD(Z80, XTAL_24MHz/6)   /* verified on pcb */
28802880   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
r1877r1878
29122912   /* basic machine hardware */
29132913   MDRV_CPU_ADD(M68000, XTAL_24MHz/2)   /* verified on pcb */
29142914   MDRV_CPU_PROGRAM_MAP(rambo3_readmem,rambo3_writemem)
2915   MDRV_CPU_VBLANK_INT(rambo3_interrupt,1)
2915   MDRV_CPU_VBLANK_INT("main", rambo3_interrupt)
29162916
29172917   MDRV_CPU_ADD(Z80, XTAL_24MHz/6)   /* verified on pcb */
29182918   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
r1877r1878
29502950   /* basic machine hardware */
29512951   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
29522952   MDRV_CPU_PROGRAM_MAP(pbobble_readmem,pbobble_writemem)
2953   MDRV_CPU_VBLANK_INT(pbobble_interrupt,1)
2953   MDRV_CPU_VBLANK_INT("main", pbobble_interrupt)
29542954
29552955   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz */
29562956   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
r1877r1878
29912991   /* basic machine hardware */
29922992   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
29932993   MDRV_CPU_PROGRAM_MAP(spacedx_readmem,spacedx_writemem)
2994   MDRV_CPU_VBLANK_INT(pbobble_interrupt,1)
2994   MDRV_CPU_VBLANK_INT("main", pbobble_interrupt)
29952995
29962996   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz */
29972997   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
r1877r1878
30323032   /* basic machine hardware */
30333033   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
30343034   MDRV_CPU_PROGRAM_MAP(spacedxo_readmem,spacedxo_writemem)
3035   MDRV_CPU_VBLANK_INT(selfeena_interrupt,1)
3035   MDRV_CPU_VBLANK_INT("main", selfeena_interrupt)
30363036
30373037   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz */
30383038   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
r1877r1878
30703070   /* basic machine hardware */
30713071   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz according to the readme*/
30723072   MDRV_CPU_PROGRAM_MAP(qzshowby_readmem,qzshowby_writemem)
3073   MDRV_CPU_VBLANK_INT(pbobble_interrupt,1)
3073   MDRV_CPU_VBLANK_INT("main", pbobble_interrupt)
30743074
30753075   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz */
30763076   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
r1877r1878
31113111   /* basic machine hardware */
31123112   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
31133113   MDRV_CPU_PROGRAM_MAP(viofight_readmem,viofight_writemem)
3114   MDRV_CPU_VBLANK_INT(viofight_interrupt,1)
3114   MDRV_CPU_VBLANK_INT("main", viofight_interrupt)
31153115
31163116   MDRV_CPU_ADD(Z80, 6000000)   /* 6 MHz verified */
31173117   MDRV_CPU_PROGRAM_MAP(viofight_sound_readmem, viofight_sound_writemem)
r1877r1878
31533153   /* basic machine hardware */
31543154   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
31553155   MDRV_CPU_PROGRAM_MAP(masterw_readmem,masterw_writemem)
3156   MDRV_CPU_VBLANK_INT(masterw_interrupt,1)
3156   MDRV_CPU_VBLANK_INT("main", masterw_interrupt)
31573157
31583158   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz */
31593159   MDRV_CPU_PROGRAM_MAP(masterw_sound_readmem,masterw_sound_writemem)
r1877r1878
31923192   /* basic machine hardware */
31933193   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz ??? */
31943194   MDRV_CPU_PROGRAM_MAP(silentd_readmem,silentd_writemem)
3195   MDRV_CPU_VBLANK_INT(silentd_interrupt,1)
3195   MDRV_CPU_VBLANK_INT("main", silentd_interrupt)
31963196
31973197   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz */
31983198   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
r1877r1878
32303230   /* basic machine hardware */
32313231   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
32323232   MDRV_CPU_PROGRAM_MAP(selfeena_readmem,selfeena_writemem)
3233   MDRV_CPU_VBLANK_INT(selfeena_interrupt,1)
3233   MDRV_CPU_VBLANK_INT("main", selfeena_interrupt)
32343234
32353235   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz */
32363236   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
r1877r1878
32773277   /* basic machine hardware */
32783278   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
32793279   MDRV_CPU_PROGRAM_MAP(selfeena_readmem,selfeena_writemem)
3280   MDRV_CPU_VBLANK_INT(selfeena_interrupt,1)
3280   MDRV_CPU_VBLANK_INT("main", selfeena_interrupt)
32813281
32823282   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz */
32833283   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
r1877r1878
33223322   /* basic machine hardware */
33233323   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
33243324   MDRV_CPU_PROGRAM_MAP(sbm_readmem,sbm_writemem)
3325   MDRV_CPU_VBLANK_INT(sbm_interrupt,1)
3325   MDRV_CPU_VBLANK_INT("main", sbm_interrupt)
33263326
33273327   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz */
33283328   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
src/mame/drivers/jackal.c
r1877r1878
259259   // basic machine hardware
260260   MDRV_CPU_ADD(M6809, MASTER_CLOCK/12) // verified on pcb
261261   MDRV_CPU_PROGRAM_MAP(master_map, 0)
262   MDRV_CPU_VBLANK_INT(jackal_interrupt, 1)
262   MDRV_CPU_VBLANK_INT("main", jackal_interrupt)
263263
264264   MDRV_CPU_ADD(M6809, MASTER_CLOCK/12) // verified on pcb
265265   MDRV_CPU_PROGRAM_MAP(slave_map, 0)
src/mame/drivers/tank8.c
r1877r1878
4141{
4242   collision_index &= ~0x3f;
4343
44   cpunum_set_input_line(Machine, 0, 0, CLEAR_LINE);
44   cpunum_set_input_line(machine, 0, 0, CLEAR_LINE);
4545}
4646
4747static WRITE8_HANDLER( tank8_crash_w )
4848{
49   discrete_sound_w(TANK8_CRASH_EN, data);
49   discrete_sound_w(machine, TANK8_CRASH_EN, data);
5050}
5151
5252static WRITE8_HANDLER( tank8_explosion_w )
5353{
54   discrete_sound_w(TANK8_EXPLOSION_EN, data);
54   discrete_sound_w(machine, TANK8_EXPLOSION_EN, data);
5555}
5656
5757static WRITE8_HANDLER( tank8_bugle_w )
5858{
59   discrete_sound_w(TANK8_BUGLE_EN, data);
59   discrete_sound_w(machine, TANK8_BUGLE_EN, data);
6060}
6161
6262static WRITE8_HANDLER( tank8_bug_w )
r1877r1878
6464   /* D0 and D1 determine the on/off time off the square wave */
6565   switch(data & 3) {
6666      case 0:
67         discrete_sound_w(TANK8_BUGLE_DATA1,8.0);
68         discrete_sound_w(TANK8_BUGLE_DATA2,4.0);
67         discrete_sound_w(machine, TANK8_BUGLE_DATA1,8.0);
68         discrete_sound_w(machine, TANK8_BUGLE_DATA2,4.0);
6969         break;
7070      case 1:
71         discrete_sound_w(TANK8_BUGLE_DATA1,8.0);
72         discrete_sound_w(TANK8_BUGLE_DATA2,7.0);
71         discrete_sound_w(machine, TANK8_BUGLE_DATA1,8.0);
72         discrete_sound_w(machine, TANK8_BUGLE_DATA2,7.0);
7373         break;
7474      case 2:
75         discrete_sound_w(TANK8_BUGLE_DATA1,8.0);
76         discrete_sound_w(TANK8_BUGLE_DATA2,2.0);
75         discrete_sound_w(machine, TANK8_BUGLE_DATA1,8.0);
76         discrete_sound_w(machine, TANK8_BUGLE_DATA2,2.0);
7777         break;
7878      case 3:
79         discrete_sound_w(TANK8_BUGLE_DATA1,16.0);
80         discrete_sound_w(TANK8_BUGLE_DATA2,4.0);
79         discrete_sound_w(machine, TANK8_BUGLE_DATA1,16.0);
80         discrete_sound_w(machine, TANK8_BUGLE_DATA2,4.0);
8181         break;
8282   }
8383
r1877r1878
8585
8686static WRITE8_HANDLER( tank8_attract_w )
8787{
88   discrete_sound_w(TANK8_ATTRACT_EN, data);
88   discrete_sound_w(machine, TANK8_ATTRACT_EN, data);
8989}
9090
9191static WRITE8_HANDLER( tank8_motor_w )
9292{
93   discrete_sound_w(TANK8_MOTOR1_EN+offset, data);
93   discrete_sound_w(machine, TANK8_MOTOR1_EN+offset, data);
9494}
9595
9696static ADDRESS_MAP_START( tank8_cpu_map, ADDRESS_SPACE_PROGRAM, 8 )
src/mame/drivers/viper.c
r1877r1878
8181
8282static READ64_HANDLER( pci_config_addr_r )
8383{
84   return pci_64be_r(0, U64(0x00000000ffffffff));
84   return pci_64be_r(machine, 0, U64(0x00000000ffffffff));
8585}
8686
8787static WRITE64_HANDLER( pci_config_addr_w )
8888{
89   pci_64be_w(0, data, U64(0x00000000ffffffff));
89   pci_64be_w(machine, 0, data, U64(0x00000000ffffffff));
9090}
9191
9292static READ64_HANDLER( pci_config_data_r )
9393{
94   return pci_64be_r(1, U64(0xffffffff00000000)) << 32;
94   return pci_64be_r(machine, 1, U64(0xffffffff00000000)) << 32;
9595}
9696
9797static WRITE64_HANDLER( pci_config_data_w )
9898{
99   pci_64be_w(1, data >> 32, U64(0xffffffff00000000));
99   pci_64be_w(machine, 1, data >> 32, U64(0xffffffff00000000));
100100}
101101
102102
r1877r1878
153153
154154static READ64_HANDLER(epic_64be_r)
155155{
156   return read64be_with_32le_handler(epic_r, offset, mem_mask);
156   return read64be_with_32le_handler(epic_r, machine, offset, mem_mask);
157157}
158158static WRITE64_HANDLER(epic_64be_w)
159159{
160   write64be_with_32le_handler(epic_w, offset, data, mem_mask);
160   write64be_with_32le_handler(epic_w, machine, offset, data, mem_mask);
161161}
162162
163163
r1877r1878
529529
530530static READ64_HANDLER(voodoo3_io_r)
531531{
532   return read64be_with_32le_handler(banshee_io_0_r, offset, mem_mask);
532   return read64be_with_32le_handler(banshee_io_0_r, machine, offset, mem_mask);
533533}
534534static WRITE64_HANDLER(voodoo3_io_w)
535535{
536536//  printf("voodoo3_io_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, activecpu_get_pc());
537   write64be_with_32le_handler(banshee_io_0_w, offset, data, mem_mask);
537   write64be_with_32le_handler(banshee_io_0_w, machine, offset, data, mem_mask);
538538}
539539
540540static READ64_HANDLER(voodoo3_r)
541541{
542   return read64be_with_32le_handler(banshee_0_r, offset, mem_mask);
542   return read64be_with_32le_handler(banshee_0_r, machine, offset, mem_mask);
543543}
544544static WRITE64_HANDLER(voodoo3_w)
545545{
546546//  printf("voodoo3_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, activecpu_get_pc());
547   write64be_with_32le_handler(banshee_0_w, offset, data, mem_mask);
547   write64be_with_32le_handler(banshee_0_w, machine,  offset, data, mem_mask);
548548}
549549
550550static READ64_HANDLER(voodoo3_lfb_r)
551551{
552   return read64be_with_32le_handler(banshee_fb_0_r, offset, mem_mask);
552   return read64be_with_32le_handler(banshee_fb_0_r, machine, offset, mem_mask);
553553}
554554static WRITE64_HANDLER(voodoo3_lfb_w)
555555{
556556//  printf("voodoo3_lfb_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, activecpu_get_pc());
557   write64be_with_32le_handler(banshee_fb_0_w, offset, data, mem_mask);
557   write64be_with_32le_handler(banshee_fb_0_w, machine, offset, data, mem_mask);
558558}
559559
560560
r1877r1878
565565
566566   if ((mem_mask & U64(0xffffffff00000000)) != U64(0xffffffff00000000))
567567   {
568      r |= (UINT64)timekeeper_0_32be_r((offset * 2) + 0, (UINT32)(mem_mask >> 32)) << 32;
568      r |= (UINT64)timekeeper_0_32be_r(machine, (offset * 2) + 0, (UINT32)(mem_mask >> 32)) << 32;
569569   }
570570   if ((mem_mask & U64(0x00000000ffffffff)) != U64(0x00000000ffffffff))
571571   {
572      r |= timekeeper_0_32be_r((offset * 2) + 1, (UINT32)(mem_mask));
572      r |= timekeeper_0_32be_r(machine, (offset * 2) + 1, (UINT32)(mem_mask));
573573   }
574574
575575   return r;
r1877r1878
579579{
580580   if (!(mem_mask & U64(0xffffffff00000000)))
581581   {
582      timekeeper_0_32be_w((offset * 2) + 0, (UINT32)(data >> 32), (UINT32)(mem_mask >> 32));
582      timekeeper_0_32be_w(machine, (offset * 2) + 0, (UINT32)(data >> 32), (UINT32)(mem_mask >> 32));
583583   }
584584   if (!(mem_mask & U64(0x00000000ffffffff)))
585585   {
586      timekeeper_0_32be_w((offset * 2) + 1, (UINT32)(data), (UINT32)(mem_mask));
586      timekeeper_0_32be_w(machine, (offset * 2) + 1, (UINT32)(data), (UINT32)(mem_mask));
587587   }
588588}
589589
r1877r1878
636636   MDRV_CPU_ADD(MPC8240, 200000000)
637637   MDRV_CPU_CONFIG(viper_ppc_cfg)
638638   MDRV_CPU_PROGRAM_MAP(viper_map, 0)
639   MDRV_CPU_VBLANK_INT(viper_vblank, 1)
639   MDRV_CPU_VBLANK_INT("main", viper_vblank)
640640
641641   MDRV_MACHINE_RESET(viper)
642642
src/mame/drivers/paranoia.c
r1877r1878
3434****************************************************************************/
3535
3636#include "driver.h"
37#include "deprecat.h"
3738#include "machine/pcecommn.h"
3839#include "video/vdc.h"
3940#include "cpu/h6280/h6280.h"
r1877r1878
132133   MDRV_CPU_ADD(H6280, PCE_MAIN_CLOCK/3)
133134   MDRV_CPU_PROGRAM_MAP(pce_mem, 0)
134135   MDRV_CPU_IO_MAP(pce_io, 0)
135   MDRV_CPU_VBLANK_INT(pce_interrupt, VDC_LPF)
136   MDRV_CPU_VBLANK_INT_HACK(pce_interrupt, VDC_LPF)
136137
137138   MDRV_INTERLEAVE(1)
138139
r1877r1878
181182static DRIVER_INIT(paranoia)
182183{
183184   DRIVER_INIT_CALL(pce);
184};
185}
185186
186187GAME( 1990, paranoia, 0, paranoia, paranoia, paranoia, ROT0, "Naxat Soft", "Paranoia", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )
src/mame/drivers/mw8080bw.c
r1877r1878
141141****************************************************************************/
142142
143143#include "driver.h"
144#include "deprecat.h"
144145#include "rendlay.h"
145146#include "rescap.h"
146147#include "mw8080bw.h"
r1877r1878
163164
164165static READ8_HANDLER( mw8080bw_shift_result_rev_r )
165166{
166   UINT8 ret = mb14241_0_shift_result_r(0);
167   UINT8 ret = mb14241_0_shift_result_r(machine, 0);
167168
168169   return BITSWAP8(ret,0,1,2,3,4,5,6,7);
169170}
r1877r1878
175176
176177   if (rev_shift_res)
177178   {
178      ret = mw8080bw_shift_result_rev_r(0);
179      ret = mw8080bw_shift_result_rev_r(machine, 0);
179180   }
180181   else
181182   {
182      ret = mb14241_0_shift_result_r(0);
183      ret = mb14241_0_shift_result_r(machine, 0);
183184   }
184185
185186   return ret;
r1877r1878
187188
188189static WRITE8_HANDLER( mw8080bw_reversable_shift_count_w)
189190{
190   mb14241_0_shift_count_w(offset, data);
191   mb14241_0_shift_count_w(machine, offset, data);
191192
192193   rev_shift_res = data & 0x08;
193194}
r1877r1878
421422
422423static WRITE8_HANDLER( gunfight_io_w )
423424{
424   if (offset & 0x01)  gunfight_audio_w(0, data);
425   if (offset & 0x01)  gunfight_audio_w(machine, 0, data);
425426
426   if (offset & 0x02)  mb14241_0_shift_count_w(0, data);
427   if (offset & 0x02)  mb14241_0_shift_count_w(machine, 0, data);
427428
428   if (offset & 0x04)  mb14241_0_shift_data_w(0, data);
429   if (offset & 0x04)  mb14241_0_shift_data_w(machine, 0, data);
429430}
430431
431432
r1877r1878
610611
611612static WRITE8_HANDLER( tornbase_io_w )
612613{
613   if (offset & 0x01)  tornbase_audio_w(0, data);
614   if (offset & 0x01)  tornbase_audio_w(machine, 0, data);
614615
615   if (offset & 0x02)  mb14241_0_shift_count_w(0, data);
616   if (offset & 0x02)  mb14241_0_shift_count_w(machine, 0, data);
616617
617   if (offset & 0x04)  mb14241_0_shift_data_w(0, data);
618   if (offset & 0x04)  mb14241_0_shift_data_w(machine, 0, data);
618619}
619620
620621
r1877r1878
858859
859860static void maze_update_discrete(void)
860861{
861   maze_write_discrete(maze_tone_timing_state);
862   maze_write_discrete(Machine, maze_tone_timing_state);
862863}
863864
864865
865866static TIMER_CALLBACK( maze_tone_timing_timer_callback )
866867{
867868   maze_tone_timing_state = !maze_tone_timing_state;
868   maze_write_discrete(maze_tone_timing_state);
869   maze_write_discrete(machine, maze_tone_timing_state);
869870}
870871
871872
r1877r1878
895896
896897static WRITE8_HANDLER( maze_io_w )
897898{
898   if (offset & 0x01)  maze_coin_counter_w(0, data);
899   if (offset & 0x01)  maze_coin_counter_w(machine, 0, data);
899900
900   if (offset & 0x02)  watchdog_reset_w(0, data);
901   if (offset & 0x02)  watchdog_reset_w(machine, 0, data);
901902}
902903
903904
r1877r1878
10541055
10551056static WRITE8_HANDLER( checkmat_io_w )
10561057{
1057   if (offset & 0x01)  checkmat_audio_w(0, data);
1058   if (offset & 0x01)  checkmat_audio_w(machine, 0, data);
10581059
1059   if (offset & 0x02)  watchdog_reset_w(0, data);
1060   if (offset & 0x02)  watchdog_reset_w(machine, 0, data);
10601061}
10611062
10621063
r1877r1878
20952096{                              /* A7 A6 A5 A4 A3 A2 A1 A0 */
20962097   if ((offset & 0x07) == 0x02)
20972098   {
2098      watchdog_reset_w(0, data);      /* -  -  -  -  -  0  1  0 */
2099      watchdog_reset_w(machine, 0, data);      /* -  -  -  -  -  0  1  0 */
20992100   }
21002101   else if ((offset & 0x5f) == 0x01)
21012102   {
2102      spcenctr_audio_1_w(0, data);   /* -  0  -  0  0  0  0  1 */
2103      spcenctr_audio_1_w(machine, 0, data);   /* -  0  -  0  0  0  0  1 */
21032104   }
21042105   else if ((offset & 0x5f) == 0x09)
21052106   {
2106      spcenctr_audio_2_w(0, data);   /* -  0  -  0  1  0  0  1 */
2107      spcenctr_audio_2_w(machine, 0, data);   /* -  0  -  0  1  0  0  1 */
21072108   }
21082109   else if ((offset & 0x5f) == 0x11)
21092110   {
2110      spcenctr_audio_3_w(0, data);   /* -  0  -  1  0  0  0  1 */
2111      spcenctr_audio_3_w(machine, 0, data);   /* -  0  -  1  0  0  0  1 */
21112112   }
21122113   else if ((offset & 0x07) == 0x03)
21132114   {                           /* -  -  -  -  -  0  1  1 */
r1877r1878
23242325       anything unusual on the schematics that would cause
23252326       the bits to flip */
23262327
2327   return ~mb14241_0_shift_result_r(0);
2328   return ~mb14241_0_shift_result_r(machine,0);
23282329}
23292330
23302331
src/mame/drivers/namcos86.c
r1877r1878
283283   if (wdog == 3)
284284   {
285285      wdog = 0;
286      watchdog_reset_w(0,0);
286      watchdog_reset_w(machine,0,0);
287287   }
288288}
289289
r1877r1878
293293   if (wdog == 3)
294294   {
295295      wdog = 0;
296      watchdog_reset_w(0,0);
296      watchdog_reset_w(machine,0,0);
297297   }
298298}
299299
r1877r1878
331331         break;
332332
333333      case 4:
334         bankswitch1_ext_w(0,data);
334         bankswitch1_ext_w(machine,0,data);
335335         break;
336336
337337      case 5:   // not used?
r1877r1878
10661066   /* basic machine hardware */
10671067   MDRV_CPU_ADD_TAG("cpu1", M6809, 49152000/32)
10681068   MDRV_CPU_PROGRAM_MAP(cpu1_map,0)
1069   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
1069   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
10701070
10711071   MDRV_CPU_ADD_TAG("cpu2", M6809, 49152000/32)
10721072   MDRV_CPU_PROGRAM_MAP(hopmappy_cpu2_map,0)
1073   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
1073   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
10741074
10751075   MDRV_CPU_ADD_TAG("mcu", HD63701, 49152000/8)   /* or compatible 6808 with extra instructions */
10761076   MDRV_CPU_PROGRAM_MAP(hopmappy_mcu_map,0)
10771077   MDRV_CPU_IO_MAP(mcu_port_map,0)
1078   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   /* ??? */
1078   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   /* ??? */
10791079
10801080   MDRV_INTERLEAVE(800)   /* heavy interleaving needed to avoid hangs in rthunder */
10811081
src/mame/drivers/suna8.c
r1877r1878
659659   if (data & ~0x02)    logerror("CPU #0 - PC %04X: unknown palettebank bits: %02X\n",activecpu_get_pc(),data);
660660
661661   /* Also used as soundlatch - depending on c0c0? */
662   soundlatch_w(0,data);
662   soundlatch_w(machine,0,data);
663663}
664664
665665/*
r1877r1878
960960
961961static READ8_HANDLER( sparkman_c0a3_r )
962962{
963   return (cpu_getcurrentframe() & 1) ? 0x80 : 0;
963   return (video_screen_get_frame_number(0) & 1) ? 0x80 : 0;
964964}
965965
966966static ADDRESS_MAP_START( sparkman_readmem, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
15531553   MDRV_CPU_ADD(Z80, 24000000 / 4)         /* ? */
15541554   MDRV_CPU_PROGRAM_MAP(hardhead_readmem,hardhead_writemem)
15551555   MDRV_CPU_IO_MAP(hardhead_readport,hardhead_writeport)
1556   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   /* No NMI */
1556   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   /* No NMI */
15571557
15581558   MDRV_CPU_ADD(Z80, 24000000 / 4)
15591559   /* audio CPU */               /* ? */
15601560   MDRV_CPU_PROGRAM_MAP(hardhead_sound_readmem,hardhead_sound_writemem)
15611561   MDRV_CPU_IO_MAP(hardhead_sound_readport,hardhead_sound_writeport)
1562   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)   /* No NMI */
1562   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)   /* No NMI */
15631563
15641564   /* video hardware */
15651565   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
16081608   MDRV_CPU_ADD(Z80, 24000000 / 4)               /* ? */
16091609   MDRV_CPU_PROGRAM_MAP(rranger_readmem,rranger_writemem)
16101610   MDRV_CPU_IO_MAP(rranger_readport,rranger_writeport)
1611   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   /* IRQ & NMI ! */
1611   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   /* IRQ & NMI ! */
16121612
16131613   MDRV_CPU_ADD(Z80, 24000000 / 4)
16141614   /* audio CPU */               /* ? */
16151615   MDRV_CPU_PROGRAM_MAP(rranger_sound_readmem,rranger_sound_writemem)
16161616   MDRV_CPU_IO_MAP(rranger_sound_readport,rranger_sound_writeport)
1617   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)   /* NMI = retn */
1617   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)   /* NMI = retn */
16181618
16191619   /* video hardware */
16201620   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
16661666   MDRV_CPU_ADD_TAG("main", Z80, 24000000 / 4)      /* SUNA PROTECTION BLOCK */
16671667   MDRV_CPU_PROGRAM_MAP(brickzn_readmem,brickzn_writemem)
16681668   MDRV_CPU_IO_MAP(brickzn_readport,brickzn_writeport)
1669//  MDRV_CPU_VBLANK_INT(brickzn_interrupt, 2)
1670   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   // nmi breaks ramtest but is needed!
1669//  MDRV_CPU_VBLANK_INT_HACK(brickzn_interrupt, 2)
1670   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   // nmi breaks ramtest but is needed!
16711671
16721672   MDRV_CPU_ADD_TAG("sound", Z80, 24000000 / 4)   /* Z0840006PSC */
16731673   /* audio CPU */
r1877r1878
17361736
17371737static MACHINE_RESET( hardhea2 )
17381738{
1739   hardhea2_rambank_0_w(0,0);
1739   hardhea2_rambank_0_w(machine,0,0);
17401740}
17411741
17421742static MACHINE_DRIVER_START( hardhea2 )
r1877r1878
17441744   MDRV_IMPORT_FROM( brickzn )
17451745   MDRV_CPU_MODIFY("main")         /* SUNA T568009 */
17461746   MDRV_CPU_PROGRAM_MAP(hardhea2_readmem,hardhea2_writemem)
1747   MDRV_CPU_VBLANK_INT(hardhea2_interrupt,2)   /* IRQ & NMI */
1747   MDRV_CPU_VBLANK_INT_HACK(hardhea2_interrupt,2)   /* IRQ & NMI */
17481748
17491749   MDRV_MACHINE_RESET(hardhea2)
17501750   MDRV_PALETTE_LENGTH(256)
r1877r1878
17691769   MDRV_CPU_ADD(Z80, 24000000 / 4)               /* ? */
17701770   MDRV_CPU_PROGRAM_MAP(starfigh_readmem,starfigh_writemem)
17711771   MDRV_CPU_IO_MAP(starfigh_readport,starfigh_writeport)
1772   MDRV_CPU_VBLANK_INT(brickzn_interrupt,2)   /* IRQ & NMI */
1772   MDRV_CPU_VBLANK_INT_HACK(brickzn_interrupt,2)   /* IRQ & NMI */
17731773
17741774   /* The sound section is identical to that of hardhead */
17751775   MDRV_CPU_ADD(Z80, 24000000 / 4)
17761776   /* audio CPU */               /* ? */
17771777   MDRV_CPU_PROGRAM_MAP(hardhead_sound_readmem,hardhead_sound_writemem)
17781778   MDRV_CPU_IO_MAP(hardhead_sound_readport,hardhead_sound_writeport)
1779   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)   /* No NMI */
1779   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)   /* No NMI */
17801780
17811781   /* video hardware */
17821782   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
18291829   /* basic machine hardware */
18301830   MDRV_CPU_ADD(Z80, 24000000 / 4)               /* ? */
18311831   MDRV_CPU_PROGRAM_MAP(sparkman_readmem,sparkman_writemem)
1832   MDRV_CPU_VBLANK_INT(sparkman_interrupt,2)   /* IRQ & NMI */
1832   MDRV_CPU_VBLANK_INT_HACK(sparkman_interrupt,2)   /* IRQ & NMI */
18331833
18341834   MDRV_CPU_ADD(Z80, 24000000 / 4)
18351835   /* audio CPU */               /* ? */
18361836   MDRV_CPU_PROGRAM_MAP(hardhead_sound_readmem,hardhead_sound_writemem)
18371837   MDRV_CPU_IO_MAP(hardhead_sound_readport,hardhead_sound_writeport)
1838   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)   /* No NMI */
1838   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)   /* No NMI */
18391839
18401840   /* video hardware */
18411841   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/vaportra.c
r1877r1878
2929{
3030   /* Force synchronisation between CPUs with fake timer */
3131   timer_call_after_resynch(NULL, 0, NULL);
32   soundlatch_w(0,data & 0xff);
33   cpunum_set_input_line(Machine, 1,0,ASSERT_LINE);
32   soundlatch_w(machine,0,data & 0xff);
33   cpunum_set_input_line(machine, 1,0,ASSERT_LINE);
3434}
3535
3636static READ16_HANDLER( vaportra_control_r )
r1877r1878
9393
9494static READ8_HANDLER( vaportra_soundlatch_r )
9595{
96   cpunum_set_input_line(Machine, 1,0,CLEAR_LINE);
97   return soundlatch_r(offset);
96   cpunum_set_input_line(machine, 1,0,CLEAR_LINE);
97   return soundlatch_r(machine, offset);
9898}
9999
100100static WRITE8_HANDLER( YM2151_w )
101101{
102102   switch (offset) {
103103   case 0:
104      YM2151_register_port_0_w(0,data);
104      YM2151_register_port_0_w(machine,0,data);
105105      break;
106106   case 1:
107      YM2151_data_port_0_w(0,data);
107      YM2151_data_port_0_w(machine,0,data);
108108      break;
109109   }
110110}
r1877r1878
113113{
114114   switch (offset) {
115115   case 0:
116      YM2203_control_port_0_w(0,data);
116      YM2203_control_port_0_w(machine,0,data);
117117      break;
118118   case 1:
119      YM2203_write_port_0_w(0,data);
119      YM2203_write_port_0_w(machine,0,data);
120120      break;
121121   }
122122}
r1877r1878
275275   /* basic machine hardware */
276276   MDRV_CPU_ADD(M68000,12000000) /* Custom chip 59 */
277277   MDRV_CPU_PROGRAM_MAP(vaportra_readmem,vaportra_writemem)
278   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
278   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
279279
280280   MDRV_CPU_ADD(H6280, 32220000/4) /* Custom chip 45; Audio section crystal is 32.220 MHz */
281281   /* audio CPU */
src/mame/drivers/btime.c
r1877r1878
9898
9999INTERRUPT_GEN( lnc_sound_interrupt );
100100
101static WRITE8_HANDLER( sound_command_w );
101static WRITE8_HANDLER( audio_command_w );
102102
103103READ8_HANDLER( mmonkey_protection_r );
104104WRITE8_HANDLER( mmonkey_protection_w );
r1877r1878
106106
107107static UINT8 *decrypted;
108108static UINT8 *rambase;
109static UINT8 *sound_rambase;
109static UINT8 *audio_rambase;
110110
111111
112112
r1877r1878
149149static WRITE8_HANDLER( lnc_w )
150150{
151151   if      (offset <= 0x3bff)                       ;
152   else if (offset >= 0x3c00 && offset <= 0x3fff) { lnc_videoram_w(offset - 0x3c00,data); return; }
153   else if (offset >= 0x7c00 && offset <= 0x7fff) { lnc_mirrorvideoram_w(offset - 0x7c00,data); return; }
152   else if (offset >= 0x3c00 && offset <= 0x3fff) { lnc_videoram_w(machine,offset - 0x3c00,data); return; }
153   else if (offset >= 0x7c00 && offset <= 0x7fff) { lnc_mirrorvideoram_w(machine,offset - 0x7c00,data); return; }
154154   else if (offset == 0x8000)                     { return; }  /* MWA8_NOP */
155   else if (offset == 0x8001)                     { lnc_video_control_w(0,data); return; }
155   else if (offset == 0x8001)                     { lnc_video_control_w(machine,0,data); return; }
156156   else if (offset == 0x8003)                       ;
157157   else if (offset == 0x9000)                     { return; }  /* MWA8_NOP */
158   else if (offset == 0x9002)                     { sound_command_w(0,data); return; }
158   else if (offset == 0x9002)                     { audio_command_w(machine,0,data); return; }
159159   else if (offset >= 0xb000 && offset <= 0xb1ff)   ;
160160   else logerror("CPU #%d PC %04x: warning - write %02x to unmapped memory address %04x\n",cpu_getactivecpu(),activecpu_get_pc(),data,offset);
161161
r1877r1878
168168static WRITE8_HANDLER( mmonkey_w )
169169{
170170   if      (offset <= 0x3bff)                       ;
171   else if (offset >= 0x3c00 && offset <= 0x3fff) { lnc_videoram_w(offset - 0x3c00,data); return; }
172   else if (offset >= 0x7c00 && offset <= 0x7fff) { lnc_mirrorvideoram_w(offset - 0x7c00,data); return; }
173   else if (offset == 0x8001)                     { lnc_video_control_w(0,data); return; }
171   else if (offset >= 0x3c00 && offset <= 0x3fff) { lnc_videoram_w(machine,offset - 0x3c00,data); return; }
172   else if (offset >= 0x7c00 && offset <= 0x7fff) { lnc_mirrorvideoram_w(machine,offset - 0x7c00,data); return; }
173   else if (offset == 0x8001)                     { lnc_video_control_w(machine,0,data); return; }
174174   else if (offset == 0x8003)                       ;
175175   else if (offset == 0x9000)                     { return; }  /* MWA8_NOP */
176   else if (offset == 0x9002)                     { sound_command_w(0,data); return; }
177   else if (offset >= 0xb000 && offset <= 0xbfff) { mmonkey_protection_w(offset - 0xb000, data); return; }
176   else if (offset == 0x9002)                     { audio_command_w(machine,0,data); return; }
177   else if (offset >= 0xb000 && offset <= 0xbfff) { mmonkey_protection_w(machine,offset - 0xb000, data); return; }
178178   else logerror("CPU #%d PC %04x: warning - write %02x to unmapped memory address %04x\n",cpu_getactivecpu(),activecpu_get_pc(),data,offset);
179179
180180   rambase[offset] = data;
r1877r1878
186186static WRITE8_HANDLER( btime_w )
187187{
188188   if      (offset <= 0x07ff)                     ;
189   else if (offset >= 0x0c00 && offset <= 0x0c0f) btime_paletteram_w(offset - 0x0c00,data);
189   else if (offset >= 0x0c00 && offset <= 0x0c0f) btime_paletteram_w(machine,offset - 0x0c00,data);
190190   else if (offset >= 0x1000 && offset <= 0x17ff) ;
191   else if (offset >= 0x1800 && offset <= 0x1bff) btime_mirrorvideoram_w(offset - 0x1800,data);
192   else if (offset >= 0x1c00 && offset <= 0x1fff) btime_mirrorcolorram_w(offset - 0x1c00,data);
193   else if (offset == 0x4002)                     btime_video_control_w(0,data);
194   else if (offset == 0x4003)                     sound_command_w(0,data);
195   else if (offset == 0x4004)                     bnj_scroll1_w(0,data);
191   else if (offset >= 0x1800 && offset <= 0x1bff) btime_mirrorvideoram_w(machine,offset - 0x1800,data);
192   else if (offset >= 0x1c00 && offset <= 0x1fff) btime_mirrorcolorram_w(machine,offset - 0x1c00,data);
193   else if (offset == 0x4002)                     btime_video_control_w(machine,0,data);
194   else if (offset == 0x4003)                     audio_command_w(machine,0,data);
195   else if (offset == 0x4004)                     bnj_scroll1_w(machine,0,data);
196196   else logerror("CPU #%d PC %04x: warning - write %02x to unmapped memory address %04x\n",cpu_getactivecpu(),activecpu_get_pc(),data,offset);
197197
198198   rambase[offset] = data;
r1877r1878
204204{
205205   if      (offset <= 0x07ff)                   ;
206206   else if (offset >= 0x8000 && offset <= 0x87ff) ;
207   else if (offset >= 0x8800 && offset <= 0x8bff) btime_mirrorvideoram_w(offset - 0x8800,data);
208   else if (offset >= 0x8c00 && offset <= 0x8fff) btime_mirrorcolorram_w(offset - 0x8c00,data);
209   else if (offset == 0x9000)                  zoar_video_control_w(0, data);
207   else if (offset >= 0x8800 && offset <= 0x8bff) btime_mirrorvideoram_w(machine,offset - 0x8800,data);
208   else if (offset >= 0x8c00 && offset <= 0x8fff) btime_mirrorcolorram_w(machine,offset - 0x8c00,data);
209   else if (offset == 0x9000)                  zoar_video_control_w(machine,0, data);
210210   else if (offset >= 0x9800 && offset <= 0x9803) ;
211   else if (offset == 0x9804)                     bnj_scroll2_w(0,data);
212   else if (offset == 0x9805)                     bnj_scroll1_w(0,data);
213   else if (offset == 0x9806)                     sound_command_w(0,data);
211   else if (offset == 0x9804)                     bnj_scroll2_w(machine,0,data);
212   else if (offset == 0x9805)                     bnj_scroll1_w(machine,0,data);
213   else if (offset == 0x9806)                     audio_command_w(machine,0,data);
214214   else logerror("CPU #%d PC %04x: warning - write %02x to unmapped memory address %04x\n",cpu_getactivecpu(),activecpu_get_pc(),data,offset);
215215
216216   rambase[offset] = data;
r1877r1878
221221static WRITE8_HANDLER( disco_w )
222222{
223223   if      (offset <= 0x04ff)                     ;
224   else if (offset >= 0x2000 && offset <= 0x7fff) deco_charram_w(offset - 0x2000,data);
224   else if (offset >= 0x2000 && offset <= 0x7fff) deco_charram_w(machine,offset - 0x2000,data);
225225   else if (offset >= 0x8000 && offset <= 0x881f) ;
226   else if (offset == 0x9a00)                     sound_command_w(0,data);
227   else if (offset == 0x9c00)                     disco_video_control_w(0,data);
226   else if (offset == 0x9a00)                     audio_command_w(machine,0,data);
227   else if (offset == 0x9c00)                     disco_video_control_w(machine,0,data);
228228   else logerror("CPU #%d PC %04x: warning - write %02x to unmapped memory address %04x\n",cpu_getactivecpu(),activecpu_get_pc(),data,offset);
229229
230230   rambase[offset] = data;
r1877r1878
233233}
234234
235235
236static ADDRESS_MAP_START( btime_readmem, ADDRESS_SPACE_PROGRAM, 8 )
237   AM_RANGE(0x0000, 0x07ff) AM_READ(MRA8_RAM)
238   AM_RANGE(0x1000, 0x17ff) AM_READ(MRA8_RAM)
239   AM_RANGE(0x1800, 0x1bff) AM_READ(btime_mirrorvideoram_r)
240   AM_RANGE(0x1c00, 0x1fff) AM_READ(btime_mirrorcolorram_r)
241   AM_RANGE(0x4000, 0x4000) AM_READ(input_port_0_r)     /* IN0 */
242   AM_RANGE(0x4001, 0x4001) AM_READ(input_port_1_r)     /* IN1 */
243   AM_RANGE(0x4002, 0x4002) AM_READ(input_port_2_r)     /* coin */
244   AM_RANGE(0x4003, 0x4003) AM_READ(input_port_3_r)     /* DSW1 */
245   AM_RANGE(0x4004, 0x4004) AM_READ(input_port_4_r)     /* DSW2 */
236static ADDRESS_MAP_START( btime_map, ADDRESS_SPACE_PROGRAM, 8 )
237   AM_RANGE(0x0000, 0xffff) AM_WRITE(btime_w)   /* override the following entries to */
238                                    /* support ROM decryption */
239   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&rambase)
240   AM_RANGE(0x0c00, 0x0c0f) AM_WRITE(btime_paletteram_w) AM_BASE(&paletteram)
241   AM_RANGE(0x1000, 0x13ff) AM_RAM AM_BASE(&btime_videoram) AM_SIZE(&btime_videoram_size)
242   AM_RANGE(0x1400, 0x17ff) AM_RAM AM_BASE(&btime_colorram)
243   AM_RANGE(0x1800, 0x1bff) AM_READWRITE(btime_mirrorvideoram_r, btime_mirrorvideoram_w)
244   AM_RANGE(0x1c00, 0x1fff) AM_READWRITE(btime_mirrorcolorram_r, btime_mirrorcolorram_w)
245   AM_RANGE(0x4000, 0x4000) AM_READWRITE(input_port_0_r, MWA8_NOP)
246   AM_RANGE(0x4001, 0x4001) AM_READ(input_port_1_r)
247   AM_RANGE(0x4002, 0x4002) AM_READWRITE(input_port_2_r, btime_video_control_w)
248   AM_RANGE(0x4003, 0x4003) AM_READWRITE(input_port_3_r, audio_command_w)
249   AM_RANGE(0x4004, 0x4004) AM_READWRITE(input_port_4_r, bnj_scroll1_w)
246250   AM_RANGE(0xb000, 0xffff) AM_READ(MRA8_ROM)
247251ADDRESS_MAP_END
248252
249static ADDRESS_MAP_START( btime_writemem, ADDRESS_SPACE_PROGRAM, 8 )
250   AM_RANGE(0x0000, 0xffff) AM_WRITE(btime_w)       /* override the following entries to */
251                                       /* support ROM decryption */
252   AM_RANGE(0x0000, 0x07ff) AM_WRITE(MWA8_RAM) AM_BASE(&rambase)
253   AM_RANGE(0x0c00, 0x0c0f) AM_WRITE(btime_paletteram_w) AM_BASE(&paletteram)
254   AM_RANGE(0x1000, 0x13ff) AM_WRITE(MWA8_RAM) AM_BASE(&btime_videoram) AM_SIZE(&btime_videoram_size)
255   AM_RANGE(0x1400, 0x17ff) AM_WRITE(MWA8_RAM) AM_BASE(&btime_colorram)
256   AM_RANGE(0x1800, 0x1bff) AM_WRITE(btime_mirrorvideoram_w)
257   AM_RANGE(0x1c00, 0x1fff) AM_WRITE(btime_mirrorcolorram_w)
258   AM_RANGE(0x4000, 0x4000) AM_WRITE(MWA8_NOP)
259   AM_RANGE(0x4002, 0x4002) AM_WRITE(btime_video_control_w)
260   AM_RANGE(0x4003, 0x4003) AM_WRITE(sound_command_w)
261   AM_RANGE(0x4004, 0x4004) AM_WRITE(bnj_scroll1_w)
262ADDRESS_MAP_END
263
264static ADDRESS_MAP_START( cookrace_readmem, ADDRESS_SPACE_PROGRAM, 8 )
265   AM_RANGE(0x0000, 0x03ff) AM_READ(MRA8_RAM)
266   AM_RANGE(0x0500, 0x3fff) AM_READ(MRA8_ROM)
267   AM_RANGE(0xc000, 0xc7ff) AM_READ(MRA8_RAM)
268   AM_RANGE(0xc800, 0xcbff) AM_READ(btime_mirrorvideoram_r)
269   AM_RANGE(0xcc00, 0xcfff) AM_READ(btime_mirrorcolorram_r)
270   AM_RANGE(0xd000, 0xd0ff) AM_READ(MRA8_RAM)   /* background */
271   AM_RANGE(0xd100, 0xd3ff) AM_READ(MRA8_RAM)   /* ? */
272   AM_RANGE(0xd400, 0xd7ff) AM_READ(MRA8_RAM)   /* background? */
273   AM_RANGE(0xe000, 0xe000) AM_READ(input_port_3_r)     /* DSW1 */
274   AM_RANGE(0xe300, 0xe300) AM_READ(input_port_3_r)     /* mirror address used on high score name enter */
253static ADDRESS_MAP_START( cookrace_map, ADDRESS_SPACE_PROGRAM, 8 )
254   AM_RANGE(0x0000, 0x03ff) AM_RAM AM_BASE(&rambase)
255   AM_RANGE(0x0500, 0x3fff) AM_ROM
256   AM_RANGE(0xc000, 0xc3ff) AM_RAM AM_BASE(&btime_videoram) AM_SIZE(&btime_videoram_size)
257   AM_RANGE(0xc400, 0xc7ff) AM_RAM AM_BASE(&btime_colorram)
258   AM_RANGE(0xc800, 0xcbff) AM_READWRITE(btime_mirrorvideoram_r, btime_mirrorvideoram_w)
259   AM_RANGE(0xcc00, 0xcfff) AM_READWRITE(btime_mirrorcolorram_r, btime_mirrorcolorram_w)
260   AM_RANGE(0xd000, 0xd0ff) AM_RAM                     /* background? */
261   AM_RANGE(0xd100, 0xd3ff) AM_RAM                     /* ? */
262   AM_RANGE(0xd400, 0xd7ff) AM_RAM AM_BASE(&bnj_backgroundram) AM_SIZE(&bnj_backgroundram_size)
263   AM_RANGE(0xe000, 0xe000) AM_READWRITE(input_port_3_r, bnj_video_control_w)
264   AM_RANGE(0xe300, 0xe300) AM_READ(input_port_3_r)     /* mirror address used on high score name entry */
275265                                 /* screen */
276   AM_RANGE(0xe001, 0xe001) AM_READ(input_port_4_r)     /* DSW2 */
277   AM_RANGE(0xe002, 0xe002) AM_READ(input_port_0_r)     /* IN0 */
278   AM_RANGE(0xe003, 0xe003) AM_READ(input_port_1_r)     /* IN1 */
279   AM_RANGE(0xe004, 0xe004) AM_READ(input_port_2_r)     /* coin */
280   AM_RANGE(0xfff9, 0xffff) AM_READ(MRA8_ROM)
266   AM_RANGE(0xe001, 0xe001) AM_READWRITE(input_port_4_r, audio_command_w)
267   AM_RANGE(0xe002, 0xe002) AM_READ(input_port_0_r)
268   AM_RANGE(0xe003, 0xe003) AM_READ(input_port_1_r)
269   AM_RANGE(0xe004, 0xe004) AM_READ(input_port_2_r)
270   AM_RANGE(0xfff9, 0xffff) AM_ROM
281271ADDRESS_MAP_END
282272
283static ADDRESS_MAP_START( cookrace_writemem, ADDRESS_SPACE_PROGRAM, 8 )
284   AM_RANGE(0x0000, 0x03ff) AM_WRITE(MWA8_RAM) AM_BASE(&rambase)
285   AM_RANGE(0x0500, 0x3fff) AM_WRITE(MWA8_ROM)
286   AM_RANGE(0xc000, 0xc3ff) AM_WRITE(MWA8_RAM) AM_BASE(&btime_videoram) AM_SIZE(&btime_videoram_size)
287   AM_RANGE(0xc400, 0xc7ff) AM_WRITE(MWA8_RAM) AM_BASE(&btime_colorram)
288   AM_RANGE(0xc800, 0xcbff) AM_WRITE(btime_mirrorvideoram_w)
289   AM_RANGE(0xcc00, 0xcfff) AM_WRITE(btime_mirrorcolorram_w)
290   AM_RANGE(0xd000, 0xd0ff) AM_WRITE(MWA8_RAM)   /* background? */
291   AM_RANGE(0xd100, 0xd3ff) AM_WRITE(MWA8_RAM)   /* ? */
292   AM_RANGE(0xd400, 0xd7ff) AM_WRITE(MWA8_RAM) AM_BASE(&bnj_backgroundram) AM_SIZE(&bnj_backgroundram_size)
293   AM_RANGE(0xe000, 0xe000) AM_WRITE(bnj_video_control_w)
294   AM_RANGE(0xe001, 0xe001) AM_WRITE(sound_command_w)
295#if 0
296   AM_RANGE(0x4004, 0x4004) AM_WRITE(bnj_scroll1_w)
297#endif
298   AM_RANGE(0xfff9, 0xffff) AM_WRITE(MWA8_ROM)
299ADDRESS_MAP_END
300
301static ADDRESS_MAP_START( zoar_readmem, ADDRESS_SPACE_PROGRAM, 8 )
302   AM_RANGE(0x0000, 0x07ff) AM_READ(MRA8_RAM)
303   AM_RANGE(0x9800, 0x9800) AM_READ(input_port_3_r)     /* DSW 1 */
304   AM_RANGE(0x9801, 0x9801) AM_READ(input_port_4_r)     /* DSW 2 */
305   AM_RANGE(0x9802, 0x9802) AM_READ(input_port_0_r)     /* IN 0 */
306   AM_RANGE(0x9803, 0x9803) AM_READ(input_port_1_r)     /* IN 1 */
307   AM_RANGE(0x9804, 0x9804) AM_READ(input_port_2_r)     /* coin */
308   AM_RANGE(0xd000, 0xffff) AM_READ(MRA8_ROM)
309ADDRESS_MAP_END
310
311static ADDRESS_MAP_START( zoar_writemem, ADDRESS_SPACE_PROGRAM, 8 )
312   AM_RANGE(0x0000, 0xffff) AM_WRITE(zoar_w)       /* override the following entries to */
313                                       /* support ROM decryption */
314   AM_RANGE(0x0000, 0x07ff) AM_WRITE(MWA8_RAM) AM_BASE(&rambase)
273static ADDRESS_MAP_START( zoar_map, ADDRESS_SPACE_PROGRAM, 8 )
274   AM_RANGE(0x0000, 0xffff) AM_WRITE(zoar_w)   /* override the following entries to */
275                                    /* support ROM decryption */
276   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&rambase)
315277   AM_RANGE(0x8000, 0x83ff) AM_WRITE(MWA8_RAM) AM_BASE(&btime_videoram) AM_SIZE(&btime_videoram_size)
316278   AM_RANGE(0x8400, 0x87ff) AM_WRITE(MWA8_RAM) AM_BASE(&btime_colorram)
317279   AM_RANGE(0x8800, 0x8bff) AM_WRITE(btime_mirrorvideoram_w)
318280   AM_RANGE(0x8c00, 0x8fff) AM_WRITE(btime_mirrorcolorram_w)
319281   AM_RANGE(0x9000, 0x9000) AM_WRITE(zoar_video_control_w)
282   AM_RANGE(0x9800, 0x9800) AM_READ(input_port_3_r)
283   AM_RANGE(0x9801, 0x9801) AM_READ(input_port_4_r)
284   AM_RANGE(0x9802, 0x9802) AM_READ(input_port_0_r)
285   AM_RANGE(0x9803, 0x9803) AM_READ(input_port_1_r)
320286   AM_RANGE(0x9800, 0x9803) AM_WRITE(MWA8_RAM) AM_BASE(&zoar_scrollram)
321   AM_RANGE(0x9805, 0x9805) AM_WRITE(bnj_scroll2_w)
287   AM_RANGE(0x9804, 0x9804) AM_READWRITE(input_port_2_r, bnj_scroll2_w)
322288   AM_RANGE(0x9805, 0x9805) AM_WRITE(bnj_scroll1_w)
323   AM_RANGE(0x9806, 0x9806) AM_WRITE(sound_command_w)
324  /*AM_RANGE(0x9807, 0x9807) AM_WRITE(MWA8_RAM) */ /* Marked as ACK on schematics (Board 2 Pg 5) */
289   AM_RANGE(0x9806, 0x9806) AM_WRITE(audio_command_w)
290   AM_RANGE(0xd000, 0xffff) AM_READ(MRA8_ROM)
325291ADDRESS_MAP_END
326292
327static ADDRESS_MAP_START( lnc_readmem, ADDRESS_SPACE_PROGRAM, 8 )
328   AM_RANGE(0x0000, 0x3fff) AM_READ(MRA8_RAM)
329   AM_RANGE(0x7c00, 0x7fff) AM_READ(btime_mirrorvideoram_r)
330   AM_RANGE(0x8000, 0x8000) AM_READ(input_port_3_r)     /* DSW1 */
331   AM_RANGE(0x8001, 0x8001) AM_READ(input_port_4_r)     /* DSW2 */
332   AM_RANGE(0x9000, 0x9000) AM_READ(input_port_0_r)     /* IN0 */
333   AM_RANGE(0x9001, 0x9001) AM_READ(input_port_1_r)     /* IN1 */
334   AM_RANGE(0x9002, 0x9002) AM_READ(input_port_2_r)     /* coin */
335   AM_RANGE(0xb000, 0xb1ff) AM_READ(MRA8_RAM)
293static ADDRESS_MAP_START( lnc_map, ADDRESS_SPACE_PROGRAM, 8 )
294   AM_RANGE(0x0000, 0xffff) AM_WRITE(lnc_w)   /* override the following entries to */
295                                    /* support ROM decryption */
296   AM_RANGE(0x0000, 0x3bff) AM_RAM AM_BASE(&rambase)
297   AM_RANGE(0x3c00, 0x3fff) AM_READWRITE(MRA8_RAM, lnc_videoram_w) AM_BASE(&btime_videoram) AM_SIZE(&btime_videoram_size)
298   AM_RANGE(0x7800, 0x7bff) AM_WRITE(MWA8_RAM) AM_BASE(&btime_colorram)  /* this is just here to initialize the pointer */
299   AM_RANGE(0x7c00, 0x7fff) AM_READWRITE(btime_mirrorvideoram_r, lnc_mirrorvideoram_w)
300   AM_RANGE(0x8000, 0x8000) AM_READWRITE(input_port_3_r, MWA8_NOP)     /* ??? */
301   AM_RANGE(0x8001, 0x8001) AM_READWRITE(input_port_4_r, lnc_video_control_w)
302   AM_RANGE(0x8003, 0x8003) AM_WRITE(MWA8_RAM) AM_BASE(&lnc_charbank)
303   AM_RANGE(0x9000, 0x9000) AM_READWRITE(input_port_0_r, MWA8_NOP)     /* IRQ ack??? */
304   AM_RANGE(0x9001, 0x9001) AM_READ(input_port_1_r)
305   AM_RANGE(0x9002, 0x9002) AM_READWRITE(input_port_2_r, audio_command_w)
306   AM_RANGE(0xb000, 0xb1ff) AM_RAM
336307   AM_RANGE(0xc000, 0xffff) AM_READ(MRA8_ROM)
337308ADDRESS_MAP_END
338309
339static ADDRESS_MAP_START( lnc_writemem, ADDRESS_SPACE_PROGRAM, 8 )
340   AM_RANGE(0x0000, 0xffff) AM_WRITE(lnc_w)         /* override the following entries to */
310static ADDRESS_MAP_START( mmonkey_map, ADDRESS_SPACE_PROGRAM, 8 )
311   AM_RANGE(0x0000, 0xffff) AM_WRITE(mmonkey_w)   /* override the following entries to */
341312                                       /* support ROM decryption */
342   AM_RANGE(0x0000, 0x3bff) AM_WRITE(MWA8_RAM) AM_BASE(&rambase)
343   AM_RANGE(0x3c00, 0x3fff) AM_WRITE(lnc_videoram_w) AM_BASE(&btime_videoram) AM_SIZE(&btime_videoram_size)
313   AM_RANGE(0x0000, 0x3bff) AM_RAM AM_BASE(&rambase)
314   AM_RANGE(0x3c00, 0x3fff) AM_READWRITE(MRA8_RAM, lnc_videoram_w) AM_BASE(&btime_videoram) AM_SIZE(&btime_videoram_size)
344315   AM_RANGE(0x7800, 0x7bff) AM_WRITE(MWA8_RAM) AM_BASE(&btime_colorram)  /* this is just here to initialize the pointer */
345   AM_RANGE(0x7c00, 0x7fff) AM_WRITE(lnc_mirrorvideoram_w)
346   AM_RANGE(0x8000, 0x8000) AM_WRITE(MWA8_NOP)            /* ??? */
347   AM_RANGE(0x8001, 0x8001) AM_WRITE(lnc_video_control_w)
316   AM_RANGE(0x7c00, 0x7fff) AM_READWRITE(btime_mirrorvideoram_r, lnc_mirrorvideoram_w)
317   AM_RANGE(0x8000, 0x8000) AM_READ(input_port_3_r)
318   AM_RANGE(0x8001, 0x8001) AM_READWRITE(input_port_4_r, lnc_video_control_w)
348319   AM_RANGE(0x8003, 0x8003) AM_WRITE(MWA8_RAM) AM_BASE(&lnc_charbank)
349   AM_RANGE(0x9000, 0x9000) AM_WRITE(MWA8_NOP)            /* IRQ ACK ??? */
350   AM_RANGE(0x9002, 0x9002) AM_WRITE(sound_command_w)
351   AM_RANGE(0xb000, 0xb1ff) AM_WRITE(MWA8_RAM)
352ADDRESS_MAP_END
353
354
355static ADDRESS_MAP_START( mmonkey_readmem, ADDRESS_SPACE_PROGRAM, 8 )
356   AM_RANGE(0x0000, 0x3fff) AM_READ(MRA8_RAM)
357   AM_RANGE(0x7c00, 0x7fff) AM_READ(btime_mirrorvideoram_r)
358   AM_RANGE(0x8000, 0x8000) AM_READ(input_port_3_r)     /* DSW1 */
359   AM_RANGE(0x8001, 0x8001) AM_READ(input_port_4_r)     /* DSW2 */
360   AM_RANGE(0x9000, 0x9000) AM_READ(input_port_0_r)     /* IN0 */
361   AM_RANGE(0x9001, 0x9001) AM_READ(input_port_1_r)     /* IN1 */
362   AM_RANGE(0x9002, 0x9002) AM_READ(input_port_2_r)     /* coin */
363   AM_RANGE(0xb000, 0xbfff) AM_READ(mmonkey_protection_r)
320   AM_RANGE(0x9000, 0x9000) AM_READWRITE(input_port_0_r, MWA8_NOP)     /* IRQ ack??? */
321   AM_RANGE(0x9001, 0x9001) AM_READ(input_port_1_r)
322   AM_RANGE(0x9002, 0x9002) AM_READWRITE(input_port_2_r, audio_command_w)
323   AM_RANGE(0xb000, 0xbfff) AM_READWRITE(mmonkey_protection_r, mmonkey_protection_w)
364324   AM_RANGE(0xc000, 0xffff) AM_READ(MRA8_ROM)
365325ADDRESS_MAP_END
366326
367static ADDRESS_MAP_START( mmonkey_writemem, ADDRESS_SPACE_PROGRAM, 8 )
368   AM_RANGE(0x0000, 0xffff) AM_WRITE(mmonkey_w)  /* override the following entries to */
369                           /* support ROM decryption */
370   AM_RANGE(0x0000, 0x3bff) AM_WRITE(MWA8_RAM) AM_BASE(&rambase)
371   AM_RANGE(0x3c00, 0x3fff) AM_WRITE(lnc_videoram_w) AM_BASE(&btime_videoram) AM_SIZE(&btime_videoram_size)
372   AM_RANGE(0x7800, 0x7bff) AM_WRITE(MWA8_RAM) AM_BASE(&btime_colorram)  /* this is just here to initialize the pointer */
373   AM_RANGE(0x7c00, 0x7fff) AM_WRITE(lnc_mirrorvideoram_w)
374   AM_RANGE(0x8001, 0x8001) AM_WRITE(lnc_video_control_w)
375   AM_RANGE(0x8003, 0x8003) AM_WRITE(MWA8_RAM) AM_BASE(&lnc_charbank)
376   AM_RANGE(0x9000, 0x9000) AM_WRITE(MWA8_NOP)            /* IRQ ACK ??? */
377   AM_RANGE(0x9002, 0x9002) AM_WRITE(sound_command_w)
378   AM_RANGE(0xb000, 0xbfff) AM_WRITE(mmonkey_protection_w)
379ADDRESS_MAP_END
380
381
382static ADDRESS_MAP_START( bnj_readmem, ADDRESS_SPACE_PROGRAM, 8 )
383   AM_RANGE(0x0000, 0x07ff) AM_READ(MRA8_RAM)
384   AM_RANGE(0x1000, 0x1000) AM_READ(input_port_3_r)     /* DSW1 */
385   AM_RANGE(0x1001, 0x1001) AM_READ(input_port_4_r)     /* DSW2 */
386   AM_RANGE(0x1002, 0x1002) AM_READ(input_port_0_r)     /* IN0 */
387   AM_RANGE(0x1003, 0x1003) AM_READ(input_port_1_r)     /* IN1 */
388   AM_RANGE(0x1004, 0x1004) AM_READ(input_port_2_r)     /* coin */
389   AM_RANGE(0x4000, 0x47ff) AM_READ(MRA8_RAM)
390   AM_RANGE(0x4800, 0x4bff) AM_READ(btime_mirrorvideoram_r)
391   AM_RANGE(0x4c00, 0x4fff) AM_READ(btime_mirrorcolorram_r)
392   AM_RANGE(0xa000, 0xffff) AM_READ(MRA8_ROM)
393ADDRESS_MAP_END
394
395static ADDRESS_MAP_START( bnj_writemem, ADDRESS_SPACE_PROGRAM, 8 )
396   AM_RANGE(0x0000, 0x07ff) AM_WRITE(MWA8_RAM) AM_BASE(&rambase)
397   AM_RANGE(0x1001, 0x1001) AM_WRITE(bnj_video_control_w)
398   AM_RANGE(0x1002, 0x1002) AM_WRITE(sound_command_w)
399   AM_RANGE(0x4000, 0x43ff) AM_WRITE(MWA8_RAM) AM_BASE(&btime_videoram) AM_SIZE(&btime_videoram_size)
400   AM_RANGE(0x4400, 0x47ff) AM_WRITE(MWA8_RAM) AM_BASE(&btime_colorram)
401   AM_RANGE(0x4800, 0x4bff) AM_WRITE(btime_mirrorvideoram_w)
402   AM_RANGE(0x4c00, 0x4fff) AM_WRITE(btime_mirrorcolorram_w)
327static ADDRESS_MAP_START( bnj_map, ADDRESS_SPACE_PROGRAM, 8 )
328   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&rambase)
329   AM_RANGE(0x1000, 0x1000) AM_READ(input_port_3_r)
330   AM_RANGE(0x1001, 0x1001) AM_READWRITE(input_port_4_r, bnj_video_control_w)
331   AM_RANGE(0x1002, 0x1002) AM_READWRITE(input_port_0_r, audio_command_w)
332   AM_RANGE(0x1003, 0x1003) AM_READ(input_port_1_r)
333   AM_RANGE(0x1004, 0x1004) AM_READ(input_port_2_r)
334   AM_RANGE(0x4000, 0x43ff) AM_RAM AM_BASE(&btime_videoram) AM_SIZE(&btime_videoram_size)
335   AM_RANGE(0x4400, 0x47ff) AM_RAM AM_BASE(&btime_colorram)
336   AM_RANGE(0x4800, 0x4bff) AM_READWRITE(btime_mirrorvideoram_r, btime_mirrorvideoram_w)
337   AM_RANGE(0x4c00, 0x4fff) AM_READWRITE(btime_mirrorcolorram_r, btime_mirrorcolorram_w)
403338   AM_RANGE(0x5000, 0x51ff) AM_WRITE(bnj_background_w) AM_BASE(&bnj_backgroundram) AM_SIZE(&bnj_backgroundram_size)
404339   AM_RANGE(0x5400, 0x5400) AM_WRITE(bnj_scroll1_w)
405340   AM_RANGE(0x5800, 0x5800) AM_WRITE(bnj_scroll2_w)
406341   AM_RANGE(0x5c00, 0x5c0f) AM_WRITE(btime_paletteram_w) AM_BASE(&paletteram)
407ADDRESS_MAP_END
408
409static ADDRESS_MAP_START( disco_readmem, ADDRESS_SPACE_PROGRAM, 8 )
410   AM_RANGE(0x0000, 0x04ff) AM_READ(MRA8_RAM)
411   AM_RANGE(0x2000, 0x881f) AM_READ(MRA8_RAM)
412   AM_RANGE(0x9000, 0x9000) AM_READ(input_port_2_r)     /* coin */
413   AM_RANGE(0x9200, 0x9200) AM_READ(input_port_0_r)     /* IN0 */
414   AM_RANGE(0x9400, 0x9400) AM_READ(input_port_1_r)     /* IN1 */
415   AM_RANGE(0x9800, 0x9800) AM_READ(input_port_3_r)     /* DSW1 */
416   AM_RANGE(0x9a00, 0x9a00) AM_READ(input_port_4_r)     /* DSW2 */
417   AM_RANGE(0x9c00, 0x9c00) AM_READ(input_port_5_r)     /* VBLANK */
418342   AM_RANGE(0xa000, 0xffff) AM_READ(MRA8_ROM)
419343ADDRESS_MAP_END
420344
421static ADDRESS_MAP_START( disco_writemem, ADDRESS_SPACE_PROGRAM, 8 )
422   AM_RANGE(0x0000, 0xffff) AM_WRITE(disco_w)    /* override the following entries to */
345static ADDRESS_MAP_START( disco_map, ADDRESS_SPACE_PROGRAM, 8 )
346   AM_RANGE(0x0000, 0xffff) AM_WRITE(disco_w)   /* override the following entries to */
423347                                    /* support ROM decryption */
424   AM_RANGE(0x0000, 0x04ff) AM_WRITE(MWA8_RAM) AM_BASE(&rambase)
425   AM_RANGE(0x2000, 0x7fff) AM_WRITE(deco_charram_w) AM_BASE(&deco_charram)
426   AM_RANGE(0x8000, 0x83ff) AM_WRITE(MWA8_RAM) AM_BASE(&btime_videoram) AM_SIZE(&btime_videoram_size)
427   AM_RANGE(0x8400, 0x87ff) AM_WRITE(MWA8_RAM) AM_BASE(&btime_colorram)
428   AM_RANGE(0x8800, 0x881f) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
429   AM_RANGE(0x9a00, 0x9a00) AM_WRITE(sound_command_w)
430   AM_RANGE(0x9c00, 0x9c00) AM_WRITE(disco_video_control_w)
348   AM_RANGE(0x0000, 0x04ff) AM_RAM AM_BASE(&rambase)
349   AM_RANGE(0x2000, 0x7fff) AM_READWRITE(MRA8_RAM, deco_charram_w) AM_BASE(&deco_charram)
350   AM_RANGE(0x8000, 0x83ff) AM_RAM AM_BASE(&btime_videoram) AM_SIZE(&btime_videoram_size)
351   AM_RANGE(0x8400, 0x87ff) AM_RAM AM_BASE(&btime_colorram)
352   AM_RANGE(0x8800, 0x881f) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
353   AM_RANGE(0x9000, 0x9000) AM_READ(input_port_2_r)
354   AM_RANGE(0x9200, 0x9200) AM_READ(input_port_0_r)
355   AM_RANGE(0x9400, 0x9400) AM_READ(input_port_1_r)
356   AM_RANGE(0x9800, 0x9800) AM_READ(input_port_3_r)
357   AM_RANGE(0x9a00, 0x9a00) AM_READWRITE(input_port_4_r, audio_command_w)
358   AM_RANGE(0x9c00, 0x9c00) AM_READWRITE(input_port_5_r, disco_video_control_w)
359   AM_RANGE(0xa000, 0xffff) AM_READ(MRA8_ROM)
431360ADDRESS_MAP_END
432361
433362
434static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
435   AM_RANGE(0x0000, 0x03ff) AM_RAM AM_BASE(&sound_rambase)
363static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 )
364   AM_RANGE(0x0000, 0x03ff) AM_RAM AM_BASE(&audio_rambase)
436365   AM_RANGE(0x0400, 0x0fff) AM_ROM AM_REGION(REGION_CPU2, 0xf400)
437366   AM_RANGE(0x2000, 0x2fff) AM_WRITE(AY8910_write_port_0_w)
438367   AM_RANGE(0x4000, 0x4fff) AM_WRITE(AY8910_control_port_0_w)
r1877r1878
443372   AM_RANGE(0xf000, 0xffff) AM_ROM
444373ADDRESS_MAP_END
445374
446
447static ADDRESS_MAP_START( disco_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
448   AM_RANGE(0x0000, 0x03ff) AM_READ(MRA8_RAM)
449   AM_RANGE(0x8000, 0x8fff) AM_READ(soundlatch_r)
450   AM_RANGE(0xf000, 0xffff) AM_READ(MRA8_ROM)
451ADDRESS_MAP_END
452
453static ADDRESS_MAP_START( disco_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
454   AM_RANGE(0x0000, 0x03ff) AM_WRITE(MWA8_RAM)
375static ADDRESS_MAP_START( disco_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
376   AM_RANGE(0x0000, 0x03ff) AM_RAM
455377   AM_RANGE(0x4000, 0x4fff) AM_WRITE(AY8910_write_port_0_w)
456378   AM_RANGE(0x5000, 0x5fff) AM_WRITE(AY8910_control_port_0_w)
457379   AM_RANGE(0x6000, 0x6fff) AM_WRITE(AY8910_write_port_1_w)
458380   AM_RANGE(0x7000, 0x7fff) AM_WRITE(AY8910_control_port_1_w)
459   AM_RANGE(0x8000, 0x8fff) AM_WRITE(MWA8_NOP)  /* ACK ? */
460   AM_RANGE(0xf000, 0xffff) AM_WRITE(MWA8_ROM)
381   AM_RANGE(0x8000, 0x8fff) AM_READWRITE(soundlatch_r, MWA8_NOP) /* ack ? */
382   AM_RANGE(0xf000, 0xffff) AM_ROM
461383ADDRESS_MAP_END
462384
463385
464/***************************************************************************
465
466These games don't have VBlank interrupts.
467Interrupts are still used by the game, coin insertion generates an IRQ.
468
469***************************************************************************/
470static void btime_interrupt(running_machine *machine, int generated_interrupt, int active_high)
386static INPUT_CHANGED( coin_inserted_irq_hi )
471387{
472   static int coin;
473   int port;
474
475   port = readinputport(2) & 0xc0;
476   if (active_high) port ^= 0xc0;
477
478   if (port != 0xc0)    /* Coin */
479   {
480      if (coin == 0)
481      {
482         coin = 1;
483         cpunum_set_input_line(machine, 0, generated_interrupt, (generated_interrupt == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE);
484      }
485   }
486   else coin = 0;
388   if (newval)
389      cpunum_set_input_line(machine, 0, 0, HOLD_LINE);
487390}
488391
489static INTERRUPT_GEN( btime_irq_interrupt )
392static INPUT_CHANGED( coin_inserted_irq_lo )
490393{
491   btime_interrupt(machine, 0, 1);
394   if (!newval)
395      cpunum_set_input_line(machine, 0, 0, HOLD_LINE);
492396}
493397
494static INTERRUPT_GEN( zoar_irq_interrupt )
398static INPUT_CHANGED( coin_inserted_nmi_lo )
495399{
496   btime_interrupt(machine, 0, 0);
400   cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE);
497401}
498402
499static INTERRUPT_GEN( btime_nmi_interrupt )
500{
501   btime_interrupt(machine, INPUT_LINE_NMI, 0);
502}
503403
504static WRITE8_HANDLER( sound_command_w )
404static WRITE8_HANDLER( audio_command_w )
505405{
506   soundlatch_w(offset,data);
507   cpunum_set_input_line(Machine, 1, 0, HOLD_LINE);
406   soundlatch_w(machine,offset,data);
407   cpunum_set_input_line(machine, 1, 0, HOLD_LINE);
508408}
509409
510410#define COMMON_INPUTS\
r1877r1878
531431   COMMON_INPUTS
532432
533433   PORT_START_TAG("IN2")
534   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
535   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
536   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT )
537   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
538   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
539   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
540   PORT_BIT( 0x40, IP_ACTIVE_HIGH,IPT_COIN1 )
541   PORT_BIT( 0x80, IP_ACTIVE_HIGH,IPT_COIN2 )
434   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_START1 )
435   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_START2 )
436   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_TILT )
437   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_UNKNOWN )
438   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_UNUSED )
439   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
440   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(coin_inserted_irq_hi, 0)
441   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_CHANGED(coin_inserted_irq_hi, 0)
542442
543443   PORT_START_TAG("DSW1")
544444   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
r1877r1878
609509   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
610510
611511   PORT_START_TAG("IN2")
612   PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_UNKNOWN )
613   PORT_BIT( 0x02, IP_ACTIVE_HIGH,IPT_UNKNOWN )
614   PORT_BIT( 0x04, IP_ACTIVE_HIGH,IPT_UNKNOWN )
615   PORT_BIT( 0x08, IP_ACTIVE_HIGH,IPT_START1 )
616   PORT_BIT( 0x10, IP_ACTIVE_HIGH,IPT_START2 )
617   PORT_BIT( 0x20, IP_ACTIVE_HIGH,IPT_UNKNOWN )
618   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
619   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
512   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
513   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
514   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
515   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START1 )
516   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START2 )
517   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
518   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_COIN2 ) PORT_CHANGED(coin_inserted_nmi_lo, 0)
519   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_COIN1 ) PORT_CHANGED(coin_inserted_nmi_lo, 0)
620520
621521   PORT_START_TAG("DSW1")
622522   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
r1877r1878
691591   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
692592   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
693593   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
694   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
695   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
594   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted_irq_lo, 0)
595   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted_irq_lo, 0)
696596
697597   PORT_START_TAG("DSW1")
698598   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
r1877r1878
761661   PORT_START_TAG("IN2")
762662   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
763663   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
764   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
765   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
664   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted_nmi_lo, 0)
665   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted_nmi_lo, 0)
766666
767667   PORT_START_TAG("DSW1")
768668   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
r1877r1878
831731   PORT_START_TAG("IN2")
832732   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
833733   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
834   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
835   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
734   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted_nmi_lo, 0)
735   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted_nmi_lo, 0)
836736
837737   PORT_START_TAG("DSW1")
838738   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_B ) )
r1877r1878
902802   PORT_START_TAG("IN2")
903803   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
904804   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
905   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
906   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
805   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted_nmi_lo, 0)
806   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted_nmi_lo, 0)
907807
908808   PORT_START_TAG("DSW1")
909809   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
r1877r1878
978878   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
979879   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
980880   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
981   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
982   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
881   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted_nmi_lo, 0)
882   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted_nmi_lo, 0)
983883
984884   PORT_START_TAG("DSW1")
985885   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
r1877r1878
1049949
1050950   PORT_START_TAG("IN2")
1051951   PORT_BIT( 0x1f, IP_ACTIVE_LOW, IPT_UNUSED )
1052   PORT_BIT( 0x40, IP_ACTIVE_HIGH,IPT_COIN1 )
1053   PORT_BIT( 0x80, IP_ACTIVE_HIGH,IPT_COIN2 )
952   PORT_BIT( 0x40, IP_ACTIVE_HIGH,IPT_COIN1 ) PORT_CHANGED(coin_inserted_irq_hi, 0)
953   PORT_BIT( 0x80, IP_ACTIVE_HIGH,IPT_COIN2 ) PORT_CHANGED(coin_inserted_irq_hi, 0)
1054954
1055955   PORT_START_TAG("DSW1")
1056956   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_A ) )
r1877r1878
11341034   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
11351035   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
11361036   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
1137   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
1138   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
1037   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted_nmi_lo, 0)
1038   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted_nmi_lo, 0)
11391039
11401040   PORT_START_TAG("DSW1")
11411041   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
r1877r1878
12951195
12961196   /* basic machine hardware */
12971197   MDRV_CPU_ADD_TAG("main", M6502, 1500000)
1298   MDRV_CPU_PROGRAM_MAP(btime_readmem,btime_writemem)
1299   MDRV_CPU_VBLANK_INT(btime_irq_interrupt,1)
1198   MDRV_CPU_PROGRAM_MAP(btime_map,0)
13001199
1301   MDRV_CPU_ADD_TAG("sound", M6502, 500000)
13021200   /* audio CPU */
1303   MDRV_CPU_PROGRAM_MAP(sound_map,0)
1304   MDRV_CPU_VBLANK_INT(nmi_line_pulse,16)
1201   MDRV_CPU_ADD_TAG("audio", M6502, 500000)
1202   MDRV_CPU_PROGRAM_MAP(audio_map,0)
1203   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,16)
13051204
13061205   /* video hardware */
13071206   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
13181217   MDRV_VIDEO_START(btime)
13191218   MDRV_VIDEO_UPDATE(btime)
13201219
1321   /* sound hardware */
1220   /* audio hardware */
13221221   MDRV_SPEAKER_STANDARD_MONO("mono")
13231222
13241223   MDRV_SOUND_ADD(AY8910, 1500000)
r1877r1878
13341233   /* basic machine hardware */
13351234   MDRV_IMPORT_FROM(btime)
13361235   MDRV_CPU_MODIFY("main")
1337   MDRV_CPU_PROGRAM_MAP(cookrace_readmem,cookrace_writemem)
1338   MDRV_CPU_VBLANK_INT(btime_nmi_interrupt,1)
1236   MDRV_CPU_PROGRAM_MAP(cookrace_map,0)
13391237
1340   MDRV_CPU_MODIFY("sound")
1341   MDRV_CPU_PROGRAM_MAP(sound_map,0)
1238   MDRV_CPU_MODIFY("audio")
1239   MDRV_CPU_PROGRAM_MAP(audio_map,0)
13421240
13431241   /* video hardware */
13441242   MDRV_GFXDECODE(cookrace)
r1877r1878
13531251   /* basic machine hardware */
13541252   MDRV_IMPORT_FROM(btime)
13551253   MDRV_CPU_MODIFY("main")
1356   MDRV_CPU_PROGRAM_MAP(lnc_readmem,lnc_writemem)
1357   MDRV_CPU_VBLANK_INT(btime_nmi_interrupt,1)
1254   MDRV_CPU_PROGRAM_MAP(lnc_map,0)
13581255
1359   MDRV_CPU_MODIFY("sound")
1360   MDRV_CPU_VBLANK_INT(lnc_sound_interrupt,16)
1256   MDRV_CPU_MODIFY("audio")
1257   MDRV_CPU_VBLANK_INT_HACK(lnc_sound_interrupt,16)
13611258
13621259   MDRV_MACHINE_RESET(lnc)
13631260
r1877r1878
13741271
13751272   /* basic machine hardware */
13761273   MDRV_IMPORT_FROM(lnc)
1377   MDRV_CPU_MODIFY("sound")
1378   MDRV_CPU_VBLANK_INT(nmi_line_pulse,16)
1274   MDRV_CPU_MODIFY("audio")
1275   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,16)
13791276
13801277   /* video hardware */
13811278   MDRV_VIDEO_UPDATE(eggs)
r1877r1878
13871284   /* basic machine hardware */
13881285   MDRV_IMPORT_FROM(wtennis)
13891286   MDRV_CPU_MODIFY("main")
1390   MDRV_CPU_PROGRAM_MAP(mmonkey_readmem,mmonkey_writemem)
1287   MDRV_CPU_PROGRAM_MAP(mmonkey_map,0)
13911288MACHINE_DRIVER_END
13921289
13931290
r1877r1878
13961293   /* basic machine hardware */
13971294   MDRV_IMPORT_FROM(btime)
13981295   MDRV_CPU_REPLACE("main", M6502, 750000)
1399   MDRV_CPU_PROGRAM_MAP(bnj_readmem,bnj_writemem)
1400   MDRV_CPU_VBLANK_INT(btime_nmi_interrupt,1)
1296   MDRV_CPU_PROGRAM_MAP(bnj_map,0)
14011297
14021298   /* video hardware */
14031299   MDRV_GFXDECODE(bnj)
r1877r1878
14131309   /* basic machine hardware */
14141310   MDRV_IMPORT_FROM(btime)
14151311   MDRV_CPU_MODIFY("main")
1416   MDRV_CPU_PROGRAM_MAP(zoar_readmem,zoar_writemem)
1417   MDRV_CPU_VBLANK_INT(zoar_irq_interrupt,1)
1312   MDRV_CPU_PROGRAM_MAP(zoar_map,0)
14181313
14191314   /* video hardware */
14201315   MDRV_GFXDECODE(zoar)
r1877r1878
14291324   /* basic machine hardware */
14301325   MDRV_IMPORT_FROM(btime)
14311326   MDRV_CPU_REPLACE("main", M6502, 750000)
1432   MDRV_CPU_PROGRAM_MAP(disco_readmem,disco_writemem)
1327   MDRV_CPU_PROGRAM_MAP(disco_map,0)
14331328
1434   MDRV_CPU_MODIFY("sound")
1435   MDRV_CPU_PROGRAM_MAP(disco_sound_readmem,disco_sound_writemem)
1329   MDRV_CPU_MODIFY("audio")
1330   MDRV_CPU_PROGRAM_MAP(disco_audio_map,0)
14361331
14371332   /* video hardware */
14381333   MDRV_GFXDECODE(disco)
r1877r1878
18511746
18521747static DRIVER_INIT( cookrace )
18531748{
1854   memcpy(&sound_rambase[0x200], memory_region(REGION_CPU2) + 0xf200, 0x200);
1749   memcpy(&audio_rambase[0x200], memory_region(REGION_CPU2) + 0xf200, 0x200);
18551750   decrypt_C10707_cpu(0, REGION_CPU1);
18561751}
18571752
18581753static DRIVER_INIT( wtennis )
18591754{
1860   memcpy(&sound_rambase[0x200], memory_region(REGION_CPU2) + 0xf200, 0x200);
1755   memcpy(&audio_rambase[0x200], memory_region(REGION_CPU2) + 0xf200, 0x200);
18611756   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xc15f, 0xc15f, 0, 0, wtennis_reset_hack_r);
18621757   decrypt_C10707_cpu(0, REGION_CPU1);
18631758}
src/mame/drivers/qdrmfgp.c
r1877r1878
4747static READ16_HANDLER( i_port1_r )
4848{
4949   if (control & 0x0080)
50      return input_port_0_word_r(0,0);
50      return input_port_0_word_r(machine,0,0);
5151   else
52      return input_port_1_word_r(0,0);
52      return input_port_1_word_r(machine,0,0);
5353}
5454
5555static READ16_HANDLER( i_port2_r )
5656{
5757   /* bit 0-1  battery power sensor: 3=good, 2=low, other=bad */
58
59   return (input_port_2_word_r(0,0) & 0xfffc) | 0x0003;
58   return (input_port_2_word_r(machine,0,0) & 0xfffc) | 0x0003;
6059}
6160
6261
r1877r1878
129128static READ16_HANDLER( v_rom_r )
130129{
131130   UINT8 *mem8 = memory_region(REGION_GFX1);
132   int bank = K056832_word_r(0x34/2, 0xffff);
131   int bank = K056832_word_r(machine, 0x34/2, 0xffff);
133132
134133   offset += bank * 0x800 * 4;
135134
r1877r1878
143142static READ16_HANDLER( gp2_vram_r )
144143{
145144   if (offset < 0x1000/2)
146      return K056832_ram_word_r(offset*2+1, mem_mask);
145      return K056832_ram_word_r(machine, offset*2+1, mem_mask);
147146   else
148      return K056832_ram_word_r((offset-0x1000/2)*2, mem_mask);
147      return K056832_ram_word_r(machine, (offset-0x1000/2)*2, mem_mask);
149148}
150149
151150static READ16_HANDLER( gp2_vram_mirror_r )
152151{
153152   if (offset < 0x1000/2)
154      return K056832_ram_word_r(offset*2, mem_mask);
153      return K056832_ram_word_r(machine, offset*2, mem_mask);
155154   else
156      return K056832_ram_word_r((offset-0x1000/2)*2+1, mem_mask);
155      return K056832_ram_word_r(machine, (offset-0x1000/2)*2+1, mem_mask);
157156}
158157
159158static WRITE16_HANDLER( gp2_vram_w )
160159{
161160   if (offset < 0x1000/2)
162      K056832_ram_word_w(offset*2+1, data, mem_mask);
161      K056832_ram_word_w(machine, offset*2+1, data, mem_mask);
163162   else
164      K056832_ram_word_w((offset-0x1000/2)*2, data, mem_mask);
163      K056832_ram_word_w(machine, (offset-0x1000/2)*2, data, mem_mask);
165164}
166165
167166static WRITE16_HANDLER( gp2_vram_mirror_w )
168167{
169168   if (offset < 0x1000/2)
170      K056832_ram_word_w(offset*2, data, mem_mask);
169      K056832_ram_word_w(machine, offset*2, data, mem_mask);
171170   else
172      K056832_ram_word_w((offset-0x1000/2)*2+1, data, mem_mask);
171      K056832_ram_word_w(machine, (offset-0x1000/2)*2+1, data, mem_mask);
173172}
174173
175174
r1877r1878
196195static READ16_HANDLER( k054539_word_r )
197196{
198197   if (ACCESSING_LSB16)
199      return K054539_0_r(offset);
198      return K054539_0_r(machine, offset);
200199
201200   return 0;
202201}
r1877r1878
204203static WRITE16_HANDLER( k054539_word_w )
205204{
206205   if (ACCESSING_LSB16)
207      K054539_0_w(offset, data);
206      K054539_0_w(machine, offset, data);
208207}
209208
210209/*************/
r1877r1878
215214static READ16_HANDLER( ide_std_r )
216215{
217216   if (offset & 0x01)
218      return ide_controller16_0_r(IDE_STD_OFFSET + offset/2, 0x00ff) >> 8;
217      return ide_controller16_0_r(machine, IDE_STD_OFFSET + offset/2, 0x00ff) >> 8;
219218   else
220      return ide_controller16_0_r(IDE_STD_OFFSET + offset/2, 0x0000);
219      return ide_controller16_0_r(machine, IDE_STD_OFFSET + offset/2, 0x0000);
221220}
222221
223222static WRITE16_HANDLER( ide_std_w )
224223{
225224   if (offset & 0x01)
226      ide_controller16_0_w(IDE_STD_OFFSET + offset/2, data << 8, 0x00ff);
225      ide_controller16_0_w(machine, IDE_STD_OFFSET + offset/2, data << 8, 0x00ff);
227226   else
228      ide_controller16_0_w(IDE_STD_OFFSET + offset/2, data, 0x0000);
227      ide_controller16_0_w(machine, IDE_STD_OFFSET + offset/2, data, 0x0000);
229228}
230229
231230static READ16_HANDLER( ide_alt_r )
232231{
233232   if (offset == 0)
234      return ide_controller16_0_r(IDE_ALT_OFFSET, 0xff00);
233      return ide_controller16_0_r(machine, IDE_ALT_OFFSET, 0xff00);
235234
236235   return 0;
237236}
r1877r1878
239238static WRITE16_HANDLER( ide_alt_w )
240239{
241240   if (offset == 0)
242      ide_controller16_0_w(IDE_ALT_OFFSET, data, 0xff00);
241      ide_controller16_0_w(machine, IDE_ALT_OFFSET, data, 0xff00);
243242}
244243
245244
r1877r1878
261260               break;
262261         }
263262      }
264      return ide_controller16_0_r(IDE_STD_OFFSET + offset/2, 0x00ff) >> 8;
263      return ide_controller16_0_r(machine, IDE_STD_OFFSET + offset/2, 0x00ff) >> 8;
265264   } else {
266      return ide_controller16_0_r(IDE_STD_OFFSET + offset/2, 0x0000);
265      return ide_controller16_0_r(machine, IDE_STD_OFFSET + offset/2, 0x0000);
267266   }
268267}
269268
r1877r1878
676675   /* basic machine hardware */
677676   MDRV_CPU_ADD(M68000, 32000000/2)   /*  16.000 MHz */
678677   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
679   MDRV_CPU_VBLANK_INT(qdrmfgp_interrupt, 2)
678   MDRV_CPU_VBLANK_INT_HACK(qdrmfgp_interrupt, 2)
680679
681680   MDRV_MACHINE_START(qdrmfgp)
682681   MDRV_MACHINE_RESET(qdrmfgp)
r1877r1878
709708   /* basic machine hardware */
710709   MDRV_CPU_ADD(M68000, 32000000/2)   /*  16.000 MHz */
711710   MDRV_CPU_PROGRAM_MAP(gp2_readmem,gp2_writemem)
712   MDRV_CPU_VBLANK_INT(qdrmfgp2_interrupt, 1)
711   MDRV_CPU_VBLANK_INT("main", qdrmfgp2_interrupt)
713712
714713   MDRV_MACHINE_START(qdrmfgp)
715714   MDRV_MACHINE_RESET(qdrmfgp2)
src/mame/drivers/cps1.c
r1877r1878
250250static WRITE16_HANDLER( cps1_sound_command_w )
251251{
252252   if (ACCESSING_LSB)
253      soundlatch_w(0,data & 0xff);
253      soundlatch_w(machine,0,data & 0xff);
254254}
255255
256256WRITE16_HANDLER( cps1_coinctrl_w )
r1877r1878
34663466   /* basic machine hardware */
34673467   MDRV_CPU_ADD_TAG("main", M68000, 10000000)
34683468   MDRV_CPU_PROGRAM_MAP(cps1_readmem,cps1_writemem)
3469   MDRV_CPU_VBLANK_INT(cps1_interrupt,1)
3469   MDRV_CPU_VBLANK_INT("main", cps1_interrupt)
34703470
34713471   MDRV_CPU_ADD_TAG("sound", Z80, 3579545)
34723472   /* audio CPU */
r1877r1878
35203520   /* basic machine hardware */
35213521   MDRV_IMPORT_FROM(cps1)
35223522   MDRV_CPU_REPLACE("main", M68000, 12000000)
3523   MDRV_CPU_VBLANK_INT(cps1_qsound_interrupt,1)  /* ??? interrupts per frame */
3523   MDRV_CPU_VBLANK_INT("main", cps1_qsound_interrupt)  /* ??? interrupts per frame */
35243524
35253525   MDRV_CPU_REPLACE("sound", Z80, 8000000)
35263526   MDRV_CPU_PROGRAM_MAP(qsound_readmem,qsound_writemem)
src/mame/drivers/nova2001.c
r1877r1878
118118******************************************************************************/
119119
120120#include "driver.h"
121#include "deprecat.h"
121122#include "sound/ay8910.h"
122123#include "nova2001.h"
123124
r1877r1878
689690   /* basic machine hardware */
690691   MDRV_CPU_ADD(Z80, MAIN_CLOCK/4)   // 3 MHz verified on schematics
691692   MDRV_CPU_PROGRAM_MAP(nova2001_map,0)
692   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
693   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
693694
694695   /* video hardware */
695696   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
722723   /* basic machine hardware */
723724   MDRV_CPU_ADD(Z80, MAIN_CLOCK/4)   // 3 MHz
724725   MDRV_CPU_PROGRAM_MAP(ninjakun_cpu1_map,0)
725   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
726   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
726727
727728   MDRV_CPU_ADD(Z80, MAIN_CLOCK/4)   // 3 MHz
728729   MDRV_CPU_PROGRAM_MAP(ninjakun_cpu2_map,0)
729   MDRV_CPU_VBLANK_INT(irq0_line_hold,4) /* ? */
730   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4) /* ? */
730731
731732   MDRV_INTERLEAVE(100)   /* 100 CPU slices per frame */
732733
r1877r1878
764765   MDRV_CPU_ADD(Z80, MAIN_CLOCK/4)   // 3 MHz
765766   MDRV_CPU_PROGRAM_MAP(pkunwar_map,0)
766767   MDRV_CPU_IO_MAP(pkunwar_io,0)
767   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
768   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
768769
769770   /* video hardware */
770771   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
798799   MDRV_CPU_ADD(Z80, MAIN_CLOCK/4)   // 3 MHz
799800   MDRV_CPU_PROGRAM_MAP(raiders5_cpu1_map,0)
800801   MDRV_CPU_IO_MAP(raiders5_io,0)
801   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
802   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
802803
803804   MDRV_CPU_ADD(Z80, MAIN_CLOCK/4)   // 3 MHz
804805   MDRV_CPU_PROGRAM_MAP(raiders5_cpu2_map,0)
805   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)   /* ? */
806   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)   /* ? */
806807
807808   MDRV_INTERLEAVE(400)
808809
src/mame/drivers/starcrus.c
r1877r1878
173173   MDRV_CPU_ADD(8080,9750000/9)  /* 8224 chip is a divide by 9 */
174174   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
175175   MDRV_CPU_IO_MAP(readport,writeport)
176   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
176   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
177177
178178   /* video hardware */
179179   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/yunsun16.c
r1877r1878
123123   }
124124}
125125
126static ADDRESS_MAP_START( yunsun16_readmem, ADDRESS_SPACE_PROGRAM, 16 )
127   AM_RANGE(0x000000, 0x07ffff) AM_READ(MRA16_ROM               )   // ROM
128   AM_RANGE(0xff0000, 0xffffff) AM_READ(MRA16_RAM               )   // RAM
129   AM_RANGE(0x800000, 0x800001) AM_READ(input_port_0_word_r      )   // P1 + P2
130   AM_RANGE(0x800018, 0x800019) AM_READ(input_port_1_word_r      )   // Coins
131   AM_RANGE(0x80001a, 0x80001b) AM_READ(input_port_2_word_r      )   // DSW1
132   AM_RANGE(0x80001c, 0x80001d) AM_READ(input_port_3_word_r      )   // DSW2
133   AM_RANGE(0x800188, 0x800189) AM_READ(OKIM6295_status_0_lsb_r   )   // Sound
134   AM_RANGE(0x900000, 0x903fff) AM_READ(MRA16_RAM               )   // Palette
135   AM_RANGE(0x908000, 0x90bfff) AM_READ(MRA16_RAM               )   // Layer 1
136   AM_RANGE(0x90c000, 0x90ffff) AM_READ(MRA16_RAM               )   // Layer 0
137   AM_RANGE(0x910000, 0x910fff) AM_READ(MRA16_RAM               )   // Sprites
138ADDRESS_MAP_END
139
140static ADDRESS_MAP_START( yunsun16_writemem, ADDRESS_SPACE_PROGRAM, 16 )
141   AM_RANGE(0x000000, 0x07ffff) AM_WRITE(MWA16_ROM               )   // ROM
142   AM_RANGE(0xff0000, 0xffffff) AM_WRITE(MWA16_RAM               )   // RAM
143   AM_RANGE(0x800030, 0x800031) AM_WRITE(MWA16_NOP               )   // ? (value: don't care)
144   AM_RANGE(0x800100, 0x800101) AM_WRITE(MWA16_NOP               )   // ? $9100
145   AM_RANGE(0x800102, 0x800103) AM_WRITE(MWA16_NOP               )   // ? $9080
146   AM_RANGE(0x800104, 0x800105) AM_WRITE(MWA16_NOP               )   // ? $90c0
147   AM_RANGE(0x80010a, 0x80010b) AM_WRITE(MWA16_NOP               )   // ? $9000
126static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
127   AM_RANGE(0x000000, 0x07ffff) AM_ROM
128   AM_RANGE(0x800000, 0x800001) AM_READ(input_port_0_word_r               )   // P1 + P2
129   AM_RANGE(0x800018, 0x800019) AM_READ(input_port_1_word_r               )   // Coins
130   AM_RANGE(0x80001a, 0x80001b) AM_READ(input_port_2_word_r               )   // DSW1
131   AM_RANGE(0x80001c, 0x80001d) AM_READ(input_port_3_word_r               )   // DSW2
132   AM_RANGE(0x800030, 0x800031) AM_WRITE(MWA16_NOP                        )   // ? (value: don't care)
133   AM_RANGE(0x800100, 0x800101) AM_WRITE(MWA16_NOP                        )   // ? $9100
134   AM_RANGE(0x800102, 0x800103) AM_WRITE(MWA16_NOP                        )   // ? $9080
135   AM_RANGE(0x800104, 0x800105) AM_WRITE(MWA16_NOP                        )   // ? $90c0
136   AM_RANGE(0x80010a, 0x80010b) AM_WRITE(MWA16_NOP                        )   // ? $9000
148137   AM_RANGE(0x80010c, 0x80010f) AM_WRITE(MWA16_RAM) AM_BASE(&yunsun16_scroll_1   )   // Scrolling
149   AM_RANGE(0x800114, 0x800117) AM_WRITE(MWA16_RAM) AM_BASE(&yunsun16_scroll_0   )   //
138   AM_RANGE(0x800114, 0x800117) AM_WRITE(MWA16_RAM) AM_BASE(&yunsun16_scroll_0   )   // Scrolling
150139   AM_RANGE(0x800154, 0x800155) AM_WRITE(MWA16_RAM) AM_BASE(&yunsun16_priority   )   // Priority
151   AM_RANGE(0x800180, 0x800181) AM_WRITE(yunsun16_sound_bank_w      )   // Sound
152   AM_RANGE(0x800188, 0x800189) AM_WRITE(OKIM6295_data_0_lsb_w      )   //
153   AM_RANGE(0x8001fe, 0x8001ff) AM_WRITE(MWA16_NOP               )   // ? 0 (during int)
154   AM_RANGE(0x900000, 0x903fff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16   )   // Palette
155   AM_RANGE(0x908000, 0x90bfff) AM_WRITE(yunsun16_vram_1_w) AM_BASE(&yunsun16_vram_1      )   // Layer 1
156   AM_RANGE(0x90c000, 0x90ffff) AM_WRITE(yunsun16_vram_0_w) AM_BASE(&yunsun16_vram_0      )   // Layer 0
157   AM_RANGE(0x910000, 0x910fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size   )   // Sprites
140   AM_RANGE(0x800180, 0x800181) AM_WRITE(yunsun16_sound_bank_w               )   // Sound
141   AM_RANGE(0x800188, 0x800189) AM_READWRITE(OKIM6295_status_0_lsb_r, OKIM6295_data_0_lsb_w   )   // Sound
142   AM_RANGE(0x8001fe, 0x8001ff) AM_WRITE(MWA16_NOP                                    )   // ? 0 (during int)
143   AM_RANGE(0x900000, 0x903fff) AM_READWRITE(MRA16_RAM, paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16)   // Palette
144   AM_RANGE(0x908000, 0x90bfff) AM_READWRITE(MRA16_RAM, yunsun16_vram_1_w) AM_BASE(&yunsun16_vram_1   )   // Layer 1
145   AM_RANGE(0x90c000, 0x90ffff) AM_READWRITE(MRA16_RAM, yunsun16_vram_0_w) AM_BASE(&yunsun16_vram_0   )   // Layer 0
146   AM_RANGE(0x910000, 0x910fff) AM_RAM   AM_BASE(&spriteram16) AM_SIZE(&spriteram_size               )   // Sprites
147   AM_RANGE(0xff0000, 0xffffff) AM_RAM
158148ADDRESS_MAP_END
159149
160150
r1877r1878
168158*/
169159      if ((data&0xff)!=0x3a)
170160      {
171      soundlatch_w(0,data & 0xff);
172      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
161      soundlatch_w(machine,0,data & 0xff);
162      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
173163      }
174164   }
175165}
r1877r1878
188178
189179***************************************************************************/
190180
191static ADDRESS_MAP_START( yunsun16_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
192   AM_RANGE(0x0000, 0xdfff) AM_READ(MRA8_ROM      )   // ROM
193   AM_RANGE(0xe000, 0xe7ff) AM_READ(MRA8_RAM      )   // RAM
181static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
182   AM_RANGE(0x0000, 0xdfff) AM_ROM
183   AM_RANGE(0xe000, 0xe7ff) AM_RAM
194184ADDRESS_MAP_END
195185
196static ADDRESS_MAP_START( yunsun16_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
197   AM_RANGE(0x0000, 0xdfff) AM_WRITE(MWA8_ROM      )   // ROM
198   AM_RANGE(0xe000, 0xe7ff) AM_WRITE(MWA8_RAM      )   // RAM
199ADDRESS_MAP_END
200
201static ADDRESS_MAP_START( yunsun16_sound_readport, ADDRESS_SPACE_IO, 8 )
186static ADDRESS_MAP_START( sound_port_map, ADDRESS_SPACE_IO, 8 )
202187   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
203   AM_RANGE(0x10, 0x10) AM_READ(YM3812_status_port_0_r   )   // YM3812
204   AM_RANGE(0x18, 0x18) AM_READ(soundlatch_r            )   // From Main CPU
205   AM_RANGE(0x1c, 0x1c) AM_READ(OKIM6295_status_0_r      )   // M6295
188   AM_RANGE(0x10, 0x10) AM_READWRITE(YM3812_status_port_0_r, YM3812_control_port_0_w   )   // YM3812
189   AM_RANGE(0x11, 0x11) AM_WRITE(YM3812_write_port_0_w                           )
190   AM_RANGE(0x18, 0x18) AM_READ(soundlatch_r                                 )   // From Main CPU
191   AM_RANGE(0x1c, 0x1c) AM_READWRITE(OKIM6295_status_0_r, OKIM6295_data_0_w         )   // M6295
206192ADDRESS_MAP_END
207193
208static ADDRESS_MAP_START( yunsun16_sound_writeport, ADDRESS_SPACE_IO, 8 )
209   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
210   AM_RANGE(0x10, 0x10) AM_WRITE(YM3812_control_port_0_w   )   // YM3812
211   AM_RANGE(0x11, 0x11) AM_WRITE(YM3812_write_port_0_w      )
212   AM_RANGE(0x1c, 0x1c) AM_WRITE(OKIM6295_data_0_w         )   // M6295
213ADDRESS_MAP_END
214194
215
216195/***************************************************************************
217196
218197
r1877r1878
529508
530509   /* basic machine hardware */
531510   MDRV_CPU_ADD(M68000, 16000000)
532   MDRV_CPU_PROGRAM_MAP(yunsun16_readmem,yunsun16_writemem)
533   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
511   MDRV_CPU_PROGRAM_MAP(main_map,0)
512   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
534513
535514   MDRV_CPU_ADD(Z80, 3000000)
536515   /* audio CPU */   /* ? */
537   MDRV_CPU_PROGRAM_MAP(yunsun16_sound_readmem,yunsun16_sound_writemem)
538   MDRV_CPU_IO_MAP(yunsun16_sound_readport,yunsun16_sound_writeport)
516   MDRV_CPU_PROGRAM_MAP(sound_map,0)
517   MDRV_CPU_IO_MAP(sound_port_map,0)
539518
540519   /* video hardware */
541520   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
574553
575554   /* basic machine hardware */
576555   MDRV_CPU_ADD(M68000, 16000000)
577   MDRV_CPU_PROGRAM_MAP(yunsun16_readmem,yunsun16_writemem)
578   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
556   MDRV_CPU_PROGRAM_MAP(main_map,0)
557   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
579558
580559   /* video hardware */
581560   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/scobra.c
r1877r1878
9090
9191static READ8_HANDLER(scobra_type2_ppi8255_0_r)
9292{
93   return ppi8255_0_r(offset >> 2);
93   return ppi8255_0_r(machine, offset >> 2);
9494}
9595
9696static READ8_HANDLER(scobra_type2_ppi8255_1_r)
9797{
98   return ppi8255_1_r(offset >> 2);
98   return ppi8255_1_r(machine, offset >> 2);
9999}
100100
101101static WRITE8_HANDLER(scobra_type2_ppi8255_0_w)
102102{
103   ppi8255_0_w(offset >> 2, data);
103   ppi8255_0_w(machine, offset >> 2, data);
104104}
105105
106106static WRITE8_HANDLER(scobra_type2_ppi8255_1_w)
107107{
108   ppi8255_1_w(offset >> 2, data);
108   ppi8255_1_w(machine, offset >> 2, data);
109109}
110110
111111static READ8_HANDLER(hustler_ppi8255_0_r)
112112{
113   return ppi8255_0_r(offset >> 3);
113   return ppi8255_0_r(machine, offset >> 3);
114114}
115115
116116static READ8_HANDLER(hustler_ppi8255_1_r)
117117{
118   return ppi8255_1_r(offset >> 3);
118   return ppi8255_1_r(machine, offset >> 3);
119119}
120120
121121static WRITE8_HANDLER(hustler_ppi8255_0_w)
122122{
123   ppi8255_0_w(offset >> 3, data);
123   ppi8255_0_w(machine, offset >> 3, data);
124124}
125125
126126static WRITE8_HANDLER(hustler_ppi8255_1_w)
127127{
128   ppi8255_1_w(offset >> 3, data);
128   ppi8255_1_w(machine, offset >> 3, data);
129129}
130130
131131static ADDRESS_MAP_START( type1_readmem, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
267267
268268static READ8_HANDLER( anteatg_ppi8255_0_reg0_r )
269269{
270   return ppi8255_0_r(0);
270   return ppi8255_0_r(machine, 0);
271271}
272272
273273static READ8_HANDLER( anteatg_ppi8255_0_reg1_r )
274274{
275   return ppi8255_0_r(1);
275   return ppi8255_0_r(machine, 1);
276276}
277277
278278static READ8_HANDLER( anteatg_ppi8255_0_reg2_r )
279279{
280   return ppi8255_0_r(2);
280   return ppi8255_0_r(machine, 2);
281281}
282282
283283static READ8_HANDLER( anteatg_ppi8255_0_reg3_r )
284284{
285   return ppi8255_0_r(3);
285   return ppi8255_0_r(machine, 3);
286286}
287287
288288static WRITE8_HANDLER( anteatg_ppi8255_0_reg0_w )
289289{
290   ppi8255_0_w(0, data);
290   ppi8255_0_w(machine, 0, data);
291291}
292292
293293static WRITE8_HANDLER( anteatg_ppi8255_0_reg1_w )
294294{
295   ppi8255_0_w(1, data);
295   ppi8255_0_w(machine, 1, data);
296296}
297297
298298static WRITE8_HANDLER( anteatg_ppi8255_0_reg2_w )
299299{
300   ppi8255_0_w(2, data);
300   ppi8255_0_w(machine, 2, data);
301301}
302302
303303static WRITE8_HANDLER( anteatg_ppi8255_0_reg3_w )
304304{
305   ppi8255_0_w(3, data);
305   ppi8255_0_w(machine, 3, data);
306306}
307307
308308static WRITE8_HANDLER( anteatg_ppi8255_1_reg0_w )
309309{
310   ppi8255_1_w(0, data);
310   ppi8255_1_w(machine, 0, data);
311311}
312312
313313static WRITE8_HANDLER( anteatg_ppi8255_1_reg1_w )
314314{
315   ppi8255_1_w(1, data);
315   ppi8255_1_w(machine, 1, data);
316316}
317317
318318static WRITE8_HANDLER( anteatg_ppi8255_1_reg3_w )
319319{
320   ppi8255_1_w(3, data);
320   ppi8255_1_w(machine, 3, data);
321321}
322322
323323static ADDRESS_MAP_START( anteatg_readmem, ADDRESS_SPACE_PROGRAM, 8 )
src/mame/drivers/wiz.c
r1877r1878
158158***************************************************************************/
159159
160160#include "driver.h"
161#include "deprecat.h"
161162#include "sound/ay8910.h"
162163#include "sound/discrete.h"
163164
r1877r1878
186187static WRITE8_HANDLER( sound_command_w )
187188{
188189   static int dsc0=1, dsc1=1;
189
190190   switch (offset)
191191   {
192192      // 0x90 triggers a jump to non-existant address(development system?) and must be filtered
193193      case 0x00:
194         if (data != 0x90) soundlatch_w(0, data);
194         if (data != 0x90) soundlatch_w(machine, 0, data);
195195      break;
196196
197197      // explosion sound trigger(analog?)
198198      case 0x08:
199         discrete_sound_w(STINGER_BOOM_EN1, dsc1);
200         discrete_sound_w(STINGER_BOOM_EN2, dsc1^=1);
199         discrete_sound_w(machine, STINGER_BOOM_EN1, dsc1);
200         discrete_sound_w(machine, STINGER_BOOM_EN2, dsc1^=1);
201201      break;
202202
203203      // player shot sound trigger(analog?)
204204      case 0x0a:
205         discrete_sound_w(STINGER_SHOT_EN1, dsc0);
206         discrete_sound_w(STINGER_SHOT_EN2, dsc0^=1);
205         discrete_sound_w(machine, STINGER_SHOT_EN1, dsc0);
206         discrete_sound_w(machine, STINGER_SHOT_EN2, dsc0^=1);
207207      break;
208208   }
209209}
r1877r1878
706706   /* basic machine hardware */
707707   MDRV_CPU_ADD(Z80, 18432000/6)   /* 3.072 MHz ??? */
708708   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
709   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
709   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
710710
711711   MDRV_CPU_ADD(Z80, 14318000/8)   /* ? */
712712   /* audio CPU */
713713   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
714   MDRV_CPU_VBLANK_INT(nmi_line_pulse,4)   /* ??? */
714   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,4)   /* ??? */
715715
716716   /* video hardware */
717717   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/stactics.c
r1877r1878
5555
5656static CUSTOM_INPUT( get_motor_not_ready )
5757{
58   stactics_state *state = Machine->driver_data;
58   stactics_state *state = machine->driver_data;
5959
6060   /* if the motor is self-centering, but not centered yet */
6161    return ((*state->motor_on & 0x01) == 0) &&
r1877r1878
130130static CUSTOM_INPUT( get_rng )
131131{
132132   /* this is a 555 timer, but cannot read one of the resistor values */
133   return mame_rand(Machine) & 0x07;
133   return mame_rand(machine) & 0x07;
134134}
135135
136136
r1877r1878
249249
250250    PORT_START  /* IN2 */
251251    PORT_BIT (0x07, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(get_rng, 0)
252    PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(stactics_get_vblank_count_d3, 0)
252    PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(stactics_get_frame_count_d3, 0)
253253    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
254254    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
255255    PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) )
r1877r1878
310310   /* basic machine hardware */
311311   MDRV_CPU_ADD(8080, 1933560)
312312   MDRV_CPU_PROGRAM_MAP(main_map,0)
313   MDRV_CPU_VBLANK_INT(stactics_interrupt, 1)
313   MDRV_CPU_VBLANK_INT("main", stactics_interrupt)
314314
315315   MDRV_MACHINE_START(stactics)
316316
src/mame/drivers/mermaid.c
r1877r1878
111111
112112static WRITE8_HANDLER( mermaid_AY8910_write_port_w )
113113{
114   if (mermaid_AY8910_enable[0]) AY8910_write_port_0_w(offset, data);
115   if (mermaid_AY8910_enable[1]) AY8910_write_port_1_w(offset, data);
114   if (mermaid_AY8910_enable[0]) AY8910_write_port_0_w(machine, offset, data);
115   if (mermaid_AY8910_enable[1]) AY8910_write_port_1_w(machine, offset, data);
116116}
117117
118118static WRITE8_HANDLER( mermaid_AY8910_control_port_w )
119119{
120   if (mermaid_AY8910_enable[0]) AY8910_control_port_0_w(offset, data);
121   if (mermaid_AY8910_enable[1]) AY8910_control_port_1_w(offset, data);
120   if (mermaid_AY8910_enable[0]) AY8910_control_port_0_w(machine, offset, data);
121   if (mermaid_AY8910_enable[1]) AY8910_control_port_1_w(machine, offset, data);
122122}
123123
124124/* Memory Map */
r1877r1878
255255   // basic machine hardware
256256   MDRV_CPU_ADD(Z80, 4000000)   // ???
257257   MDRV_CPU_PROGRAM_MAP(mermaid_map, 0)
258   MDRV_CPU_VBLANK_INT(nmi_line_pulse, 1)
258   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
259259
260260   // video hardware
261261
src/mame/drivers/calorie.c
r1877r1878
190190
191191static READ8_HANDLER( calorie_soundlatch_r )
192192{
193   UINT8 latch = soundlatch_r(0);
194   soundlatch_clear_w(0,0);
193   UINT8 latch = soundlatch_r(machine,0);
194   soundlatch_clear_w(machine,0,0);
195195   return latch;
196196}
197197
r1877r1878
362362   /* basic machine hardware */
363363   MDRV_CPU_ADD(Z80,4000000)       /* 4 MHz */
364364   MDRV_CPU_PROGRAM_MAP(calorie_map,0)
365   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
365   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
366366
367367   MDRV_CPU_ADD(Z80,3000000)       /* 3 MHz */
368368   MDRV_CPU_PROGRAM_MAP(calorie_sound_map,0)
src/mame/drivers/drtomy.c
r1877r1878
4747      3  | xxxxxxxx xxxxxx-- | sprite code
4848*/
4949
50static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
50static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
5151{
5252   int i, x, y, ex, ey;
5353   const gfx_element *gfx = machine->gfx[0];
r1877r1878
252252   /* basic machine hardware */
253253   MDRV_CPU_ADD(M68000,24000000/2)         /* ? MHz */
254254   MDRV_CPU_PROGRAM_MAP(drtomy_map,0)
255   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
255   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
256256
257257   /* video hardware */
258258   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/gaelco3d.c
r1877r1878
144144
145145#include "driver.h"
146146#include "deprecat.h"
147#include "memconv.h"
147148#include "gaelco3d.h"
148149#include "cpu/tms32031/tms32031.h"
149150#include "cpu/adsp2100/adsp2100.h"
r1877r1878
252253{
253254   cpunum_set_input_line(Machine, 0, 2, CLEAR_LINE);
254255}
255static WRITE32_HANDLER( irq_ack_020_w ) { if ((mem_mask & 0xffff0000) != 0xffff0000) irq_ack_w(offset, data >> 16, mem_mask >> 16); }
256static WRITE32_HANDLER( irq_ack_020_w ) { if ((mem_mask & 0xffff0000) != 0xffff0000) irq_ack_w(machine, offset, data >> 16, mem_mask >> 16); }
256257
257258
258259
r1877r1878
270271   logerror("eeprom_data_r(%02X)\n", result);
271272   return result;
272273}
273static READ32_HANDLER( eeprom_data_020_r ) { return eeprom_data_r(offset, mem_mask) << 16; }
274static READ32_HANDLER( eeprom_data_020_r ) { return eeprom_data_r(machine, offset, mem_mask) << 16; }
274275
275276
276277static WRITE16_HANDLER( eeprom_data_w )
r1877r1878
278279   if (!(mem_mask & 0xff))
279280      EEPROM_write_bit(data & 0x01);
280281}
281static WRITE32_HANDLER( eeprom_data_020_w ) { if ((mem_mask & 0xffff) != 0xffff) eeprom_data_w(offset, data, mem_mask); }
282static WRITE32_HANDLER( eeprom_data_020_w ) { if ((mem_mask & 0xffff) != 0xffff) eeprom_data_w(machine, offset, data, mem_mask); }
282283
283284
284285static WRITE16_HANDLER( eeprom_clock_w )
r1877r1878
286287   if (!(mem_mask & 0xff))
287288      EEPROM_set_clock_line((data & 0x01) ? ASSERT_LINE : CLEAR_LINE);
288289}
289static WRITE32_HANDLER( eeprom_clock_020_w ) { if ((mem_mask & 0xffff) != 0xffff) eeprom_clock_w(offset, data, mem_mask); }
290static WRITE32_HANDLER( eeprom_clock_020_w ) { if ((mem_mask & 0xffff) != 0xffff) eeprom_clock_w(machine, offset, data, mem_mask); }
290291
291292
292293static WRITE16_HANDLER( eeprom_cs_w )
r1877r1878
294295   if (!(mem_mask & 0xff))
295296      EEPROM_set_cs_line((data & 0x01) ? CLEAR_LINE : ASSERT_LINE);
296297}
297static WRITE32_HANDLER( eeprom_cs_020_w ) { if ((mem_mask & 0xffff) != 0xffff) eeprom_cs_w(offset, data, mem_mask); }
298static WRITE32_HANDLER( eeprom_cs_020_w ) { if ((mem_mask & 0xffff) != 0xffff) eeprom_cs_w(machine, offset, data, mem_mask); }
298299
299300
300301
r1877r1878
318319   if (!(mem_mask & 0xff))
319320      timer_call_after_resynch(NULL, data & 0xff, delayed_sound_w);
320321}
321static WRITE32_HANDLER( sound_data_020_w ) { if ((mem_mask & 0xffff0000) != 0xffff0000) sound_data_w(offset, data >> 16, mem_mask >> 16); }
322static WRITE32_HANDLER( sound_data_020_w ) { if ((mem_mask & 0xffff0000) != 0xffff0000) sound_data_w(machine, offset, data >> 16, mem_mask >> 16); }
322323
323324
324325static READ16_HANDLER( sound_data_r )
r1877r1878
336337      return sound_status;
337338   return 0xffff;
338339}
339static READ32_HANDLER( sound_status_020_r ) { if ((mem_mask & 0x0000ffff) != 0x0000ffff) return sound_status_r(offset, mem_mask); return ~0; }
340static READ32_HANDLER( sound_status_020_r ) { if ((mem_mask & 0x0000ffff) != 0x0000ffff) return sound_status_r(machine, offset, mem_mask); return ~0; }
340341
341342
342343static WRITE16_HANDLER( sound_status_w )
r1877r1878
382383   else
383384      logerror("%06X:analog_port_clock_w(%02X) = %08X & %08X\n", activecpu_get_pc(), offset, data, ~mem_mask);
384385}
385static WRITE32_HANDLER( analog_port_clock_020_w ) { if ((mem_mask & 0xffff) != 0xffff) analog_port_clock_w(offset, data, mem_mask); }
386static WRITE32_HANDLER( analog_port_clock_020_w ) { if ((mem_mask & 0xffff) != 0xffff) analog_port_clock_w(machine, offset, data, mem_mask); }
386387
387388
388389static WRITE16_HANDLER( analog_port_latch_w )
r1877r1878
401402   else
402403      logerror("%06X:analog_port_latch_w(%02X) = %08X & %08X\n", activecpu_get_pc(), offset, data, ~mem_mask);
403404}
404static WRITE32_HANDLER( analog_port_latch_020_w ) { if ((mem_mask & 0xffff) != 0xffff) analog_port_latch_w(offset, data, mem_mask); }
405static WRITE32_HANDLER( analog_port_latch_020_w ) { if ((mem_mask & 0xffff) != 0xffff) analog_port_latch_w(machine, offset, data, mem_mask); }
405406
406407
407408
r1877r1878
445446   logerror("%06X:tms_reset_w(%02X) = %08X & %08X\n", activecpu_get_pc(), offset, data, ~mem_mask);
446447      cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, (data == 0xffff) ? CLEAR_LINE : ASSERT_LINE);
447448}
448static WRITE32_HANDLER( tms_reset_020_w ) { if ((mem_mask & 0xffff) != 0xffff) tms_reset_w(offset, data, mem_mask); }
449static WRITE32_HANDLER( tms_reset_020_w ) { if ((mem_mask & 0xffff) != 0xffff) tms_reset_w(machine, offset, data, mem_mask); }
449450
450451
451452static WRITE16_HANDLER( tms_irq_w )
r1877r1878
456457   if (!(mem_mask & 0xff))
457458      cpunum_set_input_line(Machine, 1, 0, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE);
458459}
459static WRITE32_HANDLER( tms_irq_020_w ) { if ((mem_mask & 0xffff) != 0xffff) tms_irq_w(offset, data, mem_mask); }
460static WRITE32_HANDLER( tms_irq_020_w ) { if ((mem_mask & 0xffff) != 0xffff) tms_irq_w(machine, offset, data, mem_mask); }
460461
461462
462463static WRITE16_HANDLER( tms_control3_w )
463464{
464465   logerror("%06X:tms_control3_w(%02X) = %08X & %08X\n", activecpu_get_pc(), offset, data, ~mem_mask);
465466}
466static WRITE32_HANDLER( tms_control3_020_w ) { if ((mem_mask & 0xffff) != 0xffff) tms_control3_w(offset, data, mem_mask); }
467static WRITE32_HANDLER( tms_control3_020_w ) { if ((mem_mask & 0xffff) != 0xffff) tms_control3_w(machine, offset, data, mem_mask); }
467468
468469
469470static WRITE16_HANDLER( tms_comm_w )
r1877r1878
471472   COMBINE_DATA(&tms_comm_base[offset ^ tms_offset_xor]);
472473   logerror("%06X:tms_comm_w(%02X) = %08X & %08X\n", activecpu_get_pc(), offset*2, data, ~mem_mask);
473474}
474static WRITE32_HANDLER( tms_comm_020_w )
475{
476   if ((mem_mask & 0xffff0000) != 0xffff0000) tms_comm_w(offset * 2 + 0, data >> 16, mem_mask >> 16);
477   if ((mem_mask & 0x0000ffff) != 0x0000ffff) tms_comm_w(offset * 2 + 1, data, mem_mask);
478}
475static WRITE32_HANDLER( tms_comm_020_w ) { write32be_with_16be_handler(tms_comm_w, machine, offset, data, mem_mask); }
479476
480477
481478
r1877r1878
711708   if (!(mem_mask & 0xff))
712709      set_led_status(0, data != 0);
713710}
714static WRITE32_HANDLER( led_0_020_w ) { if ((mem_mask & 0xffff) != 0xffff) led_0_w(offset, data, mem_mask); }
711static WRITE32_HANDLER( led_0_020_w ) { if ((mem_mask & 0xffff) != 0xffff) led_0_w(machine, offset, data, mem_mask); }
715712
716713
717714static WRITE16_HANDLER( led_1_w )
r1877r1878
720717   if (!(mem_mask & 0xff))
721718      set_led_status(1, data != 0);
722719}
723static WRITE32_HANDLER( led_1_020_w ) { if ((mem_mask & 0xffff) != 0xffff) led_1_w(offset, data, mem_mask); }
720static WRITE32_HANDLER( led_1_020_w ) { if ((mem_mask & 0xffff) != 0xffff) led_1_w(machine, offset, data, mem_mask); }
724721
725722
726723
r1877r1878
943940   /* basic machine hardware */
944941   MDRV_CPU_ADD_TAG("main", M68000, 15000000)
945942   MDRV_CPU_PROGRAM_MAP(main_map,0)
946   MDRV_CPU_VBLANK_INT(vblank_gen, 1)
943   MDRV_CPU_VBLANK_INT("main", vblank_gen)
947944
948945   MDRV_CPU_ADD_TAG("tms", TMS32031, 60000000)
949946   MDRV_CPU_PROGRAM_MAP(tms_map,0)
src/mame/drivers/avalnche.c
r1877r1878
2828***************************************************************************/
2929
3030#include "driver.h"
31#include "deprecat.h"
3132#include "sound/discrete.h"
3233#include "avalnche.h"
3334
r1877r1878
155156
156157static INPUT_PORTS_START( avalnche )
157158   PORT_START_TAG("IN0")
158   PORT_BIT (0x03, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* Spare */
159   PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Coinage ) )
159   PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW:6" )         /* Listed as "Unused" */
160   PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW:5" )         /* Listed as "Unused" */
161   PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW:4,3")
160162   PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
161163   PORT_DIPSETTING(    0x04, DEF_STR( 1C_1C ) )
162164   PORT_DIPSETTING(    0x0c, DEF_STR( 1C_2C ) )
163165   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
164   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Language ) )
166   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Language ) )      PORT_DIPLOCATION("SW:2,1")
165167   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
166168   PORT_DIPSETTING(    0x30, DEF_STR( German ) )
167169   PORT_DIPSETTING(    0x20, DEF_STR( French ) )
r1877r1878
172174   PORT_START_TAG("IN1")
173175   PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
174176   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
175   PORT_DIPNAME( 0x04, 0x04, "Allow Extended Play" )
177   PORT_DIPNAME( 0x04, 0x04, "Allow Extended Play" )   PORT_DIPLOCATION("SW:8")
176178   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
177179   PORT_DIPSETTING(    0x04, DEF_STR( Yes ) )
178   PORT_DIPNAME( 0x08, 0x00, "Lives/Extended Play" )
179   PORT_DIPSETTING(    0x00, "3/450 points" )
180   PORT_DIPSETTING(    0x08, "5/750 points" )
181   PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* SLAM */
180   PORT_DIPNAME( 0x08, 0x00, "Lives/Extended Play" )   PORT_DIPLOCATION("SW:7")
181   PORT_DIPSETTING(    0x00, "3/450 Points" )
182   PORT_DIPSETTING(    0x08, "5/750 Points" )
183   PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )      /* SLAM */
182184   PORT_SERVICE( 0x20, IP_ACTIVE_HIGH)
183   PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 )   /* Serve */
184   PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_VBLANK )   /* VBLANK */
185   PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 )      /* Serve */
186   PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_VBLANK )      /* VBLANK */
185187
186188   PORT_START_TAG("IN2")
187189   PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x40,0xb7) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_CENTERDELTA(0)
r1877r1878
189191
190192
191193static INPUT_PORTS_START( cascade )
192   PORT_START_TAG("IN0")
193   PORT_BIT (0x03, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* Spare */
194   PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Coinage ) )
195   PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
196   PORT_DIPSETTING(    0x04, DEF_STR( 1C_1C ) )
197   PORT_DIPSETTING(    0x0c, DEF_STR( 1C_2C ) )
198   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
199   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Language ) )
194   PORT_INCLUDE( avalnche )
195
196   PORT_MODIFY("IN0")
197   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Language ) )      PORT_DIPLOCATION("SW:2,1")
200198   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
201199   PORT_DIPSETTING(    0x30, DEF_STR( German ) )
202200   PORT_DIPSETTING(    0x20, DEF_STR( French ) )
203201   PORT_DIPSETTING(    0x10, DEF_STR( Italian ) )
204   PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_START2 )
205   PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_START1 )
206202
207   PORT_START_TAG("IN1")
208   PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
209   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
210   PORT_DIPNAME( 0x04, 0x04, "Allow Extended Play" )
211   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
212   PORT_DIPSETTING(    0x04, DEF_STR( Yes ) )
213   PORT_DIPNAME( 0x08, 0x00, "Extended Play" )
214   PORT_DIPSETTING(    0x00, "1500 points" )
215   PORT_DIPSETTING(    0x08, "2500 points" )
216   PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* SLAM */
217   PORT_SERVICE( 0x20, IP_ACTIVE_HIGH)
218   PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 )   /* Serve */
219   PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_VBLANK )   /* VBLANK */
220
221   PORT_START_TAG("IN2")
222   PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x40,0xb7) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_CENTERDELTA(0)
203   PORT_MODIFY("IN1")
204   PORT_DIPNAME( 0x08, 0x00, "Extended Play" )         PORT_DIPLOCATION("SW:7")
205   PORT_DIPSETTING(    0x00, "1500 Points" )
206   PORT_DIPSETTING(    0x08, "2500 Points" )
223207INPUT_PORTS_END
224208
225209
r1877r1878
235219   /* basic machine hardware */
236220   MDRV_CPU_ADD(M6502,12096000/16)      /* clock input is the "2H" signal divided by two */
237221   MDRV_CPU_PROGRAM_MAP(main_map,0)
238   MDRV_CPU_VBLANK_INT(avalnche_interrupt,8)
222   MDRV_CPU_VBLANK_INT_HACK(avalnche_interrupt,8)
239223
240224   /* video hardware */
241225   MDRV_VIDEO_UPDATE(avalnche)
src/mame/drivers/namcos11.c
r1877r1878
264264
265265***************************************************************************/
266266
267#include <stdarg.h>
268267#include "driver.h"
268#include "deprecat.h"
269269#include "cpu/mips/psx.h"
270270#include "includes/psx.h"
271271#include "machine/at28c16.h"
r1877r1878
765765static const struct
766766{
767767   const char *s_name;
768   read32_handler keycus_r;
768   read32_machine_func keycus_r;
769769   int n_daughterboard;
770770} namcos11_config_table[] =
771771{
r1877r1878
877877   /* basic machine hardware */
878878   MDRV_CPU_ADD( PSXCPU, XTAL_67_7376MHz )
879879   MDRV_CPU_PROGRAM_MAP( namcos11_map, 0 )
880   MDRV_CPU_VBLANK_INT( namcos11_vblank, 1 )
880   MDRV_CPU_VBLANK_INT("main", namcos11_vblank)
881881
882882   MDRV_MACHINE_RESET( namcos11 )
883883   MDRV_NVRAM_HANDLER( at28c16_0 )
src/mame/drivers/lethalj.c
r1877r1878
6464
6565static CUSTOM_INPUT( ticket_status )
6666{
67   return ticket_dispenser_0_r(0) >> 7;
67   return ticket_dispenser_0_r(machine, 0) >> 7;
6868}
6969
7070
r1877r1878
8585static WRITE16_HANDLER( ripribit_control_w )
8686{
8787   coin_counter_w(0, data & 1);
88   ticket_dispenser_0_w(0, ((data >> 1) & 1) << 7);
88   ticket_dispenser_0_w(machine, 0, ((data >> 1) & 1) << 7);
8989   output_set_lamp_value(0, (data >> 2) & 1);
9090}
9191
9292
9393static WRITE16_HANDLER( cfarm_control_w )
9494{
95   ticket_dispenser_0_w(0, ((data >> 0) & 1) << 7);
95   ticket_dispenser_0_w(machine, 0, ((data >> 0) & 1) << 7);
9696   output_set_lamp_value(0, (data >> 2) & 1);
9797   output_set_lamp_value(1, (data >> 3) & 1);
9898   output_set_lamp_value(2, (data >> 4) & 1);
r1877r1878
102102
103103static WRITE16_HANDLER( cclownz_control_w )
104104{
105   ticket_dispenser_0_w(0, ((data >> 0) & 1) << 7);
105   ticket_dispenser_0_w(machine, 0, ((data >> 0) & 1) << 7);
106106   output_set_lamp_value(0, (data >> 2) & 1);
107107   output_set_lamp_value(1, (data >> 4) & 1);
108108   output_set_lamp_value(2, (data >> 5) & 1);
src/mame/drivers/dcon.c
r1877r1878
277277   /* basic machine hardware */
278278   MDRV_CPU_ADD(M68000, 10000000)
279279   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
280   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
280   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
281281
282282   SEIBU_SOUND_SYSTEM_CPU(4000000) /* Perhaps 14318180/4? */
283283
r1877r1878
306306   /* basic machine hardware */
307307   MDRV_CPU_ADD(M68000, 10000000)
308308   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
309   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
309   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
310310
311311   SEIBU2_SOUND_SYSTEM_CPU(14318180/4)
312312
src/mame/drivers/kickgoal.c
r1877r1878
5050   Ditto for samples 65, 66, 67 and 68.
5151*/
5252
53#ifdef UNUSED_DEFINITION
5354static const UINT8 kickgoal_cmd_snd[128] =
5455{
5556/*00*/   0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
r1877r1878
6162/*30*/   0x00, 0x00, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
6263/*38*/   0x29, 0x2a, 0x2b, 0x00, 0x6b, 0x00, 0x00, 0x00
6364};
65#endif
6466
6567/* Sound numbers in the sample ROM
666801 Melody A     Bank 0
r1877r1878
224226      case 0xfd:   OKIM6295_set_bank_base(0, (2 * 0x40000)); break;
225227      case 0xfe:   OKIM6295_set_bank_base(0, (1 * 0x40000)); break;
226228      case 0xff:   OKIM6295_set_bank_base(0, (3 * 0x40000)); break;
227      case 0x78:   OKIM6295_data_0_w(0,data);
229      case 0x78:   OKIM6295_data_0_w(machine,0,data);
228230               snd_sam[0]=00; snd_sam[1]=00; snd_sam[2]=00; snd_sam[3]=00;
229231               break;
230232      default:   if (snd_new) /* Play new sample */
r1877r1878
232234                  if ((data & 0x80) && (snd_sam[3] != snd_new))
233235                  {
234236                     logerror("About to play sample %02x at vol %02x\n",snd_new,data);
235                     if ((OKIM6295_status_0_r(0) & 0x08) != 0x08)
237                     if ((OKIM6295_status_0_r(machine,0) & 0x08) != 0x08)
236238                     {
237239                     logerror("Playing sample %02x at vol %02x\n",snd_new,data);
238                        OKIM6295_data_0_w(0,snd_new);
239                        OKIM6295_data_0_w(0,data);
240                        OKIM6295_data_0_w(machine,0,snd_new);
241                        OKIM6295_data_0_w(machine,0,data);
240242                     }
241243                     snd_new = 00;
242244                  }
243245                  if ((data & 0x40) && (snd_sam[2] != snd_new))
244246                  {
245247                     logerror("About to play sample %02x at vol %02x\n",snd_new,data);
246                     if ((OKIM6295_status_0_r(0) & 0x04) != 0x04)
248                     if ((OKIM6295_status_0_r(machine,0) & 0x04) != 0x04)
247249                     {
248250                     logerror("Playing sample %02x at vol %02x\n",snd_new,data);
249                        OKIM6295_data_0_w(0,snd_new);
250                        OKIM6295_data_0_w(0,data);
251                        OKIM6295_data_0_w(machine,0,snd_new);
252                        OKIM6295_data_0_w(machine,0,data);
251253                     }
252254                     snd_new = 00;
253255                  }
254256                  if ((data & 0x20) && (snd_sam[1] != snd_new))
255257                  {
256258                     logerror("About to play sample %02x at vol %02x\n",snd_new,data);
257                     if ((OKIM6295_status_0_r(0) & 0x02) != 0x02)
259                     if ((OKIM6295_status_0_r(machine,0) & 0x02) != 0x02)
258260                     {
259261                     logerror("Playing sample %02x at vol %02x\n",snd_new,data);
260                        OKIM6295_data_0_w(0,snd_new);
261                        OKIM6295_data_0_w(0,data);
262                        OKIM6295_data_0_w(machine,0,snd_new);
263                        OKIM6295_data_0_w(machine,0,data);
262264                     }
263265                     snd_new = 00;
264266                  }
265267                  if ((data & 0x10) && (snd_sam[0] != snd_new))
266268                  {
267269                     logerror("About to play sample %02x at vol %02x\n",snd_new,data);
268                     if ((OKIM6295_status_0_r(0) & 0x01) != 0x01)
270                     if ((OKIM6295_status_0_r(machine,0) & 0x01) != 0x01)
269271                     {
270272                     logerror("Playing sample %02x at vol %02x\n",snd_new,data);
271                        OKIM6295_data_0_w(0,snd_new);
272                        OKIM6295_data_0_w(0,data);
273                        OKIM6295_data_0_w(machine,0,snd_new);
274                        OKIM6295_data_0_w(machine,0,data);
273275                     }
274276                     snd_new = 00;
275277                  }
r1877r1878
284286               else /* Turn a channel off */
285287               {
286288                  logerror("Turning channel %02x off\n",data);
287                  OKIM6295_data_0_w(0,data);
289                  OKIM6295_data_0_w(machine,0,data);
288290                  if (data & 0x40) snd_sam[3] = 00;
289291                  if (data & 0x20) snd_sam[2] = 00;
290292                  if (data & 0x10) snd_sam[1] = 00;
r1877r1878
303305static UINT16 m6295_key_delay;
304306static INTERRUPT_GEN( kickgoal_interrupt )
305307{
306   if ((OKIM6295_status_0_r(0) & 0x08) == 0)
308   if ((OKIM6295_status_0_r(machine,0) & 0x08) == 0)
307309   {
308310      switch(kickgoal_melody_loop)
309311      {
r1877r1878
332334      if (kickgoal_melody_loop)
333335      {
334336//          logerror("Changing to sample %02x\n",kickgoal_melody_loop);
335         OKIM6295_data_0_w(0,((0x80 | kickgoal_melody_loop) & 0xff));
336         OKIM6295_data_0_w(0,0x81);
337         OKIM6295_data_0_w(machine,0,((0x80 | kickgoal_melody_loop) & 0xff));
338         OKIM6295_data_0_w(machine,0,0x81);
337339      }
338340   }
339341   if ( input_code_pressed_once(KEYCODE_PGUP) )
r1877r1878
410412   {
411413      if (m6295_key_delay >= (0x80 * oki_time_base))
412414      {
413         OKIM6295_data_0_w(0,0x78);
414         OKIM6295_data_0_w(0,(0x80 | m6295_comm));
415         OKIM6295_data_0_w(0,0x11);
415         OKIM6295_data_0_w(machine,0,0x78);
416         OKIM6295_data_0_w(machine,0,(0x80 | m6295_comm));
417         OKIM6295_data_0_w(machine,0,0x11);
416418
417419         popmessage("Playing sound %02x on Bank %02x",m6295_comm,m6295_bank);
418420
r1877r1878
665667   /* basic machine hardware */
666668   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
667669   MDRV_CPU_PROGRAM_MAP(kickgoal_program_map, 0)
668   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
670   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
669671   MDRV_CPU_PERIODIC_INT(kickgoal_interrupt, 240)
670672
671673   MDRV_CPU_ADD(PIC16C57, 12000000/4)   /* 3MHz ? */
r1877r1878
701703   /* basic machine hardware */
702704   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
703705   MDRV_CPU_PROGRAM_MAP(kickgoal_program_map, 0)
704   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
706   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
705707
706708   MDRV_CPU_ADD(PIC16C57, 12000000/4)   /* 3MHz ? */
707709   MDRV_CPU_FLAGS(CPU_DISABLE) /* Disables since the internal rom isn't dumped */
r1877r1878
726728
727729   /* sound hardware */
728730   MDRV_SPEAKER_STANDARD_MONO("mono")
729   MDRV_SOUND_ADD(OKIM6295, 12000000/8)
730   MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low)
731   MDRV_SOUND_ADD(OKIM6295, XTAL_12MHz/12) /* verified on pcb */
732   MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) /* verified on pcb */
731733   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
732734MACHINE_DRIVER_END
733735
src/mame/drivers/itech8.c
r1877r1878
454454
455455#include "driver.h"
456456#include "deprecat.h"
457#include "memconv.h"
457458#include "cpu/m6809/m6809.h"
458459#include "machine/6821pia.h"
459460#include "machine/6522via.h"
r1877r1878
692693      memory_set_bankptr(1, &memory_region(REGION_CPU1)[0x4000 + 0xc000 * ((data >> 5) & 1)]);
693694
694695   /* the rest is handled by the video hardware */
695   itech8_blitter_w(offset, data);
696   itech8_blitter_w(machine, offset, data);
696697}
697698
698699
r1877r1878
751752   /* bit 5 controls the coin counter */
752753   /* bit 6 controls the diagnostic sound LED */
753754   pia_portb_data = data;
754   ticket_dispenser_w(0, (data & 0x10) << 3);
755   ticket_dispenser_w(machine, 0, (data & 0x10) << 3);
755756   coin_counter_w(0, (data & 0x20) >> 5);
756757}
757758
r1877r1878
765766   /* bit 6 controls the diagnostic sound LED */
766767   /* bit 7 controls the ticket dispenser */
767768   pia_portb_data = data;
768   ticket_dispenser_w(0, data & 0x80);
769   ticket_dispenser_w(machine, 0, data & 0x80);
769770   coin_counter_w(0, (data & 0x20) >> 5);
770771}
771772
r1877r1878
833834
834835static READ16_HANDLER( blitter16_r )
835836{
836   return (itech8_blitter_r(offset * 2 + 0) << 8) + itech8_blitter_r(offset * 2 + 1);
837   return read16be_with_read8_handler(itech8_blitter_r, machine, offset, mem_mask);
837838}
838839
839840
r1877r1878
844845   /* bit doesn't matter in XY addressing mode */
845846   if ((offset & 0x700) == 0x100)
846847   {
847      int result = itech8_tms34061_r(offset * 2);
848      int result = itech8_tms34061_r(machine, offset * 2);
848849      return (result << 8) | result;
849850   }
850851   else
851      return (itech8_tms34061_r(offset * 2 + 0) << 8) + itech8_tms34061_r(offset * 2 + 1);
852      return (itech8_tms34061_r(machine, offset * 2 + 0) << 8) + itech8_tms34061_r(machine, offset * 2 + 1);
852853}
853854
854855
855856static WRITE16_HANDLER( sound_data16_w )
856857{
857858   if (ACCESSING_MSB)
858      sound_data_w(0, data >> 8);
859      sound_data_w(machine, 0, data >> 8);
859860}
860861
861862
r1877r1878
869870static WRITE16_HANDLER( display_page16_w )
870871{
871872   if (ACCESSING_MSB)
872      itech8_page_w(0, ~data >> 8);
873      itech8_page_w(machine, 0, ~data >> 8);
873874}
874875
875876
876877static WRITE16_HANDLER( tms34061_latch16_w )
877878{
878879   if (ACCESSING_MSB)
879      tms34061_latch_w(0, data >> 8);
880      tms34061_latch_w(machine, 0, data >> 8);
880881}
881882
882883
883884static WRITE16_HANDLER( blitter16_w )
884885{
885   if (ACCESSING_MSB)
886      itech8_blitter_w(offset * 2 + 0, data >> 8);
887   if (ACCESSING_LSB)
888      itech8_blitter_w(offset * 2 + 1, data);
886   write16be_with_write8_handler(itech8_blitter_w, machine, offset, data, mem_mask);
889887}
890888
891889
892890static WRITE16_HANDLER( palette16_w )
893891{
894892   if (ACCESSING_MSB)
895      itech8_palette_w(offset / 8, data >> 8);
893      itech8_palette_w(machine, offset / 8, data >> 8);
896894}
897895
898896
899897static WRITE16_HANDLER( tms34061_16_w )
900898{
901   if (ACCESSING_MSB)
902      itech8_tms34061_w(offset * 2 + 0, data >> 8);
903   else if (ACCESSING_LSB)
904      itech8_tms34061_w(offset * 2 + 1, data);
899   write16be_with_write8_handler(itech8_tms34061_w, machine, offset, data, mem_mask);
905900}
906901
907902
r1877r1878
17641759   /* basic machine hardware */
17651760   MDRV_CPU_ADD_TAG("main", M6809, CLOCK_8MHz/4)
17661761   MDRV_CPU_PROGRAM_MAP(tmslo_map,0)
1767   MDRV_CPU_VBLANK_INT(generate_nmi,1)
1762   MDRV_CPU_VBLANK_INT("main", generate_nmi)
17681763
17691764   MDRV_MACHINE_START(itech8)
17701765   MDRV_MACHINE_RESET(itech8)
src/mame/drivers/galaxian.c
r1877r1878
390390/* Send sound data to the sound cpu and cause an nmi */
391391static WRITE8_HANDLER( checkman_sound_command_w )
392392{
393   soundlatch_w (0,data);
394   cpunum_set_input_line (Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
393   soundlatch_w (machine,0,data);
394   cpunum_set_input_line (machine, 1, INPUT_LINE_NMI, PULSE_LINE);
395395}
396396
397397static READ8_HANDLER( drivfrcg_port0_r )
r1877r1878
891891
892892static WRITE8_HANDLER( zigzag_8910_data_trigger_w )
893893{
894   AY8910_write_port_0_w(0,latch);
894   AY8910_write_port_0_w(machine,0,latch);
895895}
896896
897897static WRITE8_HANDLER( zigzag_8910_control_trigger_w )
898898{
899   AY8910_control_port_0_w(0,latch);
899   AY8910_control_port_0_w(machine,0,latch);
900900}
901901
902902static ADDRESS_MAP_START( zigzag_readmem, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
43214321   MDRV_IMPORT_FROM(galaxian)
43224322   MDRV_CPU_MODIFY("main")
43234323   MDRV_CPU_PROGRAM_MAP(gmgalax_readmem,galaxian_writemem)
4324   MDRV_CPU_VBLANK_INT(gmgalax_vh_interrupt,1)
4324   MDRV_CPU_VBLANK_INT("main", gmgalax_vh_interrupt)
43254325
43264326   /* video hardware */
43274327   MDRV_GFXDECODE(gmgalax)
r1877r1878
45434543   /* audio CPU */   /* 1.62 MHz */
45444544   MDRV_CPU_PROGRAM_MAP(checkman_sound_readmem,checkman_sound_writemem)
45454545   MDRV_CPU_IO_MAP(checkman_sound_readport,checkman_sound_writeport)
4546   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   /* NMIs are triggered by the main CPU */
4546   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   /* NMIs are triggered by the main CPU */
45474547
45484548   /* video hardware */
45494549   MDRV_PALETTE_LENGTH(32+2+64)   /* 32 for the characters, 2 for the bullets, 64 for the stars */
r1877r1878
45704570   MDRV_CPU_ADD(Z80, 1620000)
45714571   /* audio CPU */
45724572   MDRV_CPU_PROGRAM_MAP(checkmaj_sound_readmem,checkmaj_sound_writemem)
4573   MDRV_CPU_VBLANK_INT(irq0_line_hold,32)   /* NMIs are triggered by the main CPU */
4573   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,32)   /* NMIs are triggered by the main CPU */
45744574
45754575
45764576   /* video hardware */
r1877r1878
45944594   /* audio CPU */   /* 1.62 MHz */
45954595   MDRV_CPU_PROGRAM_MAP(checkman_sound_readmem,checkman_sound_writemem)
45964596   MDRV_CPU_IO_MAP(checkman_sound_readport,checkman_sound_writeport)
4597   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   /* NMIs are triggered by the main CPU */
4597   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   /* NMIs are triggered by the main CPU */
45984598
45994599   /* video hardware */
46004600   MDRV_PALETTE_LENGTH(32+2+64)   /* 32 for the characters, 2 for the bullets, 64 for the stars */
r1877r1878
47174717   MDRV_CPU_MODIFY("main")
47184718   MDRV_CPU_PROGRAM_MAP(ozon1_readmem,ozon1_writemem)
47194719   MDRV_CPU_IO_MAP(0,ozon1_writeport)
4720   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
4720   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
47214721
47224722   MDRV_MACHINE_RESET(NULL)
47234723
r1877r1878
47354735   MDRV_CPU_ADD(S2650, 18432000/6)
47364736   MDRV_CPU_PROGRAM_MAP(drivfrcg,0)
47374737   MDRV_CPU_IO_MAP(drivfrcg_io,0)
4738   MDRV_CPU_VBLANK_INT(hunchbks_vh_interrupt,1)
4738   MDRV_CPU_VBLANK_INT("main", hunchbks_vh_interrupt)
47394739
47404740
47414741   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
47814781   MDRV_CPU_ADD(S2650, PIXEL_CLOCK/2)
47824782   MDRV_CPU_PROGRAM_MAP(hunchbkg,0)
47834783   MDRV_CPU_IO_MAP(hunchbkg_io,0)
4784   MDRV_CPU_VBLANK_INT(hunchbks_vh_interrupt,1)
4784   MDRV_CPU_VBLANK_INT("main", hunchbks_vh_interrupt)
47854785
47864786   MDRV_GFXDECODE(galaxian)
47874787   MDRV_PALETTE_LENGTH(32+2+64)      /* 32 for the characters, 2 for the bullets, 64 for the stars */
r1877r1878
48074807   MDRV_IMPORT_FROM(galaxian_base)
48084808   MDRV_CPU_MODIFY("main")
48094809   MDRV_CPU_PROGRAM_MAP(harem_cpu1,0)
4810   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
4810   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
48114811
48124812   MDRV_CPU_ADD(Z80, 1620000)
48134813   /* audio CPU */
r1877r1878
48444844   MDRV_CPU_ADD(S2650, PIXEL_CLOCK/2)
48454845   MDRV_CPU_PROGRAM_MAP(racknrol,0)
48464846   MDRV_CPU_IO_MAP(racknrol_io,0)
4847   MDRV_CPU_VBLANK_INT(hunchbks_vh_interrupt,1)
4847   MDRV_CPU_VBLANK_INT("main", hunchbks_vh_interrupt)
48484848
48494849   MDRV_GFXDECODE(galaxian)
48504850   MDRV_PALETTE_LENGTH(32)
r1877r1878
49024902   MDRV_CPU_ADD(S2650, PIXEL_CLOCK/2)
49034903   MDRV_CPU_PROGRAM_MAP(racknrol,0)
49044904   MDRV_CPU_IO_MAP(hexpoola_io,0)
4905   MDRV_CPU_VBLANK_INT(hunchbks_vh_interrupt,1)
4905   MDRV_CPU_VBLANK_INT("main", hunchbks_vh_interrupt)
49064906
49074907   MDRV_GFXDECODE(galaxian)
49084908   MDRV_PALETTE_LENGTH(32)
src/mame/drivers/othldrby.c
r1877r1878
243243   /* basic machine hardware */
244244   MDRV_CPU_ADD(M68000, 16000000)
245245   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
246   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
246   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
247247
248248   /* video hardware */
249249   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/bbusters.c
r1877r1878
268268
269269static WRITE16_HANDLER( sound_cpu_w )
270270{
271   soundlatch_w(0,data&0xff);
272   cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
271   soundlatch_w(machine,0,data&0xff);
272   cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
273273}
274274
275275static READ16_HANDLER( mechatt_gun_r )
r1877r1878
681681
682682static VIDEO_EOF( bbuster )
683683{
684   buffer_spriteram16_w(0,0,0);
685   buffer_spriteram16_2_w(0,0,0);
684   buffer_spriteram16_w(machine,0,0,0);
685   buffer_spriteram16_2_w(machine,0,0,0);
686686}
687687
688688static VIDEO_EOF( mechatt )
689689{
690   buffer_spriteram16_w(0,0,0);
690   buffer_spriteram16_w(machine,0,0,0);
691691}
692692
693693static MACHINE_DRIVER_START( bbusters )
r1877r1878
695695   /* basic machine hardware */
696696   MDRV_CPU_ADD(M68000, 12000000)
697697   MDRV_CPU_PROGRAM_MAP(bbuster_readmem,bbuster_writemem)
698   MDRV_CPU_VBLANK_INT(bbuster,4)
698   MDRV_CPU_VBLANK_INT_HACK(bbuster,4)
699699
700700   MDRV_CPU_ADD(Z80,4000000) /* Accurate */
701701   /* audio CPU */
r1877r1878
739739   /* basic machine hardware */
740740   MDRV_CPU_ADD(M68000, 12000000)
741741   MDRV_CPU_PROGRAM_MAP(mechatt_readmem,mechatt_writemem)
742   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
742   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
743743
744744   MDRV_CPU_ADD(Z80,4000000) /* Accurate */
745745   /* audio CPU */
src/mame/drivers/gstriker.c
r1877r1878
206206   if (ACCESSING_LSB)
207207   {
208208      pending_command = 1;
209      soundlatch_w(offset,data & 0xff);
210      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
209      soundlatch_w(machine,offset,data & 0xff);
210      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
211211   }
212212}
213213
r1877r1878
441441static MACHINE_DRIVER_START( gstriker )
442442   MDRV_CPU_ADD(M68000, 10000000)
443443   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
444   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
444   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
445445
446446   MDRV_CPU_ADD(Z80,8000000/2)
447447   /* audio CPU */   /* 4 MHz ??? */
src/mame/drivers/snk.c
r1877r1878
316316   return value;
317317}
318318
319static int snk_input_port_r( int which ){
319static int snk_input_port_r( running_machine *machine, int which ){
320320   switch( snk_io[which] ){
321321      case SNK_INP0:
322322      {
323         int value = input_port_0_r( 0 );
323         int value = input_port_0_r( machine,0 );
324324         if( (snk_sound_register & 0x04) == 0 ) value &= ~snk_sound_busy_bit;
325325         return value;
326326      }
r1877r1878
328328      case SNK_ROT_PLAYER1: return snk_rot( 0 );
329329      case SNK_ROT_PLAYER2: return snk_rot( 1 );
330330
331      case SNK_INP1: return input_port_1_r(0);
332      case SNK_INP2: return input_port_2_r(0);
333      case SNK_INP3: return input_port_3_r(0);
334      case SNK_INP4: return input_port_4_r(0);
335      case SNK_INP5: return input_port_5_r(0);
336      case SNK_INP6: return input_port_6_r(0);
337      case SNK_INP7: return input_port_7_r(0);
338      case SNK_INP8: return input_port_8_r(0);
339      case SNK_INP9: return input_port_9_r(0);
340      case SNK_INP10: return input_port_10_r(0);
341      case SNK_INP11: return input_port_11_r(0);
331      case SNK_INP1: return input_port_1_r(machine,0);
332      case SNK_INP2: return input_port_2_r(machine,0);
333      case SNK_INP3: return input_port_3_r(machine,0);
334      case SNK_INP4: return input_port_4_r(machine,0);
335      case SNK_INP5: return input_port_5_r(machine,0);
336      case SNK_INP6: return input_port_6_r(machine,0);
337      case SNK_INP7: return input_port_7_r(machine,0);
338      case SNK_INP8: return input_port_8_r(machine,0);
339      case SNK_INP9: return input_port_9_r(machine,0);
340      case SNK_INP10: return input_port_10_r(machine,0);
341      case SNK_INP11: return input_port_11_r(machine,0);
342342
343343      default:
344344      logerror("read from unmapped input port:%d\n", which );
r1877r1878
384384
385385static WRITE8_HANDLER( snk_soundlatch_w ){
386386   snk_sound_register |= 0x08 | 0x04;
387   soundlatch_w( offset, data );
387   soundlatch_w( machine, offset, data );
388388}
389389
390390static READ8_HANDLER( snk_soundlatch_clear_r ){ /* TNK3 */
391   soundlatch_w( 0, 0 );
391   soundlatch_w( machine, 0, 0 );
392392   snk_sound_register = 0;
393393   return 0x00;
394394}
r1877r1878
455455
456456static READ8_HANDLER( cpuA_io_r ){
457457   switch( offset ){
458      case 0x000: return snk_input_port_r( 0 );   // coin input, player start
459      case 0x100: return snk_input_port_r( 1 );   // joy1
460      case 0x180: return snk_input_port_r( 2 );   // joy2
461      case 0x200: return snk_input_port_r( 3 );   // joy3
462      case 0x280: return snk_input_port_r( 4 );   // joy4
463      case 0x300: return snk_input_port_r( 5 );   // aim1
464      case 0x380: return snk_input_port_r( 6 );   // aim2
465      case 0x400: return snk_input_port_r( 7 );   // aim3
466      case 0x480: return snk_input_port_r( 8 );   // aim4
467      case 0x500: return snk_input_port_r( 9 );   // unused by tdfever
468      case 0x580: return snk_input_port_r( 10 );   // dsw
469      case 0x600: return snk_input_port_r( 11 );   // dsw
470      case 0x080: return snk_input_port_r( 12 );   // player start (types C and D in 'fsoccer')
458      case 0x000: return snk_input_port_r( machine,0 );   // coin input, player start
459      case 0x100: return snk_input_port_r( machine,1 );   // joy1
460      case 0x180: return snk_input_port_r( machine,2 );   // joy2
461      case 0x200: return snk_input_port_r( machine,3 );   // joy3
462      case 0x280: return snk_input_port_r( machine,4 );   // joy4
463      case 0x300: return snk_input_port_r( machine,5 );   // aim1
464      case 0x380: return snk_input_port_r( machine,6 );   // aim2
465      case 0x400: return snk_input_port_r( machine,7 );   // aim3
466      case 0x480: return snk_input_port_r( machine,8 );   // aim4
467      case 0x500: return snk_input_port_r( machine,9 );   // unused by tdfever
468      case 0x580: return snk_input_port_r( machine,10 );   // dsw
469      case 0x600: return snk_input_port_r( machine,11 );   // dsw
470      case 0x080: return snk_input_port_r( machine,12 );   // player start (types C and D in 'fsoccer')
471471
472      case 0x700: return(snk_cpuB_nmi_trigger_r(0));
472      case 0x700: return(snk_cpuB_nmi_trigger_r(machine,0));
473473
474474      /* "Hard Flags" */
475475      case 0xe00:
r1877r1878
490490
491491      case 0x400: /* most games */
492492      case 0x500: /* tdfever */
493      snk_soundlatch_w( 0, data );
493      snk_soundlatch_w( machine, 0, data );
494494      break;
495495
496496      case 0x700:
497      snk_cpuA_nmi_ack_w(0, 0);
497      snk_cpuA_nmi_ack_w(machine, 0, 0);
498498      break;
499499
500500      default:
r1877r1878
506506static READ8_HANDLER( cpuB_io_r ){
507507   switch( offset ){
508508      case 0x000:
509      case 0x700: return(snk_cpuA_nmi_trigger_r(0));
509      case 0x700: return(snk_cpuA_nmi_trigger_r(machine, 0));
510510
511511      /* "Hard Flags" they are needed here, otherwise ikarijp/b doesn't work right */
512512      case 0xe00:
r1877r1878
524524{
525525   io_ram[offset] = data;
526526
527   if (offset==0 || offset==0x700) snk_cpuB_nmi_ack_w(0, 0);
527   if (offset==0 || offset==0x700) snk_cpuB_nmi_ack_w(machine, 0, 0);
528528}
529529
530530/**********************  Tnk3, Athena, Fighting Golf ********************/
r1877r1878
817817   /* basic machine hardware */
818818   MDRV_CPU_ADD(Z80, XTAL_13_4MHz/4) /* verified on pcb */
819819   MDRV_CPU_PROGRAM_MAP(tnk3_cpuA_map,0)
820   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
820   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
821821
822822   MDRV_CPU_ADD(Z80, XTAL_13_4MHz/4) /* verified on pcb */
823823   MDRV_CPU_PROGRAM_MAP(tnk3_cpuB_map,0)
824   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
824   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
825825
826826   MDRV_CPU_ADD(Z80, XTAL_8MHz/2) /* verified on pcb */
827827   /* audio CPU */
828828   MDRV_CPU_PROGRAM_MAP(YM3526_sound_map,0)
829   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)
829   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)
830830
831831   MDRV_INTERLEAVE(100)
832832
r1877r1878
861861   /* basic machine hardware */
862862   MDRV_CPU_ADD(Z80, 4000000)
863863   MDRV_CPU_PROGRAM_MAP(tnk3_cpuA_map,0)
864   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
864   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
865865
866866   MDRV_CPU_ADD(Z80, 4000000)
867867   MDRV_CPU_PROGRAM_MAP(tnk3_cpuB_map,0)
868   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
868   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
869869
870870   MDRV_CPU_ADD(Z80, 4000000)
871871   /* audio CPU */
872872   MDRV_CPU_PROGRAM_MAP(YM3526_YM3526_sound_map,0)
873   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
873   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
874874
875875   MDRV_INTERLEAVE(300)
876876
r1877r1878
909909   /* basic machine hardware */
910910   MDRV_CPU_ADD(Z80, XTAL_13_4MHz/4) /* verified on pcb */
911911   MDRV_CPU_PROGRAM_MAP(cpuA_map,0)
912   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
912   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
913913
914914   MDRV_CPU_ADD(Z80, XTAL_13_4MHz/4) /* verified on pcb */
915915   MDRV_CPU_PROGRAM_MAP(cpuB_map,0)
916   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
916   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
917917
918918   MDRV_CPU_ADD(Z80, XTAL_8MHz/2) /* verified on pcb */
919919   /* audio CPU */
920920   MDRV_CPU_PROGRAM_MAP(YM3526_YM3526_sound_map,0)
921   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
921   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
922922
923923   MDRV_INTERLEAVE(100)
924924
r1877r1878
957957   /* basic machine hardware */
958958   MDRV_CPU_ADD(Z80, XTAL_13_4MHz/4) /* verified on pcb */
959959   MDRV_CPU_PROGRAM_MAP(cpuA_map,0)
960   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
960   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
961961
962962   MDRV_CPU_ADD(Z80, XTAL_13_4MHz/4) /* verified on pcb */
963963   MDRV_CPU_PROGRAM_MAP(cpuB_map,0)
964   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
964   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
965965
966966   MDRV_CPU_ADD(Z80, XTAL_8MHz/2) /* verified on pcb */
967967   /* audio CPU */
968968   MDRV_CPU_PROGRAM_MAP(YM3526_Y8950_sound_map,0)
969   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
969   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
970970
971971   MDRV_INTERLEAVE(100)
972972
r1877r1878
10051005   /* basic machine hardware */
10061006   MDRV_CPU_ADD(Z80, XTAL_8MHz/2) /* verified on pcb */
10071007   MDRV_CPU_PROGRAM_MAP(cpuA_map,0)
1008   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1008   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
10091009
10101010   MDRV_CPU_ADD(Z80, XTAL_8MHz/2) /* verified on pcb */
10111011   MDRV_CPU_PROGRAM_MAP(cpuB_map,0)
1012   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1012   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
10131013
10141014   MDRV_CPU_ADD(Z80, XTAL_8MHz/2) /* verified on pcb */
10151015   /* audio CPU */
10161016   MDRV_CPU_PROGRAM_MAP(YM3526_Y8950_sound_map,0)
1017   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1017   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
10181018
10191019   MDRV_INTERLEAVE(100)
10201020
r1877r1878
10511051   /* basic machine hardware */
10521052   MDRV_CPU_ADD(Z80, 4000000)
10531053   MDRV_CPU_PROGRAM_MAP(cpuA_map,0)
1054   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1054   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
10551055
10561056   // 5MHz gives CPUB higher priority or ROM test will fail if the first NMI is triggered too early by CPUA
10571057   MDRV_CPU_ADD(Z80, 5000000)
10581058   MDRV_CPU_PROGRAM_MAP(cpuB_map,0)
1059   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1059   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
10601060
10611061   MDRV_CPU_ADD(Z80, 4000000)
10621062   /* audio CPU */
10631063   MDRV_CPU_PROGRAM_MAP(YM3526_Y8950_sound_map,0)
1064   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1064   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
10651065
10661066   MDRV_INTERLEAVE(100)
10671067
r1877r1878
10981098   /* basic machine hardware */
10991099   MDRV_CPU_ADD(Z80, 4000000)
11001100   MDRV_CPU_PROGRAM_MAP(cpuA_map,0)
1101   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1101   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
11021102
11031103   MDRV_CPU_ADD(Z80, 4000000)
11041104   MDRV_CPU_PROGRAM_MAP(cpuB_map,0)
1105   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1105   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
11061106
11071107   MDRV_CPU_ADD(Z80, 4000000)
11081108   /* audio CPU */
11091109   MDRV_CPU_PROGRAM_MAP(YM3526_Y8950_sound_map,0)
1110   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
1110   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
11111111
11121112   MDRV_INTERLEAVE(100)
11131113
r1877r1878
11441144   /* basic machine hardware */
11451145   MDRV_CPU_ADD(Z80, 4000000)
11461146   MDRV_CPU_PROGRAM_MAP(cpuA_map,0)
1147   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1147   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
11481148
11491149   MDRV_CPU_ADD(Z80, 4000000)
11501150   MDRV_CPU_PROGRAM_MAP(cpuB_map,0)
1151   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1151   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
11521152
11531153   MDRV_CPU_ADD(Z80, 4000000)
11541154   /* audio CPU */
11551155   MDRV_CPU_PROGRAM_MAP(YM3812_Y8950_sound_map,0)
1156   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1156   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
11571157
11581158   MDRV_INTERLEAVE(100)
11591159
r1877r1878
11901190   /* basic machine hardware */
11911191   MDRV_CPU_ADD(Z80, 4000000)
11921192   MDRV_CPU_PROGRAM_MAP(cpuA_map,0)
1193   MDRV_CPU_VBLANK_INT(snk_irq_AB,1)
1193   MDRV_CPU_VBLANK_INT("main", snk_irq_AB)
11941194
11951195   MDRV_CPU_ADD(Z80, 4000000)
11961196   MDRV_CPU_PROGRAM_MAP(cpuB_map,0)
1197//  MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1197//  MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
11981198
11991199   MDRV_CPU_ADD(Z80, 4000000)
12001200   /* audio CPU */
12011201   MDRV_CPU_PROGRAM_MAP(YM3526_Y8950_sound_map,0)
1202   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1202   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
12031203
12041204   MDRV_INTERLEAVE(300)
12051205
r1877r1878
12381238   /* basic machine hardware */
12391239   MDRV_CPU_ADD(Z80, 4000000)
12401240   MDRV_CPU_PROGRAM_MAP(cpuA_map,0)
1241   MDRV_CPU_VBLANK_INT(snk_irq_AB,1)
1241   MDRV_CPU_VBLANK_INT("main", snk_irq_AB)
12421242
12431243   MDRV_CPU_ADD(Z80, 4000000)
12441244   MDRV_CPU_PROGRAM_MAP(cpuB_map,0)
1245//  MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1245//  MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
12461246
12471247   MDRV_CPU_ADD(Z80, 4000000)
12481248   /* audio CPU */
12491249   MDRV_CPU_PROGRAM_MAP(YM3526_Y8950_sound_map,0)
1250   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1250   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
12511251
12521252   MDRV_INTERLEAVE(300)
12531253
r1877r1878
12861286   /* basic machine hardware */
12871287   MDRV_CPU_ADD(Z80, XTAL_8MHz/2) /* verified on pcb */
12881288   MDRV_CPU_PROGRAM_MAP(cpuA_map,0)
1289   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1289   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
12901290
12911291   MDRV_CPU_ADD(Z80, XTAL_8MHz/2) /* verified on pcb */
12921292   MDRV_CPU_PROGRAM_MAP(cpuB_map,0)
1293   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1293   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
12941294
12951295   MDRV_CPU_ADD(Z80, XTAL_8MHz/2) /* verified on pcb */
12961296   /* audio CPU */
12971297   MDRV_CPU_PROGRAM_MAP(Y8950_sound_map, 0)
1298   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
1298   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
12991299
13001300   MDRV_INTERLEAVE(100)
13011301
src/mame/drivers/hyprduel.c
r1877r1878
299299   return ROM[offs] ^ 0xff;
300300}
301301
302INLINE void blt_write(const int tmap, const offs_t offs, const UINT16 data, const UINT16 mask)
302INLINE void blt_write(running_machine *machine, const int tmap, const offs_t offs, const UINT16 data, const UINT16 mask)
303303{
304304   switch( tmap )
305305   {
306      case 1:   hyprduel_vram_0_w(offs,data,mask);   break;
307      case 2:   hyprduel_vram_1_w(offs,data,mask);   break;
308      case 3:   hyprduel_vram_2_w(offs,data,mask);   break;
306      case 1:   hyprduel_vram_0_w(machine,offs,data,mask);   break;
307      case 2:   hyprduel_vram_1_w(machine,offs,data,mask);   break;
308      case 3:   hyprduel_vram_2_w(machine,offs,data,mask);   break;
309309   }
310310//  logerror("CPU #0 PC %06X : Blitter %X] %04X <- %04X & %04X\n",activecpu_get_pc(),tmap,offs,data,mask);
311311}
r1877r1878
380380                  src_offs++;
381381
382382                  dst_offs &= 0xffff;
383                  blt_write(tmap,dst_offs,b2,mask);
383                  blt_write(machine,tmap,dst_offs,b2,mask);
384384                  dst_offs = ((dst_offs+1) & (0x100-1)) | (dst_offs & (~(0x100-1)));
385385               }
386386               break;
r1877r1878
396396               while (count--)
397397               {
398398                  dst_offs &= 0xffff;
399                  blt_write(tmap,dst_offs,b2<<shift,mask);
399                  blt_write(machine,tmap,dst_offs,b2<<shift,mask);
400400                  dst_offs = ((dst_offs+1) & (0x100-1)) | (dst_offs & (~(0x100-1)));
401401                  b2++;
402402               }
r1877r1878
413413               while (count--)
414414               {
415415                  dst_offs &= 0xffff;
416                  blt_write(tmap,dst_offs,b2,mask);
416                  blt_write(machine,tmap,dst_offs,b2,mask);
417417                  dst_offs = ((dst_offs+1) & (0x100-1)) | (dst_offs & (~(0x100-1)));
418418               }
419419               break;
r1877r1878
710710   /* basic machine hardware */
711711   MDRV_CPU_ADD(M68000,20000000/2)      /* 10MHz */
712712   MDRV_CPU_PROGRAM_MAP(hyprduel_readmem,hyprduel_writemem)
713   MDRV_CPU_VBLANK_INT(hyprduel_interrupt,RASTER_LINES)
713   MDRV_CPU_VBLANK_INT_HACK(hyprduel_interrupt,RASTER_LINES)
714714
715715   MDRV_CPU_ADD(M68000,20000000/2)      /* 10MHz */
716716   MDRV_CPU_PROGRAM_MAP(hyprduel_readmem2,hyprduel_writemem2)
r1877r1878
751751   /* basic machine hardware */
752752   MDRV_CPU_ADD(M68000,20000000/2)      /* 10MHz */
753753   MDRV_CPU_PROGRAM_MAP(magerror_readmem,magerror_writemem)
754   MDRV_CPU_VBLANK_INT(hyprduel_interrupt,RASTER_LINES)
754   MDRV_CPU_VBLANK_INT_HACK(hyprduel_interrupt,RASTER_LINES)
755755
756756   MDRV_CPU_ADD(M68000,20000000/2)      /* 10MHz */
757757   MDRV_CPU_PROGRAM_MAP(magerror_readmem2,magerror_writemem2)
src/mame/drivers/arcadecl.c
r1877r1878
128128
129129static READ16_HANDLER( adpcm_r )
130130{
131   return (OKIM6295_status_0_r(offset) << 8) | 0x00ff;
131   return (OKIM6295_status_0_r(machine, offset) << 8) | 0x00ff;
132132}
133133
134134
135135static WRITE16_HANDLER( adpcm_w )
136136{
137137   if (ACCESSING_MSB)
138      OKIM6295_data_0_w(offset, (data >> 8) & 0xff);
138      OKIM6295_data_0_w(machine, offset, (data >> 8) & 0xff);
139139}
140140
141141
r1877r1878
347347   /* basic machine hardware */
348348   MDRV_CPU_ADD(M68000, MASTER_CLOCK)
349349   MDRV_CPU_PROGRAM_MAP(main_map,0)
350   MDRV_CPU_VBLANK_INT(atarigen_video_int_gen,1)
350   MDRV_CPU_VBLANK_INT("main", atarigen_video_int_gen)
351351
352352   MDRV_MACHINE_RESET(arcadecl)
353353   MDRV_NVRAM_HANDLER(atarigen)
src/mame/drivers/namconb1.c
r1877r1878
753753static MACHINE_DRIVER_START( namconb1 )
754754   MDRV_CPU_ADD(M68EC020,MASTER_CLOCK_HZ/2)
755755   MDRV_CPU_PROGRAM_MAP(namconb1_am,0)
756   MDRV_CPU_VBLANK_INT(namconb1_interrupt,1)
756   MDRV_CPU_VBLANK_INT("main", namconb1_interrupt)
757757
758758   NAMCO_C7X_MCU(MASTER_CLOCK_HZ/3)
759759
r1877r1878
777777static MACHINE_DRIVER_START( namconb2 )
778778   MDRV_CPU_ADD(M68EC020,MASTER_CLOCK_HZ/2)
779779   MDRV_CPU_PROGRAM_MAP(namconb2_am,0)
780   MDRV_CPU_VBLANK_INT(namconb2_interrupt,1)
780   MDRV_CPU_VBLANK_INT("main", namconb2_interrupt)
781781
782782   NAMCO_C7X_MCU(MASTER_CLOCK_HZ/3)
783783
r1877r1878
12531253   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(4) PORT_PLAYER(2)
12541254INPUT_PORTS_END
12551255
1256#ifdef UNUSED_DEFINITION
12561257static INPUT_PORTS_START( machbrkr )
12571258   PORT_START
12581259   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
r1877r1878
13041305   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(4)
13051306   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START4 )
13061307INPUT_PORTS_END
1308#endif
13071309
13081310static INPUT_PORTS_START( outfxies )
13091311   PORT_START
src/mame/drivers/flstory.c
r1877r1878
8989
9090static WRITE8_HANDLER( sound_command_w )
9191{
92   soundlatch_w(0,data);
92   soundlatch_w(machine,0,data);
9393   timer_call_after_resynch(NULL, data,nmi_callback);
9494}
9595
r1877r1878
163163
164164static READ8_HANDLER( victnine_port_5_r )
165165{
166   return (victnine_mcu_status_r(0) & 3) | (readinputport(5) & ~3);
166   return (victnine_mcu_status_r(machine,0) & 3) | (readinputport(5) & ~3);
167167}
168168
169169static ADDRESS_MAP_START( victnine_map, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
683683   /* basic machine hardware */
684684   MDRV_CPU_ADD(Z80,10733000/2)      /* ??? */
685685   MDRV_CPU_PROGRAM_MAP(flstory_map,0)
686   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
686   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
687687
688688   MDRV_CPU_ADD(Z80,8000000/2)
689689   /* audio CPU */      /* 4 MHz */
690690   MDRV_CPU_PROGRAM_MAP(sound_map,0)
691   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)   /* IRQ generated by ??? */
691   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)   /* IRQ generated by ??? */
692692                  /* NMI generated by the main CPU */
693693
694694   MDRV_CPU_ADD(M68705,4000000)   /* ??? */
r1877r1878
732732   /* basic machine hardware */
733733   MDRV_CPU_ADD(Z80,10733000/2)      /* ??? */
734734   MDRV_CPU_PROGRAM_MAP(onna34ro_map,0)
735   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
735   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
736736
737737   MDRV_CPU_ADD(Z80,8000000/2)
738738   /* audio CPU */      /* 4 MHz */
739739   MDRV_CPU_PROGRAM_MAP(sound_map,0)
740   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)   /* IRQ generated by ??? */
740   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)   /* IRQ generated by ??? */
741741                  /* NMI generated by the main CPU */
742742//  MDRV_CPU_ADD(M68705,4000000)  /* ??? */
743743//  MDRV_CPU_PROGRAM_MAP(m68705_readmem,m68705_writemem)
r1877r1878
780780   /* basic machine hardware */
781781   MDRV_CPU_ADD(Z80,8000000/2)      /* 4 MHz */
782782   MDRV_CPU_PROGRAM_MAP(victnine_map,0)
783   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
783   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
784784
785785   MDRV_CPU_ADD(Z80,8000000/2)
786786   /* audio CPU */      /* 4 MHz */
787787   MDRV_CPU_PROGRAM_MAP(sound_map,0)
788   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)   /* IRQ generated by ??? */
788   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)   /* IRQ generated by ??? */
789789                  /* NMI generated by the main CPU */
790790//  MDRV_CPU_ADD(M68705,4000000)  /* ??? */
791791//  MDRV_CPU_PROGRAM_MAP(m68705_readmem,m68705_writemem)
src/mame/drivers/fcrash.c
r1877r1878
6565   }
6666}
6767
68static void fcrash_render_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
68static void fcrash_render_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
6969{
7070   int pos;
7171   int base=0x50c8/2; // and 10c8/2 for the buffer?
r1877r1878
9292
9393}
9494
95static void fcrash_render_layer(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int layer,int primask)
95static void fcrash_render_layer(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int layer,int primask)
9696{
9797   switch (layer)
9898   {
r1877r1878
107107   }
108108}
109109
110static void fcrash_render_high_layer(mame_bitmap *bitmap, const rectangle *cliprect, int layer)
110static void fcrash_render_high_layer(bitmap_t *bitmap, const rectangle *cliprect, int layer)
111111{
112112   switch (layer)
113113   {
r1877r1878
324324   /* basic machine hardware */
325325   MDRV_CPU_ADD_TAG("main", M68000, 10000000)
326326   MDRV_CPU_PROGRAM_MAP(fcrash_readmem,fcrash_writemem)
327   MDRV_CPU_VBLANK_INT(cps1_interrupt,1)
327   MDRV_CPU_VBLANK_INT("main", cps1_interrupt)
328328
329329//  MDRV_CPU_ADD_TAG("sound", Z80, 4000000) /* ???? */
330330//  /* audio CPU */
src/mame/drivers/suprslam.c
r1877r1878
106106   if (ACCESSING_LSB)
107107   {
108108      pending_command = 1;
109      soundlatch_w(offset,data & 0xff);
110      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
109      soundlatch_w(machine,offset,data & 0xff);
110      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
111111   }
112112}
113113
r1877r1878
329329static MACHINE_DRIVER_START( suprslam )
330330   MDRV_CPU_ADD(M68000, 16000000)
331331   MDRV_CPU_PROGRAM_MAP(suprslam_readmem,suprslam_writemem)
332   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
332   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
333333
334334   MDRV_CPU_ADD(Z80,8000000/2)
335335   /* audio CPU */   /* 4 MHz ??? */
src/mame/drivers/f-32.c
r1877r1878
1616#include "sound/2151intf.h"
1717#include "sound/okim6295.h"
1818
19static UINT32 *vram;
19static UINT32 *mosaicf2_videoram;
2020
2121static READ32_HANDLER( oki_32bit_r )
2222{
23   return OKIM6295_status_0_r(0);
23   return OKIM6295_status_0_r(machine, 0);
2424}
2525
2626static WRITE32_HANDLER( oki_32bit_w )
2727{
28   OKIM6295_data_0_w(0, data & 0xff);
28   OKIM6295_data_0_w(machine, 0, data & 0xff);
2929}
3030
3131static READ32_HANDLER( ym2151_status_32bit_r )
3232{
33   return YM2151_status_port_0_r(0);
33   return YM2151_status_port_0_r(machine, 0);
3434}
3535
3636static WRITE32_HANDLER( ym2151_data_32bit_w )
3737{
38   YM2151_data_port_0_w(0, data & 0xff);
38   YM2151_data_port_0_w(machine, 0, data & 0xff);
3939}
4040
4141static WRITE32_HANDLER( ym2151_register_32bit_w )
4242{
43   YM2151_register_port_0_w(0,data & 0xff);
43   YM2151_register_port_0_w(machine,0,data & 0xff);
4444}
4545
46static WRITE32_HANDLER( vram_w )
47{
48   int x,y;
49
50   COMBINE_DATA(&vram[offset]);
51
52   y = offset >> 8;
53   x = offset & 0xff;
54
55   if(x < 320/2 && y < 224)
56   {
57      *BITMAP_ADDR16(tmpbitmap, y, x*2+0) = (vram[offset] >> 16) & 0x7fff;
58      *BITMAP_ADDR16(tmpbitmap, y, x*2+1) = vram[offset] & 0x7fff;
59   }
60}
61
6246static READ32_HANDLER( eeprom_r )
6347{
6448   return EEPROM_read_bit();
r1877r1878
8064}
8165
8266
67static VIDEO_UPDATE( mosaicf2 )
68{
69   offs_t offs;
70
71   for (offs = 0; offs < 0x10000; offs++)
72   {
73      int   y = offs >> 8;
74      int x = offs & 0xff;
75
76      if ((x < 0xa0) && (y < 0xe0))
77      {
78         *BITMAP_ADDR16(bitmap, y, (x * 2) + 0) = (mosaicf2_videoram[offs] >> 16) & 0x7fff;
79         *BITMAP_ADDR16(bitmap, y, (x * 2) + 1) = (mosaicf2_videoram[offs] >>  0) & 0x7fff;
80      }
81   }
82
83   return 0;
84}
85
86
87
8388static ADDRESS_MAP_START( common_map, ADDRESS_SPACE_PROGRAM, 32 )
8489   AM_RANGE(0x00000000, 0x001fffff) AM_RAM
85   AM_RANGE(0x40000000, 0x4003ffff) AM_WRITE(vram_w) AM_BASE(&vram)
90   AM_RANGE(0x40000000, 0x4003ffff) AM_RAM AM_BASE(&mosaicf2_videoram)
8691   AM_RANGE(0x80000000, 0x80ffffff) AM_ROM AM_REGION(REGION_USER2,0)
8792   AM_RANGE(0xfff00000, 0xffffffff) AM_ROM AM_REGION(REGION_USER1,0)
8893ADDRESS_MAP_END
r1877r1878
9398   if ((activecpu_get_pc() == 0x000379de) ||
9499       (activecpu_get_pc() == 0x000379cc) ) activecpu_adjust_icount(-100);
95100   //else printf("PC %08x\n", activecpu_get_pc() );
96   return input_port_1_dword_r(0, 0);
101   return input_port_1_dword_r(machine, 0, 0);
97102}
98103
99104
r1877r1878
147152   MDRV_CPU_ADD_TAG("main", E132XN, 20000000*4)   /* 4x internal multiplier */
148153   MDRV_CPU_PROGRAM_MAP(common_map,0)
149154   MDRV_CPU_IO_MAP(mosaicf2_io,0)
150   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
155   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
151156
152157   MDRV_NVRAM_HANDLER(93C46)
153158
r1877r1878
159164   MDRV_SCREEN_SIZE(512, 512)
160165   MDRV_SCREEN_VISIBLE_AREA(0, 319, 0, 223)
161166
162   MDRV_VIDEO_START(generic_bitmapped)
163   MDRV_VIDEO_UPDATE(generic_bitmapped)
167   MDRV_VIDEO_UPDATE(mosaicf2)
164168
165169   /* sound hardware */
166170   MDRV_SPEAKER_STANDARD_STEREO("left", "right")
src/mame/drivers/calomega.c
r1877r1878
473473    TODO:
474474
475475    - Parent/clone relationship.
476    - System 905 inputs.
476    - System 903/905 inputs.
477477    - System 905 sound through PIAs.
478478    - Fix lamps.
479479
r1877r1878
491491/* from video */
492492WRITE8_HANDLER( calomega_videoram_w );
493493WRITE8_HANDLER( calomega_colorram_w );
494WRITE8_HANDLER( calomega_mc6845_address_w );
495READ8_HANDLER( calomega_mc6845_register_r );
496WRITE8_HANDLER( calomega_mc6845_register_w );
497494PALETTE_INIT( calomega );
498495VIDEO_START( calomega );
499496VIDEO_UPDATE( calomega );
r1877r1878
507504   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
508505   AM_RANGE(0x0840, 0x0840) AM_WRITE(AY8910_control_port_0_w)
509506   AM_RANGE(0x0841, 0x0841) AM_WRITE(AY8910_write_port_0_w)
510   AM_RANGE(0x0880, 0x0880) AM_WRITE(calomega_mc6845_address_w)
511   AM_RANGE(0x0881, 0x0881) AM_READWRITE(calomega_mc6845_register_r, calomega_mc6845_register_w)
507   AM_RANGE(0x0880, 0x0880) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
508   AM_RANGE(0x0881, 0x0881) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
512509   AM_RANGE(0x08c4, 0x08c7) AM_READWRITE(pia_0_r, pia_0_w)
513510   AM_RANGE(0x08c8, 0x08cb) AM_READWRITE(pia_1_r, pia_1_w)
514511   AM_RANGE(0x1000, 0x13ff) AM_RAM AM_WRITE(calomega_videoram_w) AM_BASE(&videoram)
r1877r1878
520517   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
521518   AM_RANGE(0x0880, 0x0880) AM_WRITE(AY8910_control_port_0_w)
522519   AM_RANGE(0x0881, 0x0881) AM_WRITE(AY8910_write_port_0_w)
523   AM_RANGE(0x1080, 0x1080) AM_WRITE(calomega_mc6845_address_w)
524   AM_RANGE(0x1081, 0x1081) AM_READWRITE(calomega_mc6845_register_r, calomega_mc6845_register_w)
520   AM_RANGE(0x1080, 0x1080) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
521   AM_RANGE(0x1081, 0x1081) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
525522   AM_RANGE(0x10c4, 0x10c7) AM_READWRITE(pia_0_r, pia_0_w)
526523   AM_RANGE(0x10c8, 0x10cb) AM_READWRITE(pia_1_r, pia_1_w)
527524   AM_RANGE(0x2000, 0x23ff) AM_RAM AM_WRITE(calomega_videoram_w) AM_BASE(&videoram)
r1877r1878
10531050{
10541051   switch( mux_data&0xf0 )   /* bits 4-7 */
10551052   {
1056      case 0x10: return input_port_0_r(0);
1057      case 0x20: return input_port_1_r(0);
1058      case 0x40: return input_port_2_r(0);
1059      case 0x80: return input_port_3_r(0);
1053      case 0x10: return input_port_0_r(machine,0);
1054      case 0x20: return input_port_1_r(machine,0);
1055      case 0x40: return input_port_2_r(machine,0);
1056      case 0x80: return input_port_3_r(machine,0);
10601057   }
10611058   return 0xff;
10621059}
r1877r1878
11501147   // basic machine hardware
11511148   MDRV_CPU_ADD_TAG("main", M6502, MASTER_CLOCK/16)   /* confirmed */
11521149   MDRV_CPU_PROGRAM_MAP(sys903_map, 0)
1153   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
1150   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
11541151
11551152   MDRV_NVRAM_HANDLER(generic_0fill)
11561153
r1877r1878
21182115GAME( 1982, elgrande, 0,        sys903,   elgrande, elgrande, ROT0, "Tuni Electro Service / E.T. Marketing", "El Grande - 5 Card Draw (New)",                 0 )
21192116GAME( 1983, jjpoker,  0,        sys903,   jjpoker,  jjpoker,  ROT0, "Enter-Tech (ETL)",                      "Jackpot Joker Poker (set 1)",                   0 )
21202117GAME( 1983, jjpokerb, jjpoker,  sys903,   jjpoker,  jjpoker,  ROT0, "Enter-Tech (ETL)",                      "Jackpot Joker Poker (set 2)",                   0 )
2121GAME( 1988, ssipkr24, jjpoker,  sys903,   ssipkr,   jjpoker,  ROT0, "SSI",                                   "SSI Poker (v2.4)",                              0 )
2122GAME( 1988, ssipkr30, jjpoker,  sys903,   ssipkr,   jjpoker,  ROT0, "SSI",                                   "SSI Poker (v3.0)",                              0 )
2123GAME( 1990, ssipkr40, jjpoker,  sys903,   ssipkr,   jjpoker,  ROT0, "SSI",                                   "SSI Poker (v4.0)",                              0 )
2118GAME( 1988, ssipkr24, 0,        sys903,   ssipkr,   jjpoker,  ROT0, "SSI",                                   "SSI Poker (v2.4)",                              0 )
2119GAME( 1988, ssipkr30, ssipkr24, sys903,   ssipkr,   jjpoker,  ROT0, "SSI",                                   "SSI Poker (v3.0)",                              0 )
2120GAME( 1990, ssipkr40, ssipkr24, sys903,   ssipkr,   jjpoker,  ROT0, "SSI",                                   "SSI Poker (v4.0)",                              0 )
src/mame/drivers/strnskil.c
r1877r1878
337337   /* basic machine hardware */
338338   MDRV_CPU_ADD(Z80,8000000/2) /* 4.000MHz */
339339   MDRV_CPU_PROGRAM_MAP(strnskil_readmem1,strnskil_writemem1)
340   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
340   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
341341
342342   MDRV_CPU_ADD(Z80,8000000/2) /* 4.000MHz */
343343   MDRV_CPU_PROGRAM_MAP(strnskil_readmem2,strnskil_writemem2)
344   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
344   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
345345
346346   MDRV_INTERLEAVE(100)
347347
src/mame/drivers/sfkick.c
r1877r1878
8282
8383   MDRV_CPU_ADD(Z80,8000000) // ?
8484   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
85//  MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
85//  MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
8686
8787   //MDRV_CPU_ADD(Z80,8000000) // ?
8888   //MDRV_CPU_PROGRAM_MAP(readmem2,writemem2)
89//  MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
89//  MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
9090
9191   MDRV_SCREEN_ADD("main", RASTER)
9292   MDRV_SCREEN_REFRESH_RATE(60)
src/mame/drivers/atetris.c
r1877r1878
245245
246246static INPUT_PORTS_START( atetris )
247247   // These ports are read via the Pokeys
248   PORT_START      /* IN0 */
248   PORT_START_TAG("IN0")
249249   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN2 )
250250   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN1 )
251   PORT_DIPNAME( 0x04, 0x00, "Freeze" )
251   PORT_DIPNAME( 0x04, 0x00, "Freeze" )         PORT_DIPLOCATION("50H:!4")
252252   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
253253   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
254   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Freeze Step") PORT_CODE(KEYCODE_F1)
255   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_UNUSED )
254   PORT_DIPNAME( 0x08, 0x00, "Freeze Step" )      PORT_DIPLOCATION("50H:!3")
255   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
256   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
257   PORT_DIPUNUSED_DIPLOC( 0x10, 0x00, "50H:!2" )   /* Listed As "SPARE2 (Unused)" */
258   PORT_DIPUNUSED_DIPLOC( 0x20, 0x00, "50H:!1" )   /* Listed As "SPARE1 (Unused)" */
256259   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_VBLANK )
257260   PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
258261
259   PORT_START      /* IN1 */
262   PORT_START_TAG("IN1")
260263   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1)
261264   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1)
262265   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1)
r1877r1878
270273
271274// Same as the regular one except they added a Flip Controls switch
272275static INPUT_PORTS_START( atetcktl )
273   // These ports are read via the Pokeys
274   PORT_START      /* IN0 */
275   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN2 )
276   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN1 )
277   PORT_DIPNAME( 0x04, 0x00, "Freeze" )
276   PORT_INCLUDE( atetris )
277
278   PORT_MODIFY("IN0")
279   PORT_DIPNAME( 0x20, 0x00, "Flip Controls" )      PORT_DIPLOCATION("50H:!1")
278280   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
279   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
280   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Freeze Step") PORT_CODE(KEYCODE_F1)
281   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
282   PORT_DIPNAME( 0x20, 0x00, "Flip Controls" )
283   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
284281   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
285   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_VBLANK )
286   PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
287
288   PORT_START      /* IN1 */
289   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1)
290   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
291   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
292   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
293   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2)
294   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
295   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
296   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
297282INPUT_PORTS_END
298283
299284
src/mame/drivers/dgpix.c
r1877r1878
5454
5555static UINT32 *vram;
5656static int vbuffer = 0;
57static mame_bitmap *bitmaps[2];
57static bitmap_t *bitmaps[2];
5858
5959static int flash_roms;
6060static UINT32 flash_cmd = 0;
r1877r1878
163163   switch(mem_mask)
164164   {
165165      case 0:
166         vram_w(offset,data,0x0000ffff);
167         vram_w(offset,data,0xffff0000);
166         vram_w(machine,offset,data,0x0000ffff);
167         vram_w(machine,offset,data,0xffff0000);
168168         return;
169169
170170      case 0xffff:
r1877r1878
217217{
218218   /* burn a bunch of cycles because this is polled frequently during busy loops */
219219   activecpu_adjust_icount(-100);
220   return input_port_0_dword_r(offset, 0);
220   return input_port_0_dword_r(machine, offset, 0);
221221}
222222
223223static ADDRESS_MAP_START( cpu_map, ADDRESS_SPACE_PROGRAM, 32 )
src/mame/drivers/cosmic.c
r1877r1878
112112
113113static WRITE8_HANDLER( panic_sound_output2_w )
114114{
115   panic_sound_output_w(offset+15, data);
115   panic_sound_output_w(machine, offset+15, data);
116116}
117117
118118static WRITE8_HANDLER( cosmicg_output_w )
r1877r1878
189189        /* mostly not noticed since sound is */
190190      /* only enabled if game in progress! */
191191
192       if ((input_port_3_r(0) & 0xc0) != 0xc0)
193           panic_sound_output_w(17,1);
192       if ((input_port_3_r(machine,0) & 0xc0) != 0xc0)
193           panic_sound_output_w(machine,17,1);
194194
195195      cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, 0xcf);   /* RST 08h */
196196    }
r1877r1878
228228static INTERRUPT_GEN( magspot_interrupt )
229229{
230230   /* Coin 1 causes an IRQ, Coin 2 an NMI */
231   if (input_port_4_r(0) & 0x01)
231   if (input_port_4_r(machine,0) & 0x01)
232232        cpunum_set_input_line(machine, 0, 0, HOLD_LINE);
233   else if (input_port_4_r(0) & 0x02)
233   else if (input_port_4_r(machine,0) & 0x02)
234234      cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
235235}
236236
237237static INTERRUPT_GEN( nomnlnd_interrupt )
238238{
239239   /* Coin causes an NMI */
240   if (input_port_4_r(0) & 0x01)
240   if (input_port_4_r(machine,0) & 0x01)
241241      cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
242242}
243243
r1877r1878
252252{
253253   /* The top four address lines from the CRTC are bits 0-3 */
254254
255   return (input_port_0_r(0) & 0xf0) | ((video_screen_get_vpos(0) & 0xf0) >> 4);
255   return (input_port_0_r(machine,0) & 0xf0) | ((video_screen_get_vpos(0) & 0xf0) >> 4);
256256}
257257
258258static READ8_HANDLER( magspot_coinage_dip_r )
259259{
260   return (input_port_5_r(0) & (1 << (7 - offset))) ? 0 : 1;
260   return (input_port_5_r(machine,0) & (1 << (7 - offset))) ? 0 : 1;
261261}
262262
263263
r1877r1878
266266static READ8_HANDLER( nomnlnd_port_0_1_r )
267267{
268268   int control;
269    int fire = input_port_3_r(0);
269    int fire = input_port_3_r(machine,0);
270270
271271   if (offset)
272      control = input_port_1_r(0);
272      control = input_port_1_r(machine,0);
273273    else
274      control = input_port_0_r(0);
274      control = input_port_0_r(machine,0);
275275
276276    /* If firing - stop tank */
277277
r1877r1878
10051005   MDRV_CPU_MODIFY("main")
10061006
10071007   MDRV_CPU_PROGRAM_MAP(panic_readmem,panic_writemem)
1008   MDRV_CPU_VBLANK_INT(panic_interrupt,2)
1008   MDRV_CPU_VBLANK_INT_HACK(panic_interrupt,2)
10091009
10101010   /* video hardware */
10111011   MDRV_GFXDECODE(panic)
r1877r1878
10331033   MDRV_CPU_MODIFY("main")
10341034
10351035   MDRV_CPU_PROGRAM_MAP(cosmica_readmem,cosmica_writemem)
1036   MDRV_CPU_VBLANK_INT(cosmica_interrupt,32)
1036   MDRV_CPU_VBLANK_INT_HACK(cosmica_interrupt,32)
10371037
10381038   /* video hardware */
10391039   MDRV_GFXDECODE(cosmica)
r1877r1878
10541054            1.5MHz.  So, if someone can check this... */
10551055   MDRV_CPU_PROGRAM_MAP(cosmicg_readmem,cosmicg_writemem)
10561056   MDRV_CPU_IO_MAP(cosmicg_readport,cosmicg_writeport)
1057   MDRV_CPU_VBLANK_INT(cosmicg_interrupt,1)
1057   MDRV_CPU_VBLANK_INT("main", cosmicg_interrupt)
10581058
10591059   /* video hardware */
10601060   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
10871087   MDRV_CPU_MODIFY("main")
10881088
10891089   MDRV_CPU_PROGRAM_MAP(magspot_readmem,magspot_writemem)
1090   MDRV_CPU_VBLANK_INT(magspot_interrupt,1)
1090   MDRV_CPU_VBLANK_INT("main", magspot_interrupt)
10911091
10921092   /* video hardware */
10931093   MDRV_GFXDECODE(panic)
r1877r1878
11211121   MDRV_CPU_MODIFY("main")
11221122
11231123   MDRV_CPU_PROGRAM_MAP(magspot_readmem,magspot_writemem)
1124   MDRV_CPU_VBLANK_INT(nomnlnd_interrupt,1)
1124   MDRV_CPU_VBLANK_INT("main", nomnlnd_interrupt)
11251125
11261126   /* video hardware */
11271127   MDRV_GFXDECODE(panic)
src/mame/drivers/sangho.c
r1877r1878
235235   MDRV_CPU_ADD(Z80,8000000) // ?
236236   MDRV_CPU_PROGRAM_MAP(readmem, 0)
237237   MDRV_CPU_IO_MAP(readport_pzlestar,writeport_pzlestar)
238   MDRV_CPU_VBLANK_INT(sangho_interrupt,262)
238   MDRV_CPU_VBLANK_INT_HACK(sangho_interrupt,262)
239239
240240   MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
241241
r1877r1878
268268   MDRV_CPU_ADD(Z80,8000000) // ?
269269   MDRV_CPU_PROGRAM_MAP(readmem, 0)
270270   MDRV_CPU_IO_MAP(readport_sexyboom,writeport_sexyboom)
271   MDRV_CPU_VBLANK_INT(sangho_interrupt,262)
271   MDRV_CPU_VBLANK_INT_HACK(sangho_interrupt,262)
272272
273273   MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
274274
src/mame/drivers/shaolins.c
r1877r1878
220220   /* basic machine hardware */
221221   MDRV_CPU_ADD(M6809, XTAL_18_432MHz/12)        /* verified on pcb */
222222   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
223   MDRV_CPU_VBLANK_INT(shaolins_interrupt,16)   /* 1 IRQ + 8 NMI */
223   MDRV_CPU_VBLANK_INT_HACK(shaolins_interrupt,16)   /* 1 IRQ + 8 NMI */
224224
225225   /* video hardware */
226226   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/model2.c
r1877r1878
483483
484484static READ32_HANDLER(videoctl_r)
485485{
486   return (cpu_getcurrentframe() & 1)<<2;
486   return (video_screen_get_frame_number(0) & 1)<<2;
487487}
488488
489489
r1877r1878
944944{
945945   if (((mem_mask & 0xff) == 0) && (offset == 0))
946946   {
947      SCSP_MidiIn(0, data&0xff, 0);
947      SCSP_MidiIn(machine, 0, data&0xff, 0);
948948
949949      // give the 68k time to notice
950950      cpu_spinuntil_time(ATTOTIME_IN_USEC(40));
r1877r1878
15781578
15791579static READ16_HANDLER( m1_snd_mpcm0_r )
15801580{
1581   return MultiPCM_reg_0_r(0);
1581   return MultiPCM_reg_0_r(machine, 0);
15821582}
15831583
15841584static WRITE16_HANDLER( m1_snd_mpcm0_w )
15851585{
1586   MultiPCM_reg_0_w(offset, data);
1586   MultiPCM_reg_0_w(machine, offset, data);
15871587}
15881588
15891589static WRITE16_HANDLER( m1_snd_mpcm0_bnk_w )
r1877r1878
15931593
15941594static READ16_HANDLER( m1_snd_mpcm1_r )
15951595{
1596   return MultiPCM_reg_1_r(0);
1596   return MultiPCM_reg_1_r(machine, 0);
15971597}
15981598
15991599static WRITE16_HANDLER( m1_snd_mpcm1_w )
16001600{
1601   MultiPCM_reg_1_w(offset, data);
1601   MultiPCM_reg_1_w(machine, offset, data);
16021602}
16031603
16041604static WRITE16_HANDLER( m1_snd_mpcm1_bnk_w )
r1877r1878
16081608
16091609static READ16_HANDLER( m1_snd_ym_r )
16101610{
1611   return YM3438_status_port_0_A_r(0);
1611   return YM3438_status_port_0_A_r(machine, 0);
16121612}
16131613
16141614static WRITE16_HANDLER( m1_snd_ym_w )
r1877r1878
16161616   switch (offset)
16171617   {
16181618      case 0:
1619         YM3438_control_port_0_A_w(0, data);
1619         YM3438_control_port_0_A_w(machine, 0, data);
16201620         break;
16211621
16221622      case 1:
1623         YM3438_data_port_0_A_w(0, data);
1623         YM3438_data_port_0_A_w(machine, 0, data);
16241624         break;
16251625
16261626      case 2:
1627         YM3438_control_port_0_B_w(0, data);
1627         YM3438_control_port_0_B_w(machine, 0, data);
16281628         break;
16291629
16301630      case 3:
1631         YM3438_data_port_0_B_w(0, data);
1631         YM3438_data_port_0_B_w(machine, 0, data);
16321632         break;
16331633   }
16341634}
r1877r1878
17891789static MACHINE_DRIVER_START( model2o )
17901790   MDRV_CPU_ADD(I960, 25000000)
17911791   MDRV_CPU_PROGRAM_MAP(model2_base_mem, model2o_mem)
1792    MDRV_CPU_VBLANK_INT(model2_interrupt,2)
1792    MDRV_CPU_VBLANK_INT_HACK(model2_interrupt,2)
17931793
17941794   MDRV_CPU_ADD(M68000, 10000000)
17951795   MDRV_CPU_PROGRAM_MAP(model1_snd, 0)
r1877r1878
18361836static MACHINE_DRIVER_START( model2a )
18371837   MDRV_CPU_ADD(I960, 25000000)
18381838   MDRV_CPU_PROGRAM_MAP(model2_base_mem, model2a_crx_mem)
1839    MDRV_CPU_VBLANK_INT(model2_interrupt,2)
1839    MDRV_CPU_VBLANK_INT_HACK(model2_interrupt,2)
18401840
18411841   MDRV_CPU_ADD(M68000, 12000000)
18421842   MDRV_CPU_PROGRAM_MAP(model2_snd, 0)
r1877r1878
18801880static MACHINE_DRIVER_START( model2b )
18811881   MDRV_CPU_ADD(I960, 25000000)
18821882   MDRV_CPU_PROGRAM_MAP(model2_base_mem, model2b_crx_mem)
1883    MDRV_CPU_VBLANK_INT(model2_interrupt,2)
1883    MDRV_CPU_VBLANK_INT_HACK(model2_interrupt,2)
18841884
18851885   MDRV_CPU_ADD(M68000, 12000000)
18861886   MDRV_CPU_PROGRAM_MAP(model2_snd, 0)
r1877r1878
19241924static MACHINE_DRIVER_START( model2c )
19251925   MDRV_CPU_ADD(I960, 25000000)
19261926   MDRV_CPU_PROGRAM_MAP(model2_base_mem, model2c_crx_mem)
1927    MDRV_CPU_VBLANK_INT(model2c_interrupt,3)
1927    MDRV_CPU_VBLANK_INT_HACK(model2c_interrupt,3)
19281928
19291929   MDRV_CPU_ADD(M68000, 12000000)
19301930   MDRV_CPU_PROGRAM_MAP(model2_snd, 0)
src/mame/drivers/bmcbowl.c
r1877r1878
215215
216216static READ16_HANDLER(via_r)
217217{
218   return via_0_r(offset);
218   return via_0_r(machine,offset);
219219}
220220
221221static WRITE16_HANDLER(via_w)
222222{
223   via_0_w(offset,data);
223   via_0_w(machine,offset,data);
224224}
225225
226226static READ8_HANDLER(via_b_in)
227227{
228   return input_port_3_r(0);
228   return input_port_3_r(machine,0);
229229}
230230
231231
r1877r1878
447447{
448448   switch(bmc_input)
449449   {
450         case 0x00:   return  input_port_1_r(0);
451         case 0x40:   return  input_port_2_r(0);
450         case 0x00:   return  input_port_1_r(machine,0);
451         case 0x40:   return  input_port_2_r(machine,0);
452452   }
453453   logerror("unknown input - %X (PC=%X)\n",bmc_input,activecpu_get_previouspc());
454454   return 0xff;
r1877r1878
495495static MACHINE_DRIVER_START( bmcbowl )
496496   MDRV_CPU_ADD_TAG("main", M68000, 21477270/2 )
497497   MDRV_CPU_PROGRAM_MAP(bmcbowl_mem,0)
498   MDRV_CPU_VBLANK_INT(bmc_interrupt,2)
498   MDRV_CPU_VBLANK_INT_HACK(bmc_interrupt,2)
499499
500500
501501   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/sshangha.c
r1877r1878
8989
9090static WRITE16_HANDLER( sshangha_sound_w )
9191{
92   soundlatch_w(0,data&0xff);
93   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
92   soundlatch_w(machine,0,data&0xff);
93   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
9494}
9595
9696/* Protection/IO chip 146 */
r1877r1878
142142         orientation when entering the "test mode"
143143         (check the game code from 0x0006b8 to 0x0006f0).
144144       I can't tell however if this is accurate or not. */
145   sshangha_control_0_w(0, 0x10, 0xff00);
145   sshangha_control_0_w(machine, 0, 0x10, 0xff00);
146146}
147147
148148/******************************************************************************/
r1877r1878
342342   /* basic machine hardware */
343343   MDRV_CPU_ADD(M68000, 28000000/2)
344344   MDRV_CPU_PROGRAM_MAP(sshangha_readmem,sshangha_writemem)
345   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
345   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
346346
347347   MDRV_CPU_ADD(Z80, 16000000/4)
348348   /* audio CPU */
src/mame/drivers/wiping.c
r1877r1878
310310   /* basic machine hardware */
311311   MDRV_CPU_ADD(Z80,18432000/6)   /* 3.072 MHz */
312312   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
313   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
313   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
314314
315315   MDRV_CPU_ADD(Z80,18432000/6)
316316   /* audio CPU */   /* 3.072 MHz */
src/mame/drivers/kyugo.c
r1877r1878
4040{
4141   // must start with interrupts and sub CPU disabled
4242   cpu_interrupt_enable(0, 0);
43   kyugo_sub_cpu_control_w(0, 0);
43   kyugo_sub_cpu_control_w(machine, 0, 0);
4444}
4545
4646
r1877r1878
496496   MDRV_CPU_ADD_TAG("main", Z80, 18432000 / 4)   /* 18.432 MHz crystal */
497497   MDRV_CPU_PROGRAM_MAP(main_map,0)
498498   MDRV_CPU_IO_MAP(0,gyrodine_portmap)
499   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
499   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
500500
501501   MDRV_CPU_ADD_TAG("sub", Z80, 18432000 / 4)   /* 18.432 MHz crystal */
502502   MDRV_CPU_PROGRAM_MAP(gyrodine_sub_map,0)
503503   MDRV_CPU_IO_MAP(gyrodine_sub_portmap,0)
504   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)
504   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)
505505
506506   MDRV_INTERLEAVE(100)
507507
src/mame/drivers/leland.c
r1877r1878
719719   MDRV_CPU_ADD_TAG("master", Z80, MASTER_CLOCK/2)
720720   MDRV_CPU_PROGRAM_MAP(master_map_program,0)
721721   MDRV_CPU_IO_MAP(master_map_io,0)
722   MDRV_CPU_VBLANK_INT(leland_master_interrupt,1)
722   MDRV_CPU_VBLANK_INT("main", leland_master_interrupt)
723723
724724   MDRV_CPU_ADD_TAG("slave", Z80, MASTER_CLOCK/2)
725725   MDRV_CPU_PROGRAM_MAP(slave_small_map_program,0)
src/mame/drivers/mjsiyoub.c
r1877r1878
8282   /* basic machine hardware */
8383   MDRV_CPU_ADD(Z80,18432000/4)
8484   MDRV_CPU_PROGRAM_MAP(readmem1,writemem1)
85//  MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
85//  MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
8686
8787   MDRV_CPU_ADD(Z80,18432000/4)
8888   MDRV_CPU_PROGRAM_MAP(readmem2,writemem2)
89//  MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
89//  MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
9090
9191   /* video hardware */
9292   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/lazercmd.c
r1877r1878
221221***************************************************************************/
222222
223223#include "driver.h"
224#include "deprecat.h"
224225#include "lazercmd.h"
225226#include "cpu/s2650/s2650.h"
226227#include "sound/dac.h"
r1877r1878
285286static READ8_HANDLER( lazercmd_data_port_r )
286287{
287288   int data;
288   data = input_port_2_r(0) & 0x0f;
289   data = input_port_2_r(machine,0) & 0x0f;
289290   return data;
290291}
291292
r1877r1878
380381   switch (offset)
381382   {
382383      case 0:             /* player 1 joysticks */
383         data = input_port_0_r(0);
384         data = input_port_0_r(machine,0);
384385         break;
385386      case 1:             /* player 2 joysticks */
386         data = input_port_1_r(0);
387         data = input_port_1_r(machine,0);
387388         break;
388389      case 2:             /* player 1 + 2 buttons */
389         data = input_port_4_r(0);
390         data = input_port_4_r(machine,0);
390391         break;
391392      case 3:             /* coin slot + start buttons */
392         data = input_port_3_r(0);
393         data = input_port_3_r(machine,0);
393394         break;
394395      case 4:             /* vertical scan counter */
395396         data = ((timer_count&0x10)>>1)|((timer_count&0x20)>>3)|((timer_count&0x40)>>5)|((timer_count&0x80)>>7);
r1877r1878
620621            thus requiring an extra loading of approx 3-5 */
621622   MDRV_CPU_PROGRAM_MAP(lazercmd_map,0)
622623   MDRV_CPU_IO_MAP(lazercmd_portmap,0)
623   MDRV_CPU_VBLANK_INT(lazercmd_timer, 128)    /* 7680 Hz */
624   MDRV_CPU_VBLANK_INT_HACK(lazercmd_timer, 128)    /* 7680 Hz */
624625
625626   /* video hardware */
626627   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
655656            thus requiring an extra loading of approx 3-5 */
656657   MDRV_CPU_PROGRAM_MAP(medlanes_map,0)
657658   MDRV_CPU_IO_MAP(lazercmd_portmap,0)
658   MDRV_CPU_VBLANK_INT(lazercmd_timer, 128)    /* 7680 Hz */
659   MDRV_CPU_VBLANK_INT_HACK(lazercmd_timer, 128)    /* 7680 Hz */
659660
660661   /* video hardware */
661662   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
690691            thus requiring an extra loading of approx 3-5 */
691692   MDRV_CPU_PROGRAM_MAP(bbonk_map,0)
692693   MDRV_CPU_IO_MAP(lazercmd_portmap,0)
693   MDRV_CPU_VBLANK_INT(bbonk_timer, 128)    /* 7680 Hz */
694   MDRV_CPU_VBLANK_INT_HACK(bbonk_timer, 128)    /* 7680 Hz */
694695
695696   /* video hardware */
696697   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/popeye.c
r1877r1878
463463   int res;
464464
465465
466   res = input_port_3_r(offset);
467   res |= (input_port_4_r(offset) << (7-dswbit)) & 0x80;
466   res = input_port_3_r(machine,offset);
467   res |= (input_port_4_r(machine,offset) << (7-dswbit)) & 0x80;
468468
469469   return res;
470470}
r1877r1878
484484   MDRV_CPU_ADD_TAG("main", Z80, 8000000/2)   /* 4 MHz */
485485   MDRV_CPU_PROGRAM_MAP(skyskipr_readmem,skyskipr_writemem)
486486   MDRV_CPU_IO_MAP(readport,writeport)
487   MDRV_CPU_VBLANK_INT(popeye_interrupt,1)
487   MDRV_CPU_VBLANK_INT("main", popeye_interrupt)
488488
489489   /* video hardware */
490490   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/gstream.c
r1877r1878
166166   AM_RANGE(0xFFF80000, 0xFFFFFFFF) AM_ROM AM_REGION(REGION_USER1,0) // boot rom
167167ADDRESS_MAP_END
168168
169static READ32_HANDLER( gstream_oki_0_r ) { return OKIM6295_status_0_r(0); }
170static READ32_HANDLER( gstream_oki_1_r ) { return OKIM6295_status_1_r(0); }
171static WRITE32_HANDLER( gstream_oki_0_w ) { OKIM6295_data_0_w(0, data & 0xff); }
172static WRITE32_HANDLER( gstream_oki_1_w ) { OKIM6295_data_1_w(0, data & 0xff); }
169static READ32_HANDLER( gstream_oki_0_r ) { return OKIM6295_status_0_r(machine, 0); }
170static READ32_HANDLER( gstream_oki_1_r ) { return OKIM6295_status_1_r(machine, 0); }
171static WRITE32_HANDLER( gstream_oki_0_w ) { OKIM6295_data_0_w(machine, 0, data & 0xff); }
172static WRITE32_HANDLER( gstream_oki_1_w ) { OKIM6295_data_1_w(machine, 0, data & 0xff); }
173173
174174static WRITE32_HANDLER( gstream_oki_4030_w )
175175{
r1877r1878
389389   MDRV_CPU_ADD_TAG("main", E132XT, 16000000*4)   /* 4x internal multiplier */
390390   MDRV_CPU_PROGRAM_MAP(gstream_32bit_map,0)
391391   MDRV_CPU_IO_MAP(gstream_io,0)
392   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
392   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
393393
394394   /* video hardware */
395395   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/4enraya.c
r1877r1878
4949***************************************************************************/
5050
5151#include "driver.h"
52#include "deprecat.h"
5253#include "cpu/z80/z80.h"
5354#include "sound/ay8910.h"
5455
r1877r1878
7071   if ((last & 0x04) == 0x04 && (data & 0x4) == 0x00)
7172   {
7273      if (last & 0x01)
73         AY8910_control_port_0_w(0,soundlatch);
74         AY8910_control_port_0_w(machine,0,soundlatch);
7475      else
75         AY8910_write_port_0_w(0,soundlatch);
76         AY8910_write_port_0_w(machine,0,soundlatch);
7677   }
7778   last=data;
7879}
r1877r1878
161162   MDRV_CPU_ADD(Z80,8000000/2)
162163   MDRV_CPU_PROGRAM_MAP(main_map,0)
163164   MDRV_CPU_IO_MAP(main_portmap,0)
164   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)
165   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)
165166
166167   /* video hardware */
167168   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/taxidrvr.c
r1877r1878
1111
1212
1313
14static WRITE8_HANDLER( p2a_w ) { taxidrvr_spritectrl_w(0,data); }
15static WRITE8_HANDLER( p2b_w ) { taxidrvr_spritectrl_w(1,data); }
16static WRITE8_HANDLER( p2c_w ) { taxidrvr_spritectrl_w(2,data); }
17static WRITE8_HANDLER( p3a_w ) { taxidrvr_spritectrl_w(3,data); }
18static WRITE8_HANDLER( p3b_w ) { taxidrvr_spritectrl_w(4,data); }
19static WRITE8_HANDLER( p3c_w ) { taxidrvr_spritectrl_w(5,data); }
20static WRITE8_HANDLER( p4a_w ) { taxidrvr_spritectrl_w(6,data); }
21static WRITE8_HANDLER( p4b_w ) { taxidrvr_spritectrl_w(7,data); }
22static WRITE8_HANDLER( p4c_w ) { taxidrvr_spritectrl_w(8,data); }
14static WRITE8_HANDLER( p2a_w ) { taxidrvr_spritectrl_w(machine,0,data); }
15static WRITE8_HANDLER( p2b_w ) { taxidrvr_spritectrl_w(machine,1,data); }
16static WRITE8_HANDLER( p2c_w ) { taxidrvr_spritectrl_w(machine,2,data); }
17static WRITE8_HANDLER( p3a_w ) { taxidrvr_spritectrl_w(machine,3,data); }
18static WRITE8_HANDLER( p3b_w ) { taxidrvr_spritectrl_w(machine,4,data); }
19static WRITE8_HANDLER( p3c_w ) { taxidrvr_spritectrl_w(machine,5,data); }
20static WRITE8_HANDLER( p4a_w ) { taxidrvr_spritectrl_w(machine,6,data); }
21static WRITE8_HANDLER( p4b_w ) { taxidrvr_spritectrl_w(machine,7,data); }
22static WRITE8_HANDLER( p4c_w ) { taxidrvr_spritectrl_w(machine,8,data); }
2323
2424
2525
r1877r1878
362362   /* basic machine hardware */
363363   MDRV_CPU_ADD(Z80,4000000)   /* 4 MHz ??? */
364364   MDRV_CPU_PROGRAM_MAP(readmem1,writemem1)
365   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
365   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
366366
367367   MDRV_CPU_ADD(Z80,4000000)   /* 4 MHz ??? */
368368   MDRV_CPU_PROGRAM_MAP(readmem2,writemem2)
369   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   /* ??? */
369   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   /* ??? */
370370
371371   MDRV_CPU_ADD(Z80,4000000)   /* 4 MHz ??? */
372372   MDRV_CPU_PROGRAM_MAP(readmem3,writemem3)
373373   MDRV_CPU_IO_MAP(readport3,writeport3)
374   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   /* ??? */
374   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   /* ??? */
375375
376376   MDRV_INTERLEAVE(100)   /* 100 CPU slices per frame - an high value to ensure proper */
377377                     /* synchronization of the CPUs */
src/mame/drivers/blockade.c
r1877r1878
6767{
6868   cpunum_resume(0, SUSPEND_ANY_REASON);
6969
70   if ((input_port_0_r(0) & 0x80) == 0)
70   if ((input_port_0_r(machine,0) & 0x80) == 0)
7171   {
7272      just_been_reset = 1;
7373      cpunum_set_input_line(machine, 0, INPUT_LINE_RESET, PULSE_LINE);
r1877r1878
7878{
7979    /* coin latch is bit 7 */
8080
81    UINT8 temp = (input_port_0_r(0)&0x7f);
81    UINT8 temp = (input_port_0_r(machine,0)&0x7f);
8282    return (coin_latch<<7) | (temp);
8383}
8484
r1877r1878
458458   MDRV_CPU_ADD(8080, 2079000)
459459   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
460460   MDRV_CPU_IO_MAP(readport,writeport)
461   MDRV_CPU_VBLANK_INT(blockade_interrupt,1)
461   MDRV_CPU_VBLANK_INT("main", blockade_interrupt)
462462
463463   /* video hardware */
464464   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/compgolf.c
r1877r1878
211211static MACHINE_DRIVER_START( compgolf )
212212   MDRV_CPU_ADD(M6809, 2000000)
213213   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
214   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
214   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
215215
216216   /* video hardware */
217217   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/cps2.c
r1877r1878
10231023INPUT_PORTS_END
10241024
10251025/* 3 players and 2 buttons */
1026#ifdef UNUSED_DEFINITION
10261027static INPUT_PORTS_START( cps2_3p2b )
10271028   PORT_INCLUDE(cps2_3p3b)
10281029
r1877r1878
10331034   PORT_MODIFY("IN1")
10341035    PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )           /* BUTTON3 PORT_PLAYER(3) */
10351036INPUT_PORTS_END
1037#endif
10361038
10371039/* 2 players and 4 buttons */
10381040static INPUT_PORTS_START( cps2_2p4b )
r1877r1878
12391241   MDRV_CPU_ADD(M68000, 16000000)
12401242   MDRV_CPU_CONFIG(cps2_encryption)
12411243   MDRV_CPU_PROGRAM_MAP(cps2_readmem,cps2_writemem)
1242   MDRV_CPU_VBLANK_INT(cps2_interrupt,262)   // 262  /* ??? interrupts per frame */
1244   MDRV_CPU_VBLANK_INT_HACK(cps2_interrupt,262)   // 262  /* ??? interrupts per frame */
12431245
12441246   MDRV_CPU_ADD(Z80, 8000000)
12451247   MDRV_CPU_PROGRAM_MAP(qsound_readmem,qsound_writemem)
r1877r1878
22392241   ROM_LOAD16_WORD_SWAP( "dad.12m",   0x200000, 0x200000, CRC(2f0b5a4e) SHA1(8d1ebbb811aa469b0f0d29d719d2b9af28fb63a2) )
22402242ROM_END
22412243
2242ROM_START( ddtodjr2 )
2244ROM_START( ddtodjr1 )
22432245   ROM_REGION( CODE_SIZE, REGION_CPU1, 0 )      /* 68000 code */
22442246   ROM_LOAD16_WORD_SWAP( "dadj.03b", 0x000000, 0x80000, CRC(87606b85) SHA1(1311c9ae321207db4632572f6c838b732974b087) )
22452247   ROM_LOAD16_WORD_SWAP( "dadj.04b", 0x080000, 0x80000, CRC(24d49575) SHA1(419d7d2f970c23c39334a7f2e8c5caa237769c5d) )
r1877r1878
22662268   ROM_LOAD16_WORD_SWAP( "dad.12m",   0x200000, 0x200000, CRC(2f0b5a4e) SHA1(8d1ebbb811aa469b0f0d29d719d2b9af28fb63a2) )
22672269ROM_END
22682270
2269ROM_START( ddtodjr1 )
2271ROM_START( ddtodjr2 )
22702272   ROM_REGION( CODE_SIZE, REGION_CPU1, 0 )      /* 68000 code */
22712273   ROM_LOAD16_WORD_SWAP( "dadj.03a", 0x000000, 0x80000, CRC(711638dc) SHA1(30c1d1a694aa8e51d072b26b47ba55aed6d77b7b) )
22722274   ROM_LOAD16_WORD_SWAP( "dadj.04a", 0x080000, 0x80000, CRC(4869639c) SHA1(1544813e6712a78267c1d27b6b49148d42c11127) )
src/mame/drivers/lordgun.c
r1877r1878
152152//  popmessage("PR: %04x", data);
153153}
154154
155static READ16_HANDLER( lordgun_ppi8255_0_r )   {   return ppi8255_0_r(offset);   }
156static READ16_HANDLER( lordgun_ppi8255_1_r )   {   return ppi8255_1_r(offset);   }
155static READ16_HANDLER( lordgun_ppi8255_0_r )   {   return ppi8255_0_r(machine, offset);   }
156static READ16_HANDLER( lordgun_ppi8255_1_r )   {   return ppi8255_1_r(machine, offset);   }
157157
158static WRITE16_HANDLER( lordgun_ppi8255_0_w )   {   ppi8255_0_w(offset, data & 0xff);   }
159static WRITE16_HANDLER( lordgun_ppi8255_1_w )   {   ppi8255_1_w(offset, data & 0xff);   }
158static WRITE16_HANDLER( lordgun_ppi8255_0_w )   {   ppi8255_0_w(machine, offset, data & 0xff);   }
159static WRITE16_HANDLER( lordgun_ppi8255_1_w )   {   ppi8255_1_w(machine, offset, data & 0xff);   }
160160
161161static READ16_HANDLER( lordgun_gun_0_x_r )      { return lordgun_gun[0].hw_x; }
162162static READ16_HANDLER( lordgun_gun_0_y_r )      { return lordgun_gun[0].hw_y; }
r1877r1878
166166
167167static WRITE16_HANDLER( lordgun_soundlatch_w )
168168{
169   if (ACCESSING_LSB)   soundlatch_w (0, (data >> 0) & 0xff);
170   if (ACCESSING_MSB)   soundlatch2_w(0, (data >> 8) & 0xff);
169   if (ACCESSING_LSB)   soundlatch_w (machine, 0, (data >> 0) & 0xff);
170   if (ACCESSING_MSB)   soundlatch2_w(machine, 0, (data >> 8) & 0xff);
171171
172   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
172   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
173173}
174174
175175static ADDRESS_MAP_START( lordgun_map, ADDRESS_SPACE_PROGRAM, 16 )
r1877r1878
438438static MACHINE_DRIVER_START( lordgun )
439439   MDRV_CPU_ADD_TAG("main", M68000, 10000000)
440440   MDRV_CPU_PROGRAM_MAP(lordgun_map,0)
441   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
441   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
442442
443443   MDRV_CPU_ADD_TAG("sound", Z80, 5000000)
444444   MDRV_CPU_PROGRAM_MAP(lordgun_soundmem_map,0)
src/mame/drivers/lemmings.c
r1877r1878
7474
7575static WRITE16_HANDLER( lemmings_sound_w )
7676{
77   soundlatch_w(0,data&0xff);
78   cpunum_set_input_line(Machine, 1,1,HOLD_LINE);
77   soundlatch_w(machine,0,data&0xff);
78   cpunum_set_input_line(machine, 1,1,HOLD_LINE);
7979}
8080
8181static WRITE8_HANDLER( lemmings_sound_ack_w )
r1877r1878
275275   /* basic machine hardware */
276276   MDRV_CPU_ADD(M68000, 14000000)
277277   MDRV_CPU_PROGRAM_MAP(lemmings_readmem,lemmings_writemem)
278   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
278   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
279279
280280   MDRV_CPU_ADD(M6809,32220000/8)
281281   /* audio CPU */
src/mame/drivers/pushman.c
r1877r1878
4040static WRITE16_HANDLER( pushman_control_w )
4141{
4242   if (ACCESSING_MSB)
43      soundlatch_w(0,(data>>8)&0xff);
43      soundlatch_w(machine,0,(data>>8)&0xff);
4444}
4545
4646static READ16_HANDLER( pushman_68705_r )
r1877r1878
435435   /* basic machine hardware */
436436   MDRV_CPU_ADD(M68000, 8000000)
437437   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
438   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
438   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
439439
440440   MDRV_CPU_ADD(Z80, 4000000)
441441   /* audio CPU */
r1877r1878
478478   /* basic machine hardware */
479479   MDRV_CPU_ADD(M68000, 8000000)
480480   MDRV_CPU_PROGRAM_MAP(bballs_readmem,bballs_writemem)
481   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
481   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
482482
483483   MDRV_CPU_ADD(Z80, 4000000)
484484   /* audio CPU */
src/mame/drivers/zerozone.c
r1877r1878
6161{
6262   if (ACCESSING_MSB)
6363   {
64      soundlatch_w(offset,data >> 8);
65      cpunum_set_input_line_and_vector(Machine, 1,0,HOLD_LINE,0xff);
64      soundlatch_w(machine,offset,data >> 8);
65      cpunum_set_input_line_and_vector(machine, 1,0,HOLD_LINE,0xff);
6666   }
6767}
6868
69static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 16 )
70   AM_RANGE(0x000000, 0x01ffff) AM_READ(MRA16_ROM)
69static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
70   AM_RANGE(0x000000, 0x01ffff) AM_ROM
7171   AM_RANGE(0x080000, 0x08000f) AM_READ(zerozone_input_r)
72   AM_RANGE(0x088000, 0x0881ff) AM_READ(MRA16_RAM)
73   AM_RANGE(0x098000, 0x098001) AM_READ(MRA16_RAM) /* watchdog? */
74   AM_RANGE(0x09ce00, 0x09ffff) AM_READ(MRA16_RAM)
75   AM_RANGE(0x0c0000, 0x0cffff) AM_READ(MRA16_RAM)
76   AM_RANGE(0x0f8000, 0x0f87ff) AM_READ(MRA16_RAM) // never actually used
77ADDRESS_MAP_END
78
79static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 16 )
80   AM_RANGE(0x000000, 0x01ffff) AM_WRITE(MWA16_ROM)
8172   AM_RANGE(0x084000, 0x084001) AM_WRITE(zerozone_sound_w)
82   AM_RANGE(0x088000, 0x0881ff) AM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE(&paletteram16)
83   AM_RANGE(0x09ce00, 0x09ddff) AM_WRITE(zerozone_tilemap_w) AM_BASE(&zerozone_videoram) AM_SIZE(&videoram_size)
73   AM_RANGE(0x088000, 0x0881ff) AM_READWRITE(MRA16_RAM, paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE(&paletteram16)
74   AM_RANGE(0x098000, 0x098001) AM_RAM      /* Watchdog? */
75   AM_RANGE(0x09ce00, 0x09ffff) AM_READWRITE(MRA16_RAM, zerozone_tilemap_w) AM_BASE(&zerozone_videoram) AM_SIZE(&videoram_size)
8476   AM_RANGE(0x0b4000, 0x0b4001) AM_WRITE(zerozone_tilebank_w)
85   AM_RANGE(0x0c0000, 0x0cffff) AM_WRITE(MWA16_RAM) /* RAM */
86   AM_RANGE(0x0f8000, 0x0f87ff) AM_WRITE(MWA16_RAM)
77   AM_RANGE(0x0c0000, 0x0cffff) AM_RAM
78   AM_RANGE(0x0f8000, 0x0f87ff) AM_RAM      /* Never read from */
8779ADDRESS_MAP_END
8880
89
90static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
91   AM_RANGE(0x0000, 0x7fff) AM_READ(MRA8_ROM)
92   AM_RANGE(0x8000, 0x87ff) AM_READ(MRA8_RAM)
93   AM_RANGE(0x9800, 0x9800) AM_READ(OKIM6295_status_0_r)
81static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
82   AM_RANGE(0x0000, 0x7fff) AM_ROM
83   AM_RANGE(0x8000, 0x87ff) AM_RAM
84   AM_RANGE(0x9800, 0x9800) AM_READWRITE(OKIM6295_status_0_r, OKIM6295_data_0_w)
9485   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
9586ADDRESS_MAP_END
9687
97static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
98   AM_RANGE(0x0000, 0x7fff) AM_WRITE(MWA8_ROM)
99   AM_RANGE(0x8000, 0x87ff) AM_WRITE(MWA8_RAM)
100   AM_RANGE(0x9800, 0x9800) AM_WRITE(OKIM6295_data_0_w)
101ADDRESS_MAP_END
10288
10389static INPUT_PORTS_START( zerozone )
10490   PORT_START_TAG("IN0")
r1877r1878
192178
193179   /* basic machine hardware */
194180   MDRV_CPU_ADD(M68000, 10000000)   /* 10 MHz */
195   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
196   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
181   MDRV_CPU_PROGRAM_MAP(main_map,0)
182   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
197183
198184   MDRV_CPU_ADD(Z80, 1000000)
199185   /* audio CPU */   /* 1 MHz ??? */
200   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
186   MDRV_CPU_PROGRAM_MAP(sound_map,0)
201187
202188   MDRV_INTERLEAVE(10)
203189
src/mame/drivers/espial.c
r1877r1878
3232
3333WRITE8_HANDLER( zodiac_master_interrupt_enable_w )
3434{
35   interrupt_enable_w(offset,~data & 1);
35   interrupt_enable_w(machine,offset,~data & 1);
3636}
3737
3838
r1877r1878
6060
6161WRITE8_HANDLER( zodiac_master_soundlatch_w )
6262{
63   soundlatch_w(offset, data);
64   cpunum_set_input_line(Machine, 1, 0, HOLD_LINE);
63   soundlatch_w(machine, offset, data);
64   cpunum_set_input_line(machine, 1, 0, HOLD_LINE);
6565}
6666
6767
r1877r1878
315315   /* basic machine hardware */
316316   MDRV_CPU_ADD_TAG("main", Z80, 3072000)   /* 3.072 MHz */
317317   MDRV_CPU_PROGRAM_MAP(espial_readmem,espial_writemem)
318   MDRV_CPU_VBLANK_INT(zodiac_master_interrupt,2)
318   MDRV_CPU_VBLANK_INT_HACK(zodiac_master_interrupt,2)
319319
320320   MDRV_CPU_ADD(Z80, 3072000)   /* 2 MHz?????? */
321321   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
322322   MDRV_CPU_IO_MAP(0,sound_writeport)
323   MDRV_CPU_VBLANK_INT(espial_sound_nmi_gen,4)
323   MDRV_CPU_VBLANK_INT_HACK(espial_sound_nmi_gen,4)
324324
325325   MDRV_MACHINE_RESET(espial)
326326
src/mame/drivers/hyperspt.c
r1877r1878
462462   /* basic machine hardware */
463463   MDRV_CPU_ADD_TAG("main", M6809, XTAL_18_432MHz/12)   /* verified on pcb */
464464   MDRV_CPU_PROGRAM_MAP(hyperspt_readmem,writemem)
465   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
465   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
466466
467467   MDRV_CPU_ADD(Z80,XTAL_14_31818MHz/4) /* verified on pcb */
468468   /* audio CPU */
src/mame/drivers/tiamc1.c
r1877r1878
160160   tiamc1_spriteram_n = video_ram + 0x3020;
161161   tiamc1_spriteram_a = video_ram + 0x3030;
162162
163   tiamc1_bankswitch_w(0, 0);
163   tiamc1_bankswitch_w(machine, 0, 0);
164164
165165   state_save_register_global_pointer(video_ram, 0x3040);
166166}
r1877r1878
279279   MDRV_CPU_PROGRAM_MAP(tiamc1_readmem,tiamc1_writemem)
280280   MDRV_CPU_IO_MAP(tiamc1_readport,tiamc1_writeport)
281281
282   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
282   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
283283
284284   MDRV_MACHINE_RESET(tiamc1)
285285
src/mame/drivers/toaplan1.c
r1877r1878
12231223   /* basic machine hardware */
12241224   MDRV_CPU_ADD(M68000, 10000000)
12251225   MDRV_CPU_PROGRAM_MAP(rallybik_main_map, 0)
1226   MDRV_CPU_VBLANK_INT(toaplan1_interrupt,1)
1226   MDRV_CPU_VBLANK_INT("main", toaplan1_interrupt)
12271227
12281228   MDRV_CPU_ADD(Z80,28000000/8)      /* 3.5MHz (28MHz Oscillator) */
12291229   MDRV_CPU_PROGRAM_MAP(toaplan1_sound_map, 0)
r1877r1878
12631263   /* basic machine hardware */
12641264   MDRV_CPU_ADD(M68000, 10000000)
12651265   MDRV_CPU_PROGRAM_MAP(truxton_main_map, 0)
1266   MDRV_CPU_VBLANK_INT(toaplan1_interrupt,1)
1266   MDRV_CPU_VBLANK_INT("main", toaplan1_interrupt)
12671267
12681268   MDRV_CPU_ADD(Z80,28000000/8)      /* 3.5MHz (28MHz Oscillator) */
12691269   MDRV_CPU_PROGRAM_MAP(toaplan1_sound_map, 0)
r1877r1878
13031303   /* basic machine hardware */
13041304   MDRV_CPU_ADD(M68000, 10000000)
13051305   MDRV_CPU_PROGRAM_MAP(hellfire_main_map, 0)
1306   MDRV_CPU_VBLANK_INT(toaplan1_interrupt,1)
1306   MDRV_CPU_VBLANK_INT("main", toaplan1_interrupt)
13071307
13081308   MDRV_CPU_ADD(Z80,28000000/8)      /* 3.5MHz (28MHz Oscillator) */
13091309   MDRV_CPU_PROGRAM_MAP(toaplan1_sound_map, 0)
r1877r1878
13431343   /* basic machine hardware */
13441344   MDRV_CPU_ADD(M68000, 10000000)
13451345   MDRV_CPU_PROGRAM_MAP(zerowing_main_map, 0)
1346   MDRV_CPU_VBLANK_INT(toaplan1_interrupt,1)
1346   MDRV_CPU_VBLANK_INT("main", toaplan1_interrupt)
13471347
13481348   MDRV_CPU_ADD(Z80,28000000/8)      /* 3.5MHz (28MHz Oscillator) */
13491349   MDRV_CPU_PROGRAM_MAP(toaplan1_sound_map, 0)
r1877r1878
13831383   /* basic machine hardware */
13841384   MDRV_CPU_ADD(M68000, 10000000)
13851385   MDRV_CPU_PROGRAM_MAP(demonwld_main_map, 0)
1386   MDRV_CPU_VBLANK_INT(toaplan1_interrupt,1)
1386   MDRV_CPU_VBLANK_INT("main", toaplan1_interrupt)
13871387
13881388   MDRV_CPU_ADD(Z80,28000000/8)      /* 3.5MHz (28MHz Oscillator) */
13891389   MDRV_CPU_PROGRAM_MAP(toaplan1_sound_map, 0)
r1877r1878
14271427   /* basic machine hardware */
14281428   MDRV_CPU_ADD(M68000, 10000000)
14291429   MDRV_CPU_PROGRAM_MAP(samesame_main_map, 0)
1430   MDRV_CPU_VBLANK_INT(toaplan1_interrupt,1)
1430   MDRV_CPU_VBLANK_INT("main", toaplan1_interrupt)
14311431
14321432   MDRV_MACHINE_RESET(toaplan1)
14331433
r1877r1878
14611461   /* basic machine hardware */
14621462   MDRV_CPU_ADD(M68000, 10000000)
14631463   MDRV_CPU_PROGRAM_MAP(outzone_main_map, 0)
1464   MDRV_CPU_VBLANK_INT(toaplan1_interrupt,1)
1464   MDRV_CPU_VBLANK_INT("main", toaplan1_interrupt)
14651465
14661466   MDRV_CPU_ADD(Z80,28000000/8)      /* 3.5MHz (28MHz Oscillator) */
14671467   MDRV_CPU_PROGRAM_MAP(toaplan1_sound_map, 0)
r1877r1878
15011501   /* basic machine hardware */
15021502   MDRV_CPU_ADD(M68000, XTAL_10MHz) /* verified on pcb */
15031503   MDRV_CPU_PROGRAM_MAP(vimana_main_map, 0)
1504   MDRV_CPU_VBLANK_INT(toaplan1_interrupt,1)
1504   MDRV_CPU_VBLANK_INT("main", toaplan1_interrupt)
15051505
15061506   MDRV_MACHINE_RESET(vimana)
15071507
src/mame/drivers/segag80r.c
r1877r1878
156156 *
157157 *************************************/
158158
159static void service_switch(void *param, UINT32 oldval, UINT32 newval)
159static INPUT_CHANGED( service_switch )
160160{
161161   /* pressing the service switch sends an NMI */
162162   if (newval)
163      cpunum_set_input_line(Machine, 0, INPUT_LINE_NMI, PULSE_LINE);
163      cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
164164}
165165
166166
167167static MACHINE_START( g80r )
168168{
169   /* request a callback if the service switch is pressed */
170   input_port_set_changed_callback(port_tag_to_index("SERVICESW"), 0x01, service_switch, NULL);
171
172169   /* register for save states */
173170}
174171
r1877r1878
204201}
205202
206203static WRITE8_HANDLER( mainram_w )         { mainram[decrypt_offset(offset)] = data; }
207static WRITE8_HANDLER( vidram_w )          { segag80r_videoram_w(decrypt_offset(offset), data); }
208static WRITE8_HANDLER( monsterb_vidram_w ) { monsterb_videoram_w(decrypt_offset(offset), data); }
209static WRITE8_HANDLER( pignewt_vidram_w )  { pignewt_videoram_w(decrypt_offset(offset), data); }
210static WRITE8_HANDLER( sindbadm_vidram_w ) { sindbadm_videoram_w(decrypt_offset(offset), data); }
211static WRITE8_HANDLER( usb_ram_w )         { sega_usb_ram_w(decrypt_offset(offset), data); }
204static WRITE8_HANDLER( vidram_w )          { segag80r_videoram_w(machine, decrypt_offset(offset), data); }
205static WRITE8_HANDLER( monsterb_vidram_w ) { monsterb_videoram_w(machine, decrypt_offset(offset), data); }
206static WRITE8_HANDLER( pignewt_vidram_w )  { pignewt_videoram_w(machine, decrypt_offset(offset), data); }
207static WRITE8_HANDLER( sindbadm_vidram_w ) { sindbadm_videoram_w(machine, decrypt_offset(offset), data); }
208static WRITE8_HANDLER( usb_ram_w )         { sega_usb_ram_w(machine, decrypt_offset(offset), data); }
212209
213210
214211
r1877r1878
305302
306303static WRITE8_HANDLER( sindbadm_soundport_w )
307304{
308   soundlatch_w(0,data);
309   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
305   soundlatch_w(machine,0,data);
306   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
310307   cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(50));
311308}
312309
r1877r1878
321318/* the data lines are flipped */
322319static WRITE8_HANDLER( sindbadm_SN76496_0_w )
323320{
324   SN76496_0_w(offset, BITSWAP8(data, 0,1,2,3,4,5,6,7));
321   SN76496_0_w(machine, offset, BITSWAP8(data, 0,1,2,3,4,5,6,7));
325322}
326323
327324
328325static WRITE8_HANDLER( sindbadm_SN76496_1_w )
329326{
330   SN76496_1_w(offset, BITSWAP8(data, 0,1,2,3,4,5,6,7));
327   SN76496_1_w(machine, offset, BITSWAP8(data, 0,1,2,3,4,5,6,7));
331328}
332329
333330
r1877r1878
467464   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )            /* P1.30 */
468465
469466   PORT_START_TAG("SERVICESW")
470   PORT_SERVICE_NO_TOGGLE( 0x01, IP_ACTIVE_HIGH )
467   PORT_SERVICE_NO_TOGGLE( 0x01, IP_ACTIVE_HIGH ) PORT_CHANGED(service_switch, 0)
471468INPUT_PORTS_END
472469
473470
r1877r1878
821818   MDRV_CPU_ADD_TAG("main", Z80, VIDEO_CLOCK/4)
822819   MDRV_CPU_PROGRAM_MAP(main_map,0)
823820   MDRV_CPU_IO_MAP(main_portmap,0)
824   MDRV_CPU_VBLANK_INT(segag80r_vblank_start,1)
821   MDRV_CPU_VBLANK_INT("main", segag80r_vblank_start)
825822
826823   MDRV_MACHINE_START(g80r)
827824
r1877r1878
914911   MDRV_IMPORT_FROM(g80r_base)
915912   MDRV_CPU_MODIFY("main")
916913   MDRV_CPU_IO_MAP(sindbadm_portmap,0)
917   MDRV_CPU_VBLANK_INT(sindbadm_vblank_start,1)
914   MDRV_CPU_VBLANK_INT("main", sindbadm_vblank_start)
918915
919916   /* video hardware */
920917   MDRV_GFXDECODE(monsterb)
r1877r1878
924921
925922   MDRV_CPU_ADD(Z80, SINDBADM_SOUND_CLOCK/2)
926923   MDRV_CPU_PROGRAM_MAP(sindbadm_sound_map,0)
927   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)
924   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)
928925
929926   /* sound hardware */
930927   MDRV_SOUND_ADD(SN76496, SINDBADM_SOUND_CLOCK/4)
src/mame/drivers/magic10.c
r1877r1878
346346static MACHINE_DRIVER_START( magic10 )
347347   MDRV_CPU_ADD_TAG("cpu", M68000, 10000000) // ?
348348   MDRV_CPU_PROGRAM_MAP(magic10_map,0)
349   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
349   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
350350
351351   MDRV_NVRAM_HANDLER(generic_0fill)
352352
src/mame/drivers/hnayayoi.c
r1877r1878
624624   MDRV_CPU_ADD_TAG("main", Z80, 20000000/4 )        /* 5 MHz ???? */
625625   MDRV_CPU_PROGRAM_MAP(hnayayoi_readmem,hnayayoi_writemem)
626626   MDRV_CPU_IO_MAP(hnayayoi_readport,hnayayoi_writeport)
627   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
627   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
628628   MDRV_CPU_PERIODIC_INT(nmi_line_pulse, 8000)
629629
630630   MDRV_MACHINE_RESET(hnayayoi)
src/mame/drivers/shanghai.c
r1877r1878
986986   MDRV_CPU_ADD(V30,16000000/2)   /* ? */
987987   MDRV_CPU_PROGRAM_MAP(shanghai_map,0)
988988   MDRV_CPU_IO_MAP(shanghai_portmap,0)
989   MDRV_CPU_VBLANK_INT(shanghai_interrupt,1)
989   MDRV_CPU_VBLANK_INT("main", shanghai_interrupt)
990990
991991   /* video hardware */
992992   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
10191019   MDRV_CPU_ADD(V30,16000000/2)   /* ? */
10201020   MDRV_CPU_PROGRAM_MAP(shangha2_map,0)
10211021   MDRV_CPU_IO_MAP(shangha2_portmap,0)
1022   MDRV_CPU_VBLANK_INT(shanghai_interrupt,1)
1022   MDRV_CPU_VBLANK_INT("main", shanghai_interrupt)
10231023
10241024   /* video hardware */
10251025   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
10501050   /* basic machine hardware */
10511051   MDRV_CPU_ADD(V30,16000000/2)   /* ? */
10521052   MDRV_CPU_PROGRAM_MAP(kothello_map, 0)
1053   MDRV_CPU_VBLANK_INT(shanghai_interrupt,1)
1053   MDRV_CPU_VBLANK_INT("main", shanghai_interrupt)
10541054
10551055   SEIBU3A_SOUND_SYSTEM_CPU(14318180/4)
10561056
src/mame/drivers/tmnt.c
r1877r1878
119119   /* some games have the A12 line not connected, so the chip spans */
120120   /* twice the memory range, with mirroring */
121121   offset = ((offset & 0x3000) >> 1) | (offset & 0x07ff);
122   return K052109_word_r(offset,mem_mask);
122   return K052109_word_r(machine,offset,mem_mask);
123123}
124124
125125static WRITE16_HANDLER( K052109_word_noA12_w )
r1877r1878
127127   /* some games have the A12 line not connected, so the chip spans */
128128   /* twice the memory range, with mirroring */
129129   offset = ((offset & 0x3000) >> 1) | (offset & 0x07ff);
130   K052109_word_w(offset,data,mem_mask);
130   K052109_word_w(machine,offset,data,mem_mask);
131131}
132132
133133static WRITE16_HANDLER( punkshot_K052109_word_w )
r1877r1878
135135   /* it seems that a word write is supposed to affect only the MSB. The */
136136   /* "ROUND 1" text in punkshtj goes lost otherwise. */
137137   if (ACCESSING_MSB)
138      K052109_w(offset,(data >> 8) & 0xff);
138      K052109_w(machine,offset,(data >> 8) & 0xff);
139139   else if (ACCESSING_LSB)
140      K052109_w(offset + 0x2000,data & 0xff);
140      K052109_w(machine,offset + 0x2000,data & 0xff);
141141}
142142
143143static WRITE16_HANDLER( punkshot_K052109_word_noA12_w )
r1877r1878
145145   /* some games have the A12 line not connected, so the chip spans */
146146   /* twice the memory range, with mirroring */
147147   offset = ((offset & 0x3000) >> 1) | (offset & 0x07ff);
148   punkshot_K052109_word_w(offset,data,mem_mask);
148   punkshot_K052109_word_w(machine,offset,data,mem_mask);
149149}
150150
151151
r1877r1878
159159   else
160160   {
161161      offset = ((offset & 0x000e) >> 1) | ((offset & 0x1fc0) >> 3);
162      return K053245_word_r(offset,mem_mask);
162      return K053245_word_r(machine,offset,mem_mask);
163163   }
164164}
165165
r1877r1878
170170   if (!(offset & 0x0031))
171171   {
172172      offset = ((offset & 0x000e) >> 1) | ((offset & 0x1fc0) >> 3);
173      K053245_word_w(offset,data,mem_mask);
173      K053245_word_w(machine,offset,data,mem_mask);
174174   }
175175}
176176
r1877r1878
178178{
179179   offset &= ~1;   /* handle mirror address */
180180
181   return K053244_r(offset + 1) | (K053244_r(offset) << 8);
181   return K053244_r(machine,offset + 1) | (K053244_r(machine,offset) << 8);
182182}
183183
184184static WRITE16_HANDLER( K053244_word_noA1_w )
r1877r1878
186186   offset &= ~1;   /* handle mirror address */
187187
188188   if (ACCESSING_MSB)
189      K053244_w(offset,(data >> 8) & 0xff);
189      K053244_w(machine,offset,(data >> 8) & 0xff);
190190   if (ACCESSING_LSB)
191      K053244_w(offset + 1,data & 0xff);
191      K053244_w(machine,offset + 1,data & 0xff);
192192}
193193
194194static INTERRUPT_GEN(cuebrick_interrupt)
r1877r1878
224224static WRITE16_HANDLER( tmnt_sound_command_w )
225225{
226226   if (ACCESSING_LSB)
227      soundlatch_w(0,data & 0xff);
227      soundlatch_w(machine,0,data & 0xff);
228228}
229229
230230static READ16_HANDLER( punkshot_sound_r )
231231{
232232   /* If the sound CPU is running, read the status, otherwise
233233       just make it pass the test */
234   return K053260_0_r(2 + offset);
234   return K053260_0_r(machine,2 + offset);
235235}
236236
237237static READ16_HANDLER( blswhstl_sound_r )
238238{
239239   /* If the sound CPU is running, read the status, otherwise
240240       just make it pass the test */
241   return K053260_0_r(2 + offset);
241   return K053260_0_r(machine,2 + offset);
242242}
243243
244244static READ16_HANDLER( glfgreat_sound_r )
245245{
246246   /* If the sound CPU is running, read the status, otherwise
247247       just make it pass the test */
248   return K053260_0_r(2 + offset) << 8;
248   return K053260_0_r(machine,2 + offset) << 8;
249249}
250250
251251static WRITE16_HANDLER( glfgreat_sound_w )
252252{
253253   if (ACCESSING_MSB)
254      K053260_0_w(offset, (data >> 8) & 0xff);
254      K053260_0_w(machine, offset, (data >> 8) & 0xff);
255255
256256   if (offset)
257      cpunum_set_input_line_and_vector(Machine, 1,0,HOLD_LINE,0xff);
257      cpunum_set_input_line_and_vector(machine, 1,0,HOLD_LINE,0xff);
258258}
259259
260260static READ16_HANDLER( prmrsocr_sound_r )
261261{
262   return soundlatch3_r(0);
262   return soundlatch3_r(machine,0);
263263}
264264
265265static WRITE16_HANDLER( prmrsocr_sound_cmd_w )
r1877r1878
267267   if (ACCESSING_LSB)
268268   {
269269      data &= 0xff;
270      if (offset == 0) soundlatch_w(0,data);
271      else soundlatch2_w(0,data);
270      if (offset == 0) soundlatch_w(machine,0,data);
271      else soundlatch2_w(machine,0,data);
272272   }
273273}
274274
275275static WRITE16_HANDLER( prmrsocr_sound_irq_w )
276276{
277   cpunum_set_input_line_and_vector(Machine, 1,0,HOLD_LINE,0xff);
277   cpunum_set_input_line_and_vector(machine, 1,0,HOLD_LINE,0xff);
278278}
279279
280280static WRITE8_HANDLER( prmrsocr_audio_bankswitch_w )
r1877r1878
287287
288288static READ16_HANDLER( tmnt2_sound_r )
289289{
290   return K053260_0_r(2 + offset);
290   return K053260_0_r(machine, 2 + offset);
291291}
292292
293293static READ8_HANDLER( tmnt_sres_r )
r1877r1878
410410         data = -program_read_word(0x105818);
411411         data = ((data / 8 - 4) & 0x1f) * 0x40;
412412         data += ((program_read_word(0x105cb0) +
413                  256*K052109_r(0x1a01) + K052109_r(0x1a00) - 6) / 8 + 12) & 0x3f;
413                  256*K052109_r(machine,0x1a01) + K052109_r(machine,0x1a00) - 6) / 8 + 12) & 0x3f;
414414         return data;
415415
416416      default:
r1877r1878
436436         {
437437            if ((program_read_word(0x180006 + 128*i) >> 8) == logical_pri)
438438            {
439               K053245_word_w(8*i,hardware_pri,0xff00);
439               K053245_word_w(machine,8*i,hardware_pri,0xff00);
440440               hardware_pri++;
441441            }
442442         }
r1877r1878
491491
492492   /* bit 3 is service button */
493493   /* bit 6 is ??? VBLANK? OBJMPX? */
494   res = input_port_2_word_r(0,0);
494   res = input_port_2_word_r(machine,0,0);
495495   if (init_eeprom_count)
496496   {
497497      init_eeprom_count--;
r1877r1878
507507
508508   /* bit 0 is EEPROM data */
509509   /* bit 1 is EEPROM ready */
510   res = EEPROM_read_bit() | input_port_3_word_r(0,0);
510   res = EEPROM_read_bit() | input_port_3_word_r(machine,0,0);
511511   return res;
512512}
513513
r1877r1878
520520   /* bit 1 is EEPROM ready */
521521   /* bit 2 is VBLANK (???) */
522522   /* bit 7 is service button */
523   res = EEPROM_read_bit() | input_port_3_word_r(0,0);
523   res = EEPROM_read_bit() | input_port_3_word_r(machine,0,0);
524524   if (init_eeprom_count)
525525   {
526526      init_eeprom_count--;
r1877r1878
539539   /* bit 1 is EEPROM ready */
540540   /* bit 2 is VBLANK (???) */
541541   /* bit 3 is service button */
542   res = EEPROM_read_bit() | input_port_3_word_r(0,0);
542   res = EEPROM_read_bit() | input_port_3_word_r(machine,0,0);
543543   if (init_eeprom_count)
544544   {
545545      init_eeprom_count--;
r1877r1878
598598{
599599   int res;
600600
601   res = input_port_0_word_r(0,0);
601   res = input_port_0_word_r(machine,0,0);
602602   if (init_eeprom_count)
603603   {
604604      init_eeprom_count--;
r1877r1878
616616   /* bit 1 is EEPROM ready */
617617   /* bit 3 is VBLANK (???) */
618618   /* bit 7 is service button */
619   res = (EEPROM_read_bit() << 8) | input_port_1_word_r(0,0);
619   res = (EEPROM_read_bit() << 8) | input_port_1_word_r(machine,0,0);
620620   toggle ^= 0x0800;
621621   return (res ^ toggle);
622622}
r1877r1878
650650   /* bit 9 is service button */
651651   int res;
652652
653   res = input_port_0_word_r(0,0);
653   res = input_port_0_word_r(machine,0,0);
654654   if (init_eeprom_count)
655655   {
656656      init_eeprom_count--;
r1877r1878
663663{
664664   /* bit 8 is EEPROM data */
665665   /* bit 9 is EEPROM ready */
666   return (EEPROM_read_bit() << 8) | input_port_1_word_r(0,0);
666   return (EEPROM_read_bit() << 8) | input_port_1_word_r(machine,0,0);
667667}
668668
669669static WRITE16_HANDLER( prmrsocr_eeprom_w )
670670{
671671   if (ACCESSING_LSB)
672672   {
673      prmrsocr_122000_w(offset,data,mem_mask);
673      prmrsocr_122000_w(machine,offset,data,mem_mask);
674674   }
675675
676676   if (ACCESSING_MSB)
r1877r1878
686686
687687static READ16_HANDLER( cuebrick_snd_r )
688688{
689   return YM2151_status_port_0_r(0)<<8;
689   return YM2151_status_port_0_r(machine,0)<<8;
690690}
691691
692692static WRITE16_HANDLER( cuebrick_snd_w )
693693{
694694   if (offset)
695695   {
696      YM2151_data_port_0_w(0, data>>8);
696      YM2151_data_port_0_w(machine, 0, data>>8);
697697   }
698698   else
699699   {
700      YM2151_register_port_0_w(0, data>>8);
700      YM2151_register_port_0_w(machine, 0, data>>8);
701701   }
702702}
703703
r1877r1878
906906   return(0);
907907}
908908
909static void tmnt2_put_word(UINT32 addr, UINT16 data)
909static void tmnt2_put_word(running_machine *machine, UINT32 addr, UINT16 data)
910910{
911911   UINT32 offs;
912912   if (addr >= 0x180000/2 && addr <= 0x183fff/2)
r1877r1878
916916      if (!(offs & 0x0031))
917917      {
918918         offs = ((offs & 0x000e) >> 1) | ((offs & 0x1fc0) >> 3);
919         K053245_word_w(offs, data, 0);
919         K053245_word_w(machine, offs, data, 0);
920920      }
921921   }
922922   else if (addr >= 0x104000/2 && addr <= 0x107fff/2) sunset_104000[addr-0x104000/2] = data;
r1877r1878
10311031   xoffs += xmod;
10321032   yoffs += ymod;
10331033
1034   tmnt2_put_word(dst_addr +  0, attr1);
1035   tmnt2_put_word(dst_addr +  2, code);
1036   tmnt2_put_word(dst_addr +  4, (UINT32)yoffs);
1037   tmnt2_put_word(dst_addr +  6, (UINT32)xoffs);
1038   tmnt2_put_word(dst_addr + 12, attr2 | color);
1034   tmnt2_put_word(machine, dst_addr +  0, attr1);
1035   tmnt2_put_word(machine, dst_addr +  2, code);
1036   tmnt2_put_word(machine, dst_addr +  4, (UINT32)yoffs);
1037   tmnt2_put_word(machine, dst_addr +  6, (UINT32)xoffs);
1038   tmnt2_put_word(machine, dst_addr + 12, attr2 | color);
10391039}
10401040#else // for reference; do not remove
10411041static WRITE16_HANDLER( tmnt2_1c0800_w )
r1877r1878
12951295
12961296static READ8_HANDLER( K054539_0_ctrl_r )
12971297{
1298   return K054539_0_r(0x200+offset);
1298   return K054539_0_r(machine,0x200+offset);
12991299}
13001300static WRITE8_HANDLER( K054539_0_ctrl_w )
13011301{
1302   K054539_0_w(0x200+offset,data);
1302   K054539_0_w(machine,0x200+offset,data);
13031303}
13041304
13051305static ADDRESS_MAP_START( prmrsocr_audio_map, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
23292329   /* basic machine hardware */
23302330   MDRV_CPU_ADD(M68000, 8000000)   /* 8 MHz */
23312331   MDRV_CPU_PROGRAM_MAP(cuebrick_main_map,0)
2332   MDRV_CPU_VBLANK_INT(cuebrick_interrupt,10)
2332   MDRV_CPU_VBLANK_INT_HACK(cuebrick_interrupt,10)
23332333
23342334   /* video hardware */
23352335   MDRV_VIDEO_ATTRIBUTES(VIDEO_HAS_SHADOWS | VIDEO_HAS_HIGHLIGHTS | VIDEO_UPDATE_AFTER_VBLANK)
r1877r1878
23622362   /* basic machine hardware */
23632363   MDRV_CPU_ADD(M68000, XTAL_24MHz/3)
23642364   MDRV_CPU_PROGRAM_MAP(mia_main_map,0)
2365   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
2365   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)
23662366
23672367   MDRV_CPU_ADD(Z80, XTAL_3_579545MHz)
23682368   MDRV_CPU_PROGRAM_MAP(mia_audio_map,0)
r1877r1878
23992399static MACHINE_RESET( tmnt )
24002400{
24012401   /* the UPD7759 control flip-flops are cleared: /ST is 1, /RESET is 0 */
2402   upd7759_0_start_w(0, 0);
2403   upd7759_0_reset_w(0, 1);
2402   upd7759_0_start_w(machine, 0, 0);
2403   upd7759_0_reset_w(machine, 0, 1);
24042404}
24052405
24062406static MACHINE_DRIVER_START( tmnt )
r1877r1878
24082408   /* basic machine hardware */
24092409   MDRV_CPU_ADD(M68000, XTAL_24MHz/3)
24102410   MDRV_CPU_PROGRAM_MAP(tmnt_main_map,0)
2411   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
2411   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)
24122412
24132413   MDRV_CPU_ADD(Z80, XTAL_3_579545MHz)
24142414   MDRV_CPU_PROGRAM_MAP(tmnt_audio_map,0)
r1877r1878
24572457   /* basic machine hardware */
24582458   MDRV_CPU_ADD(M68000, XTAL_24MHz/2)
24592459   MDRV_CPU_PROGRAM_MAP(punkshot_main_map,0)
2460   MDRV_CPU_VBLANK_INT(punkshot_interrupt,1)
2460   MDRV_CPU_VBLANK_INT("main", punkshot_interrupt)
24612461
24622462   MDRV_CPU_ADD(Z80, XTAL_3_579545MHz)
24632463   MDRV_CPU_PROGRAM_MAP(punkshot_audio_map,0)
r1877r1878
24962496   /* basic machine hardware */
24972497   MDRV_CPU_ADD(M68000, XTAL_24MHz/2)
24982498   MDRV_CPU_PROGRAM_MAP(lgtnfght_main_map,0)
2499   MDRV_CPU_VBLANK_INT(lgtnfght_interrupt,1)
2499   MDRV_CPU_VBLANK_INT("main", lgtnfght_interrupt)
25002500
25012501   MDRV_CPU_ADD(Z80, XTAL_3_579545MHz)
25022502   MDRV_CPU_PROGRAM_MAP(lgtnfght_audio_map,0)
r1877r1878
25352535   /* basic machine hardware */
25362536   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
25372537   MDRV_CPU_PROGRAM_MAP(blswhstl_main_map,0)
2538   MDRV_CPU_VBLANK_INT(punkshot_interrupt,1)
2538   MDRV_CPU_VBLANK_INT("main", punkshot_interrupt)
25392539
25402540   MDRV_CPU_ADD(Z80, XTAL_3_579545MHz)
25412541   MDRV_CPU_PROGRAM_MAP(ssriders_audio_map,0)
r1877r1878
25952595   /* basic machine hardware */
25962596   MDRV_CPU_ADD(M68000, 12000000)   /* ? */
25972597   MDRV_CPU_PROGRAM_MAP(glfgreat_main_map,0)
2598   MDRV_CPU_VBLANK_INT(lgtnfght_interrupt,1)
2598   MDRV_CPU_VBLANK_INT("main", lgtnfght_interrupt)
25992599
26002600   MDRV_CPU_ADD(Z80, XTAL_3_579545MHz)
26012601   MDRV_CPU_PROGRAM_MAP(glfgreat_audio_map,0)
r1877r1878
26442644   /* basic machine hardware */
26452645   MDRV_CPU_ADD(M68000, 12000000)   /* ? */
26462646   MDRV_CPU_PROGRAM_MAP(prmrsocr_main_map,0)
2647   MDRV_CPU_VBLANK_INT(lgtnfght_interrupt,1)
2647   MDRV_CPU_VBLANK_INT("main", lgtnfght_interrupt)
26482648
26492649   MDRV_CPU_ADD(Z80, 8000000)
26502650   /* audio CPU */   /* ? */
r1877r1878
26842684   /* basic machine hardware */
26852685   MDRV_CPU_ADD(M68000, XTAL_32MHz/2)
26862686   MDRV_CPU_PROGRAM_MAP(tmnt2_main_map,0)
2687   MDRV_CPU_VBLANK_INT(punkshot_interrupt,1)
2687   MDRV_CPU_VBLANK_INT("main", punkshot_interrupt)
26882688
26892689   MDRV_CPU_ADD(Z80, 8000000)
26902690   /* audio CPU */   /* 8 MHz; clock is correct, but there's 1 cycle wait for ROM/RAM */
r1877r1878
27312731   /* basic machine hardware */
27322732   MDRV_CPU_ADD(M68000, XTAL_32MHz/2)
27332733   MDRV_CPU_PROGRAM_MAP(ssriders_main_map,0)
2734   MDRV_CPU_VBLANK_INT(punkshot_interrupt,1)
2734   MDRV_CPU_VBLANK_INT("main", punkshot_interrupt)
27352735
27362736   MDRV_CPU_ADD(Z80, 4000000)
27372737   /* audio CPU */   /* ????? makes the ROM test sync */
r1877r1878
27742774   /* basic machine hardware */
27752775   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
27762776   MDRV_CPU_PROGRAM_MAP(sunsetbl_main_map,0)
2777   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
2777   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
27782778
27792779   MDRV_NVRAM_HANDLER(eeprom)
27802780
r1877r1878
28072807   /* basic machine hardware */
28082808   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
28092809   MDRV_CPU_PROGRAM_MAP(thndrx2_main_map,0)
2810   MDRV_CPU_VBLANK_INT(punkshot_interrupt,1)
2810   MDRV_CPU_VBLANK_INT("main", punkshot_interrupt)
28112811
28122812   MDRV_CPU_ADD(Z80, XTAL_3_579545MHz)
28132813   MDRV_CPU_PROGRAM_MAP(thndrx2_audio_map,0)
src/mame/drivers/namcos12.c
r1877r1878
12081208static MACHINE_RESET( namcos12 )
12091209{
12101210   psx_machine_init();
1211   bankoffset_w(0,0,0);
1211   bankoffset_w(machine,0,0,0);
12121212
12131213   if( strcmp( machine->gamedrv->name, "tektagt" ) == 0 ||
12141214      strcmp( machine->gamedrv->name, "tektagta" ) == 0 ||
r1877r1878
14761476   /* basic machine hardware */
14771477   MDRV_CPU_ADD( PSXCPU, XTAL_100MHz )
14781478   MDRV_CPU_PROGRAM_MAP( namcos12_map, 0 )
1479   MDRV_CPU_VBLANK_INT( psx_vblank, 1 )
1479   MDRV_CPU_VBLANK_INT("main", psx_vblank)
14801480
14811481   MDRV_CPU_ADD(H83002, 14745600 )   /* verified 14.7456 MHz */
14821482   MDRV_CPU_PROGRAM_MAP( s12h8rwmap, 0 )
14831483   MDRV_CPU_IO_MAP( s12h8iomap, 0 )
1484   MDRV_CPU_VBLANK_INT( irq1_line_pulse, 1 )
1484   MDRV_CPU_VBLANK_INT("main", irq1_line_pulse)
14851485
14861486   MDRV_MACHINE_RESET( namcos12 )
14871487   MDRV_NVRAM_HANDLER( at28c16_0 )
src/mame/drivers/raiden2.c
r1877r1878
7575
7676/* SPRITE DRAWING (move to video file) */
7777
78static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect ,int pri_mask )
78static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ,int pri_mask )
7979{
8080   const UINT16 *source = spriteram16 + 0x1000/2 - 4;
8181   const UINT16 *finish = spriteram16;
r1877r1878
11811181   /* basic machine hardware */
11821182   MDRV_CPU_ADD(V30,XTAL_32MHz/2) /* verified on pcb */
11831183   MDRV_CPU_PROGRAM_MAP(raiden2_mem, 0)
1184   MDRV_CPU_VBLANK_INT(raiden2_interrupt,1)
1184   MDRV_CPU_VBLANK_INT("main", raiden2_interrupt)
11851185
11861186   MDRV_MACHINE_RESET(raiden2)
11871187
r1877r1878
20972097}
20982098static READ16_HANDLER( rdx_v33_oki_r )
20992099{
2100   return OKIM6295_status_0_r(0);
2100   return OKIM6295_status_0_r(machine,0);
21012101}
21022102
21032103static WRITE16_HANDLER( rdx_v33_oki_w )
21042104{
2105   if (ACCESSING_LSB) OKIM6295_data_0_w(0, data & 0x00ff);
2105   if (ACCESSING_LSB) OKIM6295_data_0_w(machine, 0, data & 0x00ff);
21062106   if (ACCESSING_MSB) logerror("rdx_v33_oki_w MSB %04x\n",data);
21072107}
21082108
r1877r1878
22372237   /* basic machine hardware */
22382238   MDRV_CPU_ADD(V33, 32000000/2 ) // ?
22392239   MDRV_CPU_PROGRAM_MAP(rdx_v33_map, 0)
2240   MDRV_CPU_VBLANK_INT(rdx_v33_interrupt,1)
2240   MDRV_CPU_VBLANK_INT("main", rdx_v33_interrupt)
22412241
22422242   MDRV_NVRAM_HANDLER(rdx_v33)
22432243
src/mame/drivers/zodiack.c
r1877r1878
1919***************************************************************************/
2020
2121#include "driver.h"
22#include "deprecat.h"
2223#include "sound/ay8910.h"
2324#include "includes/espial.h"
2425
r1877r1878
4849   /* Bit 2 - ???? */
4950}
5051
51static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
52   AM_RANGE(0x0000, 0x4fff) AM_READ(MRA8_ROM)
53   AM_RANGE(0x5800, 0x5fff) AM_READ(MRA8_RAM)
54   AM_RANGE(0x6081, 0x6081) AM_READ(input_port_0_r)
52
53static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
54   AM_RANGE(0x0000, 0x4fff) AM_ROM
55   AM_RANGE(0x5800, 0x5fff) AM_RAM
56   AM_RANGE(0x6081, 0x6081) AM_READWRITE(input_port_0_r, zodiack_control_w)
5557   AM_RANGE(0x6082, 0x6082) AM_READ(input_port_1_r)
5658   AM_RANGE(0x6083, 0x6083) AM_READ(input_port_2_r)
5759   AM_RANGE(0x6084, 0x6084) AM_READ(input_port_3_r)
58   AM_RANGE(0x6090, 0x6090) AM_READ(soundlatch_r)
59   AM_RANGE(0x7000, 0x7000) AM_READ(MRA8_NOP)  /* ??? */
60   AM_RANGE(0x9000, 0x93ff) AM_READ(MRA8_RAM)
61   AM_RANGE(0xa000, 0xa3ff) AM_READ(MRA8_RAM)
62   AM_RANGE(0xb000, 0xb3ff) AM_READ(MRA8_RAM)
63   AM_RANGE(0xc000, 0xcfff) AM_READ(MRA8_ROM)
64ADDRESS_MAP_END
65
66
67static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
68   AM_RANGE(0x0000, 0x4fff) AM_WRITE(MWA8_ROM)
69   AM_RANGE(0x5800, 0x5fff) AM_WRITE(MWA8_RAM)
70   AM_RANGE(0x6081, 0x6081) AM_WRITE(zodiack_control_w)
71   AM_RANGE(0x6090, 0x6090) AM_WRITE(zodiac_master_soundlatch_w)
72   AM_RANGE(0x7000, 0x7000) AM_WRITE(watchdog_reset_w)
60   AM_RANGE(0x6090, 0x6090) AM_READWRITE(soundlatch_r, zodiac_master_soundlatch_w)
61   AM_RANGE(0x7000, 0x7000) AM_READWRITE(MRA8_NOP,watchdog_reset_w)  /* NOP??? */
7362   AM_RANGE(0x7100, 0x7100) AM_WRITE(zodiac_master_interrupt_enable_w)
7463   AM_RANGE(0x7200, 0x7200) AM_WRITE(zodiack_flipscreen_w)
75   AM_RANGE(0x9000, 0x903f) AM_WRITE(zodiack_attributes_w) AM_BASE(&zodiack_attributesram)
76   AM_RANGE(0x9040, 0x905f) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
77   AM_RANGE(0x9060, 0x907f) AM_WRITE(MWA8_RAM) AM_BASE(&zodiack_bulletsram) AM_SIZE(&zodiack_bulletsram_size)
78   AM_RANGE(0x9080, 0x93ff) AM_WRITE(MWA8_RAM)
79   AM_RANGE(0xa000, 0xa3ff) AM_WRITE(zodiack_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size)
80   AM_RANGE(0xb000, 0xb3ff) AM_WRITE(zodiack_videoram2_w) AM_BASE(&zodiack_videoram2)
81   AM_RANGE(0xc000, 0xcfff) AM_WRITE(MWA8_ROM)
64   AM_RANGE(0x9000, 0x903f) AM_READWRITE(MRA8_RAM, zodiack_attributes_w) AM_BASE(&zodiack_attributesram)
65   AM_RANGE(0x9040, 0x905f) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
66   AM_RANGE(0x9060, 0x907f) AM_RAM AM_BASE(&zodiack_bulletsram) AM_SIZE(&zodiack_bulletsram_size)
67   AM_RANGE(0x9080, 0x93ff) AM_RAM
68   AM_RANGE(0xa000, 0xa3ff) AM_READWRITE(MRA8_RAM, zodiack_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size)
69   AM_RANGE(0xb000, 0xb3ff) AM_READWRITE(MRA8_RAM, zodiack_videoram2_w) AM_BASE(&zodiack_videoram2)
70   AM_RANGE(0xc000, 0xcfff) AM_ROM
8271ADDRESS_MAP_END
8372
84static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
85   AM_RANGE(0x0000, 0x1fff) AM_READ(MRA8_ROM)
86   AM_RANGE(0x2000, 0x23ff) AM_READ(MRA8_RAM)
87   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
88ADDRESS_MAP_END
89
90static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
91   AM_RANGE(0x0000, 0x1fff) AM_WRITE(MWA8_ROM)
92   AM_RANGE(0x2000, 0x23ff) AM_WRITE(MWA8_RAM)
73static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
74   AM_RANGE(0x0000, 0x1fff) AM_ROM
75   AM_RANGE(0x2000, 0x23ff) AM_RAM
9376   AM_RANGE(0x4000, 0x4000) AM_WRITE(espial_sound_nmi_enable_w)
94   AM_RANGE(0x6000, 0x6000) AM_WRITE(soundlatch_w)
77   AM_RANGE(0x6000, 0x6000) AM_READWRITE(soundlatch_r, soundlatch_w)
9578ADDRESS_MAP_END
9679
97static ADDRESS_MAP_START( sound_writeport, ADDRESS_SPACE_IO, 8 )
80static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
9881   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
9982   AM_RANGE(0x00, 0x00) AM_WRITE(AY8910_control_port_0_w)
10083   AM_RANGE(0x01, 0x01) AM_WRITE(AY8910_write_port_0_w)
r1877r1878
475458
476459   /* basic machine hardware */
477460   MDRV_CPU_ADD(Z80, 4000000)        /* 4.00 MHz??? */
478   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
479   MDRV_CPU_VBLANK_INT(zodiac_master_interrupt,2)
461   MDRV_CPU_PROGRAM_MAP(main_map,0)
462   MDRV_CPU_VBLANK_INT_HACK(zodiac_master_interrupt,2)
480463
481464   MDRV_CPU_ADD(Z80, 14318000/8)   /* 1.78975 MHz??? */
482   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
483   MDRV_CPU_IO_MAP(0,sound_writeport)
484   MDRV_CPU_VBLANK_INT(espial_sound_nmi_gen,8)   /* IRQs are triggered by the main CPU */
465   MDRV_CPU_PROGRAM_MAP(sound_map,0)
466   MDRV_CPU_IO_MAP(io_map,0)
467   MDRV_CPU_VBLANK_INT_HACK(espial_sound_nmi_gen,8)   /* IRQs are triggered by the main CPU */
485468
486469   MDRV_MACHINE_RESET(zodiack)
487470
src/mame/drivers/scramble.c
r1877r1878
212212
213213static READ8_HANDLER(mars_ppi8255_0_r)
214214{
215   return ppi8255_0_r(((offset >> 2) & 0x02) | ((offset >> 1) & 0x01));
215   return ppi8255_0_r(machine, ((offset >> 2) & 0x02) | ((offset >> 1) & 0x01));
216216}
217217
218218static READ8_HANDLER(mars_ppi8255_1_r)
219219{
220   return ppi8255_1_r(((offset >> 2) & 0x02) | ((offset >> 1) & 0x01));
220   return ppi8255_1_r(machine, ((offset >> 2) & 0x02) | ((offset >> 1) & 0x01));
221221}
222222
223223static WRITE8_HANDLER(mars_ppi8255_0_w)
224224{
225   ppi8255_0_w(((offset >> 2) & 0x02) | ((offset >> 1) & 0x01), data);
225   ppi8255_0_w(machine, ((offset >> 2) & 0x02) | ((offset >> 1) & 0x01), data);
226226}
227227
228228static WRITE8_HANDLER(mars_ppi8255_1_w)
229229{
230   ppi8255_1_w(((offset >> 2) & 0x02) | ((offset >> 1) & 0x01), data);
230   ppi8255_1_w(machine, ((offset >> 2) & 0x02) | ((offset >> 1) & 0x01), data);
231231}
232232
233233
r1877r1878
505505
506506static READ8_HANDLER(frogf_ppi8255_0_r)
507507{
508   return ppi8255_0_r(offset >> 3);
508   return ppi8255_0_r(machine, offset >> 3);
509509}
510510
511511static READ8_HANDLER(frogf_ppi8255_1_r)
512512{
513   return ppi8255_1_r(offset >> 3);
513   return ppi8255_1_r(machine, offset >> 3);
514514}
515515
516516static WRITE8_HANDLER(frogf_ppi8255_0_w)
517517{
518   ppi8255_0_w(offset >> 3, data);
518   ppi8255_0_w(machine, offset >> 3, data);
519519}
520520
521521static WRITE8_HANDLER(frogf_ppi8255_1_w)
522522{
523   ppi8255_1_w(offset >> 3, data);
523   ppi8255_1_w(machine, offset >> 3, data);
524524}
525525
526526static ADDRESS_MAP_START( frogf_map, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
24062406   MDRV_CPU_REPLACE("main", S2650, 18432000/6)
24072407   MDRV_CPU_PROGRAM_MAP(hunchbks_readmem,hunchbks_writemem)
24082408   MDRV_CPU_IO_MAP(hunchbks_readport,0)
2409   MDRV_CPU_VBLANK_INT(hunchbks_vh_interrupt,1)
2409   MDRV_CPU_VBLANK_INT("main", hunchbks_vh_interrupt)
24102410
24112411   MDRV_SCREEN_MODIFY("main")
24122412   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
src/mame/drivers/mogura.c
r1877r1878
9999
100100static WRITE8_HANDLER(dac_w)
101101{
102   DAC_0_data_w(0, data & 0xf0 );   /* left */
103   DAC_1_data_w(0, (data & 0x0f)<<4 );   /* right */
102   DAC_0_data_w(machine, 0, data & 0xf0 );   /* left */
103   DAC_1_data_w(machine, 0, (data & 0x0f)<<4 );   /* right */
104104}
105105
106106
r1877r1878
214214   MDRV_CPU_ADD(Z80,3000000)       /* 3 MHz */
215215   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
216216   MDRV_CPU_IO_MAP(readport,writeport)
217   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
217   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
218218
219219   MDRV_GFXDECODE(mogura)
220220
src/mame/drivers/mole.c
r1877r1878
197197   // basic machine hardware
198198   MDRV_CPU_ADD(M6502, 4000000) // ???
199199   MDRV_CPU_PROGRAM_MAP(mole_map, 0)
200   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
200   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
201201
202202   // video hardware
203203
src/mame/drivers/system18.c
r1877r1878
7575void fd1094_driver_init(void (*set_decrypted)(UINT8 *));
7676
7777/* video/segac2.c */
78extern void update_system18_vdp( mame_bitmap *bitmap, const rectangle *cliprect );
78extern void update_system18_vdp( bitmap_t *bitmap, const rectangle *cliprect );
7979extern void start_system18_vdp(void);
8080extern READ16_HANDLER( segac2_vdp_r );
8181extern WRITE16_HANDLER( segac2_vdp_w );
r1877r1878
195195
196196static WRITE16_HANDLER( sound_command_irq_w ){
197197   if( ACCESSING_LSB ){
198      soundlatch_w( 0,data&0xff );
199      cpunum_set_input_line(Machine, 1, 0, HOLD_LINE );
198      soundlatch_w( machine,0,data&0xff );
199      cpunum_set_input_line(machine, 1, 0, HOLD_LINE );
200200   }
201201}
202202
r1877r1878
339339
340340static WRITE16_HANDLER( sound_command_nmi_w ){
341341   if( ACCESSING_LSB ){
342      soundlatch_w( 0,data&0xff );
343      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
342      soundlatch_w( machine,0,data&0xff );
343      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
344344   }
345345}
346346
r1877r1878
11191119
11201120   /* basic machine hardware */
11211121   MDRV_CPU_ADD_TAG("main", M68000, 10000000)
1122   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
1122   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
11231123
11241124   MDRV_CPU_ADD_TAG("sound", Z80, 8000000)
11251125   /* audio CPU */
src/mame/drivers/taitojc.c
r1877r1878
10811081
10821082/*****************************************************************************/
10831083
1084#ifdef UNUSED_DEFINITION
10841085static INPUT_PORTS_START( taitojc )
10851086   PORT_START
10861087      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_COIN4)
r1877r1878
11141115      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON8)
11151116
11161117INPUT_PORTS_END
1118#endif
11171119
11181120static INPUT_PORTS_START( dendeg )
11191121   PORT_START
r1877r1878
12711273static MACHINE_DRIVER_START( taitojc )
12721274   MDRV_CPU_ADD(M68040, 25000000)
12731275   MDRV_CPU_PROGRAM_MAP(taitojc_map, 0)
1274   MDRV_CPU_VBLANK_INT(taitojc_vblank, 1)
1276   MDRV_CPU_VBLANK_INT("main", taitojc_vblank)
12751277   MDRV_CPU_PERIODIC_INT(taitojc_int6, 1000)
12761278
12771279   TAITO_F3_SOUND_SYSTEM_CPU(16000000)
src/mame/drivers/missb2.c
r1877r1878
368368   // basic machine hardware
369369   MDRV_CPU_ADD(Z80, MAIN_XTAL/4)   // 6 MHz
370370   MDRV_CPU_PROGRAM_MAP(master_map, 0)
371   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
371   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
372372
373373   MDRV_CPU_ADD(Z80, MAIN_XTAL/4)   // 6 MHz
374374   MDRV_CPU_PROGRAM_MAP(slave_map, 0)
375   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
375   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
376376
377377   MDRV_CPU_ADD(Z80, MAIN_XTAL/8)
378378   /* audio CPU */   // 3 MHz
379379   MDRV_CPU_PROGRAM_MAP(sound_map, 0)
380//  MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
381   MDRV_CPU_VBLANK_INT(missb2_interrupt, 1)
380//  MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
381   MDRV_CPU_VBLANK_INT("main", missb2_interrupt)
382382
383383   MDRV_INTERLEAVE(100) // 100 CPU slices per frame - a high value to ensure proper synchronization of the CPUs
384384
src/mame/drivers/pitnrun.c
r1877r1878
286286static MACHINE_DRIVER_START( pitnrun )
287287   MDRV_CPU_ADD(Z80,8000000/2)       /* ? MHz */
288288   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
289   MDRV_CPU_VBLANK_INT(pitnrun_nmi_source,1)
289   MDRV_CPU_VBLANK_INT("main", pitnrun_nmi_source)
290290
291291   MDRV_CPU_ADD(Z80, 10000000/4)     /* 2.5 MHz */
292292
293293   /* audio CPU */
294294   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
295295   MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
296   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
296   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
297297
298298   MDRV_CPU_ADD(M68705,3000000)
299299   MDRV_CPU_PROGRAM_MAP(mcu_readmem,mcu_writemem)
r1877r1878
319319   /* sound hardware */
320320   MDRV_SPEAKER_STANDARD_MONO("mono")
321321
322   MDRV_SOUND_ADD(AY8910, 18432000/12)
322   MDRV_SOUND_ADD(AY8910, XTAL_18_432MHz/12)       /* verified on pcb */
323323   MDRV_SOUND_CONFIG(ay8910_interface)
324324   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
325325
326   MDRV_SOUND_ADD(AY8910, 18432000/12)
326   MDRV_SOUND_ADD(AY8910, XTAL_18_432MHz/12)       /* verified on pcb */
327327   MDRV_SOUND_CONFIG(ay8910_interface)
328328   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
329329MACHINE_DRIVER_END
src/mame/drivers/ddealer.c
r1877r1878
189189static MACHINE_DRIVER_START( ddealer )
190190   MDRV_CPU_ADD_TAG("main" , M68000, 10000000)
191191   MDRV_CPU_PROGRAM_MAP(ddealer,0)
192   MDRV_CPU_VBLANK_INT(ddealer_interrupt,1)
192   MDRV_CPU_VBLANK_INT("main", ddealer_interrupt)
193193   MDRV_CPU_PERIODIC_INT(irq1_line_hold, 112)
194194
195195   MDRV_GFXDECODE(jalmah)
src/mame/drivers/liberatr.c
r1877r1878
134134******************************************************************************************/
135135
136136#include "driver.h"
137#include "deprecat.h"
137138#include "machine/atari_vg.h"
138139#include "sound/pokey.h"
139140#include "liberatr.h"
r1877r1878
383384   /* basic machine hardware */
384385   MDRV_CPU_ADD_TAG("main", M6502, MASTER_CLOCK/16) /* 1.25Mhz divided from 20Mhz master clock */
385386   MDRV_CPU_PROGRAM_MAP(liberatr_map,0)
386   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)
387   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)
387388
388389   MDRV_NVRAM_HANDLER(atari_vg)
389390
src/mame/drivers/berzerk.c
r1877r1878
521521
522522   /* offset 6 writes to the sfxcontrol latch */
523523   case 6:
524      exidy_sfxctrl_w(data >> 6, data);
524      exidy_sfxctrl_w(machine, data >> 6, data);
525525      break;
526526
527527   /* everything else writes to the 6840 */
528528   default:
529      exidy_sh6840_w(offset, data);
529      exidy_sh6840_w(machine, offset, data);
530530      break;
531531
532532   }
r1877r1878
543543static SOUND_RESET(berzerk)
544544{
545545   /* clears the flip-flop controlling the volume and freq on the speech chip */
546   berzerk_audio_w(4, 0x40);
546   berzerk_audio_w(machine, 4, 0x40);
547547}
548548
549549
src/mame/drivers/tehkanwc.c
r1877r1878
165165
166166static WRITE8_HANDLER( sound_command_w )
167167{
168   soundlatch_w(offset,data);
169   cpunum_set_input_line(Machine, 2,INPUT_LINE_NMI,PULSE_LINE);
168   soundlatch_w(machine,offset,data);
169   cpunum_set_input_line(machine, 2,INPUT_LINE_NMI,PULSE_LINE);
170170}
171171
172172static TIMER_CALLBACK( reset_callback )
r1877r1878
176176
177177static WRITE8_HANDLER( sound_answer_w )
178178{
179   soundlatch2_w(0,data);
179   soundlatch2_w(machine,0,data);
180180
181181   /* in Gridiron, the sound CPU goes in a tight loop after the self test, */
182182   /* probably waiting to be reset by a watchdog */
r1877r1878
661661   /* basic machine hardware */
662662   MDRV_CPU_ADD_TAG("main", Z80, 18432000/4)   /* 18.432000 / 4 */
663663   MDRV_CPU_PROGRAM_MAP(main_mem,0)
664   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
664   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
665665
666666   MDRV_CPU_ADD(Z80, 18432000/4)
667667   MDRV_CPU_PROGRAM_MAP(sub_mem,0)
668   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
668   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
669669
670670   MDRV_CPU_ADD(Z80, 18432000/4)
671671   MDRV_CPU_PROGRAM_MAP(sound_mem,0)
672672   MDRV_CPU_IO_MAP(sound_port,0)
673   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
673   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
674674
675675   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame - seems enough to keep the CPUs in sync */
676676
src/mame/drivers/bionicc.c
r1877r1878
112112static WRITE16_HANDLER( hacked_soundcommand_w )
113113{
114114   COMBINE_DATA(&soundcommand);
115   soundlatch_w(0,soundcommand & 0xff);
115   soundlatch_w(machine,0,soundcommand & 0xff);
116116}
117117
118118static READ16_HANDLER( hacked_soundcommand_r )
r1877r1878
347347   /* basic machine hardware */
348348   MDRV_CPU_ADD(M68000, MASTER_CLOCK / 2) /* 12 MHz - verified in schematics */
349349   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
350   MDRV_CPU_VBLANK_INT(bionicc_interrupt,8)
350   MDRV_CPU_VBLANK_INT_HACK(bionicc_interrupt,8)
351351
352352   /* audio CPU */
353353   MDRV_CPU_ADD(Z80, EXO3_F0_CLK / 4)   /* EXO3 C,B=GND, A=5V ==> Divisor 2^2 */
r1877r1878
356356     * schematics indicate that nmi_line is set on  M680000 access with AB1=1
357357     * and IOCS=0 (active low), see pages A-1/10, A-4/10 in schematics
358358     */
359   MDRV_CPU_VBLANK_INT(nmi_line_pulse,4)
359   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,4)
360360
361361   /* video hardware */
362362   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
src/mame/drivers/citycon.c
r1877r1878
209209   /* basic machine hardware */
210210   MDRV_CPU_ADD(M6809, 2048000)        /* 2.048 MHz ??? */
211211   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
212   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
212   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
213213
214214   MDRV_CPU_ADD(M6809, 640000)
215215   /* audio CPU */        /* 0.640 MHz ??? */
216216   MDRV_CPU_PROGRAM_MAP(readmem_sound,writemem_sound)
217   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
217   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
218218
219219   /* video hardware */
220220   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/suprridr.c
r1877r1878
355355   MDRV_CPU_ADD(Z80, 10000000/4)      /* just a guess */
356356   MDRV_CPU_PROGRAM_MAP(main_map,0)
357357   MDRV_CPU_IO_MAP(main_portmap,0)
358   MDRV_CPU_VBLANK_INT(main_nmi_gen,1)
358   MDRV_CPU_VBLANK_INT("main", main_nmi_gen)
359359
360360   MDRV_CPU_ADD(Z80, 10000000/4)      /* just a guess */
361361   /* audio CPU */
src/mame/drivers/spy.c
r1877r1878
6868{
6969   if (rambank & 1)
7070   {
71      paletteram_xBBBBBGGGGGRRRRR_be_w(offset,data);
71      paletteram_xBBBBBGGGGGRRRRR_be_w(machine,offset,data);
7272   }
7373   else if (rambank & 2)
7474   {
r1877r1878
538538   /* basic machine hardware */
539539   MDRV_CPU_ADD(M6809, 3000000) /* ? */
540540   MDRV_CPU_PROGRAM_MAP(spy_readmem,spy_writemem)
541   MDRV_CPU_VBLANK_INT(spy_interrupt,1)
541   MDRV_CPU_VBLANK_INT("main", spy_interrupt)
542542
543543   MDRV_CPU_ADD(Z80, 3579545)
544544   /* audio CPU */
src/mame/drivers/psikyo.c
r1877r1878
311311   switch(offset)
312312   {
313313      case 0x0:   return (readinputport(0) << 16) | psikyo_readcoinport(1);
314      case 0x1:   return (((readinputport(2) << 16) | readinputport(3)) & 0xffff000f) | s1945_mcu_r(offset-1, mem_mask);
315      case 0x2:   return s1945_mcu_r(offset-1, mem_mask);
314      case 0x1:   return (((readinputport(2) << 16) | readinputport(3)) & 0xffff000f) | s1945_mcu_r(machine, offset-1, mem_mask);
315      case 0x2:   return s1945_mcu_r(machine, offset-1, mem_mask);
316316      default:   logerror("PC %06X - Read input %02X !\n", activecpu_get_pc(), offset*2);
317317               return 0;
318318   }
r1877r1878
331331{
332332   paletteram16 = (UINT16 *)paletteram32;
333333   if (ACCESSING_MSW32)
334      paletteram16_xRRRRRGGGGGBBBBB_word_w(offset*2, data >> 16, mem_mask >> 16);
334      paletteram16_xRRRRRGGGGGBBBBB_word_w(machine, offset*2, data >> 16, mem_mask >> 16);
335335   if (ACCESSING_LSW32)
336      paletteram16_xRRRRRGGGGGBBBBB_word_w(offset*2+1, data, mem_mask);
336      paletteram16_xRRRRRGGGGGBBBBB_word_w(machine, offset*2+1, data, mem_mask);
337337}
338338
339339static ADDRESS_MAP_START( psikyo_readmem, ADDRESS_SPACE_PROGRAM, 32 )
r1877r1878
15651565   /* basic machine hardware */
15661566   MDRV_CPU_ADD(M68EC020, 16000000)
15671567   MDRV_CPU_PROGRAM_MAP(psikyo_readmem,psikyo_writemem)
1568   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
1568   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
15691569
15701570   MDRV_CPU_ADD(Z80, 4000000)
15711571   /* audio CPU */   /* ? */
r1877r1878
16191619   /* basic machine hardware */
16201620   MDRV_CPU_ADD(M68EC020, 16000000)
16211621   MDRV_CPU_PROGRAM_MAP(psikyo_readmem,psikyo_writemem)
1622   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
1622   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
16231623
16241624   MDRV_CPU_ADD(Z80, 4000000)   /* ! LZ8420M (Z80 core) ! */
16251625   /* audio CPU */
r1877r1878
16811681   /* basic machine hardware */
16821682   MDRV_CPU_ADD(M68EC020, 16000000)
16831683   MDRV_CPU_PROGRAM_MAP(psikyo_readmem,psikyo_writemem)
1684   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
1684   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
16851685
16861686   MDRV_CPU_ADD(Z80, 4000000)   /* ! LZ8420M (Z80 core) ! */
16871687   /* audio CPU */
src/mame/drivers/ampoker2.c
r1877r1878
496496   /* watchdog sometimes stop to work */
497497   if (( (data >> 3) & 0x01) == 0)      /* check for refresh value (0x08h) */
498498   {
499      watchdog_reset_w(0,0);
499      watchdog_reset(machine);
500500//      fprintf(stdout,"Watchdog\n");
501501   }
502502}
src/mame/drivers/dynadice.c
r1877r1878
6060    D3 - /Reset
6161
6262*/
63   if ((data &7)==7) AY8910_control_port_0_w(0,ay_data);
64   if ((data &7)==6) AY8910_write_port_0_w(0,ay_data);
63   if ((data &7)==7) AY8910_control_port_0_w(machine,0,ay_data);
64   if ((data &7)==6) AY8910_write_port_0_w(machine,0,ay_data);
6565}
6666
6767
src/mame/drivers/playmark.c
r1877r1878
137137
138138   bit = EEPROM_read_bit() << 7;
139139
140   return (input_port_0_r(0) & 0x7f) | bit;
140   return (input_port_0_r(machine,0) & 0x7f) | bit;
141141}
142142
143143static READ16_HANDLER( hotmind_port2_r )
r1877r1878
146146
147147   bit = EEPROM_read_bit() << 7;
148148
149   return (input_port_2_r(0) & 0x7f) | bit;
149   return (input_port_2_r(machine,0) & 0x7f) | bit;
150150}
151151
152152static WRITE16_HANDLER( wbeachvl_coin_eeprom_w )
r1877r1878
202202//      logerror("PortB reading %02x from the 68K\n",data);
203203   }
204204   else if ((playmark_oki_control & 0x38) == 0x28) {
205      data = (OKIM6295_status_0_r(0) & 0x0f);
205      data = (OKIM6295_status_0_r(machine,0) & 0x0f);
206206//      logerror("PortB reading %02x from the OKI status port\n",data);
207207   }
208208
r1877r1878
255255        1   Not used
256256        0   Not used
257257    */
258
259258   playmark_oki_control = data;
260259
261260   if ((data & 0x38) == 0x18)
262261   {
263262//      logerror("Writing %02x to OKI1, PortC=%02x, Code=%02x\n",playmark_oki_command,playmark_oki_control,playmark_snd_command);
264      OKIM6295_data_0_w(0, playmark_oki_command);
263      OKIM6295_data_0_w(machine, 0, playmark_oki_command);
265264   }
266265}
267266
r1877r1878
970969   /* basic machine hardware */
971970   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
972971   MDRV_CPU_PROGRAM_MAP(bigtwin_main_map, 0)
973   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
972   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
974973
975974   MDRV_CPU_ADD(PIC16C57, 12000000)   /* 3MHz */
976975   /* Program and Data Maps are internal to the MCU */
r1877r1878
10041003   /* basic machine hardware */
10051004   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
10061005   MDRV_CPU_PROGRAM_MAP(wbeachvl_main_map, 0)
1007   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
1006   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
10081007
10091008//  MDRV_CPU_ADD(PIC16C57, 12000000)   /* 3MHz */
10101009   /* Program and Data Maps are internal to the MCU */
r1877r1878
10391038   /* basic machine hardware */
10401039   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
10411040   MDRV_CPU_PROGRAM_MAP(excelsr_main_map, 0)
1042   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
1041   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
10431042
10441043   MDRV_CPU_ADD(PIC16C57, 12000000)   /* 3MHz */
10451044   /* Program and Data Maps are internal to the MCU */
r1877r1878
10721071   /* basic machine hardware */
10731072   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
10741073   MDRV_CPU_PROGRAM_MAP(hotmind_main_map, 0)
1075   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
1074   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
10761075
10771076   MDRV_CPU_ADD(PIC16C57, 12000000)   /* 3MHz */
10781077   /* Program and Data Maps are internal to the MCU */
r1877r1878
11071106   /* basic machine hardware */
11081107   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
11091108   MDRV_CPU_PROGRAM_MAP(hrdtimes_main_map, 0)
1110   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
1109   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
11111110
11121111//  MDRV_CPU_ADD(PIC16C57, 12000000)   /* 3MHz */
11131112   /* Program and Data Maps are internal to the MCU */
r1877r1878
11301129   /* sound hardware */
11311130   MDRV_SPEAKER_STANDARD_MONO("mono")
11321131
1133   MDRV_SOUND_ADD(OKIM6295, 1000000)
1134   MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high)
1132   MDRV_SOUND_ADD(OKIM6295, XTAL_1MHz) /* verified on pcb */
1133   MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) /* verified on pcb */
11351134   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
11361135MACHINE_DRIVER_END
11371136
src/mame/drivers/dacholer.c
r1877r1878
261261   tilemap_set_transparent_pen(fg_tilemap,0);
262262}
263263
264static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
264static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
265265{
266266   int offs,code,attr,sx,sy,flipx,flipy;
267267
r1877r1878
337337   MDRV_CPU_ADD(Z80, 4000000)   /* ? */
338338   MDRV_CPU_PROGRAM_MAP(main_map, 0)
339339   MDRV_CPU_IO_MAP(main_io_map, 0)
340   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
340   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
341341
342342   MDRV_CPU_ADD(Z80, 4000000)   /* ? */
343343   MDRV_CPU_PROGRAM_MAP(snd_map, 0)
src/mame/drivers/esd16.c
r1877r1878
7070{
7171   if (ACCESSING_LSB)
7272   {
73      soundlatch_w(0,data & 0xff);
74      cpunum_set_input_line(Machine, 1,0,ASSERT_LINE);      // Generate an IRQ
73      soundlatch_w(machine,0,data & 0xff);
74      cpunum_set_input_line(machine, 1,0,ASSERT_LINE);      // Generate an IRQ
7575      cpu_spinuntil_time(ATTOTIME_IN_USEC(50));   // Allow the other CPU to reply
7676   }
7777}
r1877r1878
286286static READ8_HANDLER( esd16_sound_command_r )
287287{
288288   /* Clear IRQ only after reading the command, or some get lost */
289   cpunum_set_input_line(Machine, 1,0,CLEAR_LINE);
290   return soundlatch_r(0);
289   cpunum_set_input_line(machine, 1,0,CLEAR_LINE);
290   return soundlatch_r(machine,0);
291291}
292292
293293static ADDRESS_MAP_START( multchmp_sound_readport, ADDRESS_SPACE_IO, 8 )
r1877r1878
528528   /* basic machine hardware */
529529   MDRV_CPU_ADD_TAG("main",M68000, 16000000)
530530   MDRV_CPU_PROGRAM_MAP(multchmp_readmem,multchmp_writemem)
531   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
531   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
532532
533533   MDRV_CPU_ADD(Z80, 4000000)
534534   /* audio CPU */   /* ? */
535535   MDRV_CPU_PROGRAM_MAP(multchmp_sound_readmem,multchmp_sound_writemem)
536536   MDRV_CPU_IO_MAP(multchmp_sound_readport,multchmp_sound_writeport)
537   MDRV_CPU_VBLANK_INT(nmi_line_pulse,32)   /* IRQ By Main CPU */
537   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,32)   /* IRQ By Main CPU */
538538
539539   /* video hardware */
540540   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/model3.c
r1877r1878
12871287{
12881288   UINT64 r = 0;
12891289   if(!(mem_mask & U64(0xff00000000000000))) {
1290      r |= (UINT64)rtc72421_r((offset*2)+0, (UINT32)(mem_mask >> 32)) << 32;
1290      r |= (UINT64)rtc72421_r(machine, (offset*2)+0, (UINT32)(mem_mask >> 32)) << 32;
12911291   }
12921292   if(!(mem_mask & U64(0x00000000ff000000))) {
1293      r |= (UINT64)rtc72421_r((offset*2)+1, (UINT32)(mem_mask));
1293      r |= (UINT64)rtc72421_r(machine, (offset*2)+1, (UINT32)(mem_mask));
12941294   }
12951295   return r;
12961296}
r1877r1878
12981298static WRITE64_HANDLER( model3_rtc_w )
12991299{
13001300   if(!(mem_mask & U64(0xff00000000000000))) {
1301      rtc72421_w((offset*2)+0, (UINT32)(data >> 32), (UINT32)(mem_mask >> 32));
1301      rtc72421_w(machine, (offset*2)+0, (UINT32)(data >> 32), (UINT32)(mem_mask >> 32));
13021302   }
13031303   if(!(mem_mask & U64(0x00000000ff000000))) {
1304      rtc72421_w((offset*2)+1, (UINT32)(data), (UINT32)(mem_mask));
1304      rtc72421_w(machine, (offset*2)+1, (UINT32)(data), (UINT32)(mem_mask));
13051305   }
13061306}
13071307
r1877r1878
13251325   // serial configuration writes
13261326   if ((mem_mask == U64(0x00ffffffffffffff)) && (offset == 0))
13271327   {
1328      SCSP_MidiIn(0, (data>>56)&0xff, 0);
1328      SCSP_MidiIn(machine, 0, (data>>56)&0xff, 0);
13291329
13301330      // give the 68k time to notice
13311331      cpu_spinuntil_time(ATTOTIME_IN_USEC(40));
r1877r1878
40834083   MDRV_CPU_ADD(PPC603, 66000000)
40844084   MDRV_CPU_CONFIG(model3_10)
40854085   MDRV_CPU_PROGRAM_MAP(model3_mem, 0)
4086    MDRV_CPU_VBLANK_INT(model3_interrupt,2)
4086    MDRV_CPU_VBLANK_INT_HACK(model3_interrupt,2)
40874087
40884088   MDRV_CPU_ADD(M68000, 12000000)
40894089   MDRV_CPU_PROGRAM_MAP(model3_snd, 0)
r1877r1878
41224122   MDRV_CPU_ADD(PPC603, 100000000)
41234123   MDRV_CPU_CONFIG(model3_15)
41244124   MDRV_CPU_PROGRAM_MAP(model3_mem, 0)
4125    MDRV_CPU_VBLANK_INT(model3_interrupt,2)
4125    MDRV_CPU_VBLANK_INT_HACK(model3_interrupt,2)
41264126
41274127   MDRV_CPU_ADD(M68000, 12000000)
41284128   MDRV_CPU_PROGRAM_MAP(model3_snd, 0)
r1877r1878
41594159   MDRV_CPU_ADD(PPC603, 166000000)
41604160   MDRV_CPU_CONFIG(model3_2x)
41614161   MDRV_CPU_PROGRAM_MAP(model3_mem, 0)
4162    MDRV_CPU_VBLANK_INT(model3_interrupt,2)
4162    MDRV_CPU_VBLANK_INT_HACK(model3_interrupt,2)
41634163
41644164   MDRV_CPU_ADD(M68000, 12000000)
41654165   MDRV_CPU_PROGRAM_MAP(model3_snd, 0)
r1877r1878
41954195   MDRV_CPU_ADD(PPC603, 166000000)
41964196   MDRV_CPU_CONFIG(model3_2x)
41974197   MDRV_CPU_PROGRAM_MAP(model3_mem, 0)
4198    MDRV_CPU_VBLANK_INT(model3_interrupt,2)
4198    MDRV_CPU_VBLANK_INT_HACK(model3_interrupt,2)
41994199
42004200   MDRV_CPU_ADD(M68000, 12000000)
42014201   MDRV_CPU_PROGRAM_MAP(model3_snd, 0)
src/mame/drivers/namcos21.c
r1877r1878
15181518static MACHINE_DRIVER_START( s21base )
15191519   MDRV_CPU_ADD(M68000,12288000) /* Master */
15201520   MDRV_CPU_PROGRAM_MAP(namcos21_68k_master, namcos21_68k_common)
1521   MDRV_CPU_VBLANK_INT(namcos2_68k_master_vblank,1)
1521   MDRV_CPU_VBLANK_INT("main", namcos2_68k_master_vblank)
15221522
15231523   MDRV_CPU_ADD(M68000,12288000) /* Slave */
15241524   MDRV_CPU_PROGRAM_MAP(namcos21_68k_slave, namcos21_68k_common)
1525   MDRV_CPU_VBLANK_INT(namcos2_68k_slave_vblank,1)
1525   MDRV_CPU_VBLANK_INT("main", namcos2_68k_slave_vblank)
15261526
15271527   MDRV_CPU_ADD(M6809,3072000) /* Sound */
15281528   MDRV_CPU_PROGRAM_MAP(readmem_sound,writemem_sound)
1529   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
1529   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
15301530   MDRV_CPU_PERIODIC_INT(irq1_line_hold,120)
15311531
15321532   MDRV_CPU_ADD(HD63705,2048000) /* IO */
15331533   MDRV_CPU_PROGRAM_MAP(readmem_mcu,writemem_mcu)
1534   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1534   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
15351535
15361536   MDRV_CPU_ADD(TMS32025,24000000) /* 24 MHz? overclocked */
15371537   MDRV_CPU_PROGRAM_MAP(master_dsp_program,0)
r1877r1878
15971597static MACHINE_DRIVER_START( driveyes )
15981598   MDRV_CPU_ADD(M68000,12288000) /* Master */
15991599   MDRV_CPU_PROGRAM_MAP(driveyes_68k_master, driveyes_68k_common)
1600   MDRV_CPU_VBLANK_INT(namcos2_68k_master_vblank,1)
1600   MDRV_CPU_VBLANK_INT("main", namcos2_68k_master_vblank)
16011601
16021602   MDRV_CPU_ADD(M68000,12288000) /* Slave */
16031603   MDRV_CPU_PROGRAM_MAP(driveyes_68k_slave, driveyes_68k_common)
1604   MDRV_CPU_VBLANK_INT(namcos2_68k_slave_vblank,1)
1604   MDRV_CPU_VBLANK_INT("main", namcos2_68k_slave_vblank)
16051605
16061606   MDRV_CPU_ADD(M6809,3072000) /* Sound */
16071607   MDRV_CPU_PROGRAM_MAP(readmem_sound,writemem_sound)
1608   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
1608   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
16091609   MDRV_CPU_PERIODIC_INT(irq1_line_hold,120)
16101610
16111611   MDRV_CPU_ADD(HD63705,2048000) /* IO */
16121612   MDRV_CPU_PROGRAM_MAP(readmem_mcu,writemem_mcu)
1613   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1613   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
16141614
16151615   MDRV_CPU_ADD(TMS32025,24000000*2) /* 24 MHz? overclocked */
16161616   MDRV_CPU_PROGRAM_MAP(winrun_dsp_program,0)
r1877r1878
16521652static MACHINE_DRIVER_START( winrun_c140_typeB )
16531653   MDRV_CPU_ADD(M68000,12288000) /* Master */
16541654   MDRV_CPU_PROGRAM_MAP(am_master_winrun,0)
1655   MDRV_CPU_VBLANK_INT(namcos2_68k_master_vblank,1)
1655   MDRV_CPU_VBLANK_INT("main", namcos2_68k_master_vblank)
16561656
16571657   MDRV_CPU_ADD(M68000,12288000) /* Slave */
16581658   MDRV_CPU_PROGRAM_MAP(am_slave_winrun,0)
1659   MDRV_CPU_VBLANK_INT(namcos2_68k_slave_vblank,1)
1659   MDRV_CPU_VBLANK_INT("main", namcos2_68k_slave_vblank)
16601660
16611661   MDRV_CPU_ADD(M6809,3072000) /* Sound */
16621662   MDRV_CPU_PROGRAM_MAP(readmem_sound,writemem_sound)
1663   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
1663   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
16641664   MDRV_CPU_PERIODIC_INT(irq1_line_hold,120)
16651665
16661666   MDRV_CPU_ADD(HD63705,2048000) /* IO */
16671667   MDRV_CPU_PROGRAM_MAP(readmem_mcu,writemem_mcu)
1668   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1668   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
16691669
16701670   MDRV_CPU_ADD(TMS32025,24000000) /* 24 MHz? overclocked */
16711671   MDRV_CPU_PROGRAM_MAP(winrun_dsp_program,0)
r1877r1878
16741674
16751675   MDRV_CPU_ADD(M68000,12288000) /* graphics coprocessor */
16761676   MDRV_CPU_PROGRAM_MAP(am_gpu_winrun,0)
1677   MDRV_CPU_VBLANK_INT(namcos2_68k_gpu_vblank,1)
1677   MDRV_CPU_VBLANK_INT("main", namcos2_68k_gpu_vblank)
16781678
16791679   MDRV_INTERLEAVE(100) /* 100 CPU slices per frame */
16801680
src/mame/drivers/pgm.c
r1877r1878
445445{
446446   if(ACCESSING_LSB) {
447447      if (PGMLOGERROR) logerror("SL 1 m68.w %02x (%06x) IRQ\n", data & 0xff, activecpu_get_pc());
448      soundlatch_w(0, data);
449      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE );
448      soundlatch_w(machine, 0, data);
449      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE );
450450   }
451451}
452452
453453static WRITE8_HANDLER( z80_l3_w )
454454{
455455   if (PGMLOGERROR) logerror("SL 3 z80.w %02x (%04x)\n", data, activecpu_get_pc());
456   soundlatch3_w(0, data);
456   soundlatch3_w(machine, 0, data);
457457}
458458
459459static void sound_irq(int level)
r1877r1878
15591559   /* basic machine hardware */
15601560   MDRV_CPU_ADD_TAG("main", M68000, 20000000) /* 20 mhz! verified on real board */
15611561   MDRV_CPU_PROGRAM_MAP(pgm_mem,0)
1562   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
1562   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
15631563
15641564   MDRV_CPU_ADD_TAG("sound", Z80, 8468000)
15651565   MDRV_CPU_PROGRAM_MAP(z80_mem, 0)
r1877r1878
15931593   MDRV_IMPORT_FROM(pgm)
15941594
15951595   MDRV_CPU_MODIFY("main")
1596   MDRV_CPU_VBLANK_INT(drgw_interrupt,2) // needs an extra IRQ, puzzli2 doesn't want this irq!
1596   MDRV_CPU_VBLANK_INT_HACK(drgw_interrupt,2) // needs an extra IRQ, puzzli2 doesn't want this irq!
15971597MACHINE_DRIVER_END
15981598
15991599static MACHINE_RESET( killbld );
src/mame/drivers/iqblock.c
r1877r1878
306306   MDRV_CPU_ADD(Z80,12000000/2)   /* 6 MHz */
307307   MDRV_CPU_PROGRAM_MAP(main_map,0)
308308   MDRV_CPU_IO_MAP(main_portmap,0)
309   MDRV_CPU_VBLANK_INT(iqblock_interrupt,16)
309   MDRV_CPU_VBLANK_INT_HACK(iqblock_interrupt,16)
310310
311311   MDRV_MACHINE_RESET(iqblock)
312312
r1877r1878
337337   MDRV_CPU_ADD(Z180,12000000/2)   /* 6 MHz , appears to use Z180 instructions */
338338   MDRV_CPU_PROGRAM_MAP(main_map,0)
339339   MDRV_CPU_IO_MAP(main_portmap,0)
340   MDRV_CPU_VBLANK_INT(iqblock_interrupt,16)
340   MDRV_CPU_VBLANK_INT_HACK(iqblock_interrupt,16)
341341
342342   MDRV_MACHINE_RESET(iqblock)
343343
r1877r1878
368368   MDRV_CPU_ADD(Z180,12000000/2)   /* 6 MHz */
369369   MDRV_CPU_PROGRAM_MAP(main_map,0)
370370   MDRV_CPU_IO_MAP(pokerigs_portmap,0)
371   MDRV_CPU_VBLANK_INT(iqblock_interrupt,16)
371   MDRV_CPU_VBLANK_INT_HACK(iqblock_interrupt,16)
372372
373373   MDRV_MACHINE_RESET(iqblock)
374374
src/mame/drivers/gameplan.c
r1877r1878
141141
142142static WRITE8_HANDLER( audio_trigger_w )
143143{
144   gameplan_state *state = Machine->driver_data;
144   gameplan_state *state = machine->driver_data;
145145
146146   UINT8 cmd = (data << 7) | (state->audio_cmd & 0x7f);
147147
148   soundlatch_w(0, cmd);
149   r6532_0_porta_w(0, cmd);
148   soundlatch_w(machine, 0, cmd);
149   r6532_0_porta_w(machine, 0, cmd);
150150}
151151
152152
src/mame/drivers/ikki.c
r1877r1878
195195   /* basic machine hardware */
196196   MDRV_CPU_ADD(Z80,8000000/2) /* 4.000MHz */
197197   MDRV_CPU_PROGRAM_MAP(ikki_cpu1,0)
198   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
198   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
199199
200200   MDRV_CPU_ADD(Z80,8000000/2) /* 4.000MHz */
201201   MDRV_CPU_PROGRAM_MAP(ikki_cpu2,0)
202   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
202   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
203203
204204   MDRV_INTERLEAVE(10)
205205
src/mame/drivers/capbowl.c
r1877r1878
163163
164164static READ8_HANDLER( track_0_r )
165165{
166   return (input_port_0_r(offset) & 0xf0) | ((input_port_2_r(offset) - last_trackball_val[0]) & 0x0f);
166   return (input_port_0_r(machine, offset) & 0xf0) | ((input_port_2_r(machine, offset) - last_trackball_val[0]) & 0x0f);
167167}
168168
169169
170170static READ8_HANDLER( track_1_r )
171171{
172   return (input_port_1_r(offset) & 0xf0) | ((input_port_3_r(offset) - last_trackball_val[1]) & 0x0f);
172   return (input_port_1_r(machine, offset) & 0xf0) | ((input_port_3_r(machine, offset) - last_trackball_val[1]) & 0x0f);
173173}
174174
175175
176176static WRITE8_HANDLER( track_reset_w )
177177{
178178   /* reset the trackball counters */
179   last_trackball_val[0] = input_port_2_r(offset);
180   last_trackball_val[1] = input_port_3_r(offset);
179   last_trackball_val[0] = input_port_2_r(machine, offset);
180   last_trackball_val[1] = input_port_3_r(machine, offset);
181181
182   watchdog_reset_w(offset,data);
182   watchdog_reset_w(machine, offset, data);
183183}
184184
185185
r1877r1878
192192
193193static WRITE8_HANDLER( capbowl_sndcmd_w )
194194{
195   cpunum_set_input_line(Machine, 1, M6809_IRQ_LINE, HOLD_LINE);
196   soundlatch_w(offset, data);
195   cpunum_set_input_line(machine, 1, M6809_IRQ_LINE, HOLD_LINE);
196   soundlatch_w(machine, offset, data);
197197}
198198
199199
r1877r1878
352352   /* basic machine hardware */
353353   MDRV_CPU_ADD_TAG("main", M6809E, MASTER_CLOCK)
354354   MDRV_CPU_PROGRAM_MAP(capbowl_map,0)
355   MDRV_CPU_VBLANK_INT(capbowl_interrupt,1)
355   MDRV_CPU_VBLANK_INT("main", capbowl_interrupt)
356356
357357   /* audio CPU */
358358   MDRV_CPU_ADD(M6809E, MASTER_CLOCK)
src/mame/drivers/darius.c
r1877r1878
173173
174174static WRITE16_HANDLER( darius_watchdog_w )
175175{
176   watchdog_reset_w(0,data);
176   watchdog_reset_w(machine,0,data);
177177}
178178
179179
r1877r1878
186186   switch (offset)
187187   {
188188      case 0x01:
189         return (taitosound_comm_r(0) & 0xff);   /* sound interface read */
189         return (taitosound_comm_r(machine,0) & 0xff);   /* sound interface read */
190190
191191      case 0x04:
192         return input_port_0_word_r(0,mem_mask);   /* IN0 */
192         return input_port_0_word_r(machine,0,mem_mask);   /* IN0 */
193193
194194      case 0x05:
195         return input_port_1_word_r(0,mem_mask);   /* IN1 */
195         return input_port_1_word_r(machine,0,mem_mask);   /* IN1 */
196196
197197      case 0x06:
198         return input_port_2_word_r(0,mem_mask);   /* IN2 */
198         return input_port_2_word_r(machine,0,mem_mask);   /* IN2 */
199199
200200      case 0x07:
201201         return coin_word;   /* bits 3&4 coin lockouts, must return zero */
202202
203203      case 0x08:
204         return input_port_3_word_r(0,mem_mask);   /* DSW */
204         return input_port_3_word_r(machine,0,mem_mask);   /* DSW */
205205   }
206206
207207logerror("CPU #0 PC %06x: warning - read unmapped ioc offset %06x\n",activecpu_get_pc(),offset);
r1877r1878
215215   {
216216      case 0x00:   /* sound interface write */
217217
218         taitosound_port_w (0, data & 0xff);
218         taitosound_port_w (machine, 0, data & 0xff);
219219         return;
220220
221221      case 0x01:   /* sound interface write */
222222
223         taitosound_comm_w (0, data & 0xff);
223         taitosound_comm_w (machine, 0, data & 0xff);
224224         return;
225225
226226      case 0x28:   /* unknown, written by both cpus - always 0? */
r1877r1878
833833   /* basic machine hardware */
834834   MDRV_CPU_ADD(M68000,16000000/2)   /* 8 MHz ? */
835835   MDRV_CPU_PROGRAM_MAP(darius_readmem,darius_writemem)
836   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
836   MDRV_CPU_VBLANK_INT("left", irq4_line_hold)
837837
838838   MDRV_CPU_ADD(Z80,8000000/2)
839839   /* audio CPU */   /* 4 MHz ? */
r1877r1878
841841
842842   MDRV_CPU_ADD(M68000,16000000/2)   /* 8 MHz ? */
843843   MDRV_CPU_PROGRAM_MAP(darius_cpub_readmem,darius_cpub_writemem)
844   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
844   MDRV_CPU_VBLANK_INT("left", irq4_line_hold)
845845
846846   MDRV_CPU_ADD(Z80,8000000/2) /* 4 MHz ? */
847847   /* audio CPU */   /* ADPCM player using MSM5205 */
src/mame/drivers/ssingles.c
r1877r1878
4747   0x00,0x00,0x00,   0xff,0x00,0xff,   0x80,0x00,0x80,   0x40,0x00,0x40
4848};
4949
50static void update_row(running_machine *machine, mc6845_t *mc6845, mame_bitmap *bitmap, const rectangle *cliprect,
51      UINT16 ma, UINT8 ra, UINT16 y, UINT8 x_count, INT8 cursor_x, void *param)
50static MC6845_UPDATE_ROW( update_row )
5251{
5352   int cx,x;
5453   UINT32 tile_address;
r1877r1878
9291      NULL,
9392      update_row,
9493      NULL,
94      NULL,
95      NULL,
9596      NULL
9697};
9798
r1877r1878
105106   ssingles_colorram[offset]=data;
106107}
107108
108static WRITE8_HANDLER( ssingles_mc6845_address_w )
109{
110   mc6845_address_w(mc6845, data);
111}
112109
113
114static WRITE8_HANDLER( ssingles_mc6845_register_w )
115{
116   mc6845_register_w(mc6845, data);
117}
118
119
120110static VIDEO_START(ssingles)
121111{
122112   mc6845 = devtag_get_token(machine, MC6845, "crtc");
r1877r1878
158148static READ8_HANDLER(controls_r)
159149{
160150   int data=7;
161   switch(input_port_1_r(0)) //multiplexed
151   switch(input_port_1_r(machine,0)) //multiplexed
162152   {
163153      case 0x01: data=1; break;
164154      case 0x02: data=2; break;
r1877r1878
168158      case 0x20: data=6; break;
169159      case 0x40: data=0; break;
170160   }
171   return (input_port_0_r(0)&(~0x1c))|(data<<2);
161   return (input_port_0_r(machine,0)&(~0x1c))|(data<<2);
172162}
173163
174164static ADDRESS_MAP_START( ssingles_map, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
192182   AM_RANGE(0x18, 0x18) AM_READ(input_port_3_r)
193183   AM_RANGE(0x1c, 0x1c) AM_READ(controls_r)
194184   AM_RANGE(0x1a, 0x1a) AM_WRITENOP //video/crt related
195   AM_RANGE(0xfe, 0xfe) AM_WRITE(ssingles_mc6845_address_w)
196   AM_RANGE(0xff, 0xff) AM_WRITE(ssingles_mc6845_register_w)
185   AM_RANGE(0xfe, 0xfe) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
186   AM_RANGE(0xff, 0xff) AM_DEVWRITE(MC6845, "crtc", mc6845_register_w)
197187
198188ADDRESS_MAP_END
199189
r1877r1878
272262   MDRV_CPU_ADD(Z80,4000000)       /* ? MHz */
273263   MDRV_CPU_PROGRAM_MAP(ssingles_map,0)
274264   MDRV_CPU_IO_MAP(ssingles_io_map,0)
275   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
265   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
276266
277267   MDRV_SCREEN_ADD("main", RASTER)
278268   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
src/mame/drivers/kinst.c
r1877r1878
275275
276276static READ32_HANDLER( ide_controller_r )
277277{
278   return midway_ide_asic_r(offset / 2, mem_mask);
278   return midway_ide_asic_r(machine, offset / 2, mem_mask);
279279}
280280
281281
282282static WRITE32_HANDLER( ide_controller_w )
283283{
284   midway_ide_asic_w(offset / 2, data, mem_mask);
284   midway_ide_asic_w(machine, offset / 2, data, mem_mask);
285285}
286286
287287
288288static READ32_HANDLER( ide_controller_extra_r )
289289{
290   return ide_controller32_0_r(0x3f6/4, 0xff00ffff) >> 16;
290   return ide_controller32_0_r(machine, 0x3f6/4, 0xff00ffff) >> 16;
291291}
292292
293293
294294static WRITE32_HANDLER( ide_controller_extra_w )
295295{
296   ide_controller32_0_w(0x3f6/4, data << 16, 0xff00ffff);
296   ide_controller32_0_w(machine, 0x3f6/4, data << 16, 0xff00ffff);
297297}
298298
299299
r1877r1878
657657   MDRV_CPU_ADD(R4600LE, MASTER_CLOCK*2)
658658   MDRV_CPU_CONFIG(config)
659659   MDRV_CPU_PROGRAM_MAP(main_map,0)
660   MDRV_CPU_VBLANK_INT(irq0_start,1)
660   MDRV_CPU_VBLANK_INT("main", irq0_start)
661661
662662   MDRV_MACHINE_START(kinst)
663663   MDRV_MACHINE_RESET(kinst)
src/mame/drivers/cbasebal.c
r1877r1878
5151static READ8_HANDLER( bankedram_r )
5252{
5353   if (rambank == 2)
54      return cbasebal_textram_r(offset);   /* VRAM */
54      return cbasebal_textram_r(machine,offset);   /* VRAM */
5555   else if (rambank == 1)
5656   {
5757      if (offset < 0x800)
r1877r1878
6060   }
6161   else
6262   {
63      return cbasebal_scrollram_r(offset);   /* SCROLL */
63      return cbasebal_scrollram_r(machine,offset);   /* SCROLL */
6464   }
6565}
6666
6767static WRITE8_HANDLER( bankedram_w )
6868{
6969   if (rambank == 2)
70      cbasebal_textram_w(offset,data);
70      cbasebal_textram_w(machine,offset,data);
7171   else if (rambank == 1)
7272   {
7373      if (offset < 0x800)
74         paletteram_xxxxBBBBRRRRGGGG_le_w(offset,data);
74         paletteram_xxxxBBBBRRRRGGGG_le_w(machine,offset,data);
7575   }
7676   else
77      cbasebal_scrollram_w(offset,data);
77      cbasebal_scrollram_w(machine,offset,data);
7878}
7979
8080static WRITE8_HANDLER( cbasebal_coinctrl_w )
r1877r1878
122122
123123   bit = EEPROM_read_bit() << 7;
124124
125   return (input_port_2_r(0) & 0x7f) | bit;
125   return (input_port_2_r(machine,0) & 0x7f) | bit;
126126}
127127
128128static WRITE8_HANDLER( eeprom_cs_w )
r1877r1878
255255   MDRV_CPU_ADD(Z80, 6000000)   /* ??? */
256256   MDRV_CPU_PROGRAM_MAP(cbasebal_map,0)
257257   MDRV_CPU_IO_MAP(cbasebal_portmap,0)
258   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   /* ??? */
258   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   /* ??? */
259259
260260   MDRV_NVRAM_HANDLER(cbasebal)
261261
src/mame/drivers/beathead.c
r1877r1878
304304
305305static READ32_HANDLER( sound_data_r )
306306{
307   return atarigen_sound_r(offset,0);
307   return atarigen_sound_r(machine,offset,0);
308308}
309309
310310
311311static WRITE32_HANDLER( sound_data_w )
312312{
313313   if (ACCESSING_LSB32)
314      atarigen_sound_w(offset, data, mem_mask);
314      atarigen_sound_w(machine,offset, data, mem_mask);
315315}
316316
317317
318318static WRITE32_HANDLER( sound_reset_w )
319319{
320320   logerror("Sound reset = %d\n", !offset);
321   cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, offset ? CLEAR_LINE : ASSERT_LINE);
321   cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, offset ? CLEAR_LINE : ASSERT_LINE);
322322}
323323
324324
src/mame/drivers/st0016.c
r1877r1878
4444        xxxx - input port #2
4545    xxxx     - dip switches (2x8 bits) (multiplexed)
4646*/
47   int retval=input_port_2_r(0)&0x0f;
47   int retval=input_port_2_r(machine,0)&0x0f;
4848   switch(mux_port&0x30)
4949   {
50      case 0x00: retval|=((input_port_4_r(0)&1)<<4)|((input_port_4_r(0)&0x10)<<1)|((input_port_5_r(0)&1)<<6)|((input_port_5_r(0)&0x10)<<3);break;
51      case 0x10: retval|=((input_port_4_r(0)&2)<<3)|((input_port_4_r(0)&0x20)   )|((input_port_5_r(0)&2)<<5)|((input_port_5_r(0)&0x20)<<2);break;
52      case 0x20: retval|=((input_port_4_r(0)&4)<<2)|((input_port_4_r(0)&0x40)>>1)|((input_port_5_r(0)&4)<<4)|((input_port_5_r(0)&0x40)<<1);break;
53      case 0x30: retval|=((input_port_4_r(0)&8)<<1)|((input_port_4_r(0)&0x80)>>2)|((input_port_5_r(0)&8)<<3)|((input_port_5_r(0)&0x80)   );break;
50      case 0x00: retval|=((input_port_4_r(machine,0)&1)<<4)|((input_port_4_r(machine,0)&0x10)<<1)|((input_port_5_r(machine,0)&1)<<6)|((input_port_5_r(machine,0)&0x10)<<3);break;
51      case 0x10: retval|=((input_port_4_r(machine,0)&2)<<3)|((input_port_4_r(machine,0)&0x20)   )|((input_port_5_r(machine,0)&2)<<5)|((input_port_5_r(machine,0)&0x20)<<2);break;
52      case 0x20: retval|=((input_port_4_r(machine,0)&4)<<2)|((input_port_4_r(machine,0)&0x40)>>1)|((input_port_5_r(machine,0)&4)<<4)|((input_port_5_r(machine,0)&0x40)<<1);break;
53      case 0x30: retval|=((input_port_4_r(machine,0)&8)<<1)|((input_port_4_r(machine,0)&0x80)>>2)|((input_port_5_r(machine,0)&8)<<3)|((input_port_5_r(machine,0)&0x80)   );break;
5454   }
5555   return retval;
5656}
r1877r1878
420420   MDRV_CPU_PROGRAM_MAP(st0016_mem,0)
421421   MDRV_CPU_IO_MAP(st0016_io,0)
422422
423   MDRV_CPU_VBLANK_INT(st0016_int,5) /*  4*nmi + int0 */
423   MDRV_CPU_VBLANK_INT_HACK(st0016_int,5) /*  4*nmi + int0 */
424424
425425   /* video hardware */
426426   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/sbasketb.c
r1877r1878
240240   /* basic machine hardware */
241241   MDRV_CPU_ADD(M6809, 1400000)        /* 1.400 MHz ??? */
242242   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
243   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
243   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
244244
245245   MDRV_CPU_ADD(Z80,14318000/4)
246246   /* audio CPU */   /* 3.5795 MHz */
src/mame/drivers/smstrv.c
r1877r1878
227227   MDRV_CPU_ADD(I8088,24000000/2)
228228   MDRV_CPU_PROGRAM_MAP(smstrv_map,0)
229229//  MDRV_CPU_IO_MAP(io_map,0)
230   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
230   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
231231
232232//  MDRV_NVRAM_HANDLER(generic_0fill)
233233   MDRV_MACHINE_RESET(smstrv)
src/mame/drivers/funkyjet.c
r1877r1878
368368   /* basic machine hardware */
369369   MDRV_CPU_ADD(M68000, 14000000) /* 28 MHz crystal */
370370   MDRV_CPU_PROGRAM_MAP(funkyjet_readmem,funkyjet_writemem)
371   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
371   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
372372
373373   MDRV_CPU_ADD(H6280,32220000/4)   /* Custom chip 45, Audio section crystal is 32.220 MHz */
374374   /* audio CPU */
src/mame/drivers/skyarmy.c
r1877r1878
264264   MDRV_CPU_ADD(Z80,4000000)
265265   MDRV_CPU_PROGRAM_MAP(skyarmy_readmem,skyarmy_writemem)
266266   MDRV_CPU_IO_MAP(readport,writeport)
267   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
267   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
268268   MDRV_CPU_PERIODIC_INT(skyarmy_nmi_source,650)   /* Hz */
269269
270270   /* video hardware */
src/mame/drivers/ksayakyu.c
r1877r1878
6464*/
6565
6666#include "driver.h"
67#include "deprecat.h"
6768#include "sound/ay8910.h"
6869#include "sound/dac.h"
6970
r1877r1878
9091static WRITE8_HANDLER( latch_w )
9192{
9293   sound_status&=~0x80;
93   soundlatch_w(0,data|0x80);
94   soundlatch_w(machine,0,data|0x80);
9495}
9596
9697static READ8_HANDLER (sound_status_r)
r1877r1878
240241static MACHINE_DRIVER_START( ksayakyu )
241242   MDRV_CPU_ADD(Z80,8000000/2)
242243   MDRV_CPU_PROGRAM_MAP(maincpu_map,0)
243   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
244   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
244245
245246   MDRV_CPU_ADD(Z80, 80000000/2)
246247   /* audio CPU */
247248   MDRV_CPU_PROGRAM_MAP(soundcpu_map,0)
248   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)
249   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)
249250
250251   MDRV_INTERLEAVE(1000)
251252
src/mame/drivers/qix.c
r1877r1878
547547   /* basic machine hardware */
548548   MDRV_CPU_ADD_TAG("main", M6809, MAIN_CLOCK_OSC/4/4)   /* 1.25 MHz */
549549   MDRV_CPU_PROGRAM_MAP(main_map,0)
550   MDRV_CPU_VBLANK_INT(qix_vblank_start,1)
550   MDRV_CPU_VBLANK_INT("main", qix_vblank_start)
551551
552552   /* high interleave needed to ensure correct text in service mode */
553553   /* Zookeeper settings and high score table seem especially sensitive to this */
src/mame/drivers/suprgolf.c
r1877r1878
291291   MDRV_CPU_ADD(Z80,4000000)
292292   MDRV_CPU_PROGRAM_MAP(main_map,0)
293293   MDRV_CPU_IO_MAP(io_map,0)
294   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
294   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
295295
296296   MDRV_VIDEO_START(suprgolf)
297297   MDRV_VIDEO_UPDATE(suprgolf)
src/mame/drivers/xexex.c
r1877r1878
153153   UINT16 *src, *dst;
154154
155155   counter = frame;
156   frame = cpu_getcurrentframe();
156   frame = video_screen_get_frame_number(0);
157157   if (limiter && counter == frame) return; // make sure we only do DMA transfer once per frame
158158
159159   K053247_export_config(&dst, 0, 0, 0, &counter);
r1877r1878
207207   /* bit 0 is EEPROM data */
208208   /* bit 1 is EEPROM ready */
209209   /* bit 3 is service button */
210   res = EEPROM_read_bit() | input_port_1_r(0);
210   res = EEPROM_read_bit() | input_port_1_r(machine, 0);
211211
212212   if (init_eeprom_count)
213213   {
r1877r1878
256256   {
257257      // anyone knows why 0x1a keeps lurking the sound queue in the world version???
258258      if (xexex_strip0x1a)
259         if (soundlatch2_r(0)==1 && data==0x1a) return;
259         if (soundlatch2_r(machine, 0)==1 && data==0x1a) return;
260260
261      soundlatch_w(0, data & 0xff);
261      soundlatch_w(machine, 0, data & 0xff);
262262   }
263263}
264264
r1877r1878
266266{
267267   if (ACCESSING_LSB)
268268   {
269      soundlatch2_w(0, data & 0xff);
269      soundlatch2_w(machine, 0, data & 0xff);
270270   }
271271}
272272
273273static WRITE16_HANDLER( sound_irq_w )
274274{
275   cpunum_set_input_line(Machine, 1, 0, HOLD_LINE);
275   cpunum_set_input_line(machine, 1, 0, HOLD_LINE);
276276}
277277
278278static READ16_HANDLER( sound_status_r )
279279{
280   return soundlatch3_r(0);
280   return soundlatch3_r(machine, 0);
281281}
282282
283283static void reset_sound_region(void)
r1877r1878
343343}
344344
345345
346static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 16 )
347   AM_RANGE(0x000000, 0x07ffff) AM_READ(MRA16_ROM)
346static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
347   AM_RANGE(0x000000, 0x07ffff) AM_ROM
348   AM_RANGE(0x080000, 0x08ffff) AM_RAM AM_BASE(&xexex_workram)         // work RAM
349
348350#if XE_SKIPIDLE
349   AM_RANGE(0x080014, 0x080015) AM_READ(xexex_waitskip_r)      // helps sound CPU by giving back control as early as possible
351   AM_RANGE(0x080014, 0x080015) AM_READ(xexex_waitskip_r)            // helps sound CPU by giving back control as early as possible
350352#endif
351   AM_RANGE(0x080000, 0x08ffff) AM_READ(MRA16_RAM)
352   AM_RANGE(0x090000, 0x097fff) AM_READ(MRA16_RAM)            // K053247 sprite RAM
353   AM_RANGE(0x098000, 0x09ffff) AM_READ(spriteram16_mirror_r)   // K053247 sprite RAM mirror read
354   AM_RANGE(0x0c4000, 0x0c4001) AM_READ(K053246_word_r)         // Passthrough to sprite roms
355   AM_RANGE(0x0c6000, 0x0c7fff) AM_READ(K053250_0_ram_r)      // K053250 "road" RAM
356   AM_RANGE(0x0c8000, 0x0c800f) AM_READ(K053250_0_r)
353
354   AM_RANGE(0x090000, 0x097fff) AM_RAM AM_BASE(&spriteram16)         // K053247 sprite RAM
355   AM_RANGE(0x098000, 0x09ffff) AM_READWRITE(spriteram16_mirror_r, spriteram16_mirror_w)   // K053247 sprite RAM mirror read
356   AM_RANGE(0x0c0000, 0x0c003f) AM_WRITE(K056832_word_w)            // VACSET (K054157)
357   AM_RANGE(0x0c2000, 0x0c2007) AM_WRITE(K053246_word_w)            // OBJSET1
358   AM_RANGE(0x0c4000, 0x0c4001) AM_READ(K053246_word_r)            // Passthrough to sprite roms
359   AM_RANGE(0x0c6000, 0x0c7fff) AM_READWRITE(K053250_0_ram_r, K053250_0_ram_w)   // K053250 "road" RAM
360   AM_RANGE(0x0c8000, 0x0c800f) AM_READWRITE(K053250_0_r, K053250_0_w)
361   AM_RANGE(0x0ca000, 0x0ca01f) AM_WRITE(K054338_word_w)            // CLTC
362   AM_RANGE(0x0cc000, 0x0cc01f) AM_WRITE(K053251_lsb_w)            // priority encoder
363   AM_RANGE(0x0d0000, 0x0d001f) AM_WRITE(K053252_word_w)            // CCU
364   AM_RANGE(0x0d4000, 0x0d4001) AM_WRITE(sound_irq_w)
365   AM_RANGE(0x0d600c, 0x0d600d) AM_WRITE(sound_cmd1_w)
366   AM_RANGE(0x0d600e, 0x0d600f) AM_WRITE(sound_cmd2_w)
357367   AM_RANGE(0x0d6014, 0x0d6015) AM_READ(sound_status_r)
358   AM_RANGE(0x0d6000, 0x0d601f) AM_READ(MRA16_RAM)
368   AM_RANGE(0x0d6000, 0x0d601f) AM_RAM                           // sound regs fall through
369   AM_RANGE(0x0d8000, 0x0d8007) AM_WRITE(K056832_b_word_w)            // VSCCS regs
359370   AM_RANGE(0x0da000, 0x0da001) AM_READ(input_port_2_word_r)
360371   AM_RANGE(0x0da002, 0x0da003) AM_READ(input_port_3_word_r)
361372   AM_RANGE(0x0dc000, 0x0dc001) AM_READ(input_port_0_word_r)
362373   AM_RANGE(0x0dc002, 0x0dc003) AM_READ(control1_r)
363   AM_RANGE(0x0de000, 0x0de001) AM_READ(control2_r)
364   AM_RANGE(0x100000, 0x17ffff) AM_READ(MRA16_ROM)
365   AM_RANGE(0x180000, 0x181fff) AM_READ(K056832_ram_word_r)
366   AM_RANGE(0x182000, 0x183fff) AM_READ(K056832_ram_word_r)
367   AM_RANGE(0x190000, 0x191fff) AM_READ(K056832_rom_word_r)      // Passthrough to tile roms
374   AM_RANGE(0x0de000, 0x0de001) AM_READWRITE(control2_r, control2_w)
375   AM_RANGE(0x100000, 0x17ffff) AM_ROM
376   AM_RANGE(0x180000, 0x181fff) AM_READWRITE(K056832_ram_word_r, K056832_ram_word_w)
377   AM_RANGE(0x182000, 0x183fff) AM_READWRITE(K056832_ram_word_r, K056832_ram_word_w)
378   AM_RANGE(0x190000, 0x191fff) AM_READWRITE(K056832_rom_word_r, MWA16_ROM)      // Passthrough to tile roms
368379   AM_RANGE(0x1a0000, 0x1a1fff) AM_READ(K053250_0_rom_r)
369   AM_RANGE(0x1b0000, 0x1b1fff) AM_READ(MRA16_RAM)
380   AM_RANGE(0x1b0000, 0x1b1fff) AM_READWRITE(MRA16_RAM, paletteram16_xrgb_word_be_w) AM_BASE(&paletteram16)
381
370382#if XE_DEBUG
371383   AM_RANGE(0x0c0000, 0x0c003f) AM_READ(K056832_word_r)
372384   AM_RANGE(0x0c2000, 0x0c2007) AM_READ(K053246_reg_word_r)
r1877r1878
375387   AM_RANGE(0x0d0000, 0x0d001f) AM_READ(K053252_word_r)
376388   AM_RANGE(0x0d8000, 0x0d8007) AM_READ(K056832_b_word_r)
377389#endif
378ADDRESS_MAP_END
379390
380static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 16 )
381   AM_RANGE(0x000000, 0x07ffff) AM_WRITE(MWA16_ROM)               // main ROM
382   AM_RANGE(0x080000, 0x08ffff) AM_WRITE(MWA16_RAM) AM_BASE(&xexex_workram)   // work RAM
383   AM_RANGE(0x090000, 0x097fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16)   // K053247 sprite RAM
384   AM_RANGE(0x098000, 0x09ffff) AM_WRITE(spriteram16_mirror_w)      // K053247 sprite RAM mirror write
385   AM_RANGE(0x0c0000, 0x0c003f) AM_WRITE(K056832_word_w)            // VACSET (K054157)
386   AM_RANGE(0x0c2000, 0x0c2007) AM_WRITE(K053246_word_w)            // OBJSET1
387   AM_RANGE(0x0c6000, 0x0c7fff) AM_WRITE(K053250_0_ram_w)         // K053250 "road" RAM
388   AM_RANGE(0x0c8000, 0x0c800f) AM_WRITE(K053250_0_w)            // background effects generator
389   AM_RANGE(0x0ca000, 0x0ca01f) AM_WRITE(K054338_word_w)            // CLTC
390   AM_RANGE(0x0cc000, 0x0cc01f) AM_WRITE(K053251_lsb_w)            // priority encoder
391   AM_RANGE(0x0d0000, 0x0d001f) AM_WRITE(K053252_word_w)            // CCU
392   AM_RANGE(0x0d4000, 0x0d4001) AM_WRITE(sound_irq_w)
393   AM_RANGE(0x0d600c, 0x0d600d) AM_WRITE(sound_cmd1_w)
394   AM_RANGE(0x0d600e, 0x0d600f) AM_WRITE(sound_cmd2_w)
395   AM_RANGE(0x0d6000, 0x0d601f) AM_WRITE(MWA16_RAM)               // sound regs fall through
396   AM_RANGE(0x0d8000, 0x0d8007) AM_WRITE(K056832_b_word_w)         // VSCCS regs
397   AM_RANGE(0x0de000, 0x0de001) AM_WRITE(control2_w)
398   AM_RANGE(0x100000, 0x17ffff) AM_WRITE(MWA16_ROM)
399   AM_RANGE(0x180000, 0x181fff) AM_WRITE(K056832_ram_word_w)       // tilemap RAM
400   AM_RANGE(0x182000, 0x183fff) AM_WRITE(K056832_ram_word_w)       // tilemap RAM mirror
401   AM_RANGE(0x190000, 0x191fff) AM_WRITE(MWA16_ROM)               // tile ROM
402   AM_RANGE(0x1b0000, 0x1b1fff) AM_WRITE(paletteram16_xrgb_word_be_w) AM_BASE(&paletteram16)
403391ADDRESS_MAP_END
404392
405static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
406   AM_RANGE(0x0000, 0x7fff) AM_READ(MRA8_ROM)
407   AM_RANGE(0x8000, 0xbfff) AM_READ(MRA8_BANK2)
408   AM_RANGE(0xc000, 0xdfff) AM_READ(MRA8_RAM)
409   AM_RANGE(0xe000, 0xe22f) AM_READ(K054539_0_r)
410   AM_RANGE(0xec01, 0xec01) AM_READ(YM2151_status_port_0_r)
411   AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_r)
412   AM_RANGE(0xf003, 0xf003) AM_READ(soundlatch2_r)
413ADDRESS_MAP_END
414393
415static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
416   AM_RANGE(0x0000, 0xbfff) AM_WRITE(MWA8_ROM)
417   AM_RANGE(0xc000, 0xdfff) AM_WRITE(MWA8_RAM)
418   AM_RANGE(0xe000, 0xe22f) AM_WRITE(K054539_0_w)
394static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
395   AM_RANGE(0x8000, 0xbfff) AM_READ(MRA8_BANK2)
396   AM_RANGE(0x0000, 0xbfff) AM_ROM
397   AM_RANGE(0xc000, 0xdfff) AM_RAM
398   AM_RANGE(0xe000, 0xe22f) AM_READWRITE(K054539_0_r, K054539_0_w)
419399   AM_RANGE(0xec00, 0xec00) AM_WRITE(YM2151_register_port_0_w)
420   AM_RANGE(0xec01, 0xec01) AM_WRITE(YM2151_data_port_0_w)
400   AM_RANGE(0xec01, 0xec01) AM_READWRITE(YM2151_status_port_0_r, YM2151_data_port_0_w)
421401   AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch3_w)
402   AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_r)
403   AM_RANGE(0xf003, 0xf003) AM_READ(soundlatch2_r)
422404   AM_RANGE(0xf800, 0xf800) AM_WRITE(sound_bankswitch_w)
423405ADDRESS_MAP_END
424406
r1877r1878
474456
475457   /* basic machine hardware */
476458   MDRV_CPU_ADD(M68000, 16000000)   // 16MHz (32MHz xtal)
477   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
478   MDRV_CPU_VBLANK_INT(xexex_interrupt,2)
459   MDRV_CPU_PROGRAM_MAP(main_map,0)
460   MDRV_CPU_VBLANK_INT_HACK(xexex_interrupt,2)
479461
480462   // 8MHz (PCB shows one 32MHz/18.432MHz xtal, reference: www.system16.com)
481463   // more likely 32MHz since 18.432MHz yields 4.608MHz(too slow) or 9.216MHz(too fast) with integer divisors
482464   MDRV_CPU_ADD(Z80, 8000000)
483465
484466   /* audio CPU */
485   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
467   MDRV_CPU_PROGRAM_MAP(sound_map,0)
486468
487469   MDRV_INTERLEAVE(32)
488470
src/mame/drivers/wallc.c
r1877r1878
278278   /* basic machine hardware */
279279   MDRV_CPU_ADD(Z80, 12288000 / 4)   /* 3.072 MHz ? */
280280   MDRV_CPU_PROGRAM_MAP(wallc_map,0)
281   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
281   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
282282
283283   /* video hardware */
284284   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/marinedt.c
r1877r1878
9696
9797#include "driver.h"
9898
99static mame_bitmap *tile, *obj1, *obj2;
99static bitmap_t *tile, *obj1, *obj2;
100100static tilemap *tx_tilemap;
101101
102102static UINT8 *tx_tileram;
r1877r1878
278278
279279//if(data&0xf0)
280280//  logerror("pf:%02x %d\n",marinedt_pf);
281//logerror("pd:%02x %d\n",marinedt_pd, cpu_getcurrentframe());
281//logerror("pd:%02x %d\n",marinedt_pd, video_screen_get_frame_number(0));
282282
283283}
284284
r1877r1878
587587   MDRV_CPU_ADD(Z80,10000000/4)
588588   MDRV_CPU_PROGRAM_MAP(marinedt_readmem,marinedt_writemem)
589589   MDRV_CPU_IO_MAP(marinedt_readport,marinedt_writeport)
590   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
590   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
591591
592592   /* video hardware */
593593   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/ironhors.c
r1877r1878
397397   /* basic machine hardware */
398398   MDRV_CPU_ADD(M6809,18432000/6)        /* 3.072 MHz??? mod by Shingo Suzuki 1999/10/15 */
399399   MDRV_CPU_PROGRAM_MAP(master_map, 0)
400   MDRV_CPU_VBLANK_INT(ironhors_interrupt,8)
400   MDRV_CPU_VBLANK_INT_HACK(ironhors_interrupt,8)
401401
402402   MDRV_CPU_ADD_TAG("sound",Z80,18432000/6)
403403   /* audio CPU */        /* 3.072 MHz */
src/mame/drivers/battlex.c
r1877r1878
4141
4242
4343#include "driver.h"
44#include "deprecat.h"
4445#include "sound/ay8910.h"
4546
4647
r1877r1878
210211   MDRV_CPU_ADD(Z80,10000000/2 )       /* 10 MHz, divided ? (Z80A CPU) */
211212   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
212213   MDRV_CPU_IO_MAP(readport,writeport)
213   MDRV_CPU_VBLANK_INT(irq0_line_hold,8) /* controls game speed? */
214   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,8) /* controls game speed? */
214215
215216   /* video hardware */
216217   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/skullxbo.c
r1877r1878
251251   /* basic machine hardware */
252252   MDRV_CPU_ADD(M68000, ATARI_CLOCK_14MHz/2)
253253   MDRV_CPU_PROGRAM_MAP(main_map,0)
254   MDRV_CPU_VBLANK_INT(atarigen_video_int_gen,1)
254   MDRV_CPU_VBLANK_INT("main", atarigen_video_int_gen)
255255
256256   MDRV_MACHINE_RESET(skullxbo)
257257   MDRV_NVRAM_HANDLER(atarigen)
src/mame/drivers/sliver.c
r1877r1878
8989static int tmp_counter;
9090static int clr_offset=0;
9191
92static mame_bitmap *sliver_bitmap_fg;
93static mame_bitmap *sliver_bitmap_bg;
92static bitmap_t *sliver_bitmap_fg;
93static bitmap_t *sliver_bitmap_bg;
9494
9595static UINT16 tempbuf[8];
9696
r1877r1878
385385
386386static WRITE16_HANDLER(sound_w)
387387{
388      soundlatch_w(0,data & 0xff);
389      cpunum_set_input_line(Machine, 1, I8051_INT0_LINE, HOLD_LINE);
388      soundlatch_w(machine,0,data & 0xff);
389      cpunum_set_input_line(machine, 1, I8051_INT0_LINE, HOLD_LINE);
390390}
391391
392392static ADDRESS_MAP_START( sliver_map, ADDRESS_SPACE_PROGRAM, 16 )
r1877r1878
533533static MACHINE_DRIVER_START( sliver )
534534   MDRV_CPU_ADD_TAG("main", M68000, 12000000)
535535   MDRV_CPU_PROGRAM_MAP(sliver_map,0)
536   MDRV_CPU_VBLANK_INT(sliver_int,3)
536   MDRV_CPU_VBLANK_INT_HACK(sliver_int,3)
537537
538538   MDRV_CPU_ADD(I8051, 8000000)
539539   MDRV_CPU_PROGRAM_MAP(soundmem_prg,0)
src/mame/drivers/konamigq.c
r1877r1878
225225   data = 0;
226226   if( ACCESSING_LSB16 )
227227   {
228      data |= K054539_1_r( offset );
228      data |= K054539_1_r( machine, offset );
229229   }
230230   if( ACCESSING_MSB16 )
231231   {
232      data |= K054539_0_r( offset ) << 8;
232      data |= K054539_0_r( machine, offset ) << 8;
233233   }
234234   return data;
235235}
r1877r1878
238238{
239239   if( ACCESSING_LSB16 )
240240   {
241      K054539_1_w( offset, data );
241      K054539_1_w( machine, offset, data );
242242   }
243243   if( ACCESSING_MSB16 )
244244   {
245      K054539_0_w( offset, data >> 8 );
245      K054539_0_w( machine, offset, data >> 8 );
246246   }
247247}
248248
r1877r1878
376376   /* basic machine hardware */
377377   MDRV_CPU_ADD( PSXCPU, XTAL_67_7376MHz )
378378   MDRV_CPU_PROGRAM_MAP( konamigq_map, 0 )
379   MDRV_CPU_VBLANK_INT( psx_vblank, 1 )
379   MDRV_CPU_VBLANK_INT("main", psx_vblank)
380380
381381   MDRV_CPU_ADD_TAG( "sound", M68000, 8000000 )
382382   /* audio CPU */
src/mame/drivers/epos.c
r1877r1878
350350   MDRV_CPU_ADD(Z80, 11000000/4)   /* 2.75 MHz (see notes) */
351351   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
352352   MDRV_CPU_IO_MAP(readport,writeport)
353   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
353   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
354354
355355   /* video hardware */
356356   MDRV_VIDEO_UPDATE(epos)
r1877r1878
374374   MDRV_CPU_ADD(Z80, 11000000/4)   /* 2.75 MHz (see notes) */
375375   MDRV_CPU_PROGRAM_MAP(dealer_readmem,dealer_writemem)
376376   MDRV_CPU_IO_MAP(dealer_readport,dealer_writeport)
377   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
377   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
378378
379379   /* video hardware */
380380   MDRV_VIDEO_UPDATE(epos)
src/mame/drivers/mrflea.c
r1877r1878
238238ADDRESS_MAP_END
239239
240240static WRITE8_HANDLER( mrflea_data0_w ){
241   AY8910_control_port_0_w( offset, mrflea_select0 );
242   AY8910_write_port_0_w( offset, data );
241   AY8910_control_port_0_w( machine, offset, mrflea_select0 );
242   AY8910_write_port_0_w( machine, offset, data );
243243}
244244
245245static WRITE8_HANDLER( mrflea_data1_w ){
246246}
247247
248248static WRITE8_HANDLER( mrflea_data2_w ){
249   AY8910_control_port_1_w( offset, mrflea_select2 );
250   AY8910_write_port_1_w( offset, data );
249   AY8910_control_port_1_w( machine, offset, mrflea_select2 );
250   AY8910_write_port_1_w( machine, offset, data );
251251}
252252
253253static WRITE8_HANDLER( mrflea_data3_w ){
254   AY8910_control_port_2_w( offset, mrflea_select3 );
255   AY8910_write_port_2_w( offset, data );
254   AY8910_control_port_2_w( machine, offset, mrflea_select3 );
255   AY8910_write_port_2_w( machine, offset, data );
256256}
257257
258258static ADDRESS_MAP_START( writeport_io, ADDRESS_SPACE_IO, 8 )
r1877r1878
278278   MDRV_CPU_ADD(Z80, 4000000) /* 4 MHz? */
279279   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
280280   MDRV_CPU_IO_MAP(readport,writeport)
281   MDRV_CPU_VBLANK_INT(irq0_line_hold,1) /* NMI resets the game */
281   MDRV_CPU_VBLANK_INT("main", irq0_line_hold) /* NMI resets the game */
282282
283283   MDRV_CPU_ADD(Z80, 6000000)
284284   MDRV_CPU_PROGRAM_MAP(readmem_io,writemem_io)
285285   MDRV_CPU_IO_MAP(readport_io,writeport_io)
286   MDRV_CPU_VBLANK_INT(mrflea_io_interrupt,2)
286   MDRV_CPU_VBLANK_INT_HACK(mrflea_io_interrupt,2)
287287
288288   MDRV_INTERLEAVE(100)
289289
src/mame/drivers/cps3.c
r1877r1878
377377
378378static UINT32* cps3_mame_colours;//[0x20000]; // actual values to write to 32-bit bitmap
379379
380static mame_bitmap *renderbuffer_bitmap;
380static bitmap_t *renderbuffer_bitmap;
381381static rectangle renderbuffer_clip;
382382
383383
r1877r1878
386386#define CPS3_TRANSPARENCY_PEN_INDEX 2
387387#define CPS3_TRANSPARENCY_PEN_INDEX_BLEND 3
388388
389INLINE void cps3_drawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
389INLINE void cps3_drawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx,
390390      unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy,
391391      const rectangle *clip,int transparency,int transparent_color,
392      int scalex, int scaley,mame_bitmap *pri_buffer,UINT32 pri_mask)
392      int scalex, int scaley,bitmap_t *pri_buffer,UINT32 pri_mask)
393393{
394394   rectangle myclip;
395395
r1877r1878
941941
942942// the 0x400 bit in the tilemap regs is "draw it upside-down"  (bios tilemap during flashing, otherwise capcom logo is flipped)
943943
944static void cps3_draw_tilemapsprite_line(int tmnum, int drawline, mame_bitmap *bitmap, const rectangle *cliprect )
944static void cps3_draw_tilemapsprite_line(int tmnum, int drawline, bitmap_t *bitmap, const rectangle *cliprect )
945945{
946946   UINT32* tmapregs[4] = { tilemap20_regs_base, tilemap30_regs_base, tilemap40_regs_base, tilemap50_regs_base };
947947   UINT32* regs;
r1877r1878
12411241
12421242                        if (current_ypos&0x200) current_ypos-=0x400;
12431243
1244                        //if ( (whichbpp) && (cpu_getcurrentframe() & 1)) continue;
1244                        //if ( (whichbpp) && (video_screen_get_frame_number(0) & 1)) continue;
12451245
12461246                        /* use the palette value from the main list or the sublists? */
12471247                        if (whichpal)
r1877r1878
19141914
19151915static READ32_HANDLER( cps3_cdrom_r )
19161916{
1917
19181917   UINT32 retval = 0;
19191918
19201919   if (ACCESSING_MSB32)
19211920   {
1922      retval |= ((UINT16)wd33c93_r(0))<<16;
1921      retval |= ((UINT16)wd33c93_r(machine,0))<<16;
19231922   }
19241923
19251924   if (ACCESSING_LSB32)
19261925   {
1927      retval |= (UINT16)wd33c93_r(1);
1926      retval |= (UINT16)wd33c93_r(machine,1);
19281927   }
19291928
19301929   return retval;
r1877r1878
19341933{
19351934   if (ACCESSING_MSB32)
19361935   {
1937      wd33c93_w(0,(data & 0x00ff0000)>>16);
1936      wd33c93_w(machine,0,(data & 0x00ff0000)>>16);
19381937   }
19391938
19401939   if (ACCESSING_LSB32)
19411940   {
1942      wd33c93_w(1,(data & 0x000000ff)>>0);
1941      wd33c93_w(machine,1,(data & 0x000000ff)>>0);
19431942   }
19441943}
19451944
r1877r1878
27262725   /* basic machine hardware */
27272726   MDRV_CPU_ADD_TAG("main", SH2, 6250000*4) // external clock is 6.25 Mhz, it sets the intenral multiplier to 4x (this should probably be handled in the core..)
27282727   MDRV_CPU_PROGRAM_MAP(cps3_map,0)
2729   MDRV_CPU_VBLANK_INT(cps3_vbl_interrupt,1)
2728   MDRV_CPU_VBLANK_INT("main", cps3_vbl_interrupt)
27302729   MDRV_CPU_PERIODIC_INT(cps3_other_interrupt,80) /* ?source? */
27312730
27322731   /* video hardware */
src/mame/drivers/glass.c
r1877r1878
204204   /* basic machine hardware */
205205   MDRV_CPU_ADD(M68000,24000000/2)      /* 12 MHz (M680000 P12) */
206206   MDRV_CPU_PROGRAM_MAP(glass_readmem,glass_writemem)
207   MDRV_CPU_VBLANK_INT(glass_interrupt, 1)
207   MDRV_CPU_VBLANK_INT("main", glass_interrupt)
208208
209209   MDRV_MACHINE_RESET(glass)
210210
src/mame/drivers/spiders.c
r1877r1878
273273   /* update the different PIA pins from the input ports */
274274
275275   /* CA1 - copy of PA1 (COIN1) */
276   pia_1_ca1_w(0, input_port_0_r(0) & 0x02);
276   pia_1_ca1_w(machine, 0, input_port_0_r(machine, 0) & 0x02);
277277
278278   /* CA2 - copy of PA0 (SERVICE1) */
279   pia_1_ca2_w(0, input_port_0_r(0) & 0x01);
279   pia_1_ca2_w(machine, 0, input_port_0_r(machine, 0) & 0x01);
280280
281281   /* CB1 - (crosshatch) */
282   pia_1_cb1_w(0, input_port_5_r(0));
282   pia_1_cb1_w(machine, 0, input_port_5_r(machine, 0));
283283
284284   /* CB2 - NOT CONNECTED */
285285}
r1877r1878
345345
346346static void ic60_74123_output_changed(int output)
347347{
348   pia_2_ca1_w(0, output);
348   pia_2_ca1_w(Machine, 0, output);
349349}
350350
351351
r1877r1878
410410#define NUM_PENS   (8)
411411
412412
413static WRITE8_HANDLER( spiders_mc6845_address_w )
414{
415   mc6845_address_w(mc6845, data);
416}
417
418
419static READ8_HANDLER( spiders_mc6845_register_r )
420{
421   return mc6845_register_r(mc6845);
422}
423
424
425static WRITE8_HANDLER( spiders_mc6845_register_w )
426{
427   mc6845_register_w(mc6845, data);
428}
429
430
431413static WRITE8_HANDLER( flipscreen_w )
432414{
433415   flipscreen = data;
434416}
435417
436418
437static void *begin_update(running_machine *machine, mc6845_t *mc6845, mame_bitmap *bitmap, const rectangle *cliprect)
419static MC6845_BEGIN_UPDATE( begin_update )
438420{
439421   /* create the pens */
440422   offs_t i;
r1877r1878
449431}
450432
451433
452static void update_row(running_machine *machine, mc6845_t *mc6845, mame_bitmap *bitmap, const rectangle *cliprect,
453                  UINT16 ma, UINT8 ra, UINT16 y, UINT8 x_count, INT8 cursor_x, void *param)
434static MC6845_UPDATE_ROW( update_row )
454435{
455436   UINT8 cx;
456437
r1877r1878
509490}
510491
511492
512static void display_enable_changed(running_machine *machine, mc6845_t *mc6845, int display_enabled)
493static MC6845_ON_DE_CHANGED( display_enable_changed )
513494{
514495   TTL74123_A_w(0, display_enabled);
515496}
r1877r1878
523504   begin_update,         /* before pixel update callback */
524505   update_row,            /* row update callback */
525506   0,                  /* after pixel update callback */
526   display_enable_changed   /* call back for display state changes */
507   display_enable_changed,   /* callback for display state changes */
508   NULL,               /* HSYNC callback */
509   NULL               /* VSYNC callback */
527510};
528511
529512
r1877r1878
590573
591574static ADDRESS_MAP_START( spiders_main_map, ADDRESS_SPACE_PROGRAM, 8 )
592575   AM_RANGE(0x0000, 0xbfff) AM_RAM AM_BASE(&spiders_ram)
593   AM_RANGE(0xc000, 0xc000) AM_WRITE(spiders_mc6845_address_w)
594   AM_RANGE(0xc001, 0xc001) AM_READWRITE(spiders_mc6845_register_r, spiders_mc6845_register_w)
576   AM_RANGE(0xc000, 0xc000) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
577   AM_RANGE(0xc001, 0xc001) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
595578   AM_RANGE(0xc020, 0xc027) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
596579   AM_RANGE(0xc044, 0xc047) AM_READWRITE(pia_1_r, pia_1_w)
597580   AM_RANGE(0xc048, 0xc04b) AM_READWRITE(pia_2_alt_r, pia_2_alt_w)
src/mame/drivers/mcatadv.c
r1877r1878
161161
162162static WRITE16_HANDLER( mcat_soundlatch_w )
163163{
164   soundlatch_w(0, data);
165   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
164   soundlatch_w(machine, 0, data);
165   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
166166}
167167
168168#if 0 // mcat only.. install read handler?
r1877r1878
180180
181181static READ16_HANDLER( mcat_wd_r )
182182{
183   watchdog_reset_r(0);
183   watchdog_reset_r(machine,0);
184184   return 0xc00;
185185}
186186
r1877r1878
495495   /* basic machine hardware */
496496   MDRV_CPU_ADD(M68000, XTAL_16MHz) /* verified on pcb */
497497   MDRV_CPU_PROGRAM_MAP(mcatadv_readmem,mcatadv_writemem)
498   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
498   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
499499
500500   MDRV_CPU_ADD_TAG("sound", Z80, XTAL_16MHz/4) /* verified on pcb */
501501   MDRV_CPU_PROGRAM_MAP(mcatadv_sound_readmem,mcatadv_sound_writemem)
src/mame/drivers/cinemat.c
r1877r1878
3939#include "starcas.lh"
4040#include "solarq.lh"
4141
42#define MASTER_CLOCK         XTAL_19_923MHz
4243
44
45
4346static UINT16 *rambase;
4447
4548static UINT8 coin_detected;
46static UINT8 coin_last_input;
4749static UINT8 coin_last_reset;
4850
4951static UINT8 mux_select;
r1877r1878
5961static MACHINE_START( cinemat )
6062{
6163   state_save_register_global(coin_detected);
62   state_save_register_global(coin_last_input);
6364   state_save_register_global(coin_last_reset);
6465   state_save_register_global(mux_select);
6566}
r1877r1878
6970{
7071   /* reset the coin states */
7172   coin_detected = 0;
72   coin_last_input = 0x80;
7373   coin_last_reset = 0;
7474
7575   /* reset mux select */
r1877r1878
104104 *
105105 *************************************/
106106
107static INTERRUPT_GEN( check_coins )
107static INPUT_CHANGED( coin_inserted )
108108{
109   UINT8 new_input = readinputportbytag("SWITCHES") & 0x80;
110
111109   /* on the falling edge of a new coin, set the coin_detected flag */
112   if (coin_last_input != new_input && new_input == 0x00)
110   if (newval == 0)
113111      coin_detected = 1;
114   coin_last_input = new_input;
115112}
116113
117114
r1877r1878
140137static WRITE8_HANDLER( mux_select_w )
141138{
142139   mux_select = data;
143   cinemat_sound_control_w(0x07, data);
140   cinemat_sound_control_w(machine, 0x07, data);
144141}
145142
146143
r1877r1878
271268
272269static READ8_HANDLER( qb3_frame_r )
273270{
271   attotime next_update = video_screen_get_time_until_update(0);
272   attotime frame_period = video_screen_get_frame_period(0);
273   int percent = next_update.attoseconds / (frame_period.attoseconds / 100);
274
274275   /* note this is just an approximation... */
275   return cpu_scalebyfcount(100) < 90;
276   return (percent >= 10);
276277}
277278
278279
r1877r1878
370371   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
371372   PORT_DIPSETTING(   0x40, DEF_STR( Off ) )
372373   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
373   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
374   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
374375INPUT_PORTS_END
375376
376377
r1877r1878
415416   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
416417   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
417418   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
418   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
419   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
419420INPUT_PORTS_END
420421
421422
r1877r1878
448449   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
449450   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
450451   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
451   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
452   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
452453
453454   PORT_START_TAG("WHEEL")
454455   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_RESET
r1877r1878
493494   PORT_DIPNAME( 0x40,   0x40, DEF_STR( Unknown ) )
494495   PORT_DIPSETTING(   0x40, DEF_STR( Off ) )
495496   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
496   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
497   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
497498INPUT_PORTS_END
498499
499500
r1877r1878
537538   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
538539   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
539540   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
540   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
541   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
541542
542543   PORT_START_TAG("PAD1")
543544   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P1 Pad 1") PORT_CODE(KEYCODE_7_PAD) PORT_PLAYER(1)
r1877r1878
593594   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
594595   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
595596   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
596   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
597   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
597598
598599   PORT_START_TAG("ANALOGX")
599600   PORT_BIT( 0xfff, 0x800, IPT_AD_STICK_X ) PORT_MINMAX(0x200,0xe00) PORT_SENSITIVITY(100) PORT_KEYDELTA(50)
r1877r1878
638639   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
639640   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
640641   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
641   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
642   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
642643INPUT_PORTS_END
643644
644645
r1877r1878
674675   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
675676   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
676677   PORT_SERVICE( 0x40, IP_ACTIVE_HIGH )
677   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
678   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
678679INPUT_PORTS_END
679680
680681
r1877r1878
710711   PORT_DIPSETTING(   0x00, "Individual" )
711712   PORT_DIPSETTING(   0x20, "Combined" )
712713   PORT_SERVICE( 0x40,   IP_ACTIVE_LOW )
713   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
714   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
714715INPUT_PORTS_END
715716
716717
r1877r1878
747748   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
748749   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
749750   PORT_SERVICE( 0x40, IP_ACTIVE_HIGH )
750   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
751   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
751752INPUT_PORTS_END
752753
753754
r1877r1878
781782   PORT_DIPSETTING(   0x20, DEF_STR( Off ) )
782783   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
783784   PORT_SERVICE( 0x40,   IP_ACTIVE_HIGH )
784   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
785   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
785786INPUT_PORTS_END
786787
787788
r1877r1878
817818   PORT_DIPSETTING(   0x20, DEF_STR( Off ) )
818819   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
819820   PORT_SERVICE( 0x40,   IP_ACTIVE_LOW )
820   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
821   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
821822
822823   PORT_START_TAG("DIAL")
823824   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_REVERSE PORT_SENSITIVITY(100) PORT_KEYDELTA(5)
r1877r1878
859860   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
860861   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
861862   PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
862   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
863   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
863864INPUT_PORTS_END
864865
865866
r1877r1878
901902   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) )
902903   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
903904   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
904   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
905   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
905906INPUT_PORTS_END
906907
907908
r1877r1878
947948   PORT_DIPSETTING(   0x20, DEF_STR( Off ) )
948949   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
949950   PORT_SERVICE( 0x40,   IP_ACTIVE_LOW )
950   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
951   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
951952INPUT_PORTS_END
952953
953954
r1877r1878
983984static MACHINE_DRIVER_START( cinemat_nojmi_4k )
984985
985986   /* basic machine hardware */
986   MDRV_CPU_ADD_TAG("main", CCPU, 5000000)
987   MDRV_CPU_ADD_TAG("main", CCPU, MASTER_CLOCK/4)
987988   MDRV_CPU_CONFIG(config_nojmi)
988989   MDRV_CPU_PROGRAM_MAP(program_map_4k,0)
989990   MDRV_CPU_DATA_MAP(data_map,0)
990991   MDRV_CPU_IO_MAP(io_map,0)
991   MDRV_CPU_VBLANK_INT(check_coins,1)
992992
993993   MDRV_MACHINE_START(cinemat)
994994   MDRV_MACHINE_RESET(cinemat)
995995
996996   /* video hardware */
997   MDRV_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
998
997999   MDRV_SCREEN_ADD("main", VECTOR)
998   MDRV_SCREEN_REFRESH_RATE(38)
999   MDRV_SCREEN_SIZE(400, 300)
1000   MDRV_SCREEN_REFRESH_RATE(MASTER_CLOCK/4/16/16/16/16/2)
1001   MDRV_SCREEN_SIZE(1024, 768)
10001002   MDRV_SCREEN_VISIBLE_AREA(0, 1023, 0, 767)
10011003
10021004   MDRV_VIDEO_START(cinemat_bilevel)
1003   MDRV_VIDEO_EOF(cinemat)
1004   MDRV_VIDEO_UPDATE(vector)
1005   MDRV_VIDEO_UPDATE(cinemat)
10051006MACHINE_DRIVER_END
10061007
10071008
src/mame/drivers/toaplan2.c
r1877r1878
376376
377377
378378/***************** Sound stuff *****************/
379void dogyuun_okisnd_w(int data);
380void kbash_okisnd_w(int data);
381void fixeight_okisnd_w(int data);
382void batsugun_okisnd_w(int data);
379void dogyuun_okisnd_w(running_machine *machine, int data);
380void kbash_okisnd_w(running_machine *machine, int data);
381void fixeight_okisnd_w(running_machine *machine, int data);
382void batsugun_okisnd_w(running_machine *machine, int data);
383383
384384
385385/***************************************************************************
r1877r1878
655655{
656656   if (ACCESSING_LSB)
657657   {
658      toaplan2_coin_w(offset, data & 0xff);
658      toaplan2_coin_w(machine, offset, data & 0xff);
659659   }
660660   if (ACCESSING_MSB && (data & 0xff00) )
661661   {
r1877r1878
667667{
668668   if (ACCESSING_LSB)
669669   {
670      toaplan2_coin_w(offset, data & 0xff);
670      toaplan2_coin_w(machine, offset, data & 0xff);
671671      OKIM6295_set_bank_base(0, (((data & 0x10) >> 4) * 0x40000));
672672   }
673673   if (ACCESSING_MSB && (data & 0xff00) )
r1877r1878
721721   }
722722   if (mcu_data == 0xff) mcu_data = 0x10;
723723   else mcu_data = 0x00;
724   return ( mcu_data | input_port_6_r(0) );
724   return ( mcu_data | input_port_6_r(machine,0) );
725725}
726726
727727static READ16_HANDLER( pipibibi_z80_status_r )
r1877r1878
741741{
742742   INT8 value, new_value;
743743
744   new_value = input_port_7_r(0);
744   new_value = input_port_7_r(machine,0);
745745   if (new_value == old_p1_paddle_h) return 0;
746746   value = new_value - old_p1_paddle_h;
747747   old_p1_paddle_h = new_value;
r1877r1878
752752{
753753   INT8 value, new_value;
754754
755   new_value = input_port_8_r(0);
755   new_value = input_port_8_r(machine,0);
756756   if (new_value == old_p2_paddle_h) return 0;
757757   value = new_value - old_p2_paddle_h;
758758   old_p2_paddle_h = new_value;
r1877r1878
886886   if (ACCESSING_LSB)
887887   {
888888      mcu_data = data;
889      dogyuun_okisnd_w(data);
889      dogyuun_okisnd_w(machine, data);
890890   }
891891   logerror("PC:%06x Writing command (%04x) to the NEC V25+ secondary CPU port\n",activecpu_get_previouspc(),mcu_data);
892892}
r1877r1878
905905{
906906   if (ACCESSING_LSB)
907907   {
908      kbash_okisnd_w(data);
908      kbash_okisnd_w(machine, data);
909909   }
910910   logerror("PC:%06x Writing Sound command (%04x) to the NEC V25+ secondary CPU\n",activecpu_get_previouspc(),data);
911911}
r1877r1878
942942      if (mcu_data & 0xff00)
943943      {
944944         mcu_data = (mcu_data & 0xff00) | (data & 0xff);
945         fixeight_okisnd_w(data);
945         fixeight_okisnd_w(machine, data);
946946      }
947947      else if (mcu_data == 0xff00)
948948      {
r1877r1878
986986   if (ACCESSING_LSB)
987987   {
988988      mcu_data = data;
989      batsugun_okisnd_w(data);
989      batsugun_okisnd_w(machine, data);
990990   }
991991   logerror("PC:%06x Writing command (%04x) to the NEC V25+ secondary CPU port %02x\n",activecpu_get_previouspc(),mcu_data,(offset*2));
992992}
r1877r1878
10501050{
10511051   if (ACCESSING_LSB)
10521052   {
1053      soundlatch_w(offset, data & 0xff);
1054      cpunum_set_input_line(Machine, 1, 0, HOLD_LINE);
1053      soundlatch_w(machine, offset, data & 0xff);
1054      cpunum_set_input_line(machine, 1, 0, HOLD_LINE);
10551055   }
10561056}
10571057
r1877r1878
10971097
10981098static WRITE8_HANDLER( raizing_okim6295_bankselect_0 )
10991099{
1100   NMK112_okibank_w(0,  data      & 0x0f);   // chip 0 bank 0
1101   NMK112_okibank_w(1, (data >> 4)   & 0x0f);   // chip 0 bank 1
1100   NMK112_okibank_w(machine, 0,  data      & 0x0f);   // chip 0 bank 0
1101   NMK112_okibank_w(machine, 1, (data >> 4)   & 0x0f);   // chip 0 bank 1
11021102}
11031103
11041104static WRITE8_HANDLER( raizing_okim6295_bankselect_1 )
11051105{
1106   NMK112_okibank_w(2,  data      & 0x0f);   // chip 0 bank 2
1107   NMK112_okibank_w(3, (data >> 4)   & 0x0f);   // chip 0 bank 3
1106   NMK112_okibank_w(machine, 2,  data      & 0x0f);   // chip 0 bank 2
1107   NMK112_okibank_w(machine, 3, (data >> 4)   & 0x0f);   // chip 0 bank 3
11081108}
11091109
11101110static WRITE8_HANDLER( raizing_okim6295_bankselect_2 )
11111111{
1112   NMK112_okibank_w(4,  data      & 0x0f);   // chip 1 bank 0
1113   NMK112_okibank_w(5, (data >> 4)   & 0x0f);   // chip 1 bank 1
1112   NMK112_okibank_w(machine, 4,  data      & 0x0f);   // chip 1 bank 0
1113   NMK112_okibank_w(machine, 5, (data >> 4)   & 0x0f);   // chip 1 bank 1
11141114}
11151115
11161116static WRITE8_HANDLER( raizing_okim6295_bankselect_3 )
11171117{
1118   NMK112_okibank_w(6,  data      & 0x0f);   // chip 1 bank 2
1119   NMK112_okibank_w(7, (data >> 4)   & 0x0f);   // chip 1 bank 3
1118   NMK112_okibank_w(machine, 6,  data      & 0x0f);   // chip 1 bank 2
1119   NMK112_okibank_w(machine, 7, (data >> 4)   & 0x0f);   // chip 1 bank 3
11201120}
11211121
11221122
r1877r1878
11781178{
11791179   if (ACCESSING_LSB)
11801180   {
1181      soundlatch_w(offset, data & 0xff);
1182      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, ASSERT_LINE);
1181      soundlatch_w(machine, offset, data & 0xff);
1182      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, ASSERT_LINE);
11831183   }
11841184}
11851185
r1877r1878
11881188{
11891189   if (ACCESSING_LSB)
11901190   {
1191      soundlatch2_w(offset, data & 0xff);
1192      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, ASSERT_LINE);
1191      soundlatch2_w(machine, offset, data & 0xff);
1192      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, ASSERT_LINE);
11931193   }
11941194}
11951195
r1877r1878
32973297   /* basic machine hardware */
32983298   MDRV_CPU_ADD(M68000, 10000000)         /* 10MHz Oscillator */
32993299   MDRV_CPU_PROGRAM_MAP(tekipaki_68k_mem, 0)
3300   MDRV_CPU_VBLANK_INT(toaplan2_vblank_irq4,1)
3300   MDRV_CPU_VBLANK_INT("main", toaplan2_vblank_irq4)
33013301
33023302#if HD64x180
33033303   MDRV_CPU_ADD(Z180, 10000000)         /* HD647180 CPU actually */
r1877r1878
33363336   /* basic machine hardware */
33373337   MDRV_CPU_ADD(M68000, XTAL_10MHz)         /* verified on pcb */
33383338   MDRV_CPU_PROGRAM_MAP(ghox_68k_mem, 0)
3339   MDRV_CPU_VBLANK_INT(toaplan2_vblank_irq4,1)
3339   MDRV_CPU_VBLANK_INT("main", toaplan2_vblank_irq4)
33403340
33413341#if HD64x180
33423342   MDRV_CPU_ADD(Z180, XTAL_10MHz)         /* HD647180 CPU actually */
r1877r1878
33743374   /* basic machine hardware */
33753375   MDRV_CPU_ADD(M68000, XTAL_25MHz/2)         /* verified on pcb */
33763376   MDRV_CPU_PROGRAM_MAP(dogyuun_68k_mem, 0)
3377   MDRV_CPU_VBLANK_INT(toaplan2_vblank_irq4,1)
3377   MDRV_CPU_VBLANK_INT("main", toaplan2_vblank_irq4)
33783378
33793379#if V25
33803380   MDRV_CPU_ADD(Z180, XTAL_25MHz/2)         /* NEC V25+ type Toaplan marked CPU ??? */
r1877r1878
34173417   /* basic machine hardware */
34183418   MDRV_CPU_ADD(M68000, 16000000)         /* 16MHz Oscillator */
34193419   MDRV_CPU_PROGRAM_MAP(kbash_68k_mem, 0)
3420   MDRV_CPU_VBLANK_INT(toaplan2_vblank_irq4,1)
3420   MDRV_CPU_VBLANK_INT("main", toaplan2_vblank_irq4)
34213421
34223422#if V25
34233423   MDRV_CPU_ADD(Z180, 16000000)         /* NEC V25+ type Toaplan marked CPU ??? */
r1877r1878
34593459   /* basic machine hardware */
34603460   MDRV_CPU_ADD(M68000, 16000000)         /* 16MHz Oscillator */
34613461   MDRV_CPU_PROGRAM_MAP(kbash2_68k_mem, 0)
3462   MDRV_CPU_VBLANK_INT(toaplan2_vblank_irq4,1)
3462   MDRV_CPU_VBLANK_INT("main", toaplan2_vblank_irq4)
34633463
34643464   MDRV_MACHINE_RESET(toaplan2)
34653465
r1877r1878
34973497   /* basic machine hardware */
34983498   MDRV_CPU_ADD(M68000, XTAL_16MHz)         /* verified on pcb */
34993499   MDRV_CPU_PROGRAM_MAP(truxton2_68k_mem, 0)
3500   MDRV_CPU_VBLANK_INT(toaplan2_vblank_irq2,1)
3500   MDRV_CPU_VBLANK_INT("main", toaplan2_vblank_irq2)
35013501
35023502   MDRV_MACHINE_RESET(toaplan2)
35033503
r1877r1878
35343534   /* basic machine hardware */
35353535   MDRV_CPU_ADD(M68000, XTAL_10MHz)         /* verified on pcb */
35363536   MDRV_CPU_PROGRAM_MAP(pipibibs_68k_mem, 0)
3537   MDRV_CPU_VBLANK_INT(toaplan2_vblank_irq4,1)
3537   MDRV_CPU_VBLANK_INT("main", toaplan2_vblank_irq4)
35383538
35393539   MDRV_CPU_ADD(Z80,XTAL_27MHz/8)         /* verified on pcb */
35403540   MDRV_CPU_PROGRAM_MAP(sound_z80_mem, 0)
r1877r1878
35733573   /* basic machine hardware */
35743574   MDRV_CPU_ADD(M68000, 10000000)         /* 10MHz Oscillator */
35753575   MDRV_CPU_PROGRAM_MAP(tekipaki_68k_mem, 0)
3576   MDRV_CPU_VBLANK_INT(toaplan2_vblank_irq4,1)
3576   MDRV_CPU_VBLANK_INT("main", toaplan2_vblank_irq4)
35773577
35783578   MDRV_CPU_ADD(Z80, 27000000/8)         /* This should be a HD647180 */
35793579                                 /* Change this to 10MHz when HD647180 gets dumped. 10MHz Oscillator */
r1877r1878
36133613   /* basic machine hardware */
36143614   MDRV_CPU_ADD(M68000, 10000000)         /* 10MHz Oscillator */
36153615   MDRV_CPU_PROGRAM_MAP(pipibibi_68k_mem, 0)
3616   MDRV_CPU_VBLANK_INT(toaplan2_vblank_irq4,1)
3616   MDRV_CPU_VBLANK_INT("main", toaplan2_vblank_irq4)
36173617
36183618   MDRV_CPU_ADD(Z80,27000000/8)         /* ??? 3.37MHz */
36193619   MDRV_CPU_PROGRAM_MAP(sound_z80_mem, 0)
r1877r1878
36523652   /* basic machine hardware */
36533653   MDRV_CPU_ADD(M68000, XTAL_16MHz)         /* verified on pcb */
36543654   MDRV_CPU_PROGRAM_MAP(fixeight_68k_mem, 0)
3655   MDRV_CPU_VBLANK_INT(toaplan2_vblank_irq4,1)
3655   MDRV_CPU_VBLANK_INT("main", toaplan2_vblank_irq4)
36563656
36573657#if V25
36583658   MDRV_CPU_ADD(Z180, XTAL_16MHz)         /* NEC V25+ type Toaplan marked CPU ??? */
r1877r1878
36953695   /* basic machine hardware */
36963696   MDRV_CPU_ADD(M68000, 10000000)         /* 10MHz Oscillator */
36973697   MDRV_CPU_PROGRAM_MAP(fixeighb_68k_mem, 0)
3698   MDRV_CPU_VBLANK_INT(toaplan2_vblank_irq2,1)
3698   MDRV_CPU_VBLANK_INT("main", toaplan2_vblank_irq2)
36993699
37003700   MDRV_MACHINE_RESET(toaplan2)
37013701
r1877r1878
37293729   /* basic machine hardware */
37303730   MDRV_CPU_ADD(M68000, 10000000)         /* 10MHz Oscillator */
37313731   MDRV_CPU_PROGRAM_MAP(vfive_68k_mem, 0)
3732   MDRV_CPU_VBLANK_INT(toaplan2_vblank_irq4,1)
3732   MDRV_CPU_VBLANK_INT("main", toaplan2_vblank_irq4)
37333733
37343734#if V25
37353735   MDRV_CPU_ADD(Z180, 10000000)         /* NEC V25+ type Toaplan marked CPU ??? */
r1877r1878
37683768   /* basic machine hardware */
37693769   MDRV_CPU_ADD(M68000,32000000/2)         /* 16MHz , 32MHz Oscillator */
37703770   MDRV_CPU_PROGRAM_MAP(batsugun_68k_mem, 0)
3771   MDRV_CPU_VBLANK_INT(toaplan2_vblank_irq4,1)
3771   MDRV_CPU_VBLANK_INT("main", toaplan2_vblank_irq4)
37723772
37733773#if V25
37743774   MDRV_CPU_ADD(Z180, 32000000/2)         /* NEC V25+ type Toaplan marked CPU ??? */
r1877r1878
38113811   /* basic machine hardware */
38123812   MDRV_CPU_ADD(M68000, 16000000)
38133813   MDRV_CPU_PROGRAM_MAP(snowbro2_68k_mem, 0)
3814   MDRV_CPU_VBLANK_INT(toaplan2_vblank_irq4,1)
3814   MDRV_CPU_VBLANK_INT("main", toaplan2_vblank_irq4)
38153815
38163816   MDRV_MACHINE_RESET(toaplan2)
38173817
r1877r1878
38483848   /* basic machine hardware */
38493849   MDRV_CPU_ADD(M68000,32000000/2)         /* 16MHz , 32MHz Oscillator */
38503850   MDRV_CPU_PROGRAM_MAP(mahoudai_68k_mem, 0)
3851   MDRV_CPU_VBLANK_INT(toaplan2_vblank_irq4,1)
3851   MDRV_CPU_VBLANK_INT("main", toaplan2_vblank_irq4)
38523852
38533853   MDRV_CPU_ADD(Z80,32000000/8)         /* 4MHz , 32MHz Oscillator */
38543854   MDRV_CPU_PROGRAM_MAP(raizing_sound_z80_mem, 0)
r1877r1878
38903890   /* basic machine hardware */
38913891   MDRV_CPU_ADD(M68000,32000000/2)         /* 16MHz , 32MHz Oscillator */
38923892   MDRV_CPU_PROGRAM_MAP(shippumd_68k_mem, 0)
3893   MDRV_CPU_VBLANK_INT(toaplan2_vblank_irq4,1)
3893   MDRV_CPU_VBLANK_INT("main", toaplan2_vblank_irq4)
38943894
38953895   MDRV_CPU_ADD(Z80,32000000/8)         /* 4MHz , 32MHz Oscillator */
38963896   MDRV_CPU_PROGRAM_MAP(raizing_sound_z80_mem, 0)
r1877r1878
39323932   /* basic machine hardware */
39333933   MDRV_CPU_ADD(M68000,32000000/2)         /* 16MHz , 32MHz Oscillator */
39343934   MDRV_CPU_PROGRAM_MAP(bgaregga_68k_mem, 0)
3935   MDRV_CPU_VBLANK_INT(toaplan2_vblank_irq4,1)
3935   MDRV_CPU_VBLANK_INT("main", toaplan2_vblank_irq4)
39363936
39373937   MDRV_CPU_ADD(Z80,32000000/8)         /* 4MHz , 32MHz Oscillator */
39383938   MDRV_CPU_PROGRAM_MAP(bgaregga_sound_z80_mem, 0)
r1877r1878
39743974   /* basic machine hardware */
39753975   MDRV_CPU_ADD(M68000,32000000/2)         /* 16MHz , 32MHz Oscillator */
39763976   MDRV_CPU_PROGRAM_MAP(batrider_68k_mem, 0)
3977   MDRV_CPU_VBLANK_INT(toaplan2_vblank_irq2,1)
3977   MDRV_CPU_VBLANK_INT("main", toaplan2_vblank_irq2)
39783978
39793979   MDRV_CPU_ADD(Z80,32000000/8)         /* 4MHz , 32MHz Oscillator */
39803980   MDRV_CPU_PROGRAM_MAP(batrider_sound_z80_mem, 0)
r1877r1878
40194019   /* basic machine hardware */
40204020   MDRV_CPU_ADD(M68000,32000000/2)
40214021   MDRV_CPU_PROGRAM_MAP(bbakraid_68k_mem, 0)
4022   MDRV_CPU_VBLANK_INT(toaplan2_vblank_irq1,1)
4022   MDRV_CPU_VBLANK_INT("main", toaplan2_vblank_irq1)
40234023
40244024   MDRV_CPU_ADD(Z80,32000000/4)
40254025   MDRV_CPU_PROGRAM_MAP(bbakraid_sound_z80_mem, 0)
src/mame/drivers/ddz.c
r1877r1878
5454static MACHINE_DRIVER_START( ddz )
5555   MDRV_CPU_ADD(SE3208, 43000000)
5656   MDRV_CPU_PROGRAM_MAP(ddz_mem,0)
57    MDRV_CPU_VBLANK_INT(ddz_interrupt,1)
57    MDRV_CPU_VBLANK_INT("main", ddz_interrupt)
5858
5959   //MDRV_MACHINE_RESET(ddz)
6060
src/mame/drivers/mjkjidai.c
r1877r1878
356356   MDRV_CPU_ADD(Z80,10000000/2)   /* 5 MHz ??? */
357357   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
358358   MDRV_CPU_IO_MAP(readport,writeport)
359   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
359   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
360360
361361   MDRV_NVRAM_HANDLER(mjkjidai)
362362
src/mame/drivers/jchan.c
r1877r1878
417417   skns_spc_regs = auto_malloc (0x40);
418418}
419419
420extern void skns_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect );
420extern void skns_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect );
421421
422422
423423static VIDEO_UPDATE(jchan)
r1877r1878
749749
750750   MDRV_CPU_ADD(M68000, 16000000)
751751   MDRV_CPU_PROGRAM_MAP(jchan_main,0)
752   MDRV_CPU_VBLANK_INT(jchan_vblank, 2)
752   MDRV_CPU_VBLANK_INT_HACK(jchan_vblank, 2)
753753
754754   MDRV_CPU_ADD(M68000, 16000000)
755755   MDRV_CPU_PROGRAM_MAP(jchan_sub,0)
src/mame/drivers/jailbrek.c
r1877r1878
243243   /* basic machine hardware */
244244   MDRV_CPU_ADD(M6809, MASTER_CLOCK/12)
245245   MDRV_CPU_PROGRAM_MAP(jailbrek_map, 0)
246   MDRV_CPU_VBLANK_INT(jb_interrupt,1)
246   MDRV_CPU_VBLANK_INT("main", jb_interrupt)
247247   MDRV_CPU_PERIODIC_INT(jb_interrupt_nmi, 500) /* ? */
248248
249249   MDRV_MACHINE_START(jailbrek)
src/mame/drivers/couple.c
r1877r1878
5454---- ---- xxxx xxxx tile number
5555*/
5656
57static WRITE8_HANDLER( couple_mc6845_address_w )
58{
59   mc6845_address_w(mc6845, data);
60}
61
62static WRITE8_HANDLER( couple_mc6845_register_w )
63{
64   mc6845_register_w(mc6845, data);
65}
66
6757static TILE_GET_INFO( get_tile_info )
6858{
6959   UINT16 vram_data = (((vram_hi[tile_index] & 0xff) << 8) | (vram_lo[tile_index] & 0xff));
r1877r1878
158148//  AM_RANGE( 0xc000, 0xc00f ) AM_READ(dummy_inputs_r)
159149//  AM_RANGE( 0xc008, 0xc008 ) AM_READ(input_port_0_r)
160150//  AM_RANGE( 0xc00a, 0xc00a ) AM_READ(input_port_1_r)
161     AM_RANGE( 0xe000, 0xe000 ) AM_WRITE(couple_mc6845_address_w)
162     AM_RANGE( 0xe001, 0xe001 ) AM_WRITE(couple_mc6845_register_w)
151     AM_RANGE( 0xe000, 0xe000 ) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
152     AM_RANGE( 0xe001, 0xe001 ) AM_DEVWRITE(MC6845, "crtc", mc6845_register_w)
163153   AM_RANGE( 0xe800, 0xefff ) AM_READWRITE(MRA8_RAM, couple_vram_hi_w) AM_BASE(&vram_hi)
164154   AM_RANGE( 0xf000, 0xf7ff ) AM_READWRITE(MRA8_RAM, couple_vram_lo_w) AM_BASE(&vram_lo)
165155   AM_RANGE( 0xf800, 0xfbff ) AM_RAM /*extra VRAM?*/
r1877r1878
445435   MDRV_CPU_ADD(Z80,18432000/6)       /* ?? */
446436   MDRV_CPU_PROGRAM_MAP(merit_mem,0)
447437   MDRV_CPU_IO_MAP(merit_io,0)
448   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
438   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
449439
450440   MDRV_MACHINE_RESET(couple)
451441
src/mame/drivers/sgladiat.c
r1877r1878
6161static WRITE8_HANDLER( sgladiat_soundlatch_w )
6262{
6363   snk_sound_busy_bit = 0x20;
64   soundlatch_w( offset, data );
64   soundlatch_w( machine, offset, data );
6565
6666   /* trigger NMI on sound CPU */
67   cpunum_set_input_line(Machine, 2, INPUT_LINE_NMI, PULSE_LINE);   // safer because NMI can be lost in rare occations
67   cpunum_set_input_line(machine, 2, INPUT_LINE_NMI, PULSE_LINE);   // safer because NMI can be lost in rare occations
6868}
6969
7070static READ8_HANDLER( sgladiat_soundlatch_r )
7171{
7272   snk_sound_busy_bit = 0;
73   return(soundlatch_r(0));
73   return(soundlatch_r(machine,0));
7474}
7575
7676static READ8_HANDLER( sgladiat_sound_nmi_ack_r )
r1877r1878
147147   /* basic machine hardware */
148148   MDRV_CPU_ADD(Z80, 4000000)
149149   MDRV_CPU_PROGRAM_MAP(sgladiat_cpuA_map,0)
150//  MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
150//  MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
151151
152152   MDRV_CPU_ADD(Z80, 5000000)
153153   MDRV_CPU_PROGRAM_MAP(sgladiat_cpuB_map,0)
154   MDRV_CPU_VBLANK_INT(snk_irq_BA,1)
154   MDRV_CPU_VBLANK_INT("main", snk_irq_BA)
155155
156156   MDRV_CPU_ADD(Z80, 4000000)
157157   MDRV_CPU_PROGRAM_MAP(sgladiat_sound_map,0)
src/mame/drivers/mlanding.c
r1877r1878
1313static UINT16 * ml_tileram;
1414static UINT16 * ml_spriteram;
1515static UINT16 * ml_unk;
16static mame_bitmap *ml_bitmap[8];
16static bitmap_t *ml_bitmap[8];
1717#define ML_CHARS 0x2000
1818static UINT8 dirtychar[ML_CHARS];
1919static int status_bit;
r1877r1878
363363   /* basic machine hardware */
364364   MDRV_CPU_ADD(M68000, 12000000 )      /* 12 MHz ??? (guess) */
365365   MDRV_CPU_PROGRAM_MAP(mlanding_mem, 0)
366   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
366   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
367367
368368   MDRV_CPU_ADD(Z80, 4000000 )      /* 4 MHz ??? (guess) */
369369   MDRV_CPU_PROGRAM_MAP(mlanding_z80_mem,0)
370370
371371   MDRV_CPU_ADD(M68000, 12000000 )      /* 12 MHz ??? (guess) */
372372   MDRV_CPU_PROGRAM_MAP(mlanding_sub_mem,0)
373   MDRV_CPU_VBLANK_INT(irq6_line_hold,7)
373   MDRV_CPU_VBLANK_INT_HACK(irq6_line_hold,7)
374374
375375   MDRV_CPU_ADD(Z80, 4000000 )      /* 4 MHz ??? (guess) */
376376   MDRV_CPU_PROGRAM_MAP(mlanding_z80_sub_mem,0)
377   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
377   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
378378
379379   /* video hardware */
380380   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/gaelco.c
r1877r1878
7777static WRITE16_HANDLER( bigkarnk_sound_command_w )
7878{
7979   if (ACCESSING_LSB){
80      soundlatch_w(0,data & 0xff);
81      cpunum_set_input_line(Machine, 1,M6809_FIRQ_LINE,HOLD_LINE);
80      soundlatch_w(machine,0,data & 0xff);
81      cpunum_set_input_line(machine, 1,M6809_FIRQ_LINE,HOLD_LINE);
8282   }
8383}
8484
r1877r1878
211211TILELAYOUT8(0x100000);
212212TILELAYOUT16(0x100000);
213213
214GFXDECODEINFO(0x100000,64);
214GFXDECODEINFO(0x100000,64)
215215
216216
217217static MACHINE_DRIVER_START( bigkarnk )
r1877r1878
219219   /* basic machine hardware */
220220   MDRV_CPU_ADD(M68000, 10000000)   /* MC68000P10, 10 MHz */
221221   MDRV_CPU_PROGRAM_MAP(bigkarnk_readmem,bigkarnk_writemem)
222   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
222   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
223223
224224   MDRV_CPU_ADD(M6809, 8867000/4)   /* 68B09, 2.21675 MHz? */
225225   /* audio CPU */
r1877r1878
474474   /* basic machine hardware */
475475   MDRV_CPU_ADD(M68000,24000000/2)         /* 12 MHz */
476476   MDRV_CPU_PROGRAM_MAP(maniacsq_readmem,maniacsq_writemem)
477   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
477   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
478478
479479   /* video hardware */
480480   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
11101110   /* basic machine hardware */
11111111   MDRV_CPU_ADD(M68000, 12000000)   /* MC68000P12, 12 MHz */
11121112   MDRV_CPU_PROGRAM_MAP(squash_readmem,squash_writemem)
1113   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
1113   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
11141114
11151115   MDRV_INTERLEAVE(10)
11161116
r1877r1878
12781278   /* basic machine hardware */
12791279   MDRV_CPU_ADD(M68000, 12000000)   /* MC68000P12, 12 MHz */
12801280   MDRV_CPU_PROGRAM_MAP(squash_readmem,thoop_writemem)
1281   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
1281   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
12821282
12831283   MDRV_INTERLEAVE(10)
12841284
src/mame/drivers/bankp.c
r1877r1878
275275   MDRV_CPU_ADD(Z80, BANKP_CPU_CLOCK)
276276   MDRV_CPU_PROGRAM_MAP(bankp_map, 0)
277277   MDRV_CPU_IO_MAP(bankp_io_map, 0)
278   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
278   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
279279
280280   /* video hardware */
281281   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/tankbust.c
r1877r1878
9191   switch (offset)
9292   {
9393   case 0:   /* 0xe000 interrupt enable */
94      interrupt_enable_w(0,data);
94      interrupt_enable_w(machine,0,data);
9595   break;
9696
9797   case 1:   /* 0xe001 (value 0 then 1) written right after the soundlatch_w */
r1877r1878
369369   /* basic machine hardware */
370370   MDRV_CPU_ADD(Z80, 4000000)      /* 4 MHz ? */
371371   MDRV_CPU_PROGRAM_MAP( readmem, writemem )
372   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
372   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
373373
374374   MDRV_CPU_ADD(Z80, 4000000)      /* 3.072 MHz ? */
375375   MDRV_CPU_PROGRAM_MAP( readmem2, writemem2 )
src/mame/drivers/wecleman.c
r1877r1878
408408{
409409   switch ( (wecleman_selected_ip >> 5) & 3 )
410410   {                                    // From WEC Le Mans Schems:
411      case 0:  return input_port_4_r(offset);      // Accel - Schems: Accelevr
411      case 0:  return input_port_4_r(machine, offset);      // Accel - Schems: Accelevr
412412      case 1:  return ~0;                     // ????? - Schems: Not Used
413      case 2:  return input_port_5_r(offset);      // Wheel - Schems: Handlevr
413      case 2:  return input_port_5_r(machine, offset);      // Wheel - Schems: Handlevr
414414      case 3:  return ~0;                     // Table - Schems: Turnvr
415415
416416      default: return ~0;
r1877r1878
563563
564564static READ16_HANDLER( hotchase_K051316_0_r )
565565{
566   return K051316_0_r(offset) & 0xff;
566   return K051316_0_r(machine, offset) & 0xff;
567567}
568568
569569static READ16_HANDLER( hotchase_K051316_1_r )
570570{
571   return K051316_1_r(offset) & 0xff;
571   return K051316_1_r(machine, offset) & 0xff;
572572}
573573
574574static WRITE16_HANDLER( hotchase_K051316_0_w )
575575{
576   if (ACCESSING_LSB)      K051316_0_w(offset, data & 0xff);
576   if (ACCESSING_LSB)      K051316_0_w(machine, offset, data & 0xff);
577577}
578578
579579static WRITE16_HANDLER( hotchase_K051316_1_w )
580580{
581   if (ACCESSING_LSB)      K051316_1_w(offset, data & 0xff);
581   if (ACCESSING_LSB)      K051316_1_w(machine, offset, data & 0xff);
582582}
583583
584584static WRITE16_HANDLER( hotchase_K051316_ctrl_0_w )
585585{
586   if (ACCESSING_LSB)      K051316_ctrl_0_w(offset, data & 0xff);
586   if (ACCESSING_LSB)      K051316_ctrl_0_w(machine, offset, data & 0xff);
587587}
588588
589589static WRITE16_HANDLER( hotchase_K051316_ctrl_1_w )
590590{
591   if (ACCESSING_LSB)      K051316_ctrl_1_w(offset, data & 0xff);
591   if (ACCESSING_LSB)      K051316_ctrl_1_w(machine, offset, data & 0xff);
592592}
593593
594594static WRITE16_HANDLER( hotchase_soundlatch_w );
r1877r1878
651651{
652652   if (ACCESSING_LSB)
653653   {
654      soundlatch_w(0,data & 0xFF);
655      cpunum_set_input_line(Machine, 2,0, HOLD_LINE);
654      soundlatch_w(machine,0,data & 0xFF);
655      cpunum_set_input_line(machine, 2,0, HOLD_LINE);
656656   }
657657}
658658
r1877r1878
719719{
720720   if (ACCESSING_LSB)
721721   {
722      soundlatch_w(0,data & 0xFF);
723      cpunum_set_input_line(Machine, 2,M6809_IRQ_LINE, HOLD_LINE);
722      soundlatch_w(machine,0,data & 0xFF);
723      cpunum_set_input_line(machine, 2,M6809_IRQ_LINE, HOLD_LINE);
724724   }
725725}
726726
r1877r1878
791791#define HOTCHASE_K007232_RW(_chip_) \
792792static READ8_HANDLER( hotchase_K007232_##_chip_##_r ) \
793793{ \
794   return K007232_read_port_##_chip_##_r(offset ^ 1); \
794   return K007232_read_port_##_chip_##_r(machine, offset ^ 1); \
795795} \
796796static WRITE8_HANDLER( hotchase_K007232_##_chip_##_w ) \
797797{ \
798   K007232_write_port_##_chip_##_w(offset ^ 1, data); \
798   K007232_write_port_##_chip_##_w(machine, offset ^ 1, data); \
799799} \
800800
801801/* 3 x K007232 */
r1877r1878
11151115   /* basic machine hardware */
11161116   MDRV_CPU_ADD(M68000, 10000000)   /* Schems show 10MHz */
11171117   MDRV_CPU_PROGRAM_MAP(wecleman_map,0)
1118   MDRV_CPU_VBLANK_INT(wecleman_interrupt,5 + 1)   /* in order to read the inputs once per frame */
1118   MDRV_CPU_VBLANK_INT_HACK(wecleman_interrupt,5 + 1)   /* in order to read the inputs once per frame */
11191119
11201120   MDRV_CPU_ADD(M68000, 10000000)   /* Schems show 10MHz */
11211121   MDRV_CPU_PROGRAM_MAP(wecleman_sub_map,0)
r1877r1878
11721172   /* basic machine hardware */
11731173   MDRV_CPU_ADD(M68000, 10000000)   /* 10 MHz - PCB is drawn in one set's readme */
11741174   MDRV_CPU_PROGRAM_MAP(hotchase_map,0)
1175   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
1175   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
11761176
11771177   MDRV_CPU_ADD(M68000, 10000000)   /* 10 MHz - PCB is drawn in one set's readme */
11781178   MDRV_CPU_PROGRAM_MAP(hotchase_sub_map,0)
src/mame/drivers/crbaloon.c
r1877r1878
166166   sound_global_enable((data & 0x02) ? TRUE : FALSE);
167167
168168   /* D2 - unlabeled - music enable */
169   crbaloon_audio_set_music_enable((data & 0x04) ? TRUE : FALSE);
169   crbaloon_audio_set_music_enable(machine, (data & 0x04) ? TRUE : FALSE);
170170
171171   /* D3 - EXPLOSION */
172172   crbaloon_audio_set_explosion_enable((data & 0x08) ? TRUE : FALSE);
r1877r1878
178178   crbaloon_audio_set_appear_enable((data & 0x20) ? TRUE : FALSE);
179179
180180   /* D6 - unlabeled - laugh enable */
181   crbaloon_audio_set_laugh_enable((data & 0x40) ? TRUE : FALSE);
181   crbaloon_audio_set_laugh_enable(machine, (data & 0x40) ? TRUE : FALSE);
182182
183183   /* D7 - unlabeled - goes to PC3259 pin 16 */
184184
r1877r1878
188188
189189static WRITE8_HANDLER( port_music_w )
190190{
191   crbaloon_audio_set_music_freq(data);
191   crbaloon_audio_set_music_freq(machine, data);
192192}
193193
194194
r1877r1878
220220   ADDRESS_MAP_FLAGS( AMEF_ABITS(4) )
221221   AM_RANGE(0x00, 0x00) AM_MIRROR(0x0c) AM_READ(port_tag_to_handler8("DSW0"))
222222   AM_RANGE(0x01, 0x01) AM_MIRROR(0x0c) AM_READ(port_tag_to_handler8("IN0"))
223/*  AM_SPACE(0x02, 0x03) AM_READ(pc3259_r) crashes if not at the end */
223   AM_RANGE(0x02, 0x02) AM_MIRROR(0x0c) AM_MASK(0x0c) AM_READ(pc3259_r)
224//  AM_SPACE(0x02, 0x03) AM_READ(pc3259_r) crashes if not at the end
224225   AM_RANGE(0x03, 0x03) AM_MIRROR(0x0c) AM_READ(port_tag_to_handler8("IN1"))
225226
226227   AM_RANGE(0x00, 0x00) AM_WRITE(MWA8_NOP)   /* not connected */
r1877r1878
232233   AM_RANGE(0x0c, 0x0c) AM_WRITE(MWA8_NOP) /* MSK - to PC3259 */
233234   AM_RANGE(0x0d, 0x0d) AM_WRITE(MWA8_NOP) /* schematics has it in a box marked "NOT USE" */
234235   AM_RANGE(0x0e, 0x0f) AM_WRITE(MWA8_NOP)
235
236   AM_SPACE(0x02, 0x03) AM_READ(pc3259_r)
237236ADDRESS_MAP_END
238237
239238
r1877r1878
347346static MACHINE_RESET( crballoon )
348347{
349348   pc3092_reset();
350   port_sound_w(0, 0);
351   port_music_w(0, 0);
349   port_sound_w(machine, 0, 0);
350   port_music_w(machine, 0, 0);
352351}
353352
354353
r1877r1878
365364   MDRV_CPU_ADD(Z80, CRBALOON_MASTER_XTAL / 3)
366365   MDRV_CPU_PROGRAM_MAP(main_map,0)
367366   MDRV_CPU_IO_MAP(main_io_map,0)
368   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
367   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
369368
370369   MDRV_MACHINE_RESET(crballoon)
371370
src/mame/drivers/dmndrby.c
r1877r1878
178178   /* basic machine hardware */
179179   MDRV_CPU_ADD(Z80,8000000)       /* ? MHz */
180180   MDRV_CPU_PROGRAM_MAP(memmap,0)
181   MDRV_CPU_VBLANK_INT(dderby_interrupt,1)
181   MDRV_CPU_VBLANK_INT("main", dderby_interrupt)
182182
183183   /* video hardware */
184184   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/pastelg.c
r1877r1878
204204   MDRV_CPU_ADD(Z80, 19968000/8)   /* 2.496 MHz ? */
205205   MDRV_CPU_PROGRAM_MAP(readmem_pastelg, writemem_pastelg)
206206   MDRV_CPU_IO_MAP(readport_pastelg, writeport_pastelg)
207//  MDRV_CPU_VBLANK_INT(nb1413m3_interrupt,96)  // nmiclock not written, chip is 1411M1 instead of 1413M3
208   MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 1)
207//  MDRV_CPU_VBLANK_INT_HACK(nb1413m3_interrupt,96)  // nmiclock not written, chip is 1411M1 instead of 1413M3
208   MDRV_CPU_VBLANK_INT("main", nb1413m3_interrupt)
209209
210210   MDRV_MACHINE_RESET(nb1413m3)
211211   MDRV_NVRAM_HANDLER(nb1413m3)
src/mame/drivers/seattle.c
r1877r1878
469469static void update_vblank_irq(void);
470470static void galileo_reset(void);
471471static TIMER_CALLBACK( galileo_timer_callback );
472static void galileo_perform_dma(int which);
472static void galileo_perform_dma(running_machine *machine, int which);
473473static void voodoo_stall(int stall);
474474static void widget_reset(void);
475475static void update_widget_irq(void);
r1877r1878
652652
653653static READ32_HANDLER( interrupt_state2_r )
654654{
655   UINT32 result = interrupt_state_r(offset, mem_mask);
655   UINT32 result = interrupt_state_r(machine, offset, mem_mask);
656656   result |= vblank_state << 8;
657657   return result;
658658}
r1877r1878
973973}
974974
975975
976static void galileo_perform_dma(int which)
976static void galileo_perform_dma(running_machine *machine, int which)
977977{
978978   do
979979   {
r1877r1878
10241024            }
10251025
10261026            /* write the data and advance */
1027            voodoo_0_w((dstaddr & 0xffffff) / 4, program_read_dword(srcaddr), 0);
1027            voodoo_0_w(machine, (dstaddr & 0xffffff) / 4, program_read_dword(srcaddr), 0);
10281028            srcaddr += srcinc;
10291029            dstaddr += dstinc;
10301030            bytesleft -= 4;
r1877r1878
11881188
11891189         /* if enabling, start the DMA */
11901190         if (!(oldata & 0x1000) && (data & 0x1000))
1191            galileo_perform_dma(which);
1191            galileo_perform_dma(machine, which);
11921192         break;
11931193      }
11941194
r1877r1878
13061306   /* if we're not stalled, just write and get out */
13071307   if (!voodoo_stalled)
13081308   {
1309      voodoo_0_w(offset, data, mem_mask);
1309      voodoo_0_w(machine, offset, data, mem_mask);
13101310      return;
13111311   }
13121312
r1877r1878
13621362
13631363            /* resume execution */
13641364            cpuintrf_push_context(0);
1365            galileo_perform_dma(which);
1365            galileo_perform_dma(Machine, which);
13661366            cpuintrf_pop_context();
13671367            break;
13681368         }
r1877r1878
13721372      {
13731373         /* if the CPU had a pending write, do it now */
13741374         if (cpu_stalled_on_voodoo)
1375            voodoo_0_w(cpu_stalled_offset, cpu_stalled_data, cpu_stalled_mem_mask);
1375            voodoo_0_w(Machine, cpu_stalled_offset, cpu_stalled_data, cpu_stalled_mem_mask);
13761376         cpu_stalled_on_voodoo = FALSE;
13771377
13781378         /* resume CPU execution */
r1877r1878
14731473static READ32_HANDLER( ethernet_r )
14741474{
14751475   if (!(offset & 8))
1476      return smc91c94_r(offset & 7, mem_mask | 0x0000);
1476      return smc91c94_r(machine, offset & 7, mem_mask | 0x0000);
14771477   else
1478      return smc91c94_r(offset & 7, mem_mask | 0xff00);
1478      return smc91c94_r(machine, offset & 7, mem_mask | 0xff00);
14791479}
14801480
14811481
14821482static WRITE32_HANDLER( ethernet_w )
14831483{
14841484   if (!(offset & 8))
1485      smc91c94_w(offset & 7, data & 0xffff, mem_mask | 0x0000);
1485      smc91c94_w(machine, offset & 7, data & 0xffff, mem_mask | 0x0000);
14861486   else
1487      smc91c94_w(offset & 7, data & 0x00ff, mem_mask | 0xff00);
1487      smc91c94_w(machine, offset & 7, data & 0x00ff, mem_mask | 0xff00);
14881488}
14891489
14901490
r1877r1878
15321532         break;
15331533
15341534      case WREG_ANALOG:
1535         result = analog_port_r(0, mem_mask);
1535         result = analog_port_r(machine, 0, mem_mask);
15361536         break;
15371537
15381538      case WREG_ETHER_DATA:
1539         result = smc91c94_r(widget.ethernet_addr & 7, mem_mask & 0xffff);
1539         result = smc91c94_r(machine, widget.ethernet_addr & 7, mem_mask & 0xffff);
15401540         break;
15411541   }
15421542
r1877r1878
15631563         break;
15641564
15651565      case WREG_ANALOG:
1566         analog_port_w(0, data, mem_mask);
1566         analog_port_w(machine, 0, data, mem_mask);
15671567         break;
15681568
15691569      case WREG_ETHER_DATA:
1570         smc91c94_w(widget.ethernet_addr & 7, data & 0xffff, mem_mask & 0xffff);
1570         smc91c94_w(machine, widget.ethernet_addr & 7, data & 0xffff, mem_mask & 0xffff);
15711571         break;
15721572   }
15731573}
src/mame/drivers/portrait.c
r1877r1878
250250static MACHINE_DRIVER_START( portrait )
251251   MDRV_CPU_ADD(Z80, 4000000)     /* 4 MHz ? */
252252   MDRV_CPU_PROGRAM_MAP(portrait_map,0)
253   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
253   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
254254
255255   MDRV_CPU_ADD(I8039, 3120000)  /* ? */
256256   /* audio CPU */
src/mame/drivers/munchmo.c
r1877r1878
5858
5959static WRITE8_HANDLER( mnchmobl_soundlatch_w )
6060{
61   soundlatch_w( offset, data );
62   cpunum_set_input_line(Machine, 1, 0, HOLD_LINE );
61   soundlatch_w( machine, offset, data );
62   cpunum_set_input_line(machine, 1, 0, HOLD_LINE );
6363}
6464
6565static WRITE8_HANDLER( sound_nmi_ack_w )
r1877r1878
283283   /* basic machine hardware */
284284   MDRV_CPU_ADD(Z80, 3750000) /* ? */
285285   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
286   MDRV_CPU_VBLANK_INT(mnchmobl_interrupt,2)
286   MDRV_CPU_VBLANK_INT_HACK(mnchmobl_interrupt,2)
287287
288288   MDRV_CPU_ADD(Z80, 3750000) /* ? */
289289   /* audio CPU */
290290   MDRV_CPU_PROGRAM_MAP(readmem_sound,writemem_sound)
291   MDRV_CPU_VBLANK_INT(nmi_line_assert,1)
291   MDRV_CPU_VBLANK_INT("main", nmi_line_assert)
292292
293293   /* video hardware */
294294   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/funkybee.c
r1877r1878
9393
9494static READ8_HANDLER( funkybee_input_port_0_r )
9595{
96   watchdog_reset_r(0);
97   return input_port_0_r(offset);
96   watchdog_reset_r(machine,0);
97   return input_port_0_r(machine,offset);
9898}
9999
100100static WRITE8_HANDLER( funkybee_coin_counter_w )
r1877r1878
187187   PORT_DIPSETTING(   0x80, DEF_STR( Cocktail ) )
188188INPUT_PORTS_END
189189
190#ifdef UNUSED_DEFINITION
190191static INPUT_PORTS_START( funkbeeb )
191192   PORT_INCLUDE(funkybee)
192193
r1877r1878
197198   PORT_DIPSETTING(   0x10, "3" )
198199   PORT_DIPSETTING(   0x00, "4" )
199200INPUT_PORTS_END
201#endif
200202
201203static INPUT_PORTS_START( skylancr )
202204   PORT_START_TAG("IN0")
r1877r1878
306308   MDRV_CPU_ADD(Z80, 3072000)   /* 3.072 MHz */
307309   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
308310   MDRV_CPU_IO_MAP(readport,writeport)
309   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
311   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
310312
311313   /* video hardware */
312314   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/btoads.c
r1877r1878
172172{
173173   UINT16 reg = offset >> 8;
174174   UINT16 val = ((offset & 0xff) << 8) | data;
175   BSMT2000_data_0_w(reg, val, 0);
175   BSMT2000_data_0_w(machine, reg, val, 0);
176176}
177177
178178
src/mame/drivers/tetrisp2.c
r1877r1878
143143
144144static READ16_HANDLER( tetrisp2_sound_r )
145145{
146   return YMZ280B_status_0_r(offset);
146   return YMZ280B_status_0_r(machine,offset);
147147}
148148
149149static WRITE16_HANDLER( tetrisp2_sound_w )
150150{
151151   if (ACCESSING_LSB)
152152   {
153      if (offset)   YMZ280B_data_0_w     (offset, data & 0xff);
154      else      YMZ280B_register_0_w (offset, data & 0xff);
153      if (offset)   YMZ280B_data_0_w     (machine, offset, data & 0xff);
154      else      YMZ280B_register_0_w (machine, offset, data & 0xff);
155155   }
156156}
157157
r1877r1878
10371037   /* basic machine hardware */
10381038   MDRV_CPU_ADD(M68000, 12000000)
10391039   MDRV_CPU_PROGRAM_MAP(tetrisp2_readmem,tetrisp2_writemem)
1040   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
1040   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
10411041
10421042   MDRV_NVRAM_HANDLER(tetrisp2)
10431043
r1877r1878
10691069   /* basic machine hardware */
10701070   MDRV_CPU_ADD(M68000, 12000000)
10711071   MDRV_CPU_PROGRAM_MAP(rockn1_readmem,rockn1_writemem)
1072   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
1072   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
10731073
10741074   MDRV_NVRAM_HANDLER(tetrisp2)
10751075
r1877r1878
11031103   /* basic machine hardware */
11041104   MDRV_CPU_ADD(M68000, 12000000)
11051105   MDRV_CPU_PROGRAM_MAP(rockn2_readmem,rockn2_writemem)
1106   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
1106   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
11071107
11081108   MDRV_NVRAM_HANDLER(tetrisp2)
11091109
r1877r1878
11361136   /* basic machine hardware */
11371137   MDRV_CPU_ADD(M68000, 12000000)
11381138   MDRV_CPU_PROGRAM_MAP(rocknms_main_readmem,rocknms_main_writemem)
1139   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
1139   MDRV_CPU_VBLANK_INT("left", irq2_line_hold)
11401140
11411141   MDRV_CPU_ADD(M68000, 12000000)
11421142   MDRV_CPU_PROGRAM_MAP(rocknms_sub_readmem,rocknms_sub_writemem)
1143   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
1143   MDRV_CPU_VBLANK_INT("left", irq2_line_hold)
11441144
11451145   MDRV_NVRAM_HANDLER(tetrisp2)
11461146
src/mame/drivers/lastduel.c
r1877r1878
4040static WRITE16_HANDLER( lastduel_sound_w )
4141{
4242   if (ACCESSING_LSB)
43      soundlatch_w(0,data & 0xff);
43      soundlatch_w(machine,0,data & 0xff);
4444}
4545
4646/******************************************************************************/
r1877r1878
261261   /* basic machine hardware */
262262   MDRV_CPU_ADD(M68000, 10000000) /* Could be 8 MHz */
263263   MDRV_CPU_PROGRAM_MAP(lastduel_readmem,lastduel_writemem)
264   MDRV_CPU_VBLANK_INT(lastduel_interrupt,3)   /* 1 for vbl, 2 for control reads?? */
264   MDRV_CPU_VBLANK_INT_HACK(lastduel_interrupt,3)   /* 1 for vbl, 2 for control reads?? */
265265
266266   MDRV_CPU_ADD(Z80, 3579545)
267267   /* audio CPU */ /* Accurate */
r1877r1878
301301   /* basic machine hardware */
302302   MDRV_CPU_ADD(M68000, 10000000) /* Accurate */
303303   MDRV_CPU_PROGRAM_MAP(madgear_readmem,madgear_writemem)
304   MDRV_CPU_VBLANK_INT(madgear_interrupt,3)   /* 1 for vbl, 2 for control reads?? */
304   MDRV_CPU_VBLANK_INT_HACK(madgear_interrupt,3)   /* 1 for vbl, 2 for control reads?? */
305305
306306   MDRV_CPU_ADD(Z80, XTAL_3_579545MHz) /* verified on pcb */
307307   /* audio CPU */
src/mame/drivers/alpha68k.c
r1877r1878
323323static WRITE16_HANDLER( kyros_sound_w )
324324{
325325   if(ACCESSING_MSB)
326      soundlatch_w(0, (data>>8)&0xff);
326      soundlatch_w(machine, 0, (data>>8)&0xff);
327327}
328328
329329static WRITE16_HANDLER( alpha68k_II_sound_w )
330330{
331331   if(ACCESSING_LSB)
332      soundlatch_w(0, data&0xff);
332      soundlatch_w(machine, 0, data&0xff);
333333}
334334
335335static WRITE16_HANDLER( alpha68k_V_sound_w )
336336{
337337   /* Sound & fix bank select are in the same word */
338338   if(ACCESSING_LSB)
339      soundlatch_w(0,data&0xff);
339      soundlatch_w(machine,0,data&0xff);
340340   if(ACCESSING_MSB)
341341      alpha68k_V_video_bank_w((data>>8)&0xff);
342342}
r1877r1878
345345{
346346   if (ACCESSING_LSB)
347347   {
348      soundlatch_w(0, data);
348      soundlatch_w(machine, 0, data);
349349      cpunum_set_input_line(Machine, 1, 0, HOLD_LINE);
350350   }
351351}
r1877r1878
354354{
355355   if (ACCESSING_LSB)
356356   {
357      soundlatch_w(0, data);
357      soundlatch_w(machine, 0, data);
358358      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
359359   }
360360}
r1877r1878
19861986   /* basic machine hardware */
19871987   MDRV_CPU_ADD(M68000, 6000000) /* 24MHz/4? */
19881988   MDRV_CPU_PROGRAM_MAP(kyros_map,0)
1989   MDRV_CPU_VBLANK_INT(alpha68k_interrupt,2)
1989   MDRV_CPU_VBLANK_INT_HACK(alpha68k_interrupt,2)
19901990
19911991   MDRV_CPU_ADD(Z80, 3579545)
19921992   /* audio CPU */ /* ? */
19931993   MDRV_CPU_PROGRAM_MAP(sstingry_sound_map,0)
19941994   MDRV_CPU_IO_MAP(kyros_sound_portmap,0)
19951995//AT
1996   MDRV_CPU_VBLANK_INT(irq0_line_hold, 2)
1996   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold, 2)
19971997   MDRV_CPU_PERIODIC_INT(nmi_line_pulse, 4000)
19981998//ZT
19991999
r1877r1878
20362036   /* basic machine hardware */
20372037   MDRV_CPU_ADD(M68000, 6000000) /* 24MHz/4? */
20382038   MDRV_CPU_PROGRAM_MAP(kyros_map,0)
2039   MDRV_CPU_VBLANK_INT(alpha68k_interrupt,2)
2039   MDRV_CPU_VBLANK_INT_HACK(alpha68k_interrupt,2)
20402040
20412041   MDRV_CPU_ADD(Z80, 3579545)
20422042   /* audio CPU */ /* ? */
20432043   MDRV_CPU_PROGRAM_MAP(kyros_sound_map,0)
20442044   MDRV_CPU_IO_MAP(kyros_sound_portmap,0)
20452045//AT
2046   MDRV_CPU_VBLANK_INT(irq0_line_hold, 2)
2046   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold, 2)
20472047   MDRV_CPU_PERIODIC_INT(nmi_line_pulse, 4000)
20482048//ZT
20492049
r1877r1878
20852085   /* basic machine hardware */
20862086   MDRV_CPU_ADD(M68000, 8000000)
20872087   MDRV_CPU_PROGRAM_MAP(kyros_map,0)
2088   MDRV_CPU_VBLANK_INT(alpha68k_interrupt,17) // must be at least 4 for the controls to be smooth
2088   MDRV_CPU_VBLANK_INT_HACK(alpha68k_interrupt,17) // must be at least 4 for the controls to be smooth
20892089
20902090   MDRV_CPU_ADD(Z80, 4000000)
20912091   MDRV_CPU_PROGRAM_MAP(jongbou_sound_map,0)
20922092   MDRV_CPU_IO_MAP(jongbou_sound_portmap,0)
2093   MDRV_CPU_VBLANK_INT(irq0_line_hold, 160) // guess, controls sound speed
2093   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold, 160) // guess, controls sound speed
20942094
20952095   MDRV_MACHINE_RESET(common)
20962096
r1877r1878
21202120   /* basic machine hardware */
21212121   MDRV_CPU_ADD(M68000, 6000000) /* 24MHz/4? */
21222122   MDRV_CPU_PROGRAM_MAP(alpha68k_I_map,0)
2123   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)/* VBL */
2123   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)/* VBL */
21242124
21252125   MDRV_CPU_ADD(Z80, 4000000) // 4Mhz seems to yield the correct tone
21262126   MDRV_CPU_PROGRAM_MAP(alpha68k_I_s_map,0)
r1877r1878
21522152   /* basic machine hardware */
21532153   MDRV_CPU_ADD_TAG("main", M68000, 8000000) /* Correct */
21542154   MDRV_CPU_PROGRAM_MAP(alpha68k_II_map,0)
2155   MDRV_CPU_VBLANK_INT(irq3_line_hold,1)/* VBL */
2155   MDRV_CPU_VBLANK_INT("main", irq3_line_hold)/* VBL */
21562156
21572157   MDRV_CPU_ADD(Z80, /*3579545*/3579545*2) /* Unlikely but needed to stop nested NMI's */
21582158   /* audio CPU */ /* Correct?? */
r1877r1878
21922192static MACHINE_DRIVER_START( btlfildb )
21932193   MDRV_IMPORT_FROM(alpha68k_II)
21942194   MDRV_CPU_MODIFY("main")
2195   MDRV_CPU_VBLANK_INT(alpha68k_interrupt,2)
2195   MDRV_CPU_VBLANK_INT_HACK(alpha68k_interrupt,2)
21962196MACHINE_DRIVER_END
21972197
21982198//AT
r1877r1878
22012201   /* basic machine hardware */
22022202   MDRV_CPU_ADD(M68000, 8000000)
22032203   MDRV_CPU_PROGRAM_MAP(alpha68k_II_map, 0)
2204   MDRV_CPU_VBLANK_INT(alpha68k_interrupt, 4)
2204   MDRV_CPU_VBLANK_INT_HACK(alpha68k_interrupt, 4)
22052205
22062206   MDRV_CPU_ADD(Z80, 4000000*2)
22072207   MDRV_CPU_PROGRAM_MAP(sound_map,0)
r1877r1878
22432243   /* basic machine hardware */
22442244   MDRV_CPU_ADD(M68000, 10000000) /* ? */
22452245   MDRV_CPU_PROGRAM_MAP(alpha68k_V_map,0)
2246   MDRV_CPU_VBLANK_INT(irq3_line_hold,1)/* VBL */
2246   MDRV_CPU_VBLANK_INT("main", irq3_line_hold)/* VBL */
22472247
22482248   MDRV_CPU_ADD(Z80, /*3579545*/3579545*2) /* Unlikely but needed to stop nested NMI's */
22492249   MDRV_CPU_PROGRAM_MAP(sound_map,0)
r1877r1878
22842284   /* basic machine hardware */
22852285   MDRV_CPU_ADD(M68000, 10000000) /* ? */
22862286   MDRV_CPU_PROGRAM_MAP(alpha68k_V_map,0)
2287   MDRV_CPU_VBLANK_INT(irq3_line_hold,1)/* VBL */
2287   MDRV_CPU_VBLANK_INT("main", irq3_line_hold)/* VBL */
22882288
22892289   MDRV_CPU_ADD(Z80, /*3579545*/3579545*2) /* Unlikely but needed to stop nested NMI's */
22902290   MDRV_CPU_PROGRAM_MAP(sound_map,0)
r1877r1878
23252325   /* basic machine hardware */
23262326   MDRV_CPU_ADD(M68000, 9000000) /* Confirmed 18 MHz/2 */
23272327   MDRV_CPU_PROGRAM_MAP(tnexspce_map,0)
2328   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)/* VBL */
2328   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)/* VBL */
23292329
23302330   MDRV_CPU_ADD(Z80, 4000000)
23312331   MDRV_CPU_PROGRAM_MAP(tnexspce_sound_map,0)
src/mame/drivers/drgnmst.c
r1877r1878
7070
7171   switch (drgnmst_oki_control & 0x1f)
7272   {
73      case 0x12:   data = (OKIM6295_status_1_r(0) & 0x0f); break;
74      case 0x16:   data = (OKIM6295_status_0_r(0) & 0x0f); break;
73      case 0x12:   data = (OKIM6295_status_1_r(machine, 0) & 0x0f); break;
74      case 0x16:   data = (OKIM6295_status_0_r(machine, 0) & 0x0f); break;
7575      case 0x0b:
7676      case 0x0f:   data = drgnmst_snd_command; break;
7777      default:   break;
r1877r1878
151151      case 0x11:
152152//                  logerror("Writing %02x to OKI1",drgnmst_oki_command);
153153//                  logerror(", PortC=%02x, Code=%02x, Bank0=%01x, Bank1=%01x\n",drgnmst_oki_control,drgnmst_snd_command,drgnmst_oki0_bank,drgnmst_oki1_bank);
154               OKIM6295_data_1_w(0, drgnmst_oki_command);
154               OKIM6295_data_1_w(machine, 0, drgnmst_oki_command);
155155               break;
156156      case 0x15:
157157//                  logerror("Writing %02x to OKI0",drgnmst_oki_command);
158158//                  logerror(", PortC=%02x, Code=%02x, Bank0=%01x, Bank1=%01x\n",drgnmst_oki_control,drgnmst_snd_command,drgnmst_oki0_bank,drgnmst_oki1_bank);
159               OKIM6295_data_0_w(0, drgnmst_oki_command);
159               OKIM6295_data_0_w(machine, 0, drgnmst_oki_command);
160160               break;
161161      default:   break;
162162   }
r1877r1878
360360static MACHINE_DRIVER_START( drgnmst )
361361   MDRV_CPU_ADD(M68000, 12000000) /* Confirmed */
362362   MDRV_CPU_PROGRAM_MAP(drgnmst_main_map, 0)
363   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
363   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
364364
365365   MDRV_CPU_ADD(PIC16C55, 32000000/8)   /* Confirmed */
366366   /* Program and Data Maps are internal to the MCU */
src/mame/drivers/lucky8.c
r1877r1878
356356   // basic machine hardware
357357   MDRV_CPU_ADD(Z80, 12000000/4)   // ??? Runs far too fast
358358   MDRV_CPU_PROGRAM_MAP(lucky8_map, 0)
359   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
359   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
360360
361361   // video hardware
362362
src/mame/drivers/starfire.c
r1877r1878
5050
5151
5252static UINT8 fireone_select;
53static read8_handler input_read;
53static read8_machine_func input_read;
5454
5555
5656
r1877r1878
6767   {
6868      switch (offset & 7)
6969      {
70         case 0:   starfire_vidctrl_w(0, data); break;
71         case 1: starfire_vidctrl1_w(0, data); break;
70         case 0:   starfire_vidctrl_w(machine, 0, data); break;
71         case 1: starfire_vidctrl1_w(machine, 0, data); break;
7272         case 2:
7373            /* Sounds */
7474            fireone_select = (data & 0x8) ? 0 : 1;
r1877r1878
8686{
8787   /* A11 selects input ports */
8888   if (offset & 0x800)
89      return (*input_read)(offset);
89      return (*input_read)(machine, offset);
9090
9191   /* convert to a videoram offset */
9292   offset = (offset & 0x31f) | ((offset & 0xe0) << 5);
r1877r1878
105105{
106106   switch (offset & 15)
107107   {
108      case 0:   return input_port_0_r(0);
109      case 1:   return input_port_1_r(0);   /* Note: need to loopback sounds lengths on that one */
110      case 5: return input_port_4_r(0);
111      case 6:   return input_port_2_r(0);
112      case 7:   return input_port_3_r(0);
108      case 0:   return input_port_0_r(machine,0);
109      case 1:   return input_port_1_r(machine,0);   /* Note: need to loopback sounds lengths on that one */
110      case 5: return input_port_4_r(machine,0);
111      case 6:   return input_port_2_r(machine,0);
112      case 7:   return input_port_3_r(machine,0);
113113      default: return 0xff;
114114   }
115115}
r1877r1878
132132
133133   switch (offset & 15)
134134   {
135      case 0:   return input_port_0_r(0);
136      case 1: return input_port_1_r(0);
135      case 0:   return input_port_0_r(machine,0);
136      case 1: return input_port_1_r(machine,0);
137137      case 2:
138         temp = fireone_select ? input_port_2_r(0) : input_port_3_r(0);
138         temp = fireone_select ? input_port_2_r(machine,0) : input_port_3_r(machine,0);
139139         temp = (temp & 0xc0) | fireone_paddle_map[temp & 0x3f];
140140         return temp;
141141      default: return 0xff;
r1877r1878
265265   /* basic machine hardware */
266266   MDRV_CPU_ADD(Z80, STARFIRE_CPU_CLOCK)
267267   MDRV_CPU_PROGRAM_MAP(main_map,0)
268   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
268   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
269269
270270   /* video hardware */
271271   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/tmaster.c
r1877r1878
170170
171171***************************************************************************/
172172
173static mame_bitmap *tmaster_bitmap[2][2];   // 2 layers, 2 buffers per layer
173static bitmap_t *tmaster_bitmap[2][2];   // 2 layers, 2 buffers per layer
174174static UINT16 *tmaster_regs;
175175static UINT16 tmaster_color;
176176static UINT16 tmaster_addr;
r1877r1878
253253
254254   UINT16 data;
255255
256   mame_bitmap *bitmap;
256   bitmap_t *bitmap;
257257
258258   buffer   =   (tmaster_regs[0x02/2] >> 8) & 3;   // 1 bit per layer, selects the currently displayed buffer
259259    sw      =    tmaster_regs[0x04/2];
r1877r1878
681681static MACHINE_DRIVER_START( tm3k )
682682   MDRV_CPU_ADD_TAG("main", M68000, 12000000)
683683   MDRV_CPU_PROGRAM_MAP(tmaster_map,0)
684   MDRV_CPU_VBLANK_INT(tm3k_interrupt,2+5+20) // ??
684   MDRV_CPU_VBLANK_INT_HACK(tm3k_interrupt,2+5+20) // ??
685685
686686   MDRV_MACHINE_RESET(tmaster)
687687   MDRV_NVRAM_HANDLER(generic_0fill)
r1877r1878
721721static MACHINE_DRIVER_START( tm )
722722   MDRV_IMPORT_FROM(tm3k)
723723   MDRV_CPU_MODIFY("main")
724   MDRV_CPU_VBLANK_INT(tm_interrupt,3+20) // ??
724   MDRV_CPU_VBLANK_INT_HACK(tm_interrupt,3+20) // ??
725725
726726   MDRV_SOUND_REPLACE("OKI",OKIM6295, 1122000)
727727   MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) // clock frequency & pin 7 not verified
r1877r1878
751751static MACHINE_DRIVER_START( galgames )
752752   MDRV_CPU_ADD_TAG("main", M68000, XTAL_24MHz / 2)
753753   MDRV_CPU_PROGRAM_MAP(galgames_map,0)
754   MDRV_CPU_VBLANK_INT(galgames_interrupt, 1+20)   // ??
754   MDRV_CPU_VBLANK_INT_HACK(galgames_interrupt, 1+20)   // ??
755755
756756   MDRV_NVRAM_HANDLER( galgames )
757757   MDRV_MACHINE_RESET( galgames )
src/mame/drivers/freekick.c
r1877r1878
662662   MDRV_CPU_ADD_TAG("main",Z80, 18432000/6)   //confirmed
663663   MDRV_CPU_PROGRAM_MAP(pbillrd_readmem,pbillrd_writemem)
664664   MDRV_CPU_PERIODIC_INT(irq0_line_hold, 50*3) //??
665   MDRV_CPU_VBLANK_INT(freekick_irqgen,1)
665   MDRV_CPU_VBLANK_INT("main", freekick_irqgen)
666666
667667   MDRV_GFXDECODE(freekick)
668668
src/mame/drivers/cischeat.c
r1877r1878
17351735}
17361736
17371737
1738/* CPU # 2 & 3 */
1739#define CISCHEAT_SUB_INTERRUPT_NUM   1
1740
17411738/* CPU # 4 */
17421739#define CISCHEAT_SOUND_INTERRUPT_NUM   16
17431740
r1877r1878
17521749   /* basic machine hardware */
17531750   MDRV_CPU_ADD_TAG("cpu1", M68000, 10000000)
17541751   MDRV_CPU_PROGRAM_MAP(bigrun_readmem,bigrun_writemem)
1755   MDRV_CPU_VBLANK_INT(cischeat_interrupt,CISCHEAT_INTERRUPT_NUM)
1752   MDRV_CPU_VBLANK_INT_HACK(cischeat_interrupt,CISCHEAT_INTERRUPT_NUM)
17561753
17571754   MDRV_CPU_ADD_TAG("cpu2", M68000, 10000000)
17581755   MDRV_CPU_PROGRAM_MAP(bigrun_readmem2,bigrun_writemem2)
1759   MDRV_CPU_VBLANK_INT(irq4_line_hold,CISCHEAT_SUB_INTERRUPT_NUM)
1756   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
17601757
17611758   MDRV_CPU_ADD_TAG("cpu3", M68000, 10000000)
17621759   MDRV_CPU_PROGRAM_MAP(bigrun_readmem3,bigrun_writemem3)
1763   MDRV_CPU_VBLANK_INT(irq4_line_hold,CISCHEAT_SUB_INTERRUPT_NUM)
1760   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
17641761
17651762   MDRV_CPU_ADD_TAG("sound", M68000, 6000000)
17661763   /* audio CPU */
17671764   MDRV_CPU_PROGRAM_MAP(bigrun_sound_readmem,bigrun_sound_writemem)
1768   MDRV_CPU_VBLANK_INT(irq4_line_hold,CISCHEAT_SOUND_INTERRUPT_NUM)
1765   MDRV_CPU_VBLANK_INT_HACK(irq4_line_hold,CISCHEAT_SOUND_INTERRUPT_NUM)
17691766
17701767   MDRV_INTERLEAVE(20)
17711768
r1877r1878
18981895   /* basic machine hardware */
18991896   MDRV_CPU_ADD_TAG("main",M68000, 12000000)
19001897   MDRV_CPU_PROGRAM_MAP(readmem_scudhamm,writemem_scudhamm)
1901   MDRV_CPU_VBLANK_INT(interrupt_scudhamm,INTERRUPT_NUM_SCUDHAMM)
1898   MDRV_CPU_VBLANK_INT_HACK(interrupt_scudhamm,INTERRUPT_NUM_SCUDHAMM)
19021899
19031900   /* video hardware */
19041901   MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK | VIDEO_HAS_SHADOWS)
r1877r1878
19501947   MDRV_IMPORT_FROM(scudhamm)
19511948   MDRV_CPU_MODIFY("main")
19521949   MDRV_CPU_PROGRAM_MAP(readmem_armchmp2,writemem_armchmp2)
1953   MDRV_CPU_VBLANK_INT(interrupt_armchmp2,INTERRUPT_NUM_SCUDHAMM)
1950   MDRV_CPU_VBLANK_INT_HACK(interrupt_armchmp2,INTERRUPT_NUM_SCUDHAMM)
19541951
19551952MACHINE_DRIVER_END
19561953
src/mame/drivers/namcos22.c
r1877r1878
18071807static MACHINE_DRIVER_START( namcos22s )
18081808   MDRV_CPU_ADD_TAG("main", M68EC020,SS22_MASTER_CLOCK/2)
18091809   MDRV_CPU_PROGRAM_MAP(namcos22s_am,0)
1810   MDRV_CPU_VBLANK_INT(namcos22s_interrupt,2)
1810   MDRV_CPU_VBLANK_INT_HACK(namcos22s_interrupt,2)
18111811
18121812   MDRV_CPU_ADD(TMS32025,SS22_MASTER_CLOCK)
18131813   MDRV_CPU_PROGRAM_MAP(master_dsp_program,0)
18141814   MDRV_CPU_DATA_MAP(master_dsp_data,0)
18151815   MDRV_CPU_IO_MAP(master_dsp_io,0)
1816   MDRV_CPU_VBLANK_INT(dsp_serial_pulse1,SERIAL_IO_PERIOD)
1816   MDRV_CPU_VBLANK_INT_HACK(dsp_serial_pulse1,SERIAL_IO_PERIOD)
18171817
18181818   MDRV_CPU_ADD(TMS32025,SS22_MASTER_CLOCK)
18191819   MDRV_CPU_PROGRAM_MAP(slave_dsp_program,0)
r1877r1878
18231823   MDRV_CPU_ADD(M37710, SS22_MASTER_CLOCK/3)
18241824   MDRV_CPU_PROGRAM_MAP(mcu_program, 0)
18251825   MDRV_CPU_IO_MAP( mcu_io, 0 )
1826   MDRV_CPU_VBLANK_INT(mcu_interrupt, 3)
1826   MDRV_CPU_VBLANK_INT_HACK(mcu_interrupt, 3)
18271827
18281828   MDRV_NVRAM_HANDLER(namcos22)
18291829   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
22222222static MACHINE_DRIVER_START( namcos22 )
22232223   MDRV_CPU_ADD(M68020,SS22_MASTER_CLOCK/2) /* 25 MHz? */
22242224   MDRV_CPU_PROGRAM_MAP(namcos22_am,0)
2225   MDRV_CPU_VBLANK_INT(namcos22_interrupt,2)
2225   MDRV_CPU_VBLANK_INT_HACK(namcos22_interrupt,2)
22262226
22272227   MDRV_CPU_ADD(TMS32025,SS22_MASTER_CLOCK) /* ? */
22282228   MDRV_CPU_PROGRAM_MAP(master_dsp_program,0)
22292229   MDRV_CPU_DATA_MAP(master_dsp_data,0)
22302230   MDRV_CPU_IO_MAP(master_dsp_io,0)
2231   MDRV_CPU_VBLANK_INT(dsp_serial_pulse1,SERIAL_IO_PERIOD)
2231   MDRV_CPU_VBLANK_INT_HACK(dsp_serial_pulse1,SERIAL_IO_PERIOD)
22322232
22332233   MDRV_CPU_ADD(TMS32025,SS22_MASTER_CLOCK) /* ? */
22342234   MDRV_CPU_PROGRAM_MAP(slave_dsp_program,0)
src/mame/drivers/flyball.c
r1877r1878
261261   /* basic machine hardware */
262262   MDRV_CPU_ADD(M6502, 12096000 / 16)
263263   MDRV_CPU_PROGRAM_MAP(flyball_map, 0)
264   MDRV_CPU_VBLANK_INT(nmi_line_pulse, 1)
264   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
265265
266266   MDRV_MACHINE_RESET(flyball)
267267
src/mame/drivers/redclash.c
r1877r1878
351351   /* basic machine hardware */
352352   MDRV_CPU_ADD(Z80, 4000000)  /* 4 MHz */
353353   MDRV_CPU_PROGRAM_MAP(zero_readmem,zero_writemem)
354   MDRV_CPU_VBLANK_INT(redclash_interrupt,1)
354   MDRV_CPU_VBLANK_INT("main", redclash_interrupt)
355355
356356   /* video hardware */
357357   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
378378   /* basic machine hardware */
379379   MDRV_CPU_ADD(Z80, 4000000)  /* 4 MHz */
380380   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
381   MDRV_CPU_VBLANK_INT(redclash_interrupt,1)
381   MDRV_CPU_VBLANK_INT("main", redclash_interrupt)
382382
383383   /* video hardware */
384384   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/vicdual.c
r1877r1878
9393      coin_counter_w(0, 1);
9494      coin_counter_w(0, 0);
9595
96      cpunum_set_input_line(Machine, 0, INPUT_LINE_RESET, PULSE_LINE);
96      cpunum_set_input_line(machine, 0, INPUT_LINE_RESET, PULSE_LINE);
9797
9898      /* simulate the coin switch being closed for a while */
9999      timer_set(double_to_attotime(4 * attotime_to_double(video_screen_get_frame_period(0))), NULL, 0, clear_coin_status);
r1877r1878
136136   /* the vertical synch counter gets incremented at the end of HSYNC,
137137       compensate for this */
138138   if (video_screen_get_hpos(0) >= VICDUAL_HSEND)
139   {
140139      vcounter = (vcounter + 1) % VICDUAL_VTOTAL;
141   }
142140
143141   return vcounter;
144142}
r1877r1878
158156
159157static CUSTOM_INPUT( vicdual_get_composite_blank_comp )
160158{
161   return (vicdual_get_vblank_comp(0) && !video_screen_get_hblank(0));
159   return (vicdual_get_vblank_comp(machine, 0) && !video_screen_get_hblank(0));
162160}
163161
164162
r1877r1878
174172   if (!timer_started)
175173   {
176174      timer_started = 1;
177
178175      timer_pulse(TIMER_HALF_PERIOD, NULL, 0, vicdual_timer_callback);
179176   }
180177
r1877r1878
193190
194191int vicdual_is_cabinet_color(void)
195192{
196   UINT32 input = readinputportbytag(COLOR_BW_PORT_TAG);
197
198   return (input == 0);
193   return (readinputportbytag(COLOR_BW_PORT_TAG) == 0);
199194}
200195
201196
r1877r1878
220215
221216static WRITE8_HANDLER( vicdual_videoram_w )
222217{
223   video_screen_update_partial(0, video_screen_get_vpos(0));
224
218   video_screen_update_now(0);
225219   vicdual_videoram[offset] = data;
226220}
227221
r1877r1878
234228
235229static WRITE8_HANDLER( vicdual_characterram_w )
236230{
237   video_screen_update_partial(0, video_screen_get_vpos(0));
231   video_screen_update_now(0);
238232
239233   vicdual_characterram[offset] = data;
240234}
r1877r1878
277271{
278272   UINT8 ret = 0;
279273
280   if (offset & 0x01)  ret = input_port_0_r(0);
274   if (offset & 0x01)  ret = input_port_0_r(machine, 0);
275   if (offset & 0x08)  ret = input_port_1_r(machine, 0);
281276
282   if (offset & 0x08)  ret = input_port_1_r(0);
283
284277   return ret;
285278}
286279
r1877r1878
288281static WRITE8_HANDLER( depthch_io_w )
289282{
290283   if (offset & 0x01)  assert_coin_status();
291
292   if (offset & 0x04)  depthch_audio_w(0, data);
284   if (offset & 0x04)  depthch_audio_w(machine, 0, data);
293285}
294286
295287
r1877r1878
361353{
362354   UINT8 ret = 0;
363355
364   if (offset & 0x01)  ret = input_port_0_r(0);
356   if (offset & 0x01)  ret = input_port_0_r(machine,0);
357   if (offset & 0x08)  ret = input_port_1_r(machine,0);
365358
366   if (offset & 0x08)  ret = input_port_1_r(0);
367
368359   return ret;
369360}
370361
r1877r1878
372363static WRITE8_HANDLER( safari_io_w )
373364{
374365   if (offset & 0x01)  assert_coin_status();
375
376366   if (offset & 0x02)  /* safari_audio_w(0, data) */;
377367}
378368
r1877r1878
447437{
448438   UINT8 ret = 0;
449439
450   if (offset & 0x01)  ret = input_port_0_r(0);
440   if (offset & 0x01)  ret = input_port_0_r(machine,0);
441   if (offset & 0x08)  ret = input_port_1_r(machine,0);
451442
452   if (offset & 0x08)  ret = input_port_1_r(0);
453
454443   return ret;
455444}
456445
r1877r1878
458447static WRITE8_HANDLER( frogs_io_w )
459448{
460449   if (offset & 0x01)  assert_coin_status();
461
462   if (offset & 0x02)  frogs_audio_w(0, data);
450   if (offset & 0x02)  frogs_audio_w(machine, 0, data);
463451}
464452
465453
r1877r1878
557545{
558546   UINT8 ret = 0;
559547
560   if (offset & 0x01)  ret = input_port_0_r(0);
548   if (offset & 0x01)  ret = input_port_0_r(machine,0);
549   if (offset & 0x08)  ret = input_port_1_r(machine,0);
561550
562   if (offset & 0x08)  ret = input_port_1_r(0);
563
564551   return ret;
565552}
566553
r1877r1878
569556{
570557   UINT8 ret = 0;
571558
572   if (offset & 0x01)  ret = input_port_0_r(0);
559   if (offset & 0x01)  ret = input_port_0_r(machine, 0);
560   if (offset & 0x04)  ret = input_port_1_r(machine, 0);
561   if (offset & 0x08)  ret = input_port_2_r(machine, 0);
573562
574   if (offset & 0x04)  ret = input_port_1_r(0);
575
576   if (offset & 0x08)  ret = input_port_2_r(0);
577
578563   return ret;
579564}
580565
r1877r1878
582567static WRITE8_HANDLER( headon_io_w )
583568{
584569   if (offset & 0x01)  assert_coin_status();
585
586   if (offset & 0x02)  headon_audio_w(0, data);
587
570   if (offset & 0x02)  headon_audio_w(machine, 0, data);
588571   if (offset & 0x04)  /* vicdual_palette_bank_w(0, data)  */;    /* not written to */
589572}
590573
r1877r1878
762745{
763746   UINT8 ret = 0;
764747
765   if (offset & 0x01)  ret = input_port_0_r(0);
766
748   if (offset & 0x01)  ret = input_port_0_r(machine, 0);
767749    if (offset & 0x02)  /* schematics show this as in input port, but never read from */
768
769   if (offset & 0x04)  ret = input_port_1_r(0);
770
771   if (offset & 0x08)  ret = input_port_2_r(0);
772
750   if (offset & 0x04)  ret = input_port_1_r(machine, 0);
751   if (offset & 0x08)  ret = input_port_2_r(machine, 0);
773752   if (offset & 0x12)  logerror("********* Read from port %x\n", offset);
774753
775754   return ret;
r1877r1878
779758static WRITE8_HANDLER( headon2_io_w )
780759{
781760   if (offset & 0x01)  assert_coin_status();
782
783   if (offset & 0x02)  headon_audio_w(0, data);
784
785   if (offset & 0x04)  vicdual_palette_bank_w(0, data);
786
761   if (offset & 0x02)  headon_audio_w(machine, 0, data);
762   if (offset & 0x04)  vicdual_palette_bank_w(machine, 0, data);
787763    if (offset & 0x08)  ;/* schematics show this as going into a shifer circuit, but never written to */
788
789764    if (offset & 0x10)  ;/* schematics show this as going to an edge connector, but never written to */
790
791765   if (offset & 0x18)  logerror("********* Write to port %x\n", offset);
792766}
793767
r1877r1878
795769static WRITE8_HANDLER( digger_io_w )
796770{
797771   if (offset & 0x01)  assert_coin_status();
798
799772   if (offset & 0x02)  /* digger_audio_1_w(0, data) */;
800
801773   if (offset & 0x04)
802774   {
803      vicdual_palette_bank_w(0, data & 0x03);
775      vicdual_palette_bank_w(machine, 0, data & 0x03);
804776      /* digger_audio_2_w(0, data & 0xfc) */;
805777   }
806778
807779    if (offset & 0x08)  ;/* schematics show this as going into a shifer circuit, but never written to */
808
809780    if (offset & 0x10)  ;/* schematics show this as going to an edge connector, but never written to */
810
811781   if (offset & 0x18)  logerror("********* Write to port %x\n", offset);
812782}
813783
r1877r1878
993963
994964static WRITE8_HANDLER( invho2_io_w )
995965{
996   if (offset & 0x01)  invho2_audio_w(0, data);
997
998   if (offset & 0x02)  invinco_audio_w(0, data);
999
966   if (offset & 0x01)  invho2_audio_w(machine, 0, data);
967   if (offset & 0x02)  invinco_audio_w(machine, 0, data);
1000968   if (offset & 0x08)  assert_coin_status();
1001
1002   if (offset & 0x40)  vicdual_palette_bank_w(0, data);
969   if (offset & 0x40)  vicdual_palette_bank_w(machine, 0, data);
1003970}
1004971
1005972
1006973static WRITE8_HANDLER( invds_io_w )
1007974{
1008   if (offset & 0x01)  invinco_audio_w(0, data);
1009
975   if (offset & 0x01)  invinco_audio_w(machine, 0, data);
1010976   if (offset & 0x02)  /* deepscan_audio_w(0, data) */;
1011
1012977   if (offset & 0x08)  assert_coin_status();
1013
1014   if (offset & 0x40)  vicdual_palette_bank_w(0, data);
978   if (offset & 0x40)  vicdual_palette_bank_w(machine, 0, data);
1015979}
1016980
1017981
1018982static WRITE8_HANDLER( sspacaho_io_w )
1019983{
1020   if (offset & 0x01)  invho2_audio_w(0, data);
1021
1022   if (offset & 0x02)  /* sspaceatt_audio_w(0, data) */;
1023
984   if (offset & 0x01)  invho2_audio_w(machine, 0, data);
985   if (offset & 0x02)  /* sspaceatt_audio_w(machine, 0, data) */;
1024986   if (offset & 0x08)  assert_coin_status();
1025
1026   if (offset & 0x40)  vicdual_palette_bank_w(0, data);
987   if (offset & 0x40)  vicdual_palette_bank_w(machine, 0, data);
1027988}
1028989
1029990
1030991static WRITE8_HANDLER( tranqgun_io_w )
1031992{
1032   if (offset & 0x01)  /* tranqgun_audio_w(0, data) */;
1033
1034   if (offset & 0x02)  vicdual_palette_bank_w(0, data);
1035
993   if (offset & 0x01)  /* tranqgun_audio_w(machine, 0, data) */;
994   if (offset & 0x02)  vicdual_palette_bank_w(machine, 0, data);
1036995   if (offset & 0x08)  assert_coin_status();
1037996}
1038997
1039998
1040999static WRITE8_HANDLER( spacetrk_io_w )
10411000{
1042   if (offset & 0x01)  /* spacetrk_audio_w(0, data) */;
1043
1044   if (offset & 0x02)  /* spacetrk_audio_w(0, data) */;
1045
1001   if (offset & 0x01)  /* spacetrk_audio_w(machine, 0, data) */;
1002   if (offset & 0x02)  /* spacetrk_audio_w(machine, 0, data) */;
10461003   if (offset & 0x08)  assert_coin_status();
1047
1048   if (offset & 0x40)  vicdual_palette_bank_w(0, data);
1004   if (offset & 0x40)  vicdual_palette_bank_w(machine, 0, data);
10491005}
10501006
10511007
10521008static WRITE8_HANDLER( carnival_io_w )
10531009{
1054   if (offset & 0x01)  carnival_audio_1_w(0, data);
1055
1056   if (offset & 0x02)  carnival_audio_2_w(0, data);
1057
1010   if (offset & 0x01)  carnival_audio_1_w(machine, 0, data);
1011   if (offset & 0x02)  carnival_audio_2_w(machine, 0, data);
10581012   if (offset & 0x08)  assert_coin_status();
1059
1060   if (offset & 0x40)  vicdual_palette_bank_w(0, data);
1013   if (offset & 0x40)  vicdual_palette_bank_w(machine, 0, data);
10611014}
10621015
10631016
10641017static WRITE8_HANDLER( brdrline_io_w )
10651018{
1066   if (offset & 0x01)  /* brdrline_audio_w(0, data) */;
1067
1068   if (offset & 0x02)  vicdual_palette_bank_w(0, data);
1069
1019   if (offset & 0x01)  /* brdrline_audio_w(machine, 0, data) */;
1020   if (offset & 0x02)  vicdual_palette_bank_w(machine, 0, data);
10701021   if (offset & 0x08)  assert_coin_status();
10711022}
10721023
10731024
10741025static WRITE8_HANDLER( pulsar_io_w )
10751026{
1076   if (offset & 0x01)  pulsar_audio_1_w(0, data);
1077
1078   if (offset & 0x02)  pulsar_audio_2_w(0, data);
1079
1027   if (offset & 0x01)  pulsar_audio_1_w(machine, 0, data);
1028   if (offset & 0x02)  pulsar_audio_2_w(machine, 0, data);
10801029   if (offset & 0x08)  assert_coin_status();
1081
1082   if (offset & 0x40)  vicdual_palette_bank_w(0, data);
1030   if (offset & 0x40)  vicdual_palette_bank_w(machine, 0, data);
10831031}
10841032
10851033
r1877r1878
10891037
10901038   if (offset & 0x02)
10911039   {
1092      vicdual_palette_bank_w(0, data & 0x03);
1040      vicdual_palette_bank_w(machine, 0, data & 0x03);
10931041      /* heiankyo_audio_2_w(0, data & 0xfc) */;
10941042   }
10951043
r1877r1878
11001048static WRITE8_HANDLER( alphaho_io_w )
11011049{
11021050   if (offset & 0x01)  /* headon_audio_w(0, data) */;
1103
11041051   if (offset & 0x02)  /* alphaf_audio_w(0, data) */;
1105
11061052   if (offset & 0x08)  assert_coin_status();
1107
1108   if (offset & 0x40)  vicdual_palette_bank_w(0, data);
1053   if (offset & 0x40)  vicdual_palette_bank_w(machine, 0, data);
11091054}
11101055
11111056
r1877r1878
20351980   UINT32 answer = 0;
20361981
20371982   if (samurai_protection_data == 0xab)
2038   {
20391983      answer = 0x02;
2040   }
20411984   else if (samurai_protection_data == 0x1d)
2042   {
20431985      answer = 0x0c;
2044   }
20451986
20461987   return (answer >> offset) & 0x01;
20471988}
r1877r1878
20501991static WRITE8_HANDLER( samurai_io_w )
20511992{
20521993   if (offset & 0x02)  /* samurai_audio_w(0, data) */;
2053
20541994   if (offset & 0x08)  assert_coin_status();
2055
2056   if (offset & 0x40)  vicdual_palette_bank_w(0, data);
1995   if (offset & 0x40)  vicdual_palette_bank_w(machine, 0, data);
20571996}
20581997
20591998
r1877r1878
21602099{
21612100   UINT8 ret = 0;
21622101
2163   if (offset & 0x01)  ret = input_port_0_r(0);
2102   if (offset & 0x01)  ret = input_port_0_r(machine,0);
2103   if (offset & 0x08)  ret = input_port_1_r(machine,0);
21642104
2165   if (offset & 0x08)  ret = input_port_1_r(0);
2166
21672105   return ret;
21682106}
21692107
r1877r1878
21712109static WRITE8_HANDLER( nsub_io_w )
21722110{
21732111   if (offset & 0x01)  assert_coin_status();
2174
21752112   if (offset & 0x02)  /* nsub_audio_w(0, data) */;
2176
2177   if (offset & 0x04)  vicdual_palette_bank_w(0, data);
2113   if (offset & 0x04)  vicdual_palette_bank_w(machine, 0, data);
21782114}
21792115
21802116
r1877r1878
22582194{
22592195   UINT8 ret = 0;
22602196
2261   if (offset & 0x01)  ret = input_port_0_r(0);
2197   if (offset & 0x01)  ret = input_port_0_r(machine,0);
2198   if (offset & 0x02)  ret = input_port_1_r(machine,0);
2199   if (offset & 0x08)  ret = input_port_2_r(machine,0);
22622200
2263   if (offset & 0x02)  ret = input_port_1_r(0);
2264
2265   if (offset & 0x08)  ret = input_port_2_r(0);
2266
22672201   return ret;
22682202}
22692203
r1877r1878
22712205static WRITE8_HANDLER( invinco_io_w )
22722206{
22732207   if (offset & 0x01)  assert_coin_status();
2274
2275   if (offset & 0x02)  invinco_audio_w(0, data);
2276
2277   if (offset & 0x04)  vicdual_palette_bank_w(0, data);
2208   if (offset & 0x02)  invinco_audio_w(machine, 0, data);
2209   if (offset & 0x04)  vicdual_palette_bank_w(machine, 0, data);
22782210}
22792211
22802212
src/mame/drivers/xybots.c
r1877r1878
190190   /* basic machine hardware */
191191   MDRV_CPU_ADD(M68000, ATARI_CLOCK_14MHz/2)
192192   MDRV_CPU_PROGRAM_MAP(main_map,0)
193   MDRV_CPU_VBLANK_INT(atarigen_video_int_gen,1)
193   MDRV_CPU_VBLANK_INT("main", atarigen_video_int_gen)
194194
195195   MDRV_MACHINE_RESET(xybots)
196196   MDRV_NVRAM_HANDLER(atarigen)
src/mame/drivers/speglsht.c
r1877r1878
271271   MDRV_CPU_PROGRAM_MAP(st0016_mem,0)
272272   MDRV_CPU_IO_MAP(st0016_io,0)
273273
274   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
274   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
275275
276276   MDRV_CPU_ADD(R3000LE, 25000000)
277277   MDRV_CPU_CONFIG(config)
278278   MDRV_CPU_PROGRAM_MAP(speglsht_mem,0)
279   MDRV_CPU_VBLANK_INT(irq4_gen,1)
279   MDRV_CPU_VBLANK_INT("main", irq4_gen)
280280
281281   MDRV_INTERLEAVE(100)
282282   MDRV_MACHINE_RESET(speglsht)
src/mame/drivers/rockola.c
r1877r1878
289289WRITE8_HANDLER( rockola_videoram2_w );
290290WRITE8_HANDLER( rockola_colorram_w );
291291WRITE8_HANDLER( rockola_charram_w );
292WRITE8_HANDLER( rockola_mc6845_address_w );
293WRITE8_HANDLER( rockola_mc6845_register_w );
294292WRITE8_HANDLER( rockola_flipscreen_w );
295293WRITE8_HANDLER( rockola_scrollx_w );
296294WRITE8_HANDLER( rockola_scrolly_w );
r1877r1878
372370   AM_RANGE(0x0800, 0x0bff) AM_RAM AM_WRITE(rockola_videoram_w) AM_BASE(&videoram)
373371   AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_WRITE(rockola_colorram_w) AM_BASE(&colorram)
374372   AM_RANGE(0x1000, 0x1fff) AM_RAM AM_WRITE(rockola_charram_w) AM_BASE(&rockola_charram)
375   AM_RANGE(0x3000, 0x3000) AM_WRITE(rockola_mc6845_address_w)
376   AM_RANGE(0x3001, 0x3001) AM_WRITE(rockola_mc6845_register_w)
373   AM_RANGE(0x3000, 0x3000) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
374   AM_RANGE(0x3001, 0x3001) AM_DEVWRITE(MC6845, "crtc", mc6845_register_w)
377375   AM_RANGE(0x4000, 0x8fff) AM_ROM
378376   AM_RANGE(0xb000, 0xb001) AM_WRITE(sasuke_sound_w)
379377   AM_RANGE(0xb002, 0xb002) AM_WRITE(satansat_b002_w)   /* flip screen & irq enable */
r1877r1878
391389   AM_RANGE(0x0800, 0x0bff) AM_RAM AM_WRITE(rockola_videoram_w) AM_BASE(&videoram)
392390   AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_WRITE(rockola_colorram_w) AM_BASE(&colorram)
393391   AM_RANGE(0x1000, 0x1fff) AM_RAM AM_WRITE(rockola_charram_w) AM_BASE(&rockola_charram)
394   AM_RANGE(0x3000, 0x3000) AM_WRITE(rockola_mc6845_address_w)
395   AM_RANGE(0x3001, 0x3001) AM_WRITE(rockola_mc6845_register_w)
392   AM_RANGE(0x3000, 0x3000) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
393   AM_RANGE(0x3001, 0x3001) AM_DEVWRITE(MC6845, "crtc", mc6845_register_w)
396394   AM_RANGE(0x4000, 0x97ff) AM_ROM
397395   AM_RANGE(0xb000, 0xb001) AM_WRITE(satansat_sound_w)
398396   AM_RANGE(0xb002, 0xb002) AM_WRITE(satansat_b002_w)   /* flip screen & irq enable */
r1877r1878
410408   AM_RANGE(0x0800, 0x0bff) AM_RAM AM_WRITE(rockola_videoram_w) AM_BASE(&videoram)
411409   AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_WRITE(rockola_colorram_w) AM_BASE(&colorram)
412410   AM_RANGE(0x1000, 0x1fff) AM_RAM AM_WRITE(rockola_charram_w) AM_BASE(&rockola_charram)
413   AM_RANGE(0x3000, 0x3000) AM_WRITE(rockola_mc6845_address_w)
414   AM_RANGE(0x3001, 0x3001) AM_WRITE(rockola_mc6845_register_w)
411   AM_RANGE(0x3000, 0x3000) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
412   AM_RANGE(0x3001, 0x3001) AM_DEVWRITE(MC6845, "crtc", mc6845_register_w)
415413   AM_RANGE(0x3100, 0x3102) AM_WRITE(vanguard_sound_w)
416414   AM_RANGE(0x3103, 0x3103) AM_WRITE(rockola_flipscreen_w)
417415   AM_RANGE(0x3104, 0x3104) AM_READ_PORT("IN0")
r1877r1878
431429   AM_RANGE(0x0800, 0x0bff) AM_RAM AM_WRITE(rockola_videoram_w) AM_BASE(&videoram)
432430   AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_WRITE(rockola_colorram_w) AM_BASE(&colorram)
433431   AM_RANGE(0x1000, 0x1fff) AM_RAM AM_WRITE(rockola_charram_w) AM_BASE(&rockola_charram)
434   AM_RANGE(0x2000, 0x2000) AM_WRITE(rockola_mc6845_address_w)
435   AM_RANGE(0x2001, 0x2001) AM_WRITE(rockola_mc6845_register_w)
432   AM_RANGE(0x2000, 0x2000) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
433   AM_RANGE(0x2001, 0x2001) AM_DEVWRITE(MC6845, "crtc", mc6845_register_w)
436434   AM_RANGE(0x2100, 0x2103) AM_WRITE(fantasy_sound_w)
437435   AM_RANGE(0x2104, 0x2104) AM_READ_PORT("IN0")
438436   AM_RANGE(0x2105, 0x2105) AM_READ_PORT("IN1")
r1877r1878
452450   AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_WRITE(rockola_colorram_w) AM_BASE(&colorram)
453451   AM_RANGE(0x1000, 0x1fff) AM_RAM AM_WRITE(rockola_charram_w) AM_BASE(&rockola_charram)
454452   AM_RANGE(0x3000, 0x9fff) AM_ROM
455   AM_RANGE(0xb000, 0xb000) AM_WRITE(rockola_mc6845_address_w)
456   AM_RANGE(0xb001, 0xb001) AM_WRITE(rockola_mc6845_register_w)
453   AM_RANGE(0xb000, 0xb000) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
454   AM_RANGE(0xb001, 0xb001) AM_DEVWRITE(MC6845, "crtc", mc6845_register_w)
457455   AM_RANGE(0xb100, 0xb103) AM_WRITE(fantasy_sound_w)
458456   AM_RANGE(0xb104, 0xb104) AM_READ_PORT("IN0")
459457   AM_RANGE(0xb105, 0xb105) AM_READ_PORT("IN1")
r1877r1878
10811079   // basic machine hardware
10821080   MDRV_CPU_ADD_TAG("main", M6502, 11289000/16) // 700 kHz
10831081   MDRV_CPU_PROGRAM_MAP(sasuke_map, 0)
1084   MDRV_CPU_VBLANK_INT(satansat_interrupt, 2)
1082   MDRV_CPU_VBLANK_INT_HACK(satansat_interrupt, 2)
10851083
10861084   MDRV_MACHINE_RESET(sasuke)
10871085
r1877r1878
11561154   //MDRV_CPU_ADD_TAG("main", M6502, 11289000/8)   // 1.4 MHz
11571155   MDRV_CPU_ADD_TAG("main", M6502, 930000)      // adjusted
11581156   MDRV_CPU_PROGRAM_MAP(vanguard_map, 0)
1159   MDRV_CPU_VBLANK_INT(rockola_interrupt, 2)
1157   MDRV_CPU_VBLANK_INT_HACK(rockola_interrupt, 2)
11601158
11611159   MDRV_MACHINE_RESET(vanguard)
11621160
src/mame/drivers/magicfly.c
r1877r1878
336336   tilemap_mark_tile_dirty(bg_tilemap, offset);
337337}
338338
339static WRITE8_HANDLER( magicfly_mc6845_address_w )
340{
341   mc6845_address_w(mc6845, data);
342}
343
344static READ8_HANDLER( magicfly_mc6845_register_r )
345{
346   return mc6845_register_r(mc6845);
347}
348
349static WRITE8_HANDLER( magicfly_mc6845_register_w )
350{
351   mc6845_register_w(mc6845, data);
352}
353
354339static TILE_GET_INFO( get_magicfly_tile_info )
355340{
356341/*  - bits -
r1877r1878
454439{
455440   switch( mux_data & 0x0f )   /* bits 0-3 */
456441   {
457      case 0x01: return input_port_0_r(0);
458      case 0x02: return input_port_1_r(0);
459      case 0x04: return input_port_2_r(0);
460      case 0x08: return input_port_3_r(0);
461      case 0x00: return input_port_4_r(0);
442      case 0x01: return input_port_0_r(machine,0);
443      case 0x02: return input_port_1_r(machine,0);
444      case 0x04: return input_port_2_r(machine,0);
445      case 0x08: return input_port_3_r(machine,0);
446      case 0x00: return input_port_4_r(machine,0);
462447   }
463448   return 0xff;
464449}
r1877r1878
475460
476461static ADDRESS_MAP_START( magicfly_map, ADDRESS_SPACE_PROGRAM, 8 )
477462   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)    /* MK48Z02B NVRAM */
478   AM_RANGE(0x0800, 0x0800) AM_WRITE(magicfly_mc6845_address_w)
479   AM_RANGE(0x0801, 0x0801) AM_READWRITE(magicfly_mc6845_register_r, magicfly_mc6845_register_w)
463   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
464   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
480465   AM_RANGE(0x1000, 0x13ff) AM_RAM AM_WRITE(magicfly_videoram_w) AM_BASE(&videoram)        /* HM6116LP #1 (2K x 8) RAM (only 1st half used) */
481466   AM_RANGE(0x1800, 0x1bff) AM_RAM AM_WRITE(magicfly_colorram_w) AM_BASE(&colorram)        /* HM6116LP #2 (2K x 8) RAM (only 1st half used) */
482467   AM_RANGE(0x2800, 0x2800) AM_READ(mux_port_r)  /* multiplexed input port */
r1877r1878
660645   /* basic machine hardware */
661646   MDRV_CPU_ADD_TAG("main", M6502, MASTER_CLOCK/12)   /* guess */
662647   MDRV_CPU_PROGRAM_MAP(magicfly_map, 0)
663   MDRV_CPU_VBLANK_INT(nmi_line_pulse, 1)
648   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
664649
665650   MDRV_NVRAM_HANDLER(generic_0fill)
666651
src/mame/drivers/centiped.c
r1877r1878
657657
658658static WRITE8_HANDLER( caterplr_AY8910_w )
659659{
660   AY8910_control_port_0_w(0, offset);
661   AY8910_write_port_0_w(0, data);
660   AY8910_control_port_0_w(machine, 0, offset);
661   AY8910_write_port_0_w(machine, 0, data);
662662}
663663
664664
665665static READ8_HANDLER( caterplr_AY8910_r )
666666{
667   AY8910_control_port_0_w(0, offset);
668   return AY8910_read_port_0_r(0);
667   AY8910_control_port_0_w(machine, 0, offset);
668   return AY8910_read_port_0_r(machine, 0);
669669}
670670
671671
src/mame/drivers/atarisy1.c
r1877r1878
366366
367367   /* write strobe */
368368   if (!(old & 1) && (tms5220_ctl & 1))
369      tms5220_data_w(0, tms5220_out_data);
369      tms5220_data_w(machine, 0, tms5220_out_data);
370370
371371   /* read strobe */
372372   if (!(old & 2) && (tms5220_ctl & 2))
373      tms5220_in_data = tms5220_status_r(0);
373      tms5220_in_data = tms5220_status_r(machine, 0);
374374
375375   /* bit 4 is connected to an up-counter, clocked by SYCLKB */
376376   data = 5 | ((data >> 3) & 2);
r1877r1878
417417static OPBASE_HANDLER( indytemp_setopbase )
418418{
419419   int prevpc = activecpu_get_previouspc();
420
421420   /*
422421     *  This is a slightly ugly kludge for Indiana Jones & the Temple of Doom because it jumps
423422     *  directly to code in the slapstic.  The general order of things is this:
r1877r1878
437436     */
438437
439438   if (address & 0x80000)
440      atarigen_slapstic_r(0,0);
439      atarigen_slapstic_r(machine,0,0);
441440   else if (prevpc & 0x80000)
442      atarigen_slapstic_r((prevpc >> 1) & 0x3fff,0);
441      atarigen_slapstic_r(machine,(prevpc >> 1) & 0x3fff,0);
443442
444443   return address;
445444}
r1877r1878
740739   /* basic machine hardware */
741740   MDRV_CPU_ADD(M68010, ATARI_CLOCK_14MHz/2)
742741   MDRV_CPU_PROGRAM_MAP(main_map,0)
743   MDRV_CPU_VBLANK_INT(atarigen_video_int_gen,1)
742   MDRV_CPU_VBLANK_INT("main", atarigen_video_int_gen)
744743
745744   MDRV_CPU_ADD(M6502, ATARI_CLOCK_14MHz/8)
746745   MDRV_CPU_PROGRAM_MAP(sound_map,0)
src/mame/drivers/wgp.c
r1877r1878
636636static WRITE16_HANDLER( wgp_sound_w )
637637{
638638   if (offset == 0)
639      taitosound_port_w (0, data & 0xff);
639      taitosound_port_w (machine, 0, data & 0xff);
640640   else if (offset == 1)
641      taitosound_comm_w (0, data & 0xff);
641      taitosound_comm_w (machine, 0, data & 0xff);
642642}
643643
644644static READ16_HANDLER( wgp_sound_r )
645645{
646646   if (offset == 1)
647      return ((taitosound_comm_r (0) & 0xff));
647      return ((taitosound_comm_r (machine, 0) & 0xff));
648648   else return 0;
649649}
650650
r1877r1878
982982   /* basic machine hardware */
983983   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz ??? */
984984   MDRV_CPU_PROGRAM_MAP(wgp_readmem,wgp_writemem)
985   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
985   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
986986
987987   MDRV_CPU_ADD(Z80, 16000000/4)   /* 4 MHz ??? */
988988   /* audio CPU */
r1877r1878
990990
991991   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz ??? */
992992   MDRV_CPU_PROGRAM_MAP(wgp_cpub_readmem,wgp_cpub_writemem)
993   MDRV_CPU_VBLANK_INT(wgp_cpub_interrupt,1)
993   MDRV_CPU_VBLANK_INT("main", wgp_cpub_interrupt)
994994
995995   MDRV_MACHINE_START(wgp)
996996
r1877r1878
10271027   /* basic machine hardware */
10281028   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz ??? */
10291029   MDRV_CPU_PROGRAM_MAP(wgp_readmem,wgp_writemem)
1030   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
1030   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
10311031
10321032   MDRV_CPU_ADD(Z80, 16000000/4)   /* 4 MHz ??? */
10331033   /* audio CPU */
r1877r1878
10351035
10361036   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz ??? */
10371037   MDRV_CPU_PROGRAM_MAP(wgp_cpub_readmem,wgp_cpub_writemem)
1038   MDRV_CPU_VBLANK_INT(wgp_cpub_interrupt,1)
1038   MDRV_CPU_VBLANK_INT("main", wgp_cpub_interrupt)
10391039
10401040   MDRV_MACHINE_START(wgp)
10411041
src/mame/drivers/turbosub.c
r1877r1878
333333
334334   MDRV_CPU_ADD(M6809E,4000000)
335335   MDRV_CPU_PROGRAM_MAP(game_cpu_map,0)
336   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)      /* Unverified */
336   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)      /* Unverified */
337337
338338   MDRV_CPU_ADD(M6809E,4000000)
339339   MDRV_CPU_PROGRAM_MAP(frame_cpu_map,0)
src/mame/drivers/welltris.c
r1877r1878
347347   if (ACCESSING_LSB)
348348   {
349349      pending_command = 1;
350      soundlatch_w(0, data & 0xff);
351      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
350      soundlatch_w(machine, 0, data & 0xff);
351      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
352352   }
353353}
354354
r1877r1878
752752   /* basic machine hardware */
753753   MDRV_CPU_ADD(M68000,20000000/2)   /* 10 MHz */
754754   MDRV_CPU_PROGRAM_MAP(welltris_readmem,welltris_writemem)
755   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
755   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
756756
757757   MDRV_CPU_ADD(Z80,8000000/2)      /* 4 MHz ??? */
758758   /* audio CPU */
src/mame/drivers/pturn.c
r1877r1878
7575
7676*/
7777#include "driver.h"
78#include "deprecat.h"
7879#include "sound/ay8910.h"
7980
8081static tilemap *pturn_fgmap,*pturn_bgmap;
r1877r1878
200201
201202static WRITE8_HANDLER(sound_w)
202203{
203   soundlatch_w(0,data);
204   soundlatch_w(machine,0,data);
204205}
205206
206207
r1877r1878
440441
441442static MACHINE_RESET( pturn )
442443{
443   soundlatch_clear_w(0,0);
444   soundlatch_clear_w(machine,0,0);
444445}
445446
446447static MACHINE_DRIVER_START( pturn )
447448   MDRV_CPU_ADD(Z80, 12000000/3)
448449   MDRV_CPU_PROGRAM_MAP(main_map,0)
449   MDRV_CPU_VBLANK_INT(pturn_main_intgen,1)
450   MDRV_CPU_VBLANK_INT("main", pturn_main_intgen)
450451   MDRV_MACHINE_RESET(pturn)
451452
452453   MDRV_CPU_ADD(Z80, 12000000/3)
453454   /* audio CPU */
454455   MDRV_CPU_PROGRAM_MAP(sub_map,0)
455   MDRV_CPU_VBLANK_INT(pturn_sub_intgen,3)
456   MDRV_CPU_VBLANK_INT_HACK(pturn_sub_intgen,3)
456457
457458   MDRV_GFXDECODE(pturn)
458459
src/mame/drivers/gumbo.c
r1877r1878
309309static MACHINE_DRIVER_START( gumbo )
310310   MDRV_CPU_ADD_TAG("main", M68000, 14318180 /2)    // or 10mhz? ?
311311   MDRV_CPU_PROGRAM_MAP(gumbo_readmem,gumbo_writemem)
312   MDRV_CPU_VBLANK_INT(irq1_line_hold,1) // all the same
312   MDRV_CPU_VBLANK_INT("main", irq1_line_hold) // all the same
313313
314314   MDRV_GFXDECODE(gumbo)
315315
src/mame/drivers/getrivia.c
r1877r1878
7979
8080static READ8_HANDLER( port1_r )
8181{
82   return input_port_1_r(0) | (ticket_dispenser_0_r(0) >> 5);
82   return input_port_1_r(machine, 0) | (ticket_dispenser_0_r(machine, 0) >> 5);
8383}
8484
8585static WRITE8_HANDLER( lamps_w )
r1877r1878
105105   set_led_status(9,data & 0x08);
106106
107107   /* bit 5 - ticket out in trivia games */
108   ticket_dispenser_w(0, (data & 0x20)<< 2);
108   ticket_dispenser_w(machine,0, (data & 0x20)<< 2);
109109
110110   /* bit 6 enables NMI */
111   interrupt_enable_w(0,data & 0x40);
111   interrupt_enable_w(machine,0,data & 0x40);
112112
113113   /* bit 7 goes directly to the sound amplifier */
114114   DAC_data_w(0,((data & 0x80) >> 7) * 255);
r1877r1878
143143   set_led_status(8,data & 0x10);
144144
145145   /* bit 6 enables NMI */
146   interrupt_enable_w(0,data & 0x40);
146   interrupt_enable_w(machine,0,data & 0x40);
147147}
148148
149149static WRITE8_HANDLER( banksel_1_1_w )
r1877r1878
396396static MACHINE_DRIVER_START( getrivia )
397397   MDRV_CPU_ADD_TAG("cpu",Z80,4000000) /* 4 MHz */
398398   MDRV_CPU_PROGRAM_MAP(getrivia_map,0)
399   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
399   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
400400
401401   /* video hardware */
402402   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/scregg.c
r1877r1878
5050***************************************************************************/
5151
5252#include "driver.h"
53#include "deprecat.h"
5354#include "sound/ay8910.h"
5455
5556
r1877r1878
232233   /* basic machine hardware */
233234   MDRV_CPU_ADD(M6502, 1500000)
234235   MDRV_CPU_PROGRAM_MAP(dommy_readmem,dommy_writemem)
235   MDRV_CPU_VBLANK_INT(irq0_line_hold,16)
236   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,16)
236237
237238   /* video hardware */
238239   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
265266   /* basic machine hardware */
266267   MDRV_CPU_ADD(M6502, 1500000)
267268   MDRV_CPU_PROGRAM_MAP(eggs_readmem,eggs_writemem)
268   MDRV_CPU_VBLANK_INT(irq0_line_hold,16)
269   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,16)
269270
270271   /* video hardware */
271272   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/dec0.c
r1877r1878
5757   switch (offset<<1)
5858   {
5959      case 0: /* Playfield & Sprite priority */
60         dec0_priority_w(0,data,mem_mask);
60         dec0_priority_w(machine,0,data,mem_mask);
6161         break;
6262
6363      case 2: /* DMA flag */
64         dec0_update_sprites_w(0,0,mem_mask);
64         dec0_update_sprites_w(machine,0,0,mem_mask);
6565         break;
6666
6767      case 4: /* 6502 sound cpu */
6868         if (ACCESSING_LSB)
6969         {
70            soundlatch_w(0,data & 0xff);
71            cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
70            soundlatch_w(machine,0,data & 0xff);
71            cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
7272         }
7373         break;
7474
r1877r1878
103103       case 0:
104104         if (ACCESSING_LSB)
105105         {
106            soundlatch_w(0,data & 0xff);
107            cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
106            soundlatch_w(machine,0,data & 0xff);
107            cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
108108         }
109109         break;
110110      case 2:
111         dec0_priority_w(0,data,mem_mask);
111         dec0_priority_w(machine,0,data,mem_mask);
112112         break;
113113    }
114114}
r1877r1878
117117{
118118   if (ACCESSING_LSB)
119119   {
120      soundlatch_w(0,data & 0xff);
121      cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
120      soundlatch_w(machine,0,data & 0xff);
121      cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
122122   }
123123}
124124
r1877r1878
295295{
296296   switch (offset) {
297297   case 0:
298      YM3812_control_port_0_w(0,data);
298      YM3812_control_port_0_w(machine,0,data);
299299      break;
300300   case 1:
301      YM3812_write_port_0_w(0,data);
301      YM3812_write_port_0_w(machine,0,data);
302302      break;
303303   }
304304}
r1877r1878
307307{
308308   switch (offset) {
309309   case 0:
310      YM2203_control_port_0_w(0,data);
310      YM2203_control_port_0_w(machine,0,data);
311311      break;
312312   case 1:
313      YM2203_write_port_0_w(0,data);
313      YM2203_write_port_0_w(machine,0,data);
314314      break;
315315   }
316316}
r1877r1878
930930   /* basic machine hardware */
931931   MDRV_CPU_ADD(M68000, 10000000)
932932   MDRV_CPU_PROGRAM_MAP(dec0_readmem,dec0_writemem)
933   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)/* VBL, level 5 interrupts from i8751 */
933   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)/* VBL, level 5 interrupts from i8751 */
934934
935935   MDRV_CPU_ADD(M6502, 1500000)
936936   /* audio CPU */
r1877r1878
973973   /* basic machine hardware */
974974   MDRV_CPU_ADD(M68000, 10000000)
975975   MDRV_CPU_PROGRAM_MAP(dec0_readmem,dec0_writemem)
976   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)/* VBL, level 5 interrupts from i8751 */
976   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)/* VBL, level 5 interrupts from i8751 */
977977
978978   MDRV_CPU_ADD(M6502, 1500000)
979979   /* audio CPU */
r1877r1878
10161016   /* basic machine hardware */
10171017   MDRV_CPU_ADD(M68000, 10000000)
10181018   MDRV_CPU_PROGRAM_MAP(dec0_readmem,dec0_writemem)
1019   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)/* VBL, level 5 interrupts from i8751 */
1019   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)/* VBL, level 5 interrupts from i8751 */
10201020
10211021   MDRV_CPU_ADD(M6502, 1500000)
10221022   /* audio CPU */
r1877r1878
10591059   /* basic machine hardware */
10601060   MDRV_CPU_ADD(M68000, 10000000)
10611061   MDRV_CPU_PROGRAM_MAP(dec0_readmem,dec0_writemem)
1062   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)/* VBL */
1062   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)/* VBL */
10631063
10641064   MDRV_CPU_ADD(M6502, 1500000)
10651065   /* audio CPU */
r1877r1878
11071107   /* basic machine hardware */
11081108   MDRV_CPU_ADD(M68000, 10000000)
11091109   MDRV_CPU_PROGRAM_MAP(dec0_readmem,dec0_writemem)
1110   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)/* VBL */
1110   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)/* VBL */
11111111
11121112   MDRV_CPU_ADD(M6502, 1500000)
11131113   /* audio CPU */
r1877r1878
11501150   /* basic machine hardware */
11511151   MDRV_CPU_ADD(M68000, 10000000)
11521152   MDRV_CPU_PROGRAM_MAP(dec0_readmem,dec0_writemem)
1153   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)/* VBL */
1153   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)/* VBL */
11541154
11551155   MDRV_CPU_ADD(M6502, 1500000)
11561156   /* audio CPU */
r1877r1878
11981198   /* basic machine hardware */
11991199   MDRV_CPU_ADD(M68000, XTAL_20MHz/2) /* verified on pcb (20MHZ OSC) 68000P12 running at 10Mhz */
12001200   MDRV_CPU_PROGRAM_MAP(slyspy_readmem,slyspy_writemem)
1201   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)/* VBL */
1201   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)/* VBL */
12021202
12031203   MDRV_CPU_ADD(H6280, XTAL_12MHz/2/3)
12041204   /* audio CPU */ /* verified on pcb (6Mhz is XIN on pin 10 of H6280, verified on pcb */
r1877r1878
12411241   /* basic machine hardware */
12421242   MDRV_CPU_ADD(M68000, XTAL_20MHz/2) /* verified on pcb (20MHZ OSC) 68000P12 running at 10Mhz */
12431243   MDRV_CPU_PROGRAM_MAP(midres_readmem,midres_writemem)
1244   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)/* VBL */
1244   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)/* VBL */
12451245
12461246   MDRV_CPU_ADD(H6280, XTAL_24MHz/4/3)
12471247   /* audio CPU */ /* verified on pcb (6Mhz is XIN on pin 10 of H6280, verified on pcb */
src/mame/drivers/ssv.c
r1877r1878
27902790
27912791   /* basic machine hardware */
27922792   MDRV_CPU_ADD_TAG("main", V60, 16000000) /* Based on STA-0001 & STA-0001B System boards */
2793   MDRV_CPU_VBLANK_INT(ssv_interrupt,2)   /* Vblank */
2793   MDRV_CPU_VBLANK_INT_HACK(ssv_interrupt,2)   /* Vblank */
27942794
27952795   MDRV_MACHINE_RESET(ssv)
27962796
r1877r1878
28372837   MDRV_IMPORT_FROM(ssv)
28382838   MDRV_CPU_MODIFY("main")
28392839   MDRV_CPU_PROGRAM_MAP(gdfs_readmem, gdfs_writemem)
2840   MDRV_CPU_VBLANK_INT(gdfs_interrupt,1+4)
2840   MDRV_CPU_VBLANK_INT_HACK(gdfs_interrupt,1+4)
28412841
28422842   MDRV_NVRAM_HANDLER(gdfs)
28432843
src/mame/drivers/taitoair.c
r1877r1878
593593   /* basic machine hardware */
594594   MDRV_CPU_ADD(M68000,24000000 / 2)      /* 12 MHz ??? */
595595   MDRV_CPU_PROGRAM_MAP(airsys_map, 0)
596   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
596   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)
597597
598598   MDRV_CPU_ADD(Z80,8000000 / 2)         /* 4 MHz ??? */
599599   MDRV_CPU_PROGRAM_MAP(sound_map, 0)
src/mame/drivers/atarig42.c
r1877r1878
518518   /* basic machine hardware */
519519   MDRV_CPU_ADD(M68000, ATARI_CLOCK_14MHz)
520520   MDRV_CPU_PROGRAM_MAP(main_map,0)
521   MDRV_CPU_VBLANK_INT(atarigen_video_int_gen,1)
521   MDRV_CPU_VBLANK_INT("main", atarigen_video_int_gen)
522522
523523   /* ASIC65 */
524524   MDRV_IMPORT_FROM(asic65)
src/mame/drivers/tceptor.c
r1877r1878
433433   /* basic machine hardware */
434434   MDRV_CPU_ADD(M6809, 49152000/32)
435435   MDRV_CPU_PROGRAM_MAP(m6809_map,0)
436   MDRV_CPU_VBLANK_INT(m6809_vb_interrupt,1)
436   MDRV_CPU_VBLANK_INT("2D", m6809_vb_interrupt)
437437
438438   MDRV_CPU_ADD(M65C02, 49152000/24)
439439   /* audio CPU */
r1877r1878
445445
446446   MDRV_CPU_ADD(M68000, 49152000/4)
447447   MDRV_CPU_PROGRAM_MAP(m68k_map,0)
448   MDRV_CPU_VBLANK_INT(m68k_vb_interrupt,1)
448   MDRV_CPU_VBLANK_INT("2D", m68k_vb_interrupt)
449449
450450   MDRV_CPU_ADD(HD63701, 49152000/8)   /* or compatible 6808 with extra instructions */
451451   MDRV_CPU_PROGRAM_MAP(mcu_map,0)
452452   MDRV_CPU_IO_MAP(mcu_io_map,0)
453   MDRV_CPU_VBLANK_INT(mcu_vb_interrupt,1)
453   MDRV_CPU_VBLANK_INT("2D", mcu_vb_interrupt)
454454
455455   MDRV_INTERLEAVE(100)
456456
src/mame/drivers/cop01.c
r1877r1878
6969
7070static WRITE8_HANDLER( cop01_sound_command_w )
7171{
72   soundlatch_w(offset,data);
73   cpunum_set_input_line_and_vector(Machine, 1,0,HOLD_LINE,0xff);
72   soundlatch_w(machine,offset,data);
73   cpunum_set_input_line_and_vector(machine, 1,0,HOLD_LINE,0xff);
7474}
7575
7676static READ8_HANDLER( cop01_sound_command_r )
r1877r1878
8080#define TIMER_RATE 12000   /* total guess */
8181
8282
83   res = (soundlatch_r(offset) & 0x7f) << 1;
83   res = (soundlatch_r(machine,offset) & 0x7f) << 1;
8484
8585   /* bit 0 seems to be a timer */
8686   if ((activecpu_gettotalcycles() / TIMER_RATE) & 1)
r1877r1878
418418   MDRV_CPU_ADD(Z80, 4000000)   /* ???? */
419419   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
420420   MDRV_CPU_IO_MAP(readport,writeport)
421   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
421   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
422422
423423   MDRV_CPU_ADD(Z80, 3000000)
424424   /* audio CPU */   /* ???? */
r1877r1878
459459   MDRV_CPU_ADD(Z80, 4000000)   /* ???? */
460460   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
461461   MDRV_CPU_IO_MAP(mightguy_readport,writeport)
462   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
462   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
463463
464464   MDRV_CPU_ADD(Z80, 3000000)
465465   /* audio CPU */   /* ???? */
src/mame/drivers/hanaawas.c
r1877r1878
6969      }
7070   }
7171
72   return (input_port_0_r(0) & 0xf0) | ordinal;
72   return (input_port_0_r(machine,0) & 0xf0) | ordinal;
7373}
7474
7575static WRITE8_HANDLER( hanaawas_inputs_mux_w )
r1877r1878
208208   MDRV_CPU_ADD(Z80,18432000/6)   /* 3.072 MHz ??? */
209209   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
210210   MDRV_CPU_IO_MAP(readport,writeport)
211   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
211   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
212212
213213   /* video hardware */
214214   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/mpu4drvr.c
r1877r1878
11671167static INPUT_PORTS_START( dealem )
11681168   PORT_START_TAG("ORANGE1")
11691169   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Gamble")
1170   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Pontoon")
1170   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
11711171   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
11721172   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
11731173   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
11741174   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
11751175   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
1176   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_INTERLOCK) PORT_NAME("Rear Door") PORT_TOGGLE
1176   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN)
11771177
11781178   PORT_START_TAG("ORANGE2")
11791179   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN5) PORT_NAME("20p Token")PORT_IMPULSE(3)
r1877r1878
11871187
11881188   PORT_START_TAG("BLACK1")
11891189   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON5) PORT_NAME("Collect")
1190   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN) //Duplicate for Pontoon button
1190   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Pontoon")
11911191   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
11921192   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
11931193   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
11941194   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_SERVICE) PORT_NAME("Test Button") PORT_CODE(KEYCODE_W)
11951195   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_SERVICE) PORT_NAME("Refill Key") PORT_CODE(KEYCODE_R) PORT_TOGGLE
1196   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_INTERLOCK) PORT_NAME("Cashbox Door")  PORT_CODE(KEYCODE_Q) PORT_TOGGLE
1196   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_INTERLOCK) PORT_NAME("Rear Door")  PORT_CODE(KEYCODE_Q) PORT_TOGGLE
11971197
11981198   PORT_START_TAG("BLACK2")
11991199   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Hi-Lo")
r1877r1878
14951495
14961496static UINT8 *dealem_videoram;
14971497
1498static WRITE8_HANDLER( dealem_mc6845_address_w )
1499{
1500   mc6845_address_w(mc6845, data);
1501}
1502
1503static READ8_HANDLER( dealem_mc6845_register_r )
1504{
1505   return mc6845_register_r(mc6845);
1506}
1507
1508static WRITE8_HANDLER( dealem_mc6845_register_w )
1509{
1510   mc6845_register_w(mc6845, data);
1511}
1512
15131498/***************************************************************************
15141499
15151500  Convert the color PROMs into a more useable format.
r1877r1878
15851570
15861571   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
15871572
1588   AM_RANGE(0x0800, 0x0800) AM_WRITE(dealem_mc6845_address_w)
1589   AM_RANGE(0x0801, 0x0801) AM_READWRITE(dealem_mc6845_register_r, dealem_mc6845_register_w)
1573   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
1574   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
15901575
1591//  AM_RANGE(0x0850, 0x0850) AM_WRITE(bankswitch_w) // write bank (rom page select)
1576//  AM_RANGE(0x0850, 0x0850) AM_READWRITE(bankswitch_r,bankswitch_w)    // write bank (rom page select)
15921577
15931578//  AM_RANGE(0x08E0, 0x08E7) AM_READ( 68681_duart_r)
15941579//  AM_RANGE(0x08E0, 0x08E7) AM_WRITE( 68681_duart_w)
r1877r1878
16271612
16281613   MDRV_CPU_ADD_TAG("video", M68000, VIDEO_MASTER_CLOCK )
16291614   MDRV_CPU_PROGRAM_MAP(mpu4_68k_map,0)
1630   MDRV_CPU_VBLANK_INT(mpu4_vid_irq,1)
1615   MDRV_CPU_VBLANK_INT("main", mpu4_vid_irq)
16311616
16321617   MDRV_NVRAM_HANDLER(generic_0fill)            // confirm
16331618
r1877r1878
16761661
16771662   MDRV_CPU_PERIODIC_INT(gen_50hz, 100)               // generate 50 hz signal
16781663
1679   MDRV_CPU_VBLANK_INT(nmi_line_pulse, 1)
1664   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
16801665
16811666   MDRV_SPEAKER_STANDARD_MONO("mono")
16821667   MDRV_SOUND_ADD_TAG("AY8913",AY8913, MPU4_MASTER_CLOCK/4)
src/mame/drivers/aquarium.c
r1877r1878
8787static READ16_HANDLER( aquarium_coins_r )
8888{
8989   int data;
90   data = (input_port_2_word_r(0,mem_mask) & 0x7fff);   /* IN1 */
90   data = (input_port_2_word_r(machine,0,mem_mask) & 0x7fff);   /* IN1 */
9191   data |= aquarium_snd_ack;
9292   aquarium_snd_ack = 0;
9393   return data;
r1877r1878
102102{
103103//  popmessage("sound write %04x",data);
104104
105   soundlatch_w(1,data&0xff);
106   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE );
105   soundlatch_w(machine,1,data&0xff);
106   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE );
107107}
108108
109109static WRITE8_HANDLER( aquarium_z80_bank_w )
r1877r1878
132132
133133static READ8_HANDLER( aquarium_oki_r )
134134{
135   return (aquarium_snd_bitswap(OKIM6295_status_0_r(0)) );
135   return (aquarium_snd_bitswap(OKIM6295_status_0_r(machine,0)) );
136136}
137137
138138static WRITE8_HANDLER( aquarium_oki_w )
139139{
140140   logerror("Z80-PC:%04x Writing %04x to the OKI M6295\n",activecpu_get_previouspc(),aquarium_snd_bitswap(data));
141   OKIM6295_data_0_w( 0, (aquarium_snd_bitswap(data)) );
141   OKIM6295_data_0_w( machine, 0, (aquarium_snd_bitswap(data)) );
142142}
143143
144144
r1877r1878
343343   }
344344
345345   /* reset the sound bank */
346   aquarium_z80_bank_w(0, 0);
346   aquarium_z80_bank_w(machine, 0, 0);
347347}
348348
349349
r1877r1878
370370   /* basic machine hardware */
371371   MDRV_CPU_ADD(M68000, 32000000/2)
372372   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
373   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
373   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
374374
375375   MDRV_CPU_ADD(Z80, 6000000)
376376   /* audio CPU */
src/mame/drivers/metro.c
r1877r1878
157157{
158158   /*  Get the pending IRQs (only the enabled ones, e.g. where
159159        irq_enable is *0*)  */
160   UINT16 irq = metro_irq_cause_r(0,0) & ~*metro_irq_enable;
160   UINT16 irq = metro_irq_cause_r(Machine,0,0) & ~*metro_irq_enable;
161161
162162   if (irq_line == -1)   /* mouja, gakusai, gakusai2, dokyusei, dokyusp */
163163   {
r1877r1878
344344    switch ( ioline )
345345   {
346346      case UPD7810_RXD:   /* read the RxD line */
347         data = soundlatch_r(0);
347         data = soundlatch_r(Machine,0);
348348         state = data & 1;
349         soundlatch_w(0, data >> 1);
349         soundlatch_w(Machine, 0, data >> 1);
350350         break;
351351      default:
352352         logerror("upd7810 ioline %d not handled\n", ioline);
r1877r1878
359359{
360360   if (ACCESSING_LSB)
361361   {
362      soundlatch_w(0,data & 0xff);
363      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
362      soundlatch_w(machine,0,data & 0xff);
363      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
364364      cpu_spinuntil_int();
365365      busy_sndcpu = 1;
366366   }
r1877r1878
443443      {
444444         /* write */
445445         if (BIT(data,1))
446            YM2413_data_port_0_w(0,porta);
446            YM2413_data_port_0_w(machine,0,porta);
447447         else
448            YM2413_register_port_0_w(0,porta);
448            YM2413_register_port_0_w(machine,0,porta);
449449      }
450450      portb = data;
451451      return;
r1877r1878
455455   {
456456      /* write */
457457      if (!BIT(data,4))
458         OKIM6295_data_0_w(0,porta);
458         OKIM6295_data_0_w(machine,0,porta);
459459   }
460460   portb = data;
461461}
r1877r1878
487487      {
488488         /* write */
489489         if (BIT(data,1))
490            YM2151_data_port_0_w(0,porta);
490            YM2151_data_port_0_w(machine,0,porta);
491491         else
492            YM2151_register_port_0_w(0,porta);
492            YM2151_register_port_0_w(machine,0,porta);
493493      }
494494      if (!BIT(data,3))
495495      {
496496         /* read */
497497         if (BIT(data,1))
498            porta = YM2151_status_port_0_r(0);
498            porta = YM2151_status_port_0_r(machine,0);
499499      }
500500      portb = data;
501501      return;
r1877r1878
505505   {
506506      /* write */
507507      if (!BIT(data,4))
508         OKIM6295_data_0_w(0,porta);
508         OKIM6295_data_0_w(machine,0,porta);
509509   }
510510   if (BIT(portb,3) && !BIT(data,3))   /* clock 1->0 */
511511   {
512512      /* read */
513513      if (!BIT(data,4))
514         porta = OKIM6295_status_0_r(0);
514         porta = OKIM6295_status_0_r(machine,0);
515515   }
516516   portb = data;
517517}
r1877r1878
529529
530530static READ16_HANDLER( ymf278b_r )
531531{
532   return YMF278B_status_port_0_r(0);
532   return YMF278B_status_port_0_r(machine, 0);
533533}
534534
535535static WRITE16_HANDLER( ymf278b_w )
r1877r1878
538538      switch(offset)
539539      {
540540         case 0:
541            YMF278B_control_port_0_A_w(0, data);
541            YMF278B_control_port_0_A_w(machine, 0, data);
542542            break;
543543         case 1:
544            YMF278B_data_port_0_A_w(0, data);
544            YMF278B_data_port_0_A_w(machine, 0, data);
545545            break;
546546         case 2:
547            YMF278B_control_port_0_B_w(0, data);
547            YMF278B_control_port_0_B_w(machine, 0, data);
548548            break;
549549         case 3:
550            YMF278B_data_port_0_B_w(0, data);
550            YMF278B_data_port_0_B_w(machine, 0, data);
551551            break;
552552         case 4:
553            YMF278B_control_port_0_C_w(0, data);
553            YMF278B_control_port_0_C_w(machine, 0, data);
554554            break;
555555         case 5:
556            YMF278B_data_port_0_C_w(0, data);
556            YMF278B_data_port_0_C_w(machine, 0, data);
557557            break;
558558      }
559559}
r1877r1878
689689   return ROM[offs] ^ 0xff;
690690}
691691
692INLINE void blt_write(const int tmap, const offs_t offs, const UINT16 data, const UINT16 mask)
692INLINE void blt_write(running_machine *machine, const int tmap, const offs_t offs, const UINT16 data, const UINT16 mask)
693693{
694694   switch( tmap )
695695   {
696      case 1:   metro_vram_0_w(offs,data,mask);   break;
697      case 2:   metro_vram_1_w(offs,data,mask);   break;
698      case 3:   metro_vram_2_w(offs,data,mask);   break;
696      case 1:   metro_vram_0_w(machine,offs,data,mask);   break;
697      case 2:   metro_vram_1_w(machine,offs,data,mask);   break;
698      case 3:   metro_vram_2_w(machine,offs,data,mask);   break;
699699   }
700700//  logerror("CPU #0 PC %06X : Blitter %X] %04X <- %04X & %04X\n",activecpu_get_pc(),tmap,offs,data,mask);
701701}
r1877r1878
770770                  src_offs++;
771771
772772                  dst_offs &= 0xffff;
773                  blt_write(tmap,dst_offs,b2,mask);
773                  blt_write(machine,tmap,dst_offs,b2,mask);
774774                  dst_offs = ((dst_offs+1) & (0x100-1)) | (dst_offs & (~(0x100-1)));
775775               }
776776               break;
r1877r1878
786786               while (count--)
787787               {
788788                  dst_offs &= 0xffff;
789                  blt_write(tmap,dst_offs,b2<<shift,mask);
789                  blt_write(machine,tmap,dst_offs,b2<<shift,mask);
790790                  dst_offs = ((dst_offs+1) & (0x100-1)) | (dst_offs & (~(0x100-1)));
791791                  b2++;
792792               }
r1877r1878
803803               while (count--)
804804               {
805805                  dst_offs &= 0xffff;
806                  blt_write(tmap,dst_offs,b2,mask);
806                  blt_write(machine,tmap,dst_offs,b2,mask);
807807                  dst_offs = ((dst_offs+1) & (0x100-1)) | (dst_offs & (~(0x100-1)));
808808               }
809809               break;
r1877r1878
11841184} \
11851185static WRITE16_HANDLER( karatour_vram_##_n_##_w ) \
11861186{ \
1187   metro_vram_##_n_##_w(KARATOUR_OFFS(offset),data,mem_mask); \
1187   metro_vram_##_n_##_w(machine,KARATOUR_OFFS(offset),data,mem_mask); \
11881188}
11891189
11901190KARATOUR_VRAM( 0 )
r1877r1878
19281928
19291929static WRITE16_HANDLER( blzntrnd_sound_w )
19301930{
1931   soundlatch_w(offset, data>>8);
1932   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
1931   soundlatch_w(machine, offset, data>>8);
1932   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
19331933}
19341934
19351935static WRITE8_HANDLER( blzntrnd_sh_bankswitch_w )
r1877r1878
21512151
21522152static READ8_HANDLER( puzzlet_port7_r )
21532153{
2154   return input_port_2_word_r(0,0);
2154   return input_port_2_word_r(machine,0,0);
21552155}
21562156
21572157static READ8_HANDLER( puzzlet_serB_r )
21582158{
2159   return input_port_0_word_r(0,0);   // coin
2159   return input_port_0_word_r(machine,0,0);   // coin
21602160}
21612161
21622162static WRITE8_HANDLER( puzzlet_portb_w )
r1877r1878
38033803   /* basic machine hardware */
38043804   MDRV_CPU_ADD(M68000, 16000000)
38053805   MDRV_CPU_PROGRAM_MAP(balcube_readmem,balcube_writemem)
3806   MDRV_CPU_VBLANK_INT(metro_interrupt,10)   /* ? */
3806   MDRV_CPU_VBLANK_INT_HACK(metro_interrupt,10)   /* ? */
38073807
38083808   MDRV_MACHINE_RESET(metro)
38093809
r1877r1878
38363836   /* basic machine hardware */
38373837   MDRV_CPU_ADD(M68000, 16000000)
38383838   MDRV_CPU_PROGRAM_MAP(bangball_readmem,bangball_writemem)
3839   MDRV_CPU_VBLANK_INT(bangball_interrupt,1)
3839   MDRV_CPU_VBLANK_INT("main", bangball_interrupt)
38403840
38413841   MDRV_MACHINE_RESET(metro)
38423842
r1877r1878
38693869   /* basic machine hardware */
38703870   MDRV_CPU_ADD(M68000, 16000000)
38713871   MDRV_CPU_PROGRAM_MAP(batlbubl_readmem,batlbubl_writemem)
3872   MDRV_CPU_VBLANK_INT(bangball_interrupt,1)
3872   MDRV_CPU_VBLANK_INT("main", bangball_interrupt)
38733873
38743874   MDRV_MACHINE_RESET(metro)
38753875
r1877r1878
39013901   /* basic machine hardware */
39023902   MDRV_CPU_ADD(M68000, 16000000)
39033903   MDRV_CPU_PROGRAM_MAP(daitorid_readmem,daitorid_writemem)
3904   MDRV_CPU_VBLANK_INT(metro_interrupt,10)   /* ? */
3904   MDRV_CPU_VBLANK_INT_HACK(metro_interrupt,10)   /* ? */
39053905
39063906   MDRV_CPU_ADD(UPD7810, 12000000)
39073907   /* audio CPU */
r1877r1878
39453945   /* basic machine hardware */
39463946   MDRV_CPU_ADD(M68000, 12000000)
39473947   MDRV_CPU_PROGRAM_MAP(dharma_readmem,dharma_writemem)
3948   MDRV_CPU_VBLANK_INT(metro_interrupt,10)   /* ? */
3948   MDRV_CPU_VBLANK_INT_HACK(metro_interrupt,10)   /* ? */
39493949
39503950   MDRV_CPU_ADD(UPD7810, 12000000)
39513951   /* audio CPU */
r1877r1878
39883988   /* basic machine hardware */
39893989   MDRV_CPU_ADD(M68000, 12000000)
39903990   MDRV_CPU_PROGRAM_MAP(karatour_readmem,karatour_writemem)
3991   MDRV_CPU_VBLANK_INT(karatour_interrupt,10)   /* ? */
3991   MDRV_CPU_VBLANK_INT_HACK(karatour_interrupt,10)   /* ? */
39923992
39933993   MDRV_CPU_ADD(UPD7810, 12000000)
39943994   /* audio CPU */
r1877r1878
40314031   /* basic machine hardware */
40324032   MDRV_CPU_ADD(M68000, 12000000)
40334033   MDRV_CPU_PROGRAM_MAP(kokushi_readmem,kokushi_writemem)
4034   MDRV_CPU_VBLANK_INT(karatour_interrupt,10)   /* ? */
4034   MDRV_CPU_VBLANK_INT_HACK(karatour_interrupt,10)   /* ? */
40354035
40364036   MDRV_CPU_ADD(UPD7810, 12000000)
40374037   /* audio CPU */
r1877r1878
40744074   /* basic machine hardware */
40754075   MDRV_CPU_ADD(M68000, 12000000)
40764076   MDRV_CPU_PROGRAM_MAP(lastfort_readmem,lastfort_writemem)
4077   MDRV_CPU_VBLANK_INT(metro_interrupt,10)   /* ? */
4077   MDRV_CPU_VBLANK_INT_HACK(metro_interrupt,10)   /* ? */
40784078
40794079   MDRV_CPU_ADD(UPD7810, 12000000)
40804080   /* audio CPU */
r1877r1878
41164116   /* basic machine hardware */
41174117   MDRV_CPU_ADD(M68000, 12000000)
41184118   MDRV_CPU_PROGRAM_MAP(lastforg_readmem,lastforg_writemem)
4119   MDRV_CPU_VBLANK_INT(karatour_interrupt,10)   /* ? */
4119   MDRV_CPU_VBLANK_INT_HACK(karatour_interrupt,10)   /* ? */
41204120
41214121   MDRV_CPU_ADD(UPD7810, 12000000)
41224122   /* audio CPU */
r1877r1878
41584158   /* basic machine hardware */
41594159   MDRV_CPU_ADD(M68000, 16000000)
41604160   MDRV_CPU_PROGRAM_MAP(dokyusei_readmem,dokyusei_writemem)
4161   MDRV_CPU_VBLANK_INT(dokyusei_interrupt,2)   /* ? */
4161   MDRV_CPU_VBLANK_INT_HACK(dokyusei_interrupt,2)   /* ? */
41624162
41634163   MDRV_MACHINE_RESET(metro)
41644164
r1877r1878
42084208   /* basic machine hardware */
42094209   MDRV_CPU_ADD(M68000, 16000000)
42104210   MDRV_CPU_PROGRAM_MAP(dokyusp_readmem,dokyusp_writemem)
4211   MDRV_CPU_VBLANK_INT(gakusai_interrupt,1)
4211   MDRV_CPU_VBLANK_INT("main", gakusai_interrupt)
42124212
42134213   MDRV_MACHINE_RESET(metro)
42144214   MDRV_NVRAM_HANDLER(dokyusp)
r1877r1878
42464246   /* basic machine hardware */
42474247   MDRV_CPU_ADD(M68000, 16000000)
42484248   MDRV_CPU_PROGRAM_MAP(gakusai_readmem,gakusai_writemem)
4249   MDRV_CPU_VBLANK_INT(gakusai_interrupt,1)
4249   MDRV_CPU_VBLANK_INT("main", gakusai_interrupt)
42504250
42514251   MDRV_MACHINE_RESET(metro)
42524252   MDRV_NVRAM_HANDLER(93C46)
r1877r1878
42844284   /* basic machine hardware */
42854285   MDRV_CPU_ADD(M68000, 16000000)
42864286   MDRV_CPU_PROGRAM_MAP(gakusai2_readmem,gakusai2_writemem)
4287   MDRV_CPU_VBLANK_INT(gakusai_interrupt,1)
4287   MDRV_CPU_VBLANK_INT("main", gakusai_interrupt)
42884288
42894289   MDRV_MACHINE_RESET(metro)
42904290   MDRV_NVRAM_HANDLER(93C46)
r1877r1878
43224322   /* basic machine hardware */
43234323   MDRV_CPU_ADD(M68000, 12000000)
43244324   MDRV_CPU_PROGRAM_MAP(pangpoms_readmem,pangpoms_writemem)
4325   MDRV_CPU_VBLANK_INT(metro_interrupt,10)   /* ? */
4325   MDRV_CPU_VBLANK_INT_HACK(metro_interrupt,10)   /* ? */
43264326
43274327   MDRV_CPU_ADD(UPD7810, 12000000)
43284328   /* audio CPU */
r1877r1878
43654365   /* basic machine hardware */
43664366   MDRV_CPU_ADD(M68000, 12000000)
43674367   MDRV_CPU_PROGRAM_MAP(poitto_readmem,poitto_writemem)
4368   MDRV_CPU_VBLANK_INT(metro_interrupt,10)   /* ? */
4368   MDRV_CPU_VBLANK_INT_HACK(metro_interrupt,10)   /* ? */
43694369
43704370   MDRV_CPU_ADD(UPD7810, 12000000)
43714371   /* audio CPU */
r1877r1878
44084408   /* basic machine hardware */
44094409   MDRV_CPU_ADD(M68000, 12000000)
44104410   MDRV_CPU_PROGRAM_MAP(pururun_readmem,pururun_writemem)
4411   MDRV_CPU_VBLANK_INT(metro_interrupt,10)   /* ? */
4411   MDRV_CPU_VBLANK_INT_HACK(metro_interrupt,10)   /* ? */
44124412
44134413   MDRV_CPU_ADD(UPD7810, 12000000)
44144414   /* audio CPU */
r1877r1878
44524452   /* basic machine hardware */
44534453   MDRV_CPU_ADD(M68000, 12000000)
44544454   MDRV_CPU_PROGRAM_MAP(skyalert_readmem,skyalert_writemem)
4455   MDRV_CPU_VBLANK_INT(metro_interrupt,10)   /* ? */
4455   MDRV_CPU_VBLANK_INT_HACK(metro_interrupt,10)   /* ? */
44564456
44574457   MDRV_CPU_ADD(UPD7810, 12000000)
44584458   /* audio CPU */
r1877r1878
44954495   /* basic machine hardware */
44964496   MDRV_CPU_ADD(M68000, 12000000)
44974497   MDRV_CPU_PROGRAM_MAP(toride2g_readmem,toride2g_writemem)
4498   MDRV_CPU_VBLANK_INT(metro_interrupt,10)   /* ? */
4498   MDRV_CPU_VBLANK_INT_HACK(metro_interrupt,10)   /* ? */
44994499
45004500   MDRV_CPU_ADD(UPD7810, 12000000)
45014501   /* audio CPU */
r1877r1878
45384538   /* basic machine hardware */
45394539   MDRV_CPU_ADD(M68000, 12000000)   /* ??? */
45404540   MDRV_CPU_PROGRAM_MAP(mouja_readmem,mouja_writemem)
4541   MDRV_CPU_VBLANK_INT(mouja_interrupt,1)
4541   MDRV_CPU_VBLANK_INT("main", mouja_interrupt)
45424542
45434543   MDRV_MACHINE_RESET(metro)
45444544
r1877r1878
45744574   /* basic machine hardware */
45754575   MDRV_CPU_ADD(M68000, 16000000)
45764576   MDRV_CPU_PROGRAM_MAP(blzntrnd_readmem,blzntrnd_writemem)
4577   MDRV_CPU_VBLANK_INT(karatour_interrupt,10)   /* ? */
4577   MDRV_CPU_VBLANK_INT_HACK(karatour_interrupt,10)   /* ? */
45784578
45794579   MDRV_CPU_ADD(Z80, 8000000)
45804580   /* audio CPU */
r1877r1878
46144614   /* basic machine hardware */
46154615   MDRV_CPU_ADD(M68000, 16000000)
46164616   MDRV_CPU_PROGRAM_MAP(blzntrnd_readmem,blzntrnd_writemem)
4617   MDRV_CPU_VBLANK_INT(karatour_interrupt,10)   /* ? */
4617   MDRV_CPU_VBLANK_INT_HACK(karatour_interrupt,10)   /* ? */
46184618
46194619   MDRV_CPU_ADD(Z80, 8000000)
46204620   /* audio CPU */
r1877r1878
46864686
46874687   MDRV_CPU_PROGRAM_MAP(puzzlet_map,0)
46884688   MDRV_CPU_IO_MAP(puzzlet_io_map,0)
4689   MDRV_CPU_VBLANK_INT(puzzlet_interrupt, 5)
4689   MDRV_CPU_VBLANK_INT_HACK(puzzlet_interrupt, 5)
46904690
46914691   MDRV_MACHINE_RESET(metro)
46924692
r1877r1878
47674767   porta = 0x00;
47684768   portb = 0x00;
47694769   busy_sndcpu = 0;
4770   metro_sound_rombank_w(0, 0x00);
4770   metro_sound_rombank_w(machine, 0, 0x00);
47714771}
47724772
47734773static DRIVER_INIT( karatour )
r1877r1878
47904790   porta = 0x00;
47914791   portb = 0x00;
47924792   busy_sndcpu = 0;
4793   daitorid_sound_rombank_w(0, 0x00);
4793   daitorid_sound_rombank_w(machine, 0, 0x00);
47944794}
47954795
47964796
src/mame/drivers/angelkds.c
r1877r1878
596596   MDRV_CPU_ADD(Z80, 8000000) /* 8MHz? 6 seems too slow? */
597597   MDRV_CPU_PROGRAM_MAP(main_map,0)
598598   MDRV_CPU_IO_MAP(main_portmap,0)
599   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
599   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
600600
601601   MDRV_CPU_ADD(Z80, 4000000) /* 8 MHz? */
602602   MDRV_CPU_PROGRAM_MAP(sub_map,0)
src/mame/drivers/jrpacman.c
r1877r1878
269269   MDRV_CPU_ADD(Z80, 18432000/6)   /* 3.072 MHz */
270270   MDRV_CPU_PROGRAM_MAP(main_map,0)
271271   MDRV_CPU_IO_MAP(port_map,0)
272   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
272   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
273273
274274   /* video hardware */
275275   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/hshavoc.c
r1877r1878
134134static MACHINE_DRIVER_START( genesis_base )
135135   /*basic machine hardware */
136136   MDRV_CPU_ADD_TAG("main", M68000, MASTER_CLOCK / 7)
137   MDRV_CPU_VBLANK_INT(genesis_vblank_interrupt,1)
137   MDRV_CPU_VBLANK_INT("main", genesis_vblank_interrupt)
138138
139139   MDRV_CPU_ADD_TAG("sound", Z80, MASTER_CLOCK / 15)
140140   MDRV_CPU_PROGRAM_MAP(genesis_z80_readmem, genesis_z80_writemem)
141   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1) /* from vdp at scanline 0xe0 */
141   MDRV_CPU_VBLANK_INT("main", irq0_line_hold) /* from vdp at scanline 0xe0 */
142142
143143   MDRV_INTERLEAVE(100)
144144
r1877r1878
192192   ROM_LOAD( "pic16c57",  0x00, 0x01, NO_DUMP ) // protected
193193ROM_END
194194
195#ifdef UNUSED_DEFINITION
195196ROM_START( hshavoc2 ) /* Genesis Version, for reference */
196197   ROM_REGION( 0x200000, REGION_CPU1, 0 )
197198   ROM_LOAD( "hsh.rom", 0x000000, 0x100000, CRC(17be551c) SHA1(0dc1969098716ba332978b89356f62961417682b) )
198199ROM_END
200#endif
199201
200202static READ16_HANDLER( vdp_fake_r )
201203{
src/mame/drivers/circusc.c
r1877r1878
9393
9494      /* CS3 */
9595      case 1:
96         SN76496_0_w(0, sn_latch);
96         SN76496_0_w(machine, 0, sn_latch);
9797         break;
9898
9999      /* CS4 */
100100      case 2:
101         SN76496_1_w(0, sn_latch);
101         SN76496_1_w(machine, 0, sn_latch);
102102         break;
103103
104104      /* CS5 */
r1877r1878
303303   /* basic machine hardware */
304304   MDRV_CPU_ADD(M6809, 2048000)        /* 2 MHz */
305305   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
306   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
306   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
307307   MDRV_WATCHDOG_VBLANK_INIT(8)
308308
309309   /* audio CPU */     /* Z80 Clock is derived from a 14.31818 MHz crystal */
src/mame/drivers/laserbas.c
r1877r1878
131131   MDRV_CPU_ADD(Z80, 4000000)
132132   MDRV_CPU_PROGRAM_MAP(laserbas_memory,0)
133133   MDRV_CPU_IO_MAP(laserbas_io,0)
134   MDRV_CPU_VBLANK_INT(laserbas_interrupt,2)
134   MDRV_CPU_VBLANK_INT_HACK(laserbas_interrupt,2)
135135
136136
137137   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/mikie.c
r1877r1878
247247   // basic machine hardware
248248   MDRV_CPU_ADD(M6809, 1250000)   // ??? MC68A09E
249249   MDRV_CPU_PROGRAM_MAP(mikie_map, 0)
250   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
250   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
251251
252252   MDRV_CPU_ADD(Z80, CLK)   // 3.58 MHz
253253   /* audio CPU */
src/mame/drivers/midvunit.c
r1877r1878
219219
220220   /* bit 3 is the watchdog */
221221   if ((olddata ^ control_data) & 0x0008)
222      watchdog_reset_w(0, 0);
222      watchdog_reset_w(machine, 0, 0);
223223
224224   /* bit 1 is the DCS sound reset */
225225   dcs_reset_w((~control_data >> 1) & 1);
r1877r1878
240240
241241   /* bit 9 is the watchdog */
242242   if ((olddata ^ control_data) & 0x0200)
243      watchdog_reset_w(0, 0);
243      watchdog_reset_w(machine, 0, 0);
244244
245245   /* bit 8 is the LED */
246246
r1877r1878
386386static READ32_HANDLER( offroadc_serial_status_r )
387387{
388388   int status = midway_serial_pic2_status_r();
389   return (port1_r(offset, mem_mask) & 0x7fff7fff) | (status << 31) | (status << 15);
389   return (port1_r(machine, offset, mem_mask) & 0x7fff7fff) | (status << 31) | (status << 15);
390390}
391391
392392
r1877r1878
447447         /* bit 0x10 resets watchdog */
448448         if ((olddata ^ midvplus_misc[offset]) & 0x0010)
449449         {
450            watchdog_reset_w(0, 0);
450            watchdog_reset_w(machine, 0, 0);
451451            logit = 0;
452452         }
453453         break;
src/mame/drivers/kingpin.c
r1877r1878
149149   MDRV_CPU_ADD(Z80, 3579545)
150150   MDRV_CPU_PROGRAM_MAP(kingpin_program_map,0)
151151   MDRV_CPU_IO_MAP(kingpin_readport,kingpin_writeport)
152   MDRV_CPU_VBLANK_INT(kingpin_video_interrupt,1)
152   MDRV_CPU_VBLANK_INT("main", kingpin_video_interrupt)
153153
154154/*  SOUND CPU */
155155   MDRV_CPU_ADD(Z80, 3579545)
src/mame/drivers/namcond1.c
r1877r1878
295295   /* basic machine hardware */
296296   MDRV_CPU_ADD(M68000, 12288000)
297297   MDRV_CPU_PROGRAM_MAP(namcond1_map,0)
298   MDRV_CPU_VBLANK_INT(irq1_line_hold, 1)
298   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
299299   MDRV_CPU_PERIODIC_INT(ygv608_timed_interrupt, 1000)
300300
301301   MDRV_CPU_ADD(H83002, 16384000 )
302302   MDRV_CPU_PROGRAM_MAP( nd1h8rwmap, 0 )
303303   MDRV_CPU_IO_MAP( nd1h8iomap, 0 )
304   MDRV_CPU_VBLANK_INT( mcu_interrupt, 1 )
304   MDRV_CPU_VBLANK_INT("main", mcu_interrupt)
305305
306306   MDRV_INTERLEAVE(100)
307307
src/mame/drivers/usgames.c
r1877r1878
2424*/
2525
2626#include "driver.h"
27#include "deprecat.h"
2728#include "video/mc6845.h"
2829#include "sound/ay8910.h"
2930
3031/* video */
3132WRITE8_HANDLER( usgames_videoram_w );
3233WRITE8_HANDLER( usgames_charram_w );
33WRITE8_HANDLER( usgames_mc6845_address_w );
34WRITE8_HANDLER( usgames_mc6845_register_w );
3534VIDEO_START(usgames);
3635PALETTE_INIT(usgames);
3736VIDEO_UPDATE(usgames);
r1877r1878
103102   AM_RANGE(0x2020, 0x2020) AM_WRITE(lamps1_w)
104103   AM_RANGE(0x2030, 0x2030) AM_WRITE(lamps2_w)
105104
106   AM_RANGE(0x2040, 0x2040) AM_WRITE(usgames_mc6845_address_w)
107   AM_RANGE(0x2041, 0x2041) AM_WRITE(usgames_mc6845_register_w)
105   AM_RANGE(0x2040, 0x2040) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
106   AM_RANGE(0x2041, 0x2041) AM_DEVWRITE(MC6845, "crtc", mc6845_register_w)
108107
109108   AM_RANGE(0x2400, 0x2400) AM_WRITE(AY8910_control_port_0_w)
110109   AM_RANGE(0x2401, 0x2401) AM_WRITE(AY8910_write_port_0_w)
r1877r1878
123122   AM_RANGE(0x2420, 0x2420) AM_WRITE(lamps1_w)
124123   AM_RANGE(0x2430, 0x2430) AM_WRITE(lamps2_w)
125124
126   AM_RANGE(0x2440, 0x2440) AM_WRITE(usgames_mc6845_address_w)
127   AM_RANGE(0x2441, 0x2441) AM_WRITE(usgames_mc6845_register_w)
125   AM_RANGE(0x2440, 0x2440) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
126   AM_RANGE(0x2441, 0x2441) AM_DEVWRITE(MC6845, "crtc", mc6845_register_w)
128127
129128   AM_RANGE(0x2000, 0x2000) AM_WRITE(AY8910_control_port_0_w)
130129   AM_RANGE(0x2001, 0x2001) AM_WRITE(AY8910_write_port_0_w)
r1877r1878
292291   /* basic machine hardware */
293292   MDRV_CPU_ADD_TAG("main", M6809, 2000000) /* ?? */
294293   MDRV_CPU_PROGRAM_MAP(usgames_readmem,usgames_writemem)
295   MDRV_CPU_VBLANK_INT(irq0_line_hold,5) /* ?? */
294   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,5) /* ?? */
296295
297296   MDRV_NVRAM_HANDLER(generic_0fill)
298297
src/mame/drivers/opwolf.c
r1877r1878
567567   /* basic machine hardware */
568568   MDRV_CPU_ADD(M68000, 12000000 )   /* 12 MHz */
569569   MDRV_CPU_PROGRAM_MAP(opwolf_readmem,opwolf_writemem)
570   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
570   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)
571571
572572   MDRV_CPU_ADD(Z80, 4000000 )   /* 4 MHz */
573573   MDRV_CPU_PROGRAM_MAP(z80_readmem,z80_writemem)
r1877r1878
616616   /* basic machine hardware */
617617   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz ??? */
618618   MDRV_CPU_PROGRAM_MAP(opwolfb_readmem,opwolfb_writemem)
619   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
619   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)
620620
621621   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz ??? */
622622   MDRV_CPU_PROGRAM_MAP(z80_readmem,z80_writemem)
623623
624624   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz ??? */
625625   MDRV_CPU_PROGRAM_MAP(sub_z80_readmem,sub_z80_writemem)
626   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
626   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
627627
628628   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
629629
src/mame/drivers/surpratk.c
r1877r1878
3939         return paletteram[offset];
4040   }
4141   else if (videobank & 0x01)
42      return K053245_r(offset);
42      return K053245_r(machine,offset);
4343   else
4444      return ram[offset];
4545}
r1877r1878
4949   if (videobank & 0x02)
5050   {
5151      if (videobank & 0x04)
52         paletteram_xBBBBBGGGGGRRRRR_be_w(offset + 0x0800,data);
52         paletteram_xBBBBBGGGGGRRRRR_be_w(machine,offset + 0x0800,data);
5353      else
54         paletteram_xBBBBBGGGGGRRRRR_be_w(offset,data);
54         paletteram_xBBBBBGGGGGRRRRR_be_w(machine,offset,data);
5555   }
5656   else if (videobank & 0x01)
57      K053245_w(offset,data);
57      K053245_w(machine,offset,data);
5858   else
5959      ram[offset] = data;
6060}
r1877r1878
239239   /* basic machine hardware */
240240   MDRV_CPU_ADD(KONAMI, 3000000)   /* 053248 */
241241   MDRV_CPU_PROGRAM_MAP(surpratk_readmem,surpratk_writemem)
242   MDRV_CPU_VBLANK_INT(surpratk_interrupt,1)
242   MDRV_CPU_VBLANK_INT("main", surpratk_interrupt)
243243
244244   MDRV_MACHINE_RESET(surpratk)
245245
src/mame/drivers/pmpoker.c
r1877r1878
383383static mc6845_t *mc6845;
384384static tilemap *bg_tilemap;
385385
386static WRITE8_HANDLER( pmpoker_mc6845_address_w )
387{
388   mc6845_address_w(mc6845, data);
389}
390
391static READ8_HANDLER( pmpoker_mc6845_register_r )
392{
393   return mc6845_register_r(mc6845);
394}
395
396static WRITE8_HANDLER( pmpoker_mc6845_register_w )
397{
398   mc6845_register_w(mc6845, data);
399}
400
401386static WRITE8_HANDLER( pmpoker_videoram_w )
402387{
403388   videoram[offset] = data;
r1877r1878
484469
485470static ADDRESS_MAP_START( pmpoker_map, ADDRESS_SPACE_PROGRAM, 8 )
486471   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)   /* battery backed RAM */
487   AM_RANGE(0x0800, 0x0800) AM_WRITE(pmpoker_mc6845_address_w)
488   AM_RANGE(0x0801, 0x0801) AM_READWRITE(pmpoker_mc6845_register_r, pmpoker_mc6845_register_w)
472   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
473   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
489474   AM_RANGE(0x0844, 0x0847) AM_READWRITE(pia_0_r, pia_0_w)
490475   AM_RANGE(0x0848, 0x084b) AM_READWRITE(pia_1_r, pia_1_w)
491476   AM_RANGE(0x1000, 0x13ff) AM_RAM AM_WRITE(pmpoker_videoram_w) AM_BASE(&videoram)
r1877r1878
496481
497482static ADDRESS_MAP_START( jokerpkr_map, ADDRESS_SPACE_PROGRAM, 8 )
498483   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)   /* battery backed RAM */
499   AM_RANGE(0x0800, 0x0800) AM_WRITE(pmpoker_mc6845_address_w)
500   AM_RANGE(0x0801, 0x0801) AM_READWRITE(pmpoker_mc6845_register_r, pmpoker_mc6845_register_w)
484   AM_RANGE(0x0800, 0x0800) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
485   AM_RANGE(0x0801, 0x0801) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
501486   AM_RANGE(0x0844, 0x0847) AM_READWRITE(pia_0_r, pia_0_w)
502487   AM_RANGE(0x0848, 0x084b) AM_READWRITE(pia_1_r, pia_1_w)
503488   AM_RANGE(0x1000, 0x13ff) AM_RAM AM_WRITE(pmpoker_videoram_w) AM_BASE(&videoram)
r1877r1878
902887{
903888   switch( mux_data&0xf0 )   /* bits 4-7 */
904889   {
905      case 0x10: return input_port_0_r(0);
906      case 0x20: return input_port_1_r(0);
907      case 0x40: return input_port_2_r(0);
908      case 0x80: return input_port_3_r(0);
890      case 0x10: return input_port_0_r(machine,0);
891      case 0x20: return input_port_1_r(machine,0);
892      case 0x40: return input_port_2_r(machine,0);
893      case 0x80: return input_port_3_r(machine,0);
909894   }
910895   return 0xff;
911896}
r1877r1878
1003988   /* basic machine hardware */
1004989   MDRV_CPU_ADD_TAG("main", M6502, MASTER_CLOCK/16)   /* guess */
1005990   MDRV_CPU_PROGRAM_MAP(pmpoker_map, 0)
1006   MDRV_CPU_VBLANK_INT(nmi_line_pulse, 1)
991   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
1007992
1008993   MDRV_NVRAM_HANDLER(generic_0fill)
1009994
src/mame/drivers/suna16.c
r1877r1878
5353{
5454   if (ACCESSING_LSB)
5555   {
56      soundlatch_w( 0, data & 0xff );
56      soundlatch_w( machine, 0, data & 0xff );
5757   }
5858   if (data & ~0xff)   logerror("CPU#0 PC %06X - Sound latch unknown bits: %04X\n", activecpu_get_pc(), data);
5959}
r1877r1878
848848   /* basic machine hardware */
849849   MDRV_CPU_ADD(M68000, 8000000)   /* ? */
850850   MDRV_CPU_PROGRAM_MAP(bssoccer_readmem,bssoccer_writemem)
851   MDRV_CPU_VBLANK_INT(bssoccer_interrupt,2)
851   MDRV_CPU_VBLANK_INT_HACK(bssoccer_interrupt,2)
852852
853853   MDRV_CPU_ADD(Z80, 3579545)      /* Z80B */
854854   /* audio CPU */
r1877r1878
911911   /* basic machine hardware */
912912   MDRV_CPU_ADD(M68000, 8000000)
913913   MDRV_CPU_PROGRAM_MAP(uballoon_readmem,uballoon_writemem)
914   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
914   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
915915
916916   MDRV_CPU_ADD(Z80, 3579545)
917917   /* audio CPU */   /* ? */
r1877r1878
962962   /* basic machine hardware */
963963   MDRV_CPU_ADD(M68000, 24000000/4)
964964   MDRV_CPU_PROGRAM_MAP(sunaq_readmem,sunaq_writemem)
965   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
965   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
966966
967967   MDRV_CPU_ADD(Z80, 14318000/4)
968968   /* audio CPU */
r1877r1878
10351035   /* basic machine hardware */
10361036   MDRV_CPU_ADD(M68000, 24000000/4)
10371037   MDRV_CPU_PROGRAM_MAP(bestbest_map,0)
1038   MDRV_CPU_VBLANK_INT(bssoccer_interrupt,2)
1038   MDRV_CPU_VBLANK_INT_HACK(bssoccer_interrupt,2)
10391039
10401040   MDRV_CPU_ADD(Z80, 24000000/4)
10411041   MDRV_CPU_PROGRAM_MAP(bestbest_sound_map,0)
src/mame/drivers/zaccaria.c
r1877r1878
108108static READ8_HANDLER( zaccaria_port0a_r )
109109{
110110   if (active_8910 == 0)
111      return AY8910_read_port_0_r(0);
111      return AY8910_read_port_0_r(machine,0);
112112   else
113      return AY8910_read_port_1_r(0);
113      return AY8910_read_port_1_r(machine,0);
114114}
115115
116116static WRITE8_HANDLER( zaccaria_port0a_w )
r1877r1878
128128   {
129129      /* bit 0 goes to the 8910 #0 BC1 pin */
130130      if (last & 0x01)
131         AY8910_control_port_0_w(0,port0a);
131         AY8910_control_port_0_w(machine,0,port0a);
132132      else
133         AY8910_write_port_0_w(0,port0a);
133         AY8910_write_port_0_w(machine,0,port0a);
134134   }
135135   else if ((last & 0x02) == 0x00 && (data & 0x02) == 0x02)
136136   {
r1877r1878
143143   {
144144      /* bit 2 goes to the 8910 #1 BC1 pin */
145145      if (last & 0x04)
146         AY8910_control_port_1_w(0,port0a);
146         AY8910_control_port_1_w(machine,0,port0a);
147147      else
148         AY8910_write_port_1_w(0,port0a);
148         AY8910_write_port_1_w(machine,0,port0a);
149149   }
150150   else if ((last & 0x08) == 0x00 && (data & 0x08) == 0x08)
151151   {
r1877r1878
161161{
162162   static int toggle;
163163
164   pia_0_cb1_w(0,toggle & 1);
164   pia_0_cb1_w(machine,0,toggle & 1);
165165   toggle ^= 1;
166166}
167167
r1877r1878
171171
172172static READ8_HANDLER( zaccaria_port1a_r )
173173{
174   if (~port1b & 1) return tms5220_status_r(0);
174   if (~port1b & 1) return tms5220_status_r(machine,0);
175175   else return port1a;
176176}
177177
r1877r1878
187187   // bit 0 = /RS
188188
189189   // bit 1 = /WS
190   if (~data & 2) tms5220_data_w(0,port1a);
190   if (~data & 2) tms5220_data_w(machine,0,port1a);
191191
192192   // bit 3 = "ACS" (goes, inverted, to input port 6 bit 3)
193193   acs = ~data & 0x08;
r1877r1878
210210
211211static void tms5220_irq_handler(int state)
212212{
213   pia_1_cb1_w(0,state ? 0 : 1);
213   pia_1_cb1_w(Machine,0,state ? 0 : 1);
214214}
215215
216216
r1877r1878
257257
258258static WRITE8_HANDLER( sound_command_w )
259259{
260   soundlatch_w(0,data);
261   cpunum_set_input_line(Machine, 2,0,(data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
260   soundlatch_w(machine,0,data);
261   cpunum_set_input_line(machine, 2,0,(data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
262262}
263263
264264static WRITE8_HANDLER( sound1_command_w )
265265{
266   pia_0_ca1_w(0,data & 0x80);
267   soundlatch2_w(0,data);
266   pia_0_ca1_w(machine,0,data & 0x80);
267   soundlatch2_w(machine,0,data);
268268}
269269
270270static WRITE8_HANDLER( mc1408_data_w )
r1877r1878
300300   switch (offset)
301301   {
302302      case 0:
303         return (input_port_6_r(0) & 0x07) | (acs & 0x08);   /* bits 4 and 5 must be 0 in Jack Rabbit */
303         return (input_port_6_r(machine,0) & 0x07) | (acs & 0x08);   /* bits 4 and 5 must be 0 in Jack Rabbit */
304304
305305      case 2:
306306         return 0x10;    /* Jack Rabbit */
r1877r1878
324324
325325static WRITE8_HANDLER( nmienable_w )
326326{
327   interrupt_enable_w(0,data & 1);
327   interrupt_enable_w(machine,0,data & 1);
328328}
329329
330330
r1877r1878
662662   /* basic machine hardware */
663663   MDRV_CPU_ADD(Z80,XTAL_18_432MHz/6)   /* verified on pcb */
664664   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
665   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
665   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
666666
667667   MDRV_CPU_ADD(M6802,XTAL_3_579545MHz) /* verified on pcb */
668668   MDRV_CPU_PROGRAM_MAP(sound_readmem1,sound_writemem1)
src/mame/drivers/shadfrce.c
r1877r1878
212212{
213213   if (ACCESSING_MSB)
214214   {
215      soundlatch_w(1,data >> 8);
216      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE );
215      soundlatch_w(machine,1,data >> 8);
216      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE );
217217   }
218218   else
219219   {
r1877r1878
221221      double brt = (data & 0xff) / 255.0;
222222
223223      for (i = 0; i < 0x4000; i++)
224         palette_set_brightness(Machine,i,brt);
224         palette_set_brightness(machine,i,brt);
225225   }
226226}
227227
r1877r1878
553553static MACHINE_DRIVER_START( shadfrce )
554554   MDRV_CPU_ADD(M68000, 28000000/2) /* ? Guess - CPU is rated for 16MHz */
555555   MDRV_CPU_PROGRAM_MAP(shadfrce_readmem,shadfrce_writemem)
556   MDRV_CPU_VBLANK_INT(shadfrce_interrupt,2)
556   MDRV_CPU_VBLANK_INT_HACK(shadfrce_interrupt,2)
557557
558558   MDRV_CPU_ADD(Z80, 3579545)
559559   /* audio CPU */
src/mame/drivers/speedbal.c
r1877r1878
5151***************************************************************************/
5252
5353#include "driver.h"
54#include "deprecat.h"
5455#include "sound/3812intf.h"
5556
5657
r1877r1878
230231   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz ??? */
231232   MDRV_CPU_PROGRAM_MAP(main_cpu_map,0)
232233   MDRV_CPU_IO_MAP(main_cpu_io_map,0)
233   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
234   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
234235
235236   MDRV_CPU_ADD(Z80, 2660000)   /* 2.66 MHz ???  Maybe yes */
236237   MDRV_CPU_PROGRAM_MAP(sound_cpu_map,0)
237238   MDRV_CPU_IO_MAP(sound_cpu_io_map,0)
238   MDRV_CPU_VBLANK_INT(irq0_line_hold,8)
239   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,8)
239240
240241   /* video hardware */
241242   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/yumefuda.c
r1877r1878
166166      case 0x02: return readinputport(2);
167167      case 0x04: return readinputport(3);
168168      case 0x08: return readinputport(4);
169      case 0x10: return 0xff; return readinputport(5);
170      case 0x20: return 0xff; return readinputport(6);
169      /* FIXME: Was this a quick hack? */
170      case 0x10: return 0xff; //return readinputport(5);
171      case 0x20: return 0xff; //return readinputport(6);
171172   }
172173   return 0xff;
173174}
r1877r1878
197198
198199/***************************************************************************************/
199200
200static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
201   AM_RANGE(0x0000, 0x7fff) AM_READ(MRA8_ROM)
202   AM_RANGE(0x8000, 0x9fff) AM_READ(MRA8_BANK1)
203   AM_RANGE(0xaf80, 0xafff) AM_READ(custom_ram_r)
204   AM_RANGE(0xb000, 0xb0ff) AM_READ(MRA8_RAM)
205   AM_RANGE(0xc000, 0xc3ff) AM_READ(MRA8_RAM)
206   AM_RANGE(0xd000, 0xd3ff) AM_READ(MRA8_RAM)
207   AM_RANGE(0xe000, 0xffff) AM_READ(MRA8_RAM)
208ADDRESS_MAP_END
209
210static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
211   AM_RANGE(0x0000, 0x7fff) AM_WRITE(MWA8_ROM)
212   AM_RANGE(0x8000, 0x9fff) AM_WRITE(MWA8_ROM)
201static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
202   AM_RANGE(0x0000, 0x7fff) AM_ROM
203   AM_RANGE(0x8000, 0x9fff) AM_READWRITE(MRA8_BANK1, MWA8_ROM)
213204   AM_RANGE(0xa7fc, 0xa7fc) AM_WRITE(prot_lock_w)
214205   AM_RANGE(0xa7ff, 0xa7ff) AM_WRITE(eeprom_w)
215   AM_RANGE(0xaf80, 0xafff) AM_WRITE(custom_ram_w) AM_BASE(&cus_ram) //260d - 2626
216   AM_RANGE(0xb000, 0xb0ff) AM_WRITE(MWA8_RAM) AM_WRITE(paletteram_RRRGGGBB_w) AM_BASE(&paletteram)/*Wrong format*/
217   AM_RANGE(0xc000, 0xc3ff) AM_WRITE(yumefuda_vram_w) AM_BASE(&videoram)
218   AM_RANGE(0xd000, 0xd3ff) AM_WRITE(yumefuda_cram_w) AM_BASE(&colorram)
219   AM_RANGE(0xe000, 0xffff) AM_WRITE(MWA8_RAM)
206   AM_RANGE(0xaf80, 0xafff) AM_READWRITE(custom_ram_r, custom_ram_w) AM_BASE(&cus_ram) /*260d - 2626*/
207   AM_RANGE(0xb000, 0xb0ff) AM_READWRITE(MRA8_RAM, paletteram_RRRGGGBB_w) AM_BASE(&paletteram) /*Wrong format*/
208   AM_RANGE(0xc000, 0xc3ff) AM_READWRITE(MRA8_RAM, yumefuda_vram_w) AM_BASE(&videoram)
209   AM_RANGE(0xd000, 0xd3ff) AM_READWRITE(MRA8_RAM, yumefuda_cram_w) AM_BASE(&colorram)
210   AM_RANGE(0xe000, 0xffff) AM_RAM
220211ADDRESS_MAP_END
221212
222static ADDRESS_MAP_START( readport, ADDRESS_SPACE_IO, 8 )
213static ADDRESS_MAP_START( port_map, ADDRESS_SPACE_IO, 8 )
223214   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
224   AM_RANGE(0x40, 0x40) AM_READ(AY8910_read_port_0_r)
215   AM_RANGE(0x40, 0x40) AM_READWRITE(AY8910_read_port_0_r, AY8910_control_port_0_w)
216   AM_RANGE(0x41, 0x41) AM_WRITE(AY8910_write_port_0_w)
217   AM_RANGE(0x80, 0x80) AM_WRITE(mux_w)
225218   AM_RANGE(0x81, 0x81) AM_READ(eeprom_r)
226219   AM_RANGE(0x82, 0x82) AM_READ(mux_r)
220   AM_RANGE(0xc0, 0xc0) AM_WRITE(port_c0_w) /*watchdog write?*/
227221ADDRESS_MAP_END
228222
229static ADDRESS_MAP_START( writeport, ADDRESS_SPACE_IO, 8 )
230   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
231   AM_RANGE(0x40, 0x40) AM_WRITE(AY8910_control_port_0_w)
232   AM_RANGE(0x41, 0x41) AM_WRITE(AY8910_write_port_0_w)
233   AM_RANGE(0x80, 0x80) AM_WRITE(mux_w)
234   AM_RANGE(0xc0, 0xc0) AM_WRITE(port_c0_w) //watchdog write?
235ADDRESS_MAP_END
236
237223static MACHINE_DRIVER_START( yumefuda )
238224
239225   /* basic machine hardware */
240226   MDRV_CPU_ADD(Z80 , 6000000) /*???*/
241   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
242   MDRV_CPU_IO_MAP(readport,writeport)
243   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
227   MDRV_CPU_PROGRAM_MAP(main_map,0)
228   MDRV_CPU_IO_MAP(port_map,0)
229   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
244230
245231   MDRV_NVRAM_HANDLER(93C46)
246232
src/mame/drivers/jongkyo.c
r1877r1878
108108   switch (keyboard_select)
109109   {
110110
111      default:
112         printf("keyboard1_r, select %02x\n",keyboard_select);
113         return 0xff;
114
115111      case 0xef:
116112         return  readinputportbytag("0");
117113
r1877r1878
126122
127123      case 0xfe:
128124         return  readinputportbytag("4");
125
126      default:
127         printf("keyboard1_r, select %02x\n",keyboard_select);
128         /* fall through */
129129   }
130130
131131   return 0xff;
r1877r1878
136136{
137137   switch (keyboard_select)
138138   {
139
140      default:
141         printf("keyboard2_r, select %02x\n",keyboard_select);
142         return 0xff;
143
144139      case 0xef:
145140         return  readinputportbytag("5");
146141
r1877r1878
155150
156151      case 0xfe:
157152         return  readinputportbytag("9");
153
154      default:
155         printf("keyboard2_r, select %02x\n",keyboard_select);
156         /* fall through */
158157   }
159158
160159   return 0xff;
r1877r1878
591590   MDRV_CPU_ADD(Z80,JONGKYO_CLOCK/4)
592591   MDRV_CPU_PROGRAM_MAP(jongkyo_memmap,0)
593592   MDRV_CPU_IO_MAP(jongkyo_portmap,0)
594   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
593   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
595594
596595   /* video hardware */
597596   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/attckufo.c
r1877r1878
6464{
6565   switch(offset)
6666   {
67      case 0: return input_port_0_r(0);
68      case 2: return input_port_1_r(0);
67      case 0: return input_port_0_r(machine,0);
68      case 2: return input_port_1_r(machine,0);
6969   }
7070   return 0xff;
7171}
src/mame/drivers/littlerb.c
r1877r1878
302302}
303303#endif
304304
305static void draw_sprite(mame_bitmap *bitmap, int xsize,int ysize, int offset, int xpos, int ypos )
305static void draw_sprite(bitmap_t *bitmap, int xsize,int ysize, int offset, int xpos, int ypos )
306306{
307307   UINT16* spritegfx = littlerb_region4;
308308   int x,y;
r1877r1878
362362static MACHINE_DRIVER_START( littlerb )
363363   MDRV_CPU_ADD(M68000, 12000000)
364364   MDRV_CPU_PROGRAM_MAP(littlerb_main, 0)
365   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
365   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
366366
367367
368368   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/firebeat.c
r1877r1878
147147}
148148
149149
150static void gcu_draw_object(int chip, mame_bitmap *bitmap, const rectangle *cliprect, UINT32 *cmd)
150static void gcu_draw_object(int chip, bitmap_t *bitmap, const rectangle *cliprect, UINT32 *cmd)
151151{
152152   // 0x00: xxx----- -------- -------- --------   command type
153153   // 0x00: -------- xxxxxxxx xxxxxxxx xxxxxxxx   object data address in vram
r1877r1878
300300   }
301301}
302302
303static void gcu_fill_rect(mame_bitmap *bitmap, const rectangle *cliprect, UINT32 *cmd)
303static void gcu_fill_rect(bitmap_t *bitmap, const rectangle *cliprect, UINT32 *cmd)
304304{
305305   int i, j;
306306   int x1, y1, x2, y2;
r1877r1878
347347   }
348348}
349349
350static void gcu_draw_character(int chip, mame_bitmap *bitmap, const rectangle *cliprect, UINT32 *cmd)
350static void gcu_draw_character(int chip, bitmap_t *bitmap, const rectangle *cliprect, UINT32 *cmd)
351351{
352352   // 0x00: xxx----- -------- -------- --------   command type
353353   // 0x00: -------- xxxxxxxx xxxxxxxx xxxxxxxx   character data address in vram
r1877r1878
395395   }
396396}
397397
398static void gcu_exec_display_list(int chip, mame_bitmap *bitmap, const rectangle *cliprect, UINT32 address)
398static void gcu_exec_display_list(int chip, bitmap_t *bitmap, const rectangle *cliprect, UINT32 address)
399399{
400400   int counter = 0;
401401   int end = 0;
r1877r1878
12211221
12221222   if (!(mem_mask & 0xff000000))
12231223   {
1224      r |= pc16552d_0_r((offset*4)+0) << 24;
1224      r |= pc16552d_0_r(machine, (offset*4)+0) << 24;
12251225   }
12261226   if (!(mem_mask & 0x00ff0000))
12271227   {
1228      r |= pc16552d_0_r((offset*4)+1) << 16;
1228      r |= pc16552d_0_r(machine, (offset*4)+1) << 16;
12291229   }
12301230   if (!(mem_mask & 0x0000ff00))
12311231   {
1232      r |= pc16552d_0_r((offset*4)+2) << 8;
1232      r |= pc16552d_0_r(machine, (offset*4)+2) << 8;
12331233   }
12341234   if (!(mem_mask & 0x000000ff))
12351235   {
1236      r |= pc16552d_0_r((offset*4)+3) << 0;
1236      r |= pc16552d_0_r(machine, (offset*4)+3) << 0;
12371237   }
12381238
12391239   return r;
r1877r1878
12431243{
12441244   if (!(mem_mask & 0xff000000))
12451245   {
1246      pc16552d_0_w((offset*4)+0, (data >> 24) & 0xff);
1246      pc16552d_0_w(machine, (offset*4)+0, (data >> 24) & 0xff);
12471247   }
12481248   if (!(mem_mask & 0x00ff0000))
12491249   {
1250      pc16552d_0_w((offset*4)+1, (data >> 16) & 0xff);
1250      pc16552d_0_w(machine, (offset*4)+1, (data >> 16) & 0xff);
12511251   }
12521252   if (!(mem_mask & 0x0000ff00))
12531253   {
1254      pc16552d_0_w((offset*4)+2, (data >> 8) & 0xff);
1254      pc16552d_0_w(machine, (offset*4)+2, (data >> 8) & 0xff);
12551255   }
12561256   if (!(mem_mask & 0x000000ff))
12571257   {
1258      pc16552d_0_w((offset*4)+3, (data >> 0) & 0xff);
1258      pc16552d_0_w(machine, (offset*4)+3, (data >> 0) & 0xff);
12591259   }
12601260}
12611261
r1877r1878
13241324
13251325   if (!(mem_mask & 0xff000000))   /* External RAM read */
13261326   {
1327      r |= YMZ280B_data_0_r(offset) << 24;
1327      r |= YMZ280B_data_0_r(machine, offset) << 24;
13281328   }
13291329   if (!(mem_mask & 0x00ff0000))
13301330   {
1331      r |= YMZ280B_status_0_r(offset) << 16;
1331      r |= YMZ280B_status_0_r(machine, offset) << 16;
13321332   }
13331333
13341334   return r;
r1877r1878
13371337static WRITE32_HANDLER( sound_w )
13381338{
13391339//  printf("sound_w: %08X, %08X, %08X\n", offset, data, mem_mask);
1340
13411340   if (!(mem_mask & 0xff000000))
13421341   {
1343      YMZ280B_register_0_w(offset, (data >> 24) & 0xff);
1342      YMZ280B_register_0_w(machine, offset, (data >> 24) & 0xff);
13441343   }
13451344   if (!(mem_mask & 0x00ff0000))
13461345   {
1347      YMZ280B_data_0_w(offset, (data >> 16) & 0xff);
1346      YMZ280B_data_0_w(machine, offset, (data >> 16) & 0xff);
13481347   }
13491348}
13501349
r1877r1878
13971396
13981397   if (!(mem_mask & 0xff000000))
13991398   {
1400      r |= pc16552d_1_r(offset >> 6) << 24;
1399      r |= pc16552d_1_r(machine, offset >> 6) << 24;
14011400   }
14021401
14031402   return r;
r1877r1878
14071406{
14081407   if (!(mem_mask & 0xff000000))
14091408   {
1410      pc16552d_1_w(offset >> 6, (data >> 24) & 0xff);
1409      pc16552d_1_w(machine, offset >> 6, (data >> 24) & 0xff);
14111410   }
14121411}
14131412
r1877r1878
15581557
15591558static WRITE32_HANDLER( lamp_output_kbm_w )
15601559{
1561   lamp_output_w(offset, data, mem_mask);
1560   lamp_output_w(machine, offset, data, mem_mask);
15621561
15631562   if (!(mem_mask & 0xff000000))
15641563   {
r1877r1878
15771576
15781577static WRITE32_HANDLER( lamp_output_ppp_w )
15791578{
1580   lamp_output_w(offset, data, mem_mask);
1579   lamp_output_w(machine, offset, data, mem_mask);
15811580
15821581   // ParaParaParadise lamps (active high)
15831582   // 0x00000100 Left
r1877r1878
16241623
16251624static WRITE32_HANDLER( lamp_output2_ppp_w )
16261625{
1627   lamp_output2_w(offset, data, mem_mask);
1626   lamp_output2_w(machine, offset, data, mem_mask);
16281627
16291628   // ParaParaParadise lamps (active high)
16301629   // 0x00010000 Top LED 0
r1877r1878
16581657
16591658static WRITE32_HANDLER( lamp_output3_ppp_w )
16601659{
1661   lamp_output3_w(offset, data, mem_mask);
1660   lamp_output3_w(machine, offset, data, mem_mask);
16621661
16631662   // ParaParaParadise lamps (active high)
16641663   // 0x00010000 Lamp 0
r1877r1878
19941993   MDRV_CPU_ADD(PPC403, 66000000)
19951994   MDRV_CPU_CONFIG(firebeat_ppc_cfg)
19961995   MDRV_CPU_PROGRAM_MAP(firebeat_map, 0)
1997   MDRV_CPU_VBLANK_INT(firebeat_interrupt,1)
1996   MDRV_CPU_VBLANK_INT("main", firebeat_interrupt)
19981997
19991998   MDRV_MACHINE_RESET(firebeat)
20001999   MDRV_NVRAM_HANDLER(firebeat)
r1877r1878
20322031   MDRV_CPU_ADD(PPC403, 66000000)
20332032   MDRV_CPU_CONFIG(firebeat_ppc_cfg)
20342033   MDRV_CPU_PROGRAM_MAP(firebeat_map, 0)
2035   MDRV_CPU_VBLANK_INT(firebeat_interrupt,1)
2034   MDRV_CPU_VBLANK_INT("left", firebeat_interrupt)
20362035
20372036   MDRV_MACHINE_RESET(firebeat)
20382037   MDRV_NVRAM_HANDLER(firebeat)
r1877r1878
22352234
22362235/*****************************************************************************/
22372236
2238static void init_lights(write32_handler out1, write32_handler out2, write32_handler out3)
2237static void init_lights(write32_machine_func out1, write32_machine_func out2, write32_machine_func out3)
22392238{
22402239   if(!out1) out1 = lamp_output_w;
22412240   if(!out2) out1 = lamp_output2_w;
r1877r1878
24102409
24112410/*****************************************************************************/
24122411
2413GAME( 2000, ppp,     0,       firebeat,      ppp,    ppp,      ROT0,   "Konami",  "ParaParaParadise", GAME_NOT_WORKING);
2414GAME( 2000, ppd,      0,       firebeat,      ppp,    ppd,      ROT0,   "Konami",  "ParaParaDancing", GAME_NOT_WORKING);
2415GAME( 2000, ppp11,     0,       firebeat,      ppp,    ppp,      ROT0,   "Konami",  "ParaParaParadise v1.1", GAME_NOT_WORKING);
2416GAMEL(2000, kbm,      0,       firebeat2,     kbm,    kbm,    ROT270,   "Konami",  "Keyboardmania", GAME_NOT_WORKING, layout_firebeat);
2417GAMEL(2000, kbm2nd,   0,       firebeat2,     kbm,    kbm,    ROT270,   "Konami",  "Keyboardmania 2nd Mix", GAME_NOT_WORKING, layout_firebeat);
2418GAMEL(2001, kbm3rd,   0,       firebeat2,     kbm,    kbm,    ROT270,   "Konami",  "Keyboardmania 3rd Mix", GAME_NOT_WORKING, layout_firebeat);
2419GAME( 2001, popn7,    0,       firebeat_spu,  popn,   ppp,      ROT0,   "Konami",  "Pop n' Music 7", GAME_NOT_WORKING);
2412GAME( 2000, ppp,     0,       firebeat,      ppp,    ppp,      ROT0,   "Konami",  "ParaParaParadise", GAME_NOT_WORKING)
2413GAME( 2000, ppd,      0,       firebeat,      ppp,    ppd,      ROT0,   "Konami",  "ParaParaDancing", GAME_NOT_WORKING)
2414GAME( 2000, ppp11,     0,       firebeat,      ppp,    ppp,      ROT0,   "Konami",  "ParaParaParadise v1.1", GAME_NOT_WORKING)
2415GAMEL(2000, kbm,      0,       firebeat2,     kbm,    kbm,    ROT270,   "Konami",  "Keyboardmania", GAME_NOT_WORKING, layout_firebeat)
2416GAMEL(2000, kbm2nd,   0,       firebeat2,     kbm,    kbm,    ROT270,   "Konami",  "Keyboardmania 2nd Mix", GAME_NOT_WORKING, layout_firebeat)
2417GAMEL(2001, kbm3rd,   0,       firebeat2,     kbm,    kbm,    ROT270,   "Konami",  "Keyboardmania 3rd Mix", GAME_NOT_WORKING, layout_firebeat)
2418GAME( 2001, popn7,    0,       firebeat_spu,  popn,   ppp,      ROT0,   "Konami",  "Pop n' Music 7", GAME_NOT_WORKING)
src/mame/drivers/clayshoo.c
r1877r1878
299299   MDRV_CPU_ADD(Z80,5068000/4)      /* 5.068/4 Mhz (divider is a guess) */
300300   MDRV_CPU_PROGRAM_MAP(main_map,0)
301301   MDRV_CPU_IO_MAP(main_io_map,0)
302   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
302   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
303303
304304   MDRV_MACHINE_START(clayshoo)
305305
src/mame/drivers/tagteam.c
r1877r1878
4646
4747static WRITE8_HANDLER( sound_command_w )
4848{
49   soundlatch_w(offset,data);
50   cpunum_set_input_line(Machine, 1,M6502_IRQ_LINE,HOLD_LINE);
49   soundlatch_w(machine,offset,data);
50   cpunum_set_input_line(machine, 1,M6502_IRQ_LINE,HOLD_LINE);
5151}
5252
5353
r1877r1878
272272   /* basic machine hardware */
273273   MDRV_CPU_ADD(M6502, 1500000)   /* 1.5 MHz ?? */
274274   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
275   MDRV_CPU_VBLANK_INT(tagteam_interrupt,1)
275   MDRV_CPU_VBLANK_INT("main", tagteam_interrupt)
276276
277277   MDRV_CPU_ADD(M6502, 975000)
278278   /* audio CPU */  /* 975 kHz ?? */
279279   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
280   MDRV_CPU_VBLANK_INT(nmi_line_pulse,16)   /* IRQs are triggered by the main CPU */
280   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,16)   /* IRQs are triggered by the main CPU */
281281
282282   /* video hardware */
283283   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/eolith.c
r1877r1878
258258static MACHINE_DRIVER_START( eolith45 )
259259   MDRV_CPU_ADD_TAG("cpu", E132N, 45000000)       /* 45 MHz */
260260   MDRV_CPU_PROGRAM_MAP(eolith_map,0)
261   MDRV_CPU_VBLANK_INT(eolith_speedup,262)
261   MDRV_CPU_VBLANK_INT_HACK(eolith_speedup,262)
262262
263263   /* sound cpu */
264264
src/mame/drivers/bigevglf.c
r1877r1878
377377
378378    */
379379   bit5 ^= 0x20;
380   return bigevglf_mcu_status_r(0) | (readinputport(1) & 3) | bit5; /* bit 0 and bit 1 - coin inputs */
380   return bigevglf_mcu_status_r(machine,0) | (readinputport(1) & 3) | bit5; /* bit 0 and bit 1 - coin inputs */
381381}
382382
383383static ADDRESS_MAP_START( bigevglf_sub_readport, ADDRESS_SPACE_IO, 8 )
r1877r1878
479479   MDRV_CPU_ADD(Z80,10000000/2)      /* 5 MHz ? */
480480   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
481481   MDRV_CPU_IO_MAP(bigevglf_readport,bigevglf_writeport)
482   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   /* vblank */
482   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   /* vblank */
483483
484484   MDRV_CPU_ADD(Z80,10000000/2)      /* 5 MHz ? */
485485   MDRV_CPU_PROGRAM_MAP(readmem_sub,writemem_sub)
486486   MDRV_CPU_IO_MAP(bigevglf_sub_readport,bigevglf_sub_writeport)
487   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   /* vblank */
487   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   /* vblank */
488488
489489   MDRV_CPU_ADD(Z80,8000000/2)
490490   /* audio CPU */      /* 4 MHz ? */
491491   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
492   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)   /* IRQ generated by ???;
492   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)   /* IRQ generated by ???;
493493        2 irqs/frame give good music tempo but also SOUND ERROR in test mode,
494494        4 irqs/frame give SOUND OK in test mode but music seems to be running too fast */
495495
src/mame/drivers/bagman.c
r1877r1878
5454        Port A of the 8910 is connected to IN0
5555        Port B of the 8910 is connected to IN1
5656
57DIP locations verified for:
58    - bagman (manual)
59
5760***************************************************************************/
5861
5962#include "driver.h"
r1877r1878
8386static UINT8 ls259_buf[8] = {0,0,0,0,0,0,0,0};
8487
8588
86static void start_talking (void)
89static void start_talking (running_machine *machine)
8790{
8891#if 0
8992   logerror("Talk started: selected bit %1i, selected roms QS %i  QT %i\n",
r1877r1878
9699#endif
97100
98101   speech_rom_address = 0x0;
99   tms5110_CTL_w(0,TMS5110_CMD_SPEAK);
100   tms5110_PDC_w(0,0);
101   tms5110_PDC_w(0,1);
102   tms5110_PDC_w(0,0);
102   tms5110_CTL_w(machine,0,TMS5110_CMD_SPEAK);
103   tms5110_PDC_w(machine,0,0);
104   tms5110_PDC_w(machine,0,1);
105   tms5110_PDC_w(machine,0,0);
103106}
104107
105static void reset_talking (void)
108static void reset_talking (running_machine *machine)
106109{
107110/*To be extremely accurate there should be a delays between each of
108111  the function calls below. In real they happen with the frequency of 160 kHz.
109112*/
110113
111   tms5110_CTL_w(0,TMS5110_CMD_RESET);
112   tms5110_PDC_w(0,0);
113   tms5110_PDC_w(0,1);
114   tms5110_PDC_w(0,0);
114   tms5110_CTL_w(machine,0,TMS5110_CMD_RESET);
115   tms5110_PDC_w(machine,0,0);
116   tms5110_PDC_w(machine,0,1);
117   tms5110_PDC_w(machine,0,0);
115118
116   tms5110_PDC_w(0,0);
117   tms5110_PDC_w(0,1);
118   tms5110_PDC_w(0,0);
119   tms5110_PDC_w(machine,0,0);
120   tms5110_PDC_w(machine,0,1);
121   tms5110_PDC_w(machine,0,0);
119122
120   tms5110_PDC_w(0,0);
121   tms5110_PDC_w(0,1);
122   tms5110_PDC_w(0,0);
123   tms5110_PDC_w(machine,0,0);
124   tms5110_PDC_w(machine,0,1);
125   tms5110_PDC_w(machine,0,0);
123126
124127   speech_rom_address = 0x0;
125128}
r1877r1878
164167
165168static WRITE8_HANDLER( bagman_ls259_w )
166169{
167   bagman_pal16r6_w(offset,data); /*this is just a simulation*/
170   bagman_pal16r6_w(machine,offset,data); /*this is just a simulation*/
168171
169172   if (ls259_buf[offset] != (data&1) )
170173   {
r1877r1878
174177      {
175178         if (ls259_buf[3] == 0)   /* 1->0 transition */
176179         {
177            reset_talking();
180            reset_talking(machine);
178181         }
179182         else
180183         {
181            start_talking();   /* 0->1 transition */
184            start_talking(machine);   /* 0->1 transition */
182185         }
183186      }
184187   }
r1877r1878
268271
269272
270273static INPUT_PORTS_START( bagman )
271   PORT_START   /* IN0 */
274   PORT_START_TAG("IN0")
272275   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
273276   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
274277   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
r1877r1878
278281   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
279282   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
280283
281   PORT_START   /* IN1 */
284   PORT_START_TAG("IN1")
282285   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
283286   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN4 )
284287   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
r1877r1878
288291   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
289292   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
290293
291   PORT_START   /* DSW */
292   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )   PORT_DIPLOCATION("SW1:1,2")
294   PORT_START_TAG("DSW")
295   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )         PORT_DIPLOCATION("SW1:1,2")
293296   PORT_DIPSETTING(   0x03, "2" )
294297   PORT_DIPSETTING(   0x02, "3" )
295298   PORT_DIPSETTING(   0x01, "4" )
296299   PORT_DIPSETTING(   0x00, "5" )
297   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coinage ) )   PORT_DIPLOCATION("SW1:3")
300   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coinage ) )         PORT_DIPLOCATION("SW1:3")
298301   PORT_DIPSETTING(   0x00, "2C/1C 1C/1C 1C/3C 1C/7C" )
299302   PORT_DIPSETTING(   0x04, "1C/1C 1C/2C 1C/6C 1C/14C" )
300   PORT_DIPNAME( 0x18, 0x18, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW1:4,5")
303   PORT_DIPNAME( 0x18, 0x18, DEF_STR( Difficulty ) )      PORT_DIPLOCATION("SW1:4,5")
301304   PORT_DIPSETTING(   0x18, DEF_STR( Easy ) )
302305   PORT_DIPSETTING(   0x10, DEF_STR( Medium ) )
303306   PORT_DIPSETTING(   0x08, DEF_STR( Hard ) )
304307   PORT_DIPSETTING(   0x00, DEF_STR( Hardest ) )
305   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Language ) )   PORT_DIPLOCATION("SW1:6")
308   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Language ) )         PORT_DIPLOCATION("SW1:6")
306309   PORT_DIPSETTING(   0x20, DEF_STR( English ) )
307310   PORT_DIPSETTING(   0x00, DEF_STR( French ) )
308   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Bonus_Life ) )   PORT_DIPLOCATION("SW1:7")
311   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Bonus_Life ) )      PORT_DIPLOCATION("SW1:7")
309312   PORT_DIPSETTING(   0x40, "30000" )
310313   PORT_DIPSETTING(   0x00, "40000" )
311   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )   PORT_DIPLOCATION("SW1:8")
314   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )         PORT_DIPLOCATION("SW1:8")
312315   PORT_DIPSETTING(   0x80, DEF_STR( Upright ) )
313316   PORT_DIPSETTING(   0x00, DEF_STR( Cocktail ) )
314317INPUT_PORTS_END
315318
316/* EXACTLY the same as bagman, the only difference is that
317Languade dip is replaced by Demo Sounds */
318319static INPUT_PORTS_START( bagmans )
319   PORT_START   /* IN0 */
320   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
321   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
322   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
323   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
324   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
325   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY
326   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
327   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
320   PORT_INCLUDE( bagman )
328321
329   PORT_START   /* IN1 */
330   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
331   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN4 )
332   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
333   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
334   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
335   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY PORT_COCKTAIL
336   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
337   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
338
339   PORT_START   /* DSW */
340   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
341   PORT_DIPSETTING(   0x03, "2" )
342   PORT_DIPSETTING(   0x02, "3" )
343   PORT_DIPSETTING(   0x01, "4" )
344   PORT_DIPSETTING(   0x00, "5" )
345   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coinage ) )
346   PORT_DIPSETTING(   0x00, "2C/1C 1C/1C 1C/3C 1C/7C" )
347   PORT_DIPSETTING(   0x04, "1C/1C 1C/2C 1C/6C 1C/14C" )
348   PORT_DIPNAME( 0x18, 0x18, DEF_STR( Difficulty ) )
349   PORT_DIPSETTING(   0x18, DEF_STR( Easy ) )
350   PORT_DIPSETTING(   0x10, DEF_STR( Medium ) )
351   PORT_DIPSETTING(   0x08, DEF_STR( Hard ) )
352   PORT_DIPSETTING(   0x00, DEF_STR( Hardest ) )
322   PORT_MODIFY("DSW")
353323   PORT_DIPNAME( 0x20, 0x20, DEF_STR ( Demo_Sounds ) )
354324   PORT_DIPSETTING(   0x00, DEF_STR ( Off ) )
355325   PORT_DIPSETTING(   0x20, DEF_STR ( On ) )
356   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Bonus_Life ) )
357   PORT_DIPSETTING(   0x40, "30000" )
358   PORT_DIPSETTING(   0x00, "40000" )
359   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
360   PORT_DIPSETTING(   0x80, DEF_STR( Upright ) )
361   PORT_DIPSETTING(   0x00, DEF_STR( Cocktail ) )
362326INPUT_PORTS_END
363327
364
365/* EXACTLY the same as bagman, the only difference is that the START1 button */
366/* also acts as the shoot button. */
367328static INPUT_PORTS_START( sbagman )
368   PORT_START   /* IN0 */
369   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
370   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
329   PORT_INCLUDE( bagman )
330
331   PORT_MODIFY("IN0")
371332   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
372   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 )   /* double-function button, start and shoot */
373   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
374   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
375   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
376   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
377   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
333   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) /* double-function button, start and shoot */
378334
379   PORT_START   /* IN1 */
380   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
381   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN4 )
335   PORT_MODIFY("IN1")
382336   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
383337   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL /* double-function button, start and shoot */
384   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
385   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
386   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
387   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
388   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
389
390   PORT_START   /* DSW */
391   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
392   PORT_DIPSETTING(   0x03, "2" )
393   PORT_DIPSETTING(   0x02, "3" )
394   PORT_DIPSETTING(   0x01, "4" )
395   PORT_DIPSETTING(   0x00, "5" )
396   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coinage ) )
397   PORT_DIPSETTING(   0x00, "2C/1C 1C/1C 1C/3C 1C/7C" )
398   PORT_DIPSETTING(   0x04, "1C/1C 1C/2C 1C/6C 1C/14C" )
399   PORT_DIPNAME( 0x18, 0x18, DEF_STR( Difficulty ) )
400   PORT_DIPSETTING(   0x18, DEF_STR( Easy ) )
401   PORT_DIPSETTING(   0x10, DEF_STR( Medium ) )
402   PORT_DIPSETTING(   0x08, DEF_STR( Hard ) )
403   PORT_DIPSETTING(   0x00, DEF_STR( Hardest ) )
404   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Language ) )
405   PORT_DIPSETTING(   0x20, DEF_STR( English ) )
406   PORT_DIPSETTING(   0x00, DEF_STR( French ) )
407   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Bonus_Life ) )
408   PORT_DIPSETTING(   0x40, "30000" )
409   PORT_DIPSETTING(   0x00, "40000" )
410   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
411   PORT_DIPSETTING(   0x80, DEF_STR( Upright ) )
412   PORT_DIPSETTING(   0x00, DEF_STR( Cocktail ) )
413338INPUT_PORTS_END
414339
415340static INPUT_PORTS_START( pickin )
416   PORT_START   /* IN0 */
417   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
418   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
419   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
420   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
421   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
422   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
423   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
424   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
341   PORT_INCLUDE( bagman )
425342
426   PORT_START   /* IN1 */
427   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
428   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN4 )
429   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
430   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
431   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
432   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
433   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
434   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
435
436   PORT_START   /* DSW */
437   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Coinage ) )
343   PORT_MODIFY("DSW")
344   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Coinage ) )         PORT_DIPLOCATION("SW1:1")
438345   PORT_DIPSETTING(   0x00, "2C/1C 1C/1C 1C/3C 1C/7C" )
439346   PORT_DIPSETTING(   0x01, "1C/1C 1C/2C 1C/6C 1C/14C" )
440   PORT_DIPNAME( 0x06, 0x04, DEF_STR( Lives ) )
347   PORT_DIPNAME( 0x06, 0x04, DEF_STR( Lives ) )         PORT_DIPLOCATION("SW1:2,3")
441348   PORT_DIPSETTING(   0x06, "2" )
442349   PORT_DIPSETTING(   0x04, "3" )
443350   PORT_DIPSETTING(   0x02, "4" )
444351   PORT_DIPSETTING(   0x00, "5" )
445   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Free_Play ) )
352   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Free_Play ) )      PORT_DIPLOCATION("SW1:4")
446353   PORT_DIPSETTING(   0x08, DEF_STR( Off ) )
447354   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
448   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
449   PORT_DIPSETTING(   0x10, DEF_STR( Off ) )
450   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
451   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
452   PORT_DIPSETTING(   0x20, DEF_STR( Off ) )
453   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
454   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Language ) )
355   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW1:5" )
356   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW1:6" )
357   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Language ) )         PORT_DIPLOCATION("SW1:7")
455358   PORT_DIPSETTING(   0x40, DEF_STR( English ) )
456359   PORT_DIPSETTING(   0x00, DEF_STR( French ) )
457   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
458   PORT_DIPSETTING(   0x80, DEF_STR( Upright ) )
459   PORT_DIPSETTING(   0x00, DEF_STR( Cocktail ) )
460360INPUT_PORTS_END
461361
462362static INPUT_PORTS_START( botanic )
463   PORT_START   /* IN0 */
464   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
465   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
466   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
467   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
468   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
469   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
470   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
471   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
363   PORT_INCLUDE( bagman )
472364
473   PORT_START   /* IN1 */
474   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
475   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN4 )
476   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
477   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
478   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
479   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
480   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
481   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
482
483   PORT_START   /* DSW */
484   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
485   PORT_DIPSETTING(   0x00, "2" )
486   PORT_DIPSETTING(   0x03, "3" )
487   PORT_DIPSETTING(   0x02, "4" )
488   PORT_DIPSETTING(   0x01, "5" )
489   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Coinage ) )
490   PORT_DIPSETTING(   0x04, "2C/1C 1C/1C 1C/3C 1C/7C" )
491   PORT_DIPSETTING(   0x00, "1C/1C 1C/2C 1C/6C 1C/14C" )
492   PORT_DIPNAME( 0x08, 0x08, "Invulnerability Fruits" )
365   PORT_MODIFY("DSW")
366   PORT_DIPNAME( 0x08, 0x08, "Invulnerability Fruits" )   PORT_DIPLOCATION("SW1:4")
493367   PORT_DIPSETTING(   0x08, "3" )
494368   PORT_DIPSETTING(   0x00, DEF_STR( None ) )
495   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
496   PORT_DIPSETTING(   0x10, DEF_STR( Off ) )
497   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
498   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
499   PORT_DIPSETTING(   0x20, DEF_STR( Off ) )
500   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
501   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
502   PORT_DIPSETTING(   0x40, DEF_STR( Off ) )
503   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
504   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
505   PORT_DIPSETTING(   0x80, DEF_STR( Upright ) )
506   PORT_DIPSETTING(   0x00, DEF_STR( Cocktail ) )
369   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW1:5" )
370   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW1:6" )
371   PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x40, "SW1:7" )
507372INPUT_PORTS_END
508373
509374
r1877r1878
565430   MDRV_CPU_ADD(Z80, 3072000)   /* 3.072 MHz (?) */
566431   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
567432   MDRV_CPU_IO_MAP(readport,writeport)
568   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
433   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
569434
570435   MDRV_MACHINE_RESET(bagman)
571436
r1877r1878
601466   MDRV_CPU_ADD(Z80, 3072000)   /* 3.072 MHz (?) */
602467   MDRV_CPU_PROGRAM_MAP(pickin_readmem,pickin_writemem)
603468   MDRV_CPU_IO_MAP(readport,writeport)
604   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
469   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
605470
606471   MDRV_MACHINE_RESET(bagman)
607472
r1877r1878
651516   MDRV_CPU_ADD(Z80, 3072000)   /* 3.072 MHz (?) */
652517   MDRV_CPU_PROGRAM_MAP(pickin_readmem,pickin_writemem)
653518   MDRV_CPU_IO_MAP(readport,writeport)
654   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
519   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
655520
656521   MDRV_MACHINE_RESET(bagman)
657522
r1877r1878
942807   *bagman_video_enable = 1;
943808}
944809
945GAME( 1982, bagman,    0,      bagman,  bagman,  0,        ROT270, "Valadon Automation", "Bagman", 0 )
810GAME( 1982, bagman,    0,      bagman,  bagman,  0,        ROT270, "Valadon Automation", "Bagman", 0 )
946811GAME( 1982, bagnard,  bagman,  bagman,  bagman,  0,        ROT270, "Valadon Automation", "Le Bagnard (set 1)", 0 )
947812GAME( 1982, bagnarda, bagman,  bagman,  bagman,  bagnarda, ROT270, "Valadon Automation", "Le Bagnard (set 2)", 0 )
948813GAME( 1982, bagmans,  bagman,  bagman,  bagmans, 0,        ROT270, "Valadon Automation (Stern license)", "Bagman (Stern set 1)", 0 )
949814GAME( 1982, bagmans2, bagman,  bagman,  bagman,  0,        ROT270, "Valadon Automation (Stern license)", "Bagman (Stern set 2)", 0 )
950GAME( 1984, sbagman,  0,      bagman,  sbagman, 0,        ROT270, "Valadon Automation", "Super Bagman", 0 )
815GAME( 1984, sbagman,  0,      bagman,  sbagman, 0,        ROT270, "Valadon Automation", "Super Bagman", 0 )
951816GAME( 1984, sbagmans, sbagman, bagman,  sbagman, 0,        ROT270, "Valadon Automation (Stern license)", "Super Bagman (Stern)", 0 )
952GAME( 1983, pickin,    0,      pickin,  pickin,  0,        ROT270, "Valadon Automation", "Pickin'", 0 )
817GAME( 1983, pickin,    0,      pickin,  pickin,  0,        ROT270, "Valadon Automation", "Pickin'", 0 )
953818GAME( 1984, botanic,  0,       botanic, botanic, 0,        ROT270, "Valadon Automation (Itisa license)", "Botanic", 0 )
954819
src/mame/drivers/namcos23.c
r1877r1878
387387}
388388
389389static void
390DrawLine( mame_bitmap *bitmap, int x0, int y0, int x1, int y1 )
390DrawLine( bitmap_t *bitmap, int x0, int y0, int x1, int y1 )
391391{
392392   if( x0>=0 && x0<bitmap->width &&
393393      x1>=0 && x1<bitmap->width &&
r1877r1878
421421} /* DrawLine */
422422
423423static void
424DrawPoly( mame_bitmap *bitmap, const UINT32 *pSource, int n, int bNew )
424DrawPoly( bitmap_t *bitmap, const UINT32 *pSource, int n, int bNew )
425425{
426426   UINT32 flags = *pSource++;
427427   UINT32 unk = *pSource++;
r1877r1878
861861   MDRV_CPU_ADD(H83002, 14745600 )
862862   MDRV_CPU_PROGRAM_MAP( s23h8rwmap, 0 )
863863   MDRV_CPU_IO_MAP( s23h8iomap, 0 )
864   MDRV_CPU_VBLANK_INT( irq1_line_pulse, 1 )
864   MDRV_CPU_VBLANK_INT("main", irq1_line_pulse)
865865
866866
867867   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
895895   MDRV_CPU_ADD(R4650BE, 166000000)
896896   MDRV_CPU_CONFIG(config)
897897   MDRV_CPU_PROGRAM_MAP(ss23_map, 0)
898   MDRV_CPU_VBLANK_INT(namcos23_interrupt, 1)
898   MDRV_CPU_VBLANK_INT("main", namcos23_interrupt)
899899
900900   MDRV_CPU_ADD(H83002, 14745600 )
901901   MDRV_CPU_PROGRAM_MAP( s23h8rwmap, 0 )
902902   MDRV_CPU_IO_MAP( s23h8iomap, 0 )
903   MDRV_CPU_VBLANK_INT( irq1_line_pulse, 1 )
903   MDRV_CPU_VBLANK_INT("main", irq1_line_pulse)
904904
905905
906906   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/inufuku.c
r1877r1878
109109      if (data == 0x08) return;
110110
111111      pending_command = 1;
112      soundlatch_w(0, data & 0xff);
113      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
112      soundlatch_w(machine, 0, data & 0xff);
113      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
114114   }
115115}
116116
r1877r1878
141141static DRIVER_INIT( inufuku )
142142{
143143   pending_command = 1;
144   inufuku_soundrombank_w(0, 0);
144   inufuku_soundrombank_w(machine, 0, 0);
145145}
146146
147147
r1877r1878
401401   /* basic machine hardware */
402402   MDRV_CPU_ADD(M68000, 32000000/2)   /* 16.00 MHz */
403403   MDRV_CPU_PROGRAM_MAP(inufuku_readmem, inufuku_writemem)
404   MDRV_CPU_VBLANK_INT(irq1_line_hold, 1)
404   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
405405
406406   MDRV_CPU_ADD(Z80, 32000000/4)      /* 8.00 MHz */
407407   /* audio CPU */
src/mame/drivers/tattack.c
r1877r1878
186186   /* basic machine hardware */
187187   MDRV_CPU_ADD(Z80, 8000000 / 2)   /* 4 MHz ? */
188188   MDRV_CPU_PROGRAM_MAP(mem, 0)
189   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
189   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
190190
191191   /* video hardware */
192192   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/commando.c
r1877r1878
4343***************************************************************************/
4444
4545#include "driver.h"
46#include "deprecat.h"
4647#include "sound/2203intf.h"
4748
4849extern UINT8 *commando_videoram2, *commando_colorram2;
r1877r1878
240241   // basic machine hardware
241242   MDRV_CPU_ADD(Z80, PHI_MAIN)   // ???
242243   MDRV_CPU_PROGRAM_MAP(commando_map, 0)
243   MDRV_CPU_VBLANK_INT(commando_interrupt, 1)
244   MDRV_CPU_VBLANK_INT("main", commando_interrupt)
244245
245246   MDRV_CPU_ADD(Z80, PHI_B)   // 3 MHz
246247   /* audio CPU */
247248   MDRV_CPU_PROGRAM_MAP(sound_map, 0)
248   MDRV_CPU_VBLANK_INT(irq0_line_hold, 4)
249   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold, 4)
249250
250251   // video hardware
251252   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
src/mame/drivers/atarisy2.c
r1877r1878
361361
362362static void bankselect_postload(void)
363363{
364   bankselect_w(0, bankselect[0], 0);
365   bankselect_w(1, bankselect[1], 0);
364   bankselect_w(Machine, 0, bankselect[0], 0);
365   bankselect_w(Machine, 1, bankselect[1], 0);
366366}
367367
368368
r1877r1878
375375
376376static READ16_HANDLER( switch_r )
377377{
378   int result = input_port_1_r(offset) | (input_port_2_r(offset) << 8);
378   int result = input_port_1_r(machine, offset) | (input_port_2_r(machine, offset) << 8);
379379
380380   if (atarigen_cpu_to_sound_ready) result ^= 0x20;
381381   if (atarigen_sound_to_cpu_ready) result ^= 0x10;
r1877r1878
386386
387387static READ8_HANDLER( switch_6502_r )
388388{
389   int result = input_port_0_r(offset);
389   int result = input_port_0_r(machine, offset);
390390
391391   if (atarigen_cpu_to_sound_ready) result ^= 0x01;
392392   if (atarigen_sound_to_cpu_ready) result ^= 0x02;
393393   if (!has_tms5220 || tms5220_ready_r()) result ^= 0x04;
394   if (!(input_port_2_r(offset) & 0x80)) result ^= 0x10;
394   if (!(input_port_2_r(machine, offset) & 0x80)) result ^= 0x10;
395395
396396   return result;
397397}
r1877r1878
626626   /* a large number of signals are reset when this happens */
627627   atarigen_sound_io_reset(1);
628628   sndti_reset(SOUND_YM2151, 0);
629   mixer_w(0, 0);
629   mixer_w(machine, 0, 0);
630630   tms5220_data = 0;
631631   tms5220_data_strobe = 0;
632632}
r1877r1878
639639   atarigen_update_interrupts();
640640
641641   /* handle it normally otherwise */
642   return atarigen_sound_r(offset,0);
642   return atarigen_sound_r(machine,offset,0);
643643}
644644
645645
r1877r1878
650650   atarigen_update_interrupts();
651651
652652   /* handle it normally otherwise */
653   atarigen_6502_sound_w(offset, data);
653   atarigen_6502_sound_w(machine, offset, data);
654654}
655655
656656
r1877r1878
661661   atarigen_update_interrupts();
662662
663663   /* handle it normally otherwise */
664   return atarigen_6502_sound_r(offset);
664   return atarigen_6502_sound_r(machine, offset);
665665}
666666
667667
r1877r1878
681681static WRITE8_HANDLER( tms5220_strobe_w )
682682{
683683   if (!(offset & 1) && tms5220_data_strobe && has_tms5220)
684      tms5220_data_w(0, tms5220_data);
684      tms5220_data_w(machine, 0, tms5220_data);
685685   tms5220_data_strobe = offset & 1;
686686}
687687
r1877r1878
774774   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL )
775775   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL )
776776   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
777   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SPECIAL )
777   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE )
778778   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3 )
779779   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
780780   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
r1877r1878
820820   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
821821
822822   PORT_START_TAG("DSW0")
823   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )
823   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )      PORT_DIPLOCATION("6/7A:!8,!7")
824824   PORT_DIPSETTING(    0x03, DEF_STR( 4C_1C ) )
825825   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
826826   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
827827   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
828   PORT_DIPNAME( 0x0c, 0x00, "Right Coin" )
828   PORT_DIPNAME( 0x0c, 0x00, "Right Coin" )         PORT_DIPLOCATION("6/7A:!6,!5")
829829   PORT_DIPSETTING(    0x00, "*1" )
830830   PORT_DIPSETTING(    0x04, "*4" )
831831   PORT_DIPSETTING(    0x08, "*5" )
832832   PORT_DIPSETTING(    0x0c, "*6" )
833   PORT_DIPNAME( 0x10, 0x00, "Left Coin" )
833   PORT_DIPNAME( 0x10, 0x00, "Left Coin" )            PORT_DIPLOCATION("6/7A:!4")
834834   PORT_DIPSETTING(    0x00, "*1" )
835835   PORT_DIPSETTING(    0x10, "*2" )
836   PORT_DIPNAME( 0xe0, 0x00, "Bonus Coins" )
836   PORT_DIPNAME( 0xe0, 0x00, "Bonus Coins" )         PORT_DIPLOCATION("6/7A:!3,!2,!1")
837837   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
838   PORT_DIPSETTING(    0x80, "1 each 5" )
839   PORT_DIPSETTING(    0x40, "1 each 4" )
840   PORT_DIPSETTING(    0xa0, "1 each 3" )
841   PORT_DIPSETTING(    0x60, "2 each 4" )
842   PORT_DIPSETTING(    0x20, "1 each 2" )
843   PORT_DIPSETTING(    0xc0, "1 each ?" )
838   PORT_DIPSETTING(    0x80, "1 Each 5" )
839   PORT_DIPSETTING(    0x40, "1 Each 4" )
840   PORT_DIPSETTING(    0xa0, "1 Each 3" )
841   PORT_DIPSETTING(    0x60, "2 Each 4" )
842   PORT_DIPSETTING(    0x20, "1 Each 2" )
843   PORT_DIPSETTING(    0xc0, "1 Each ?" )            /* Not Documented */
844844   PORT_DIPSETTING(    0xe0, DEF_STR( Free_Play ) )
845845
846846   PORT_START_TAG("DSW1")
847   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Difficulty ) )
847   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("5/6A:!8,!7")
848848   PORT_DIPSETTING(    0x01, DEF_STR( Easy ) )
849849   PORT_DIPSETTING(    0x02, DEF_STR( Medium ) )
850850   PORT_DIPSETTING(    0x00, "Med. Hard" )
851851   PORT_DIPSETTING(    0x03, DEF_STR( Hard ) )
852   PORT_DIPNAME( 0x0c, 0x08, DEF_STR( Bonus_Life ) )
852   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) )   PORT_DIPLOCATION("5/6A:!6,!5")
853853   PORT_DIPSETTING(    0x08, "10000" )
854854   PORT_DIPSETTING(    0x00, "15000" )
855855   PORT_DIPSETTING(    0x0c, "20000" )
856856   PORT_DIPSETTING(    0x04, DEF_STR( None ) )
857   PORT_DIPNAME( 0x30, 0x20, DEF_STR( Lives ) )
857   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Lives ) )      PORT_DIPLOCATION("5/6A:!4,!3")
858858   PORT_DIPSETTING(    0x20, "3" )
859859   PORT_DIPSETTING(    0x00, "4" )
860860   PORT_DIPSETTING(    0x30, "5" )
861861   PORT_DIPSETTING(    0x10, "Infinite (Cheat)")
862   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
863   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
864   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
865   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
866   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
867   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
862   PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "5/6A:!2" )      /* Listed as "Unused" */
863   PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "5/6A:!1" )      /* Listed as "Unused" */
868864INPUT_PORTS_END
869865
870866
871867static INPUT_PORTS_START( 720 )
872   PORT_START_TAG("1840")   /* (sound) */
873   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )
874   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL )
875   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL )
876   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
877   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SPECIAL )
878   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3 )
879   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
880   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
868   PORT_INCLUDE( paperboy )
881869
882   PORT_START_TAG("1800")
883   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
884   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
885   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
886   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
887   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL )
888   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL )
889   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
890   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
891   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
892   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
893
894   PORT_START_TAG("1801")
895   PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED )
896   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
897
898   PORT_START_TAG("ADC0")
870   PORT_MODIFY("ADC0")
899871   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
900872
901   PORT_START_TAG("ADC1")
873   PORT_MODIFY("ADC1")
902874   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
903875
904   PORT_START_TAG("ADC2")
905   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
906
907   PORT_START_TAG("ADC3")
908   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
909
910   PORT_START_TAG("LETA0")   /* not direct mapped */
876   PORT_MODIFY("LETA0")   /* not direct mapped */
911877   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10)
912878
913   PORT_START_TAG("LETA1")   /* not direct mapped */
879   PORT_MODIFY("LETA1")   /* not direct mapped */
914880   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE
915881
916   PORT_START_TAG("LETA2")
917   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
918
919   PORT_START_TAG("LETA3")
920   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
921
922   PORT_START_TAG("DSW0")
923   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )
924   PORT_DIPSETTING(    0x03, DEF_STR( 4C_1C ) )
925   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
926   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
927   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
928   PORT_DIPNAME( 0x0c, 0x00, "Right Coin" )
929   PORT_DIPSETTING(    0x00, "*1" )
930   PORT_DIPSETTING(    0x04, "*4" )
931   PORT_DIPSETTING(    0x08, "*5" )
932   PORT_DIPSETTING(    0x0c, "*6" )
933   PORT_DIPNAME( 0x10, 0x00, "Left Coin" )
934   PORT_DIPSETTING(    0x00, "*1" )
935   PORT_DIPSETTING(    0x10, "*2" )
936   PORT_DIPNAME( 0xe0, 0x00, "Bonus Coins" )
937   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
938/*  PORT_DIPSETTING(    0xc0, DEF_STR( None ) )*/
939   PORT_DIPSETTING(    0x80, "1 each 5" )
940   PORT_DIPSETTING(    0x40, "1 each 4" )
941   PORT_DIPSETTING(    0xa0, "1 each 3" )
942   PORT_DIPSETTING(    0x60, "2 each 4" )
943   PORT_DIPSETTING(    0x20, "1 each 2" )
944   PORT_DIPSETTING(    0xe0, DEF_STR( Free_Play ) )
945
946   PORT_START_TAG("DSW1")
947   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Bonus_Life ) )
882   PORT_MODIFY("DSW1")
883   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Bonus_Life ) )      PORT_DIPLOCATION("5/6A:!8,!7")
948884   PORT_DIPSETTING(    0x01, "3000" )
949885   PORT_DIPSETTING(    0x00, "5000" )
950886   PORT_DIPSETTING(    0x02, "8000" )
951887   PORT_DIPSETTING(    0x03, "12000" )
952   PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Difficulty ) )
888   PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Difficulty ) )      PORT_DIPLOCATION("5/6A:!6,!5")
953889   PORT_DIPSETTING(    0x04, DEF_STR( Easy ) )
954890   PORT_DIPSETTING(    0x00, DEF_STR( Medium ) )
955891   PORT_DIPSETTING(    0x08, DEF_STR( Hard ) )
956892   PORT_DIPSETTING(    0x0c, DEF_STR( Hardest ) )
957   PORT_DIPNAME( 0x30, 0x10, "Maximum Add. A. Coins" )
893   PORT_DIPNAME( 0x30, 0x10, "Maximum Add. A. Coins" )      PORT_DIPLOCATION("5/6A:!4,!3")
958894   PORT_DIPSETTING(    0x10, "0" )
959895   PORT_DIPSETTING(    0x20, "1" )
960896   PORT_DIPSETTING(    0x00, "2" )
961897   PORT_DIPSETTING(    0x30, "3" )
962   PORT_DIPNAME( 0xc0, 0x40, "Coins Required" )
963   PORT_DIPSETTING(    0x80, "3 to Start, 2 to Continue" )
964   PORT_DIPSETTING(    0xc0, "3 to Start, 1 to Continue" )
965   PORT_DIPSETTING(    0x00, "2 to Start, 1 to Continue" )
966   PORT_DIPSETTING(    0x40, "1 to Start, 1 to Continue" )
898   PORT_DIPNAME( 0xc0, 0x40, "Coins Required" )         PORT_DIPLOCATION("5/6A:!2,!1")
899   PORT_DIPSETTING(    0x80, "3 To Start, 2 To Continue" )
900   PORT_DIPSETTING(    0xc0, "3 To Start, 1 To Continue" )
901   PORT_DIPSETTING(    0x00, "2 To Start, 1 To Continue" )
902   PORT_DIPSETTING(    0x40, "1 To Start, 1 To Continue" )
967903INPUT_PORTS_END
968904
969905
970906static INPUT_PORTS_START( ssprint )
971   PORT_START_TAG("1840")
972   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )
973   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL )
974   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL )
975   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
976   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SPECIAL )
977   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
978   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
979   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 )
907   PORT_INCLUDE( paperboy )
980908
981   PORT_START_TAG("1800")
982   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
983   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
909   PORT_MODIFY("1800")
984910   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
985911   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START3 )
986   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL )
987   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL )
988912   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
989913   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
990914
991   PORT_START_TAG("1801")
992   PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED )
993   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
994
995   PORT_START_TAG("ADC0")
915   PORT_MODIFY("ADC0")
996916   PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0x3f) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_PLAYER(1)
997917
998   PORT_START_TAG("ADC1")
918   PORT_MODIFY("ADC1")
999919   PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0x3f) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_PLAYER(2)
1000920
1001   PORT_START_TAG("ADC2")
921   PORT_MODIFY("ADC2")
1002922   PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0x3f) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_PLAYER(3)
1003923
1004   PORT_START_TAG("ADC3")
1005   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
1006
1007   PORT_START_TAG("LETA0")
924   PORT_MODIFY("LETA0")
1008925   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(1)
1009926
1010   PORT_START_TAG("LETA1")
927   PORT_MODIFY("LETA1")
1011928   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(2)
1012929
1013   PORT_START_TAG("LETA2")
930   PORT_MODIFY("LETA2")
1014931   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(3)
1015932
1016   PORT_START_TAG("LETA3")
1017   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
1018
1019   PORT_START_TAG("DSW0")
1020   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )
1021   PORT_DIPSETTING(    0x03, DEF_STR( 4C_1C ) )
1022   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
1023   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
1024   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
1025   PORT_DIPNAME( 0x1c, 0x00, "Coin Multiplier" )
933   PORT_MODIFY("DSW0")
934   PORT_DIPNAME( 0x1c, 0x00, "Coin Multiplier" )      PORT_DIPLOCATION("6/7A:!6,!5,!4")
1026935   PORT_DIPSETTING(    0x00, "*1" )
1027936   PORT_DIPSETTING(    0x04, "*2" )
1028937   PORT_DIPSETTING(    0x08, "*3" )
r1877r1878
1031940   PORT_DIPSETTING(    0x14, "*6" )
1032941   PORT_DIPSETTING(    0x18, "*7" )
1033942   PORT_DIPSETTING(    0x1c, "*8" )
1034   PORT_DIPNAME( 0xe0, 0x00, "Bonus Coins" )
1035   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
1036   PORT_DIPSETTING(    0x80, "1 each 5" )
1037   PORT_DIPSETTING(    0x40, "1 each 4" )
1038   PORT_DIPSETTING(    0xa0, "1 each 3" )
1039   PORT_DIPSETTING(    0x60, "2 each 4" )
1040   PORT_DIPSETTING(    0x20, "1 each 2" )
1041   PORT_DIPSETTING(    0xc0, "1 each ?" )
1042   PORT_DIPSETTING(    0xe0, DEF_STR( Free_Play ) )
1043943
1044   PORT_START_TAG("DSW1")
1045   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Difficulty ) )
944   PORT_MODIFY("DSW1")
945   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("5/6A:!8,!7")
1046946   PORT_DIPSETTING(    0x01, DEF_STR( Easy ) )
1047947   PORT_DIPSETTING(    0x00, DEF_STR( Medium ) )
1048948   PORT_DIPSETTING(    0x02, "Med. Hard" )
1049949   PORT_DIPSETTING(    0x03, DEF_STR( Hard ) )
1050   PORT_DIPNAME( 0x0c, 0x04, "Obstacles" )
950   PORT_DIPNAME( 0x0c, 0x00, "Obstacles" )            PORT_DIPLOCATION("5/6A:!6,!5")
1051951   PORT_DIPSETTING(    0x04, DEF_STR( Easy ) )
1052952   PORT_DIPSETTING(    0x00, DEF_STR( Medium ) )
1053953   PORT_DIPSETTING(    0x08, "Med. Hard" )
1054954   PORT_DIPSETTING(    0x0c, DEF_STR( Hard ) )
1055   PORT_DIPNAME( 0x30, 0x00, "Wrenches" )
955   PORT_DIPNAME( 0x30, 0x00, "Wrenches" )            PORT_DIPLOCATION("5/6A:!4,!3")
1056956   PORT_DIPSETTING(    0x10, "2" )
1057957   PORT_DIPSETTING(    0x00, "3" )
1058958   PORT_DIPSETTING(    0x20, "4" )
1059959   PORT_DIPSETTING(    0x30, "5" )
1060   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
1061   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1062   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
1063   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
1064   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1065   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
1066960INPUT_PORTS_END
1067961
1068962
1069963static INPUT_PORTS_START( csprint )
1070   PORT_START_TAG("1840")
1071   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )
1072   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL )
1073   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL )
1074   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
1075   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SPECIAL )
964   PORT_INCLUDE( ssprint )
965
966   PORT_MODIFY("1840")
1076967   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
1077   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
1078   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
1079968
1080   PORT_START_TAG("1800")
969   PORT_MODIFY("1800")
1081970   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
1082971   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
1083972   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
1084973   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
1085   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL )
1086   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL )
1087   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
1088   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
1089974
1090   PORT_START_TAG("1801")
1091   PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED )
1092   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
1093
1094   PORT_START_TAG("ADC0")
1095   PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0x3f) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_PLAYER(1)
1096
1097   PORT_START_TAG("ADC1")
1098   PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0x3f) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_PLAYER(2)
1099
1100   PORT_START_TAG("ADC2")
975   PORT_MODIFY("ADC2")
1101976   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
1102977
1103   PORT_START_TAG("ADC3")
978   PORT_MODIFY("LETA2")
1104979   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
1105980
1106   PORT_START_TAG("LETA0")
1107   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(1)
1108
1109   PORT_START_TAG("LETA1")
1110   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(2)
1111
1112   PORT_START_TAG("LETA2")
1113   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
1114
1115   PORT_START_TAG("LETA3")
1116   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
1117
1118   PORT_START_TAG("DSW0")
1119   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )
1120   PORT_DIPSETTING(    0x03, DEF_STR( 4C_1C ) )
1121   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
1122   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
1123   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
1124   PORT_DIPNAME( 0x1c, 0x00, "Coin Multiplier" )
1125   PORT_DIPSETTING(    0x00, "*1" )
1126   PORT_DIPSETTING(    0x04, "*2" )
1127   PORT_DIPSETTING(    0x08, "*3" )
1128   PORT_DIPSETTING(    0x0c, "*4" )
1129   PORT_DIPSETTING(    0x10, "*5" )
1130   PORT_DIPSETTING(    0x14, "*6" )
1131   PORT_DIPSETTING(    0x18, "*7" )
1132   PORT_DIPSETTING(    0x1c, "*8" )
1133   PORT_DIPNAME( 0xe0, 0x00, "Bonus Coins" )
1134   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
1135   PORT_DIPSETTING(    0x80, "1 each 5" )
1136   PORT_DIPSETTING(    0x40, "1 each 4" )
1137   PORT_DIPSETTING(    0xa0, "1 each 3" )
1138   PORT_DIPSETTING(    0x60, "2 each 4" )
1139   PORT_DIPSETTING(    0x20, "1 each 2" )
1140   PORT_DIPSETTING(    0xc0, "1 each ?" )
1141   PORT_DIPSETTING(    0xe0, DEF_STR( Free_Play ) )
1142
1143   PORT_START_TAG("DSW1")
1144   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Difficulty ) )
1145   PORT_DIPSETTING(    0x01, DEF_STR( Easy ) )
1146   PORT_DIPSETTING(    0x00, DEF_STR( Medium ) )
1147   PORT_DIPSETTING(    0x02, "Med. Hard" )
1148   PORT_DIPSETTING(    0x03, DEF_STR( Hard ) )
1149   PORT_DIPNAME( 0x0c, 0x04, "Obstacles" )
1150   PORT_DIPSETTING(    0x04, DEF_STR( Easy ) )
1151   PORT_DIPSETTING(    0x00, DEF_STR( Medium ) )
1152   PORT_DIPSETTING(    0x08, "Med. Hard" )
1153   PORT_DIPSETTING(    0x0c, DEF_STR( Hard ) )
1154   PORT_DIPNAME( 0x30, 0x00, "Wrenches" )
1155   PORT_DIPSETTING(    0x10, "2" )
1156   PORT_DIPSETTING(    0x00, "3" )
1157   PORT_DIPSETTING(    0x20, "4" )
1158   PORT_DIPSETTING(    0x30, "5" )
1159   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
1160   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1161   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
1162   PORT_DIPNAME( 0x80, 0x80, "Auto High Score Reset" )
981   PORT_MODIFY("DSW1")
982   PORT_DIPNAME( 0x80, 0x00, "Auto High Score Reset" )      PORT_DIPLOCATION("5/6A:!1") /* "After 2000 Plays." */
1163983   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1164984   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1165985INPUT_PORTS_END
1166986
1167987
1168988static INPUT_PORTS_START( apb )
1169   PORT_START_TAG("1840")
1170   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )
1171   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL )
1172   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_SPECIAL )
1173   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
1174   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_SPECIAL )
1175   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_COIN3  )
1176   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_COIN2  )
1177   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_COIN1  )
989   PORT_INCLUDE( paperboy )
1178990
1179   PORT_START_TAG("1800")
1180   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_UNUSED )
991   PORT_MODIFY("1800")
1181992   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(1)
1182993   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_UNUSED )
1183994   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON3 ) PORT_PLAYER(1)
1184   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL )
1185   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL )
1186995   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
1187996   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
1188997
1189   PORT_START_TAG("1801")
1190   PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED )
1191   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
1192
1193   PORT_START_TAG("ADC0")
998   PORT_MODIFY("ADC0")
1194999   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
11951000
1196   PORT_START_TAG("ADC1")
1001   PORT_MODIFY("ADC1")
11971002   PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0x3f) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_PLAYER(1)
11981003
1199   PORT_START_TAG("ADC2")
1200   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
1201
1202   PORT_START_TAG("ADC3")
1203   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
1204
1205   PORT_START_TAG("LETA0")
1004   PORT_MODIFY("LETA0")
12061005   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(1)
12071006
1208   PORT_START_TAG("LETA1")
1209   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
1210
1211   PORT_START_TAG("LETA2")
1212   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
1213
1214   PORT_START_TAG("LETA3")
1215   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
1216
1217   PORT_START_TAG("DSW0")
1218   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )
1219   PORT_DIPSETTING(    0x03, DEF_STR( 4C_1C ) )
1220   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
1221   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
1222   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
1223   PORT_DIPNAME( 0x0c, 0x00, "Right Coin" )
1224   PORT_DIPSETTING(    0x00, "*1" )
1225   PORT_DIPSETTING(    0x04, "*4" )
1226   PORT_DIPSETTING(    0x08, "*5" )
1227   PORT_DIPSETTING(    0x0c, "*6" )
1228   PORT_DIPNAME( 0x10, 0x00, "Left Coin" )
1229   PORT_DIPSETTING(    0x00, "*1" )
1230   PORT_DIPSETTING(    0x10, "*2" )
1231   PORT_DIPNAME( 0xe0, 0x00, "Bonus Coins" )
1007   PORT_MODIFY("DSW0")
1008   PORT_DIPNAME( 0xe0, 0x00, "Bonus Coins" )         PORT_DIPLOCATION("6/7A:!3,!2,!1")
12321009   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
1233   PORT_DIPSETTING(    0xc0, "1 each 6" )
1234   PORT_DIPSETTING(    0xa0, "1 each 5" )
1235   PORT_DIPSETTING(    0x80, "1 each 4" )
1236   PORT_DIPSETTING(    0x60, "1 each 3" )
1237   PORT_DIPSETTING(    0x40, "1 each 2" )
1238   PORT_DIPSETTING(    0x20, "1 each 1" )
1010   PORT_DIPSETTING(    0xc0, "1 Each 6" )            /* Not documented */
1011   PORT_DIPSETTING(    0xa0, "1 Each 5" )
1012   PORT_DIPSETTING(    0x80, "1 Each 4" )
1013   PORT_DIPSETTING(    0x60, "1 Each 3" )
1014   PORT_DIPSETTING(    0x40, "1 Each 2" )
1015   PORT_DIPSETTING(    0x20, "1 Each 1" )
12391016   PORT_DIPSETTING(    0xe0, DEF_STR( Free_Play ) )
12401017
1241   PORT_START_TAG("DSW1")
1242   PORT_DIPNAME( 0x01, 0x01, "Attract Lights" )
1018   PORT_MODIFY("DSW1")
1019   PORT_DIPNAME( 0x01, 0x00, "Attract Lights" )      PORT_DIPLOCATION("5/6A:!8") /* Listed As Unused. */
12431020   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
12441021   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1245   PORT_DIPNAME( 0x06, 0x06, "Max Continues" )
1022   PORT_DIPNAME( 0x06, 0x00, "Max Continues" )         PORT_DIPLOCATION("5/6A:!7,!6")
12461023   PORT_DIPSETTING(    0x02, "3" )
12471024   PORT_DIPSETTING(    0x04, "10" )
12481025   PORT_DIPSETTING(    0x00, "25" )
12491026   PORT_DIPSETTING(    0x06, "199" )
1250   PORT_DIPNAME( 0x38, 0x38, DEF_STR( Difficulty ) )
1251   PORT_DIPSETTING(    0x38, "1 (Easy)" )
1252   PORT_DIPSETTING(    0x30, "2" )
1253   PORT_DIPSETTING(    0x28, "3" )
1254   PORT_DIPSETTING(    0x00, "4" )
1255   PORT_DIPSETTING(    0x20, "5" )
1256   PORT_DIPSETTING(    0x10, "6" )
1257   PORT_DIPSETTING(    0x08, "7" )
1258   PORT_DIPSETTING(    0x18, "8 (Hard)" )
1259   PORT_DIPNAME( 0xc0, 0x40, "Coins Required" )
1260   PORT_DIPSETTING(    0x80, "3 to Start, 2 to Continue" )
1261   PORT_DIPSETTING(    0xc0, "3 to Start, 1 to Continue" )
1262   PORT_DIPSETTING(    0x00, "2 to Start, 1 to Continue" )
1263   PORT_DIPSETTING(    0x40, "1 to Start, 1 to Continue" )
1027   PORT_DIPNAME( 0x38, 0x00, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("5/6A:!5,!4,!3")   /* No. Of Demerits Allowed  Bonus Inc. Every x Pts  Perfect Day Bonus   */
1028   PORT_DIPSETTING(    0x38, DEF_STR( Easiest ) )                                 /* 11                       5000                    Yes                 */
1029   PORT_DIPSETTING(    0x30, DEF_STR( Very_Easy ) )                              /* 10                       6000                    Yes                 */
1030   PORT_DIPSETTING(    0x28, DEF_STR( Easy ) )                                    /* 9                        8000                    Yes                 */
1031   PORT_DIPSETTING(    0x00, "Medium Easy" )                                    /* 8                        10000                   Yes                 */
1032   PORT_DIPSETTING(    0x20, "Medium Hard" )                                    /* 7                        11000                   Yes                 */
1033   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )                                    /* 6                        13000                   Yes                 */
1034   PORT_DIPSETTING(    0x08, DEF_STR( Very_Hard ) )                              /* 5                        15000                   No                  */
1035   PORT_DIPSETTING(    0x18, DEF_STR( Hardest ) )                                 /* 4                        18000                   No                  */
1036   PORT_DIPNAME( 0xc0, 0x00, "Coins Required" )      PORT_DIPLOCATION("5/6A:!2,!1")
1037   PORT_DIPSETTING(    0x80, "3 To Start, 2 To Continue" )
1038   PORT_DIPSETTING(    0xc0, "3 To Start, 1 To Continue" )
1039   PORT_DIPSETTING(    0x00, "2 To Start, 1 To Continue" )
1040   PORT_DIPSETTING(    0x40, "1 To Start, 1 To Continue" )
12641041INPUT_PORTS_END
12651042
12661043
r1877r1878
13531130   MDRV_CPU_ADD_TAG("main", T11, MASTER_CLOCK/2)
13541131   MDRV_CPU_CONFIG(t11_data)
13551132   MDRV_CPU_PROGRAM_MAP(main_map,0)
1356   MDRV_CPU_VBLANK_INT(vblank_int,1)
1133   MDRV_CPU_VBLANK_INT("main", vblank_int)
13571134
13581135   MDRV_CPU_ADD_TAG("sound", M6502, SOUND_CLOCK/8)
13591136   MDRV_CPU_PROGRAM_MAP(sound_map,0)
src/mame/drivers/mjsister.c
r1877r1878
77*****************************************************************************/
88
99#include "driver.h"
10#include "deprecat.h"
1011#include "sound/dac.h"
1112#include "sound/ay8910.h"
1213
r1877r1878
308309   MDRV_CPU_ADD(Z80, MCLK/2) /* 6.000 MHz */
309310   MDRV_CPU_PROGRAM_MAP(mjsister_readmem,mjsister_writemem)
310311   MDRV_CPU_IO_MAP(mjsister_readport,mjsister_writeport)
311   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
312   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
312313
313314   MDRV_MACHINE_RESET(mjsister)
314315
src/mame/drivers/ninjakd2.c
r1877r1878
925925   /* basic machine hardware */
926926   MDRV_CPU_ADD_TAG("main", Z80, MAIN_CLOCK_12/2)      /* verified */
927927   MDRV_CPU_PROGRAM_MAP(ninjakd2_main_cpu,0)
928   MDRV_CPU_VBLANK_INT(ninjakd2_interrupt,1)
928   MDRV_CPU_VBLANK_INT("main", ninjakd2_interrupt)
929929
930930   MDRV_CPU_ADD_TAG("sound", Z80, MAIN_CLOCK_5)      /* verified */
931931   MDRV_CPU_PROGRAM_MAP(ninjakd2_sound_cpu,0)
src/mame/drivers/skydiver.c
r1877r1878
8787***************************************************************************/
8888
8989#include "driver.h"
90#include "deprecat.h"
9091#include "skydiver.h"
9192#include "sound/discrete.h"
9293
r1877r1878
144145static INTERRUPT_GEN( skydiver_interrupt )
145146{
146147   /* Convert range data to divide value and write to sound */
147   discrete_sound_w(SKYDIVER_RANGE_DATA, (0x01 << (~skydiver_videoram[0x394] & 0x07)) & 0xff);   // Range 0-2
148   discrete_sound_w(machine, SKYDIVER_RANGE_DATA, (0x01 << (~skydiver_videoram[0x394] & 0x07)) & 0xff);   // Range 0-2
148149
149   discrete_sound_w(SKYDIVER_RANGE3_EN,  skydiver_videoram[0x394] & 0x08);      // Range 3 - note disable
150   discrete_sound_w(SKYDIVER_NOTE_DATA, ~skydiver_videoram[0x395] & 0xff);      // Note - freq
151   discrete_sound_w(SKYDIVER_NOISE_DATA,  skydiver_videoram[0x396] & 0x0f);   // NAM - Noise Amplitude
150   discrete_sound_w(machine, SKYDIVER_RANGE3_EN,  skydiver_videoram[0x394] & 0x08);      // Range 3 - note disable
151   discrete_sound_w(machine, SKYDIVER_NOTE_DATA, ~skydiver_videoram[0x395] & 0xff);      // Note - freq
152   discrete_sound_w(machine, SKYDIVER_NOISE_DATA,  skydiver_videoram[0x396] & 0x0f);   // NAM - Noise Amplitude
152153
153154   if (skydiver_nmion)
154155      cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
r1877r1878
164165
165166static WRITE8_HANDLER( skydiver_sound_enable_w )
166167{
167   discrete_sound_w(SKYDIVER_SOUND_EN, offset);
168   discrete_sound_w(machine, SKYDIVER_SOUND_EN, offset);
168169}
169170
170171static WRITE8_HANDLER( skydiver_whistle_w )
171172{
172   discrete_sound_w(SKYDIVER_WHISTLE1_EN + (offset >> 1), offset & 0x01);
173   discrete_sound_w(machine, SKYDIVER_WHISTLE1_EN + (offset >> 1), offset & 0x01);
173174}
174175
175176
r1877r1878
370371   /* basic machine hardware */
371372   MDRV_CPU_ADD(M6800,3000000/4)      /* ???? */
372373   MDRV_CPU_PROGRAM_MAP(skydiver_map, 0)
373   MDRV_CPU_VBLANK_INT(skydiver_interrupt, 5)
374   MDRV_CPU_VBLANK_INT_HACK(skydiver_interrupt, 5)
374375   MDRV_WATCHDOG_VBLANK_INIT(8)   // 128V clocks the same as VBLANK
375376
376377   MDRV_MACHINE_RESET(skydiver)
src/mame/drivers/yunsung8.c
r1877r1878
6060
6161   yunsung8_videoram_0 = RAM + 0x0000;   // Ram is banked
6262   yunsung8_videoram_1 = RAM + 0x2000;
63   yunsung8_videobank_w(0,0);
63   yunsung8_videobank_w(machine,0,0);
6464}
6565
6666
r1877r1878
7777{
7878   UINT8 *RAM = memory_region(REGION_CPU1);
7979
80   int bank         =   data & 7;      // ROM bank
80   int bank            =   data & 7;      // ROM bank
8181   yunsung8_layers_ctrl   =   data & 0x30;   // Layers enable
8282
8383   if (data & ~0x37)   logerror("CPU #0 - PC %04X: Bank %02X\n",activecpu_get_pc(),data);
r1877r1878
9797    d000-dfff   Tiles   ""
9898*/
9999
100static ADDRESS_MAP_START( yunsung8_readmem, ADDRESS_SPACE_PROGRAM, 8 )
101   AM_RANGE(0x0000, 0x7fff) AM_READ(MRA8_ROM            )   // ROM
100static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
101   AM_RANGE(0x0001, 0x0001) AM_WRITE(yunsung8_bankswitch_w   )   // ROM Bank (again?)
102102   AM_RANGE(0x8000, 0xbfff) AM_READ(MRA8_BANK1            )   // Banked ROM
103   AM_RANGE(0xc000, 0xdfff) AM_READ(yunsung8_videoram_r   )   // Video RAM (Banked)
104   AM_RANGE(0xe000, 0xffff) AM_READ(MRA8_RAM            )   // RAM
103   AM_RANGE(0x0000, 0xbfff) AM_ROM
104   AM_RANGE(0xc000, 0xdfff) AM_READWRITE(yunsung8_videoram_r, yunsung8_videoram_w   )   // Video RAM (Banked)
105   AM_RANGE(0xe000, 0xffff) AM_RAM
105106ADDRESS_MAP_END
106107
107static ADDRESS_MAP_START( yunsung8_writemem, ADDRESS_SPACE_PROGRAM, 8 )
108   AM_RANGE(0x0000, 0x0000) AM_WRITE(MWA8_ROM            )   // ROM
109   AM_RANGE(0x0001, 0x0001) AM_WRITE(yunsung8_bankswitch_w   )   // ROM Bank (again?)
110   AM_RANGE(0x0002, 0xbfff) AM_WRITE(MWA8_ROM            )   // ROM
111   AM_RANGE(0xc000, 0xdfff) AM_WRITE(yunsung8_videoram_w   )   // Video RAM (Banked)
112   AM_RANGE(0xe000, 0xffff) AM_WRITE(MWA8_RAM            )   // RAM
113ADDRESS_MAP_END
114108
115
116static ADDRESS_MAP_START( yunsung8_readport, ADDRESS_SPACE_IO, 8 )
109static ADDRESS_MAP_START( port_map, ADDRESS_SPACE_IO, 8 )
117110   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
118   AM_RANGE(0x00, 0x00) AM_READ(input_port_0_r      )   // Coins
119   AM_RANGE(0x01, 0x01) AM_READ(input_port_1_r      )   // P1
120   AM_RANGE(0x02, 0x02) AM_READ(input_port_2_r      )   // P2
121   AM_RANGE(0x03, 0x03) AM_READ(input_port_3_r      )   // DSW 1
122   AM_RANGE(0x04, 0x04) AM_READ(input_port_4_r      )   // DSW 2
111   AM_RANGE(0x00, 0x00) AM_READWRITE(input_port_0_r, yunsung8_videobank_w   )   // read = coins . write = video RAM bank
112   AM_RANGE(0x01, 0x01) AM_READWRITE(input_port_1_r, yunsung8_bankswitch_w   )   // read = P1 . write = ROM Bank + Layers Enable
113   AM_RANGE(0x02, 0x02) AM_READWRITE(input_port_2_r, soundlatch_w         )   // read = P2 . write = To Sound CPU
114   AM_RANGE(0x03, 0x03) AM_READ(input_port_3_r                        )   // DSW 1
115   AM_RANGE(0x04, 0x04) AM_READ(input_port_4_r                        )   // DSW 2
116   AM_RANGE(0x06, 0x06) AM_WRITE(yunsung8_flipscreen_w                  )   // Flip Screen
117   AM_RANGE(0x07, 0x07) AM_WRITE(MWA8_NOP                           )   // ? (end of IRQ, random value)
123118ADDRESS_MAP_END
124119
125static ADDRESS_MAP_START( yunsung8_writeport, ADDRESS_SPACE_IO, 8 )
126   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
127   AM_RANGE(0x00, 0x00) AM_WRITE(yunsung8_videobank_w   )   // Video RAM Bank
128   AM_RANGE(0x01, 0x01) AM_WRITE(yunsung8_bankswitch_w   )   // ROM Bank + Layers Enable
129   AM_RANGE(0x02, 0x02) AM_WRITE(soundlatch_w         )   // To Sound CPU
130   AM_RANGE(0x06, 0x06) AM_WRITE(yunsung8_flipscreen_w   )   // Flip Screen
131   AM_RANGE(0x07, 0x07) AM_WRITE(MWA8_NOP            )   // ? (end of IRQ, random value)
132ADDRESS_MAP_END
133120
134121
135
136122/***************************************************************************
137123
138124
r1877r1878
167153
168154
169155
170static ADDRESS_MAP_START( yunsung8_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
171   AM_RANGE(0x0000, 0x7fff) AM_READ(MRA8_ROM                  )   // ROM
172   AM_RANGE(0x8000, 0xbfff) AM_READ(MRA8_BANK2                  )   // Banked ROM
173   AM_RANGE(0xf000, 0xf7ff) AM_READ(MRA8_RAM                  )   // RAM
174   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r               )   // From Main CPU
175ADDRESS_MAP_END
176
177static ADDRESS_MAP_START( yunsung8_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
178   AM_RANGE(0x0000, 0x7fff) AM_WRITE(MWA8_ROM                  )   // ROM
179   AM_RANGE(0x8000, 0xbfff) AM_WRITE(MWA8_ROM                  )   // Banked ROM
156static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
157   AM_RANGE(0x0000, 0x7fff) AM_ROM
158   AM_RANGE(0x8000, 0xbfff) AM_READWRITE(MRA8_BANK2,MWA8_ROM      )   // Banked ROM
180159   AM_RANGE(0xe000, 0xe000) AM_WRITE(yunsung8_sound_bankswitch_w   )   // ROM Bank
181160   AM_RANGE(0xe400, 0xe400) AM_WRITE(yunsung8_adpcm_w            )
182161   AM_RANGE(0xec00, 0xec00) AM_WRITE(YM3812_control_port_0_w      )   // YM3812
183162   AM_RANGE(0xec01, 0xec01) AM_WRITE(YM3812_write_port_0_w         )
184   AM_RANGE(0xf000, 0xf7ff) AM_WRITE(MWA8_RAM                  )   // RAM
163   AM_RANGE(0xf000, 0xf7ff) AM_RAM
164   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r               )   // From Main CPU
185165ADDRESS_MAP_END
186166
187167
r1877r1878
528508
529509   /* basic machine hardware */
530510   MDRV_CPU_ADD(Z80, 8000000)         /* Z80B */
531   MDRV_CPU_PROGRAM_MAP(yunsung8_readmem,yunsung8_writemem)
532   MDRV_CPU_IO_MAP(yunsung8_readport,yunsung8_writeport)
533   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   /* No nmi routine */
511   MDRV_CPU_PROGRAM_MAP(main_map,0)
512   MDRV_CPU_IO_MAP(port_map,0)
513   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   /* No nmi routine */
534514
535515   MDRV_CPU_ADD(Z80, 4000000)         /* ? */
536516   /* audio CPU */
537   MDRV_CPU_PROGRAM_MAP(yunsung8_sound_readmem,yunsung8_sound_writemem)
538   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   /* NMI caused by the MSM5205? */
517   MDRV_CPU_PROGRAM_MAP(sound_map,0)
518   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   /* NMI caused by the MSM5205? */
539519
540520   MDRV_MACHINE_RESET(yunsung8)
541521
src/mame/drivers/m52.c
r1877r1878
390390   MDRV_CPU_ADD_TAG("main", Z80, MASTER_CLOCK/6)
391391   MDRV_CPU_PROGRAM_MAP(main_map,0)
392392   MDRV_CPU_IO_MAP(main_portmap,0)
393   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
393   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
394394
395395   /* video hardware */
396396   MDRV_GFXDECODE(m52)
src/mame/drivers/spacefb.c
r1877r1878
208208static MACHINE_RESET( spacefb )
209209{
210210   /* the 3 output ports are cleared on reset */
211   spacefb_port_0_w(0, 0);
212   spacefb_port_1_w(0, 0);
213   spacefb_port_2_w(0, 0);
211   spacefb_port_0_w(machine, 0, 0);
212   spacefb_port_1_w(machine, 0, 0);
213   spacefb_port_2_w(machine, 0, 0);
214214
215215   start_interrupt_timer();
216216}
src/mame/drivers/warpwarp.c
r1877r1878
176176         /* n.c. */
177177         break;
178178      case 3:
179         geebee_sound_w(0,data);
179         geebee_sound_w(machine,0,data);
180180         break;
181181   }
182182}
r1877r1878
255255         warpwarp_ball_v = data;
256256         break;
257257      case 2:
258         warpwarp_sound_w(0,data);
258         warpwarp_sound_w(machine,0,data);
259259         break;
260260      case 3:
261         watchdog_reset_w(0,data);
261         watchdog_reset_w(machine,0,data);
262262         break;
263263   }
264264}
r1877r1878
837837   MDRV_CPU_ADD_TAG("main", 8080,XTAL_18_432MHz/9) /* verified on pcb */
838838   MDRV_CPU_PROGRAM_MAP(readmem_geebee,writemem_geebee)
839839   MDRV_CPU_IO_MAP(readport_geebee,writeport_geebee)
840   MDRV_CPU_VBLANK_INT(irq0_line_pulse,1)   /* one interrupt per frame */
840   MDRV_CPU_VBLANK_INT("main", irq0_line_pulse)
841841
842842   /* video hardware */
843843   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
880880   /* basic machine hardware */
881881   MDRV_CPU_ADD_TAG("main", 8080,18432000/9)       /* 18.432 MHz / 9 */
882882   MDRV_CPU_PROGRAM_MAP(readmem_bombbee,writemem_bombbee)
883   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
883   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
884884
885885   /* video hardware */
886886   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/cubocd32.c
r1877r1878
4545*/
4646
4747#include "driver.h"
48#include "memconv.h"
4849#include "sound/custom.h"
4950#include "includes/amiga.h"
5051#include "includes/cubocd32.h"
5152
52//READWRITE16BETO32BE(amiga_cia32,amiga_cia_r,amiga_cia_w)
53//READWRITE16BETO32BE(amiga_custom32,amiga_custom_r,amiga_custom_w)
54
5553static READ32_HANDLER( amiga_cia32_r )
5654{
57   UINT32 result = 0;
58   if ((mem_mask & 0xffff0000) != 0xffff0000)
59      result |= amiga_cia_r(offset * 2 + 0, mem_mask >> 16) << 16;
60   if ((mem_mask & 0x0000ffff) != 0x0000ffff)
61      result |= amiga_cia_r(offset * 2 + 1, mem_mask) << 0;
62   return result;
55   return read32be_with_16be_handler(amiga_cia_r, machine, offset, mem_mask);
6356}
6457
6558static WRITE32_HANDLER( amiga_cia32_w )
6659{
67   if ((mem_mask & 0xffff0000) != 0xffff0000)
68      amiga_cia_w( offset * 2 + 0, data >> 16, mem_mask >> 16);
69   if ((mem_mask & 0x0000ffff) != 0x0000ffff)
70      amiga_cia_w( offset * 2 + 1, data, mem_mask);
60   write32be_with_16be_handler(amiga_cia_w, machine, offset, data, mem_mask);
7161}
7262
7363static READ32_HANDLER( amiga_custom32_r )
7464{
75   UINT32 result = 0;
76   if ((mem_mask & 0xffff0000) != 0xffff0000)
77      result |= amiga_custom_r(offset * 2 + 0, mem_mask >> 16) << 16;
78   if ((mem_mask & 0x0000ffff) != 0x0000ffff)
79      result |= amiga_custom_r(offset * 2 + 1, mem_mask) << 0;
80   return result;
65   return read32be_with_16be_handler(amiga_custom_r, machine, offset, mem_mask);
8166}
8267
8368static WRITE32_HANDLER( amiga_custom32_w )
8469{
85   if ((mem_mask & 0xffff0000) != 0xffff0000)
86      amiga_custom_w( offset * 2 + 0, data >> 16, mem_mask >> 16);
87   if ((mem_mask & 0x0000ffff) != 0x0000ffff)
88      amiga_custom_w( offset * 2 + 1, data, mem_mask);
70   write32be_with_16be_handler(amiga_custom_w, machine, offset, data, mem_mask);
8971}
9072
9173static WRITE32_HANDLER( aga_overlay_w )
r1877r1878
267249   /* basic machine hardware */
268250   MDRV_CPU_ADD(M68EC020, AMIGA_68EC020_PAL_CLOCK) /* 14.3 Mhz */
269251   MDRV_CPU_PROGRAM_MAP(cd32_map,0)
270   MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 312)
271252
272253   MDRV_MACHINE_RESET(amiga)
273254   MDRV_NVRAM_HANDLER(cd32)
r1877r1878
286267   MDRV_PALETTE_INIT(amiga)
287268
288269   MDRV_VIDEO_START(amiga)
289   MDRV_VIDEO_UPDATE(generic_bitmapped)
270   MDRV_VIDEO_UPDATE(amiga)
290271
291272   /* sound hardware */
292273    MDRV_SPEAKER_STANDARD_STEREO("left", "right")
src/mame/drivers/wheelfir.c
r1877r1878
7575
7676static UINT16 *wheelfir_myram;
7777static UINT16 wheelfir_blitdata[16];
78static mame_bitmap *wheelfir_tmp_bitmap[3];
78static bitmap_t *wheelfir_tmp_bitmap[3];
7979
8080/*
8181
r1877r1878
150150
151151/* it draws the background and road with direct writes to port 6... but where does this really go? an extra blit source page? */
152152static int wheelfir_six_pos = 0;
153static mame_bitmap* render_bitmap;
153static bitmap_t* render_bitmap;
154154
155155static WRITE16_HANDLER(wheelfir_blit_w)
156156{
r1877r1878
631631static MACHINE_DRIVER_START( wheelfir )
632632   MDRV_CPU_ADD_TAG("main", M68000, 32000000)
633633   MDRV_CPU_PROGRAM_MAP(wheelfir_main, 0)
634   MDRV_CPU_VBLANK_INT(wheelfir_irq,256)  // 1,3,5 valid
634   MDRV_CPU_VBLANK_INT_HACK(wheelfir_irq,256)  // 1,3,5 valid
635635
636636   MDRV_CPU_ADD_TAG("main", M68000, 32000000/2)
637637   MDRV_CPU_PROGRAM_MAP(wheelfir_sub, 0)
638   MDRV_CPU_VBLANK_INT(irq1_line_hold,1) // 1 valid
638   MDRV_CPU_VBLANK_INT("main", irq1_line_hold) // 1 valid
639639
640640   MDRV_MACHINE_RESET (wheelfir)
641641
src/mame/drivers/steaser.c
r1877r1878
8282static MACHINE_DRIVER_START( steaser )
8383   MDRV_CPU_ADD_TAG("main", M68000, 11059200 )
8484   MDRV_CPU_PROGRAM_MAP(steaser_map,0)
85//  MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
85//  MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
8686
8787   MDRV_GFXDECODE(steaser)
8888
src/mame/drivers/cbuster.c
r1877r1878
3838{
3939   switch (offset<<1) {
4040   case 0: /* DMA flag */
41      buffer_spriteram16_w(0,0,0);
41      buffer_spriteram16_w(machine,0,0,0);
4242      return;
4343
4444   case 6: /* IRQ ack */
4545      return;
4646
4747    case 2: /* Sound CPU write */
48      soundlatch_w(0,data & 0xff);
49      cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
48      soundlatch_w(machine,0,data & 0xff);
49      cpunum_set_input_line(machine, 1,0,HOLD_LINE);
5050       return;
5151
5252   case 4: /* Protection, maybe this is a PAL on the board?
r1877r1878
158158{
159159   switch (offset) {
160160   case 0:
161      YM2151_register_port_0_w(0,data);
161      YM2151_register_port_0_w(machine,0,data);
162162      break;
163163   case 1:
164      YM2151_data_port_0_w(0,data);
164      YM2151_data_port_0_w(machine,0,data);
165165      break;
166166   }
167167}
r1877r1878
170170{
171171   switch (offset) {
172172   case 0:
173      YM2203_control_port_0_w(0,data);
173      YM2203_control_port_0_w(machine,0,data);
174174      break;
175175   case 1:
176      YM2203_write_port_0_w(0,data);
176      YM2203_write_port_0_w(machine,0,data);
177177      break;
178178   }
179179}
r1877r1878
346346   /* basic machine hardware */
347347   MDRV_CPU_ADD(M68000, 12000000) /* Custom chip 59 */
348348   MDRV_CPU_PROGRAM_MAP(twocrude_readmem,twocrude_writemem)
349   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)/* VBL */
349   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)/* VBL */
350350
351351   MDRV_CPU_ADD(H6280,32220000/4) /* Custom chip 45, Audio section crystal is 32.220 MHz */
352352   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
src/mame/drivers/ghosteo.c
r1877r1878
484484   /* basic machine hardware */
485485   MDRV_CPU_ADD(ARM7, 24000000)
486486   MDRV_CPU_PROGRAM_MAP(bballoon_map,0)
487   MDRV_CPU_VBLANK_INT(bballoon_interrupt,1)
487   MDRV_CPU_VBLANK_INT("main", bballoon_interrupt)
488488
489489
490490   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/dunhuang.c
r1877r1878
346346static READ8_HANDLER( dunhuang_service_r )
347347{
348348   return readinputport(5)
349    | ((dunhuang_hopper && !(cpu_getcurrentframe()%10)) ? 0x00 : 0x08)   // bit 3: hopper sensor
349    | ((dunhuang_hopper && !(video_screen_get_frame_number(0)%10)) ? 0x00 : 0x08)   // bit 3: hopper sensor
350350    | 0x80                                                // bit 7 low -> tiles block transferrer busy
351351   ;
352352}
r1877r1878
676676   MDRV_CPU_ADD(Z80,12000000/2)
677677   MDRV_CPU_PROGRAM_MAP(dunhuang_map,0)
678678   MDRV_CPU_IO_MAP(dunhuang_io_map,0)
679   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
679   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
680680
681681   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_SEC(5))
682682
src/mame/drivers/gng.c
r1877r1878
2121***************************************************************************/
2222
2323#include "driver.h"
24#include "deprecat.h"
2425#include "cpu/m6809/m6809.h"
2526#include "sound/2203intf.h"
2627
r1877r1878
341342   /* basic machine hardware */
342343   MDRV_CPU_ADD(M6809, 1500000)         /* 1.5 MHz ? */
343344   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
344   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
345   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
345346
346347   MDRV_CPU_ADD(Z80, 3000000)
347348   /* audio CPU */
348349   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
349   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)
350   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)
350351
351352   MDRV_MACHINE_START(gng)
352353
src/mame/drivers/onetwo.c
r1877r1878
6868
6969static WRITE8_HANDLER( onetwo_coin_counters_w )
7070{
71   watchdog_reset_w(0, data & 0x01);
71   watchdog_reset(machine);
7272   coin_counter_w(0, data & 0x02);
7373   coin_counter_w(1, data & 0x04);
7474}
7575
7676static WRITE8_HANDLER( onetwo_soundlatch_w )
7777{
78   soundlatch_w(0, data);
79   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
78   soundlatch_w(machine, 0, data);
79   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
8080}
8181
8282static void setColor(int offset)
r1877r1878
137137ADDRESS_MAP_END
138138
139139static INPUT_PORTS_START( onetwo )
140   PORT_START
141   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
142   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
143   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
144   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
145   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
146   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
147   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
148   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
149   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
150   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
151   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
152   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
153   PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coinage ) )
140   PORT_START_TAG("DSW1")
141   PORT_DIPNAME( 0x03, 0x03, "Timer" ) PORT_DIPLOCATION("SW1:1,2")
142   PORT_DIPSETTING(    0x03, DEF_STR( Easy ) )
143   PORT_DIPSETTING(    0x02, DEF_STR( Normal ) )
144   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) )
145   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
146   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4")
147   PORT_DIPSETTING(    0x0c, DEF_STR( Easy ) )
148   PORT_DIPSETTING(    0x08, DEF_STR( Normal ) )
149   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
150   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
151   PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coinage ) ) PORT_CONDITION("DSW2",0x04,PORTCOND_EQUALS,0x04) PORT_DIPLOCATION("SW1:5,6,7,8")
154152   PORT_DIPSETTING(    0xa0, DEF_STR( 6C_1C ) )
155153   PORT_DIPSETTING(    0xb0, DEF_STR( 5C_1C ) )
156154   PORT_DIPSETTING(    0xc0, DEF_STR( 4C_1C ) )
r1877r1878
167165   PORT_DIPSETTING(    0x60, DEF_STR( 1C_5C ) )
168166   PORT_DIPSETTING(    0x50, DEF_STR( 1C_6C ) )
169167   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
168    PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) PORT_CONDITION("DSW2",0x04,PORTCOND_NOTEQUALS,0x04) PORT_DIPLOCATION("SW1:5,6")
169   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
170   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) )
171   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) )
172   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
173   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) PORT_CONDITION("DSW2",0x04,PORTCOND_NOTEQUALS,0x04) PORT_DIPLOCATION("SW1:7,8")
174   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) )
175   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
176   PORT_DIPSETTING(    0x40, DEF_STR( 1C_5C ) )
177   PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )
170178
171   PORT_START
172   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
179   PORT_START_TAG("DSW2")
180   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown) ) PORT_DIPLOCATION("SW2:1") /* Flip Sreen? */
173181   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
174182   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
175   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
183   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:2")
176184   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
177185   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
178   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
179   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
180   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
181   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
182   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
183   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
184   PORT_DIPNAME( 0x10, 0x10, "Allow Stage Selection" )
186   PORT_DIPNAME( 0x04, 0x04, "Coin Chute" ) PORT_DIPLOCATION("SW2:3")
187   PORT_DIPSETTING(    0x04, "Common" )
188   PORT_DIPSETTING(    0x00, "Separate" )
189   PORT_DIPNAME( 0x08, 0x08, "Nude Pictures" ) PORT_DIPLOCATION("SW2:4")
190   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
191   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
192   PORT_DIPNAME( 0x10, 0x10, "Women Select" ) PORT_DIPLOCATION("SW2:5")
185193   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
186194   PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
187   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
195   /* In stop mode, press 2 to stop and 1 to restart */
196   PORT_DIPNAME( 0x20, 0x20, "Stop Mode (Cheat)") PORT_DIPLOCATION("SW2:6")
188197   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
189198   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
190   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
191   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
192   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
193   PORT_DIPNAME( 0x80, 0x00, "Freeze" )
199   PORT_DIPNAME( 0x40, 0x40, "Play Mode" ) PORT_DIPLOCATION("SW2:7")
200   PORT_DIPSETTING(    0x00, "1 Player" )
201   PORT_DIPSETTING(    0x40, "2 Player" )
202   PORT_DIPNAME( 0x80, 0x00, "Freeze" ) PORT_DIPLOCATION("SW2:8")
194203   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
195204   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
196205
197   PORT_START
206   PORT_START_TAG("IN0")
198207   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
199208   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
200209   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
r1877r1878
204213   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
205214   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
206215
207   PORT_START
216   PORT_START_TAG("IN1")
208217   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
209218   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
210219   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
r1877r1878
214223   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
215224   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
216225
217   PORT_START
226   PORT_START_TAG("COIN")
218227   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
219228   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
220229   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
r1877r1878
266275   MDRV_CPU_ADD(Z80,4000000)   /* 4 MHz */
267276   MDRV_CPU_PROGRAM_MAP(main_cpu,0)
268277   MDRV_CPU_IO_MAP(main_cpu_io,0)
269   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
278   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
270279
271280   MDRV_CPU_ADD(Z80,4000000)   /* 4 MHz */
272281   /* audio CPU */
src/mame/drivers/ojankohs.c
r1877r1878
5555VIDEO_START( ojankoc );
5656WRITE8_HANDLER( ojankoc_palette_w );
5757WRITE8_HANDLER( ojankoc_videoram_w );
58void ojankoc_flipscreen(int data);
58void ojankoc_flipscreen(running_machine *machine, int data);
5959
6060
6161static int ojankohs_portselect;
r1877r1878
133133
134134   ojankohs_adpcm_reset = ((data & 0x10) >> 4);
135135   MSM5205_reset_w(0, (!(data & 0x10) >> 4));
136   ojankoc_flipscreen(data);
136   ojankoc_flipscreen(machine, data);
137137}
138138
139139static WRITE8_HANDLER( ojankohs_portselect_w )
r1877r1878
956956   MDRV_CPU_ADD(Z80,12000000/2)      /* 6.00 MHz ? */
957957   MDRV_CPU_PROGRAM_MAP(readmem_ojankohs,writemem_ojankohs)
958958   MDRV_CPU_IO_MAP(readport_ojankohs,writeport_ojankohs)
959   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
959   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
960960
961961   MDRV_MACHINE_RESET(ojankohs)
962962   MDRV_NVRAM_HANDLER(generic_0fill)
r1877r1878
993993   MDRV_CPU_ADD(Z80,12000000/2)      /* 6.00 MHz ? */
994994   MDRV_CPU_PROGRAM_MAP(readmem_ojankoy,writemem_ojankoy)
995995   MDRV_CPU_IO_MAP(readport_ojankohs,writeport_ojankoy)
996   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
996   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
997997
998998   MDRV_MACHINE_RESET(ojankohs)
999999   MDRV_NVRAM_HANDLER(generic_0fill)
r1877r1878
10311031   MDRV_CPU_ADD(Z80,12000000/2)      /* 6.00 MHz ? */
10321032   MDRV_CPU_PROGRAM_MAP(readmem_ojankoy,writemem_ojankoy)
10331033   MDRV_CPU_IO_MAP(readport_ccasino,writeport_ccasino)
1034   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1034   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
10351035
10361036   MDRV_MACHINE_RESET(ojankohs)
10371037   MDRV_NVRAM_HANDLER(generic_0fill)
r1877r1878
10681068   MDRV_CPU_ADD(Z80,8000000/2)         /* 4.00 MHz */
10691069   MDRV_CPU_PROGRAM_MAP(readmem_ojankoc,writemem_ojankoc)
10701070   MDRV_CPU_IO_MAP(readport_ojankoc,writeport_ojankoc)
1071   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1071   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
10721072
10731073   MDRV_MACHINE_RESET(ojankohs)
10741074   MDRV_NVRAM_HANDLER(generic_0fill)
src/mame/drivers/n8080.c
r1877r1878
1111***************************************************************************/
1212
1313#include "driver.h"
14#include "deprecat.h"
1415#include "includes/n8080.h"
1516
1617static unsigned shift_data;
r1877r1878
7879   MDRV_CPU_ADD(8080, 20160000 / 10)
7980   MDRV_CPU_PROGRAM_MAP(main_cpu_map, 0)
8081   MDRV_CPU_IO_MAP(main_io_map, 0)
81   MDRV_CPU_VBLANK_INT(interrupt, 2)
82   MDRV_CPU_VBLANK_INT_HACK(interrupt, 2)
8283
8384   /* video hardware */
8485   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
103104   MDRV_CPU_ADD(8080, 20160000 / 10)
104105   MDRV_CPU_PROGRAM_MAP(main_cpu_map, 0)
105106   MDRV_CPU_IO_MAP(main_io_map, 0)
106   MDRV_CPU_VBLANK_INT(interrupt, 2)
107   MDRV_CPU_VBLANK_INT_HACK(interrupt, 2)
107108
108109   /* video hardware */
109110   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
128129   MDRV_CPU_ADD(8080, 20160000 / 10)
129130   MDRV_CPU_PROGRAM_MAP(helifire_main_cpu_map, 0)
130131   MDRV_CPU_IO_MAP(main_io_map, 0)
131   MDRV_CPU_VBLANK_INT(interrupt, 2)
132   MDRV_CPU_VBLANK_INT_HACK(interrupt, 2)
132133
133134   /* video hardware */
134135   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/nbmj8891.c
r1877r1878
30283028   MDRV_CPU_ADD_TAG("main", Z80, 20000000/4)   /* 5.00 MHz ? */
30293029   MDRV_CPU_PROGRAM_MAP(readmem_gionbana, writemem_gionbana)
30303030   MDRV_CPU_IO_MAP(readport_gionbana, writeport_gionbana)
3031//  MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 132)    // nmiclock = 60
3032   MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 1)
3031//  MDRV_CPU_VBLANK_INT_HACK(nb1413m3_interrupt, 132)    // nmiclock = 60
3032   MDRV_CPU_VBLANK_INT("main", nb1413m3_interrupt)
30333033
30343034   MDRV_MACHINE_RESET(nb1413m3)
30353035
r1877r1878
30933093   MDRV_IMPORT_FROM(gionbana)
30943094   MDRV_CPU_MODIFY("main")
30953095   MDRV_CPU_IO_MAP(readport_gionbana, writeport_hanamomo)
3096//  MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 142)    // ?
3096//  MDRV_CPU_VBLANK_INT_HACK(nb1413m3_interrupt, 142)    // ?
30973097
30983098   MDRV_NVRAM_HANDLER(nb1413m3)
30993099
r1877r1878
31093109   MDRV_IMPORT_FROM(gionbana)
31103110   MDRV_CPU_MODIFY("main")
31113111   MDRV_CPU_IO_MAP(readport_gionbana, writeport_hanamomo)
3112//  MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 128)
3112//  MDRV_CPU_VBLANK_INT_HACK(nb1413m3_interrupt, 128)
31133113
31143114   MDRV_NVRAM_HANDLER(nb1413m3)
31153115
r1877r1878
31263126   MDRV_CPU_MODIFY("main")
31273127   MDRV_CPU_PROGRAM_MAP(readmem_hanamomo, writemem_hanamomo)
31283128   MDRV_CPU_IO_MAP(readport_gionbana, writeport_hanamomo)
3129//  MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 128)
3129//  MDRV_CPU_VBLANK_INT_HACK(nb1413m3_interrupt, 128)
31303130
31313131   /* video hardware */
31323132   MDRV_SCREEN_MODIFY("main")
r1877r1878
31423142   MDRV_CPU_MODIFY("main")
31433143   MDRV_CPU_PROGRAM_MAP(readmem_gionbana, writemem_gionbana)
31443144   MDRV_CPU_IO_MAP(readport_gionbana, writeport_msjiken)
3145//  MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 142)    // nmiclock = 70
3145//  MDRV_CPU_VBLANK_INT_HACK(nb1413m3_interrupt, 142)    // nmiclock = 70
31463146MACHINE_DRIVER_END
31473147
31483148
r1877r1878
31533153   /* basic machine hardware */
31543154   MDRV_IMPORT_FROM(gionbana)
31553155   MDRV_CPU_MODIFY("main")
3156//  MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 142)    // nmiclock = 70
3156//  MDRV_CPU_VBLANK_INT_HACK(nb1413m3_interrupt, 142)    // nmiclock = 70
31573157
31583158   /* video hardware */
31593159   MDRV_VIDEO_START(nbmj8891_1layer)
r1877r1878
31653165   /* basic machine hardware */
31663166   MDRV_IMPORT_FROM(telmahjn)
31673167   MDRV_CPU_MODIFY("main")
3168//  MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 128)
3168//  MDRV_CPU_VBLANK_INT_HACK(nb1413m3_interrupt, 128)
31693169MACHINE_DRIVER_END
31703170
31713171
r1877r1878
32643264   MDRV_CPU_MODIFY("main")
32653265   MDRV_CPU_PROGRAM_MAP(readmem_scandalm, writemem_scandalm)
32663266   MDRV_CPU_IO_MAP(readport_scandalm, writeport_scandalm)
3267//  MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 128)
3267//  MDRV_CPU_VBLANK_INT_HACK(nb1413m3_interrupt, 128)
32683268
32693269   MDRV_NVRAM_HANDLER(nb1413m3)
32703270
r1877r1878
32873287   MDRV_CPU_MODIFY("main")
32883288   MDRV_CPU_PROGRAM_MAP(readmem_taiwanmb, writemem_taiwanmb)
32893289   MDRV_CPU_IO_MAP(readport_taiwanmb, writeport_taiwanmb)
3290//  MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 1)
3290//  MDRV_CPU_VBLANK_INT("main", nb1413m3_interrupt)
32913291
32923292   MDRV_NVRAM_HANDLER(nb1413m3)
32933293
src/mame/drivers/wc90b.c
r1877r1878
129129
130130static WRITE8_HANDLER( wc90b_sound_command_w )
131131{
132   soundlatch_w(offset,data);
133   cpunum_set_input_line(Machine, 2,0,HOLD_LINE);
132   soundlatch_w(machine,offset,data);
133   cpunum_set_input_line(machine, 2,0,HOLD_LINE);
134134}
135135
136136static WRITE8_HANDLER( adpcm_control_w )
r1877r1878
393393   /* basic machine hardware */
394394   MDRV_CPU_ADD(Z80, 6000000)   /* 6.0 MHz ??? */
395395   MDRV_CPU_PROGRAM_MAP(wc90b_readmem1,wc90b_writemem1)
396   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
396   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
397397
398398   MDRV_CPU_ADD(Z80, 6000000)   /* 6.0 MHz ??? */
399399   MDRV_CPU_PROGRAM_MAP(wc90b_readmem2,wc90b_writemem2)
400   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
400   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
401401
402402   MDRV_CPU_ADD(Z80, 2510000) // based on goal92 speed measured by guru (although maybe it should be 10mhz / 4 which is close)
403403   /* audio CPU */   /* 2.51 MHz */
src/mame/drivers/kncljoe.c
r1877r1878
175175//  MDRV_CPU_ADD(Z80, 4000000) /* 4 MHz */
176176   MDRV_CPU_ADD(Z80, 5500000) /* 4 MHz is too low. The game loop never finishes a frame in time. */
177177   MDRV_CPU_PROGRAM_MAP(main_map,0)
178   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
178   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
179179
180180   /* video hardware */
181181   MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK)
src/mame/drivers/holeland.c
r1877r1878
300300   MDRV_CPU_ADD(Z80, 4000000)        /* 4 MHz ? */
301301   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
302302   MDRV_CPU_IO_MAP(readport,writeport)
303   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
303   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
304304
305305   /* video hardware */
306306   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
369369   MDRV_CPU_ADD(Z80, 20000000/4)        /* 5 MHz */
370370   MDRV_CPU_PROGRAM_MAP(crzrally_readmem,crzrally_writemem)
371371   MDRV_CPU_IO_MAP(readport,writeport)
372   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
372   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
373373
374374   /* video hardware */
375375   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/liberate.c
r1877r1878
1515*******************************************************************************/
1616
1717#include "driver.h"
18#include "deprecat.h"
1819#include "cpu/m6502/m6502.h"
1920#include "sound/ay8910.h"
2021
r1877r1878
519520   MDRV_CPU_ADD_TAG("main",DECO16, 2000000)
520521   MDRV_CPU_PROGRAM_MAP(liberate_readmem,liberate_writemem)
521522   MDRV_CPU_IO_MAP(deco16_readport,deco16_writeport)
522   MDRV_CPU_VBLANK_INT(deco16_interrupt,1)
523   MDRV_CPU_VBLANK_INT("main", deco16_interrupt)
523524
524525   MDRV_CPU_ADD_TAG("sound",M6502, 1500000)
525526   /* audio CPU */
526527   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
527   MDRV_CPU_VBLANK_INT(nmi_line_pulse,16)
528   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,16)
528529
529530   MDRV_INTERLEAVE(200)
530531
r1877r1878
558559   /* basic machine hardware */
559560   MDRV_CPU_ADD(M6502, 2000000)
560561   MDRV_CPU_PROGRAM_MAP(liberatb_readmem,liberatb_writemem)
561   MDRV_CPU_VBLANK_INT(deco16_interrupt,1)
562   MDRV_CPU_VBLANK_INT("main", deco16_interrupt)
562563
563564   MDRV_IMPORT_FROM(liberate)
564565   MDRV_CPU_REMOVE("main")
r1877r1878
595596   MDRV_CPU_ADD(M6502, 1500000)
596597   /* audio CPU */
597598   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
598   MDRV_CPU_VBLANK_INT(nmi_line_pulse,16)
599   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,16)
599600
600601   MDRV_INTERLEAVE(200)
601602
src/mame/drivers/spdodgeb.c
r1877r1878
4646
4747static WRITE8_HANDLER( sound_command_w )
4848{
49   soundlatch_w(offset,data);
50   cpunum_set_input_line(Machine, 1,M6809_IRQ_LINE,HOLD_LINE);
49   soundlatch_w(machine,offset,data);
50   cpunum_set_input_line(machine, 1,M6809_IRQ_LINE,HOLD_LINE);
5151}
5252
5353static WRITE8_HANDLER( spd_adpcm_w )
r1877r1878
435435   /* basic machine hardware */
436436   MDRV_CPU_ADD(M6502,12000000/6)   /* 2MHz ? */
437437   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
438   MDRV_CPU_VBLANK_INT(spdodgeb_interrupt,33)   /* 1 IRQ every 8 visible scanlines, plus NMI for vblank */
438   MDRV_CPU_VBLANK_INT_HACK(spdodgeb_interrupt,33)   /* 1 IRQ every 8 visible scanlines, plus NMI for vblank */
439439
440440   MDRV_CPU_ADD(M6809,12000000/6)
441441   /* audio CPU */   /* 2MHz ? */
src/mame/drivers/gunsmoke.c
r1877r1878
6767***************************************************************************/
6868
6969#include "driver.h"
70#include "deprecat.h"
7071#include "sound/2203intf.h"
7172
7273extern UINT8 *gunsmoke_scrollx;
r1877r1878
287288   // basic machine hardware
288289   MDRV_CPU_ADD(Z80, 4000000)   // 4 MHz
289290   MDRV_CPU_PROGRAM_MAP(gunsmoke_map, 0)
290   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
291   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
291292
292293   MDRV_CPU_ADD(Z80, 3000000)   // 3 MHz
293294   /* audio CPU */
294295   MDRV_CPU_PROGRAM_MAP(sound_map, 0)
295   MDRV_CPU_VBLANK_INT(irq0_line_hold, 4)
296   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold, 4)
296297
297298   // video hardware
298299
src/mame/drivers/cvs.c
r1877r1878
129129UINT8 *cvs_s2636_1_ram;
130130UINT8 *cvs_s2636_2_ram;
131131
132static emu_timer *cvs_393hz_timer;
133static UINT8 cvs_393hz_clock;
132134static UINT8 *cvs_4_bit_dac_data;
133135static UINT8 *cvs_tms5110_ctl_data;
134136
r1877r1878
277279   /* the lower 4 (or 3?) bits select the port to read */
278280   switch (offset & 0x0f)   /* might be 0x07 */
279281   {
280   case 0x00:  ret = input_port_0_r(0); break;
281   case 0x02:  ret = input_port_1_r(0); break;
282   case 0x03:  ret = input_port_2_r(0); break;
283   case 0x04:  ret = input_port_3_r(0); break;
284   case 0x06:  ret = input_port_4_r(0); break;
285   case 0x07:  ret = input_port_5_r(0); break;
282   case 0x00:  ret = input_port_0_r(machine, 0); break;
283   case 0x02:  ret = input_port_1_r(machine, 0); break;
284   case 0x03:  ret = input_port_2_r(machine, 0); break;
285   case 0x04:  ret = input_port_3_r(machine, 0); break;
286   case 0x06:  ret = input_port_4_r(machine, 0); break;
287   case 0x07:  ret = input_port_5_r(machine, 0); break;
286288   default:    logerror("%04x : CVS: Reading unmapped input port 0x%02x\n", activecpu_get_pc(), offset & 0x0f); break;
287289   }
288290
r1877r1878
299301
300302static READ8_HANDLER( cvs_393hz_clock_r )
301303{
302     if(cpu_scalebyfcount(6) & 1) return 0x80;
303    else return 0;
304     return cvs_393hz_clock ? 0x80 : 0;
304305}
305306
306307
308static TIMER_CALLBACK( cvs_393hz_timer_cb )
309{
310   cvs_393hz_clock = !cvs_393hz_clock;
311}
307312
313
314static void start_393hz_timer(void)
315{
316   cvs_393hz_timer = timer_alloc(cvs_393hz_timer_cb, NULL);
317   timer_adjust_periodic(cvs_393hz_timer, ATTOTIME_IN_HZ(2*393), 0, ATTOTIME_IN_HZ(2*393));
318}
319
320
321
308322/*************************************
309323 *
310324 *  4-bit DAC
r1877r1878
324338             (cvs_4_bit_dac_data[3] << 3);
325339
326340   /* scale up to a full byte and output */
327   DAC_1_data_w(0, (dac_value << 4) | dac_value);
341   DAC_1_data_w(machine, 0, (dac_value << 4) | dac_value);
328342}
329343
330344
r1877r1878
336350 *************************************/
337351
338352/* temporary code begin */
339static void speech_execute_command(UINT8 command)
353static void speech_execute_command(running_machine *machine, UINT8 command)
340354{
341355   /* reset */
342356   if (command == 0x3f)
343357   {
344      tms5110_CTL_w(0, TMS5110_CMD_RESET);
358      tms5110_CTL_w(machine, 0, TMS5110_CMD_RESET);
345359
346      tms5110_PDC_w(0,0);
347      tms5110_PDC_w(0,1);
348      tms5110_PDC_w(0,0);
360      tms5110_PDC_w(machine, 0,0);
361      tms5110_PDC_w(machine, 0,1);
362      tms5110_PDC_w(machine, 0,0);
349363
350      tms5110_PDC_w(0,0);
351      tms5110_PDC_w(0,1);
352      tms5110_PDC_w(0,0);
364      tms5110_PDC_w(machine, 0,0);
365      tms5110_PDC_w(machine, 0,1);
366      tms5110_PDC_w(machine, 0,0);
353367
354      tms5110_PDC_w(0,0);
355      tms5110_PDC_w(0,1);
356      tms5110_PDC_w(0,0);
368      tms5110_PDC_w(machine, 0,0);
369      tms5110_PDC_w(machine, 0,1);
370      tms5110_PDC_w(machine, 0,0);
357371
358372      speech_rom_bit_address = 0;
359373   }
360374   /* start */
361375   else
362376   {
363      tms5110_CTL_w(0, TMS5110_CMD_SPEAK);
377      tms5110_CTL_w(machine, 0, TMS5110_CMD_SPEAK);
364378
365      tms5110_PDC_w(0, 0);
366      tms5110_PDC_w(0, 1);
367      tms5110_PDC_w(0, 0);
379      tms5110_PDC_w(machine, 0, 0);
380      tms5110_PDC_w(machine, 0, 1);
381      tms5110_PDC_w(machine, 0, 0);
368382
369383      speech_rom_bit_address = command * 0x80 * 8;
370384   }
r1877r1878
385399}
386400
387401
388static void cvs_set_speech_command_w(UINT8 data)
402static void cvs_set_speech_command_w(running_machine *machine, UINT8 data)
389403{
390   soundlatch2_w(0, data & 0x7f);
404   soundlatch2_w(machine, 0, data & 0x7f);
391405   if (~data & 0x40) LOG(("%04x : CVS: Speech Command W = %04x\n", activecpu_get_pc(), data & 0x7f));
392406}
393407
r1877r1878
395409static READ8_HANDLER( cvs_speech_command_r )
396410{
397411   /* bit 7 is TMS status (active LO) */
398   return (~tms5110_status_r(0) << 7) | soundlatch2_r(0);
412   return (~tms5110_status_r(machine, 0) << 7) | soundlatch2_r(machine, 0);
399413}
400414
401415
r1877r1878
456470    /* cause interrupt on audio CPU if bit 7 set */
457471   if (data & 0x80)
458472   {
459         soundlatch_w(0, data);
473         soundlatch_w(machine, 0, data);
460474      cvs_dac_cpu_interrupt();
461475
462476      LOG(("%04x : CVS: Audio command = %02x\n", activecpu_get_pc(), data));
463477   }
464478
465   cvs_set_speech_command_w(data);
479   cvs_set_speech_command_w(machine, data);
466480
467481   /* temporary code begin */
468482   if ((data & 0x40) == 0)
469      speech_execute_command(data & 0x03f);
483      speech_execute_command(machine, data & 0x03f);
470484   /* temporary code end */
471485}
472486
r1877r1878
486500   cvs_character_ram = auto_malloc(3 * 0x800);  /* only half is used, but
487501                                                    by allocating twice the amount,
488502                                                    we can use the same gfx_layout */
503   start_393hz_timer();
504
489505   /* register state save */
490506   state_save_register_global_pointer(cvs_color_ram, 0x400);
491507   state_save_register_global_pointer(cvs_palette_ram, 0x10);
r1877r1878
493509   state_save_register_global(character_banking_mode);
494510   state_save_register_global(character_ram_page_start);
495511   state_save_register_global(speech_rom_bit_address);
512   state_save_register_global(cvs_393hz_clock);
496513}
497514
498515
r1877r1878
9981015   MDRV_CPU_ADD(S2650, 894886.25)
9991016   MDRV_CPU_PROGRAM_MAP(cvs_main_cpu_map,0)
10001017   MDRV_CPU_IO_MAP(cvs_main_cpu_io_map,0)
1001   MDRV_CPU_VBLANK_INT(cvs_main_cpu_interrupt, 1)
1018   MDRV_CPU_VBLANK_INT("main", cvs_main_cpu_interrupt)
10021019
10031020   MDRV_CPU_ADD(S2650, 894886.25)
10041021   MDRV_CPU_PROGRAM_MAP(cvs_dac_cpu_map,0)
src/mame/drivers/turbo.c
r1877r1878
639639
640640static TIMER_CALLBACK( delayed_ppi8255_w )
641641{
642    ppi8255_0_w(param >> 8, param & 0xff);
642    ppi8255_0_w(machine, param >> 8, param & 0xff);
643643}
644644
645645
r1877r1878
10011001   /* basic machine hardware */
10021002   MDRV_CPU_ADD(Z80, MASTER_CLOCK/4)
10031003   MDRV_CPU_PROGRAM_MAP(turbo_map,0)
1004   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1004   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
10051005
10061006   /* video hardware */
10071007   MDRV_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
r1877r1878
10271027   /* basic machine hardware */
10281028   MDRV_CPU_ADD(Z80, MASTER_CLOCK/4)
10291029   MDRV_CPU_PROGRAM_MAP(subroc3d_map,0)
1030   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1030   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
10311031
10321032   /* video hardware */
10331033   MDRV_GFXDECODE(turbo)
r1877r1878
10521052   /* basic machine hardware */
10531053   MDRV_CPU_ADD(Z80, MASTER_CLOCK/4)
10541054   MDRV_CPU_PROGRAM_MAP(buckrog_map,0)
1055   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1055   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
10561056
10571057   MDRV_CPU_ADD(Z80, MASTER_CLOCK/4)
10581058   MDRV_CPU_PROGRAM_MAP(buckrog_cpu2_map,0)
src/mame/drivers/seta.c
r1877r1878
14911491static WRITE16_HANDLER( sub_ctrl_w )
14921492{
14931493   static int old_data = 0;
1494
14951494   switch(offset)
14961495   {
14971496      case 0/2:   // bit 0: reset sub cpu?
r1877r1878
15071506         break;
15081507
15091508      case 4/2:   // not sure
1510         if (ACCESSING_LSB)   soundlatch_w(0, data & 0xff);
1509         if (ACCESSING_LSB)   soundlatch_w(machine, 0, data & 0xff);
15111510         break;
15121511
15131512      case 6/2:   // not sure
1514         if (ACCESSING_LSB)   soundlatch2_w(0, data & 0xff);
1513         if (ACCESSING_LSB)   soundlatch2_w(machine, 0, data & 0xff);
15151514         break;
15161515   }
15171516
r1877r1878
16801679{
16811680   if (ACCESSING_LSB)
16821681   {
1683      soundlatch_word_w(0,data,mem_mask);
1684      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
1682      soundlatch_word_w(machine,0,data,mem_mask);
1683      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
16851684      cpu_spinuntil_time(ATTOTIME_IN_USEC(50));   // Allow the other cpu to reply
16861685   }
16871686}
r1877r1878
24382437      case 1:   offset = 2;   break;
24392438      case 2:   offset = 1;   break;
24402439   }
2441   seta_vregs_w(offset,data,mem_mask);
2440   seta_vregs_w(machine,offset,data,mem_mask);
24422441}
24432442
24442443/* Mirror RAM is necessary or startup, to clear Work RAM after the test */
r1877r1878
25952594
25962595static READ16_HANDLER( kiwame_input_r )
25972596{
2598   int row_select = kiwame_nvram_r( 0x10a/2,0 ) & 0x1f;
2597   int row_select = kiwame_nvram_r( machine,0x10a/2,0 ) & 0x1f;
25992598   int i;
26002599
26012600   for(i = 0; i < 5; i++)
r1877r1878
27632762{
27642763   if (ACCESSING_LSB)
27652764   {
2766      cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
2767      soundlatch_w(0,data & 0xff);
2765      cpunum_set_input_line(machine, 1,0,HOLD_LINE);
2766      soundlatch_w(machine,0,data & 0xff);
27682767   }
27692768}
27702769
r1877r1878
28172816
28182817static WRITE8_HANDLER( sub_bankswitch_lockout_w )
28192818{
2820   sub_bankswitch_w(offset,data);
2819   sub_bankswitch_w(machine,offset,data);
28212820   seta_coin_lockout_w(data);
28222821}
28232822
r1877r1878
29312930
29322931static WRITE8_HANDLER( calibr50_soundlatch2_w )
29332932{
2934   soundlatch2_w(0,data);
2933   soundlatch2_w(machine,0,data);
29352934   cpu_spinuntil_time(ATTOTIME_IN_USEC(50));   // Allow the other cpu to reply
29362935}
29372936
r1877r1878
30653064                            Crazy Fight
30663065***************************************************************************/
30673066
3068static WRITE16_HANDLER( YM3812_control_port_0_lsb_w )   {   if (ACCESSING_LSB)   YM3812_control_port_0_w(0, data & 0xff);   }
3069static WRITE16_HANDLER( YM3812_write_port_0_lsb_w )      {   if (ACCESSING_LSB)   YM3812_write_port_0_w(0, data & 0xff);      }
3067static WRITE16_HANDLER( YM3812_control_port_0_lsb_w )   {   if (ACCESSING_LSB)   YM3812_control_port_0_w(machine, 0, data & 0xff);   }
3068static WRITE16_HANDLER( YM3812_write_port_0_lsb_w )      {   if (ACCESSING_LSB)   YM3812_write_port_0_w(machine, 0, data & 0xff);      }
30703069
30713070static ADDRESS_MAP_START( crazyfgt_map, ADDRESS_SPACE_PROGRAM, 16 )
30723071   AM_RANGE(0x000000, 0x07ffff) AM_ROM
r1877r1878
66866685   /* basic machine hardware */
66876686   MDRV_CPU_ADD(M68000, 16000000/2)   /* 8 MHz */
66886687   MDRV_CPU_PROGRAM_MAP(tndrcade_readmem,tndrcade_writemem)
6689   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
6688   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
66906689
66916690   MDRV_CPU_ADD(M65C02, 16000000/8)   /* 2 MHz */
66926691   MDRV_CPU_PROGRAM_MAP(tndrcade_sub_readmem,tndrcade_sub_writemem)
6693   MDRV_CPU_VBLANK_INT(tndrcade_sub_interrupt,TNDRCADE_SUB_INTERRUPTS_NUM)
6692   MDRV_CPU_VBLANK_INT_HACK(tndrcade_sub_interrupt,TNDRCADE_SUB_INTERRUPTS_NUM)
66946693
66956694   /* video hardware */
66966695   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
67366735   /* basic machine hardware */
67376736   MDRV_CPU_ADD(M68000, 16000000/2)   /* 8 MHz */
67386737   MDRV_CPU_PROGRAM_MAP(downtown_readmem,downtown_writemem)
6739   MDRV_CPU_VBLANK_INT(irq3_line_hold,1)
6738   MDRV_CPU_VBLANK_INT("main", irq3_line_hold)
67406739
67416740   MDRV_CPU_ADD(M65C02, 16000000/8)   /* 2 MHz */
67426741   MDRV_CPU_PROGRAM_MAP(twineagl_sub_readmem,twineagl_sub_writemem)
6743   MDRV_CPU_VBLANK_INT(seta_sub_interrupt,SETA_SUB_INTERRUPTS_NUM)
6742   MDRV_CPU_VBLANK_INT_HACK(seta_sub_interrupt,SETA_SUB_INTERRUPTS_NUM)
67446743
67456744   /* video hardware */
67466745   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
67786777   /* basic machine hardware */
67796778   MDRV_CPU_ADD(M68000, XTAL_16MHz/2) /* verified on pcb */
67806779   MDRV_CPU_PROGRAM_MAP(downtown_readmem,downtown_writemem)
6781   MDRV_CPU_VBLANK_INT(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
6780   MDRV_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
67826781
67836782   MDRV_CPU_ADD(M65C02, XTAL_16MHz/8) /* verified on pcb */
67846783   MDRV_CPU_PROGRAM_MAP(downtown_sub_readmem,downtown_sub_writemem)
6785   MDRV_CPU_VBLANK_INT(seta_sub_interrupt,SETA_SUB_INTERRUPTS_NUM)
6784   MDRV_CPU_VBLANK_INT_HACK(seta_sub_interrupt,SETA_SUB_INTERRUPTS_NUM)
67866785
67876786   /* video hardware */
67886787   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
68386837   /* basic machine hardware */
68396838   MDRV_CPU_ADD(M68000, 16000000/2)   /* 8 MHz */
68406839   MDRV_CPU_PROGRAM_MAP(usclssic_readmem,usclssic_writemem)
6841   MDRV_CPU_VBLANK_INT(calibr50_interrupt,calibr50_INTERRUPTS_NUM)
6840   MDRV_CPU_VBLANK_INT_HACK(calibr50_interrupt,calibr50_INTERRUPTS_NUM)
68426841
68436842   MDRV_CPU_ADD(M65C02, 16000000/8)   /* 2 MHz */
68446843   MDRV_CPU_PROGRAM_MAP(calibr50_sub_readmem,calibr50_sub_writemem)
6845   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   /* NMI caused by main cpu when writing to the sound latch */
6844   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   /* NMI caused by main cpu when writing to the sound latch */
68466845
68476846   /* video hardware */
68486847   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
68836882   /* basic machine hardware */
68846883   MDRV_CPU_ADD(M68000, 16000000/2)   /* 8 MHz */
68856884   MDRV_CPU_PROGRAM_MAP(calibr50_readmem,calibr50_writemem)
6886   MDRV_CPU_VBLANK_INT(calibr50_interrupt,calibr50_INTERRUPTS_NUM)
6885   MDRV_CPU_VBLANK_INT_HACK(calibr50_interrupt,calibr50_INTERRUPTS_NUM)
68876886
68886887   MDRV_CPU_ADD(M65C02, 16000000/8)   /* 2 MHz */
68896888   MDRV_CPU_PROGRAM_MAP(calibr50_sub_readmem,calibr50_sub_writemem)
6890   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)   /* IRQ: 4/frame
6889   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)   /* IRQ: 4/frame
68916890                               NMI: when the 68k writes the sound latch */
68926891
68936892   /* video hardware */
r1877r1878
69256924   /* basic machine hardware */
69266925   MDRV_CPU_ADD(M68000, 16000000/2)   /* 8 MHz */
69276926   MDRV_CPU_PROGRAM_MAP(downtown_readmem,downtown_writemem)
6928   MDRV_CPU_VBLANK_INT(irq3_line_hold,1)
6927   MDRV_CPU_VBLANK_INT("main", irq3_line_hold)
69296928
69306929   MDRV_CPU_ADD(M65C02, 16000000/8)   /* 2 MHz */
69316930   MDRV_CPU_PROGRAM_MAP(metafox_sub_readmem,metafox_sub_writemem)
6932   MDRV_CPU_VBLANK_INT(seta_sub_interrupt,SETA_SUB_INTERRUPTS_NUM)
6931   MDRV_CPU_VBLANK_INT_HACK(seta_sub_interrupt,SETA_SUB_INTERRUPTS_NUM)
69336932
69346933   /* video hardware */
69356934   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
69686967   /* basic machine hardware */
69696968   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
69706969   MDRV_CPU_PROGRAM_MAP(atehate_readmem,atehate_writemem)
6971   MDRV_CPU_VBLANK_INT(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
6970   MDRV_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
69726971
69736972   /* video hardware */
69746973   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
70107009   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
70117010   MDRV_CPU_PROGRAM_MAP(blandia_readmem,blandia_writemem)
70127011
7013   MDRV_CPU_VBLANK_INT(seta_interrupt_2_and_4,SETA_INTERRUPTS_NUM)
7012   MDRV_CPU_VBLANK_INT_HACK(seta_interrupt_2_and_4,SETA_INTERRUPTS_NUM)
70147013
70157014   /* video hardware */
70167015   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
70427041   /* basic machine hardware */
70437042   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
70447043   MDRV_CPU_PROGRAM_MAP(blandiap_readmem,blandiap_writemem)
7045   MDRV_CPU_VBLANK_INT(seta_interrupt_2_and_4,SETA_INTERRUPTS_NUM)
7044   MDRV_CPU_VBLANK_INT_HACK(seta_interrupt_2_and_4,SETA_INTERRUPTS_NUM)
70467045
70477046   /* video hardware */
70487047   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
70797078   /* basic machine hardware */
70807079   MDRV_CPU_ADD(M68000, 16000000/2)   /* 8 MHz */
70817080   MDRV_CPU_PROGRAM_MAP(blockcar_readmem,blockcar_writemem)
7082   MDRV_CPU_VBLANK_INT(irq3_line_hold,1)
7081   MDRV_CPU_VBLANK_INT("main", irq3_line_hold)
70837082
70847083   /* video hardware */
70857084   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
71147113   /* basic machine hardware */
71157114   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
71167115   MDRV_CPU_PROGRAM_MAP(daioh_readmem,daioh_writemem)
7117   MDRV_CPU_VBLANK_INT(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
7116   MDRV_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
71187117
71197118   /* video hardware */
71207119   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
71547153   /* basic machine hardware */
71557154   MDRV_CPU_ADD(M68000, 16000000/2)   /* 8 MHz */
71567155   MDRV_CPU_PROGRAM_MAP(drgnunit_readmem,drgnunit_writemem)
7157   MDRV_CPU_VBLANK_INT(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
7156   MDRV_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
71587157
71597158   /* video hardware */
71607159   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
71887187   /* basic machine hardware */
71897188   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
71907189   MDRV_CPU_PROGRAM_MAP(drgnunit_readmem,drgnunit_writemem)
7191   MDRV_CPU_VBLANK_INT(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
7190   MDRV_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
71927191
71937192   /* video hardware */
71947193   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
72247223   /* basic machine hardware */
72257224   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
72267225   MDRV_CPU_PROGRAM_MAP(wrofaero_readmem,wrofaero_writemem)
7227   MDRV_CPU_VBLANK_INT(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
7226   MDRV_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
72287227
72297228   /* video hardware */
72307229   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
72647263   /* basic machine hardware */
72657264   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
72667265   MDRV_CPU_PROGRAM_MAP(extdwnhl_readmem,extdwnhl_writemem)
7267   MDRV_CPU_VBLANK_INT(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
7266   MDRV_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
72687267
72697268   /* video hardware */
72707269   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
73177316   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
73187317   MDRV_CPU_PROGRAM_MAP(wrofaero_readmem,wrofaero_writemem)
73197318#if   __uPD71054_TIMER
7320//  MDRV_CPU_VBLANK_INT( wrofaero_interrupt, 1 )
7321   MDRV_CPU_VBLANK_INT(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
7319//  MDRV_CPU_VBLANK_INT("main", wrofaero_interrupt)
7320   MDRV_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
73227321#else
7323   MDRV_CPU_VBLANK_INT(seta_interrupt_2_and_4,SETA_INTERRUPTS_NUM)
7322   MDRV_CPU_VBLANK_INT_HACK(seta_interrupt_2_and_4,SETA_INTERRUPTS_NUM)
73247323#endif   // __uPD71054_TIMER
73257324
73267325#if   __uPD71054_TIMER
r1877r1878
73657364   /* basic machine hardware */
73667365   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
73677366   MDRV_CPU_PROGRAM_MAP(wrofaero_readmem,wrofaero_writemem)
7368   MDRV_CPU_VBLANK_INT(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
7367   MDRV_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
73697368
73707369   /* video hardware */
73717370   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
74017400   /* basic machine hardware */
74027401   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
74037402   MDRV_CPU_PROGRAM_MAP(kamenrid_readmem,kamenrid_writemem)
7404   MDRV_CPU_VBLANK_INT( wrofaero_interrupt, 1 )
7403   MDRV_CPU_VBLANK_INT("main", wrofaero_interrupt)
74057404
74067405#if   __uPD71054_TIMER
74077406   MDRV_MACHINE_RESET( wrofaero )
r1877r1878
74417440   /* basic machine hardware */
74427441   MDRV_CPU_ADD(M68000, 14318180/2)   /* 7.143 MHz */
74437442   MDRV_CPU_PROGRAM_MAP(orbs_readmem,orbs_writemem)
7444   MDRV_CPU_VBLANK_INT(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
7443   MDRV_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
74457444
74467445   /* video hardware */
74477446   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
74767475   /* basic machine hardware */
74777476   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
74787477   MDRV_CPU_PROGRAM_MAP(krzybowl_readmem,krzybowl_writemem)
7479   MDRV_CPU_VBLANK_INT(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
7478   MDRV_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
74807479
74817480   /* video hardware */
74827481   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
75127511   /* basic machine hardware */
75137512   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
75147513   MDRV_CPU_PROGRAM_MAP(madshark_readmem,madshark_writemem)
7515   MDRV_CPU_VBLANK_INT( wrofaero_interrupt, 1 )
7514   MDRV_CPU_VBLANK_INT("main", wrofaero_interrupt)
75167515
75177516#if   __uPD71054_TIMER
75187517   MDRV_MACHINE_RESET( wrofaero )
r1877r1878
75557554   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
75567555   MDRV_CPU_PROGRAM_MAP(msgundam_readmem,msgundam_writemem)
75577556#if   __uPD71054_TIMER
7558   MDRV_CPU_VBLANK_INT( wrofaero_interrupt, 1 )
7557   MDRV_CPU_VBLANK_INT("main", wrofaero_interrupt)
75597558#else
7560   MDRV_CPU_VBLANK_INT(seta_interrupt_2_and_4,SETA_INTERRUPTS_NUM)
7559   MDRV_CPU_VBLANK_INT_HACK(seta_interrupt_2_and_4,SETA_INTERRUPTS_NUM)
75617560#endif   // __uPD71054_TIMER
75627561
75637562#if   __uPD71054_TIMER
r1877r1878
75997598   /* basic machine hardware */
76007599   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
76017600   MDRV_CPU_PROGRAM_MAP(oisipuzl_readmem,oisipuzl_writemem)
7602   MDRV_CPU_VBLANK_INT(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
7601   MDRV_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
76037602
76047603   /* video hardware */
76057604   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
76357634   /* basic machine hardware */
76367635   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
76377636   MDRV_CPU_PROGRAM_MAP(triplfun_readmem,triplfun_writemem)
7638   MDRV_CPU_VBLANK_INT(irq3_line_hold,1)
7637   MDRV_CPU_VBLANK_INT("main", irq3_line_hold)
76397638
76407639   /* video hardware */
76417640   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
76697668   /* basic machine hardware */
76707669   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
76717670   MDRV_CPU_PROGRAM_MAP(kiwame_readmem,kiwame_writemem)
7672   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)/* lev 1-7 are the same. WARNING:
7671   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)/* lev 1-7 are the same. WARNING:
76737672                                   the interrupt table is written to. */
76747673
76757674   /* video hardware */
r1877r1878
77087707   /* basic machine hardware */
77097708   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
77107709   MDRV_CPU_PROGRAM_MAP(wrofaero_readmem,wrofaero_writemem)
7711   MDRV_CPU_VBLANK_INT(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
7710   MDRV_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
77127711
77137712   /* video hardware */
77147713   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
77467745   /* basic machine hardware */
77477746   MDRV_CPU_ADD(M68000, 16000000/2)   /* 8 MHz */
77487747   MDRV_CPU_PROGRAM_MAP(thunderl_readmem,thunderl_writemem)
7749   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
7748   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
77507749
77517750   /* video hardware */
77527751   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
77777776   /* basic machine hardware */
77787777   MDRV_CPU_ADD(M68000, 16000000/2)   /* 8 MHz */
77797778   MDRV_CPU_PROGRAM_MAP(thunderl_readmem,thunderl_writemem)
7780   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
7779   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
77817780
77827781   MDRV_CPU_ADD(Z80, 16000000/4)   /* 4 MHz */
77837782   MDRV_CPU_PROGRAM_MAP(wiggie_sound_readmem,wiggie_sound_writemem)
r1877r1878
78107809   /* basic machine hardware */
78117810   MDRV_CPU_ADD(M68000, 16000000/2)   /* 8 MHz */
78127811   MDRV_CPU_PROGRAM_MAP(thunderl_readmem,thunderl_writemem)
7813   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
7812   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
78147813
78157814   /* video hardware */
78167815   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
78467845   /* basic machine hardware */
78477846   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
78487847   MDRV_CPU_PROGRAM_MAP(umanclub_readmem,umanclub_writemem)
7849   MDRV_CPU_VBLANK_INT(irq3_line_hold,1)
7848   MDRV_CPU_VBLANK_INT("main", irq3_line_hold)
78507849
78517850   /* video hardware */
78527851   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
78817880   /* basic machine hardware */
78827881   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
78837882   MDRV_CPU_PROGRAM_MAP(utoukond_readmem,utoukond_writemem)
7884   MDRV_CPU_VBLANK_INT(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
7883   MDRV_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
78857884
78867885   MDRV_CPU_ADD(Z80, 16000000/4)   /* 4 MHz */
78877886   /* audio CPU */
r1877r1878
79277926   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
79287927   MDRV_CPU_PROGRAM_MAP(wrofaero_readmem,wrofaero_writemem)
79297928#if   __uPD71054_TIMER
7930   MDRV_CPU_VBLANK_INT( wrofaero_interrupt, 1 )
7929   MDRV_CPU_VBLANK_INT("main", wrofaero_interrupt)
79317930#else
7932   MDRV_CPU_VBLANK_INT(seta_interrupt_2_and_4,SETA_INTERRUPTS_NUM)
7931   MDRV_CPU_VBLANK_INT_HACK(seta_interrupt_2_and_4,SETA_INTERRUPTS_NUM)
79337932#endif   // __uPD71054_TIMER
79347933
79357934#if   __uPD71054_TIMER
r1877r1878
79767975   /* basic machine hardware */
79777976   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
79787977   MDRV_CPU_PROGRAM_MAP(wrofaero_readmem,wrofaero_writemem)
7979   MDRV_CPU_VBLANK_INT(irq3_line_hold,1)
7978   MDRV_CPU_VBLANK_INT("main", irq3_line_hold)
79807979
79817980   /* video hardware */
79827981   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
80118010   /* basic machine hardware */
80128011   MDRV_CPU_ADD(M68000, 16000000/2)   /* 8 MHz */
80138012   MDRV_CPU_PROGRAM_MAP(pairlove_readmem,pairlove_writemem)
8014   MDRV_CPU_VBLANK_INT(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
8013   MDRV_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM)
80158014
80168015   /* video hardware */
80178016   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
80558054   /* basic machine hardware */
80568055   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
80578056   MDRV_CPU_PROGRAM_MAP(crazyfgt_map,0)
8058   MDRV_CPU_VBLANK_INT(crazyfgt_interrupt,1+5)
8057   MDRV_CPU_VBLANK_INT_HACK(crazyfgt_interrupt,1+5)
80598058
80608059   /* video hardware */
80618060   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
81148113   /* basic machine hardware */
81158114   MDRV_CPU_ADD(M68000, 16000000)
81168115   MDRV_CPU_PROGRAM_MAP(inttoote_map,0)
8117   MDRV_CPU_VBLANK_INT(inttoote_interrupt,8+1+1+1)
8116   MDRV_CPU_VBLANK_INT_HACK(inttoote_interrupt,8+1+1+1)
81188117
81198118   /* video hardware */
81208119   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
95179516GAME( 1987, tndrcade, 0,        tndrcade, tndrcade, 0,        ROT270, "[Seta] (Taito license)", "Thundercade / Twin Formation" , 0) // Title/License: DSW
95189517GAME( 1987, tndrcadj, tndrcade, tndrcade, tndrcadj, 0,        ROT270, "[Seta] (Taito license)", "Tokusyu Butai U.A.G. (Japan)" , 0) // License: DSW
95199518GAME( 1988, twineagl, 0,        twineagl, twineagl, twineagl, ROT270, "Seta (Taito license)",   "Twin Eagle - Revenge Joe's Brother" , 0) // Country/License: DSW
9520GAME( 1989, downtown, 0,        downtown, downtown, downtown, ROT270, "Seta",                   "DownTown (Set 1)" , 0) // Country/License: DSW
9521GAME( 1989, downtow2, downtown, downtown, downtown, downtown, ROT270, "Seta",                   "DownTown (Set 2)" , 0) // Country/License: DSW
9522GAME( 1989, downtowp, downtown, downtown, downtown, downtown, ROT270, "Seta",                   "DownTown (prototype)" , 0) // Country/License: DSW
9519GAME( 1989, downtown, 0,        downtown, downtown, downtown, ROT270, "Seta",                   "DownTown / Mokugeki (Set 1)" , 0) // Country/License: DSW
9520GAME( 1989, downtow2, downtown, downtown, downtown, downtown, ROT270, "Seta",                   "DownTown / Mokugeki (Set 2)" , 0) // Country/License: DSW
9521GAME( 1989, downtowp, downtown, downtown, downtown, downtown, ROT270, "Seta",                   "DownTown / Mokugeki (prototype)" , 0) // Country/License: DSW
95239522GAME( 1989, usclssic, 0,        usclssic, usclssic, 0,        ROT270, "Seta",                   "U.S. Classic" , 0) // Country/License: DSW
95249523GAME( 1989, calibr50, 0,        calibr50, calibr50, 0,        ROT270, "Athena / Seta",          "Caliber 50" , 0) // Country/License: DSW
95259524GAME( 1989, arbalest, 0,        metafox,  arbalest, arbalest, ROT270, "Seta",                   "Arbalester" , 0) // Country/License: DSW
src/mame/drivers/truco.c
r1877r1878
151151   MDRV_CPU_ADD(M6809, 750000)        /* ?? guess */
152152   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
153153
154   MDRV_CPU_VBLANK_INT(truco_interrupt,1)
154   MDRV_CPU_VBLANK_INT("main", truco_interrupt)
155155
156156   MDRV_MACHINE_RESET(truco)
157157
src/mame/drivers/laserbat.c
r1877r1878
516516static VIDEO_UPDATE( laserbat )
517517{
518518   int y;
519   mame_bitmap *s2636_0_bitmap;
520   mame_bitmap *s2636_1_bitmap;
521   mame_bitmap *s2636_2_bitmap;
519   bitmap_t *s2636_0_bitmap;
520   bitmap_t *s2636_1_bitmap;
521   bitmap_t *s2636_2_bitmap;
522522
523523   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
524524
r1877r1878
599599static READ8_HANDLER( zaccaria_port0a_r )
600600{
601601   if (active_8910 == 0)
602      return AY8910_read_port_0_r(0);
602      return AY8910_read_port_0_r(machine,0);
603603   else
604      return AY8910_read_port_1_r(0);
604      return AY8910_read_port_1_r(machine,0);
605605}
606606
607607static WRITE8_HANDLER( zaccaria_port0a_w )
r1877r1878
619619   {
620620      /* bit 0 goes to the 8910 #0 BC1 pin */
621621      if (last & 0x01)
622         AY8910_control_port_0_w(0,port0a);
622         AY8910_control_port_0_w(machine,0,port0a);
623623      else
624         AY8910_write_port_0_w(0,port0a);
624         AY8910_write_port_0_w(machine,0,port0a);
625625   }
626626   else if ((last & 0x02) == 0x00 && (data & 0x02) == 0x02)
627627   {
r1877r1878
634634   {
635635      /* bit 2 goes to the 8910 #1 BC1 pin */
636636      if (last & 0x04)
637         AY8910_control_port_1_w(0,port0a);
637         AY8910_control_port_1_w(machine,0,port0a);
638638      else
639         AY8910_write_port_1_w(0,port0a);
639         AY8910_write_port_1_w(machine,0,port0a);
640640   }
641641   else if ((last & 0x08) == 0x00 && (data & 0x08) == 0x08)
642642   {
r1877r1878
683683{
684684   static int toggle;
685685
686   pia_0_cb1_w(0,toggle & 1);
686   pia_0_cb1_w(machine,0,toggle & 1);
687687   toggle ^= 1;
688688}
689689
r1877r1878
693693   MDRV_CPU_ADD(S2650, 14318180/4) // ???
694694   MDRV_CPU_PROGRAM_MAP(laserbat_map,0)
695695   MDRV_CPU_IO_MAP(laserbat_io_map,0)
696   MDRV_CPU_VBLANK_INT(laserbat_interrupt,1)
696   MDRV_CPU_VBLANK_INT("main", laserbat_interrupt)
697697
698698   /* video hardware */
699699   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
727727   MDRV_CPU_ADD(S2650, 14318000/4)   /* ? */
728728   MDRV_CPU_PROGRAM_MAP(laserbat_map,0)
729729   MDRV_CPU_IO_MAP(catnmous_io_map,0)
730   MDRV_CPU_VBLANK_INT(laserbat_interrupt,1)
730   MDRV_CPU_VBLANK_INT("main", laserbat_interrupt)
731731
732732   MDRV_CPU_ADD(M6802,3580000) /* ? */
733733   MDRV_CPU_PROGRAM_MAP(catnmous_sound_map,0)
src/mame/drivers/trvquest.c
r1877r1878
196196
197197static INTERRUPT_GEN( trvquest_interrupt )
198198{
199   via_2_ca1_w(0,1);
200   via_2_ca1_w(0,0);
199   via_2_ca1_w(machine,0,1);
200   via_2_ca1_w(machine,0,0);
201201}
202202
203203static MACHINE_DRIVER_START( trvquest )
r1877r1878
206206
207207   MDRV_CPU_ADD(M6809,6000000)
208208   MDRV_CPU_PROGRAM_MAP(cpu_map,0)
209   MDRV_CPU_VBLANK_INT(trvquest_interrupt,1)
209   MDRV_CPU_VBLANK_INT("main", trvquest_interrupt)
210210
211211   MDRV_NVRAM_HANDLER(generic_1fill)
212212   MDRV_MACHINE_START(trvquest)
src/mame/drivers/tnzs.c
r1877r1878
343343{
344344   // to avoid the write when the sound chip is initialized
345345   if(data != 0xff)
346      DAC_0_data_w(0, data );
346      DAC_0_data_w(machine, 0, data);
347347}
348348
349349static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
435435
436436static WRITE8_HANDLER( tnzsb_sound_command_w )
437437{
438   soundlatch_w(offset,data);
439   cpunum_set_input_line_and_vector(Machine, 2,0,HOLD_LINE,0xff);
438   soundlatch_w(machine,offset,data);
439   cpunum_set_input_line_and_vector(machine, 2,0,HOLD_LINE,0xff);
440440}
441441
442442static ADDRESS_MAP_START( tnzsb_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
12921292   /* basic machine hardware */
12931293   MDRV_CPU_ADD(Z80, XTAL_12MHz/2)   /* verified on pcb */
12941294   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
1295   MDRV_CPU_VBLANK_INT(arknoid2_interrupt,1)
1295   MDRV_CPU_VBLANK_INT("main", arknoid2_interrupt)
12961296
12971297   MDRV_CPU_ADD(Z80, XTAL_12MHz/2)   /* verified on pcb */
12981298   MDRV_CPU_PROGRAM_MAP(sub_readmem,sub_writemem)
1299   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1299   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
13001300
13011301   MDRV_INTERLEAVE(100)
13021302
r1877r1878
13311331   /* basic machine hardware */
13321332   MDRV_CPU_ADD(Z80,XTAL_12MHz/2)      /* 6.0 MHz ??? - Main board Crystal is 12MHz */
13331333   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
1334   MDRV_CPU_VBLANK_INT(arknoid2_interrupt,1)
1334   MDRV_CPU_VBLANK_INT("main", arknoid2_interrupt)
13351335
13361336   MDRV_CPU_ADD(Z80,XTAL_12MHz/2)      /* 6.0 MHz ??? - Main board Crystal is 12MHz */
13371337   MDRV_CPU_PROGRAM_MAP(sub_readmem,sub_writemem)
1338   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1338   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
13391339
13401340   MDRV_INTERLEAVE(100)
13411341
r1877r1878
13701370   /* basic machine hardware */
13711371   MDRV_CPU_ADD(Z80,XTAL_12MHz/2)      /* 6.0 MHz ??? - Main board Crystal is 12MHz */
13721372   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
1373   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1373   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
13741374
13751375   MDRV_CPU_ADD(Z80,XTAL_12MHz/2)      /* 6.0 MHz ??? - Main board Crystal is 12MHz */
13761376   MDRV_CPU_PROGRAM_MAP(sub_readmem,sub_writemem)
1377   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1377   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
13781378
13791379   MDRV_CPU_ADD(I8X41,12000000/2)   /* 400KHz ??? - Main board Crystal is 12MHz */
13801380   MDRV_CPU_PROGRAM_MAP(i8742_readmem,i8742_writemem)
r1877r1878
14121412   /* basic machine hardware */
14131413   MDRV_CPU_ADD(Z80, XTAL_12MHz/2)   /* verified on pcb */
14141414   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
1415   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1415   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
14161416
14171417   MDRV_CPU_ADD(Z80, XTAL_12MHz/2)   /* verified on pcb */
14181418   MDRV_CPU_PROGRAM_MAP(sub_readmem,sub_writemem)
1419   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1419   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
14201420
14211421   MDRV_INTERLEAVE(100)
14221422
r1877r1878
14501450   /* basic machine hardware */
14511451   MDRV_CPU_ADD(Z80, XTAL_12MHz/2) /* verified on pcb */
14521452   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
1453   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1453   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
14541454
14551455   MDRV_CPU_ADD(Z80, XTAL_12MHz/2) /* verified on pcb */
14561456   MDRV_CPU_PROGRAM_MAP(kageki_sub_readmem,kageki_sub_writemem)
1457   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1457   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
14581458
14591459   MDRV_INTERLEAVE(100)
14601460
r1877r1878
14951495   /* basic machine hardware */
14961496   MDRV_CPU_ADD_TAG("cpu0", Z80, XTAL_12MHz/2) /* verified on pcb */
14971497   MDRV_CPU_PROGRAM_MAP(cpu0_type2,0)
1498   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1498   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
14991499
15001500   MDRV_CPU_ADD_TAG("cpu1", Z80, XTAL_12MHz/2) /* verified on pcb */
15011501   MDRV_CPU_PROGRAM_MAP(tnzsb_cpu1_map,0)
1502   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1502   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
15031503
15041504   MDRV_CPU_ADD_TAG("cpu2", Z80, XTAL_12MHz/2) /* verified on pcb */
15051505   MDRV_CPU_PROGRAM_MAP(tnzsb_cpu2_map,0)
src/mame/drivers/tp84.c
r1877r1878
44
55driver by Marc Lafontaine
66
7TODO:
8- the slave CPU multiplexes sprites. We are cheating now, and reading them
9  from somewhere else.
107
11
12The schematics are available on the net.
13
14There is 3 CPU for this game.
15 Two 68A09E for the game.
16 A Z80A for the sound
17
18As I understand it, the second 6809 is for displaying
19 the sprites. If we do not emulate him, all work well, except
20 that the player cannot die.
21 Address 57ff must read 0 to pass the RAM test if the second CPU
22 is not emulated.
23
24
258---- Master 6809 ------
269
2710Write
r1877r1878
5740
5841------ Slave 6809 --------
5942 0000-1fff SAFR Watch dog ?
60 2000      seem to be the beam position (if always 0, no player collision is detected)
43 2000      beam position
6144 4000      enable or reset IRQ
6245 6000-67ff DRA
6346 8000-87ff Ram (Common for the Master and Slave 6809)
r1877r1878
8770#include "sound/flt_rc.h"
8871
8972
90extern UINT8 *tp84_videoram2, *tp84_colorram2;
73extern UINT8 *tp84_bg_videoram;
74extern UINT8 *tp84_bg_colorram;
75extern UINT8 *tp84_fg_videoram;
76extern UINT8 *tp84_fg_colorram;
77extern UINT8 *tp84_spriteram;
78extern UINT8 *tp84_scroll_x;
79extern UINT8 *tp84_scroll_y;
80extern UINT8 *tp84_palette_bank;
81extern UINT8 *tp84_flipscreen_x;
82extern UINT8 *tp84_flipscreen_y;
9183
92WRITE8_HANDLER( tp84_videoram_w );
93WRITE8_HANDLER( tp84_colorram_w );
94WRITE8_HANDLER( tp84_videoram2_w );
95WRITE8_HANDLER( tp84_colorram2_w );
96WRITE8_HANDLER( tp84_scroll_x_w );
97WRITE8_HANDLER( tp84_scroll_y_w );
98WRITE8_HANDLER( tp84_flipscreen_x_w );
99WRITE8_HANDLER( tp84_flipscreen_y_w );
100WRITE8_HANDLER( tp84_col0_w );
84WRITE8_HANDLER( tp84_spriteram_w );
10185READ8_HANDLER( tp84_scanline_r );
10286
10387PALETTE_INIT( tp84 );
10488VIDEO_START( tp84 );
10589VIDEO_UPDATE( tp84 );
10690
107INTERRUPT_GEN( tp84_6809_interrupt );
10891
10992
110
11193static READ8_HANDLER( tp84_sh_timer_r )
11294{
11395   /* main xtal 14.318MHz, divided by 4 to get the CPU clock, further */
r1877r1878
11799   return (activecpu_gettotalcycles() / (2048/2)) & 0x0f;
118100}
119101
102
120103static WRITE8_HANDLER( tp84_filter_w )
121104{
122105   int C;
r1877r1878
151134
152135
153136
154/* CPU 1 read addresses */
155static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
156   AM_RANGE(0x2800, 0x2800) AM_READ(input_port_0_r)
137static ADDRESS_MAP_START( tp84_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
138   AM_RANGE(0x2000, 0x2000) AM_WRITE(watchdog_reset_w)
139   AM_RANGE(0x2800, 0x2800) AM_READWRITE(input_port_0_r, MWA8_RAM) AM_BASE(&tp84_palette_bank)
157140   AM_RANGE(0x2820, 0x2820) AM_READ(input_port_1_r)
158141   AM_RANGE(0x2840, 0x2840) AM_READ(input_port_2_r)
159142   AM_RANGE(0x2860, 0x2860) AM_READ(input_port_3_r)
160   AM_RANGE(0x3000, 0x3000) AM_READ(input_port_4_r)
161   AM_RANGE(0x4000, 0x4fff) AM_READ(MRA8_RAM)
162   AM_RANGE(0x5000, 0x57ff) AM_READ(MRA8_RAM) AM_SHARE(1)
163   AM_RANGE(0x8000, 0xffff) AM_READ(MRA8_ROM)
164ADDRESS_MAP_END
165
166/* CPU 1 write addresses */
167static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
168   AM_RANGE(0x2000, 0x2000) AM_WRITE(watchdog_reset_w)
169   AM_RANGE(0x2800, 0x2800) AM_WRITE(tp84_col0_w)
170   AM_RANGE(0x3000, 0x3000) AM_WRITE(MWA8_RAM)
171   AM_RANGE(0x3004, 0x3004) AM_WRITE(tp84_flipscreen_x_w)
172   AM_RANGE(0x3005, 0x3005) AM_WRITE(tp84_flipscreen_y_w)
143   AM_RANGE(0x3000, 0x3000) AM_READWRITE(input_port_4_r, MWA8_RAM)
144   AM_RANGE(0x3004, 0x3004) AM_WRITE(MWA8_RAM) AM_BASE(&tp84_flipscreen_x)
145   AM_RANGE(0x3005, 0x3005) AM_WRITE(MWA8_RAM) AM_BASE(&tp84_flipscreen_y)
173146   AM_RANGE(0x3800, 0x3800) AM_WRITE(tp84_sh_irqtrigger_w)
174147   AM_RANGE(0x3a00, 0x3a00) AM_WRITE(soundlatch_w)
175   AM_RANGE(0x3c00, 0x3c00) AM_WRITE(tp84_scroll_x_w)
176   AM_RANGE(0x3e00, 0x3e00) AM_WRITE(tp84_scroll_y_w)
177   AM_RANGE(0x4000, 0x43ff) AM_WRITE(tp84_videoram_w) AM_BASE(&videoram)
178   AM_RANGE(0x4400, 0x47ff) AM_WRITE(tp84_videoram2_w) AM_BASE(&tp84_videoram2)
179   AM_RANGE(0x4800, 0x4bff) AM_WRITE(tp84_colorram_w) AM_BASE(&colorram)
180   AM_RANGE(0x4c00, 0x4fff) AM_WRITE(tp84_colorram2_w) AM_BASE(&tp84_colorram2)
181   AM_RANGE(0x5000, 0x57ff) AM_WRITE(MWA8_RAM) AM_SHARE(1)
182   AM_RANGE(0x8000, 0xffff) AM_WRITE(MWA8_ROM)
148   AM_RANGE(0x3c00, 0x3c00) AM_WRITE(MWA8_RAM) AM_BASE(&tp84_scroll_x)
149   AM_RANGE(0x3e00, 0x3e00) AM_WRITE(MWA8_RAM) AM_BASE(&tp84_scroll_y)
150   AM_RANGE(0x4000, 0x43ff) AM_RAM AM_BASE(&tp84_bg_videoram)
151   AM_RANGE(0x4400, 0x47ff) AM_RAM AM_BASE(&tp84_fg_videoram)
152   AM_RANGE(0x4800, 0x4bff) AM_RAM AM_BASE(&tp84_bg_colorram)
153   AM_RANGE(0x4c00, 0x4fff) AM_RAM AM_BASE(&tp84_fg_colorram)
154   AM_RANGE(0x5000, 0x57ff) AM_RAM AM_SHARE(1)
155   AM_RANGE(0x8000, 0xffff) AM_ROM
183156ADDRESS_MAP_END
184157
185158static ADDRESS_MAP_START( tp84b_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
186   AM_RANGE(0x0000, 0x03ff) AM_RAM AM_WRITE(tp84_videoram_w) AM_BASE(&videoram)
187   AM_RANGE(0x0400, 0x07ff) AM_RAM AM_WRITE(tp84_videoram2_w) AM_BASE(&tp84_videoram2)
188   AM_RANGE(0x0800, 0x0bff) AM_RAM AM_WRITE(tp84_colorram_w) AM_BASE(&colorram)
189   AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_WRITE(tp84_colorram2_w) AM_BASE(&tp84_colorram2)
159   AM_RANGE(0x0000, 0x03ff) AM_RAM AM_BASE(&tp84_bg_videoram)
160   AM_RANGE(0x0400, 0x07ff) AM_RAM AM_BASE(&tp84_fg_videoram)
161   AM_RANGE(0x0800, 0x0bff) AM_RAM AM_BASE(&tp84_bg_colorram)
162   AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_BASE(&tp84_fg_colorram)
190163   AM_RANGE(0x1000, 0x17ff) AM_RAM AM_SHARE(1)
191164   AM_RANGE(0x1800, 0x1800) AM_WRITE(watchdog_reset_w)
192   AM_RANGE(0x1a00, 0x1a00) AM_READWRITE(input_port_0_r, tp84_col0_w)
165   AM_RANGE(0x1a00, 0x1a00) AM_READWRITE(input_port_0_r, MWA8_RAM) AM_BASE(&tp84_palette_bank)
193166   AM_RANGE(0x1a20, 0x1a20) AM_READ(input_port_1_r)
194167   AM_RANGE(0x1a40, 0x1a40) AM_READ(input_port_2_r)
195168   AM_RANGE(0x1a60, 0x1a60) AM_READ(input_port_3_r)
196169   AM_RANGE(0x1c00, 0x1c00) AM_READWRITE(input_port_4_r, MWA8_NOP)
197   AM_RANGE(0x1c04, 0x1c04) AM_WRITE(tp84_flipscreen_x_w)
198   AM_RANGE(0x1c05, 0x1c05) AM_WRITE(tp84_flipscreen_y_w)
170   AM_RANGE(0x1c04, 0x1c04) AM_WRITE(MWA8_RAM) AM_BASE(&tp84_flipscreen_x)
171   AM_RANGE(0x1c05, 0x1c05) AM_WRITE(MWA8_RAM) AM_BASE(&tp84_flipscreen_y)
199172   AM_RANGE(0x1e00, 0x1e00) AM_WRITE(tp84_sh_irqtrigger_w)
200173   AM_RANGE(0x1e80, 0x1e80) AM_WRITE(soundlatch_w)
201   AM_RANGE(0x1f00, 0x1f00) AM_WRITE(tp84_scroll_x_w)
202   AM_RANGE(0x1f80, 0x1f80) AM_WRITE(tp84_scroll_y_w)
174   AM_RANGE(0x1f00, 0x1f00) AM_WRITE(MWA8_RAM) AM_BASE(&tp84_scroll_x)
175   AM_RANGE(0x1f80, 0x1f80) AM_WRITE(MWA8_RAM) AM_BASE(&tp84_scroll_y)
203176   AM_RANGE(0x8000, 0xffff) AM_ROM
204177ADDRESS_MAP_END
205178
206179
207/* CPU 2 read addresses */
208static ADDRESS_MAP_START( readmem_cpu2, ADDRESS_SPACE_PROGRAM, 8 )
209//  AM_RANGE(0x0000, 0x0000) AM_READ(MRA8_RAM)
180static ADDRESS_MAP_START( cpu2_map, ADDRESS_SPACE_PROGRAM, 8 )
181//  AM_RANGE(0x0000, 0x0000) AM_RAM /* Watch dog ?*/
210182   AM_RANGE(0x2000, 0x2000) AM_READ(tp84_scanline_r) /* beam position */
211   AM_RANGE(0x6000, 0x67ff) AM_READ(MRA8_RAM)
212   AM_RANGE(0x8000, 0x87ff) AM_READ(MRA8_RAM) AM_SHARE(1)
213   AM_RANGE(0xe000, 0xffff) AM_READ(MRA8_ROM)
183   AM_RANGE(0x4000, 0x4000) AM_WRITE(interrupt_enable_w)
184   AM_RANGE(0x6000, 0x679f) AM_RAM
185   AM_RANGE(0x67a0, 0x67ff) AM_READWRITE(MRA8_RAM, tp84_spriteram_w) AM_BASE(&tp84_spriteram)
186   AM_RANGE(0x8000, 0x87ff) AM_RAM AM_SHARE(1)
187   AM_RANGE(0xe000, 0xffff) AM_ROM
214188ADDRESS_MAP_END
215189
216/* CPU 2 write addresses */
217static ADDRESS_MAP_START( writemem_cpu2, ADDRESS_SPACE_PROGRAM, 8 )
218//  AM_RANGE(0x0000, 0x0000) AM_WRITE(MWA8_RAM) /* Watch dog ?*/
219   AM_RANGE(0x4000, 0x4000) AM_WRITE(interrupt_enable_w) /* IRQ enable */
220   AM_RANGE(0x6000, 0x679f) AM_WRITE(MWA8_RAM)
221   AM_RANGE(0x67a0, 0x67ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)   /* REAL (multiplexed) */
222   AM_RANGE(0x8000, 0x87ff) AM_WRITE(MWA8_RAM) AM_SHARE(1)
223   AM_RANGE(0xe000, 0xffff) AM_WRITE(MWA8_ROM)
224ADDRESS_MAP_END
225190
226
227static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
228   AM_RANGE(0x0000, 0x3fff) AM_READ(MRA8_ROM)
229   AM_RANGE(0x4000, 0x43ff) AM_READ(MRA8_RAM)
191static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 )
192   AM_RANGE(0x0000, 0x3fff) AM_ROM
193   AM_RANGE(0x4000, 0x43ff) AM_RAM
230194   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
231195   AM_RANGE(0x8000, 0x8000) AM_READ(tp84_sh_timer_r)
232ADDRESS_MAP_END
233
234static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
235   AM_RANGE(0x0000, 0x3fff) AM_WRITE(MWA8_ROM)
236   AM_RANGE(0x4000, 0x43ff) AM_WRITE(MWA8_RAM)
237196   AM_RANGE(0xa000, 0xa1ff) AM_WRITE(tp84_filter_w)
238197   AM_RANGE(0xc000, 0xc000) AM_WRITE(MWA8_NOP)
239198   AM_RANGE(0xc001, 0xc001) AM_WRITE(SN76496_0_w)
r1877r1878
436395   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
437396   16*8
438397};
398
439399static const gfx_layout spritelayout =
440400{
441401   16,16,
r1877r1878
460420
461421   /* basic machine hardware */
462422   MDRV_CPU_ADD_TAG("cpu1",M6809, XTAL_18_432MHz/12) /* verified on pcb */
463   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
464   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
423   MDRV_CPU_PROGRAM_MAP(tp84_cpu1_map,0)
424   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
465425
466426   MDRV_CPU_ADD(M6809, XTAL_18_432MHz/12)   /* verified on pcb */
467   MDRV_CPU_PROGRAM_MAP(readmem_cpu2,writemem_cpu2)
468   MDRV_CPU_VBLANK_INT(tp84_6809_interrupt,256)
427   MDRV_CPU_PROGRAM_MAP(cpu2_map,0)
428   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
469429
470   MDRV_CPU_ADD(Z80,XTAL_14_31818MHz/4) /* verified on pcb */
471430   /* audio CPU */
472   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
431   MDRV_CPU_ADD(Z80,XTAL_14_31818MHz/4) /* verified on pcb */
432   MDRV_CPU_PROGRAM_MAP(audio_map,0)
473433
474434   MDRV_INTERLEAVE(100)   /* 100 CPU slices per frame - an high value to ensure proper */
475435                     /* synchronization of the CPUs */
476
477436   /* video hardware */
478437   MDRV_SCREEN_ADD("main", RASTER)
479438   MDRV_SCREEN_REFRESH_RATE(60)
r1877r1878
489448   MDRV_VIDEO_START(tp84)
490449   MDRV_VIDEO_UPDATE(tp84)
491450
492   /* sound hardware */
451   /* audio hardware */
493452   MDRV_SPEAKER_STANDARD_MONO("mono")
494453
495454   MDRV_SOUND_ADD(SN76489A, XTAL_14_31818MHz/8) /* verified on pcb */
r1877r1878
611570ROM_END
612571
613572
614GAME( 1984, tp84,  0,    tp84,  tp84, 0, ROT90, "Konami", "Time Pilot '84 (set 1)", 0 )
615GAME( 1984, tp84a, tp84, tp84,  tp84a,0, ROT90, "Konami", "Time Pilot '84 (set 2)", 0 )
616GAME( 1984, tp84b, tp84, tp84b, tp84, 0, ROT90, "Konami", "Time Pilot '84 (set 3)", 0 )
573GAME( 1984, tp84,  0,    tp84,  tp84, 0, ROT90, "Konami", "Time Pilot '84 (set 1)", GAME_SUPPORTS_SAVE )
574GAME( 1984, tp84a, tp84, tp84,  tp84a,0, ROT90, "Konami", "Time Pilot '84 (set 2)", GAME_SUPPORTS_SAVE )
575GAME( 1984, tp84b, tp84, tp84b, tp84, 0, ROT90, "Konami", "Time Pilot '84 (set 3)", GAME_SUPPORTS_SAVE )
src/mame/drivers/rohga.c
r1877r1878
817817   /* basic machine hardware */
818818   MDRV_CPU_ADD(M68000, 14000000)
819819   MDRV_CPU_PROGRAM_MAP(rohga_readmem,rohga_writemem)
820   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
820   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
821821
822822   MDRV_CPU_ADD(H6280,32220000/4/3) /* verified on pcb (8.050Mhz is XIN on pin 10 of H6280 */
823823   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
r1877r1878
862862   /* basic machine hardware */
863863   MDRV_CPU_ADD(M68000, 14000000)
864864   MDRV_CPU_PROGRAM_MAP(wizdfire_readmem,wizdfire_writemem)
865   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
865   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
866866
867867   MDRV_CPU_ADD(H6280,32220000/4/3) /* verified on pcb (8.050Mhz is XIN on pin 10 of H6280 */
868868   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
r1877r1878
907907   /* basic machine hardware */
908908   MDRV_CPU_ADD(M68000, 14000000)
909909   MDRV_CPU_PROGRAM_MAP(nitrobal_readmem,nitrobal_writemem)
910   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
910   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
911911
912912   MDRV_CPU_ADD(H6280,32220000/4/3) /* verified on pcb (8.050Mhz is XIN on pin 10 of H6280 */
913913   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
r1877r1878
952952   /* basic machine hardware */
953953   MDRV_CPU_ADD(M68000, 14000000)
954954   MDRV_CPU_PROGRAM_MAP(schmeisr_readmem,schmeisr_writemem)
955   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
955   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
956956
957957   MDRV_CPU_ADD(H6280,32220000/4/3) /* verified on pcb (8.050Mhz is XIN on pin 10 of H6280 */
958958   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
src/mame/drivers/vball.c
r1877r1878
143143
144144
145145static WRITE8_HANDLER( cpu_sound_command_w ) {
146   soundlatch_w( offset, data );
147   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE );
146   soundlatch_w( machine, offset, data );
147   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE );
148148}
149149
150150
r1877r1878
402402   /* basic machine hardware */
403403    MDRV_CPU_ADD(M6502, 2000000)   /* 2 MHz - measured by guru but it makes the game far far too slow ?! */
404404   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
405   MDRV_CPU_VBLANK_INT(vball_interrupt,32)   /* ??1 IRQ every 8 visible scanlines, plus NMI for vblank?? */
405   MDRV_CPU_VBLANK_INT_HACK(vball_interrupt,32)   /* ??1 IRQ every 8 visible scanlines, plus NMI for vblank?? */
406406
407407   MDRV_CPU_ADD(Z80, 3579545)
408408   /* audio CPU */   /* 3.579545 MHz */
r1877r1878
441441   /* basic machine hardware */
442442    MDRV_CPU_ADD(M6502, 2000000)   /* 2.0 MHz */
443443   MDRV_CPU_PROGRAM_MAP(vball2pj_readmem,writemem)
444   MDRV_CPU_VBLANK_INT(vball_interrupt,32)   /* ??1 IRQ every 8 visible scanlines, plus NMI for vblank?? */
444   MDRV_CPU_VBLANK_INT_HACK(vball_interrupt,32)   /* ??1 IRQ every 8 visible scanlines, plus NMI for vblank?? */
445445
446446   MDRV_CPU_ADD(Z80, 3579545)
447447   /* audio CPU */   /* 3.579545 MHz */
src/mame/drivers/higemaru.c
r1877r1878
175175   /* basic machine hardware */
176176   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz ? Main xtal is 12MHz */
177177   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
178   MDRV_CPU_VBLANK_INT(higemaru_interrupt,2)
178   MDRV_CPU_VBLANK_INT_HACK(higemaru_interrupt,2)
179179
180180   /* video hardware */
181181   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/plygonet.c
r1877r1878
110110      return (readinputport(0)<<24);
111111   }
112112
113   /* FIXME: code will never execute */
114#if 0
113115   logerror("unk access to eeprom port (mask %x)\n", mem_mask);
114116   return 0;
117#endif
115118}
116119
117120
r1877r1878
163166
164167static READ32_HANDLER( sound_r )
165168{
166   int latch = soundlatch3_r(0);
169   int latch = soundlatch3_r(machine, 0);
167170
168171   if (latch == 0xe) latch = 0xf;   /* hack: until 54539 NMI disable found */
169172
r1877r1878
174177{
175178   if (ACCESSING_MSB)
176179   {
177      soundlatch_w(0, (data>>8)&0xff);
180      soundlatch_w(machine, 0, (data>>8)&0xff);
178181   }
179182   else
180183   {
181      soundlatch2_w(0, data&0xff);
184      soundlatch2_w(machine, 0, data&0xff);
182185   }
183186}
184187
r1877r1878
684687static MACHINE_DRIVER_START( plygonet )
685688   MDRV_CPU_ADD(M68EC020, 16000000)   /* 16 MHz (xtal is 32.0 MHz) */
686689   MDRV_CPU_PROGRAM_MAP(polygonet_map, 0)
687   MDRV_CPU_VBLANK_INT(polygonet_interrupt, 2)
690   MDRV_CPU_VBLANK_INT_HACK(polygonet_interrupt, 2)
688691
689692   MDRV_CPU_ADD(DSP56156, 10000000)      /* should be 40.0 MHz */
690693   MDRV_CPU_FLAGS(CPU_DISABLE)
src/mame/drivers/naomi.c
r1877r1878
750750   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2)
751751   PORT_START_TAG("IN4")
752752   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2)
753
753754   PORT_START_TAG("COINS")
754   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
755   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
755   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(dc_coin_slots_callback, &dc_coin_counts[0])
756   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_CHANGED(dc_coin_slots_callback, &dc_coin_counts[1])
756757INPUT_PORTS_END
757758
758759static const struct AICAinterface aica_interface =
r1877r1878
774775   MDRV_CPU_CONFIG(sh4cpu_config)
775776   MDRV_CPU_PROGRAM_MAP(naomi_map,0)
776777   MDRV_CPU_IO_MAP(naomi_port,0)
777   MDRV_CPU_VBLANK_INT(naomi_vblank,1)
778   MDRV_CPU_VBLANK_INT("main", naomi_vblank)
778779
779780   MDRV_CPU_ADD_TAG("sound", ARM7, ((XTAL_33_8688MHz*2)/3)/8)   // AICA bus clock is 2/3rds * 33.8688.  ARM7 gets 1 bus cycle out of each 8.
780781   MDRV_CPU_PROGRAM_MAP(dc_audio_map, 0)
src/mame/drivers/nemesis.c
r1877r1878
102102static WRITE16_HANDLER( salamand_soundlatch_word_w )
103103{
104104   if(ACCESSING_LSB) {
105      soundlatch_w(offset,data & 0xff);
106      cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
105      soundlatch_w(machine,offset,data & 0xff);
106      cpunum_set_input_line(machine, 1,0,HOLD_LINE);
107107   }
108108}
109109
r1877r1878
245245{
246246   switch (hcrash_selected_ip & 0xf)
247247   {                                    // From WEC Le Mans Schems:
248      case 0xc:  return input_port_8_r(offset);   // Accel - Schems: Accelevr
249      case 0:    return input_port_8_r(offset);
250      case 0xd:  return input_port_9_r(offset);   // Wheel - Schems: Handlevr
251      case 1:    return input_port_9_r(offset);
248      case 0xc:  return input_port_8_r(machine,offset);   // Accel - Schems: Accelevr
249      case 0:    return input_port_8_r(machine,offset);
250      case 0xd:  return input_port_9_r(machine,offset);   // Wheel - Schems: Handlevr
251      case 1:    return input_port_9_r(machine,offset);
252252
253253      default: return ~0;
254254   }
r1877r1878
257257static WRITE16_HANDLER( nemesis_soundlatch_word_w )
258258{
259259   if(ACCESSING_LSB) {
260      soundlatch_w(offset,data & 0xff);
260      soundlatch_w(machine,offset,data & 0xff);
261261   }
262262}
263263
r1877r1878
21492149   MDRV_CPU_ADD(M68000,18432000/2)         /* 9.216 MHz? */
21502150//          14318180/2, /* From schematics, should be accurate */
21512151   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
2152   MDRV_CPU_VBLANK_INT(nemesis_interrupt,1)
2152   MDRV_CPU_VBLANK_INT("main", nemesis_interrupt)
21532153
21542154   MDRV_CPU_ADD(Z80,14318180/4)
21552155   /* audio CPU */ /* From schematics, should be accurate */
r1877r1878
21972197   /* basic machine hardware */
21982198   MDRV_CPU_ADD(M68000,18432000/2)         /* 9.216 MHz? */
21992199   MDRV_CPU_PROGRAM_MAP(konamigt_readmem,konamigt_writemem)
2200   MDRV_CPU_VBLANK_INT(konamigt_interrupt,2)
2200   MDRV_CPU_VBLANK_INT_HACK(konamigt_interrupt,2)
22012201
22022202   MDRV_CPU_ADD(Z80,14318180/4)
22032203   /* audio CPU */        /* 3.579545 MHz */
r1877r1878
22412241   /* basic machine hardware */
22422242   MDRV_CPU_ADD(M68000,18432000/2)       /* 9.216MHz */
22432243   MDRV_CPU_PROGRAM_MAP(salamand_readmem,salamand_writemem)
2244   MDRV_CPU_VBLANK_INT(salamand_interrupt,1)
2244   MDRV_CPU_VBLANK_INT("main", salamand_interrupt)
22452245
22462246   MDRV_CPU_ADD(Z80, 3579545)
22472247   /* audio CPU */        /* 3.579545 MHz */
r1877r1878
22922292   /* basic machine hardware */
22932293   MDRV_CPU_ADD(M68000,18432000/2)         /* 9.216 MHz? */
22942294   MDRV_CPU_PROGRAM_MAP(blkpnthr_readmem,blkpnthr_writemem)
2295   MDRV_CPU_VBLANK_INT(blkpnthr_interrupt,1)
2295   MDRV_CPU_VBLANK_INT("main", blkpnthr_interrupt)
22962296
22972297   MDRV_CPU_ADD(Z80, 3579545)
22982298   /* audio CPU */        /* 3.579545 MHz */
r1877r1878
23382338   /* basic machine hardware */
23392339   MDRV_CPU_ADD(M68000,18432000/2)         /* 9.216 MHz? */
23402340   MDRV_CPU_PROGRAM_MAP(citybomb_readmem,citybomb_writemem)
2341   MDRV_CPU_VBLANK_INT(salamand_interrupt,1)
2341   MDRV_CPU_VBLANK_INT("main", salamand_interrupt)
23422342
23432343   MDRV_CPU_ADD(Z80, 3579545)
23442344   /* audio CPU */        /* 3.579545 MHz */
r1877r1878
23882388   /* basic machine hardware */
23892389   MDRV_CPU_ADD(M68000,18432000/2)         /* 9.216 MHz? */
23902390   MDRV_CPU_PROGRAM_MAP(nyanpani_readmem,nyanpani_writemem)
2391   MDRV_CPU_VBLANK_INT(salamand_interrupt,1)
2391   MDRV_CPU_VBLANK_INT("main", salamand_interrupt)
23922392
23932393   MDRV_CPU_ADD(Z80, 3579545)
23942394   /* audio CPU */        /* 3.579545 MHz */
r1877r1878
24382438   /* basic machine hardware */
24392439   MDRV_CPU_ADD(M68000,18432000/2)     /* 9.216MHz */
24402440   MDRV_CPU_PROGRAM_MAP(gx400_readmem,gx400_writemem)
2441   MDRV_CPU_VBLANK_INT(gx400_interrupt,3)
2441   MDRV_CPU_VBLANK_INT_HACK(gx400_interrupt,3)
24422442
24432443   MDRV_CPU_ADD(Z80,14318180/4)        /* 3.579545 MHz */
24442444   MDRV_CPU_PROGRAM_MAP(gx400_sound_readmem,gx400_sound_writemem)
2445   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)   /* interrupts are triggered by the main CPU */
2445   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)   /* interrupts are triggered by the main CPU */
24462446
24472447   MDRV_MACHINE_RESET(nemesis)
24482448
r1877r1878
24862486   /* basic machine hardware */
24872487   MDRV_CPU_ADD(M68000,18432000/2)     /* 9.216MHz */
24882488   MDRV_CPU_PROGRAM_MAP(rf2_gx400_readmem,rf2_gx400_writemem)
2489   MDRV_CPU_VBLANK_INT(gx400_interrupt,3)
2489   MDRV_CPU_VBLANK_INT_HACK(gx400_interrupt,3)
24902490
24912491   MDRV_CPU_ADD(Z80,14318180/4)
24922492   /* audio CPU */        /* 3.579545 MHz */
24932493   MDRV_CPU_PROGRAM_MAP(gx400_sound_readmem,gx400_sound_writemem)
2494   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)   /* interrupts are triggered by the main CPU */
2494   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)   /* interrupts are triggered by the main CPU */
24952495
24962496   MDRV_MACHINE_RESET(nemesis)
24972497
r1877r1878
25342534   /* basic machine hardware */
25352535   MDRV_CPU_ADD(M68000,18432000/3)         /* 6.144MHz */
25362536   MDRV_CPU_PROGRAM_MAP(hcrash_map,0)
2537   MDRV_CPU_VBLANK_INT(konamigt_interrupt,2)
2537   MDRV_CPU_VBLANK_INT_HACK(konamigt_interrupt,2)
25382538
25392539   MDRV_CPU_ADD(Z80,14318180/4)
25402540   /* audio CPU */        /* 3.579545 MHz */
src/mame/drivers/cheekyms.c
r1877r1878
22 Universal Cheeky Mouse Driver
33 (c)Lee Taylor May/June 1998, All rights reserved.
44
5 For use only in offical Mame releases.
5 For use only in offical MAME releases.
66 Not to be distributed as part of any commerical work.
77**************************************************************************/
88
r1877r1878
1010#include "sound/dac.h"
1111
1212
13extern UINT8 *cheekyms_videoram;
14extern UINT8 *cheekyms_spriteram;
15extern UINT8 *cheekyms_port_80;
1316
1417PALETTE_INIT( cheekyms );
18VIDEO_START( cheekyms );
1519VIDEO_UPDATE( cheekyms );
16WRITE8_HANDLER( cheekyms_sprite_w );
1720WRITE8_HANDLER( cheekyms_port_40_w );
1821WRITE8_HANDLER( cheekyms_port_80_w );
1922
2023
21static ADDRESS_MAP_START( addressmap, ADDRESS_SPACE_PROGRAM, 8 )
24
25static INPUT_CHANGED( coin_inserted )
26{
27   /* this starts a 556 one-shot timer (and triggers a sound effect) */
28   if (newval)
29      cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
30}
31
32
33static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
2234   AM_RANGE(0x0000, 0x1fff) AM_ROM
2335   AM_RANGE(0x3000, 0x33ff) AM_RAM
24   AM_RANGE(0x3800, 0x3bff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size)
36   AM_RANGE(0x3800, 0x3bff) AM_RAM AM_BASE(&cheekyms_videoram)
2537ADDRESS_MAP_END
2638
27static ADDRESS_MAP_START( portmap, ADDRESS_SPACE_IO, 8 )
39static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
2840   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
2941   AM_RANGE(0x00, 0x00) AM_READ(input_port_0_r)
3042   AM_RANGE(0x01, 0x01) AM_READ(input_port_1_r)
31   AM_RANGE(0x20, 0x3f) AM_WRITE(cheekyms_sprite_w)
43   AM_RANGE(0x20, 0x3f) AM_WRITE(MWA8_RAM) AM_BASE(&cheekyms_spriteram)
3244   AM_RANGE(0x40, 0x40) AM_WRITE(cheekyms_port_40_w)
33   AM_RANGE(0x80, 0x80) AM_WRITE(cheekyms_port_80_w)
45   AM_RANGE(0x80, 0x80) AM_WRITE(cheekyms_port_80_w) AM_BASE(&cheekyms_port_80)
3446ADDRESS_MAP_END
3547
3648
37static INTERRUPT_GEN( cheekyms_interrupt )
38{
39   if (readinputport(2) & 1)   /* Coin */
40      nmi_line_pulse(machine, cpunum);
41   else
42      irq0_line_hold(machine, cpunum);
43}
44
45
4649static INPUT_PORTS_START( cheekyms )
4750   PORT_START      /* IN0 */
4851   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) )
r1877r1878
5457   PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
5558   PORT_DIPSETTING(    0x04, DEF_STR( 1C_1C ) )
5659   PORT_DIPSETTING(    0x00, DEF_STR( 1C_2C ) )
57//PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
60  //PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
5861   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Cabinet ) )
5962   PORT_DIPSETTING(    0x10, DEF_STR( Upright ) )
6063   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
r1877r1878
7881   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
7982
8083   PORT_START   /* FAKE */
81   /* The coin slots are not memory mapped. Coin  causes a NMI, */
82   /* This fake input port is used by the interrupt */
83   /* handler to be notified of coin insertions. We use IMPULSE to */
84   /* trigger exactly one interrupt, without having to check when the */
85   /* user releases the key. */
86   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
84   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
8785INPUT_PORTS_END
8886
8987
r1877r1878
123121
124122   /* basic machine hardware */
125123   MDRV_CPU_ADD(Z80,5000000/2)  /* 2.5 MHz */
126   MDRV_CPU_PROGRAM_MAP(addressmap,0)
127   MDRV_CPU_IO_MAP(portmap,0)
128   MDRV_CPU_VBLANK_INT(cheekyms_interrupt,1)
124   MDRV_CPU_PROGRAM_MAP(main_map,0)
125   MDRV_CPU_IO_MAP(io_map,0)
126   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
129127
130128   /* video hardware */
131129   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
139137   MDRV_PALETTE_LENGTH(0xc0)
140138
141139   MDRV_PALETTE_INIT(cheekyms)
140   MDRV_VIDEO_START(cheekyms)
142141   MDRV_VIDEO_UPDATE(cheekyms)
143142
144   /* sound hardware */
143   /* audio hardware */
145144   MDRV_SPEAKER_STANDARD_MONO("mono")
146145
147146   MDRV_SOUND_ADD(DAC, 0)
r1877r1878
180179
181180
182181
183GAME( 1980?, cheekyms, 0, cheekyms, cheekyms, 0, ROT270, "Universal", "Cheeky Mouse", GAME_IMPERFECT_SOUND )
182GAME( 1980, cheekyms, 0, cheekyms, cheekyms, 0, ROT270, "Universal", "Cheeky Mouse", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
src/mame/drivers/progolf.c
r1877r1878
202202   /* basic machine hardware */
203203   MDRV_CPU_ADD(M6502, 2000000)       /* ? */
204204   MDRV_CPU_PROGRAM_MAP(main_cpu,0)
205//  MDRV_CPU_VBLANK_INT(progolf_interrupt,1)
205//  MDRV_CPU_VBLANK_INT("main", progolf_interrupt)
206206
207207//  MDRV_CPU_ADD(M6502, 500000)
208208//  MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
209//  MDRV_CPU_VBLANK_INT(nmi_line_pulse,16)
209//  MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,16)
210210
211211   /* video hardware */
212212   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/magmax.c
r1877r1878
365365   /* basic machine hardware */
366366   MDRV_CPU_ADD(M68000, XTAL_16MHz/2)   /* verified on pcb */
367367   MDRV_CPU_PROGRAM_MAP(magmax_readmem,magmax_writemem)
368   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
368   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
369369
370370   MDRV_CPU_ADD(Z80,XTAL_20MHz/8) /* verified on pcb */
371371   /* audio CPU */
src/mame/drivers/powerbal.c
r1877r1878
6363
6464static READ16_HANDLER( magicstk_port2_r )
6565{
66   return (input_port_2_r(0) & 0xfe) | EEPROM_read_bit();
66   return (input_port_2_r(machine,0) & 0xfe) | EEPROM_read_bit();
6767}
6868
6969static WRITE16_HANDLER( magicstk_coin_eeprom_w )
r1877r1878
335335   SET_TILE_INFO(1,code,colr >> 12,0);
336336}
337337
338static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
338static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
339339{
340340   int offs;
341341   int height = machine->gfx[0]->height;
r1877r1878
413413   /* basic machine hardware */
414414   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
415415   MDRV_CPU_PROGRAM_MAP(powerbal_main_map, 0)
416   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
416   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
417417
418418   /* video hardware */
419419   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
441441   /* basic machine hardware */
442442   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz */
443443   MDRV_CPU_PROGRAM_MAP(magicstk_main_map, 0)
444   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
444   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
445445
446446   MDRV_NVRAM_HANDLER(magicstk)
447447
src/mame/drivers/stv.c
r1877r1878
20362036static READ32_HANDLER( stv_scsp_regs_r32 )
20372037{
20382038   offset <<= 1;
2039   return (SCSP_0_r(offset+1, 0xffff) | (SCSP_0_r(offset, 0xffff)<<16));
2039   return (SCSP_0_r(machine, offset+1, 0xffff) | (SCSP_0_r(machine, offset, 0xffff)<<16));
20402040}
20412041
20422042static WRITE32_HANDLER( stv_scsp_regs_w32 )
20432043{
20442044   offset <<= 1;
2045   SCSP_0_w(offset, data>>16, mem_mask >> 16);
2046   SCSP_0_w(offset+1, data, mem_mask);
2045   SCSP_0_w(machine, offset, data>>16, mem_mask >> 16);
2046   SCSP_0_w(machine, offset+1, data, mem_mask);
20472047}
20482048
20492049/* communication,SLAVE CPU acquires data from the MASTER CPU and triggers an irq.  *
r1877r1878
27362736   /* basic machine hardware */
27372737   MDRV_CPU_ADD(SH2, MASTER_CLOCK_352/2) // 28.6364 MHz
27382738   MDRV_CPU_PROGRAM_MAP(stv_mem, 0)
2739   MDRV_CPU_VBLANK_INT(stv_interrupt,264)/*264 lines,224 display lines*/
2739   MDRV_CPU_VBLANK_INT_HACK(stv_interrupt,264)/*264 lines,224 display lines*/
27402740   MDRV_CPU_CONFIG(sh2_conf_master)
27412741
27422742   MDRV_CPU_ADD(SH2, MASTER_CLOCK_352/2) // 28.6364 MHz
src/mame/drivers/timelimt.c
r1877r1878
262262   MDRV_CPU_ADD(Z80, 5000000)   /* 5.000 MHz */
263263   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
264264   MDRV_CPU_IO_MAP(readport,0)
265   MDRV_CPU_VBLANK_INT(timelimt_irq,1)
265   MDRV_CPU_VBLANK_INT("main", timelimt_irq)
266266
267267   MDRV_CPU_ADD(Z80,18432000/6)
268268   /* audio CPU */   /* 3.072 MHz */
269269   MDRV_CPU_PROGRAM_MAP(readmem_sound,writemem_sound)
270270   MDRV_CPU_IO_MAP(readport_sound,writeport_sound)
271   MDRV_CPU_VBLANK_INT(irq0_line_hold,1) /* ? */
271   MDRV_CPU_VBLANK_INT("main", irq0_line_hold) /* ? */
272272
273273   MDRV_INTERLEAVE(50)
274274
src/mame/drivers/talbot.c
r1877r1878
158158   bg_tilemap = tilemap_create(get_tile_info_bg, tilemap_scan_rows, 8, 8, 32, 32);
159159}
160160
161static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
161static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
162162{
163163   int offs;
164164
r1877r1878
237237   /* basic machine hardware */
238238   MDRV_CPU_ADD(Z80, 18432000/6)   /* (?) */
239239   MDRV_CPU_PROGRAM_MAP(cpu_map, 0)
240   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
240   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
241241
242242   /* MCU */
243243//  MDRV_CPU_ADD(ALPHA8201, 18432000/6/8/2) /* (?) */
src/mame/drivers/warriorb.c
r1877r1878
181181static WRITE16_HANDLER( warriorb_sound_w )
182182{
183183   if (offset == 0)
184      taitosound_port_w (0, data & 0xff);
184      taitosound_port_w (machine, 0, data & 0xff);
185185   else if (offset == 1)
186      taitosound_comm_w (0, data & 0xff);
186      taitosound_comm_w (machine, 0, data & 0xff);
187187}
188188
189189static READ16_HANDLER( warriorb_sound_r )
190190{
191191   if (offset == 1)
192      return ((taitosound_comm_r (0) & 0xff));
192      return ((taitosound_comm_r (machine,0) & 0xff));
193193   else return 0;
194194}
195195
r1877r1878
488488   /* basic machine hardware */
489489   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz ??? (Might well be 16!) */
490490   MDRV_CPU_PROGRAM_MAP(darius2d_readmem,darius2d_writemem)
491   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
491   MDRV_CPU_VBLANK_INT("left", irq4_line_hold)
492492
493493   MDRV_CPU_ADD(Z80,16000000/4)
494494   /* audio CPU */   /* 4 MHz ? */
r1877r1878
547547   /* basic machine hardware */
548548   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz ? */
549549   MDRV_CPU_PROGRAM_MAP(warriorb_readmem,warriorb_writemem)
550   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
550   MDRV_CPU_VBLANK_INT("left", irq4_line_hold)
551551
552552   MDRV_CPU_ADD(Z80,16000000/4)
553553   /* audio CPU */   /* 4 MHz ? */
src/mame/drivers/igs_blit.c
r1877r1878
10131013static WRITE16_HANDLER( igs_YM3812_control_port_0_w )
10141014{
10151015   if (ACCESSING_LSB)
1016      YM3812_control_port_0_w(0,data);
1016      YM3812_control_port_0_w(machine,0,data);
10171017}
10181018
10191019static WRITE16_HANDLER( igs_YM3812_write_port_0_w )
10201020{
10211021   if (ACCESSING_LSB)
1022      YM3812_write_port_0_w(0,data);
1022      YM3812_write_port_0_w(machine,0,data);
10231023}
10241024
10251025static ADDRESS_MAP_START( chindrag_readmem, ADDRESS_SPACE_PROGRAM, 16 )
r1877r1878
11581158{
11591159   switch(offset)
11601160   {
1161      case 0:   return ics2115_r(0);
1162      case 1:   return ics2115_r(1);
1163      case 2:   return (ics2115_r(3) << 8) | ics2115_r(2);
1161      case 0:   return ics2115_r(machine,0);
1162      case 1:   return ics2115_r(machine,1);
1163      case 2:   return (ics2115_r(machine,3) << 8) | ics2115_r(machine,2);
11641164   }
11651165   return 0xff;
11661166}
r1877r1878
11701170   switch(offset)
11711171   {
11721172      case 1:
1173         if (ACCESSING_LSB)   ics2115_w(1,data);
1173         if (ACCESSING_LSB)   ics2115_w(machine,1,data);
11741174         break;
11751175      case 2:
1176         if (ACCESSING_LSB)   ics2115_w(2,data);
1177         if (ACCESSING_MSB)   ics2115_w(3,data>>8);
1176         if (ACCESSING_LSB)   ics2115_w(machine,2,data);
1177         if (ACCESSING_MSB)   ics2115_w(machine,3,data>>8);
11781178         break;
11791179   }
11801180}
r1877r1878
23992399   MDRV_IMPORT_FROM(igs_base)
24002400   MDRV_CPU_MODIFY("main")
24012401   MDRV_CPU_PROGRAM_MAP(chmplst2_readmem,chmplst2_writemem)
2402   MDRV_CPU_VBLANK_INT(chmplst2_interrupt,1+4)   // lev5 frequency drives the music tempo
2402   MDRV_CPU_VBLANK_INT_HACK(chmplst2_interrupt,1+4)   // lev5 frequency drives the music tempo
24032403
24042404//  MDRV_GFXDECODE(chmplst2)
24052405
r1877r1878
24122412   MDRV_IMPORT_FROM(igs_base)
24132413   MDRV_CPU_MODIFY("main")
24142414   MDRV_CPU_PROGRAM_MAP(chindrag_readmem,chindrag_writemem)
2415   MDRV_CPU_VBLANK_INT(chmplst2_interrupt,1+4)   // lev5 frequency drives the music tempo
2415   MDRV_CPU_VBLANK_INT_HACK(chmplst2_interrupt,1+4)   // lev5 frequency drives the music tempo
24162416
24172417   MDRV_SOUND_ADD(YM3812, 3579545)
24182418   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 2.0)
r1877r1878
24322432   MDRV_IMPORT_FROM(igs_base)
24332433   MDRV_CPU_MODIFY("main")
24342434   MDRV_CPU_PROGRAM_MAP(grtwall_readmem,grtwall_writemem)
2435   MDRV_CPU_VBLANK_INT(grtwall_interrupt,2)
2435   MDRV_CPU_VBLANK_INT_HACK(grtwall_interrupt,2)
24362436MACHINE_DRIVER_END
24372437
24382438
r1877r1878
24512451   MDRV_IMPORT_FROM(igs_base)
24522452   MDRV_CPU_MODIFY("main")
24532453   MDRV_CPU_PROGRAM_MAP(lhb_readmem,lhb_writemem)
2454   MDRV_CPU_VBLANK_INT(lhb_interrupt,3)
2454   MDRV_CPU_VBLANK_INT_HACK(lhb_interrupt,3)
24552455MACHINE_DRIVER_END
24562456
24572457
r1877r1878
24822482   MDRV_IMPORT_FROM(igs_base)
24832483   MDRV_CPU_MODIFY("main")
24842484   MDRV_CPU_PROGRAM_MAP(vbowl_readmem,vbowl_writemem)
2485   MDRV_CPU_VBLANK_INT(vbowl_interrupt,3+4)
2485   MDRV_CPU_VBLANK_INT_HACK(vbowl_interrupt,3+4)
24862486
24872487   MDRV_VIDEO_EOF(vbowl)   // trackball
24882488//  MDRV_GFXDECODE(chmplst2)
r1877r1878
24992499   MDRV_IMPORT_FROM(igs_base)
25002500   MDRV_CPU_MODIFY("main")
25012501   MDRV_CPU_PROGRAM_MAP(xymg_readmem,xymg_writemem)
2502   MDRV_CPU_VBLANK_INT(grtwall_interrupt,2)
2502   MDRV_CPU_VBLANK_INT_HACK(grtwall_interrupt,2)
25032503MACHINE_DRIVER_END
25042504
25052505
src/mame/drivers/goal92.c
r1877r1878
3131{
3232   if (ACCESSING_MSB)
3333   {
34      soundlatch_w(0, (data >> 8) & 0xff);
35      cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
34      soundlatch_w(machine, 0, (data >> 8) & 0xff);
35      cpunum_set_input_line(machine, 1,0,HOLD_LINE);
3636   }
3737}
3838
r1877r1878
287287   16*16
288288};
289289
290#ifdef UNUSED_FUNCTON
290291static const gfx_layout layout_16x16x4_2 =
291292{
292293   16,16,
r1877r1878
299300      256+0*32,256+1*32,256+2*32,256+3*32,256+4*32,256+5*32,256+6*32,256+7*32 },
300301   1024
301302};
303#endif
302304
303305static GFXDECODE_START( goal92 )
304306   GFXDECODE_ENTRY( REGION_GFX1, 0, layout_16x16x4,         0*16, 8*16 ) // Sprites
r1877r1878
314316   /* basic machine hardware */
315317   MDRV_CPU_ADD(M68000,12000000)
316318   MDRV_CPU_PROGRAM_MAP(goal92_readmem,goal92_writemem)
317   MDRV_CPU_VBLANK_INT(irq6_line_hold,1) /* VBL */
319   MDRV_CPU_VBLANK_INT("main", irq6_line_hold) /* VBL */
318320
319321   MDRV_CPU_ADD(Z80, 2500000)
320322   /* audio CPU */
src/mame/drivers/champbwl.c
r1877r1878
333333   /* basic machine hardware */
334334   MDRV_CPU_ADD(Z80, 16000000/4) /* 4MHz */
335335   MDRV_CPU_PROGRAM_MAP(champbwl_map,0)
336   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
336   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
337337
338338   MDRV_NVRAM_HANDLER(generic_0fill)
339339
src/mame/drivers/bishi.c
r1877r1878
7070
7171static READ16_HANDLER( bishi_sound_r )
7272{
73   return YMZ280B_status_0_r(offset)<<8;
73   return YMZ280B_status_0_r(machine, offset)<<8;
7474}
7575
7676static WRITE16_HANDLER( bishi_sound_w )
7777{
7878    if (offset)
7979   {
80      YMZ280B_data_0_w(offset, data>>8);
80      YMZ280B_data_0_w(machine, offset, data>>8);
8181   }
8282    else
8383   {
84      YMZ280B_register_0_w(offset, data>>8);
84      YMZ280B_register_0_w(machine, offset, data>>8);
8585   }
8686}
8787
8888static READ16_HANDLER( dipsw_r )   // dips
8989{
90   return input_port_1_r(0) | (input_port_5_r(0)<<8);
90   return input_port_1_r(machine,0) | (input_port_5_r(machine,0)<<8);
9191}
9292
9393static READ16_HANDLER( player1_r )    // players 1 and 3
9494{
95   return 0xff | (input_port_2_r(0)<<8);
95   return 0xff | (input_port_2_r(machine,0)<<8);
9696}
9797
9898static READ16_HANDLER( player2_r )   // players 2 and 4
9999{
100   return input_port_3_r(0) | (input_port_4_r(0)<<8);
100   return input_port_3_r(machine,0) | (input_port_4_r(machine,0)<<8);
101101}
102102
103103static READ16_HANDLER( bishi_K056832_rom_r )
r1877r1878
115115      ouroffs += 4;
116116   }
117117
118   return K056832_bishi_rom_word_r(ouroffs, mem_mask);
118   return K056832_bishi_rom_word_r(machine, ouroffs, mem_mask);
119119}
120120
121121static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 16 )
r1877r1878
268268   /* basic machine hardware */
269269   MDRV_CPU_ADD_TAG("main", M68000, 16000000)
270270   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
271   MDRV_CPU_VBLANK_INT(bishi_interrupt, 2)
271   MDRV_CPU_VBLANK_INT_HACK(bishi_interrupt, 2)
272272
273273   MDRV_MACHINE_START(bishi)
274274   MDRV_MACHINE_RESET(bishi)
src/mame/drivers/vamphalf.c
r1877r1878
4848static READ16_HANDLER( oki_r )
4949{
5050   if(offset)
51      return OKIM6295_status_0_r(0);
51      return OKIM6295_status_0_r(machine, 0);
5252   else
5353      return 0;
5454}
r1877r1878
5656static WRITE16_HANDLER( oki_w )
5757{
5858   if(offset)
59      OKIM6295_data_0_w(0, data);
59      OKIM6295_data_0_w(machine, 0, data);
6060}
6161
6262static READ32_HANDLER( oki32_r )
6363{
64   return OKIM6295_status_0_r(0) << 8;
64   return OKIM6295_status_0_r(machine, 0) << 8;
6565}
6666
6767static WRITE32_HANDLER( oki32_w )
6868{
69   OKIM6295_data_0_w(0, (data >> 8) & 0xff);
69   OKIM6295_data_0_w(machine, 0, (data >> 8) & 0xff);
7070}
7171
7272static READ16_HANDLER( ym2151_status_r )
7373{
7474   if(offset)
75      return YM2151_status_port_0_r(0);
75      return YM2151_status_port_0_r(machine, 0);
7676   else
7777      return 0;
7878}
r1877r1878
8080static WRITE16_HANDLER( ym2151_data_w )
8181{
8282   if(offset)
83      YM2151_data_port_0_w(0, data);
83      YM2151_data_port_0_w(machine, 0, data);
8484}
8585
8686static WRITE16_HANDLER( ym2151_register_w )
8787{
8888   if(offset)
89      YM2151_register_port_0_w(0, data);
89      YM2151_register_port_0_w(machine, 0, data);
9090}
9191
9292static READ32_HANDLER( ym2151_status32_r )
9393{
94   return YM2151_status_port_0_r(0) << 8;
94   return YM2151_status_port_0_r(machine, 0) << 8;
9595}
9696
9797static WRITE32_HANDLER( ym2151_data32_w )
9898{
99   YM2151_data_port_0_w(0, (data >> 8) & 0xff);
99   YM2151_data_port_0_w(machine, 0, (data >> 8) & 0xff);
100100}
101101
102102static WRITE32_HANDLER( ym2151_register32_w )
103103{
104   YM2151_register_port_0_w(0, (data >> 8) & 0xff);
104   YM2151_register_port_0_w(machine, 0, (data >> 8) & 0xff);
105105}
106106
107107static READ16_HANDLER( eeprom_r )
r1877r1878
352352-------x xxxxxxxx X offs
353353*/
354354
355static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, int scrnum)
355static void draw_sprites(running_machine *machine, bitmap_t *bitmap, int scrnum)
356356{
357357   const gfx_element *gfx = machine->gfx[0];
358358   UINT32 cnt;
r1877r1878
584584static MACHINE_DRIVER_START( common )
585585   MDRV_CPU_ADD_TAG("main", E116T, 50000000)   /* 50 MHz */
586586   MDRV_CPU_PROGRAM_MAP(common_map,0)
587   MDRV_CPU_VBLANK_INT(irq1_line_hold, 1)
587   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
588588
589589   MDRV_NVRAM_HANDLER(93C46_vamphalf)
590590
src/mame/drivers/1942.c
r1877r1878
268268   /* basic machine hardware */
269269   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz (?) */
270270   MDRV_CPU_PROGRAM_MAP(c1942_map, 0)
271   MDRV_CPU_VBLANK_INT(c1942_interrupt,2)
271   MDRV_CPU_VBLANK_INT_HACK(c1942_interrupt,2)
272272
273273   MDRV_CPU_ADD(Z80, 3000000)   /* 3 MHz ??? */
274274   MDRV_CPU_PROGRAM_MAP(sound_map, 0)
275   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)
275   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)
276276
277277   /* video hardware */
278278   MDRV_GFXDECODE(1942)
src/mame/drivers/mayumi.c
r1877r1878
4141
4242static MACHINE_RESET( mayumi )
4343{
44   bank_sel_w(0,0);
44   bank_sel_w(machine,0,0);
4545}
4646
4747static WRITE8_HANDLER( input_sel_w )
r1877r1878
273273   MDRV_CPU_ADD(Z80, MCLK/2) /* 5.000 MHz ? */
274274   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
275275   MDRV_CPU_IO_MAP(readport,writeport)
276   MDRV_CPU_VBLANK_INT(mayumi_interrupt,1)
276   MDRV_CPU_VBLANK_INT("main", mayumi_interrupt)
277277
278278   MDRV_MACHINE_RESET( mayumi )
279279
src/mame/drivers/poolshrk.c
r1877r1878
6565{
6666   if ((offset & 3) == 3)
6767   {
68      watchdog_reset_w(0, 0);
68      watchdog_reset_w(machine, 0, 0);
6969   }
7070}
7171
r1877r1878
8282
8383   if ((offset & 3) == 3)
8484   {
85      watchdog_reset_r(0);
85      watchdog_reset_r(machine, 0);
8686   }
8787
8888   return val;
r1877r1878
216216   /* basic machine hardware */
217217   MDRV_CPU_ADD(M6800, 11055000 / 8) /* ? */
218218   MDRV_CPU_PROGRAM_MAP(poolshrk_cpu_map, 0)
219   MDRV_CPU_VBLANK_INT(irq0_line_assert, 1)
219   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
220220
221221   /* video hardware */
222222   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/bloodbro.c
r1877r1878
528528   // basic machine hardware
529529   MDRV_CPU_ADD_TAG("main", M68000, XTAL_20MHz/2) /* verified on pcb */
530530   MDRV_CPU_PROGRAM_MAP(bloodbro_map, 0)
531   MDRV_CPU_VBLANK_INT(irq4_line_hold, 1)
531   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
532532
533533   SEIBU_SOUND_SYSTEM_CPU(XTAL_7_15909MHz/2) /* verified on pcb */
534534
r1877r1878
558558
559559   MDRV_CPU_MODIFY("main")
560560   MDRV_CPU_PROGRAM_MAP(weststry_map, 0)
561   MDRV_CPU_VBLANK_INT(irq6_line_hold, 1)
561   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
562562
563563   MDRV_GFXDECODE(weststry)
564564   MDRV_PALETTE_LENGTH(1024)
r1877r1878
570570   MDRV_IMPORT_FROM(bloodbro)
571571
572572   MDRV_CPU_MODIFY("main")
573   MDRV_CPU_VBLANK_INT(irq2_line_hold, 1)
573   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
574574
575575   MDRV_VIDEO_UPDATE(skysmash)
576576MACHINE_DRIVER_END
src/mame/drivers/raiden.c
r1877r1878
228228
229229static VIDEO_EOF( raiden )
230230{
231   buffer_spriteram16_w(0,0,0); /* Could be a memory location instead */
231   buffer_spriteram16_w(machine,0,0,0); /* Could be a memory location instead */
232232}
233233
234234static MACHINE_DRIVER_START( raiden )
r1877r1878
236236   /* basic machine hardware */
237237   MDRV_CPU_ADD(V30,XTAL_20MHz/2) /* NEC V30 CPU, 20MHz verified on pcb */
238238   MDRV_CPU_PROGRAM_MAP(main_map,0)
239   MDRV_CPU_VBLANK_INT(raiden_interrupt,1)
239   MDRV_CPU_VBLANK_INT("main", raiden_interrupt)
240240
241241   MDRV_CPU_ADD(V30,XTAL_20MHz/2) /* NEC V30 CPU, 20MHz verified on pcb */
242242   MDRV_CPU_PROGRAM_MAP(sub_map,0)
243   MDRV_CPU_VBLANK_INT(raiden_interrupt,1)
243   MDRV_CPU_VBLANK_INT("main", raiden_interrupt)
244244
245245   SEIBU_SOUND_SYSTEM_CPU(XTAL_14_31818MHz/4) /* verified on pcb */
246246
r1877r1878
275275   /* basic machine hardware */
276276   MDRV_CPU_ADD(V30,XTAL_20MHz/2) /* NEC V30 CPU, 20MHz verified on pcb */
277277   MDRV_CPU_PROGRAM_MAP(alt_map,0)
278   MDRV_CPU_VBLANK_INT(raiden_interrupt,1)
278   MDRV_CPU_VBLANK_INT("main", raiden_interrupt)
279279
280280   MDRV_CPU_ADD(V30,XTAL_20MHz/2) /* NEC V30 CPU, 20MHz verified on pcb */
281281   MDRV_CPU_PROGRAM_MAP(sub_map,0)
282   MDRV_CPU_VBLANK_INT(raiden_interrupt,1)
282   MDRV_CPU_VBLANK_INT("main", raiden_interrupt)
283283
284284   SEIBU_SOUND_SYSTEM_CPU(XTAL_14_31818MHz/4) /* verified on pcb */
285285
src/mame/drivers/alg.c
r1877r1878
3232static UINT8 serial_timer_active;
3333static UINT16 input_select;
3434
35static bitmap_t *amiga_bitmap;
3536static render_texture *video_texture;
3637static render_texture *overlay_texture;
3738
r1877r1878
7677   /* configure for cleanup */
7778   add_exit_callback(machine, video_cleanup);
7879
80   /* allocate Amiga bitmap */
81   amiga_bitmap = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format);
82
7983   /* standard video start */
8084   VIDEO_START_CALL(amiga);
8185
r1877r1878
103107
104108static VIDEO_UPDATE( alg )
105109{
106   /* composite the video */
107   if (!video_skip_this_frame())
110   int y;
111
112   /* update the Amiga video */
113   for (y = cliprect->min_y; y <= cliprect->max_y; y++)
114      amiga_render_scanline(machine, amiga_bitmap, y);
115
116   /* at the end of the frame, composite the video */
117   if (!video_skip_this_frame() && (cliprect->max_y == machine->screen[screen].visarea.max_y))
108118   {
109      mame_bitmap *vidbitmap;
119      bitmap_t *vidbitmap;
110120      rectangle fixedvis = machine->screen[screen].visarea;
111121      fixedvis.max_x++;
112122      fixedvis.max_y++;
r1877r1878
120130      /* then overlay the Amiga video */
121131      if (overlay_texture == NULL)
122132         overlay_texture = render_texture_alloc(NULL, NULL);
123      render_texture_set_bitmap(overlay_texture, tmpbitmap, &fixedvis, 0, TEXFORMAT_PALETTEA16);
133      render_texture_set_bitmap(overlay_texture, amiga_bitmap, &fixedvis, 0, TEXFORMAT_PALETTEA16);
124134
125135      /* add both quads to the screen */
126136      render_container_empty(render_container_get_screen(screen));
127137      render_screen_add_quad(screen, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0xff,0xff,0xff), video_texture, PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1));
128138      render_screen_add_quad(screen, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0xff,0xff,0xff), overlay_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_SCREENTEX(1));
139
140      /* display disc information */
141      if (discinfo != NULL)
142         popmessage("%s", laserdisc_describe_state(discinfo));
129143   }
130144
131   /* display disc information */
132   if (discinfo != NULL)
133      popmessage("%s", laserdisc_describe_state(discinfo));
134
135145   return 0;
136146}
137147
r1877r1878
455465   /* basic machine hardware */
456466   MDRV_CPU_ADD_TAG("main", M68000, AMIGA_68000_NTSC_CLOCK)
457467   MDRV_CPU_PROGRAM_MAP(main_map_r1,0)
458   MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 262)
459468
460469   MDRV_MACHINE_START(alg)
461470   MDRV_MACHINE_RESET(alg)
r1877r1878
507516   /* adjust for PAL specs */
508517   MDRV_CPU_REPLACE("main", M68000, AMIGA_68000_PAL_CLOCK)
509518   MDRV_CPU_PROGRAM_MAP(main_map_picmatic,0)
510   MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 312)
511519
512520   MDRV_SCREEN_MODIFY("main")
513521   MDRV_SCREEN_REFRESH_RATE(50)
src/mame/drivers/galaxia.c
r1877r1878
146146   MDRV_CPU_ADD(S2650,2000000)       /* ? MHz */
147147   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
148148   MDRV_CPU_IO_MAP(readport,writeport)
149   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
150//  MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
149   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
150//  MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
151151
152152   /* video hardware */
153153   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/vegaeo.c
r1877r1878
2626   switch(mem_mask)
2727   {
2828      case 0:
29         vega_vram_w(offset,data,0x00ffffff);
30         vega_vram_w(offset,data,0xff00ffff);
31         vega_vram_w(offset,data,0xffff00ff);
32         vega_vram_w(offset,data,0xffffff00);
29         vega_vram_w(machine,offset,data,0x00ffffff);
30         vega_vram_w(machine,offset,data,0xff00ffff);
31         vega_vram_w(machine,offset,data,0xffff00ff);
32         vega_vram_w(machine,offset,data,0xffffff00);
3333         return;
3434
3535      case 0x0000ffff:
36         vega_vram_w(offset,data,0x00ffffff);
37         vega_vram_w(offset,data,0xff00ffff);
36         vega_vram_w(machine,offset,data,0x00ffffff);
37         vega_vram_w(machine,offset,data,0xff00ffff);
3838         return;
3939
4040      case 0xffff0000:
41         vega_vram_w(offset,data,0xffff00ff);
42         vega_vram_w(offset,data,0xffffff00);
41         vega_vram_w(machine,offset,data,0xffff00ff);
42         vega_vram_w(machine,offset,data,0xffffff00);
4343         return;
4444
4545      default:
r1877r1878
163163static MACHINE_DRIVER_START( vega )
164164   MDRV_CPU_ADD_TAG("cpu", GMS30C2132, 55000000)   /* 55 MHz */
165165   MDRV_CPU_PROGRAM_MAP(vega_map,0)
166   MDRV_CPU_VBLANK_INT(eolith_speedup,262)
166   MDRV_CPU_VBLANK_INT_HACK(eolith_speedup,262)
167167
168168   /* sound cpu */
169169
src/mame/drivers/fromanc2.c
r1877r1878
135135
136136static WRITE16_HANDLER( fromanc2_sndcmd_w )
137137{
138   soundlatch_w(offset, (data >> 8) & 0xff);   // 1P (LEFT)
139   soundlatch2_w(offset, data & 0xff);         // 2P (RIGHT)
138   soundlatch_w(machine, offset, (data >> 8) & 0xff);   // 1P (LEFT)
139   soundlatch2_w(machine, offset, data & 0xff);         // 2P (RIGHT)
140140
141   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
141   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
142142   fromanc2_sndcpu_nmi_flag = 0;
143143}
144144
r1877r1878
705705   /* basic machine hardware */
706706   MDRV_CPU_ADD(M68000,32000000/2)      /* 16.00 MHz */
707707   MDRV_CPU_PROGRAM_MAP(fromanc2_readmem_main,fromanc2_writemem_main)
708   MDRV_CPU_VBLANK_INT(fromanc2_interrupt,1)
708   MDRV_CPU_VBLANK_INT("left", fromanc2_interrupt)
709709
710710   MDRV_CPU_ADD(Z80,32000000/4)
711711   /* audio CPU */      /* 8.00 MHz */
r1877r1878
758758   /* basic machine hardware */
759759   MDRV_CPU_ADD(M68000,32000000/2)      /* 16.00 MHz */
760760   MDRV_CPU_PROGRAM_MAP(fromancr_readmem_main,fromancr_writemem_main)
761   MDRV_CPU_VBLANK_INT(fromanc2_interrupt,1)
761   MDRV_CPU_VBLANK_INT("left", fromanc2_interrupt)
762762
763763   MDRV_CPU_ADD(Z80,32000000/4)
764764   /* audio CPU */      /* 8.00 MHz */
r1877r1878
810810   /* basic machine hardware */
811811   MDRV_CPU_ADD(M68000,32000000/2)      /* 16.00 MHz */
812812   MDRV_CPU_PROGRAM_MAP(fromanc4_readmem_main,fromanc4_writemem_main)
813   MDRV_CPU_VBLANK_INT(fromanc2_interrupt,1)
813   MDRV_CPU_VBLANK_INT("left", fromanc2_interrupt)
814814
815815   MDRV_CPU_ADD(Z80,32000000/4)
816816   /* audio CPU */      /* 8.00 MHz */
src/mame/drivers/bombjack.c
r1877r1878
333333   /* basic machine hardware */
334334   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz */
335335   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
336   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
336   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
337337
338338   MDRV_CPU_ADD(Z80, 3072000)
339339   /* audio CPU */   /* 3.072 MHz????? */
340340   MDRV_CPU_PROGRAM_MAP(bombjack_sound_readmem,bombjack_sound_writemem)
341341   MDRV_CPU_IO_MAP(0,bombjack_sound_writeport)
342   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
342   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
343343
344344   MDRV_MACHINE_START(bombjack)
345345
src/mame/drivers/rallyx.c
r1877r1878
228228   switch (offset)
229229   {
230230      case 0x00:   /* BANG */
231         rallyx_bang_w(0,bit);
231         rallyx_bang_w(machine,0,bit);
232232         break;
233233
234234      case 0x01:   /* INT ON */
r1877r1878
272272   switch (offset)
273273   {
274274      case 0x00:   /* SOUNDON */
275         timeplt_sh_irqtrigger_w(0,bit);
275         timeplt_sh_irqtrigger_w(machine,0,bit);
276276         break;
277277
278278      case 0x01:   /* INTST */
r1877r1878
299299         break;
300300
301301      case 0x07:   /* STARSON */
302         tactcian_starson_w(offset,bit);
302         tactcian_starson_w(machine,offset,bit);
303303         break;
304304   }
305305}
r1877r1878
840840   MDRV_CPU_ADD(Z80, 18432000/6)   /* 3.072 MHz */
841841   MDRV_CPU_PROGRAM_MAP(rallyx_map,0)
842842   MDRV_CPU_IO_MAP(0,writeport)
843   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
843   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
844844
845845   /* video hardware */
846846   MDRV_VIDEO_ATTRIBUTES(VIDEO_HAS_SHADOWS)
r1877r1878
877877   /* basic machine hardware */
878878   MDRV_CPU_ADD(Z80, 18432000/6)   /* 3.072 MHz */
879879   MDRV_CPU_PROGRAM_MAP(jungler_map,0)
880   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
880   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
881881
882882   /* video hardware */
883883   MDRV_VIDEO_ATTRIBUTES(VIDEO_HAS_SHADOWS)
src/mame/drivers/trucocl.c
r1877r1878
4545
4646static WRITE8_HANDLER( irq_enable_w)
4747{
48   interrupt_enable_w( 0, (~data) & 1 );
48   interrupt_enable_w( machine, 0, (~data) & 1 );
4949}
5050
5151static int cur_dac_address = -1;
r1877r1878
145145   /* basic machine hardware */
146146   MDRV_CPU_ADD(Z80, 18432000/6)
147147   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
148   MDRV_CPU_VBLANK_INT(trucocl_interrupt,1)
148   MDRV_CPU_VBLANK_INT("main", trucocl_interrupt)
149149
150150   /* video hardware */
151151   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/igs_m68.c
r1877r1878
4141static MACHINE_DRIVER_START( igs_m68 )
4242   MDRV_CPU_ADD_TAG("main", M68000, 22000000 /2)    // 11mhz
4343   MDRV_CPU_PROGRAM_MAP(igs_m68_map,0)
44   //MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
44   //MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
4545
4646   //MDRV_GFXDECODE(igs_m68)
4747
src/mame/drivers/bnstars.c
r1877r1878
181181
182182/* ROZ Layers */
183183
184static void draw_roz(mame_bitmap *bitmap, const rectangle *cliprect,int priority, int chip)
184static void draw_roz(bitmap_t *bitmap, const rectangle *cliprect,int priority, int chip)
185185{
186186   /* TODO: registers 0x40/4 / 0x44/4 and 0x50/4 / 0x54/4 are used, meaning unknown */
187187
r1877r1878
326326static int flipscreen = 0;
327327
328328/* SPRITES based on tetrisp2 for now, readd priority bits later */
329static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, UINT32 *sprram_top, size_t sprram_size, int region)
329static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT32 *sprram_top, size_t sprram_size, int region)
330330{
331331/***************************************************************************
332332
r1877r1878
13391339   /* basic machine hardware */
13401340   MDRV_CPU_ADD(V70, 20000000) // 20MHz
13411341   MDRV_CPU_PROGRAM_MAP(bnstars_map,0)
1342   MDRV_CPU_VBLANK_INT(ms32_interrupt,32)
1342   MDRV_CPU_VBLANK_INT_HACK(ms32_interrupt,32)
13431343
13441344//  MDRV_CPU_ADD(Z80, 4000000) /* audio CPU */
13451345//  MDRV_CPU_PROGRAM_MAP(bnstars_z80_map, 0)
src/mame/drivers/unico.c
r1877r1878
2323***************************************************************************/
2424
2525#include "driver.h"
26#include "deprecat.h"
2726#include "machine/eeprom.h"
2827#include "unico.h"
2928#include "sound/2151intf.h"
r1877r1878
3837
3938***************************************************************************/
4039
41static READ16_HANDLER ( YM3812_status_port_0_msb_r )   {   return YM3812_status_port_0_r(0) << 8;   }
42static WRITE16_HANDLER( YM3812_register_port_0_msb_w )   {   if (ACCESSING_MSB)   YM3812_control_port_0_w(0,data >> 8);   }
43static WRITE16_HANDLER( YM3812_data_port_0_msb_w )      {   if (ACCESSING_MSB)   YM3812_write_port_0_w(0,data >> 8);      }
40static READ16_HANDLER ( YM3812_status_port_0_msb_r )   {   return YM3812_status_port_0_r(machine,0) << 8;   }
41static WRITE16_HANDLER( YM3812_register_port_0_msb_w )   {   if (ACCESSING_MSB)   YM3812_control_port_0_w(machine,0,data >> 8);   }
42static WRITE16_HANDLER( YM3812_data_port_0_msb_w )      {   if (ACCESSING_MSB)   YM3812_write_port_0_w(machine,0,data >> 8);      }
4443
4544
4645/*
r1877r1878
135134   if (x<0x160) x=0x30 + (x*0xd0/0x15f);
136135   else x=((x-0x160) * 0x20)/0x1f;
137136
138   return ((x&0xff) ^ (cpu_getcurrentframe()&1))<<8;
137   return ((x&0xff) ^ (video_screen_get_frame_number(0)&1))<<8;
139138}
140139
141140static READ16_HANDLER( unico_guny_0_msb_r )
r1877r1878
144143
145144   y=0x18+((y*0xe0)/0xff);
146145
147   return ((y&0xff) ^ (cpu_getcurrentframe()&1))<<8;
146   return ((y&0xff) ^ (video_screen_get_frame_number(0)&1))<<8;
148147}
149148
150149static READ16_HANDLER( unico_gunx_1_msb_r )
r1877r1878
155154   if (x<0x160) x=0x30 + (x*0xd0/0x15f);
156155   else x=((x-0x160) * 0x20)/0x1f;
157156
158   return ((x&0xff) ^ (cpu_getcurrentframe()&1))<<8;
157   return ((x&0xff) ^ (video_screen_get_frame_number(0)&1))<<8;
159158}
160159
161160static READ16_HANDLER( unico_guny_1_msb_r )
r1877r1878
164163
165164   y=0x18+((y*0xe0)/0xff);
166165
167   return ((y&0xff) ^ (cpu_getcurrentframe()&1))<<8;
166   return ((y&0xff) ^ (video_screen_get_frame_number(0)&1))<<8;
168167}
169168
170169static ADDRESS_MAP_START( readmem_zeropnt, ADDRESS_SPACE_PROGRAM, 16 )
r1877r1878
220219static READ32_HANDLER( zeropnt2_dsw2_r )         { return (readinputportbytag("DSW2") << 16) | 0xffff; }
221220static READ32_HANDLER( zeropnt2_buttons_r )         { return ((readinputportbytag("IN7") | ((EEPROM_read_bit() & 0x01) << 7)) << 16) | 0xffff; }
222221
223static READ32_HANDLER( zeropnt2_gunx_0_msb_r )      { return (unico_gunx_0_msb_r(0,0)-0x0800) << 16; }
224static READ32_HANDLER( zeropnt2_guny_0_msb_r )      { return (unico_guny_0_msb_r(0,0)+0x0800) << 16; }
225static READ32_HANDLER( zeropnt2_gunx_1_msb_r )      { return (unico_gunx_1_msb_r(0,0)-0x0800) << 16; }
226static READ32_HANDLER( zeropnt2_guny_1_msb_r )      { return (unico_guny_1_msb_r(0,0)+0x0800) << 16; }
222static READ32_HANDLER( zeropnt2_gunx_0_msb_r )      { return (unico_gunx_0_msb_r(machine,0,0)-0x0800) << 16; }
223static READ32_HANDLER( zeropnt2_guny_0_msb_r )      { return (unico_guny_0_msb_r(machine,0,0)+0x0800) << 16; }
224static READ32_HANDLER( zeropnt2_gunx_1_msb_r )      { return (unico_gunx_1_msb_r(machine,0,0)-0x0800) << 16; }
225static READ32_HANDLER( zeropnt2_guny_1_msb_r )      { return (unico_guny_1_msb_r(machine,0,0)+0x0800) << 16; }
227226
228static READ32_HANDLER ( zeropnt2_oki0_r )         { return OKIM6295_status_0_r(0) << 16; }
229static READ32_HANDLER ( zeropnt2_oki1_r )         { return OKIM6295_status_1_r(0) << 16; }
230static WRITE32_HANDLER( zeropnt2_oki0_w )         { if ((mem_mask & 0x00ff0000) == 0)   OKIM6295_data_0_w(0,(data >> 16) & 0xff); }
231static WRITE32_HANDLER( zeropnt2_oki1_w )         { if ((mem_mask & 0x00ff0000) == 0)   OKIM6295_data_1_w(0,(data >> 16) & 0xff); }
227static READ32_HANDLER ( zeropnt2_oki0_r )         { return OKIM6295_status_0_r(machine,0) << 16; }
228static READ32_HANDLER ( zeropnt2_oki1_r )         { return OKIM6295_status_1_r(machine,0) << 16; }
229static WRITE32_HANDLER( zeropnt2_oki0_w )         { if ((mem_mask & 0x00ff0000) == 0)   OKIM6295_data_0_w(machine,0,(data >> 16) & 0xff); }
230static WRITE32_HANDLER( zeropnt2_oki1_w )         { if ((mem_mask & 0x00ff0000) == 0)   OKIM6295_data_1_w(machine,0,(data >> 16) & 0xff); }
232231
233static READ32_HANDLER( zeropnt2_ym2151_status_r )   { return YM2151_status_port_0_r(0) << 16; }
234static WRITE32_HANDLER( zeropnt2_ym2151_reg_w )      { if ((mem_mask & 0x00ff0000) == 0)   YM2151_register_port_0_w(0,(data >> 16) & 0xff); }
235static WRITE32_HANDLER( zeropnt2_ym2151_data_w )   { if ((mem_mask & 0x00ff0000) == 0)   YM2151_data_port_0_w(0,(data >> 16) & 0xff); }
232static READ32_HANDLER( zeropnt2_ym2151_status_r )   { return YM2151_status_port_0_r(machine,0) << 16; }
233static WRITE32_HANDLER( zeropnt2_ym2151_reg_w )      { if ((mem_mask & 0x00ff0000) == 0)   YM2151_register_port_0_w(machine,0,(data >> 16) & 0xff); }
234static WRITE32_HANDLER( zeropnt2_ym2151_data_w )   { if ((mem_mask & 0x00ff0000) == 0)   YM2151_data_port_0_w(machine,0,(data >> 16) & 0xff); }
236235
237236static WRITE32_HANDLER( zeropnt2_sound_bank_w )
238237{
r1877r1878
677676   /* basic machine hardware */
678677   MDRV_CPU_ADD(M68000, 16000000)
679678   MDRV_CPU_PROGRAM_MAP(readmem_burglarx,writemem_burglarx)
680   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
679   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
681680
682681   MDRV_MACHINE_RESET(unico)
683682
r1877r1878
724723   /* basic machine hardware */
725724   MDRV_CPU_ADD(M68000, 16000000)
726725   MDRV_CPU_PROGRAM_MAP(readmem_zeropnt,writemem_zeropnt)
727   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
726   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
728727
729728   MDRV_MACHINE_RESET(zeropt)
730729
r1877r1878
766765   /* basic machine hardware */
767766   MDRV_CPU_ADD(M68EC020, 16000000)
768767   MDRV_CPU_PROGRAM_MAP(readmem_zeropnt2,writemem_zeropnt2)
769   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
768   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
770769
771770   MDRV_MACHINE_RESET(zeropt)
772771
src/mame/drivers/blockhl.c
r1877r1878
5454static WRITE8_HANDLER( bankedram_w )
5555{
5656   if (palette_selected)
57      paletteram_xBBBBBGGGGGRRRRR_be_w(offset,data);
57      paletteram_xBBBBBGGGGGRRRRR_be_w(machine,offset,data);
5858   else
5959      ram[offset] = data;
6060}
r1877r1878
222222   /* basic machine hardware */
223223   MDRV_CPU_ADD(KONAMI,3000000)      /* Konami custom 052526 */
224224   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
225   MDRV_CPU_VBLANK_INT(blockhl_interrupt,1)
225   MDRV_CPU_VBLANK_INT("main", blockhl_interrupt)
226226
227227   MDRV_CPU_ADD(Z80, 3579545)
228228   /* audio CPU */      /* ? */
src/mame/drivers/gcpinbal.c
r1877r1878
8181   switch (offset)
8282   {
8383      case 0x80/2:
84         return input_port_0_word_r(0,mem_mask);   /* DSW */
84         return input_port_0_word_r(machine,0,mem_mask);   /* DSW */
8585
8686      case 0x84/2:
87         return input_port_1_word_r(0,mem_mask);   /* IN0 */
87         return input_port_1_word_r(machine,0,mem_mask);   /* IN0 */
8888
8989      case 0x86/2:
90         return input_port_2_word_r(0,mem_mask);   /* IN1 */
90         return input_port_2_word_r(machine,0,mem_mask);   /* IN1 */
9191
9292      case 0x50:
9393      case 0x51:
94         return OKIM6295_status_0_r(0)<<8;
94         return OKIM6295_status_0_r(machine,0)<<8;
9595         break;
9696
9797   }
r1877r1878
149149      // OKIM6295
150150      case 0x50:
151151      case 0x51:
152         OKIM6295_data_0_w(0, data>>8);
152         OKIM6295_data_0_w(machine, 0, data>>8);
153153         break;
154154
155155      // MSM6585 ADPCM - mini emulation
r1877r1878
381381   /* basic machine hardware */
382382   MDRV_CPU_ADD_TAG("main", M68000, 32000000/2)   /* 16 MHz ? */
383383   MDRV_CPU_PROGRAM_MAP(gcpinbal_readmem,gcpinbal_writemem)
384   MDRV_CPU_VBLANK_INT(gcpinbal_interrupt,1)
384   MDRV_CPU_VBLANK_INT("main", gcpinbal_interrupt)
385385
386386   /* video hardware */
387387   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/realbrk.c
r1877r1878
7373   {
7474      case 0x00/2: return 0xffff;
7575      case 0x02/2: return 0xffff;
76      case 0x04/2: return input_port_0_word_r(0,0);/*Service buttons*/
77      case 0x06/2: return input_port_1_word_r(0,0);/*DIP 2*/
78      case 0x08/2: return input_port_2_word_r(0,0);/*DIP 1*/
79      case 0x0a/2: return input_port_3_word_r(0,0);/*DIP 1+2 Hi-Bits*/
80      case 0x0c/2: return input_port_4_word_r(0,0);/*Handle 1p*/
81      case 0x0e/2: return input_port_5_word_r(0,0);/*Buttons 1p*/
82      case 0x10/2: return input_port_6_word_r(0,0);/*Handle 2p*/
83      case 0x12/2: return input_port_7_word_r(0,0);/*Buttons 2p*/
76      case 0x04/2: return input_port_0_word_r(machine,0,0);/*Service buttons*/
77      case 0x06/2: return input_port_1_word_r(machine,0,0);/*DIP 2*/
78      case 0x08/2: return input_port_2_word_r(machine,0,0);/*DIP 1*/
79      case 0x0a/2: return input_port_3_word_r(machine,0,0);/*DIP 1+2 Hi-Bits*/
80      case 0x0c/2: return input_port_4_word_r(machine,0,0);/*Handle 1p*/
81      case 0x0e/2: return input_port_5_word_r(machine,0,0);/*Buttons 1p*/
82      case 0x10/2: return input_port_6_word_r(machine,0,0);/*Handle 2p*/
83      case 0x12/2: return input_port_7_word_r(machine,0,0);/*Buttons 2p*/
8484   }
8585   return 0xffff;
8686}
r1877r1878
9292   switch(offset)
9393   {
9494      case 0x00/2: return 0xffff;
95      case 0x02/2: return input_port_0_word_r(0,0);/*Service buttons*/
95      case 0x02/2: return input_port_0_word_r(machine,0,0);/*Service buttons*/
9696      /*DSW,same handling as realbrk*/
9797      case 0x04/2:
98         if (sel & 0x01)   return   (input_port_1_word_r(0,0) & 0x00ff) << 8;      // DSW1 low bits
99         if (sel & 0x02)   return   (input_port_2_word_r(0,0) & 0x00ff) << 8;      // DSW2 low bits
100         if (sel & 0x04)   return   (input_port_3_word_r(0,0) & 0x00ff) << 8;      // DSW3 low bits
101         if (sel & 0x08)   return   (input_port_4_word_r(0,0) & 0x00ff) << 8;      // DSW4 low bits
98         if (sel & 0x01)   return   (input_port_1_word_r(machine,0,0) & 0x00ff) << 8;      // DSW1 low bits
99         if (sel & 0x02)   return   (input_port_2_word_r(machine,0,0) & 0x00ff) << 8;      // DSW2 low bits
100         if (sel & 0x04)   return   (input_port_3_word_r(machine,0,0) & 0x00ff) << 8;      // DSW3 low bits
101         if (sel & 0x08)   return   (input_port_4_word_r(machine,0,0) & 0x00ff) << 8;      // DSW4 low bits
102102
103         if (sel & 0x10)   return   ((input_port_1_word_r(0,0) & 0x0300) << 0) |   // DSWs high 2 bits
104                           ((input_port_2_word_r(0,0) & 0x0300) << 2) |
105                           ((input_port_3_word_r(0,0) & 0x0300) << 4) |
106                           ((input_port_4_word_r(0,0) & 0x0300) << 6) ;
103         if (sel & 0x10)   return   ((input_port_1_word_r(machine,0,0) & 0x0300) << 0) |   // DSWs high 2 bits
104                           ((input_port_2_word_r(machine,0,0) & 0x0300) << 2) |
105                           ((input_port_3_word_r(machine,0,0) & 0x0300) << 4) |
106                           ((input_port_4_word_r(machine,0,0) & 0x0300) << 6) ;
107107
108108         return 0xffff;
109      case 0x06/2: return input_port_6_word_r(0,0);/*Buttons+Handle 2p*/
110      case 0x08/2: return input_port_5_word_r(0,0);/*Buttons+Handle 1p*/
109      case 0x06/2: return input_port_6_word_r(machine,0,0);/*Buttons+Handle 2p*/
110      case 0x08/2: return input_port_5_word_r(machine,0,0);/*Buttons+Handle 1p*/
111111      case 0x0a/2: return 0xffff;
112112      case 0x0c/2: return 0xffff;
113113      case 0x0e/2: return 0xffff;
r1877r1878
683683   /* basic machine hardware */
684684   MDRV_CPU_ADD_TAG("main",M68000,32000000 / 2)         /* !! TMP68301 !! */
685685   MDRV_CPU_PROGRAM_MAP(base_mem,realbrk_mem)
686   MDRV_CPU_VBLANK_INT(realbrk_interrupt,1)
686   MDRV_CPU_VBLANK_INT("main", realbrk_interrupt)
687687
688688   MDRV_MACHINE_RESET( tmp68301 )
689689
src/mame/drivers/diverboy.c
r1877r1878
6161{
6262   if (ACCESSING_LSB)
6363   {
64      soundlatch_w(0,data & 0xff);
65      cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
64      soundlatch_w(machine,0,data & 0xff);
65      cpunum_set_input_line(machine, 1,0,HOLD_LINE);
6666   }
6767}
6868
r1877r1878
195195static MACHINE_DRIVER_START( diverboy )
196196   MDRV_CPU_ADD(M68000, 12000000) /* guess */
197197   MDRV_CPU_PROGRAM_MAP(diverboy_readmem,diverboy_writemem)
198   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
198   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
199199
200200   MDRV_CPU_ADD(Z80, 4000000)
201201   /* audio CPU */
src/mame/drivers/arcadia.c
r1877r1878
7878
7979/*************************************
8080 *
81 *  Special port handlers
82 *
83 *************************************/
84
85static CUSTOM_INPUT( arcadia_coin_counter_r )
86{
87   /* return coin counter values */
88   return *(UINT8 *)param & 3;
89}
90
91
92
93/*************************************
94 *
9581 *  CIA-A port A access:
9682 *
9783 *  PA7 = game port 1, pin 6 (fire)
r1877r1878
170156 *
171157 *************************************/
172158
173static void coin_changed_callback(void *param, UINT32 oldval, UINT32 newval)
159static CUSTOM_INPUT( coin_counter_r )
174160{
161   /* return coin counter values */
162   return *(UINT8 *)param & 3;
163}
164
165
166static INPUT_CHANGED( coin_changed_callback )
167{
175168   UINT8 *counter = param;
176169
177170   /* check for a 0 -> 1 transition */
r1877r1878
230223   PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
231224   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
232225   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
233   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(arcadia_coin_counter_r, &coin_counter[0])
234   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(arcadia_coin_counter_r, &coin_counter[1])
226   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(coin_counter_r, &coin_counter[0])
227   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(coin_counter_r, &coin_counter[1])
235228
236229   PORT_START_TAG("JOY0DAT")
237230   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(amiga_joystick_convert, "P1JOY")
r1877r1878
261254   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
262255
263256   PORT_START_TAG("COINS")
264   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
265   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
257   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(coin_changed_callback, &coin_counter[0])
258   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_CHANGED(coin_changed_callback, &coin_counter[1])
266259INPUT_PORTS_END
267260
268261
r1877r1878
291284   /* basic machine hardware */
292285   MDRV_CPU_ADD(M68000, AMIGA_68000_NTSC_CLOCK)
293286   MDRV_CPU_PROGRAM_MAP(amiga_map,0)
294   MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 262)
295287
296288   MDRV_MACHINE_RESET(amiga)
297289   MDRV_NVRAM_HANDLER(generic_0fill)
r1877r1878
309301   MDRV_PALETTE_INIT(amiga)
310302
311303   MDRV_VIDEO_START(amiga)
312   MDRV_VIDEO_UPDATE(generic_bitmapped)
304   MDRV_VIDEO_UPDATE(amiga)
313305
314306   /* sound hardware */
315307   MDRV_SPEAKER_STANDARD_STEREO("left", "right")
r1877r1878
684676   biosrom = (UINT16 *)memory_region(REGION_USER2);
685677   if (biosrom[0] != 0x4afc)
686678      generic_decode(REGION_USER2, 6, 1, 0, 2, 3, 4, 5, 7);
687
688   /* request notifications when the coins change */
689   input_port_set_changed_callback(port_tag_to_index("COINS"), 0x01, coin_changed_callback, &coin_counter[0]);
690   input_port_set_changed_callback(port_tag_to_index("COINS"), 0x02, coin_changed_callback, &coin_counter[1]);
691679}
692680
693681
src/mame/drivers/segag80v.c
r1877r1878
133133***************************************************************************/
134134
135135#include "driver.h"
136#include "deprecat.h"
137136#include "sound/ay8910.h"
138137#include "sound/samples.h"
139138#include "audio/segasnd.h"
r1877r1878
179178 *
180179 *************************************/
181180
182static void service_switch(void *param, UINT32 oldval, UINT32 newval)
181static INPUT_CHANGED( service_switch )
183182{
184183   /* pressing the service switch sends an NMI */
185184   if (newval)
186      cpunum_set_input_line(Machine, 0, INPUT_LINE_NMI, PULSE_LINE);
185      cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
187186}
188187
189188
190189static MACHINE_START( g80v )
191190{
192   /* request a callback if the service switch is pressed */
193   input_port_set_changed_callback(port_tag_to_index("SERVICESW"), 0x01, service_switch, NULL);
194
195191   /* register for save states */
196192   state_save_register_global_array(mult_data);
197193   state_save_register_global(mult_result);
r1877r1878
234230}
235231
236232static WRITE8_HANDLER( mainram_w ) { mainram[decrypt_offset(offset)] = data; }
237static WRITE8_HANDLER( usb_ram_w ) { sega_usb_ram_w(decrypt_offset(offset), data); }
233static WRITE8_HANDLER( usb_ram_w ) { sega_usb_ram_w(machine, decrypt_offset(offset), data); }
238234static WRITE8_HANDLER( vectorram_w ) { vectorram[decrypt_offset(offset)] = data; }
239235
240236
r1877r1878
508504   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )            /* P1.30 */
509505
510506   PORT_START_TAG("SERVICESW")
511   PORT_SERVICE_NO_TOGGLE( 0x01, IP_ACTIVE_HIGH )
507   PORT_SERVICE_NO_TOGGLE( 0x01, IP_ACTIVE_HIGH ) PORT_CHANGED(service_switch, 0)
512508INPUT_PORTS_END
513509
514510
r1877r1878
914910   MDRV_CPU_ADD(Z80, CPU_CLOCK/2)
915911   MDRV_CPU_PROGRAM_MAP(main_map,0)
916912   MDRV_CPU_IO_MAP(main_portmap,0)
917   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
913   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
918914
919915   MDRV_MACHINE_START(g80v)
920916   MDRV_MACHINE_RESET(g80v)
src/mame/drivers/carjmbre.c
r1877r1878
186186   /* basic machine hardware */
187187   MDRV_CPU_ADD(Z80,18432000/6)
188188   MDRV_CPU_PROGRAM_MAP(carjmbre_readmem,carjmbre_writemem)
189   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
189   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
190190
191191   MDRV_CPU_ADD(Z80, 1500000)
192192   /* audio CPU */
193193   MDRV_CPU_PROGRAM_MAP(carjmbre_sound_readmem,carjmbre_sound_writemem)
194194   MDRV_CPU_IO_MAP(carjmbre_sound_readport,carjmbre_sound_writeport)
195   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
195   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
196196
197197   /* video hardware */
198198   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/vmetal.c
r1877r1878
9292
9393/* video/metro.c */
9494extern UINT16 *metro_videoregs;
95void metro_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect);
95void metro_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
9696WRITE16_HANDLER( metro_paletteram_w );
9797
9898static READ16_HANDLER ( varia_crom_read )
r1877r1878
208208    16   002a 000e 0083 00ee 000f 0069 0069   0e832a-0f69ee
209209    */
210210
211   ES8712_data_0_lsb_w(offset, data, mem_mask);
211   ES8712_data_0_lsb_w(machine, offset, data, mem_mask);
212212   logerror("PC:%06x - Writing %04x to ES8712 offset %02x\n",activecpu_get_previouspc(),data,offset);
213213}
214214
r1877r1878
427427static MACHINE_DRIVER_START( varia )
428428   MDRV_CPU_ADD(M68000, 16000000)
429429   MDRV_CPU_PROGRAM_MAP(varia_program_map, 0)
430   MDRV_CPU_VBLANK_INT(irq1_line_hold,1) // also level 3
430   MDRV_CPU_VBLANK_INT("main", irq1_line_hold) // also level 3
431431
432432
433433   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/superchs.c
r1877r1878
116116   switch (offset)
117117   {
118118      case 0x00:
119         return (input_port_0_word_r(0,0) << 16) | input_port_1_word_r(0,0) |
119         return (input_port_0_word_r(machine,0,0) << 16) | input_port_1_word_r(machine,0,0) |
120120              (EEPROM_read_bit() << 7);
121121
122122      case 0x01:
r1877r1878
145145      {
146146         if (ACCESSING_MSB32)   /* $300000 is watchdog */
147147         {
148            watchdog_reset_w(0,data >> 24);
148            watchdog_reset(machine);
149149         }
150150
151151         if (ACCESSING_LSB32)
r1877r1878
177177
178178static READ32_HANDLER( superchs_stick_r )
179179{
180   int fake = input_port_6_word_r(0,0);
180   int fake = input_port_6_word_r(machine,0,0);
181181   int accel;
182182
183183   if (!(fake &0x10))   /* Analogue steer (the real control method) */
184184   {
185      steer = input_port_2_word_r(0,0);
185      steer = input_port_2_word_r(machine,0,0);
186186   }
187187   else   /* Digital steer, with smoothing - speed depends on how often stick_r is called */
188188   {
r1877r1878
207207   }
208208
209209   /* Accelerator is an analogue input but the game treats it as digital (on/off) */
210   if (input_port_6_word_r(0,0) & 0x1)   /* pressing B1 */
210   if (input_port_6_word_r(machine,0,0) & 0x1)   /* pressing B1 */
211211      accel = 0x0;
212212   else
213213      accel = 0xff;
214214
215215   /* Todo: Verify brake - and figure out other input */
216   return (steer << 24) | (accel << 16) | (input_port_4_word_r(0,0) << 8) | input_port_5_word_r(0,0);
216   return (steer << 24) | (accel << 16) | (input_port_4_word_r(machine,0,0) << 8) | input_port_5_word_r(machine,0,0);
217217}
218218
219219static WRITE32_HANDLER( superchs_stick_w )
r1877r1878
417417   /* basic machine hardware */
418418   MDRV_CPU_ADD(M68EC020, 16000000)   /* 16 MHz */
419419   MDRV_CPU_PROGRAM_MAP(superchs_readmem,superchs_writemem)
420   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)/* VBL */
420   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)/* VBL */
421421
422422   TAITO_F3_SOUND_SYSTEM_CPU(16000000)
423423
424424
425425   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
426426   MDRV_CPU_PROGRAM_MAP(superchs_cpub_readmem,superchs_cpub_writemem)
427   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)/* VBL */
427   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)/* VBL */
428428
429429   MDRV_INTERLEAVE(8)   /* CPU slices - Need to interleave Cpu's 1 & 3 */
430430
src/mame/drivers/bottom9.c
r1877r1878
3434static READ8_HANDLER( bottom9_bankedram1_r )
3535{
3636   if (K052109_selected)
37      return K052109_051960_r(offset);
37      return K052109_051960_r(machine,offset);
3838   else
3939   {
4040      if (zoomreadroms)
41         return K051316_rom_0_r(offset);
41         return K051316_rom_0_r(machine,offset);
4242      else
43         return K051316_0_r(offset);
43         return K051316_0_r(machine,offset);
4444   }
4545}
4646
4747static WRITE8_HANDLER( bottom9_bankedram1_w )
4848{
49   if (K052109_selected) K052109_051960_w(offset,data);
50   else K051316_0_w(offset,data);
49   if (K052109_selected) K052109_051960_w(machine,offset,data);
50   else K051316_0_w(machine,offset,data);
5151}
5252
5353static READ8_HANDLER( bottom9_bankedram2_r )
5454{
55   if (K052109_selected) return K052109_051960_r(offset + 0x2000);
55   if (K052109_selected) return K052109_051960_r(machine,offset + 0x2000);
5656   else return paletteram[offset];
5757}
5858
5959static WRITE8_HANDLER( bottom9_bankedram2_w )
6060{
61   if (K052109_selected) K052109_051960_w(offset + 0x2000,data);
62   else paletteram_xBBBBBGGGGGRRRRR_be_w(offset,data);
61   if (K052109_selected) K052109_051960_w(machine,offset + 0x2000,data);
62   else paletteram_xBBBBBGGGGGRRRRR_be_w(machine,offset,data);
6363}
6464
6565static WRITE8_HANDLER( bankswitch_w )
r1877r1878
403403   /* basic machine hardware */
404404   MDRV_CPU_ADD(M6809, 2000000) /* ? */
405405   MDRV_CPU_PROGRAM_MAP(bottom9_readmem,bottom9_writemem)
406   MDRV_CPU_VBLANK_INT(bottom9_interrupt,1)
406   MDRV_CPU_VBLANK_INT("main", bottom9_interrupt)
407407
408408   MDRV_CPU_ADD(Z80, 3579545)
409409   /* audio CPU */
410410   MDRV_CPU_PROGRAM_MAP(bottom9_sound_readmem,bottom9_sound_writemem)
411   MDRV_CPU_VBLANK_INT(bottom9_sound_interrupt,8)   /* irq is triggered by the main CPU */
411   MDRV_CPU_VBLANK_INT_HACK(bottom9_sound_interrupt,8)   /* irq is triggered by the main CPU */
412412
413413   /* video hardware */
414414   MDRV_VIDEO_ATTRIBUTES(VIDEO_HAS_SHADOWS)
src/mame/drivers/flower.c
r1877r1878
8080
8181static WRITE8_HANDLER( sound_command_w )
8282{
83   soundlatch_w(0,data);
83   soundlatch_w(machine,0,data);
8484   if (sn_nmi_enable)
85      cpunum_set_input_line(Machine, 2, INPUT_LINE_NMI, PULSE_LINE);
85      cpunum_set_input_line(machine, 2, INPUT_LINE_NMI, PULSE_LINE);
8686}
8787
8888static ADDRESS_MAP_START( flower_cpu1, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
235235   /* basic machine hardware */
236236   MDRV_CPU_ADD(Z80,8000000)
237237   MDRV_CPU_PROGRAM_MAP(flower_cpu1,0)
238   MDRV_CPU_VBLANK_INT(irq0_line_hold,10)
239//  MDRV_CPU_VBLANK_INT(nmi_line_pulse,1) //nmis stuff up the writes to shared ram
238   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,10)
239//  MDRV_CPU_VBLANK_INT("main", nmi_line_pulse) //nmis stuff up the writes to shared ram
240240
241241   MDRV_CPU_ADD(Z80,8000000)
242242   MDRV_CPU_PROGRAM_MAP(flower_cpu2,0)
243   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
244//  MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
243   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
244//  MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
245245
246246   MDRV_CPU_ADD(Z80,8000000)
247247   MDRV_CPU_PROGRAM_MAP(flower_sound_cpu,0)
src/mame/drivers/battlera.c
r1877r1878
4747static WRITE8_HANDLER( battlera_sound_w )
4848{
4949   if (offset==0) {
50      soundlatch_w(0,data);
51      cpunum_set_input_line(Machine, 1, 0, HOLD_LINE);
50      soundlatch_w(machine,0,data);
51      cpunum_set_input_line(machine, 1, 0, HOLD_LINE);
5252   }
5353}
5454
r1877r1878
104104static WRITE8_HANDLER( YM2203_w )
105105{
106106   switch (offset) {
107   case 0: YM2203_control_port_0_w(0,data); break;
108   case 1: YM2203_write_port_0_w(0,data); break;
107   case 0: YM2203_control_port_0_w(machine,0,data); break;
108   case 1: YM2203_write_port_0_w(machine,0,data); break;
109109   }
110110}
111111
r1877r1878
274274   MDRV_CPU_ADD(H6280,21477200/3)
275275   MDRV_CPU_PROGRAM_MAP(battlera_readmem,battlera_writemem)
276276   MDRV_CPU_IO_MAP(0,battlera_portwrite)
277   MDRV_CPU_VBLANK_INT(battlera_interrupt,256) /* 8 prelines, 232 lines, 16 vblank? */
277   MDRV_CPU_VBLANK_INT_HACK(battlera_interrupt,256) /* 8 prelines, 232 lines, 16 vblank? */
278278
279279   MDRV_CPU_ADD(H6280,21477200/3)
280280   /* audio CPU */
src/mame/drivers/dreamwld.c
r1877r1878
5151static tilemap *dreamwld_bg_tilemap;
5252static tilemap *dreamwld_bg2_tilemap;
5353
54static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
54static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
5555{
5656   const gfx_element *gfx = machine->gfx[0];
5757   UINT32 *source = spriteram32;
r1877r1878
221221
222222static READ32_HANDLER(dreamwld_6295_0_r)
223223{
224   return OKIM6295_status_0_r(0)<<24;
224   return OKIM6295_status_0_r(machine, 0)<<24;
225225}
226226
227227static WRITE32_HANDLER(dreamwld_6295_0_w)
228228{
229229   if (!(mem_mask & 0xff000000))
230230   {
231      OKIM6295_data_0_w(0, (data>>24) & 0xff);
231      OKIM6295_data_0_w(machine, 0, (data>>24) & 0xff);
232232   }
233233   else
234234   {
r1877r1878
260260
261261static READ32_HANDLER(dreamwld_6295_1_r)
262262{
263   return OKIM6295_status_1_r(0)<<24;
263   return OKIM6295_status_1_r(machine, 0)<<24;
264264}
265265
266266static WRITE32_HANDLER(dreamwld_6295_1_w)
267267{
268268   if (!(mem_mask & 0xff000000))
269269   {
270      OKIM6295_data_1_w(0, (data>>24) & 0xff);
270      OKIM6295_data_1_w(machine, 0, (data>>24) & 0xff);
271271   }
272272   else
273273   {
r1877r1878
448448   /* basic machine hardware */
449449   MDRV_CPU_ADD(M68EC020, MASTER_CLOCK/2)
450450   MDRV_CPU_PROGRAM_MAP(dreamwld_map, 0)
451   MDRV_CPU_VBLANK_INT(irq4_line_hold,1) // 4, 5, or 6, all point to the same place
451   MDRV_CPU_VBLANK_INT("main", irq4_line_hold) // 4, 5, or 6, all point to the same place
452452
453453   /* video hardware */
454454   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/xain.c
r1877r1878
199199
200200static WRITE8_HANDLER( xain_sound_command_w )
201201{
202   soundlatch_w(offset,data);
203   cpunum_set_input_line(Machine, 2,M6809_IRQ_LINE,HOLD_LINE);
202   soundlatch_w(machine,offset,data);
203   cpunum_set_input_line(machine, 2,M6809_IRQ_LINE,HOLD_LINE);
204204}
205205
206206static WRITE8_HANDLER( xain_main_irq_w )
r1877r1878
267267      vblank=0;
268268}
269269
270static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
271   AM_RANGE(0x0000, 0x1fff) AM_READ(xain_sharedram_r)
270static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
271   AM_RANGE(0x0000, 0x1fff) AM_READWRITE(xain_sharedram_r, xain_sharedram_w) AM_BASE(&xain_sharedram)
272272   AM_RANGE(0x2000, 0x37ff) AM_READ(MRA8_RAM)
273   AM_RANGE(0x2000, 0x27ff) AM_WRITE(xain_charram_w) AM_BASE(&xain_charram)
274   AM_RANGE(0x2800, 0x2fff) AM_WRITE(xain_bgram1_w) AM_BASE(&xain_bgram1)
275   AM_RANGE(0x3000, 0x37ff) AM_WRITE(xain_bgram0_w) AM_BASE(&xain_bgram0)
276   AM_RANGE(0x3800, 0x397f) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
273277   AM_RANGE(0x3a00, 0x3a00) AM_READ(input_port_0_r)
278   AM_RANGE(0x3a00, 0x3a01) AM_WRITE(xain_scrollxP1_w)
274279   AM_RANGE(0x3a01, 0x3a01) AM_READ(input_port_1_r)
275280   AM_RANGE(0x3a02, 0x3a02) AM_READ(input_port_2_r)
281   AM_RANGE(0x3a02, 0x3a03) AM_WRITE(xain_scrollyP1_w)
276282   AM_RANGE(0x3a03, 0x3a03) AM_READ(input_port_3_r)
277283   AM_RANGE(0x3a04, 0x3a04) AM_READ(xain_68705_r)   /* from the 68705 */
284   AM_RANGE(0x3a04, 0x3a05) AM_WRITE(xain_scrollxP0_w)
278285   AM_RANGE(0x3a05, 0x3a05) AM_READ(xain_input_port_4_r)
279286//  AM_RANGE(0x3a06, 0x3a06) AM_READ(MRA8_NOP)  /* ?? read (and discarded) on startup. Maybe reset the 68705 */
280   AM_RANGE(0x4000, 0x7fff) AM_READ(MRA8_BANK1)
281   AM_RANGE(0x8000, 0xffff) AM_READ(MRA8_ROM)
282ADDRESS_MAP_END
283
284static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
285   AM_RANGE(0x0000, 0x1fff) AM_WRITE(xain_sharedram_w) AM_BASE(&xain_sharedram)
286   AM_RANGE(0x2000, 0x27ff) AM_WRITE(xain_charram_w) AM_BASE(&xain_charram)
287   AM_RANGE(0x2800, 0x2fff) AM_WRITE(xain_bgram1_w) AM_BASE(&xain_bgram1)
288   AM_RANGE(0x3000, 0x37ff) AM_WRITE(xain_bgram0_w) AM_BASE(&xain_bgram0)
289   AM_RANGE(0x3800, 0x397f) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
290   AM_RANGE(0x3a00, 0x3a01) AM_WRITE(xain_scrollxP1_w)
291   AM_RANGE(0x3a02, 0x3a03) AM_WRITE(xain_scrollyP1_w)
292   AM_RANGE(0x3a04, 0x3a05) AM_WRITE(xain_scrollxP0_w)
293287   AM_RANGE(0x3a06, 0x3a07) AM_WRITE(xain_scrollyP0_w)
294288   AM_RANGE(0x3a08, 0x3a08) AM_WRITE(xain_sound_command_w)
295289   AM_RANGE(0x3a09, 0x3a0c) AM_WRITE(xain_main_irq_w)
r1877r1878
298292   AM_RANGE(0x3a0f, 0x3a0f) AM_WRITE(xainCPUA_bankswitch_w)
299293   AM_RANGE(0x3c00, 0x3dff) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split1_w) AM_BASE(&paletteram)
300294   AM_RANGE(0x3e00, 0x3fff) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_split2_w) AM_BASE(&paletteram_2)
301   AM_RANGE(0x4000, 0xffff) AM_WRITE(MWA8_ROM)
295   AM_RANGE(0x4000, 0x7fff) AM_READ(MRA8_BANK1)
296   AM_RANGE(0x4000, 0xffff) AM_ROM
302297ADDRESS_MAP_END
303298
304static ADDRESS_MAP_START( readmemB, ADDRESS_SPACE_PROGRAM, 8 )
305   AM_RANGE(0x0000, 0x1fff) AM_READ(xain_sharedram_r)
306   AM_RANGE(0x4000, 0x7fff) AM_READ(MRA8_BANK2)
307   AM_RANGE(0x8000, 0xffff) AM_READ(MRA8_ROM)
308ADDRESS_MAP_END
309
310static ADDRESS_MAP_START( writememB, ADDRESS_SPACE_PROGRAM, 8 )
311   AM_RANGE(0x0000, 0x1fff) AM_WRITE(xain_sharedram_w)
299static ADDRESS_MAP_START( cpu_map_B, ADDRESS_SPACE_PROGRAM, 8 )
300   AM_RANGE(0x0000, 0x1fff) AM_READWRITE(xain_sharedram_r, xain_sharedram_w)
312301   AM_RANGE(0x2000, 0x2000) AM_WRITE(xain_irqA_assert_w)
313302   AM_RANGE(0x2800, 0x2800) AM_WRITE(xain_irqB_clear_w)
314303   AM_RANGE(0x3000, 0x3000) AM_WRITE(xainCPUB_bankswitch_w)
315   AM_RANGE(0x4000, 0xffff) AM_WRITE(MWA8_ROM)
304   AM_RANGE(0x4000, 0x7fff) AM_READ(MRA8_BANK2)
305   AM_RANGE(0x4000, 0xffff) AM_ROM
316306ADDRESS_MAP_END
317307
318308#if 0
319static ADDRESS_MAP_START( mcu_readmem, ADDRESS_SPACE_PROGRAM, 8 )
320   AM_RANGE(0x0010, 0x007f) AM_READ(MRA8_RAM)
321   AM_RANGE(0x0080, 0x07ff) AM_READ(MRA8_ROM)
309static ADDRESS_MAP_START( mcu_map, ADDRESS_SPACE_PROGRAM, 8 )
310   AM_RANGE(0x0010, 0x007f) AM_RAM
311   AM_RANGE(0x0080, 0x07ff) AM_ROM
322312ADDRESS_MAP_END
323
324static ADDRESS_MAP_START( mcu_writemem, ADDRESS_SPACE_PROGRAM, 8 )
325   AM_RANGE(0x0010, 0x007f) AM_WRITE(MWA8_RAM)
326   AM_RANGE(0x0080, 0x07ff) AM_WRITE(MWA8_ROM)
327ADDRESS_MAP_END
328313#endif
329314
330static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
331   AM_RANGE(0x0000, 0x07ff) AM_READ(MRA8_RAM)
315static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
316   AM_RANGE(0x0000, 0x07ff) AM_RAM
332317   AM_RANGE(0x1000, 0x1000) AM_READ(soundlatch_r)
333   AM_RANGE(0x8000, 0xffff) AM_READ(MRA8_ROM)
334ADDRESS_MAP_END
335
336static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
337   AM_RANGE(0x0000, 0x07ff) AM_WRITE(MWA8_RAM)
338318   AM_RANGE(0x2800, 0x2800) AM_WRITE(YM2203_control_port_0_w)
339319   AM_RANGE(0x2801, 0x2801) AM_WRITE(YM2203_write_port_0_w)
340320   AM_RANGE(0x3000, 0x3000) AM_WRITE(YM2203_control_port_1_w)
341321   AM_RANGE(0x3001, 0x3001) AM_WRITE(YM2203_write_port_1_w)
342   AM_RANGE(0x4000, 0xffff) AM_WRITE(MWA8_ROM)
322   AM_RANGE(0x4000, 0xffff) AM_ROM
343323ADDRESS_MAP_END
344324
345
346
347325static INPUT_PORTS_START( xsleena )
348326   PORT_START_TAG("IN0")
349327   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
r1877r1878
468446static MACHINE_START( xsleena )
469447{
470448   /* initialize the bank pointers */
471   xainCPUA_bankswitch_w(0,0);
472   xainCPUB_bankswitch_w(0,0);
449   xainCPUA_bankswitch_w(machine,0,0);
450   xainCPUB_bankswitch_w(machine,0,0);
473451}
474452
475453
r1877r1878
477455
478456   /* basic machine hardware */
479457   MDRV_CPU_ADD(M6809, 1500000)   /* Confirmed 1.5MHz */
480   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
481   MDRV_CPU_VBLANK_INT(xain_interrupt,256)
458   MDRV_CPU_PROGRAM_MAP(main_map,0)
459   MDRV_CPU_VBLANK_INT_HACK(xain_interrupt,256)
482460
483461   MDRV_CPU_ADD(M6809, 1500000)   /* Confirmed 1.5MHz */
484   MDRV_CPU_PROGRAM_MAP(readmemB,writememB)
462   MDRV_CPU_PROGRAM_MAP(cpu_map_B,0)
485463
486464   MDRV_CPU_ADD(M6809, 1500000)   /* Confirmed 1.5MHz */
487465   /* audio CPU */
488   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
466   MDRV_CPU_PROGRAM_MAP(sound_map,0)
489467
490468//  MDRV_CPU_ADD(M68705, 3000000)    /* Confirmed 3MHz */
491//  MDRV_CPU_PROGRAM_MAP(mcu_readmem,mcu_writemem)
469//  MDRV_CPU_PROGRAM_MAP(mcu_map,0)
492470
493471   MDRV_MACHINE_START(xsleena)
494472
src/mame/drivers/gundealr.c
r1877r1878
465465   MDRV_CPU_ADD(Z80, 8000000)   /* 8 MHz ??? */
466466   MDRV_CPU_PROGRAM_MAP(main_map,0)
467467   MDRV_CPU_IO_MAP(main_portmap,0)
468   MDRV_CPU_VBLANK_INT(yamyam_interrupt,4)   /* ? */
468   MDRV_CPU_VBLANK_INT_HACK(yamyam_interrupt,4)   /* ? */
469469
470470   /* video hardware */
471471   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/mrdo.c
r1877r1878
178178   /* basic machine hardware */
179179   MDRV_CPU_ADD(Z80,8000000/2)   /* 4 MHz */
180180   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
181   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
181   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
182182
183183   /* video hardware */
184184   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/namcos1.c
r1877r1878
998998   /* basic machine hardware */
999999   MDRV_CPU_ADD(M6809,49152000/32)
10001000   MDRV_CPU_PROGRAM_MAP(main_map, 0)
1001   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
1001   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
10021002
10031003   MDRV_CPU_ADD(M6809,49152000/32)
10041004   MDRV_CPU_PROGRAM_MAP(sub_map, 0)
1005   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
1005   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
10061006
10071007   MDRV_CPU_ADD(M6809,49152000/32)
10081008   MDRV_CPU_PROGRAM_MAP(sound_map, 0)
1009   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
1009   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
10101010
10111011   MDRV_CPU_ADD_TAG("MCU",HD63701,49152000/8)
10121012   MDRV_CPU_PROGRAM_MAP(mcu_map, 0)
10131013   MDRV_CPU_IO_MAP(mcu_port_map, 0)
1014   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
1014   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
10151015
10161016   // heavy sync required to prevent CPUs from fighting for video RAM access and going into deadlocks
10171017   MDRV_INTERLEAVE(640)
src/mame/drivers/mainevt.c
r1877r1878
9797   upd7759_reset_w(0, data & 2);
9898   upd7759_start_w(0, data & 1);
9999
100   interrupt_enable_w(0,data & 4);
100   interrupt_enable_w(machine,0,data & 4);
101101}
102102
103103static WRITE8_HANDLER( devstor_sh_irqcontrol_w )
104104{
105interrupt_enable_w(0,data & 4);
105   interrupt_enable_w(machine,0,data & 4);
106106}
107107
108108static WRITE8_HANDLER( mainevt_sh_bankswitch_w )
r1877r1878
709709   /* basic machine hardware */
710710   MDRV_CPU_ADD(HD6309, 3000000*4)   /* ?? */
711711   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
712   MDRV_CPU_VBLANK_INT(mainevt_interrupt,1)
712   MDRV_CPU_VBLANK_INT("main", mainevt_interrupt)
713713
714714   MDRV_CPU_ADD(Z80, 3579545)
715715   /* audio CPU */   /* 3.579545 MHz */
716716   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
717   MDRV_CPU_VBLANK_INT(nmi_line_pulse,8)   /* ??? */
717   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,8)   /* ??? */
718718
719719   /* video hardware */
720720   MDRV_VIDEO_ATTRIBUTES(VIDEO_HAS_SHADOWS)
r1877r1878
750750   /* basic machine hardware */
751751   MDRV_CPU_ADD(HD6309, 3000000*4)   /* ?? */
752752   MDRV_CPU_PROGRAM_MAP(dv_readmem,dv_writemem)
753   MDRV_CPU_VBLANK_INT(dv_interrupt,1)
753   MDRV_CPU_VBLANK_INT("main", dv_interrupt)
754754
755755   MDRV_CPU_ADD(Z80, 3579545)
756756   /* audio CPU */   /* 3.579545 MHz */
757757   MDRV_CPU_PROGRAM_MAP(dv_sound_readmem,dv_sound_writemem)
758   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)
758   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)
759759
760760   /* video hardware */
761761   MDRV_VIDEO_ATTRIBUTES(VIDEO_HAS_SHADOWS)
src/mame/drivers/m62.c
r1877r1878
13081308   MDRV_CPU_ADD_TAG("main", Z80, 24000000/6)
13091309   MDRV_CPU_PROGRAM_MAP(ldrun_readmem,ldrun_writemem)
13101310   MDRV_CPU_IO_MAP(kungfum_readport,kungfum_writeport)
1311   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1311   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
13121312
13131313   /* video hardware */
13141314   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/astrocde.c
r1877r1878
448448
449449static void profbank_banksw_restore(void)
450450{
451   profpac_banksw_w(0, profpac_bank);
451   profpac_banksw_w(Machine, 0, profpac_bank);
452452}
453453
454454
r1877r1878
524524
525525static WRITE8_HANDLER( tenpindx_sound_w )
526526{
527   soundlatch_w(offset, data);
528   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
527   soundlatch_w(machine, offset, data);
528   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
529529}
530530
531531
r1877r1878
17251725   memory_install_read8_handler(0, ADDRESS_SPACE_IO, 0x15, 0x15, 0x77ff, 0xff00, profpac_io_2_r);
17261726
17271727   /* reset banking */
1728   profpac_banksw_w(0, 0);
1728   profpac_banksw_w(machine, 0, 0);
17291729   state_save_register_func_postload(profbank_banksw_restore);
17301730}
17311731
r1877r1878
17391739   memory_install_write8_handler(0, ADDRESS_SPACE_IO, 0x97, 0x97, 0x0000, 0xff00, demndrgn_sound_w);
17401740
17411741   /* reset banking */
1742   profpac_banksw_w(0, 0);
1742   profpac_banksw_w(machine, 0, 0);
17431743   state_save_register_func_postload(profbank_banksw_restore);
17441744}
17451745
r1877r1878
17581758   memory_install_write8_handler(0, ADDRESS_SPACE_IO, 0x97, 0x97, 0x0000, 0xff00, tenpindx_sound_w);
17591759
17601760   /* reset banking */
1761   profpac_banksw_w(0, 0);
1761   profpac_banksw_w(machine, 0, 0);
17621762   state_save_register_func_postload(profbank_banksw_restore);
17631763}
17641764
src/mame/drivers/megazone.c
r1877r1878
301301   /* basic machine hardware */
302302   MDRV_CPU_ADD(M6809, 18432000/9)        /* 2 MHz */
303303   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
304   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
304   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
305305
306306   MDRV_CPU_ADD(Z80,18432000/6)     /* Z80 Clock is derived from the H1 signal */
307307   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
308308   MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
309   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
309   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
310310
311311   MDRV_CPU_ADD(I8039,14318000/2)
312312   /* audio CPU */   /* 1/2 14MHz crystal */
src/mame/drivers/deco156.c
r1877r1878
6060
6161/* spriteram is really 16-bit.. this can be changed to use 16-bit ram like the tilemaps
6262 its the same sprite chip Data East used on many, many 16-bit era titles */
63static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
63static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
6464{
6565   int offs;
6666
r1877r1878
7474
7575      y = spriteram32[offs]&0xffff;
7676      flash=y&0x1000;
77      if (flash && (cpu_getcurrentframe() & 1)) continue;
77      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
7878
7979      x = spriteram32[offs+2]&0xffff;
8080      colour = (x >>9) & 0x1f;
r1877r1878
175175
176176static READ32_HANDLER(hvysmsh_oki_0_r)
177177{
178   return OKIM6295_status_0_r(0);
178   return OKIM6295_status_0_r(machine, 0);
179179}
180180
181181static WRITE32_HANDLER(hvysmsh_oki_0_w)
182182{
183183//  data & 0xff00 is written sometimes too. game bug or needed data?
184   OKIM6295_data_0_w(0,data&0xff);
184   OKIM6295_data_0_w(machine,0,data&0xff);
185185}
186186
187187static READ32_HANDLER(hvysmsh_oki_1_r)
188188{
189   return OKIM6295_status_1_r(0);
189   return OKIM6295_status_1_r(machine, 0);
190190}
191191
192192static WRITE32_HANDLER(hvysmsh_oki_1_w)
193193{
194   OKIM6295_data_1_w(0,data&0xff);
194   OKIM6295_data_1_w(machine,0,data&0xff);
195195}
196196
197197static READ32_HANDLER(wcvol95_eeprom_r)
r1877r1878
211211static WRITE32_HANDLER(wcvol95_nonbuffered_palette_w)
212212{
213213   COMBINE_DATA(&paletteram32[offset]);
214   palette_set_color_rgb(Machine,offset,pal5bit(paletteram32[offset] >> 0),pal5bit(paletteram32[offset] >> 5),pal5bit(paletteram32[offset] >> 10));
214   palette_set_color_rgb(machine,offset,pal5bit(paletteram32[offset] >> 0),pal5bit(paletteram32[offset] >> 5),pal5bit(paletteram32[offset] >> 10));
215215}
216216
217217
218218static READ32_HANDLER( deco156_snd_r )
219219{
220   return YMZ280B_status_0_r(0);
220   return YMZ280B_status_0_r(machine, 0);
221221}
222222
223223static WRITE32_HANDLER( deco156_snd_w )
224224{
225225   if (offset)
226      YMZ280B_data_0_w(0, data);
226      YMZ280B_data_0_w(machine, 0, data);
227227   else
228      YMZ280B_register_0_w(0, data);
228      YMZ280B_register_0_w(machine, 0, data);
229229}
230230
231231/***************************************************************************/
r1877r1878
237237static WRITE32_HANDLER( wcvol95_pf12_control_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; COMBINE_DATA(&deco16_pf12_control[offset]); }
238238static READ32_HANDLER( wcvol95_pf1_data_r ) {   return deco16_pf1_data[offset]^0xffff0000; }
239239static READ32_HANDLER( wcvol95_pf2_data_r ) {   return deco16_pf2_data[offset]^0xffff0000; }
240static WRITE32_HANDLER( wcvol95_pf1_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf1_data_w(offset,data,mem_mask); }
241static WRITE32_HANDLER( wcvol95_pf2_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf2_data_w(offset,data,mem_mask); }
240static WRITE32_HANDLER( wcvol95_pf1_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf1_data_w(machine,offset,data,mem_mask); }
241static WRITE32_HANDLER( wcvol95_pf2_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf2_data_w(machine,offset,data,mem_mask); }
242242
243243
244244static ADDRESS_MAP_START( hvysmsh_map, ADDRESS_SPACE_PROGRAM, 32 )
r1877r1878
426426   /* basic machine hardware */
427427   MDRV_CPU_ADD(ARM, 28000000) /* Unconfirmed */
428428   MDRV_CPU_PROGRAM_MAP(hvysmsh_map,0)
429   MDRV_CPU_VBLANK_INT(deco32_vbl_interrupt,1)
429   MDRV_CPU_VBLANK_INT("main", deco32_vbl_interrupt)
430430
431431   MDRV_NVRAM_HANDLER(93C46)
432432
r1877r1878
465465   /* basic machine hardware */
466466   MDRV_CPU_ADD(ARM, 28000000) /* Unconfirmed */
467467   MDRV_CPU_PROGRAM_MAP(wcvol95_map,0)
468   MDRV_CPU_VBLANK_INT(deco32_vbl_interrupt,1)
468   MDRV_CPU_VBLANK_INT("main", deco32_vbl_interrupt)
469469
470470   MDRV_NVRAM_HANDLER(93C46)
471471
src/mame/drivers/pass.c
r1877r1878
117117
118118static WRITE16_HANDLER ( pass_soundwrite )
119119{
120   soundlatch_w(0,data & 0xff);
120   soundlatch_w(machine,0,data & 0xff);
121121}
122122
123123/* todo: check all memory regions actually readable / read from */
r1877r1878
273273   /* basic machine hardware */
274274   MDRV_CPU_ADD(M68000, 14318180/2 )
275275   MDRV_CPU_PROGRAM_MAP(pass_readmem,pass_writemem)
276   MDRV_CPU_VBLANK_INT(irq1_line_hold,1) /* all the same */
276   MDRV_CPU_VBLANK_INT("main", irq1_line_hold) /* all the same */
277277
278278   MDRV_CPU_ADD(Z80, 14318180/4 )
279279   /* audio CPU */
280280   MDRV_CPU_PROGRAM_MAP(pass_sound_readmem,pass_sound_writemem)
281281   MDRV_CPU_IO_MAP(pass_sound_readport,pass_sound_writeport)
282   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
282   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
283283
284284   /* video hardware */
285285   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/toki.c
r1877r1878
6161
6262static WRITE16_HANDLER( tokib_soundcommand16_w )
6363{
64   soundlatch_w(0,data & 0xff);
65   cpunum_set_input_line(Machine, 1, 0, HOLD_LINE);
64   soundlatch_w(machine,0,data & 0xff);
65   cpunum_set_input_line(machine, 1, 0, HOLD_LINE);
6666}
6767
6868static READ16_HANDLER( pip16_r )
r1877r1878
438438   /* basic machine hardware */
439439   MDRV_CPU_ADD(M68000,XTAL_20MHz /2)    /* verified on pcb */
440440   MDRV_CPU_PROGRAM_MAP(toki_map,0)
441   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)/* VBL */
441   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)/* VBL */
442442
443443   SEIBU_SOUND_SYSTEM_CPU(XTAL_14_31818MHz/4)   /* verifed on pcb */
444444
r1877r1878
470470   /* basic machine hardware */
471471   MDRV_CPU_ADD(M68000, 12000000)   /* 10MHz causes bad slowdowns with monkey machine rd1 */
472472   MDRV_CPU_PROGRAM_MAP(tokib_map,0)
473   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)/* VBL (could be level1, same vector) */
473   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)/* VBL (could be level1, same vector) */
474474
475475   MDRV_CPU_ADD(Z80, 4000000)   /* verified with PCB */
476476   /* audio CPU */
src/mame/drivers/dwarfd.c
r1877r1878
462462{
463463}
464464
465static void drawCrt(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
465static void drawCrt(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
466466{
467467   int x,y;
468468   for (y=0;y<maxy;y++)
r1877r1878
690690   MDRV_CPU_PROGRAM_MAP(mem_map, 0)
691691   MDRV_CPU_IO_MAP(io_map, 0)
692692
693   MDRV_CPU_VBLANK_INT(dwarfd_interrupt,NUM_LINES+4) //16 +vblank + 1 unused
693   MDRV_CPU_VBLANK_INT_HACK(dwarfd_interrupt,NUM_LINES+4) //16 +vblank + 1 unused
694694
695695   /* video hardware */
696696   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/40love.c
r1877r1878
266266
267267static WRITE8_HANDLER( sound_command_w )
268268{
269   soundlatch_w(0,data);
269   soundlatch_w(machine,0,data);
270270   timer_call_after_resynch(NULL, data,nmi_callback);
271271}
272272
r1877r1878
297297
298298static READ8_HANDLER( fortyl_mcu_r )
299299{
300   return buggychl_mcu_r(offset);
300   return buggychl_mcu_r(machine,offset);
301301}
302302
303303static READ8_HANDLER( fortyl_mcu_status_r )
304304{
305   return buggychl_mcu_status_r(offset);
305   return buggychl_mcu_status_r(machine,offset);
306306}
307307
308308static WRITE8_HANDLER( fortyl_mcu_w )
309309{
310   buggychl_mcu_w(offset,data);
310   buggychl_mcu_w(machine,offset,data);
311311}
312312
313313static WRITE8_HANDLER( bank_select_w )
r1877r1878
10981098   /* basic machine hardware */
10991099   MDRV_CPU_ADD(Z80,8000000/2) /* OK */
11001100   MDRV_CPU_PROGRAM_MAP(40love_map,0)
1101   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1101   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
11021102
11031103   MDRV_CPU_ADD(Z80,8000000/2)
11041104   /* audio CPU */ /* OK */
11051105   MDRV_CPU_PROGRAM_MAP(sound_map,0)
1106   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)   /* source/number of IRQs is unknown */
1106   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)   /* source/number of IRQs is unknown */
11071107
11081108   MDRV_CPU_ADD(M68705,18432000/6) /* OK */
11091109   MDRV_CPU_PROGRAM_MAP(mcu_map,0)
r1877r1878
11451145   /* basic machine hardware */
11461146   MDRV_CPU_ADD(Z80,8000000/2)
11471147   MDRV_CPU_PROGRAM_MAP(undoukai_map,0)
1148   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1148   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
11491149
11501150   MDRV_CPU_ADD(Z80,8000000/2)
11511151   /* audio CPU */
11521152   MDRV_CPU_PROGRAM_MAP(sound_map,0)
1153   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)   /* source/number of IRQs is unknown */
1153   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)   /* source/number of IRQs is unknown */
11541154
11551155//  MDRV_CPU_ADD(M68705,18432000/6)
11561156//  MDRV_CPU_PROGRAM_MAP(mcu_map,0)
src/mame/drivers/junofrst.c
r1877r1878
168168
169169static WRITE8_HANDLER( flip_screen_w )
170170{
171   tutankhm_flip_screen_x_w(0, data);
172   tutankhm_flip_screen_y_w(0, data);
171   tutankhm_flip_screen_x_w(machine, 0, data);
172   tutankhm_flip_screen_y_w(machine, 0, data);
173173}
174174
175175
r1877r1878
337337   /* basic machine hardware */
338338   MDRV_CPU_ADD(M6809, 1500000)         /* 1.5 MHz ??? */
339339   MDRV_CPU_PROGRAM_MAP(main_map,0)
340   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
340   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
341341
342342   MDRV_CPU_ADD(Z80,14318000/8)
343343   /* audio CPU */   /* 1.78975 MHz */
src/mame/drivers/renegade.c
r1877r1878
200200
201201static WRITE8_HANDLER( sound_w )
202202{
203   soundlatch_w(offset, data);
204   cpunum_set_input_line(Machine, 1, M6809_IRQ_LINE, HOLD_LINE);
203   soundlatch_w(machine, offset, data);
204   cpunum_set_input_line(machine, 1, M6809_IRQ_LINE, HOLD_LINE);
205205}
206206
207207/********************************************************************************************/
r1877r1878
788788   /* basic machine hardware */
789789   MDRV_CPU_ADD(M6502, 12000000/8)   /* 1.5 MHz (measured) */
790790   MDRV_CPU_PROGRAM_MAP(main_readmem,main_writemem)
791   MDRV_CPU_VBLANK_INT(renegade_interrupt,2)
791   MDRV_CPU_VBLANK_INT_HACK(renegade_interrupt,2)
792792
793793   MDRV_CPU_ADD(M6809, 12000000/8)
794794   /* audio CPU */
src/mame/drivers/sg1000a.c
r1877r1878
270270   MDRV_CPU_ADD(Z80, 3579545)       /* 3.579545 Mhz */
271271   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
272272   MDRV_CPU_IO_MAP(readport,writeport)
273   MDRV_CPU_VBLANK_INT(sg100a_interrupt,1)
273   MDRV_CPU_VBLANK_INT("main", sg100a_interrupt)
274274
275275   /* video hardware */
276276   MDRV_IMPORT_FROM(tms9928a)
src/mame/drivers/galaga.c
r1877r1878
814814
815815   /* Reset all latches */
816816   for (i = 0;i < 8;i++)
817      bosco_latch_w(i,0);
817      bosco_latch_w(machine,i,0);
818818
819819   namco_06xx_init(0, 0,
820820      NAMCOIO_51XX, &intf0,
r1877r1878
835835
836836   /* Reset all latches */
837837   for (i = 0;i < 8;i++)
838      bosco_latch_w(i,0);
838      bosco_latch_w(machine,i,0);
839839
840840   namco_06xx_init(0, 0,
841841      NAMCOIO_51XX, &intf0,
r1877r1878
850850
851851   /* Reset all latches */
852852   for (i = 0;i < 8;i++)
853      bosco_latch_w(i,0);
853      bosco_latch_w(machine,i,0);
854854
855855   namco_06xx_init(0, 0,
856856      NAMCOIO_51XX, &intf0,
r1877r1878
865865
866866   /* Reset all latches */
867867   for (i = 0;i < 8;i++)
868      bosco_latch_w(i,0);
868      bosco_latch_w(machine,i,0);
869869
870870   battles_customio_init();
871871}
r1877r1878
876876
877877   /* Reset all latches */
878878   for (i = 0;i < 8;i++)
879      bosco_latch_w(i,0);
879      bosco_latch_w(machine,i,0);
880880
881881   namco_06xx_init(0, 0,
882882      NAMCOIO_51XX, &intf0,
r1877r1878
16211621   /* basic machine hardware */
16221622   MDRV_CPU_ADD(Z80, 18432000/6)   /* 3.072 MHz */
16231623   MDRV_CPU_PROGRAM_MAP(bosco_map,0)
1624   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
1624   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
16251625
16261626   MDRV_CPU_ADD(Z80, 18432000/6)   /* 3.072 MHz */
16271627   MDRV_CPU_PROGRAM_MAP(bosco_map,0)
1628   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
1628   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
16291629
16301630   MDRV_CPU_ADD(Z80, 18432000/6)   /* 3.072 MHz */
16311631   MDRV_CPU_PROGRAM_MAP(bosco_map,0)
1632   MDRV_CPU_VBLANK_INT(nmi_line_pulse,2)   /* 64V */
1632   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,2)   /* 64V */
16331633
16341634   MDRV_CPU_ADD_TAG(CPUTAG_50XX, MB8842, 18432000/12/6)   /* 1.536 MHz, internally divided by 6 */
16351635   MDRV_CPU_PROGRAM_MAP(namco_50xx_map_program,0)
r1877r1878
16901690   /* basic machine hardware */
16911691   MDRV_CPU_ADD(Z80, 18432000/6)   /* 3.072 MHz */
16921692   MDRV_CPU_PROGRAM_MAP(galaga_map,0)
1693   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
1693   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
16941694
16951695   MDRV_CPU_ADD(Z80, 18432000/6)   /* 3.072 MHz */
16961696   MDRV_CPU_PROGRAM_MAP(galaga_map,0)
1697   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
1697   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
16981698
16991699   MDRV_CPU_ADD(Z80, 18432000/6)   /* 3.072 MHz */
17001700   MDRV_CPU_PROGRAM_MAP(galaga_map,0)
1701   MDRV_CPU_VBLANK_INT(galaga_cpu3_nmi,4)   /* 64V (see notes at the top of the driver) */
1701   MDRV_CPU_VBLANK_INT_HACK(galaga_cpu3_nmi,4)   /* 64V (see notes at the top of the driver) */
17021702
17031703   MDRV_CPU_ADD_TAG(CPUTAG_54XX, MB8844, 18432000/12/6)   /* 1.536 MHz, internally divided by 6 */
17041704   MDRV_CPU_PROGRAM_MAP(namco_54xx_map_program,0)
r1877r1878
17591759   /* basic machine hardware */
17601760   MDRV_CPU_ADD(Z80, 18432000/6)   /* 3.072 MHz */
17611761   MDRV_CPU_PROGRAM_MAP(xevious_map,0)
1762   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
1762   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
17631763
17641764   MDRV_CPU_ADD(Z80, 18432000/6)   /* 3.072 MHz */
17651765   MDRV_CPU_PROGRAM_MAP(xevious_map,0)
1766   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
1766   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
17671767
17681768   MDRV_CPU_ADD(Z80, 18432000/6)   /* 3.072 MHz */
17691769   MDRV_CPU_PROGRAM_MAP(xevious_map,0)
1770   MDRV_CPU_VBLANK_INT(nmi_line_pulse,2)   /* 64V */
1770   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,2)   /* 64V */
17711771
17721772   MDRV_CPU_ADD_TAG(CPUTAG_50XX, MB8842, 18432000/12/6)   /* 1.536 MHz, internally divided by 6 */
17731773   MDRV_CPU_PROGRAM_MAP(namco_50xx_map_program,0)
r1877r1878
18221822
18231823   MDRV_CPU_ADD(Z80, 18432000/6)   /* 3.072 MHz */
18241824   MDRV_CPU_PROGRAM_MAP(readmem4_battles,writemem4_battles)
1825   MDRV_CPU_VBLANK_INT(battles_interrupt_4,1)
1825   MDRV_CPU_VBLANK_INT("main", battles_interrupt_4)
18261826
18271827   MDRV_MACHINE_RESET(battles)
18281828
r1877r1878
18431843   /* basic machine hardware */
18441844   MDRV_CPU_ADD(Z80, 18432000/6)   /* 3.072 MHz */
18451845   MDRV_CPU_PROGRAM_MAP(digdug_map,0)
1846   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
1846   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
18471847
18481848   MDRV_CPU_ADD(Z80, 18432000/6)   /* 3.072 MHz */
18491849   MDRV_CPU_PROGRAM_MAP(digdug_map,0)
1850   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
1850   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
18511851
18521852   MDRV_CPU_ADD(Z80, 18432000/6)   /* 3.072 MHz */
18531853   MDRV_CPU_PROGRAM_MAP(digdug_map,0)
1854   MDRV_CPU_VBLANK_INT(nmi_line_pulse,2)   /* 64V */
1854   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,2)   /* 64V */
18551855
18561856   MDRV_INTERLEAVE(100)   /* 100 CPU slices per frame - an high value to ensure proper */
18571857                     /* synchronization of the CPUs */
src/mame/drivers/panicr.c
r1877r1878
194194   colortable_configure_tilemap_groups(machine->colortable, txttilemap, machine->gfx[0], 0);
195195}
196196
197static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect )
197static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect )
198198{
199199   int offs,fx,fy,x,y,color,sprite;
200200
r1877r1878
358358static MACHINE_DRIVER_START( panicr )
359359   MDRV_CPU_ADD(V20,16000000/2) /* Sony 8623h9 CXQ70116D-8 (V20 compatible) */
360360   MDRV_CPU_PROGRAM_MAP(panicr_map,0)
361   MDRV_CPU_VBLANK_INT(panicr_interrupt,2)
361   MDRV_CPU_VBLANK_INT_HACK(panicr_interrupt,2)
362362
363363   MDRV_CPU_ADD_TAG(CPUTAG_T5182,Z80,14318180/4)   /* 3.579545 MHz */
364364   MDRV_CPU_PROGRAM_MAP(t5182_map, 0)
src/mame/drivers/istellar.c
r1877r1878
333333   MDRV_CPU_ADD(Z80, GUESSED_CLOCK)
334334   MDRV_CPU_PROGRAM_MAP(z80_0_mem,0)
335335   MDRV_CPU_IO_MAP(z80_0_io,0)
336   MDRV_CPU_VBLANK_INT(vblank_callback_istellar, 1)
336   MDRV_CPU_VBLANK_INT("main", vblank_callback_istellar)
337337
338338/*  sound cpu */
339339   MDRV_CPU_ADD(Z80, GUESSED_CLOCK)
src/mame/drivers/lasso.c
r1877r1878
2020  hardware.  The music ends at the perfect time with this clock speed
2121- Lasso: fire button auto-repeats on high score entry screen (real behavior?)
2222
23***************************************************************************
24
25DIP locations verified for:
26    - lasso
27
2328***************************************************************************/
2429
2530#include "driver.h"
r1877r1878
3136#include "sound/ay8910.h"
3237
3338
34/* IRQ = VBlank, NMI = Coin Insertion */
35
36static UINT8 coins_old;
37
38static INTERRUPT_GEN( lasso_interrupt )
39static INPUT_CHANGED( coin_inserted )
3940{
40   // VBlank
41   if (cpu_getiloops() == 0)
42      cpunum_set_input_line(machine, 0, 0, HOLD_LINE);
43   else
44   {
45      UINT8 coins_new;
46
47      // Coins
48      coins_new = ~readinputport(3) & 0x30;
49
50      if ( ((coins_new & 0x10) && !(coins_old & 0x10)) ||
51          ((coins_new & 0x20) && !(coins_old & 0x20)) )
52         cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
53
54      coins_old = coins_new;
55   }
41   /* coin insertion causes an NMI */
42   cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE);
5643}
5744
5845
59
6046/* Write to the sound latch and generate an IRQ on the sound CPU */
6147
6248static UINT8 *lasso_chip_data;
r1877r1878
6450
6551static WRITE8_HANDLER( sound_command_w )
6652{
67   soundlatch_w(offset,data);
68   cpunum_set_input_line(Machine, 1, 0, PULSE_LINE);
53   soundlatch_w(machine,offset,data);
54   cpunum_set_input_line(machine, 1, 0, PULSE_LINE);
6955}
7056
7157static WRITE8_HANDLER( pinbo_sound_command_w )
7258{
73   soundlatch_w(offset,data);
74   cpunum_set_input_line(Machine, 1, 0, HOLD_LINE);
59   soundlatch_w(machine,offset,data);
60   cpunum_set_input_line(machine, 1, 0, HOLD_LINE);
7561}
7662
7763static READ8_HANDLER( sound_status_r )
r1877r1878
8571   UINT8 to_write = BITSWAP8(*lasso_chip_data, 0, 1, 2, 3, 4, 5, 6, 7);
8672
8773   if (~data & 0x01)   /* chip #0 */
88      SN76496_0_w(0, to_write);
74      SN76496_0_w(machine, 0, to_write);
8975
9076   if (~data & 0x02)   /* chip #1 */
91      SN76496_1_w(0, to_write);
77      SN76496_1_w(machine, 0, to_write);
9278}
9379
94static MACHINE_START( lasso )
95{
96   /* register for saving */
97   state_save_register_global(coins_old);
98}
9980
100
10181static ADDRESS_MAP_START( lasso_main_map, ADDRESS_SPACE_PROGRAM, 8 )
10282   AM_RANGE(0x0000, 0x03ff) AM_RAM
10383   AM_RANGE(0x0400, 0x07ff) AM_READWRITE(MRA8_RAM, lasso_videoram_w) AM_BASE(&lasso_videoram)
r1877r1878
253233   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED  )
254234
255235   PORT_START_TAG("1806")
256   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) )
236   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) )      PORT_DIPLOCATION("SW2:!1")
257237   PORT_DIPSETTING(   0x01, DEF_STR( Upright ) )
258238   PORT_DIPSETTING(   0x00, DEF_STR( Cocktail ) )
259   PORT_DIPNAME( 0x0e, 0x0e, DEF_STR( Coin_A ) )
239   PORT_DIPNAME( 0x0e, 0x00, DEF_STR( Coin_A ) )      PORT_DIPLOCATION("SW2:!2,!3,!4")
260240   PORT_DIPSETTING(   0x02, DEF_STR( 2C_1C ) )
261   PORT_DIPSETTING(   0x0e, DEF_STR( 1C_1C ) )
241   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
262242   PORT_DIPSETTING(   0x08, DEF_STR( 1C_2C ) )
263243   PORT_DIPSETTING(   0x04, DEF_STR( 1C_3C ) )
264244   PORT_DIPSETTING(   0x0c, DEF_STR( 1C_6C ) )
265//  PORT_DIPSETTING(    0x06, DEF_STR( 1C_1C ) )
266//  PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
267//  PORT_DIPSETTING(    0x0a, DEF_STR( 1C_1C ) )
268   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
269   PORT_DIPSETTING(    0x30, "3" )
245//  PORT_DIPSETTING(    0x06, DEF_STR( 1C_1C ) )        /* Not documented */
246//  PORT_DIPSETTING(    0x0a, DEF_STR( 1C_1C ) )        /* Not documented */
247//  PORT_DIPSETTING(    0x0e, DEF_STR( 1C_1C ) )        /* Not documented */
248   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW2:!5,!6")
249   PORT_DIPSETTING(    0x00, "3" )
270250   PORT_DIPSETTING(    0x10, "4" )
271251   PORT_DIPSETTING(    0x20, "5" )
272//  PORT_DIPSETTING(    0x00, "3" )
273   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Coin_B ) )
252//  PORT_DIPSETTING(    0x30, "3" )                     /* Not documented */
253   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Coin_B ) )      PORT_DIPLOCATION("SW1:!1")
274254   PORT_DIPSETTING(   0x40, DEF_STR( 2C_1C ) )
275255   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
276   PORT_DIPNAME( 0x80, 0x80, "Warm-Up Instructions" )
256   PORT_DIPNAME( 0x80, 0x80, "Warm-Up Instructions" )   PORT_DIPLOCATION("SW1:!4") /* Listed as "Unused" */
277257   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
278258   PORT_DIPSETTING(   0x80, DEF_STR( Yes ) )
279259
280260   PORT_START_TAG("1807")
281   PORT_DIPNAME( 0x01, 0x00, "Warm-Up" )
261   PORT_DIPNAME( 0x01, 0x00, "Warm-Up" )            PORT_DIPLOCATION("SW1:!3")
282262   PORT_DIPSETTING(    0x01, DEF_STR( No ) )
283263   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
284   PORT_DIPNAME( 0x02, 0x00, "Warm-Up Language" )
264   PORT_DIPNAME( 0x02, 0x00, "Warm-Up Language" )      PORT_DIPLOCATION("SW1:!2")
285265   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
286266   PORT_DIPSETTING(    0x02, DEF_STR( German ) )
287   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )   /* used */
288   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
289   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
290   PORT_DIPNAME( 0x08, 0x00, "Invulnerability (Cheat)")
267   PORT_DIPUNUSED_DIPLOC( 0x04, 0x00, "SW1:!5" )      /* Listed as "Unused" */
268   PORT_DIPNAME( 0x08, 0x00, "Invulnerability (Cheat)") PORT_DIPLOCATION("SW1:!6") /* Listed as "Test" */
291269   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
292270   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
293   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2    )
294   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1    )
271   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2    ) PORT_CHANGED(coin_inserted, 0)
272   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1    ) PORT_CHANGED(coin_inserted, 0)
295273   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START2  )
296274   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START1  )
297275INPUT_PORTS_END
298276
299277static INPUT_PORTS_START( chameleo )
300   PORT_START_TAG("1804")
301   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY
302   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY
303   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY
304   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY
305   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
278   PORT_INCLUDE( lasso )
279
280   PORT_MODIFY("1804")
306281   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )
307   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
308   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
309282
310   PORT_START_TAG("1805")
311   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL
312   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL
313   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY PORT_COCKTAIL
314   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL
315   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL
283   PORT_MODIFY("1805")
316284   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )
317   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
318   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
319285
320   PORT_START_TAG("1806")
321   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) )
322   PORT_DIPSETTING(   0x01, DEF_STR( Upright ) )
323   PORT_DIPSETTING(   0x00, DEF_STR( Cocktail ) )
324   PORT_DIPNAME( 0x0e, 0x0e, DEF_STR( Coin_A ) )
325   PORT_DIPSETTING(   0x02, DEF_STR( 2C_1C ) )
326   PORT_DIPSETTING(   0x0e, DEF_STR( 1C_1C ) )
327   PORT_DIPSETTING(   0x08, DEF_STR( 1C_2C ) )
328   PORT_DIPSETTING(   0x04, DEF_STR( 1C_3C ) )
329   PORT_DIPSETTING(   0x0c, DEF_STR( 1C_6C ) )
330//  PORT_DIPSETTING(    0x06, DEF_STR( 1C_1C ) )
331//  PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
332//  PORT_DIPSETTING(    0x0a, DEF_STR( 1C_1C ) )
333   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Lives ) )
286   PORT_MODIFY("1806")
287   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW2:!5,!6")
334288   PORT_DIPSETTING(    0x00, "3" )
335289   PORT_DIPSETTING(    0x30, "5" )
336290//  PORT_DIPSETTING(    0x10, "5" )
337291   PORT_DIPSETTING(    0x20, "Infinite (Cheat)")
338   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Coin_B ) )
339   PORT_DIPSETTING(   0x40, DEF_STR( 2C_1C ) )
340   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
341   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
342   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
343   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
292   PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x00, "SW1:!4" )
344293
345   PORT_START_TAG("1807")
346   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )   /* probably unused */
347   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
348   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
349   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )   /* probably unused */
350   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
351   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
352   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )   /* probably unused */
353   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
354   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
355   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
294   PORT_MODIFY("1807")
295   PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x00, "SW1:!3" )      /* Probably unused */
296   PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x00, "SW1:!2" )      /* Probably unused */
297   PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x00, "SW1:!5" )      /* Probably unused */
298   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("SW1:!6")
356299   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
357300   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
358   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2    )
359   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1    )
360   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START2  )
361   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START1  )
362301INPUT_PORTS_END
363302
364303static INPUT_PORTS_START( wwjgtin )
365   PORT_START_TAG("1804")
366   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY
367   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY
368   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY
369   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY
370   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
371   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 )
372   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
373   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
304   PORT_INCLUDE( lasso )
374305
375   PORT_START_TAG("1805")
306   PORT_MODIFY("1805")
376307   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2)
377308   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2)
378309   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2)
379310   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2)
380311   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
381312   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2)
382   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
383   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
384313
385   PORT_START_TAG("1806")
386   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )   /* used - has to do with the controls */
387   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
388   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
389   PORT_DIPNAME( 0x0e, 0x0e, DEF_STR( Coin_A ) )
390   PORT_DIPSETTING(   0x02, DEF_STR( 2C_1C ) )
391   PORT_DIPSETTING(   0x0e, DEF_STR( 1C_1C ) )
392   PORT_DIPSETTING(   0x08, DEF_STR( 1C_2C ) )
393   PORT_DIPSETTING(   0x04, DEF_STR( 1C_3C ) )
394   PORT_DIPSETTING(   0x0c, DEF_STR( 1C_6C ) )
395//  PORT_DIPSETTING(    0x06, DEF_STR( 1C_1C ) )
396//  PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
397//  PORT_DIPSETTING(    0x0a, DEF_STR( 1C_1C ) )
398   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )   /* probably unused */
399   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
400   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
401   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )   /* probably unused */
402   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
403   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
404   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Coin_B ) )
405   PORT_DIPSETTING(   0x40, DEF_STR( 2C_1C ) )
406   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
407   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )   /* probably unused */
408   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
409   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
314   PORT_MODIFY("1806")
315   PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x00, "SW2:!1" )      /* used - has to do with the controls */
316   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x00, "SW2:!5" )      /* probably unused */
317   PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x00, "SW2:!6" )      /* probably unused */
318   PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x00, "SW1:!4" )      /* probably unused */
410319
411   PORT_START_TAG("1807")
412   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Bonus_Life) )
320   PORT_MODIFY("1807")
321   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Bonus_Life) )   PORT_DIPLOCATION("SW1:!3")
413322   PORT_DIPSETTING(    0x00, "20k" )
414323   PORT_DIPSETTING(    0x01, "50k" )
415   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) )
324   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("SW1:!2")
416325   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
417326   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
418   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )   /* probably unused */
419   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
420   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
421   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )   /* probably unused */
422   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
423   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
424   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_COIN2   )
425   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_COIN1   )
327   PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x00, "SW1:!5" )      /* probably unused */
328   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x00, "SW1:!6" )      /* probably unused */
329   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_COIN2   ) PORT_CHANGED(coin_inserted, 0)
330   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_COIN1   ) PORT_CHANGED(coin_inserted, 0)
426331   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START1  )
427332   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START2  )
428333INPUT_PORTS_END
429334
430335static INPUT_PORTS_START( pinbo )
431   PORT_START_TAG("1804")
336   PORT_INCLUDE( lasso )
337
338   PORT_MODIFY("1804")
432339   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY
433340   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY
434341   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY
r1877r1878
438345   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
439346   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
440347
441   PORT_START_TAG("1805")
348   PORT_MODIFY("1805")
442349   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
443350   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
444351   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
r1877r1878
448355   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
449356   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
450357
451   PORT_START_TAG("1806")
452   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) )
453   PORT_DIPSETTING(    0x01, DEF_STR( Upright ) )
454   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
455   PORT_DIPNAME( 0x0e, 0x0e, DEF_STR( Coin_A ) )
456   PORT_DIPSETTING(   0x02, DEF_STR( 2C_1C ) )
457   PORT_DIPSETTING(   0x0e, DEF_STR( 1C_1C ) )
458   PORT_DIPSETTING(   0x08, DEF_STR( 1C_2C ) )
459   PORT_DIPSETTING(   0x04, DEF_STR( 1C_3C ) )
460   PORT_DIPSETTING(   0x0c, DEF_STR( 1C_6C ) )
461//  PORT_DIPSETTING(    0x06, DEF_STR( 1C_1C ) )
462//  PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
463//  PORT_DIPSETTING(    0x0a, DEF_STR( 1C_1C ) )
464   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Lives ) )
358   PORT_MODIFY("1806")
359   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW2:!5,!6")
465360   PORT_DIPSETTING(    0x00, "3" )
466361   PORT_DIPSETTING(    0x10, "4" )
467362   PORT_DIPSETTING(    0x20, "5" )
468363   PORT_DIPSETTING(    0x30, "70 (Cheat)")
469   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Coin_B ) )
470   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) )
471   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
472   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )   /* probably unused */
473   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
474   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
364   PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x00, "SW1:!4" )      /* probably unused */
475365
476   PORT_START_TAG("1807")
477   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Bonus_Life) )
478   PORT_DIPSETTING(    0x00, "500000,1000000" )
366   PORT_MODIFY("1807")
367   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Bonus_Life) )   PORT_DIPLOCATION("SW1:!3")
368   PORT_DIPSETTING(    0x00, "500000, 1000000" )
479369   PORT_DIPSETTING(    0x01, DEF_STR( None ) )
480   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Controls ) )
370   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Controls ) )      PORT_DIPLOCATION("SW1:!2")
481371   PORT_DIPSETTING(    0x02, DEF_STR( Normal ) )
482372   PORT_DIPSETTING(    0x00, "Reversed" )
483   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )   /* probably unused */
484   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
485   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
486   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
373   PORT_DIPUNUSED_DIPLOC( 0x04, 0x00, "SW1:!5" )      /* probably unused */
374   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("SW1:!6")
487375   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
488376   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
489   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_COIN2   )
490   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_COIN1   )
491   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START2 )
492   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START1 )
493377INPUT_PORTS_END
494378
379static INPUT_PORTS_START( pinboa )
380   PORT_INCLUDE( pinbo )
495381
382   PORT_MODIFY("1806")
383   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Lives ) )      PORT_DIPLOCATION("SW2:!5,!6")
384   PORT_DIPSETTING(    0x00, "1" )
385   PORT_DIPSETTING(    0x10, "2" )
386   PORT_DIPSETTING(    0x20, "3" )
387   PORT_DIPSETTING(    0x30, "70 (Cheat)")
388INPUT_PORTS_END
389
390
496391static const gfx_layout lasso_charlayout =
497392{
498393   8,8,
r1877r1878
573468   /* basic machine hardware */
574469   MDRV_CPU_ADD_TAG("main", M6502, 11289000/16)   /* guess */
575470   MDRV_CPU_PROGRAM_MAP(lasso_main_map,0)
471   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
576472
577473   MDRV_CPU_ADD_TAG("audio", M6502, 600000)
578474   MDRV_CPU_PROGRAM_MAP(lasso_audio_map, 0)
579475
580   MDRV_CPU_VBLANK_INT(lasso_interrupt,2)      /* IRQ = VBlank, NMI = Coin Insertion */
581476   MDRV_INTERLEAVE(100)
582477
583   MDRV_MACHINE_START(lasso)
584
585478   /* video hardware */
586479   MDRV_SCREEN_ADD("main", RASTER)
587480   MDRV_SCREEN_REFRESH_RATE(57)   /* guess, but avoids glitching of Chameleon's high score table */
r1877r1878
958851GAME( 1984, wwjgtin,  0,       wwjgtin,  wwjgtin,  0, ROT0,  "Jaleco / Casio", "Wai Wai Jockey Gate-In!", GAME_SUPPORTS_SAVE )
959852GAME( 1991, photof,   wwjgtin, wwjgtin,  wwjgtin,  0, ROT0,  "bootleg?",      "Photo Finish", GAME_SUPPORTS_SAVE )
960853GAME( 1984, pinbo,    0,       pinbo,    pinbo,    0, ROT90, "Jaleco",         "Pinbo (set 1)", GAME_SUPPORTS_SAVE )
961GAME( 1984, pinboa,   pinbo,   pinbo,    pinbo,    0, ROT90, "Jaleco",         "Pinbo (set 2)", GAME_SUPPORTS_SAVE )
962GAME( 1985, pinbos,   pinbo,   pinbo,    pinbo,    0, ROT90, "bootleg?",       "Pinbo (Strike)", GAME_SUPPORTS_SAVE )
854GAME( 1984, pinboa,   pinbo,   pinbo,    pinboa,   0, ROT90, "Jaleco",         "Pinbo (set 2)", GAME_SUPPORTS_SAVE )
855GAME( 1985, pinbos,   pinbo,   pinbo,    pinboa,   0, ROT90, "bootleg?",       "Pinbo (Strike)", GAME_SUPPORTS_SAVE )
src/mame/drivers/macs.c
r1877r1878
351351   MDRV_CPU_PROGRAM_MAP(macs_mem,0)
352352   MDRV_CPU_IO_MAP(macs_io,0)
353353
354   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
354   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
355355
356356   MDRV_MACHINE_RESET(macs)
357357
src/mame/drivers/nbmj8688.c
r1877r1878
31383138
31393139   /* basic machine hardware */
31403140   MDRV_CPU_ADD_TAG("main", Z80, 5000000)   /* 5.00 MHz */
3141   MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 1)
3141   MDRV_CPU_VBLANK_INT("main", nb1413m3_interrupt)
31423142
31433143   MDRV_MACHINE_RESET(nb1413m3)
31443144   MDRV_NVRAM_HANDLER(nb1413m3)
r1877r1878
32063206   MDRV_CPU_MODIFY("main")
32073207   MDRV_CPU_PROGRAM_MAP(readmem_secolove, writemem_secolove)
32083208   MDRV_CPU_IO_MAP(readport_secolove, writeport_crystalg)
3209//  MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 96) // nmiclock = 2f
3209//  MDRV_CPU_VBLANK_INT_HACK(nb1413m3_interrupt, 96) // nmiclock = 2f
32103210MACHINE_DRIVER_END
32113211
32123212
r1877r1878
32173217   MDRV_CPU_MODIFY("main")
32183218   MDRV_CPU_PROGRAM_MAP(readmem_secolove, writemem_secolove)
32193219   MDRV_CPU_IO_MAP(readport_secolove, writeport_secolove)
3220//  MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 128)    // nmiclock = 60
3220//  MDRV_CPU_VBLANK_INT_HACK(nb1413m3_interrupt, 128)    // nmiclock = 60
32213221MACHINE_DRIVER_END
32223222
32233223
r1877r1878
32283228   MDRV_CPU_MODIFY("main")
32293229   MDRV_CPU_PROGRAM_MAP(readmem_secolove, writemem_secolove)
32303230   MDRV_CPU_IO_MAP(readport_secolove, writeport_secolove)
3231//  MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 128)    // nmiclock = 60
3231//  MDRV_CPU_VBLANK_INT_HACK(nb1413m3_interrupt, 128)    // nmiclock = 60
32323232
32333233   /* video hardware */
32343234   MDRV_VIDEO_START(mbmj8688_hybrid_12bit)
r1877r1878
32423242   MDRV_CPU_MODIFY("main")
32433243   MDRV_CPU_PROGRAM_MAP(readmem_secolove, writemem_secolove)
32443244   MDRV_CPU_IO_MAP(readport_secolove, writeport_secolove)
3245//  MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 128)    // nmiclock = 60/40
3245//  MDRV_CPU_VBLANK_INT_HACK(nb1413m3_interrupt, 128)    // nmiclock = 60/40
32463246
32473247   /* video hardware */
32483248   MDRV_VIDEO_START(mbmj8688_pure_16bit)
r1877r1878
32533253
32543254   /* basic machine hardware */
32553255   MDRV_CPU_ADD_TAG("main", Z80, 5000000)   /* 5.00 MHz */
3256   MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 1)
3256   MDRV_CPU_VBLANK_INT("main", nb1413m3_interrupt)
32573257   MDRV_CPU_PROGRAM_MAP(readmem_secolove, writemem_secolove)
32583258   MDRV_CPU_IO_MAP(readport_secolove, writeport_p16bit_LCD)
32593259
r1877r1878
33083308   MDRV_CPU_MODIFY("main")
33093309   MDRV_CPU_PROGRAM_MAP(readmem_secolove, writemem_secolove)
33103310   MDRV_CPU_IO_MAP(readport_secolove, writeport_seiha)
3311//  MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 128)    // nmiclock = 60
3311//  MDRV_CPU_VBLANK_INT_HACK(nb1413m3_interrupt, 128)    // nmiclock = 60
33123312MACHINE_DRIVER_END
33133313
33143314
r1877r1878
33193319   MDRV_CPU_MODIFY("main")
33203320   MDRV_CPU_PROGRAM_MAP(readmem_secolove, writemem_secolove)
33213321   MDRV_CPU_IO_MAP(readport_secolove, writeport_iemoto)
3322//  MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 128)    // nmiclock = 60
3322//  MDRV_CPU_VBLANK_INT_HACK(nb1413m3_interrupt, 128)    // nmiclock = 60
33233323MACHINE_DRIVER_END
33243324
33253325
r1877r1878
33303330   MDRV_CPU_MODIFY("main")
33313331   MDRV_CPU_PROGRAM_MAP(readmem_ojousan, writemem_ojousan)
33323332   MDRV_CPU_IO_MAP(readport_secolove, writeport_iemoto)
3333//  MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 128)    // nmiclock = 60
3333//  MDRV_CPU_VBLANK_INT_HACK(nb1413m3_interrupt, 128)    // nmiclock = 60
33343334MACHINE_DRIVER_END
33353335
33363336
r1877r1878
33413341   MDRV_CPU_MODIFY("main")
33423342   MDRV_CPU_PROGRAM_MAP(readmem_mjsikaku, writemem_mjsikaku)
33433343   MDRV_CPU_IO_MAP(readport_kaguya, writeport_kaguya)
3344//  MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 128)
3344//  MDRV_CPU_VBLANK_INT_HACK(nb1413m3_interrupt, 128)
33453345MACHINE_DRIVER_END
33463346
33473347
r1877r1878
33523352   MDRV_CPU_MODIFY("main")
33533353   MDRV_CPU_PROGRAM_MAP(readmem_mjsikaku, writemem_mjsikaku)
33543354   MDRV_CPU_IO_MAP(readport_mjsikaku, writeport_mjsikaku)
3355//  MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 144)    // nmiclock = 70
3355//  MDRV_CPU_VBLANK_INT_HACK(nb1413m3_interrupt, 144)    // nmiclock = 70
33563356
33573357   /* sound hardware */
33583358   MDRV_SOUND_REPLACE("8910", YM3812, 20000000/8)
r1877r1878
33673367   MDRV_CPU_MODIFY("main")
33683368   MDRV_CPU_PROGRAM_MAP(readmem_secolove, writemem_secolove)
33693369   MDRV_CPU_IO_MAP(readport_mmsikaku, writeport_mmsikaku)
3370//  MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 128)
3370//  MDRV_CPU_VBLANK_INT_HACK(nb1413m3_interrupt, 128)
33713371MACHINE_DRIVER_END
33723372
33733373
src/mame/drivers/sbowling.c
r1877r1878
3838***********************************************************/
3939
4040#include "driver.h"
41#include "deprecat.h"
4142#include "cpu/i8039/i8039.h"
4243#include "video/resnet.h"
4344#include "sound/ay8910.h"
r1877r1878
152153   {
153154      int offs;
154155      for (offs = 0;offs < videoram_size; offs++)
155         sbw_videoram_w(offs, videoram[offs]);
156         sbw_videoram_w(machine, offs, videoram[offs]);
156157   }
157158   sbw_system = data;
158159}
r1877r1878
176177static READ8_HANDLER (controls_r)
177178{
178179   if(sbw_system&2)
179      return input_port_2_r(0);
180      return input_port_2_r(machine,0);
180181   else
181      return input_port_3_r(0);
182      return input_port_3_r(machine,0);
182183}
183184
184185static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
330331   MDRV_CPU_ADD(8080, 19968000/10 )
331332   MDRV_CPU_PROGRAM_MAP(main_map,0)
332333   MDRV_CPU_IO_MAP(port_map,0)
333   MDRV_CPU_VBLANK_INT(sbw_interrupt, 2)
334   MDRV_CPU_VBLANK_INT_HACK(sbw_interrupt, 2)
334335   MDRV_GFXDECODE(sbowling)
335336
336337   /* video hardware */
src/mame/drivers/psychic5.c
r1877r1878
550550   /* basic machine hardware */
551551   MDRV_CPU_ADD(Z80, 6000000)
552552   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
553   MDRV_CPU_VBLANK_INT(psychic5_interrupt,2)
553   MDRV_CPU_VBLANK_INT_HACK(psychic5_interrupt,2)
554554
555555   MDRV_CPU_ADD(Z80, 6000000)
556556   /* audio CPU */
src/mame/drivers/taito_h.c
r1877r1878
200200{
201201   /* Bypass TC0220IOC controller for analog input */
202202
203   UINT8   port = TC0220IOC_port_r(0);   /* read port number */
203   UINT8   port = TC0220IOC_port_r(machine,0);   /* read port number */
204204
205205   switch( port )
206206   {
r1877r1878
241241            return 0x00;
242242
243243      default:
244         return TC0220IOC_portreg_r( offset );
244         return TC0220IOC_portreg_r( machine,offset );
245245   }
246246}
247247
r1877r1878
578578   /* basic machine hardware */
579579   MDRV_CPU_ADD(M68000,24000000 / 2)      /* 12 MHz */
580580   MDRV_CPU_PROGRAM_MAP(syvalion_readmem,syvalion_writemem)
581   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
581   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
582582
583583   MDRV_CPU_ADD(Z80,8000000 / 2)      /* 4 MHz ??? */
584584   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
r1877r1878
617617   /* basic machine hardware */
618618   MDRV_CPU_ADD(M68000,24000000 / 2)      /* 12 MHz */
619619   MDRV_CPU_PROGRAM_MAP(recordbr_readmem,recordbr_writemem)
620   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
620   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
621621
622622   MDRV_CPU_ADD(Z80,8000000 / 2)      /* 4 MHz ??? */
623623   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
r1877r1878
656656   /* basic machine hardware */
657657   MDRV_CPU_ADD(M68000,24000000 / 2)      /* 12 MHz */
658658   MDRV_CPU_PROGRAM_MAP(dleague_readmem,dleague_writemem)
659   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
659   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
660660
661661   MDRV_CPU_ADD(Z80,8000000 / 2)      /* 4 MHz ??? */
662662   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
src/mame/drivers/good.c
r1877r1878
273273static MACHINE_DRIVER_START( good )
274274   MDRV_CPU_ADD_TAG("main", M68000, 16000000 /2)
275275   MDRV_CPU_PROGRAM_MAP(good_map,0)
276   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
276   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
277277
278278   MDRV_GFXDECODE(good)
279279
src/mame/drivers/8080bw.c
r1877r1878
15101510static READ8_HANDLER( sfl_input_r )
15111511{
15121512   sfl_int^=0x80;//vblank flag ?
1513   return sfl_int|input_port_1_r(0);
1513   return sfl_int|input_port_1_r(machine,0);
15141514}
15151515
15161516static ADDRESS_MAP_START( sflush_map, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
15351535   MDRV_IMPORT_FROM(mw8080bw_root)
15361536   MDRV_CPU_REPLACE("main",M6800,2000000)        /* ?? */
15371537   MDRV_CPU_PROGRAM_MAP(sflush_map,0)
1538   MDRV_CPU_VBLANK_INT(irq0_line_pulse,2)
1538   MDRV_CPU_VBLANK_INT_HACK(irq0_line_pulse,2)
15391539
15401540   /* video hardware */
15411541   MDRV_VIDEO_UPDATE(sflush)
r1877r1878
17751775   MDRV_CPU_PROGRAM_MAP(schaser_map,0)
17761776   MDRV_CPU_IO_MAP(polaris_io_map,0)
17771777   MDRV_WATCHDOG_VBLANK_INIT(255)
1778   MDRV_CPU_VBLANK_INT(polaris_interrupt,1)
1778   MDRV_CPU_VBLANK_INT("main", polaris_interrupt)
17791779
17801780   /* video hardware */
17811781   MDRV_VIDEO_UPDATE(polaris)
r1877r1878
25152515   MDRV_CPU_MODIFY("main")
25162516   MDRV_CPU_PROGRAM_MAP(darthvdr_map,0)
25172517   MDRV_CPU_IO_MAP(darthvdr_io_map,0)
2518   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
2518   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
25192519
25202520   MDRV_MACHINE_START(darthvdr)
25212521   MDRV_MACHINE_RESET(darthvdr)
src/mame/drivers/othunder.c
r1877r1878
385385            break;
386386
387387         default:
388            TC0220IOC_w(offset,data & 0xff);
388            TC0220IOC_w(machine,offset,data & 0xff);
389389      }
390390   }
391391}
r1877r1878
403403         return eeprom_r();
404404
405405      default:
406         return TC0220IOC_r( offset );
406         return TC0220IOC_r( machine, offset );
407407   }
408408}
409409
r1877r1878
457457static WRITE16_HANDLER( othunder_sound_w )
458458{
459459   if (offset == 0)
460      taitosound_port_w (0, data & 0xff);
460      taitosound_port_w (machine, 0, data & 0xff);
461461   else if (offset == 1)
462      taitosound_comm_w (0, data & 0xff);
462      taitosound_comm_w (machine, 0, data & 0xff);
463463}
464464
465465static READ16_HANDLER( othunder_sound_r )
466466{
467467   if (offset == 1)
468      return ((taitosound_comm_r (0) & 0xff));
468      return ((taitosound_comm_r (machine, 0) & 0xff));
469469   else return 0;
470470}
471471
r1877r1878
704704//  MDRV_CPU_ADD(M68000, 24000000/2 )   /* 12 MHz */
705705   MDRV_CPU_ADD(M68000, 13000000 )   /* fixes garbage graphics on startup */
706706   MDRV_CPU_PROGRAM_MAP(othunder_map,0)
707   MDRV_CPU_VBLANK_INT(vblank_interrupt,1)
707   MDRV_CPU_VBLANK_INT("main", vblank_interrupt)
708708
709709   MDRV_CPU_ADD(Z80,16000000/4 )   /* 4 MHz */
710710   /* audio CPU */
src/mame/drivers/ginganin.c
r1877r1878
351351   /* basic machine hardware */
352352   MDRV_CPU_ADD(M68000, 6000000)   /* ? */
353353   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
354   MDRV_CPU_VBLANK_INT(irq1_line_hold,1) /* ? (vectors 1-7 cointain the same address) */
354   MDRV_CPU_VBLANK_INT("main", irq1_line_hold) /* ? (vectors 1-7 cointain the same address) */
355355
356356   MDRV_CPU_ADD(M6809, 1000000)
357357   /* audio CPU */
358358   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
359   MDRV_CPU_VBLANK_INT(ginganin_sound_interrupt,60)   /* Takahiro Nogi. 1999/09/27 (1 -> 60) */
359   MDRV_CPU_VBLANK_INT_HACK(ginganin_sound_interrupt,60)   /* Takahiro Nogi. 1999/09/27 (1 -> 60) */
360360
361361   /* video hardware */
362362   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/tail2nos.c
r1877r1878
4141{
4242   if (ACCESSING_LSB)
4343   {
44      soundlatch_w(offset,data & 0xff);
45      cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
44      soundlatch_w(machine,offset,data & 0xff);
45      cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
4646   }
4747}
4848
4949static READ16_HANDLER( tail2nos_K051316_0_r )
5050{
51   return K051316_0_r(offset);
51   return K051316_0_r(machine,offset);
5252}
5353
5454static WRITE16_HANDLER( tail2nos_K051316_0_w )
5555{
5656   if (ACCESSING_LSB)
57      K051316_0_w(offset,data & 0xff);
57      K051316_0_w(machine,offset,data & 0xff);
5858}
5959
6060static WRITE16_HANDLER( tail2nos_K051316_ctrl_0_w )
6161{
6262   if (ACCESSING_LSB)
63      K051316_ctrl_0_w(offset,data & 0xff);
63      K051316_ctrl_0_w(machine,offset,data & 0xff);
6464}
6565
6666static WRITE8_HANDLER( sound_bankswitch_w )
r1877r1878
267267   /* basic machine hardware */
268268   MDRV_CPU_ADD(M68000,XTAL_20MHz/2)   /* verified on pcb */
269269   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
270   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
270   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
271271
272272   MDRV_CPU_ADD(Z80,XTAL_20MHz/4)   /* verified on pcb */
273273   /* audio CPU */
src/mame/drivers/m79amb.c
r1877r1878
5151 */
5252#include "driver.h"
5353
54WRITE8_HANDLER( ramtek_videoram_w );
55
5654INTERRUPT_GEN( invaders_interrupt );
5755void ramtek_sh_update(void);
58WRITE8_HANDLER( ramtek_mask_w );
5956
60/*
61 * since these functions aren't used anywhere else, i've made them
62 * static, and included them here
63 */
57
58/***************************************************************************
59
60  video.c
61
62  Functions to emulate the video hardware of the machine.
63
64***************************************************************************/
65
66#include "driver.h"
67
68
69
70static UINT8 *ramtek_videoram;
71static UINT8 *mask;
72
73
74static WRITE8_HANDLER( ramtek_videoram_w )
75{
76   ramtek_videoram[offset] = data & ~*mask;
77}
78
79static VIDEO_UPDATE( ramtek )
80{
81   offs_t offs;
82
83   for (offs = 0; offs < 0x2000; offs++)
84   {
85      int i;
86
87      UINT8 data = ramtek_videoram[offs];
88      int y = offs >> 5;
89      int x = (offs & 0x1f) << 3;
90
91      for (i = 0; i < 8; i++)
92      {
93         pen_t pen = (data & 0x80) ? RGB_WHITE : RGB_BLACK;
94         *BITMAP_ADDR32(bitmap, y, x) = pen;
95
96         x++;
97         data <<= 1;
98      }
99   }
100
101   return 0;
102}
103
104
64105static const int ControllerTable[32] = {
65106    0  , 1  , 3  , 2  , 6  , 7  , 5  , 4  ,
66107    12 , 13 , 15 , 14 , 10 , 11 , 9  , 8  ,
r1877r1878
70111
71112static READ8_HANDLER( gray5bit_controller0_r )
72113{
73    return (input_port_2_r(0) & 0xe0) | (~ControllerTable[input_port_2_r(0) & 0x1f] & 0x1f);
114    return (input_port_2_r(machine,0) & 0xe0) | (~ControllerTable[input_port_2_r(machine,0) & 0x1f] & 0x1f);
74115}
75116
76117static READ8_HANDLER( gray5bit_controller1_r )
77118{
78    return (input_port_3_r(0) & 0xe0) | (~ControllerTable[input_port_3_r(0) & 0x1f] & 0x1f);
119    return (input_port_3_r(machine,0) & 0xe0) | (~ControllerTable[input_port_3_r(machine,0) & 0x1f] & 0x1f);
79120}
80121
81static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
82   AM_RANGE(0x0000, 0x1fff) AM_READ(MRA8_ROM)
83   AM_RANGE(0x4000, 0x63ff) AM_READ(MRA8_RAM)
84   AM_RANGE(0x8000, 0x8000) AM_READ(input_port_0_r)
85   AM_RANGE(0x8002, 0x8002) AM_READ(input_port_1_r)
86   AM_RANGE(0x8004, 0x8004) AM_READ(gray5bit_controller0_r)
87   AM_RANGE(0x8005, 0x8005) AM_READ(gray5bit_controller1_r)
88   AM_RANGE(0xC000, 0xC07f) AM_READ(MRA8_RAM)         /* ?? */
89   AM_RANGE(0xC200, 0xC27f) AM_READ(MRA8_RAM)         /* ?? */
90ADDRESS_MAP_END
91
92122static WRITE8_HANDLER( sound_w )
93123{
94124}
95125
96static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
97   AM_RANGE(0x0000, 0x1fff) AM_WRITE(MWA8_ROM)
98   AM_RANGE(0x4000, 0x43ff) AM_WRITE(MWA8_RAM)
99   AM_RANGE(0x4400, 0x5fff) AM_WRITE(ramtek_videoram_w) AM_BASE(&videoram)
100   AM_RANGE(0x6000, 0x63ff) AM_WRITE(MWA8_RAM)      /* ?? */
101   AM_RANGE(0x8001, 0x8001) AM_WRITE(ramtek_mask_w)
102   AM_RANGE(0x8000, 0x8000) AM_WRITE(sound_w)      /* sound_w listed twice?? */
103   AM_RANGE(0x8002, 0x8003) AM_WRITE(sound_w)      /* Manual Shows sound control at 0x8002 */
104   AM_RANGE(0xC000, 0xC07f) AM_WRITE(MWA8_RAM)         /* ?? */
105   AM_RANGE(0xC200, 0xC27f) AM_WRITE(MWA8_RAM)         /* ?? */
126static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
127   AM_RANGE(0x0000, 0x1fff) AM_ROM
128   AM_RANGE(0x4000, 0x5fff) AM_READWRITE(MRA8_RAM, ramtek_videoram_w) AM_BASE(&ramtek_videoram)
129   AM_RANGE(0x6000, 0x63ff) AM_RAM      /* ?? */
130   AM_RANGE(0x8000, 0x8000) AM_READWRITE(input_port_0_r, sound_w) /* sound_w listed twice?? */
131   AM_RANGE(0x8001, 0x8001) AM_WRITE(MWA8_RAM) AM_BASE(&mask)
132   AM_RANGE(0x8002, 0x8002) AM_READWRITE(input_port_1_r, sound_w)
133   AM_RANGE(0x8003, 0x8003) AM_WRITE(sound_w)      /* Manual Shows sound control at 0x8002 */
134   AM_RANGE(0x8004, 0x8004) AM_READ(gray5bit_controller0_r)
135   AM_RANGE(0x8005, 0x8005) AM_READ(gray5bit_controller1_r)
136   AM_RANGE(0xc000, 0xc07f) AM_RAM               /* ?? */
137   AM_RANGE(0xc200, 0xc27f) AM_RAM               /* ?? */
106138ADDRESS_MAP_END
107139
108140
141
109142static INPUT_PORTS_START( m79amb )
110143   PORT_START      /* 8000 */
111144   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* dip switch */
r1877r1878
142175INPUT_PORTS_END
143176
144177
145static INTERRUPT_GEN( M79_interrupt )
178static INTERRUPT_GEN( m79amb_interrupt )
146179{
147180   cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, 0xcf);  /* RST 08h */
148181}
r1877r1878
161194
162195   /* basic machine hardware */
163196   MDRV_CPU_ADD(8080, 1996800)
164   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
165   MDRV_CPU_VBLANK_INT(M79_interrupt,1)
197   MDRV_CPU_PROGRAM_MAP(main_map,0)
198   MDRV_CPU_VBLANK_INT("main", m79amb_interrupt)
166199
167200   /* video hardware */
168201   MDRV_SCREEN_ADD("main", RASTER)
169202   MDRV_SCREEN_REFRESH_RATE(60)
170203   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
171204   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
172   MDRV_SCREEN_SIZE(32*8, 28*8)
173   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1)
205   MDRV_SCREEN_SIZE(32*8, 32*8)
206   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 4*8, 32*8-1)
174207
175   MDRV_VIDEO_START(generic_bitmapped)
176   MDRV_VIDEO_UPDATE(generic_bitmapped)
208   MDRV_VIDEO_UPDATE(ramtek)
177209
178210   /* sound hardware */
179211MACHINE_DRIVER_END
r1877r1878
202234
203235
204236
205GAME( 1977, m79amb, 0, m79amb, m79amb, m79amb, ROT0, "RamTek", "M79 Ambush", GAME_NO_SOUND )
237GAME( 1977, m79amb, 0, m79amb, m79amb, m79amb, ROT0, "Ramtek", "M-79 Ambush", GAME_NO_SOUND )
src/mame/drivers/mrjong.c
r1877r1878
7575
7676static WRITE8_HANDLER( io_0x00_w )
7777{
78   mrjong_flipscreen_w(0, ((data & 0x04) > 2));
78   mrjong_flipscreen_w(machine, 0, ((data & 0x04) > 2));
7979}
8080
8181static READ8_HANDLER( io_0x03_r )
r1877r1878
182182   MDRV_CPU_ADD(Z80,15468000/6)   /* 2.578 MHz?? */
183183   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
184184   MDRV_CPU_IO_MAP(readport,writeport)
185   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
185   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
186186
187187   /* video hardware */
188188   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/quasar.c
r1877r1878
112112{
113113   UINT8 ans = 0;
114114
115   if (IOpage == 0) ans = input_port_0_r(0);
116   if (IOpage == 1) ans = input_port_1_r(0);
117   if (IOpage == 2) ans = input_port_2_r(0);
118   if (IOpage == 3) ans = input_port_3_r(0);
115   if (IOpage == 0) ans = input_port_0_r(machine, 0);
116   if (IOpage == 1) ans = input_port_1_r(machine, 0);
117   if (IOpage == 2) ans = input_port_2_r(machine, 0);
118   if (IOpage == 3) ans = input_port_3_r(machine, 0);
119119
120120   return ans;
121121}
r1877r1878
150150   // return input_port_5_r(0);
151151
152152   // Add in sound DIP switch
153   return (Quasar_Command) + (input_port_5_r(0) & 0x30);
153   return (Quasar_Command) + (input_port_5_r(machine, 0) & 0x30);
154154}
155155
156156static READ8_HANDLER( Quasar_T1_r )
r1877r1878
160160
161161static WRITE8_HANDLER( Quasar_DAC_w )
162162{
163   DAC_0_signed_data_w(0,data);
163   DAC_0_signed_data_w(machine,0,data);
164164}
165165
166166// memory map taken from the manual
r1877r1878
345345   MDRV_CPU_ADD_TAG("main", S2650, 14318000/4)   /* 14 mhz crystal divide by 4 on board */
346346   MDRV_CPU_PROGRAM_MAP(quasar,0)
347347   MDRV_CPU_IO_MAP(quasar_io,0)
348   MDRV_CPU_VBLANK_INT(quasar_interrupt,1)
348   MDRV_CPU_VBLANK_INT("main", quasar_interrupt)
349349
350350   MDRV_CPU_ADD_TAG("sound",I8035,6000000)         /* 6MHz crystal divide by 15 in CPU */
351351   /* audio CPU */
src/mame/drivers/meritm.c
r1877r1878
5858   /* basic machine hardware */
5959   MDRV_CPU_ADD(Z80,6000000)
6060   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
61//  MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
61//  MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
6262
6363   /* video hardware */
6464   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/slapshot.c
r1877r1878
202202   switch (offset)
203203   {
204204      case 0x03:
205         return ((input_port_3_word_r(0,0) & 0xef) |
206              (input_port_5_word_r(0,0) & 0x10))  << 8;   /* IN3 + service switch */
205         return ((input_port_3_word_r(machine,0,0) & 0xef) |
206              (input_port_5_word_r(machine,0,0) & 0x10))  << 8;   /* IN3 + service switch */
207207
208208      default:
209         return TC0640FIO_r(offset) << 8;
209         return TC0640FIO_r(machine,offset) << 8;
210210   }
211211}
212212
r1877r1878
248248static WRITE16_HANDLER( slapshot_msb_sound_w )
249249{
250250   if (offset == 0)
251      taitosound_port_w (0,(data >> 8) & 0xff);
251      taitosound_port_w (machine,0,(data >> 8) & 0xff);
252252   else if (offset == 1)
253      taitosound_comm_w (0,(data >> 8) & 0xff);
253      taitosound_comm_w (machine,0,(data >> 8) & 0xff);
254254
255255#ifdef MAME_DEBUG
256256   if (data & 0xff)
r1877r1878
261261static READ16_HANDLER( slapshot_msb_sound_r )
262262{
263263   if (offset == 1)
264      return ((taitosound_comm_r (0) & 0xff) << 8);
264      return ((taitosound_comm_r (machine, 0) & 0xff) << 8);
265265   else return 0;
266266}
267267
r1877r1878
550550   /* basic machine hardware */
551551   MDRV_CPU_ADD(M68000, 14346000)   /* 28.6860 MHz / 2 ??? */
552552   MDRV_CPU_PROGRAM_MAP(slapshot_readmem,slapshot_writemem)
553   MDRV_CPU_VBLANK_INT(slapshot_interrupt,1)
553   MDRV_CPU_VBLANK_INT("main", slapshot_interrupt)
554554
555555   MDRV_CPU_ADD(Z80,32000000/8)
556556   /* audio CPU */   /* 4 MHz */
r1877r1878
592592   /* basic machine hardware */
593593   MDRV_CPU_ADD(M68000, 14346000)   /* 28.6860 MHz / 2 ??? */
594594   MDRV_CPU_PROGRAM_MAP(opwolf3_readmem,opwolf3_writemem)
595   MDRV_CPU_VBLANK_INT(slapshot_interrupt,1)
595   MDRV_CPU_VBLANK_INT("main", slapshot_interrupt)
596596
597597   MDRV_CPU_ADD(Z80,32000000/8)
598598   /* audio CPU */   /* 4 MHz */
src/mame/drivers/ertictac.c
r1877r1878
3131#include "cpu/arm/arm.h"
3232
3333static UINT32 *ertictac_mainram;
34static UINT32 *ram;
34static UINT32 *ertictac_videoram;
3535static UINT32 IRQSTA, IRQMSKA, IRQMSKB, FIQMSK, T1low, T1high;
3636static UINT32 vidFIFO[256];
3737
38static READ32_HANDLER(ram_r)
39{
40   return ram[offset];
41}
42
43static WRITE32_HANDLER(ram_w)
44{
45   COMBINE_DATA(&ram[offset]);
46   if(offset>=vidFIFO[0x88]/4 && offset<( (vidFIFO[0x88]/4) + 0x28000/4))
47   {
48      int tmp=offset-vidFIFO[0x88]/4;
49      int x=(tmp%80)<<2;
50      int y=(tmp/80)&0xff;
51
52      *BITMAP_ADDR16(tmpbitmap, y, x++) = (ram[offset]>> 0)&0xff;
53      *BITMAP_ADDR16(tmpbitmap, y, x++) = (ram[offset]>> 8)&0xff;
54      *BITMAP_ADDR16(tmpbitmap, y, x++) = (ram[offset]>>16)&0xff;
55      *BITMAP_ADDR16(tmpbitmap, y, x  ) = (ram[offset]>>24)&0xff;
56   }
57}
58
5938static WRITE32_HANDLER(video_fifo_w)
6039{
6140   vidFIFO[data>>24]=data&0xffffff;
r1877r1878
6342
6443static READ32_HANDLER(IOCR_r)
6544{
66   return (input_port_5_r(0)&0x80)|0x34;
45   return (input_port_5_r(machine,0)&0x80)|0x34;
6746}
6847
6948static WRITE32_HANDLER(IOCR_w)
r1877r1878
172151
173152static ADDRESS_MAP_START( ertictac_map, ADDRESS_SPACE_PROGRAM, 32 )
174153   AM_RANGE(0x00000000, 0x0007ffff) AM_RAM AM_BASE (&ertictac_mainram)
175   AM_RANGE(0x01f00000, 0x01ffffff) AM_READWRITE(ram_r, ram_w) AM_BASE (&ram)
154   AM_RANGE(0x01f00000, 0x01ffffff) AM_RAM AM_BASE (&ertictac_videoram)
176155   AM_RANGE(0x03200000, 0x03200003) AM_READWRITE(IOCR_r, IOCR_w)
177156   AM_RANGE(0x03200010, 0x03200013) AM_READ(IRQSTA_r)
178157   AM_RANGE(0x03200014, 0x03200017) AM_READWRITE(IRQRQA_r, IRQRQA_w)
r1877r1878
360339   }
361340}
362341
363static PALETTE_INIT(ertictac)
342
343#define NUM_PENS   (0x100)
344
345static void get_pens(pen_t *pens)
364346{
365   int c;
347   int color;
366348
367   for (c = 0; c < 256; c++)
349   for (color = 0; color < NUM_PENS; color++)
368350   {
369       int r,g,b,i;
351       UINT8 i = color & 0x03;
352       UINT8 r = ((color & 0x04) >> 0) | ((color & 0x10) >> 1) | i;
353       UINT8 g = ((color & 0x20) >> 3) | ((color & 0x40) >> 3) | i;
354       UINT8 b = ((color & 0x08) >> 1) | ((color & 0x80) >> 4) | i;
370355
371       i = c & 0x03;
372       r = ((c & 0x04) >> 0) | ((c & 0x10) >> 1) | i;
373       g = ((c & 0x20) >> 3) | ((c & 0x40) >> 3) | i;
374       b = ((c & 0x08) >> 1) | ((c & 0x80) >> 4) | i;
375
376       palette_set_color_rgb(machine, c, pal4bit(r), pal4bit(g), pal4bit(b));
356      pens[color] = MAKE_RGB(pal4bit(r), pal4bit(g), pal4bit(b));
377357   }
378358}
379359
360
361static VIDEO_UPDATE( ertictac )
362{
363   int y, x;
364   pen_t pens[NUM_PENS];
365
366   get_pens(pens);
367
368   for (y = cliprect->min_y; y <= cliprect->max_y; y++)
369      for (x = 0; x < 0x140; x += 4)
370      {
371         offs_t offs = (y * 0x50) + (x >> 2) + (vidFIFO[0x88] >> 2);
372
373         *BITMAP_ADDR32(bitmap, y, x + 0) = pens[(ertictac_videoram[offs] >>  0) & 0xff];
374         *BITMAP_ADDR32(bitmap, y, x + 1) = pens[(ertictac_videoram[offs] >>  8) & 0xff];
375         *BITMAP_ADDR32(bitmap, y, x + 2) = pens[(ertictac_videoram[offs] >> 16) & 0xff];
376         *BITMAP_ADDR32(bitmap, y, x + 3) = pens[(ertictac_videoram[offs] >> 24) & 0xff];
377      }
378
379   return 0;
380}
381
382
380383static MACHINE_DRIVER_START( ertictac )
381384
382385   MDRV_CPU_ADD(ARM, 16000000) /* guess */
383386   MDRV_CPU_PROGRAM_MAP(ertictac_map,0)
384   MDRV_CPU_VBLANK_INT(ertictac_interrupt,1)
387   MDRV_CPU_VBLANK_INT("main", ertictac_interrupt)
385388
386389   MDRV_MACHINE_RESET(ertictac)
387390
r1877r1878
389392   MDRV_SCREEN_ADD("main", RASTER)
390393   MDRV_SCREEN_REFRESH_RATE(60)
391394   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
392   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
395   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
393396   MDRV_SCREEN_SIZE(320, 256)
394397   MDRV_SCREEN_VISIBLE_AREA(0, 319, 0, 255)
395398
396   MDRV_PALETTE_LENGTH(256)
397   MDRV_PALETTE_INIT(ertictac)
398
399   MDRV_VIDEO_START(generic_bitmapped)
400   MDRV_VIDEO_UPDATE(generic_bitmapped)
399   MDRV_VIDEO_UPDATE(ertictac)
401400MACHINE_DRIVER_END
402401
403402ROM_START( ertictac )
src/mame/drivers/vsnes.c
r1877r1878
240240
241241static READ8_HANDLER( psg_4015_r )
242242{
243   return NESPSG_0_r(0x15);
243   return NESPSG_0_r(machine, 0x15);
244244}
245245
246246static WRITE8_HANDLER( psg_4015_w )
247247{
248   NESPSG_0_w(0x15, data);
248   NESPSG_0_w(machine, 0x15, data);
249249}
250250
251251static WRITE8_HANDLER( psg_4017_w )
252252{
253   NESPSG_0_w(0x17, data);
253   NESPSG_0_w(machine, 0x17, data);
254254}
255255
256256static READ8_HANDLER( psg1_4015_r )
257257{
258   return NESPSG_1_r(0x15);
258   return NESPSG_1_r(machine, 0x15);
259259}
260260
261261static WRITE8_HANDLER( psg1_4015_w )
262262{
263   NESPSG_1_w(0x15, data);
263   NESPSG_1_w(machine, 0x15, data);
264264}
265265
266266static WRITE8_HANDLER( psg1_4017_w )
267267{
268   NESPSG_1_w(0x17, data);
268   NESPSG_1_w(machine, 0x17, data);
269269}
270270
271271static ADDRESS_MAP_START( vsnes_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
513513   PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_COIN4 ) PORT_IMPULSE(1) \
514514   PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) /* this bit masks irqs - dont change */ \
515515
516#ifdef UNUSED_DEFINITION
516517static INPUT_PORTS_START( vsnes )
517518   VS_CONTROLS( IPT_START1, IPT_BUTTON3, IPT_START2, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_PLAYER(2)
518519
r1877r1878
542543   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
543544   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
544545INPUT_PORTS_END
546#endif
545547
546548static INPUT_PORTS_START( topgun )
547549   VS_CONTROLS( IPT_START1, IPT_UNKNOWN, IPT_START2, IPT_UNKNOWN )
src/mame/drivers/xyonix.c
r1877r1878
149149
150150/* Mem / Port Maps ***********************************************************/
151151
152static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
153   AM_RANGE(0x0000, 0xbfff) AM_READ(MRA8_ROM)
154   AM_RANGE(0xc000, 0xdfff) AM_READ(MRA8_RAM)
155   AM_RANGE(0xe000, 0xffff) AM_READ(MRA8_RAM)
152static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
153   AM_RANGE(0x0000, 0xbfff) AM_ROM
154   AM_RANGE(0xc000, 0xdfff) AM_RAM
155   AM_RANGE(0xe000, 0xffff) AM_READWRITE(MRA8_RAM, xyonix_vidram_w) AM_BASE(&xyonix_vidram)
156156ADDRESS_MAP_END
157157
158static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
159   AM_RANGE(0x0000, 0xbfff) AM_WRITE(MWA8_ROM)
160   AM_RANGE(0xc000, 0xdfff) AM_WRITE(MWA8_RAM)
161   AM_RANGE(0xe000, 0xffff) AM_WRITE(xyonix_vidram_w) AM_BASE(&xyonix_vidram)
162ADDRESS_MAP_END
163
164static ADDRESS_MAP_START( port_readmem, ADDRESS_SPACE_IO, 8 )
158static ADDRESS_MAP_START( port_map, ADDRESS_SPACE_IO, 8 )
165159   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
166   AM_RANGE(0x20, 0x21) AM_READ(MRA8_NOP)   /* SN76496 ready signal */
167   AM_RANGE(0xe0, 0xe0) AM_READ(xyonix_io_r)
168ADDRESS_MAP_END
169
170static ADDRESS_MAP_START( port_writemem, ADDRESS_SPACE_IO, 8 )
171   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
172   AM_RANGE(0x20, 0x20) AM_WRITE(SN76496_0_w)
173   AM_RANGE(0x21, 0x21) AM_WRITE(SN76496_1_w)
174   AM_RANGE(0xe0, 0xe0) AM_WRITE(xyonix_io_w)
175   AM_RANGE(0x40, 0x40) AM_WRITE(MWA8_NOP)   // NMI ack?
160   AM_RANGE(0x20, 0x20) AM_READWRITE(MRA8_NOP, SN76496_0_w)   /* SN76496 ready signal */
161   AM_RANGE(0x21, 0x21) AM_READWRITE(MRA8_NOP, SN76496_1_w)
162   AM_RANGE(0x40, 0x40) AM_WRITE(MWA8_NOP)      /* NMI ack? */
176163   AM_RANGE(0x50, 0x50) AM_WRITE(xyonix_irqack_w)
177   AM_RANGE(0x60, 0x61) AM_WRITE(MWA8_NOP)   // mc6845
164   AM_RANGE(0x60, 0x61) AM_WRITE(MWA8_NOP)      /* mc6845 */
165   AM_RANGE(0xe0, 0xe0) AM_READWRITE(xyonix_io_r, xyonix_io_w)
178166ADDRESS_MAP_END
179167
180168/* Inputs Ports **************************************************************/
r1877r1878
245233
246234   /* basic machine hardware */
247235   MDRV_CPU_ADD(Z80,16000000 / 4)       /* 4 MHz ? */
248   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
249   MDRV_CPU_IO_MAP(port_readmem,port_writemem)
250   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
236   MDRV_CPU_PROGRAM_MAP(main_map,0)
237   MDRV_CPU_IO_MAP(port_map,0)
238   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
251239   MDRV_CPU_PERIODIC_INT(irq0_line_assert,4*60)   /* ?? controls music tempo */
252240
253241   /* video hardware */
src/mame/drivers/victory.c
r1877r1878
212212   MDRV_CPU_ADD(Z80, VICTORY_MAIN_CPU_CLOCK)
213213   MDRV_CPU_PROGRAM_MAP(main_map,0)
214214   MDRV_CPU_IO_MAP(main_io_map,0)
215   MDRV_CPU_VBLANK_INT(victory_vblank_interrupt,1)
215   MDRV_CPU_VBLANK_INT("main", victory_vblank_interrupt)
216216
217217   MDRV_NVRAM_HANDLER(generic_0fill)
218218
src/mame/drivers/1943.c
r1877r1878
2121*/
2222
2323#include "driver.h"
24#include "deprecat.h"
2425#include "cpu/z80/z80.h"
2526#include "sound/2203intf.h"
2627
r1877r1878
251252   // basic machine hardware
252253   MDRV_CPU_ADD(Z80, 6000000)   // 6 MHz
253254   MDRV_CPU_PROGRAM_MAP(c1943_map, 0)
254   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
255   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
255256
256257   MDRV_CPU_ADD(Z80, 3000000)   // 3 MHz
257258   /* audio CPU */
258259   MDRV_CPU_PROGRAM_MAP(sound_map, 0)
259   MDRV_CPU_VBLANK_INT(irq0_line_hold, 4)
260   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold, 4)
260261
261262   // video hardware
262263
r1877r1878
276277   // sound hardware
277278   MDRV_SPEAKER_STANDARD_MONO("mono")
278279
279   MDRV_SOUND_ADD(YM2203, 1500000)
280   MDRV_SOUND_ADD(YM2203, XTAL_24MHz/16)   /* verified on pcb */
280281   MDRV_SOUND_ROUTE(0, "mono", 0.15)
281282   MDRV_SOUND_ROUTE(1, "mono", 0.15)
282283   MDRV_SOUND_ROUTE(2, "mono", 0.15)
283284   MDRV_SOUND_ROUTE(3, "mono", 0.10)
284285
285   MDRV_SOUND_ADD(YM2203, 1500000)
286   MDRV_SOUND_ADD(YM2203, XTAL_24MHz/16)   /* verified on pcb */
286287   MDRV_SOUND_ROUTE(0, "mono", 0.15)
287288   MDRV_SOUND_ROUTE(1, "mono", 0.15)
288289   MDRV_SOUND_ROUTE(2, "mono", 0.15)
src/mame/drivers/cninja.c
r1877r1878
5959
6060static WRITE16_HANDLER( cninja_sound_w )
6161{
62   soundlatch_w(0,data&0xff);
63   cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
62   soundlatch_w(machine,0,data&0xff);
63   cpunum_set_input_line(machine, 1,0,HOLD_LINE);
6464}
6565
6666static WRITE16_HANDLER( stoneage_sound_w )
6767{
68   soundlatch_w(0,data&0xff);
69   cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
68   soundlatch_w(machine,0,data&0xff);
69   cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
7070}
7171
7272static TIMER_CALLBACK( interrupt_gen )
r1877r1878
785785   /* basic machine hardware */
786786   MDRV_CPU_ADD(M68000, 12000000)
787787   MDRV_CPU_PROGRAM_MAP(cninja_readmem,cninja_writemem)
788   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
788   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)
789789
790790   MDRV_CPU_ADD(H6280,32220000/8)
791791   /* audio CPU */   /* Accurate */
r1877r1878
834834   /* basic machine hardware */
835835   MDRV_CPU_ADD(M68000, 12000000)
836836   MDRV_CPU_PROGRAM_MAP(cninja_readmem,cninja_writemem)
837   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
837   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)
838838
839839   MDRV_CPU_ADD(Z80, 3579545)
840840   /* audio CPU */
r1877r1878
880880   /* basic machine hardware */
881881   MDRV_CPU_ADD(M68000, 12000000)
882882   MDRV_CPU_PROGRAM_MAP(edrandy_readmem,edrandy_writemem)
883   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
883   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)
884884
885885   MDRV_CPU_ADD(H6280,32220000/8)
886886   /* audio CPU */   /* Accurate */
r1877r1878
929929   /* basic machine hardware */
930930   MDRV_CPU_ADD(M68000, 14000000)
931931   MDRV_CPU_PROGRAM_MAP(robocop2_readmem,robocop2_writemem)
932   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
932   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)
933933
934934   MDRV_CPU_ADD(H6280,32220000/8)
935935   /* audio CPU */   /* Accurate */
r1877r1878
981981   /* basic machine hardware */
982982   MDRV_CPU_ADD(M68000, 14000000)
983983   MDRV_CPU_PROGRAM_MAP(mutantf_readmem,mutantf_writemem)
984   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
984   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
985985
986986   MDRV_CPU_ADD(H6280,32220000/8)
987987   /* audio CPU */
src/mame/drivers/pacland.c
r1877r1878
415415   /* basic machine hardware */
416416   MDRV_CPU_ADD(M6809, 49152000/32)   /* 1.536 MHz */
417417   MDRV_CPU_PROGRAM_MAP(main_map,0)
418   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
418   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
419419
420420   MDRV_CPU_ADD(HD63701, 49152000/8)   /* 1.536 MHz? */
421421   MDRV_CPU_PROGRAM_MAP(mcu_map,0)
422422   MDRV_CPU_IO_MAP(mcu_port_map,0)
423   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
423   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
424424
425425   MDRV_INTERLEAVE(100)   /* we need heavy synching between the MCU and the CPU */
426426
src/mame/drivers/psikyo4.c
r1877r1878
365365
366366static READ32_HANDLER( psh_ymf_fm_r )
367367{
368   return YMF278B_status_port_0_r(0)<<24; /* Also, bit 0 being high indicates not ready to send sample data for test */
368   return YMF278B_status_port_0_r(machine, 0)<<24; /* Also, bit 0 being high indicates not ready to send sample data for test */
369369}
370370
371371static WRITE32_HANDLER( psh_ymf_fm_w )
372372{
373373   if (!(mem_mask & 0xff000000))   // FM bank 1 address (OPL2/OPL3 compatible)
374374   {
375      YMF278B_control_port_0_A_w(0, data>>24);
375      YMF278B_control_port_0_A_w(machine, 0, data>>24);
376376   }
377377
378378   if (!(mem_mask & 0x00ff0000))   // FM bank 1 data
379379   {
380      YMF278B_data_port_0_A_w(0, data>>16);
380      YMF278B_data_port_0_A_w(machine, 0, data>>16);
381381   }
382382
383383   if (!(mem_mask & 0x0000ff00))   // FM bank 2 address (OPL3/YMF 262 extended)
384384   {
385      YMF278B_control_port_0_B_w(0, data>>8);
385      YMF278B_control_port_0_B_w(machine, 0, data>>8);
386386   }
387387
388388   if (!(mem_mask & 0x000000ff))   // FM bank 2 data
389389   {
390      YMF278B_data_port_0_B_w(0, data);
390      YMF278B_data_port_0_B_w(machine, 0, data);
391391   }
392392}
393393
r1877r1878
395395{
396396   if (!(mem_mask & 0xff000000))   // PCM address (OPL4/YMF 278B extended)
397397   {
398      YMF278B_control_port_0_C_w(0, data>>24);
398      YMF278B_control_port_0_C_w(machine, 0, data>>24);
399399
400400#if ROMTEST
401401      if (data>>24 == 0x06)   // Reset Sample reading (They always write this code immediately before reading data)
r1877r1878
407407
408408   if (!(mem_mask & 0x00ff0000))   // PCM data
409409   {
410      YMF278B_data_port_0_C_w(0, data>>16);
410      YMF278B_data_port_0_C_w(machine, 0, data>>16);
411411   }
412412}
413413
r1877r1878
492492   /* basic machine hardware */
493493   MDRV_CPU_ADD_TAG("main", SH2, MASTER_CLOCK/2)
494494   MDRV_CPU_PROGRAM_MAP(ps4_readmem,ps4_writemem)
495   MDRV_CPU_VBLANK_INT(psikyosh_interrupt,1)
495   MDRV_CPU_VBLANK_INT("left", psikyosh_interrupt)
496496
497497   MDRV_NVRAM_HANDLER(93C56)
498498
src/mame/drivers/wardner.c
r1877r1878
174174
175175void wardner_restore_bank(void)
176176{
177   wardner_ramrom_bank_sw(0,1);   /* Dummy value to ensure restoration */
178   wardner_ramrom_bank_sw(0,wardner_membank);
177   wardner_ramrom_bank_sw(Machine,0,1);   /* Dummy value to ensure restoration */
178   wardner_ramrom_bank_sw(Machine,0,wardner_membank);
179179}
180180
181181
r1877r1878
468468   MDRV_CPU_ADD(Z80,24000000/4)         /* 6MHz ??? - Real board crystal is 24MHz */
469469   MDRV_CPU_PROGRAM_MAP(main_program_map, 0)
470470   MDRV_CPU_IO_MAP(main_io_map, 0)
471   MDRV_CPU_VBLANK_INT(wardner_interrupt,1)
471   MDRV_CPU_VBLANK_INT("main", wardner_interrupt)
472472
473473   MDRV_CPU_ADD(Z80,24000000/7)         /* 3.43MHz ??? */
474474   MDRV_CPU_PROGRAM_MAP(sound_program_map, 0)
src/mame/drivers/jcross.c
r1877r1878
5555static WRITE8_HANDLER( sound_command_w )
5656{
5757   sound_cpu_busy = 0x20;
58   soundlatch_w(0, data);
59   cpunum_set_input_line(Machine, 2, INPUT_LINE_NMI, PULSE_LINE);
58   soundlatch_w(machine, 0, data);
59   cpunum_set_input_line(machine, 2, INPUT_LINE_NMI, PULSE_LINE);
6060}
6161
6262static READ8_HANDLER( sound_command_r )
6363{
6464   sound_cpu_busy = 0;
65   return(soundlatch_r(0));
65   return(soundlatch_r(machine,0));
6666}
6767
6868static READ8_HANDLER( sound_nmi_ack_r )
r1877r1878
7373
7474static READ8_HANDLER( jcross_port_0_r )
7575{
76   return(input_port_0_r(0) | sound_cpu_busy);
76   return(input_port_0_r(machine,0) | sound_cpu_busy);
7777}
7878
7979static WRITE8_HANDLER(jcross_vregs0_w){jcross_vregs[0]=data;}
r1877r1878
261261
262262   MDRV_CPU_ADD(Z80, 3360000)
263263   MDRV_CPU_PROGRAM_MAP(cpuA_map,0)
264   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
264   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
265265
266266   MDRV_CPU_ADD(Z80, 3360000)
267267   MDRV_CPU_PROGRAM_MAP(cpuB_map,0)
268   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
268   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
269269
270270   MDRV_CPU_ADD(Z80, 4000000)
271271   /* audio CPU */
src/mame/drivers/nss.c
r1877r1878
310310
311311static READ8_HANDLER( spc_ram_100_r )
312312{
313   return spc_ram_r(offset + 0x100);
313   return spc_ram_r(machine, offset + 0x100);
314314}
315315
316316static WRITE8_HANDLER( spc_ram_100_w )
317317{
318   spc_ram_w(offset + 0x100, data);
318   spc_ram_w(machine, offset + 0x100, data);
319319}
320320
321321static ADDRESS_MAP_START( spc_mem, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
420420   MDRV_CPU_ADD_TAG("sound", SPC700, 2048000/2)   /* 2.048 Mhz, but internal divider */
421421   /* audio CPU */
422422   MDRV_CPU_PROGRAM_MAP(spc_mem, 0)
423   MDRV_CPU_VBLANK_INT(NULL, 0)
424423
425424   MDRV_INTERLEAVE(400)
426425
src/mame/drivers/rollrace.c
r1877r1878
55***************************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
89#include "cpu/z80/z80.h"
910#include "sound/ay8910.h"
1011
r1877r1878
237238   /* basic machine hardware */
238239   MDRV_CPU_ADD(Z80,XTAL_24MHz/8) /* verified on pcb */
239240   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
240   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
241   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
241242
242243   MDRV_CPU_ADD(Z80,XTAL_24MHz/16) /* verified on pcb */
243244   /* audio CPU */
244245   MDRV_CPU_PROGRAM_MAP(readmem_snd,writemem_snd)
245   MDRV_CPU_VBLANK_INT(nmi_line_pulse,4)
246   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,4)
246247
247248   /* video hardware */
248249   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/mirage.c
r1877r1878
3939
4040#include "deco16ic.h"
4141
42static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
42static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
4343{
4444   int offs;
4545
r1877r1878
5252
5353      y = spriteram16[offs];
5454      flash=y&0x1000;
55      if (flash && (cpu_getcurrentframe() & 1)) continue;
55      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
5656
5757      x = spriteram16[offs+2];
5858      colour = (x >>9) & 0x1f;
r1877r1878
349349   /* basic machine hardware */
350350   MDRV_CPU_ADD(M68000, 28000000/2)
351351   MDRV_CPU_PROGRAM_MAP(mirage_readmem,mirage_writemem)
352   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
352   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
353353
354354   /* video hardware */
355355   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/missile.c
r1877r1878
591591
592592   /* POKEY */
593593   else if (offset < 0x4800)
594      pokey1_w(offset & 0x0f, data);
594      pokey1_w(machine, offset & 0x0f, data);
595595
596596   /* OUT0 */
597597   else if (offset < 0x4900)
r1877r1878
650650
651651   /* POKEY */
652652   else if (offset < 0x4800)
653      result = pokey1_r(offset & 0x0f);
653      result = pokey1_r(machine, offset & 0x0f);
654654
655655   /* IN0 */
656656   else if (offset < 0x4900)
src/mame/drivers/ddrible.c
r1877r1878
9292static READ8_HANDLER( ddrible_vlm5030_busy_r )
9393{
9494   return mame_rand(Machine); /* patch */
95   /* FIXME: remove ? */
96#if 0
9597   if (VLM5030_BSY()) return 1;
9698   else return 0;
99#endif
97100}
98101
99102static WRITE8_HANDLER( ddrible_vlm5030_ctrl_w )
r1877r1878
342345   /* basic machine hardware */
343346   MDRV_CPU_ADD(M6809,   XTAL_18_432MHz/12)   /* verified on pcb */
344347   MDRV_CPU_PROGRAM_MAP(readmem_cpu0,writemem_cpu0)
345   MDRV_CPU_VBLANK_INT(ddrible_interrupt_0,1)
348   MDRV_CPU_VBLANK_INT("main", ddrible_interrupt_0)
346349
347350   MDRV_CPU_ADD(M6809,   XTAL_18_432MHz/12)   /* verified on pcb */
348351   MDRV_CPU_PROGRAM_MAP(readmem_cpu1,writemem_cpu1)
349   MDRV_CPU_VBLANK_INT(ddrible_interrupt_1,1)
352   MDRV_CPU_VBLANK_INT("main", ddrible_interrupt_1)
350353
351354   MDRV_CPU_ADD(M6809,   XTAL_18_432MHz/12)   /* verified on pcb */
352355   MDRV_CPU_PROGRAM_MAP(readmem_cpu2,writemem_cpu2)
src/mame/drivers/popper.c
r1877r1878
312312   /* basic machine hardware */
313313   MDRV_CPU_ADD(Z80,18432000/6)
314314   MDRV_CPU_PROGRAM_MAP(popper_readmem,popper_writemem)
315   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
315   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
316316
317317   MDRV_CPU_ADD(Z80,18432000/12)
318318   /* audio CPU */
319319   MDRV_CPU_PROGRAM_MAP(popper_sound_readmem,popper_sound_writemem)
320   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)      //NMIs caused by the main CPU
320   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)      //NMIs caused by the main CPU
321321
322322   MDRV_INTERLEAVE(30)
323323
src/mame/drivers/ladyfrog.c
r1877r1878
9797
9898static WRITE8_HANDLER( sound_command_w )
9999{
100   soundlatch_w(0,data);
100   soundlatch_w(machine,0,data);
101101   timer_call_after_resynch(NULL, data,nmi_callback);
102102}
103103
r1877r1878
281281static MACHINE_DRIVER_START( ladyfrog )
282282   MDRV_CPU_ADD(Z80,8000000/2)
283283   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
284   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
284   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
285285
286286   MDRV_CPU_ADD(Z80,8000000/2)
287287   /* audio CPU */
288288   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
289   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
289   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
290290
291291   /* video hardware */
292292   MDRV_INTERLEAVE(100)
src/mame/drivers/go2000.c
r1877r1878
169169static MACHINE_DRIVER_START( go2000 )
170170   MDRV_CPU_ADD_TAG("main", M68000, 10000000)
171171   MDRV_CPU_PROGRAM_MAP(go2000_readmem,go2000_writemem)
172   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
172   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
173173
174174   MDRV_GFXDECODE(go2000)
175175
src/mame/drivers/djboy.c
r1877r1878
403403
404404   logerror( "0x%04x: prot_w(0x%02x)\n", activecpu_get_pc(), data );
405405
406   watchdog_reset_w(0,0);
406   watchdog_reset_w(machine,0,0);
407407
408408   if( prot_mode == ePROT_WAIT_DSW1_WRITEBACK )
409409   {
r1877r1878
715715
716716static WRITE8_HANDLER( trigger_nmi_on_sound_cpu2 )
717717{
718   soundlatch_w(0,data);
719   cpunum_set_input_line(Machine, 2, INPUT_LINE_NMI, PULSE_LINE);
718   soundlatch_w(machine,0,data);
719   cpunum_set_input_line(machine, 2, INPUT_LINE_NMI, PULSE_LINE);
720720} /* trigger_nmi_on_sound_cpu2 */
721721
722722static WRITE8_HANDLER( cpu2_bankswitch_w )
r1877r1878
829829   MDRV_CPU_ADD(Z80,6000000)
830830   MDRV_CPU_PROGRAM_MAP(cpu0_am,0)
831831   MDRV_CPU_IO_MAP(cpu0_port_am,0)
832   MDRV_CPU_VBLANK_INT(djboy_interrupt,2)
832   MDRV_CPU_VBLANK_INT_HACK(djboy_interrupt,2)
833833
834834   MDRV_CPU_ADD(Z80,6000000)
835835   MDRV_CPU_PROGRAM_MAP(cpu1_am,0)
836836   MDRV_CPU_IO_MAP(cpu1_port_am,0)
837   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
837   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
838838
839839   MDRV_CPU_ADD(Z80, 6000000)
840840   MDRV_CPU_PROGRAM_MAP(cpu2_am,0)
841841   MDRV_CPU_IO_MAP(cpu2_port_am,0)
842   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
842   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
843843
844844   MDRV_INTERLEAVE(100)
845845
src/mame/drivers/sidearms.c
r1877r1878
718718   /* basic machine hardware */
719719   MDRV_CPU_ADD(Z80, 4000000) /* 4 MHz (?) */
720720   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
721   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
721   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
722722
723723   MDRV_CPU_ADD(Z80, 4000000) /* 4 MHz (?) */
724724   /* audio CPU */
r1877r1878
764764   /* basic machine hardware */
765765   MDRV_CPU_ADD(Z80, 4000000) /* 4 MHz (?) */
766766   MDRV_CPU_PROGRAM_MAP(turtship_readmem,turtship_writemem)
767   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
767   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
768768
769769   MDRV_CPU_ADD(Z80, 4000000) /* 4 MHz (?) */
770770   /* audio CPU */
r1877r1878
809809   /* basic machine hardware */
810810   MDRV_CPU_ADD(Z80, 4000000)        /* 4 MHz (?) */
811811   MDRV_CPU_PROGRAM_MAP(whizz_readmem,whizz_writemem)
812   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
812   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
813813
814814   MDRV_CPU_ADD(Z80, 4000000)
815815   /* audio CPU */
816816   MDRV_CPU_PROGRAM_MAP(whizz_sound_readmem,whizz_sound_writemem)
817817   MDRV_CPU_IO_MAP(whizz_readport,whizz_writeport)
818   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
818   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
819819
820820   MDRV_INTERLEAVE(1000)
821821
src/mame/drivers/taito_x.c
r1877r1878
10091009   /* basic machine hardware */
10101010   MDRV_CPU_ADD(M68000, XTAL_16MHz/2)   /* verified on pcb */
10111011   MDRV_CPU_PROGRAM_MAP(superman_readmem,superman_writemem)
1012   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
1012   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
10131013
10141014   MDRV_CPU_ADD(Z80, XTAL_16MHz/4)   /* verified on pcb */
10151015   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
r1877r1878
10491049   /* basic machine hardware */
10501050   MDRV_CPU_ADD(M68000, XTAL_16MHz/2)   /* verified on pcb */
10511051   MDRV_CPU_PROGRAM_MAP(daisenpu_readmem,daisenpu_writemem)
1052   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
1052   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
10531053
10541054   MDRV_CPU_ADD(Z80, XTAL_16MHz/4)   /* verified on pcb */
10551055   MDRV_CPU_PROGRAM_MAP(daisenpu_sound_readmem,daisenpu_sound_writemem)
r1877r1878
10861086   /* basic machine hardware */
10871087   MDRV_CPU_ADD(M68000, 8000000)   /* 8 MHz? */
10881088   MDRV_CPU_PROGRAM_MAP(gigandes_readmem,gigandes_writemem)
1089   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
1089   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
10901090
10911091   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz ??? */
10921092   MDRV_CPU_PROGRAM_MAP(ballbros_sound_readmem,ballbros_sound_writemem)
r1877r1878
11251125   /* basic machine hardware */
11261126   MDRV_CPU_ADD(M68000, 8000000)   /* 8 MHz? */
11271127   MDRV_CPU_PROGRAM_MAP(ballbros_readmem,ballbros_writemem)
1128   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
1128   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
11291129
11301130   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz ??? */
11311131   MDRV_CPU_PROGRAM_MAP(ballbros_sound_readmem,ballbros_sound_writemem)
src/mame/drivers/jack.c
r1877r1878
7272
7373static WRITE8_HANDLER( jack_sh_command_w )
7474{
75   soundlatch_w(0,data);
76   cpunum_set_input_line(Machine, 1, 0, HOLD_LINE);
75   soundlatch_w(machine,0,data);
76   cpunum_set_input_line(machine, 1, 0, HOLD_LINE);
7777}
7878
7979
r1877r1878
875875   /* basic machine hardware */
876876   MDRV_CPU_ADD_TAG("main", Z80, 18000000/6)   /* 3 MHz */
877877   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
878   MDRV_CPU_VBLANK_INT(irq0_line_hold,1) /* jack needs 1 or its too fast */
878   MDRV_CPU_VBLANK_INT("main", irq0_line_hold) /* jack needs 1 or its too fast */
879879
880880   MDRV_CPU_ADD(Z80,18000000/12)
881881   /* audio CPU */   /* 1.5 MHz */
r1877r1878
909909   /* basic machine hardware */
910910   MDRV_IMPORT_FROM(jack)
911911   MDRV_CPU_MODIFY("main")
912   MDRV_CPU_VBLANK_INT(irq0_line_hold,2) /* tripool needs 2 or the palette is broken */
912   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2) /* tripool needs 2 or the palette is broken */
913913MACHINE_DRIVER_END
914914
915915static INTERRUPT_GEN( joinem_interrupts )
r1877r1878
929929   MDRV_IMPORT_FROM(jack)
930930   MDRV_CPU_MODIFY("main")
931931   MDRV_CPU_PROGRAM_MAP(joinem_map,0)
932   MDRV_CPU_VBLANK_INT(joinem_interrupts,3)
932   MDRV_CPU_VBLANK_INT_HACK(joinem_interrupts,3)
933933
934934   MDRV_GFXDECODE(joinem)
935935   MDRV_PALETTE_LENGTH(0x100)
r1877r1878
949949   MDRV_IMPORT_FROM(jack)
950950   MDRV_CPU_MODIFY("main")
951951   MDRV_CPU_PROGRAM_MAP(joinem_map,0)
952   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
952   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
953953
954954   MDRV_GFXDECODE(joinem)
955955   MDRV_PALETTE_LENGTH(0x100)
src/mame/drivers/tumblep.c
r1877r1878
7272
7373static WRITE16_HANDLER( tumblep_sound_w )
7474{
75   soundlatch_w(0,data & 0xff);
76   cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
75   soundlatch_w(machine,0,data & 0xff);
76   cpunum_set_input_line(machine, 1,0,HOLD_LINE);
7777}
7878
7979#ifdef UNUSED_FUNCTION
8080static WRITE16_HANDLER( jumppop_sound_w )
8181{
82   soundlatch_w(0,data & 0xff);
83   cpunum_set_input_line(Machine, 1, 0, ASSERT_LINE );
82   soundlatch_w(machine,0,data & 0xff);
83   cpunum_set_input_line(machine, 1, 0, ASSERT_LINE );
8484}
8585#endif
8686
r1877r1878
140140{
141141   switch (offset) {
142142   case 0:
143      YM2151_register_port_0_w(0,data);
143      YM2151_register_port_0_w(machine,0,data);
144144      break;
145145   case 1:
146      YM2151_data_port_0_w(0,data);
146      YM2151_data_port_0_w(machine,0,data);
147147      break;
148148   }
149149}
r1877r1878
321321   /* basic machine hardware */
322322   MDRV_CPU_ADD(M68000, 14000000)
323323   MDRV_CPU_PROGRAM_MAP(tumblepop_readmem,tumblepop_writemem)
324   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
324   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
325325
326326   MDRV_CPU_ADD(H6280, 32220000/8)   /* Custom chip 45; Audio section crystal is 32.220 MHz */
327327   /* audio CPU */
src/mame/drivers/dogfgt.c
r1877r1878
5757   {
5858      /* bit 4 goes to the 8910 #0 BC1 pin */
5959      if (last & 0x10)
60         AY8910_control_port_0_w(0,soundlatch);
60         AY8910_control_port_0_w(machine,0,soundlatch);
6161      else
62         AY8910_write_port_0_w(0,soundlatch);
62         AY8910_write_port_0_w(machine,0,soundlatch);
6363   }
6464   /* bit 7 goes to 8910 #1 BDIR pin  */
6565   if ((last & 0x80) == 0x80 && (data & 0x80) == 0x00)
6666   {
6767      /* bit 6 goes to the 8910 #1 BC1 pin */
6868      if (last & 0x40)
69         AY8910_control_port_1_w(0,soundlatch);
69         AY8910_control_port_1_w(machine,0,soundlatch);
7070      else
71         AY8910_write_port_1_w(0,soundlatch);
71         AY8910_write_port_1_w(machine,0,soundlatch);
7272   }
7373
7474   last = data;
r1877r1878
243243   /* basic machine hardware */
244244   MDRV_CPU_ADD(M6502, 1500000)   /* 1.5 MHz ???? */
245245   MDRV_CPU_PROGRAM_MAP(main_readmem,main_writemem)
246   MDRV_CPU_VBLANK_INT(irq0_line_hold,16)   /* ? controls music tempo */
246   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,16)   /* ? controls music tempo */
247247
248248   MDRV_CPU_ADD(M6502, 1500000)   /* 1.5 MHz ???? */
249249   MDRV_CPU_PROGRAM_MAP(sub_readmem,sub_writemem)
src/mame/drivers/dietgo.c
r1877r1878
4343{
4444   switch (offset) {
4545   case 0:
46      YM2151_register_port_0_w(0,data);
46      YM2151_register_port_0_w(machine,0,data);
4747      break;
4848   case 1:
49      YM2151_data_port_0_w(0,data);
49      YM2151_data_port_0_w(machine,0,data);
5050      break;
5151   }
5252}
r1877r1878
205205   /* basic machine hardware */
206206   MDRV_CPU_ADD(M68000, XTAL_28MHz/2) /* DE102 (verified on pcb) */
207207   MDRV_CPU_PROGRAM_MAP(dietgo_map,0)
208   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
208   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
209209
210210   MDRV_CPU_ADD(H6280, XTAL_32_22MHz/4/3)   /* Custom chip 45; XIN is 32.220MHZ/4, verified on pcb */
211211   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
src/mame/drivers/taitosj.c
r1877r1878
225225
226226static WRITE8_HANDLER( taitosj_soundcommand_w )
227227{
228   soundlatch_w(offset,data);
229   if (!sndnmi_disable) cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
228   soundlatch_w(machine,offset,data);
229   if (!sndnmi_disable) cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
230230}
231231
232232static UINT8 input_port_4_f0;
r1877r1878
18611861   /* basic machine hardware */
18621862   MDRV_CPU_ADD_TAG("main",Z80,8000000/2)      /* 4 MHz */
18631863   MDRV_CPU_PROGRAM_MAP(taitosj_main_nomcu_map,0)
1864   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1864   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
18651865
18661866   /* audio CPU */      /* 3 MHz */
18671867   MDRV_CPU_ADD(Z80,6000000/2)
src/mame/drivers/vigilant.c
r1877r1878
1515***************************************************************************/
1616
1717#include "driver.h"
18#include "deprecat.h"
1819#include "audio/m72.h"
1920#include "sound/dac.h"
2021#include "sound/2203intf.h"
r1877r1878
584585   MDRV_CPU_ADD(Z80, 3579645)         /* 3.579645 MHz */
585586   MDRV_CPU_PROGRAM_MAP(vigilant_readmem,vigilant_writemem)
586587   MDRV_CPU_IO_MAP(vigilant_readport,vigilant_writeport)
587   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
588   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
588589
589590   MDRV_CPU_ADD(Z80, 3579645)
590591   /* audio CPU */         /* 3.579645 MHz */
591592   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
592593   MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
593   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1 */
594   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,128)   /* clocked by V1 */
594595                        /* IRQs are generated by main Z80 and YM2151 */
595596   MDRV_MACHINE_RESET(m72_sound)
596597
r1877r1878
627628   MDRV_CPU_ADD(Z80, 5688800)         /* 5.688800 MHz */
628629   MDRV_CPU_PROGRAM_MAP(vigilant_readmem,vigilant_writemem)
629630   MDRV_CPU_IO_MAP(vigilant_readport,vigilant_writeport)
630   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
631   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
631632
632633   MDRV_CPU_ADD(Z80, 18432000/6)
633634   /* audio CPU */         /* 3.072000 MHz */
634635   MDRV_CPU_PROGRAM_MAP(buccanrs_sound_readmem,buccanrs_sound_writemem)
635636   MDRV_CPU_IO_MAP(buccanrs_sound_readport,buccanrs_sound_writeport)
636   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1 */
637   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,128)   /* clocked by V1 */
637638                        /* IRQs are generated by main Z80 and YM2151 */
638639   MDRV_MACHINE_RESET(m72_sound)
639640
r1877r1878
686687   MDRV_CPU_ADD(Z80, 3579645)         /* 3.579645 MHz */
687688   MDRV_CPU_PROGRAM_MAP(kikcubic_readmem,kikcubic_writemem)
688689   MDRV_CPU_IO_MAP(kikcubic_readport,kikcubic_writeport)
689   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
690   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
690691
691692   MDRV_CPU_ADD(Z80, 3579645)
692693   /* audio CPU */         /* 3.579645 MHz */
693694   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
694695   MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
695   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1 */
696   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,128)   /* clocked by V1 */
696697                        /* IRQs are generated by main Z80 and YM2151 */
697698   MDRV_MACHINE_RESET(m72_sound)
698699
src/mame/drivers/kingobox.c
r1877r1878
6161}
6262
6363static WRITE8_HANDLER( video_interrupt_w ) {
64   cpunum_set_input_line_and_vector(Machine, 1, 0, HOLD_LINE, 0xff );
64   cpunum_set_input_line_and_vector(machine, 1, 0, HOLD_LINE, 0xff );
6565}
6666
6767static WRITE8_HANDLER( sprite_interrupt_w ) {
68   cpunum_set_input_line_and_vector(Machine, 2, 0, HOLD_LINE, 0xff );
68   cpunum_set_input_line_and_vector(machine, 2, 0, HOLD_LINE, 0xff );
6969}
7070
7171static WRITE8_HANDLER( scroll_interrupt_w ) {
72   sprite_interrupt_w( offset, data );
72   sprite_interrupt_w( machine, offset, data );
7373   *kingofb_scroll_y = data;
7474}
7575
7676static WRITE8_HANDLER( sound_command_w ) {
77   soundlatch_w( 0, data );
78   cpunum_set_input_line_and_vector(Machine, 3, 0, HOLD_LINE, 0xff );
77   soundlatch_w( machine, 0, data );
78   cpunum_set_input_line_and_vector(machine, 3, 0, HOLD_LINE, 0xff );
7979}
8080
8181
r1877r1878
553553   /* basic machine hardware */
554554   MDRV_CPU_ADD(Z80, 4000000)        /* 4.0 MHz */
555555   MDRV_CPU_PROGRAM_MAP(main_readmem,main_writemem)
556   MDRV_CPU_VBLANK_INT(kingofb_interrupt,1)
556   MDRV_CPU_VBLANK_INT("main", kingofb_interrupt)
557557
558558   MDRV_CPU_ADD(Z80, 4000000)        /* 4.0 MHz */
559559   MDRV_CPU_PROGRAM_MAP(video_readmem,video_writemem)
560   MDRV_CPU_VBLANK_INT(kingofb_interrupt,1)
560   MDRV_CPU_VBLANK_INT("main", kingofb_interrupt)
561561
562562   MDRV_CPU_ADD(Z80, 4000000)        /* 4.0 MHz */
563563   MDRV_CPU_PROGRAM_MAP(sprite_readmem,sprite_writemem)
564   MDRV_CPU_VBLANK_INT(kingofb_interrupt,1)
564   MDRV_CPU_VBLANK_INT("main", kingofb_interrupt)
565565
566566   MDRV_CPU_ADD(Z80, 4000000)
567567   /* audio CPU */        /* 4.0 MHz */
r1877r1878
604604   /* basic machine hardware */
605605   MDRV_CPU_ADD(Z80, 4000000)        /* 4.0 MHz */
606606   MDRV_CPU_PROGRAM_MAP(rk_main_readmem,rk_main_writemem)
607   MDRV_CPU_VBLANK_INT(kingofb_interrupt,1)
607   MDRV_CPU_VBLANK_INT("main", kingofb_interrupt)
608608
609609   MDRV_CPU_ADD(Z80, 4000000)        /* 4.0 MHz */
610610   MDRV_CPU_PROGRAM_MAP(rk_video_readmem,rk_video_writemem)
611   MDRV_CPU_VBLANK_INT(kingofb_interrupt,1)
611   MDRV_CPU_VBLANK_INT("main", kingofb_interrupt)
612612
613613   MDRV_CPU_ADD(Z80, 4000000)        /* 4.0 MHz */
614614   MDRV_CPU_PROGRAM_MAP(rk_sprite_readmem,rk_sprite_writemem)
615   MDRV_CPU_VBLANK_INT(kingofb_interrupt,1)
615   MDRV_CPU_VBLANK_INT("main", kingofb_interrupt)
616616
617617   MDRV_CPU_ADD(Z80, 4000000)
618618   /* audio CPU */        /* 4.0 MHz */
src/mame/drivers/galivan.c
r1877r1878
5959
6060static WRITE8_HANDLER( galivan_sound_command_w )
6161{
62   soundlatch_w(offset,(data << 1) | 1);
62   soundlatch_w(machine,offset,(data << 1) | 1);
6363}
6464
6565static READ8_HANDLER( galivan_sound_command_r )
6666{
6767   int data;
6868
69   data = soundlatch_r(offset);
70   soundlatch_clear_w(0,0);
69   data = soundlatch_r(machine,offset);
70   soundlatch_clear_w(machine,0,0);
7171   return data;
7272}
7373
r1877r1878
8383   switch (offset)
8484   {
8585      case   0x0b:
86         ninjemak_scrolly_w(0, data);
86         ninjemak_scrolly_w(machine, 0, data);
8787         break;
8888      case   0x0c:
89         ninjemak_scrolly_w(1, data);
89         ninjemak_scrolly_w(machine, 1, data);
9090         break;
9191      case   0x0d:
92         ninjemak_scrollx_w(0, data);
92         ninjemak_scrollx_w(machine, 0, data);
9393         break;
9494      case   0x0e:
95         ninjemak_scrollx_w(1, data);
95         ninjemak_scrollx_w(machine, 1, data);
9696         break;
9797      default:
9898         break;
r1877r1878
560560   MDRV_CPU_ADD(Z80,12000000/2)      /* 6 MHz? */
561561   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
562562   MDRV_CPU_IO_MAP(readport,writeport)
563   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
563   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
564564
565565   MDRV_CPU_ADD(Z80,8000000/2)
566566   /* audio CPU */      /* 4 MHz? */
r1877r1878
604604   MDRV_CPU_ADD(Z80,12000000/2)      /* 6 MHz? */
605605   MDRV_CPU_PROGRAM_MAP(readmem,ninjemak_writemem)
606606   MDRV_CPU_IO_MAP(ninjemak_readport,ninjemak_writeport)
607   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
607   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
608608
609609   MDRV_CPU_ADD(Z80,8000000/2)
610610   /* audio CPU */      /* 4 MHz? */
src/mame/drivers/nbmj8991.c
r1877r1878
2929******************************************************************************/
3030
3131#include "driver.h"
32#include "deprecat.h"
3233#include "nb1413m3.h"
3334#include "sound/ay8910.h"
3435#include "sound/3812intf.h"
r1877r1878
5960
6061static WRITE8_HANDLER( nbmj8991_soundbank_w )
6162{
62   if (!(data & 0x80)) soundlatch_clear_w(0, 0);
63   if (!(data & 0x80)) soundlatch_clear_w(machine, 0, 0);
6364   memory_set_bank(1, data & 0x03);
6465}
6566
6667static WRITE8_HANDLER( nbmj8991_sound_w )
6768{
68   soundlatch_w(0, data);
69   soundlatch_w(machine, 0, data);
6970}
7071
7172static READ8_HANDLER( nbmj8991_sound_r )
7273{
7374   int data;
7475
75   data = soundlatch_r(0);
76   data = soundlatch_r(machine,0);
7677   return data;
7778}
7879
r1877r1878
17591760   MDRV_CPU_ADD_TAG("main", Z80, 25000000/5)      /* 5.00 MHz ? */
17601761   MDRV_CPU_PROGRAM_MAP(readmem_galkoku, writemem_galkoku)
17611762   MDRV_CPU_IO_MAP(readport_galkoku, writeport_galkoku)
1762//  MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 128)
1763   MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 1)
1763//  MDRV_CPU_VBLANK_INT_HACK(nb1413m3_interrupt, 128)
1764   MDRV_CPU_VBLANK_INT("main", nb1413m3_interrupt)
17641765
17651766   MDRV_MACHINE_RESET(nbmj8991)
17661767
r1877r1878
17931794   MDRV_CPU_ADD_TAG("main", Z80, 6000000/2)   /* 3.00 MHz */
17941795   MDRV_CPU_PROGRAM_MAP(readmem_pstadium, writemem_pstadium)
17951796   MDRV_CPU_IO_MAP(readport_pstadium, writeport_pstadium)
1796   MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 1)
1797   MDRV_CPU_VBLANK_INT("main", nb1413m3_interrupt)
17971798
17981799   MDRV_CPU_ADD(Z80, 3900000)               /* 4.00 MHz */
17991800   /* audio CPU */
18001801   MDRV_CPU_PROGRAM_MAP(sound_readmem_nbmj8991, sound_writemem_nbmj8991)
18011802   MDRV_CPU_IO_MAP(sound_readport_nbmj8991, sound_writeport_nbmj8991)
1802   MDRV_CPU_VBLANK_INT(irq0_line_hold, 128)
1803   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold, 128)
18031804
18041805   MDRV_MACHINE_RESET(nbmj8991)
18051806
src/mame/drivers/blockout.c
r1877r1878
3636{
3737   if (ACCESSING_LSB)
3838   {
39      soundlatch_w(offset,data & 0xff);
40      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
39      soundlatch_w(machine,offset,data & 0xff);
40      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
4141   }
4242}
4343
r1877r1878
318318   /* basic machine hardware */
319319   MDRV_CPU_ADD(M68000, 10000000)       /* MRH - 8.76 makes gfx/adpcm samples sync better -- but 10 is correct speed*/
320320   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
321   MDRV_CPU_VBLANK_INT(blockout_interrupt,2)
321   MDRV_CPU_VBLANK_INT_HACK(blockout_interrupt,2)
322322
323323   MDRV_CPU_ADD(Z80, 3579545)
324324   /* audio CPU */   /* 3.579545 MHz */
src/mame/drivers/tsamurai.c
r1877r1878
384384}
385385
386386static WRITE8_HANDLER( vsgongf_sound_command_w ){
387   soundlatch_w( offset, data );
388   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE );
387   soundlatch_w( machine, offset, data );
388   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE );
389389}
390390
391391static ADDRESS_MAP_START( readmem_vsgongf, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
754754   MDRV_CPU_ADD(Z80, 4000000)
755755   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
756756   MDRV_CPU_IO_MAP(z80_readport,z80_writeport)
757   MDRV_CPU_VBLANK_INT(samurai_interrupt,1)
757   MDRV_CPU_VBLANK_INT("main", samurai_interrupt)
758758
759759   MDRV_CPU_ADD(Z80, 2000000)
760760   /* audio CPU */
r1877r1878
799799   MDRV_CPU_ADD(Z80, 4000000)
800800   MDRV_CPU_PROGRAM_MAP(readmem_m660,writemem_m660)
801801   MDRV_CPU_IO_MAP(z80_readport,z80_writeport_m660)
802   MDRV_CPU_VBLANK_INT(samurai_interrupt,1)
802   MDRV_CPU_VBLANK_INT("main", samurai_interrupt)
803803
804804   MDRV_CPU_ADD(Z80, 2000000)
805805   /* audio CPU */
r1877r1878
813813   /* audio CPU */
814814   MDRV_CPU_PROGRAM_MAP(readmem_sound3_m660,writemem_sound3_m660)
815815   MDRV_CPU_IO_MAP(readport_sound3_m660,writeport_sound3_m660)
816   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
816   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
817817
818818   /* video hardware */
819819   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
849849   /* basic machine hardware */
850850   MDRV_CPU_ADD(Z80, 4000000)
851851   MDRV_CPU_PROGRAM_MAP(readmem_vsgongf,writemem_vsgongf)
852   MDRV_CPU_VBLANK_INT(samurai_interrupt,1)
852   MDRV_CPU_VBLANK_INT("main", samurai_interrupt)
853853
854854   MDRV_CPU_ADD(Z80, 4000000)
855855   MDRV_CPU_PROGRAM_MAP(readmem_sound_vsgongf,writemem_sound_vsgongf)
856856   MDRV_CPU_IO_MAP(0,z80_writeport)
857   MDRV_CPU_VBLANK_INT(vsgongf_sound_interrupt,3)
857   MDRV_CPU_VBLANK_INT_HACK(vsgongf_sound_interrupt,3)
858858
859859   /* video hardware */
860860   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/igs_m027.c
r1877r1878
368368
369369   MDRV_CPU_PROGRAM_MAP(igs_majhong_map,0)
370370
371   MDRV_CPU_VBLANK_INT(igs_majhong_interrupt,1)
371   MDRV_CPU_VBLANK_INT("main", igs_majhong_interrupt)
372372   //MDRV_NVRAM_HANDLER(generic_0fill)
373373
374374   MDRV_GFXDECODE(igs_m027)
src/mame/drivers/canyon.c
r1877r1878
237237   /* basic machine hardware */
238238   MDRV_CPU_ADD(M6502, 12096000 / 16)
239239   MDRV_CPU_PROGRAM_MAP(main_map,0)
240   MDRV_CPU_VBLANK_INT(nmi_line_pulse, 1)
240   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
241241   MDRV_WATCHDOG_VBLANK_INIT(8)
242242
243243   /* video hardware */
src/mame/drivers/ettrivia.c
r1877r1878
9393      /* special case to return the value written to 0xb000 */
9494      /* does it reset the chips too ? */
9595      case 0:   break;
96      case 0xc4: b000_ret = AY8910_read_port_0_r(0);   break;
97      case 0x94: b000_ret = AY8910_read_port_1_r(0);   break;
98      case 0x86: b000_ret = AY8910_read_port_2_r(0);   break;
96      case 0xc4: b000_ret = AY8910_read_port_0_r(machine,0);   break;
97      case 0x94: b000_ret = AY8910_read_port_1_r(machine,0);   break;
98      case 0x86: b000_ret = AY8910_read_port_2_r(machine,0);   break;
9999
100100      case 0x80:
101101         switch(b800_prev)
102102         {
103            case 0xe0: AY8910_control_port_0_w(0,b000_val);   break;
104            case 0x98: AY8910_control_port_1_w(0,b000_val);   break;
105            case 0x83: AY8910_control_port_2_w(0,b000_val);   break;
103            case 0xe0: AY8910_control_port_0_w(machine,0,b000_val);   break;
104            case 0x98: AY8910_control_port_1_w(machine,0,b000_val);   break;
105            case 0x83: AY8910_control_port_2_w(machine,0,b000_val);   break;
106106
107            case 0xa0: AY8910_write_port_0_w(0,b000_val);   break;
108            case 0x88: AY8910_write_port_1_w(0,b000_val);   break;
109            case 0x81: AY8910_write_port_2_w(0,b000_val);   break;
107            case 0xa0: AY8910_write_port_0_w(machine,0,b000_val);   break;
108            case 0x88: AY8910_write_port_1_w(machine,0,b000_val);   break;
109            case 0x81: AY8910_write_port_2_w(machine,0,b000_val);   break;
110110
111111         }
112112      break;
r1877r1878
230230   MDRV_CPU_ADD(Z80,12000000/4-48000) //should be ok, it gives the 300 interrupts expected
231231   MDRV_CPU_PROGRAM_MAP(cpu_map,0)
232232   MDRV_CPU_IO_MAP(io_map,0)
233   MDRV_CPU_VBLANK_INT(ettrivia_interrupt,1)
233   MDRV_CPU_VBLANK_INT("main", ettrivia_interrupt)
234234
235235   MDRV_NVRAM_HANDLER(generic_0fill)
236236
src/mame/drivers/splash.c
r1877r1878
6969static WRITE16_HANDLER( splash_sh_irqtrigger_w )
7070{
7171   if (ACCESSING_LSB){
72      soundlatch_w(0,data & 0xff);
73      cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
72      soundlatch_w(machine,0,data & 0xff);
73      cpunum_set_input_line(machine, 1,0,HOLD_LINE);
7474   }
7575}
7676
7777static WRITE16_HANDLER( roldf_sh_irqtrigger_w )
7878{
7979   if (ACCESSING_LSB){
80      soundlatch_w(0,data & 0xff);
81      cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
80      soundlatch_w(machine,0,data & 0xff);
81      cpunum_set_input_line(machine, 1,0,HOLD_LINE);
8282   }
8383
8484   // give the z80 time to see it
r1877r1878
435435   /* basic machine hardware */
436436   MDRV_CPU_ADD(M68000,24000000/2)         /* 12 MHz (24/2) */
437437   MDRV_CPU_PROGRAM_MAP(splash_readmem,splash_writemem)
438   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
438   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
439439
440440   MDRV_CPU_ADD(Z80,30000000/8)
441441   /* audio CPU */
442442   MDRV_CPU_PROGRAM_MAP(splash_readmem_sound,splash_writemem_sound)
443   MDRV_CPU_VBLANK_INT(nmi_line_pulse,64)   /* needed for the msm5205 to play the samples */
443   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,64)   /* needed for the msm5205 to play the samples */
444444
445445   /* video hardware */
446446   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
482482   /* basic machine hardware */
483483   MDRV_CPU_ADD(M68000,24000000/2)         /* 12 MHz - verified */
484484   MDRV_CPU_PROGRAM_MAP(roldfrog_readmem,roldfrog_writemem)
485   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
485   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
486486
487487   MDRV_CPU_ADD(Z80,3000000)         /* 3 MHz - verified */
488488   /* audio CPU */
489489   MDRV_CPU_PROGRAM_MAP(roldf_sound_map,0)
490490   MDRV_CPU_IO_MAP(roldf_sound_io_map,0)
491//  MDRV_CPU_VBLANK_INT(nmi_line_pulse,64)  /* needed for the msm5205 to play the samples */
491//  MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,64)  /* needed for the msm5205 to play the samples */
492492
493493   /* video hardware */
494494   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
521521   /* basic machine hardware */
522522   MDRV_CPU_ADD(M68000,24000000/2)         /* 12 MHz (24/2) */
523523   MDRV_CPU_PROGRAM_MAP(funystrp_readmem,funystrp_writemem)
524   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
524   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
525525
526526//  MDRV_CPU_ADD(Z80,30000000/8)
527527//  /* audio CPU */
528528//  MDRV_CPU_PROGRAM_MAP(splash_readmem_sound,splash_writemem_sound)
529//  MDRV_CPU_VBLANK_INT(nmi_line_pulse,64)  /* needed for the msm5205 to play the samples */
529//  MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,64)  /* needed for the msm5205 to play the samples */
530530
531531   /* video hardware */
532532   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/jalmah.c
r1877r1878
195195}
196196
197197#define MCU_READ(_number_,_bit_,_offset_,_retval_)\
198if((0xffff - input_port_##_number_##_word_r(0,0)) & _bit_) { jm_regs[_offset_] = _retval_; }
198if((0xffff - readinputport(_number_)) & _bit_) { jm_regs[_offset_] = _retval_; }
199199
200200/*RAM-based protection handlings*/
201201static void daireika_mcu_run(running_machine *machine)
202202{
203203   static UINT16 prg_prot;
204204
205   if((0xffff - input_port_0_word_r(0,0)) & 0x0008)//service_mode
205   if((0xffff - input_port_0_word_r(machine,0,0)) & 0x0008)//service_mode
206206   {
207      jm_regs[0x000/2] = input_port_2_word_r(0,0);
208      jm_regs[0x002/2] = input_port_3_word_r(0,0);
209      jm_regs[0x004/2] = input_port_4_word_r(0,0);
210      jm_regs[0x006/2] = input_port_5_word_r(0,0);
211      jm_regs[0x008/2] = input_port_6_word_r(0,0);
212      jm_regs[0x00a/2] = input_port_7_word_r(0,0);
207      jm_regs[0x000/2] = input_port_2_word_r(machine,0,0);
208      jm_regs[0x002/2] = input_port_3_word_r(machine,0,0);
209      jm_regs[0x004/2] = input_port_4_word_r(machine,0,0);
210      jm_regs[0x006/2] = input_port_5_word_r(machine,0,0);
211      jm_regs[0x008/2] = input_port_6_word_r(machine,0,0);
212      jm_regs[0x00a/2] = input_port_7_word_r(machine,0,0);
213213   }
214214   else
215215   {
r1877r1878
247247{
248248   static UINT16 prg_prot;
249249
250   if((0xffff - input_port_0_word_r(0,0)) & 0x0008)//service_mode
250   if((0xffff - input_port_0_word_r(machine,0,0)) & 0x0008)//service_mode
251251   {
252      jm_regs[0x300/2] = input_port_2_word_r(0,0);
253      jm_regs[0x302/2] = input_port_3_word_r(0,0);
254      jm_regs[0x304/2] = input_port_4_word_r(0,0);
255      jm_regs[0x306/2] = input_port_5_word_r(0,0);
256      jm_regs[0x308/2] = input_port_6_word_r(0,0);
257      jm_regs[0x30a/2] = input_port_7_word_r(0,0);
252      jm_regs[0x300/2] = input_port_2_word_r(machine,0,0);
253      jm_regs[0x302/2] = input_port_3_word_r(machine,0,0);
254      jm_regs[0x304/2] = input_port_4_word_r(machine,0,0);
255      jm_regs[0x306/2] = input_port_5_word_r(machine,0,0);
256      jm_regs[0x308/2] = input_port_6_word_r(machine,0,0);
257      jm_regs[0x30a/2] = input_port_7_word_r(machine,0,0);
258258   }
259259   else
260260   {
r1877r1878
289289
290290static void second_mcu_run(running_machine *machine)
291291{
292   if((0xffff - input_port_1_word_r(0,0)) & 0x0004)//service_mode
292   if((0xffff - input_port_1_word_r(machine,0,0)) & 0x0004)//service_mode
293293   {
294      jm_regs[0x200/2] = input_port_2_word_r(0,0);
295      jm_regs[0x202/2] = input_port_3_word_r(0,0);
296      jm_regs[0x204/2] = input_port_4_word_r(0,0);
294      jm_regs[0x200/2] = input_port_2_word_r(machine,0,0);
295      jm_regs[0x202/2] = input_port_3_word_r(machine,0,0);
296      jm_regs[0x204/2] = input_port_4_word_r(machine,0,0);
297297   }
298298   else
299299   {
r1877r1878
10021002static MACHINE_DRIVER_START( jalmah )
10031003   MDRV_CPU_ADD_TAG("main" , M68000, 8000000) /* 68000-8 */
10041004   MDRV_CPU_PROGRAM_MAP(jalmah,0)
1005   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
1005   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
10061006
10071007   MDRV_GFXDECODE(jalmah)
10081008
src/mame/drivers/f1gp.c
r1877r1878
7272   if (ACCESSING_LSB)
7373   {
7474      pending_command = 1;
75      soundlatch_w(offset,data & 0xff);
76      cpunum_set_input_line(Machine, 2, INPUT_LINE_NMI, PULSE_LINE);
75      soundlatch_w(machine,offset,data & 0xff);
76      cpunum_set_input_line(machine, 2, INPUT_LINE_NMI, PULSE_LINE);
7777   }
7878}
7979
r1877r1878
568568   /* basic machine hardware */
569569   MDRV_CPU_ADD_TAG("main",M68000,XTAL_20MHz/2)   /* verified on pcb */
570570   MDRV_CPU_PROGRAM_MAP(f1gp_readmem1,f1gp_writemem1)
571   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
571   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
572572
573573   MDRV_CPU_ADD(M68000,XTAL_20MHz/2)   /* verified on pcb */
574574   MDRV_CPU_PROGRAM_MAP(readmem2,writemem2)
575   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
575   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
576576
577577   MDRV_CPU_ADD(Z80,XTAL_20MHz/4)   /* verified on pcb */
578578   /* audio CPU */
r1877r1878
611611   /* basic machine hardware */
612612   MDRV_CPU_ADD_TAG("main",M68000,10000000)   /* 10 MHz ??? */
613613   MDRV_CPU_PROGRAM_MAP(f1gpb_cpu1_map,0)
614   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
614   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
615615
616616   MDRV_CPU_ADD(M68000,10000000)   /* 10 MHz ??? */
617617   MDRV_CPU_PROGRAM_MAP(f1gpb_cpu2_map,0)
618   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
618   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
619619
620620   /* NO sound CPU */
621621   MDRV_INTERLEAVE(100) /* 100 CPU slices per frame */
src/mame/drivers/supdrapo.c
r1877r1878
264264static MACHINE_DRIVER_START( supdrapo )
265265   MDRV_CPU_ADD(Z80,8000000/2)       /* ??? */
266266   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
267   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
267   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
268268
269269   /* video hardware */
270270   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/lvcards.c
r1877r1878
469469
470470   MDRV_CPU_PROGRAM_MAP(lvcards_map, 0)
471471   MDRV_CPU_IO_MAP(lvcards_io_map, 0)
472   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
472   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
473473
474474   // video hardware
475475
src/mame/drivers/namcos2.c
r1877r1878
447447***************************************************************************/
448448
449449#include "driver.h"
450#include "deprecat.h"
450451#include "namcos2.h"
451452#include "cpu/m6809/m6809.h"
452453#include "namcoic.h"
r1877r1878
15711572static MACHINE_DRIVER_START( default )
15721573   MDRV_CPU_ADD(M68000, 12288000)
15731574   MDRV_CPU_PROGRAM_MAP(master_default_am,common_default_am)
1574   MDRV_CPU_VBLANK_INT(namcos2_68k_master_vblank,1)
1575   MDRV_CPU_VBLANK_INT("main", namcos2_68k_master_vblank)
15751576
15761577   MDRV_CPU_ADD(M68000, 12288000)
15771578   MDRV_CPU_PROGRAM_MAP(slave_default_am,common_default_am)
1578   MDRV_CPU_VBLANK_INT(namcos2_68k_slave_vblank,1)
1579   MDRV_CPU_VBLANK_INT("main", namcos2_68k_slave_vblank)
15791580
15801581   MDRV_CPU_ADD(M6809,3072000) // Sound handling
15811582   MDRV_CPU_PROGRAM_MAP(readmem_sound,writemem_sound)
1582   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
1583   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
15831584   MDRV_CPU_PERIODIC_INT(irq1_line_hold, 120)
15841585
15851586   MDRV_CPU_ADD(HD63705,2048000) // I/O handling
15861587   MDRV_CPU_PROGRAM_MAP(readmem_mcu,writemem_mcu)
1587   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1588   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
15881589
15891590   MDRV_INTERLEAVE(100) /* CPU slices per frame */
15901591
r1877r1878
16451646static MACHINE_DRIVER_START( gollygho )
16461647   MDRV_CPU_ADD(M68000, 12288000)
16471648   MDRV_CPU_PROGRAM_MAP(master_default_am,common_default_am)
1648   MDRV_CPU_VBLANK_INT(namcos2_68k_master_vblank,1)
1649   MDRV_CPU_VBLANK_INT("main", namcos2_68k_master_vblank)
16491650
16501651   MDRV_CPU_ADD(M68000, 12288000)
16511652   MDRV_CPU_PROGRAM_MAP(slave_default_am,common_default_am)
1652   MDRV_CPU_VBLANK_INT(namcos2_68k_slave_vblank,1)
1653   MDRV_CPU_VBLANK_INT("main", namcos2_68k_slave_vblank)
16531654
16541655   MDRV_CPU_ADD(M6809,3072000) // Sound handling
16551656   MDRV_CPU_PROGRAM_MAP(readmem_sound,writemem_sound)
1656   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
1657   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
16571658   MDRV_CPU_PERIODIC_INT(irq1_line_hold, 120)
16581659
16591660   MDRV_CPU_ADD(HD63705,2048000) // I/O handling
16601661   MDRV_CPU_PROGRAM_MAP(readmem_mcu,writemem_mcu)
1661   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1662   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
16621663
16631664   MDRV_INTERLEAVE(100) /* CPU slices per frame */
16641665
r1877r1878
16951696static MACHINE_DRIVER_START( finallap )
16961697   MDRV_CPU_ADD(M68000, 12288000)
16971698   MDRV_CPU_PROGRAM_MAP(master_finallap_am,common_finallap_am)
1698   MDRV_CPU_VBLANK_INT(namcos2_68k_master_vblank,1)
1699   MDRV_CPU_VBLANK_INT("main", namcos2_68k_master_vblank)
16991700
17001701   MDRV_CPU_ADD(M68000, 12288000)
17011702   MDRV_CPU_PROGRAM_MAP(slave_finallap_am,common_finallap_am)
1702   MDRV_CPU_VBLANK_INT(namcos2_68k_slave_vblank,1)
1703   MDRV_CPU_VBLANK_INT("main", namcos2_68k_slave_vblank)
17031704
17041705   MDRV_CPU_ADD(M6809,3072000) // Sound handling
17051706   MDRV_CPU_PROGRAM_MAP(readmem_sound,writemem_sound)
1706   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
1707   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
17071708   MDRV_CPU_PERIODIC_INT(irq1_line_hold, 120)
17081709
17091710   MDRV_CPU_ADD(HD63705,2048000) // I/O handling
17101711   MDRV_CPU_PROGRAM_MAP(readmem_mcu,writemem_mcu)
1711   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1712   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
17121713
17131714   MDRV_INTERLEAVE(100) /* CPU slices per frame */
17141715
r1877r1878
17451746static MACHINE_DRIVER_START( sgunner )
17461747   MDRV_CPU_ADD(M68000, 12288000)
17471748   MDRV_CPU_PROGRAM_MAP(master_sgunner_am,common_sgunner_am)
1748   MDRV_CPU_VBLANK_INT(namcos2_68k_master_vblank,1)
1749   MDRV_CPU_VBLANK_INT("main", namcos2_68k_master_vblank)
17491750
17501751   MDRV_CPU_ADD(M68000, 12288000)
17511752   MDRV_CPU_PROGRAM_MAP(slave_sgunner_am,common_sgunner_am)
1752   MDRV_CPU_VBLANK_INT(namcos2_68k_slave_vblank,1)
1753   MDRV_CPU_VBLANK_INT("main", namcos2_68k_slave_vblank)
17531754
17541755   MDRV_CPU_ADD(M6809,3072000) // Sound handling
17551756   MDRV_CPU_PROGRAM_MAP(readmem_sound,writemem_sound)
1756   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
1757   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
17571758   MDRV_CPU_PERIODIC_INT(irq1_line_hold, 120)
17581759
17591760   MDRV_CPU_ADD(HD63705,2048000) // I/O handling
17601761   MDRV_CPU_PROGRAM_MAP(readmem_mcu,writemem_mcu)
1761   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1762   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
17621763
17631764   MDRV_INTERLEAVE(100) /* CPU slices per frame */
17641765
r1877r1878
17951796static MACHINE_DRIVER_START( luckywld )
17961797   MDRV_CPU_ADD(M68000, 12288000)
17971798   MDRV_CPU_PROGRAM_MAP(master_luckywld_am,common_luckywld_am)
1798   MDRV_CPU_VBLANK_INT(namcos2_68k_master_vblank,1)
1799   MDRV_CPU_VBLANK_INT("main", namcos2_68k_master_vblank)
17991800
18001801   MDRV_CPU_ADD(M68000, 12288000)
18011802   MDRV_CPU_PROGRAM_MAP(slave_luckywld_am,common_luckywld_am)
1802   MDRV_CPU_VBLANK_INT(namcos2_68k_slave_vblank,1)
1803   MDRV_CPU_VBLANK_INT("main", namcos2_68k_slave_vblank)
18031804
18041805   MDRV_CPU_ADD(M6809,3072000) /* Sound handling */
18051806   MDRV_CPU_PROGRAM_MAP(readmem_sound,writemem_sound)
1806   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
1807   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
18071808   MDRV_CPU_PERIODIC_INT(irq1_line_hold,120)
18081809
18091810   MDRV_CPU_ADD(HD63705,2048000) /* I/O handling */
18101811   MDRV_CPU_PROGRAM_MAP(readmem_mcu,writemem_mcu)
1811   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1812   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
18121813
18131814   MDRV_INTERLEAVE(100) /* CPU slices per frame */
18141815
r1877r1878
18451846static MACHINE_DRIVER_START( metlhawk )
18461847   MDRV_CPU_ADD(M68000, 12288000)
18471848   MDRV_CPU_PROGRAM_MAP(master_metlhawk_am,common_metlhawk_am)
1848   MDRV_CPU_VBLANK_INT(namcos2_68k_master_vblank,1)
1849   MDRV_CPU_VBLANK_INT("main", namcos2_68k_master_vblank)
18491850
18501851   MDRV_CPU_ADD(M68000, 12288000)
18511852   MDRV_CPU_PROGRAM_MAP(slave_metlhawk_am,common_metlhawk_am)
1852   MDRV_CPU_VBLANK_INT(namcos2_68k_slave_vblank,1)
1853   MDRV_CPU_VBLANK_INT("main", namcos2_68k_slave_vblank)
18531854
18541855   MDRV_CPU_ADD(M6809,3072000) /* Sound handling */
18551856   MDRV_CPU_PROGRAM_MAP(readmem_sound,writemem_sound)
1856   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
1857   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
18571858   MDRV_CPU_PERIODIC_INT(irq1_line_hold,120)
18581859
18591860   MDRV_CPU_ADD(HD63705,2048000) /* I/O handling */
18601861   MDRV_CPU_PROGRAM_MAP(readmem_mcu,writemem_mcu)
1861   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1862   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
18621863
18631864   MDRV_INTERLEAVE(100) /* CPU slices per frame */
18641865
src/mame/drivers/route16.c
r1877r1878
6868 ***************************************************************************/
6969
7070#include "driver.h"
71#include "deprecat.h"
7172#include "sound/dac.h"
7273#include "sound/sn76477.h"
7374#include "sound/ay8910.h"
r1877r1878
609610   MDRV_CPU_ADD_TAG("cpu1", Z80, 2500000)   /* 10MHz / 4 = 2.5MHz */
610611   MDRV_CPU_PROGRAM_MAP(route16_cpu1_map,0)
611612   MDRV_CPU_IO_MAP(cpu1_io_map,0)
612   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
613   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
613614
614615   MDRV_CPU_ADD_TAG("cpu2", Z80, 2500000)   /* 10MHz / 4 = 2.5MHz */
615616   MDRV_CPU_PROGRAM_MAP(route16_cpu2_map,0)
r1877r1878
681682   /* basic machine hardware */
682683   MDRV_IMPORT_FROM(speakres)
683684   MDRV_CPU_MODIFY("cpu2")
684   MDRV_CPU_VBLANK_INT(irq0_line_hold,48)
685   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,48)
685686MACHINE_DRIVER_END
686687
687688
src/mame/drivers/tecmosys.c
r1877r1878
537537static MACHINE_DRIVER_START( deroon )
538538   MDRV_CPU_ADD(M68000, 16000000/8) /* the /8 divider is here only for OPL3 testing */
539539   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
540   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
540   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
541541
542542   MDRV_CPU_ADD(Z80, 16000000/2 )   /* 8 MHz ??? */
543543   /* audio CPU */
src/mame/drivers/polyplay.c
r1877r1878
294294   MDRV_CPU_PROGRAM_MAP(polyplay_map,0)
295295   MDRV_CPU_IO_MAP(polyplay_io_map,0)
296296   MDRV_CPU_PERIODIC_INT(periodic_interrupt,75)
297   MDRV_CPU_VBLANK_INT(coin_interrupt,1)
297   MDRV_CPU_VBLANK_INT("main", coin_interrupt)
298298
299299   MDRV_MACHINE_RESET(polyplay)
300300
src/mame/drivers/exzisus.c
r1877r1878
328328   /* basic machine hardware */
329329   MDRV_CPU_ADD(Z80, 6000000)         /* 6 MHz ??? */
330330   MDRV_CPU_PROGRAM_MAP(cpua_readmem,cpua_writemem)
331   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
331   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
332332
333333   MDRV_CPU_ADD(Z80, 4000000)         /* 4 MHz ??? */
334334   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
335335
336336   MDRV_CPU_ADD(Z80, 6000000)         /* 6 MHz ??? */
337337   MDRV_CPU_PROGRAM_MAP(cpub_readmem,cpub_writemem)
338   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
338   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
339339
340340   MDRV_CPU_ADD(Z80, 6000000)         /* 6 MHz ??? */
341341   MDRV_CPU_PROGRAM_MAP(cpuc_readmem,cpuc_writemem)
342   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
342   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
343343
344344   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
345345
src/mame/drivers/exidy440.c
r1877r1878
219219#include "exidy440.h"
220220
221221
222/* globals */
223UINT8 exidy440_topsecret;
222/* constants */
223#define MAIN_CPU_CLOCK      (EXIDY440_MASTER_CLOCK / 8)
224224
225225
226226/* local variables */
227227static UINT8 exidy440_bank;
228static UINT8 port_0_xor;
229static UINT8 port_2_xor;
230static UINT8 port_3_xor;
231static UINT8 mirror_vblank_bit;
232static UINT8 mirror_trigger_bit;
233static UINT8 copy_protection_read;
234static UINT8 last_coins;
235228
236229static const UINT8 *showdown_bank_data[2];
237230static INT8 showdown_bank_select;
r1877r1878
264257
265258/*************************************
266259 *
267 *  Interrupt handling
260 *  Coin handling
268261 *
269262 *************************************/
270263
271static void handle_coins(running_machine *machine)
264static INPUT_CHANGED( coin_inserted )
272265{
273   int coins;
274
275266   /* if we got a coin, set the IRQ on the main CPU */
276   coins = readinputport(3) & 3;
277   if (((coins ^ last_coins) & 0x01) && (coins & 0x01) == 0)
267   if (newval == 0)
278268      cpunum_set_input_line(machine, 0, 0, ASSERT_LINE);
279   if (((coins ^ last_coins) & 0x02) && (coins & 0x02) == 0)
280      cpunum_set_input_line(machine, 0, 0, ASSERT_LINE);
281   last_coins = coins;
282269}
283270
284271
285static INTERRUPT_GEN( main_interrupt )
286{
287   /* generate coin interrupts */
288   handle_coins(machine);
289   exidy440_vblank_interrupt(machine, cpunum);
290}
291272
292
293static MACHINE_RESET( exidy440 )
294{
295   exidy440_bank = 0xff;
296   exidy440_bank_select(0);
297   last_coins = input_port_3_r(0) & 3;
298}
299
300
301
302273/*************************************
303274 *
304 *  Primary input port read
275 *  Primary input port special bits
305276 *
306277 *************************************/
307278
308static READ8_HANDLER( input_r )
279static CUSTOM_INPUT( firq_beam_r )
309280{
310   int result = input_port_0_r(offset);
281   return exidy440_firq_beam;
282}
311283
312   /* the FIRQ cause is reflected in the upper 2 bits */
313   if (exidy440_firq_vblank) result ^= 0x80;
314   if (exidy440_firq_beam) result ^= 0x40;
315284
316   /* Whodunit needs the VBLANK bit mirrored to bit 0 */
317   if (mirror_vblank_bit && exidy440_firq_vblank) result ^= 0x01;
285static CUSTOM_INPUT( firq_vblank_r )
286{
287   return exidy440_firq_vblank;
288}
318289
319   /* Hit'N Miss needs the trigger bit mirrored to bit 0 */
320   if (mirror_trigger_bit) result = (result & 0xfe) | ((result >> 1) & 1);
321290
322   /* return with the appropriate XOR */
323   return result ^ port_0_xor;
291static CUSTOM_INPUT( hitnmiss_button1_r )
292{
293   /* button 1 shows up in two bits */
294   UINT32 button1 = readinputportbytag("HITNMISS_BUTTON1");
295   return (button1 << 1) | button1;
324296}
325297
326298
r1877r1878
368340 *
369341 *************************************/
370342
371static READ8_HANDLER( io_r )
343static READ8_HANDLER( exidy440_input_port_3_r )
372344{
373   int result = 0xff;
345   /* I/O1 accesses clear the CIRQ flip/flop */
346   cpunum_set_input_line(Machine, 0, 0, CLEAR_LINE);
347   return readinputport(3);
348}
374349
375   switch (offset & 0xe0)
376   {
377      case 0x00:                              /* sound command */
378         result = exidy440_sound_command;
379         break;
380350
381      case 0x20:                              /* coin bits I/O1 */
382         result = readinputport(3) ^ port_3_xor;
383
384         /* I/O1 accesses clear the CIRQ flip/flop */
385         cpunum_set_input_line(Machine, 0, 0, CLEAR_LINE);
386         break;
387
388      case 0x40:                              /* clear coin counters I/O2 */
389         break;
390
391      case 0x60:                              /* dip switches (8) */
392         result = input_port_1_r(offset);
393         break;
394
395      case 0x80:                              /* player control bits */
396         result = input_port_2_r(offset) ^ port_2_xor;
397         break;
398
399      case 0xa0:                              /* coin bits I/O5 */
400         /* sound command acknowledgements come on bit 3 here */
401         if (exidy440_sound_command_ack)
402            result ^= 0x08;
403         break;
404
405      case 0xc0:
406         /* for Clay Pigeon and Top Secret */
407         if (offset < 0xc4)
408            return copy_protection_read;
409
410         /* for Top Secret only */
411         if (offset == 0xc5)
412            return (input_port_5_r(offset) & 1) ? 0x01 : 0x02;
413         else if (offset == 0xc6)
414            return input_port_4_r(offset);
415         else if (offset == 0xc7)
416            return input_port_6_r(offset);
417         else
418            return 0;
419   }
420
421   return result;
351static READ8_HANDLER( sound_command_ack_r )
352{
353   /* sound command acknowledgements come on bit 3 here */
354   return exidy440_sound_command_ack ? 0xf7 : 0xff;
422355}
423356
424357
r1877r1878
431364
432365static TIMER_CALLBACK( delayed_sound_command_w )
433366{
434   exidy440_sound_command = param;
367   *exidy440_sound_command = param;
435368   exidy440_sound_command_ack = 0;
436369
437370   /* cause an FIRQ on the sound CPU */
r1877r1878
439372}
440373
441374
442static WRITE8_HANDLER( io_w )
375static WRITE8_HANDLER( sound_command_w )
443376{
444   logerror("W I/O1[%02X]=%02X\n", offset, data);
377   timer_call_after_resynch(NULL, data, delayed_sound_command_w);
378}
445379
446   /* switch off the upper 4 bits of the offset */
447   switch (offset & 0xe0)
448   {
449      case 0x00:                              /* sound command */
450         timer_call_after_resynch(NULL, data, delayed_sound_command_w);
451         break;
452380
453      case 0x20:                              /* coin bits I/O1 */
381static WRITE8_HANDLER( exidy440_input_port_3_w )
382{
383   /* I/O1 accesses clear the CIRQ flip/flop */
384   cpunum_set_input_line(Machine, 0, 0, CLEAR_LINE);
385}
454386
455         /* accesses here clear the CIRQ flip/flop */
456         cpunum_set_input_line(Machine, 0, 0, CLEAR_LINE);
457         break;
458387
459      case 0x40:                              /* coin counter I/O2 */
460         coin_counter_w(0, data & 1);
461         break;
462
463      case 0x60:                              /* dip switches (8) */
464         break;
465
466      case 0x80:                              /* player control bits */
467         break;
468
469      case 0xa0:                              /* coin bits I/O3 */
470         break;
471
472      case 0xc0:
473         /* for Top Secret only */
474         if (offset == 0xc1)
475            topsecex_yscroll = data;
476         break;
477   }
388static WRITE8_HANDLER( exidy440_coin_counter_w )
389{
390   coin_counter_w(0, data & 1);
478391}
479392
480393
r1877r1878
514427}
515428
516429
430static READ8_HANDLER( claypign_protection_r )
431{
432   return 0x76;
433}
517434
435
436static READ8_HANDLER( topsecex_input_port_5_r )
437{
438   return (input_port_5_r(machine, offset) & 1) ? 0x01 : 0x02;
439}
440
441
442static WRITE8_HANDLER( topsecex_yscroll_w )
443{
444   *topsecex_yscroll = data;
445}
446
447
448
518449/*************************************
519450 *
451 *  Reset
452 *
453 *************************************/
454
455static MACHINE_RESET( exidy440 )
456{
457   exidy440_bank = 0xff;
458   exidy440_bank_select(0);
459}
460
461
462
463/*************************************
464 *
520465 *  Main CPU memory handlers
521466 *
522467 *************************************/
r1877r1878
529474   AM_RANGE(0x2b00, 0x2b00) AM_READ(exidy440_vertical_pos_r)
530475   AM_RANGE(0x2b01, 0x2b01) AM_READWRITE(exidy440_horizontal_pos_r, exidy440_interrupt_clear_w)
531476   AM_RANGE(0x2b02, 0x2b02) AM_RAM AM_BASE(&exidy440_scanline)
532   AM_RANGE(0x2b03, 0x2b03) AM_READWRITE(input_r, exidy440_control_w)
477   AM_RANGE(0x2b03, 0x2b03) AM_READWRITE(input_port_0_r, exidy440_control_w)
533478   AM_RANGE(0x2c00, 0x2dff) AM_READWRITE(exidy440_paletteram_r, exidy440_paletteram_w)
534   AM_RANGE(0x2e00, 0x2eff) AM_READWRITE(io_r, io_w)
479   AM_RANGE(0x2e00, 0x2e1f) AM_READWRITE(MRA8_RAM, sound_command_w) AM_BASE(&exidy440_sound_command)
480   AM_RANGE(0x2e20, 0x2e3f) AM_READWRITE(exidy440_input_port_3_r, exidy440_input_port_3_w)
481   AM_RANGE(0x2e40, 0x2e5f) AM_READWRITE(MRA8_NOP, exidy440_coin_counter_w)   /* read: clear coin counters I/O2 */
482   AM_RANGE(0x2e60, 0x2e7f) AM_READWRITE(input_port_1_r, MWA8_NOP)
483   AM_RANGE(0x2e80, 0x2e9f) AM_READWRITE(input_port_2_r, MWA8_NOP)
484   AM_RANGE(0x2ea0, 0x2ebf) AM_READWRITE(sound_command_ack_r, MWA8_NOP)
485   AM_RANGE(0x2ec0, 0x2eff) AM_NOP
535486   AM_RANGE(0x3000, 0x3fff) AM_RAM
536487   AM_RANGE(0x4000, 0x7fff) AM_READWRITE(MRA8_BANK1, bankram_w)
537488   AM_RANGE(0x8000, 0xffff) AM_ROM
r1877r1878
579530   PORT_DIPSETTING(    0x30, DEF_STR( Normal ) )
580531   PORT_DIPSETTING(    0x20, DEF_STR( Hard ) )
581532   PORT_DIPSETTING(    0x10, DEF_STR( Hardest ) )
582   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
533   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, 0)
534   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
583535
584536   PORT_START             /* audio board dips */
585537   COINAGE
r1877r1878
593545   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNKNOWN )
594546
595547   PORT_START            /* coin counters */
596   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
597   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
548   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
549   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
598550   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN )
599551
600552   PORT_START            /* fake analog X */
r1877r1878
607559
608560static INPUT_PORTS_START( cheyenne )
609561   PORT_START            /* player inputs and logic board dips */
610   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
611   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
612   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
613   PORT_DIPSETTING(    0x08, "2" )
614   PORT_DIPSETTING(    0x0c, "3" )
615   PORT_DIPSETTING(    0x04, "4" )
616   PORT_DIPSETTING(    0x00, "5" )
617   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
618   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
619   PORT_DIPSETTING(    0x30, DEF_STR( Normal ) )
620   PORT_DIPSETTING(    0x20, DEF_STR( Hard ) )
621   PORT_DIPSETTING(    0x10, DEF_STR( Hardest ) )
622   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
562   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
563   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 )
564   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Lives ) )
565   PORT_DIPSETTING(    0x04, "2" )
566   PORT_DIPSETTING(    0x00, "3" )
567   PORT_DIPSETTING(    0x08, "4" )
568   PORT_DIPSETTING(    0x0c, "5" )
569   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty ) )
570   PORT_DIPSETTING(    0x30, DEF_STR( Easy ) )
571   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
572   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
573   PORT_DIPSETTING(    0x20, DEF_STR( Hardest ) )
574   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, 0)
575   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
623576
624577   PORT_START             /* audio board dips */
625578   COINAGE
r1877r1878
633586   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNKNOWN )
634587
635588   PORT_START            /* coin counters */
636   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
637   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
589   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
590   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
638591   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN )
639592
640593   PORT_START            /* fake analog X */
r1877r1878
647600
648601static INPUT_PORTS_START( combat )
649602   PORT_START            /* player inputs and logic board dips */
650   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
651   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
652   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
653   PORT_DIPSETTING(    0x08, "2" )
654   PORT_DIPSETTING(    0x0c, "3" )
655   PORT_DIPSETTING(    0x04, "4" )
656   PORT_DIPSETTING(    0x00, "5" )
657   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
658   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
659   PORT_DIPSETTING(    0x30, DEF_STR( Normal ) )
660   PORT_DIPSETTING(    0x20, DEF_STR( Hard ) )
661   PORT_DIPSETTING(    0x10, DEF_STR( Hardest ) )
662   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
603   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
604   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 )
605   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Lives ) )
606   PORT_DIPSETTING(    0x04, "2" )
607   PORT_DIPSETTING(    0x00, "3" )
608   PORT_DIPSETTING(    0x08, "4" )
609   PORT_DIPSETTING(    0x0c, "5" )
610   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty ) )
611   PORT_DIPSETTING(    0x30, DEF_STR( Easy ) )
612   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
613   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
614   PORT_DIPSETTING(    0x20, DEF_STR( Hardest ) )
615   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, 0)
616   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
663617
664618   PORT_START             /* audio board dips */
665619   COINAGE
r1877r1878
669623   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
670624
671625   PORT_START            /* start button */
672   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
673   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNKNOWN )
626   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
627   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNKNOWN )
674628
675629   PORT_START            /* coin counters */
676   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
677   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
630   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
631   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
678632   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN )
679633
680634   PORT_START            /* fake analog X */
r1877r1878
687641
688642static INPUT_PORTS_START( catch22 )
689643   PORT_START            /* player inputs and logic board dips */
690   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
691   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
692   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
693   PORT_DIPSETTING(    0x08, "4" )
694   PORT_DIPSETTING(    0x0c, "5" )
695   PORT_DIPSETTING(    0x04, "6" )
696   PORT_DIPSETTING(    0x00, "7" )
697   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
698   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
699   PORT_DIPSETTING(    0x30, DEF_STR( Normal ) )
700   PORT_DIPSETTING(    0x20, DEF_STR( Hard ) )
701   PORT_DIPSETTING(    0x10, DEF_STR( Hardest ) )
702   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
644   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
645   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 )
646   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Lives ) )
647   PORT_DIPSETTING(    0x04, "4" )
648   PORT_DIPSETTING(    0x00, "5" )
649   PORT_DIPSETTING(    0x08, "6" )
650   PORT_DIPSETTING(    0x0c, "7" )
651   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty ) )
652   PORT_DIPSETTING(    0x30, DEF_STR( Easy ) )
653   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
654   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
655   PORT_DIPSETTING(    0x20, DEF_STR( Hardest ) )
656   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, 0)
657   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
703658
704659   PORT_START             /* audio board dips */
705660   COINAGE
r1877r1878
709664   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
710665
711666   PORT_START            /* start button */
712   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
713   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNKNOWN )
667   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
668   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNKNOWN )
714669
715670   PORT_START            /* coin counters */
716   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
717   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
718   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN )
671   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
672   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
673   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
674   PORT_BIT( 0xf8, IP_ACTIVE_LOW,  IPT_UNKNOWN )
719675
720676   PORT_START            /* fake analog X */
721677   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
r1877r1878
727683
728684static INPUT_PORTS_START( cracksht )
729685   PORT_START            /* player inputs and logic board dips */
730   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
731   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
732   PORT_DIPNAME( 0x0c, 0x0c, "Seconds" )
733   PORT_DIPSETTING(    0x08, "20" )
734   PORT_DIPSETTING(    0x0c, "30" )
735   PORT_DIPSETTING(    0x04, "40" )
736   PORT_DIPSETTING(    0x00, "50" )
737   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
738   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
739   PORT_DIPSETTING(    0x30, DEF_STR( Normal ) )
740   PORT_DIPSETTING(    0x20, DEF_STR( Hard ) )
741   PORT_DIPSETTING(    0x10, DEF_STR( Hardest ) )
742   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
686   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
687   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 )
688   PORT_DIPNAME( 0x0c, 0x00, "Seconds" )
689   PORT_DIPSETTING(    0x04, "20" )
690   PORT_DIPSETTING(    0x00, "30" )
691   PORT_DIPSETTING(    0x08, "40" )
692   PORT_DIPSETTING(    0x0c, "50" )
693   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty ) )
694   PORT_DIPSETTING(    0x30, DEF_STR( Easy ) )
695   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
696   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
697   PORT_DIPSETTING(    0x20, DEF_STR( Hardest ) )
698   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, 0)
699   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
743700
744701   PORT_START             /* audio board dips */
745702   COINAGE
r1877r1878
749706   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
750707
751708   PORT_START            /* start button */
752   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
753   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNKNOWN )
709   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
710   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNKNOWN )
754711
755712   PORT_START            /* coin counters */
756   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
757   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
758   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN )
713   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
714   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
715   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
716   PORT_BIT( 0xf8, IP_ACTIVE_LOW,  IPT_UNKNOWN )
759717
760718   PORT_START            /* fake analog X */
761719   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
r1877r1878
767725
768726static INPUT_PORTS_START( claypign )
769727   PORT_START            /* player inputs and logic board dips */
770   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
771   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
772   PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNKNOWN )
773   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
774   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
775   PORT_DIPSETTING(    0x30, DEF_STR( Normal ) )
776   PORT_DIPSETTING(    0x20, DEF_STR( Hard ) )
777   PORT_DIPSETTING(    0x10, DEF_STR( Hardest ) )
778   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
728   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
729   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 )
730   PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNKNOWN )
731   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty ) )
732   PORT_DIPSETTING(    0x30, DEF_STR( Easy ) )
733   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
734   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
735   PORT_DIPSETTING(    0x20, DEF_STR( Hardest ) )
736   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, 0)
737   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
779738
780739   PORT_START             /* audio board dips */
781740   COINAGE
r1877r1878
785744   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
786745
787746   PORT_START            /* start button */
788   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
789   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNKNOWN )
747   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
748   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNKNOWN )
790749
791750   PORT_START            /* coin counters */
792   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
793   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
794   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN )
751   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
752   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
753   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
754   PORT_BIT( 0xf8, IP_ACTIVE_LOW,  IPT_UNKNOWN )
795755
796756   PORT_START            /* fake analog X */
797757   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
r1877r1878
803763
804764static INPUT_PORTS_START( chiller )
805765   PORT_START            /* player inputs and logic board dips */
806   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
807   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
808   PORT_DIPNAME( 0x0c, 0x0c, "Seconds" )
809   PORT_DIPSETTING(    0x08, "30" )
810   PORT_DIPSETTING(    0x0c, "45" )
811   PORT_DIPSETTING(    0x04, "60" )
812   PORT_DIPSETTING(    0x00, "70" )
813   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
814   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
815   PORT_DIPSETTING(    0x30, DEF_STR( Normal ) )
816   PORT_DIPSETTING(    0x20, DEF_STR( Hard ) )
817   PORT_DIPSETTING(    0x10, DEF_STR( Hardest ) )
818   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
766   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
767   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 )
768   PORT_DIPNAME( 0x0c, 0x00, "Seconds" )
769   PORT_DIPSETTING(    0x04, "30" )
770   PORT_DIPSETTING(    0x00, "45" )
771   PORT_DIPSETTING(    0x08, "60" )
772   PORT_DIPSETTING(    0x0c, "70" )
773   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty ) )
774   PORT_DIPSETTING(    0x30, DEF_STR( Easy ) )
775   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
776   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
777   PORT_DIPSETTING(    0x20, DEF_STR( Hardest ) )
778   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, 0)
779   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
819780
820781   PORT_START             /* audio board dips */
821782   COINAGE
822783   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN )
823784
824785   PORT_START            /* start button */
825   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
826   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNKNOWN )
786   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
787   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNKNOWN )
827788
828789   PORT_START            /* coin counters */
829   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
830   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
831   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN )
790   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
791   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
792   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
793   PORT_BIT( 0xf8, IP_ACTIVE_LOW,  IPT_UNKNOWN )
832794
833795   PORT_START            /* fake analog X */
834796   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
r1877r1878
840802
841803static INPUT_PORTS_START( topsecex )
842804   PORT_START            /* player inputs and logic board dips */
843   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
844   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
845   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
846   PORT_DIPSETTING(    0x08, "3" )
847   PORT_DIPSETTING(    0x0c, "4" )
848   PORT_DIPSETTING(    0x04, "5" )
849   PORT_DIPSETTING(    0x00, "6" )
850   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
851   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
852   PORT_DIPSETTING(    0x30, DEF_STR( Normal ) )
853   PORT_DIPSETTING(    0x20, DEF_STR( Hard ) )
854   PORT_DIPSETTING(    0x10, DEF_STR( Hardest ) )
855   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
805   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
806   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
807   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Lives ) )
808   PORT_DIPSETTING(    0x04, "3" )
809   PORT_DIPSETTING(    0x00, "4" )
810   PORT_DIPSETTING(    0x08, "5" )
811   PORT_DIPSETTING(    0x0c, "6" )
812   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty ) )
813   PORT_DIPSETTING(    0x30, DEF_STR( Easy ) )
814   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
815   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
816   PORT_DIPSETTING(    0x20, DEF_STR( Hardest ) )
817   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, 0)
818   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
856819
857820   PORT_START             /* audio board dips */
858821   COINAGE
859822   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN )
860823
861824   PORT_START            /* start button */
862   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 )
863   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNKNOWN )
825   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 )
826   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNKNOWN )
864827
865828   PORT_START            /* coin counters */
866   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
867   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
868   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN )
829   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
830   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
831   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
832   PORT_BIT( 0xf8, IP_ACTIVE_LOW,  IPT_UNKNOWN )
869833
870834   PORT_START            /* fake analog X */
871835   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_REVERSE
r1877r1878
887851
888852static INPUT_PORTS_START( hitnmiss )
889853   PORT_START            /* player inputs and logic board dips */
890   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
891   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
892   PORT_DIPNAME( 0x0c, 0x0c, "Seconds" )
893   PORT_DIPSETTING(    0x08, "20" )
894   PORT_DIPSETTING(    0x0c, "30" )
895   PORT_DIPSETTING(    0x04, "40" )
896   PORT_DIPSETTING(    0x00, "50" )
897   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
898   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
899   PORT_DIPSETTING(    0x30, DEF_STR( Normal ) )
900   PORT_DIPSETTING(    0x20, DEF_STR( Hard ) )
901   PORT_DIPSETTING(    0x10, DEF_STR( Hardest ) )
902   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
854   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(hitnmiss_button1_r, 0)
855   PORT_DIPNAME( 0x0c, 0x00, "Seconds" )
856   PORT_DIPSETTING(    0x04, "20" )
857   PORT_DIPSETTING(    0x00, "30" )
858   PORT_DIPSETTING(    0x08, "40" )
859   PORT_DIPSETTING(    0x0c, "50" )
860   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty ) )
861   PORT_DIPSETTING(    0x30, DEF_STR( Easy ) )
862   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
863   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
864   PORT_DIPSETTING(    0x20, DEF_STR( Hardest ) )
865   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, 0)
866   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
903867
904868   PORT_START             /* audio board dips */
905869   COINAGE
r1877r1878
909873   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
910874
911875   PORT_START            /* start button */
912   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
913   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNKNOWN )
876   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
877   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNKNOWN )
914878
915879   PORT_START            /* coin counters */
916   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
917   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
918   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN )
880   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
881   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
882   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
883   PORT_BIT( 0xf8, IP_ACTIVE_LOW,  IPT_UNKNOWN )
919884
920885   PORT_START            /* fake analog X */
921886   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
922887
923888   PORT_START            /* fake analog Y */
924889   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10)
890
891   PORT_START_TAG("HITNMISS_BUTTON1")
892   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
925893INPUT_PORTS_END
926894
927895
928896static INPUT_PORTS_START( whodunit )
929897   PORT_START            /* player inputs and logic board dips */
930   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
931   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
932   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
933   PORT_DIPSETTING(    0x08, "2" )
934   PORT_DIPSETTING(    0x0c, "3" )
935   PORT_DIPSETTING(    0x04, "4" )
936   PORT_DIPSETTING(    0x00, "5" )
937   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
938   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
939   PORT_DIPSETTING(    0x30, DEF_STR( Normal ) )
940   PORT_DIPSETTING(    0x20, DEF_STR( Hard ) )
941   PORT_DIPSETTING(    0x10, DEF_STR( Hardest ) )
942   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
898   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
899   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 )
900   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Lives ) )
901   PORT_DIPSETTING(    0x04, "2" )
902   PORT_DIPSETTING(    0x00, "3" )
903   PORT_DIPSETTING(    0x08, "4" )
904   PORT_DIPSETTING(    0x0c, "5" )
905   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty ) )
906   PORT_DIPSETTING(    0x30, DEF_STR( Easy ) )
907   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
908   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
909   PORT_DIPSETTING(    0x20, DEF_STR( Hardest ) )
910   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, 0)
911   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
943912
944913   PORT_START             /* audio board dips */
945914   COINAGE
946915   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN )
947916
948917   PORT_START            /* start button */
949   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
950   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNKNOWN )
918   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
919   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNKNOWN )
951920
952921   PORT_START            /* coin counters */
953   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
954   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
955   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN )
922   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
923   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
924   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
925   PORT_BIT( 0xf8, IP_ACTIVE_LOW,  IPT_UNKNOWN )
956926
957927   PORT_START            /* fake analog X */
958928   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
r1877r1878
964934
965935static INPUT_PORTS_START( showdown )
966936   PORT_START            /* player inputs and logic board dips */
967   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
968   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
969   PORT_DIPNAME( 0x0c, 0x0c, "Hands" )
970   PORT_DIPSETTING(    0x08, "1" )
971   PORT_DIPSETTING(    0x0c, "2" )
972   PORT_DIPSETTING(    0x04, "3" )
973   PORT_DIPSETTING(    0x00, "4" )
974   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
975   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
976   PORT_DIPSETTING(    0x30, DEF_STR( Normal ) )
977   PORT_DIPSETTING(    0x20, DEF_STR( Hard ) )
978   PORT_DIPSETTING(    0x10, DEF_STR( Hardest ) )
979   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
937   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
938   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 )
939   PORT_DIPNAME( 0x0c, 0x00, "Hands" )
940   PORT_DIPSETTING(    0x04, "1" )
941   PORT_DIPSETTING(    0x00, "2" )
942   PORT_DIPSETTING(    0x08, "3" )
943   PORT_DIPSETTING(    0x0c, "4" )
944   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty ) )
945   PORT_DIPSETTING(    0x30, DEF_STR( Easy ) )
946   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
947   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
948   PORT_DIPSETTING(    0x20, DEF_STR( Hardest ) )
949   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, 0)
950   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
980951
981952   PORT_START             /* audio board dips */
982953   COINAGE
r1877r1878
994965   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
995966
996967   PORT_START            /* start button */
997   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Action")
998   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Bet-All")
999   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Gold")
1000   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Blue")
1001   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Red")
1002   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("White")
1003   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1004   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
968   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("Action")
969   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Bet-All")
970   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Gold")
971   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Blue")
972   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Red")
973   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_NAME("White")
974   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
975   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
1005976
1006977   PORT_START            /* coin counters */
1007   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
1008   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
1009   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN )
978   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
979   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
980   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
981   PORT_BIT( 0xf8, IP_ACTIVE_LOW,  IPT_UNKNOWN )
1010982
1011983   PORT_START            /* fake analog X */
1012984   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
r1877r1878
1026998static MACHINE_DRIVER_START( exidy440 )
1027999
10281000   /* basic machine hardware */
1029   MDRV_CPU_ADD(M6809,EXIDY440_MAIN_CPU_CLOCK)
1001   MDRV_CPU_ADD(M6809, MAIN_CPU_CLOCK)
10301002   MDRV_CPU_PROGRAM_MAP(exidy440_map,0)
1031   MDRV_CPU_VBLANK_INT(main_interrupt,1)
1003   MDRV_CPU_VBLANK_INT("main", exidy440_vblank_interrupt)
10321004
10331005   MDRV_MACHINE_RESET(exidy440)
10341006   MDRV_NVRAM_HANDLER(exidy440)
10351007
10361008   /* video hardware */
1037   MDRV_SCREEN_ADD("main", RASTER)
1038   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
1039   MDRV_SCREEN_RAW_PARAMS(EXIDY440_PIXEL_CLOCK, EXIDY440_HTOTAL, EXIDY440_HBEND, EXIDY440_HBSTART, EXIDY440_VTOTAL, EXIDY440_VBEND, EXIDY440_VBSTART)
1009   MDRV_IMPORT_FROM(exidy440_video)
10401010
1041   MDRV_PALETTE_LENGTH(256)
1042
1043   MDRV_VIDEO_START(exidy440)
1044   MDRV_VIDEO_EOF(exidy440)
1045   MDRV_VIDEO_UPDATE(exidy440)
1046
10471011   /* audio hardware */
10481012   MDRV_IMPORT_FROM(exidy440_audio)
10491013MACHINE_DRIVER_END
r1877r1878
10551019   MDRV_IMPORT_FROM(exidy440)
10561020
10571021   /* video hardware */
1058   MDRV_SCREEN_MODIFY("main")
1059   MDRV_SCREEN_RAW_PARAMS(EXIDY440_PIXEL_CLOCK, EXIDY440_HTOTAL, EXIDY440_HBEND, EXIDY440_HBSTART, EXIDY440_VTOTAL, EXIDY440_VBEND, TOPSECEX_VBSTART)
1060
1022   MDRV_IMPORT_FROM(topsecex_video)
10611023MACHINE_DRIVER_END
10621024
10631025
r1877r1878
19631925 *
19641926 *************************************/
19651927
1966#define SET_PARAMS(top,p0,p2,p3,mv,mt,cpr) \
1967   showdown_bank_data[0] = showdown_bank_data[1] = NULL;\
1968   exidy440_topsecret       = top;\
1969   port_0_xor             = p0;\
1970   port_2_xor             = p2;\
1971   port_3_xor            = p3;\
1972   mirror_vblank_bit       = mv;\
1973   mirror_trigger_bit       = mt;\
1974   copy_protection_read    = cpr
1928static DRIVER_INIT( exidy440 )
1929{
1930   showdown_bank_data[0] = showdown_bank_data[1] = NULL;
1931}
19751932
1976static DRIVER_INIT( crossbow ) { SET_PARAMS(0, 0x00, 0x00, 0x00, 0, 0, 0x00); }
1977static DRIVER_INIT( cheyenne ) { SET_PARAMS(0, 0xff, 0x00, 0x00, 0, 0, 0x00); }
1978static DRIVER_INIT( combat )   { SET_PARAMS(0, 0xff, 0xff, 0x00, 0, 0, 0x00); }
1979static DRIVER_INIT( cracksht ) { SET_PARAMS(0, 0xff, 0xff, 0x04, 0, 0, 0x00); }
1980static DRIVER_INIT( claypign ) { SET_PARAMS(0, 0xff, 0xff, 0x04, 0, 0, 0x76); }
1981static DRIVER_INIT( chiller )  { SET_PARAMS(0, 0xff, 0xff, 0x04, 0, 0, 0x00); }
1982static DRIVER_INIT( topsecex ) { SET_PARAMS(1, 0xff, 0xff, 0x04, 0, 0, 0x00); }
1983static DRIVER_INIT( hitnmiss ) { SET_PARAMS(0, 0xff, 0xff, 0x04, 0, 1, 0x00); }
1984static DRIVER_INIT( whodunit ) { SET_PARAMS(0, 0xff, 0xff, 0x04, 1, 0, 0x00); }
19851933
1934static DRIVER_INIT( claypign )
1935{
1936   DRIVER_INIT_CALL(exidy440);
1937
1938   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x2ec0, 0x2ec3, 0, 0, claypign_protection_r);
1939}
1940
1941
1942static DRIVER_INIT( topsecex )
1943{
1944   DRIVER_INIT_CALL(exidy440);
1945
1946   /* extra input ports and scrolling */
1947   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x2ec5, 0x2ec5, 0, 0, topsecex_input_port_5_r);
1948   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x2ec6, 0x2ec6, 0, 0, input_port_4_r);
1949   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x2ec7, 0x2ec7, 0, 0, input_port_6_r);
1950
1951   topsecex_yscroll = memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x2ec1, 0x2ec1, 0, 0, topsecex_yscroll_w);
1952}
1953
1954
19861955static DRIVER_INIT( showdown )
19871956{
19881957   static const UINT8 bankdata0[0x18] =
r1877r1878
19971966      0x46,0xd2,0x98,0x59,0x91,0x08,0xc8,0x41,
19981967      0xc5,0x8c,0x4e,0x86,0x1a,0xda,0x50,0xd1
19991968   };
2000   SET_PARAMS(0, 0xff, 0xff, 0x04, 0, 0, 0x00);
20011969
1970   DRIVER_INIT_CALL(exidy440);
1971
20021972   /* set up the fake PLD */
20031973   showdown_bank_data[0] = bankdata0;
20041974   showdown_bank_data[1] = bankdata1;
20051975}
20061976
1977
20071978static DRIVER_INIT( yukon )
20081979{
20091980   static const UINT8 bankdata0[0x18] =
r1877r1878
20181989      0x52,0xe2,0xa4,0x65,0xa1,0x04,0xc4,0x41,
20191990      0xd1,0x94,0x56,0x92,0x26,0xe6,0x60,0xe1
20201991   };
2021   SET_PARAMS(0, 0xff, 0xff, 0x04, 0, 0, 0x00);
20221992
1993   DRIVER_INIT_CALL(exidy440);
1994
20231995   /* set up the fake PLD */
20241996   showdown_bank_data[0] = bankdata0;
20251997   showdown_bank_data[1] = bankdata1;
r1877r1878
20332005 *
20342006 *************************************/
20352007
2036GAME( 1983, crossbow, 0,        exidy440, crossbow, crossbow, ROT0, "Exidy", "Crossbow (version 2.0)", 0 )
2037GAME( 1984, cheyenne, 0,        exidy440, cheyenne, cheyenne, ROT0, "Exidy", "Cheyenne (version 1.0)", 0 )
2038GAME( 1985, combat,   0,        exidy440, combat,   combat,   ROT0, "Exidy", "Combat (version 3.0)", 0 )
2039GAME( 1985, catch22,  combat,   exidy440, catch22,  combat,   ROT0, "Exidy", "Catch-22 (version 8.0)", 0 )
2040GAME( 1985, cracksht, 0,        exidy440, cracksht, cracksht, ROT0, "Exidy", "Crackshot (version 2.0)", 0 )
2008GAME( 1983, crossbow, 0,        exidy440, crossbow, exidy440, ROT0, "Exidy", "Crossbow (version 2.0)", 0 )
2009GAME( 1984, cheyenne, 0,        exidy440, cheyenne, exidy440, ROT0, "Exidy", "Cheyenne (version 1.0)", 0 )
2010GAME( 1985, combat,   0,        exidy440, combat,   exidy440, ROT0, "Exidy", "Combat (version 3.0)", 0 )
2011GAME( 1985, catch22,  combat,   exidy440, catch22,  exidy440, ROT0, "Exidy", "Catch-22 (version 8.0)", 0 )
2012GAME( 1985, cracksht, 0,        exidy440, cracksht, exidy440, ROT0, "Exidy", "Crackshot (version 2.0)", 0 )
20412013GAME( 1986, claypign, 0,        exidy440, claypign, claypign, ROT0, "Exidy", "Clay Pigeon (version 2.0)", 0 )
2042GAME( 1986, chiller,  0,        exidy440, chiller,  chiller, ROT0, "Exidy", "Chiller (version 3.0)", 0 )
2014GAME( 1986, chiller,  0,        exidy440, chiller,  exidy440, ROT0, "Exidy", "Chiller (version 3.0)", 0 )
20432015GAME( 1986, topsecex, 0,        topsecex, topsecex, topsecex, ROT0, "Exidy", "Top Secret (Exidy) (version 1.0)", 0 )
2044GAME( 1987, hitnmiss, 0,        exidy440, hitnmiss, hitnmiss, ROT0, "Exidy", "Hit 'n Miss (version 3.0)", 0 )
2045GAME( 1987, hitnmis2, hitnmiss, exidy440, hitnmiss, hitnmiss, ROT0, "Exidy", "Hit 'n Miss (version 2.0)", 0 )
2046GAME( 1988, whodunit, 0,        exidy440, whodunit, whodunit, ROT0, "Exidy", "Who Dunit (version 8.0)", 0 )
2016GAME( 1987, hitnmiss, 0,        exidy440, hitnmiss, exidy440, ROT0, "Exidy", "Hit 'n Miss (version 3.0)", 0 )
2017GAME( 1987, hitnmis2, hitnmiss, exidy440, hitnmiss, exidy440, ROT0, "Exidy", "Hit 'n Miss (version 2.0)", 0 )
2018GAME( 1988, whodunit, 0,        exidy440, whodunit, exidy440, ROT0, "Exidy", "Who Dunit (version 8.0)", 0 )
20472019GAME( 1988, showdown, 0,        exidy440, showdown, showdown, ROT0, "Exidy", "Showdown (version 5.0)", 0 )
20482020GAME( 1989, yukon,    0,        exidy440, showdown, yukon,    ROT0, "Exidy", "Yukon (version 2.0)", 0 )
20492021GAME( 1989, yukon1,   yukon,    exidy440, showdown, yukon,    ROT0, "Exidy", "Yukon (version 1.0)", 0 )
src/mame/drivers/thayers.c
r1877r1878
459459   MDRV_CPU_ADD(Z80, SCHEMATIC_CLOCK)
460460   MDRV_CPU_PROGRAM_MAP(mainmem,0)
461461   MDRV_CPU_IO_MAP(mainio,0)
462   MDRV_CPU_VBLANK_INT(vblank_callback_thayers, 1)
462   MDRV_CPU_VBLANK_INT("main", vblank_callback_thayers)
463463
464464   MDRV_MACHINE_START(thayers)
465465
src/mame/drivers/topshoot.c
r1877r1878
239239static MACHINE_DRIVER_START( genesis_base )
240240   /*basic machine hardware */
241241   MDRV_CPU_ADD_TAG("main", M68000, MASTER_CLOCK / 7)
242   MDRV_CPU_VBLANK_INT(genesis_vblank_interrupt,1)
242   MDRV_CPU_VBLANK_INT("main", genesis_vblank_interrupt)
243243
244244   MDRV_CPU_ADD_TAG("sound", Z80, MASTER_CLOCK / 15)
245245   MDRV_CPU_PROGRAM_MAP(genesis_z80_readmem, genesis_z80_writemem)
246   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1) /* from vdp at scanline 0xe0 */
246   MDRV_CPU_VBLANK_INT("main", irq0_line_hold) /* from vdp at scanline 0xe0 */
247247
248248   MDRV_INTERLEAVE(100)
249249
src/mame/drivers/merit.c
r1877r1878
797797   MDRV_CPU_ADD_TAG("main",Z80,2500000)       /* ?? */
798798   MDRV_CPU_PROGRAM_MAP(pitboss_map,0)
799799   MDRV_CPU_IO_MAP(trvwhiz_io_map,0)
800   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
800   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
801801
802802   MDRV_NVRAM_HANDLER(generic_0fill)
803803   MDRV_MACHINE_RESET(merit)
src/mame/drivers/dassault.c
r1877r1878
170170
171171static WRITE16_HANDLER( dassault_sound_w )
172172{
173   soundlatch_w(0,data&0xff);
174   cpunum_set_input_line(Machine, 2,0,HOLD_LINE); /* IRQ1 */
173   soundlatch_w(machine,0,data&0xff);
174   cpunum_set_input_line(machine, 2,0,HOLD_LINE); /* IRQ1 */
175175}
176176
177177/* The CPU-CPU irq controller is overlaid onto the end of the shared memory */
r1877r1878
556556   /* basic machine hardware */
557557   MDRV_CPU_ADD(M68000, 14000000) /* Accurate */
558558   MDRV_CPU_PROGRAM_MAP(dassault_readmem,dassault_writemem)
559   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
559   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
560560
561561   MDRV_CPU_ADD(M68000, 14000000) /* Accurate */
562562   MDRV_CPU_PROGRAM_MAP(dassault_sub_readmem,dassault_sub_writemem)
563   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
563   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)
564564
565565   MDRV_CPU_ADD(H6280,32220000/8)
566566   /* audio CPU */   /* Accurate */
src/mame/drivers/dambustr.c
r1877r1878
2727{
2828   if (data != noise_data) {
2929      noise_data = data;
30      galaxian_noise_enable_w(offset, data);
31   };
30      galaxian_noise_enable_w(machine, offset, data);
31   }
3232}
3333
3434
src/mame/drivers/pingpong.c
r1877r1878
457457   /* basic machine hardware */
458458   MDRV_CPU_ADD_TAG("cpu",Z80,18432000/6)      /* 3.072 MHz (probably) */
459459   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
460   MDRV_CPU_VBLANK_INT(pingpong_interrupt,16)   /* 1 IRQ + 8 NMI */
460   MDRV_CPU_VBLANK_INT_HACK(pingpong_interrupt,16)   /* 1 IRQ + 8 NMI */
461461
462462   /* video hardware */
463463   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
486486   MDRV_IMPORT_FROM( pingpong )
487487   MDRV_CPU_MODIFY("cpu")
488488   MDRV_CPU_PROGRAM_MAP(merlinmm_map,0)
489   MDRV_CPU_VBLANK_INT(pingpong_interrupt,2)
489   MDRV_CPU_VBLANK_INT_HACK(pingpong_interrupt,2)
490490
491491   MDRV_NVRAM_HANDLER(generic_0fill)
492492MACHINE_DRIVER_END
src/mame/drivers/ssrj.c
r1877r1878
5656
5757static READ8_HANDLER(ssrj_wheel_r)
5858{
59   int port= input_port_1_r(0) -0x80;
59   int port= input_port_1_r(machine,0) -0x80;
6060   int retval=port-oldport;
6161   oldport=port;
6262   return retval;
r1877r1878
173173   /* basic machine hardware */
174174   MDRV_CPU_ADD(Z80,8000000/2)
175175   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
176   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
176   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
177177
178178   /* video hardware */
179179   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/blstroid.c
r1877r1878
197197   /* basic machine hardware */
198198   MDRV_CPU_ADD(M68000, ATARI_CLOCK_14MHz/2)
199199   MDRV_CPU_PROGRAM_MAP(main_map,0)
200   MDRV_CPU_VBLANK_INT(atarigen_video_int_gen,1)
200   MDRV_CPU_VBLANK_INT("main", atarigen_video_int_gen)
201201
202202   MDRV_MACHINE_RESET(blstroid)
203203   MDRV_NVRAM_HANDLER(atarigen)
src/mame/drivers/gotya.c
r1877r1878
200200   /* basic machine hardware */
201201   MDRV_CPU_ADD(Z80,18432000/6)   /* 3.072 MHz ??? */
202202   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
203   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
203   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
204204
205205   /* video hardware */
206206   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/gtipoker.c
r1877r1878
5858   MDRV_CPU_ADD(Z80,4000000)       /* ? MHz */
5959   MDRV_CPU_PROGRAM_MAP(gtipoker_memmap,0)
6060   MDRV_CPU_IO_MAP(gtipoker_iomap,0)
61   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
61   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
6262
6363   /* video hardware */
6464   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/aztarac.c
r1877r1878
6060
6161static READ16_HANDLER( joystick_r )
6262{
63    return (((input_port_0_r (offset) - 0xf) << 8) |
64            ((input_port_1_r (offset) - 0xf) & 0xff));
63    return (((input_port_0_r (machine,offset) - 0xf) << 8) |
64            ((input_port_1_r (machine,offset) - 0xf) & 0xff));
6565}
6666
6767
r1877r1878
150150   /* basic machine hardware */
151151   MDRV_CPU_ADD(M68000, 8000000)
152152   MDRV_CPU_PROGRAM_MAP(main_map,0)
153   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
153   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
154154
155155   MDRV_CPU_ADD(Z80, 2000000)
156156   MDRV_CPU_PROGRAM_MAP(sound_map,0)
src/mame/drivers/tatsumi.c
r1877r1878
170170
171171static WRITE16_HANDLER(cyclwarr_sound_w)
172172{
173   soundlatch_w(0, data >> 8);
174   cpunum_set_input_line(Machine, 2, INPUT_LINE_NMI, PULSE_LINE);
173   soundlatch_w(machine, 0, data >> 8);
174   cpunum_set_input_line(machine, 2, INPUT_LINE_NMI, PULSE_LINE);
175175}
176176
177177/***************************************************************************/
r1877r1878
826826   /* basic machine hardware */
827827   MDRV_CPU_ADD(V30,20000000 / 2) /* NEC V30 CPU, 20MHz / 2 */
828828   MDRV_CPU_PROGRAM_MAP(apache3_v30_map,0)
829   MDRV_CPU_VBLANK_INT(roundup5_interrupt,1)
829   MDRV_CPU_VBLANK_INT("main", roundup5_interrupt)
830830
831831   MDRV_CPU_ADD(M68000,20000000 / 2) /* 68000 CPU, 20MHz / 2 */
832832   MDRV_CPU_PROGRAM_MAP(apache3_68000_map,0)
r1877r1878
872872   /* basic machine hardware */
873873   MDRV_CPU_ADD(V30,20000000 / 2) /* NEC V30 CPU, 20MHz / 2 */
874874   MDRV_CPU_PROGRAM_MAP(roundup5_v30_map,0)
875   MDRV_CPU_VBLANK_INT(roundup5_interrupt,1)
875   MDRV_CPU_VBLANK_INT("main", roundup5_interrupt)
876876
877877   MDRV_CPU_ADD(M68000,20000000 / 2) /* 68000 CPU, 20MHz / 2 */
878878   MDRV_CPU_PROGRAM_MAP(roundup5_68000_map,0)
r1877r1878
915915   /* basic machine hardware */
916916   MDRV_CPU_ADD(M68000, 50000000 / 4) /* Confirmed */
917917   MDRV_CPU_PROGRAM_MAP(cyclwarr_68000a_map,0)
918   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
918   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)
919919
920920   MDRV_CPU_ADD(M68000, 50000000 / 4) /* Confirmed */
921921   MDRV_CPU_PROGRAM_MAP(cyclwarr_68000b_map,0)
922   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
922   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)
923923
924924   MDRV_CPU_ADD(Z80, 16000000 / 4) /* Confirmed */
925925   MDRV_CPU_PROGRAM_MAP(cyclwarr_z80_map,0)
r1877r1878
959959   /* basic machine hardware */
960960   MDRV_CPU_ADD(M68000, 50000000 / 4) /* Confirmed */
961961   MDRV_CPU_PROGRAM_MAP(bigfight_68000a_map,0)
962   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
962   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)
963963
964964   MDRV_CPU_ADD(M68000, 50000000 / 4) /* Confirmed */
965965   MDRV_CPU_PROGRAM_MAP(bigfight_68000b_map,0)
966   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
966   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)
967967
968968   MDRV_CPU_ADD(Z80, 16000000 / 4) /* Confirmed */
969969   MDRV_CPU_PROGRAM_MAP(cyclwarr_z80_map,0)
src/mame/drivers/supbtime.c
r1877r1878
5353
5454static WRITE16_HANDLER( sound_w )
5555{
56   soundlatch_w(0,data & 0xff);
57   cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
56   soundlatch_w(machine,0,data & 0xff);
57   cpunum_set_input_line(machine, 1,0,HOLD_LINE);
5858}
5959
6060/******************************************************************************/
r1877r1878
121121{
122122   switch (offset) {
123123   case 0:
124      YM2151_register_port_0_w(0,data);
124      YM2151_register_port_0_w(machine,0,data);
125125      break;
126126   case 1:
127      YM2151_data_port_0_w(0,data);
127      YM2151_data_port_0_w(machine,0,data);
128128      break;
129129   }
130130}
r1877r1878
376376   /* basic machine hardware */
377377   MDRV_CPU_ADD(M68000, 14000000)
378378   MDRV_CPU_PROGRAM_MAP(supbtime_readmem,supbtime_writemem)
379   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
379   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
380380
381381   MDRV_CPU_ADD(H6280, 32220000/8)   /* Custom chip 45, audio section crystal is 32.220 MHz */
382382   /* audio CPU */
r1877r1878
417417   /* basic machine hardware */
418418   MDRV_CPU_ADD(M68000, 14000000)
419419   MDRV_CPU_PROGRAM_MAP(chinatwn_readmem,chinatwn_writemem)
420   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
420   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
421421
422422   MDRV_CPU_ADD(H6280, 32220000/8) /* Custom chip 45, audio section crystal is 32.220 MHz */
423423   /* audio CPU */
src/mame/drivers/blmbycar.c
r1877r1878
386386   /* basic machine hardware */
387387   MDRV_CPU_ADD(M68000, 10000000)   /* ? */
388388   MDRV_CPU_PROGRAM_MAP(blmbycar_readmem,blmbycar_writemem)
389   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
389   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
390390
391391   /* video hardware */
392392   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
416416   /* basic machine hardware */
417417   MDRV_CPU_ADD(M68000, 10000000)   /* ? */
418418   MDRV_CPU_PROGRAM_MAP(watrball_readmem,watrball_writemem)
419   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
419   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
420420
421421   /* video hardware */
422422   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/toratora.c
r1877r1878
140140   if (timer & 0x100) popmessage("watchdog!");
141141
142142
143   if (last != (input_port_0_r(0) & 0x0f))
143   if (last != (input_port_0_r(machine, 0) & 0x0f))
144144   {
145      last = input_port_0_r(0) & 0x0f;
145      last = input_port_0_r(machine, 0) & 0x0f;
146146      cpunum_set_input_line(machine, 0, 0, PULSE_LINE);
147147   }
148   pia_set_input_a(0, input_port_0_r(0) & 0x0f, 0);
148   pia_set_input_a(0, input_port_0_r(machine, 0) & 0x0f, 0);
149149
150   pia_set_input_ca1(0, input_port_0_r(0) & 0x10);
150   pia_set_input_ca1(0, input_port_0_r(machine, 0) & 0x10);
151151
152   pia_set_input_ca2(0, input_port_0_r(0) & 0x20);
152   pia_set_input_ca2(0, input_port_0_r(machine, 0) & 0x20);
153153}
154154
155155static READ8_HANDLER( timer_r )
src/mame/drivers/retofinv.c
r1877r1878
9393
9494static WRITE8_HANDLER( soundcommand_w )
9595{
96      soundlatch_w(0, data);
97      cpunum_set_input_line(Machine, 2, 0, HOLD_LINE);
96      soundlatch_w(machine, 0, data);
97      cpunum_set_input_line(machine, 2, 0, HOLD_LINE);
9898}
9999
100100static WRITE8_HANDLER( irq0_ack_w )
r1877r1878
367367   /* basic machine hardware */
368368   MDRV_CPU_ADD(Z80, 18432000/6)   /* 3.072 MHz? */
369369   MDRV_CPU_PROGRAM_MAP(main_map,0)
370   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
370   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
371371
372372   MDRV_CPU_ADD(Z80, 18432000/6)   /* 3.072 MHz? */
373373   MDRV_CPU_PROGRAM_MAP(sub_map,0)
374   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
374   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
375375
376376   MDRV_CPU_ADD(Z80, 18432000/6)   /* 3.072 MHz? */
377377   MDRV_CPU_PROGRAM_MAP(sound_map,0)
378   MDRV_CPU_VBLANK_INT(nmi_line_pulse,2)
378   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,2)
379379
380380   MDRV_CPU_ADD_TAG("68705", M68705,18432000/6)   /* 3.072 MHz? */
381381   MDRV_CPU_PROGRAM_MAP(mcu_map,0)
src/mame/drivers/gbusters.c
r1877r1878
4444static WRITE8_HANDLER( bankedram_w )
4545{
4646   if (palette_selected)
47      paletteram_xBBBBBGGGGGRRRRR_be_w(offset,data);
47      paletteram_xBBBBBGGGGGRRRRR_be_w(machine,offset,data);
4848   else
4949      ram[offset] = data;
5050}
r1877r1878
299299   /* basic machine hardware */
300300   MDRV_CPU_ADD(KONAMI, 3000000)   /* Konami custom 052526 */
301301   MDRV_CPU_PROGRAM_MAP(gbusters_readmem,gbusters_writemem)
302   MDRV_CPU_VBLANK_INT(gbusters_interrupt,1)
302   MDRV_CPU_VBLANK_INT("main", gbusters_interrupt)
303303
304304   MDRV_CPU_ADD(Z80, 3579545)
305305   /* audio CPU */      /* ? */
src/mame/drivers/megaplay.c
r1877r1878
240240//  PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_NAME("0x6201 bit 7") PORT_CODE(KEYCODE_K)
241241INPUT_PORTS_END
242242
243#ifdef UNUSED_DEFINITION
243244static INPUT_PORTS_START ( mp_col3 )
244245   GENESIS_PORTS
245246   MEGAPLAY_TEST
r1877r1878
266267//  PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_NAME("0x6201 bit 6") PORT_CODE(KEYCODE_J)
267268//  PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_NAME("0x6201 bit 7") PORT_CODE(KEYCODE_K)
268269INPUT_PORTS_END
270#endif
269271
270272static INPUT_PORTS_START ( mp_twc )
271273   GENESIS_PORTS
r1877r1878
438440   UINT8* game = memory_region(REGION_CPU1);
439441
440442   if(game_banksel == 0x142) // Genesis I/O
441      return megaplay_genesis_io_r((offset & 0x1f) / 2, 0xffff);
443      return megaplay_genesis_io_r(machine, (offset & 0x1f) / 2, 0xffff);
442444
443445   if(bios_mode & MP_ROM)
444446   {
r1877r1878
471473static WRITE8_HANDLER ( bank_w )
472474{
473475   if(game_banksel == 0x142) // Genesis I/O
474      genesis_io_w((offset & 0x1f) / 2, data, 0xffff);
476      genesis_io_w(machine, (offset & 0x1f) / 2, data, 0xffff);
475477
476478   if(offset <= 0x1fff && (bios_width & 0x08))
477479      ic37_ram[(0x2000 * (bios_bank & 0x03)) + offset] = data;
r1877r1878
674676   MDRV_CPU_ADD_TAG("megaplay_bios", Z80, MASTER_CLOCK / 15) /* ?? */
675677   MDRV_CPU_PROGRAM_MAP(megaplay_bios_readmem, megaplay_bios_writemem)
676678   MDRV_CPU_IO_MAP(megaplay_bios_readport,megaplay_bios_writeport)
677   MDRV_CPU_VBLANK_INT(megaplay_bios_irq, 262)
679   MDRV_CPU_VBLANK_INT_HACK(megaplay_bios_irq, 262)
678680
679681   MDRV_INTERLEAVE(100)
680682
src/mame/drivers/meadows.c
r1877r1878
66
77    Games supported:
88        * Dead Eye
9        * 3-D Bowling
910        * Gypsy Juggler
1011        * Inferno
1112
r1877r1878
8788
8889    0c00..0c03  H/W input ports
8990    -----------------------------------------------
90            0 R sound command from CPU #0
91            0 R audio command from CPU #0
9192                D0-D7   8 different sounds ???
9293
9394            1 R ???
r1877r1878
99100                D4-D7   volume bits 0 .. 3 (bit 4 is CPU #1 flag output)
100101            2 W D0-D7   preset for counter, clk is 5 MHz / 32
101102            3 W D0      divide c02 counter by 0: 2, 1: 4
102                D1      sound enable for c02 tone generator
103                D2      sound enable for DAC
104                D3      sound enable for c01 tone generator
103                D1      audio enable for c02 tone generator
104                D2      audio enable for DAC
105                D3      audio enable for c01 tone generator
105106
106107    0e00-0eff   RAM
107108
r1877r1878
132133 *
133134 *************************************/
134135
135static UINT64 cycles_at_vsync;
136136static UINT8 main_sense_state;
137static UINT8 sound_sense_state;
138static UINT8 coin1_state;
139static UINT8 minferno_sense;
137static UINT8 audio_sense_state;
140138
141139
142140
r1877r1878
148146
149147static READ8_HANDLER( hsync_chain_r )
150148{
151   /* horizontal sync divider chain */
152   UINT8 val = (activecpu_gettotalcycles() - cycles_at_vsync) & 0xff;
149   UINT8 val = video_screen_get_hpos(0);
153150   return BITSWAP8(val,0,1,2,3,4,5,6,7);
154151}
155152
156153
157154static READ8_HANDLER( vsync_chain_hi_r )
158155{
159   /* vertical sync divider chain */
160156   UINT8 val = video_screen_get_vpos(0);
161157   return ((val >> 1) & 0x08) | ((val >> 3) & 0x04) | ((val >> 5) & 0x02) | (val >> 7);
162158}
r1877r1878
164160
165161static READ8_HANDLER( vsync_chain_lo_r )
166162{
167   /* vertical sync divider chain */
168163   UINT8 val = video_screen_get_vpos(0);
169164   return val & 0x0f;
170165}
r1877r1878
173168
174169/*************************************
175170 *
176 *  Sound control writes
171 *  Audio control writes
177172 *
178173 *************************************/
179174
180static WRITE8_HANDLER( meadows_sound_w )
175static WRITE8_HANDLER( meadows_audio_w )
181176{
182177   switch (offset)
183178   {
184179      case 0:
185180         if (meadows_0c00 == data)
186181            break;
187         logerror("meadows_sound_w %d $%02x\n", offset, data);
182         logerror("meadows_audio_w %d $%02x\n", offset, data);
188183         meadows_0c00 = data;
189184            break;
190185
191186      case 1:
192         logerror("meadows_sound_w %d $%02x\n", offset, data);
187         logerror("meadows_audio_w %d $%02x\n", offset, data);
193188            break;
194189
195190        case 2:
196         logerror("meadows_sound_w %d $%02x\n", offset, data);
191         logerror("meadows_audio_w %d $%02x\n", offset, data);
197192            break;
198193
199194      case 3:
r1877r1878
206201
207202/*************************************
208203 *
204 *  Coin handling
205 *
206 *************************************/
207
208static INPUT_CHANGED( coin_inserted )
209{
210   cpunum_set_input_line_and_vector(machine, 0, 0, (newval ? ASSERT_LINE : CLEAR_LINE), 0x82);
211}
212
213
214
215/*************************************
216 *
209217 *  Main CPU interrupt
210218 *
211219 *************************************/
212220
213221static INTERRUPT_GEN( meadows_interrupt )
214222{
215   /* preserve the actual cycle count */
216    cycles_at_vsync = cpunum_gettotalcycles(0);
217
218223    /* fake something toggling the sense input line of the S2650 */
219224   main_sense_state ^= 1;
220225   cpunum_set_input_line(machine, 0, 1, main_sense_state ? ASSERT_LINE : CLEAR_LINE);
221
222   /* check the fake coin input */
223   if (readinputport(3) & 0x01)
224   {
225      if (!coin1_state)
226      {
227         coin1_state = 1;
228         cpunum_set_input_line_and_vector(machine, 0, 0, PULSE_LINE, 0x82);
229      }
230   }
231   else
232      coin1_state = 0;
233226}
234227
235228
r1877r1878
242235
243236static INTERRUPT_GEN( minferno_interrupt )
244237{
245   /* preserve the actual cycle count */
246   cycles_at_vsync = cpunum_gettotalcycles(0);
247   minferno_sense++;
248   cpunum_set_input_line(machine, 0, 1, (minferno_sense & 0x40) ? ASSERT_LINE : CLEAR_LINE );
238   main_sense_state++;
239   cpunum_set_input_line(machine, 0, 1, (main_sense_state & 0x40) ? ASSERT_LINE : CLEAR_LINE );
249240}
250241
251242
252243
253244/*************************************
254245 *
255 *  Sound hardware output control
246 *  Audio hardware output control
256247 *
257248 *************************************/
258249
259static WRITE8_HANDLER( sound_hardware_w )
250static WRITE8_HANDLER( audio_hardware_w )
260251{
261252   switch (offset & 3)
262253   {
r1877r1878
267258      case 1: /* counter clk 5 MHz / 256 */
268259         if (data == meadows_0c01)
269260            break;
270         logerror("sound_w ctr1 preset $%x amp %d\n", data & 15, data >> 4);
261         logerror("audio_w ctr1 preset $%x amp %d\n", data & 15, data >> 4);
271262         meadows_0c01 = data;
272263         meadows_sh_update();
273264         break;
r1877r1878
275266      case 2: /* counter clk 5 MHz / 32 (/ 2 or / 4) */
276267         if (data == meadows_0c02)
277268                break;
278         logerror("sound_w ctr2 preset $%02x\n", data);
269         logerror("audio_w ctr2 preset $%02x\n", data);
279270         meadows_0c02 = data;
280271         meadows_sh_update();
281272            break;
282273
283      case 3: /* sound enable */
274      case 3: /* audio enable */
284275         if (data == meadows_0c03)
285276                break;
286         logerror("sound_w enable ctr2/2:%d ctr2:%d dac:%d ctr1:%d\n", data&1, (data>>1)&1, (data>>2)&1, (data>>3)&1);
277         logerror("audio_w enable ctr2/2:%d ctr2:%d dac:%d ctr1:%d\n", data&1, (data>>1)&1, (data>>2)&1, (data>>3)&1);
287278         meadows_0c03 = data;
288279         meadows_sh_update();
289280            break;
r1877r1878
294285
295286/*************************************
296287 *
297 *  Sound hardware read
288 *  Audio hardware read
298289 *
299290 *************************************/
300291
301static READ8_HANDLER( sound_hardware_r )
292static READ8_HANDLER( audio_hardware_r )
302293{
303294   int data = 0;
304295
r1877r1878
319310
320311/*************************************
321312 *
322 *  Sound hardware interrupts
313 *  Audio hardware interrupts
323314 *
324315 *************************************/
325316
326static INTERRUPT_GEN( sound_interrupt )
317static INTERRUPT_GEN( audio_interrupt )
327318{
328319    /* fake something toggling the sense input line of the S2650 */
329   sound_sense_state ^= 1;
330   cpunum_set_input_line(machine, 1, 1, sound_sense_state ? ASSERT_LINE : CLEAR_LINE);
320   audio_sense_state ^= 1;
321   cpunum_set_input_line(machine, 1, 1, audio_sense_state ? ASSERT_LINE : CLEAR_LINE);
331322}
332323
333324
r1877r1878
340331
341332static PALETTE_INIT( meadows )
342333{
343   palette_set_color(machine,0,MAKE_RGB(0x00,0x00,0x00)); /* BLACK */
344   palette_set_color(machine,1,MAKE_RGB(0xff,0xff,0xff)); /* WHITE */
334   palette_set_color(machine, 0, RGB_BLACK);
335   palette_set_color(machine, 1, RGB_WHITE);
345336}
346337
347338
r1877r1878
352343 *
353344 *************************************/
354345
355static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
356   AM_RANGE(0x0000, 0x0bff) AM_WRITE(MWA8_ROM)
357   AM_RANGE(0x0c00, 0x0c03) AM_WRITE(meadows_sound_w)
358   AM_RANGE(0x0d00, 0x0d0f) AM_WRITE(meadows_spriteram_w) AM_BASE(&spriteram)
359   AM_RANGE(0x0e00, 0x0eff) AM_WRITE(MWA8_RAM)
360   AM_RANGE(0x1000, 0x1bff) AM_WRITE(MWA8_ROM)
361   AM_RANGE(0x1c00, 0x1fff) AM_WRITE(meadows_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size)
362ADDRESS_MAP_END
363
364
365static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
366   AM_RANGE(0x0000, 0x0bff) AM_READ(MRA8_ROM)
346static ADDRESS_MAP_START( meadows_main_map, ADDRESS_SPACE_PROGRAM, 8 )
347   AM_RANGE(0x0000, 0x0bff) AM_ROM
367348   AM_RANGE(0x0c00, 0x0c00) AM_READ(input_port_0_r)
368349   AM_RANGE(0x0c01, 0x0c01) AM_READ(input_port_1_r)
369350   AM_RANGE(0x0c02, 0x0c02) AM_READ(hsync_chain_r)
370351   AM_RANGE(0x0c03, 0x0c03) AM_READ(input_port_2_r)
371   AM_RANGE(0x0e00, 0x0eff) AM_READ(MRA8_RAM)
372   AM_RANGE(0x1000, 0x1bff) AM_READ(MRA8_ROM)
373   AM_RANGE(0x1c00, 0x1fff) AM_READ(MRA8_RAM)
352   AM_RANGE(0x0c00, 0x0c03) AM_WRITE(meadows_audio_w)
353   AM_RANGE(0x0d00, 0x0d0f) AM_WRITE(meadows_spriteram_w) AM_BASE(&spriteram)
354   AM_RANGE(0x0e00, 0x0eff) AM_RAM
355   AM_RANGE(0x1000, 0x1bff) AM_ROM
356   AM_RANGE(0x1c00, 0x1fff) AM_READWRITE(MRA8_RAM, meadows_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size)
374357ADDRESS_MAP_END
375358
376359
377static ADDRESS_MAP_START( minferno_writemem, ADDRESS_SPACE_PROGRAM, 8 )
378   AM_RANGE(0x0000, 0x0bff) AM_WRITE(MWA8_ROM)
379   AM_RANGE(0x1c00, 0x1eff) AM_WRITE(meadows_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size)
380   AM_RANGE(0x1f00, 0x1f03) AM_WRITE(meadows_sound_w)
381ADDRESS_MAP_END
382
383
384static ADDRESS_MAP_START( minferno_readmem, ADDRESS_SPACE_PROGRAM, 8 )
385   AM_RANGE(0x0000, 0x0bff) AM_READ(MRA8_ROM)
386   AM_RANGE(0x1c00, 0x1eff) AM_READ(MRA8_RAM)
360static ADDRESS_MAP_START( minferno_main_map, ADDRESS_SPACE_PROGRAM, 8 )
361   AM_RANGE(0x0000, 0x0bff) AM_ROM
362   AM_RANGE(0x1c00, 0x1eff) AM_READWRITE(MRA8_RAM, meadows_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size)
387363   AM_RANGE(0x1f00, 0x1f00) AM_READ(input_port_0_r)
388364   AM_RANGE(0x1f01, 0x1f01) AM_READ(input_port_1_r)
389365   AM_RANGE(0x1f02, 0x1f02) AM_READ(input_port_2_r)
390366   AM_RANGE(0x1f03, 0x1f03) AM_READ(input_port_3_r)
367   AM_RANGE(0x1f00, 0x1f03) AM_WRITE(meadows_audio_w)
391368   AM_RANGE(0x1f04, 0x1f04) AM_READ(vsync_chain_hi_r)
392369   AM_RANGE(0x1f05, 0x1f05) AM_READ(vsync_chain_lo_r)
393370ADDRESS_MAP_END
394371
395372
396static ADDRESS_MAP_START( minferno_readport, ADDRESS_SPACE_IO, 8 )
373static ADDRESS_MAP_START( minferno_io_map, ADDRESS_SPACE_IO, 8 )
397374   AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_READ(input_port_4_r)
398375ADDRESS_MAP_END
399376
r1877r1878
401378
402379/*************************************
403380 *
404 *  Sound CPU memory handlers
381 *  Audio CPU memory handlers
405382 *
406383 *************************************/
407384
408static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
409   AM_RANGE(0x0000, 0x0bff) AM_WRITE(MWA8_ROM)
410   AM_RANGE(0x0c00, 0x0c03) AM_WRITE(sound_hardware_w)
411   AM_RANGE(0x0e00, 0x0eff) AM_WRITE(MWA8_RAM)
385static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 )
386   AM_RANGE(0x0000, 0x0bff) AM_ROM
387   AM_RANGE(0x0c00, 0x0c03) AM_READWRITE(audio_hardware_r, audio_hardware_w)
388   AM_RANGE(0x0e00, 0x0eff) AM_RAM
412389ADDRESS_MAP_END
413390
414391
415static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
416   AM_RANGE(0x0000, 0x0bff) AM_READ(MRA8_ROM)
417   AM_RANGE(0x0c00, 0x0c03) AM_READ(sound_hardware_r)
418   AM_RANGE(0x0e00, 0x0eff) AM_READ(MRA8_RAM)
419ADDRESS_MAP_END
420392
421393
422
423394/*************************************
424395 *
425396 *  Port definitions
r1877r1878
465436   PORT_DIPSETTING(    0x00, DEF_STR( None ))
466437
467438   PORT_START      /* FAKE coinage */
468   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
439   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
469440   PORT_BIT( 0x8e, IP_ACTIVE_LOW, IPT_UNUSED )
470441INPUT_PORTS_END
471442
r1877r1878
574545
575546/*************************************
576547 *
577 *  Sound interfaces
548 *  Audio interfaces
578549 *
579550 *************************************/
580551
581static const struct Samplesinterface meadows_samples_interface =
582{
583   2,
584   NULL,
585   meadows_sh_start
586};
587
588552static const char *const bowl3d_sample_names[] =
589553{
590554   "*bowl3d",
r1877r1878
594558   "footstep.wav", /* "foot sweep" */
595559   "crash.wav",    /* "crash" */
596560   "cheering.wav", /* "cheering" */
597    0   /* end of array */
561    0
598562};
599563
564
565static const struct Samplesinterface meadows_samples_interface =
566{
567   2,
568   NULL,
569   meadows_sh_start
570};
571
572
600573static const struct Samplesinterface bowl3d_samples_interface =
601574{
602    1,   /* one channel */
575    1,
603576   bowl3d_sample_names
604577};
605578
579
580
606581/*************************************
607582 *
608583 *  Machine drivers
r1877r1878
613588
614589   /* basic machine hardware */
615590   MDRV_CPU_ADD(S2650, 5000000/8)    /* 5MHz / 8 = 625 kHz */
616   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
617   MDRV_CPU_VBLANK_INT(meadows_interrupt,1)    /* one interrupt per frame!? */
591   MDRV_CPU_PROGRAM_MAP(meadows_main_map,0)
592   MDRV_CPU_VBLANK_INT("main", meadows_interrupt)    /* one interrupt per frame!? */
618593
619594   MDRV_CPU_ADD(S2650, 5000000/8)
620595   /* audio CPU */    /* 5MHz / 8 = 625 kHz */
621   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
622   MDRV_CPU_PERIODIC_INT(sound_interrupt, (double)5000000/131072)
596   MDRV_CPU_PROGRAM_MAP(audio_map,0)
597   MDRV_CPU_PERIODIC_INT(audio_interrupt, (double)5000000/131072)
623598
624599   MDRV_INTERLEAVE(10)
625600
r1877r1878
637612   MDRV_VIDEO_START(meadows)
638613   MDRV_VIDEO_UPDATE(meadows)
639614
640   /* sound hardware */
615   /* audio hardware */
641616   MDRV_SPEAKER_STANDARD_MONO("mono")
642617
643618   MDRV_SOUND_ADD(DAC, 0)
r1877r1878
653628
654629   /* basic machine hardware */
655630   MDRV_CPU_ADD(S2650, 5000000/8/3)    /* 5MHz / 8 = 625 kHz */
656   MDRV_CPU_PROGRAM_MAP(minferno_readmem,minferno_writemem)
657   MDRV_CPU_IO_MAP(minferno_readport,0)
658   MDRV_CPU_VBLANK_INT(minferno_interrupt,1)
631   MDRV_CPU_PROGRAM_MAP(minferno_main_map,0)
632   MDRV_CPU_IO_MAP(minferno_io_map,0)
633   MDRV_CPU_VBLANK_INT("main", minferno_interrupt)
659634
660635   /* video hardware */
661636   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
671646   MDRV_VIDEO_START(meadows)
672647   MDRV_VIDEO_UPDATE(meadows)
673648
674   /* sound hardware */
649   /* audio hardware */
675650MACHINE_DRIVER_END
676651
677652
r1877r1878
679654   /* basic machine hardware */
680655   MDRV_IMPORT_FROM(meadows)
681656
682    /* video hardware */
657    /* audio hardware */
683658   MDRV_SOUND_ADD(SAMPLES, 0)
684659   MDRV_SOUND_CONFIG(bowl3d_samples_interface)
685660   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
686661MACHINE_DRIVER_END
687662
688663
664
689665/*************************************
690666 *
691667 *  ROM definitions
r1877r1878
715691   ROM_REGION( 0x0400, REGION_GFX5, ROMREGION_DISPOSE )
716692   /* empty */
717693
718   ROM_REGION( 0x08000, REGION_CPU2, 0 )    /* 32K for code for the sound cpu */
694   ROM_REGION( 0x08000, REGION_CPU2, 0 )
719695   ROM_LOAD( "de_snd",       0x0000, 0x0400, CRC(c10a1b1a) SHA1(779ea261d23360634081295a164cacbd819d8719) )
720696ROM_END
721697
698
722699ROM_START( bowl3d )
723700   ROM_REGION( 0x08000, REGION_CPU1, 0 )
724701   ROM_LOAD( "b3d.h8",       0x0000, 0x0400, CRC(be38feeb) SHA1(feab3c61ce1e351c02f6ffa7f7f2ac90e62e7719) )
r1877r1878
770747   /* empty (copied from 2) */
771748
772749   ROM_REGION( 0x0400, REGION_GFX4, ROMREGION_DISPOSE )
773   /* empty (filled with fake data) */
750   ROM_LOAD( "gj.x",      0x0000, 0x0400, NO_DUMP )      /* missing */
774751
775752   ROM_REGION( 0x0400, REGION_GFX5, ROMREGION_DISPOSE )
776   /* empty (filled with fake data) */
753   ROM_LOAD( "gj.y",      0x0000, 0x0400, NO_DUMP )      /* missing */
777754
778   ROM_REGION( 0x08000, REGION_CPU2, 0 )    /* 32K for code for the sound cpu */
755   ROM_REGION( 0x08000, REGION_CPU2, 0 )
779756   ROM_LOAD( "gj.a4s",       0x0000, 0x0400, CRC(17a116bc) SHA1(797ba0b292afa3ba7eec985b533014acc00ed47d) )
780757   ROM_LOAD( "gj.a5s",       0x0400, 0x0400, CRC(fc23ae09) SHA1(42be34a9ef8c4c8ef9f94c85ca031076f84faa96) )
781758   ROM_LOAD( "gj.a6s",       0x0800, 0x0400, CRC(9e7bd71e) SHA1(e00801820c1a39cbfed124a29470da03cf8b40b4) )
r1877r1878
831808   int i, length;
832809   UINT8 *mem;
833810
834   /* Create an inverted copy of the graphics data */
811   /* create an inverted copy of the graphics data */
835812   mem = memory_region(REGION_GFX1);
836813   length = memory_region_length(REGION_GFX1);
837814   for (i = 0; i < length/2; i++)
r1877r1878
847824 *************************************/
848825
849826GAMEL( 1978, deadeye,  0, meadows,  meadows,  0,        ROT0,  "Meadows", "Dead Eye", 0, layout_deadeye )
850GAME(  1978, bowl3d,   0, bowl3d,   meadows,  0,        ROT90, "Meadows", "Bowling 3D", GAME_NOT_WORKING )
851GAMEL( 1978, gypsyjug, 0, meadows,  meadows,  gypsyjug, ROT0,  "Meadows", "Gypsy Juggler", 0, layout_gypsyjug )
852GAME ( 1978, minferno, 0, minferno, minferno, minferno, ROT0,  "Meadows", "Inferno (S2650)", GAME_NO_SOUND )
827GAME ( 1978, bowl3d,   0, bowl3d,   meadows,  0,        ROT90, "Meadows", "3-D Bowling", GAME_NOT_WORKING )
828GAMEL( 1978, gypsyjug, 0, meadows,  meadows,  gypsyjug, ROT0,  "Meadows", "Gypsy Juggler", GAME_IMPERFECT_GRAPHICS, layout_gypsyjug )
829GAME ( 1978, minferno, 0, minferno, minferno, minferno, ROT0,  "Meadows", "Inferno (Meadows)", GAME_NO_SOUND )
src/mame/drivers/dotrikun.c
r1877r1878
6868   MDRV_CPU_ADD(Z80, 4000000)       /* 4 MHz */
6969   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
7070   MDRV_CPU_IO_MAP(readport,writeport)
71   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
71   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
7272
7373   /* video hardware */
7474   MDRV_VIDEO_UPDATE(dotrikun)
src/mame/drivers/bogeyman.c
r1877r1878
99***************************************************************************/
1010
1111#include "driver.h"
12#include "deprecat.h"
1213#include "cpu/m6502/m6502.h"
1314#include "sound/ay8910.h"
1415extern UINT8 *bogeyman_videoram2, *bogeyman_colorram2;
r1877r1878
4647   {
4748      // bit 4 goes to the 8910 #0 BC1 pin
4849      if (last & 0x10)
49         AY8910_control_port_0_w(0,psg_latch);
50         AY8910_control_port_0_w(machine,0,psg_latch);
5051      else
51         AY8910_write_port_0_w(0,psg_latch);
52         AY8910_write_port_0_w(machine,0,psg_latch);
5253   }
5354
5455   // bit 7 goes to 8910 #1 BDIR pin
r1877r1878
5657   {
5758      // bit 6 goes to the 8910 #1 BC1 pin
5859      if (last & 0x40)
59         AY8910_control_port_1_w(0,psg_latch);
60         AY8910_control_port_1_w(machine,0,psg_latch);
6061      else
61         AY8910_write_port_1_w(0,psg_latch);
62         AY8910_write_port_1_w(machine,0,psg_latch);
6263   }
6364
6465   last = data;
r1877r1878
227228   // basic machine hardware
228229   MDRV_CPU_ADD(M6502, 2000000)   // 12 MHz clock on board
229230   MDRV_CPU_PROGRAM_MAP(bogeyman_map, 0)
230   MDRV_CPU_VBLANK_INT(irq0_line_hold, 16) // Controls sound
231   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold, 16) // Controls sound
231232
232233   // video hardware
233234   MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
src/mame/drivers/harddriv.c
r1877r1878
963963   /* basic machine hardware */
964964   MDRV_CPU_ADD_TAG("main", M68010, 32000000/4)
965965   MDRV_CPU_PROGRAM_MAP(driver_68k_map,0)
966   MDRV_CPU_VBLANK_INT(atarigen_video_int_gen,1)
966   MDRV_CPU_VBLANK_INT("main", atarigen_video_int_gen)
967967   MDRV_CPU_PERIODIC_INT(hd68k_irq_gen, (double)32000000/16/16/16/16/2)
968968
969969   MDRV_CPU_ADD_TAG("gsp", TMS34010, 48000000)
src/mame/drivers/srmp2.c
r1877r1878
10761076   /* basic machine hardware */
10771077   MDRV_CPU_ADD(M68000,16000000/2)            /* 8.00 MHz */
10781078   MDRV_CPU_PROGRAM_MAP(srmp2_readmem,srmp2_writemem)
1079   MDRV_CPU_VBLANK_INT(srmp2_interrupt,16)      /* Interrupt times is not understood */
1079   MDRV_CPU_VBLANK_INT_HACK(srmp2_interrupt,16)      /* Interrupt times is not understood */
10801080
10811081   MDRV_MACHINE_RESET(srmp2)
10821082   MDRV_NVRAM_HANDLER(generic_0fill)
r1877r1878
11161116   //      4000000,                /* 4.00 MHz ? */
11171117   MDRV_CPU_PROGRAM_MAP(srmp3_readmem,srmp3_writemem)
11181118   MDRV_CPU_IO_MAP(srmp3_readport,srmp3_writeport)
1119   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1119   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
11201120
11211121   MDRV_MACHINE_RESET(srmp3)
11221122   MDRV_NVRAM_HANDLER(generic_0fill)
r1877r1878
11531153   /* basic machine hardware */
11541154   MDRV_CPU_ADD(M68000,16000000/2)            /* 8.00 MHz */
11551155   MDRV_CPU_PROGRAM_MAP(mjyuugi_readmem,mjyuugi_writemem)
1156   MDRV_CPU_VBLANK_INT(srmp2_interrupt,16)      /* Interrupt times is not understood */
1156   MDRV_CPU_VBLANK_INT_HACK(srmp2_interrupt,16)      /* Interrupt times is not understood */
11571157
11581158   MDRV_MACHINE_RESET(srmp2)
11591159   MDRV_NVRAM_HANDLER(generic_0fill)
src/mame/drivers/m72.c
r1877r1878
7171***************************************************************************/
7272
7373#include "driver.h"
74#include "deprecat.h"
7475#include "machine/irem_cpu.h"
7576#include "audio/m72.h"
7677#include "sound/dac.h"
r1877r1878
185186
186187static INTERRUPT_GEN(fake_nmi)
187188{
188   int sample = m72_sample_r(0);
189   int sample = m72_sample_r(machine,0);
189190   if (sample)
190      m72_sample_w(0,sample);
191      m72_sample_w(machine,0,sample);
191192}
192193
193194
r1877r1878
19931994   MDRV_CPU_ADD_TAG("sound",Z80, SOUND_CLOCK)
19941995   MDRV_CPU_PROGRAM_MAP(sound_ram_map,0)
19951996   MDRV_CPU_IO_MAP(sound_portmap,0)
1996   MDRV_CPU_VBLANK_INT(fake_nmi,128)   /* clocked by V1? (Vigilante) */
1997   MDRV_CPU_VBLANK_INT_HACK(fake_nmi,128)   /* clocked by V1? (Vigilante) */
19971998                        /* IRQs are generated by main Z80 and YM2151 */
19981999
19992000   MDRV_MACHINE_START(m72)
r1877r1878
20292030   MDRV_CPU_ADD_TAG("mcu",I8751, 8000000)
20302031   MDRV_CPU_PROGRAM_MAP(mcu_map,0)
20312032   MDRV_CPU_DATA_MAP(mcu_data_map,0)
2032   MDRV_CPU_VBLANK_INT(irq0_line_pulse,1)
2033   MDRV_CPU_VBLANK_INT("main", irq0_line_pulse)
20332034MACHINE_DRIVER_END
20342035
20352036
r1877r1878
20432044   MDRV_CPU_ADD_TAG("sound",Z80, SOUND_CLOCK)
20442045   MDRV_CPU_PROGRAM_MAP(sound_ram_map,0)
20452046   MDRV_CPU_IO_MAP(sound_portmap,0)
2046   MDRV_CPU_VBLANK_INT(fake_nmi,128)   /* clocked by V1? (Vigilante) */
2047   MDRV_CPU_VBLANK_INT_HACK(fake_nmi,128)   /* clocked by V1? (Vigilante) */
20472048                        /* IRQs are generated by main Z80 and YM2151 */
20482049
20492050   MDRV_MACHINE_START(m72)
r1877r1878
20842085   MDRV_CPU_ADD_TAG("sound",Z80, SOUND_CLOCK)
20852086   MDRV_CPU_PROGRAM_MAP(sound_ram_map,0)
20862087   MDRV_CPU_IO_MAP(sound_portmap,0)
2087   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
2088   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
20882089                        /* IRQs are generated by main Z80 and YM2151 */
20892090
20902091   MDRV_MACHINE_START(m72)
r1877r1878
21252126   MDRV_CPU_ADD_TAG("sound",Z80, SOUND_CLOCK)
21262127   MDRV_CPU_PROGRAM_MAP(sound_rom_map,0)
21272128   MDRV_CPU_IO_MAP(rtype2_sound_portmap,0)
2128   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
2129   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
21292130                        /* IRQs are generated by main Z80 and YM2151 */
21302131
21312132   MDRV_MACHINE_START(m72)
r1877r1878
21652166   MDRV_CPU_ADD_TAG("sound", Z80, SOUND_CLOCK)
21662167   MDRV_CPU_PROGRAM_MAP(sound_ram_map,0)
21672168   MDRV_CPU_IO_MAP(sound_portmap,0)
2168   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
2169   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
21692170                        /* IRQs are generated by main Z80 and YM2151 */
21702171
21712172   MDRV_MACHINE_START(m72)
r1877r1878
22062207   MDRV_CPU_ADD_TAG("sound", Z80, SOUND_CLOCK)
22072208   MDRV_CPU_PROGRAM_MAP(sound_rom_map,0)
22082209   MDRV_CPU_IO_MAP(rtype2_sound_portmap,0)
2209   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
2210   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
22102211                        /* IRQs are generated by main Z80 and YM2151 */
22112212
22122213   MDRV_MACHINE_START(m72)
r1877r1878
22462247   MDRV_CPU_ADD_TAG("sound", Z80, SOUND_CLOCK)
22472248   MDRV_CPU_PROGRAM_MAP(sound_rom_map,0)
22482249   MDRV_CPU_IO_MAP(rtype2_sound_portmap,0)
2249   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
2250   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
22502251                        /* IRQs are generated by main Z80 and YM2151 */
22512252
22522253   MDRV_MACHINE_START(m72)
r1877r1878
22862287   MDRV_CPU_ADD_TAG("sound", Z80, SOUND_CLOCK)
22872288   MDRV_CPU_PROGRAM_MAP(sound_rom_map,0)
22882289   MDRV_CPU_IO_MAP(rtype2_sound_portmap,0)
2289   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
2290   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
22902291                        /* IRQs are generated by main Z80 and YM2151 */
22912292
22922293   MDRV_MACHINE_START(m72)
r1877r1878
23272328   MDRV_CPU_ADD_TAG("sound", Z80, SOUND_CLOCK)
23282329   MDRV_CPU_PROGRAM_MAP(sound_rom_map,0)
23292330   MDRV_CPU_IO_MAP(rtype2_sound_portmap,0)
2330   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
2331   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
23312332                        /* IRQs are generated by main Z80 and YM2151 */
23322333
23332334   MDRV_MACHINE_START(m72)
r1877r1878
23682369   MDRV_CPU_ADD_TAG("sound", Z80, SOUND_CLOCK)
23692370   MDRV_CPU_PROGRAM_MAP(sound_rom_map,0)
23702371   MDRV_CPU_IO_MAP(poundfor_sound_portmap,0)
2371   MDRV_CPU_VBLANK_INT(fake_nmi,128)   /* clocked by V1? (Vigilante) */
2372   MDRV_CPU_VBLANK_INT_HACK(fake_nmi,128)   /* clocked by V1? (Vigilante) */
23722373                        /* IRQs are generated by main Z80 and YM2151 */
23732374
23742375   MDRV_MACHINE_START(m72)
r1877r1878
24082409   MDRV_CPU_ADD_TAG("sound", Z80, SOUND_CLOCK)
24092410   MDRV_CPU_PROGRAM_MAP(sound_rom_map,0)
24102411   MDRV_CPU_IO_MAP(rtype2_sound_portmap,0)
2411   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
2412   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
24122413                        /* IRQs are generated by main Z80 and YM2151 */
24132414
24142415   MDRV_MACHINE_START(m72)
src/mame/drivers/r2dtank.c
r1877r1878
9191
9292static READ8_HANDLER( audio_command_r )
9393{
94   UINT8 ret = soundlatch_r(0);
94   UINT8 ret = soundlatch_r(machine, 0);
9595
9696if (LOG_AUDIO_COMM) logerror("%08X  CPU#1  Audio Command Read: %x\n", safe_activecpu_get_pc(), ret);
9797
r1877r1878
101101
102102static WRITE8_HANDLER( audio_command_w )
103103{
104   soundlatch_w(0, ~data);
105   cpunum_set_input_line(Machine, 1, M6802_IRQ_LINE, HOLD_LINE);
104   soundlatch_w(machine, 0, ~data);
105   cpunum_set_input_line(machine, 1, M6802_IRQ_LINE, HOLD_LINE);
106106
107107if (LOG_AUDIO_COMM) logerror("%08X   CPU#0  Audio Command Write: %x\n", safe_activecpu_get_pc(), data^0xff);
108108}
r1877r1878
110110
111111static READ8_HANDLER( audio_answer_r )
112112{
113   UINT8 ret = soundlatch2_r(0);
113   UINT8 ret = soundlatch2_r(machine, 0);
114114if (LOG_AUDIO_COMM) logerror("%08X  CPU#0  Audio Answer Read: %x\n", safe_activecpu_get_pc(), ret);
115115
116116   return ret;
r1877r1878
123123   if (safe_activecpu_get_pc() == 0xfb12)
124124      data = 0x00;
125125
126   soundlatch2_w(0, data);
127   cpunum_set_input_line(Machine, 0, M6809_IRQ_LINE, HOLD_LINE);
126   soundlatch2_w(machine, 0, data);
127   cpunum_set_input_line(machine, 0, M6809_IRQ_LINE, HOLD_LINE);
128128
129129if (LOG_AUDIO_COMM) logerror("%08X  CPU#1  Audio Answer Write: %x\n", safe_activecpu_get_pc(), data);
130130}
r1877r1878
151151
152152   if (AY8910_selected & 0x08)
153153{
154      ret = AY8910_read_port_0_r(offset);
154      ret = AY8910_read_port_0_r(machine, offset);
155155if (LOG_AUDIO_COMM) logerror("%08X  CPU#1  AY8910 #0 Port Read: %x\n", safe_activecpu_get_pc(), ret);}
156156
157157   if (AY8910_selected & 0x10)
158158{
159      ret = AY8910_read_port_1_r(offset);
159      ret = AY8910_read_port_1_r(machine, offset);
160160if (LOG_AUDIO_COMM) logerror("%08X  CPU#1  AY8910 #1 Port Read: %x\n", safe_activecpu_get_pc(), ret);}
161161
162162   return ret;
r1877r1878
169169   {
170170      if (AY8910_selected & 0x08)
171171{if (LOG_AUDIO_COMM) logerror("%08X  CPU#1  AY8910 #0 Control Write: %x\n", safe_activecpu_get_pc(), data);
172         AY8910_control_port_0_w(offset, data);
172         AY8910_control_port_0_w(machine, offset, data);
173173}
174174      if (AY8910_selected & 0x10)
175175{if (LOG_AUDIO_COMM) logerror("%08X  CPU#1  AY8910 #1 Control Write: %x\n", safe_activecpu_get_pc(), data);
176         AY8910_control_port_1_w(offset, data);
176         AY8910_control_port_1_w(machine, offset, data);
177177}
178178   }
179179   else
180180   {
181181      if (AY8910_selected & 0x08)
182182{if (LOG_AUDIO_COMM) logerror("%08X  CPU#1  AY8910 #0 Port Write: %x\n", safe_activecpu_get_pc(), data);
183         AY8910_write_port_0_w(offset, data);
183         AY8910_write_port_0_w(machine, offset, data);
184184}
185185
186186      if (AY8910_selected & 0x10)
187187{if (LOG_AUDIO_COMM) logerror("%08X  CPU#1  AY8910 #1 Port Write: %x\n", safe_activecpu_get_pc(), data);
188         AY8910_write_port_1_w(offset, data);
188         AY8910_write_port_1_w(machine, offset, data);
189189}
190190   }
191191}
r1877r1878
220220
221221static void ttl74123_output_changed(int output)
222222{
223   pia_0_ca1_w(0, output);
223   pia_0_ca1_w(Machine, 0, output);
224224   ttl74123_output = output;
225225}
226226
r1877r1878
304304#define NUM_PENS   (8)
305305
306306
307static WRITE8_HANDLER( r2dtank_mc6845_address_w )
308{
309   mc6845_address_w(mc6845, data);
310}
311
312
313static WRITE8_HANDLER( r2dtank_mc6845_register_w )
314{
315   mc6845_register_w(mc6845, data);
316}
317
318
319307static WRITE8_HANDLER( flipscreen_w )
320308{
321309   flipscreen = !data;
322310}
323311
324312
325static void *begin_update(running_machine *machine, mc6845_t *mc6845, mame_bitmap *bitmap, const rectangle *cliprect)
313static MC6845_BEGIN_UPDATE( begin_update )
326314{
327315   /* create the pens */
328316   offs_t i;
r1877r1878
337325}
338326
339327
340static void update_row(running_machine *machine, mc6845_t *mc6845, mame_bitmap *bitmap, const rectangle *cliprect,
341                  UINT16 ma, UINT8 ra, UINT16 y, UINT8 x_count, INT8 cursor_x, void *param)
328static MC6845_UPDATE_ROW( update_row )
342329{
343330   UINT8 cx;
344331
r1877r1878
387374}
388375
389376
390static void display_enable_changed(running_machine *machine, mc6845_t *mc6845, int display_enabled)
377static MC6845_ON_DE_CHANGED( display_enable_changed )
391378{
392379   TTL74123_A_w(0, display_enabled);
393380}
r1877r1878
401388   begin_update,         /* before pixel update callback */
402389   update_row,            /* row update callback */
403390   0,                  /* after pixel update callback */
404   display_enable_changed   /* call back for display state changes */
391   display_enable_changed,   /* callback for display state changes */
392   NULL,               /* HSYNC callback */
393   NULL               /* VSYNC callback */
405394};
406395
407396
r1877r1878
428417
429418static WRITE8_HANDLER( pia_comp_0_w )
430419{
431   pia_0_w(offset, ~data);
420   pia_0_w(machine, offset, ~data);
432421}
433422
434423
r1877r1878
439428   AM_RANGE(0x6000, 0x7fff) AM_RAM
440429   AM_RANGE(0x8000, 0x8003) AM_READWRITE(pia_0_r, pia_comp_0_w)
441430   AM_RANGE(0x8004, 0x8004) AM_READWRITE(audio_answer_r, audio_command_w)
442   AM_RANGE(0xb000, 0xb000) AM_WRITE(r2dtank_mc6845_address_w)
443   AM_RANGE(0xb001, 0xb001) AM_WRITE(r2dtank_mc6845_register_w)
431   AM_RANGE(0xb000, 0xb000) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
432   AM_RANGE(0xb001, 0xb001) AM_DEVWRITE(MC6845, "crtc", mc6845_register_w)
444433   AM_RANGE(0xc000, 0xc007) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
445434   AM_RANGE(0xc800, 0xffff) AM_ROM
446435ADDRESS_MAP_END
src/mame/drivers/ohmygod.c
r1877r1878
332332   /* basic machine hardware */
333333   MDRV_CPU_ADD(M68000, 12000000)
334334   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
335   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
335   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
336336
337337   MDRV_MACHINE_RESET(ohmygod)
338338   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_SEC(3))   /* a guess, and certainly wrong */
src/mame/drivers/pokechmp.c
r1877r1878
9494
9595static WRITE8_HANDLER( pokechmp_sound_w )
9696{
97   soundlatch_w(0,data);
98   cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
97   soundlatch_w(machine,0,data);
98   cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
9999}
100100
101101
r1877r1878
249249   /* basic machine hardware */
250250   MDRV_CPU_ADD(M6502, 4000000)
251251   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
252   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
252   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
253253
254254   MDRV_CPU_ADD(M6502, 4000000)
255255   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
256   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
256   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
257257
258258   /* video hardware */
259259   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/snk68.c
r1877r1878
127127
128128static WRITE16_HANDLER( sound_w )
129129{
130   soundlatch_w(0,(data>>8)&0xff);
131   cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
130   soundlatch_w(machine,0,(data>>8)&0xff);
131   cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
132132}
133133
134134/*******************************************************************************/
r1877r1878
700700   /* basic machine hardware */
701701   MDRV_CPU_ADD(M68000, 10000000)   /* Accurate */
702702   MDRV_CPU_PROGRAM_MAP(searchar_readmem,searchar_writemem)
703   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
703   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
704704
705705   MDRV_CPU_ADD(Z80, 4000000)
706706   /* audio CPU */   /* Accurate */
r1877r1878
739739   /* basic machine hardware */
740740   MDRV_CPU_ADD(M68000, 10000000)   /* Accurate */
741741   MDRV_CPU_PROGRAM_MAP(pow_readmem,pow_writemem)
742   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
742   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
743743
744744   MDRV_CPU_ADD(Z80, 4000000)
745745   /* audio CPU */   /* Accurate */
r1877r1878
778778   /* basic machine hardware */
779779   MDRV_CPU_ADD(M68000, XTAL_18MHz/2) /* verified on pcb  */
780780   MDRV_CPU_PROGRAM_MAP(searchar_readmem,searchar_writemem)
781   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
781   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
782782
783783   MDRV_CPU_ADD(Z80, XTAL_8MHz/2) /* verified on pcb  */
784784   /* audio CPU */
r1877r1878
817817   /* basic machine hardware */
818818   MDRV_CPU_ADD(M68000, 10000000)   /* Accurate */
819819   MDRV_CPU_PROGRAM_MAP(pow_readmem,pow_writemem)
820   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
820   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
821821
822822   MDRV_CPU_ADD(Z80, 4000000)
823823   /* audio CPU */   /* Accurate */
src/mame/drivers/madalien.c
r1877r1878
99#include "driver.h"
1010#include "deprecat.h"
1111#include "sound/ay8910.h"
12#include "video/mc6845.h"
1213#include "madalien.h"
1314
1415
r1877r1878
1920static UINT8 *shift_lo;
2021
2122
22static INTERRUPT_GEN( madalien_interrupt )
23static INPUT_CHANGED( coin_inserted )
2324{
24   cpunum_set_input_line(machine, 0, INPUT_LINE_NMI,
25      (readinputportbytag("PLAYER2") & 0x80) ? CLEAR_LINE : ASSERT_LINE);
25   /* coin insertion causes an NMI */
26   cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE);
2627}
2728
2829
r1877r1878
5758
5859static WRITE8_HANDLER( madalien_sound_command_w )
5960{
60   cpunum_set_input_line(Machine, 1, 0, ASSERT_LINE);
61
62   soundlatch_w(offset, data);
61   cpunum_set_input_line(machine, 1, 0, ASSERT_LINE);
62   soundlatch_w(machine, offset, data);
6363}
6464
6565
6666static READ8_HANDLER(madalien_sound_command_r )
6767{
68   cpunum_set_input_line(Machine, 1, 0, CLEAR_LINE);
69
70   return soundlatch_r(offset);
68   cpunum_set_input_line(machine, 1, 0, CLEAR_LINE);
69   return soundlatch_r(machine, offset);
7170}
7271
7372
r1877r1878
8887   AM_RANGE(0x6400, 0x67ff) AM_RAM
8988   AM_RANGE(0x6800, 0x7fff) AM_RAM AM_BASE(&madalien_charram)
9089
91   AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x0ff0) AM_WRITE(madalien_mc6845_address_w)
92   AM_RANGE(0x8001, 0x8001) AM_MIRROR(0x0ff0) AM_READWRITE(madalien_mc6845_register_r, madalien_mc6845_register_w)
90   AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x0ff0) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
91   AM_RANGE(0x8001, 0x8001) AM_MIRROR(0x0ff0) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
9392   AM_RANGE(0x8004, 0x8004) AM_MIRROR(0x0ff0) AM_WRITE(MWA8_RAM) AM_BASE(&madalien_video_control)
9493   AM_RANGE(0x8005, 0x8005) AM_MIRROR(0x0ff0) AM_WRITE(madalien_output_w)
9594   AM_RANGE(0x8006, 0x8006) AM_MIRROR(0x0ff0) AM_READWRITE(soundlatch2_r, madalien_sound_command_w)
r1877r1878
109108ADDRESS_MAP_END
110109
111110
112static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
111static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 )
113112   AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x1c00) AM_RAM
114113   AM_RANGE(0x6000, 0x6003) AM_MIRROR(0x1ffc) AM_RAM /* unknown device in an epoxy block, might be tilt detection */
115114   AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x1ffc) AM_READ(madalien_sound_command_r)
r1877r1878
159158   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
160159   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
161160   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
162   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) /* or service coin */
161   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
163162INPUT_PORTS_END
164163
165164
r1877r1878
177176   /* main CPU */
178177   MDRV_CPU_ADD(M6502, MADALIEN_MAIN_CLOCK / 8)    /* 1324kHz */
179178   MDRV_CPU_PROGRAM_MAP(main_map, 0)
180   MDRV_CPU_VBLANK_INT(madalien_interrupt, 1)
181179
182180   /* audio CPU */
183181   MDRV_CPU_ADD(M6502, SOUND_CLOCK / 8)   /* 512kHz */
184   MDRV_CPU_PROGRAM_MAP(sound_map, 0)
182   MDRV_CPU_PROGRAM_MAP(audio_map, 0)
185183   MDRV_CPU_PERIODIC_INT(nmi_line_pulse, 800)    /* unknown due to incomplete schematics */
186184
187185   /* video hardware */
src/mame/drivers/igs_180.c
r1877r1878
129129   MDRV_CPU_ADD(Z180,16000000)   /* 16 MHz? */
130130   MDRV_CPU_PROGRAM_MAP(igs_180_map,0)
131131   MDRV_CPU_IO_MAP(igs_180_portmap,0)
132   MDRV_CPU_VBLANK_INT(igs_180_interrupt,2)
133   //MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
132   MDRV_CPU_VBLANK_INT_HACK(igs_180_interrupt,2)
133   //MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
134134
135135   /* video hardware */
136136   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/aeroboto.c
r1877r1878
229229   /* basic machine hardware */
230230   MDRV_CPU_ADD(M6809, XTAL_10MHz/8) /* verified on pcb */
231231   MDRV_CPU_PROGRAM_MAP(main_map,0)
232   MDRV_CPU_VBLANK_INT(aeroboto_interrupt,1)
232   MDRV_CPU_VBLANK_INT("main", aeroboto_interrupt)
233233
234234   MDRV_CPU_ADD(M6809, XTAL_10MHz/16) /* verified on pcb */
235235   MDRV_CPU_PROGRAM_MAP(sound_map,0)
236   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
236   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
237237
238238   /* video hardware */
239239   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/konamigv.c
r1877r1878
349349   /* basic machine hardware */
350350   MDRV_CPU_ADD( PSXCPU, XTAL_67_7376MHz )
351351   MDRV_CPU_PROGRAM_MAP( konamigv_map, 0 )
352   MDRV_CPU_VBLANK_INT( psx_vblank, 1 )
352   MDRV_CPU_VBLANK_INT("main", psx_vblank)
353353
354354   MDRV_MACHINE_RESET( konamigv )
355355   MDRV_NVRAM_HANDLER(konamigv_93C46)
src/mame/drivers/firetrap.c
r1877r1878
199199
200200static WRITE8_HANDLER( firetrap_sound_command_w )
201201{
202   soundlatch_w(offset,data);
203   cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
202   soundlatch_w(machine,offset,data);
203   cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
204204}
205205
206206static WRITE8_HANDLER( firetrap_sound_2400_w )
r1877r1878
576576   /* basic machine hardware */
577577   MDRV_CPU_ADD(Z80, 6000000)   /* 6 MHz */
578578   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
579   MDRV_CPU_VBLANK_INT(firetrap,2)
579   MDRV_CPU_VBLANK_INT_HACK(firetrap,2)
580580
581581   MDRV_CPU_ADD(M6502,3072000/2)
582582   /* audio CPU */   /* 1.536 MHz? */
r1877r1878
616616   /* basic machine hardware */
617617   MDRV_CPU_ADD(Z80, 6000000)   /* 6 MHz */
618618   MDRV_CPU_PROGRAM_MAP(readmem_bootleg,writemem_bootleg)
619   MDRV_CPU_VBLANK_INT(bootleg,1)
619   MDRV_CPU_VBLANK_INT("main", bootleg)
620620
621621   MDRV_CPU_ADD(M6502,3072000/2)
622622   /* audio CPU */   /* 1.536 MHz? */
src/mame/drivers/crgolf.c
r1877r1878
364364   /* basic machine hardware */
365365   MDRV_CPU_ADD(Z80,MASTER_CLOCK/3/2)
366366   MDRV_CPU_PROGRAM_MAP(main_map,0)
367   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
367   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
368368
369369   MDRV_CPU_ADD(Z80,MASTER_CLOCK/3/2)
370370   MDRV_CPU_PROGRAM_MAP(sound_map,0)
371   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
371   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
372372
373373   MDRV_MACHINE_START(crgolf)
374374   MDRV_INTERLEAVE(100)
src/mame/drivers/mastboy.c
r1877r1878
862862   MDRV_CPU_ADD_TAG("main", Z180, 12000000/2)   /* HD647180X0CP6-1M1R */
863863   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
864864   MDRV_CPU_IO_MAP(port_readmem,0)
865   MDRV_CPU_VBLANK_INT(mastboy_interrupt,1)
865   MDRV_CPU_VBLANK_INT("main", mastboy_interrupt)
866866
867867   MDRV_NVRAM_HANDLER(generic_1fill)
868868
src/mame/drivers/thedeep.c
r1877r1878
4444
4545static WRITE8_HANDLER( thedeep_sound_w )
4646{
47   soundlatch_w(0,data);
48   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
47   soundlatch_w(machine,0,data);
48   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
4949}
5050
5151static UINT8 protection_command, protection_data;
r1877r1878
365365   /* basic machine hardware */
366366   MDRV_CPU_ADD(Z80, 6000000)      /* 6MHz */
367367   MDRV_CPU_PROGRAM_MAP(thedeep_readmem,thedeep_writemem)
368   MDRV_CPU_VBLANK_INT(thedeep_interrupt,2)   /* IRQ by MCU, NMI by vblank (maskable) */
368   MDRV_CPU_VBLANK_INT_HACK(thedeep_interrupt,2)   /* IRQ by MCU, NMI by vblank (maskable) */
369369
370370    MDRV_CPU_ADD(M65C02, 2000000)   /* 2MHz */
371371   MDRV_CPU_PROGRAM_MAP(thedeep_sound_readmem,thedeep_sound_writemem)
src/mame/drivers/oneshot.c
r1877r1878
372372   /* basic machine hardware */
373373   MDRV_CPU_ADD(M68000, 12000000)
374374   MDRV_CPU_PROGRAM_MAP(oneshot_readmem,oneshot_writemem)
375   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
375   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
376376
377377   MDRV_CPU_ADD(Z80, 5000000)
378378   MDRV_CPU_PROGRAM_MAP(snd_readmem, snd_writemem)
src/mame/drivers/stlforce.c
r1877r1878
242242   /* basic machine hardware */
243243   MDRV_CPU_ADD_TAG("cpu", M68000, 15000000)
244244   MDRV_CPU_PROGRAM_MAP(stlforce_map,0)
245   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
245   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
246246
247247   MDRV_NVRAM_HANDLER(stlforce)
248248
src/mame/drivers/rmhaihai.c
r1877r1878
163163
164164static MACHINE_RESET( themj )
165165{
166   themj_rombank_w(0,0);
166   themj_rombank_w(machine,0,0);
167167}
168168
169169
r1877r1878
514514   MDRV_CPU_ADD_TAG("main",Z80,20000000/4)   /* 5 MHz ??? */
515515   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
516516   MDRV_CPU_IO_MAP(readport,writeport)
517   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
517   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
518518
519519   /* video hardware */
520520   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/topspeed.c
r1877r1878
330330
331331static READ16_HANDLER( topspeed_input_bypass_r )
332332{
333   UINT8 port = TC0220IOC_port_r(0);   /* read port number */
333   UINT8 port = TC0220IOC_port_r(machine,0);   /* read port number */
334334   int steer = 0;
335335   int analogue_steer = readinputportbytag_safe(STEER_PORT_TAG,0x00);
336336   int fake = readinputportbytag_safe(FAKE_PORT_TAG,0x00);
r1877r1878
367367         return steer >> 8;
368368
369369      default:
370         return TC0220IOC_portreg_r(offset);
370         return TC0220IOC_portreg_r(machine,offset);
371371   }
372372}
373373
r1877r1878
695695   /* basic machine hardware */
696696   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz ??? */
697697   MDRV_CPU_PROGRAM_MAP(topspeed_readmem,topspeed_writemem)
698   MDRV_CPU_VBLANK_INT(topspeed_interrupt,1)
698   MDRV_CPU_VBLANK_INT("main", topspeed_interrupt)
699699
700700   MDRV_CPU_ADD(Z80,16000000/4)
701701   /* audio CPU */   /* 4 MHz ??? */
r1877r1878
703703
704704   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz ??? */
705705   MDRV_CPU_PROGRAM_MAP(topspeed_cpub_readmem,topspeed_cpub_writemem)
706   MDRV_CPU_VBLANK_INT(topspeed_cpub_interrupt,1)
706   MDRV_CPU_VBLANK_INT("main", topspeed_cpub_interrupt)
707707
708708   MDRV_MACHINE_START(topspeed)
709709
src/mame/drivers/zr107.c
r1877r1878
7070// defined in drivers/nwk-tr.c
7171int K001604_vh_start(running_machine *machine, int chip);
7272void K001604_tile_update(running_machine *machine, int chip);
73void K001604_draw_front_layer(int chip, mame_bitmap *bitmap, const rectangle *cliprect);
74void K001604_draw_back_layer(int chip, mame_bitmap *bitmap, const rectangle *cliprect);
73void K001604_draw_front_layer(int chip, bitmap_t *bitmap, const rectangle *cliprect);
74void K001604_draw_back_layer(int chip, bitmap_t *bitmap, const rectangle *cliprect);
7575READ32_HANDLER(K001604_tile_r);
7676READ32_HANDLER(K001604_char_r);
7777WRITE32_HANDLER(K001604_tile_w);
r1877r1878
358358   UINT16 ret = 0;
359359
360360   if (ACCESSING_LSB16)
361      ret |= K054539_1_r(offset);
361      ret |= K054539_1_r(machine, offset);
362362   if (ACCESSING_MSB16)
363      ret |= K054539_0_r(offset)<<8;
363      ret |= K054539_0_r(machine, offset)<<8;
364364
365365   return ret;
366366}
r1877r1878
368368static WRITE16_HANDLER( dual539_w )
369369{
370370   if (ACCESSING_LSB16)
371      K054539_1_w(offset, data);
371      K054539_1_w(machine, offset, data);
372372   if (ACCESSING_MSB16)
373      K054539_0_w(offset, data>>8);
373      K054539_0_w(machine, offset, data>>8);
374374}
375375
376376static ADDRESS_MAP_START( sound_memmap, ADDRESS_SPACE_PROGRAM, 16 )
r1877r1878
573573   MDRV_CPU_ADD(PPC403, 64000000/2)   /* PowerPC 403GA 32MHz */
574574   MDRV_CPU_CONFIG(zr107_ppc_cfg)
575575   MDRV_CPU_PROGRAM_MAP(zr107_map, 0)
576   MDRV_CPU_VBLANK_INT(zr107_vblank, 1)
576   MDRV_CPU_VBLANK_INT("main", zr107_vblank)
577577
578578   MDRV_CPU_ADD(M68000, 64000000/8)   /* 8MHz */
579579   MDRV_CPU_PROGRAM_MAP(sound_memmap, 0)
r1877r1878
618618   MDRV_CPU_ADD(PPC403, 64000000/2)   /* PowerPC 403GA 32MHz */
619619   MDRV_CPU_CONFIG(zr107_ppc_cfg)
620620   MDRV_CPU_PROGRAM_MAP(jetwave_map, 0)
621   MDRV_CPU_VBLANK_INT(zr107_vblank, 1)
621   MDRV_CPU_VBLANK_INT("main", zr107_vblank)
622622
623623   MDRV_CPU_ADD(M68000, 64000000/8)   /* 8MHz */
624624   MDRV_CPU_PROGRAM_MAP(sound_memmap, 0)
src/mame/drivers/amspdwy.c
r1877r1878
6363
6464static READ8_HANDLER( amspdwy_sound_r )
6565{
66   return (YM2151_status_port_0_r(0) & ~ 0x30) | readinputport(4);
66   return (YM2151_status_port_0_r(machine,0) & ~ 0x30) | readinputport(4);
6767}
6868
6969static WRITE8_HANDLER( amspdwy_sound_w )
7070{
71   soundlatch_w(0,data);
72   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
71   soundlatch_w(machine,0,data);
72   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
7373}
7474
7575static ADDRESS_MAP_START( amspdwy_map, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
257257   MDRV_CPU_ADD(Z80,3000000)
258258   MDRV_CPU_PROGRAM_MAP(amspdwy_map,0)
259259   MDRV_CPU_IO_MAP(amspdwy_portmap,0)
260   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   /* IRQ: 60Hz, NMI: retn */
260   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   /* IRQ: 60Hz, NMI: retn */
261261
262262   MDRV_CPU_ADD(Z80,3000000)   /* Can't be disabled: the YM2151 timers must work */
263263   MDRV_CPU_PROGRAM_MAP(amspdwy_sound_map,0)
src/mame/drivers/segae.c
r1877r1878
627627   UINT8* vram;
628628   UINT8* cram;
629629   UINT8  writemode;
630   mame_bitmap* r_bitmap;
630   bitmap_t* r_bitmap;
631631   UINT8* tile_renderline;
632632   UINT8* sprite_renderline;
633633
r1877r1878
988988
989989WRITE8_HANDLER( sms_sn76496_w )
990990{
991   SN76496_0_w(0, data & 0xff);
991   SN76496_0_w(machine, 0, data & 0xff);
992992}
993993
994994static void draw_tile_line(int drawxpos, int tileline, UINT16 tiledata, UINT8* linebuf, struct sms_vdp* chip)
r1877r1878
21532153
21542154static WRITE8_HANDLER( sms_sn76496_2_w )
21552155{
2156   SN76496_1_w(0, data & 0xff);
2156   SN76496_1_w(machine, 0, data & 0xff);
21572157}
21582158
21592159static void init_ports_systeme(void)
src/mame/drivers/fantland.c
r1877r1878
7171static WRITE16_HANDLER( fantland_nmi_enable_16_w )
7272{
7373   if (ACCESSING_LSB)
74      fantland_nmi_enable_w(offset*2,data);
74      fantland_nmi_enable_w(machine,offset*2,data);
7575}
7676
7777static WRITE8_HANDLER( fantland_soundlatch_w )
7878{
79   soundlatch_w(0,data);
80   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
79   soundlatch_w(machine,0,data);
80   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
8181}
8282
8383static WRITE16_HANDLER( fantland_soundlatch_16_w )
8484{
8585   if (ACCESSING_LSB)
86      fantland_soundlatch_w(offset*2, data);
86      fantland_soundlatch_w(machine, offset*2, data);
8787}
8888
8989/***************************************************************************
r1877r1878
190190
191191   x = readinputport(13 + offset * 2);
192192   y = readinputport(12 + offset * 2);
193   f = cpu_getcurrentframe();
193   f = video_screen_get_frame_number(0);
194194
195195   ret[offset]   =   (ret[offset] & 0x14) | (readinputport(2 + offset) & 0xc3);
196196
r1877r1878
811811   /* basic machine hardware */
812812   MDRV_CPU_ADD(I8086, 8000000)        // ?
813813   MDRV_CPU_PROGRAM_MAP(fantland_map, 0)
814   MDRV_CPU_VBLANK_INT(fantland_irq,1)
814   MDRV_CPU_VBLANK_INT("main", fantland_irq)
815815
816816   /* audio CPU */
817817   MDRV_CPU_ADD(I8088, 8000000)        // ?
r1877r1878
863863   /* basic machine hardware */
864864   MDRV_CPU_ADD(I8088, 8000000)        // ?
865865   MDRV_CPU_PROGRAM_MAP(galaxygn_map, 0)
866   MDRV_CPU_VBLANK_INT(fantland_irq,1)
866   MDRV_CPU_VBLANK_INT("main", fantland_irq)
867867
868868   /* audio CPU */
869869   MDRV_CPU_ADD(I8088, 8000000)        // ?
r1877r1878
917917   /* basic machine hardware */
918918   MDRV_CPU_ADD(V20, 16000000/2)        // D701080C-8 - NEC D70108C-8 V20 CPU, running at 8.000MHz [16/2]
919919   MDRV_CPU_PROGRAM_MAP(borntofi_map, 0)
920   MDRV_CPU_VBLANK_INT(fantland_irq,1)
920   MDRV_CPU_VBLANK_INT("main", fantland_irq)
921921
922922   /* audio CPU */
923923   MDRV_CPU_ADD(I8088, 18432000/3)        // 8088 - AMD P8088-2 CPU, running at 6.144MHz [18.432/3]
r1877r1878
963963   /* basic machine hardware */
964964   MDRV_CPU_ADD(V20, XTAL_18MHz/2)      // D701080C-8 (V20)
965965   MDRV_CPU_PROGRAM_MAP(wheelrun_map, 0)
966   MDRV_CPU_VBLANK_INT(fantland_irq,1)
966   MDRV_CPU_VBLANK_INT("main", fantland_irq)
967967
968968   /* audio CPU */
969969   MDRV_CPU_ADD(Z80, XTAL_18MHz/2)      // Z8400BB1 (Z80B)
src/mame/drivers/dominob.c
r1877r1878
4040
4141static UINT8 *bgram;
4242
43static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
43static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
4444{
4545   int offs;
4646
r1877r1878
124124
125125static READ8_HANDLER( dominob_input_2_r )
126126{
127   return input_port_2_r(offset);
127   return input_port_2_r(machine, offset);
128128}
129129
130130
r1877r1878
254254   MDRV_CPU_ADD(Z80,8000000/2)
255255   MDRV_CPU_PROGRAM_MAP(memmap, 0)
256256   MDRV_CPU_IO_MAP(portmap,0)
257   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
257   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
258258
259259   /* video hardware */
260260   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/ksys573.c
r1877r1878
17821782   }
17831783}
17841784
1785static void gx700pwfbf_init( void (*output_callback)( int offset, int data ) )
1785static void gx700pwfbf_init( void (*output_callback_func)( int offset, int data ) )
17861786{
17871787   memset( gx700pwbf_output_data, 0, sizeof( gx700pwbf_output_data ) );
17881788
1789   gx700pwfbf_output_callback = output_callback;
1789   gx700pwfbf_output_callback = output_callback_func;
17901790
17911791   memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1f640000, 0x1f6400ff, 0, 0, gx700pwbf_io_r );
17921792   memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1f640000, 0x1f6400ff, 0, 0, gx700pwbf_io_w );
r1877r1878
23172317   }
23182318}
23192319
2320static void gx894pwbba_init( void (*output_callback)( int offset, int data ) )
2320static void gx894pwbba_init( void (*output_callback_func)( int offset, int data ) )
23212321{
23222322   int gx894_ram_size = 24 * 1024 * 1024;
23232323
2324   gx894pwbba_output_callback = output_callback;
2324   gx894pwbba_output_callback = output_callback_func;
23252325
23262326   memory_install_read32_handler ( 0, ADDRESS_SPACE_PROGRAM, 0x1f640000, 0x1f6400ff, 0, 0, gx894pwbba_r );
23272327   memory_install_write32_handler( 0, ADDRESS_SPACE_PROGRAM, 0x1f640000, 0x1f6400ff, 0, 0, gx894pwbba_w );
r1877r1878
27272727   /* basic machine hardware */
27282728   MDRV_CPU_ADD( PSXCPU, XTAL_67_7376MHz )
27292729   MDRV_CPU_PROGRAM_MAP( konami573_map, 0 )
2730   MDRV_CPU_VBLANK_INT( sys573_vblank, 1 )
2730   MDRV_CPU_VBLANK_INT("main", sys573_vblank)
27312731
27322732   MDRV_MACHINE_RESET( konami573 )
27332733   MDRV_NVRAM_HANDLER( konami573 )
src/mame/drivers/atarig1.c
r1877r1878
424424   /* basic machine hardware */
425425   MDRV_CPU_ADD(M68000, ATARI_CLOCK_14MHz)
426426   MDRV_CPU_PROGRAM_MAP(main_map,0)
427   MDRV_CPU_VBLANK_INT(atarigen_video_int_gen,1)
427   MDRV_CPU_VBLANK_INT("main", atarigen_video_int_gen)
428428
429429   MDRV_MACHINE_START(atarig1)
430430   MDRV_MACHINE_RESET(atarig1)
src/mame/drivers/bladestl.c
r1877r1878
8989
9090static WRITE8_HANDLER( bladestl_sh_irqtrigger_w )
9191{
92   soundlatch_w(offset, data);
93   cpunum_set_input_line(Machine, 1, M6809_IRQ_LINE, HOLD_LINE);
92   soundlatch_w(machine, offset, data);
93   cpunum_set_input_line(machine, 1, M6809_IRQ_LINE, HOLD_LINE);
9494   //logerror("(sound) write %02x\n", data);
9595}
9696
r1877r1878
434434   /* basic machine hardware */
435435   MDRV_CPU_ADD(HD6309, 24000000/2)      /* 24MHz/2 (?) */
436436   MDRV_CPU_PROGRAM_MAP(bladestl_readmem,bladestl_writemem)
437   MDRV_CPU_VBLANK_INT(bladestl_interrupt,2) /* (1 IRQ + 1 NMI) */
437   MDRV_CPU_VBLANK_INT_HACK(bladestl_interrupt,2) /* (1 IRQ + 1 NMI) */
438438
439439   MDRV_CPU_ADD(M6809, 2000000)
440440   /* audio CPU */      /* ? */
src/mame/drivers/srumbler.c
r1877r1878
5353static MACHINE_RESET( srumbler )
5454{
5555   /* initialize banked ROM pointers */
56   srumbler_bankswitch_w(0,0);
56   srumbler_bankswitch_w(machine,0,0);
5757}
5858
5959static INTERRUPT_GEN( srumbler_interrupt )
r1877r1878
258258   /* basic machine hardware */
259259   MDRV_CPU_ADD(M6809, 1500000)        /* 1.5 MHz (?) */
260260   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
261   MDRV_CPU_VBLANK_INT(srumbler_interrupt,2)
261   MDRV_CPU_VBLANK_INT_HACK(srumbler_interrupt,2)
262262
263263   MDRV_CPU_ADD(Z80, 3000000)
264264   /* audio CPU */        /* 3 MHz ??? */
265265   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
266   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)
266   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)
267267
268268   MDRV_MACHINE_RESET(srumbler)
269269
src/mame/drivers/legionna.c
r1877r1878
543543      /* Non-protection reads */
544544
545545      case (0x708/2):   /* seibu sound: these three around $b10 on */
546         return seibu_main_word_r(2,0);
546         return seibu_main_word_r(machine,2,0);
547547
548548      case (0x70c/2):
549         return seibu_main_word_r(3,0);
549         return seibu_main_word_r(machine,3,0);
550550
551551      case (0x714/2):
552         return seibu_main_word_r(5,0);
552         return seibu_main_word_r(machine,5,0);
553553
554554      /* Inputs */
555555
556556      case (0x740/2):   /* code at $b00 sticks waiting for bit 6 hi */
557         return input_port_1_word_r(0,0);
557         return input_port_1_word_r(machine,0,0);
558558
559559      case (0x744/2):
560         return input_port_2_word_r(0,0);
560         return input_port_2_word_r(machine,0,0);
561561
562562      case (0x748/2):   /* code at $f4a reads this 4 times in _weird_ fashion */
563         return input_port_0_word_r(0,0);
563         return input_port_0_word_r(machine,0,0);
564564
565565      case (0x74c/2):
566         return input_port_3_word_r(0,0);
566         return input_port_3_word_r(machine,0,0);
567567
568568   }
569569//logerror("CPU0 PC %06x unknown MCU read offset: %04x\n",activecpu_get_previouspc(),offset);
r1877r1878
699699      }
700700      case (0x700/2):   /* seibu(0) */
701701      {
702         seibu_main_word_w(0,mcu_ram[offset],0xff00);
702         seibu_main_word_w(machine,0,mcu_ram[offset],0xff00);
703703         break;
704704      }
705705      case (0x704/2):   /* seibu(1) */
706706      {
707         seibu_main_word_w(1,mcu_ram[offset],0xff00);
707         seibu_main_word_w(machine,1,mcu_ram[offset],0xff00);
708708         break;
709709      }
710710      case (0x710/2):   /* seibu(4) */
711711      {
712         seibu_main_word_w(4,mcu_ram[offset],0xff00);
712         seibu_main_word_w(machine,4,mcu_ram[offset],0xff00);
713713         break;
714714      }
715715      case (0x718/2):   /* seibu(6) */
716716      {
717         seibu_main_word_w(6,mcu_ram[offset],0xff00);
717         seibu_main_word_w(machine,6,mcu_ram[offset],0xff00);
718718         break;
719719      }
720720//      default:
r1877r1878
11291129      /* Non-protection reads */
11301130
11311131      case (0x7c8/2):   /* seibu sound */
1132         return seibu_main_word_r(2,0);
1132         return seibu_main_word_r(machine,2,0);
11331133
11341134      case (0x7cc/2):
1135         return seibu_main_word_r(3,0);
1135         return seibu_main_word_r(machine,3,0);
11361136
11371137      case (0x7d4/2):
1138         return seibu_main_word_r(5,0);
1138         return seibu_main_word_r(machine,5,0);
11391139
11401140      /* Inputs */
11411141
11421142      case (0x740/2):
1143         return input_port_1_word_r(0,0);
1143         return input_port_1_word_r(machine,0,0);
11441144
11451145      case (0x744/2):
1146         return input_port_2_word_r(0,0);
1146         return input_port_2_word_r(machine,0,0);
11471147
11481148      case (0x748/2):
1149         return input_port_4_word_r(0,0);
1149         return input_port_4_word_r(machine,0,0);
11501150
11511151      case (0x74c/2):
1152         return input_port_3_word_r(0,0);
1152         return input_port_3_word_r(machine,0,0);
11531153
11541154   }
11551155//logerror("CPU0 PC %06x unknown MCU read offset: %04x\n",activecpu_get_previouspc(),offset);
r1877r1878
13591359      }
13601360      case (0x7c0/2):   /* seibu(0) */
13611361      {
1362         seibu_main_word_w(0,mcu_ram[offset],0xff00);
1362         seibu_main_word_w(machine,0,mcu_ram[offset],0xff00);
13631363         break;
13641364      }
13651365      case (0x7c4/2):   /* seibu(1) */
13661366      {
1367         seibu_main_word_w(1,mcu_ram[offset],0xff00);
1367         seibu_main_word_w(machine,1,mcu_ram[offset],0xff00);
13681368         break;
13691369      }
13701370      case (0x7d0/2):   /* seibu(4) */
13711371      {
1372         seibu_main_word_w(4,mcu_ram[offset],0xff00);
1372         seibu_main_word_w(machine,4,mcu_ram[offset],0xff00);
13731373         break;
13741374      }
13751375      case (0x7d8/2):   /* seibu(6) */
13761376      {
1377         seibu_main_word_w(6,mcu_ram[offset],0xff00);
1377         seibu_main_word_w(machine,6,mcu_ram[offset],0xff00);
13781378         break;
13791379      }
13801380      default:
r1877r1878
14431443
14441444      /* Non-protection reads */
14451445      case (0x708/2):   /* seibu sound */
1446         return seibu_main_word_r(2,0);
1446         return seibu_main_word_r(machine,2,0);
14471447
14481448      case (0x70c/2):
1449         return seibu_main_word_r(3,0);
1449         return seibu_main_word_r(machine,3,0);
14501450
14511451      case (0x714/2):
1452         return seibu_main_word_r(5,0);
1452         return seibu_main_word_r(machine,5,0);
14531453
14541454      /* Inputs */
14551455
14561456      case (0x740/2):
1457         return input_port_1_word_r(0,0);
1457         return input_port_1_word_r(machine,0,0);
14581458
14591459      case (0x744/2):
1460         return input_port_2_word_r(0,0);
1460         return input_port_2_word_r(machine,0,0);
14611461
14621462      case (0x748/2):
1463         return input_port_4_word_r(0,0);
1463         return input_port_4_word_r(machine,0,0);
14641464
14651465      case (0x74c/2):
1466         return input_port_3_word_r(0,0);
1466         return input_port_3_word_r(machine,0,0);
14671467
14681468      case (0x75c/2):
1469         return input_port_5_word_r(0,0);
1469         return input_port_5_word_r(machine,0,0);
14701470   }
14711471//  return mame_rand(Machine);
14721472     if(offset > (0x500/2) && offset < (0x600/2))
r1877r1878
18221822
18231823      case (0x700/2):   /* seibu(0) */
18241824      {
1825         seibu_main_word_w(0,mcu_ram[offset],0xff00);
1825         seibu_main_word_w(machine,0,mcu_ram[offset],0xff00);
18261826         break;
18271827      }
18281828      case (0x704/2):   /* seibu(1) */
18291829      {
1830         seibu_main_word_w(1,mcu_ram[offset],0xff00);
1830         seibu_main_word_w(machine,1,mcu_ram[offset],0xff00);
18311831         break;
18321832      }
18331833      case (0x710/2):   /* seibu(4) */
18341834      {
1835         seibu_main_word_w(4,mcu_ram[offset],0xff00);
1835         seibu_main_word_w(machine,4,mcu_ram[offset],0xff00);
18361836         break;
18371837      }
18381838      case (0x718/2):   /* seibu(6) */
18391839      {
1840         seibu_main_word_w(6,mcu_ram[offset],0xff00);
1840         seibu_main_word_w(machine,6,mcu_ram[offset],0xff00);
18411841         break;
18421842      }
18431843
r1877r1878
18851885      /* Non-protection reads */
18861886
18871887      case (0x708/2):   /* seibu sound */
1888         return seibu_main_word_r(2,0);
1888         return seibu_main_word_r(machine,2,0);
18891889
18901890      case (0x70c/2):
1891         return seibu_main_word_r(3,0);
1891         return seibu_main_word_r(machine,3,0);
18921892
18931893      case (0x714/2):
1894         return seibu_main_word_r(5,0);
1894         return seibu_main_word_r(machine,5,0);
18951895
18961896      /* Inputs */
18971897
18981898      case (0x740/2):
1899         return input_port_1_word_r(0,0);
1899         return input_port_1_word_r(machine,0,0);
19001900
19011901      case (0x744/2):
1902         return input_port_2_word_r(0,0);
1902         return input_port_2_word_r(machine,0,0);
19031903
19041904      case (0x748/2):
1905         return input_port_4_word_r(0,0);
1905         return input_port_4_word_r(machine,0,0);
19061906
19071907      case (0x74c/2):
1908         return input_port_3_word_r(0,0);
1908         return input_port_3_word_r(machine,0,0);
19091909
19101910   }
19111911//logerror("CPU0 PC %06x unknown MCU read offset: %04x\n",activecpu_get_previouspc(),offset);
r1877r1878
19671967      }
19681968      case (0x700/2):   /* seibu(0) */
19691969      {
1970         seibu_main_word_w(0,mcu_ram[offset],0xff00);
1970         seibu_main_word_w(machine,0,mcu_ram[offset],0xff00);
19711971         break;
19721972      }
19731973      case (0x704/2):   /* seibu(1) */
19741974      {
1975         seibu_main_word_w(1,mcu_ram[offset],0xff00);
1975         seibu_main_word_w(machine,1,mcu_ram[offset],0xff00);
19761976         break;
19771977      }
19781978      case (0x710/2):   /* seibu(4) */
19791979      {
1980         seibu_main_word_w(4,mcu_ram[offset],0xff00);
1980         seibu_main_word_w(machine,4,mcu_ram[offset],0xff00);
19811981         break;
19821982      }
19831983      case (0x718/2):   /* seibu(6) */
19841984      {
1985         seibu_main_word_w(6,mcu_ram[offset],0xff00);
1985         seibu_main_word_w(machine,6,mcu_ram[offset],0xff00);
19861986         break;
19871987      }
19881988       //  default:
r1877r1878
20292029      /* Non-protection reads */
20302030
20312031      case (0x7c8/2):   /* seibu sound */
2032         return seibu_main_word_r(2,0);
2032         return seibu_main_word_r(machine,2,0);
20332033
20342034      case (0x7cc/2):
2035         return seibu_main_word_r(3,0);
2035         return seibu_main_word_r(machine,3,0);
20362036
20372037      case (0x7d4/2):
2038         return seibu_main_word_r(5,0);
2038         return seibu_main_word_r(machine,5,0);
20392039
20402040      /* Inputs */
20412041
20422042      case (0x740/2):
2043         return input_port_1_word_r(0,0);
2043         return input_port_1_word_r(machine,0,0);
20442044
20452045      case (0x744/2):
2046         return input_port_2_word_r(0,0);
2046         return input_port_2_word_r(machine,0,0);
20472047
20482048      case (0x748/2):
2049         return input_port_4_word_r(0,0);
2049         return input_port_4_word_r(machine,0,0);
20502050
20512051      case (0x74c/2):
2052         return input_port_3_word_r(0,0);
2052         return input_port_3_word_r(machine,0,0);
20532053
20542054   }
20552055//  if(offset >= (0x400/2) && offset < (0x600/2) && offset != (0x5a4/2))
r1877r1878
21292129
21302130      case (0x7c0/2):   /* seibu(0) */
21312131      {
2132         seibu_main_word_w(0,mcu_ram[offset],0xff00);
2132         seibu_main_word_w(machine,0,mcu_ram[offset],0xff00);
21332133         break;
21342134      }
21352135      case (0x7c4/2):   /* seibu(1) */
21362136      {
2137         seibu_main_word_w(1,mcu_ram[offset],0xff00);
2137         seibu_main_word_w(machine,1,mcu_ram[offset],0xff00);
21382138         break;
21392139      }
21402140      case (0x7d0/2):   /* seibu(4) */
21412141      {
2142         seibu_main_word_w(4,mcu_ram[offset],0xff00);
2142         seibu_main_word_w(machine,4,mcu_ram[offset],0xff00);
21432143         break;
21442144      }
21452145      case (0x7d8/2):   /* seibu(6) */
21462146      {
2147         seibu_main_word_w(6,mcu_ram[offset],0xff00);
2147         seibu_main_word_w(machine,6,mcu_ram[offset],0xff00);
21482148         break;
21492149      }
21502150//      default:
r1877r1878
21622162      //  return mcu_ram[offset];
21632163
21642164      case (0x700/2):
2165         return input_port_1_word_r(0,0);
2165         return input_port_1_word_r(machine,0,0);
21662166
21672167      case (0x704/2):
2168         return input_port_2_word_r(0,0);
2168         return input_port_2_word_r(machine,0,0);
21692169
21702170      case (0x708/2):
2171         return input_port_4_word_r(0,0);
2171         return input_port_4_word_r(machine,0,0);
21722172
21732173      case (0x70c/2):
2174         return input_port_3_word_r(0,0);
2174         return input_port_3_word_r(machine,0,0);
21752175
21762176      case (0x71c/2):
2177         return input_port_5_word_r(0,0);
2177         return input_port_5_word_r(machine,0,0);
21782178
21792179      case (0x748/2):   /* seibu sound */
2180         return seibu_main_word_r(2,0);
2180         return seibu_main_word_r(machine,2,0);
21812181      case (0x74c/2):
2182         return seibu_main_word_r(3,0);
2182         return seibu_main_word_r(machine,3,0);
21832183      case (0x754/2):
2184         return seibu_main_word_r(5,0);
2184         return seibu_main_word_r(machine,5,0);
21852185
21862186   }
21872187
r1877r1878
23862386
23872387      case (0x740/2):   /* seibu(0) */
23882388      {
2389         seibu_main_word_w(0,mcu_ram[offset],0xff00);
2389         seibu_main_word_w(machine,0,mcu_ram[offset],0xff00);
23902390         break;
23912391      }
23922392      case (0x744/2):   /* seibu(1) */
23932393      {
2394         seibu_main_word_w(1,mcu_ram[offset],0xff00);
2394         seibu_main_word_w(machine,1,mcu_ram[offset],0xff00);
23952395         break;
23962396      }
23972397      case (0x750/2):   /* seibu(4) */
23982398      {
2399         seibu_main_word_w(4,mcu_ram[offset],0xff00);
2399         seibu_main_word_w(machine,4,mcu_ram[offset],0xff00);
24002400         break;
24012401      }
24022402      case (0x758/2):   /* seibu(6) */
24032403      {
2404         seibu_main_word_w(6,mcu_ram[offset],0xff00);
2404         seibu_main_word_w(machine,6,mcu_ram[offset],0xff00);
24052405         break;
24062406      }
24072407   }
r1877r1878
24182418      //  return mcu_ram[offset];
24192419
24202420      case (0x700/2):
2421         return input_port_1_word_r(0,0);
2421         return input_port_1_word_r(machine,0,0);
24222422
24232423      case (0x704/2):
2424         return input_port_2_word_r(0,0);
2424         return input_port_2_word_r(machine,0,0);
24252425
24262426      case (0x708/2):
2427         return input_port_4_word_r(0,0);
2427         return input_port_4_word_r(machine,0,0);
24282428
24292429      case (0x70c/2):
2430         return input_port_3_word_r(0,0);
2430         return input_port_3_word_r(machine,0,0);
24312431
24322432      case (0x71c/2):
2433         return input_port_5_word_r(0,0);
2433         return input_port_5_word_r(machine,0,0);
24342434#if 0
24352435      case (0x748/2):   /* seibu sound */
24362436         return seibu_main_word_r(2,0);
r1877r1878
25642564      /*WRONG*/
25652565      case (0x65c/2):
25662566      {
2567         soundlatch_w(1,data&0xff);
2568         cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE );
2567         soundlatch_w(machine,1,data&0xff);
2568         cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE );
25692569         break;
25702570      }
25712571      /*video regs (not scrollram,something else)*/
r1877r1878
34653465   /* basic machine hardware */
34663466   MDRV_CPU_ADD(M68000,20000000/2)    /* ??? */
34673467   MDRV_CPU_PROGRAM_MAP(legionna_readmem,legionna_writemem)
3468   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)/* VBL */
3468   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)/* VBL */
34693469
34703470   SEIBU_SOUND_SYSTEM_CPU(14318180/4)
34713471
r1877r1878
34973497   /* basic machine hardware */
34983498   MDRV_CPU_ADD(M68000,20000000/2)    /* ??? */
34993499   MDRV_CPU_PROGRAM_MAP(heatbrl_readmem,heatbrl_writemem)
3500   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)/* VBL */
3500   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)/* VBL */
35013501
35023502   SEIBU_SOUND_SYSTEM_CPU(14318180/4)
35033503
r1877r1878
35283528   /* basic machine hardware */
35293529   MDRV_CPU_ADD(M68000, 20000000/2)
35303530   MDRV_CPU_PROGRAM_MAP(godzilla_readmem,godzilla_writemem)
3531   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
3531   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
35323532
35333533   SEIBU2_SOUND_SYSTEM_CPU(14318180/4)
35343534
r1877r1878
35593559   /* basic machine hardware */
35603560   MDRV_CPU_ADD(M68000, 20000000/2)
35613561   MDRV_CPU_PROGRAM_MAP(denjinmk_readmem,denjinmk_writemem)
3562   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
3562   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
35633563
35643564   SEIBU2_SOUND_SYSTEM_CPU(14318180/4)
35653565
r1877r1878
35903590   /* basic machine hardware */
35913591   MDRV_CPU_ADD(M68000, 20000000/2)
35923592   MDRV_CPU_PROGRAM_MAP(sdgndmrb_readmem,sdgndmrb_writemem)
3593   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
3593   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
35943594
35953595   SEIBU2_SOUND_SYSTEM_CPU(14318180/4)
35963596
r1877r1878
36223622   /* basic machine hardware */
36233623   MDRV_CPU_ADD(M68000,20000000/2)
36243624   MDRV_CPU_PROGRAM_MAP(cupsoc_mem,0)
3625   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)/* VBL */
3625   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)/* VBL */
36263626
36273627   SEIBU_SOUND_SYSTEM_CPU(14318180/4)
36283628
r1877r1878
36543654   /* basic machine hardware */
36553655   MDRV_CPU_ADD(M68000,12000000)
36563656   MDRV_CPU_PROGRAM_MAP(cupsocbl_mem,0)
3657   MDRV_CPU_VBLANK_INT(irq4_line_hold,1) /* VBL */
3657   MDRV_CPU_VBLANK_INT("main", irq4_line_hold) /* VBL */
36583658
36593659   /*Different Sound hardware*/
36603660   //SEIBU_SOUND_SYSTEM_CPU(14318180/4)
36613661   MDRV_CPU_ADD(Z80,14318180/4)
36623662   MDRV_CPU_PROGRAM_MAP(cupsocbl_sound_mem,0)
3663   //MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
3663   //MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
36643664
36653665   //MDRV_MACHINE_INIT(seibu_sound_1)
36663666
src/mame/drivers/midas.c
r1877r1878
7272   tilemap_set_transparent_pen(tmap, 0);
7373}
7474
75static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
75static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
7676{
7777   UINT16 *s      =   livequiz_gfxram + 0x8000;
7878   UINT16 *codes   =   livequiz_gfxram;
r1877r1878
442442   /* basic machine hardware */
443443   MDRV_CPU_ADD(M68000, 24000000 / 2)
444444   MDRV_CPU_PROGRAM_MAP(mem_map,0)
445   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
445   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
446446
447447   MDRV_NVRAM_HANDLER(93C46)
448448
src/mame/drivers/mcr68.c
r1877r1878
9292   /* make this happen, we must assume that reads from the */
9393   /* 6840 take 14 additional cycles                       */
9494   activecpu_adjust_icount(-14);
95   return mcr68_6840_upper_r(offset,0);
95   return mcr68_6840_upper_r(machine,offset,0);
9696}
9797
9898
r1877r1878
107107{
108108   COMBINE_DATA(&control_word);
109109/*  soundsgood_reset_w(~control_word & 0x0020);*/
110   soundsgood_data_w(offset, ((control_word & 0x000f) << 1) | ((control_word & 0x0010) >> 4));
110   soundsgood_data_w(machine, offset, ((control_word & 0x000f) << 1) | ((control_word & 0x0010) >> 4));
111111}
112112
113113
r1877r1878
122122{
123123   COMBINE_DATA(&control_word);
124124/*  soundsgood_reset_w(~control_word & 0x0020);*/
125   soundsgood_data_w(offset, (control_word >> 8) & 0x1f);
125   soundsgood_data_w(machine, offset, (control_word >> 8) & 0x1f);
126126}
127127
128128
r1877r1878
138138   int result = readinputportbytag("IN0");
139139   int which = (control_word >> 3) & 3;
140140   int analog = readinputport(3 + which);
141   return result | ((soundsgood_status_r(0) & 1) << 5) | (analog << 8);
141   return result | ((soundsgood_status_r(machine, 0) & 1) << 5) | (analog << 8);
142142}
143143
144144
145145static READ16_HANDLER( spyhunt2_port_1_r )
146146{
147147   int result = readinputportbytag("IN1");
148   return result | ((turbocs_status_r(0) & 1) << 7);
148   return result | ((turbocs_status_r(machine, 0) & 1) << 7);
149149}
150150
151151
r1877r1878
154154   COMBINE_DATA(&control_word);
155155
156156/*  turbocs_reset_w(~control_word & 0x0080);*/
157   turbocs_data_w(offset, (control_word >> 8) & 0x001f);
157   turbocs_data_w(machine, offset, (control_word >> 8) & 0x001f);
158158
159159   soundsgood_reset_w(~control_word & 0x2000);
160   soundsgood_data_w(offset, (control_word >> 8) & 0x001f);
160   soundsgood_data_w(machine, offset, (control_word >> 8) & 0x001f);
161161}
162162
163163
r1877r1878
880880   /* basic machine hardware */
881881   MDRV_CPU_ADD(M68000, 7652400)   /* should be XTAL_16MHz/2 */
882882   MDRV_CPU_PROGRAM_MAP(zwackery_map,0)
883   MDRV_CPU_VBLANK_INT(mcr68_interrupt,1)
883   MDRV_CPU_VBLANK_INT("main", mcr68_interrupt)
884884
885885//  MDRV_WATCHDOG_VBLANK_INIT(8)
886886   MDRV_MACHINE_START(zwackery)
r1877r1878
910910   /* basic machine hardware */
911911   MDRV_CPU_ADD_TAG("main", M68000, 7723800)
912912   MDRV_CPU_PROGRAM_MAP(mcr68_map,0)
913   MDRV_CPU_VBLANK_INT(mcr68_interrupt,1)
913   MDRV_CPU_VBLANK_INT("main", mcr68_interrupt)
914914
915915   MDRV_WATCHDOG_VBLANK_INIT(8)
916916   MDRV_MACHINE_START(mcr68)
src/mame/drivers/pbaction.c
r1877r1878
5454
5555static WRITE8_HANDLER( pbaction_sh_command_w )
5656{
57   soundlatch_w(offset,data);
58   cpunum_set_input_line_and_vector(Machine, 1,0,HOLD_LINE,0x00);
57   soundlatch_w(machine,offset,data);
58   cpunum_set_input_line_and_vector(machine, 1,0,HOLD_LINE,0x00);
5959}
6060
6161
r1877r1878
267267   /* basic machine hardware */
268268   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz? */
269269   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
270   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
270   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
271271
272272   MDRV_CPU_ADD(Z80, 3072000)
273273   /* audio CPU */
274274   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
275275   MDRV_CPU_IO_MAP(0,sound_writeport)
276   MDRV_CPU_VBLANK_INT(pbaction_interrupt,2)   /* ??? */
276   MDRV_CPU_VBLANK_INT_HACK(pbaction_interrupt,2)   /* ??? */
277277                           /* IRQs are caused by the main CPU */
278278
279279   /* video hardware */
src/mame/drivers/funworld.c
r1877r1878
840840/* from video */
841841WRITE8_HANDLER( funworld_videoram_w );
842842WRITE8_HANDLER( funworld_colorram_w );
843WRITE8_HANDLER( funworld_mc6845_address_w );
844READ8_HANDLER( funworld_mc6845_register_r );
845WRITE8_HANDLER( funworld_mc6845_register_w );
846843PALETTE_INIT( funworld );
847844VIDEO_START( funworld );
848845VIDEO_START( magiccrd );
r1877r1878
885882   AM_RANGE(0x0a00, 0x0a03) AM_READWRITE(pia_1_r, pia_1_w)
886883   AM_RANGE(0x0c00, 0x0c00) AM_READWRITE(AY8910_read_port_0_r, AY8910_control_port_0_w)
887884   AM_RANGE(0x0c01, 0x0c01) AM_WRITE(AY8910_write_port_0_w)
888   AM_RANGE(0x0e00, 0x0e00) AM_WRITE(funworld_mc6845_address_w)
889   AM_RANGE(0x0e01, 0x0e01) AM_READWRITE(funworld_mc6845_register_r, funworld_mc6845_register_w)
885   AM_RANGE(0x0e00, 0x0e00) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
886   AM_RANGE(0x0e01, 0x0e01) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
890887   AM_RANGE(0x2000, 0x2fff) AM_RAM AM_WRITE(funworld_videoram_w) AM_BASE(&videoram)
891888   AM_RANGE(0x3000, 0x3fff) AM_RAM   AM_WRITE(funworld_colorram_w) AM_BASE(&colorram)
892889   AM_RANGE(0x4000, 0x4000) AM_READNOP
r1877r1878
900897   AM_RANGE(0x0a00, 0x0a03) AM_READWRITE(pia_1_r, pia_1_w)
901898   AM_RANGE(0x0c00, 0x0c00) AM_READWRITE(AY8910_read_port_0_r, AY8910_control_port_0_w)
902899   AM_RANGE(0x0c01, 0x0c01) AM_WRITE(AY8910_write_port_0_w)
903   AM_RANGE(0x0e00, 0x0e00) AM_WRITE(funworld_mc6845_address_w)
904   AM_RANGE(0x0e01, 0x0e01) AM_READWRITE(funworld_mc6845_register_r, funworld_mc6845_register_w)
900   AM_RANGE(0x0e00, 0x0e00) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
901   AM_RANGE(0x0e01, 0x0e01) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
905902   AM_RANGE(0x3600, 0x36ff) AM_RAM   // some games use $3603-05 range for protection.
906903   AM_RANGE(0x4000, 0x4fff) AM_RAM AM_WRITE(funworld_videoram_w) AM_BASE(&videoram)
907904   AM_RANGE(0x5000, 0x5fff) AM_RAM   AM_WRITE(funworld_colorram_w) AM_BASE(&colorram)
r1877r1878
914911   AM_RANGE(0x0a00, 0x0a03) AM_READWRITE(pia_1_r, pia_1_w)
915912   AM_RANGE(0x0c00, 0x0c00) AM_READWRITE(AY8910_read_port_0_r, AY8910_control_port_0_w)
916913   AM_RANGE(0x0c01, 0x0c01) AM_WRITE(AY8910_write_port_0_w)
917   AM_RANGE(0x0e00, 0x0e00) AM_WRITE(funworld_mc6845_address_w)
918   AM_RANGE(0x0e01, 0x0e01) AM_READWRITE(funworld_mc6845_register_r, funworld_mc6845_register_w)
914   AM_RANGE(0x0e00, 0x0e00) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
915   AM_RANGE(0x0e01, 0x0e01) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
919916   AM_RANGE(0x2000, 0x2000) AM_READNOP   // some unknown reads
920917   AM_RANGE(0x3e00, 0x3fff) AM_RAM   // some games use $3e03-05 range for protection.
921918   AM_RANGE(0x6000, 0x6fff) AM_RAM AM_WRITE(funworld_videoram_w) AM_BASE(&videoram)
r1877r1878
929926   AM_RANGE(0x2a00, 0x2a03) AM_READWRITE(pia_1_r, pia_1_w)
930927   AM_RANGE(0x2c00, 0x2c00) AM_READWRITE(AY8910_read_port_0_r, AY8910_control_port_0_w)
931928   AM_RANGE(0x2c01, 0x2c01) AM_WRITE(AY8910_write_port_0_w)
932   AM_RANGE(0x2e00, 0x2e00) AM_WRITE(funworld_mc6845_address_w)
933   AM_RANGE(0x2e01, 0x2e01) AM_READWRITE(funworld_mc6845_register_r, funworld_mc6845_register_w)
929   AM_RANGE(0x2e00, 0x2e00) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
930   AM_RANGE(0x2e01, 0x2e01) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
934931   AM_RANGE(0x4000, 0x4fff) AM_RAM AM_WRITE(funworld_videoram_w) AM_BASE(&videoram)
935932   AM_RANGE(0x5000, 0x5fff) AM_RAM   AM_WRITE(funworld_colorram_w) AM_BASE(&colorram)
936933   AM_RANGE(0x6000, 0xffff) AM_ROM
r1877r1878
15471544   // basic machine hardware
15481545   MDRV_CPU_ADD_TAG("main", M65SC02, MASTER_CLOCK/8)   // 2MHz
15491546   MDRV_CPU_PROGRAM_MAP(funworld_map, 0)
1550   MDRV_CPU_VBLANK_INT(nmi_line_pulse, 1)
1547   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
15511548
15521549   MDRV_NVRAM_HANDLER(generic_0fill)
15531550
r1877r1878
16301627static MACHINE_DRIVER_START( snookr10 )
16311628   MDRV_CPU_ADD_TAG("main", M65SC02, MASTER_CLOCK/8)   // 2MHz
16321629   MDRV_CPU_PROGRAM_MAP(snookr10_map, 0)
1633   MDRV_CPU_VBLANK_INT(nmi_line_pulse, 1)
1630   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
16341631
16351632   // video hardware
16361633
src/mame/drivers/overdriv.c
r1877r1878
3535
3636static READ16_HANDLER( K051316_0_msb_r )
3737{
38   return K051316_0_r(offset) << 8;
38   return K051316_0_r(machine,offset) << 8;
3939}
4040
4141static READ16_HANDLER( K051316_1_msb_r )
4242{
43   return K051316_1_r(offset) << 8;
43   return K051316_1_r(machine,offset) << 8;
4444}
4545
4646static READ16_HANDLER( K051316_rom_0_msb_r )
4747{
48   return K051316_rom_0_r(offset) << 8;
48   return K051316_rom_0_r(machine,offset) << 8;
4949}
5050
5151static READ16_HANDLER( K051316_rom_1_msb_r )
5252{
53   return K051316_rom_1_r(offset) << 8;
53   return K051316_rom_1_r(machine,offset) << 8;
5454}
5555
5656static WRITE16_HANDLER( K051316_0_msb_w )
5757{
5858   if (ACCESSING_MSB)
59      K051316_0_w(offset,data >> 8);
59      K051316_0_w(machine,offset,data >> 8);
6060}
6161
6262static WRITE16_HANDLER( K051316_1_msb_w )
6363{
6464   if (ACCESSING_MSB)
65      K051316_1_w(offset,data >> 8);
65      K051316_1_w(machine,offset,data >> 8);
6666}
6767
6868static WRITE16_HANDLER( K051316_ctrl_0_msb_w )
6969{
7070   if (ACCESSING_MSB)
71      K051316_ctrl_0_w(offset,data >> 8);
71      K051316_ctrl_0_w(machine,offset,data >> 8);
7272}
7373
7474static WRITE16_HANDLER( K051316_ctrl_1_msb_w )
7575{
7676   if (ACCESSING_MSB)
77      K051316_ctrl_1_w(offset,data >> 8);
77      K051316_ctrl_1_w(machine,offset,data >> 8);
7878}
7979
8080
r1877r1878
129129
130130//logerror("%06x eeprom_r\n",activecpu_get_pc());
131131   /* bit 6 is EEPROM data */
132   res = (EEPROM_read_bit() << 6) | input_port_0_word_r(0,0);
132   res = (EEPROM_read_bit() << 6) | input_port_0_word_r(machine,0,0);
133133
134134   return res;
135135}
r1877r1878
227227
228228static READ16_HANDLER( overdriv_sound_0_r )
229229{
230   return K053260_0_r(2 + offset);
230   return K053260_0_r(machine,2 + offset);
231231}
232232
233233static READ16_HANDLER( overdriv_sound_1_r )
234234{
235   return K053260_1_r(2 + offset);
235   return K053260_1_r(machine,2 + offset);
236236}
237237
238238static WRITE16_HANDLER( overdriv_soundirq_w )
r1877r1878
398398   /* basic machine hardware */
399399   MDRV_CPU_ADD(M68000,24000000/2)   /* 12 MHz */
400400   MDRV_CPU_PROGRAM_MAP(overdriv_readmem,overdriv_writemem)
401   MDRV_CPU_VBLANK_INT(cpuA_interrupt,4)   /* ??? IRQ 4 is vblank, IRQ 5 of unknown origin */
401   MDRV_CPU_VBLANK_INT_HACK(cpuA_interrupt,4)   /* ??? IRQ 4 is vblank, IRQ 5 of unknown origin */
402402
403403   MDRV_CPU_ADD(M68000,24000000/2)   /* 12 MHz */
404404   MDRV_CPU_PROGRAM_MAP(overdriv_readmem2,overdriv_writemem2)
405   MDRV_CPU_VBLANK_INT(cpuB_interrupt,1)   /* IRQ 5 and 6 are generated by the main CPU. */
405   MDRV_CPU_VBLANK_INT("main", cpuB_interrupt)   /* IRQ 5 and 6 are generated by the main CPU. */
406406                        /* IRQ 5 is used only in test mode, to request the checksums of the gfx ROMs. */
407407   MDRV_CPU_ADD(M6809,3579545/2)   /* 1.789 MHz?? This might be the right speed, but ROM testing */
408408                  /* takes a little too much (the counter wraps from 0000 to 9999). */
src/mame/drivers/thunderx.c
r1877r1878
5454static WRITE8_HANDLER( scontra_bankedram_w )
5555{
5656   if (palette_selected)
57      paletteram_xBBBBBGGGGGRRRRR_be_w(offset,data);
57      paletteram_xBBBBBGGGGGRRRRR_be_w(machine,offset,data);
5858   else
5959      ram[offset] = data;
6060}
r1877r1878
9696         logerror("%04x pmc internal ram %04x = %02x\n",activecpu_get_pc(),offset,data);
9797   }
9898   else
99      paletteram_xBBBBBGGGGGRRRRR_be_w(offset,data);
99      paletteram_xBBBBBGGGGGRRRRR_be_w(machine,offset,data);
100100}
101101
102102/*
r1877r1878
699699   /* basic machine hardware */
700700   MDRV_CPU_ADD(KONAMI, 3000000)   /* 052001 */
701701   MDRV_CPU_PROGRAM_MAP(scontra_readmem,scontra_writemem)
702   MDRV_CPU_VBLANK_INT(scontra_interrupt,1)
702   MDRV_CPU_VBLANK_INT("main", scontra_interrupt)
703703
704704   MDRV_CPU_ADD(Z80, 3579545)
705705   /* audio CPU */      /* ? */
r1877r1878
741741   /* basic machine hardware */
742742   MDRV_CPU_ADD(KONAMI, 3000000)      /* ? */
743743   MDRV_CPU_PROGRAM_MAP(thunderx_readmem,thunderx_writemem)
744   MDRV_CPU_VBLANK_INT(scontra_interrupt,1)
744   MDRV_CPU_VBLANK_INT("main", scontra_interrupt)
745745
746746   MDRV_CPU_ADD(Z80, 3579545)
747747   /* audio CPU */      /* ? */
src/mame/drivers/jackpool.c
r1877r1878
175175static MACHINE_DRIVER_START( jackpool )
176176   MDRV_CPU_ADD(M68000, 12000000) // ?
177177   MDRV_CPU_PROGRAM_MAP(jackpool_readmem,jackpool_writemem)
178   MDRV_CPU_VBLANK_INT(jackpool_interrupt,3)  // ?
178   MDRV_CPU_VBLANK_INT_HACK(jackpool_interrupt,3)  // ?
179179
180180   MDRV_GFXDECODE(jackpool)
181181
src/mame/drivers/spcforce.c
r1877r1878
6161{
6262    spcforce_SN76496_select = data;
6363
64   if (~data & 0x40)  SN76496_0_w(0, spcforce_SN76496_latch);
65   if (~data & 0x20)  SN76496_1_w(0, spcforce_SN76496_latch);
66   if (~data & 0x10)  SN76496_2_w(0, spcforce_SN76496_latch);
64   if (~data & 0x40)  SN76496_0_w(machine, 0, spcforce_SN76496_latch);
65   if (~data & 0x20)  SN76496_1_w(machine, 0, spcforce_SN76496_latch);
66   if (~data & 0x10)  SN76496_2_w(machine, 0, spcforce_SN76496_latch);
6767}
6868
6969static READ8_HANDLER( spcforce_t0_r )
r1877r1878
261261   /* FIXME: The 8085A had a max clock of 6MHz, internally divided by 2! */
262262   MDRV_CPU_ADD(8085A, 8000000 * 2)        /* 4.00 MHz??? */
263263   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
264   MDRV_CPU_VBLANK_INT(irq3_line_hold,1)
264   MDRV_CPU_VBLANK_INT("main", irq3_line_hold)
265265
266266   MDRV_CPU_ADD(I8035,6144000)
267267   /* audio CPU */      /* divisor ??? */
src/mame/drivers/gsword.c
r1877r1878
331331
332332static WRITE8_HANDLER( gsword_AY8910_control_port_0_w )
333333{
334   AY8910_control_port_0_w(offset,data);
334   AY8910_control_port_0_w(machine,offset,data);
335335   fake8910_0 = data;
336336}
337337static WRITE8_HANDLER( gsword_AY8910_control_port_1_w )
338338{
339   AY8910_control_port_1_w(offset,data);
339   AY8910_control_port_1_w(machine,offset,data);
340340   fake8910_1 = data;
341341}
342342
r1877r1878
358358
359359static WRITE8_HANDLER( adpcm_soundcommand_w )
360360{
361   soundlatch_w(0,data);
362   cpunum_set_input_line(Machine, 2, INPUT_LINE_NMI, PULSE_LINE);
361   soundlatch_w(machine,0,data);
362   cpunum_set_input_line(machine, 2, INPUT_LINE_NMI, PULSE_LINE);
363363}
364364
365365static ADDRESS_MAP_START( cpu1_map, 0 , 8 )
r1877r1878
691691   MDRV_CPU_ADD(Z80, XTAL_18MHz/6) /* verified on pcb */
692692   MDRV_CPU_PROGRAM_MAP(cpu1_map,0)
693693   MDRV_CPU_IO_MAP(cpu1_io_map,0)
694   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
694   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
695695
696696   MDRV_CPU_ADD(Z80, XTAL_18MHz/6) /* verified on pcb */
697697   MDRV_CPU_PROGRAM_MAP(cpu2_map,0)
698698   MDRV_CPU_IO_MAP(cpu2_io_map,0)
699   MDRV_CPU_VBLANK_INT(gsword_snd_interrupt,4)
699   MDRV_CPU_VBLANK_INT_HACK(gsword_snd_interrupt,4)
700700
701701   MDRV_CPU_ADD(Z80, XTAL_18MHz/6) /* verified on pcb */
702702   /* audio CPU */
r1877r1878
747747   MDRV_CPU_ADD(Z80, 18000000/6) /* ? */
748748   MDRV_CPU_PROGRAM_MAP(cpu1_map,0)
749749   MDRV_CPU_IO_MAP(josvolly_cpu1_io_map,0)
750   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
750   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
751751
752752   MDRV_CPU_ADD(Z80, 12000000/4) /* ? */
753753   /* audio CPU */
754754   MDRV_CPU_PROGRAM_MAP(josvolly_cpu2_map,0)
755755   MDRV_CPU_IO_MAP(josvolly_cpu2_io_map,0)
756//  MDRV_CPU_VBLANK_INT(gsword_snd_interrupt,1)
757   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
756//  MDRV_CPU_VBLANK_INT("main", gsword_snd_interrupt)
757   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
758758
759759   MDRV_MACHINE_RESET(josvolly)
760760
src/mame/drivers/nmg5.c
r1877r1878
245245{
246246   if (ACCESSING_LSB)
247247   {
248      soundlatch_w(0,data & 0xff);
249      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
248      soundlatch_w(machine,0,data & 0xff);
249      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
250250   }
251251}
252252
r1877r1878
805805   tilemap_set_transparent_pen(fg_tilemap,0);
806806}
807807
808static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
808static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
809809{
810810   int offs;
811811
r1877r1878
841841   }
842842}
843843
844static void draw_bitmap(mame_bitmap *bitmap)
844static void draw_bitmap(bitmap_t *bitmap)
845845{
846846   int yyy=256;
847847   int xxx=512/4;
r1877r1878
985985   /* basic machine hardware */
986986   MDRV_CPU_ADD_TAG("main", M68000, 16000000)   /* 16 MHz */
987987   MDRV_CPU_PROGRAM_MAP(nmg5_map,0)
988   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
988   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
989989
990990   MDRV_CPU_ADD_TAG("sound", Z80, 4000000)      /* 4 MHz */
991991   /* audio CPU */
src/mame/drivers/mario.c
r1877r1878
9090***************************************************************************/
9191
9292#include "driver.h"
93#include "deprecat.h"
9493#include "machine/z80dma.h"
9594
9695#include "mario.h"
9796
98static UINT8 mario_dma_read_byte(offs_t offset);
99static void mario_dma_write_byte(offs_t offset, UINT8 data);
97static Z80DMA_READ(mario_dma_read_byte);
98static Z80DMA_WRITE(mario_dma_write_byte);
10099
101100/*************************************
102101 *
r1877r1878
104103 *
105104 *************************************/
106105
107static const struct z80dma_interface mario_dma =
106static const z80dma_interface mario_dma =
108107{
109108   0,
110109   Z80_CLOCK,
r1877r1878
120119 *
121120 *************************************/
122121
123static MACHINE_START( mario )
124{
125   z80dma_init(1);
126   z80dma_config(0, &mario_dma);
127}
128
129static MACHINE_RESET( mario )
130{
131   z80dma_reset();
132}
133
134122/*************************************
135123 *
136124 *  DMA handling
137125 *
138126 *************************************/
139127
140static UINT8 mario_dma_read_byte(offs_t offset)
128static Z80DMA_READ(mario_dma_read_byte)
141129{
142130   UINT8 result;
143131
r1877r1878
148136   return result;
149137}
150138
151static void mario_dma_write_byte(offs_t offset, UINT8 data)
139static Z80DMA_WRITE(mario_dma_write_byte)
152140{
153141   cpuintrf_push_context(0);
154142   program_write_byte(offset, data);
r1877r1878
361349   MDRV_CPU_ADD_TAG("main", Z80, Z80_CLOCK)   /* verified on pcb */
362350   MDRV_CPU_PROGRAM_MAP(mario_map, 0)
363351   MDRV_CPU_IO_MAP(0,mario_writeport)
364   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
352   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
365353
366   MDRV_MACHINE_START(mario)
367   MDRV_MACHINE_RESET(mario)
354   /* devices */
355   MDRV_DEVICE_ADD(Z80DMA_DEV_0_TAG, Z80DMA)
356   MDRV_DEVICE_CONFIG(mario_dma)
368357
369358   /* video hardware */
370359   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
397386   MDRV_CPU_REPLACE("main", Z80, 4000000)        /* 4.000 MHz (?) */
398387   MDRV_CPU_PROGRAM_MAP(masao_map, 0)
399388   MDRV_CPU_IO_MAP(0,mario_writeport)
400   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
389   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
401390
402391   /* sound hardware */
403392   MDRV_IMPORT_FROM(masao_audio)
src/mame/drivers/xmen.c
r1877r1878
7676   /* bit 6 is EEPROM data */
7777   /* bit 7 is EEPROM ready */
7878   /* bit 14 is service button */
79   res = (EEPROM_read_bit() << 6) | input_port_2_word_r(0,0);
79   res = (EEPROM_read_bit() << 6) | input_port_2_word_r(machine,0,0);
8080   if (init_eeprom_count)
8181   {
8282      init_eeprom_count--;
r1877r1878
9393   /* bit 6 is EEPROM data */
9494   /* bit 7 is EEPROM ready */
9595   /* bit 14 is service button */
96   res = (EEPROM_read_bit() << 6) | input_port_2_word_r(0,0);
96   res = (EEPROM_read_bit() << 6) | input_port_2_word_r(machine,0,0);
9797   if (init_eeprom_count)
9898   {
9999      init_eeprom_count--;
r1877r1878
129129
130130static READ16_HANDLER( sound_status_r )
131131{
132   return soundlatch2_r(0);
132   return soundlatch2_r(machine,0);
133133}
134134
135135static WRITE16_HANDLER( sound_cmd_w )
136136{
137137   if (ACCESSING_LSB) {
138138      data &= 0xff;
139      soundlatch_w(0, data);
139      soundlatch_w(machine, 0, data);
140140   }
141141}
142142
143143static WRITE16_HANDLER( sound_irq_w )
144144{
145   cpunum_set_input_line(Machine, 1, 0, HOLD_LINE);
145   cpunum_set_input_line(machine, 1, 0, HOLD_LINE);
146146}
147147
148148//int xmen_irqenabled;
r1877r1878
151151{
152152   if(ACCESSING_LSB) {
153153      /* bit 2 is interrupt enable */
154      interrupt_enable_w(0,data & 0x04);
154      interrupt_enable_w(machine,0,data & 0x04);
155155   //  xmen_irqenabled = data;
156156   }
157157}
r1877r1878
170170}
171171
172172
173static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 16 )
174   AM_RANGE(0x000000, 0x03ffff) AM_READ(MRA16_ROM)
175   AM_RANGE(0x080000, 0x0fffff) AM_READ(MRA16_ROM)
176   AM_RANGE(0x100000, 0x100fff) AM_READ(K053247_word_r)
177   AM_RANGE(0x101000, 0x101fff) AM_READ(MRA16_RAM)
178   AM_RANGE(0x104000, 0x104fff) AM_READ(MRA16_RAM)
179   AM_RANGE(0x108054, 0x108055) AM_READ(sound_status_r)
180   AM_RANGE(0x10a000, 0x10a001) AM_READ(input_port_0_word_r)
181   AM_RANGE(0x10a002, 0x10a003) AM_READ(input_port_1_word_r)
182   AM_RANGE(0x10a004, 0x10a005) AM_READ(eeprom_r)
183   AM_RANGE(0x10a00c, 0x10a00d) AM_READ(K053246_word_r)
184   AM_RANGE(0x110000, 0x113fff) AM_READ(MRA16_RAM)   /* main RAM */
185   AM_RANGE(0x18c000, 0x197fff) AM_READ(K052109_lsb_r)
186
187
188ADDRESS_MAP_END
189
190static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 16 )
191   AM_RANGE(0x000000, 0x03ffff) AM_WRITE(MWA16_ROM)
192   AM_RANGE(0x080000, 0x0fffff) AM_WRITE(MWA16_ROM)
193   AM_RANGE(0x100000, 0x100fff) AM_WRITE(K053247_word_w)
194   AM_RANGE(0x101000, 0x101fff) AM_WRITE(MWA16_RAM)
195   AM_RANGE(0x104000, 0x104fff) AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)
173static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
174   AM_RANGE(0x000000, 0x03ffff) AM_ROM
175   AM_RANGE(0x080000, 0x0fffff) AM_ROM
176   AM_RANGE(0x100000, 0x100fff) AM_READWRITE(K053247_word_r, K053247_word_w)
177   AM_RANGE(0x101000, 0x101fff) AM_RAM
178   AM_RANGE(0x104000, 0x104fff) AM_READWRITE(MRA16_RAM, paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)
196179   AM_RANGE(0x108000, 0x108001) AM_WRITE(eeprom_w)
197180   AM_RANGE(0x108020, 0x108027) AM_WRITE(K053246_word_w)
198181   AM_RANGE(0x10804c, 0x10804d) AM_WRITE(sound_cmd_w)
199182   AM_RANGE(0x10804e, 0x10804f) AM_WRITE(sound_irq_w)
183   AM_RANGE(0x108054, 0x108055) AM_READ(sound_status_r)
200184   AM_RANGE(0x108060, 0x10807f) AM_WRITE(K053251_lsb_w)
201   AM_RANGE(0x10a000, 0x10a001) AM_WRITE(watchdog_reset16_w)
202   AM_RANGE(0x110000, 0x113fff) AM_WRITE(MWA16_RAM)   /* main RAM */
185   AM_RANGE(0x10a000, 0x10a001) AM_READWRITE(input_port_0_word_r, watchdog_reset16_w)
186   AM_RANGE(0x10a002, 0x10a003) AM_READ(input_port_1_word_r)
187   AM_RANGE(0x10a004, 0x10a005) AM_READ(eeprom_r)
188   AM_RANGE(0x10a00c, 0x10a00d) AM_READ(K053246_word_r)
189   AM_RANGE(0x110000, 0x113fff) AM_RAM      /* main RAM */
203190   AM_RANGE(0x18fa00, 0x18fa01) AM_WRITE(xmen_18fa00_w)
204   AM_RANGE(0x18c000, 0x197fff) AM_WRITE(K052109_lsb_w)
205
191   AM_RANGE(0x18c000, 0x197fff) AM_READWRITE(K052109_lsb_r, K052109_lsb_w)
206192ADDRESS_MAP_END
207193
208static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
209   AM_RANGE(0x0000, 0x7fff) AM_READ(MRA8_ROM)
194static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
195   AM_RANGE(0x0000, 0x7fff) AM_ROM
210196   AM_RANGE(0x8000, 0xbfff) AM_READ(MRA8_BANK4)
211   AM_RANGE(0xc000, 0xdfff) AM_READ(MRA8_RAM)
212   AM_RANGE(0xe000, 0xe22f) AM_READ(K054539_0_r)
213   AM_RANGE(0xec01, 0xec01) AM_READ(YM2151_status_port_0_r)
214   AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_r)
215ADDRESS_MAP_END
216
217static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
218   AM_RANGE(0x0000, 0xbfff) AM_WRITE(MWA8_ROM)
219   AM_RANGE(0xc000, 0xdfff) AM_WRITE(MWA8_RAM)
220   AM_RANGE(0xe000, 0xe22f) AM_WRITE(K054539_0_w)
197   AM_RANGE(0x8000, 0xbfff) AM_WRITE(MWA8_ROM)
198   AM_RANGE(0xc000, 0xdfff) AM_RAM
199   AM_RANGE(0xe000, 0xe22f) AM_READWRITE(K054539_0_r, K054539_0_w)
221200   AM_RANGE(0xe800, 0xe800) AM_WRITE(YM2151_register_port_0_w)
222   AM_RANGE(0xec01, 0xec01) AM_WRITE(YM2151_data_port_0_w)
201   AM_RANGE(0xec01, 0xec01) AM_READWRITE(YM2151_status_port_0_r, YM2151_data_port_0_w)
223202   AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch2_w)
203   AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_r)
224204   AM_RANGE(0xf800, 0xf800) AM_WRITE(sound_bankswitch_w)
225205ADDRESS_MAP_END
226206
227/* 6p version */
228207
229static ADDRESS_MAP_START( readmem6p, ADDRESS_SPACE_PROGRAM, 16 )
230   AM_RANGE(0x000000, 0x03ffff) AM_READ(MRA16_ROM)
231   AM_RANGE(0x080000, 0x0fffff) AM_READ(MRA16_ROM)
232   AM_RANGE(0x100000, 0x100fff) AM_READ(MRA16_RAM) /* 1st sprite list on 6p */
233   AM_RANGE(0x101000, 0x101fff) AM_READ(MRA16_RAM)
234
235
236   AM_RANGE(0x102000, 0x102fff) AM_READ(MRA16_RAM) /* 2nd sprite list on 6p */
237   AM_RANGE(0x102000, 0x103fff) AM_READ(MRA16_RAM) /* 6p - a buffer? */
238
239
240   AM_RANGE(0x104000, 0x104fff) AM_READ(MRA16_RAM)
241   AM_RANGE(0x108054, 0x108055) AM_READ(sound_status_r)
242   AM_RANGE(0x10a000, 0x10a001) AM_READ(input_port_0_word_r)
243   AM_RANGE(0x10a002, 0x10a003) AM_READ(input_port_1_word_r)
244   AM_RANGE(0x10a004, 0x10a005) AM_READ(xmen6p_eeprom_r)
245   AM_RANGE(0x10a006, 0x10a007) AM_READ(input_port_3_word_r)
246   AM_RANGE(0x10a00c, 0x10a00d) AM_READ(K053246_word_r) /* sprites */
247   AM_RANGE(0x110000, 0x113fff) AM_READ(MRA16_RAM)   /* main RAM */
248   AM_RANGE(0x18c000, 0x197fff) AM_READ(MRA16_RAM) /* left tilemap */
249
250/*
251    AM_RANGE(0x1ac000, 0x1af7ff) AM_READ(MRA16_RAM)
252    AM_RANGE(0x1b0000, 0x1b37ff) AM_READ(MRA16_RAM)
253    AM_RANGE(0x1b4000, 0x1b77ff) AM_READ(MRA16_RAM)
254*/
255   AM_RANGE(0x1ac000, 0x1b7fff) AM_READ(MRA16_RAM) /* right tilemap */
256
257
258   /* what are the regions below buffers? (used by hw or software?) */
259/*
260    AM_RANGE(0x1cc000, 0x1cf7ff) AM_READ(MRA16_RAM)
261    AM_RANGE(0x1d0000, 0x1d37ff) AM_READ(MRA16_RAM)
262*/
263   AM_RANGE(0x1cc000, 0x1d7fff) AM_READ(MRA16_RAM) /* tilemap ?*/
264
265/*
266    AM_RANGE(0x1ec000, 0x1ef7ff) AM_READ(MRA16_RAM)
267    AM_RANGE(0x1f0000, 0x1f37ff) AM_READ(MRA16_RAM)
268    AM_RANGE(0x1f4000, 0x1f77ff) AM_READ(MRA16_RAM)
269*/
270   AM_RANGE(0x1ec000, 0x1f7fff) AM_READ(MRA16_RAM) /* tilemap ?*/
271
272ADDRESS_MAP_END
273
208/* 6p version */
274209UINT16*xmen6p_spriteramleft;
275210UINT16*xmen6p_spriteramright;
276211UINT16*xmen6p_tilemapleft;
277212UINT16*xmen6p_tilemapright;
278213
279static ADDRESS_MAP_START( writemem6p, ADDRESS_SPACE_PROGRAM, 16 )
280   AM_RANGE(0x000000, 0x03ffff) AM_WRITE(MWA16_ROM)
281   AM_RANGE(0x080000, 0x0fffff) AM_WRITE(MWA16_ROM)
282   AM_RANGE(0x100000, 0x100fff) AM_WRITE(MWA16_RAM) AM_BASE(&xmen6p_spriteramleft) /* sprites (screen 1) */
283   AM_RANGE(0x101000, 0x101fff) AM_WRITE(MWA16_RAM)
284
285   AM_RANGE(0x102000, 0x102fff) AM_WRITE(MWA16_RAM) AM_BASE(&xmen6p_spriteramright)/* sprites (screen 2) */
286   AM_RANGE(0x103000, 0x103fff) AM_WRITE(MWA16_RAM)
287
288   AM_RANGE(0x104000, 0x104fff) AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)
214static ADDRESS_MAP_START( 6p_main_map, ADDRESS_SPACE_PROGRAM, 16 )
215   AM_RANGE(0x000000, 0x03ffff) AM_ROM
216   AM_RANGE(0x080000, 0x0fffff) AM_ROM
217   AM_RANGE(0x100000, 0x100fff) AM_RAM AM_BASE(&xmen6p_spriteramleft)   /* sprites (screen 1) */
218   AM_RANGE(0x101000, 0x101fff) AM_RAM
219   AM_RANGE(0x102000, 0x102fff) AM_RAM AM_BASE(&xmen6p_spriteramright)   /* sprites (screen 2) */
220   AM_RANGE(0x103000, 0x103fff) AM_RAM      /* 6p - a buffer? */
221   AM_RANGE(0x104000, 0x104fff) AM_READWRITE(MRA16_RAM,paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)
289222   AM_RANGE(0x108000, 0x108001) AM_WRITE(eeprom_w)
290223   AM_RANGE(0x108020, 0x108027) AM_WRITE(K053246_word_w) /* sprites */
291224   AM_RANGE(0x10804c, 0x10804d) AM_WRITE(sound_cmd_w)
292225   AM_RANGE(0x10804e, 0x10804f) AM_WRITE(sound_irq_w)
226   AM_RANGE(0x108054, 0x108055) AM_READ(sound_status_r)
293227   AM_RANGE(0x108060, 0x10807f) AM_WRITE(K053251_lsb_w)
294   AM_RANGE(0x10a000, 0x10a001) AM_WRITE(watchdog_reset16_w)
295   AM_RANGE(0x110000, 0x113fff) AM_WRITE(MWA16_RAM)   /* main RAM */
228   AM_RANGE(0x10a000, 0x10a001) AM_READWRITE(input_port_0_word_r,watchdog_reset16_w)
229   AM_RANGE(0x10a002, 0x10a003) AM_READ(input_port_1_word_r)
230   AM_RANGE(0x10a004, 0x10a005) AM_READ(xmen6p_eeprom_r)
231   AM_RANGE(0x10a006, 0x10a007) AM_READ(input_port_3_word_r)
232   AM_RANGE(0x10a00c, 0x10a00d) AM_READ(K053246_word_r) /* sprites */
233   AM_RANGE(0x110000, 0x113fff) AM_RAM      /* main RAM */
296234   AM_RANGE(0x18fa00, 0x18fa01) AM_WRITE(xmen_18fa00_w)
297   AM_RANGE(0x18c000, 0x197fff) AM_WRITE(MWA16_RAM/*K052109_lsb_w*/) AM_BASE(&xmen6p_tilemapleft) /* left tilemap (p1,p2,p3 counters) */
298
235/*  AM_RANGE(0x18c000, 0x197fff) AM_WRITE(K052109_lsb_w) AM_BASE(&xmen6p_tilemapleft) */
236   AM_RANGE(0x18c000, 0x197fff) AM_RAM AM_BASE(&xmen6p_tilemapleft) /* left tilemap (p1,p2,p3 counters) */
299237/*
238    AM_RANGE(0x1ac000, 0x1af7ff) AM_READ(MRA16_RAM)
300239    AM_RANGE(0x1ac000, 0x1af7ff) AM_WRITE(MWA16_RAM)
240
241    AM_RANGE(0x1b0000, 0x1b37ff) AM_READ(MRA16_RAM)
301242    AM_RANGE(0x1b0000, 0x1b37ff) AM_WRITE(MWA16_RAM)
243
244    AM_RANGE(0x1b4000, 0x1b77ff) AM_READ(MRA16_RAM)
302245    AM_RANGE(0x1b4000, 0x1b77ff) AM_WRITE(MWA16_RAM)
303246*/
304   AM_RANGE(0x1ac000, 0x1b7fff) AM_WRITE(MWA16_RAM) AM_BASE(&xmen6p_tilemapright)/* tilemap right side (p4,p5,p6 counters) */
247   AM_RANGE(0x1ac000, 0x1b7fff) AM_RAM AM_BASE(&xmen6p_tilemapright) /* right tilemap */
305248
306   /* whats the stuff below, buffers? */
307
249   /* what are the regions below buffers? (used by hw or software?) */
308250/*
251    AM_RANGE(0x1cc000, 0x1cf7ff) AM_READ(MRA16_RAM)
309252    AM_RANGE(0x1cc000, 0x1cf7ff) AM_WRITE(MWA16_RAM)
253
254    AM_RANGE(0x1d0000, 0x1d37ff) AM_READ(MRA16_RAM)
310255    AM_RANGE(0x1d0000, 0x1d37ff) AM_WRITE(MWA16_RAM)
311256*/
312   AM_RANGE(0x1cc000, 0x1d7fff) AM_WRITE(MWA16_RAM) /* tilemap? */
257   AM_RANGE(0x1cc000, 0x1d7fff) AM_RAM /* tilemap ? */
313258
259   /* whats the stuff below, buffers? */
314260/*
261    AM_RANGE(0x1ec000, 0x1ef7ff) AM_READ(MRA16_RAM)
315262    AM_RANGE(0x1ec000, 0x1ef7ff) AM_WRITE(MWA16_RAM)
263    AM_RANGE(0x1f0000, 0x1f37ff) AM_READ(MRA16_RAM)
316264    AM_RANGE(0x1f0000, 0x1f37ff) AM_WRITE(MWA16_RAM)
265    AM_RANGE(0x1f4000, 0x1f77ff) AM_READ(MRA16_RAM)
317266    AM_RANGE(0x1f4000, 0x1f77ff) AM_WRITE(MWA16_RAM)
318267*/
319   AM_RANGE(0x1ec000, 0x1f7fff) AM_WRITE(MWA16_RAM) /*  tilemap? */
320
268   AM_RANGE(0x1ec000, 0x1f7fff) AM_RAM /* tilemap ? */
321269ADDRESS_MAP_END
322270
323271
324
325272static INPUT_PORTS_START( xmen )
326273   PORT_START   /* IN1 */
327274   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
r1877r1878
523470
524471   /* basic machine hardware */
525472   MDRV_CPU_ADD(M68000, 16000000)   /* ? */
526   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
527   MDRV_CPU_VBLANK_INT(xmen_interrupt,2)
473   MDRV_CPU_PROGRAM_MAP(main_map,0)
474   MDRV_CPU_VBLANK_INT_HACK(xmen_interrupt,2)
528475
529476   MDRV_CPU_ADD(Z80,8000000)   /* verified with M1, guessed but accurate */
530477   /* audio CPU */   /* ????? */
531   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
478   MDRV_CPU_PROGRAM_MAP(sound_map,0)
532479
533480   MDRV_MACHINE_START(xmen)
534481
r1877r1878
591538
592539   /* basic machine hardware */
593540   MDRV_CPU_ADD(M68000, 16000000)   /* ? */
594   MDRV_CPU_PROGRAM_MAP(readmem6p,writemem6p)
595   MDRV_CPU_VBLANK_INT(xmen6p_interrupt,2)
541   MDRV_CPU_PROGRAM_MAP(6p_main_map,0)
542   MDRV_CPU_VBLANK_INT_HACK(xmen6p_interrupt,2)
596543
597544   MDRV_CPU_ADD(Z80,8000000)   /* verified with M1, guessed but accurate */
598545   /* audio CPU */   /* ????? */
599   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
546   MDRV_CPU_PROGRAM_MAP(sound_map,0)
600547
601548
602549   MDRV_NVRAM_HANDLER(xmen)
src/mame/drivers/atarifb.c
r1877r1878
103103***************************************************************************/
104104
105105#include "driver.h"
106#include "deprecat.h"
106107#include "atarifb.h"
107108#include "sound/discrete.h"
108109
r1877r1878
561562   /* basic machine hardware */
562563   MDRV_CPU_ADD_TAG("main", M6502, 750000)
563564   MDRV_CPU_PROGRAM_MAP(atarifb_map,0)
564   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)
565   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)
565566
566567   /* video hardware */
567568   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/silkroad.c
r1877r1878
161161
162162static READ32_HANDLER(silk_6295_0_r)
163163{
164   return OKIM6295_status_0_r(0)<<16;
164   return OKIM6295_status_0_r(machine, 0)<<16;
165165}
166166
167167static WRITE32_HANDLER(silk_6295_0_w)
r1877r1878
169169   if (!(mem_mask & 0x00ff0000))
170170   {
171171      logerror("OKI0: write %x mem_mask %8x\n", data>>16, mem_mask);
172      OKIM6295_data_0_w(0, (data>>16) & 0xff);
172      OKIM6295_data_0_w(machine, 0, (data>>16) & 0xff);
173173   }
174174}
175175
176176static READ32_HANDLER(silk_6295_1_r)
177177{
178   return OKIM6295_status_1_r(0)<<16;
178   return OKIM6295_status_1_r(machine, 0)<<16;
179179}
180180
181181static WRITE32_HANDLER(silk_6295_1_w)
r1877r1878
183183   if (!(mem_mask & 0x00ff0000))
184184   {
185185      logerror("OKI1: write %x mem_mask %8x\n", data>>16, mem_mask);
186      OKIM6295_data_1_w(0, (data>>16) & 0xff);
186      OKIM6295_data_1_w(machine, 0, (data>>16) & 0xff);
187187   }
188188}
189189
190190static READ32_HANDLER(silk_ym_r)
191191{
192   return YM2151_status_port_0_r(0)<<16;
192   return YM2151_status_port_0_r(machine, 0)<<16;
193193}
194194
195195static WRITE32_HANDLER(silk_ym_regport_w)
196196{
197197   if (!(mem_mask & 0x00ff0000))
198198   {
199      YM2151_register_port_0_w(0, (data>>16) & 0xff);
199      YM2151_register_port_0_w(machine, 0, (data>>16) & 0xff);
200200   }
201201}
202202
r1877r1878
204204{
205205   if (!(mem_mask & 0x00ff0000))
206206   {
207      YM2151_data_port_0_w(0, (data>>16) & 0xff);
207      YM2151_data_port_0_w(machine, 0, (data>>16) & 0xff);
208208   }
209209}
210210
r1877r1878
373373   /* basic machine hardware */
374374   MDRV_CPU_ADD(M68EC020, 16000000)
375375   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
376   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
376   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
377377
378378   /* video hardware */
379379   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/wink.c
r1877r1878
320320   MDRV_CPU_ADD(Z80, 12000000 / 4)
321321   MDRV_CPU_PROGRAM_MAP(wink_map,0)
322322   MDRV_CPU_IO_MAP(wink_io,0)
323   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
323   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
324324
325325   MDRV_CPU_ADD(Z80, 12000000 / 8)
326326   MDRV_CPU_PROGRAM_MAP(wink_sound_map,0)
src/mame/drivers/lethal.c
r1877r1878
230230
231231static READ8_HANDLER( control2_r )
232232{
233   return 0x02 | EEPROM_read_bit() | (input_port_1_r(0) & 0xf0);
233   return 0x02 | EEPROM_read_bit() | (input_port_1_r(machine,0) & 0xf0);
234234}
235235
236236static WRITE8_HANDLER( control2_w )
r1877r1878
257257
258258static WRITE8_HANDLER( sound_cmd_w )
259259{
260   soundlatch_w(0, data);
260   soundlatch_w(machine, 0, data);
261261}
262262
263263static WRITE8_HANDLER( sound_irq_w )
r1877r1878
301301            case 0x44:
302302            case 0x45:
303303            case 0x46:
304               return K053244_r(offset-0x40);
304               return K053244_r(machine,offset-0x40);
305305               break;
306306
307307            case 0x80:
r1877r1878
336336            case 0x9d:
337337            case 0x9e:
338338            case 0x9f:
339               return K054000_r(offset-0x80);
339               return K054000_r(machine,offset-0x80);
340340               break;
341341
342342            case 0xca:
343               return sound_status_r(0);
343               return sound_status_r(machine,0);
344344               break;
345345         }
346346      }
347347      else if (offset < 0x1800)
348         return K053245_r((offset - 0x0800) & 0x07ff);
348         return K053245_r(machine,(offset - 0x0800) & 0x07ff);
349349      else if (offset < 0x2000)
350         return K056832_ram_code_lo_r(offset - 0x1800);
350         return K056832_ram_code_lo_r(machine,offset - 0x1800);
351351      else if (offset < 0x2800)
352         return K056832_ram_code_hi_r(offset - 0x2000);
352         return K056832_ram_code_hi_r(machine,offset - 0x2000);
353353      else if (offset < 0x3000)
354         return K056832_ram_attr_lo_r(offset - 0x2800);
354         return K056832_ram_attr_lo_r(machine,offset - 0x2800);
355355      else // (offset < 0x3800)
356         return K056832_ram_attr_hi_r(offset - 0x3000);
356         return K056832_ram_attr_hi_r(machine,offset - 0x3000);
357357   }
358358
359359   return 0;
r1877r1878
363363{
364364   if (cur_control2 & 0x10)   // RAM enable
365365   {
366      paletteram_xBBBBBGGGGGRRRRR_be_w(offset,data);
366      paletteram_xBBBBBGGGGGRRRRR_be_w(machine,offset,data);
367367   }
368368   else
369369   {
r1877r1878
372372         switch (offset)
373373         {
374374            case 0xc6:
375               sound_cmd_w(0, data);
375               sound_cmd_w(machine, 0, data);
376376               break;
377377
378378            case 0xc7:
379               sound_irq_w(0, data);
379               sound_irq_w(machine, 0, data);
380380               break;
381381
382382            case 0x40:
r1877r1878
386386            case 0x44:
387387            case 0x45:
388388            case 0x46:
389               K053244_w(offset-0x40, data);
389               K053244_w(machine, offset-0x40, data);
390390               break;
391391
392392            case 0x80:
r1877r1878
421421            case 0x9d:
422422            case 0x9e:
423423            case 0x9f:
424               K054000_w(offset-0x80, data);
424               K054000_w(machine, offset-0x80, data);
425425               break;
426426
427427            default:
r1877r1878
431431      }
432432      else if (offset < 0x1800)
433433      {
434         K053245_w((offset - 0x0800) & 0x07ff, data);
434         K053245_w(machine, (offset - 0x0800) & 0x07ff, data);
435435
436436      }
437437      else if (offset < 0x2000)
438         K056832_ram_code_lo_w(offset - 0x1800, data);
438         K056832_ram_code_lo_w(machine, offset - 0x1800, data);
439439      else if (offset < 0x2800)
440         K056832_ram_code_hi_w(offset - 0x2000, data);
440         K056832_ram_code_hi_w(machine, offset - 0x2000, data);
441441      else if (offset < 0x3000)
442         K056832_ram_attr_lo_w(offset - 0x2800, data);
442         K056832_ram_attr_lo_w(machine, offset - 0x2800, data);
443443      else // (offset < 0x3800)
444         K056832_ram_attr_hi_w(offset - 0x3000, data);
444         K056832_ram_attr_hi_w(machine, offset - 0x3000, data);
445445   }
446446}
447447
448448// use one more palette entry for the BG color
449449static WRITE8_HANDLER(le_bgcolor_w)
450450{
451   paletteram_xBBBBBGGGGGRRRRR_be_w(0x3800+offset, data);
451   paletteram_xBBBBBGGGGGRRRRR_be_w(machine,0x3800+offset, data);
452452}
453453
454454static READ8_HANDLER(guns_r)
r1877r1878
656656   /* basic machine hardware */
657657   MDRV_CPU_ADD_TAG("main", HD6309, MAIN_CLOCK/2)   // ???
658658   MDRV_CPU_PROGRAM_MAP(le_main, 0)
659   MDRV_CPU_VBLANK_INT(lethalen_interrupt, 1)
659   MDRV_CPU_VBLANK_INT("main", lethalen_interrupt)
660660
661661   MDRV_CPU_ADD_TAG("sound", Z80, 8000000)
662662   MDRV_CPU_PROGRAM_MAP(le_sound, 0)
src/mame/drivers/videopin.c
r1877r1878
7272
7373   /* both output latches are cleared on reset */
7474
75   videopin_out1_w(0, 0);
76   videopin_out2_w(0, 0);
75   videopin_out1_w(machine, 0, 0);
76   videopin_out2_w(machine, 0, 0);
7777}
7878
7979
r1877r1878
134134   if (i == 7)
135135      set_led_status(0, data & 8);   /* start button */
136136
137   cpunum_set_input_line(Machine, 0, 0, CLEAR_LINE);
137   cpunum_set_input_line(machine, 0, 0, CLEAR_LINE);
138138}
139139
140140
r1877r1878
152152   mask = ~data & 0x10;
153153
154154   if (mask)
155      cpunum_set_input_line(Machine, 0, INPUT_LINE_NMI, CLEAR_LINE);
155      cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, CLEAR_LINE);
156156
157157   coin_lockout_global_w(~data & 0x08);
158158
159159   /* Convert octave data to divide value and write to sound */
160   discrete_sound_w(VIDEOPIN_OCTAVE_DATA, (0x01 << (~data & 0x07)) & 0xfe);
160   discrete_sound_w(machine, VIDEOPIN_OCTAVE_DATA, (0x01 << (~data & 0x07)) & 0xfe);
161161}
162162
163163
r1877r1878
174174
175175   coin_counter_w(0, data & 0x10);
176176
177   discrete_sound_w(VIDEOPIN_BELL_EN, data & 0x40);   // Bell
178   discrete_sound_w(VIDEOPIN_BONG_EN, data & 0x20);   // Bong
179   discrete_sound_w(VIDEOPIN_ATTRACT_EN, data & 0x80);   // Attract
180   discrete_sound_w(VIDEOPIN_VOL_DATA, data & 0x07);      // Vol0,1,2
177   discrete_sound_w(machine, VIDEOPIN_BELL_EN, data & 0x40);   // Bell
178   discrete_sound_w(machine, VIDEOPIN_BONG_EN, data & 0x20);   // Bong
179   discrete_sound_w(machine, VIDEOPIN_ATTRACT_EN, data & 0x80);   // Attract
180   discrete_sound_w(machine, VIDEOPIN_VOL_DATA, data & 0x07);      // Vol0,1,2
181181}
182182
183183
184184static WRITE8_HANDLER( videopin_note_dvsr_w )
185185{
186186   /* note data */
187   discrete_sound_w(VIDEOPIN_NOTE_DATA, ~data &0xff);
187   discrete_sound_w(machine, VIDEOPIN_NOTE_DATA, ~data &0xff);
188188}
189189
190190
src/mame/drivers/exprraid.c
r1877r1878
9999
100100static WRITE8_HANDLER( sound_cpu_command_w )
101101{
102    soundlatch_w(0,data);
103    cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
102    soundlatch_w(machine,0,data);
103    cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
104104}
105105
106106static READ8_HANDLER( vblank_r )
r1877r1878
307307   /* basic machine hardware */
308308   MDRV_CPU_ADD(M6502, 4000000)        /* 4 MHz ??? */
309309   MDRV_CPU_PROGRAM_MAP(master_map, 0)
310   MDRV_CPU_VBLANK_INT(exprraid_interrupt,1)
310   MDRV_CPU_VBLANK_INT("main", exprraid_interrupt)
311311
312312   MDRV_CPU_ADD(M6809, 2000000)        /* 2 MHz ??? */
313313   MDRV_CPU_PROGRAM_MAP(slave_map, 0)
src/mame/drivers/tecmo16.c
r1877r1878
6262{
6363   if (ACCESSING_LSB)
6464   {
65      soundlatch_w(0x00,data & 0xff);
66      cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
65      soundlatch_w(machine,0x00,data & 0xff);
66      cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
6767   }
6868}
6969
r1877r1878
443443   /* basic machine hardware */
444444   MDRV_CPU_ADD(M68000,24000000/2)         /* 12MHz */
445445   MDRV_CPU_PROGRAM_MAP(fstarfrc_readmem,fstarfrc_writemem)
446   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
446   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)
447447
448448   MDRV_CPU_ADD(Z80,8000000/2)
449449   /* audio CPU */         /* 4MHz */
r1877r1878
484484   /* basic machine hardware */
485485   MDRV_CPU_ADD(M68000,24000000/2)         /* 12MHz */
486486   MDRV_CPU_PROGRAM_MAP(ginkun_readmem,ginkun_writemem)
487   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
487   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)
488488
489489   MDRV_CPU_ADD(Z80,8000000/2)
490490   /* audio CPU */         /* 4MHz */
src/mame/drivers/2mindril.c
r1877r1878
195195static MACHINE_DRIVER_START( drill )
196196   MDRV_CPU_ADD_TAG("main", M68000, 16000000 )
197197   MDRV_CPU_PROGRAM_MAP(drill_map,0)
198   MDRV_CPU_VBLANK_INT(drill_interrupt,1)
198   MDRV_CPU_VBLANK_INT("main", drill_interrupt)
199199   MDRV_GFXDECODE(2mindril)
200200
201201   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/csk.c
r1877r1878
128128
129129
130130#include "driver.h"
131#include "deprecat.h"
131132#include "cpu/z80/z80.h"
132133#include "sound/2413intf.h"
133134
r1877r1878
737738   MDRV_CPU_ADD_TAG("main",Z80, 3579545)
738739   MDRV_CPU_PROGRAM_MAP(map,0)
739740   MDRV_CPU_IO_MAP(cpoker_map,0)
740   MDRV_CPU_VBLANK_INT(cpoker_interrupt,8)
741   MDRV_CPU_VBLANK_INT_HACK(cpoker_interrupt,8)
741742
742743   MDRV_MACHINE_RESET(cpk)
743744
r1877r1878
768769   MDRV_CPU_MODIFY("main")
769770   /* basic machine hardware */
770771   MDRV_CPU_IO_MAP(csk227_map,0)
771   MDRV_CPU_VBLANK_INT(cska_interrupt,8)
772   MDRV_CPU_VBLANK_INT_HACK(cska_interrupt,8)
772773   MDRV_GFXDECODE(csk)
773774
774775MACHINE_DRIVER_END
r1877r1878
779780   MDRV_CPU_MODIFY("main")
780781   /* basic machine hardware */
781782   MDRV_CPU_IO_MAP(csk234_map,0)
782   MDRV_CPU_VBLANK_INT(cska_interrupt,8)
783   MDRV_CPU_VBLANK_INT_HACK(cska_interrupt,8)
783784   MDRV_GFXDECODE(csk)
784785
785786MACHINE_DRIVER_END
src/mame/drivers/naughtyb.c
r1877r1878
111111
112112static READ8_HANDLER( in0_port_r )
113113{
114   int in0 = input_port_0_r(0);
114   int in0 = input_port_0_r(machine,0);
115115
116116   if ( naughtyb_cocktail )
117117   {
118118      // cabinet == cocktail -AND- handling player 2
119119
120120      in0 = ( in0 & 0x03 ) |            // start buttons
121           ( input_port_1_r(0) & 0xFC );   // cocktail inputs
121           ( input_port_1_r(machine,0) & 0xFC );   // cocktail inputs
122122   }
123123
124124   return in0;
r1877r1878
128128{
129129   // vblank replaces the cabinet dip
130130
131   return ( ( input_port_2_r(0) & 0x7F ) |      // dsw0
132             ( input_port_3_r(0) & 0x80 ) );   // vblank
131   return ( ( input_port_2_r(machine,0) & 0x7F ) |      // dsw0
132             ( input_port_3_r(machine,0) & 0x80 ) );   // vblank
133133}
134134
135135/* Pop Flamer
r1877r1878
381381   /* basic machine hardware */
382382   MDRV_CPU_ADD(Z80, CLOCK_XTAL / 4) /* 12 MHz clock, divided by 4. CPU is a Z80A */
383383   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
384   MDRV_CPU_VBLANK_INT(naughtyb_interrupt,1)
384   MDRV_CPU_VBLANK_INT("main", naughtyb_interrupt)
385385
386386   /* video hardware */
387387   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
418418   /* basic machine hardware */
419419   MDRV_CPU_ADD(Z80, CLOCK_XTAL / 4) /* 12 MHz clock, divided by 4. CPU is a Z80A */
420420   MDRV_CPU_PROGRAM_MAP(readmem,popflame_writemem)
421   MDRV_CPU_VBLANK_INT(naughtyb_interrupt,1)
421   MDRV_CPU_VBLANK_INT("main", naughtyb_interrupt)
422422
423423   /* video hardware */
424424   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/taitowlf.c
r1877r1878
3737   }
3838}
3939
40static void draw_char(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, const gfx_element *gfx, int ch, int att, int x, int y)
40static void draw_char(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const gfx_element *gfx, int ch, int att, int x, int y)
4141{
4242   int i,j;
4343   UINT8 *dp;
r1877r1878
8686
8787static READ8_HANDLER(at_dma8237_1_r)
8888{
89   return dma8237_1_r(offset / 2);
89   return dma8237_1_r(machine, offset / 2);
9090}
9191
9292static WRITE8_HANDLER(at_dma8237_1_w)
9393{
94   dma8237_1_w(offset / 2, data);
94   dma8237_1_w(machine, offset / 2, data);
9595}
9696
9797static READ32_HANDLER(at32_dma8237_1_r)
9898{
99   return read32le_with_read8_handler(at_dma8237_1_r, offset, mem_mask);
99   return read32le_with_read8_handler(at_dma8237_1_r, machine, offset, mem_mask);
100100}
101101
102102static WRITE32_HANDLER(at32_dma8237_1_w)
103103{
104   write32le_with_write8_handler(at_dma8237_1_w, offset, data, mem_mask);
104   write32le_with_write8_handler(at_dma8237_1_w, machine, offset, data, mem_mask);
105105}
106106
107107
r1877r1878
269269
270270static READ32_HANDLER( ide0_r )
271271{
272   return ide_controller32_0_r(0x1f0/4 + offset, mem_mask);
272   return ide_controller32_0_r(machine, 0x1f0/4 + offset, mem_mask);
273273}
274274
275275static WRITE32_HANDLER( ide0_w )
276276{
277   ide_controller32_0_w(0x1f0/4 + offset, data, mem_mask);
277   ide_controller32_0_w(machine, 0x1f0/4 + offset, data, mem_mask);
278278}
279279
280280static READ32_HANDLER( fdc_r )
281281{
282   return ide_controller32_0_r(0x3f0/4 + offset, mem_mask);
282   return ide_controller32_0_r(machine, 0x3f0/4 + offset, mem_mask);
283283}
284284
285285static WRITE32_HANDLER( fdc_w )
286286{
287287   //mame_printf_debug("FDC: write %08X, %08X, %08X\n", data, offset, mem_mask);
288   ide_controller32_0_w(0x3f0/4 + offset, data, mem_mask);
288   ide_controller32_0_w(machine, 0x3f0/4 + offset, data, mem_mask);
289289}
290290
291291
r1877r1878
529529
530530/*****************************************************************************/
531531
532GAME(1997, pf2012, 0,   taitowlf, taitowlf, taitowlf,   ROT0,   "Taito",  "Psychic Force 2012", GAME_NOT_WORKING | GAME_NO_SOUND);
532GAME(1997, pf2012, 0,   taitowlf, taitowlf, taitowlf,   ROT0,   "Taito",  "Psychic Force 2012", GAME_NOT_WORKING | GAME_NO_SOUND)
src/mame/drivers/toypop.c
r1877r1878
137137static WRITE8_HANDLER( toypop_sound_sharedram_w )
138138{
139139   if (offset < 0x40)
140      namco_15xx_w(offset,data);
140      namco_15xx_w(machine,offset,data);
141141   else
142142      namco_soundregs[offset] = data;
143143}
r1877r1878
571571   /* basic machine hardware */
572572   MDRV_CPU_ADD_TAG("main", M6809, 1536000)   /* 1.536 MHz (measured on Libble Rabble board) */
573573   MDRV_CPU_PROGRAM_MAP(readmem_mainCPU_liblrabl,writemem_mainCPU_liblrabl)
574   MDRV_CPU_VBLANK_INT(toypop_main_interrupt,1)
574   MDRV_CPU_VBLANK_INT("main", toypop_main_interrupt)
575575
576576   MDRV_CPU_ADD(M6809, 1536000)
577577   /* audio CPU */
578578   MDRV_CPU_PROGRAM_MAP(readmem_soundCPU,writemem_soundCPU)
579   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
579   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
580580
581581   MDRV_CPU_ADD(M68000, 6144000)   /* 6.144 MHz (measured on Libble Rabble board) */
582582   MDRV_CPU_PROGRAM_MAP(readmem_68k,writemem_68k)
583   MDRV_CPU_VBLANK_INT(toypop_m68000_interrupt,1)
583   MDRV_CPU_VBLANK_INT("main", toypop_m68000_interrupt)
584584
585585   MDRV_INTERLEAVE(100)    /* 100 CPU slices per frame - an high value to ensure proper */
586586                     /* synchronization of the CPUs */
src/mame/drivers/tumbleb.c
r1877r1878
316316
317317static WRITE16_HANDLER( tumblepb_oki_w )
318318{
319
320
321319   if (mem_mask==0x0000)
322320   {
323      OKIM6295_data_0_w(0,data&0xff);
321      OKIM6295_data_0_w(machine,0,data&0xff);
324322      //printf("tumbleb_oki_w %04x %04x\n",data,mem_mask);
325323   }
326324   else
327325   {
328      OKIM6295_data_0_w(0,(data>>8)&0xff);
326      OKIM6295_data_0_w(machine,0,(data>>8)&0xff);
329327      //printf("tumbleb_oki_w %04x %04x\n",data,mem_mask);
330328   }
331329    /* STUFF IN OTHER BYTE TOO..*/
r1877r1878
339337#ifdef UNUSED_FUNCTION
340338static WRITE16_HANDLER( tumblepb_sound_w )
341339{
342   soundlatch_w(0,data & 0xff);
340   soundlatch_w(machine,0,data & 0xff);
343341   cpunum_set_input_line(machine, 1,0,HOLD_LINE);
344342}
345343#endif
346344
347345static WRITE16_HANDLER( jumppop_sound_w )
348346{
349   soundlatch_w(0,data & 0xff);
350   cpunum_set_input_line(Machine, 1, 0, ASSERT_LINE );
347   soundlatch_w(machine,0,data & 0xff);
348   cpunum_set_input_line(machine, 1, 0, ASSERT_LINE );
351349}
352350
353351/******************************************************************************/
r1877r1878
444442static int tumblep_music_bank;
445443static int tumbleb2_music_is_playing;
446444
447static void tumbleb2_playmusic(void)
445static void tumbleb2_playmusic(running_machine *machine)
448446{
449   int status = OKIM6295_status_0_r(0);
447   int status = OKIM6295_status_0_r(machine,0);
450448
451449   if (tumbleb2_music_is_playing)
452450   {
453451      if ((status&0x08)==0x00)
454452      {
455         OKIM6295_data_0_w(0,0x80|tumblep_music_command);
456         OKIM6295_data_0_w(0,0x00|0x82);
453         OKIM6295_data_0_w(machine,0,0x80|tumblep_music_command);
454         OKIM6295_data_0_w(machine,0,0x00|0x82);
457455      }
458456   }
459457}
r1877r1878
462460static INTERRUPT_GEN( tumbleb2_interrupt )
463461{
464462   cpunum_set_input_line(machine, 0, 6, HOLD_LINE);
465   tumbleb2_playmusic();
463   tumbleb2_playmusic(machine);
466464}
467465
468466static const int tumbleb_sound_lookup[256] = {
r1877r1878
492490   memcpy(&oki[0x38000], &oki[0x80000+0x38000+0x8000*bank],0x8000);
493491}
494492
495static void tumbleb2_play_sound (int data)
493static void tumbleb2_play_sound (running_machine *machine, int data)
496494{
497   int status = OKIM6295_status_0_r(0);
495   int status = OKIM6295_status_0_r(machine,0);
498496
499497   if ((status&0x01)==0x00)
500498   {
501      OKIM6295_data_0_w(0,0x80|data);
502      OKIM6295_data_0_w(0,0x00|0x12);
499      OKIM6295_data_0_w(machine,0,0x80|data);
500      OKIM6295_data_0_w(machine,0,0x00|0x12);
503501   }
504502   else if ((status&0x02)==0x00)
505503   {
506      OKIM6295_data_0_w(0,0x80|data);
507      OKIM6295_data_0_w(0,0x00|0x22);
504      OKIM6295_data_0_w(machine,0,0x80|data);
505      OKIM6295_data_0_w(machine,0,0x00|0x22);
508506   }
509507   else if ((status&0x04)==0x00)
510508   {
511      OKIM6295_data_0_w(0,0x80|data);
512      OKIM6295_data_0_w(0,0x00|0x42);
509      OKIM6295_data_0_w(machine,0,0x80|data);
510      OKIM6295_data_0_w(machine,0,0x00|0x42);
513511   }
514512}
515513
r1877r1878
525523// bank 7 = how to play?
526524// bank 8 = boss???
527525
528static void process_tumbleb2_music_command(int data)
526static void process_tumbleb2_music_command(running_machine *machine, int data)
529527{
530   int status = OKIM6295_status_0_r(0);
528   int status = OKIM6295_status_0_r(machine,0);
531529
532530   if (data == 1) // stop?
533531   {
534532      if ((status&0x08)==0x08)
535533      {
536         OKIM6295_data_0_w(0,0x40);      /* Stop playing music */
534         OKIM6295_data_0_w(machine,0,0x40);      /* Stop playing music */
537535         tumbleb2_music_is_playing = 0;
538536      }
539537   }
r1877r1878
542540      if (tumbleb2_music_is_playing != data)
543541      {
544542         tumbleb2_music_is_playing = data;
545         OKIM6295_data_0_w(0,0x40); // stop the current music
543         OKIM6295_data_0_w(machine,0,0x40); // stop the current music
546544         switch (data)
547545         {
548546            case 0x04: // map screen
r1877r1878
616614               break;
617615         }
618616         tumbleb2_set_music_bank(tumblep_music_bank);
619         tumbleb2_playmusic();
617         tumbleb2_playmusic(machine);
620618
621619      }
622620
r1877r1878
638636   }
639637   else if (sound == -2)
640638   {
641      process_tumbleb2_music_command(data);
639      process_tumbleb2_music_command(machine, data);
642640   }
643641   else
644642   {
645      tumbleb2_play_sound(sound);
643      tumbleb2_play_sound(machine, sound);
646644   }
647645}
648646
r1877r1878
768766
769767static WRITE16_HANDLER( jumpkids_sound_w )
770768{
771   soundlatch_w(0,data & 0xff);
772   cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
769   soundlatch_w(machine,0,data & 0xff);
770   cpunum_set_input_line(machine, 1,0,HOLD_LINE);
773771}
774772
775773
r1877r1878
851849{
852850   if (ACCESSING_LSB)
853851   {
854      soundlatch_w(0,data & 0xff);
852      soundlatch_w(machine,0,data & 0xff);
855853      // needed for Super Trio which reads the sound with polling
856854//      cpu_spinuntil_time(ATTOTIME_IN_USEC(100));
857855      cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(20));
r1877r1878
896894
897895static READ8_HANDLER(jumppop_z80latch_r)
898896{
899   cpunum_set_input_line(Machine, 1, 0, CLEAR_LINE);
900   return soundlatch_r(0);
897   cpunum_set_input_line(machine, 1, 0, CLEAR_LINE);
898   return soundlatch_r(machine, 0);
901899}
902900
903901static ADDRESS_MAP_START( jumppop_sound_io_map, ADDRESS_SPACE_IO, 8 )
r1877r1878
17831781    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
17841782INPUT_PORTS_END
17851783
1784#ifdef UNUSED_DEFINITION
17861785static INPUT_PORTS_START( dquizgo )
17871786   PORT_START   /* Player 1 controls */
17881787   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
r1877r1878
18531852   PORT_DIPSETTING(    0x40, "4" )
18541853   PORT_DIPSETTING(    0x80, "5" )
18551854INPUT_PORTS_END
1855#endif
18561856
18571857static INPUT_PORTS_START( jumppop )
18581858   PORT_START   /* Controls */
r1877r1878
20322032   /* basic machine hardware */
20332033   MDRV_CPU_ADD(M68000, 14000000)
20342034   MDRV_CPU_PROGRAM_MAP(tumblepopb_readmem,tumblepopb_writemem)
2035   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
2035   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
20362036
20372037   /* video hardware */
20382038   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
20622062   /* basic machine hardware */
20632063   MDRV_CPU_ADD(M68000, 14000000)
20642064   MDRV_CPU_PROGRAM_MAP(tumblepopb_readmem,tumblepopb_writemem)
2065   MDRV_CPU_VBLANK_INT(tumbleb2_interrupt,1)
2065   MDRV_CPU_VBLANK_INT("main", tumbleb2_interrupt)
20662066
20672067   /* video hardware */
20682068   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
20912091   /* basic machine hardware */
20922092   MDRV_CPU_ADD(M68000, 12000000)
20932093   MDRV_CPU_PROGRAM_MAP(jumpkids_readmem,jumpkids_writemem)
2094   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
2094   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
20952095
20962096   /* z80? */
20972097   MDRV_CPU_ADD( Z80, 8000000/2)
r1877r1878
21232123   /* basic machine hardware */
21242124   MDRV_CPU_ADD(M68000, 12000000)
21252125   MDRV_CPU_PROGRAM_MAP(fncywld_readmem,fncywld_writemem)
2126   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
2126   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
21272127
21282128   /* video hardware */
21292129   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
21812181   /* basic machine hardware */
21822182   MDRV_CPU_ADD(M68000, 15000000) /* verified */
21832183   MDRV_CPU_PROGRAM_MAP(htchctch_readmem,htchctch_writemem)
2184   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
2184   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
21852185
21862186   MDRV_CPU_ADD( Z80, 15000000/4) /* verified on dquizgo */
21872187
r1877r1878
22582258   /* basic machine hardware */
22592259   MDRV_CPU_ADD(M68000, 16000000)
22602260   MDRV_CPU_PROGRAM_MAP(jumppop_readmem,jumppop_writemem)
2261   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
2261   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
22622262
22632263   MDRV_CPU_ADD(Z80, 3500000) /* verified */
22642264   /* audio CPU */
r1877r1878
22972297   /* basic machine hardware */
22982298   MDRV_CPU_ADD(M68000, 14000000) /* 14mhz should be correct, but lots of sprite flicker later in game */
22992299   MDRV_CPU_PROGRAM_MAP(suprtrio_main_cpu,0)
2300   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
2300   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
23012301
23022302   MDRV_CPU_ADD(Z80, 8000000)
23032303   /* audio CPU */
r1877r1878
23312331   /* basic machine hardware */
23322332   MDRV_CPU_ADD(M68000, 14000000)
23332333   MDRV_CPU_PROGRAM_MAP(pangpang_readmem,pangpang_writemem)
2334   MDRV_CPU_VBLANK_INT(tumbleb2_interrupt,1)
2334   MDRV_CPU_VBLANK_INT("main", tumbleb2_interrupt)
23352335
23362336   /* video hardware */
23372337   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/micro3d.c
r1877r1878
137137}
138138
139139
140static void micro3d_scanline_update(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params)
140static void micro3d_scanline_update(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params)
141141{
142142   UINT16 *src = &micro3d_sprite_vram[(params->rowaddr << 8) & 0x7fe00];
143143   UINT16 *dest = BITMAP_ADDR16(bitmap, scanline, 0);
r1877r1878
796796
797797                    if(data & 0x10)
798798                    {
799                       upd7759_0_reset_w(0,0);
799                       upd7759_0_reset_w(machine,0,0);
800800                    }
801801                    else
802802                    {
803                       upd7759_0_reset_w(0,1);
803                       upd7759_0_reset_w(machine,0,1);
804804                    }
805805                    break;
806806}
r1877r1878
812812switch(offset)
813813{
814814        case 0x01:  return readinputport(3);                           /* Test push switch */
815        case 0x03:  return (int)(upd7759_0_busy_r(0))<<3;
815        case 0x03:  return (int)(upd7759_0_busy_r(machine,0))<<3;
816816        default:    return 0;
817817}
818818
r1877r1878
861861static MACHINE_DRIVER_START( micro3d )
862862   MDRV_CPU_ADD(M68000, 12000000 )
863863   MDRV_CPU_PROGRAM_MAP(hostmem,0)
864   MDRV_CPU_VBLANK_INT(micro3d_vblank,1)
864   MDRV_CPU_VBLANK_INT("main", micro3d_vblank)
865865
866866    MDRV_CPU_ADD(TMS34010, 40000000)
867867   MDRV_CPU_CONFIG(vgb_config)
src/mame/drivers/momoko.c
r1877r1878
253253   /* basic machine hardware */
254254   MDRV_CPU_ADD(Z80, 5000000)   /* 5.0MHz */
255255   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
256   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
256   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
257257
258258   MDRV_CPU_ADD(Z80, 2500000)
259259   /* audio CPU */   /* 2.5MHz */
src/mame/drivers/kchamp.c
r1877r1878
128128}
129129
130130static WRITE8_HANDLER( sound_command_w ) {
131   soundlatch_w( 0, data );
132   cpunum_set_input_line_and_vector(Machine, 1, 0, HOLD_LINE, 0xff );
131   soundlatch_w( machine, 0, data );
132   cpunum_set_input_line_and_vector(machine, 1, 0, HOLD_LINE, 0xff );
133133}
134134
135135static int msm_data = 0;
r1877r1878
444444   MDRV_CPU_ADD(Z80, 3000000)   /* 12MHz / 4 = 3.0 MHz */
445445   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
446446   MDRV_CPU_IO_MAP(readport,writeport)
447   MDRV_CPU_VBLANK_INT(kc_interrupt,1)
447   MDRV_CPU_VBLANK_INT("main", kc_interrupt)
448448
449449   MDRV_CPU_ADD(Z80, 3000000)
450450   /* audio CPU */   /* 12MHz / 4 = 3.0 MHz */
r1877r1878
492492   MDRV_CPU_ADD(Z80, 3000000)   /* 12MHz / 4 = 3.0 MHz */
493493   MDRV_CPU_PROGRAM_MAP(kc_readmem,kc_writemem)
494494   MDRV_CPU_IO_MAP(kc_readport,kc_writeport)
495   MDRV_CPU_VBLANK_INT(kc_interrupt,1)
495   MDRV_CPU_VBLANK_INT("main", kc_interrupt)
496496
497497   MDRV_CPU_ADD(Z80, 3000000)
498498   /* audio CPU */   /* 12MHz / 4 = 3.0 MHz */
src/mame/drivers/olibochu.c
r1877r1878
9292      8, 8, 32, 32);
9393}
9494
95static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
95static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
9696{
9797   int offs;
9898
r1877r1878
173173   for (c = 15;c >= 0;c--)
174174      if (cmd & (1 << c)) break;
175175
176   if (c >= 0) soundlatch_w(0,15-c);
176   if (c >= 0) soundlatch_w(machine,0,15-c);
177177}
178178
179179
r1877r1878
368368   /* basic machine hardware */
369369   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz ?? */
370370   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
371   MDRV_CPU_VBLANK_INT(olibochu_interrupt,2)
371   MDRV_CPU_VBLANK_INT_HACK(olibochu_interrupt,2)
372372
373373   MDRV_CPU_ADD(Z80, 4000000)
374374   /* audio CPU */   /* 4 MHz ?? */
375375   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
376   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
376   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
377377
378378   /* video hardware */
379379   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/ultratnk.c
r1877r1878
133133
134134static WRITE8_HANDLER( ultratnk_fire_1_w )
135135{
136   discrete_sound_w(ULTRATNK_FIRE_EN_1, offset & 1);
136   discrete_sound_w(machine, ULTRATNK_FIRE_EN_1, offset & 1);
137137}
138138static WRITE8_HANDLER( ultratnk_fire_2_w )
139139{
140   discrete_sound_w(ULTRATNK_FIRE_EN_2, offset & 1);
140   discrete_sound_w(machine, ULTRATNK_FIRE_EN_2, offset & 1);
141141}
142142static WRITE8_HANDLER( ultratnk_attract_w )
143143{
144   discrete_sound_w(ULTRATNK_ATTRACT_EN, data & 1);
144   discrete_sound_w(machine, ULTRATNK_ATTRACT_EN, data & 1);
145145}
146146static WRITE8_HANDLER( ultratnk_explosion_w )
147147{
148   discrete_sound_w(ULTRATNK_EXPLOSION_DATA, data & 15);
148   discrete_sound_w(machine, ULTRATNK_EXPLOSION_DATA, data & 15);
149149}
150150
151151
src/mame/drivers/m90.c
r1877r1878
2525*****************************************************************************/
2626
2727#include "driver.h"
28#include "deprecat.h"
2829#include "m92.h"
2930#include "machine/irem_cpu.h"
3031#include "audio/m72.h"
r1877r1878
655656   MDRV_CPU_ADD_TAG("main", V30,32000000/4)
656657   MDRV_CPU_PROGRAM_MAP(main_cpu,0)
657658   MDRV_CPU_IO_MAP(main_cpu_io,0)
658   MDRV_CPU_VBLANK_INT(m90_interrupt,1)
659   MDRV_CPU_VBLANK_INT("main", m90_interrupt)
659660
660661   MDRV_CPU_ADD(Z80, 3579545)
661662   /* audio CPU */   /* 3.579545 MHz */
662663   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
663664   MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
664   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
665   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
665666                        /* IRQs are generated by main Z80 and YM2151 */
666667
667668   MDRV_MACHINE_RESET(m72_sound)
r1877r1878
738739
739740   MDRV_CPU_PROGRAM_MAP(main_cpu,0)
740741   MDRV_CPU_IO_MAP(main_cpu_io,0)
741   MDRV_CPU_VBLANK_INT(m90_interrupt,1)
742   MDRV_CPU_VBLANK_INT("main", m90_interrupt)
742743
743744   MDRV_CPU_ADD(Z80, 3579545)
744745   /* audio CPU */   /* 3.579545 MHz */
745746   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
746747   MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
747   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
748   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
748749                        /* IRQs are generated by main Z80 and YM2151 */
749750   MDRV_MACHINE_RESET(m72_sound)
750751
r1877r1878
784785
785786   MDRV_CPU_PROGRAM_MAP(main_cpu,0)
786787   MDRV_CPU_IO_MAP(main_cpu_io,0)
787   MDRV_CPU_VBLANK_INT(m90_interrupt,1)
788   MDRV_CPU_VBLANK_INT("main", m90_interrupt)
788789
789790   MDRV_CPU_ADD(Z80, 3579545)
790791   /* audio CPU */   /* 3.579545 MHz */
791792   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
792793   MDRV_CPU_IO_MAP(bbmanw_sound_readport,bbmanw_sound_writeport)
793   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
794   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
794795                        /* IRQs are generated by main Z80 and YM2151 */
795796   MDRV_MACHINE_RESET(m72_sound)
796797
r1877r1878
829830   MDRV_CPU_MODIFY("main")
830831   MDRV_CPU_CONFIG(no_table)
831832
832   MDRV_CPU_VBLANK_INT(bomblord_interrupt,1)
833   MDRV_CPU_VBLANK_INT("main", bomblord_interrupt)
833834
834835MACHINE_DRIVER_END
835836
r1877r1878
841842   MDRV_CPU_ADD_TAG("main", V30,32000000/4)
842843   MDRV_CPU_PROGRAM_MAP(bootleg_main_cpu,0)
843844   MDRV_CPU_IO_MAP(main_cpu_io,0)
844   MDRV_CPU_VBLANK_INT(m90_interrupt,1)
845   MDRV_CPU_VBLANK_INT("main", m90_interrupt)
845846
846847   MDRV_CPU_ADD(Z80, 3579545)
847848   /* audio CPU */   /* 3.579545 MHz */
848849   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
849850   MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
850   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
851   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
851852                        /* IRQs are generated by main Z80 and YM2151 */
852853   MDRV_MACHINE_RESET(m72_sound)
853854
src/mame/drivers/tugboat.c
r1877r1878
7979      if (offset<0x8 ) tugboat_ram[0x291d + 32*offset + 32*9] = data ^ 0x0f;
8080}
8181
82static void draw_tilemap(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,
82static void draw_tilemap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,
8383      int addr,int gfx0,int gfx1,int transparency)
8484{
8585   int x,y;
r1877r1878
374374static MACHINE_DRIVER_START( tugboat )
375375   MDRV_CPU_ADD_TAG("main", M6502, 2000000)   /* 2 MHz ???? */
376376   MDRV_CPU_PROGRAM_MAP(tugboat_readmem,tugboat_writemem)
377   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
377   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
378378
379379   MDRV_MACHINE_START(tugboat)
380380   MDRV_MACHINE_RESET(tugboat)
src/mame/drivers/gunbustr.c
r1877r1878
9292   {
9393      case 0x00:
9494      {
95         return (input_port_0_word_r(0,0) << 16) | input_port_1_word_r(0,0) |
95         return (input_port_0_word_r(machine,0,0) << 16) | input_port_1_word_r(machine,0,0) |
9696              (EEPROM_read_bit() << 7);
9797      }
9898
9999      case 0x01:
100100      {
101         return input_port_2_word_r(0,0) | (coin_word << 16);
101         return input_port_2_word_r(machine,0,0) | (coin_word << 16);
102102      }
103103    }
104104logerror("CPU #0 PC %06x: read input %06x\n",activecpu_get_pc(),offset);
r1877r1878
126126      {
127127         if (ACCESSING_MSB32)   /* $400000 is watchdog */
128128         {
129            watchdog_reset_w(0,data >> 24);
129            watchdog_reset(machine);
130130         }
131131
132132         if (ACCESSING_LSB32)
r1877r1878
175175
176176static READ32_HANDLER( gunbustr_gun_r )
177177{
178   return ( input_port_3_word_r(0,0) << 24) | (input_port_4_word_r(0,0) << 16) |
179       ( input_port_5_word_r(0,0) << 8)  |  input_port_6_word_r(0,0);
178   return ( input_port_3_word_r(machine,0,0) << 24) | (input_port_4_word_r(machine,0,0) << 16) |
179       ( input_port_5_word_r(machine,0,0) << 8)  |  input_port_6_word_r(machine,0,0);
180180}
181181
182182static WRITE32_HANDLER( gunbustr_gun_w )
r1877r1878
377377   /* basic machine hardware */
378378   MDRV_CPU_ADD(M68EC020, 16000000)   /* 16 MHz */
379379   MDRV_CPU_PROGRAM_MAP(gunbustr_readmem,gunbustr_writemem)
380   MDRV_CPU_VBLANK_INT(gunbustr_interrupt,1) /* VBL */
380   MDRV_CPU_VBLANK_INT("main", gunbustr_interrupt) /* VBL */
381381
382382   TAITO_F3_SOUND_SYSTEM_CPU(16000000)
383383
src/mame/drivers/scotrsht.c
r1877r1878
3737
3838static WRITE8_HANDLER( scotrsht_soundlatch_w )
3939{
40   soundlatch_w(0,data);
41   cpunum_set_input_line(Machine, 1, 0, HOLD_LINE);
40   soundlatch_w(machine,0,data);
41   cpunum_set_input_line(machine, 1, 0, HOLD_LINE);
4242}
4343
4444static ADDRESS_MAP_START( scotrsht_map, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
226226   /* basic machine hardware */
227227   MDRV_CPU_ADD(M6809, 18432000/6)        /* 3.072 MHz */
228228   MDRV_CPU_PROGRAM_MAP(scotrsht_map,0)
229   MDRV_CPU_VBLANK_INT(scotrsht_interrupt,1)
229   MDRV_CPU_VBLANK_INT("main", scotrsht_interrupt)
230230
231231   MDRV_CPU_ADD(Z80, 18432000/6)
232232   /* audio CPU */        /* 3.072 MHz */
src/mame/drivers/taito_z.c
r1877r1878
10131013         break;
10141014
10151015      default:
1016         TC0220IOC_w( offset,data );   /* might be a 510NIO ! */
1016         TC0220IOC_w( machine,offset,data );   /* might be a 510NIO ! */
10171017   }
10181018}
10191019
r1877r1878
10261026{
10271027   /* Bypass TC0220IOC controller for analog input */
10281028
1029   UINT8 port = TC0220IOC_port_r(0);   /* read port number */
1029   UINT8 port = TC0220IOC_port_r(machine,0);   /* read port number */
10301030   int steer = 0;
1031   int fake = input_port_6_word_r(0,0);
1031   int fake = input_port_6_word_r(machine,0,0);
10321032
10331033   if (!(fake &0x10))   /* Analogue steer (the real control method) */
10341034   {
10351035      /* center around zero and reduce span to 0xc0 */
1036      steer = ((input_port_5_word_r(0,0) - 0x80) * 0xc0) / 0x100;
1036      steer = ((input_port_5_word_r(machine,0,0) - 0x80) * 0xc0) / 0x100;
10371037
10381038   }
10391039   else   /* Digital steer */
r1877r1878
10571057         return steer >> 8;
10581058
10591059      default:
1060         return TC0220IOC_portreg_r( offset );
1060         return TC0220IOC_portreg_r( machine,offset );
10611061   }
10621062}
10631063
r1877r1878
10661066{
10671067   /* Bypass TC0220IOC controller for extra inputs */
10681068
1069   UINT8 port = TC0220IOC_port_r(0);   /* read port number */
1069   UINT8 port = TC0220IOC_port_r(machine,0);   /* read port number */
10701070   int steer = 0;
1071   int fake = input_port_10_word_r(0,0);
1071   int fake = input_port_10_word_r(machine,0,0);
10721072
10731073   if (!(fake &0x10))   /* Analogue steer (the real control method) */
10741074   {
10751075      /* center around zero */
1076      steer = input_port_9_word_r(0,0) - 0x80;
1076      steer = input_port_9_word_r(machine,0,0) - 0x80;
10771077   }
10781078   else   /* Digital steer */
10791079   {
r1877r1878
10901090   switch (port)
10911091   {
10921092      case 0x08:
1093         return input_port_5_word_r(0,mem_mask);
1093         return input_port_5_word_r(machine,0,mem_mask);
10941094
10951095      case 0x09:
1096         return input_port_6_word_r(0,mem_mask);
1096         return input_port_6_word_r(machine,0,mem_mask);
10971097
10981098      case 0x0a:
1099         return input_port_7_word_r(0,mem_mask);
1099         return input_port_7_word_r(machine,0,mem_mask);
11001100
11011101      case 0x0b:
1102         return input_port_8_word_r(0,mem_mask);
1102         return input_port_8_word_r(machine,0,mem_mask);
11031103
11041104      case 0x0c:
11051105         return steer &0xff;
r1877r1878
11081108         return steer >> 8;
11091109
11101110      default:
1111         return TC0220IOC_portreg_r( offset );
1111         return TC0220IOC_portreg_r( machine, offset );
11121112   }
11131113}
11141114
r1877r1878
11181118   switch (offset)
11191119   {
11201120      case 0x00:
1121         return input_port_5_word_r(0,mem_mask);
1121         return input_port_5_word_r(machine,0,mem_mask);
11221122
11231123      case 0x01:
1124         return input_port_6_word_r(0,mem_mask);
1124         return input_port_6_word_r(machine,0,mem_mask);
11251125
11261126      case 0x02:
1127         return input_port_7_word_r(0,mem_mask);
1127         return input_port_7_word_r(machine,0,mem_mask);
11281128
11291129      case 0x03:
1130         return input_port_8_word_r(0,mem_mask);
1130         return input_port_8_word_r(machine,0,mem_mask);
11311131   }
11321132
11331133logerror("CPU #0 PC %06x: warning - read unmapped stick offset %06x\n",activecpu_get_pc(),offset);
r1877r1878
11511151   switch (offset)
11521152   {
11531153      case 0x00:
1154         return nightstr_stick[(input_port_5_word_r(0,mem_mask) * 0x64) / 0x100];
1154         return nightstr_stick[(input_port_5_word_r(machine,0,mem_mask) * 0x64) / 0x100];
11551155
11561156      case 0x01:
1157         return nightstr_stick[(input_port_6_word_r(0,mem_mask) * 0x64) / 0x100];
1157         return nightstr_stick[(input_port_6_word_r(machine,0,mem_mask) * 0x64) / 0x100];
11581158
11591159      case 0x02:
1160         return input_port_7_word_r(0,mem_mask);
1160         return input_port_7_word_r(machine,0,mem_mask);
11611161
11621162      case 0x03:
1163         return input_port_8_word_r(0,mem_mask);
1163         return input_port_8_word_r(machine,0,mem_mask);
11641164   }
11651165
11661166logerror("CPU #0 PC %06x: warning - read unmapped stick offset %06x\n",activecpu_get_pc(),offset);
r1877r1878
11831183static READ16_HANDLER( sci_steer_input_r )
11841184{
11851185   int steer = 0;
1186   int fake = input_port_6_word_r(0,0);
1186   int fake = input_port_6_word_r(machine,0,0);
11871187
11881188   if (!(fake &0x10))   /* Analogue steer (the real control method) */
11891189   {
11901190      /* center around zero and reduce span to 0xc0 */
1191      steer = ((input_port_5_word_r(0,0) - 0x80) * 0xc0) / 0x100;
1191      steer = ((input_port_5_word_r(machine,0,0) - 0x80) * 0xc0) / 0x100;
11921192   }
11931193   else   /* Digital steer */
11941194   {
r1877r1878
12251225         return eeprom_r();
12261226
12271227      default:
1228         return TC0220IOC_r( offset );   /* might be a 510NIO ! */
1228         return TC0220IOC_r( machine, offset );   /* might be a 510NIO ! */
12291229   }
12301230}
12311231
r1877r1878
12341234   switch (offset)
12351235   {
12361236      case 0x00:
1237         return input_port_5_word_r(0,mem_mask);   /* P1X */
1237         return input_port_5_word_r(machine,0,mem_mask);   /* P1X */
12381238
12391239      case 0x01:
1240         return input_port_6_word_r(0,mem_mask);   /* P1Y */
1240         return input_port_6_word_r(machine,0,mem_mask);   /* P1Y */
12411241
12421242      case 0x02:
1243         return input_port_7_word_r(0,mem_mask);   /* P2X */
1243         return input_port_7_word_r(machine,0,mem_mask);   /* P2X */
12441244
12451245      case 0x03:
1246         return input_port_8_word_r(0,mem_mask);   /* P2Y */
1246         return input_port_8_word_r(machine,0,mem_mask);   /* P2Y */
12471247   }
12481248
12491249   return 0x0;
r1877r1878
12661266static READ16_HANDLER( dblaxle_steer_input_r )
12671267{
12681268   int steer = 0;
1269   int fake = input_port_6_word_r(0,0);
1269   int fake = input_port_6_word_r(machine,0,0);
12701270
12711271   if (!(fake &0x10))   /* Analogue steer (the real control method) */
12721272   {
12731273      /* center around zero and reduce span to 0x80 */
1274      steer = ((input_port_5_word_r(0,0) - 0x80) * 0x80) / 0x100;
1274      steer = ((input_port_5_word_r(machine,0,0) - 0x80) * 0x80) / 0x100;
12751275   }
12761276   else   /* Digital steer */
12771277   {
r1877r1878
13491349static WRITE16_HANDLER( taitoz_sound_w )
13501350{
13511351   if (offset == 0)
1352      taitosound_port_w (0, data & 0xff);
1352      taitosound_port_w (machine, 0, data & 0xff);
13531353   else if (offset == 1)
1354      taitosound_comm_w (0, data & 0xff);
1354      taitosound_comm_w (machine, 0, data & 0xff);
13551355
13561356#ifdef MAME_DEBUG
13571357//  if (data & 0xff00)
r1877r1878
13671367static READ16_HANDLER( taitoz_sound_r )
13681368{
13691369   if (offset == 1)
1370      return ((taitosound_comm_r (0) & 0xff));
1370      return ((taitosound_comm_r (machine,0) & 0xff));
13711371   else return 0;
13721372}
13731373
r1877r1878
28352835   /* basic machine hardware */
28362836   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz ??? */
28372837   MDRV_CPU_PROGRAM_MAP(contcirc_readmem,contcirc_writemem)
2838   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
2838   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
28392839
28402840   MDRV_CPU_ADD(Z80,16000000/4)
28412841   /* audio CPU */   /* 4 MHz ??? */
r1877r1878
28432843
28442844   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz ??? */
28452845   MDRV_CPU_PROGRAM_MAP(contcirc_cpub_readmem,contcirc_cpub_writemem)
2846   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
2846   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
28472847
28482848   MDRV_MACHINE_START(taitoz)
28492849
r1877r1878
28802880   /* basic machine hardware */
28812881   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz ??? */
28822882   MDRV_CPU_PROGRAM_MAP(chasehq_readmem,chasehq_writemem)
2883   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
2883   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
28842884
28852885   MDRV_CPU_ADD(Z80,16000000/4)
28862886   /* audio CPU */   /* 4 MHz ??? */
r1877r1878
28882888
28892889   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz ??? */
28902890   MDRV_CPU_PROGRAM_MAP(chq_cpub_readmem,chq_cpub_writemem)
2891   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
2891   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
28922892
28932893   MDRV_MACHINE_START(taitoz)
28942894
r1877r1878
29242924   /* basic machine hardware */
29252925   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz ??? */
29262926   MDRV_CPU_PROGRAM_MAP(enforce_readmem,enforce_writemem)
2927   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
2927   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
29282928
29292929   MDRV_CPU_ADD(Z80,16000000/4)
29302930   /* audio CPU */   /* 4 MHz ??? */
r1877r1878
29322932
29332933   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz ??? */
29342934   MDRV_CPU_PROGRAM_MAP(enforce_cpub_readmem,enforce_cpub_writemem)
2935   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
2935   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
29362936
29372937   MDRV_MACHINE_START(taitoz)
29382938
r1877r1878
29712971   /* basic machine hardware */
29722972   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz ??? */
29732973   MDRV_CPU_PROGRAM_MAP(bshark_readmem,bshark_writemem)
2974   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
2974   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
29752975
29762976   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz ??? */
29772977   MDRV_CPU_PROGRAM_MAP(bshark_cpub_readmem,bshark_cpub_writemem)
2978   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
2978   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
29792979
29802980   MDRV_MACHINE_START(taitoz)
29812981
r1877r1878
30123012   /* basic machine hardware */
30133013   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz ??? */
30143014   MDRV_CPU_PROGRAM_MAP(sci_readmem,sci_writemem)
3015   MDRV_CPU_VBLANK_INT(sci_interrupt,1)
3015   MDRV_CPU_VBLANK_INT("main", sci_interrupt)
30163016
30173017   MDRV_CPU_ADD(Z80,16000000/4)
30183018   /* audio CPU */   /* 4 MHz ??? */
r1877r1878
30203020
30213021   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz ??? */
30223022   MDRV_CPU_PROGRAM_MAP(sci_cpub_readmem,sci_cpub_writemem)
3023   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
3023   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
30243024
30253025   MDRV_MACHINE_START(taitoz)
30263026
r1877r1878
30573057   /* basic machine hardware */
30583058   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz ??? */
30593059   MDRV_CPU_PROGRAM_MAP(nightstr_readmem,nightstr_writemem)
3060   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
3060   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
30613061
30623062   MDRV_CPU_ADD(Z80,16000000/4)
30633063   /* audio CPU */   /* 4 MHz ??? */
r1877r1878
30653065
30663066   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz ??? */
30673067   MDRV_CPU_PROGRAM_MAP(nightstr_cpub_readmem,nightstr_cpub_writemem)
3068   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
3068   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
30693069
30703070   MDRV_MACHINE_START(taitoz)
30713071
r1877r1878
31033103   /* basic machine hardware */
31043104   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz ??? */
31053105   MDRV_CPU_PROGRAM_MAP(aquajack_readmem,aquajack_writemem)
3106   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
3106   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
31073107
31083108   MDRV_CPU_ADD(Z80,16000000/4)
31093109   /* audio CPU */   /* 4 MHz ??? */
r1877r1878
31113111
31123112   MDRV_CPU_ADD(M68000, 12000000)   /* 12 MHz ??? */
31133113   MDRV_CPU_PROGRAM_MAP(aquajack_cpub_readmem,aquajack_cpub_writemem)
3114   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
3114   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
31153115
31163116   MDRV_MACHINE_START(taitoz)
31173117
r1877r1878
31483148   /* basic machine hardware */
31493149   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz ??? */
31503150   MDRV_CPU_PROGRAM_MAP(spacegun_readmem,spacegun_writemem)
3151   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
3151   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
31523152
31533153   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz ??? */
31543154   MDRV_CPU_PROGRAM_MAP(spacegun_cpub_readmem,spacegun_cpub_writemem)
3155   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
3155   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
31563156
31573157   MDRV_MACHINE_START(taitoz)
31583158
r1877r1878
31893189   /* basic machine hardware */
31903190   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz ??? */
31913191   MDRV_CPU_PROGRAM_MAP(dblaxle_readmem,dblaxle_writemem)
3192   MDRV_CPU_VBLANK_INT(dblaxle_interrupt,1)
3192   MDRV_CPU_VBLANK_INT("main", dblaxle_interrupt)
31933193
31943194   MDRV_CPU_ADD(Z80,16000000/4)
31953195   /* audio CPU */   /* 4 MHz ??? */
r1877r1878
31973197
31983198   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz ??? */
31993199   MDRV_CPU_PROGRAM_MAP(dblaxle_cpub_readmem,dblaxle_cpub_writemem)
3200   MDRV_CPU_VBLANK_INT(dblaxle_cpub_interrupt,1)
3200   MDRV_CPU_VBLANK_INT("main", dblaxle_cpub_interrupt)
32013201
32023202   MDRV_MACHINE_START(taitoz)
32033203
r1877r1878
32343234   /* basic machine hardware */
32353235   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz ??? */
32363236   MDRV_CPU_PROGRAM_MAP(racingb_readmem,racingb_writemem)
3237   MDRV_CPU_VBLANK_INT(dblaxle_interrupt,1)
3237   MDRV_CPU_VBLANK_INT("main", dblaxle_interrupt)
32383238
32393239   MDRV_CPU_ADD(Z80,16000000/4)
32403240   /* audio CPU */   /* 4 MHz ??? */
r1877r1878
32423242
32433243   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz ??? */
32443244   MDRV_CPU_PROGRAM_MAP(racingb_cpub_readmem,racingb_cpub_writemem)
3245   MDRV_CPU_VBLANK_INT(dblaxle_cpub_interrupt,1)
3245   MDRV_CPU_VBLANK_INT("main", dblaxle_cpub_interrupt)
32463246
32473247   MDRV_MACHINE_START(taitoz)
32483248   MDRV_INTERLEAVE(100)
src/mame/drivers/lastfght.c
r1877r1878
7070                                Video Hardware
7171***************************************************************************/
7272
73static mame_bitmap *lastfght_bitmap[2];
73static bitmap_t *lastfght_bitmap[2];
7474static int clr_offset;
7575static int lastfght_dest;
7676
r1877r1878
258258   {
259259      int x,y, addr;
260260      UINT8 *gfxdata = memory_region( REGION_GFX1 );
261      mame_bitmap *dest = lastfght_bitmap[lastfght_dest];
261      bitmap_t *dest = lastfght_bitmap[lastfght_dest];
262262
263263#if 0
264264      logerror("%06x: blit x %03x, y %03x, w %03x, h %03x, sx %03x.%02x, sx1 %03x.%02x, dsx %03x.%02x, sy %03x.%02x, sy1 %03x.%02x, dsy %03x.%02x, sp %02x, sr %02x, data %02x\n", activecpu_get_pc(),
r1877r1878
463463static MACHINE_DRIVER_START( lastfght )
464464   MDRV_CPU_ADD(H83044, 32000000/2)
465465   MDRV_CPU_PROGRAM_MAP( lastfght_map, 0 )
466   MDRV_CPU_VBLANK_INT(unknown_interrupt,2)
466   MDRV_CPU_VBLANK_INT_HACK(unknown_interrupt,2)
467467
468468   MDRV_NVRAM_HANDLER(generic_0fill)
469469
src/mame/drivers/markham.c
r1877r1878
200200   /* basic machine hardware */
201201   MDRV_CPU_ADD(Z80,8000000/2) /* 4.000MHz */
202202   MDRV_CPU_PROGRAM_MAP(readmem1,writemem1)
203   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
203   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
204204
205205   MDRV_CPU_ADD(Z80,8000000/2) /* 4.000MHz */
206206   MDRV_CPU_PROGRAM_MAP(readmem2,writemem2)
207   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
207   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
208208
209209   MDRV_INTERLEAVE(100)
210210
src/mame/drivers/msisaac.c
r1877r1878
6969
7070static WRITE8_HANDLER( sound_command_w )
7171{
72   soundlatch_w(0,data);
72   soundlatch_w(machine,0,data);
7373   timer_call_after_resynch(NULL, data,nmi_callback);
7474}
7575
r1877r1878
530530   /* basic machine hardware */
531531   MDRV_CPU_ADD(Z80, 4000000)
532532   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
533   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
533   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
534534
535535   MDRV_CPU_ADD(Z80, 4000000)
536536   /* audio CPU */
537537   MDRV_CPU_PROGRAM_MAP(readmem_sound,writemem_sound)
538   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   /* source of IRQs is unknown */
538   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   /* source of IRQs is unknown */
539539
540540#ifdef USE_MCU
541541   MDRV_CPU_ADD(M68705,8000000/2)  /* 4 MHz */
src/mame/drivers/superqix.c
r1877r1878
930930   MDRV_CPU_ADD(Z80,12000000/2)       /* 6 MHz */
931931   MDRV_CPU_PROGRAM_MAP(main_map,0)
932932   MDRV_CPU_IO_MAP(pbillian_port_map,0)
933   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
933   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
934934
935935   /* video hardware */
936936   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
961961   MDRV_CPU_ADD(Z80,12000000/2)       /* 6 MHz */
962962   MDRV_CPU_PROGRAM_MAP(main_map,0)
963963   MDRV_CPU_IO_MAP(hotsmash_port_map,0)
964   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
964   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
965965
966966   MDRV_CPU_ADD(M68705, 4000000) /* ???? */
967967   MDRV_CPU_PROGRAM_MAP(m68705_map,0)
r1877r1878
997997   MDRV_CPU_ADD(Z80, 12000000/2)   /* 6 MHz */
998998   MDRV_CPU_PROGRAM_MAP(main_map,0)
999999   MDRV_CPU_IO_MAP(sqix_port_map,0)
1000   MDRV_CPU_VBLANK_INT(sqix_interrupt,6)   /* ??? */
1000   MDRV_CPU_VBLANK_INT_HACK(sqix_interrupt,6)   /* ??? */
10011001
10021002   MDRV_CPU_ADD(I8751, 12000000/3)   /* ??? */
10031003   MDRV_CPU_PROGRAM_MAP(mcu_map,0)
r1877r1878
10381038   MDRV_CPU_ADD(Z80, 12000000/2)   /* 6 MHz */
10391039   MDRV_CPU_PROGRAM_MAP(main_map,0)
10401040   MDRV_CPU_IO_MAP(bootleg_port_map,0)
1041   MDRV_CPU_VBLANK_INT(bootleg_interrupt,6)   /* ??? */
1041   MDRV_CPU_VBLANK_INT_HACK(bootleg_interrupt,6)   /* ??? */
10421042
10431043   /* video hardware */
10441044   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/playch10.c
r1877r1878
409409
410410static READ8_HANDLER( psg_4015_r )
411411{
412   return NESPSG_0_r(0x15);
412   return NESPSG_0_r(machine, 0x15);
413413}
414414
415415static WRITE8_HANDLER( psg_4015_w )
416416{
417   NESPSG_0_w(0x15, data);
417   NESPSG_0_w(machine, 0x15, data);
418418}
419419
420420static WRITE8_HANDLER( psg_4017_w )
421421{
422   NESPSG_0_w(0x17, data);
422   NESPSG_0_w(machine, 0x17, data);
423423}
424424
425425/******************************************************************************/
r1877r1878
735735   MDRV_CPU_ADD(Z80, 8000000/2)   // 4 MHz
736736   MDRV_CPU_PROGRAM_MAP(bios_map, 0)
737737   MDRV_CPU_IO_MAP(bios_io_map, 0)
738   MDRV_CPU_VBLANK_INT(playch10_interrupt, 1)
738   MDRV_CPU_VBLANK_INT("top", playch10_interrupt)
739739
740740   MDRV_CPU_ADD(N2A03, N2A03_DEFAULTCLOCK)
741741   MDRV_CPU_PROGRAM_MAP(cart_map, 0)
src/mame/drivers/cyberbal.c
r1877r1878
454454
455455   MDRV_CPU_ADD(M68000, ATARI_CLOCK_14MHz/2)
456456   MDRV_CPU_PROGRAM_MAP(extra_map,0)
457   MDRV_CPU_VBLANK_INT(atarigen_video_int_gen,1)
457   MDRV_CPU_VBLANK_INT("left", atarigen_video_int_gen)   /* or is it "right?" */
458458
459459   MDRV_CPU_ADD(M68000, ATARI_CLOCK_14MHz/2)
460460   MDRV_CPU_PROGRAM_MAP(sound_68k_map,0)
r1877r1878
506506   /* basic machine hardware */
507507   MDRV_CPU_ADD(M68000, ATARI_CLOCK_14MHz/2)
508508   MDRV_CPU_PROGRAM_MAP(cyberb2p_map,0)
509   MDRV_CPU_VBLANK_INT(atarigen_video_int_gen,1)
509   MDRV_CPU_VBLANK_INT("main", atarigen_video_int_gen)
510510
511511   MDRV_MACHINE_RESET(cyberb2p)
512512   MDRV_NVRAM_HANDLER(atarigen)
src/mame/drivers/lockon.c
r1877r1878
161161
162162static WRITE16_HANDLER( emres_w )
163163{
164   watchdog_reset_r(0);
164   watchdog_reset(machine);
165165   lockon_main_inten = 0;
166166}
167167
src/mame/drivers/mappy.c
r1877r1878
691691static WRITE8_HANDLER( mappy_snd_sharedram_w )
692692{
693693   if (offset < 0x40)
694      namco_15xx_w(offset,data);
694      namco_15xx_w(machine,offset,data);
695695   else
696696      namco_soundregs[offset] = data;
697697}
r1877r1878
833833
834834   /* Reset all latches */
835835   for (i = 0;i < 0x10;i += 2)
836      superpac_latch_w(i,0);
836      superpac_latch_w(machine,i,0);
837837}
838838
839839static MACHINE_RESET( phozon )
r1877r1878
842842
843843   /* Reset all latches */
844844   for (i = 0;i < 0x10;i += 2)
845      phozon_latch_w(i,0);
845      phozon_latch_w(machine,i,0);
846846}
847847
848848static MACHINE_RESET( mappy )
r1877r1878
851851
852852   /* Reset all latches */
853853   for (i = 0;i < 0x10;i += 2)
854      mappy_latch_w(i,0);
854      mappy_latch_w(machine,i,0);
855855}
856856
857857static INTERRUPT_GEN( mappy_interrupt_1 )
r1877r1878
15731573   /* basic machine hardware */
15741574   MDRV_CPU_ADD(M6809, PIXEL_CLOCK/4)   /* 1.536 MHz */
15751575   MDRV_CPU_PROGRAM_MAP(superpac_cpu1_map,0)
1576   MDRV_CPU_VBLANK_INT(mappy_interrupt_1,1)   // also update the custom I/O chips
1576   MDRV_CPU_VBLANK_INT("main", mappy_interrupt_1)   // also update the custom I/O chips
15771577
15781578   MDRV_CPU_ADD(M6809, PIXEL_CLOCK/4)   /* 1.536 MHz */
15791579   MDRV_CPU_PROGRAM_MAP(superpac_cpu2_map,0)
1580   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
1580   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
15811581
15821582   MDRV_WATCHDOG_VBLANK_INIT(8)
15831583   MDRV_INTERLEAVE(100)    /* 100 CPU slices per frame - an high value to ensure proper */
r1877r1878
16201620   /* basic machine hardware */
16211621   MDRV_CPU_ADD(M6809,   PIXEL_CLOCK/4)   /* MAIN CPU */
16221622   MDRV_CPU_PROGRAM_MAP(phozon_cpu1_map,0)
1623   MDRV_CPU_VBLANK_INT(mappy_interrupt_1,1)   // also update the custom I/O chips
1623   MDRV_CPU_VBLANK_INT("main", mappy_interrupt_1)   // also update the custom I/O chips
16241624
16251625   MDRV_CPU_ADD(M6809,   PIXEL_CLOCK/4)   /* SOUND CPU */
16261626   MDRV_CPU_PROGRAM_MAP(phozon_cpu2_map,0)
1627   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
1627   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
16281628
16291629   MDRV_CPU_ADD(M6809,   PIXEL_CLOCK/4)   /* SUB CPU */
16301630   MDRV_CPU_PROGRAM_MAP(phozon_cpu3_map,0)
1631   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
1631   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
16321632
16331633   MDRV_WATCHDOG_VBLANK_INIT(8)
16341634   MDRV_INTERLEAVE(100)    /* 100 CPU slices per frame - an high value to ensure proper */
r1877r1878
16611661   /* basic machine hardware */
16621662   MDRV_CPU_ADD(M6809, PIXEL_CLOCK/4)   /* 1.536 MHz */
16631663   MDRV_CPU_PROGRAM_MAP(mappy_cpu1_map,0)
1664   MDRV_CPU_VBLANK_INT(mappy_interrupt_1,1)   // also update the custom I/O chips
1664   MDRV_CPU_VBLANK_INT("main", mappy_interrupt_1)   // also update the custom I/O chips
16651665
16661666   MDRV_CPU_ADD(M6809, PIXEL_CLOCK/4)   /* 1.536 MHz */
16671667   MDRV_CPU_PROGRAM_MAP(mappy_cpu2_map,0)
1668   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
1668   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
16691669
16701670   MDRV_WATCHDOG_VBLANK_INIT(8)
16711671   MDRV_INTERLEAVE(100)    /* 100 CPU slices per frame - an high value to ensure proper */
src/mame/drivers/safarir.c
r1877r1878
125125static TILE_GET_INFO( get_bg_tile_info )
126126{
127127   int color;
128   UINT8 code = ram_r(tile_index | 0x400);
128   UINT8 code = ram_r(machine,tile_index | 0x400);
129129
130130   /* this is wrong */
131131   if (code & 0x80)
r1877r1878
140140static TILE_GET_INFO( get_fg_tile_info )
141141{
142142   int color, flags;
143   UINT8 code = ram_r(tile_index);
143   UINT8 code = ram_r(machine,tile_index);
144144
145145   if (code & 0x80)
146146      color = 7;   /* white */
src/mame/drivers/rastan.c
r1877r1878
383383   /* basic machine hardware */
384384   MDRV_CPU_ADD(M68000, 8000000)   /* 8 MHz */
385385   MDRV_CPU_PROGRAM_MAP(rastan_map,0)
386   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
386   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)
387387
388388   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz */
389389   MDRV_CPU_PROGRAM_MAP(rastan_s_map,0)
r1877r1878
407407   /* sound hardware */
408408   MDRV_SPEAKER_STANDARD_MONO("mono")
409409
410   MDRV_SOUND_ADD(YM2151, 4000000)
410   MDRV_SOUND_ADD(YM2151, XTAL_16MHz/4)   /* verified on pcb */
411411   MDRV_SOUND_CONFIG(ym2151_interface)
412412   MDRV_SOUND_ROUTE(0, "mono", 0.50)
413413   MDRV_SOUND_ROUTE(1, "mono", 0.50)
414414
415   MDRV_SOUND_ADD(MSM5205, 384000)
415   MDRV_SOUND_ADD(MSM5205, XTAL_384kHz)   /* verified on pcb */
416416   MDRV_SOUND_CONFIG(msm5205_interface)
417417   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60)
418418MACHINE_DRIVER_END
src/mame/drivers/pntnpuzl.c
r1877r1878
455455static MACHINE_DRIVER_START( pntnpuzl )
456456   MDRV_CPU_ADD_TAG("main", M68000, 12000000)//??
457457   MDRV_CPU_PROGRAM_MAP(pntnpuzl_map,0)
458   MDRV_CPU_VBLANK_INT(pntnpuzl_irq,1)   // irq1 = coin irq2 = service irq4 = coin
458   MDRV_CPU_VBLANK_INT("main", pntnpuzl_irq)   // irq1 = coin irq2 = service irq4 = coin
459459
460460   MDRV_NVRAM_HANDLER(pntnpuzl)
461461
src/mame/drivers/gijoe.c
r1877r1878
9797   /* bit 8  is EEPROM data */
9898   /* bit 9  is EEPROM ready */
9999   /* bit 11 is service button */
100   res = (EEPROM_read_bit()<<8) | input_port_0_word_r(0,0);
100   res = (EEPROM_read_bit()<<8) | input_port_0_word_r(machine,0,0);
101101
102102   if (init_eeprom_count)
103103   {
r1877r1878
185185{
186186   if(ACCESSING_LSB) {
187187      data &= 0xff;
188      soundlatch_w(0, data);
188      soundlatch_w(machine, 0, data);
189189   }
190190}
191191
192192static WRITE16_HANDLER( sound_irq_w )
193193{
194   cpunum_set_input_line(Machine, 1, 0, HOLD_LINE);
194   cpunum_set_input_line(machine, 1, 0, HOLD_LINE);
195195}
196196
197197static READ16_HANDLER( sound_status_r )
198198{
199   return soundlatch2_r(0);
199   return soundlatch2_r(machine,0);
200200}
201201
202202static void sound_nmi(void)
r1877r1878
344344   /* basic machine hardware */
345345   MDRV_CPU_ADD(M68000, 16000000)   /* Confirmed */
346346   MDRV_CPU_PROGRAM_MAP(readmem, writemem)
347   MDRV_CPU_VBLANK_INT(gijoe_interrupt, 1)
347   MDRV_CPU_VBLANK_INT("main", gijoe_interrupt)
348348
349349   MDRV_CPU_ADD(Z80, 8000000)
350350   /* audio CPU */   /* Amuse & confirmed. z80e */
src/mame/drivers/uapce.c
r1877r1878
4747   // bit 3 - enable 752 Hz (D-3) square wave output
4848
4949   logerror( "Writing control latch with %02X\n", data );
50};
50}
5151
5252static READ8_HANDLER( jamma_if_control_latch_r )
5353{
5454   return jamma_if_control_latch & 0x08;
55};
55}
5656
5757static READ8_HANDLER( jamma_if_read_dsw )
5858{
r1877r1878
9494   }
9595
9696   return dsw_val & 1;
97};
97}
9898
9999static UINT8 jamma_if_read_joystick( void )
100100{
r1877r1878
106106   {
107107      return readinputportbytag( "IN" ) | 0x08;
108108   }
109};
109}
110110
111111static MACHINE_RESET( uapce )
112112{
113113   pce_set_joystick_readinputport_callback( jamma_if_read_joystick );
114114   jamma_if_control_latch = 0;
115};
115}
116116
117117static ADDRESS_MAP_START( z80_map, ADDRESS_SPACE_PROGRAM, 8)
118118   AM_RANGE( 0x0000, 0x07FF) AM_ROM
r1877r1878
182182   MDRV_CPU_ADD(H6280, PCE_MAIN_CLOCK/3)
183183   MDRV_CPU_PROGRAM_MAP(pce_mem, 0)
184184   MDRV_CPU_IO_MAP(pce_io, 0)
185   MDRV_CPU_VBLANK_INT(pce_interrupt, VDC_LPF)
185   MDRV_CPU_VBLANK_INT_HACK(pce_interrupt, VDC_LPF)
186186
187187   MDRV_CPU_ADD(Z80, 1400000)
188188   MDRV_CPU_PROGRAM_MAP(z80_map, 0)
r1877r1878
224224static DRIVER_INIT(uapce)
225225{
226226   DRIVER_INIT_CALL(pce);
227};
227}
228228
229229GAME( 1989, blazlaz, 0, uapce, uapce, uapce, ROT0, "Hudson Soft", "Blazing Lazers", GAME_IMPERFECT_SOUND )
src/mame/drivers/tigeroad.c
r1877r1878
87870x0003, 0x0080, 0x0006, 0x0060, 0x0000, 0x00e0, 0x000a, 0x00c0, 0x0003, 0x0080, 0x0006, 0x0060, 0x0000, 0x00e0, 0x000a, 0x00c0,
88880x0003, 0x0080, 0x0006, 0x0060, 0x0000, 0x00e0, 0x000a, 0x00c0, 0x0003, 0x0080, 0x0006, 0x0060, 0x0000, 0x00e0, 0x000a, 0x00c0 };
8989
90static void f1dream_protection_w(void)
90static void f1dream_protection_w(running_machine *machine)
9191{
9292   int indx;
9393   int value = 255;
r1877r1878
146146   else if ((prevpc == 0x27f8) || (prevpc == 0x511a) || (prevpc == 0x5142) || (prevpc == 0x516a))
147147   {
148148      /* The main CPU stuffs the byte for the soundlatch into 0xfffffd.*/
149      soundlatch_w(2,ram16[0x3ffc/2]);
149      soundlatch_w(machine,2,ram16[0x3ffc/2]);
150150   }
151151}
152152
153153static WRITE16_HANDLER( f1dream_control_w )
154154{
155155   logerror("protection write, PC: %04x  FFE1 Value:%01x\n",activecpu_get_pc(), ram16[0x3fe0/2]);
156   f1dream_protection_w();
156   f1dream_protection_w(machine);
157157}
158158
159159static WRITE16_HANDLER( tigeroad_soundcmd_w )
160160{
161161   if (ACCESSING_MSB)
162      soundlatch_w(offset,data >> 8);
162      soundlatch_w(machine,offset,data >> 8);
163163}
164164
165165static WRITE8_HANDLER( msm5205_w )
r1877r1878
549549   /* basic machine hardware */
550550   MDRV_CPU_ADD(M68000, 6000000) /* ? Main clock is 24MHz */
551551   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
552   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
552   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
553553
554554   MDRV_CPU_ADD(Z80, 4000000)
555555   /* audio CPU */    /* 4 MHz ??? */
r1877r1878
577577   /* sound hardware */
578578   MDRV_SPEAKER_STANDARD_MONO("mono")
579579
580   MDRV_SOUND_ADD(YM2203, 3579545)
580   MDRV_SOUND_ADD(YM2203, XTAL_3_579545MHz) /* verified on pcb */
581581   MDRV_SOUND_CONFIG(ym2203_interface)
582582   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
583583
584   MDRV_SOUND_ADD(YM2203, 3579545)
584   MDRV_SOUND_ADD(YM2203, XTAL_3_579545MHz) /* verified on pcb */
585585   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
586586MACHINE_DRIVER_END
587587
src/mame/drivers/wilytowr.c
r1877r1878
166166   fg_flag = 0;
167167}
168168
169static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
169static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
170170{
171171   int offs;
172172
r1877r1878
229229{
230230   int num_ays = (sndti_exists(SOUND_AY8910, 1)) ? 2 : 1;
231231   if ((p2 & 0xf0) == 0xe0)
232      AY8910_control_port_0_w(0,offset);
232      AY8910_control_port_0_w(machine,0,offset);
233233   else if ((p2 & 0xf0) == 0xa0)
234      AY8910_write_port_0_w(0,offset);
234      AY8910_write_port_0_w(machine,0,offset);
235235   else if (num_ays == 2 && (p1 & 0xe0) == 0x60)
236      AY8910_control_port_1_w(0,offset);
236      AY8910_control_port_1_w(machine,0,offset);
237237   else if (num_ays == 2 && (p1 & 0xe0) == 0x40)
238      AY8910_write_port_1_w(0,offset);
238      AY8910_write_port_1_w(machine,0,offset);
239239   else // if ((p2 & 0xf0) != 0x70)
240240      /* the port address is the data, while the data seems to be control bits */
241241      logerror("%04x: snddata_w ctrl = %02x, p1 = %02x, p2 = %02x, data = %02x\n",activecpu_get_pc(),data,p1,p2,offset);
r1877r1878
515515   /* basic machine hardware */
516516   MDRV_CPU_ADD(Z80,4000000)   /* 4 MHz ???? */
517517   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
518   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
518   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
519519
520520   MDRV_CPU_ADD(I8039,8000000)   /* ????? */
521521   /* audio CPU */
r1877r1878
552552   /* basic machine hardware */
553553   MDRV_CPU_ADD(Z80, 12000000/4)     /* 3 MHz */
554554   MDRV_CPU_PROGRAM_MAP(fghtbskt_map,0)
555   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
555   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
556556
557557   MDRV_CPU_ADD(I8039,12000000/4)   /* ????? */
558558   /* audio CPU */
src/mame/drivers/spaceg.c
r1877r1878
170170
171171
172172
173static UINT8 unkram[65536];
173static UINT8 *unkram;
174174
175static int io9400;
176static int io9401;
175static UINT8 *io9400;
176static UINT8 *io9401;
177177
178178static PALETTE_INIT( spaceg )
179179{
r1877r1878
205205
206206static WRITE8_HANDLER( zvideoram_w )
207207{
208   int i,x,y,col;
208   int col;
209209
210210   col = unkram[0x400];
211211
r1877r1878
213213
214214   col &=0x0f;
215215
216   switch(io9401)
216   switch(*io9401)
217217   {
218218   case 0x0d:   /* 1101 */
219219      videoram[offset] &= ~data;
r1877r1878
226226      break;
227227
228228   default:
229      logerror("mode =%02x pc=%04x\n",io9401,activecpu_get_pc() );
230      popmessage("mode =%02x pc=%04x\n",io9401,activecpu_get_pc() );
229      logerror("mode =%02x pc=%04x\n",*io9401,activecpu_get_pc() );
230      popmessage("mode =%02x pc=%04x\n",*io9401,activecpu_get_pc() );
231231      return;
232232      break;
233233   }
234234
235235
236236   unkram  [offset] = col;
237
238   y= 255 - (offset & 0xff);
239   x= 255 - ((offset>>8)*8);
240   x -= ((io9400&0xe0)>>5);
241
242   /* draw modified eight pixels */
243   if (y >= 0 && y < tmpbitmap->height)
244      for (i = 0; i < 8; i++)
245      {
246         if (x >= 0 && y < tmpbitmap->width)
247            *BITMAP_ADDR16(tmpbitmap, y, x) = (data&1)? col : 0;
248         x++;
249         data >>= 1;
250      }
251237}
252238
253239static READ8_HANDLER(fake_r)
r1877r1878
283269         logerror("palette? read from unkram offset = %04x\n",offset);
284270   }
285271
286if (io9401!=0x40)
287   logerror("unkram read in mode: 9401 = %02x (offset=%04x)\n",io9401,offset);
272if (*io9401!=0x40)
273   logerror("unkram read in mode: 9401 = %02x (offset=%04x)\n",*io9401,offset);
288274
289275
290276   return unkram[offset];
291277}
292278
293static WRITE8_HANDLER(spaceg_colorram_w)
279
280static VIDEO_UPDATE( spaceg )
294281{
295   int i,x,y,col;
282   offs_t offs;
296283
297   unkram[offset] = data;
284   for (offs = 0; offs < 0x2000; offs++)
285   {
286      int i;
287      UINT8 data = videoram[offs];
298288
289      int y = offs & 0xff;
290      UINT8 x = ((offs >> 8) << 3) - ((*io9400 & 0xe0) >> 5);
299291
300   /* refresh eight pixels because the color might have just been changed */
301   data = videoram[offset];
302   col  = unkram  [offset];
303
304   y= 255 - (offset & 0xff);
305   x= 255 - ((offset>>8)*8);
306   x -= ((io9400&0xe0)>>5);
307
308   /* draw modified eight pixels */
309   if (y >= 0 && y < tmpbitmap->height)
310292      for (i = 0; i < 8; i++)
311293      {
312         if (x >= 0 && x < tmpbitmap->width)
313            *BITMAP_ADDR16(tmpbitmap, y, x) = (data&1)? col : 0;
294         *BITMAP_ADDR16(bitmap, y, x) = (data & 0x80) ? unkram[offs] : 0;
295
314296         x++;
315         data >>= 1;
297         data <<= 1;
316298      }
317}
318
319
320static READ8_HANDLER(zr_r)
321{
322   return videoram[offset];
323}
324
325static WRITE8_HANDLER(io9400_w)
326{
327   io9400=data;
328   if (io9400 & 0x1f)
329   {
330      logerror("!!9400 =%02x pc=%04x\n",io9400,activecpu_get_pc() );
331299   }
332}
333300
334static WRITE8_HANDLER(io9401_w)
335{
336   io9401 = data;
337
338
339//0x40 - loads the palette on READ, address line 0x100 is the ninth bit (3rd bit of the red component)
340
341   switch(io9401)
342   {
343   case 0x0d:
344   case 0x01:
345   case 0x00:
346         break;
347   default:
348      logerror("!!9401 mode =%02x pc=%04x\n",io9401,activecpu_get_pc() );
349      break;
350   }
301   return 0;
351302}
352303
304
353305static ADDRESS_MAP_START( readwritemem, ADDRESS_SPACE_PROGRAM, 8 )
354306   AM_RANGE(0x0000, 0x1fff) AM_ROM
355307   AM_RANGE(0x3000, 0x3fff) AM_ROM
356308   AM_RANGE(0x7000, 0x77ff) AM_RAM
357   AM_RANGE(0xc000, 0xdfff) AM_READWRITE(zr_r, zvideoram_w) AM_BASE(&videoram)
358   AM_RANGE(0xa000, 0xbfff) AM_READWRITE(spaceg_colorram_r, spaceg_colorram_w)
309   AM_RANGE(0xc000, 0xdfff) AM_READWRITE(MRA8_RAM, zvideoram_w) AM_BASE(&videoram)
310   AM_RANGE(0xa000, 0xbfff) AM_READWRITE(spaceg_colorram_r, MWA8_RAM) AM_BASE(&unkram)
359311
360312
361   AM_RANGE(0x9400, 0x9400) AM_WRITE(io9400_w) /* gfx ctrl */
362   AM_RANGE(0x9401, 0x9401) AM_WRITE(io9401_w) /* gfx ctrl */
313   AM_RANGE(0x9400, 0x9400) AM_WRITE(MWA8_RAM) AM_BASE(&io9400)    /* gfx ctrl */
314   AM_RANGE(0x9401, 0x9401) AM_WRITE(MWA8_RAM) AM_BASE(&io9401)   /* gfx ctrl */
363315   /* 9402 -
364316        bits 0 and 1 probably control the lamps under the player 1 and player 2 start buttons
365317        bit 3 is probably a flip screen
r1877r1878
414366   /* basic machine hardware */
415367   MDRV_CPU_ADD(Z80,2500000)       /* 2.5 MHz */
416368   MDRV_CPU_PROGRAM_MAP(readwritemem,0)
417   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)   /* 60 Hz NMIs (verified) */
369   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)   /* 60 Hz NMIs (verified) */
418370
419371   /* video hardware */
420372   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
422374   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
423375   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
424376   MDRV_SCREEN_SIZE(256, 256)
425   MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-1-3*8)
377   MDRV_SCREEN_VISIBLE_AREA(0, 255, 32, 255)
426378
427379   MDRV_PALETTE_LENGTH(16+128-16)
428380   MDRV_PALETTE_INIT( spaceg )
429   MDRV_VIDEO_START(generic_bitmapped)
430   MDRV_VIDEO_UPDATE( generic_bitmapped )
381   MDRV_VIDEO_UPDATE( spaceg )
431382
432383   /* sound hardware */
433384   MDRV_SPEAKER_STANDARD_MONO("mono")
r1877r1878
469420ROM_END
470421
471422
472GAME( 1979, spaceg, 0, spaceg, spaceg, 0, ROT90, "Omori", "Space Guerrilla", GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND)
423GAME( 1979, spaceg, 0, spaceg, spaceg, 0, ROT270, "Omori", "Space Guerrilla", GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND)
src/mame/drivers/looping.c
r1877r1878
241241 *
242242 *************************************/
243243
244static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
244static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
245245{
246246   const UINT8 *source;
247247   looping_state *state = machine->driver_data;
r1877r1878
312312static WRITE8_HANDLER( level2_irq_set )
313313{
314314   if (!(data & 1))
315      cpunum_set_input_line_and_vector(Machine, 0, 0, ASSERT_LINE, 4);
315      cpunum_set_input_line_and_vector(machine, 0, 0, ASSERT_LINE, 4);
316316}
317317
318318
319319static WRITE8_HANDLER( main_irq_ack_w )
320320{
321321   if (data == 0)
322      cpunum_set_input_line(Machine, 0, 0, CLEAR_LINE);
322      cpunum_set_input_line(machine, 0, 0, CLEAR_LINE);
323323}
324324
325325
326326static WRITE8_HANDLER( looping_souint_clr )
327327{
328328   if (data == 0)
329      cpunum_set_input_line(Machine, 1, 0, CLEAR_LINE);
329      cpunum_set_input_line(machine, 1, 0, CLEAR_LINE);
330330}
331331
332332
r1877r1878
338338
339339static WRITE8_HANDLER( looping_soundlatch_w )
340340{
341   soundlatch_w(offset, data);
342   cpunum_set_input_line_and_vector(Machine, 1, 0, ASSERT_LINE, 4);
341   soundlatch_w(machine, offset, data);
342   cpunum_set_input_line_and_vector(machine, 1, 0, ASSERT_LINE, 4);
343343}
344344
345345
r1877r1878
581581   MDRV_CPU_ADD(TMS9995, MAIN_CPU_CLOCK)
582582   MDRV_CPU_PROGRAM_MAP(looping_map,0)
583583   MDRV_CPU_IO_MAP(looping_io_map,0)
584   MDRV_CPU_VBLANK_INT(looping_interrupt,1)
584   MDRV_CPU_VBLANK_INT("main", looping_interrupt)
585585
586586   MDRV_CPU_ADD(TMS9980, SOUND_CLOCK/4)
587587   MDRV_CPU_PROGRAM_MAP(looping_sound_map,0)
src/mame/drivers/segas32.c
r1877r1878
359359
360360/* I/O chips and custom I/O */
361361static UINT8 misc_io_data[2][0x10];
362static read16_handler custom_io_r[2];
363static write16_handler custom_io_w[2];
362static read16_machine_func custom_io_r[2];
363static write16_machine_func custom_io_w[2];
364364static UINT8 analog_bank;
365365static UINT8 analog_value[4];
366366static UINT8 sonic_last[6];
r1877r1878
752752static READ16_HANDLER( io_expansion_r )
753753{
754754   if (custom_io_r[0])
755      return (*custom_io_r[0])(offset, mem_mask);
755      return (*custom_io_r[0])(machine, offset, mem_mask);
756756   else
757757      logerror("%06X:io_expansion_r(%X)\n", activecpu_get_pc(), offset);
758758   return 0xffff;
r1877r1878
766766      return;
767767
768768   if (custom_io_w[0])
769      (*custom_io_w[0])(offset, data, mem_mask);
769      (*custom_io_w[0])(machine, offset, data, mem_mask);
770770   else
771771      logerror("%06X:io_expansion_w(%X) = %02X\n", activecpu_get_pc(), offset, data & 0xff);
772772}
r1877r1878
775775static READ32_HANDLER( io_expansion_0_r )
776776{
777777   if (custom_io_r[0])
778      return (*custom_io_r[0])(offset*2+0, mem_mask) |
779           ((*custom_io_r[0])(offset*2+1, mem_mask >> 16) << 16);
778      return (*custom_io_r[0])(machine, offset*2+0, mem_mask) |
779           ((*custom_io_r[0])(machine, offset*2+1, mem_mask >> 16) << 16);
780780   else
781781      logerror("%06X:io_expansion_r(%X)\n", activecpu_get_pc(), offset);
782782   return 0xffffffff;
r1877r1878
789789   if ((mem_mask & 0x000000ff) != 0x000000ff)
790790   {
791791      if (custom_io_w[0])
792         (*custom_io_w[0])(offset*2+0, data, mem_mask);
792         (*custom_io_w[0])(machine, offset*2+0, data, mem_mask);
793793      else
794794         logerror("%06X:io_expansion_w(%X) = %02X\n", activecpu_get_pc(), offset, data & 0xff);
795795   }
796796   if ((mem_mask & 0x00ff0000) != 0x00ff0000)
797797   {
798798      if (custom_io_w[0])
799         (*custom_io_w[0])(offset*2+1, data >> 16, mem_mask >> 16);
799         (*custom_io_w[0])(machine, offset*2+1, data >> 16, mem_mask >> 16);
800800      else
801801         logerror("%06X:io_expansion_w(%X) = %02X\n", activecpu_get_pc(), offset, data & 0xff);
802802   }
r1877r1878
806806static READ32_HANDLER( io_expansion_1_r )
807807{
808808   if (custom_io_r[1])
809      return (*custom_io_r[1])(offset*2+0, mem_mask) |
810           ((*custom_io_r[1])(offset*2+1, mem_mask >> 16) << 16);
809      return (*custom_io_r[1])(machine, offset*2+0, mem_mask) |
810           ((*custom_io_r[1])(machine, offset*2+1, mem_mask >> 16) << 16);
811811   else
812812      logerror("%06X:io_expansion_r(%X)\n", activecpu_get_pc(), offset);
813813   return 0xffffffff;
r1877r1878
820820   if ((mem_mask & 0x000000ff) != 0x000000ff)
821821   {
822822      if (custom_io_w[1])
823         (*custom_io_w[1])(offset*2+0, data, mem_mask);
823         (*custom_io_w[1])(machine, offset*2+0, data, mem_mask);
824824      else
825825         logerror("%06X:io_expansion_w(%X) = %02X\n", activecpu_get_pc(), offset, data & 0xff);
826826   }
827827   if ((mem_mask & 0x00ff0000) != 0x00ff0000)
828828   {
829829      if (custom_io_w[1])
830         (*custom_io_w[1])(offset*2+1, data >> 16, mem_mask >> 16);
830         (*custom_io_w[1])(machine, offset*2+1, data >> 16, mem_mask >> 16);
831831      else
832832         logerror("%06X:io_expansion_w(%X) = %02X\n", activecpu_get_pc(), offset, data & 0xff);
833833   }
r1877r1878
21922192   /* basic machine hardware */
21932193   MDRV_CPU_ADD(V60, MASTER_CLOCK/2)
21942194   MDRV_CPU_PROGRAM_MAP(system32_map,0)
2195   MDRV_CPU_VBLANK_INT(start_of_vblank_int,1)
2195   MDRV_CPU_VBLANK_INT("main", start_of_vblank_int)
21962196
21972197   MDRV_CPU_ADD_TAG("sound", Z80, MASTER_CLOCK/4)
21982198   MDRV_CPU_PROGRAM_MAP(system32_sound_map,0)
r1877r1878
22462246   /* basic machine hardware */
22472247   MDRV_CPU_ADD(V70, MULTI32_CLOCK/2)
22482248   MDRV_CPU_PROGRAM_MAP(multi32_map,0)
2249   MDRV_CPU_VBLANK_INT(start_of_vblank_int,1)
2249   MDRV_CPU_VBLANK_INT("left", start_of_vblank_int)
22502250
22512251   MDRV_CPU_ADD_TAG("sound", Z80, MASTER_CLOCK/4)
22522252   MDRV_CPU_PROGRAM_MAP(multi32_sound_map,0)
r1877r1878
37723772 *
37733773 *************************************/
37743774
3775static void segas32_common_init(read16_handler custom_r, write16_handler custom_w, const UINT8 *default_eeprom)
3775static void segas32_common_init(read16_machine_func custom_r, write16_machine_func custom_w, const UINT8 *default_eeprom)
37763776{
37773777   /* reset the custom handlers and other pointers */
37783778   custom_io_r[0] = custom_r;
src/mame/drivers/1945kiii.c
r1877r1878
7979   k3_bg_tilemap = tilemap_create(get_k3_bg_tile_info,tilemap_scan_rows,16, 16, 32,64);
8080}
8181
82static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
82static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
8383{
8484   const gfx_element *gfx = machine->gfx[0];
8585   UINT16 *source = k3_spriteram_1;
r1877r1878
246246static MACHINE_DRIVER_START( k3 )
247247   MDRV_CPU_ADD(M68000, 16000000)
248248   MDRV_CPU_PROGRAM_MAP(k3_map,0)
249   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
249   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
250250
251251   MDRV_GFXDECODE(1945kiii)
252252
src/mame/drivers/badlands.c
r1877r1878
138138{
139139   /* sound IRQ is on 32V */
140140   if (scanline & 32)
141      atarigen_6502_irq_ack_r(0);
141      atarigen_6502_irq_ack_r(machine, 0);
142142   else if (!(readinputport(0) & 0x40))
143143      atarigen_6502_irq_gen(machine, 0);
144144}
r1877r1878
166166
167167static INTERRUPT_GEN( vblank_int )
168168{
169   int pedal_state = input_port_4_r(0);
169   int pedal_state = input_port_4_r(machine, 0);
170170   int i;
171171
172172   /* update the pedals once per frame */
r1877r1878
226226         break;
227227
228228      case 0x002:      /* /RDP */
229         result = atarigen_6502_sound_r(offset);
229         result = atarigen_6502_sound_r(machine, offset);
230230         break;
231231
232232      case 0x004:      /* /RDIO */
r1877r1878
248248         break;
249249
250250      case 0x006:      /* /IRQACK */
251         atarigen_6502_irq_ack_r(0);
251         atarigen_6502_irq_ack_r(machine, 0);
252252         break;
253253
254254      case 0x200:      /* /VOICE */
r1877r1878
274274         break;
275275
276276      case 0x006:      /* /IRQACK */
277         atarigen_6502_irq_ack_r(0);
277         atarigen_6502_irq_ack_r(machine, 0);
278278         break;
279279
280280      case 0x200:      /* n/c */
r1877r1878
282282         break;
283283
284284      case 0x202:      /* /WRP */
285         atarigen_6502_sound_w(offset, data);
285         atarigen_6502_sound_w(machine, offset, data);
286286         break;
287287
288288      case 0x204:      /* WRIO */
r1877r1878
440440   /* basic machine hardware */
441441   MDRV_CPU_ADD(M68000, ATARI_CLOCK_14MHz/2)
442442   MDRV_CPU_PROGRAM_MAP(main_map,0)
443   MDRV_CPU_VBLANK_INT(vblank_int,1)
443   MDRV_CPU_VBLANK_INT("main", vblank_int)
444444
445445   MDRV_CPU_ADD(M6502, ATARI_CLOCK_14MHz/8)
446446   MDRV_CPU_PROGRAM_MAP(audio_map,0)
src/mame/drivers/slapfght.c
r1877r1878
186186***************************************************************************/
187187
188188#include "driver.h"
189#include "deprecat.h"
189190#include "cpu/m6805/m6805.h"
190191#include "sound/ay8910.h"
191192
r1877r1878
340341
341342static READ8_HANDLER(tigerh_status_r)
342343{
343   return (slapfight_port_00_r(0)&0xf9)| ((tigerh_mcu_status_r(0)));
344   return (slapfight_port_00_r(machine,0)&0xf9)| ((tigerh_mcu_status_r(machine,0)));
344345}
345346
346347static ADDRESS_MAP_START( tigerh_readport, ADDRESS_SPACE_IO, 8 )
r1877r1878
833834
834835static VIDEO_EOF( perfrman )
835836{
836   buffer_spriteram_w(0,0);
837   buffer_spriteram_w(machine,0,0);
837838}
838839
839840static MACHINE_DRIVER_START( perfrman )
r1877r1878
842843   MDRV_CPU_ADD(Z80,16000000/4)         /* 4MHz ???, 16MHz Oscillator */
843844   MDRV_CPU_PROGRAM_MAP(perfrman_readmem,perfrman_writemem)
844845   MDRV_CPU_IO_MAP(readport,writeport)
845   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
846   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
846847
847848   MDRV_CPU_ADD(Z80,16000000/8)         /* 2MHz ???, 16MHz Oscillator */
848849   MDRV_CPU_PROGRAM_MAP(perfrman_sound_readmem,perfrman_sound_writemem)
849   MDRV_CPU_VBLANK_INT(getstar_interrupt,4)   /* music speed, verified */
850   MDRV_CPU_VBLANK_INT_HACK(getstar_interrupt,4)   /* music speed, verified */
850851
851852   MDRV_INTERLEAVE(10)      /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
852853
r1877r1878
889890   MDRV_CPU_ADD(Z80, 6000000)
890891   MDRV_CPU_PROGRAM_MAP(tigerh_readmem,writemem)
891892   MDRV_CPU_IO_MAP(readport,tigerh_writeport)
892   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
893   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
893894
894895   MDRV_CPU_ADD(Z80, 6000000)
895896   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
896   MDRV_CPU_VBLANK_INT(nmi_line_pulse,6)    /* ??? */
897   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,6)    /* ??? */
897898
898899   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
899900
r1877r1878
935936   MDRV_CPU_ADD(Z80, XTAL_36MHz/6) /* verified on pcb */
936937   MDRV_CPU_PROGRAM_MAP(tigerh_readmem,writemem)
937938   MDRV_CPU_IO_MAP(tigerh_readport,tigerh_writeport)
938   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
939   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
939940
940941   MDRV_CPU_ADD(Z80, XTAL_36MHz/12) /* verified on pcb */
941942   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
942   MDRV_CPU_VBLANK_INT(nmi_line_pulse,6)    /* ??? */
943   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,6)    /* ??? */
943944
944945   MDRV_CPU_ADD(M68705,XTAL_36MHz/12) /* verified on pcb */
945946   MDRV_CPU_PROGRAM_MAP(m68705_readmem,m68705_writemem)
r1877r1878
984985   MDRV_CPU_ADD_TAG("main",Z80, XTAL_36MHz/6) /* verified on pcb */
985986   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
986987   MDRV_CPU_IO_MAP(readport,writeport)
987   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
988   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
988989
989990   MDRV_CPU_ADD(Z80, XTAL_36MHz/12) /* verified on pcb */
990991   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
991   MDRV_CPU_VBLANK_INT(getstar_interrupt, 3)
992   MDRV_CPU_VBLANK_INT_HACK(getstar_interrupt, 3)
992993
993994   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
994995
src/mame/drivers/astinvad.c
r1877r1878
110110 *
111111 *************************************/
112112
113static void plot_byte(mame_bitmap *bitmap, UINT8 y, UINT8 x, UINT8 data, UINT8 color)
113static void plot_byte(bitmap_t *bitmap, UINT8 y, UINT8 x, UINT8 data, UINT8 color)
114114{
115115   pen_t fore_pen = MAKE_RGB(pal1bit(color >> 0), pal1bit(color >> 2), pal1bit(color >> 1));
116116   UINT8 flip_xor = screen_flip & 7;
r1877r1878
201201}
202202
203203
204static INTERRUPT_GEN( spaceint_interrupt )
204static INPUT_CHANGED( spaceint_coin_inserted )
205205{
206   if (readinputport(2) & 1)   /* coin */
207      cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
208
209   cpunum_set_input_line(machine, 0, 0, HOLD_LINE);
206   /* coin insertion causes an NMI */
207   cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, newval ? ASSERT_LINE : CLEAR_LINE);
210208}
211209
212210
r1877r1878
223221
224222   /* the address lines are used for /CS; yes, they can overlap! */
225223   if (!(offset & 4))
226      result &= ppi8255_0_r(offset);
224      result &= ppi8255_0_r(machine, offset);
227225   if (!(offset & 8))
228      result &= ppi8255_1_r(offset);
226      result &= ppi8255_1_r(machine, offset);
229227   return result;
230228}
231229
r1877r1878
234232{
235233   /* the address lines are used for /CS; yes, they can overlap! */
236234   if (!(offset & 4))
237      ppi8255_0_w(offset, data);
235      ppi8255_0_w(machine, offset, data);
238236   if (!(offset & 8))
239      ppi8255_1_w(offset, data);
237      ppi8255_1_w(machine, offset, data);
240238}
241239
242240
r1877r1878
453451   PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
454452
455453   PORT_START_TAG("IN2")
456   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1) /* causes NMI */
454   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(spaceint_coin_inserted, 0)
457455
458456   PORT_START_TAG("IN3")
459457   PORT_DIPNAME( 0xff, 0x00, DEF_STR( Cabinet ) )
r1877r1878
538536   MDRV_CPU_ADD(Z80, MASTER_CLOCK)        /* a guess */
539537   MDRV_CPU_PROGRAM_MAP(spaceint_map,0)
540538   MDRV_CPU_IO_MAP(spaceint_portmap,0)
541   MDRV_CPU_VBLANK_INT(spaceint_interrupt,1)
539   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
542540
543541   /* video hardware */
544542   MDRV_VIDEO_START(spaceint)
src/mame/drivers/psikyosh.c
r1877r1878
463463
464464static READ32_HANDLER( psh_ymf_fm_r )
465465{
466   return YMF278B_status_port_0_r(0)<<24; /* Also, bit 0 being high indicates not ready to send sample data for test */
466   return YMF278B_status_port_0_r(machine,0)<<24; /* Also, bit 0 being high indicates not ready to send sample data for test */
467467}
468468
469469static WRITE32_HANDLER( psh_ymf_fm_w )
470470{
471471   if (!(mem_mask & 0xff000000))   // FM bank 1 address (OPL2/OPL3 compatible)
472472   {
473      YMF278B_control_port_0_A_w(0, data>>24);
473      YMF278B_control_port_0_A_w(machine, 0, data>>24);
474474   }
475475
476476   if (!(mem_mask & 0x00ff0000))   // FM bank 1 data
477477   {
478      YMF278B_data_port_0_A_w(0, data>>16);
478      YMF278B_data_port_0_A_w(machine, 0, data>>16);
479479   }
480480
481481   if (!(mem_mask & 0x0000ff00))   // FM bank 2 address (OPL3/YMF 262 extended)
482482   {
483      YMF278B_control_port_0_B_w(0, data>>8);
483      YMF278B_control_port_0_B_w(machine, 0, data>>8);
484484   }
485485
486486   if (!(mem_mask & 0x000000ff))   // FM bank 2 data
487487   {
488      YMF278B_data_port_0_B_w(0, data);
488      YMF278B_data_port_0_B_w(machine, 0, data);
489489   }
490490}
491491
r1877r1878
493493{
494494   if (!(mem_mask & 0xff000000))   // PCM address (OPL4/YMF 278B extended)
495495   {
496      YMF278B_control_port_0_C_w(0, data>>24);
496      YMF278B_control_port_0_C_w(machine, 0, data>>24);
497497
498498#if ROMTEST
499499      if (data>>24 == 0x06)   // Reset Sample reading (They always write this code immediately before reading data)
r1877r1878
505505
506506   if (!(mem_mask & 0x00ff0000))   // PCM data
507507   {
508      YMF278B_data_port_0_C_w(0, data>>16);
508      YMF278B_data_port_0_C_w(machine, 0, data>>16);
509509   }
510510}
511511
r1877r1878
598598   /* basic machine hardware */
599599   MDRV_CPU_ADD_TAG("main", SH2, MASTER_CLOCK/2)
600600   MDRV_CPU_PROGRAM_MAP(ps3v1_readmem,ps3v1_writemem)
601   MDRV_CPU_VBLANK_INT(psikyosh_interrupt,1)
601   MDRV_CPU_VBLANK_INT("main", psikyosh_interrupt)
602602
603603   MDRV_NVRAM_HANDLER(93C56)
604604
src/mame/drivers/boogwing.c
r1877r1878
305305   /* basic machine hardware */
306306   MDRV_CPU_ADD(M68000, 14000000)   /* DE102 */
307307   MDRV_CPU_PROGRAM_MAP(boogwing_map,0)
308   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
308   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
309309
310310   MDRV_CPU_ADD(H6280,32220000/4)
311311   MDRV_CPU_PROGRAM_MAP(sound_readmem, sound_writemem)
src/mame/drivers/quizdna.c
r1877r1878
456456   MDRV_CPU_ADD_TAG("main", Z80, MCLK/2) /* 8.000 MHz */
457457   MDRV_CPU_PROGRAM_MAP(quizdna_readmem,quizdna_writemem)
458458   MDRV_CPU_IO_MAP(quizdna_readport,quizdna_writeport)
459   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
459   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
460460
461461   /* video hardware */
462462   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/supertnk.c
r1877r1878
273273
274274static MACHINE_RESET( supertnk )
275275{
276   supertnk_bankswitch_0_w(0, 0);
277   supertnk_bankswitch_1_w(0, 0);
276   supertnk_bankswitch_0_w(machine, 0, 0);
277   supertnk_bankswitch_1_w(machine, 0, 0);
278278
279   supertnk_bitplane_select_0_w(0, 0);
280   supertnk_bitplane_select_1_w(0, 0);
279   supertnk_bitplane_select_0_w(machine, 0, 0);
280   supertnk_bitplane_select_1_w(machine, 0, 0);
281281}
282282
283283
r1877r1878
413413   MDRV_CPU_ADD(TMS9980, 2598750) /* ? to which frequency is the 20.79 Mhz crystal mapped down? */
414414   MDRV_CPU_PROGRAM_MAP(supertnk_map,0)
415415   MDRV_CPU_IO_MAP(supertnk_io_map,0)
416   MDRV_CPU_VBLANK_INT(supertnk_interrupt,1)
416   MDRV_CPU_VBLANK_INT("main", supertnk_interrupt)
417417
418418   MDRV_MACHINE_RESET(supertnk)
419419
src/mame/drivers/darkhors.c
r1877r1878
101101   tilemap_mark_tile_dirty(darkhors_tmap2, offset);
102102}
103103
104static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
104static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
105105{
106106   UINT32 *s      =   spriteram32;
107107   UINT32 *end      =   spriteram32 + 0x02000/4;
r1877r1878
258258static WRITE32_HANDLER( OKIM6295_data_0_msb32_w )
259259{
260260   if (ACCESSING_MSB32)
261      OKIM6295_data_0_msb_w(offset, data >> 16, mem_mask >> 16);
261      OKIM6295_data_0_msb_w(machine, offset, data >> 16, mem_mask >> 16);
262262}
263263
264264static READ32_HANDLER( OKIM6295_status_0_msb32_r )
265265{
266   return OKIM6295_status_0_msb_r(offset, mem_mask >> 16) << 16;
266   return OKIM6295_status_0_msb_r(machine, offset, mem_mask >> 16) << 16;
267267}
268268
269269static WRITE32_HANDLER( paletteram32_xBBBBBGGGGGRRRRR_dword_w )
270270{
271271   paletteram16 = (UINT16 *)paletteram32;
272   if (ACCESSING_MSW32)   paletteram16_xBBBBBGGGGGRRRRR_word_w(offset*2, data >> 16, mem_mask >> 16);
273   if (ACCESSING_LSW32)   paletteram16_xBBBBBGGGGGRRRRR_word_w(offset*2+1, data, mem_mask);
272   if (ACCESSING_MSW32)   paletteram16_xBBBBBGGGGGRRRRR_word_w(machine, offset*2, data >> 16, mem_mask >> 16);
273   if (ACCESSING_LSW32)   paletteram16_xBBBBBGGGGGRRRRR_word_w(machine, offset*2+1, data, mem_mask);
274274}
275275
276276static UINT32 input_sel;
r1877r1878
600600static MACHINE_DRIVER_START( darkhors )
601601   MDRV_CPU_ADD(M68EC020, 12000000) // 36MHz/3 ??
602602   MDRV_CPU_PROGRAM_MAP(darkhors_readmem,darkhors_writemem)
603   MDRV_CPU_VBLANK_INT(darkhors,3)
603   MDRV_CPU_VBLANK_INT_HACK(darkhors,3)
604604
605605   MDRV_NVRAM_HANDLER(darkhors)
606606
src/mame/drivers/bishjan.c
r1877r1878
208208      (mame_rand(Machine) & 0x9800)   |   // bit 7 eeprom?
209209      (((bishjan_sel==0x12) ? 0x40:0x00) << 8) |
210210//      (mame_rand() & 0xff);
211//      (((cpu_getcurrentframe()%60)==0)?0x18:0x00);
211//      (((video_screen_get_frame_number(0)%60)==0)?0x18:0x00);
212212      0x18;
213213}
214214
r1877r1878
228228
229229   return   (res << 8) |
230230         readinputport(3) |
231         ((bishjan_hopper && !(cpu_getcurrentframe()%10)) ? 0x00 : 0x04)   // bit 2: hopper sensor
231         ((bishjan_hopper && !(video_screen_get_frame_number(0)%10)) ? 0x00 : 0x04)   // bit 2: hopper sensor
232232   ;
233233}
234234
r1877r1878
442442static MACHINE_DRIVER_START( bishjan )
443443   MDRV_CPU_ADD(H83044, 44100000/3)
444444   MDRV_CPU_PROGRAM_MAP( bishjan_map, 0 )
445   MDRV_CPU_VBLANK_INT(bishjan_interrupt,2)
445   MDRV_CPU_VBLANK_INT_HACK(bishjan_interrupt,2)
446446
447447   MDRV_NVRAM_HANDLER(generic_0fill)
448448
src/mame/drivers/upscope.c
r1877r1878
290290   /* basic machine hardware */
291291   MDRV_CPU_ADD(M68000, AMIGA_68000_NTSC_CLOCK)
292292   MDRV_CPU_PROGRAM_MAP(main_map,0)
293   MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 262)
294293
295294   MDRV_MACHINE_RESET(amiga)
296295   MDRV_NVRAM_HANDLER(generic_0fill)
r1877r1878
309308   MDRV_PALETTE_INIT(amiga)
310309
311310   MDRV_VIDEO_START(amiga)
312   MDRV_VIDEO_UPDATE(generic_bitmapped)
311   MDRV_VIDEO_UPDATE(amiga)
313312
314313   /* sound hardware */
315314   MDRV_SPEAKER_STANDARD_STEREO("left", "right")
src/mame/drivers/equites.c
r1877r1878
308308static WRITE16_HANDLER(splndrbt_flip0_w)
309309{
310310   if (ACCESSING_LSB) splndrbt_flip = 0;
311   if (ACCESSING_MSB) equites_bgcolor_w(offset, data, 0x00ff);
311   if (ACCESSING_MSB) equites_bgcolor_w(machine, offset, data, 0x00ff);
312312}
313313
314314static WRITE16_HANDLER(splndrbt_flip1_w)
r1877r1878
666666   /* basic machine hardware */
667667   MDRV_CPU_ADD(M68000, XTAL_12MHz/4) /* 68000P8 running at 3mhz! verified on pcb */
668668   MDRV_CPU_PROGRAM_MAP(equites_map,0)
669   MDRV_CPU_VBLANK_INT(equites_interrupt, 2)
669   MDRV_CPU_VBLANK_INT_HACK(equites_interrupt, 2)
670670
671671   /* video hardware */
672672   MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK)
r1877r1878
695695   /* basic machine hardware */
696696   MDRV_CPU_ADD(M68000, XTAL_24MHz/4) /* 68000P8 running at 6mhz, verified on pcb */
697697   MDRV_CPU_PROGRAM_MAP(splndrbt_map, 0)
698   MDRV_CPU_VBLANK_INT(splndrbt_interrupt, 2)
698   MDRV_CPU_VBLANK_INT_HACK(splndrbt_interrupt, 2)
699699
700700   MDRV_MACHINE_RESET(splndrbt)
701701
src/mame/drivers/esh.c
r1877r1878
286286   MDRV_CPU_ADD(Z80, PCB_CLOCK/6)                  /* The denominator is a Daphne guess based on PacMan's hardware */
287287   MDRV_CPU_PROGRAM_MAP(z80_0_mem,0)
288288   MDRV_CPU_IO_MAP(z80_0_io,0)
289   MDRV_CPU_VBLANK_INT(vblank_callback_esh, 1)
289   MDRV_CPU_VBLANK_INT("main", vblank_callback_esh)
290290
291291   MDRV_MACHINE_START(esh)
292292   MDRV_NVRAM_HANDLER(generic_0fill)
src/mame/drivers/mirax.c
r1877r1878
6161*/
6262
6363#include "driver.h"
64#include "deprecat.h"
6465#include "sound/ay8910.h"
6566
6667static int nSndNum=0x10;
r1877r1878
105106{
106107   if(activecpu_get_previouspc()==0x309)
107108   {
108      AY8910_control_port_0_w(0,nAyCtrl);
109      AY8910_write_port_0_w(0,nAyData);
109      AY8910_control_port_0_w(machine,0,nAyCtrl);
110      AY8910_write_port_0_w(machine,0,nAyData);
110111   }
111112}
112113
r1877r1878
115116
116117   if(activecpu_get_previouspc()==0x309)
117118   {
118      AY8910_control_port_1_w(0,nAyCtrl);
119      AY8910_write_port_1_w(0,nAyData);
119      AY8910_control_port_1_w(machine,0,nAyCtrl);
120      AY8910_write_port_1_w(machine,0,nAyData);
120121   }
121122}
122123
r1877r1878
179180   MDRV_CPU_ADD(Z80, 12000000) // audio cpu ?
180181   MDRV_CPU_PROGRAM_MAP(memory_map,0)
181182   MDRV_CPU_IO_MAP(io_map,0)
182   MDRV_CPU_VBLANK_INT(irq0_line_hold, 2)
183   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold, 2)
183184
184185   /* video hardware */
185186   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/gradius3.c
r1877r1878
3535
3636static READ16_HANDLER( K052109_halfword_r )
3737{
38   return K052109_r(offset);
38   return K052109_r(machine,offset);
3939}
4040
4141static WRITE16_HANDLER( K052109_halfword_w )
4242{
4343   if (ACCESSING_LSB)
44      K052109_w(offset,data & 0xff);
44      K052109_w(machine,offset,data & 0xff);
4545
4646   /* is this a bug in the game or something else? */
4747   if (!ACCESSING_LSB)
48      K052109_w(offset,(data >> 8) & 0xff);
48      K052109_w(machine,offset,(data >> 8) & 0xff);
4949//      logerror("%06x half %04x = %04x\n",activecpu_get_pc(),offset,data);
5050}
5151
5252static READ16_HANDLER( K051937_halfword_r )
5353{
54   return K051937_r(offset);
54   return K051937_r(machine,offset);
5555}
5656
5757static WRITE16_HANDLER( K051937_halfword_w )
5858{
5959   if (ACCESSING_LSB)
60      K051937_w(offset,data & 0xff);
60      K051937_w(machine,offset,data & 0xff);
6161}
6262
6363static READ16_HANDLER( K051960_halfword_r )
6464{
65   return K051960_r(offset);
65   return K051960_r(machine,offset);
6666}
6767
6868static WRITE16_HANDLER( K051960_halfword_w )
6969{
7070   if (ACCESSING_LSB)
71      K051960_w(offset,data & 0xff);
71      K051960_w(machine,offset,data & 0xff);
7272}
7373
7474
r1877r1878
139139   if (irqBmask & 4)
140140   {
141141logerror("%04x trigger cpu B irq 4 %02x\n",activecpu_get_pc(),data);
142      cpunum_set_input_line(Machine, 1,4,HOLD_LINE);
142      cpunum_set_input_line(machine, 1,4,HOLD_LINE);
143143   }
144144   else
145145logerror("%04x MISSED cpu B irq 4 %02x\n",activecpu_get_pc(),data);
r1877r1878
148148static WRITE16_HANDLER( sound_command_w )
149149{
150150   if (ACCESSING_MSB)
151      soundlatch_w(0,(data >> 8) & 0xff);
151      soundlatch_w(machine,0,(data >> 8) & 0xff);
152152}
153153
154154static WRITE16_HANDLER( sound_irq_w )
r1877r1878
339339   /* basic machine hardware */
340340   MDRV_CPU_ADD(M68000, 10000000)   /* 10 MHz */
341341   MDRV_CPU_PROGRAM_MAP(gradius3_map,0)
342   MDRV_CPU_VBLANK_INT(cpuA_interrupt,1)
342   MDRV_CPU_VBLANK_INT("main", cpuA_interrupt)
343343
344344   MDRV_CPU_ADD(M68000, 10000000)   /* 10 MHz */
345345   MDRV_CPU_PROGRAM_MAP(gradius3_map2,0)
346   MDRV_CPU_VBLANK_INT(cpuB_interrupt,2)   /* has three interrupt vectors, 1 2 and 4 */
346   MDRV_CPU_VBLANK_INT_HACK(cpuB_interrupt,2)   /* has three interrupt vectors, 1 2 and 4 */
347347                        /* 4 is triggered by cpu A, the others are unknown but */
348348                        /* required for the game to run. */
349349   MDRV_CPU_ADD(Z80, 3579545)
src/mame/drivers/omegrace.c
r1877r1878
235235static MACHINE_RESET( omegrace )
236236{
237237   /* Omega Race expects the vector processor to be ready. */
238   avgdvg_reset_w (0, 0);
238   avgdvg_reset_w (machine,0, 0);
239239}
240240
241241
r1877r1878
248248
249249static READ8_HANDLER( omegrace_vg_go_r )
250250{
251   avgdvg_go_w(0,0);
251   avgdvg_go_w(machine,0,0);
252252   return 0;
253253}
254254
r1877r1878
322322
323323static WRITE8_HANDLER( omegrace_soundlatch_w )
324324{
325   soundlatch_w (offset, data);
326   cpunum_set_input_line(Machine, 1, 0, HOLD_LINE);
325   soundlatch_w (machine, offset, data);
326   cpunum_set_input_line(machine, 1, 0, HOLD_LINE);
327327}
328328
329329
src/mame/drivers/decocass.c
r1877r1878
7272}
7373
7474static WRITE8_HANDLER( ram_w )        { decrypted[0x0000 + offset] = swap_bits_5_6(data); decocass_rambase[0x0000 + offset] = data;  }
75static WRITE8_HANDLER( charram_w )    { decrypted[0x6000 + offset] = swap_bits_5_6(data); decocass_charram_w(offset, data); }
76static WRITE8_HANDLER( fgvideoram_w ) { decrypted[0xc000 + offset] = swap_bits_5_6(data); decocass_fgvideoram_w(offset, data); }
77static WRITE8_HANDLER( fgcolorram_w ) { decrypted[0xc400 + offset] = swap_bits_5_6(data); decocass_colorram_w(offset, data); }
78static WRITE8_HANDLER( tileram_w )    { decrypted[0xd000 + offset] = swap_bits_5_6(data); decocass_tileram_w(offset, data); }
79static WRITE8_HANDLER( objectram_w )  { decrypted[0xd800 + offset] = swap_bits_5_6(data); decocass_objectram_w(offset, data); }
75static WRITE8_HANDLER( charram_w )    { decrypted[0x6000 + offset] = swap_bits_5_6(data); decocass_charram_w(machine, offset, data); }
76static WRITE8_HANDLER( fgvideoram_w ) { decrypted[0xc000 + offset] = swap_bits_5_6(data); decocass_fgvideoram_w(machine, offset, data); }
77static WRITE8_HANDLER( fgcolorram_w ) { decrypted[0xc400 + offset] = swap_bits_5_6(data); decocass_colorram_w(machine, offset, data); }
78static WRITE8_HANDLER( tileram_w )    { decrypted[0xd000 + offset] = swap_bits_5_6(data); decocass_tileram_w(machine, offset, data); }
79static WRITE8_HANDLER( objectram_w )  { decrypted[0xd800 + offset] = swap_bits_5_6(data); decocass_objectram_w(machine, offset, data); }
8080
81static WRITE8_HANDLER( mirrorvideoram_w ) { offset = ((offset >> 5) & 0x1f) | ((offset & 0x1f) << 5); fgvideoram_w(offset, data); }
82static WRITE8_HANDLER( mirrorcolorram_w ) { offset = ((offset >> 5) & 0x1f) | ((offset & 0x1f) << 5); fgcolorram_w(offset, data); }
81static WRITE8_HANDLER( mirrorvideoram_w ) { offset = ((offset >> 5) & 0x1f) | ((offset & 0x1f) << 5); fgvideoram_w(machine, offset, data); }
82static WRITE8_HANDLER( mirrorcolorram_w ) { offset = ((offset >> 5) & 0x1f) | ((offset & 0x1f) << 5); fgcolorram_w(machine, offset, data); }
8383static READ8_HANDLER( mirrorvideoram_r ) { offset = ((offset >> 5) & 0x1f) | ((offset & 0x1f) << 5); return decocass_fgvideoram[offset]; }
8484static READ8_HANDLER( mirrorcolorram_r ) { offset = ((offset >> 5) & 0x1f) | ((offset & 0x1f) << 5); return decocass_colorram[offset]; }
8585
src/mame/drivers/mystwarr.c
r1877r1878
258258
259259static WRITE16_HANDLER( sound_cmd1_w )
260260{
261   soundlatch_w(0, data&0xff);
261   soundlatch_w(machine, 0, data&0xff);
262262}
263263
264264static WRITE16_HANDLER( sound_cmd1_msb_w )
265265{
266   soundlatch_w(0, data>>8);
266   soundlatch_w(machine, 0, data>>8);
267267}
268268
269269static WRITE16_HANDLER( sound_cmd2_w )
270270{
271   soundlatch2_w(0, data&0xff);
271   soundlatch2_w(machine, 0, data&0xff);
272272   return;
273273}
274274
275275static WRITE16_HANDLER( sound_cmd2_msb_w )
276276{
277   soundlatch2_w(0, data>>8);
277   soundlatch2_w(machine, 0, data>>8);
278278   return;
279279}
280280
281281static WRITE16_HANDLER( sound_irq_w )
282282{
283   cpunum_set_input_line(Machine, 1, 0, HOLD_LINE);
283   cpunum_set_input_line(machine, 1, 0, HOLD_LINE);
284284}
285285
286286static READ16_HANDLER( sound_status_r )
287287{
288   int latch = soundlatch3_r(0);
288   int latch = soundlatch3_r(machine,0);
289289
290290   if ((latch & 0xf) == 0xe) latch |= 1;
291291
r1877r1878
294294
295295static READ16_HANDLER( sound_status_msb_r )
296296{
297   int latch = soundlatch3_r(0);
297   int latch = soundlatch3_r(machine,0);
298298
299299   if ((latch & 0xf) == 0xe) latch |= 1;
300300
r1877r1878
303303
304304static WRITE16_HANDLER( irq_ack_w )
305305{
306   K056832_b_word_w(offset, data, mem_mask);
306   K056832_b_word_w(machine, offset, data, mem_mask);
307307
308308   if (offset == 3 && ACCESSING_LSB)
309309   {
r1877r1878
369369   else
370370   {
371371      offset = (offset & 0x0007) | ((offset & 0x7f80) >> 4);
372      return K053247_word_r(offset,mem_mask);
372      return K053247_word_r(machine,offset,mem_mask);
373373   }
374374}
375375
r1877r1878
384384   {
385385      offset = (offset & 0x0007) | ((offset & 0x7f80) >> 4);
386386
387      K053247_word_w(offset,data,mem_mask);
387      K053247_word_w(machine,offset,data,mem_mask);
388388   }
389389}
390390
r1877r1878
557557   else
558558   {
559559      offset = (offset & 0x0007) | ((offset & 0x1fe0) >> 2);
560      return K053247_word_r(offset,mem_mask);
560      return K053247_word_r(machine,offset,mem_mask);
561561   }
562562}
563563
r1877r1878
571571   {
572572      offset = (offset & 0x0007) | ((offset & 0x1fe0) >> 2);
573573
574      K053247_word_w(offset,data,mem_mask);
574      K053247_word_w(machine,offset,data,mem_mask);
575575   }
576576}
577577
r1877r1878
931931   /* basic machine hardware */
932932   MDRV_CPU_ADD_TAG("main", M68000, 16000000)   /* 16 MHz (confirmed) */
933933   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
934   MDRV_CPU_VBLANK_INT(mystwarr_interrupt, 3)
934   MDRV_CPU_VBLANK_INT_HACK(mystwarr_interrupt, 3)
935935
936936   MDRV_CPU_ADD_TAG("sound", Z80, 8000000)
937937   /* audio CPU */
r1877r1878
981981   /* basic machine hardware */
982982   MDRV_CPU_MODIFY("main")
983983   MDRV_CPU_PROGRAM_MAP(vsreadmem,vswritemem)
984   MDRV_CPU_VBLANK_INT(metamrph_interrupt, 40)
984   MDRV_CPU_VBLANK_INT_HACK(metamrph_interrupt, 40)
985985
986986   /* video hardware */
987987   MDRV_VIDEO_START(viostorm)
r1877r1878
10011001   /* basic machine hardware */
10021002   MDRV_CPU_MODIFY("main")
10031003   MDRV_CPU_PROGRAM_MAP(mmreadmem,mmwritemem)
1004   MDRV_CPU_VBLANK_INT(metamrph_interrupt, 40)
1004   MDRV_CPU_VBLANK_INT_HACK(metamrph_interrupt, 40)
10051005
10061006   /* video hardware */
10071007   MDRV_VIDEO_START(metamrph)
r1877r1878
10211021   /* basic machine hardware */
10221022   MDRV_CPU_MODIFY("main")
10231023   MDRV_CPU_PROGRAM_MAP(dddreadmem, dddwritemem)
1024   MDRV_CPU_VBLANK_INT(ddd_interrupt, 1)
1024   MDRV_CPU_VBLANK_INT("main", ddd_interrupt)
10251025
10261026   MDRV_GFXDECODE(dadandrn)
10271027
r1877r1878
10431043   /* basic machine hardware */
10441044   MDRV_CPU_MODIFY("main")
10451045   MDRV_CPU_PROGRAM_MAP(gaiareadmem,gaiawritemem)
1046   MDRV_CPU_VBLANK_INT(ddd_interrupt, 1)
1046   MDRV_CPU_VBLANK_INT("main", ddd_interrupt)
10471047
10481048   MDRV_GFXDECODE(gaiapols)
10491049
r1877r1878
10671067   /* basic machine hardware */
10681068   MDRV_CPU_MODIFY("main")
10691069   MDRV_CPU_PROGRAM_MAP(mcreadmem,mcwritemem)
1070   MDRV_CPU_VBLANK_INT(mchamp_interrupt, 2)
1070   MDRV_CPU_VBLANK_INT_HACK(mchamp_interrupt, 2)
10711071
10721072   MDRV_VIDEO_ATTRIBUTES(VIDEO_HAS_SHADOWS | VIDEO_HAS_HIGHLIGHTS | VIDEO_UPDATE_BEFORE_VBLANK)
10731073
src/mame/drivers/fromance.c
r1877r1878
10601060   /* basic machine hardware */
10611061   MDRV_CPU_ADD(Z80,12000000/2)      /* 6.00 Mhz ? */
10621062   MDRV_CPU_PROGRAM_MAP(nekkyoku_readmem_main,nekkyoku_writemem_main)
1063   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1063   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
10641064
10651065   MDRV_CPU_ADD(Z80,12000000/2)      /* 6.00 Mhz ? */
10661066   MDRV_CPU_PROGRAM_MAP(nekkyoku_readmem_sub,nekkyoku_writemem_sub)
r1877r1878
10981098   /* basic machine hardware */
10991099   MDRV_CPU_ADD(Z80,12000000/2)      /* 6.00 Mhz ? */
11001100   MDRV_CPU_PROGRAM_MAP(fromance_readmem_main,fromance_writemem_main)
1101   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1101   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
11021102
11031103   MDRV_CPU_ADD(Z80,12000000/2)      /* 6.00 Mhz ? */
11041104   MDRV_CPU_PROGRAM_MAP(fromance_readmem_sub,fromance_writemem_sub)
r1877r1878
11361136   /* basic machine hardware */
11371137   MDRV_CPU_ADD(Z80,12000000/2)      /* 6.00 Mhz ? */
11381138   MDRV_CPU_PROGRAM_MAP(fromance_readmem_main,fromance_writemem_main)
1139   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1139   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
11401140
11411141   MDRV_CPU_ADD(Z80,12000000/2)      /* 6.00 Mhz ? */
11421142   MDRV_CPU_PROGRAM_MAP(fromance_readmem_sub,fromance_writemem_sub)
src/mame/drivers/dlair.c
r1877r1878
7676static render_texture *overlay_texture;
7777static UINT32 last_seqid;
7878
79static mame_bitmap *overlay_bitmap;
79static bitmap_t *overlay_bitmap;
8080
8181static const UINT8 led_map[16] =
8282   { 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7c,0x07,0x7f,0x67,0x77,0x7c,0x39,0x5e,0x79,0x00 };
r1877r1878
164164
165165static VIDEO_START( dlair )
166166{
167   mame_bitmap *vidbitmap;
167   bitmap_t *vidbitmap;
168168
169169   /* create textures */
170170   last_seqid = laserdisc_get_video(discinfo, &vidbitmap);
r1877r1878
207207
208208static VIDEO_UPDATE( dlair )
209209{
210   mame_bitmap *vidbitmap;
210   bitmap_t *vidbitmap;
211211   UINT32 seqid;
212212
213213   /* get the current video and update the bitmap if different */
r1877r1878
229229
230230static VIDEO_UPDATE( dleuro )
231231{
232   mame_bitmap *vidbitmap;
232   bitmap_t *vidbitmap;
233233   UINT32 seqid;
234234   int x, y;
235235
r1877r1878
680680INPUT_PORTS_END
681681
682682
683#ifdef UNUSED_DEFINITION
683684static INPUT_PORTS_START( dleuro )
684685   PORT_START   /* IN0 */
685686   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
r1877r1878
751752   PORT_DIPSETTING(   0x80, DEF_STR( Easy ) ) PORT_CONDITION("DSW1",0x04,PORTCOND_EQUALS,0x04)
752753   PORT_DIPSETTING(   0x90, DEF_STR( Easy ) ) PORT_CONDITION("DSW1",0x04,PORTCOND_EQUALS,0x04)
753754INPUT_PORTS_END
755#endif
754756
755757
756
757758/*************************************
758759 *
759760 *  Graphics definitions
r1877r1878
803804   /* basic machine hardware */
804805   MDRV_CPU_ADD_TAG("main", Z80, MASTER_CLOCK_US/4)
805806   MDRV_CPU_PROGRAM_MAP(dlus_map,0)
806   MDRV_CPU_VBLANK_INT(vblank_callback, 1)
807   MDRV_CPU_VBLANK_INT("main", vblank_callback)
807808   MDRV_CPU_PERIODIC_INT(irq0_line_hold, (double)MASTER_CLOCK_US/8/16/16/16/16)
808809
809810   MDRV_MACHINE_START(dlair)
r1877r1878
843844   MDRV_CPU_CONFIG(dleuro_daisy_chain)
844845   MDRV_CPU_PROGRAM_MAP(dleuro_map,0)
845846   MDRV_CPU_IO_MAP(dleuro_io_map,0)
846   MDRV_CPU_VBLANK_INT(vblank_callback, 1)
847   MDRV_CPU_VBLANK_INT("main", vblank_callback)
847848
848849   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_HZ(MASTER_CLOCK_EURO/(16*16*16*16*16*8)))
849850
src/mame/drivers/jollyjgr.c
r1877r1878
279279   tilemap_set_scroll_cols(bg_tilemap, 32);
280280}
281281
282static void draw_bitmap(mame_bitmap *bitmap)
282static void draw_bitmap(bitmap_t *bitmap)
283283{
284284   int x,y,count;
285285   int i, bit0, bit1, bit2;
r1877r1878
400400static MACHINE_DRIVER_START( jollyjgr )
401401   MDRV_CPU_ADD(Z80, 3579545)       /* 3,579545 MHz */
402402   MDRV_CPU_PROGRAM_MAP(jollyjgr_map,0)
403   MDRV_CPU_VBLANK_INT(jollyjgr_interrupt,1)
403   MDRV_CPU_VBLANK_INT("main", jollyjgr_interrupt)
404404
405405   /* video hardware */
406406   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/skykid.c
r1877r1878
454454   /* basic machine hardware */
455455   MDRV_CPU_ADD(M6809,49152000/32)
456456   MDRV_CPU_PROGRAM_MAP(skykid_map,0)
457   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
457   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
458458
459459   MDRV_CPU_ADD(HD63701,49152000/8)   /* or compatible 6808 with extra instructions */
460460   MDRV_CPU_PROGRAM_MAP(mcu_map,0)
461461   MDRV_CPU_IO_MAP(mcu_port_map,0)
462   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
462   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
463463
464464   MDRV_INTERLEAVE(100)   /* we need heavy synch */
465465
src/mame/drivers/klax.c
r1877r1878
5454
5555static WRITE16_HANDLER( interrupt_ack_w )
5656{
57   atarigen_scanline_int_ack_w(offset, data, mem_mask);
58   atarigen_video_int_ack_w(offset, data, mem_mask);
57   atarigen_scanline_int_ack_w(machine, offset, data, mem_mask);
58   atarigen_video_int_ack_w(machine, offset, data, mem_mask);
5959}
6060
6161
r1877r1878
8383
8484static READ16_HANDLER( adpcm_r )
8585{
86   return OKIM6295_status_0_r(offset) | 0xff00;
86   return OKIM6295_status_0_r(machine, offset) | 0xff00;
8787}
8888
8989
9090static WRITE16_HANDLER( adpcm_w )
9191{
9292   if (ACCESSING_LSB)
93      OKIM6295_data_0_w(offset, data & 0xff);
93      OKIM6295_data_0_w(machine, offset, data & 0xff);
9494}
9595
9696
r1877r1878
198198   /* basic machine hardware */
199199   MDRV_CPU_ADD(M68000, ATARI_CLOCK_14MHz/2)
200200   MDRV_CPU_PROGRAM_MAP(main_readmem,main_writemem)
201   MDRV_CPU_VBLANK_INT(atarigen_video_int_gen,1)
201   MDRV_CPU_VBLANK_INT("main", atarigen_video_int_gen)
202202
203203   MDRV_MACHINE_RESET(klax)
204204   MDRV_NVRAM_HANDLER(atarigen)
src/mame/drivers/quizpani.c
r1877r1878
249249static MACHINE_DRIVER_START( quizpani )
250250   MDRV_CPU_ADD(M68000, 10000000)
251251   MDRV_CPU_PROGRAM_MAP(quizpani_readmem,quizpani_writemem)
252   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
252   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
253253   MDRV_CPU_PERIODIC_INT(irq1_line_hold,164) // music tempo
254254
255255   MDRV_MACHINE_RESET( quizpani )
src/mame/drivers/halleys.c
r1877r1878
12021202}
12031203
12041204
1205static void copy_scroll_op(mame_bitmap *bitmap, UINT16 *source, int sx, int sy)
1205static void copy_scroll_op(bitmap_t *bitmap, UINT16 *source, int sx, int sy)
12061206{
12071207
12081208//--------------------------------------------------------------------------
r1877r1878
12401240}
12411241
12421242
1243static void copy_scroll_xp(mame_bitmap *bitmap, UINT16 *source, int sx, int sy)
1243static void copy_scroll_xp(bitmap_t *bitmap, UINT16 *source, int sx, int sy)
12441244{
12451245
12461246//--------------------------------------------------------------------------
r1877r1878
12961296
12971297
12981298
1299static void copy_fixed_xp(mame_bitmap *bitmap, UINT16 *source)
1299static void copy_fixed_xp(bitmap_t *bitmap, UINT16 *source)
13001300{
13011301   UINT16 *esi, *edi;
13021302   int dst_pitch, ecx, edx;
r1877r1878
13311331}
13321332
13331333
1334static void copy_fixed_2b(mame_bitmap *bitmap, UINT16 *source)
1334static void copy_fixed_2b(bitmap_t *bitmap, UINT16 *source)
13351335{
13361336   UINT16 *esi, *edi;
13371337   int dst_pitch, ecx, edx;
r1877r1878
13781378}
13791379
13801380
1381static void filter_bitmap(mame_bitmap *bitmap, int mask)
1381static void filter_bitmap(bitmap_t *bitmap, int mask)
13821382{
13831383   int dst_pitch;
13841384
r1877r1878
14991499            latch_data = sound_fifo[fftail];
15001500            fftail = (fftail + 1) & (MAX_SOUNDS - 1);
15011501            latch_delay = (latch_data) ? 0 : 4;
1502            soundlatch_w(0, latch_data);
1502            soundlatch_w(machine, 0, latch_data);
15031503            cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
15041504         }
15051505
r1877r1878
15391539            latch_data = sound_fifo[fftail];
15401540            fftail = (fftail + 1) & (MAX_SOUNDS - 1);
15411541            latch_delay = (latch_data) ? 0 : 4;
1542            soundlatch_w(0, latch_data);
1542            soundlatch_w(machine, 0, latch_data);
15431543            cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
15441544         }
15451545      break;
r1877r1878
19501950static MACHINE_DRIVER_START( halleys )
19511951   MDRV_CPU_ADD_TAG("main", M6809, 1664000) /* 19968000/12 (verified on pcb) */
19521952   MDRV_CPU_PROGRAM_MAP(readmem, writemem)
1953   MDRV_CPU_VBLANK_INT(halleys_interrupt, 4)
1953   MDRV_CPU_VBLANK_INT_HACK(halleys_interrupt, 4)
19541954
19551955   MDRV_CPU_ADD(Z80, 6000000/2) /* (verified on pcb) */
19561956   /* audio CPU */
r1877r1878
19771977   // sound hardware
19781978   MDRV_SPEAKER_STANDARD_MONO("mono")
19791979
1980   MDRV_SOUND_ADD(AY8910, 6000000/4) /* (verified on pcb) */
1980   MDRV_SOUND_ADD(AY8910, XTAL_6MHz/4) /* verified on pcb */
19811981   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15)
19821982
1983   MDRV_SOUND_ADD(AY8910, 6000000/4)
1983   MDRV_SOUND_ADD(AY8910, XTAL_6MHz/4) /* verified on pcb */
19841984   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15)
19851985
1986   MDRV_SOUND_ADD(AY8910, 6000000/4)
1986   MDRV_SOUND_ADD(AY8910, XTAL_6MHz/4) /* verified on pcb */
19871987   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15)
19881988
1989   MDRV_SOUND_ADD(AY8910, 6000000/4)
1989   MDRV_SOUND_ADD(AY8910, XTAL_6MHz/4) /* verified on pcb */
19901990   MDRV_SOUND_CONFIG(ay8910_interface)
19911991   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15)
19921992MACHINE_DRIVER_END
r1877r1878
19951995static MACHINE_DRIVER_START( benberob )
19961996   MDRV_IMPORT_FROM(halleys)
19971997   MDRV_CPU_REPLACE("main", M6809, 1000000) // 19.968MHz/20? (CAUTION: timing critical)
1998   MDRV_CPU_VBLANK_INT(benberob_interrupt, 4)
1998   MDRV_CPU_VBLANK_INT_HACK(benberob_interrupt, 4)
19991999   MDRV_VIDEO_UPDATE(benberob)
20002000MACHINE_DRIVER_END
20012001
src/mame/drivers/gomoku.c
r1877r1878
169169   /* basic machine hardware */
170170   MDRV_CPU_ADD(Z80, 18432000/12)       /* 1.536 MHz ? */
171171   MDRV_CPU_PROGRAM_MAP(readmem_gomoku, writemem_gomoku)
172   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
172   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
173173
174174   /* video hardware */
175175   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/djmain.c
r1877r1878
145145   UINT16 ret = 0;
146146
147147   if (ACCESSING_LSB16)
148      ret |= K054539_1_r(offset);
148      ret |= K054539_1_r(machine, offset);
149149   if (ACCESSING_MSB16)
150      ret |= K054539_0_r(offset)<<8;
150      ret |= K054539_0_r(machine, offset)<<8;
151151
152152   return ret;
153153}
r1877r1878
155155static WRITE16_HANDLER( dual539_16_w )
156156{
157157   if (ACCESSING_LSB16)
158      K054539_1_w(offset, data);
158      K054539_1_w(machine, offset, data);
159159   if (ACCESSING_MSB16)
160      K054539_0_w(offset, data>>8);
160      K054539_0_w(machine, offset, data>>8);
161161}
162162
163163static READ32_HANDLER( dual539_r )
r1877r1878
165165   UINT32 data = 0;
166166
167167   if (~mem_mask & 0xffff0000)
168      data |= dual539_16_r(offset * 2, mem_mask >> 16) << 16;
168      data |= dual539_16_r(machine, offset * 2, mem_mask >> 16) << 16;
169169   if (~mem_mask & 0x0000ffff)
170      data |= dual539_16_r(offset * 2 + 1, mem_mask);
170      data |= dual539_16_r(machine, offset * 2 + 1, mem_mask);
171171
172172   return data;
173173}
r1877r1878
175175static WRITE32_HANDLER( dual539_w )
176176{
177177   if (~mem_mask & 0xffff0000)
178      dual539_16_w(offset * 2, data >> 16, mem_mask >> 16);
178      dual539_16_w(machine, offset * 2, data >> 16, mem_mask >> 16);
179179   if (~mem_mask & 0x0000ffff)
180      dual539_16_w(offset * 2 + 1, data, mem_mask);
180      dual539_16_w(machine, offset * 2 + 1, data, mem_mask);
181181}
182182
183183
r1877r1878
237237static READ32_HANDLER( v_rom_r )
238238{
239239   UINT8 *mem8 = memory_region(REGION_GFX2);
240   int bank = K056832_word_r(0x34/2, 0xffff);
240   int bank = K056832_word_r(machine, 0x34/2, 0xffff);
241241
242242   offset *= 2;
243243
r1877r1878
307307static READ32_HANDLER( ide_std_r )
308308{
309309   if (ACCESSING_LSB32)
310      return ide_controller16_0_r(IDE_STD_OFFSET + offset, 0x00ff) >> 8;
310      return ide_controller16_0_r(machine, IDE_STD_OFFSET + offset, 0x00ff) >> 8;
311311   else
312      return ide_controller16_0_r(IDE_STD_OFFSET + offset, 0x0000) << 16;
312      return ide_controller16_0_r(machine, IDE_STD_OFFSET + offset, 0x0000) << 16;
313313}
314314
315315static WRITE32_HANDLER( ide_std_w )
316316{
317317   if (ACCESSING_LSB32)
318      ide_controller16_0_w(IDE_STD_OFFSET + offset, data << 8, 0x00ff);
318      ide_controller16_0_w(machine, IDE_STD_OFFSET + offset, data << 8, 0x00ff);
319319   else
320      ide_controller16_0_w(IDE_STD_OFFSET + offset, data >> 16, 0x0000);
320      ide_controller16_0_w(machine, IDE_STD_OFFSET + offset, data >> 16, 0x0000);
321321}
322322
323323
324324static READ32_HANDLER( ide_alt_r )
325325{
326326   if (offset == 0)
327      return ide_controller16_0_r(IDE_ALT_OFFSET, 0xff00) << 24;
327      return ide_controller16_0_r(machine, IDE_ALT_OFFSET, 0xff00) << 24;
328328
329329   return 0;
330330}
r1877r1878
332332static WRITE32_HANDLER( ide_alt_w )
333333{
334334   if (offset == 0 && !(mem_mask & 0x00ff0000))
335      ide_controller16_0_w(IDE_ALT_OFFSET, data >> 24, 0xff00);
335      ide_controller16_0_w(machine, IDE_ALT_OFFSET, data >> 24, 0xff00);
336336}
337337
338338
r1877r1878
10131013   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
10141014
10151015
1016#ifdef UNUSED_DEFINITION
10161017static INPUT_PORTS_START( popnmusic )
10171018   POPN_INPUT         /* IN 0-2 */
10181019   POPN_DSW1         /* IN 3 */
10191020   POPN_DSW2         /* IN 4 */
10201021   POPN_DSW3         /* IN 5 */
10211022INPUT_PORTS_END
1023#endif
10221024
1025#ifdef UNUSED_DEFINITION
10231026static INPUT_PORTS_START( popn1 )
10241027   POPN_INPUT         /* IN 0-2 */
10251028   POPN1_DSW1         /* IN 3 */
10261029   POPN1_DSW2         /* IN 4 */
10271030   POPN1_DSW3         /* IN 5 */
10281031INPUT_PORTS_END
1032#endif
10291033
1030
10311034#define POPNST_INPUT \
10321035   PORT_START      /* IN 0 */ \
10331036   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) \
r1877r1878
11141117   PORT_DIPSETTING(    0x2a, DEF_STR( Off ) ) \
11151118   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
11161119
1120#ifdef UNUSED_DEFINITION
11171121static INPUT_PORTS_START( popnstage )
11181122   POPNST_INPUT         /* IN 0-2 */
11191123   POPNST_DSW1         /* IN 3 */
11201124   POPNST_DSW2         /* IN 4 */
11211125   POPNST_DSW3         /* IN 5 */
11221126INPUT_PORTS_END
1127#endif
11231128
1124
11251129/*************************************
11261130 *
11271131 *  Graphics layouts
r1877r1878
12231227   //MDRV_CPU_ADD(M68EC020, 18432000/2)    /*  9.216 MHz!? */
12241228   MDRV_CPU_ADD(M68EC020, 32000000/4)   /*  8.000 MHz!? */
12251229   MDRV_CPU_PROGRAM_MAP(memory_map, 0)
1226   MDRV_CPU_VBLANK_INT(vb_interrupt, 1)
1230   MDRV_CPU_VBLANK_INT("main", vb_interrupt)
12271231
12281232   MDRV_MACHINE_START(djmain)
12291233   MDRV_MACHINE_RESET(djmain)
src/mame/drivers/ssfindo.c
r1877r1878
335335         return (PS7500_IO[IRQSTA]&PS7500_IO[IRQMSKA])|0x80;
336336
337337      case IOCR: //TODO: nINT1, OD[n] p.81
338         return (input_port_0_r(0)&0x80)|0x34|3;
338         return (input_port_0_r(machine,0)&0x80)|0x34|3;
339339
340340      case VIDCR:
341341         return (PS7500_IO[offset]|0x50)&0xfffffff0;
r1877r1878
613613   MDRV_CPU_ADD(ARM7, 54000000) // guess...
614614   MDRV_CPU_PROGRAM_MAP(ssfindo_map,0)
615615
616   MDRV_CPU_VBLANK_INT(ssfindo_interrupt,1)
616   MDRV_CPU_VBLANK_INT("main", ssfindo_interrupt)
617617   MDRV_MACHINE_RESET(ssfindo)
618618
619619
r1877r1878
636636   MDRV_CPU_ADD(ARM7, 54000000) // guess...
637637   MDRV_CPU_PROGRAM_MAP(ppcar_map,0)
638638
639   MDRV_CPU_VBLANK_INT(ssfindo_interrupt,1)
639   MDRV_CPU_VBLANK_INT("main", ssfindo_interrupt)
640640   MDRV_MACHINE_RESET(ssfindo)
641641
642642
src/mame/drivers/firetrk.c
r1877r1878
1010#include "sound/discrete.h"
1111
1212#define FIRETRK_CPU_CLOCK_1MHZ      (12096000 / 12)
13#define FIRETRK_CPU_CLOCK_750KZ      (12096000 /16)
13#define FIRETRK_CPU_CLOCK_750KZ      (12096000 / 16)
1414
1515
1616int firetrk_game;
1717
18UINT32 firetrk_color1_mask;
19UINT32 firetrk_color2_mask;
18static UINT8 in_service_mode;
19static UINT32 dial[2];
20static UINT8 steer_dir[2];
21static UINT8 steer_flag[2];
22static UINT8 gear;
2023
21static int last_service;
22static int steer_dir[2];
23static int steer_flag[2];
24static int attract;
25static int gear;
2624
27
28static DRIVER_INIT( firetrk )
25static void set_service_mode(running_machine *machine, int enable)
2926{
30   firetrk_game = 1;
31}
32static DRIVER_INIT( superbug )
33{
34   firetrk_game = 2;
35}
36static DRIVER_INIT( montecar )
37{
38   firetrk_game = 3;
39}
27   in_service_mode = enable;
4028
41
42static void set_firetrk_service(running_machine *machine, int enable)
43{
4429   /* watchdog is disabled during service mode */
4530   watchdog_enable(machine, !enable);
4631
r1877r1878
4934}
5035
5136
52static INTERRUPT_GEN( firetrk_interrupt )
37static INPUT_CHANGED( service_mode_switch_changed )
5338{
54   int firetrk_service;
39   set_service_mode(machine, newval);
40}
5541
56   if (GAME_IS_FIRETRUCK)
57   {
58      firetrk_service = readinputport(4) & 0x80;
59      if (firetrk_service != last_service)
60      {
61         set_firetrk_service(machine, firetrk_service);
6242
63         last_service = firetrk_service;
64      }
65      if (firetrk_service)
66         return;
67   }
68   else
69   if (GAME_IS_MONTECARLO)
70   {
71      firetrk_service = readinputport(6) & 0x04;
72      if (firetrk_service != last_service)
73      {
74         set_firetrk_service(machine, firetrk_service);
43static INPUT_CHANGED( firetrk_horn_changed )
44{
45   discrete_sound_w(machine, FIRETRUCK_HORN_EN, newval);
46}
7547
76         last_service = firetrk_service;
77      }
78      if (firetrk_service)
79         return;
80   }
81   else
82      discrete_sound_w(SUPERBUG_ASR_EN, 0);   /* Super Bug - ASR */
8348
49static INPUT_CHANGED( gear_changed )
50{
51   if (newval)
52      gear = (FPTR)param;
53}
54
55
56static INTERRUPT_GEN( firetrk_interrupt )
57{
58   /* Super Bug - ASR - when is this used and what is an ASR? */
59//  discrete_sound_w(machine, SUPERBUG_ASR_EN, 0);
60
8461   /* NMI interrupts are disabled during service mode in firetrk and montecar */
85   /* they never make it here if in service mode */
86   cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
62   if (!in_service_mode)
63      cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
8764}
8865
8966
r1877r1878
9471   cpunum_set_input_line(machine, 0, 0, PULSE_LINE);
9572
9673   /* IRQs are generated by inverse 16V signal */
97
9874   scanline += 32;
9975
10076   if (scanline > 262)
101   {
10277      scanline = 0;
103   }
10478
10579   timer_set(video_screen_get_time_until_pos(0, scanline, 0), NULL, scanline, periodic_callback);
10680}
10781
10882
109static TIMER_CALLBACK( frame_callback )
83static WRITE8_HANDLER( firetrk_output_w )
11084{
111   static UINT8 dial[2];
85   /* BIT0 => START1 LAMP */
86   set_led_status(0, !(data & 0x01));
11287
113   int i;
88   /* BIT1 => START2 LAMP */
89   set_led_status(1, !(data & 0x02));
11490
115   /* handle steering wheels */
91   /* BIT2 => FLASH       */
92   firetrk_flash = data & 0x04;
11693
117   for (i = 0; i < 2; i++)
118   {
119      signed char delta = readinputport(i) - dial[i];
94   /* BIT3 => TRACK LAMP  */
95   set_led_status(3, !(data & 0x08));
12096
121      if (delta < 0)
122      {
123         steer_flag[i] = 1;
124         steer_dir[i] = 0;
125      }
126      if (delta > 0)
127      {
128         steer_flag[i] = 1;
129         steer_dir[i] = 1;
130      }
97   /* BIT4 => ATTRACT     */
98   discrete_sound_w(machine, FIRETRUCK_ATTRACT_EN, data & 0x10);
99   coin_lockout_w(0, !(data & 0x10));
100   coin_lockout_w(1, !(data & 0x10));
131101
132      dial[i] += delta;
133   }
102   /* BIT5 => START3 LAMP */
103   set_led_status(2, !(data & 0x20));
134104
135   if (GAME_IS_FIRETRUCK)
136   {
137      /* map horn button onto discrete sound emulation */
138      discrete_sound_w(FIRETRUCK_HORN_EN, readinputport(7));
139   }
105   /* BIT6 => UNUSED      */
140106
141   /* update gear shift */
142   if (GAME_IS_SUPERBUG || GAME_IS_MONTECARLO)
143   {
144      switch (readinputport(7) & 15)
145      {
146      case 1: gear = 1; break;
147      case 2: gear = 2; break;
148      case 4: gear = 3; break;
149      case 8: gear = 4; break;
150      }
151   }
107   /* BIT7 => BELL OUT    */
108   discrete_sound_w(machine, FIRETRUCK_BELL_EN, data & 0x80);
152109}
153110
154111
155static void write_output(UINT8 flags)
112static WRITE8_HANDLER( superbug_output_w )
156113{
157   if (GAME_IS_FIRETRUCK)
158   {
159      /* BIT0 => START1 LAMP */
160      /* BIT1 => START2 LAMP */
161      /* BIT2 => FLASH       */
162      /* BIT3 => TRACK LAMP  */
163      /* BIT4 => ATTRACT     */
164      /* BIT5 => START3 LAMP */
165      /* BIT6 => UNUSED      */
166      /* BIT7 => BELL OUT    */
114   /* BIT0 => START LAMP */
115   set_led_status(0, offset & 0x01);
167116
168      set_led_status(0, !(flags & 0x01));
169      set_led_status(1, !(flags & 0x02));
170      set_led_status(2, !(flags & 0x20));
171      set_led_status(3, !(flags & 0x08));
117   /* BIT1 => ATTRACT    */
118   discrete_sound_w(machine, SUPERBUG_ATTRACT_EN, offset & 0x02);
119   coin_lockout_w(0, !(offset & 0x02));
120   coin_lockout_w(1, !(offset & 0x02));
172121
173      attract = flags & 0x10;
122   /* BIT2 => FLASH      */
123   firetrk_flash = offset & 0x04;
174124
175      discrete_sound_w(FIRETRUCK_BELL_EN, flags & 0x80);   /* Bell Sound */
176      discrete_sound_w(FIRETRUCK_ATTRACT_EN, flags & 0x10);   /* Attract */
125   /* BIT3 => TRACK LAMP */
126   set_led_status(1, offset & 0x08);
127}
177128
178      coin_lockout_w(0, !attract);
179      coin_lockout_w(1, !attract);
180129
181      firetrk_set_flash(flags & 0x04);
182   }
130static WRITE8_HANDLER( montecar_output_1_w )
131{
132   /* BIT0 => START LAMP    */
133   set_led_status(0, !(data & 0x01));
183134
184   if (GAME_IS_SUPERBUG)
185   {
186      /* BIT0 => START LAMP */
187      /* BIT1 => ATTRACT    */
188      /* BIT2 => FLASH      */
189      /* BIT3 => TRACK LAMP */
135   /* BIT1 => TRACK LAMP    */
136   set_led_status(1, !(data & 0x02));
190137
191      attract = flags & 0x02;
138   /* BIT2 => ATTRACT       */
139   discrete_sound_w(machine, MONTECAR_ATTRACT_INV, data & 0x04);
192140
193      set_led_status(0, flags & 0x01);
194      set_led_status(1, flags & 0x08);
141   /* BIT3 => UNUSED        */
142   /* BIT4 => UNUSED        */
195143
196      discrete_sound_w(SUPERBUG_ATTRACT_EN, flags & 0x02);   /* Attract */
144   /* BIT5 => COIN3 COUNTER */
145   coin_counter_w(0, data & 0x80);
197146
198      coin_lockout_w(0, !attract);
199      coin_lockout_w(1, !attract);
147   /* BIT6 => COIN2 COUNTER */
148   coin_counter_w(1, data & 0x40);
200149
201      firetrk_set_flash(flags & 0x04);
202   }
150   /* BIT7 => COIN1 COUNTER */
151   coin_counter_w(2, data & 0x20);
152}
203153
204   if (GAME_IS_MONTECARLO)
205   {
206      /* BIT0 => START LAMP    */
207      /* BIT1 => TRACK LAMP    */
208      /* BIT2 => ATTRACT       */
209      /* BIT3 => UNUSED        */
210      /* BIT4 => UNUSED        */
211      /* BIT5 => COIN3 COUNTER */
212      /* BIT6 => COIN2 COUNTER */
213      /* BIT7 => COIN1 COUNTER */
214154
215      set_led_status(0, !(flags & 0x01));
216      set_led_status(1, !(flags & 0x02));
155static WRITE8_HANDLER( montecar_output_2_w )
156{
157   firetrk_flash = data & 0x80;
217158
218      discrete_sound_w(MONTECAR_ATTRACT_INV, flags & 0x04);   /* Attract */
219
220      coin_counter_w(0, flags & 0x80);
221      coin_counter_w(1, flags & 0x40);
222      coin_counter_w(2, flags & 0x20);
223   }
159   discrete_sound_w(machine, MONTECAR_BEEPER_EN, data & 0x10);
160   discrete_sound_w(machine, MONTECAR_DRONE_LOUD_DATA, data & 0x0f);
224161}
225162
226163
227164static MACHINE_RESET( firetrk )
228165{
229   timer_pulse(video_screen_get_frame_period(0), NULL, 0, frame_callback);
166   set_service_mode(machine, 0);
230167
231   if (GAME_IS_MONTECARLO)
232   {
233      write_output(0);
234      last_service = readinputport(6) & 0x04;
235      set_firetrk_service(machine, last_service);
236   }
237   else
238   if (GAME_IS_FIRETRUCK)
239   {
240      last_service = readinputport(4) & 0x80;
241      set_firetrk_service(machine, last_service);
242   }
243
244168   timer_call_after_resynch(NULL, 0, periodic_callback);
245169}
246170
247171
248static PALETTE_INIT( firetrk )
172static READ8_HANDLER( firetrk_dip_r )
249173{
250   static const UINT8 colortable_source[] =
251   {
252      0, 0, 1, 0,
253      2, 0, 3, 0,
254      3, 3, 2, 3,
255      1, 3, 0, 3,
256      0, 0, 1, 0,
257      2, 0, 0, 3,
258      3, 0, 0, 3
259   };
260   static const rgb_t palette_source[] =
261   {
262      MAKE_RGB(0x00, 0x00, 0x00),
263      MAKE_RGB(0x5b, 0x5b, 0x5b),
264      MAKE_RGB(0xa4, 0xa4, 0xa4),
265      MAKE_RGB(0xff, 0xff, 0xff)
266   };
267   int i;
174   UINT8 val0 = readinputportbytag("DIP_0");
175   UINT8 val1 = readinputportbytag("DIP_1");
268176
269   firetrk_color1_mask = firetrk_color2_mask = 0;
270   for (i = 0; i < ARRAY_LENGTH(colortable_source); i++)
271   {
272      UINT8 color = colortable_source[i];
273      if (color == 1)
274         firetrk_color1_mask |= 1 << i;
275      else if (color == 2)
276         firetrk_color2_mask |= 1 << i;
277      palette_set_color(machine, i, palette_source[color]);
278   }
177   if (val1 & (1 << (2 * offset + 0))) val0 |= 1;
178   if (val1 & (1 << (2 * offset + 1))) val0 |= 2;
179
180   return val0;
279181}
280182
281183
282static void prom_to_palette(running_machine *machine, int number, UINT8 val)
184static READ8_HANDLER( montecar_dip_r )
283185{
284   palette_set_color_rgb(machine, number, pal1bit(val >> 2), pal1bit(val >> 1), pal1bit(val >> 0));
186   UINT8 val0 = readinputportbytag("DIP_0");
187   UINT8 val1 = readinputportbytag("DIP_1");
188
189   if (val1 & (1 << (3 - offset))) val0 |= 1;
190   if (val1 & (1 << (7 - offset))) val0 |= 2;
191
192   return val0;
285193}
286194
287195
288static PALETTE_INIT( montecar )
196static CUSTOM_INPUT( steer_dir_r )
289197{
290   static const UINT8 colortable_source[] =
291   {
292      0x00, 0x00, 0x00, 0x01,
293      0x00, 0x02, 0x00, 0x03,
294      0x03, 0x03, 0x03, 0x02,
295      0x03, 0x01, 0x03, 0x00,
296      0x00, 0x00, 0x02, 0x00,
297      0x02, 0x01, 0x02, 0x02,
298      0x00, 0x10, 0x20, 0x30,
299      0x00, 0x04, 0x08, 0x0C,
300      0x00, 0x44, 0x48, 0x4C,
301      0x00, 0x84, 0x88, 0x8C,
302      0x00, 0xC4, 0xC8, 0xCC
303   };
198   return steer_dir[(FPTR)param];
199}
304200
305   /*
306     * The color PROM is addressed as follows:
307     *
308     *   A0 => PLAYFIELD 1
309     *   A1 => PLAYFIELD 2
310     *   A2 => DRONE 1
311     *   A3 => DRONE 2
312     *   A4 => CAR 1
313     *   A5 => CAR 2
314     *   A6 => DRONE COLOR 1
315     *   A7 => DRONE COLOR 2
316     *   A8 => PLAYFIELD WINDOW
317     *
318     * This driver hard-codes some behavior which actually depends
319     * on the PROM, like priorities, clipping and transparency.
320     *
321     */
322201
323   const UINT8* p = memory_region(REGION_PROMS);
324   int i;
202static CUSTOM_INPUT( steer_flag_r )
203{
204   return steer_flag[(FPTR)param];
205}
325206
326   firetrk_color1_mask = firetrk_color2_mask = 0;
327   for (i = 0; i < ARRAY_LENGTH(colortable_source); i++)
328   {
329      UINT8 color = colortable_source[i];
330      if (color == 1)
331         firetrk_color1_mask |= 1 << i;
332      else if (color == 2)
333         firetrk_color2_mask |= 1 << i;
334      prom_to_palette(machine, i, p[0x100 + colortable_source[i]]);
335   }
336207
337   palette_set_color(machine, ARRAY_LENGTH(colortable_source) + 0, MAKE_RGB(0x00, 0x00, 0x00));
338   palette_set_color(machine, ARRAY_LENGTH(colortable_source) + 1, MAKE_RGB(0xff, 0xff, 0xff));
208static CUSTOM_INPUT( skid_r )
209{
210   UINT32 ret;
211   int which = (FPTR)param;
212
213   if (which != 2)
214      ret = firetrk_skid[which];
215   else
216      ret = firetrk_skid[0] | firetrk_skid[1];
217
218   return ret;
339219}
340220
341221
342static READ8_HANDLER( firetrk_dip_r )
222static CUSTOM_INPUT( crash_r )
343223{
344   UINT8 val0 = readinputport(2);
345   UINT8 val1 = readinputport(3);
224   UINT32 ret;
225   int which = (FPTR)param;
346226
347   if (GAME_IS_FIRETRUCK || GAME_IS_SUPERBUG)
348   {
349      if (val1 & (1 << (2 * offset + 0))) val0 |= 1;
350      if (val1 & (1 << (2 * offset + 1))) val0 |= 2;
351   }
352   if (GAME_IS_MONTECARLO)
353   {
354      if (val1 & (1 << (3 - offset))) val0 |= 1;
355      if (val1 & (1 << (7 - offset))) val0 |= 2;
356   }
227   if (which != 2)
228      ret = firetrk_crash[which];
229   else
230      ret = firetrk_crash[0] | firetrk_crash[1];
357231
358   return val0;
232   return ret;
359233}
360234
361235
362static READ8_HANDLER( firetrk_input_r )
236static CUSTOM_INPUT( gear_r )
363237{
364   UINT8 val = 0;
238   return (gear == (FPTR)param) ? 1 : 0;
239}
365240
366   UINT8 bit0 = readinputport(4);
367   UINT8 bit6 = readinputport(5);
368   UINT8 bit7 = readinputport(6);
369241
370   if (GAME_IS_FIRETRUCK)
371   {
372      if (!steer_dir[0])
373         bit0 |= 0x04;
374      if (!steer_flag[0])
375         bit7 |= 0x04;
376      if (firetrk_skid[0] || firetrk_skid[1])
377         bit0 |= 0x40;
378      if (firetrk_crash[0] || firetrk_crash[1])
379         bit7 |= 0x40;
380      if (!steer_dir[1])
381         bit0 |= 0x08;
382      if (!steer_flag[1])
383         bit7 |= 0x08;
384   }
242static READ8_HANDLER( firetrk_input_r )
243{
244   int i;
385245
386   if (GAME_IS_SUPERBUG)
246   /* update steering wheels */
247   for (i = 0; i < 2; i++)
387248   {
388      if (!steer_dir[0])
389         bit0 |= 0x04;
390      if (!steer_flag[0])
391         bit7 |= 0x04;
392      if (firetrk_skid[0])
393         bit0 |= 0x40;
394      if (firetrk_crash[0])
395         bit7 |= 0x40;
396      if (gear == 1)
397         bit7 |= 0x02;
398      if (gear == 2)
399         bit0 |= 0x01;
400      if (gear == 3)
401         bit7 |= 0x01;
402   }
249      UINT32 new_dial = readinputportbytag_safe((i ? "STEER_2" : "STEER_1"), 0);
250      INT32 delta = new_dial - dial[i];
403251
404   if (GAME_IS_MONTECARLO)
405   {
406      if (!steer_dir[0])
407         bit6 |= 0x40;
408      if (!steer_flag[0])
409         bit7 |= 0x40;
410      if (gear == 1)
411         bit6 |= 0x01;
412      if (gear == 2)
413         bit6 |= 0x02;
414      if (gear == 3)
415         bit6 |= 0x04;
416      if (firetrk_skid[0])
417         bit7 |= 0x80;
418      if (firetrk_skid[1])
419         bit6 |= 0x80;
420      if (firetrk_crash[0])
421         val |= 0x02;
422      if (firetrk_crash[1])
423         val |= 0x01;
252      if (delta != 0)
253      {
254         steer_flag[i] = 0;
255         steer_dir[i] = (delta < 0) ? 1 : 0;
256
257         dial[i] = dial[i] + delta;
258      }
424259   }
425260
426   if (bit0 & (1 << offset)) val |= 0x01;
427   if (bit6 & (1 << offset)) val |= 0x40;
428   if (bit7 & (1 << offset)) val |= 0x80;
261   return ((readinputportbytag_safe("BIT_0", 0) & (1 << offset)) ? 0x01 : 0) |
262         ((readinputportbytag_safe("BIT_6", 0) & (1 << offset)) ? 0x40 : 0) |
263         ((readinputportbytag_safe("BIT_7", 0) & (1 << offset)) ? 0x80 : 0);
264}
429265
430   return val;
266
267static READ8_HANDLER( montecar_input_r )
268{
269   UINT8 ret = firetrk_input_r(machine, offset);
270
271   if (firetrk_crash[0])
272      ret |= 0x02;
273
274   /* can this be right, bit 0 again ???? */
275   if (firetrk_crash[1])
276      ret |= 0x01;
277
278   return ret;
431279}
432280
433281
434static WRITE8_HANDLER( firetrk_arrow_off_w )
282static WRITE8_HANDLER( blink_on_w )
435283{
436   firetrk_set_blink(1);
284   *firetrk_blink = TRUE;
437285}
438286
439287
440static WRITE8_HANDLER( firetrk_car_reset_w )
288static WRITE8_HANDLER( montecar_car_reset_w )
441289{
442290   firetrk_crash[0] = 0;
443291   firetrk_skid[0] = 0;
444292}
445293
446294
447static WRITE8_HANDLER( firetrk_drone_reset_w )
295static WRITE8_HANDLER( montecar_drone_reset_w )
448296{
449297   firetrk_crash[1] = 0;
450298   firetrk_skid[1] = 0;
451299}
452300
453301
454static WRITE8_HANDLER( firetrk_steer_reset_w )
302static WRITE8_HANDLER( steer_reset_w )
455303{
456   steer_flag[0] = 0;
457   steer_flag[1] = 0;
304   steer_flag[0] = 1;
305   steer_flag[1] = 1;
458306}
459307
460308
461static WRITE8_HANDLER( firetrk_crash_reset_w )
309static WRITE8_HANDLER( crash_reset_w )
462310{
463311   firetrk_crash[0] = 0;
464312   firetrk_crash[1] = 0;
465313}
466314
467315
468static WRITE8_HANDLER( firetrk_out_w )
469{
470   if (GAME_IS_FIRETRUCK || GAME_IS_MONTECARLO)
471   {
472      write_output(data);
473   }
474   if (GAME_IS_SUPERBUG)
475   {
476      write_output(offset);
477   }
478}
479
480
481
482316static ADDRESS_MAP_START( firetrk_map, ADDRESS_SPACE_PROGRAM, 8 )
483317   ADDRESS_MAP_FLAGS( AMEF_ABITS(14) )
484   AM_RANGE(0x0000, 0x00ff) AM_MIRROR(0x700) AM_RAM AM_BASE(&firetrk_alpha_num_ram)
485   AM_RANGE(0x0800, 0x08ff) AM_MIRROR(0x700) AM_READWRITE(MRA8_RAM, firetrk_playfield_w) AM_BASE(&firetrk_playfield_ram)
486   AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x1f) AM_WRITE(firetrk_vert_w)
487   AM_RANGE(0x1020, 0x1020) AM_MIRROR(0x1f) AM_WRITE(firetrk_horz_w)
488   AM_RANGE(0x1040, 0x1040) AM_MIRROR(0x1f) AM_WRITE(firetrk_crash_reset_w)
489   AM_RANGE(0x1060, 0x1060) AM_MIRROR(0x1f) AM_WRITE(firetrk_skid_reset_w)
490   AM_RANGE(0x1080, 0x1080) AM_MIRROR(0x1f) AM_WRITE(firetrk_car_rot_w)
491   AM_RANGE(0x10a0, 0x10a0) AM_MIRROR(0x1f) AM_WRITE(firetrk_steer_reset_w)
492   AM_RANGE(0x10c0, 0x10c0) AM_MIRROR(0x1f) AM_WRITE(watchdog_reset_w)
493   AM_RANGE(0x10e0, 0x10e0) AM_MIRROR(0x1f) AM_WRITE(firetrk_arrow_off_w)
494   AM_RANGE(0x1400, 0x1400) AM_MIRROR(0x1f) AM_WRITE(firetrk_motor_snd_w)
495   AM_RANGE(0x1420, 0x1420) AM_MIRROR(0x1f) AM_WRITE(firetrk_crash_snd_w)
496   AM_RANGE(0x1440, 0x1440) AM_MIRROR(0x1f) AM_WRITE(firetrk_skid_snd_w)
497   AM_RANGE(0x1460, 0x1460) AM_MIRROR(0x1f) AM_WRITE(firetrk_drone_hpos_w)
498   AM_RANGE(0x1480, 0x1480) AM_MIRROR(0x1f) AM_WRITE(firetrk_drone_vpos_w)
499   AM_RANGE(0x14a0, 0x14a0) AM_MIRROR(0x1f) AM_WRITE(firetrk_drone_rot_w)
500   AM_RANGE(0x14c0, 0x14c0) AM_MIRROR(0x1f) AM_WRITE(firetrk_out_w)
501   AM_RANGE(0x14e0, 0x14e0) AM_MIRROR(0x1f) AM_WRITE(firetrk_xtndply_w)
502   AM_RANGE(0x1800, 0x1807) AM_MIRROR(0x3f8) AM_READWRITE(firetrk_input_r, MWA8_NOP)
503   AM_RANGE(0x1c00, 0x1c03) AM_MIRROR(0x3fc) AM_READ(firetrk_dip_r)
318   AM_RANGE(0x0000, 0x00ff) AM_MIRROR(0x0700) AM_RAM AM_BASE(&firetrk_alpha_num_ram)
319   AM_RANGE(0x0800, 0x08ff) AM_MIRROR(0x0700) AM_RAM AM_BASE(&firetrk_playfield_ram)
320   AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_scroll_y)
321   AM_RANGE(0x1020, 0x1020) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_scroll_x)
322   AM_RANGE(0x1040, 0x1040) AM_MIRROR(0x001f) AM_WRITE(crash_reset_w)
323   AM_RANGE(0x1060, 0x1060) AM_MIRROR(0x001f) AM_WRITE(firetrk_skid_reset_w)
324   AM_RANGE(0x1080, 0x1080) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_car_rot)
325   AM_RANGE(0x10a0, 0x10a0) AM_MIRROR(0x001f) AM_WRITE(steer_reset_w)
326   AM_RANGE(0x10c0, 0x10c0) AM_MIRROR(0x001f) AM_WRITE(watchdog_reset_w)
327   AM_RANGE(0x10e0, 0x10e0) AM_MIRROR(0x001f) AM_WRITE(blink_on_w) AM_BASE(&firetrk_blink)
328   AM_RANGE(0x1400, 0x1400) AM_MIRROR(0x001f) AM_WRITE(firetrk_motor_snd_w)
329   AM_RANGE(0x1420, 0x1420) AM_MIRROR(0x001f) AM_WRITE(firetrk_crash_snd_w)
330   AM_RANGE(0x1440, 0x1440) AM_MIRROR(0x001f) AM_WRITE(firetrk_skid_snd_w)
331   AM_RANGE(0x1460, 0x1460) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_drone_x)
332   AM_RANGE(0x1480, 0x1480) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_drone_y)
333   AM_RANGE(0x14a0, 0x14a0) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_drone_rot)
334   AM_RANGE(0x14c0, 0x14c0) AM_MIRROR(0x001f) AM_WRITE(firetrk_output_w)
335   AM_RANGE(0x14e0, 0x14e0) AM_MIRROR(0x001f) AM_WRITE(firetrk_xtndply_w)
336   AM_RANGE(0x1800, 0x1807) AM_MIRROR(0x03f8) AM_READWRITE(firetrk_input_r, MWA8_NOP)
337   AM_RANGE(0x1c00, 0x1c03) AM_MIRROR(0x03fc) AM_READ(firetrk_dip_r)
504338   AM_RANGE(0x2000, 0x3fff) AM_ROM
505339ADDRESS_MAP_END
506340
r1877r1878
508342static ADDRESS_MAP_START( superbug_map, ADDRESS_SPACE_PROGRAM, 8 )
509343   ADDRESS_MAP_FLAGS( AMEF_ABITS(13) )
510344   AM_RANGE(0x0000, 0x00ff) AM_RAM
511   AM_RANGE(0x0100, 0x0100) AM_MIRROR(0x1f) AM_WRITE(firetrk_vert_w)
512   AM_RANGE(0x0120, 0x0120) AM_MIRROR(0x1f) AM_WRITE(firetrk_horz_w)
513   AM_RANGE(0x0140, 0x0140) AM_MIRROR(0x1f) AM_WRITE(firetrk_crash_reset_w)
514   AM_RANGE(0x0160, 0x0160) AM_MIRROR(0x1f) AM_WRITE(firetrk_skid_reset_w)
515   AM_RANGE(0x0180, 0x0180) AM_MIRROR(0x1f) AM_WRITE(firetrk_car_rot_w)
516   AM_RANGE(0x01a0, 0x01a0) AM_MIRROR(0x1f) AM_WRITE(firetrk_steer_reset_w)
517   AM_RANGE(0x01c0, 0x01c0) AM_MIRROR(0x1f) AM_WRITE(watchdog_reset_w)
518   AM_RANGE(0x01e0, 0x01e0) AM_MIRROR(0x1f) AM_WRITE(firetrk_arrow_off_w)
519   AM_RANGE(0x0200, 0x0207) AM_MIRROR(0x18) AM_READ(firetrk_input_r)
520   AM_RANGE(0x0220, 0x0220) AM_MIRROR(0x1f) AM_WRITE(firetrk_asr_w)
521   AM_RANGE(0x0240, 0x0243) AM_MIRROR(0x1c) AM_READ(firetrk_dip_r)
522   AM_RANGE(0x0260, 0x026f) AM_MIRROR(0x10) AM_WRITE(firetrk_out_w)
523   AM_RANGE(0x0280, 0x0280) AM_MIRROR(0x1f) AM_WRITE(firetrk_motor_snd_w)
524   AM_RANGE(0x02a0, 0x02a0) AM_MIRROR(0x1f) AM_WRITE(firetrk_crash_snd_w)
525   AM_RANGE(0x02c0, 0x02c0) AM_MIRROR(0x1f) AM_WRITE(firetrk_skid_snd_w)
345   AM_RANGE(0x0100, 0x0100) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_scroll_y)
346   AM_RANGE(0x0120, 0x0120) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_scroll_x)
347   AM_RANGE(0x0140, 0x0140) AM_MIRROR(0x001f) AM_WRITE(crash_reset_w)
348   AM_RANGE(0x0160, 0x0160) AM_MIRROR(0x001f) AM_WRITE(firetrk_skid_reset_w)
349   AM_RANGE(0x0180, 0x0180) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_car_rot)
350   AM_RANGE(0x01a0, 0x01a0) AM_MIRROR(0x001f) AM_WRITE(steer_reset_w)
351   AM_RANGE(0x01c0, 0x01c0) AM_MIRROR(0x001f) AM_WRITE(watchdog_reset_w)
352   AM_RANGE(0x01e0, 0x01e0) AM_MIRROR(0x001f) AM_WRITE(blink_on_w) AM_BASE(&firetrk_blink)
353   AM_RANGE(0x0200, 0x0207) AM_MIRROR(0x0018) AM_READ(firetrk_input_r)
354   AM_RANGE(0x0220, 0x0220) AM_MIRROR(0x001f) AM_WRITE(superbug_asr_w)
355   AM_RANGE(0x0240, 0x0243) AM_MIRROR(0x001c) AM_READ(firetrk_dip_r)
356   AM_RANGE(0x0260, 0x026f) AM_MIRROR(0x0010) AM_WRITE(superbug_output_w)
357   AM_RANGE(0x0280, 0x0280) AM_MIRROR(0x001f) AM_WRITE(superbug_motor_snd_w)
358   AM_RANGE(0x02a0, 0x02a0) AM_MIRROR(0x001f) AM_WRITE(firetrk_crash_snd_w)
359   AM_RANGE(0x02c0, 0x02c0) AM_MIRROR(0x001f) AM_WRITE(firetrk_skid_snd_w)
526360   AM_RANGE(0x0400, 0x041f) AM_RAM AM_BASE(&firetrk_alpha_num_ram)
527   AM_RANGE(0x0500, 0x05ff) AM_READWRITE(MRA8_RAM, firetrk_playfield_w) AM_BASE(&firetrk_playfield_ram)
361   AM_RANGE(0x0500, 0x05ff) AM_RAM AM_BASE(&firetrk_playfield_ram)
528362   AM_RANGE(0x0800, 0x1fff) AM_ROM
529363ADDRESS_MAP_END
530364
531365
532366static ADDRESS_MAP_START( montecar_map, ADDRESS_SPACE_PROGRAM, 8 )
533367   ADDRESS_MAP_FLAGS( AMEF_ABITS(14) )
534   AM_RANGE(0x0000, 0x00ff) AM_MIRROR(0x700) AM_RAM AM_BASE(&firetrk_alpha_num_ram)
535   AM_RANGE(0x0800, 0x08ff) AM_MIRROR(0x700) AM_READWRITE(MRA8_RAM, firetrk_playfield_w) AM_BASE(&firetrk_playfield_ram)
536   AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x1f) AM_WRITE(firetrk_vert_w)
537   AM_RANGE(0x1020, 0x1020) AM_MIRROR(0x1f) AM_WRITE(firetrk_horz_w)
538   AM_RANGE(0x1040, 0x1040) AM_MIRROR(0x1f) AM_WRITE(firetrk_drone_reset_w)
539   AM_RANGE(0x1060, 0x1060) AM_MIRROR(0x1f) AM_WRITE(firetrk_car_reset_w)
540   AM_RANGE(0x1080, 0x1080) AM_MIRROR(0x1f) AM_WRITE(firetrk_car_rot_w)
541   AM_RANGE(0x10a0, 0x10a0) AM_MIRROR(0x1f) AM_WRITE(firetrk_steer_reset_w)
542   AM_RANGE(0x10c0, 0x10c0) AM_MIRROR(0x1f) AM_WRITE(watchdog_reset_w)
543   AM_RANGE(0x10e0, 0x10e0) AM_MIRROR(0x1f) AM_WRITE(firetrk_skid_reset_w)
544   AM_RANGE(0x1400, 0x1400) AM_MIRROR(0x1f) AM_WRITE(firetrk_motor_snd_w)
545   AM_RANGE(0x1420, 0x1420) AM_MIRROR(0x1f) AM_WRITE(firetrk_crash_snd_w)
546   AM_RANGE(0x1440, 0x1440) AM_MIRROR(0x1f) AM_WRITE(firetrk_skid_snd_w)
547   AM_RANGE(0x1460, 0x1460) AM_MIRROR(0x1f) AM_WRITE(firetrk_drone_hpos_w)
548   AM_RANGE(0x1480, 0x1480) AM_MIRROR(0x1f) AM_WRITE(firetrk_drone_vpos_w)
549   AM_RANGE(0x14a0, 0x14a0) AM_MIRROR(0x1f) AM_WRITE(firetrk_drone_rot_w)
550   AM_RANGE(0x14c0, 0x14c0) AM_MIRROR(0x1f) AM_WRITE(firetrk_out_w)
551   AM_RANGE(0x14e0, 0x14e0) AM_MIRROR(0x1f) AM_WRITE(firetrk_out2_w)
552   AM_RANGE(0x1800, 0x1807) AM_MIRROR(0x3f8) AM_READWRITE(firetrk_input_r, MWA8_NOP)
553   AM_RANGE(0x1c00, 0x1c03) AM_MIRROR(0x3fc) AM_READ(firetrk_dip_r)
368   AM_RANGE(0x0000, 0x00ff) AM_MIRROR(0x0700) AM_RAM AM_BASE(&firetrk_alpha_num_ram)
369   AM_RANGE(0x0800, 0x08ff) AM_MIRROR(0x0700) AM_RAM AM_BASE(&firetrk_playfield_ram)
370   AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_scroll_y)
371   AM_RANGE(0x1020, 0x1020) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_scroll_x)
372   AM_RANGE(0x1040, 0x1040) AM_MIRROR(0x001f) AM_WRITE(montecar_drone_reset_w)
373   AM_RANGE(0x1060, 0x1060) AM_MIRROR(0x001f) AM_WRITE(montecar_car_reset_w)
374   AM_RANGE(0x1080, 0x1080) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_car_rot)
375   AM_RANGE(0x10a0, 0x10a0) AM_MIRROR(0x001f) AM_WRITE(steer_reset_w)
376   AM_RANGE(0x10c0, 0x10c0) AM_MIRROR(0x001f) AM_WRITE(watchdog_reset_w)
377   AM_RANGE(0x10e0, 0x10e0) AM_MIRROR(0x001f) AM_WRITE(montecar_skid_reset_w)
378   AM_RANGE(0x1400, 0x1400) AM_MIRROR(0x001f) AM_WRITE(firetrk_motor_snd_w)
379   AM_RANGE(0x1420, 0x1420) AM_MIRROR(0x001f) AM_WRITE(firetrk_crash_snd_w)
380   AM_RANGE(0x1440, 0x1440) AM_MIRROR(0x001f) AM_WRITE(firetrk_skid_snd_w)
381   AM_RANGE(0x1460, 0x1460) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_drone_x)
382   AM_RANGE(0x1480, 0x1480) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_drone_y)
383   AM_RANGE(0x14a0, 0x14a0) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_drone_rot)
384   AM_RANGE(0x14c0, 0x14c0) AM_MIRROR(0x001f) AM_WRITE(montecar_output_1_w)
385   AM_RANGE(0x14e0, 0x14e0) AM_MIRROR(0x001f) AM_WRITE(montecar_output_2_w)
386   AM_RANGE(0x1800, 0x1807) AM_MIRROR(0x03f8) AM_READWRITE(montecar_input_r, MWA8_NOP)
387   AM_RANGE(0x1c00, 0x1c03) AM_MIRROR(0x03fc) AM_READ(montecar_dip_r)
554388   AM_RANGE(0x2000, 0x3fff) AM_ROM
555389ADDRESS_MAP_END
556390
557391
558392static INPUT_PORTS_START( firetrk )
559   PORT_START
393   PORT_START_TAG("STEER_1")
560394   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(1)
561395
562   PORT_START
396   PORT_START_TAG("STEER_2")
563397   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(2)
564398
565   PORT_START
566   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_UNUSED) /* other DIPs connect here */
567   PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_UNUSED) /* other DIPs connect here */
399   PORT_START_TAG("DIP_0")
400   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) /* other DIPs connect here */
401   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) /* other DIPs connect here */
568402   PORT_DIPNAME( 0x0c, 0x08, DEF_STR( Coinage ))
569403   PORT_DIPSETTING(    0x0c, DEF_STR( 2C_1C ))
570404   PORT_DIPSETTING(    0x08, DEF_STR( 1C_1C ))
r1877r1878
577411   PORT_DIPSETTING(    0x20, DEF_STR( Off ))
578412   PORT_DIPSETTING(    0x00, DEF_STR( On ))
579413
580   PORT_START
414   PORT_START_TAG("DIP_1")
581415   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Language ) )
582416   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
583417   PORT_DIPSETTING(    0x01, DEF_STR( French ) )
r1877r1878
594428   PORT_DIPSETTING(    0x30, "Conservative" )
595429   PORT_DIPSETTING(    0x00, "Never" )
596430
597   PORT_START /* bit 0 */
598   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
599   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Gas") PORT_PLAYER(1)
600   PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_UNUSED) /* STEER DIR 1 */
601   PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_UNUSED) /* STEER DIR 2 */
602   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Bell") PORT_PLAYER(2)
603   PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_TILT)
604   PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_UNUSED) /* SKID */
605   PORT_SERVICE(0x80, IP_ACTIVE_HIGH)
431   PORT_START_TAG("BIT_0")
432   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
433   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Gas") PORT_PLAYER(1)
434   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_dir_r, (void *)0)
435   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_dir_r, (void *)1)
436   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Bell") PORT_PLAYER(2)
437   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_TILT )
438   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(skid_r, (void *)2)
439   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Service_Mode ) ) PORT_CODE(KEYCODE_F2) PORT_TOGGLE PORT_CHANGED(service_mode_switch_changed, 0)
440   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
441   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
606442
607   PORT_START /* bit 6 */
608   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("Front Player Start")
609   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_START2 ) PORT_NAME("Back Player Start")
610   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START3 ) PORT_NAME("Both Players Start")
611   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Track Select") PORT_CODE(KEYCODE_SPACE) PORT_PLAYER(1)
612   PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
613   PORT_BIT (0x20, IP_ACTIVE_LOW,  IPT_VBLANK)
443   PORT_START_TAG("BIT_6")
444   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("Front Player Start")
445   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 ) PORT_NAME("Back Player Start")
446   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START3 ) PORT_NAME("Both Players Start")
447   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Track Select") PORT_CODE(KEYCODE_SPACE) PORT_PLAYER(1)
448   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
449   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_VBLANK )
614450   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ))
615451   PORT_DIPSETTING(    0x00, "Smokey Joe (1 Player)" )
616452   PORT_DIPSETTING(    0x40, "Fire Truck (2 Players)" )
617   PORT_BIT(0x80, IP_ACTIVE_HIGH,   IPT_SERVICE ) PORT_NAME("Diag Hold") PORT_CODE(KEYCODE_F6)
453   PORT_BIT( 0x80, IP_ACTIVE_HIGH,   IPT_SERVICE ) PORT_NAME("Diag Hold") PORT_CODE(KEYCODE_F6)
618454
619   PORT_START /* bit 7 */
620   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
621   PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
622   PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_UNUSED) /* STEER FLAG 1 */
623   PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_UNUSED) /* STEER FLAG 2 */
624   PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_COIN1)
625   PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_COIN2)
626   PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_UNUSED) /* CRASH */
627   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Diag Step") PORT_CODE(KEYCODE_F1)
455   PORT_START_TAG("BIT_7")
456   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
457   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
458   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_flag_r, (void *)0)
459   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_flag_r, (void *)1)
460   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_COIN1 )
461   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
462   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(crash_r, (void *)2)
463   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Diag Step") PORT_CODE(KEYCODE_F1)
628464
629   PORT_START
630   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Horn") PORT_PLAYER(1)
465   PORT_START_TAG("HORN")
466   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Horn") PORT_PLAYER(1) PORT_CHANGED(firetrk_horn_changed, 0)
631467
632468   PORT_START_TAG("R27")
633469   PORT_ADJUSTER( 20, "R27 - Motor Frequency" )
r1877r1878
635471
636472
637473static INPUT_PORTS_START( superbug )
638   PORT_START
474   PORT_START_TAG("STEER_1")
639475   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10)
640476
641   PORT_START
642   PORT_BIT (0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
477   PORT_START_TAG("DIP_0")
478   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) /* other DIPs connect here */
479   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) /* other DIPs connect here */
643480
644   PORT_START
645   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_UNUSED) /* other DIPs connect here */
646   PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_UNUSED) /* other DIPs connect here */
647
648   PORT_START
481   PORT_START_TAG("DIP_1")
649482   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Coinage ))
650483   PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ))
651484   PORT_DIPSETTING(    0x02, DEF_STR( 1C_1C ))
r1877r1878
667500   PORT_DIPSETTING(    0x80, DEF_STR( Spanish ) )
668501   PORT_DIPSETTING(    0xc0, DEF_STR( German ) )
669502
670   PORT_START /* bit 0 */
671   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_UNUSED) /* GEAR 2 */
672   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Gas")
673   PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_UNUSED) /* STEER DIR */
674   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Hiscore Reset") PORT_CODE(KEYCODE_H)
675   PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
676   PORT_SERVICE( 0x20, IP_ACTIVE_HIGH)
677   PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_UNUSED) /* SKID */
678   PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_TILT)
503   PORT_START_TAG("BIT_0")
504   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gear_r, (void *)1)
505   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Gas")
506   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_dir_r, (void *)0)
507   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Hiscore Reset") PORT_CODE(KEYCODE_H)
508   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
509   PORT_SERVICE( 0x20, IP_ACTIVE_HIGH )
510   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(skid_r, (void *)0)
511   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_TILT )
679512
680   PORT_START /* bit 6 */
681   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
513   PORT_START_TAG("BIT_7")
514   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gear_r, (void *)2)
515   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gear_r, (void *)0)
516   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_flag_r, (void *)0)
517   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 )
518   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_COIN2 )
519   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START1 )
520   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(crash_r, (void *)0)
521   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Track Select") PORT_CODE(KEYCODE_SPACE)
682522
683   PORT_START /* bit 7 */
684   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_UNUSED) /* GEAR 3 */
685   PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_UNUSED) /* GEAR 1 */
686   PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_UNUSED) /* STEER FLAG */
687   PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_COIN1)
688   PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_COIN2)
689   PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_START1)
690   PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_UNUSED) /* CRASH */
691   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Track Select") PORT_CODE(KEYCODE_SPACE)
523   PORT_START_TAG("GEAR")
524   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Gear 1") PORT_CODE(KEYCODE_Z) PORT_CHANGED(gear_changed, (void *)0)
525   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Gear 2") PORT_CODE(KEYCODE_X) PORT_CHANGED(gear_changed, (void *)1)
526   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Gear 3") PORT_CODE(KEYCODE_C) PORT_CHANGED(gear_changed, (void *)2)
527   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Gear 4") PORT_CODE(KEYCODE_V) PORT_CHANGED(gear_changed, (void *)3)
692528
693   PORT_START
694   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Gear 1") PORT_CODE(KEYCODE_Z)
695   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Gear 2") PORT_CODE(KEYCODE_X)
696   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Gear 3") PORT_CODE(KEYCODE_C)
697   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Gear 4") PORT_CODE(KEYCODE_V)
698
699529   PORT_START_TAG("R62")
700530   PORT_ADJUSTER( 20, "R62 - Motor Frequency" )
701531INPUT_PORTS_END
702532
703533
704534static INPUT_PORTS_START( montecar )
705   PORT_START
535   PORT_START_TAG("STEER_1")
706536   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(1)
707537
708   PORT_START
709   PORT_BIT (0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
710
711   PORT_START
712   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_UNUSED) /* other DIPs connect here */
713   PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_UNUSED) /* other DIPs connect here */
538   PORT_START_TAG("DIP_0")
539   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) /* other DIPs connect here */
540   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) /* other DIPs connect here */
714541   PORT_DIPNAME( 0x0c, 0x0c, "Coin 3 Multiplier" )
715542   PORT_DIPSETTING(    0x0c, "1" )
716543   PORT_DIPSETTING(    0x08, "4" )
r1877r1878
723550   PORT_DIPSETTING(    0x20, DEF_STR( Off ))
724551   PORT_DIPSETTING(    0x00, DEF_STR( On ))
725552
726   PORT_START
553   PORT_START_TAG("DIP_1")
727554   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Coinage ))
728555   PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ))
729556   PORT_DIPSETTING(    0x02, DEF_STR( 1C_1C ))
r1877r1878
745572   PORT_DIPSETTING(    0x40, DEF_STR( French ) )
746573   PORT_DIPSETTING(    0x00, DEF_STR( German ) )
747574
748   PORT_START /* bit 0 */
749   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
575   PORT_START_TAG("BIT_6")
576   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gear_r, (void *)0)
577   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gear_r, (void *)1)
578   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gear_r, (void *)2)
579   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Track Select") PORT_CODE(KEYCODE_SPACE)
580   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Gas")
581   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_VBLANK )
582   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_dir_r, (void *)0)
583   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(skid_r, (void *)1)
750584
751   PORT_START /* bit 6 */
752   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_UNUSED) /* GEAR 1 */
753   PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_UNUSED) /* GEAR 2 */
754   PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_UNUSED) /* GEAR 3 */
755   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Track Select") PORT_CODE(KEYCODE_SPACE)
756   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Gas")
757   PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_VBLANK)
758   PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_UNUSED) /* STEER DIR */
759   PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_UNUSED) /* SKID 1 */
585   PORT_START_TAG("BIT_7")
586   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
587   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_TILT )
588   PORT_SERVICE( 0x04, IP_ACTIVE_HIGH ) PORT_CHANGED(service_mode_switch_changed, 0)
589   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 )
590   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_COIN2 )
591   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL )
592   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_flag_r, (void *)0)
593   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(skid_r, (void *)0)
760594
761   PORT_START /* bit 7 */
762   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_START1)
763   PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_TILT)
764   PORT_SERVICE(0x04, IP_ACTIVE_HIGH)
765   PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_COIN1)
766   PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_COIN2)
767   PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_COIN3)
768   PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_UNUSED) /* STEER FLAG */
769   PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_UNUSED) /* SKID 0 */
595   PORT_START_TAG("GEAR")
596   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Gear 1") PORT_CODE(KEYCODE_Z) PORT_CHANGED(gear_changed, (void *)0)
597   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Gear 2") PORT_CODE(KEYCODE_X) PORT_CHANGED(gear_changed, (void *)1)
598   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Gear 3") PORT_CODE(KEYCODE_C) PORT_CHANGED(gear_changed, (void *)2)
599   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Gear 4") PORT_CODE(KEYCODE_V) PORT_CHANGED(gear_changed, (void *)3)
770600
771   PORT_START
772   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Gear 1") PORT_CODE(KEYCODE_Z)
773   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Gear 2") PORT_CODE(KEYCODE_X)
774   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Gear 3") PORT_CODE(KEYCODE_C)
775   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Gear 4") PORT_CODE(KEYCODE_V)
776
777601   PORT_START_TAG("R89")
778602   PORT_ADJUSTER( 20, "R89 - Motor Frequency" )
779603
r1877r1878
789613   1,      /* planes        */
790614   { 0 },  /* plane offsets */
791615   {
792      0x1C, 0x1D, 0x1E, 0x1F, 0x04, 0x05, 0x06, 0x07,
793      0x0C, 0x0D, 0x0E, 0x0F, 0x14, 0x15, 0x16, 0x17
616      0x1c, 0x1d, 0x1e, 0x1f, 0x04, 0x05, 0x06, 0x07,
617      0x0c, 0x0d, 0x0e, 0x0f, 0x14, 0x15, 0x16, 0x17
794618   },
795619   {
796      0x000, 0x020, 0x040, 0x060, 0x080, 0x0A0, 0x0C0, 0x0E0,
797      0x100, 0x120, 0x140, 0x160, 0x180, 0x1A0, 0x1C0, 0x1E0
620      0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0,
621      0x100, 0x120, 0x140, 0x160, 0x180, 0x1a0, 0x1c0, 0x1e0
798622   },
799623   0x200
800624};
r1877r1878
807631   1,      /* planes        */
808632   { 0 },  /* plane offsets */
809633   {
810      0x0C, 0x0D, 0x0E, 0x0F, 0x14, 0x15, 0x16, 0x17,
811      0x1C, 0x1D, 0x1E, 0x1F, 0x04, 0x05, 0x06, 0x07
634      0x0c, 0x0d, 0x0e, 0x0f, 0x14, 0x15, 0x16, 0x17,
635      0x1c, 0x1d, 0x1e, 0x1f, 0x04, 0x05, 0x06, 0x07
812636   },
813637   {
814      0x000, 0x020, 0x040, 0x060, 0x080, 0x0A0, 0x0C0, 0x0E0,
815      0x100, 0x120, 0x140, 0x160, 0x180, 0x1A0, 0x1C0, 0x1E0
638      0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0,
639      0x100, 0x120, 0x140, 0x160, 0x180, 0x1a0, 0x1c0, 0x1e0
816640   },
817641   0x200
818642};
r1877r1878
825649   1,      /* planes        */
826650   { 0 },  /* plane offsets */
827651   {
828      0xC, 0xD, 0xE, 0xF, 0x4, 0x5, 0x6, 0x7
652      0xc, 0xd, 0xe, 0xf, 0x4, 0x5, 0x6, 0x7
829653   },
830654   {
831655      0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70
r1877r1878
842666   { 0 },  /* plane offsets */
843667   {
844668      0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7,
845      0x8, 0x9, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF
669      0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf
846670   },
847671   {
848672      0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70,
849      0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF
673      0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf
850674   },
851675   0x100
852676};
r1877r1878
859683   1,      /* planes        */
860684   { 0 },  /* plane offsets */
861685   {
862      0x07, 0x06, 0x05, 0x04, 0x0F, 0x0E, 0x0D, 0x0C,
863      0x17, 0x16, 0x15, 0x14, 0x1F, 0x1E, 0x1D, 0x1C
686      0x07, 0x06, 0x05, 0x04, 0x0f, 0x0e, 0x0d, 0x0c,
687      0x17, 0x16, 0x15, 0x14, 0x1f, 0x1e, 0x1d, 0x1c
864688   },
865689   {
866      0x000, 0x020, 0x040, 0x060, 0x080, 0x0A0, 0x0C0, 0x0E0,
867      0x100, 0x120, 0x140, 0x160, 0x180, 0x1A0, 0x1C0, 0x1E0
690      0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0,
691      0x100, 0x120, 0x140, 0x160, 0x180, 0x1a0, 0x1c0, 0x1e0
868692   },
869693   0x200
870694};
r1877r1878
877701   1,      /* planes        */
878702   { 0 },  /* plane offsets */
879703   {
880      0x000, 0x040, 0x080, 0x0C0, 0x100, 0x140, 0x180, 0x1C0,
881      0x200, 0x240, 0x280, 0x2C0, 0x300, 0x340, 0x380, 0x3C0,
882      0x400, 0x440, 0x480, 0x4C0, 0x500, 0x540, 0x580, 0x5C0,
883      0x600, 0x640, 0x680, 0x6C0, 0x700, 0x740, 0x780, 0x7C0
704      0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0,
705      0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, 0x3c0,
706      0x400, 0x440, 0x480, 0x4c0, 0x500, 0x540, 0x580, 0x5c0,
707      0x600, 0x640, 0x680, 0x6c0, 0x700, 0x740, 0x780, 0x7c0
884708   },
885709   {
886      0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
887      0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F,
888      0x24, 0x25, 0x26, 0x27, 0x2C, 0x2D, 0x2E, 0x2F,
889      0x34, 0x35, 0x36, 0x37, 0x3C, 0x3D, 0x3E, 0x3B
710      0x04, 0x05, 0x06, 0x07, 0x0c, 0x0d, 0x0e, 0x0f,
711      0x14, 0x15, 0x16, 0x17, 0x1c, 0x1d, 0x1e, 0x1f,
712      0x24, 0x25, 0x26, 0x27, 0x2c, 0x2d, 0x2e, 0x2f,
713      0x34, 0x35, 0x36, 0x37, 0x3c, 0x3d, 0x3e, 0x3b
890714   },
891715   0x800
892716};
r1877r1878
900724   { 0 },  /* plane offsets */
901725   {
902726      0x0000, 0x0100, 0x0200, 0x0300, 0x0400, 0x0500, 0x0600, 0x0700,
903      0x0800, 0x0900, 0x0A00, 0x0B00, 0x0C00, 0x0D00, 0x0E00, 0x0F00,
727      0x0800, 0x0900, 0x0a00, 0x0b00, 0x0c00, 0x0d00, 0x0e00, 0x0f00,
904728      0x1000, 0x1100, 0x1200, 0x1300, 0x1400, 0x1500, 0x1600, 0x1700,
905      0x1800, 0x1900, 0x1A00, 0x1B00, 0x1C00, 0x1D00, 0x1E00, 0x1F00
729      0x1800, 0x1900, 0x1a00, 0x1b00, 0x1c00, 0x1d00, 0x1e00, 0x1f00
906730   },
907731   {
908      0x04, 0x0C, 0x14, 0x1C, 0x24, 0x2C, 0x34, 0x3C,
909      0x44, 0x4C, 0x54, 0x5C, 0x64, 0x6C, 0x74, 0x7C,
910      0x84, 0x8C, 0x94, 0x9C, 0xA4, 0xAC, 0xB4, 0xBC,
911      0xC4, 0xCC, 0xD4, 0xDC, 0xE4, 0xEC, 0xF4, 0xFC
732      0x04, 0x0c, 0x14, 0x1c, 0x24, 0x2c, 0x34, 0x3c,
733      0x44, 0x4c, 0x54, 0x5c, 0x64, 0x6c, 0x74, 0x7c,
734      0x84, 0x8c, 0x94, 0x9c, 0xa4, 0xac, 0xb4, 0xbc,
735      0xc4, 0xcc, 0xd4, 0xdc, 0xe4, 0xec, 0xf4, 0xfc
912736   },
913737   0x001
914738};
r1877r1878
922746           /* plane offsets */
923747   { 1, 0 },
924748   {
925      0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
926      0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E,
927      0x20, 0x22, 0x24, 0x26, 0x28, 0x2A, 0x2C, 0x2E,
928      0x30, 0x32, 0x34, 0x36, 0x38, 0x3A, 0x3C, 0x3E
749      0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e,
750      0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e,
751      0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e,
752      0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e
929753   },
930754   {
931      0x000, 0x040, 0x080, 0x0C0, 0x100, 0x140, 0x180, 0x1C0,
932      0x200, 0x240, 0x280, 0x2C0, 0x300, 0x340, 0x380, 0x3C0,
933      0x400, 0x440, 0x480, 0x4C0, 0x500, 0x540, 0x580, 0x5C0,
934      0x600, 0x640, 0x680, 0x6C0, 0x700, 0x740, 0x780, 0x7C0
755      0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0,
756      0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, 0x3c0,
757      0x400, 0x440, 0x480, 0x4c0, 0x500, 0x540, 0x580, 0x5c0,
758      0x600, 0x640, 0x680, 0x6c0, 0x700, 0x740, 0x780, 0x7c0
935759   },
936760   0x800
937761};
r1877r1878
944768   1,      /* planes        */
945769   { 0 },  /* plane offsets */
946770   {
947      0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
948      0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F,
949      0x24, 0x25, 0x26, 0x27, 0x2C, 0x2D, 0x2E, 0x2F,
950      0x34, 0x35, 0x36, 0x37, 0x3C, 0x3D, 0x3E, 0x3B
771      0x04, 0x05, 0x06, 0x07, 0x0c, 0x0d, 0x0e, 0x0f,
772      0x14, 0x15, 0x16, 0x17, 0x1c, 0x1d, 0x1e, 0x1f,
773      0x24, 0x25, 0x26, 0x27, 0x2c, 0x2d, 0x2e, 0x2f,
774      0x34, 0x35, 0x36, 0x37, 0x3c, 0x3d, 0x3e, 0x3b
951775   },
952776   {
953      0x000, 0x040, 0x080, 0x0C0, 0x100, 0x140, 0x180, 0x1C0,
954      0x200, 0x240, 0x280, 0x2C0, 0x300, 0x340, 0x380, 0x3C0,
955      0x400, 0x440, 0x480, 0x4C0, 0x500, 0x540, 0x580, 0x5C0,
956      0x600, 0x640, 0x680, 0x6C0, 0x700, 0x740, 0x780, 0x7C0
777      0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0,
778      0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, 0x3c0,
779      0x400, 0x440, 0x480, 0x4c0, 0x500, 0x540, 0x580, 0x5c0,
780      0x600, 0x640, 0x680, 0x6c0, 0x700, 0x740, 0x780, 0x7c0
957781   },
958782   0x800
959783};
r1877r1878
966790   1,      /* planes        */
967791   { 0 },  /* plane offsets */
968792   {
969      0x04, 0x0C, 0x14, 0x1C, 0x24, 0x2C, 0x34, 0x3C,
970      0x44, 0x4C, 0x54, 0x5C, 0x64, 0x6C, 0x74, 0x7C,
971      0x84, 0x8C, 0x94, 0x9C, 0xA4, 0xAC, 0xB4, 0xBC,
972      0xC4, 0xCC, 0xD4, 0xDC, 0xE4, 0xEC, 0xF4, 0xFC
793      0x04, 0x0c, 0x14, 0x1c, 0x24, 0x2c, 0x34, 0x3c,
794      0x44, 0x4c, 0x54, 0x5c, 0x64, 0x6c, 0x74, 0x7c,
795      0x84, 0x8c, 0x94, 0x9c, 0xa4, 0xac, 0xb4, 0xbc,
796      0xc4, 0xcc, 0xd4, 0xdc, 0xe4, 0xec, 0xf4, 0xfc
973797   },
974798   {
975799      0x0000, 0x0100, 0x0200, 0x0300, 0x0400, 0x0500, 0x0600, 0x0700,
976      0x0800, 0x0900, 0x0A00, 0x0B00, 0x0C00, 0x0D00, 0x0E00, 0x0F00,
800      0x0800, 0x0900, 0x0a00, 0x0b00, 0x0c00, 0x0d00, 0x0e00, 0x0f00,
977801      0x1000, 0x1100, 0x1200, 0x1300, 0x1400, 0x1500, 0x1600, 0x1700,
978      0x1800, 0x1900, 0x1A00, 0x1B00, 0x1C00, 0x1D00, 0x1E00, 0x1F00
802      0x1800, 0x1900, 0x1a00, 0x1b00, 0x1c00, 0x1d00, 0x1e00, 0x1f00
979803   },
980804   0x001
981805};
r1877r1878
983807static const UINT32 firetrk_trailer_layout_xoffset[64] =
984808{
985809   0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
986   0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
810   0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
987811   0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
988   0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
812   0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
989813   0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
990   0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
814   0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
991815   0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
992   0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F
816   0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f
993817};
994818
995819static const UINT32 firetrk_trailer_layout_yoffset[64] =
996820{
997   0x000, 0x040, 0x080, 0x0C0, 0x100, 0x140, 0x180, 0x1C0,
998   0x200, 0x240, 0x280, 0x2C0, 0x300, 0x340, 0x380, 0x3C0,
999   0x400, 0x440, 0x480, 0x4C0, 0x500, 0x540, 0x580, 0x5C0,
1000   0x600, 0x640, 0x680, 0x6C0, 0x700, 0x740, 0x780, 0x7C0,
1001   0x800, 0x840, 0x880, 0x8C0, 0x900, 0x940, 0x980, 0x9C0,
1002   0xA00, 0xA40, 0xA80, 0xAC0, 0xB00, 0xB40, 0xB80, 0xBC0,
1003   0xC00, 0xC40, 0xC80, 0xCC0, 0xD00, 0xD40, 0xD80, 0xDC0,
1004   0xE00, 0xE40, 0xE80, 0xEC0, 0xF00, 0xF40, 0xF80, 0xFC0
821   0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0,
822   0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, 0x3c0,
823   0x400, 0x440, 0x480, 0x4c0, 0x500, 0x540, 0x580, 0x5c0,
824   0x600, 0x640, 0x680, 0x6c0, 0x700, 0x740, 0x780, 0x7c0,
825   0x800, 0x840, 0x880, 0x8c0, 0x900, 0x940, 0x980, 0x9c0,
826   0xa00, 0xa40, 0xa80, 0xac0, 0xb00, 0xb40, 0xb80, 0xbc0,
827   0xc00, 0xc40, 0xc80, 0xcc0, 0xd00, 0xd40, 0xd80, 0xdc0,
828   0xe00, 0xe40, 0xe80, 0xec0, 0xf00, 0xf40, 0xf80, 0xfc0
1005829};
1006830
1007831static const gfx_layout firetrk_trailer_layout =
r1877r1878
1051875   /* basic machine hardware */
1052876   MDRV_CPU_ADD_TAG("main", M6800, FIRETRK_CPU_CLOCK_1MHZ)   /* 750Khz during service mode */
1053877   MDRV_CPU_PROGRAM_MAP(firetrk_map, 0)
1054   MDRV_CPU_VBLANK_INT(firetrk_interrupt, 1)
878   MDRV_CPU_VBLANK_INT("main", firetrk_interrupt)
1055879   MDRV_WATCHDOG_VBLANK_INIT(5)
1056880
1057881   MDRV_MACHINE_RESET(firetrk)
1058882
1059883   /* video hardware */
884   MDRV_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
885
1060886   MDRV_SCREEN_ADD("main", RASTER)
1061887   MDRV_SCREEN_REFRESH_RATE(60)
1062888   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
1063889   MDRV_SCREEN_SIZE(320, 262)
1064890   MDRV_SCREEN_VISIBLE_AREA(0, 319, 0, 239)
1065891
1066   MDRV_GFXDECODE(firetrk)
1067
892   MDRV_VIDEO_START(firetrk)
893   MDRV_VIDEO_UPDATE(firetrk)
1068894   MDRV_PALETTE_INIT(firetrk)
1069895   MDRV_PALETTE_LENGTH(28)
896   MDRV_GFXDECODE(firetrk)
1070897
1071   MDRV_VIDEO_START(firetrk)
1072   MDRV_VIDEO_EOF(firetrk)
1073   MDRV_VIDEO_UPDATE(firetrk)
1074
1075898   /* sound hardware */
1076899   MDRV_SPEAKER_STANDARD_MONO("mono")
1077900
r1877r1878
1089912   MDRV_CPU_PROGRAM_MAP(superbug_map, 0)
1090913
1091914   /* video hardware */
915   MDRV_VIDEO_START(superbug)
916   MDRV_VIDEO_UPDATE(superbug)
1092917   MDRV_GFXDECODE(superbug)
1093
1094   MDRV_PALETTE_INIT(firetrk)
1095918   MDRV_PALETTE_LENGTH(28)
1096919
1097920   /* sound hardware */
r1877r1878
1109932   MDRV_CPU_PROGRAM_MAP(montecar_map, 0)
1110933
1111934   /* video hardware */
935   MDRV_VIDEO_START(montecar)
936   MDRV_VIDEO_UPDATE(montecar)
1112937   MDRV_GFXDECODE(montecar)
1113938
1114939   MDRV_PALETTE_INIT(montecar)
r1877r1878
11971022ROM_END
11981023
11991024
1200GAME( 1977, superbug, 0, superbug, superbug, superbug, ROT270, "Atari", "Super Bug", 0 )
1201GAME( 1978, firetrk,  0, firetrk,  firetrk,  firetrk,  ROT270, "Atari", "Fire Truck", 0 )
1202GAME( 1979, montecar, 0, montecar, montecar, montecar, ROT270, "Atari", "Monte Carlo", 0 )
1025GAME( 1977, superbug, 0, superbug, superbug, 0, ROT270, "Atari", "Super Bug", 0 )
1026GAME( 1978, firetrk,  0, firetrk,  firetrk,  0, ROT270, "Atari", "Fire Truck", 0 )
1027GAME( 1979, montecar, 0, montecar, montecar, 0, ROT270, "Atari", "Monte Carlo", 0 )
src/mame/drivers/m57.c
r1877r1878
224224   /* basic machine hardware */
225225   MDRV_CPU_ADD(Z80, XTAL_18_432MHz/6)   /* verified on pcb */
226226   MDRV_CPU_PROGRAM_MAP(main_map,0)
227   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
227   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
228228
229229   /* video hardware */
230230   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/peplus.c
r1877r1878
978978   MDRV_CPU_PROGRAM_MAP(peplus_map, 0)
979979   MDRV_CPU_DATA_MAP(peplus_datamap, 0)
980980   MDRV_CPU_IO_MAP(peplus_iomap, 0)
981   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
981   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
982982
983983   MDRV_MACHINE_RESET(peplus)
984984   MDRV_NVRAM_HANDLER(peplus)
src/mame/drivers/segas24.c
r1877r1878
506506
507507// I/O Mappers
508508
509static UINT8 hotrod_io_r(int port)
509static UINT8 hotrod_io_r(running_machine *machine, int port)
510510{
511511   switch(port) {
512512   case 0:
r1877r1878
529529   return 0x00;
530530}
531531
532static UINT8 dcclub_io_r(int port)
532static UINT8 dcclub_io_r(running_machine *machine, int port)
533533{
534534   switch(port) {
535535   case 0: {
r1877r1878
556556
557557static int cur_input_line;
558558
559static UINT8 mahmajn_io_r(int port)
559static UINT8 mahmajn_io_r(running_machine *machine, int port)
560560{
561561   switch(port) {
562562   case 0:
r1877r1878
579579   return 0x00;
580580}
581581
582static UINT8 gground_io_r(int port)
582static UINT8 gground_io_r(running_machine *machine, int port)
583583{
584584   switch(port) {
585585   case 0:
r1877r1878
602602   return 0x00;
603603}
604604
605static void mahmajn_io_w(int port, UINT8 data)
605static void mahmajn_io_w(running_machine *machine, int port, UINT8 data)
606606{
607607   switch(port) {
608608   case 3:
r1877r1878
610610         cur_input_line = (cur_input_line + 1) & 7;
611611      break;
612612   case 7: // DAC
613      DAC_0_signed_data_w(0, data);
613      DAC_0_signed_data_w(machine, 0, data);
614614      break;
615615   default:
616616      fprintf(stderr, "Port %d : %02x\n", port, data & 0xff);
617617   }
618618}
619619
620static void hotrod_io_w(int port, UINT8 data)
620static void hotrod_io_w(running_machine *machine, int port, UINT8 data)
621621{
622622   switch(port) {
623623   case 3: // Lamps
624624      break;
625625   case 7: // DAC
626      DAC_0_signed_data_w(0, data);
626      DAC_0_signed_data_w(machine,0, data);
627627      break;
628628   default:
629629      fprintf(stderr, "Port %d : %02x\n", port, data & 0xff);
r1877r1878
746746
747747static READ16_HANDLER( ym_status_r )
748748{
749   return YM2151_status_port_0_r(0);
749   return YM2151_status_port_0_r(machine, 0);
750750}
751751
752752static WRITE16_HANDLER( ym_register_w )
753753{
754754   if(ACCESSING_LSB)
755      YM2151_register_port_0_w(0, data);
755      YM2151_register_port_0_w(machine, 0, data);
756756}
757757
758758static WRITE16_HANDLER( ym_data_w )
759759{
760760   if(ACCESSING_LSB)
761      YM2151_data_port_0_w(0, data);
761      YM2151_data_port_0_w(machine, 0, data);
762762}
763763
764764
r1877r1878
19081908static MACHINE_DRIVER_START( system24 )
19091909   MDRV_CPU_ADD(M68000, 10000000)
19101910   MDRV_CPU_PROGRAM_MAP(system24_cpu1_map, 0)
1911   MDRV_CPU_VBLANK_INT(irq_vbl, 2)
1911   MDRV_CPU_VBLANK_INT_HACK(irq_vbl, 2)
19121912
19131913   MDRV_CPU_ADD(M68000, 10000000)
19141914   MDRV_CPU_PROGRAM_MAP(system24_cpu2_map, 0)
src/mame/drivers/mustache.c
r1877r1878
206206   /* basic machine hardware */
207207   MDRV_CPU_ADD(Z80, CPU_CLOCK)
208208   MDRV_CPU_PROGRAM_MAP(memmap, 0)
209   MDRV_CPU_VBLANK_INT(assert_irq,1)
209   MDRV_CPU_VBLANK_INT("main", assert_irq)
210210
211211   MDRV_CPU_ADD_TAG(CPUTAG_T5182,Z80, T5182_CLOCK)
212212   MDRV_CPU_PROGRAM_MAP(t5182_map, 0)
src/mame/drivers/namcoic.c
r1877r1878
8989} /* namco_tilemap_init */
9090
9191void
92namco_tilemap_draw( mame_bitmap *bitmap, const rectangle *cliprect, int pri )
92namco_tilemap_draw( bitmap_t *bitmap, const rectangle *cliprect, int pri )
9393{
9494   int i;
9595   for( i=0; i<6; i++ )
r1877r1878
266266/**************************************************************************************/
267267
268268static void zdrawgfxzoom(running_machine *machine,
269      mame_bitmap *dest_bmp,const gfx_element *gfx,
269      bitmap_t *dest_bmp,const gfx_element *gfx,
270270      UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
271271      const rectangle *clip,int transparency,int transparent_color,
272272      int scalex, int scaley, int zpos )
r1877r1878
414414} /* zdrawgfxzoom */
415415
416416void
417namcos2_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri, int control )
417namcos2_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri, int control )
418418{
419419   int offset = (control & 0x000f) * (128*4);
420420   int loop;
r1877r1878
498498} /* namcos2_draw_sprites */
499499
500500void
501namcos2_draw_sprites_metalhawk(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri )
501namcos2_draw_sprites_metalhawk(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri )
502502{
503503   /**
504504     * word#0
r1877r1878
674674/* nth_word32 is a general-purpose utility function, which allows us to
675675 * read from 32-bit aligned memory as if it were an array of 16 bit words.
676676 */
677#ifdef UNUSED_FUNCTION
677678INLINE UINT16
678679nth_word32( const UINT32 *pSource, int which )
679680{
r1877r1878
687688      return data>>16;
688689   }
689690} /* nth_word32 */
691#endif
690692
691693/* nth_byte32 is a general-purpose utility function, which allows us to
692694 * read from 32-bit aligned memory as if it were an array of bytes.
693695 */
696#ifdef UNUSED_FUNCTON
694697INLINE UINT8
695698nth_byte32( const UINT32 *pSource, int which )
696699{
r1877r1878
703706      default: return data&0xff;
704707      }
705708} /* nth_byte32 */
709#endif
706710
707711/**************************************************************************************************************/
708712
r1877r1878
720724 * 0x14000 sprite list (page1)
721725 */
722726static void
723draw_spriteC355(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, const UINT16 *pSource, int pri, int zpos )
727draw_spriteC355(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT16 *pSource, int pri, int zpos )
724728{
725729   unsigned screen_height_remaining, screen_width_remaining;
726730   unsigned source_height_remaining, source_width_remaining;
r1877r1878
927931
928932static void
929933DrawObjectList(running_machine *machine,
930      mame_bitmap *bitmap,
934      bitmap_t *bitmap,
931935      const rectangle *cliprect,
932936      int pri,
933937      const UINT16 *pSpriteList16,
r1877r1878
944948} /* DrawObjectList */
945949
946950void
947namco_obj_draw(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri )
951namco_obj_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri )
948952{
949953//  int offs = spriteram16[0x18000/2]; /* end-of-sprite-list */
950954   if( pri==0 )
r1877r1878
11181122namco_roz_init( int gfxbank, int maskregion )
11191123{
11201124   int i;
1121   static const tile_get_info_callback roz_info[ROZ_TILEMAP_COUNT] =
1125   static const tile_get_info_func roz_info[ROZ_TILEMAP_COUNT] =
11221126   {
11231127      roz_get_info0,
11241128      roz_get_info1
r1877r1878
12101214
12111215static void
12121216DrawRozHelper(
1213   mame_bitmap *bitmap,
1217   bitmap_t *bitmap,
12141218   tilemap *tmap,
12151219   const rectangle *clip,
12161220   const struct RozParam *rozInfo )
r1877r1878
12211225       (namcos2_gametype != NAMCOFL_FINAL_LAP_R))
12221226   {
12231227      UINT32 size_mask = rozInfo->size-1;
1224      mame_bitmap *srcbitmap = tilemap_get_pixmap( tmap );
1225      mame_bitmap *flagsbitmap = tilemap_get_flagsmap( tmap );
1228      bitmap_t *srcbitmap = tilemap_get_pixmap( tmap );
1229      bitmap_t *flagsbitmap = tilemap_get_flagsmap( tmap );
12261230      UINT32 startx = rozInfo->startx + clip->min_x * rozInfo->incxx + clip->min_y * rozInfo->incyx;
12271231      UINT32 starty = rozInfo->starty + clip->min_x * rozInfo->incxy + clip->min_y * rozInfo->incyy;
12281232      int sx = clip->min_x;
r1877r1878
12681272} /* DrawRozHelper */
12691273
12701274static void
1271DrawRozScanline( mame_bitmap *bitmap, int line, int which, int pri, const rectangle *cliprect )
1275DrawRozScanline( bitmap_t *bitmap, int line, int which, int pri, const rectangle *cliprect )
12721276{
12731277   if( line>=cliprect->min_y && line<=cliprect->max_y )
12741278   {
r1877r1878
12981302} /* DrawRozScanline */
12991303
13001304void
1301namco_roz_draw( mame_bitmap *bitmap, const rectangle *cliprect, int pri )
1305namco_roz_draw( bitmap_t *bitmap, const rectangle *cliprect, int pri )
13021306{
13031307   int mode = rozcontrol16[0]; /* 0x8000 or 0x1000 */
13041308   int which, special = 1;
r1877r1878
16421646}
16431647
16441648void
1645namco_road_draw(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int pri )
1649namco_road_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri )
16461650{
16471651   const UINT8 *clut = (void *)memory_region(REGION_USER3);
1648   mame_bitmap *pSourceBitmap;
1652   bitmap_t *pSourceBitmap;
16491653   unsigned yscroll;
16501654   int i;
16511655
src/mame/drivers/ddayjlc.c
r1877r1878
114114
115115static READ8_HANDLER(prot_r)
116116{
117   return (input_port_1_r(0)&0x1f)|protData[protAdr];
117   return (input_port_1_r(machine,0)&0x1f)|protData[protAdr];
118118}
119119
120120static WRITE8_HANDLER(prot_w)
r1877r1878
171171
172172static WRITE8_HANDLER( sound_w )
173173{
174   soundlatch_w(offset,data);
175   cpunum_set_input_line_and_vector(Machine, 1,0,HOLD_LINE,0xff);
174   soundlatch_w(machine,offset,data);
175   cpunum_set_input_line_and_vector(machine, 1,0,HOLD_LINE,0xff);
176176}
177177
178178static WRITE8_HANDLER( i8257_CH0_w )
r1877r1878
399399static MACHINE_DRIVER_START( ddayjlc )
400400   MDRV_CPU_ADD(Z80,12000000/3)
401401   MDRV_CPU_PROGRAM_MAP(main_cpu,0)
402   MDRV_CPU_VBLANK_INT(ddayjlc_interrupt,1)
402   MDRV_CPU_VBLANK_INT("main", ddayjlc_interrupt)
403403
404404   MDRV_CPU_ADD(Z80, 12000000/4)
405405   /* audio CPU */
406406   MDRV_CPU_PROGRAM_MAP(sound_cpu,0)
407   MDRV_CPU_VBLANK_INT(ddayjlc_snd_interrupt,1)
407   MDRV_CPU_VBLANK_INT("main", ddayjlc_snd_interrupt)
408408
409409   MDRV_INTERLEAVE(100)
410410
src/mame/drivers/segas16a.c
r1877r1878
163163static UINT8 video_control;
164164static UINT8 mj_input_num;
165165
166static read16_handler custom_io_r;
167static write16_handler custom_io_w;
166static read16_machine_func custom_io_r;
167static write16_machine_func custom_io_w;
168168static void (*lamp_changed_w)(UINT8 changed, UINT8 newval);
169static void (*i8751_vblank_hook)(void);
169static void (*i8751_vblank_hook)(running_machine *machine);
170170
171171static UINT8 n7751_command;
172172static UINT32 n7751_rom_address;
r1877r1878
266266
267267static TIMER_CALLBACK( delayed_ppi8255_w )
268268{
269   ppi8255_0_w(param >> 8, param & 0xff);
269   ppi8255_0_w(machine, param >> 8, param & 0xff);
270270}
271271
272272
r1877r1878
276276   switch (offset & (0x3000/2))
277277   {
278278      case 0x0000/2:
279         return ppi8255_0_r(offset & 3);
279         return ppi8255_0_r(machine, offset & 3);
280280
281281      case 0x1000/2:
282282         return readinputport(offset & 3);
r1877r1878
308308static READ16_HANDLER( misc_io_r )
309309{
310310   if (custom_io_r)
311      return (*custom_io_r)(offset, mem_mask);
311      return (*custom_io_r)(machine, offset, mem_mask);
312312   else
313      return standard_io_r(offset, mem_mask);
313      return standard_io_r(machine, offset, mem_mask);
314314}
315315
316316
317317static WRITE16_HANDLER( misc_io_w )
318318{
319319   if (custom_io_w)
320      (*custom_io_w)(offset, data, mem_mask);
320      (*custom_io_w)(machine, offset, data, mem_mask);
321321   else
322      standard_io_w(offset, data, mem_mask);
322      standard_io_w(machine, offset, data, mem_mask);
323323}
324324
325325
r1877r1878
397397{
398398   /* assert ACK */
399399   ppi8255_set_portC(0, 0x00);
400   return soundlatch_r(offset);
400   return soundlatch_r(machine, offset);
401401}
402402
403403
r1877r1878
491491{
492492   /* if we have a fake 8751 handler, call it on VBLANK */
493493   if (i8751_vblank_hook != NULL)
494      (*i8751_vblank_hook)();
494      (*i8751_vblank_hook)(machine);
495495}
496496
497497
r1877r1878
502502 *
503503 *************************************/
504504
505static void bodyslam_i8751_sim(void)
505static void bodyslam_i8751_sim(running_machine *machine)
506506{
507507   UINT8 flag = workram[0x200/2] >> 8;
508508   UINT8 tick = workram[0x200/2] & 0xff;
r1877r1878
510510   UINT8 min = workram[0x202/2] & 0xff;
511511
512512   /* signal a VBLANK to the main CPU */
513   cpunum_set_input_line(Machine, 0, 4, HOLD_LINE);
513   cpunum_set_input_line(machine, 0, 4, HOLD_LINE);
514514
515515   /* out of time? set the flag */
516516   if (tick == 0 && sec == 0 && min == 0)
r1877r1878
547547}
548548
549549
550static void quartet_i8751_sim(void)
550static void quartet_i8751_sim(running_machine *machine)
551551{
552552   /* signal a VBLANK to the main CPU */
553   cpunum_set_input_line(Machine, 0, 4, HOLD_LINE);
553   cpunum_set_input_line(machine, 0, 4, HOLD_LINE);
554554
555555   /* X scroll values */
556   segaic16_textram_0_w(0xff8/2, workram[0x0d14/2], 0);
557   segaic16_textram_0_w(0xffa/2, workram[0x0d18/2], 0);
556   segaic16_textram_0_w(machine, 0xff8/2, workram[0x0d14/2], 0);
557   segaic16_textram_0_w(machine, 0xffa/2, workram[0x0d18/2], 0);
558558
559559   /* page values */
560   segaic16_textram_0_w(0xe9e/2, workram[0x0d1c/2], 0);
561   segaic16_textram_0_w(0xe9c/2, workram[0x0d1e/2], 0);
560   segaic16_textram_0_w(machine, 0xe9e/2, workram[0x0d1c/2], 0);
561   segaic16_textram_0_w(machine, 0xe9c/2, workram[0x0d1e/2], 0);
562562}
563563
564564
r1877r1878
606606         break;
607607   }
608608
609   return standard_io_r(offset, mem_mask);
609   return standard_io_r(machine, offset, mem_mask);
610610}
611611
612612
r1877r1878
690690         }
691691         break;
692692   }
693   return standard_io_r(offset, mem_mask);
693   return standard_io_r(machine, offset, mem_mask);
694694}
695695
696696/*************************************
r1877r1878
702702static READ16_HANDLER( pshot16a_custom_io_r )
703703{
704704   static int read_port = 0;
705
706705   switch (offset & (0x3000/2))
707706   {
708707      case 0x1000/2:
r1877r1878
725724         }
726725         break;
727726   }
728   return standard_io_r(offset, mem_mask);
727   return standard_io_r(machine, offset, mem_mask);
729728}
730729
731730/*************************************
r1877r1878
746745         }
747746         break;
748747   }
749   return standard_io_r(offset, mem_mask);
748   return standard_io_r(machine, offset, mem_mask);
750749}
751750
752751
r1877r1878
760759static READ16_HANDLER( sjryuko_custom_io_r )
761760{
762761   static const char *const portname[] = { "MJ0", "MJ1", "MJ2", "MJ3", "MJ4", "MJ5" };
763
764762   switch (offset & (0x3000/2))
765763   {
766764      case 0x1000/2:
r1877r1878
776774         }
777775         break;
778776   }
779   return standard_io_r(offset, mem_mask);
777   return standard_io_r(machine, offset, mem_mask);
780778}
781779
782780
r1877r1878
17781776   /* basic machine hardware */
17791777   MDRV_CPU_ADD_TAG("main", M68000, 10000000)
17801778   MDRV_CPU_PROGRAM_MAP(system16a_map,0)
1781   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
1779   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
17821780
17831781   MDRV_CPU_ADD_TAG("sound", Z80, 4000000)
17841782   /* audio CPU */
r1877r1878
18311829static MACHINE_DRIVER_START( system16a_8751 )
18321830   MDRV_IMPORT_FROM(system16a)
18331831   MDRV_CPU_MODIFY("main")
1834   MDRV_CPU_VBLANK_INT(i8751_main_cpu_vblank,1)
1832   MDRV_CPU_VBLANK_INT("main", i8751_main_cpu_vblank)
18351833
18361834   MDRV_CPU_ADD_TAG("mcu", I8751, 8000000)
18371835   MDRV_CPU_PROGRAM_MAP(mcu_map,0)
18381836   MDRV_CPU_DATA_MAP(mcu_data_map,0)
1839   MDRV_CPU_VBLANK_INT(irq0_line_pulse,1)
1837   MDRV_CPU_VBLANK_INT("main", irq0_line_pulse)
18401838MACHINE_DRIVER_END
18411839
18421840
src/mame/drivers/neogeo.c
r1877r1878
368368   case 0x00: select_controller(data & 0x00ff); break;
369369   case 0x18: set_output_latch(data & 0x00ff); break;
370370   case 0x20: set_output_data(data & 0x00ff); break;
371   case 0x28: pd4990a_control_16_w(0, data, mem_mask); break;
371   case 0x28: pd4990a_control_16_w(machine, 0, data, mem_mask); break;
372372//  case 0x30: break; // coin counters
373373//  case 0x31: break; // coin counters
374374//  case 0x32: break; // coin lockout
r1877r1878
444444
445445static CUSTOM_INPUT( get_calendar_status )
446446{
447   return (pd4990a_databit_r(0) << 1) | pd4990a_testbit_r(0);
447   return (pd4990a_databit_r(machine, 0) << 1) | pd4990a_testbit_r(machine, 0);
448448}
449449
450450
r1877r1878
564564   /* accessing the LSB only is not mapped */
565565   if (mem_mask != 0xff00)
566566   {
567      soundlatch_w(0, data >> 8);
567      soundlatch_w(machine, 0, data >> 8);
568568
569569      audio_cpu_assert_nmi();
570570
r1877r1878
578578
579579static READ8_HANDLER( audio_command_r )
580580{
581   UINT8 ret = soundlatch_r(0);
581   UINT8 ret = soundlatch_r(machine, 0);
582582
583583   if (LOG_CPU_COMM) logerror(" AUD CPU PC   %04x: audio_command_r %02x\n", activecpu_get_pc(), ret);
584584
585585   /* this is a guess */
586   audio_cpu_clear_nmi_w(0, 0);
586   audio_cpu_clear_nmi_w(machine, 0, 0);
587587
588588   return ret;
589589}
r1877r1878
877877   /* only an LSB write resets the watchdog */
878878   if (ACCESSING_LSB)
879879   {
880      watchdog_reset16_w(offset, data, mem_mask);
880      watchdog_reset16_w(machine, offset, data, mem_mask);
881881   }
882882}
883883
r1877r1878
10081008
10091009   /* reset system control registers */
10101010   for (offs = 0; offs < 8; offs++)
1011      system_control_w(offs, 0, 0xff00);
1011      system_control_w(machine, offs, 0, 0xff00);
10121012
10131013   neogeo_reset_rng();
10141014
r1877r1878
10851085   AM_RANGE(0x06, 0x06) AM_MIRROR(0xff00) AM_READWRITE(YM2610_status_port_0_B_r, YM2610_control_port_0_B_w)
10861086   AM_RANGE(0x07, 0x07) AM_MIRROR(0xff00) AM_WRITE(YM2610_data_port_0_B_w)
10871087   AM_RANGE(0x08, 0x08) AM_MIRROR(0xff00) /* write - NMI enable / acknowledge? (the data written doesn't matter) */
1088   AM_SPACE(0x08, 0x0f) AM_READ(audio_cpu_bank_select_f000_f7ff_r)
1089   AM_SPACE(0x09, 0x0f) AM_READ(audio_cpu_bank_select_e000_efff_r)
1090   AM_SPACE(0x0a, 0x0f) AM_READ(audio_cpu_bank_select_c000_dfff_r)
1091   AM_SPACE(0x0b, 0x0f) AM_READ(audio_cpu_bank_select_8000_bfff_r)
1088   AM_RANGE(0x08, 0x08) AM_MIRROR(0xfff0) AM_MASK(0xfff0) AM_READ(audio_cpu_bank_select_f000_f7ff_r)
1089   AM_RANGE(0x09, 0x09) AM_MIRROR(0xfff0) AM_MASK(0xfff0) AM_READ(audio_cpu_bank_select_e000_efff_r)
1090   AM_RANGE(0x0a, 0x0a) AM_MIRROR(0xfff0) AM_MASK(0xfff0) AM_READ(audio_cpu_bank_select_c000_dfff_r)
1091   AM_RANGE(0x0b, 0x0b) AM_MIRROR(0xfff0) AM_MASK(0xfff0) AM_READ(audio_cpu_bank_select_8000_bfff_r)
10921092   AM_RANGE(0x0c, 0x0c) AM_MIRROR(0xff00) AM_WRITE(audio_result_w)
10931093   AM_RANGE(0x18, 0x18) AM_MIRROR(0xff00) /* write - NMI disable? (the data written doesn't matter) */
10941094ADDRESS_MAP_END
src/mame/drivers/konamigx.c
r1877r1878
919919
920920static READ32_HANDLER( gx5bppspr_r )
921921{
922   return (K055673_rom_word_r(offset*2+1, 0xffff) | K055673_rom_word_r(offset*2, 0xffff)<<16);
922   return (K055673_rom_word_r(machine, offset*2+1, 0xffff) | K055673_rom_word_r(machine, offset*2, 0xffff)<<16);
923923}
924924
925925static READ32_HANDLER( gx6bppspr_r )
926926{
927   return (K055673_GX6bpp_rom_word_r(offset*2+1, 0xffff) | K055673_GX6bpp_rom_word_r(offset*2, 0xffff)<<16);
927   return (K055673_GX6bpp_rom_word_r(machine, offset*2+1, 0xffff) | K055673_GX6bpp_rom_word_r(machine, offset*2, 0xffff)<<16);
928928}
929929
930930static READ32_HANDLER( type1_roz_r1 )
r1877r1878
12081208   UINT16 ret = 0;
12091209
12101210   if (ACCESSING_LSB16)
1211      ret |= K054539_1_r(offset);
1211      ret |= K054539_1_r(machine, offset);
12121212   if (ACCESSING_MSB16)
1213      ret |= K054539_0_r(offset)<<8;
1213      ret |= K054539_0_r(machine, offset)<<8;
12141214
12151215   return ret;
12161216}
r1877r1878
12181218static WRITE16_HANDLER( dual539_w )
12191219{
12201220   if (ACCESSING_LSB16)
1221      K054539_1_w(offset, data);
1221      K054539_1_w(machine, offset, data);
12221222   if (ACCESSING_MSB16)
1223      K054539_0_w(offset, data>>8);
1223      K054539_0_w(machine, offset, data>>8);
12241224}
12251225
12261226static READ16_HANDLER( sndcomm68k_r )
r1877r1878
13131313   /* basic machine hardware */
13141314   MDRV_CPU_ADD_TAG("main", M68EC020, 24000000)
13151315   MDRV_CPU_PROGRAM_MAP(gx_base_memmap, gx_type2_map)
1316   MDRV_CPU_VBLANK_INT(konamigx_vbinterrupt, 1)
1316   MDRV_CPU_VBLANK_INT("main", konamigx_vbinterrupt)
13171317
13181318   /* note: part is a -8, crystals are 18.4 and 32.0 MHz, and
13191319       twinbee yahhoo will not pass POST if the 68000 isn't
r1877r1878
14081408
14091409   MDRV_CPU_MODIFY("main")
14101410   MDRV_CPU_PROGRAM_MAP(gx_base_memmap, gx_type3_map)
1411   MDRV_CPU_VBLANK_INT(konamigx_hbinterrupt, 262)
1411   MDRV_CPU_VBLANK_INT_HACK(konamigx_hbinterrupt, 262)
14121412
14131413   MDRV_VIDEO_START(konamigx_type3)
14141414   MDRV_PALETTE_LENGTH(16384)
r1877r1878
14231423
14241424   MDRV_CPU_MODIFY("main")
14251425   MDRV_CPU_PROGRAM_MAP(gx_base_memmap, gx_type4_map)
1426   MDRV_CPU_VBLANK_INT(konamigx_hbinterrupt, 262)
1426   MDRV_CPU_VBLANK_INT_HACK(konamigx_hbinterrupt, 262)
14271427
14281428   MDRV_SCREEN_MODIFY("main")
14291429   MDRV_SCREEN_SIZE(64*8, 32*8)
src/mame/drivers/segahang.c
r1877r1878
138138
139139static TIMER_CALLBACK( delayed_ppi8255_w )
140140{
141   ppi8255_0_w(param >> 8, param & 0xff);
141   ppi8255_0_w(machine, param >> 8, param & 0xff);
142142}
143143
144144
r1877r1878
147147   switch (offset & 0x3020/2)
148148   {
149149      case 0x0000/2: /* PPI @ 4B */
150         return ppi8255_0_r(offset & 3);
150         return ppi8255_0_r(machine, offset & 3);
151151
152152      case 0x1000/2: /* Input ports and DIP switches */
153153         return readinputport(offset & 3);
154154
155155      case 0x3000/2: /* PPI @ 4C */
156         return ppi8255_1_r(offset & 3);
156         return ppi8255_1_r(machine, offset & 3);
157157
158158      case 0x3020/2: /* ADC0804 data output */
159159         return readinputport(4 + adc_select);
160160   }
161161
162162   logerror("%06X:hangon_io_r - unknown read access to address %04X\n", activecpu_get_pc(), offset * 2);
163   return segaic16_open_bus_r(0,0);
163   return segaic16_open_bus_r(machine,0,0);
164164}
165165
166166
r1877r1878
176176            return;
177177
178178         case 0x3000/2: /* PPI @ 4C */
179            ppi8255_1_w(offset & 3, data & 0xff);
179            ppi8255_1_w(machine, offset & 3, data & 0xff);
180180            return;
181181
182182         case 0x3020/2: /* ADC0804 */
r1877r1878
192192   switch (offset & 0x0030/2)
193193   {
194194      case 0x0000/2:
195         return ppi8255_0_r(offset & 3);
195         return ppi8255_0_r(machine, offset & 3);
196196
197197      case 0x0010/2: /* Input ports and DIP switches */
198198         return readinputport(offset & 3);
199199
200200      case 0x0020/2: /* PPI @ 4C */
201201         if (offset == 2) return 0;
202         return ppi8255_1_r(offset & 3);
202         return ppi8255_1_r(machine, offset & 3);
203203
204204      case 0x0030/2: /* ADC0804 data output */
205205         return readinputport(4 + adc_select);
206206   }
207207
208208   logerror("%06X:sharrier_io_r - unknown read access to address %04X\n", activecpu_get_pc(), offset * 2);
209   return segaic16_open_bus_r(0,0);
209   return segaic16_open_bus_r(machine,0,0);
210210}
211211
212212
r1877r1878
222222            return;
223223
224224         case 0x0020/2: /* PPI @ 4C */
225            ppi8255_1_w(offset & 3, data & 0xff);
225            ppi8255_1_w(machine, offset & 3, data & 0xff);
226226            return;
227227
228228         case 0x0030/2: /* ADC0804 */
r1877r1878
347347{
348348   /* assert ACK */
349349   ppi8255_set_portC(0, 0x00);
350   return soundlatch_r(offset);
350   return soundlatch_r(machine, offset);
351351}
352352
353353
r1877r1878
845845   /* basic machine hardware */
846846   MDRV_CPU_ADD_TAG("main", M68000, MASTER_CLOCK_25MHz/4)
847847   MDRV_CPU_PROGRAM_MAP(hangon_map,0)
848   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
848   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
849849
850850   MDRV_CPU_ADD_TAG("sub", M68000, MASTER_CLOCK_25MHz/4)
851851   MDRV_CPU_PROGRAM_MAP(sub_map,0)
r1877r1878
872872   /* basic machine hardware */
873873   MDRV_CPU_REPLACE("main", M68000, MASTER_CLOCK_10MHz)
874874   MDRV_CPU_PROGRAM_MAP(sharrier_map,0)
875   MDRV_CPU_VBLANK_INT(i8751_main_cpu_vblank,1)
875   MDRV_CPU_VBLANK_INT("main", i8751_main_cpu_vblank)
876876
877877   MDRV_CPU_REPLACE("sub", M68000, MASTER_CLOCK_10MHz)
878878
r1877r1878
999999   MDRV_CPU_ADD_TAG("mcu", I8751, 8000000)
10001000   MDRV_CPU_PROGRAM_MAP(mcu_map,0)
10011001   MDRV_CPU_DATA_MAP(mcu_data_map,0)
1002   MDRV_CPU_VBLANK_INT(irq0_line_pulse,1)
1002   MDRV_CPU_VBLANK_INT("main", irq0_line_pulse)
10031003MACHINE_DRIVER_END
10041004
10051005
src/mame/drivers/sprcros2.c
r1877r1878
304304   MDRV_CPU_ADD(Z80,10000000/2)
305305   MDRV_CPU_PROGRAM_MAP(sprcros2_m_readmem,sprcros2_m_writemem)
306306   MDRV_CPU_IO_MAP(sprcros2_m_readport,sprcros2_m_writeport)
307   MDRV_CPU_VBLANK_INT(sprcros2_m_interrupt,2)   //1 nmi + 1 irq
307   MDRV_CPU_VBLANK_INT_HACK(sprcros2_m_interrupt,2)   //1 nmi + 1 irq
308308
309309   MDRV_CPU_ADD(Z80,10000000/2)
310310   MDRV_CPU_PROGRAM_MAP(sprcros2_s_readmem,sprcros2_s_writemem)
311311   MDRV_CPU_IO_MAP(0,sprcros2_s_writeport)
312   MDRV_CPU_VBLANK_INT(sprcros2_s_interrupt,2)   //2 nmis
312   MDRV_CPU_VBLANK_INT_HACK(sprcros2_s_interrupt,2)   //2 nmis
313313
314314   MDRV_MACHINE_START(sprcros2)
315315
src/mame/drivers/statriv2.c
r1877r1878
607607   MDRV_CPU_ADD_TAG("main",8085A,12400000*2)              /* 12.4MHz / 4? */
608608   MDRV_CPU_PROGRAM_MAP(statriv2_readmem,statriv2_writemem)
609609   MDRV_CPU_IO_MAP(statriv2_readport,statriv2_writeport)
610   MDRV_CPU_VBLANK_INT(statriv2_interrupt,1)
610   MDRV_CPU_VBLANK_INT("main", statriv2_interrupt)
611611
612612   MDRV_NVRAM_HANDLER(statriv2)
613613
src/mame/drivers/carrera.c
r1877r1878
5151
5252
5353
54static WRITE8_HANDLER( carrera_mc6845_address_w )
55{
56   mc6845_address_w(mc6845, data);
57}
58
59static WRITE8_HANDLER( carrera_mc6845_register_w )
60{
61   mc6845_register_w(mc6845, data);
62}
63
64
6554static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
6655   AM_RANGE(0x0000, 0x4fff) AM_READ(MRA8_ROM)
6756   AM_RANGE(0xe000, 0xe7ff) AM_READ(MRA8_RAM)
r1877r1878
7160static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
7261   AM_RANGE(0x0000, 0x4fff) AM_WRITE(MWA8_ROM)
7362   AM_RANGE(0xe000, 0xe7ff) AM_WRITE(MWA8_RAM)
74   AM_RANGE(0xe800, 0xe800) AM_WRITE(carrera_mc6845_address_w)
75   AM_RANGE(0xe801, 0xe801) AM_WRITE(carrera_mc6845_register_w)
63   AM_RANGE(0xe800, 0xe800) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
64   AM_RANGE(0xe801, 0xe801) AM_DEVWRITE(MC6845, "crtc", mc6845_register_w)
7665   AM_RANGE(0xf000, 0xffff) AM_WRITE(MWA8_RAM) AM_BASE(&carrera_tileram)
7766ADDRESS_MAP_END
7867
r1877r1878
307296   MDRV_CPU_ADD(Z80,MASTER_CLOCK/6)
308297   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
309298   MDRV_CPU_IO_MAP(readport,writeport)
310   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
299   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
311300
312301   /* video hardware */
313302   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/dorachan.c
r1877r1878
99*/
1010
1111#include "driver.h"
12#include "deprecat.h"
1213
1314
1415#define NUM_PENS   (8)
r1877r1878
213214   MDRV_CPU_ADD(Z80, 2000000)
214215   MDRV_CPU_PROGRAM_MAP(dorachan_map,0)
215216   MDRV_CPU_IO_MAP(dorachan_io_map,0)
216   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
217   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
217218
218219   /* video hardware */
219220   MDRV_VIDEO_UPDATE(dorachan)
src/mame/drivers/thunderj.c
r1877r1878
180180    if (cpu_readmem24bew_word(0x163482) > 0xfff)
181181        mame_printf_debug("You're screwed!");*/
182182
183   return atarivc_r(offset,0);
183   return atarivc_r(machine,offset,0);
184184}
185185
186186
src/mame/drivers/ultraman.c
r1877r1878
2424
2525static READ16_HANDLER( ultraman_K051937_r )
2626{
27   return K051937_r(offset);
27   return K051937_r(machine, offset);
2828}
2929
3030static READ16_HANDLER( ultraman_K051960_r )
3131{
32   return K051960_r(offset);
32   return K051960_r(machine, offset);
3333}
3434
3535static READ16_HANDLER( ultraman_K051316_0_r )
3636{
37   return K051316_0_r(offset);
37   return K051316_0_r(machine, offset);
3838}
3939
4040static READ16_HANDLER( ultraman_K051316_1_r )
4141{
42   return K051316_1_r(offset);
42   return K051316_1_r(machine, offset);
4343}
4444
4545static READ16_HANDLER( ultraman_K051316_2_r )
4646{
47   return K051316_2_r(offset);
47   return K051316_2_r(machine, offset);
4848}
4949
5050static WRITE16_HANDLER( ultraman_K051316_0_w )
5151{
5252   if (ACCESSING_LSB)
53      K051316_0_w(offset, data & 0xff);
53      K051316_0_w(machine, offset, data & 0xff);
5454}
5555
5656static WRITE16_HANDLER( ultraman_K051316_1_w )
5757{
5858   if (ACCESSING_LSB)
59      K051316_1_w(offset, data & 0xff);
59      K051316_1_w(machine, offset, data & 0xff);
6060}
6161
6262static WRITE16_HANDLER( ultraman_K051316_2_w )
6363{
6464   if (ACCESSING_LSB)
65      K051316_2_w(offset, data & 0xff);
65      K051316_2_w(machine, offset, data & 0xff);
6666}
6767
6868static WRITE16_HANDLER( ultraman_K051316_ctrl_0_w )
6969{
7070   if (ACCESSING_LSB)
71      K051316_ctrl_0_w(offset, data & 0xff);
71      K051316_ctrl_0_w(machine, offset, data & 0xff);
7272}
7373
7474static WRITE16_HANDLER( ultraman_K051316_ctrl_1_w )
7575{
7676   if (ACCESSING_LSB)
77      K051316_ctrl_1_w(offset, data & 0xff);
77      K051316_ctrl_1_w(machine, offset, data & 0xff);
7878
7979}
8080
8181static WRITE16_HANDLER( ultraman_K051316_ctrl_2_w )
8282{
8383   if (ACCESSING_LSB)
84      K051316_ctrl_2_w(offset, data & 0xff);
84      K051316_ctrl_2_w(machine, offset, data & 0xff);
8585}
8686
8787static WRITE16_HANDLER( ultraman_K051937_w )
8888{
8989   if (ACCESSING_LSB)
90      K051937_w(offset, data & 0xff);
90      K051937_w(machine, offset, data & 0xff);
9191}
9292
9393static WRITE16_HANDLER( ultraman_K051960_w )
9494{
9595   if (ACCESSING_LSB)
96      K051960_w(offset, data & 0xff);
96      K051960_w(machine, offset, data & 0xff);
9797}
9898
9999static WRITE16_HANDLER( sound_cmd_w )
100100{
101101   if (ACCESSING_LSB)
102      soundlatch_w(0,data & 0xff);
102      soundlatch_w(machine,0,data & 0xff);
103103}
104104
105105static WRITE16_HANDLER( sound_irq_trigger_w )
r1877r1878
267267   /* basic machine hardware */
268268   MDRV_CPU_ADD(M68000,24000000/2)      /* 12 MHz? */
269269   MDRV_CPU_PROGRAM_MAP(ultraman_readmem,ultraman_writemem)
270   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
270   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
271271
272272   MDRV_CPU_ADD(Z80,24000000/6)
273273   /* audio CPU */      /* 4 MHz? */
src/mame/drivers/parodius.c
r1877r1878
4545   if (videobank & 0x01)
4646   {
4747      if (videobank & 0x04)
48         paletteram_xBBBBBGGGGGRRRRR_be_w(offset + 0x0800,data);
48         paletteram_xBBBBBGGGGGRRRRR_be_w(machine,offset + 0x0800,data);
4949      else
50         paletteram_xBBBBBGGGGGRRRRR_be_w(offset,data);
50         paletteram_xBBBBBGGGGGRRRRR_be_w(machine,offset,data);
5151   }
5252   else
5353      ram[offset] = data;
r1877r1878
5656static READ8_HANDLER( parodius_052109_053245_r )
5757{
5858   if (videobank & 0x02)
59      return K053245_r(offset);
59      return K053245_r(machine,offset);
6060   else
61      return K052109_r(offset);
61      return K052109_r(machine,offset);
6262}
6363
6464static WRITE8_HANDLER( parodius_052109_053245_w )
6565{
6666   if (videobank & 0x02)
67      K053245_w(offset,data);
67      K053245_w(machine,offset,data);
6868   else
69      K052109_w(offset,data);
69      K052109_w(machine,offset,data);
7070}
7171
7272static WRITE8_HANDLER( parodius_videobank_w )
r1877r1878
9595
9696static READ8_HANDLER( parodius_sound_r )
9797{
98   return K053260_0_r(2 + offset);
98   return K053260_0_r(machine,2 + offset);
9999}
100100
101101static WRITE8_HANDLER( parodius_sh_irqtrigger_w )
r1877r1878
299299   /* basic machine hardware */
300300   MDRV_CPU_ADD(KONAMI, 3000000)      /* 053248 */
301301   MDRV_CPU_PROGRAM_MAP(parodius_readmem,parodius_writemem)
302   MDRV_CPU_VBLANK_INT(parodius_interrupt,1)
302   MDRV_CPU_VBLANK_INT("main", parodius_interrupt)
303303
304304   MDRV_CPU_ADD(Z80, 3579545)
305305   /* audio CPU */
src/mame/drivers/ladybug.c
r1877r1878
7676WRITE8_HANDLER( sraider_io_w );
7777WRITE8_HANDLER( sraider_misc_w );
7878
79//extern UINT8 sraider_grid_status;
80//extern UINT8 sraider_0x30, sraider_0x38;
8179
82static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
83   AM_RANGE(0x0000, 0x5fff) AM_READ(MRA8_ROM)
84   AM_RANGE(0x6000, 0x6fff) AM_READ(MRA8_RAM)
80static ADDRESS_MAP_START( ladybug_map, ADDRESS_SPACE_PROGRAM, 8 )
81   AM_RANGE(0x0000, 0x5fff) AM_ROM
82   AM_RANGE(0x6000, 0x6fff) AM_RAM
83   AM_RANGE(0x7000, 0x73ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
8584   AM_RANGE(0x8000, 0x8fff) AM_READ(MRA8_NOP)
86   AM_RANGE(0x9000, 0x9000) AM_READ(input_port_0_r)   /* IN0 */
87   AM_RANGE(0x9001, 0x9001) AM_READ(input_port_1_r)   /* IN1 */
88   AM_RANGE(0x9002, 0x9002) AM_READ(input_port_3_r)   /* DSW0 */
89   AM_RANGE(0x9003, 0x9003) AM_READ(input_port_4_r)   /* DSW1 */
90   AM_RANGE(0xd000, 0xd7ff) AM_READ(MRA8_RAM)   /* video and color RAM */
85   AM_RANGE(0x9000, 0x9000) AM_READ(input_port_0_r)
86   AM_RANGE(0x9001, 0x9001) AM_READ(input_port_1_r)
87   AM_RANGE(0x9002, 0x9002) AM_READ(input_port_3_r)
88   AM_RANGE(0x9003, 0x9003) AM_READ(input_port_4_r)
89   AM_RANGE(0xa000, 0xa000) AM_WRITE(ladybug_flipscreen_w)
90   AM_RANGE(0xb000, 0xbfff) AM_WRITE(SN76496_0_w)
91   AM_RANGE(0xc000, 0xcfff) AM_WRITE(SN76496_1_w)
92   AM_RANGE(0xd000, 0xd3ff) AM_READWRITE(MRA8_RAM, ladybug_videoram_w) AM_BASE(&videoram)
93   AM_RANGE(0xd400, 0xd7ff) AM_READWRITE(MRA8_RAM, ladybug_colorram_w) AM_BASE(&colorram)
9194   AM_RANGE(0xe000, 0xe000) AM_READ(input_port_2_r)   /* IN2 */
9295ADDRESS_MAP_END
9396
94static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
95   AM_RANGE(0x0000, 0x5fff) AM_WRITE(MWA8_ROM)
96   AM_RANGE(0x6000, 0x6fff) AM_WRITE(MWA8_RAM)
97
98static ADDRESS_MAP_START( sraider_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
99   AM_RANGE(0x0000, 0x5fff) AM_ROM
100   AM_RANGE(0x6000, 0x6fff) AM_RAM
97101   AM_RANGE(0x7000, 0x73ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
98   AM_RANGE(0xa000, 0xa000) AM_WRITE(ladybug_flipscreen_w)
99   AM_RANGE(0xb000, 0xbfff) AM_WRITE(SN76496_0_w)
100   AM_RANGE(0xc000, 0xcfff) AM_WRITE(SN76496_1_w)
102   AM_RANGE(0x8005, 0x8005) AM_READ(sraider_8005_r)  // protection check?
103   AM_RANGE(0x8006, 0x8006) AM_WRITE(sraider_sound_low_w)
104   AM_RANGE(0x8007, 0x8007) AM_WRITE(sraider_sound_high_w)
105   AM_RANGE(0x9000, 0x9000) AM_READ(input_port_0_r)
106   AM_RANGE(0x9001, 0x9001) AM_READ(input_port_1_r)
107   AM_RANGE(0x9002, 0x9002) AM_READ(input_port_2_r)
108   AM_RANGE(0x9003, 0x9003) AM_READ(input_port_3_r)
101109   AM_RANGE(0xd000, 0xd3ff) AM_WRITE(ladybug_videoram_w) AM_BASE(&videoram)
102110   AM_RANGE(0xd400, 0xd7ff) AM_WRITE(ladybug_colorram_w) AM_BASE(&colorram)
111   AM_RANGE(0xe000, 0xe000) AM_WRITE(MWA8_NOP)  //unknown 0x10 when in attract, 0x20 when coined/playing
103112ADDRESS_MAP_END
104113
105/***************************************************************************
106114
107  Lady Bug doesn't have VBlank interrupts.
108  Interrupts are still used by the game: but they are related to coin
109  slots. Left slot generates a NMI, Right slot an IRQ.
115static ADDRESS_MAP_START( sraider_cpu2_map, ADDRESS_SPACE_PROGRAM, 8 )
116   AM_RANGE(0x0000, 0x5fff) AM_ROM
117   AM_RANGE(0x6000, 0x63ff) AM_RAM
118   AM_RANGE(0x8000, 0x8000) AM_READ(sraider_sound_low_r)
119   AM_RANGE(0xa000, 0xa000) AM_READ(sraider_sound_high_r)
120   AM_RANGE(0xc000, 0xc000) AM_READ(MRA8_NOP) //some kind of sync
121   AM_RANGE(0xe000, 0xe0ff) AM_WRITE(MWA8_RAM) AM_BASE(&sraider_grid_data)
122   AM_RANGE(0xe800, 0xe800) AM_WRITE(sraider_io_w)
123ADDRESS_MAP_END
110124
111***************************************************************************/
112static INTERRUPT_GEN( ladybug_interrupt )
125
126static ADDRESS_MAP_START( sraider_cpu2_io_map, ADDRESS_SPACE_IO, 8 )
127     ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
128   AM_RANGE(0x00, 0x00) AM_WRITE(SN76496_0_w)
129   AM_RANGE(0x08, 0x08) AM_WRITE(SN76496_1_w)
130   AM_RANGE(0x10, 0x10) AM_WRITE(SN76496_2_w)
131   AM_RANGE(0x18, 0x18) AM_WRITE(SN76496_3_w)
132   AM_RANGE(0x20, 0x20) AM_WRITE(SN76496_4_w)
133   AM_RANGE(0x28, 0x3f) AM_WRITE(sraider_misc_w)  // lots unknown
134ADDRESS_MAP_END
135
136
137
138static INPUT_CHANGED( coin1_inserted )
113139{
114   if (readinputport(5) & 1)   /* Left Coin */
115      cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
116   else if (readinputport(5) & 2)   /* Right Coin */
140   /* left coin insertion causes an NMI */
141   cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, newval ? ASSERT_LINE : CLEAR_LINE);
142}
143
144static INPUT_CHANGED( coin2_inserted )
145{
146   /* right coin insertion causes an IRQ */
147   if (newval)
117148      cpunum_set_input_line(machine, 0, 0, HOLD_LINE);
118149}
119150
r1877r1878
213244   PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
214245   /* settings 0x00 thru 0x50 all give 1 Coin/1 Credit */
215246
216   PORT_START_TAG("FAKE")   /* FAKE */
217   /* The coin slots are not memory mapped. Coin Left causes a NMI, */
218   /* Coin Right an IRQ. This fake input port is used by the interrupt */
219   /* handler to be notified of coin insertions. We use IMPULSE to */
220   /* trigger exactly one interrupt, without having to check when the */
221   /* user releases the key. */
222   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
223   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1)
247   PORT_START_TAG("COIN")   /* FAKE */
248   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(coin1_inserted, 0)
249   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_CHANGED(coin2_inserted, 0)
224250
225251   PORT_START_TAG(LADYBUG_P1_CONTROL_PORT_TAG)
226252   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY
r1877r1878
320346   PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
321347   /* settings 0x00 thru 0x04 all give 1 Coin/1 Credit */
322348
323   PORT_START_TAG("FAKE")
324   /* The coin slots are not memory mapped. Coin Left causes a NMI, */
325   /* Coin Right an IRQ. This fake input port is used by the interrupt */
326   /* handler to be notified of coin insertions. We use IMPULSE to */
327   /* trigger exactly one interrupt, without having to check when the */
328   /* user releases the key. */
329   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
330   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1)
349   PORT_START_TAG("COIN")   /* FAKE */
350   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(coin1_inserted, 0)
351   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_CHANGED(coin2_inserted, 0)
331352INPUT_PORTS_END
332353
333354static INPUT_PORTS_START( cavenger )
r1877r1878
409430   PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
410431   /* settings 0x00 thru 0x50 all give 1 Coin/1 Credit */
411432
412   PORT_START_TAG("FAKE")
413   /* The coin slots are not memory mapped. Coin Left causes a NMI, */
414   /* Coin Right an IRQ. This fake input port is used by the interrupt */
415   /* handler to be notified of coin insertions. We use IMPULSE to */
416   /* trigger exactly one interrupt, without having to check when the */
417   /* user releases the key. */
418   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
419   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1)
433   PORT_START_TAG("COIN")   /* FAKE */
434   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(coin1_inserted, 0)
435   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_CHANGED(coin2_inserted, 0)
420436INPUT_PORTS_END
421437
422438static INPUT_PORTS_START( dorodon )
r1877r1878
500516   PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
501517   /* settings 0x00 thru 0x50 all give 1 Coin/1 Credit */
502518
503   PORT_START_TAG("FAKE")
504   /* The coin slots are not memory mapped. Coin Left causes a NMI, */
505   /* Coin Right an IRQ. This fake input port is used by the interrupt */
506   /* handler to be notified of coin insertions. We use IMPULSE to */
507   /* trigger exactly one interrupt, without having to check when the */
508   /* user releases the key. */
509   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
510   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1)
519   PORT_START_TAG("COIN")   /* FAKE */
520   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(coin1_inserted, 0)
521   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_CHANGED(coin2_inserted, 0)
511522INPUT_PORTS_END
512523
513524static INPUT_PORTS_START( sraider )
r1877r1878
659670
660671   /* basic machine hardware */
661672   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz */
662   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
663   MDRV_CPU_VBLANK_INT(ladybug_interrupt,1)
673   MDRV_CPU_PROGRAM_MAP(ladybug_map,0)
664674
665675   /* video hardware */
666676   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
688698MACHINE_DRIVER_END
689699
690700
691static ADDRESS_MAP_START( sraider_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
692   AM_RANGE(0x0000, 0x5fff) AM_ROM
693   AM_RANGE(0x6000, 0x6fff) AM_RAM
694   AM_RANGE(0x7000, 0x73ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
695   AM_RANGE(0x8005, 0x8005) AM_READ(sraider_8005_r)  // protection check?
696   AM_RANGE(0x8006, 0x8006) AM_WRITE(sraider_sound_low_w)
697   AM_RANGE(0x8007, 0x8007) AM_WRITE(sraider_sound_high_w)
698   AM_RANGE(0x9000, 0x9000) AM_READ(input_port_0_r)   /* IN0 */
699   AM_RANGE(0x9001, 0x9001) AM_READ(input_port_1_r)   /* IN1 */
700   AM_RANGE(0x9002, 0x9002) AM_READ(input_port_2_r)   /* DSW0 */
701   AM_RANGE(0x9003, 0x9003) AM_READ(input_port_3_r)   /* DSW1 */
702   AM_RANGE(0xd000, 0xd3ff) AM_WRITE(ladybug_videoram_w) AM_BASE(&videoram)
703   AM_RANGE(0xd400, 0xd7ff) AM_WRITE(ladybug_colorram_w) AM_BASE(&colorram)
704   AM_RANGE(0xe000, 0xe000) AM_WRITE(MWA8_NOP)  //unknown
705      // 0x10 when in attract, 0x20 when coined/playing
706ADDRESS_MAP_END
707
708static ADDRESS_MAP_START( sraider_cpu2_map, ADDRESS_SPACE_PROGRAM, 8 )
709   AM_RANGE(0x0000, 0x5fff) AM_ROM
710   AM_RANGE(0x6000, 0x63ff) AM_RAM
711   AM_RANGE(0x8000, 0x8000) AM_READ(sraider_sound_low_r)
712   AM_RANGE(0xa000, 0xa000) AM_READ(sraider_sound_high_r)
713   AM_RANGE(0xc000, 0xc000) AM_READ(MRA8_NOP) //some kind of sync
714   AM_RANGE(0xe000, 0xe0ff) AM_WRITE(MWA8_RAM) AM_BASE(&sraider_grid_data)
715   AM_RANGE(0xe800, 0xe800) AM_WRITE(sraider_io_w)
716ADDRESS_MAP_END
717
718static ADDRESS_MAP_START( sraider_cpu2_io, ADDRESS_SPACE_IO, 8 )
719     ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
720   AM_RANGE(0x00, 0x00) AM_WRITE(SN76496_0_w)
721   AM_RANGE(0x08, 0x08) AM_WRITE(SN76496_1_w)
722   AM_RANGE(0x10, 0x10) AM_WRITE(SN76496_2_w)
723   AM_RANGE(0x18, 0x18) AM_WRITE(SN76496_3_w)
724   AM_RANGE(0x20, 0x20) AM_WRITE(SN76496_4_w)
725   AM_RANGE(0x28, 0x3f) AM_WRITE(sraider_misc_w)  // lots unknown
726ADDRESS_MAP_END
727
728
729701static MACHINE_DRIVER_START( sraider )
730702
731703   /* basic machine hardware */
732704   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz */
733705   MDRV_CPU_PROGRAM_MAP(sraider_cpu1_map,0)
734   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
706   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
735707
736708   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz */
737709   MDRV_CPU_PROGRAM_MAP(sraider_cpu2_map,0)
738   MDRV_CPU_IO_MAP(sraider_cpu2_io,0)
739   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
710   MDRV_CPU_IO_MAP(sraider_cpu2_io_map,0)
711   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
740712
741713   /* video hardware */
742714   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
896868ROM_END
897869
898870ROM_START( dorodon )
899   ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* 64K for data, 64K for encrypted opcodes */
871   ROM_REGION( 0x10000, REGION_CPU1, 0 )
900872   ROM_LOAD( "dorodon.0",   0x0000, 0x2000, CRC(460aaf26) SHA1(c4ea41cba4ac2d93fedec3c117a4470fee2a910f) )
901873   ROM_LOAD( "dorodon.1",   0x2000, 0x2000, CRC(d2451eb6) SHA1(4154bfe50b7f75444d3f0c9be6bd2475fdba1938) )
902874   ROM_LOAD( "dorodon.2",   0x4000, 0x2000, CRC(d3c6ee6c) SHA1(6971ecdc968810c19f8601efc3d389450156bb22) )
903875
904   /* Characters */
905876   ROM_REGION( 0x2000, REGION_GFX1, ROMREGION_DISPOSE )
906877   ROM_LOAD( "dorodon.5",   0x0000, 0x1000, CRC(5eee2b85) SHA1(55ac9566e805d103b6916f51c764e2601cc1f715) )
907878   ROM_LOAD( "dorodon.6",   0x1000, 0x1000, CRC(395ac25a) SHA1(d8a55e42b8c5d957c2e6a3181d7ac10c6a448f46) )
908879
909   /* Sprites */
910880   ROM_REGION( 0x2000, REGION_GFX2, ROMREGION_DISPOSE )
911881   ROM_LOAD( "dorodon.4",   0x0000, 0x1000, CRC(d70bb50a) SHA1(b9d46862f288c49bb8b660da87b63bd4ecb36379) )
912882   ROM_LOAD( "dorodon.3",   0x1000, 0x1000, CRC(e44e59e6) SHA1(ff730152804d75ddb9fb19e8ec33cc764d8a50e8) )
913883
914   /* Opcode Decryption PROMS */
915884   ROM_REGION( 0x0100, REGION_USER1, ROMREGION_DISPOSE )
916   ROM_LOAD_NIB_HIGH( "dorodon.bp4",0x0000,0x0100,CRC(f865c135) SHA1(1202f83bfa50afa5a5d24401efa8bf058e7e30b5) )
917   ROM_LOAD_NIB_LOW(  "dorodon.bp3",0x0000,0x0100,CRC(47b2f0bb) SHA1(640720aa5c1119080c6da928f6d1b0e76b989742) )
885   ROM_LOAD_NIB_HIGH( "dorodon.bp4", 0x0000, 0x0100, CRC(f865c135) SHA1(1202f83bfa50afa5a5d24401efa8bf058e7e30b5) )
886   ROM_LOAD_NIB_LOW(  "dorodon.bp3", 0x0000, 0x0100, CRC(47b2f0bb) SHA1(640720aa5c1119080c6da928f6d1b0e76b989742) )
918887
919888   ROM_REGION( 0x0060, REGION_PROMS, 0 )
920889   ROM_LOAD( "dorodon.bp0", 0x0000, 0x0020, CRC(8fcf0bc8) SHA1(392d22731b3e4bc663d6e4385f6069ee2b4ee029) ) /* palette */
r1877r1878
923892ROM_END
924893
925894ROM_START( dorodon2 )
926   ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* 64K for data, 64K for encrypted opcodes */
895   ROM_REGION( 0x10000, REGION_CPU1, 0 )
927896   ROM_LOAD( "1.3fg",        0x0000, 0x2000, CRC(4d05d6f8) SHA1(db12ad04295f0ce112b6e90fde94a53ed1d6c3b9) )
928897   ROM_LOAD( "2.3h",         0x2000, 0x2000, CRC(27b43b09) SHA1(12a8a6b8665bb9d1967ec631a794aab564a50570) )
929898   ROM_LOAD( "3.3k",         0x4000, 0x2000, CRC(38d2f295) SHA1(b4d2cfd6e9f03c3ef18dcf67326f4106749b62b1) )
930899
931   /* Characters */
932900   ROM_REGION( 0x2000, REGION_GFX1, ROMREGION_DISPOSE )
933901   ROM_LOAD( "6.6a",        0x0000, 0x1000, CRC(2a2d8b9c) SHA1(ba3ce8ed6cafa711bf4c6ed260dd15b38adbd6cc) )
934902   ROM_LOAD( "7.6bc",       0x1000, 0x1000, CRC(d14f95fa) SHA1(e9ba87602d779d833b8152c077c692e67ef696cc) )
935903
936   /* Sprites */
937904   ROM_REGION( 0x2000, REGION_GFX2, ROMREGION_DISPOSE )
938905   ROM_LOAD( "5.3t",        0x0000, 0x1000, CRC(54c04f58) SHA1(342ef914e6f8bf37472d146bb5e9fb67056d7fc5) )
939906   ROM_LOAD( "4.3r",        0x1000, 0x1000, CRC(1ebb6493) SHA1(30367d7594118e0fa8620e5d20c66a650ca82c86) )
940907
941   /* Opcode Decryption PROMS (from other romset) */
942908   ROM_REGION( 0x0100, REGION_USER1, ROMREGION_DISPOSE )
943   ROM_LOAD_NIB_HIGH( "dorodon.bp4",0x0000,0x0100,CRC(f865c135) SHA1(1202f83bfa50afa5a5d24401efa8bf058e7e30b5) )
944   ROM_LOAD_NIB_LOW(  "dorodon.bp3",0x0000,0x0100,CRC(47b2f0bb) SHA1(640720aa5c1119080c6da928f6d1b0e76b989742) )
909   ROM_LOAD_NIB_HIGH( "dorodon.bp4", 0x0000, 0x0100, CRC(f865c135) SHA1(1202f83bfa50afa5a5d24401efa8bf058e7e30b5) )
910   ROM_LOAD_NIB_LOW(  "dorodon.bp3", 0x0000, 0x0100, CRC(47b2f0bb) SHA1(640720aa5c1119080c6da928f6d1b0e76b989742) )
945911
946912   /* (from other romset - I think these are correct, they match the Starcade video) */
947913   ROM_REGION( 0x0060, REGION_PROMS, 0 )
r1877r1878
981947
982948static DRIVER_INIT( dorodon )
983949{
984   /* Decode the opcodes */
950   /* decode the opcodes */
985951
986952   offs_t i;
987953   UINT8 *decrypted = auto_malloc(0x6000);
r1877r1878
990956
991957   memory_set_decrypted_region(0, 0x0000, 0x5fff, decrypted);
992958
993   for (i = 0;i < 0x6000;i++)
994   {
959   for (i = 0; i < 0x6000; i++)
995960      decrypted[i] = table[rom[i]];
996   }
997961}
998962
999static DRIVER_INIT( sraider )
1000{
1001}
1002963
1003964GAME( 1981, cavenger, 0,       ladybug, cavenger, 0,       ROT0,   "Universal", "Cosmic Avenger", 0 )
1004965GAME( 1981, ladybug,  0,       ladybug, ladybug,  0,       ROT270, "Universal", "Lady Bug", 0 )
r1877r1878
1007968GAME( 1982, dorodon,  0,       ladybug, dorodon,  dorodon, ROT270, "Falcon",    "Dorodon (set 1)", 0 )
1008969GAME( 1982, dorodon2, dorodon, ladybug, dorodon,  dorodon, ROT270, "Falcon",    "Dorodon (set 2)", 0 )
1009970GAME( 1982, snapjack, 0,       ladybug, snapjack, 0,       ROT0,   "Universal", "Snap Jack", 0 )
1010GAME( 1982, sraider,  0,       sraider, sraider,  sraider, ROT270, "Universal", "Space Raider", 0 )
971GAME( 1982, sraider,  0,       sraider, sraider,  0,      ROT270, "Universal", "Space Raider", 0 )
src/mame/drivers/quantum.c
r1877r1878
120120static WRITE16_HANDLER( pokey_word_w )
121121{
122122   if (offset & 0x10) /* A5 selects chip */
123      pokey2_w(offset & 0x0f, data);
123      pokey2_w(machine, offset & 0x0f, data);
124124   else
125      pokey1_w(offset & 0x0f, data);
125      pokey1_w(machine, offset & 0x0f, data);
126126}
127127
128128
129129static READ16_HANDLER( pokey_word_r )
130130{
131131   if (offset & 0x10)
132      return pokey2_r(offset & 0x0f);
132      return pokey2_r(machine, offset & 0x0f);
133133   else
134      return pokey1_r(offset & 0x0f);
134      return pokey1_r(machine, offset & 0x0f);
135135}
136136
137137
src/mame/drivers/blueprnt.c
r1877r1878
8181
8282static WRITE8_HANDLER( blueprnt_sound_command_w )
8383{
84   soundlatch_w(offset, data);
85   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
84   soundlatch_w(machine, offset, data);
85   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
8686}
8787
8888static WRITE8_HANDLER( blueprnt_coin_counter_w )
r1877r1878
297297   // basic machine hardware
298298   MDRV_CPU_ADD(Z80, 7000000/2)   // 3.5 MHz
299299   MDRV_CPU_PROGRAM_MAP(blueprnt_map, 0)
300   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
300   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
301301
302302   MDRV_CPU_ADD(Z80, 10000000/2/2/2)   // 1.25 MHz (2H)
303303   MDRV_CPU_PROGRAM_MAP(sound_map, 0)
304   MDRV_CPU_VBLANK_INT(irq0_line_hold, 4)   // IRQs connected to 32V
304   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold, 4)   // IRQs connected to 32V
305305                                 // NMIs are caused by the main CPU
306306   // video hardware
307307
src/mame/drivers/combatsc.c
r1877r1878
237237static READ8_HANDLER ( combasc_YM2203_status_port_0_r )
238238{
239239   static int boost = 1;
240   int status = YM2203_status_port_0_r(0);
240   int status = YM2203_status_port_0_r(machine,0);
241241
242242   if (activecpu_get_pc() == 0x334)
243243   {
r1877r1878
662662   /* basic machine hardware */
663663   MDRV_CPU_ADD(HD6309, 3000000*4)   /* 3 MHz? */
664664   MDRV_CPU_PROGRAM_MAP(combasc_readmem,combasc_writemem)
665   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
665   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
666666
667667   MDRV_CPU_ADD(Z80,3579545)   /* 3.579545 MHz */
668668   /* audio CPU */
r1877r1878
705705   /* basic machine hardware */
706706   MDRV_CPU_ADD(HD6309, 3000000*4)   /* 3 MHz? */
707707   MDRV_CPU_PROGRAM_MAP(combascb_readmem,combascb_writemem)
708   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
708   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
709709
710710   MDRV_CPU_ADD(Z80,3579545)   /* 3.579545 MHz */
711711   /* audio CPU */
src/mame/drivers/rockrage.c
r1877r1878
8787
8888static WRITE8_HANDLER( rockrage_sh_irqtrigger_w )
8989{
90   soundlatch_w(offset, data);
91   cpunum_set_input_line(Machine, 1,M6809_IRQ_LINE,HOLD_LINE);
90   soundlatch_w(machine, offset, data);
91   cpunum_set_input_line(machine, 1,M6809_IRQ_LINE,HOLD_LINE);
9292}
9393
9494static READ8_HANDLER( rockrage_VLM5030_busy_r ) {
r1877r1878
295295   /* basic machine hardware */
296296   MDRV_CPU_ADD(HD6309, 3000000*4)      /* 24MHz/8 */
297297   MDRV_CPU_PROGRAM_MAP(rockrage_readmem,rockrage_writemem)
298   MDRV_CPU_VBLANK_INT(rockrage_interrupt,1)
298   MDRV_CPU_VBLANK_INT("main", rockrage_interrupt)
299299
300300   MDRV_CPU_ADD(M6809, 1500000)      /* 24MHz/16 */
301301   /* audio CPU */
src/mame/drivers/ttchamp.c
r1877r1878
227227   MDRV_CPU_ADD(V30, 8000000)
228228   MDRV_CPU_PROGRAM_MAP(ttchamp_map, 0)
229229   MDRV_CPU_IO_MAP(ttchamp_io,0)
230   MDRV_CPU_VBLANK_INT(ttchamp_irq,1)
230   MDRV_CPU_VBLANK_INT("main", ttchamp_irq)
231231
232232   /* video hardware */
233233   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/egghunt.c
r1877r1878
5454static UINT8 egghunt_okibanking;
5555static UINT8 egghunt_gfx_banking;
5656
57static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
57static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
5858{
5959   int flipscreen = 0;
6060   int offs,sx,sy;
r1877r1878
173173
174174static WRITE8_HANDLER( egghunt_soundlatch_w )
175175{
176   soundlatch_w(0,data);
177   cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
176   soundlatch_w(machine,0,data);
177   cpunum_set_input_line(machine, 1,0,HOLD_LINE);
178178}
179179
180180static READ8_HANDLER( egghunt_okibanking_r )
r1877r1878
389389   MDRV_CPU_ADD(Z80,12000000/2)       /* 6 MHz ?*/
390390   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
391391   MDRV_CPU_IO_MAP(readport,writeport)
392   MDRV_CPU_VBLANK_INT(irq0_line_hold,1) // or 2 like mitchell.c?
392   MDRV_CPU_VBLANK_INT("main", irq0_line_hold) // or 2 like mitchell.c?
393393
394394   MDRV_CPU_ADD(Z80,12000000/2)       /* 6 MHz ?*/
395395   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
src/mame/drivers/buggychl.c
r1877r1878
133133
134134static WRITE8_HANDLER( sound_command_w )
135135{
136   soundlatch_w(0,data);
136   soundlatch_w(machine,0,data);
137137   timer_call_after_resynch(NULL, data,nmi_callback);
138138}
139139
r1877r1878
432432   /* basic machine hardware */
433433   MDRV_CPU_ADD(Z80, 4000000) /* 4 MHz??? */
434434   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
435   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
435   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
436436
437437   MDRV_CPU_ADD(Z80, 4000000)
438438   /* audio CPU */ /* 4 MHz??? */
439439   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
440   MDRV_CPU_VBLANK_INT(irq0_line_hold,60)   /* irq is timed, tied to the cpu clock and not to vblank */
440   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,60)   /* irq is timed, tied to the cpu clock and not to vblank */
441441                     /* nmi is caused by the main cpu */
442442
443443   MDRV_CPU_ADD(M68705,8000000/2)  /* 4 MHz */
src/mame/drivers/segac2.c
r1877r1878
180180{
181181   switch (offset)
182182   {
183      case 0: return YM3438_status_port_0_A_r(0);
184      case 1: return YM3438_read_port_0_r(0);
185      case 2: return YM3438_status_port_0_B_r(0);
183      case 0: return YM3438_status_port_0_A_r(machine, 0);
184      case 1: return YM3438_read_port_0_r(machine, 0);
185      case 2: return YM3438_status_port_0_B_r(machine, 0);
186186   }
187187   return 0xff;
188188}
r1877r1878
205205
206206      switch (offset)
207207      {
208         case 0: YM3438_control_port_0_A_w(0, data & 0xff);   last_port = data;   break;
209         case 1: YM3438_data_port_0_A_w(0, data & 0xff);                     break;
210         case 2: YM3438_control_port_0_B_w(0, data & 0xff);   last_port = data;   break;
211         case 3: YM3438_data_port_0_B_w(0, data & 0xff);                     break;
208         case 0: YM3438_control_port_0_A_w(machine, 0, data & 0xff);   last_port = data;   break;
209         case 1: YM3438_data_port_0_A_w(machine, 0, data & 0xff);                     break;
210         case 2: YM3438_control_port_0_B_w(machine, 0, data & 0xff);   last_port = data;   break;
211         case 3: YM3438_data_port_0_B_w(machine, 0, data & 0xff);                     break;
212212      }
213213   }
214214}
r1877r1878
372372
373373         /* otherwise, return an input port */
374374         if (offset == 0x04/2 && sound_banks)
375            return (readinputport(offset) & 0xbf) | (upd7759_0_busy_r(0) << 6);
375            return (readinputport(offset) & 0xbf) | (upd7759_0_busy_r(machine,0) << 6);
376376         return readinputport(offset);
377377
378378      /* 'SEGA' protection */
r1877r1878
13651365   /* basic machine hardware */
13661366   MDRV_CPU_ADD_TAG("main", M68000, XL2_CLOCK/6)
13671367   MDRV_CPU_PROGRAM_MAP(main_map,0)
1368   MDRV_CPU_VBLANK_INT(genesis_vblank_interrupt,1)
1368   MDRV_CPU_VBLANK_INT("main", genesis_vblank_interrupt)
13691369
13701370   MDRV_MACHINE_START(segac2)
13711371   MDRV_MACHINE_RESET(segac2)
src/mame/drivers/gotcha.c
r1877r1878
277277   /* basic machine hardware */
278278   MDRV_CPU_ADD(M68000,14318180)   /* 14.31818 MHz */
279279   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
280   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
280   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
281281
282282   MDRV_CPU_ADD(Z80,6000000)   /* 6 MHz */
283283   /* audio CPU */
284284   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
285//  MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
285//  MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
286286
287287   /* video hardware */
288288   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/starshp1.c
r1877r1878
302302
303303   MDRV_CPU_ADD(M6502, STARSHP1_CPU_CLOCK)
304304   MDRV_CPU_PROGRAM_MAP(readmem, writemem)
305   MDRV_CPU_VBLANK_INT(starshp1_interrupt, 1)
305   MDRV_CPU_VBLANK_INT("main", starshp1_interrupt)
306306
307307   /* video hardware */
308308
src/mame/drivers/bigstrkb.c
r1877r1878
224224static MACHINE_DRIVER_START( bigstrkb )
225225   MDRV_CPU_ADD(M68000, 12000000)
226226   MDRV_CPU_PROGRAM_MAP(bigstrkb_readmem,bigstrkb_writemem)
227   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
227   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
228228
229229   MDRV_GFXDECODE(bigstrkb)
230230
src/mame/drivers/pandoras.c
r1877r1878
6262               break;
6363      case 0x03:   coin_counter_w(1,data & 0x01);
6464               break;
65      case 0x05:   pandoras_flipscreen_w(0, data);
65      case 0x05:   pandoras_flipscreen_w(machine, 0, data);
6666               break;
6767      case 0x06:   if (!data) cpunum_set_input_line(Machine, 1, M6809_IRQ_LINE, CLEAR_LINE);
6868               irq_enable_b = data;
r1877r1878
379379   /* basic machine hardware */
380380   MDRV_CPU_ADD(M6809,18432000/6)   /* CPU A */
381381   MDRV_CPU_PROGRAM_MAP(pandoras_readmem_a,pandoras_writemem_a)
382   MDRV_CPU_VBLANK_INT(pandoras_interrupt_a,1)
382   MDRV_CPU_VBLANK_INT("main", pandoras_interrupt_a)
383383
384384   MDRV_CPU_ADD(M6809,18432000/6)   /* CPU B */
385385   MDRV_CPU_PROGRAM_MAP(pandoras_readmem_b,pandoras_writemem_b)
386   MDRV_CPU_VBLANK_INT(pandoras_interrupt_b,1)
386   MDRV_CPU_VBLANK_INT("main", pandoras_interrupt_b)
387387
388388   MDRV_CPU_ADD(Z80,14318000/8)
389389   /* audio CPU */
src/mame/drivers/taito_f2.c
r1877r1878
310310
311311static WRITE16_HANDLER( taitof2_watchdog_w )
312312{
313   watchdog_reset_w(0,data);
313   watchdog_reset(machine);
314314}
315315
316316static WRITE16_HANDLER( growl_coin_word_w )   /* what about coins 3&4 ?? */
r1877r1878
359359    switch (offset)
360360    {
361361         case 0x00:
362              return input_port_3_word_r(0,mem_mask); /* DSW A */
362              return input_port_3_word_r(machine,0,mem_mask); /* DSW A */
363363
364364         case 0x01:
365              return input_port_4_word_r(0,mem_mask); /* DSW B */
365              return input_port_4_word_r(machine,0,mem_mask); /* DSW B */
366366    }
367367
368368logerror("CPU #0 PC %06x: warning - read unmapped dsw_r offset %06x\n",activecpu_get_pc(),offset);
r1877r1878
375375    switch (offset)
376376    {
377377         case 0x00:
378              return input_port_0_word_r(0,mem_mask); /* IN0 */
378              return input_port_0_word_r(machine,0,mem_mask); /* IN0 */
379379
380380         case 0x01:
381              return input_port_1_word_r(0,mem_mask); /* IN1 */
381              return input_port_1_word_r(machine,0,mem_mask); /* IN1 */
382382
383383         case 0x02:
384              return input_port_2_word_r(0,mem_mask); /* IN2 */
384              return input_port_2_word_r(machine,0,mem_mask); /* IN2 */
385385
386386    }
387387
r1877r1878
395395   switch (offset)
396396   {
397397      case 0x00:
398         return input_port_3_word_r(0,mem_mask); /* DSW A */
398         return input_port_3_word_r(machine,0,mem_mask); /* DSW A */
399399
400400      case 0x01:
401         return input_port_4_word_r(0,mem_mask); /* DSW B */
401         return input_port_4_word_r(machine,0,mem_mask); /* DSW B */
402402
403403      case 0x02:
404         return input_port_2_word_r(0,mem_mask); /* IN2 */
404         return input_port_2_word_r(machine,0,mem_mask); /* IN2 */
405405
406406//      case 0x03:
407407//          return (coin_word & ~mem_mask);
408408
409409      case 0x05:
410         return input_port_0_word_r(0,mem_mask); /* IN0 */
410         return input_port_0_word_r(machine,0,mem_mask); /* IN0 */
411411
412412      case 0x06:
413         return input_port_1_word_r(0,mem_mask); /* IN1 */
413         return input_port_1_word_r(machine,0,mem_mask); /* IN1 */
414414
415415      case 0x07:
416         return input_port_5_word_r(0,mem_mask); /* IN3 */
416         return input_port_5_word_r(machine,0,mem_mask); /* IN3 */
417417
418418      case 0x08:
419         return input_port_6_word_r(0,mem_mask); /* IN4 */
419         return input_port_6_word_r(machine,0,mem_mask); /* IN4 */
420420    }
421421
422422logerror("CPU #0 PC %06x: warning - read unmapped input offset %06x\n",activecpu_get_pc(),offset);
r1877r1878
429429   switch (offset)
430430   {
431431      case 0x00:
432         return (input_port_3_word_r(0,0) << 8); /* DSW A */
432         return (input_port_3_word_r(machine,0,0) << 8); /* DSW A */
433433
434434      case 0x01:
435         return (input_port_4_word_r(0,0) << 8); /* DSW B */
435         return (input_port_4_word_r(machine,0,0) << 8); /* DSW B */
436436
437437      case 0x02:
438         return (input_port_0_word_r(0,0) << 8); /* IN 0 */
438         return (input_port_0_word_r(machine,0,0) << 8); /* IN 0 */
439439
440440      case 0x03:
441         return (input_port_1_word_r(0,0) << 8); /* IN 1 */
441         return (input_port_1_word_r(machine,0,0) << 8); /* IN 1 */
442442
443443      case 0x04:
444         return (input_port_5_word_r(0,0) << 8); /* IN 3 */
444         return (input_port_5_word_r(machine,0,0) << 8); /* IN 3 */
445445
446446      case 0x05:
447         return (input_port_6_word_r(0,0) << 8); /* IN 4 */
447         return (input_port_6_word_r(machine,0,0) << 8); /* IN 4 */
448448
449449      case 0x06:
450         return (input_port_2_word_r(0,0) << 8); /* IN 2 */
450         return (input_port_2_word_r(machine,0,0) << 8); /* IN 2 */
451451
452452//      case 0x07:
453453//          return (coin_word & ~mem_mask);
r1877r1878
466466   switch (offset)
467467   {
468468      case 0x00:
469         curr = input_port_5_word_r(0,0); /* Paddle A */
469         curr = input_port_5_word_r(machine,0,0); /* Paddle A */
470470         res = curr - last[0];
471471         last[0] = curr;
472472         return res;
473473
474474      case 0x02:
475         curr = input_port_6_word_r(0,0); /* Paddle B */
475         curr = input_port_6_word_r(machine,0,0); /* Paddle B */
476476         res = curr - last[1];
477477         last[1] = curr;
478478         return res;
r1877r1878
488488    switch (offset)
489489    {
490490         case 0x00:
491              return input_port_5_word_r(0,mem_mask); /* Paddle A */
491              return input_port_5_word_r(machine,0,mem_mask); /* Paddle A */
492492
493493         case 0x01:
494              return input_port_6_word_r(0,mem_mask); /* Paddle B */
494              return input_port_6_word_r(machine,0,mem_mask); /* Paddle B */
495495    }
496496
497497logerror("CPU #0 PC %06x: warning - read unmapped paddle offset %06x\n",activecpu_get_pc(),offset);
r1877r1878
504504   switch (offset)
505505   {
506506      case 0x00:
507         return input_port_3_word_r(0,mem_mask); /* DSW A */
507         return input_port_3_word_r(machine,0,mem_mask); /* DSW A */
508508
509509      case 0x01:
510         return input_port_4_word_r(0,mem_mask); /* DSW B */
510         return input_port_4_word_r(machine,0,mem_mask); /* DSW B */
511511
512512      case 0x02:
513         return input_port_2_word_r(0,mem_mask); /* IN2 */
513         return input_port_2_word_r(machine,0,mem_mask); /* IN2 */
514514
515515//      case 0x03:
516516//          return (coin_word & ~mem_mask);
517517
518518      case 0x05:
519         return input_port_0_word_r(0,mem_mask); /* IN0 */
519         return input_port_0_word_r(machine,0,mem_mask); /* IN0 */
520520
521521      case 0x06:
522         return input_port_1_word_r(0,mem_mask); /* IN1 */
522         return input_port_1_word_r(machine,0,mem_mask); /* IN1 */
523523    }
524524
525525logerror("CPU #0 PC %06x: warning - read unmapped input offset %06x\n",activecpu_get_pc(),offset);
r1877r1878
533533    {
534534        case 0x00:
535535        {
536         return (input_port_5_word_r(0,0) << 8) + input_port_7_word_r(0,0); /* DSW A + coin */
536         return (input_port_5_word_r(machine,0,0) << 8) + input_port_7_word_r(machine,0,0); /* DSW A + coin */
537537        }
538538
539539        case 0x01:
540540        {
541         return (input_port_6_word_r(0,0) << 8) + input_port_8_word_r(0,0); /* DSW B + coin */
541         return (input_port_6_word_r(machine,0,0) << 8) + input_port_8_word_r(machine,0,0); /* DSW B + coin */
542542        }
543543    }
544544
r1877r1878
552552    switch (mjnquest_input)
553553    {
554554         case 0x01:
555              return input_port_0_word_r(0,mem_mask); /* IN0 */
555              return input_port_0_word_r(machine,0,mem_mask); /* IN0 */
556556
557557         case 0x02:
558              return input_port_1_word_r(0,mem_mask); /* IN1 */
558              return input_port_1_word_r(machine,0,mem_mask); /* IN1 */
559559
560560         case 0x04:
561              return input_port_2_word_r(0,mem_mask); /* IN2 */
561              return input_port_2_word_r(machine,0,mem_mask); /* IN2 */
562562
563563         case 0x08:
564              return input_port_3_word_r(0,mem_mask); /* IN3 */
564              return input_port_3_word_r(machine,0,mem_mask); /* IN3 */
565565
566566         case 0x10:
567              return input_port_4_word_r(0,mem_mask); /* IN4 */
567              return input_port_4_word_r(machine,0,mem_mask); /* IN4 */
568568
569569    }
570570
r1877r1878
583583    switch (offset)
584584    {
585585         case 0x00:
586              return input_port_4_word_r(0,mem_mask); /* DSW B */
586              return input_port_4_word_r(machine,0,mem_mask); /* DSW B */
587587
588588         case 0x01:
589              return input_port_0_word_r(0,mem_mask); /* IN0 */
589              return input_port_0_word_r(machine,0,mem_mask); /* IN0 */
590590    }
591591
592592logerror("CPU #0 PC %06x: warning - read unmapped input_r offset %06x\n",activecpu_get_pc(),offset);
r1877r1878
599599    switch (offset)
600600    {
601601         case 0x00:
602              return input_port_3_word_r(0,mem_mask); /* DSW A */
602              return input_port_3_word_r(machine,0,mem_mask); /* DSW A */
603603
604604         case 0x01:
605              return input_port_1_word_r(0,mem_mask); /* IN1 */
605              return input_port_1_word_r(machine,0,mem_mask); /* IN1 */
606606
607607         case 0x02:
608              return input_port_2_word_r(0,mem_mask); /* IN2 */
608              return input_port_2_word_r(machine,0,mem_mask); /* IN2 */
609609    }
610610
611611logerror("CPU #0 PC %06x: warning - read unmapped input_r offset %06x\n",activecpu_get_pc(),offset);
r1877r1878
618618    switch (offset)
619619    {
620620         case 0x00:
621              return input_port_0_word_r(0,mem_mask);   /* IN0 */
621              return input_port_0_word_r(machine,0,mem_mask);   /* IN0 */
622622
623623/* case 0x01 only used if "printer" DSW is on, and appears to
624624   be printer status byte */
625625
626626         case 0x02:
627              return input_port_1_word_r(0,mem_mask); /* IN1 */
627              return input_port_1_word_r(machine,0,mem_mask); /* IN1 */
628628    }
629629
630630logerror("CPU #0 PC %06x: warning - read unmapped input_r offset %06x\n",activecpu_get_pc(),offset);
r1877r1878
642642
643643   if (yesnoj_dsw)
644644   {
645      return input_port_2_word_r(0,mem_mask);
645      return input_port_2_word_r(machine,0,mem_mask);
646646   }
647647   else
648648   {
649      return input_port_3_word_r(0,mem_mask);
649      return input_port_3_word_r(machine,0,mem_mask);
650650   }
651651}
652652
r1877r1878
829829static READ16_HANDLER( taitof2_sound_r )
830830{
831831   if (offset == 1)
832      return (taitosound_comm16_lsb_r(0,mem_mask));
832      return (taitosound_comm16_lsb_r(machine,0,mem_mask));
833833   else return 0;
834834}
835835
836836static READ16_HANDLER( taitof2_msb_sound_r )
837837{
838838   if (offset == 1)
839      return (taitosound_comm16_msb_r(0,mem_mask));
839      return (taitosound_comm16_msb_r(machine,0,mem_mask));
840840   else return 0;
841841}
842842
r1877r1878
38683868
38693869   /* basic machine hardware */
38703870   MDRV_CPU_ADD_TAG("main", M68000, 24000000/2)   /* 12 MHz */
3871   MDRV_CPU_VBLANK_INT(taitof2_interrupt,1)
3871   MDRV_CPU_VBLANK_INT("main", taitof2_interrupt)
38723872
38733873   MDRV_CPU_ADD(Z80, 24000000/6)   /* 4 MHz */
38743874   /* audio CPU */
r1877r1878
43224322   /* basic machine hardware */
43234323   MDRV_CPU_ADD(M68000,24000000/2)   /* verified on pcb  */
43244324   MDRV_CPU_PROGRAM_MAP(cameltry_readmem,cameltry_writemem)
4325   MDRV_CPU_VBLANK_INT(taitof2_interrupt,1)
4325   MDRV_CPU_VBLANK_INT("main", taitof2_interrupt)
43264326
43274327   MDRV_CPU_ADD(Z80,24000000/4)   /* verifed on pcb */
43284328   /* audio CPU */
r1877r1878
43644364   /* basic machine hardware */
43654365   MDRV_CPU_ADD(M68000,24000000/2)   /* 12 MHz */
43664366   MDRV_CPU_PROGRAM_MAP(driveout_readmem,driveout_writemem)
4367   MDRV_CPU_VBLANK_INT(taitof2_interrupt,1)
4367   MDRV_CPU_VBLANK_INT("main", taitof2_interrupt)
43684368
43694369   MDRV_CPU_ADD(Z80,24000000/6)   /* 4 MHz */
43704370   /* audio CPU */
src/mame/drivers/gberet.c
r1877r1878
552552   // basic machine hardware
553553   MDRV_CPU_ADD_TAG("main", Z80, 18432000/6)   // X1S (generated by a custom IC)
554554   MDRV_CPU_PROGRAM_MAP(gberet_map, 0)
555   MDRV_CPU_VBLANK_INT(gberet_interrupt, 32)   // 1 IRQ + 16 NMI (generated by a custom IC)
555   MDRV_CPU_VBLANK_INT_HACK(gberet_interrupt, 32)   // 1 IRQ + 16 NMI (generated by a custom IC)
556556
557557   // video hardware
558558
r1877r1878
583583   // basic machine hardware
584584   MDRV_CPU_MODIFY("main")
585585   MDRV_CPU_PROGRAM_MAP(gberetb_map, 0)
586   MDRV_CPU_VBLANK_INT(gberet_interrupt, 16)   // 1 IRQ + 8 NMI
586   MDRV_CPU_VBLANK_INT_HACK(gberet_interrupt, 16)   // 1 IRQ + 8 NMI
587587
588588   MDRV_SCREEN_MODIFY("main")
589589   MDRV_SCREEN_REFRESH_RATE(60)
r1877r1878
601601   // basic machine hardware
602602   MDRV_CPU_MODIFY("main")
603603   MDRV_CPU_PROGRAM_MAP(mrgoemon_map, 0)
604   MDRV_CPU_VBLANK_INT(gberet_interrupt, 16)   // 1 IRQ + 8 NMI
604   MDRV_CPU_VBLANK_INT_HACK(gberet_interrupt, 16)   // 1 IRQ + 8 NMI
605605
606606   MDRV_SCREEN_MODIFY("main")
607607   MDRV_SCREEN_REFRESH_RATE(60)
src/mame/drivers/stfight.c
r1877r1878
487487   /* basic machine hardware */
488488   MDRV_CPU_ADD(Z80, 3000000)   /* 3 MHz */
489489   MDRV_CPU_PROGRAM_MAP(readmem_cpu1,writemem_cpu1)
490   MDRV_CPU_VBLANK_INT(stfight_vb_interrupt,1)
490   MDRV_CPU_VBLANK_INT("main", stfight_vb_interrupt)
491491
492492   MDRV_CPU_ADD(Z80, 3000000)
493493   /* audio CPU */   /* 3 MHz */
src/mame/drivers/gottlieb.c
r1877r1878
197197
198198static READ8_HANDLER( gottlieb_track_0_r )
199199{
200   return input_port_2_r(offset) - track[0];
200   return input_port_2_r(machine, offset) - track[0];
201201}
202202
203203static READ8_HANDLER( gottlieb_track_1_r )
204204{
205   return input_port_3_r(offset) - track[1];
205   return input_port_3_r(machine, offset) - track[1];
206206}
207207
208208static WRITE8_HANDLER( gottlieb_track_reset_w )
209209{
210210   /* reset the trackball counters */
211   track[0] = input_port_2_r(offset);
212   track[1] = input_port_3_r(offset);
211   track[0] = input_port_2_r(machine, offset);
212   track[1] = input_port_3_r(machine, offset);
213213}
214214
215215static int joympx;
r1877r1878
240240   set_led_status(0,data & 0x20);
241241   set_led_status(1,data & 0x40);
242242   set_led_status(2,data & 0x80);
243   gottlieb_video_outputs_w(offset,data);
243   gottlieb_video_outputs_w(machine,offset,data);
244244}
245245
246246static WRITE8_HANDLER( stooges_output_w )
247247{
248248   joympx = (data >> 5) & 0x03;
249   gottlieb_video_outputs_w(offset,data);
249   gottlieb_video_outputs_w(machine,offset,data);
250250}
251251
252252
r1877r1878
15231523   /* basic machine hardware */
15241524   MDRV_CPU_ADD_TAG("main", I8088, 5000000)   /* 5 MHz */
15251525   MDRV_CPU_PROGRAM_MAP(gottlieb_map,0)
1526   MDRV_CPU_VBLANK_INT(gottlieb_interrupt,1)
1526   MDRV_CPU_VBLANK_INT("main", gottlieb_interrupt)
15271527
15281528   /* audio CPU */
15291529   MDRV_CPU_ADD_TAG("sound", M6502, 3579545/4)   /* the board can be set to /2 as well */
r1877r1878
16011601   /* basic machine hardware */
16021602   MDRV_CPU_ADD_TAG("main", I8088, 5000000)   /* 5 MHz */
16031603   MDRV_CPU_PROGRAM_MAP(gottlieb_map,0)
1604   MDRV_CPU_VBLANK_INT(gottlieb_interrupt,1)
1604   MDRV_CPU_VBLANK_INT("main", gottlieb_interrupt)
16051605
16061606   MDRV_CPU_ADD_TAG("sound", M6502, 1000000)   /* 1 MHz */
16071607   /* audio CPU */
src/mame/drivers/sandscrp.c
r1877r1878
187187static READ16_HANDLER( sandscrp_soundlatch_word_r )
188188{
189189   latch2_full = 0;
190   return soundlatch2_r(0);
190   return soundlatch2_r(machine,0);
191191}
192192
193193static WRITE16_HANDLER( sandscrp_soundlatch_word_w )
r1877r1878
195195   if (ACCESSING_LSB)
196196   {
197197      latch1_full = 1;
198      soundlatch_w(0, data & 0xff);
199      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
198      soundlatch_w(machine, 0, data & 0xff);
199      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
200200      cpu_spinuntil_time(ATTOTIME_IN_USEC(100));   // Allow the other cpu to reply
201201   }
202202}
r1877r1878
253253static READ8_HANDLER( sandscrp_soundlatch_r )
254254{
255255   latch1_full = 0;
256   return soundlatch_r(0);
256   return soundlatch_r(machine,0);
257257}
258258
259259static WRITE8_HANDLER( sandscrp_soundlatch_w )
260260{
261261   latch2_full = 1;
262   soundlatch2_w(0,data);
262   soundlatch2_w(machine,0,data);
263263}
264264
265265static ADDRESS_MAP_START( sandscrp_soundmem, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
435435   /* basic machine hardware */
436436   MDRV_CPU_ADD(M68000,12000000)   /* TMP68HC000N-12 */
437437   MDRV_CPU_PROGRAM_MAP(sandscrp,0)
438   MDRV_CPU_VBLANK_INT(sandscrp_interrupt,1)
438   MDRV_CPU_VBLANK_INT("main", sandscrp_interrupt)
439439
440440   MDRV_CPU_ADD(Z80,4000000)   /* Z8400AB1, Reads the DSWs: it can't be disabled */
441441   MDRV_CPU_PROGRAM_MAP(sandscrp_soundmem,0)
src/mame/drivers/gpworld.c
r1877r1878
5959
6060
6161/* VIDEO GOODS */
62static void gpworld_draw_tiles(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
62static void gpworld_draw_tiles(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
6363{
6464   UINT8 characterX, characterY;
6565
r1877r1878
7676   }
7777}
7878
79INLINE void draw_pixel(mame_bitmap *bitmap,const rectangle *cliprect,int x,int y,int color)
79INLINE void draw_pixel(bitmap_t *bitmap,const rectangle *cliprect,int x,int y,int color)
8080{
8181   if (flip_screen_get())
8282   {
r1877r1878
9393   *BITMAP_ADDR32(bitmap, y, x) = color;
9494}
9595
96static void gpworld_draw_sprites(mame_bitmap *bitmap, const rectangle *cliprect)
96static void gpworld_draw_sprites(bitmap_t *bitmap, const rectangle *cliprect)
9797{
9898   const int SPR_Y_TOP     = 0;
9999   const int SPR_Y_BOTTOM  = 1;
r1877r1878
434434   MDRV_CPU_ADD(Z80, GUESSED_CLOCK)
435435   MDRV_CPU_PROGRAM_MAP(mainmem,0)
436436   MDRV_CPU_IO_MAP(mainport,0)
437   MDRV_CPU_VBLANK_INT(vblank_callback_gpworld, 1)
437   MDRV_CPU_VBLANK_INT("main", vblank_callback_gpworld)
438438
439439   MDRV_MACHINE_START(gpworld)
440440
src/mame/drivers/ddragon.c
r1877r1878
323323         break;
324324
325325      case 3: /* 380e - SND irq */
326         soundlatch_w(0, data);
327         cpunum_set_input_line(Machine, snd_cpu, sound_irq, (sound_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE);
326         soundlatch_w(machine, 0, data);
327         cpunum_set_input_line(machine, snd_cpu, sound_irq, (sound_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE);
328328         break;
329329
330330      case 4: /* 380f - ? */
src/mame/drivers/acommand.c
r1877r1878
8686         0);
8787}
8888
89static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority, int pri_mask)
89static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority, int pri_mask)
9090{
9191   int offs;
9292
r1877r1878
162162#define SHOW_LEDS   0
163163
164164#if SHOW_LEDS
165static void draw_led(mame_bitmap *bitmap, int x, int y,UINT8 value)
165static void draw_led(bitmap_t *bitmap, int x, int y,UINT8 value)
166166{
167167   plot_box(bitmap, x, y, 5, 9, 0x00000000);
168168
r1877r1878
281281                ---- ---- ---- --x- (Activate Test)
282282                ---- ---- ---- ---x (Advance Thru Tests)
283283            */
284         return input_port_0_word_r(0,0);
284         return input_port_0_word_r(machine,0,0);
285285      case 0x0014/2:
286286         /*
287287                write 0x40,read (~0x08)
r1877r1878
291291            */
292292         return (ac_devram[offset]);
293293      case 0x0016/2:
294         return OKIM6295_status_0_r(0);
294         return OKIM6295_status_0_r(machine,0);
295295      case 0x0018/2:
296296         /*
297297                ---- ---- ---- x--- Astronaut - switch
298298            */
299299         return ac_devram[offset];
300300      case 0x001a/2:
301         return OKIM6295_status_1_r(0);
301         return OKIM6295_status_1_r(machine,0);
302302      case 0x0040/2:
303303         /*
304304                x-x- x-x- x-x- xx-- (ACTIVE HIGH?) [eori #$aaac, D0]
r1877r1878
315315                xxxx xxxx ---- ---- DIPSW4
316316                ---- ---- xxxx xxxx DIPSW3
317317            */
318         return input_port_1_word_r(0,0);
318         return input_port_1_word_r(machine,0,0);
319319   }
320320   return ac_devram[offset];
321321}
r1877r1878
329329         if(ACCESSING_LSB)
330330         {
331331            logerror("Request to play sample %02x with rom 2\n",data);
332            OKIM6295_data_0_w(0,data);
332            OKIM6295_data_0_w(machine,0,data);
333333         }
334334         break;
335335      case 0x1a/2:
336336         if(ACCESSING_LSB)
337337         {
338338            logerror("Request to play sample %02x with rom 1\n",data);
339            OKIM6295_data_1_w(0,data);
339            OKIM6295_data_1_w(machine,0,data);
340340         }
341341         break;
342342      case 0x1c/2:
r1877r1878
519519   /* basic machine hardware */
520520   MDRV_CPU_ADD(M68000,12000000)
521521   MDRV_CPU_PROGRAM_MAP(acommand,0)
522   MDRV_CPU_VBLANK_INT(acommand_irq,2)
522   MDRV_CPU_VBLANK_INT_HACK(acommand_irq,2)
523523
524524   /* video hardware */
525525   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/asterix.c
r1877r1878
6868   /* bit 8  is EEPROM data */
6969   /* bit 9  is EEPROM ready */
7070   /* bit 10 is service button */
71   res = (EEPROM_read_bit()<<8) | input_port_1_word_r(0,0);
71   res = (EEPROM_read_bit()<<8) | input_port_1_word_r(machine,0,0);
7272
7373   if (init_eeprom_count)
7474   {
r1877r1878
117117
118118static READ16_HANDLER( asterix_sound_r )
119119{
120   return K053260_0_r(2 + offset);
120   return K053260_0_r(machine,2 + offset);
121121}
122122
123123static TIMER_CALLBACK( nmi_callback )
r1877r1878
127127
128128static WRITE8_HANDLER( sound_arm_nmi_w )
129129{
130   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, CLEAR_LINE);
130   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, CLEAR_LINE);
131131   timer_set(ATTOTIME_IN_USEC(5), NULL,0,nmi_callback);
132132}
133133
134134static WRITE16_HANDLER( sound_irq_w )
135135{
136   cpunum_set_input_line(Machine, 1, 0, HOLD_LINE);
136   cpunum_set_input_line(machine, 1, 0, HOLD_LINE);
137137}
138138
139139// Check the routine at 7f30 in the ead version.
r1877r1878
257257   /* basic machine hardware */
258258   MDRV_CPU_ADD(M68000, 12000000)
259259   MDRV_CPU_PROGRAM_MAP(main_map,0)
260   MDRV_CPU_VBLANK_INT(asterix_interrupt,1)
260   MDRV_CPU_VBLANK_INT("main", asterix_interrupt)
261261
262262   MDRV_CPU_ADD(Z80, 8000000)
263263   MDRV_CPU_PROGRAM_MAP(sound_map,0)
src/mame/drivers/tubep.c
r1877r1878
146146            //screen_flip_w(offset,data&1); /* bit 0 = screen flip, active high */
147147            break;
148148      case 6:
149            tubep_background_romselect_w(offset,data);   /* bit0 = 0->select roms: B1,B3,B5; bit0 = 1->select roms: B2,B4,B6 */
149            tubep_background_romselect_w(machine,offset,data);   /* bit0 = 0->select roms: B1,B3,B5; bit0 = 1->select roms: B2,B4,B6 */
150150            break;
151151      case 7:
152            tubep_colorproms_A4_line_w(offset,data);   /* bit0 = line A4 (color proms address) state */
152            tubep_colorproms_A4_line_w(machine,offset,data);   /* bit0 = line A4 (color proms address) state */
153153            break;
154154      default:
155155            break;
r1877r1878
955955
956956   MDRV_CPU_ADD(M6802,6000000) /* ? MHz Xtal */
957957   MDRV_CPU_PROGRAM_MAP(nsc_map,0)
958   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
958   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
959959MACHINE_DRIVER_END
960960
961961
src/mame/drivers/ppmast93.c
r1877r1878
190190{
191191   switch(offset&0xff)
192192   {
193      case 0: YM2413_register_port_0_w(0,data); break;
194      case 1: YM2413_data_port_0_w(0,data); break;
195      case 2: DAC_0_data_w(0,data);break;
193      case 0: YM2413_register_port_0_w(machine,0,data); break;
194      case 1: YM2413_data_port_0_w(machine,0,data); break;
195      case 2: DAC_0_data_w(machine,0,data);break;
196196      default: logerror("%x %x - %x\n",offset,data,activecpu_get_previouspc());
197197   }
198198}
r1877r1878
347347   MDRV_CPU_ADD(Z80,5000000)       /* 5 MHz */
348348   MDRV_CPU_PROGRAM_MAP(ppmast93_cpu1_map,0)
349349   MDRV_CPU_IO_MAP(ppmast93_cpu1_io,0)
350   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
350   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
351351
352352   MDRV_CPU_ADD(Z80,5000000)       /* 5 MHz */
353353   MDRV_CPU_PROGRAM_MAP(ppmast93_cpu2_map,0)
src/mame/drivers/homedata.c
r1877r1878
298298static READ8_HANDLER( mrokumei_sound_io_r )
299299{
300300   if (sndbank & 4)
301      return(soundlatch_r(0));
301      return(soundlatch_r(machine,0));
302302   else
303303      return memory_region(REGION_CPU2)[0x10000 + offset + (sndbank & 1) * 0x10000];
304304}
r1877r1878
326326
327327static WRITE8_HANDLER( mrokumei_sound_cmd_w )
328328{
329   soundlatch_w(offset,data);
330   cpunum_set_input_line(Machine, 1,0,HOLD_LINE);
329   soundlatch_w(machine,offset,data);
330   cpunum_set_input_line(machine, 1,0,HOLD_LINE);
331331}
332332
333333
r1877r1878
373373   if (BIT(upd7807_portc,5) && !BIT(data,5))   /* write clock 1->0 */
374374   {
375375      if (BIT(data,3))
376         YM2203_write_port_0_w(0,upd7807_porta);
376         YM2203_write_port_0_w(machine,0,upd7807_porta);
377377      else
378         YM2203_control_port_0_w(0,upd7807_porta);
378         YM2203_control_port_0_w(machine,0,upd7807_porta);
379379   }
380380
381381   if (BIT(upd7807_portc,4) && !BIT(data,4))   /* read clock 1->0 */
382382   {
383383      if (BIT(data,3))
384         upd7807_porta = YM2203_read_port_0_r(0);
384         upd7807_porta = YM2203_read_port_0_r(machine,0);
385385      else
386         upd7807_porta = YM2203_status_port_0_r(0);
386         upd7807_porta = YM2203_status_port_0_r(machine,0);
387387   }
388388
389389   upd7807_portc = data;
r1877r1878
393393{
394394   /* on reset, ports are set as input (high impedance), therefore 0xff output */
395395   reikaids_which=homedata_priority;
396   reikaids_upd7807_portc_w(0,0xff);
396   reikaids_upd7807_portc_w(machine,0,0xff);
397397}
398398
399399static READ8_HANDLER( reikaids_io_r )
r1877r1878
529529   coin_counter_w(0,~data & 0x80);
530530
531531   if (BIT(upd7807_portc,5) && !BIT(data,5))   /* clock 1->0 */
532      SN76496_0_w(0,upd7807_porta);
532      SN76496_0_w(machine,0,upd7807_porta);
533533
534534   upd7807_portc = data;
535535}
r1877r1878
537537static MACHINE_RESET( pteacher_upd7807 )
538538{
539539   /* on reset, ports are set as input (high impedance), therefore 0xff output */
540   pteacher_upd7807_portc_w(0,0xff);
540   pteacher_upd7807_portc_w(machine,0,0xff);
541541}
542542
543543
r1877r1878
12621262   /* basic machine hardware */
12631263   MDRV_CPU_ADD(M6809, 16000000/4)   /* 4MHz ? */
12641264   MDRV_CPU_PROGRAM_MAP(mrokumei_readmem,mrokumei_writemem)
1265   MDRV_CPU_VBLANK_INT(homedata_irq,1)   /* also triggered by the blitter */
1265   MDRV_CPU_VBLANK_INT("main", homedata_irq)   /* also triggered by the blitter */
12661266
12671267   MDRV_CPU_ADD(Z80, 16000000/4)   /* 4MHz ? */
12681268   /* audio CPU */
r1877r1878
13191319   /* basic machine hardware */
13201320   MDRV_CPU_ADD(M6809, 16000000/4)   /* 4MHz ? */
13211321   MDRV_CPU_PROGRAM_MAP(reikaids_readmem,reikaids_writemem)
1322   MDRV_CPU_VBLANK_INT(homedata_irq,1)   /* also triggered by the blitter */
1322   MDRV_CPU_VBLANK_INT("main", homedata_irq)   /* also triggered by the blitter */
13231323
13241324   MDRV_CPU_ADD(UPD7807, 8000000)   /* ??? MHz (max speed for the 7807 is 12MHz) */
13251325   MDRV_CPU_CONFIG(upd_config)
13261326   MDRV_CPU_PROGRAM_MAP(reikaids_upd7807_readmem,reikaids_upd7807_writemem)
13271327   MDRV_CPU_IO_MAP(reikaids_upd7807_readport,reikaids_upd7807_writeport)
1328   MDRV_CPU_VBLANK_INT(upd7807_irq,1)
1328   MDRV_CPU_VBLANK_INT("main", upd7807_irq)
13291329
13301330   MDRV_INTERLEAVE(500)   // very high interleave required to sync for startup tests
13311331
r1877r1878
13691369   /* basic machine hardware */
13701370   MDRV_CPU_ADD(M6809, 16000000/4)   /* 4MHz ? */
13711371   MDRV_CPU_PROGRAM_MAP(pteacher_readmem,pteacher_writemem)
1372   MDRV_CPU_VBLANK_INT(homedata_irq,1)   /* also triggered by the blitter */
1372   MDRV_CPU_VBLANK_INT("main", homedata_irq)   /* also triggered by the blitter */
13731373
13741374   MDRV_CPU_ADD_TAG("sound", UPD7807, 9000000)   /* 9MHz ? */
13751375   MDRV_CPU_CONFIG(upd_config)
13761376   MDRV_CPU_PROGRAM_MAP(pteacher_upd7807_readmem,pteacher_upd7807_writemem)
13771377   MDRV_CPU_IO_MAP(pteacher_upd7807_readport,pteacher_upd7807_writeport)
1378   MDRV_CPU_VBLANK_INT(upd7807_irq,1)
1378   MDRV_CPU_VBLANK_INT("main", upd7807_irq)
13791379
13801380   MDRV_INTERLEAVE(100)   // should be enough
13811381
src/mame/drivers/exidy.c
r1877r1878
126126***************************************************************************/
127127
128128#include "driver.h"
129#include "deprecat.h"
129130#include "exidy.h"
130131#include "targ.h"
131132#include "machine/6821pia.h"
r1877r1878
782783
783784   /* basic machine hardware */
784785   MDRV_CPU_ADD_TAG("main", M6502, EXIDY_CPU_CLOCK)
785   MDRV_CPU_VBLANK_INT(exidy_vblank_interrupt,1)
786   MDRV_CPU_VBLANK_INT("main", exidy_vblank_interrupt)
786787
787788   /* video hardware */
788789   MDRV_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
r1877r1878
862863   /* basic machine hardware */
863864   MDRV_IMPORT_FROM(venture)
864865   MDRV_CPU_MODIFY("main")
865   MDRV_CPU_VBLANK_INT(teetert_vblank_interrupt,10)
866   MDRV_CPU_VBLANK_INT_HACK(teetert_vblank_interrupt,10)
866867MACHINE_DRIVER_END
867868
868869
r1877r1878
14121413   exidy_video_config(0x04, 0x04, TRUE);
14131414
14141415   /* reset the ROM bank */
1415   fax_bank_select_w(0,0);
1416   fax_bank_select_w(machine,0,0);
14161417}
14171418
14181419
src/mame/drivers/xxmissio.c
r1877r1878
292292   /* basic machine hardware */
293293   MDRV_CPU_ADD(Z80,12000000/4)   /* 3.0MHz */
294294   MDRV_CPU_PROGRAM_MAP(map1,0)
295   MDRV_CPU_VBLANK_INT(xxmissio_interrupt_m,1)
295   MDRV_CPU_VBLANK_INT("main", xxmissio_interrupt_m)
296296
297297   MDRV_CPU_ADD(Z80,12000000/4)   /* 3.0MHz */
298298   MDRV_CPU_PROGRAM_MAP(map2,0)
299   MDRV_CPU_VBLANK_INT(xxmissio_interrupt_s,2)
299   MDRV_CPU_VBLANK_INT_HACK(xxmissio_interrupt_s,2)
300300
301301   MDRV_INTERLEAVE(100)
302302
src/mame/drivers/mugsmash.c
r1877r1878
6262   switch (offset)
6363   {
6464   case 1:
65      soundlatch_w(1,data&0xff);
66      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE );
65      soundlatch_w(machine,1,data&0xff);
66      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE );
6767      break;
6868
6969   default:
r1877r1878
430430static MACHINE_DRIVER_START( mugsmash )
431431   MDRV_CPU_ADD(M68000, 12000000)
432432   MDRV_CPU_PROGRAM_MAP(mugsmash_readmem,mugsmash_writemem)
433   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
433   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
434434
435435   MDRV_CPU_ADD(Z80, 4000000)
436436   /* audio CPU */   /* Guess */
src/mame/drivers/pcktgal.c
r1877r1878
4646
4747static WRITE8_HANDLER( pcktgal_sound_w )
4848{
49   soundlatch_w(0,data);
50   cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
49   soundlatch_w(machine,0,data);
50   cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
5151}
5252
5353static int msm5205next;
r1877r1878
239239   /* basic machine hardware */
240240   MDRV_CPU_ADD(M6502, 2000000)
241241   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
242   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
242   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
243243
244244   MDRV_CPU_ADD(M6502, 1500000)
245245   /* audio CPU */
src/mame/drivers/hyhoo.c
r1877r1878
268268   MDRV_CPU_ADD(Z80, 5000000/1)   /* 5.00 MHz ?? */
269269   MDRV_CPU_PROGRAM_MAP(readmem_hyhoo, writemem_hyhoo)
270270   MDRV_CPU_IO_MAP(readport_hyhoo, writeport_hyhoo)
271   MDRV_CPU_VBLANK_INT(nb1413m3_interrupt, 1)
271   MDRV_CPU_VBLANK_INT("main", nb1413m3_interrupt)
272272
273273   MDRV_MACHINE_RESET(nb1413m3)
274274   MDRV_NVRAM_HANDLER(nb1413m3)
src/mame/drivers/hng64.c
r1877r1878
15181518   MDRV_CPU_ADD(R4600BE, MASTER_CLOCK)     // actually R4300
15191519   MDRV_CPU_CONFIG(config)
15201520   MDRV_CPU_PROGRAM_MAP(hng_map, 0)
1521   MDRV_CPU_VBLANK_INT(irq_start,3)
1521   MDRV_CPU_VBLANK_INT_HACK(irq_start,3)
15221522
15231523   MDRV_CPU_ADD(V30,8000000)             // v53, 16? mhz!
15241524   MDRV_CPU_PROGRAM_MAP(hng_sound_map,0)
src/mame/drivers/solomon.c
r1877r1878
2424
2525static WRITE8_HANDLER( solomon_sh_command_w )
2626{
27   soundlatch_w(offset,data);
28   cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
27   soundlatch_w(machine,offset,data);
28   cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
2929}
3030
3131/* this is checked on the title screen and when you reach certain scores in the game
r1877r1878
206206   /* basic machine hardware */
207207   MDRV_CPU_ADD(Z80, 4000000)   /* 4.0 MHz (?????) */
208208   MDRV_CPU_PROGRAM_MAP(main_map,0)
209   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
209   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
210210
211211   MDRV_CPU_ADD(Z80, 3072000)
212212   MDRV_CPU_PROGRAM_MAP(sound_map,0)
213213   MDRV_CPU_IO_MAP(sound_portmap,0)
214   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)   /* ??? */
214   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)   /* ??? */
215215                  /* NMIs are caused by the main CPU */
216216
217217   /* video hardware */
src/mame/drivers/macrossp.c
r1877r1878
278278   if (ACCESSING_MSW32)
279279   {
280280      //logerror("%08x write soundcmd %08x (%08x)\n",activecpu_get_pc(),data,mem_mask);
281      soundlatch_word_w(0,data >> 16,0);
281      soundlatch_word_w(machine,0,data >> 16,0);
282282      sndpending = 1;
283283      cpunum_set_input_line(Machine, 1,2,HOLD_LINE);
284284      /* spin for a while to let the sound CPU read the command */
r1877r1878
290290{
291291//  logerror("%06x read soundcmd\n",activecpu_get_pc());
292292   sndpending = 0;
293   return soundlatch_word_r(offset,mem_mask);
293   return soundlatch_word_r(machine,offset,mem_mask);
294294}
295295
296296
r1877r1878
534534   /* basic machine hardware */
535535   MDRV_CPU_ADD(M68EC020, 50000000/2)   /* 25 MHz */
536536   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
537   MDRV_CPU_VBLANK_INT(irq3_line_hold,1) // there are others ...
537   MDRV_CPU_VBLANK_INT("main", irq3_line_hold) // there are others ...
538538
539539   MDRV_CPU_ADD(M68000, 32000000/2)   /* 16 MHz */
540540   /* audio CPU */
src/mame/drivers/gladiatr.c
r1877r1878
309309
310310static WRITE8_HANDLER( glad_cpu_sound_command_w )
311311{
312   soundlatch_w(0,data);
313   cpunum_set_input_line(Machine, 2, INPUT_LINE_NMI, ASSERT_LINE);
312   soundlatch_w(machine,0,data);
313   cpunum_set_input_line(machine, 2, INPUT_LINE_NMI, ASSERT_LINE);
314314}
315315
316316static READ8_HANDLER( glad_cpu_sound_command_r )
317317{
318   cpunum_set_input_line(Machine, 2, INPUT_LINE_NMI, CLEAR_LINE);
319   return soundlatch_r(0);
318   cpunum_set_input_line(machine, 2, INPUT_LINE_NMI, CLEAR_LINE);
319   return soundlatch_r(machine,0);
320320}
321321
322322static WRITE8_HANDLER( gladiatr_flipscreen_w )
r1877r1878
683683   MDRV_CPU_ADD(Z80, XTAL_12MHz/2) /* verified on pcb */
684684   MDRV_CPU_PROGRAM_MAP(ppking_cpu1_map,0)
685685   MDRV_CPU_IO_MAP(ppking_cpu1_io,0)
686   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
686   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
687687
688688   MDRV_CPU_ADD(Z80, XTAL_12MHz/4) /* verified on pcb */
689689   MDRV_CPU_PROGRAM_MAP(cpu2_map,0)
690690   MDRV_CPU_IO_MAP(ppking_cpu2_io,0)
691   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
691   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
692692
693693   MDRV_CPU_ADD(M6809, XTAL_12MHz/16) /* verified on pcb */
694694   /* audio CPU */
r1877r1878
733733   MDRV_CPU_ADD(Z80, XTAL_12MHz/2) /* verified on pcb */
734734   MDRV_CPU_PROGRAM_MAP(gladiatr_cpu1_map,0)
735735   MDRV_CPU_IO_MAP(gladiatr_cpu1_io,0)
736   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
736   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
737737
738738   MDRV_CPU_ADD(Z80, XTAL_12MHz/4) /* verified on pcb */
739739   MDRV_CPU_PROGRAM_MAP(cpu2_map,0)
src/mame/drivers/imolagp.c
r1877r1878
396396   MDRV_CPU_ADD(Z80,8000000) /* ? */
397397   MDRV_CPU_PROGRAM_MAP(imolagp_master,0)
398398   MDRV_CPU_IO_MAP(readport_master,0)
399   MDRV_CPU_VBLANK_INT(master_interrupt,4)
399   MDRV_CPU_VBLANK_INT_HACK(master_interrupt,4)
400400
401401   MDRV_CPU_ADD(Z80,8000000) /* ? */
402402   MDRV_CPU_PROGRAM_MAP(imolagp_slave,0)
403403   MDRV_CPU_IO_MAP(readport_slave,0)
404   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
404   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
405405
406406   MDRV_INTERLEAVE(100)
407407
src/mame/drivers/puckpkmn.c
r1877r1878
9292
9393static READ16_HANDLER( puckpkmn_YM3438_r )
9494{
95   return   YM3438_status_port_0_A_r(0) << 8;
95   return   YM3438_status_port_0_A_r(machine, 0) << 8;
9696}
9797
9898static WRITE16_HANDLER( puckpkmn_YM3438_w )
r1877r1878
100100   switch (offset)
101101   {
102102      case 0:
103         if (ACCESSING_MSB)   YM3438_control_port_0_A_w   (0,   (data >> 8) & 0xff);
104         else             YM3438_data_port_0_A_w      (0,   (data >> 0) & 0xff);
103         if (ACCESSING_MSB)   YM3438_control_port_0_A_w   (machine, 0,   (data >> 8) & 0xff);
104         else             YM3438_data_port_0_A_w      (machine, 0,   (data >> 0) & 0xff);
105105         break;
106106      case 1:
107         if (ACCESSING_MSB)   YM3438_control_port_0_B_w   (0,   (data >> 8) & 0xff);
108         else             YM3438_data_port_0_B_w      (0,   (data >> 0) & 0xff);
107         if (ACCESSING_MSB)   YM3438_control_port_0_B_w   (machine, 0,   (data >> 8) & 0xff);
108         else             YM3438_data_port_0_B_w      (machine, 0,   (data >> 0) & 0xff);
109109         break;
110110   }
111111}
r1877r1878
158158   /* basic machine hardware */
159159   MDRV_CPU_ADD_TAG("main",M68000, MASTER_CLOCK/7)       /*???*/
160160   MDRV_CPU_PROGRAM_MAP(puckpkmn_readmem,puckpkmn_writemem)
161   MDRV_CPU_VBLANK_INT(genesis_vblank_interrupt,1)
161   MDRV_CPU_VBLANK_INT("main", genesis_vblank_interrupt)
162162
163163   MDRV_MACHINE_START(genesis)
164164   MDRV_MACHINE_RESET(genesis)
src/mame/drivers/kinstb.c
r1877r1878
8484
8585static READ8_HANDLER( spc_ram_100_r )
8686{
87   return spc_ram_r(offset + 0x100);
87   return spc_ram_r(machine, offset + 0x100);
8888}
8989
9090static WRITE8_HANDLER( spc_ram_100_w )
9191{
92   spc_ram_w(offset + 0x100, data);
92   spc_ram_w(machine, offset + 0x100, data);
9393}
9494
9595static ADDRESS_MAP_START( spc_mem, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
214214   MDRV_CPU_ADD_TAG("sound", SPC700, 2048000/2)   /* 2.048 Mhz, but internal divider */
215215   /* audio CPU */
216216   MDRV_CPU_PROGRAM_MAP(spc_mem, 0)
217   MDRV_CPU_VBLANK_INT(NULL, 0)
218217
219218   MDRV_INTERLEAVE(400)
220219
src/mame/drivers/moo.c
r1877r1878
9898   /* bit 1 is EEPROM ready */
9999   /* bit 3 is service button */
100100   /* bits 4-7 are DIP switches */
101   res = EEPROM_read_bit() | input_port_1_r(0);
101   res = EEPROM_read_bit() | input_port_1_r(machine,0);
102102
103103   if (init_eeprom_count)
104104   {
r1877r1878
202202{
203203   if((data & 0x00ff0000) == 0) {
204204      data &= 0xff;
205      soundlatch_w(0, data);
205      soundlatch_w(machine, 0, data);
206206   }
207207}
208208
209209static WRITE16_HANDLER( sound_cmd2_w )
210210{
211211   if((data & 0x00ff0000) == 0) {
212      soundlatch2_w(0, data & 0xff);
212      soundlatch2_w(machine, 0, data & 0xff);
213213   }
214214}
215215
216216static WRITE16_HANDLER( sound_irq_w )
217217{
218   cpunum_set_input_line(Machine, 1, 0, HOLD_LINE);
218   cpunum_set_input_line(machine, 1, 0, HOLD_LINE);
219219}
220220
221221static READ16_HANDLER( sound_status_r )
222222{
223   return soundlatch3_r(0);
223   return soundlatch3_r(machine,0);
224224}
225225
226226static WRITE8_HANDLER( sound_bankswitch_w )
r1877r1878
240240   else
241241   {
242242      offset = (offset & 0x0007) | ((offset & 0x7f80) >> 4);
243      return K053247_word_r(offset,mem_mask);
243      return K053247_word_r(machine,offset,mem_mask);
244244   }
245245}
246246
r1877r1878
252252   {
253253      offset = (offset & 0x0007) | ((offset & 0x7f80) >> 4);
254254
255      K053247_word_w(offset,data,mem_mask);
255      K053247_word_w(machine,offset,data,mem_mask);
256256   }
257257}
258258
r1877r1878
261261
262262static READ16_HANDLER( player1_r )    // players 1 and 3
263263{
264   return input_port_2_r(0) | (input_port_4_r(0)<<8);
264   return input_port_2_r(machine,0) | (input_port_4_r(machine,0)<<8);
265265}
266266
267267static READ16_HANDLER( player2_r )   // players 2 and 4
268268{
269   return input_port_3_r(0) | (input_port_5_r(0)<<8);
269   return input_port_3_r(machine,0) | (input_port_5_r(machine,0)<<8);
270270}
271271
272272static WRITE16_HANDLER( moo_prot_w )
r1877r1878
629629   /* basic machine hardware */
630630   MDRV_CPU_ADD_TAG("main", M68000, 16000000)
631631   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
632   MDRV_CPU_VBLANK_INT(moo_interrupt, 1)
632   MDRV_CPU_VBLANK_INT("main", moo_interrupt)
633633
634634   MDRV_CPU_ADD_TAG("sound", Z80, 8000000)
635635   /* audio CPU */
r1877r1878
673673   /* basic machine hardware */
674674   MDRV_CPU_ADD_TAG("main", M68000, 16100000)
675675   MDRV_CPU_PROGRAM_MAP(readmembl,writemembl)
676   MDRV_CPU_VBLANK_INT(moobl_interrupt, 1)
676   MDRV_CPU_VBLANK_INT("main", moobl_interrupt)
677677
678678   MDRV_MACHINE_START(moo)
679679   MDRV_MACHINE_RESET(moo)
src/mame/drivers/stepstag.c
r1877r1878
123123   /* basic machine hardware */
124124   MDRV_CPU_ADD(M68000, 16000000 ) //??
125125   MDRV_CPU_PROGRAM_MAP(stepstag_readmem,stepstag_writemem)
126   MDRV_CPU_VBLANK_INT(irq4_line_hold,1) // 4 & 6 valid
126   MDRV_CPU_VBLANK_INT("main", irq4_line_hold) // 4 & 6 valid
127127
128128   MDRV_CPU_ADD(M68000, 16000000 ) //??
129129   MDRV_CPU_PROGRAM_MAP(stepstag_sub_readmem,stepstag_sub_writemem)
src/mame/drivers/goindol.c
r1877r1878
1818***************************************************************************/
1919
2020#include "driver.h"
21#include "deprecat.h"
2122#include "sound/2203intf.h"
2223
2324VIDEO_START( goindol );
r1877r1878
272273   /* basic machine hardware */
273274   MDRV_CPU_ADD(Z80, 6000000)        /* 6 MHz (?) */
274275   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
275   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
276   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
276277
277278   MDRV_CPU_ADD(Z80, 4000000)
278279   /* audio CPU */
279280   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
280   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)
281   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)
281282
282283   /* video hardware */
283284   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/eolith16.c
r1877r1878
1010**********************************************************************/
1111
1212#include "driver.h"
13#include "deprecat.h"
1314#include "machine/eeprom.h"
1415#include "sound/okim6295.h"
1516#include "eolithsp.h"
r1877r1878
165166static MACHINE_DRIVER_START( eolith16 )
166167   MDRV_CPU_ADD(E116T, 60000000)      /* no internal multiplier */
167168   MDRV_CPU_PROGRAM_MAP(eolith16_map,0)
168   MDRV_CPU_VBLANK_INT(eolith_speedup,262)
169   MDRV_CPU_VBLANK_INT_HACK(eolith_speedup,262)
169170
170171   MDRV_NVRAM_HANDLER(eolith16_eeprom)
171172
src/mame/drivers/taito_l.c
r1877r1878
107107static UINT8 *empty_ram;
108108static UINT8 *shared_ram;
109109
110static read8_handler porte0_r;
111static read8_handler porte1_r;
112static read8_handler portf0_r;
113static read8_handler portf1_r;
110static read8_machine_func porte0_r;
111static read8_machine_func porte1_r;
112static read8_machine_func portf0_r;
113static read8_machine_func portf1_r;
114114
115115static void palette_notifier(int addr)
116116{
r1877r1878
446446
447447static READ8_HANDLER( portA_r )
448448{
449   if (extport == 0) return porte0_r(0);
450   else return porte1_r(0);
449   if (extport == 0) return porte0_r(machine,0);
450   else return porte1_r(machine,0);
451451}
452452
453453static READ8_HANDLER( portB_r )
454454{
455   if (extport == 0) return portf0_r(0);
456   else return portf1_r(0);
455   if (extport == 0) return portf0_r(machine,0);
456   else return portf1_r(machine,0);
457457}
458458
459459static READ8_HANDLER( ym2203_data0_r )
460460{
461461   extport = 0;
462   return YM2203_read_port_0_r(offset);
462   return YM2203_read_port_0_r(machine,offset);
463463}
464464
465465static READ8_HANDLER( ym2203_data1_r )
466466{
467467   extport = 1;
468   return YM2203_read_port_0_r(offset);
468   return YM2203_read_port_0_r(machine,offset);
469469}
470470
471471static const UINT8 *mcu_reply;
r1877r1878
533533   switch(mux_ctrl)
534534   {
535535   case 0:
536      return input_port_0_r(0);
536      return input_port_0_r(machine,0);
537537   case 1:
538      return input_port_1_r(0);
538      return input_port_1_r(machine,0);
539539   case 2:
540      return input_port_2_r(0);
540      return input_port_2_r(machine,0);
541541   case 3:
542      return input_port_3_r(0);
542      return input_port_3_r(machine,0);
543543   case 7:
544      return input_port_4_r(0);
544      return input_port_4_r(machine,0);
545545   default:
546546      logerror("Mux read from unknown port %d (%04x)\n", mux_ctrl, activecpu_get_pc());
547547      return 0xff;
r1877r1878
553553   switch(mux_ctrl)
554554   {
555555   case 4:
556      control2_w(0, data);
556      control2_w(machine,0, data);
557557      break;
558558   default:
559559      logerror("Mux write to unknown port %d, %02x (%04x)\n", mux_ctrl, data, activecpu_get_pc());
r1877r1878
22852285   /* basic machine hardware */
22862286   MDRV_CPU_ADD_TAG("cpu1", Z80, 13330560/2)    /* verified freq on pin122 of TC0090LVC cpu */
22872287   MDRV_CPU_PROGRAM_MAP(fhawk_readmem,fhawk_writemem)
2288   MDRV_CPU_VBLANK_INT(vbl_interrupt,3)
2288   MDRV_CPU_VBLANK_INT_HACK(vbl_interrupt,3)
22892289
22902290   MDRV_CPU_ADD_TAG("sound", Z80, 4000000)   /* verified on pcb */
22912291   /* audio CPU */
r1877r1878
22932293
22942294   MDRV_CPU_ADD_TAG("cpu2", Z80, 12000000/3)    /* verified on pcb */
22952295   MDRV_CPU_PROGRAM_MAP(fhawk_2_readmem,fhawk_2_writemem)
2296   MDRV_CPU_VBLANK_INT(irq0_line_hold,3) /* fixes slow down problems */
2296   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,3) /* fixes slow down problems */
22972297
22982298   MDRV_INTERLEAVE(100)
22992299
r1877r1878
23852385   /* basic machine hardware */
23862386   MDRV_CPU_ADD(Z80, 13330560/2)    /* verified freq on pin122 of TC0090LVC cpu */
23872387   MDRV_CPU_PROGRAM_MAP(kurikint_readmem,kurikint_writemem)
2388   MDRV_CPU_VBLANK_INT(vbl_interrupt,3)
2388   MDRV_CPU_VBLANK_INT_HACK(vbl_interrupt,3)
23892389
23902390   MDRV_CPU_ADD( Z80, 12000000/3)    /* verified on pcb */
23912391   MDRV_CPU_PROGRAM_MAP(kurikint_2_readmem,kurikint_2_writemem)
2392   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
2392   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
23932393
23942394   MDRV_INTERLEAVE(100)
23952395
r1877r1878
24362436   /* basic machine hardware */
24372437   MDRV_CPU_ADD_TAG("main", Z80, 13330560/2)    /* verified freq on pin122 of TC0090LVC cpu */
24382438   MDRV_CPU_PROGRAM_MAP(plotting_readmem,plotting_writemem)
2439   MDRV_CPU_VBLANK_INT(vbl_interrupt,3)
2439   MDRV_CPU_VBLANK_INT_HACK(vbl_interrupt,3)
24402440
24412441   MDRV_MACHINE_RESET(plotting)
24422442
r1877r1878
25152515   /* basic machine hardware */
25162516   MDRV_CPU_ADD(Z80, 13330560/2)    /* not verfied */
25172517   MDRV_CPU_PROGRAM_MAP(evilston_readmem,evilston_writemem)
2518   MDRV_CPU_VBLANK_INT(vbl_interrupt,3)
2518   MDRV_CPU_VBLANK_INT_HACK(vbl_interrupt,3)
25192519
25202520   MDRV_CPU_ADD(Z80, 12000000/3)    /* not verified */
25212521   MDRV_CPU_PROGRAM_MAP(evilston_2_readmem,evilston_2_writemem)
2522   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
2522   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
25232523
25242524   MDRV_INTERLEAVE(100)
25252525
src/mame/drivers/gyruss.c
r1877r1878
6161#include "sound/dac.h"
6262
6363
64void konami1_decode_cpu2(void);
64extern UINT8 *gyruss_videoram;
65extern UINT8 *gyruss_colorram;
66extern UINT8 *gyruss_spriteram;
67extern UINT8 *gyruss_flipscreen;
6568
66WRITE8_HANDLER( gyruss_flipscreen_w );
69void konami1_decode_cpu2(void);
70WRITE8_HANDLER( gyruss_spriteram_w );
6771READ8_HANDLER( gyruss_scanline_r );
6872VIDEO_START( gyruss );
6973PALETTE_INIT( gyruss );
7074VIDEO_UPDATE( gyruss );
71INTERRUPT_GEN( gyruss_6809_interrupt );
7275
73
7476READ8_HANDLER( gyruss_portA_r );
7577WRITE8_HANDLER( gyruss_filter0_w );
7678WRITE8_HANDLER( gyruss_filter1_w );
r1877r1878
7880WRITE8_HANDLER( gyruss_i8039_irq_w );
7981
8082
81static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
82   AM_RANGE(0x0000, 0x7fff) AM_READ(MRA8_ROM)
83   AM_RANGE(0x8000, 0x87ff) AM_READ(MRA8_RAM)
84   AM_RANGE(0x9000, 0x9fff) AM_READ(MRA8_RAM)
85   AM_RANGE(0xa000, 0xa7ff) AM_READ(MRA8_RAM) AM_SHARE(1)
86   AM_RANGE(0xc000, 0xc000) AM_READ(input_port_4_r)   /* DSW1 */
87   AM_RANGE(0xc080, 0xc080) AM_READ(input_port_0_r)   /* IN0 */
88   AM_RANGE(0xc0a0, 0xc0a0) AM_READ(input_port_1_r)   /* IN1 */
89   AM_RANGE(0xc0c0, 0xc0c0) AM_READ(input_port_2_r)   /* IN2 */
90   AM_RANGE(0xc0e0, 0xc0e0) AM_READ(input_port_3_r)   /* DSW0 */
91   AM_RANGE(0xc100, 0xc100) AM_READ(input_port_5_r)   /* DSW2 */
83static ADDRESS_MAP_START( main_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
84   AM_RANGE(0x0000, 0x7fff) AM_ROM
85   AM_RANGE(0x8000, 0x83ff) AM_RAM AM_BASE(&gyruss_colorram)
86   AM_RANGE(0x8400, 0x87ff) AM_RAM AM_BASE(&gyruss_videoram)
87   AM_RANGE(0x9000, 0x9fff) AM_RAM
88   AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_SHARE(1)
89   AM_RANGE(0xc000, 0xc000) AM_READWRITE(input_port_4_r, MWA8_NOP)   /* watchdog reset */
90   AM_RANGE(0xc080, 0xc080) AM_READWRITE(input_port_0_r, gyruss_sh_irqtrigger_w)
91   AM_RANGE(0xc0a0, 0xc0a0) AM_READ(input_port_1_r)
92   AM_RANGE(0xc0c0, 0xc0c0) AM_READ(input_port_2_r)
93   AM_RANGE(0xc0e0, 0xc0e0) AM_READ(input_port_3_r)
94   AM_RANGE(0xc100, 0xc100) AM_READWRITE(input_port_5_r, soundlatch_w)
95   AM_RANGE(0xc180, 0xc180) AM_WRITE(interrupt_enable_w)
96   AM_RANGE(0xc185, 0xc185) AM_WRITE(MWA8_RAM) AM_BASE(&gyruss_flipscreen)
9297ADDRESS_MAP_END
9398
94static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
95   AM_RANGE(0x0000, 0x7fff) AM_WRITE(MWA8_ROM)                 /* rom space+1        */
96   AM_RANGE(0x8000, 0x83ff) AM_WRITE(MWA8_RAM) AM_BASE(&colorram)
97   AM_RANGE(0x8400, 0x87ff) AM_WRITE(MWA8_RAM) AM_BASE(&videoram) AM_SIZE(&videoram_size)
98   AM_RANGE(0x9000, 0x9fff) AM_WRITE(MWA8_RAM)
99   AM_RANGE(0xa000, 0xa7ff) AM_WRITE(MWA8_RAM) AM_SHARE(1)
100   AM_RANGE(0xc000, 0xc000) AM_WRITE(MWA8_NOP)   /* watchdog reset */
101   AM_RANGE(0xc080, 0xc080) AM_WRITE(gyruss_sh_irqtrigger_w)
102   AM_RANGE(0xc100, 0xc100) AM_WRITE(soundlatch_w)         /* command to soundb  */
103   AM_RANGE(0xc180, 0xc180) AM_WRITE(interrupt_enable_w)      /* NMI enable         */
104   AM_RANGE(0xc185, 0xc185) AM_WRITE(gyruss_flipscreen_w)
105ADDRESS_MAP_END
106
107static ADDRESS_MAP_START( m6809_readmem, ADDRESS_SPACE_PROGRAM, 8 )
99static ADDRESS_MAP_START( main_cpu2_map, ADDRESS_SPACE_PROGRAM, 8 )
108100   AM_RANGE(0x0000, 0x0000) AM_READ(gyruss_scanline_r)
109   AM_RANGE(0x4000, 0x47ff) AM_READ(MRA8_RAM)
110   AM_RANGE(0x6000, 0x67ff) AM_READ(MRA8_RAM) AM_SHARE(1)
111   AM_RANGE(0xe000, 0xffff) AM_READ(MRA8_ROM)
112ADDRESS_MAP_END
113
114static ADDRESS_MAP_START( m6809_writemem, ADDRESS_SPACE_PROGRAM, 8 )
115101   AM_RANGE(0x2000, 0x2000) AM_WRITE(interrupt_enable_w)
116   AM_RANGE(0x4000, 0x47ff) AM_WRITE(MWA8_RAM)
117   AM_RANGE(0x4040, 0x40ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
118   AM_RANGE(0x6000, 0x67ff) AM_WRITE(MWA8_RAM) AM_SHARE(1)
119   AM_RANGE(0xe000, 0xffff) AM_WRITE(MWA8_ROM)
102   AM_RANGE(0x4000, 0x403f) AM_RAM
103   AM_RANGE(0x4040, 0x40ff) AM_READWRITE(MRA8_RAM, gyruss_spriteram_w) AM_BASE(&gyruss_spriteram)
104   AM_RANGE(0x4100, 0x47ff) AM_RAM
105   AM_RANGE(0x6000, 0x67ff) AM_RAM AM_SHARE(1)
106   AM_RANGE(0xe000, 0xffff) AM_ROM
120107ADDRESS_MAP_END
121108
122static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
123   AM_RANGE(0x0000, 0x5fff) AM_READ(MRA8_ROM)                 /* rom soundboard     */
124   AM_RANGE(0x6000, 0x63ff) AM_READ(MRA8_RAM)                 /* ram soundboard     */
109static ADDRESS_MAP_START( audio_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
110   AM_RANGE(0x0000, 0x5fff) AM_ROM
111   AM_RANGE(0x6000, 0x63ff) AM_RAM
125112   AM_RANGE(0x8000, 0x8000) AM_READ(soundlatch_r)
126113ADDRESS_MAP_END
127114
128static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
129   AM_RANGE(0x0000, 0x5fff) AM_WRITE(MWA8_ROM)                 /* rom soundboard     */
130   AM_RANGE(0x6000, 0x63ff) AM_WRITE(MWA8_RAM)                 /* ram soundboard     */
131ADDRESS_MAP_END
132
133static ADDRESS_MAP_START( sound_readport, ADDRESS_SPACE_IO, 8 )
115static ADDRESS_MAP_START( audio_cpu1_io_map, ADDRESS_SPACE_IO, 8 )
134116   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
135   AM_RANGE(0x01, 0x01) AM_READ(AY8910_read_port_0_r)
136     AM_RANGE(0x05, 0x05) AM_READ(AY8910_read_port_1_r)
137   AM_RANGE(0x09, 0x09) AM_READ(AY8910_read_port_2_r)
138     AM_RANGE(0x0d, 0x0d) AM_READ(AY8910_read_port_3_r)
139     AM_RANGE(0x11, 0x11) AM_READ(AY8910_read_port_4_r)
140ADDRESS_MAP_END
141
142static ADDRESS_MAP_START( sound_writeport, ADDRESS_SPACE_IO, 8 )
143   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
144117   AM_RANGE(0x00, 0x00) AM_WRITE(AY8910_control_port_0_w)
118   AM_RANGE(0x01, 0x01) AM_READ(AY8910_read_port_0_r)
145119   AM_RANGE(0x02, 0x02) AM_WRITE(AY8910_write_port_0_w)
146120   AM_RANGE(0x04, 0x04) AM_WRITE(AY8910_control_port_1_w)
121     AM_RANGE(0x05, 0x05) AM_READ(AY8910_read_port_1_r)
147122   AM_RANGE(0x06, 0x06) AM_WRITE(AY8910_write_port_1_w)
148123   AM_RANGE(0x08, 0x08) AM_WRITE(AY8910_control_port_2_w)
124   AM_RANGE(0x09, 0x09) AM_READ(AY8910_read_port_2_r)
149125   AM_RANGE(0x0a, 0x0a) AM_WRITE(AY8910_write_port_2_w)
150126   AM_RANGE(0x0c, 0x0c) AM_WRITE(AY8910_control_port_3_w)
127     AM_RANGE(0x0d, 0x0d) AM_READ(AY8910_read_port_3_r)
151128   AM_RANGE(0x0e, 0x0e) AM_WRITE(AY8910_write_port_3_w)
152129   AM_RANGE(0x10, 0x10) AM_WRITE(AY8910_control_port_4_w)
130     AM_RANGE(0x11, 0x11) AM_READ(AY8910_read_port_4_r)
153131   AM_RANGE(0x12, 0x12) AM_WRITE(AY8910_write_port_4_w)
154132   AM_RANGE(0x14, 0x14) AM_WRITE(gyruss_i8039_irq_w)
155133   AM_RANGE(0x18, 0x18) AM_WRITE(soundlatch2_w)
156134ADDRESS_MAP_END
157135
158static ADDRESS_MAP_START( i8039_readmem, ADDRESS_SPACE_PROGRAM, 8 )
159   AM_RANGE(0x0000, 0x0fff) AM_READ(MRA8_ROM)
136static ADDRESS_MAP_START( audio_cpu2_map, ADDRESS_SPACE_PROGRAM, 8 )
137   AM_RANGE(0x0000, 0x0fff) AM_ROM
160138ADDRESS_MAP_END
161139
162static ADDRESS_MAP_START( i8039_writemem, ADDRESS_SPACE_PROGRAM, 8 )
163   AM_RANGE(0x0000, 0x0fff) AM_WRITE(MWA8_ROM)
164ADDRESS_MAP_END
165
166static ADDRESS_MAP_START( i8039_readport, ADDRESS_SPACE_IO, 8 )
140static ADDRESS_MAP_START( audio_cpu2_io_map, ADDRESS_SPACE_IO, 8 )
167141   AM_RANGE(0x00, 0xff) AM_READ(soundlatch2_r)
168ADDRESS_MAP_END
169
170static ADDRESS_MAP_START( i8039_writeport, ADDRESS_SPACE_IO, 8 )
171142   AM_RANGE(I8039_p1, I8039_p1) AM_WRITE(DAC_0_data_w)
172143   AM_RANGE(I8039_p2, I8039_p2) AM_WRITE(MWA8_NOP)
173144ADDRESS_MAP_END
174145
146
175147#define GYRUSS_COMMON\
176148   PORT_START_TAG("IN0")\
177149   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )\
r1877r1878
234206   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
235207
236208static INPUT_PORTS_START( gyruss )
237GYRUSS_COMMON
209   GYRUSS_COMMON
238210
239211   PORT_START_TAG("DSW1")
240212   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
r1877r1878
271243/* This is identical to gyruss except for the bonus that has different
272244   values */
273245static INPUT_PORTS_START( gyrussce )
274GYRUSS_COMMON
246   GYRUSS_COMMON
275247
276248   PORT_START_TAG("DSW1")
277249   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
r1877r1878
316288   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
317289   16*8   /* every char takes 16 consecutive bytes */
318290};
291
319292static const gfx_layout spritelayout =
320293{
321294   8,16,   /* 8*16 sprites */
r1877r1878
329302};
330303
331304
332
333305static GFXDECODE_START( gyruss )
334306   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, spritelayout, 0, 16 )   /* upper half */
335307   GFXDECODE_ENTRY( REGION_GFX1, 0x0010, spritelayout, 0, 16 )   /* lower half */
r1877r1878
337309GFXDECODE_END
338310
339311
340
341312static const struct AY8910interface ay8910_interface_1 =
342313{
343314   0,
r1877r1878
365336
366337   /* basic machine hardware */
367338   MDRV_CPU_ADD(Z80, 3072000)   /* 3.072 MHz (?) */
368   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
369   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
339   MDRV_CPU_PROGRAM_MAP(main_cpu1_map,0)
340   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
370341
371342   MDRV_CPU_ADD(M6809, 2000000)        /* 2 MHz ??? */
372   MDRV_CPU_PROGRAM_MAP(m6809_readmem,m6809_writemem)
373   MDRV_CPU_VBLANK_INT(gyruss_6809_interrupt,256)
343   MDRV_CPU_PROGRAM_MAP(main_cpu2_map,0)
344   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
374345
375346   MDRV_CPU_ADD(Z80,14318180/4)
376347   /* audio CPU */   /* 3.579545 MHz */
377   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
378   MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
348   MDRV_CPU_PROGRAM_MAP(audio_cpu1_map,0)
349   MDRV_CPU_IO_MAP(audio_cpu1_io_map,0)
379350
380351   MDRV_CPU_ADD(I8039,8000000)
381352   /* audio CPU */   /* 8MHz crystal */
382   MDRV_CPU_PROGRAM_MAP(i8039_readmem,i8039_writemem)
383   MDRV_CPU_IO_MAP(i8039_readport,i8039_writeport)
353   MDRV_CPU_PROGRAM_MAP(audio_cpu2_map,0)
354   MDRV_CPU_IO_MAP(audio_cpu2_io_map,0)
384355
385356   /* video hardware */
386357   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/groundfx.c
r1877r1878
164164   {
165165      case 0x00:
166166      {
167         return (input_port_0_word_r(0,0) << 16) | input_port_1_word_r(0,0) |
167         return (input_port_0_word_r(machine,0,0) << 16) | input_port_1_word_r(machine,0,0) |
168168              (EEPROM_read_bit() << 7) | frame_counter;
169169      }
170170
171171      case 0x01:
172172      {
173         return input_port_2_word_r(0,0) | (coin_word << 16);
173         return input_port_2_word_r(machine,0,0) | (coin_word << 16);
174174      }
175175    }
176176
r1877r1878
185185      {
186186         if (ACCESSING_MSB32)   /* $500000 is watchdog */
187187         {
188            watchdog_reset_w(0,data >> 24);
188            watchdog_reset(machine);
189189         }
190190
191191         if (ACCESSING_LSB32)
r1877r1878
215215
216216static READ32_HANDLER( groundfx_adc_r )
217217{
218   return (input_port_3_word_r(0,0) << 8) | input_port_4_word_r(0,0);
218   return (input_port_3_word_r(machine,0,0) << 8) | input_port_4_word_r(machine,0,0);
219219}
220220
221221static WRITE32_HANDLER( groundfx_adc_w )
r1877r1878
409409   /* basic machine hardware */
410410   MDRV_CPU_ADD(M68EC020, 16000000)   /* 16 MHz */
411411   MDRV_CPU_PROGRAM_MAP(groundfx_readmem,groundfx_writemem)
412   MDRV_CPU_VBLANK_INT(groundfx_interrupt,1)
412   MDRV_CPU_VBLANK_INT("main", groundfx_interrupt)
413413
414414   TAITO_F3_SOUND_SYSTEM_CPU(16000000)
415415
src/mame/drivers/fastlane.c
r1877r1878
4242static WRITE8_HANDLER( k007121_registers_w )
4343{
4444   if (offset < 8)
45      K007121_ctrl_0_w(offset,data);
45      K007121_ctrl_0_w(machine,offset,data);
4646   else   /* scroll registers */
4747      fastlane_k007121_regs[offset] = data;
4848}
r1877r1878
7171
7272static READ8_HANDLER( fastlane_K007232_read_port_0_r )
7373{
74   return K007232_read_port_0_r(offset ^ 1);
74   return K007232_read_port_0_r(machine, offset ^ 1);
7575}
7676static WRITE8_HANDLER( fastlane_K007232_write_port_0_w )
7777{
78   K007232_write_port_0_w(offset ^ 1, data);
78   K007232_write_port_0_w(machine, offset ^ 1, data);
7979}
8080static READ8_HANDLER( fastlane_K007232_read_port_1_r )
8181{
82   return K007232_read_port_1_r(offset ^ 1);
82   return K007232_read_port_1_r(machine, offset ^ 1);
8383}
8484static WRITE8_HANDLER( fastlane_K007232_write_port_1_w )
8585{
86   K007232_write_port_1_w(offset ^ 1, data);
86   K007232_write_port_1_w(machine, offset ^ 1, data);
8787}
8888
8989
r1877r1878
279279   /* basic machine hardware */
280280   MDRV_CPU_ADD(HD6309, 3000000*4)      /* 24MHz/8? */
281281   MDRV_CPU_PROGRAM_MAP(fastlane_readmem,fastlane_writemem)
282   MDRV_CPU_VBLANK_INT(fastlane_interrupt,16)   /* 1 IRQ + ??? NMI (generated by the 007121) */
282   MDRV_CPU_VBLANK_INT_HACK(fastlane_interrupt,16)   /* 1 IRQ + ??? NMI (generated by the 007121) */
283283
284284   /* video hardware */
285285   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/gamecstl.c
r1877r1878
7070      palette_set_color(machine, i, cga_palette[i]);
7171}
7272
73static void draw_char(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, const gfx_element *gfx, int ch, int att, int x, int y)
73static void draw_char(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const gfx_element *gfx, int ch, int att, int x, int y)
7474{
7575   int i,j;
7676   UINT8 *dp;
r1877r1878
120120
121121static READ8_HANDLER(at_dma8237_1_r)
122122{
123   return dma8237_1_r(offset / 2);
123   return dma8237_1_r(machine, offset / 2);
124124}
125125
126126static WRITE8_HANDLER(at_dma8237_1_w)
127127{
128   dma8237_1_w(offset / 2, data);
128   dma8237_1_w(machine, offset / 2, data);
129129}
130130
131131static READ32_HANDLER(at32_dma8237_1_r)
132132{
133   return read32le_with_read8_handler(at_dma8237_1_r, offset, mem_mask);
133   return read32le_with_read8_handler(at_dma8237_1_r, machine, offset, mem_mask);
134134}
135135
136136static WRITE32_HANDLER(at32_dma8237_1_w)
137137{
138   write32le_with_write8_handler(at_dma8237_1_w, offset, data, mem_mask);
138   write32le_with_write8_handler(at_dma8237_1_w, machine, offset, data, mem_mask);
139139}
140140
141141
r1877r1878
303303
304304static READ32_HANDLER( ide0_r )
305305{
306   return ide_controller32_0_r(0x1f0/4 + offset, mem_mask);
306   return ide_controller32_0_r(machine, 0x1f0/4 + offset, mem_mask);
307307}
308308
309309static WRITE32_HANDLER( ide0_w )
310310{
311   ide_controller32_0_w(0x1f0/4 + offset, data, mem_mask);
311   ide_controller32_0_w(machine, 0x1f0/4 + offset, data, mem_mask);
312312}
313313
314314static READ32_HANDLER( fdc_r )
315315{
316   return ide_controller32_0_r(0x3f0/4 + offset, mem_mask);
316   return ide_controller32_0_r(machine, 0x3f0/4 + offset, mem_mask);
317317}
318318
319319static WRITE32_HANDLER( fdc_w )
320320{
321321   //mame_printf_debug("FDC: write %08X, %08X, %08X\n", data, offset, mem_mask);
322   ide_controller32_0_w(0x3f0/4 + offset, data, mem_mask);
322   ide_controller32_0_w(machine, 0x3f0/4 + offset, data, mem_mask);
323323}
324324
325325
r1877r1878
539539
540540/*****************************************************************************/
541541
542GAME(2002, gamecstl, 0,   gamecstl, gamecstl, gamecstl,   ROT0,   "Cristaltec",  "GameCristal", GAME_NOT_WORKING | GAME_NO_SOUND);
542GAME(2002, gamecstl, 0,   gamecstl, gamecstl, gamecstl,   ROT0,   "Cristaltec",  "GameCristal", GAME_NOT_WORKING | GAME_NO_SOUND)
543543
src/mame/drivers/segald.c
r1877r1878
3535static UINT8 ldv1000_output_latch;
3636
3737/* VIDEO GOODS */
38static void astron_draw_characters(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
38static void astron_draw_characters(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
3939{
4040   UINT8 characterX, characterY;
4141
r1877r1878
5050   }
5151}
5252
53static void astron_draw_sprites(mame_bitmap *bitmap, const rectangle *cliprect)
53static void astron_draw_sprites(bitmap_t *bitmap, const rectangle *cliprect)
5454{
5555   /* Heisted from Daphne */
5656   const UINT8 SPR_Y_TOP     = 0;
r1877r1878
346346   MDRV_CPU_ADD(Z80, SCHEMATIC_CLOCK/4)
347347   MDRV_CPU_PROGRAM_MAP(mainmem,0)
348348   MDRV_CPU_IO_MAP(mainport,0)
349   MDRV_CPU_VBLANK_INT(vblank_callback_astron, 1)
349   MDRV_CPU_VBLANK_INT("main", vblank_callback_astron)
350350   MDRV_CPU_PERIODIC_INT(nmi_line_pulse, 1000.0/59.94)
351351
352352   MDRV_MACHINE_START(astron)
src/mame/drivers/kangaroo.c
r1877r1878
372372   /* basic machine hardware */
373373   MDRV_CPU_ADD(Z80, MASTER_CLOCK/4)
374374   MDRV_CPU_PROGRAM_MAP(main_map,0)
375   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
375   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
376376
377377   MDRV_CPU_ADD(Z80, MASTER_CLOCK/8)
378378   MDRV_CPU_PROGRAM_MAP(sound_map,0)
379379   MDRV_CPU_IO_MAP(sound_portmap,0)
380   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
380   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
381381
382382   MDRV_MACHINE_START(kangaroo)
383383   MDRV_MACHINE_RESET(kangaroo)
src/mame/drivers/cabal.c
r1877r1878
105105
106106static WRITE16_HANDLER( cabal_sound_irq_trigger_word_w )
107107{
108   seibu_main_word_w(4,data,mem_mask);
108   seibu_main_word_w(machine,4,data,mem_mask);
109109
110110   /* spin for a while to let the Z80 read the command, otherwise coins "stick" */
111111   cpu_spinuntil_time(ATTOTIME_IN_USEC(50));
r1877r1878
540540   /* basic machine hardware */
541541   MDRV_CPU_ADD(M68000, 20000000/2) /* verified on pcb */
542542   MDRV_CPU_PROGRAM_MAP(readmem_cpu,writemem_cpu)
543   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
543   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
544544
545545   MDRV_CPU_ADD(Z80, 3579580) /* verified on pcb */
546546   /* audio CPU */
r1877r1878
585585   /* basic machine hardware */
586586   MDRV_CPU_ADD(M68000, 12000000) /* 12 MHz */
587587   MDRV_CPU_PROGRAM_MAP(cabalbl_readmem_cpu,cabalbl_writemem_cpu)
588   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
588   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
589589
590590   MDRV_CPU_ADD(Z80, 4000000)
591591   MDRV_CPU_PROGRAM_MAP(cabalbl_readmem_sound,cabalbl_writemem_sound)
src/mame/drivers/cidelsa.c
r1877r1878
8989   switch (data)
9090   {
9191   case 0x01:
92      AY8910_write_port_0_w(0, draco_ay_latch);
92      AY8910_write_port_0_w(machine, 0, draco_ay_latch);
9393      break;
9494
9595   case 0x02:
96      draco_ay_latch = AY8910_read_port_0_r(0);
96      draco_ay_latch = AY8910_read_port_0_r(machine, 0);
9797      break;
9898
9999   case 0x03:
100      AY8910_control_port_0_w(0, draco_ay_latch);
100      AY8910_control_port_0_w(machine, 0, draco_ay_latch);
101101      break;
102102   }
103103}
r1877r1878
217217{
218218   int addr = cdp1869_get_cma(offset);
219219   cidelsa_pcb[addr] = activecpu_get_reg(CDP1802_Q);
220   cdp1869_charram_w(offset, data);
220   cdp1869_charram_w(machine, offset, data);
221221}
222222
223223static READ8_HANDLER ( cidelsa_charram_r )
224224{
225225   int addr = cdp1869_get_cma(offset);
226226   cdp1869_pcb = cidelsa_pcb[addr];
227   return cdp1869_charram_r(offset);
227   return cdp1869_charram_r(machine,offset);
228228}
229229
230230/* Memory Maps */
r1877r1878
517517   MDRV_CPU_PROGRAM_MAP(destryer_map, 0)
518518   MDRV_CPU_IO_MAP(destryer_io_map, 0)
519519   MDRV_CPU_CONFIG(cidelsa_cdp1802_config)
520   MDRV_CPU_VBLANK_INT(altair_interrupt, CDP1869_TOTAL_SCANLINES_PAL)
520   MDRV_CPU_VBLANK_INT_HACK(altair_interrupt, CDP1869_TOTAL_SCANLINES_PAL)
521521   MDRV_NVRAM_HANDLER(generic_0fill)
522522   MDRV_MACHINE_START(destryer)
523523   MDRV_MACHINE_RESET(destryer)
r1877r1878
550550   MDRV_CPU_PROGRAM_MAP(destryea_map, 0)
551551   MDRV_CPU_IO_MAP(destryer_io_map, 0)
552552   MDRV_CPU_CONFIG(cidelsa_cdp1802_config)
553   MDRV_CPU_VBLANK_INT(altair_interrupt, CDP1869_TOTAL_SCANLINES_PAL)
553   MDRV_CPU_VBLANK_INT_HACK(altair_interrupt, CDP1869_TOTAL_SCANLINES_PAL)
554554   MDRV_NVRAM_HANDLER(generic_0fill)
555555   MDRV_MACHINE_START(destryer)
556556   MDRV_MACHINE_RESET(destryer)
r1877r1878
583583   MDRV_CPU_PROGRAM_MAP(altair_map, 0)
584584   MDRV_CPU_IO_MAP(altair_io_map, 0)
585585   MDRV_CPU_CONFIG(cidelsa_cdp1802_config)
586   MDRV_CPU_VBLANK_INT(altair_interrupt, CDP1869_TOTAL_SCANLINES_PAL)
586   MDRV_CPU_VBLANK_INT_HACK(altair_interrupt, CDP1869_TOTAL_SCANLINES_PAL)
587587   MDRV_MACHINE_START(destryer)
588588   MDRV_MACHINE_RESET(destryer)
589589
r1877r1878
615615   MDRV_CPU_PROGRAM_MAP(draco_map, 0)
616616   MDRV_CPU_IO_MAP(draco_io_map, 0)
617617   MDRV_CPU_CONFIG(cidelsa_cdp1802_config)
618   MDRV_CPU_VBLANK_INT(draco_interrupt, CDP1869_TOTAL_SCANLINES_PAL)
618   MDRV_CPU_VBLANK_INT_HACK(draco_interrupt, CDP1869_TOTAL_SCANLINES_PAL)
619619   MDRV_NVRAM_HANDLER(generic_0fill)
620620   MDRV_MACHINE_START(draco)
621621   MDRV_MACHINE_RESET(destryer)
src/mame/drivers/tickee.c
r1877r1878
112112 *
113113 *************************************/
114114
115static void scanline_update(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params)
115static void scanline_update(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params)
116116{
117117   UINT16 *src = &tickee_vram[(params->rowaddr << 8) & 0x3ff00];
118118   UINT32 *dest = BITMAP_ADDR32(bitmap, scanline, 0);
r1877r1878
159159
160160static READ8_HANDLER( port1_r )
161161{
162   return input_port_1_r(offset) | (ticket_dispenser_0_r(0) >> 5) | (ticket_dispenser_1_r(0) >> 6);
162   return input_port_1_r(machine, offset) | (ticket_dispenser_0_r(machine, 0) >> 5) | (ticket_dispenser_1_r(machine, 0) >> 6);
163163}
164164
165165static READ8_HANDLER( port2_r )
166166{
167   return input_port_3_r(offset) | (ticket_dispenser_0_r(0) >> 5) | (ticket_dispenser_1_r(0) >> 6);
167   return input_port_3_r(machine, offset) | (ticket_dispenser_0_r(machine, 0) >> 5) | (ticket_dispenser_1_r(machine, 0) >> 6);
168168}
169169
170170
r1877r1878
190190
191191   if (offset == 3)
192192   {
193      ticket_dispenser_0_w(0, (data & 8) << 4);
194      ticket_dispenser_1_w(0, (data & 4) << 5);
193      ticket_dispenser_0_w(machine, 0, (data & 8) << 4);
194      ticket_dispenser_1_w(machine, 0, (data & 4) << 5);
195195   }
196196
197197   if (olddata != tickee_control[offset])
src/mame/drivers/hotblock.c
r1877r1878
188188   MDRV_CPU_ADD(I8088, 10000000)
189189   MDRV_CPU_PROGRAM_MAP(hotblock_map, 0)
190190   MDRV_CPU_IO_MAP(hotblock_io,0)
191   MDRV_CPU_VBLANK_INT(hotblocks_irq,1)
191   MDRV_CPU_VBLANK_INT("main", hotblocks_irq)
192192
193193   /* video hardware */
194194   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/srmp5.c
r1877r1878
2929*/
3030
3131#include "driver.h"
32#include "deprecat.h"
3233#include "cpu/mips/r3000.h"
3334#include "sound/st0016.h"
3435#include "st0016.h"
r1877r1878
624625   MDRV_CPU_ADD_TAG("main",Z80,8000000)
625626   MDRV_CPU_PROGRAM_MAP(st0016_mem,0)
626627   MDRV_CPU_IO_MAP(st0016_io,0)
627   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
628   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
628629
629  MDRV_CPU_ADD(R3000LE, 40000000)
630   MDRV_CPU_ADD(R3000LE, 40000000)
630631   MDRV_CPU_CONFIG(config)
631   MDRV_CPU_VBLANK_INT(irq4_line_hold,2)
632   MDRV_CPU_VBLANK_INT_HACK(irq4_line_hold,2)
632633   MDRV_CPU_PROGRAM_MAP(srmp5_mem,0)
633634
634635
src/mame/drivers/suprloco.c
r1877r1878
3232
3333static WRITE8_HANDLER( suprloco_soundport_w )
3434{
35   soundlatch_w(0,data);
36   cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
35   soundlatch_w(machine,0,data);
36   cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
3737   /* spin for a while to let the Z80 read the command (fixes hanging sound in Regulus) */
3838   cpu_spinuntil_time(ATTOTIME_IN_USEC(50));
3939}
r1877r1878
170170   /* basic machine hardware */
171171   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz (?) */
172172   MDRV_CPU_PROGRAM_MAP(main_map,0)
173   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
173   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
174174
175175   MDRV_CPU_ADD(Z80, 4000000)
176176   /* audio CPU */
177177   MDRV_CPU_PROGRAM_MAP(sound_map,0)
178   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)         /* NMIs are caused by the main CPU */
178   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)         /* NMIs are caused by the main CPU */
179179
180180   /* video hardware */
181181   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/m92.c
r1877r1878
333333static WRITE16_HANDLER( m92_soundlatch_w )
334334{
335335   timer_call_after_resynch(NULL, V30_ASSERT, setvector_callback);
336   soundlatch_w(0, data & 0xff);
336   soundlatch_w(machine, 0, data & 0xff);
337337}
338338
339339static READ16_HANDLER( m92_sound_status_r )
r1877r1878
344344
345345static READ16_HANDLER( m92_soundlatch_r )
346346{
347   return soundlatch_r(offset) | 0xff00;
347   return soundlatch_r(machine, offset) | 0xff00;
348348}
349349
350350static WRITE16_HANDLER( m92_sound_irq_ack_w )
src/mame/drivers/hal21.c
r1877r1878
7272   aso_scroll_sync[offset] = data;
7373}
7474
75static void hal21_sound_scheduler(int mode, int data)
75static void hal21_sound_scheduler(running_machine *machine, int mode, int data)
7676{
7777   static int busy, hold, ffcount, ffhead, fftail;
7878
r1877r1878
116116   }
117117
118118   snk_sound_busy_bit = 0x20;
119   soundlatch_w(0, data);
120   cpunum_set_input_line(Machine, 2, INPUT_LINE_NMI, PULSE_LINE);
119   soundlatch_w(machine, 0, data);
120   cpunum_set_input_line(machine, 2, INPUT_LINE_NMI, PULSE_LINE);
121121}
122122
123123/**************************************************************************/
r1877r1878
180180}
181181
182182
183static void hal21_draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int scrollx, int scrolly, int attrs,
183static void hal21_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int scrollx, int scrolly, int attrs,
184184                        const gfx_element *gfx )
185185{
186186   static int color[2] = {8, 8};
r1877r1878
218218      }
219219}
220220
221static void hal21_draw_sprites(mame_bitmap *bitmap, const rectangle *cliprect, int scrollx, int scrolly,
221static void hal21_draw_sprites(bitmap_t *bitmap, const rectangle *cliprect, int scrollx, int scrolly,
222222                        const gfx_element *gfx )
223223{
224224   UINT8 *sprptr, *endptr;
r1877r1878
248248   }
249249}
250250
251static void aso_draw_background(mame_bitmap *bitmap, const rectangle *cliprect, int scrollx, int scrolly, int attrs,
251static void aso_draw_background(bitmap_t *bitmap, const rectangle *cliprect, int scrollx, int scrolly, int attrs,
252252                        const gfx_element *gfx )
253253{
254254   int bankbase, c, x, y, offsx, offsy, dx, dy, sx, sy, offs, tile_number;
r1877r1878
278278      }
279279}
280280
281static void aso_draw_sprites(mame_bitmap *bitmap, const rectangle *cliprect, int scrollx, int scrolly,
281static void aso_draw_sprites(bitmap_t *bitmap, const rectangle *cliprect, int scrollx, int scrolly,
282282                        const gfx_element *gfx )
283283{
284284   UINT8 *sprptr, *endptr;
r1877r1878
551551
552552static READ8_HANDLER( CPUC_ready_r ) { snk_sound_busy_bit = 0; return 0; }
553553
554static READ8_HANDLER( hal21_input_port_0_r ) { return input_port_0_r(0) | snk_sound_busy_bit; }
554static READ8_HANDLER( hal21_input_port_0_r ) { return input_port_0_r(machine,0) | snk_sound_busy_bit; }
555555
556static WRITE8_HANDLER( hal21_soundcommand_w ) { hal21_sound_scheduler(1, data); }
557static WRITE8_HANDLER( hal21_soundack_w ) { hal21_sound_scheduler(2, data); }
556static WRITE8_HANDLER( hal21_soundcommand_w ) { hal21_sound_scheduler(machine, 1, data); }
557static WRITE8_HANDLER( hal21_soundack_w ) { hal21_sound_scheduler(machine,2, data); }
558558
559559static READ8_HANDLER( hal21_soundcommand_r )
560560{
561   int data = soundlatch_r(0);
562   soundlatch_clear_w(0, 0);
561   int data = soundlatch_r(machine, 0);
562   soundlatch_clear_w(machine, 0, 0);
563563   return data;
564564}
565565
566566static WRITE8_HANDLER( aso_soundcommand_w )
567567{
568568   snk_sound_busy_bit = 0x20;
569   soundlatch_w(0, data);
570   cpunum_set_input_line(Machine, 2, 0, HOLD_LINE );
569   soundlatch_w(machine, 0, data);
570   cpunum_set_input_line(machine, 2, 0, HOLD_LINE );
571571}
572572
573573static INTERRUPT_GEN( hal21_sound_interrupt )
574574{
575   hal21_sound_scheduler(3, 0);
575   hal21_sound_scheduler(machine, 3, 0);
576576}
577577
578578/**************************************************************************/
r1877r1878
691691static MACHINE_RESET( aso )
692692{
693693   memset(hal21_vreg, 0, 8);
694   hal21_sound_scheduler(0, 0);
694   hal21_sound_scheduler(machine, 0, 0);
695695   snk_sound_busy_bit = 0;
696696}
697697
r1877r1878
700700   /* basic machine hardware */
701701   MDRV_CPU_ADD(Z80, 4000000)
702702   MDRV_CPU_PROGRAM_MAP(aso_cpuA_map,0)
703   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
703   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
704704
705705   MDRV_CPU_ADD(Z80, 4000000)
706706   MDRV_CPU_PROGRAM_MAP(aso_cpuB_map,0)
707   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
707   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
708708
709709   MDRV_CPU_ADD(Z80, 4000000)
710710   /* audio CPU */
711711   MDRV_CPU_PROGRAM_MAP(aso_sound_map,0)
712   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
712   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
713713
714714   MDRV_INTERLEAVE(100)
715715
r1877r1878
744744   /* basic machine hardware */
745745   MDRV_CPU_ADD(Z80, 4000000)
746746   MDRV_CPU_PROGRAM_MAP(hal21_cpuA_map,0)
747   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
747   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
748748
749749   MDRV_CPU_ADD(Z80, 4000000)
750750   MDRV_CPU_PROGRAM_MAP(hal21_cpuB_map,0)
751   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
751   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
752752
753753   MDRV_CPU_ADD(Z80, 4000000)
754754   /* audio CPU */
755755   MDRV_CPU_PROGRAM_MAP(hal21_sound_map,0)
756756   MDRV_CPU_IO_MAP(hal21_sound_portmap,0)
757   MDRV_CPU_VBLANK_INT(hal21_sound_interrupt,1)
757   MDRV_CPU_VBLANK_INT("main", hal21_sound_interrupt)
758758   MDRV_CPU_PERIODIC_INT(irq0_line_hold, 220) // music tempo, hand tuned
759759
760760   MDRV_INTERLEAVE(100)
src/mame/drivers/m58.c
r1877r1878
192192   /* basic machine hardware */
193193   MDRV_CPU_ADD(Z80, MASTER_CLOCK/3/2)
194194   MDRV_CPU_PROGRAM_MAP(yard_map, 0)
195   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
195   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
196196
197197   /* video hardware */
198198   MDRV_GFXDECODE(yard)
src/mame/drivers/vendetta.c
r1877r1878
188188
189189/********************************************/
190190
191static READ8_HANDLER( vendetta_K052109_r ) { return K052109_r( offset + 0x2000 ); }
192//static WRITE8_HANDLER( vendetta_K052109_w ) { K052109_w( offset + 0x2000, data ); }
191static READ8_HANDLER( vendetta_K052109_r ) { return K052109_r( machine, offset + 0x2000 ); }
192//static WRITE8_HANDLER( vendetta_K052109_w ) { K052109_w( machine, offset + 0x2000, data ); }
193193static WRITE8_HANDLER( vendetta_K052109_w ) {
194194   // *************************************************************************************
195195   // *  Escape Kids uses 052109's mirrored Tilemap ROM bank selector, but only during    *
196196   // *  Tilemap MASK-ROM Test       (0x1d80<->0x3d80, 0x1e00<->0x3e00, 0x1f00<->0x3f00)  *
197197   // *************************************************************************************
198   if ( ( offset == 0x1d80 ) || ( offset == 0x1e00 ) || ( offset == 0x1f00 ) )      K052109_w( offset, data );
199   K052109_w( offset + 0x2000, data );
198   if ( ( offset == 0x1d80 ) || ( offset == 0x1e00 ) || ( offset == 0x1f00 ) )      K052109_w( machine, offset, data );
199   K052109_w( machine, offset + 0x2000, data );
200200}
201201
202202static offs_t video_banking_base;
r1877r1878
240240
241241static WRITE8_HANDLER( z80_arm_nmi_w )
242242{
243   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, CLEAR_LINE );
243   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, CLEAR_LINE );
244244
245245   timer_set( ATTOTIME_IN_USEC( 25 ), NULL, 0, z80_nmi_callback );
246246}
247247
248248static WRITE8_HANDLER( z80_irq_w )
249249{
250   cpunum_set_input_line_and_vector(Machine, 1, 0, HOLD_LINE, 0xff );
250   cpunum_set_input_line_and_vector(machine, 1, 0, HOLD_LINE, 0xff );
251251}
252252
253253static READ8_HANDLER( vendetta_sound_interrupt_r )
254254{
255   cpunum_set_input_line_and_vector(Machine, 1, 0, HOLD_LINE, 0xff );
255   cpunum_set_input_line_and_vector(machine, 1, 0, HOLD_LINE, 0xff );
256256   return 0x00;
257257}
258258
259259static READ8_HANDLER( vendetta_sound_r )
260260{
261   return K053260_0_r(2 + offset);
261   return K053260_0_r(machine, 2 + offset);
262262}
263263
264264/********************************************/
r1877r1878
581581   MDRV_CPU_ADD_TAG("main", KONAMI, 6000000)   /* this is strange, seems an overclock but */
582582//  MDRV_CPU_ADD_TAG("main", KONAMI, 3000000)   /* is needed to have correct music speed */
583583   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
584   MDRV_CPU_VBLANK_INT(vendetta_irq,1)
584   MDRV_CPU_VBLANK_INT("main", vendetta_irq)
585585
586586   MDRV_CPU_ADD(Z80, 3579545)   /* verified with PCB */
587587   /* audio CPU */
src/mame/drivers/fcombat.c
r1877r1878
5757extern int fcombat_sh;
5858extern int fcombat_sv;
5959
60
61static INPUT_CHANGED( coin_inserted )
62{
63   /* coin insertion causes an NMI */
64   cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE);
65}
66
67
6068static INPUT_PORTS_START( fcombat )
6169   PORT_START_TAG("IN0")      /* player 1 inputs (muxed on 0xe000) */
6270   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
r1877r1878
113121   PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
114122   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
115123
116   PORT_START_TAG("FAKE")
117   /* The coin slots are not memory mapped. */
118   /* This fake input port is used by the interrupt */
119   /* handler to be notified of coin insertions. We use IMPULSE to */
120   /* trigger exactly one interrupt, without having to check when the */
121   /* user releases the key. */
122   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
124   PORT_START_TAG("COIN")
125   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
123126INPUT_PORTS_END
124127
125128
r1877r1878
143146static READ8_HANDLER( fcombat_port01_r )
144147{
145148   /* the cocktail flip bit muxes between ports 0 and 1 */
146   return fcombat_cocktail_flip ? input_port_1_r(offset) : input_port_0_r(offset);
149   return fcombat_cocktail_flip ? input_port_1_r(machine,offset) : input_port_0_r(machine,offset);
147150}
148151
149152
r1877r1878
192195
193196}
194197
195static ADDRESS_MAP_START( fcombat_readmem, ADDRESS_SPACE_PROGRAM, 8 )
196   AM_RANGE(0x0000, 0x7fff) AM_READ(MRA8_ROM)
198static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
199   AM_RANGE(0x0000, 0x7fff) AM_ROM
200   AM_RANGE(0xc000, 0xc7ff) AM_RAM
201   AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size)
202   AM_RANGE(0xd800, 0xd8ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
197203   AM_RANGE(0xe000, 0xe000) AM_READ(fcombat_port01_r)
198204   AM_RANGE(0xe100, 0xe100) AM_READ(input_port_2_r)
199205   AM_RANGE(0xe200, 0xe200) AM_READ(input_port_3_r)
200206   AM_RANGE(0xe300, 0xe300) AM_READ(e300_r)
201207   AM_RANGE(0xe400, 0xe400) AM_READ(fcombat_protection_r) // protection?
202   AM_RANGE(0xc000, 0xc7ff) AM_READ(MRA8_RAM)
203   AM_RANGE(0xd000, 0xd7ff) AM_READ(MRA8_RAM)
204   AM_RANGE(0xd800, 0xd8ff) AM_READ(MRA8_RAM)
205ADDRESS_MAP_END
206
207static ADDRESS_MAP_START( fcombat_writemem, ADDRESS_SPACE_PROGRAM, 8 )
208   AM_RANGE(0x0000, 0x7fff) AM_WRITE(MWA8_ROM)
209   AM_RANGE(0xc000, 0xc7ff) AM_WRITE(MWA8_RAM)
210   AM_RANGE(0xd000, 0xd7ff) AM_WRITE(MWA8_RAM) AM_BASE(&videoram) AM_SIZE(&videoram_size)
211   AM_RANGE(0xd800, 0xd8ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
212
213208   AM_RANGE(0xe800, 0xe800) AM_WRITE(fcombat_videoreg_w)   // at least bit 0 for flip screen and joystick input multiplexor
214
215209   AM_RANGE(0xe900, 0xe900) AM_WRITE(e900_w)
216210   AM_RANGE(0xea00, 0xea00) AM_WRITE(ea00_w)
217211   AM_RANGE(0xeb00, 0xeb00) AM_WRITE(eb00_w)
218
219212   AM_RANGE(0xec00, 0xec00) AM_WRITE(ec00_w)
220213   AM_RANGE(0xed00, 0xed00) AM_WRITE(ed00_w)
221
222214   AM_RANGE(0xee00, 0xee00) AM_WRITE(ee00_w)   // related to protection ? - doesn't seem to have any effect
223
224   /* erk ... */
225215   AM_RANGE(0xef00, 0xef00) AM_WRITE(soundlatch_w)
226216ADDRESS_MAP_END
227217
228/* sound cpu */
229218
230static ADDRESS_MAP_START( fcombat_readmem2, ADDRESS_SPACE_PROGRAM, 8 )
231   AM_RANGE(0x0000, 0x3fff) AM_READ(MRA8_ROM)
232   AM_RANGE(0x4000, 0x47ff) AM_READ(MRA8_RAM)
219static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 )
220   AM_RANGE(0x0000, 0x3fff) AM_ROM
221   AM_RANGE(0x4000, 0x47ff) AM_RAM
233222   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
234223   AM_RANGE(0x8001, 0x8001) AM_READ(AY8910_read_port_0_r)
235   AM_RANGE(0xa001, 0xa001) AM_READ(AY8910_read_port_1_r)
236   AM_RANGE(0xc001, 0xc001) AM_READ(AY8910_read_port_2_r)
237ADDRESS_MAP_END
238
239static ADDRESS_MAP_START( fcombat_writemem2, ADDRESS_SPACE_PROGRAM, 8 )
240   AM_RANGE(0x0000, 0x3fff) AM_WRITE(MWA8_ROM)
241   AM_RANGE(0x4000, 0x47ff) AM_WRITE(MWA8_RAM)
242224   AM_RANGE(0x8002, 0x8002) AM_WRITE(AY8910_write_port_0_w)
243225   AM_RANGE(0x8003, 0x8003) AM_WRITE(AY8910_control_port_0_w)
226   AM_RANGE(0xa001, 0xa001) AM_READ(AY8910_read_port_1_r)
244227   AM_RANGE(0xa002, 0xa002) AM_WRITE(AY8910_write_port_1_w)
245228   AM_RANGE(0xa003, 0xa003) AM_WRITE(AY8910_control_port_1_w)
229   AM_RANGE(0xc001, 0xc001) AM_READ(AY8910_read_port_2_r)
246230   AM_RANGE(0xc002, 0xc002) AM_WRITE(AY8910_write_port_2_w)
247231   AM_RANGE(0xc003, 0xc003) AM_WRITE(AY8910_control_port_2_w)
248232ADDRESS_MAP_END
249233
234
235
250236/*************************************
251237 *
252238 *  Graphics layouts
r1877r1878
286272   GFXDECODE_ENTRY( REGION_GFX3, 0, spritelayout,     512, 64 )
287273GFXDECODE_END
288274
289/*************************************
290 *
291 *  Sound interfaces
292 *
293 *************************************/
294275
295/* interrupt */
296276
297
298static INTERRUPT_GEN( fcombat_interrupt )
299{
300   /* Exerion triggers NMIs on coin insertion */
301   if (readinputport(4) & 1)
302      cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
303}
304
305277/*************************************
306278 *
307279 *  Machine drivers
r1877r1878
311283static MACHINE_DRIVER_START( fcombat )
312284
313285   MDRV_CPU_ADD(Z80, 10000000/3)
314   MDRV_CPU_PROGRAM_MAP(fcombat_readmem,fcombat_writemem)
315   MDRV_CPU_VBLANK_INT(fcombat_interrupt,1)
286   MDRV_CPU_PROGRAM_MAP(main_map,0)
316287
317288   MDRV_CPU_ADD(Z80, 10000000/3)
318   MDRV_CPU_PROGRAM_MAP(fcombat_readmem2,fcombat_writemem2)
289   MDRV_CPU_PROGRAM_MAP(audio_map,0)
319290
320291   /* video hardware */
321292   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
329300   MDRV_VIDEO_START(fcombat)
330301   MDRV_VIDEO_UPDATE(fcombat)
331302
332   /* sound hardware */
303   /* audio hardware */
333304   MDRV_SPEAKER_STANDARD_MONO("mono")
334305
335306   MDRV_SOUND_ADD(AY8910, 1500000)
src/mame/drivers/destroyr.c
r1877r1878
8181{
8282   destroyr_cursor = data;
8383
84   watchdog_reset_w(offset, data);
84   watchdog_reset_w(machine, offset, data);
8585}
8686
8787
r1877r1878
122122      /* bit 0 => low explosion */
123123      break;
124124   case 8:
125      destroyr_misc_w(offset, data);
125      destroyr_misc_w(machine, offset, data);
126126      break;
127127   default:
128128      logerror("unmapped output port %d\n", offset);
r1877r1878
341341   /* basic machine hardware */
342342   MDRV_CPU_ADD(M6800, 12096000 / 16)
343343   MDRV_CPU_PROGRAM_MAP(destroyr_map, 0)
344   MDRV_CPU_VBLANK_INT(irq0_line_assert, 4)
344   MDRV_CPU_VBLANK_INT_HACK(irq0_line_assert, 4)
345345
346346   MDRV_MACHINE_RESET(destroyr)
347347
src/mame/drivers/segas16b.c
r1877r1878
893893
894894static UINT8 has_sound_cpu;
895895
896static read16_handler custom_io_r;
897static write16_handler custom_io_w;
896static read16_machine_func custom_io_r;
897static write16_machine_func custom_io_w;
898898
899899static UINT8 disable_screen_blanking;
900900static UINT8 mj_input_num;
901901static UINT8 hwc_input_value;
902902
903static void (*i8751_vblank_hook)(void);
903static void (*i8751_vblank_hook)(running_machine *machine);
904904static const UINT8 *i8751_initial_config;
905905
906906
r1877r1878
10221022{
10231023   if (has_sound_cpu)
10241024   {
1025      soundlatch_w(0, data & 0xff);
1025      soundlatch_w(Machine, 0, data & 0xff);
10261026      cpunum_set_input_line(Machine, 1, 0, HOLD_LINE);
10271027   }
10281028}
r1877r1878
11261126         return readinputport(4 + (offset & 1));
11271127   }
11281128   logerror("%06X:standard_io_r - unknown read access to address %04X\n", activecpu_get_pc(), offset * 2);
1129   return segaic16_open_bus_r(0,0);
1129   return segaic16_open_bus_r(machine,0,0);
11301130}
11311131
11321132
r1877r1878
11631163static READ16_HANDLER( misc_io_r )
11641164{
11651165   if (custom_io_r)
1166      return (*custom_io_r)(offset, mem_mask);
1166      return (*custom_io_r)(machine, offset, mem_mask);
11671167   else
1168      return standard_io_r(offset, mem_mask);
1168      return standard_io_r(machine, offset, mem_mask);
11691169}
11701170
11711171
11721172static WRITE16_HANDLER( misc_io_w )
11731173{
11741174   if (custom_io_w)
1175      (*custom_io_w)(offset, data, mem_mask);
1175      (*custom_io_w)(machine, offset, data, mem_mask);
11761176   else
1177      standard_io_w(offset, data, mem_mask);
1177      standard_io_w(machine, offset, data, mem_mask);
11781178}
11791179
11801180
r1877r1878
11991199   {
12001200      case 0x0000/2:
12011201         /* multiply registers */
1202         return segaic16_multiply_0_r(offset & 3, mem_mask);
1202         return segaic16_multiply_0_r(machine, offset & 3, mem_mask);
12031203
12041204      case 0x1000/2:
12051205         /* compare registers */
1206         return segaic16_compare_timer_0_r(offset & 7, mem_mask);
1206         return segaic16_compare_timer_0_r(machine, offset & 7, mem_mask);
12071207   }
1208   return segaic16_open_bus_r(0,0);
1208   return segaic16_open_bus_r(machine,0,0);
12091209}
12101210
12111211
r1877r1878
12161216   {
12171217      case 0x0000/2:
12181218         /* multiply registers */
1219         segaic16_multiply_0_w(offset & 3, data, mem_mask);
1219         segaic16_multiply_0_w(machine, offset & 3, data, mem_mask);
12201220         break;
12211221
12221222      case 0x1000/2:
12231223         /* compare registers */
1224         segaic16_compare_timer_0_w(offset & 7, data, mem_mask);
1224         segaic16_compare_timer_0_w(machine, offset & 7, data, mem_mask);
12251225         break;
12261226
12271227      case 0x2000/2:
r1877r1878
12351235static READ16_HANDLER( unknown_rgn2_r )
12361236{
12371237   logerror("Region 2: read from %04X\n", offset * 2);
1238   return segaic16_compare_timer_1_r(offset & 7, mem_mask);
1238   return segaic16_compare_timer_1_r(machine, offset & 7, mem_mask);
12391239}
12401240
12411241
12421242static WRITE16_HANDLER( unknown_rgn2_w )
12431243{
12441244   logerror("Region 2: write to %04X = %04X & %04X\n", offset * 2, data, mem_mask ^ 0xffff);
1245   segaic16_compare_timer_1_w(offset & 7, data, mem_mask);
1245   segaic16_compare_timer_1_w(machine, offset & 7, data, mem_mask);
12461246}
12471247
12481248
r1877r1878
13491349{
13501350   /* if we have a fake 8751 handler, call it on VBLANK */
13511351   if (i8751_vblank_hook != NULL)
1352      (*i8751_vblank_hook)();
1352      (*i8751_vblank_hook)(machine);
13531353}
13541354
13551355
r1877r1878
13601360 *
13611361 *************************************/
13621362
1363static void altbeast_common_i8751_sim(offs_t soundoffs, offs_t inputoffs)
1363static void altbeast_common_i8751_sim(running_machine *machine, offs_t soundoffs, offs_t inputoffs)
13641364{
13651365   UINT16 temp;
13661366
13671367   /* signal a VBLANK to the main CPU */
1368   cpunum_set_input_line(Machine, 0, 4, HOLD_LINE);
1368   cpunum_set_input_line(machine, 0, 4, HOLD_LINE);
13691369
13701370   /* set tile banks */
1371   rom_5704_bank_w(1, workram[0x3094/2] & 0x00ff, 0xff00);
1371   rom_5704_bank_w(machine, 1, workram[0x3094/2] & 0x00ff, 0xff00);
13721372
13731373   /* process any new sound data */
13741374   temp = workram[soundoffs];
13751375   if ((temp & 0xff00) != 0x0000)
13761376   {
1377      segaic16_memory_mapper_w(0x03, temp >> 8);
1377      segaic16_memory_mapper_w(machine, 0x03, temp >> 8);
13781378      workram[soundoffs] = temp & 0x00ff;
13791379   }
13801380
r1877r1878
13821382   workram[inputoffs] = ~readinputport(0) << 8;
13831383}
13841384
1385static void altbeasj_i8751_sim(void)
1385static void altbeasj_i8751_sim(running_machine *machine)
13861386{
1387   altbeast_common_i8751_sim(0x30d4/2, 0x30d0/2);
1387   altbeast_common_i8751_sim(machine, 0x30d4/2, 0x30d0/2);
13881388}
13891389
1390static void altbeas5_i8751_sim(void)
1390static void altbeas5_i8751_sim(running_machine *machine)
13911391{
1392   altbeast_common_i8751_sim(0x3098/2, 0x3096/2);
1392   altbeast_common_i8751_sim(machine, 0x3098/2, 0x3096/2);
13931393}
13941394
1395static void altbeast_i8751_sim(void)
1395static void altbeast_i8751_sim(running_machine *machine)
13961396{
1397   altbeast_common_i8751_sim(0x30c4/2, 0x30c2/2);
1397   altbeast_common_i8751_sim(machine, 0x30c4/2, 0x30c2/2);
13981398}
13991399
14001400
1401static void ddux_i8751_sim(void)
1401static void ddux_i8751_sim(running_machine *machine)
14021402{
14031403   UINT16 temp;
14041404
14051405   /* signal a VBLANK to the main CPU */
1406   cpunum_set_input_line(Machine, 0, 4, HOLD_LINE);
1406   cpunum_set_input_line(machine, 0, 4, HOLD_LINE);
14071407
14081408   /* process any new sound data */
14091409   temp = workram[0x0bd0/2];
14101410   if ((temp & 0xff00) != 0x0000)
14111411   {
1412      segaic16_memory_mapper_w(0x03, temp >> 8);
1412      segaic16_memory_mapper_w(machine, 0x03, temp >> 8);
14131413      workram[0x0bd0/2] = temp & 0x00ff;
14141414   }
14151415}
14161416
14171417
1418static void goldnaxe_i8751_init(void)
1418static void goldnaxe_i8751_init(running_machine *machine)
14191419{
14201420   static const UINT8 memory_control_5704[0x10] =
14211421      { 0x02,0x00, 0x02,0x08, 0x00,0x1f, 0x00,0xff, 0x00,0x20, 0x01,0x10, 0x00,0x14, 0x00,0xc4 };
r1877r1878
14331433   }
14341434}
14351435
1436static void goldnaxe_i8751_sim(void)
1436static void goldnaxe_i8751_sim(running_machine *machine)
14371437{
14381438   UINT16 temp;
14391439
14401440   /* signal a VBLANK to the main CPU */
1441   cpunum_set_input_line(Machine, 0, 4, HOLD_LINE);
1441   cpunum_set_input_line(machine, 0, 4, HOLD_LINE);
14421442
14431443   /* they periodically clear the data at 2cd8,2cda,2cdc,2cde and expect the MCU to fill it in */
14441444   if (workram[0x2cd8/2] == 0 && workram[0x2cda/2] == 0 && workram[0x2cdc/2] == 0 && workram[0x2cde/2] == 0)
r1877r1878
14531453   temp = workram[0x2cfc/2];
14541454   if ((temp & 0xff00) != 0x0000)
14551455   {
1456      segaic16_memory_mapper_w(0x03, temp >> 8);
1456      segaic16_memory_mapper_w(machine, 0x03, temp >> 8);
14571457      workram[0x2cfc/2] = temp & 0x00ff;
14581458   }
14591459
r1877r1878
14631463}
14641464
14651465
1466static void tturf_i8751_sim(void)
1466static void tturf_i8751_sim(running_machine *machine)
14671467{
14681468   UINT16 temp;
14691469
14701470   /* signal a VBLANK to the main CPU */
1471   cpunum_set_input_line(Machine, 0, 4, HOLD_LINE);
1471   cpunum_set_input_line(machine, 0, 4, HOLD_LINE);
14721472
14731473   /* process any new sound data */
14741474   temp = workram[0x01d0/2];
14751475   if ((temp & 0xff00) != 0x0000)
14761476   {
1477      segaic16_memory_mapper_w(0x03, temp);
1477      segaic16_memory_mapper_w(machine, 0x03, temp);
14781478      workram[0x01d0/2] = temp & 0x00ff;
14791479   }
14801480
r1877r1878
14851485}
14861486
14871487
1488static void wb3_i8751_sim(void)
1488static void wb3_i8751_sim(running_machine *machine)
14891489{
14901490   UINT16 temp;
14911491
14921492   /* signal a VBLANK to the main CPU */
1493   cpunum_set_input_line(Machine, 0, 4, HOLD_LINE);
1493   cpunum_set_input_line(machine, 0, 4, HOLD_LINE);
14941494
14951495   /* process any new sound data */
14961496   temp = workram[0x0008/2];
14971497   if ((temp & 0x00ff) != 0x0000)
14981498   {
1499      segaic16_memory_mapper_w(0x03, temp >> 8);
1499      segaic16_memory_mapper_w(machine, 0x03, temp >> 8);
15001500      workram[0x0008/2] = temp & 0xff00;
15011501   }
15021502}
15031503
15041504
1505static void wrestwar_i8751_sim(void)
1505static void wrestwar_i8751_sim(running_machine *machine)
15061506{
15071507   UINT16 temp;
15081508
15091509   /* signal a VBLANK to the main CPU */
1510   cpunum_set_input_line(Machine, 0, 4, HOLD_LINE);
1510   cpunum_set_input_line(machine, 0, 4, HOLD_LINE);
15111511
15121512   /* process any new sound data */
15131513   temp = workram[0x208e/2];
15141514   if ((temp & 0xff00) != 0x0000)
15151515   {
1516      segaic16_memory_mapper_w(0x03, temp);
1516      segaic16_memory_mapper_w(machine, 0x03, temp);
15171517      workram[0x208e/2] = temp & 0x00ff;
15181518   }
15191519
r1877r1878
15341534   if (ACCESSING_MSB)
15351535      switch (offset & 1)
15361536      {
1537         case 0:   YM2413_register_port_0_w(0, data >> 8);   break;
1538         case 1:   YM2413_data_port_0_w(0, data >> 8);      break;
1537         case 0:   YM2413_register_port_0_w(machine, 0, data >> 8);   break;
1538         case 1:   YM2413_data_port_0_w(machine, 0, data >> 8);      break;
15391539      }
15401540}
15411541
r1877r1878
15651565         }
15661566         break;
15671567   }
1568   return standard_io_r(offset, mem_mask);
1568   return standard_io_r(machine, offset, mem_mask);
15691569}
15701570
15711571
r1877r1878
15921592         }
15931593         break;
15941594   }
1595   return standard_io_r(offset, mem_mask);
1595   return standard_io_r(machine, offset, mem_mask);
15961596}
15971597
15981598
15991599static WRITE16_HANDLER( hwchamp_custom_io_w )
16001600{
16011601   static const char *const portname[4] = { "MONITOR", "LEFT", "RIGHT", "DUMMY" };
1602
16031602   switch (offset & (0x3000/2))
16041603   {
16051604      case 0x3000/2:
r1877r1878
16201619         }
16211620         break;
16221621   }
1623   standard_io_w(offset, data, mem_mask);
1622   standard_io_w(machine, offset, data, mem_mask);
16241623}
16251624
16261625
r1877r1878
16451644         }
16461645         break;
16471646   }
1648   return standard_io_r(offset, mem_mask);
1647   return standard_io_r(machine, offset, mem_mask);
16491648}
16501649
16511650
r1877r1878
16701669         }
16711670         break;
16721671   }
1673   return standard_io_r(offset, mem_mask);
1672   return standard_io_r(machine, offset, mem_mask);
16741673}
16751674
16761675
r1877r1878
16841683static READ16_HANDLER( sjryuko_custom_io_r )
16851684{
16861685   static const char *const portname[] = { "MJ0", "MJ1", "MJ2", "MJ3", "MJ4", "MJ5" };
1687
16881686   switch (offset & (0x3000/2))
16891687   {
16901688      case 0x1000/2:
r1877r1878
17001698         }
17011699         break;
17021700   }
1703   return standard_io_r(offset, mem_mask);
1701   return standard_io_r(machine, offset, mem_mask);
17041702}
17051703
17061704
17071705static WRITE16_HANDLER( sjryuko_custom_io_w )
17081706{
17091707   static UINT8 last_val;
1710
17111708   switch (offset & (0x3000/2))
17121709   {
17131710      case 0x0000/2:
r1877r1878
17151712            mj_input_num = (mj_input_num + 1) % 6;
17161713         break;
17171714   }
1718   standard_io_w(offset, data, mem_mask);
1715   standard_io_w(machine, offset, data, mem_mask);
17191716}
17201717
17211718
r1877r1878
19061903INPUT_PORTS_END
19071904
19081905
1906#ifdef UNUSED_DEFINITION
19091907static INPUT_PORTS_START( generic )
19101908   PORT_INCLUDE( system16b_generic )
19111909INPUT_PORTS_END
1910#endif
19121911
19131912
1914
19151913/*************************************
19161914 *
19171915 *  Game-specific port definitions
r1877r1878
32173215   /* basic machine hardware */
32183216   MDRV_CPU_ADD_TAG("main", M68000, MASTER_CLOCK_10MHz)
32193217   MDRV_CPU_PROGRAM_MAP(system16b_map,0)
3220   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
3218   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
32213219
32223220   MDRV_CPU_ADD_TAG("sound", Z80, MASTER_CLOCK_10MHz/2)
32233221   MDRV_CPU_PROGRAM_MAP(sound_map,0)
r1877r1878
32523250static MACHINE_DRIVER_START( system16b_8751 )
32533251   MDRV_IMPORT_FROM(system16b)
32543252   MDRV_CPU_MODIFY("main")
3255   MDRV_CPU_VBLANK_INT(i8751_main_cpu_vblank,1)
3253   MDRV_CPU_VBLANK_INT("main", i8751_main_cpu_vblank)
32563254
32573255   MDRV_CPU_ADD_TAG("mcu", I8751, MASTER_CLOCK_8MHz)
32583256   MDRV_CPU_PROGRAM_MAP(mcu_map,0)
32593257   MDRV_CPU_DATA_MAP(mcu_data_map,0)
3260   MDRV_CPU_VBLANK_INT(irq0_line_pulse,1)
3258   MDRV_CPU_VBLANK_INT("main", irq0_line_pulse)
32613259MACHINE_DRIVER_END
32623260
32633261
r1877r1878
61656163static DRIVER_INIT( goldnaxe_5704 )
61666164{
61676165   DRIVER_INIT_CALL(generic_5704);
6168   goldnaxe_i8751_init();
6166   goldnaxe_i8751_init(machine);
61696167   i8751_vblank_hook = goldnaxe_i8751_sim;
61706168}
61716169
r1877r1878
61736171static DRIVER_INIT( goldnaxe_5797 )
61746172{
61756173   DRIVER_INIT_CALL(generic_5797);
6176   goldnaxe_i8751_init();
6174   goldnaxe_i8751_init(machine);
61776175   i8751_vblank_hook = goldnaxe_i8751_sim;
61786176}
61796177
src/mame/drivers/thoop2.c
r1877r1878
198198   /* basic machine hardware */
199199   MDRV_CPU_ADD(M68000,24000000/2)         /* 12 MHz */
200200   MDRV_CPU_PROGRAM_MAP(thoop2_readmem,thoop2_writemem)
201   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
201   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
202202
203203   /* video hardware */
204204   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/wwfwfest.c
r1877r1878
128128static WRITE16_HANDLER( wwfwfest_paletteram16_xxxxBBBBGGGGRRRR_word_w )
129129{
130130   offset = (offset & 0x000f) | (offset & 0x7fc0) >> 2;
131   paletteram16_xxxxBBBBGGGGRRRR_word_w (offset, data, mem_mask);
131   paletteram16_xxxxBBBBGGGGRRRR_word_w (machine, offset, data, mem_mask);
132132}
133133
134134/*- Priority Control -*/
r1877r1878
199199
200200static WRITE16_HANDLER ( wwfwfest_soundwrite )
201201{
202   soundlatch_w(1,data & 0xff);
203   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE );
202   soundlatch_w(machine,1,data & 0xff);
203   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE );
204204}
205205
206206/*******************************************************************************
r1877r1878
393393
394394static VIDEO_EOF( wwfwfest )
395395{
396   buffer_spriteram16_w(0,0,0);
396   buffer_spriteram16_w(machine,0,0,0);
397397}
398398
399399/*******************************************************************************
r1877r1878
405405   /* basic machine hardware */
406406   MDRV_CPU_ADD(M68000, 24000000/2)   /* 24 crystal, 12 rated chip */
407407   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
408   MDRV_CPU_VBLANK_INT(wwfwfest_interrupt,2)
408   MDRV_CPU_VBLANK_INT_HACK(wwfwfest_interrupt,2)
409409
410410   MDRV_CPU_ADD(Z80, 3579545)
411411   /* audio CPU */
src/mame/drivers/marineb.c
r1877r1878
511511   MDRV_CPU_ADD_TAG("main", Z80, 3072000)   /* 3.072 MHz */
512512   MDRV_CPU_PROGRAM_MAP(marineb_map,0)
513513   MDRV_CPU_IO_MAP(marineb_io_map,0)
514   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
514   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
515515
516516   MDRV_MACHINE_RESET(marineb)
517517
r1877r1878
576576   MDRV_IMPORT_FROM(marineb)
577577   MDRV_CPU_MODIFY("main")
578578   MDRV_CPU_IO_MAP(wanted_io_map,0)
579   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
579   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
580580
581581   /* video hardware */
582582   MDRV_GFXDECODE(wanted)
src/mame/drivers/pktgaldx.c
r1877r1878
347347   /* basic machine hardware */
348348   MDRV_CPU_ADD(M68000, 14000000)
349349   MDRV_CPU_PROGRAM_MAP(pktgaldx_map,0)
350   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
350   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
351351
352352   /* video hardware */
353353   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
382382   /* basic machine hardware */
383383   MDRV_CPU_ADD(M68000, 16000000)
384384   MDRV_CPU_PROGRAM_MAP(pktgaldb_readmem,pktgaldb_writemem)
385   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
385   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
386386
387387   /* video hardware */
388388   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/timeplt.c
r1877r1878
323323   /* basic machine hardware */
324324   MDRV_CPU_ADD(Z80, MASTER_CLOCK/3/2)   /* not confirmed, but common for Konami games of the era */
325325   MDRV_CPU_PROGRAM_MAP(main_map,0)
326   MDRV_CPU_VBLANK_INT(timeplt_interrupt,1)
326   MDRV_CPU_VBLANK_INT("main", timeplt_interrupt)
327327
328328   MDRV_MACHINE_START(timeplt)
329329
src/mame/drivers/multigam.c
r1877r1878
5151
5252static READ8_HANDLER( psg_4015_r )
5353{
54   return NESPSG_0_r(0x15);
54   return NESPSG_0_r(machine, 0x15);
5555}
5656
5757static WRITE8_HANDLER( psg_4015_w )
5858{
59   NESPSG_0_w(0x15, data);
59   NESPSG_0_w(machine, 0x15, data);
6060}
6161
6262static WRITE8_HANDLER( psg_4017_w )
6363{
64   NESPSG_0_w(0x17, data);
64   NESPSG_0_w(machine, 0x17, data);
6565}
6666
6767/* Inputs */
r1877r1878
216216{
217217   /* reset the ppu */
218218   ppu2c0x_reset( 0, 1 );
219};
219}
220220
221221static PALETTE_INIT( multigam )
222222{
r1877r1878
254254
255255static DRIVER_INIT( multigam )
256256{
257   multigam_mapper_w( 0x0fff, 0x01 );
257   multigam_mapper_w( machine, 0x0fff, 0x01 );
258258}
259259
260260static GFXDECODE_START( multigam )
src/mame/drivers/atarigx2.c
r1877r1878
14331433   /* basic machine hardware */
14341434   MDRV_CPU_ADD(M68EC020, ATARI_CLOCK_14MHz)
14351435   MDRV_CPU_PROGRAM_MAP(main_map,0)
1436   MDRV_CPU_VBLANK_INT(atarigen_video_int_gen,1)
1436   MDRV_CPU_VBLANK_INT("main", atarigen_video_int_gen)
14371437
14381438   MDRV_MACHINE_RESET(atarigx2)
14391439   MDRV_NVRAM_HANDLER(atarigen)
r1877r1878
17171717ROM_END
17181718
17191719
1720#ifdef UNUSED_DEFINITION
17201721ROM_START( motofrei )
17211722   ROM_REGION( 0x80000, REGION_CPU1, 0 )   /* 8*64k for 68000 code */
17221723   ROM_LOAD32_BYTE( "motoi0.094",   0x000000, 0x020000, CRC(a2ed9656) SHA1(7473400ee26e72d8ca51dd1f84a6c3bf0c5a72e9) )
r1877r1878
17601761   ROM_LOAD( "094-002a.bin",  0x0200, 0x0200, CRC(f4768b4d) SHA1(a506fa5386ab0ea2851ff1f8474d4bfc66deaa70) )
17611762   ROM_LOAD( "094-003a.bin",  0x0400, 0x0200, CRC(22a76ad4) SHA1(ce840c283bbd3a5f19dc8d91b19d1571eff51ff4) )
17621763ROM_END
1764#endif
17631765
1764
1766#ifdef UNUSED_DEFINITION
17651767ROM_START( motofreg )
17661768   ROM_REGION( 0x80000, REGION_CPU1, 0 )   /* 8*64k for 68000 code */
17671769   ROM_LOAD32_BYTE( "motog0.094",   0x000000, 0x020000, CRC(1b205eed) SHA1(e5bcabd6b0b8e7f06e9be0f7f66c86d09840d876) )
r1877r1878
18051807   ROM_LOAD( "094-002a.bin",  0x0200, 0x0200, CRC(f4768b4d) SHA1(a506fa5386ab0ea2851ff1f8474d4bfc66deaa70) )
18061808   ROM_LOAD( "094-003a.bin",  0x0400, 0x0200, CRC(22a76ad4) SHA1(ce840c283bbd3a5f19dc8d91b19d1571eff51ff4) )
18071809ROM_END
1810#endif
18081811
1809
1812#ifdef UNUSED_DEFINITION
18101813ROM_START( motofmdg )
18111814   ROM_REGION( 0x80000, REGION_CPU1, 0 )   /* 8*64k for 68000 code */
18121815   ROM_LOAD32_BYTE( "mdg0.094",     0x000000, 0x020000, CRC(5839b940) SHA1(0b331869e938a7e344d4a514a8b70d26f5d1fc14) )
r1877r1878
18501853   ROM_LOAD( "094-002a.bin",  0x0200, 0x0200, CRC(f4768b4d) SHA1(a506fa5386ab0ea2851ff1f8474d4bfc66deaa70) )
18511854   ROM_LOAD( "094-003a.bin",  0x0400, 0x0200, CRC(22a76ad4) SHA1(ce840c283bbd3a5f19dc8d91b19d1571eff51ff4) )
18521855ROM_END
1856#endif
18531857
1854
18551858ROM_START( motofrft )
18561859   ROM_REGION( 0x80000, REGION_CPU1, 0 )   /* 8*64k for 68000 code */
18571860   ROM_LOAD32_BYTE( "ft0.094",      0x000000, 0x020000, CRC(99158754) SHA1(46e73a465aceb147e1ca1bd982448079880cc47e) )
src/mame/drivers/fuukifg2.c
r1877r1878
7878{
7979   if (ACCESSING_LSB)
8080   {
81      soundlatch_w(0,data & 0xff);
82      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
81      soundlatch_w(machine,0,data & 0xff);
82      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
8383//      cpu_spinuntil_time(ATTOTIME_IN_USEC(50));   // Allow the other CPU to reply
8484      cpu_boost_interleave(attotime_zero, ATTOTIME_IN_USEC(50)); // Fixes glitching in rasters
8585   }
src/mame/drivers/nwk-tr.c
r1877r1878
329329   }
330330}
331331
332void K001604_draw_back_layer(int chip, mame_bitmap *bitmap, const rectangle *cliprect)
332void K001604_draw_back_layer(int chip, bitmap_t *bitmap, const rectangle *cliprect)
333333{
334334   int layer;
335335   int num_layers;
r1877r1878
363363   }
364364}
365365
366void K001604_draw_front_layer(int chip, mame_bitmap *bitmap, const rectangle *cliprect)
366void K001604_draw_front_layer(int chip, bitmap_t *bitmap, const rectangle *cliprect)
367367{
368368   //tilemap_draw(bitmap, cliprect, K001604_layer_8x8[chip][1], 0,0);
369369   tilemap_draw(bitmap, cliprect, K001604_layer_8x8[chip][0], 0,0);
src/mame/drivers/vulgus.c
r1877r1878
248248   /* basic machine hardware */
249249   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz (?) */
250250   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
251   MDRV_CPU_VBLANK_INT(vulgus_interrupt,2)
251   MDRV_CPU_VBLANK_INT_HACK(vulgus_interrupt,2)
252252
253253   MDRV_CPU_ADD(Z80, 3000000)
254254   /* audio CPU */   /* 3 MHz ??? */
255255   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
256   MDRV_CPU_VBLANK_INT(irq0_line_hold,8)
256   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,8)
257257
258258   /* video hardware */
259259   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/circus.c
r1877r1878
3131***************************************************************************/
3232
3333#include "driver.h"
34#include "deprecat.h"
3435#include "sound/samples.h"
3536#include "circus.h"
3637
r1877r1878
272273   /* basic machine hardware */
273274   MDRV_CPU_ADD(M6502,11289000/16) /* 705.562kHz */
274275   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
275   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
276   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
276277
277278   /* video hardware */
278279   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
307308   /* basic machine hardware */
308309   MDRV_CPU_ADD(M6502,11289000/16) /* 705.562kHz */
309310   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
310   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
311   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
311312
312313   /* video hardware */
313314   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
341342   /* basic machine hardware */
342343   MDRV_CPU_ADD(M6502,11289000/16) /* 705.562kHz */
343344   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
344   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
345   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
345346
346347   /* video hardware */
347348   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
375376   /* basic machine hardware */
376377   MDRV_CPU_ADD(M6502, 705562)        /* 11.289MHz / 16 */
377378   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
378   //MDRV_CPU_VBLANK_INT(ripcord_interrupt,1) //AT
379   //MDRV_CPU_VBLANK_INT("main", ripcord_interrupt) //AT
379380
380381   /* video hardware */
381382   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/sderby.c
r1877r1878
253253static MACHINE_DRIVER_START( sderby )
254254   MDRV_CPU_ADD(M68000, 12000000)
255255   MDRV_CPU_PROGRAM_MAP(sderby_readmem,sderby_writemem)
256   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
256   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
257257
258258   MDRV_GFXDECODE(sderby)
259259
r1877r1878
281281static MACHINE_DRIVER_START( pmroulet )
282282   MDRV_CPU_ADD(M68000, 12000000)
283283   MDRV_CPU_PROGRAM_MAP(roulette_map,0)
284   MDRV_CPU_VBLANK_INT(irq2_line_hold,1)
284   MDRV_CPU_VBLANK_INT("main", irq2_line_hold)
285285
286286   MDRV_GFXDECODE(sderby)
287287
src/mame/drivers/zac2650.c
r1877r1878
2323VIDEO_START( tinvader );
2424VIDEO_UPDATE( tinvader );
2525
26static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
27   AM_RANGE(0x0000, 0x17ff) AM_READ(MRA8_ROM)
28    AM_RANGE(0x1800, 0x1bff) AM_READ(MRA8_RAM)
29   AM_RANGE(0x1c00, 0x1cff) AM_READ(MRA8_RAM)
30   AM_RANGE(0x1d00, 0x1dff) AM_READ(MRA8_RAM)
31    AM_RANGE(0x1e80, 0x1e80) AM_READ(tinvader_port_0_r)
32    AM_RANGE(0x1e81, 0x1e81) AM_READ(input_port_1_r)
26static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
27   AM_RANGE(0x0000, 0x17ff) AM_ROM
28   AM_RANGE(0x1800, 0x1bff) AM_READWRITE(MRA8_RAM, tinvader_videoram_w) AM_BASE(&videoram)
29   AM_RANGE(0x1c00, 0x1cff) AM_RAM
30   AM_RANGE(0x1d00, 0x1dff) AM_RAM
31   AM_RANGE(0x1e80, 0x1e80) AM_READWRITE(tinvader_port_0_r, tinvader_sound_w)
32   AM_RANGE(0x1e81, 0x1e81) AM_READ(input_port_1_r)
3333    AM_RANGE(0x1e82, 0x1e82) AM_READ(input_port_2_r)
34   AM_RANGE(0x1e85, 0x1e85) AM_READ(input_port_4_r)         /* Dodgem Only */
35   AM_RANGE(0x1e86, 0x1e86) AM_READ(input_port_5_r)         /* Dodgem Only */
36    AM_RANGE(0x1f00, 0x1fff) AM_READ(zac_s2636_r)         /* S2636 Chip */
34   AM_RANGE(0x1e85, 0x1e85) AM_READ(input_port_4_r)               /* Dodgem Only */
35   AM_RANGE(0x1e86, 0x1e86) AM_READWRITE(input_port_5_r, MWA8_NOP)      /* Dodgem Only */
36   AM_RANGE(0x1f00, 0x1fff) AM_READWRITE(zac_s2636_r, MWA8_RAM) AM_BASE(&zac2650_s2636_0_ram)
3737ADDRESS_MAP_END
3838
39
40static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
41   AM_RANGE(0x0000, 0x17ff) AM_WRITE(MWA8_ROM)
42   AM_RANGE(0x1800, 0x1bff) AM_WRITE(tinvader_videoram_w) AM_BASE(&videoram)
43   AM_RANGE(0x1c00, 0x1cff) AM_WRITE(MWA8_RAM)
44    AM_RANGE(0x1d00, 0x1dff) AM_WRITE(MWA8_RAM)
45    AM_RANGE(0x1e80, 0x1e80) AM_WRITE(tinvader_sound_w)
46   AM_RANGE(0x1e86, 0x1e86) AM_WRITE(MWA8_NOP)            /* Dodgem Only */
47   AM_RANGE(0x1f00, 0x1fff) AM_WRITE(MWA8_RAM) AM_BASE(&zac2650_s2636_0_ram)
48ADDRESS_MAP_END
49
50static ADDRESS_MAP_START( readport, ADDRESS_SPACE_IO, 8 )
39static ADDRESS_MAP_START( port_map, ADDRESS_SPACE_IO, 8 )
5140    AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ(input_port_3_r)
5241ADDRESS_MAP_END
5342
r1877r1878
320309
321310   /* basic machine hardware */
322311   MDRV_CPU_ADD(S2650, 3800000/4)
323   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
324   MDRV_CPU_IO_MAP(readport,0)
312   MDRV_CPU_PROGRAM_MAP(main_map, 0)
313   MDRV_CPU_IO_MAP(port_map,0)
325314
326315   /* video hardware */
327316   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/vcombat.c
r1877r1878
8888static INPUT_PORTS_START( vcombat )
8989INPUT_PORTS_END
9090
91static VIDEO_UPDATE( vcombat )
92{
93   return 0;
94}
9195
9296static MACHINE_DRIVER_START( vcombat )
9397   MDRV_CPU_ADD_TAG("main", M68000, XTAL_12MHz)
r1877r1878
110114
111115   MDRV_PALETTE_LENGTH(0x100)
112116
113   MDRV_VIDEO_START(generic_bitmapped)
114   MDRV_VIDEO_UPDATE(generic_bitmapped)
117   MDRV_VIDEO_UPDATE(vcombat)
115118MACHINE_DRIVER_END
116119
117120
src/mame/drivers/shangha3.c
r1877r1878
105105{
106106   if (ACCESSING_LSB)
107107   {
108      soundlatch_w(0,data & 0xff);
109      cpunum_set_input_line_and_vector(Machine, 1,0,HOLD_LINE,0xff);   /* RST 38h */
108      soundlatch_w(machine,0,data & 0xff);
109      cpunum_set_input_line_and_vector(machine, 1,0,HOLD_LINE,0xff);   /* RST 38h */
110110   }
111111}
112112
r1877r1878
499499   /* basic machine hardware */
500500   MDRV_CPU_ADD(M68000, 8000000)
501501   MDRV_CPU_PROGRAM_MAP(shangha3_readmem,shangha3_writemem)
502   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
502   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
503503
504504   /* video hardware */
505505   MDRV_VIDEO_ATTRIBUTES(VIDEO_HAS_SHADOWS )
r1877r1878
535535   /* basic machine hardware */
536536   MDRV_CPU_ADD(M68000, 8000000)
537537   MDRV_CPU_PROGRAM_MAP(heberpop_readmem,heberpop_writemem)
538   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
538   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
539539
540540   MDRV_CPU_ADD(Z80, 6000000)   /* 6 MHz ??? */
541541   MDRV_CPU_PROGRAM_MAP(heberpop_sound_readmem,heberpop_sound_writemem)
r1877r1878
577577   /* basic machine hardware */
578578   MDRV_CPU_ADD(M68000, 8000000)
579579   MDRV_CPU_PROGRAM_MAP(blocken_readmem,blocken_writemem)
580   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
580   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
581581
582582   MDRV_CPU_ADD(Z80, 6000000)   /* 6 MHz ??? */
583583   MDRV_CPU_PROGRAM_MAP(heberpop_sound_readmem,heberpop_sound_writemem)
src/mame/drivers/pkscram.c
r1877r1878
4949{
5050   switch (offset)
5151   {
52      case 0: YM2203_control_port_0_w(0,data & 0xff);break;
53      case 1: YM2203_write_port_0_w(0,data & 0xff);break;
52      case 0: YM2203_control_port_0_w(machine,0,data & 0xff);break;
53      case 1: YM2203_write_port_0_w(machine,0,data & 0xff);break;
5454   }
5555}
5656
5757static READ16_HANDLER( pkscramble_YM2203_r )
5858{
59   return YM2203_status_port_0_r(0);
59   return YM2203_status_port_0_r(machine,0);
6060}
6161
6262// input bit 0x20 in port1 should stay low until bit 0x20 is written here, then
r1877r1878
285285   /* basic machine hardware */
286286   MDRV_CPU_ADD(M68000, 8000000 )
287287   MDRV_CPU_PROGRAM_MAP(pkscramble_map,0)
288   //MDRV_CPU_VBLANK_INT(irq1_line_hold,1) /* only valid irq */
288   //MDRV_CPU_VBLANK_INT("main", irq1_line_hold) /* only valid irq */
289289
290290   MDRV_NVRAM_HANDLER(generic_0fill)
291291
src/mame/drivers/vastar.c
r1877r1878
327327   MDRV_CPU_ADD(Z80, 3072000)   /* 3.072 MHz ???? */
328328   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
329329   MDRV_CPU_IO_MAP(0,writeport)
330   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
330   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
331331
332332   MDRV_CPU_ADD(Z80, 3072000)   /* 3.072 MHz ???? */
333333   MDRV_CPU_PROGRAM_MAP(cpu2_readmem,cpu2_writemem)
334334   MDRV_CPU_IO_MAP(cpu2_readport,cpu2_writeport)
335   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)   /* ??? */
335   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)   /* ??? */
336336
337337   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame - seems enough to ensure proper */
338338                  /* synchronization of the CPUs */
src/mame/drivers/39in1.c
r1877r1878
2828static INPUT_PORTS_START( 39in1 )
2929INPUT_PORTS_END
3030
31static VIDEO_UPDATE( 39in1 )
32{
33   return 0;
34}
35
3136static MACHINE_DRIVER_START( 39in1 )
3237   MDRV_CPU_ADD(ARM7, 200000000)   // actually Xscale PXA255, but ARM7 is a compatible subset
3338   MDRV_CPU_PROGRAM_MAP(39in1_map,0)
r1877r1878
3843   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
3944   MDRV_SCREEN_RAW_PARAMS(16777216/4, 308, 0,  240, 228, 0,  160)   // completely bogus for this h/w
4045
41   MDRV_VIDEO_START(generic_bitmapped)
42   MDRV_VIDEO_UPDATE(generic_bitmapped)
46   MDRV_VIDEO_UPDATE(39in1)
4347
4448   MDRV_SPEAKER_STANDARD_STEREO("left", "right")
4549MACHINE_DRIVER_END
src/mame/drivers/taotaido.c
r1877r1878
9494   if (ACCESSING_LSB)
9595   {
9696      pending_command = 1;
97      soundlatch_w(offset,data & 0xff);
98      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
97      soundlatch_w(machine,offset,data & 0xff);
98      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
9999   }
100100}
101101static ADDRESS_MAP_START( taotaido_readmem, ADDRESS_SPACE_PROGRAM, 16 )
r1877r1878
360360static MACHINE_DRIVER_START( taotaido )
361361   MDRV_CPU_ADD(M68000, 32000000/2)
362362   MDRV_CPU_PROGRAM_MAP(taotaido_readmem,taotaido_writemem)
363   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
363   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
364364
365365   MDRV_CPU_ADD(Z80,20000000/4) // ??
366366   /* audio CPU */
src/mame/drivers/fortecar.c
r1877r1878
147147   MDRV_CPU_PROGRAM_MAP(fortecar_map,0)
148148   MDRV_CPU_IO_MAP(fortecar_ports,0)
149149
150   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
150   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
151151
152152   /* video hardware */
153153   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/relief.c
r1877r1878
135135
136136static READ16_HANDLER( adpcm_r )
137137{
138   return OKIM6295_status_0_r(offset) | 0xff00;
138   return OKIM6295_status_0_r(machine, offset) | 0xff00;
139139}
140140
141141
142142static WRITE16_HANDLER( adpcm_w )
143143{
144144   if (ACCESSING_LSB)
145      OKIM6295_data_0_w(offset, data & 0xff);
145      OKIM6295_data_0_w(machine, offset, data & 0xff);
146146}
147147
148148
r1877r1878
158158   if (ACCESSING_LSB)
159159   {
160160      if (offset & 1)
161         YM2413_data_port_0_w(0, data & 0xff);
161         YM2413_data_port_0_w(machine, 0, data & 0xff);
162162      else
163         YM2413_register_port_0_w(0, data & 0xff);
163         YM2413_register_port_0_w(machine, 0, data & 0xff);
164164   }
165165}
166166
src/mame/drivers/gunpey.c
r1877r1878
124124   MDRV_CPU_ADD(V30, 57242400 / 4)
125125   MDRV_CPU_PROGRAM_MAP(mem_map,0)
126126   MDRV_CPU_IO_MAP(io_map,0)
127   MDRV_CPU_VBLANK_INT(gunpey_interrupt,1)
127   MDRV_CPU_VBLANK_INT("main", gunpey_interrupt)
128128
129129   /* video hardware */
130130   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/taito_f3.c
r1877r1878
8686   switch (offset)
8787   {
8888      case 0x00: /* Watchdog */
89         watchdog_reset_w(0,0);
89         watchdog_reset(machine);
9090         return;
9191      case 0x01: /* Coin counters & lockouts */
9292         if (ACCESSING_MSB32) {
r1877r1878
442442   /* basic machine hardware */
443443   MDRV_CPU_ADD(M68EC020, 16000000)
444444   MDRV_CPU_PROGRAM_MAP(f3_readmem,f3_writemem)
445   MDRV_CPU_VBLANK_INT(f3_interrupt2,1)
445   MDRV_CPU_VBLANK_INT("main", f3_interrupt2)
446446
447447   TAITO_F3_SOUND_SYSTEM_CPU(16000000)
448448
src/mame/drivers/gaelco2.c
r1877r1878
6161   { 0,1,2,3,4,5,6,7, 16*8+0,16*8+1,16*8+2,16*8+3,16*8+4,16*8+5,16*8+6,16*8+7 },   \
6262   { 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8, 8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8 },      \
6363   32*8                                                         \
64}
64};
6565
6666#define GFXDECODEINFO(NUM,ENTRIES) \
6767static GFXDECODE_START( NUM )\
r1877r1878
6969GFXDECODE_END
7070
7171
72TILELAYOUT16(0x0080000);
73GFXDECODEINFO(0x0080000, 128);
74TILELAYOUT16(0x0200000);
75GFXDECODEINFO(0x0200000, 128);
76TILELAYOUT16(0x0400000);
77GFXDECODEINFO(0x0400000, 128);
72TILELAYOUT16(0x0080000)
73GFXDECODEINFO(0x0080000, 128)
74TILELAYOUT16(0x0200000)
75GFXDECODEINFO(0x0200000, 128)
76TILELAYOUT16(0x0400000)
77GFXDECODEINFO(0x0400000, 128)
7878
7979
8080/*============================================================================
r1877r1878
193193   /* basic machine hardware */
194194   MDRV_CPU_ADD(M68000, 26000000/2)      /* 13 MHz? */
195195   MDRV_CPU_PROGRAM_MAP(maniacsq_readmem, maniacsq_writemem)
196   MDRV_CPU_VBLANK_INT(irq6_line_hold, 1)
196   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
197197
198198   /* video hardware */
199199   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
r1877r1878
346346   /* basic machine hardware */
347347   MDRV_CPU_ADD(M68000, 30000000/2)         /* 15 MHz */
348348   MDRV_CPU_PROGRAM_MAP(bang_readmem, bang_writemem)
349   MDRV_CPU_VBLANK_INT(bang_interrupt, 6)
349   MDRV_CPU_VBLANK_INT_HACK(bang_interrupt, 6)
350350
351351   MDRV_NVRAM_HANDLER(gaelco2)
352352
r1877r1878
551551   /* basic machine hardware */
552552   MDRV_CPU_ADD(M68000, 24000000/2)         /* 12 MHz */
553553   MDRV_CPU_PROGRAM_MAP(alighunt_readmem, alighunt_writemem)
554   MDRV_CPU_VBLANK_INT(irq6_line_hold, 1)
554   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
555555
556556   /* video hardware */
557557   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
r1877r1878
814814   /* basic machine hardware */
815815   MDRV_CPU_ADD(M68000, 32000000/2)         /* 16 MHz */
816816   MDRV_CPU_PROGRAM_MAP(touchgo_readmem, touchgo_writemem)
817   MDRV_CPU_VBLANK_INT(irq6_line_hold, 1)
817   MDRV_CPU_VBLANK_INT("left", irq6_line_hold)
818818
819819   /* video hardware */
820820   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
r1877r1878
10171017   /* basic machine hardware */
10181018   MDRV_CPU_ADD(M68000, 30000000/2)         /* 15 MHz */
10191019   MDRV_CPU_PROGRAM_MAP(snowboar_readmem, snowboar_writemem)
1020   MDRV_CPU_VBLANK_INT(irq6_line_hold, 1)
1020   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
10211021
10221022   MDRV_NVRAM_HANDLER(gaelco2)
10231023
r1877r1878
12621262   /* basic machine hardware */
12631263   MDRV_CPU_ADD(M68000, 26000000/2)         /* 13 MHz */
12641264   MDRV_CPU_PROGRAM_MAP(wrally2_readmem, wrally2_writemem)
1265   MDRV_CPU_VBLANK_INT(irq6_line_hold, 1)
1265   MDRV_CPU_VBLANK_INT("left", irq6_line_hold)
12661266
12671267   MDRV_NVRAM_HANDLER(gaelco2)
12681268
src/mame/drivers/homerun.c
r1877r1878
9292static READ8_HANDLER(homerun_40_r)
9393{
9494   if(video_screen_get_vpos(0)>116)
95      return input_port_0_r(0)|0x40;
95      return input_port_0_r(machine,0)|0x40;
9696   else
97      return input_port_0_r(0);
97      return input_port_0_r(machine,0);
9898}
9999
100100static ADDRESS_MAP_START( homerun_iomap, ADDRESS_SPACE_IO, 8 )
r1877r1878
189189   MDRV_CPU_ADD(Z80, 5000000)
190190   MDRV_CPU_PROGRAM_MAP(homerun_memmap, 0)
191191   MDRV_CPU_IO_MAP(homerun_iomap, 0)
192   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
192   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
193193
194194   MDRV_MACHINE_RESET(homerun)
195195
src/mame/drivers/champbas.c
r1877r1878
268268   /* main cpu */
269269   MDRV_CPU_ADD(Z80, 18432000/6)
270270   MDRV_CPU_PROGRAM_MAP(main_map,0)
271   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
271   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
272272
273273   /* audio CPU */
274274   MDRV_CPU_ADD(Z80, 18432000/6)
src/mame/drivers/baraduke.c
r1877r1878
438438   /* basic machine hardware */
439439   MDRV_CPU_ADD(M6809,49152000/32)
440440   MDRV_CPU_PROGRAM_MAP(baraduke_map,0)
441   MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
441   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
442442
443443   MDRV_CPU_ADD(HD63701,49152000/8)
444444   MDRV_CPU_PROGRAM_MAP(mcu_map,0)
445445   MDRV_CPU_IO_MAP(mcu_port_map,0)
446   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
446   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
447447
448448   MDRV_INTERLEAVE(100)      /* we need heavy synch */
449449
src/mame/drivers/ssozumo.c
r1877r1878
5151
5252static WRITE8_HANDLER( ssozumo_sh_command_w )
5353{
54   soundlatch_w(offset, data);
55   cpunum_set_input_line(Machine, 1, M6502_IRQ_LINE, HOLD_LINE);
54   soundlatch_w(machine, offset, data);
55   cpunum_set_input_line(machine, 1, M6502_IRQ_LINE, HOLD_LINE);
5656}
5757
5858
r1877r1878
235235   /* basic machine hardware */
236236   MDRV_CPU_ADD(M6502, 1200000)   /* 1.2 MHz ???? */
237237   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
238   MDRV_CPU_VBLANK_INT(ssozumo_interrupt,1)
238   MDRV_CPU_VBLANK_INT("main", ssozumo_interrupt)
239239
240240   MDRV_CPU_ADD(M6502, 975000)
241241   /* audio CPU */       /* 975 kHz ?? */
242242   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
243   MDRV_CPU_VBLANK_INT(nmi_line_pulse,16)   /* IRQs are triggered by the main CPU */
243   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,16)   /* IRQs are triggered by the main CPU */
244244
245245   /* video hardware */
246246   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/mcr.c
r1877r1878
283283
284284
285285#include "driver.h"
286#include "deprecat.h"
286287#include "machine/z80ctc.h"
287288#include "machine/z80pio.h"
288289#include "machine/z80sio.h"
r1877r1878
486487
487488   /* bit 4 = SEL0 (J1-8) on squawk n talk board */
488489   /* bits 3-0 = MD3-0 connected to squawk n talk (J1-4,3,2,1) */
489   squawkntalk_data_w(offset, data);
490   squawkntalk_data_w(machine, offset, data);
490491}
491492
492493
r1877r1878
567568
568569   /* bit 4 = SEL0 (J1-8) on squawk n talk board */
569570   /* bits 3-0 = MD3-0 connected to squawk n talk (J1-4,3,2,1) */
570   squawkntalk_data_w(offset, data);
571   squawkntalk_data_w(machine, offset, data);
571572}
572573
573574
r1877r1878
594595{
595596   if (data & 0x40) input_mux = 1;
596597   if (data & 0x80) input_mux = 0;
597   turbocs_data_w(offset, data);
598   turbocs_data_w(machine, offset, data);
598599}
599600
600601
r1877r1878
15071508   MDRV_CPU_CONFIG(mcr_daisy_chain)
15081509   MDRV_CPU_PROGRAM_MAP(cpu_90009_map,0)
15091510   MDRV_CPU_IO_MAP(cpu_90009_portmap,0)
1510   MDRV_CPU_VBLANK_INT(mcr_interrupt,2)
1511   MDRV_CPU_VBLANK_INT_HACK(mcr_interrupt,2)
15111512
15121513   MDRV_WATCHDOG_VBLANK_INIT(16)
15131514   MDRV_MACHINE_START(mcr)
r1877r1878
15951596   MDRV_CPU_CONFIG(mcr_ipu_daisy_chain)
15961597   MDRV_CPU_PROGRAM_MAP(ipu_91695_map,0)
15971598   MDRV_CPU_IO_MAP(ipu_91695_portmap,0)
1598   MDRV_CPU_VBLANK_INT(mcr_ipu_interrupt,2)
1599   MDRV_CPU_VBLANK_INT_HACK(mcr_ipu_interrupt,2)
15991600MACHINE_DRIVER_END
16001601
16011602
src/mame/drivers/m107.c
r1877r1878
122122static WRITE16_HANDLER( m107_soundlatch_w )
123123{
124124   timer_call_after_resynch(NULL, V30_ASSERT,setvector_callback);
125   soundlatch_w(0, data & 0xff);
125   soundlatch_w(machine, 0, data & 0xff);
126126//      logerror("soundlatch_w %02x\n",data);
127127}
128128
r1877r1878
135135
136136static READ16_HANDLER( m107_soundlatch_r )
137137{
138   return soundlatch_r(offset) | 0xff00;
138   return soundlatch_r(machine, offset) | 0xff00;
139139}
140140
141141static WRITE16_HANDLER( m107_sound_irq_ack_w )
src/mame/drivers/ninjaw.c
r1877r1878
249249static WRITE16_HANDLER( ninjaw_sound_w )
250250{
251251   if (offset == 0)
252      taitosound_port_w (0, data & 0xff);
252      taitosound_port_w (machine, 0, data & 0xff);
253253   else if (offset == 1)
254      taitosound_comm_w (0, data & 0xff);
254      taitosound_comm_w (machine, 0, data & 0xff);
255255
256256#ifdef MAME_DEBUG
257257   if (data & 0xff00)
r1877r1878
262262static READ16_HANDLER( ninjaw_sound_r )
263263{
264264   if (offset == 1)
265      return ((taitosound_comm_r (0) & 0xff));
265      return ((taitosound_comm_r (machine,0) & 0xff));
266266   else return 0;
267267}
268268
r1877r1878
625625   /* basic machine hardware */
626626   MDRV_CPU_ADD(M68000,16000000/2)   /* 8 MHz ? */
627627   MDRV_CPU_PROGRAM_MAP(ninjaw_readmem,ninjaw_writemem)
628   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
628   MDRV_CPU_VBLANK_INT("left", irq4_line_hold)
629629
630630   MDRV_CPU_ADD(Z80,16000000/4)
631631   /* audio CPU */   /* 16/4 MHz ? */
r1877r1878
633633
634634   MDRV_CPU_ADD(M68000,16000000/2)   /* 8 MHz ? */
635635   MDRV_CPU_PROGRAM_MAP(ninjaw_cpub_readmem,ninjaw_cpub_writemem)
636   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
636   MDRV_CPU_VBLANK_INT("left", irq4_line_hold)
637637
638638   MDRV_INTERLEAVE(100)   /* CPU slices */
639639
r1877r1878
699699   /* basic machine hardware */
700700   MDRV_CPU_ADD(M68000,16000000/2)   /* 8 MHz ? */
701701   MDRV_CPU_PROGRAM_MAP(darius2_readmem,darius2_writemem)
702   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
702   MDRV_CPU_VBLANK_INT("left", irq4_line_hold)
703703
704704   MDRV_CPU_ADD(Z80,16000000/4)
705705   /* audio CPU */   /* 4 MHz ? */
r1877r1878
707707
708708   MDRV_CPU_ADD(M68000,16000000/2)   /* 8 MHz ? */
709709   MDRV_CPU_PROGRAM_MAP(darius2_cpub_readmem,darius2_cpub_writemem)
710   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
710   MDRV_CPU_VBLANK_INT("left", irq4_line_hold)
711711
712712   MDRV_INTERLEAVE(100)   /* CPU slices */
713713
src/mame/drivers/matmania.c
r1877r1878
6060
6161static WRITE8_HANDLER( matmania_sh_command_w )
6262{
63   soundlatch_w(offset,data);
64   cpunum_set_input_line(Machine, 1,M6502_IRQ_LINE,HOLD_LINE);
63   soundlatch_w(machine,offset,data);
64   cpunum_set_input_line(machine, 1,M6502_IRQ_LINE,HOLD_LINE);
6565}
6666
6767static WRITE8_HANDLER( matmania_dac_w )
r1877r1878
7272
7373static WRITE8_HANDLER( maniach_sh_command_w )
7474{
75   soundlatch_w(offset,data);
76   cpunum_set_input_line(Machine, 1,M6809_IRQ_LINE,HOLD_LINE);
75   soundlatch_w(machine,offset,data);
76   cpunum_set_input_line(machine, 1,M6809_IRQ_LINE,HOLD_LINE);
7777}
7878
7979
r1877r1878
338338   /* basic machine hardware */
339339   MDRV_CPU_ADD(M6502, 1500000)   /* 1.5 MHz ???? */
340340   MDRV_CPU_PROGRAM_MAP(matmania_readmem,matmania_writemem)
341   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
341   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
342342
343343   MDRV_CPU_ADD(M6502, 1200000)
344344   /* audio CPU */   /* 1.2 MHz ???? */
345345   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
346   MDRV_CPU_VBLANK_INT(nmi_line_pulse,15)   /* ???? */
346   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,15)   /* ???? */
347347                        /* IRQs are caused by the main CPU */
348348   MDRV_INTERLEAVE(10)
349349
r1877r1878
394394   /* basic machine hardware */
395395   MDRV_CPU_ADD(M6502, 1500000)   /* 1.5 MHz ???? */
396396   MDRV_CPU_PROGRAM_MAP(maniach_readmem,maniach_writemem)
397   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
397   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
398398
399399   MDRV_CPU_ADD(M6809, 1500000)
400400   /* audio CPU */   /* 1.5 MHz ???? */
src/mame/drivers/arkanoid.c
r1877r1878
746746   // basic machine hardware
747747   MDRV_CPU_ADD_TAG("main", Z80, 6000000) /* 6 Mhz */
748748   MDRV_CPU_PROGRAM_MAP(arkanoid_map, 0)
749   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
749   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
750750
751751   MDRV_CPU_ADD_TAG("mcu", M68705, 3000000) /* 3 Mhz */
752752   MDRV_CPU_PROGRAM_MAP(mcu_map, 0)
r1877r1878
774774   // sound hardware
775775   MDRV_SPEAKER_STANDARD_MONO("mono")
776776
777   MDRV_SOUND_ADD(AY8910, 1500000)
777   MDRV_SOUND_ADD(AY8910, XTAL_12MHz/4/2) /* YM2149 clock is 3mhz, pin 26 is low so 3mhz/2 */
778778   MDRV_SOUND_CONFIG(ay8910_interface)
779779   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.33)
780780MACHINE_DRIVER_END
src/mame/drivers/twin16.c
r1877r1878
139139static WRITE16_HANDLER( sound_command_w )
140140{
141141   COMBINE_DATA(&twin16_sound_command);
142   soundlatch_w( 0, twin16_sound_command&0xff );
142   soundlatch_w( machine, 0, twin16_sound_command&0xff );
143143}
144144
145145static READ16_HANDLER( twin16_sprite_status_r )
r1877r1878
960960
961961   MDRV_CPU_ADD(M68000, 10000000)
962962   MDRV_CPU_PROGRAM_MAP(readmem_sub,writemem_sub)
963   MDRV_CPU_VBLANK_INT(CPUB_interrupt,1)
963   MDRV_CPU_VBLANK_INT("main", CPUB_interrupt)
964964
965965   MDRV_CPU_ADD(M68000, 10000000)
966966   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
967   MDRV_CPU_VBLANK_INT(CPUA_interrupt,1)
967   MDRV_CPU_VBLANK_INT("main", CPUA_interrupt)
968968
969969   MDRV_INTERLEAVE(100)
970970
r1877r1878
10181018
10191019   MDRV_CPU_ADD(M68000, 10000000)
10201020   MDRV_CPU_PROGRAM_MAP(fround_readmem,fround_writemem)
1021   MDRV_CPU_VBLANK_INT(CPUA_interrupt,1)
1021   MDRV_CPU_VBLANK_INT("main", CPUA_interrupt)
10221022
10231023   MDRV_INTERLEAVE(100)
10241024
src/mame/drivers/megasys1.c
r1877r1878
113113#define SYS_A_CPU_CLOCK      (XTAL_12MHz / 2)   /* clock for main 68000 */
114114#define SYS_B_CPU_CLOCK      XTAL_8MHz      /* clock for main 68000 */
115115#define SYS_C_CPU_CLOCK      (XTAL_24MHz / 2)   /* clock for main 68000 */
116#define SYS_D_CPU_CLOCK      XTAL_8MHz      /* clock for main 68000 */
116117#define SOUND_CPU_CLOCK      XTAL_7MHz      /* clock for sound 68000 */
117118#define OKI4_SOUND_CLOCK   XTAL_4MHz
118119
r1877r1878
273274
274275   switch (i)
275276   {
276         case 0 :   return coins_r(0,0);   break;
277         case 1 :   return player1_r(0,0);   break;
278         case 2 :   return player2_r(0,0);   break;
279         case 3 :   return dsw1_r(0,0);      break;
280         case 4 :   return dsw2_r(0,0);      break;
277         case 0 :   return coins_r(machine,0,0);   break;
278         case 1 :   return player1_r(machine,0,0);   break;
279         case 2 :   return player2_r(machine,0,0);   break;
280         case 3 :   return dsw1_r(machine,0,0);      break;
281         case 4 :   return dsw2_r(machine,0,0);      break;
281282         default    :   return 0x0006;
282283   }
283284}
r1877r1878
360361                            [ Main CPU - System D ]
361362***************************************************************************/
362363
363#define INTERRUPT_NUM_D      1
364364static INTERRUPT_GEN( interrupt_D )
365365{
366366   cpunum_set_input_line(machine, 0, 2, HOLD_LINE);
r1877r1878
467467   if (megasys1_ignore_oki_status == 1)
468468      return 0;
469469   else
470      return OKIM6295_status_0_lsb_r(offset,mem_mask);
470      return OKIM6295_status_0_lsb_r(machine,offset,mem_mask);
471471}
472472
473473static READ16_HANDLER( oki_status_1_r )
r1877r1878
475475   if (megasys1_ignore_oki_status == 1)
476476      return 0;
477477   else
478      return OKIM6295_status_1_lsb_r(offset,mem_mask);
478      return OKIM6295_status_1_lsb_r(machine,offset,mem_mask);
479479}
480480
481481/***************************************************************************
r1877r1878
636636   /* basic machine hardware */
637637   MDRV_CPU_ADD_TAG("main", M68000, SYS_A_CPU_CLOCK) /* 6MHz verified */
638638   MDRV_CPU_PROGRAM_MAP(readmem_A,writemem_A)
639   MDRV_CPU_VBLANK_INT(interrupt_A,INTERRUPT_NUM_A)
639   MDRV_CPU_VBLANK_INT_HACK(interrupt_A,INTERRUPT_NUM_A)
640640
641641   MDRV_CPU_ADD_TAG("sound", M68000, SOUND_CPU_CLOCK) /* 7MHz verified */
642642   /* audio CPU */
r1877r1878
664664   /* sound hardware */
665665   MDRV_SPEAKER_STANDARD_STEREO("left", "right")
666666
667   MDRV_SOUND_ADD(YM2151, SOUND_CPU_CLOCK/2) /* 3.5MHz verified */
667   MDRV_SOUND_ADD(YM2151, SOUND_CPU_CLOCK/2) /* 3.5MHz (7MHz / 2) verified */
668668   MDRV_SOUND_CONFIG(ym2151_interface)
669669   MDRV_SOUND_ROUTE(0, "left", 0.80)
670670   MDRV_SOUND_ROUTE(1, "right", 0.80)
r1877r1878
693693   MDRV_CPU_REPLACE("main", M68000, SYS_B_CPU_CLOCK) /* 8MHz */
694694   MDRV_CPU_MODIFY("main")
695695   MDRV_CPU_PROGRAM_MAP(readmem_B,writemem_B)
696   MDRV_CPU_VBLANK_INT(interrupt_B,INTERRUPT_NUM_B)
696   MDRV_CPU_VBLANK_INT_HACK(interrupt_B,INTERRUPT_NUM_B)
697697
698698   MDRV_CPU_MODIFY("sound")
699699   MDRV_CPU_PROGRAM_MAP(sound_readmem_B,sound_writemem_B)
r1877r1878
723723   MDRV_CPU_REPLACE("main", M68000, SYS_C_CPU_CLOCK) /* 12MHz */
724724   MDRV_CPU_MODIFY("main")
725725   MDRV_CPU_PROGRAM_MAP(readmem_C,writemem_C)
726   MDRV_CPU_VBLANK_INT(interrupt_C,INTERRUPT_NUM_C)
726   MDRV_CPU_VBLANK_INT_HACK(interrupt_C,INTERRUPT_NUM_C)
727727
728728   MDRV_CPU_MODIFY("sound")
729729   MDRV_CPU_PROGRAM_MAP(sound_readmem_B,sound_writemem_B)
r1877r1878
736736
737737                              1x68000 1xM6295
738738
739KLOV entry for peekaboo: Jaleco board no. PB-92127A. Main CPU: Motorola 68000P10
739                        OSC: 8MHz
740740
741741***************************************************************************/
742742
r1877r1878
744744static MACHINE_DRIVER_START( system_D )
745745
746746   /* basic machine hardware */
747   MDRV_CPU_ADD(M68000, 8000000)   /* 8MHz?? */
747   MDRV_CPU_ADD(M68000, SYS_D_CPU_CLOCK)   /* 8MHz */
748748   MDRV_CPU_PROGRAM_MAP(readmem_D,writemem_D)
749   MDRV_CPU_VBLANK_INT(interrupt_D,INTERRUPT_NUM_D)
749   MDRV_CPU_VBLANK_INT("main", interrupt_D)
750750
751751   MDRV_MACHINE_RESET(megasys1)
752752
r1877r1878
768768   /* sound hardware */
769769   MDRV_SPEAKER_STANDARD_MONO("mono")
770770
771   MDRV_SOUND_ADD_TAG("OKI1",OKIM6295, 1980000)
772   MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low) // clock frequency & pin 7 not verified
771   MDRV_SOUND_ADD_TAG("OKI1",OKIM6295, SYS_D_CPU_CLOCK/4)   /* 2MHz (8MHz / 4) */
772   MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high)
773773   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
774774MACHINE_DRIVER_END
775775
r1877r1878
807807   /* basic machine hardware */
808808   MDRV_CPU_ADD(M68000, SYS_A_CPU_CLOCK) /* 6MHz (12MHz / 2) */
809809   MDRV_CPU_PROGRAM_MAP(readmem_A,writemem_A)
810   MDRV_CPU_VBLANK_INT(interrupt_A,INTERRUPT_NUM_A)
810   MDRV_CPU_VBLANK_INT_HACK(interrupt_A,INTERRUPT_NUM_A)
811811
812812   MDRV_CPU_ADD(Z80, 3000000) /* OSC 12MHz divided by 4 ??? */
813813   /* audio CPU */
r1877r1878
27422742
27432743                            [ Peek-a-Boo! ]
27442744
2745Jaleco board no. PB-92127A
2746
2747  CPU: Motorola 68000P10
2748Sound: OKI M6295
2749  OSC: 8Mhz
2750  MCU: MO-90233 (unknown type with internal rom)
2751
27452752interrupts:
27462753    1]      506>    rte
27472754    2]      50a>    move.w  #$ffff, $1f0006.l
r1877r1878
28282835   ROM_LOAD16_BYTE( "j2", 0x000001, 0x020000, CRC(7b3d430d) SHA1(8b48101929da4938a61dfd0eda845368c4184831) )
28292836
28302837   ROM_REGION( 0x40000, REGION_CPU2, 0 ) /* MCU Internal Code */
2831   ROM_LOAD( "peekaboo.mcu", 0x000000, 0x40000, NO_DUMP )
2838   ROM_LOAD( "mo-90233.mcu", 0x000000, 0x40000, NO_DUMP )
28322839
28332840   ROM_REGION( 0x080000, REGION_GFX1, ROMREGION_DISPOSE ) /* Scroll 0 */
28342841   ROM_LOAD( "5",       0x000000, 0x080000, CRC(34fa07bb) SHA1(0f688acf302fd56701ee4fcc1d692adb7bf86ce4) )
r1877r1878
29242931   switch (protection_val)
29252932   {
29262933      case 0x02:   return 0x03;
2927      case 0x51:   return player1_r(0,0);
2928      case 0x52:   return player2_r(0,0);
2934      case 0x51:   return player1_r(machine,0,0);
2935      case 0x52:   return player2_r(machine,0,0);
29292936      default:   return protection_val;
29302937   }
29312938}
r1877r1878
38523859
38533860static WRITE16_HANDLER( OKIM6295_data_0_both_w )
38543861{
3855   if (ACCESSING_LSB)   OKIM6295_data_0_w(0, (data >> 0) & 0xff );
3856   else            OKIM6295_data_0_w(0, (data >> 8) & 0xff );
3862   if (ACCESSING_LSB)   OKIM6295_data_0_w(machine, 0, (data >> 0) & 0xff );
3863   else            OKIM6295_data_0_w(machine, 0, (data >> 8) & 0xff );
38573864}
38583865static WRITE16_HANDLER( OKIM6295_data_1_both_w )
38593866{
3860   if (ACCESSING_LSB)   OKIM6295_data_1_w(0, (data >> 0) & 0xff );
3861   else            OKIM6295_data_1_w(0, (data >> 8) & 0xff );
3867   if (ACCESSING_LSB)   OKIM6295_data_1_w(machine, 0, (data >> 0) & 0xff );
3868   else            OKIM6295_data_1_w(machine, 0, (data >> 8) & 0xff );
38623869}
38633870
38643871static DRIVER_INIT( jitsupro )
src/mame/drivers/crshrace.c
r1877r1878
166166   if (ACCESSING_LSB)
167167   {
168168      pending_command = 1;
169      soundlatch_w(offset,data & 0xff);
170      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
169      soundlatch_w(machine,offset,data & 0xff);
170      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
171171   }
172172}
173173
r1877r1878
625625   /* basic machine hardware */
626626   MDRV_CPU_ADD(M68000,16000000)   /* 16 MHz ??? */
627627   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
628   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
628   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
629629
630630   MDRV_CPU_ADD(Z80,4000000)   /* 4 MHz ??? */
631631   /* audio CPU */
src/mame/drivers/airbustr.c
r1877r1878
250250           that would reset the main cpu. We avoid this and patch
251251           the rom instead (main cpu has to be reset once at startup) */
252252      case 0xfe0:
253         return watchdog_reset_r(0);
253         return watchdog_reset_r(machine,0);
254254
255255      /* Reading a word at eff2 probably yelds the product
256256           of the words written to eff0 and eff2 */
r1877r1878
319319static READ8_HANDLER( soundcommand_r )
320320{
321321   soundlatch_status = 0;   // soundlatch has been read
322   return soundlatch_r(0);
322   return soundlatch_r(machine,0);
323323}
324324
325325static READ8_HANDLER( soundcommand2_r )
326326{
327327   soundlatch2_status = 0;   // soundlatch2 has been read
328   return soundlatch2_r(0);
328   return soundlatch2_r(machine,0);
329329}
330330
331331static WRITE8_HANDLER( soundcommand_w )
332332{
333   soundlatch_w(0, data);
333   soundlatch_w(machine, 0, data);
334334   soundlatch_status = 1;   // soundlatch has been written
335   cpunum_set_input_line(Machine, 2, INPUT_LINE_NMI, PULSE_LINE);   // cause a nmi to sub cpu
335   cpunum_set_input_line(machine, 2, INPUT_LINE_NMI, PULSE_LINE);   // cause a nmi to sub cpu
336336}
337337
338338static WRITE8_HANDLER( soundcommand2_w )
339339{
340   soundlatch2_w(0, data);
340   soundlatch2_w(machine, 0, data);
341341   soundlatch2_status = 1;   // soundlatch2 has been written
342342}
343343
r1877r1878
587587static MACHINE_RESET( airbustr )
588588{
589589   soundlatch_status = soundlatch2_status = 0;
590   master_bankswitch_w(0, 0x02);
591   slave_bankswitch_w(0, 0x02);
592   sound_bankswitch_w(0, 0x02);
590   master_bankswitch_w(machine, 0, 0x02);
591   slave_bankswitch_w(machine, 0, 0x02);
592   sound_bankswitch_w(machine, 0, 0x02);
593593}
594594
595595/* Machine Driver */
r1877r1878
599599   MDRV_CPU_ADD(Z80, 6000000)   // ???
600600   MDRV_CPU_PROGRAM_MAP(master_map, 0)
601601   MDRV_CPU_IO_MAP(master_io_map, 0)
602   MDRV_CPU_VBLANK_INT(master_interrupt, 2)   // nmi caused by sub cpu?, ?
602   MDRV_CPU_VBLANK_INT_HACK(master_interrupt, 2)   // nmi caused by sub cpu?, ?
603603
604604   MDRV_CPU_ADD(Z80, 6000000)   // ???
605605   MDRV_CPU_PROGRAM_MAP(slave_map, 0)
606606   MDRV_CPU_IO_MAP(slave_io_map, 0)
607   MDRV_CPU_VBLANK_INT(slave_interrupt, 2)      // nmi caused by main cpu, ?
607   MDRV_CPU_VBLANK_INT_HACK(slave_interrupt, 2)      // nmi caused by main cpu, ?
608608
609609   MDRV_CPU_ADD(Z80, 6000000)   // ???
610610   MDRV_CPU_PROGRAM_MAP(sound_map, 0)
611611   MDRV_CPU_IO_MAP(sound_io_map, 0)
612   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)      // nmi are caused by sub cpu writing a sound command
612   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)      // nmi are caused by sub cpu writing a sound command
613613
614614   MDRV_INTERLEAVE(100)   // Palette RAM is filled by sub cpu with data supplied by main cpu
615615                     // Maybe a high value is safer in order to avoid glitches
src/mame/drivers/clshroad.c
r1877r1878
306306   /* basic machine hardware */
307307   MDRV_CPU_ADD(Z80, 3000000)   /* ? */
308308   MDRV_CPU_PROGRAM_MAP(clshroad_readmem,clshroad_writemem)
309   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   /* IRQ, no NMI */
309   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   /* IRQ, no NMI */
310310
311311   MDRV_CPU_ADD(Z80, 3000000)   /* ? */
312312   /* audio CPU */
313313   MDRV_CPU_PROGRAM_MAP(clshroad_sound_readmem,clshroad_sound_writemem)
314   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   /* IRQ, no NMI */
314   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   /* IRQ, no NMI */
315315
316316   MDRV_MACHINE_RESET(clshroad)
317317
r1877r1878
343343   /* basic machine hardware */
344344   MDRV_CPU_ADD(Z80, 18432000/6)   /* ? */
345345   MDRV_CPU_PROGRAM_MAP(clshroad_readmem,clshroad_writemem)
346   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   /* IRQ, no NMI */
346   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   /* IRQ, no NMI */
347347
348348   MDRV_CPU_ADD(Z80, 18432000/6)   /* ? */
349349   /* audio CPU */
350350   MDRV_CPU_PROGRAM_MAP(clshroad_sound_readmem,clshroad_sound_writemem)
351   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)   /* IRQ, no NMI */
351   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   /* IRQ, no NMI */
352352
353353   MDRV_MACHINE_RESET(clshroad)
354354
src/mame/drivers/pacman.c
r1877r1878
522522   /* since the sound region in Ali Baba is not contiguous, translate the
523523       offset into the 0-0x1f range */
524524    if (offset < 0x10)
525      pacman_sound_w(offset, data);
525      pacman_sound_w(machine, offset, data);
526526   else if (offset < 0x20)
527527      spriteram_2[offset - 0x10] = data;
528528   else
529      pacman_sound_w(offset - 0x10, data);
529      pacman_sound_w(machine, offset - 0x10, data);
530530}
531531
532532
r1877r1878
557557
558558static READ8_HANDLER( maketrax_special_port2_r )
559559{
560   int data = input_port_2_r(offset);
560   int data = input_port_2_r(machine,offset);
561561   int pc = activecpu_get_previouspc();
562562
563563   if ((pc == 0x1973) || (pc == 0x2389)) return data | 0x40;
r1877r1878
600600
601601static READ8_HANDLER( korosuke_special_port2_r )
602602{
603   int data = input_port_2_r(offset);
603   int data = input_port_2_r(machine,offset);
604604   int pc = activecpu_get_previouspc();
605605
606606   if ((pc == 0x196e) || (pc == 0x2387)) return data | 0x40;
r1877r1878
30753075   MDRV_CPU_ADD_TAG("main", Z80, MASTER_CLOCK/6)
30763076   MDRV_CPU_PROGRAM_MAP(pacman_map,0)
30773077   MDRV_CPU_IO_MAP(0,writeport)
3078   MDRV_CPU_VBLANK_INT(pacman_interrupt,2)
3078   MDRV_CPU_VBLANK_INT_HACK(pacman_interrupt,2)
30793079   MDRV_WATCHDOG_VBLANK_INIT(16)
30803080
30813081   /* video hardware */
r1877r1878
31493149
31503150   MDRV_CPU_MODIFY("main")
31513151   MDRV_CPU_PROGRAM_MAP(alibaba_map,0)
3152   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
3152   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
31533153MACHINE_DRIVER_END
31543154
31553155
r1877r1878
31613161   MDRV_CPU_MODIFY("main")
31623162   MDRV_CPU_PROGRAM_MAP(dremshpr_map,0)
31633163   MDRV_CPU_IO_MAP(0,dremshpr_writeport)
3164   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
3164   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
31653165
31663166   /* sound hardware */
31673167   MDRV_SOUND_REPLACE("namco", AY8910, 14318000/8)
r1877r1878
32033203   MDRV_CPU_MODIFY("main")
32043204   MDRV_CPU_PROGRAM_MAP(vanvan_map,0)
32053205   MDRV_CPU_IO_MAP(0,vanvan_writeport)
3206   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
3206   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
32073207
32083208   /* video hardware */
32093209   MDRV_SCREEN_MODIFY("main")
r1877r1878
32253225   MDRV_CPU_MODIFY("main")
32263226   MDRV_CPU_PROGRAM_MAP(bigbucks_map,0)
32273227   MDRV_CPU_IO_MAP(bigbucks_readport,0)
3228   MDRV_CPU_VBLANK_INT(irq0_line_hold,20)
3228   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,20)
32293229
32303230   MDRV_SCREEN_MODIFY("main")
32313231   MDRV_SCREEN_VISIBLE_AREA(0*8, 36*8-1, 0*8, 28*8-1)
r1877r1878
32403240   MDRV_CPU_REMOVE("main")
32413241   MDRV_CPU_ADD_TAG("main", S2650, MASTER_CLOCK/6/2)   /* 2H */
32423242   MDRV_CPU_PROGRAM_MAP(s2650games_map,0)
3243   MDRV_CPU_VBLANK_INT(s2650_interrupt,1)
3243   MDRV_CPU_VBLANK_INT("main", s2650_interrupt)
32443244
32453245   MDRV_GFXDECODE(s2650games)
32463246
r1877r1878
32953295
32963296   MDRV_CPU_MODIFY("main")
32973297   MDRV_CPU_PROGRAM_MAP(rocktrv2_map,0)
3298   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
3298   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
32993299
33003300   MDRV_SCREEN_MODIFY("main")
33013301   MDRV_SCREEN_VISIBLE_AREA(0*8, 36*8-1, 0*8, 28*8-1)
r1877r1878
33103310   MDRV_CPU_MODIFY("main")
33113311   MDRV_CPU_PROGRAM_MAP(mschamp_map,0)
33123312   MDRV_CPU_IO_MAP(mschamp_readport,writeport)
3313   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
3313   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
33143314
33153315   MDRV_MACHINE_RESET(mschamp)
33163316MACHINE_DRIVER_END
src/mame/drivers/dcheese.c
r1877r1878
134134
135135static READ16_HANDLER( port_2_r )
136136{
137   return (readinputport(2) & 0xff1f) | (!soundlatch_full << 7) | (ticket_dispenser_r(0) >> 2);
137   return (readinputport(2) & 0xff1f) | (!soundlatch_full << 7) | (ticket_dispenser_r(machine, 0) >> 2);
138138}
139139
140140
r1877r1878
147147      EEPROM_set_cs_line(~data & 8);
148148      EEPROM_write_bit(data & 2);
149149      EEPROM_set_clock_line(data & 4);
150      ticket_dispenser_w(0, (data & 1) << 7);
150      ticket_dispenser_w(machine, 0, (data & 1) << 7);
151151   }
152152}
153153
r1877r1878
158158   {
159159      /* write the latch and set the IRQ */
160160      soundlatch_full = 1;
161      cpunum_set_input_line(Machine, 1, 0, ASSERT_LINE);
162      soundlatch_w(0, data & 0xff);
161      cpunum_set_input_line(machine, 1, 0, ASSERT_LINE);
162      soundlatch_w(machine, 0, data & 0xff);
163163   }
164164}
165165
r1877r1878
175175{
176176   /* read the latch and clear the IRQ */
177177   soundlatch_full = 0;
178   cpunum_set_input_line(Machine, 1, 0, CLEAR_LINE);
179   return soundlatch_r(0);
178   cpunum_set_input_line(machine, 1, 0, CLEAR_LINE);
179   return soundlatch_r(machine, 0);
180180}
181181
182182
r1877r1878
207207   if (offset % 2 == 0)
208208      sound_msb_latch = data;
209209   else
210      BSMT2000_data_0_w(offset/2, (sound_msb_latch << 8) | data, 0);
210      BSMT2000_data_0_w(machine, offset/2, (sound_msb_latch << 8) | data, 0);
211211}
212212
213213
r1877r1878
404404   /* basic machine hardware */
405405   MDRV_CPU_ADD(M68000, MAIN_OSC)
406406   MDRV_CPU_PROGRAM_MAP(main_cpu_map,0)
407   MDRV_CPU_VBLANK_INT(dcheese_vblank,1)
407   MDRV_CPU_VBLANK_INT("main", dcheese_vblank)
408408
409409   MDRV_CPU_ADD(M6809, SOUND_OSC/16)
410410   MDRV_CPU_PROGRAM_MAP(sound_cpu_map,0)
src/mame/drivers/chqflag.c
r1877r1878
363363   /* basic machine hardware */
364364   MDRV_CPU_ADD(KONAMI,XTAL_24MHz/8)   /* 052001 (verified on pcb) */
365365   MDRV_CPU_PROGRAM_MAP(chqflag_readmem,chqflag_writemem)
366   MDRV_CPU_VBLANK_INT(chqflag_interrupt,16)   /* ? */
366   MDRV_CPU_VBLANK_INT_HACK(chqflag_interrupt,16)   /* ? */
367367
368368   MDRV_CPU_ADD(Z80, XTAL_3_579545MHz) /* verified on pcb */
369369   /* audio CPU */   /* ? */
src/mame/drivers/bwing.c
r1877r1878
7272            ffcount--;
7373            latch_data = sound_fifo[fftail];
7474            fftail = (fftail + 1) & (MAX_SOUNDS - 1);
75            soundlatch_w(0, latch_data);
75            soundlatch_w(machine, 0, latch_data);
7676            cpunum_set_input_line(machine, 2, DECO16_IRQ_LINE, HOLD_LINE); // SNDREQ
7777         }
7878      break;
r1877r1878
392392   // basic machine hardware
393393   MDRV_CPU_ADD(M6809, 2000000)
394394   MDRV_CPU_PROGRAM_MAP(bwp1_readmem, bwp1_writemem)
395   MDRV_CPU_VBLANK_INT(bwp1_interrupt, 3)
395   MDRV_CPU_VBLANK_INT_HACK(bwp1_interrupt, 3)
396396
397397   MDRV_CPU_ADD(M6809, 2000000)
398398   MDRV_CPU_PROGRAM_MAP(bwp2_readmem, bwp2_writemem)
399//  MDRV_CPU_VBLANK_INT(irq1_line_assert, 1) // vblank triggers FIRQ on CPU2 by design (unused)
399//  MDRV_CPU_VBLANK_INT("main", irq1_line_assert) // vblank triggers FIRQ on CPU2 by design (unused)
400400
401401   MDRV_CPU_ADD(DECO16, 2000000)
402402   /* audio CPU */
src/mame/drivers/srmp6.c
r1877r1878
535535   if (offset >= 0xfff00/2 && offset <= 0xfff1a/2 )
536536   {
537537      offset &=0x1f;
538      srmp6_dma_w(offset,data,mem_mask);
538      srmp6_dma_w(machine,offset,data,mem_mask);
539539   }
540540}
541541
r1877r1878
544544   INT8 r, g, b;
545545   int brg = brightness - 0x60;
546546
547   paletteram16_xBBBBBGGGGGRRRRR_word_w(offset, data, mem_mask);
547   paletteram16_xBBBBBGGGGGRRRRR_word_w(machine, offset, data, mem_mask);
548548
549549   if(brg)
550550   {
r1877r1878
709709static MACHINE_DRIVER_START( srmp6 )
710710   MDRV_CPU_ADD(M68000, 16000000)
711711   MDRV_CPU_PROGRAM_MAP(srmp6,0)
712   MDRV_CPU_VBLANK_INT(srmp6_interrupt,2)
712   MDRV_CPU_VBLANK_INT_HACK(srmp6_interrupt,2)
713713
714714
715715   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/sf.c
r1877r1878
5353{
5454   if (ACCESSING_LSB)
5555   {
56      soundlatch_w(offset,data & 0xff);
57      cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
56      soundlatch_w(machine,offset,data & 0xff);
57      cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
5858   }
5959}
6060
r1877r1878
123123         program_write_word(0xffc00c, 0xc0);
124124         program_write_word(0xffc00e, 0);
125125
126         sf_fg_scroll_w(0, d1, 0);
127         sf_bg_scroll_w(0, d2, 0);
126         sf_fg_scroll_w(machine, 0, d1, 0);
127         sf_fg_scroll_w(machine, 0, d2, 0);
128128         break;
129129      }
130130   case 4:
r1877r1878
144144            }
145145            program_write_word(0xffc682, d1);
146146            program_write_word(0xffc00e, off);
147            sf_bg_scroll_w(0, d1, 0);
147            sf_fg_scroll_w(machine, 0, d1, 0);
148148         }
149149         break;
150150      }
r1877r1878
166166
167167static READ16_HANDLER( button1_r )
168168{
169   return (scale[input_port_7_r(0)]<<8)|scale[input_port_5_r(0)];
169   return (scale[input_port_7_r(machine,0)]<<8)|scale[input_port_5_r(machine,0)];
170170}
171171
172172static READ16_HANDLER( button2_r )
173173{
174   return (scale[input_port_8_r(0)]<<8)|scale[input_port_6_r(0)];
174   return (scale[input_port_8_r(machine,0)]<<8)|scale[input_port_6_r(machine,0)];
175175}
176176
177177
r1877r1878
820820   /* basic machine hardware */
821821   MDRV_CPU_ADD_TAG("main", M68000, 8000000)   /* 8 MHz ? (xtal is 16MHz) */
822822   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
823   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
823   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
824824
825825   MDRV_CPU_ADD(Z80, 3579545)
826826   /* audio CPU */   /* ? xtal is 3.579545MHz */
r1877r1878
889889   /* basic machine hardware */
890890   MDRV_IMPORT_FROM(sf)
891891   MDRV_CPU_MODIFY("main")
892   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
892   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
893893MACHINE_DRIVER_END
894894
895895
src/mame/drivers/lsasquad.c
r1877r1878
591591   /* basic machine hardware */
592592   MDRV_CPU_ADD(Z80, 6000000)   /* 6 MHz? */
593593   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
594   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
594   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
595595
596596   MDRV_CPU_ADD(Z80, 4000000)
597597   /* audio CPU */   /* 4 MHz? */
r1877r1878
637637   /* basic machine hardware */
638638   MDRV_CPU_ADD(Z80, 6000000)
639639   MDRV_CPU_PROGRAM_MAP(mem_daikaiju, 0)
640   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
640   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
641641
642642   MDRV_CPU_ADD(Z80, 3000000)
643643   /* audio CPU */
src/mame/drivers/konamim2.c
r1877r1878
10481048   MDRV_CPU_ADD(PPC602, 33000000)   /* actually PPC602, 66MHz */
10491049   MDRV_CPU_CONFIG(ppc602_config)
10501050   MDRV_CPU_PROGRAM_MAP(m2_main, 0)
1051   MDRV_CPU_VBLANK_INT(m2, 1)
1051   MDRV_CPU_VBLANK_INT("main", m2)
10521052
10531053   MDRV_CPU_ADD(PPC602, 33000000)   /* actually PPC602, 66MHz */
10541054   MDRV_CPU_CONFIG(ppc602_config)
src/mame/drivers/sengokmj.c
r1877r1878
289289   MDRV_CPU_ADD(V30, 16000000/2) /* V30-8 */
290290   MDRV_CPU_PROGRAM_MAP(sengokmj_map,0)
291291   MDRV_CPU_IO_MAP(sengokmj_io_map,0)
292   MDRV_CPU_VBLANK_INT(sengokmj_interrupt,1)
292   MDRV_CPU_VBLANK_INT("main", sengokmj_interrupt)
293293
294294   SEIBU_SOUND_SYSTEM_CPU(14318180/4)
295295
src/mame/drivers/cham24.c
r1877r1878
6868
6969static READ8_HANDLER( psg_4015_r )
7070{
71   return NESPSG_0_r(0x15);
71   return NESPSG_0_r(machine,0x15);
7272}
7373
7474static WRITE8_HANDLER( psg_4015_w )
7575{
76   NESPSG_0_w(0x15, data);
76   NESPSG_0_w(machine,0x15, data);
7777}
7878
7979static WRITE8_HANDLER( psg_4017_w )
8080{
81   NESPSG_0_w(0x17, data);
81   NESPSG_0_w(machine,0x17, data);
8282}
8383
8484static UINT32 in_0;
r1877r1878
206206
207207   /* reset the ppu */
208208   ppu2c0x_reset( 0, 1 );
209};
209}
210210
211211static PALETTE_INIT( cham24 )
212212{
src/mame/drivers/cave.c
r1877r1878
221221{
222222//  sound_flag1 = 1;
223223//  sound_flag2 = 1;
224   soundlatch_word_w(offset,data,mem_mask);
224   soundlatch_word_w(machine,offset,data,mem_mask);
225225   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
226226   cpu_spinuntil_time(ATTOTIME_IN_USEC(50));   // Allow the other cpu to reply
227227}
r1877r1878
230230static READ8_HANDLER( soundlatch_lo_r )
231231{
232232//  sound_flag1 = 0;
233   return soundlatch_word_r(offset,0) & 0xff;
233   return soundlatch_word_r(machine,offset,0) & 0xff;
234234}
235235
236236/* Sound CPU: read the high 8 bits of the 16 bit sound latch */
237237static READ8_HANDLER( soundlatch_hi_r )
238238{
239239//  sound_flag2 = 0;
240   return soundlatch_word_r(offset,0) >> 8;
240   return soundlatch_word_r(machine,offset,0) >> 8;
241241}
242242
243243/* Main CPU: read the latch written by the sound CPU (acknowledge) */
r1877r1878
273273{
274274   if (ACCESSING_LSB)
275275   {
276      if (offset)   YMZ280B_data_0_w     (offset, data & 0xff);
277      else      YMZ280B_register_0_w (offset, data & 0xff);
276      if (offset)   YMZ280B_data_0_w     (machine, offset, data & 0xff);
277      else      YMZ280B_register_0_w (machine, offset, data & 0xff);
278278   }
279279}
280280
281281/* Handles reads from the YMZ280B */
282282static READ16_HANDLER( cave_sound_r )
283283{
284   return YMZ280B_status_0_r(offset);
284   return YMZ280B_status_0_r(machine,offset);
285285}
286286
287287
r1877r1878
350350static WRITE16_HANDLER( sailormn_eeprom_msb_w )
351351{
352352   sailormn_tilebank_w    ( data &  0x0100 );
353   cave_eeprom_msb_w(offset,data & ~0x0100,mem_mask);
353   cave_eeprom_msb_w(machine,offset,data & ~0x0100,mem_mask);
354354}
355355
356356static WRITE16_HANDLER( hotdogst_eeprom_msb_w )
r1877r1878
578578      case 0:
579579      case 1:
580580      case 2:
581      case 3:   return cave_irq_cause_r(offset,0);
581      case 3:   return cave_irq_cause_r(machine,offset,0);
582582
583583      default:   return 0x0000;
584584   }
r1877r1878
10821082
10831083static READ16_HANDLER( agallet_irq_cause_r )
10841084{
1085   UINT16 irq_cause = cave_irq_cause_r(offset,mem_mask);
1085   UINT16 irq_cause = cave_irq_cause_r(machine,offset,mem_mask);
10861086
10871087   if (offset == 0)
10881088   {
r1877r1878
20182018   /* basic machine hardware */
20192019   MDRV_CPU_ADD(M68000, 16000000)
20202020   MDRV_CPU_PROGRAM_MAP(dfeveron_readmem,dfeveron_writemem)
2021   MDRV_CPU_VBLANK_INT(cave_interrupt,1)
2021   MDRV_CPU_VBLANK_INT("main", cave_interrupt)
20222022
20232023   MDRV_MACHINE_RESET(cave)
20242024   MDRV_NVRAM_HANDLER(cave)
r1877r1878
20572057   /* basic machine hardware */
20582058   MDRV_CPU_ADD(M68000, 16000000)
20592059   MDRV_CPU_PROGRAM_MAP(ddonpach_readmem,ddonpach_writemem)
2060   MDRV_CPU_VBLANK_INT(cave_interrupt,1)
2060   MDRV_CPU_VBLANK_INT("main", cave_interrupt)
20612061
20622062   MDRV_MACHINE_RESET(cave)
20632063   MDRV_NVRAM_HANDLER(cave)
r1877r1878
20962096   /* basic machine hardware */
20972097   MDRV_CPU_ADD(M68000, 16000000)
20982098   MDRV_CPU_PROGRAM_MAP(donpachi_readmem,donpachi_writemem)
2099   MDRV_CPU_VBLANK_INT(cave_interrupt,1)
2099   MDRV_CPU_VBLANK_INT("main", cave_interrupt)
21002100
21012101   MDRV_MACHINE_RESET(cave)
21022102   MDRV_NVRAM_HANDLER(cave)
r1877r1878
21402140   /* basic machine hardware */
21412141   MDRV_CPU_ADD(M68000, 16000000)
21422142   MDRV_CPU_PROGRAM_MAP(esprade_readmem,esprade_writemem)
2143   MDRV_CPU_VBLANK_INT(cave_interrupt,1)
2143   MDRV_CPU_VBLANK_INT("main", cave_interrupt)
21442144
21452145   MDRV_MACHINE_RESET(cave)
21462146   MDRV_NVRAM_HANDLER(cave)
r1877r1878
21782178   /* basic machine hardware */
21792179   MDRV_CPU_ADD(M68000, 16000000)
21802180   MDRV_CPU_PROGRAM_MAP(gaia_readmem,gaia_writemem)
2181   MDRV_CPU_VBLANK_INT(cave_interrupt,1)
2181   MDRV_CPU_VBLANK_INT("main", cave_interrupt)
21822182
21832183   MDRV_MACHINE_RESET(cave)
21842184
r1877r1878
22152215   /* basic machine hardware */
22162216   MDRV_CPU_ADD(M68000, 16000000)
22172217   MDRV_CPU_PROGRAM_MAP(guwange_readmem,guwange_writemem)
2218   MDRV_CPU_VBLANK_INT(cave_interrupt,1)
2218   MDRV_CPU_VBLANK_INT("main", cave_interrupt)
22192219
22202220   MDRV_MACHINE_RESET(cave)
22212221   MDRV_NVRAM_HANDLER(cave)
r1877r1878
22522252   /* basic machine hardware */
22532253   MDRV_CPU_ADD(M68000, 16000000)
22542254   MDRV_CPU_PROGRAM_MAP(hotdogst_readmem,hotdogst_writemem)
2255   MDRV_CPU_VBLANK_INT(cave_interrupt,1)
2255   MDRV_CPU_VBLANK_INT("main", cave_interrupt)
22562256
22572257   MDRV_CPU_ADD(Z80, 4000000)
22582258   /* audio CPU */   /* ? */
r1877r1878
23072307   /* basic machine hardware */
23082308   MDRV_CPU_ADD(M68000, 16000000)
23092309   MDRV_CPU_PROGRAM_MAP(korokoro_readmem,korokoro_writemem)
2310   MDRV_CPU_VBLANK_INT(cave_interrupt,1)
2310   MDRV_CPU_VBLANK_INT("main", cave_interrupt)
23112311
23122312   MDRV_MACHINE_RESET(cave)
23132313   MDRV_NVRAM_HANDLER(korokoro)
r1877r1878
23462346   /* basic machine hardware */
23472347   MDRV_CPU_ADD(M68000, 16000000)
23482348   MDRV_CPU_PROGRAM_MAP(mazinger_readmem,mazinger_writemem)
2349   MDRV_CPU_VBLANK_INT(cave_interrupt,1)
2349   MDRV_CPU_VBLANK_INT("main", cave_interrupt)
23502350
23512351   MDRV_CPU_ADD(Z80, 4000000)
23522352//  /* audio CPU */ // Bidirectional communication
r1877r1878
24032403   /* basic machine hardware */
24042404   MDRV_CPU_ADD(M68000,32000000 / 2)
24052405   MDRV_CPU_PROGRAM_MAP(metmqstr_readmem,metmqstr_writemem)
2406   MDRV_CPU_VBLANK_INT(cave_interrupt,1)
2406   MDRV_CPU_VBLANK_INT("main", cave_interrupt)
24072407
24082408   MDRV_CPU_ADD(Z80,32000000 / 4)
24092409   /* audio CPU */
r1877r1878
24612461   /* basic machine hardware */
24622462   MDRV_CPU_ADD(M68000, 16000000)   /* 16 MHz */
24632463   MDRV_CPU_PROGRAM_MAP(pwrinst2_readmem,pwrinst2_writemem)
2464   MDRV_CPU_VBLANK_INT(cave_interrupt,1)
2464   MDRV_CPU_VBLANK_INT("main", cave_interrupt)
24652465
24662466   MDRV_CPU_ADD(Z80,16000000 / 2)
24672467   /* audio CPU */   /* 8 MHz */
r1877r1878
25212521   /* basic machine hardware */
25222522   MDRV_CPU_ADD(M68000, 16000000)
25232523   MDRV_CPU_PROGRAM_MAP(sailormn_readmem,sailormn_writemem)
2524   MDRV_CPU_VBLANK_INT(cave_interrupt,1)
2524   MDRV_CPU_VBLANK_INT("main", cave_interrupt)
25252525
25262526   MDRV_CPU_ADD(Z80, 8000000)
25272527//  /* audio CPU */ // Bidirectional Communication
r1877r1878
25762576   /* basic machine hardware */
25772577   MDRV_CPU_ADD(M68000, 16000000)
25782578   MDRV_CPU_PROGRAM_MAP(uopoko_readmem,uopoko_writemem)
2579   MDRV_CPU_VBLANK_INT(cave_interrupt,1)
2579   MDRV_CPU_VBLANK_INT("main", cave_interrupt)
25802580
25812581   MDRV_NVRAM_HANDLER(cave)
25822582
src/mame/drivers/dooyong.c
r1877r1878
977977   /* basic machine hardware */
978978   MDRV_CPU_ADD(Z80, 8000000)   /* ??? */
979979   MDRV_CPU_PROGRAM_MAP(lastday_readmem,lastday_writemem)
980   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
980   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
981981
982982   MDRV_CPU_ADD(Z80, 4000000)
983983   /* audio CPU */   /* ??? */
r1877r1878
10111011   /* basic machine hardware */
10121012   MDRV_CPU_ADD(Z80, 8000000)   /* ??? */
10131013   MDRV_CPU_PROGRAM_MAP(gulfstrm_readmem,pollux_writemem)
1014   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1014   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
10151015
10161016   MDRV_CPU_ADD(Z80, 4000000)
10171017   /* audio CPU */   /* ??? */
r1877r1878
10451045   /* basic machine hardware */
10461046   MDRV_CPU_ADD(Z80, 8000000)   /* ??? */
10471047   MDRV_CPU_PROGRAM_MAP(pollux_readmem,pollux_writemem)
1048   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1048   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
10491049
10501050   MDRV_CPU_ADD(Z80, 4000000)
10511051   /* audio CPU */   /* ??? */
r1877r1878
10791079   /* basic machine hardware */
10801080   MDRV_CPU_ADD(Z80, 8000000)   /* ??? */
10811081   MDRV_CPU_PROGRAM_MAP(bluehawk_readmem,bluehawk_writemem)
1082   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1082   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
10831083
10841084   MDRV_CPU_ADD(Z80, 4000000)
10851085   /* audio CPU */   /* ??? */
r1877r1878
11131113   /* basic machine hardware */
11141114   MDRV_CPU_ADD(Z80, 8000000)   /* ??? */
11151115   MDRV_CPU_PROGRAM_MAP(flytiger_readmem,flytiger_writemem)
1116   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1116   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
11171117
11181118   MDRV_CPU_ADD(Z80, 4000000)
11191119   /* audio CPU */   /* ??? */
r1877r1878
11471147   /* basic machine hardware */
11481148   MDRV_CPU_ADD(Z80, 8000000)   /* ??? */
11491149   MDRV_CPU_PROGRAM_MAP(primella_readmem,primella_writemem)
1150   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1150   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
11511151
11521152   MDRV_CPU_ADD(Z80, 4000000)
11531153   /* audio CPU */   /* ??? */
r1877r1878
11851185   /* basic machine hardware */
11861186   MDRV_CPU_ADD(M68000, 8000000)   /* measured on super-x */
11871187   MDRV_CPU_PROGRAM_MAP(rshark_readmem,rshark_writemem)
1188   MDRV_CPU_VBLANK_INT(rshark_interrupt,2)   /* 5 and 6 */
1188   MDRV_CPU_VBLANK_INT_HACK(rshark_interrupt,2)   /* 5 and 6 */
11891189
11901190   MDRV_CPU_ADD(Z80, 4000000)
11911191   /* audio CPU */   /* measured on super-x */
r1877r1878
12171217   /* basic machine hardware */
12181218   MDRV_CPU_ADD(M68000, 8000000)   /* measured on super-x */
12191219   MDRV_CPU_PROGRAM_MAP(superx_readmem,superx_writemem)
1220   MDRV_CPU_VBLANK_INT(rshark_interrupt,2)   /* 5 and 6 */
1220   MDRV_CPU_VBLANK_INT_HACK(rshark_interrupt,2)   /* 5 and 6 */
12211221
12221222   MDRV_CPU_ADD(Z80, 4000000)
12231223   /* audio CPU */   /* measured on super-x */
r1877r1878
12491249   /* basic machine hardware */
12501250   MDRV_CPU_ADD(M68000, 10000000)
12511251   MDRV_CPU_PROGRAM_MAP(popbingo_readmem,popbingo_writemem)
1252   MDRV_CPU_VBLANK_INT(rshark_interrupt,2)   /* 5 and 6 */
1252   MDRV_CPU_VBLANK_INT_HACK(rshark_interrupt,2)   /* 5 and 6 */
12531253
12541254   MDRV_CPU_ADD(Z80, 4000000)
12551255   /* audio CPU */   /* measured on super-x */
src/mame/drivers/brkthru.c
r1877r1878
6767VIDEO_UPDATE( brkthru );
6868
6969
70static int nmi_enable;
71
7270static WRITE8_HANDLER( brkthru_1803_w )
7371{
7472   /* bit 0 = NMI enable */
75   nmi_enable = ~data & 1;
73   cpu_interrupt_enable(0, ~data & 1);
7674
7775   /* bit 1 = ? maybe IRQ acknowledge */
7876}
7977static WRITE8_HANDLER( darwin_0803_w )
8078{
8179   /* bit 0 = NMI enable */
82   /*nmi_enable = ~data & 1;*/
80   /*cpu_interrupt_enable(1, ~data & 1);*/
8381   logerror("0803 %02X\n",data);
84        nmi_enable = data;
82   cpu_interrupt_enable(0, data & 1);
8583   /* bit 1 = ? maybe IRQ acknowledge */
8684}
8785
8886static WRITE8_HANDLER( brkthru_soundlatch_w )
8987{
90   soundlatch_w(offset,data);
91   cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
88   soundlatch_w(machine,offset,data);
89   cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
9290}
9391
92static INPUT_CHANGED( coin_inserted )
93{
94   /* coin insertion causes an IRQ */
95   cpunum_set_input_line(machine, 0, 0, newval ? CLEAR_LINE : ASSERT_LINE);
96}
9497
9598
99
96100static ADDRESS_MAP_START( brkthru_map, ADDRESS_SPACE_PROGRAM, 8 )
97101   AM_RANGE(0x0000, 0x03ff) AM_READWRITE(MRA8_RAM, brkthru_fgram_w) AM_BASE(&brkthru_videoram) AM_SIZE(&brkthru_videoram_size)
98102   AM_RANGE(0x0400, 0x0bff) AM_RAM
r1877r1878
143147
144148
145149
146static INTERRUPT_GEN( brkthru_interrupt )
147{
148   if (cpu_getiloops() == 0)
149   {
150      if (nmi_enable)
151         cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
152   }
153   else
154   {
155      /* generate IRQ on coin insertion */
156      if ((readinputportbytag("IN2") & 0xe0) != 0xe0)
157         cpunum_set_input_line(machine, 0, 0, HOLD_LINE);
158   }
159}
160
161150#define COMMON_IN0\
162151   PORT_START_TAG("IN0")\
163152   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )\
r1877r1878
181170   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK )   /* used only by the self test */
182171
183172static INPUT_PORTS_START( brkthru )
184COMMON_IN0
185COMMON_IN1
173   COMMON_IN0
174   COMMON_IN1
186175
187176   PORT_START_TAG("IN2")
188177   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
r1877r1878
198187   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Allow_Continue ) )
199188   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
200189   PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
201   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)   /* Manual says Picture Flip=On, Normal=Off */
202   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2)
203   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_IMPULSE(2)
190   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)   /* Manual says Picture Flip=On, Normal=Off */
191   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
192   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_CHANGED(coin_inserted, 0)
204193
205194   PORT_START_TAG("DSW0")
206195   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
r1877r1878
228217INPUT_PORTS_END
229218
230219static INPUT_PORTS_START( brkthruj )
231COMMON_IN0
232COMMON_IN1
220   COMMON_IN0
221   COMMON_IN1
233222
234223   PORT_START_TAG("IN2")
235224   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
r1877r1878
243232   PORT_DIPSETTING(    0x0c, "20000/30000 Points" )
244233   PORT_DIPSETTING(    0x08, "20000/40000 Points" )
245234   PORT_SERVICE( 0x10, IP_ACTIVE_LOW )
246   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)   /* Manual says Pitcure Flip=On, Normal=Off */
247   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2)
248   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_IMPULSE(2)
235   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)   /* Manual says Pitcure Flip=On, Normal=Off */
236   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
237   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_CHANGED(coin_inserted, 0)
249238
250239   PORT_START_TAG("DSW0")
251240   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
r1877r1878
273262INPUT_PORTS_END
274263
275264static INPUT_PORTS_START( darwin )
276COMMON_IN0
277COMMON_IN1
265   COMMON_IN0
266   COMMON_IN1
278267
279268   PORT_START_TAG("IN2")   /* modified by Shingo Suzuki 1999/11/02 */
280269   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Lives ) )
r1877r1878
291280   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) )
292281   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
293282   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
294   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
295   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2)
296   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_IMPULSE(2)
283   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
284   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
285   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_CHANGED(coin_inserted, 0)
297286
298287   PORT_START_TAG("DSW0")
299288   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
r1877r1878
402391   /* basic machine hardware */
403392   MDRV_CPU_ADD(M6809, MASTER_CLOCK/8)        /* 1.5 MHz ? */
404393   MDRV_CPU_PROGRAM_MAP(brkthru_map,0)
405   MDRV_CPU_VBLANK_INT(brkthru_interrupt,2)
394   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
406395
407396   MDRV_CPU_ADD(M6809, MASTER_CLOCK/8)      /* 1.5 MHz ? */
408397   MDRV_CPU_PROGRAM_MAP(sound_map,0)
r1877r1878
440429   /* basic machine hardware */
441430   MDRV_CPU_ADD(M6809, MASTER_CLOCK/8)        /* 1.5 MHz ? */
442431   MDRV_CPU_PROGRAM_MAP(darwin_map,0)
443   MDRV_CPU_VBLANK_INT(brkthru_interrupt,2)
432   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
444433
445434   MDRV_CPU_ADD(M6809, MASTER_CLOCK/8)      /* 1.5 MHz ? */
446435   MDRV_CPU_PROGRAM_MAP(sound_map,0)
src/mame/drivers/dec8.c
r1877r1878
9595/* Only used by ghostb, gondo, garyoret, other games can control buffering */
9696static VIDEO_EOF( dec8 )
9797{
98   buffer_spriteram_w(0,0);
98   buffer_spriteram_w(machine,0,0);
9999}
100100
101101static READ8_HANDLER( i8751_h_r )
r1877r1878
426426
427427static WRITE8_HANDLER( dec8_sound_w )
428428{
429    soundlatch_w(0,data);
430   cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
429    soundlatch_w(machine,0,data);
430   cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
431431}
432432
433433static WRITE8_HANDLER( oscar_sound_w )
434434{
435    soundlatch_w(0,data);
436   cpunum_set_input_line(Machine, 2,INPUT_LINE_NMI,PULSE_LINE);
435    soundlatch_w(machine,0,data);
436   cpunum_set_input_line(machine, 2,INPUT_LINE_NMI,PULSE_LINE);
437437}
438438
439439static void csilver_adpcm_int(int data)
r1877r1878
20872087   /* basic machine hardware */
20882088   MDRV_CPU_ADD(M6809, 2000000)
20892089   MDRV_CPU_PROGRAM_MAP(cobra_readmem,cobra_writemem)
2090   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
2090   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
20912091
20922092   MDRV_CPU_ADD(M6502, 1500000)
20932093   /* audio CPU */
r1877r1878
21292129   /* basic machine hardware */
21302130   MDRV_CPU_ADD(HD6309, 3000000*4)
21312131   MDRV_CPU_PROGRAM_MAP(ghostb_readmem,ghostb_writemem)
2132   MDRV_CPU_VBLANK_INT(ghostb_interrupt,1)
2132   MDRV_CPU_VBLANK_INT("main", ghostb_interrupt)
21332133
21342134   MDRV_CPU_ADD(M6502, 1500000)
21352135   /* audio CPU */
r1877r1878
21732173   /* basic machine hardware */
21742174   MDRV_CPU_ADD(M6809,2000000)  /* MC68A09EP */
21752175   MDRV_CPU_PROGRAM_MAP(srdarwin_readmem,srdarwin_writemem)
2176   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
2176   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
21772177
21782178   MDRV_CPU_ADD(M6502, 1500000)
21792179   /* audio CPU */
r1877r1878
22152215   /* basic machine hardware */
22162216   MDRV_CPU_ADD(HD6309,3000000*4) /* HD63C09EP */
22172217   MDRV_CPU_PROGRAM_MAP(gondo_readmem,gondo_writemem)
2218   MDRV_CPU_VBLANK_INT(gondo_interrupt,1)
2218   MDRV_CPU_VBLANK_INT("main", gondo_interrupt)
22192219
22202220   MDRV_CPU_ADD(M6502, 1500000)
22212221   /* audio CPU */
r1877r1878
22582258   /* basic machine hardware */
22592259   MDRV_CPU_ADD(HD6309, XTAL_12MHz/2) /* verified on pcb */
22602260   MDRV_CPU_PROGRAM_MAP(oscar_readmem,oscar_writemem)
2261   MDRV_CPU_VBLANK_INT(oscar_interrupt,1)
2261   MDRV_CPU_VBLANK_INT("main", oscar_interrupt)
22622262
22632263   MDRV_CPU_ADD(HD6309, XTAL_12MHz/2) /* verified on pcb */
22642264   MDRV_CPU_PROGRAM_MAP(oscar_sub_readmem,oscar_sub_writemem)
r1877r1878
23972397
23982398   MDRV_CPU_ADD(M6809, XTAL_12MHz/8) /* verified on pcb */
23992399   MDRV_CPU_PROGRAM_MAP(csilver_sub_readmem,csilver_sub_writemem)
2400   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
2400   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
24012401
24022402   MDRV_CPU_ADD(M6502, XTAL_12MHz/8) /* verified on pcb */
24032403   /* audio CPU */
r1877r1878
24442444   /* basic machine hardware */
24452445   MDRV_CPU_ADD(HD6309,3000000*4) /* HD63C09EP */
24462446   MDRV_CPU_PROGRAM_MAP(garyoret_readmem,garyoret_writemem)
2447   MDRV_CPU_VBLANK_INT(gondo_interrupt,1)
2447   MDRV_CPU_VBLANK_INT("main", gondo_interrupt)
24482448
24492449   MDRV_CPU_ADD(M6502, 1500000)
24502450   /* audio CPU */
src/mame/drivers/rcorsair.c
r1877r1878
121121
122122   MDRV_CPU_ADD(8085A,8000000)       /* Sound CPU? */
123123   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
124//  MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
124//  MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
125125
126126   MDRV_SCREEN_ADD("main", RASTER)
127127   MDRV_SCREEN_REFRESH_RATE(60)
src/mame/drivers/tbowl.c
r1877r1878
8686
8787static WRITE8_HANDLER( tbowl_sound_command_w )
8888{
89   soundlatch_w(offset,data);
90   cpunum_set_input_line(Machine, 2,INPUT_LINE_NMI,PULSE_LINE);
89   soundlatch_w(machine,offset,data);
90   cpunum_set_input_line(machine, 2,INPUT_LINE_NMI,PULSE_LINE);
9191}
9292
9393
r1877r1878
589589   /* CPU on Board '6206B' */
590590   MDRV_CPU_ADD(Z80, 8000000) /* NEC D70008AC-8 (Z80 Clone) */
591591   MDRV_CPU_PROGRAM_MAP(readmem_6206B,writemem_6206B)
592   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
592   MDRV_CPU_VBLANK_INT("left", irq0_line_hold)
593593
594594   /* CPU on Board '6206C' */
595595   MDRV_CPU_ADD(Z80, 8000000) /* NEC D70008AC-8 (Z80 Clone) */
596596   MDRV_CPU_PROGRAM_MAP(readmem_6206C,writemem_6206C)
597   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
597   MDRV_CPU_VBLANK_INT("left", irq0_line_hold)
598598
599599   /* CPU on Board '6206A' */
600600   MDRV_CPU_ADD(Z80, 4000000) /* Actual Z80 */
src/mame/drivers/battlane.c
r1877r1878
258258   /* basic machine hardware */
259259   MDRV_CPU_ADD(M6809, 1250000)        /* 1.25 MHz ? */
260260   MDRV_CPU_PROGRAM_MAP(battlane_map, 0)
261   MDRV_CPU_VBLANK_INT(battlane_cpu1_interrupt, 1)
261   MDRV_CPU_VBLANK_INT("main", battlane_cpu1_interrupt)
262262
263263   MDRV_CPU_ADD(M6809, 1250000)        /* 1.25 MHz ? */
264264   MDRV_CPU_PROGRAM_MAP(battlane_map, 0)
src/mame/drivers/atarigt.c
r1877r1878
9393   if (reason)
9494      atarigen_sound_int_gen(Machine, 0);
9595   else
96      atarigen_sound_int_ack_w(0,0,0);
96      atarigen_sound_int_ack_w(Machine,0,0,0);
9797}
9898
9999
r1877r1878
807807   /* basic machine hardware */
808808   MDRV_CPU_ADD(M68EC020, ATARI_CLOCK_50MHz/2)
809809   MDRV_CPU_PROGRAM_MAP(main_map,0)
810   MDRV_CPU_VBLANK_INT(atarigen_video_int_gen,1)
810   MDRV_CPU_VBLANK_INT("main", atarigen_video_int_gen)
811811   MDRV_CPU_PERIODIC_INT(atarigen_scanline_int_gen, 250)
812812
813813   MDRV_MACHINE_RESET(atarigt)
r1877r1878
10871087   if (pc == 0x25834 || pc == 0x25860)
10881088      logerror("%06X:PFW@%06X = %08X & %08X (src=%06X)\n", activecpu_get_pc(), 0xd72000 + offset*4, data, ~mem_mask, (UINT32)activecpu_get_reg(M68K_A3) - 2);
10891089
1090   atarigen_playfield32_w(offset, data, mem_mask);
1090   atarigen_playfield32_w(machine, offset, data, mem_mask);
10911091}
10921092
10931093static DRIVER_INIT( tmek )
src/mame/drivers/cherrym2.c
r1877r1878
354354   MDRV_CPU_ADD(Z80, 8000000/2)   // ???
355355   MDRV_CPU_PROGRAM_MAP(cm_map, 0)
356356   MDRV_CPU_IO_MAP(cm_io_map, 0)
357   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
357   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
358358
359359   //MDRV_NVRAM_HANDLER(cmv801)
360360
src/mame/drivers/rbmk.c
r1877r1878
8888
8989static READ16_HANDLER( eeprom_r )
9090{
91   return (EEPROM_read_bit() << 15)|(input_port_3_word_r(0,0)&0x7fff);
91   return (EEPROM_read_bit() << 15)|(input_port_3_word_r(machine,0,0)&0x7fff);
9292}
9393
9494static WRITE16_HANDLER( eeprom_w )
r1877r1878
501501static MACHINE_DRIVER_START( rbmk )
502502   MDRV_CPU_ADD_TAG("main", M68000, 22000000 /2)
503503   MDRV_CPU_PROGRAM_MAP(rbmk_mem,0)
504   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
504   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
505505
506506   MDRV_GFXDECODE(rbmk)
507507
src/mame/drivers/bigfghtr.c
r1877r1878
214214
215215
216216
217static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int priority )
217static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority )
218218{
219219   int offs;
220220   for (offs = 0;offs < spriteram_size/2;offs += 4)
r1877r1878
272272
273273static VIDEO_EOF( bigfghtr )
274274{
275   buffer_spriteram16_w(0,0,0);
275   buffer_spriteram16_w(machine,0,0,0);
276276}
277277
278278
279279static WRITE16_HANDLER( sound_command_w )
280280{
281281   if (ACCESSING_LSB)
282      soundlatch_w(0,((data & 0x7f) << 1) | 1);
282      soundlatch_w(machine,0,((data & 0x7f) << 1) | 1);
283283}
284284
285285static WRITE16_HANDLER( io_w )
r1877r1878
317317         break;
318318
319319         case 0x46/2:
320            return (input_port_0_word_r(0,0)&0xffff)^0xffff;
320            return (input_port_0_word_r(machine,0,0)&0xffff)^0xffff;
321321
322322
323323      }
r1877r1878
357357
358358static READ8_HANDLER( soundlatch_clear_r )
359359{
360   soundlatch_clear_w(0,0);
360   soundlatch_clear_w(machine,0,0);
361361   return 0;
362362}
363363
r1877r1878
421421   MDRV_CPU_ADD(M68000, 8000000) /* 8 MHz?? */
422422   MDRV_CPU_PROGRAM_MAP(mainmem,0)
423423
424   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
424   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
425425
426426   MDRV_CPU_ADD(Z80, 3072000)
427427   /* audio CPU */   /* 3.072 MHz???? */
428428   MDRV_CPU_PROGRAM_MAP(soundmem,0)
429429   MDRV_CPU_IO_MAP(soundport,0)
430   MDRV_CPU_VBLANK_INT(irq0_line_hold,128)
430   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,128)
431431
432432   /* video hardware */
433433   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
src/mame/drivers/genesis.c
r1877r1878
271271      switch (offset & 3)
272272      {
273273      case 0:
274         if (ACCESSING_MSB)    return YM3438_status_port_0_A_r(0) << 8;
275         else              return YM3438_read_port_0_r(0);
274         if (ACCESSING_MSB)    return YM3438_status_port_0_A_r(machine, 0) << 8;
275         else              return YM3438_read_port_0_r(machine, 0);
276276         break;
277277      case 2:
278         if (ACCESSING_MSB)   return YM3438_status_port_0_B_r(0) << 8;
278         if (ACCESSING_MSB)   return YM3438_status_port_0_B_r(machine, 0) << 8;
279279         else             return 0;
280280         break;
281281      }
r1877r1878
331331      switch (offset & 3)
332332      {
333333      case 0:
334         if (ACCESSING_MSB)    return YM3438_status_port_0_A_r(0) << 8;
335         else              return YM3438_read_port_0_r(0);
334         if (ACCESSING_MSB)    return YM3438_status_port_0_A_r(machine, 0) << 8;
335         else              return YM3438_read_port_0_r(machine, 0);
336336         break;
337337      case 2:
338         if (ACCESSING_MSB)   return YM3438_status_port_0_B_r(0) << 8;
338         if (ACCESSING_MSB)   return YM3438_status_port_0_B_r(machine, 0) << 8;
339339         else             return 0;
340340         break;
341341      }
r1877r1878
383383      switch (offset & 3)
384384      {
385385      case 0:
386         if (ACCESSING_MSB)   YM3438_control_port_0_A_w   (0,   (data >> 8) & 0xff);
387         else             YM3438_data_port_0_A_w      (0,   (data >> 0) & 0xff);
386         if (ACCESSING_MSB)   YM3438_control_port_0_A_w   (machine, 0,   (data >> 8) & 0xff);
387         else             YM3438_data_port_0_A_w      (machine, 0,   (data >> 0) & 0xff);
388388         break;
389389      case 2:
390         if (ACCESSING_MSB)   YM3438_control_port_0_B_w   (0,   (data >> 8) & 0xff);
391         else             YM3438_data_port_0_B_w      (0,   (data >> 0) & 0xff);
390         if (ACCESSING_MSB)   YM3438_control_port_0_B_w   (machine, 0,   (data >> 8) & 0xff);
391         else             YM3438_data_port_0_B_w      (machine, 0,   (data >> 0) & 0xff);
392392         break;
393393      }
394394   }
r1877r1878
412412
413413      if ( (offset >= 0x10) && (offset <=0x17) )
414414      {
415         if (ACCESSING_LSB) SN76496_0_w(0, data & 0xff);
416         if (ACCESSING_MSB) SN76496_0_w(0, (data >>8) & 0xff);
415         if (ACCESSING_LSB) SN76496_0_w(machine, 0, data & 0xff);
416         if (ACCESSING_MSB) SN76496_0_w(machine, 0, (data >>8) & 0xff);
417417      }
418418
419419   }
r1877r1878
677677   {
678678      switch (offset & 3)
679679      {
680      case 0: return YM3438_status_port_0_A_r(0);
681      case 1: return YM3438_read_port_0_r(0);
682      case 2: return YM3438_status_port_0_B_r(0);
680      case 0: return YM3438_status_port_0_A_r(machine, 0);
681      case 1: return YM3438_read_port_0_r(machine, 0);
682      case 2: return YM3438_status_port_0_B_r(machine, 0);
683683      case 3: return 0;
684684      }
685685   }
r1877r1878
714714   {
715715      switch (offset & 3)
716716      {
717      case 0: YM3438_control_port_0_A_w   (0,   data);
717      case 0: YM3438_control_port_0_A_w   (machine, 0,   data);
718718         break;
719      case 1: YM3438_data_port_0_A_w      (0, data);
719      case 1: YM3438_data_port_0_A_w      (machine, 0, data);
720720         break;
721      case 2: YM3438_control_port_0_B_w   (0,   data);
721      case 2: YM3438_control_port_0_B_w   (machine, 0,   data);
722722         break;
723      case 3: YM3438_data_port_0_B_w      (0,   data);
723      case 3: YM3438_data_port_0_B_w      (machine, 0,   data);
724724         break;
725725      }
726726   }
r1877r1878
728728   /* Bank Register */
729729   if ((offset >= 0x6000) && (offset <= 0x60ff))
730730   {
731      genesis_bank_select_w(offset & 0xff, data);
731      genesis_bank_select_w(machine, offset & 0xff, data);
732732   }
733733
734734   /* Unused / Illegal */
r1877r1878
782782   /*basic machine hardware */
783783   MDRV_CPU_ADD_TAG("main", M68000, MASTER_CLOCK / 7)
784784   MDRV_CPU_PROGRAM_MAP(genesis_readmem, genesis_writemem)
785   MDRV_CPU_VBLANK_INT(genesis_vblank_interrupt,1)
785   MDRV_CPU_VBLANK_INT("main", genesis_vblank_interrupt)
786786
787787   MDRV_CPU_ADD_TAG("sound", Z80, MASTER_CLOCK / 15)
788788   MDRV_CPU_PROGRAM_MAP(genesis_z80_readmem, genesis_z80_writemem)
789   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1) /* from vdp at scanline 0xe0 */
789   MDRV_CPU_VBLANK_INT("main", irq0_line_hold) /* from vdp at scanline 0xe0 */
790790
791791   MDRV_INTERLEAVE(100)
792792
src/mame/drivers/amidar.c
r1877r1878
6161
6262static READ8_HANDLER(amidar_ppi8255_0_r)
6363{
64   return ppi8255_0_r(offset >> 4);
64   return ppi8255_0_r(machine, offset >> 4);
6565}
6666
6767static READ8_HANDLER(amidar_ppi8255_1_r)
6868{
69   return ppi8255_1_r(offset >> 4);
69   return ppi8255_1_r(machine, offset >> 4);
7070}
7171
7272static WRITE8_HANDLER(amidar_ppi8255_0_w)
7373{
74   ppi8255_0_w(offset >> 4, data);
74   ppi8255_0_w(machine, offset >> 4, data);
7575}
7676
7777static WRITE8_HANDLER(amidar_ppi8255_1_w)
7878{
79   ppi8255_1_w(offset >> 4, data);
79   ppi8255_1_w(machine, offset >> 4, data);
8080}
8181
8282
src/mame/drivers/thepit.c
r1877r1878
644644   /* basic machine hardware */
645645   MDRV_CPU_ADD_TAG("main", Z80, PIXEL_CLOCK/2)     /* 3.072 MHz */
646646   MDRV_CPU_PROGRAM_MAP(thepit_main_map,0)
647   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
647   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
648648
649649   MDRV_CPU_ADD(Z80, SOUND_CLOCK/4)     /* 2.5 MHz */
650650   MDRV_CPU_PROGRAM_MAP(audio_map,0)
651651   MDRV_CPU_IO_MAP(audio_io_map,0)
652   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
652   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
653653
654654   /* video hardware */
655655   MDRV_GFXDECODE(thepit)
src/mame/drivers/trvmadns.c
r1877r1878
282282   MDRV_CPU_ADD(Z80,10000000/2) // ?
283283   MDRV_CPU_PROGRAM_MAP(cpu_map,0)
284284   MDRV_CPU_IO_MAP(io_map,0)
285   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
285   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
286286
287287   /* video hardware */
288288   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/changela.c
r1877r1878
99***************************************************************************/
1010
1111#include "driver.h"
12#include "deprecat.h"
1213#include "cpu/z80/z80.h"
1314#include "cpu/m6805/m6805.h"
1415#include "sound/ay8910.h"
r1877r1878
479480
480481   MDRV_CPU_ADD(Z80,5000000)
481482   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
482   MDRV_CPU_VBLANK_INT(chl_interrupt,4)
483   MDRV_CPU_VBLANK_INT_HACK(chl_interrupt,4)
483484
484485   MDRV_CPU_ADD(M68705,2500000)
485486   MDRV_CPU_PROGRAM_MAP(mcu_readmem,mcu_writemem)
src/mame/drivers/crimfght.c
r1877r1878
3131
3232static WRITE8_HANDLER( crimfght_sh_irqtrigger_w )
3333{
34   soundlatch_w(offset,data);
35   cpunum_set_input_line_and_vector(Machine, 1,0,HOLD_LINE,0xff);
34   soundlatch_w(machine,offset,data);
35   cpunum_set_input_line_and_vector(machine, 1,0,HOLD_LINE,0xff);
3636}
3737
3838static WRITE8_HANDLER( crimfght_snd_bankswitch_w )
r1877r1878
367367   /* basic machine hardware */
368368   MDRV_CPU_ADD(KONAMI, 3000000)      /* ? */
369369   MDRV_CPU_PROGRAM_MAP(crimfght_readmem,crimfght_writemem)
370   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
370   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
371371
372372   MDRV_CPU_ADD(Z80, 3579545)   /* verified with PCB */
373373   /* audio CPU */
src/mame/drivers/rabbit.c
r1877r1878
9595static UINT32 *rabbit_tilemap_regs[4];
9696static UINT32 *rabbit_spriteregs;
9797static UINT32 *rabbit_blitterregs;
98static mame_bitmap *rabbit_sprite_bitmap;
98static bitmap_t *rabbit_sprite_bitmap;
9999static rectangle rabbit_sprite_clip;
100100
101101static int rabbit_vblirqlevel, rabbit_bltirqlevel, rabbit_banking;
r1877r1878
214214
215215*/
216216
217static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
217static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
218218{
219219   int xpos,ypos,tileno,xflip,yflip, colr;
220220   const gfx_element *gfx = machine->gfx[1];
r1877r1878
253253}
254254
255255/* the sprite bitmap can probably be handled better than this ... */
256static void rabbit_clearspritebitmap( mame_bitmap *bitmap, const rectangle *cliprect )
256static void rabbit_clearspritebitmap( bitmap_t *bitmap, const rectangle *cliprect )
257257{
258258   int startx, starty;
259259   int y;
r1877r1878
280280}
281281
282282/* todo: fix zoom, its inaccurate and this code is ugly */
283static void draw_sprite_bitmap( mame_bitmap *bitmap, const rectangle *cliprect )
283static void draw_sprite_bitmap( bitmap_t *bitmap, const rectangle *cliprect )
284284{
285285
286286   UINT32 x,y;
r1877r1878
383383
384384*/
385385
386static void rabbit_drawtilemap( mame_bitmap *bitmap, const rectangle *cliprect, int whichtilemap )
386static void rabbit_drawtilemap( bitmap_t *bitmap, const rectangle *cliprect, int whichtilemap )
387387{
388388   INT32 startx, starty, incxx, incxy, incyx, incyy, tran;
389389
r1877r1878
10681068static MACHINE_DRIVER_START( rabbit )
10691069   MDRV_CPU_ADD_TAG("main",M68EC020,24000000) /* 24 MHz */
10701070   MDRV_CPU_PROGRAM_MAP(rabbit_readmem,rabbit_writemem)
1071   MDRV_CPU_VBLANK_INT(rabbit_interrupts,262)
1071   MDRV_CPU_VBLANK_INT_HACK(rabbit_interrupts,262)
10721072   /* (rabbit) */
10731073/*  lev 1 : 0x64 : 0000 027c -
10741074    lev 2 : 0x68 : 0000 3106 - unused?
r1877r1878
11971197   MDRV_IMPORT_FROM(rabbit)
11981198   MDRV_CPU_MODIFY("main")
11991199   MDRV_CPU_PROGRAM_MAP(tmmjprd_readmem,tmmjprd_writemem)
1200   MDRV_CPU_VBLANK_INT(tmmjprd_interrupt,2)
1200   MDRV_CPU_VBLANK_INT_HACK(tmmjprd_interrupt,2)
12011201
12021202   MDRV_VIDEO_START(tmmjprd)
12031203   MDRV_VIDEO_UPDATE(tmmjprd)
src/mame/drivers/sstrangr.c
r1877r1878
66
77
88#include "driver.h"
9#include "deprecat.h"
910
1011
1112#define NUM_PENS   (8)
r1877r1878
183184   MDRV_CPU_ADD_TAG("main",8080,1996800)   /* clock is a guess, taken from mw8080bw */
184185   MDRV_CPU_PROGRAM_MAP(sstrangr_map,0)
185186   MDRV_CPU_IO_MAP(sstrangr_io_map,0)
186   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
187   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
187188
188189   /* video hardware */
189190   MDRV_VIDEO_UPDATE(sstrangr)
src/mame/drivers/asuka.c
r1877r1878
783783   /* basic machine hardware */
784784   MDRV_CPU_ADD(M68000, 8000000)    /* checked on PCB */
785785   MDRV_CPU_PROGRAM_MAP(bonzeadv_map,0)
786   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
786   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
787787
788788   MDRV_CPU_ADD(Z80,4000000)    /* sound CPU, also required for test mode */
789789   MDRV_CPU_PROGRAM_MAP(bonzeadv_z80_map,0)
r1877r1878
819819   /* basic machine hardware */
820820   MDRV_CPU_ADD(M68000, XTAL_16MHz/2)   /* verified on pcb */
821821   MDRV_CPU_PROGRAM_MAP(asuka_map,0)
822   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
822   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)
823823
824824   MDRV_CPU_ADD(Z80, XTAL_16MHz/4)   /* verified on pcb */
825825   MDRV_CPU_PROGRAM_MAP(z80_map,0)
r1877r1878
858858   /* basic machine hardware */
859859   MDRV_CPU_ADD(M68000, XTAL_32MHz/2)   /* 68000p12 running at 16Mhz, verified on pcb  */
860860   MDRV_CPU_PROGRAM_MAP(cadash_map,0)
861   MDRV_CPU_VBLANK_INT(cadash_interrupt,1)
861   MDRV_CPU_VBLANK_INT("main", cadash_interrupt)
862862
863863   MDRV_CPU_ADD(Z80, XTAL_8MHz/2)   /* verified on pcb */
864864   MDRV_CPU_PROGRAM_MAP(cadash_z80_map,0)
r1877r1878
893893   /* basic machine hardware */
894894   MDRV_CPU_ADD(M68000, 8000000)   /* 8 MHz ??? */
895895   MDRV_CPU_PROGRAM_MAP(asuka_map,0)
896   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
896   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)
897897
898898   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz ??? */
899899   MDRV_CPU_PROGRAM_MAP(z80_map,0)
r1877r1878
932932   /* basic machine hardware */
933933   MDRV_CPU_ADD(M68000, 8000000)   /* 8 MHz ??? */
934934   MDRV_CPU_PROGRAM_MAP(asuka_map,0)
935   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
935   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)
936936
937937   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz ??? */
938938   MDRV_CPU_PROGRAM_MAP(cadash_z80_map,0)
r1877r1878
967967   /* basic machine hardware */
968968   MDRV_CPU_ADD(M68000, 8000000)   /* 8 MHz ??? */
969969   MDRV_CPU_PROGRAM_MAP(eto_map,0)
970   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
970   MDRV_CPU_VBLANK_INT("main", irq5_line_hold)
971971
972972   MDRV_CPU_ADD(Z80, 4000000)   /* 4 MHz ??? */
973973   MDRV_CPU_PROGRAM_MAP(cadash_z80_map,0)
src/mame/drivers/triplhnt.c
r1877r1878
3636}
3737
3838
39static void triplhnt_update_misc(int offset)
39static void triplhnt_update_misc(running_machine *machine, int offset)
4040{
4141   UINT8 is_witch_hunt;
4242   UINT8 bit = offset >> 1;
r1877r1878
7272   coin_lockout_w(0, !(triplhnt_misc_flags & 0x08));
7373   coin_lockout_w(1, !(triplhnt_misc_flags & 0x08));
7474
75   discrete_sound_w(TRIPLHNT_SCREECH_EN, triplhnt_misc_flags & 0x04);   // screech
76   discrete_sound_w(TRIPLHNT_LAMP_EN, triplhnt_misc_flags & 0x02);   // Lamp is used to reset noise
77   discrete_sound_w(TRIPLHNT_BEAR_EN, triplhnt_misc_flags & 0x80);   // bear
75   discrete_sound_w(machine, TRIPLHNT_SCREECH_EN, triplhnt_misc_flags & 0x04);   // screech
76   discrete_sound_w(machine, TRIPLHNT_LAMP_EN, triplhnt_misc_flags & 0x02);   // Lamp is used to reset noise
77   discrete_sound_w(machine, TRIPLHNT_BEAR_EN, triplhnt_misc_flags & 0x80);   // bear
7878
7979   is_witch_hunt = readinputport(2) == 0x40;
8080   bit = ~triplhnt_misc_flags & 0x40;
r1877r1878
9393
9494static WRITE8_HANDLER( triplhnt_misc_w )
9595{
96   triplhnt_update_misc(offset);
96   triplhnt_update_misc(machine, offset);
9797}
9898
9999
r1877r1878
107107
108108static READ8_HANDLER( triplhnt_input_port_4_r )
109109{
110   watchdog_reset_w(0, 0);
111
110   watchdog_reset_w(machine, 0, 0);
112111   return readinputport(4);
113112}
114113
115114
116115static READ8_HANDLER( triplhnt_misc_r )
117116{
118   triplhnt_update_misc(offset);
119
117   triplhnt_update_misc(machine, offset);
120118   return readinputport(7) | triplhnt_hit_code;
121119}
122120
r1877r1878
321319/* basic machine hardware */
322320   MDRV_CPU_ADD(M6800, 800000)
323321   MDRV_CPU_PROGRAM_MAP(triplhnt_readmem, triplhnt_writemem)
324   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
322   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
325323
326324   MDRV_NVRAM_HANDLER(generic_0fill)
327325
src/mame/drivers/pooyan.c
r1877r1878
216216   /* basic machine hardware */
217217   MDRV_CPU_ADD(Z80, MASTER_CLOCK/3/2)
218218   MDRV_CPU_PROGRAM_MAP(main_map,0)
219   MDRV_CPU_VBLANK_INT(pooyan_interrupt,1)
219   MDRV_CPU_VBLANK_INT("main", pooyan_interrupt)
220220
221221   MDRV_MACHINE_START(pooyan)
222222
src/mame/drivers/backfire.c
r1877r1878
2727static UINT32 *backfire_spriteram32_1;
2828static UINT32 *backfire_spriteram32_2;
2929static UINT32 *backfire_mainram;
30static mame_bitmap * backfire_left;
31static mame_bitmap * backfire_right;
30static bitmap_t *backfire_left;
31static bitmap_t *backfire_right;
3232
3333//UINT32 *backfire_180010, *backfire_188010;
3434static UINT32 *backfire_left_priority, *backfire_right_priority;
r1877r1878
9090   backfire_right = auto_bitmap_alloc(80*8, 32*8, BITMAP_FORMAT_INDEXED16);
9191}
9292
93static void draw_sprites(running_machine *machine,mame_bitmap *bitmap,const rectangle *cliprect, UINT32 *backfire_spriteram32, int region)
93static void draw_sprites(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect, UINT32 *backfire_spriteram32, int region)
9494{
9595   int offs;
9696
r1877r1878
104104
105105      y = backfire_spriteram32[offs]&0xffff;
106106      flash=y&0x1000;
107      if (flash && (cpu_getcurrentframe() & 1)) continue;
107      if (flash && (video_screen_get_frame_number(0) & 1)) continue;
108108
109109      x = backfire_spriteram32[offs+2]&0xffff;
110110      colour = (x >>9) & 0x1f;
r1877r1878
264264static WRITE32_HANDLER(wcvol95_nonbuffered_palette_w)
265265{
266266   COMBINE_DATA(&paletteram32[offset]);
267   palette_set_color_rgb(Machine,offset,pal5bit(paletteram32[offset] >> 0),pal5bit(paletteram32[offset] >> 5),pal5bit(paletteram32[offset] >> 10));
267   palette_set_color_rgb(machine,offset,pal5bit(paletteram32[offset] >> 0),pal5bit(paletteram32[offset] >> 5),pal5bit(paletteram32[offset] >> 10));
268268}
269269
270270
271271static READ32_HANDLER( deco156_snd_r )
272272{
273   return YMZ280B_status_0_r(0);
273   return YMZ280B_status_0_r(machine, 0);
274274}
275275
276276static WRITE32_HANDLER( deco156_snd_w )
277277{
278278   if (offset)
279      YMZ280B_data_0_w(0, data);
279      YMZ280B_data_0_w(machine, 0, data);
280280   else
281      YMZ280B_register_0_w(0, data);
281      YMZ280B_register_0_w(machine, 0, data);
282282}
283283
284284/* map 32-bit writes to 16-bit */
r1877r1878
299299static READ32_HANDLER( backfire_pf2_data_r ) {   return deco16_pf2_data[offset]^0xffff0000; }
300300static READ32_HANDLER( backfire_pf3_data_r ) {   return deco16_pf3_data[offset]^0xffff0000; }
301301static READ32_HANDLER( backfire_pf4_data_r ) {   return deco16_pf4_data[offset]^0xffff0000; }
302static WRITE32_HANDLER( backfire_pf1_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf1_data_w(offset,data,mem_mask); }
303static WRITE32_HANDLER( backfire_pf2_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf2_data_w(offset,data,mem_mask); }
304static WRITE32_HANDLER( backfire_pf3_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf3_data_w(offset,data,mem_mask); }
305static WRITE32_HANDLER( backfire_pf4_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf4_data_w(offset,data,mem_mask); }
302static WRITE32_HANDLER( backfire_pf1_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf1_data_w(machine,offset,data,mem_mask); }
303static WRITE32_HANDLER( backfire_pf2_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf2_data_w(machine,offset,data,mem_mask); }
304static WRITE32_HANDLER( backfire_pf3_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf3_data_w(machine,offset,data,mem_mask); }
305static WRITE32_HANDLER( backfire_pf4_data_w ) { data &=0x0000ffff; mem_mask &=0x0000ffff; deco16_pf4_data_w(machine,offset,data,mem_mask); }
306306
307307#ifdef UNUSED_FUNCTION
308308READ32_HANDLER( backfire_unknown_wheel_r )
r1877r1878
489489   /* basic machine hardware */
490490   MDRV_CPU_ADD(ARM, 28000000/4) /* Unconfirmed */
491491   MDRV_CPU_PROGRAM_MAP(backfire_map,0)
492   MDRV_CPU_VBLANK_INT(deco32_vbl_interrupt,1)
492   MDRV_CPU_VBLANK_INT("left", deco32_vbl_interrupt)   /* or is it "right?" */
493493
494494   MDRV_NVRAM_HANDLER(93C46)
495495
src/mame/drivers/rollerg.c
r1877r1878
4444
4545static READ8_HANDLER( rollerg_K051316_r )
4646{
47   if (readzoomroms) return K051316_rom_0_r(offset);
48   else return K051316_0_r(offset);
47   if (readzoomroms) return K051316_rom_0_r(machine, offset);
48   else return K051316_0_r(machine, offset);
4949}
5050
5151static READ8_HANDLER( rollerg_sound_r )
5252{
5353   /* If the sound CPU is running, read the status, otherwise
5454       just make it pass the test */
55   return K053260_0_r(2 + offset);
55   return K053260_0_r(machine, 2 + offset);
5656}
5757
5858static WRITE8_HANDLER( soundirq_w )
r1877r1878
247247   /* basic machine hardware */
248248   MDRV_CPU_ADD(KONAMI, 3000000)      /* ? */
249249   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
250   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
250   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
251251
252252   MDRV_CPU_ADD(Z80, 3579545)
253253   /* audio CPU */
src/mame/drivers/sidepckt.c
r1877r1878
3333
3434static WRITE8_HANDLER( sound_cpu_command_w )
3535{
36    soundlatch_w(offset,data);
37    cpunum_set_input_line(Machine, 1,INPUT_LINE_NMI,PULSE_LINE);
36    soundlatch_w(machine,offset,data);
37    cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
3838}
3939
4040static READ8_HANDLER( sidepckt_i8751_r )
r1877r1878
295295   /* basic machine hardware */
296296   MDRV_CPU_ADD(M6809, 2000000)        /* 2 MHz */
297297   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
298   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
298   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
299299
300300   MDRV_CPU_ADD(M6502, 1500000)
301301   /* audio CPU */        /* 1.5 MHz */
r1877r1878
334334   /* basic machine hardware */
335335   MDRV_CPU_ADD(M6809, 2000000)        /* 2 MHz */
336336   MDRV_CPU_PROGRAM_MAP(readmem,j_writemem)
337   MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
337   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
338338
339339   MDRV_CPU_ADD(M6502, 1500000)
340340   /* audio CPU */        /* 1.5 MHz */
src/mame/drivers/starwars.c
r1877r1878
6161      memcpy(slapstic_base, &slapstic_source[current_bank * 0x2000], 0x2000);
6262
6363      /* reset all the banks */
64      starwars_out_w(4, 0);
64      starwars_out_w(machine, 4, 0);
6565   }
6666
6767   /* reset the matrix processor */
r1877r1878
136136   /* if we're jumping into the slapstic region, tweak the new PC */
137137   if ((address & 0xe000) == 0x8000)
138138   {
139      esb_slapstic_r(address & 0x1fff);
139      esb_slapstic_r(machine, address & 0x1fff);
140140
141141      /* make sure we catch the next branch as well */
142142      catch_nextBranch();
r1877r1878
147147   else if ((prevpc & 0xe000) == 0x8000)
148148   {
149149      if (prevpc != 0x8080 && prevpc != 0x8090 && prevpc != 0x80a0 && prevpc != 0x80b0)
150         esb_slapstic_r(prevpc & 0x1fff);
150         esb_slapstic_r(machine, prevpc & 0x1fff);
151151   }
152152
153153   return address;
src/mame/drivers/pirates.c
r1877r1878
170170      bit = 1;
171171
172172   /* bit 4 is EEPROM data, bit 7 is protection */
173   return input_port_1_word_r(0,0) | (EEPROM_read_bit() << 4) | (bit << 7);
173   return input_port_1_word_r(machine,0,0) | (EEPROM_read_bit() << 4) | (bit << 7);
174174}
175175
176176
r1877r1878
287287static MACHINE_DRIVER_START( pirates )
288288   MDRV_CPU_ADD(M68000, 16000000) /* 16mhz */
289289   MDRV_CPU_PROGRAM_MAP(pirates_readmem,pirates_writemem)
290   MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
290   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
291291
292292   MDRV_NVRAM_HANDLER(pirates)
293293
src/mame/drivers/tankbatt.c
r1877r1878
281281   /* basic machine hardware */
282282   MDRV_CPU_ADD(M6502, 1000000)   /* 1 MHz ???? */
283283   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
284   MDRV_CPU_VBLANK_INT(tankbatt_interrupt,1)
284   MDRV_CPU_VBLANK_INT("main", tankbatt_interrupt)
285285
286286   /* video hardware */
287287   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/cherrym.c
r1877r1878
7171}
7272
7373#if 0
74static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
74static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
7575{
7676   // THIS IS COMPLETELY WRONG AND ONLY A PLACEHOLDER, IT HAS BEEN DISABLED TO KEEP THE COMPILER HAPPY
7777   int offs;
r1877r1878
374374   MDRV_CPU_ADD(Z80, 8000000/2)   // ???
375375   MDRV_CPU_PROGRAM_MAP(cm_map, 0)
376376   MDRV_CPU_IO_MAP(cm_io_map, 0)
377   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
377   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
378378
379379   //MDRV_NVRAM_HANDLER(cmv801)
380380
src/mame/drivers/exerion.c
r1877r1878
1717#include "exerion.h"
1818#include "sound/ay8910.h"
1919
20
2021static UINT8 *exerion_ram;
2122
23
24
2225/*************************************
2326 *
2427 *  Interrupts & inputs
r1877r1878
2831static READ8_HANDLER( exerion_port01_r )
2932{
3033   /* the cocktail flip bit muxes between ports 0 and 1 */
31   return exerion_cocktail_flip ? input_port_1_r(offset) : input_port_0_r(offset);
34   return exerion_cocktail_flip ? input_port_1_r(machine,offset) : input_port_0_r(machine,offset);
3235}
3336
3437
35static INTERRUPT_GEN( exerion_interrupt )
38static INPUT_CHANGED( coin_inserted )
3639{
37   /* Exerion triggers NMIs on coin insertion */
38   if (readinputport(4) & 1)
39      cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
40   /* coin insertion causes an NMI */
41   cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE);
4042}
4143
4244
r1877r1878
184186   PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
185187   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
186188
187   PORT_START_TAG("FAKE")      /* FAKE */
188   /* The coin slots are not memory mapped. */
189   /* This fake input port is used by the interrupt */
190   /* handler to be notified of coin insertions. We use IMPULSE to */
191   /* trigger exactly one interrupt, without having to check when the */
192   /* user releases the key. */
193   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
189   PORT_START_TAG("COIN")
190   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
194191INPUT_PORTS_END
195192
196193
r1877r1878
281278
282279   MDRV_CPU_ADD(Z80, EXERION_CPU_CLOCK)
283280   MDRV_CPU_PROGRAM_MAP(main_map,0)
284   MDRV_CPU_VBLANK_INT(exerion_interrupt,1)
285281
286282   MDRV_CPU_ADD(Z80, EXERION_CPU_CLOCK)
287283   MDRV_CPU_PROGRAM_MAP(sub_map,0)
r1877r1878
298294   MDRV_VIDEO_START(exerion)
299295   MDRV_VIDEO_UPDATE(exerion)
300296
301   /* sound hardware */
297   /* audio hardware */
302298   MDRV_SPEAKER_STANDARD_MONO("mono")
303299
304300   MDRV_SOUND_ADD(AY8910, EXERION_AY8910_CLOCK)
src/mame/drivers/wrally.c
r1877r1878
229229
230230static MACHINE_DRIVER_START( wrally )
231231   /* basic machine hardware */
232   MDRV_CPU_ADD(M68000,24000000/2)         /* 12 MHz */
232   MDRV_CPU_ADD(M68000,XTAL_24MHz/2)   /* verified on pcb */
233233   MDRV_CPU_PROGRAM_MAP(wrally_readmem,wrally_writemem)
234   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
234   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
235235
236236   /* video hardware */
237237   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
251251   /* sound hardware */
252252   MDRV_SPEAKER_STANDARD_MONO("mono")
253253
254   MDRV_SOUND_ADD(OKIM6295, 1056000)
255   MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) // clock frequency & pin 7 not verified
254   MDRV_SOUND_ADD(OKIM6295, XTAL_1MHz) /* verified on pcb */
255   MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) /* verified on pcb */
256256   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
257257MACHINE_DRIVER_END
258258
259259
260
261260ROM_START( wrally )
262261   ROM_REGION( 0x100000, REGION_CPU1, 0 )   /* 68000 code */
263262   ROM_LOAD16_BYTE(   "worldr17.c23",   0x000000, 0x080000, CRC(050f5629) SHA1(74fc2cd5114f3bc4b2429f1d8d7eeb1658f9f179) )
src/mame/drivers/mosaic.c
r1877r1878
285285   MDRV_CPU_ADD_TAG("main", Z180, 7000000)   /* ??? */
286286   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
287287   MDRV_CPU_IO_MAP(readport,writeport)
288   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
288   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
289289
290290   /* video hardware */
291291   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/segas18.c
r1877r1878
6161static UINT8 misc_io_data[0x10];
6262static UINT8 mcu_data;
6363
64static read16_handler custom_io_r;
65static write16_handler custom_io_w;
64static read16_machine_func custom_io_r;
65static write16_machine_func custom_io_w;
6666
6767static UINT8 wwally_last_x[3], wwally_last_y[3];
6868static UINT8 lghost_value, lghost_select;
r1877r1878
149149
150150static void sound_w(UINT8 data)
151151{
152   soundlatch_w(0, data & 0xff);
152   soundlatch_w(Machine, 0, data & 0xff);
153153   cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
154154}
155155
r1877r1878
326326      /* I/O chip */
327327      case 0x0000/2:
328328      case 0x1000/2:
329         return io_chip_r(offset, mem_mask);
329         return io_chip_r(machine, offset, mem_mask);
330330
331331      /* video control latch */
332332      case 0x2000/2:
333333         return readinputport(4 + (offset & 1));
334334   }
335335   if (custom_io_r)
336      return custom_io_r(offset, mem_mask);
336      return custom_io_r(machine, offset, mem_mask);
337337   logerror("%06X:misc_io_r - unknown read access to address %04X\n", activecpu_get_pc(), offset * 2);
338   return segaic16_open_bus_r(0,0);
338   return segaic16_open_bus_r(machine,0,0);
339339}
340340
341341
r1877r1878
349349      case 0x1000/2:
350350         if (ACCESSING_LSB)
351351         {
352            io_chip_w(offset, data, mem_mask);
352            io_chip_w(machine, offset, data, mem_mask);
353353            return;
354354         }
355355         break;
r1877r1878
365365   }
366366   if (custom_io_w)
367367   {
368      custom_io_w(offset, data, mem_mask);
368      custom_io_w(machine, offset, data, mem_mask);
369369      return;
370370   }
371371   logerror("%06X:misc_io_w - unknown write access to address %04X = %04X & %04X\n", activecpu_get_pc(), offset * 2, data, mem_mask ^ 0xffff);
r1877r1878
427427      case 0x3024/2:
428428         return readinputportbytag("P34START");
429429   }
430   return segaic16_open_bus_r(0,0);
430   return segaic16_open_bus_r(machine,0,0);
431431}
432432
433433
r1877r1878
451451         lghost_value <<= 1;
452452         return result;
453453   }
454   return segaic16_open_bus_r(0,0);
454   return segaic16_open_bus_r(machine,0,0);
455455}
456456
457457
r1877r1878
511511      case 0x3014/2:
512512         return (readinputportbytag("TRACKY3") - wwally_last_y[2]) & 0xff;
513513   }
514   return segaic16_open_bus_r(0,0);
514   return segaic16_open_bus_r(machine,0,0);
515515}
516516
517517
r1877r1878
12581258   /* basic machine hardware */
12591259   MDRV_CPU_ADD_TAG("main", M68000, 10000000)
12601260   MDRV_CPU_PROGRAM_MAP(system18_map,0)
1261   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
1261   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
12621262
12631263   MDRV_CPU_ADD_TAG("sound", Z80, 8000000)
12641264   /* audio CPU */
r1877r1878
12981298static MACHINE_DRIVER_START( system18_8751 )
12991299   MDRV_IMPORT_FROM(system18)
13001300   MDRV_CPU_MODIFY("main")
1301   MDRV_CPU_VBLANK_INT(irq0_line_hold,0)
1301   MDRV_CPU_VBLANK_INT_HACK(NULL,0)
13021302
13031303   MDRV_CPU_ADD(I8751, 8000000)
13041304   MDRV_CPU_PROGRAM_MAP(mcu_map,0)
13051305   MDRV_CPU_DATA_MAP(mcu_data_map,0)
1306   MDRV_CPU_VBLANK_INT(irq0_line_pulse,1)
1306   MDRV_CPU_VBLANK_INT("main", irq0_line_pulse)
13071307MACHINE_DRIVER_END
13081308
13091309
src/mame/drivers/meijinsn.c
r1877r1878
6969static WRITE16_HANDLER( sound_w )
7070{
7171   if(ACCESSING_LSB)
72      soundlatch_w(0, data&0xff);
72      soundlatch_w(machine, 0, data&0xff);
7373}
7474
7575static READ16_HANDLER( alpha_mcu_r )
r1877r1878
305305static MACHINE_DRIVER_START( meijinsn )
306306   MDRV_CPU_ADD_TAG("main", M68000, 9000000 )
307307   MDRV_CPU_PROGRAM_MAP(meijinsn_map, 0)
308   MDRV_CPU_VBLANK_INT(meijinsn_interrupt,2)
308   MDRV_CPU_VBLANK_INT_HACK(meijinsn_interrupt,2)
309309
310310   MDRV_CPU_ADD(Z80, 4000000)
311311   MDRV_CPU_PROGRAM_MAP(meijinsn_sound_map,0)
312312   MDRV_CPU_IO_MAP(meijinsn_sound_io_map,0)
313   MDRV_CPU_VBLANK_INT(irq0_line_hold, 160)
313   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold, 160)
314314
315315   MDRV_MACHINE_RESET(meijinsn)
316316
src/mame/drivers/ltcasino.c
r1877r1878
649649   /* basic machine hardware */
650650   MDRV_CPU_ADD(M6502,2000000)       /* ? MHz */
651651   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
652   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
652   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
653653
654654   /* video hardware */
655655   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/crospang.c
r1877r1878
5454{
5555   if(ACCESSING_LSB)
5656   {
57      soundlatch_w(0,data & 0xff);
57      soundlatch_w(machine,0,data & 0xff);
5858   }
5959}
6060
r1877r1878
406406   /* basic machine hardware */
407407   MDRV_CPU_ADD(M68000, 14318180/2)
408408   MDRV_CPU_PROGRAM_MAP(crospang_readmem,crospang_writemem)
409   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
409   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
410410
411411   MDRV_CPU_ADD(Z80, 14318180/4)
412412   /* audio CPU */
r1877r1878
444444   /* basic machine hardware */
445445   MDRV_CPU_ADD(M68000, 14318180/2)
446446   MDRV_CPU_PROGRAM_MAP(bestri_readmem,bestri_writemem)
447   MDRV_CPU_VBLANK_INT(irq6_line_hold,1)
447   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
448448
449449   MDRV_CPU_ADD(Z80, 14318180/4)
450450   /* audio CPU */
src/mame/drivers/royalmah.c
r1877r1878
221221
222222static READ8_HANDLER( royalmah_player_1_port_r )
223223{
224   int ret = (input_port_0_r(offset) & 0xc0) | 0x3f;
224   int ret = (input_port_0_r(machine,offset) & 0xc0) | 0x3f;
225225
226   if ((input_port_select & 0x01) == 0)  ret &= input_port_0_r(offset);
227   if ((input_port_select & 0x02) == 0)  ret &= input_port_1_r(offset);
228   if ((input_port_select & 0x04) == 0)  ret &= input_port_2_r(offset);
229   if ((input_port_select & 0x08) == 0)  ret &= input_port_3_r(offset);
230   if ((input_port_select & 0x10) == 0)  ret &= input_port_4_r(offset);
226   if ((input_port_select & 0x01) == 0)  ret &= input_port_0_r(machine,offset);
227   if ((input_port_select & 0x02) == 0)  ret &= input_port_1_r(machine,offset);
228   if ((input_port_select & 0x04) == 0)  ret &= input_port_2_r(machine,offset);
229   if ((input_port_select & 0x08) == 0)  ret &= input_port_3_r(machine,offset);
230   if ((input_port_select & 0x10) == 0)  ret &= input_port_4_r(machine,offset);
231231
232232   return ret;
233233}
234234
235235static READ8_HANDLER( royalmah_player_2_port_r )
236236{
237   int ret = (input_port_5_r(offset) & 0xc0) | 0x3f;
237   int ret = (input_port_5_r(machine,offset) & 0xc0) | 0x3f;
238238
239   if ((input_port_select & 0x01) == 0)  ret &= input_port_5_r(offset);
240   if ((input_port_select & 0x02) == 0)  ret &= input_port_6_r(offset);
241   if ((input_port_select & 0x04) == 0)  ret &= input_port_7_r(offset);
242   if ((input_port_select & 0x08) == 0)  ret &= input_port_8_r(offset);
243   if ((input_port_select & 0x10) == 0)  ret &= input_port_9_r(offset);
239   if ((input_port_select & 0x01) == 0)  ret &= input_port_5_r(machine,offset);
240   if ((input_port_select & 0x02) == 0)  ret &= input_port_6_r(machine,offset);
241   if ((input_port_select & 0x04) == 0)  ret &= input_port_7_r(machine,offset);
242   if ((input_port_select & 0x08) == 0)  ret &= input_port_8_r(machine,offset);
243   if ((input_port_select & 0x10) == 0)  ret &= input_port_9_r(machine,offset);
244244
245245   return ret;
246246}
r1877r1878
574574   {
575575      case 0x8000:   return readinputport(14);      // dsw 4
576576      case 0x8200:   return readinputport(13);      // dsw 3
577      case 0x9001:   return AY8910_read_port_0_r(0);   // inputs
577      case 0x9001:   return AY8910_read_port_0_r(machine,0);   // inputs
578578      case 0x9011:   return readinputport(10);
579579   }
580580
r1877r1878
595595   switch(offset)
596596   {
597597      case 0x8e00:   palette_base = data & 0x1f;   return;
598      case 0x9002:   AY8910_write_port_0_w(0,data);         return;
599      case 0x9003:   AY8910_control_port_0_w(0,data);      return;
598      case 0x9002:   AY8910_write_port_0_w(machine,0,data);         return;
599      case 0x9003:   AY8910_control_port_0_w(machine,0,data);      return;
600600      case 0x9010:
601         mjifb_coin_counter_w(0,data);
601         mjifb_coin_counter_w(machine,0,data);
602602         return;
603      case 0x9011:   input_port_select_w(0,data);   return;
603      case 0x9011:   input_port_select_w(machine,0,data);   return;
604604      case 0x9013:
605605//          if (data)   popmessage("%02x",data);
606606         return;
r1877r1878
681681   {
682682      case 0x8000:   return readinputport(14);      // dsw 2
683683      case 0x8001:   return readinputport(13);      // dsw 1
684      case 0x9001:   return AY8910_read_port_0_r(0);   // inputs
684      case 0x9001:   return AY8910_read_port_0_r(machine,0);   // inputs
685685      case 0x9011:   return readinputport(10);
686686   }
687687
r1877r1878
700700   offset += 0x8000;
701701   switch(offset)
702702   {
703      case 0x8802:   palette_base = data & 0x1f;         return;
704      case 0x9002:   AY8910_write_port_0_w(0,data);      return;
705      case 0x9003:   AY8910_control_port_0_w(0,data);   return;
706      case 0x9010:   mjifb_coin_counter_w(0,data);      return;
707      case 0x9011:   input_port_select_w(0,data);      return;
703      case 0x8802:   palette_base = data & 0x1f;               return;
704      case 0x9002:   AY8910_write_port_0_w(machine,0,data);      return;
705      case 0x9003:   AY8910_control_port_0_w(machine,0,data);   return;
706      case 0x9010:   mjifb_coin_counter_w(machine,0,data);      return;
707      case 0x9011:   input_port_select_w(machine,0,data);      return;
708708      case 0x9013:
709709//          if (data)   popmessage("%02x",data);
710710         return;
r1877r1878
33153315   MDRV_CPU_ADD_TAG("main", Z80, 3000000)        /* 3.00 MHz ? */
33163316   MDRV_CPU_PROGRAM_MAP(royalmah_map,0)
33173317   MDRV_CPU_IO_MAP(royalmah_iomap,0)
3318   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
3318   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
33193319
33203320   MDRV_NVRAM_HANDLER(generic_0fill)
33213321
r1877r1878
33613361   MDRV_IMPORT_FROM(dondenmj)
33623362   MDRV_CPU_MODIFY("main")
33633363   MDRV_CPU_IO_MAP(suzume_iomap,0)
3364   MDRV_CPU_VBLANK_INT(suzume_irq,1)
3364   MDRV_CPU_VBLANK_INT("main", suzume_irq)
33653365MACHINE_DRIVER_END
33663366
33673367static MACHINE_DRIVER_START( tontonb )
r1877r1878
34153415   MDRV_CPU_REPLACE("main",Z80,24000000/4)   /* 6 MHz? */
34163416   MDRV_CPU_PROGRAM_MAP(janptr96_map,0)
34173417   MDRV_CPU_IO_MAP(janptr96_iomap,0)
3418   MDRV_CPU_VBLANK_INT(janptr96_interrupt,3)   /* IM 2 needs a vector on the data bus */
3418   MDRV_CPU_VBLANK_INT_HACK(janptr96_interrupt,3)   /* IM 2 needs a vector on the data bus */
34193419
34203420   MDRV_SCREEN_MODIFY("main")
34213421   MDRV_SCREEN_VISIBLE_AREA(0, 255, 9, 255-8)
r1877r1878
34273427   MDRV_CPU_REPLACE("main",TMP90841, 8000000)   /* ? */
34283428   MDRV_CPU_PROGRAM_MAP(mjifb_map,0)
34293429   MDRV_CPU_IO_MAP(mjifb_iomap,0)
3430   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
3430   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
34313431
34323432   MDRV_SCREEN_MODIFY("main")
34333433   MDRV_SCREEN_VISIBLE_AREA(0, 255, 8, 255-8)
r1877r1878
34393439   MDRV_CPU_REPLACE("main",TMP90841, 8000000)   /* ? */
34403440   MDRV_CPU_PROGRAM_MAP(mjdejavu_map,0)
34413441   MDRV_CPU_IO_MAP(mjifb_iomap,0)
3442   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
3442   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
34433443
34443444   MDRV_SCREEN_MODIFY("main")
34453445   MDRV_SCREEN_VISIBLE_AREA(0, 255, 8, 255-8)
r1877r1878
34603460   MDRV_CPU_REPLACE("main",TMP90841, 12000000)   /* ? */
34613461   MDRV_CPU_PROGRAM_MAP(mjtensin_map,0)
34623462   MDRV_CPU_IO_MAP(mjtensin_iomap,0)
3463   MDRV_CPU_VBLANK_INT( mjtensin_interrupt,2 )
3463   MDRV_CPU_VBLANK_INT_HACK( mjtensin_interrupt,2 )
34643464
34653465   MDRV_SCREEN_MODIFY("main")
34663466   MDRV_SCREEN_VISIBLE_AREA(0, 255, 8, 255-8)
r1877r1878
34713471   MDRV_CPU_REPLACE("main",TMP90841, 12000000)   /* ? */
34723472   MDRV_CPU_PROGRAM_MAP(cafetime_map,0)
34733473   MDRV_CPU_IO_MAP(cafetime_iomap,0)
3474   MDRV_CPU_VBLANK_INT(mjtensin_interrupt,2)
3474   MDRV_CPU_VBLANK_INT_HACK(mjtensin_interrupt,2)
34753475
34763476   MDRV_SCREEN_MODIFY("main")
34773477   MDRV_SCREEN_VISIBLE_AREA(0, 255, 8, 255-8)
src/mame/drivers/subs.c
r1877r1878
1818***************************************************************************/
1919
2020#include "driver.h"
21#include "deprecat.h"
2122#include "subs.h"
2223#include "sound/discrete.h"
2324#include "rendlay.h"
r1877r1878
185186   /* basic machine hardware */
186187   MDRV_CPU_ADD(M6502,12096000/16)      /* clock input is the "4H" signal */
187188   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
188   MDRV_CPU_VBLANK_INT(subs_interrupt,4)
189   MDRV_CPU_VBLANK_INT_HACK(subs_interrupt,4)
189190
190191   MDRV_MACHINE_RESET(subs)
191192
src/mame/drivers/coolridr.c
r1877r1878
178178static MACHINE_DRIVER_START( coolridr )
179179   MDRV_CPU_ADD_TAG("main", SH2, 28000000)   // ?? mhz
180180   MDRV_CPU_PROGRAM_MAP(system_h1_map,0)
181   MDRV_CPU_VBLANK_INT(system_h1, 2)
181   MDRV_CPU_VBLANK_INT_HACK(system_h1, 2)
182182
183183   MDRV_CPU_ADD_TAG("sound", M68000, 12000000)   // ?? mhz
184184   MDRV_CPU_PROGRAM_MAP(system_h1_sound_map,0)
185185
186186   MDRV_CPU_ADD_TAG("sub", SH2, 8000000)   // SH7032 HD6417032F20!! ?? mhz
187187   MDRV_CPU_PROGRAM_MAP(coolridr_submap,0)
188   MDRV_CPU_VBLANK_INT(system_h1_sub, 2)
188   MDRV_CPU_VBLANK_INT_HACK(system_h1_sub, 2)
189189
190190   MDRV_GFXDECODE(coolridr)
191191
src/mame/drivers/darkmist.c
r1877r1878
249249   /* basic machine hardware */
250250   MDRV_CPU_ADD(Z80,4000000)       /* ? MHz */
251251   MDRV_CPU_PROGRAM_MAP(memmap, 0)
252   MDRV_CPU_VBLANK_INT(darkmist_interrupt,2)
252   MDRV_CPU_VBLANK_INT_HACK(darkmist_interrupt,2)
253253
254254   MDRV_CPU_ADD_TAG(CPUTAG_T5182,Z80,14318180/4)   /* 3.579545 MHz */
255255   MDRV_CPU_PROGRAM_MAP(t5182_map, 0)
src/mame/drivers/exctsccr.c
r1877r1878
383383   /* basic machine hardware */
384384   MDRV_CPU_ADD(Z80, 4000000)   /* 4.0 MHz (?) */
385385   MDRV_CPU_PROGRAM_MAP(main_map,0)
386   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
386   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
387387
388388   MDRV_CPU_ADD(Z80, 4123456)   /* ??? with 4 MHz, nested NMIs might happen */
389389   MDRV_CPU_PROGRAM_MAP(sub_map,0)
r1877r1878
440440   /* basic machine hardware */
441441   MDRV_CPU_ADD(Z80, 4000000)   /* 4.0 MHz (?) */
442442   MDRV_CPU_PROGRAM_MAP(bl_readmem,bl_writemem)
443   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
443   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
444444
445445   MDRV_CPU_ADD(Z80, 3072000)   /* 3.072 MHz ? */
446446   MDRV_CPU_PROGRAM_MAP(bl_sound_readmem,bl_sound_writemem)
src/mame/drivers/ajax.c
r1877r1878
240240   /* basic machine hardware */
241241   MDRV_CPU_ADD(KONAMI, 3000000)   /* 12/4 MHz*/
242242   MDRV_CPU_PROGRAM_MAP(ajax_main_map,0)
243   MDRV_CPU_VBLANK_INT(ajax_interrupt,1)   /* IRQs triggered by the 051960 */
243   MDRV_CPU_VBLANK_INT("main", ajax_interrupt)   /* IRQs triggered by the 051960 */
244244
245245   MDRV_CPU_ADD(M6809, 3000000)   /* ? */
246246   MDRV_CPU_PROGRAM_MAP(ajax_sub_map,0)
src/mame/drivers/mquake.c
r1877r1878
8888
8989static READ16_HANDLER( es5503_word_lsb_r )
9090{
91   return (ACCESSING_LSB) ? (ES5503_reg_0_r(offset) | 0xff00) : 0xffff;
91   return (ACCESSING_LSB) ? (ES5503_reg_0_r(machine, offset) | 0xff00) : 0xffff;
9292}
9393
9494static WRITE16_HANDLER( es5503_word_lsb_w )
r1877r1878
109109         }
110110      }
111111
112      ES5503_reg_0_w(offset, data);
112      ES5503_reg_0_w(machine, offset, data);
113113   }
114114}
115115
r1877r1878
352352   /* basic machine hardware */
353353   MDRV_CPU_ADD(M68000, AMIGA_68000_NTSC_CLOCK)
354354   MDRV_CPU_PROGRAM_MAP(main_map,0)
355   MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 262)
356355
357356   MDRV_MACHINE_RESET(mquake)
358357   MDRV_NVRAM_HANDLER(generic_0fill)
r1877r1878
371370   MDRV_PALETTE_INIT(amiga)
372371
373372   MDRV_VIDEO_START(amiga)
374   MDRV_VIDEO_UPDATE(generic_bitmapped)
373   MDRV_VIDEO_UPDATE(amiga)
375374
376375   /* sound hardware */
377376   MDRV_SPEAKER_STANDARD_STEREO("left", "right")
src/mame/drivers/funybubl.c
r1877r1878
8080
8181static WRITE8_HANDLER( funybubl_soundcommand_w )
8282{
83   soundlatch_w(0,data);
84   cpunum_set_input_line(Machine, 1,0, HOLD_LINE);
83   soundlatch_w(machine,0,data);
84   cpunum_set_input_line(machine, 1,0, HOLD_LINE);
8585}
8686
8787static WRITE8_HANDLER( funybubl_oki_bank_sw )
r1877r1878
248248   MDRV_CPU_ADD(Z80,12000000/2)       /* 6 MHz?? */
249249   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
250250   MDRV_CPU_IO_MAP(readport,writeport)
251   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
251   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
252252
253253   MDRV_CPU_ADD(Z80,8000000/2)       /* 4 MHz?? */
254254   MDRV_CPU_PROGRAM_MAP(soundreadmem,soundwritemem)
src/mame/drivers/rotaryf.c
r1877r1878
1111*/
1212
1313#include "driver.h"
14#include "deprecat.h"
1415#include "cpu/i8085/i8085.h"
1516
1617
r1877r1878
151152   MDRV_CPU_ADD_TAG("main",8085A,4000000) /* 8080? */ /* 2 MHz? */
152153   MDRV_CPU_PROGRAM_MAP(rotaryf_map,0)
153154   MDRV_CPU_IO_MAP(rotaryf_io_map,0)
154   MDRV_CPU_VBLANK_INT(rotaryf_interrupt,5)
155   MDRV_CPU_VBLANK_INT_HACK(rotaryf_interrupt,5)
155156
156157   /* video hardware */
157158   MDRV_VIDEO_UPDATE(rotaryf)
src/mame/drivers/shisen.c
r1877r1878
66
77***************************************************************************/
88#include "driver.h"
9#include "deprecat.h"
910#include "audio/m72.h"
1011#include "sound/dac.h"
1112#include "sound/2151intf.h"
r1877r1878
1920
2021static READ8_HANDLER( sichuan2_dsw1_r )
2122{
22   int ret = input_port_3_r(0);
23   int ret = input_port_3_r(machine, 0);
2324
2425   /* Based on the coin mode fill in the upper bits */
25   if (input_port_4_r(0) & 0x04)
26   if (input_port_4_r(machine, 0) & 0x04)
2627   {
2728      /* Mode 1 */
28      ret   |= (input_port_5_r(0) << 4);
29      ret   |= (input_port_5_r(machine, 0) << 4);
2930   }
3031   else
3132   {
3233      /* Mode 2 */
33      ret   |= (input_port_5_r(0) & 0xf0);
34      ret   |= (input_port_5_r(machine, 0) & 0xf0);
3435   }
3536
3637   return ret;
r1877r1878
243244   MDRV_CPU_ADD(Z80, 6000000)   /* 6 MHz ? */
244245   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
245246   MDRV_CPU_IO_MAP(readport,writeport)
246   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
247   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
247248
248249   MDRV_CPU_ADD(Z80, 3579645)
249250   /* audio CPU */
250251   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
251252   MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
252   MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
253   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,128)   /* clocked by V1? (Vigilante) */
253254                        /* IRQs are generated by main Z80 and YM2151 */
254255
255256   MDRV_MACHINE_RESET(m72_sound)
src/mame/drivers/tutankhm.c
r1877r1878
232232   /* basic machine hardware */
233233   MDRV_CPU_ADD(M6809, 1500000)         /* 1.5 MHz ??? */
234234   MDRV_CPU_PROGRAM_MAP(main_map,0)
235   MDRV_CPU_VBLANK_INT(tutankhm_interrupt,1)
235   MDRV_CPU_VBLANK_INT("main", tutankhm_interrupt)
236236
237237   MDRV_MACHINE_START(tutankhm)
238238
src/mame/drivers/nmk16.c
r1877r1878
277277{
278278   if (ACCESSING_LSB)
279279   {
280      soundlatch_w(0,data & 0xff);
281      cpunum_set_input_line(Machine, 1,0, HOLD_LINE);
280      soundlatch_w(machine,0,data & 0xff);
281      cpunum_set_input_line(machine, 1,0, HOLD_LINE);
282282   }
283283}
284284
r1877r1878
330330      return res << 8;
331331   }
332332   else
333      return ~input_port_1_word_r(0,0);
333      return ~input_port_1_word_r(machine,0,0);
334334}
335335
336336static WRITE16_HANDLER( macross2_sound_command_w )
337337{
338338   if (ACCESSING_LSB)
339      soundlatch_w(0,data & 0xff);
339      soundlatch_w(machine,0,data & 0xff);
340340}
341341
342342static READ16_HANDLER( macross2_sound_result_r )
343343{
344   return soundlatch2_r(0);
344   return soundlatch2_r(machine,0);
345345}
346346
347347static WRITE8_HANDLER( macross2_sound_bank_w )
r1877r1878
373373{
374374   if (ACCESSING_LSB)
375375   {
376      soundlatch_w(0,data&0xff);
377      cpunum_set_input_line(Machine, 1, 0, HOLD_LINE);
376      soundlatch_w(machine,0,data&0xff);
377      cpunum_set_input_line(machine, 1, 0, HOLD_LINE);
378378   }
379379}
380380
r1877r1878
36963696   /* basic machine hardware */
36973697   MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz */
36983698   MDRV_CPU_PROGRAM_MAP(tharrier_readmem,tharrier_writemem)
3699   MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
3699   MDRV_CPU_VBLANK_INT_HACK(nmk_interrupt,2)
37003700   MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
37013701
37023702   MDRV_CPU_ADD(Z80, 3000000)
r1877r1878
37463746   /* basic machine hardware */
37473747   MDRV_CPU_ADD(M68000, 10000000) /* 10? MHz - check */
37483748   MDRV_CPU_PROGRAM_MAP(manybloc_readmem,manybloc_writemem)
3749   MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
3749   MDRV_CPU_VBLANK_INT_HACK(nmk_interrupt,2)
37503750   MDRV_CPU_PERIODIC_INT(irq1_line_hold,56)/* this needs to equal the framerate on this, rather than being double it .. */
37513751
37523752   MDRV_CPU_ADD(Z80, 3000000)
r1877r1878
37933793   /* basic machine hardware */
37943794   MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz ? */
37953795   MDRV_CPU_PROGRAM_MAP(mustang_map,0)
3796   MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
3796   MDRV_CPU_VBLANK_INT_HACK(nmk_interrupt,2)
37973797   MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
37983798
37993799   MDRV_MACHINE_RESET(NMK004)
r1877r1878
38383838   /* basic machine hardware */
38393839   MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz ? */
38403840   MDRV_CPU_PROGRAM_MAP(mustangb_map,0)
3841   MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
3841   MDRV_CPU_VBLANK_INT_HACK(nmk_interrupt,2)
38423842   MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
38433843
38443844   SEIBU_SOUND_SYSTEM_CPU(14318180/4)
r1877r1878
39203920   /* basic machine hardware */
39213921   MDRV_CPU_ADD(M68000, BIOSHIP_CRYSTAL1 ) /* 10.0 MHz (verified) */
39223922   MDRV_CPU_PROGRAM_MAP(bioship_readmem,bioship_writemem)
3923   MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
3923   MDRV_CPU_VBLANK_INT_HACK(nmk_interrupt,2)
39243924   MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
39253925
39263926   MDRV_MACHINE_RESET(NMK004)
r1877r1878
39643964   /* basic machine hardware */
39653965   MDRV_CPU_ADD(M68000, XTAL_10MHz) /* 68000p12 running at 10Mhz, verified on pcb */
39663966   MDRV_CPU_PROGRAM_MAP(vandyke_readmem,vandyke_writemem)
3967   MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
3967   MDRV_CPU_VBLANK_INT_HACK(nmk_interrupt,2)
39683968   MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
39693969
39703970   MDRV_MACHINE_RESET(NMK004)
r1877r1878
40084008   /* basic machine hardware */
40094009   MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz ? */
40104010   MDRV_CPU_PROGRAM_MAP(vandyke_readmem,vandyke_writemem)
4011   MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
4011   MDRV_CPU_VBLANK_INT_HACK(nmk_interrupt,2)
40124012   MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
40134013
40144014   MDRV_CPU_ADD(PIC16C57, 12000000)   /* 3MHz */
r1877r1878
40444044   /* basic machine hardware */
40454045   MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz (verified on pcb) */
40464046   MDRV_CPU_PROGRAM_MAP(acrobatm_readmem,acrobatm_writemem)
4047   MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
4047   MDRV_CPU_VBLANK_INT_HACK(nmk_interrupt,2)
40484048   MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
40494049
40504050   MDRV_MACHINE_RESET(NMK004)
r1877r1878
40904090   /* basic machine hardware */
40914091   MDRV_CPU_ADD(M68000, 10000000)
40924092   MDRV_CPU_PROGRAM_MAP(tdragon_readmem,tdragonb_writemem)
4093   //MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
4094   MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
4093   //MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
4094   MDRV_CPU_VBLANK_INT_HACK(nmk_interrupt,2)
40954095   MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ?? drives music */
40964096
40974097   SEIBU_SOUND_SYSTEM_CPU(14318180/4)
r1877r1878
41224122   /* basic machine hardware */
41234123   MDRV_CPU_ADD(M68000, 10000000)
41244124   MDRV_CPU_PROGRAM_MAP(tdragon_readmem,tdragon_writemem)
4125   MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
4126   //MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
4125   MDRV_CPU_VBLANK_INT_HACK(nmk_interrupt,2)
4126   //MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
41274127   MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ?? drives music */
41284128
41294129   MDRV_MACHINE_RESET(NMK004)
r1877r1878
41674167   /* basic machine hardware */
41684168   MDRV_CPU_ADD(M68000, 8000000) /* 8 Mhz */
41694169   MDRV_CPU_PROGRAM_MAP(ssmissin_readmem,ssmissin_writemem)
4170   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
4170   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
41714171   MDRV_CPU_PERIODIC_INT(irq1_line_hold,112) /* input related */
41724172
41734173   MDRV_CPU_ADD(Z80, 8000000/2) /* 4 Mhz */
r1877r1878
42044204   /* basic machine hardware */
42054205   MDRV_CPU_ADD(M68000, 12000000) /* 12 MHz ? */
42064206   MDRV_CPU_PROGRAM_MAP(strahl_readmem,strahl_writemem)
4207   MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
4207   MDRV_CPU_VBLANK_INT_HACK(nmk_interrupt,2)
42084208   MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
42094209
42104210   MDRV_MACHINE_RESET(NMK004)
r1877r1878
42494249   /* basic machine hardware */
42504250   MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz ? */
42514251   MDRV_CPU_PROGRAM_MAP(hachamf_map,0)
4252   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
4252   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
42534253   MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
42544254
42554255   MDRV_MACHINE_RESET(NMK004)
r1877r1878
42944294   /* basic machine hardware */
42954295   MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz ? */
42964296   MDRV_CPU_PROGRAM_MAP(macross_readmem,macross_writemem)
4297   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
4297   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
42984298   MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
42994299
43004300   MDRV_MACHINE_RESET(NMK004)
r1877r1878
43394339   /* basic machine hardware */
43404340   MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz? */
43414341   MDRV_CPU_PROGRAM_MAP(gunnail_readmem,gunnail_writemem)
4342   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
4342   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
43434343   MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)
43444344
43454345   MDRV_MACHINE_RESET(NMK004)
r1877r1878
43844384   /* basic machine hardware */
43854385   MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz ? */
43864386   MDRV_CPU_PROGRAM_MAP(macross2_readmem,macross2_writemem)
4387   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
4387   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
43884388   MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
43894389
43904390   MDRV_CPU_ADD(Z80, 4000000)
r1877r1878
44304430   /* basic machine hardware */
44314431   MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz  */
44324432   MDRV_CPU_PROGRAM_MAP(macross2_readmem,macross2_writemem)
4433   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
4433   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
44344434   MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
44354435
44364436   MDRV_CPU_ADD(Z80, 4000000)
r1877r1878
44764476   /* basic machine hardware */
44774477   MDRV_CPU_ADD(M68000, 14000000) /* 14 MHz measured */
44784478   MDRV_CPU_PROGRAM_MAP(macross2_readmem,raphero_writemem)
4479   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
4479   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
44804480   MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
44814481
44824482   MDRV_CPU_ADD_TAG("sound",TMP90841, 8000000)
r1877r1878
45204520   /* basic machine hardware */
45214521   MDRV_CPU_ADD(M68000, 10000000) /* verified on pcb */
45224522   MDRV_CPU_PROGRAM_MAP(bjtwin_readmem,bjtwin_writemem)
4523   MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
4523   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
45244524   MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ?? drives music */
45254525
45264526   MDRV_MACHINE_RESET(nmk16)
r1877r1878
47804780}
47814781
47824782/* NO NMK004, it has a PIC instead */
4783static READ16_HANDLER( vandykeb_r ) { return 0x0000; };
4783static READ16_HANDLER( vandykeb_r ) { return 0x0000; }
47844784static DRIVER_INIT (vandykeb)
47854785{
47864786   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x08000e, 0x08000f, 0, 0, vandykeb_r );
r1877r1878
50235023   /* basic machine hardware */
50245024   MDRV_CPU_ADD(M68000,12000000)
50255025   MDRV_CPU_PROGRAM_MAP(afega,0)
5026   MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
5026   MDRV_CPU_VBLANK_INT_HACK(nmk_interrupt,2)
50275027
50285028   MDRV_CPU_ADD(Z80, 4000000)
50295029   /* audio CPU */   /* ? */
r1877r1878
50475047   /* sound hardware */
50485048   MDRV_SPEAKER_STANDARD_STEREO("left", "right")
50495049
5050   MDRV_SOUND_ADD(YM2151, 4000000)
5050   MDRV_SOUND_ADD(YM2151, XTAL_4MHz) /* verified on pcb */
50515051   MDRV_SOUND_CONFIG(afega_ym2151_intf)
50525052   MDRV_SOUND_ROUTE(0, "left", 0.30)
50535053   MDRV_SOUND_ROUTE(1, "right", 0.30)
50545054
5055   MDRV_SOUND_ADD(OKIM6295, 1000000)
5056   MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high)
5055   MDRV_SOUND_ADD(OKIM6295, XTAL_4MHz/4) /* verified on pcb */
5056   MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) /* verified on pcb */
50575057   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.70)
50585058   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.70)
50595059MACHINE_DRIVER_END
r1877r1878
50915091   /* basic machine hardware */
50925092   MDRV_CPU_ADD(M68000,12000000)
50935093   MDRV_CPU_PROGRAM_MAP(afega,0)
5094   MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
5094   MDRV_CPU_VBLANK_INT_HACK(nmk_interrupt,2)
50955095
50965096   MDRV_CPU_ADD(Z80,4000000)
50975097   /* audio CPU */
r1877r1878
51315131   /* basic machine hardware */
51325132   MDRV_CPU_ADD(M68000,12000000)
51335133   MDRV_CPU_PROGRAM_MAP(twinactn_map,0)
5134   MDRV_CPU_VBLANK_INT(nmk_interrupt,2)
5134   MDRV_CPU_VBLANK_INT_HACK(nmk_interrupt,2)
51355135   MDRV_CPU_PERIODIC_INT(irq1_line_hold,112)/* ???????? */
51365136
51375137   MDRV_CPU_ADD(Z80, 4000000)
src/mame/drivers/miniboy7.c
r1877r1878
146146   tilemap_mark_tile_dirty(bg_tilemap, offset);
147147}
148148
149static WRITE8_HANDLER( miniboy7_mc6845_address_w )
150{
151   mc6845_address_w(mc6845, data);
152}
153
154static READ8_HANDLER( miniboy7_mc6845_register_r )
155{
156   return mc6845_register_r(mc6845);
157}
158
159static WRITE8_HANDLER( miniboy7_mc6845_register_w )
160{
161   mc6845_register_w(mc6845, data);
162}
163
164149static TILE_GET_INFO( get_bg_tile_info )
165150{
166151/*  - bits -
r1877r1878
203188   AM_RANGE(0x1000, 0x17ff) AM_RAM AM_WRITE(miniboy7_colorram_w) AM_BASE(&colorram)
204189   AM_RANGE(0x1800, 0x25ff) AM_RAM   /* looks like videoram */
205190   AM_RANGE(0x2600, 0x27ff) AM_RAM
206   AM_RANGE(0x2800, 0x2800) AM_WRITE(miniboy7_mc6845_address_w)
207   AM_RANGE(0x2801, 0x2801) AM_READWRITE(miniboy7_mc6845_register_r, miniboy7_mc6845_register_w)
191   AM_RANGE(0x2800, 0x2800) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
192   AM_RANGE(0x2801, 0x2801) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
208193//  AM_RANGE(0x3000, 0x3001) ????? R/W
209194//  AM_RANGE(0x3080, 0x3083) AM_READWRITE(pia_0_r, pia_0_w)
210195//  AM_RANGE(0x3800, 0x3800) ????? R
r1877r1878
273258   /* basic machine hardware */
274259   MDRV_CPU_ADD_TAG("main", M6502, MASTER_CLOCK/16)   /* guess */
275260   MDRV_CPU_PROGRAM_MAP(miniboy7_map, 0)
276   MDRV_CPU_VBLANK_INT(nmi_line_pulse, 1)
261   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
277262
278263   /* video hardware */
279264   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/m10.c
r1877r1878
427427 *
428428 *************************************/
429429
430static INPUT_CHANGED( coin_inserted )
431{
432   /* coin insertion causes an NMI */
433   cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, newval ? ASSERT_LINE : CLEAR_LINE);
434}
435
436
430437static TIMER_CALLBACK( interrupt_callback )
431438{
432439    if (param==0)
r1877r1878
446453
447454static INTERRUPT_GEN( m11_interrupt )
448455{
449   if (readinputport(2) & 1)   /* Left Coin */
450        cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
451    else
452    {
453       cpunum_set_input_line(machine, 0, 0, ASSERT_LINE);
454       timer_set(video_screen_get_time_until_pos(0, IREMM10_VBEND, 0), NULL, -1,interrupt_callback);
455    }
456   cpunum_set_input_line(machine, 0, 0, ASSERT_LINE);
457   timer_set(video_screen_get_time_until_pos(0, IREMM10_VBEND, 0), NULL, -1,interrupt_callback);
456458}
457459
458460static INTERRUPT_GEN( m10_interrupt )
459461{
460   if (readinputport(2) & 1)   /* Left Coin */
461        cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
462    else
463      cpunum_set_input_line(machine, 0, 0, ASSERT_LINE);
462   cpunum_set_input_line(machine, 0, 0, ASSERT_LINE);
464463}
465464
466465static INTERRUPT_GEN( m15_interrupt )
467466{
468   if (readinputport(2) & 1)   /* Left Coin */
469        cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
470    else
471    {
472      cpunum_set_input_line(machine, 0, 0, ASSERT_LINE);
473       timer_set(video_screen_get_time_until_pos(0, IREMM10_VBSTART+1, 80), NULL, -1,interrupt_callback);
474    }
467   cpunum_set_input_line(machine, 0, 0, ASSERT_LINE);
468      timer_set(video_screen_get_time_until_pos(0, IREMM10_VBSTART+1, 80), NULL, -1,interrupt_callback);
475469}
476470
477471/*************************************
r1877r1878
576570   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
577571
578572   PORT_START   /* FAKE */
579   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
573   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
580574
581575   CAB_PORTENV
582576INPUT_PORTS_END
r1877r1878
617611   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
618612
619613   PORT_START   /* FAKE */
620   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
614   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
621615
622616   CAB_PORTENV
623617INPUT_PORTS_END
r1877r1878
645639   PORT_DIPSETTING (  0x20, "1 Coin 2 Plays" )
646640
647641   PORT_START   /* FAKE */
648   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
642   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
649643
650644   PORT_START   /* IN3 */
651645   PORT_BIT( 0x03, 0, IPT_UNUSED )
r1877r1878
682676   PORT_DIPSETTING (  0x20, "1 Coin 2 Plays" )
683677
684678   PORT_START   /* FAKE */
685   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
679   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
686680
687681   PORT_START   /* IN3 */
688682   PORT_BIT( 0x03, 0, IPT_UNUSED )
r1877r1878
762756
763757   MDRV_MACHINE_RESET(irem)
764758
765   MDRV_CPU_VBLANK_INT(m10_interrupt,1)
759   MDRV_CPU_VBLANK_INT("main", m10_interrupt)
766760
767761   /* video hardware */
768762   MDRV_SCREEN_ADD("main", RASTER)
r1877r1878
794788   MDRV_CPU_REPLACE("main", M6502,IREMM10_CPU_CLOCK / 2)
795789   //MDRV_CPU_MODIFY("main")
796790   MDRV_CPU_PROGRAM_MAP(m11_main,0)
797   MDRV_CPU_VBLANK_INT(m11_interrupt,1)
791   MDRV_CPU_VBLANK_INT("main", m11_interrupt)
798792
799793   /* sound hardware */
800794MACHINE_DRIVER_END
r1877r1878
809803
810804   MDRV_MACHINE_RESET(irem)
811805
812   MDRV_CPU_VBLANK_INT(m15_interrupt,1)
806   MDRV_CPU_VBLANK_INT("main", m15_interrupt)
813807
814808   /* video hardware */
815809   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/nitedrvr.c
r1877r1878
164164   // basic machine hardware
165165   MDRV_CPU_ADD(M6502, 12096000/12) // 1 MHz
166166   MDRV_CPU_PROGRAM_MAP(nitedrvr_map, 0)
167   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
167   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
168168   MDRV_WATCHDOG_VBLANK_INIT(3)
169169
170170   MDRV_MACHINE_RESET(nitedrvr)
src/tools/makemeta.c
r1877r1878
454454
455455      /* bail if we passed the end */
456456      if (framenum > patcount)
457         return 0;
457         break;
458458
459459      /* if we don't have a white flag, the previous frame must match us */
460460      if (!curpat->white) flags |= 0x01;
r1877r1878
470470      /* output the result */
471471      output_meta(flags, curpat->white, line16, line17, line18, bcdframenum, 0);
472472   }
473
474473   return 0;
475474}
476475
src/tools/chdman.c
r1877r1878
9898    put_bigendian_uint32 - write a UINT32 in big-endian order to memory
9999-------------------------------------------------*/
100100
101#ifdef UNUSED_FUNCTON
101102INLINE void put_bigendian_uint32(UINT8 *base, UINT32 value)
102103{
103104   base[0] = value >> 24;
r1877r1878
105106   base[2] = value >> 8;
106107   base[3] = value;
107108}
109#endif
108110
109
110111/*-------------------------------------------------
111112    print_big_int - 64-bit int printing with commas
112113-------------------------------------------------*/
src/osd/osdcomm.h
r1877r1878
3939#define ATTR_MALLOC            __attribute__((malloc))
4040#define ATTR_PURE            __attribute__((pure))
4141#define ATTR_CONST            __attribute__((const))
42#define ATTR_FORCE_INLINE      __attribute__((always_inline))
43#define ATTR_NONNULL         __attribute__((nonnull(1)))
4244#define UNEXPECTED(exp)         __builtin_expect((exp), 0)
4345#define TYPES_COMPATIBLE(a,b)   __builtin_types_compatible_p(a, b)
4446#define RESTRICT            __restrict__
47#define SETJMP_GNUC_PROTECT()   (void)__builtin_return_address(1)
4548#else
4649#define ATTR_UNUSED
4750#define ATTR_NORETURN
r1877r1878
4952#define ATTR_MALLOC
5053#define ATTR_PURE
5154#define ATTR_CONST
55#define ATTR_FORCE_INLINE
56#define ATTR_NONNULL
5257#define UNEXPECTED(exp)         (exp)
5358#define TYPES_COMPATIBLE(a,b)   1
5459#define RESTRICT
60#define SETJMP_GNUC_PROTECT()   do {} while (0)
5561#endif
5662
5763
r1877r1878
130136#endif
131137
132138
139/* U64 and S64 are used to wrap long integer constants. */
140#ifdef __GNUC__
141#define U64(val) val##ULL
142#define S64(val) val##LL
143#else
144#define U64(val) val
145#define S64(val) val
146#endif
147
148
133149/* Highly useful macro for compile-time knowledge of an array size */
134150#define ARRAY_LENGTH(x)      (sizeof(x) / sizeof(x[0]))
135151
src/osd/windows/video.c
r1877r1878
6161win_monitor_info *win_monitor_list;
6262static win_monitor_info *primary_monitor;
6363
64static mame_bitmap *effect_bitmap;
64static bitmap_t *effect_bitmap;
6565
6666
6767
src/osd/windows/drawd3d.c
r1877r1878
167167   int                  last_wrap;               // previous wrap state
168168   DWORD               last_modmode;            // previous texture modulation
169169
170   mame_bitmap *         vector_bitmap;            // experimental: bitmap for vectors
170   bitmap_t *            vector_bitmap;            // experimental: bitmap for vectors
171171   texture_info *         vector_texture;            // experimental: texture for vectors
172172};
173173
src/osd/winui/mui_audit.c
r1877r1878
160160
161161static int ProcessAuditResults(int game, audit_record *audit, int audit_records)
162162{
163   output_callback prevcb;
163   output_callback_func prevcb;
164164   void *prevparam;
165165   int res;
166166
src/emu/config.c
r1877r1878
3535{
3636   struct _config_type *   next;            /* next in line */
3737   const char *         name;            /* node name */
38   config_callback         load;            /* load callback */
39   config_callback         save;            /* save callback */
38   config_callback_func         load;            /* load callback */
39   config_callback_func         save;            /* save callback */
4040};
4141
4242
r1877r1878
8686 *
8787 *************************************/
8888
89void config_register(const char *nodename, config_callback load, config_callback save)
89void config_register(const char *nodename, config_callback_func load, config_callback_func save)
9090{
9191   config_type *newtype;
9292   config_type **ptype;
src/emu/debug/debugcpu.c
r1877r1878
140140}
141141
142142
143/*-------------------------------------------------
144    on_vblank - called when a VBLANK hits
145-------------------------------------------------*/
146
147static void on_vblank(running_machine *machine, screen_state *screen, int vblank_state)
148{
149   /* if we're configured to stop on VBLANK, break */
150   if (vblank_state && break_on_vblank)
151   {
152      execution_state = EXECUTION_STATE_STOPPED;
153      debug_console_printf("Stopped at VBLANK\n");
154      break_on_vblank = 0;
155   }
156}
157
158
143159/***************************************************************************
144160    INITIALIZATION
145161***************************************************************************/
r1877r1878
279295      }
280296   }
281297
298   /* add callback for breaking on VBLANK */
299   video_screen_register_vbl_cb(machine, NULL, on_vblank);
300
282301   add_exit_callback(machine, debug_cpu_exit);
283302}
284303
r1877r1878
10281047
10291048
10301049/*-------------------------------------------------
1031    debug_vblank_hook - called when the real
1032    VBLANK hits
1033-------------------------------------------------*/
1034
1035void debug_vblank_hook(void)
1036{
1037   /* if we're configured to stop on VBLANK, break */
1038   if (break_on_vblank)
1039   {
1040      execution_state = EXECUTION_STATE_STOPPED;
1041      debug_console_printf("Stopped at VBLANK\n");
1042      break_on_vblank = 0;
1043   }
1044}
1045
1046
1047/*-------------------------------------------------
10481050    debug_vblank_hook - called when an interrupt
10491051    is acknowledged
10501052-------------------------------------------------*/
r1877r1878
10971099    for the specified CPU
10981100-------------------------------------------------*/
10991101
1100void debug_get_memory_hooks(int cpunum, debug_hook_read_ptr *read, debug_hook_write_ptr *write)
1102void debug_get_memory_hooks(int cpunum, debug_hook_read_func *read, debug_hook_write_func *write)
11011103{
11021104   memory_hook_cpunum = cpunum;
11031105
src/emu/debug/debugcpu.h
r1877r1878
5454    TYPE DEFINITIONS
5555***************************************************************************/
5656
57typedef void (*debug_hook_read_ptr)(int spacenum, int size, offs_t address);
58typedef void (*debug_hook_write_ptr)(int spacenum, int size, offs_t address, UINT64 data);
57typedef void (*debug_hook_read_func)(int spacenum, int size, offs_t address);
58typedef void (*debug_hook_write_func)(int spacenum, int size, offs_t address, UINT64 data);
5959
6060
6161typedef struct _debug_trace_info debug_trace_info;
r1877r1878
182182void            debug_flush_traces(void);
183183
184184/* debugging hooks */
185void            debug_vblank_hook(void);
186185void            debug_interrupt_hook(int cpunum, int irqline);
187void            debug_get_memory_hooks(int cpunum, debug_hook_read_ptr *read, debug_hook_write_ptr *write);
186void            debug_get_memory_hooks(int cpunum, debug_hook_read_func *read, debug_hook_write_func *write);
188187void            debug_set_instruction_hook(int cpunum, int (*hook)(offs_t pc));
189188
190189/* execution control */
src/emu/cpu/m6805/m6805.c
r1877r1878
263263   p->b.l = RM(Addr);
264264}
265265
266#ifdef UNUSED_FUNCTION
266267INLINE void WM16( UINT32 Addr, PAIR *p )
267268{
268269   WM( Addr, p->b.h );
r1877r1878
270271//  if( ++Addr > AMASK ) Addr = 0;
271272   WM( Addr, p->b.l );
272273}
274#endif
273275
274276#if (HAS_M68705)
275277
src/emu/cpu/m68000/m68kcpu.c
r1877r1878
575575         return M68K_CPU_TYPE_INVALID;
576576      default:         return 0;
577577   }
578   return 0;
579578}
580579
581580void m68k_set_reg(m68k_register_t regnum, unsigned int value)
src/emu/cpu/ccpu/ccpu.h
r1877r1878
1313
1414#include "cpuintrf.h"
1515
16
1617/***************************************************************************
1718    REGISTER ENUMERATION
1819***************************************************************************/
r1877r1878
3233};
3334
3435
36
3537/***************************************************************************
3638    CONFIG STRUCTURE
3739***************************************************************************/
r1877r1878
4446};
4547
4648
49
4750/***************************************************************************
4851    PUBLIC FUNCTIONS
4952***************************************************************************/
5053
5154void ccpu_get_info(UINT32 state, cpuinfo *info);
55void ccpu_wdt_timer_trigger(void);
5256
5357#ifdef ENABLE_DEBUGGER
5458offs_t ccpu_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
src/emu/cpu/ccpu/ccpu.c
r1877r1878
1919
2020typedef struct
2121{
22    UINT16   PC;
23    UINT16   A;
24    UINT16   B;
25    UINT8   I;
26    UINT16   J;
27    UINT8   P;
28    UINT16   X;
29    UINT16   Y;
30    UINT16   T;
31    UINT16 *acc;
22    UINT16      PC;
23    UINT16      A;
24    UINT16      B;
25    UINT8      I;
26    UINT16      J;
27    UINT8      P;
28    UINT16      X;
29    UINT16      Y;
30    UINT16      T;
31    UINT16 *   acc;
3232
33    UINT16   a0flag, ncflag, cmpacc, cmpval;
34    UINT16   miflag, nextmiflag, nextnextmiflag;
35    UINT16   drflag;
33    UINT16      a0flag, ncflag, cmpacc, cmpval;
34    UINT16      miflag, nextmiflag, nextnextmiflag;
35    UINT16      drflag;
3636
37   UINT8   (*external_input)(void);
38   void   (*vector_callback)(INT16 sx, INT16 sy, INT16 ex, INT16 ey, UINT8 shift);
39   UINT8   scrnum;
37   UINT8      (*external_input)(void);
38   void      (*vector_callback)(INT16 sx, INT16 sy, INT16 ex, INT16 ey, UINT8 shift);
39
40   UINT8      waiting;
41   UINT8      watchdog;
4042} ccpuRegs;
4143
4244
r1877r1878
123125}
124126
125127
128void ccpu_wdt_timer_trigger(void)
129{
130   ccpu.waiting = FALSE;
131   ccpu.watchdog++;
132   if (ccpu.watchdog >= 3)
133      ccpu.PC = 0;
134}
135
136
126137static void ccpu_init(int index, int clock, const void *_config, int (*irqcallback)(int))
127138{
128139   const struct CCPUConfig *config = _config;
r1877r1878
140151   state_save_register_item("ccpu", clock, ccpu.X);
141152   state_save_register_item("ccpu", clock, ccpu.Y);
142153   state_save_register_item("ccpu", clock, ccpu.T);
143   state_save_register_item("ccpu", clock, ccpu.scrnum);
154   state_save_register_item("ccpu", clock, ccpu.a0flag);
155   state_save_register_item("ccpu", clock, ccpu.ncflag);
156   state_save_register_item("ccpu", clock, ccpu.cmpacc);
157   state_save_register_item("ccpu", clock, ccpu.cmpval);
158   state_save_register_item("ccpu", clock, ccpu.miflag);
159   state_save_register_item("ccpu", clock, ccpu.nextmiflag);
160   state_save_register_item("ccpu", clock, ccpu.nextnextmiflag);
161   state_save_register_item("ccpu", clock, ccpu.drflag);
162   state_save_register_item("ccpu", clock, ccpu.waiting);
163   state_save_register_item("ccpu", clock, ccpu.watchdog);
144164}
145165
146166
r1877r1878
165185   ccpu.cmpval = 1;
166186   ccpu.miflag = ccpu.nextmiflag = ccpu.nextnextmiflag = 0;
167187   ccpu.drflag = 0;
188
189   ccpu.waiting = FALSE;
190   ccpu.watchdog = 0;
168191}
169192
170193
r1877r1878
175198
176199static int ccpu_execute(int cycles)
177200{
201   if (ccpu.waiting)
202      return cycles;
203
178204   ccpu_icount = cycles;
179205
180206   while (ccpu_icount >= 0)
r1877r1878
545571         /* FRM */
546572         case 0xe5:
547573         case 0xf5:
548/* FIXME: once vector game video system configuration is fixed,
549   remove section in brackets and uncomment line below.
550   Speed Freak should run nice and smooth, with no flickering. */
551{
552   attotime scantime, abstime;
553   extern emu_timer *refresh_timer;
554   scantime = timer_starttime(refresh_timer);
555   abstime = timer_get_time();
556   while (attotime_compare(abstime, scantime) >= 0)
557      scantime = attotime_add(scantime, video_screen_get_frame_period(ccpu.scrnum));
558   cpu_spinuntil_time(attotime_sub(scantime, abstime));
559}
560/*              cpu_spinuntil_time(video_screen_get_time_until_pos(ccpu.scrnum, Machine->screen[ccpu.scrnum].visarea.max_y + 1, 0)); */
561            NEXT_ACC_A(); CYCLES(1);
574            ccpu.waiting = TRUE;
575            NEXT_ACC_A();
576            ccpu_icount = -1;
577
578            /* some games repeat the FRM opcode twice; it apparently does not cause
579                   a second wait, so we make sure we skip any duplicate opcode at this
580                   point */
581            if (READOP(ccpu.PC) == opcode)
582               ccpu.PC++;
562583            break;
563584
564585         /* STAP */
r1877r1878
570591
571592         /* CST */
572593         case 0xf7:
573            watchdog_reset(Machine);
594            ccpu.watchdog = 0;
574595         /* ADDP */
575596         case 0xe7:
576597            tempval = RDMEM(ccpu.I);
src/emu/cpu/z80gb/z80gb.h
r1877r1878
66typedef struct {
77   const UINT16   *regs;
88   UINT8   features;
9   void   (*timer_callback)(int cycles);
9   void   (*timer_fired_func)(int cycles);
1010} Z80GB_CONFIG;
1111
1212enum {
src/emu/cpu/z80gb/z80gb.c
r1877r1878
4646#define FLAG_C  0x10
4747
4848#define CYCLES_PASSED(X)      z80gb_ICount -= ((X) / (Regs.w.gb_speed));   \
49               if ( Regs.w.timer_callback ) {         \
50                  Regs.w.timer_callback( X );      \
49               if ( Regs.w.timer_fired_func ) {         \
50                  Regs.w.timer_fired_func( X );      \
5151               }
5252
5353typedef struct {
r1877r1878
6565   int   ei_delay;
6666   int   (*irq_callback)(int irqline);
6767   /* Timer stuff */
68   void   (*timer_callback)(int cycles);
68   void   (*timer_fired_func)(int cycles);
6969   /* Fetch & execute related */
7070   int      execution_state;
7171   UINT8   op;
r1877r1878
197197   Regs.w.HL = 0x0000;
198198   Regs.w.SP = 0x0000;
199199   Regs.w.PC = 0x0000;
200   Regs.w.timer_callback = NULL;
200   Regs.w.timer_fired_func = NULL;
201201   Regs.w.features = Z80GB_FEATURE_HALT_BUG;
202202   if (Regs.w.config)
203203   {
r1877r1878
209209         Regs.w.SP = Regs.w.config->regs[4];
210210         Regs.w.PC = Regs.w.config->regs[5];
211211      }
212      Regs.w.timer_callback = Regs.w.config->timer_callback;
212      Regs.w.timer_fired_func = Regs.w.config->timer_fired_func;
213213      Regs.w.features = Regs.w.config->features;
214214   }
215215   Regs.w.enable = 0;
src/emu/cpu/tms34010/tms34010.h
r1877r1878
7373   UINT8   scrnum;                        /* the screen operated on */
7474   UINT32   pixclock;                     /* the pixel clock (0 means don't adjust screen size) */
7575   int      pixperclock;                  /* pixels per clock */
76   void   (*scanline_callback)(running_machine *machine, int screen, mame_bitmap *bitmap, int scanline, const tms34010_display_params *params);
76   void   (*scanline_callback)(running_machine *machine, int screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params);
7777   void   (*output_int)(int state);         /* output interrupt callback */
7878   void   (*to_shiftreg)(offs_t, UINT16 *);   /* shift register write */
7979   void   (*from_shiftreg)(offs_t, UINT16 *);   /* shift register read */
src/emu/cpu/tms34010/tms34010.c
r1877r1878
692692   /* the first time we are run */
693693   state.reset_deferred = state.config->halt_on_reset;
694694   if (state.config->halt_on_reset)
695      tms34010_io_register_w(REG_HSTCTLH, 0x8000, 0);
695      tms34010_io_register_w(Machine, REG_HSTCTLH, 0x8000, 0);
696696}
697697
698698#if (HAS_TMS34020)
r1877r1878
16531653      /* control register */
16541654      case TMS34010_HOST_CONTROL:
16551655         external_host_access = TRUE;
1656         tms34010_io_register_w(REG_HSTCTLH, data & 0xff00, 0);
1657         tms34010_io_register_w(REG_HSTCTLL, data & 0x00ff, 0);
1656         tms34010_io_register_w(Machine, REG_HSTCTLH, data & 0xff00, 0);
1657         tms34010_io_register_w(Machine, REG_HSTCTLL, data & 0x00ff, 0);
16581658         external_host_access = FALSE;
16591659         break;
16601660
src/emu/cpu/tms32031/32031ops.c
r1877r1878
183183      case 20:   return CONDITION_ZUF;
184184      default:   illegal(); return 1;
185185   }
186   return 0;
187186}
188187
189188
src/emu/cpu/tms32031/tms32031.c
r1877r1878
297297    EXECEPTION HANDLING
298298***************************************************************************/
299299
300#ifdef UNUSED_FUNCTION
300301INLINE void generate_exception(int exception)
301302{
302303}
303304
304
305305INLINE void invalid_instruction(UINT32 op)
306306{
307307}
308#endif
308309
309310
310311
r1877r1878
634635         WMEM(offs++, data);
635636      }
636637   }
637
638   /* keep the compiler happy */
639   return 0;
640638}
641639
642640
src/emu/cpu/sharc/sharcops.c
r1877r1878
10011001               {
10021002                  UINT32 shift = REG(ry);
10031003                  REG(rn) = REG(rx);
1004                  if (shift >= 0 && shift < 32)
1004                  if (shift < 32)
10051005                  {
10061006                     REG(rn) |= (1 << shift);
10071007                  }
r1877r1878
10171017               {
10181018                  UINT32 shift = REG(ry);
10191019                  REG(rn) = REG(rx);
1020                  if (shift >= 0 && shift < 32)
1020                  if (shift < 32)
10211021                  {
10221022                     REG(rn) &= ~(1 << shift);
10231023                  }
src/emu/cpu/drcfe.c
r1877r1878
4444   UINT32            window_end;               /* code window end offset = startpc + window_end */
4545   UINT32            max_sequence;            /* maximum instructions to include in a sequence */
4646
47   drcfe_describe      describe;               /* callback to describe a single instruction */
47   drcfe_describe_func      describe;               /* callback to describe a single instruction */
4848   void *            param;                  /* parameter for the callback */
4949
5050   /* CPU parameters */
5151   offs_t            pageshift;               /* shift to convert address to a page index */
52   cpufunc_translate   translate;               /* pointer to translation function */
52   cpu_translate_func   translate;               /* pointer to translation function */
5353
5454   /* opcode descriptor arrays */
5555   opcode_desc *      desc_live_list;            /* head of list of live descriptions */
r1877r1878
135135
136136   /* initialize the state */
137137   drcfe->pageshift = activecpu_page_shift(ADDRESS_SPACE_PROGRAM);
138   drcfe->translate = (cpufunc_translate)activecpu_get_info_fct(CPUINFO_PTR_TRANSLATE);
138   drcfe->translate = (cpu_translate_func)activecpu_get_info_fct(CPUINFO_PTR_TRANSLATE);
139139
140140   return drcfe;
141141}
src/emu/cpu/i86/i86.c
r1877r1878
55/* 26.March 2000 PeT changed set_irq_line */
66
77#include "debugger.h"
8#include "cpuintrf.h"
89#include "deprecat.h"
910
1011#include "host.h"
src/emu/cpu/i86/i86time.c
r1877r1878
150150   (void *)-1      /* marker to make sure we line up */
151151};
152152
153
154153/* these come from the Intel 80186 datasheet */
155154static const struct i80x86_timing i80186_cycles =
156155{
r1877r1878
230229   (void *)-1      /* marker to make sure we line up */
231230};
232231
233
234232/* these come from the 80286 timings in OPCODE.LST */
235233/* many of these numbers are suspect */
236234static const struct i80x86_timing i80286_cycles =
src/emu/cpu/drcfe.h
r1877r1878
146146
147147
148148/* callback function that is used to describe a single opcode */
149typedef int (*drcfe_describe)(void *param, opcode_desc *desc);
149typedef int (*drcfe_describe_func)(void *param, opcode_desc *desc);
150150
151151
152152/* description of a given opcode */
r1877r1878
156156   UINT32         window_start;         /* code window start offset = startpc - window_start */
157157   UINT32         window_end;            /* code window end offset = startpc + window_end */
158158   UINT32         max_sequence;         /* maximum instructions to include in a sequence */
159   drcfe_describe   describe;            /* callback to describe a single instruction */
159   drcfe_describe_func   describe;            /* callback to describe a single instruction */
160160};
161161
162162/*
src/emu/cpu/spc700/spc700.c
r1877r1878
278278   return spc700_read_8_immediate(address);
279279}
280280
281#ifdef UNUSED_FUNCTION
281282INLINE uint read_8_instruction(uint address)
282283{
283284   address = MAKE_UINT_16(address);
284285   return spc700_read_instruction(address);
285286}
287#endif
286288
287289INLINE uint read_8_direct(uint address)
288290{
r1877r1878
432434INLINE uint EA_DP(void)   {return OPER_8_IMM();}
433435INLINE uint EA_DPX(void)   {return (EA_DP() + REG_X)&0xff;}
434436INLINE uint EA_DPY(void)   {return (EA_DP() + REG_Y)&0xff;}
437#ifdef UNUSED_FUNCTION
435438INLINE uint EA_DPI(void)   {return OPER_16_DP();}
439#endif
436440INLINE uint EA_DXI(void)   {return OPER_16_DPX();}
437441INLINE uint EA_DIY(void)   {uint addr = OPER_16_DP(); if((addr&0xff00) != ((addr+REG_Y)&0xff00)) CLK(1); return addr + REG_Y;}
438442INLINE uint EA_XI(void)    {return REG_X;}
r1877r1878
535539   return value | (PULL_8()<<8);
536540}
537541
542#ifdef UNUSED_FUNCTION
538543INLINE void SERVICE_IRQ(void)
539544{
540545   CLK(7);
r1877r1878
545550      INT_ACK(0);
546551   JUMP(read_16_VEC(VECTOR_IRQ));
547552}
553#endif
548554
549555#if !SPC700_OPTIMIZE_SNES
550556INLINE void CHECK_IRQ(void)
src/emu/cpu/dsp56k/dsp56k.c
r1877r1878
821821//          if (hrdfBIT)
822822         return HTXHRX;
823823
824         /* FIXME: Following code never reached due to commented if above */
825#if 0
824826         // Reading HRX clears HRDF.
825827         CLEAR_hrdfBIT();
826828
827829         // The DSP may program the HRIE bit to cause a Host Receive Data interrupt when HRDF is set.
828830
829831         return 0x0000;
832#endif
830833         break;
831834   }
832835
src/emu/cpu/mc68hc11/mc68hc11.c
r1877r1878
9292         {
9393            return io_read_byte((hc11.adctl & 0x7) + MC68HC11_IO_AD0);
9494         }
95         break;
9695      }
9796      case 0x32:      /* ADR2 */
9897      {
r1877r1878
104103         {
105104            return io_read_byte((hc11.adctl & 0x7) + MC68HC11_IO_AD0);
106105         }
107         break;
108106      }
109107      case 0x33:      /* ADR3 */
110108      {
r1877r1878
116114         {
117115            return io_read_byte((hc11.adctl & 0x7) + MC68HC11_IO_AD0);
118116         }
119         break;
120117      }
121118      case 0x34:      /* ADR4 */
122119      {
r1877r1878
128125         {
129126            return io_read_byte((hc11.adctl & 0x7) + MC68HC11_IO_AD0);
130127         }
131         break;
132128      }
133129      case 0x38:      /* OPT2 */
134130         return 0;
src/emu/cpu/adsp2100/2100ops.c
r1877r1878
9090      adsp2100.alt = temp;
9191   }
9292   if ((new_value ^ adsp2100.mstat) & MSTAT_TIMER)
93      if (adsp2100.timer_callback)
94         (*adsp2100.timer_callback)((new_value & MSTAT_TIMER) != 0);
93      if (adsp2100.timer_fired_func)
94         (*adsp2100.timer_fired_func)((new_value & MSTAT_TIMER) != 0);
9595   if (new_value & MSTAT_STICKYV)
9696      adsp2100.astat_clear = ~(CFLAG | NFLAG | ZFLAG);
9797   else
src/emu/cpu/adsp2100/adsp2100.c
r1877r1878
246246    /* other callbacks */
247247   RX_CALLBACK sport_rx_callback;
248248   TX_CALLBACK sport_tx_callback;
249   ADSP2100_TIMER_CALLBACK timer_callback;
249   ADSP2100_TIMER_CALLBACK timer_fired_func;
250250} adsp2100_Regs;
251251
252252
r1877r1878
21742174      /* --- the following bits of info are set as pointers to data or functions --- */
21752175      case CPUINFO_PTR_ADSP2100_RX_HANDLER:         adsp2100.sport_rx_callback = (RX_CALLBACK)info->f;   break;
21762176      case CPUINFO_PTR_ADSP2100_TX_HANDLER:         adsp2100.sport_tx_callback = (TX_CALLBACK)info->f;   break;
2177      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      adsp2100.timer_callback = (ADSP2100_TIMER_CALLBACK)info->f;   break;
2177      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      adsp2100.timer_fired_func = (ADSP2100_TIMER_CALLBACK)info->f;   break;
21782178
21792179      default:
21802180         adsp21xx_set_info(state, info);
r1877r1878
22022202
22032203      case CPUINFO_PTR_ADSP2100_RX_HANDLER:         info->f = (genf *)adsp2100.sport_rx_callback;   break;
22042204      case CPUINFO_PTR_ADSP2100_TX_HANDLER:         info->f = (genf *)adsp2100.sport_tx_callback;   break;
2205      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      info->f = (genf *)adsp2100.timer_callback;      break;
2205      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      info->f = (genf *)adsp2100.timer_fired_func;      break;
22062206
22072207      /* --- the following bits of info are returned as NULL-terminated strings --- */
22082208      case CPUINFO_STR_NAME:                     strcpy(info->s, "ADSP2101");         break;
r1877r1878
22622262      /* --- the following bits of info are set as pointers to data or functions --- */
22632263      case CPUINFO_PTR_ADSP2100_RX_HANDLER:         adsp2100.sport_rx_callback = (RX_CALLBACK)info->f;   break;
22642264      case CPUINFO_PTR_ADSP2100_TX_HANDLER:         adsp2100.sport_tx_callback = (TX_CALLBACK)info->f;   break;
2265      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      adsp2100.timer_callback = (ADSP2100_TIMER_CALLBACK)info->f;   break;
2265      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      adsp2100.timer_fired_func = (ADSP2100_TIMER_CALLBACK)info->f;   break;
22662266
22672267      default:
22682268         adsp21xx_set_info(state, info);
r1877r1878
22902290
22912291      case CPUINFO_PTR_ADSP2100_RX_HANDLER:         info->f = (genf *)adsp2100.sport_rx_callback;   break;
22922292      case CPUINFO_PTR_ADSP2100_TX_HANDLER:         info->f = (genf *)adsp2100.sport_tx_callback;   break;
2293      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      info->f = (genf *)adsp2100.timer_callback;      break;
2293      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      info->f = (genf *)adsp2100.timer_fired_func;      break;
22942294
22952295      /* --- the following bits of info are returned as NULL-terminated strings --- */
22962296      case CPUINFO_STR_NAME:                     strcpy(info->s, "ADSP2104");         break;
r1877r1878
23472347      /* --- the following bits of info are set as pointers to data or functions --- */
23482348      case CPUINFO_PTR_ADSP2100_RX_HANDLER:         adsp2100.sport_rx_callback = (RX_CALLBACK)info->f;   break;
23492349      case CPUINFO_PTR_ADSP2100_TX_HANDLER:         adsp2100.sport_tx_callback = (TX_CALLBACK)info->f;   break;
2350      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      adsp2100.timer_callback = (ADSP2100_TIMER_CALLBACK)info->f;   break;
2350      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      adsp2100.timer_fired_func = (ADSP2100_TIMER_CALLBACK)info->f;   break;
23512351
23522352      default:
23532353         adsp21xx_set_info(state, info);
r1877r1878
23722372
23732373      case CPUINFO_PTR_ADSP2100_RX_HANDLER:         info->f = (genf *)adsp2100.sport_rx_callback;   break;
23742374      case CPUINFO_PTR_ADSP2100_TX_HANDLER:         info->f = (genf *)adsp2100.sport_tx_callback;   break;
2375      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      info->f = (genf *)adsp2100.timer_callback;      break;
2375      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      info->f = (genf *)adsp2100.timer_fired_func;      break;
23762376
23772377      /* --- the following bits of info are returned as NULL-terminated strings --- */
23782378      case CPUINFO_STR_NAME:                     strcpy(info->s, "ADSP2105");         break;
r1877r1878
24322432      /* --- the following bits of info are set as pointers to data or functions --- */
24332433      case CPUINFO_PTR_ADSP2100_RX_HANDLER:         adsp2100.sport_rx_callback = (RX_CALLBACK)info->f;   break;
24342434      case CPUINFO_PTR_ADSP2100_TX_HANDLER:         adsp2100.sport_tx_callback = (TX_CALLBACK)info->f;   break;
2435      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      adsp2100.timer_callback = (ADSP2100_TIMER_CALLBACK)info->f;   break;
2435      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      adsp2100.timer_fired_func = (ADSP2100_TIMER_CALLBACK)info->f;   break;
24362436
24372437      default:
24382438         adsp21xx_set_info(state, info);
r1877r1878
24602460
24612461      case CPUINFO_PTR_ADSP2100_RX_HANDLER:         info->f = (genf *)adsp2100.sport_rx_callback;   break;
24622462      case CPUINFO_PTR_ADSP2100_TX_HANDLER:         info->f = (genf *)adsp2100.sport_tx_callback;   break;
2463      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      info->f = (genf *)adsp2100.timer_callback;      break;
2463      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      info->f = (genf *)adsp2100.timer_fired_func;      break;
24642464
24652465      /* --- the following bits of info are returned as NULL-terminated strings --- */
24662466      case CPUINFO_STR_NAME:                     strcpy(info->s, "ADSP2115");         break;
r1877r1878
25232523      /* --- the following bits of info are set as pointers to data or functions --- */
25242524      case CPUINFO_PTR_ADSP2100_RX_HANDLER:         adsp2100.sport_rx_callback = (RX_CALLBACK)info->f;   break;
25252525      case CPUINFO_PTR_ADSP2100_TX_HANDLER:         adsp2100.sport_tx_callback = (TX_CALLBACK)info->f;   break;
2526      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      adsp2100.timer_callback = (ADSP2100_TIMER_CALLBACK)info->f;   break;
2526      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      adsp2100.timer_fired_func = (ADSP2100_TIMER_CALLBACK)info->f;   break;
25272527
25282528      default:
25292529         adsp21xx_set_info(state, info);
r1877r1878
25582558
25592559      case CPUINFO_PTR_ADSP2100_RX_HANDLER:         info->f = (genf *)adsp2100.sport_rx_callback; break;
25602560      case CPUINFO_PTR_ADSP2100_TX_HANDLER:         info->f = (genf *)adsp2100.sport_tx_callback; break;
2561      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      info->f = (genf *)adsp2100.timer_callback; break;
2561      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      info->f = (genf *)adsp2100.timer_fired_func; break;
25622562
25632563      /* --- the following bits of info are returned as NULL-terminated strings --- */
25642564      case CPUINFO_STR_NAME:                     strcpy(info->s, "ADSP2181");         break;
src/emu/cpu/dsp32/dsp32.c
r1877r1878
260260    EXECEPTION HANDLING
261261***************************************************************************/
262262
263#ifdef UNUSED_FUNCTION
263264INLINE void generate_exception(int exception)
264265{
265266}
267#endif
266268
267
269#ifdef UNUSED_FUNCTION
268270INLINE void invalid_instruction(UINT32 op)
269271{
270272}
273#endif
271274
272275
273
274276/***************************************************************************
275277    IRQ HANDLING
276278***************************************************************************/
r1877r1878
450452***************************************************************************/
451453
452454/* context finder */
455#ifdef UNUSED_FUNCTION
453456INLINE dsp32_regs *FINDCONTEXT(int cpu)
454457{
455458   dsp32_regs *context = cpunum_get_context_ptr(cpu);
r1877r1878
457460      context = &dsp32;
458461   return context;
459462}
463#endif
460464
461465static const UINT32 regmap[4][16] =
462466{
src/emu/cpu/rsp/rsp.c
r1877r1878
232232{
233233   if (reg >= 0 && reg < 8)
234234   {
235      return (config->sp_reg_r)(reg, 0x00000000);
235      return (config->sp_reg_r)(Machine, reg, 0x00000000);
236236   }
237237   else if (reg >= 8 && reg < 16)
238238   {
239      return (config->dp_reg_r)(reg - 8, 0x00000000);
239      return (config->dp_reg_r)(Machine, reg - 8, 0x00000000);
240240   }
241241   else
242242   {
r1877r1878
248248{
249249   if (reg >= 0 && reg < 8)
250250   {
251      (config->sp_reg_w)(reg, data, 0x00000000);
251      (config->sp_reg_w)(Machine, reg, data, 0x00000000);
252252   }
253253   else if (reg >= 8 && reg < 16)
254254   {
255      (config->dp_reg_w)(reg - 8, data, 0x00000000);
255      (config->dp_reg_w)(Machine, reg - 8, data, 0x00000000);
256256   }
257257   else
258258   {
src/emu/cpu/rsp/rsp.h
r1877r1878
33
44struct _rsp_config
55{
6   read32_handler dp_reg_r;
7   write32_handler dp_reg_w;
8   read32_handler sp_reg_r;
9   write32_handler sp_reg_w;
6   read32_machine_func dp_reg_r;
7   write32_machine_func dp_reg_w;
8   read32_machine_func sp_reg_r;
9   write32_machine_func sp_reg_w;
1010   void (*sp_set_status)(UINT32 status);
1111};
1212typedef struct _rsp_config rsp_config;
src/emu/cpu/m6502/m4510.c
r1877r1878
141141   UINT16  low, high;
142142   UINT32   mem[8];
143143   int    (*irq_callback)(int irqline);   /* IRQ callback */
144   read8_handler rdmem_id;               /* readmem callback for indexed instructions */
145   write8_handler wrmem_id;            /* writemem callback for indexed instructions */
144   read8_machine_func rdmem_id;               /* readmem callback for indexed instructions */
145   write8_machine_func wrmem_id;            /* writemem callback for indexed instructions */
146146
147147   UINT8    ddr;
148148   UINT8    port;
r1877r1878
173173#define M4510
174174#include "t65ce02.c"
175175
176static READ8_HANDLER( default_rdmem_id ) { return program_read_byte_8(offset); }
177static WRITE8_HANDLER( default_wrmem_id ) { program_write_byte_8(offset, data); }
178
176179static void m4510_init(int index, int clock, const void *config, int (*irqcallback)(int))
177180{
178   m4510.rdmem_id = program_read_byte_8;
179   m4510.wrmem_id = program_write_byte_8;
181   m4510.rdmem_id = default_rdmem_id;
182   m4510.wrmem_id = default_wrmem_id;
180183   m4510.irq_callback = irqcallback;
181184}
182185
r1877r1878
412415      case CPUINFO_INT_REGISTER + M4510_MEM7:         m4510.mem[7] = info->i;               break;
413416
414417      /* --- the following bits of info are set as pointers to data or functions --- */
415      case CPUINFO_PTR_M6502_READINDEXED_CALLBACK:   m4510.rdmem_id = (read8_handler) info->f; break;
416      case CPUINFO_PTR_M6502_WRITEINDEXED_CALLBACK:   m4510.wrmem_id = (write8_handler) info->f; break;
418      case CPUINFO_PTR_M6502_READINDEXED_CALLBACK:   m4510.rdmem_id = (read8_machine_func) info->f; break;
419      case CPUINFO_PTR_M6502_WRITEINDEXED_CALLBACK:   m4510.wrmem_id = (write8_machine_func) info->f; break;
417420      case CPUINFO_PTR_M6510_PORTREAD:            m4510.port_read = (UINT8 (*)(void)) info->f; break;
418421      case CPUINFO_PTR_M6510_PORTWRITE:            m4510.port_write = (void (*)(UINT8)) info->f; break;
419422   }
src/emu/cpu/m6502/ops02.h
r1877r1878
6363
6464#define PPC m6502.ppc.d
6565
66#define RDMEM_ID   m6502.rdmem_id
67#define WRMEM_ID   m6502.wrmem_id
66#define RDMEM_ID(a)      m6502.rdmem_id(Machine,a)
67#define WRMEM_ID(a,d)   m6502.wrmem_id(Machine,a,d)
6868
6969#define CHANGE_PC change_pc(PCD)
7070
src/emu/cpu/m6502/m6502.c
r1877r1878
7272   UINT8   irq_state;
7373   UINT8   so_state;
7474   int    (*irq_callback)(int irqline);   /* IRQ callback */
75   read8_handler rdmem_id;               /* readmem callback for indexed instructions */
76   write8_handler wrmem_id;            /* writemem callback for indexed instructions */
75   read8_machine_func rdmem_id;               /* readmem callback for indexed instructions */
76   write8_machine_func wrmem_id;            /* writemem callback for indexed instructions */
7777
7878#if (HAS_M6510) || (HAS_M6510T) || (HAS_M8502) || (HAS_M7501)
7979   UINT8    ddr;
r1877r1878
8989
9090static m6502_Regs m6502;
9191
92static READ8_HANDLER( default_rdmem_id ) { return program_read_byte_8(offset); }
93static WRITE8_HANDLER( default_wdmem_id ) { program_write_byte_8(offset, data); }
94
9295/***************************************************************
9396 * include the opcode macros, functions and tables
9497 ***************************************************************/
r1877r1878
130133   m6502.irq_callback = irqcallback;
131134   m6502.subtype = subtype;
132135   m6502.insn = insn;
133   m6502.rdmem_id = program_read_byte_8;
134   m6502.wrmem_id = program_write_byte_8;
136   m6502.rdmem_id = default_rdmem_id;
137   m6502.wrmem_id = default_wdmem_id;
135138
136139   state_save_register_item(type, index, m6502.pc.w.l);
137140   state_save_register_item(type, index, m6502.sp.w.l);
r1877r1878
680683      case CPUINFO_INT_REGISTER + M6502_ZP:         m6502.zp.w.l = info->i;               break;
681684
682685      /* --- the following bits of info are set as pointers to data or functions --- */
683      case CPUINFO_PTR_M6502_READINDEXED_CALLBACK:   m6502.rdmem_id = (read8_handler) info->f; break;
684      case CPUINFO_PTR_M6502_WRITEINDEXED_CALLBACK:   m6502.wrmem_id = (write8_handler) info->f; break;
686      case CPUINFO_PTR_M6502_READINDEXED_CALLBACK:   m6502.rdmem_id = (read8_machine_func) info->f; break;
687      case CPUINFO_PTR_M6502_WRITEINDEXED_CALLBACK:   m6502.wrmem_id = (write8_machine_func) info->f; break;
685688   }
686689}
687690
src/emu/cpu/m6502/m6509.c
r1877r1878
7878   UINT8   irq_state;
7979   UINT8   so_state;
8080   int    (*irq_callback)(int irqline);   /* IRQ callback */
81   read8_handler rdmem_id;               /* readmem callback for indexed instructions */
82   write8_handler wrmem_id;            /* readmem callback for indexed instructions */
81   read8_machine_func rdmem_id;               /* readmem callback for indexed instructions */
82   write8_machine_func wrmem_id;            /* readmem callback for indexed instructions */
8383}   m6509_Regs;
8484
8585static int m6502_ICount = 0;
r1877r1878
119119   AM_RANGE(0x00001, 0x00001) AM_MIRROR(0xF0000) AM_READWRITE(m6509_read_00001, m6509_write_00001)
120120ADDRESS_MAP_END
121121
122static READ8_HANDLER( default_rdmem_id ) { return program_read_byte_8(offset); }
123static WRITE8_HANDLER( default_wdmem_id ) { program_write_byte_8(offset, data); }
124
122125static void m6509_init(int index, int clock, const void *config, int (*irqcallback)(int))
123126{
124   m6509.rdmem_id = program_read_byte_8;
125   m6509.wrmem_id = program_write_byte_8;
127   m6509.rdmem_id = default_rdmem_id;
128   m6509.wrmem_id = default_wdmem_id;
126129   m6509.irq_callback = irqcallback;
127130}
128131
r1877r1878
304307      case CPUINFO_INT_REGISTER + M6509_ZP:         m6509.zp.w.l = info->i;               break;
305308
306309      /* --- the following bits of info are set as pointers to data or functions --- */
307      case CPUINFO_PTR_M6502_READINDEXED_CALLBACK:   m6509.rdmem_id = (read8_handler) info->f; break;
308      case CPUINFO_PTR_M6502_WRITEINDEXED_CALLBACK:   m6509.wrmem_id = (write8_handler) info->f; break;
310      case CPUINFO_PTR_M6502_READINDEXED_CALLBACK:   m6509.rdmem_id = (read8_machine_func) info->f; break;
311      case CPUINFO_PTR_M6502_WRITEINDEXED_CALLBACK:   m6509.wrmem_id = (write8_machine_func) info->f; break;
309312   }
310313}
311314
src/emu/cpu/m6502/m65ce02.c
r1877r1878
7474   UINT8   nmi_state;
7575   UINT8   irq_state;
7676   int    (*irq_callback)(int irqline);   /* IRQ callback */
77   read8_handler rdmem_id;               /* readmem callback for indexed instructions */
78   write8_handler wrmem_id;            /* writemem callback for indexed instructions */
77   read8_machine_func rdmem_id;               /* readmem callback for indexed instructions */
78   write8_machine_func wrmem_id;            /* writemem callback for indexed instructions */
7979}   m65ce02_Regs;
8080
8181
r1877r1878
260260      case CPUINFO_INT_REGISTER + M65CE02_ZP: m65ce02.zp.b.l = info->i; break;
261261
262262      /* --- the following bits of info are set as pointers to data or functions --- */
263      case CPUINFO_PTR_M6502_READINDEXED_CALLBACK:   m65ce02.rdmem_id = (read8_handler) info->f; break;
264      case CPUINFO_PTR_M6502_WRITEINDEXED_CALLBACK:   m65ce02.wrmem_id = (write8_handler) info->f; break;
263      case CPUINFO_PTR_M6502_READINDEXED_CALLBACK:   m65ce02.rdmem_id = (read8_machine_func) info->f; break;
264      case CPUINFO_PTR_M6502_WRITEINDEXED_CALLBACK:   m65ce02.wrmem_id = (write8_machine_func) info->f; break;
265265   }
266266}
267267
src/emu/cpu/i8085/i8085.c
r1877r1878
11221122         I.IREQ &= ~I.ISRV;
11231123         /* reset serviced IRQ */
11241124         I.ISRV = 0;
1125         if( I.irq_state[0] != CLEAR_LINE ) {
1125         if( I.irq_state[I8085_INTR_LINE] != CLEAR_LINE ) {
11261126            LOG(("i8085 EI sets INTR\n"));
11271127            I.IREQ |= IM_INTR;
11281128            I.INTR = I8085_INTR;
11291129         }
11301130         if( I.cputype ) {
1131            if( I.irq_state[1] != CLEAR_LINE ) {
1131            if( I.irq_state[I8085_RST55_LINE] != CLEAR_LINE ) {
11321132               LOG(("i8085 EI sets RST5.5\n"));
11331133               I.IREQ |= IM_RST55;
11341134            }
1135            if( I.irq_state[2] != CLEAR_LINE ) {
1135            if( I.irq_state[I8085_RST65_LINE] != CLEAR_LINE ) {
11361136               LOG(("i8085 EI sets RST6.5\n"));
11371137               I.IREQ |= IM_RST65;
11381138            }
1139            if( I.irq_state[3] != CLEAR_LINE ) {
1139            if( I.irq_state[I8085_RST75_LINE] != CLEAR_LINE ) {
11401140               LOG(("i8085 EI sets RST7.5\n"));
11411141               I.IREQ |= IM_RST75;
1142               I.irq_state[I8085_RST75_LINE] = CLEAR_LINE;   /* clear latch */
11421143            }
11431144            /* find highest priority IREQ flag with
11441145                   IM enabled and schedule for execution */
r1877r1878
14191420   {
14201421
14211422      I.IREQ |= IM_RST75;          /* request RST7.5 */
1423      I.irq_state[I8085_RST75_LINE] = CLEAR_LINE;   /* clear latch */
14221424      if( I.IM & IM_RST75 ) return;   /* if masked, ignore it for now */
14231425      if( !I.ISRV )               /* if no higher priority IREQ is serviced */
14241426      {
r1877r1878
15061508   }
15071509   else if (irqline < 4)
15081510   {
1509      I.irq_state[irqline] = state;
1511      if (irqline == I8085_RST75_LINE)   /* RST7.5 is latched on rising edge, the others are sampled */
1512      {
1513         if( state != CLEAR_LINE )
1514            I.irq_state[irqline] = state;
1515      }
1516      else
1517         I.irq_state[irqline] = state;
1518
15101519      if (state == CLEAR_LINE)
15111520      {
15121521         if( !(I.IM & IM_IEN) )
src/emu/cpu/powerpc/ppc.c
r1877r1878
66#include "deprecat.h"
77
88#if (HAS_PPC603 || HAS_PPC601 || HAS_PPC604)
9void ppc603_exception(int exception);
9static void ppc603_exception(int exception);
1010#endif
1111#if (HAS_PPC602)
12void ppc602_exception(int exception);
12static void ppc602_exception(int exception);
1313#endif
1414#if (HAS_PPC403)
15void ppc403_exception(int exception);
15static void ppc403_exception(int exception);
1616static UINT8 ppc403_spu_r(UINT32 a);
1717static void ppc403_spu_w(UINT32 a, UINT8 d);
1818#endif
r1877r1878
817817   return CR(0) << 28 | CR(1) << 24 | CR(2) << 20 | CR(3) << 16 | CR(4) << 12 | CR(5) << 8 | CR(6) << 4 | CR(7);
818818}
819819
820#ifdef UNUSED_FUNCTION
820821INLINE void ppc_exception(int exception_type)
821822{
822823   longjmp(ppc.exception_jmpbuf, exception_type);
823824}
825#endif
824826
825827/***********************************************************************/
826828
r1877r1878
845847
846848/* Initialization and shutdown */
847849
848void ppc_init(void)
850static void ppc_init(void)
849851{
850852   int i,j;
851853
r1877r1878
17321734}
17331735#endif
17341736
1735void ppc_get_info(UINT32 state, cpuinfo *info)
1737static void ppc_get_info(UINT32 state, cpuinfo *info)
17361738{
17371739   switch(state)
17381740   {
src/emu/cpu/powerpc/ppc602.c
r1877r1878
239239
240240   change_pc(ppc.npc);
241241
242#ifdef __GNUC__
243242   // MinGW's optimizer kills setjmp()/longjmp()
244   (void)__builtin_return_address(1);
245#endif
243   SETJMP_GNUC_PROTECT();
246244
247245   exception_type = setjmp(ppc.exception_jmpbuf);
248246   if (exception_type)
src/emu/cpu/powerpc/ppc603.c
r1877r1878
247247
248248   change_pc(ppc.npc);
249249
250#ifdef __GNUC__
251250   // MinGW's optimizer kills setjmp()/longjmp()
252   (void)__builtin_return_address(1);
253#endif
251   SETJMP_GNUC_PROTECT();
254252
255253   exception_type = setjmp(ppc.exception_jmpbuf);
256254   if (exception_type)
src/emu/cpu/z8000/z8000.c
r1877r1878
256256   }
257257}
258258
259#ifdef UNUSED_FUNCTION
259260INLINE UINT32 RDPORT_L(int mode, UINT16 addr)
260261{
261262   if( mode == 0 )
r1877r1878
271272      return 0x00000000;
272273   }
273274}
275#endif
274276
275277INLINE void WRPORT_B(int mode, UINT16 addr, UINT8 value)
276278{
r1877r1878
297299    }
298300}
299301
302#ifdef UNUSED_FUNCTION
300303INLINE void WRPORT_L(int mode, UINT16 addr, UINT32 value)
301304{
302305   if( mode == 0 )
r1877r1878
311314      /* how to handle MMU writes? */
312315   }
313316}
317#endif
314318
315319#include "z8000ops.c"
316320#include "z8000tbl.c"
src/emu/cpu/sh2/sh2.c
r1877r1878
189189INLINE UINT8 RB(offs_t A)
190190{
191191   if (A >= 0xe0000000)
192      return sh2_internal_r((A & 0x1fc)>>2, ~(0xff << (((~A) & 3)*8))) >> (((~A) & 3)*8);
192      return sh2_internal_r(Machine, (A & 0x1fc)>>2, ~(0xff << (((~A) & 3)*8))) >> (((~A) & 3)*8);
193193
194194   if (A >= 0xc0000000)
195195      return program_read_byte_32be(A);
r1877r1878
203203INLINE UINT16 RW(offs_t A)
204204{
205205   if (A >= 0xe0000000)
206      return sh2_internal_r((A & 0x1fc)>>2, ~(0xffff << (((~A) & 2)*8))) >> (((~A) & 2)*8);
206      return sh2_internal_r(Machine, (A & 0x1fc)>>2, ~(0xffff << (((~A) & 2)*8))) >> (((~A) & 2)*8);
207207
208208   if (A >= 0xc0000000)
209209      return program_read_word_32be(A);
r1877r1878
217217INLINE UINT32 RL(offs_t A)
218218{
219219   if (A >= 0xe0000000)
220      return sh2_internal_r((A & 0x1fc)>>2, 0);
220      return sh2_internal_r(Machine, (A & 0x1fc)>>2, 0);
221221
222222   if (A >= 0xc0000000)
223223      return program_read_dword_32be(A);
r1877r1878
233233
234234   if (A >= 0xe0000000)
235235   {
236      sh2_internal_w((A & 0x1fc)>>2, V << (((~A) & 3)*8), ~(0xff << (((~A) & 3)*8)));
236      sh2_internal_w(Machine, (A & 0x1fc)>>2, V << (((~A) & 3)*8), ~(0xff << (((~A) & 3)*8)));
237237      return;
238238   }
239239
r1877r1878
253253{
254254   if (A >= 0xe0000000)
255255   {
256      sh2_internal_w((A & 0x1fc)>>2, V << (((~A) & 2)*8), ~(0xffff << (((~A) & 2)*8)));
256      sh2_internal_w(Machine, (A & 0x1fc)>>2, V << (((~A) & 2)*8), ~(0xffff << (((~A) & 2)*8)));
257257      return;
258258   }
259259
r1877r1878
273273{
274274   if (A >= 0xe0000000)
275275   {
276      sh2_internal_w((A & 0x1fc)>>2, V, 0);
276      sh2_internal_w(Machine, (A & 0x1fc)>>2, V, 0);
277277      return;
278278   }
279279
src/emu/cpu/sh4/sh4.c
r1877r1878
239239INLINE UINT8 RB(offs_t A)
240240{
241241   if (A >= 0xfe000000)
242      return sh4_internal_r(((A & 0x0fc) >> 2) | ((A & 0x1fe0000) >> 11), ~(0xff << ((A & 3)*8))) >> ((A & 3)*8);
242      return sh4_internal_r(Machine, ((A & 0x0fc) >> 2) | ((A & 0x1fe0000) >> 11), ~(0xff << ((A & 3)*8))) >> ((A & 3)*8);
243243
244244   if (A >= 0xe0000000)
245245      return program_read_byte_64le(A);
r1877r1878
253253INLINE UINT16 RW(offs_t A)
254254{
255255   if (A >= 0xfe000000)
256      return sh4_internal_r(((A & 0x0fc) >> 2) | ((A & 0x1fe0000) >> 11), ~(0xffff << ((A & 2)*8))) >> ((A & 2)*8);
256      return sh4_internal_r(Machine, ((A & 0x0fc) >> 2) | ((A & 0x1fe0000) >> 11), ~(0xffff << ((A & 2)*8))) >> ((A & 2)*8);
257257
258258   if (A >= 0xe0000000)
259259      return program_read_word_64le(A);
r1877r1878
267267INLINE UINT32 RL(offs_t A)
268268{
269269   if (A >= 0xfe000000)
270      return sh4_internal_r(((A & 0x0fc) >> 2) | ((A & 0x1fe0000) >> 11), 0);
270      return sh4_internal_r(Machine, ((A & 0x0fc) >> 2) | ((A & 0x1fe0000) >> 11), 0);
271271
272272   if (A >= 0xe0000000)
273273      return program_read_dword_64le(A);
r1877r1878
283283
284284   if (A >= 0xfe000000)
285285   {
286      sh4_internal_w(((A & 0x0fc) >> 2) | ((A & 0x1fe0000) >> 11), V << ((A & 3)*8), ~(0xff << ((A & 3)*8)));
286      sh4_internal_w(Machine, ((A & 0x0fc) >> 2) | ((A & 0x1fe0000) >> 11), V << ((A & 3)*8), ~(0xff << ((A & 3)*8)));
287287      return;
288288   }
289289
r1877r1878
303303{
304304   if (A >= 0xfe000000)
305305   {
306      sh4_internal_w(((A & 0x0fc) >> 2) | ((A & 0x1fe0000) >> 11), V << ((A & 2)*8), ~(0xffff << ((A & 2)*8)));
306      sh4_internal_w(Machine, ((A & 0x0fc) >> 2) | ((A & 0x1fe0000) >> 11), V << ((A & 2)*8), ~(0xffff << ((A & 2)*8)));
307307      return;
308308   }
309309
r1877r1878
323323{
324324   if (A >= 0xfe000000)
325325   {
326      sh4_internal_w(((A & 0x0fc) >> 2) | ((A & 0x1fe0000) >> 11), V, 0);
326      sh4_internal_w(Machine, ((A & 0x0fc) >> 2) | ((A & 0x1fe0000) >> 11), V, 0);
327327      return;
328328   }
329329
r1877r1878
37113711   //if rtcnt < rtcor then rtcor-rtcnt
37123712   //if rtcnt >= rtcor then 256-rtcnt+rtcor=256+rtcor-rtcnt
37133713   ticks = sh4.m[RTCOR]-sh4.m[RTCNT];
3714   if (ticks < 0)
3714   if (ticks <= 0)
37153715      ticks = 256 + ticks;
3716   //((double)rtcnt_div[(sh4.m[RTCSR] >> 3) & 7] / (double)100000000)*ticks
37173716   timer_adjust_oneshot(sh4.refresh_timer, attotime_mul(attotime_mul(ATTOTIME_IN_HZ(sh4.bus_clock), rtcnt_div[(sh4.m[RTCSR] >> 3) & 7]), ticks), sh4.cpu_number);
37183717   sh4.refresh_timer_base = sh4.m[RTCNT];
37193718}
src/emu/cpu/alph8201/alph8201.c
r1877r1878
308308static void rlca(void)       { CF = (R.A>>7)&1; R.A = (R.A<<1) | (R.A>>7); ZF = (R.A==0); }
309309static void rrca(void)       { CF = R.A &1;     R.A = (R.A>>1) | (R.A<<7); ZF = (R.A==0); }
310310static void inc_b(void)        { M_ADDB(1); }
311static void dec_b(void)        { M_SUBB(1); };
311static void dec_b(void)        { M_SUBB(1); }
312312static void inc_a(void)       { M_ADD(1); }
313313static void dec_a(void)       { M_SUB(1); }
314static void cpl(void)       { R.A = R.A^0xff; ZF = (R.A==0); };
314static void cpl(void)       { R.A = R.A^0xff; ZF = (R.A==0); }
315315
316316static void ld_a_ix0_0(void) { R.A = M_RDMEM(BIX0+0); }
317317static void ld_a_ix0_1(void) { R.A = M_RDMEM(BIX0+1); }
r1877r1878
611611static void tst_a(void)    { ZF = (R.A==0); }                          /* maybe OK */
612612static void clr_a(void)    { R.A = 0; ZF = (R.A==0); }                 /* maybe OK */
613613static void cmp_a_n(void)   { UINT8 i=M_RDMEM_OPCODE();  ZF = (R.A==i); CF = (R.A<i); }
614static void call(void) { UINT8 i=M_RDMEM_OPCODE(); R.retptr.w.l = PC; M_JMP(i); }; /* OK , but stack is unknown */
614static void call(void) { UINT8 i=M_RDMEM_OPCODE(); R.retptr.w.l = PC; M_JMP(i); } /* OK , but stack is unknown */
615615static void ld_a_ix0_a(void) { R.A = M_RDMEM(BIX0+R.A); }              /* maybe OK */
616static void ret(void) { R.mb = R.retptr.b.h; M_JMP( R.retptr.b.l ); }; /* OK , but stack is unknown */
616static void ret(void) { R.mb = R.retptr.b.h; M_JMP( R.retptr.b.l ); } /* OK , but stack is unknown */
617617
618618static const s_opcode opcode_8301[256]=
619619{
src/emu/cpu/g65816/g65816.c
r1877r1878
360360      case CPUINFO_INT_REGISTER + G65816_IRQ_STATE:   g65816_set_reg(G65816_IRQ_STATE, info->i); break;
361361
362362      /* --- the following bits of info are set as pointers to data or functions --- */
363      case CPUINFO_PTR_G65816_READVECTOR_CALLBACK:   READ_VECTOR = (read8_handler) info->f;   break;
363      case CPUINFO_PTR_G65816_READVECTOR_CALLBACK:   READ_VECTOR = (read8_machine_func) info->f;   break;
364364   }
365365}
366366
src/emu/cpu/g65816/g65816op.h
r1877r1878
8181INLINE uint g65816i_read_8_vector(uint address)
8282{
8383   if (READ_VECTOR)
84      return READ_VECTOR(address);
84      return READ_VECTOR(Machine, address);
8585   else
8686      return g65816i_read_8_normal(address);
8787}
src/emu/cpu/g65816/g65816cm.h
r1877r1878
8787   uint ir;         /* Instruction Register */
8888   uint irq_delay;      /* delay 1 instruction before checking irq */
8989   int (*int_ack)(int); /* Interrupt Acknowledge */
90   read8_handler read_vector;   /* Read vector override */
90   read8_machine_func read_vector;   /* Read vector override */
9191   uint stopped;      /* Sets how the CPU is stopped */
9292   void (*const *opcodes)(void);
9393   uint (*get_reg)(int regnum);
src/emu/cpu/i8051/i8051.c
r1877r1878
208208/***************************************************************
209209 * Read/Write a byte from/to the Internal RAM
210210 ***************************************************************/
211#define IRAM_R(a)      internal_ram_read(a)
212#define IRAM_W(a,v)      internal_ram_write(a,v)
211#define IRAM_R(a)      internal_ram_read(Machine,a)
212#define IRAM_W(a,v)      internal_ram_write(Machine,a,v)
213213/***************************************************************
214214 * Read/Write a byte from/to the Internal RAM indirectly (called from indirect addressing)
215215 ***************************************************************/
216#define IRAM_IR(a)      internal_ram_iread(a)
217#define IRAM_IW(a,v)      internal_ram_iwrite(a,v)
216#define IRAM_IR(a)      internal_ram_iread(Machine,a)
217#define IRAM_IW(a,v)   internal_ram_iwrite(Machine,a,v)
218218/***************************************************************
219219 * Form an Address to Read/Write to External RAM indirectly (called from indirect addressing)
220220 ***************************************************************/
221#define ERAM_ADDR(a,m)      external_ram_iaddr(a,m)
221#define ERAM_ADDR(a,m)   external_ram_iaddr(Machine,a,m)
222222/***************************************************************
223223 * Read/Write a byte from/to the SFR Registers
224224 ***************************************************************/
225#define SFR_R(a)      sfr_read(a)
226#define SFR_W(a,v)      sfr_write(a,v)
225#define SFR_R(a)      sfr_read(Machine,a)
226#define SFR_W(a,v)      sfr_write(Machine,a,v)
227227/***************************************************************
228228 * Read/Write a bit from Bit Addressable Memory
229229 ***************************************************************/
230#define BIT_R(a)      bit_address_r(a)
231#define BIT_W(a,v)      bit_address_w(a,v)
230#define BIT_R(a)      bit_address_r(Machine,a)
231#define BIT_W(a,v)      bit_address_w(Machine,a,v)
232232/***************************************************************
233233 * Input/Output a byte from given I/O port
234234 ***************************************************************/
235235#define IN(port)      ((UINT8)io_read_byte(port))
236#define OUT(port,value)    io_write_byte(port,value)
236#define OUT(port,value) io_write_byte(port,value)
237237/***************************************************************
238238 * Access the 4 banks of R registers (R0...R7)
239239 ***************************************************************/
r1877r1878
13501350   default:
13511351      return 0;
13521352   }
1353   return 0;
13541353}
13551354
13561355/*NOTE: These are not used by the opcode functions, they are here only for MAME requirements*/
r1877r1878
17861785/* Different chip types handle differently, for speed, simply call the chip's handler */
17871786static READ8_HANDLER(internal_ram_iread)
17881787{
1789   return i8051.iram_iread(offset);
1788   return i8051.iram_iread(Machine,offset);
17901789}
17911790
17921791/* Writes the contents of the Internal RAM memory (BUT CALLED FROM AN INDIRECT ADDRESSING MODE)   */
17931792/* Different chip types handle differently, for speed, simply call the chip's handler */
17941793static WRITE8_HANDLER(internal_ram_iwrite)
17951794{
1796   i8051.iram_iwrite(offset,data);
1795   i8051.iram_iwrite(Machine,offset,data);
17971796}
17981797
17991798/*Generate an external ram address for read/writing using indirect addressing mode */
r1877r1878
18051804static READ32_HANDLER(external_ram_iaddr)
18061805{
18071806    if(i8051.eram_iaddr_callback)
1808        return i8051.eram_iaddr_callback(offset,mem_mask);
1807        return i8051.eram_iaddr_callback(Machine,offset,mem_mask);
18091808    else
18101809        LOG(("i8051 #%d: external ram address requested (8 bit offset=%02x), but no callback available! at PC:%04x\n", cpu_getactivecpu(), offset, PC));
18111810
r1877r1878
21332132#if (HAS_I8052 || HAS_I8752)
21342133   //Update Timer 2
21352134   if(GET_TR2) {
2136      int timerinc, overflow, isoverflow;
2135      int timerinc, overflow;
21372136      UINT16 count = ((R_TH2<<8) | R_TL2);
2138      timerinc = overflow = isoverflow = 0;
2137      timerinc = overflow = 0;
21392138
21402139      //Are we in counter mode?
21412140      if(GET_CT2)      {
src/emu/cpu/mips/mdrc64.c
r1877r1878
210210
211211typedef struct _oob_handler oob_handler;
212212
213typedef void (*oob_callback)(drc_core *drc, oob_handler *oob, void *param);
213typedef void (*oob_callback_func)(drc_core *drc, oob_handler *oob, void *param);
214214
215215struct _oob_handler
216216{
217   oob_callback      callback;         /* pointer to callback function */
217   oob_callback_func      callback;         /* pointer to callback function */
218218   void *            param;            /* callback parameter */
219219   const opcode_desc *   desc;            /* pointer to description of relevant instruction */
220220   emit_link         link;            /* link to source of the branch */
r1877r1878
365365    bounds callback for later
366366-------------------------------------------------*/
367367
368INLINE void oob_request_callback(drc_core *drc, UINT8 condition, oob_callback callback, const compiler_state *compiler, const opcode_desc *desc, void *param)
368INLINE void oob_request_callback(drc_core *drc, UINT8 condition, oob_callback_func callback, const compiler_state *compiler, const opcode_desc *desc, void *param)
369369{
370370   oob_handler *oob = &mips3.drcdata->ooblist[mips3.drcdata->oobcount++];
371371
r1877r1878
30813081         emit_mov_m32_r32(DRCTOP, CPR0ADDR(reg), REG_EAX);                        // mov  cpr0[reg],eax
30823082         return TRUE;
30833083   }
3084   return FALSE;
30853084}
30863085
30873086
r1877r1878
31343133         emit_movsxd_r64_m32(DRCTOP, REG_RAX, CPR0ADDR(reg));                     // movsxd rax,cpr0[reg]
31353134         return TRUE;
31363135   }
3137   return FALSE;
31383136}
31393137
31403138
src/emu/cpu/tms7000/tms7000.c
r1877r1878
6666   return result | RM((mAddr+1)&0xffff);
6767}
6868
69#ifdef UNUSED_FUNCTION
6970INLINE void WM16( UINT32 mAddr, PAIR p )   /*Write memory file (16 bit) */
7071{
7172   WM( mAddr, p.b.h );
7273   WM( (mAddr+1)&0xffff, p.b.l );
7374}
75#endif
7476
7577INLINE UINT16 RRF16( UINT32 mAddr )   /*Read register file (16 bit) */
7678{
src/emu/cpu/tms32025/tms32025.c
r1877r1878
294294INLINE void MODIFY_PM (int data) { R.STR1 &= ~PM_REG;  R.STR1 |= (data & PM_REG); R.STR1 |= 0x0180; }
295295INLINE void MODIFY_ARP(int data) { R.STR1 &= ~ARB_REG; R.STR1 |= (R.STR0 & ARP_REG); R.STR1 |= 0x0180; \
296296                           R.STR0 &= ~ARP_REG; R.STR0 |= ((data << 13) & ARP_REG); R.STR0 |= 0x0400; }
297#ifdef UNUSED_FUNCTION
297298INLINE void MODIFY_ARB(int data) { R.STR1 &= ~ARB_REG; R.STR1 |= ((data << 13) & ARB_REG); R.STR1 |= 0x0180; }
299#endif
298300
299301static int mHackIgnoreARP; /* special handling for lst, lst1 instructions */
300302
src/emu/cpu/arm7/arm7core.c
r1877r1878
7878*****************************************************************************/
7979
8080#include <stdarg.h>
81#include "deprecat.h"
8182
8283#define ARM7_DEBUG_CORE 0
8384
r1877r1878
674675{
675676    // This instruction simply instructs the co-processor to do something, no data is returned to ARM7 core
676677    if (arm7_coproc_do_callback)
677        arm7_coproc_do_callback(insn, 0, 0);    // simply pass entire opcode to callback - since data format is actually dependent on co-proc implementation
678        arm7_coproc_do_callback(Machine, insn, 0, 0);    // simply pass entire opcode to callback - since data format is actually dependent on co-proc implementation
678679    else
679680        LOG(("%08x: Co-Processor Data Operation executed, but no callback defined!\n", R15));
680681}
r1877r1878
690691    {
691692        if (arm7_coproc_rt_r_callback)
692693        {
693            UINT32 res = arm7_coproc_rt_r_callback(insn, 0);   // RT Read handler must parse opcode & return appropriate result
694            UINT32 res = arm7_coproc_rt_r_callback(Machine, insn, 0);   // RT Read handler must parse opcode & return appropriate result
694695            SET_REGISTER((insn >> 12) & 0xf, res);
695696        }
696697        else
r1877r1878
700701    else
701702    {
702703        if (arm7_coproc_rt_r_callback)
703            arm7_coproc_rt_w_callback(insn, GET_REGISTER((insn >> 12) & 0xf), 0);
704            arm7_coproc_rt_w_callback(Machine, insn, GET_REGISTER((insn >> 12) & 0xf), 0);
704705        else
705706            LOG(("%08x: Co-Processor Register Transfer executed, but no RT Write callback defined!\n", R15));
706707    }
src/emu/cpu/arm7/arm7core.h
r1877r1878
140140/* 17 processor registers are visible at any given time,
141141 * banked depending on processor mode.
142142 */
143
143144static const int sRegisterTable[ARM7_NUM_MODES][18] =
144145{
145146    { /* USR */
src/emu/cpu/h6280/h6280.c
r1877r1878
333333         if(h6280.irq_state[1]!=CLEAR_LINE) status|=1; /* IRQ 2 */
334334         if(h6280.irq_state[0]!=CLEAR_LINE) status|=2; /* IRQ 1 */
335335         if(h6280.irq_state[2]!=CLEAR_LINE) status|=4; /* TIMER */
336         return status|(h6280.io_buffer&(~H6280_IRQ_MASK));break;
336         return status|(h6280.io_buffer&(~H6280_IRQ_MASK));
337337      }
338338   case 2: return h6280.irq_mask|(h6280.io_buffer&(~H6280_IRQ_MASK));break;
339339   }
src/emu/cpu/m6800/m6800.c
r1877r1878
19651965
19661966READ8_HANDLER( hd63701_internal_registers_r )
19671967{
1968   return m6803_internal_registers_r(offset);
1968   return m6803_internal_registers_r(Machine, offset);
19691969}
19701970
19711971WRITE8_HANDLER( hd63701_internal_registers_w )
19721972{
1973   m6803_internal_registers_w(offset,data);
1973   m6803_internal_registers_w(Machine, offset,data);
19741974}
19751975#endif
19761976
src/emu/memconv.h
r1877r1878
8585 *
8686 *************************************/
8787
88INLINE UINT16 read16be_with_read8_handler(read8_handler handler, offs_t offset, UINT16 mem_mask)
88INLINE UINT16 read16be_with_read8_handler(read8_machine_func handler, void *param, offs_t offset, UINT16 mem_mask)
8989{
9090   UINT16 result = 0;
9191   if ((mem_mask & 0xff00) != 0xff00)
92      result |= ((UINT16)(*handler)(offset * 2 + 0)) << 8;
92      result |= ((UINT16)(*handler)(param, offset * 2 + 0)) << 8;
9393   if ((mem_mask & 0x00ff) != 0x00ff)
94      result |= ((UINT16)(*handler)(offset * 2 + 1)) << 0;
94      result |= ((UINT16)(*handler)(param, offset * 2 + 1)) << 0;
9595   return result;
9696}
9797
9898
99INLINE void write16be_with_write8_handler(write8_handler handler, offs_t offset, UINT16 data, UINT16 mem_mask)
99INLINE void write16be_with_write8_handler(write8_machine_func handler, void *param, offs_t offset, UINT16 data, UINT16 mem_mask)
100100{
101101   if ((mem_mask & 0xff00) != 0xff00)
102      (*handler)(offset * 2 + 0, data >> 8);
102      (*handler)(param, offset * 2 + 0, data >> 8);
103103   if ((mem_mask & 0x00ff) != 0x00ff)
104      (*handler)(offset * 2 + 1, data >> 0);
104      (*handler)(param, offset * 2 + 1, data >> 0);
105105}
106106
107107
r1877r1878
111111 *
112112 *************************************/
113113
114INLINE UINT16 read16le_with_read8_handler(read8_handler handler, offs_t offset, UINT16 mem_mask)
114INLINE UINT16 read16le_with_read8_handler(read8_machine_func handler, void *param, offs_t offset, UINT16 mem_mask)
115115{
116116   UINT16 result = 0;
117117   if ((mem_mask & 0x00ff) != 0x00ff)
118      result |= ((UINT16) (*handler)(offset * 2 + 0)) << 0;
118      result |= ((UINT16) (*handler)(param, offset * 2 + 0)) << 0;
119119   if ((mem_mask & 0xff00) != 0xff00)
120      result |= ((UINT16) (*handler)(offset * 2 + 1)) << 8;
120      result |= ((UINT16) (*handler)(param, offset * 2 + 1)) << 8;
121121   return result;
122122}
123123
124124
125INLINE void write16le_with_write8_handler(write8_handler handler, offs_t offset, UINT16 data, UINT16 mem_mask)
125INLINE void write16le_with_write8_handler(write8_machine_func handler, void *param, offs_t offset, UINT16 data, UINT16 mem_mask)
126126{
127127   if ((mem_mask & 0x00ff) != 0x00ff)
128      (*handler)(offset * 2 + 0, data >> 0);
128      (*handler)(param, offset * 2 + 0, data >> 0);
129129   if ((mem_mask & 0xff00) != 0xff00)
130      (*handler)(offset * 2 + 1, data >> 8);
130      (*handler)(param, offset * 2 + 1, data >> 8);
131131}
132132
133133
r1877r1878
137137 *
138138 *************************************/
139139
140INLINE UINT32 read32be_with_read8_handler(read8_handler handler, offs_t offset, UINT32 mem_mask)
140INLINE UINT32 read32be_with_read8_handler(read8_machine_func handler, void *param, offs_t offset, UINT32 mem_mask)
141141{
142142   UINT32 result = 0;
143143   if ((mem_mask & 0xffff0000) != 0xffff0000)
144      result |= read16be_with_read8_handler(handler, offset * 2 + 0, mem_mask >> 16) << 16;
144      result |= read16be_with_read8_handler(handler, param, offset * 2 + 0, mem_mask >> 16) << 16;
145145   if ((mem_mask & 0x0000ffff) != 0x0000ffff)
146      result |= read16be_with_read8_handler(handler, offset * 2 + 1, mem_mask) << 0;
146      result |= read16be_with_read8_handler(handler, param, offset * 2 + 1, mem_mask) << 0;
147147   return result;
148148}
149149
150150
151INLINE void write32be_with_write8_handler(write8_handler handler, offs_t offset, UINT32 data, UINT32 mem_mask)
151INLINE void write32be_with_write8_handler(write8_machine_func handler, void *param, offs_t offset, UINT32 data, UINT32 mem_mask)
152152{
153153   if ((mem_mask & 0xffff0000) != 0xffff0000)
154      write16be_with_write8_handler(handler, offset * 2 + 0, data >> 16, mem_mask >> 16);
154      write16be_with_write8_handler(handler, param, offset * 2 + 0, data >> 16, mem_mask >> 16);
155155   if ((mem_mask & 0x0000ffff) != 0x0000ffff)
156      write16be_with_write8_handler(handler, offset * 2 + 1, data, mem_mask);
156      write16be_with_write8_handler(handler, param, offset * 2 + 1, data, mem_mask);
157157}
158158
159159
r1877r1878
163163 *
164164 *************************************/
165165
166INLINE UINT32 read32le_with_read8_handler(read8_handler handler, offs_t offset, UINT32 mem_mask)
166INLINE UINT32 read32le_with_read8_handler(read8_machine_func handler, void *param, offs_t offset, UINT32 mem_mask)
167167{
168168   UINT32 result = 0;
169169   if ((mem_mask & 0x0000ffff) != 0x0000ffff)
170      result |= read16le_with_read8_handler(handler, offset * 2 + 0, mem_mask) << 0;
170      result |= read16le_with_read8_handler(handler, param, offset * 2 + 0, mem_mask) << 0;
171171   if ((mem_mask & 0xffff0000) != 0xffff0000)
172      result |= read16le_with_read8_handler(handler, offset * 2 + 1, mem_mask >> 16) << 16;
172      result |= read16le_with_read8_handler(handler, param, offset * 2 + 1, mem_mask >> 16) << 16;
173173   return result;
174174}
175175
176176
177INLINE void write32le_with_write8_handler(write8_handler handler, offs_t offset, UINT32 data, UINT32 mem_mask)
177INLINE void write32le_with_write8_handler(write8_machine_func handler, void *param, offs_t offset, UINT32 data, UINT32 mem_mask)
178178{
179179   if ((mem_mask & 0x0000ffff) != 0x0000ffff)
180      write16le_with_write8_handler(handler, offset * 2 + 0, data, mem_mask);
180      write16le_with_write8_handler(handler, param, offset * 2 + 0, data, mem_mask);
181181   if ((mem_mask & 0xffff0000) != 0xffff0000)
182      write16le_with_write8_handler(handler, offset * 2 + 1, data >> 16, mem_mask >> 16);
182      write16le_with_write8_handler(handler, param, offset * 2 + 1, data >> 16, mem_mask >> 16);
183183}
184184
185185
r1877r1878
189189 *
190190 *************************************/
191191
192INLINE UINT32 read32be_with_16be_handler(read16_handler handler, offs_t offset, UINT32 mem_mask)
192INLINE UINT32 read32be_with_16be_handler(read16_machine_func handler, void *param, offs_t offset, UINT32 mem_mask)
193193{
194194   UINT32 result = 0;
195195   if ((mem_mask & 0xffff0000) != 0xffff0000)
196      result |= (*handler)(offset * 2 + 0, mem_mask >> 16) << 16;
196      result |= (*handler)(param, offset * 2 + 0, mem_mask >> 16) << 16;
197197   if ((mem_mask & 0x0000ffff) != 0x0000ffff)
198      result |= (*handler)(offset * 2 + 1, mem_mask) << 0;
198      result |= (*handler)(param, offset * 2 + 1, mem_mask) << 0;
199199   return result;
200200}
201201
202202
203INLINE void write32be_with_16be_handler(write16_handler handler, offs_t offset, UINT32 data, UINT32 mem_mask)
203INLINE void write32be_with_16be_handler(write16_machine_func handler, void *param, offs_t offset, UINT32 data, UINT32 mem_mask)
204204{
205205   if ((mem_mask & 0xffff0000) != 0xffff0000)
206      (*handler)(offset * 2 + 0, data >> 16, mem_mask >> 16);
206      (*handler)(param, offset * 2 + 0, data >> 16, mem_mask >> 16);
207207   if ((mem_mask & 0x0000ffff) != 0x0000ffff)
208      (*handler)(offset * 2 + 1, data, mem_mask);
208      (*handler)(param, offset * 2 + 1, data, mem_mask);
209209}
210210
211211
r1877r1878
215215 *
216216 *************************************/
217217
218INLINE UINT32 read32le_with_16le_handler(read16_handler handler, offs_t offset, UINT32 mem_mask)
218INLINE UINT32 read32le_with_16le_handler(read16_machine_func handler, void *param, offs_t offset, UINT32 mem_mask)
219219{
220220   UINT32 result = 0;
221221   if ((mem_mask & 0x0000ffff) != 0x0000ffff)
222      result |= (*handler)(offset * 2 + 0, mem_mask) << 0;
222      result |= (*handler)(param, offset * 2 + 0, mem_mask) << 0;
223223   if ((mem_mask & 0xffff0000) != 0xffff0000)
224      result |= (*handler)(offset * 2 + 1, mem_mask >> 16) << 16;
224      result |= (*handler)(param, offset * 2 + 1, mem_mask >> 16) << 16;
225225   return result;
226226}
227227
228228
229INLINE void write32le_with_16le_handler(write16_handler handler, offs_t offset, UINT32 data, UINT32 mem_mask)
229INLINE void write32le_with_16le_handler(write16_machine_func handler, void *param, offs_t offset, UINT32 data, UINT32 mem_mask)
230230{
231231   if ((mem_mask & 0x0000ffff) != 0x0000ffff)
232      (*handler)(offset * 2 + 0, data, mem_mask);
232      (*handler)(param, offset * 2 + 0, data, mem_mask);
233233   if ((mem_mask & 0xffff0000) != 0xffff0000)
234      (*handler)(offset * 2 + 1, data >> 16, mem_mask >> 16);
234      (*handler)(param, offset * 2 + 1, data >> 16, mem_mask >> 16);
235235}
236236
237237
r1877r1878
241241 *
242242 *************************************/
243243
244INLINE UINT32 read32be_with_16le_handler(read16_handler handler, offs_t offset, UINT32 mem_mask)
244INLINE UINT32 read32be_with_16le_handler(read16_machine_func handler, void *param, offs_t offset, UINT32 mem_mask)
245245{
246246   UINT32 result = 0;
247247   mem_mask = FLIPENDIAN_INT32(mem_mask);
248   result = read32le_with_16le_handler(handler, offset, mem_mask);
248   result = read32le_with_16le_handler(handler, param, offset, mem_mask);
249249   return FLIPENDIAN_INT32(result);
250250}
251251
252252
253INLINE void write32be_with_16le_handler(write16_handler handler, offs_t offset, UINT32 data, UINT32 mem_mask)
253INLINE void write32be_with_16le_handler(write16_machine_func handler, void *param, offs_t offset, UINT32 data, UINT32 mem_mask)
254254{
255255   data = FLIPENDIAN_INT32(data);
256256   mem_mask = FLIPENDIAN_INT32(mem_mask);
257   write32le_with_16le_handler(handler, offset, data, mem_mask);
257   write32le_with_16le_handler(handler, param, offset, data, mem_mask);
258258}
259259
260260
r1877r1878
264264 *
265265 *************************************/
266266
267INLINE UINT32 read32le_with_16be_handler(read16_handler handler, offs_t offset, UINT32 mem_mask)
267INLINE UINT32 read32le_with_16be_handler(read16_machine_func handler, void *param, offs_t offset, UINT32 mem_mask)
268268{
269269   UINT32 result = 0;
270270   mem_mask = FLIPENDIAN_INT32(mem_mask);
271   result = read32be_with_16be_handler(handler, offset, mem_mask);
271   result = read32be_with_16be_handler(handler, param, offset, mem_mask);
272272   return FLIPENDIAN_INT32(result);
273273}
274274
275275
276INLINE void write32le_with_16be_handler(write16_handler handler, offs_t offset, UINT32 data, UINT32 mem_mask)
276INLINE void write32le_with_16be_handler(write16_machine_func handler, void *param, offs_t offset, UINT32 data, UINT32 mem_mask)
277277{
278278   data = FLIPENDIAN_INT32(data);
279279   mem_mask = FLIPENDIAN_INT32(mem_mask);
280   write32be_with_16be_handler(handler, offset, data, mem_mask);
280   write32be_with_16be_handler(handler, param, offset, data, mem_mask);
281281}
282282
283283
r1877r1878
287287 *
288288 *************************************/
289289
290INLINE UINT64 read64be_with_read8_handler(read8_handler handler, offs_t offset, UINT64 mem_mask)
290INLINE UINT64 read64be_with_read8_handler(read8_machine_func handler, void *param, offs_t offset, UINT64 mem_mask)
291291{
292292   UINT64 result = 0;
293293   if ((mem_mask & U64(0xffffffff00000000)) != U64(0xffffffff00000000))
294      result |= (UINT64)read32be_with_read8_handler(handler, offset * 2 + 0, mem_mask >> 32) << 32;
294      result |= (UINT64)read32be_with_read8_handler(handler, param, offset * 2 + 0, mem_mask >> 32) << 32;
295295   if ((mem_mask & U64(0x00000000ffffffff)) != U64(0x00000000ffffffff))
296      result |= (UINT64)read32be_with_read8_handler(handler, offset * 2 + 1, mem_mask) << 0;
296      result |= (UINT64)read32be_with_read8_handler(handler, param, offset * 2 + 1, mem_mask) << 0;
297297   return result;
298298}
299299
300300
301INLINE void write64be_with_write8_handler(write8_handler handler, offs_t offset, UINT64 data, UINT64 mem_mask)
301INLINE void write64be_with_write8_handler(write8_machine_func handler, void *param, offs_t offset, UINT64 data, UINT64 mem_mask)
302302{
303303   if ((mem_mask & U64(0xffffffff00000000)) != U64(0xffffffff00000000))
304      write32be_with_write8_handler(handler, offset * 2 + 0, data >> 32, mem_mask >> 32);
304      write32be_with_write8_handler(handler, param, offset * 2 + 0, data >> 32, mem_mask >> 32);
305305   if ((mem_mask & U64(0x00000000ffffffff)) != U64(0x00000000ffffffff))
306      write32be_with_write8_handler(handler, offset * 2 + 1, data, mem_mask);
306      write32be_with_write8_handler(handler, param, offset * 2 + 1, data, mem_mask);
307307}
308308
309309
r1877r1878
313313 *
314314 *************************************/
315315
316INLINE UINT64 read64le_with_read8_handler(read8_handler handler, offs_t offset, UINT64 mem_mask)
316INLINE UINT64 read64le_with_read8_handler(read8_machine_func handler, void *param, offs_t offset, UINT64 mem_mask)
317317{
318318   UINT64 result = 0;
319319   if ((mem_mask & U64(0x00000000ffffffff)) != U64(0x00000000ffffffff))
320      result |= (UINT64)read32le_with_read8_handler(handler, offset * 2 + 0, mem_mask >> 0) << 0;
320      result |= (UINT64)read32le_with_read8_handler(handler, param, offset * 2 + 0, mem_mask >> 0) << 0;
321321   if ((mem_mask & U64(0xffffffff00000000)) != U64(0xffffffff00000000))
322      result |= (UINT64)read32le_with_read8_handler(handler, offset * 2 + 1, mem_mask >> 32) << 32;
322      result |= (UINT64)read32le_with_read8_handler(handler, param, offset * 2 + 1, mem_mask >> 32) << 32;
323323   return result;
324324}
325325
326326
327INLINE void write64le_with_write8_handler(write8_handler handler, offs_t offset, UINT64 data, UINT64 mem_mask)
327INLINE void write64le_with_write8_handler(write8_machine_func handler, void *param, offs_t offset, UINT64 data, UINT64 mem_mask)
328328{
329329   if ((mem_mask & U64(0x00000000ffffffff)) != U64(0x00000000ffffffff))
330      write32le_with_write8_handler(handler, offset * 2 + 0, data >> 0, mem_mask >> 0);
330      write32le_with_write8_handler(handler, param, offset * 2 + 0, data >> 0, mem_mask >> 0);
331331   if ((mem_mask & U64(0xffffffff00000000)) != U64(0xffffffff00000000))
332      write32le_with_write8_handler(handler, offset * 2 + 1, data >> 32, mem_mask >> 32);
332      write32le_with_write8_handler(handler, param, offset * 2 + 1, data >> 32, mem_mask >> 32);
333333}
334334
335335
r1877r1878
339339 *
340340 *************************************/
341341
342INLINE UINT32 read64be_with_16be_handler(read16_handler handler, offs_t offset, UINT64 mem_mask)
342INLINE UINT32 read64be_with_16be_handler(read16_machine_func handler, void *param, offs_t offset, UINT64 mem_mask)
343343{
344344   UINT64 result = 0;
345345   if ((mem_mask & U64(0xffffffff00000000)) != U64(0xffffffff00000000))
346      result |= (UINT64)read32be_with_16be_handler(handler, offset * 2 + 0, mem_mask >> 32) << 32;
346      result |= (UINT64)read32be_with_16be_handler(handler, param, offset * 2 + 0, mem_mask >> 32) << 32;
347347   if ((mem_mask & U64(0x00000000ffffffff)) != U64(0x00000000ffffffff))
348      result |= (UINT64)read32be_with_16be_handler(handler, offset * 2 + 1, mem_mask >> 0) << 0;
348      result |= (UINT64)read32be_with_16be_handler(handler, param, offset * 2 + 1, mem_mask >> 0) << 0;
349349   return result;
350350}
351351
352352
353INLINE void write64be_with_16be_handler(write16_handler handler, offs_t offset, UINT64 data, UINT64 mem_mask)
353INLINE void write64be_with_16be_handler(write16_machine_func handler, void *param, offs_t offset, UINT64 data, UINT64 mem_mask)
354354{
355355   if ((mem_mask & U64(0xffffffff00000000)) != U64(0xffffffff00000000))
356      write32be_with_16be_handler(handler, offset * 2 + 0, data >> 32, mem_mask >> 32);
356      write32be_with_16be_handler(handler, param, offset * 2 + 0, data >> 32, mem_mask >> 32);
357357   if ((mem_mask & U64(0x00000000ffffffff)) != U64(0x00000000ffffffff))
358      write32be_with_16be_handler(handler, offset * 2 + 1, data >> 0, mem_mask >> 0);
358      write32be_with_16be_handler(handler, param, offset * 2 + 1, data >> 0, mem_mask >> 0);
359359}
360360
361361
r1877r1878
365365 *
366366 *************************************/
367367
368INLINE UINT32 read64le_with_16le_handler(read16_handler handler, offs_t offset, UINT64 mem_mask)
368INLINE UINT32 read64le_with_16le_handler(read16_machine_func handler, void *param, offs_t offset, UINT64 mem_mask)
369369{
370370   UINT64 result = 0;
371371   if ((mem_mask & U64(0x00000000ffffffff)) != U64(0x00000000ffffffff))
372      result |= (UINT64)read32le_with_16le_handler(handler, offset * 2 + 0, mem_mask >> 0) << 0;
372      result |= (UINT64)read32le_with_16le_handler(handler, param, offset * 2 + 0, mem_mask >> 0) << 0;
373373   if ((mem_mask & U64(0xffffffff00000000)) != U64(0xffffffff00000000))
374      result |= (UINT64)read32le_with_16le_handler(handler, offset * 2 + 1, mem_mask >> 32) << 32;
374      result |= (UINT64)read32le_with_16le_handler(handler, param, offset * 2 + 1, mem_mask >> 32) << 32;
375375   return result;
376376}
377377
378378
379INLINE void write64le_with_16le_handler(write16_handler handler, offs_t offset, UINT64 data, UINT64 mem_mask)
379INLINE void write64le_with_16le_handler(write16_machine_func handler, void *param, offs_t offset, UINT64 data, UINT64 mem_mask)
380380{
381381   if ((mem_mask & U64(0x00000000ffffffff)) != U64(0x00000000ffffffff))
382      write32le_with_16le_handler(handler, offset * 2 + 0, data >> 0, mem_mask >> 0);
382      write32le_with_16le_handler(handler, param, offset * 2 + 0, data >> 0, mem_mask >> 0);
383383   if ((mem_mask & U64(0xffffffff00000000)) != U64(0xffffffff00000000))
384      write32le_with_16le_handler(handler, offset * 2 + 1, data >> 32, mem_mask >> 32);
384      write32le_with_16le_handler(handler, param, offset * 2 + 1, data >> 32, mem_mask >> 32);
385385}
386386
387387
r1877r1878
391391 *
392392 *************************************/
393393
394INLINE UINT32 read64be_with_16le_handler(read16_handler handler, offs_t offset, UINT64 mem_mask)
394INLINE UINT32 read64be_with_16le_handler(read16_machine_func handler, void *param, offs_t offset, UINT64 mem_mask)
395395{
396396   UINT64 result = 0;
397397   if ((mem_mask & U64(0xffffffff00000000)) != U64(0xffffffff00000000))
398      result |= (UINT64)read32be_with_16le_handler(handler, offset * 2 + 0, mem_mask >> 32) << 32;
398      result |= (UINT64)read32be_with_16le_handler(handler, param, offset * 2 + 0, mem_mask >> 32) << 32;
399399   if ((mem_mask & U64(0x00000000ffffffff)) != U64(0x00000000ffffffff))
400      result |= (UINT64)read32be_with_16le_handler(handler, offset * 2 + 1, mem_mask >> 0) << 0;
400      result |= (UINT64)read32be_with_16le_handler(handler, param, offset * 2 + 1, mem_mask >> 0) << 0;
401401   return result;
402402}
403403
404404
405INLINE void write64be_with_16le_handler(write16_handler handler, offs_t offset, UINT64 data, UINT64 mem_mask)
405INLINE void write64be_with_16le_handler(write16_machine_func handler, void *param, offs_t offset, UINT64 data, UINT64 mem_mask)
406406{
407407   if ((mem_mask & U64(0xffffffff00000000)) != U64(0xffffffff00000000))
408      write32be_with_16le_handler(handler, offset * 2 + 0, data >> 32, mem_mask >> 32);
408      write32be_with_16le_handler(handler, param, offset * 2 + 0, data >> 32, mem_mask >> 32);
409409   if ((mem_mask & U64(0x00000000ffffffff)) != U64(0x00000000ffffffff))
410      write32be_with_16le_handler(handler, offset * 2 + 1, data >> 0, mem_mask >> 0);
410      write32be_with_16le_handler(handler, param, offset * 2 + 1, data >> 0, mem_mask >> 0);
411411}
412412
413413
r1877r1878
417417 *
418418 *************************************/
419419
420INLINE UINT32 read64le_with_16be_handler(read16_handler handler, offs_t offset, UINT64 mem_mask)
420INLINE UINT32 read64le_with_16be_handler(read16_machine_func handler, void *param, offs_t offset, UINT64 mem_mask)
421421{
422422   UINT64 result = 0;
423423   if ((mem_mask & U64(0x00000000ffffffff)) != U64(0x00000000ffffffff))
424      result |= (UINT64)read32le_with_16be_handler(handler, offset * 2 + 0, mem_mask >> 0) << 0;
424      result |= (UINT64)read32le_with_16be_handler(handler, param, offset * 2 + 0, mem_mask >> 0) << 0;
425425   if ((mem_mask & U64(0xffffffff00000000)) != U64(0xffffffff00000000))
426      result |= (UINT64)read32le_with_16be_handler(handler, offset * 2 + 1, mem_mask >> 32) << 32;
426      result |= (UINT64)read32le_with_16be_handler(handler, param, offset * 2 + 1, mem_mask >> 32) << 32;
427427   return result;
428428}
429429
430430
431INLINE void write64le_with_16be_handler(write16_handler handler, offs_t offset, UINT64 data, UINT64 mem_mask)
431INLINE void write64le_with_16be_handler(write16_machine_func handler, void *param, offs_t offset, UINT64 data, UINT64 mem_mask)
432432{
433433   if ((mem_mask & U64(0x00000000ffffffff)) != U64(0x00000000ffffffff))
434      write32le_with_16be_handler(handler, offset * 2 + 0, data >> 0, mem_mask >> 0);
434      write32le_with_16be_handler(handler, param, offset * 2 + 0, data >> 0, mem_mask >> 0);
435435   if ((mem_mask & U64(0xffffffff00000000)) != U64(0xffffffff00000000))
436      write32le_with_16be_handler(handler, offset * 2 + 1, data >> 32, mem_mask >> 32);
436      write32le_with_16be_handler(handler, param, offset * 2 + 1, data >> 32, mem_mask >> 32);
437437}
438438
439439
r1877r1878
443443 *
444444 *************************************/
445445
446INLINE UINT64 read64be_with_32be_handler(read32_handler handler, offs_t offset, UINT64 mem_mask)
446INLINE UINT64 read64be_with_32be_handler(read32_machine_func handler, void *param, offs_t offset, UINT64 mem_mask)
447447{
448448   UINT64 result = 0;
449449   if ((mem_mask & U64(0xffffffff00000000)) != U64(0xffffffff00000000))
450      result |= (UINT64)(*handler)(offset * 2 + 0, mem_mask >> 32) << 32;
450      result |= (UINT64)(*handler)(param, offset * 2 + 0, mem_mask >> 32) << 32;
451451   if ((mem_mask & U64(0x00000000ffffffff)) != U64(0x00000000ffffffff))
452      result |= (UINT64)(*handler)(offset * 2 + 1, mem_mask >> 0) << 0;
452      result |= (UINT64)(*handler)(param, offset * 2 + 1, mem_mask >> 0) << 0;
453453   return result;
454454}
455455
456456
457INLINE void write64be_with_32be_handler(write32_handler handler, offs_t offset, UINT64 data, UINT64 mem_mask)
457INLINE void write64be_with_32be_handler(write32_machine_func handler, void *param, offs_t offset, UINT64 data, UINT64 mem_mask)
458458{
459459   if ((mem_mask & U64(0xffffffff00000000)) != U64(0xffffffff00000000))
460      (*handler)(offset * 2 + 0, data >> 32, mem_mask >> 32);
460      (*handler)(param, offset * 2 + 0, data >> 32, mem_mask >> 32);
461461   if ((mem_mask & U64(0x00000000ffffffff)) != U64(0x00000000ffffffff))
462      (*handler)(offset * 2 + 1, data >>  0, mem_mask >>  0);
462      (*handler)(param, offset * 2 + 1, data >>  0, mem_mask >>  0);
463463}
464464
465465
r1877r1878
469469 *
470470 *************************************/
471471
472INLINE UINT64 read64le_with_32le_handler(read32_handler handler, offs_t offset, UINT64 mem_mask)
472INLINE UINT64 read64le_with_32le_handler(read32_machine_func handler, void *param, offs_t offset, UINT64 mem_mask)
473473{
474474   UINT64 result = 0;
475475   if ((mem_mask & U64(0x00000000ffffffff)) != U64(0x00000000ffffffff))
476      result |= (UINT64)(*handler)(offset * 2 + 0, mem_mask >> 0) << 0;
476      result |= (UINT64)(*handler)(param, offset * 2 + 0, mem_mask >> 0) << 0;
477477   if ((mem_mask & U64(0xffffffff00000000)) != U64(0xffffffff00000000))
478      result |= (UINT64)(*handler)(offset * 2 + 1, mem_mask >> 32) << 32;
478      result |= (UINT64)(*handler)(param, offset * 2 + 1, mem_mask >> 32) << 32;
479479   return result;
480480}
481481
482482
483INLINE void write64le_with_32le_handler(write32_handler handler, offs_t offset, UINT64 data, UINT64 mem_mask)
483INLINE void write64le_with_32le_handler(write32_machine_func handler, void *param, offs_t offset, UINT64 data, UINT64 mem_mask)
484484{
485485   if ((mem_mask & U64(0x00000000ffffffff)) != U64(0x00000000ffffffff))
486      (*handler)(offset * 2 + 0, data >> 0, mem_mask >> 0);
486      (*handler)(param, offset * 2 + 0, data >> 0, mem_mask >> 0);
487487   if ((mem_mask & U64(0xffffffff00000000)) != U64(0xffffffff00000000))
488      (*handler)(offset * 2 + 1, data >> 32, mem_mask >> 32);
488      (*handler)(param, offset * 2 + 1, data >> 32, mem_mask >> 32);
489489}
490490
491491
r1877r1878
495495 *
496496 *************************************/
497497
498INLINE UINT64 read64be_with_32le_handler(read32_handler handler, offs_t offset, UINT64 mem_mask)
498INLINE UINT64 read64be_with_32le_handler(read32_machine_func handler, void *param, offs_t offset, UINT64 mem_mask)
499499{
500500   UINT64 result;
501501   mem_mask = FLIPENDIAN_INT64(mem_mask);
502   result = read64le_with_32le_handler(handler, offset, mem_mask);
502   result = read64le_with_32le_handler(handler, param, offset, mem_mask);
503503   return FLIPENDIAN_INT64(result);
504504}
505505
506506
507INLINE void write64be_with_32le_handler(write32_handler handler, offs_t offset, UINT64 data, UINT64 mem_mask)
507INLINE void write64be_with_32le_handler(write32_machine_func handler, void *param, offs_t offset, UINT64 data, UINT64 mem_mask)
508508{
509509   data = FLIPENDIAN_INT64(data);
510510   mem_mask = FLIPENDIAN_INT64(mem_mask);
511   write64le_with_32le_handler(handler, offset, data, mem_mask);
511   write64le_with_32le_handler(handler, param, offset, data, mem_mask);
512512}
513513
514514
r1877r1878
518518 *
519519 *************************************/
520520
521INLINE UINT64 read64le_with_32be_handler(read32_handler handler, offs_t offset, UINT64 mem_mask)
521INLINE UINT64 read64le_with_32be_handler(read32_machine_func handler, void *param, offs_t offset, UINT64 mem_mask)
522522{
523523   UINT64 result;
524524   mem_mask = FLIPENDIAN_INT64(mem_mask);
525   result = read64be_with_32be_handler(handler, offset, mem_mask);
525   result = read64be_with_32be_handler(handler, param, offset, mem_mask);
526526   return FLIPENDIAN_INT64(result);
527527}
528528
529529
530INLINE void write64le_with_32be_handler(write32_handler handler, offs_t offset, UINT64 data, UINT64 mem_mask)
530INLINE void write64le_with_32be_handler(write32_machine_func handler, void *param, offs_t offset, UINT64 data, UINT64 mem_mask)
531531{
532532   data = FLIPENDIAN_INT64(data);
533533   mem_mask = FLIPENDIAN_INT64(mem_mask);
534   write64be_with_32be_handler(handler, offset, data, mem_mask);
534   write64be_with_32be_handler(handler, param, offset, data, mem_mask);
535535}
536536
537537
r1877r1878
542542
543543**************************************************************************/
544544
545#define READ_TEMPLATE(bits, name, handler, func)   \
546READ##bits##_HANDLER( name##_r )               \
547{                                       \
548   return func(handler, offset, mem_mask);         \
545#define READ_TEMPLATE(bits, name, handler, func)            \
546READ##bits##_HANDLER( name##_r )                        \
547{                                                \
548   return func(handler, param, offset, mem_mask);            \
549549}
550550
551551#define READ_TEMPLATE_COND(bits, name, handler, func, cond)      \
552552READ##bits##_HANDLER( name##_r )                        \
553553{                                                \
554554   if (cond)                                       \
555      return func(handler, offset, mem_mask);               \
555      return func(handler, param, offset, mem_mask);         \
556556   return 0;                                       \
557557}
558558
559#define WRITE_TEMPLATE(bits, name, handler, func)         \
560WRITE##bits##_HANDLER( name##_w )                     \
561{                                             \
562   func(handler, offset, data, mem_mask);               \
559#define WRITE_TEMPLATE(bits, name, handler, func)            \
560WRITE##bits##_HANDLER( name##_w )                        \
561{                                                \
562   func(handler, param, offset, data, mem_mask);            \
563563}
564564
565565#define WRITE_TEMPLATE_COND(bits, name, handler, func, cond)   \
566566WRITE##bits##_HANDLER( name##_w )                        \
567567{                                                \
568568   if (cond)                                       \
569      return func(handler, offset, data, mem_mask);         \
569      return func(handler, param, offset, data, mem_mask);   \
570570}
571571
572572
src/emu/config.h
r1877r1878
4343 *
4444 *************************************/
4545
46typedef void (*config_callback)(int config_type, xml_data_node *parentnode);
46typedef void (*config_callback_func)(int config_type, xml_data_node *parentnode);
4747
4848
4949
r1877r1878
5454 *************************************/
5555
5656void config_init(running_machine *machine);
57void config_register(const char *nodename, config_callback load, config_callback save);
57void config_register(const char *nodename, config_callback_func load, config_callback_func save);
5858int config_load_settings(running_machine *machine);
5959void config_save_settings(running_machine *machine);
6060
src/emu/streams.c
r1877r1878
145145   INT32            output_base_sampindex;   /* sample at base of buffer, relative to the current emulated second */
146146
147147   /* callback information */
148   stream_callback    callback;            /* callback function */
148   stream_update_func    callback;            /* callback function */
149149   void *            param;               /* callback function parameter */
150150};
151151
r1877r1878
348348    stream_create - create a new stream
349349-------------------------------------------------*/
350350
351sound_stream *stream_create(int inputs, int outputs, int sample_rate, void *param, stream_callback callback)
351sound_stream *stream_create(int inputs, int outputs, int sample_rate, void *param, stream_update_func callback)
352352{
353353   streams_private *strdata = Machine->streams_data;
354354   int inputnum, outputnum;
src/emu/uigfx.c
r1877r1878
2929
3030   /* intermediate bitmaps */
3131   UINT8         bitmap_dirty;      /* is the bitmap dirty? */
32   mame_bitmap *   bitmap;            /* bitmap for drawing gfx and tilemaps */
32   bitmap_t *      bitmap;            /* bitmap for drawing gfx and tilemaps */
3333   render_texture *texture;         /* texture for rendering the above bitmap */
3434
3535   /* palette-specific data */
r1877r1878
8383
8484/* graphics set handling */
8585static void gfxset_handle_keys(ui_gfx_state *state, int xcells, int ycells);
86static void gfxset_draw_item(const gfx_element *gfx, int index, mame_bitmap *bitmap, int dstx, int dsty, int color, int rotate);
86static void gfxset_draw_item(const gfx_element *gfx, int index, bitmap_t *bitmap, int dstx, int dsty, int color, int rotate);
8787static void gfxset_update_bitmap(ui_gfx_state *state, int xcells, int ycells, gfx_element *gfx);
8888static void gfxset_handler(ui_gfx_state *state);
8989
r1877r1878
761761    the view
762762-------------------------------------------------*/
763763
764static void gfxset_draw_item(const gfx_element *gfx, int index, mame_bitmap *bitmap, int dstx, int dsty, int color, int rotate)
764static void gfxset_draw_item(const gfx_element *gfx, int index, bitmap_t *bitmap, int dstx, int dsty, int color, int rotate)
765765{
766766   static const pen_t default_palette[] =
767767   {
src/emu/streams.h
r1877r1878
2121
2222typedef struct _sound_stream sound_stream;
2323
24typedef void (*stream_callback)(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
24typedef void (*stream_update_func)(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
2525
2626
2727
r1877r1878
4646/* ----- stream configuration and setup ----- */
4747
4848/* create a new stream */
49sound_stream *stream_create(int inputs, int outputs, int sample_rate, void *param, stream_callback callback);
49sound_stream *stream_create(int inputs, int outputs, int sample_rate, void *param, stream_update_func callback);
5050
5151/* configure a stream's input */
5252void stream_set_input(sound_stream *stream, int index, sound_stream *input_stream, int output_index, float gain);
src/emu/eigccx86.h
r1877r1878
3333
3434#ifndef __x86_64__
3535#define mul_32x32 _mul_32x32
36INLINE INT64 __attribute__((const, always_inline))
36INLINE INT64 ATTR_CONST ATTR_FORCE_INLINE
3737_mul_32x32(INT32 a, INT32 b)
3838{
3939   register INT64 result;
r1877r1878
5959
6060#ifndef __x86_64__
6161#define mulu_32x32 _mulu_32x32
62INLINE UINT64 __attribute__((const, always_inline))
62INLINE UINT64 ATTR_CONST ATTR_FORCE_INLINE
6363_mulu_32x32(UINT32 a, UINT32 b)
6464{
6565   register UINT64 result;
r1877r1878
8484-------------------------------------------------*/
8585
8686#define mul_32x32_hi _mul_32x32_hi
87INLINE INT32 __attribute__((const, always_inline))
87INLINE INT32 ATTR_CONST ATTR_FORCE_INLINE
8888_mul_32x32_hi(INT32 a, INT32 b)
8989{
9090    register INT32 result, temp;
r1877r1878
9393      " imull  %[b] ;"
9494      : [result] "=d"  (result)   /* result in edx */
9595        , [temp]   "=a"  (temp)     /* This is effectively a clobber */
96        : [a]      "%1"  (a)        /* 'a' should be in eax on entry */
96        : [a]      "a"  (a)        /* 'a' should be in eax on entry */
9797        , [b]      "rm"  (b)        /* 'b' can be memory or register */
9898      : "%cc"                  /* Clobbers condition codes */
9999   );
r1877r1878
109109-------------------------------------------------*/
110110
111111#define mulu_32x32_hi _mulu_32x32_hi
112INLINE UINT32 __attribute__((const, always_inline))
112INLINE UINT32 ATTR_CONST ATTR_FORCE_INLINE
113113_mulu_32x32_hi(UINT32 a, UINT32 b)
114114{
115115    register UINT32 result, temp;
r1877r1878
118118      " mull  %[b] ;"
119119      : [result] "=d"  (result)   /* result in edx */
120120        , [temp]   "=a"  (temp)     /* This is effectively a clobber */
121        : [a]      "%1"  (a)        /* 'a' should be in eax on entry */
121        : [a]      "a"   (a)        /* 'a' should be in eax on entry */
122122        , [b]      "rm"  (b)        /* 'b' can be memory or register */
123123      : "%cc"                  /* Clobbers condition codes */
124124   );
r1877r1878
136136
137137#ifndef __x86_64__
138138#define mul_32x32_shift _mul_32x32_shift
139INLINE INT32 __attribute__((const, always_inline))
139INLINE INT32 ATTR_CONST ATTR_FORCE_INLINE
140140_mul_32x32_shift(INT32 a, INT32 b, UINT8 shift)
141141{
142142   register INT32 result;
r1877r1878
166166
167167#ifndef __x86_64__
168168#define mulu_32x32_shift _mulu_32x32_shift
169INLINE UINT32 __attribute__((const, always_inline))
169INLINE UINT32 ATTR_CONST ATTR_FORCE_INLINE
170170_mulu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift)
171171{
172172   register UINT32 result;
r1877r1878
194194
195195#ifndef __x86_64__
196196#define div_64x32 _div_64x32
197INLINE INT32 __attribute__((const, always_inline))
197INLINE INT32 ATTR_CONST ATTR_FORCE_INLINE
198198_div_64x32(INT64 a, INT32 b)
199199{
200200   register INT32 result, temp;
r1877r1878
221221
222222#ifndef __x86_64__
223223#define divu_64x32 _divu_64x32
224INLINE UINT32 __attribute__((const, always_inline))
224INLINE UINT32 ATTR_CONST ATTR_FORCE_INLINE
225225_divu_64x32(UINT64 a, UINT32 b)
226226{
227227   register UINT32 result, temp;
r1877r1878
249249
250250#ifndef __x86_64__
251251#define div_64x32_rem _div_64x32_rem
252INLINE INT32 __attribute__((always_inline))
252INLINE INT32 ATTR_FORCE_INLINE
253253_div_64x32_rem(INT64 dividend, INT32 divisor, INT32 *remainder)
254254{
255255   register INT32 quotient;
r1877r1878
277277
278278#ifndef __x86_64__
279279#define divu_64x32_rem _divu_64x32_rem
280INLINE UINT32 __attribute__((always_inline))
280INLINE UINT32 ATTR_FORCE_INLINE
281281_divu_64x32_rem(UINT64 dividend, UINT32 divisor, UINT32 *remainder)
282282{
283283   register UINT32 quotient;
r1877r1878
305305
306306#ifndef __x86_64__
307307#define div_32x32_shift _div_32x32_shift
308INLINE INT32 __attribute__((const, always_inline))
308INLINE INT32 ATTR_CONST ATTR_FORCE_INLINE
309309_div_32x32_shift(INT32 a, INT32 b, UINT8 shift)
310310{
311311   register INT32 result;
r1877r1878
337337
338338#ifndef __x86_64__
339339#define divu_32x32_shift _divu_32x32_shift
340INLINE UINT32 __attribute__((const, always_inline))
340INLINE UINT32 ATTR_CONST ATTR_FORCE_INLINE
341341_divu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift)
342342{
343343   register INT32 result;
r1877r1878
368368
369369#ifndef __x86_64__
370370#define mod_64x32 _mod_64x32
371INLINE INT32 __attribute__((const, always_inline))
371INLINE INT32 ATTR_CONST ATTR_FORCE_INLINE
372372_mod_64x32(INT64 a, INT32 b)
373373{
374374   register INT32 result, temp;
r1877r1878
395395
396396#ifndef __x86_64__
397397#define modu_64x32 _modu_64x32
398INLINE UINT32 __attribute__((const, always_inline))
398INLINE UINT32 ATTR_CONST ATTR_FORCE_INLINE
399399_modu_64x32(UINT64 a, UINT32 b)
400400{
401401   register UINT32 result, temp;
r1877r1878
422422
423423#ifdef __SSE2__
424424#define recip_approx _recip_approx
425INLINE float __attribute__((const))
425INLINE float ATTR_CONST
426426_recip_approx(float value)
427427{
428428   __m128 value_xmm = _mm_set_ss(value);
r1877r1878
445445-------------------------------------------------*/
446446
447447#define count_leading_zeros _count_leading_zeros
448INLINE UINT8 __attribute__((const, always_inline))
448INLINE UINT8 ATTR_CONST ATTR_FORCE_INLINE
449449_count_leading_zeros(UINT32 value)
450450{
451451   register UINT32 result;
r1877r1878
470470-------------------------------------------------*/
471471
472472#define count_leading_ones _count_leading_ones
473INLINE UINT8 __attribute__((const, always_inline))
473INLINE UINT8 ATTR_CONST ATTR_FORCE_INLINE
474474_count_leading_ones(UINT32 value)
475475{
476476   register UINT32 result;
r1877r1878
504504-------------------------------------------------*/
505505
506506#define compare_exchange32 _compare_exchange32
507INLINE INT32 __attribute__((nonnull(1), always_inline))
507INLINE INT32 ATTR_NONNULL ATTR_FORCE_INLINE
508508_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange)
509509{
510510   register INT32 result;
r1877r1878
531531
532532#ifdef __x86_64__
533533#define compare_exchange64 _compare_exchange64
534INLINE INT64 __attribute__((nonnull(1), always_inline))
534INLINE INT64 ATTR_NONNULL ATTR_FORCE_INLINE
535535_compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange)
536536{
537537   register INT64 result;
r1877r1878
557557-------------------------------------------------*/
558558
559559#define atomic_exchange32 _atomic_exchange32
560INLINE INT32 __attribute__((nonnull(1), always_inline))
560INLINE INT32 ATTR_NONNULL ATTR_FORCE_INLINE
561561_atomic_exchange32(INT32 volatile *ptr, INT32 exchange)
562562{
563563   register INT32 result;
r1877r1878
580580-------------------------------------------------*/
581581
582582#define atomic_add32 _atomic_add32
583INLINE INT32 __attribute__((nonnull(1), always_inline))
583INLINE INT32 ATTR_NONNULL ATTR_FORCE_INLINE
584584_atomic_add32(INT32 volatile *ptr, INT32 delta)
585585{
586586   register INT32 result = delta;
r1877r1878
604604-------------------------------------------------*/
605605
606606#define atomic_increment32 _atomic_increment32
607INLINE INT32 __attribute__((nonnull(1), always_inline))
607INLINE INT32 ATTR_NONNULL ATTR_FORCE_INLINE
608608_atomic_increment32(INT32 volatile *ptr)
609609{
610610   register INT32 result = 1;
r1877r1878
628628-------------------------------------------------*/
629629
630630#define atomic_decrement32 _atomic_decrement32
631INLINE INT32 __attribute__((nonnull(1), always_inline))
631INLINE INT32 ATTR_NONNULL ATTR_FORCE_INLINE
632632_atomic_decrement32(INT32 volatile *ptr)
633633{
634634   register INT32 result = -1;
src/emu/video/cdp1869.c
r1877r1878
381381   }
382382}
383383
384static void cdp1869_draw_line(running_machine *machine, mame_bitmap *bitmap, int x, int y, int data, int color)
384static void cdp1869_draw_line(running_machine *machine, bitmap_t *bitmap, int x, int y, int data, int color)
385385{
386386   int i;
387387
r1877r1878
420420   }
421421}
422422
423static void cdp1869_draw_char(running_machine *machine, mame_bitmap *bitmap, int x, int y, UINT16 pramaddr, const rectangle *screenrect)
423static void cdp1869_draw_char(running_machine *machine, bitmap_t *bitmap, int x, int y, UINT16 pramaddr, const rectangle *screenrect)
424424{
425425   int i;
426426   UINT8 code = cdp1869_read_pageram(pramaddr);
src/emu/video/tms9928a.c
r1877r1878
100100/*
101101** Forward declarations of internal functions.
102102*/
103static void draw_mode0 (running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect);
104static void draw_mode1 (running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect);
105static void draw_mode2 (running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect);
106static void draw_mode12 (running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect);
107static void draw_mode3 (running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect);
108static void draw_mode23 (running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect);
109static void draw_modebogus (running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect);
110static void draw_sprites (running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect);
103static void draw_mode0 (running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
104static void draw_mode1 (running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
105static void draw_mode2 (running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
106static void draw_mode12 (running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
107static void draw_mode3 (running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
108static void draw_mode23 (running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
109static void draw_modebogus (running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
110static void draw_sprites (running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect);
111111static void change_register (int reg, UINT8 data);
112112
113static void (*const ModeHandlers[])(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) = {
113static void (*const ModeHandlers[])(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) = {
114114        draw_mode0, draw_mode1, draw_mode2,  draw_mode12,
115115        draw_mode3, draw_modebogus, draw_mode23,
116116        draw_modebogus };
r1877r1878
141141    void (*INTCallback)(int);
142142    /* memory */
143143    UINT8 *vMem, *dBackMem;
144    mame_bitmap *tmpbmp;
144    bitmap_t *tmpbmp;
145145    int vramsize, model;
146146    /* emulation settings */
147147    int LimitSprites; /* max 4 sprites on a row, like original TMS9918A */
r1877r1878
292292            tms.Addr = ((UINT16)data << 8 | tms.FirstByte) & (tms.vramsize - 1);
293293            if ( !(data & 0x40) ) {
294294            /* read ahead */
295            TMS9928A_vram_r   (0);
295            TMS9928A_vram_r   (machine,0);
296296            }
297297        }
298298        tms.latch = 0;
r1877r1878
442442    return b;
443443}
444444
445static void draw_mode1 (running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) {
445static void draw_mode1 (running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) {
446446    int pattern,x,y,yy,xx,name,charcode;
447447    UINT8 fg,bg,*patternptr;
448448   rectangle rt;
r1877r1878
475475    }
476476}
477477
478static void draw_mode12 (running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) {
478static void draw_mode12 (running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) {
479479    int pattern,x,y,yy,xx,name,charcode;
480480    UINT8 fg,bg,*patternptr;
481481   rectangle rt;
r1877r1878
508508    }
509509}
510510
511static void draw_mode0 (running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) {
511static void draw_mode0 (running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) {
512512    int pattern,x,y,yy,xx,name,charcode,colour;
513513    UINT8 fg,bg,*patternptr;
514514
r1877r1878
532532    }
533533}
534534
535static void draw_mode2 (running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) {
535static void draw_mode2 (running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) {
536536    int colour,name,x,y,yy,pattern,xx,charcode;
537537    UINT8 fg,bg;
538538    UINT8 *colourptr,*patternptr;
r1877r1878
560560    }
561561}
562562
563static void draw_mode3 (running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) {
563static void draw_mode3 (running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) {
564564    int x,y,yy,yyy,name,charcode;
565565    UINT8 fg,bg,*patternptr;
566566
r1877r1878
588588    }
589589}
590590
591static void draw_mode23 (running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) {
591static void draw_mode23 (running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) {
592592    int x,y,yy,yyy,name,charcode;
593593    UINT8 fg,bg,*patternptr;
594594
r1877r1878
617617    }
618618}
619619
620static void draw_modebogus (running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) {
620static void draw_modebogus (running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) {
621621    UINT8 fg,bg;
622622    int x,y,n,xx;
623623
r1877r1878
644644**
645645** This code should be optimized. One day.
646646*/
647static void draw_sprites (running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) {
647static void draw_sprites (running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) {
648648    UINT8 *attributeptr,*patternptr,c;
649649    int p,x,y,size,i,j,large,yy,xx,limit[192],
650650        illegalsprite,illegalspriteline;
src/emu/video/tms34061.c
r1877r1878
395395 *
396396 *************************************/
397397
398void tms34061_w(int col, int row, int func, UINT8 data)
398void tms34061_w(running_machine *machine, int col, int row, int func, UINT8 data)
399399{
400400   offs_t offs;
401401
r1877r1878
405405      /* both 0 and 2 map to register access */
406406      case 0:
407407      case 2:
408         register_w(col, data);
408         register_w(machine, col, data);
409409         break;
410410
411411      /* function 1 maps to XY access; col is the address adjustment */
412412      case 1:
413         xypixel_w(col, data);
413         xypixel_w(machine, col, data);
414414         break;
415415
416416      /* function 3 maps to direct access */
r1877r1878
454454}
455455
456456
457UINT8 tms34061_r(int col, int row, int func)
457UINT8 tms34061_r(running_machine *machine, int col, int row, int func)
458458{
459459   int result = 0;
460460   offs_t offs;
r1877r1878
465465      /* both 0 and 2 map to register access */
466466      case 0:
467467      case 2:
468         result = register_r(col);
468         result = register_r(machine, col);
469469         break;
470470
471471      /* function 1 maps to XY access; col is the address adjustment */
472472      case 1:
473         result = xypixel_r(col);
473         result = xypixel_r(machine, col);
474474         break;
475475
476476      /* funtion 3 maps to direct access */
src/emu/video/v9938.c
r1877r1878
7474static UINT8 v9938_command_unit_w (UINT8 Op);
7575static UINT8 v9938_vdp_to_cpu (void);
7676static void v9938_set_mode (void);
77static void v9938_refresh_line (mame_bitmap *bmp, int line);
77static void v9938_refresh_line (bitmap_t *bmp, int line);
7878
7979/***************************************************************************
8080
r1877r1878
386386         {
387387         vdp.address_latch =
388388            (((UINT16)data << 8) | vdp.cmd_write) & 0x3fff;
389         if ( !(data & 0x40) ) v9938_vram_r (0); /* read ahead! */
389         if ( !(data & 0x40) ) v9938_vram_r (machine,0); /* read ahead! */
390390         }
391391
392392      vdp.cmd_write_first = 0;
r1877r1878
10521052   vdp.mode = i;
10531053   }
10541054
1055static void v9938_refresh_16 (mame_bitmap *bmp, int line)
1055static void v9938_refresh_16 (bitmap_t *bmp, int line)
10561056   {
10571057   int i, double_lines;
10581058   UINT8 col[256];
r1877r1878
11111111      memcpy (ln2, ln, (512 + 32) * 2);
11121112   }
11131113
1114static void v9938_refresh_line (mame_bitmap *bmp, int line)
1114static void v9938_refresh_line (bitmap_t *bmp, int line)
11151115   {
11161116   int ind16, ind256;
11171117
src/emu/video/vector.c
r1877r1878
6969struct _vector_texture
7070{
7171   render_texture *   texture;
72   mame_bitmap *      bitmap;
72   bitmap_t *         bitmap;
7373};
7474
7575static vector_texture *vectortex[TEXTURE_INTENSITY_BUCKETS][TEXTURE_LENGTH_BUCKETS];
src/emu/video/voodoo.c
r1877r1878
456456 *
457457 *************************************/
458458
459int voodoo_update(int which, mame_bitmap *bitmap, const rectangle *cliprect)
459int voodoo_update(int which, bitmap_t *bitmap, const rectangle *cliprect)
460460{
461461   voodoo_state *v = voodoo[which];
462462   int changed = v->fbi.video_changed;
r1877r1878
17131713         mame_printf_debug("UNKNOWN PACKET TYPE %d\n", command & 7);
17141714         return 1;
17151715   }
1716   return 1;
17171716}
17181717
17191718
src/emu/video/tms34061.h
r1877r1878
5959void tms34061_start(running_machine *machine, const struct tms34061_interface *interface);
6060
6161/* reads/writes to the 34061 */
62UINT8 tms34061_r(int col, int row, int func);
63void tms34061_w(int col, int row, int func, UINT8 data);
62UINT8 tms34061_r(running_machine *machine, int col, int row, int func);
63void tms34061_w(running_machine *machine, int col, int row, int func, UINT8 data);
6464
6565/* latch settings */
6666READ8_HANDLER( tms34061_latch_r );
src/emu/video/voodoo.h
r1877r1878
1818};
1919
2020void voodoo_start(int which, int scrnum, int type, int fbmem_in_mb, int tmem0_in_mb, int tmem1_in_mb);
21int voodoo_update(int which, mame_bitmap *bitmap, const rectangle *cliprect);
21int voodoo_update(int which, bitmap_t *bitmap, const rectangle *cliprect);
2222void voodoo_reset(int which);
2323void voodoo_exit(int which);
2424int voodoo_get_type(int which);
src/emu/video/generic.c
r1877r1878
5959UINT8 *paletteram_2;   /* use when palette RAM is split in two parts */
6060UINT16 *paletteram16_2;
6161
62mame_bitmap *tmpbitmap;
62bitmap_t *tmpbitmap;
6363static int flip_screen_x, flip_screen_y;
6464
6565
src/emu/video/vooddefs.h
r1877r1878
16031603struct _raster_info
16041604{
16051605   struct _raster_info *next;         /* pointer to next entry with the same hash */
1606   poly_draw_scanline callback;      /* callback pointer */
1606   poly_draw_scanline_func callback;      /* callback pointer */
16071607   UINT8      is_generic;            /* TRUE if this is one of the generic rasterizers */
16081608   UINT8      display;            /* display index */
16091609   UINT32      hits;               /* how many hits (pixels) we've used this for */
src/emu/video/generic.h
r1877r1878
6262extern UINT8 *paletteram_2;   /* use when palette RAM is split in two parts */
6363extern UINT16 *paletteram16_2;
6464
65extern mame_bitmap *tmpbitmap;
65extern bitmap_t *tmpbitmap;
6666
6767
6868
src/emu/video/s2636.c
r1877r1878
105105   int y_offset;
106106   int x_offset;
107107
108   mame_bitmap *bitmap;
109   mame_bitmap *collision_bitmap;
108   bitmap_t *bitmap;
109   bitmap_t *collision_bitmap;
110110};
111111
112112
r1877r1878
143143 *************************************/
144144
145145static void draw_sprite(UINT8 *gfx, int color, int y, int x, int expand,
146                  int or_mode, mame_bitmap *bitmap, const rectangle *cliprect)
146                  int or_mode, bitmap_t *bitmap, const rectangle *cliprect)
147147{
148148   int sy;
149149
r1877r1878
264264 *
265265 *************************************/
266266
267mame_bitmap *s2636_update(s2636_t *s2636, const rectangle *cliprect)
267bitmap_t *s2636_update(s2636_t *s2636, const rectangle *cliprect)
268268{
269269   UINT8 collision = 0;
270270   int spriteno;
src/emu/video/poly.c
r1877r1878
139139   void *            extra;               /* extra data pointer */
140140   UINT8            numparams;            /* number of parameters for this polygon  */
141141   UINT8            numverts;            /* number of vertices in this polygon */
142   poly_draw_scanline    callback;            /* callback to handle a scanline's worth of work */
142   poly_draw_scanline_func    callback;            /* callback to handle a scanline's worth of work */
143143   INT32            xorigin;            /* X origin for all parameters */
144144   INT32            yorigin;            /* Y origin for all parameters */
145145   poly_param         param[MAX_VERTEX_PARAMS];/* array of parameter data */
r1877r1878
489489    triangle given 3 vertexes
490490-------------------------------------------------*/
491491
492UINT32 poly_render_triangle(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int paramcount, const poly_vertex *v1, const poly_vertex *v2, const poly_vertex *v3)
492UINT32 poly_render_triangle(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline_func callback, int paramcount, const poly_vertex *v1, const poly_vertex *v2, const poly_vertex *v3)
493493{
494494   float dxdy_v1v2, dxdy_v1v3, dxdy_v2v3;
495495   const poly_vertex *tv;
r1877r1878
672672    triangles in a fan
673673-------------------------------------------------*/
674674
675UINT32 poly_render_triangle_fan(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int paramcount, int numverts, const poly_vertex *v)
675UINT32 poly_render_triangle_fan(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline_func callback, int paramcount, int numverts, const poly_vertex *v)
676676{
677677   UINT32 pixels = 0;
678678   int vertnum;
r1877r1878
689689    render of an object, given specific extents
690690-------------------------------------------------*/
691691
692UINT32 poly_render_triangle_custom(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int startscanline, int numscanlines, const poly_extent *extents)
692UINT32 poly_render_triangle_custom(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline_func callback, int startscanline, int numscanlines, const poly_extent *extents)
693693{
694694   INT32 curscan, scaninc;
695695   polygon_info *polygon;
r1877r1878
796796    given 4 vertexes
797797-------------------------------------------------*/
798798
799UINT32 poly_render_quad(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int paramcount, const poly_vertex *v1, const poly_vertex *v2, const poly_vertex *v3, const poly_vertex *v4)
799UINT32 poly_render_quad(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline_func callback, int paramcount, const poly_vertex *v1, const poly_vertex *v2, const poly_vertex *v3, const poly_vertex *v4)
800800{
801801   poly_edge fedgelist[3], bedgelist[3];
802802   const poly_edge *ledge, *redge;
r1877r1878
10221022    quads in a fan
10231023-------------------------------------------------*/
10241024
1025UINT32 poly_render_quad_fan(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int paramcount, int numverts, const poly_vertex *v)
1025UINT32 poly_render_quad_fan(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline_func callback, int paramcount, int numverts, const poly_vertex *v)
10261026{
10271027   UINT32 pixels = 0;
10281028   int vertnum;
r1877r1878
10441044    to 32 vertices
10451045-------------------------------------------------*/
10461046
1047UINT32 poly_render_polygon(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int paramcount, int numverts, const poly_vertex *v)
1047UINT32 poly_render_polygon(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline_func callback, int paramcount, int numverts, const poly_vertex *v)
10481048{
10491049   poly_edge fedgelist[MAX_POLYGON_VERTS - 1], bedgelist[MAX_POLYGON_VERTS - 1];
10501050   const poly_edge *ledge, *redge;
src/emu/video/mc6845.c
r1877r1878
113113}
114114
115115
116void mc6845_address_w(mc6845_t *mc6845, UINT8 data)
116WRITE8_DEVICE_HANDLER( mc6845_address_w )
117117{
118   mc6845_t *mc6845 = device->token;
119
118120   assert(mc6845 != NULL);
119121
120122   mc6845->register_address_latch = data & 0x1f;
121123}
122124
123125
124UINT8 mc6845_status_r(mc6845_t *mc6845)
126READ8_DEVICE_HANDLER( mc6845_status_r )
125127{
128   mc6845_t *mc6845 = device->token;
126129   UINT8 ret = 0;
127130
128131   assert(mc6845 != NULL);
r1877r1878
140143}
141144
142145
143UINT8 mc6845_register_r(mc6845_t *mc6845)
146READ8_DEVICE_HANDLER( mc6845_register_r )
144147{
148   mc6845_t *mc6845 = device->token;
145149   UINT8 ret = 0;
146150
147151   assert(mc6845 != NULL);
r1877r1878
163167}
164168
165169
166void mc6845_register_w(mc6845_t *mc6845, UINT8 data)
170WRITE8_DEVICE_HANDLER( mc6845_register_w )
167171{
172   mc6845_t *mc6845 = device->token;
173
168174   assert(mc6845 != NULL);
169175
170176   if (LOG)  logerror("M6845 PC %04x: reg 0x%02x = 0x%02x\n", activecpu_get_pc(), mc6845->register_address_latch, data);
src/emu/video/tlc34076.c
r1877r1878
244244
245245READ16_HANDLER( tlc34076_lsb_r )
246246{
247   return tlc34076_r(offset);
247   return tlc34076_r(machine, offset);
248248}
249249
250250WRITE16_HANDLER( tlc34076_lsb_w )
251251{
252252   if (ACCESSING_LSB)
253      tlc34076_w(offset, data);
253      tlc34076_w(machine, offset, data);
254254}
255255
256256READ16_HANDLER( tlc34076_msb_r )
257257{
258   return tlc34076_r(offset) << 8;
258   return tlc34076_r(machine, offset) << 8;
259259}
260260
261261WRITE16_HANDLER( tlc34076_msb_w )
262262{
263263   if (ACCESSING_MSB)
264      tlc34076_w(offset, data >> 8);
264      tlc34076_w(machine, offset, data >> 8);
265265}
266266
src/emu/video/s2636.h
r1877r1878
1919/* returns a BITMAP_FORMAT_INDEXED16 bitmap the size of the screen
2020   D0-D2 of each pixel is the pixel color
2121   D3 indicates whether the S2636 drew this pixel - 0 = not drawn, 1 = drawn */
22mame_bitmap *s2636_update(s2636_t *s2636, const rectangle *cliprect);
22bitmap_t *s2636_update(s2636_t *s2636, const rectangle *cliprect);
2323
2424#endif
src/emu/video/poly.h
r1877r1878
9090
9191
9292/* callback routine to process a batch of scanlines in a triangle */
93typedef void (*poly_draw_scanline)(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid);
93typedef void (*poly_draw_scanline_func)(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid);
9494
9595
9696
r1877r1878
122122/* ----- core triangle rendering ----- */
123123
124124/* render a single triangle given 3 vertexes */
125UINT32 poly_render_triangle(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int paramcount, const poly_vertex *v1, const poly_vertex *v2, const poly_vertex *v3);
125UINT32 poly_render_triangle(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline_func callback, int paramcount, const poly_vertex *v1, const poly_vertex *v2, const poly_vertex *v3);
126126
127127/* render a set of triangles in a fan */
128UINT32 poly_render_triangle_fan(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int paramcount, int numverts, const poly_vertex *v);
128UINT32 poly_render_triangle_fan(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline_func callback, int paramcount, int numverts, const poly_vertex *v);
129129
130130/* perform a custom render of an object, given specific extents */
131UINT32 poly_render_triangle_custom(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int startscanline, int numscanlines, const poly_extent *extents);
131UINT32 poly_render_triangle_custom(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline_func callback, int startscanline, int numscanlines, const poly_extent *extents);
132132
133133
134134
135135/* ----- core quad rendering ----- */
136136
137137/* render a single quad given 4 vertexes */
138UINT32 poly_render_quad(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int paramcount, const poly_vertex *v1, const poly_vertex *v2, const poly_vertex *v3, const poly_vertex *v4);
138UINT32 poly_render_quad(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline_func callback, int paramcount, const poly_vertex *v1, const poly_vertex *v2, const poly_vertex *v3, const poly_vertex *v4);
139139
140140/* render a set of quads in a fan */
141UINT32 poly_render_quad_fan(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int paramcount, int numverts, const poly_vertex *v);
141UINT32 poly_render_quad_fan(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline_func callback, int paramcount, int numverts, const poly_vertex *v);
142142
143143
144144
145145/* ----- core polygon rendering ----- */
146146
147147/* render a single polygon up to 32 vertices */
148UINT32 poly_render_polygon(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int paramcount, int numverts, const poly_vertex *v);
148UINT32 poly_render_polygon(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline_func callback, int paramcount, int numverts, const poly_vertex *v);
149149
150150
151151
src/emu/video/mc6845.h
r1877r1878
8383DEVICE_GET_INFO( c6545_1 );
8484
8585/* select one of the registers for reading or writing */
86void mc6845_address_w(mc6845_t *mc6845, UINT8 data);
86WRITE8_DEVICE_HANDLER( mc6845_address_w );
8787
8888/* read from the status register */
89UINT8 mc6845_status_r(mc6845_t *mc6845);
89READ8_DEVICE_HANDLER( mc6845_status_r );
9090
9191/* read from the currently selected register */
92UINT8 mc6845_register_r(mc6845_t *mc6845);
92READ8_DEVICE_HANDLER( mc6845_register_r );
9393
9494/* write to the currently selected register */
95void mc6845_register_w(mc6845_t *mc6845, UINT8 data);
95WRITE8_DEVICE_HANDLER( mc6845_register_w );
9696
9797/* return the current value on the MA0-MA13 pins */
9898UINT16 mc6845_get_ma(mc6845_t *mc6845);
src/emu/info.c
r1877r1878
998998      "\t\t\t<!ATTLIST chip type (cpu|audio) #REQUIRED>\n"
999999      "\t\t\t<!ATTLIST chip clock CDATA #IMPLIED>\n"
10001000      "\t\t<!ELEMENT display EMPTY>\n"
1001      "\t\t\t<!ATTLIST display type (raster|vector) #REQUIRED>\n"
1001      "\t\t\t<!ATTLIST display type (raster|vector|lcd|unknown) #REQUIRED>\n"
10021002      "\t\t\t<!ATTLIST display rotate (0|90|180|270) #REQUIRED>\n"
10031003      "\t\t\t<!ATTLIST display flipx (yes|no) \"no\">\n"
10041004      "\t\t\t<!ATTLIST display width CDATA #IMPLIED>\n"
src/emu/tilemap.c
r1877r1878
4747
4848
4949/* internal blitting callbacks */
50typedef void (*blitmask_t)(void *dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, UINT8 *pri, UINT32 pcode);
51typedef void (*blitopaque_t)(void *dest, const UINT16 *source, int count, UINT8 *pri, UINT32 pcode);
50typedef void (*blitmask_func)(void *dest, const UINT16 *source, const UINT8 *maskptr, int mask, int value, int count, UINT8 *pri, UINT32 pcode);
51typedef void (*blitopaque_func)(void *dest, const UINT16 *source, int count, UINT8 *pri, UINT32 pcode);
5252
5353
5454/* blitting parameters for rendering */
5555typedef struct _blit_parameters blit_parameters;
5656struct _blit_parameters
5757{
58   mame_bitmap *      bitmap;
58   bitmap_t *         bitmap;
5959   rectangle         cliprect;
60   blitmask_t          draw_masked;
61   blitopaque_t       draw_opaque;
60   blitmask_func       draw_masked;
61   blitopaque_func      draw_opaque;
6262   UINT32             tilemap_priority_code;
6363   UINT8            mask;
6464   UINT8            value;
r1877r1878
7979   UINT32                  height;            /* height of the full tilemap in pixels */
8080
8181   /* logical <-> memory mappings */
82   tilemap_mapper_callback      mapper;            /* callback to map a row/column to a memory index */
82   tilemap_mapper_func      mapper;            /* callback to map a row/column to a memory index */
8383   tilemap_logical_index *      memory_to_logical;   /* map from memory index to logical index */
8484   tilemap_logical_index      max_logical_index;   /* maximum valid logical index */
8585   tilemap_memory_index *      logical_to_memory;   /* map from logical index to memory index */
8686   tilemap_memory_index      max_memory_index;   /* maximum valid memory index */
8787
8888   /* callback to interpret video RAM for the tilemap */
89   tile_get_info_callback      tile_get_info;      /* callback to get information about a tile */
89   tile_get_info_func      tile_get_info;      /* callback to get information about a tile */
9090   tile_data               tileinfo;         /* structure to hold the data for a tile */
9191   void *                  user_data;         /* user data value passed to the callback */
9292
r1877r1878
108108   INT32                  dy_flipped;         /* global vertical scroll offset when flipped */
109109
110110   /* pixel data */
111   mame_bitmap *            pixmap;            /* cached pixel data */
111   bitmap_t *               pixmap;            /* cached pixel data */
112112
113113   /* transparency mapping */
114   mame_bitmap *            flagsmap;         /* per-pixel flags */
114   bitmap_t *               flagsmap;         /* per-pixel flags */
115115   UINT8 *                  tileflags;         /* per-tile flags */
116116   UINT8 *                  pen_to_flags;       /* mapping of pens to flags */
117117};
r1877r1878
122122    GLOBAL VARIABLES
123123***************************************************************************/
124124
125mame_bitmap *         priority_bitmap;
125bitmap_t *            priority_bitmap;
126126
127127static tilemap *      tilemap_list;
128128static tilemap **      tilemap_tailptr;
r1877r1878
152152static UINT8 tile_apply_bitmask(tilemap *tmap, const UINT8 *maskdata, UINT32 x0, UINT32 y0, UINT8 category, UINT8 flags);
153153
154154/* drawing helpers */
155static void configure_blit_parameters(blit_parameters *blit, tilemap *tmap, mame_bitmap *dest, const rectangle *cliprect, UINT32 flags, UINT8 priority, UINT8 priority_mask);
155static void configure_blit_parameters(blit_parameters *blit, tilemap *tmap, bitmap_t *dest, const rectangle *cliprect, UINT32 flags, UINT8 priority, UINT8 priority_mask);
156156static void tilemap_draw_instance(tilemap *tmap, const blit_parameters *blit, int xpos, int ypos);
157157static void tilemap_draw_roz_core(tilemap *tmap, const blit_parameters *blit,
158158      UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, int wraparound);
r1877r1878
287287    tilemap_create - allocate a new tilemap
288288-------------------------------------------------*/
289289
290tilemap *tilemap_create(tile_get_info_callback tile_get_info, tilemap_mapper_callback mapper, int tilewidth, int tileheight, int cols, int rows)
290tilemap *tilemap_create(tile_get_info_func tile_get_info, tilemap_mapper_func mapper, int tilewidth, int tileheight, int cols, int rows)
291291{
292292   tilemap *tmap;
293293   int group;
r1877r1878
693693    (updated) internal pixmap for a tilemap
694694-------------------------------------------------*/
695695
696mame_bitmap *tilemap_get_pixmap(tilemap *tmap)
696bitmap_t *tilemap_get_pixmap(tilemap *tmap)
697697{
698698   /* ensure all the tiles are up-to-date and then return the pixmap */
699699   pixmap_update(tmap, NULL);
r1877r1878
706706    (updated) internal flagsmap for a tilemap
707707-------------------------------------------------*/
708708
709mame_bitmap *tilemap_get_flagsmap(tilemap *tmap)
709bitmap_t *tilemap_get_flagsmap(tilemap *tmap)
710710{
711711   /* ensure all the tiles are up-to-date and then return the pixmap */
712712   pixmap_update(tmap, NULL);
r1877r1878
738738    priority/priority_mask to the priority bitmap
739739-------------------------------------------------*/
740740
741void tilemap_draw_primask(mame_bitmap *dest, const rectangle *cliprect, tilemap *tmap, UINT32 flags, UINT8 priority, UINT8 priority_mask)
741void tilemap_draw_primask(bitmap_t *dest, const rectangle *cliprect, tilemap *tmap, UINT32 flags, UINT8 priority, UINT8 priority_mask)
742742{
743743   rectangle original_cliprect;
744744   blit_parameters blit;
r1877r1878
856856    priority_mask to the priority bitmap
857857-------------------------------------------------*/
858858
859void tilemap_draw_roz_primask(mame_bitmap *dest, const rectangle *cliprect, tilemap *tmap,
859void tilemap_draw_roz_primask(bitmap_t *dest, const rectangle *cliprect, tilemap *tmap,
860860      UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy,
861861      int wraparound, UINT32 flags, UINT8 priority, UINT8 priority_mask)
862862{
r1877r1878
933933    priority)
934934-------------------------------------------------*/
935935
936void tilemap_draw_by_index(mame_bitmap *dest, int number, UINT32 scrollx, UINT32 scrolly)
936void tilemap_draw_by_index(bitmap_t *dest, int number, UINT32 scrollx, UINT32 scrolly)
937937{
938938   tilemap *tmap = indexed_tilemap(number);
939939   blit_parameters blit;
r1877r1878
12661266static UINT8 tile_draw(tilemap *tmap, const UINT8 *pendata, UINT32 x0, UINT32 y0, UINT32 palette_base, UINT8 category, UINT8 group, UINT8 flags)
12671267{
12681268   const UINT8 *penmap = tmap->pen_to_flags + group * MAX_PEN_TO_FLAGS;
1269   mame_bitmap *flagsmap = tmap->flagsmap;
1270   mame_bitmap *pixmap = tmap->pixmap;
1269   bitmap_t *flagsmap = tmap->flagsmap;
1270   bitmap_t *pixmap = tmap->pixmap;
12711271   int height = tmap->tileheight;
12721272   int width = tmap->tilewidth;
12731273   UINT8 andmask = ~0, ormask = 0;
r1877r1878
13611361
13621362static UINT8 tile_apply_bitmask(tilemap *tmap, const UINT8 *maskdata, UINT32 x0, UINT32 y0, UINT8 category, UINT8 flags)
13631363{
1364   mame_bitmap *flagsmap = tmap->flagsmap;
1364   bitmap_t *flagsmap = tmap->flagsmap;
13651365   int height = tmap->tileheight;
13661366   int width = tmap->tilewidth;
13671367   UINT8 andmask = ~0, ormask = 0;
r1877r1878
14211421    and indexed drawing code
14221422-------------------------------------------------*/
14231423
1424static void configure_blit_parameters(blit_parameters *blit, tilemap *tmap, mame_bitmap *dest, const rectangle *cliprect, UINT32 flags, UINT8 priority, UINT8 priority_mask)
1424static void configure_blit_parameters(blit_parameters *blit, tilemap *tmap, bitmap_t *dest, const rectangle *cliprect, UINT32 flags, UINT8 priority, UINT8 priority_mask)
14251425{
14261426   /* start with nothing */
14271427   memset(blit, 0, sizeof(*blit));
r1877r1878
15061506
15071507static void tilemap_draw_instance(tilemap *tmap, const blit_parameters *blit, int xpos, int ypos)
15081508{
1509   mame_bitmap *dest = blit->bitmap;
1509   bitmap_t *dest = blit->bitmap;
15101510   const UINT16 *source_baseaddr;
15111511   const UINT8 *mask_baseaddr;
15121512   void *dest_baseaddr = NULL;
r1877r1878
16851685      UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, int wraparound)
16861686{
16871687   const pen_t *clut = &Machine->pens[blit->tilemap_priority_code >> 16];
1688   mame_bitmap *destbitmap = blit->bitmap;
1689   mame_bitmap *srcbitmap = tmap->pixmap;
1690   mame_bitmap *flagsmap = tmap->flagsmap;
1688   bitmap_t *destbitmap = blit->bitmap;
1689   bitmap_t *srcbitmap = tmap->pixmap;
1690   bitmap_t *flagsmap = tmap->flagsmap;
16911691   const int xmask = srcbitmap->width-1;
16921692   const int ymask = srcbitmap->height-1;
16931693   const int widthshifted = srcbitmap->width << 16;
src/emu/deprecat.h
r1877r1878
3434
3535/*************************************
3636 *
37 *  Video timing
37 *  Old way of allowing "VBLANK"
38 *  interrupts to fire more than once
39 *  a frame.
3840 *
39 *  These functions are no longer considered
40 *  to be the authority on scanline timing.
41 *  Please use the video_screen_* functions
42 *  in video.c for newer drivers.
41 *  These should be replaced with
42 *  scanline based interrupts as
43 *  it makes no sense to have more
44 *  than one VBLANK interrupt
45 *  per frame.
4346 *
4447 *************************************/
4548
46/* Returns the number of the video frame we are currently playing */
47int cpu_getcurrentframe(void);
49#define MDRV_CPU_VBLANK_INT_HACK(_func, _rate) \
50   TOKEN_UINT32_PACK2(MCONFIG_TOKEN_CPU_VBLANK_INT_HACK, 8, _rate, 24), \
51   TOKEN_PTR(interrupt, _func),
4852
4953
5054
src/emu/tilemap.h
r1877r1878
148148    6. In your VIDEO_UPDATE callback, render the tiles by calling
149149        tilemap_draw() or tilemap_draw_roz(). If you need to do custom
150150        rendering and want access to the raw pixels, call
151        tilemap_get_pixmap() to get a pointer to the updated mame_bitmap
151        tilemap_get_pixmap() to get a pointer to the updated bitmap_t
152152        containing the tilemap graphics.
153153
154154****************************************************************************
r1877r1878
366366/* Macros for setting tile attributes in the TILE_GET_INFO callback: */
367367/*   TILE_FLIP_YX assumes that flipy is in bit 1 and flipx is in bit 0 */
368368/*   TILE_FLIP_XY assumes that flipy is in bit 0 and flipx is in bit 1 */
369/*   TILE_GROUP shifts a split group number appropriately to OR into the tile flags */
370369#define TILE_FLIPYX(YX)               ((YX) & 3)
371370#define TILE_FLIPXY(XY)               ((((XY) & 2) >> 1) | (((XY) & 1) << 1))
372371
r1877r1878
397396
398397
399398/* callback function to get info about a tile */
400typedef void (*tile_get_info_callback)(running_machine *machine, tile_data *tileinfo, tilemap_memory_index tile_index, void *param);
399typedef void (*tile_get_info_func)(running_machine *machine, tile_data *tileinfo, tilemap_memory_index tile_index, void *param);
401400
402401/* callback function to map a column,row pair to a memory index */
403typedef tilemap_memory_index (*tilemap_mapper_callback)(UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
402typedef tilemap_memory_index (*tilemap_mapper_func)(UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
404403
405404
406405
r1877r1878
408407    GLOBAL VARIABLES
409408***************************************************************************/
410409
411extern mame_bitmap *priority_bitmap;
410extern bitmap_t *priority_bitmap;
412411
413412
414413
r1877r1878
427426/* ----- tilemap creation and configuration ----- */
428427
429428/* create a new tilemap; note that tilemaps are tracked by the core so there is no dispose */
430tilemap *tilemap_create(tile_get_info_callback tile_get_info, tilemap_mapper_callback mapper, int tilewidth, int tileheight, int cols, int rows);
429tilemap *tilemap_create(tile_get_info_func tile_get_info, tilemap_mapper_func mapper, int tilewidth, int tileheight, int cols, int rows);
431430
432431/* specify a parameter to be passed into the tile_get_info callback */
433432void tilemap_set_user_data(tilemap *tmap, void *user_data);
r1877r1878
495494/* ----- internal map access ----- */
496495
497496/* return a pointer to the (updated) internal pixmap for a tilemap */
498mame_bitmap *tilemap_get_pixmap(tilemap *tmap);
497bitmap_t *tilemap_get_pixmap(tilemap *tmap);
499498
500499/* return a pointer to the (updated) internal flagsmap for a tilemap */
501mame_bitmap *tilemap_get_flagsmap(tilemap *tmap);
500bitmap_t *tilemap_get_flagsmap(tilemap *tmap);
502501
503502/* return a pointer to the (updated) internal per-tile flags for a tilemap */
504503UINT8 *tilemap_get_tile_flags(tilemap *tmap);
r1877r1878
508507/* ----- tilemap rendering ----- */
509508
510509/* draw a tilemap to the destination with clipping; pixels apply priority/priority_mask to the priority bitmap */
511void tilemap_draw_primask(mame_bitmap *dest, const rectangle *cliprect, tilemap *tmap, UINT32 flags, UINT8 priority, UINT8 priority_mask);
510void tilemap_draw_primask(bitmap_t *dest, const rectangle *cliprect, tilemap *tmap, UINT32 flags, UINT8 priority, UINT8 priority_mask);
512511
513512/* draw a tilemap to the destination with clipping and arbitrary rotate/zoom; */
514513/* pixels apply priority/priority_mask to the priority bitmap */
515void tilemap_draw_roz_primask(mame_bitmap *dest, const rectangle *cliprect, tilemap *tmap,
514void tilemap_draw_roz_primask(bitmap_t *dest, const rectangle *cliprect, tilemap *tmap,
516515      UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy,
517516      int wraparound, UINT32 flags, UINT8 priority, UINT8 priority_mask);
518517
r1877r1878
527526void tilemap_size_by_index(int number, UINT32 *width, UINT32 *height);
528527
529528/* render an indexed tilemap with fixed characteristics (no priority) */
530void tilemap_draw_by_index(mame_bitmap *dest, int number, UINT32 scrollx, UINT32 scrolly);
529void tilemap_draw_by_index(bitmap_t *dest, int number, UINT32 scrollx, UINT32 scrolly);
531530
532531
533532
r1877r1878
584583    tilemap_draw_primask
585584-------------------------------------------------*/
586585
587INLINE void tilemap_draw(mame_bitmap *dest, const rectangle *cliprect, tilemap *tmap, UINT32 flags, UINT8 priority)
586INLINE void tilemap_draw(bitmap_t *dest, const rectangle *cliprect, tilemap *tmap, UINT32 flags, UINT8 priority)
588587{
589588   tilemap_draw_primask(dest, cliprect, tmap, flags, priority, 0xff);
590589}
r1877r1878
595594    tilemap_draw_roz_primask
596595-------------------------------------------------*/
597596
598INLINE void tilemap_draw_roz(mame_bitmap *dest, const rectangle *cliprect, tilemap *tmap,
597INLINE void tilemap_draw_roz(bitmap_t *dest, const rectangle *cliprect, tilemap *tmap,
599598      UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy,
600599      int wraparound, UINT32 flags, UINT8 priority)
601600{
src/emu/watchdog.c
r0r1878
1/***************************************************************************
2
3    watchdog.h
4
5    Watchdog handling
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#include "driver.h"
13
14
15
16
17/***************************************************************************
18    GLOBAL VARIABLES
19***************************************************************************/
20
21static UINT8 watchdog_enabled;
22static INT32 watchdog_counter;
23static emu_timer *watchdog_timer;
24
25
26
27/***************************************************************************
28    FUNCTION PROTOTYPES
29***************************************************************************/
30
31static void watchdog_internal_reset(running_machine *machine);
32static TIMER_CALLBACK( watchdog_callback );
33
34
35
36/*-------------------------------------------------
37    watchdog_init - one time initialization
38-------------------------------------------------*/
39
40void watchdog_init(running_machine *machine)
41{
42   /* allocate a timer for the watchdog */
43   watchdog_timer = timer_alloc(watchdog_callback, NULL);
44
45   add_reset_callback(machine, watchdog_internal_reset);
46
47   /* save some stuff in the default tag */
48   state_save_push_tag(0);
49   state_save_register_item("watchdog", 0, watchdog_enabled);
50   state_save_register_item("watchdog", 0, watchdog_counter);
51   state_save_pop_tag();
52}
53
54
55/*-------------------------------------------------
56    watchdog_internal_reset - reset the watchdog
57    system
58-------------------------------------------------*/
59
60static void watchdog_internal_reset(running_machine *machine)
61{
62   /* set up the watchdog timer; only start off enabled if explicitly configured */
63   watchdog_enabled = (machine->config->watchdog_vblank_count != 0 || attotime_compare(machine->config->watchdog_time, attotime_zero) != 0);
64   watchdog_reset(machine);
65   watchdog_enabled = TRUE;
66}
67
68
69/*-------------------------------------------------
70    watchdog_callback - watchdog timer callback
71-------------------------------------------------*/
72
73static TIMER_CALLBACK( watchdog_callback )
74{
75   logerror("Reset caused by the watchdog!!!\n");
76   popmessage("Reset caused by the watchdog!!!\n");
77   mame_schedule_soft_reset(machine);
78}
79
80
81/*-------------------------------------------------
82    on_vblank - updates VBLANK based watchdog
83    timers
84-------------------------------------------------*/
85
86static void on_vblank(running_machine *machine, screen_state *screen, int vblank_state)
87{
88   /* VBLANK starting */
89   if (vblank_state && watchdog_enabled)
90   {
91      /* check the watchdog */
92      if (machine->config->watchdog_vblank_count != 0 && --watchdog_counter == 0)
93         watchdog_callback(machine, NULL, 0);
94   }
95}
96
97
98/*-------------------------------------------------
99    watchdog_reset - reset the watchdog timer
100-------------------------------------------------*/
101
102void watchdog_reset(running_machine *machine)
103{
104   /* if we're not enabled, skip it */
105   if (!watchdog_enabled)
106      timer_adjust_oneshot(watchdog_timer, attotime_never, 0);
107
108   /* VBLANK-based watchdog? */
109   else if (machine->config->watchdog_vblank_count != 0)
110   {
111      watchdog_counter = machine->config->watchdog_vblank_count;
112
113      /* register a global VBLANK callback */
114      video_screen_register_vbl_cb(machine, NULL, on_vblank);
115   }
116
117   /* timer-based watchdog? */
118   else if (attotime_compare(machine->config->watchdog_time, attotime_zero) != 0)
119      timer_adjust_oneshot(watchdog_timer, machine->config->watchdog_time, 0);
120
121   /* default to an obscene amount of time (3 seconds) */
122   else
123      timer_adjust_oneshot(watchdog_timer, ATTOTIME_IN_SEC(3), 0);
124}
125
126
127/*-------------------------------------------------
128    watchdog_enable - reset the watchdog timer
129-------------------------------------------------*/
130
131void watchdog_enable(running_machine *machine, int enable)
132{
133   /* when re-enabled, we reset our state */
134   if (watchdog_enabled != enable)
135   {
136      watchdog_enabled = enable;
137      watchdog_reset(machine);
138   }
139}
src/emu/uimenu.c
r1877r1878
7676typedef struct _menu_state menu_state;
7777struct _menu_state
7878{
79   ui_menu_handler handler;         /* handler callback */
79   ui_menu_handler_func handler;         /* handler callback */
8080   UINT32         state;            /* state value */
8181};
8282
r1877r1878
125125
126126static dip_descriptor dip_switch_model[MAX_PHYSICAL_DIPS];
127127
128static mame_bitmap *hilight_bitmap;
128static bitmap_t *hilight_bitmap;
129129static render_texture *hilight_texture;
130130
131131static render_texture *arrow_texture;
r1877r1878
174174#endif /* MESS */
175175
176176/* menu helpers */
177static void menu_render_triangle(mame_bitmap *dest, const mame_bitmap *source, const rectangle *sbounds, void *param);
177static void menu_render_triangle(bitmap_t *dest, const bitmap_t *source, const rectangle *sbounds, void *param);
178178
179179static int input_menu_get_items(input_item_data *itemlist, int group);
180180static int input_menu_get_game_items(input_item_data *itemlist);
r1877r1878
658658    stack
659659-------------------------------------------------*/
660660
661UINT32 ui_menu_stack_push(ui_menu_handler new_handler, UINT32 new_state)
661UINT32 ui_menu_stack_push(ui_menu_handler_func new_handler, UINT32 new_state)
662662{
663663   menu_state *state = &menu_stack[++menu_stack_index];
664664   assert(menu_stack_index < MENU_STACK_DEPTH);
r1877r1878
17561756    indicators
17571757-------------------------------------------------*/
17581758
1759static void menu_render_triangle(mame_bitmap *dest, const mame_bitmap *source, const rectangle *sbounds, void *param)
1759static void menu_render_triangle(bitmap_t *dest, const bitmap_t *source, const rectangle *sbounds, void *param)
17601760{
17611761   int halfwidth = dest->width / 2;
17621762   int height = dest->height;
r1877r1878
18871887      const char *name = input_port_name(in);
18881888
18891889      /* add if we match the group and we have a valid name */
1890      if (name != NULL &&
1890      if ((name != NULL) && (input_port_condition(in)) &&
18911891#ifdef MESS
18921892         (in->category == 0 || input_category_active(in->category)) &&
18931893#endif /* MESS */
src/emu/watchdog.h
r0r1878
1/***************************************************************************
2
3    watchdog.h
4
5    Watchdog handling
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#pragma once
13
14#ifndef __WATCHDOG_H__
15#define __WATCHDOG_H__
16
17
18/* startup */
19void watchdog_init(running_machine *machine);
20
21/* reset the watchdog */
22void watchdog_reset(running_machine *machine);
23
24/* enable/disable the watchdog */
25void watchdog_enable(running_machine *machine, int enable);
26
27
28#endif   /* __WATCHDOG_H__ */
src/emu/video.c
r1877r1878
99
1010***************************************************************************/
1111
12#include "osdepend.h"
1312#include "driver.h"
13#include "deprecat.h"
1414#include "profiler.h"
1515#include "png.h"
1616#include "debugger.h"
17#include "render.h"
1817#include "rendutil.h"
1918#include "ui.h"
20#include "deprecat.h"
21#include "video/vector.h"
2219
2320#include "snap.lh"
2421
r1877r1878
3936***************************************************************************/
4037
4138#define SUBSECONDS_PER_SPEED_UPDATE   (ATTOSECONDS_PER_SECOND / 4)
42#define PAUSED_REFRESH_RATE         30
39#define PAUSED_REFRESH_RATE         (30)
40#define MAX_VBL_CB               (10)
4341
4442
4543
r1877r1878
5149struct _internal_screen_info
5250{
5351   /* pointers to screen configuration and state */
54   const screen_config *   config;            /* pointer to the configuration in the Machine->config */
55   screen_state *         state;            /* pointer to visible state in Machine structure */
52   int                  scrnum;               /* the screen index */
53   const screen_config *   config;               /* pointer to the configuration in the Machine->config */
54   screen_state *         state;               /* pointer to visible state in Machine structure */
5655
5756   /* textures and bitmaps */
58   render_texture *      texture[2];         /* 2x textures for the screen bitmap */
59   mame_bitmap *         bitmap[2];         /* 2x bitmaps for rendering */
60   UINT8               curbitmap;         /* current bitmap index */
61   UINT8               curtexture;         /* current texture index */
62   bitmap_format         format;            /* format of bitmap for this screen */
63   UINT8               changed;         /* has this bitmap changed? */
64   INT32               last_partial_scan;   /* scanline of last partial update */
57   render_texture *      texture[2];            /* 2x textures for the screen bitmap */
58   bitmap_t *            bitmap[2];            /* 2x bitmaps for rendering */
59   UINT8               curbitmap;            /* current bitmap index */
60   UINT8               curtexture;            /* current texture index */
61   bitmap_format         format;               /* format of bitmap for this screen */
62   UINT8               changed;            /* has this bitmap changed? */
63   INT32               last_partial_scan;      /* scanline of last partial update */
64   UINT8               vblank_state;         /* 1 = in VBLANK region, 0 = outside */
6565
6666   /* screen timing */
67   attoseconds_t         scantime;         /* attoseconds per scanline */
68   attoseconds_t         pixeltime;         /* attoseconds per pixel */
69   attotime             vblank_time;      /* time of last VBLANK start */
70   emu_timer *            scanline0_timer;   /* scanline 0 timer */
71   emu_timer *            scanline_timer;      /* scanline timer */
67   attoseconds_t         scantime;            /* attoseconds per scanline */
68   attoseconds_t         pixeltime;            /* attoseconds per pixel */
69   attotime             vblank_time;         /* time of last VBLANK start */
70   emu_timer *            vblank_begin_timer;      /* timer to signal VBLANK start */
71   emu_timer *            vblank_end_timer;      /* timer to signal VBLANK end */
72   emu_timer *            scanline0_timer;      /* scanline 0 timer */
73   emu_timer *            scanline_timer;         /* scanline timer */
74   UINT64               frame_number;         /* the current frame number */
7275
76   /* VBLANK callbacks */
77   int vbl_cb_count;                        /* # of callbacks installed */
78   vblank_state_changed_func      vbl_cbs[MAX_VBL_CB];   /* the array of callbacks */
79
7380   /* movie recording */
74   mame_file *            movie_file;         /* handle to the open movie file */
75   UINT32                movie_frame;      /* current movie frame number */
81   mame_file *            movie_file;            /* handle to the open movie file */
82   UINT32                movie_frame;         /* current movie frame number */
7683};
7784
7885
7986struct _video_private
8087{
8188   /* per-screen information */
82   internal_screen_info   scrinfo[MAX_SCREENS]; /* per-screen infomration */
89   internal_screen_info   scrinfo[MAX_SCREENS]; /* per-screen information */
8390
8491   /* snapshot stuff */
8592   render_target *         snap_target;      /* screen shapshot target */
86   mame_bitmap *         snap_bitmap;      /* screen snapshot bitmap */
93   bitmap_t *            snap_bitmap;      /* screen snapshot bitmap */
8794
8895   /* crosshair bits */
89   mame_bitmap *         crosshair_bitmap[MAX_PLAYERS]; /* crosshair bitmap per player */
96   bitmap_t *            crosshair_bitmap[MAX_PLAYERS]; /* crosshair bitmap per player */
9097   render_texture *      crosshair_texture[MAX_PLAYERS]; /* crosshair texture per player */
9198   UINT8                crosshair_animate;   /* animation frame index */
9299   UINT8                crosshair_visible;   /* crosshair visible mask */
r1877r1878
177184static void decode_graphics(running_machine *machine, const gfx_decode_entry *gfxdecodeinfo);
178185
179186/* global rendering */
187static TIMER_CALLBACK( vblank_begin_callback );
188static TIMER_CALLBACK( vblank_end_callback );
180189static TIMER_CALLBACK( scanline0_callback );
181190static TIMER_CALLBACK( scanline_update_callback );
182191static int finish_screen_updates(running_machine *machine);
r1877r1878
188197static void recompute_speed(attotime emutime);
189198
190199/* screen snapshots */
191static mame_bitmap *get_snapshot_bitmap(running_machine *machine, int scrnum);
200static bitmap_t *get_snapshot_bitmap(running_machine *machine, int scrnum);
192201static file_error mame_fopen_next(const char *pathoption, const char *extension, mame_file **file);
193202
194203/* movie recording */
r1877r1878
306315      render_container *container = render_container_get_screen(scrnum);
307316      internal_screen_info *info = &viddata->scrinfo[scrnum];
308317
318      /* allocate the VBLANK timers */
319      info->vblank_begin_timer = timer_alloc(vblank_begin_callback, info);
320      info->vblank_end_timer = timer_alloc(vblank_end_callback, info);
321
309322      /* allocate a timer to reset partial updates */
310323      info->scanline0_timer = timer_alloc(scanline0_callback, NULL);
311324
312325      /* make pointers back to the config and state */
326      info->scrnum = scrnum;
313327      info->config = device->inline_config;
314328      info->state = &machine->screen[scrnum];
315329
r1877r1878
327341         render_container_set_yscale(container, info->config->yscale);
328342
329343      /* reset VBLANK timing */
330      info->vblank_time = attotime_sub_attoseconds(attotime_zero, machine->screen[0].vblank);
344      info->vblank_time = attotime_zero;
331345
332346      /* allocate a timer to generate per-scanline updates */
333347      if (machine->config->video_attributes & VIDEO_UPDATE_SCANLINE)
r1877r1878
339353      /* register for save states */
340354      state_save_register_item("video", scrnum, info->vblank_time.seconds);
341355      state_save_register_item("video", scrnum, info->vblank_time.attoseconds);
356      state_save_register_item("video", scrnum, info->frame_number);
342357   }
343358
344359   /* create spriteram buffers if necessary */
r1877r1878
435450
436451
437452/*-------------------------------------------------
438    video_vblank_start - called at the start of
439    VBLANK, which is driven by the CPU scheduler
440-------------------------------------------------*/
441
442void video_vblank_start(running_machine *machine)
443{
444   video_private *viddata = machine->video_data;
445   attotime curtime = timer_get_time();
446   int scrnum;
447
448   /* kludge: we get called at time 0 to reset, but at that point,
449       the time of last VBLANK is actually -vblank_duration */
450   if (curtime.seconds == 0 && curtime.attoseconds == 0)
451      curtime = attotime_sub_attoseconds(attotime_zero, machine->screen[0].vblank);
452
453   /* reset VBLANK timers for each screen -- fix me */
454   for (scrnum = 0; scrnum < MAX_SCREENS; scrnum++)
455      viddata->scrinfo[scrnum].vblank_time = curtime;
456}
457
458
459/*-------------------------------------------------
460453    init_buffered_spriteram - initialize the
461454    double-buffered spriteram
462455-------------------------------------------------*/
r1877r1878
766759      }
767760   }
768761
769   /* recompute the VBLANK timing */
770   {
771      extern void cpu_compute_vblank_timing(running_machine *machine);
772      cpu_compute_vblank_timing(Machine);
773   }
774
775762   /* if we are on scanline 0 already, reset the update timer immediately */
776763   /* otherwise, defer until the next scanline 0 */
777764   if (video_screen_get_vpos(scrnum) == 0)
778765      timer_adjust_oneshot(info->scanline0_timer, attotime_zero, scrnum);
779766   else
780767      timer_adjust_oneshot(info->scanline0_timer, video_screen_get_time_until_pos(scrnum, 0, 0), scrnum);
768
769   /* start the VBLANK timer */
770   timer_adjust_oneshot(info->vblank_begin_timer, video_screen_get_time_until_vblank_start(scrnum), 0);
781771}
782772
783773
r1877r1878
974964int video_screen_get_vblank(int scrnum)
975965{
976966   internal_screen_info *info = get_screen_info(Machine, scrnum);
977   int vpos = video_screen_get_vpos(scrnum);
978   return (vpos < info->state->visarea.min_y || vpos > info->state->visarea.max_y);
967   return info->vblank_state;
979968}
980969
981970
r1877r1878
10231012
10241013
10251014/*-------------------------------------------------
1015    video_screen_get_time_until_vblank_start -
1016    returns the amount of time remaining until
1017    the next VBLANK period start
1018-------------------------------------------------*/
1019
1020attotime video_screen_get_time_until_vblank_start(int scrnum)
1021{
1022   return video_screen_get_time_until_pos(scrnum, Machine->screen[scrnum].visarea.max_y + 1, 0);
1023}
1024
1025
1026/*-------------------------------------------------
1027    video_screen_get_time_until_vblank_end -
1028    returns the amount of time remaining until
1029    the end of the current VBLANK (if in progress)
1030    or the end of the next VBLANK
1031-------------------------------------------------*/
1032
1033attotime video_screen_get_time_until_vblank_end(int scrnum)
1034{
1035   return video_screen_get_time_until_pos(scrnum, Machine->screen[scrnum].visarea.min_y, 0);
1036}
1037
1038
1039/*-------------------------------------------------
1040    video_screen_get_time_until_update -
1041    returns the amount of time remaining until
1042    the next VBLANK period start
1043-------------------------------------------------*/
1044
1045attotime video_screen_get_time_until_update(int scrnum)
1046{
1047   if (Machine->config->video_attributes & VIDEO_UPDATE_AFTER_VBLANK)
1048      return video_screen_get_time_until_vblank_end(scrnum);
1049   else
1050      return video_screen_get_time_until_vblank_start(scrnum);
1051}
1052
1053
1054/*-------------------------------------------------
10261055    video_screen_get_scan_period - return the
10271056    amount of time the beam takes to draw one
10281057    scanline
r1877r1878
10471076}
10481077
10491078
1079/*-------------------------------------------------
1080    video_screen_get_frame_number - return the
1081    current frame number since the start of the
1082    emulated machine
1083-------------------------------------------------*/
10501084
1085UINT64 video_screen_get_frame_number(int scrnum)
1086{
1087   internal_screen_info *info = get_screen_info(Machine, scrnum);
1088   return info->frame_number;
1089}
1090
1091
1092/*-------------------------------------------------
1093    video_screen_register_vbl_cb - registers a
1094    VBLANK callback
1095-------------------------------------------------*/
1096
1097void video_screen_register_vbl_cb(running_machine *machine, void *screen, vblank_state_changed_func vbl_cb)
1098{
1099   int i, found;
1100   internal_screen_info *scrinfo = NULL;
1101
1102   /* validate arguments */
1103   assert(machine != NULL);
1104   assert(machine->config != NULL);
1105   assert(machine->config->devicelist != NULL);
1106   assert(machine->video_data != NULL);
1107   assert(machine->video_data->scrinfo != NULL);
1108   assert(vbl_cb != NULL);
1109
1110   /* if the screen is NULL, grab the first screen -- we are installing a "global" handler */
1111   if (screen == NULL)
1112   {
1113      if (video_screen_count(machine->config) > 0)
1114      {
1115         const char *screen_tag = video_screen_first(machine->config)->tag;
1116         screen = devtag_get_token(machine, VIDEO_SCREEN, screen_tag);
1117      }
1118      else
1119      {
1120         /* we need to do something for screenless games */
1121         assert(screen != NULL);
1122      }
1123   }
1124
1125   /* find the screen info structure for the given token - there should only be one */
1126   for (i = 0; i < MAX_SCREENS; i++)
1127      if (machine->video_data->scrinfo[i].state == screen)
1128         scrinfo = machine->video_data->scrinfo + i;
1129
1130   /* make sure we still have room for the callback */
1131   assert(scrinfo != NULL);
1132   assert(scrinfo->vbl_cb_count != MAX_VBL_CB);
1133
1134   /* check if we already have this callback registered */
1135   found = FALSE;
1136   for (i = 0; i < scrinfo->vbl_cb_count; i++)
1137      if (scrinfo->vbl_cbs[i] == vbl_cb)
1138         found = TRUE;
1139
1140   /* if not found, register and increment count */
1141   if (!found)
1142   {
1143      scrinfo->vbl_cbs[scrinfo->vbl_cb_count] = vbl_cb;
1144      scrinfo->vbl_cb_count++;
1145   }
1146}
1147
1148
1149
10511150/***************************************************************************
10521151    VIDEO SCREEN DEVICE INTERFACE
10531152***************************************************************************/
r1877r1878
10571156    for a video screen
10581157-------------------------------------------------*/
10591158
1060static void *video_screen_start(running_machine *machine, const char *tag, const void *static_config, const void *inline_config)
1159static DEVICE_START( video_screen )
10611160{
10621161   int scrindex = device_list_index(machine->config->devicelist, VIDEO_SCREEN, tag);
10631162   return &machine->screen[scrindex];
r1877r1878
10691168    callback
10701169-------------------------------------------------*/
10711170
1072static void video_screen_set_info(running_machine *machine, void *token, UINT32 state, const deviceinfo *info)
1171static DEVICE_SET_INFO( video_screen )
10731172{
10741173   switch (state)
10751174   {
r1877r1878
10831182    callback
10841183-------------------------------------------------*/
10851184
1086void video_screen_get_info(running_machine *machine, void *token, UINT32 state, deviceinfo *info)
1185DEVICE_GET_INFO( video_screen )
10871186{
10881187   switch (state)
10891188   {
10901189      /* --- the following bits of info are returned as 64-bit signed integers --- */
1091      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = sizeof(screen_config);      break;
1190      case DEVINFO_INT_INLINE_CONFIG_BYTES:   info->i = sizeof(screen_config);      break;
1191      case DEVINFO_INT_CLASS:               info->i = DEVICE_CLASS_VIDEO;         break;
10921192
10931193      /* --- the following bits of info are returned as pointers to data or functions --- */
1094      case DEVINFO_FCT_SET_INFO:                  info->set_info = video_screen_set_info;break;
1095      case DEVINFO_FCT_START:                     info->start = video_screen_start;      break;
1096      case DEVINFO_FCT_STOP:                     /* Nothing */                     break;
1097      case DEVINFO_FCT_RESET:                     /* Nothing */                     break;
1194      case DEVINFO_FCT_SET_INFO:            info->set_info = DEVICE_SET_INFO_NAME(video_screen); break;
1195      case DEVINFO_FCT_START:               info->start = DEVICE_START_NAME(video_screen); break;
1196      case DEVINFO_FCT_STOP:               /* Nothing */                     break;
1197      case DEVINFO_FCT_RESET:               /* Nothing */                     break;
10981198
10991199      /* --- the following bits of info are returned as NULL-terminated strings --- */
1100      case DEVINFO_STR_NAME:                     info->s = "Raster";                  break;
1101      case DEVINFO_STR_FAMILY:                  info->s = "Video Screen";            break;
1102      case DEVINFO_STR_VERSION:                  info->s = "1.0";                  break;
1103      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                  break;
1104      case DEVINFO_STR_CREDITS:                  info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
1200      case DEVINFO_STR_NAME:               info->s = "Raster";                  break;
1201      case DEVINFO_STR_FAMILY:            info->s = "Video Screen";            break;
1202      case DEVINFO_STR_VERSION:            info->s = "1.0";                  break;
1203      case DEVINFO_STR_SOURCE_FILE:         info->s = __FILE__;                  break;
1204      case DEVINFO_STR_CREDITS:            info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
11051205   }
11061206}
11071207
r1877r1878
11121212***************************************************************************/
11131213
11141214/*-------------------------------------------------
1215    call_vb_callbacks - call any external VBLANK
1216    callsbacks with the given state
1217-------------------------------------------------*/
1218
1219static void call_vb_callbacks(running_machine *machine, internal_screen_info *scrinfo, int vblank_state)
1220{
1221   int i;
1222
1223   /* set it in the state structure */
1224   scrinfo->vblank_state = vblank_state;
1225
1226   for (i = 0; i < scrinfo->vbl_cb_count; i++)
1227      scrinfo->vbl_cbs[i](machine, scrinfo->state, vblank_state);
1228}
1229
1230
1231/*-------------------------------------------------
1232    vblank_begin_callback - call any external
1233    callbacks to signal the VBLANK period has begun
1234-------------------------------------------------*/
1235
1236static TIMER_CALLBACK( vblank_begin_callback )
1237{
1238   attoseconds_t vblank_period;
1239   internal_screen_info *scrinfo = ptr;
1240
1241   /* reset the starting VBLANK time */
1242   scrinfo->vblank_time = timer_get_time();
1243
1244   /* call the external callbacks */
1245   call_vb_callbacks(machine, scrinfo, TRUE);
1246
1247   /* do we update the screen now? - only do it for the first screen */
1248   if (!(machine->config->video_attributes & VIDEO_UPDATE_AFTER_VBLANK) && (scrinfo->scrnum == 0))
1249      video_frame_update(machine, FALSE);
1250
1251   /* if there has been no VBLANK time specified in the MACHINE_DRIVER, compute it now
1252       from the visible area, otherwise just used the supplied value */
1253   if ((scrinfo->state->vblank == 0) && !scrinfo->state->oldstyle_vblank_supplied)
1254      vblank_period = (scrinfo->state->refresh / scrinfo->state->height) * (scrinfo->state->height - (scrinfo->state->visarea.max_y + 1 - scrinfo->state->visarea.min_y));
1255   else
1256      vblank_period = scrinfo->state->vblank;
1257
1258   /* reset the timers */
1259   timer_adjust_oneshot(scrinfo->vblank_begin_timer, attotime_make(0, scrinfo->state->refresh), 0);
1260   timer_adjust_oneshot(scrinfo->vblank_end_timer, attotime_make(0, vblank_period), 0);
1261}
1262
1263
1264/*-------------------------------------------------
1265    vblank_end_callback - call any external
1266    callbacks to signal the VBLANK period has ended
1267-------------------------------------------------*/
1268
1269static TIMER_CALLBACK( vblank_end_callback )
1270{
1271   internal_screen_info *scrinfo = ptr;
1272
1273   /* update the first screen if we didn't before */
1274   if ((machine->config->video_attributes & VIDEO_UPDATE_AFTER_VBLANK) && (scrinfo->scrnum == 0))
1275      video_frame_update(machine, FALSE);
1276
1277   /* let any external parties know that the VBLANK is over */
1278   call_vb_callbacks(machine, scrinfo, FALSE);
1279
1280   /* increment the frame number counter */
1281   scrinfo->frame_number++;
1282}
1283
1284
1285/*-------------------------------------------------
11151286    scanline0_callback - reset partial updates
11161287    for a screen
11171288-------------------------------------------------*/
r1877r1878
12561427            /* if we're not skipping the frame and if the screen actually changed, then update the texture */
12571428            if (!global.skipping_this_frame && screen->changed)
12581429            {
1259               mame_bitmap *bitmap = screen->bitmap[screen->curbitmap];
1430               bitmap_t *bitmap = screen->bitmap[screen->curbitmap];
12601431               rectangle fixedvis = machine->screen[scrnum].visarea;
12611432               fixedvis.max_x++;
12621433               fixedvis.max_y++;
r1877r1878
18031974{
18041975   const rgb_t *palette = (machine->palette != NULL) ? palette_entry_list_adjusted(machine->palette) : NULL;
18051976   png_info pnginfo = { 0 };
1806   mame_bitmap *bitmap;
1977   bitmap_t *bitmap;
18071978   png_error error;
18081979   char text[256];
18091980
r1877r1878
18572028    given screen number
18582029-------------------------------------------------*/
18592030
1860static mame_bitmap *get_snapshot_bitmap(running_machine *machine, int scrnum)
2031static bitmap_t *get_snapshot_bitmap(running_machine *machine, int scrnum)
18612032{
18622033   video_private *viddata = machine->video_data;
18632034   const render_primitive_list *primlist;
r1877r1878
20082179   if (info->movie_file != NULL)
20092180   {
20102181      png_info pnginfo = { 0 };
2011      mame_bitmap *bitmap;
2182      bitmap_t *bitmap;
20122183      png_error error;
20132184
20142185      profiler_mark(PROFILER_MOVIE_REC);
src/emu/uimenu.h
r1877r1878
3232    TYPE DEFINITIONS
3333***************************************************************************/
3434
35typedef UINT32 (*ui_menu_handler)(UINT32 state);
35typedef UINT32 (*ui_menu_handler_func)(UINT32 state);
3636
3737typedef struct _ui_menu_item ui_menu_item;
3838struct _ui_menu_item
r1877r1878
7373
7474/* menu stack management */
7575void ui_menu_stack_reset(void);
76UINT32 ui_menu_stack_push(ui_menu_handler new_handler, UINT32 new_state);
76UINT32 ui_menu_stack_push(ui_menu_handler_func new_handler, UINT32 new_state);
7777UINT32 ui_menu_stack_pop(void);
7878
7979/* force game select menu */
src/emu/memory.c
r1877r1878
3434        ending with 'end' inclusive. An address hits in this bucket if the
3535        'address' >= 'start' and 'address' <= 'end'.
3636
37    AM_SPACE(match, mask)
38        Specifies at the bit level (closer to real hardware) how to determine
39        if an address matches a given bit pattern. An address hits in this
40        bucket if 'address' & 'mask' == 'match'
41
4237    AM_MASK(mask)
4338        Specifies a mask for the addresses in the current bucket. This mask
4439        is applied after a positive hit in the bucket specified by AM_RANGE
4540        or AM_SPACE, and is computed before accessing the RAM or calling
46        through to the read/write handler. If you use AM_SPACE, the mask
47        is implicitly set equal to the logical NOT of the mask specified in
48        the AM_SPACE macro. If you use AM_MIRROR, below, the mask is ANDed
49        implicitly with the logical NOT of the mirror. The mask specified
50        by this macro is ANDed against any implicit masks.
41        through to the read/write handler. If you use AM_MIRROR, below, the
42        mask is ANDed implicitly with the logical NOT of the mirror. The
43        mask specified by this macro is ANDed against any implicit masks.
5144
5245    AM_MIRROR(mirror)
5346        Specifies mirror addresses for the given bucket. The current bucket
r1877r1878
171164   UINT8               cpunum;               /* which CPU are we associated with? */
172165   UINT8               spacenum;            /* which address space are we associated with? */
173166   UINT8               isallocated;         /* did we allocate this ourselves? */
174   offs_t                start, end;            /* start/end or match/mask for verifying a match */
167   offs_t                start, end;            /* start/end for verifying a match */
175168    UINT8 *               data;               /* pointer to the data for this block */
176169};
177170
r1877r1878
206199   offs_t               offset;               /* base offset for handler */
207200   offs_t               top;               /* maximum offset for handler */
208201   offs_t               mask;               /* mask against the final address */
202   void *               object;               /* object associated with the handler */
209203   const char *         name;               /* name of the handler */
210204};
211205
r1877r1878
247241typedef struct _cpu_data cpu_data;
248242struct _cpu_data
249243{
250   opbase_handler          opbase;               /* opcode base handler */
244   opbase_handler_func          opbase;               /* opcode base handler */
251245
252246   void *               op_ram;               /* dynamic RAM base pointer */
253247   void *               op_rom;               /* dynamic ROM base pointer */
r1877r1878
283277
284278static int               cur_context;               /* current CPU context */
285279
286static opbase_handler      opbasefunc;                  /* opcode base override */
280static opbase_handler_func      opbasefunc;                  /* opcode base override */
287281
288282static int               debugger_access;            /* treat accesses as coming from the debugger */
289283static int               log_unmap[ADDRESS_SPACES];      /* log unmapped memory accesses */
r1877r1878
292286static bank_data          bankdata[STATIC_COUNT];         /* data gathered for each bank */
293287
294288#ifdef ENABLE_DEBUGGER
295static debug_hook_read_ptr   debug_hook_read;            /* pointer to debugger callback for memory reads */
296static debug_hook_write_ptr   debug_hook_write;            /* pointer to debugger callback for memory writes */
289static debug_hook_read_func   debug_hook_read;            /* pointer to debugger callback for memory reads */
290static debug_hook_write_func   debug_hook_write;            /* pointer to debugger callback for memory writes */
297291#endif
298292
299293static const data_accessors memory_accessors[ADDRESS_SPACES][4][2] =
r1877r1878
381375static void init_addrspace(UINT8 cpunum, UINT8 spacenum);
382376static void preflight_memory(void);
383377static void populate_memory(void);
384static void install_mem_handler_private(addrspace_data *space, int iswrite, int databits, int ismatchmask, offs_t start, offs_t end, offs_t mask, offs_t mirror, genf *handler, int isfixed, const char *handler_name);
385static void install_mem_handler(addrspace_data *space, int iswrite, int databits, int ismatchmask, offs_t start, offs_t end, offs_t mask, offs_t mirror, genf *handler, int isfixed, const char *handler_name);
378static void install_mem_handler_private(addrspace_data *space, int iswrite, int databits, offs_t start, offs_t end, offs_t mask, offs_t mirror, genf *handler, int isfixed, void *object, const char *handler_name);
379static void install_mem_handler(addrspace_data *space, int iswrite, int databits, offs_t start, offs_t end, offs_t mask, offs_t mirror, genf *handler, int isfixed, void *object, const char *handler_name);
386380static genf *assign_dynamic_bank(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mirror, int isfixed, int ismasked);
387static UINT8 get_handler_index(handler_data *table, genf *handler, const char *handler_name, offs_t start, offs_t end, offs_t mask);
381static UINT8 get_handler_index(handler_data *table, void *object, genf *handler, const char *handler_name, offs_t start, offs_t end, offs_t mask);
388382static void populate_table_range(addrspace_data *space, int iswrite, offs_t start, offs_t stop, UINT8 handler);
389static void populate_table_match(addrspace_data *space, int iswrite, offs_t matchval, offs_t matchmask, UINT8 handler);
390383static UINT8 allocate_subtable(table_data *tabledata);
391384static void reallocate_subtable(table_data *tabledata, UINT8 subentry);
392385static int merge_subtables(table_data *tabledata);
r1877r1878
568561    memory base
569562-------------------------------------------------*/
570563
571opbase_handler memory_set_opbase_handler(int cpunum, opbase_handler function)
564opbase_handler_func memory_set_opbase_handler(int cpunum, opbase_handler_func function)
572565{
573   opbase_handler old = cpudata[cpunum].opbase;
566   opbase_handler_func old = cpudata[cpunum].opbase;
574567   cpudata[cpunum].opbase = function;
575568   if (cpunum == cpu_getactivecpu())
576569      opbasefunc = function;
r1877r1878
592585   /* allow overrides */
593586   if (opbasefunc != NULL)
594587   {
595      pc = (*opbasefunc)(pc);
588      pc = (*opbasefunc)(Machine, pc);
596589      if (pc == ~0)
597590         return;
598591   }
r1877r1878
751744      UINT8 saved_opcode_entry = opcode_entry;
752745
753746      /* query the handler */
754      offs_t new_offset = (*cpudata[cpunum].opbase)(offset);
747      offs_t new_offset = (*cpudata[cpunum].opbase)(Machine, offset);
755748
756749      /* if it returns ~0, we use whatever data the handler set */
757750      if (new_offset == ~0)
r1877r1878
952945void *_memory_install_read_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, FPTR handler, const char *handler_name)
953946{
954947   addrspace_data *space = &cpudata[cpunum].space[spacenum];
955   if (handler < 0 || handler >= STATIC_COUNT)
948   if (handler >= STATIC_COUNT)
956949      fatalerror("fatal: can only use static banks with memory_install_read_handler()");
957   install_mem_handler(space, 0, space->dbits, 0, start, end, mask, mirror, (genf *)(FPTR)handler, 0, handler_name);
950   install_mem_handler(space, 0, space->dbits, start, end, mask, mirror, (genf *)(FPTR)handler, 0, Machine, handler_name);
958951   mem_dump();
959952   return memory_find_base(cpunum, spacenum, 0, SPACE_SHIFT(space, start));
960953}
961954
962UINT8 *_memory_install_read8_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_handler handler, const char *handler_name)
955UINT8 *_memory_install_read8_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_machine_func handler, const char *handler_name)
963956{
964957   addrspace_data *space = &cpudata[cpunum].space[spacenum];
965   install_mem_handler(space, 0, 8, 0, start, end, mask, mirror, (genf *)handler, 0, handler_name);
958   install_mem_handler(space, 0, 8, start, end, mask, mirror, (genf *)handler, 0, Machine, handler_name);
966959   mem_dump();
967960   return memory_find_base(cpunum, spacenum, 0, SPACE_SHIFT(space, start));
968961}
969962
970UINT16 *_memory_install_read16_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read16_handler handler, const char *handler_name)
963UINT16 *_memory_install_read16_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read16_machine_func handler, const char *handler_name)
971964{
972965   addrspace_data *space = &cpudata[cpunum].space[spacenum];
973   install_mem_handler(space, 0, 16, 0, start, end, mask, mirror, (genf *)handler, 0, handler_name);
966   install_mem_handler(space, 0, 16, start, end, mask, mirror, (genf *)handler, 0, Machine, handler_name);
974967   mem_dump();
975968   return memory_find_base(cpunum, spacenum, 0, SPACE_SHIFT(space, start));
976969}
977970
978UINT32 *_memory_install_read32_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read32_handler handler, const char *handler_name)
971UINT32 *_memory_install_read32_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read32_machine_func handler, const char *handler_name)
979972{
980973   addrspace_data *space = &cpudata[cpunum].space[spacenum];
981   install_mem_handler(space, 0, 32, 0, start, end, mask, mirror, (genf *)handler, 0, handler_name);
974   install_mem_handler(space, 0, 32, start, end, mask, mirror, (genf *)handler, 0, Machine, handler_name);
982975   mem_dump();
983976   return memory_find_base(cpunum, spacenum, 0, SPACE_SHIFT(space, start));
984977}
985978
986UINT64 *_memory_install_read64_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read64_handler handler, const char *handler_name)
979UINT64 *_memory_install_read64_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read64_machine_func handler, const char *handler_name)
987980{
988981   addrspace_data *space = &cpudata[cpunum].space[spacenum];
989   install_mem_handler(space, 0, 64, 0, start, end, mask, mirror, (genf *)handler, 0, handler_name);
982   install_mem_handler(space, 0, 64, start, end, mask, mirror, (genf *)handler, 0, Machine, handler_name);
990983   mem_dump();
991984   return memory_find_base(cpunum, spacenum, 0, SPACE_SHIFT(space, start));
992985}
r1877r1878
1000993void *_memory_install_write_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, FPTR handler, const char *handler_name)
1001994{
1002995   addrspace_data *space = &cpudata[cpunum].space[spacenum];
1003   if (handler < 0 || handler >= STATIC_COUNT)
996   if (handler >= STATIC_COUNT)
1004997      fatalerror("fatal: can only use static banks with memory_install_write_handler()");
1005   install_mem_handler(space, 1, space->dbits, 0, start, end, mask, mirror, (genf *)handler, 0, handler_name);
998   install_mem_handler(space, 1, space->dbits, start, end, mask, mirror, (genf *)handler, 0, Machine, handler_name);
1006999   mem_dump();
10071000   return memory_find_base(cpunum, spacenum, 1, SPACE_SHIFT(space, start));
10081001}
10091002
1010UINT8 *_memory_install_write8_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, write8_handler handler, const char *handler_name)
1003UINT8 *_memory_install_write8_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, write8_machine_func handler, const char *handler_name)
10111004{
10121005   addrspace_data *space = &cpudata[cpunum].space[spacenum];
1013   install_mem_handler(space, 1, 8, 0, start, end, mask, mirror, (genf *)handler, 0, handler_name);
1006   install_mem_handler(space, 1, 8, start, end, mask, mirror, (genf *)handler, 0, Machine, handler_name);
10141007   mem_dump();
10151008   return memory_find_base(cpunum, spacenum, 1, SPACE_SHIFT(space, start));
10161009}
10171010
1018UINT16 *_memory_install_write16_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, write16_handler handler, const char *handler_name)
1011UINT16 *_memory_install_write16_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, write16_machine_func handler, const char *handler_name)
10191012{
10201013   addrspace_data *space = &cpudata[cpunum].space[spacenum];
1021   install_mem_handler(space, 1, 16, 0, start, end, mask, mirror, (genf *)handler, 0, handler_name);
1014   install_mem_handler(space, 1, 16, start, end, mask, mirror, (genf *)handler, 0, Machine, handler_name);
10221015   mem_dump();
10231016   return memory_find_base(cpunum, spacenum, 1, SPACE_SHIFT(space, start));
10241017}
10251018
1026UINT32 *_memory_install_write32_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, write32_handler handler, const char *handler_name)
1019UINT32 *_memory_install_write32_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, write32_machine_func handler, const char *handler_name)
10271020{
10281021   addrspace_data *space = &cpudata[cpunum].space[spacenum];
1029   install_mem_handler(space, 1, 32, 0, start, end, mask, mirror, (genf *)handler, 0, handler_name);
1022   install_mem_handler(space, 1, 32, start, end, mask, mirror, (genf *)handler, 0, Machine, handler_name);
10301023   mem_dump();
10311024   return memory_find_base(cpunum, spacenum, 1, SPACE_SHIFT(space, start));
10321025}
10331026
1034UINT64 *_memory_install_write64_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, write64_handler handler, const char *handler_name)
1027UINT64 *_memory_install_write64_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, write64_machine_func handler, const char *handler_name)
10351028{
10361029   addrspace_data *space = &cpudata[cpunum].space[spacenum];
1037   install_mem_handler(space, 1, 64, 0, start, end, mask, mirror, (genf *)handler, 0, handler_name);
1030   install_mem_handler(space, 1, 64, start, end, mask, mirror, (genf *)handler, 0, Machine, handler_name);
10381031   mem_dump();
10391032   return memory_find_base(cpunum, spacenum, 1, SPACE_SHIFT(space, start));
10401033}
r1877r1878
10481041void *_memory_install_readwrite_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, FPTR rhandler, FPTR whandler, const char *rhandler_name, const char *whandler_name)
10491042{
10501043   addrspace_data *space = &cpudata[cpunum].space[spacenum];
1051   if (rhandler < 0 || rhandler >= STATIC_COUNT || whandler < 0 || whandler >= STATIC_COUNT)
1044   if (rhandler >= STATIC_COUNT || whandler >= STATIC_COUNT)
10521045      fatalerror("fatal: can only use static banks with memory_install_readwrite_handler()");
1053   install_mem_handler(space, 0, space->dbits, 0, start, end, mask, mirror, (genf *)(FPTR)rhandler, 0, rhandler_name);
1054   install_mem_handler(space, 1, space->dbits, 0, start, end, mask, mirror, (genf *)(FPTR)whandler, 0, whandler_name);
1046   install_mem_handler(space, 0, space->dbits, start, end, mask, mirror, (genf *)(FPTR)rhandler, 0, Machine, rhandler_name);
1047   install_mem_handler(space, 1, space->dbits, start, end, mask, mirror, (genf *)(FPTR)whandler, 0, Machine, whandler_name);
10551048   mem_dump();
10561049   return memory_find_base(cpunum, spacenum, 0, SPACE_SHIFT(space, start));
10571050}
10581051
1059UINT8 *_memory_install_readwrite8_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_handler rhandler, write8_handler whandler, const char *rhandler_name, const char *whandler_name)
1052UINT8 *_memory_install_readwrite8_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_machine_func rhandler, write8_machine_func whandler, const char *rhandler_name, const char *whandler_name)
10601053{
10611054   addrspace_data *space = &cpudata[cpunum].space[spacenum];
1062   install_mem_handler(space, 0, 8, 0, start, end, mask, mirror, (genf *)rhandler, 0, rhandler_name);
1063   install_mem_handler(space, 1, 8, 0, start, end, mask, mirror, (genf *)whandler, 0, whandler_name);
1055   install_mem_handler(space, 0, 8, start, end, mask, mirror, (genf *)rhandler, 0, Machine, rhandler_name);
1056   install_mem_handler(space, 1, 8, start, end, mask, mirror, (genf *)whandler, 0, Machine, whandler_name);
10641057   mem_dump();
10651058   return memory_find_base(cpunum, spacenum, 0, SPACE_SHIFT(space, start));
10661059}
10671060
1068UINT16 *_memory_install_readwrite16_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read16_handler rhandler, write16_handler whandler, const char *rhandler_name, const char *whandler_name)
1061UINT16 *_memory_install_readwrite16_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read16_machine_func rhandler, write16_machine_func whandler, const char *rhandler_name, const char *whandler_name)
10691062{
10701063   addrspace_data *space = &cpudata[cpunum].space[spacenum];
1071   install_mem_handler(space, 0, 16, 0, start, end, mask, mirror, (genf *)rhandler, 0, rhandler_name);
1072   install_mem_handler(space, 1, 16, 0, start, end, mask, mirror, (genf *)whandler, 0, whandler_name);
1064   install_mem_handler(space, 0, 16, start, end, mask, mirror, (genf *)rhandler, 0, Machine, rhandler_name);
1065   install_mem_handler(space, 1, 16, start, end, mask, mirror, (genf *)whandler, 0, Machine, whandler_name);
10731066   mem_dump();
10741067   return memory_find_base(cpunum, spacenum, 0, SPACE_SHIFT(space, start));
10751068}
10761069
1077UINT32 *_memory_install_readwrite32_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read32_handler rhandler, write32_handler whandler, const char *rhandler_name, const char *whandler_name)
1070UINT32 *_memory_install_readwrite32_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read32_machine_func rhandler, write32_machine_func whandler, const char *rhandler_name, const char *whandler_name)
10781071{
10791072   addrspace_data *space = &cpudata[cpunum].space[spacenum];
1080   install_mem_handler(space, 0, 32, 0, start, end, mask, mirror, (genf *)rhandler, 0, rhandler_name);
1081   install_mem_handler(space, 1, 32, 0, start, end, mask, mirror, (genf *)whandler, 0, whandler_name);
1073   install_mem_handler(space, 0, 32, start, end, mask, mirror, (genf *)rhandler, 0, Machine, rhandler_name);
1074   install_mem_handler(space, 1, 32, start, end, mask, mirror, (genf *)whandler, 0, Machine, whandler_name);
10821075   mem_dump();
10831076   return memory_find_base(cpunum, spacenum, 0, SPACE_SHIFT(space, start));
10841077}
10851078
1086UINT64 *_memory_install_readwrite64_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read64_handler rhandler, write64_handler whandler, const char *rhandler_name, const char *whandler_name)
1079UINT64 *_memory_install_readwrite64_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read64_machine_func rhandler, write64_machine_func whandler, const char *rhandler_name, const char *whandler_name)
10871080{
10881081   addrspace_data *space = &cpudata[cpunum].space[spacenum];
1089   install_mem_handler(space, 0, 64, 0, start, end, mask, mirror, (genf *)rhandler, 0, rhandler_name);
1090   install_mem_handler(space, 1, 64, 0, start, end, mask, mirror, (genf *)whandler, 0, whandler_name);
1082   install_mem_handler(space, 0, 64, start, end, mask, mirror, (genf *)rhandler, 0, Machine, rhandler_name);
1083   install_mem_handler(space, 1, 64, start, end, mask, mirror, (genf *)whandler, 0, Machine, whandler_name);
10911084   mem_dump();
10921085   return memory_find_base(cpunum, spacenum, 0, SPACE_SHIFT(space, start));
10931086}
10941087
10951088
10961089/*-------------------------------------------------
1097    memory_install_readX_matchmask_handler -
1098    install dynamic match/mask read handler for
1099    X-bit case
1100-------------------------------------------------*/
1101
1102void *_memory_install_read_matchmask_handler(int cpunum, int spacenum, offs_t matchval, offs_t maskval, offs_t mask, offs_t mirror, FPTR handler, const char *handler_name)
1103{
1104   addrspace_data *space = &cpudata[cpunum].space[spacenum];
1105   if (handler < 0 || handler >= STATIC_COUNT)
1106      fatalerror("fatal: can only use static banks with memory_install_read_matchmask_handler()");
1107   install_mem_handler(space, 0, space->dbits, 1, matchval, maskval, mask, mirror, (genf *)handler, 0, handler_name);
1108   mem_dump();
1109   return memory_find_base(cpunum, spacenum, 0, SPACE_SHIFT(space, matchval));
1110}
1111
1112UINT8 *_memory_install_read8_matchmask_handler(int cpunum, int spacenum, offs_t matchval, offs_t maskval, offs_t mask, offs_t mirror, read8_handler handler, const char *handler_name)
1113{
1114   addrspace_data *space = &cpudata[cpunum].space[spacenum];
1115   install_mem_handler(space, 0, 8, 1, matchval, maskval, mask, mirror, (genf *)handler, 0, handler_name);
1116   mem_dump();
1117   return memory_find_base(cpunum, spacenum, 0, SPACE_SHIFT(space, matchval));
1118}
1119
1120UINT16 *_memory_install_read16_matchmask_handler(int cpunum, int spacenum, offs_t matchval, offs_t maskval, offs_t mask, offs_t mirror, read16_handler handler, const char *handler_name)
1121{
1122   addrspace_data *space = &cpudata[cpunum].space[spacenum];
1123   install_mem_handler(space, 0, 16, 1, matchval, maskval, mask, mirror, (genf *)handler, 0, handler_name);
1124   mem_dump();
1125   return memory_find_base(cpunum, spacenum, 0, SPACE_SHIFT(space, matchval));
1126}
1127
1128UINT32 *_memory_install_read32_matchmask_handler(int cpunum, int spacenum, offs_t matchval, offs_t maskval, offs_t mask, offs_t mirror, read32_handler handler, const char *handler_name)
1129{
1130   addrspace_data *space = &cpudata[cpunum].space[spacenum];
1131   install_mem_handler(space, 0, 32, 1, matchval, maskval, mask, mirror, (genf *)handler, 0, handler_name);
1132   mem_dump();
1133   return memory_find_base(cpunum, spacenum, 0, SPACE_SHIFT(space, matchval));
1134}
1135
1136UINT64 *_memory_install_read64_matchmask_handler(int cpunum, int spacenum, offs_t matchval, offs_t maskval, offs_t mask, offs_t mirror, read64_handler handler, const char *handler_name)
1137{
1138   addrspace_data *space = &cpudata[cpunum].space[spacenum];
1139   install_mem_handler(space, 0, 64, 1, matchval, maskval, mask, mirror, (genf *)handler, 0, handler_name);
1140   mem_dump();
1141   return memory_find_base(cpunum, spacenum, 0, SPACE_SHIFT(space, matchval));
1142}
1143
1144
1145/*-------------------------------------------------
1146    memory_install_writeX_matchmask_handler -
1147    install dynamic match/mask write handler for
1148    X-bit case
1149-------------------------------------------------*/
1150
1151void *_memory_install_write_matchmask_handler(int cpunum, int spacenum, offs_t matchval, offs_t maskval, offs_t mask, offs_t mirror, FPTR handler, const char *handler_name)
1152{
1153   addrspace_data *space = &cpudata[cpunum].space[spacenum];
1154   if (handler < 0 || handler >= STATIC_COUNT)
1155      fatalerror("fatal: can only use static banks with memory_install_write_matchmask_handler()");
1156   install_mem_handler(space, 1, space->dbits, 1, matchval, maskval, mask, mirror, (genf *)handler, 0, handler_name);
1157   mem_dump();
1158   return memory_find_base(cpunum, spacenum, 1, SPACE_SHIFT(space, matchval));
1159}
1160
1161UINT8 *_memory_install_write8_matchmask_handler(int cpunum, int spacenum, offs_t matchval, offs_t maskval, offs_t mask, offs_t mirror, write8_handler handler, const char *handler_name)
1162{
1163   addrspace_data *space = &cpudata[cpunum].space[spacenum];
1164   install_mem_handler(space, 1, 8, 1, matchval, maskval, mask, mirror, (genf *)handler, 0, handler_name);
1165   mem_dump();
1166   return memory_find_base(cpunum, spacenum, 1, SPACE_SHIFT(space, matchval));
1167}
1168
1169UINT16 *_memory_install_write16_matchmask_handler(int cpunum, int spacenum, offs_t matchval, offs_t maskval, offs_t mask, offs_t mirror, write16_handler handler, const char *handler_name)
1170{
1171   addrspace_data *space = &cpudata[cpunum].space[spacenum];
1172   install_mem_handler(space, 1, 16, 1, matchval, maskval, mask, mirror, (genf *)handler, 0, handler_name);
1173   mem_dump();
1174   return memory_find_base(cpunum, spacenum, 1, SPACE_SHIFT(space, matchval));
1175}
1176
1177UINT32 *_memory_install_write32_matchmask_handler(int cpunum, int spacenum, offs_t matchval, offs_t maskval, offs_t mask, offs_t mirror, write32_handler handler, const char *handler_name)
1178{
1179   addrspace_data *space = &cpudata[cpunum].space[spacenum];
1180   install_mem_handler(space, 1, 32, 1, matchval, maskval, mask, mirror, (genf *)handler, 0, handler_name);
1181   mem_dump();
1182   return memory_find_base(cpunum, spacenum, 1, SPACE_SHIFT(space, matchval));
1183}
1184
1185UINT64 *_memory_install_write64_matchmask_handler(int cpunum, int spacenum, offs_t matchval, offs_t maskval, offs_t mask, offs_t mirror, write64_handler handler, const char *handler_name)
1186{
1187   addrspace_data *space = &cpudata[cpunum].space[spacenum];
1188   install_mem_handler(space, 1, 64, 1, matchval, maskval, mask, mirror, (genf *)handler, 0, handler_name);
1189   mem_dump();
1190   return memory_find_base(cpunum, spacenum, 1, SPACE_SHIFT(space, matchval));
1191}
1192
1193
1194/*-------------------------------------------------
11951090    construct_address_map - build address map
11961091-------------------------------------------------*/
11971092
r1877r1878
12041099
12051100   /* start by constructing the internal CPU map */
12061101   if (internal_map)
1207      map = (*internal_map)(map);
1102      map = (*internal_map)(Machine, map);
12081103
12091104   /* construct the standard map */
12101105   if (drv->cpu[cpunum].construct_map[spacenum][0])
1211      map = (*drv->cpu[cpunum].construct_map[spacenum][0])(map);
1106      map = (*drv->cpu[cpunum].construct_map[spacenum][0])(Machine, map);
12121107   if (drv->cpu[cpunum].construct_map[spacenum][1])
1213      map = (*drv->cpu[cpunum].construct_map[spacenum][1])(map);
1108      map = (*drv->cpu[cpunum].construct_map[spacenum][1])(Machine, map);
12141109}
12151110
12161111
r1877r1878
12501145    given address space in a standard fashion
12511146-------------------------------------------------*/
12521147
1253INLINE void adjust_addresses(addrspace_data *space, int ismatchmask, offs_t *start, offs_t *end, offs_t *mask, offs_t *mirror)
1148INLINE void adjust_addresses(addrspace_data *space, offs_t *start, offs_t *end, offs_t *mask, offs_t *mirror)
12541149{
12551150   /* adjust start/end/mask values */
12561151   if (*mask == 0)
r1877r1878
12631158   /* adjust to byte values */
12641159   *mask = SPACE_SHIFT(space, *mask);
12651160   *start = SPACE_SHIFT(space, *start);
1266   *end = ismatchmask ? SPACE_SHIFT(space, *end) : SPACE_SHIFT_END(space, *end);
1161   *end = SPACE_SHIFT_END(space, *end);
12671162   *mirror = SPACE_SHIFT(space, *mirror);
12681163}
12691164
r1877r1878
13351230      memcpy(space->adjmap, space->map, sizeof(space->map[0]) * MAX_ADDRESS_MAP_SIZE * 2);
13361231      for (map = space->adjmap; !IS_AMENTRY_END(map); map++)
13371232         if (!IS_AMENTRY_EXTENDED(map))
1338            adjust_addresses(space, IS_AMENTRY_MATCH_MASK(map), &map->start, &map->end, &map->mask, &map->mirror);
1233            adjust_addresses(space, &map->start, &map->end, &map->mask, &map->mirror);
13391234
13401235      /* validate adjusted addresses against implicit regions */
13411236      for (map = space->adjmap; !IS_AMENTRY_END(map); map++)
r1877r1878
15031398               for (map--; map >= space->map; map--)
15041399                  if (!IS_AMENTRY_EXTENDED(map))
15051400                  {
1506                     int ismatchmask = ((map->flags & AM_FLAGS_MATCH_MASK) != 0);
15071401                     int isfixed = (map->memory != NULL) || (map->share != 0);
1402
15081403                     if (map->read.handler != NULL)
1509                        install_mem_handler_private(space, 0, space->dbits, ismatchmask, map->start, map->end, map->mask, map->mirror, map->read.handler, isfixed, map->read_name);
1404                     {
1405                        void *object = Machine;
1406                        if (map->read_devtype != NULL)
1407                        {
1408                           object = (void *)device_list_find_by_tag(Machine->config->devicelist, map->read_devtype, map->read_devtag);
1409                           if (object == NULL)
1410                              fatalerror("Unidentified object in memory map: type=%s tag=%s\n", devtype_name(map->read_devtype), map->read_devtag);
1411                        }
1412                        install_mem_handler_private(space, 0, space->dbits, map->start, map->end, map->mask, map->mirror, map->read.handler, isfixed, object, map->read_name);
1413                     }
15101414                     if (map->write.handler != NULL)
1511                        install_mem_handler_private(space, 1, space->dbits, ismatchmask, map->start, map->end, map->mask, map->mirror, map->write.handler, isfixed, map->write_name);
1415                     {
1416                        void *object = Machine;
1417                        if (map->write_devtype != NULL)
1418                        {
1419                           object = (void *)device_list_find_by_tag(Machine->config->devicelist, map->write_devtype, map->write_devtag);
1420                           if (object == NULL)
1421                              fatalerror("Unidentified object in memory map: type=%s tag=%s\n", devtype_name(map->write_devtype), map->write_devtag);
1422                        }
1423                        install_mem_handler_private(space, 1, space->dbits, map->start, map->end, map->mask, map->mirror, map->write.handler, isfixed, object, map->write_name);
1424                     }
15121425                  }
15131426            }
15141427         }
r1877r1878
15221435    banks to dynamically assigned banks
15231436-------------------------------------------------*/
15241437
1525static void install_mem_handler_private(addrspace_data *space, int iswrite, int databits, int ismatchmask, offs_t start, offs_t end, offs_t mask, offs_t mirror, genf *handler, int isfixed, const char *handler_name)
1438static void install_mem_handler_private(addrspace_data *space, int iswrite, int databits, offs_t start, offs_t end, offs_t mask, offs_t mirror, genf *handler, int isfixed, void *object, const char *handler_name)
15261439{
15271440   /* translate ROM to RAM/UNMAP here */
15281441   if (HANDLER_IS_ROM(handler))
r1877r1878
15381451      offs_t temp_mirror = mirror;
15391452
15401453      /* adjust the incoming addresses (temporarily) */
1541      adjust_addresses(space, ismatchmask, &temp_start, &temp_end, &temp_mask, &temp_mirror);
1454      adjust_addresses(space, &temp_start, &temp_end, &temp_mask, &temp_mirror);
15421455
15431456      /* assign a bank to the adjusted addresses */
15441457      handler = (genf *)assign_dynamic_bank(space->cpunum, space->spacenum, temp_start, temp_end, temp_mirror, isfixed, ismasked);
r1877r1878
15471460   }
15481461
15491462   /* then do a normal installation */
1550   install_mem_handler(space, iswrite, databits, ismatchmask, start, end, mask, mirror, handler, isfixed, handler_name);
1463   install_mem_handler(space, iswrite, databits, start, end, mask, mirror, handler, isfixed, object, handler_name);
15511464}
15521465
15531466
r1877r1878
15561469    memory operations
15571470-------------------------------------------------*/
15581471
1559static void install_mem_handler(addrspace_data *space, int iswrite, int databits, int ismatchmask, offs_t start, offs_t end, offs_t mask, offs_t mirror, genf *handler, int isfixed, const char *handler_name)
1472static void install_mem_handler(addrspace_data *space, int iswrite, int databits, offs_t start, offs_t end, offs_t mask, offs_t mirror, genf *handler, int isfixed, void *object, const char *handler_name)
15601473{
15611474   offs_t lmirrorbit[LEVEL2_BITS], lmirrorbits, hmirrorbit[32 - LEVEL2_BITS], hmirrorbits, lmirrorcount, hmirrorcount;
15621475   table_data *tabledata = iswrite ? &space->write : &space->read;
r1877r1878
15971510   }
15981511
15991512   /* adjust the incoming addresses */
1600   adjust_addresses(space, ismatchmask, &start, &end, &mask, &mirror);
1513   adjust_addresses(space, &start, &end, &mask, &mirror);
16011514
16021515   /* if this ended up a bank handler, tag it for reads or writes */
16031516   if (HANDLER_IS_BANK(handler))
r1877r1878
16211534         hmirrorbit[hmirrorbits++] = 1 << i;
16221535
16231536   /* get the final handler index */
1624   idx = get_handler_index(tabledata->handlers, handler, handler_name, start, end, mask);
1537   idx = get_handler_index(tabledata->handlers, object, handler, handler_name, start, end, mask);
16251538
16261539   /* loop over mirrors in the level 2 table */
16271540   for (hmirrorcount = 0; hmirrorcount < (1 << hmirrorbits); hmirrorcount++)
r1877r1878
16681581               lmirrorbase |= lmirrorbit[i];
16691582
16701583         /* populate the tables */
1671         if (!ismatchmask)
1672            populate_table_range(space, iswrite, start + lmirrorbase, end + lmirrorbase, idx);
1673         else
1674            populate_table_match(space, iswrite, start + lmirrorbase, end + lmirrorbase, idx);
1584         populate_table_range(space, iswrite, start + lmirrorbase, end + lmirrorbase, idx);
16751585      }
16761586   }
16771587
r1877r1878
17151625    handler, or allocates a new one as necessary
17161626-------------------------------------------------*/
17171627
1718static UINT8 get_handler_index(handler_data *table, genf *handler, const char *handler_name, offs_t start, offs_t end, offs_t mask)
1628static UINT8 get_handler_index(handler_data *table, void *object, genf *handler, const char *handler_name, offs_t start, offs_t end, offs_t mask)
17191629{
17201630   int i;
17211631
r1877r1878
17311641         table[i].top = end;
17321642         table[i].mask = mask;
17331643         table[i].name = handler_name;
1644         table[i].object = object;
17341645      }
17351646      return i;
17361647   }
r1877r1878
17451656         table[i].top = end;
17461657         table[i].mask = mask;
17471658         table[i].name = handler_name;
1659         table[i].object = object;
17481660         return i;
17491661      }
1750      if (table[i].handler.generic == handler && table[i].offset == start && table[i].mask == mask)
1662      if (table[i].handler.generic == handler && table[i].offset == start && table[i].mask == mask && table[i].object == object)
17511663         return i;
17521664   }
17531665   return 0;
r1877r1878
18191731
18201732
18211733/*-------------------------------------------------
1822    populate_table_match - assign a memory handler
1823    to a range of addresses
1824-------------------------------------------------*/
1825
1826static void populate_table_match(addrspace_data *space, int iswrite, offs_t matchval, offs_t matchmask, UINT8 handler)
1827{
1828   table_data *tabledata = iswrite ? &space->write : &space->read;
1829   int lowermask, lowermatch;
1830   int uppermask, uppermatch;
1831   int l1index, l2index;
1832
1833   /* clear out any ignored bits in the matchval */
1834   matchval &= matchmask;
1835
1836   /* compute the lower half of the match/mask pair */
1837   lowermask = matchmask & ((1<<LEVEL2_BITS)-1);
1838   lowermatch = matchval & ((1<<LEVEL2_BITS)-1);
1839
1840   /* compute the upper half of the match/mask pair */
1841   uppermask = matchmask >> LEVEL2_BITS;
1842   uppermatch = matchval >> LEVEL2_BITS;
1843
1844   /* if the lower bits of the mask are all 0, we can work exclusively at the top level */
1845   if (lowermask == 0)
1846   {
1847      /* loop over top level matches */
1848      for (l1index = 0; l1index <= (space->mask >> LEVEL2_BITS); l1index++)
1849         if ((l1index & uppermatch) == uppermask)
1850         {
1851            /* if we have a subtable here, release it */
1852            if (tabledata->table[l1index] >= SUBTABLE_BASE)
1853               release_subtable(tabledata, tabledata->table[l1index]);
1854            tabledata->table[l1index] = handler;
1855         }
1856   }
1857
1858   /* okay, we need to work at both levels */
1859   else
1860   {
1861      /* loop over top level matches */
1862      for (l1index = 0; l1index <= (space->mask >> LEVEL2_BITS); l1index++)
1863         if ((l1index & uppermatch) == uppermask)
1864         {
1865            UINT8 *subtable = open_subtable(tabledata, l1index);
1866
1867            /* now loop over lower level matches */
1868            for (l2index = 0; l2index < (1 << LEVEL2_BITS); l2index++)
1869               if ((l2index & lowermask) == lowermatch)
1870                  subtable[l2index] = handler;
1871            close_subtable(tabledata, l1index);
1872         }
1873   }
1874}
1875
1876
1877/*-------------------------------------------------
18781734    allocate_subtable - allocate a fresh subtable
18791735    and set its usecount to 1
18801736-------------------------------------------------*/
r1877r1878
19091765         fatalerror("Ran out of subtables!");
19101766   }
19111767
1912   /* hopefully this never happens */
1913   return 0;
19141768}
19151769
19161770
r1877r1878
20821936      return 1;
20831937
20841938   handler = (FPTR)map->write.handler;
2085   if (handler >= 0 && handler < STATIC_COUNT)
1939   if (handler < STATIC_COUNT)
20861940   {
20871941      if (handler != STATIC_INVALID &&
20881942         handler != STATIC_ROM &&
r1877r1878
20921946   }
20931947
20941948   handler = (FPTR)map->read.handler;
2095   if (handler >= 0 && handler < STATIC_COUNT)
1949   if (handler < STATIC_COUNT)
20961950   {
20971951      if (handler != STATIC_INVALID &&
20981952         (handler < STATIC_BANK1 || handler > STATIC_BANK1 + MAX_BANKS - 1) &&
r1877r1878
21291983            /* we do this to make sure they are found by memory_find_base first */
21301984            for (map = space->adjmap; map && !IS_AMENTRY_END(map); map++)
21311985               if (!IS_AMENTRY_EXTENDED(map) && map->memory != NULL)
2132               {
2133                  if (!IS_AMENTRY_MATCH_MASK(map))
2134                     allocate_memory_block(cpunum, spacenum, map->start, map->end, map->memory);
2135                  else
2136                     allocate_memory_block(cpunum, spacenum, map->start, map->start + map->mask, map->memory);
2137               }
1986                  allocate_memory_block(cpunum, spacenum, map->start, map->end, map->memory);
21381987
21391988            /* loop over all blocks just allocated and assign pointers from them */
21401989            for (i = start_count; i < memory_block_count; i++)
r1877r1878
21532002
21542003               /* work in MEMORY_BLOCK_SIZE-sized chunks */
21552004               curstart = unassigned->start / MEMORY_BLOCK_SIZE;
2156               if (!IS_AMENTRY_MATCH_MASK(unassigned))
2157                  curend = unassigned->end / MEMORY_BLOCK_SIZE;
2158               else
2159                  curend = (unassigned->start + unassigned->mask) / MEMORY_BLOCK_SIZE;
2005               curend = unassigned->end / MEMORY_BLOCK_SIZE;
21602006
21612007               /* loop while we keep finding unassigned blocks in neighboring MEMORY_BLOCK_SIZE chunks */
21622008               do
r1877r1878
21712017
21722018                        /* get block start/end blocks for this block */
21732019                        blockstart = map->start / MEMORY_BLOCK_SIZE;
2174                        if (!IS_AMENTRY_MATCH_MASK(map))
2175                           blockend = map->end / MEMORY_BLOCK_SIZE;
2176                        else
2177                           blockend = (map->start + map->mask) / MEMORY_BLOCK_SIZE;
2020                        blockend = map->end / MEMORY_BLOCK_SIZE;
21782021
21792022                        /* if we intersect or are adjacent, adjust the start/end */
21802023                        if (blockstart <= curend + 1 && blockend >= curstart - 1)
r1877r1878
22842127             }
22852128
22862129            /* otherwise, look for a match in this block */
2287            else
2130            else if (map->start >= start && map->end <= end)
22882131            {
2289               if (!IS_AMENTRY_MATCH_MASK(map))
2290               {
2291                  if (map->start >= start && map->end <= end)
2292                  {
2293                     map->memory = base + (map->start - start);
2294                      VPRINTF(("memory range %08X-%08X -> found in block from %08X-%08X [%p]\n", map->start, map->end, start, end, map->memory));
2295                   }
2296               }
2297               else
2298               {
2299                  if (map->start >= start && map->start + map->mask <= end)
2300                  {
2301                     map->memory = base + (map->start - start);
2302                      VPRINTF(("memory range %08X-%08X -> found in block from %08X-%08X [%p]\n", map->start, map->end, start, end, map->memory));
2303                   }
2304               }
2132               map->memory = base + (map->start - start);
2133               VPRINTF(("memory range %08X-%08X -> found in block from %08X-%08X [%p]\n", map->start, map->end, start, end, map->memory));
23052134            }
23062135         }
23072136
r1877r1878
23612190                  /* assign base/size values */
23622191                  if (map->base != NULL)
23632192                     *map->base = map->memory;
2364                  if (map->size)
2365                  {
2366                     if (!IS_AMENTRY_MATCH_MASK(map))
2367                        *map->size = map->end - map->start + 1;
2368                     else
2369                        *map->size = map->mask + 1;
2370                  }
2193                  if (map->size != NULL)
2194                     *map->size = map->end - map->start + 1;
23712195               }
23722196         }
23732197
r1877r1878
24162240      if (!IS_AMENTRY_EXTENDED(map))
24172241      {
24182242         offs_t maskoffs = offset & map->mask;
2419         if (!IS_AMENTRY_MATCH_MASK(map))
2243         if (maskoffs >= map->start && maskoffs <= map->end)
24202244         {
2421            if (maskoffs >= map->start && maskoffs <= map->end)
2422            {
2423               VPRINTF(("found in entry %08X-%08X [%p]\n", map->start, map->end, (UINT8 *)map->memory + (maskoffs - map->start)));
2424               return (UINT8 *)map->memory + (maskoffs - map->start);
2425            }
2245            VPRINTF(("found in entry %08X-%08X [%p]\n", map->start, map->end, (UINT8 *)map->memory + (maskoffs - map->start)));
2246            return (UINT8 *)map->memory + (maskoffs - map->start);
24262247         }
2427         else
2428         {
2429            if ((maskoffs & map->end) == map->start)
2430            {
2431               VPRINTF(("found in entry %08X-%08X [%p]\n", map->start, map->end, (UINT8 *)map->memory + (maskoffs - map->start)));
2432               return (UINT8 *)map->memory + (maskoffs - map->start);
2433            }
2434         }
24352248      }
24362249
24372250   /* if not found there, look in the allocated blocks */
r1877r1878
24512264    PERFORM_LOOKUP - common lookup procedure
24522265-------------------------------------------------*/
24532266
2454#define PERFORM_LOOKUP(lookup,space,extraand)                                 \
2267#define PERFORM_LOOKUP(lookup,handlers,spacenum,extraand)                        \
24552268   /* perform lookup */                                                \
2456   address &= space.addrmask & extraand;                                    \
2457   entry = space.lookup[LEVEL1_INDEX(address)];                              \
2269   address &= active_address_space[spacenum].addrmask & extraand;                  \
2270   entry = active_address_space[spacenum].lookup[LEVEL1_INDEX(address)];            \
24582271   if (entry >= SUBTABLE_BASE)                                             \
2459      entry = space.lookup[LEVEL2_INDEX(entry,address)];                        \
2272      entry = active_address_space[spacenum].lookup[LEVEL2_INDEX(entry,address)];      \
2273   handler = &active_address_space[spacenum].handlers[entry];                     \
24602274
24612275
24622276/*-------------------------------------------------
r1877r1878
24672281UINT8 name(offs_t original_address)                                          \
24682282{                                                                  \
24692283   offs_t address = original_address;                                       \
2284   const handler_data *handler;                                          \
24702285   UINT32 entry;                                                      \
24712286   MEMREADSTART();                                                      \
2472   PERFORM_LOOKUP(readlookup,active_address_space[spacenum],~0);                  \
2287   PERFORM_LOOKUP(readlookup,readhandlers,spacenum,~0);                        \
24732288   DEBUG_HOOK_READ(spacenum, 1, address);                                    \
24742289                                                                  \
24752290   /* handle banks inline */                                             \
2476   address = (address - active_address_space[spacenum].readhandlers[entry].offset) & active_address_space[spacenum].readhandlers[entry].mask;\
2291   address = (address - handler->offset) & handler->mask;                        \
24772292   if (entry < STATIC_RAM)                                              \
24782293      MEMREADEND(bank_ptr[entry][address]);                                 \
24792294                                                                  \
24802295   /* fall back to the handler */                                          \
24812296   else                                                            \
2482      MEMREADEND((*active_address_space[spacenum].readhandlers[entry].handler.read.handler8)(address));\
2483   return 0;                                                         \
2297      MEMREADEND((*handler->handler.read.handler8)(handler->object, address));      \
24842298}                                                                  \
24852299
24862300#define READBYTE(name,spacenum,xormacro,handlertype,ignorebits,shiftbytes,masktype)      \
24872301UINT8 name(offs_t original_address)                                          \
24882302{                                                                  \
24892303   offs_t address = original_address;                                       \
2304   const handler_data *handler;                                          \
24902305   UINT32 entry;                                                      \
24912306   MEMREADSTART();                                                      \
2492   PERFORM_LOOKUP(readlookup,active_address_space[spacenum],~0);                  \
2307   PERFORM_LOOKUP(readlookup,readhandlers,spacenum,~0);                        \
24932308   DEBUG_HOOK_READ(spacenum, 1, address);                                    \
24942309                                                                  \
24952310   /* handle banks inline */                                             \
2496   address = (address - active_address_space[spacenum].readhandlers[entry].offset) & active_address_space[spacenum].readhandlers[entry].mask;\
2311   address = (address - handler->offset) & handler->mask;                        \
24972312   if (entry < STATIC_RAM)                                                \
24982313      MEMREADEND(bank_ptr[entry][xormacro(address)]);                           \
24992314                                                                  \
r1877r1878
25012316   else                                                            \
25022317   {                                                               \
25032318      int shift = 8 * (shiftbytes);                                       \
2504      MEMREADEND((*active_address_space[spacenum].readhandlers[entry].handler.read.handlertype)(address >> (ignorebits), ~((masktype)0xff << shift)) >> shift);\
2319      MEMREADEND((*handler->handler.read.handlertype)(handler->object, address >> (ignorebits), ~((masktype)0xff << shift)) >> shift);\
25052320   }                                                               \
2506   return 0;                                                         \
25072321}                                                                  \
25082322
25092323#define READBYTE16BE(name,space)   READBYTE(name,space,BYTE_XOR_BE, handler16,1,~address & 1,UINT16)
r1877r1878
25232337UINT16 name(offs_t original_address)                                       \
25242338{                                                                  \
25252339   offs_t address = original_address;                                       \
2340   const handler_data *handler;                                          \
25262341   UINT32 entry;                                                      \
25272342   MEMREADSTART();                                                      \
2528   PERFORM_LOOKUP(readlookup,active_address_space[spacenum],~1);                  \
2343   PERFORM_LOOKUP(readlookup,readhandlers,spacenum,~1);                        \
25292344   DEBUG_HOOK_READ(spacenum, 2, address);                                    \
25302345                                                                  \
25312346   /* handle banks inline */                                             \
2532   address = (address - active_address_space[spacenum].readhandlers[entry].offset) & active_address_space[spacenum].readhandlers[entry].mask;\
2347   address = (address - handler->offset) & handler->mask;                        \
25332348   if (entry < STATIC_RAM)                                                \
25342349      MEMREADEND(*(UINT16 *)&bank_ptr[entry][address]);                        \
25352350                                                                  \
25362351   /* fall back to the handler */                                          \
25372352   else                                                            \
2538      MEMREADEND((*active_address_space[spacenum].readhandlers[entry].handler.read.handler16)(address >> 1,0));\
2539   return 0;                                                         \
2353      MEMREADEND((*handler->handler.read.handler16)(handler->object, address >> 1, 0));\
25402354}                                                                  \
25412355
25422356#define READWORD(name,spacenum,xormacro,handlertype,ignorebits,shiftbytes,masktype)      \
25432357UINT16 name(offs_t original_address)                                       \
25442358{                                                                  \
25452359   offs_t address = original_address;                                       \
2360   const handler_data *handler;                                          \
25462361   UINT32 entry;                                                      \
25472362   MEMREADSTART();                                                      \
2548   PERFORM_LOOKUP(readlookup,active_address_space[spacenum],~1);                  \
2363   PERFORM_LOOKUP(readlookup,readhandlers,spacenum,~1);                        \
25492364   DEBUG_HOOK_READ(spacenum, 2, address);                                    \
25502365                                                                  \
25512366   /* handle banks inline */                                             \
2552   address = (address - active_address_space[spacenum].readhandlers[entry].offset) & active_address_space[spacenum].readhandlers[entry].mask;\
2367   address = (address - handler->offset) & handler->mask;                        \
25532368   if (entry < STATIC_RAM)                                                \
25542369      MEMREADEND(*(UINT16 *)&bank_ptr[entry][xormacro(address)]);                  \
25552370                                                                  \
r1877r1878
25572372   else                                                            \
25582373   {                                                               \
25592374      int shift = 8 * (shiftbytes);                                       \
2560      MEMREADEND((*active_address_space[spacenum].readhandlers[entry].handler.read.handlertype)(address >> (ignorebits), ~((masktype)0xffff << shift)) >> shift);\
2375      MEMREADEND((*handler->handler.read.handlertype)(handler->object, address >> (ignorebits), ~((masktype)0xffff << shift)) >> shift);\
25612376   }                                                               \
2562   return 0;                                                         \
25632377}                                                                  \
25642378
25652379#define READWORD32BE(name,space)   READWORD(name,space,WORD_XOR_BE, handler32,2,~address & 2,UINT32)
r1877r1878
25772391UINT32 name(offs_t original_address)                                       \
25782392{                                                                  \
25792393   offs_t address = original_address;                                       \
2394   const handler_data *handler;                                          \
25802395   UINT32 entry;                                                      \
25812396   MEMREADSTART();                                                      \
2582   PERFORM_LOOKUP(readlookup,active_address_space[spacenum],~3);                  \
2397   PERFORM_LOOKUP(readlookup,readhandlers,spacenum,~3);                        \
25832398   DEBUG_HOOK_READ(spacenum, 4, address);                                    \
25842399                                                                  \
25852400   /* handle banks inline */                                             \
2586   address = (address - active_address_space[spacenum].readhandlers[entry].offset) & active_address_space[spacenum].readhandlers[entry].mask;\
2401   address = (address - handler->offset) & handler->mask;                        \
25872402   if (entry < STATIC_RAM)                                                \
25882403      MEMREADEND(*(UINT32 *)&bank_ptr[entry][address]);                        \
25892404                                                                  \
25902405   /* fall back to the handler */                                          \
25912406   else                                                            \
2592      MEMREADEND((*active_address_space[spacenum].readhandlers[entry].handler.read.handler32)(address >> 2,0));\
2593   return 0;                                                         \
2407      MEMREADEND((*handler->handler.read.handler32)(handler->object, address >> 2, 0));\
25942408}                                                                  \
25952409
25962410#define READMASKED32(name,spacenum)                                          \
25972411UINT32 name(offs_t original_address, UINT32 mem_mask)                           \
25982412{                                                                  \
25992413   offs_t address = original_address;                                       \
2414   const handler_data *handler;                                          \
26002415   UINT32 entry;                                                      \
26012416   MEMREADSTART();                                                      \
2602   PERFORM_LOOKUP(readlookup,active_address_space[spacenum],~3);                  \
2417   PERFORM_LOOKUP(readlookup,readhandlers,spacenum,~3);                        \
26032418   DEBUG_HOOK_READ(spacenum, 4, address);                                    \
26042419                                                                  \
26052420   /* handle banks inline */                                             \
2606   address = (address - active_address_space[spacenum].readhandlers[entry].offset) & active_address_space[spacenum].readhandlers[entry].mask;\
2421   address = (address - handler->offset) & handler->mask;                        \
26072422   if (entry < STATIC_RAM)                                                \
26082423      MEMREADEND(*(UINT32 *)&bank_ptr[entry][address]);                        \
26092424                                                                  \
26102425   /* fall back to the handler */                                          \
26112426   else                                                            \
2612      MEMREADEND((*active_address_space[spacenum].readhandlers[entry].handler.read.handler32)(address >> 2, mem_mask));\
2613   return 0;                                                         \
2427      MEMREADEND((*handler->handler.read.handler32)(handler->object, address >> 2, mem_mask));\
26142428}                                                                  \
26152429
26162430#define READDWORD(name,spacenum,xormacro,handlertype,ignorebits,shiftbytes,masktype)   \
26172431UINT32 name(offs_t original_address)                                       \
26182432{                                                                  \
26192433   offs_t address = original_address;                                       \
2434   const handler_data *handler;                                          \
26202435   UINT32 entry;                                                      \
26212436   MEMREADSTART();                                                      \
2622   PERFORM_LOOKUP(readlookup,active_address_space[spacenum],~3);                  \
2437   PERFORM_LOOKUP(readlookup,readhandlers,spacenum,~3);                        \
26232438   DEBUG_HOOK_READ(spacenum, 4, address);                                    \
26242439                                                                  \
26252440   /* handle banks inline */                                             \
2626   address = (address - active_address_space[spacenum].readhandlers[entry].offset) & active_address_space[spacenum].readhandlers[entry].mask;\
2441   address = (address - handler->offset) & handler->mask;                        \
26272442   if (entry < STATIC_RAM)                                                \
26282443      MEMREADEND(*(UINT32 *)&bank_ptr[entry][xormacro(address)]);                  \
26292444                                                                  \
r1877r1878
26312446   else                                                            \
26322447   {                                                               \
26332448      int shift = 8 * (shiftbytes);                                       \
2634      MEMREADEND((*active_address_space[spacenum].readhandlers[entry].handler.read.handlertype)(address >> (ignorebits), ~((masktype)0xffffffff << shift)) >> shift);\
2449      MEMREADEND((*handler->handler.read.handlertype)(handler->object, address >> (ignorebits), ~((masktype)0xffffffff << shift)) >> shift);\
26352450   }                                                               \
2636   return 0;                                                         \
26372451}                                                                  \
26382452
26392453#define READDWORD64BE(name,space)   READDWORD(name,space,DWORD_XOR_BE,handler64,3,~address & 4,UINT64)
r1877r1878
26492463UINT64 name(offs_t original_address)                                       \
26502464{                                                                  \
26512465   offs_t address = original_address;                                       \
2466   const handler_data *handler;                                          \
26522467   UINT32 entry;                                                      \
26532468   MEMREADSTART();                                                      \
2654   PERFORM_LOOKUP(readlookup,active_address_space[spacenum],~7);                  \
2469   PERFORM_LOOKUP(readlookup,readhandlers,spacenum,~7);                        \
26552470   DEBUG_HOOK_READ(spacenum, 8, address);                                    \
26562471                                                                  \
26572472   /* handle banks inline */                                             \
2658   address = (address - active_address_space[spacenum].readhandlers[entry].offset) & active_address_space[spacenum].readhandlers[entry].mask;\
2473   address = (address - handler->offset) & handler->mask;                        \
26592474   if (entry < STATIC_RAM)                                                \
26602475      MEMREADEND(*(UINT64 *)&bank_ptr[entry][address]);                        \
26612476                                                                  \
26622477   /* fall back to the handler */                                          \
26632478   else                                                            \
2664      MEMREADEND((*active_address_space[spacenum].readhandlers[entry].handler.read.handler64)(address >> 3,0));\
2665   return 0;                                                         \
2479      MEMREADEND((*handler->handler.read.handler64)(handler->object, address >> 3, 0));\
26662480}                                                                  \
26672481
26682482#define READMASKED64(name,spacenum)                                          \
26692483UINT64 name(offs_t original_address, UINT64 mem_mask)                           \
26702484{                                                                  \
26712485   offs_t address = original_address;                                       \
2486   const handler_data *handler;                                          \
26722487   UINT32 entry;                                                      \
26732488   MEMREADSTART();                                                      \
2674   PERFORM_LOOKUP(readlookup,active_address_space[spacenum],~7);                  \
2489   PERFORM_LOOKUP(readlookup,readhandlers,spacenum,~7);                        \
26752490   DEBUG_HOOK_READ(spacenum, 8, address);                                    \
26762491                                                                  \
26772492   /* handle banks inline */                                             \
2678   address = (address - active_address_space[spacenum].readhandlers[entry].offset) & active_address_space[spacenum].readhandlers[entry].mask;\
2493   address = (address - handler->offset) & handler->mask;                        \
26792494   if (entry < STATIC_RAM)                                                \
26802495      MEMREADEND(*(UINT64 *)&bank_ptr[entry][address]);                        \
26812496                                                                  \
26822497   /* fall back to the handler */                                          \
26832498   else                                                            \
2684      MEMREADEND((*active_address_space[spacenum].readhandlers[entry].handler.read.handler64)(address >> 3, mem_mask));\
2685   return 0;                                                         \
2499      MEMREADEND((*handler->handler.read.handler64)(handler->object, address >> 3, mem_mask));\
26862500}                                                                  \
26872501
26882502
r1877r1878
26942508void name(offs_t original_address, UINT8 data)                                 \
26952509{                                                                  \
26962510   offs_t address = original_address;                                       \
2511   const handler_data *handler;                                          \
26972512   UINT32 entry;                                                      \
26982513   MEMWRITESTART();                                                   \
2699   PERFORM_LOOKUP(writelookup,active_address_space[spacenum],~0);                  \
2514   PERFORM_LOOKUP(writelookup,writehandlers,spacenum,~0);                        \
27002515   DEBUG_HOOK_WRITE(spacenum, 1, address, data);                              \
27012516                                                                  \
27022517   /* handle banks inline */                                             \
2703   address = (address - active_address_space[spacenum].writehandlers[entry].offset) & active_address_space[spacenum].writehandlers[entry].mask;\
2518   address = (address - handler->offset) & handler->mask;                        \
27042519   if (entry < STATIC_RAM)                                                \
27052520      MEMWRITEEND(bank_ptr[entry][address] = data);                           \
27062521                                                                  \
27072522   /* fall back to the handler */                                          \
27082523   else                                                            \
2709      MEMWRITEEND((*active_address_space[spacenum].writehandlers[entry].handler.write.handler8)(address, data));\
2524      MEMWRITEEND((*handler->handler.write.handler8)(handler->object, address, data));\
27102525}                                                                  \
27112526
27122527#define WRITEBYTE(name,spacenum,xormacro,handlertype,ignorebits,shiftbytes,masktype)   \
27132528void name(offs_t original_address, UINT8 data)                                 \
27142529{                                                                  \
27152530   offs_t address = original_address;                                       \
2531   const handler_data *handler;                                          \
27162532   UINT32 entry;                                                      \
27172533   MEMWRITESTART();                                                   \
2718   PERFORM_LOOKUP(writelookup,active_address_space[spacenum],~0);                  \
2534   PERFORM_LOOKUP(writelookup,writehandlers,spacenum,~0);                        \
27192535   DEBUG_HOOK_WRITE(spacenum, 1, address, data);                              \
27202536                                                                  \
27212537   /* handle banks inline */                                             \
2722   address = (address - active_address_space[spacenum].writehandlers[entry].offset) & active_address_space[spacenum].writehandlers[entry].mask;\
2538   address = (address - handler->offset) & handler->mask;                        \
27232539   if (entry < STATIC_RAM)                                                \
27242540      MEMWRITEEND(bank_ptr[entry][xormacro(address)] = data);                     \
27252541                                                                  \
r1877r1878
27272543   else                                                            \
27282544   {                                                               \
27292545      int shift = 8 * (shiftbytes);                                       \
2730      MEMWRITEEND((*active_address_space[spacenum].writehandlers[entry].handler.write.handlertype)(address >> (ignorebits), (masktype)data << shift, ~((masktype)0xff << shift)));\
2546      MEMWRITEEND((*handler->handler.write.handlertype)(handler->object, address >> (ignorebits), (masktype)data << shift, ~((masktype)0xff << shift)));\
27312547   }                                                               \
27322548}                                                                  \
27332549
r1877r1878
27482564void name(offs_t original_address, UINT16 data)                                 \
27492565{                                                                  \
27502566   offs_t address = original_address;                                       \
2567   const handler_data *handler;                                          \
27512568   UINT32 entry;                                                      \
27522569   MEMWRITESTART();                                                   \
2753   PERFORM_LOOKUP(writelookup,active_address_space[spacenum],~1);                  \
2570   PERFORM_LOOKUP(writelookup,writehandlers,spacenum,~1);                        \
27542571   DEBUG_HOOK_WRITE(spacenum, 2, address, data);                              \
27552572                                                                  \
27562573   /* handle banks inline */                                             \
2757   address = (address - active_address_space[spacenum].writehandlers[entry].offset) & active_address_space[spacenum].writehandlers[entry].mask;\
2574   address = (address - handler->offset) & handler->mask;                        \
27582575   if (entry < STATIC_RAM)                                                \
27592576      MEMWRITEEND(*(UINT16 *)&bank_ptr[entry][address] = data);                  \
27602577                                                                  \
27612578   /* fall back to the handler */                                          \
27622579   else                                                            \
2763      MEMWRITEEND((*active_address_space[spacenum].writehandlers[entry].handler.write.handler16)(address >> 1, data, 0));\
2580      MEMWRITEEND((*handler->handler.write.handler16)(handler->object, address >> 1, data, 0));\
27642581}                                                                  \
27652582
27662583#define WRITEWORD(name,spacenum,xormacro,handlertype,ignorebits,shiftbytes,masktype)   \
27672584void name(offs_t original_address, UINT16 data)                                 \
27682585{                                                                  \
27692586   offs_t address = original_address;                                       \
2587   const handler_data *handler;                                          \
27702588   UINT32 entry;                                                      \
27712589   MEMWRITESTART();                                                   \
2772   PERFORM_LOOKUP(writelookup,active_address_space[spacenum],~1);                  \
2590   PERFORM_LOOKUP(writelookup,writehandlers,spacenum,~1);                        \
27732591   DEBUG_HOOK_WRITE(spacenum, 2, address, data);                              \
27742592                                                                  \
27752593   /* handle banks inline */                                             \
2776   address = (address - active_address_space[spacenum].writehandlers[entry].offset) & active_address_space[spacenum].writehandlers[entry].mask;\
2594   address = (address - handler->offset) & handler->mask;                        \
27772595   if (entry < STATIC_RAM)                                                \
27782596      MEMWRITEEND(*(UINT16 *)&bank_ptr[entry][xormacro(address)] = data);            \
27792597                                                                  \
r1877r1878
27812599   else                                                            \
27822600   {                                                               \
27832601      int shift = 8 * (shiftbytes);                                       \
2784      MEMWRITEEND((*active_address_space[spacenum].writehandlers[entry].handler.write.handlertype)(address >> (ignorebits), (masktype)data << shift, ~((masktype)0xffff << shift)));\
2602      MEMWRITEEND((*handler->handler.write.handlertype)(handler->object, address >> (ignorebits), (masktype)data << shift, ~((masktype)0xffff << shift)));\
27852603   }                                                               \
27862604}                                                                  \
27872605
r1877r1878
28002618void name(offs_t original_address, UINT32 data)                                 \
28012619{                                                                  \
28022620   offs_t address = original_address;                                       \
2621   const handler_data *handler;                                          \
28032622   UINT32 entry;                                                      \
28042623   MEMWRITESTART();                                                   \
2805   PERFORM_LOOKUP(writelookup,active_address_space[spacenum],~3);                  \
2624   PERFORM_LOOKUP(writelookup,writehandlers,spacenum,~3);                        \
28062625   DEBUG_HOOK_WRITE(spacenum, 4, address, data);                              \
28072626                                                                  \
28082627   /* handle banks inline */                                             \
2809   address = (address - active_address_space[spacenum].writehandlers[entry].offset) & active_address_space[spacenum].writehandlers[entry].mask;\
2628   address = (address - handler->offset) & handler->mask;                        \
28102629   if (entry < STATIC_RAM)                                                \
28112630      MEMWRITEEND(*(UINT32 *)&bank_ptr[entry][address] = data);                  \
28122631                                                                  \
28132632   /* fall back to the handler */                                          \
28142633   else                                                            \
2815      MEMWRITEEND((*active_address_space[spacenum].writehandlers[entry].handler.write.handler32)(address >> 2, data, 0));\
2634      MEMWRITEEND((*handler->handler.write.handler32)(handler->object, address >> 2, data, 0));\
28162635}                                                                  \
28172636
28182637#define WRITEMASKED32(name,spacenum)                                       \
28192638void name(offs_t original_address, UINT32 data, UINT32 mem_mask)                  \
28202639{                                                                  \
28212640   offs_t address = original_address;                                       \
2641   const handler_data *handler;                                          \
28222642   UINT32 entry;                                                      \
28232643   MEMWRITESTART();                                                   \
2824   PERFORM_LOOKUP(writelookup,active_address_space[spacenum],~3);                  \
2644   PERFORM_LOOKUP(writelookup,writehandlers,spacenum,~3);                        \
28252645   DEBUG_HOOK_WRITE(spacenum, 4, address, data);                              \
28262646                                                                  \
28272647   /* handle banks inline */                                             \
2828   address = (address - active_address_space[spacenum].writehandlers[entry].offset) & active_address_space[spacenum].writehandlers[entry].mask;\
2648   address = (address - handler->offset) & handler->mask;                        \
28292649   if (entry < STATIC_RAM)                                                \
28302650   {                                                               \
28312651      UINT32 *dest = (UINT32 *)&bank_ptr[entry][address];                        \
r1877r1878
28342654                                                                  \
28352655   /* fall back to the handler */                                          \
28362656   else                                                            \
2837      MEMWRITEEND((*active_address_space[spacenum].writehandlers[entry].handler.write.handler32)(address >> 2, data, mem_mask));\
2657      MEMWRITEEND((*handler->handler.write.handler32)(handler->object, address >> 2, data, mem_mask));\
28382658}                                                                  \
28392659
28402660#define WRITEDWORD(name,spacenum,xormacro,handlertype,ignorebits,shiftbytes,masktype)   \
28412661void name(offs_t original_address, UINT32 data)                                 \
28422662{                                                                  \
28432663   offs_t address = original_address;                                       \
2664   const handler_data *handler;                                          \
28442665   UINT32 entry;                                                      \
28452666   MEMWRITESTART();                                                   \
2846   PERFORM_LOOKUP(writelookup,active_address_space[spacenum],~3);                  \
2667   PERFORM_LOOKUP(writelookup,writehandlers,spacenum,~3);                        \
28472668   DEBUG_HOOK_WRITE(spacenum, 4, address, data);                              \
28482669                                                                  \
28492670   /* handle banks inline */                                             \
2850   address = (address - active_address_space[spacenum].writehandlers[entry].offset) & active_address_space[spacenum].writehandlers[entry].mask;\
2671   address = (address - handler->offset) & handler->mask;                        \
28512672   if (entry < STATIC_RAM)                                                \
28522673      MEMWRITEEND(*(UINT32 *)&bank_ptr[entry][xormacro(address)] = data);            \
28532674                                                                  \
r1877r1878
28552676   else                                                            \
28562677   {                                                               \
28572678      int shift = 8 * (shiftbytes);                                       \
2858      MEMWRITEEND((*active_address_space[spacenum].writehandlers[entry].handler.write.handlertype)(address >> (ignorebits), (masktype)data << shift, ~((masktype)0xffffffff << shift)));\
2679      MEMWRITEEND((*handler->handler.write.handlertype)(handler->object, address >> (ignorebits), (masktype)data << shift, ~((masktype)0xffffffff << shift)));\
28592680   }                                                               \
28602681}                                                                  \
28612682
r1877r1878
28722693void name(offs_t original_address, UINT64 data)                                 \
28732694{                                                                  \
28742695   offs_t address = original_address;                                       \
2696   const handler_data *handler;                                          \
28752697   UINT32 entry;                                                      \
28762698   MEMWRITESTART();                                                   \
2877   PERFORM_LOOKUP(writelookup,active_address_space[spacenum],~7);                  \
2699   PERFORM_LOOKUP(writelookup,writehandlers,spacenum,~7);                        \
28782700   DEBUG_HOOK_WRITE(spacenum, 8, address, data);                              \
28792701                                                                  \
28802702   /* handle banks inline */                                             \
2881   address = (address - active_address_space[spacenum].writehandlers[entry].offset) & active_address_space[spacenum].writehandlers[entry].mask;\
2703   address = (address - handler->offset) & handler->mask;                        \
28822704   if (entry < STATIC_RAM)                                                \
28832705      MEMWRITEEND(*(UINT64 *)&bank_ptr[entry][address] = data);                  \
28842706                                                                  \
28852707   /* fall back to the handler */                                          \
28862708   else                                                            \
2887      MEMWRITEEND((*active_address_space[spacenum].writehandlers[entry].handler.write.handler64)(address >> 3, data, 0));\
2709      MEMWRITEEND((*handler->handler.write.handler64)(handler->object, address >> 3, data, 0));\
28882710}                                                                  \
28892711
28902712#define WRITEMASKED64(name,spacenum)                                       \
28912713void name(offs_t original_address, UINT64 data, UINT64 mem_mask)                  \
28922714{                                                                  \
28932715   offs_t address = original_address;                                       \
2716   const handler_data *handler;                                          \
28942717   UINT32 entry;                                                      \
28952718   MEMWRITESTART();                                                   \
2896   PERFORM_LOOKUP(writelookup,active_address_space[spacenum],~7);                  \
2719   PERFORM_LOOKUP(writelookup,writehandlers,spacenum,~7);                        \
28972720   DEBUG_HOOK_WRITE(spacenum, 8, address, data);                              \
28982721                                                                  \
28992722   /* handle banks inline */                                             \
2900   address = (address - active_address_space[spacenum].writehandlers[entry].offset) & active_address_space[spacenum].writehandlers[entry].mask;\
2723   address = (address - handler->offset) & handler->mask;                        \
29012724   if (entry < STATIC_RAM)                                                \
29022725   {                                                               \
29032726      UINT64 *dest = (UINT64 *)&bank_ptr[entry][address];                        \
r1877r1878
29062729                                                                  \
29072730   /* fall back to the handler */                                          \
29082731   else                                                            \
2909      MEMWRITEEND((*active_address_space[spacenum].writehandlers[entry].handler.write.handler64)(address >> 3, data, mem_mask));\
2732      MEMWRITEEND((*handler->handler.write.handler64)(handler->object, address >> 3, data, mem_mask));\
29102733}                                                                  \
29112734
29122735
src/emu/video.h
r1877r1878
8888};
8989
9090
91/*-------------------------------------------------
92    vblank_state_changed_func - callback that a
93    screen calls to notify of a change of
94    the VBLANK state
95-------------------------------------------------*/
9196
97typedef void (*vblank_state_changed_func)(running_machine *machine, screen_state *screen, int vblank_state);
98
99
100
92101/***************************************************************************
93102    FUNCTION PROTOTYPES
94103***************************************************************************/
r1877r1878
98107/* core initialization */
99108void video_init(running_machine *machine);
100109
101/* core VBLANK callback */
102void video_vblank_start(running_machine *machine);
103110
104
105111/* ----- screen management ----- */
106112
107113/* set the resolution of a screen */
r1877r1878
127133/* return the time when the beam will reach a particular H,V position */
128134attotime video_screen_get_time_until_pos(int scrnum, int vpos, int hpos);
129135
136/* return the time when the beam will reach the start of VBLANK */
137attotime video_screen_get_time_until_vblank_start(int scrnum);
138
139/* return the time when the beam will reach the end of VBLANK */
140attotime video_screen_get_time_until_vblank_end(int scrnum);
141
142/* return the time when the VIDEO_UPDATE function will be called */
143attotime video_screen_get_time_until_update(int scrnum);
144
130145/* return the amount of time the beam takes to draw one scan line */
131146attotime video_screen_get_scan_period(int scrnum);
132147
133148/* return the amount of time the beam takes to draw one complete frame */
134149attotime video_screen_get_frame_period(int scrnum);
135150
151/* return the current frame number -- this is always increasing */
152UINT64 video_screen_get_frame_number(int scrnum);
153
136154/* returns whether a given screen exists */
137155int video_screen_exists(int scrnum);
138156
157/* registers a VBLANK callback for the given screen*/
158void video_screen_register_vbl_cb(running_machine *machine, void *screen, vblank_state_changed_func vbl_cb);
139159
140160
141161/* ----- video screen device interface ----- */
142162
143163/* device get info callback */
144#define VIDEO_SCREEN video_screen_get_info
145void video_screen_get_info(running_machine *machine, void *token, UINT32 state, deviceinfo *info);
164#define VIDEO_SCREEN DEVICE_GET_INFO_NAME(video_screen)
165DEVICE_GET_INFO( video_screen );
146166
147167
148168
src/emu/emu.mak
r1877r1878
7777   $(EMUOBJ)/uimenu.o \
7878   $(EMUOBJ)/validity.o \
7979   $(EMUOBJ)/video.o \
80   $(EMUOBJ)/watchdog.o
8081
8182ifdef PROFILER
8283EMUOBJS += \
src/emu/memory.h
r1877r1878
1515#define __MEMORY_H__
1616
1717#include "mamecore.h"
18#include "devintrf.h"
1819
1920
2021
r1877r1878
2627typedef UINT32         offs_t;
2728
2829/* ----- typedefs for the various common data access handlers ----- */
29typedef UINT8         (*read8_handler)  (ATTR_UNUSED offs_t offset);
30typedef void         (*write8_handler) (ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT8 data);
31typedef UINT16         (*read16_handler) (ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 mem_mask);
32typedef void         (*write16_handler)(ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 data, ATTR_UNUSED UINT16 mem_mask);
33typedef UINT32         (*read32_handler) (ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT32 mem_mask);
34typedef void         (*write32_handler)(ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT32 data, ATTR_UNUSED UINT32 mem_mask);
35typedef UINT64         (*read64_handler) (ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT64 mem_mask);
36typedef void         (*write64_handler)(ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT64 data, ATTR_UNUSED UINT64 mem_mask);
37typedef offs_t         (*opbase_handler) (ATTR_UNUSED offs_t address);
30typedef UINT8         (*read8_machine_func)  (ATTR_UNUSED running_machine *machine, ATTR_UNUSED offs_t offset);
31typedef void         (*write8_machine_func) (ATTR_UNUSED running_machine *machine, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT8 data);
32typedef UINT16         (*read16_machine_func) (ATTR_UNUSED running_machine *machine, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 mem_mask);
33typedef void         (*write16_machine_func)(ATTR_UNUSED running_machine *machine, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 data, ATTR_UNUSED UINT16 mem_mask);
34typedef UINT32         (*read32_machine_func) (ATTR_UNUSED running_machine *machine, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT32 mem_mask);
35typedef void         (*write32_machine_func)(ATTR_UNUSED running_machine *machine, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT32 data, ATTR_UNUSED UINT32 mem_mask);
36typedef UINT64         (*read64_machine_func) (ATTR_UNUSED running_machine *machine, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT64 mem_mask);
37typedef void         (*write64_machine_func)(ATTR_UNUSED running_machine *machine, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT64 data, ATTR_UNUSED UINT64 mem_mask);
3838
39typedef UINT8         (*read8_device_func)  (ATTR_UNUSED device_config *device, ATTR_UNUSED offs_t offset);
40typedef void         (*write8_device_func) (ATTR_UNUSED device_config *device, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT8 data);
41typedef UINT16         (*read16_device_func) (ATTR_UNUSED device_config *device, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 mem_mask);
42typedef void         (*write16_device_func)(ATTR_UNUSED device_config *device, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 data, ATTR_UNUSED UINT16 mem_mask);
43typedef UINT32         (*read32_device_func) (ATTR_UNUSED device_config *device, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT32 mem_mask);
44typedef void         (*write32_device_func)(ATTR_UNUSED device_config *device, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT32 data, ATTR_UNUSED UINT32 mem_mask);
45typedef UINT64         (*read64_device_func) (ATTR_UNUSED device_config *device, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT64 mem_mask);
46typedef void         (*write64_device_func)(ATTR_UNUSED device_config *device, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT64 data, ATTR_UNUSED UINT64 mem_mask);
47
48typedef offs_t         (*opbase_handler_func) (ATTR_UNUSED running_machine *machine, ATTR_UNUSED offs_t address);
49
3950/* ----- this struct contains pointers to the live read/write routines ----- */
4051typedef struct _data_accessors data_accessors;
4152struct _data_accessors
r1877r1878
5869***************************************************************************/
5970
6071/* ----- macros for declaring the various common data access handlers ----- */
61#define READ8_HANDLER(name)    UINT8  name(ATTR_UNUSED offs_t offset)
62#define WRITE8_HANDLER(name)    void   name(ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT8 data)
63#define READ16_HANDLER(name)   UINT16 name(ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 mem_mask)
64#define WRITE16_HANDLER(name)   void   name(ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 data, ATTR_UNUSED UINT16 mem_mask)
65#define READ32_HANDLER(name)   UINT32 name(ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT32 mem_mask)
66#define WRITE32_HANDLER(name)   void   name(ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT32 data, ATTR_UNUSED UINT32 mem_mask)
67#define READ64_HANDLER(name)   UINT64 name(ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT64 mem_mask)
68#define WRITE64_HANDLER(name)   void   name(ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT64 data, ATTR_UNUSED UINT64 mem_mask)
69#define OPBASE_HANDLER(name)   offs_t name(ATTR_UNUSED offs_t address)
72#define READ8_HANDLER(name)    UINT8  name(ATTR_UNUSED running_machine *machine, ATTR_UNUSED offs_t offset)
73#define WRITE8_HANDLER(name)    void   name(ATTR_UNUSED running_machine *machine, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT8 data)
74#define READ16_HANDLER(name)   UINT16 name(ATTR_UNUSED running_machine *machine, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 mem_mask)
75#define WRITE16_HANDLER(name)   void   name(ATTR_UNUSED running_machine *machine, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 data, ATTR_UNUSED UINT16 mem_mask)
76#define READ32_HANDLER(name)   UINT32 name(ATTR_UNUSED running_machine *machine, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT32 mem_mask)
77#define WRITE32_HANDLER(name)   void   name(ATTR_UNUSED running_machine *machine, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT32 data, ATTR_UNUSED UINT32 mem_mask)
78#define READ64_HANDLER(name)   UINT64 name(ATTR_UNUSED running_machine *machine, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT64 mem_mask)
79#define WRITE64_HANDLER(name)   void   name(ATTR_UNUSED running_machine *machine, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT64 data, ATTR_UNUSED UINT64 mem_mask)
7080
81#define READ8_DEVICE_HANDLER(name)       UINT8  name(ATTR_UNUSED device_config *device, ATTR_UNUSED offs_t offset)
82#define WRITE8_DEVICE_HANDLER(name)    void   name(ATTR_UNUSED device_config *device, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT8 data)
83#define READ16_DEVICE_HANDLER(name)      UINT16 name(ATTR_UNUSED device_config *device, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 mem_mask)
84#define WRITE16_DEVICE_HANDLER(name)   void   name(ATTR_UNUSED device_config *device, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 data, ATTR_UNUSED UINT16 mem_mask)
85#define READ32_DEVICE_HANDLER(name)      UINT32 name(ATTR_UNUSED device_config *device, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT32 mem_mask)
86#define WRITE32_DEVICE_HANDLER(name)   void   name(ATTR_UNUSED device_config *device, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT32 data, ATTR_UNUSED UINT32 mem_mask)
87#define READ64_DEVICE_HANDLER(name)      UINT64 name(ATTR_UNUSED device_config *device, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT64 mem_mask)
88#define WRITE64_DEVICE_HANDLER(name)   void   name(ATTR_UNUSED device_config *device, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT64 data, ATTR_UNUSED UINT64 mem_mask)
89
90#define OPBASE_HANDLER(name)   offs_t name(ATTR_UNUSED running_machine *machine, ATTR_UNUSED offs_t address)
91
7192/* ----- macros for accessing bytes and words within larger chunks ----- */
7293#ifdef LSB_FIRST
7394   #define BYTE_XOR_BE(a)     ((a) ^ 1)            /* read/write a byte to a 16-bit space */
r1877r1878
108129
109130/* ----- definitions for the flags in the address maps ----- */
110131#define AM_FLAGS_EXTENDED      0x01               /* this is an extended entry with the below flags in the start field */
111#define AM_FLAGS_MATCH_MASK      0x02               /* this entry should have the start/end pair treated as a match/mask pair */
112#define AM_FLAGS_END         0x04               /* this is the terminating entry in the array */
132#define AM_FLAGS_END         0x02               /* this is the terminating entry in the array */
113133
114134/* ----- definitions for the extended flags in the address maps ----- */
115135#define AMEF_SPECIFIES_SPACE   0x00000001            /* set if the address space is specified */
r1877r1878
199219***************************************************************************/
200220
201221/* 8-bit reads */
202#define MRA8_BANK1            ((read8_handler)STATIC_BANK1)
203#define MRA8_BANK2            ((read8_handler)STATIC_BANK2)
204#define MRA8_BANK3            ((read8_handler)STATIC_BANK3)
205#define MRA8_BANK4            ((read8_handler)STATIC_BANK4)
206#define MRA8_BANK5            ((read8_handler)STATIC_BANK5)
207#define MRA8_BANK6            ((read8_handler)STATIC_BANK6)
208#define MRA8_BANK7            ((read8_handler)STATIC_BANK7)
209#define MRA8_BANK8            ((read8_handler)STATIC_BANK8)
210#define MRA8_BANK9            ((read8_handler)STATIC_BANK9)
211#define MRA8_BANK10            ((read8_handler)STATIC_BANK10)
212#define MRA8_BANK11            ((read8_handler)STATIC_BANK11)
213#define MRA8_BANK12            ((read8_handler)STATIC_BANK12)
214#define MRA8_BANK13            ((read8_handler)STATIC_BANK13)
215#define MRA8_BANK14            ((read8_handler)STATIC_BANK14)
216#define MRA8_BANK15            ((read8_handler)STATIC_BANK15)
217#define MRA8_BANK16            ((read8_handler)STATIC_BANK16)
218#define MRA8_BANK17            ((read8_handler)STATIC_BANK17)
219#define MRA8_BANK18            ((read8_handler)STATIC_BANK18)
220#define MRA8_BANK19            ((read8_handler)STATIC_BANK19)
221#define MRA8_BANK20            ((read8_handler)STATIC_BANK20)
222#define MRA8_BANK21            ((read8_handler)STATIC_BANK21)
223#define MRA8_BANK22            ((read8_handler)STATIC_BANK22)
224#define MRA8_BANK23            ((read8_handler)STATIC_BANK23)
225#define MRA8_BANK24            ((read8_handler)STATIC_BANK24)
226#define MRA8_BANK25            ((read8_handler)STATIC_BANK25)
227#define MRA8_BANK26            ((read8_handler)STATIC_BANK26)
228#define MRA8_BANK27            ((read8_handler)STATIC_BANK27)
229#define MRA8_BANK28            ((read8_handler)STATIC_BANK28)
230#define MRA8_BANK29            ((read8_handler)STATIC_BANK29)
231#define MRA8_BANK30            ((read8_handler)STATIC_BANK30)
232#define MRA8_BANK31            ((read8_handler)STATIC_BANK31)
233#define MRA8_BANK32            ((read8_handler)STATIC_BANK32)
234#define MRA8_RAM            ((read8_handler)STATIC_RAM)
235#define MRA8_ROM            ((read8_handler)STATIC_ROM)
236#define MRA8_NOP            ((read8_handler)STATIC_NOP)
237#define MRA8_UNMAP            ((read8_handler)STATIC_UNMAP)
222#define MRA8_BANK1            ((read8_machine_func)STATIC_BANK1)
223#define MRA8_BANK2            ((read8_machine_func)STATIC_BANK2)
224#define MRA8_BANK3            ((read8_machine_func)STATIC_BANK3)
225#define MRA8_BANK4            ((read8_machine_func)STATIC_BANK4)
226#define MRA8_BANK5            ((read8_machine_func)STATIC_BANK5)
227#define MRA8_BANK6            ((read8_machine_func)STATIC_BANK6)
228#define MRA8_BANK7            ((read8_machine_func)STATIC_BANK7)
229#define MRA8_BANK8            ((read8_machine_func)STATIC_BANK8)
230#define MRA8_BANK9            ((read8_machine_func)STATIC_BANK9)
231#define MRA8_BANK10            ((read8_machine_func)STATIC_BANK10)
232#define MRA8_BANK11            ((read8_machine_func)STATIC_BANK11)
233#define MRA8_BANK12            ((read8_machine_func)STATIC_BANK12)
234#define MRA8_BANK13            ((read8_machine_func)STATIC_BANK13)
235#define MRA8_BANK14            ((read8_machine_func)STATIC_BANK14)
236#define MRA8_BANK15            ((read8_machine_func)STATIC_BANK15)
237#define MRA8_BANK16            ((read8_machine_func)STATIC_BANK16)
238#define MRA8_BANK17            ((read8_machine_func)STATIC_BANK17)
239#define MRA8_BANK18            ((read8_machine_func)STATIC_BANK18)
240#define MRA8_BANK19            ((read8_machine_func)STATIC_BANK19)
241#define MRA8_BANK20            ((read8_machine_func)STATIC_BANK20)
242#define MRA8_BANK21            ((read8_machine_func)STATIC_BANK21)
243#define MRA8_BANK22            ((read8_machine_func)STATIC_BANK22)
244#define MRA8_BANK23            ((read8_machine_func)STATIC_BANK23)
245#define MRA8_BANK24            ((read8_machine_func)STATIC_BANK24)
246#define MRA8_BANK25            ((read8_machine_func)STATIC_BANK25)
247#define MRA8_BANK26            ((read8_machine_func)STATIC_BANK26)
248#define MRA8_BANK27            ((read8_machine_func)STATIC_BANK27)
249#define MRA8_BANK28            ((read8_machine_func)STATIC_BANK28)
250#define MRA8_BANK29            ((read8_machine_func)STATIC_BANK29)
251#define MRA8_BANK30            ((read8_machine_func)STATIC_BANK30)
252#define MRA8_BANK31            ((read8_machine_func)STATIC_BANK31)
253#define MRA8_BANK32            ((read8_machine_func)STATIC_BANK32)
254#define MRA8_RAM            ((read8_machine_func)STATIC_RAM)
255#define MRA8_ROM            ((read8_machine_func)STATIC_ROM)
256#define MRA8_NOP            ((read8_machine_func)STATIC_NOP)
257#define MRA8_UNMAP            ((read8_machine_func)STATIC_UNMAP)
238258
239259/* 8-bit writes */
240#define MWA8_BANK1            ((write8_handler)STATIC_BANK1)
241#define MWA8_BANK2            ((write8_handler)STATIC_BANK2)
242#define MWA8_BANK3            ((write8_handler)STATIC_BANK3)
243#define MWA8_BANK4            ((write8_handler)STATIC_BANK4)
244#define MWA8_BANK5            ((write8_handler)STATIC_BANK5)
245#define MWA8_BANK6            ((write8_handler)STATIC_BANK6)
246#define MWA8_BANK7            ((write8_handler)STATIC_BANK7)
247#define MWA8_BANK8            ((write8_handler)STATIC_BANK8)
248#define MWA8_BANK9            ((write8_handler)STATIC_BANK9)
249#define MWA8_BANK10            ((write8_handler)STATIC_BANK10)
250#define MWA8_BANK11            ((write8_handler)STATIC_BANK11)
251#define MWA8_BANK12            ((write8_handler)STATIC_BANK12)
252#define MWA8_BANK13            ((write8_handler)STATIC_BANK13)
253#define MWA8_BANK14            ((write8_handler)STATIC_BANK14)
254#define MWA8_BANK15            ((write8_handler)STATIC_BANK15)
255#define MWA8_BANK16            ((write8_handler)STATIC_BANK16)
256#define MWA8_BANK17            ((write8_handler)STATIC_BANK17)
257#define MWA8_BANK18            ((write8_handler)STATIC_BANK18)
258#define MWA8_BANK19            ((write8_handler)STATIC_BANK19)
259#define MWA8_BANK20            ((write8_handler)STATIC_BANK20)
260#define MWA8_BANK21            ((write8_handler)STATIC_BANK21)
261#define MWA8_BANK22            ((write8_handler)STATIC_BANK22)
262#define MWA8_BANK23            ((write8_handler)STATIC_BANK23)
263#define MWA8_BANK24            ((write8_handler)STATIC_BANK24)
264#define MWA8_BANK25            ((write8_handler)STATIC_BANK25)
265#define MWA8_BANK26            ((write8_handler)STATIC_BANK26)
266#define MWA8_BANK27            ((write8_handler)STATIC_BANK27)
267#define MWA8_BANK28            ((write8_handler)STATIC_BANK28)
268#define MWA8_BANK29            ((write8_handler)STATIC_BANK29)
269#define MWA8_BANK30            ((write8_handler)STATIC_BANK30)
270#define MWA8_BANK31            ((write8_handler)STATIC_BANK31)
271#define MWA8_BANK32            ((write8_handler)STATIC_BANK32)
272#define MWA8_RAM            ((write8_handler)STATIC_RAM)
273#define MWA8_ROM            ((write8_handler)STATIC_ROM)
274#define MWA8_NOP            ((write8_handler)STATIC_NOP)
275#define MWA8_UNMAP            ((write8_handler)STATIC_UNMAP)
260#define MWA8_BANK1            ((write8_machine_func)STATIC_BANK1)
261#define MWA8_BANK2            ((write8_machine_func)STATIC_BANK2)
262#define MWA8_BANK3            ((write8_machine_func)STATIC_BANK3)
263#define MWA8_BANK4            ((write8_machine_func)STATIC_BANK4)
264#define MWA8_BANK5            ((write8_machine_func)STATIC_BANK5)
265#define MWA8_BANK6            ((write8_machine_func)STATIC_BANK6)
266#define MWA8_BANK7            ((write8_machine_func)STATIC_BANK7)
267#define MWA8_BANK8            ((write8_machine_func)STATIC_BANK8)
268#define MWA8_BANK9            ((write8_machine_func)STATIC_BANK9)
269#define MWA8_BANK10            ((write8_machine_func)STATIC_BANK10)
270#define MWA8_BANK11            ((write8_machine_func)STATIC_BANK11)
271#define MWA8_BANK12            ((write8_machine_func)STATIC_BANK12)
272#define MWA8_BANK13            ((write8_machine_func)STATIC_BANK13)
273#define MWA8_BANK14            ((write8_machine_func)STATIC_BANK14)
274#define MWA8_BANK15            ((write8_machine_func)STATIC_BANK15)
275#define MWA8_BANK16            ((write8_machine_func)STATIC_BANK16)
276#define MWA8_BANK17            ((write8_machine_func)STATIC_BANK17)
277#define MWA8_BANK18            ((write8_machine_func)STATIC_BANK18)
278#define MWA8_BANK19            ((write8_machine_func)STATIC_BANK19)
279#define MWA8_BANK20            ((write8_machine_func)STATIC_BANK20)
280#define MWA8_BANK21            ((write8_machine_func)STATIC_BANK21)
281#define MWA8_BANK22            ((write8_machine_func)STATIC_BANK22)
282#define MWA8_BANK23            ((write8_machine_func)STATIC_BANK23)
283#define MWA8_BANK24            ((write8_machine_func)STATIC_BANK24)
284#define MWA8_BANK25            ((write8_machine_func)STATIC_BANK25)
285#define MWA8_BANK26            ((write8_machine_func)STATIC_BANK26)
286#define MWA8_BANK27            ((write8_machine_func)STATIC_BANK27)
287#define MWA8_BANK28            ((write8_machine_func)STATIC_BANK28)
288#define MWA8_BANK29            ((write8_machine_func)STATIC_BANK29)
289#define MWA8_BANK30            ((write8_machine_func)STATIC_BANK30)
290#define MWA8_BANK31            ((write8_machine_func)STATIC_BANK31)
291#define MWA8_BANK32            ((write8_machine_func)STATIC_BANK32)
292#define MWA8_RAM            ((write8_machine_func)STATIC_RAM)
293#define MWA8_ROM            ((write8_machine_func)STATIC_ROM)
294#define MWA8_NOP            ((write8_machine_func)STATIC_NOP)
295#define MWA8_UNMAP            ((write8_machine_func)STATIC_UNMAP)
276296
277297/* 16-bit reads */
278#define MRA16_BANK1            ((read16_handler)STATIC_BANK1)
279#define MRA16_BANK2            ((read16_handler)STATIC_BANK2)
280#define MRA16_BANK3            ((read16_handler)STATIC_BANK3)
281#define MRA16_BANK4            ((read16_handler)STATIC_BANK4)
282#define MRA16_BANK5            ((read16_handler)STATIC_BANK5)
283#define MRA16_BANK6            ((read16_handler)STATIC_BANK6)
284#define MRA16_BANK7            ((read16_handler)STATIC_BANK7)
285#define MRA16_BANK8            ((read16_handler)STATIC_BANK8)
286#define MRA16_BANK9            ((read16_handler)STATIC_BANK9)
287#define MRA16_BANK10         ((read16_handler)STATIC_BANK10)
288#define MRA16_BANK11         ((read16_handler)STATIC_BANK11)
289#define MRA16_BANK12         ((read16_handler)STATIC_BANK12)
290#define MRA16_BANK13         ((read16_handler)STATIC_BANK13)
291#define MRA16_BANK14         ((read16_handler)STATIC_BANK14)
292#define MRA16_BANK15         ((read16_handler)STATIC_BANK15)
293#define MRA16_BANK16         ((read16_handler)STATIC_BANK16)
294#define MRA16_BANK17         ((read16_handler)STATIC_BANK17)
295#define MRA16_BANK18         ((read16_handler)STATIC_BANK18)
296#define MRA16_BANK19         ((read16_handler)STATIC_BANK19)
297#define MRA16_BANK20         ((read16_handler)STATIC_BANK20)
298#define MRA16_BANK21         ((read16_handler)STATIC_BANK21)
299#define MRA16_BANK22         ((read16_handler)STATIC_BANK22)
300#define MRA16_BANK23         ((read16_handler)STATIC_BANK23)
301#define MRA16_BANK24         ((read16_handler)STATIC_BANK24)
302#define MRA16_BANK25         ((read16_handler)STATIC_BANK25)
303#define MRA16_BANK26         ((read16_handler)STATIC_BANK26)
304#define MRA16_BANK27         ((read16_handler)STATIC_BANK27)
305#define MRA16_BANK28         ((read16_handler)STATIC_BANK28)
306#define MRA16_BANK29         ((read16_handler)STATIC_BANK29)
307#define MRA16_BANK30         ((read16_handler)STATIC_BANK30)
308#define MRA16_BANK31         ((read16_handler)STATIC_BANK31)
309#define MRA16_BANK32         ((read16_handler)STATIC_BANK32)
310#define MRA16_RAM            ((read16_handler)STATIC_RAM)
311#define MRA16_ROM            ((read16_handler)STATIC_ROM)
312#define MRA16_NOP            ((read16_handler)STATIC_NOP)
313#define MRA16_UNMAP            ((read16_handler)STATIC_UNMAP)
298#define MRA16_BANK1            ((read16_machine_func)STATIC_BANK1)
299#define MRA16_BANK2            ((read16_machine_func)STATIC_BANK2)
300#define MRA16_BANK3            ((read16_machine_func)STATIC_BANK3)
301#define MRA16_BANK4            ((read16_machine_func)STATIC_BANK4)
302#define MRA16_BANK5            ((read16_machine_func)STATIC_BANK5)
303#define MRA16_BANK6            ((read16_machine_func)STATIC_BANK6)
304#define MRA16_BANK7            ((read16_machine_func)STATIC_BANK7)
305#define MRA16_BANK8            ((read16_machine_func)STATIC_BANK8)
306#define MRA16_BANK9            ((read16_machine_func)STATIC_BANK9)
307#define MRA16_BANK10         ((read16_machine_func)STATIC_BANK10)
308#define MRA16_BANK11         ((read16_machine_func)STATIC_BANK11)
309#define MRA16_BANK12         ((read16_machine_func)STATIC_BANK12)
310#define MRA16_BANK13         ((read16_machine_func)STATIC_BANK13)
311#define MRA16_BANK14         ((read16_machine_func)STATIC_BANK14)
312#define MRA16_BANK15         ((read16_machine_func)STATIC_BANK15)
313#define MRA16_BANK16         ((read16_machine_func)STATIC_BANK16)
314#define MRA16_BANK17         ((read16_machine_func)STATIC_BANK17)
315#define MRA16_BANK18         ((read16_machine_func)STATIC_BANK18)
316#define MRA16_BANK19         ((read16_machine_func)STATIC_BANK19)
317#define MRA16_BANK20         ((read16_machine_func)STATIC_BANK20)
318#define MRA16_BANK21         ((read16_machine_func)STATIC_BANK21)
319#define MRA16_BANK22         ((read16_machine_func)STATIC_BANK22)
320#define MRA16_BANK23         ((read16_machine_func)STATIC_BANK23)
321#define MRA16_BANK24         ((read16_machine_func)STATIC_BANK24)
322#define MRA16_BANK25         ((read16_machine_func)STATIC_BANK25)
323#define MRA16_BANK26         ((read16_machine_func)STATIC_BANK26)
324#define MRA16_BANK27         ((read16_machine_func)STATIC_BANK27)
325#define MRA16_BANK28         ((read16_machine_func)STATIC_BANK28)
326#define MRA16_BANK29         ((read16_machine_func)STATIC_BANK29)
327#define MRA16_BANK30         ((read16_machine_func)STATIC_BANK30)
328#define MRA16_BANK31         ((read16_machine_func)STATIC_BANK31)
329#define MRA16_BANK32         ((read16_machine_func)STATIC_BANK32)
330#define MRA16_RAM            ((read16_machine_func)STATIC_RAM)
331#define MRA16_ROM            ((read16_machine_func)STATIC_ROM)
332#define MRA16_NOP            ((read16_machine_func)STATIC_NOP)
333#define MRA16_UNMAP            ((read16_machine_func)STATIC_UNMAP)
314334
315335/* 16-bit writes */
316#define MWA16_BANK1            ((write16_handler)STATIC_BANK1)
317#define MWA16_BANK2            ((write16_handler)STATIC_BANK2)
318#define MWA16_BANK3            ((write16_handler)STATIC_BANK3)
319#define MWA16_BANK4            ((write16_handler)STATIC_BANK4)
320#define MWA16_BANK5            ((write16_handler)STATIC_BANK5)
321#define MWA16_BANK6            ((write16_handler)STATIC_BANK6)
322#define MWA16_BANK7            ((write16_handler)STATIC_BANK7)
323#define MWA16_BANK8            ((write16_handler)STATIC_BANK8)
324#define MWA16_BANK9            ((write16_handler)STATIC_BANK9)
325#define MWA16_BANK10         ((write16_handler)STATIC_BANK10)
326#define MWA16_BANK11         ((write16_handler)STATIC_BANK11)
327#define MWA16_BANK12         ((write16_handler)STATIC_BANK12)
328#define MWA16_BANK13         ((write16_handler)STATIC_BANK13)
329#define MWA16_BANK14         ((write16_handler)STATIC_BANK14)
330#define MWA16_BANK15         ((write16_handler)STATIC_BANK15)
331#define MWA16_BANK16         ((write16_handler)STATIC_BANK16)
332#define MWA16_BANK17         ((write16_handler)STATIC_BANK17)
333#define MWA16_BANK18         ((write16_handler)STATIC_BANK18)
334#define MWA16_BANK19         ((write16_handler)STATIC_BANK19)
335#define MWA16_BANK20         ((write16_handler)STATIC_BANK20)
336#define MWA16_BANK21         ((write16_handler)STATIC_BANK21)
337#define MWA16_BANK22         ((write16_handler)STATIC_BANK22)
338#define MWA16_BANK23         ((write16_handler)STATIC_BANK23)
339#define MWA16_BANK24         ((write16_handler)STATIC_BANK24)
340#define MWA16_BANK25         ((write16_handler)STATIC_BANK25)
341#define MWA16_BANK26         ((write16_handler)STATIC_BANK26)
342#define MWA16_BANK27         ((write16_handler)STATIC_BANK27)
343#define MWA16_BANK28         ((write16_handler)STATIC_BANK28)
344#define MWA16_BANK29         ((write16_handler)STATIC_BANK29)
345#define MWA16_BANK30         ((write16_handler)STATIC_BANK30)
346#define MWA16_BANK31         ((write16_handler)STATIC_BANK31)
347#define MWA16_BANK32         ((write16_handler)STATIC_BANK32)
348#define MWA16_RAM            ((write16_handler)STATIC_RAM)
349#define MWA16_ROM            ((write16_handler)STATIC_ROM)
350#define MWA16_NOP            ((write16_handler)STATIC_NOP)
351#define MWA16_UNMAP            ((write16_handler)STATIC_UNMAP)
336#define MWA16_BANK1            ((write16_machine_func)STATIC_BANK1)
337#define MWA16_BANK2            ((write16_machine_func)STATIC_BANK2)
338#define MWA16_BANK3            ((write16_machine_func)STATIC_BANK3)
339#define MWA16_BANK4            ((write16_machine_func)STATIC_BANK4)
340#define MWA16_BANK5            ((write16_machine_func)STATIC_BANK5)
341#define MWA16_BANK6            ((write16_machine_func)STATIC_BANK6)
342#define MWA16_BANK7            ((write16_machine_func)STATIC_BANK7)
343#define MWA16_BANK8            ((write16_machine_func)STATIC_BANK8)
344#define MWA16_BANK9            ((write16_machine_func)STATIC_BANK9)
345#define MWA16_BANK10         ((write16_machine_func)STATIC_BANK10)
346#define MWA16_BANK11         ((write16_machine_func)STATIC_BANK11)
347#define MWA16_BANK12         ((write16_machine_func)STATIC_BANK12)
348#define MWA16_BANK13         ((write16_machine_func)STATIC_BANK13)
349#define MWA16_BANK14         ((write16_machine_func)STATIC_BANK14)
350#define MWA16_BANK15         ((write16_machine_func)STATIC_BANK15)
351#define MWA16_BANK16         ((write16_machine_func)STATIC_BANK16)
352#define MWA16_BANK17         ((write16_machine_func)STATIC_BANK17)
353#define MWA16_BANK18         ((write16_machine_func)STATIC_BANK18)
354#define MWA16_BANK19         ((write16_machine_func)STATIC_BANK19)
355#define MWA16_BANK20         ((write16_machine_func)STATIC_BANK20)
356#define MWA16_BANK21         ((write16_machine_func)STATIC_BANK21)
357#define MWA16_BANK22         ((write16_machine_func)STATIC_BANK22)
358#define MWA16_BANK23         ((write16_machine_func)STATIC_BANK23)
359#define MWA16_BANK24         ((write16_machine_func)STATIC_BANK24)
360#define MWA16_BANK25         ((write16_machine_func)STATIC_BANK25)
361#define MWA16_BANK26         ((write16_machine_func)STATIC_BANK26)
362#define MWA16_BANK27         ((write16_machine_func)STATIC_BANK27)
363#define MWA16_BANK28         ((write16_machine_func)STATIC_BANK28)
364#define MWA16_BANK29         ((write16_machine_func)STATIC_BANK29)
365#define MWA16_BANK30         ((write16_machine_func)STATIC_BANK30)
366#define MWA16_BANK31         ((write16_machine_func)STATIC_BANK31)
367#define MWA16_BANK32         ((write16_machine_func)STATIC_BANK32)
368#define MWA16_RAM            ((write16_machine_func)STATIC_RAM)
369#define MWA16_ROM            ((write16_machine_func)STATIC_ROM)
370#define MWA16_NOP            ((write16_machine_func)STATIC_NOP)
371#define MWA16_UNMAP            ((write16_machine_func)STATIC_UNMAP)
352372
353373/* 32-bit reads */
354#define MRA32_BANK1            ((read32_handler)STATIC_BANK1)
355#define MRA32_BANK2            ((read32_handler)STATIC_BANK2)
356#define MRA32_BANK3            ((read32_handler)STATIC_BANK3)
357#define MRA32_BANK4            ((read32_handler)STATIC_BANK4)
358#define MRA32_BANK5            ((read32_handler)STATIC_BANK5)
359#define MRA32_BANK6            ((read32_handler)STATIC_BANK6)
360#define MRA32_BANK7            ((read32_handler)STATIC_BANK7)
361#define MRA32_BANK8            ((read32_handler)STATIC_BANK8)
362#define MRA32_BANK9            ((read32_handler)STATIC_BANK9)
363#define MRA32_BANK10         ((read32_handler)STATIC_BANK10)
364#define MRA32_BANK11         ((read32_handler)STATIC_BANK11)
365#define MRA32_BANK12         ((read32_handler)STATIC_BANK12)
366#define MRA32_BANK13         ((read32_handler)STATIC_BANK13)
367#define MRA32_BANK14         ((read32_handler)STATIC_BANK14)
368#define MRA32_BANK15         ((read32_handler)STATIC_BANK15)
369#define MRA32_BANK16         ((read32_handler)STATIC_BANK16)
370#define MRA32_BANK17         ((read32_handler)STATIC_BANK17)
371#define MRA32_BANK18         ((read32_handler)STATIC_BANK18)
372#define MRA32_BANK19         ((read32_handler)STATIC_BANK19)
373#define MRA32_BANK20         ((read32_handler)STATIC_BANK20)
374#define MRA32_BANK21         ((read32_handler)STATIC_BANK21)
375#define MRA32_BANK22         ((read32_handler)STATIC_BANK22)
376#define MRA32_BANK23         ((read32_handler)STATIC_BANK23)
377#define MRA32_BANK24         ((read32_handler)STATIC_BANK24)
378#define MRA32_BANK25         ((read32_handler)STATIC_BANK25)
379#define MRA32_BANK26         ((read32_handler)STATIC_BANK26)
380#define MRA32_BANK27         ((read32_handler)STATIC_BANK27)
381#define MRA32_BANK28         ((read32_handler)STATIC_BANK28)
382#define MRA32_BANK29         ((read32_handler)STATIC_BANK29)
383#define MRA32_BANK30         ((read32_handler)STATIC_BANK30)
384#define MRA32_BANK31         ((read32_handler)STATIC_BANK31)
385#define MRA32_BANK32         ((read32_handler)STATIC_BANK32)
386#define MRA32_RAM            ((read32_handler)STATIC_RAM)
387#define MRA32_ROM            ((read32_handler)STATIC_ROM)
388#define MRA32_NOP            ((read32_handler)STATIC_NOP)
389#define MRA32_UNMAP            ((read32_handler)STATIC_UNMAP)
374#define MRA32_BANK1            ((read32_machine_func)STATIC_BANK1)
375#define MRA32_BANK2            ((read32_machine_func)STATIC_BANK2)
376#define MRA32_BANK3            ((read32_machine_func)STATIC_BANK3)
377#define MRA32_BANK4            ((read32_machine_func)STATIC_BANK4)
378#define MRA32_BANK5            ((read32_machine_func)STATIC_BANK5)
379#define MRA32_BANK6            ((read32_machine_func)STATIC_BANK6)
380#define MRA32_BANK7            ((read32_machine_func)STATIC_BANK7)
381#define MRA32_BANK8            ((read32_machine_func)STATIC_BANK8)
382#define MRA32_BANK9            ((read32_machine_func)STATIC_BANK9)
383#define MRA32_BANK10         ((read32_machine_func)STATIC_BANK10)
384#define MRA32_BANK11         ((read32_machine_func)STATIC_BANK11)
385#define MRA32_BANK12         ((read32_machine_func)STATIC_BANK12)
386#define MRA32_BANK13         ((read32_machine_func)STATIC_BANK13)
387#define MRA32_BANK14         ((read32_machine_func)STATIC_BANK14)
388#define MRA32_BANK15         ((read32_machine_func)STATIC_BANK15)
389#define MRA32_BANK16         ((read32_machine_func)STATIC_BANK16)
390#define MRA32_BANK17         ((read32_machine_func)STATIC_BANK17)
391#define MRA32_BANK18         ((read32_machine_func)STATIC_BANK18)
392#define MRA32_BANK19         ((read32_machine_func)STATIC_BANK19)
393#define MRA32_BANK20         ((read32_machine_func)STATIC_BANK20)
394#define MRA32_BANK21         ((read32_machine_func)STATIC_BANK21)
395#define MRA32_BANK22         ((read32_machine_func)STATIC_BANK22)
396#define MRA32_BANK23         ((read32_machine_func)STATIC_BANK23)
397#define MRA32_BANK24         ((read32_machine_func)STATIC_BANK24)
398#define MRA32_BANK25         ((read32_machine_func)STATIC_BANK25)
399#define MRA32_BANK26         ((read32_machine_func)STATIC_BANK26)
400#define MRA32_BANK27         ((read32_machine_func)STATIC_BANK27)
401#define MRA32_BANK28         ((read32_machine_func)STATIC_BANK28)
402#define MRA32_BANK29         ((read32_machine_func)STATIC_BANK29)
403#define MRA32_BANK30         ((read32_machine_func)STATIC_BANK30)
404#define MRA32_BANK31         ((read32_machine_func)STATIC_BANK31)
405#define MRA32_BANK32         ((read32_machine_func)STATIC_BANK32)
406#define MRA32_RAM            ((read32_machine_func)STATIC_RAM)
407#define MRA32_ROM            ((read32_machine_func)STATIC_ROM)
408#define MRA32_NOP            ((read32_machine_func)STATIC_NOP)
409#define MRA32_UNMAP            ((read32_machine_func)STATIC_UNMAP)
390410
391411/* 32-bit writes */
392#define MWA32_BANK1            ((write32_handler)STATIC_BANK1)
393#define MWA32_BANK2            ((write32_handler)STATIC_BANK2)
394#define MWA32_BANK3            ((write32_handler)STATIC_BANK3)
395#define MWA32_BANK4            ((write32_handler)STATIC_BANK4)
396#define MWA32_BANK5            ((write32_handler)STATIC_BANK5)
397#define MWA32_BANK6            ((write32_handler)STATIC_BANK6)
398#define MWA32_BANK7            ((write32_handler)STATIC_BANK7)
399#define MWA32_BANK8            ((write32_handler)STATIC_BANK8)
400#define MWA32_BANK9            ((write32_handler)STATIC_BANK9)
401#define MWA32_BANK10         ((write32_handler)STATIC_BANK10)
402#define MWA32_BANK11         ((write32_handler)STATIC_BANK11)
403#define MWA32_BANK12         ((write32_handler)STATIC_BANK12)
404#define MWA32_BANK13         ((write32_handler)STATIC_BANK13)
405#define MWA32_BANK14         ((write32_handler)STATIC_BANK14)
406#define MWA32_BANK15         ((write32_handler)STATIC_BANK15)
407#define MWA32_BANK16         ((write32_handler)STATIC_BANK16)
408#define MWA32_BANK17         ((write32_handler)STATIC_BANK17)
409#define MWA32_BANK18         ((write32_handler)STATIC_BANK18)
410#define MWA32_BANK19         ((write32_handler)STATIC_BANK19)
411#define MWA32_BANK20         ((write32_handler)STATIC_BANK20)
412#define MWA32_BANK21         ((write32_handler)STATIC_BANK21)
413#define MWA32_BANK22         ((write32_handler)STATIC_BANK22)
414#define MWA32_BANK23         ((write32_handler)STATIC_BANK23)
415#define MWA32_BANK24         ((write32_handler)STATIC_BANK24)
416#define MWA32_BANK25         ((write32_handler)STATIC_BANK25)
417#define MWA32_BANK26         ((write32_handler)STATIC_BANK26)
418#define MWA32_BANK27         ((write32_handler)STATIC_BANK27)
419#define MWA32_BANK28         ((write32_handler)STATIC_BANK28)
420#define MWA32_BANK29         ((write32_handler)STATIC_BANK29)
421#define MWA32_BANK30         ((write32_handler)STATIC_BANK30)
422#define MWA32_BANK31         ((write32_handler)STATIC_BANK31)
423#define MWA32_BANK32         ((write32_handler)STATIC_BANK32)
424#define MWA32_RAM            ((write32_handler)STATIC_RAM)
425#define MWA32_ROM            ((write32_handler)STATIC_ROM)
426#define MWA32_NOP            ((write32_handler)STATIC_NOP)
427#define MWA32_UNMAP            ((write32_handler)STATIC_UNMAP)
412#define MWA32_BANK1            ((write32_machine_func)STATIC_BANK1)
413#define MWA32_BANK2            ((write32_machine_func)STATIC_BANK2)
414#define MWA32_BANK3            ((write32_machine_func)STATIC_BANK3)
415#define MWA32_BANK4            ((write32_machine_func)STATIC_BANK4)
416#define MWA32_BANK5            ((write32_machine_func)STATIC_BANK5)
417#define MWA32_BANK6            ((write32_machine_func)STATIC_BANK6)
418#define MWA32_BANK7            ((write32_machine_func)STATIC_BANK7)
419#define MWA32_BANK8            ((write32_machine_func)STATIC_BANK8)
420#define MWA32_BANK9            ((write32_machine_func)STATIC_BANK9)
421#define MWA32_BANK10         ((write32_machine_func)STATIC_BANK10)
422#define MWA32_BANK11         ((write32_machine_func)STATIC_BANK11)
423#define MWA32_BANK12         ((write32_machine_func)STATIC_BANK12)
424#define MWA32_BANK13         ((write32_machine_func)STATIC_BANK13)
425#define MWA32_BANK14         ((write32_machine_func)STATIC_BANK14)
426#define MWA32_BANK15         ((write32_machine_func)STATIC_BANK15)
427#define MWA32_BANK16         ((write32_machine_func)STATIC_BANK16)
428#define MWA32_BANK17         ((write32_machine_func)STATIC_BANK17)
429#define MWA32_BANK18         ((write32_machine_func)STATIC_BANK18)
430#define MWA32_BANK19         ((write32_machine_func)STATIC_BANK19)
431#define MWA32_BANK20         ((write32_machine_func)STATIC_BANK20)
432#define MWA32_BANK21         ((write32_machine_func)STATIC_BANK21)
433#define MWA32_BANK22         ((write32_machine_func)STATIC_BANK22)
434#define MWA32_BANK23         ((write32_machine_func)STATIC_BANK23)
435#define MWA32_BANK24         ((write32_machine_func)STATIC_BANK24)
436#define MWA32_BANK25         ((write32_machine_func)STATIC_BANK25)
437#define MWA32_BANK26         ((write32_machine_func)STATIC_BANK26)
438#define MWA32_BANK27         ((write32_machine_func)STATIC_BANK27)
439#define MWA32_BANK28         ((write32_machine_func)STATIC_BANK28)
440#define MWA32_BANK29         ((write32_machine_func)STATIC_BANK29)
441#define MWA32_BANK30         ((write32_machine_func)STATIC_BANK30)
442#define MWA32_BANK31         ((write32_machine_func)STATIC_BANK31)
443#define MWA32_BANK32         ((write32_machine_func)STATIC_BANK32)
444#define MWA32_RAM            ((write32_machine_func)STATIC_RAM)
445#define MWA32_ROM            ((write32_machine_func)STATIC_ROM)
446#define MWA32_NOP            ((write32_machine_func)STATIC_NOP)
447#define MWA32_UNMAP            ((write32_machine_func)STATIC_UNMAP)
428448
429449/* 64-bit reads */
430#define MRA64_BANK1            ((read64_handler)STATIC_BANK1)
431#define MRA64_BANK2            ((read64_handler)STATIC_BANK2)
432#define MRA64_BANK3            ((read64_handler)STATIC_BANK3)
433#define MRA64_BANK4            ((read64_handler)STATIC_BANK4)
434#define MRA64_BANK5            ((read64_handler)STATIC_BANK5)
435#define MRA64_BANK6            ((read64_handler)STATIC_BANK6)
436#define MRA64_BANK7            ((read64_handler)STATIC_BANK7)
437#define MRA64_BANK8            ((read64_handler)STATIC_BANK8)
438#define MRA64_BANK9            ((read64_handler)STATIC_BANK9)
439#define MRA64_BANK10         ((read64_handler)STATIC_BANK10)
440#define MRA64_BANK11         ((read64_handler)STATIC_BANK11)
441#define MRA64_BANK12         ((read64_handler)STATIC_BANK12)
442#define MRA64_BANK13         ((read64_handler)STATIC_BANK13)
443#define MRA64_BANK14         ((read64_handler)STATIC_BANK14)
444#define MRA64_BANK15         ((read64_handler)STATIC_BANK15)
445#define MRA64_BANK16         ((read64_handler)STATIC_BANK16)
446#define MRA64_BANK17         ((read64_handler)STATIC_BANK17)
447#define MRA64_BANK18         ((read64_handler)STATIC_BANK18)
448#define MRA64_BANK19         ((read64_handler)STATIC_BANK19)
449#define MRA64_BANK20         ((read64_handler)STATIC_BANK20)
450#define MRA64_BANK21         ((read64_handler)STATIC_BANK21)
451#define MRA64_BANK22         ((read64_handler)STATIC_BANK22)
452#define MRA64_BANK23         ((read64_handler)STATIC_BANK23)
453#define MRA64_BANK24         ((read64_handler)STATIC_BANK24)
454#define MRA64_BANK25         ((read64_handler)STATIC_BANK25)
455#define MRA64_BANK26         ((read64_handler)STATIC_BANK26)
456#define MRA64_BANK27         ((read64_handler)STATIC_BANK27)
457#define MRA64_BANK28         ((read64_handler)STATIC_BANK28)
458#define MRA64_BANK29         ((read64_handler)STATIC_BANK29)
459#define MRA64_BANK30         ((read64_handler)STATIC_BANK30)
460#define MRA64_BANK31         ((read64_handler)STATIC_BANK31)
461#define MRA64_BANK32         ((read64_handler)STATIC_BANK32)
462#define MRA64_RAM            ((read64_handler)STATIC_RAM)
463#define MRA64_ROM            ((read64_handler)STATIC_ROM)
464#define MRA64_NOP            ((read64_handler)STATIC_NOP)
465#define MRA64_UNMAP            ((read64_handler)STATIC_UNMAP)
450#define MRA64_BANK1            ((read64_machine_func)STATIC_BANK1)
451#define MRA64_BANK2            ((read64_machine_func)STATIC_BANK2)
452#define MRA64_BANK3            ((read64_machine_func)STATIC_BANK3)
453#define MRA64_BANK4            ((read64_machine_func)STATIC_BANK4)
454#define MRA64_BANK5            ((read64_machine_func)STATIC_BANK5)
455#define MRA64_BANK6            ((read64_machine_func)STATIC_BANK6)
456#define MRA64_BANK7            ((read64_machine_func)STATIC_BANK7)
457#define MRA64_BANK8            ((read64_machine_func)STATIC_BANK8)
458#define MRA64_BANK9            ((read64_machine_func)STATIC_BANK9)
459#define MRA64_BANK10         ((read64_machine_func)STATIC_BANK10)
460#define MRA64_BANK11         ((read64_machine_func)STATIC_BANK11)
461#define MRA64_BANK12         ((read64_machine_func)STATIC_BANK12)
462#define MRA64_BANK13         ((read64_machine_func)STATIC_BANK13)
463#define MRA64_BANK14         ((read64_machine_func)STATIC_BANK14)
464#define MRA64_BANK15         ((read64_machine_func)STATIC_BANK15)
465#define MRA64_BANK16         ((read64_machine_func)STATIC_BANK16)
466#define MRA64_BANK17         ((read64_machine_func)STATIC_BANK17)
467#define MRA64_BANK18         ((read64_machine_func)STATIC_BANK18)
468#define MRA64_BANK19         ((read64_machine_func)STATIC_BANK19)
469#define MRA64_BANK20         ((read64_machine_func)STATIC_BANK20)
470#define MRA64_BANK21         ((read64_machine_func)STATIC_BANK21)
471#define MRA64_BANK22         ((read64_machine_func)STATIC_BANK22)
472#define MRA64_BANK23         ((read64_machine_func)STATIC_BANK23)
473#define MRA64_BANK24         ((read64_machine_func)STATIC_BANK24)
474#define MRA64_BANK25         ((read64_machine_func)STATIC_BANK25)
475#define MRA64_BANK26         ((read64_machine_func)STATIC_BANK26)
476#define MRA64_BANK27         ((read64_machine_func)STATIC_BANK27)
477#define MRA64_BANK28         ((read64_machine_func)STATIC_BANK28)
478#define MRA64_BANK29         ((read64_machine_func)STATIC_BANK29)
479#define MRA64_BANK30         ((read64_machine_func)STATIC_BANK30)
480#define MRA64_BANK31         ((read64_machine_func)STATIC_BANK31)
481#define MRA64_BANK32         ((read64_machine_func)STATIC_BANK32)
482#define MRA64_RAM            ((read64_machine_func)STATIC_RAM)
483#define MRA64_ROM            ((read64_machine_func)STATIC_ROM)
484#define MRA64_NOP            ((read64_machine_func)STATIC_NOP)
485#define MRA64_UNMAP            ((read64_machine_func)STATIC_UNMAP)
466486
467487/* 64-bit writes */
468#define MWA64_BANK1            ((write64_handler)STATIC_BANK1)
469#define MWA64_BANK2            ((write64_handler)STATIC_BANK2)
470#define MWA64_BANK3            ((write64_handler)STATIC_BANK3)
471#define MWA64_BANK4            ((write64_handler)STATIC_BANK4)
472#define MWA64_BANK5            ((write64_handler)STATIC_BANK5)
473#define MWA64_BANK6            ((write64_handler)STATIC_BANK6)
474#define MWA64_BANK7            ((write64_handler)STATIC_BANK7)
475#define MWA64_BANK8            ((write64_handler)STATIC_BANK8)
476#define MWA64_BANK9            ((write64_handler)STATIC_BANK9)
477#define MWA64_BANK10         ((write64_handler)STATIC_BANK10)
478#define MWA64_BANK11         ((write64_handler)STATIC_BANK11)
479#define MWA64_BANK12         ((write64_handler)STATIC_BANK12)
480#define MWA64_BANK13         ((write64_handler)STATIC_BANK13)
481#define MWA64_BANK14         ((write64_handler)STATIC_BANK14)
482#define MWA64_BANK15         ((write64_handler)STATIC_BANK15)
483#define MWA64_BANK16         ((write64_handler)STATIC_BANK16)
484#define MWA64_BANK17         ((write64_handler)STATIC_BANK17)
485#define MWA64_BANK18         ((write64_handler)STATIC_BANK18)
486#define MWA64_BANK19         ((write64_handler)STATIC_BANK19)
487#define MWA64_BANK20         ((write64_handler)STATIC_BANK20)
488#define MWA64_BANK21         ((write64_handler)STATIC_BANK21)
489#define MWA64_BANK22         ((write64_handler)STATIC_BANK22)
490#define MWA64_BANK23         ((write64_handler)STATIC_BANK23)
491#define MWA64_BANK24         ((write64_handler)STATIC_BANK24)
492#define MWA64_BANK25         ((write64_handler)STATIC_BANK25)
493#define MWA64_BANK26         ((write64_handler)STATIC_BANK26)
494#define MWA64_BANK27         ((write64_handler)STATIC_BANK27)
495#define MWA64_BANK28         ((write64_handler)STATIC_BANK28)
496#define MWA64_BANK29         ((write64_handler)STATIC_BANK29)
497#define MWA64_BANK30         ((write64_handler)STATIC_BANK30)
498#define MWA64_BANK31         ((write64_handler)STATIC_BANK31)
499#define MWA64_BANK32         ((write64_handler)STATIC_BANK32)
500#define MWA64_RAM            ((write64_handler)STATIC_RAM)
501#define MWA64_ROM            ((write64_handler)STATIC_ROM)
502#define MWA64_NOP            ((write64_handler)STATIC_NOP)
503#define MWA64_UNMAP            ((write64_handler)STATIC_UNMAP)
488#define MWA64_BANK1            ((write64_machine_func)STATIC_BANK1)
489#define MWA64_BANK2            ((write64_machine_func)STATIC_BANK2)
490#define MWA64_BANK3            ((write64_machine_func)STATIC_BANK3)
491#define MWA64_BANK4            ((write64_machine_func)STATIC_BANK4)
492#define MWA64_BANK5            ((write64_machine_func)STATIC_BANK5)
493#define MWA64_BANK6            ((write64_machine_func)STATIC_BANK6)
494#define MWA64_BANK7            ((write64_machine_func)STATIC_BANK7)
495#define MWA64_BANK8            ((write64_machine_func)STATIC_BANK8)
496#define MWA64_BANK9            ((write64_machine_func)STATIC_BANK9)
497#define MWA64_BANK10         ((write64_machine_func)STATIC_BANK10)
498#define MWA64_BANK11         ((write64_machine_func)STATIC_BANK11)
499#define MWA64_BANK12         ((write64_machine_func)STATIC_BANK12)
500#define MWA64_BANK13         ((write64_machine_func)STATIC_BANK13)
501#define MWA64_BANK14         ((write64_machine_func)STATIC_BANK14)
502#define MWA64_BANK15         ((write64_machine_func)STATIC_BANK15)
503#define MWA64_BANK16         ((write64_machine_func)STATIC_BANK16)
504#define MWA64_BANK17         ((write64_machine_func)STATIC_BANK17)
505#define MWA64_BANK18         ((write64_machine_func)STATIC_BANK18)
506#define MWA64_BANK19         ((write64_machine_func)STATIC_BANK19)
507#define MWA64_BANK20         ((write64_machine_func)STATIC_BANK20)
508#define MWA64_BANK21         ((write64_machine_func)STATIC_BANK21)
509#define MWA64_BANK22         ((write64_machine_func)STATIC_BANK22)
510#define MWA64_BANK23         ((write64_machine_func)STATIC_BANK23)
511#define MWA64_BANK24         ((write64_machine_func)STATIC_BANK24)
512#define MWA64_BANK25         ((write64_machine_func)STATIC_BANK25)
513#define MWA64_BANK26         ((write64_machine_func)STATIC_BANK26)
514#define MWA64_BANK27         ((write64_machine_func)STATIC_BANK27)
515#define MWA64_BANK28         ((write64_machine_func)STATIC_BANK28)
516#define MWA64_BANK29         ((write64_machine_func)STATIC_BANK29)
517#define MWA64_BANK30         ((write64_machine_func)STATIC_BANK30)
518#define MWA64_BANK31         ((write64_machine_func)STATIC_BANK31)
519#define MWA64_BANK32         ((write64_machine_func)STATIC_BANK32)
520#define MWA64_RAM            ((write64_machine_func)STATIC_RAM)
521#define MWA64_ROM            ((write64_machine_func)STATIC_ROM)
522#define MWA64_NOP            ((write64_machine_func)STATIC_NOP)
523#define MWA64_UNMAP            ((write64_machine_func)STATIC_UNMAP)
504524
505525
506526
r1877r1878
524544typedef union _read_handlers read_handlers;
525545union _read_handlers
526546{
527   genf *            handler;
528   read8_handler      handler8;
529   read16_handler      handler16;
530   read32_handler      handler32;
531   read64_handler      handler64;
547   genf *               handler;
548   read8_machine_func      handler8;
549   read16_machine_func      handler16;
550   read32_machine_func      handler32;
551   read64_machine_func      handler64;
532552};
533553
534554/* ----- a union of all the different write handler types ----- */
535555typedef union _write_handlers write_handlers;
536556union _write_handlers
537557{
538   genf *            handler;
539   write8_handler      handler8;
540   write16_handler      handler16;
541   write32_handler      handler32;
542   write64_handler      handler64;
558   genf *               handler;
559   write8_machine_func      handler8;
560   write16_machine_func   handler16;
561   write32_machine_func   handler32;
562   write64_machine_func   handler64;
543563};
544564
545565/* ----- a generic address map type ----- */
r1877r1878
547567struct _address_map
548568{
549569   UINT32            flags;            /* flags and additional info about this entry */
550   offs_t            start, end;         /* start/end (or mask/match) values */
570   offs_t            start, end;         /* start/end values */
551571   offs_t            mirror;            /* mirror bits */
552572   offs_t            mask;            /* mask bits */
553573   read_handlers       read;            /* read handler callback */
554574   const char *      read_name;         /* read handler callback name */
575   device_type         read_devtype;      /* read device type for device references */
576   const char *      read_devtag;      /* read tag for the relevant device */
555577   write_handlers       write;            /* write handler callback */
556578   const char *      write_name;         /* write handler callback name */
579   device_type         write_devtype;      /* read device type for device references */
580   const char *      write_devtag;      /* read tag for the relevant device */
557581   void *            memory;            /* pointer to memory backing this entry */
558582   UINT32            share;            /* index of a shared memory block */
559583   void **            base;            /* receives pointer to memory (optional) */
r1877r1878
583607void construct_address_map(address_map *map, const machine_config *drv, int cpunum, int spacenum);
584608
585609/* ----- a typedef for pointers to these functions ----- */
586typedef address_map *(*construct_map_t)(address_map *map);
610typedef address_map *(*construct_map_t)(running_machine *machine, address_map *map);
587611
588612/* use this to declare external references to a machine driver */
589613#define ADDRESS_MAP_EXTERN(_name)                              \
590address_map *construct_map_##_name(address_map *map)               \
614address_map *construct_map_##_name(running_machine *machine, address_map *map)               \
591615
592616/* ----- macros for starting, ending, and setting map flags ----- */
593617#define ADDRESS_MAP_START(_name,_space,_bits)                     \
594address_map *construct_map_##_name(address_map *map)               \
618address_map *construct_map_##_name(running_machine *machine, address_map *map)               \
595619{                                                      \
596   extern read##_bits##_handler port_tag_to_handler##_bits(const char *); \
597   typedef read##_bits##_handler _rh_t;                        \
598   typedef write##_bits##_handler _wh_t;                        \
599   _rh_t read;                                             \
600   _wh_t write;                                          \
601   _rh_t (*port_tag_to_handler)(const char *) = port_tag_to_handler##_bits; \
620   extern read##_bits##_machine_func port_tag_to_handler##_bits(const char *); \
621   typedef read##_bits##_machine_func _rmf_t;                     \
622   typedef write##_bits##_machine_func _wmf_t;                     \
623   typedef read##_bits##_device_func _rdf_t;                     \
624   typedef write##_bits##_device_func _wdf_t;                     \
625   _rmf_t readm;                                          \
626   _wmf_t writem;                                          \
627   _rdf_t readd;                                          \
628   _wdf_t writed;                                          \
629   _rmf_t (*port_tag_to_handler)(const char *) = port_tag_to_handler##_bits; \
602630   UINT##_bits **base;                                       \
603631                                                      \
604   (void)read; (void)write; (void)base;                        \
605   (void)port_tag_to_handler; \
632   (void)readm; (void)writem; (void)readd; (void)writed; (void)base;   \
633   (void)port_tag_to_handler;                                  \
606634   map->flags = AM_FLAGS_EXTENDED;                              \
607635   map->start = AMEF_DBITS(_bits) | AMEF_SPACE(_space);            \
608636
r1877r1878
624652   map->start = (_start);                                    \
625653   map->end = (_end);                                       \
626654
627#define AM_SPACE(_match,_mask)                                 \
628   map++;                                                \
629   map->flags = AM_FLAGS_MATCH_MASK;                           \
630   map->start = (_match);                                    \
631   map->end = (_mask);                                       \
632
633655/* ----- these are optional entries after each map entry ----- */
634656#define AM_MASK(_mask)                                       \
635657   map->mask = (_mask);                                    \
r1877r1878
638660   map->mirror = (_mirror);                                 \
639661
640662#define AM_READ(_handler)                                    \
641   map->read.handler = (genf *)(read = _handler);                  \
663   map->read.handler = (genf *)(readm = _handler);                  \
642664   map->read_name = #_handler;                                 \
643665
644#define AM_READ_PORT(_tag) \
645   AM_READ((*port_tag_to_handler)(_tag))
666#define AM_READ_PORT(_tag)                                     \
667   AM_READ((*port_tag_to_handler)(_tag))                        \
646668
669#define AM_DEVREAD(_type, _tag, _handler)                        \
670   map->read.handler = (genf *)(readd = _handler);                  \
671   map->read_name = #_handler;                                 \
672   map->read_devtype = _type;                                 \
673   map->read_devtag = _tag;                                 \
674
647675#define AM_WRITE(_handler)                                    \
648   map->write.handler = (genf *)(write = _handler);               \
676   map->write.handler = (genf *)(writem = _handler);               \
649677   map->write_name = #_handler;                              \
650678
679#define AM_DEVWRITE(_type, _tag, _handler)                        \
680   map->write.handler = (genf *)(writed = _handler);               \
681   map->write_name = #_handler;                              \
682   map->write_devtype = _type;                                 \
683   map->write_devtag = _tag;                                 \
684
651685#define AM_REGION(_region, _offs)                              \
652686   map->region = (_region);                                 \
653687   map->region_offs = (_offs);                                 \
r1877r1878
659693   map->base = (void **)(base = _base);                        \
660694
661695#define AM_BASE_MEMBER(_struct, _member)                        \
662   if (Machine != NULL && Machine->driver_data != NULL)            \
663      map->base = (void **)(base = &((_struct *)Machine->driver_data)->_member);\
696   if (machine != NULL && machine->driver_data != NULL)            \
697      map->base = (void **)(base = &((_struct *)machine->driver_data)->_member);\
664698
665699#define AM_SIZE(_size)                                       \
666700   map->size = _size;                                       \
667701
668702#define AM_SIZE_MEMBER(_struct, _member)                        \
669   if (Machine != NULL && Machine->driver_data != NULL)            \
670      map->size = &((_struct *)Machine->driver_data)->_member;      \
703   if (machine != NULL && machine->driver_data != NULL)            \
704      map->size = &((_struct *)machine->driver_data)->_member;      \
671705
672706/* ----- common shortcuts ----- */
673707#define AM_READWRITE(_read,_write)         AM_READ(_read) AM_WRITE(_write)
674#define AM_ROM                        AM_READ((_rh_t)STATIC_ROM)
675#define AM_RAM                        AM_READWRITE((_rh_t)STATIC_RAM, (_wh_t)STATIC_RAM)
676#define AM_WRITEONLY                  AM_WRITE((_wh_t)STATIC_RAM)
677#define AM_UNMAP                     AM_READWRITE((_rh_t)STATIC_UNMAP, (_wh_t)STATIC_UNMAP)
678#define AM_ROMBANK(_bank)               AM_READ((_rh_t)(STATIC_BANK1 + (_bank) - 1))
679#define AM_RAMBANK(_bank)               AM_READWRITE((_rh_t)(STATIC_BANK1 + (_bank) - 1), (_wh_t)(STATIC_BANK1 + (_bank) - 1))
680#define AM_NOP                        AM_READWRITE((_rh_t)STATIC_NOP, (_wh_t)STATIC_NOP)
681#define AM_READNOP                     AM_READ((_rh_t)STATIC_NOP)
682#define AM_WRITENOP                     AM_WRITE((_wh_t)STATIC_NOP)
708#define AM_DEVREADWRITE(_type,_tag,_read,_write) AM_DEVREAD(_type,_tag,_read) AM_DEVWRITE(_type,_tag,_write)
709#define AM_ROM                        AM_READ((_rmf_t)STATIC_ROM)
710#define AM_RAM                        AM_READWRITE((_rmf_t)STATIC_RAM, (_wmf_t)STATIC_RAM)
711#define AM_WRITEONLY                  AM_WRITE((_wmf_t)STATIC_RAM)
712#define AM_UNMAP                     AM_READWRITE((_rmf_t)STATIC_UNMAP, (_wmf_t)STATIC_UNMAP)
713#define AM_ROMBANK(_bank)               AM_READ((_rmf_t)(STATIC_BANK1 + (_bank) - 1))
714#define AM_RAMBANK(_bank)               AM_READWRITE((_rmf_t)(STATIC_BANK1 + (_bank) - 1), (_wmf_t)(STATIC_BANK1 + (_bank) - 1))
715#define AM_NOP                        AM_READWRITE((_rmf_t)STATIC_NOP, (_wmf_t)STATIC_NOP)
716#define AM_READNOP                     AM_READ((_rmf_t)STATIC_NOP)
717#define AM_WRITENOP                     AM_WRITE((_wmf_t)STATIC_NOP)
683718
684719
685720
r1877r1878
689724
690725/* ----- macros for identifying address map struct markers ----- */
691726#define IS_AMENTRY_EXTENDED(ma)            (((ma)->flags & AM_FLAGS_EXTENDED) != 0)
692#define IS_AMENTRY_MATCH_MASK(ma)         (((ma)->flags & AM_FLAGS_MATCH_MASK) != 0)
693727#define IS_AMENTRY_END(ma)               (((ma)->flags & AM_FLAGS_END) != 0)
694728
695729#define AM_EXTENDED_FLAGS(ma)            ((ma)->start)
r1877r1878
919953const address_map *memory_get_map(int cpunum, int spacenum);
920954
921955/* ----- opcode base control ---- */
922opbase_handler memory_set_opbase_handler(int cpunum, opbase_handler function);
956opbase_handler_func memory_set_opbase_handler(int cpunum, opbase_handler_func function);
923957void      memory_set_opbase(offs_t offset);
924958
925959/* ----- separate opcode/data encryption helper ---- */
r1877r1878
944978
945979/* ----- dynamic address space mapping ----- */
946980void *      _memory_install_read_handler   (int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, FPTR handler, const char *handler_name);
947UINT8 *      _memory_install_read8_handler  (int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_handler handler, const char *handler_name);
948UINT16 *   _memory_install_read16_handler (int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read16_handler handler, const char *handler_name);
949UINT32 *   _memory_install_read32_handler (int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read32_handler handler, const char *handler_name);
950UINT64 *   _memory_install_read64_handler (int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read64_handler handler, const char *handler_name);
981UINT8 *      _memory_install_read8_handler  (int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_machine_func handler, const char *handler_name);
982UINT16 *   _memory_install_read16_handler (int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read16_machine_func handler, const char *handler_name);
983UINT32 *   _memory_install_read32_handler (int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read32_machine_func handler, const char *handler_name);
984UINT64 *   _memory_install_read64_handler (int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read64_machine_func handler, const char *handler_name);
951985void *      _memory_install_write_handler  (int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, FPTR handler, const char *handler_name);
952UINT8 *      _memory_install_write8_handler (int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, write8_handler handler, const char *handler_name);
953UINT16 *   _memory_install_write16_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, write16_handler handler, const char *handler_name);
954UINT32 *   _memory_install_write32_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, write32_handler handler, const char *handler_name);
955UINT64 *   _memory_install_write64_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, write64_handler handler, const char *handler_name);
986UINT8 *      _memory_install_write8_handler (int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, write8_machine_func handler, const char *handler_name);
987UINT16 *   _memory_install_write16_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, write16_machine_func handler, const char *handler_name);
988UINT32 *   _memory_install_write32_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, write32_machine_func handler, const char *handler_name);
989UINT64 *   _memory_install_write64_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, write64_machine_func handler, const char *handler_name);
956990void *      _memory_install_readwrite_handler  (int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, FPTR rhandler, FPTR whandler, const char *rhandler_name, const char *whandler_name);
957UINT8 *      _memory_install_readwrite8_handler (int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_handler rhandler, write8_handler whandler, const char *rhandler_name, const char *whandler_name);
958UINT16 *   _memory_install_readwrite16_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read16_handler rhandler, write16_handler whandler, const char *rhandler_name, const char *whandler_name);
959UINT32 *   _memory_install_readwrite32_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read32_handler rhandler, write32_handler whandler, const char *rhandler_name, const char *whandler_name);
960UINT64 *   _memory_install_readwrite64_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read64_handler rhandler, write64_handler whandler, const char *rhandler_name, const char *whandler_name);
991UINT8 *      _memory_install_readwrite8_handler (int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_machine_func rhandler, write8_machine_func whandler, const char *rhandler_name, const char *whandler_name);
992UINT16 *   _memory_install_readwrite16_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read16_machine_func rhandler, write16_machine_func whandler, const char *rhandler_name, const char *whandler_name);
993UINT32 *   _memory_install_readwrite32_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read32_machine_func rhandler, write32_machine_func whandler, const char *rhandler_name, const char *whandler_name);
994UINT64 *   _memory_install_readwrite64_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read64_machine_func rhandler, write64_machine_func whandler, const char *rhandler_name, const char *whandler_name);
961995
962void *      _memory_install_read_matchmask_handler   (int cpunum, int spacenum, offs_t matchval, offs_t maskval, offs_t mask, offs_t mirror, FPTR handler, const char *handler_name);
963UINT8 *      _memory_install_read8_matchmask_handler  (int cpunum, int spacenum, offs_t matchval, offs_t maskval, offs_t mask, offs_t mirror, read8_handler handler, const char *handler_name);
964UINT16 *   _memory_install_read16_matchmask_handler (int cpunum, int spacenum, offs_t matchval, offs_t maskval, offs_t mask, offs_t mirror, read16_handler handler, const char *handler_name);
965UINT32 *   _memory_install_read32_matchmask_handler (int cpunum, int spacenum, offs_t matchval, offs_t maskval, offs_t mask, offs_t mirror, read32_handler handler, const char *handler_name);
966UINT64 *   _memory_install_read64_matchmask_handler (int cpunum, int spacenum, offs_t matchval, offs_t maskval, offs_t mask, offs_t mirror, read64_handler handler, const char *handler_name);
967void *      _memory_install_write_matchmask_handler  (int cpunum, int spacenum, offs_t matchval, offs_t maskval, offs_t mask, offs_t mirror, FPTR handler, const char *handler_name);
968UINT8 *      _memory_install_write8_matchmask_handler (int cpunum, int spacenum, offs_t matchval, offs_t maskval, offs_t mask, offs_t mirror, write8_handler handler, const char *handler_name);
969UINT16 *   _memory_install_write16_matchmask_handler(int cpunum, int spacenum, offs_t matchval, offs_t maskval, offs_t mask, offs_t mirror, write16_handler handler, const char *handler_name);
970UINT32 *   _memory_install_write32_matchmask_handler(int cpunum, int spacenum, offs_t matchval, offs_t maskval, offs_t mask, offs_t mirror, write32_handler handler, const char *handler_name);
971UINT64 *   _memory_install_write64_matchmask_handler(int cpunum, int spacenum, offs_t matchval, offs_t maskval, offs_t mask, offs_t mirror, write64_handler handler, const char *handler_name);
972
973996/* ----- memory debugging ----- */
974997void       memory_dump(FILE *file);
975998const char *memory_get_handler_string(int read0_or_write1, int cpunum, int spacenum, offs_t offset);
r1877r1878
10471070#define memory_install_readwrite64_handler(cpu, space, start, end, mask, mirror, rhandler, whandler)      \
10481071   _memory_install_readwrite64_handler(cpu, space, start, end, mask, mirror, rhandler, whandler, #rhandler, #whandler)
10491072
1050#define memory_install_read_matchmask_handler(cpu, space, start, end, mask, mirror, handler)         \
1051   _memory_install_read_matchmask_handler(cpu, space, start, end, mask, mirror, handler, #handler)
1052#define memory_install_read8_matchmask_handler(cpu, space, start, end, mask, mirror, handler)         \
1053   _memory_install_read8_matchmask_handler(cpu, space, start, end, mask, mirror, handler, #handler)
1054#define memory_install_read16_matchmask_handler(cpu, space, start, end, mask, mirror, handler)         \
1055   _memory_install_read16_matchmask_handler(cpu, space, start, end, mask, mirror, handler, #handler)
1056#define memory_install_read32_matchmask_handler(cpu, space, start, end, mask, mirror, handler)         \
1057   _memory_install_read32_matchmask_handler(cpu, space, start, end, mask, mirror, handler, #handler)
1058#define memory_install_read64_matchmask_handler(cpu, space, start, end, mask, mirror, handler)         \
1059   _memory_install_read64_matchmask_handler(cpu, space, start, end, mask, mirror, handler, #handler)
1060
1061#define memory_install_write_matchmask_handler(cpu, space, start, end, mask, mirror, handler)         \
1062   _memory_install_write_matchmask_handler(cpu, space, start, end, mask, mirror, handler, #handler)
1063#define memory_install_write8_matchmask_handler(cpu, space, start, end, mask, mirror, handler)         \
1064   _memory_install_write8_matchmask_handler(cpu, space, start, end, mask, mirror, handler, #handler)
1065#define memory_install_write16_matchmask_handler(cpu, space, start, end, mask, mirror, handler)         \
1066   _memory_install_write16_matchmask_handler(cpu, space, start, end, mask, mirror, handler, #handler)
1067#define memory_install_write32_matchmask_handler(cpu, space, start, end, mask, mirror, handler)         \
1068   _memory_install_write32_matchmask_handler(cpu, space, start, end, mask, mirror, handler, #handler)
1069#define memory_install_write64_matchmask_handler(cpu, space, start, end, mask, mirror, handler)         \
1070   _memory_install_write64_matchmask_handler(cpu, space, start, end, mask, mirror, handler, #handler)
1071
10721073/* ----- generic memory access ----- */
10731074INLINE UINT8  program_read_byte (offs_t offset) { return (*active_address_space[ADDRESS_SPACE_PROGRAM].accessors->read_byte)(offset); }
10741075INLINE UINT16 program_read_word (offs_t offset) { return (*active_address_space[ADDRESS_SPACE_PROGRAM].accessors->read_word)(offset); }
src/emu/mame.c
r1877r1878
4646                - calls rom_init() [romload.c] to load the game's ROMs
4747                - calls memory_init() [memory.c] to process the game's memory maps
4848                - calls cpuexec_init() [cpuexec.c] to initialize the CPUs
49                - calls watchdog_init() [watchdog.c] to initialize the watchdog system
4950                - calls cpuint_init() [cpuint.c] to initialize the CPU interrupts
50                - calls mame_debug_init() [debugcpu.c] to set up the debugger
5151                - calls the driver's DRIVER_INIT callback
5252                - calls video_init() [video.c] to start the video system
5353                - calls sound_init() [sound.c] to start the audio system
54                - calls mame_debug_init() [debugcpu.c] to set up the debugger
5455                - calls the driver's MACHINE_START, SOUND_START, and VIDEO_START callbacks
5556                - disposes of regions marked as disposable
5657                - calls saveload_init() [mame.c] to set up for save/load
r1877r1878
188189static UINT8 started_empty;
189190
190191/* output channels */
191static output_callback output_cb[OUTPUT_CHANNEL_COUNT];
192static output_callback_func output_cb[OUTPUT_CHANNEL_COUNT];
192193static void *output_cb_param[OUTPUT_CHANNEL_COUNT];
193194
194195/* the "disclaimer" that should be printed when run with no parameters */
r1877r1878
930931    channel
931932-------------------------------------------------*/
932933
933void mame_set_output_channel(output_channel channel, output_callback callback, void *param, output_callback *prevcb, void **prevparam)
934void mame_set_output_channel(output_channel channel, output_callback_func callback, void *param, output_callback_func *prevcb, void **prevparam)
934935{
935936   assert(channel < OUTPUT_CHANNEL_COUNT);
936937   assert(callback != NULL);
r1877r1878
15661567   rom_init(machine, machine->gamedrv->rom);
15671568   memory_init(machine);
15681569   cpuexec_init(machine);
1570   watchdog_init(machine);
15691571   cpuint_init(machine);
15701572
15711573#ifdef MESS
r1877r1878
15731575   devices_init(machine);
15741576#endif
15751577
1576#ifdef ENABLE_DEBUGGER
1577   /* initialize the debugger */
1578   if (machine->debug_mode)
1579      mame_debug_init(machine);
1580#endif
1581
15821578   /* call the game driver's init function */
15831579   /* this is where decryption is done and memory maps are altered */
15841580   /* so this location in the init order is important */
r1877r1878
15931589   device_list_start(machine);
15941590
15951591   sound_init(machine);
1592   input_port_post_init(machine);
15961593
1594#ifdef ENABLE_DEBUGGER
1595   /* initialize the debugger */
1596   if (machine->debug_mode)
1597      mame_debug_init(machine);
1598#endif
1599
15971600   /* call the driver's _START callbacks */
15981601   if (machine->config->machine_start != NULL) (*machine->config->machine_start)(machine);
15991602   if (machine->config->sound_start != NULL) (*machine->config->sound_start)(machine);
src/emu/inptport.c
r1877r1878
169169};
170170
171171
172typedef struct _changed_port_info changed_port_info;
173struct _changed_port_info
174{
175   changed_port_info *   next;      /* linked list */
176   input_port_entry *   port;      /* pointer to the input port referenced */
177   UINT8            shift;      /* right shift to apply before calling callback */
178};
179
180
172181typedef struct _input_bit_info input_bit_info;
173182struct _input_bit_info
174183{
r1877r1878
178187};
179188
180189
181typedef struct _changed_callback_info changed_callback_info;
182struct _changed_callback_info
183{
184   changed_callback_info *next;   /* linked list */
185   UINT32            mask;      /* mask we care about */
186   input_port_changed_func callback;/* callback */
187   void *            param;      /* parameter */
188};
189
190
191190typedef struct _input_port_info input_port_info;
192191struct _input_port_info
193192{
r1877r1878
202201   input_bit_info       bit[MAX_BITS_PER_PORT]; /* info about each bit in the port */
203202   analog_port_info *   analoginfo;   /* pointer to linked list of analog port info */
204203   custom_port_info *   custominfo;   /* pointer to linked list of custom port info */
205   changed_callback_info *change_notify;/* list of people to notify if things change */
206   UINT32            changed_last_value;
204   changed_port_info *   changedinfo;/* pointer to linked list of changed port info */
207205};
208206
209207
r1877r1878
276274    PORT HANDLER TABLES
277275***************************************************************************/
278276
279static const read8_handler port_handler8[] =
277static const read8_machine_func port_handler8[] =
280278{
281279   input_port_0_r,         input_port_1_r,         input_port_2_r,         input_port_3_r,
282280   input_port_4_r,         input_port_5_r,         input_port_6_r,         input_port_7_r,
r1877r1878
289287};
290288
291289
292static const read16_handler port_handler16[] =
290static const read16_machine_func port_handler16[] =
293291{
294292   input_port_0_word_r,   input_port_1_word_r,   input_port_2_word_r,   input_port_3_word_r,
295293   input_port_4_word_r,   input_port_5_word_r,   input_port_6_word_r,   input_port_7_word_r,
r1877r1878
302300};
303301
304302
305static const read32_handler port_handler32[] =
303static const read32_machine_func port_handler32[] =
306304{
307305   input_port_0_dword_r,   input_port_1_dword_r,   input_port_2_dword_r,   input_port_3_dword_r,
308306   input_port_4_dword_r,   input_port_5_dword_r,   input_port_6_dword_r,   input_port_7_dword_r,
r1877r1878
10341032    FUNCTION PROTOTYPES
10351033***************************************************************************/
10361034
1035static void on_vblank(running_machine *machine, screen_state *screen, int vblank_state);
10371036static void setup_playback(running_machine *machine);
10381037static void setup_record(running_machine *machine);
10391038static void input_port_exit(running_machine *machine);
10401039static void input_port_load(int config_type, xml_data_node *parentnode);
10411040static void input_port_save(int config_type, xml_data_node *parentnode);
1041static void input_port_vblank_start(running_machine *machine);
1042static void input_port_vblank_end(void);
10421043static void update_digital_joysticks(void);
10431044static void update_analog_port(int port);
10441045static void interpolate_analog_port(int port);
r1877r1878
11381139}
11391140
11401141
1142void input_port_post_init(running_machine *machine)
1143{
1144   /* set up callback for updating the ports */
1145   video_screen_register_vbl_cb(machine, NULL, on_vblank);
1146}
1147
1148
1149
11411150/*************************************
11421151 *
1152 *  VBLANK handler
1153 *
1154 *************************************/
1155
1156static void on_vblank(running_machine *machine, screen_state *screen, int vblank_state)
1157{
1158   /* VBLANK starting - read keyboard & update the status of the input ports */
1159   if (vblank_state)
1160      input_port_vblank_start(machine);
1161
1162   /* VBLANK ending - update IPT_VBLANK input ports */
1163   else
1164      input_port_vblank_end();
1165}
1166
1167
1168
1169/*************************************
1170 *
11431171 *  Set up for playback
11441172 *
11451173 *************************************/
r1877r1878
13111339            port_info[portnum].custominfo = info;
13121340         }
13131341
1342         /* if this is a changed input, add it to the list */
1343         else if (port->changed != NULL)
1344         {
1345            changed_port_info *info;
1346
1347            /* allocate memory */
1348            info = auto_malloc(sizeof(*info));
1349            memset(info, 0, sizeof(*info));
1350
1351            /* fill in the data */
1352            info->port = port;
1353            for (mask = port->mask; !(mask & 1); mask >>= 1)
1354               info->shift++;
1355
1356            /* hook in the list */
1357            info->next = port_info[portnum].changedinfo;
1358            port_info[portnum].changedinfo = info;
1359         }
1360
13141361         /* if this is an analog port, create an info struct for it */
13151362         else if (IS_ANALOG(port))
13161363         {
r1877r1878
14921539   }
14931540
14941541   /* run an initial update */
1495   input_port_vblank_start();
1542   input_port_vblank_start(Machine);
14961543}
14971544
14981545
r1877r1878
15291576 *
15301577 *************************************/
15311578
1579#ifdef UNUSED_FUNCTION
15321580INLINE input_code get_default_code(int config_type, int type)
15331581{
15341582   switch (type)
r1877r1878
15451593   }
15461594   return SEQCODE_END;
15471595}
1596#endif
15481597
15491598
15501599INLINE int string_to_seq_index(const char *string)
r1877r1878
21092158            port->custom_param = (void *)TOKEN_GET_PTR(ipt, voidptr);
21102159            break;
21112160
2161         /* changed callbacks */
2162         case INPUT_TOKEN_CHANGED:
2163            port->changed = TOKEN_GET_PTR(ipt, changedptr);
2164            port->changed_param = (void *)TOKEN_GET_PTR(ipt, voidptr);
2165            break;
2166
21122167         /* dip switch definition */
21132168         case INPUT_TOKEN_DIPNAME:
21142169            TOKEN_GET_UINT64_UNPACK2(ipt, mask, 32, defval, 32);
r1877r1878
25202575}
25212576
25222577
2523read8_handler port_tag_to_handler8(const char *tag)
2578read8_machine_func port_tag_to_handler8(const char *tag)
25242579{
25252580   int port = port_tag_to_index(tag);
25262581   return (port == -1) ? MRA8_NOP : port_handler8[port];
25272582}
25282583
25292584
2530read16_handler port_tag_to_handler16(const char *tag)
2585read16_machine_func port_tag_to_handler16(const char *tag)
25312586{
25322587   int port = port_tag_to_index(tag);
25332588   return (port == -1) ? MRA16_NOP : port_handler16[port];
25342589}
25352590
25362591
2537read32_handler port_tag_to_handler32(const char *tag)
2592read32_machine_func port_tag_to_handler32(const char *tag)
25382593{
25392594   int port = port_tag_to_index(tag);
25402595   return (port == -1) ? MRA32_NOP : port_handler32[port];
25412596}
25422597
25432598
2544read64_handler port_tag_to_handler64(const char *tag)
2599read64_machine_func port_tag_to_handler64(const char *tag)
25452600{
25462601   return MRA64_NOP;
25472602}
r1877r1878
28252880 *
28262881 *************************************/
28272882
2828void input_port_vblank_start(void)
2883static void input_port_vblank_start(running_machine *machine)
28292884{
28302885   int ui_visible = ui_is_menu_active() || ui_is_slider_active();
28312886   int portnum, bitnum;
r1877r1878
28432898   {
28442899      input_port_info *portinfo = &port_info[portnum];
28452900      input_bit_info *info;
2901      changed_port_info *changed;
28462902
28472903      /* compute the VBLANK mask */
28482904      portinfo->vblank = 0;
r1877r1878
28502906         if (info->port->type == IPT_VBLANK)
28512907         {
28522908            portinfo->vblank ^= info->port->mask;
2853            if (Machine->screen[0].vblank == 0)
2909            if (machine->screen[0].vblank == 0)
28542910               logerror("Warning: you are using IPT_VBLANK with vblank_time = 0. You need to increase vblank_time for IPT_VBLANK to work.\n");
28552911         }
28562912
r1877r1878
29372993
29382994            /* note that analog ports are handled instantaneously at port read time */
29392995         }
2996
2997      /* call changed handlers */
2998      for (changed = portinfo->changedinfo; changed; changed = changed->next)
2999         if (input_port_condition(changed->port))
3000         {
3001            input_port_entry *port = changed->port;
3002
3003            UINT32 new_unmasked_value = readinputport(portnum);
3004            UINT32 newval = (new_unmasked_value       & port->mask) >> changed->shift;
3005            UINT32 oldval = (port->changed_last_value & port->mask) >> changed->shift;
3006
3007            if (newval != oldval)
3008               (*port->changed)(machine, port->changed_param, oldval, newval);
3009
3010            port->changed_last_value = new_unmasked_value;
3011         }
29403012   }
29413013
29423014#ifdef MESS
r1877r1878
29443016   inputx_update();
29453017#endif
29463018
2947   /* call changed handlers */
2948   for (portnum = 0; portnum < MAX_INPUT_PORTS; portnum++)
2949      if (port_info[portnum].change_notify != NULL)
2950      {
2951         changed_callback_info *cbinfo;
2952         UINT32 newvalue = readinputport(portnum);
2953         UINT32 oldvalue = port_info[portnum].changed_last_value;
2954         UINT32 delta = newvalue ^ oldvalue;
2955
2956         /* call all the callbacks whose mask matches the requested mask */
2957         for (cbinfo = port_info[portnum].change_notify; cbinfo; cbinfo = cbinfo->next)
2958            if (delta & cbinfo->mask)
2959               (*cbinfo->callback)(cbinfo->param, oldvalue & cbinfo->mask, newvalue & cbinfo->mask);
2960
2961         port_info[portnum].changed_last_value = newvalue;
2962      }
2963
29643019   /* handle playback/record */
29653020   for (portnum = 0; portnum < MAX_INPUT_PORTS; portnum++)
29663021   {
r1877r1878
29743029   }
29753030
29763031   /* store speed read from INP file, if extended INP */
2977   if (Machine->playback_file != NULL && extended_inp)
3032   if (machine->playback_file != NULL && extended_inp)
29783033   {
29793034      UINT32 dummy;
2980      mame_fread(Machine->playback_file, &rec_speed, sizeof(rec_speed));
2981      mame_fread(Machine->playback_file, &dummy, sizeof(dummy));
3035      mame_fread(machine->playback_file, &rec_speed, sizeof(rec_speed));
3036      mame_fread(machine->playback_file, &dummy, sizeof(dummy));
29823037      framecount++;
29833038      rec_speed *= 100;
29843039      totalspeed += rec_speed;
r1877r1878
29953050 *
29963051 *************************************/
29973052
2998void input_port_vblank_end(void)
3053static void input_port_vblank_end(void)
29993054{
30003055   int ui_visible = ui_is_menu_active() || ui_is_slider_active();
30013056   int port;
r1877r1878
33943449         /* replace the bits with bits from the custom routine */
33953450         input_port_entry *port = custom->port;
33963451         portinfo->digital &= ~port->mask;
3397         portinfo->digital |= ((*port->custom)(port->custom_param) << custom->shift) & port->mask;
3452         portinfo->digital |= ((*port->custom)(Machine, port->custom_param) << custom->shift) & port->mask;
33983453      }
33993454
34003455   /* compute the current result: default value XOR the digital, merged with the analog */
r1877r1878
34153470      result = (result & ~portinfo->vblank) | (portinfo->defvalue & portinfo->vblank);
34163471
34173472      /* toggle VBLANK if we're in a VBLANK state */
3418      if (Machine->screen[0].oldstyle_vblank_supplied)
3419      {
3420         int cpu_getvblank(void);
3421
3422         if (cpu_getvblank())
3423            result ^= portinfo->vblank;
3424      }
3425      else
3426      {
3427         if (video_screen_get_vblank(0))
3428            result ^= portinfo->vblank;
3429      }
3473      if (video_screen_get_vblank(0))
3474         result ^= portinfo->vblank;
34303475   }
34313476   return result;
34323477}
r1877r1878
34713516
34723517/*************************************
34733518 *
3474 *  Input port callbacks
3475 *
3476 *************************************/
3477
3478void input_port_set_changed_callback(int port, UINT32 mask, void (*callback)(void *, UINT32, UINT32), void *param)
3479{
3480   input_port_info *portinfo = &port_info[port];
3481   changed_callback_info *cbinfo;
3482
3483   assert_always(mame_get_phase(Machine) == MAME_PHASE_INIT, "Can only call input_port_set_changed_callback() at init time!");
3484   assert_always((port >= 0) && (port < MAX_INPUT_PORTS), "Invalid port number passed to input_port_set_changed_callback()!");
3485
3486   cbinfo = auto_malloc(sizeof(*cbinfo));
3487   cbinfo->next = portinfo->change_notify;
3488   cbinfo->mask = mask;
3489   cbinfo->callback = callback;
3490   cbinfo->param = param;
3491
3492   portinfo->change_notify = cbinfo;
3493}
3494
3495
3496
3497/*************************************
3498 *
34993519 *  Return position of crosshair axis
35003520 *
35013521 *************************************/
src/emu/rendfont.c
r1877r1878
4141   INT32            xoffs, yoffs;      /* X and Y offset from baseline to top,left of bitmap */
4242   INT32            bmwidth, bmheight;   /* width and height of bitmap */
4343   const char *      rawdata;         /* pointer to the raw data for this one */
44   mame_bitmap *      bitmap;            /* pointer to the bitmap containing the raw data */
44   bitmap_t *         bitmap;            /* pointer to the bitmap containing the raw data */
4545   render_texture *   texture;         /* pointer to a texture for rendering and sizing */
4646};
4747
r1877r1878
320320    string to a bitmap
321321-------------------------------------------------*/
322322
323void render_font_get_scaled_bitmap_and_bounds(render_font *font, mame_bitmap *dest, float height, float aspect, unicode_char chnum, rectangle *bounds)
323void render_font_get_scaled_bitmap_and_bounds(render_font *font, bitmap_t *dest, float height, float aspect, unicode_char chnum, rectangle *bounds)
324324{
325325   render_font_char *ch = get_char(font, chnum);
326326   float scale = font->scale * height;
src/emu/devintrf.c
r1877r1878
319319
320320
321321/*-------------------------------------------------
322    device_list_class_first - return the first
322    device_list_class_first - return the first
323323    device in the list of a given class
324324-------------------------------------------------*/
325325
r1877r1878
337337
338338
339339/*-------------------------------------------------
340    device_list_class_next - return the next
340    device_list_class_next - return the next
341341    device in the list of a given class
342342-------------------------------------------------*/
343343
r1877r1878
357357
358358
359359/*-------------------------------------------------
360    device_list_class_find_by_tag - retrieve a
360    device_list_class_find_by_tag - retrieve a
361361    device configuration based on a class and tag
362362-------------------------------------------------*/
363363
r1877r1878
401401
402402
403403/*-------------------------------------------------
404    device_list_class_find_by_index - retrieve a
405    device configuration based on a class and
404    device_list_class_find_by_index - retrieve a
405    device configuration based on a class and
406406    index
407407-------------------------------------------------*/
408408
r1877r1878
446446      assert(config->start != NULL);
447447
448448      /* call the start function */
449      config->machine = machine;
449450      config->token = (*config->start)(machine, config->tag, config->static_config, config->inline_config);
450451      assert(config->token != NULL);
451452
r1877r1878
477478
478479      /* clear the token to indicate we are finished */
479480      config->token = NULL;
481      config->machine = NULL;
480482   }
481483}
482484
src/emu/eigccppc.h
r1877r1878
4242-------------------------------------------------*/
4343
4444#define mul_32x32_hi _mul_32x32_hi
45INLINE INT32 __attribute__((const, always_inline))
45INLINE INT32 ATTR_CONST ATTR_FORCE_INLINE
4646_mul_32x32_hi(INT32 val1, INT32 val2)
4747{
4848   register INT32 result;
r1877r1878
6565-------------------------------------------------*/
6666
6767#define mulu_32x32_hi _mulu_32x32_hi
68INLINE UINT32 __attribute__((const, always_inline))
68INLINE UINT32 ATTR_CONST ATTR_FORCE_INLINE
6969_mulu_32x32_hi(UINT32 val1, UINT32 val2)
7070{
7171   register UINT32 result;
r1877r1878
9090
9191#if !defined(__ppc64__) && !defined(__PPC64__) && !defined(_ARCH_PPC64)
9292#define mul_32x32_shift _mul_32x32_shift
93INLINE INT32 __attribute__((const, always_inline))
93INLINE INT32 ATTR_CONST ATTR_FORCE_INLINE
9494_mul_32x32_shift(INT32 val1, INT32 val2, UINT8 shift)
9595{
9696   register INT32 result;
r1877r1878
124124
125125#if !defined(__ppc64__) && !defined(__PPC64__) && !defined(_ARCH_PPC64)
126126#define mulu_32x32_shift _mulu_32x32_shift
127INLINE UINT32 __attribute__((const, always_inline))
127INLINE UINT32 ATTR_CONST ATTR_FORCE_INLINE
128128_mulu_32x32_shift(UINT32 val1, UINT32 val2, UINT8 shift)
129129{
130130   register UINT32 result;
r1877r1878
223223-------------------------------------------------*/
224224
225225#define recip_approx _recip_approx
226INLINE float __attribute__((const, always_inline))
226INLINE float ATTR_CONST ATTR_FORCE_INLINE
227227_recip_approx(float value)
228228{
229229   register float result;
r1877r1878
249249-------------------------------------------------*/
250250
251251#define count_leading_zeros _count_leading_zeros
252INLINE UINT8 __attribute__((const, always_inline))
252INLINE UINT8 ATTR_CONST ATTR_FORCE_INLINE
253253_count_leading_zeros(UINT32 value)
254254{
255255   register UINT32 result;
r1877r1878
270270-------------------------------------------------*/
271271
272272#define count_leading_ones _count_leading_ones
273INLINE UINT8 __attribute__((const, always_inline))
273INLINE UINT8 ATTR_CONST ATTR_FORCE_INLINE
274274_count_leading_ones(UINT32 value)
275275{
276276   register UINT32 result;
r1877r1878
299299-------------------------------------------------*/
300300
301301#define compare_exchange32 _compare_exchange32
302INLINE INT32 __attribute__((nonnull(1), always_inline))
302INLINE INT32 ATTR_NONNULL ATTR_FORCE_INLINE
303303_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange)
304304{
305305   register INT32 result;
r1877r1878
333333
334334#if defined(__ppc64__) || defined(__PPC64__)
335335#define compare_exchange64 _compare_exchange64
336INLINE INT64 __attribute__((nonnull(1), always_inline))
336INLINE INT64 ATTR_NONNULL ATTR_FORCE_INLINE
337337_compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange)
338338{
339339   register INT64 result;
r1877r1878
365365-------------------------------------------------*/
366366
367367#define atomic_exchange32 _atomic_exchange32
368INLINE INT32 __attribute__((nonnull(1), always_inline))
368INLINE INT32 ATTR_NONNULL ATTR_FORCE_INLINE
369369_atomic_exchange32(INT32 volatile *ptr, INT32 exchange)
370370{
371371   register INT32 result;
r1877r1878
393393-------------------------------------------------*/
394394
395395#define atomic_add32 _atomic_add32
396INLINE INT32 __attribute__((nonnull(1), always_inline))
396INLINE INT32 ATTR_NONNULL ATTR_FORCE_INLINE
397397_atomic_add32(INT32 volatile *ptr, INT32 delta)
398398{
399399   register INT32 result;
r1877r1878
422422-------------------------------------------------*/
423423
424424#define atomic_increment32 _atomic_increment32
425INLINE INT32 __attribute__((nonnull(1), always_inline))
425INLINE INT32 ATTR_NONNULL ATTR_FORCE_INLINE
426426_atomic_increment32(INT32 volatile *ptr)
427427{
428428   register INT32 result;
r1877r1878
450450-------------------------------------------------*/
451451
452452#define atomic_decrement32 _atomic_decrement32
453INLINE INT32 __attribute__((nonnull(1), always_inline))
453INLINE INT32 ATTR_NONNULL ATTR_FORCE_INLINE
454454_atomic_decrement32(INT32 volatile *ptr)
455455{
456456   register INT32 result;
src/emu/machine/msm6242.c
r1877r1878
130130
131131READ16_HANDLER( msm6242_lsb_r )
132132{
133   return msm6242_r(offset);
133   return msm6242_r(machine, offset);
134134}
135135
136136WRITE16_HANDLER( msm6242_lsb_w )
137137{
138138   if (ACCESSING_LSB)
139      msm6242_w(offset,data);
139      msm6242_w(machine, offset, data);
140140}
src/emu/machine/6821pia.c
r1877r1878
249249
250250   /* update the input */
251251   if (p->intf->in_a_func)
252      port_a_data = p->intf->in_a_func(0);
252      port_a_data = p->intf->in_a_func(Machine, 0);
253253   else
254254   {
255255      if (p->in_a_pushed)
r1877r1878
292292
293293      /* update the input */
294294      if (p->intf->in_b_func)
295         port_b_data = p->intf->in_b_func(0);
295         port_b_data = p->intf->in_b_func(Machine, 0);
296296      else
297297      {
298298         if (p->in_b_pushed)
r1877r1878
368368
369369      /* send to output function */
370370      if (p->intf->out_ca2_func)
371         p->intf->out_ca2_func(0, p->out_ca2);
371         p->intf->out_ca2_func(Machine, 0, p->out_ca2);
372372      else
373373      {
374374         if (p->out_ca2_needs_pulled)
r1877r1878
393393
394394      /* send to output function */
395395      if (p->intf->out_cb2_func)
396         p->intf->out_cb2_func(0, p->out_cb2);
396         p->intf->out_cb2_func(Machine, 0, p->out_cb2);
397397      else
398398      {
399399         if (p->out_cb2_needs_pulled)
r1877r1878
495495
496496   /* update CA1 & CA2 if callback exists, these in turn may update IRQ's */
497497   if (p->intf->in_ca1_func)
498      pia_set_input_ca1(which, p->intf->in_ca1_func(0));
498      pia_set_input_ca1(which, p->intf->in_ca1_func(Machine, 0));
499499   else if (!p->logged_ca1_not_connected && (!p->in_ca1_pushed))
500500   {
501501      logerror("cpu #%d (PC=%08X): PIA #%d: Warning! No CA1 read handler. Assuming pin not connected\n", cpu_getactivecpu(), safe_activecpu_get_pc(), which);
r1877r1878
503503   }
504504
505505   if (p->intf->in_ca2_func)
506      pia_set_input_ca2(which, p->intf->in_ca2_func(0));
506      pia_set_input_ca2(which, p->intf->in_ca2_func(Machine, 0));
507507   else if ( !p->logged_ca2_not_connected && C2_INPUT(p->ctl_a) && !p->in_ca2_pushed)
508508   {
509509      logerror("cpu #%d (PC=%08X): PIA #%d: Warning! No CA2 read handler. Assuming pin not connected\n", cpu_getactivecpu(), safe_activecpu_get_pc(), which);
r1877r1878
533533
534534   /* update CB1 & CB2 if callback exists, these in turn may update IRQ's */
535535   if (p->intf->in_cb1_func)
536      pia_set_input_cb1(which, p->intf->in_cb1_func(0));
536      pia_set_input_cb1(which, p->intf->in_cb1_func(Machine, 0));
537537   else if (!p->logged_cb1_not_connected && !p->in_cb1_pushed)
538538   {
539539      logerror("cpu #%d (PC=%08X): PIA #%d: Error! no CB1 read handler. Three-state pin is undefined\n", cpu_getactivecpu(), safe_activecpu_get_pc(), which);
r1877r1878
541541   }
542542
543543   if (p->intf->in_cb2_func)
544      pia_set_input_cb2(which, p->intf->in_cb2_func(0));
544      pia_set_input_cb2(which, p->intf->in_cb2_func(Machine, 0));
545545   else if (!p->logged_cb2_not_connected && C2_INPUT(p->ctl_b) && !p->in_cb2_pushed)
546546   {
547547      logerror("cpu #%d (PC=%08X): PIA #%d: Error! No CB2 read handler. Three-state pin is undefined\n", cpu_getactivecpu(), safe_activecpu_get_pc(), which);
r1877r1878
630630   LOG(("cpu #%d (PC=%08X): PIA #%d: %s = %02X\n", cpu_getactivecpu(), safe_activecpu_get_pc(), which, message, data));
631631
632632   if (p->intf->out_a_func)
633      p->intf->out_a_func(0, data);
633      p->intf->out_a_func(Machine, 0, data);
634634   else
635635   {
636636      if (p->out_a_needs_pulled)
r1877r1878
651651   LOG(("cpu #%d (PC=%08X): PIA #%d: %s = %02X\n", cpu_getactivecpu(), safe_activecpu_get_pc(), which, message, data));
652652
653653   if (p->intf->out_b_func)
654      p->intf->out_b_func(0, data);
654      p->intf->out_b_func(Machine, 0, data);
655655   else
656656   {
657657      if (p->out_b_needs_pulled)
src/emu/machine/6532riot.c
r1877r1878
124124         {
125125            UINT8 write_data = ( r6532[which].ddr_a & r6532[which].out_a ) | ( ~r6532[which].ddr_a & 0xFF );
126126            if (r6532[which].intf->out_a_func)
127               r6532[which].intf->out_a_func(0, write_data);
127               r6532[which].intf->out_a_func(Machine, 0, write_data);
128128            else
129129               logerror("6532RIOT chip #%d: Port A is being written to but has no handler.  PC: %08X - %02X\n", which, safe_activecpu_get_pc(), write_data);
130130            /* Check for PA7 change */
r1877r1878
141141         {
142142            UINT8 write_data = ( r6532[which].ddr_b & r6532[which].out_b ) | ( ~r6532[which].ddr_b & 0xFF );
143143            if (r6532[which].intf->out_b_func)
144               r6532[which].intf->out_b_func(0, write_data);
144               r6532[which].intf->out_b_func(Machine, 0, write_data);
145145            else
146146               logerror("6532RIOT chip #%d: Port B is being written to but has no handler.  PC: %08X - %02X\n", which, safe_activecpu_get_pc(), write_data);
147147         }
r1877r1878
236236   {
237237   case 0:
238238      if (r6532[which].intf->in_a_func)
239         r6532[which].in_a = r6532[which].intf->in_a_func(0);
239         r6532[which].in_a = r6532[which].intf->in_a_func(Machine, 0);
240240      else
241241         logerror("6532RIOT chip #%d: Port A is being read but has no handler.  PC: %08X\n", which, safe_activecpu_get_pc());
242242      val = ( r6532[which].ddr_a & r6532[which].out_a ) | ( ~r6532[which].ddr_a & r6532[which].in_a );
r1877r1878
248248      break;
249249   case 2:
250250      if (r6532[which].intf->in_b_func)
251         r6532[which].in_b = r6532[which].intf->in_b_func(0);
251         r6532[which].in_b = r6532[which].intf->in_b_func(Machine, 0);
252252      else
253253         logerror("6532RIOT chip #%d: Port B is being read but has no handler.  PC: %08X\n", which, safe_activecpu_get_pc());
254254
src/emu/machine/6522via.c
r1877r1878
2323 */
2424
2525#include "driver.h"
26#include "deprecat.h"
2627#include "6522via.h"
2728
2829//#define TRACE_VIA
r1877r1878
250251      v->sr =  (v->sr << 1) | v->out_cb2;
251252
252253      if (v->intf->out_cb2_func)
253         v->intf->out_cb2_func(0, v->out_cb2);
254         v->intf->out_cb2_func(Machine, 0, v->out_cb2);
254255
255256      v->in_cb1=1;
256257      if (v->intf->out_cb1_func)
257258      {
258259         /* this should be one cycle wide */
259         v->intf->out_cb1_func(0, 0);
260         v->intf->out_cb1_func(0, 1);
260         v->intf->out_cb1_func(Machine, 0, 0);
261         v->intf->out_cb1_func(Machine, 0, 1);
261262      }
262263
263264      v->shift_counter = (v->shift_counter + 1) % 8;
r1877r1878
276277      v->sr =  (v->sr << 1) | v->out_cb2;
277278
278279      if (v->intf->out_cb2_func)
279         v->intf->out_cb2_func(0, v->out_cb2);
280         v->intf->out_cb2_func(Machine, 0, v->out_cb2);
280281
281282      v->shift_counter = (v->shift_counter + 1) % 8;
282283
r1877r1878
289290   if (SI_EXT_CONTROL(v->acr))
290291   {
291292      if (v->intf->in_cb2_func)
292         v->in_cb2 = v->intf->in_cb2_func(0);
293         v->in_cb2 = v->intf->in_cb2_func(Machine, 0);
293294
294295      v->sr =  (v->sr << 1) | (v->in_cb2 & 1);
295296
r1877r1878
336337      UINT8 write_data = (v->out_b & v->ddr_b) | (v->ddr_b ^ 0xff);
337338
338339      if (v->intf->out_b_func)
339         v->intf->out_b_func(0, write_data);
340         v->intf->out_b_func(Machine, 0, write_data);
340341      else
341342         logerror("6522VIA chip %d: Port B is being written to but has no handler.  PC: %08X - %02X\n", which, safe_activecpu_get_pc(), write_data);
342343   }
r1877r1878
402403      if (PB_LATCH_ENABLE(v->acr) == 0)
403404      {
404405         if (v->intf->in_b_func)
405            v->in_b = v->intf->in_b_func(0);
406            v->in_b = v->intf->in_b_func(Machine, 0);
406407         else
407408            logerror("6522VIA chip %d: Port B is being read but has no handler.  PC: %08X\n", which, safe_activecpu_get_pc());
408409      }
r1877r1878
421422      if (PA_LATCH_ENABLE(v->acr) == 0)
422423      {
423424         if (v->intf->in_a_func)
424            v->in_a = v->intf->in_a_func(0);
425            v->in_a = v->intf->in_a_func(Machine, 0);
425426         else
426427            logerror("6522VIA chip %d: Port A is being read but has no handler.  PC: %08X\n", which, safe_activecpu_get_pc());
427428      }
r1877r1878
442443
443444            /* call the CA2 output function */
444445            if (v->intf->out_ca2_func)
445               v->intf->out_ca2_func(0, 0);
446               v->intf->out_ca2_func(Machine, 0, 0);
446447            else
447448               logerror("6522VIA chip %d: Port CA2 is being written to but has no handler.  PC: %08X - %02X\n", which, safe_activecpu_get_pc(), 0);
448449         }
r1877r1878
455456      if (PA_LATCH_ENABLE(v->acr) == 0)
456457      {
457458         if (v->intf->in_a_func)
458            v->in_a = v->intf->in_a_func(0);
459            v->in_a = v->intf->in_a_func(Machine, 0);
459460         else
460461            logerror("6522VIA chip %d: Port A is being read but has no handler.  PC: %08X\n", which, safe_activecpu_get_pc());
461462      }
r1877r1878
565566         UINT8 write_data = (v->out_b & v->ddr_b) | (v->ddr_b ^ 0xff);
566567
567568         if (v->intf->out_b_func)
568            v->intf->out_b_func(0, write_data);
569            v->intf->out_b_func(Machine, 0, write_data);
569570         else
570571            logerror("6522VIA chip %d: Port B is being written to but has no handler.  PC: %08X - %02X\n", which, safe_activecpu_get_pc(), write_data);
571572      }
r1877r1878
583584
584585            /* call the CB2 output function */
585586            if (v->intf->out_cb2_func)
586               v->intf->out_cb2_func(0, 0);
587               v->intf->out_cb2_func(Machine, 0, 0);
587588            else
588589               logerror("6522VIA chip %d: Port CB2 is being written to but has no handler.  PC: %08X - %02X\n", which, safe_activecpu_get_pc(), 0);
589590         }
r1877r1878
598599         UINT8 write_data = (v->out_a & v->ddr_a) | (v->ddr_a ^ 0xff);
599600
600601         if (v->intf->out_a_func)
601            v->intf->out_a_func(0, write_data);
602            v->intf->out_a_func(Machine, 0, write_data);
602603         else
603604            logerror("6522VIA chip %d: Port A is being written to but has no handler.  PC: %08X - %02X\n", which, safe_activecpu_get_pc(), write_data);
604605      }
r1877r1878
612613         /* call the CA2 output function */
613614         if (v->intf->out_ca2_func)
614615         {
615            v->intf->out_ca2_func(0, 0);
616            v->intf->out_ca2_func(0, 1);
616            v->intf->out_ca2_func(Machine, 0, 0);
617            v->intf->out_ca2_func(Machine, 0, 1);
617618         }
618619         else
619620            logerror("6522VIA chip %d: Port CA2 is being pulsed but has no handler.  PC: %08X\n", which, safe_activecpu_get_pc());
r1877r1878
630631
631632            /* call the CA2 output function */
632633            if (v->intf->out_ca2_func)
633               v->intf->out_ca2_func(0, 0);
634               v->intf->out_ca2_func(Machine, 0, 0);
634635            else
635636               logerror("6522VIA chip %d: Port CA2 is being written to but has no handler.  PC: %08X - %02X\n", which, safe_activecpu_get_pc(), 0);
636637         }
r1877r1878
646647         UINT8 write_data = (v->out_a & v->ddr_a) | (v->ddr_a ^ 0xff);
647648
648649         if (v->intf->out_a_func)
649            v->intf->out_a_func(0, write_data);
650            v->intf->out_a_func(Machine, 0, write_data);
650651         else
651652            logerror("6522VIA chip %d: Port A is being written to but has no handler.  PC: %08X - %02X\n", which, safe_activecpu_get_pc(), write_data);
652653      }
r1877r1878
664665            UINT8 write_data = (v->out_b & v->ddr_b) | (v->ddr_b ^ 0xff);
665666
666667            if (v->intf->out_b_func)
667               v->intf->out_b_func(0, write_data);
668               v->intf->out_b_func(Machine, 0, write_data);
668669            else
669670               logerror("6522VIA chip %d: Port B is being written to but has no handler.  PC: %08X - %02X\n", which, safe_activecpu_get_pc(), write_data);
670671         }
r1877r1878
682683            UINT8 write_data = (v->out_a & v->ddr_a) | (v->ddr_a ^ 0xff);
683684
684685            if (v->intf->out_a_func)
685               v->intf->out_a_func(0, write_data);
686               v->intf->out_a_func(Machine, 0, write_data);
686687            else
687688               logerror("6522VIA chip %d: Port A is being written to but has no handler.  PC: %08X - %02X\n", which, safe_activecpu_get_pc(), write_data);
688689         }
r1877r1878
714715            UINT8 write_data = (v->out_b & v->ddr_b) | (v->ddr_b ^ 0xff);
715716
716717            if (v->intf->out_b_func)
717               v->intf->out_b_func(0, write_data);
718               v->intf->out_b_func(Machine, 0, write_data);
718719            else
719720               logerror("6522VIA chip %d: Port B is being written to but has no handler.  PC: %08X - %02X\n", which, safe_activecpu_get_pc(), write_data);
720721         }
r1877r1878
764765      {
765766         v->out_ca2 = CA2_OUTPUT_LEVEL(data);
766767         if (v->intf->out_ca2_func)
767            v->intf->out_ca2_func(0, v->out_ca2);
768            v->intf->out_ca2_func(Machine, 0, v->out_ca2);
768769         else
769770            logerror("6522VIA chip %d: Port CA2 is being written to but has no handler.  PC: %08X - %02X\n", which, safe_activecpu_get_pc(), v->out_ca2);
770771      }
r1877r1878
773774      {
774775         v->out_cb2 = CB2_OUTPUT_LEVEL(data);
775776         if (v->intf->out_cb2_func)
776            v->intf->out_cb2_func(0, v->out_cb2);
777            v->intf->out_cb2_func(Machine, 0, v->out_cb2);
777778         else
778779            logerror("6522VIA chip %d: Port CB2 is being written to but has no handler.  PC: %08X - %02X\n", which, safe_activecpu_get_pc(), v->out_cb2);
779780      }
r1877r1878
795796               UINT8 write_data = (v->out_b & v->ddr_b) | (v->ddr_b ^ 0xff);
796797
797798               if (v->intf->out_b_func)
798                  v->intf->out_b_func(0, write_data);
799                  v->intf->out_b_func(Machine, 0, write_data);
799800               else
800801                  logerror("6522VIA chip %d: Port B is being written to but has no handler.  PC: %08X - %02X\n", which, safe_activecpu_get_pc(), write_data);
801802            }
r1877r1878
876877         if (PA_LATCH_ENABLE(v->acr))
877878         {
878879            if (v->intf->in_a_func)
879               v->in_a = v->intf->in_a_func(0);
880               v->in_a = v->intf->in_a_func(Machine, 0);
880881            else
881882               logerror("6522VIA chip %d: Port A is being read but has no handler.  PC: %08X\n", which, safe_activecpu_get_pc());
882883         }
r1877r1878
894895
895896               /* call the CA2 output function */
896897               if (v->intf->out_ca2_func)
897                  v->intf->out_ca2_func(0, 1);
898                  v->intf->out_ca2_func(Machine, 0, 1);
898899               else
899900                  logerror("6522VIA chip %d: Port CA2 is being written to but has no handler.  PC: %08X - %02X\n", which, safe_activecpu_get_pc(), 1);
900901            }
r1877r1878
963964         if (PB_LATCH_ENABLE(v->acr))
964965         {
965966            if (v->intf->in_b_func)
966               v->in_b = v->intf->in_b_func(0);
967               v->in_b = v->intf->in_b_func(Machine, 0);
967968            else
968969               logerror("6522VIA chip %d: Port B is being read but has no handler.  PC: %08X\n", which, safe_activecpu_get_pc());
969970         }
r1877r1878
983984
984985               /* call the CB2 output function */
985986               if (v->intf->out_cb2_func)
986                  v->intf->out_cb2_func(0, 1);
987                  v->intf->out_cb2_func(Machine, 0, 1);
987988               else
988989                  logerror("6522VIA chip %d: Port CB2 is being written to but has no handler.  PC: %08X - %02X\n", which, safe_activecpu_get_pc(), 1);
989990            }
src/emu/machine/6821pia.h
r1877r1878
3030typedef struct _pia6821_interface pia6821_interface;
3131struct _pia6821_interface
3232{
33   read8_handler in_a_func;
34   read8_handler in_b_func;
35   read8_handler in_ca1_func;
36   read8_handler in_cb1_func;
37   read8_handler in_ca2_func;
38   read8_handler in_cb2_func;
39   write8_handler out_a_func;
40   write8_handler out_b_func;
41   write8_handler out_ca2_func;
42   write8_handler out_cb2_func;
33   read8_machine_func in_a_func;
34   read8_machine_func in_b_func;
35   read8_machine_func in_ca1_func;
36   read8_machine_func in_cb1_func;
37   read8_machine_func in_ca2_func;
38   read8_machine_func in_cb2_func;
39   write8_machine_func out_a_func;
40   write8_machine_func out_b_func;
41   write8_machine_func out_ca2_func;
42   write8_machine_func out_cb2_func;
4343   void (*irq_a_func)(int state);
4444   void (*irq_b_func)(int state);
4545};
src/emu/machine/laserdsc.c
r1877r1878
224224   UINT32         fieldnum;            /* field number (0 or 1) */
225225
226226   /* video data */
227   mame_bitmap *   videoframe[2];         /* currently cached frames */
227   bitmap_t *      videoframe[2];         /* currently cached frames */
228228   UINT8         videofields[2];         /* number of fields in each frame */
229229   UINT32         videoframenum[2];      /* frame number contained in each frame */
230230   UINT8         videoindex;            /* index of the current video buffer */
231   mame_bitmap *   emptyframe;            /* blank frame */
231   bitmap_t *      emptyframe;            /* blank frame */
232232
233233   /* audio data */
234234   INT16 *         audiobuffer[2];         /* buffer for audio samples */
r1877r1878
642642    given color pattern
643643-------------------------------------------------*/
644644
645INLINE void fillbitmap_yuy16(mame_bitmap *bitmap, UINT8 yval, UINT8 cr, UINT8 cb)
645INLINE void fillbitmap_yuy16(bitmap_t *bitmap, UINT8 yval, UINT8 cr, UINT8 cb)
646646{
647647   UINT16 color0 = (yval << 8) | cb;
648648   UINT16 color1 = (yval << 8) | cr;
r1877r1878
10591059    video frame
10601060-------------------------------------------------*/
10611061
1062UINT32 laserdisc_get_video(laserdisc_info *info, mame_bitmap **bitmap)
1062UINT32 laserdisc_get_video(laserdisc_info *info, bitmap_t **bitmap)
10631063{
10641064   int frameindex;
10651065
src/emu/machine/6532riot.h
r1877r1878
1111
1212struct riot6532_interface
1313{
14   read8_handler in_a_func;
15   read8_handler in_b_func;
16   write8_handler out_a_func;
17   write8_handler out_b_func;
14   read8_machine_func in_a_func;
15   read8_machine_func in_b_func;
16   write8_machine_func out_a_func;
17   write8_machine_func out_b_func;
1818   void (*irq_func)(int state);
1919};
2020
src/emu/machine/6522via.h
r1877r1878
3636
3737struct via6522_interface
3838{
39   read8_handler in_a_func;
40   read8_handler in_b_func;
41   read8_handler in_ca1_func;
42   read8_handler in_cb1_func;
43   read8_handler in_ca2_func;
44   read8_handler in_cb2_func;
45   write8_handler out_a_func;
46   write8_handler out_b_func;
47   write8_handler out_ca1_func;
48   write8_handler out_cb1_func;
49   write8_handler out_ca2_func;
50   write8_handler out_cb2_func;
39   read8_machine_func in_a_func;
40   read8_machine_func in_b_func;
41   read8_machine_func in_ca1_func;
42   read8_machine_func in_cb1_func;
43   read8_machine_func in_ca2_func;
44   read8_machine_func in_cb2_func;
45   write8_machine_func out_a_func;
46   write8_machine_func out_b_func;
47   write8_machine_func out_ca1_func;
48   write8_machine_func out_cb1_func;
49   write8_machine_func out_ca2_func;
50   write8_machine_func out_cb2_func;
5151   void (*irq_func)(int state);
5252};
5353
src/emu/machine/pic8259.c
r1877r1878
381381WRITE8_HANDLER ( pic8259_0_w )   { pic8259_write(0, offset, data); }
382382WRITE8_HANDLER ( pic8259_1_w )   { pic8259_write(1, offset, data); }
383383
384READ16_HANDLER ( pic8259_16le_0_r ) { return read16le_with_read8_handler(pic8259_0_r, offset, mem_mask); }
385READ16_HANDLER ( pic8259_16le_1_r ) { return read16le_with_read8_handler(pic8259_1_r, offset, mem_mask); }
386WRITE16_HANDLER ( pic8259_16le_0_w ) { write16le_with_write8_handler(pic8259_0_w, offset, data, mem_mask); }
387WRITE16_HANDLER ( pic8259_16le_1_w ) { write16le_with_write8_handler(pic8259_1_w, offset, data, mem_mask); }
384READ16_HANDLER ( pic8259_16le_0_r ) { return read16le_with_read8_handler(pic8259_0_r, machine, offset, mem_mask); }
385READ16_HANDLER ( pic8259_16le_1_r ) { return read16le_with_read8_handler(pic8259_1_r, machine, offset, mem_mask); }
386WRITE16_HANDLER ( pic8259_16le_0_w ) { write16le_with_write8_handler(pic8259_0_w, machine, offset, data, mem_mask); }
387WRITE16_HANDLER ( pic8259_16le_1_w ) { write16le_with_write8_handler(pic8259_1_w, machine, offset, data, mem_mask); }
388388
389READ32_HANDLER ( pic8259_32le_0_r ) { return read32le_with_read8_handler(pic8259_0_r, offset, mem_mask); }
390READ32_HANDLER ( pic8259_32le_1_r ) { return read32le_with_read8_handler(pic8259_1_r, offset, mem_mask); }
391WRITE32_HANDLER ( pic8259_32le_0_w ) { write32le_with_write8_handler(pic8259_0_w, offset, data, mem_mask); }
392WRITE32_HANDLER ( pic8259_32le_1_w ) { write32le_with_write8_handler(pic8259_1_w, offset, data, mem_mask); }
389READ32_HANDLER ( pic8259_32le_0_r ) { return read32le_with_read8_handler(pic8259_0_r, machine, offset, mem_mask); }
390READ32_HANDLER ( pic8259_32le_1_r ) { return read32le_with_read8_handler(pic8259_1_r, machine, offset, mem_mask); }
391WRITE32_HANDLER ( pic8259_32le_0_w ) { write32le_with_write8_handler(pic8259_0_w, machine, offset, data, mem_mask); }
392WRITE32_HANDLER ( pic8259_32le_1_w ) { write32le_with_write8_handler(pic8259_1_w, machine, offset, data, mem_mask); }
393393
394READ64_HANDLER ( pic8259_64be_0_r ) { return read64be_with_read8_handler(pic8259_0_r, offset, mem_mask); }
395READ64_HANDLER ( pic8259_64be_1_r ) { return read64be_with_read8_handler(pic8259_1_r, offset, mem_mask); }
396WRITE64_HANDLER ( pic8259_64be_0_w ) { write64be_with_write8_handler(pic8259_0_w, offset, data, mem_mask); }
397WRITE64_HANDLER ( pic8259_64be_1_w ) { write64be_with_write8_handler(pic8259_1_w, offset, data, mem_mask); }
394READ64_HANDLER ( pic8259_64be_0_r ) { return read64be_with_read8_handler(pic8259_0_r, machine, offset, mem_mask); }
395READ64_HANDLER ( pic8259_64be_1_r ) { return read64be_with_read8_handler(pic8259_1_r, machine, offset, mem_mask); }
396WRITE64_HANDLER ( pic8259_64be_0_w ) { write64be_with_write8_handler(pic8259_0_w, machine, offset, data, mem_mask); }
397WRITE64_HANDLER ( pic8259_64be_1_w ) { write64be_with_write8_handler(pic8259_1_w, machine, offset, data, mem_mask); }
src/emu/machine/laserdsc.h
r1877r1878
7373void laserdisc_exit(laserdisc_info *info);
7474void laserdisc_vsync(laserdisc_info *info);
7575const char *laserdisc_describe_state(laserdisc_info *info);
76UINT32 laserdisc_get_video(laserdisc_info *info, mame_bitmap **bitmap);
76UINT32 laserdisc_get_video(laserdisc_info *info, bitmap_t **bitmap);
7777UINT32 laserdisc_get_field_code(laserdisc_info *info, UINT8 code);
7878
7979void laserdisc_data_w(laserdisc_info *info, UINT8 data);
src/emu/machine/6840ptm.c
r1877r1878
340340   if ((currptr->mode[idx] == 4)||(currptr->mode[idx] == 6))
341341   {
342342      currptr->output[idx] = 1;
343      if ( currptr->intf->out_func[idx] ) currptr->intf->out_func[idx](0, currptr->output[idx]);
343      if ( currptr->intf->out_func[idx] ) currptr->intf->out_func[idx](Machine, 0, currptr->output[idx]);
344344   }
345345
346346   /* set the timer */
r1877r1878
549549         { // output cleared
550550            if ( currptr->intf )
551551            {
552               if ( currptr->intf->out_func[idx] ) currptr->intf->out_func[idx](0, 0);
552               if ( currptr->intf->out_func[idx] ) currptr->intf->out_func[idx](Machine, 0, 0);
553553            }
554554         }
555555         /* reset? */
r1877r1878
644644         {
645645            p->output[idx] = p->output[idx]?0:1;
646646            PLOG(("**ptm6840 %d t%d output %d **\n", which, idx+1, p->output[idx]));
647            if ( p->intf->out_func[idx] ) p->intf->out_func[idx](0, p->output[idx]);
647            if ( p->intf->out_func[idx] ) p->intf->out_func[idx](Machine, 0, p->output[idx]);
648648         }
649649         if ((p->mode[idx] == 4)||(p->mode[idx] == 6))
650650         {
r1877r1878
652652            {
653653               p->output[idx] = 1;
654654               PLOG(("**ptm6840 %d t%d output %d **\n", which, idx+1, p->output[idx]));
655               if ( p->intf->out_func[idx] ) p->intf->out_func[idx](0, p->output[idx]);
655               if ( p->intf->out_func[idx] ) p->intf->out_func[idx](Machine, 0, p->output[idx]);
656656               p->fired[idx]=1;//no changes in output until reinit
657657            }
658658         }
src/emu/machine/6840ptm.h
r1877r1878
1818   int internal_clock;
1919   int external_clock[3];
2020
21   write8_handler   out_func[3];   // function to call when output[idx] changes
21   write8_machine_func   out_func[3];   // function to call when output[idx] changes
2222
2323   void (*irq_func)(int state);   // function called if IRQ line changes
2424};
src/emu/machine/z80dma.c
r1877r1878
8686
8787#define READY_ACTIVE_HIGH(_c) ((WR5(_c)>>3) & 0x01)
8888
89struct z80dma
89struct _z80dma_t
9090{
91   const struct z80dma_interface *intf;
91   running_machine *machine;
92   const z80dma_interface *intf;
9293   emu_timer *timer;
9394
9495   UINT16    regs[REGNUM(6,1)+1];
r1877r1878
109110   UINT8 latch;
110111};
111112
112static struct z80dma *dma;
113static int dma_count;
114
115113static TIMER_CALLBACK( z80dma_timerproc );
116static void z80dma_update_status(int which);
114static void z80dma_update_status(z80dma_t *z80dma);
117115
118116/* ----------------------------------------------------------------------- */
119117
120int z80dma_init(int count)
118static void z80dma_do_read(z80dma_t *cntx)
121119{
122   int which;
123
124   dma = auto_malloc(count * sizeof(struct z80dma));
125   memset(dma, 0, count * sizeof(struct z80dma));
126   dma_count = count;
127
128   for (which = 0; which < dma_count; which++)
129   {
130      dma[which].timer = timer_alloc(z80dma_timerproc, NULL);
131
132      state_save_register_item_array("Z80DMA", which, dma[which].regs);
133      state_save_register_item_array("Z80DMA", which, dma[which].regs_follow);
134
135      state_save_register_item("Z80DMA", which, dma[which].num_follow);
136      state_save_register_item("Z80DMA", which, dma[which].cur_follow);
137      state_save_register_item("Z80DMA", which, dma[which].status);
138      state_save_register_item("Z80DMA", which, dma[which].dma_enabled);
139
140      state_save_register_item("Z80DMA", which, dma[which].addressA);
141      state_save_register_item("Z80DMA", which, dma[which].addressB);
142      state_save_register_item("Z80DMA", which, dma[which].count);
143      state_save_register_item("Z80DMA", which, dma[which].rdy);
144      state_save_register_item("Z80DMA", which, dma[which].is_read);
145      state_save_register_item("Z80DMA", which, dma[which].cur_cycle);
146      state_save_register_item("Z80DMA", which, dma[which].latch);
147
148   }
149
150   return 0;
151}
152
153
154
155void z80dma_config(int which, const struct z80dma_interface *intf)
156{
157   dma[which].intf = intf;
158}
159
160
161
162void z80dma_reset(void)
163{
164   int which;
165
166   for (which = 0; which < dma_count; which++)
167   {
168      dma[which].status = 0;
169      dma[which].rdy = 0;
170      dma[which].num_follow = 0;
171      dma[which].dma_enabled = 0;
172      z80dma_update_status(which);
173   }
174}
175
176
177
178/* ----------------------------------------------------------------------- */
179
180static void z80dma_do_read(int which)
181{
182   struct z80dma   *cntx = &dma[which];
183120   UINT8 mode;
184121
185122   mode = TRANSFER_MODE(cntx);
r1877r1878
188125         if (PORTA_IS_SOURCE(cntx))
189126         {
190127            if (PORTA_MEMORY(cntx))
191               cntx->latch = cntx->intf->memory_read_func(cntx->addressA);
128               cntx->latch = cntx->intf->memory_read(cntx->machine, cntx, cntx->addressA);
192129            else
193               cntx->latch = cntx->intf->portA_read_func(cntx->addressA);
130               cntx->latch = cntx->intf->portA_read(cntx->machine, cntx, cntx->addressA);
194131            cntx->addressA += PORTA_STEP(cntx);
195132         }
196133         else
197134         {
198135            if (PORTB_MEMORY(cntx))
199               cntx->latch = cntx->intf->memory_read_func(cntx->addressB);
136               cntx->latch = cntx->intf->memory_read(cntx->machine, cntx, cntx->addressB);
200137            else
201               cntx->latch = cntx->intf->portB_read_func(cntx->addressB);
138               cntx->latch = cntx->intf->portB_read(cntx->machine, cntx, cntx->addressB);
202139            cntx->addressB += PORTB_STEP(cntx);
203140         }
204141         break;
r1877r1878
209146   }
210147}
211148
212static int z80dma_do_write(int which)
149static int z80dma_do_write(z80dma_t *cntx)
213150{
214   struct z80dma   *cntx = &dma[which];
215151   int done;
216152   UINT8 mode;
217153
r1877r1878
225161         if (PORTA_IS_SOURCE(cntx))
226162         {
227163            if (PORTB_MEMORY(cntx))
228               cntx->intf->memory_write_func(cntx->addressB, cntx->latch);
164               cntx->intf->memory_write(cntx->machine, cntx, cntx->addressB, cntx->latch);
229165            else
230               cntx->intf->portB_write_func(cntx->addressB, cntx->latch);
166               cntx->intf->portB_write(cntx->machine, cntx, cntx->addressB, cntx->latch);
231167            cntx->addressB += PORTB_STEP(cntx);
232168         }
233169         else
234170         {
235171            if (PORTA_MEMORY(cntx))
236               cntx->intf->memory_write_func(cntx->addressA, cntx->latch);
172               cntx->intf->memory_write(cntx->machine, cntx, cntx->addressA, cntx->latch);
237173            else
238               cntx->intf->portB_write_func(cntx->addressA, cntx->latch);
174               cntx->intf->portB_write(cntx->machine, cntx, cntx->addressA, cntx->latch);
239175            cntx->addressA += PORTA_STEP(cntx);
240176         }
241177         cntx->count--;
r1877r1878
255191
256192static TIMER_CALLBACK( z80dma_timerproc )
257193{
258   int which = param;
259   struct z80dma   *cntx = &dma[which];
194   z80dma_t *cntx = ptr;
260195   int done;
261196
262197   if (--cntx->cur_cycle)
r1877r1878
265200   }
266201   if (cntx->is_read)
267202   {
268      z80dma_do_read(which);
203      z80dma_do_read(cntx);
269204      done = 0;
270205      cntx->is_read = 0;
271206      cntx->cur_cycle = (PORTA_IS_SOURCE(cntx) ? PORTA_CYCLE_LEN(cntx) : PORTB_CYCLE_LEN(cntx));
272207   }
273208   else
274209   {
275      done = z80dma_do_write(which);
210      done = z80dma_do_write(cntx);
276211      cntx->is_read = 1;
277212      cntx->cur_cycle = (PORTB_IS_SOURCE(cntx) ? PORTA_CYCLE_LEN(cntx) : PORTB_CYCLE_LEN(cntx));
278213   }
279214   if (done)
280215   {
281216      cntx->dma_enabled = 0; //FIXME: Correct?
282      z80dma_update_status(which);
217      z80dma_update_status(cntx);
283218   }
284219}
285220
286static void z80dma_update_status(int which)
221static void z80dma_update_status(z80dma_t *z80dma)
287222{
288   struct z80dma   *cntx = &dma[which];
289223   UINT16 pending_transfer;
290224   attotime next;
291225
292226   /* no transfer is active right now; is there a transfer pending right now? */
293   pending_transfer = dma[which].rdy & dma[which].dma_enabled;
227   pending_transfer = z80dma->rdy & z80dma->dma_enabled;
294228
295229   if (pending_transfer)
296230   {
297      dma[which].is_read = 1;
298      dma[which].cur_cycle = (PORTA_IS_SOURCE(cntx) ? PORTA_CYCLE_LEN(cntx) : PORTB_CYCLE_LEN(cntx));
299      next = ATTOTIME_IN_HZ(dma[which].intf->clockhz);
300      timer_adjust_periodic(dma[which].timer,
231      z80dma->is_read = 1;
232      z80dma->cur_cycle = (PORTA_IS_SOURCE(z80dma) ? PORTA_CYCLE_LEN(z80dma) : PORTB_CYCLE_LEN(z80dma));
233      next = ATTOTIME_IN_HZ(z80dma->intf->clockhz);
234      timer_adjust_periodic(z80dma->timer,
301235         attotime_zero,
302         which,
236         0,
303237         /* 1 byte transferred in 4 clock cycles */
304238         next);
305239   }
306240   else
307241   {
308242      /* no transfers active right now */
309      timer_reset(dma[which].timer, attotime_never);
243      timer_reset(z80dma->timer, attotime_never);
310244   }
311245
312246   /* set the halt line */
313   if (dma[which].intf && dma[which].intf->cpunum >= 0)
247   if (z80dma->intf && z80dma->intf->cpunum >= 0)
314248   {
315249      //FIXME: Synchronization is done by BUSREQ!
316      cpunum_set_input_line(Machine, dma[which].intf->cpunum, INPUT_LINE_HALT,
250      cpunum_set_input_line(Machine, z80dma->intf->cpunum, INPUT_LINE_HALT,
317251         pending_transfer ? ASSERT_LINE : CLEAR_LINE);
318252   }
319253}
320254
321255/* ----------------------------------------------------------------------- */
322256
323static UINT8 z80dma_read(int which, offs_t offset)
257UINT8 z80dma_read(z80dma_t *z80dma)
324258{
325259   fatalerror("z80dma_read: not implemented");
326260   return 0;
r1877r1878
328262
329263
330264
331static void z80dma_write(int which, offs_t offset, UINT8 data)
265void z80dma_write(z80dma_t *z80dma, UINT8 data)
332266{
333   struct z80dma   *cntx = &dma[which];
267   z80dma_t *cntx = z80dma;
334268
335269   if (cntx->num_follow == 0)
336270   {
r1877r1878
406340               break;
407341            case 0x83:   /* Disable dma */
408342               cntx->dma_enabled = 0;
409               z80dma_rdy_write(which, cntx->rdy);
343               z80dma_rdy_write(cntx, cntx->rdy);
410344               break;
411345            case 0x87:   /* Enable dma */
412346               cntx->dma_enabled = 1;
413               z80dma_rdy_write(which, cntx->rdy);
347               z80dma_rdy_write(cntx, cntx->rdy);
414348               break;
415349            case 0xBB:
416350               cntx->regs_follow[cntx->num_follow++] = GET_REGNUM(cntx, READ_MASK(cntx));
r1877r1878
446380
447381static TIMER_CALLBACK( z80dma_rdy_write_callback )
448382{
449   int which = param >> 1;
450383   int state = param & 0x01;
451   struct z80dma   *cntx = &dma[which];
384   z80dma_t *cntx = ptr;
452385
453386   /* normalize state */
454387   cntx->rdy = 1 ^ state ^ READY_ACTIVE_HIGH(cntx);
455388   cntx->status = (cntx->status & 0xFD) | (cntx->rdy<<1);
456389
457   z80dma_update_status(which);
390   z80dma_update_status(cntx);
458391}
459392
460393
461394
462void z80dma_rdy_write(int which, int state)
395void z80dma_rdy_write(z80dma_t *z80dma, int state)
463396{
464397   int param;
465398
466   param = (which << 1) | (state ? 1 : 0);
467   LOG(("RDY: %d Active High: %d\n", state, READY_ACTIVE_HIGH(&dma[which])));
468   timer_call_after_resynch(NULL, param, z80dma_rdy_write_callback);
399   param = (state ? 1 : 0);
400   LOG(("RDY: %d Active High: %d\n", state, READY_ACTIVE_HIGH(z80dma)));
401   timer_call_after_resynch(z80dma, param, z80dma_rdy_write_callback);
469402}
470403
404/* ----------------------------------------------------------------------- */
471405
472/******************* Standard 8-bit/32-bit/64-bit CPU interfaces *******************/
406/* device interface */
473407
474READ8_HANDLER( z80dma_0_r )   { return z80dma_read(0, offset); }
475READ8_HANDLER( z80dma_1_r )   { return z80dma_read(1, offset); }
476WRITE8_HANDLER( z80dma_0_w ) { z80dma_write(0, offset, data); }
477WRITE8_HANDLER( z80dma_1_w ) { z80dma_write(1, offset, data); }
408static DEVICE_START( z80dma )
409{
410   z80dma_t *z80dma;
411   char unique_tag[30];
478412
479WRITE8_HANDLER( z80dma_0_rdy_w ) { z80dma_rdy_write(0, data); }
480WRITE8_HANDLER( z80dma_1_rdy_w ) { z80dma_rdy_write(1, data); }
413   /* validate arguments */
414   assert(machine != NULL);
415   assert(tag != NULL);
416   assert(strlen(tag) < 20);
481417
482READ16_HANDLER( z80dma_16le_0_r ) { return read16le_with_read8_handler(z80dma_0_r, offset, mem_mask); }
483READ16_HANDLER( z80dma_16le_1_r ) { return read16le_with_read8_handler(z80dma_1_r, offset, mem_mask); }
484WRITE16_HANDLER( z80dma_16le_0_w ) { write16le_with_write8_handler(z80dma_0_w, offset, data, mem_mask); }
485WRITE16_HANDLER( z80dma_16le_1_w ) { write16le_with_write8_handler(z80dma_1_w, offset, data, mem_mask); }
418   /* allocate the object that holds the state */
419   z80dma = auto_malloc(sizeof(*z80dma));
420   memset(z80dma, 0, sizeof(*z80dma));
486421
487READ32_HANDLER( z80dma_32le_0_r ) { return read32le_with_read8_handler(z80dma_0_r, offset, mem_mask); }
488READ32_HANDLER( z80dma_32le_1_r ) { return read32le_with_read8_handler(z80dma_1_r, offset, mem_mask); }
489WRITE32_HANDLER( z80dma_32le_0_w ) { write32le_with_write8_handler(z80dma_0_w, offset, data, mem_mask); }
490WRITE32_HANDLER( z80dma_32le_1_w ) { write32le_with_write8_handler(z80dma_1_w, offset, data, mem_mask); }
422   //z80dma->device_type = device_type;
423   z80dma->machine = machine;
424   z80dma->intf = static_config;
491425
492READ64_HANDLER( z80dma_64be_0_r ) { return read64be_with_read8_handler(z80dma_0_r, offset, mem_mask); }
493READ64_HANDLER( z80dma_64be_1_r ) { return read64be_with_read8_handler(z80dma_1_r, offset, mem_mask); }
494WRITE64_HANDLER( z80dma_64be_0_w ) { write64be_with_write8_handler(z80dma_0_w, offset, data, mem_mask); }
495WRITE64_HANDLER( z80dma_64be_1_w ) { write64be_with_write8_handler(z80dma_1_w, offset, data, mem_mask); }
426   z80dma->timer = timer_alloc(z80dma_timerproc, z80dma);
427
428   state_save_combine_module_and_tag(unique_tag, "z80dma", tag);
429
430   state_save_register_item_array(unique_tag, 0, z80dma->regs);
431   state_save_register_item_array(unique_tag, 0, z80dma->regs_follow);
432
433   state_save_register_item(unique_tag, 0, z80dma->num_follow);
434   state_save_register_item(unique_tag, 0, z80dma->cur_follow);
435   state_save_register_item(unique_tag, 0, z80dma->status);
436   state_save_register_item(unique_tag, 0, z80dma->dma_enabled);
437
438   state_save_register_item(unique_tag, 0, z80dma->addressA);
439   state_save_register_item(unique_tag, 0, z80dma->addressB);
440   state_save_register_item(unique_tag, 0, z80dma->count);
441   state_save_register_item(unique_tag, 0, z80dma->rdy);
442   state_save_register_item(unique_tag, 0, z80dma->is_read);
443   state_save_register_item(unique_tag, 0, z80dma->cur_cycle);
444   state_save_register_item(unique_tag, 0, z80dma->latch);
445
446   return z80dma;
447}
448
449static DEVICE_RESET( z80dma )
450{
451   z80dma_t *z80dma = token;
452
453   z80dma->status = 0;
454   z80dma->rdy = 0;
455   z80dma->num_follow = 0;
456   z80dma->dma_enabled = 0;
457   z80dma_update_status(z80dma);
458}
459
460
461static DEVICE_SET_INFO( z80dma )
462{
463   switch (state)
464   {
465      /* no parameters to set */
466   }
467}
468
469
470DEVICE_GET_INFO( z80dma )
471{
472   switch (state)
473   {
474      /* --- the following bits of info are returned as 64-bit signed integers --- */
475      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                     break;
476      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;      break;
477
478      /* --- the following bits of info are returned as pointers to data or functions --- */
479      case DEVINFO_FCT_SET_INFO:                  info->set_info = DEVICE_SET_INFO_NAME(z80dma); break;
480      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(z80dma);break;
481      case DEVINFO_FCT_STOP:                     /* Nothing */                     break;
482      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(z80dma);break;
483
484      /* --- the following bits of info are returned as NULL-terminated strings --- */
485      case DEVINFO_STR_NAME:                     info->s = "Z80DMA";                  break;
486      case DEVINFO_STR_FAMILY:                  info->s = "DMA controllers";         break;
487      case DEVINFO_STR_VERSION:                  info->s = "1.0";                  break;
488      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                  break;
489      case DEVINFO_STR_CREDITS:                  info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
490   }
491}
492
493/******************* Standard 8-bit CPU interfaces *******************/
494
495READ8_HANDLER( z80dma_0_r )
496{
497   z80dma_t   *z80dma = devtag_get_token(Machine, Z80DMA, Z80DMA_DEV_0_TAG);
498
499   return z80dma_read(z80dma);
500}
501
502READ8_HANDLER( z80dma_1_r )
503{
504   z80dma_t   *z80dma = devtag_get_token(Machine, Z80DMA, Z80DMA_DEV_1_TAG);
505
506   return z80dma_read(z80dma);
507}
508
509WRITE8_HANDLER( z80dma_0_w )
510{
511   z80dma_t   *z80dma = devtag_get_token(Machine, Z80DMA, Z80DMA_DEV_0_TAG);
512
513   z80dma_write(z80dma, data);
514}
515
516WRITE8_HANDLER( z80dma_1_w )
517{
518   z80dma_t   *z80dma = devtag_get_token(Machine, Z80DMA, Z80DMA_DEV_1_TAG);
519
520   z80dma_write(z80dma, data);
521}
522
523WRITE8_HANDLER( z80dma_0_rdy_w )
524{
525   z80dma_t   *z80dma = devtag_get_token(Machine, Z80DMA, Z80DMA_DEV_0_TAG);
526
527   z80dma_rdy_write(z80dma, data);
528}
529
530WRITE8_HANDLER( z80dma_1_rdy_w )
531{
532   z80dma_t   *z80dma = devtag_get_token(Machine, Z80DMA, Z80DMA_DEV_1_TAG);
533
534   z80dma_rdy_write(z80dma, data);
535}
src/emu/machine/z80dma.h
r1877r1878
77#ifndef Z80DMA_H
88#define Z80DMA_H
99
10struct z80dma_interface
10typedef struct _z80dma_t z80dma_t;
11typedef struct _z80dma_interface z80dma_interface;
12
13#define Z80DMA DEVICE_GET_INFO_NAME(z80dma)
14
15typedef UINT8 (*z80dma_read_func)(running_machine *machine, z80dma_t *z80dma, offs_t offset);
16#define Z80DMA_READ(name) UINT8 name(running_machine *machine, z80dma_t *z80dma, offs_t offset)
17
18typedef void (*z80dma_write_func)(running_machine *machine, z80dma_t *z80dma, offs_t offset, UINT8 data);
19#define Z80DMA_WRITE(name) void name(running_machine *machine, z80dma_t *z80dma, offs_t offset, UINT8 data)
20
21struct _z80dma_interface
1122{
1223   /* CPU to halt when DMA is active */
1324   int cpunum;
r1877r1878
1627   int clockhz;
1728
1829   /* accessors to main memory */
19   UINT8 (*memory_read_func)(offs_t offset);
20   void (*memory_write_func)(offs_t offset, UINT8 data);
30   z80dma_read_func   memory_read;
31   z80dma_write_func   memory_write;
2132
2233   /* port accesors */
23   UINT8 (*portA_read_func)(UINT16 addr);
24   void (*portA_write_func)(UINT16 addr, UINT8 data);
25   UINT8 (*portB_read_func)(UINT16 addr);
26   void (*portB_write_func)(UINT16 addr, UINT8 data);
34   z80dma_read_func   portA_read;
35   z80dma_write_func   portA_write;
36   z80dma_read_func   portB_read;
37   z80dma_write_func   portB_write;
2738
2839   /* interrupt callback - not implemented */
2940   /* void (*irqcb)(int state); */
3041};
3142
32int z80dma_init(int count);
33void z80dma_config(int which, const struct z80dma_interface *intf);
34void z80dma_reset(void);
43/* device interface */
44DEVICE_GET_INFO( z80dma );
3545
36void z80dma_rdy_write(int which, int state);
46void z80dma_rdy_write( z80dma_t *z80dma, int state);
47UINT8 z80dma_read( z80dma_t *z80dma);
48void z80dma_write( z80dma_t *z80dma, UINT8 data);
3749
50/******************* Standard 8-bit CPU interfaces *******************/
51
52#define Z80DMA_DEV_0_TAG   "z80dma0"
53
3854READ8_HANDLER(z80dma_0_r);
55WRITE8_HANDLER(z80dma_0_rdy_w);
56WRITE8_HANDLER(z80dma_0_w);
57
58#define Z80DMA_DEV_1_TAG   "z80dma1"
59
3960READ8_HANDLER(z80dma_1_r);
40WRITE8_HANDLER(z80dma_0_w);
4161WRITE8_HANDLER(z80dma_1_w);
42
43WRITE8_HANDLER(z80dma_0_rdy_w);
4462WRITE8_HANDLER(z80dma_1_rdy_w);
4563
46READ16_HANDLER(z80dma_16le_0_r);
47READ16_HANDLER(z80dma_16le_1_r);
48WRITE16_HANDLER(z80dma_16le_0_w);
49WRITE16_HANDLER(z80dma_16le_1_w);
50
51READ32_HANDLER(z80dma_32le_0_r);
52READ32_HANDLER(z80dma_32le_1_r);
53WRITE32_HANDLER(z80dma_32le_0_w);
54WRITE32_HANDLER(z80dma_32le_1_w);
55
56READ64_HANDLER(z80dma_64be_0_r);
57READ64_HANDLER(z80dma_64be_1_r);
58WRITE64_HANDLER(z80dma_64be_0_w);
59WRITE64_HANDLER(z80dma_64be_1_w);
60
6164#endif /* Z80_H */
src/emu/machine/pc16552d.c
r1877r1878
201201
202202            return duart_pop_rx_fifo(chip, channel);
203203         }
204         break;
205204      }
206205      case 1:
207206      {
r1877r1878
314313
315314            return;
316315         }
317         break;
318316      }
319317      case 1:
320318      {
r1877r1878
335333            check_interrupts(chip, channel);
336334            return;
337335         }
338         break;
339336      }
340337
341338      case 2:
src/emu/machine/8255ppi.c
r1877r1878
9191*********************************************************************/
9292
9393#include "driver.h"
94#include "deprecat.h"
9495#include "8255ppi.h"
9596#include "memconv.h"
9697
r1877r1878
99100
100101typedef struct
101102{
102   read8_handler port_read[3];
103   write8_handler port_write[3];
103   read8_machine_func port_read[3];
104   write8_machine_func port_write[3];
104105
105106   /* mode flags */
106107   UINT8 groupA_mode;
r1877r1878
268269   if (chip->in_mask[port])
269270   {
270271      if (chip->port_read[port])
271         ppi8255_input(chip, port, chip->port_read[port](0));
272         ppi8255_input(chip, port, chip->port_read[port](Machine, 0));
272273
273274      result |= chip->read[port] & chip->in_mask[port];
274275   }
r1877r1878
328329
329330   chip->output[port] = write_data;
330331   if (chip->port_write[port])
331      chip->port_write[port](0, write_data);
332      chip->port_write[port](Machine, 0, write_data);
332333}
333334
334335
r1877r1878
427428#endif
428429
429430
430void ppi8255_set_portAread(int which, read8_handler portAread)
431void ppi8255_set_portAread(int which, read8_machine_func portAread)
431432{
432433   chips[which].port_read[0] = portAread;
433434}
434435
435void ppi8255_set_portBread(int which, read8_handler portBread)
436void ppi8255_set_portBread(int which, read8_machine_func portBread)
436437{
437438   chips[which].port_read[1] = portBread;
438439}
439440
440void ppi8255_set_portCread(int which, read8_handler portCread)
441void ppi8255_set_portCread(int which, read8_machine_func portCread)
441442{
442443   chips[which].port_read[2] = portCread;
443444}
444445
445446
446void ppi8255_set_portAwrite(int which, write8_handler portAwrite)
447void ppi8255_set_portAwrite(int which, write8_machine_func portAwrite)
447448{
448449   chips[which].port_write[0] = portAwrite;
449450}
450451
451void ppi8255_set_portBwrite(int which, write8_handler portBwrite)
452void ppi8255_set_portBwrite(int which, write8_machine_func portBwrite)
452453{
453454   chips[which].port_write[1] = portBwrite;
454455}
455456
456void ppi8255_set_portCwrite(int which, write8_handler portCwrite)
457void ppi8255_set_portCwrite(int which, write8_machine_func portCwrite)
457458{
458459   chips[which].port_write[2] = portCwrite;
459460}
r1877r1878
571572WRITE8_HANDLER( ppi8255_6_w ) { ppi8255_w( 6, offset, data ); }
572573WRITE8_HANDLER( ppi8255_7_w ) { ppi8255_w( 7, offset, data ); }
573574
574READ16_HANDLER( ppi8255_16le_0_r ) { return read16le_with_read8_handler(ppi8255_0_r, offset, mem_mask); }
575READ16_HANDLER( ppi8255_16le_1_r ) { return read16le_with_read8_handler(ppi8255_1_r, offset, mem_mask); }
576READ16_HANDLER( ppi8255_16le_2_r ) { return read16le_with_read8_handler(ppi8255_2_r, offset, mem_mask); }
577READ16_HANDLER( ppi8255_16le_3_r ) { return read16le_with_read8_handler(ppi8255_3_r, offset, mem_mask); }
578READ16_HANDLER( ppi8255_16le_4_r ) { return read16le_with_read8_handler(ppi8255_4_r, offset, mem_mask); }
579READ16_HANDLER( ppi8255_16le_5_r ) { return read16le_with_read8_handler(ppi8255_5_r, offset, mem_mask); }
580READ16_HANDLER( ppi8255_16le_6_r ) { return read16le_with_read8_handler(ppi8255_6_r, offset, mem_mask); }
581READ16_HANDLER( ppi8255_16le_7_r ) { return read16le_with_read8_handler(ppi8255_7_r, offset, mem_mask); }
582WRITE16_HANDLER( ppi8255_16le_0_w ) { write16le_with_write8_handler(ppi8255_0_w, offset, data, mem_mask); }
583WRITE16_HANDLER( ppi8255_16le_1_w ) { write16le_with_write8_handler(ppi8255_1_w, offset, data, mem_mask); }
584WRITE16_HANDLER( ppi8255_16le_2_w ) { write16le_with_write8_handler(ppi8255_2_w, offset, data, mem_mask); }
585WRITE16_HANDLER( ppi8255_16le_3_w ) { write16le_with_write8_handler(ppi8255_3_w, offset, data, mem_mask); }
586WRITE16_HANDLER( ppi8255_16le_4_w ) { write16le_with_write8_handler(ppi8255_4_w, offset, data, mem_mask); }
587WRITE16_HANDLER( ppi8255_16le_5_w ) { write16le_with_write8_handler(ppi8255_5_w, offset, data, mem_mask); }
588WRITE16_HANDLER( ppi8255_16le_6_w ) { write16le_with_write8_handler(ppi8255_6_w, offset, data, mem_mask); }
589WRITE16_HANDLER( ppi8255_16le_7_w ) { write16le_with_write8_handler(ppi8255_7_w, offset, data, mem_mask); }
575READ16_HANDLER( ppi8255_16le_0_r ) { return read16le_with_read8_handler(ppi8255_0_r, machine, offset, mem_mask); }
576READ16_HANDLER( ppi8255_16le_1_r ) { return read16le_with_read8_handler(ppi8255_1_r, machine, offset, mem_mask); }
577READ16_HANDLER( ppi8255_16le_2_r ) { return read16le_with_read8_handler(ppi8255_2_r, machine, offset, mem_mask); }
578READ16_HANDLER( ppi8255_16le_3_r ) { return read16le_with_read8_handler(ppi8255_3_r, machine, offset, mem_mask); }
579READ16_HANDLER( ppi8255_16le_4_r ) { return read16le_with_read8_handler(ppi8255_4_r, machine, offset, mem_mask); }
580READ16_HANDLER( ppi8255_16le_5_r ) { return read16le_with_read8_handler(ppi8255_5_r, machine, offset, mem_mask); }
581READ16_HANDLER( ppi8255_16le_6_r ) { return read16le_with_read8_handler(ppi8255_6_r, machine, offset, mem_mask); }
582READ16_HANDLER( ppi8255_16le_7_r ) { return read16le_with_read8_handler(ppi8255_7_r, machine, offset, mem_mask); }
583WRITE16_HANDLER( ppi8255_16le_0_w ) { write16le_with_write8_handler(ppi8255_0_w, machine, offset, data, mem_mask); }
584WRITE16_HANDLER( ppi8255_16le_1_w ) { write16le_with_write8_handler(ppi8255_1_w, machine, offset, data, mem_mask); }
585WRITE16_HANDLER( ppi8255_16le_2_w ) { write16le_with_write8_handler(ppi8255_2_w, machine, offset, data, mem_mask); }
586WRITE16_HANDLER( ppi8255_16le_3_w ) { write16le_with_write8_handler(ppi8255_3_w, machine, offset, data, mem_mask); }
587WRITE16_HANDLER( ppi8255_16le_4_w ) { write16le_with_write8_handler(ppi8255_4_w, machine, offset, data, mem_mask); }
588WRITE16_HANDLER( ppi8255_16le_5_w ) { write16le_with_write8_handler(ppi8255_5_w, machine, offset, data, mem_mask); }
589WRITE16_HANDLER( ppi8255_16le_6_w ) { write16le_with_write8_handler(ppi8255_6_w, machine, offset, data, mem_mask); }
590WRITE16_HANDLER( ppi8255_16le_7_w ) { write16le_with_write8_handler(ppi8255_7_w, machine, offset, data, mem_mask); }
src/emu/machine/8042kbdc.c
r1877r1878
613613
614614READ32_HANDLER( kbdc8042_32le_r )
615615{
616   return read32le_with_read8_handler(kbdc8042_8_r, offset, mem_mask);
616   return read32le_with_read8_handler(kbdc8042_8_r, machine, offset, mem_mask);
617617}
618618
619619
620620
621621WRITE32_HANDLER( kbdc8042_32le_w )
622622{
623   write32le_with_write8_handler(kbdc8042_8_w, offset, data, mem_mask);
623   write32le_with_write8_handler(kbdc8042_8_w, machine, offset, data, mem_mask);
624624}
625625
626626
627627
628628READ64_HANDLER( kbdc8042_64be_r )
629629{
630   return read64be_with_read8_handler(kbdc8042_8_r, offset, mem_mask);
630   return read64be_with_read8_handler(kbdc8042_8_r, machine, offset, mem_mask);
631631}
632632
633633
634634
635635WRITE64_HANDLER( kbdc8042_64be_w )
636636{
637   write64be_with_write8_handler(kbdc8042_8_w, offset, data, mem_mask);
637   write64be_with_write8_handler(kbdc8042_8_w, machine, offset, data, mem_mask);
638638}
src/emu/machine/8255ppi.h
r1877r1878
1414typedef struct
1515{
1616   int num;                      /* number of PPIs to emulate */
17   read8_handler portAread[MAX_8255];
18   read8_handler portBread[MAX_8255];
19   read8_handler portCread[MAX_8255];
20   write8_handler portAwrite[MAX_8255];
21   write8_handler portBwrite[MAX_8255];
22   write8_handler portCwrite[MAX_8255];
17   read8_machine_func portAread[MAX_8255];
18   read8_machine_func portBread[MAX_8255];
19   read8_machine_func portCread[MAX_8255];
20   write8_machine_func portAwrite[MAX_8255];
21   write8_machine_func portBwrite[MAX_8255];
22   write8_machine_func portCwrite[MAX_8255];
2323} ppi8255_interface;
2424
2525
r1877r1878
3030UINT8 ppi8255_r ( int which, offs_t offset );
3131void ppi8255_w( int which, offs_t offset, UINT8 data );
3232
33void ppi8255_set_portAread( int which, read8_handler portAread);
34void ppi8255_set_portBread( int which, read8_handler portBread);
35void ppi8255_set_portCread( int which, read8_handler portCread);
33void ppi8255_set_portAread( int which, read8_machine_func portAread);
34void ppi8255_set_portBread( int which, read8_machine_func portBread);
35void ppi8255_set_portCread( int which, read8_machine_func portCread);
3636
37void ppi8255_set_portAwrite( int which, write8_handler portAwrite);
38void ppi8255_set_portBwrite( int which, write8_handler portBwrite);
39void ppi8255_set_portCwrite( int which, write8_handler portCwrite);
37void ppi8255_set_portAwrite( int which, write8_machine_func portAwrite);
38void ppi8255_set_portBwrite( int which, write8_machine_func portBwrite);
39void ppi8255_set_portCwrite( int which, write8_machine_func portCwrite);
4040
4141void ppi8255_set_portA( int which, UINT8 data );
4242void ppi8255_set_portB( int which, UINT8 data );
src/emu/machine/8237dma.c
r1877r1878
435435WRITE8_HANDLER( dma8237_0_w ) { dma8237_write(0, offset, data); }
436436WRITE8_HANDLER( dma8237_1_w ) { dma8237_write(1, offset, data); }
437437
438READ16_HANDLER( dma8237_16le_0_r ) { return read16le_with_read8_handler(dma8237_0_r, offset, mem_mask); }
439READ16_HANDLER( dma8237_16le_1_r ) { return read16le_with_read8_handler(dma8237_1_r, offset, mem_mask); }
440WRITE16_HANDLER( dma8237_16le_0_w ) { write16le_with_write8_handler(dma8237_0_w, offset, data, mem_mask); }
441WRITE16_HANDLER( dma8237_16le_1_w ) { write16le_with_write8_handler(dma8237_1_w, offset, data, mem_mask); }
438READ16_HANDLER( dma8237_16le_0_r ) { return read16le_with_read8_handler(dma8237_0_r, machine, offset, mem_mask); }
439READ16_HANDLER( dma8237_16le_1_r ) { return read16le_with_read8_handler(dma8237_1_r, machine, offset, mem_mask); }
440WRITE16_HANDLER( dma8237_16le_0_w ) { write16le_with_write8_handler(dma8237_0_w, machine, offset, data, mem_mask); }
441WRITE16_HANDLER( dma8237_16le_1_w ) { write16le_with_write8_handler(dma8237_1_w, machine, offset, data, mem_mask); }
442442
443READ32_HANDLER( dma8237_32le_0_r ) { return read32le_with_read8_handler(dma8237_0_r, offset, mem_mask); }
444READ32_HANDLER( dma8237_32le_1_r ) { return read32le_with_read8_handler(dma8237_1_r, offset, mem_mask); }
445WRITE32_HANDLER( dma8237_32le_0_w ) { write32le_with_write8_handler(dma8237_0_w, offset, data, mem_mask); }
446WRITE32_HANDLER( dma8237_32le_1_w ) { write32le_with_write8_handler(dma8237_1_w, offset, data, mem_mask); }
443READ32_HANDLER( dma8237_32le_0_r ) { return read32le_with_read8_handler(dma8237_0_r, machine, offset, mem_mask); }
444READ32_HANDLER( dma8237_32le_1_r ) { return read32le_with_read8_handler(dma8237_1_r, machine, offset, mem_mask); }
445WRITE32_HANDLER( dma8237_32le_0_w ) { write32le_with_write8_handler(dma8237_0_w, machine, offset, data, mem_mask); }
446WRITE32_HANDLER( dma8237_32le_1_w ) { write32le_with_write8_handler(dma8237_1_w, machine, offset, data, mem_mask); }
447447
448READ64_HANDLER( dma8237_64be_0_r ) { return read64be_with_read8_handler(dma8237_0_r, offset, mem_mask); }
449READ64_HANDLER( dma8237_64be_1_r ) { return read64be_with_read8_handler(dma8237_1_r, offset, mem_mask); }
450WRITE64_HANDLER( dma8237_64be_0_w ) { write64be_with_write8_handler(dma8237_0_w, offset, data, mem_mask); }
451WRITE64_HANDLER( dma8237_64be_1_w ) { write64be_with_write8_handler(dma8237_1_w, offset, data, mem_mask); }
448READ64_HANDLER( dma8237_64be_0_r ) { return read64be_with_read8_handler(dma8237_0_r, machine, offset, mem_mask); }
449READ64_HANDLER( dma8237_64be_1_r ) { return read64be_with_read8_handler(dma8237_1_r, machine, offset, mem_mask); }
450WRITE64_HANDLER( dma8237_64be_0_w ) { write64be_with_write8_handler(dma8237_0_w, machine, offset, data, mem_mask); }
451WRITE64_HANDLER( dma8237_64be_1_w ) { write64be_with_write8_handler(dma8237_1_w, machine, offset, data, mem_mask); }
src/emu/machine/8257dma.c
r1877r1878
363363WRITE8_HANDLER( dma8257_0_w ) { dma8257_write(0, offset, data); }
364364WRITE8_HANDLER( dma8257_1_w ) { dma8257_write(1, offset, data); }
365365
366READ16_HANDLER( dma8257_16le_0_r ) { return read16le_with_read8_handler(dma8257_0_r, offset, mem_mask); }
367READ16_HANDLER( dma8257_16le_1_r ) { return read16le_with_read8_handler(dma8257_1_r, offset, mem_mask); }
368WRITE16_HANDLER( dma8257_16le_0_w ) { write16le_with_write8_handler(dma8257_0_w, offset, data, mem_mask); }
369WRITE16_HANDLER( dma8257_16le_1_w ) { write16le_with_write8_handler(dma8257_1_w, offset, data, mem_mask); }
366READ16_HANDLER( dma8257_16le_0_r ) { return read16le_with_read8_handler(dma8257_0_r, machine, offset, mem_mask); }
367READ16_HANDLER( dma8257_16le_1_r ) { return read16le_with_read8_handler(dma8257_1_r, machine, offset, mem_mask); }
368WRITE16_HANDLER( dma8257_16le_0_w ) { write16le_with_write8_handler(dma8257_0_w, machine, offset, data, mem_mask); }
369WRITE16_HANDLER( dma8257_16le_1_w ) { write16le_with_write8_handler(dma8257_1_w, machine, offset, data, mem_mask); }
370370
371READ32_HANDLER( dma8257_32le_0_r ) { return read32le_with_read8_handler(dma8257_0_r, offset, mem_mask); }
372READ32_HANDLER( dma8257_32le_1_r ) { return read32le_with_read8_handler(dma8257_1_r, offset, mem_mask); }
373WRITE32_HANDLER( dma8257_32le_0_w ) { write32le_with_write8_handler(dma8257_0_w, offset, data, mem_mask); }
374WRITE32_HANDLER( dma8257_32le_1_w ) { write32le_with_write8_handler(dma8257_1_w, offset, data, mem_mask); }
371READ32_HANDLER( dma8257_32le_0_r ) { return read32le_with_read8_handler(dma8257_0_r, machine, offset, mem_mask); }
372READ32_HANDLER( dma8257_32le_1_r ) { return read32le_with_read8_handler(dma8257_1_r, machine, offset, mem_mask); }
373WRITE32_HANDLER( dma8257_32le_0_w ) { write32le_with_write8_handler(dma8257_0_w, machine, offset, data, mem_mask); }
374WRITE32_HANDLER( dma8257_32le_1_w ) { write32le_with_write8_handler(dma8257_1_w, machine, offset, data, mem_mask); }
375375
376READ64_HANDLER( dma8257_64be_0_r ) { return read64be_with_read8_handler(dma8257_0_r, offset, mem_mask); }
377READ64_HANDLER( dma8257_64be_1_r ) { return read64be_with_read8_handler(dma8257_1_r, offset, mem_mask); }
378WRITE64_HANDLER( dma8257_64be_0_w ) { write64be_with_write8_handler(dma8257_0_w, offset, data, mem_mask); }
379WRITE64_HANDLER( dma8257_64be_1_w ) { write64be_with_write8_handler(dma8257_1_w, offset, data, mem_mask); }
376READ64_HANDLER( dma8257_64be_0_r ) { return read64be_with_read8_handler(dma8257_0_r, machine, offset, mem_mask); }
377READ64_HANDLER( dma8257_64be_1_r ) { return read64be_with_read8_handler(dma8257_1_r, machine, offset, mem_mask); }
378WRITE64_HANDLER( dma8257_64be_0_w ) { write64be_with_write8_handler(dma8257_0_w, machine, offset, data, mem_mask); }
379WRITE64_HANDLER( dma8257_64be_1_w ) { write64be_with_write8_handler(dma8257_1_w, machine, offset, data, mem_mask); }
src/emu/machine/z80sio.c
r1877r1878
88***************************************************************************/
99
1010#include "driver.h"
11#include "deprecat.h"
1112#include "z80sio.h"
1213#include "cpu/z80/z80.h"
1314#include "cpu/z80/z80daisy.h"
r1877r1878
180181   UINT8      int_state[8];      /* interrupt states */
181182
182183   void (*irq_cb)(int state);
183   write8_handler dtr_changed_cb;
184   write8_handler rts_changed_cb;
185   write8_handler break_changed_cb;
186   write8_handler transmit_cb;
184   write8_machine_func dtr_changed_cb;
185   write8_machine_func rts_changed_cb;
186   write8_machine_func break_changed_cb;
187   write8_machine_func transmit_cb;
187188   int (*receive_poll_cb)(int which);
188189};
189190
r1877r1878
418419      /* SIO write register 5 */
419420      case 5:
420421         if (((old ^ data) & SIO_WR5_DTR) && sio->dtr_changed_cb)
421            (*sio->dtr_changed_cb)(ch, (data & SIO_WR5_DTR) != 0);
422            (*sio->dtr_changed_cb)(Machine, ch, (data & SIO_WR5_DTR) != 0);
422423         if (((old ^ data) & SIO_WR5_SEND_BREAK) && sio->break_changed_cb)
423            (*sio->break_changed_cb)(ch, (data & SIO_WR5_SEND_BREAK) != 0);
424            (*sio->break_changed_cb)(Machine, ch, (data & SIO_WR5_SEND_BREAK) != 0);
424425         if (((old ^ data) & SIO_WR5_RTS) && sio->rts_changed_cb)
425            (*sio->rts_changed_cb)(ch, (data & SIO_WR5_RTS) != 0);
426            (*sio->rts_changed_cb)(Machine, ch, (data & SIO_WR5_RTS) != 0);
426427         break;
427428   }
428429}
r1877r1878
641642
642643      /* actually transmit the character */
643644      if (sio->transmit_cb != NULL)
644         (*sio->transmit_cb)(ch, chan->outbuf);
645         (*sio->transmit_cb)(machine, ch, chan->outbuf);
645646
646647      /* update the status register */
647648      chan->status[0] |= SIO_RR0_TX_BUFFER_EMPTY;
src/emu/machine/z80sio.h
r1877r1878
2424{
2525   int baseclock;
2626   void (*irq_cb)(int state);
27   write8_handler dtr_changed_cb;
28   write8_handler rts_changed_cb;
29   write8_handler break_changed_cb;
30   write8_handler transmit_cb;
27   write8_machine_func dtr_changed_cb;
28   write8_machine_func rts_changed_cb;
29   write8_machine_func break_changed_cb;
30   write8_machine_func transmit_cb;
3131   int (*receive_poll_cb)(int which);
3232};
3333
src/emu/machine/pci.c
r1877r1878
193193
194194
195195
196READ64_HANDLER(pci_64be_r) { return read64be_with_32le_handler(pci_32le_r, offset, mem_mask); }
197WRITE64_HANDLER(pci_64be_w) { write64be_with_32le_handler(pci_32le_w, offset, data, mem_mask); }
196READ64_HANDLER(pci_64be_r) { return read64be_with_32le_handler(pci_32le_r, machine, offset, mem_mask); }
197WRITE64_HANDLER(pci_64be_w) { write64be_with_32le_handler(pci_32le_w, machine, offset, data, mem_mask); }
src/emu/machine/z80ctc.c
r1877r1878
8181   attotime period16;         /* 16/system clock */
8282   attotime period256;      /* 256/system clock */
8383   void (*intr)(int which);   /* interrupt callback */
84   write8_handler zc[4];      /* zero crossing callbacks */
84   write8_machine_func zc[4];      /* zero crossing callbacks */
8585   UINT8 notimer;            /* no timer masks */
8686   UINT16 mode[4];            /* current mode */
8787   UINT16 tconst[4];         /* time constant */
r1877r1878
132132   /* generate the clock pulse */
133133   if (ctc->zc[ch])
134134   {
135      (*ctc->zc[ch])(0,1);
136      (*ctc->zc[ch])(0,0);
135      (*ctc->zc[ch])(machine,0,1);
136      (*ctc->zc[ch])(machine,0,0);
137137   }
138138
139139   /* reset the down counter */
src/emu/machine/pit8253.c
r1877r1878
4545{
4646   double clockin;               /* input clock frequency in Hz */
4747
48   void (*output_callback)(int);   /* callback function for when output changes */
48   void (*output_callback_func)(int);   /* callback function for when output changes */
4949   void (*freq_callback)(double);   /* callback function for when output frequency changes */
5050
5151   attotime last_updated;         /* time when last updated */
r1877r1878
272272   if (output != timer->output)
273273   {
274274      timer->output =   output;
275      if (timer->output_callback != NULL)
275      if (timer->output_callback_func != NULL)
276276      {
277         timer->output_callback(output);
277         timer->output_callback_func(output);
278278      }
279279   }
280280}
r1877r1878
602602      break;
603603   }
604604
605   if (timer->output_callback != NULL)
605   if (timer->output_callback_func != NULL)
606606   {
607607      timer->cycles_to_output   = cycles_to_output;
608608      if (cycles_to_output ==   CYCLES_NEVER ||   timer->clockin == 0)
r1877r1878
766766         timer =   get_timer(pit,timerno);
767767
768768         timer->clockin = pit->config->timer[timerno].clockin;
769         timer->output_callback = pit->config->timer[timerno].output_callback;
769         timer->output_callback_func = pit->config->timer[timerno].output_callback_func;
770770         timer->freq_callback = pit->config->timer[timerno].clock_callback;
771771
772         if (timer->output_callback == NULL)
772         if (timer->output_callback_func == NULL)
773773            timer->outputtimer = NULL;
774774         else
775775         {
r1877r1878
11881188WRITE16_HANDLER ( pit8253_0_lsb_w ) { if (ACCESSING_LSB) pit8253_write(0, offset, data); }
11891189WRITE16_HANDLER ( pit8253_1_lsb_w ) { if (ACCESSING_LSB) pit8253_write(1, offset, data); }
11901190
1191READ16_HANDLER ( pit8253_16le_0_r ) { return read16le_with_read8_handler(pit8253_0_r, offset, mem_mask); }
1192READ16_HANDLER ( pit8253_16le_1_r ) { return read16le_with_read8_handler(pit8253_1_r, offset, mem_mask); }
1193WRITE16_HANDLER   ( pit8253_16le_0_w ) { write16le_with_write8_handler(pit8253_0_w, offset, data,   mem_mask); }
1194WRITE16_HANDLER   ( pit8253_16le_1_w ) { write16le_with_write8_handler(pit8253_1_w, offset, data,   mem_mask); }
1191READ16_HANDLER ( pit8253_16le_0_r ) { return read16le_with_read8_handler(pit8253_0_r, machine, offset, mem_mask); }
1192READ16_HANDLER ( pit8253_16le_1_r ) { return read16le_with_read8_handler(pit8253_1_r, machine, offset, mem_mask); }
1193WRITE16_HANDLER   ( pit8253_16le_0_w ) { write16le_with_write8_handler(pit8253_0_w, machine, offset, data,   mem_mask); }
1194WRITE16_HANDLER   ( pit8253_16le_1_w ) { write16le_with_write8_handler(pit8253_1_w, machine, offset, data,   mem_mask); }
11951195
1196READ32_HANDLER ( pit8253_32le_0_r ) { return read32le_with_read8_handler(pit8253_0_r, offset, mem_mask); }
1197READ32_HANDLER ( pit8253_32le_1_r ) { return read32le_with_read8_handler(pit8253_1_r, offset, mem_mask); }
1198WRITE32_HANDLER   ( pit8253_32le_0_w ) { write32le_with_write8_handler(pit8253_0_w, offset, data,   mem_mask); }
1199WRITE32_HANDLER   ( pit8253_32le_1_w ) { write32le_with_write8_handler(pit8253_1_w, offset, data,   mem_mask); }
1196READ32_HANDLER ( pit8253_32le_0_r ) { return read32le_with_read8_handler(pit8253_0_r, machine, offset, mem_mask); }
1197READ32_HANDLER ( pit8253_32le_1_r ) { return read32le_with_read8_handler(pit8253_1_r, machine, offset, mem_mask); }
1198WRITE32_HANDLER   ( pit8253_32le_0_w ) { write32le_with_write8_handler(pit8253_0_w, machine, offset, data,   mem_mask); }
1199WRITE32_HANDLER   ( pit8253_32le_1_w ) { write32le_with_write8_handler(pit8253_1_w, machine, offset, data,   mem_mask); }
12001200
1201READ64_HANDLER ( pit8253_64be_0_r ) { return read64be_with_read8_handler(pit8253_0_r, offset, mem_mask); }
1202READ64_HANDLER ( pit8253_64be_1_r ) { return read64be_with_read8_handler(pit8253_1_r, offset, mem_mask); }
1203WRITE64_HANDLER   ( pit8253_64be_0_w ) { write64be_with_write8_handler(pit8253_0_w, offset, data,   mem_mask); }
1204WRITE64_HANDLER   ( pit8253_64be_1_w ) { write64be_with_write8_handler(pit8253_1_w, offset, data,   mem_mask); }
1201READ64_HANDLER ( pit8253_64be_0_r ) { return read64be_with_read8_handler(pit8253_0_r, machine, offset, mem_mask); }
1202READ64_HANDLER ( pit8253_64be_1_r ) { return read64be_with_read8_handler(pit8253_1_r, machine, offset, mem_mask); }
1203WRITE64_HANDLER   ( pit8253_64be_0_w ) { write64be_with_write8_handler(pit8253_0_w, machine, offset, data,   mem_mask); }
1204WRITE64_HANDLER   ( pit8253_64be_1_w ) { write64be_with_write8_handler(pit8253_1_w, machine, offset, data,   mem_mask); }
12051205
12061206WRITE8_HANDLER ( pit8253_0_gate_w )   { pit8253_gate_write(0,   offset,   data); }
12071207WRITE8_HANDLER ( pit8253_1_gate_w )   { pit8253_gate_write(1,   offset,   data); }
src/emu/machine/z80ctc.h
r1877r1878
2929   int baseclock;                           /* timer clock */
3030   int notimer;                         /* timer disablers */
3131   void (*intr)(int which);             /* callback when change interrupt status */
32   write8_handler zc0;   /* ZC/TO0 callback */
33   write8_handler zc1;   /* ZC/TO1 callback */
34   write8_handler zc2;   /* ZC/TO2 callback */
32   write8_machine_func zc0;   /* ZC/TO0 callback */
33   write8_machine_func zc1;   /* ZC/TO1 callback */
34   write8_machine_func zc2;   /* ZC/TO2 callback */
3535} z80ctc_interface;
3636
3737
src/emu/machine/pit8253.h
r1877r1878
1515   struct
1616   {
1717      double clockin;
18      void (*output_callback)(int state);
18      void (*output_callback_func)(int state);
1919      void (*clock_callback)(double clockout);
2020   } timer[3];
2121};
src/emu/machine/mc146818.c
r1877r1878
364364
365365READ16_HANDLER(mc146818_port16le_r)
366366{
367   return read16le_with_read8_handler(mc146818_port_r, offset, mem_mask);
367   return read16le_with_read8_handler(mc146818_port_r, machine, offset, mem_mask);
368368}
369369
370370WRITE16_HANDLER(mc146818_port16le_w)
371371{
372   write16le_with_write8_handler(mc146818_port_w, offset, data, mem_mask);
372   write16le_with_write8_handler(mc146818_port_w, machine, offset, data, mem_mask);
373373}
374374
375375READ32_HANDLER(mc146818_port32le_r)
376376{
377   return read32le_with_read8_handler(mc146818_port_r, offset, mem_mask);
377   return read32le_with_read8_handler(mc146818_port_r, machine, offset, mem_mask);
378378}
379379
380380WRITE32_HANDLER(mc146818_port32le_w)
381381{
382   write32le_with_write8_handler(mc146818_port_w, offset, data, mem_mask);
382   write32le_with_write8_handler(mc146818_port_w, machine, offset, data, mem_mask);
383383}
384384
385385READ64_HANDLER(mc146818_port64be_r)
386386{
387   return read64be_with_read8_handler(mc146818_port_r, offset, mem_mask);
387   return read64be_with_read8_handler(mc146818_port_r, machine, offset, mem_mask);
388388}
389389
390390WRITE64_HANDLER(mc146818_port64be_w)
391391{
392   write64be_with_write8_handler(mc146818_port_w, offset, data, mem_mask);
392   write64be_with_write8_handler(mc146818_port_w, machine, offset, data, mem_mask);
393393}
src/emu/mame.h
r1877r1878
157157***************************************************************************/
158158
159159/* output channel callback */
160typedef void (*output_callback)(void *param, const char *format, va_list argptr);
160typedef void (*output_callback_func)(void *param, const char *format, va_list argptr);
161161
162162
163163/* forward type declarations */
r1877r1878
340340/* ----- output management ----- */
341341
342342/* set the output handler for a channel, returns the current one */
343void mame_set_output_channel(output_channel channel, output_callback callback, void *param, output_callback *prevcb, void **prevparam);
343void mame_set_output_channel(output_channel channel, output_callback_func callback, void *param, output_callback_func *prevcb, void **prevparam);
344344
345345/* built-in default callbacks */
346346void mame_file_output_callback(void *param, const char *format, va_list argptr);
src/emu/inptport.h
r1877r1878
4040
4141
4242/* macro for a custom callback functions (PORT_CUSTOM) */
43#define CUSTOM_INPUT(name)   UINT32 name(void *param)
43#define CUSTOM_INPUT(name)   UINT32 name(running_machine *machine, void *param)
4444
45/* macro for port changed callback functions (PORT_CHANGED) */
46#define INPUT_CHANGED(name)   void name(running_machine *machine, void *param, UINT32 oldval, UINT32 newval)
4547
48
4649/* sequence types for input_port_seq() call */
4750enum _input_seq_type
4851{
r1877r1878
355358   INPUT_TOKEN_INVERT,
356359   INPUT_TOKEN_UNUSED,
357360   INPUT_TOKEN_CUSTOM,
361   INPUT_TOKEN_CHANGED,
358362   INPUT_TOKEN_DIPNAME,
359363   INPUT_TOKEN_DIPSETTING,
360364   INPUT_TOKEN_DIPLOCATION,
r1877r1878
497501
498502
499503/* a custom input port callback function */
500typedef UINT32 (*input_port_custom_func)(void *param);
501typedef void (*input_port_changed_func)(void *param, UINT32 oldval, UINT32 newval);
504typedef UINT32 (*input_port_custom_func)(running_machine *machine, void *param);
505typedef void (*input_port_changed_func)(running_machine *machine, void *param, UINT32 oldval, UINT32 newval);
502506
503507
504508/* this type is used to encode input port definitions */
r1877r1878
508512   TOKEN_COMMON_FIELDS
509513   const input_port_token *tokenptr;
510514   input_port_custom_func customptr;
515   input_port_changed_func changedptr;
511516};
512517
513518
r1877r1878
560565   const char *name;         /* user-friendly name to display */
561566   input_seq   seq;         /* input sequence affecting the input bits */
562567   input_port_custom_func custom;/* custom callback routine */
563   void *      custom_param;   /* parameter for callback routine */
568   void *      custom_param;   /* parameter for custom callback routine */
569   input_port_changed_func changed;/* changed callback routine */
570   void *      changed_param;   /* parameter for changed callback routine */
571   UINT32      changed_last_value; /* the last value for changed detection purposes */
564572
565573   /* valid if type is between __ipt_analog_start and __ipt_analog_end */
566574   struct
r1877r1878
783791   TOKEN_PTR(customptr, _callback), \
784792   TOKEN_PTR(voidptr, _param),
785793
794/* changed callbacks */
795#define PORT_CHANGED(_callback, _param) \
796   TOKEN_UINT32_PACK1(INPUT_TOKEN_CHANGED, 8), \
797   TOKEN_PTR(changedptr, _callback), \
798   TOKEN_PTR(voidptr, _param),
799
786800/* dip switch definition */
787801#define PORT_DIPNAME(_mask,_default,_name) \
788802   TOKEN_UINT32_PACK1(INPUT_TOKEN_DIPNAME, 8), \
r1877r1878
893907***************************************************************************/
894908
895909void input_port_init(running_machine *machine, const input_port_token *ipt);
910void input_port_post_init(running_machine *machine);
896911const char *input_port_string_from_token(const input_port_token token);
897912
898913input_port_entry *input_port_initialize(input_port_init_params *params, UINT32 type, const char *tag, UINT32 mask, UINT32 defval);
r1877r1878
908923int port_type_in_use(int type);
909924int port_type_to_group(int type, int player);
910925int port_tag_to_index(const char *tag);
911read8_handler port_tag_to_handler8(const char *tag);
912read16_handler port_tag_to_handler16(const char *tag);
913read32_handler port_tag_to_handler32(const char *tag);
914read64_handler port_tag_to_handler64(const char *tag);
926read8_machine_func port_tag_to_handler8(const char *tag);
927read16_machine_func port_tag_to_handler16(const char *tag);
928read32_machine_func port_tag_to_handler32(const char *tag);
929read64_machine_func port_tag_to_handler64(const char *tag);
915930const char *input_port_name(const input_port_entry *in);
916931const input_seq *input_port_seq(input_port_entry *in, input_seq_type seqtype);
917932const input_seq *input_port_default_seq(int type, int player, input_seq_type seqtype);
918933int input_port_condition(const input_port_entry *in);
919void input_port_set_changed_callback(int port, UINT32 mask, input_port_changed_func callback, void *param);
920934
921935const char *port_type_to_token(int type, int player);
922936int token_to_port_type(const char *string, int *player);
r1877r1878
926940int input_ui_pressed_repeat(int code, int speed);
927941
928942void input_port_update_defaults(void);
929void input_port_vblank_start(void);   /* called by cpuintrf.c - not for external use */
930void input_port_vblank_end(void);   /* called by cpuintrf.c - not for external use */
931943
932944void input_port_set_digital_value(int port, UINT32 value, UINT32 mask);
933945
src/emu/rendfont.h
r1877r1878
2525void render_font_free(render_font *font);
2626INT32 render_font_get_pixel_height(render_font *font);
2727render_texture *render_font_get_char_texture_and_bounds(render_font *font, float height, float aspect, unicode_char ch, render_bounds *bounds);
28void render_font_get_scaled_bitmap_and_bounds(render_font *font, mame_bitmap *dest, float height, float aspect, unicode_char chnum, rectangle *bounds);
28void render_font_get_scaled_bitmap_and_bounds(render_font *font, bitmap_t *dest, float height, float aspect, unicode_char chnum, rectangle *bounds);
2929float render_font_get_char_width(render_font *font, float height, float aspect, unicode_char ch);
3030float render_font_get_string_width(render_font *font, float height, float aspect, const char *string);
3131float render_font_get_utf8string_width(render_font *font, float height, float aspect, const char *utf8string);
src/emu/devintrf.h
r1877r1878
161161   device_reset_func      reset;               /* quick pointer to reset callback */
162162   const void *         static_config;         /* static device configuration */
163163   void *               inline_config;         /* inline device configuration */
164
165   /* these two fields are only valid if the device is live */
164166   void *               token;               /* token if device is live */
167   running_machine *      machine;            /* machine if device is live */
168
165169   char               tag[1];               /* tag for this instance */
166170};
167171
src/emu/rendutil.c
r1877r1878
2222/* utilities */
2323static void resample_argb_bitmap_average(UINT32 *dest, UINT32 drowpixels, UINT32 dwidth, UINT32 dheight, const UINT32 *source, UINT32 srowpixels, UINT32 swidth, UINT32 sheight, const render_color *color, UINT32 dx, UINT32 dy);
2424static void resample_argb_bitmap_bilinear(UINT32 *dest, UINT32 drowpixels, UINT32 dwidth, UINT32 dheight, const UINT32 *source, UINT32 srowpixels, UINT32 swidth, UINT32 sheight, const render_color *color, UINT32 dx, UINT32 dy);
25static void copy_png_to_bitmap(mame_bitmap *bitmap, const png_info *png, int *hasalpha);
26static void copy_png_alpha_to_bitmap(mame_bitmap *bitmap, const png_info *png, int *hasalpha);
25static void copy_png_to_bitmap(bitmap_t *bitmap, const png_info *png, int *hasalpha);
26static void copy_png_alpha_to_bitmap(bitmap_t *bitmap, const png_info *png, int *hasalpha);
2727
2828
2929
r1877r1878
5252    quality resampling of a texture
5353-------------------------------------------------*/
5454
55void render_resample_argb_bitmap_hq(void *dest, UINT32 drowpixels, UINT32 dwidth, UINT32 dheight, const mame_bitmap *source, const rectangle *orig_sbounds, const render_color *color)
55void render_resample_argb_bitmap_hq(void *dest, UINT32 drowpixels, UINT32 dwidth, UINT32 dheight, const bitmap_t *source, const rectangle *orig_sbounds, const render_color *color)
5656{
5757   UINT32 swidth, sheight;
5858   const UINT32 *sbase;
r1877r1878
556556
557557/*-------------------------------------------------
558558    render_load_png - load a PNG file into a
559    mame_bitmap
559    bitmap_t
560560-------------------------------------------------*/
561561
562mame_bitmap *render_load_png(const char *dirname, const char *filename, mame_bitmap *alphadest, int *hasalpha)
562bitmap_t *render_load_png(const char *dirname, const char *filename, bitmap_t *alphadest, int *hasalpha)
563563{
564   mame_bitmap *bitmap = NULL;
564   bitmap_t *bitmap = NULL;
565565   file_error filerr;
566566   mame_file *file;
567567   png_info png;
r1877r1878
636636    bitmap
637637-------------------------------------------------*/
638638
639static void copy_png_to_bitmap(mame_bitmap *bitmap, const png_info *png, int *hasalpha)
639static void copy_png_to_bitmap(bitmap_t *bitmap, const png_info *png, int *hasalpha)
640640{
641641   UINT8 accumalpha = 0xff;
642642   UINT8 *src;
r1877r1878
701701    to the alpha channel of a bitmap
702702-------------------------------------------------*/
703703
704static void copy_png_alpha_to_bitmap(mame_bitmap *bitmap, const png_info *png, int *hasalpha)
704static void copy_png_alpha_to_bitmap(bitmap_t *bitmap, const png_info *png, int *hasalpha)
705705{
706706   UINT8 accumalpha = 0xff;
707707   UINT8 *src;
src/emu/rendersw.c
r1877r1878
18811881    using a software rasterizer
18821882-------------------------------------------------*/
18831883
1884void FUNC_PREFIX(draw_primitives)(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch)
1884static void FUNC_PREFIX(draw_primitives)(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch)
18851885{
18861886   const render_primitive *prim;
18871887
src/emu/rendutil.h
r1877r1878
2525
2626/* ----- render utilities ----- */
2727
28void render_resample_argb_bitmap_hq(void *dest, UINT32 drowpixels, UINT32 dwidth, UINT32 dheight, const mame_bitmap *source, const rectangle *sbounds, const render_color *color);
28void render_resample_argb_bitmap_hq(void *dest, UINT32 drowpixels, UINT32 dwidth, UINT32 dheight, const bitmap_t *source, const rectangle *sbounds, const render_color *color);
2929int render_clip_line(render_bounds *bounds, const render_bounds *clip);
3030int render_clip_quad(render_bounds *bounds, const render_bounds *clip, render_quad_texuv *texcoords);
3131void render_line_to_quad(const render_bounds *bounds, float width, render_bounds *bounds0, render_bounds *bounds1);
32mame_bitmap *render_load_png(const char *dirname, const char *filename, mame_bitmap *alphadest, int *hasalpha);
32bitmap_t *render_load_png(const char *dirname, const char *filename, bitmap_t *alphadest, int *hasalpha);
3333
3434
3535
src/emu/cpuexec.c
r1877r1878
1010***************************************************************************/
1111
1212#include "driver.h"
13#include "deprecat.h"
14#include "cheat.h"
1513#include "profiler.h"
16#include "debugger.h"
1714
18#ifdef ENABLE_DEBUGGER
19#include "debug/debugcpu.h"
20#endif
2115
2216
2317
r1877r1878
7165typedef struct _cpuexec_data cpuexec_data;
7266struct _cpuexec_data
7367{
74   UINT8      saveable;            /* true if saveable */
75
7668   UINT8      suspend;            /* suspend reason mask (0 = not suspended) */
7769   UINT8      nextsuspend;         /* pending suspend reason mask */
7870   UINT8      eatcycles;            /* true if we eat cycles while suspended */
7971   UINT8      nexteatcycles;         /* pending value */
8072   INT32      trigger;            /* pending trigger to release a trigger suspension */
8173
82   INT32       iloops;             /* number of interrupts remaining this frame */
83
8474   UINT64       totalcycles;         /* total CPU cycles executed */
8575   attotime    localtime;            /* local time, relative to the timer system's global time */
8676   INT32      clock;               /* current active clock */
8777   double      clockscale;            /* current active clock scale factor */
8878
89   INT32      vblankint_countdown;   /* number of vblank callbacks left until we interrupt */
90   INT32       vblankint_multiplier;   /* number of vblank callbacks per interrupt */
91   emu_timer *   vblankint_timer;      /* reference to elapsed time counter */
79   emu_timer *   timedint_timer;         /* reference to this CPU's periodic interrupt timer */
9280
93   emu_timer *   timedint_timer;         /* reference to this CPU's timer */
94   attotime    timedint_period;       /* timing period of the timed interrupt */
81   /* these below are hacks to support multiple interrupts per frame */
82   INT32       iloops;             /* number of interrupts remaining this frame */
83   emu_timer *   partial_frame_timer;   /* the timer that triggers partial frame interrupts */
84   attotime   partial_frame_period;   /* the length of one partial frame for interrupt purposes */
9585};
9686
9787
r1877r1878
10393/* general CPU variables */
10494static cpuexec_data cpu[MAX_CPU];
10595
106static UINT8 vblank;
107static UINT32 current_frame;
108
10996static int cycles_running;
11097static int cycles_stolen;
11198
11299
113100/* timer variables */
114static emu_timer *vblank_timer;
115static INT32 vblank_countdown;
116static INT32 vblank_multiplier;
117static attotime vblank_period;
118
119static emu_timer *update_timer;
120
121emu_timer *refresh_timer;   /* temporarily made non-static (for ccpu) */
122static attotime refresh_period;
123
124101static emu_timer *timeslice_timer;
125102static attotime timeslice_period;
126103
r1877r1878
128105static emu_timer *interleave_boost_timer_end;
129106static attotime perfect_interleave;
130107
131/* watchdog state */
132static UINT8 watchdog_enabled;
133static INT32 watchdog_counter;
134static emu_timer *watchdog_timer;
135108
136109
137
138110/***************************************************************************
139111    FUNCTION PROTOTYPES
140112***************************************************************************/
r1877r1878
142114static void cpuexec_exit(running_machine *machine);
143115static void cpuexec_reset(running_machine *machine);
144116static void cpu_inittimers(running_machine *machine);
145static void cpu_vblankreset(running_machine *machine);
146static TIMER_CALLBACK( cpu_vblankcallback );
147static TIMER_CALLBACK( cpu_updatecallback );
148117static TIMER_CALLBACK( end_interleave_boost );
118static TIMER_CALLBACK( trigger_partial_frame_interrupt );
149119static void compute_perfect_interleave(running_machine *machine);
150120
151void cpu_compute_vblank_timing(running_machine *machine);
152121
153122
154
155123/***************************************************************************
156124    CORE CPU EXECUTION
157125***************************************************************************/
r1877r1878
163131
164132void cpuexec_init(running_machine *machine)
165133{
166   int numscreens = video_screen_count(machine->config);
167134   int cpunum;
168135
169   /* if there has been no VBLANK time specified in the MACHINE_DRIVER, compute it now
170       from the visible area */
171   if (numscreens > 0 && machine->screen[0].vblank == 0 && !machine->screen[0].oldstyle_vblank_supplied)
172      machine->screen[0].vblank = (machine->screen[0].refresh / machine->screen[0].height) * (machine->screen[0].height - (machine->screen[0].visarea.max_y + 1 - machine->screen[0].visarea.min_y));
173
174   /* allocate vblank and refresh timers, and compute the initial timing */
175   vblank_timer = timer_alloc(cpu_vblankcallback, NULL);
176   refresh_timer = timer_alloc(NULL, NULL);
177   cpu_compute_vblank_timing(machine);
178
179136   /* loop over all our CPUs */
180137   for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
181138   {
r1877r1878
212169      state_save_register_item("cpu", cpunum, cpu[cpunum].clock);
213170      state_save_register_item("cpu", cpunum, cpu[cpunum].clockscale);
214171
215      state_save_register_item("cpu", cpunum, cpu[cpunum].vblankint_countdown);
216
217172      /* initialize this CPU */
218173      state_save_push_tag(cpunum + 1);
219174      num_regs = state_save_get_reg_count();
r1877r1878
235190
236191   /* compute the perfect interleave factor */
237192   compute_perfect_interleave(machine);
238
239   /* save some stuff in the default tag */
240   state_save_push_tag(0);
241   state_save_register_item("cpu", 0, vblank);
242   state_save_register_item("cpu", 0, current_frame);
243   state_save_register_item("cpu", 0, watchdog_enabled);
244   state_save_register_item("cpu", 0, watchdog_counter);
245   state_save_register_item("cpu", 0, vblank_countdown);
246   state_save_pop_tag();
247193}
248194
249195
r1877r1878
259205   /* initialize the various timers (suspends all CPUs at startup) */
260206   cpu_inittimers(machine);
261207
262   /* set up the watchdog timer; only start off enabled if explicitly configured */
263   watchdog_enabled = (machine->config->watchdog_vblank_count != 0 || attotime_compare(machine->config->watchdog_time, attotime_zero) != 0);
264   watchdog_reset(machine);
265   watchdog_enabled = TRUE;
266
267208   /* first pass over CPUs */
268209   for (cpunum = 0; cpunum < cpu_gettotalcpu(); cpunum++)
269210   {
r1877r1878
279220      /* then reset the CPU directly */
280221      cpunum_reset(cpunum);
281222   }
282
283   /* reset the globals */
284   cpu_vblankreset(machine);
285   vblank = 0;
286   current_frame = 0;
287223}
288224
289225
r1877r1878
802738
803739
804740/***************************************************************************
805    WATCHDOG TIMERS
806***************************************************************************/
807
808/*-------------------------------------------------
809    watchdog_callback - watchdog timer callback
810-------------------------------------------------*/
811
812static TIMER_CALLBACK( watchdog_callback )
813{
814   logerror("reset caused by the watchdog\n");
815   mame_schedule_soft_reset(machine);
816}
817
818
819/*-------------------------------------------------
820    watchdog_reset - reset the watchdog timer
821-------------------------------------------------*/
822
823void watchdog_reset(running_machine *machine)
824{
825   /* if we're not enabled, skip it */
826   if (!watchdog_enabled)
827      timer_adjust_oneshot(watchdog_timer, attotime_never, 0);
828
829   /* VBLANK-based watchdog? */
830   else if (machine->config->watchdog_vblank_count != 0)
831      watchdog_counter = machine->config->watchdog_vblank_count;
832
833   /* timer-based watchdog? */
834   else if (attotime_compare(machine->config->watchdog_time, attotime_zero) != 0)
835      timer_adjust_oneshot(watchdog_timer, machine->config->watchdog_time, 0);
836
837   /* default to an obscene amount of time (3 seconds) */
838   else
839      timer_adjust_oneshot(watchdog_timer, ATTOTIME_IN_SEC(3), 0);
840}
841
842
843/*-------------------------------------------------
844    watchdog_enable - reset the watchdog timer
845-------------------------------------------------*/
846
847void watchdog_enable(running_machine *machine, int enable)
848{
849   /* when re-enabled, we reset our state */
850   if (watchdog_enabled != enable)
851   {
852      watchdog_enabled = enable;
853      watchdog_reset(machine);
854   }
855}
856
857
858
859/***************************************************************************
860741    CHEESY FAKE VIDEO TIMING
861742***************************************************************************/
862743
863744/*-------------------------------------------------
864    cpu_compute_vblank_timing - recompute cheesy
865    VBLANK timing after a video change
866-------------------------------------------------*/
867
868void cpu_compute_vblank_timing(running_machine *machine)
869{
870   int numscreens = video_screen_count(machine->config);
871   attoseconds_t refresh_attosecs;
872
873   refresh_attosecs = (numscreens == 0) ? HZ_TO_ATTOSECONDS(60) : machine->screen[0].refresh;
874   refresh_period = attotime_make(0, refresh_attosecs);
875
876   /* recompute the vblank period */
877   vblank_period = attotime_make(0, refresh_attosecs / (vblank_multiplier ? vblank_multiplier : 1));
878   if (vblank_timer != NULL && timer_enable(vblank_timer, FALSE))
879   {
880      attotime remaining = timer_timeleft(vblank_timer);
881      if (remaining.seconds == 0 && remaining.attoseconds == 0)
882         remaining = vblank_period;
883      timer_adjust_periodic(vblank_timer, remaining, 0, vblank_period);
884   }
885
886   LOG(("cpu_compute_vblank_timing: refresh=%s vblank=%s\n", attotime_string(refresh_period, 9), attotime_string(vblank_period, 9)));
887}
888
889
890/*-------------------------------------------------
891745    cpu_scalebyfcount - scale by time between
892746    refresh timers
893747-------------------------------------------------*/
894748
895749int cpu_scalebyfcount(int value)
896750{
897   attotime refresh_elapsed = timer_timeelapsed(refresh_timer);
898   int result;
751//  attotime refresh_elapsed = timer_timeelapsed(refresh_timer);
752//  int result;
899753
900754   /* shift off some bits to ensure no overflow */
901   if (value < 65536)
902      result = value * (refresh_elapsed.attoseconds >> 16) / (refresh_period.attoseconds >> 16);
903   else
904      result = value * (refresh_elapsed.attoseconds >> 32) / (refresh_period.attoseconds >> 32);
905   if (value >= 0)
906      return (result < value) ? result : value;
907   else
908      return (result > value) ? result : value;
755//  if (value < 65536)
756//      result = value * (refresh_elapsed.attoseconds >> 16) / (refresh_period.attoseconds >> 16);
757//  else
758//      result = value * (refresh_elapsed.attoseconds >> 32) / (refresh_period.attoseconds >> 32);
759//  if (value >= 0)
760//      return (result < value) ? result : value;
761//  else
762//      return (result > value) ? result : value;
763   return 0;
909764}
910765
911766
r1877r1878
921776}
922777
923778
924/*-------------------------------------------------
925    cpu_getvblank - return the cheesy VBLANK
926    state (deprecated)
927-------------------------------------------------*/
928
929int cpu_getvblank(void)
930{
931   return vblank;
932}
933
934
935/*-------------------------------------------------
936    cpu_getcurrentframe - return the current
937    frame count (deprecated)
938-------------------------------------------------*/
939
940int cpu_getcurrentframe(void)
941{
942   return current_frame;
943}
944
945
946
947779/***************************************************************************
948780    INTERNAL TIMING
949781***************************************************************************/
950782
951783/*-------------------------------------------------
952    cpu_vblankreset - hook for updating things on
953    cheesy fake VBLANK (once per frame)
784    on_vblank - calls any external callbacks
785    for this screen
954786-------------------------------------------------*/
955787
956static void cpu_vblankreset(running_machine *machine)
788static void on_vblank(running_machine *machine, screen_state *screen, int vblank_state)
957789{
958   int cpunum;
959
960   /* notify the video system of a VBLANK start */
961   video_vblank_start(machine);
962
963   /* read keyboard & update the status of the input ports */
964   input_port_vblank_start();
965
966   /* check the watchdog */
967   if (machine->config->watchdog_vblank_count != 0 && --watchdog_counter == 0)
968      watchdog_callback(machine, NULL, 0);
969
970   /* reset the cycle counters */
971   for (cpunum = 0; cpunum < cpu_gettotalcpu(); cpunum++)
790   /* VBLANK starting */
791   if (vblank_state)
972792   {
973      if (!(cpu[cpunum].suspend & SUSPEND_REASON_DISABLE))
974         cpu[cpunum].iloops = machine->config->cpu[cpunum].vblank_interrupts_per_frame - 1;
975      else
976         cpu[cpunum].iloops = -1;
977   }
978}
793      int cpunum;
794      const char *screen_tag = NULL;
795      const device_config *device;
979796
797      /* get the screen's tag */
798      for (device = video_screen_first(machine->config); device != NULL; device = video_screen_next(device))
799         if (device->token == screen)
800            screen_tag = device->tag;
980801
981/*-------------------------------------------------
982    cpu_firstvblankcallback - timer callback for
983    the first fake VBLANK
984-------------------------------------------------*/
802      assert(screen_tag != NULL);
985803
986static TIMER_CALLBACK( cpu_firstvblankcallback )
987{
988   /* now that we're synced up, pulse from here on out */
989   timer_adjust_periodic(vblank_timer, vblank_period, param, vblank_period);
804      /* find any CPUs that have this screen as their VBLANK interrupt source */
805      for (cpunum = 0; cpunum < cpu_gettotalcpu(); cpunum++)
806      {
807         int cpu_interested;
808         const cpu_config *config = machine->config->cpu + cpunum;
990809
991   /* but we need to call the standard routine as well */
992   cpu_vblankcallback(machine, NULL, param);
993}
810         /* start the interrupt counter */
811         if (!(cpu[cpunum].suspend & SUSPEND_REASON_DISABLE))
812            cpu[cpunum].iloops = config->vblank_interrupts_per_frame - 1;
813         else
814            cpu[cpunum].iloops = -1;
994815
816         /* the hack style VBLANK decleration uses the first screen always */
817         if (config->vblank_interrupts_per_frame > 1)
818            cpu_interested = TRUE;
995819
996/*-------------------------------------------------
997    cpu_vblankcallback - timer callback for
998    subsequent fake VBLANKs
999-------------------------------------------------*/
820         /* for new style decleration, we need to compare the tags */
821         else if (config->vblank_interrupts_per_frame == 1)
822            cpu_interested = (strcmp(config->vblank_interrupt_screen, screen_tag) == 0);
1000823
1001static TIMER_CALLBACK( cpu_vblankcallback )
1002{
1003   int cpunum;
824         /* no VBLANK interrupt, not interested */
825         else
826            cpu_interested = FALSE;
1004827
1005   if (vblank_countdown == 1)
1006      vblank = 1;
1007
1008   /* loop over CPUs */
1009   for (cpunum = 0; cpunum < cpu_gettotalcpu(); cpunum++)
1010   {
1011      /* if the interrupt multiplier is valid */
1012      if (cpu[cpunum].vblankint_multiplier != -1)
1013      {
1014         /* decrement; if we hit zero, generate the interrupt and reset the countdown */
1015         if (!--cpu[cpunum].vblankint_countdown)
828         /* if interested, call the interrupt handler */
829         if (cpu_interested)
1016830         {
1017            /* a param of -1 means don't call any callbacks */
1018            if (param != -1)
831            if (!cpunum_is_suspended(cpunum, SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE))
1019832            {
1020               /* if the CPU has a VBLANK handler, call it */
1021               if (machine->config->cpu[cpunum].vblank_interrupt && !cpunum_is_suspended(cpunum, SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE))
1022               {
1023                  cpuintrf_push_context(cpunum);
1024                  (*machine->config->cpu[cpunum].vblank_interrupt)(machine, cpunum);
1025                  cpuintrf_pop_context();
1026               }
1027
1028               /* update the counters */
1029               cpu[cpunum].iloops--;
833               cpuintrf_push_context(cpunum);
834               (*machine->config->cpu[cpunum].vblank_interrupt)(machine, cpunum);
835               cpuintrf_pop_context();
1030836            }
1031837
1032            /* reset the countdown and timer */
1033            cpu[cpunum].vblankint_countdown = cpu[cpunum].vblankint_multiplier;
1034            timer_adjust_oneshot(cpu[cpunum].vblankint_timer, attotime_never, 0);
838            /* if we have more than one interrupt per frame, start the timer now to trigger the rest of them */
839            if ((config->vblank_interrupts_per_frame > 1) &&
840               !(cpu[cpunum].suspend & SUSPEND_REASON_DISABLE))
841            {
842               cpu[cpunum].partial_frame_period = attotime_div(video_screen_get_frame_period(0), config->vblank_interrupts_per_frame);
843               timer_adjust_oneshot(cpu[cpunum].partial_frame_timer, cpu[cpunum].partial_frame_period, cpunum);
844            }
1035845         }
1036846      }
1037
1038      /* else reset the VBLANK timer if this is going to be a real VBLANK */
1039      else if (vblank_countdown == 1)
1040         timer_adjust_oneshot(cpu[cpunum].vblankint_timer, attotime_never, 0);
1041847   }
1042
1043   /* is it a real VBLANK? */
1044   if (!--vblank_countdown)
1045   {
1046      /* do we update the screen now? */
1047      if (!(machine->config->video_attributes & VIDEO_UPDATE_AFTER_VBLANK))
1048         video_frame_update(machine, FALSE);
1049
1050      /* Set the timer to update the screen */
1051      timer_adjust_oneshot(update_timer, attotime_make(0, machine->screen[0].vblank), 0);
1052
1053      /* reset the globals */
1054      cpu_vblankreset(machine);
1055
1056      /* reset the counter */
1057      vblank_countdown = vblank_multiplier;
1058
1059#ifdef ENABLE_DEBUGGER
1060      /* notify the debugger */
1061      debug_vblank_hook();
1062#endif
1063   }
1064848}
1065849
1066850
1067851/*-------------------------------------------------
1068    cpu_updatecallback - timer callback for
1069    the fake end of VBLANK
852    trigger_partial_frame_interrupt - called to
853    trigger a partial frame interrupt
1070854-------------------------------------------------*/
1071855
1072static TIMER_CALLBACK( cpu_updatecallback )
856static TIMER_CALLBACK( trigger_partial_frame_interrupt )
1073857{
1074   /* update the screen if we didn't before */
1075   if (machine->config->video_attributes & VIDEO_UPDATE_AFTER_VBLANK)
1076      video_frame_update(machine, FALSE);
1077   vblank = 0;
858   int cpunum = param;
1078859
1079   /* update IPT_VBLANK input ports */
1080   input_port_vblank_end();
860   cpu[cpunum].iloops--;
1081861
1082   /* track total frames */
1083   current_frame++;
862   /* call the interrupt handler */
863   if (!cpunum_is_suspended(cpunum, SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE))
864   {
865      cpuintrf_push_context(cpunum);
866      (*machine->config->cpu[cpunum].vblank_interrupt)(machine, cpunum);
867      cpuintrf_pop_context();
868   }
1084869
1085   /* reset the refresh timer */
1086   timer_adjust_oneshot(refresh_timer, attotime_never, 0);
870   /* more? */
871   if (cpu[cpunum].iloops > 0)
872      timer_adjust_oneshot(cpu[cpunum].partial_frame_timer, cpu[cpunum].partial_frame_period, cpunum);
1087873}
1088874
1089875
r1877r1878
1168954{
1169955   int numscreens = video_screen_count(machine->config);
1170956   attoseconds_t refresh_attosecs;
1171   attotime first_time;
1172   int cpunum, max, ipf;
957   int cpunum, ipf;
1173958
1174   /* allocate a timer for the watchdog */
1175   watchdog_timer = timer_alloc(watchdog_callback, NULL);
1176
1177959   /* allocate a dummy timer at the minimum frequency to break things up */
1178960   ipf = machine->config->cpu_slices_per_frame;
1179961   if (ipf <= 0)
r1877r1878
1187969   interleave_boost_timer = timer_alloc(NULL, NULL);
1188970   interleave_boost_timer_end = timer_alloc(end_interleave_boost, NULL);
1189971
1190   /*
1191     *  The following code finds all the CPUs that are interrupting in sync with the VBLANK
1192     *  and sets up the VBLANK timer to run at the minimum number of cycles per frame in
1193     *  order to service all the synced interrupts
1194     */
1195
1196   /* find the CPU with the maximum interrupts per frame */
1197   max = 1;
972   /* register the interrupt handler callbacks */
1198973   for (cpunum = 0; cpunum < cpu_gettotalcpu(); cpunum++)
1199974   {
1200      ipf = machine->config->cpu[cpunum].vblank_interrupts_per_frame;
1201      if (ipf > max)
1202         max = ipf;
1203   }
975      const cpu_config *config = machine->config->cpu + cpunum;
1204976
1205   /* now find the LCD with the rest of the CPUs (brute force - these numbers aren't huge) */
1206   vblank_multiplier = max;
1207   while (1)
1208   {
1209      for (cpunum = 0; cpunum < cpu_gettotalcpu(); cpunum++)
977      /* VBLANK interrupts */
978      if (config->vblank_interrupts_per_frame > 0)
1210979      {
1211         ipf = machine->config->cpu[cpunum].vblank_interrupts_per_frame;
1212         if (ipf > 0 && (vblank_multiplier % ipf) != 0)
1213            break;
1214      }
1215      if (cpunum == cpu_gettotalcpu())
1216         break;
1217      vblank_multiplier += max;
1218   }
980         const char *screen_tag;
981         screen_state *screen;
1219982
1220   /* initialize the countdown timers and intervals */
1221   for (cpunum = 0; cpunum < cpu_gettotalcpu(); cpunum++)
1222   {
1223      ipf = machine->config->cpu[cpunum].vblank_interrupts_per_frame;
1224      if (ipf > 0)
1225         cpu[cpunum].vblankint_countdown = cpu[cpunum].vblankint_multiplier = vblank_multiplier / ipf;
1226      else
1227         cpu[cpunum].vblankint_countdown = cpu[cpunum].vblankint_multiplier = -1;
1228   }
983         /* get the screen that will trigger the VBLANK */
1229984
1230   /* allocate a vblank timer at the frame rate * the LCD number of interrupts per frame */
1231   vblank_period = attotime_make(0, refresh_attosecs / vblank_multiplier);
1232   vblank_countdown = vblank_multiplier;
985         /* new style - use screen tag directly */
986         if (config->vblank_interrupts_per_frame == 1)
987            screen_tag = config->vblank_interrupt_screen;
1233988
1234   /* allocate an update timer that will be used to time the actual screen updates */
1235   update_timer = timer_alloc(cpu_updatecallback, NULL);
989         /* old style 'hack' setup - use screen #0 */
990         else
991         {
992            const device_config *config = device_list_first(machine->config->devicelist, VIDEO_SCREEN);
993            screen_tag = config->tag;
1236994
1237   /*
1238     *      The following code creates individual timers for each CPU whose interrupts are not
1239     *      synced to the VBLANK, and computes the typical number of cycles per interrupt
1240     */
995            /* allocate timer that will trigger the partial frame updates */
996            cpu[cpunum].partial_frame_timer = timer_alloc(trigger_partial_frame_interrupt, 0);
997         }
1241998
1242   /* start the CPU interrupt timers */
1243   for (cpunum = 0; cpunum < cpu_gettotalcpu(); cpunum++)
1244   {
1245      ipf = machine->config->cpu[cpunum].vblank_interrupts_per_frame;
999         screen = devtag_get_token(machine, VIDEO_SCREEN, screen_tag);
1000         video_screen_register_vbl_cb(machine, screen, on_vblank);
1001      }
12461002
1247      /* compute the average number of cycles per interrupt */
1248      if (ipf <= 0)
1249         ipf = 1;
1250      cpu[cpunum].vblankint_timer = timer_alloc(NULL, NULL);
1251
1252      /* see if we need to allocate a CPU timer */
1253      if (machine->config->cpu[cpunum].timed_interrupt_period != 0)
1003      /* periodic interrupts */
1004      if (config->timed_interrupt_period != 0)
12541005      {
1255         cpu[cpunum].timedint_period = attotime_make(0, machine->config->cpu[cpunum].timed_interrupt_period);
1006         attotime timedint_period = attotime_make(0, config->timed_interrupt_period);
12561007         cpu[cpunum].timedint_timer = timer_alloc(cpu_timedintcallback, NULL);
1257         timer_adjust_periodic(cpu[cpunum].timedint_timer, cpu[cpunum].timedint_period, cpunum, cpu[cpunum].timedint_period);
1008         timer_adjust_periodic(cpu[cpunum].timedint_timer, timedint_period, cpunum, timedint_period);
12581009      }
12591010   }
1260
1261   /* note that since we start the first frame on the refresh, we can't pulse starting
1262       immediately; instead, we back up one VBLANK period, and inch forward until we hit
1263       positive time. That time will be the time of the first VBLANK timer callback */
1264   first_time = attotime_sub_attoseconds(vblank_period, machine->screen[0].vblank);
1265   while (attotime_compare(first_time, attotime_zero) < 0)
1266   {
1267      cpu_vblankcallback(machine, NULL, -1);
1268      first_time = attotime_add(first_time, vblank_period);
1269   }
1270   timer_set(first_time, NULL, 0, cpu_firstvblankcallback);
1271
1272   /* reset the refresh timer to get ourself back in sync */
1273   timer_adjust_oneshot(refresh_timer, attotime_never, 0);
12741011}
src/emu/mamecore.h
r1877r1878
7777/* stream_sample_t is used to represent a single sample in a sound stream */
7878typedef INT32 stream_sample_t;
7979
80/* mame_bitmap is just a bitmap_t */
81typedef bitmap_t mame_bitmap;
8280
8381
84
8582/***************************************************************************
8683 * Union of UINT8, UINT16 and UINT32 in native endianess of the target
8784 * This is used to access bytes and words in a machine independent manner.
r1877r1878
183180#define DEGREE_TO_RADIAN(x)   ((M_PI / 180.0) * (x))
184181
185182
186/* U64 and S64 are used to wrap long integer constants. */
187#ifdef __GNUC__
188#define U64(val) val##ULL
189#define S64(val) val##LL
190#else
191#define U64(val) val
192#define S64(val) val
193#endif
194183
195
196184/* Useful macros to deal with bit shuffling encryptions */
197185#define BIT(x,n) (((x)>>(n))&1)
198186
src/emu/rendlay.c
r1877r1878
131131   render_bounds      bounds;            /* bounds of the element */
132132   render_color      color;            /* color of the element */
133133   const char *      string;            /* string for text components */
134   mame_bitmap *      bitmap;            /* source bitmap for images */
134   bitmap_t *         bitmap;            /* source bitmap for images */
135135   const char *      dirname;         /* directory name of image file (for lazy loading) */
136136   const char *      imagefile;         /* name of the image file (for lazy loading) */
137137   const char *      alphafile;         /* name of the alpha file (for lazy loading) */
r1877r1878
145145***************************************************************************/
146146
147147/* layout elements */
148static void layout_element_scale(mame_bitmap *dest, const mame_bitmap *source, const rectangle *sbounds, void *param);
149static void layout_element_draw_rect(mame_bitmap *dest, const rectangle *bounds, const render_color *color);
150static void layout_element_draw_disk(mame_bitmap *dest, const rectangle *bounds, const render_color *color);
151static void layout_element_draw_text(mame_bitmap *dest, const rectangle *bounds, const render_color *color, const char *string);
152static void layout_element_draw_led7seg(mame_bitmap *dest, const rectangle *bounds, const render_color *color, int state);
153static void layout_element_draw_led14seg(mame_bitmap *dest, const rectangle *bounds, const render_color *color, int state);
154static void layout_element_draw_led16seg(mame_bitmap *dest, const rectangle *bounds, const render_color *color, int state);
155static void layout_element_draw_led14segsc(mame_bitmap *dest, const rectangle *bounds, const render_color *color, int state);
156static void layout_element_draw_led16segsc(mame_bitmap *dest, const rectangle *bounds, const render_color *color, int state);
148static void layout_element_scale(bitmap_t *dest, const bitmap_t *source, const rectangle *sbounds, void *param);
149static void layout_element_draw_rect(bitmap_t *dest, const rectangle *bounds, const render_color *color);
150static void layout_element_draw_disk(bitmap_t *dest, const rectangle *bounds, const render_color *color);
151static void layout_element_draw_text(bitmap_t *dest, const rectangle *bounds, const render_color *color, const char *string);
152static void layout_element_draw_led7seg(bitmap_t *dest, const rectangle *bounds, const render_color *color, int state);
153static void layout_element_draw_led14seg(bitmap_t *dest, const rectangle *bounds, const render_color *color, int state);
154static void layout_element_draw_led16seg(bitmap_t *dest, const rectangle *bounds, const render_color *color, int state);
155static void layout_element_draw_led14segsc(bitmap_t *dest, const rectangle *bounds, const render_color *color, int state);
156static void layout_element_draw_led16segsc(bitmap_t *dest, const rectangle *bounds, const render_color *color, int state);
157157
158158/* layout file parsing */
159159static layout_element *load_layout_element(xml_data_node *elemnode, const char *dirname);
160160static element_component *load_element_component(xml_data_node *compnode, const char *dirname);
161161static layout_view *load_layout_view(xml_data_node *viewnode, layout_element *elemlist);
162162static view_item *load_view_item(xml_data_node *itemnode, layout_element *elemlist);
163static mame_bitmap *load_component_bitmap(const char *dirname, const char *file, const char *alphafile, int *hasalpha);
163static bitmap_t *load_component_bitmap(const char *dirname, const char *file, const char *alphafile, int *hasalpha);
164164static int load_bounds(xml_data_node *boundsnode, render_bounds *bounds);
165165static int load_color(xml_data_node *colornode, render_color *color);
166166static int load_orientation(xml_data_node *orientnode, int *orientation);
r1877r1878
228228    any non-screen elements
229229-------------------------------------------------*/
230230
231#ifdef UNUSED_FUNCTION
231232INLINE int view_has_art(layout_view *view)
232233{
233234   return (view->itemlist[ITEM_LAYER_BACKDROP] != 0 ||
234235         view->itemlist[ITEM_LAYER_OVERLAY] != 0 ||
235236         view->itemlist[ITEM_LAYER_BEZEL] != 0);
236237}
238#endif
237239
238240
239
240241/***************************************************************************
241242    LAYOUT VIEWS
242243***************************************************************************/
r1877r1878
360361    appropriate resolution
361362-------------------------------------------------*/
362363
363static void layout_element_scale(mame_bitmap *dest, const mame_bitmap *source, const rectangle *sbounds, void *param)
364static void layout_element_scale(bitmap_t *dest, const bitmap_t *source, const rectangle *sbounds, void *param)
364365{
365366   element_texture *elemtex = param;
366367   element_component *component;
r1877r1878
432433    in the specified color
433434-------------------------------------------------*/
434435
435static void layout_element_draw_rect(mame_bitmap *dest, const rectangle *bounds, const render_color *color)
436static void layout_element_draw_rect(bitmap_t *dest, const rectangle *bounds, const render_color *color)
436437{
437438   UINT32 r, g, b, inva;
438439   UINT32 x, y;
r1877r1878
471472    in the specified color
472473-------------------------------------------------*/
473474
474static void layout_element_draw_disk(mame_bitmap *dest, const rectangle *bounds, const render_color *color)
475static void layout_element_draw_disk(bitmap_t *dest, const rectangle *bounds, const render_color *color)
475476{
476477   float xcenter, ycenter;
477478   float xradius, yradius, ooyradius2;
r1877r1878
530531    specified color
531532-------------------------------------------------*/
532533
533static void layout_element_draw_text(mame_bitmap *dest, const rectangle *bounds, const render_color *color, const char *string)
534static void layout_element_draw_text(bitmap_t *dest, const rectangle *bounds, const render_color *color, const char *string)
534535{
535536   render_font *font = render_font_alloc(NULL);
536   mame_bitmap *tempbitmap;
537   bitmap_t *tempbitmap;
537538   UINT32 r, g, b, a;
538539   float aspect = 1.0f;
539540   INT32 curx, width;
r1877r1878
613614    and start points
614615-------------------------------------------------*/
615616
616static void draw_segment_horizontal_caps(mame_bitmap *dest, int minx, int maxx, int midy, int width, int caps, rgb_t color)
617static void draw_segment_horizontal_caps(bitmap_t *dest, int minx, int maxx, int midy, int width, int caps, rgb_t color)
617618{
618619   int x, y;
619620
r1877r1878
636637    LED segment
637638-------------------------------------------------*/
638639
639static void draw_segment_horizontal(mame_bitmap *dest, int minx, int maxx, int midy, int width, rgb_t color)
640static void draw_segment_horizontal(bitmap_t *dest, int minx, int maxx, int midy, int width, rgb_t color)
640641{
641642   draw_segment_horizontal_caps(dest, minx, maxx, midy, width, LINE_CAP_START | LINE_CAP_END, color);
642643}
r1877r1878
648649    and start points
649650-------------------------------------------------*/
650651
651static void draw_segment_vertical_caps(mame_bitmap *dest, int miny, int maxy, int midx, int width, int caps, rgb_t color)
652static void draw_segment_vertical_caps(bitmap_t *dest, int miny, int maxy, int midx, int width, int caps, rgb_t color)
652653{
653654   int x, y;
654655
r1877r1878
671672    LED segment
672673-------------------------------------------------*/
673674
674static void draw_segment_vertical(mame_bitmap *dest, int miny, int maxy, int midx, int width, rgb_t color)
675static void draw_segment_vertical(bitmap_t *dest, int miny, int maxy, int midx, int width, rgb_t color)
675676{
676677   draw_segment_vertical_caps(dest, miny, maxy, midx, width, LINE_CAP_START | LINE_CAP_END, color);
677678}
r1877r1878
682683    LED segment that looks like this: /
683684-------------------------------------------------*/
684685
685static void draw_segment_diagonal_1(mame_bitmap *dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color)
686static void draw_segment_diagonal_1(bitmap_t *dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color)
686687{
687688   int x, y;
688689   float ratio;
r1877r1878
712713    LED segment that looks like this: \
713714-------------------------------------------------*/
714715
715static void draw_segment_diagonal_2(mame_bitmap *dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color)
716static void draw_segment_diagonal_2(bitmap_t *dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color)
716717{
717718   int x, y;
718719   float ratio;
r1877r1878
741742    draw_segment_decimal - draw a decimal point
742743-------------------------------------------------*/
743744
744static void draw_segment_decimal(mame_bitmap *dest, int midx, int midy, int width, rgb_t color)
745static void draw_segment_decimal(bitmap_t *dest, int midx, int midy, int width, rgb_t color)
745746{
746747   float ooradius2;
747748   UINT32 x, y;
r1877r1878
772773    draw_segment_comma - draw a comma tail
773774-------------------------------------------------*/
774775#if 0
775static void draw_segment_comma(mame_bitmap *dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color)
776static void draw_segment_comma(bitmap_t *dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color)
776777{
777778   int x, y;
778779   float ratio;
r1877r1878
797798
798799
799800/*-------------------------------------------------
800    apply_skew - apply skew to a mame_bitmap
801    apply_skew - apply skew to a bitmap_t
801802-------------------------------------------------*/
802803
803static void apply_skew(mame_bitmap *dest, int skewwidth)
804static void apply_skew(bitmap_t *dest, int skewwidth)
804805{
805806   int x, y;
806807
r1877r1878
821822    7-segment LCD
822823-------------------------------------------------*/
823824
824static void layout_element_draw_led7seg(mame_bitmap *dest, const rectangle *bounds, const render_color *color, int pattern)
825static void layout_element_draw_led7seg(bitmap_t *dest, const rectangle *bounds, const render_color *color, int pattern)
825826{
826827   const rgb_t onpen = MAKE_ARGB(0xff,0xff,0xff,0xff);
827828   const rgb_t offpen = MAKE_ARGB(0xff,0x20,0x20,0x20);
828829   int bmwidth, bmheight, segwidth, skewwidth;
829   mame_bitmap *tempbitmap;
830   bitmap_t *tempbitmap;
830831
831832   /* sizes for computation */
832833   bmwidth = 250;
r1877r1878
877878    14-segment LCD
878879-------------------------------------------------*/
879880
880static void layout_element_draw_led14seg(mame_bitmap *dest, const rectangle *bounds, const render_color *color, int pattern)
881static void layout_element_draw_led14seg(bitmap_t *dest, const rectangle *bounds, const render_color *color, int pattern)
881882{
882883   const rgb_t onpen = MAKE_ARGB(0xff, 0xff, 0xff, 0xff);
883884   const rgb_t offpen = MAKE_ARGB(0xff, 0x20, 0x20, 0x20);
884885   int bmwidth, bmheight, segwidth, skewwidth;
885   mame_bitmap *tempbitmap;
886   bitmap_t *tempbitmap;
886887
887888   /* sizes for computation */
888889   bmwidth = 250;
r1877r1878
983984    14-segment LCD with semicolon (2 extra segments)
984985-------------------------------------------------*/
985986
986static void layout_element_draw_led14segsc(mame_bitmap *dest, const rectangle *bounds, const render_color *color, int pattern)
987static void layout_element_draw_led14segsc(bitmap_t *dest, const rectangle *bounds, const render_color *color, int pattern)
987988{
988989   const rgb_t onpen = MAKE_ARGB(0xff, 0xff, 0xff, 0xff);
989990   const rgb_t offpen = MAKE_ARGB(0xff, 0x20, 0x20, 0x20);
990991   int bmwidth, bmheight, segwidth, skewwidth;
991   mame_bitmap *tempbitmap;
992   bitmap_t *tempbitmap;
992993
993994   /* sizes for computation */
994995   bmwidth = 250;
r1877r1878
10981099    16-segment LCD
10991100-------------------------------------------------*/
11001101
1101static void layout_element_draw_led16seg(mame_bitmap *dest, const rectangle *bounds, const render_color *color, int pattern)
1102static void layout_element_draw_led16seg(bitmap_t *dest, const rectangle *bounds, const render_color *color, int pattern)
11021103{
11031104   const rgb_t onpen = MAKE_ARGB(0xff, 0xff, 0xff, 0xff);
11041105   const rgb_t offpen = MAKE_ARGB(0xff, 0x20, 0x20, 0x20);
11051106   int bmwidth, bmheight, segwidth, skewwidth;
1106   mame_bitmap *tempbitmap;
1107   bitmap_t *tempbitmap;
11071108
11081109   /* sizes for computation */
11091110   bmwidth = 250;
r1877r1878
12141215    16-segment LCD with semicolon (2 extra segments)
12151216-------------------------------------------------*/
12161217
1217static void layout_element_draw_led16segsc(mame_bitmap *dest, const rectangle *bounds, const render_color *color, int pattern)
1218static void layout_element_draw_led16segsc(bitmap_t *dest, const rectangle *bounds, const render_color *color, int pattern)
12181219{
12191220   const rgb_t onpen = MAKE_ARGB(0xff, 0xff, 0xff, 0xff);
12201221   const rgb_t offpen = MAKE_ARGB(0xff, 0x20, 0x20, 0x20);
12211222   int bmwidth, bmheight, segwidth, skewwidth;
1222   mame_bitmap *tempbitmap;
1223   bitmap_t *tempbitmap;
12231224
12241225   /* sizes for computation */
12251226   bmwidth = 250;
r1877r1878
18781879    with artwork for a component
18791880-------------------------------------------------*/
18801881
1881static mame_bitmap *load_component_bitmap(const char *dirname, const char *file, const char *alphafile, int *hasalpha)
1882static bitmap_t *load_component_bitmap(const char *dirname, const char *file, const char *alphafile, int *hasalpha)
18821883{
1883   mame_bitmap *bitmap;
1884   bitmap_t *bitmap;
18841885
18851886   /* load the basic bitmap */
18861887   bitmap = render_load_png(dirname, file, NULL, hasalpha);
src/emu/cpuintrf.h
r1877r1878
1616
1717#include "cpuint.h"
1818#include "cpuexec.h"
19#include "watchdog.h"
1920#include "mame.h"
2021#include "state.h"
2122
r1877r1878
197198
198199
199200/* define the various callback functions */
200typedef void (*cpufunc_get_info)(UINT32 state, cpuinfo *info);
201typedef void (*cpufunc_set_info)(UINT32 state, cpuinfo *info);
202typedef void (*cpufunc_get_context)(void *buffer);
203typedef void (*cpufunc_set_context)(void *buffer);
204typedef void (*cpufunc_init)(int index, int clock, const void *config, int (*irqcallback)(int));
205typedef void (*cpufunc_reset)(void);
206typedef void (*cpufunc_exit)(void);
207typedef int   (*cpufunc_execute)(int cycles);
208typedef void (*cpufunc_burn)(int cycles);
209typedef offs_t (*cpufunc_disassemble)(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
210typedef int   (*cpufunc_translate)(int space, offs_t *address);
211typedef int   (*cpufunc_read)(int space, UINT32 offset, int size, UINT64 *value);
212typedef int   (*cpufunc_write)(int space, UINT32 offset, int size, UINT64 value);
213typedef int   (*cpufunc_readop)(UINT32 offset, int size, UINT64 *value);
214typedef void (*cpufunc_setup_commands)(void);
201typedef void (*cpu_get_info_func)(UINT32 state, cpuinfo *info);
202typedef void (*cpu_set_info_func)(UINT32 state, cpuinfo *info);
203typedef void (*cpu_get_context_func)(void *buffer);
204typedef void (*cpu_set_context_func)(void *buffer);
205typedef void (*cpu_init_func)(int index, int clock, const void *config, int (*irqcallback)(int));
206typedef void (*cpu_reset_func)(void);
207typedef void (*cpu_exit_func)(void);
208typedef int   (*cpu_execute_func)(int cycles);
209typedef void (*cpu_burn_func)(int cycles);
210typedef offs_t (*cpu_disassemble_func)(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
211typedef int   (*cpu_translate_func)(int space, offs_t *address);
212typedef int   (*cpu_read_func)(int space, UINT32 offset, int size, UINT64 *value);
213typedef int   (*cpu_write_func)(int space, UINT32 offset, int size, UINT64 value);
214typedef int   (*cpu_readop_func)(UINT32 offset, int size, UINT64 *value);
215typedef void (*cpu_setup_commands_func)(void);
215216
216217
217218/* cpuinfo union used to pass data to/from the get_info/set_info functions */
r1877r1878
222223   genf *              f;                     /* generic function pointers */
223224   char *               s;                     /* generic strings */
224225
225   cpufunc_set_info      setinfo;               /* CPUINFO_PTR_SET_INFO */
226   cpufunc_get_context      getcontext;               /* CPUINFO_PTR_GET_CONTEXT */
227   cpufunc_set_context      setcontext;               /* CPUINFO_PTR_SET_CONTEXT */
228   cpufunc_init         init;                  /* CPUINFO_PTR_INIT */
229   cpufunc_reset         reset;                  /* CPUINFO_PTR_RESET */
230   cpufunc_exit         exit;                  /* CPUINFO_PTR_EXIT */
231   cpufunc_execute         execute;               /* CPUINFO_PTR_EXECUTE */
232   cpufunc_burn         burn;                  /* CPUINFO_PTR_BURN */
233   cpufunc_disassemble      disassemble;            /* CPUINFO_PTR_DISASSEMBLE */
234   cpufunc_translate      translate;               /* CPUINFO_PTR_TRANSLATE */
235   cpufunc_read         read;                  /* CPUINFO_PTR_READ */
236   cpufunc_write         write;                  /* CPUINFO_PTR_WRITE */
237   cpufunc_readop         readop;                  /* CPUINFO_PTR_READOP */
238   cpufunc_setup_commands   setup_commands;            /* CPUINFO_PTR_DEBUG_SETUP_COMMANDS */
226   cpu_set_info_func      setinfo;               /* CPUINFO_PTR_SET_INFO */
227   cpu_get_context_func   getcontext;               /* CPUINFO_PTR_GET_CONTEXT */
228   cpu_set_context_func   setcontext;               /* CPUINFO_PTR_SET_CONTEXT */
229   cpu_init_func         init;                  /* CPUINFO_PTR_INIT */
230   cpu_reset_func         reset;                  /* CPUINFO_PTR_RESET */
231   cpu_exit_func         exit;                  /* CPUINFO_PTR_EXIT */
232   cpu_execute_func      execute;               /* CPUINFO_PTR_EXECUTE */
233   cpu_burn_func         burn;                  /* CPUINFO_PTR_BURN */
234   cpu_disassemble_func   disassemble;            /* CPUINFO_PTR_DISASSEMBLE */
235   cpu_translate_func      translate;               /* CPUINFO_PTR_TRANSLATE */
236   cpu_read_func         read;                  /* CPUINFO_PTR_READ */
237   cpu_write_func         write;                  /* CPUINFO_PTR_WRITE */
238   cpu_readop_func         readop;                  /* CPUINFO_PTR_READOP */
239   cpu_setup_commands_func   setup_commands;            /* CPUINFO_PTR_DEBUG_SETUP_COMMANDS */
239240   int *               icount;                  /* CPUINFO_PTR_INSTRUCTION_COUNTER */
240241   construct_map_t       internal_map;            /* CPUINFO_PTR_INTERNAL_MEMORY_MAP */
241242};
r1877r1878
245246struct _cpu_interface
246247{
247248   /* table of core functions */
248   cpufunc_get_info      get_info;
249   cpufunc_set_info      set_info;
250   cpufunc_get_context      get_context;
251   cpufunc_set_context      set_context;
252   cpufunc_init         init;
253   cpufunc_reset         reset;
254   cpufunc_exit         exit;
255   cpufunc_execute         execute;
256   cpufunc_burn         burn;
257   cpufunc_disassemble      disassemble;
258   cpufunc_translate      translate;
249   cpu_get_info_func      get_info;
250   cpu_set_info_func      set_info;
251   cpu_get_context_func   get_context;
252   cpu_set_context_func   set_context;
253   cpu_init_func         init;
254   cpu_reset_func         reset;
255   cpu_exit_func         exit;
256   cpu_execute_func      execute;
257   cpu_burn_func         burn;
258   cpu_disassemble_func   disassemble;
259   cpu_translate_func      translate;
259260
260261   /* other info */
261262   size_t               context_size;
src/emu/output.c
r1877r1878
3131struct _output_notify
3232{
3333   output_notify *      next;         /* link to next item */
34   output_notifier      notifier;      /* callback to call */
34   output_notifier_func      notifier;      /* callback to call */
3535   void *            param;         /* parameter to pass the callback */
3636};
3737
r1877r1878
321321    if NULL is specified
322322-------------------------------------------------*/
323323
324void output_set_notifier(const char *outname, output_notifier callback, void *param)
324void output_set_notifier(const char *outname, output_notifier_func callback, void *param)
325325{
326326   output_notify **headptr;
327327
r1877r1878
357357    notifier for all outputs
358358-------------------------------------------------*/
359359
360void output_notify_all(output_notifier callback, void *param)
360void output_notify_all(output_notifier_func callback, void *param)
361361{
362362   output_item *item;
363363   int hash;
src/emu/cpuexec.h
r1877r1878
261261   construct_map_t construct_map[ADDRESS_SPACES][2]; /* 2 memory maps per address space */
262262   void          (*vblank_interrupt)(running_machine *machine, int cpunum);   /* for interrupts tied to VBLANK */
263263   int          vblank_interrupts_per_frame;/* usually 1 */
264   const char *   vblank_interrupt_screen;   /* the screen that causes the VBLANK interrupt */
264265   void          (*timed_interrupt)(running_machine *machine, int cpunum);   /* for interrupts not tied to VBLANK */
265266   attoseconds_t    timed_interrupt_period;      /* period for periodic interrupts */
266267   const void *   reset_param;            /* parameter for cpu_reset */
r1877r1878
370371
371372
372373
373/* ----- watchdog timers ----- */
374
375/* reset the watchdog */
376void watchdog_reset(running_machine *machine);
377
378/* enable/disable the watchdog */
379void watchdog_enable(running_machine *machine, int enable);
380
381
382
383374#endif   /* __CPUEXEC_H__ */
src/emu/output.h
r1877r1878
2121    TYPE DEFINITIONS
2222***************************************************************************/
2323
24typedef void (*output_notifier)(const char *outname, INT32 value, void *param);
24typedef void (*output_notifier_func)(const char *outname, INT32 value, void *param);
2525
2626
2727
r1877r1878
4545INT32 output_get_indexed_value(const char *outname, int index);
4646
4747/* set a notifier on a particular output, or globally if NULL */
48void output_set_notifier(const char *outname, output_notifier callback, void *param);
48void output_set_notifier(const char *outname, output_notifier_func callback, void *param);
4949
5050/* set a notifier on a particular output, or globally if NULL */
51void output_notify_all(output_notifier callback, void *param);
51void output_notify_all(output_notifier_func callback, void *param);
5252
5353/* map a name to a unique ID */
5454UINT32 output_name_to_id(const char *outname);
src/emu/sound/sp0256.c
r1877r1878
13001300
13011301   if( offset == 0 )
13021302   {
1303      sp0256_ALD_w( 0, data & 0xff );
1303      sp0256_ALD_w( machine, 0, data & 0xff );
13041304      return;
13051305   }
13061306
src/emu/sound/disc_inp.c
r1877r1878
110110#define DSS_ADJUSTMENT__PMIN   (*(node->input[5]))
111111#define DSS_ADJUSTMENT__PMAX   (*(node->input[6]))
112112
113void dss_adjustment_step(node_description *node)
113static void dss_adjustment_step(node_description *node)
114114{
115115   if (DSS_ADJUSTMENT__ENABLE)
116116   {
r1877r1878
136136   }
137137}
138138
139void dss_adjustment_reset(node_description *node)
139static void dss_adjustment_reset(node_description *node)
140140{
141141   struct dss_adjustment_context *context = node->context;
142142   double min, max;
r1877r1878
184184 ************************************************************************/
185185#define DSS_CONSTANT__INIT   (*(node->input[0]))
186186
187void dss_constant_step(node_description *node)
187static void dss_constant_step(node_description *node)
188188{
189189   node->output= DSS_CONSTANT__INIT;
190190}
r1877r1878
200200 * input[3]    - Current data value
201201 *
202202 ************************************************************************/
203void dss_input_step(node_description *node)
203static void dss_input_step(node_description *node)
204204{
205205   UINT8 *node_data = node->context;
206206
207207   node->output = *node_data * DSS_INPUT__GAIN + DSS_INPUT__OFFSET;
208208}
209209
210void dss_input_reset(node_description *node)
210static void dss_input_reset(node_description *node)
211211{
212212   UINT8 *node_data = node->context;
213213
r1877r1878
227227   dss_input_step(node);
228228}
229229
230void dss_input_pulse_step(node_description *node)
230static void dss_input_pulse_step(node_description *node)
231231{
232232   UINT8 *node_data = node->context;
233233
r1877r1878
252252#define DSS_INPUT_STREAM__GAIN      (*(node->input[1]))
253253#define DSS_INPUT_STREAM__OFFSET   (*(node->input[2]))
254254
255void dss_input_stream_step(node_description *node)
255static void dss_input_stream_step(node_description *node)
256256{
257257   // the context pointer is set to point to the current input stream data in discrete_stream_update
258258   stream_sample_t **ptr = node->context;
r1877r1878
261261   node->output = data ? (*data) * DSS_INPUT_STREAM__GAIN + DSS_INPUT_STREAM__OFFSET : 0;
262262}
263263
264void dss_input_stream_reset(node_description *node)
264static void dss_input_stream_reset(node_description *node)
265265{
266266   int istream = DSS_INPUT_STREAM__STREAM;
267267   /* we will use the node's context pointer to point to the input stream data */
src/emu/sound/3812intf.c
r1877r1878
1717*
1818******************************************************************************/
1919#include "sndintrf.h"
20#include "deprecat.h"
2021#include "streams.h"
2122#include "cpuintrf.h"
2223#include "3812intf.h"
r1877r1878
403404{
404405   struct y8950_info *info = param;
405406   if (info->intf->portread)
406      return info->intf->portread(info->index);
407      return info->intf->portread(Machine,info->index);
407408   return 0;
408409}
409410
r1877r1878
411412{
412413   struct y8950_info *info = param;
413414   if (info->intf->portwrite)
414      info->intf->portwrite(info->index,data);
415      info->intf->portwrite(Machine,info->index,data);
415416}
416417
417418static unsigned char Y8950KeyboardHandler_r(void *param)
418419{
419420   struct y8950_info *info = param;
420421   if (info->intf->keyboardread)
421      return info->intf->keyboardread(info->index);
422      return info->intf->keyboardread(Machine,info->index);
422423   return 0;
423424}
424425
r1877r1878
426427{
427428   struct y8950_info *info = param;
428429   if (info->intf->keyboardwrite)
429      info->intf->keyboardwrite(info->index,data);
430      info->intf->keyboardwrite(Machine,info->index,data);
430431}
431432
432433static void y8950_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
src/emu/sound/3812intf.h
r1877r1878
1515
1616   int rom_region; /* delta-T ADPCM ROM/RAM region */
1717
18   read8_handler keyboardread;
19   write8_handler keyboardwrite;
20   read8_handler portread;
21   write8_handler portwrite;
18   read8_machine_func keyboardread;
19   write8_machine_func keyboardwrite;
20   read8_machine_func portread;
21   write8_machine_func portwrite;
2222};
2323
2424
src/emu/sound/ymz280b.c
r1877r1878
2424#include <math.h>
2525
2626#include "sndintrf.h"
27#include "deprecat.h"
2728#include "streams.h"
2829#include "ymz280b.h"
2930
r1877r1878
9192   void (*irq_callback)(int);      /* IRQ callback */
9293   struct YMZ280BVoice   voice[8];   /* the 8 voices */
9394   UINT32 rom_readback_addr;      /* where the CPU can read the ROM */
94   read8_handler ext_ram_read;      /* external RAM read handler */
95   write8_handler ext_ram_write;   /* external RAM write handler */
95   read8_machine_func ext_ram_read;      /* external RAM read handler */
96   write8_machine_func ext_ram_write;   /* external RAM write handler */
9697
9798#if MAKE_WAVS
9899   void *      wavresample;         /* resampled waveform */
r1877r1878
117118static TIMER_CALLBACK( update_irq_state_timer_6 );
118119static TIMER_CALLBACK( update_irq_state_timer_7 );
119120
120static const timer_callback update_irq_state_cb[] =
121static const timer_fired_func update_irq_state_cb[] =
121122{
122123   update_irq_state_timer_0,
123124   update_irq_state_timer_1,
r1877r1878
864865
865866         case 0x87:      /* RAM write */
866867            if (chip->ext_ram_write)
867               chip->ext_ram_write(chip->rom_readback_addr, data);
868               chip->ext_ram_write(Machine, chip->rom_readback_addr, data);
868869            else
869870               logerror("YMZ280B attempted RAM write to %X\n", chip->rom_readback_addr);
870871            break;
r1877r1878
10741075{
10751076   UINT8 data;
10761077   struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 0);
1077   data = chip->ext_ram_read(chip->rom_readback_addr - 1);
1078   data = chip->ext_ram_read(machine, chip->rom_readback_addr - 1);
10781079   chip->rom_readback_addr++;
10791080   return data;
10801081}
r1877r1878
10831084{
10841085   UINT8 data;
10851086   struct YMZ280BChip *chip = sndti_token(SOUND_YMZ280B, 1);
1086   data = chip->ext_ram_read(chip->rom_readback_addr - 1);
1087   data = chip->ext_ram_read(machine, chip->rom_readback_addr - 1);
10871088   chip->rom_readback_addr++;
10881089   return data;
10891090}
src/emu/sound/ymz280b.h
r1877r1878
1212{
1313   int region;                  /* memory region where the sample ROM lives */
1414   void (*irq_callback)(int state);   /* irq callback */
15   read8_handler ext_read;         /* external RAM read */
16   write8_handler ext_write;      /* external RAM write */
15   read8_machine_func ext_read;         /* external RAM read */
16   write8_machine_func ext_write;      /* external RAM write */
1717};
1818
1919READ8_HANDLER ( YMZ280B_status_0_r );
src/emu/sound/disc_mth.c
r1877r1878
163163#define DST_ADDER__IN2      (*(node->input[3]))
164164#define DST_ADDER__IN3      (*(node->input[4]))
165165
166void dst_adder_step(node_description *node)
166static void dst_adder_step(node_description *node)
167167{
168168   if(DST_ADDER__ENABLE)
169169   {
r1877r1878
190190#define DST_COMP_ADDER__ENABLE   (*(node->input[0]))
191191#define DST_COMP_ADDER__SELECT   (int)(*(node->input[1]))
192192
193void dst_comp_adder_step(node_description *node)
193static void dst_comp_adder_step(node_description *node)
194194{
195195   const discrete_comp_adder_table *info = node->custom;
196196   int bit;
r1877r1878
240240#define DST_CLAMP__MAX      (*(node->input[3]))
241241#define DST_CLAMP__CLAMP   (*(node->input[4]))
242242
243void dst_clamp_step(node_description *node)
243static void dst_clamp_step(node_description *node)
244244{
245245   if(DST_CLAMP__ENABLE)
246246   {
r1877r1878
271271#define DST_DAC_R1__DATA      (int)(*(node->input[1]))
272272#define DST_DAC_R1__VON         (*(node->input[2]))
273273
274void dst_dac_r1_step(node_description *node)
274static void dst_dac_r1_step(node_description *node)
275275{
276276   const discrete_dac_r1_ladder *info = node->custom;
277277   struct dst_dac_r1_context *context = node->context;
r1877r1878
307307   }
308308}
309309
310void dst_dac_r1_reset(node_description *node)
310static void dst_dac_r1_reset(node_description *node)
311311{
312312   const discrete_dac_r1_ladder *info = node->custom;
313313   struct dst_dac_r1_context *context = node->context;
r1877r1878
376376#define DST_DIODE_MIX__VJUNC      (*(node->input[1]))
377377#define DST_DIODE_MIX__INP(addr)   (*(node->input[2 + addr]))
378378
379void dst_diode_mix_step(node_description *node)
379static void dst_diode_mix_step(node_description *node)
380380{
381381   struct dst_size_context *context = node->context;
382382   double max = 0;
r1877r1878
397397   }
398398}
399399
400void dst_diode_mix_reset(node_description *node)
400static void dst_diode_mix_reset(node_description *node)
401401{
402402   struct dst_size_context *context = node->context;
403403
r1877r1878
420420#define DST_DIVIDE__IN      (*(node->input[1]))
421421#define DST_DIVIDE__DIV      (*(node->input[2]))
422422
423void dst_divide_step(node_description *node)
423static void dst_divide_step(node_description *node)
424424{
425425   if(DST_DIVIDE__ENABLE)
426426   {
r1877r1878
456456#define DST_GAIN__GAIN      (*(node->input[2]))
457457#define DST_GAIN__OFFSET   (*(node->input[3]))
458458
459void dst_gain_step(node_description *node)
459static void dst_gain_step(node_description *node)
460460{
461461   if(DST_GAIN__ENABLE)
462462   {
r1877r1878
518518   return (result);
519519}
520520
521void dst_integrate_step(node_description *node)
521static void dst_integrate_step(node_description *node)
522522{
523523   const discrete_integrate_info *info = node->custom;
524524   struct dst_integrate_context *context = node->context;
r1877r1878
563563   if (node->output > context->vMaxOut) node->output = context->vMaxOut;
564564}
565565
566void dst_integrate_reset(node_description *node)
566static void dst_integrate_reset(node_description *node)
567567{
568568   const discrete_integrate_info *info = node->custom;
569569   struct dst_integrate_context *context = node->context;
r1877r1878
599599#define DST_LOGIC_INV__ENABLE   (*(node->input[0]))
600600#define DST_LOGIC_INV__IN      (*(node->input[1]))
601601
602void dst_logic_inv_step(node_description *node)
602static void dst_logic_inv_step(node_description *node)
603603{
604604   if(DST_LOGIC_INV__ENABLE)
605605   {
r1877r1878
628628#define DST_LOGIC_AND__IN2      (*(node->input[3]))
629629#define DST_LOGIC_AND__IN3      (*(node->input[4]))
630630
631void dst_logic_and_step(node_description *node)
631static void dst_logic_and_step(node_description *node)
632632{
633633   if(DST_LOGIC_AND__ENABLE)
634634   {
r1877r1878
657657#define DST_LOGIC_NAND__IN2      (*(node->input[3]))
658658#define DST_LOGIC_NAND__IN3      (*(node->input[4]))
659659
660void dst_logic_nand_step(node_description *node)
660static void dst_logic_nand_step(node_description *node)
661661{
662662   if(DST_LOGIC_NAND__ENABLE)
663663   {
r1877r1878
686686#define DST_LOGIC_OR__IN2      (*(node->input[3]))
687687#define DST_LOGIC_OR__IN3      (*(node->input[4]))
688688
689void dst_logic_or_step(node_description *node)
689static void dst_logic_or_step(node_description *node)
690690{
691691   if(DST_LOGIC_OR__ENABLE)
692692   {
r1877r1878
715715#define DST_LOGIC_NOR__IN2      (*(node->input[3]))
716716#define DST_LOGIC_NOR__IN3      (*(node->input[4]))
717717
718void dst_logic_nor_step(node_description *node)
718static void dst_logic_nor_step(node_description *node)
719719{
720720   if(DST_LOGIC_NOR__ENABLE)
721721   {
r1877r1878
740740#define DST_LOGIC_XOR__IN0      (*(node->input[1]))
741741#define DST_LOGIC_XOR__IN1      (*(node->input[2]))
742742
743void dst_logic_xor_step(node_description *node)
743static void dst_logic_xor_step(node_description *node)
744744{
745745   if(DST_LOGIC_XOR__ENABLE)
746746   {
r1877r1878
765765#define DST_LOGIC_XNOR__IN0      (*(node->input[1]))
766766#define DST_LOGIC_XNOR__IN1      (*(node->input[2]))
767767
768void dst_logic_nxor_step(node_description *node)
768static void dst_logic_nxor_step(node_description *node)
769769{
770770   if(DST_LOGIC_XNOR__ENABLE)
771771   {
r1877r1878
795795#define DST_LOGIC_DFF__CLOCK    (*(node->input[3]))
796796#define DST_LOGIC_DFF__DATA     (*(node->input[4]))
797797
798void dst_logic_dff_step(node_description *node)
798static void dst_logic_dff_step(node_description *node)
799799{
800800   struct dst_flipflop_context *context = node->context;
801801   int clk = (int)DST_LOGIC_DFF__CLOCK;
r1877r1878
818818   context->last_clk = clk;
819819}
820820
821void dst_logic_ff_reset(node_description *node)
821static void dst_logic_ff_reset(node_description *node)
822822{
823823   struct dst_flipflop_context *context = node->context;
824824   context->last_clk = 0;
r1877r1878
845845#define DST_LOGIC_JKFF__J        (*(node->input[4]))
846846#define DST_LOGIC_JKFF__K        (*(node->input[5]))
847847
848void dst_logic_jkff_step(node_description *node)
848static void dst_logic_jkff_step(node_description *node)
849849{
850850   struct dst_flipflop_context *context = node->context;
851851   int clk = (int)DST_LOGIC_JKFF__CLOCK;
r1877r1878
902902#define DST_LOOKUP_TABLE__IN      (*(node->input[1]))
903903#define DST_LOOKUP_TABLE__SIZE      (*(node->input[2]))
904904
905void dst_lookup_table_step(node_description *node)
905static void dst_lookup_table_step(node_description *node)
906906{
907907   const double *table = node->custom;
908908   int   addr = DST_LOOKUP_TABLE__IN;
r1877r1878
966966#define DST_MIXER__ENABLE      (*(node->input[0]))
967967#define DST_MIXER__IN(bit)      (*(node->input[bit + 1]))
968968
969void dst_mixer_step(node_description *node)
969static void dst_mixer_step(node_description *node)
970970{
971971   const discrete_mixer_desc *info = node->custom;
972972   struct dst_mixer_context *context = node->context;
r1877r1878
10691069   }
10701070}
10711071
1072void dst_mixer_reset(node_description *node)
1072static void dst_mixer_reset(node_description *node)
10731073{
10741074   const discrete_mixer_desc *info = node->custom;
10751075   struct dst_mixer_context *context = node->context;
r1877r1878
11891189#define DST_MULTIPLEX__ADDR         (*(node->input[1]))
11901190#define DST_MULTIPLEX__INP(addr)   (*(node->input[2 + addr]))
11911191
1192void dst_multiplex_step(node_description *node)
1192static void dst_multiplex_step(node_description *node)
11931193{
11941194   struct dst_size_context *context = node->context;
11951195   int addr;
r1877r1878
12131213   }
12141214}
12151215
1216void dst_multiplex_reset(node_description *node)
1216static void dst_multiplex_reset(node_description *node)
12171217{
12181218   struct dst_size_context *context = node->context;
12191219
r1877r1878
12411241#define DST_ONESHOT__WIDTH   (*(node->input[3]))
12421242#define DST_ONESHOT__TYPE   (int)(*(node->input[4]))
12431243
1244void dst_oneshot_step(node_description *node)
1244static void dst_oneshot_step(node_description *node)
12451245{
12461246   struct dst_oneshot_context *context = node->context;
12471247   int trigger = (DST_ONESHOT__TRIG != 0);
r1877r1878
13001300}
13011301
13021302
1303void dst_oneshot_reset(node_description *node)
1303static void dst_oneshot_reset(node_description *node)
13041304{
13051305   struct dst_oneshot_context *context = node->context;
13061306   context->countdown = 0;
r1877r1878
13301330#define DST_RAMP__END      (*(node->input[4]))
13311331#define DST_RAMP__CLAMP      (*(node->input[5]))
13321332
1333void dst_ramp_step(node_description *node)
1333static void dst_ramp_step(node_description *node)
13341334{
13351335   struct dss_ramp_context *context = node->context;
13361336
r1877r1878
13571357   }
13581358}
13591359
1360void dst_ramp_reset(node_description *node)
1360static void dst_ramp_reset(node_description *node)
13611361{
13621362   struct dss_ramp_context *context = node->context;
13631363
r1877r1878
13831383#define DST_SAMPHOLD__CLOCK      (*(node->input[2]))
13841384#define DST_SAMPHOLD__TYPE      (*(node->input[3]))
13851385
1386void dst_samphold_step(node_description *node)
1386static void dst_samphold_step(node_description *node)
13871387{
13881388   struct dst_samphold_context *context = node->context;
13891389
r1877r1878
14201420   context->lastinput=DST_SAMPHOLD__CLOCK;
14211421}
14221422
1423void dst_samphold_reset(node_description *node)
1423static void dst_samphold_reset(node_description *node)
14241424{
14251425   struct dst_samphold_context *context = node->context;
14261426
r1877r1878
14471447#define DSS_SWITCH__IN0      (*(node->input[2]))
14481448#define DSS_SWITCH__IN1      (*(node->input[3]))
14491449
1450void dst_switch_step(node_description *node)
1450static void dst_switch_step(node_description *node)
14511451{
14521452   if(DSS_SWITCH__ENABLE)
14531453   {
r1877r1878
14751475#define DSS_ASWITCH__THRESHOLD   (*(node->input[3]))
14761476
14771477
1478void dst_aswitch_step(node_description *node)
1478static void dst_aswitch_step(node_description *node)
14791479{
14801480   if(DSS_SWITCH__ENABLE)
14811481   {
r1877r1878
15241524   return value;
15251525}
15261526
1527void dst_transform_step(node_description *node)
1527static void dst_transform_step(node_description *node)
15281528{
15291529   if(DST_TRANSFORM__ENABLE)
15301530   {
r1877r1878
16601660#define DST_OP_AMP__INP0   (*(node->input[1]))
16611661#define DST_OP_AMP__INP1   (*(node->input[2]))
16621662
1663void dst_op_amp_step(node_description *node)
1663static void dst_op_amp_step(node_description *node)
16641664{
16651665   const discrete_op_amp_info *info = node->custom;
16661666   struct dst_op_amp_context *context = node->context;
r1877r1878
17201720      node->output = 0;
17211721}
17221722
1723void dst_op_amp_reset(node_description *node)
1723static void dst_op_amp_reset(node_description *node)
17241724{
17251725   const discrete_op_amp_info *info = node->custom;
17261726   struct dst_op_amp_context *context = node->context;
r1877r1878
17631763 ************************************************************************/
17641764#define DST_OP_AMP_1SHT__TRIGGER   (*(node->input[0]))
17651765
1766void dst_op_amp_1sht_step(node_description *node)
1766static void dst_op_amp_1sht_step(node_description *node)
17671767{
17681768   const discrete_op_amp_1sht_info *info = node->custom;
17691769   struct dst_op_amp_1sht_context *context = node->context;
r1877r1878
18031803      context->vCap1 += ((node->output - OP_AMP_NORTON_VBE) * context->r34ratio + OP_AMP_NORTON_VBE - context->vCap1) * context->exponent1c;
18041804}
18051805
1806void dst_op_amp_1sht_reset(node_description *node)
1806static void dst_op_amp_1sht_reset(node_description *node)
18071807{
18081808   const discrete_op_amp_1sht_info *info = node->custom;
18091809   struct dst_op_amp_1sht_context *context = node->context;
r1877r1878
18411841#define DST_TVCA_OP_AMP__INP0   (*(node->input[3]))
18421842#define DST_TVCA_OP_AMP__INP1   (*(node->input[4]))
18431843
1844void dst_tvca_op_amp_step(node_description *node)
1844static void dst_tvca_op_amp_step(node_description *node)
18451845{
18461846   const discrete_op_amp_tvca_info *info = node->custom;
18471847   struct dst_tvca_op_amp_context *context = node->context;
r1877r1878
19211921   if (node->output > context->vOutMax) node->output = context->vOutMax;
19221922}
19231923
1924void dst_tvca_op_amp_reset(node_description *node)
1924static void dst_tvca_op_amp_reset(node_description *node)
19251925{
19261926   const discrete_op_amp_tvca_info *info = node->custom;
19271927   struct dst_tvca_op_amp_context *context = node->context;
src/emu/sound/aica.c
r1877r1878
66    - No FM mode
77    - A third sample format (ADPCM) has been added
88    - Some minor other tweeks (no EGHOLD, slighly more capable DSP)
9
10    init:
11
912*/
1013
1114#include "sndintrf.h"
r1877r1878
126129   int curstep, nxtstep;
127130   int cur_lpquant, cur_lpsample, cur_lpstep;
128131   UINT8 *adbase, *nxtbase, *adlpbase;
132   UINT8 mslc;         // monitored?
129133};
130134
131135
r1877r1878
140144#define MIFULL(aica)      ((aica->udata.data[4]>>0x0)&0x0200)
141145#define MIEMPTY(aica)      ((aica->udata.data[4]>>0x0)&0x0100)
142146
147#define AFSEL(aica)      ((aica->udata.data[6]>>0x0)&0x4000)
148#define MSLC(aica)      ((aica->udata.data[6]>>0x8)&0x3F)
149
143150#define SCILV0(aica)       ((aica->udata.data[0xa8/2]>>0x0)&0xff)
144151#define SCILV1(aica)       ((aica->udata.data[0xac/2]>>0x0)&0xff)
145152#define SCILV2(aica)       ((aica->udata.data[0xb0/2]>>0x0)&0xff)
r1877r1878
425432const int TableQuant[8]={ADFIX(0.8984375),ADFIX(0.8984375),ADFIX(0.8984375),ADFIX(0.8984375),ADFIX(1.19921875),ADFIX(1.59765625),ADFIX(2.0),ADFIX(2.3984375)};
426433const int quant_mul[16]= { 1, 3, 5, 7, 9, 11, 13, 15, -1, -3, -5, -7, -9, -11, -13, -15};
427434
428void InitADPCM(int *PrevSignal, int *PrevQuant)
435static void InitADPCM(int *PrevSignal, int *PrevQuant)
429436{
430437   *PrevSignal=0;
431438   *PrevQuant=0x7f;
432439}
433440
434signed short INLINE DecodeADPCM(int *PrevSignal, unsigned char Delta, int *PrevQuant)
441INLINE signed short DecodeADPCM(int *PrevSignal, unsigned char Delta, int *PrevQuant)
435442{
436443   *PrevSignal+=(*PrevQuant*quant_mul[Delta&15])>>(3);
437444   *PrevSignal=ICLIP16(*PrevSignal);
r1877r1878
634641      AICA->Slots[i].active=0;
635642      AICA->Slots[i].base=NULL;
636643      AICA->Slots[i].EG.state=RELEASE;
644      AICA->Slots[i].mslc=0;
637645   }
638646
639647   AICALFO_Init();
r1877r1878
666674               {
667675                  if(KEYONB(s2) && s2->EG.state==RELEASE/*&& !s2->active*/)
668676                  {
677                     if(s2->mslc) AICA->udata.data[0x10] &= 0x7FFF; // reset LP at KEY_ON
669678                     AICA_StartSlot(AICA, s2);
670679                     #if 0
671680                     printf("StartSlot[%02X]:   SSCTL %01X SA %06X LSA %04X LEA %04X PCMS %01X LPCTL %01X\n",sl,SSCTL(s2),SA(s2),LSA(s2),LEA(s2),PCMS(s2),LPCTL(s2));
r1877r1878
726735         break;
727736      case 0x8:
728737      case 0x9:
729         AICA_MidiIn(0, AICA->udata.data[0x8/2]&0xff, 0);
738         AICA_MidiIn(Machine, 0, AICA->udata.data[0x8/2]&0xff, 0);
730739         break;
731/*      case 0x12:
732        case 0x13:
733        case 0x14:
734        case 0x15:
735        case 0x16:
736        case 0x17:
737            break;*/
740      case 0x12:
741      case 0x13:
742      case 0x14:
743      case 0x15:
744      case 0x16:
745      case 0x17:
746         break;
738747      case 0x90:
739748      case 0x91:
740749         if(AICA->Master)
r1877r1878
860869      case 0x10:   // LP check
861870      case 0x11:
862871         {
863//              int MSLC = (AICA->udata.data[0xc/2]>>8) & 0x3f; // which slot are we monitoring?
864
865//              AICA->udata.data[0x10/2] |= 0x8000; // set LP if necessary
872            //int MSLC = (AICA->udata.data[0xc/2]>>8) & 0x3f;   // which slot are we monitoring?
866873         }
867874         break;
868875
r1877r1878
959966      {
960967         AICA_UpdateRegR(AICA, addr&0xff);
961968         v= *((unsigned short *) (AICA->udata.datab+((addr&0xff))));
969         if((addr&0xfe)==0x10) AICA->udata.data[0x10/2] &= 0x7FFF;   // reset LP on read
962970      }
963971      else if (addr == 0x2d00)
964972      {
r1877r1878
977985
978986#define REVSIGN(v) ((~v)+1)
979987
980void AICA_TimersAddTicks(struct _AICA *AICA, int ticks)
988#ifdef UNUSED_FUNCTION
989static void AICA_TimersAddTicks(struct _AICA *AICA, int ticks)
981990{
982991   if(AICA->TimCnt[0]<=0xff00)
983992   {
r1877r1878
10151024      AICA->udata.data[0x98/2]|=AICA->TimCnt[2]>>8;
10161025   }
10171026}
1027#endif
10181028
10191029INLINE INT32 AICA_UpdateSlot(struct _AICA *AICA, struct _SLOT *slot)
10201030{
r1877r1878
10601070   }
10611071   else if (PCMS(slot) == 0)   //16 bit signed
10621072   {
1063      INT16 *p1=(signed short *) (AICA->AICARAM+((SA(slot)+addr1)&AICA->RAM_MASK));
1064      INT16 *p2=(signed short *) (AICA->AICARAM+((SA(slot)+addr2)&AICA->RAM_MASK));
1073      UINT8 *p1=(UINT8 *) (AICA->AICARAM+((SA(slot)+addr1)&AICA->RAM_MASK));
1074      UINT8 *p2=(UINT8 *) (AICA->AICARAM+((SA(slot)+addr2)&AICA->RAM_MASK));
10651075      INT32 s;
10661076      INT32 fpart=slot->cur_addr&((1<<SHIFT)-1);
1067      s=(int) (p1[0])*((1<<SHIFT)-fpart)+(int) (p2[0])*fpart;
1077      s=(int) ((INT16)(p1[0] | (p1[1]<<8)))*((1<<SHIFT)-fpart)+(int) ((INT16)(p2[0] | (p2[1]<<8)))*fpart;
10681078      sample=(s>>SHIFT);
10691079   }
10701080   else   // 4-bit ADPCM
r1877r1878
11461156         if(*addr[addr_select]>=LSA(slot) && *addr[addr_select]>=LEA(slot))
11471157         {
11481158         //slot->active=0;
1159         if(slot->mslc) AICA->udata.data[8] |= 0x8000;
11491160         AICA_StopSlot(slot,0);
11501161         }
11511162         break;
11521163      case 1: //normal loop
11531164         if(*addr[addr_select]>=LEA(slot))
11541165         {
1166            if(slot->mslc) AICA->udata.data[8] |= 0x8000;
11551167            rem_addr = *slot_addr[addr_select] - (LEA(slot)<<SHIFT);
11561168            *slot_addr[addr_select]=(LSA(slot)<<SHIFT) + rem_addr;
11571169
r1877r1878
11941206   else
11951207      sample=(sample*EG_TABLE[EG_Update(slot)>>(SHIFT-10)])>>SHIFT;
11961208
1209   if(slot->mslc)
1210   {
1211      AICA->udata.data[0x12/2] = addr1;
1212      if (!(AFSEL(AICA)))
1213      {
1214         AICA->udata.data[0x10/2] |= slot->EG.state<<13;
1215         AICA->udata.data[0x10/2] |= 0x3FF - (slot->EG.volume>>EG_SHIFT);
1216      }
1217   }
1218
11971219   return sample;
11981220}
11991221
r1877r1878
12141236      // mix slots' direct output
12151237      for(sl=0;sl<64;++sl)
12161238      {
1239         struct _SLOT *slot=AICA->Slots+sl;
1240         slot->mslc = (MSLC(AICA)==sl);
12171241         RBUFDST=AICA->RINGBUF+AICA->BUFPTR;
12181242         if(AICA->Slots[sl].active)
12191243         {
1220            struct _SLOT *slot=AICA->Slots+sl;
12211244            unsigned int Enc;
12221245            signed int sample;
12231246
r1877r1878
12541277   }
12551278}
12561279
1257int AICA_IRQCB(void *param)
1280#ifdef UNUSED_FUNCTION
1281static int AICA_IRQCB(void *param)
12581282{
12591283   CheckPendingIRQ(param);
12601284   return -1;
12611285}
1286#endif
12621287
12631288static void AICA_Update(void *param, stream_sample_t **inputs, stream_sample_t **buf, int samples)
12641289{
r1877r1878
12931318   return AICA;
12941319}
12951320
1296void aica_stop(void)
1321#ifdef UNUSED_FUNCTION
1322static void aica_stop(void)
12971323{
12981324}
1325#endif
12991326
13001327void AICA_set_ram_base(int which, void *base, int size)
13011328{
src/emu/sound/x1_010.c
r1877r1878
270270   UINT16   ret;
271271
272272   ret = info->HI_WORD_BUF[offset]<<8;
273   ret += (seta_sound_r( offset )&0xff);
273   ret += (seta_sound_r( machine, offset )&0xff);
274274   LOG_REGISTER_READ(( "Read X1-010 PC:%06X Offset:%04X Data:%04X\n", activecpu_get_pc(), offset, ret ));
275275   return ret;
276276}
r1877r1878
279279{
280280   struct x1_010_info *info = sndti_token(SOUND_X1_010, 0);
281281   info->HI_WORD_BUF[offset] = (data>>8)&0xff;
282   seta_sound_w( offset, data&0xff );
282   seta_sound_w( machine, offset, data&0xff );
283283   LOG_REGISTER_WRITE(( "Write X1-010 PC:%06X Offset:%04X Data:%04X\n", activecpu_get_pc(), offset, data ));
284284}
285285
src/emu/sound/upd7759.c
r1877r1878
197197
198198*************************************************************/
199199
200const static int upd7759_step[16][16] =
200static const int upd7759_step[16][16] =
201201{
202202   { 0,  0,  1,  2,  3,   5,   7,  10,  0,   0,  -1,  -2,  -3,   -5,   -7,  -10 },
203203   { 0,  1,  2,  3,  4,   6,   8,  13,  0,  -1,  -2,  -3,  -4,   -6,   -8,  -13 },
r1877r1878
217217   { 6, 20, 36, 54, 76, 104, 144, 214, -6, -20, -36, -54, -76, -104, -144, -214 },
218218};
219219
220const static int upd7759_state[16] = { -1, -1, 0, 0, 1, 2, 2, 3, -1, -1, 0, 0, 1, 2, 2, 3 };
220static const int upd7759_state[16] = { -1, -1, 0, 0, 1, 2, 2, 3, -1, -1, 0, 0, 1, 2, 2, 3 };
221221
222222
223223
src/emu/sound/ymf271.c
r1877r1878
1414
1515#include <math.h>
1616#include "sndintrf.h"
17#include "deprecat.h"
1718#include "streams.h"
1819#include "ymf271.h"
1920
r1877r1878
107108   UINT8 ext_read;
108109
109110   const UINT8 *rom;
110   read8_handler ext_mem_read;
111   write8_handler ext_mem_write;
111   read8_machine_func ext_mem_read;
112   write8_machine_func ext_mem_write;
112113   void (*irq_callback)(int);
113114
114115   int index;
r1877r1878
13751376static UINT8 ymf271_read_ext_memory(YMF271Chip *chip, UINT32 address)
13761377{
13771378   if( chip->ext_mem_read ) {
1378      return chip->ext_mem_read(address);
1379      return chip->ext_mem_read(Machine,address);
13791380   } else {
13801381      if( address < 0x800000)
13811382         return chip->rom[address];
r1877r1878
13861387static void ymf271_write_ext_memory(YMF271Chip *chip, UINT32 address, UINT8 data)
13871388{
13881389   if( chip->ext_mem_write ) {
1389      chip->ext_mem_write(address, data);
1390      chip->ext_mem_write(Machine, address, data);
13901391   }
13911392}
13921393
r1877r1878
17251726   state_save_register_item("ymf271", chip->index, chip->ext_read);
17261727}
17271728
1728static void ymf271_init(YMF271Chip *chip, UINT8 *rom, void (*cb)(int), read8_handler ext_read, write8_handler ext_write)
1729static void ymf271_init(YMF271Chip *chip, UINT8 *rom, void (*cb)(int), read8_machine_func ext_read, write8_machine_func ext_write)
17291730{
17301731   chip->timA = timer_alloc(ymf271_timer_a_tick, chip);
17311732   chip->timB = timer_alloc(ymf271_timer_b_tick, chip);
src/emu/sound/pokey.c
r1877r1878
5050 *****************************************************************************/
5151
5252#include "sndintrf.h"
53#include "deprecat.h"
5354#include "streams.h"
5455#include "cpuintrf.h"
5556#include "pokey.h"
r1877r1878
180181   int timer_param[3];      /* computed parameters for these timers */
181182   emu_timer *rtimer;     /* timer for calculating the random offset */
182183   emu_timer *ptimer[8];   /* pot timers */
183   read8_handler pot_r[8];
184   read8_handler allpot_r;
185   read8_handler serin_r;
186   write8_handler serout_w;
184   read8_machine_func pot_r[8];
185   read8_machine_func allpot_r;
186   read8_machine_func serin_r;
187   write8_machine_func serout_w;
187188   void (*interrupt_cb)(int mask);
188189    UINT8 AUDF[4];          /* AUDFx (D200, D202, D204, D206) */
189190   UINT8 AUDC[4];         /* AUDCx (D201, D203, D205, D207) */
r1877r1878
809810      p->POTx[pot] = 0xff;
810811      if( p->pot_r[pot] )
811812      {
812         int r = (*p->pot_r[pot])(pot);
813         int r = (*p->pot_r[pot])(Machine, pot);
813814
814815         LOG(("POKEY #%d pot_r(%d) returned $%02x\n", p->index, pot, r));
815816         if( r != -1 )
r1877r1878
878879      }
879880      else if( p->allpot_r )
880881      {
881         data = (*p->allpot_r)(offs);
882         data = (*p->allpot_r)(Machine, offs);
882883         LOG(("POKEY #%d ALLPOT callback $%02x\n", chip, data));
883884      }
884885      else
r1877r1878
931932
932933   case SERIN_C:
933934      if( p->serin_r )
934         p->SERIN = (*p->serin_r)(offs);
935         p->SERIN = (*p->serin_r)(Machine, offs);
935936      data = p->SERIN;
936937      LOG(("POKEY #%d SERIN  $%02x\n", chip, data));
937938      break;
r1877r1878
11781179    case SEROUT_C:
11791180      LOG(("POKEY #%d SEROUT $%02x\n", chip, data));
11801181      if (p->serout_w)
1181         (*p->serout_w)(offs, data);
1182         (*p->serout_w)(Machine, offs, data);
11821183      p->SKSTAT |= SK_SEROUT;
11831184        /*
11841185         * These are arbitrary values, tested with some custom boot
src/emu/sound/ymf271.h
r1877r1878
44struct YMF271interface
55{
66   int region;         /* memory region of sample ROMs */
7   read8_handler ext_read;      /* external memory read */
8   write8_handler ext_write;   /* external memory write */
7   read8_machine_func ext_read;      /* external memory read */
8   write8_machine_func ext_write;   /* external memory write */
99   void (*irq_callback)(int state);   /* irq callback */
1010};
1111
src/emu/sound/ay8910.c
r1877r1878
1111***************************************************************************/
1212
1313#include "sndintrf.h"
14#include "deprecat.h"
1415#include "streams.h"
1516#include "cpuintrf.h"
1617#include "ay8910.h"
r1877r1878
2627   int streams;
2728   int ready;
2829   sound_stream *Channel;
29   read8_handler PortAread;
30   read8_handler PortBread;
31   write8_handler PortAwrite;
32   write8_handler PortBwrite;
30   read8_machine_func PortAread;
31   read8_machine_func PortBread;
32   write8_machine_func PortAwrite;
33   write8_machine_func PortBwrite;
3334   INT32 register_latch;
3435   UINT8 Regs[16];
3536   INT32 lastEnable;
r1877r1878
124125      {
125126         /* write out 0xff if port set to input */
126127         if (PSG->PortAwrite)
127            (*PSG->PortAwrite)(0, (PSG->Regs[AY_ENABLE] & 0x40) ? PSG->Regs[AY_PORTA] : 0xff);
128            (*PSG->PortAwrite)(Machine, 0, (PSG->Regs[AY_ENABLE] & 0x40) ? PSG->Regs[AY_PORTA] : 0xff);
128129      }
129130
130131      if ((PSG->lastEnable == -1) ||
r1877r1878
132133      {
133134         /* write out 0xff if port set to input */
134135         if (PSG->PortBwrite)
135            (*PSG->PortBwrite)(0, (PSG->Regs[AY_ENABLE] & 0x80) ? PSG->Regs[AY_PORTB] : 0xff);
136            (*PSG->PortBwrite)(Machine, 0, (PSG->Regs[AY_ENABLE] & 0x80) ? PSG->Regs[AY_PORTB] : 0xff);
136137      }
137138
138139      PSG->lastEnable = PSG->Regs[AY_ENABLE];
r1877r1878
212213      if (PSG->Regs[AY_ENABLE] & 0x40)
213214      {
214215         if (PSG->PortAwrite)
215            (*PSG->PortAwrite)(0, PSG->Regs[AY_PORTA]);
216            (*PSG->PortAwrite)(Machine, 0, PSG->Regs[AY_PORTA]);
216217         else
217218            logerror("warning - write %02x to 8910 #%d Port A\n",PSG->Regs[AY_PORTA],PSG->index);
218219      }
r1877r1878
225226      if (PSG->Regs[AY_ENABLE] & 0x80)
226227      {
227228         if (PSG->PortBwrite)
228            (*PSG->PortBwrite)(0, PSG->Regs[AY_PORTB]);
229            (*PSG->PortBwrite)(Machine, 0, PSG->Regs[AY_PORTB]);
229230         else
230231            logerror("warning - write %02x to 8910 #%d Port B\n",PSG->Regs[AY_PORTB],PSG->index);
231232      }
r1877r1878
613614
614615static void AY8910_init(struct AY8910 *PSG, int streams,
615616      int clock,int sample_rate,
616      read8_handler portAread,read8_handler portBread,
617      write8_handler portAwrite,write8_handler portBwrite)
617      read8_machine_func portAread,read8_machine_func portBread,
618      write8_machine_func portAwrite,write8_machine_func portBwrite)
618619{
619620   PSG->PortAread = portAread;
620621   PSG->PortBread = portBread;
r1877r1878
673674
674675
675676void *ay8910_start_ym(sound_type chip_type, int sndindex, int clock, int streams,
676      read8_handler portAread, read8_handler portBread,
677      write8_handler portAwrite, write8_handler portBwrite)
677      read8_machine_func portAread, read8_machine_func portBread,
678      write8_machine_func portAwrite, write8_machine_func portBwrite)
678679{
679680   struct AY8910 *info;
680681
r1877r1878
765766           even if the port is set as output, we still need to return the external
766767           data. Some games, like kidniki, need this to work.
767768         */
768      if (PSG->PortAread) PSG->Regs[AY_PORTA] = (*PSG->PortAread)(0);
769      if (PSG->PortAread) PSG->Regs[AY_PORTA] = (*PSG->PortAread)(Machine, 0);
769770      else logerror("PC %04x: warning - read 8910 #%d Port A\n",activecpu_get_pc(),PSG->index);
770771      break;
771772   case AY_PORTB:
772773      if ((PSG->Regs[AY_ENABLE] & 0x80) != 0)
773774         logerror("warning: read from 8910 #%d Port B set as output\n",PSG->index);
774      if (PSG->PortBread) PSG->Regs[AY_PORTB] = (*PSG->PortBread)(0);
775      if (PSG->PortBread) PSG->Regs[AY_PORTB] = (*PSG->PortBread)(Machine, 0);
775776      else logerror("PC %04x: warning - read 8910 #%d Port B\n",activecpu_get_pc(),PSG->index);
776777      break;
777778   }
src/emu/sound/cdda.c
r1877r1878
9090
9191int cdda_num_from_cdrom(void *file)
9292{
93   int index;
93   int index = 0;
9494
95   for (index = 0; ; index++)
95   do
9696   {
9797      cdda_info *info;
9898
r1877r1878
105105         return -1;
106106      if (info->disc == file)
107107         return index;
108   }
109   return 0;
108      index++;
109   } while (1);
110110}
111111
112112
src/emu/sound/pokey.h
r1877r1878
6767 *****************************************************************************/
6868
6969struct POKEYinterface {
70   read8_handler pot_r[8];
71   read8_handler allpot_r;
72   read8_handler serin_r;
73   write8_handler serout_w;
70   read8_machine_func pot_r[8];
71   read8_machine_func allpot_r;
72   read8_machine_func serin_r;
73   write8_machine_func serout_w;
7474   void (*interrupt_cb)(int mask);
7575};
7676
src/emu/sound/tms5220r.c
r1877r1878
22
33/* This is the energy lookup table (4-bits -> 10-bits) */
44
5const static unsigned short energytable[0x10]={
5static const unsigned short energytable[0x10]={
660x0000,0x00C0,0x0140,0x01C0,0x0280,0x0380,0x0500,0x0740,
770x0A00,0x0E40,0x1440,0x1C80,0x2840,0x38C0,0x5040,0x7FC0};
88
99/* This is the pitch lookup table (6-bits -> 8-bits) */
1010
11const static unsigned short pitchtable [0x40]={
11static const unsigned short pitchtable [0x40]={
12120x0000,0x1000,0x1100,0x1200,0x1300,0x1400,0x1500,0x1600,
13130x1700,0x1800,0x1900,0x1A00,0x1B00,0x1C00,0x1D00,0x1E00,
14140x1F00,0x2000,0x2100,0x2200,0x2300,0x2400,0x2500,0x2600,
r1877r1878
2222
2323/* K1 is (5-bits -> 9 bits+sign, 2's comp. fractional (-1 < x < 1) */
2424
25const static short k1table    [0x20]={
25static const short k1table    [0x20]={
2626(short)0x82C0,(short)0x8380,(short)0x83C0,(short)0x8440,(short)0x84C0,(short)0x8540,(short)0x8600,(short)0x8780,
2727(short)0x8880,(short)0x8980,(short)0x8AC0,(short)0x8C00,(short)0x8D40,(short)0x8F00,(short)0x90C0,(short)0x92C0,
2828(short)0x9900,(short)0xA140,(short)0xAB80,(short)0xB840,(short)0xC740,(short)0xD8C0,(short)0xEBC0,0x0000,
r1877r1878
3030
3131/* K2 is (5-bits -> 9 bits+sign, 2's comp. fractional (-1 < x < 1) */
3232
33const static short k2table    [0x20]={
33static const short k2table    [0x20]={
3434(short)0xAE00,(short)0xB480,(short)0xBB80,(short)0xC340,(short)0xCB80,(short)0xD440,(short)0xDDC0,(short)0xE780,
3535(short)0xF180,(short)0xFBC0,0x0600,0x1040,0x1A40,0x2400,0x2D40,0x3600,
36360x3E40,0x45C0,0x4CC0,0x5300,0x5880,0x5DC0,0x6240,0x6640,
r1877r1878
3838
3939/* K3 is (4-bits -> 9 bits+sign, 2's comp. fractional (-1 < x < 1) */
4040
41const static short k3table    [0x10]={
41static const short k3table    [0x10]={
4242(short)0x9200,(short)0x9F00,(short)0xAD00,(short)0xBA00,(short)0xC800,(short)0xD500,(short)0xE300,(short)0xF000,
4343(short)0xFE00,0x0B00,0x1900,0x2600,0x3400,0x4100,0x4F00,0x5C00};
4444
4545/* K4 is (4-bits -> 9 bits+sign, 2's comp. fractional (-1 < x < 1) */
4646
47const static short k4table    [0x10]={
47static const short k4table    [0x10]={
4848(short)0xAE00,(short)0xBC00,(short)0xCA00,(short)0xD800,(short)0xE600,(short)0xF400,0x0100,0x0F00,
49490x1D00,0x2B00,0x3900,0x4700,0x5500,0x6300,0x7100,0x7E00};
5050
5151/* K5 is (4-bits -> 9 bits+sign, 2's comp. fractional (-1 < x < 1) */
5252
53const static short k5table    [0x10]={
53static const short k5table    [0x10]={
5454(short)0xAE00,(short)0xBA00,(short)0xC500,(short)0xD100,(short)0xDD00,(short)0xE800,(short)0xF400,(short)0xFF00,
55550x0B00,0x1700,0x2200,0x2E00,0x3900,0x4500,0x5100,0x5C00};
5656
5757/* K6 is (4-bits -> 9 bits+sign, 2's comp. fractional (-1 < x < 1) */
5858
59const static short k6table    [0x10]={
59static const short k6table    [0x10]={
6060(short)0xC000,(short)0xCB00,(short)0xD600,(short)0xE100,(short)0xEC00,(short)0xF700,0x0300,0x0E00,
61610x1900,0x2400,0x2F00,0x3A00,0x4500,0x5000,0x5B00,0x6600};
6262
6363/* K7 is (4-bits -> 9 bits+sign, 2's comp. fractional (-1 < x < 1) */
6464
65const static short k7table    [0x10]={
65static const short k7table    [0x10]={
6666(short)0xB300,(short)0xBF00,(short)0xCB00,(short)0xD700,(short)0xE300,(short)0xEF00,(short)0xFB00,0x0700,
67670x1300,0x1F00,0x2B00,0x3700,0x4300,0x4F00,0x5A00,0x6600};
6868
6969/* K8 is (3-bits -> 9 bits+sign, 2's comp. fractional (-1 < x < 1) */
7070
71const static short k8table    [0x08]={
71static const short k8table    [0x08]={
7272(short)0xC000,(short)0xD800,(short)0xF000,0x0700,0x1F00,0x3700,0x4F00,0x6600};
7373
7474/* K9 is (3-bits -> 9 bits+sign, 2's comp. fractional (-1 < x < 1) */
7575
76const static short k9table    [0x08]={
76static const short k9table    [0x08]={
7777(short)0xC000,(short)0xD400,(short)0xE800,(short)0xFC00,0x1000,0x2500,0x3900,0x4D00};
7878
7979/* K10 is (3-bits -> 9 bits+sign, 2's comp. fractional (-1 < x < 1) */
8080
81const static short k10table   [0x08]={
81static const short k10table   [0x08]={
8282(short)0xCD00,(short)0xDF00,(short)0xF100,0x0400,0x1600,0x2000,0x3B00,0x4D00};
8383
8484/* chirp table */
src/emu/sound/ym2151.c
r1877r1878
77#include <math.h>
88
99#include "sndintrf.h"
10#include "deprecat.h"
1011#include "streams.h"
1112#include "ym2151.h"
1213
r1877r1878
165166   UINT32      noise_tab[32];         /* 17bit Noise Generator periods */
166167
167168   void (*irqhandler)(int irq);      /* IRQ function handler */
168   write8_handler porthandler;      /* port write function handler */
169   write8_machine_func porthandler;      /* port write function handler */
169170
170171   unsigned int clock;               /* chip clock in Hz (passed from 2151intf.c) */
171172   unsigned int sampfreq;            /* sampling frequency in Hz (passed from 2151intf.c) */
r1877r1878
11951196      case 0x1b:   /* CT2, CT1, LFO waveform */
11961197         chip->ct = v >> 6;
11971198         chip->lfo_wsel = v & 3;
1198         if (chip->porthandler) (*chip->porthandler)(0 , chip->ct );
1199         if (chip->porthandler) (*chip->porthandler)(Machine, 0 , chip->ct );
11991200         break;
12001201
12011202      default:
r1877r1878
24972498   PSG->irqhandler = handler;
24982499}
24992500
2500void YM2151SetPortWriteHandler(void *chip, write8_handler handler)
2501void YM2151SetPortWriteHandler(void *chip, write8_machine_func handler)
25012502{
25022503   YM2151 *PSG = chip;
25032504   PSG->porthandler = handler;
src/emu/sound/ay8910.h
r1877r1878
1818
1919struct AY8910interface
2020{
21   read8_handler portAread;
22   read8_handler portBread;
23   write8_handler portAwrite;
24   write8_handler portBwrite;
21   read8_machine_func portAread;
22   read8_machine_func portBread;
23   write8_machine_func portAwrite;
24   write8_machine_func portBwrite;
2525};
2626
2727void AY8910_set_volume(int chip,int channel,int volume);
r1877r1878
7878/*********** An interface for SSG of YM2203 ***********/
7979
8080void *ay8910_start_ym(sound_type chip_type, int sndindex, int clock, int streams,
81      read8_handler portAread, read8_handler portBread,
82      write8_handler portAwrite, write8_handler portBwrite);
81      read8_machine_func portAread, read8_machine_func portBread,
82      write8_machine_func portAwrite, write8_machine_func portBwrite);
8383
8484void ay8910_stop_ym(void *chip);
8585void ay8910_reset_ym(void *chip);
src/emu/sound/ym2151.h
r1877r1878
7979void YM2151SetIrqHandler(void *chip, void (*handler)(int irq));
8080
8181/* set port write handler on YM2151 chip number 'n'*/
82void YM2151SetPortWriteHandler(void *chip, write8_handler handler);
82void YM2151SetPortWriteHandler(void *chip, write8_machine_func handler);
8383
8484/* refresh chip when load state */
8585void YM2151Postload(void *chip);
src/emu/sound/scsp.c
r1877r1878
712712         break;
713713      case 0x6:
714714      case 0x7:
715         SCSP_MidiIn(0, SCSP->udata.data[0x6/2]&0xff, 0);
715         SCSP_MidiIn(Machine, 0, SCSP->udata.data[0x6/2]&0xff, 0);
716716         break;
717717      case 0x12:
718718      case 0x13:
src/emu/sound/disc_dev.c
r1877r1878
158158#define DSD_555_ASTBL__C      (*(node->input[3]))
159159#define DSD_555_ASTBL__CTRLV   (*(node->input[4]))
160160
161void dsd_555_astbl_step(node_description *node)
161static void dsd_555_astbl_step(node_description *node)
162162{
163163   const discrete_555_desc *info = node->custom;
164164   struct dsd_555_astbl_context *context = node->context;
r1877r1878
338338   }
339339}
340340
341void dsd_555_astbl_reset(node_description *node)
341static void dsd_555_astbl_reset(node_description *node)
342342{
343343   const discrete_555_desc *info = node->custom;
344344   struct dsd_555_astbl_context *context = node->context;
r1877r1878
399399#define DSD_555_MSTBL__R      (*(node->input[2]))
400400#define DSD_555_MSTBL__C      (*(node->input[3]))
401401
402void dsd_555_mstbl_step(node_description *node)
402static void dsd_555_mstbl_step(node_description *node)
403403{
404404   const discrete_555_desc *info = node->custom;
405405   struct dsd_555_mstbl_context *context = node->context;
r1877r1878
485485   }
486486}
487487
488void dsd_555_mstbl_reset(node_description *node)
488static void dsd_555_mstbl_reset(node_description *node)
489489{
490490   const discrete_555_desc *info = node->custom;
491491   struct dsd_555_mstbl_context *context = node->context;
r1877r1878
542542#define DSD_555_CC__RGND   (*(node->input[5]))
543543#define DSD_555_CC__RDIS   (*(node->input[6]))
544544
545void dsd_555_cc_step(node_description *node)
545static void dsd_555_cc_step(node_description *node)
546546{
547547   const discrete_555_cc_desc *info = node->custom;
548548   struct dsd_555_cc_context *context = node->context;
r1877r1878
814814   }
815815}
816816
817void dsd_555_cc_reset(node_description *node)
817static void dsd_555_cc_reset(node_description *node)
818818{
819819   const discrete_555_cc_desc *info = node->custom;
820820   struct dsd_555_cc_context *context = node->context;
r1877r1878
999999#define DSD_555_VCO1__VIN1   (*(node->input[1]))
10001000#define DSD_555_VCO1__VIN2   (*(node->input[2]))
10011001
1002void dsd_555_vco1_step(node_description *node)
1002static void dsd_555_vco1_step(node_description *node)
10031003{
10041004   const discrete_555_vco1_desc *info = node->custom;
10051005   struct dsd_555_vco1_context *context = node->context;
r1877r1878
11501150   }
11511151}
11521152
1153void dsd_555_vco1_reset(node_description *node)
1153static void dsd_555_vco1_reset(node_description *node)
11541154{
11551155   const discrete_555_vco1_desc *info = node->custom;
11561156   struct dsd_555_vco1_context *context = node->context;
r1877r1878
12281228#define DSD_566__R      (*(node->input[2]))
12291229#define DSD_566__C      (*(node->input[3]))
12301230
1231void dsd_566_step(node_description *node)
1231static void dsd_566_step(node_description *node)
12321232{
12331233   const discrete_566_desc *info = node->custom;
12341234   struct dsd_566_context *context = node->context;
r1877r1878
13381338      node->output = 0;
13391339}
13401340
1341void dsd_566_reset(node_description *node)
1341static void dsd_566_reset(node_description *node)
13421342{
13431343   const discrete_566_desc *info = node->custom;
13441344   struct dsd_566_context *context = node->context;
r1877r1878
14041404#define LS624_F1(x)         (0.19 + 20.0/90.0*(x))
14051405#define LS624_T(_C, _R, _F)      (-600.0 * (_C) * log(1.0-LS624_F1(_R)*0.12/LS624_F1(_F)))
14061406
1407void dsd_ls624_step(node_description *node)
1407static void dsd_ls624_step(node_description *node)
14081408{
14091409   struct dsd_ls624_context *context = node->context;
14101410
r1877r1878
14521452      node->output = 0;
14531453}
14541454
1455void dsd_ls624_reset(node_description *node)
1455static void dsd_ls624_reset(node_description *node)
14561456{
14571457   struct dsd_ls624_context *context = node->context;
14581458
src/emu/sound/2608intf.h
r1877r1878
55
66struct YM2608interface
77{
8   read8_handler portAread;
9   read8_handler portBread;
10   write8_handler portAwrite;
11   write8_handler portBwrite;
8   read8_machine_func portAread;
9   read8_machine_func portBread;
10   write8_machine_func portAwrite;
11   write8_machine_func portBwrite;
1212   void ( *handler )( int irq );   /* IRQ handler for the YM2608 */
1313   int pcmrom;      /* Delta-T memory region ram/rom */
1414};
src/emu/sound/disc_wav.c
r1877r1878
177177
178178static const int disc_7492_count[6] = {0x00, 0x01, 0x02, 0x04, 0x05, 0x06};
179179
180void dss_counter_step(node_description *node)
180static void dss_counter_step(node_description *node)
181181{
182182   struct dss_counter_context *context = node->context;
183183   double cycles;
r1877r1878
267267      node->output = context->count;
268268}
269269
270void dss_counter_reset(node_description *node)
270static void dss_counter_reset(node_description *node)
271271{
272272   struct dss_counter_context *context = node->context;
273273
r1877r1878
373373}
374374
375375/* reset prototype so that it can be used in init function */
376void dss_lfsr_reset(node_description *node);
376static void dss_lfsr_reset(node_description *node);
377377
378void dss_lfsr_step(node_description *node)
378static void dss_lfsr_step(node_description *node)
379379{
380380   const discrete_lfsr_desc *lfsr_desc = node->custom;
381381   struct dss_lfsr_context *context = node->context;
r1877r1878
465465   }
466466}
467467
468void dss_lfsr_reset(node_description *node)
468static void dss_lfsr_reset(node_description *node)
469469{
470470   const discrete_lfsr_desc *lfsr_desc = node->custom;
471471   struct dss_lfsr_context *context = node->context;
r1877r1878
519519#define DSS_NOISE__AMP      (*(node->input[2]))
520520#define DSS_NOISE__BIAS      (*(node->input[3]))
521521
522void dss_noise_step(node_description *node)
522static void dss_noise_step(node_description *node)
523523{
524524   struct dss_noise_context *context = node->context;
525525
r1877r1878
556556}
557557
558558
559void dss_noise_reset(node_description *node)
559static void dss_noise_reset(node_description *node)
560560{
561561   struct dss_noise_context *context = node->context;
562562
r1877r1878
585585 #define DSS_NOTE__MAX2         (*(node->input[4]))
586586 #define DSS_NOTE__CLOCK_TYPE   (*(node->input[5]))
587587
588void dss_note_step(node_description *node)
588static void dss_note_step(node_description *node)
589589{
590590   struct dss_note_context *context = node->context;
591591
r1877r1878
671671      node->output = 0;
672672}
673673
674void dss_note_reset(node_description *node)
674static void dss_note_reset(node_description *node)
675675{
676676   struct dss_note_context *context = node->context;
677677
r1877r1878
709709/* the same to save a calculation step */
710710#define DSS_OP_AMP_OSC_NORTON_VP_IN      context->high_out_V
711711
712void dss_op_amp_osc_step(node_description *node)
712static void dss_op_amp_osc_step(node_description *node)
713713{
714714   const discrete_op_amp_osc_info *info = node->custom;
715715   struct dss_op_amp_osc_context *context = node->context;
r1877r1878
881881   }
882882}
883883
884void dss_op_amp_osc_reset(node_description *node)
884static void dss_op_amp_osc_reset(node_description *node)
885885{
886886   const discrete_op_amp_osc_info *info = node->custom;
887887   struct dss_op_amp_osc_context *context = node->context;
r1877r1878
10241024#define DSS_SAWTOOTHWAVE__GRAD      (*(node->input[4]))
10251025#define DSS_SAWTOOTHWAVE__PHASE      (*(node->input[5]))
10261026
1027void dss_sawtoothwave_step(node_description *node)
1027static void dss_sawtoothwave_step(node_description *node)
10281028{
10291029   struct dss_sawtoothwave_context *context = node->context;
10301030
r1877r1878
10501050   context->phase=fmod((context->phase+((2.0*M_PI*DSS_SAWTOOTHWAVE__FREQ)/discrete_current_context->sample_rate)),2.0*M_PI);
10511051}
10521052
1053void dss_sawtoothwave_reset(node_description *node)
1053static void dss_sawtoothwave_reset(node_description *node)
10541054{
10551055   struct dss_sawtoothwave_context *context = node->context;
10561056   double start;
r1877r1878
10841084#define DSS_SCHMITT_OSC__VIN   (*(node->input[1]))
10851085#define DSS_SCHMITT_OSC__AMP   (*(node->input[2]))
10861086
1087void dss_schmitt_osc_step(node_description *node)
1087static void dss_schmitt_osc_step(node_description *node)
10881088{
10891089   const discrete_schmitt_osc_desc *info = node->custom;
10901090   struct dss_schmitt_osc_context *context = node->context;
r1877r1878
11581158   node->output *= DSS_SCHMITT_OSC__AMP;
11591159}
11601160
1161void dss_schmitt_osc_reset(node_description *node)
1161static void dss_schmitt_osc_reset(node_description *node)
11621162{
11631163   const discrete_schmitt_osc_desc *info = node->custom;
11641164   struct dss_schmitt_osc_context *context = node->context;
r1877r1878
12041204#define DSS_SINEWAVE__BIAS      (*(node->input[3]))
12051205#define DSS_SINEWAVE__PHASE      (*(node->input[4]))
12061206
1207void dss_sinewave_step(node_description *node)
1207static void dss_sinewave_step(node_description *node)
12081208{
12091209   struct dss_sinewave_context *context = node->context;
12101210
r1877r1878
12301230   context->phase=fmod((context->phase+((2.0*M_PI*DSS_SINEWAVE__FREQ)/discrete_current_context->sample_rate)),2.0*M_PI);
12311231}
12321232
1233void dss_sinewave_reset(node_description *node)
1233static void dss_sinewave_reset(node_description *node)
12341234{
12351235   struct dss_sinewave_context *context = node->context;
12361236   double start;
r1877r1878
12631263#define DSS_SQUAREWAVE__BIAS   (*(node->input[4]))
12641264#define DSS_SQUAREWAVE__PHASE   (*(node->input[5]))
12651265
1266void dss_squarewave_step(node_description *node)
1266static void dss_squarewave_step(node_description *node)
12671267{
12681268   struct dss_squarewave_context *context = node->context;
12691269
r1877r1878
12961296   context->phase=fmod((context->phase+((2.0*M_PI*DSS_SQUAREWAVE__FREQ)/discrete_current_context->sample_rate)),2.0*M_PI);
12971297}
12981298
1299void dss_squarewave_reset(node_description *node)
1299static void dss_squarewave_reset(node_description *node)
13001300{
13011301   struct dss_squarewave_context *context = node->context;
13021302   double start;
r1877r1878
13291329#define DSS_SQUAREWFIX__BIAS   (*(node->input[4]))
13301330#define DSS_SQUAREWFIX__PHASE   (*(node->input[5]))
13311331
1332void dss_squarewfix_step(node_description *node)
1332static void dss_squarewfix_step(node_description *node)
13331333{
13341334   struct dss_squarewfix_context *context = node->context;
13351335
r1877r1878
13581358   }
13591359}
13601360
1361void dss_squarewfix_reset(node_description *node)
1361static void dss_squarewfix_reset(node_description *node)
13621362{
13631363   struct dss_squarewfix_context *context = node->context;
13641364
r1877r1878
14071407#define DSS_SQUAREWAVE2__BIAS   (*(node->input[4]))
14081408#define DSS_SQUAREWAVE2__SHIFT   (*(node->input[5]))
14091409
1410void dss_squarewave2_step(node_description *node)
1410static void dss_squarewave2_step(node_description *node)
14111411{
14121412   struct dss_squarewave_context *context = node->context;
14131413   double newphase;
r1877r1878
14421442   }
14431443}
14441444
1445void dss_squarewave2_reset(node_description *node)
1445static void dss_squarewave2_reset(node_description *node)
14461446{
14471447   struct dss_squarewave_context *context = node->context;
14481448   double start;
r1877r1878
14901490      return info->vB;
14911491}
14921492
1493void dss_inverter_osc_step(node_description *node)
1493static void dss_inverter_osc_step(node_description *node)
14941494{
14951495   struct dss_inverter_osc_context *context = node->context;
14961496   const discrete_inverter_osc_desc *info = node->custom;
r1877r1878
15961596      node->output = (node->output > info->vInFall);
15971597}
15981598
1599void dss_inverter_osc_reset(node_description *node)
1599static void dss_inverter_osc_reset(node_description *node)
16001600{
16011601   struct dss_inverter_osc_context *context = node->context;
16021602   const discrete_inverter_osc_desc *info = node->custom;
r1877r1878
16331633#define DSS_TRIANGLEWAVE__BIAS      (*(node->input[3]))
16341634#define DSS_TRIANGLEWAVE__PHASE      (*(node->input[4]))
16351635
1636void dss_trianglewave_step(node_description *node)
1636static void dss_trianglewave_step(node_description *node)
16371637{
16381638   struct dss_trianglewave_context *context = node->context;
16391639
r1877r1878
16601660   context->phase=fmod((context->phase+((2.0*M_PI*DSS_TRIANGLEWAVE__FREQ)/discrete_current_context->sample_rate)),2.0*M_PI);
16611661}
16621662
1663void dss_trianglewave_reset(node_description *node)
1663static void dss_trianglewave_reset(node_description *node)
16641664{
16651665   struct dss_trianglewave_context *context = node->context;
16661666   double start;
r1877r1878
16861686 ************************************************************************/
16871687#define DSS_ADSR__ENABLE   (*(node->input[0]))
16881688
1689void dss_adsrenv_step(node_description *node)
1689static void dss_adsrenv_step(node_description *node)
16901690{
16911691//  struct dss_adsr_context *context = node->context;
16921692
r1877r1878
17011701}
17021702
17031703
1704void dss_adsrenv_reset(node_description *node)
1704static void dss_adsrenv_reset(node_description *node)
17051705{
17061706   dss_adsrenv_step(node);
17071707}
src/emu/sound/2151intf.c
r1877r1878
135135WRITE8_HANDLER( YM2151_word_0_w )
136136{
137137   if (offset)
138      YM2151_data_port_0_w(0,data);
138      YM2151_data_port_0_w(machine,0,data);
139139   else
140      YM2151_register_port_0_w(0,data);
140      YM2151_register_port_0_w(machine,0,data);
141141}
142142
143143WRITE8_HANDLER( YM2151_word_1_w )
144144{
145145   if (offset)
146      YM2151_data_port_1_w(0,data);
146      YM2151_data_port_1_w(machine,0,data);
147147   else
148      YM2151_register_port_1_w(0,data);
148      YM2151_register_port_1_w(machine,0,data);
149149}
150150
151151READ16_HANDLER( YM2151_status_port_0_lsb_r )
152152{
153   return YM2151_status_port_0_r(0);
153   return YM2151_status_port_0_r(machine,0);
154154}
155155
156156READ16_HANDLER( YM2151_status_port_1_lsb_r )
157157{
158   return YM2151_status_port_1_r(0);
158   return YM2151_status_port_1_r(machine,0);
159159}
160160
161161READ16_HANDLER( YM2151_status_port_2_lsb_r )
162162{
163   return YM2151_status_port_2_r(0);
163   return YM2151_status_port_2_r(machine,0);
164164}
165165
166166
167167WRITE16_HANDLER( YM2151_register_port_0_lsb_w )
168168{
169169   if (ACCESSING_LSB)
170      YM2151_register_port_0_w(0, data & 0xff);
170      YM2151_register_port_0_w(machine, 0, data & 0xff);
171171}
172172
173173WRITE16_HANDLER( YM2151_register_port_1_lsb_w )
174174{
175175   if (ACCESSING_LSB)
176      YM2151_register_port_1_w(0, data & 0xff);
176      YM2151_register_port_1_w(machine, 0, data & 0xff);
177177}
178178
179179WRITE16_HANDLER( YM2151_register_port_2_lsb_w )
180180{
181181   if (ACCESSING_LSB)
182      YM2151_register_port_2_w(0, data & 0xff);
182      YM2151_register_port_2_w(machine, 0, data & 0xff);
183183}
184184
185185WRITE16_HANDLER( YM2151_data_port_0_lsb_w )
186186{
187187   if (ACCESSING_LSB)
188      YM2151_data_port_0_w(0, data & 0xff);
188      YM2151_data_port_0_w(machine, 0, data & 0xff);
189189}
190190
191191WRITE16_HANDLER( YM2151_data_port_1_lsb_w )
192192{
193193   if (ACCESSING_LSB)
194      YM2151_data_port_1_w(0, data & 0xff);
194      YM2151_data_port_1_w(machine, 0, data & 0xff);
195195}
196196
197197WRITE16_HANDLER( YM2151_data_port_2_lsb_w )
198198{
199199   if (ACCESSING_LSB)
200      YM2151_data_port_2_w(0, data & 0xff);
200      YM2151_data_port_2_w(machine, 0, data & 0xff);
201201}
202202
203203
src/emu/sound/k053260.c
r1877r1878
429429WRITE16_HANDLER( K053260_0_lsb_w )
430430{
431431   if (ACCESSING_LSB)
432      K053260_0_w (offset, data & 0xff);
432      K053260_0_w (machine, offset, data & 0xff);
433433}
434434
435435READ16_HANDLER( K053260_0_lsb_r )
436436{
437   return K053260_0_r(offset);
437   return K053260_0_r(machine, offset);
438438}
439439
440440WRITE16_HANDLER( K053260_1_lsb_w )
441441{
442442   if (ACCESSING_LSB)
443      K053260_1_w (offset, data & 0xff);
443      K053260_1_w (machine, offset, data & 0xff);
444444}
445445
446446READ16_HANDLER( K053260_1_lsb_r )
447447{
448   return K053260_1_r(offset);
448   return K053260_1_r(machine, offset);
449449}
450450
451451
src/emu/sound/2413intf.c
r1877r1878
139139WRITE8_HANDLER( YM2413_data_port_2_w ) { struct ym2413_info *info = sndti_token(SOUND_YM2413, 2); YM2413Write (info->chip, 1, data); } /* 3rd chip */
140140WRITE8_HANDLER( YM2413_data_port_3_w ) { struct ym2413_info *info = sndti_token(SOUND_YM2413, 3); YM2413Write (info->chip, 1, data); } /* 4th chip */
141141
142WRITE16_HANDLER( YM2413_register_port_0_lsb_w ) { if (ACCESSING_LSB) YM2413_register_port_0_w(offset,data & 0xff); }
143WRITE16_HANDLER( YM2413_register_port_0_msb_w ) { if (ACCESSING_MSB) YM2413_register_port_0_w(offset,((data & 0xff00) >> 8)); }
144WRITE16_HANDLER( YM2413_register_port_1_lsb_w ) { if (ACCESSING_LSB) YM2413_register_port_1_w(offset,data & 0xff); }
145WRITE16_HANDLER( YM2413_register_port_2_lsb_w ) { if (ACCESSING_LSB) YM2413_register_port_2_w(offset,data & 0xff); }
146WRITE16_HANDLER( YM2413_register_port_3_lsb_w ) { if (ACCESSING_LSB) YM2413_register_port_3_w(offset,data & 0xff); }
147WRITE16_HANDLER( YM2413_data_port_0_lsb_w ) { if (ACCESSING_LSB) YM2413_data_port_0_w(offset,data & 0xff); }
148WRITE16_HANDLER( YM2413_data_port_0_msb_w ) { if (ACCESSING_MSB) YM2413_data_port_0_w(offset,((data & 0xff00) >> 8)); }
149WRITE16_HANDLER( YM2413_data_port_1_lsb_w ) { if (ACCESSING_LSB) YM2413_data_port_1_w(offset,data & 0xff); }
150WRITE16_HANDLER( YM2413_data_port_2_lsb_w ) { if (ACCESSING_LSB) YM2413_data_port_2_w(offset,data & 0xff); }
151WRITE16_HANDLER( YM2413_data_port_3_lsb_w ) { if (ACCESSING_LSB) YM2413_data_port_3_w(offset,data & 0xff); }
142WRITE16_HANDLER( YM2413_register_port_0_lsb_w ) { if (ACCESSING_LSB) YM2413_register_port_0_w(machine,offset,data & 0xff); }
143WRITE16_HANDLER( YM2413_register_port_0_msb_w ) { if (ACCESSING_MSB) YM2413_register_port_0_w(machine,offset,((data & 0xff00) >> 8)); }
144WRITE16_HANDLER( YM2413_register_port_1_lsb_w ) { if (ACCESSING_LSB) YM2413_register_port_1_w(machine,offset,data & 0xff); }
145WRITE16_HANDLER( YM2413_register_port_2_lsb_w ) { if (ACCESSING_LSB) YM2413_register_port_2_w(machine,offset,data & 0xff); }
146WRITE16_HANDLER( YM2413_register_port_3_lsb_w ) { if (ACCESSING_LSB) YM2413_register_port_3_w(machine,offset,data & 0xff); }
147WRITE16_HANDLER( YM2413_data_port_0_lsb_w ) { if (ACCESSING_LSB) YM2413_data_port_0_w(machine,offset,data & 0xff); }
148WRITE16_HANDLER( YM2413_data_port_0_msb_w ) { if (ACCESSING_MSB) YM2413_data_port_0_w(machine,offset,((data & 0xff00) >> 8)); }
149WRITE16_HANDLER( YM2413_data_port_1_lsb_w ) { if (ACCESSING_LSB) YM2413_data_port_1_w(machine,offset,data & 0xff); }
150WRITE16_HANDLER( YM2413_data_port_2_lsb_w ) { if (ACCESSING_LSB) YM2413_data_port_2_w(machine,offset,data & 0xff); }
151WRITE16_HANDLER( YM2413_data_port_3_lsb_w ) { if (ACCESSING_LSB) YM2413_data_port_3_w(machine,offset,data & 0xff); }
152152
153153
154154/**************************************************************************
src/emu/sound/2151intf.h
r1877r1878
44struct YM2151interface
55{
66   void (*irqhandler)(int irq);
7   write8_handler portwritehandler;
7   write8_machine_func portwritehandler;
88};
99
1010READ8_HANDLER( YM2151_status_port_0_r );
src/emu/sound/k053260.h
r1877r1878
88
99struct K053260_interface {
1010   int region;               /* memory region of sample ROM(s) */
11   timer_callback irq;         /* called on SH1 complete cycle ( clock / 32 ) */
11   timer_fired_func irq;         /* called on SH1 complete cycle ( clock / 32 ) */
1212};
1313
1414
src/emu/sound/disc_flt.c
r1877r1878
109109#define DST_CRFILTER__C         (*(node->input[3]))
110110#define DST_CRFILTER__VREF      (*(node->input[4]))
111111
112void dst_crfilter_step(node_description *node)
112static void dst_crfilter_step(node_description *node)
113113{
114114   struct dst_rcfilter_context *context = node->context;
115115
r1877r1878
124124   }
125125}
126126
127void dst_crfilter_reset(node_description *node)
127static void dst_crfilter_reset(node_description *node)
128128{
129129   struct dst_rcfilter_context *context = node->context;
130130
r1877r1878
177177   }
178178}
179179
180void dst_filter1_step(node_description *node)
180static void dst_filter1_step(node_description *node)
181181{
182182   struct dss_filter1_context *context = node->context;
183183   double gain = 1.0;
r1877r1878
193193   context->y1 = node->output;
194194}
195195
196void dst_filter1_reset(node_description *node)
196static void dst_filter1_reset(node_description *node)
197197{
198198   struct dss_filter1_context *context = node->context;
199199
r1877r1878
261261   }
262262}
263263
264void dst_filter2_step(node_description *node)
264static void dst_filter2_step(node_description *node)
265265{
266266   struct dss_filter2_context *context = node->context;
267267   double gain = 1.0;
r1877r1878
280280   context->y1 = node->output;
281281}
282282
283void dst_filter2_reset(node_description *node)
283static void dst_filter2_reset(node_description *node)
284284{
285285   struct dss_filter2_context *context = node->context;
286286
r1877r1878
309309#define DST_OP_AMP_FILT__INP2   (*(node->input[2]))
310310#define DST_OP_AMP_FILT__TYPE   (*(node->input[3]))
311311
312void dst_op_amp_filt_step(node_description *node)
312static void dst_op_amp_filt_step(node_description *node)
313313{
314314   const discrete_op_amp_filt_info *info = node->custom;
315315   struct dst_op_amp_filt_context *context = node->context;
r1877r1878
392392
393393}
394394
395void dst_op_amp_filt_reset(node_description *node)
395static void dst_op_amp_filt_reset(node_description *node)
396396{
397397   const discrete_op_amp_filt_info *info = node->custom;
398398   struct dst_op_amp_filt_context *context = node->context;
r1877r1878
514514#define DST_RCDISC__R      (*(node->input[2]))
515515#define DST_RCDISC__C      (*(node->input[3]))
516516
517void dst_rcdisc_step(node_description *node)
517static void dst_rcdisc_step(node_description *node)
518518{
519519   struct dst_rcdisc_context *context = node->context;
520520
r1877r1878
537537      }
538538}
539539
540void dst_rcdisc_reset(node_description *node)
540static void dst_rcdisc_reset(node_description *node)
541541{
542542   struct dst_rcdisc_context *context = node->context;
543543
r1877r1878
569569#define DST_RCDISC2__R1      (*(node->input[4]))
570570#define DST_RCDISC2__C      (*(node->input[5]))
571571
572void dst_rcdisc2_step(node_description *node)
572static void dst_rcdisc2_step(node_description *node)
573573{
574574   double diff;
575575   struct dst_rcdisc_context *context = node->context;
r1877r1878
582582   node->output += diff;
583583}
584584
585void dst_rcdisc2_reset(node_description *node)
585static void dst_rcdisc2_reset(node_description *node)
586586{
587587   struct dst_rcdisc_context *context = node->context;
588588
r1877r1878
612612#define DST_RCDISC3__R2      (*(node->input[3]))
613613#define DST_RCDISC3__C      (*(node->input[4]))
614614
615void dst_rcdisc3_step(node_description *node)
615static void dst_rcdisc3_step(node_description *node)
616616{
617617   double diff;
618618   struct dst_rcdisc_context *context = node->context;
r1877r1878
640640   }
641641}
642642
643void dst_rcdisc3_reset(node_description *node)
643static void dst_rcdisc3_reset(node_description *node)
644644{
645645   struct dst_rcdisc_context *context = node->context;
646646
r1877r1878
675675#define DST_RCDISC4__VP      (*(node->input[6]))
676676#define DST_RCDISC4__TYPE   (*(node->input[7]))
677677
678void dst_rcdisc4_step(node_description *node)
678static void dst_rcdisc4_step(node_description *node)
679679{
680680   struct dst_rcdisc4_context *context = node->context;
681681   int inp1 = (DST_RCDISC4__IN == 0) ? 0 : 1;
r1877r1878
700700   if (node->output < 0) node->output = 0;
701701}
702702
703void dst_rcdisc4_reset(node_description *node)
703static void dst_rcdisc4_reset(node_description *node)
704704{
705705   struct dst_rcdisc4_context *context = node->context;
706706   double   v, i, r, rT;
r1877r1878
789789#define DST_RCDISC5__R      (*(node->input[2]))
790790#define DST_RCDISC5__C      (*(node->input[3]))
791791
792void dst_rcdisc5_step(node_description *node)
792static void dst_rcdisc5_step(node_description *node)
793793{
794794   double diff,u;
795795   struct dst_rcdisc_context *context = node->context;
r1877r1878
815815   }
816816}
817817
818void dst_rcdisc5_reset(node_description *node)
818static void dst_rcdisc5_reset(node_description *node)
819819{
820820   struct dst_rcdisc_context *context = node->context;
821821
r1877r1878
864864#define KT      0.026
865865#define EM_IC(x) (ALPHAT * IES * exp( (x) / KT - 1.0 ))
866866
867void dst_rcintegrate_step(node_description *node)
867static void dst_rcintegrate_step(node_description *node)
868868{
869869   double diff,u,iQ,iQc,iC,RG,vE;
870870   struct dst_rcdisc_context *context = node->context;
r1877r1878
932932   }
933933}
934934
935void dst_rcintegrate_reset(node_description *node)
935static void dst_rcintegrate_reset(node_description *node)
936936{
937937   struct dst_rcdisc_context *context = node->context;
938938   double r;
r1877r1878
981981#define DST_RCDISC_MOD__C      (*(node->input[7]))
982982#define DST_RCDISC_MOD__VP      (*(node->input[8]))
983983
984void dst_rcdisc_mod_step(node_description *node)
984static void dst_rcdisc_mod_step(node_description *node)
985985{
986986   double diff,Rc,Rc2,vCap,u,vD=0.0;
987987   struct dst_rcdisc_context *context = node->context;
r1877r1878
10221022   }
10231023}
10241024
1025void dst_rcdisc_mod_reset(node_description *node)
1025static void dst_rcdisc_mod_reset(node_description *node)
10261026{
10271027   struct dst_rcdisc_context *context = node->context;
10281028
r1877r1878
10471047#define DST_RCFILTER__C         (*(node->input[3]))
10481048#define DST_RCFILTER__VREF      (*(node->input[4]))
10491049
1050void dst_rcfilter_step(node_description *node)
1050static void dst_rcfilter_step(node_description *node)
10511051{
10521052   struct dst_rcfilter_context *context = node->context;
10531053
r1877r1878
10661066   }
10671067}
10681068
1069void dst_rcfilter_reset(node_description *node)
1069static void dst_rcfilter_reset(node_description *node)
10701070{
10711071   struct dst_rcfilter_context *context = node->context;
10721072
r1877r1878
10951095#define DST_RCFILTERN__R      (*(node->input[2]))
10961096#define DST_RCFILTERN__C      (*(node->input[3]))
10971097
1098void dst_rcfilterN_reset(node_description *node)
1098static void dst_rcfilterN_reset(node_description *node)
10991099{
11001100//  double f=1.0/(2*M_PI* DST_RCFILTERN__R * DST_RCFILTERN__C);
11011101
r1877r1878
11261126#define DST_RCDISCN__R      (*(node->input[2]))
11271127#define DST_RCDISCN__C      (*(node->input[3]))
11281128
1129void dst_rcdiscN_reset(node_description *node)
1129static void dst_rcdiscN_reset(node_description *node)
11301130{
11311131//  double f=1.0/(2*M_PI* DST_RCDISCN__R * DST_RCDISCN__C);
11321132
r1877r1878
11401140   dst_filter1_reset(node);
11411141}
11421142
1143void dst_rcdiscN_step(node_description *node)
1143static void dst_rcdiscN_step(node_description *node)
11441144{
11451145   struct dss_filter1_context *context = node->context;
11461146   double gain = 1.0;
r1877r1878
11901190   double a1_1, b0_1, b1_1;   /* digital filter coefficients, filter #2 */
11911191};
11921192
1193void dst_rcdisc2N_step(node_description *node)
1193static void dst_rcdisc2N_step(node_description *node)
11941194{
11951195   struct dss_rcdisc2_context *context = node->context;
11961196   double input = ((DST_RCDISC2N__ENABLE == 0) ? DST_RCDISC2N__IN0 : DST_RCDISC2N__IN1);
r1877r1878
12041204   context->y1 = node->output;
12051205}
12061206
1207void dst_rcdisc2N_reset(node_description *node)
1207static void dst_rcdisc2N_reset(node_description *node)
12081208{
12091209   struct dss_rcdisc2_context *context = node->context;
12101210   double f1,f2;
src/emu/sound/namco.c
r1877r1878
771771      }
772772   }
773773   else if (offset < 0x140)
774      namcos1_sound_w(offset - 0x100,data);
774      namcos1_sound_w(machine, offset - 0x100,data);
775775   else
776776      namco_wavedata[offset] = data;
777777}
src/emu/sound/aicalfo.c
r1877r1878
3434static int PSCALES[8][256];
3535static int ASCALES[8][256];
3636
37void AICALFO_Init(void)
37static void AICALFO_Init(void)
3838{
3939    int i,s;
4040    for(i=0;i<256;++i)
r1877r1878
103103   }
104104}
105105
106signed int INLINE AICAPLFO_Step(struct _LFO *LFO)
106INLINE signed int AICAPLFO_Step(struct _LFO *LFO)
107107{
108108   int p;
109109
r1877r1878
116116   return p<<(SHIFT-LFO_SHIFT);
117117}
118118
119signed int INLINE AICAALFO_Step(struct _LFO *LFO)
119INLINE signed int AICAALFO_Step(struct _LFO *LFO)
120120{
121121   int p;
122122    LFO->phase+=LFO->phase_step;
r1877r1878
128128   return p<<(SHIFT-LFO_SHIFT);
129129}
130130
131void AICALFO_ComputeStep(struct _LFO *LFO,UINT32 LFOF,UINT32 LFOWS,UINT32 LFOS,int ALFO)
131static void AICALFO_ComputeStep(struct _LFO *LFO,UINT32 LFOF,UINT32 LFOWS,UINT32 LFOS,int ALFO)
132132{
133133    float step=(float) LFOFreq[LFOF]*256.0/(float)44100.0;
134134    LFO->phase_step=(unsigned int) ((float) (1<<LFO_SHIFT)*step);
src/emu/sound/2203intf.c
r1877r1878
296296WRITE8_HANDLER( YM2203_word_0_w )
297297{
298298   if (offset)
299      YM2203_write_port_0_w(0,data);
299      YM2203_write_port_0_w(machine,0,data);
300300   else
301      YM2203_control_port_0_w(0,data);
301      YM2203_control_port_0_w(machine,0,data);
302302}
303303
304304WRITE8_HANDLER( YM2203_word_1_w )
305305{
306306   if (offset)
307      YM2203_write_port_1_w(0,data);
307      YM2203_write_port_1_w(machine,0,data);
308308   else
309      YM2203_control_port_1_w(0,data);
309      YM2203_control_port_1_w(machine,0,data);
310310}
311311
312312
src/emu/sound/2203intf.h
r1877r1878
55
66struct YM2203interface
77{
8   read8_handler portAread;
9   read8_handler portBread;
10   write8_handler portAwrite;
11   write8_handler portBwrite;
8   read8_machine_func portAread;
9   read8_machine_func portBread;
10   write8_machine_func portAwrite;
11   write8_machine_func portBwrite;
1212   void (*handler)(int irq);
1313};
1414
src/emu/sound/es5503.c
r1877r1878
3535
3636#include <math.h>
3737#include "sndintrf.h"
38#include "deprecat.h"
3839#include "cpuintrf.h"
3940#include "es5503.h"
4041#include "streams.h"
r1877r1878
6970
7071   void (*irq_callback)(int);   // IRQ callback
7172
72   read8_handler adc_read;      // callback for the 5503's built-in analog to digital converter
73   read8_machine_func adc_read;      // callback for the 5503's built-in analog to digital converter
7374
7475   INT8  oscsenabled;      // # of oscillators enabled
7576
r1877r1878
376377         case 0xe2:   // A/D converter
377378            if (chip->adc_read)
378379            {
379               return chip->adc_read(0);
380               return chip->adc_read(Machine, 0);
380381            }
381382            break;
382383      }
src/emu/sound/es5503.h
r1877r1878
44struct ES5503interface
55{
66   void (*irq_callback)(int state);
7   read8_handler adc_read;
7   read8_machine_func adc_read;
88   UINT8 *wave_memory;
99};
1010
src/emu/ui.c
r1877r1878
11311131            bufptr += sprintf(bufptr, "Vector\n");
11321132         else
11331133            bufptr += sprintf(bufptr, "%d " UTF8_MULTIPLY " %d (%s) %f" UTF8_NBSP "Hz\n",
1134                  scrconfig->defstate.visarea.max_x - scrconfig->defstate.visarea.min_x + 1,
1135                  scrconfig->defstate.visarea.max_y - scrconfig->defstate.visarea.min_y + 1,
1134                  Machine->screen[index].visarea.max_x - Machine->screen[index].visarea.min_x + 1,
1135                  Machine->screen[index].visarea.max_y - Machine->screen[index].visarea.min_y + 1,
11361136                  (Machine->gamedrv->flags & ORIENTATION_SWAP_XY) ? "V" : "H",
1137                  ATTOSECONDS_TO_HZ(scrconfig->defstate.refresh));
1137                  ATTOSECONDS_TO_HZ(Machine->screen[index].refresh));
11381138      }
11391139   }
11401140
src/emu/sound.c
r1877r1878
785785    for a speaker
786786-------------------------------------------------*/
787787
788static void *speaker_output_start(running_machine *machine, const char *tag, const void *static_config, const void *inline_config)
788static DEVICE_START( speaker_output )
789789{
790790   speaker_info *info;
791791
r1877r1878
805805    for a speaker
806806-------------------------------------------------*/
807807
808static void speaker_output_stop(running_machine *machine, void *token)
808static DEVICE_STOP( speaker_output )
809809{
810810#ifdef MAME_DEBUG
811811   speaker_info *info = token;
r1877r1878
822822    callback
823823-------------------------------------------------*/
824824
825static void speaker_output_set_info(running_machine *machine, void *token, UINT32 state, const deviceinfo *info)
825static DEVICE_SET_INFO( speaker_output )
826826{
827827   switch (state)
828828   {
r1877r1878
836836    callback
837837-------------------------------------------------*/
838838
839void speaker_output_get_info(running_machine *machine, void *token, UINT32 state, deviceinfo *info)
839DEVICE_GET_INFO( speaker_output )
840840{
841841   switch (state)
842842   {
843843      /* --- the following bits of info are returned as 64-bit signed integers --- */
844844      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = sizeof(speaker_config);      break;
845      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_AUDIO;         break;
845846
846847      /* --- the following bits of info are returned as pointers to data or functions --- */
847      case DEVINFO_FCT_SET_INFO:                  info->set_info = speaker_output_set_info;break;
848      case DEVINFO_FCT_START:                     info->start = speaker_output_start;      break;
849      case DEVINFO_FCT_STOP:                     info->stop = speaker_output_stop;      break;
848      case DEVINFO_FCT_SET_INFO:                  info->set_info = DEVICE_SET_INFO_NAME(speaker_output); break;
849      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(speaker_output); break;
850      case DEVINFO_FCT_STOP:                     info->stop = DEVICE_STOP_NAME(speaker_output); break;
850851      case DEVINFO_FCT_RESET:                     /* Nothing */                     break;
851852
852853      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/sound.h
r1877r1878
101101/* ----- sound speaker device interface ----- */
102102
103103/* device get info callback */
104#define SPEAKER_OUTPUT speaker_output_get_info
105void speaker_output_get_info(running_machine *machine, void *token, UINT32 state, deviceinfo *info);
104#define SPEAKER_OUTPUT DEVICE_GET_INFO_NAME(speaker_output)
105DEVICE_GET_INFO( speaker_output );
106106
107107
108108#endif   /* __SOUND_H__ */
src/emu/input.c
r1877r1878
6161   void *               internal;            /* internal callback pointer */
6262   input_item_class      itemclass;            /* class of the item */
6363   input_item_id         itemid;               /* originally specified item id */
64   item_get_state_cb      getstate;            /* get state callback */
64   item_get_state_func      getstate;            /* get state callback */
6565   INT32               current;            /* current raw value */
6666   INT32               memory;               /* "memory" value, to remember where we started during polling */
6767   INT32               oncelatch;            /* latched "once" value, cleared after each read  */
r1877r1878
689689    input device
690690-------------------------------------------------*/
691691
692void input_device_item_add(input_device *device, const char *name, void *internal, input_item_id itemid, item_get_state_cb getstate)
692void input_device_item_add(input_device *device, const char *name, void *internal, input_item_id itemid, item_get_state_func getstate)
693693{
694694   input_device_item *item;
695695
src/emu/driver.h
r1877r1878
5454#define VIDEO_EOF(name)            void video_eof_##name(running_machine *machine)
5555#define VIDEO_EOF_CALL(name)      video_eof_##name(machine)
5656
57#define VIDEO_UPDATE(name)         UINT32 video_update_##name(running_machine *machine, int screen, mame_bitmap *bitmap, const rectangle *cliprect)
57#define VIDEO_UPDATE(name)         UINT32 video_update_##name(running_machine *machine, int screen, bitmap_t *bitmap, const rectangle *cliprect)
5858#define VIDEO_UPDATE_CALL(name)      video_update_##name(machine, screen, bitmap, cliprect)
5959
6060
r1877r1878
8383typedef void (*video_reset_func)(running_machine *machine);
8484typedef void (*palette_init_func)(running_machine *machine, const UINT8 *color_prom);
8585typedef void (*video_eof_func)(running_machine *machine);
86typedef UINT32 (*video_update_func)(running_machine *machine, int screen, mame_bitmap *bitmap, const rectangle *cliprect);
86typedef UINT32 (*video_update_func)(running_machine *machine, int screen, bitmap_t *bitmap, const rectangle *cliprect);
8787
8888
8989
r1877r1878
9393
9494#include "cpuintrf.h"
9595#include "sndintrf.h"
96#include "devintrf.h"
9697#include "fileio.h"
9798#include "drawgfx.h"
9899#include "emupal.h"
src/emu/drawgfx.c
r1877r1878
358358    BLOCKMOVE PRIMITIVES
359359***************************************************************************/
360360
361#ifdef UNUSED_FUNCTION
361362INLINE void blockmove_NtoN_transpen_noremap8(
362363      const UINT8 *srcdata,int srcwidth,int srcheight,int srcmodulo,
363364      UINT8 *dstdata,int dstmodulo,
r1877r1878
423424      srcheight--;
424425   }
425426}
427#endif
426428
429#ifdef UNUSED_FUNCTION
427430INLINE void blockmove_NtoN_transpen_noremap_flipx8(
428431      const UINT8 *srcdata,int srcwidth,int srcheight,int srcmodulo,
429432      UINT8 *dstdata,int dstmodulo,
r1877r1878
484487      srcheight--;
485488   }
486489}
490#endif
487491
488
489492INLINE void blockmove_NtoN_transpen_noremap16(
490493      const UINT16 *srcdata,int srcwidth,int srcheight,int srcmodulo,
491494      UINT16 *dstdata,int dstmodulo,
r1877r1878
842845
843846***************************************************************************/
844847
845INLINE void common_drawgfx(mame_bitmap *dest,const gfx_element *gfx,
848INLINE void common_drawgfx(bitmap_t *dest,const gfx_element *gfx,
846849      unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy,
847850      const rectangle *clip,int transparency,int transparent_color,
848      mame_bitmap *pri_buffer,UINT32 pri_mask)
851      bitmap_t *pri_buffer,UINT32 pri_mask)
849852{
850853   assert(dest != NULL);
851854   assert((dest->bpp == 16) || (dest->bpp == 32));
r1877r1878
890893      drawgfx_core32(dest,gfx,code,color,flipx,flipy,sx,sy,clip,transparency,transparent_color,pri_buffer,pri_mask);
891894}
892895
893void drawgfx(mame_bitmap *dest,const gfx_element *gfx,
896void drawgfx(bitmap_t *dest,const gfx_element *gfx,
894897      unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy,
895898      const rectangle *clip,int transparency,int transparent_color)
896899{
r1877r1878
899902   profiler_mark(PROFILER_END);
900903}
901904
902void pdrawgfx(mame_bitmap *dest,const gfx_element *gfx,
905void pdrawgfx(bitmap_t *dest,const gfx_element *gfx,
903906      unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy,
904907      const rectangle *clip,int transparency,int transparent_color,UINT32 priority_mask)
905908{
r1877r1878
908911   profiler_mark(PROFILER_END);
909912}
910913
911void mdrawgfx(mame_bitmap *dest,const gfx_element *gfx,
914void mdrawgfx(bitmap_t *dest,const gfx_element *gfx,
912915      unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy,
913916      const rectangle *clip,int transparency,int transparent_color,UINT32 priority_mask)
914917{
r1877r1878
923926  Use copybitmap() to copy a bitmap onto another at the given position.
924927
925928***************************************************************************/
926static void copybitmap_common(mame_bitmap *dest,mame_bitmap *src,int flipx,int flipy,int sx,int sy,
929static void copybitmap_common(bitmap_t *dest,bitmap_t *src,int flipx,int flipy,int sx,int sy,
927930      const rectangle *clip,int transparency,int transparent_color)
928931{
929932   assert(dest != NULL);
r1877r1878
941944   profiler_mark(PROFILER_END);
942945}
943946
944void copybitmap(mame_bitmap *dest, mame_bitmap *src, int flipx, int flipy,
947void copybitmap(bitmap_t *dest, bitmap_t *src, int flipx, int flipy,
945948            int sx, int sy, const rectangle *clip)
946949{
947950   copybitmap_common(dest,src,flipx,flipy,sx,sy,clip,TRANSPARENCY_NONE,0);
948951}
949952
950void copybitmap_trans(mame_bitmap *dest, mame_bitmap *src, int flipx, int flipy,
953void copybitmap_trans(bitmap_t *dest, bitmap_t *src, int flipx, int flipy,
951954                 int sx, int sy, const rectangle *clip, pen_t transparent_pen)
952955{
953956   copybitmap_common(dest,src,flipx,flipy,sx,sy,clip,TRANSPARENCY_PEN,transparent_pen);
r1877r1878
968971  scrolls as a whole in at least one direction.
969972
970973***************************************************************************/
971static void copyscrollbitmap_common(mame_bitmap *dest,mame_bitmap *src,
974static void copyscrollbitmap_common(bitmap_t *dest,bitmap_t *src,
972975      int rows,const int *rowscroll,int cols,const int *colscroll,
973976      const rectangle *clip,int transparency,int transparent_color)
974977{
r1877r1878
12061209}
12071210
12081211
1209void copyscrollbitmap(mame_bitmap *dest, mame_bitmap *src,
1212void copyscrollbitmap(bitmap_t *dest, bitmap_t *src,
12101213                 int rows, const int *rowscroll, int cols, const int *colscroll,
12111214                 const rectangle *clip)
12121215{
12131216   copyscrollbitmap_common(dest,src,rows,rowscroll,cols,colscroll,clip,TRANSPARENCY_NONE,0);
12141217}
12151218
1216void copyscrollbitmap_trans(mame_bitmap *dest, mame_bitmap *src,
1219void copyscrollbitmap_trans(bitmap_t *dest, bitmap_t *src,
12171220                      int rows, const int *rowscroll, int cols, const int *colscroll,
12181221                      const rectangle *clip, pen_t transparent_pen)
12191222{
r1877r1878
12251228   - startx and starty MUST be UINT32 for calculations to work correctly
12261229   - srcbitmap->width and height are assumed to be a power of 2 to speed up wraparound
12271230   */
1228void copyrozbitmap(mame_bitmap *dest,mame_bitmap *src,
1231void copyrozbitmap(bitmap_t *dest,bitmap_t *src,
12291232      UINT32 startx,UINT32 starty,int incxx,int incxy,int incyx,int incyy,int wraparound,
12301233      const rectangle *clip,int transparency,int transparent_color,UINT32 priority)
12311234{
r1877r1878
12591262
12601263
12611264
1262INLINE void common_drawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
1265INLINE void common_drawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx,
12631266      unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy,
12641267      const rectangle *clip,int transparency,int transparent_color,
1265      int scalex, int scaley,mame_bitmap *pri_buffer,UINT32 pri_mask)
1268      int scalex, int scaley,bitmap_t *pri_buffer,UINT32 pri_mask)
12661269{
12671270   /* verify arguments */
12681271   assert(dest_bmp != NULL);
r1877r1878
22882291   }
22892292}
22902293
2291void drawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
2294void drawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx,
22922295      unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy,
22932296      const rectangle *clip,int transparency,int transparent_color,int scalex, int scaley)
22942297{
r1877r1878
22982301   profiler_mark(PROFILER_END);
22992302}
23002303
2301void pdrawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
2304void pdrawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx,
23022305      unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy,
23032306      const rectangle *clip,int transparency,int transparent_color,int scalex, int scaley,
23042307      UINT32 priority_mask)
r1877r1878
23092312   profiler_mark(PROFILER_END);
23102313}
23112314
2312void mdrawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
2315void mdrawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx,
23132316      unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy,
23142317      const rectangle *clip,int transparency,int transparent_color,int scalex, int scaley,
23152318      UINT32 priority_mask)
r1877r1878
32383241
32393242
32403243DECLARE(drawgfx_core,(
3241      mame_bitmap *dest,const gfx_element *gfx,
3244      bitmap_t *dest,const gfx_element *gfx,
32423245      unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy,
32433246      const rectangle *clip,int transparency,int transparent_color,
3244      mame_bitmap *pri_buffer,UINT32 pri_mask),
3247      bitmap_t *pri_buffer,UINT32 pri_mask),
32453248{
32463249   int ox;
32473250   int oy;
r1877r1878
33723375})
33733376
33743377DECLARE(copybitmap_core,(
3375      mame_bitmap *dest,mame_bitmap *src,
3378      bitmap_t *dest,bitmap_t *src,
33763379      int flipx,int flipy,int sx,int sy,
33773380      const rectangle *clip,int transparency,int transparent_color),
33783381{
r1877r1878
34373440   }
34383441})
34393442
3440DECLARE(copyrozbitmap_core,(mame_bitmap *bitmap,mame_bitmap *srcbitmap,
3443DECLARE(copyrozbitmap_core,(bitmap_t *bitmap,bitmap_t *srcbitmap,
34413444      UINT32 startx,UINT32 starty,int incxx,int incxy,int incyx,int incyy,int wraparound,
34423445      const rectangle *clip,int transparency,int transparent_color,UINT32 priority),
34433446{
r1877r1878
37193722#endif /* (DEPTH != 8) */
37203723
37213724DECLAREG(draw_scanline, (
3722      mame_bitmap *bitmap,int x,int y,int length,
3725      bitmap_t *bitmap,int x,int y,int length,
37233726      const DATA_TYPE *src,const pen_t *pens,int transparent_pen),
37243727{
37253728   assert(bitmap != NULL);
r1877r1878
38213824})
38223825
38233826DECLAREG(pdraw_scanline, (
3824      mame_bitmap *bitmap,int x,int y,int length,
3827      bitmap_t *bitmap,int x,int y,int length,
38253828      const DATA_TYPE *src,const pen_t *pens,int transparent_pen,int pri),
38263829{
38273830   assert(bitmap != NULL);
r1877r1878
39493952)
39503953
39513954DECLAREG(extract_scanline, (
3952      mame_bitmap *bitmap,int x,int y,int length,
3955      bitmap_t *bitmap,int x,int y,int length,
39533956      DATA_TYPE *dst),
39543957{
39553958   assert(bitmap != NULL);
src/emu/input.h
r1877r1878
473473typedef UINT32 input_code;
474474
475475/* callback for getting the value of an item on a device */
476typedef INT32 (*item_get_state_cb)(void *device_internal, void *item_internal);
476typedef INT32 (*item_get_state_func)(void *device_internal, void *item_internal);
477477
478478/* (opaque) input device object */
479479typedef struct _input_device input_device;
r1877r1878
517517input_device *input_device_add(input_device_class devclass, const char *name, void *internal);
518518
519519/* add a new item to an input device */
520void input_device_item_add(input_device *device, const char *name, void *internal, input_item_id itemid, item_get_state_cb getstate);
520void input_device_item_add(input_device *device, const char *name, void *internal, input_item_id itemid, item_get_state_func getstate);
521521
522522
523523
src/emu/drawgfx.h
r1877r1878
197197void freegfx(gfx_element *gfx);
198198
199199
200void drawgfx(mame_bitmap *dest,const gfx_element *gfx,
200void drawgfx(bitmap_t *dest,const gfx_element *gfx,
201201      unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy,
202202      const rectangle *clip,int transparency,int transparent_color);
203void pdrawgfx(mame_bitmap *dest,const gfx_element *gfx,
203void pdrawgfx(bitmap_t *dest,const gfx_element *gfx,
204204      unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy,
205205      const rectangle *clip,int transparency,int transparent_color,
206206      UINT32 priority_mask);
207void mdrawgfx(mame_bitmap *dest,const gfx_element *gfx,
207void mdrawgfx(bitmap_t *dest,const gfx_element *gfx,
208208      unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy,
209209      const rectangle *clip,int transparency,int transparent_color,
210210      UINT32 priority_mask);
211211
212212
213void drawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
213void drawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx,
214214      unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy,
215215      const rectangle *clip,int transparency,int transparent_color,int scalex,int scaley);
216void pdrawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
216void pdrawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx,
217217      unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy,
218218      const rectangle *clip,int transparency,int transparent_color,int scalex,int scaley,
219219      UINT32 priority_mask);
220void mdrawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
220void mdrawgfxzoom( bitmap_t *dest_bmp,const gfx_element *gfx,
221221      unsigned int code,unsigned int color,int flipx,int flipy,int sx,int sy,
222222      const rectangle *clip,int transparency,int transparent_color,int scalex,int scaley,
223223      UINT32 priority_mask);
224224
225225
226void draw_scanline8(mame_bitmap *bitmap,int x,int y,int length,const UINT8 *src,const pen_t *pens,int transparent_pen);
227void draw_scanline16(mame_bitmap *bitmap,int x,int y,int length,const UINT16 *src,const pen_t *pens,int transparent_pen);
228void draw_scanline32(mame_bitmap *bitmap,int x,int y,int length,const UINT32 *src,const pen_t *pens,int transparent_pen);
229void pdraw_scanline8(mame_bitmap *bitmap,int x,int y,int length,const UINT8 *src,const pen_t *pens,int transparent_pen,int pri);
230void pdraw_scanline16(mame_bitmap *bitmap,int x,int y,int length,const UINT16 *src,const pen_t *pens,int transparent_pen,int pri);
231void pdraw_scanline32(mame_bitmap *bitmap,int x,int y,int length,const UINT32 *src,const pen_t *pens,int transparent_pen,int pri);
232void extract_scanline8(mame_bitmap *bitmap,int x,int y,int length,UINT8 *dst);
233void extract_scanline16(mame_bitmap *bitmap,int x,int y,int length,UINT16 *dst);
234void extract_scanline32(mame_bitmap *bitmap,int x,int y,int length,UINT32 *dst);
226void draw_scanline8(bitmap_t *bitmap,int x,int y,int length,const UINT8 *src,const pen_t *pens,int transparent_pen);
227void draw_scanline16(bitmap_t *bitmap,int x,int y,int length,const UINT16 *src,const pen_t *pens,int transparent_pen);
228void draw_scanline32(bitmap_t *bitmap,int x,int y,int length,const UINT32 *src,const pen_t *pens,int transparent_pen);
229void pdraw_scanline8(bitmap_t *bitmap,int x,int y,int length,const UINT8 *src,const pen_t *pens,int transparent_pen,int pri);
230void pdraw_scanline16(bitmap_t *bitmap,int x,int y,int length,const UINT16 *src,const pen_t *pens,int transparent_pen,int pri);
231void pdraw_scanline32(bitmap_t *bitmap,int x,int y,int length,const UINT32 *src,const pen_t *pens,int transparent_pen,int pri);
232void extract_scanline8(bitmap_t *bitmap,int x,int y,int length,UINT8 *dst);
233void extract_scanline16(bitmap_t *bitmap,int x,int y,int length,UINT16 *dst);
234void extract_scanline32(bitmap_t *bitmap,int x,int y,int length,UINT32 *dst);
235235
236236
237void copybitmap(mame_bitmap *dest,mame_bitmap *src,int flipx,int flipy,
237void copybitmap(bitmap_t *dest,bitmap_t *src,int flipx,int flipy,
238238            int sx,int sy,const rectangle *clip);
239239
240void copybitmap_trans(mame_bitmap *dest,mame_bitmap *src,int flipx,int flipy,
240void copybitmap_trans(bitmap_t *dest,bitmap_t *src,int flipx,int flipy,
241241                 int sx,int sy,const rectangle *clip,pen_t transparent_pen);
242242
243void copyscrollbitmap(mame_bitmap *dest,mame_bitmap *src,
243void copyscrollbitmap(bitmap_t *dest,bitmap_t *src,
244244                 int rows,const int *rowscroll,int cols,const int *colscroll,
245245                 const rectangle *clip);
246246
247void copyscrollbitmap_trans(mame_bitmap *dest,mame_bitmap *src,
247void copyscrollbitmap_trans(bitmap_t *dest,bitmap_t *src,
248248                      int rows,const int *rowscroll,int cols,const int *colscroll,
249249                      const rectangle *clip,pen_t transparent_pen);
250250
r1877r1878
277277  Optionally the bitmap can be tiled across the screen instead of doing a single
278278  copy. This is obtained by setting the wraparound parameter to true.
279279 */
280void copyrozbitmap(mame_bitmap *dest,mame_bitmap *src,
280void copyrozbitmap(bitmap_t *dest,bitmap_t *src,
281281      UINT32 startx,UINT32 starty,int incxx,int incxy,int incyx,int incyy,int wraparound,
282282      const rectangle *clip,int transparency,int transparent_color,UINT32 priority);
283283
src/emu/render.c
r1877r1878
121121/* a scaled_texture contains a single scaled entry for a texture */
122122struct _scaled_texture
123123{
124   mame_bitmap *      bitmap;            /* final bitmap */
124   bitmap_t *         bitmap;            /* final bitmap */
125125   UINT32            seqid;            /* sequence number */
126126};
127127
r1877r1878
131131{
132132   render_texture *   next;            /* next texture (for free list) */
133133   render_texture *   base;            /* pointer to base of texture group */
134   mame_bitmap *      bitmap;            /* pointer to the original bitmap */
134   bitmap_t *         bitmap;            /* pointer to the original bitmap */
135135   rectangle         sbounds;         /* source bounds within the bitmap */
136136   UINT32            palettebase;      /* palette base within the system palette */
137137   int               format;            /* format of the texture data */
138   texture_scaler      scaler;            /* scaling callback */
138   texture_scaler_func      scaler;            /* scaling callback */
139139   void *            param;            /* scaling callback parameter */
140140   UINT32            curseq;            /* current sequence number */
141141   scaled_texture      scaled[MAX_TEXTURE_SCALES];   /* array of scaled variants of this texture */
r1877r1878
193193   float            yscale;            /* Y scale factor of the container */
194194   float            xoffset;         /* X offset of the container */
195195   float            yoffset;         /* Y offset of the container */
196   mame_bitmap *      overlaybitmap;      /* overlay bitmap */
196   bitmap_t *         overlaybitmap;      /* overlay bitmap */
197197   render_texture *   overlaytexture;      /* overlay texture */
198198   palette_client *   palclient;         /* client to the system palette */
199199   rgb_t            bcglookup256[0x400];/* lookup table for brightness/contrast/gamma */
r1877r1878
223223/* containers for the UI and for screens */
224224static render_container *ui_container;
225225static render_container *screen_container[MAX_SCREENS];
226static mame_bitmap *screen_overlay;
226static bitmap_t *screen_overlay;
227227
228228/* variables for tracking extents to clear */
229229static INT32 clear_extents[MAX_CLEAR_EXTENTS];
r1877r1878
270270static render_container *render_container_alloc(void);
271271static void render_container_free(render_container *container);
272272static container_item *render_container_item_add_generic(render_container *container, UINT8 type, float x0, float y0, float x1, float y1, rgb_t argb);
273static void render_container_overlay_scale(mame_bitmap *dest, const mame_bitmap *source, const rectangle *sbounds, void *param);
273static void render_container_overlay_scale(bitmap_t *dest, const bitmap_t *source, const rectangle *sbounds, void *param);
274274static void render_container_recompute_lookups(render_container *container);
275275static void render_container_update_palette(render_container *container);
276276
r1877r1878
13021302    the current layout and proposed new parameters
13031303-------------------------------------------------*/
13041304
1305void render_target_compute_visible_area(render_target *target, INT32 target_width, INT32 target_height, float target_pixel_aspect, UINT8 target_orientation, INT32 *visible_width, INT32 *visible_height)
1305void render_target_compute_visible_area(render_target *target, INT32 target_width, INT32 target_height, float target_pixel_aspect, int target_orientation, INT32 *visible_width, INT32 *visible_height)
13061306{
13071307   float width, height;
13081308   float scale;
r1877r1878
14451445   render_target_compute_visible_area(target, target->width, target->height, target->pixel_aspect, target->orientation, &viswidth, &visheight);
14461446
14471447   /* create a root transform for the target */
1448   root_xform.xoffs = (target->width - viswidth) / 2;
1449   root_xform.yoffs = (target->height - visheight) / 2;
1450   root_xform.xscale = viswidth;
1451   root_xform.yscale = visheight;
1448   root_xform.xoffs = (float) (target->width - viswidth) / 2;
1449   root_xform.yoffs = (float) (target->height - visheight) / 2;
1450   root_xform.xscale = (float) viswidth;
1451   root_xform.yscale = (float) visheight;
14521452   root_xform.color.r = root_xform.color.g = root_xform.color.b = root_xform.color.a = 1.0f;
14531453   root_xform.orientation = target->orientation;
14541454
r1877r1878
15491549      /* compute the transform for the UI */
15501550      ui_xform.xoffs = 0;
15511551      ui_xform.yoffs = 0;
1552      ui_xform.xscale = target->width;
1553      ui_xform.yscale = target->height;
1552      ui_xform.xscale = (float) target->width;
1553      ui_xform.yscale = (float) target->height;
15541554      ui_xform.color.r = ui_xform.color.g = ui_xform.color.b = ui_xform.color.a = 1.0f;
15551555      ui_xform.orientation = target->orientation;
15561556
r1877r1878
18861886      prim->flags = PRIMFLAG_TEXORIENT(xform->orientation) | PRIMFLAG_BLENDMODE(blendmode) | PRIMFLAG_TEXFORMAT(texture->format);
18871887
18881888      /* compute the bounds */
1889      set_render_bounds_wh(&prim->bounds, render_round_nearest(xform->xoffs), render_round_nearest(xform->yoffs), width, height);
1889      set_render_bounds_wh(&prim->bounds, render_round_nearest(xform->xoffs), render_round_nearest(xform->yoffs), (float) width, (float) height);
18901890      if (xform->orientation & ORIENTATION_SWAP_XY)
18911891         ISWAP(width, height);
18921892      width = MIN(width, target->maxtexwidth);
r1877r1878
22212221    render_texture_alloc - allocate a new texture
22222222-------------------------------------------------*/
22232223
2224render_texture *render_texture_alloc(texture_scaler scaler, void *param)
2224render_texture *render_texture_alloc(texture_scaler_func scaler, void *param)
22252225{
22262226   render_texture *texture;
22272227
r1877r1878
22912291    bitmap
22922292-------------------------------------------------*/
22932293
2294void render_texture_set_bitmap(render_texture *texture, mame_bitmap *bitmap, const rectangle *sbounds, UINT32 palettebase, int format)
2294void render_texture_set_bitmap(render_texture *texture, bitmap_t *bitmap, const rectangle *sbounds, UINT32 palettebase, int format)
22952295{
22962296   int scalenum;
22972297
r1877r1878
24152415    resampling scaler
24162416-------------------------------------------------*/
24172417
2418void render_texture_hq_scale(mame_bitmap *dest, const mame_bitmap *source, const rectangle *sbounds, void *param)
2418void render_texture_hq_scale(bitmap_t *dest, const bitmap_t *source, const rectangle *sbounds, void *param)
24192419{
24202420   render_color color = { 1.0f, 1.0f, 1.0f, 1.0f };
24212421   render_resample_argb_bitmap_hq(dest->base, dest->rowpixels, dest->width, dest->height, source, sbounds, &color);
r1877r1878
27012701    overlay bitmap for the container
27022702-------------------------------------------------*/
27032703
2704void render_container_set_overlay(render_container *container, mame_bitmap *bitmap)
2704void render_container_set_overlay(render_container *container, bitmap_t *bitmap)
27052705{
27062706   /* free any existing texture */
27072707   if (container->overlaytexture != NULL)
r1877r1878
28362836    an overlay
28372837-------------------------------------------------*/
28382838
2839static void render_container_overlay_scale(mame_bitmap *dest, const mame_bitmap *source, const rectangle *sbounds, void *param)
2839static void render_container_overlay_scale(bitmap_t *dest, const bitmap_t *source, const rectangle *sbounds, void *param)
28402840{
28412841   int x, y;
28422842
src/emu/state.c
r1877r1878
291291    bitmap to be saved
292292-------------------------------------------------*/
293293
294void state_save_register_bitmap(const char *module, UINT32 instance, const char *name, mame_bitmap *val)
294void state_save_register_bitmap(const char *module, UINT32 instance, const char *name, bitmap_t *val)
295295{
296296   state_save_register_memory(module, instance, name, val->base, val->bpp / 8, val->rowpixels * val->height);
297297}
src/emu/timer.c
r1877r1878
4343{
4444   emu_timer *      next;
4545   emu_timer *      prev;
46   timer_callback   callback;
46   timer_fired_func   callback;
4747   INT32          param;
4848   void *         ptr;
4949   const char *   file;
r1877r1878
458458    isn't primed yet
459459-------------------------------------------------*/
460460
461INLINE emu_timer *_timer_alloc_common(timer_callback callback, void *ptr, const char *file, int line, const char *func, int temp)
461INLINE emu_timer *_timer_alloc_common(timer_fired_func callback, void *ptr, const char *file, int line, const char *func, int temp)
462462{
463463   attotime time = get_current_time();
464464   emu_timer *timer = timer_new();
r1877r1878
490490   return timer;
491491}
492492
493emu_timer *_timer_alloc_internal(timer_callback callback, void *ptr, const char *file, int line, const char *func)
493emu_timer *_timer_alloc_internal(timer_fired_func callback, void *ptr, const char *file, int line, const char *func)
494494{
495495   return _timer_alloc_common(callback, ptr, file, line, func, FALSE);
496496}
r1877r1878
585585    period
586586-------------------------------------------------*/
587587
588void _timer_pulse_internal(attotime period, void *ptr, INT32 param, timer_callback callback, const char *file, int line, const char *func)
588void _timer_pulse_internal(attotime period, void *ptr, INT32 param, timer_fired_func callback, const char *file, int line, const char *func)
589589{
590590   emu_timer *timer = _timer_alloc_common(callback, ptr, file, line, func, FALSE);
591591   timer_adjust_periodic(timer, period, param, period);
r1877r1878
597597    calls the callback after the given duration
598598-------------------------------------------------*/
599599
600void _timer_set_internal(attotime duration, void *ptr, INT32 param, timer_callback callback, const char *file, int line, const char *func)
600void _timer_set_internal(attotime duration, void *ptr, INT32 param, timer_fired_func callback, const char *file, int line, const char *func)
601601{
602602   emu_timer *timer = _timer_alloc_common(callback, ptr, file, line, func, TRUE);
603603   timer_adjust_oneshot(timer, duration, param);
src/emu/mconfig.c
r1877r1878
368368         case MCONFIG_TOKEN_CPU_VBLANK_INT:
369369            assert(cpu != NULL);
370370            TOKEN_UNGET_UINT32(tokens);
371            TOKEN_GET_UINT32_UNPACK1(tokens, entrytype, 8);
372            cpu->vblank_interrupt_screen = TOKEN_GET_STRING(tokens);
373            cpu->vblank_interrupt = TOKEN_GET_PTR(tokens, interrupt);
374            cpu->vblank_interrupts_per_frame = 1;
375            break;
376
377         case MCONFIG_TOKEN_CPU_VBLANK_INT_HACK:
378            assert(cpu != NULL);
379            TOKEN_UNGET_UINT32(tokens);
371380            TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, cpu->vblank_interrupts_per_frame, 24);
372381            cpu->vblank_interrupt = TOKEN_GET_PTR(tokens, interrupt);
373382            break;
src/emu/cheat.c
r1877r1878
79467946{
79477947   switch(size)
79487948   {
7949      case kSearchSize_8Bit:
7950      case kSearchSize_1Bit:
7951      default:
7952         buf[0] = (data >> 0) & 0xFF;
7953         buf[1] = 0;
7954
7955         return 1;
7956
79577949      case kSearchSize_16Bit:
79587950         buf[0] = (data >> 8) & 0xFF;
79597951         buf[1] = (data >> 0) & 0xFF;
r1877r1878
79777969         buf[4] = 0;
79787970
79797971         return 4;
7972
7973      case kSearchSize_8Bit:
7974      case kSearchSize_1Bit:
7975      default:
7976         buf[0] = (data >> 0) & 0xFF;
7977         buf[1] = 0;
7978
7979         return 1;
7980
79807981   }
79817982
7982   buf[0] = 0;
7983   return 0;
79847983}
79857984
79867985/*---------------------------------------------
r1877r1878
89238922
89248923static UINT8 DefaultEnableRegion(running_machine *machine, SearchRegion * region, SearchInfo * info)
89258924{
8926   write8_handler      handler = region->writeHandler->write.handler8;
8925   write8_machine_func      handler = region->writeHandler->write.handler8;
89278926   FPTR            handlerAddress = (FPTR)handler;
89288927
89298928   switch(info->searchSpeed)
r1877r1878
1124711246
1124811247      case kOperation_AddSubtract:
1124911248      {
11250         INT32   temp, bound;
11249         //INT32 temp, bound;
1125111250
1125211251         /* ----- if extend data field is invalid, direct return ----- */
1125311252         //if(action->flags & kActionFlag_IgnoreMask)
1125411253            return;
1125511254
11255         /* FIXME: AddSubstract looks seriously broken
11256             *        and being worked on. */
11257#if 0
1125611258         temp = ReadData(action);
1125711259
1125811260         /* ----- OperationParameter field stores add/subtract ----- */
r1877r1878
1127411276         }
1127511277
1127611278         WriteData(action, temp);
11279#endif
1127711280      }
1127811281      break;
1127911282
src/emu/render.h
r1877r1878
170170-------------------------------------------------*/
171171
172172/* texture scaling callback */
173typedef void (*texture_scaler)(mame_bitmap *dest, const mame_bitmap *source, const rectangle *sbounds, void *param);
173typedef void (*texture_scaler_func)(bitmap_t *dest, const bitmap_t *source, const rectangle *sbounds, void *param);
174174
175175
176176
r1877r1878
376376void render_target_set_max_texture_size(render_target *target, int maxwidth, int maxheight);
377377
378378/* compute the visible area for the given target with the current layout and proposed new parameters */
379void render_target_compute_visible_area(render_target *target, INT32 target_width, INT32 target_height, float target_pixel_aspect, UINT8 target_orientation, INT32 *visible_width, INT32 *visible_height);
379void render_target_compute_visible_area(render_target *target, INT32 target_width, INT32 target_height, float target_pixel_aspect, int target_orientation, INT32 *visible_width, INT32 *visible_height);
380380
381381/* get the "minimum" size of a target, which is the smallest bounds that will ensure at least
382382   1 target pixel per source pixel for all included screens */
r1877r1878
390390/* ----- render texture management ----- */
391391
392392/* allocate a new texture */
393render_texture *render_texture_alloc(texture_scaler scaler, void *param);
393render_texture *render_texture_alloc(texture_scaler_func scaler, void *param);
394394
395395/* free an allocated texture */
396396void render_texture_free(render_texture *texture);
397397
398398/* set a new source bitmap */
399void render_texture_set_bitmap(render_texture *texture, mame_bitmap *bitmap, const rectangle *sbounds, UINT32 palettebase, int format);
399void render_texture_set_bitmap(render_texture *texture, bitmap_t *bitmap, const rectangle *sbounds, UINT32 palettebase, int format);
400400
401401/* generic high quality resampling scaler */
402void render_texture_hq_scale(mame_bitmap *dest, const mame_bitmap *source, const rectangle *sbounds, void *param);
402void render_texture_hq_scale(bitmap_t *dest, const bitmap_t *source, const rectangle *sbounds, void *param);
403403
404404
405405
r1877r1878
460460void render_container_set_yoffset(render_container *container, float yoffset);
461461
462462/* set the overlay bitmap for the container */
463void render_container_set_overlay(render_container *container, mame_bitmap *bitmap);
463void render_container_set_overlay(render_container *container, bitmap_t *bitmap);
464464
465465/* return a pointer to the UI container */
466466render_container *render_container_get_ui(void);
src/emu/state.h
r1877r1878
8686int state_save_get_reg_count(void);
8787
8888void state_save_register_memory(const char *module, UINT32 instance, const char *name, void *val, UINT32 valsize, UINT32 valcount);
89void state_save_register_bitmap(const char *module, UINT32 instance, const char *name, mame_bitmap *val);
89void state_save_register_bitmap(const char *module, UINT32 instance, const char *name, bitmap_t *val);
9090
9191void state_save_register_func_presave(void (*func)(void));
9292void state_save_register_func_postload(void (*func)(void));
src/emu/timer.h
r1877r1878
5454***************************************************************************/
5555
5656/* a timer callback looks like this */
57typedef void (*timer_callback)(running_machine *machine, void *ptr, INT32 param);
57typedef void (*timer_fired_func)(running_machine *machine, void *ptr, INT32 param);
5858
5959/* opaque type for representing a timer */
6060typedef struct _emu_timer emu_timer;
r1877r1878
106106/* ----- core timer management ----- */
107107
108108/* allocate a permament timer that isn't primed yet */
109emu_timer *_timer_alloc_internal(timer_callback callback, void *param, const char *file, int line, const char *func);
109emu_timer *_timer_alloc_internal(timer_fired_func callback, void *param, const char *file, int line, const char *func);
110110
111111/* adjust the time when this timer will fire and disable any periodic firings */
112112void timer_adjust_oneshot(emu_timer *which, attotime duration, INT32 param);
r1877r1878
119119/* ----- anonymous timer management ----- */
120120
121121/* allocate a one-shot timer, which calls the callback after the given duration */
122void _timer_set_internal(attotime druation, void *ptr, INT32 param, timer_callback callback, const char *file, int line, const char *func);
122void _timer_set_internal(attotime druation, void *ptr, INT32 param, timer_fired_func callback, const char *file, int line, const char *func);
123123
124124/* allocate a pulse timer, which repeatedly calls the callback using the given period */
125void _timer_pulse_internal(attotime period, void *ptr, INT32 param, timer_callback callback, const char *file, int line, const char *func);
125void _timer_pulse_internal(attotime period, void *ptr, INT32 param, timer_fired_func callback, const char *file, int line, const char *func);
126126
127127
128128
src/emu/validity.c
r1877r1878
683683         for ( ; !IS_AMENTRY_END(map); map++)
684684            if (!IS_AMENTRY_EXTENDED(map))
685685            {
686               int ismatchmask = ((map->flags & AM_FLAGS_MATCH_MASK) != 0);
687686               UINT32 start = SPACE_SHIFT(map->start);
688               UINT32 end = ismatchmask ? SPACE_SHIFT(map->end) : SPACE_SHIFT_END(map->end);
687               UINT32 end = SPACE_SHIFT_END(map->end);
689688
689               /* look for inverted start/end pairs */
690               if (end < start)
690691               {
691                  /* look for inverted start/end pairs */
692                  if (end < start)
693                  {
694                     mame_printf_error("%s: %s wrong %s memory read handler start = %08x > end = %08x\n", driver->source_file, driver->name, spacename[spacenum], map->start, map->end);
695                     error = TRUE;
696                  }
692                  mame_printf_error("%s: %s wrong %s memory read handler start = %08x > end = %08x\n", driver->source_file, driver->name, spacename[spacenum], map->start, map->end);
693                  error = TRUE;
694               }
697695
698                  /* look for misaligned entries */
699                  if ((start & (alignunit-1)) != 0 || (end & (alignunit-1)) != (alignunit-1))
700                  {
701                     mame_printf_error("%s: %s wrong %s memory read handler start = %08x, end = %08x ALIGN = %d\n", driver->source_file, driver->name, spacename[spacenum], map->start, map->end, alignunit);
702                     error = TRUE;
703                  }
696               /* look for misaligned entries */
697               if ((start & (alignunit-1)) != 0 || (end & (alignunit-1)) != (alignunit-1))
698               {
699                  mame_printf_error("%s: %s wrong %s memory read handler start = %08x, end = %08x ALIGN = %d\n", driver->source_file, driver->name, spacename[spacenum], map->start, map->end, alignunit);
700                  error = TRUE;
701               }
704702
705                  /* if this is a program space, auto-assign implicit ROM entries */
706                  if ((FPTR)map->read.handler == STATIC_ROM && !map->region)
707                  {
708                     map->region = REGION_CPU1 + cpunum;
709                     map->region_offs = map->start;
710                  }
703               /* if this is a program space, auto-assign implicit ROM entries */
704               if ((FPTR)map->read.handler == STATIC_ROM && !map->region)
705               {
706                  map->region = REGION_CPU1 + cpunum;
707                  map->region_offs = map->start;
708               }
711709
712                  /* if this entry references a memory region, validate it */
713                  if (map->region && map->share == 0)
710               /* if this entry references a memory region, validate it */
711               if (map->region && map->share == 0)
712               {
713                  offs_t length = region_length[map->region];
714
715                  if (length == 0)
714716                  {
715                     offs_t length = region_length[map->region];
716
717                     if (length == 0)
718                     {
719                        mame_printf_error("%s: %s CPU %d space %d memory map entry %X-%X references non-existant region %d\n", driver->source_file, driver->name, cpunum, spacenum, map->start, map->end, map->region);
720                        error = TRUE;
721                     }
722                     else if (map->region_offs + (end - start + 1) > length)
723                     {
724                        mame_printf_error("%s: %s CPU %d space %d memory map entry %X-%X extends beyond region %d size (%X)\n", driver->source_file, driver->name, cpunum, spacenum, map->start, map->end, map->region, length);
725                        error = TRUE;
726                     }
717                     mame_printf_error("%s: %s CPU %d space %d memory map entry %X-%X references non-existant region %d\n", driver->source_file, driver->name, cpunum, spacenum, map->start, map->end, map->region);
718                     error = TRUE;
727719                  }
728
729                  /* If this is a match/mask, make sure the match bits are present in the mask */
730                  if (ismatchmask && (start & end) != start)
720                  else if (map->region_offs + (end - start + 1) > length)
731721                  {
732                     mame_printf_error("%s: %s CPU %d space %d memory map entry match %X contains bits not in mask %X for region %d\n", driver->source_file, driver->name, cpunum, spacenum, map->start, map->end, map->region);
722                     mame_printf_error("%s: %s CPU %d space %d memory map entry %X-%X extends beyond region %d size (%X)\n", driver->source_file, driver->name, cpunum, spacenum, map->start, map->end, map->region, length);
733723                     error = TRUE;
734724                  }
735725               }
726
727               /* make sure all devices exist */
728               if (map->read_devtype != NULL && device_list_find_by_tag(config->devicelist, map->read_devtype, map->read_devtag) == NULL)
729               {
730                  mame_printf_error("%s: %s CPU %d space %d memory map entry references nonexistant device type %s, tag %s\n", driver->source_file, driver->name, cpunum, spacenum, devtype_name(map->read_devtype), map->read_devtag);
731                  error = TRUE;
732               }
733               if (map->write_devtype != NULL && device_list_find_by_tag(config->devicelist, map->write_devtype, map->write_devtag) == NULL)
734               {
735                  mame_printf_error("%s: %s CPU %d space %d memory map entry references nonexistant device type %s, tag %s\n", driver->source_file, driver->name, cpunum, spacenum, devtype_name(map->write_devtype), map->write_devtag);
736                  error = TRUE;
737               }
736738            }
737739            else
738740            {
r1877r1878
759761                  }
760762               }
761763            }
764
765         /* validate the interrupts */
766         if (cpu->vblank_interrupt != NULL)
767         {
768            if (video_screen_count(config) == 0)
769            {
770               mame_printf_error("%s: %s cpu #%d has a VBLANK interrupt, but the driver is screenless !\n", driver->source_file, driver->name, cpunum);
771               error = TRUE;
772            }
773            else if (cpu->vblank_interrupts_per_frame == 0)
774            {
775               mame_printf_error("%s: %s cpu #%d has a VBLANK interrupt handler with 0 interrupts!\n", driver->source_file, driver->name, cpunum);
776               error = TRUE;
777            }
778            else if (cpu->vblank_interrupts_per_frame == 1)
779            {
780               if (cpu->vblank_interrupt_screen == NULL)
781               {
782                  mame_printf_error("%s: %s cpu #%d has a valid VBLANK interrupt handler with no screen tag supplied!\n", driver->source_file, driver->name, cpunum);
783                  error = TRUE;
784               }
785               else if (device_list_index(config->devicelist, VIDEO_SCREEN, cpu->vblank_interrupt_screen) == -1)
786               {
787                  mame_printf_error("%s: %s cpu #%d VBLANK interrupt with a non-existant screen tag (%s)!\n", driver->source_file, driver->name, cpunum, cpu->vblank_interrupt_screen);
788                  error = TRUE;
789               }
790            }
791         }
792         else if (cpu->vblank_interrupts_per_frame != 0)
793         {
794            mame_printf_error("%s: %s cpu #%d has no VBLANK interrupt handler but a non-0 interrupt count is given!\n", driver->source_file, driver->name, cpunum);
795            error = TRUE;
796         }
797
798         if ((cpu->timed_interrupt != NULL) && (cpu->timed_interrupt_period == 0))
799         {
800            mame_printf_error("%s: %s cpu #%d has a timer interrupt handler with 0 period!\n", driver->source_file, driver->name, cpunum);
801            error = TRUE;
802         }
803         else if ((cpu->timed_interrupt == NULL) && (cpu->timed_interrupt_period != 0))
804         {
805            mame_printf_error("%s: %s cpu #%d has a no timer interrupt handler but has a non-0 period given!\n", driver->source_file, driver->name, cpunum);
806            error = TRUE;
807         }
762808      }
763809   }
764810
src/emu/mconfig.h
r1877r1878
4848   MCONFIG_TOKEN_CPU_DATA_MAP,
4949   MCONFIG_TOKEN_CPU_IO_MAP,
5050   MCONFIG_TOKEN_CPU_VBLANK_INT,
51   MCONFIG_TOKEN_CPU_VBLANK_INT_HACK,
5152   MCONFIG_TOKEN_CPU_PERIODIC_INT,
5253
5354   MCONFIG_TOKEN_DRIVER_DATA,
r1877r1878
138139   void            (*video_start)(running_machine *machine);      /* one-time video start callback */
139140   void            (*video_reset)(running_machine *machine);      /* video reset callback */
140141   void            (*video_eof)(running_machine *machine);         /* end-of-frame video callback */
141   UINT32            (*video_update)(running_machine *machine, int screen, mame_bitmap *bitmap, const rectangle *cliprect); /* video update callback */
142   UINT32            (*video_update)(running_machine *machine, int screen, bitmap_t *bitmap, const rectangle *cliprect); /* video update callback */
142143
143144   sound_config      sound[MAX_SOUND];         /* array of sound chips in the system */
144145
r1877r1878
188189
189190/* use this to declare external references to a machine driver */
190191#define MACHINE_DRIVER_EXTERN(_name) \
191   extern const machine_config_token machine_config_##_name[];
192   extern const machine_config_token machine_config_##_name[]
192193
193194
194195/* importing data from other machine drivers */
r1877r1878
284285   TOKEN_PTR(voidptr, construct_map_##_map1), \
285286   TOKEN_PTR(voidptr, construct_map_##_map2), \
286287
287#define MDRV_CPU_VBLANK_INT(_func, _rate) \
288   TOKEN_UINT32_PACK2(MCONFIG_TOKEN_CPU_VBLANK_INT, 8, _rate, 24), \
288#define MDRV_CPU_VBLANK_INT(_tag, _func) \
289   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_CPU_VBLANK_INT, 8), \
290   TOKEN_STRING(_tag), \
289291   TOKEN_PTR(interrupt, _func),
290292
291293#define MDRV_CPU_PERIODIC_INT(_func, _rate)   \
src/emu/drivers/xtal.h
r1877r1878
6565   XTAL_10MHz         = 10000000,
6666   XTAL_10_595MHz     = 10595000,      /* Mad Alien */
6767   XTAL_10_738635MHz   = 10738635,      /* TMS9918 family */
68   XTAL_11MHz      = 11000000,      /* Mario I8039 sound */
68   XTAL_11MHz         = 11000000,      /* Mario I8039 sound */
6969   XTAL_11_0592MHz     = 11059200,      /* Lethal Justice */
7070   XTAL_11_2MHz        = 11200000,      /* New York, New York */
7171   XTAL_11_289MHz     = 11289000,      /* Vanguard */
r1877r1878
8282   XTAL_14_31818MHz     = 14318180,      /* Extremely common, used on 100's of PCBs */
8383   XTAL_14_705882MHz     = 14705882,      /* Aleck64 */
8484   XTAL_14_7456MHz    = 14745600,      /* Namco System 12 & System Super 22/23 for H8/3002 CPU */
85   XTAL_15MHz      = 15000000,      /* Sinclair QL */
85   XTAL_15MHz         = 15000000,      /* Sinclair QL */
8686   XTAL_15_468MHz     = 15468000,      /* Bank Panic h/w, Sega G80 */
8787   XTAL_16MHz         = 16000000,      /* Extremely common, used on 100's of PCBs */
8888   XTAL_16_9344MHz     = 16934400,      /* Usually used to drive 90's Yamaha OPL/FM chips */
8989   XTAL_17_73447MHz   = 17734470,      /* 4 times the PAL subcarrier */
9090   XTAL_18MHz         = 18000000,      /* S.A.R, Ikari Warriors 3 */
9191   XTAL_18_432MHz     = 18432000,      /* Extremely common, used on 100's of PCBs */
92   XTAL_19_968MHz     = 19968000,      /* Used mostly by Space Invaders games by Taito/Midway and clones */
92   XTAL_19_923MHz      = 19923000,      /* Cinematronics vectors */
93   XTAL_19_968MHz     = 19968000,      /* Used mostly by some Taito games */
9394   XTAL_20MHz         = 20000000,
9495   XTAL_21MHz        = 21000000,      /* Lock-On pixel clock */
9596   XTAL_21_3MHz        = 21300000,
r1877r1878
105106   XTAL_27_164MHz     = 27164000,      /* Typically used on 90's Taito PCBs to drive the custom chips */
106107   XTAL_28MHz         = 28000000,
107108   XTAL_28_37516MHz   = 28375160,      /* Amiga PAL systems */
108   XTAL_28_63636MHz     = 28636360,      /* later Leland games and Atari GT, Amiga NTSC */
109   XTAL_28_63636MHz     = 28636360,      /* later Leland games and Atari GT, Amiga NTSC , Raiden2 h/w */
109110   XTAL_30_4761MHz     = 30476100,      /* Taito JC */
110111   XTAL_32MHz         = 32000000,
111112   XTAL_32_22MHz        = 32220000,      /* Typically used on 90's Data East PCBs */
r1877r1878
142143   XTAL_400kHz         = 400000,      /* Used on Great Swordman h/w */
143144   XTAL_455kHz         = 455000,      /* Used on Gladiator h/w */
144145   XTAL_640kHz         = 640000,
145   XTAL_1_056MHz         = 1056000       /* used on Trio The Punch */
146   XTAL_1_056MHz      = 1056000       /* used on Trio The Punch */
146147};
147148
148149
src/lib/util/chd.h
r1877r1878
176176typedef struct _chd_file chd_file;
177177
178178
179/* progress callback function */
180typedef void (*chd_progress_printf)(const char *format, ...);
181
182
183179/* extract header structure (NOT the on-disk header structure) */
184180typedef struct _chd_header chd_header;
185181struct _chd_header
src/lib/util/cdrom.c
r1877r1878
2828#define VERBOSE   (0)
2929#if VERBOSE
3030#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
31void CLIB_DECL logerror(const char *text,...);
3132#else
3233#define LOG(x)
3334#endif
3435
35void CLIB_DECL logerror(const char *text,...);
3636
3737
3838
src/lib/util/png.c
r1877r1878
5858}
5959
6060
61#ifdef UNUSED_FUNCTON
6162INLINE UINT16 fetch_16bit(UINT8 *v)
6263{
6364   return BIG_ENDIANIZE_INT16(*(UINT16 *)v);
6465}
66#endif
6567
66
6768INLINE UINT32 fetch_32bit(UINT8 *v)
6869{
6970   return BIG_ENDIANIZE_INT32(*(UINT32 *)v);
r1877r1878
7677}
7778
7879
80#ifdef UNUSED_FUNCTON
7981INLINE void put_16bit(UINT8 *v, UINT16 data)
8082{
8183   *(UINT16 *)v = BIG_ENDIANIZE_INT16(data);
8284}
85#endif
8386
84
8587INLINE void put_32bit(UINT8 *v, UINT32 data)
8688{
8789   *(UINT32 *)v = BIG_ENDIANIZE_INT32(data);
src/mess/devices/coco_fdc.c
r1877r1878
6767*********************************************************************/
6868
6969#include "driver.h"
70#include "deprecat.h"
7071#include "cococart.h"
7172#include "coco_vhd.h"
7273#include "includes/coco.h"
r1877r1878
281282
282283static UINT8 fdc_coco_r(coco_cartridge *cartridge, UINT16 addr)
283284{
285   running_machine *machine = Machine;
284286   UINT8 result = 0;
285287   switch(addr & 0xEF)
286288   {
287289      case 8:
288         result = wd17xx_status_r(0);
290         result = wd17xx_status_r(machine, 0);
289291         break;
290292      case 9:
291         result = wd17xx_track_r(0);
293         result = wd17xx_track_r(machine, 0);
292294         break;
293295      case 10:
294         result = wd17xx_sector_r(0);
296         result = wd17xx_sector_r(machine, 0);
295297         break;
296298      case 11:
297         result = wd17xx_data_r(0);
299         result = wd17xx_data_r(machine, 0);
298300         break;
299301   }
300302   return result;
r1877r1878
308310
309311static void fdc_coco_w(coco_cartridge *cartridge, UINT16 addr, UINT8 data)
310312{
313   running_machine *machine = Machine;
311314   switch(addr & 0xEF)
312315   {
313316      case 0: case 1: case 2: case 3:
r1877r1878
315318         fdc_coco_dskreg_w(cartridge, data);
316319         break;
317320      case 8:
318         wd17xx_command_w(0, data);
321         wd17xx_command_w(machine, 0, data);
319322         break;
320323      case 9:
321         wd17xx_track_w(0, data);
324         wd17xx_track_w(machine, 0, data);
322325         break;
323326      case 10:
324         wd17xx_sector_w(0, data);
327         wd17xx_sector_w(machine, 0, data);
325328         break;
326329      case 11:
327         wd17xx_data_w(0, data);
330         wd17xx_data_w(machine, 0, data);
328331         break;
329332   };
330333}
r1877r1878
386389
387390static UINT8 fdc_coco3plus_r(coco_cartridge *cartridge, UINT16 addr)
388391{
392   running_machine *machine = Machine;
389393   UINT8 result = fdc_coco_r(cartridge, addr);
390394
391395   switch(addr)
392396   {
393397      case 0x10:   /* FF50 */
394398         if (real_time_clock() == RTC_DISTO)
395            result = msm6242_r(msm6242_rtc_address);
399            result = msm6242_r(machine, msm6242_rtc_address);
396400         break;
397401
398402      case 0x38:   /* FF78 */
399403         if (real_time_clock() == RTC_CLOUD9)
400            ds1315_r_0(addr);
404            ds1315_r_0(machine, addr);
401405         break;
402406
403407      case 0x39:   /* FF79 */
404408         if (real_time_clock() == RTC_CLOUD9)
405            ds1315_r_1(addr);
409            ds1315_r_1(machine, addr);
406410         break;
407411
408412      case 0x3C:   /* FF7C */
409413         if (real_time_clock() == RTC_CLOUD9)
410            result = ds1315_r_data(addr);
414            result = ds1315_r_data(machine, addr);
411415         break;
412416
413417      case 0x40:
r1877r1878
417421      case 0x44:
418422      case 0x45:
419423         if (device_count(IO_VHD) > 0)
420            result = coco_vhd_io_r(addr);
424            result = coco_vhd_io_r(machine, addr);
421425         break;
422426   }
423427   return result;
r1877r1878
431435
432436static void fdc_coco3plus_w(coco_cartridge *cartridge, UINT16 addr, UINT8 data)
433437{
438   running_machine *machine = Machine;
439
434440   fdc_coco_w(cartridge, addr, data);
435441
436442   switch(addr)
437443   {
438444      case 0x10:   /* FF50 */
439445         if (real_time_clock() == RTC_DISTO)
440            msm6242_w(msm6242_rtc_address, data);
446            msm6242_w(machine, msm6242_rtc_address, data);
441447         break;
442448
443449      case 0x11:   /* FF51 */
r1877r1878
452458      case 0x44:
453459      case 0x45:
454460         if (device_count(IO_VHD) > 0)
455            coco_vhd_io_w(addr, data);
461            coco_vhd_io_w(machine, addr, data);
456462         break;
457463   }
458464}
r1877r1878
559565
560566static UINT8 fdc_dragon_r(coco_cartridge *cartridge, UINT16 addr)
561567{
568   running_machine *machine = Machine;
562569   UINT8 result = 0;
563570   switch(addr & 0xEF)
564571   {
565572      case 0:
566         result = wd17xx_status_r(0);
573         result = wd17xx_status_r(machine, 0);
567574         break;
568575      case 1:
569         result = wd17xx_track_r(0);
576         result = wd17xx_track_r(machine, 0);
570577         break;
571578      case 2:
572         result = wd17xx_sector_r(0);
579         result = wd17xx_sector_r(machine, 0);
573580         break;
574581      case 3:
575         result = wd17xx_data_r(0);
582         result = wd17xx_data_r(machine, 0);
576583         break;
577584   }
578585   return result;
r1877r1878
586593
587594static void fdc_dragon_w(coco_cartridge *cartridge, UINT16 addr, UINT8 data)
588595{
596   running_machine *machine = Machine;
589597   switch(addr & 0xEF)
590598   {
591599      case 0:
592         wd17xx_command_w(0, data);
600         wd17xx_command_w(machine, 0, data);
593601
594602         /* disk head is encoded in the command byte */
595603         /* Only for type 3 & 4 commands */
r1877r1878
597605            wd17xx_set_side((data & 0x02) ? 1 : 0);
598606         break;
599607      case 1:
600         wd17xx_track_w(0, data);
608         wd17xx_track_w(machine, 0, data);
601609         break;
602610      case 2:
603         wd17xx_sector_w(0, data);
611         wd17xx_sector_w(machine, 0, data);
604612         break;
605613      case 3:
606         wd17xx_data_w(0, data);
614         wd17xx_data_w(machine, 0, data);
607615         break;
608616      case 8: case 9: case 10: case 11:
609617      case 12: case 13: case 14: case 15:
src/mess/devices/thomflop.c
r1877r1878
278278static READ8_HANDLER ( to7_5p14_r )
279279{
280280   if ( offset < 4 )
281      return wd17xx_r( offset );
281      return wd17xx_r( machine, offset );
282282   else if ( offset == 8 )
283283      return to7_5p14_select;
284284   else
r1877r1878
291291static WRITE8_HANDLER( to7_5p14_w )
292292{
293293   if ( offset < 4 )
294      wd17xx_w( offset, data );
294      wd17xx_w( machine, offset, data );
295295   else if ( offset == 8 )
296296   {
297297      /* drive select */
r1877r1878
375375static READ8_HANDLER ( to7_5p14sd_r )
376376{
377377   if ( offset < 8 )
378      return mc6843_r( offset );
378      return mc6843_r( machine, offset );
379379   else if ( offset >= 8 && offset <= 9 )
380380      return to7_5p14sd_select;
381381   else
r1877r1878
388388static WRITE8_HANDLER( to7_5p14sd_w )
389389{
390390   if ( offset < 8 )
391      mc6843_w( offset, data );
391      mc6843_w( machine, offset, data );
392392   else if ( offset >= 8 && offset <= 9 )
393393   {
394394      /* drive select */
r1877r1878
17111711static READ8_HANDLER ( to7_network_r )
17121712{
17131713   if ( offset >= 0 && offset < 4 )
1714      return mc6854_r( offset );
1714      return mc6854_r( machine, offset );
17151715
17161716   if ( offset == 8 )
17171717   {
r1877r1878
17301730static WRITE8_HANDLER ( to7_network_w )
17311731{
17321732   if ( offset >= 0 && offset < 4 )
1733      mc6854_w( offset, data );
1733      mc6854_w( machine, offset, data );
17341734   else
17351735   {
17361736      logerror( "%f $%04x to7_network_w: invalid write offset %i (data=$%02X)\n",
r1877r1878
18201820   {
18211821
18221822   case 1:
1823      return to7_5p14sd_r( offset );
1823      return to7_5p14sd_r( machine, offset );
18241824
18251825   case 2:
1826      return to7_5p14_r( offset );
1826      return to7_5p14_r( machine, offset );
18271827
18281828   case 3:
1829      return thmfc_floppy_r( offset );
1829      return thmfc_floppy_r( machine, offset );
18301830
18311831   case 4:
1832      return to7_qdd_r( offset );
1832      return to7_qdd_r( machine, offset );
18331833
18341834   case 5:
1835      return to7_network_r( offset );
1835      return to7_network_r( machine, offset );
18361836   }
18371837
18381838   return 0;
r1877r1878
18461846   {
18471847
18481848   case 1:
1849      to7_5p14sd_w( offset, data );
1849      to7_5p14sd_w( machine, offset, data );
18501850      return;
18511851
18521852   case 2:
1853      to7_5p14_w( offset, data );
1853      to7_5p14_w( machine, offset, data );
18541854      break;
18551855
18561856   case 3:
r1877r1878
18611861         VLOG (( "to7_floppy_w: set CD 90-351 ROM bank to %i\n", data & 3 ));
18621862      }
18631863      else
1864         thmfc_floppy_w( offset, data );
1864         thmfc_floppy_w( machine, offset, data );
18651865      break;
18661866
18671867   case 4:
1868      to7_qdd_w( offset, data );
1868      to7_qdd_w( machine, offset, data );
18691869      break;
18701870
18711871   case 5:
1872      to7_network_w( offset, data );
1872      to7_network_w( machine, offset, data );
18731873      break;
18741874   }
18751875}
r1877r1878
19121912READ8_HANDLER ( to9_floppy_r )
19131913{
19141914   if ( THOM_FLOPPY_EXT )
1915      return to7_floppy_r( offset );
1915      return to7_floppy_r( machine, offset );
19161916   else
1917      return  to7_5p14_r( offset );
1917      return  to7_5p14_r( machine, offset );
19181918}
19191919
19201920WRITE8_HANDLER ( to9_floppy_w )
19211921{
19221922   if ( THOM_FLOPPY_EXT )
1923      to7_floppy_w( offset, data );
1923      to7_floppy_w( machine, offset, data );
19241924   else
1925      to7_5p14_w( offset, data );
1925      to7_5p14_w( machine, offset, data );
19261926}
src/mess/mslegacy.c
r1877r1878
122122
123123WRITE8_HANDLER(crtc6845_0_address_w)
124124{
125   mc6845_address_w(mslegacy_mc6845, data);
125   device_config *devconf = (device_config *) device_list_find_by_tag(machine->config->devicelist, MC6845, "crtc");
126   mc6845_address_w(devconf, offset, data);
126127}
127128
128129
129130
130131READ8_HANDLER(crtc6845_0_register_r)
131132{
132   return mc6845_register_r(mslegacy_mc6845);
133   device_config *devconf = (device_config *) device_list_find_by_tag(machine->config->devicelist, MC6845, "crtc");
134   return mc6845_register_r(devconf, offset);
133135}
134136
135137
136138
137139WRITE8_HANDLER(crtc6845_0_register_w)
138140{
139   mc6845_register_w(mslegacy_mc6845, data);
141   device_config *devconf = (device_config *) device_list_find_by_tag(machine->config->devicelist, MC6845, "crtc");
142   mc6845_register_w(devconf, offset, data);
140143}
141144
142145
src/mess/compcfg.c
r1877r1878
131131
132132UINT8 *memory_install_ram8_handler(int cpunum, int spacenum, offs_t start, offs_t end, offs_t ram_offset, int bank)
133133{
134   read8_handler read_bank = (read8_handler) (FPTR)(STATIC_BANK1 + bank - 1);
135   write8_handler write_bank = (write8_handler) (FPTR)(STATIC_BANK1 + bank - 1);
134   read8_machine_func read_bank = (read8_machine_func) (FPTR)(STATIC_BANK1 + bank - 1);
135   write8_machine_func write_bank = (write8_machine_func) (FPTR)(STATIC_BANK1 + bank - 1);
136136   offs_t bank_size = end - start + 1;
137137
138138   memory_set_bankptr(bank, mess_ram + ram_offset);
src/mess/audio/pc.c
r1877r1878
5959void pc_sh_speaker(int data)
6060{
6161   int mode = 0;
62   pit8253_0_gate_w(2, data & 1);
62   pit8253_0_gate_w(Machine, 2, data & 1);
6363
6464   switch( data )
6565   {
src/mess/audio/mea8000.c
r1877r1878
8383   /* configuration parameters */
8484
8585   int channel;                  /* first argument for DAC_data_w */
86   write8_handler req_out_func;  /* 1-bit 'ready' output, not negated */
86   write8_machine_func req_out_func;  /* 1-bit 'ready' output, not negated */
8787
8888   /* state */
8989
r1877r1878
200200      (mea8000.state == MEA8000_STARTED && mea8000.bufpos < 4);
201201}
202202
203static void mea8000_update_req( void )
203static void mea8000_update_req( running_machine *machine )
204204{
205205   /* actually, req pulses less than 3us for each new byte,
206206      it goes back up if there space left in the buffer, or stays low if the
r1877r1878
208208      frame end to compose a new frame.
209209   */
210210   if (mea8000.req_out_func)
211      mea8000.req_out_func(0, mea8000_accept_byte());
211      mea8000.req_out_func(machine, 0, mea8000_accept_byte());
212212}
213213
214214
r1877r1878
520520         LOG(( "%f mea8000_timer_expire: stop frame\n", attotime_to_double(timer_get_time()) ));
521521         mea8000_stop_frame();
522522      }
523      mea8000_update_req();
523      mea8000_update_req(machine);
524524   }
525525   else
526526   {
r1877r1878
593593            mea8000.state = MEA8000_STARTED;
594594         }
595595      }
596      mea8000_update_req();
596      mea8000_update_req(machine);
597597      break;
598598
599599   case 1: /* command register */
r1877r1878
613613            activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data,
614614            stop, mea8000.cont, mea8000.roe ));
615615
616      mea8000_update_req();
616      mea8000_update_req(machine);
617617      break;
618618   }
619619
r1877r1878
628628
629629
630630
631void mea8000_reset ( void )
631void mea8000_reset ( running_machine *machine )
632632{
633633   int i;
634634   LOG (( "mea8000_reset\n" ));
r1877r1878
637637   mea8000.cont = 0;
638638   mea8000.roe = 0;
639639   mea8000.state = MEA8000_STOPPED;
640   mea8000_update_req();
640   mea8000_update_req(machine);
641641   for (i=0; i<4; i++)
642642   {
643643      mea8000.f[i].last_output = 0;
r1877r1878
652652
653653
654654
655void mea8000_config ( int channel, write8_handler req_out_func )
655void mea8000_config ( running_machine *machine, int channel, write8_machine_func req_out_func )
656656{
657657   int i;
658658   mea8000_init_tables();
r1877r1878
686686   state_save_register_item( "mea8000", 0, mea8000.pitch );
687687   state_save_register_item( "mea8000", 0, mea8000.noise );
688688
689   mea8000_reset();
689   mea8000_reset(machine);
690690}
src/mess/audio/mea8000.h
r1877r1878
99#ifndef MEA8000
1010#define MEA8000
1111
12extern void mea8000_config ( int channel, write8_handler req_out_func );
12extern void mea8000_config ( running_machine *machine, int channel, write8_machine_func req_out_func );
1313
1414/* reset by external signal */
15extern void mea8000_reset ( void );
15extern void mea8000_reset ( running_machine *machine );
1616
1717/* interface to CPU via address/data bus*/
1818extern READ8_HANDLER  ( mea8000_r );
src/mess/audio/dave.c
r1877r1878
480480}
481481
482482
483WRITE8_HANDLER (   Dave_reg_w )
483WRITE8_HANDLER ( Dave_reg_w )
484484{
485485   logerror("dave w: %04x %02x\n",offset,data);
486486
487   Dave_sound_w(offset,data);
487   Dave_sound_w(machine, offset, data);
488488
489489   dave.Regs[offset & 0x01f] = data;
490490
src/mess/audio/intv.c
r1877r1878
1414READ16_HANDLER( AY8914_directread_port_0_lsb_r )
1515{
1616   int rv;
17   AY8910_control_port_0_w(0,mapping8914to8910[offset&0xff]);
18   rv = (int)AY8910_read_port_0_r(0);
17   AY8910_control_port_0_w(machine, 0, mapping8914to8910[offset&0xff]);
18   rv = (int)AY8910_read_port_0_r(machine, 0);
1919   return rv;
2020}
2121
2222WRITE16_HANDLER( AY8914_directwrite_port_0_lsb_w )
2323{
24   AY8910_control_port_0_w(0,mapping8914to8910[offset&0xff]);
25   AY8910_write_port_0_w(0,data&0xff);
24   AY8910_control_port_0_w(machine, 0, mapping8914to8910[offset&0xff]);
25   AY8910_write_port_0_w(machine, 0, data&0xff);
2626}
src/mess/audio/cgenie.c
r1877r1878
1818
1919READ8_HANDLER( cgenie_sh_data_port_r )
2020{
21   return AY8910_read_port_0_r(offset);
21   return AY8910_read_port_0_r(machine, offset);
2222}
2323
2424WRITE8_HANDLER( cgenie_sh_control_port_w )
2525{
2626   control_port = data;
27   AY8910_control_port_0_w(offset, data);
27   AY8910_control_port_0_w(machine, offset, data);
2828}
2929
3030WRITE8_HANDLER( cgenie_sh_data_port_w )
3131{
32   AY8910_write_port_0_w(offset, data);
32   AY8910_write_port_0_w(machine, offset, data);
3333}
3434
src/mess/includes/cococart.h
r1877r1878
2626{
2727   void (*init)(const struct cartridge_callback *callbacks);
2828   void (*term)(void);
29   read8_handler io_r;
30   write8_handler io_w;
29   read8_machine_func io_r;
30   write8_machine_func io_w;
3131   void (*enablesound)(int enable);
3232};
3333
src/mess/includes/pc1401.h
r1877r1878
1010#define PC1401_H_
1111
1212
13#define KEY_OFF input_port_0_r(0)&0x80
14#define KEY_CAL input_port_0_r(0)&0x40
15#define KEY_BASIC input_port_0_r(0)&0x20
16#define KEY_BRK input_port_0_r(0)&0x10
17#define KEY_DEF input_port_0_r(0)&8
18#define KEY_DOWN input_port_0_r(0)&4
19#define KEY_UP input_port_0_r(0)&2
20#define KEY_LEFT input_port_0_r(0)&1
13#define KEY_OFF readinputport(0)&0x80
14#define KEY_CAL readinputport(0)&0x40
15#define KEY_BASIC readinputport(0)&0x20
16#define KEY_BRK readinputport(0)&0x10
17#define KEY_DEF readinputport(0)&8
18#define KEY_DOWN readinputport(0)&4
19#define KEY_UP readinputport(0)&2
20#define KEY_LEFT readinputport(0)&1
2121
22#define KEY_RIGHT input_port_1_r(0)&0x80
22#define KEY_RIGHT readinputport(1)&0x80
2323// pc1403 sml
24#define KEY_SHIFT input_port_1_r(0)&0x20
25#define KEY_Q input_port_1_r(0)&0x10
26#define KEY_W input_port_1_r(0)&8
27#define KEY_E input_port_1_r(0)&4
28#define KEY_R input_port_1_r(0)&2
29#define KEY_T input_port_1_r(0)&1
24#define KEY_SHIFT readinputport(1)&0x20
25#define KEY_Q readinputport(1)&0x10
26#define KEY_W readinputport(1)&8
27#define KEY_E readinputport(1)&4
28#define KEY_R readinputport(1)&2
29#define KEY_T readinputport(1)&1
3030
31#define KEY_Y input_port_2_r(0)&0x80
32#define KEY_U input_port_2_r(0)&0x40
33#define KEY_I input_port_2_r(0)&0x20
34#define KEY_O input_port_2_r(0)&0x10
35#define KEY_P input_port_2_r(0)&8
36#define KEY_A input_port_2_r(0)&4
37#define KEY_S input_port_2_r(0)&2
38#define KEY_D input_port_2_r(0)&1
31#define KEY_Y readinputport(2)&0x80
32#define KEY_U readinputport(2)&0x40
33#define KEY_I readinputport(2)&0x20
34#define KEY_O readinputport(2)&0x10
35#define KEY_P readinputport(2)&8
36#define KEY_A readinputport(2)&4
37#define KEY_S readinputport(2)&2
38#define KEY_D readinputport(2)&1
3939
40#define KEY_F input_port_3_r(0)&0x80
41#define KEY_G input_port_3_r(0)&0x40
42#define KEY_H input_port_3_r(0)&0x20
43#define KEY_J input_port_3_r(0)&0x10
44#define KEY_K input_port_3_r(0)&8
45#define KEY_L input_port_3_r(0)&4
46#define KEY_COMMA input_port_3_r(0)&2
47#define KEY_Z input_port_3_r(0)&1
40#define KEY_F readinputport(3)&0x80
41#define KEY_G readinputport(3)&0x40
42#define KEY_H readinputport(3)&0x20
43#define KEY_J readinputport(3)&0x10
44#define KEY_K readinputport(3)&8
45#define KEY_L readinputport(3)&4
46#define KEY_COMMA readinputport(3)&2
47#define KEY_Z readinputport(3)&1
4848
49#define KEY_X input_port_4_r(0)&0x80
50#define KEY_C input_port_4_r(0)&0x40
51#define KEY_V input_port_4_r(0)&0x20
52#define KEY_B input_port_4_r(0)&0x10
53#define KEY_N input_port_4_r(0)&8
54#define KEY_M input_port_4_r(0)&4
55#define KEY_SPC input_port_4_r(0)&2
56#define KEY_ENTER input_port_4_r(0)&1
49#define KEY_X readinputport(4)&0x80
50#define KEY_C readinputport(4)&0x40
51#define KEY_V readinputport(4)&0x20
52#define KEY_B readinputport(4)&0x10
53#define KEY_N readinputport(4)&8
54#define KEY_M readinputport(4)&4
55#define KEY_SPC readinputport(4)&2
56#define KEY_ENTER readinputport(4)&1
5757
58#define KEY_HYP input_port_5_r(0)&0x80
59#define KEY_SIN input_port_5_r(0)&0x40
60#define KEY_COS input_port_5_r(0)&0x20
61#define KEY_TAN input_port_5_r(0)&0x10
62#define KEY_FE input_port_5_r(0)&8
63#define KEY_CCE input_port_5_r(0)&4
64#define KEY_HEX input_port_5_r(0)&2
65#define KEY_DEG input_port_5_r(0)&1
58#define KEY_HYP readinputport(5)&0x80
59#define KEY_SIN readinputport(5)&0x40
60#define KEY_COS readinputport(5)&0x20
61#define KEY_TAN readinputport(5)&0x10
62#define KEY_FE readinputport(5)&8
63#define KEY_CCE readinputport(5)&4
64#define KEY_HEX readinputport(5)&2
65#define KEY_DEG readinputport(5)&1
6666
67#define KEY_LN input_port_6_r(0)&0x80
68#define KEY_LOG input_port_6_r(0)&0x40
69#define KEY_1X input_port_6_r(0)&0x20
70#define KEY_STAT input_port_6_r(0)&0x10
71#define KEY_EXP input_port_6_r(0)&8
72#define KEY_POT input_port_6_r(0)&4
73#define KEY_ROOT input_port_6_r(0)&2
74#define KEY_SQUARE input_port_6_r(0)&1
67#define KEY_LN readinputport(6)&0x80
68#define KEY_LOG readinputport(6)&0x40
69#define KEY_1X readinputport(6)&0x20
70#define KEY_STAT readinputport(6)&0x10
71#define KEY_EXP readinputport(6)&8
72#define KEY_POT readinputport(6)&4
73#define KEY_ROOT readinputport(6)&2
74#define KEY_SQUARE readinputport(6)&1
7575
76#define KEY_BRACE_LEFT input_port_7_r(0)&0x80
77#define KEY_BRACE_RIGHT input_port_7_r(0)&0x40
78#define KEY_7 input_port_7_r(0)&0x20
79#define KEY_8 input_port_7_r(0)&0x10
80#define KEY_9 input_port_7_r(0)&8
81#define KEY_DIV input_port_7_r(0)&4
82#define KEY_XM input_port_7_r(0)&2
83#define KEY_4 input_port_7_r(0)&1
76#define KEY_BRACE_LEFT readinputport(7)&0x80
77#define KEY_BRACE_RIGHT readinputport(7)&0x40
78#define KEY_7 readinputport(7)&0x20
79#define KEY_8 readinputport(7)&0x10
80#define KEY_9 readinputport(7)&8
81#define KEY_DIV readinputport(7)&4
82#define KEY_XM readinputport(7)&2
83#define KEY_4 readinputport(7)&1
8484
85#define KEY_5 input_port_8_r(0)&0x80
86#define KEY_6 input_port_8_r(0)&0x40
87#define KEY_MUL input_port_8_r(0)&0x20
88#define KEY_RM input_port_8_r(0)&0x10
89#define KEY_1 input_port_8_r(0)&8
90#define KEY_2 input_port_8_r(0)&4
91#define KEY_3 input_port_8_r(0)&2
92#define KEY_MINUS input_port_8_r(0)&1
85#define KEY_5 readinputport(8)&0x80
86#define KEY_6 readinputport(8)&0x40
87#define KEY_MUL readinputport(8)&0x20
88#define KEY_RM readinputport(8)&0x10
89#define KEY_1 readinputport(8)&8
90#define KEY_2 readinputport(8)&4
91#define KEY_3 readinputport(8)&2
92#define KEY_MINUS readinputport(8)&1
9393
94#define KEY_MPLUS input_port_9_r(0)&0x80
95#define KEY_0 input_port_9_r(0)&0x40
96#define KEY_SIGN input_port_9_r(0)&0x20
97#define KEY_POINT input_port_9_r(0)&0x10
98#define KEY_PLUS input_port_9_r(0)&8
99#define KEY_EQUALS input_port_9_r(0)&4
100#define KEY_RESET input_port_9_r(0)&2
94#define KEY_MPLUS readinputport(9)&0x80
95#define KEY_0 readinputport(9)&0x40
96#define KEY_SIGN readinputport(9)&0x20
97#define KEY_POINT readinputport(9)&0x10
98#define KEY_PLUS readinputport(9)&8
99#define KEY_EQUALS readinputport(9)&4
100#define KEY_RESET readinputport(9)&2
101101
102#define RAM4K (input_port_10_r(0)&0xc0)==0x40
103#define RAM10K (input_port_10_r(0)&0xc0)==0x80
104#define CONTRAST (input_port_10_r(0)&7)
102#define RAM4K (readinputport(10)&0xc0)==0x40
103#define RAM10K (readinputport(10)&0xc0)==0x80
104#define CONTRAST (readinputport(10)&7)
105105
106106
107107/*----------- defined in machine/pc1401.c -----------*/
src/mess/includes/hp48.h
r1877r1878
88#define HP48_H_
99
1010
11#define KEY_A input_port_0_r(0)&0x80
12#define KEY_B input_port_0_r(0)&0x40
13#define KEY_C input_port_0_r(0)&0x20
14#define KEY_D input_port_0_r(0)&0x10
15#define KEY_E input_port_0_r(0)&8
16#define KEY_F input_port_0_r(0)&4
17#define KEY_G input_port_0_r(0)&2
18#define KEY_H input_port_0_r(0)&1
19#define KEY_I input_port_1_r(0)&0x80
20#define KEY_J input_port_1_r(0)&0x40
21#define KEY_K input_port_1_r(0)&0x20
22#define KEY_L input_port_1_r(0)&0x10
23#define KEY_M input_port_1_r(0)&8
24#define KEY_N input_port_1_r(0)&4
25#define KEY_O input_port_1_r(0)&2
26#define KEY_P input_port_1_r(0)&1
27#define KEY_Q input_port_2_r(0)&0x80
28#define KEY_R input_port_2_r(0)&0x40
29#define KEY_S input_port_2_r(0)&0x20
30#define KEY_T input_port_2_r(0)&0x10
31#define KEY_U input_port_2_r(0)&8
32#define KEY_V input_port_2_r(0)&4
33#define KEY_W input_port_2_r(0)&2
34#define KEY_X input_port_2_r(0)&1
35#define KEY_ENTER input_port_3_r(0)&0x80
36#define KEY_Y input_port_3_r(0)&0x40
37#define KEY_Z input_port_3_r(0)&0x20
38#define KEY_DEL input_port_3_r(0)&0x10
39#define KEY_LEFT input_port_3_r(0)&8
40#define KEY_ALPHA input_port_3_r(0)&4
41#define KEY_7 input_port_3_r(0)&2
42#define KEY_8 input_port_3_r(0)&1
43#define KEY_9 input_port_4_r(0)&0x80
44#define KEY_DIVIDE input_port_4_r(0)&0x40
45#define KEY_ORANGE input_port_4_r(0)&0x20
46#define KEY_4 input_port_4_r(0)&0x10
47#define KEY_5 input_port_4_r(0)&8
48#define KEY_6 input_port_4_r(0)&4
49#define KEY_MULTIPLY input_port_4_r(0)&2
50#define KEY_BLUE input_port_4_r(0)&1
51#define KEY_1 input_port_5_r(0)&0x80
52#define KEY_2 input_port_5_r(0)&0x40
53#define KEY_3 input_port_5_r(0)&0x20
54#define KEY_MINUS input_port_5_r(0)&0x10
55#define KEY_ON input_port_5_r(0)&8
56#define KEY_0 input_port_5_r(0)&4
57#define KEY_POINT input_port_5_r(0)&2
58#define KEY_SPC input_port_5_r(0)&1
59#define KEY_PLUS input_port_6_r(0)&0x80
11#define KEY_A readinputport(0)&0x80
12#define KEY_B readinputport(0)&0x40
13#define KEY_C readinputport(0)&0x20
14#define KEY_D readinputport(0)&0x10
15#define KEY_E readinputport(0)&8
16#define KEY_F readinputport(0)&4
17#define KEY_G readinputport(0)&2
18#define KEY_H readinputport(0)&1
19#define KEY_I readinputport(1)&0x80
20#define KEY_J readinputport(1)&0x40
21#define KEY_K readinputport(1)&0x20
22#define KEY_L readinputport(1)&0x10
23#define KEY_M readinputport(1)&8
24#define KEY_N readinputport(1)&4
25#define KEY_O readinputport(1)&2
26#define KEY_P readinputport(1)&1
27#define KEY_Q readinputport(2)&0x80
28#define KEY_R readinputport(2)&0x40
29#define KEY_S readinputport(2)&0x20
30#define KEY_T readinputport(2)&0x10
31#define KEY_U readinputport(2)&8
32#define KEY_V readinputport(2)&4
33#define KEY_W readinputport(2)&2
34#define KEY_X readinputport(2)&1
35#define KEY_ENTER readinputport(3)&0x80
36#define KEY_Y readinputport(3)&0x40
37#define KEY_Z readinputport(3)&0x20
38#define KEY_DEL readinputport(3)&0x10
39#define KEY_LEFT readinputport(3)&8
40#define KEY_ALPHA readinputport(3)&4
41#define KEY_7 readinputport(3)&2
42#define KEY_8 readinputport(3)&1
43#define KEY_9 readinputport(4)&0x80
44#define KEY_DIVIDE readinputport(4)&0x40
45#define KEY_ORANGE readinputport(4)&0x20
46#define KEY_4 readinputport(4)&0x10
47#define KEY_5 readinputport(4)&8
48#define KEY_6 readinputport(4)&4
49#define KEY_MULTIPLY readinputport(4)&2
50#define KEY_BLUE readinputport(4)&1
51#define KEY_1 readinputport(5)&0x80
52#define KEY_2 readinputport(5)&0x40
53#define KEY_3 readinputport(5)&0x20
54#define KEY_MINUS readinputport(5)&0x10
55#define KEY_ON readinputport(5)&8
56#define KEY_0 readinputport(5)&4
57#define KEY_POINT readinputport(5)&2
58#define KEY_SPC readinputport(5)&1
59#define KEY_PLUS readinputport(6)&0x80
6060
6161
6262/*----------- defined in machine/hp48.c -----------*/
src/mess/includes/c65.h
r1877r1878
88#define C65_H_
99
1010
11#define C65_KEY_TAB (input_port_10_word_r(0,0)&0x8000)
12#define C65_KEY_CTRL (input_port_10_word_r(0,0)&1)
11#define C65_KEY_TAB (readinputport(10)&0x8000)
12#define C65_KEY_CTRL (readinputport(10)&1)
1313
14#define C65_KEY_RIGHT_SHIFT ((input_port_12_r(0)&0x20)\
14#define C65_KEY_RIGHT_SHIFT ((readinputport(12)&0x20)\
1515          ||C65_KEY_CURSOR_UP||C65_KEY_CURSOR_LEFT)
16#define C65_KEY_CURSOR_UP (input_port_12_r(0)&0x10)
17#define C65_KEY_SPACE (input_port_12_r(0)&8)
18#define C65_KEY_CURSOR_LEFT (input_port_12_r(0)&4)
19#define C65_KEY_CURSOR_DOWN ((input_port_12_r(0)&2)||C65_KEY_CURSOR_UP)
20#define C65_KEY_CURSOR_RIGHT ((input_port_12_r(0)&1)||C65_KEY_CURSOR_LEFT)
16#define C65_KEY_CURSOR_UP (readinputport(12)&0x10)
17#define C65_KEY_SPACE (readinputport(12)&8)
18#define C65_KEY_CURSOR_LEFT (readinputport(12)&4)
19#define C65_KEY_CURSOR_DOWN ((readinputport(12)&2)||C65_KEY_CURSOR_UP)
20#define C65_KEY_CURSOR_RIGHT ((readinputport(12)&1)||C65_KEY_CURSOR_LEFT)
2121
22#define C65_KEY_STOP (input_port_13_word_r(0,0)&0x8000)
23#define C65_KEY_ESCAPE (input_port_13_word_r(0,0)&0x4000)
24#define C65_KEY_ALT (input_port_13_word_r(0,0)&0x2000)
25#define C65_KEY_DIN (input_port_13_word_r(0,0)&0x1000)
26#define C65_KEY_NOSCRL (input_port_13_word_r(0,0)&0x0800)
27#define C65_KEY_F1 (input_port_13_word_r(0,0)&0x0400)
28#define C65_KEY_F3 (input_port_13_word_r(0,0)&0x0200)
29#define C65_KEY_F5 (input_port_13_word_r(0,0)&0x0100)
30#define C65_KEY_F7 (input_port_13_word_r(0,0)&0x0080)
31#define C65_KEY_F9 (input_port_13_word_r(0,0)&0x0040)
32#define C65_KEY_F11 (input_port_13_word_r(0,0)&0x0020)
33#define C65_KEY_F13 (input_port_13_word_r(0,0)&0x0010)
34#define C65_KEY_HELP (input_port_13_word_r(0,0)&0x0008)
22#define C65_KEY_STOP (readinputport(13)&0x8000)
23#define C65_KEY_ESCAPE (readinputport(13)&0x4000)
24#define C65_KEY_ALT (readinputport(13)&0x2000)
25#define C65_KEY_DIN (readinputport(13)&0x1000)
26#define C65_KEY_NOSCRL (readinputport(13)&0x0800)
27#define C65_KEY_F1 (readinputport(13)&0x0400)
28#define C65_KEY_F3 (readinputport(13)&0x0200)
29#define C65_KEY_F5 (readinputport(13)&0x0100)
30#define C65_KEY_F7 (readinputport(13)&0x0080)
31#define C65_KEY_F9 (readinputport(13)&0x0040)
32#define C65_KEY_F11 (readinputport(13)&0x0020)
33#define C65_KEY_F13 (readinputport(13)&0x0010)
34#define C65_KEY_HELP (readinputport(13)&0x0008)
3535
3636
3737/*----------- defined in machine/c65.c -----------*/
src/mess/includes/cbmb.h
r1877r1878
7777#define JOYSTICK2 ((input_port_20_word_r(0,0)&0xe00)==0x200)
7878#define JOYSTICK_SWAP      (input_port_20_word_r(0,0)&0x100)
7979
80#define PADDLE1_BUTTON   ((input_port_14_word_r(0,0)&0x100))
81#define PADDLE1_VALUE   (input_port_14_word_r(0,0)&0xff)
80#define PADDLE1_BUTTON   ((readinputport(14)&0x100))
81#define PADDLE1_VALUE   (readinputport(14)&0xff)
8282#define PADDLE2_BUTTON   ((input_port_15_word_r(0,0)&0x100))
8383#define PADDLE2_VALUE   (input_port_15_word_r(0,0)&0xff)
8484#define PADDLE3_BUTTON   ((input_port_16_word_r(0,0)&0x100))
r1877r1878
9090#define LIGHTPEN_X_VALUE ((readinputport(18)&0x3ff)&~1)   /* effectiv resolution */
9191#define LIGHTPEN_Y_VALUE (readinputport(19)&~1)   /* effectiv resolution */
9292
93#define JOYSTICK_1_LEFT   ((input_port_13_word_r(0,0)&0x8000))
94#define JOYSTICK_1_RIGHT   ((input_port_13_word_r(0,0)&0x4000))
95#define JOYSTICK_1_UP      ((input_port_13_word_r(0,0)&0x2000))
96#define JOYSTICK_1_DOWN   ((input_port_13_word_r(0,0)&0x1000))
97#define JOYSTICK_1_BUTTON ((input_port_13_word_r(0,0)&0x800))
98#define JOYSTICK_1_BUTTON2 ((input_port_13_word_r(0,0)&0x400))
99#define JOYSTICK_2_LEFT   ((input_port_13_word_r(0,0)&0x80))
100#define JOYSTICK_2_RIGHT   ((input_port_13_word_r(0,0)&0x40))
101#define JOYSTICK_2_UP      ((input_port_13_word_r(0,0)&0x20))
102#define JOYSTICK_2_DOWN   ((input_port_13_word_r(0,0)&0x10))
103#define JOYSTICK_2_BUTTON ((input_port_13_word_r(0,0)&8))
104#define JOYSTICK_2_BUTTON2 ((input_port_13_word_r(0,0)&4))
93#define JOYSTICK_1_LEFT   ((readinputport(13)&0x8000))
94#define JOYSTICK_1_RIGHT   ((readinputport(13)&0x4000))
95#define JOYSTICK_1_UP      ((readinputport(13)&0x2000))
96#define JOYSTICK_1_DOWN   ((readinputport(13)&0x1000))
97#define JOYSTICK_1_BUTTON ((readinputport(13)&0x800))
98#define JOYSTICK_1_BUTTON2 ((readinputport(13)&0x400))
99#define JOYSTICK_2_LEFT   ((readinputport(13)&0x80))
100#define JOYSTICK_2_RIGHT   ((readinputport(13)&0x40))
101#define JOYSTICK_2_UP      ((readinputport(13)&0x20))
102#define JOYSTICK_2_DOWN   ((readinputport(13)&0x10))
103#define JOYSTICK_2_BUTTON ((readinputport(13)&8))
104#define JOYSTICK_2_BUTTON2 ((readinputport(13)&4))
105105
106106#define IEEE8ON   0
107107#define IEEE9ON   0
r1877r1878
130130
131131/*----------- defined in video/cbmb.c -----------*/
132132
133READ8_HANDLER( cbmb_mc6845_register_r );
134WRITE8_HANDLER( cbmb_mc6845_register_w );
135WRITE8_HANDLER( cbmb_mc6845_address_w );
136133VIDEO_START( cbmb_crtc );
137134VIDEO_UPDATE( cbmb_crtc );
138135MC6845_UPDATE_ROW( cbm600_update_row );
src/mess/includes/pc1350.h
r1877r1878
1010#define PC1350_H_
1111
1212
13#define PC1350_KEY_OFF input_port_0_r(0)&0x80
14#define PC1350_KEY_DOWN input_port_0_r(0)&0x40
15#define PC1350_KEY_UP input_port_0_r(0)&0x20
16#define PC1350_KEY_MODE input_port_0_r(0)&0x10
17#define PC1350_KEY_CLS input_port_0_r(0)&8
18#define PC1350_KEY_LEFT input_port_0_r(0)&4
19#define PC1350_KEY_RIGHT input_port_0_r(0)&2
20#define PC1350_KEY_DEL input_port_0_r(0)&1
13#define PC1350_KEY_OFF readinputport(0)&0x80
14#define PC1350_KEY_DOWN readinputport(0)&0x40
15#define PC1350_KEY_UP readinputport(0)&0x20
16#define PC1350_KEY_MODE readinputport(0)&0x10
17#define PC1350_KEY_CLS readinputport(0)&8
18#define PC1350_KEY_LEFT readinputport(0)&4
19#define PC1350_KEY_RIGHT readinputport(0)&2
20#define PC1350_KEY_DEL readinputport(0)&1
2121
22#define PC1350_KEY_INS input_port_1_r(0)&0x80
23#define PC1350_KEY_BRK input_port_1_r(0)&0x40
24#define PC1350_KEY_RSHIFT input_port_1_r(0)&0x20
25#define PC1350_KEY_7 input_port_1_r(0)&0x10
26#define PC1350_KEY_8 input_port_1_r(0)&8
27#define PC1350_KEY_9 input_port_1_r(0)&4
28#define PC1350_KEY_BRACE_OPEN input_port_1_r(0)&2
29#define PC1350_KEY_BRACE_CLOSE input_port_1_r(0)&1
22#define PC1350_KEY_INS readinputport(1)&0x80
23#define PC1350_KEY_BRK readinputport(1)&0x40
24#define PC1350_KEY_RSHIFT readinputport(1)&0x20
25#define PC1350_KEY_7 readinputport(1)&0x10
26#define PC1350_KEY_8 readinputport(1)&8
27#define PC1350_KEY_9 readinputport(1)&4
28#define PC1350_KEY_BRACE_OPEN readinputport(1)&2
29#define PC1350_KEY_BRACE_CLOSE readinputport(1)&1
3030
31#define PC1350_KEY_4 input_port_2_r(0)&0x80
32#define PC1350_KEY_5 input_port_2_r(0)&0x40
33#define PC1350_KEY_6 input_port_2_r(0)&0x20
34#define PC1350_KEY_SLASH input_port_2_r(0)&0x10
35#define PC1350_KEY_COLON input_port_2_r(0)&8
36#define PC1350_KEY_1 input_port_2_r(0)&4
37#define PC1350_KEY_2 input_port_2_r(0)&2
38#define PC1350_KEY_3 input_port_2_r(0)&1
31#define PC1350_KEY_4 readinputport(2)&0x80
32#define PC1350_KEY_5 readinputport(2)&0x40
33#define PC1350_KEY_6 readinputport(2)&0x20
34#define PC1350_KEY_SLASH readinputport(2)&0x10
35#define PC1350_KEY_COLON readinputport(2)&8
36#define PC1350_KEY_1 readinputport(2)&4
37#define PC1350_KEY_2 readinputport(2)&2
38#define PC1350_KEY_3 readinputport(2)&1
3939
40#define PC1350_KEY_ASTERIX input_port_3_r(0)&0x80
41#define PC1350_KEY_SEMICOLON input_port_3_r(0)&0x40
42#define PC1350_KEY_0 input_port_3_r(0)&0x20
43#define PC1350_KEY_POINT input_port_3_r(0)&0x10
44#define PC1350_KEY_PLUS input_port_3_r(0)&8
45#define PC1350_KEY_MINUS input_port_3_r(0)&4
46#define PC1350_KEY_COMMA input_port_3_r(0)&2
47#define PC1350_KEY_LSHIFT input_port_3_r(0)&1
40#define PC1350_KEY_ASTERIX readinputport(3)&0x80
41#define PC1350_KEY_SEMICOLON readinputport(3)&0x40
42#define PC1350_KEY_0 readinputport(3)&0x20
43#define PC1350_KEY_POINT readinputport(3)&0x10
44#define PC1350_KEY_PLUS readinputport(3)&8
45#define PC1350_KEY_MINUS readinputport(3)&4
46#define PC1350_KEY_COMMA readinputport(3)&2
47#define PC1350_KEY_LSHIFT readinputport(3)&1
4848
49#define PC1350_KEY_Q input_port_4_r(0)&0x80
50#define PC1350_KEY_W input_port_4_r(0)&0x40
51#define PC1350_KEY_E input_port_4_r(0)&0x20
52#define PC1350_KEY_R input_port_4_r(0)&0x10
53#define PC1350_KEY_T input_port_4_r(0)&8
54#define PC1350_KEY_Y input_port_4_r(0)&4
55#define PC1350_KEY_U input_port_4_r(0)&2
56#define PC1350_KEY_I input_port_4_r(0)&1
49#define PC1350_KEY_Q readinputport(4)&0x80
50#define PC1350_KEY_W readinputport(4)&0x40
51#define PC1350_KEY_E readinputport(4)&0x20
52#define PC1350_KEY_R readinputport(4)&0x10
53#define PC1350_KEY_T readinputport(4)&8
54#define PC1350_KEY_Y readinputport(4)&4
55#define PC1350_KEY_U readinputport(4)&2
56#define PC1350_KEY_I readinputport(4)&1
5757
58#define PC1350_KEY_O input_port_5_r(0)&0x80
59#define PC1350_KEY_P input_port_5_r(0)&0x40
60#define PC1350_KEY_DEF input_port_5_r(0)&0x20
61#define PC1350_KEY_A input_port_5_r(0)&0x10
62#define PC1350_KEY_S input_port_5_r(0)&8
63#define PC1350_KEY_D input_port_5_r(0)&4
64#define PC1350_KEY_F input_port_5_r(0)&2
65#define PC1350_KEY_G input_port_5_r(0)&1
58#define PC1350_KEY_O readinputport(5)&0x80
59#define PC1350_KEY_P readinputport(5)&0x40
60#define PC1350_KEY_DEF readinputport(5)&0x20
61#define PC1350_KEY_A readinputport(5)&0x10
62#define PC1350_KEY_S readinputport(5)&8
63#define PC1350_KEY_D readinputport(5)&4
64#define PC1350_KEY_F readinputport(5)&2
65#define PC1350_KEY_G readinputport(5)&1
6666
67#define PC1350_KEY_H input_port_6_r(0)&0x80
68#define PC1350_KEY_J input_port_6_r(0)&0x40
69#define PC1350_KEY_K input_port_6_r(0)&0x20
70#define PC1350_KEY_L input_port_6_r(0)&0x10
71#define PC1350_KEY_EQUALS input_port_6_r(0)&8
72#define PC1350_KEY_SML input_port_6_r(0)&4
73#define PC1350_KEY_Z input_port_6_r(0)&2
74#define PC1350_KEY_X input_port_6_r(0)&1
67#define PC1350_KEY_H readinputport(6)&0x80
68#define PC1350_KEY_J readinputport(6)&0x40
69#define PC1350_KEY_K readinputport(6)&0x20
70#define PC1350_KEY_L readinputport(6)&0x10
71#define PC1350_KEY_EQUALS readinputport(6)&8
72#define PC1350_KEY_SML readinputport(6)&4
73#define PC1350_KEY_Z readinputport(6)&2
74#define PC1350_KEY_X readinputport(6)&1
7575
76#define PC1350_KEY_C input_port_7_r(0)&0x80
77#define PC1350_KEY_V input_port_7_r(0)&0x40
78#define PC1350_KEY_B input_port_7_r(0)&0x20
79#define PC1350_KEY_N input_port_7_r(0)&0x10
80#define PC1350_KEY_M input_port_7_r(0)&8
81#define PC1350_KEY_SPACE input_port_7_r(0)&4
82#define PC1350_KEY_ENTER input_port_7_r(0)&2
76#define PC1350_KEY_C readinputport(7)&0x80
77#define PC1350_KEY_V readinputport(7)&0x40
78#define PC1350_KEY_B readinputport(7)&0x20
79#define PC1350_KEY_N readinputport(7)&0x10
80#define PC1350_KEY_M readinputport(7)&8
81#define PC1350_KEY_SPACE readinputport(7)&4
82#define PC1350_KEY_ENTER readinputport(7)&2
8383
84#define PC1350_CONTRAST (input_port_8_r(0)&7)
84#define PC1350_CONTRAST (readinputport(8)&7)
8585
8686
8787/*----------- defined in machine/pc1350.c -----------*/
src/mess/includes/coco.h
r1877r1878
5555DEVICE_UNLOAD(coco_rom);
5656DEVICE_UNLOAD(coco3_rom);
5757
58INPUT_CHANGED(coco_keyboard_changed);
59
5860SNAPSHOT_LOAD ( coco_pak );
5961SNAPSHOT_LOAD ( coco3_pak );
6062READ8_HANDLER ( coco3_mmu_r );
src/mess/includes/gb.h
r1877r1878
127127
128128READ8_HANDLER( gb_video_r );
129129WRITE8_HANDLER( gb_video_w );
130void gb_video_init( int mode );
130void gb_video_init( running_machine *machine, int mode );
131131
132132
133133#endif /* GB_H_ */
src/mess/includes/c128.h
r1877r1878
1515#define C128_H_
1616
1717
18#define C128_MAIN_MEMORY      (input_port_8_r(0)&0x300)
18#define C128_MAIN_MEMORY      (readinputport(8)&0x300)
1919#define RAM128KB (0)
2020#define RAM256KB (0x100)
2121#define RAM1MB (0x200)
2222
23#define VDC_RAM_64KBYTE      (input_port_8_r(0)&0x40) /* else 16KB */
24#define MONITOR_TV      (input_port_8_r(0)&0x20) /* else RGBI */
23#define VDC_RAM_64KBYTE      (readinputport(8)&0x40) /* else 16KB */
24#define MONITOR_TV      (readinputport(8)&0x20) /* else RGBI */
2525
26#define C128_KEY_RIGHT_SHIFT ((input_port_12_r(0)&0x20)\
26#define C128_KEY_RIGHT_SHIFT ((readinputport(12)&0x20)\
2727          ||C128_KEY_CURSOR_UP||C128_KEY_CURSOR_LEFT)
2828
29#define C128_KEY_CURSOR_DOWN ((input_port_12_r(0)&0x10)||C128_KEY_CURSOR_UP)
30#define C128_KEY_CURSOR_RIGHT ((input_port_12_r(0)&8)||C128_KEY_CURSOR_LEFT)
29#define C128_KEY_CURSOR_DOWN ((readinputport(12)&0x10)||C128_KEY_CURSOR_UP)
30#define C128_KEY_CURSOR_RIGHT ((readinputport(12)&8)||C128_KEY_CURSOR_LEFT)
3131
32#define KEY_ESCAPE (input_port_13_word_r(0,0)&0x8000)
33#define KEY_TAB (input_port_13_word_r(0,0)&0x4000)
34#define KEY_ALT (input_port_13_word_r(0,0)&0x2000)
35#define KEY_DIN (input_port_13_word_r(0,0)&0x1000)
32#define KEY_ESCAPE (readinputport(13)&0x8000)
33#define KEY_TAB (readinputport(13)&0x4000)
34#define KEY_ALT (readinputport(13)&0x2000)
35#define KEY_DIN (readinputport(13)&0x1000)
3636
37#define KEY_HELP (input_port_13_word_r(0,0)&0x0800)
38#define KEY_LINEFEED (input_port_13_word_r(0,0)&0x0400)
39#define KEY_4080 (input_port_13_word_r(0,0)&0x0200)
40#define KEY_NOSCRL (input_port_13_word_r(0,0)&0x0100)
37#define KEY_HELP (readinputport(13)&0x0800)
38#define KEY_LINEFEED (readinputport(13)&0x0400)
39#define KEY_4080 (readinputport(13)&0x0200)
40#define KEY_NOSCRL (readinputport(13)&0x0100)
4141
42#define KEY_UP (input_port_13_word_r(0,0)&0x0080)
43#define KEY_DOWN (input_port_13_word_r(0,0)&0x0040)
44#define KEY_LEFT (input_port_13_word_r(0,0)&0x0020)
45#define KEY_RIGHT (input_port_13_word_r(0,0)&0x0010)
42#define KEY_UP (readinputport(13)&0x0080)
43#define KEY_DOWN (readinputport(13)&0x0040)
44#define KEY_LEFT (readinputport(13)&0x0020)
45#define KEY_RIGHT (readinputport(13)&0x0010)
4646
47#define C128_KEY_F1 (input_port_13_word_r(0,0)&0x0008)
48#define C128_KEY_F3 (input_port_13_word_r(0,0)&0x0004)
49#define C128_KEY_F5 (input_port_13_word_r(0,0)&0x0002)
50#define C128_KEY_F7 (input_port_13_word_r(0,0)&0x0001)
47#define C128_KEY_F1 (readinputport(13)&0x0008)
48#define C128_KEY_F3 (readinputport(13)&0x0004)
49#define C128_KEY_F5 (readinputport(13)&0x0002)
50#define C128_KEY_F7 (readinputport(13)&0x0001)
5151
52#define KEY_NUM7 (input_port_14_word_r(0,0)&0x8000)
53#define KEY_NUM8 (input_port_14_word_r(0,0)&0x4000)
54#define KEY_NUM9 (input_port_14_word_r(0,0)&0x2000)
55#define KEY_NUMPLUS (input_port_14_word_r(0,0)&0x1000)
56#define KEY_NUM4 (input_port_14_word_r(0,0)&0x800)
57#define KEY_NUM5 (input_port_14_word_r(0,0)&0x400)
58#define KEY_NUM6 (input_port_14_word_r(0,0)&0x200)
59#define KEY_NUMMINUS (input_port_14_word_r(0,0)&0x100)
60#define KEY_NUM1 (input_port_14_word_r(0,0)&0x80)
61#define KEY_NUM2 (input_port_14_word_r(0,0)&0x40)
62#define KEY_NUM3 (input_port_14_word_r(0,0)&0x20)
63#define KEY_NUM0 (input_port_14_word_r(0,0)&0x10)
64#define KEY_NUMPOINT (input_port_14_word_r(0,0)&8)
65#define KEY_NUMENTER (input_port_14_word_r(0,0)&4)
66#define C128_KEY_CURSOR_UP (input_port_14_word_r(0,0)&2)
67#define C128_KEY_CURSOR_LEFT (input_port_14_word_r(0,0)&1)
52#define KEY_NUM7 (readinputport(14)&0x8000)
53#define KEY_NUM8 (readinputport(14)&0x4000)
54#define KEY_NUM9 (readinputport(14)&0x2000)
55#define KEY_NUMPLUS (readinputport(14)&0x1000)
56#define KEY_NUM4 (readinputport(14)&0x800)
57#define KEY_NUM5 (readinputport(14)&0x400)
58#define KEY_NUM6 (readinputport(14)&0x200)
59#define KEY_NUMMINUS (readinputport(14)&0x100)
60#define KEY_NUM1 (readinputport(14)&0x80)
61#define KEY_NUM2 (readinputport(14)&0x40)
62#define KEY_NUM3 (readinputport(14)&0x20)
63#define KEY_NUM0 (readinputport(14)&0x10)
64#define KEY_NUMPOINT (readinputport(14)&8)
65#define KEY_NUMENTER (readinputport(14)&4)
66#define C128_KEY_CURSOR_UP (readinputport(14)&2)
67#define C128_KEY_CURSOR_LEFT (readinputport(14)&1)
6868
6969
7070/*----------- defined in machine/c128.c -----------*/
r1877r1878
7878extern UINT8 *c128_external_function;
7979extern UINT8 *c128_vdcram;
8080
81 READ8_HANDLER(c128_m6510_port_r);
81READ8_HANDLER(c128_m6510_port_r);
8282WRITE8_HANDLER(c128_mmu8722_port_w);
83 READ8_HANDLER(c128_mmu8722_port_r);
83READ8_HANDLER(c128_mmu8722_port_r);
8484WRITE8_HANDLER(c128_mmu8722_ff00_w);
85 READ8_HANDLER(c128_mmu8722_ff00_r);
85READ8_HANDLER(c128_mmu8722_ff00_r);
8686int c128_capslock_r (void);
8787WRITE8_HANDLER(c128_write_0000);
8888WRITE8_HANDLER(c128_write_1000);
src/mess/includes/pet.h
r1877r1878
99
1010#include "video/mc6845.h"
1111
12READ8_HANDLER( pet_mc6845_register_r );
13WRITE8_HANDLER( pet_mc6845_register_w );
14WRITE8_HANDLER( pet_mc6845_address_w );
15
1612/*----------- defined in video/pet.c -----------*/
1713
1814/* call to init videodriver */
r1877r1878
2925
3026/*----------- defined in machine/pet.c -----------*/
3127
32#define CBM8096_MEMORY (input_port_11_r(0)&8)
33#define M6809_SELECT (input_port_11_r(0)&4)
34#define IEEE8ON (input_port_11_r(0)&2)
35#define IEEE9ON (input_port_11_r(0)&1)
28#define CBM8096_MEMORY (readinputport(11)&8)
29#define M6809_SELECT (readinputport(11)&4)
30#define IEEE8ON (readinputport(11)&2)
31#define IEEE9ON (readinputport(11)&1)
3632
3733extern UINT8 *pet_memory;
3834extern UINT8 *pet_videoram;
src/mess/includes/c16.h
r1877r1878
88#define C16_H_
99
1010
11#define JOYSTICK1_PORT (input_port_7_r(0)&0x80)
12#define JOYSTICK2_PORT (input_port_7_r(0)&0x40)
11#define JOYSTICK1_PORT (readinputport(7)&0x80)
12#define JOYSTICK2_PORT (readinputport(7)&0x40)
1313
14#define JOYSTICK_2_LEFT   ((input_port_1_r(0)&0x80))
15#define JOYSTICK_2_RIGHT   ((input_port_1_r(0)&0x40))
16#define JOYSTICK_2_UP      ((input_port_1_r(0)&0x20))
17#define JOYSTICK_2_DOWN   ((input_port_1_r(0)&0x10))
18#define JOYSTICK_2_BUTTON ((input_port_1_r(0)&8))
14#define JOYSTICK_2_LEFT   ((readinputport(1)&0x80))
15#define JOYSTICK_2_RIGHT   ((readinputport(1)&0x40))
16#define JOYSTICK_2_UP      ((readinputport(1)&0x20))
17#define JOYSTICK_2_DOWN   ((readinputport(1)&0x10))
18#define JOYSTICK_2_BUTTON ((readinputport(1)&8))
1919
20#define JOYSTICK_1_LEFT   ((input_port_0_r(0)&0x80))
21#define JOYSTICK_1_RIGHT   ((input_port_0_r(0)&0x40))
22#define JOYSTICK_1_UP      ((input_port_0_r(0)&0x20))
23#define JOYSTICK_1_DOWN   ((input_port_0_r(0)&0x10))
24#define JOYSTICK_1_BUTTON ((input_port_0_r(0)&8))
20#define JOYSTICK_1_LEFT   ((readinputport(0)&0x80))
21#define JOYSTICK_1_RIGHT   ((readinputport(0)&0x40))
22#define JOYSTICK_1_UP      ((readinputport(0)&0x20))
23#define JOYSTICK_1_DOWN   ((readinputport(0)&0x10))
24#define JOYSTICK_1_BUTTON ((readinputport(0)&8))
2525
26#define KEY_ESC (input_port_2_word_r(0,0)&0x8000)
27#define KEY_1 (input_port_2_word_r(0,0)&0x4000)
28#define KEY_2 (input_port_2_word_r(0,0)&0x2000)
29#define KEY_3 (input_port_2_word_r(0,0)&0x1000)
30#define KEY_4 (input_port_2_word_r(0,0)&0x800)
31#define KEY_5 (input_port_2_word_r(0,0)&0x400)
32#define KEY_6 (input_port_2_word_r(0,0)&0x200)
33#define KEY_7 (input_port_2_word_r(0,0)&0x100)
34#define KEY_8 (input_port_2_word_r(0,0)&0x80)
35#define KEY_9 (input_port_2_word_r(0,0)&0x40)
36#define KEY_0 (input_port_2_word_r(0,0)&0x20)
37#define KEY_LEFT (input_port_2_word_r(0,0)&0x10)
38#define KEY_RIGHT (input_port_2_word_r(0,0)&8)
39#define KEY_UP (input_port_2_word_r(0,0)&4)
40#define KEY_DOWN (input_port_2_word_r(0,0)&2)
41#define KEY_DEL (input_port_2_word_r(0,0)&1)
26#define KEY_ESC (readinputport(2)&0x8000)
27#define KEY_1 (readinputport(2)&0x4000)
28#define KEY_2 (readinputport(2)&0x2000)
29#define KEY_3 (readinputport(2)&0x1000)
30#define KEY_4 (readinputport(2)&0x800)
31#define KEY_5 (readinputport(2)&0x400)
32#define KEY_6 (readinputport(2)&0x200)
33#define KEY_7 (readinputport(2)&0x100)
34#define KEY_8 (readinputport(2)&0x80)
35#define KEY_9 (readinputport(2)&0x40)
36#define KEY_0 (readinputport(2)&0x20)
37#define KEY_LEFT (readinputport(2)&0x10)
38#define KEY_RIGHT (readinputport(2)&8)
39#define KEY_UP (readinputport(2)&4)
40#define KEY_DOWN (readinputport(2)&2)
41#define KEY_DEL (readinputport(2)&1)
4242
43#define KEY_CTRL (input_port_3_word_r(0,0)&0x8000)
44#define KEY_Q (input_port_3_word_r(0,0)&0x4000)
45#define KEY_W (input_port_3_word_r(0,0)&0x2000)
46#define KEY_E (input_port_3_word_r(0,0)&0x1000)
47#define KEY_R (input_port_3_word_r(0,0)&0x800)
48#define KEY_T (input_port_3_word_r(0,0)&0x400)
49#define KEY_Y (input_port_3_word_r(0,0)&0x200)
50#define KEY_U (input_port_3_word_r(0,0)&0x100)
51#define KEY_I (input_port_3_word_r(0,0)&0x80)
52#define KEY_O (input_port_3_word_r(0,0)&0x40)
53#define KEY_P (input_port_3_word_r(0,0)&0x20)
54#define KEY_ATSIGN (input_port_3_word_r(0,0)&0x10)
55#define KEY_PLUS (input_port_3_word_r(0,0)&8)
56#define KEY_MINUS (input_port_3_word_r(0,0)&4)
57#define KEY_HOME (input_port_3_word_r(0,0)&2)
58#define KEY_STOP (input_port_3_word_r(0,0)&1)
43#define KEY_CTRL (readinputport(3)&0x8000)
44#define KEY_Q (readinputport(3)&0x4000)
45#define KEY_W (readinputport(3)&0x2000)
46#define KEY_E (readinputport(3)&0x1000)
47#define KEY_R (readinputport(3)&0x800)
48#define KEY_T (readinputport(3)&0x400)
49#define KEY_Y (readinputport(3)&0x200)
50#define KEY_U (readinputport(3)&0x100)
51#define KEY_I (readinputport(3)&0x80)
52#define KEY_O (readinputport(3)&0x40)
53#define KEY_P (readinputport(3)&0x20)
54#define KEY_ATSIGN (readinputport(3)&0x10)
55#define KEY_PLUS (readinputport(3)&8)
56#define KEY_MINUS (readinputport(3)&4)
57#define KEY_HOME (readinputport(3)&2)
58#define KEY_STOP (readinputport(3)&1)
5959
60#define KEY_SHIFTLOCK (input_port_4_word_r(0,0)&0x8000)
61#define KEY_A (input_port_4_word_r(0,0)&0x4000)
62#define KEY_S (input_port_4_word_r(0,0)&0x2000)
63#define KEY_D (input_port_4_word_r(0,0)&0x1000)
64#define KEY_F (input_port_4_word_r(0,0)&0x800)
65#define KEY_G (input_port_4_word_r(0,0)&0x400)
66#define KEY_H (input_port_4_word_r(0,0)&0x200)
67#define KEY_J (input_port_4_word_r(0,0)&0x100)
68#define KEY_K (input_port_4_word_r(0,0)&0x80)
69#define KEY_L (input_port_4_word_r(0,0)&0x40)
70#define KEY_SEMICOLON (input_port_4_word_r(0,0)&0x20)
71#define KEY_COLON (input_port_4_word_r(0,0)&0x10)
72#define KEY_ASTERIX (input_port_4_word_r(0,0)&8)
73#define KEY_RETURN (input_port_4_word_r(0,0)&4)
74#define KEY_CBM (input_port_4_word_r(0,0)&2)
75#define KEY_LEFT_SHIFT (input_port_4_word_r(0,0)&1)
60#define KEY_SHIFTLOCK (readinputport(4)&0x8000)
61#define KEY_A (readinputport(4)&0x4000)
62#define KEY_S (readinputport(4)&0x2000)
63#define KEY_D (readinputport(4)&0x1000)
64#define KEY_F (readinputport(4)&0x800)
65#define KEY_G (readinputport(4)&0x400)
66#define KEY_H (readinputport(4)&0x200)
67#define KEY_J (readinputport(4)&0x100)
68#define KEY_K (readinputport(4)&0x80)
69#define KEY_L (readinputport(4)&0x40)
70#define KEY_SEMICOLON (readinputport(4)&0x20)
71#define KEY_COLON (readinputport(4)&0x10)
72#define KEY_ASTERIX (readinputport(4)&8)
73#define KEY_RETURN (readinputport(4)&4)
74#define KEY_CBM (readinputport(4)&2)
75#define KEY_LEFT_SHIFT (readinputport(4)&1)
7676
7777
78#define KEY_Z (input_port_5_word_r(0,0)&0x8000)
79#define KEY_X (input_port_5_word_r(0,0)&0x4000)
80#define KEY_C (input_port_5_word_r(0,0)&0x2000)
81#define KEY_V (input_port_5_word_r(0,0)&0x1000)
82#define KEY_B (input_port_5_word_r(0,0)&0x800)
83#define KEY_N (input_port_5_word_r(0,0)&0x400)
84#define KEY_M (input_port_5_word_r(0,0)&0x200)
85#define KEY_COMMA (input_port_5_word_r(0,0)&0x100)
86#define KEY_POINT (input_port_5_word_r(0,0)&0x80)
87#define KEY_SLASH (input_port_5_word_r(0,0)&0x40)
88#define KEY_RIGHT_SHIFT (input_port_5_word_r(0,0)&0x20)
89#define KEY_POUND (input_port_5_word_r(0,0)&0x10)
90#define KEY_EQUALS (input_port_5_word_r(0,0)&8)
91#define KEY_SPACE (input_port_5_word_r(0,0)&4)
92#define KEY_F1 (input_port_5_word_r(0,0)&2)
93#define KEY_F2 (input_port_5_word_r(0,0)&1)
78#define KEY_Z (readinputport(5)&0x8000)
79#define KEY_X (readinputport(5)&0x4000)
80#define KEY_C (readinputport(5)&0x2000)
81#define KEY_V (readinputport(5)&0x1000)
82#define KEY_B (readinputport(5)&0x800)
83#define KEY_N (readinputport(5)&0x400)
84#define KEY_M (readinputport(5)&0x200)
85#define KEY_COMMA (readinputport(5)&0x100)
86#define KEY_POINT (readinputport(5)&0x80)
87#define KEY_SLASH (readinputport(5)&0x40)
88#define KEY_RIGHT_SHIFT (readinputport(5)&0x20)
89#define KEY_POUND (readinputport(5)&0x10)
90#define KEY_EQUALS (readinputport(5)&8)
91#define KEY_SPACE (readinputport(5)&4)
92#define KEY_F1 (readinputport(5)&2)
93#define KEY_F2 (readinputport(5)&1)
9494
95#define KEY_F3 (input_port_6_word_r(0,0)&0x8000)
96#define KEY_HELP (input_port_6_word_r(0,0)&0x4000)
95#define KEY_F3 (readinputport(6)&0x8000)
96#define KEY_HELP (readinputport(6)&0x4000)
9797
98#define JOYSTICK_SWAP (input_port_6_word_r(0,0)&0x2000)
98#define JOYSTICK_SWAP (readinputport(6)&0x2000)
9999
100#define DATASSETTE_PLAY      (input_port_6_word_r(0,0)&4)
101#define DATASSETTE_RECORD   (input_port_6_word_r(0,0)&2)
102#define DATASSETTE_STOP      (input_port_6_word_r(0,0)&1)
100#define DATASSETTE_PLAY      (readinputport(6)&4)
101#define DATASSETTE_RECORD   (readinputport(6)&2)
102#define DATASSETTE_STOP      (readinputport(6)&1)
103103
104#define QUICKLOAD      (input_port_6_word_r(0,0)&8)
104#define QUICKLOAD      (readinputport(6)&8)
105105
106106#define KEY_SHIFT (KEY_LEFT_SHIFT||KEY_RIGHT_SHIFT||KEY_SHIFTLOCK)
107107
108#define DATASSETTE (input_port_7_r(0)&0x20)
109#define DATASSETTE_TONE (input_port_7_r(0)&0x10)
108#define DATASSETTE (readinputport(7)&0x20)
109#define DATASSETTE_TONE (readinputport(7)&0x10)
110110
111#define NO_REAL_FLOPPY ((input_port_8_r(0)&0xc0)==0)
112#define REAL_C1551 ((input_port_8_r(0)&0xc0)==0x40)
113#define REAL_VC1541 ((input_port_8_r(0)&0xc0)==0x80)
111#define NO_REAL_FLOPPY ((readinputport(8)&0xc0)==0)
112#define REAL_C1551 ((readinputport(8)&0xc0)==0x40)
113#define REAL_VC1541 ((readinputport(8)&0xc0)==0x80)
114114
115#define IEC8ON ((input_port_8_r(0)&0x38)==8)
116#define IEC8ON ((input_port_8_r(0)&0x38)==8)
117#define IEC9ON ((input_port_8_r(0)&7)==1)
115#define IEC8ON ((readinputport(8)&0x38)==8)
116#define IEC8ON ((readinputport(8)&0x38)==8)
117#define IEC9ON ((readinputport(8)&7)==1)
118118
119#define SIDCARD ((input_port_9_r(0)&0x80))
119#define SIDCARD ((readinputport(9)&0x80))
120120// a lot of c64 software has been converted to c16
121121// these oftenly still produce the commands for the sid chip at 0xd400
122122// with following hack you can hear these sounds
123#define SIDCARD_HACK ((input_port_9_r(0)&0x40))
123#define SIDCARD_HACK ((readinputport(9)&0x40))
124124
125#define C16_PAL ((input_port_9_r(0)&0x10)==0)
125#define C16_PAL ((readinputport(9)&0x10)==0)
126126
127#define TYPE_C16 ((input_port_9_r(0)&0xc)==0)
128#define TYPE_PLUS4 ((input_port_9_r(0)&0xc)==4)
129#define TYPE_364 ((input_port_9_r(0)&0xc)==8)
127#define TYPE_C16 ((readinputport(9)&0xc)==0)
128#define TYPE_PLUS4 ((readinputport(9)&0xc)==4)
129#define TYPE_364 ((readinputport(9)&0xc)==8)
130130
131131
132132/*----------- defined in machine/c16.c -----------*/
r1877r1878
161161extern int c16_read_keyboard (int databus);
162162extern void c16_interrupt (int);
163163
164extern void c16_driver_init(void);
164extern void c16_driver_init(running_machine *machine);
165165extern MACHINE_RESET( c16 );
166166extern INTERRUPT_GEN( c16_frame_interrupt );
167167
src/mess/includes/pc1403.h
r1877r1878
1010#define PC1403_H_
1111
1212
13#define KEY_SMALL input_port_1_r(0)&0x40
14#define RAM32K (input_port_10_r(0)&0x80)==0x80
13#define KEY_SMALL readinputport(1)&0x40
14#define RAM32K (readinputport(10)&0x80)==0x80
1515
1616
1717/*----------- defined in machine/pc1403.c -----------*/
src/mess/includes/microtan.h
r1877r1878
2828
2929INTERRUPT_GEN( microtan_interrupt );
3030
31 READ8_HANDLER ( microtan_via_0_r );
32 READ8_HANDLER ( microtan_via_1_r );
33 READ8_HANDLER ( microtan_bffx_r );
34 READ8_HANDLER ( microtan_sound_r );
35 READ8_HANDLER ( microtan_sio_r );
31READ8_HANDLER ( microtan_bffx_r );
32READ8_HANDLER ( microtan_sound_r );
3633
37WRITE8_HANDLER ( microtan_via_0_w );
38WRITE8_HANDLER ( microtan_via_1_w );
3934WRITE8_HANDLER ( microtan_bffx_w );
4035WRITE8_HANDLER ( microtan_sound_w );
41WRITE8_HANDLER ( microtan_sio_w );
4236
4337
4438/*----------- defined in video/microtan.c -----------*/
src/mess/includes/apple2.h
r1877r1878
125125struct _apple2_meminfo
126126{
127127   UINT32 read_mem;
128   read8_handler read_handler;
128   read8_machine_func read_handler;
129129   UINT32 write_mem;
130   write8_handler write_handler;
130   write8_machine_func write_handler;
131131};
132132
133133typedef struct _apple2_memmap_entry apple2_memmap_entry;
src/mess/includes/c64.h
r1877r1878
7474   PORT_DIPSETTING(  0, DEF_STR( No ) )\
7575   PORT_DIPSETTING(   0x100, DEF_STR( Yes ) )
7676
77#define LIGHTPEN            ((input_port_7_word_r(0,0)&0xe000)==0xa000)
78#define MOUSE1               ((input_port_7_word_r(0,0)&0xe000)==0x8000)
79#define JOYSTICK1_2BUTTON      ((input_port_7_word_r(0,0)&0xe000)==0x6000)
80#define PADDLES12            ((input_port_7_word_r(0,0)&0xe000)==0x4000)
81#define JOYSTICK1            ((input_port_7_word_r(0,0)&0xe000)==0x2000)
82#define LIGHTPEN_POINTER      (LIGHTPEN&&(input_port_7_word_r(0,0)&0x1000))
83#define MOUSE2               ((input_port_7_word_r(0,0)&0xe00)==0x800)
84#define JOYSTICK2_2BUTTON      ((input_port_7_word_r(0,0)&0xe00)==0x600)
85#define PADDLES34            ((input_port_7_word_r(0,0)&0xe00)==0x400)
86#define JOYSTICK2            ((input_port_7_word_r(0,0)&0xe00)==0x200)
87#define JOYSTICK_SWAP         (input_port_7_word_r(0,0)&0x100)
77#define LIGHTPEN            ((readinputport(7)&0xe000)==0xa000)
78#define MOUSE1               ((readinputport(7)&0xe000)==0x8000)
79#define JOYSTICK1_2BUTTON      ((readinputport(7)&0xe000)==0x6000)
80#define PADDLES12            ((readinputport(7)&0xe000)==0x4000)
81#define JOYSTICK1            ((readinputport(7)&0xe000)==0x2000)
82#define LIGHTPEN_POINTER      (LIGHTPEN&&(readinputport(7)&0x1000))
83#define MOUSE2               ((readinputport(7)&0xe00)==0x800)
84#define JOYSTICK2_2BUTTON      ((readinputport(7)&0xe00)==0x600)
85#define PADDLES34            ((readinputport(7)&0xe00)==0x400)
86#define JOYSTICK2            ((readinputport(7)&0xe00)==0x200)
87#define JOYSTICK_SWAP         (readinputport(7)&0x100)
8888
89#define PADDLE1_BUTTON   ((input_port_1_word_r(0,0)&0x100))
90#define PADDLE1_VALUE   (input_port_1_word_r(0,0)&0xff)
91#define PADDLE2_BUTTON   ((input_port_2_word_r(0,0)&0x100))
92#define PADDLE2_VALUE   (input_port_2_word_r(0,0)&0xff)
93#define PADDLE3_BUTTON   ((input_port_3_word_r(0,0)&0x100))
94#define PADDLE3_VALUE   (input_port_3_word_r(0,0)&0xff)
95#define PADDLE4_BUTTON   ((input_port_4_word_r(0,0)&0x100))
96#define PADDLE4_VALUE   (input_port_4_word_r(0,0)&0xff)
89#define PADDLE1_BUTTON   ((readinputport(1)&0x100))
90#define PADDLE1_VALUE   (readinputport(1)&0xff)
91#define PADDLE2_BUTTON   ((readinputport(2)&0x100))
92#define PADDLE2_VALUE   (readinputport(2)&0xff)
93#define PADDLE3_BUTTON   ((readinputport(3)&0x100))
94#define PADDLE3_VALUE   (readinputport(3)&0xff)
95#define PADDLE4_BUTTON   ((readinputport(4)&0x100))
96#define PADDLE4_VALUE   (readinputport(4)&0xff)
9797
9898#define MOUSE1_BUTTON1 (MOUSE1&&(readinputport(5)&0x8000))
9999#define MOUSE1_BUTTON2 (MOUSE1&&(readinputport(5)&0x4000))
r1877r1878
109109#define LIGHTPEN_X_VALUE ((readinputport(5)&0x3ff)&~1)   /* effectiv resolution */
110110#define LIGHTPEN_Y_VALUE (readinputport(6)&~1)   /* effectiv resolution */
111111
112#define JOYSTICK_1_LEFT   ((input_port_0_word_r(0,0)&0x8000))
113#define JOYSTICK_1_RIGHT   ((input_port_0_word_r(0,0)&0x4000))
114#define JOYSTICK_1_UP      ((input_port_0_word_r(0,0)&0x2000))
115#define JOYSTICK_1_DOWN   ((input_port_0_word_r(0,0)&0x1000))
116#define JOYSTICK_1_BUTTON ((input_port_0_word_r(0,0)&0x800))
117#define JOYSTICK_1_BUTTON2 ((input_port_0_word_r(0,0)&0x400))
118#define JOYSTICK_2_LEFT   ((input_port_0_word_r(0,0)&0x80))
119#define JOYSTICK_2_RIGHT   ((input_port_0_word_r(0,0)&0x40))
120#define JOYSTICK_2_UP      ((input_port_0_word_r(0,0)&0x20))
121#define JOYSTICK_2_DOWN   ((input_port_0_word_r(0,0)&0x10))
122#define JOYSTICK_2_BUTTON ((input_port_0_word_r(0,0)&8))
123#define JOYSTICK_2_BUTTON2 ((input_port_0_word_r(0,0)&4))
112#define JOYSTICK_1_LEFT   ((readinputport(0)&0x8000))
113#define JOYSTICK_1_RIGHT   ((readinputport(0)&0x4000))
114#define JOYSTICK_1_UP      ((readinputport(0)&0x2000))
115#define JOYSTICK_1_DOWN   ((readinputport(0)&0x1000))
116#define JOYSTICK_1_BUTTON ((readinputport(0)&0x800))
117#define JOYSTICK_1_BUTTON2 ((readinputport(0)&0x400))
118#define JOYSTICK_2_LEFT   ((readinputport(0)&0x80))
119#define JOYSTICK_2_RIGHT   ((readinputport(0)&0x40))
120#define JOYSTICK_2_UP      ((readinputport(0)&0x20))
121#define JOYSTICK_2_DOWN   ((readinputport(0)&0x10))
122#define JOYSTICK_2_BUTTON ((readinputport(0)&8))
123#define JOYSTICK_2_BUTTON2 ((readinputport(0)&4))
124124
125#define QUICKLOAD      (input_port_8_word_r(0,0)&0x8000)
126#define DATASSETTE (input_port_8_word_r(0,0)&0x4000)
127#define DATASSETTE_TONE (input_port_8_word_r(0,0)&0x2000)
125#define QUICKLOAD      (readinputport(8)&0x8000)
126#define DATASSETTE (readinputport(8)&0x4000)
127#define DATASSETTE_TONE (readinputport(8)&0x2000)
128128
129#define DATASSETTE_PLAY      (input_port_8_word_r(0,0)&0x1000)
130#define DATASSETTE_RECORD   (input_port_8_word_r(0,0)&0x800)
131#define DATASSETTE_STOP      (input_port_8_word_r(0,0)&0x400)
129#define DATASSETTE_PLAY      (readinputport(8)&0x1000)
130#define DATASSETTE_RECORD   (readinputport(8)&0x800)
131#define DATASSETTE_STOP      (readinputport(8)&0x400)
132132
133#define SID8580      ((input_port_8_r(0)&0x80) ? MOS8580 : MOS6581)
133#define SID8580      ((readinputport(8)&0x80) ? MOS8580 : MOS6581)
134134
135#define AUTO_MODULE ((input_port_8_r(0)&0x1c)==0)
136#define ULTIMAX_MODULE ((input_port_8_r(0)&0x1c)==4)
137#define C64_MODULE ((input_port_8_r(0)&0x1c)==8)
138#define SUPERGAMES_MODULE ((input_port_8_r(0)&0x1c)==0x10)
139#define ROBOCOP2_MODULE ((input_port_8_r(0)&0x1c)==0x14)
140#define C128_MODULE ((input_port_8_r(0)&0x1c)==0x18)
135#define AUTO_MODULE ((readinputport(8)&0x1c)==0)
136#define ULTIMAX_MODULE ((readinputport(8)&0x1c)==4)
137#define C64_MODULE ((readinputport(8)&0x1c)==8)
138#define SUPERGAMES_MODULE ((readinputport(8)&0x1c)==0x10)
139#define ROBOCOP2_MODULE ((readinputport(8)&0x1c)==0x14)
140#define C128_MODULE ((readinputport(8)&0x1c)==0x18)
141141
142#define KEY_ARROW_LEFT (input_port_9_word_r(0,0)&0x8000)
143#define KEY_1 (input_port_9_word_r(0,0)&0x4000)
144#define KEY_2 (input_port_9_word_r(0,0)&0x2000)
145#define KEY_3 (input_port_9_word_r(0,0)&0x1000)
146#define KEY_4 (input_port_9_word_r(0,0)&0x800)
147#define KEY_5 (input_port_9_word_r(0,0)&0x400)
148#define KEY_6 (input_port_9_word_r(0,0)&0x200)
149#define KEY_7 (input_port_9_word_r(0,0)&0x100)
150#define KEY_8 (input_port_9_word_r(0,0)&0x80)
151#define KEY_9 (input_port_9_word_r(0,0)&0x40)
152#define KEY_0 (input_port_9_word_r(0,0)&0x20)
153#define KEY_PLUS (input_port_9_word_r(0,0)&0x10)
154#define KEY_MINUS (input_port_9_word_r(0,0)&8)
155#define KEY_POUND (input_port_9_word_r(0,0)&4)
156#define KEY_HOME (input_port_9_word_r(0,0)&2)
157#define KEY_DEL (input_port_9_word_r(0,0)&1)
142#define KEY_ARROW_LEFT (readinputport(9)&0x8000)
143#define KEY_1 (readinputport(9)&0x4000)
144#define KEY_2 (readinputport(9)&0x2000)
145#define KEY_3 (readinputport(9)&0x1000)
146#define KEY_4 (readinputport(9)&0x800)
147#define KEY_5 (readinputport(9)&0x400)
148#define KEY_6 (readinputport(9)&0x200)
149#define KEY_7 (readinputport(9)&0x100)
150#define KEY_8 (readinputport(9)&0x80)
151#define KEY_9 (readinputport(9)&0x40)
152#define KEY_0 (readinputport(9)&0x20)
153#define KEY_PLUS (readinputport(9)&0x10)
154#define KEY_MINUS (readinputport(9)&8)
155#define KEY_POUND (readinputport(9)&4)
156#define KEY_HOME (readinputport(9)&2)
157#define KEY_DEL (readinputport(9)&1)
158158
159#define KEY_CTRL (input_port_10_word_r(0,0)&0x8000)
160#define KEY_Q (input_port_10_word_r(0,0)&0x4000)
161#define KEY_W (input_port_10_word_r(0,0)&0x2000)
162#define KEY_E (input_port_10_word_r(0,0)&0x1000)
163#define KEY_R (input_port_10_word_r(0,0)&0x800)
164#define KEY_T (input_port_10_word_r(0,0)&0x400)
165#define KEY_Y (input_port_10_word_r(0,0)&0x200)
166#define KEY_U (input_port_10_word_r(0,0)&0x100)
167#define KEY_I (input_port_10_word_r(0,0)&0x80)
168#define KEY_O (input_port_10_word_r(0,0)&0x40)
169#define KEY_P (input_port_10_word_r(0,0)&0x20)
170#define KEY_ATSIGN (input_port_10_word_r(0,0)&0x10)
171#define KEY_ASTERIX (input_port_10_word_r(0,0)&8)
172#define KEY_ARROW_UP (input_port_10_word_r(0,0)&4)
173#define KEY_RESTORE (input_port_10_word_r(0,0)&2)
174#define KEY_STOP (input_port_10_word_r(0,0)&1)
159#define KEY_CTRL (readinputport(10)&0x8000)
160#define KEY_Q (readinputport(10)&0x4000)
161#define KEY_W (readinputport(10)&0x2000)
162#define KEY_E (readinputport(10)&0x1000)
163#define KEY_R (readinputport(10)&0x800)
164#define KEY_T (readinputport(10)&0x400)
165#define KEY_Y (readinputport(10)&0x200)
166#define KEY_U (readinputport(10)&0x100)
167#define KEY_I (readinputport(10)&0x80)
168#define KEY_O (readinputport(10)&0x40)
169#define KEY_P (readinputport(10)&0x20)
170#define KEY_ATSIGN (readinputport(10)&0x10)
171#define KEY_ASTERIX (readinputport(10)&8)
172#define KEY_ARROW_UP (readinputport(10)&4)
173#define KEY_RESTORE (readinputport(10)&2)
174#define KEY_STOP (readinputport(10)&1)
175175
176#define KEY_SHIFTLOCK (input_port_11_word_r(0,0)&0x8000)
177#define KEY_A (input_port_11_word_r(0,0)&0x4000)
178#define KEY_S (input_port_11_word_r(0,0)&0x2000)
179#define KEY_D (input_port_11_word_r(0,0)&0x1000)
180#define KEY_F (input_port_11_word_r(0,0)&0x800)
181#define KEY_G (input_port_11_word_r(0,0)&0x400)
182#define KEY_H (input_port_11_word_r(0,0)&0x200)
183#define KEY_J (input_port_11_word_r(0,0)&0x100)
184#define KEY_K (input_port_11_word_r(0,0)&0x80)
185#define KEY_L (input_port_11_word_r(0,0)&0x40)
186#define KEY_SEMICOLON (input_port_11_word_r(0,0)&0x20)
187#define KEY_COLON (input_port_11_word_r(0,0)&0x10)
188#define KEY_EQUALS (input_port_11_word_r(0,0)&8)
189#define KEY_RETURN (input_port_11_word_r(0,0)&4)
190#define KEY_CBM (input_port_11_word_r(0,0)&2)
191#define KEY_LEFT_SHIFT ((input_port_11_word_r(0,0)&1)||KEY_SHIFTLOCK)
176#define KEY_SHIFTLOCK (readinputport(11)&0x8000)
177#define KEY_A (readinputport(11)&0x4000)
178#define KEY_S (readinputport(11)&0x2000)
179#define KEY_D (readinputport(11)&0x1000)
180#define KEY_F (readinputport(11)&0x800)
181#define KEY_G (readinputport(11)&0x400)
182#define KEY_H (readinputport(11)&0x200)
183#define KEY_J (readinputport(11)&0x100)
184#define KEY_K (readinputport(11)&0x80)
185#define KEY_L (readinputport(11)&0x40)
186#define KEY_SEMICOLON (readinputport(11)&0x20)
187#define KEY_COLON (readinputport(11)&0x10)
188#define KEY_EQUALS (readinputport(11)&8)
189#define KEY_RETURN (readinputport(11)&4)
190#define KEY_CBM (readinputport(11)&2)
191#define KEY_LEFT_SHIFT ((readinputport(11)&1)||KEY_SHIFTLOCK)
192192
193#define KEY_Z (input_port_12_word_r(0,0)&0x8000)
194#define KEY_X (input_port_12_word_r(0,0)&0x4000)
195#define KEY_C (input_port_12_word_r(0,0)&0x2000)
196#define KEY_V (input_port_12_word_r(0,0)&0x1000)
197#define KEY_B (input_port_12_word_r(0,0)&0x800)
198#define KEY_N (input_port_12_word_r(0,0)&0x400)
199#define KEY_M (input_port_12_word_r(0,0)&0x200)
200#define KEY_COMMA (input_port_12_word_r(0,0)&0x100)
201#define KEY_POINT (input_port_12_word_r(0,0)&0x80)
202#define KEY_SLASH (input_port_12_word_r(0,0)&0x40)
203#define KEY_RIGHT_SHIFT ((input_port_12_word_r(0,0)&0x20)\
193#define KEY_Z (readinputport(12)&0x8000)
194#define KEY_X (readinputport(12)&0x4000)
195#define KEY_C (readinputport(12)&0x2000)
196#define KEY_V (readinputport(12)&0x1000)
197#define KEY_B (readinputport(12)&0x800)
198#define KEY_N (readinputport(12)&0x400)
199#define KEY_M (readinputport(12)&0x200)
200#define KEY_COMMA (readinputport(12)&0x100)
201#define KEY_POINT (readinputport(12)&0x80)
202#define KEY_SLASH (readinputport(12)&0x40)
203#define KEY_RIGHT_SHIFT ((readinputport(12)&0x20)\
204204          ||KEY_CURSOR_UP||KEY_CURSOR_LEFT)
205#define KEY_CURSOR_DOWN ((input_port_12_word_r(0,0)&0x10)||KEY_CURSOR_UP)
206#define KEY_CURSOR_RIGHT ((input_port_12_word_r(0,0)&8)||KEY_CURSOR_LEFT)
207#define KEY_SPACE (input_port_12_word_r(0,0)&4)
208#define KEY_F1 (input_port_12_word_r(0,0)&2)
209#define KEY_F3 (input_port_12_word_r(0,0)&1)
205#define KEY_CURSOR_DOWN ((readinputport(12)&0x10)||KEY_CURSOR_UP)
206#define KEY_CURSOR_RIGHT ((readinputport(12)&8)||KEY_CURSOR_LEFT)
207#define KEY_SPACE (readinputport(12)&4)
208#define KEY_F1 (readinputport(12)&2)
209#define KEY_F3 (readinputport(12)&1)
210210
211#define KEY_F5 (input_port_13_word_r(0,0)&0x8000)
212#define KEY_F7 (input_port_13_word_r(0,0)&0x4000)
213#define KEY_CURSOR_UP (input_port_13_word_r(0,0)&0x2000)
214#define KEY_CURSOR_LEFT (input_port_13_word_r(0,0)&0x1000)
211#define KEY_F5 (readinputport(13)&0x8000)
212#define KEY_F7 (readinputport(13)&0x4000)
213#define KEY_CURSOR_UP (readinputport(13)&0x2000)
214#define KEY_CURSOR_LEFT (readinputport(13)&0x1000)
215215
216216
217217/*----------- defined in machine/c64.c -----------*/
src/mess/includes/svi318.h
r1877r1878
4646DEVICE_LOAD( svi318_floppy );
4747
4848MC6845_UPDATE_ROW( svi806_crtc6845_update_row );
49READ8_HANDLER( svi806_r );
50WRITE8_HANDLER( svi806_w );
5149WRITE8_HANDLER( svi806_ram_enable_w );
5250VIDEO_START( svi328_806 );
5351VIDEO_UPDATE( svi328_806 );
src/mess/includes/amstr_pc.h
r1877r1878
88#define AMSTR_PC_H_
99
1010
11#define PC200_MODE (input_port_1_r(0)&0x30)
11#define PC200_MODE (readinputport(1)&0x30)
1212#define PC200_MDA 0x30
1313
1414
src/mess/includes/pc1251.h
r1877r1878
1010#define PC1251_H_
1111
1212
13#define PC1251_SWITCH_MODE (input_port_0_r(0)&7)
13#define PC1251_SWITCH_MODE (readinputport(0)&7)
1414
15#define PC1251_KEY_DEF input_port_0_r(0)&0x100
16#define PC1251_KEY_SHIFT input_port_0_r(0)&0x80
17#define PC1251_KEY_DOWN input_port_0_r(0)&0x40
18#define PC1251_KEY_UP input_port_0_r(0)&0x20
19#define PC1251_KEY_LEFT input_port_0_r(0)&0x10
20#define PC1251_KEY_RIGHT input_port_0_r(0)&8
15#define PC1251_KEY_DEF readinputport(0)&0x100
16#define PC1251_KEY_SHIFT readinputport(0)&0x80
17#define PC1251_KEY_DOWN readinputport(0)&0x40
18#define PC1251_KEY_UP readinputport(0)&0x20
19#define PC1251_KEY_LEFT readinputport(0)&0x10
20#define PC1251_KEY_RIGHT readinputport(0)&8
2121
22#define PC1251_KEY_BRK input_port_1_r(0)&0x80
23#define PC1251_KEY_Q input_port_1_r(0)&0x40
24#define PC1251_KEY_W input_port_1_r(0)&0x20
25#define PC1251_KEY_E input_port_1_r(0)&0x10
26#define PC1251_KEY_R input_port_1_r(0)&8
27#define PC1251_KEY_T input_port_1_r(0)&4
28#define PC1251_KEY_Y input_port_1_r(0)&2
29#define PC1251_KEY_U input_port_1_r(0)&1
22#define PC1251_KEY_BRK readinputport(1)&0x80
23#define PC1251_KEY_Q readinputport(1)&0x40
24#define PC1251_KEY_W readinputport(1)&0x20
25#define PC1251_KEY_E readinputport(1)&0x10
26#define PC1251_KEY_R readinputport(1)&8
27#define PC1251_KEY_T readinputport(1)&4
28#define PC1251_KEY_Y readinputport(1)&2
29#define PC1251_KEY_U readinputport(1)&1
3030
31#define PC1251_KEY_I input_port_2_r(0)&0x80
32#define PC1251_KEY_O input_port_2_r(0)&0x40
33#define PC1251_KEY_P input_port_2_r(0)&0x20
34#define PC1251_KEY_A input_port_2_r(0)&0x10
35#define PC1251_KEY_S input_port_2_r(0)&8
36#define PC1251_KEY_D input_port_2_r(0)&4
37#define PC1251_KEY_F input_port_2_r(0)&2
38#define PC1251_KEY_G input_port_2_r(0)&1
31#define PC1251_KEY_I readinputport(2)&0x80
32#define PC1251_KEY_O readinputport(2)&0x40
33#define PC1251_KEY_P readinputport(2)&0x20
34#define PC1251_KEY_A readinputport(2)&0x10
35#define PC1251_KEY_S readinputport(2)&8
36#define PC1251_KEY_D readinputport(2)&4
37#define PC1251_KEY_F readinputport(2)&2
38#define PC1251_KEY_G readinputport(2)&1
3939
40#define PC1251_KEY_H input_port_3_r(0)&0x80
41#define PC1251_KEY_J input_port_3_r(0)&0x40
42#define PC1251_KEY_K input_port_3_r(0)&0x20
43#define PC1251_KEY_L input_port_3_r(0)&0x10
44#define PC1251_KEY_EQUALS input_port_3_r(0)&8
45#define PC1251_KEY_Z input_port_3_r(0)&4
46#define PC1251_KEY_X input_port_3_r(0)&2
47#define PC1251_KEY_C input_port_3_r(0)&1
40#define PC1251_KEY_H readinputport(3)&0x80
41#define PC1251_KEY_J readinputport(3)&0x40
42#define PC1251_KEY_K readinputport(3)&0x20
43#define PC1251_KEY_L readinputport(3)&0x10
44#define PC1251_KEY_EQUALS readinputport(3)&8
45#define PC1251_KEY_Z readinputport(3)&4
46#define PC1251_KEY_X readinputport(3)&2
47#define PC1251_KEY_C readinputport(3)&1
4848
49#define PC1251_KEY_V input_port_4_r(0)&0x80
50#define PC1251_KEY_B input_port_4_r(0)&0x40
51#define PC1251_KEY_N input_port_4_r(0)&0x20
52#define PC1251_KEY_M input_port_4_r(0)&0x10
53#define PC1251_KEY_SPACE input_port_4_r(0)&8
54#define PC1251_KEY_ENTER input_port_4_r(0)&4
55#define PC1251_KEY_7 input_port_4_r(0)&2
56#define PC1251_KEY_8 input_port_4_r(0)&1
49#define PC1251_KEY_V readinputport(4)&0x80
50#define PC1251_KEY_B readinputport(4)&0x40
51#define PC1251_KEY_N readinputport(4)&0x20
52#define PC1251_KEY_M readinputport(4)&0x10
53#define PC1251_KEY_SPACE readinputport(4)&8
54#define PC1251_KEY_ENTER readinputport(4)&4
55#define PC1251_KEY_7 readinputport(4)&2
56#define PC1251_KEY_8 readinputport(4)&1
5757
58#define PC1251_KEY_9 input_port_5_r(0)&0x80
59#define PC1251_KEY_CL input_port_5_r(0)&0x40
60#define PC1251_KEY_4 input_port_5_r(0)&0x20
61#define PC1251_KEY_5 input_port_5_r(0)&0x10
62#define PC1251_KEY_6 input_port_5_r(0)&8
63#define PC1251_KEY_SLASH input_port_5_r(0)&4
64#define PC1251_KEY_1 input_port_5_r(0)&2
65#define PC1251_KEY_2 input_port_5_r(0)&1
58#define PC1251_KEY_9 readinputport(5)&0x80
59#define PC1251_KEY_CL readinputport(5)&0x40
60#define PC1251_KEY_4 readinputport(5)&0x20
61#define PC1251_KEY_5 readinputport(5)&0x10
62#define PC1251_KEY_6 readinputport(5)&8
63#define PC1251_KEY_SLASH readinputport(5)&4
64#define PC1251_KEY_1 readinputport(5)&2
65#define PC1251_KEY_2 readinputport(5)&1
6666
67#define PC1251_KEY_3 input_port_6_r(0)&0x80
68#define PC1251_KEY_ASTERIX input_port_6_r(0)&0x40
69#define PC1251_KEY_0 input_port_6_r(0)&0x20
70#define PC1251_KEY_POINT input_port_6_r(0)&0x10
71#define PC1251_KEY_PLUS input_port_6_r(0)&8
72#define PC1251_KEY_MINUS input_port_6_r(0)&4
73#define PC1251_KEY_RESET input_port_6_r(0)&1
67#define PC1251_KEY_3 readinputport(6)&0x80
68#define PC1251_KEY_ASTERIX readinputport(6)&0x40
69#define PC1251_KEY_0 readinputport(6)&0x20
70#define PC1251_KEY_POINT readinputport(6)&0x10
71#define PC1251_KEY_PLUS readinputport(6)&8
72#define PC1251_KEY_MINUS readinputport(6)&4
73#define PC1251_KEY_RESET readinputport(6)&1
7474
75#define PC1251_RAM4K (input_port_7_r(0)&0xc0)==0x40
76#define PC1251_RAM6K (input_port_7_r(0)&0xc0)==0x80
77#define PC1251_RAM11K (input_port_7_r(0)&0xc0)==0xc0
75#define PC1251_RAM4K (readinputport(7)&0xc0)==0x40
76#define PC1251_RAM6K (readinputport(7)&0xc0)==0x80
77#define PC1251_RAM11K (readinputport(7)&0xc0)==0xc0
7878
79#define PC1251_CONTRAST (input_port_7_r(0)&7)
79#define PC1251_CONTRAST (readinputport(7)&7)
8080
8181
8282/*----------- defined in machine/pc1251.c -----------*/
src/mess/includes/vc20tape.h
r1877r1878
1414void vc20tape_device_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info);
1515
1616/* the function which should be called by change on readline */
17extern void vc20_tape_open (write8_handler read_callback);
17extern void vc20_tape_open (write8_machine_func read_callback);
1818extern void c16_tape_open (void);
1919extern void vc20_tape_close (void);
2020
src/mess/video/cbmb.c
r1877r1878
2222   return 0;
2323}
2424
25READ8_HANDLER( cbmb_mc6845_register_r ) {
26   return mc6845_register_r( mc6845 );
27}
28
29WRITE8_HANDLER( cbmb_mc6845_register_w ) {
30   mc6845_register_w( mc6845, data );
31}
32
33WRITE8_HANDLER( cbmb_mc6845_address_w ) {
34   mc6845_address_w( mc6845, data );
35}
36
3725void cbm600_vh_init(void)
3826{
3927   UINT8 *gfx = memory_region(REGION_GFX1);
src/mess/video/cirrus.c
r1877r1878
213213
214214
215215
216WRITE64_HANDLER( cirrus_64be_42E8_w ) { write64be_with_write8_handler(cirrus_42E8_w, offset, data, mem_mask); }
216WRITE64_HANDLER( cirrus_64be_42E8_w ) { write64be_with_write8_handler(cirrus_42E8_w, machine, offset, data, mem_mask); }
217217
src/mess/video/coco.c
r1877r1878
5252
5353static void coco_horizontal_sync_callback(int data)
5454{
55   pia_0_ca1_w(0, data);
55   pia_0_ca1_w(Machine, 0, data);
5656}
5757
5858
5959
6060static void coco_field_sync_callback(int data)
6161{
62   pia_0_cb1_w(0, data);
62   pia_0_cb1_w(Machine, 0, data);
6363}
6464
6565
src/mess/video/gb.c
r1877r1878
11541154   cpunum_set_input_line( machine, 0, VBL_INT, ASSERT_LINE );
11551155}
11561156
1157void gb_video_init( int mode ) {
1157void gb_video_init( running_machine *machine, int mode ) {
11581158   int   i;
11591159   int vram_size = 0x2000;
11601160
r1877r1878
12181218      timer_set( ATTOTIME_IN_CYCLES(1,0), NULL, 0, gb_video_init_vbl );
12191219
12201220      /* Initialize some video registers */
1221      gb_video_w( 0x0, 0x91 );    /* LCDCONT */
1222      gb_video_w( 0x7, 0xFC );    /* BGRDPAL */
1223      gb_video_w( 0x8, 0xFC );    /* SPR0PAL */
1224      gb_video_w( 0x9, 0xFC );    /* SPR1PAL */
1221      gb_video_w( machine, 0x0, 0x91 );    /* LCDCONT */
1222      gb_video_w( machine, 0x7, 0xFC );    /* BGRDPAL */
1223      gb_video_w( machine, 0x8, 0xFC );    /* SPR0PAL */
1224      gb_video_w( machine, 0x9, 0xFC );    /* SPR1PAL */
12251225
12261226      CURLINE = gb_lcd.current_line = 0;
12271227      LCDSTAT = ( LCDSTAT & 0xF8 ) | 0x05;
r1877r1878
12461246      timer_set( ATTOTIME_IN_CYCLES(1,0), NULL, 0, gb_video_init_vbl );
12471247
12481248      /* Initialize some video registers */
1249      gb_video_w( 0x0, 0x91 );    /* LCDCONT */
1250      gb_video_w( 0x7, 0xFC );    /* BGRDPAL */
1251      gb_video_w( 0x8, 0xFC );    /* SPR0PAL */
1252      gb_video_w( 0x9, 0xFC );    /* SPR1PAL */
1249      gb_video_w( machine, 0x0, 0x91 );    /* LCDCONT */
1250      gb_video_w( machine, 0x7, 0xFC );    /* BGRDPAL */
1251      gb_video_w( machine, 0x8, 0xFC );    /* SPR0PAL */
1252      gb_video_w( machine, 0x9, 0xFC );    /* SPR1PAL */
12531253
12541254      CURLINE = gb_lcd.current_line = 0;
12551255      LCDSTAT = ( LCDSTAT & 0xF8 ) | 0x05;
r1877r1878
12781278      timer_set( ATTOTIME_IN_CYCLES(1,0), NULL, 0, gb_video_init_vbl );
12791279
12801280      /* Initialize some video registers */
1281      gbc_video_w( 0x0, 0x91 );    /* LCDCONT */
1282      gbc_video_w( 0x7, 0xFC );    /* BGRDPAL */
1283      gbc_video_w( 0x8, 0xFC );    /* SPR0PAL */
1284      gbc_video_w( 0x9, 0xFC );    /* SPR1PAL */
1285      gbc_video_w( 0x0F, 0x00 );
1281      gbc_video_w( machine, 0x0, 0x91 );    /* LCDCONT */
1282      gbc_video_w( machine, 0x7, 0xFC );    /* BGRDPAL */
1283      gbc_video_w( machine, 0x8, 0xFC );    /* SPR0PAL */
1284      gbc_video_w( machine, 0x9, 0xFC );    /* SPR1PAL */
1285      gbc_video_w( machine, 0x0F, 0x00 );
12861286      CURLINE = gb_lcd.current_line = 0x90;
12871287      LCDSTAT = ( LCDSTAT & 0xF8 ) | 0x01;
12881288      gb_lcd.mode = 1;
r1877r1878
21852185      return;
21862186   default:
21872187      /* we didn't handle the write, so pass it to the GB handler */
2188      gb_video_w( offset, data );
2188      gb_video_w( machine, offset, data );
21892189      return;
21902190   }
21912191
src/mess/video/newport.c
r1877r1878
865865      switch( nREX3_DCBSlvSelect )
866866      {
867867      case 0x00:
868         return newport_vc2_r( 0, mem_mask );
868         return newport_vc2_r( machine, 0, mem_mask );
869869         break;
870870      case 0x02:
871         return newport_cmap0_r( 0, mem_mask );
871         return newport_cmap0_r( machine, 0, mem_mask );
872872         break;
873873      case 0x03:
874         return newport_cmap1_r( 0, mem_mask );
874         return newport_cmap1_r( machine, 0, mem_mask );
875875         break;
876876      case 0x05:
877         return newport_xmap0_r( 0, mem_mask );
877         return newport_xmap0_r( machine, 0, mem_mask );
878878         break;
879879      case 0x06:
880         return newport_xmap1_r( 0, mem_mask );
880         return newport_xmap1_r( machine, 0, mem_mask );
881881         break;
882882      default:
883883         verboselog( 2, "REX3 Display Control Bus Data MSW Read: %08x\n", nREX3_DCBDataMSW );
r1877r1878
16601660      switch( nREX3_DCBSlvSelect )
16611661      {
16621662      case 0x00:
1663         newport_vc2_w( 0, data, mem_mask );
1663         newport_vc2_w( machine, 0, data, mem_mask );
16641664         break;
16651665      case 0x01:
1666          newport_cmap0_w( 0, data, mem_mask );
1666          newport_cmap0_w( machine, 0, data, mem_mask );
16671667          break;
16681668      case 0x04:
1669         newport_xmap0_w( 0, data, mem_mask );
1670         newport_xmap1_w( 0, data, mem_mask );
1669         newport_xmap0_w( machine, 0, data, mem_mask );
1670         newport_xmap1_w( machine, 0, data, mem_mask );
16711671         break;
16721672      case 0x05:
1673         newport_xmap0_w( 0, data, mem_mask );
1673         newport_xmap0_w( machine, 0, data, mem_mask );
16741674         break;
16751675      case 0x06:
1676         newport_xmap1_w( 0, data, mem_mask );
1676         newport_xmap1_w( machine, 0, data, mem_mask );
16771677         break;
16781678      default:
16791679         verboselog( 2, "REX3 Display Control Bus Data MSW Write: %08x\n", data );
src/mess/video/pc_vga.c
r1877r1878
402402   }
403403}
404404
405static READ8_HANDLER(vga_text_r)
405static READ8_HANDLER(vga_text_r)
406406{
407407   int data;
408408   data=vga.memory[((offset&~1)<<1)|(offset&1)];
r1877r1878
412412
413413static WRITE8_HANDLER(vga_text_w)
414414{
415   vga_dirty_w(((offset&~1)<<1)|(offset&1),data);
415   vga_dirty_w(machine, ((offset&~1)<<1)|(offset&1),data);
416416}
417417
418418INLINE UINT8 ega_bitplane_to_packed(UINT8 *latch, int number)
r1877r1878
498498static WRITE8_HANDLER(vga_ega_w)
499499{
500500   if (vga.sequencer.data[2]&1)
501      vga_dirty_w(offset<<2, vga_latch_write(0,data));
501      vga_dirty_w(machine, offset<<2, vga_latch_write(0,data));
502502   if (vga.sequencer.data[2]&2)
503      vga_dirty_w((offset<<2)+1, vga_latch_write(1,data));
503      vga_dirty_w(machine, (offset<<2)+1, vga_latch_write(1,data));
504504   if (vga.sequencer.data[2]&4)
505      vga_dirty_font_w((offset<<2)+2, vga_latch_write(2,data));
505      vga_dirty_font_w(machine, (offset<<2)+2, vga_latch_write(2,data));
506506   if (vga.sequencer.data[2]&8)
507      vga_dirty_w((offset<<2)+3, vga_latch_write(3,data));
507      vga_dirty_w(machine, (offset<<2)+3, vga_latch_write(3,data));
508508   if ((offset==0xffff)&&(data==0)) vga.log=1;
509509}
510510
r1877r1878
518518
519519static WRITE8_HANDLER(vga_vga_w)
520520{
521   vga_dirty_font_w(((offset&~3)<<2)|(offset&3),data);
521   vga_dirty_font_w(machine, ((offset&~3)<<2)|(offset&3),data);
522522}
523523
524static READ64_HANDLER( vga_text64_r ) { return read64be_with_read8_handler(vga_text_r, offset, mem_mask); }
525static READ64_HANDLER( vga_vga64_r ) { return read64be_with_read8_handler(vga_vga_r, offset, mem_mask); }
526static WRITE64_HANDLER( vga_text64_w ) { write64be_with_write8_handler(vga_text_w, offset, data, mem_mask); }
527static WRITE64_HANDLER( vga_vga64_w ) { write64be_with_write8_handler(vga_vga_w, offset, data, mem_mask); }
524static READ64_HANDLER( vga_text64_r ) { return read64be_with_read8_handler(vga_text_r, machine, offset, mem_mask); }
525static READ64_HANDLER( vga_vga64_r ) { return read64be_with_read8_handler(vga_vga_r, machine, offset, mem_mask); }
526static WRITE64_HANDLER( vga_text64_w ) { write64be_with_write8_handler(vga_text_w, machine, offset, data, mem_mask); }
527static WRITE64_HANDLER( vga_vga64_w ) { write64be_with_write8_handler(vga_vga_w, machine, offset, data, mem_mask); }
528528
529529static void vga_cpu_interface(void)
530530{
531531   static int sequencer, gc;
532   read8_handler read_handler;
533   write8_handler write_handler;
534   read64_handler read_handler64;
535   write64_handler write_handler64;
532   read8_machine_func read_handler;
533   write8_machine_func write_handler;
534   read64_machine_func read_handler64;
535   write64_machine_func write_handler64;
536536   UINT8 sel;
537537   int buswidth;
538538
r1877r1878
573573         case 0x00:
574574            if (vga.vga_intf.vga_memory_bank != 0)
575575            {
576               read_handler = (read8_handler) (FPTR)vga.vga_intf.vga_memory_bank;
577               write_handler = (write8_handler) (FPTR)vga.vga_intf.vga_memory_bank;
576               read_handler = (read8_machine_func) (FPTR)vga.vga_intf.vga_memory_bank;
577               write_handler = (write8_machine_func) (FPTR)vga.vga_intf.vga_memory_bank;
578578            }
579579            else
580580            {
r1877r1878
754754{
755755   UINT8 data = 0xff;
756756   if (CRTC_PORT_ADDR==0x3b0)
757      data=vga_crtc_r(offset);
757      data=vga_crtc_r(machine, offset);
758758   return data;
759759}
760760
r1877r1878
792792         switch ((vga.miscellaneous_output>>2)&3)
793793         {
794794            case 3:
795               if (vga.vga_intf.read_dipswitch && vga.vga_intf.read_dipswitch(0) & 0x01)
795               if (vga.vga_intf.read_dipswitch && vga.vga_intf.read_dipswitch(machine, 0) & 0x01)
796796                  data |= 0x10;
797797               break;
798798            case 2:
799               if (vga.vga_intf.read_dipswitch && vga.vga_intf.read_dipswitch(0) & 0x02)
799               if (vga.vga_intf.read_dipswitch && vga.vga_intf.read_dipswitch(machine, 0) & 0x02)
800800                  data |= 0x10;
801801               break;
802802            case 1:
803               if (vga.vga_intf.read_dipswitch && vga.vga_intf.read_dipswitch(0) & 0x04)
803               if (vga.vga_intf.read_dipswitch && vga.vga_intf.read_dipswitch(machine, 0) & 0x04)
804804                  data |= 0x10;
805805               break;
806806            case 0:
807               if (vga.vga_intf.read_dipswitch && vga.vga_intf.read_dipswitch(0) & 0x08)
807               if (vga.vga_intf.read_dipswitch && vga.vga_intf.read_dipswitch(machine, 0) & 0x08)
808808                  data |= 0x10;
809809               break;
810810         }
r1877r1878
886886{
887887   UINT8 data = 0xff;
888888   if (CRTC_PORT_ADDR == 0x3d0)
889      data = vga_crtc_r(offset);
889      data = vga_crtc_r(machine, offset);
890890   return data;
891891}
892892
r1877r1878
896896      logerror("vga_port_03b0_w(): port=0x%04x data=0x%02x\n", offset + 0x3b0, data);
897897
898898   if (CRTC_PORT_ADDR == 0x3b0)
899      vga_crtc_w(offset, data);
899      vga_crtc_w(machine, offset, data);
900900}
901901
902902WRITE8_HANDLER(vga_port_03c0_w)
r1877r1878
10161016      logerror("vga_port_03d0_w(): port=0x%04x data=0x%02x\n", offset + 0x3d0, data);
10171017
10181018   if (CRTC_PORT_ADDR == 0x3d0)
1019      vga_crtc_w(offset,data);
1019      vga_crtc_w(machine, offset, data);
10201020}
10211021
10221022
10231023
10241024READ8_HANDLER( paradise_ega_03c0_r )
10251025{
1026   UINT8 data = vga_port_03c0_r(offset);
1026   UINT8 data = vga_port_03c0_r(machine, offset);
10271027
10281028   if (offset == 2)
10291029   {
10301030      if ( (vga.feature_control&3)==2 ) {
1031         data=(data&~0x60)|((vga.vga_intf.read_dipswitch(0)&0xc0)>>1);
1031         data=(data&~0x60)|((vga.vga_intf.read_dipswitch(machine, 0)&0xc0)>>1);
10321032      } else if ((vga.feature_control&3)==1 ) {
1033         data=(data&~0x60)|((vga.vga_intf.read_dipswitch(0)&0x30)<<1);
1033         data=(data&~0x60)|((vga.vga_intf.read_dipswitch(machine, 0)&0x30)<<1);
10341034      }
10351035   }
10361036   return data;
r1877r1878
10761076
10771077
10781078
1079static READ64_HANDLER( vga_port64be_03b0_r ) { return read64be_with_read8_handler(vga_port_03b0_r, offset, mem_mask); }
1080static READ64_HANDLER( vga_port64be_03c0_r ) { return read64be_with_read8_handler(vga_port_03c0_r, offset, mem_mask); }
1081static READ64_HANDLER( vga_port64be_03d0_r ) { return read64be_with_read8_handler(vga_port_03d0_r, offset, mem_mask); }
1079static READ64_HANDLER( vga_port64be_03b0_r ) { return read64be_with_read8_handler(vga_port_03b0_r, machine, offset, mem_mask); }
1080static READ64_HANDLER( vga_port64be_03c0_r ) { return read64be_with_read8_handler(vga_port_03c0_r, machine, offset, mem_mask); }
1081static READ64_HANDLER( vga_port64be_03d0_r ) { return read64be_with_read8_handler(vga_port_03d0_r, machine, offset, mem_mask); }
10821082
1083static WRITE64_HANDLER( vga_port64be_03b0_w ) { write64be_with_write8_handler(vga_port_03b0_w, offset, data, mem_mask); }
1084static WRITE64_HANDLER( vga_port64be_03c0_w ) { write64be_with_write8_handler(vga_port_03c0_w, offset, data, mem_mask); }
1085static WRITE64_HANDLER( vga_port64be_03d0_w ) { write64be_with_write8_handler(vga_port_03d0_w, offset, data, mem_mask); }
1083static WRITE64_HANDLER( vga_port64be_03b0_w ) { write64be_with_write8_handler(vga_port_03b0_w, machine, offset, data, mem_mask); }
1084static WRITE64_HANDLER( vga_port64be_03c0_w ) { write64be_with_write8_handler(vga_port_03c0_w, machine, offset, data, mem_mask); }
1085static WRITE64_HANDLER( vga_port64be_03d0_w ) { write64be_with_write8_handler(vga_port_03d0_w, machine, offset, data, mem_mask); }
10861086
10871087
10881088
r1877r1878
14711471
14721472
14731473
1474READ16_HANDLER( vga_port16le_03b0_r ) { return read16le_with_read8_handler(vga_port_03b0_r, offset, mem_mask); }
1475READ16_HANDLER( vga_port16le_03c0_r ) { return read16le_with_read8_handler(vga_port_03c0_r, offset, mem_mask); }
1476READ16_HANDLER( vga_port16le_03d0_r ) { return read16le_with_read8_handler(vga_port_03d0_r, offset, mem_mask); }
1477WRITE16_HANDLER( vga_port16le_03b0_w ) { write16le_with_write8_handler(vga_port_03b0_w, offset, data, mem_mask); }
1478WRITE16_HANDLER( vga_port16le_03c0_w ) { write16le_with_write8_handler(vga_port_03c0_w, offset, data, mem_mask); }
1479WRITE16_HANDLER( vga_port16le_03d0_w ) { write16le_with_write8_handler(vga_port_03d0_w, offset, data, mem_mask); }
1474READ16_HANDLER( vga_port16le_03b0_r ) { return read16le_with_read8_handler(vga_port_03b0_r, machine, offset, mem_mask); }
1475READ16_HANDLER( vga_port16le_03c0_r ) { return read16le_with_read8_handler(vga_port_03c0_r, machine, offset, mem_mask); }
1476READ16_HANDLER( vga_port16le_03d0_r ) { return read16le_with_read8_handler(vga_port_03d0_r, machine, offset, mem_mask); }
1477WRITE16_HANDLER( vga_port16le_03b0_w ) { write16le_with_write8_handler(vga_port_03b0_w, machine, offset, data, mem_mask); }
1478WRITE16_HANDLER( vga_port16le_03c0_w ) { write16le_with_write8_handler(vga_port_03c0_w, machine, offset, data, mem_mask); }
1479WRITE16_HANDLER( vga_port16le_03d0_w ) { write16le_with_write8_handler(vga_port_03d0_w, machine, offset, data, mem_mask); }
14801480
1481READ16_HANDLER( paradise_ega16le_03c0_r ) { return read16le_with_read8_handler(paradise_ega_03c0_r, offset, mem_mask); }
1481READ16_HANDLER( paradise_ega16le_03c0_r ) { return read16le_with_read8_handler(paradise_ega_03c0_r, machine, offset, mem_mask); }
src/mess/video/pc_vga.h
r1877r1878
1919{
2020   /* VGA memory mapper */
2121   int vga_memory_bank;
22   void (*map_vga_memory)(offs_t begin, offs_t end, read8_handler rh, write8_handler wh);
22   void (*map_vga_memory)(offs_t begin, offs_t end, read8_machine_func rh, write8_machine_func wh);
2323
2424   /* VGA dipswitch (???) */
25   read8_handler read_dipswitch;
25   read8_machine_func read_dipswitch;
2626
2727   /* where the ports go */
2828   int port_addressspace;
src/mess/video/vectrex.c
r1877r1878
103103{
104104   if (vectrex_lightpen_port & 1)
105105   {
106      via_0_ca1_w (0, 1);
107      via_0_ca1_w (0, 0);
106      via_0_ca1_w(machine, 0, 1);
107      via_0_ca1_w(machine, 0, 0);
108108   }
109109   if (vectrex_lightpen_port & 2)
110110   {
r1877r1878
365365   {
366366      /* BDIR active, PSG latches */
367367      if (data & 0x08) /* BC1 (do we select a reg or write it ?) */
368         AY8910_control_port_0_w (0, vectrex_via_out[PORTA]);
368         AY8910_control_port_0_w(machine, 0, vectrex_via_out[PORTA]);
369369      else
370         AY8910_write_port_0_w (0, vectrex_via_out[PORTA]);
370         AY8910_write_port_0_w(machine, 0, vectrex_via_out[PORTA]);
371371   }
372372
373373   if (!(data & 0x1) && (vectrex_via_out[PORTB] & 0x1))
r1877r1878
470470   via_reset();
471471   z_factor = 2;
472472
473   raaspec_led_w (0, 0xff);
473   raaspec_led_w(machine, 0, 0xff);
474474
475475   VIDEO_START_CALL(vector);
476476}
src/mess/video/aim65.c
r1877r1878
8484
8585TIMER_CALLBACK(aim65_printer_timer)
8686{
87   via_0_cb1_w(0, printer_level);
88   via_0_ca1_w(0, !printer_level);
87   via_0_cb1_w(machine, 0, printer_level);
88   via_0_ca1_w(machine, 0, !printer_level);
8989   printer_level = !printer_level;
9090   aim65_printer_inc();
9191}
r1877r1878
9797   {
9898      aim65_printer_cr();
9999      timer_adjust_periodic(print_timer, attotime_zero, 0, ATTOTIME_IN_USEC(10));
100      via_0_cb1_w(0, 0);
100      via_0_cb1_w(machine, 0, 0);
101101      printer_level = 1;
102102   }
103103   else
src/mess/video/m6847.c
r1877r1878
14101410
14111411
14121412
1413static void artifacting_changed(void *param, UINT32 val, UINT32 mask)
1413static INPUT_CHANGED( artifacting_changed )
14141414{
14151415   set_dirty();
14161416}
r1877r1878
14191419
14201420INPUT_PORTS_START( m6847_artifacting )
14211421   PORT_START_TAG("artifacting")
1422   PORT_CONFNAME( 0x03, 0x01, "Artifacting" )
1422   PORT_CONFNAME( 0x03, 0x01, "Artifacting" ) PORT_CHANGED(artifacting_changed, NULL)
14231423   PORT_CONFSETTING(    0x00, DEF_STR( Off ) )
14241424   PORT_CONFSETTING(    0x01, DEF_STR( Standard ) )
14251425   PORT_CONFSETTING(    0x02, DEF_STR( Reverse ) )
r1877r1878
18111811   UINT32 frequency;
18121812   attoseconds_t period, frame_period, cpu0_clock_period = 0;
18131813   double total_scanlines;
1814   int portnum;
18151814
18161815   /* identify proper M6847 variant */
18171816   assert(cfg->type < sizeof(variants) / sizeof(variants[0]));
r1877r1878
18991898   /* build font */
19001899   build_fontdata(v);
19011900
1902   /* artifact callbacks */
1903   portnum = port_tag_to_index("artifacting");
1904   if (portnum >= 0)
1905      input_port_set_changed_callback(portnum, ~0, artifacting_changed, NULL);
1906
19071901   /* dump stats */
19081902   if (LOG_STATS)
19091903   {
src/mess/video/x68k.c
r1877r1878
11001100//   popmessage("Keyboard buffer position = %i",sys.keyboard.headpos);
11011101//   popmessage("IERA = 0x%02x, IERB = 0x%02x",sys.mfp.iera,sys.mfp.ierb);
11021102//   popmessage("IPRA = 0x%02x, IPRB = 0x%02x",sys.mfp.ipra,sys.mfp.iprb);
1103//   popmessage("uPD72065 status = %02x",nec765_status_r(0));
1103//   popmessage("uPD72065 status = %02x",nec765_status_r(machine, 0));
11041104//   popmessage("Layer enable - 0x%02x",sys.video.reg[2] & 0xff);
11051105//   popmessage("Graphic layer scroll - %i, %i - %i, %i - %i, %i - %i, %i",
11061106//      sys.crtc.reg[12],sys.crtc.reg[13],sys.crtc.reg[14],sys.crtc.reg[15],sys.crtc.reg[16],sys.crtc.reg[17],sys.crtc.reg[18],sys.crtc.reg[19]);
src/mess/video/astrocde.c
r1877r1878
339339
340340   /* else draw in copy mode */
341341
342   astrocade_videoram_w(offset,data);
342   astrocade_videoram_w(machine, offset,data);
343343
344344   magic_expand_flipflop ^= 1;
345345}
src/mess/video/kaypro.c
r1877r1878
123123
124124static struct terminal *kaypro_terminal;
125125
126static void kaypro_putstr(const char * src)
126static void kaypro_putstr(running_machine *machine, const char * src)
127127{
128128   while (*src)
129      kaypro_conout_w(0, *src++);
129      kaypro_conout_w(machine, 0, *src++);
130130}
131131
132132static int kaypro_getcursorcode(int code)
r1877r1878
141141
142142   kaypro_terminal = terminal_create(0, ' ', 10, kaypro_getcursorcode, KAYPRO_SCREEN_W, KAYPRO_SCREEN_H);
143143
144   kaypro_putstr(
144   kaypro_putstr(machine,
145145   /* a test of GB1/GB2 video mode graphics */ \
146146      "\033B5" /* start video mode */ \
147147      "MESS KAYPRO Terminal Emulator          \200\220\200\263" \
src/mess/video/pc8801.c
r1877r1878
151151   XXX(2)
152152
153153#define XXX(n) \
154static WRITE8_HANDLER(write_gvram##n##_bank5){write_gvram(offset+0x4000*n,data);} \
155static WRITE8_HANDLER(write_gvram##n##_bank6){write_gvram(offset+0x4000*n+0x3000,data);}
154static WRITE8_HANDLER(write_gvram##n##_bank5){write_gvram(machine, offset+0x4000*n,data);} \
155static WRITE8_HANDLER(write_gvram##n##_bank6){write_gvram(machine, offset+0x4000*n+0x3000,data);}
156156   VVV
157157#undef XXX
158158
r1877r1878
183183    (x & 2 ? gVRAM[offset+0x4000] : ~gVRAM[offset+0x4000]) & \
184184    (x & 4 ? gVRAM[offset+0x8000] : ~gVRAM[offset+0x8000]); \
185185} \
186static  READ8_HANDLER(read_gvram_alu##x##_bank5){return read_gvram_alu##x(offset);} \
187static  READ8_HANDLER(read_gvram_alu##x##_bank6){return read_gvram_alu##x(offset+0x3000);}
186static  READ8_HANDLER(read_gvram_alu##x##_bank5){return read_gvram_alu##x(machine, offset);} \
187static  READ8_HANDLER(read_gvram_alu##x##_bank6){return read_gvram_alu##x(machine, offset+0x3000);}
188188
189189YYY
190190
r1877r1878
195195#define WWW(x) \
196196  switch(ALU1&(0x11<<x)) { \
197197  case 0x00<<x: \
198    write_gvram(offset+x*0x4000,gVRAM[offset+x*0x4000]&(~data)); \
198    write_gvram(machine, offset+x*0x4000,gVRAM[offset+x*0x4000]&(~data)); \
199199    break; \
200200  case 0x01<<x: \
201    write_gvram(offset+x*0x4000,gVRAM[offset+x*0x4000]|data); \
201    write_gvram(machine, offset+x*0x4000,gVRAM[offset+x*0x4000]|data); \
202202    break; \
203203  case 0x10<<x: \
204    write_gvram(offset+x*0x4000,gVRAM[offset+x*0x4000]^data); \
204    write_gvram(machine, offset+x*0x4000,gVRAM[offset+x*0x4000]^data); \
205205    break; \
206206  case 0x11<<x: \
207207    break; \
r1877r1878
215215}
216216static WRITE8_HANDLER(write_gvram_alu1)
217217{
218  write_gvram(offset+0x0000 , ALU_save0);
219  write_gvram(offset+0x4000 , ALU_save1);
220  write_gvram(offset+0x8000 , ALU_save2);
218  write_gvram(machine, offset+0x0000 , ALU_save0);
219  write_gvram(machine, offset+0x4000 , ALU_save1);
220  write_gvram(machine, offset+0x8000 , ALU_save2);
221221}
222static WRITE8_HANDLER(write_gvram_alu2){write_gvram(offset+0x0000,ALU_save1);}
223static WRITE8_HANDLER(write_gvram_alu3){write_gvram(offset+0x4000,ALU_save0);}
222static WRITE8_HANDLER(write_gvram_alu2){write_gvram(machine, offset+0x0000,ALU_save1);}
223static WRITE8_HANDLER(write_gvram_alu3){write_gvram(machine, offset+0x4000,ALU_save0);}
224224
225225#define XXX(x) \
226static WRITE8_HANDLER(write_gvram_alu##x##_bank5){write_gvram_alu##x(offset,data);} \
227static WRITE8_HANDLER(write_gvram_alu##x##_bank6){write_gvram_alu##x(offset+0x3000,data);}
226static WRITE8_HANDLER(write_gvram_alu##x##_bank5){write_gvram_alu##x(machine, offset,data);} \
227static WRITE8_HANDLER(write_gvram_alu##x##_bank6){write_gvram_alu##x(machine, offset+0x3000,data);}
228228
229229ZZZ
230230
r1877r1878
232232
233233int is_pc8801_vram_select(void)
234234{
235   read8_handler rh5 = NULL, rh6 = NULL;
236   write8_handler wh5 = NULL, wh6 = NULL;
235   read8_machine_func rh5 = NULL, rh6 = NULL;
236   write8_machine_func wh5 = NULL, wh6 = NULL;
237237
238238  if(ALUON) {
239239    /* ALU mode */
src/mess/video/pc_video.c
r1877r1878
129129}
130130
131131
132WRITE16_HANDLER( pc_video_videoram16le_w ) { write16le_with_write8_handler(pc_video_videoram_w, offset, mem_mask, data); }
132WRITE16_HANDLER( pc_video_videoram16le_w ) { write16le_with_write8_handler(pc_video_videoram_w, machine, offset, mem_mask, data); }
133133
134134WRITE32_HANDLER( pc_video_videoram32_w )
135135{
src/mess/video/vic4567.c
r1877r1878
6666   case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f:
6767   case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27:
6868   case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e:
69      vic2_port_w(offset,data);
69      vic2_port_w(machine, offset,data);
7070      break;
7171   case 0x2f:
7272      DBG_LOG (2, "vic write", ("%.2x:%.2x\n", offset, data));
r1877r1878
118118   }
119119}
120120
121 READ8_HANDLER ( vic3_port_r )
121READ8_HANDLER ( vic3_port_r )
122122{
123123   int val = 0;
124124   offset &= 0x7f;
r1877r1878
130130   case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f:
131131   case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27:
132132   case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e:
133      return vic2_port_r(offset);
133      return vic2_port_r(machine, offset);
134134   case 0x2f:
135135   case 0x30:
136136      val = vic2.reg[offset];
src/mess/video/pc_mda.c
r1877r1878
216216 */
217217static int pc_mda_status_r(void)
218218{
219    int data = (input_port_0_r(0) & 0x80) | 0x08 | mda.status;
219    int data = (readinputport(0) & 0x80) | 0x08 | mda.status;
220220   mda.status ^= 0x01;
221221   return data;
222222}
src/mess/video/pc_t1t.c
r1877r1878
282282 */
283283static int pc_t1t_status_r(void)
284284{
285    int data = (input_port_0_r(0) & 0x08) | pcjr.status;
285    int data = (readinputport(0) & 0x08) | pcjr.status;
286286    pcjr.status ^= 0x01;
287287    return data;
288288}
src/mess/video/pc_aga.c
r1877r1878
131131static READ8_HANDLER ( pc_aga_mda_r )
132132{
133133   if (aga.mode==AGA_MONO)
134      return pc_MDA_r(offset);
134      return pc_MDA_r(machine, offset);
135135   return 0xff;
136136}
137137
138138static WRITE8_HANDLER ( pc_aga_mda_w )
139139{
140140   if (aga.mode==AGA_MONO)
141      pc_MDA_w(offset, data);
141      pc_MDA_w(machine, offset, data);
142142}
143143
144144static READ8_HANDLER ( pc_aga_cga_r )
145145{
146146   if (aga.mode==AGA_COLOR)
147      return pc_cga8_r(offset);
147      return pc_cga8_r(machine, offset);
148148   return 0xff;
149149}
150150
151151static WRITE8_HANDLER ( pc_aga_cga_w )
152152{
153153   if (aga.mode==AGA_COLOR)
154      pc_cga8_w(offset, data);
154      pc_cga8_w(machine, offset, data);
155155}
156156
157static READ16_HANDLER ( pc16le_aga_mda_r ) { return read16le_with_read8_handler(pc_aga_mda_r, offset, mem_mask); }
158static WRITE16_HANDLER ( pc16le_aga_mda_w ) { write16le_with_write8_handler(pc_aga_mda_w, offset, data, mem_mask); }
159static READ16_HANDLER ( pc16le_aga_cga_r ) { return read16le_with_read8_handler(pc_aga_cga_r, offset, mem_mask); }
160static WRITE16_HANDLER ( pc16le_aga_cga_w ) { write16le_with_write8_handler(pc_aga_cga_w, offset, data, mem_mask); }
157static READ16_HANDLER ( pc16le_aga_mda_r ) { return read16le_with_read8_handler(pc_aga_mda_r, machine, offset, mem_mask); }
158static WRITE16_HANDLER ( pc16le_aga_mda_w ) { write16le_with_write8_handler(pc_aga_mda_w, machine, offset, data, mem_mask); }
159static READ16_HANDLER ( pc16le_aga_cga_r ) { return read16le_with_read8_handler(pc_aga_cga_r, machine, offset, mem_mask); }
160static WRITE16_HANDLER ( pc16le_aga_cga_w ) { write16le_with_write8_handler(pc_aga_cga_w, machine, offset, data, mem_mask); }
161161
162162
163163
r1877r1878
290290   switch (aga.mode) {
291291   case AGA_COLOR:
292292      if (offset>=0x8000)
293         pc_video_videoram_w(offset-0x8000, data);
293         pc_video_videoram_w(machine, offset-0x8000, data);
294294      break;
295295   case AGA_MONO:
296      pc_video_videoram_w(offset,data);
296      pc_video_videoram_w(machine, offset,data);
297297      break;
298298   case AGA_OFF: break;
299299   }
r1877r1878
331331   {
332332      default:
333333         if (offset>=0x8000)
334            pc_video_videoram_w(offset-0x8000, data);
334            pc_video_videoram_w(machine, offset-0x8000, data);
335335         break;
336336      case AGA_MONO:
337         pc_video_videoram_w(offset,data);
337         pc_video_videoram_w(machine, offset,data);
338338         break;
339339   }
340340}
341341
342READ16_HANDLER( pc200_videoram16le_r )   { return read16le_with_read8_handler(pc200_videoram_r, offset, mem_mask); }
343WRITE16_HANDLER( pc200_videoram16le_w )   { write16le_with_write8_handler(pc200_videoram_w, offset, data, mem_mask); }
342READ16_HANDLER( pc200_videoram16le_r )   { return read16le_with_read8_handler(pc200_videoram_r, machine, offset, mem_mask); }
343WRITE16_HANDLER( pc200_videoram16le_w )   { write16le_with_write8_handler(pc200_videoram_w, machine, offset, data, mem_mask); }
344344
345345
346346static struct {
r1877r1878
354354   switch(offset) {
355355   case 4:
356356      pc200.portd |= 0x20;
357      pc_cga8_w(offset,data);
357      pc_cga8_w(machine, offset,data);
358358      break;
359359   case 8:
360360      pc200.port8 = data;
361361      pc200.portd |= 0x80;
362      pc_cga8_w(offset,data);
362      pc_cga8_w(machine, offset,data);
363363      break;
364364   case 0xe:
365365      pc200.portd = 0x1f;
r1877r1878
384384      break;
385385
386386   default:
387      pc_cga8_w(offset,data);
387      pc_cga8_w(machine, offset,data);
388388      break;
389389   }
390390}
r1877r1878
407407   case 0xe:
408408      // 0x20 low cga
409409      // 0x10 low special
410      result = input_port_1_r(0)&0x38;
410      result = readinputport(1)&0x38;
411411      break;
412412
413413   default:
414      result = pc_cga8_r(offset);
414      result = pc_cga8_r(machine, offset);
415415      break;
416416   }
417417   return result;
418418}
419419
420READ16_HANDLER( pc200_cga16le_r ) { return read16le_with_read8_handler(pc200_cga_r, offset, mem_mask); }
421WRITE16_HANDLER( pc200_cga16le_w ) { write16le_with_write8_handler(pc200_cga_w, offset, data, mem_mask); }
420READ16_HANDLER( pc200_cga16le_r ) { return read16le_with_read8_handler(pc200_cga_r, machine, offset, mem_mask); }
421WRITE16_HANDLER( pc200_cga16le_w ) { write16le_with_write8_handler(pc200_cga_w, machine, offset, data, mem_mask); }
src/mess/video/pc_cga.c
r1877r1878
199199#define CGA_FONT_2            2
200200#define CGA_FONT_3            3
201201
202#define CGA_MONITOR      (input_port_20_r(0)&0x1C)
202#define CGA_MONITOR      (readinputport(20)&0x1C)
203203#define CGA_MONITOR_RGB         0x00   /* Colour RGB */
204204#define CGA_MONITOR_MONO      0x04   /* Greyscale RGB */
205205#define CGA_MONITOR_COMPOSITE   0x08   /* Colour composite */
206206#define CGA_MONITOR_TELEVISION   0x0C   /* Television */
207207#define CGA_MONITOR_LCD         0x10   /* LCD, eg PPC512 */
208208
209#define CGA_CHIPSET      (input_port_20_r(0)&0xE0)
209#define CGA_CHIPSET      (readinputport(20)&0xE0)
210210#define CGA_CHIPSET_IBM         0x00   /* Original IBM CGA */
211211#define CGA_CHIPSET_PC1512      0x20   /* PC1512 CGA subset */
212212#define CGA_CHIPSET_PC200      0x40   /* PC200 in CGA mode */
r1877r1878
430430 */
431431static int pc_cga_status_r(void)
432432{
433   int data = ((~input_port_0_r(0)) & 0x08) | cga.status;
433   int data = ((~readinputport(0)) & 0x08) | cga.status;
434434   cga.status ^= 0x01;
435435   return data;
436436}
r1877r1878
485485
486486
487487
488READ16_HANDLER( pc_cga16le_r ) { return read16le_with_read8_handler(pc_cga8_r, offset, mem_mask); }
489WRITE16_HANDLER( pc_cga16le_w ) { write16le_with_write8_handler(pc_cga8_w, offset, data, mem_mask); }
490READ32_HANDLER( pc_cga32le_r ) { return read32le_with_read8_handler(pc_cga8_r, offset, mem_mask); }
491WRITE32_HANDLER( pc_cga32le_w ) { write32le_with_write8_handler(pc_cga8_w, offset, data, mem_mask); }
488READ16_HANDLER( pc_cga16le_r ) { return read16le_with_read8_handler(pc_cga8_r,machine,  offset, mem_mask); }
489WRITE16_HANDLER( pc_cga16le_w ) { write16le_with_write8_handler(pc_cga8_w, machine, offset, data, mem_mask); }
490READ32_HANDLER( pc_cga32le_r ) { return read32le_with_read8_handler(pc_cga8_r, machine, offset, mem_mask); }
491WRITE32_HANDLER( pc_cga32le_w ) { write32le_with_write8_handler(pc_cga8_w, machine, offset, data, mem_mask); }
492492
493493
494494
r1877r1878
12691269         }
12701270      }
12711271      mscrtc6845_set_char_lines(mscrtc6845, 200 );
1272      pc_cga8_w(offset, data);
1272      pc_cga8_w(machine, offset, data);
12731273      break;
12741274
12751275   default:
1276      pc_cga8_w(offset,data);
1276      pc_cga8_w(machine, offset,data);
12771277      break;
12781278   }
12791279}
r1877r1878
12921292      break;
12931293
12941294   default:
1295      data = pc_cga8_r(offset);
1295      data = pc_cga8_r(machine, offset);
12961296      break;
12971297   }
12981298   return data;
r1877r1878
13131313
13141314
13151315
1316READ16_HANDLER ( pc1512_16le_r ) { return read16le_with_read8_handler(pc1512_r, offset, mem_mask); }
1317WRITE16_HANDLER ( pc1512_16le_w ) { write16le_with_write8_handler(pc1512_w, offset, data, mem_mask); }
1318WRITE16_HANDLER ( pc1512_videoram16le_w ) { write16le_with_write8_handler(pc1512_videoram_w, offset, data, mem_mask); }
1316READ16_HANDLER ( pc1512_16le_r ) { return read16le_with_read8_handler(pc1512_r, machine, offset, mem_mask); }
1317WRITE16_HANDLER ( pc1512_16le_w ) { write16le_with_write8_handler(pc1512_w, machine, offset, data, mem_mask); }
1318WRITE16_HANDLER ( pc1512_videoram16le_w ) { write16le_with_write8_handler(pc1512_videoram_w, machine, offset, data, mem_mask); }
13191319
13201320
13211321
src/mess/video/pc_cga.h
r1877r1878
2929WRITE16_HANDLER( pc1512_16le_w );
3030WRITE16_HANDLER( pc1512_videoram16le_w );
3131
32#define CGA_FONT      (input_port_20_r(0)&3)
32#define CGA_FONT      (readinputport(20)&3)
3333
3434//internal use
3535void pc_cga_cursor(struct mscrtc6845_cursor *cursor);
src/mess/video/amstrad.c
r1877r1878
999999   switch(command & 0xf000)
10001000   {
10011001   case 0x0000:  // Load PSG register
1002      AY8910_control_port_0_w(0,(command & 0x0f00) >> 8);
1003      AY8910_write_port_0_w(0,command & 0x00ff);
1004      AY8910_control_port_0_w(0,prev_reg);
1002      AY8910_control_port_0_w(machine, 0,(command & 0x0f00) >> 8);
1003      AY8910_write_port_0_w(machine, 0,command & 0x00ff);
1004      AY8910_control_port_0_w(machine, 0,prev_reg);
10051005      logerror("DMA %i: LOAD %i, %i\n",channel,(command & 0x0f00) >> 8, command & 0x00ff);
10061006      break;
10071007   case 0x1000:  // Pause for n HSYNCs (0 - 4095)
src/mess/video/ted7360.c
r1877r1878
496496static int timer1_active, timer2_active, timer3_active;
497497static emu_timer *timer1, *timer2, *timer3;
498498static int cursor1 = FALSE;
499static read8_handler vic_dma_read;
500static read8_handler vic_dma_read_rom;
499static read8_machine_func vic_dma_read;
500static read8_machine_func vic_dma_read_rom;
501501static int chargenaddr, bitmapaddr, videoaddr;
502502
503503static int x_begin, x_end;
r1877r1878
540540   timer3 = timer_alloc(ted7360_timer_timeout, NULL);
541541}
542542
543void ted7360_set_dma (read8_handler dma_read,
544                 read8_handler dma_read_rom)
543void ted7360_set_dma (read8_machine_func dma_read,
544                 read8_machine_func dma_read_rom)
545545{
546546   vic_dma_read = dma_read;
547547   vic_dma_read_rom = dma_read_rom;
r1877r1878
967967   for (y = ybegin; y <= yend; y++)
968968   {
969969      if (INROM)
970         code = vic_dma_read_rom (chargenaddr + ch * 8 + y);
970         code = vic_dma_read_rom (Machine, chargenaddr + ch * 8 + y);
971971      else
972         code = vic_dma_read (chargenaddr + ch * 8 + y);
972         code = vic_dma_read (Machine, chargenaddr + ch * 8 + y);
973973      *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 0 + xoff) = color[code >> 7];
974974      *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 1 + xoff) = color[(code >> 6) & 1];
975975      *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 2 + xoff) = color[(code >> 5) & 1];
r1877r1878
989989   for (y = ybegin; y <= yend; y++)
990990   {
991991      if (INROM)
992         code = vic_dma_read_rom (chargenaddr + ch * 8 + y);
992         code = vic_dma_read_rom (Machine, chargenaddr + ch * 8 + y);
993993      else
994         code = vic_dma_read (chargenaddr + ch * 8 + y);
994         code = vic_dma_read (Machine, chargenaddr + ch * 8 + y);
995995      *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 0 + xoff) =
996996         *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 1 + xoff) = multi[code >> 6];
997997      *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 2 + xoff) =
r1877r1878
10101010
10111011   for (y = ybegin; y <= yend; y++)
10121012   {
1013      code = vic_dma_read (bitmapaddr + ch * 8 + y);
1013      code = vic_dma_read (Machine, bitmapaddr + ch * 8 + y);
10141014      *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 0 + xoff) = c16_bitmap[code >> 7];
10151015      *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 1 + xoff) = c16_bitmap[(code >> 6) & 1];
10161016      *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 2 + xoff) = c16_bitmap[(code >> 5) & 1];
r1877r1878
10291029
10301030   for (y = ybegin; y <= yend; y++)
10311031   {
1032      code = vic_dma_read (bitmapaddr + ch * 8 + y);
1032      code = vic_dma_read (Machine, bitmapaddr + ch * 8 + y);
10331033      *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 0 + xoff) =
10341034         *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 1 + xoff) = bitmapmulti[code >> 6];
10351035      *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 2 + xoff) =
r1877r1878
11181118      {
11191119         if (HIRESON)
11201120         {
1121            ch = vic_dma_read ((videoaddr | 0x400) + offs);
1122            attr = vic_dma_read (((videoaddr) + offs));
1121            ch = vic_dma_read (Machine, (videoaddr | 0x400) + offs);
1122            attr = vic_dma_read (Machine, ((videoaddr) + offs));
11231123            c1 = ((ch >> 4) & 0xf) | (attr << 4);
11241124            c2 = (ch & 0xf) | (attr & 0x70);
11251125            bitmapmulti[1] = c16_bitmap[1] = Machine->pens[c1 & 0x7f];
r1877r1878
11351135         }
11361136         else
11371137         {
1138            ch = vic_dma_read ((videoaddr | 0x400) + offs);
1139            attr = vic_dma_read (((videoaddr) + offs));
1138            ch = vic_dma_read (Machine, (videoaddr | 0x400) + offs);
1139            attr = vic_dma_read (Machine, ((videoaddr) + offs));
11401140            // levente harsfalvi's docu says cursor off in ecm and multicolor
11411141            if (ECMON)
11421142            {
src/mess/video/ted7360.h
r1877r1878
2020/* pal version */
2121/* dma_read: videochip fetched 1 byte data from system bus */
2222extern void ted7360_init (int pal);
23extern void ted7360_set_dma (read8_handler dma_read,
24                      read8_handler dma_read_rom);
23extern void ted7360_set_dma (read8_machine_func dma_read,
24                      read8_machine_func dma_read_rom);
2525
2626#define TED7360NTSC_VRETRACERATE 60
2727#define TED7360PAL_VRETRACERATE 50
src/mess/video/vc4000.c
r1877r1878
139139 
140140#ifndef ANALOG_HACK
141141   case 0xcc:
142      if (!activecpu_get_reg(S2650_FO)) data=input_port_7_r(0);
143      else data=input_port_8_r(0);
142      if (!activecpu_get_reg(S2650_FO)) data=readinputport(7);
143      else data=readinputport(8);
144144      break;
145145   case 0xcd:
146      if (!activecpu_get_reg(S2650_FO)) data=input_port_9_r(0);
147      else data=input_port_10_r(0);
146      if (!activecpu_get_reg(S2650_FO)) data=readinputport(9);
147      else data=readinputport(10);
148148      break;
149149#else
150150
r1877r1878
153153      // between 20 and 225
154154      if (!activecpu_get_reg(S2650_FO))
155155      {
156         if (input_port_7_r(0)&0x1) data=20;
157         if (input_port_7_r(0)&0x2) data=225;
156         if (readinputport(7)&0x1) data=20;
157         if (readinputport(7)&0x2) data=225;
158158      }
159159      else
160160      {
161         if (input_port_7_r(0)&0x4) data=225;
162         if (input_port_7_r(0)&0x8) data=20;
161         if (readinputport(7)&0x4) data=225;
162         if (readinputport(7)&0x8) data=20;
163163      }
164164      break;
165165
r1877r1878
167167      data = 0x66;
168168      if (!activecpu_get_reg(S2650_FO))
169169      {
170         if (input_port_7_r(0)&0x10) data=20;
171         if (input_port_7_r(0)&0x20) data=225;
170         if (readinputport(7)&0x10) data=20;
171         if (readinputport(7)&0x20) data=225;
172172      }
173173      else
174174      {
175         if (input_port_7_r(0)&0x40) data=225;
176         if (input_port_7_r(0)&0x80) data=20;
175         if (readinputport(7)&0x40) data=225;
176         if (readinputport(7)&0x80) data=20;
177177      }
178178      break;
179179#endif
src/mess/machine/wswan.c
r1877r1878
828828               Bit 0-3 - Master volume
829829               Bit 4-7 - Unknown
830830            */
831         wswan_sound_port_w( offset, data );
831         wswan_sound_port_w( machine, offset, data );
832832         break;
833833      case 0xa0:   /* Hardware type - this is probably read only
834834               Bit 0   - Enable cartridge slot and/or disable bios
r1877r1878
13781378   /* Handle Sound DMA */
13791379   if ( ( sound_dma.enable & 0x88 ) == 0x80 ) {
13801380      /* TODO: Output sound DMA byte */
1381      wswan_port_w( 0x89, program_read_byte_8( sound_dma.source ) );
1381      wswan_port_w( machine, 0x89, program_read_byte_8( sound_dma.source ) );
13821382      sound_dma.size--;
13831383      sound_dma.source = ( sound_dma.source + 1 ) & 0x0FFFFF;
13841384      if ( sound_dma.size == 0 ) {
src/mess/machine/zx.c
r1877r1878
4343   return address;
4444}
4545
46static void common_init_machine(opbase_handler setopbase)
46static void common_init_machine(opbase_handler_func setopbase)
4747{
4848   memory_set_opbase_handler(0, setopbase);
4949   zx_tape_bit = 0x80;
src/mess/machine/dgn_beta.c
r1877r1878
174174// Info for bank switcher
175175struct bank_info_entry
176176{
177   write8_handler handler;   // Pointer to write handler
177   write8_machine_func handler;   // Pointer to write handler
178178   offs_t start;      // Offset of start of block
179179   offs_t end;      // offset of end of block
180180};
r1877r1878
239239{
240240   int      Page;
241241   UINT8       *readbank;
242   write8_handler    writebank;
242   write8_machine_func    writebank;
243243   int      bank_start;
244244   int      bank_end;
245245   int      MapPage;
r1877r1878
562562      {
563563         switch (Idx)
564564         {
565            case 0 : Keyboard[Idx]=input_port_0_r(0); break;
566            case 1 : Keyboard[Idx]=input_port_1_r(0); break;
567            case 2 : Keyboard[Idx]=input_port_2_r(0); break;
568            case 3 : Keyboard[Idx]=input_port_3_r(0); break;
569            case 4 : Keyboard[Idx]=input_port_4_r(0); break;
570            case 5 : Keyboard[Idx]=input_port_5_r(0); break;
571            case 6 : Keyboard[Idx]=input_port_6_r(0); break;
572            case 7 : Keyboard[Idx]=input_port_7_r(0); break;
573            case 8 : Keyboard[Idx]=input_port_8_r(0); break;
574            case 9 : Keyboard[Idx]=input_port_9_r(0); break;
565            case 0 : Keyboard[Idx]=readinputport(0); break;
566            case 1 : Keyboard[Idx]=readinputport(1); break;
567            case 2 : Keyboard[Idx]=readinputport(2); break;
568            case 3 : Keyboard[Idx]=readinputport(3); break;
569            case 4 : Keyboard[Idx]=readinputport(4); break;
570            case 5 : Keyboard[Idx]=readinputport(5); break;
571            case 6 : Keyboard[Idx]=readinputport(6); break;
572            case 7 : Keyboard[Idx]=readinputport(7); break;
573            case 8 : Keyboard[Idx]=readinputport(8); break;
574            case 9 : Keyboard[Idx]=readinputport(9); break;
575575         }
576576
577577         if(Keyboard[Idx]!=0x7F)
r1877r1878
903903
904904static void dgnbeta_fdc_callback(wd17xx_state_t event, void *param)
905905{
906   running_machine *machine = Machine;
906907   /* The INTRQ line goes through pia2 ca1, in exactly the same way as DRQ from DragonDos does */
907908   /* DRQ is routed through various logic to the FIRQ inturrupt line on *BOTH* CPUs */
908909
909910   switch(event)
910911   {
911912      case WD17XX_IRQ_CLR:
912         pia_2_ca1_w(0,CLEAR_LINE);
913         pia_2_ca1_w(machine, 0, CLEAR_LINE);
913914         break;
914915      case WD17XX_IRQ_SET:
915         pia_2_ca1_w(0,ASSERT_LINE);
916         pia_2_ca1_w(machine, 0, ASSERT_LINE);
916917         break;
917918      case WD17XX_DRQ_CLR:
918919         /*wd2797_drq=CLEAR_LINE;*/
r1877r1878
934935   switch(offset & 0x03)
935936   {
936937      case 0:
937         result = wd17xx_status_r(0);
938         result = wd17xx_status_r(machine, 0);
938939         LOG_DISK(("Disk status=%2.2X\n",result));
939940         break;
940941      case 1:
941         result = wd17xx_track_r(0);
942         result = wd17xx_track_r(machine, 0);
942943         break;
943944      case 2:
944         result = wd17xx_sector_r(0);
945         result = wd17xx_sector_r(machine, 0);
945946         break;
946947      case 3:
947         result = wd17xx_data_r(0);
948         result = wd17xx_data_r(machine, 0);
948949         break;
949950      default:
950951         break;
r1877r1878
962963         /* But only for Type 3/4 commands */
963964         if(data & 0x80)
964965            wd17xx_set_side((data & 0x02) ? 1 : 0);
965         wd17xx_command_w(0, data);
966         wd17xx_command_w(machine, 0, data);
966967         break;
967968      case 1:
968         wd17xx_track_w(0, data);
969         wd17xx_track_w(machine, 0, data);
969970         break;
970971      case 2:
971         wd17xx_sector_w(0, data);
972         wd17xx_sector_w(machine, 0, data);
972973         break;
973974      case 3:
974         wd17xx_data_w(0, data);
975         wd17xx_data_w(machine, 0, data);
975976         break;
976977   };
977978}
r1877r1878
991992   {
992993      switch (Idx)
993994      {
994         case 0 : Row=input_port_0_r(0) /*| 0x33*/; break;
995         case 1 : Row=input_port_1_r(0); break;
996         case 2 : Row=input_port_2_r(0); break;
997         case 3 : Row=input_port_3_r(0); break;
998         case 4 : Row=input_port_4_r(0); break;
999         case 5 : Row=input_port_5_r(0); break;
1000         case 6 : Row=input_port_6_r(0); break;
1001         case 7 : Row=input_port_7_r(0); break;
1002         case 8 : Row=input_port_8_r(0); break;
1003         case 9 : Row=input_port_9_r(0); break;
995         case 0 : Row=readinputport(0) /*| 0x33*/; break;
996         case 1 : Row=readinputport(1); break;
997         case 2 : Row=readinputport(2); break;
998         case 3 : Row=readinputport(3); break;
999         case 4 : Row=readinputport(4); break;
1000         case 5 : Row=readinputport(5); break;
1001         case 6 : Row=readinputport(6); break;
1002         case 7 : Row=readinputport(7); break;
1003         case 8 : Row=readinputport(8); break;
1004         case 9 : Row=readinputport(9); break;
10041005         default : Row=0x7F; break;
10051006      }
10061007      Keyboard[Idx]=Row;
r1877r1878
10161017/* VBlank inturrupt */
10171018void dgn_beta_frame_interrupt (int data)
10181019{
1020   running_machine *machine = Machine;
1021
10191022   /* Set PIA line, so it recognises inturrupt */
10201023   if (!data)
10211024   {
1022      pia_2_cb2_w(0,ASSERT_LINE);
1025      pia_2_cb2_w(machine, 0, ASSERT_LINE);
10231026   }
10241027   else
10251028   {
1026      pia_2_cb2_w(0,CLEAR_LINE);
1029      pia_2_cb2_w(machine, 0, CLEAR_LINE);
10271030   }
10281031   LOG_VIDEO(("Vblank\n"));
10291032   ScanInKeyboard();
r1877r1878
10341037//   /* Set PIA line, so it recognises inturrupt */
10351038//   if (data)
10361039//   {
1037//      pia_0_cb1_w(0,ASSERT_LINE);
1040//      pia_0_cb1_w(machine, 0,ASSERT_LINE);
10381041//   }
10391042//   else
10401043//   {
1041//      pia_0_cb1_w(0,CLEAR_LINE);
1044//      pia_0_cb1_w(machine, 0,CLEAR_LINE);
10421045//   }
10431046}
10441047
src/mess/machine/nec765.c
r1877r1878
20972097   nec765_set_dma_drq(CLEAR_LINE);
20982098
20992099   /* write data */
2100   nec765_data_w(offset, data);
2100   nec765_data_w(machine, offset, data);
21012101}
21022102
2103 READ8_HANDLER(nec765_dack_r)
2103READ8_HANDLER(nec765_dack_r)
21042104{
21052105   /* clear data request */
21062106   nec765_set_dma_drq(CLEAR_LINE);
21072107
21082108   /* read data */
2109   return nec765_data_r(offset);
2109   return nec765_data_r(machine, offset);
21102110}
21112111
21122112
src/mess/machine/apple2gs.c
r1877r1878
868868         }
869869         else
870870         {
871            sndglu_dummy_read = ES5503_reg_0_r(sndglu_addr);
871            sndglu_dummy_read = ES5503_reg_0_r(machine, sndglu_addr);
872872         }
873873
874874         if (sndglu_ctrl & 0x20)   // auto-increment
r1877r1878
907907         }
908908         else
909909         {
910            ES5503_reg_0_w(sndglu_addr, data);
910            ES5503_reg_0_w(machine, sndglu_addr, data);
911911         }
912912
913913         if (sndglu_ctrl & 0x20)   // auto-increment
r1877r1878
10471047      case 0x39:   /* C039 - SCCAREG */
10481048      case 0x3A:   /* C03A - SCCBDATA */
10491049      case 0x3B:   /* C03B - SCCADATA */
1050         result = scc_r(offset & 0x03);
1050         result = scc_r(machine, offset & 0x03);
10511051         break;
10521052
10531053      case 0x3C:   /* C03C - SOUNDCTL */
10541054      case 0x3D:   /* C03D - SOUNDDATA */
10551055      case 0x3E:   /* C03E - SOUNDADRL */
10561056      case 0x3F:   /* C03F - SOUNDADRH */
1057         result = gssnd_r(offset & 0x03);
1057         result = gssnd_r(machine, offset & 0x03);
10581058         break;
10591059
10601060      case 0x41:   /* C041 - INTEN */
r1877r1878
10881088         result = 0x00;
10891089
10901090      default:
1091         result = apple2_c0xx_r(offset);
1091         result = apple2_c0xx_r(machine, offset);
10921092         break;
10931093   }
10941094
r1877r1878
11771177
11781178      case 0x36:   /* C036 - CYAREG */
11791179         apple2gs_cyareg = data & ~0x20;
1180         cpunum_set_clock(Machine, 0, (data & 0x80) ? APPLE2GS_14M/5 : APPLE2GS_7M/7);
1180         cpunum_set_clock(machine, 0, (data & 0x80) ? APPLE2GS_14M/5 : APPLE2GS_7M/7);
11811181         break;
11821182
11831183      case 0x38:   /* C038 - SCCBREG */
11841184      case 0x39:   /* C039 - SCCAREG */
11851185      case 0x3A:   /* C03A - SCCBDATA */
11861186      case 0x3B:   /* C03B - SCCADATA */
1187         scc_w(offset & 0x03, data);
1187         scc_w(machine, offset & 0x03, data);
11881188         break;
11891189
11901190      case 0x3C:   /* C03C - SOUNDCTL */
11911191      case 0x3D:   /* C03D - SOUNDDATA */
11921192      case 0x3E:   /* C03E - SOUNDADRL */
11931193      case 0x3F:   /* C03F - SOUNDADRH */
1194         gssnd_w(offset & 0x03, data);
1194         gssnd_w(machine, offset & 0x03, data);
11951195         break;
11961196
11971197      case 0x41:   /* C041 - INTEN */
r1877r1878
12211221         break;
12221222
12231223      default:
1224         apple2_c0xx_w(offset, data);
1224         apple2_c0xx_w(machine, offset, data);
12251225         break;
12261226   }
12271227}
r1877r1878
13081308         {
13091309            int color = (offset - 0x19e00) >> 1;
13101310
1311            palette_set_color_rgb(Machine, color + 16,
1311            palette_set_color_rgb(machine, color + 16,
13121312               ((apple2gs_slowmem[0x19E00 + (color * 2) + 1] >> 0) & 0x0F) * 17,
13131313               ((apple2gs_slowmem[0x19E00 + (color * 2) + 0] >> 4) & 0x0F) * 17,
13141314               ((apple2gs_slowmem[0x19E00 + (color * 2) + 0] >> 0) & 0x0F) * 17);
r1877r1878
15271527
15281528
15291529
1530static UINT8 apple2gs_xxCxxx_r(offs_t address)
1530static UINT8 apple2gs_xxCxxx_r(running_machine *machine, offs_t address)
15311531{
15321532   UINT8 result;
15331533   int slot;
r1877r1878
15381538   }
15391539   else if ((address & 0x000F00) == 0x000000)
15401540   {
1541      result = apple2gs_c0xx_r(address);
1541      result = apple2gs_c0xx_r(machine, address);
15421542   }
15431543   else
15441544   {
r1877r1878
15541554
15551555
15561556
1557static void apple2gs_xxCxxx_w(offs_t address, UINT8 data)
1557static void apple2gs_xxCxxx_w(running_machine *machine, offs_t address, UINT8 data)
15581558{
15591559   int slot;
15601560
r1877r1878
15641564   }
15651565   else if ((address & 0x000F00) == 0x000000)
15661566   {
1567      apple2gs_c0xx_w(address, data);
1567      apple2gs_c0xx_w(machine, address, data);
15681568   }
15691569   else
15701570   {
r1877r1878
16151615
16161616
16171617
1618static READ8_HANDLER( apple2gs_00Cxxx_r ) { return apple2gs_xxCxxx_r(offset | 0x00C000); }
1619static READ8_HANDLER( apple2gs_01Cxxx_r ) { return apple2gs_xxCxxx_r(offset | 0x01C000); }
1620static READ8_HANDLER( apple2gs_E0Cxxx_r ) { return apple2gs_xxCxxx_r(offset | 0xE0C000); }
1621static READ8_HANDLER( apple2gs_E1Cxxx_r ) { return apple2gs_xxCxxx_r(offset | 0xE1C000); }
1618static READ8_HANDLER( apple2gs_00Cxxx_r ) { return apple2gs_xxCxxx_r(machine, offset | 0x00C000); }
1619static READ8_HANDLER( apple2gs_01Cxxx_r ) { return apple2gs_xxCxxx_r(machine, offset | 0x01C000); }
1620static READ8_HANDLER( apple2gs_E0Cxxx_r ) { return apple2gs_xxCxxx_r(machine, offset | 0xE0C000); }
1621static READ8_HANDLER( apple2gs_E1Cxxx_r ) { return apple2gs_xxCxxx_r(machine, offset | 0xE1C000); }
16221622
1623static WRITE8_HANDLER( apple2gs_00Cxxx_w) { apple2gs_xxCxxx_w(offset | 0x00C000, data); }
1624static WRITE8_HANDLER( apple2gs_01Cxxx_w) { apple2gs_xxCxxx_w(offset | 0x01C000, data); }
1625static WRITE8_HANDLER( apple2gs_E0Cxxx_w) { apple2gs_xxCxxx_w(offset | 0xE0C000, data); }
1626static WRITE8_HANDLER( apple2gs_E1Cxxx_w) { apple2gs_xxCxxx_w(offset | 0xE1C000, data); }
1623static WRITE8_HANDLER( apple2gs_00Cxxx_w) { apple2gs_xxCxxx_w(machine, offset | 0x00C000, data); }
1624static WRITE8_HANDLER( apple2gs_01Cxxx_w) { apple2gs_xxCxxx_w(machine, offset | 0x01C000, data); }
1625static WRITE8_HANDLER( apple2gs_E0Cxxx_w) { apple2gs_xxCxxx_w(machine, offset | 0xE0C000, data); }
1626static WRITE8_HANDLER( apple2gs_E1Cxxx_w) { apple2gs_xxCxxx_w(machine, offset | 0xE1C000, data); }
16271627
16281628static WRITE8_HANDLER( apple2gs_Exxxxx_w )
16291629{
16301630   apple2gs_slowmem[offset] = data;
16311631}
16321632
1633static WRITE8_HANDLER( apple2gs_E004xx_w ) { apple2gs_Exxxxx_w(offset + 0x00400, data); }
1634static WRITE8_HANDLER( apple2gs_E02xxx_w ) { apple2gs_Exxxxx_w(offset + 0x02000, data); }
1635static WRITE8_HANDLER( apple2gs_E104xx_w ) { apple2gs_Exxxxx_w(offset + 0x10400, data); }
1636static WRITE8_HANDLER( apple2gs_E12xxx_w ) { apple2gs_Exxxxx_w(offset + 0x12000, data); }
1633static WRITE8_HANDLER( apple2gs_E004xx_w ) { apple2gs_Exxxxx_w(machine, offset + 0x00400, data); }
1634static WRITE8_HANDLER( apple2gs_E02xxx_w ) { apple2gs_Exxxxx_w(machine, offset + 0x02000, data); }
1635static WRITE8_HANDLER( apple2gs_E104xx_w ) { apple2gs_Exxxxx_w(machine, offset + 0x10400, data); }
1636static WRITE8_HANDLER( apple2gs_E12xxx_w ) { apple2gs_Exxxxx_w(machine, offset + 0x12000, data); }
16371637
16381638static WRITE8_HANDLER( apple2gs_slowmem_w )
16391639{
r1877r1878
16431643   {
16441644      int color = (offset - 0x19e00) >> 1;
16451645
1646      palette_set_color_rgb(Machine, color + 16,
1646      palette_set_color_rgb(machine, color + 16,
16471647         ((apple2gs_slowmem[0x19E00 + (color * 2) + 1] >> 0) & 0x0F) * 17,
16481648         ((apple2gs_slowmem[0x19E00 + (color * 2) + 0] >> 4) & 0x0F) * 17,
16491649         ((apple2gs_slowmem[0x19E00 + (color * 2) + 0] >> 0) & 0x0F) * 17);
src/mess/machine/hp48.c
r1877r1878
6868// to do support weired comparator settings
6969static void hp48_config(void)
7070{
71   static const read8_handler read_handlers[11] = { 0, MRA8_BANK1, MRA8_BANK2, MRA8_BANK3, MRA8_BANK4, MRA8_BANK5, MRA8_BANK6, MRA8_BANK7, MRA8_BANK8, MRA8_BANK9, MRA8_BANK10 };
71   static const read8_machine_func read_handlers[11] = { 0, MRA8_BANK1, MRA8_BANK2, MRA8_BANK3, MRA8_BANK4, MRA8_BANK5, MRA8_BANK6, MRA8_BANK7, MRA8_BANK8, MRA8_BANK9, MRA8_BANK10 };
7272   int i, begin_bank, end_bank, begin, end, mem_type, bank;
7373
7474   /* Determine the current memory map */
r1877r1878
151151
152152   /* Check for write to HDW */
153153   if ( hp48s.mem[HDW].adr != -1 && offset >= hp48s.mem[HDW].adr && offset < hp48s.mem[HDW].adr + 0x40 ) {
154      hp48_write( offset & 0x3F, data );
154      hp48_write( machine, offset & 0x3F, data );
155155   } else {
156156      switch( hp48_banks[bank].type ) {
157157      case HP48_RAM:
r1877r1878
500500      if (KEY_PLUS) data|=1;
501501   }
502502#else
503   if (out&0x100) data|=input_port_0_r(0);
504   if (out&0x080) data|=input_port_1_r(0);
505   if (out&0x040) data|=input_port_2_r(0);
506   if (out&0x020) data|=input_port_3_r(0);
507   if (out&0x010) data|=input_port_4_r(0);
508   if (out&0x008) data|=input_port_5_r(0);
509   if (out&0x004) data|=input_port_6_r(0);
510   if (out&0x002) data|=input_port_7_r(0);
511   if (out&0x001) data|=input_port_8_r(0);
503   if (out&0x100) data|=readinputport(0);
504   if (out&0x080) data|=readinputport(1);
505   if (out&0x040) data|=readinputport(2);
506   if (out&0x020) data|=readinputport(3);
507   if (out&0x010) data|=readinputport(4);
508   if (out&0x008) data|=readinputport(5);
509   if (out&0x004) data|=readinputport(6);
510   if (out&0x002) data|=readinputport(7);
511   if (out&0x001) data|=readinputport(8);
512512#endif
513513   return data;
514514}
src/mess/machine/apple3.c
r1877r1878
184184      case 0xE4: case 0xE5: case 0xE6: case 0xE7:
185185      case 0xE8: case 0xE9: case 0xEA: case 0xEB:
186186      case 0xEC: case 0xED: case 0xEE: case 0xEF:
187         result = applefdc_r(offset);
187         result = applefdc_r(machine, offset);
188188         break;
189189
190190      case 0xF0:
191191      case 0xF1:
192192      case 0xF2:
193193      case 0xF3:
194         result = acia_6551_r(offset & 0x03);
194         result = acia_6551_r(machine, offset & 0x03);
195195         break;
196196   }
197197   return result;
r1877r1878
245245      case 0xE4: case 0xE5: case 0xE6: case 0xE7:
246246      case 0xE8: case 0xE9: case 0xEA: case 0xEB:
247247      case 0xEC: case 0xED: case 0xEE: case 0xEF:
248         applefdc_w(offset, data);
248         applefdc_w(machine, offset, data);
249249         break;
250250
251251      case 0xF0:
252252      case 0xF1:
253253      case 0xF2:
254254      case 0xF3:
255         acia_6551_w(offset & 0x03, data);
255         acia_6551_w(machine, offset & 0x03, data);
256256         break;
257257   }
258258}
src/mess/machine/uart8250.c
r1877r1878
428428WRITE8_HANDLER ( uart8250_2_w ) { uart8250_w(2, offset, data); }
429429WRITE8_HANDLER ( uart8250_3_w ) { uart8250_w(3, offset, data); }
430430
431READ16_HANDLER ( uart8250_16le_0_r ) { return read16le_with_read8_handler(uart8250_0_r, offset, mem_mask); }
432READ16_HANDLER ( uart8250_16le_1_r ) { return read16le_with_read8_handler(uart8250_1_r, offset, mem_mask); }
433READ16_HANDLER ( uart8250_16le_2_r ) { return read16le_with_read8_handler(uart8250_2_r, offset, mem_mask); }
434READ16_HANDLER ( uart8250_16le_3_r ) { return read16le_with_read8_handler(uart8250_3_r, offset, mem_mask); }
435WRITE16_HANDLER ( uart8250_16le_0_w ) { write16le_with_write8_handler(uart8250_0_w, offset, data, mem_mask); }
436WRITE16_HANDLER ( uart8250_16le_1_w ) { write16le_with_write8_handler(uart8250_1_w, offset, data, mem_mask); }
437WRITE16_HANDLER ( uart8250_16le_2_w ) { write16le_with_write8_handler(uart8250_2_w, offset, data, mem_mask); }
438WRITE16_HANDLER ( uart8250_16le_3_w ) { write16le_with_write8_handler(uart8250_3_w, offset, data, mem_mask); }
431READ16_HANDLER ( uart8250_16le_0_r ) { return read16le_with_read8_handler(uart8250_0_r, machine, offset, mem_mask); }
432READ16_HANDLER ( uart8250_16le_1_r ) { return read16le_with_read8_handler(uart8250_1_r, machine, offset, mem_mask); }
433READ16_HANDLER ( uart8250_16le_2_r ) { return read16le_with_read8_handler(uart8250_2_r, machine, offset, mem_mask); }
434READ16_HANDLER ( uart8250_16le_3_r ) { return read16le_with_read8_handler(uart8250_3_r, machine, offset, mem_mask); }
435WRITE16_HANDLER ( uart8250_16le_0_w ) { write16le_with_write8_handler(uart8250_0_w, machine, offset, data, mem_mask); }
436WRITE16_HANDLER ( uart8250_16le_1_w ) { write16le_with_write8_handler(uart8250_1_w, machine, offset, data, mem_mask); }
437WRITE16_HANDLER ( uart8250_16le_2_w ) { write16le_with_write8_handler(uart8250_2_w, machine, offset, data, mem_mask); }
438WRITE16_HANDLER ( uart8250_16le_3_w ) { write16le_with_write8_handler(uart8250_3_w, machine, offset, data, mem_mask); }
439439
440READ32_HANDLER ( uart8250_32le_0_r ) { return read32le_with_read8_handler(uart8250_0_r, offset, mem_mask); }
441READ32_HANDLER ( uart8250_32le_1_r ) { return read32le_with_read8_handler(uart8250_1_r, offset, mem_mask); }
442READ32_HANDLER ( uart8250_32le_2_r ) { return read32le_with_read8_handler(uart8250_2_r, offset, mem_mask); }
443READ32_HANDLER ( uart8250_32le_3_r ) { return read32le_with_read8_handler(uart8250_3_r, offset, mem_mask); }
444WRITE32_HANDLER ( uart8250_32le_0_w ) { write32le_with_write8_handler(uart8250_0_w, offset, data, mem_mask); }
445WRITE32_HANDLER ( uart8250_32le_1_w ) { write32le_with_write8_handler(uart8250_1_w, offset, data, mem_mask); }
446WRITE32_HANDLER ( uart8250_32le_2_w ) { write32le_with_write8_handler(uart8250_2_w, offset, data, mem_mask); }
447WRITE32_HANDLER ( uart8250_32le_3_w ) { write32le_with_write8_handler(uart8250_3_w, offset, data, mem_mask); }
440READ32_HANDLER ( uart8250_32le_0_r ) { return read32le_with_read8_handler(uart8250_0_r, machine, offset, mem_mask); }
441READ32_HANDLER ( uart8250_32le_1_r ) { return read32le_with_read8_handler(uart8250_1_r, machine, offset, mem_mask); }
442READ32_HANDLER ( uart8250_32le_2_r ) { return read32le_with_read8_handler(uart8250_2_r, machine, offset, mem_mask); }
443READ32_HANDLER ( uart8250_32le_3_r ) { return read32le_with_read8_handler(uart8250_3_r, machine, offset, mem_mask); }
444WRITE32_HANDLER ( uart8250_32le_0_w ) { write32le_with_write8_handler(uart8250_0_w, machine, offset, data, mem_mask); }
445WRITE32_HANDLER ( uart8250_32le_1_w ) { write32le_with_write8_handler(uart8250_1_w, machine, offset, data, mem_mask); }
446WRITE32_HANDLER ( uart8250_32le_2_w ) { write32le_with_write8_handler(uart8250_2_w, machine, offset, data, mem_mask); }
447WRITE32_HANDLER ( uart8250_32le_3_w ) { write32le_with_write8_handler(uart8250_3_w, machine, offset, data, mem_mask); }
448448
449READ64_HANDLER ( uart8250_64be_0_r ) { return read64be_with_read8_handler(uart8250_0_r, offset, mem_mask); }
450READ64_HANDLER ( uart8250_64be_1_r ) { return read64be_with_read8_handler(uart8250_1_r, offset, mem_mask); }
451READ64_HANDLER ( uart8250_64be_2_r ) { return read64be_with_read8_handler(uart8250_2_r, offset, mem_mask); }
452READ64_HANDLER ( uart8250_64be_3_r ) { return read64be_with_read8_handler(uart8250_3_r, offset, mem_mask); }
453WRITE64_HANDLER ( uart8250_64be_0_w ) { write64be_with_write8_handler(uart8250_0_w, offset, data, mem_mask); }
454WRITE64_HANDLER ( uart8250_64be_1_w ) { write64be_with_write8_handler(uart8250_1_w, offset, data, mem_mask); }
455WRITE64_HANDLER ( uart8250_64be_2_w ) { write64be_with_write8_handler(uart8250_2_w, offset, data, mem_mask); }
456WRITE64_HANDLER ( uart8250_64be_3_w ) { write64be_with_write8_handler(uart8250_3_w, offset, data, mem_mask); }
449READ64_HANDLER ( uart8250_64be_0_r ) { return read64be_with_read8_handler(uart8250_0_r, machine, offset, mem_mask); }
450READ64_HANDLER ( uart8250_64be_1_r ) { return read64be_with_read8_handler(uart8250_1_r, machine, offset, mem_mask); }
451READ64_HANDLER ( uart8250_64be_2_r ) { return read64be_with_read8_handler(uart8250_2_r, machine, offset, mem_mask); }
452READ64_HANDLER ( uart8250_64be_3_r ) { return read64be_with_read8_handler(uart8250_3_r, machine, offset, mem_mask); }
453WRITE64_HANDLER ( uart8250_64be_0_w ) { write64be_with_write8_handler(uart8250_0_w, machine, offset, data, mem_mask); }
454WRITE64_HANDLER ( uart8250_64be_1_w ) { write64be_with_write8_handler(uart8250_1_w, machine, offset, data, mem_mask); }
455WRITE64_HANDLER ( uart8250_64be_2_w ) { write64be_with_write8_handler(uart8250_2_w, machine, offset, data, mem_mask); }
456WRITE64_HANDLER ( uart8250_64be_3_w ) { write64be_with_write8_handler(uart8250_3_w, machine, offset, data, mem_mask); }
src/mess/machine/c65.c
r1877r1878
8282   version 2:
8383   cmd 0x30 used for this
8484*/
85static void c65_dma_port_w(int offset, int value)
85static void c65_dma_port_w(running_machine *machine, int offset, int value)
8686{
8787   static int dump=0;
8888   PAIR pair, src, dst, len;
r1877r1878
9999      pair.b.h2=dma.data[2];
100100      pair.b.h=dma.data[1];
101101      pair.b.l=dma.data[0]=value;
102      cmd=c65_read_mem(pair.d++);
102      cmd=c65_read_mem(machine, pair.d++);
103103      len.w.h=0;
104      len.b.l=c65_read_mem(pair.d++);
105      len.b.h=c65_read_mem(pair.d++);
104      len.b.l=c65_read_mem(machine, pair.d++);
105      len.b.h=c65_read_mem(machine, pair.d++);
106106      src.b.h3=0;
107      fill=src.b.l=c65_read_mem(pair.d++);
108      src.b.h=c65_read_mem(pair.d++);
109      src.b.h2=c65_read_mem(pair.d++);
107      fill=src.b.l=c65_read_mem(machine, pair.d++);
108      src.b.h=c65_read_mem(machine, pair.d++);
109      src.b.h2=c65_read_mem(machine, pair.d++);
110110      dst.b.h3=0;
111      dst.b.l=c65_read_mem(pair.d++);
112      dst.b.h=c65_read_mem(pair.d++);
113      dst.b.h2=c65_read_mem(pair.d++);
111      dst.b.l=c65_read_mem(machine, pair.d++);
112      dst.b.h=c65_read_mem(machine, pair.d++);
113      dst.b.h2=c65_read_mem(machine, pair.d++);
114114
115115      switch (cmd) {
116116      case 0:
r1877r1878
118118         if (dump)
119119            DBG_LOG(1,"dma copy job",
120120                  ("len:%.4x src:%.6x dst:%.6x sub:%.2x modrm:%.2x\n",
121                   len.w.l, src.d, dst.d, c65_read_mem(pair.d),
122                   c65_read_mem(pair.d+1) ) );
121                   len.w.l, src.d, dst.d, c65_read_mem(machine, pair.d),
122                   c65_read_mem(machine, pair.d+1) ) );
123123         if ( (dma.version==1)
124124             &&( (src.d&0x400000)||(dst.d&0x400000)) ) {
125125            if ( !(src.d&0x400000) ) {
126126               dst.d&=~0x400000;
127127               for (i=0; i<len.w.l; i++)
128                  c65_write_mem(dst.d--,c65_read_mem(src.d++));
128                  c65_write_mem(machine, dst.d--,c65_read_mem(machine, src.d++));
129129            } else if ( !(dst.d&0x400000) ) {
130130               src.d&=~0x400000;
131131               for (i=0; i<len.w.l; i++)
132                  c65_write_mem(dst.d++,c65_read_mem(src.d--));
132                  c65_write_mem(machine, dst.d++,c65_read_mem(machine, src.d--));
133133            } else {
134134               src.d&=~0x400000;
135135               dst.d&=~0x400000;
136136               for (i=0; i<len.w.l; i++)
137                  c65_write_mem(--dst.d,c65_read_mem(--src.d));
137                  c65_write_mem(machine, --dst.d,c65_read_mem(machine, --src.d));
138138            }
139139         } else {
140140            for (i=0; i<len.w.l; i++)
141               c65_write_mem(dst.d++,c65_read_mem(src.d++));
141               c65_write_mem(machine, dst.d++,c65_read_mem(machine, src.d++));
142142         }
143143         break;
144144      case 3:
145145         DBG_LOG(3,"dma fill job",
146146               ("len:%.4x value:%.2x dst:%.6x sub:%.2x modrm:%.2x\n",
147                len.w.l, fill, dst.d, c65_read_mem(pair.d),
148                c65_read_mem(pair.d+1)));
147                len.w.l, fill, dst.d, c65_read_mem(machine, pair.d),
148                c65_read_mem(machine, pair.d+1)));
149149            for (i=0; i<len.w.l; i++)
150               c65_write_mem(dst.d++,fill);
150               c65_write_mem(machine, dst.d++,fill);
151151            break;
152152      case 0x30:
153153         DBG_LOG(1,"dma copy down",
154154               ("len:%.4x src:%.6x dst:%.6x sub:%.2x modrm:%.2x\n",
155                len.w.l, src.d, dst.d, c65_read_mem(pair.d),
156                c65_read_mem(pair.d+1) ) );
155                len.w.l, src.d, dst.d, c65_read_mem(machine, pair.d),
156                c65_read_mem(machine, pair.d+1) ) );
157157         for (i=0; i<len.w.l; i++)
158            c65_write_mem(dst.d--,c65_read_mem(src.d--));
158            c65_write_mem(machine, dst.d--,c65_read_mem(machine, src.d--));
159159         break;
160160      default:
161161         DBG_LOG(1,"dma job",
162162               ("cmd:%.2x len:%.4x src:%.6x dst:%.6x sub:%.2x modrm:%.2x\n",
163                cmd,len.w.l, src.d, dst.d, c65_read_mem(pair.d),
164                c65_read_mem(pair.d+1)));
163                cmd,len.w.l, src.d, dst.d, c65_read_mem(machine, pair.d),
164                c65_read_mem(machine, pair.d+1)));
165165      }
166166      break;
167167   default:
r1877r1878
170170   }
171171}
172172
173static int c65_dma_port_r(int offset)
173static int c65_dma_port_r(running_machine *machine, int offset)
174174{
175175   /* offset 3 bit 7 in progress ? */
176176   DBG_LOG (2, "dma chip read", ("%.3x\n", offset));
177177    return 0x7f;
178178}
179179
180static void c65_6511_port_w(int offset, int value)
180static void c65_6511_port_w(running_machine *machine, int offset, int value)
181181{
182182   if (offset==7) {
183183      c65_6511_port=value;
r1877r1878
185185   DBG_LOG (2, "r6511 write", ("%.2x %.2x\n", offset, value));
186186}
187187
188static int c65_6511_port_r(int offset)
188static int c65_6511_port_r(running_machine *machine, int offset)
189189{
190190   int data=0xff;
191191   if (offset==7) {
r1877r1878
320320}
321321#endif
322322
323static void c65_fdc_w(int offset, int data)
323static void c65_fdc_w(running_machine *machine, int offset, int data)
324324{
325325   DBG_LOG (1, "fdc write", ("%.5x %.2x %.2x\n", activecpu_get_pc(), offset, data));
326326   switch (offset&0xf) {
r1877r1878
371371   }
372372}
373373
374static int c65_fdc_r(int offset)
374static int c65_fdc_r(running_machine *machine, int offset)
375375{
376376   UINT8 data=0;
377377   switch (offset&0xf) {
r1877r1878
461461   switch(offset&0xf00) {
462462   case 0x000:
463463      if (offset < 0x80)
464         vic3_port_w (offset & 0x7f, data);
464         vic3_port_w (machine, offset & 0x7f, data);
465465      else if (offset < 0xa0) {
466         c65_fdc_w(offset&0x1f,data);
466         c65_fdc_w(machine, offset&0x1f,data);
467467      } else {
468         c65_ram_expansion_w(offset&0x1f, data);
468         c65_ram_expansion_w(machine, offset&0x1f, data);
469469         /*ram expansion crtl optional */
470470      }
471471      break;
472472   case 0x100:case 0x200: case 0x300:
473      vic3_palette_w(offset-0x100,data);
473      vic3_palette_w(machine, offset-0x100,data);
474474      break;
475475   case 0x400:
476476      if (offset<0x420) /* maybe 0x20 */
477         sid6581_0_port_w (offset & 0x3f, data);
477         sid6581_0_port_w (machine, offset & 0x3f, data);
478478      else if (offset<0x440)
479         sid6581_1_port_w(offset&0x3f, data);
479         sid6581_1_port_w(machine, offset&0x3f, data);
480480      else
481481         DBG_LOG (1, "io write", ("%.3x %.2x\n", offset, data));
482482      break;
r1877r1878
484484      DBG_LOG (1, "io write", ("%.3x %.2x\n", offset, data));
485485      break;
486486   case 0x600:
487      c65_6511_port_w(offset&0xff,data);
487      c65_6511_port_w(machine, offset&0xff,data);
488488      break;
489489   case 0x700:
490      c65_dma_port_w(offset&0xff, data);
490      c65_dma_port_w(machine, offset&0xff, data);
491491      break;
492492   }
493493}
r1877r1878
496496{
497497   switch(offset&0xf00) {
498498   case 0x000:
499      cia_0_w(offset, data);
499      cia_0_w(machine, offset, data);
500500      break;
501501   case 0x100:
502      cia_1_w(offset, data);
502      cia_1_w(machine, offset, data);
503503      break;
504504   case 0x200:
505505   case 0x300:
r1877r1878
513513   switch(offset&0xf00) {
514514   case 0x000:
515515      if (offset < 0x80)
516         return vic3_port_r (offset & 0x7f);
516         return vic3_port_r (machine, offset & 0x7f);
517517      if (offset < 0xa0) {
518         return c65_fdc_r(offset&0x1f);
518         return c65_fdc_r(machine, offset&0x1f);
519519      } else {
520         return c65_ram_expansion_r(offset&0x1f);
520         return c65_ram_expansion_r(machine, offset&0x1f);
521521         /*return; ram expansion crtl optional */
522522      }
523523      break;
r1877r1878
527527      break;
528528   case 0x400:
529529      if (offset<0x420)
530         return sid6581_0_port_r (offset & 0x3f);
530         return sid6581_0_port_r(machine, offset & 0x3f);
531531      if (offset<0x440)
532         return sid6581_1_port_r(offset&0x3f);
532         return sid6581_1_port_r(machine, offset&0x3f);
533533      DBG_LOG (1, "io read", ("%.3x\n", offset));
534534      break;
535535   case 0x500:
536536      DBG_LOG (1, "io read", ("%.3x\n", offset));
537537      break;
538538   case 0x600:
539      return c65_6511_port_r(offset&0xff);
539      return c65_6511_port_r(machine, offset&0xff);
540540   case 0x700:
541      return c65_dma_port_r(offset&0xff);
541      return c65_dma_port_r(machine, offset&0xff);
542542   }
543543   return 0xff;
544544}
r1877r1878
547547{
548548   switch(offset&0x300) {
549549   case 0x000:
550      return cia_0_r(offset);
550      return cia_0_r(machine, offset);
551551   case 0x100:
552      return cia_1_r(offset);
552      return cia_1_r(machine, offset);
553553   case 0x200:
554554   case 0x300:
555555      DBG_LOG (1, "io read", ("%.3x\n", offset+0xc00));
r1877r1878
572572static void c65_bankswitch_interface(int value)
573573{
574574   static int old=0;
575   read8_handler rh;
576   write8_handler wh;
575   read8_machine_func rh;
576   write8_machine_func wh;
577577
578578   DBG_LOG (2, "c65 bankswitch", ("%.2x\n",value));
579579
r1877r1878
620620{
621621   static int old = -1;
622622   int data, loram, hiram, charen;
623   read8_handler rh4, rh8;
624   write8_handler wh5, wh9;
623   read8_machine_func rh4, rh8;
624   write8_machine_func wh5, wh9;
625625
626626   data = (UINT8) cpunum_get_info_int(0, CPUINFO_INT_M6510_PORT);
627627   if (data == old)
src/mess/machine/mac.c
r1877r1878
107107   offs_t memory_size, void *memory_data, int is_rom, int bank)
108108{
109109   offs_t memory_mask;
110   read16_handler rh;
111   write16_handler wh;
110   read16_machine_func rh;
111   write16_machine_func wh;
112112
113113   memory_size = MIN(memory_size, (memory_end + 1 - memory_begin));
114114   memory_mask = memory_size - 1;
115115
116   rh = (read16_handler) (FPTR)bank;
117   wh = is_rom ? MWA16_UNMAP : (write16_handler) (FPTR)bank;
116   rh = (read16_machine_func) (FPTR)bank;
117   wh = is_rom ? MWA16_UNMAP : (write16_machine_func) (FPTR)bank;
118118
119119   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, memory_begin,
120120      memory_end, memory_mask, 0, rh);
r1877r1878
693693      reg = R5380_CURDATA_DTACK;
694694   }
695695
696   return ncr5380_r(reg)<<8;
696   return ncr5380_r(machine, reg)<<8;
697697}
698698
699699WRITE16_HANDLER ( macplus_scsi_w )
r1877r1878
705705      reg = R5380_OUTDATA_DTACK;
706706   }
707707
708   ncr5380_w(reg, data);
708   ncr5380_w(machine, reg, data);
709709}
710710
711711/* *************************************************************************
r1877r1878
751751READ16_HANDLER ( mac_scc_r )
752752{
753753   UINT16 result;
754   result = scc_r(offset);
754   result = scc_r(machine, offset);
755755   return (result << 8) | result;
756756}
757757
r1877r1878
759759
760760WRITE16_HANDLER ( mac_scc_w )
761761{
762   scc_w(offset, (UINT8) data);
762   scc_w(machine, offset, (UINT8) data);
763763}
764764
765765
r1877r1878
11181118   if (LOG_MAC_IWM)
11191119      logerror("mac_iwm_r: offset=0x%08x\n", offset);
11201120
1121   result = applefdc_r(offset >> 8);
1121   result = applefdc_r(machine, offset >> 8);
11221122   return (result << 8) | result;
11231123}
11241124
r1877r1878
11281128      logerror("mac_iwm_w: offset=0x%08x data=0x%04x\n", offset, data);
11291129
11301130   if (ACCESSING_LSB)
1131      applefdc_w(offset >> 8, data & 0xff);
1131      applefdc_w(machine, offset >> 8, data & 0xff);
11321132}
11331133
11341134/* *************************************************************************
r1877r1878
12611261
12621262   if (LOG_VIA)
12631263      logerror("mac_via_r: offset=0x%02x\n", offset);
1264   data = via_0_r(offset);
1264   data = via_0_r(machine, offset);
12651265
12661266   return (data & 0xff) | (data << 8);
12671267}
r1877r1878
12751275      logerror("mac_via_w: offset=0x%02x data=0x%08x\n", offset, data);
12761276
12771277   if (ACCESSING_MSB)
1278      via_0_w(offset, (data >> 8) & 0xff);
1278      via_0_w(machine, offset, (data >> 8) & 0xff);
12791279}
12801280
12811281
src/mess/machine/adam.c
r1877r1878
776776    //logerror("Configurando la memoria, L:%02xh, U:%02xh\n", adam_lower_memory, adam_upper_memory);
777777}
778778
779 READ8_HANDLER(adam_video_r)
779READ8_HANDLER(adam_video_r)
780780{
781    return ((offset&0x01) ? TMS9928A_register_r(1) : TMS9928A_vram_r(0));
781    return ((offset&0x01) ? TMS9928A_register_r(machine, 1) : TMS9928A_vram_r(machine, 0));
782782}
783783
784784WRITE8_HANDLER(adam_video_w)
785785{
786    (offset&0x01) ? TMS9928A_register_w(1, data) : TMS9928A_vram_w(0, data);
786    (offset&0x01) ? TMS9928A_register_w(machine, 1, data) : TMS9928A_vram_w(machine, 0, data);
787787}
788788
789789 READ8_HANDLER( master6801_ram_r )
src/mess/machine/mpc105.c
r1877r1878
6464               for (cpunum = 0; cpunum < cpu_gettotalcpu(); cpunum++)
6565               {
6666                  memory_install_read64_handler(cpunum, ADDRESS_SPACE_PROGRAM, begin, end,
67                     0, 0, (read64_handler) (FPTR)(bank + mpc105->bank_base));
67                     0, 0, (read64_machine_func) (FPTR)(bank + mpc105->bank_base));
6868                  memory_install_write64_handler(cpunum, ADDRESS_SPACE_PROGRAM, begin, end,
69                     0, 0, (write64_handler) (FPTR)(bank + mpc105->bank_base));
69                     0, 0, (write64_machine_func) (FPTR)(bank + mpc105->bank_base));
7070               }
7171               memory_set_bankptr(bank + mpc105->bank_base, mess_ram);
7272            }
src/mess/machine/msx_slot.c
r1877r1878
1818 */
1919
2020#include "driver.h"
21#include "deprecat.h"
2122#include "includes/msx_slot.h"
2223#include "includes/msx.h"
2324#include "machine/wd17xx.h"
r1877r1878
340341      return 0xff;
341342   }
342343   else {
343      return K051649_waveform_r (offset & 0x7f);
344      return K051649_waveform_r (machine, offset & 0x7f);
344345   }
345346}
346347
r1877r1878
369370
370371MSX_SLOT_WRITE(konami_scc)
371372{
373   running_machine *machine = Machine;
374
372375   if (addr >= 0x5000 && addr < 0x5800) {
373376      state->banks[0] = val & state->bank_mask;
374377      slot_konami_scc_map (state, 1);
r1877r1878
395398      int offset = addr & 0xff;
396399
397400      if (offset < 0x80) {
398         K051649_waveform_w (offset, val);
401         K051649_waveform_w (machine, offset, val);
399402      }
400403      else if (offset < 0xa0) {
401404         offset &= 0xf;
402405         if (offset < 0xa) {
403            K051649_frequency_w (offset, val);
406            K051649_frequency_w (machine, offset, val);
404407         }
405408         else if (offset < 0xf) {
406            K051649_volume_w (offset - 0xa, val);
409            K051649_volume_w (machine, offset - 0xa, val);
407410         }
408411         else {
409            K051649_keyonoff_w (0, val);
412            K051649_keyonoff_w (machine, 0, val);
410413         }
411414      }
412415#if 0
r1877r1878
11321135static  READ8_HANDLER (msx_diskrom_page1_r)
11331136{
11341137   switch (offset) {
1135   case 0: return wd17xx_status_r (0);
1136   case 1: return wd17xx_track_r (0);
1137   case 2: return wd17xx_sector_r (0);
1138   case 3: return wd17xx_data_r (0);
1138   case 0: return wd17xx_status_r (machine, 0);
1139   case 1: return wd17xx_track_r (machine, 0);
1140   case 2: return wd17xx_sector_r (machine, 0);
1141   case 3: return wd17xx_data_r (machine, 0);
11391142   case 7: return msx1.dsk_stat;
11401143   default:
11411144      return msx1.state[1]->mem[offset + 0x3ff8];
r1877r1878
11471150   if (offset >= 0x7f8) {
11481151      switch (offset) {
11491152      case 0x7f8:
1150         return wd17xx_status_r (0);
1153         return wd17xx_status_r (machine, 0);
11511154      case 0x7f9:
1152         return wd17xx_track_r (0);
1155         return wd17xx_track_r (machine, 0);
11531156      case 0x7fa:
1154         return wd17xx_sector_r (0);
1157         return wd17xx_sector_r (machine, 0);
11551158      case 0x7fb:
1156         return wd17xx_data_r (0);
1159         return wd17xx_data_r (machine, 0);
11571160      case 0x7ff:
11581161         return msx1.dsk_stat;
11591162      default:
r1877r1878
11911194
11921195MSX_SLOT_WRITE(diskrom)
11931196{
1197   running_machine *machine = Machine;
1198
11941199   if (addr >= 0xa000 && addr < 0xc000) {
11951200      addr -= 0x4000;
11961201   }
11971202   switch (addr) {
11981203   case 0x7ff8:
1199      wd17xx_command_w (0, val);
1204      wd17xx_command_w (machine, 0, val);
12001205      break;
12011206   case 0x7ff9:
1202      wd17xx_track_w (0, val);
1207      wd17xx_track_w (machine, 0, val);
12031208      break;
12041209   case 0x7ffa:
1205      wd17xx_sector_w (0, val);
1210      wd17xx_sector_w (machine, 0, val);
12061211      break;
12071212   case 0x7ffb:
1208      wd17xx_data_w (0, val);
1213      wd17xx_data_w (machine, 0, val);
12091214      break;
12101215   case 0x7ffc:
12111216      wd17xx_set_side (val & 1);
r1877r1878
12391244   wd17xx_reset ();
12401245}
12411246
1242static READ8_HANDLER (msx_diskrom2_page1_r)
1247static READ8_HANDLER (msx_diskrom2_page1_r)
12431248{
12441249   switch (offset) {
1245   case 0: return wd17xx_status_r (0);
1246   case 1: return wd17xx_track_r (0);
1247   case 2: return wd17xx_sector_r (0);
1248   case 3: return wd17xx_data_r (0);
1250   case 0: return wd17xx_status_r(machine, 0);
1251   case 1: return wd17xx_track_r(machine, 0);
1252   case 2: return wd17xx_sector_r(machine, 0);
1253   case 3: return wd17xx_data_r(machine, 0);
12491254   case 4: return msx1.dsk_stat;
12501255   default:
12511256      return msx1.state[1]->mem[offset + 0x3ff8];
r1877r1878
12571262   if (offset >= 0x7b8) {
12581263      switch (offset) {
12591264      case 0x7b8:
1260         return wd17xx_status_r (0);
1265         return wd17xx_status_r (machine, 0);
12611266      case 0x7b9:
1262         return wd17xx_track_r (0);
1267         return wd17xx_track_r (machine, 0);
12631268      case 0x7ba:
1264         return wd17xx_sector_r (0);
1269         return wd17xx_sector_r (machine, 0);
12651270      case 0x7bb:
1266         return wd17xx_data_r (0);
1271         return wd17xx_data_r (machine, 0);
12671272      case 0x7bc:
12681273         return msx1.dsk_stat;
12691274      default:
r1877r1878
13001305
13011306MSX_SLOT_WRITE(diskrom2)
13021307{
1308   running_machine *machine = Machine;
1309
13031310   if (addr >= 0xa000 && addr < 0xc000) {
13041311      addr -= 0x4000;
13051312   }
13061313   switch (addr) {
13071314   case 0x7fb8:
1308      wd17xx_command_w (0, val);
1315      wd17xx_command_w (machine, 0, val);
13091316      break;
13101317   case 0x7fb9:
1311      wd17xx_track_w (0, val);
1318      wd17xx_track_w (machine, 0, val);
13121319      break;
13131320   case 0x7fba:
1314      wd17xx_sector_w (0, val);
1321      wd17xx_sector_w (machine, 0, val);
13151322      break;
13161323   case 0x7fbb:
1317      wd17xx_data_w (0, val);
1324      wd17xx_data_w (machine, 0, val);
13181325      break;
13191326   case 0x7fbc:
13201327      wd17xx_set_side (val & 1);
r1877r1878
15211528
15221529MSX_SLOT_WRITE(fmpac)
15231530{
1531   running_machine *machine = Machine;
15241532   int i, data;
15251533
15261534   if (addr >= 0x4000 && addr < 0x6000 && state->cart.fmpac.sram_support) {
r1877r1878
15361544   switch (addr) {
15371545   case 0x7ff4:
15381546      if (state->cart.fmpac.opll_active) {
1539         YM2413_register_port_0_w (0, val);
1547         YM2413_register_port_0_w (machine, 0, val);
15401548      }
15411549      break;
15421550   case 0x7ff5:
15431551      if (state->cart.fmpac.opll_active) {
1544         YM2413_data_port_0_w (0, val);
1552         YM2413_data_port_0_w (machine, 0, val);
15451553      }
15461554      break;
15471555   case 0x7ff6:
r1877r1878
19841992   reg = offset & 0xff;
19851993
19861994   if (reg < 0x80) {
1987      return K051649_waveform_r (reg);
1995      return K051649_waveform_r (machine, reg);
19881996   }
19891997   else if (reg < 0xa0) {
19901998      /* nothing */
19911999   }
19922000   else if (reg < 0xc0) {
19932001      /* read wave 5 */
1994      return K051649_waveform_r (0x80 + (reg & 0x1f));
2002      return K051649_waveform_r (machine, 0x80 + (reg & 0x1f));
19952003   }
19962004#if 0
19972005   else if (reg < 0xe0) {
r1877r1878
20142022   reg = offset & 0xff;
20152023
20162024   if (reg < 0xa0) {
2017      return K051649_waveform_r (reg);
2025      return K051649_waveform_r (machine, reg);
20182026   }
20192027#if 0
20202028   else if (reg >= 0xc0 && reg < 0xe0) {
r1877r1878
20542062MSX_SLOT_WRITE(soundcartridge)
20552063{
20562064   int i;
2065   running_machine *machine = Machine;
20572066
20582067   if (addr < 0x4000) {
20592068      return;
r1877r1878
21032112         int offset = addr & 0xff;
21042113
21052114         if (offset < 0x80) {
2106            K051649_waveform_w (offset, val);
2115            K051649_waveform_w (machine, offset, val);
21072116         }
21082117         else if (offset < 0xa0) {
21092118            offset &= 0xf;
21102119
21112120            if (offset < 0xa) {
2112               K051649_frequency_w (offset, val);
2121               K051649_frequency_w (machine, offset, val);
21132122            }
21142123            else if (offset < 0x0f) {
2115               K051649_volume_w (offset - 0xa, val);
2124               K051649_volume_w (machine, offset - 0xa, val);
21162125            }
21172126            else if (offset == 0x0f) {
2118               K051649_keyonoff_w (0, val);
2127               K051649_keyonoff_w (machine, 0, val);
21192128            }
21202129         }
21212130#if 0
r1877r1878
21432152         int offset = addr & 0xff;
21442153
21452154         if (offset < 0xa0) {
2146            K052539_waveform_w (offset, val);
2155            K052539_waveform_w (machine, offset, val);
21472156         }
21482157         else if (offset < 0xc0) {
21492158            offset &= 0x0f;
21502159
21512160            if (offset < 0x0a) {
2152               K051649_frequency_w (offset, val);
2161               K051649_frequency_w (machine, offset, val);
21532162            }
21542163            else if (offset < 0x0f) {
2155               K051649_volume_w (offset - 0x0a, val);
2164               K051649_volume_w (machine, offset - 0x0a, val);
21562165            }
21572166            else if (offset == 0x0f) {
2158               K051649_keyonoff_w (0, val);
2167               K051649_keyonoff_w (machine, 0, val);
21592168            }
21602169         }
21612170#if 0
src/mess/machine/i8271.c
r1877r1878
13681368
13691369
13701370/* to be completed! */
1371 READ8_HANDLER(i8271_dack_r)
1371READ8_HANDLER(i8271_dack_r)
13721372{
1373   return i8271_data_r(offset);
1373   return i8271_data_r(machine, offset);
13741374}
13751375
13761376/* to be completed! */
13771377WRITE8_HANDLER(i8271_dack_w)
13781378{
1379   i8271_data_w(offset, data);
1379   i8271_data_w(machine, offset, data);
13801380}
13811381
13821382 READ8_HANDLER(i8271_data_r)
src/mess/machine/mc6850.c
r1877r1878
1111**********************************************************************/
1212
1313#include "driver.h"
14#include "deprecat.h"
1415#include "mc6850.h"
1516
1617struct acia6850
r1877r1878
4445   {
4546      case ACIA_6850_CTRL:
4647         if ((*(*currptr).intf).in_status_func)
47                     val = (*(*currptr).intf).in_status_func(0);
48                     val = (*(*currptr).intf).in_status_func(Machine, 0);
4849         break;
4950      case ACIA_6850_DATA:
5051         if ((*(*currptr).intf).in_recv_func)
51                     val = (*(*currptr).intf).in_recv_func(0);
52                     val = (*(*currptr).intf).in_recv_func(Machine, 0);
5253         break;
5354   }
5455   return (val);
r1877r1878
6263   {
6364      case ACIA_6850_CTRL:
6465         if ((*(*currptr).intf).out_status_func)
65                     (*(*currptr).intf).out_status_func(0, data);
66                     (*(*currptr).intf).out_status_func(Machine, 0, data);
6667         break;
6768      case ACIA_6850_DATA:
6869         if ((*(*currptr).intf).out_tran_func)
69                     (*(*currptr).intf).out_tran_func(0, data);
70                     (*(*currptr).intf).out_tran_func(Machine, 0, data);
7071         break;
7172   }
7273}
src/mess/machine/coco.c
r1877r1878
833833
834834void coco3_horizontal_sync_callback(int data)
835835{
836   pia_0_ca1_w(0, data);
836   pia_0_ca1_w(Machine, 0, data);
837837   coco3_raise_interrupt(COCO3_INT_HBORD, data);
838838}
839839
r1877r1878
841841
842842void coco3_field_sync_callback(int data)
843843{
844   pia_0_cb1_w(0, data);
844   pia_0_cb1_w(Machine, 0, data);
845845}
846846
847847void coco3_gime_field_sync_callback(void)
r1877r1878
869869   coco3_recalc_irq();
870870}
871871
872static timer_callback recalc_interrupts;
872static timer_fired_func recalc_interrupts;
873873
874874void coco_set_halt_line(int halt_line)
875875{
r1877r1878
12401240   joystick = mux_sel2;
12411241
12421242   /* poll keyoard keys */
1243   if ((input_port_0_r(0) | pia0_pb) != 0xff) porta &= ~0x01;
1244   if ((input_port_1_r(0) | pia0_pb) != 0xff) porta &= ~0x02;
1245   if ((input_port_2_r(0) | pia0_pb) != 0xff) porta &= ~0x04;
1246   if ((input_port_3_r(0) | pia0_pb) != 0xff) porta &= ~0x08;
1247   if ((input_port_4_r(0) | pia0_pb) != 0xff) porta &= ~0x10;
1248   if ((input_port_5_r(0) | pia0_pb) != 0xff) porta &= ~0x20;
1249   if ((input_port_6_r(0) | pia0_pb) != 0xff) porta &= ~0x40;
1243   if ((readinputport(0) | pia0_pb) != 0xff) porta &= ~0x01;
1244   if ((readinputport(1) | pia0_pb) != 0xff) porta &= ~0x02;
1245   if ((readinputport(2) | pia0_pb) != 0xff) porta &= ~0x04;
1246   if ((readinputport(3) | pia0_pb) != 0xff) porta &= ~0x08;
1247   if ((readinputport(4) | pia0_pb) != 0xff) porta &= ~0x10;
1248   if ((readinputport(5) | pia0_pb) != 0xff) porta &= ~0x20;
1249   if ((readinputport(6) | pia0_pb) != 0xff) porta &= ~0x40;
12501250
1251   if ((input_port_0_r(0) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x01;
1252   if ((input_port_1_r(0) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x02;
1253   if ((input_port_2_r(0) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x04;
1254   if ((input_port_3_r(0) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x08;
1255   if ((input_port_4_r(0) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x10;
1256   if ((input_port_5_r(0) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x20;
1257   if ((input_port_6_r(0) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x40;
1251   if ((readinputport(0) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x01;
1252   if ((readinputport(1) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x02;
1253   if ((readinputport(2) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x04;
1254   if ((readinputport(3) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x08;
1255   if ((readinputport(4) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x10;
1256   if ((readinputport(5) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x20;
1257   if ((readinputport(6) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x40;
12581258
12591259   switch(get_input_device(joystick ? INPUTPORT_LEFT_JOYSTICK : INPUTPORT_RIGHT_JOYSTICK))
12601260   {
r1877r1878
13431343
13441344
13451345/* three functions that update the keyboard in varying ways */
1346static WRITE8_HANDLER ( d_pia0_pb_w )                           { (*update_keyboard)(); }
1347static void coco_poll_keyboard(void *param, UINT32 value, UINT32 mask)   { (*update_keyboard)(); }
1348static TIMER_CALLBACK(coco_update_keyboard_timerproc)               { (*update_keyboard)(); }
1346static WRITE8_HANDLER ( d_pia0_pb_w )               { (*update_keyboard)(); }
1347INPUT_CHANGED(coco_keyboard_changed)               { (*update_keyboard)(); }
1348static TIMER_CALLBACK(coco_update_keyboard_timerproc)   { (*update_keyboard)(); }
13491349
13501350static WRITE8_HANDLER ( d_pia0_pa_w )
13511351{
r1877r1878
14941494{
14951495   int ddr;
14961496
1497   d_pia1_pb_w(0, data);
1497   d_pia1_pb_w(machine, 0, data);
14981498
14991499   ddr = ~pia_get_port_b_z_mask(1);
15001500
r1877r1878
15411541      case 0x00   :       /* Inactive, do nothing */
15421542         break;
15431543      case 0x01   :       /* Write to selected port */
1544         AY8910_write_port_0_w(0, pia_get_output_b(2));
1544         AY8910_write_port_0_w(machine, 0, pia_get_output_b(2));
15451545         break;
15461546      case 0x02   :       /* Read from selected port */
1547         pia_set_input_b(2, AY8910_read_port_0_r(0));
1547         pia_set_input_b(2, AY8910_read_port_0_r(machine, 0));
15481548         break;
15491549      case 0x03   :      /* Select port to write to */
1550         AY8910_control_port_0_w(0, pia_get_output_b(2));
1550         AY8910_control_port_0_w(machine, 0, pia_get_output_b(2));
15511551         break;
15521552   }
15531553}
r1877r1878
15761576
15771577static void   dgnalpha_fdc_callback(wd17xx_state_t event, void *param)
15781578{
1579   running_machine *machine = Machine;
1580
15791581   /* The NMI line on the alphaAlpha is gated through IC16 (early PLD), and is gated by pia2 CA2  */
15801582   /* The DRQ line goes through pia2 cb1, in exactly the same way as DRQ from DragonDos does */
15811583   /* for pia1 cb1 */
15821584   switch(event)
15831585   {
15841586      case WD17XX_IRQ_CLR:
1585         cpunum_set_input_line(Machine, 0, INPUT_LINE_NMI, CLEAR_LINE);
1587         cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, CLEAR_LINE);
15861588         break;
15871589      case WD17XX_IRQ_SET:
15881590         if(dgnalpha_just_reset)
r1877r1878
15921594         else
15931595         {
15941596            if (pia_get_output_ca2(2))
1595               cpunum_set_input_line(Machine, 0, INPUT_LINE_NMI, ASSERT_LINE);
1597               cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, ASSERT_LINE);
15961598         }
15971599         break;
15981600      case WD17XX_DRQ_CLR:
1599         pia_2_cb1_w(0,CARTLINE_CLEAR);
1601         pia_2_cb1_w(machine, 0, CARTLINE_CLEAR);
16001602         break;
16011603      case WD17XX_DRQ_SET:
1602         pia_2_cb1_w(0,CARTLINE_ASSERTED);
1604         pia_2_cb1_w(machine, 0, CARTLINE_ASSERTED);
16031605         break;
16041606   }
16051607}
r1877r1878
16121614   switch(offset & 0x03)
16131615   {
16141616      case 0:
1615         result = wd17xx_data_r(0);
1617         result = wd17xx_data_r(machine, 0);
16161618         break;
16171619      case 1:
1618         result = wd17xx_sector_r(0);
1620         result = wd17xx_sector_r(machine, 0);
16191621         break;
16201622      case 2:
1621         result = wd17xx_track_r(0);
1623         result = wd17xx_track_r(machine, 0);
16221624         break;
16231625      case 3:
1624         result = wd17xx_status_r(0);
1626         result = wd17xx_status_r(machine, 0);
16251627         break;
16261628      default:
16271629         break;
r1877r1878
16351637    switch(offset & 0x3)
16361638   {
16371639      case 0:
1638         wd17xx_data_w(0, data);
1640         wd17xx_data_w(machine, 0, data);
16391641         break;
16401642      case 1:
1641         wd17xx_sector_w(0, data);
1643         wd17xx_sector_w(machine, 0, data);
16421644         break;
16431645      case 2:
1644         wd17xx_track_w(0, data);
1646         wd17xx_track_w(machine, 0, data);
16451647         break;
16461648      case 3:
1647         wd17xx_command_w(0, data);
1649         wd17xx_command_w(machine, 0, data);
16481650
16491651         /* disk head is encoded in the command byte */
16501652         wd17xx_set_side((data & 0x02) ? 1 : 0);
r1877r1878
25432545READ8_HANDLER(coco3_cartridge_r)
25442546{
25452547   /* this behavior is documented in Super Extended Basic Unravelled, page 14 */
2546   return ((coco3_gimereg[0] & 0x04) || (offset >= 0x10)) ? coco_cartridge_r(offset) : 0;
2548   return ((coco3_gimereg[0] & 0x04) || (offset >= 0x10)) ? coco_cartridge_r(machine, offset) : 0;
25472549}
25482550
25492551
r1877r1878
25572559{
25582560   /* this behavior is documented in Super Extended Basic Unravelled, page 14 */
25592561   if ((coco3_gimereg[0] & 0x04) || (offset >= 0x10))
2560      coco_cartridge_w(offset, data);
2562      coco_cartridge_w(machine, offset, data);
25612563}
25622564
25632565
r1877r1878
25682570
25692571static void coco_cart_timer_w(running_machine *machine, int data)
25702572{
2571   pia_1_cb1_w(0, (data & 0x01) ? ASSERT_LINE : CLEAR_LINE);
2573   pia_1_cb1_w(machine, 0, (data & 0x01) ? ASSERT_LINE : CLEAR_LINE);
25722574
25732575   /* special code for Q state */
25742576   if ((data == 0x02) || (data == 0x03) || (data == 0x04))
r1877r1878
27182720
27192721WRITE8_HANDLER(coco_pia_1_w)
27202722{
2721   pia_1_w(offset, data);
2723   pia_1_w(machine, offset, data);
27222724   twiddle_cart_line_if_q();
27232725}
27242726
r1877r1878
27322734{
27332735   const pia6821_interface *piaintf;         /* PIA initializer */
27342736   int   piaintf_count;                     /* PIA count */
2735   timer_callback recalc_interrupts_;         /* recalculate inturrupts callback */
2737   timer_fired_func recalc_interrupts_;         /* recalculate inturrupts callback */
27362738   void (*printer_out_)(int data);            /* printer output callback */
2737   timer_callback cart_timer_proc;            /* cartridge timer proc */
2739   timer_fired_func cart_timer_proc;            /* cartridge timer proc */
27382740   const char *fdc_cart_hardware;            /* normal cartridge hardware */
27392741   void (*map_memory)(coco_cartridge *cartridge, UINT32 offset, UINT32 mask);
27402742};
r1877r1878
27482750/* for everything except the coco3, so it made sense not to pass it as a parameter */
27492751static void generic_init_machine(running_machine *machine, const machine_init_interface *init)
27502752{
2751   int portnum;
27522753   coco_cartridge_config cart_config;
27532754   mess_image *cart_image;
27542755   const char *extrainfo;
r1877r1878
28162817   cart_config.map_memory = init->map_memory;
28172818   coco_cart = cococart_init(cart_hardware, &cart_config);
28182819
2819   /* set up callbacks to be invoked on key press */
2820   for (portnum = 0; portnum <= 6; portnum++)
2821      input_port_set_changed_callback(portnum, ~0, coco_poll_keyboard, NULL);
2822
28232820#ifdef MAME_DEBUG
28242821   cpuintrf_set_dasm_override(0, coco_dasm_override);
28252822#endif
src/mess/machine/rp5c15.h
r1877r1878
5050   int pulse_count;
5151   int pulse1_state;
5252   int pulse16_state;
53   void (*timer_callback)(int state);
53   void (*timer_fired_func)(int state);
5454   void (*alarm_callback)(int state);
5555};  //  Ricoh RP5C15
5656
src/mess/machine/amigacd.c
r1877r1878
1616#include "machine/wd33c93.h"
1717#include "machine/tpi6525.h"
1818#include "matsucd.h"
19#include "deprecat.h"
1920
2021
2122#define VERBOSE_DMAC 0
r1877r1878
8182      return;
8283
8384   /* otherwise, generate the IRQ */
84   amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_PORTS, 0);
85   amiga_custom_w(Machine, REG_INTREQ, 0x8000 | INTENA_PORTS, 0);
8586}
8687
8788static TIMER_CALLBACK(dmac_dma_proc)
r1877r1878
213214      case 0x67:
214215      {
215216         LOG(( "DMAC: PC=%08x - TPI6525 Read(%d)\n", activecpu_get_pc(), (offset - 0x58) ));
216         return tpi6525_0_port_r(offset - 0x58);
217         return tpi6525_0_port_r(machine, offset - 0x58);
217218      }
218219      break;
219220
r1877r1878
339340      case 0x67:
340341      {
341342         LOG(( "DMAC: PC=%08x - TPI6525 Write(%d) - data = %04x\n", activecpu_get_pc(), (offset - 0x58), data ));
342         tpi6525_0_port_w(offset - 0x58, data);
343         tpi6525_0_port_w(machine, offset - 0x58, data);
343344      }
344345      break;
345346
r1877r1878
451452
452453   if ( (CUSTOM_REG(REG_INTREQ) & INTENA_PORTS) == 0 )
453454   {
454      amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_PORTS, 0);
455      amiga_custom_w(machine, REG_INTREQ, 0x8000 | INTENA_PORTS, 0);
455456   }
456457   else
457458   {
r1877r1878
467468   {
468469      if ( (CUSTOM_REG(REG_INTREQ) & INTENA_PORTS) == 0 )
469470      {
470         amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_PORTS, 0);
471         amiga_custom_w(Machine, REG_INTREQ, 0x8000 | INTENA_PORTS, 0);
471472      }
472473      else
473474      {
src/mess/machine/mc6850.h
r1877r1878
2626
2727struct acia6850_interface
2828{
29   read8_handler in_status_func;
30   read8_handler in_recv_func;
31   write8_handler out_status_func;
32   write8_handler out_tran_func;
29   read8_machine_func in_status_func;
30   read8_machine_func in_recv_func;
31   write8_machine_func out_status_func;
32   write8_machine_func out_tran_func;
3333};
3434
3535void acia6850_unconfig(void);
src/mess/machine/gb.c
r1877r1878
161161/* #define V_BANK*/         /* Display bank switching debug information */
162162#endif
163163
164static void gb_init_regs(void) {
164static void gb_init_regs(running_machine *machine) {
165165   /* Initialize the registers */
166166   SIODATA = 0x00;
167167   SIOCONT = 0x7E;
168168
169   gb_io_w( 0x05, 0x00 );      /* TIMECNT */
170   gb_io_w( 0x06, 0x00 );      /* TIMEMOD */
169   gb_io_w( machine, 0x05, 0x00 );      /* TIMECNT */
170   gb_io_w( machine, 0x06, 0x00 );      /* TIMEMOD */
171171}
172172
173173static void gb_rom16_0000( UINT8 *addr ) {
r1877r1878
188188   memory_set_bankptr( 4, addr );
189189}
190190
191static void gb_init(void) {
191static void gb_init(running_machine *machine) {
192192   /* Initialize the memory banks */
193193   MBC1Mode = 0;
194194   MBC3RTCBank = 0;
r1877r1878
264264         break;
265265   }
266266
267   gb_sound_w( 0x16, 0x00 );       /* Initialize sound hardware */
267   gb_sound_w( machine, 0x16, 0x00 );       /* Initialize sound hardware */
268268
269269   /* Allocate the serial timer, and disable it */
270270   gb_serial_timer = timer_alloc( gb_serial_timer_proc , NULL);
r1877r1878
282282
283283MACHINE_RESET( gb )
284284{
285   gb_init();
285   gb_init(machine);
286286
287   gb_video_init( GB_VIDEO_DMG );
287   gb_video_init( machine, GB_VIDEO_DMG );
288288
289289   /* Enable BIOS rom */
290290   memory_set_bankptr(5, memory_region(REGION_CPU1) );
r1877r1878
295295
296296MACHINE_RESET( sgb )
297297{
298   gb_init();
298   gb_init(machine);
299299
300   gb_video_init( GB_VIDEO_SGB );
300   gb_video_init( machine, GB_VIDEO_SGB );
301301
302   gb_init_regs();
302   gb_init_regs(machine);
303303
304304   memory_set_bankptr(5, ROMMap[ROMBank00] ? ROMMap[ROMBank00] : gb_dummy_rom_bank );
305305   memory_set_bankptr(10, ROMMap[ROMBank00] ? ROMMap[ROMBank00] + 0x0100 : gb_dummy_rom_bank + 0x0100 );
r1877r1878
308308   memset( sgb_tile_data, 0, 0x2000 );
309309
310310   /* Initialize the Sound Registers */
311   gb_sound_w(0x16,0xF0);   /* F0 for SGB */
312   gb_sound_w(0x15,0xF3);
313   gb_sound_w(0x14,0x77);
311   gb_sound_w(machine, 0x16,0xF0);   /* F0 for SGB */
312   gb_sound_w(machine, 0x15,0xF3);
313   gb_sound_w(machine, 0x14,0x77);
314314
315315   sgb_window_mask = 0;
316316   memset( sgb_pal_map, 0, 20*18 );
r1877r1878
331331
332332MACHINE_RESET( gbpocket )
333333{
334   gb_init();
334   gb_init(machine);
335335
336   gb_video_init( GB_VIDEO_MGB );
336   gb_video_init( machine, GB_VIDEO_MGB );
337337
338   gb_init_regs();
338   gb_init_regs(machine);
339339
340340   /* Initialize the Sound registers */
341   gb_sound_w(0x16,0x80);
342   gb_sound_w(0x15,0xF3);
343   gb_sound_w(0x14,0x77);
341   gb_sound_w(machine, 0x16,0x80);
342   gb_sound_w(machine, 0x15,0xF3);
343   gb_sound_w(machine, 0x14,0x77);
344344
345345   /* Enable BIOS rom if we have one */
346346   memory_set_bankptr(5, ROMMap[ROMBank00] ? ROMMap[ROMBank00] : gb_dummy_rom_bank );
r1877r1878
353353{
354354   int ii;
355355
356   gb_init();
356   gb_init(machine);
357357
358   gb_video_init( GB_VIDEO_CGB );
358   gb_video_init( machine, GB_VIDEO_CGB );
359359
360   gb_init_regs();
360   gb_init_regs(machine);
361361
362362   /* Initialize the Sound registers */
363   gb_sound_w(0x16, 0x80);
364   gb_sound_w(0x15, 0xF3);
365   gb_sound_w(0x14, 0x77);
363   gb_sound_w(machine, 0x16, 0x80);
364   gb_sound_w(machine, 0x15, 0xF3);
365   gb_sound_w(machine, 0x14, 0x77);
366366
367367   memory_set_bankptr(5, ROMMap[ROMBank00] ? ROMMap[ROMBank00] : gb_dummy_rom_bank );
368368   memory_set_bankptr(10, ROMMap[ROMBank00] ? ROMMap[ROMBank00] + 0x0100 : gb_dummy_rom_bank + 0x0100);
r1877r1878
372372      GBC_RAMMap[ii] = mess_ram + CGB_START_RAM_BANKS + ii * 0x1000;
373373      memset (GBC_RAMMap[ii], 0, 0x1000);
374374   }
375   gbc_io2_w( 0x30, 0x00 );
375   gbc_io2_w( machine, 0x30, 0x00 );
376376
377377   /* Initialise registers */
378   gb_io_w( 0x6C, 0xFE );
379   gb_io_w( 0x72, 0x00 );
380   gb_io_w( 0x73, 0x00 );
381   gb_io_w( 0x74, 0x8F );
382   gb_io_w( 0x75, 0x00 );
383   gb_io_w( 0x76, 0x00 );
384   gb_io_w( 0x77, 0x00 );
378   gb_io_w( machine, 0x6C, 0xFE );
379   gb_io_w( machine, 0x72, 0x00 );
380   gb_io_w( machine, 0x73, 0x00 );
381   gb_io_w( machine, 0x74, 0x8F );
382   gb_io_w( machine, 0x75, 0x00 );
383   gb_io_w( machine, 0x76, 0x00 );
384   gb_io_w( machine, 0x77, 0x00 );
385385
386386   /* Are we in colour or mono mode? */
387387   if( gb_cart[0x143] == 0x80 || gb_cart[0x143] == 0xC0 )
r1877r1878
823823      /* disable BIOS ROM */
824824      memory_set_bankptr(5, ROMMap[ROMBank00]);
825825   } else {
826      gb_video_w( offset, data );
826      gb_video_w( machine, offset, data );
827827   }
828828}
829829
r1877r1878
13401340         return;
13411341      default:
13421342         /* we didn't handle the write, so pass it to the GB handler */
1343         gb_io_w( offset, data );
1343         gb_io_w( machine, offset, data );
13441344         return;
13451345   }
13461346
r1877r1878
18811881      default:
18821882         break;
18831883   }
1884   gbc_video_w( offset, data );
1884   gbc_video_w( machine, offset, data );
18851885}
18861886
18871887READ8_HANDLER( gbc_io2_r ) {
r1877r1878
18931893   default:
18941894      break;
18951895   }
1896   return gbc_video_r( offset );
1896   return gbc_video_r( machine, offset );
18971897}
18981898
18991899/****************************************************************************
r1877r1878
19051905MACHINE_RESET( megaduck )
19061906{
19071907   /* We may have to add some more stuff here, if not then it can be merged back into gb */
1908   gb_init();
1908   gb_init(machine);
19091909
1910   gb_video_init( GB_VIDEO_DMG );
1910   gb_video_init( machine, GB_VIDEO_DMG );
19111911}
19121912
19131913/*
r1877r1878
19531953   if ( (offset & 0x0C) && ((offset & 0x0C) ^ 0x0C) ) {
19541954      offset ^= 0x0C;
19551955   }
1956   data = gb_video_r( offset );
1956   data = gb_video_r( machine, offset );
19571957   if ( offset )
19581958      return data;
19591959   return BITSWAP8(data,7,0,5,4,6,3,2,1);
r1877r1878
19671967   if ( (offset & 0x0C) && ((offset & 0x0C) ^ 0x0C) ) {
19681968      offset ^= 0x0C;
19691969   }
1970   gb_video_w(offset, data );
1970   gb_video_w(machine, offset, data );
19711971}
19721972
19731973/* Map megaduck audio offset to gameboy audio offsets */
r1877r1878
19761976
19771977WRITE8_HANDLER( megaduck_sound_w1 )
19781978{
1979   gb_sound_w( megaduck_sound_offsets[offset], data );
1979   gb_sound_w( machine, megaduck_sound_offsets[offset], data );
19801980}
19811981
19821982 READ8_HANDLER( megaduck_sound_r1 )
19831983{
1984   return gb_sound_r( megaduck_sound_offsets[offset] );
1984   return gb_sound_r( machine, megaduck_sound_offsets[offset] );
19851985}
19861986
19871987WRITE8_HANDLER( megaduck_sound_w2 )
19881988{
19891989   switch(offset) {
1990      case 0x00:   gb_sound_w( 0x10, data );   break;
1991      case 0x01:   gb_sound_w( 0x12, data );   break;
1992      case 0x02:   gb_sound_w( 0x11, data );   break;
1993      case 0x03:   gb_sound_w( 0x13, data );   break;
1994      case 0x04:   gb_sound_w( 0x14, data );   break;
1995      case 0x05:   gb_sound_w( 0x16, data );   break;
1996      case 0x06:   gb_sound_w( 0x15, data );   break;
1990      case 0x00:   gb_sound_w( machine, 0x10, data );   break;
1991      case 0x01:   gb_sound_w( machine, 0x12, data );   break;
1992      case 0x02:   gb_sound_w( machine, 0x11, data );   break;
1993      case 0x03:   gb_sound_w( machine, 0x13, data );   break;
1994      case 0x04:   gb_sound_w( machine, 0x14, data );   break;
1995      case 0x05:   gb_sound_w( machine, 0x16, data );   break;
1996      case 0x06:   gb_sound_w( machine, 0x15, data );   break;
19971997      case 0x07:
19981998      case 0x08:
19991999      case 0x09:
r1877r1878
20092009
20102010READ8_HANDLER( megaduck_sound_r2 )
20112011{
2012   return gb_sound_r(0x10 + megaduck_sound_offsets[offset]);
2012   return gb_sound_r(machine, 0x10 + megaduck_sound_offsets[offset]);
20132013}
20142014
20152015WRITE8_HANDLER( megaduck_rom_bank_select_type1 )
src/mess/machine/concept.c
r1877r1878
7676
7777static struct
7878{
79   read8_handler reg_read;
80   write8_handler reg_write;
81   read8_handler rom_read;
82   write8_handler rom_write;
79   read8_machine_func reg_read;
80   write8_machine_func reg_write;
81   read8_machine_func rom_read;
82   write8_machine_func rom_write;
8383} expansion_slots[4];
8484
8585static void concept_fdc_init(int slot);
r1877r1878
111111}
112112
113113static void install_expansion_slot(int slot,
114                           read8_handler reg_read, write8_handler reg_write,
115                           read8_handler rom_read, write8_handler rom_write)
114                           read8_machine_func reg_read, write8_machine_func reg_write,
115                           read8_machine_func rom_read, write8_machine_func rom_write)
116116{
117117   expansion_slots[slot].reg_read = reg_read;
118118   expansion_slots[slot].reg_write = reg_write;
r1877r1878
301301         {
302302            int slot = ((offset >> 4) & 7) - 1;
303303            if (expansion_slots[slot].reg_read)
304               return expansion_slots[slot].reg_read(offset & 0xf);
304               return expansion_slots[slot].reg_read(machine, offset & 0xf);
305305         }
306306         break;
307307
r1877r1878
324324         int slot = ((offset >> 8) & 7) - 1;
325325         LOG(("concept_io_r: Slot ROM memory accessed for slot %d at address 0x03%4.4x\n", slot, offset << 1));
326326         if (expansion_slots[slot].rom_read)
327            return expansion_slots[slot].rom_read(offset & 0xff);
327            return expansion_slots[slot].rom_read(machine, offset & 0xff);
328328      }
329329      break;
330330
r1877r1878
440440            LOG(("concept_io_w: Slot I/O register written for slot %d at address 0x03%4.4x, data: 0x%4.4x\n",
441441               slot, offset << 1, data));
442442            if (expansion_slots[slot].reg_write)
443               expansion_slots[slot].reg_write(offset & 0xf, data);
443               expansion_slots[slot].reg_write(machine, offset & 0xf, data);
444444         }
445445         break;
446446
r1877r1878
463463         int slot = ((offset >> 8) & 7) - 1;
464464         LOG(("concept_io_w: Slot ROM memory written to for slot %d at address 0x03%4.4x, data: 0x%4.4x\n", slot, offset << 1, data));
465465         if (expansion_slots[slot].rom_write)
466            expansion_slots[slot].rom_write(offset & 0xff, data);
466            expansion_slots[slot].rom_write(machine, offset & 0xff, data);
467467      }
468468      break;
469469
r1877r1878
614614
615615   case 8:
616616      /* FDC STATUS REG */
617      return wd17xx_status_r(offset);
617      return wd17xx_status_r(machine, offset);
618618      break;
619619
620620   case 9:
621621      /* FDC TRACK REG */
622      return wd17xx_track_r(offset);
622      return wd17xx_track_r(machine, offset);
623623      break;
624624
625625   case 10:
626626      /* FDC SECTOR REG */
627      return wd17xx_sector_r(offset);
627      return wd17xx_sector_r(machine, offset);
628628      break;
629629
630630   case 11:
631631      /* FDC DATA REG */
632      return wd17xx_data_r(offset);
632      return wd17xx_data_r(machine, offset);
633633      break;
634634   }
635635
r1877r1878
658658
659659   case 8:
660660      /* FDC COMMAMD REG */
661      wd17xx_command_w(offset, data);
661      wd17xx_command_w(machine, offset, data);
662662      break;
663663
664664   case 9:
665665      /* FDC TRACK REG */
666      wd17xx_track_w(offset, data);
666      wd17xx_track_w(machine, offset, data);
667667      break;
668668
669669   case 10:
670670      /* FDC SECTOR REG */
671      wd17xx_sector_w(offset, data);
671      wd17xx_sector_w(machine, offset, data);
672672      break;
673673
674674   case 11:
675675      /* FDC DATA REG */
676      wd17xx_data_w(offset, data);
676      wd17xx_data_w(machine, offset, data);
677677      break;
678678   }
679679}
r1877r1878
713713   {
714714   case 0:
715715      /* HDC Data Register */
716      return corvus_hdc_data_r(offset);
716      return corvus_hdc_data_r(machine, offset);
717717      break;
718718
719719   case 1:
720720      /* HDC Status Register */
721      return corvus_hdc_status_r(offset);
721      return corvus_hdc_status_r(machine, offset);
722722      break;
723723   }
724724
r1877r1878
734734   {
735735   case 0:
736736      /* HDC Data Register */
737      corvus_hdc_data_w(offset, data);
737      corvus_hdc_data_w(machine, offset, data);
738738      break;
739739   }
740740}
src/mess/machine/kim1.c
r1877r1878
693693         switch (which)
694694         {
695695         case 0:               /* key row 1 */
696            m6530[1].dria = input_port_0_r(0);
696            m6530[1].dria = readinputport(0);
697697            logerror("read keybd(%d): %c%c%c%c%c%c%c\n",
698698                which,
699699                (m6530[1].dria & 0x40) ? '.' : '0',
r1877r1878
705705                (m6530[1].dria & 0x01) ? '.' : '6');
706706            break;
707707         case 1:               /* key row 2 */
708            m6530[1].dria = input_port_1_r(0);
708            m6530[1].dria = readinputport(1);
709709            logerror("read keybd(%d): %c%c%c%c%c%c%c\n",
710710                which,
711711                (m6530[1].dria & 0x40) ? '.' : '7',
r1877r1878
717717                (m6530[1].dria & 0x01) ? '.' : 'D');
718718            break;
719719         case 2:               /* key row 3 */
720            m6530[1].dria = input_port_2_r(0);
720            m6530[1].dria = readinputport(2);
721721            logerror("read keybd(%d): %c%c%c%c%c%c%c\n",
722722                which,
723723                (m6530[1].dria & 0x40) ? '.' : 'E',
src/mess/machine/99_dsk.c
r1877r1878
420420/* prototypes */
421421static void fdc_callback(wd17xx_state_t event, void *param);
422422static TIMER_CALLBACK(motor_on_timer_callback);
423static int fdc_cru_r(int offset);
424static void fdc_cru_w(int offset, int data);
423static int fdc_cru_r(running_machine *machine, int offset);
424static void fdc_cru_w(running_machine *machine, int offset, int data);
425425static READ8_HANDLER(fdc_mem_r);
426426static WRITE8_HANDLER(fdc_mem_w);
427427
r1877r1878
466466   bit 6: always 1
467467   bit 7: selected side
468468*/
469static int fdc_cru_r(int offset)
469static int fdc_cru_r(running_machine *machine, int offset)
470470{
471471   int reply;
472472
r1877r1878
493493/*
494494   Write disk CRU interface
495495*/
496static void fdc_cru_w(int offset, int data)
496static void fdc_cru_w(running_machine *machine, int offset, int data)
497497{
498498   switch (offset)
499499   {
r1877r1878
576576   switch (offset)
577577   {
578578   case 0x1FF0:               /* Status register */
579      return (wd17xx_status_r(offset) ^ 0xFF);
579      return (wd17xx_status_r(machine, offset) ^ 0xFF);
580580      break;
581581   case 0x1FF2:               /* Track register */
582      return wd17xx_track_r(offset) ^ 0xFF;
582      return wd17xx_track_r(machine, offset) ^ 0xFF;
583583      break;
584584   case 0x1FF4:               /* Sector register */
585      return wd17xx_sector_r(offset) ^ 0xFF;
585      return wd17xx_sector_r(machine, offset) ^ 0xFF;
586586      break;
587587   case 0x1FF6:               /* Data register */
588      return wd17xx_data_r(offset) ^ 0xFF;
588      return wd17xx_data_r(machine, offset) ^ 0xFF;
589589      break;
590590   default:                  /* DSR ROM */
591591      return ti99_disk_DSR[offset];
r1877r1878
603603   switch (offset)
604604   {
605605   case 0x1FF8:               /* Command register */
606      wd17xx_command_w(offset, data);
606      wd17xx_command_w(machine, offset, data);
607607      break;
608608   case 0x1FFA:               /* Track register */
609      wd17xx_track_w(offset, data);
609      wd17xx_track_w(machine, offset, data);
610610      break;
611611   case 0x1FFC:               /* Sector register */
612      wd17xx_sector_w(offset, data);
612      wd17xx_sector_w(machine, offset, data);
613613      break;
614614   case 0x1FFE:               /* Data register */
615      wd17xx_data_w(offset, data);
615      wd17xx_data_w(machine, offset, data);
616616      break;
617617   }
618618}
r1877r1878
632632*/
633633
634634/* prototypes */
635static int ccfdc_cru_r(int offset);
636static void ccfdc_cru_w(int offset, int data);
635static int ccfdc_cru_r(running_machine *machine, int offset);
636static void ccfdc_cru_w(running_machine *machine, int offset, int data);
637637static READ8_HANDLER(ccfdc_mem_r);
638638static WRITE8_HANDLER(ccfdc_mem_w);
639639
r1877r1878
834834*/
835835
836836/* prototypes */
837static int bwg_cru_r(int offset);
838static void bwg_cru_w(int offset, int data);
839static  READ8_HANDLER(bwg_mem_r);
837static int bwg_cru_r(running_machine *machine, int offset);
838static void bwg_cru_w(running_machine *machine, int offset, int data);
839static READ8_HANDLER(bwg_mem_r);
840840static WRITE8_HANDLER(bwg_mem_w);
841841
842842static const ti99_peb_card_handlers_t bwg_handlers =
r1877r1878
886886   bit 1-3: drive n active
887887   bit 4-7: dip switches 1-4
888888*/
889static int bwg_cru_r(int offset)
889static int bwg_cru_r(running_machine *machine, int offset)
890890{
891891   int reply;
892892
r1877r1878
911911/*
912912   Write disk CRU interface
913913*/
914static void bwg_cru_w(int offset, int data)
914static void bwg_cru_w(running_machine *machine, int offset, int data)
915915{
916916   switch (offset)
917917   {
r1877r1878
10471047         switch (offset)
10481048         {
10491049         case 0x1FF0:               /* Status register */
1050            reply = wd17xx_status_r(offset);
1050            reply = wd17xx_status_r(machine, offset);
10511051            break;
10521052         case 0x1FF2:               /* Track register */
1053            reply = wd17xx_track_r(offset);
1053            reply = wd17xx_track_r(machine, offset);
10541054            break;
10551055         case 0x1FF4:               /* Sector register */
1056            reply = wd17xx_sector_r(offset);
1056            reply = wd17xx_sector_r(machine, offset);
10571057            break;
10581058         case 0x1FF6:               /* Data register */
1059            reply = wd17xx_data_r(offset);
1059            reply = wd17xx_data_r(machine, offset);
10601060            break;
10611061         default:
10621062            reply = 0;
r1877r1878
10911091         switch (offset)
10921092         {
10931093         case 0x1FF8:               /* Command register */
1094            wd17xx_command_w(offset, data);
1094            wd17xx_command_w(machine, offset, data);
10951095            break;
10961096         case 0x1FFA:               /* Track register */
1097            wd17xx_track_w(offset, data);
1097            wd17xx_track_w(machine, offset, data);
10981098            break;
10991099         case 0x1FFC:               /* Sector register */
1100            wd17xx_sector_w(offset, data);
1100            wd17xx_sector_w(machine, offset, data);
11011101            break;
11021102         case 0x1FFE:               /* Data register */
1103            wd17xx_data_w(offset, data);
1103            wd17xx_data_w(machine, offset, data);
11041104            break;
11051105         }
11061106      }
r1877r1878
11261126*/
11271127
11281128/* prototypes */
1129static int hfdc_cru_r(int offset);
1130static void hfdc_cru_w(int offset, int data);
1129static int hfdc_cru_r(running_machine *machine, int offset);
1130static void hfdc_cru_w(running_machine *machine, int offset, int data);
11311131static  READ8_HANDLER(hfdc_mem_r);
11321132static WRITE8_HANDLER(hfdc_mem_w);
11331133
r1877r1878
12541254/*
12551255   Read disk CRU interface
12561256*/
1257static int hfdc_cru_r(int offset)
1257static int hfdc_cru_r(running_machine *machine, int offset)
12581258{
12591259   int reply;
12601260   switch (offset)
r1877r1878
12941294/*
12951295   Write disk CRU interface
12961296*/
1297static void hfdc_cru_w(int offset, int data)
1297static void hfdc_cru_w(running_machine *machine, int offset, int data)
12981298{
12991299   switch (offset)
13001300   {
src/mess/machine/msx.c
r1877r1878
426426
427427READ8_HANDLER ( msx_psg_r )
428428{
429   return AY8910_read_port_0_r (offset);
429   return AY8910_read_port_0_r (machine, offset);
430430}
431431
432432WRITE8_HANDLER ( msx_psg_w )
433433{
434434   if (offset & 0x01)
435      AY8910_write_port_0_w (offset, data);
435      AY8910_write_port_0_w (machine, offset, data);
436436   else
437      AY8910_control_port_0_w (offset, data);
437      AY8910_control_port_0_w (machine, offset, data);
438438}
439439
440440static mess_image *cassette_device_image(void)
r1877r1878
453453
454454   data = (cassette_input(cassette_device_image()) > 0.0038 ? 0x80 : 0);
455455
456   if ( (msx1.psg_b ^ readinputport (8) ) & 0x40)
456   if ( (msx1.psg_b ^ readinputport(8) ) & 0x40)
457457      {
458458      /* game port 2 */
459      inp = input_port_7_r (0) & 0x7f;
459      inp = readinputport(7) & 0x7f;
460460#if 0
461461      if ( !(inp & 0x80) )
462462         {
r1877r1878
481481   else
482482      {
483483      /* game port 1 */
484      inp = input_port_6_r (0) & 0x7f;
484      inp = readinputport(6) & 0x7f;
485485#if 0
486486      if ( !(inp & 0x80) )
487487         {
r1877r1878
573573   if (msx1.opll_active) {
574574
575575      if (offset == 1) {
576         YM2413_data_port_0_w (0, data);
576         YM2413_data_port_0_w (machine, 0, data);
577577      }
578578      else {
579         YM2413_register_port_0_w (0, data);
579         YM2413_register_port_0_w (machine, 0, data);
580580      }
581581   }
582582}
r1877r1878
592592
593593WRITE8_HANDLER (msx_rtc_reg_w)
594594{
595   tc8521_w (msx1.rtc_latch, data);
595   tc8521_w(machine, msx1.rtc_latch, data);
596596}
597597
598598READ8_HANDLER (msx_rtc_reg_r)
599599{
600   return tc8521_r (msx1.rtc_latch);
600   return tc8521_r(machine, msx1.rtc_latch);
601601}
602602
603603NVRAM_HANDLER( msx2 )
r1877r1878
728728   UINT8 result = 0xff;
729729   int row, data;
730730
731   row = ppi8255_0_r (2) & 0x0f;
731   row = ppi8255_0_r(machine, 2) & 0x0f;
732732   if (row <= 10)
733733   {
734734      data = readinputport (row/2);
r1877r1878
962962   if (msx1.slot[2]->slot_type == SLOT_SUPERLOADRUNNER) {
963963      msx1.slot[2]->map (msx1.state[2], 2);
964964   }
965   msx_page0_w (-1, data);
965   msx_page0_w(machine, -1, data);
966966}
967967
968968WRITE8_HANDLER (msx_page0_w)
r1877r1878
10231023      msx_memory_map_all ();
10241024   }
10251025   else {
1026      msx_page3_w (0x3fff, data);
1026      msx_page3_w(machine, 0x3fff, data);
10271027   }
10281028}
10291029
src/mess/machine/gamecom.c
r1877r1878
8989   gamecom_dma.enabled = 0;
9090
9191   memset( internal_registers, 0x00, sizeof(internal_registers) );
92   gamecom_internal_w( SM8521_URTT, 0xFF );
93   gamecom_internal_w( SM8521_URTS, 0x42 );
94   gamecom_internal_w( SM8521_WDTC, 0x38 );
92   gamecom_internal_w( machine, SM8521_URTT, 0xFF );
93   gamecom_internal_w( machine, SM8521_URTS, 0x42 );
94   gamecom_internal_w( machine, SM8521_WDTC, 0x38 );
9595}
9696
9797static void gamecom_set_mmu( int mmu, UINT8 data ) {
src/mess/machine/ins8154.c
r1877r1878
9393   {
9494   case 0x20:
9595      if (i->intf->in_a_func)
96         val = i->intf->in_a_func(0);
96         val = i->intf->in_a_func(Machine, 0);
9797      i->in_a = val;
9898      break;
9999     
100100   case 0x21:
101101      if (i->intf->in_b_func)
102         val = i->intf->in_b_func(0);
102         val = i->intf->in_b_func(Machine, 0);
103103      i->in_b = val;
104104      break;
105105     
r1877r1878
107107      if (offset < 0x08)
108108      {
109109         if (i->intf->in_a_func)
110            val = (i->intf->in_a_func(0) << (8 - offset)) & 0x80;
110            val = (i->intf->in_a_func(Machine, 0) << (8 - offset)) & 0x80;
111111         i->in_a = val;
112112      }
113113      else
114114      {
115115         if (i->intf->in_a_func)
116            val = (i->intf->in_a_func(0) << (8 - (offset >> 4))) & 0x80;
116            val = (i->intf->in_a_func(Machine, 0) << (8 - (offset >> 4))) & 0x80;
117117         i->in_b = val;
118118      }
119119      break;
r1877r1878
133133   if (i->odra)
134134   {
135135      if (i->intf->out_a_func)
136         i->intf->out_a_func(0, (data & i->odra) | (i->odra ^ 0xff));
136         i->intf->out_a_func(Machine, 0, (data & i->odra) | (i->odra ^ 0xff));
137137      else
138138         logerror("INS8154 chip #%d (%08x): Write to port A but no write handler defined!\n",
139139            which, safe_activecpu_get_pc());
r1877r1878
151151   if (i->odrb)
152152   {
153153      if (i->intf->out_b_func)
154         i->intf->out_b_func(0, (data & i->odrb) | (i->odrb ^ 0xff));
154         i->intf->out_b_func(Machine, 0, (data & i->odrb) | (i->odrb ^ 0xff));
155155      else
156156         logerror("INS8154 chip #%d (%08x): Write to port B but no write handler defined!\n",
157157            which, safe_activecpu_get_pc());
src/mess/machine/mz700.c
r1877r1878
9090   videoram = auto_malloc(videoram_size);
9191   colorram = auto_malloc(0x800);
9292
93   mz700_bank_w(4, 0);
93   mz700_bank_w(machine, 4, 0);
9494}
9595
9696
r1877r1878
233233      break;
234234
235235   case 4: case 5: case 6: case 7:
236      data = pit8253_0_r(offset & 3);
236      data = pit8253_0_r(machine, offset & 3);
237237        break;
238238
239239   case 8:
r1877r1878
258258
259259   /* the next four ports are connected to a 8253 PIT */
260260    case 4: case 5: case 6: case 7:
261      pit8253_0_w(offset & 3, data);
261      pit8253_0_w(machine, offset & 3, data);
262262      break;
263263
264264   case 8:
265265      LOG(1,"mz700_e008_w",("%02X\n", data));
266      pit8253_0_gate_w(0, data & 1);
266      pit8253_0_gate_w(machine, 0, data & 1);
267267        break;
268268   }
269269}
r1877r1878
477477   case 6: /* 0000-0FFF no chg D000-FFFF unlocked */
478478      LOG(1,"mz700_bank_w",("6: D000-FFFF unlocked\n"));
479479      if (mz700_locked == 1)
480         mz700_bank_w(vio_lock, 0); /* old config for D000-DFFF */
480         mz700_bank_w(machine, vio_lock, 0); /* old config for D000-DFFF */
481481        break;
482482    }
483483}
r1877r1878
515515      break;
516516
517517   case 4: case 5: case 6: case 7:
518      data = pit8253_0_r(offset & 3);
518      data = pit8253_0_r(machine, offset & 3);
519519        break;
520520
521521   default:
r1877r1878
637637WRITE8_HANDLER( mz800_mmio_w )
638638{
639639   /* just wrap to the mz700 handler */
640    mz700_mmio_w(offset,data);
640    mz700_mmio_w(machine, offset,data);
641641}
642642
643643/* port E0-E9 */
r1877r1878
705705    case 6: /* 0000-0FFF no chg D000-FFFF unlocked */
706706      LOG(1,"mz800_bank_w",("6: D000-FFFF unlocked\n"));
707707        if (mz800_locked == 1)
708            mz800_bank_w(vio_lock, 0); /* old config for D000-DFFF */
708            mz800_bank_w(machine, vio_lock, 0); /* old config for D000-DFFF */
709709        break;
710710
711711   case 8: /* set MZ700 enable bit 7 ? */
r1877r1878
776776    mem = memory_region(REGION_USER1);
777777   memset(&mem[0x00000], 0xff, 0x10000);
778778
779    mz800_display_mode_w(0,0x08);   /* set MZ700 mode */
780   mz800_bank_r(1);
781   mz800_bank_w(4, 0);
779    mz800_display_mode_w(machine, 0, 0x08);   /* set MZ700 mode */
780   mz800_bank_r(machine, 1);
781   mz800_bank_w(machine, 4, 0);
782782}
783783
784784
src/mess/machine/ins8154.h
r1877r1878
1515typedef struct _ins8154_interface ins8154_interface;
1616struct _ins8154_interface
1717{
18   read8_handler in_a_func;
19   read8_handler in_b_func;
20   write8_handler out_a_func;
21   write8_handler out_b_func;
18   read8_machine_func in_a_func;
19   read8_machine_func in_b_func;
20   write8_machine_func out_a_func;
21   write8_machine_func out_b_func;
2222   void (*irq_func)(int state);   
2323};
2424
src/mess/machine/vectrex.c
r1877r1878
107107 *********************************************************************/
108108void vectrex_configuration(void)
109109{
110   unsigned char cport = input_port_5_r (0);
110   unsigned char cport = readinputport(5);
111111
112112   /* Vectrex 'dipswitch' configuration */
113113
r1877r1878
184184      vectrex_beam_color = RGB_WHITE;
185185      imager_colors[0]=imager_colors[1]=imager_colors[2]=imager_colors[3]=imager_colors[4]=imager_colors[5]=RGB_WHITE;
186186   }
187   vectrex_lightpen_port = (input_port_6_r (0) & 0x03);
187   vectrex_lightpen_port = (readinputport(6) & 0x03);
188188}
189189
190190/*********************************************************************
r1877r1878
208208   return vectrex_via_out[PORTB];
209209}
210210
211 READ8_HANDLER( v_via_pa_r )
211READ8_HANDLER( v_via_pa_r )
212212{
213213   if ((!(vectrex_via_out[PORTB] & 0x10)) && (vectrex_via_out[PORTB] & 0x08))
214214      /* BDIR inactive, we can read the PSG. BC1 has to be active. */
215215   {
216      vectrex_via_out[PORTA] = AY8910_read_port_0_r (0)
216      vectrex_via_out[PORTA] = AY8910_read_port_0_r(machine, 0)
217217         & ~(vectrex_imager_pinlevel & 0x80);
218218      vectrex_imager_pinlevel &= ~0x80;
219219   }
220220   return vectrex_via_out[PORTA];
221221}
222222
223 READ8_HANDLER( s1_via_pb_r )
223READ8_HANDLER( s1_via_pb_r )
224224{
225   return (vectrex_via_out[PORTB] & ~0x40) | ((input_port_1_r(0) & 0x1)<<6);
225   return (vectrex_via_out[PORTB] & ~0x40) | ((readinputport(1) & 0x1)<<6);
226226}
227227
228228/*********************************************************************
r1877r1878
251251         timer_set (double_to_attotime(rtime * 0.50), NULL, 1, vectrex_imager_right_eye);
252252
253253         /* Index hole sensor is connected to IO7 which triggers also CA1 of VIA */
254         via_0_ca1_w (0, 1);
255         via_0_ca1_w (0, 0);
254         via_0_ca1_w(machine, 0, 1);
255         via_0_ca1_w(machine, 0, 0);
256256         vectrex_imager_pinlevel |= 0x80;
257257      }
258258   }
src/mess/machine/aim65.c
r1877r1878
105105
106106static const pia6821_interface pia =
107107{
108   NULL, // read8_handler in_a_func,
109   NULL, // read8_handler in_b_func,
110   NULL, // read8_handler in_ca1_func,
111   NULL, // read8_handler in_cb1_func,
112   NULL, // read8_handler in_ca2_func,
113   NULL, // read8_handler in_cb2_func,
108   NULL, // read8_machine_func in_a_func,
109   NULL, // read8_machine_func in_b_func,
110   NULL, // read8_machine_func in_ca1_func,
111   NULL, // read8_machine_func in_cb1_func,
112   NULL, // read8_machine_func in_ca2_func,
113   NULL, // read8_machine_func in_cb2_func,
114114   aim65_pia_a_w,
115115   aim65_pia_b_w,
116   NULL, // write8_handler out_ca2_func,
117   NULL, // write8_handler out_cb2_func,
116   NULL, // write8_machine_func out_ca2_func,
117   NULL, // write8_machine_func out_cb2_func,
118118   NULL, // void (*irq_a_func)(int state),
119119   NULL, // void (*irq_b_func)(int state),
120120};
r1877r1878
197197
198198static const struct via6522_interface via0 =
199199{
200   0, // read8_handler in_a_func;
201   aim65_via0_b_r, // read8_handler in_b_func;
202   0, // read8_handler in_ca1_func;
203   0, // read8_handler in_cb1_func;
204   0, // read8_handler in_ca2_func;
205   0, // read8_handler in_cb2_func;
206   aim65_via0_a_w,   // write8_handler out_a_func;
207   aim65_via0_b_w, // write8_handler out_b_func;
208   0, // write8_handler out_ca1_func;
209   0, // write8_handler out_cb1_func;
210   0, // write8_handler out_ca2_func;
211   aim65_printer_on, // write8_handler out_cb2_func;
200   0, // read8_machine_func in_a_func;
201   aim65_via0_b_r, // read8_machine_func in_b_func;
202   0, // read8_machine_func in_ca1_func;
203   0, // read8_machine_func in_cb1_func;
204   0, // read8_machine_func in_ca2_func;
205   0, // read8_machine_func in_cb2_func;
206   aim65_via0_a_w,   // write8_machine_func out_a_func;
207   aim65_via0_b_w, // write8_machine_func out_b_func;
208   0, // write8_machine_func out_ca1_func;
209   0, // write8_machine_func out_cb1_func;
210   0, // write8_machine_func out_ca2_func;
211   aim65_printer_on, // write8_machine_func out_cb2_func;
212212   aim65_via_irq_func // void (*irq_func)(int state);
213213};
214214
r1877r1878
242242   r6532_reset(0);
243243
244244   via_config(0, &via0);
245   via_0_cb1_w(1, 1);
246   via_0_ca1_w(1, 0);
245   via_0_cb1_w(machine, 1, 1);
246   via_0_ca1_w(machine, 1, 0);
247247
248248   via_config(1, &user_via);
249249   via_reset();
src/mess/machine/nes_mmc.c
r1877r1878
4949
5050int MMC1_extended;   /* 0 = normal MMC1 cart, 1 = 512k MMC1, 2 = 1024k MMC1 */
5151
52write8_handler mmc_write_low;
53read8_handler mmc_read_low;
54write8_handler mmc_write_mid;
55read8_handler mmc_read_mid;
56write8_handler mmc_write;
52write8_machine_func mmc_write_low;
53read8_machine_func mmc_read_low;
54write8_machine_func mmc_write_mid;
55read8_machine_func mmc_read_mid;
56write8_machine_func mmc_write;
5757/*void (*ppu_latch)(offs_t offset);*/
5858
5959static int vrom_bank[16];
r1877r1878
106106
107107WRITE8_HANDLER( nes_low_mapper_w )
108108{
109   if (mmc_write_low) (*mmc_write_low)(offset, data);
109   if (mmc_write_low) (*mmc_write_low)(machine, offset, data);
110110   else
111111   {
112112      logerror("Unimplemented LOW mapper write, offset: %04x, data: %02x\n", offset, data);
r1877r1878
124124READ8_HANDLER( nes_low_mapper_r )
125125{
126126   if (mmc_read_low)
127      return (*mmc_read_low)(offset);
127      return (*mmc_read_low)(machine, offset);
128128   else
129129      logerror("low mapper area read, addr: %04x\n", offset + 0x4100);
130130
r1877r1878
133133
134134WRITE8_HANDLER ( nes_mid_mapper_w )
135135{
136   if (mmc_write_mid) (*mmc_write_mid)(offset, data);
136   if (mmc_write_mid) (*mmc_write_mid)(machine, offset, data);
137137   else if (nes.mid_ram_enable)
138138      battery_ram[offset] = data;
139139//   else
r1877r1878
159159
160160WRITE8_HANDLER ( nes_mapper_w )
161161{
162   if (mmc_write) (*mmc_write)(offset, data);
162   if (mmc_write) (*mmc_write)(machine, offset, data);
163163   else
164164   {
165165      logerror("Unimplemented mapper write, offset: %04x, data: %02x\n", offset, data);
r1877r1878
901901   /* Send $5000-$5015 to the sound chip */
902902   if ((offset >= 0xf00) && (offset <= 0xf15))
903903   {
904      NESPSG_0_w (offset & 0x1f, data);
904      NESPSG_0_w (machine, offset & 0x1f, data);
905905      return;
906906   }
907907
r1877r1878
29592959      break;
29602960
29612961   default:
2962      mapper4_w( offset, data );
2962      mapper4_w( machine, offset, data );
29632963      break;
29642964   }
29652965}
r1877r1878
44194419   if ( (offset & 0x6001) == 0x2000 )
44204420      return;
44214421
4422   mapper4_w( offset, data );
4422   mapper4_w( machine, offset, data );
44234423}
44244424
44254425static WRITE8_HANDLER( mapper225_w )
src/mess/machine/pclpt.c
r1877r1878
5858static void pc_LPT_w(int n, int offset, int data)
5959{
6060   PC_LPT *This=LPT+n;
61   if ( !(input_port_2_r(0) & (0x08>>n)) ) return;
61   if ( !(readinputport(2) & (0x08>>n)) ) return;
6262//   if (!This->on) return;
6363   switch( offset )
6464   {
r1877r1878
9393{
9494   PC_LPT *This=LPT+n;
9595    int data = 0xff;
96   if ( !(input_port_2_r(0) & (0x08>>n)) ) return data;
96   if ( !(readinputport(2) & (0x08>>n)) ) return data;
9797//   if (!This->on) return data;
9898   switch( offset )
9999   {
r1877r1878
156156WRITE8_HANDLER ( pc_parallelport1_w ) { pc_LPT_w(1,offset,data); }
157157WRITE8_HANDLER ( pc_parallelport2_w ) { pc_LPT_w(2,offset,data); }
158158
159READ16_HANDLER ( pc16le_parallelport0_r ) { return read16le_with_read8_handler(pc_parallelport0_r, offset, mem_mask); }
160READ16_HANDLER ( pc16le_parallelport1_r ) { return read16le_with_read8_handler(pc_parallelport1_r, offset, mem_mask); }
161READ16_HANDLER ( pc16le_parallelport2_r ) { return read16le_with_read8_handler(pc_parallelport2_r, offset, mem_mask); }
162WRITE16_HANDLER( pc16le_parallelport0_w ) { write16le_with_write8_handler(pc_parallelport0_w, offset, data, mem_mask); }
163WRITE16_HANDLER( pc16le_parallelport1_w ) { write16le_with_write8_handler(pc_parallelport1_w, offset, data, mem_mask); }
164WRITE16_HANDLER( pc16le_parallelport2_w ) { write16le_with_write8_handler(pc_parallelport2_w, offset, data, mem_mask); }
159READ16_HANDLER ( pc16le_parallelport0_r ) { return read16le_with_read8_handler(pc_parallelport0_r, machine, offset, mem_mask); }
160READ16_HANDLER ( pc16le_parallelport1_r ) { return read16le_with_read8_handler(pc_parallelport1_r, machine, offset, mem_mask); }
161READ16_HANDLER ( pc16le_parallelport2_r ) { return read16le_with_read8_handler(pc_parallelport2_r, machine, offset, mem_mask); }
162WRITE16_HANDLER( pc16le_parallelport0_w ) { write16le_with_write8_handler(pc_parallelport0_w, machine, offset, data, mem_mask); }
163WRITE16_HANDLER( pc16le_parallelport1_w ) { write16le_with_write8_handler(pc_parallelport1_w, machine, offset, data, mem_mask); }
164WRITE16_HANDLER( pc16le_parallelport2_w ) { write16le_with_write8_handler(pc_parallelport2_w, machine, offset, data, mem_mask); }
165165
166READ32_HANDLER ( pc32le_parallelport0_r ) { return read32le_with_read8_handler(pc_parallelport0_r, offset, mem_mask); }
167READ32_HANDLER ( pc32le_parallelport1_r ) { return read32le_with_read8_handler(pc_parallelport1_r, offset, mem_mask); }
168READ32_HANDLER ( pc32le_parallelport2_r ) { return read32le_with_read8_handler(pc_parallelport2_r, offset, mem_mask); }
169WRITE32_HANDLER( pc32le_parallelport0_w ) { write32le_with_write8_handler(pc_parallelport0_w, offset, data, mem_mask); }
170WRITE32_HANDLER( pc32le_parallelport1_w ) { write32le_with_write8_handler(pc_parallelport1_w, offset, data, mem_mask); }
171WRITE32_HANDLER( pc32le_parallelport2_w ) { write32le_with_write8_handler(pc_parallelport2_w, offset, data, mem_mask); }
166READ32_HANDLER ( pc32le_parallelport0_r ) { return read32le_with_read8_handler(pc_parallelport0_r, machine, offset, mem_mask); }
167READ32_HANDLER ( pc32le_parallelport1_r ) { return read32le_with_read8_handler(pc_parallelport1_r, machine, offset, mem_mask); }
168READ32_HANDLER ( pc32le_parallelport2_r ) { return read32le_with_read8_handler(pc_parallelport2_r, machine, offset, mem_mask); }
169WRITE32_HANDLER( pc32le_parallelport0_w ) { write32le_with_write8_handler(pc_parallelport0_w, machine, offset, data, mem_mask); }
170WRITE32_HANDLER( pc32le_parallelport1_w ) { write32le_with_write8_handler(pc_parallelport1_w, machine, offset, data, mem_mask); }
171WRITE32_HANDLER( pc32le_parallelport2_w ) { write32le_with_write8_handler(pc_parallelport2_w, machine, offset, data, mem_mask); }
src/mess/machine/pc_joy.c
r1877r1878
5151
5252
5353
54READ16_HANDLER ( pc16le_JOY_r ) { return read16le_with_read8_handler(pc_JOY_r, offset, mem_mask); }
55WRITE16_HANDLER ( pc16le_JOY_w ) { write16le_with_write8_handler(pc_JOY_w, offset, data, mem_mask); }
54READ16_HANDLER ( pc16le_JOY_r ) { return read16le_with_read8_handler(pc_JOY_r, machine, offset, mem_mask); }
55WRITE16_HANDLER ( pc16le_JOY_w ) { write16le_with_write8_handler(pc_JOY_w, machine, offset, data, mem_mask); }
5656
5757
5858
src/mess/machine/vc1541.c
r1877r1878
355355      vc1541->head.sync=0;
356356      if (vc1541->type==TypeVC1541) {
357357         cpunum_set_input_line(machine, vc1541->cpunumber, M6502_SET_OVERFLOW, 1);
358         via_3_ca1_w(0,1);
358         via_3_ca1_w(machine, 0,1);
359359      }
360360      return;
361361   }
r1877r1878
379379   }
380380   if (vc1541->type==TypeVC1541) {
381381      cpunum_set_input_line(machine, vc1541->cpunumber, M6502_SET_OVERFLOW, 0);
382      via_3_ca1_w(0,0);
382      via_3_ca1_w(machine, 0,0);
383383   }
384384   vc1541->clock=0;
385385}
r1877r1878
966966#ifdef CPU_SYNC
967967   cpu_sync();
968968#endif
969   tpi6525_0_port_a_w(0,data);
969   tpi6525_0_port_a_w(Machine, 0,data);
970970}
971971
972972static int c1551x_read_data (TPI6525 *This)
r1877r1878
975975#ifdef CPU_SYNC
976976   cpu_sync ();
977977#endif
978   data=tpi6525_0_port_a_r(0);
978   data=tpi6525_0_port_a_r(Machine, 0);
979979   DBG_LOG(2, "c1551 cpu",("%d read data %.2x\n",
980980                   cpu_getactivecpu (), data));
981981   return data;
r1877r1878
988988#ifdef CPU_SYNC
989989   cpu_sync();
990990#endif
991   tpi6525_0_port_c_w(0,data&0x40?0xff:0x7f);
991   tpi6525_0_port_c_w(Machine, 0,data&0x40?0xff:0x7f);
992992}
993993
994994static int c1551x_read_handshake (TPI6525 *This)
r1877r1878
997997#ifdef CPU_SYNC
998998   cpu_sync();
999999#endif
1000   data=tpi6525_0_port_c_r(0)&8?0x80:0;
1000   data=tpi6525_0_port_c_r(Machine, 0)&8?0x80:0;
10011001   DBG_LOG(2, "c1551 cpu",("%d read handshake %.2x\n",
10021002                   cpu_getactivecpu (), data));
10031003   return data;
r1877r1878
10091009#ifdef CPU_SYNC
10101010   cpu_sync();
10111011#endif
1012   data=tpi6525_0_port_c_r(0)&3;
1012   data=tpi6525_0_port_c_r(Machine, 0)&3;
10131013   DBG_LOG(1, "c1551 cpu",("%d read status %.2x\n",
10141014                   cpu_getactivecpu (), data));
10151015   return data;
src/mess/machine/nes_mmc.h
r1877r1878
55{
66   int iNesMapper; /* iNES Mapper # */
77   const char *desc;     /* Mapper description */
8   write8_handler mmc_write_low; /* $4100-$5fff write routine */
9   read8_handler mmc_read_low; /* $4100-$5fff read routine */
10   write8_handler mmc_write_mid; /* $6000-$7fff write routine */
11   write8_handler mmc_write; /* $8000-$ffff write routine */
8   write8_machine_func mmc_write_low; /* $4100-$5fff write routine */
9   read8_machine_func mmc_read_low; /* $4100-$5fff read routine */
10   write8_machine_func mmc_write_mid; /* $6000-$7fff write routine */
11   write8_machine_func mmc_write; /* $8000-$ffff write routine */
1212   void (*ppu_latch)(offs_t offset);
1313   ppu2c0x_scanline_cb      mmc_scanline;
1414   ppu2c0x_hblank_cb      mmc_hblank;
r1877r1878
2323extern UINT8 MMC5_vram[0x400];
2424extern int MMC5_vram_control;
2525
26extern write8_handler mmc_write_low;
27extern read8_handler mmc_read_low;
28extern write8_handler mmc_write_mid;
29extern read8_handler mmc_read_mid;
30extern write8_handler mmc_write;
26extern write8_machine_func mmc_write_low;
27extern read8_machine_func mmc_read_low;
28extern write8_machine_func mmc_write_mid;
29extern read8_machine_func mmc_read_mid;
30extern write8_machine_func mmc_write;
3131
3232int mapper_reset (int mapperNum);
3333
src/mess/machine/mc6846.c
r1877r1878
1919**********************************************************************/
2020
2121#include "driver.h"
22#include "deprecat.h"
2223#include "mc6846.h"
2324
2425#define VERBOSE 0
r1877r1878
6970
7071#define PORT                        \
7172   ((mc6846.pdr & mc6846.ddr) |               \
72    ((mc6846.iface->in_port_func ? mc6846.iface->in_port_func(0) : 0) & \
73    ((mc6846.iface->in_port_func ? mc6846.iface->in_port_func(machine, 0) : 0) & \
7374     ~mc6846.ddr))
7475
7576#define CTO                        \
r1877r1878
126127
127128
128129
129INLINE void mc6846_update_cto ( void )
130INLINE void mc6846_update_cto ( running_machine *machine )
130131{
131132   int cto = CTO;
132133   static int old_cto;
r1877r1878
136137      old_cto = cto;
137138   }
138139   if ( mc6846.iface->out_cto_func )
139      mc6846.iface->out_cto_func( 0, cto );
140      mc6846.iface->out_cto_func( machine, 0, cto );
140141}
141142
142143
143144
144INLINE void mc6846_timer_launch ( void )
145INLINE void mc6846_timer_launch ( running_machine *machine )
145146{
146147   int delay = FACTOR * (mc6846.preset+1);
147148   LOG (( "%f: mc6846 timer launch called, mode=%i, preset=%i (x%i)\n", attotime_to_double(timer_get_time()), MODE, mc6846.preset, FACTOR ));
r1877r1878
178179   mc6846.timer_started = 1;
179180
180181   mc6846.csr &= ~1;
181   mc6846_update_cto();
182   mc6846_update_cto(machine);
182183   mc6846_update_irq();
183184}
184185
r1877r1878
223224   timer_reset( mc6846.interval, ATTOTIME_IN_CYCLES( delay, mc6846.iface->cpunum ) );
224225
225226   mc6846.csr |= 1;
226   mc6846_update_cto();
227   mc6846_update_cto(machine);
227228   mc6846_update_irq();
228229}
229230
r1877r1878
235236
236237   /* 1 micro second after one-shot launch, we put cto to high */
237238   mc6846.cto = 1;
238   mc6846_update_cto();
239   mc6846_update_cto(machine);
239240}
240241
241242
r1877r1878
355356      {
356357         mc6846.cp2_cpu = (data >> 3) & 1;
357358         if ( mc6846.iface->out_cp2_func )
358            mc6846.iface->out_cp2_func( 0, mc6846.cp2_cpu );
359            mc6846.iface->out_cp2_func( machine, 0, mc6846.cp2_cpu );
359360      }
360361      else
361362         logerror( "$%04x mc6846 acknowledge not implemented\n", activecpu_get_previouspc() );
r1877r1878
368369      {
369370         mc6846.ddr = data;
370371         if ( mc6846.iface->out_port_func )
371            mc6846.iface->out_port_func( 0, mc6846.pdr & mc6846.ddr );
372            mc6846.iface->out_port_func( machine, 0, mc6846.pdr & mc6846.ddr );
372373      }
373374      break;
374375
r1877r1878
378379      {
379380         mc6846.pdr = data;
380381         if ( mc6846.iface->out_port_func )
381            mc6846.iface->out_port_func( 0, mc6846.pdr & mc6846.ddr );
382            mc6846.iface->out_port_func( machine, 0, mc6846.pdr & mc6846.ddr );
382383         if ( mc6846.csr1_to_be_cleared && (mc6846.csr & 2) )
383384         {
384385            mc6846.csr &= ~2;
r1877r1878
416417         mc6846.csr &= ~1;
417418         if ( MODE != 0x30 )
418419            mc6846.cto = 0;
419         mc6846_update_cto();
420         mc6846_update_cto(machine);
420421         timer_reset( mc6846.interval, attotime_never );
421422         timer_reset( mc6846.one_shot, attotime_never );
422423         mc6846.timer_started = 0;
r1877r1878
425426      {
426427         /* timer launch */
427428         if ( ! mc6846.timer_started )
428            mc6846_timer_launch();
429            mc6846_timer_launch(machine);
429430      }
430431      mc6846_update_irq();
431432   }
r1877r1878
445446         mc6846.csr &= ~1;
446447         mc6846_update_irq();
447448         mc6846.cto = 0;
448         mc6846_update_cto();
449         mc6846_update_cto(machine);
449450         /* launch only if started */
450451         if (!(mc6846.tcr & 1))
451            mc6846_timer_launch();
452            mc6846_timer_launch(machine);
452453      }
453454      break;
454455
r1877r1878
502503
503504UINT8 mc6846_get_output_port ( void )
504505{
506   running_machine *machine = Machine;
505507   return PORT;
506508}
507509
src/mess/machine/thomson.c
r1877r1878
762762READ8_HANDLER ( to7_modem_mea8000_r )
763763{
764764   if ( readinputport( THOM_INPUT_MCONFIG ) & 1 )
765      return mea8000_r( offset );
765      return mea8000_r( machine, offset );
766766   else
767767   {
768768      switch ( offset ) {
769      case 0: return acia6850_0_stat_r( 0 );
770      case 1: return acia6850_0_data_r( 0 );
769      case 0: return acia6850_0_stat_r( machine, 0 );
770      case 1: return acia6850_0_data_r( machine, 0 );
771771      default: return 0;
772772      }
773773   }
r1877r1878
778778WRITE8_HANDLER ( to7_modem_mea8000_w )
779779{
780780   if ( readinputport( THOM_INPUT_MCONFIG ) & 1 )
781      mea8000_w( offset, data );
781      mea8000_w( machine, offset, data );
782782   else
783783   {
784784      switch ( offset ) {
785      case 0: acia6850_0_ctrl_w( 0, data ); break;
786      case 1: acia6850_0_data_w( 0, data ); break;
785      case 0: acia6850_0_ctrl_w( machine, 0, data ); break;
786      case 1: acia6850_0_data_w( machine, 0, data ); break;
787787      }
788788   }
789789}
r1877r1878
12621262   to7_modem_reset();
12631263   to7_midi_reset();
12641264   to7_rf57932_reset();
1265   mea8000_reset();
1265   mea8000_reset(machine);
12661266
12671267   /* video */
12681268   thom_set_video_mode( THOM_VMODE_TO770 );
r1877r1878
12981298   to7_modem_init();
12991299   to7_midi_init();
13001300   to7_rf57932_init();
1301   mea8000_config( THOM_SOUND_SPEECH, NULL );
1301   mea8000_config( machine, THOM_SOUND_SPEECH, NULL );
13021302
13031303   /* memory */
13041304   thom_cart_bank = 0;
r1877r1878
13141314      /* BASIC instruction to see free memory: ?FRE(0) */
13151315      int extram = mess_ram_size - 24*1024;
13161316      memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x8000 + extram - 1, 0, 0,
1317                      (write8_handler)(STATIC_BANK1 + THOM_RAM_BANK - 1) );
1317                      (write8_machine_func)(STATIC_BANK1 + THOM_RAM_BANK - 1) );
13181318      memory_install_read8_handler(  0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x8000 + extram - 1, 0, 0,
1319                      (read8_handler)(STATIC_BANK1 + THOM_RAM_BANK - 1) );
1319                      (read8_machine_func)(STATIC_BANK1 + THOM_RAM_BANK - 1) );
13201320      memory_configure_bank( THOM_RAM_BANK,  0, 1, mess_ram + 0x6000, extram );
13211321      memory_set_bank( THOM_RAM_BANK, 0 );
13221322   }
r1877r1878
13921392   memory_set_bank( THOM_RAM_BANK, bank );
13931393   memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xdfff, 0, 0,
13941394                   (mess_ram_size == 128*1024 || bank < 2) ?
1395                   (write8_handler)(STATIC_BANK1 + THOM_RAM_BANK - 1) : MWA8_UNMAP );
1395                   (write8_machine_func)(STATIC_BANK1 + THOM_RAM_BANK - 1) : MWA8_UNMAP );
13961396   old_bank = bank;
13971397}
13981398
r1877r1878
14941494   to7_modem_reset();
14951495   to7_midi_reset();
14961496   to7_rf57932_reset();
1497   mea8000_reset();
1497   mea8000_reset(machine);
14981498
14991499   /* video */
15001500   thom_set_video_mode( THOM_VMODE_TO770 );
r1877r1878
15311531   to7_modem_init();
15321532   to7_midi_init();
15331533   to7_rf57932_init();
1534   mea8000_config( THOM_SOUND_SPEECH, NULL );
1534   mea8000_config( machine, THOM_SOUND_SPEECH, NULL );
15351535
15361536   /* memory */
15371537   thom_cart_bank = 0;
r1877r1878
17531753   int bank = 0;
17541754
17551755   memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0,
1756                  (read8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) );
1756                  (read8_machine_func)(STATIC_BANK1 + THOM_CART_BANK - 1) );
17571757
17581758   if ( rom_is_ram && thom_cart_nb_banks == 4 )
17591759   {
r1877r1878
17691769      int write_enable = mo5_reg_cart & 8;
17701770      bank = 4 + ( mo5_reg_cart & 3 );
17711771      memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, write_enable ?
1772                      (write8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) :  MWA8_NOP );
1772                      (write8_machine_func)(STATIC_BANK1 + THOM_CART_BANK - 1) :  MWA8_NOP );
17731773      if ( bank != old_bank )
17741774         LOG_BANK(( "mo5_update_cart_bank: CART is nanonetwork RAM bank %i (write-enable=%i)\n", mo5_reg_cart & 3, write_enable ? 1 : 0 ));
17751775   }
r1877r1878
18431843   to7_midi_reset();
18441844   to7_rf57932_reset();
18451845   mo5_init_timer();
1846   mea8000_reset();
1846   mea8000_reset(machine);
18471847
18481848   /* video */
18491849   thom_set_video_mode( THOM_VMODE_MO5 );
r1877r1878
18791879   to7_midi_init();
18801880   to7_rf57932_init();
18811881   mo5_periodic_timer = timer_alloc( mo5_periodic_cb , NULL);
1882   mea8000_config( THOM_SOUND_SPEECH, NULL );
1882   mea8000_config( machine, THOM_SOUND_SPEECH, NULL );
18831883
18841884   /* memory */
18851885   thom_cart_bank = 0;
r1877r1878
21102110   int slot = ( mc6846_get_output_port() >> 4 ) & 3; /* bits 4-5: ROM bank */
21112111
21122112   /* reset cartridge read handler */
2113   memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x0003, 0, 0, (read8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) );
2113   memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x0003, 0, 0, (read8_machine_func)(STATIC_BANK1 + THOM_CART_BANK - 1) );
21142114
21152115   switch ( slot )
21162116   {
r1877r1878
22142214   memory_set_bank( THOM_RAM_BANK, bank );
22152215   memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xdfff, 0, 0,
22162216                   (mess_ram_size == 192*1024 || bank < 6) ?
2217                   (write8_handler)(STATIC_BANK1 + THOM_RAM_BANK - 1) : MWA8_NOP );
2217                   (write8_machine_func)(STATIC_BANK1 + THOM_RAM_BANK - 1) : MWA8_NOP );
22182218   old_bank = bank;
22192219}
22202220
r1877r1878
27812781   to7_modem_reset();
27822782   to7_midi_reset();
27832783   to7_rf57932_reset();
2784   mea8000_reset();
2784   mea8000_reset(machine);
27852785
27862786   /* video */
27872787   thom_set_video_mode( THOM_VMODE_TO9 );
r1877r1878
28202820   to7_modem_init();
28212821   to7_midi_init();
28222822   to7_rf57932_init();
2823   mea8000_config( THOM_SOUND_SPEECH, NULL );
2823   mea8000_config( machine, THOM_SOUND_SPEECH, NULL );
28242824
28252825   /* memory */
28262826   thom_vram = mess_ram;
r1877r1878
32493249   memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xbfff, 0, 0,
32503250                   (mess_ram_size == 512*1024 || to8_data_vpage < 16) ?
32513251                   to8_data_vpage <= 4 ? to8_data_lo_w :
3252                   (write8_handler)(STATIC_BANK1 + TO8_DATA_LO - 1) :
3252                   (write8_machine_func)(STATIC_BANK1 + TO8_DATA_LO - 1) :
32533253                   MWA8_NOP );
32543254   memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0,
32553255                   (mess_ram_size == 512*1024 || to8_data_vpage < 16) ?
32563256                   to8_data_vpage <= 4 ? to8_data_hi_w :
3257                   (write8_handler)(STATIC_BANK1 + TO8_DATA_HI - 1) :
3257                   (write8_machine_func)(STATIC_BANK1 + TO8_DATA_HI - 1) :
32583258                   MWA8_NOP );
32593259}
32603260
r1877r1878
32663266   int bank = 0;
32673267
32683268   /* reset bank switch */
3269   memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x0003, 0, 0, (read8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) );
3269   memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x0003, 0, 0, (read8_machine_func)(STATIC_BANK1 + THOM_CART_BANK - 1) );
32703270
32713271   if ( to8_reg_cart & 0x20 )
32723272   {
r1877r1878
32763276      memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0,
32773277                      ((to8_cart_vpage < 8 || mess_ram_size == 512*1024) && (to8_reg_cart & 0x40)) ?
32783278                      (to8_cart_vpage <= 4) ? to8_vcart_w :
3279                      (write8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) :
3279                      (write8_machine_func)(STATIC_BANK1 + THOM_CART_BANK - 1) :
32803280                      MWA8_NOP );
32813281      if ( bank != old_bank )
32823282         LOG_BANK(( "to8_update_cart_bank: CART is RAM bank %i (write-enable=%i)\n", to8_cart_vpage, (to8_reg_cart & 0x40) ? 1 : 0 ));
r1877r1878
33663366{
33673367   if ( (to8_reg_sys1 & 0x80) && THOM_FLOPPY_EXT )
33683368      /* external controller */
3369      return to7_floppy_r( offset );
3369      return to7_floppy_r( machine, offset );
33703370   else if ( ! (to8_reg_sys1 & 0x80) && THOM_FLOPPY_INT )
33713371      /* internal controller */
3372      return thmfc_floppy_r( offset );
3372      return thmfc_floppy_r( machine, offset );
33733373   else
33743374      /* no controller */
33753375      return 0;
r1877r1878
33813381{
33823382   if ( (to8_reg_sys1 & 0x80) && THOM_FLOPPY_EXT )
33833383      /* external controller */
3384      to7_floppy_w( offset, data );
3384      to7_floppy_w( machine, offset, data );
33853385   else if ( ! (to8_reg_sys1 & 0x80) && THOM_FLOPPY_INT )
33863386      /* internal controller */
3387      thmfc_floppy_w( offset, data );
3387      thmfc_floppy_w( machine, offset, data );
33883388}
33893389
33903390
r1877r1878
35053505   if ( ( offset == 3 ) && ( to8_reg_ram & 0x80 ) && ( to8_reg_sys1 & 0x80 ) )
35063506   {
35073507      if ( THOM_FLOPPY_EXT )
3508         return to7_floppy_r( 0xc );
3508         return to7_floppy_r( machine, 0xc );
35093509      else
35103510         return 0;
35113511   }
r1877r1878
35693569      if ( ( offset == 3 ) && ( to8_reg_ram & 0x80 ) && ( to8_reg_sys1 & 0x80 ) )
35703570      {
35713571         if ( THOM_FLOPPY_EXT )
3572            to7_floppy_w( 0xc, data );
3572            to7_floppy_w( machine, 0xc, data );
35733573      }
35743574      else
35753575      {
r1877r1878
37063706   to7_modem_reset();
37073707   to7_midi_reset();
37083708   to7_rf57932_reset();
3709   mea8000_reset();
3709   mea8000_reset(machine);
37103710
37113711   /* gate-array */
37123712   to7_lightpen = 0;
r1877r1878
37563756   to7_modem_init();
37573757   to7_midi_init();
37583758   to7_rf57932_init();
3759   mea8000_config( THOM_SOUND_SPEECH, NULL );
3759   mea8000_config( machine, THOM_SOUND_SPEECH, NULL );
37603760
37613761   /* memory */
37623762   thom_cart_bank = 0;
r1877r1878
38683868   to7_modem_reset();
38693869   to7_midi_reset();
38703870   to7_rf57932_reset();
3871   mea8000_reset();
3871   mea8000_reset(machine);
38723872
38733873   /* gate-array */
38743874   to7_lightpen = 0;
r1877r1878
39183918   to7_modem_init();
39193919   to7_midi_init();
39203920   to7_rf57932_init();
3921   mea8000_config( THOM_SOUND_SPEECH, NULL );
3921   mea8000_config( machine, THOM_SOUND_SPEECH, NULL );
39223922
39233923   /* memory */
39243924   thom_cart_bank = 0;
r1877r1878
39883988   static int old_bank = -1;
39893989   int bank = 0;
39903990
3991   memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, (read8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) );
3991   memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, (read8_machine_func)(STATIC_BANK1 + THOM_CART_BANK - 1) );
39923992
39933993   if ( ( ( to8_reg_sys1 & 0x40 ) && ( to8_reg_cart & 0x20 ) ) || ( ! ( to8_reg_sys1 & 0x40 ) && ( mo5_reg_cart & 4 ) ) )
39943994   {
r1877r1878
40004000         bank = 8 + to8_cart_vpage;
40014001         memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0,
40024002                         (to8_reg_cart & 0x40) ? (to8_cart_vpage <= 4) ? to8_vcart_w :
4003                         (write8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) : MWA8_NOP );
4003                         (write8_machine_func)(STATIC_BANK1 + THOM_CART_BANK - 1) : MWA8_NOP );
40044004         if ( bank != old_bank )
40054005            LOG_BANK(( "mo6_update_cart_bank: CART is RAM bank %i (write-enable=%i)\n", to8_cart_vpage, (to8_reg_cart & 0x40) ? 1 : 0 ));
40064006      }
r1877r1878
40194019         to8_cart_vpage = (mo5_reg_cart & 3) | 4;
40204020         bank = 8 + to8_cart_vpage;
40214021         memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, write_enable ?
4022                         (write8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) :  MWA8_NOP );
4022                         (write8_machine_func)(STATIC_BANK1 + THOM_CART_BANK - 1) :  MWA8_NOP );
40234023         if ( bank != old_bank )
40244024            LOG_BANK(( "mo6_update_cart_bank: CART is RAM bank %i (write-enable=%i) (MO5 compat.)\n", to8_cart_vpage, write_enable ? 1 : 0 ));
40254025      }
r1877r1878
43594359{
43604360   /* 0xa7dc from external floppy drive aliases the video gate-array */
43614361   if ( ( offset == 3 ) && ( to8_reg_ram & 0x80 ) )
4362      return to7_floppy_r( 0xc );
4362      return to7_floppy_r( machine, 0xc );
43634363
43644364   switch ( offset )
43654365   {
43664366
43674367   case 0: /* palette data */
43684368   case 1: /* palette address */
4369      return to8_vreg_r( offset );
4369      return to8_vreg_r( machine, offset );
43704370
43714371   case 2:
43724372   case 3:
r1877r1878
43914391
43924392   case 0: /* palette data */
43934393   case 1: /* palette address */
4394      to8_vreg_w( offset, data );
4394      to8_vreg_w( machine, offset, data );
43954395      return;
43964396
43974397   case 2: /* display / external floppy register */
43984398      if ( ( to8_reg_sys1 & 0x80 ) && ( to8_reg_ram & 0x80 ) )
4399         to7_floppy_w( 0xc, data );
4399         to7_floppy_w( machine, 0xc, data );
44004400      else
44014401         to9_set_video_mode( data, 2 );
44024402      break;
r1877r1878
44044404   case 3: /* system register 2 */
44054405      /* 0xa7dc from external floppy drive aliases the video gate-array */
44064406      if ( ( offset == 3 ) && ( to8_reg_ram & 0x80 ) )
4407         to7_floppy_w( 0xc, data );
4407         to7_floppy_w( machine, 0xc, data );
44084408      else
44094409      {
44104410         to8_reg_sys2 = data;
r1877r1878
44404440   to7_midi_reset();
44414441   to7_rf57932_reset();
44424442   mo5_init_timer();
4443   mea8000_reset();
4443   mea8000_reset(machine);
44444444
44454445   /* gate-array */
44464446   to7_lightpen = 0;
r1877r1878
44854485   to7_midi_init();
44864486   to7_rf57932_init();
44874487   mo5_periodic_timer = timer_alloc( mo5_periodic_cb , NULL);
4488   mea8000_config( THOM_SOUND_SPEECH, NULL );
4488   mea8000_config( machine, THOM_SOUND_SPEECH, NULL );
44894489
44904490   /* memory */
44914491   thom_cart_bank = 0;
r1877r1878
45354535READ8_HANDLER ( mo5nr_net_r )
45364536{
45374537   if ( to7_controller_type )
4538      return to7_floppy_r ( offset );
4538      return to7_floppy_r ( machine, offset );
45394539
45404540   logerror( "$%04x %f mo5nr_net_r: read from reg %i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), offset );
45414541
45424542   if ( to7_controller_type )
4543      return to7_floppy_r ( offset );
4543      return to7_floppy_r ( machine, offset );
45444544
45454545   return 0;
45464546}
r1877r1878
45504550WRITE8_HANDLER ( mo5nr_net_w )
45514551{
45524552   if ( to7_controller_type )
4553      to7_floppy_w ( offset, data );
4553      to7_floppy_w ( machine, offset, data );
45544554   else
45554555      logerror( "$%04x %f mo5nr_net_w: write $%02X to reg %i\n",
45564556           activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data, offset );
r1877r1878
47074707   to7_midi_reset();
47084708   to7_rf57932_reset();
47094709   mo5_init_timer();
4710   mea8000_reset();
4710   mea8000_reset(machine);
47114711
47124712   /* gate-array */
47134713   to7_lightpen = 0;
r1877r1878
47524752   to7_midi_init();
47534753   to7_rf57932_init();
47544754   mo5_periodic_timer = timer_alloc( mo5_periodic_cb , NULL);
4755   mea8000_config( THOM_SOUND_SPEECH, NULL );
4755   mea8000_config( machine, THOM_SOUND_SPEECH, NULL );
47564756
47574757   /* memory */
47584758   thom_cart_bank = 0;
src/mess/machine/lisa.c
r1877r1878
11741174   via_set_clock(1, lisa_features.has_fast_timers ? 1250000 : 500000);   /* one of these values must be wrong : see note after description of the has_fast_timers field */
11751175
11761176   via_reset();
1177   COPS_via_out_ca2(0, 0);   /* VIA core forgets to do so */
1177   COPS_via_out_ca2(machine, 0, 0);   /* VIA core forgets to do so */
11781178
11791179   /* initialize floppy */
11801180   {
r1877r1878
13581358   }
13591359}
13601360
1361 READ8_HANDLER ( lisa_fdc_io_r )
1361READ8_HANDLER ( lisa_fdc_io_r )
13621362{
13631363   int answer=0;
13641364
13651365   switch ((offset & 0x0030) >> 4)
13661366   {
13671367   case 0:   /* IWM */
1368      answer = /*iwm_lisa_r*/applefdc_r(offset);
1368      answer = /*iwm_lisa_r*/applefdc_r(machine, offset);
13691369      break;
13701370
13711371   case 1:   /* TTL glue */
r1877r1878
13901390   switch ((offset & 0x0030) >> 4)
13911391   {
13921392   case 0:   /* IWM */
1393      /*iwm_lisa_w*/applefdc_w(offset, data);
1393      /*iwm_lisa_w*/applefdc_w(machine, offset, data);
13941394      break;
13951395
13961396   case 1:   /* TTL glue */
r1877r1878
14181418         if (! (offset & 0x0400))
14191419            return lisa_fdc_ram[offset & 0x03ff];
14201420         else
1421            return lisa_fdc_io_r(offset & 0x03ff);
1421            return lisa_fdc_io_r(machine, offset & 0x03ff);
14221422      else
14231423         return 0;   /* ??? */
14241424   }
r1877r1878
14341434         if (! (offset & 0x0800))
14351435            return lisa_fdc_ram[offset & 0x03ff];
14361436         else
1437            return lisa_fdc_io_r(offset & 0x03ff);
1437            return lisa_fdc_io_r(machine, offset & 0x03ff);
14381438      else
14391439         return 0;   /* ??? */
14401440   }
r1877r1878
14511451         if (! (offset & 0x0400))
14521452            lisa_fdc_ram[offset & 0x03ff] = data;
14531453         else
1454            lisa_fdc_io_w(offset & 0x03ff, data);
1454            lisa_fdc_io_w(machine, offset & 0x03ff, data);
14551455      }
14561456   }
14571457}
r1877r1878
14651465         if (! (offset & 0x0800))
14661466            lisa_fdc_ram[offset & 0x03ff] = data;
14671467         else
1468            lisa_fdc_io_w(offset & 0x03ff, data);
1468            lisa_fdc_io_w(machine, offset & 0x03ff, data);
14691469      }
14701470   }
14711471}
r1877r1878
15681568         break;
15691569
15701570      case IO:
1571         answer = lisa_IO_r((address & 0x00ffff) >> 1, mem_mask);
1571         answer = lisa_IO_r(machine, (address & 0x00ffff) >> 1, mem_mask);
15721572         break;
15731573
15741574      case invalid:      /* unmapped segment */
r1877r1878
18401840         break;
18411841
18421842      case IO:
1843         lisa_IO_w((address & 0x00ffff) >> 1, data, mem_mask);
1843         lisa_IO_w(machine, (address & 0x00ffff) >> 1, data, mem_mask);
18441844         break;
18451845
18461846      case RAM_stack_r:   /* read-only */
src/mess/machine/sym1.c
r1877r1878
138138   riot_port_b = data;
139139
140140   /* first 4 pins are connected to the 74145 */
141   ttl74145_0_w(0, data & 0x0f);
141   ttl74145_0_w(machine, 0, data & 0x0f);
142142}
143143
144144
src/mess/machine/lynx.c
r1877r1878
10631063      data |= 4; // no comlynx adapter
10641064      break;
10651065    case 0x8c: case 0x8d:
1066      data = lynx_uart_r( offset );
1066      data = lynx_uart_r(machine, offset);
10671067      break;
10681068    default:
10691069      data = mikey.data[offset];
r1877r1878
11211121      break;
11221122
11231123   case 0x8c: case 0x8d:
1124      lynx_uart_w(offset, data);
1124      lynx_uart_w(machine, offset, data);
11251125      break;
11261126
11271127   case 0xa0: case 0xa1: case 0xa2: case 0xa3: case 0xa4: case 0xa5: case 0xa6: case 0xa7:
r1877r1878
11801180static void lynx_reset(running_machine *machine)
11811181{
11821182   int i;
1183   lynx_memory_config_w(0, 0);
1183   lynx_memory_config_w(machine, 0, 0);
11841184
11851185   cpunum_set_input_line(machine, 0, M65SC02_IRQ_LINE, CLEAR_LINE);
11861186
r1877r1878
12081208
12091209static void lynx_postload(void)
12101210{
1211   lynx_memory_config_w(0, lynx_memory_config);
1211   lynx_memory_config_w(Machine, 0, lynx_memory_config);
12121212}
12131213
12141214MACHINE_START( lynx )
src/mess/machine/cgenie.c
r1877r1878
2020
2121
2222#define AYWriteReg(chip,port,value) \
23   AY8910_control_port_0_w(0,port);  \
24   AY8910_write_port_0_w(0,value)
23   AY8910_control_port_0_w(machine, 0,port);  \
24   AY8910_write_port_0_w(machine, 0,value)
2525
2626#define TAPE_HEADER "Colour Genie - Virtual Tape File"
2727
r1877r1878
855855   {
856856      /* comparator value */
857857      psg_b_inp = 0x00;
858      if( input_port_9_r(0) > psg_a_out )
858      if( readinputport(9) > psg_a_out )
859859         psg_b_inp |= 0x80;
860      if( input_port_10_r(0) > psg_a_out )
860      if( readinputport(10) > psg_a_out )
861861         psg_b_inp |= 0x40;
862      if( input_port_11_r(0) > psg_a_out )
862      if( readinputport(11) > psg_a_out )
863863         psg_b_inp |= 0x20;
864      if( input_port_12_r(0) > psg_a_out )
864      if( readinputport(12) > psg_a_out )
865865         psg_b_inp |= 0x10;
866866   }
867867   else
r1877r1878
869869      /* read keypad matrix */
870870      psg_b_inp = 0xFF;
871871      if( !(psg_a_out & 0x01) )
872         psg_b_inp &= ~(input_port_13_r(0) & 15);
872         psg_b_inp &= ~(readinputport(13) & 15);
873873      if( !(psg_a_out & 0x02) )
874         psg_b_inp &= ~(input_port_13_r(0) / 16);
874         psg_b_inp &= ~(readinputport(13) / 16);
875875      if( !(psg_a_out & 0x04) )
876         psg_b_inp &= ~(input_port_14_r(0) & 15);
876         psg_b_inp &= ~(readinputport(14) & 15);
877877      if( !(psg_a_out & 0x08) )
878         psg_b_inp &= ~(input_port_14_r(0) / 16);
878         psg_b_inp &= ~(readinputport(14) / 16);
879879      if( !(psg_a_out & 0x10) )
880         psg_b_inp &= ~(input_port_15_r(0) & 15);
880         psg_b_inp &= ~(readinputport(15) & 15);
881881      if( !(psg_a_out & 0x20) )
882         psg_b_inp &= ~(input_port_15_r(0) / 16);
882         psg_b_inp &= ~(readinputport(15) / 16);
883883   }
884884   return psg_b_inp;
885885}
r1877r1878
899899   /* If the floppy isn't emulated, return 0 */
900900   if( (readinputport(0) & 0x80) == 0 )
901901      return 0;
902   return wd17xx_status_r(offset);
902   return wd17xx_status_r(machine, offset);
903903}
904904
905905 READ8_HANDLER( cgenie_track_r )
r1877r1878
907907   /* If the floppy isn't emulated, return 0xff */
908908   if( (readinputport(0) & 0x80) == 0 )
909909      return 0xff;
910   return wd17xx_track_r(offset);
910   return wd17xx_track_r(machine, offset);
911911}
912912
913913 READ8_HANDLER( cgenie_sector_r )
r1877r1878
915915   /* If the floppy isn't emulated, return 0xff */
916916   if( (readinputport(0) & 0x80) == 0 )
917917      return 0xff;
918   return wd17xx_sector_r(offset);
918   return wd17xx_sector_r(machine, offset);
919919}
920920
921921 READ8_HANDLER(cgenie_data_r )
r1877r1878
923923   /* If the floppy isn't emulated, return 0xff */
924924   if( (readinputport(0) & 0x80) == 0 )
925925      return 0xff;
926   return wd17xx_data_r(offset);
926   return wd17xx_data_r(machine, offset);
927927}
928928
929929WRITE8_HANDLER( cgenie_command_w )
r1877r1878
931931   /* If the floppy isn't emulated, return immediately */
932932   if( (readinputport(0) & 0x80) == 0 )
933933      return;
934   wd17xx_command_w(offset, data);
934   wd17xx_command_w(machine, offset, data);
935935}
936936
937937WRITE8_HANDLER( cgenie_track_w )
r1877r1878
939939   /* If the floppy isn't emulated, ignore the write */
940940   if( (readinputport(0) & 0x80) == 0 )
941941      return;
942   wd17xx_track_w(offset, data);
942   wd17xx_track_w(machine, offset, data);
943943}
944944
945945WRITE8_HANDLER( cgenie_sector_w )
r1877r1878
947947   /* If the floppy isn't emulated, ignore the write */
948948   if( (readinputport(0) & 0x80) == 0 )
949949      return;
950   wd17xx_sector_w(offset, data);
950   wd17xx_sector_w(machine, offset, data);
951951}
952952
953953WRITE8_HANDLER( cgenie_data_w )
r1877r1878
955955   /* If the floppy isn't emulated, ignore the write */
956956   if( (readinputport(0) & 0x80) == 0 )
957957      return;
958   wd17xx_data_w(offset, data);
958   wd17xx_data_w(machine, offset, data);
959959}
960960
961961 READ8_HANDLER( cgenie_irq_status_r )
r1877r1878
10411041   int result = 0;
10421042
10431043   if( offset & 0x01 )
1044      result |= input_port_1_r(0);
1044      result |= readinputport(1);
10451045   if( offset & 0x02 )
1046      result |= input_port_2_r(0);
1046      result |= readinputport(2);
10471047   if( offset & 0x04 )
1048      result |= input_port_3_r(0);
1048      result |= readinputport(3);
10491049   if( offset & 0x08 )
1050      result |= input_port_4_r(0);
1050      result |= readinputport(4);
10511051   if( offset & 0x10 )
1052      result |= input_port_5_r(0);
1052      result |= readinputport(5);
10531053   if( offset & 0x20 )
1054      result |= input_port_6_r(0);
1054      result |= readinputport(6);
10551055   if( offset & 0x40 )
1056      result |= input_port_7_r(0);
1056      result |= readinputport(7);
10571057   if( offset & 0x80 )
1058      result |= input_port_8_r(0);
1058      result |= readinputport(8);
10591059
10601060   return result;
10611061}
r1877r1878
11331133{
11341134   if( cgenie_tv_mode != (readinputport(0) & 0x10) )
11351135   {
1136      cgenie_tv_mode = input_port_0_r(0) & 0x10;
1136      cgenie_tv_mode = readinputport(0) & 0x10;
11371137      /* force setting of background color */
11381138      port_ff ^= FF_BGD0;
1139      cgenie_port_ff_w(0, port_ff ^ FF_BGD0);
1139      cgenie_port_ff_w(machine, 0, port_ff ^ FF_BGD0);
11401140   }
11411141}
src/mess/machine/mc6846.h
r1877r1878
1616struct _mc6846_interface
1717{
1818  /* CPU write to the outside through chip */
19  write8_handler out_port_func;  /* 8-bit output */
20  write8_handler out_cp1_func;   /* 1-bit output */
21  write8_handler out_cp2_func;   /* 1-bit output */
19  write8_machine_func out_port_func;  /* 8-bit output */
20  write8_machine_func out_cp1_func;   /* 1-bit output */
21  write8_machine_func out_cp2_func;   /* 1-bit output */
2222
2323  /* CPU read from the outside through chip */
24  read8_handler in_port_func; /* 8-bit input */
24  read8_machine_func in_port_func; /* 8-bit input */
2525
2626  /* asynchronous timer output to outside world */
27  write8_handler out_cto_func; /* 1-bit output */
27  write8_machine_func out_cto_func; /* 1-bit output */
2828
2929  /* timer interrupt */
3030  void ( * irq_func ) ( int state );
src/mess/machine/pmd85.c
r1877r1878
471471            switch (offset & 0x80)
472472            {
473473               case 0x80:   /* Motherboard 8255 */
474                     return ppi8255_0_r(offset & 0x03);
474                     return ppi8255_0_r(machine, offset & 0x03);
475475            }
476476            break;
477477      case 0x08:   /* ROM module connector */
r1877r1878
486486                     switch (offset & 0x80)
487487                     {
488488                        case 0x80:   /* ROM module 8255 */
489                              return ppi8255_3_r(offset & 0x03);
489                              return ppi8255_3_r(machine, offset & 0x03);
490490                     }
491491                  }
492492                  break;
r1877r1878
501501                        case 0x10:   /* 8251 (casette recorder, V24) */
502502                              switch (offset & 0x01)
503503                              {
504                                 case 0x00: return msm8251_data_r(offset & 0x01);
505                                 case 0x01: return msm8251_status_r(offset & 0x01);
504                                 case 0x00: return msm8251_data_r(machine, offset & 0x01);
505                                 case 0x01: return msm8251_status_r(machine, offset & 0x01);
506506                              }
507507                              break;
508508                        case 0x40:      /* 8255 (GPIO/0, GPIO/1) */
509                              return ppi8255_1_r(offset & 0x03);
509                              return ppi8255_1_r(machine, offset & 0x03);
510510                        case 0x50:   /* 8253 */
511                              return pit8253_0_r (offset & 0x03);
511                              return pit8253_0_r(machine, offset & 0x03);
512512                        case 0x70:   /* 8255 (IMS-2) */
513                              return ppi8255_2_r(offset & 0x03);
513                              return ppi8255_2_r(machine, offset & 0x03);
514514                     }
515515                     break;
516516               case 0x80:   /* external interfaces */
r1877r1878
537537            switch (offset & 0x80)
538538            {
539539               case 0x80:   /* Motherboard 8255 */
540                     ppi8255_0_w(offset & 0x03, data);
540                     ppi8255_0_w(machine, offset & 0x03, data);
541541                     /* PMD-85.3 memory banking */
542542                     if ((offset & 0x03) == 0x03)
543543                     {
r1877r1878
559559                     switch (offset & 0x80)
560560                     {
561561                        case 0x80:   /* ROM module 8255 */
562                              ppi8255_3_w(offset & 0x03, data);
562                              ppi8255_3_w(machine, offset & 0x03, data);
563563                              break;
564564                     }
565565                  }
r1877r1878
575575                        case 0x10:   /* 8251 (casette recorder, V24) */
576576                              switch (offset & 0x01)
577577                              {
578                                 case 0x00: msm8251_data_w(offset & 0x01, data); break;
579                                 case 0x01: msm8251_control_w(offset & 0x01, data); break;
578                                 case 0x00: msm8251_data_w(machine, offset & 0x01, data); break;
579                                 case 0x01: msm8251_control_w(machine, offset & 0x01, data); break;
580580                              }
581581                              break;
582582                        case 0x40:      /* 8255 (GPIO/0, GPIO/0) */
583                              ppi8255_1_w(offset & 0x03, data);
583                              ppi8255_1_w(machine, offset & 0x03, data);
584584                              break;
585585                        case 0x50:   /* 8253 */
586                              pit8253_0_w (offset & 0x03, data);
586                              pit8253_0_w(machine, offset & 0x03, data);
587587                              logerror ("8253 writing. Address: %02x, Data: %02x\n", offset, data);
588588                              break;
589589                        case 0x70:   /* 8255 (IMS-2) */
590                              ppi8255_2_w(offset & 0x03, data);
590                              ppi8255_2_w(machine, offset & 0x03, data);
591591                              break;
592592                     }
593593                     break;
r1877r1878
621621            switch (offset & 0x80)
622622            {
623623               case 0x80:   /* Motherboard 8255 */
624                     return ppi8255_0_r(offset & 0x03);
624                     return ppi8255_0_r(machine, offset & 0x03);
625625            }
626626            break;
627627   }
r1877r1878
644644            switch (offset & 0x80)
645645            {
646646               case 0x80:   /* Motherboard 8255 */
647                     ppi8255_0_w(offset & 0x03, data);
647                     ppi8255_0_w(machine, offset & 0x03, data);
648648                     break;
649649            }
650650            break;
r1877r1878
774774   return address;
775775}
776776
777static void pmd85_common_driver_init (void)
777static void pmd85_common_driver_init (running_machine *machine)
778778{
779779   memory_set_opbase_handler(0, pmd85_opbaseoverride);
780780
781781   pit8253_init(1, &pmd85_pit8253_interface);
782   pit8253_0_gate_w(0, 1);
783   pit8253_0_gate_w(1, 1);
784   pit8253_0_gate_w(2, 1);
782   pit8253_0_gate_w(machine, 0, 1);
783   pit8253_0_gate_w(machine, 1, 1);
784   pit8253_0_gate_w(machine, 2, 1);
785785
786786   msm8251_init(&pmd85_msm8251_interface);
787787
r1877r1878
799799   pmd85_model = PMD85_1;
800800   pmd85_update_memory = pmd851_update_memory;
801801   ppi8255_init(&pmd85_ppi8255_interface);
802   pmd85_common_driver_init();
802   pmd85_common_driver_init(machine);
803803}
804804
805805DRIVER_INIT ( pmd852a )
r1877r1878
807807   pmd85_model = PMD85_2A;
808808   pmd85_update_memory = pmd852a_update_memory;
809809   ppi8255_init(&pmd85_ppi8255_interface);
810   pmd85_common_driver_init();
810   pmd85_common_driver_init(machine);
811811}
812812
813813DRIVER_INIT ( pmd853 )
r1877r1878
815815   pmd85_model = PMD85_3;
816816   pmd85_update_memory = pmd853_update_memory;
817817   ppi8255_init(&pmd85_ppi8255_interface);
818   pmd85_common_driver_init();
818   pmd85_common_driver_init(machine);
819819}
820820
821821DRIVER_INIT ( alfa )
r1877r1878
823823   pmd85_model = ALFA;
824824   pmd85_update_memory = alfa_update_memory;
825825   ppi8255_init(&alfa_ppi8255_interface);
826   pmd85_common_driver_init();
826   pmd85_common_driver_init(machine);
827827}
828828
829829DRIVER_INIT ( mato )
src/mess/machine/spectrum.c
r1877r1878
792792   int i;
793793   unsigned char lo, hi, data;
794794   SPECTRUM_Z80_SNAPSHOT_TYPE z80_type;
795   running_machine *machine = Machine;
795796
796797   z80_type = spectrum_identify_z80(pSnapshot, SnapshotSize);
797798
r1877r1878
954955         /* Only set up sound registers for 128K machine or TS2068! */
955956         for (i = 0; i < 16; i++)
956957         {
957            AY8910_control_port_0_w(0, i);
958            AY8910_write_port_0_w(0, pSnapshot[39 + i]);
958            AY8910_control_port_0_w(machine, 0, i);
959            AY8910_write_port_0_w(machine, 0, pSnapshot[39 + i]);
959960         }
960         AY8910_control_port_0_w(0, pSnapshot[38]);
961         AY8910_control_port_0_w(machine, 0, pSnapshot[38]);
961962      }
962963
963964      pSource = pSnapshot + header_size;
src/mess/machine/kaypro.c
r1877r1878
167167   }
168168
169169   row = 9;
170   new = input_port_10_r(0);
170   new = readinputport(10);
171171   chg = keyrows[row] ^ new;
172172
173   if (!chg) { new = input_port_9_r(0); chg = keyrows[--row] ^ new; }
174   if (!chg) { new = input_port_8_r(0); chg = keyrows[--row] ^ new; }
175   if (!chg) { new = input_port_7_r(0); chg = keyrows[--row] ^ new; }
176   if (!chg) { new = input_port_6_r(0); chg = keyrows[--row] ^ new; }
177   if (!chg) { new = input_port_5_r(0); chg = keyrows[--row] ^ new; }
178   if (!chg) { new = input_port_4_r(0); chg = keyrows[--row] ^ new; }
179   if (!chg) { new = input_port_3_r(0); chg = keyrows[--row] ^ new; }
180   if (!chg) { new = input_port_2_r(0); chg = keyrows[--row] ^ new; }
181   if (!chg) { new = input_port_1_r(0); chg = keyrows[--row] ^ new; }
173   if (!chg) { new = readinputport(9); chg = keyrows[--row] ^ new; }
174   if (!chg) { new = readinputport(8); chg = keyrows[--row] ^ new; }
175   if (!chg) { new = readinputport(7); chg = keyrows[--row] ^ new; }
176   if (!chg) { new = readinputport(6); chg = keyrows[--row] ^ new; }
177   if (!chg) { new = readinputport(5); chg = keyrows[--row] ^ new; }
178   if (!chg) { new = readinputport(4); chg = keyrows[--row] ^ new; }
179   if (!chg) { new = readinputport(3); chg = keyrows[--row] ^ new; }
180   if (!chg) { new = readinputport(2); chg = keyrows[--row] ^ new; }
181   if (!chg) { new = readinputport(1); chg = keyrows[--row] ^ new; }
182182   if (!chg) --row;
183183
184184   if (row >= 0)
r1877r1878
222222         if( key )   /* normal key */
223223         {
224224            repeater = 30;
225            kaypro_conin_w(0, key);
225            kaypro_conin_w(machine, 0, key);
226226         }
227227         else
228228         if( (row == 0) && (chg == 0x04) ) /* Ctrl-@ (NUL) */
229            kaypro_conin_w(0, 0);
229            kaypro_conin_w(machine, 0, 0);
230230         keyrows[row] |= new;
231231      }
232232      else
r1877r1878
237237   }
238238   else if ( key && (keyrows[lastrow] & mask) && repeat == 0 )
239239   {
240      kaypro_conin_w(0, key);
240      kaypro_conin_w(machine, 0, key);
241241   }
242242}
243243
src/mess/machine/geneve.c
r1877r1878
372372{
373373   activecpu_adjust_icount(-8);      /* this is just a minimum, it can be more */
374374
375   return tms5220_status_r(offset);
375   return tms5220_status_r(machine, offset);
376376}
377377
378378#if 0
r1877r1878
415415   }
416416#endif
417417
418   tms5220_data_w(offset, data);
418   tms5220_data_w(machine, offset, data);
419419}
420420
421421READ8_HANDLER ( geneve_r )
r1877r1878
437437         {
438438         case 0xf100:
439439         case 0xf108:      /* mirror? */
440            return v9938_vram_r(0);
440            return v9938_vram_r(machine, 0);
441441
442442         case 0xf102:
443443         case 0xf10a:      /* mirror? */
444            return v9938_status_r(0);
444            return v9938_status_r(machine, 0);
445445
446446         case 0xf110:
447447         case 0xf111:
r1877r1878
537537            {
538538               if (offset & 2)
539539               {   /* read VDP status */
540                  return v9938_status_r(0);
540                  return v9938_status_r(machine, 0);
541541               }
542542               else
543543               {   /* read VDP RAM */
544                  return v9938_vram_r(0);
544                  return v9938_vram_r(machine, 0);
545545               }
546546            }
547547            return 0;
r1877r1878
550550            /* speech read */
551551            if ((! (offset & 1)) && has_speech)
552552            {
553               return geneve_speech_r(0);
553               return geneve_speech_r(machine, 0);
554554            }
555555            return 0;
556556
r1877r1878
645645#endif
646646   case 0xba:
647647      /* DSR space */
648      return geneve_peb_r(offset);
648      return geneve_peb_r(machine, offset);
649649
650650   case 0xbc:
651651      /* speech space */
652652      if (has_speech)
653653      {
654654         if ((offset >= 0x1000) && (offset < 0x1400) && (! (offset & 1)))
655            return geneve_speech_r(0);
655            return geneve_speech_r(machine, 0);
656656         else
657657            return 0;
658658      }
r1877r1878
681681         {
682682         case 0xf100:
683683         case 0xf108:      /* mirror? */
684            v9938_vram_w(0, data);
684            v9938_vram_w(machine, 0, data);
685685            return;
686686
687687         case 0xf102:
688688         case 0xf10a:      /* mirror? */
689            v9938_command_w(0, data);
689            v9938_command_w(machine, 0, data);
690690            return;
691691
692692         case 0xf104:
693693         case 0xf10c:      /* mirror? */
694            v9938_palette_w(0, data);
694            v9938_palette_w(machine, 0, data);
695695            return;
696696
697697         case 0xf106:
698698         case 0xf10e:      /* mirror? */
699            v9938_register_w(0, data);
699            v9938_register_w(machine, 0, data);
700700            return;
701701
702702         case 0xf110:
r1877r1878
715715            return*/
716716
717717         case 0xf120:
718            SN76496_0_w(0, data);
718            SN76496_0_w(machine, 0, data);
719719            break;
720720
721721         case 0xf130:
r1877r1878
799799         {
800800         case 1:
801801            /* sound write */
802            SN76496_0_w(0, data);
802            SN76496_0_w(machine, 0, data);
803803            return;
804804
805805         case 3:
r1877r1878
811811               {
812812               case 0:
813813                  /* write VDP RAM */
814                  v9938_vram_w(0, data);
814                  v9938_vram_w(machine, 0, data);
815815                  break;
816816               case 1:
817817                  /* write VDP address */
818                  v9938_command_w(0, data);
818                  v9938_command_w(machine, 0, data);
819819                  break;
820820               case 2:
821821                  /* write palette */
822                  v9938_palette_w(0, data);
822                  v9938_palette_w(machine, 0, data);
823823                  break;
824824               case 3:
825825                  /* write register */
826                  v9938_register_w(0, data);
826                  v9938_register_w(machine, 0, data);
827827                  break;
828828               }
829829            }
r1877r1878
833833            /* speech write */
834834            if ((! (offset & 1)) && has_speech)
835835            {
836               geneve_speech_w(0, data);
836               geneve_speech_w(machine, 0, data);
837837            }
838838            return;
839839
r1877r1878
937937#endif
938938   case 0xba:
939939      /* DSR space */
940      geneve_peb_w(offset, data);
940      geneve_peb_w(machine, offset, data);
941941      return;
942942
943943   case 0xbc:
r1877r1878
945945      if (has_speech)
946946      {
947947         if ((offset >= 0x1400) && (offset < 0x1800) && (! (offset & 1)))
948            geneve_speech_w(0, data);
948            geneve_speech_w(machine, 0, data);
949949         return;
950950      }
951951
r1877r1878
10061006      }
10071007   }
10081008
1009   geneve_peb_cru_w(offset, data);
1009   geneve_peb_cru_w(machine, offset, data);
10101010}
10111011
10121012/*===========================================================================*/
src/mess/machine/c128.c
r1877r1878
5858static int c128_ram_bottom, c128_ram_top;
5959static UINT8 *c128_ram;
6060
61static void c128_set_m8502_read_handler(UINT16 start, UINT16 end, read8_handler rh)
61static void c128_set_m8502_read_handler(running_machine *machine, UINT16 start, UINT16 end, read8_machine_func rh)
6262{
6363   int cpunum;
64   cpunum = mame_find_cpu_index(Machine, "m8502");
64   cpunum = mame_find_cpu_index(machine, "m8502");
6565   memory_install_read8_handler(cpunum, ADDRESS_SPACE_PROGRAM, start, end, 0, 0, rh);
6666}
6767
r1877r1878
102102      switch ((offset&0xf00)>>8)
103103      {
104104      case 0:case 1: case 2: case 3:
105         vic2_port_w (offset & 0x3ff, data);
105         vic2_port_w (machine, offset & 0x3ff, data);
106106         break;
107107      case 4:
108         sid6581_0_port_w (offset & 0x3f, data);
108         sid6581_0_port_w (machine, offset & 0x3f, data);
109109         break;
110110      case 5:
111         c128_mmu8722_port_w (offset & 0xff, data);
111         c128_mmu8722_port_w (machine, offset & 0xff, data);
112112         break;
113113      case 6:case 7:
114         vdc8563_port_w (offset & 0xff, data);
114         vdc8563_port_w (machine, offset & 0xff, data);
115115         break;
116116      case 8: case 9: case 0xa: case 0xb:
117117          if (c64mode)
r1877r1878
120120            c64_colorram[(offset & 0x3ff)|((c64_port6510&3)<<10)] = data | 0xf0; // maybe all 8 bit connected!
121121          break;
122122      case 0xc:
123         cia_0_w(offset, data);
123         cia_0_w(machine, offset, data);
124124         break;
125125      case 0xd:
126         cia_1_w(offset, data);
126         cia_1_w(machine, offset, data);
127127         break;
128128      case 0xf:
129         c128_dma8726_port_w(offset&0xff,data);
129         c128_dma8726_port_w(machine, offset&0xff,data);
130130         break;
131131      case 0xe:
132132         DBG_LOG (1, "io write", ("%.3x %.2x\n", offset, data));
r1877r1878
137137
138138
139139
140static READ8_HANDLER( c128_read_io )
140static READ8_HANDLER( c128_read_io )
141141{
142142   switch ((offset&0xf00)>>8) {
143143   case 0:case 1: case 2: case 3:
144      return vic2_port_r (offset & 0x3ff);
144      return vic2_port_r (machine, offset & 0x3ff);
145145   case 4:
146      return sid6581_0_port_r (offset & 0xff);
146      return sid6581_0_port_r (machine, offset & 0xff);
147147   case 5:
148      return c128_mmu8722_port_r (offset & 0xff);
148      return c128_mmu8722_port_r (machine, offset & 0xff);
149149   case 6:case 7:
150      return vdc8563_port_r (offset & 0xff);
150      return vdc8563_port_r (machine, offset & 0xff);
151151   case 8: case 9: case 0xa: case 0xb:
152152      return c64_colorram[offset & 0x3ff];
153153   case 0xc:
154      return cia_0_r(offset);
154      return cia_0_r(machine, offset);
155155   case 0xd:
156      return cia_1_r(offset);
156      return cia_1_r(machine, offset);
157157   case 0xf:
158      return c128_dma8726_port_r(offset&0xff);
158      return c128_dma8726_port_r(machine, offset&0xff);
159159   case 0xe:default:
160160      DBG_LOG (1, "io read", ("%.3x\n", offset));
161161      return 0xff;
r1877r1878
166166{
167167   static int old, exrom, game;
168168   int data, loram, hiram, charen;
169   read8_handler rh;
169   read8_machine_func rh;
170170
171171   if (!c64mode)
172172      return;
r1877r1878
219219      else
220220         memory_set_bankptr(13, c64_memory + 0xd000);
221221   }
222   c128_set_m8502_read_handler(0xd000, 0xdfff, rh);
222   c128_set_m8502_read_handler(Machine, 0xd000, 0xdfff, rh);
223223
224224   if (!c64_game && c64_exrom)
225225   {
r1877r1878
336336
337337static void c128_bankswitch_128 (int reset)
338338{
339   read8_handler rh;
339   read8_machine_func rh;
340340
341341   c64mode = MMU_64MODE;
342342   if (c64mode)
r1877r1878
415415      else
416416         c128_ram_top = 0x10000;
417417
418      c128_set_m8502_read_handler(0xff00, 0xff04, c128_mmu8722_ff00_r);
418      c128_set_m8502_read_handler(Machine, 0xff00, 0xff04, c128_mmu8722_ff00_r);
419419
420420      if (MMU_IO_ON)
421421      {
r1877r1878
427427         c128_write_io = 0;
428428         rh = MRA8_BANK13;
429429      }
430      c128_set_m8502_read_handler(0xd000, 0xdfff, rh);
430      c128_set_m8502_read_handler(Machine, 0xd000, 0xdfff, rh);
431431
432432      if (MMU_RAM_HI)
433433      {
r1877r1878
707707WRITE8_HANDLER( c128_write_ff00 )
708708{
709709   if (!c64mode)
710      c128_mmu8722_ff00_w (offset, data);
710      c128_mmu8722_ff00_w (machine, offset, data);
711711   else if (c128_ram!=NULL)
712712      c64_memory[0xff00 + offset] = data;
713713}
src/mess/machine/i82439tx.c
r1877r1878
102102
103103
104104
105static void intel82439tx_configure_memory(UINT8 val, offs_t begin, offs_t end, int read_bank, write32_handler wh)
105static void intel82439tx_configure_memory(UINT8 val, offs_t begin, offs_t end, int read_bank, write32_machine_func wh)
106106{
107107   memory_install_read_handler(0, ADDRESS_SPACE_PROGRAM, begin, end, 0, 0, read_bank);
108108   if (val & 0x01)
src/mess/machine/lviv.c
r1877r1878
143143      switch ((offset >> 4) & 0x3)
144144      {
145145      case 0:
146         return ppi8255_0_r(offset & 3);
146         return ppi8255_0_r(machine, offset & 3);
147147         break;
148148
149149      case 1:
150         return ppi8255_1_r(offset & 3);
150         return ppi8255_1_r(machine, offset & 3);
151151         break;
152152
153153      case 2:
r1877r1878
180180      switch ((offset >> 4) & 0x3)
181181      {
182182      case 0:
183         ppi8255_0_w(offset & 3, data);
183         ppi8255_0_w(machine, offset & 3, data);
184184         break;
185185
186186      case 1:
187         ppi8255_1_w(offset & 3, data);
187         ppi8255_1_w(machine, offset & 3, data);
188188         break;
189189
190190      case 2:
src/mess/machine/pc8801.c
r1877r1878
181181WRITE8_HANDLER(pc88sr_outport_30)
182182{
183183  /* bit 1-5 not implemented yet */
184  pc88sr_disp_30(offset,data);
184  pc88sr_disp_30(machine, offset,data);
185185}
186186
187187WRITE8_HANDLER(pc88sr_outport_40)
r1877r1878
194194  if((port_save&0x04) == 0x00 && (data&0x04) != 0x00) calender_shift();
195195  port_save=data;
196196
197  if((input_port_17_r(0)&0x40)==0x00) {
197  if((readinputport(17)&0x40)==0x00) {
198198    data&=0x7f;
199199  }
200200  switch(data&0xa0) {
r1877r1878
241241  int r;
242242
243243  /* read DIP-SW */
244  r=input_port_17_r(0)<<1;
244  r=readinputport(17)<<1;
245245  /* change bit 0 according BASIC mode */
246246  if(is_Nbasic) {
247247    r&=0xfe;
r1877r1878
268268  int r;
269269
270270  /* read DIP-SW */
271  r=input_port_18_r(0)<<1;
271  r=readinputport(18)<<1;
272272  /* change bit 6 according speed switch */
273273  if(pc88sr_is_highspeed) {
274274    r|=0x40;
r1877r1878
487487  RAMmode=((data&0x02)!=0);
488488  ROMmode=((data&0x04)!=0);
489489  pc8801_update_bank();
490  pc88sr_disp_31(offset,data);
490  pc88sr_disp_31(machine, offset,data);
491491}
492492
493493 READ8_HANDLER(pc88sr_inport_32)
r1877r1878
503503  no4throm2=(data&3);
504504  enable_FM_IRQ=((data & 0x80) == 0x00);
505505  if(FM_IRQ_save && enable_FM_IRQ) pc8801_raise_interrupt(FM_IRQ_LEVEL);
506  pc88sr_disp_32(offset,data);
506  pc88sr_disp_32(machine, offset,data);
507507  pc8801_update_bank();
508508}
509509
r1877r1878
572572   pc8801_update_bank();
573573   pc8801_video_init(hireso);
574574
575  if(extmem_mode!=input_port_19_r(0)) {
576    extmem_mode=input_port_19_r(0);
575  if(extmem_mode!=readinputport(19)) {
576    extmem_mode=readinputport(19);
577577    if(extRAM!=NULL) {
578578      free(extRAM);
579579      extRAM=NULL;
r1877r1878
695695{
696696  int a;
697697
698  a=input_port_16_r(0);
698  a=readinputport(16);
699699  is_Nbasic = ((a&0x01)==0x00);
700700  is_V2mode = ((a&0x02)==0x00);
701701  pc88sr_is_highspeed = ((a&0x04)!=0x00);
r1877r1878
810810
811811static void pc8801_init_5fd(void)
812812{
813   use_5FD = (input_port_18_r(0)&0x80)!=0x00;
813   use_5FD = (readinputport(18)&0x80)!=0x00;
814814   ppi8255_init(&pc8801_8255_config);
815815   if (!use_5FD)
816816      cpunum_suspend(1, SUSPEND_REASON_DISABLE, 1);
src/mess/machine/pet.c
r1877r1878
3131UINT8 *pet_videoram;
3232static UINT8 *pet80_bank1_base;
3333
34static READ8_HANDLER( pet_mc6845_register_r )
35{
36   device_config *devconf = (device_config *) device_list_find_by_tag(machine->config->devicelist, MC6845, "crtc");
37   return mc6845_register_r(devconf, offset);
38}
39
40static WRITE8_HANDLER( pet_mc6845_register_w )
41{
42   device_config *devconf = (device_config *) device_list_find_by_tag(machine->config->devicelist, MC6845, "crtc");
43   mc6845_register_w(devconf, offset, data);
44}
45
46static WRITE8_HANDLER( pet_mc6845_address_w )
47{
48   device_config *devconf = (device_config *) device_list_find_by_tag(machine->config->devicelist, MC6845, "crtc");
49   mc6845_address_w(devconf, offset, data);
50}
51
3452/* pia at 0xe810
3553   port a
3654    7 sense input (low for diagnostics)
r1877r1878
249267static WRITE8_HANDLER(cbm8096_io_w)
250268{
251269   if (offset<0x10) ;
252   else if (offset<0x14) pia_0_w(offset&3,data);
270   else if (offset<0x14) pia_0_w(machine, offset&3,data);
253271   else if (offset<0x20) ;
254   else if (offset<0x24) pia_1_w(offset&3,data);
272   else if (offset<0x24) pia_1_w(machine, offset&3,data);
255273   else if (offset<0x40) ;
256   else if (offset<0x50) via_0_w(offset&0xf,data);
274   else if (offset<0x50) via_0_w(machine, offset&0xf,data);
257275   else if (offset<0x80) ;
258   else if (offset == 0x80) pet_mc6845_address_w(offset, data);
259   else if (offset == 0x81) pet_mc6845_register_w(offset, data);
276   else if (offset == 0x80) pet_mc6845_address_w(machine, offset, data);
277   else if (offset == 0x81) pet_mc6845_register_w(machine, offset, data);
260278}
261279
262static READ8_HANDLER(cbm8096_io_r)
280static READ8_HANDLER(cbm8096_io_r)
263281{
264282   int data=0xff;
265283   if (offset<0x10) ;
266   else if (offset<0x14) data=pia_0_r(offset&3);
284   else if (offset<0x14) data=pia_0_r(machine, offset&3);
267285   else if (offset<0x20) ;
268   else if (offset<0x24) data=pia_1_r(offset&3);
286   else if (offset<0x24) data=pia_1_r(machine, offset&3);
269287   else if (offset<0x40) ;
270   else if (offset<0x50) data=via_0_r(offset&0xf);
288   else if (offset<0x50) data=via_0_r(machine, offset&0xf);
271289   else if (offset<0x80) ;
272   else if (offset == 0x81) data=pet_mc6845_register_r(offset);
290   else if (offset == 0x81) data=pet_mc6845_register_r(machine, offset);
273291   return data;
274292}
275293
r1877r1878
290308*/
291309WRITE8_HANDLER(cbm8096_w)
292310{
293   read8_handler rh;
294   write8_handler wh;
311   read8_machine_func rh;
312   write8_machine_func wh;
295313
296314   if (data&0x80)
297315   {
r1877r1878
434452{
435453   static int level=0;
436454
437   pia_0_cb1_w(0,level);
455   pia_0_cb1_w(machine, 0,level);
438456   level=!level;
439457}
440458
r1877r1878
558576      {
559577         memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xfff0, 0xfff0, 0, 0, MWA8_NOP);
560578      }
561      cbm8096_w(0,0);
579      cbm8096_w(machine, 0, 0);
562580   }
563581
564582   cbm_drive_0_config (IEEE8ON ? IEEE : 0, 8);
src/mess/machine/c16.c
r1877r1878
381381   }
382382}
383383
384static void c16_common_driver_init (void)
384static void c16_common_driver_init (running_machine *machine)
385385{
386386#ifdef VC1541
387387   VC1541_CONFIG vc1541= { 1, 8 };
r1877r1878
392392   cpunum_set_info_fct(0, CPUINFO_PTR_M6510_PORTREAD, (genf *) c16_m7501_port_read);
393393   cpunum_set_info_fct(0, CPUINFO_PTR_M6510_PORTWRITE, (genf *) c16_m7501_port_write);
394394
395   c16_select_roms (0, 0);
396   c16_switch_to_rom (0, 0);
395   c16_select_roms (machine, 0, 0);
396   c16_switch_to_rom (machine, 0, 0);
397397
398398   if (REAL_C1551) {
399399      tpi6525[2].a.read=c1551x_0_read_data;
r1877r1878
441441#endif
442442}
443443
444void c16_driver_init(void)
444void c16_driver_init(running_machine *machine)
445445{
446   c16_common_driver_init ();
446   c16_common_driver_init (machine);
447447   ted7360_init (C16_PAL);
448448   ted7360_set_dma (ted7360_dma_read, ted7360_dma_read_rom);
449449}
r1877r1878
454454   mess_ram[(0x5400 + offset) % mess_ram_size] = data;
455455   mess_ram[(0x9400 + offset) % mess_ram_size] = data;
456456   mess_ram[(0xd400 + offset) % mess_ram_size] = data;
457   sid6581_0_port_w(offset,data);
457   sid6581_0_port_w(machine, offset,data);
458458}
459459
460460static WRITE8_HANDLER(c16_sidcart_64k)
461461{
462462   mess_ram[(0xd400 + offset) % mess_ram_size] = data;
463   sid6581_0_port_w(offset,data);
463   sid6581_0_port_w(machine, offset,data);
464464}
465465
466466MACHINE_RESET( c16 )
src/mess/machine/oric.c
r1877r1878
172172      /* if psg is in read register state return reg data */
173173      if (oric_psg_control==0x01)
174174      {
175         return AY8910_read_port_0_r(0);
175         return AY8910_read_port_0_r(machine, 0);
176176      }
177177
178178      /* return high-impedance */
r1877r1878
199199/* read/write data depending on state of bdir, bc1 pins and data output to psg */
200200static void oric_psg_connection_refresh(void)
201201{
202   running_machine *machine = Machine;
203
202204   if (oric_psg_control!=0)
203205   {
204206      switch (oric_psg_control)
r1877r1878
209211         /* read register data */
210212         case 1:
211213         {
212            //oric_via_port_a_data = AY8910_read_port_0_r(0);
214            //oric_via_port_a_data = AY8910_read_port_0_r(machine, 0);
213215         }
214216         break;
215217         /* write register data */
216218         case 2:
217219         {
218            AY8910_write_port_0_w (0, oric_via_port_a_data);
220            AY8910_write_port_0_w(machine, 0, oric_via_port_a_data);
219221         }
220222         break;
221223         /* write register index */
222224         case 3:
223225         {
224            AY8910_control_port_0_w (0, oric_via_port_a_data);
226            AY8910_control_port_0_w(machine, 0, oric_via_port_a_data);
225227         }
226228         break;
227229
r1877r1878
593595   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0310, 0x031f, 0, 0, applefdc_w);
594596   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0380, 0x0383, 0, 0, apple2_v2_interface_w);
595597
596   apple2_v2_interface_w(0,0);
598   apple2_v2_interface_w(Machine, 0, 0);
597599}
598600
599601/********************/
r1877r1878
722724   {
723725      /* jasmin floppy disc interface */
724726      case 0x04:
725         data = wd17xx_status_r(0);
727         data = wd17xx_status_r(machine, 0);
726728         break;
727729      case 0x05:
728         data =wd17xx_track_r(0);
730         data =wd17xx_track_r(machine, 0);
729731         break;
730732      case 0x06:
731         data = wd17xx_sector_r(0);
733         data = wd17xx_sector_r(machine, 0);
732734         break;
733735      case 0x07:
734         data = wd17xx_data_r(0);
736         data = wd17xx_data_r(machine, 0);
735737         break;
736738      default:
737         data = via_0_r(offset & 0x0f);
739         data = via_0_r(machine, offset & 0x0f);
738740         logerror("unhandled io read: %04x %02x\n", offset, data);
739741         break;
740742
r1877r1878
749751   {
750752      /* microdisc floppy disc interface */
751753      case 0x04:
752         wd17xx_command_w(0,data);
754         wd17xx_command_w(machine, 0, data);
753755         break;
754756      case 0x05:
755         wd17xx_track_w(0,data);
757         wd17xx_track_w(machine, 0, data);
756758         break;
757759      case 0x06:
758         wd17xx_sector_w(0,data);
760         wd17xx_sector_w(machine, 0, data);
759761         break;
760762      case 0x07:
761         wd17xx_data_w(0,data);
763         wd17xx_data_w(machine, 0, data);
762764         break;
763765      /* bit 0 = side */
764766      case 0x08:
r1877r1878
787789         break;
788790
789791      default:
790         via_0_w(offset & 0x0f, data);
792         via_0_w(machine, offset & 0x0f, data);
791793         break;
792794   }
793795}
r1877r1878
954956   {
955957      /* microdisc floppy disc interface */
956958      case 0x00:
957         data = wd17xx_status_r(0);
959         data = wd17xx_status_r(machine, 0);
958960         break;
959961      case 0x01:
960         data =wd17xx_track_r(0);
962         data =wd17xx_track_r(machine, 0);
961963         break;
962964      case 0x02:
963         data = wd17xx_sector_r(0);
965         data = wd17xx_sector_r(machine, 0);
964966         break;
965967      case 0x03:
966         data = wd17xx_data_r(0);
968         data = wd17xx_data_r(machine, 0);
967969         break;
968970      case 0x04:
969971         data = port_314_r | 0x07f;
r1877r1878
975977         break;
976978
977979      default:
978         data = via_0_r(offset & 0x0f);
980         data = via_0_r(machine, offset & 0x0f);
979981         break;
980982
981983   }
r1877r1878
989991   {
990992      /* microdisc floppy disc interface */
991993      case 0x00:
992         wd17xx_command_w(0,data);
994         wd17xx_command_w(machine, 0, data);
993995         break;
994996      case 0x01:
995         wd17xx_track_w(0,data);
997         wd17xx_track_w(machine, 0, data);
996998         break;
997999      case 0x02:
998         wd17xx_sector_w(0,data);
1000         wd17xx_sector_w(machine, 0, data);
9991001         break;
10001002      case 0x03:
1001         wd17xx_data_w(0,data);
1003         wd17xx_data_w(machine, 0, data);
10021004         break;
10031005      case 0x04:
10041006      {
r1877r1878
10311033      break;
10321034
10331035      default:
1034         via_0_w(offset & 0x0f, data);
1036         via_0_w(machine, offset & 0x0f, data);
10351037         break;
10361038   }
10371039}
r1877r1878
12281230      }
12291231   }
12301232   /* it is repeated */
1231   return via_0_r(offset & 0x0f);
1233   return via_0_r(machine, offset & 0x0f);
12321234}
12331235
12341236WRITE8_HANDLER ( oric_IO_w )
r1877r1878
12671269      logerror("via 0 w: %04x %02x %04x\n",offset,data,(unsigned) cpunum_get_reg(0, REG_PC));
12681270   }
12691271
1270   via_0_w(offset & 0x0f,data);
1272   via_0_w(machine, offset & 0x0f,data);
12711273}
12721274
12731275
r1877r1878
13441346
13451347static void   telestrat_refresh_mem(void)
13461348{
1347   read8_handler rh;
1348   write8_handler wh;
1349   read8_machine_func rh;
1350   write8_machine_func wh;
13491351
13501352   struct telestrat_mem_block *mem_block = &telestrat_blocks[telestrat_bank_selection];
13511353
src/mess/machine/europc.c
r1877r1878
123123      }
124124      break;
125125   case 0xa:
126      europc_rtc_w(0, data);
126      europc_rtc_w(machine, 0, data);
127127      return;
128128   }
129129   logerror("jim write %.2x %.2x\n",offset,data);
130130   europc_jim.data[offset]=data;
131131}
132132
133extern  READ8_HANDLER ( europc_jim_r )
133READ8_HANDLER ( europc_jim_r )
134134{
135135   int data=0;
136136   switch(offset) {
137137   case 4: case 5: case 6: case 7: data=europc_jim.data[offset];break;
138138   case 0: case 1: case 2: case 3: data=0;break;
139   case 0xa: return europc_rtc_r(0);
139   case 0xa: return europc_rtc_r(machine, 0);
140140   }
141141   return data;
142142}
src/mess/machine/mc10.c
r1877r1878
6969
7070   int val = 0x40;
7171
72   if ((input_port_0_r(0) | mc10_keyboard_strobe) == 0xff)
72   if ((readinputport(0) | mc10_keyboard_strobe) == 0xff)
7373      val |= 0x01;
74   if ((input_port_1_r(0) | mc10_keyboard_strobe) == 0xff)
74   if ((readinputport(1) | mc10_keyboard_strobe) == 0xff)
7575      val |= 0x02;
76   if ((input_port_2_r(0) | mc10_keyboard_strobe) == 0xff)
76   if ((readinputport(2) | mc10_keyboard_strobe) == 0xff)
7777      val |= 0x04;
78   if ((input_port_3_r(0) | mc10_keyboard_strobe) == 0xff)
78   if ((readinputport(3) | mc10_keyboard_strobe) == 0xff)
7979      val |= 0x08;
80   if ((input_port_4_r(0) | mc10_keyboard_strobe) == 0xff)
80   if ((readinputport(4) | mc10_keyboard_strobe) == 0xff)
8181      val |= 0x10;
82   if ((input_port_5_r(0) | mc10_keyboard_strobe) == 0xff)
82   if ((readinputport(5) | mc10_keyboard_strobe) == 0xff)
8383      val |= 0x20;
8484
8585   return val;
r1877r1878
138138   mess_image *img = image_from_devtype_and_index(IO_CASSETTE, 0);
139139   int val = 0xed;
140140
141   if ((input_port_6_r(0) | mc10_keyboard_strobe) == 0xff)
141   if ((readinputport(6) | mc10_keyboard_strobe) == 0xff)
142142      val |= 0x02;
143143
144144   if (cassette_input(img) >= 0)
src/mess/machine/atom.c
r1877r1878
428428      case 2:
429429      case 3:
430430         /* 8271 registers */
431         return i8271_r(offset);
431         return i8271_r(machine, offset);
432432      case 4:
433         return i8271_data_r(offset);
433         return i8271_data_r(machine, offset);
434434      default:
435435         break;
436436   }
r1877r1878
447447      case 2:
448448      case 3:
449449         /* 8271 registers */
450         i8271_w(offset, data);
450         i8271_w(machine, offset, data);
451451         return;
452452      case 4:
453         i8271_data_w(offset, data);
453         i8271_data_w(machine, offset, data);
454454         return;
455455      default:
456456         break;
src/mess/machine/coleco.c
r1877r1878
4040      {
4141         int inport0,inport1,inport6,data;
4242
43         inport0 = input_port_0_r(0);
44         inport1 = input_port_1_r(0);
45         inport6 = input_port_6_r(0);
43         inport0 = readinputport(0);
44         inport1 = readinputport(1);
45         inport6 = readinputport(6);
4646
4747         /* Numeric pad buttons are not independent on a real ColecoVision, if you push more
4848         than one, a real ColecoVision think that it is a third button, so we are going to emulate
r1877r1878
6969      /* Joystick and fire 2 (SAC Red Button) */
7070      else
7171      {
72         int data = input_port_2_r(0) & 0xCF;
73         int inport6 = input_port_6_r(0);
72         int data = readinputport(2) & 0xCF;
73         int inport6 = readinputport(6);
7474
7575         if (inport6&0x07) /* If Extra Contollers enabled */
7676         {
r1877r1878
8888      {
8989         int inport3,inport4,data;
9090
91         inport3 = input_port_3_r(0);
92         inport4 = input_port_4_r(0);
91         inport3 = readinputport(3);
92         inport4 = readinputport(4);
9393
9494         /* Numeric pad buttons are not independent on a real ColecoVision, if you push more
9595         than one, a real ColecoVision think that it is a third button, so we are going to emulate
r1877r1878
114114      /* Joystick and fire 2*/
115115      else
116116      {
117         int data = input_port_5_r(0) & 0xCF;
118         int inport6 = input_port_6_r(0);
117         int data = readinputport(5) & 0xCF;
118         int inport6 = readinputport(6);
119119
120120         if (inport6&0x02) /* If Roller Controller enabled */
121121         {
src/mess/machine/at.c
r1877r1878
9292
9393
9494
95static void at_map_vga_memory(offs_t begin, offs_t end, read8_handler rh, write8_handler wh)
95static void at_map_vga_memory(offs_t begin, offs_t end, read8_machine_func rh, write8_machine_func wh)
9696{
9797   int buswidth;
9898   buswidth = cputype_databus_width(Machine->config->cpu[0].type, ADDRESS_SPACE_PROGRAM);
src/mess/machine/99_usbsm.c
r1877r1878
3333
3434
3535/* prototypes */
36static int usbsm_cru_r(int offset);
37static void usbsm_cru_w(int offset, int data);
36static int usbsm_cru_r(running_machine *machine, int offset);
37static void usbsm_cru_w(running_machine *machine, int offset, int data);
3838static  READ8_HANDLER(usbsm_mem_r);
3939static WRITE8_HANDLER(usbsm_mem_w);
4040static UINT16 usbsm_mem_16_r(offs_t offset);
r1877r1878
100100/*
101101   Read USB-SmartMedia CRU interface
102102*/
103static int usbsm_cru_r(int offset)
103static int usbsm_cru_r(running_machine *machine, int offset)
104104{
105105   int reply = 0;
106106
r1877r1878
138138/*
139139   Write USB-SmartMedia CRU interface
140140*/
141static void usbsm_cru_w(int offset, int data)
141static void usbsm_cru_w(running_machine *machine, int offset, int data)
142142{
143143   offset &= 31;
144144
src/mess/machine/vc20.c
r1877r1878
574574      cbm_drive_1_config (SERIAL, 9);
575575   }
576576   via_reset ();
577   via_0_ca1_w (0, vc20_via0_read_ca1(0) );
577   via_0_ca1_w(machine, 0, vc20_via0_read_ca1(machine, 0) );
578578}
579579
580580static int vc20_rom_id(mess_image *image)
r1877r1878
713713
714714INTERRUPT_GEN( vc20_frame_interrupt )
715715{
716   via_0_ca1_w (0, vc20_via0_read_ca1 (0));
716   via_0_ca1_w(machine, 0, vc20_via0_read_ca1 (machine, 0));
717717   keyboard[0] = readinputportbytag( TAG_KEYBOARD_ROW0 );
718718   keyboard[1] = readinputportbytag( TAG_KEYBOARD_ROW1 );
719719   keyboard[2] = readinputportbytag( TAG_KEYBOARD_ROW2 );
src/mess/machine/pc_fdc.c
r1877r1878
1111
1212**********************************************************************/
1313
14#include "driver.h"
15#include "deprecat.h"
1416#include "machine/pc_fdc.h"
1517#include "machine/nec765.h"
1618#include "memconv.h"
r1877r1878
160162   /* if dma is not enabled, dacks are not acknowledged */
161163   if ((fdc->digital_output_register & PC_FDC_FLAGS_DOR_DMA_ENABLED)!=0)
162164   {
163      data = nec765_dack_r(0);
165      data = nec765_dack_r(Machine, 0);
164166   }
165167
166168   return data;
r1877r1878
174176   if ((fdc->digital_output_register & PC_FDC_FLAGS_DOR_DMA_ENABLED)!=0)
175177   {
176178      /* dma acknowledge - and send byte to fdc */
177      nec765_dack_w(0,data);
179      nec765_dack_w(Machine, 0,data);
178180   }
179181}
180182
r1877r1878
324326      case 3: /* tape drive select? */
325327         break;
326328      case 4:
327         data = nec765_status_r(0);
329         data = nec765_status_r(machine, 0);
328330         break;
329331      case 5:
330         data = nec765_data_r(offset);
332         data = nec765_data_r(machine, offset);
331333         break;
332334      case 6: /* FDC reserved */
333335         break;
r1877r1878
363365         pc_fdc_data_rate_w(data);
364366         break;
365367      case 5:
366         nec765_data_w(0, data);
368         nec765_data_w(machine, 0, data);
367369         break;
368370      case 6:
369371         /* FDC reserved */
r1877r1878
382384   }
383385}
384386
385READ16_HANDLER( pc16le_fdc_r ) { return read16le_with_read8_handler(pc_fdc_r, offset, mem_mask); }
386WRITE16_HANDLER( pc16le_fdc_w ) { write16le_with_write8_handler(pc_fdc_w, offset, data, mem_mask); }
387READ16_HANDLER( pc16le_fdc_r ) { return read16le_with_read8_handler(pc_fdc_r, machine, offset, mem_mask); }
388WRITE16_HANDLER( pc16le_fdc_w ) { write16le_with_write8_handler(pc_fdc_w, machine, offset, data, mem_mask); }
387389
388READ32_HANDLER( pc32le_fdc_r ) { return read32le_with_read8_handler(pc_fdc_r, offset, mem_mask); }
389WRITE32_HANDLER( pc32le_fdc_w ) { write32le_with_write8_handler(pc_fdc_w, offset, data, mem_mask); }
390READ32_HANDLER( pc32le_fdc_r ) { return read32le_with_read8_handler(pc_fdc_r, machine, offset, mem_mask); }
391WRITE32_HANDLER( pc32le_fdc_w ) { write32le_with_write8_handler(pc_fdc_w, machine, offset, data, mem_mask); }
390392
391READ64_HANDLER( pc64be_fdc_r ) { return read64be_with_read8_handler(pc_fdc_r, offset, mem_mask); }
392WRITE64_HANDLER( pc64be_fdc_w ) { write64be_with_write8_handler(pc_fdc_w, offset, data, mem_mask); }
393READ64_HANDLER( pc64be_fdc_r ) { return read64be_with_read8_handler(pc_fdc_r, machine, offset, mem_mask); }
394WRITE64_HANDLER( pc64be_fdc_w ) { write64be_with_write8_handler(pc_fdc_w,machine,  offset, data, mem_mask); }
393395
src/mess/machine/pc_hdc.c
r1877r1878
719719static UINT8 pc_HDC_r(int chip, offs_t offs)
720720{
721721   UINT8 data = 0xff;
722   if( !(input_port_3_r(0) & (0x08>>chip)) || !pc_hdc_file(chip<<1) )
722   if( !(readinputport(3) & (0x08>>chip)) || !pc_hdc_file(chip<<1) )
723723      return data;
724724   switch( offs )
725725   {
r1877r1878
742742   if (LOG_HDC_CALL)
743743      logerror("pc_HDC_w(): chip=%d offs=%d data=0x%02x\n", chip, offs, data);
744744
745   if( !(input_port_3_r(0) & (0x08>>chip)) || !pc_hdc_file(chip<<1) )
745   if( !(readinputport(3) & (0x08>>chip)) || !pc_hdc_file(chip<<1) )
746746      return;
747747
748748   switch( offs )
r1877r1878
766766WRITE8_HANDLER ( pc_HDC1_w ) { pc_HDC_w(0, offset, data); }
767767WRITE8_HANDLER ( pc_HDC2_w ) { pc_HDC_w(1, offset, data); }
768768
769READ16_HANDLER ( pc16le_HDC1_r ) { return read16le_with_read8_handler(pc_HDC1_r, offset, mem_mask); }
770READ16_HANDLER ( pc16le_HDC2_r ) { return read16le_with_read8_handler(pc_HDC2_r, offset, mem_mask); }
771WRITE16_HANDLER ( pc16le_HDC1_w ) { write16le_with_write8_handler(pc_HDC1_w, offset, data, mem_mask); }
772WRITE16_HANDLER ( pc16le_HDC2_w ) { write16le_with_write8_handler(pc_HDC2_w, offset, data, mem_mask); }
769READ16_HANDLER ( pc16le_HDC1_r ) { return read16le_with_read8_handler(pc_HDC1_r, machine, offset, mem_mask); }
770READ16_HANDLER ( pc16le_HDC2_r ) { return read16le_with_read8_handler(pc_HDC2_r, machine, offset, mem_mask); }
771WRITE16_HANDLER ( pc16le_HDC1_w ) { write16le_with_write8_handler(pc_HDC1_w, machine, offset, data, mem_mask); }
772WRITE16_HANDLER ( pc16le_HDC2_w ) { write16le_with_write8_handler(pc_HDC2_w, machine, offset, data, mem_mask); }
773773
774READ32_HANDLER ( pc32le_HDC1_r ) { return read32le_with_read8_handler(pc_HDC1_r, offset, mem_mask); }
775READ32_HANDLER ( pc32le_HDC2_r ) { return read32le_with_read8_handler(pc_HDC2_r, offset, mem_mask); }
776WRITE32_HANDLER ( pc32le_HDC1_w ) { write32le_with_write8_handler(pc_HDC1_w, offset, data, mem_mask); }
777WRITE32_HANDLER ( pc32le_HDC2_w ) { write32le_with_write8_handler(pc_HDC2_w, offset, data, mem_mask); }
774READ32_HANDLER ( pc32le_HDC1_r ) { return read32le_with_read8_handler(pc_HDC1_r, machine, offset, mem_mask); }
775READ32_HANDLER ( pc32le_HDC2_r ) { return read32le_with_read8_handler(pc_HDC2_r, machine, offset, mem_mask); }
776WRITE32_HANDLER ( pc32le_HDC1_w ) { write32le_with_write8_handler(pc_HDC1_w, machine, offset, data, mem_mask); }
777WRITE32_HANDLER ( pc32le_HDC2_w ) { write32le_with_write8_handler(pc_HDC2_w, machine, offset, data, mem_mask); }
src/mess/machine/99_ide.c
r1877r1878
2929/* prototypes */
3030static void ide_interrupt_callback(int state);
3131
32static int ide_cru_r(int offset);
33static void ide_cru_w(int offset, int data);
34static  READ8_HANDLER(ide_mem_r);
32static int ide_cru_r(running_machine *machine, int offset);
33static void ide_cru_w(running_machine *machine, int offset, int data);
34static READ8_HANDLER(ide_mem_r);
3535static WRITE8_HANDLER(ide_mem_w);
3636
3737/* pointer to the IDE RAM area */
r1877r1878
167167/*
168168   Read ide CRU interface
169169*/
170static int ide_cru_r(int offset)
170static int ide_cru_r(running_machine *machine, int offset)
171171{
172172   int reply;
173173
r1877r1878
191191/*
192192   Write ide CRU interface
193193*/
194static void ide_cru_w(int offset, int data)
194static void ide_cru_w(running_machine *machine, int offset, int data)
195195{
196196   offset &= 7;
197197
src/mess/machine/ibmpc.c
r1877r1878
149149   if (pc_ppi.portc_switch_high)
150150   {
151151      /* read hi nibble of S2 */
152      data = (data&0xf0)|((input_port_1_r(0) >> 4) & 0x0f);
152      data = (data&0xf0)|((readinputport(1) >> 4) & 0x0f);
153153      PIO_LOG(1,"PIO_C_r (hi)",("$%02x\n", data));
154154   }
155155   else
156156   {
157157      /* read lo nibble of S2 */
158      data = (data&0xf0)|(input_port_1_r(0) & 0x0f);
158      data = (data&0xf0)|(readinputport(1) & 0x0f);
159159      PIO_LOG(1,"PIO_C_r (lo)",("$%02x\n", data));
160160   }
161161
r1877r1878
243243   }
244244}
245245
246READ16_HANDLER( pc16le_rtc_r ) { return read16le_with_read8_handler(pc_rtc_r, offset, mem_mask); }
247WRITE16_HANDLER( pc16le_rtc_w ) { write16le_with_write8_handler(pc_rtc_w, offset, data, mem_mask); }
246READ16_HANDLER( pc16le_rtc_r ) { return read16le_with_read8_handler(pc_rtc_r, machine, offset, mem_mask); }
247WRITE16_HANDLER( pc16le_rtc_w ) { write16le_with_write8_handler(pc_rtc_w, machine, offset, data, mem_mask); }
248248
249249/*************************************************************************
250250 *
src/mess/machine/68901mfp.c
r1877r1878
284284{
285285   mc68901_t *chip = ptr;
286286
287   UINT8 gpio = chip->intf->gpio_r(0);
287   UINT8 gpio = chip->intf->gpio_r(machine, 0);
288288
289289   UINT8 gpold = (chip->gpip & ~chip->ddr) ^ chip->aer;
290290   UINT8 gpnew = (gpio & ~chip->ddr) ^ chip->aer;
r1877r1878
708708
709709      if (chip->intf->gpio_w)
710710      {
711         chip->intf->gpio_w(0, chip->gpip);
711         chip->intf->gpio_w(Machine, 0, chip->gpip);
712712      }
713713      break;
714714
src/mess/machine/amigafdc.c
r1877r1878
1515#include "amiga.h"
1616#include "amigafdc.h"
1717#include "machine/6526cia.h"
18#include "deprecat.h"
1819
1920
2021#define MAX_TRACK_BYTES         12500
r1877r1878
267268   if ( fdc_status[drive].mfm[cur_pos-2] == ( ( sync >> 8 ) & 0xff ) &&
268269       fdc_status[drive].mfm[cur_pos-1] == ( sync & 0xff ) )
269270   {
270      amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_DSKSYN, 0);
271      amiga_custom_w(machine, REG_INTREQ, 0x8000 | INTENA_DSKSYN, 0);
271272   }
272273
273274   if ( sector < 10 )
r1877r1878
309310      {
310311         logerror("Write to disk unsupported yet\n" );
311312
312         amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_DSKBLK, 0);
313         amiga_custom_w(machine, REG_INTREQ, 0x8000 | INTENA_DSKBLK, 0);
313314      }
314315   }
315316   else
r1877r1878
342343
343344      if ( fdc_status[drive].len <= 0 )
344345      {
345         amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_DSKBLK, 0);
346         amiga_custom_w(machine, REG_INTREQ, 0x8000 | INTENA_DSKBLK, 0);
346347      }
347348      else
348349      {
r1877r1878
373374
374375   if ( drive == -1 ) {
375376      logerror("Disk DMA started with no drive selected!\n" );
376      amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_DSKBLK, 0);
377      amiga_custom_w(Machine, REG_INTREQ, 0x8000 | INTENA_DSKBLK, 0);
377378      return;
378379   }
379380
src/mess/machine/z80dart.c
r1877r1878
88***************************************************************************/
99
1010#include "driver.h"
11#include "deprecat.h"
1112#include "z80dart.h"
1213#include "cpu/z80/z80.h"
1314#include "cpu/z80/z80daisy.h"
r1877r1878
159160   UINT8      int_state[8];      /* interrupt states */
160161
161162   void (*irq_cb)(int state);
162   write8_handler dtr_changed_cb;
163   write8_handler rts_changed_cb;
164   write8_handler break_changed_cb;
165   write8_handler transmit_cb;
163   write8_machine_func dtr_changed_cb;
164   write8_machine_func rts_changed_cb;
165   write8_machine_func break_changed_cb;
166   write8_machine_func transmit_cb;
166167   int (*receive_poll_cb)(int which);
167168};
168169
r1877r1878
344345   dart_channel *chan = &dart->chan[ch];
345346   int reg = chan->regs[0] & 7;
346347   UINT8 old = chan->regs[reg];
348   running_machine *machine = Machine;
347349
348350   if (reg != 0 || (reg & 0xf8))
349351      VPRINTF(("%04X:dart_reg_w(%c,%d) = %02X\n", activecpu_get_pc(), 'A' + ch, reg, data));
r1877r1878
397399      /* DART write register 5 */
398400      case 5:
399401         if (((old ^ data) & DART_WR5_DTR) && dart->dtr_changed_cb)
400            (*dart->dtr_changed_cb)(ch, (data & DART_WR5_DTR) != 0);
402            (*dart->dtr_changed_cb)(machine, ch, (data & DART_WR5_DTR) != 0);
401403         if (((old ^ data) & DART_WR5_SEND_BREAK) && dart->break_changed_cb)
402            (*dart->break_changed_cb)(ch, (data & DART_WR5_SEND_BREAK) != 0);
404            (*dart->break_changed_cb)(machine, ch, (data & DART_WR5_SEND_BREAK) != 0);
403405         if (((old ^ data) & DART_WR5_RTS) && dart->rts_changed_cb)
404            (*dart->rts_changed_cb)(ch, (data & DART_WR5_RTS) != 0);
406            (*dart->rts_changed_cb)(machine, ch, (data & DART_WR5_RTS) != 0);
405407         break;
406408   }
407409}
r1877r1878
645647
646648      /* actually transmit the character */
647649      if (dart->transmit_cb != NULL)
648         (*dart->transmit_cb)(ch, chan->outbuf);
650         (*dart->transmit_cb)(machine, ch, chan->outbuf);
649651
650652      /* update the status register */
651653      chan->status[0] |= DART_RR0_TX_BUFFER_EMPTY;
src/mess/machine/bebox.c
r1877r1878
442442static READ8_HANDLER( bebox_800001F0_8_r ) { return ide_controller_0_r(offset + 0x1F0); }
443443static WRITE8_HANDLER( bebox_800001F0_8_w ) { ide_controller_0_w(offset + 0x1F0, data); }
444444
445READ64_HANDLER( bebox_800001F0_r ) { return read64be_with_read8_handler(bebox_800001F0_8_r, offset, mem_mask); }
446WRITE64_HANDLER( bebox_800001F0_w ) { write64be_with_write8_handler(bebox_800001F0_8_w, offset, data, mem_mask); }
445READ64_HANDLER( bebox_800001F0_r ) { return read64be_with_read8_handler(bebox_800001F0_8_r, machine, offset, mem_mask); }
446WRITE64_HANDLER( bebox_800001F0_w ) { write64be_with_write8_handler(bebox_800001F0_8_w, machine, offset, data, mem_mask); }
447447
448448
449449READ64_HANDLER( bebox_800003F0_r )
450450{
451   UINT64 result = pc64be_fdc_r(offset, mem_mask | 0xFFFF);
451   UINT64 result = pc64be_fdc_r(machine, offset, mem_mask | 0xFFFF);
452452
453453   if (((mem_mask >> 8) & 0xFF) == 0)
454454   {
r1877r1878
467467
468468WRITE64_HANDLER( bebox_800003F0_w )
469469{
470   pc64be_fdc_w(offset, data, mem_mask | 0xFFFF);
470   pc64be_fdc_w(machine, offset, data, mem_mask | 0xFFFF);
471471
472472   if (((mem_mask >> 8) & 0xFF) == 0)
473473      ide_controller_0_w(0x3F6, (data >> 8) & 0xFF);
r1877r1878
496496 *
497497 *************************************/
498498
499static read8_handler bebox_vga_memory_rh;
500static write8_handler bebox_vga_memory_wh;
499static read8_machine_func bebox_vga_memory_rh;
500static write8_machine_func bebox_vga_memory_wh;
501501
502502static READ64_HANDLER( bebox_video_r )
503503{
r1877r1878
517517
518518static READ64_HANDLER( bebox_vga_memory_r )
519519{
520   return read64be_with_read8_handler(bebox_vga_memory_rh, offset, mem_mask);
520   return read64be_with_read8_handler(bebox_vga_memory_rh, machine, offset, mem_mask);
521521}
522522
523523
524524static WRITE64_HANDLER( bebox_vga_memory_w )
525525{
526   write64be_with_write8_handler(bebox_vga_memory_wh, offset, data, mem_mask);
526   write64be_with_write8_handler(bebox_vga_memory_wh, machine, offset, data, mem_mask);
527527}
528528
529529
530static void bebox_map_vga_memory(offs_t begin, offs_t end, read8_handler rh, write8_handler wh)
530static void bebox_map_vga_memory(offs_t begin, offs_t end, read8_machine_func rh, write8_machine_func wh)
531531{
532   read64_handler rh64 = (rh == MRA8_BANK4) ? MRA64_BANK4 : bebox_vga_memory_r;
533   write64_handler wh64 = (wh == MWA8_BANK4) ? MWA64_BANK4 : bebox_vga_memory_w;
532   read64_machine_func rh64 = (rh == MRA8_BANK4) ? MRA64_BANK4 : bebox_vga_memory_r;
533   write64_machine_func wh64 = (wh == MWA8_BANK4) ? MWA64_BANK4 : bebox_vga_memory_w;
534534
535535   bebox_vga_memory_rh = rh;
536536   bebox_vga_memory_wh = wh;
r1877r1878
615615
616616READ64_HANDLER(bebox_page_r)
617617{
618   return read64be_with_read8_handler(at_page8_r, offset, mem_mask);
618   return read64be_with_read8_handler(at_page8_r, machine, offset, mem_mask);
619619}
620620
621621
622622WRITE64_HANDLER(bebox_page_w)
623623{
624   write64be_with_write8_handler(at_page8_w, offset, data, mem_mask);
624   write64be_with_write8_handler(at_page8_w, machine, offset, data, mem_mask);
625625}
626626
627627
r1877r1878
657657
658658WRITE64_HANDLER(bebox_80000480_w)
659659{
660   write64be_with_write8_handler(at_hipage8_w, offset, data, mem_mask);
660   write64be_with_write8_handler(at_hipage8_w, machine, offset, data, mem_mask);
661661}
662662
663663
r1877r1878
748748
749749READ64_HANDLER( bebox_flash_r )
750750{
751   return read64be_with_read8_handler(bebox_flash8_r, offset, mem_mask);
751   return read64be_with_read8_handler(bebox_flash8_r, machine, offset, mem_mask);
752752}
753753
754754
755755WRITE64_HANDLER( bebox_flash_w )
756756{
757   write64be_with_write8_handler(bebox_flash8_w, offset, data, mem_mask);
757   write64be_with_write8_handler(bebox_flash8_w, machine, offset, data, mem_mask);
758758}
759759
760760
src/mess/machine/a7800.c
r1877r1878
404404      }
405405      break;
406406   }
407   tia_sound_w(offset,data);
407   tia_sound_w(machine, offset,data);
408408   ROM[offset] = data;
409409}
410410
r1877r1878
428428      }
429429      else if(a7800_cart_type & 0x01)
430430      {
431         pokey1_w(offset,data);
431         pokey1_w(machine, offset,data);
432432      }
433433      else
434434      {
src/mess/machine/68901mfp.h
r1877r1878
6363
6464   void (*irq_callback)(mc68901_t *chip, int state);
6565
66   read8_handler gpio_r;
67   write8_handler gpio_w;
66   read8_machine_func gpio_r;
67   write8_machine_func gpio_w;
6868};
6969
7070/* device interface */
src/mess/machine/amigakbd.c
r1877r1878
5454   }
5555}
5656
57static void kbd_update( void *param, UINT32 oldvalue, UINT32 newvalue )
57static INPUT_CHANGED( kbd_update )
5858{
5959   int   index = *( (int*)(param) ), i;
60   UINT32   delta = oldvalue ^ newvalue;
60   UINT32   delta = oldval ^ newval;
6161
6262   /* Special case Page UP, which we will use as Action Replay button */
63   if ( (index == 3) && ( delta & 0x80000000 ) && ( newvalue & 0x80000000 ) )
63   if ( (index == 3) && ( delta & 0x80000000 ) && ( newval & 0x80000000 ) )
6464   {
6565      const amiga_machine_interface *amiga_intf = amiga_get_interface();
6666
r1877r1878
7777      {
7878         if ( delta & ( 1 << i ) )
7979         {
80            int   down = ( newvalue & ( 1 << i ) ) ? 0 : 1;
80            int   down = ( newval & ( 1 << i ) ) ? 0 : 1;
8181            int   scancode = ( ( (index*32)+i ) << 1 ) | down;
8282            int amigacode = ~scancode;
8383
r1877r1878
9797
9898void amigakbd_init( void )
9999{
100   /* register for changes on the keyboard ports */
101   int    i;
102
103   for( i = 0; i < 4; i++ )
104   {
105      char   buf[64];
106
107      sprintf( buf, "amiga_keyboard_%d", i );
108
109      input_port_set_changed_callback( port_tag_to_index( buf ), 0xFFFFFFFF, kbd_update, &kbd_index[i] );
110   }
111
112100   /* allocate a keyboard buffer */
113101   key_buf = auto_malloc( KEYBOARD_BUFFER_SIZE );
114102   key_buf_pos = 0;
r1877r1878
120108/*********************************************************************************************/
121109
122110INPUT_PORTS_START( amiga_keyboard )
123   PORT_START_TAG("amiga_keyboard_0")
111   PORT_START_TAG("amiga_keyboard_0") PORT_CHANGED(kbd_update, &kbd_index[0])
124112   PORT_BIT( 0x00000001, 0x0000, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE)      // 00
125113   PORT_BIT( 0x00000002, 0x0000, IPT_KEYBOARD) PORT_CODE(KEYCODE_1)      // 01
126114   PORT_BIT( 0x00000004, 0x0000, IPT_KEYBOARD) PORT_CODE(KEYCODE_2)      // 02
r1877r1878
154142   PORT_BIT( 0x40000000, 0x0000, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD)      // 1E
155143   PORT_BIT( 0x80000000, 0x0000, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD)      // 1F
156144
157   PORT_START_TAG("amiga_keyboard_1")
145   PORT_START_TAG("amiga_keyboard_1") PORT_CHANGED(kbd_update, &kbd_index[1])
158146   PORT_BIT( 0x00000001, 0x0000, IPT_KEYBOARD) PORT_CODE(KEYCODE_A)      // 20
159147   PORT_BIT( 0x00000002, 0x0000, IPT_KEYBOARD) PORT_CODE(KEYCODE_S)      // 21
160148   PORT_BIT( 0x00000004, 0x0000, IPT_KEYBOARD) PORT_CODE(KEYCODE_D)      // 22
r1877r1878
188176   PORT_BIT( 0x40000000, 0x0000, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD)      // 3E
189177   PORT_BIT( 0x80000000, 0x0000, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD)      // 3F
190178
191   PORT_START_TAG("amiga_keyboard_2")
179   PORT_START_TAG("amiga_keyboard_2") PORT_CHANGED(kbd_update, &kbd_index[2])
192180   PORT_BIT( 0x00000001, 0x0000, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE)      // 40
193181   PORT_BIT( 0x00000002, 0x0000, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE)   // 41
194182   PORT_BIT( 0x00000004, 0x0000, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB)      // 42
r1877r1878
222210   PORT_BIT( 0x40000000, 0x0000, IPT_KEYBOARD) PORT_CODE(KEYCODE_PLUS_PAD)      // 5E
223211   PORT_BIT( 0x80000000, 0x0000, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT)      // 5F
224212
225   PORT_START_TAG("amiga_keyboard_3")
213   PORT_START_TAG("amiga_keyboard_3") PORT_CHANGED(kbd_update, &kbd_index[3])
226214   PORT_BIT( 0x00000001, 0x0000, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT)      // 60
227215   PORT_BIT( 0x00000002, 0x0000, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT)      // 61
228216   PORT_BIT( 0x00000004, 0x0000, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK)      // 62
src/mess/machine/z80dart.h
r1877r1878
2424{
2525   int baseclock;
2626   void (*irq_cb)(int state);
27   write8_handler dtr_changed_cb;
28   write8_handler rts_changed_cb;
29   write8_handler break_changed_cb;
30   write8_handler transmit_cb;
27   write8_machine_func dtr_changed_cb;
28   write8_machine_func rts_changed_cb;
29   write8_machine_func break_changed_cb;
30   write8_machine_func transmit_cb;
3131   int (*receive_poll_cb)(int which);
3232};
3333
src/mess/machine/mtx.c
r1877r1878
5151
5252static void mtx_tms9929a_interrupt(int data)
5353{
54   z80ctc_0_trg0_w(0, data ? 0 : 1);
54   running_machine *machine = Machine;
55   z80ctc_0_trg0_w(machine, 0, data ? 0 : 1);
5556}
5657
5758static const TMS9928a_interface tms9928a_interface =
r1877r1878
217218
218219READ8_HANDLER( mtx_ctc_r )
219220{
220   return z80ctc_0_r(offset);
221   return z80ctc_0_r(machine, offset);
221222}
222223
223224WRITE8_HANDLER( mtx_ctc_w )
224225{
225226//  logerror("mtx_ctc_w: %02x\n", data);
226227   if (offset < 3)
227      z80ctc_0_w(offset,data);
228      z80ctc_0_w(machine, offset,data);
228229}
229230
230231static z80ctc_interface mtx_ctc_intf =
src/mess/machine/microtan.c
r1877r1878
295295}
296296
297297/**************************************************************
298 * VIA read wrappers
299 **************************************************************/
300
301static const char *const via_name[16] = {
302    "PB  ","PA  ","DDRB","DDRA",
303    "T1CL","T1CH","T1LL","T1LH",
304    "T2CL","T2CH","SR  ","ACR ",
305    "PCR ","IFR ","IER ","PANH"
306};
307
308 READ8_HANDLER( microtan_via_0_r )
309{
310    int data = via_0_r(offset);
311    LOG(("microtan_via_0_r %s -> %02X\n", via_name[offset], data));
312    return data;
313}
314
315 READ8_HANDLER( microtan_via_1_r )
316{
317    int data = via_1_r(offset);
318    LOG(("microtan_via_1_r %s -> %02X\n", via_name[offset], data));
319    return data;
320}
321
322/**************************************************************
323 * VIA write wrappers
324 **************************************************************/
325WRITE8_HANDLER( microtan_via_0_w )
326{
327    LOG(("via_0_w (%2d) %s <- %02X\n", offset, via_name[offset], data));
328    via_0_w(offset,data);
329}
330
331WRITE8_HANDLER( microtan_via_1_w )
332{
333    LOG(("via_1_w (%2d) %s <- %02X\n", offset, via_name[offset], data));
334    via_1_w(offset,data);
335}
336
337/**************************************************************
338298 * VIA interface structure
339299 **************************************************************/
340300static const struct via6522_interface via6522[2] =
r1877r1878
370330      via_set_input_cb2(0,1);
371331}
372332
373 READ8_HANDLER( microtan_sio_r )
333READ8_HANDLER( microtan_sound_r )
374334{
375    int data;
376   data = acia_6551_r(offset);
377    LOG(("microtan_sio_r: %d -> %02x\n", offset, data));
378    return data;
379}
380
381WRITE8_HANDLER( microtan_sio_w )
382{
383    LOG(("microtan_sio_w: %d <- %02x\n", offset, data));
384   acia_6551_w(offset,data);
385}
386
387
388 READ8_HANDLER( microtan_sound_r )
389{
390335    int data = 0xff;
391336    LOG(("microtan_sound_r: -> %02x\n", data));
392337    return data;
r1877r1878
747692
748693static void microtan_snapshot_copy(UINT8 *snapshot_buff, int snapshot_size)
749694{
695   running_machine *machine = Machine;
750696    UINT8 *RAM = memory_region(REGION_CPU1);
751697
752698    /* check for .DMP file format */
r1877r1878
803749
804750        /* first set of VIA6522 registers */
805751        for (i = 0; i < 16; i++ )
806            via_0_w(i, snapshot_buff[base++]);
752            via_0_w(machine, i, snapshot_buff[base++]);
807753
808754        /* second set of VIA6522 registers */
809755        for (i = 0; i < 16; i++ )
810            via_1_w(i, snapshot_buff[base++]);
756            via_1_w(machine, i, snapshot_buff[base++]);
811757
812758        /* microtan IO bff0-bfff */
813759        for (i = 0; i < 16; i++ )
814760        {
815761            RAM[0xbff0+i] = snapshot_buff[base++];
816762            if (i < 4)
817                microtan_bffx_w(i,RAM[0xbff0+i]);
763                microtan_bffx_w(machine, i, RAM[0xbff0+i]);
818764        }
819765
820        microtan_sound_w(0, snapshot_buff[base++]);
766        microtan_sound_w(machine, 0, snapshot_buff[base++]);
821767        microtan_chunky_graphics = snapshot_buff[base++];
822768
823769        /* first set of AY8910 registers */
824770        for (i = 0; i < 16; i++ )
825771        {
826            AY8910_control_port_0_w(0, i);
827            AY8910_write_port_0_w(0, snapshot_buff[base++]);
772            AY8910_control_port_0_w(machine, 0, i);
773            AY8910_write_port_0_w(machine, 0, snapshot_buff[base++]);
828774        }
829775
830776        /* second set of AY8910 registers */
831777        for (i = 0; i < 16; i++ )
832778        {
833            AY8910_control_port_0_w(0, i);
834            AY8910_write_port_0_w(0, snapshot_buff[base++]);
779            AY8910_control_port_0_w(machine, 0, i);
780            AY8910_write_port_0_w(machine, 0, snapshot_buff[base++]);
835781        }
836782
837783        for (i = 0; i < 32*16; i++)
src/mess/machine/intv.c
r1877r1878
5353      switch (offset)
5454      {
5555         case 0x000:
56            rv = input_port_10_r(0) & 0x80;
56            rv = readinputport(10) & 0x80;
5757            logerror("TAPE: Read %02x from 0x40%02x - XOR Data?\n",rv,offset);
5858            break;
5959         case 0x001:
60            rv = (input_port_10_r(0) & 0x40) << 1;
60            rv = (readinputport(10) & 0x40) << 1;
6161            logerror("TAPE: Read %02x from 0x40%02x - Sense 1?\n",rv,offset);
6262            break;
6363         case 0x002:
64            rv = (input_port_10_r(0) & 0x20) << 2;
64            rv = (readinputport(10) & 0x20) << 2;
6565            logerror("TAPE: Read %02x from 0x40%02x - Sense 2?\n",rv,offset);
6666            break;
6767         case 0x003:
68            rv = (input_port_10_r(0) & 0x10) << 3;
68            rv = (readinputport(10) & 0x10) << 3;
6969            logerror("TAPE: Read %02x from 0x40%02x - Tape Present\n",rv,offset);
7070            break;
7171         case 0x004:
72            rv = (input_port_10_r(0) & 0x08) << 4;
72            rv = (readinputport(10) & 0x08) << 4;
7373            logerror("TAPE: Read %02x from 0x40%02x - Comp (339/1)\n",rv,offset);
7474            break;
7575         case 0x005:
76            rv = (input_port_10_r(0) & 0x04) << 5;
76            rv = (readinputport(10) & 0x04) << 5;
7777            logerror("TAPE: Read %02x from 0x40%02x - Clocked Comp (339/13)\n",rv,offset);
7878            break;
7979         case 0x006:
r1877r1878
9393         case 0x060:   /* Keyboard Read */
9494            rv = 0xff;
9595            if (intvkbd_keyboard_col == 0)
96               rv = input_port_0_r(0);
96               rv = readinputport(0);
9797            if (intvkbd_keyboard_col == 1)
98               rv = input_port_1_r(0);
98               rv = readinputport(1);
9999            if (intvkbd_keyboard_col == 2)
100               rv = input_port_2_r(0);
100               rv = readinputport(2);
101101            if (intvkbd_keyboard_col == 3)
102               rv = input_port_3_r(0);
102               rv = readinputport(3);
103103            if (intvkbd_keyboard_col == 4)
104               rv = input_port_4_r(0);
104               rv = readinputport(4);
105105            if (intvkbd_keyboard_col == 5)
106               rv = input_port_5_r(0);
106               rv = readinputport(5);
107107            if (intvkbd_keyboard_col == 6)
108               rv = input_port_6_r(0);
108               rv = readinputport(6);
109109            if (intvkbd_keyboard_col == 7)
110               rv = input_port_7_r(0);
110               rv = readinputport(7);
111111            if (intvkbd_keyboard_col == 8)
112               rv = input_port_8_r(0);
112               rv = readinputport(8);
113113            if (intvkbd_keyboard_col == 9)
114               rv = input_port_9_r(0);
114               rv = readinputport(9);
115115            break;
116116         case 0x80:
117117            rv = 0x00;
r1877r1878
140140         case 0xce:
141141         case 0xcf:
142142            /* TMS9927 regs */
143            rv = intvkbd_tms9927_r(offset-0xc0);
143            rv = intvkbd_tms9927_r(machine, offset-0xc0);
144144            break;
145145         default:
146146            rv = (intvkbd_dualport_ram[offset]&0x0300)>>8;
r1877r1878
258258         case 0xce:
259259         case 0xcf:
260260            /* TMS9927 regs */
261            intvkbd_tms9927_w(offset-0xc0, data);
261            intvkbd_tms9927_w(machine, offset-0xc0, data);
262262            break;
263263         default:
264264            logerror("%04X: Unknown write %02x to 0x40%02x\n",activecpu_get_pc(),data,offset);
r1877r1878
459459      switch(byte)
460460      {
461461         case 0:
462            value = input_port_0_r(0);
462            value = readinputport(0);
463463            break;
464464         case 1:
465            value = input_port_1_r(0);
465            value = readinputport(1);
466466            break;
467467         case 2:
468            value = input_port_2_r(0);
468            value = readinputport(2);
469469            break;
470470      }
471471      for(bit=7; bit>=0; bit--)
src/mess/machine/99_peb.c
r1877r1878
121121   {
122122      struct
123123      {
124         read8_handler mem_read;      /* card mem read handler (8 bits) */
125         write8_handler mem_write;   /* card mem write handler (8 bits) */
124         read8_machine_func mem_read;      /* card mem read handler (8 bits) */
125         write8_machine_func mem_write;   /* card mem write handler (8 bits) */
126126      } width_8bit;
127127      struct
128128      {
129         read16_handler mem_read;   /* card mem read handler (16 bits) */
130         write16_handler mem_write;   /* card mem write handler (16 bits) */
129         read16_machine_func mem_read;   /* card mem read handler (16 bits) */
130         write16_machine_func mem_write;   /* card mem write handler (16 bits) */
131131      } width_16bit;
132132   } w;
133133} ti99_4p_peb_card_handlers_t;
r1877r1878
325325/*
326326   Read CRU in range >1000->1ffe (>800->fff) (ti-99/4(a))
327327*/
328 READ8_HANDLER ( ti99_4x_peb_cru_r )
328READ8_HANDLER ( ti99_4x_peb_cru_r )
329329{
330330   int port;
331331   cru_read_handler handler;
r1877r1878
334334   port = (offset & 0x00f0) >> 4;
335335   handler = expansion_ports[port].cru_read;
336336
337   reply = (handler) ? (*handler)(offset & 0xf) : 0;
337   reply = (handler) ? (*handler)(machine, offset & 0xf) : 0;
338338
339339   return reply;
340340}
r1877r1878
351351   handler = expansion_ports[port].cru_write;
352352
353353   if (handler)
354      (*handler)(offset & 0x7f, data);
354      (*handler)(machine, offset & 0x7f, data);
355355
356356   /* expansion card enable? */
357357   if ((offset & 0x7f) == 0)
r1877r1878
377377READ16_HANDLER ( ti99_4x_peb_r )
378378{
379379   int reply = 0;
380   read8_handler handler;
380   read8_machine_func handler;
381381
382382   activecpu_adjust_icount(-4);
383383
r1877r1878
386386      handler = expansion_ports[active_card].mem_read;
387387      if (handler)
388388      {
389         reply = (*handler)((offset << 1) + 1);
390         reply |= ((unsigned) (*handler)(offset << 1)) << 8;
389         reply = (*handler)(machine, (offset << 1) + 1);
390         reply |= ((unsigned) (*handler)(machine, offset << 1)) << 8;
391391      }
392392   }
393393
r1877r1878
399399*/
400400WRITE16_HANDLER ( ti99_4x_peb_w )
401401{
402   write8_handler handler;
402   write8_machine_func handler;
403403
404404   activecpu_adjust_icount(-4);
405405
r1877r1878
411411      handler = expansion_ports[active_card].mem_write;
412412      if (handler)
413413      {
414         (*handler)((offset << 1) + 1, data & 0xff);
415         (*handler)(offset << 1, (data >> 8) & 0xff);
414         (*handler)(machine, (offset << 1) + 1, data & 0xff);
415         (*handler)(machine, offset << 1, (data >> 8) & 0xff);
416416      }
417417   }
418418}
r1877r1878
430430   port = (offset & 0x00f0) >> 4;
431431   handler = expansion_ports[port].cru_read;
432432
433   reply = (handler) ? (*handler)(offset & 0xf) : 0;
433   reply = (handler) ? (*handler)(machine, offset & 0xf) : 0;
434434
435435   return reply;
436436}
r1877r1878
447447   handler = expansion_ports[port].cru_write;
448448
449449   if (handler)
450      (*handler)(offset & 0x7f, data);
450      (*handler)(machine, offset & 0x7f, data);
451451
452452   /* expansion card enable? */
453453   if ((offset & 0x7f) == 0)
r1877r1878
473473 READ8_HANDLER ( geneve_peb_r )
474474{
475475   int reply = 0;
476   read8_handler handler;
476   read8_machine_func handler;
477477
478478   activecpu_adjust_icount(-8);
479479
r1877r1878
481481   {
482482            handler = expansion_ports[active_card].mem_read;
483483      if (handler)
484         reply = (*handler)(offset);
484         reply = (*handler)(machine, offset);
485485   }
486486
487487   return reply;
r1877r1878
492492*/
493493WRITE8_HANDLER ( geneve_peb_w )
494494{
495   write8_handler handler;
495   write8_machine_func handler;
496496
497497   activecpu_adjust_icount(-8);
498498
r1877r1878
500500   {
501501      handler = expansion_ports[active_card].mem_write;
502502      if (handler)
503         (*handler)(offset, data);
503         (*handler)(machine, offset, data);
504504   }
505505}
506506
r1877r1878
516516   port = (offset & 0x01f0) >> 4;
517517   handler = expansion_ports[port].cru_read;
518518
519   reply = (handler) ? (*handler)(offset & 0xf) : 0;
519   reply = (handler) ? (*handler)(machine, offset & 0xf) : 0;
520520
521521   return reply;
522522}
r1877r1878
533533   handler = expansion_ports[port].cru_write;
534534
535535   if (handler)
536      (*handler)(offset & 0x7f, data);
536      (*handler)(machine, offset & 0x7f, data);
537537
538538   /* expansion card enable? */
539539   if ((offset & 0x7f) == 0)
r1877r1878
559559 READ8_HANDLER ( ti99_8_peb_r )
560560{
561561   int reply = 0;
562   read8_handler handler;
562   read8_machine_func handler;
563563
564564   activecpu_adjust_icount(-4);
565565
r1877r1878
567567   {
568568      handler = expansion_ports[active_card].mem_read;
569569      if (handler)
570         reply = (*handler)(offset);
570         reply = (*handler)(machine, offset);
571571   }
572572
573573   return reply;
r1877r1878
578578*/
579579WRITE8_HANDLER ( ti99_8_peb_w )
580580{
581   write8_handler handler;
581   write8_machine_func handler;
582582
583583   activecpu_adjust_icount(-4);
584584
r1877r1878
586586   {
587587      handler = expansion_ports[active_card].mem_write;
588588      if (handler)
589         (*handler)(offset, data);
589         (*handler)(machine, offset, data);
590590   }
591591}
592592
r1877r1878
602602   port = offset >> 4;
603603   handler = ti99_4p_expansion_ports[port].cru_read;
604604
605   reply = (handler) ? (*handler)(offset & 0xf) : 0;
605   reply = (handler) ? (*handler)(machine, offset & 0xf) : 0;
606606
607607   return reply;
608608}
r1877r1878
619619   handler = ti99_4p_expansion_ports[port].cru_write;
620620
621621   if (handler)
622      (*handler)(offset & 0x7f, data);
622      (*handler)(machine, offset & 0x7f, data);
623623
624624   /* expansion card enable? */
625625   if ((offset & 0x7f) == 0)
r1877r1878
663663READ16_HANDLER ( ti99_4p_peb_r )
664664{
665665   int reply = 0;
666   read8_handler handler;
667   read16_handler handler16;
666   read8_machine_func handler;
667   read16_machine_func handler16;
668668
669669
670670   if (active_card == -1)
r1877r1878
679679         handler = ti99_4p_expansion_ports[active_card].w.width_8bit.mem_read;
680680         if (handler)
681681         {
682            reply = (*handler)((offset << 1) + 1);
683            reply |= ((unsigned) (*handler)(offset << 1)) << 8;
682            reply = (*handler)(machine, (offset << 1) + 1);
683            reply |= ((unsigned) (*handler)(machine, offset << 1)) << 8;
684684         }
685685      }
686686      else
r1877r1878
689689
690690         handler16 = ti99_4p_expansion_ports[active_card].w.width_16bit.mem_read;
691691         if (handler16)
692            reply = (*handler16)(offset, /*mem_mask*/0);
692            reply = (*handler16)(machine, offset, /*mem_mask*/0);
693693      }
694694   }
695695
r1877r1878
713713*/
714714WRITE16_HANDLER ( ti99_4p_peb_w )
715715{
716   write8_handler handler;
717   write16_handler handler16;
716   write8_machine_func handler;
717   write16_machine_func handler16;
718718
719719   if (active_card == -1)
720720      activecpu_adjust_icount(-4);   /* ??? */
r1877r1878
730730         handler = ti99_4p_expansion_ports[active_card].w.width_8bit.mem_write;
731731         if (handler)
732732         {
733            (*handler)((offset << 1) + 1, data & 0xff);
734            (*handler)(offset << 1, (data >> 8) & 0xff);
733            (*handler)(machine, (offset << 1) + 1, data & 0xff);
734            (*handler)(machine, offset << 1, (data >> 8) & 0xff);
735735         }
736736      }
737737      else
r1877r1878
740740
741741         handler16 = ti99_4p_expansion_ports[active_card].w.width_16bit.mem_write;
742742         if (handler16)
743            (*handler16)(offset, data, /*mem_mask*/0);
743            (*handler16)(machine, offset, data, /*mem_mask*/0);
744744      }
745745   }
746746}
src/mess/machine/amigacrt.c
r1877r1878
197197      amiga_ar23_freeze();
198198   }
199199
200   return amiga_cia_r( offset, mem_mask );
200   return amiga_cia_r( machine, offset, mem_mask );
201201}
202202
203203static WRITE16_HANDLER( amiga_ar23_mode_w )
src/mess/machine/osborne1.c
r1877r1878
8484   } else {
8585      switch( offset & 0x0F00 ) {
8686      case 0x100:   /* Floppy */
87         data = wd17xx_r( offset );
87         data = wd17xx_r( machine, offset );
8888         break;
8989      case 0x200:   /* Keyboard */
9090         /* Row 0 */
r1877r1878
105105         if ( offset & 0x80 )   data &= readinputport(7);
106106         break;
107107      case 0x900:   /* IEEE488 PIA */
108         data = pia_0_r( offset & 0x03 );
108         data = pia_0_r( machine, offset & 0x03 );
109109         break;
110110      case 0xA00:   /* Serial */
111111         break;
112112      case 0xC00:   /* Video PIA */
113         data = pia_1_r( offset & 0x03 );
113         data = pia_1_r( machine, offset & 0x03 );
114114         break;
115115      }
116116   }
r1877r1878
128128      /* Handle writes to the I/O area */
129129      switch( offset & 0x0F00 ) {
130130      case 0x100:   /* Floppy */
131         wd17xx_w( offset, data );
131         wd17xx_w( machine, offset, data );
132132         break;
133133      case 0x900:   /* IEEE488 PIA */
134         pia_0_w( offset & 0x03, data );
134         pia_0_w( machine, offset & 0x03, data );
135135         break;
136136      case 0xA00:   /* Serial */
137137         break;
138138      case 0xC00:   /* Video PIA */
139         pia_1_w( offset & 0x03, data );
139         pia_1_w( machine, offset & 0x03, data );
140140         break;
141141      }
142142   }
r1877r1878
217217static int osborne1_z80_irq_ack(int param) {
218218   /* Enable ROM and I/O when IRQ is acknowledged */
219219   UINT8   old_bankswitch = osborne1.bankswitch;
220   osborne1_bankswitch_w( 0, 0 );
220   osborne1_bankswitch_w( Machine, 0, 0 );
221221   osborne1.bankswitch = old_bankswitch;
222222   osborne1.in_irq_handler = 1;
223223   return 0xF8;
r1877r1878
316316      /* Clear CA1 on video PIA */
317317      osborne1.start_y = ( osborne1.new_start_y - 1 ) & 0x1F;
318318      osborne1.charline = 0;
319      pia_1_ca1_w( 0, 0 );
319      pia_1_ca1_w( machine, 0, 0 );
320320   }
321321   if ( y == 240 ) {
322322      /* Set CA1 on video PIA */
323      pia_1_ca1_w( 0, 0xFF );
323      pia_1_ca1_w( machine, 0, 0xFF );
324324   }
325325   if ( y < 240 ) {
326326      /* Draw a line of the display */
r1877r1878
424424
425425MACHINE_RESET( osborne1 ) {
426426   /* Initialize memory configuration */
427   osborne1_bankswitch_w( 0x00, 0 );
427   osborne1_bankswitch_w( machine, 0x00, 0 );
428428
429429   osborne1.pia_0_irq_state = FALSE;
430430   osborne1.pia_1_irq_state = FALSE;
r1877r1878
435435
436436   osborne1.video_timer = timer_alloc( osborne1_video_callback , NULL);
437437   timer_adjust_oneshot(osborne1.video_timer, video_screen_get_time_until_pos( 0, 1, 0 ), 0);
438   pia_1_ca1_w( 0, 0 );
438   pia_1_ca1_w( machine, 0, 0 );
439439
440440   timer_set( attotime_zero, NULL, 0, setup_beep );
441441
src/mess/machine/amstrad.c
r1877r1878
2828#include "devices/snapquik.h"
2929#include "includes/amstrad.h"
3030#include "sound/ay8910.h"
31#include "deprecat.h"
3132
3233
3334void amstrad_setup_machine(void)
r1877r1878
3839/* load CPCEMU style snapshots */
3940void amstrad_handle_snapshot(unsigned char *pSnapshot)
4041{
42   running_machine *machine = Machine;
4143   int RegData;
4244   int i;
4345
r1877r1878
144146   /* PSG */
145147   for (i=0; i<16; i++)
146148   {
147      AY8910_control_port_0_w(0,i);
149      AY8910_control_port_0_w(machine, 0,i);
148150
149      AY8910_write_port_0_w(0,pSnapshot[0x05b + i] & 0x0ff);
151      AY8910_write_port_0_w(machine, 0,pSnapshot[0x05b + i] & 0x0ff);
150152   }
151153
152   AY8910_control_port_0_w(0,pSnapshot[0x05a]);
154   AY8910_control_port_0_w(machine, 0,pSnapshot[0x05a]);
153155
154156   {
155157      int MemSize;
src/mess/machine/99_peb.h
r1877r1878
55/*
66   prototype for CRU handlers in expansion system
77*/
8typedef int (*cru_read_handler)(int offset);
9typedef void (*cru_write_handler)(int offset, int data);
8typedef int (*cru_read_handler)(running_machine *machine, int offset);
9typedef void (*cru_write_handler)(running_machine *machine, int offset, int data);
1010
1111/*
1212   Descriptor for TI peripheral expansion cards (8-bit bus)
r1877r1878
1616   cru_read_handler cru_read;      /* card CRU read handler */
1717   cru_write_handler cru_write;   /* card CRU handler */
1818
19   read8_handler mem_read;      /* card mem read handler (8 bits) */
20   write8_handler mem_write;   /* card mem write handler (8 bits) */
19   read8_machine_func mem_read;      /* card mem read handler (8 bits) */
20   write8_machine_func mem_write;   /* card mem write handler (8 bits) */
2121} ti99_peb_card_handlers_t;
2222
2323/*
r1877r1878
3030   cru_read_handler cru_read;      /* card CRU read handler */
3131   cru_write_handler cru_write;   /* card CRU handler */
3232
33   read16_handler mem_read;      /* card mem read handler (16 bits) */
34   write16_handler mem_write;      /* card mem write handler (16 bits) */
33   read16_machine_func mem_read;      /* card mem read handler (16 bits) */
34   write16_machine_func mem_write;      /* card mem write handler (16 bits) */
3535} ti99_peb_16bit_card_handlers_t;
3636
3737/* masks for ila and ilb */
src/mess/machine/sms.c
r1877r1878
242242      smsVersion = (data & 0xA0);
243243   }
244244   if ( data & 0x08 ) {
245      sms_input_write( 0, ( data & 0x20 ) >> 5 );
245      sms_input_write( machine, 0, ( data & 0x20 ) >> 5 );
246246   }
247247   if ( data & 0x02 ) {
248      sms_input_write( 1, ( data & 0x80 ) >> 7 );
248      sms_input_write( machine, 1, ( data & 0x80 ) >> 7 );
249249   }
250250}
251251
r1877r1878
273273
274274READ8_HANDLER(sms_count_r) {
275275   if ( offset & 0x01 ) {
276      return sms_vdp_hcount_r(offset);
276      return sms_vdp_hcount_r(machine, offset);
277277   } else {
278278      /* VCount read */
279      return sms_vdp_vcount_r(offset);
279      return sms_vdp_vcount_r(machine, offset);
280280   }
281281}
282282
r1877r1878
305305
306306WRITE8_HANDLER(sms_YM2413_register_port_0_w) {
307307   if ( HAS_FM ) {
308      YM2413_register_port_0_w(offset, (data & 0x3F));
308      YM2413_register_port_0_w(machine, offset, (data & 0x3F));
309309   }
310310}
311311
312312WRITE8_HANDLER(sms_YM2413_data_port_0_w) {
313313   if ( HAS_FM ) {
314314      logerror("data_port_0_w %x %x\n", offset, data);
315      YM2413_data_port_0_w(offset, data);
315      YM2413_data_port_0_w(machine, offset, data);
316316   }
317317}
318318
src/mess/machine/wd17xx.c
r1877r1878
15821582
15831583   switch(offset % 4) {
15841584   case 0:
1585      result = wd17xx_status_r(0);
1585      result = wd17xx_status_r(machine, 0);
15861586      break;
15871587   case 1:
1588      result = wd17xx_track_r(0);
1588      result = wd17xx_track_r(machine, 0);
15891589      break;
15901590   case 2:
1591      result = wd17xx_sector_r(0);
1591      result = wd17xx_sector_r(machine, 0);
15921592      break;
15931593   case 3:
1594      result = wd17xx_data_r(0);
1594      result = wd17xx_data_r(machine, 0);
15951595      break;
15961596   }
15971597   return result;
r1877r1878
16031603{
16041604   switch(offset % 4) {
16051605   case 0:
1606      wd17xx_command_w(0, data);
1606      wd17xx_command_w(machine, 0, data);
16071607      break;
16081608   case 1:
1609      wd17xx_track_w(0, data);
1609      wd17xx_track_w(machine, 0, data);
16101610      break;
16111611   case 2:
1612      wd17xx_sector_w(0, data);
1612      wd17xx_sector_w(machine, 0, data);
16131613      break;
16141614   case 3:
1615      wd17xx_data_w(0, data);
1615      wd17xx_data_w(machine, 0, data);
16161616      break;
16171617   }
16181618}
src/mess/machine/coupe.c
r1877r1878
3939
4040static void coupe_update_bank(int bank, UINT8 *memory, int is_readonly)
4141{
42   read8_handler rh;
43   write8_handler wh;
42   read8_machine_func rh;
43   write8_machine_func wh;
4444
4545   if (memory)
4646      memory_set_bankptr(bank, memory);
4747
48   rh = !memory ? MRA8_NOP :                        (read8_handler) (STATIC_BANK1 + (FPTR)bank - 1);
49   wh = !memory ? MWA8_NOP : (is_readonly ? MWA8_UNMAP :   (write8_handler) (STATIC_BANK1 + (FPTR)bank - 1));
48   rh = !memory ? MRA8_NOP :                        (read8_machine_func) (STATIC_BANK1 + (FPTR)bank - 1);
49   wh = !memory ? MWA8_NOP : (is_readonly ? MWA8_UNMAP :   (write8_machine_func) (STATIC_BANK1 + (FPTR)bank - 1));
5050
5151   memory_install_read8_handler(0,  ADDRESS_SPACE_PROGRAM, ((bank-1) * 0x4000), ((bank-1) * 0x4000) + 0x3FFF, 0, 0, rh);
5252   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, ((bank-1) * 0x4000), ((bank-1) * 0x4000) + 0x3FFF, 0, 0, wh);
src/mess/machine/cybiko.c
r1877r1878
433433{
434434   UINT16 data = 0;
435435   _logerror( 2, ("cybiko_key_r (%08X/%04X)\n", offset, mem_mask));
436   if ACCESSING_MSB16 data = data | (cybiko_key_r_byte( offset * 2 + 0) << 8);
437   if ACCESSING_LSB16 data = data | (cybiko_key_r_byte( offset * 2 + 1) << 0);
436   if ACCESSING_MSB16 data = data | (cybiko_key_r_byte(machine, offset * 2 + 0) << 8);
437   if ACCESSING_LSB16 data = data | (cybiko_key_r_byte(machine, offset * 2 + 1) << 0);
438438   _logerror( 2, ("%04X\n", data));
439439   return data;
440440}
r1877r1878
504504READ8_HANDLER( cybikov1_io_reg_r )
505505{
506506   _logerror( 2, ("cybikov1_io_reg_r (%08X)\n", offset));
507   return cybiko_io_reg_r( offset);
507   return cybiko_io_reg_r(machine, offset);
508508}
509509
510510READ8_HANDLER( cybikov2_io_reg_r )
511511{
512512   _logerror( 2, ("cybikov2_io_reg_r (%08X)\n", offset));
513   return cybiko_io_reg_r( offset);
513   return cybiko_io_reg_r(machine, offset);
514514}
515515
516516READ8_HANDLER( cybikoxt_io_reg_r )
r1877r1878
522522      // rs232
523523      case H8S_IO_PORT3 : if (cybiko_rs232_pin_rxd()) data = data | H8S_P3_RXD1; break;
524524      // default
525      default : data = cybiko_io_reg_r( offset);
525      default : data = cybiko_io_reg_r(machine, offset);
526526   }
527527   return data;
528528}
r1877r1878
530530WRITE8_HANDLER( cybikov1_io_reg_w )
531531{
532532   _logerror( 2, ("cybikov1_io_reg_w (%08X/%02X)\n", offset, data));
533   cybiko_io_reg_w( offset, data);
533   cybiko_io_reg_w(machine, offset, data);
534534}
535535
536536WRITE8_HANDLER( cybikov2_io_reg_w )
537537{
538538   _logerror( 2, ("cybikov2_io_reg_w (%08X/%02X)\n", offset, data));
539   cybiko_io_reg_w( offset, data);
539   cybiko_io_reg_w(machine, offset, data);
540540}
541541
542542WRITE8_HANDLER( cybikoxt_io_reg_w )
r1877r1878
552552      }
553553      break;
554554      // default
555      default : cybiko_io_reg_w( offset, data);
555      default : cybiko_io_reg_w(machine, offset, data);
556556   }
557557}
558558
src/mess/machine/trs80.c
r1877r1878
755755   int result = 0;
756756
757757   if (offset & 1)
758      result |= input_port_1_r(0);
758      result |= readinputport(1);
759759   if (offset & 2)
760      result |= input_port_2_r(0);
760      result |= readinputport(2);
761761   if (offset & 4)
762      result |= input_port_3_r(0);
762      result |= readinputport(3);
763763   if (offset & 8)
764      result |= input_port_4_r(0);
764      result |= readinputport(4);
765765   if (offset & 16)
766      result |= input_port_5_r(0);
766      result |= readinputport(5);
767767   if (offset & 32)
768      result |= input_port_6_r(0);
768      result |= readinputport(6);
769769   if (offset & 64)
770      result |= input_port_7_r(0);
770      result |= readinputport(7);
771771   if (offset & 128)
772      result |= input_port_8_r(0);
772      result |= readinputport(8);
773773
774774   return result;
775775}
src/mess/machine/odyssey2.c
r1877r1878
7171READ8_HANDLER( odyssey2_bus_r )
7272{
7373    if ((p1 & (P1_VDC_COPY_MODE_ENABLE | P1_VDC_ENABLE)) == 0)
74      return odyssey2_video_r(offset); /* seems to have higher priority than ram??? */
74      return odyssey2_video_r(machine, offset); /* seems to have higher priority than ram??? */
7575
7676    else if (!(p1 & P1_EXT_RAM_ENABLE))
7777      return ram[offset];
r1877r1878
8686      if ( offset & 0x80 ) {
8787         if ( data & 0x20 ) {
8888            logerror("voice write %02X, data = %02X (p1 = %02X)\n", offset, data, p1 );
89            sp0256_ALD_w( 0, offset & 0x7F );
89            sp0256_ALD_w( machine, 0, offset & 0x7F );
9090         } else {
9191            /* TODO: Reset sp0256 in this case */
9292         }
r1877r1878
9494   }
9595
9696    else if (!(p1 & P1_VDC_ENABLE))
97      odyssey2_video_w(offset, data);
97      odyssey2_video_w(machine, offset, data);
9898}
9999
100100READ8_HANDLER( g7400_bus_r )
101101{
102102   if ((p1 & (P1_VDC_COPY_MODE_ENABLE | P1_VDC_ENABLE)) == 0) {
103      return odyssey2_video_r(offset); /* seems to have higher priority than ram??? */
103      return odyssey2_video_r(machine, offset); /* seems to have higher priority than ram??? */
104104   }
105105   else if (!(p1 & P1_EXT_RAM_ENABLE)) {
106106      return ram[offset];
r1877r1878
117117      ram[offset] = data;
118118   }
119119   else if (!(p1 & P1_VDC_ENABLE)) {
120      odyssey2_video_w(offset, data);
120      odyssey2_video_w(machine, offset, data);
121121   } else {
122122//      ef9341_w( offset & 0x02, offset & 0x01, data );
123123   }
r1877r1878
139139
140140   odyssey2_switch_banks();
141141
142   odyssey2_lum_w ( 0, p1 >> 7 );
142   odyssey2_lum_w ( machine, 0, p1 >> 7 );
143143
144144    logerror("%.6f p1 written %.2x\n", attotime_to_double(timer_get_time()), data);
145145}
src/mess/machine/apple2.c
r1877r1878
106106   int i, bank, rbank, wbank;
107107   int full_update = 0;
108108   apple2_meminfo meminfo;
109   read8_handler rh;
110   write8_handler wh;
109   read8_machine_func rh;
110   write8_machine_func wh;
111111   offs_t begin, end_r, end_w;
112112   UINT8 *rbase, *wbase, *rom, *slot_ram;
113113   UINT32 rom_length, slot_length, offset;
r1877r1878
147147         rbank = (bank_disposition != A2MEM_IO) ? bank : 0;
148148         begin = apple2_mem_config.memmap[i].begin;
149149         end_r = apple2_mem_config.memmap[i].end;
150         rh = (read8_handler) (STATIC_BANK1 + (FPTR)(rbank - 1));
150         rh = (read8_machine_func) (STATIC_BANK1 + (FPTR)(rbank - 1));
151151
152152         LOG(("apple2_update_memory():  Updating RD {%06X..%06X} [#%02d] --> %08X\n",
153153            begin, end_r, rbank, meminfo.read_mem));
r1877r1878
227227            wbank = 0;
228228         begin = apple2_mem_config.memmap[i].begin;
229229         end_w = apple2_mem_config.memmap[i].end;
230         wh = (write8_handler) (STATIC_BANK1 + (FPTR)(wbank - 1));
230         wh = (write8_machine_func) (STATIC_BANK1 + (FPTR)(wbank - 1));
231231
232232         LOG(("apple2_update_memory():  Updating WR {%06X..%06X} [#%02d] --> %08X\n",
233233            begin, end_w, wbank, meminfo.write_mem));
r1877r1878
299299
300300READ8_HANDLER(apple2_c0xx_r)
301301{
302   static const read8_handler handlers[] =
302   static const read8_machine_func handlers[] =
303303   {
304304      apple2_c00x_r,
305305      apple2_c01x_r,
r1877r1878
312312   };
313313   UINT8 result = 0x00;
314314   int slot;
315   running_machine *machine = Machine;
316315
317316   offset &= 0xFF;
318317
319318   if (offset < 0x80)
320319   {
321320      if (handlers[offset / 0x10])
322         result = handlers[offset / 0x10](offset % 0x10);
321         result = handlers[offset / 0x10](machine, offset % 0x10);
323322   }
324323   else
325324   {
r1877r1878
334333
335334WRITE8_HANDLER(apple2_c0xx_w)
336335{
337   static const write8_handler handlers[] =
336   static const write8_machine_func handlers[] =
338337   {
339338      apple2_c00x_w,
340339      apple2_c01x_w,
r1877r1878
346345      apple2_c07x_w
347346   };
348347   int slot;
349   running_machine *machine = Machine;
350348
351349   offset &= 0xFF;
352350
353351   if (offset < 0x80)
354352   {
355353      if (handlers[offset / 0x10])
356         handlers[offset / 0x10](offset % 0x10, data);
354         handlers[offset / 0x10](machine, offset % 0x10, data);
357355   }
358356   else
359357   {
r1877r1878
923921
924922READ8_HANDLER( apple2_c02x_r )
925923{
926   apple2_c02x_w(offset, 0);
924   apple2_c02x_w(machine, offset, 0);
927925   return apple2_getfloatingbusvalue();
928926}
929927
r1877r1878
970968
971969WRITE8_HANDLER ( apple2_c03x_w )
972970{
973   apple2_c03x_r(offset);
971   apple2_c03x_r(machine, offset);
974972}
975973
976974
r1877r1878
1000998
1001999WRITE8_HANDLER ( apple2_c05x_w )
10021000{
1003   apple2_c05x_r(offset);
1001   apple2_c05x_r(machine, offset);
10041002}
10051003
10061004
r1877r1878
10811079
10821080WRITE8_HANDLER ( apple2_c07x_w )
10831081{
1084   apple2_c07x_r(offset);
1082   apple2_c07x_r(machine, offset);
10851083}
10861084
10871085
r1877r1878
11281126
11291127static WRITE8_HANDLER ( apple2_c08x_w )
11301128{
1131   apple2_c08x_r(offset);
1129   apple2_c08x_r(machine, offset);
11321130}
11331131
11341132
r1877r1878
11391137
11401138static UINT8 apple2_langcard_read(running_machine *machine, void *token, offs_t offset)
11411139{
1142   return apple2_c08x_r(offset);
1140   return apple2_c08x_r(machine, offset);
11431141
11441142}
11451143
r1877r1878
11471145
11481146static void apple2_langcard_write(running_machine *machine, void *token, offs_t offset, UINT8 data)
11491147{
1150   apple2_c08x_w(offset, data);
1148   apple2_c08x_w(machine, offset, data);
11511149}
11521150
11531151
r1877r1878
12251223            case 0x04: /* make inactive */
12261224               break;
12271225            case 0x06: /* write data */
1228               AY8910_write_port_0_w (0, latch0);
1226               AY8910_write_port_0_w (machine, 0, latch0);
12291227               break;
12301228            case 0x07: /* set register */
1231               AY8910_control_port_0_w (0, latch0);
1229               AY8910_control_port_0_w (machine, 0, latch0);
12321230               break;
12331231         }
12341232         break;
r1877r1878
12501248            case 0x04: /* make inactive */
12511249               break;
12521250            case 0x06: /* write data */
1253               AY8910_write_port_1_w (0, latch1);
1251               AY8910_write_port_1_w (machine, 0, latch1);
12541252               break;
12551253            case 0x07: /* set register */
1256               AY8910_control_port_1_w (0, latch1);
1254               AY8910_control_port_1_w (machine, 0, latch1);
12571255               break;
12581256         }
12591257         break;
r1877r1878
14731471
14741472static UINT8 apple2_fdc_read(running_machine *machine, void *token, offs_t offset)
14751473{
1476   return applefdc_r(offset);
1474   return applefdc_r(machine, offset);
14771475}
14781476
14791477
14801478
14811479static void apple2_fdc_write(running_machine *machine, void *token, offs_t offset, UINT8 data)
14821480{
1483   applefdc_w(offset, data);
1481   applefdc_w(machine, offset, data);
14841482}
14851483
14861484
src/mess/machine/ti85.c
r1877r1878
138138
139139static void update_ti86_memory (void)
140140{
141   write8_handler wh;
141   write8_machine_func wh;
142142
143143   if (ti85_memory_page_0x4000 & 0x40)
144144   {
src/mess/machine/c64.c
r1877r1878
473473{
474474   c64_io_mirror[ offset ] = data;
475475   if (offset < 0x400) {
476      vic2_port_w (offset & 0x3ff, data);
476      vic2_port_w (machine, offset & 0x3ff, data);
477477   } else if (offset < 0x800) {
478      sid6581_0_port_w (offset & 0x3ff, data);
478      sid6581_0_port_w (machine, offset & 0x3ff, data);
479479   } else if (offset < 0xc00)
480480      c64_colorram[offset & 0x3ff] = data | 0xf0;
481481   else if (offset < 0xd00)
482      cia_0_w(offset, data);
482      cia_0_w(machine, offset, data);
483483   else if (offset < 0xe00)
484484   {
485485      if (c64_cia1_on)
486         cia_1_w(offset, data);
486         cia_1_w(machine, offset, data);
487487      else
488488         DBG_LOG (1, "io write", ("%.3x %.2x\n", offset, data));
489489   }
r1877r1878
515515WRITE8_HANDLER(c64_ioarea_w)
516516{
517517   if ( c64_io_enabled ) {
518      c64_write_io( offset, data );
518      c64_write_io( machine, offset, data );
519519   } else {
520520      c64_io_ram_w_ptr[ offset ] = data;
521521   }
r1877r1878
524524READ8_HANDLER( c64_read_io )
525525{
526526   if (offset < 0x400)
527      return vic2_port_r (offset & 0x3ff);
527      return vic2_port_r (machine, offset & 0x3ff);
528528   else if (offset < 0x800)
529      return sid6581_0_port_r (offset & 0x3ff);
529      return sid6581_0_port_r (machine, offset & 0x3ff);
530530   else if (offset < 0xc00)
531531      return c64_colorram[offset & 0x3ff];
532532   else if (offset < 0xd00)
533      return cia_0_r(offset);
533      return cia_0_r(machine, offset);
534534   else if (c64_cia1_on && (offset < 0xe00))
535      return cia_1_r(offset);
535      return cia_1_r(machine, offset);
536536   DBG_LOG (1, "io read", ("%.3x\n", offset));
537537   return 0xff;
538538}
r1877r1878
540540READ8_HANDLER(c64_ioarea_r)
541541{
542542   if ( c64_io_enabled ) {
543      return c64_read_io( offset );
543      return c64_read_io( machine, offset );
544544   }
545545   return c64_io_ram_r_ptr[ offset ];
546546}
r1877r1878
974974         opcode_base = c64_io_mirror;
975975         opcode_memory_min = 0x0000;
976976         opcode_memory_max = 0xcfff;
977         c64_io_mirror[address & 0x0fff] = c64_read_io( address & 0x0fff );
977         c64_io_mirror[address & 0x0fff] = c64_read_io( machine, address & 0x0fff );
978978      } else {
979979         opcode_mask = 0x0fff;
980980         opcode_arg_base = c64_io_ram_r_ptr;
src/mess/machine/svi318.c
r1877r1878
239239
240240READ8_HANDLER( svi318_ppi_r )
241241{
242   return ppi8255_0_r (offset);
242   return ppi8255_0_r(machine, offset);
243243}
244244
245245WRITE8_HANDLER( svi318_ppi_w )
246246{
247   ppi8255_0_w (offset + 2, data);
247   ppi8255_0_w(machine, offset + 2, data);
248248}
249249
250250/* Printer port */
r1877r1878
451451   }
452452}
453453
454static void svi806_set_crtc_register(UINT8 reg, UINT8 data) {
455   mc6845_address_w(mc6845, reg);
456   mc6845_register_w(mc6845, data);
454static void svi806_set_crtc_register(UINT8 reg, UINT8 data) {   
455   /*
456      NPW 9-Mar-2008 - This is bad; commenting out
457
458      mc6845_address_w(mc6845, 0, reg);
459      mc6845_register_w(mc6845, 0, data);
460   */
457461}
458462
459463static TIMER_CALLBACK(svi318_80col_init_registers) {
r1877r1878
491495   timer_set( attotime_zero, NULL, 0, svi318_80col_init_registers );
492496}
493497
494READ8_HANDLER( svi806_r )
495{
496   return mc6845_register_r( mc6845 );
497}
498
499WRITE8_HANDLER( svi806_w )
500{
501   switch( offset ) {
502   case 0:
503      mc6845_address_w( mc6845, data );
504      break;
505   case 1:
506      mc6845_register_w( mc6845, data );
507      break;
508   }
509}
510
511498WRITE8_HANDLER( svi806_ram_enable_w )
512499{
513500   svi.svi806_ram_enabled = ( data & 0x01 );
r1877r1878
644631   TMS9928A_reset();
645632
646633   /* PPI */
647   ppi8255_0_w(3, 0x92);
634   ppi8255_0_w(machine, 3, 0x92);
648635
649636   svi.bank_switch = 0xff;
650637   svi318_set_banks();
src/mess/machine/99_hsgpl.c
r1877r1878
114114   cr_ramena  = 0x8000
115115};
116116
117static void hsgpl_cru_w(int offset, int data);
118static  READ8_HANDLER(hsgpl_dsr_r);
117static void hsgpl_cru_w(running_machine *machine, int offset, int data);
118static READ8_HANDLER(hsgpl_dsr_r);
119119
120120static const ti99_peb_card_handlers_t hsgpl_handlers =
121121{
r1877r1878
285285/*
286286   Write hsgpl CRU interface
287287*/
288static void hsgpl_cru_w(int offset, int data)
288static void hsgpl_cru_w(running_machine *machine, int offset, int data)
289289{
290290   offset &= 0xf;
291291
src/mess/machine/pc.c
r1877r1878
149149
150150
151151
152static void pc_map_vga_memory(offs_t begin, offs_t end, read8_handler rh, write8_handler wh)
152static void pc_map_vga_memory(offs_t begin, offs_t end, read8_machine_func rh, write8_machine_func wh)
153153{
154154   int buswidth;
155155   buswidth = cputype_databus_width(Machine->config->cpu[0].type, ADDRESS_SPACE_PROGRAM);
src/mess/machine/amstr_pc.c
r1877r1878
200200
201201 READ8_HANDLER( pc200_port378_r )
202202{
203   int data=pc_parallelport1_r(offset);
204   if (offset==1) data=(data&~7)|(input_port_1_r(0)&7);
205   if (offset==2) data=(data&~0xe0)|(input_port_1_r(0)&0xc0);
203   int data=pc_parallelport1_r(machine, offset);
204   if (offset==1) data=(data&~7)|(readinputport(1)&7);
205   if (offset==2) data=(data&~0xe0)|(readinputport(1)&0xc0);
206206   return data;
207207}
208208
209209
210210 READ8_HANDLER( pc1640_port378_r )
211211{
212   int data=pc_parallelport1_r(offset);
213   if (offset==1) data=(data&~7)|(input_port_1_r(0)&7);
212   int data=pc_parallelport1_r(machine, offset);
213   if (offset==1) data=(data&~7)|(readinputport(1)&7);
214214   if (offset==2) {
215215      switch (pc1640.dipstate) {
216216      case 0:
217         data=(data&~0xe0)|(input_port_1_r(0)&0xe0);
217         data=(data&~0xe0)|(readinputport(1)&0xe0);
218218         break;
219219      case 1:
220         data=(data&~0xe0)|((input_port_1_r(0)&0xe000)>>8);
220         data=(data&~0xe0)|((readinputport(1)&0xe000)>>8);
221221         break;
222222      case 2:
223         data=(data&~0xe0)|((input_port_1_r(0)&0xe00)>>4);
223         data=(data&~0xe0)|((readinputport(1)&0xe00)>>4);
224224         break;
225225
226226      }
r1877r1878
231231 READ8_HANDLER( pc1640_port3d0_r )
232232{
233233   if (offset==0xa) pc1640.dipstate=0;
234   return vga_port_03d0_r(offset);
234   return vga_port_03d0_r(machine, offset);
235235}
236236
237237 READ8_HANDLER( pc1640_port4278_r )
r1877r1878
250250
251251static READ8_HANDLER( pc1640_mouse_x_r )
252252{
253   return pc1640.mouse.x-input_port_13_r(0);
253   return pc1640.mouse.x-readinputport(13);
254254}
255255
256256static READ8_HANDLER( pc1640_mouse_y_r )
257257{
258   return pc1640.mouse.y-input_port_14_r(0);
258   return pc1640.mouse.y-readinputport(14);
259259}
260260
261261static WRITE8_HANDLER( pc1640_mouse_x_w )
262262{
263   pc1640.mouse.x=data+input_port_13_r(0);
263   pc1640.mouse.x=data+readinputport(13);
264264}
265265
266266static WRITE8_HANDLER( pc1640_mouse_y_w )
267267{
268   pc1640.mouse.y=data+input_port_14_r(0);
268   pc1640.mouse.y=data+readinputport(14);
269269}
270270
271READ16_HANDLER( pc1640_16le_mouse_x_r )    { return read16le_with_read8_handler(pc1640_mouse_x_r, offset, mem_mask); }
272READ16_HANDLER( pc1640_16le_mouse_y_r )  { return read16le_with_read8_handler(pc1640_mouse_y_r, offset, mem_mask); }
273WRITE16_HANDLER( pc1640_16le_mouse_x_w ) { write16le_with_write8_handler(pc1640_mouse_x_w, offset, data, mem_mask); }
274WRITE16_HANDLER( pc1640_16le_mouse_y_w ) { write16le_with_write8_handler(pc1640_mouse_y_w, offset, data, mem_mask); }
271READ16_HANDLER( pc1640_16le_mouse_x_r )    { return read16le_with_read8_handler(pc1640_mouse_x_r, machine, offset, mem_mask); }
272READ16_HANDLER( pc1640_16le_mouse_y_r )  { return read16le_with_read8_handler(pc1640_mouse_y_r, machine, offset, mem_mask); }
273WRITE16_HANDLER( pc1640_16le_mouse_x_w ) { write16le_with_write8_handler(pc1640_mouse_x_w, machine, offset, data, mem_mask); }
274WRITE16_HANDLER( pc1640_16le_mouse_y_w ) { write16le_with_write8_handler(pc1640_mouse_y_w, machine, offset, data, mem_mask); }
275275
276276INPUT_PORTS_START( amstrad_keyboard )
277277
r1877r1878
402402INPUT_PORTS_END
403403
404404
405READ16_HANDLER( pc1640_16le_port60_r ) { return read16le_with_read8_handler(pc1640_port60_r, offset, mem_mask); }
406WRITE16_HANDLER( pc1640_16le_port60_w ) { write16le_with_write8_handler(pc1640_port60_w, offset, data, mem_mask); }
405READ16_HANDLER( pc1640_16le_port60_r ) { return read16le_with_read8_handler(pc1640_port60_r, machine, offset, mem_mask); }
406WRITE16_HANDLER( pc1640_16le_port60_w ) { write16le_with_write8_handler(pc1640_port60_w, machine, offset, data, mem_mask); }
407407
408READ16_HANDLER( pc200_16le_port378_r ) { return read16le_with_read8_handler(pc200_port378_r, offset, mem_mask); }
409READ16_HANDLER( pc1640_16le_port378_r ) { return read16le_with_read8_handler(pc1640_port378_r, offset, mem_mask); }
410READ16_HANDLER( pc1640_16le_port3d0_r ) { return read16le_with_read8_handler(pc1640_port3d0_r, offset, mem_mask); }
411READ16_HANDLER( pc1640_16le_port4278_r ) { return read16le_with_read8_handler(pc1640_port4278_r, offset, mem_mask); }
412READ16_HANDLER( pc1640_16le_port278_r ) { return read16le_with_read8_handler(pc1640_port278_r, offset, mem_mask); }
408READ16_HANDLER( pc200_16le_port378_r ) { return read16le_with_read8_handler(pc200_port378_r, machine, offset, mem_mask); }
409READ16_HANDLER( pc1640_16le_port378_r ) { return read16le_with_read8_handler(pc1640_port378_r, machine, offset, mem_mask); }
410READ16_HANDLER( pc1640_16le_port3d0_r ) { return read16le_with_read8_handler(pc1640_port3d0_r, machine, offset, mem_mask); }
411READ16_HANDLER( pc1640_16le_port4278_r ) { return read16le_with_read8_handler(pc1640_port4278_r, machine, offset, mem_mask); }
412READ16_HANDLER( pc1640_16le_port278_r ) { return read16le_with_read8_handler(pc1640_port278_r, machine, offset, mem_mask); }
src/mess/machine/ti99_4x.c
r1877r1878
10221022
10231023   if (hsgpl_crdena)
10241024      /* hsgpl is enabled */
1025      return ti99_hsgpl_rom6_r(offset, mem_mask);
1025      return ti99_hsgpl_rom6_r(machine, offset, mem_mask);
10261026
10271027   if (cartridge_mbx && (offset >= 0x0600) && (offset <= 0x07fe))
10281028      return (cartridge_pages[0])[offset];
r1877r1878
10361036
10371037   if (hsgpl_crdena)
10381038      /* hsgpl is enabled */
1039      ti99_hsgpl_rom6_w(offset, data, mem_mask);
1039      ti99_hsgpl_rom6_w(machine, offset, data, mem_mask);
10401040   else if (cartridge_minimemory && offset >= 0x800)
10411041      /* handle minimem RAM */
10421042      COMBINE_DATA(current_page_ptr+offset);
r1877r1878
10661066
10671067   if (hsgpl_crdena)
10681068      /* hsgpl is enabled */
1069      return ti99_hsgpl_rom6_r(offset, mem_mask);
1069      return ti99_hsgpl_rom6_r(machine, offset, mem_mask);
10701070
10711071   return 0;
10721072}
r1877r1878
10831083
10841084   if (hsgpl_crdena)
10851085      /* hsgpl is enabled */
1086      ti99_hsgpl_rom6_w(offset, data, mem_mask);
1086      ti99_hsgpl_rom6_w(machine, offset, data, mem_mask);
10871087}
10881088
10891089/*---------------------------------------------------------------------------*/
r1877r1878
11231123{
11241124   activecpu_adjust_icount(-4);
11251125
1126   SN76496_0_w(offset, (data >> 8) & 0xff);
1126   SN76496_0_w(machine, offset, (data >> 8) & 0xff);
11271127}
11281128
11291129/*
r1877r1878
11351135
11361136   if (offset & 1)
11371137   {   /* read VDP status */
1138      return ((int) TMS9928A_register_r(0)) << 8;
1138      return ((int) TMS9928A_register_r(machine, 0)) << 8;
11391139   }
11401140   else
11411141   {   /* read VDP RAM */
1142      return ((int) TMS9928A_vram_r(0)) << 8;
1142      return ((int) TMS9928A_vram_r(machine, 0)) << 8;
11431143   }
11441144}
11451145
r1877r1878
11521152
11531153   if (offset & 1)
11541154   {   /* write VDP address */
1155      TMS9928A_register_w(0, (data >> 8) & 0xff);
1155      TMS9928A_register_w(machine, 0, (data >> 8) & 0xff);
11561156   }
11571157   else
11581158   {   /* write VDP data */
1159      TMS9928A_vram_w(0, (data >> 8) & 0xff);
1159      TMS9928A_vram_w(machine, 0, (data >> 8) & 0xff);
11601160   }
11611161}
11621162
r1877r1878
11691169
11701170   if (offset & 1)
11711171   {   /* read VDP status */
1172      return ((int) v9938_status_r(0)) << 8;
1172      return ((int) v9938_status_r(machine, 0)) << 8;
11731173   }
11741174   else
11751175   {   /* read VDP RAM */
1176      return ((int) v9938_vram_r(0)) << 8;
1176      return ((int) v9938_vram_r(machine, 0)) << 8;
11771177   }
11781178}
11791179
r1877r1878
11881188   {
11891189   case 0:
11901190      /* write VDP data */
1191      v9938_vram_w(0, (data >> 8) & 0xff);
1191      v9938_vram_w(machine, 0, (data >> 8) & 0xff);
11921192      break;
11931193   case 1:
11941194      /* write VDP address */
1195      v9938_command_w(0, (data >> 8) & 0xff);
1195      v9938_command_w(machine, 0, (data >> 8) & 0xff);
11961196      break;
11971197   case 2:
11981198      /* write VDP palette */
1199      v9938_palette_w(0, (data >> 8) & 0xff);
1199      v9938_palette_w(machine, 0, (data >> 8) & 0xff);
12001200      break;
12011201   case 3:
12021202      /* write VDP register */
1203      v9938_register_w(0, (data >> 8) & 0xff);
1203      v9938_register_w(machine, 0, (data >> 8) & 0xff);
12041204      break;
12051205   }
12061206}
r1877r1878
12121212{
12131213   activecpu_adjust_icount(-(18+3));      /* this is just a minimum, it can be more */
12141214
1215   return ((int) tms5220_status_r(offset)) << 8;
1215   return ((int) tms5220_status_r(machine, offset)) << 8;
12161216}
12171217
12181218#if 0
r1877r1878
12551255   }
12561256#endif
12571257
1258   tms5220_data_w(offset, (data >> 8) & 0xff);
1258   tms5220_data_w(machine, offset, (data >> 8) & 0xff);
12591259}
12601260
12611261/*
r1877r1878
12971297
12981298   if (hsgpl_crdena)
12991299      /* hsgpl buffers are stronger than console GROM buffers */
1300      reply = ti99_hsgpl_gpl_r(offset, mem_mask);
1300      reply = ti99_hsgpl_gpl_r(machine, offset, mem_mask);
13011301
13021302   return reply;
13031303}
r1877r1878
13451345   }
13461346
13471347   if (hsgpl_crdena)
1348      ti99_hsgpl_gpl_w(offset, data, mem_mask);
1348      ti99_hsgpl_gpl_w(machine, offset, data, mem_mask);
13491349}
13501350
13511351/*
r1877r1878
13551355{
13561356   activecpu_adjust_icount(-4);      /* HSGPL is located on 8-bit bus? */
13571357
1358   return /*hsgpl_crdena ?*/ ti99_hsgpl_gpl_r(offset, mem_mask) /*: 0*/;
1358   return /*hsgpl_crdena ?*/ ti99_hsgpl_gpl_r(machine, offset, mem_mask) /*: 0*/;
13591359}
13601360
13611361/*
r1877r1878
13661366   activecpu_adjust_icount(-4);      /* HSGPL is located on 8-bit bus? */
13671367
13681368   /*if (hsgpl_crdena)*/
1369      ti99_hsgpl_gpl_w(offset, data, mem_mask);
1369      ti99_hsgpl_gpl_w(machine, offset, data, mem_mask);
13701370}
13711371
13721372
r1877r1878
14161416               {
14171417                  if (offset & 2)
14181418                     /* read VDP status */
1419                     reply = TMS9928A_register_r(0);
1419                     reply = TMS9928A_register_r(machine, 0);
14201420                  else
14211421                     /* read VDP RAM */
1422                     reply = TMS9928A_vram_r(0);
1422                     reply = TMS9928A_vram_r(machine, 0);
14231423               }
14241424            }
14251425            else
r1877r1878
14351435            if (! (offset & 1))
14361436            {
14371437               activecpu_adjust_icount(-16*4);      /* this is just a minimum, it can be more */
1438               reply = tms5220_status_r(0);
1438               reply = tms5220_status_r(machine, 0);
14391439            }
14401440            break;
14411441
14421442         case 6:
14431443            /* GPL read */
14441444            if (! (offset & 1))
1445               reply = ti99_rgpl_r(offset >> 1, 0) >> 8;
1445               reply = ti99_rgpl_r(machine, offset >> 1, 0) >> 8;
14461446            break;
14471447
14481448         default:
r1877r1878
14871487
14881488      case 2:
14891489         /* DSR space */
1490         reply = ti99_8_peb_r(offset & 0x1fff);
1490         reply = ti99_8_peb_r(machine, offset & 0x1fff);
14911491         break;
14921492
14931493      case 3:
r1877r1878
15461546         case 1:
15471547            /* sound write + RAM */
15481548            if (offset < 0x8410)
1549               SN76496_0_w(offset, data);
1549               SN76496_0_w(machine, offset, data);
15501550            else
15511551               sRAM_ptr_8[offset & 0x1fff] = data;
15521552            break;
r1877r1878
15871587            {
15881588               if (offset & 2)
15891589                  /* read VDP status */
1590                  TMS9928A_register_w(0, data);
1590                  TMS9928A_register_w(machine, 0, data);
15911591               else
15921592                  /* read VDP RAM */
1593                  TMS9928A_vram_w(0, data);
1593                  TMS9928A_vram_w(machine, 0, data);
15941594            }
15951595            break;
15961596
r1877r1878
16171617                  timer_set(attotime_zero, NULL, 0, /*speech_kludge_callback*/NULL);
16181618               }
16191619
1620               tms5220_data_w(offset, data);
1620               tms5220_data_w(machine, offset, data);
16211621            }
16221622            break;
16231623
16241624         case 7:
16251625            /* GPL write */
16261626            if (! (offset & 1))
1627               ti99_wgpl_w(offset >> 1, data << 8, 0);
1627               ti99_wgpl_w(machine, offset >> 1, data << 8, 0);
16281628            break;
16291629
16301630         default:
r1877r1878
16641664
16651665      case 2:
16661666         /* DSR space */
1667         ti99_8_peb_w(offset & 0x1fff, data);
1667         ti99_8_peb_w(machine, offset & 0x1fff, data);
16681668         break;
16691669
16701670      case 3:
r1877r1878
24672467*/
24682468
24692469/* prototypes */
2470static void ti99_8_internal_dsr_cru_w(int offset, int data);
2470static void ti99_8_internal_dsr_cru_w(running_machine *machine, int offset, int data);
24712471static  READ8_HANDLER(ti99_8_internal_dsr_r);
24722472
24732473
r1877r1878
24942494/* write CRU bit:
24952495   bit0: enable/disable internal DSR ROM,
24962496   bit1: hard reset */
2497static void ti99_8_internal_dsr_cru_w(int offset, int data)
2497static void ti99_8_internal_dsr_cru_w(running_machine *machine, int offset, int data)
24982498{
24992499   switch (offset)
25002500   {
r1877r1878
25242524*/
25252525
25262526/* prototypes */
2527static void ti99_4p_internal_dsr_cru_w(int offset, int data);
2527static void ti99_4p_internal_dsr_cru_w(running_machine *machine, int offset, int data);
25282528static READ16_HANDLER(ti99_4p_internal_dsr_r);
25292529
25302530
r1877r1878
25582558   bit1: enable/disable internal cartridge ROM
25592559   bit2: set/clear senila
25602560   bit3: set/clear senilb*/
2561static void ti99_4p_internal_dsr_cru_w(int offset, int data)
2561static void ti99_4p_internal_dsr_cru_w(running_machine *machine, int offset, int data)
25622562{
25632563   switch (offset)
25642564   {
r1877r1878
26552655*/
26562656
26572657/* prototypes */
2658static void sAMS_cru_w(int offset, int data);
2658static void sAMS_cru_w(running_machine *machine, int offset, int data);
26592659static  READ8_HANDLER(sAMS_mapper_r);
26602660static WRITE8_HANDLER(sAMS_mapper_w);
26612661
r1877r1878
27002700/* write CRU bit:
27012701   bit0: enable/disable mapper registers in DSR space,
27022702   bit1: enable/disable address mapping */
2703static void sAMS_cru_w(int offset, int data)
2703static void sAMS_cru_w(running_machine *machine, int offset, int data)
27042704{
27052705   if (offset == 1)
27062706      sAMS_mapper_on = data;
r1877r1878
27702770*/
27712771
27722772/* prototypes */
2773static void ti99_4p_mapper_cru_w(int offset, int data);
2773static void ti99_4p_mapper_cru_w(running_machine *machine, int offset, int data);
27742774static READ16_HANDLER(ti99_4p_mapper_r);
27752775static WRITE16_HANDLER(ti99_4p_mapper_w);
27762776
r1877r1878
28422842/* write CRU bit:
28432843   bit0: enable/disable mapper registers in DSR space,
28442844   bit1: enable/disable address mapping */
2845static void ti99_4p_mapper_cru_w(int offset, int data)
2845static void ti99_4p_mapper_cru_w(running_machine *machine, int offset, int data)
28462846{
28472847   int i;
28482848
r1877r1878
29202920   Up to 512kb of RAM.  Straightforward mapper, works with 32kb chunks.
29212921*/
29222922
2923static int myarc_cru_r(int offset);
2924static void myarc_cru_w(int offset, int data);
2923static int myarc_cru_r(running_machine *machine, int offset);
2924static void myarc_cru_w(running_machine *machine, int offset, int data);
29252925
29262926static READ16_HANDLER ( ti99_myarcxramlow_r );
29272927static WRITE16_HANDLER ( ti99_myarcxramlow_w );
r1877r1878
29842984
29852985/* read CRU bit:
29862986   bit 1-2 (128kb) or 1-4 (512kb): read current map offset */
2987static int myarc_cru_r(int offset)
2987static int myarc_cru_r(running_machine *machine, int offset)
29882988{
29892989   /*if (offset == 0)*/   /* right??? */
29902990   {
r1877r1878
29942994
29952995/* write CRU bit:
29962996   bit 1-2 (128kb) or 1-4 (512kb): write map offset */
2997static void myarc_cru_w(int offset, int data)
2997static void myarc_cru_w(running_machine *machine, int offset, int data)
29982998{
29992999   offset &= 0x7;   /* right??? */
30003000   if (offset >= 1)
r1877r1878
30513051*/
30523052
30533053/* prototypes */
3054static int evpc_cru_r(int offset);
3055static void evpc_cru_w(int offset, int data);
3054static int evpc_cru_r(running_machine *machine, int offset);
3055static void evpc_cru_w(running_machine *machine, int offset, int data);
30563056static  READ8_HANDLER(evpc_mem_r);
30573057static WRITE8_HANDLER(evpc_mem_w);
30583058
r1877r1878
30913091/*
30923092   Read evpc CRU interface
30933093*/
3094static int evpc_cru_r(int offset)
3094static int evpc_cru_r(running_machine *machine, int offset)
30953095{
30963096   return 0;   /* dip-switch value */
30973097}
r1877r1878
30993099/*
31003100   Write evpc CRU interface
31013101*/
3102static void evpc_cru_w(int offset, int data)
3102static void evpc_cru_w(running_machine *machine, int offset, int data)
31033103{
31043104   switch (offset)
31053105   {
src/mess/machine/vc20tape.c
r1877r1878
3131
3232   int data;
3333   int motor;
34   write8_handler read_callback;
34   write8_machine_func read_callback;
3535
3636   int type;                     /* 0 nothing */
3737}
r1877r1878
885885      }
886886   }
887887   if (tape.read_callback)
888      tape.read_callback (0, tape.data);
888      tape.read_callback (machine, 0, tape.data);
889889   vc20_prg_state ();
890890}
891891
892void vc20_tape_open (write8_handler read_callback)
892void vc20_tape_open (write8_machine_func read_callback)
893893{
894894   tape.read_callback = read_callback;
895895#ifndef NEW_GAMEDRIVER
src/mess/machine/994x_ser.c
r1877r1878
3131/* prototypes */
3232static void int_callback(int which, int INT);
3333static void xmit_callback(int which, int data);
34static int rs232_cru_r(int offset);
35static void rs232_cru_w(int offset, int data);
36static  READ8_HANDLER(rs232_mem_r);
34static int rs232_cru_r(running_machine *machine, int offset);
35static void rs232_cru_w(running_machine *machine, int offset, int data);
36static READ8_HANDLER(rs232_mem_r);
3737static WRITE8_HANDLER(rs232_mem_w);
3838
3939/* pointer to the rs232 ROM data */
r1877r1878
235235   bit 0: always 0
236236   ...
237237*/
238static int rs232_cru_r(int offset)
238static int rs232_cru_r(running_machine *machine, int offset)
239239{
240240   int reply;
241241
r1877r1878
291291/*
292292   Write rs232 card CRU interface
293293*/
294static void rs232_cru_w(int offset, int data)
294static void rs232_cru_w(running_machine *machine, int offset, int data)
295295{
296296   switch (offset >> 5)
297297   {
src/mess/machine/bbc.c
r1877r1878
574574   if ((offset>=0x200) && (offset<=0x2ff)) /* SHEILA */
575575   {
576576      myo=offset-0x200;
577      if ((myo>=0x00) && (myo<=0x07)) return BBC_6845_r(myo-0x00);      /* Video Controller */
578      if ((myo>=0x08) && (myo<=0x0f)) return BBC_6850_r(myo-0x08);      /* Serial Controller */
577      if ((myo>=0x00) && (myo<=0x07)) return BBC_6845_r(machine, myo-0x00);      /* Video Controller */
578      if ((myo>=0x08) && (myo<=0x0f)) return BBC_6850_r(machine, myo-0x08);      /* Serial Controller */
579579      if ((myo>=0x10) && (myo<=0x17)) return 0xfe;                  /* Serial System Chip */
580      if ((myo>=0x18) && (myo<=0x1f)) return uPD7002_r(myo-0x18);         /* A to D converter */
580      if ((myo>=0x18) && (myo<=0x1f)) return uPD7002_r(machine, myo-0x18);         /* A to D converter */
581581      if ((myo>=0x20) && (myo<=0x23)) return 0xfe;                  /* VideoULA */
582      if ((myo>=0x24) && (myo<=0x27)) return bbcm_wd1770l_read(myo-0x24); /* 1770 */
583      if ((myo>=0x28) && (myo<=0x2f)) return bbcm_wd1770_read(myo-0x28);  /* disc control latch */
582      if ((myo>=0x24) && (myo<=0x27)) return bbcm_wd1770l_read(machine, myo-0x24); /* 1770 */
583      if ((myo>=0x28) && (myo<=0x2f)) return bbcm_wd1770_read(machine, myo-0x28);  /* disc control latch */
584584      if ((myo>=0x30) && (myo<=0x33)) return 0xfe;                  /* page select */
585      if ((myo>=0x34) && (myo<=0x37)) return bbcm_ACCCON_read(myo-0x34);   /* ACCCON */
585      if ((myo>=0x34) && (myo<=0x37)) return bbcm_ACCCON_read(machine, myo-0x34);   /* ACCCON */
586586      if ((myo>=0x38) && (myo<=0x3f)) return 0xfe;                  /* NC ?? */
587      if ((myo>=0x40) && (myo<=0x5f)) return via_0_r(myo-0x40);
588      if ((myo>=0x60) && (myo<=0x7f)) return via_1_r(myo-0x60);
587      if ((myo>=0x40) && (myo<=0x5f)) return via_0_r(machine, myo-0x40);
588      if ((myo>=0x60) && (myo<=0x7f)) return via_1_r(machine, myo-0x60);
589589      if ((myo>=0x80) && (myo<=0x9f)) return 0xfe;
590590      if ((myo>=0xa0) && (myo<=0xbf)) return 0xfe;
591591      if ((myo>=0xc0) && (myo<=0xdf)) return 0xfe;
r1877r1878
602602   if ((offset>=0x200) && (offset<=0x2ff)) /* SHEILA */
603603   {
604604      myo=offset-0x200;
605      if ((myo>=0x00) && (myo<=0x07)) BBC_6845_w(myo-0x00,data);         /* Video Controller */
606      if ((myo>=0x08) && (myo<=0x0f)) BBC_6850_w(myo-0x08,data);         /* Serial Controller */
607      if ((myo>=0x10) && (myo<=0x17)) BBC_SerialULA_w(myo-0x10,data);      /* Serial System Chip */
608      if ((myo>=0x18) && (myo<=0x1f)) uPD7002_w(myo-0x18,data);         /* A to D converter */
609      if ((myo>=0x20) && (myo<=0x23)) videoULA_w(myo-0x20,data);         /* VideoULA */
610      if ((myo>=0x24) && (myo<=0x27)) bbcm_wd1770l_write(myo-0x24,data);    /* 1770 */
611      if ((myo>=0x28) && (myo<=0x2f)) bbcm_wd1770_write(myo-0x28,data);     /* disc control latch */
612      if ((myo>=0x30) && (myo<=0x33)) page_selectbm_w(myo-0x30,data);      /* page select */
613      if ((myo>=0x34) && (myo<=0x37)) bbcm_ACCCON_write(myo-0x34,data);   /* ACCCON */
605      if ((myo>=0x00) && (myo<=0x07)) BBC_6845_w(machine, myo-0x00,data);         /* Video Controller */
606      if ((myo>=0x08) && (myo<=0x0f)) BBC_6850_w(machine, myo-0x08,data);         /* Serial Controller */
607      if ((myo>=0x10) && (myo<=0x17)) BBC_SerialULA_w(machine, myo-0x10,data);      /* Serial System Chip */
608      if ((myo>=0x18) && (myo<=0x1f)) uPD7002_w(machine, myo-0x18,data);         /* A to D converter */
609      if ((myo>=0x20) && (myo<=0x23)) videoULA_w(machine, myo-0x20,data);         /* VideoULA */
610      if ((myo>=0x24) && (myo<=0x27)) bbcm_wd1770l_write(machine, myo-0x24,data);    /* 1770 */
611      if ((myo>=0x28) && (myo<=0x2f)) bbcm_wd1770_write(machine, myo-0x28,data);     /* disc control latch */
612      if ((myo>=0x30) && (myo<=0x33)) page_selectbm_w(machine, myo-0x30,data);      /* page select */
613      if ((myo>=0x34) && (myo<=0x37)) bbcm_ACCCON_write(machine, myo-0x34,data);   /* ACCCON */
614614      //if ((myo>=0x38) && (myo<=0x3f))                            /* NC ?? */
615      if ((myo>=0x40) && (myo<=0x5f)) via_0_w(myo-0x40,data);
616      if ((myo>=0x60) && (myo<=0x7f)) via_1_w(myo-0x60,data);
615      if ((myo>=0x40) && (myo<=0x5f)) via_0_w(machine, myo-0x40,data);
616      if ((myo>=0x60) && (myo<=0x7f)) via_1_w(machine, myo-0x60,data);
617617      //if ((myo>=0x80) && (myo<=0x9f))
618618      //if ((myo>=0xa0) && (myo<=0xbf))
619619      //if ((myo>=0xc0) && (myo<=0xdf))
r1877r1878
767767
768768         if ((readinputport(column)|0x01)!=0xff)
769769         {
770            via_0_ca2_w(0,1);
770            via_0_ca2_w(machine, 0,1);
771771         } else {
772            via_0_ca2_w(0,0);
772            via_0_ca2_w(machine, 0,0);
773773         }
774774
775775      } else {
776         via_0_ca2_w(0,0);
776         via_0_ca2_w(machine, 0,0);
777777      }
778778   }
779779}
r1877r1878
799799
800800         if ((readinputport(column)|0x01)!=0xff)
801801         {
802            via_0_ca2_w(0,1);
802            via_0_ca2_w(machine, 0,1);
803803         } else {
804            via_0_ca2_w(0,0);
804            via_0_ca2_w(machine, 0,0);
805805         }
806806
807807      } else {
808         via_0_ca2_w(0,0);
808         via_0_ca2_w(machine, 0,0);
809809      }
810810   }
811811}
812812
813813
814814
815static int bbc_keyboard(int data)
815static int bbc_keyboard(running_machine *machine, int data)
816816{
817817   int bit;
818818   int row;
r1877r1878
834834
835835   if ((res|1)!=0xff)
836836   {
837      via_0_ca2_w(0,1);
837      via_0_ca2_w(machine, 0,1);
838838   } else {
839      via_0_ca2_w(0,0);
839      via_0_ca2_w(machine, 0,0);
840840   }
841841
842842   return (data & 0x7f) | (bit<<7);
r1877r1878
858858
859859
860860/* This the BBC Masters Real Time Clock and NVRam IC */
861static void MC146818_set(void)
861static void MC146818_set(running_machine *machine)
862862{
863863   logerror ("146181 WR=%d DS=%d AS=%d CE=%d \n",MC146818_WR,MC146818_DS,MC146818_AS,MC146818_CE);
864864
r1877r1878
870870      {
871871         if (MC146818_WR)
872872         {
873            via_system_porta=mc146818_port_r(1);
873            via_system_porta=mc146818_port_r(machine, 1);
874874            //logerror("read 146818 data %d \n",via_system_porta);
875875         } else {
876            mc146818_port_w(1,via_system_porta);
876            mc146818_port_w(machine, 1,via_system_porta);
877877            //logerror("write 146818 data %d \n",via_system_porta);
878878         }
879879      }
r1877r1878
881881      // if address select is set then set the address in the 146818
882882      if (MC146818_AS)
883883      {
884         mc146818_port_w(0,via_system_porta);
884         mc146818_port_w(machine, 0,via_system_porta);
885885         //logerror("write 146818 address %d \n",via_system_porta);
886886      }
887887   }
r1877r1878
897897   if (b0_sound==0)
898898   {
899899       //logerror("Doing an unsafe write to the sound chip %d \n",data);
900      SN76496_0_w(0,via_system_porta);
900      SN76496_0_w(machine, 0,via_system_porta);
901901   }
902902   if (b3_keyboard==0)
903903   {
904904       //logerror("Doing an unsafe write to the keyboard %d \n",data);
905      via_system_porta=bbc_keyboard(via_system_porta);
905      via_system_porta=bbc_keyboard(machine, via_system_porta);
906906   }
907   if (bbc_Master) MC146818_set();
907   if (bbc_Master) MC146818_set(machine);
908908}
909909
910910
r1877r1878
931931            {
932932               /* BBC MASTER has NV RAM Here */
933933               MC146818_WR=1;
934               MC146818_set();
934               MC146818_set(machine);
935935            }
936936         } else {
937937            if (b1_speech_read==0) {
r1877r1878
947947            {
948948               /* BBC MASTER has NV RAM Here */
949949               MC146818_DS=1;
950               MC146818_set();
950               MC146818_set(machine);
951951            }
952952         } else {
953953            if (b2_speech_write==0) {
r1877r1878
992992      case 0:
993993         if (b0_sound==1) {
994994            b0_sound=0;
995            SN76496_0_w(0,via_system_porta);
995            SN76496_0_w(machine, 0,via_system_porta);
996996         }
997997         break;
998998      case 1:
r1877r1878
10021002            {
10031003               /* BBC MASTER has NV RAM Here */
10041004               MC146818_WR=0;
1005               MC146818_set();
1005               MC146818_set(machine);
10061006            }
10071007         } else {
10081008            if (b1_speech_read==1) {
r1877r1878
10181018            {
10191019               /* BBC MASTER has NV RAM Here */
10201020               MC146818_DS=0;
1021               MC146818_set();
1021               MC146818_set(machine);
10221022            }
10231023         } else {
10241024            if (b2_speech_write==1) {
r1877r1878
10311031         if (b3_keyboard==1) {
10321032            b3_keyboard=0;
10331033            /* *** call keyboard enabled *** */
1034            via_system_porta=bbc_keyboard(via_system_porta);
1034            via_system_porta=bbc_keyboard(machine, via_system_porta);
10351035         }
10361036         break;
10371037      case 4:
r1877r1878
10691069      if (MC146818_AS != ((data>>7)&1))
10701070      {
10711071         MC146818_AS=(data>>7)&1;
1072         MC146818_set();
1072         MC146818_set(machine);
10731073      }
10741074
10751075      //if CE changes
10761076      if (MC146818_CE != ((data>>6)&1))
10771077      {
10781078         MC146818_CE=(data>>6)&1;
1079         MC146818_set();
1079         MC146818_set(machine);
10801080      }
10811081   }
10821082}
r1877r1878
11291129/* joystick EOC */
11301130static  READ8_HANDLER( bbcb_via_system_read_cb1 )
11311131{
1132  return uPD7002_EOC_r(0);
1132  return uPD7002_EOC_r(machine, 0);
11331133}
11341134
11351135
r1877r1878
12501250   /* this is a very bad way of returning an acknowledge
12511251   by just linking the strobe output into the acknowledge input */
12521252   bbc_printer_ca1=data;
1253   via_1_ca1_w(0,data);
1253   via_1_ca1_w(machine, 0,data);
12541254}
12551255
12561256static void bbc_via_user_irq(int level)
r1877r1878
13051305
13061306static void BBC_uPD7002_EOC(int data)
13071307{
1308   via_0_cb1_w(0,data);
1308   via_0_cb1_w(Machine, 0,data);
13091309}
13101310
13111311static const struct uPD7002_interface BBC_uPD7002 =
r1877r1878
15411541      case 2:
15421542      case 3:
15431543         /* 8271 registers */
1544         ret=i8271_r(offset);
1544         ret=i8271_r(machine, offset);
15451545         logerror("  %d\n",ret);
15461546         return ret;
15471547      case 4:
1548         ret=i8271_data_r(offset);
1548         ret=i8271_data_r(machine, offset);
15491549         logerror("  %d\n",ret);
15501550         return ret;
15511551      default:
r1877r1878
15661566      case 2:
15671567      case 3:
15681568         /* 8271 registers */
1569         i8271_w(offset, data);
1569         i8271_w(machine, offset, data);
15701570         return;
15711571      case 4:
1572         i8271_data_w(offset, data);
1572         i8271_data_w(machine, offset, data);
15731573         return;
15741574      default:
15751575         break;
r1877r1878
17221722   switch (offset)
17231723   {
17241724   case 4:
1725      retval=wd17xx_status_r(0);
1725      retval=wd17xx_status_r(machine, 0);
17261726      break;
17271727   case 5:
1728      retval=wd17xx_track_r(0);
1728      retval=wd17xx_track_r(machine, 0);
17291729      break;
17301730   case 6:
1731      retval=wd17xx_sector_r(0);
1731      retval=wd17xx_sector_r(machine, 0);
17321732      break;
17331733   case 7:
1734      retval=wd17xx_data_r(0);
1734      retval=wd17xx_data_r(machine, 0);
17351735      break;
17361736   default:
17371737      break;
r1877r1878
17471747   switch (offset)
17481748   {
17491749   case 0:
1750      bbc_wd177x_status_w(0, data);
1750      bbc_wd177x_status_w(machine, 0, data);
17511751      break;
17521752   case 4:
1753      wd17xx_command_w(0, data);
1753      wd17xx_command_w(machine, 0, data);
17541754      break;
17551755   case 5:
1756      wd17xx_track_w(0, data);
1756      wd17xx_track_w(machine, 0, data);
17571757      break;
17581758   case 6:
1759      wd17xx_sector_w(0, data);
1759      wd17xx_sector_w(machine, 0, data);
17601760      break;
17611761   case 7:
1762      wd17xx_data_w(0, data);
1762      wd17xx_data_w(machine, 0, data);
17631763      break;
17641764   default:
17651765      break;
r1877r1878
18421842         switch (offset)
18431843         {
18441844            case 0xf8:
1845               return wd17xx_status_r(0);
1845               return wd17xx_status_r(machine, 0);
18461846               break;
18471847            case 0xf9:
1848               return wd17xx_track_r(0);
1848               return wd17xx_track_r(machine, 0);
18491849               break;
18501850            case 0xfa:
1851               return wd17xx_sector_r(0);
1851               return wd17xx_sector_r(machine, 0);
18521852               break;
18531853            case 0xfb:
1854               return wd17xx_data_r(0);
1854               return wd17xx_data_r(machine, 0);
18551855               break;
18561856         }
18571857
r1877r1878
18731873         switch (offset)
18741874         {
18751875            case 0xf8:
1876               wd17xx_command_w(0, data);
1876               wd17xx_command_w(machine, 0, data);
18771877               break;
18781878            case 0xf9:
1879               wd17xx_track_w(0, data);
1879               wd17xx_track_w(machine, 0, data);
18801880               break;
18811881            case 0xfa:
1882               wd17xx_sector_w(0, data);
1882               wd17xx_sector_w(machine, 0, data);
18831883               break;
18841884            case 0xfb:
1885               wd17xx_data_w(0, data);
1885               wd17xx_data_w(machine, 0, data);
18861886               break;
18871887            case 0xfc:
1888               bbc_opus_status_w(0,data);
1888               bbc_opus_status_w(machine, 0,data);
18891889               break;
18901890            case 0xfe:
18911891               opusbank=(opusbank & 0xff) | (data<<8);
r1877r1878
19121912   switch (offset)
19131913   {
19141914   case 0:
1915      retval=wd17xx_status_r(0);
1915      retval=wd17xx_status_r(machine, 0);
19161916      break;
19171917   case 1:
1918      retval=wd17xx_track_r(0);
1918      retval=wd17xx_track_r(machine, 0);
19191919      break;
19201920   case 2:
1921      retval=wd17xx_sector_r(0);
1921      retval=wd17xx_sector_r(machine, 0);
19221922      break;
19231923   case 3:
1924      retval=wd17xx_data_r(0);
1924      retval=wd17xx_data_r(machine, 0);
19251925      break;
19261926   default:
19271927      break;
r1877r1878
19361936   switch (offset)
19371937   {
19381938   case 0:
1939      wd17xx_command_w(0, data);
1939      wd17xx_command_w(machine, 0, data);
19401940      break;
19411941   case 1:
1942      wd17xx_track_w(0, data);
1942      wd17xx_track_w(machine, 0, data);
19431943      break;
19441944   case 2:
1945      wd17xx_sector_w(0, data);
1945      wd17xx_sector_w(machine, 0, data);
19461946      break;
19471947   case 3:
1948      wd17xx_data_w(0, data);
1948      wd17xx_data_w(machine, 0, data);
19491949      break;
19501950   default:
19511951      break;
r1877r1878
19961996   switch (bbc_DFSType){
19971997   /* case 0 to 3 are all standard 8271 interfaces */
19981998   case 0: case 1: case 2: case 3:
1999      return bbc_i8271_read(offset);
1999      return bbc_i8271_read(machine, offset);
20002000      break;
20012001   /* case 4 is the acown 1770 interface */
20022002   case 4:
2003      return bbc_wd1770_read(offset);
2003      return bbc_wd1770_read(machine, offset);
20042004      break;
20052005   /* case 5 is the watford 1770 interface */
20062006   case 5:
2007      return bbc_wd1770_read(offset);
2007      return bbc_wd1770_read(machine, offset);
20082008      break;
20092009   /* case 6 is the Opus challenger interface */
20102010   case 6:
r1877r1878
20222022   switch (bbc_DFSType){
20232023   /* case 0 to 3 are all standard 8271 interfaces */
20242024   case 0: case 1: case 2: case 3:
2025      bbc_i8271_write(offset,data);
2025      bbc_i8271_write(machine, offset,data);
20262026      break;
20272027   /* case 4 is the acown 1770 interface */
20282028   case 4:
2029      bbc_wd1770_write(offset,data);
2029      bbc_wd1770_write(machine, offset,data);
20302030      break;
20312031   /* case 5 is the watford 1770 interface */
20322032   case 5:
2033      bbc_wd1770_write(offset,data);
2033      bbc_wd1770_write(machine, offset,data);
20342034      break;
20352035   /* case 6 is the Opus challenger interface */
20362036   case 6:
src/mess/machine/compis.c
r1877r1878
204204
205205READ16_HANDLER ( compis_osp_pic_r )
206206{
207   return pic8259_0_r (offset);
207   return pic8259_0_r(machine, offset);
208208}
209209
210210WRITE16_HANDLER ( compis_osp_pic_w )
211211{
212   pic8259_0_w (offset, data);
212   pic8259_0_w(machine, offset, data);
213213}
214214
215215/*-------------------------------------------------------------------------*/
r1877r1878
328328   /* DMA acknowledge if iSBX-218A has DMA enabled */
329329     if (readinputport(7))
330330     {
331      data = nec765_dack_r(0);
331      data = nec765_dack_r(machine, 0);
332332   }
333333
334334   return data;
r1877r1878
339339   switch(offset)
340340   {
341341      case 2:
342         nec765_data_w(0, data);
342         nec765_data_w(machine, 0, data);
343343         break;
344344      default:
345345         logerror("FDC Unknown Port Write %04X = %04X\n", offset, data);
r1877r1878
354354   switch(offset)
355355   {
356356      case 0:
357         data = nec765_status_r(0);
357         data = nec765_status_r(machine, 0);
358358         break;
359359      case 1:
360         data = nec765_data_r(0);
360         data = nec765_data_r(machine, 0);
361361         break;
362362      default:
363363         logerror("FDC Unknown Port Read %04X\n", offset);
r1877r1878
448448
449449READ16_HANDLER ( compis_ppi_r )
450450{
451   return ppi8255_0_r (offset);
451   return ppi8255_0_r(machine, offset);
452452}
453453
454454WRITE16_HANDLER ( compis_ppi_w )
455455{
456   ppi8255_0_w (offset, data);
456   ppi8255_0_w(machine, offset, data);
457457}
458458
459459/*-------------------------------------------------------------------------*/
r1877r1878
488488
489489READ16_HANDLER ( compis_pit_r )
490490{
491   return pit8253_0_r (offset);
491   return pit8253_0_r(machine, offset);
492492}
493493
494494WRITE16_HANDLER ( compis_pit_w )
495495{
496   pit8253_0_w (offset , data);
496   pit8253_0_w(machine, offset , data);
497497}
498498
499499/*-------------------------------------------------------------------------*/
r1877r1878
502502
503503READ16_HANDLER ( compis_osp_pit_r )
504504{
505   return pit8253_1_r (offset);
505   return pit8253_1_r(machine, offset);
506506}
507507
508508WRITE16_HANDLER ( compis_osp_pit_w )
509509{
510   pit8253_1_w (offset, data);
510   pit8253_1_w(machine, offset, data);
511511}
512512
513513/*-------------------------------------------------------------------------*/
r1877r1878
544544
545545READ16_HANDLER ( compis_usart_r )
546546{
547   return msm8251_data_r ( offset);
547   return msm8251_data_r(machine, offset);
548548}
549549
550550WRITE16_HANDLER ( compis_usart_w )
r1877r1878
552552   switch (offset)
553553   {
554554      case 0x00:
555         msm8251_data_w (0,data);
555         msm8251_data_w(machine, 0, data);
556556         break;
557557      case 0x01:
558         msm8251_control_w (0,data);
558         msm8251_control_w(machine, 0, data);
559559         break;
560560      default:
561561         logerror("USART Unknown Port Write %04X = %04X\n", offset, data);
src/mess/machine/vtech2.c
r1877r1878
6262static  READ8_HANDLER ( mra_bank4) { return mra_bank(3,offset); }
6363
6464/* read banked memory (handle memory mapped i/o) */
65static const read8_handler mra_bank_soft[4] =
65static const read8_machine_func mra_bank_soft[4] =
6666{
6767    mra_bank1,  /* mapped in 0000-3fff */
6868    mra_bank2,  /* mapped in 4000-7fff */
r1877r1878
7171};
7272
7373/* write banked memory (handle memory mapped i/o and videoram) */
74static const write8_handler mwa_bank_soft[4] =
74static const write8_machine_func mwa_bank_soft[4] =
7575{
7676    mwa_bank1,  /* mapped in 0000-3fff */
7777    mwa_bank2,  /* mapped in 4000-7fff */
r1877r1878
8080};
8181
8282/* read banked memory (plain ROM/RAM) */
83static const read8_handler mra_bank_hard[4] =
83static const read8_machine_func mra_bank_hard[4] =
8484{
8585    MRA8_BANK1,  /* mapped in 0000-3fff */
8686    MRA8_BANK2,  /* mapped in 4000-7fff */
r1877r1878
8989};
9090
9191/* write banked memory (plain ROM/RAM) */
92static const write8_handler mwa_bank_hard[4] =
92static const write8_machine_func mwa_bank_hard[4] =
9393{
9494    MWA8_BANK1,  /* mapped in 0000-3fff */
9595    MWA8_BANK2,  /* mapped in 4000-7fff */
r1877r1878
114114
115115
116116
117static void laser_machine_init(int bank_mask, int video_mask)
117static void laser_machine_init(running_machine *machine, int bank_mask, int video_mask)
118118{
119119    int i;
120120
r1877r1878
124124   logerror("laser_machine_init(): bank mask $%04X, video %d [$%05X]\n", laser_bank_mask, laser_video_bank, laser_video_bank * 0x04000);
125125
126126   for (i = 0; i < sizeof(laser_bank) / sizeof(laser_bank[0]); i++)
127      laser_bank_select_w(i, 0);
127      laser_bank_select_w(machine, i, 0);
128128}
129129
130130MACHINE_RESET( laser350 )
131131{
132132   /* banks 0 to 3 only, optional ROM extension */
133   laser_machine_init(0xf00f, 3);
133   laser_machine_init(machine, 0xf00f, 3);
134134}
135135
136136MACHINE_RESET( laser500 )
137137{
138138   /* banks 0 to 2, and 4-7 only , optional ROM extension */
139   laser_machine_init(0xf0f7, 7);
139   laser_machine_init(machine, 0xf0f7, 7);
140140}
141141
142142MACHINE_RESET( laser700 )
143143{
144144   /* all banks except #3 */
145   laser_machine_init(0xfff7, 7);
145   laser_machine_init(machine, 0xfff7, 7);
146146}
147147
148148
r1877r1878
153153        "RAM #0","RAM #1","RAM #2","RAM #3",
154154        "RAM #4","RAM #5","RAM #6","RAM #7/Video RAM hi",
155155        "ext ROM #0","ext ROM #1","ext ROM #2","ext ROM #3"};
156   read8_handler read_handler;
157   write8_handler write_handler;
156   read8_machine_func read_handler;
157   write8_machine_func write_handler;
158158
159159   offset %= 4;
160160    data &= 15;
src/mess/machine/kc.c
r1877r1878
155155}
156156#endif
157157
158 READ8_HANDLER(kc85_disk_hw_ctc_r)
158READ8_HANDLER(kc85_disk_hw_ctc_r)
159159{
160   return z80ctc_1_r(offset);
160   return z80ctc_1_r(machine, offset);
161161}
162162
163163WRITE8_HANDLER(kc85_disk_hw_ctc_w)
164164{
165   z80ctc_1_w(offset,data);
165   z80ctc_1_w(machine, offset, data);
166166}
167167
168168WRITE8_HANDLER(kc85_disc_interface_ram_w)
r1877r1878
179179   program_write_byte(addr|0x0f000,data);
180180}
181181
182 READ8_HANDLER(kc85_disc_interface_ram_r)
182READ8_HANDLER(kc85_disc_interface_ram_r)
183183{
184184   int addr;
185185
r1877r1878
12421242/* update status of memory area 0x4000-0x07fff */
12431243static void kc85_4_update_0x04000(void)
12441244{
1245   read8_handler rh;
1246   write8_handler wh;
1245   read8_machine_func rh;
1246   write8_machine_func wh;
12471247
12481248   /* access ram? */
12491249   if (kc85_86_data & (1<<0))
r1877r1878
12921292/* update memory address 0x0c000-0x0e000 */
12931293static void kc85_4_update_0x0c000(void)
12941294{
1295   read8_handler rh;
1295   read8_machine_func rh;
12961296
12971297   if (kc85_86_data & (1<<7))
12981298   {
r1877r1878
13331333/* update memory address 0x0e000-0x0ffff */
13341334static void kc85_4_update_0x0e000(void)
13351335{
1336   read8_handler rh;
1336   read8_machine_func rh;
13371337
13381338   if (kc85_pio_data[0] & (1<<0))
13391339   {
r1877r1878
14471447/* update memory region 0x0c000-0x0e000 */
14481448static void kc85_3_update_0x0c000(void)
14491449{
1450   read8_handler rh;
1450   read8_machine_func rh;
14511451
14521452   if (kc85_pio_data[0] & (1<<7))
14531453   {
r1877r1878
14691469/* update memory address 0x0e000-0x0ffff */
14701470static void kc85_3_update_0x0e000(void)
14711471{
1472   read8_handler rh;
1472   read8_machine_func rh;
14731473
14741474   if (kc85_pio_data[0] & (1<<0))
14751475   {
r1877r1878
14931493for write operations */
14941494static void kc85_3_update_0x00000(void)
14951495{
1496   read8_handler rh;
1497   write8_handler wh;
1496   read8_machine_func rh;
1497   write8_machine_func wh;
14981498
14991499   /* access ram? */
15001500   if (kc85_pio_data[0] & (1<<1))
r1877r1878
15421542/* MRA8_BANK3 is used for read, MWA8_BANK8 is used for write */
15431543static void kc85_3_update_0x08000(void)
15441544{
1545   read8_handler rh;
1546   write8_handler wh;
1545   read8_machine_func rh;
1546   write8_machine_func wh;
15471547    unsigned char *ram_page;
15481548
15491549    if (kc85_pio_data[0] & (1<<2))
r1877r1878
17131713{
17141714   unsigned char data;
17151715
1716   data = z80ctc_0_r(offset);
1716   data = z80ctc_0_r(machine, offset);
17171717   //LOG_KBD(("ctc data r:%02x\n",data));
17181718   return data;
17191719}
r1877r1878
17221722{
17231723   //logerror("ctc data w:%02x\n",data);
17241724
1725   z80ctc_0_w(offset,data);
1725   z80ctc_0_w(machine, offset,data);
17261726}
17271727
17281728
r1877r1878
17871787   kc85_15khz_state^=1;
17881788
17891789   /* set clock input for channel 2 and 3 to ctc */
1790   z80ctc_0_trg0_w(0,kc85_15khz_state);
1791   z80ctc_0_trg1_w(0,kc85_15khz_state);
1790   z80ctc_0_trg0_w(machine, 0,kc85_15khz_state);
1791   z80ctc_0_trg1_w(machine, 0,kc85_15khz_state);
17921792
17931793   kc85_15khz_count++;
17941794
r1877r1878
18001800      kc85_50hz_state^=1;
18011801
18021802      /* set clock input for channel 2 and 3 to ctc */
1803      z80ctc_0_trg2_w(0,kc85_50hz_state);
1804      z80ctc_0_trg3_w(0,kc85_50hz_state);
1803      z80ctc_0_trg2_w(machine, 0, kc85_50hz_state);
1804      z80ctc_0_trg3_w(machine, 0, kc85_50hz_state);
18051805   }
18061806}
18071807
src/mess/mess.mak
r1877r1878
130130#CPUS += ASAP
131131CPUS += UPD7810
132132#CPUS += UPD7807
133CPUS += UPD7801
134133CPUS += ARM
135134CPUS += ARM7
136135CPUS += JAGUAR
r1877r1878
211210CPUS += TMS7000_EXL
212211CPUS += SM8500
213212CPUS += V30MZ
213CPUS += UPD7801
214214CPUS += M68008
215215#CPUS += TMS99000
216216CPUS += TMS99010
src/mess/drivers/wswan.c
r1877r1878
3131***************************************************************************/
3232
3333#include "driver.h"
34#include "deprecat.h"
3435#include "includes/wswan.h"
3536#include "devices/cartslot.h"
3637#include "sound/custom.h"
r1877r1878
129130   MDRV_CPU_ADD_TAG("main", V30MZ, 3072000)
130131   MDRV_CPU_PROGRAM_MAP(wswan_mem, 0)
131132   MDRV_CPU_IO_MAP(wswan_io, 0)
132   MDRV_CPU_VBLANK_INT(wswan_scanline_interrupt, 159)   /* 1 int each scanline */
133   MDRV_CPU_VBLANK_INT_HACK(wswan_scanline_interrupt, 159)   /* 1 int each scanline */
133134
134135   MDRV_SCREEN_ADD("main", LCD)
135136   MDRV_SCREEN_REFRESH_RATE(75)
src/mess/drivers/pdp1.c
r1877r1878
397397   MDRV_CPU_ADD(PDP1, 1000000/*the CPU core uses microsecond counts*/)
398398   MDRV_CPU_CONFIG(pdp1_reset_param)
399399   MDRV_CPU_PROGRAM_MAP(pdp1_map, 0)
400   MDRV_CPU_VBLANK_INT(pdp1_interrupt, 1)   /* dummy interrupt: handles input */
400   MDRV_CPU_VBLANK_INT("main", pdp1_interrupt)   /* dummy interrupt: handles input */
401401
402402   MDRV_MACHINE_START( pdp1 )
403403   MDRV_MACHINE_RESET( pdp1 )
src/mess/drivers/c65.c
r1877r1878
314314   /* basic machine hardware */
315315   MDRV_CPU_ADD_TAG("main", M4510, 3500000)  /* or VIC6567_CLOCK, */
316316   MDRV_CPU_PROGRAM_MAP(c65_mem, 0)
317   MDRV_CPU_VBLANK_INT(c64_frame_interrupt, 1)
317   MDRV_CPU_VBLANK_INT("main", c64_frame_interrupt)
318318   MDRV_CPU_PERIODIC_INT(vic3_raster_irq, VIC2_HRETRACERATE)
319319   MDRV_INTERLEAVE(0)
320320
src/mess/drivers/atari.c
r1877r1878
77******************************************************************************/
88
99#include "driver.h"
10#include "deprecat.h"
1011#include "cpu/m6502/m6502.h"
1112#include "includes/atari.h"
1213#include "devices/cartslot.h"
r1877r1878
735736
736737   MDRV_CPU_MODIFY( "main" )
737738   MDRV_CPU_PROGRAM_MAP(a400_mem, 0)
738   MDRV_CPU_VBLANK_INT(a400_interrupt, TOTAL_LINES_60HZ)
739   MDRV_CPU_VBLANK_INT_HACK(a400_interrupt, TOTAL_LINES_60HZ)
739740
740741   MDRV_MACHINE_START( a400 )
741742
r1877r1878
750751
751752   MDRV_CPU_MODIFY( "main" )
752753   MDRV_CPU_PROGRAM_MAP(a400_mem, 0)
753   MDRV_CPU_VBLANK_INT(a400_interrupt, TOTAL_LINES_50HZ)
754   MDRV_CPU_VBLANK_INT_HACK(a400_interrupt, TOTAL_LINES_50HZ)
754755
755756   MDRV_MACHINE_START( a400 )
756757
r1877r1878
765766
766767   MDRV_CPU_MODIFY( "main" )
767768   MDRV_CPU_PROGRAM_MAP(a800_mem, 0)
768   MDRV_CPU_VBLANK_INT(a800_interrupt, TOTAL_LINES_60HZ)
769   MDRV_CPU_VBLANK_INT_HACK(a800_interrupt, TOTAL_LINES_60HZ)
769770
770771   MDRV_MACHINE_START( a800 )
771772
r1877r1878
780781
781782   MDRV_CPU_MODIFY( "main" )
782783   MDRV_CPU_PROGRAM_MAP(a800_mem, 0)
783   MDRV_CPU_VBLANK_INT(a800_interrupt, TOTAL_LINES_50HZ)
784   MDRV_CPU_VBLANK_INT_HACK(a800_interrupt, TOTAL_LINES_50HZ)
784785
785786   MDRV_MACHINE_START( a800 )
786787
r1877r1878
795796
796797   MDRV_CPU_MODIFY( "main" )
797798   MDRV_CPU_PROGRAM_MAP(a800xl_mem, 0)
798   MDRV_CPU_VBLANK_INT(a800xl_interrupt, TOTAL_LINES_60HZ)
799   MDRV_CPU_VBLANK_INT_HACK(a800xl_interrupt, TOTAL_LINES_60HZ)
799800
800801   MDRV_MACHINE_START( a800xl )
801802
r1877r1878
810811
811812   MDRV_CPU_MODIFY( "main" )
812813   MDRV_CPU_PROGRAM_MAP(a5200_mem, 0)
813   MDRV_CPU_VBLANK_INT(a5200_interrupt, TOTAL_LINES_60HZ)
814   MDRV_CPU_VBLANK_INT_HACK(a5200_interrupt, TOTAL_LINES_60HZ)
814815
815816   MDRV_MACHINE_START( a5200 )
816817
src/mess/drivers/nc.c
r1877r1878
331331}
332332
333333
334static const read8_handler nc_bankhandler_r[]={
334static const read8_machine_func nc_bankhandler_r[]={
335335MRA8_BANK1, MRA8_BANK2, MRA8_BANK3, MRA8_BANK4};
336336
337static const write8_handler nc_bankhandler_w[]={
337static const write8_machine_func nc_bankhandler_w[]={
338338MWA8_BANK5, MWA8_BANK6, MWA8_BANK7, MWA8_BANK8};
339339
340340static void nc_refresh_memory_bank_config(int bank)
341341{
342342   int mem_type;
343343   int mem_bank;
344   read8_handler read_handler;
345   write8_handler write_handler = NULL;
344   read8_machine_func read_handler;
345   write8_machine_func write_handler = NULL;
346346
347347   mem_type = (nc_memory_config[bank]>>6) & 0x03;
348348   mem_bank = nc_memory_config[bank] & 0x03f;
r1877r1878
848848
849849static WRITE8_HANDLER(nc100_uart_control_w)
850850{
851   nc_uart_control_w(offset,data);
851   nc_uart_control_w(machine, offset,data);
852852
853853//  /* is this correct?? */
854854//  if (data & (1<<3))
r1877r1878
14721472
14731473   reset_fdc = (nc_uart_control^data) & (1<<5);
14741474
1475   nc_uart_control_w(offset,data);
1475   nc_uart_control_w(machine, offset,data);
14761476
14771477   if (data & (1<<3))
14781478   {
src/mess/drivers/adam.c
r1877r1878
630630   //MDRV_CPU_ADD(M6800, 4000000)       /* 4.0 Mhz */
631631   //MDRV_CPU_PROGRAM_MAP(master6801_mem, 0)
632632
633   MDRV_CPU_VBLANK_INT(adam_interrupt,1)
633   MDRV_CPU_VBLANK_INT("main", adam_interrupt)
634634
635635   MDRV_MACHINE_START( adam )
636636   MDRV_MACHINE_RESET( adam )
src/mess/drivers/cbmb.c
r1877r1878
187187   /*  {0xfc000, 0xfcfff, MRA8_ROM }, */
188188   AM_RANGE(0xfd000, 0xfd7ff) AM_READ( MRA8_ROM )
189189//  AM_RANGE(0xfd800, 0xfd8ff)
190   AM_RANGE(0xfd801, 0xfd801) AM_MIRROR( 0xfe ) AM_READ( cbmb_mc6845_register_r )
190   AM_RANGE(0xfd801, 0xfd801) AM_MIRROR( 0xfe ) AM_DEVREAD(MC6845, "crtc", mc6845_register_r)
191191   /* disk units */
192192   AM_RANGE(0xfda00, 0xfdaff) AM_READ( sid6581_0_port_r )
193193   /* db00 coprocessor */
r1877r1878
209209   AM_RANGE(0xf6000, 0xf7fff) AM_WRITE( MWA8_ROM )
210210   AM_RANGE(0xf8000, 0xfbfff) AM_WRITE( MWA8_ROM) AM_BASE( &cbmb_basic )
211211   AM_RANGE(0xfd000, 0xfd7ff) AM_WRITE( MWA8_RAM) AM_BASE( &videoram) AM_SIZE(&videoram_size ) /* VIDEORAM */
212   AM_RANGE(0xfd800, 0xfd800) AM_MIRROR( 0xfe ) AM_WRITE( cbmb_mc6845_address_w )
213   AM_RANGE(0xfd801, 0xfd801) AM_MIRROR( 0xfe ) AM_WRITE( cbmb_mc6845_register_w )
212   AM_RANGE(0xfd800, 0xfd800) AM_MIRROR( 0xfe ) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
213   AM_RANGE(0xfd801, 0xfd801) AM_MIRROR( 0xfe ) AM_DEVWRITE(MC6845, "crtc", mc6845_register_w)
214214   /* disk units */
215215   AM_RANGE(0xfda00, 0xfdaff) AM_WRITE( sid6581_0_port_w)
216216   /* db00 coprocessor */
src/mess/drivers/sord.c
r1877r1878
332332{
333333   unsigned char data;
334334
335   data = z80ctc_0_r(offset & 0x03);
335   data = z80ctc_0_r(machine, offset & 0x03);
336336
337337   logerror("sord ctc r: %04x %02x\n",(offset & 0x03), data);
338338
r1877r1878
343343{
344344   logerror("sord ctc w: %04x %02x\n",(offset & 0x03), data);
345345
346   z80ctc_0_w(offset & 0x03, data);
346   z80ctc_0_w(machine, offset & 0x03, data);
347347}
348348
349349static  READ8_HANDLER(sord_sys_r)
r1877r1878
449449{
450450   if (state)
451451   {
452      z80ctc_0_trg3_w(0,1);
453      z80ctc_0_trg3_w(0,0);
452      z80ctc_0_trg3_w(Machine, 0, 1);
453      z80ctc_0_trg3_w(Machine, 0, 0);
454454   }
455455}
456456
r1877r1878
625625   MDRV_CPU_ADD_TAG("main", Z80, 3800000)
626626   MDRV_CPU_PROGRAM_MAP(sord_m5_mem, 0)
627627   MDRV_CPU_IO_MAP(sord_m5_io, 0)
628   MDRV_CPU_VBLANK_INT(sord_interrupt, 1)
628   MDRV_CPU_VBLANK_INT("main", sord_interrupt)
629629   MDRV_CPU_CONFIG( sord_m5_daisy_chain )
630630   MDRV_INTERLEAVE(1)
631631
src/mess/drivers/mbee.c
r1877r1878
256256   MDRV_CPU_PROGRAM_MAP(mbee_mem, 0)
257257   MDRV_CPU_IO_MAP(mbee_ports, 0)
258258   MDRV_CPU_CONFIG(mbee_daisy_chain)
259   MDRV_CPU_VBLANK_INT(mbee_interrupt,1)
259   MDRV_CPU_VBLANK_INT("main", mbee_interrupt)
260260   MDRV_INTERLEAVE(1)
261261
262262   MDRV_MACHINE_RESET( mbee )
src/mess/drivers/pokemini.c
r1877r1878
6666   MDRV_PALETTE_INIT( pokemini )
6767   MDRV_SCREEN_REFRESH_RATE( 30 )
6868   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
69   MDRV_CPU_VBLANK_INT( pokemini_int, 1 )
69   MDRV_CPU_VBLANK_INT("main", pokemini_int)
7070
7171   /* sound hardware */
7272#if 0   
src/mess/drivers/coco.c
r1877r1878
283283 */
284284static INPUT_PORTS_START( dragon32 )
285285   PORT_START /* KEY ROW 0 */
286   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
287   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
288   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"')
289   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
290   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
291   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
292   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&')
293   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'')
286   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
287   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
288   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"')
289   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
290   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
291   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
292   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&')
293   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'')
294294
295295   PORT_START /* KEY ROW 1 */
296   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
297   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
298   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*')
299   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+')
300   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
301   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=')
302   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
303   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
296   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
297   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
298   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*')
299   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+')
300   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
301   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=')
302   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
303   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
304304
305305   PORT_START /* KEY ROW 2 */
306   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('@')
307   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A')
308   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B')
309   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C')
310   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D')
311   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E')
312   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F')
313   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G')
306   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('@')
307   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_A) PORT_CHAR('A')
308   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_B) PORT_CHAR('B')
309   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_C) PORT_CHAR('C')
310   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_D) PORT_CHAR('D')
311   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_E) PORT_CHAR('E')
312   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_F) PORT_CHAR('F')
313   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_G) PORT_CHAR('G')
314314
315315   PORT_START /* KEY ROW 3 */
316   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H')
317   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I')
318   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J')
319   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K')
320   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L')
321   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M')
322   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N')
323   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O')
316   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_H) PORT_CHAR('H')
317   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_I) PORT_CHAR('I')
318   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_J) PORT_CHAR('J')
319   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_K) PORT_CHAR('K')
320   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_L) PORT_CHAR('L')
321   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_M) PORT_CHAR('M')
322   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_N) PORT_CHAR('N')
323   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_O) PORT_CHAR('O')
324324
325325   PORT_START /* KEY ROW 4 */
326   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P')
327   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')
328   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R')
329   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S')
330   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T')
331   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U')
332   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V')
333   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W')
326   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_P) PORT_CHAR('P')
327   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')
328   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_R) PORT_CHAR('R')
329   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_S) PORT_CHAR('S')
330   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_T) PORT_CHAR('T')
331   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_U) PORT_CHAR('U')
332   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_V) PORT_CHAR('V')
333   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_W) PORT_CHAR('W')
334334
335335   PORT_START /* KEY ROW 5 */
336   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X')
337   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y')
338   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z')
339   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR('^')
340   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(10)
341   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
342   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(9)
343   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
336   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_X) PORT_CHAR('X')
337   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y')
338   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z')
339   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR('^')
340   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(10)
341   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
342   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(9)
343   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
344344
345345   PORT_START /* KEY ROW 6 */
346   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
347   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(12)
348   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_END) PORT_CODE(KEYCODE_ESC) PORT_CHAR(27)
346   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
347   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(12)
348   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_NAME("BREAK") PORT_CODE(KEYCODE_END) PORT_CODE(KEYCODE_ESC) PORT_CHAR(27)
349349   PORT_BIT (0x78, IP_ACTIVE_LOW, IPT_UNUSED)
350   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L-SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
351   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R-SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
350   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_NAME("L-SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
351   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_NAME("R-SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
352352
353353   PORT_INCLUDE( coco_joystick )
354354   PORT_INCLUDE( coco_joystick_buttons )
r1877r1878
370370 */
371371static INPUT_PORTS_START( coco )
372372   PORT_START /* KEY ROW 0 */
373   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('@')
374   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A')
375   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B')
376   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C')
377   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D')
378   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E')
379   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F')
380   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G')
373   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('@')
374   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_A) PORT_CHAR('A')
375   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_B) PORT_CHAR('B')
376   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_C) PORT_CHAR('C')
377   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_D) PORT_CHAR('D')
378   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_E) PORT_CHAR('E')
379   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_F) PORT_CHAR('F')
380   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_G) PORT_CHAR('G')
381381
382382   PORT_START /* KEY ROW 1 */
383   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H')
384   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I')
385   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J')
386   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K')
387   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L')
388   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M')
389   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N')
390   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O')
383   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_H) PORT_CHAR('H')
384   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_I) PORT_CHAR('I')
385   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_J) PORT_CHAR('J')
386   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_K) PORT_CHAR('K')
387   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_L) PORT_CHAR('L')
388   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_M) PORT_CHAR('M')
389   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_N) PORT_CHAR('N')
390   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_O) PORT_CHAR('O')
391391
392392   PORT_START /* KEY ROW 2 */
393   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P')
394   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')
395   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R')
396   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S')
397   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T')
398   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U')
399   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V')
400   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W')
393   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_P) PORT_CHAR('P')
394   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')
395   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_R) PORT_CHAR('R')
396   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_S) PORT_CHAR('S')
397   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_T) PORT_CHAR('T')
398   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_U) PORT_CHAR('U')
399   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_V) PORT_CHAR('V')
400   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_W) PORT_CHAR('W')
401401
402402   PORT_START /* KEY ROW 3 */
403   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X')
404   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y')
405   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z')
406   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR('^')
407   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(10)
408   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
409   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(9)
410   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
403   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_X) PORT_CHAR('X')
404   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y')
405   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z')
406   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR('^')
407   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(10)
408   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
409   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(9)
410   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
411411
412412   PORT_START /* KEY ROW 4 */
413   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
414   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
415   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"')
416   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
417   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
418   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
419   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&')
420   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'')
413   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
414   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
415   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"')
416   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
417   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
418   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
419   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&')
420   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'')
421421
422422   PORT_START /* KEY ROW 5 */
423   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
424   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
425   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*')
426   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+')
427   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
428   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=')
429   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
430   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
423   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
424   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
425   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*')
426   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+')
427   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
428   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=')
429   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
430   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
431431
432432   PORT_START /* KEY ROW 6 */
433   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
434   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(12)
435   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_END) PORT_CODE(KEYCODE_ESC) PORT_CHAR(27)
433   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
434   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(12)
435   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_NAME("BREAK") PORT_CODE(KEYCODE_END) PORT_CODE(KEYCODE_ESC) PORT_CHAR(27)
436436   PORT_BIT(0x78, IP_ACTIVE_LOW, IPT_UNUSED)
437   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L-SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
438   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R-SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
437   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_NAME("L-SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
438   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED(coco_keyboard_changed, NULL) PORT_NAME("R-SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
439439
440440   PORT_INCLUDE( coco_joystick )
441441   PORT_INCLUDE( coco_joystick_buttons )
src/mess/drivers/nes.c
r1877r1878
2020
2121static READ8_HANDLER( psg_4015_r )
2222{
23   return NESPSG_0_r(0x15);
23   return NESPSG_0_r(machine, 0x15);
2424}
2525
2626static WRITE8_HANDLER( psg_4015_w )
2727{
28   NESPSG_0_w(0x15, data);
28   NESPSG_0_w(machine, 0x15, data);
2929}
3030
3131static WRITE8_HANDLER( psg_4017_w )
3232{
33   NESPSG_0_w(0x17, data);
33   NESPSG_0_w(machine, 0x17, data);
3434}
3535
3636static WRITE8_HANDLER(nes_vh_sprite_dma_w)
src/mess/drivers/ti99_8.c
r1877r1878
403403   MDRV_CPU_CONFIG(ti99_8_processor_config)
404404   MDRV_CPU_PROGRAM_MAP(ti99_8_memmap, 0)
405405   MDRV_CPU_IO_MAP(ti99_8_readcru, ti99_8_writecru)
406   MDRV_CPU_VBLANK_INT(ti99_vblank_interrupt, 1)
406   MDRV_CPU_VBLANK_INT("main", ti99_vblank_interrupt)
407407
408408   MDRV_MACHINE_START( ti99_8_60hz )
409409   MDRV_MACHINE_RESET( ti99 )
r1877r1878
433433   MDRV_CPU_CONFIG(ti99_8_processor_config)
434434   MDRV_CPU_PROGRAM_MAP(ti99_8_memmap, 0)
435435   MDRV_CPU_IO_MAP(ti99_8_readcru, ti99_8_writecru)
436   MDRV_CPU_VBLANK_INT(ti99_vblank_interrupt, 1)
436   MDRV_CPU_VBLANK_INT("main", ti99_vblank_interrupt)
437437
438438   MDRV_MACHINE_START( ti99_8_50hz )
439439   MDRV_MACHINE_RESET( ti99 )
src/mess/drivers/gb.c
r1877r1878
556556   MDRV_CPU_ADD_TAG("main", Z80GB, 4194304)         /* 4.194304 Mhz */
557557   MDRV_CPU_PROGRAM_MAP(gb_map, 0)
558558   MDRV_CPU_CONFIG(dmg_cpu_reset)
559   MDRV_CPU_VBLANK_INT(gb_scanline_interrupt, 1)   /* 1 dummy int each frame */
559   MDRV_CPU_VBLANK_INT("main", gb_scanline_interrupt)   /* 1 dummy int each frame */
560560
561561   MDRV_SCREEN_ADD("main", LCD)
562562   MDRV_SCREEN_REFRESH_RATE(DMG_FRAMES_PER_SECOND)
r1877r1878
673673   /* basic machine hardware */
674674   MDRV_CPU_ADD_TAG("main", Z80GB, 4194304)         /* 4.194304 Mhz */
675675   MDRV_CPU_PROGRAM_MAP( megaduck_map, 0 )
676   MDRV_CPU_VBLANK_INT(gb_scanline_interrupt, 1)   /* 1 int each scanline ! */
676   MDRV_CPU_VBLANK_INT("main", gb_scanline_interrupt)   /* 1 int each scanline ! */
677677   MDRV_CPU_CONFIG(megaduck_cpu_reset)
678678
679679   MDRV_SCREEN_ADD("main", LCD)
src/mess/drivers/z88.c
r1877r1878
177177
178178static void z88_install_memory_handler_pair(offs_t start, offs_t size, int bank_base, void *read_addr, void *write_addr)
179179{
180   read8_handler read_handler;
181   write8_handler write_handler;
180   read8_machine_func read_handler;
181   write8_machine_func write_handler;
182182
183   read_handler  = read_addr  ? (read8_handler)  (STATIC_BANK1 + (FPTR)(bank_base - 1 + 0)) : MRA8_ROM;
184   write_handler = write_addr ? (write8_handler) (STATIC_BANK1 + (FPTR)(bank_base - 1 + 1)) : MWA8_UNMAP;
183   read_handler  = read_addr  ? (read8_machine_func)  (STATIC_BANK1 + (FPTR)(bank_base - 1 + 0)) : MRA8_ROM;
184   write_handler = write_addr ? (write8_machine_func) (STATIC_BANK1 + (FPTR)(bank_base - 1 + 1)) : MWA8_UNMAP;
185185
186186   memory_install_read8_handler(0,  ADDRESS_SPACE_PROGRAM, start, start + size - 1, 0, 0, read_handler);
187187   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, start, start + size - 1, 0, 0, write_handler);
r1877r1878
496496      case 0x0d1:
497497      case 0x0d2:
498498      case 0x0d3:
499         blink_srx_w(port & 0x03, data);
499         blink_srx_w(machine, port & 0x03, data);
500500         return;
501501   }
502502
src/mess/drivers/concept.c
r1877r1878
5757   /* basic machine hardware */
5858   MDRV_CPU_ADD(M68000, 8182000)        /* 16.364 Mhz / 2 */
5959   MDRV_CPU_PROGRAM_MAP(concept_memmap, 0)
60   MDRV_CPU_VBLANK_INT(concept_interrupt,1)
60   MDRV_CPU_VBLANK_INT("main", concept_interrupt)
6161
6262   MDRV_INTERLEAVE(1)
6363   MDRV_MACHINE_START(concept)
src/mess/drivers/pcw16.c
r1877r1878
175175
176176static char *pcw16_mem_ptr[4];
177177
178static const write8_handler pcw16_write_handler_dram[4] =
178static const write8_machine_func pcw16_write_handler_dram[4] =
179179{
180180   MWA8_BANK5,
181181   MWA8_BANK6,
r1877r1878
183183   MWA8_BANK8
184184};
185185
186static const read8_handler pcw16_read_handler_dram[4] =
186static const read8_machine_func pcw16_read_handler_dram[4] =
187187{
188188   MRA8_BANK1,
189189   MRA8_BANK2,
r1877r1878
260260   return pcw16_flash1_bank_handler_r(3, offset);
261261}
262262
263static const read8_handler pcw16_flash0_bank_handlers_r[4] =
263static const read8_machine_func pcw16_flash0_bank_handlers_r[4] =
264264{
265265   pcw16_flash0_bank_handler0_r,
266266   pcw16_flash0_bank_handler1_r,
r1877r1878
268268   pcw16_flash0_bank_handler3_r,
269269};
270270
271static const read8_handler pcw16_flash1_bank_handlers_r[4] =
271static const read8_machine_func pcw16_flash1_bank_handlers_r[4] =
272272{
273273   pcw16_flash1_bank_handler0_r,
274274   pcw16_flash1_bank_handler1_r,
r1877r1878
337337   pcw16_flash1_bank_handler_w(3, offset, data);
338338}
339339
340static const write8_handler pcw16_flash0_bank_handlers_w[4] =
340static const write8_machine_func pcw16_flash0_bank_handlers_w[4] =
341341{
342342   pcw16_flash0_bank_handler0_w,
343343   pcw16_flash0_bank_handler1_w,
r1877r1878
345345   pcw16_flash0_bank_handler3_w,
346346};
347347
348static const write8_handler pcw16_flash1_bank_handlers_w[4] =
348static const write8_machine_func pcw16_flash1_bank_handlers_w[4] =
349349{
350350   pcw16_flash1_bank_handler0_w,
351351   pcw16_flash1_bank_handler1_w,
r1877r1878
374374
375375static void pcw16_set_bank_handlers(int bank, PCW16_RAM_TYPE type)
376376{
377   read8_handler read_handler;
378   write8_handler write_handler;
377   read8_machine_func read_handler;
378   write8_machine_func write_handler;
379379
380380   switch (type) {
381381   case PCW16_MEM_ROM:
r1877r1878
11591159/* write to Super I/O chip. FDC Data Rate. */
11601160static WRITE8_HANDLER(pcw16_superio_fdc_datarate_w)
11611161{
1162   pc_fdc_w(PC_FDC_DATA_RATE_REGISTER,data);
1162   pc_fdc_w(machine, PC_FDC_DATA_RATE_REGISTER,data);
11631163}
11641164
11651165/* write to Super I/O chip. FDC Digital output register */
11661166static WRITE8_HANDLER(pcw16_superio_fdc_digital_output_register_w)
11671167{
1168   pc_fdc_w(PC_FDC_DIGITAL_OUTPUT_REGISTER, data);
1168   pc_fdc_w(machine, PC_FDC_DIGITAL_OUTPUT_REGISTER, data);
11691169}
11701170
11711171/* write to Super I/O chip. FDC Data Register */
11721172static WRITE8_HANDLER(pcw16_superio_fdc_data_w)
11731173{
1174   pc_fdc_w(PC_FDC_DATA_REGISTER, data);
1174   pc_fdc_w(machine, PC_FDC_DATA_REGISTER, data);
11751175}
11761176
11771177/* write to Super I/O chip. FDC Data Register */
11781178static  READ8_HANDLER(pcw16_superio_fdc_data_r)
11791179{
1180   return pc_fdc_r(PC_FDC_DATA_REGISTER);
1180   return pc_fdc_r(machine, PC_FDC_DATA_REGISTER);
11811181}
11821182
11831183/* write to Super I/O chip. FDC Main Status Register */
11841184static  READ8_HANDLER(pcw16_superio_fdc_main_status_register_r)
11851185{
1186   return pc_fdc_r(PC_FDC_MAIN_STATUS_REGISTER);
1186   return pc_fdc_r(machine, PC_FDC_MAIN_STATUS_REGISTER);
11871187}
11881188
11891189static  READ8_HANDLER(pcw16_superio_fdc_digital_input_register_r)
11901190{
1191   return pc_fdc_r(PC_FDC_DIGITIAL_INPUT_REGISTER);
1191   return pc_fdc_r(machine, PC_FDC_DIGITIAL_INPUT_REGISTER);
11921192}
11931193
11941194static void   pcw16_fdc_interrupt(int state)
src/mess/drivers/kim1.c
r1877r1878
162162   /* basic machine hardware */
163163   MDRV_CPU_ADD_TAG("main", M6502, 1000000)        /* 1 MHz */
164164   MDRV_CPU_PROGRAM_MAP(kim1_map, 0)
165   MDRV_CPU_VBLANK_INT(kim1_interrupt, 1)
165   MDRV_CPU_VBLANK_INT("main", kim1_interrupt)
166166   MDRV_INTERLEAVE(1)
167167
168168   MDRV_MACHINE_RESET( kim1 )
src/mess/drivers/msx.c
r1877r1878
66*/
77
88#include "driver.h"
9#include "deprecat.h"
910#include "machine/8255ppi.h"
1011#include "video/tms9928a.h"
1112#include "video/v9938.h"
r1877r1878
726727   MDRV_CPU_ADD(Z80, 3579545)        /* 3.579545 Mhz */
727728   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
728729   MDRV_CPU_IO_MAP(readport,writeport)
729   MDRV_CPU_VBLANK_INT(msx_interrupt,1)
730   MDRV_CPU_VBLANK_INT("main", msx_interrupt)
730731   MDRV_INTERLEAVE(1)
731732
732733   MDRV_MACHINE_START( msx )
r1877r1878
774775   MDRV_CPU_ADD(Z80, 3579545)        /* 3.579545 Mhz */
775776   MDRV_CPU_PROGRAM_MAP(readmem, writemem)
776777   MDRV_CPU_IO_MAP(readport2,writeport2)
777   MDRV_CPU_VBLANK_INT(msx2_interrupt,262)
778   MDRV_CPU_VBLANK_INT_HACK(msx2_interrupt, 262)
778779   MDRV_INTERLEAVE(1)
779780
780781   MDRV_MACHINE_RESET( msx2 )
src/mess/drivers/gamecom.c
r1877r1878
1616***************************************************************************/
1717
1818#include "driver.h"
19#include "deprecat.h"
1920#include "includes/gamecom.h"
2021#include "cpu/sm8500/sm8500.h"
2122#include "devices/cartslot.h"
r1877r1878
9293   MDRV_CPU_ADD_TAG( "main", SM8500, XTAL_11_0592MHz/2 )   /* actually it's an sm8521 microcontroller containing an sm8500 cpu */
9394   MDRV_CPU_PROGRAM_MAP( gamecom_mem_map, 0 )
9495   MDRV_CPU_CONFIG( gamecom_cpu_config )
95   MDRV_CPU_VBLANK_INT( gamecom_scanline, 200 )
96   MDRV_CPU_VBLANK_INT_HACK(gamecom_scanline, 200)
9697
9798   MDRV_SCREEN_ADD("main", LCD)
9899   MDRV_SCREEN_REFRESH_RATE( 59.732155 )
src/mess/drivers/tmc600.c
r1877r1878
114114   case 0x30:
115115      // write cdp1869 command on the data bus
116116      vismac_bkg_latch = data & 0x07;
117      cdp1869_out3_w(0, data);
117      cdp1869_out3_w(machine, 0, data);
118118      break;
119119
120120   case 0x40:
121      cdp1869_out4_w(0, data);
121      cdp1869_out4_w(machine, 0, data);
122122      break;
123123
124124   case 0x50:
125      cdp1869_out5_w(0, data);
125      cdp1869_out5_w(machine, 0, data);
126126      break;
127127
128128   case 0x60:
129      cdp1869_out6_w(0, data);
129      cdp1869_out6_w(machine, 0, data);
130130      break;
131131
132132   case 0x70:
133      cdp1869_out7_w(0, data);
133      cdp1869_out7_w(machine, 0, data);
134134      break;
135135   }
136136}
137137
138138static WRITE8_HANDLER( vismac_pageram_w )
139139{
140   cdp1869_pageram_w( offset, data );
140   cdp1869_pageram_w( machine, offset, data );
141141   vismac_colorram[offset] = vismac_color_latch;
142142}
143143
src/mess/drivers/tm990189.c
r1877r1878
597597    it. */
598598
599599   if (offset & 2)
600      reply = TMS9928A_register_r(0);
600      reply = TMS9928A_register_r(machine, 0);
601601   else
602      reply = TMS9928A_vram_r(0);
602      reply = TMS9928A_vram_r(machine, 0);
603603
604604   if (!(offset & 1))
605605      bogus_read_save = reply;
r1877r1878
614614   if (offset & 1)
615615   {
616616      if (offset & 2)
617         TMS9928A_register_w(0, data);
617         TMS9928A_register_w(machine, 0, data);
618618      else
619         TMS9928A_vram_w(0, data);
619         TMS9928A_vram_w(machine, 0, data);
620620   }
621621}
622622
623static READ8_HANDLER(video_joy_r)
623static READ8_HANDLER(video_joy_r)
624624{
625625   int reply = readinputport(9);
626626
src/mess/drivers/dc.c
r1877r1878
146146   MDRV_CPU_CONFIG(sh4cpu_config)
147147   MDRV_CPU_PROGRAM_MAP(dc_map,0)
148148   MDRV_CPU_IO_MAP(dc_port,0)
149   MDRV_CPU_VBLANK_INT(dc_dispatch_vblank,1)
149   MDRV_CPU_VBLANK_INT("main", dc_dispatch_vblank)
150150
151151   MDRV_CPU_ADD_TAG("sound", ARM7, ((XTAL_33_8688MHz*2)/3)/8)   // AICA bus clock is 2/3rds * 33.8688.  ARM7 gets 1 bus cycle out of each 8.
152152   MDRV_CPU_PROGRAM_MAP(dc_audio_map, 0)
src/mess/drivers/lisa.c
r1877r1878
3737   /* basic machine hardware */
3838   MDRV_CPU_ADD_TAG("main", M68000, 5093760)        /* 20.37504 Mhz / 4 */
3939   MDRV_CPU_PROGRAM_MAP(lisa_map, 0)
40   MDRV_CPU_VBLANK_INT(lisa_interrupt,1)
40   MDRV_CPU_VBLANK_INT("main", lisa_interrupt)
4141
4242   MDRV_CPU_ADD_TAG("fdc", M6502, 2000000)        /* 16.000 Mhz / 8 in when DIS asserted, 16.000 Mhz / 9 otherwise (?) */
4343   MDRV_CPU_PROGRAM_MAP(lisa_fdc_map, 0)
src/mess/drivers/lynx.c
r1877r1878
215215   /* basic machine hardware */
216216   MDRV_CPU_ADD(M65SC02, 4000000)        /* vti core, integrated in vlsi, stz, but not bbr bbs */
217217   MDRV_CPU_PROGRAM_MAP(lynx_mem, 0)
218   MDRV_CPU_VBLANK_INT(lynx_frame_int, 1)
218   MDRV_CPU_VBLANK_INT("main", lynx_frame_int)
219219   MDRV_INTERLEAVE(1)
220220
221221   MDRV_MACHINE_START( lynx )
src/mess/drivers/aquarius.c
r1877r1878
215215   MDRV_CPU_ADD_TAG("main", Z80, 3500000)
216216   MDRV_CPU_PROGRAM_MAP(aquarius_mem, 0)
217217   MDRV_CPU_IO_MAP(aquarius_io, 0)
218   MDRV_CPU_VBLANK_INT( aquarius_interrupt, 1 )
218   MDRV_CPU_VBLANK_INT("main", aquarius_interrupt)
219219   MDRV_INTERLEAVE(1)
220220
221221   MDRV_MACHINE_RESET( aquarius )
src/mess/drivers/cgenie.c
r1877r1878
372372   MDRV_CPU_ADD_TAG("main", Z80, 2216800)        /* 2,2168 Mhz */
373373   MDRV_CPU_PROGRAM_MAP(cgenie_mem, 0)
374374   MDRV_CPU_IO_MAP(cgenie_io, 0)
375   MDRV_CPU_VBLANK_INT(cgenie_frame_interrupt,1)
375   MDRV_CPU_VBLANK_INT("main", cgenie_frame_interrupt)
376376   MDRV_CPU_PERIODIC_INT(cgenie_timer_interrupt, 40)
377377   MDRV_INTERLEAVE(4)
378378
src/mess/drivers/abc80.c
r1877r1878
459459   MDRV_CPU_CONFIG(abc80_daisy_chain)
460460   MDRV_CPU_PROGRAM_MAP(abc80_map, 0)
461461   MDRV_CPU_IO_MAP(abc80_io_map, 0)
462   MDRV_CPU_VBLANK_INT(abc80_nmi_interrupt, 1)
462   MDRV_CPU_VBLANK_INT("main", abc80_nmi_interrupt)
463463
464464   MDRV_MACHINE_START(abc80)
465465
src/mess/drivers/apexc.c
r1877r1878
802802   MDRV_CPU_PROGRAM_MAP(apexc_mem_map, 0)
803803   MDRV_CPU_IO_MAP(apexc_io_map, 0)
804804   /* dummy interrupt: handles the control panel */
805   MDRV_CPU_VBLANK_INT(apexc_interrupt, 1)
805   MDRV_CPU_VBLANK_INT("main", apexc_interrupt)
806806   /*MDRV_CPU_PERIODIC_INT(func, rate)*/
807807
808808   MDRV_MACHINE_START( apexc )
src/mess/drivers/x68k.c
r1877r1878
346346// 4 channel DMA controller (Hitachi HD63450)
347347static WRITE16_HANDLER( x68k_dmac_w )
348348{
349   hd63450_w(offset, data, mem_mask);
349   hd63450_w(machine, offset, data, mem_mask);
350350}
351351
352352static READ16_HANDLER( x68k_dmac_r )
353353{
354   return hd63450_r(offset, mem_mask);
354   return hd63450_r(machine, offset, mem_mask);
355355}
356356
357357static void x68k_keyboard_ctrl_w(int data)
r1877r1878
566566   switch(offset)
567567   {
568568   case 0:
569      return scc_r(0);
569      return scc_r(machine, 0);
570570   case 1:
571571      return x68k_read_mouse();
572572   case 2:
573      return scc_r(1);
573      return scc_r(machine, 1);
574574   case 3:
575      return scc_r(3);
575      return scc_r(machine, 3);
576576   default:
577577      return 0xff;
578578   }
r1877r1878
586586   switch(offset)
587587   {
588588   case 0:
589      scc_w(0,(UINT8)data);
589      scc_w(machine, 0,(UINT8)data);
590590      if((scc_get_reg_b(5) & 0x02) != prev)
591591      {
592592         if(scc_get_reg_b(5) & 0x02)  // Request to Send
r1877r1878
599599      }
600600      break;
601601   case 1:
602      scc_w(2,(UINT8)data);
602      scc_w(machine, 2,(UINT8)data);
603603      break;
604604   case 2:
605      scc_w(1,(UINT8)data);
605      scc_w(machine, 1,(UINT8)data);
606606      break;
607607   case 3:
608      scc_w(3,(UINT8)data);
608      scc_w(machine, 3,(UINT8)data);
609609      break;
610610   }
611611   prev = scc_get_reg_b(5) & 0x02;
r1877r1878
693693   {
694694   case 0x00:
695695   case 0x01:
696      nec765_data_w(0,data);
696      nec765_data_w(machine, 0,data);
697697      break;
698698   case 0x02:  // drive option signal control
699699      x = data & 0x0f;
r1877r1878
736736   switch(offset)
737737   {
738738   case 0x00:
739      return nec765_status_r(0);
739      return nec765_status_r(machine, 0);
740740   case 0x01:
741      return nec765_data_r(0);
741      return nec765_data_r(machine, 0);
742742   case 0x02:
743743      ret = 0x00;
744744      for(x=0;x<4;x++)
r1877r1878
782782   int data = -1;
783783
784784   if(sys.fdc.drq_state != 0)
785      data = nec765_dack_r(0);
785      data = nec765_dack_r(Machine, 0);
786786//  logerror("FDC: DACK reading\n");
787787   return data;
788788}
789789
790790static void x68k_fdc_write_byte(int addr, int data)
791791{
792   nec765_dack_w(0,data);
792   nec765_dack_w(Machine, 0, data);
793793}
794794
795795static void fdc_drq(int state, int read_write)
r1877r1878
820820   switch(offset)
821821   {
822822   case 0x00:
823      YM2151_register_port_0_w(0,data);
823      YM2151_register_port_0_w(machine, 0, data);
824824      logerror("YM: Register select 0x%02x\n",data);
825825      break;
826826   case 0x01:
827      YM2151_data_port_0_w(0,data);
827      YM2151_data_port_0_w(machine, 0, data);
828828      logerror("YM: Data write 0x%02x\n",data);
829829      break;
830830   }
r1877r1878
833833static READ16_HANDLER( x68k_fm_r )
834834{
835835   if(offset == 0x01)
836      return YM2151_status_port_0_r(0);
836      return YM2151_status_port_0_r(machine, 0);
837837
838838   return 0xff;
839839}
r1877r1878
11451145
11461146static READ16_HANDLER( x68k_rtc_r )
11471147{
1148   return rp5c15_r(offset,mem_mask);
1148   return rp5c15_r(machine, offset, mem_mask);
11491149}
11501150
11511151static WRITE16_HANDLER( x68k_rtc_w )
11521152{
1153   rp5c15_w(offset,data,mem_mask);
1153   rp5c15_w(machine, offset, data, mem_mask);
11541154}
11551155
11561156static void x68k_rtc_alarm_irq(int state)
r1877r1878
19281928{
19291929   /*  Install RAM handlers  */
19301930   x68k_spriteram = (UINT16*)memory_region(REGION_USER1);
1931   memory_install_read16_handler(0,ADDRESS_SPACE_PROGRAM,0x000000,mess_ram_size-1,mess_ram_size-1,0,(read16_handler)1);
1932   memory_install_write16_handler(0,ADDRESS_SPACE_PROGRAM,0x000000,mess_ram_size-1,mess_ram_size-1,0,(write16_handler)1);
1931   memory_install_read16_handler(0,ADDRESS_SPACE_PROGRAM,0x000000,mess_ram_size-1,mess_ram_size-1,0,(read16_machine_func)1);
1932   memory_install_write16_handler(0,ADDRESS_SPACE_PROGRAM,0x000000,mess_ram_size-1,mess_ram_size-1,0,(write16_machine_func)1);
19331933   memory_set_bankptr(1,mess_ram);
1934   memory_install_read16_handler(0,ADDRESS_SPACE_PROGRAM,0xc00000,0xdfffff,0x1fffff,0,(read16_handler)x68k_gvram_r);
1935   memory_install_write16_handler(0,ADDRESS_SPACE_PROGRAM,0xc00000,0xdfffff,0x1fffff,0,(write16_handler)x68k_gvram_w);
1934   memory_install_read16_handler(0,ADDRESS_SPACE_PROGRAM,0xc00000,0xdfffff,0x1fffff,0,(read16_machine_func)x68k_gvram_r);
1935   memory_install_write16_handler(0,ADDRESS_SPACE_PROGRAM,0xc00000,0xdfffff,0x1fffff,0,(write16_machine_func)x68k_gvram_w);
19361936   memory_set_bankptr(2,gvram);  // so that code in VRAM is executable - needed for Terra Cresta
1937   memory_install_read16_handler(0,ADDRESS_SPACE_PROGRAM,0xe00000,0xe7ffff,0x07ffff,0,(read16_handler)x68k_tvram_r);
1938   memory_install_write16_handler(0,ADDRESS_SPACE_PROGRAM,0xe00000,0xe7ffff,0x07ffff,0,(write16_handler)x68k_tvram_w);
1937   memory_install_read16_handler(0,ADDRESS_SPACE_PROGRAM,0xe00000,0xe7ffff,0x07ffff,0,(read16_machine_func)x68k_tvram_r);
1938   memory_install_write16_handler(0,ADDRESS_SPACE_PROGRAM,0xe00000,0xe7ffff,0x07ffff,0,(write16_machine_func)x68k_tvram_w);
19391939   memory_set_bankptr(3,tvram);  // so that code in VRAM is executable - needed for Terra Cresta
1940   memory_install_read16_handler(0,ADDRESS_SPACE_PROGRAM,0xed0000,0xed3fff,0x003fff,0,(read16_handler)x68k_sram_r);
1941   memory_install_write16_handler(0,ADDRESS_SPACE_PROGRAM,0xed0000,0xed3fff,0x003fff,0,(write16_handler)x68k_sram_w);
1940   memory_install_read16_handler(0,ADDRESS_SPACE_PROGRAM,0xed0000,0xed3fff,0x003fff,0,(read16_machine_func)x68k_sram_r);
1941   memory_install_write16_handler(0,ADDRESS_SPACE_PROGRAM,0xed0000,0xed3fff,0x003fff,0,(write16_machine_func)x68k_sram_w);
19421942   memory_set_bankptr(4,generic_nvram16);  // so that code in SRAM is executable, there is an option for booting from SRAM
19431943
19441944   // start keyboard timer
r1877r1878
20022002   /* basic machine hardware */
20032003   MDRV_CPU_ADD_TAG("main", M68000, 10000000)  /* 10 MHz */
20042004   MDRV_CPU_PROGRAM_MAP(x68k_map, 0)
2005   MDRV_CPU_VBLANK_INT(x68k_vsync_irq,1)
2005   MDRV_CPU_VBLANK_INT("main", x68k_vsync_irq)
20062006   MDRV_INTERLEAVE(1)
20072007
20082008   MDRV_MACHINE_START( x68000 )
src/mess/drivers/spectrum.c
r1877r1878
319319
320320static  READ8_HANDLER ( spectrum_port_r )
321321{
322      if ((offset & 1)==0)
323         return spectrum_port_fe_r(offset);
322   if ((offset & 1)==0)
323      return spectrum_port_fe_r(machine, offset);
324324
325      if ((offset & 0xff)==0x1f)
326         return spectrum_port_1f_r(offset);
325   if ((offset & 0xff)==0x1f)
326      return spectrum_port_1f_r(machine, offset);
327327
328      if ((offset & 0xff)==0x7f)
329         return spectrum_port_7f_r(offset);
328   if ((offset & 0xff)==0x7f)
329      return spectrum_port_7f_r(machine, offset);
330330
331      if ((offset & 0xff)==0xdf)
332         return spectrum_port_df_r(offset);
331   if ((offset & 0xff)==0xdf)
332      return spectrum_port_df_r(machine, offset);
333333
334      return video_screen_get_vpos(0)<193 ? spectrum_colorram[(video_screen_get_vpos(0)&0xf8)<<2]:0xff;
334   return video_screen_get_vpos(0)<193 ? spectrum_colorram[(video_screen_get_vpos(0)&0xf8)<<2]:0xff;
335335}
336336
337337static WRITE8_HANDLER ( spectrum_port_w )
338338{
339339   if ((offset & 1)==0)
340      spectrum_port_fe_w(offset,data);
340      spectrum_port_fe_w(machine, offset,data);
341341   else
342342   {
343343      logerror("Write %02x to Port: %04x\n", data, offset);
r1877r1878
370370
371371static WRITE8_HANDLER(spectrum_128_port_7ffd_w)
372372{
373      /* D0-D2: RAM page located at 0x0c000-0x0ffff */
374      /* D3 - Screen select (screen 0 in ram page 5, screen 1 in ram page 7 */
375      /* D4 - ROM select - which rom paged into 0x0000-0x03fff */
376      /* D5 - Disable paging */
373   /* D0-D2: RAM page located at 0x0c000-0x0ffff */
374   /* D3 - Screen select (screen 0 in ram page 5, screen 1 in ram page 7 */
375   /* D4 - ROM select - which rom paged into 0x0000-0x03fff */
376   /* D5 - Disable paging */
377377
378      /* disable paging? */
379      if (spectrum_128_port_7ffd_data & 0x20)
380            return;
378   /* disable paging? */
379   if (spectrum_128_port_7ffd_data & 0x20)
380         return;
381381
382      /* store new state */
383      spectrum_128_port_7ffd_data = data;
382   /* store new state */
383   spectrum_128_port_7ffd_data = data;
384384
385      /* update memory */
386      spectrum_128_update_memory();
385   /* update memory */
386   spectrum_128_update_memory();
387387}
388388
389389extern void spectrum_128_update_memory(void)
390390{
391      unsigned char *ChosenROM;
392      int ROMSelection;
391   unsigned char *ChosenROM;
392   int ROMSelection;
393393
394      if (spectrum_128_port_7ffd_data & 8)
395      {
396            logerror("SCREEN 1: BLOCK 7\n");
397            spectrum_128_screen_location = spectrum_ram + (7<<14);
398      }
399      else
400      {
401            logerror("SCREEN 0: BLOCK 5\n");
402            spectrum_128_screen_location = spectrum_ram + (5<<14);
403      }
394   if (spectrum_128_port_7ffd_data & 8)
395   {
396         logerror("SCREEN 1: BLOCK 7\n");
397         spectrum_128_screen_location = spectrum_ram + (7<<14);
398   }
399   else
400   {
401         logerror("SCREEN 0: BLOCK 5\n");
402         spectrum_128_screen_location = spectrum_ram + (5<<14);
403   }
404404
405      /* select ram at 0x0c000-0x0ffff */
406      {
407            int ram_page;
408            unsigned char *ram_data;
405   /* select ram at 0x0c000-0x0ffff */
406   {
407         int ram_page;
408         unsigned char *ram_data;
409409
410            ram_page = spectrum_128_port_7ffd_data & 0x07;
411            ram_data = spectrum_ram + (ram_page<<14);
410         ram_page = spectrum_128_port_7ffd_data & 0x07;
411         ram_data = spectrum_ram + (ram_page<<14);
412412
413            memory_set_bankptr(4, ram_data);
414            memory_set_bankptr(8, ram_data);
413         memory_set_bankptr(4, ram_data);
414         memory_set_bankptr(8, ram_data);
415415
416            logerror("RAM at 0xc000: %02x\n",ram_page);
417      }
416         logerror("RAM at 0xc000: %02x\n",ram_page);
417   }
418418
419      /* ROM switching */
420      ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01);
419   /* ROM switching */
420   ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01);
421421
422      /* rom 0 is 128K rom, rom 1 is 48 BASIC */
422   /* rom 0 is 128K rom, rom 1 is 48 BASIC */
423423
424      ChosenROM = memory_region(REGION_CPU1) + 0x010000 + (ROMSelection<<14);
424   ChosenROM = memory_region(REGION_CPU1) + 0x010000 + (ROMSelection<<14);
425425
426      memory_set_bankptr(1, ChosenROM);
426   memory_set_bankptr(1, ChosenROM);
427427
428      logerror("rom switch: %02x\n", ROMSelection);
428   logerror("rom switch: %02x\n", ROMSelection);
429429}
430430
431431
432432
433433static WRITE8_HANDLER(spectrum_128_port_bffd_w)
434434{
435      AY8910_write_port_0_w(0, data);
435   AY8910_write_port_0_w(machine, 0, data);
436436}
437437
438438static WRITE8_HANDLER(spectrum_128_port_fffd_w)
439439{
440      AY8910_control_port_0_w(0, data);
440   AY8910_control_port_0_w(machine, 0, data);
441441}
442442
443443static  READ8_HANDLER(spectrum_128_port_fffd_r)
444444{
445      return AY8910_read_port_0_r(0);
445   return AY8910_read_port_0_r(machine, 0);
446446}
447447
448448static  READ8_HANDLER ( spectrum_128_port_r )
449449{
450450    if ((offset & 1)==0)
451451    {
452       return spectrum_port_fe_r(offset);
452       return spectrum_port_fe_r(machine, offset);
453453    }
454454
455455    if ((offset & 2)==0)
r1877r1878
460460            break;
461461
462462         case 3:
463            return spectrum_128_port_fffd_r(offset);
463            return spectrum_128_port_fffd_r(machine, offset);
464464      }
465465    }
466466
467467    /* don't think these are correct! */
468468    if ((offset & 0xff)==0x1f)
469       return spectrum_port_1f_r(offset);
469       return spectrum_port_1f_r(machine, offset);
470470
471471    if ((offset & 0xff)==0x7f)
472       return spectrum_port_7f_r(offset);
472       return spectrum_port_7f_r(machine, offset);
473473
474474    if ((offset & 0xff)==0xdf)
475       return spectrum_port_df_r(offset);
475       return spectrum_port_df_r(machine, offset);
476476
477477    return video_screen_get_vpos(0)<193 ? spectrum_128_screen_location[0x1800|(video_screen_get_vpos(0)&0xf8)<<2]:0xff;
478478}
r1877r1878
480480static WRITE8_HANDLER ( spectrum_128_port_w )
481481{
482482      if ((offset & 1)==0)
483            spectrum_port_fe_w(offset,data);
483            spectrum_port_fe_w(machine, offset,data);
484484
485485      /* Only decodes on A15, A14 & A1 */
486486      else if ((offset & 2)==0)
r1877r1878
488488            switch ((offset>>8) & 0xc0)
489489            {
490490                  case 0x40:
491                        spectrum_128_port_7ffd_w(offset, data);
491                        spectrum_128_port_7ffd_w(machine, offset, data);
492492                        break;
493493                  case 0x80:
494                        spectrum_128_port_bffd_w(offset, data);
494                        spectrum_128_port_bffd_w(machine, offset, data);
495495                        break;
496496                  case 0xc0:
497                        spectrum_128_port_fffd_w(offset, data);
497                        spectrum_128_port_fffd_w(machine, offset, data);
498498                        break;
499499                  default:
500500                        logerror("Write %02x to 128 port: %04x\n", data, offset);
r1877r1878
566566static WRITE8_HANDLER(spectrum_plus3_port_3ffd_w)
567567{
568568      if (~readinputport(16) & 0x20)
569            nec765_data_w(0,data);
569            nec765_data_w(machine, 0,data);
570570}
571571
572572static  READ8_HANDLER(spectrum_plus3_port_3ffd_r)
r1877r1878
574574      if (readinputport(16) & 0x20)
575575            return 0xff;
576576      else
577            return nec765_data_r(0);
577            return nec765_data_r(machine, 0);
578578}
579579
580580
r1877r1878
583583      if (readinputport(16) & 0x20)
584584            return 0xff;
585585      else
586            return nec765_status_r(0);
586            return nec765_status_r(machine, 0);
587587}
588588
589589
r1877r1878
722722{
723723    if ((offset & 1)==0)
724724    {
725       return spectrum_port_fe_r(offset);
725       return spectrum_port_fe_r(machine, offset);
726726    }
727727
728728    if ((offset & 2)==0)
r1877r1878
740740
741741               /* +3 fdc status */
742742               case 2:
743                  return spectrum_plus3_port_2ffd_r(offset);
743                  return spectrum_plus3_port_2ffd_r(machine, offset);
744744               /* +3 fdc data */
745745               case 3:
746                  return spectrum_plus3_port_3ffd_r(offset);
746                  return spectrum_plus3_port_3ffd_r(machine, offset);
747747
748748               default:
749749                  break;
r1877r1878
753753
754754         /* 128k AY data */
755755         case 3:
756            return spectrum_128_port_fffd_r(offset);
756            return spectrum_128_port_fffd_r(machine, offset);
757757
758758         default:
759759            break;
r1877r1878
766766static WRITE8_HANDLER ( spectrum_plus3_port_w )
767767{
768768      if ((offset & 1)==0)
769            spectrum_port_fe_w(offset,data);
769            spectrum_port_fe_w(machine, offset, data);
770770
771771      /* the following is not decoded exactly, need to check
772772        what is correct! */
r1877r1878
790790
791791                  /* +3 memory */
792792                  case 1:
793                     spectrum_plus3_port_1ffd_w(offset, data);
793                     spectrum_plus3_port_1ffd_w(machine, offset, data);
794794                     break;
795795
796796                  /* +3 fdc data */
797797                  case 3:
798                     spectrum_plus3_port_3ffd_w(offset,data);
798                     spectrum_plus3_port_3ffd_w(machine, offset, data);
799799                     break;
800800
801801                  default:
r1877r1878
806806
807807            /* 128k memory */
808808            case 1:
809               spectrum_plus3_port_7ffd_w(offset, data);
809               spectrum_plus3_port_7ffd_w(machine, offset, data);
810810               break;
811811
812812            /* 128k AY data */
813813            case 2:
814               spectrum_128_port_bffd_w(offset, data);
814               spectrum_128_port_bffd_w(machine, offset, data);
815815               break;
816816
817817            /* 128K AY register */
818818            case 3:
819               spectrum_128_port_fffd_w(offset, data);
819               spectrum_128_port_fffd_w(machine, offset, data);
820820
821821            default:
822822               break;
r1877r1878
870870
871871static WRITE8_HANDLER(ts2068_port_f5_w)
872872{
873      AY8910_control_port_0_w(0, data);
873      AY8910_control_port_0_w(machine, 0, data);
874874}
875875
876876static  READ8_HANDLER(ts2068_port_f6_r)
r1877r1878
881881           if both bits are set then OR values
882882           Bit 0 up, 1 down, 2 left, 3 right, 7 fire active low. Other bits 1
883883        */
884      return AY8910_read_port_0_r(0);
884      return AY8910_read_port_0_r(machine, 0);
885885}
886886
887887static WRITE8_HANDLER(ts2068_port_f6_w)
888888{
889      AY8910_write_port_0_w(0, data);
889      AY8910_write_port_0_w(machine, 0, data);
890890}
891891
892892static  READ8_HANDLER(ts2068_port_ff_r)
r1877r1878
908908}
909909
910910
911static READ8_HANDLER ( ts2068_port_r )
911static READ8_HANDLER ( ts2068_port_r )
912912{
913      switch (offset & 0xff)
914      {
915            /* Note: keys only decoded on port #fe not all even ports so
916                   ports #f4 & #f6 correctly read */
917            case 0xf4: return ts2068_port_f4_r(offset);
918            case 0xf6: return ts2068_port_f6_r(offset);
919            case 0xff: return ts2068_port_ff_r(offset);
913   switch (offset & 0xff)
914   {
915      /* Note: keys only decoded on port #fe not all even ports so
916           ports #f4 & #f6 correctly read */
917      case 0xf4: return ts2068_port_f4_r(machine, offset);
918      case 0xf6: return ts2068_port_f6_r(machine, offset);
919      case 0xff: return ts2068_port_ff_r(machine, offset);
920920
921            case 0xfe: return spectrum_port_fe_r(offset);
922            case 0x1f: return spectrum_port_1f_r(offset);
923            case 0x7f: return spectrum_port_7f_r(offset);
924            case 0xdf: return spectrum_port_df_r(offset);
925      }
926      logerror("Read from port: %04x\n", offset);
921      case 0xfe: return spectrum_port_fe_r(machine, offset);
922      case 0x1f: return spectrum_port_1f_r(machine, offset);
923      case 0x7f: return spectrum_port_7f_r(machine, offset);
924      case 0xdf: return spectrum_port_df_r(machine, offset);
925   }
926   logerror("Read from port: %04x\n", offset);
927927
928      return 0xff;
928   return 0xff;
929929}
930930
931931static WRITE8_HANDLER ( ts2068_port_w )
r1877r1878
935935   Port #fb is the Thermal printer port and works exactly as the Sinclair
936936   Printer - ie not yet emulated.
937937*/
938      switch (offset & 0xff)
939      {
940            case 0xfe: spectrum_port_fe_w(offset,data); break;
941            case 0xf4: ts2068_port_f4_w(offset,data); break;
942            case 0xf5: ts2068_port_f5_w(offset,data); break;
943            case 0xf6: ts2068_port_f6_w(offset,data); break;
944            case 0xff: ts2068_port_ff_w(offset,data); break;
945            default:
946                  logerror("Write %02x to Port: %04x\n", data, offset);
947      }
938   switch (offset & 0xff)
939   {
940      case 0xfe: spectrum_port_fe_w(machine, offset,data); break;
941      case 0xf4: ts2068_port_f4_w(machine, offset,data); break;
942      case 0xf5: ts2068_port_f5_w(machine, offset,data); break;
943      case 0xf6: ts2068_port_f6_w(machine, offset,data); break;
944      case 0xff: ts2068_port_ff_w(machine, offset,data); break;
945      default:
946            logerror("Write %02x to Port: %04x\n", data, offset);
947   }
948948}
949949
950950
r1877r1878
970970void ts2068_update_memory(void)
971971{
972972   unsigned char *ChosenROM, *ExROM, *DOCK;
973   read8_handler rh;
974   write8_handler wh;
973   read8_machine_func rh;
974   write8_machine_func wh;
975975
976976   DOCK = timex_cart_data;
977977
r1877r1878
13301330static  READ8_HANDLER ( tc2048_port_r )
13311331{
13321332      if ((offset & 1)==0)
1333            return spectrum_port_fe_r(offset);
1333            return spectrum_port_fe_r(machine, offset);
13341334      switch (offset & 0xff)
13351335      {
1336            case 0xff: return ts2068_port_ff_r(offset);
1337            case 0x1f: return spectrum_port_1f_r(offset);
1338            case 0x7f: return spectrum_port_7f_r(offset);
1339            case 0xdf: return spectrum_port_df_r(offset);
1336            case 0xff: return ts2068_port_ff_r(machine, offset);
1337            case 0x1f: return spectrum_port_1f_r(machine, offset);
1338            case 0x7f: return spectrum_port_7f_r(machine, offset);
1339            case 0xdf: return spectrum_port_df_r(machine, offset);
13401340      }
13411341
13421342      logerror("Read from port: %04x\n", offset);
r1877r1878
13461346static WRITE8_HANDLER ( tc2048_port_w )
13471347{
13481348      if ((offset & 1)==0)
1349            spectrum_port_fe_w(offset,data);
1349            spectrum_port_fe_w(machine, offset,data);
13501350      else if ((offset & 0xff)==0xff)
1351            tc2048_port_ff_w(offset,data);
1351            tc2048_port_ff_w(offset, data);
13521352      else
13531353      {
13541354            logerror("Write %02x to Port: %04x\n", data, offset);
r1877r1878
15211521{
15221522   unsigned char *ChosenROM;
15231523   int ROMSelection;
1524   read8_handler rh;
1525   write8_handler wh;
1524   read8_machine_func rh;
1525   write8_machine_func wh;
15261526
15271527   if (spectrum_128_port_7ffd_data & 8)
15281528   {
r1877r1878
16271627{
16281628    if ((offset & 1)==0)
16291629    {
1630       return spectrum_port_fe_r(offset);
1630       return spectrum_port_fe_r(machine, offset);
16311631    }
16321632
16331633    /* KT: the following is not decoded exactly, need to check what
r1877r1878
16361636    {
16371637       switch ((offset>>8) & 0xff)
16381638       {
1639            case 0xff: return spectrum_128_port_fffd_r(offset);
1640            case 0x1f: return spectrum_port_1f_r(offset);
1641            case 0x7f: return spectrum_port_7f_r(offset);
1642            case 0xdf: return spectrum_port_df_r(offset);
1639            case 0xff: return spectrum_128_port_fffd_r(machine, offset);
1640            case 0x1f: return spectrum_port_1f_r(machine, offset);
1641            case 0x7f: return spectrum_port_7f_r(machine, offset);
1642            case 0xdf: return spectrum_port_df_r(machine, offset);
16431643       }
16441644    }
16451645#if 0
16461646    switch (offset & 0x0ff)
16471647    {
16481648      case 0x01f:
1649         return wd17xx_status_r(offset);
1649         return wd17xx_status_r(machine, offset);
16501650      case 0x03f:
1651         return wd17xx_track_r(offset);
1651         return wd17xx_track_r(machine, offset);
16521652      case 0x05f:
1653         return wd17xx_sector_r(offset);
1653         return wd17xx_sector_r(machine, offset);
16541654      case 0x07f:
1655         return wd17xx_data_r(offset);
1655         return wd17xx_data_r(machine, offset);
16561656      case 0x0ff:
16571657         return betadisk_status;
16581658    }
r1877r1878
16681668static WRITE8_HANDLER(scorpion_port_w)
16691669{
16701670   if ((offset & 1)==0)
1671      spectrum_port_fe_w(offset,data);
1671      spectrum_port_fe_w(machine, offset, data);
16721672
16731673   else if ((offset & 2)==0)
16741674   {
16751675         switch ((offset>>8) & 0xf0)
16761676         {
16771677            case 0x70:
1678                  scorpion_port_7ffd_w(offset, data);
1678                  scorpion_port_7ffd_w(machine, offset, data);
16791679                  break;
16801680            case 0xb0:
1681                  spectrum_128_port_bffd_w(offset, data);
1681                  spectrum_128_port_bffd_w(machine, offset, data);
16821682                  break;
16831683            case 0xf0:
1684                  spectrum_128_port_fffd_w(offset, data);
1684                  spectrum_128_port_fffd_w(machine, offset, data);
16851685                  break;
16861686            case 0x10:
1687                  scorpion_port_1ffd_w(offset, data);
1687                  scorpion_port_1ffd_w(machine, offset, data);
16881688                  break;
16891689            default:
16901690                  logerror("Write %02x to scorpion port: %04x\n", data, offset);
r1877r1878
19771977   MDRV_CPU_ADD_TAG("main", Z80, 3500000)        /* 3.5 Mhz */
19781978   MDRV_CPU_PROGRAM_MAP(spectrum_mem, 0)
19791979   MDRV_CPU_IO_MAP(spectrum_io, 0)
1980   MDRV_CPU_VBLANK_INT(spec_interrupt,1)
1980   MDRV_CPU_VBLANK_INT("main", spec_interrupt)
19811981   MDRV_INTERLEAVE(1)
19821982
19831983   MDRV_MACHINE_RESET( spectrum )
src/mess/drivers/mpf1.c
r1877r1878
487487   data = ~kbdlatch;
488488
489489   // watchdog reset
490   watchdog_reset_w(0, ~data & 0x40);
490   watchdog_reset(machine);
491491
492492   // TONE led & speaker
493493   led_tone = (~data & 0x80) >> 7;
r1877r1878
541541   MDRV_CPU_ADD(Z80, 3579500/2)   // 1.79 MHz
542542   MDRV_CPU_PROGRAM_MAP(mpf1_map, 0)
543543   MDRV_CPU_IO_MAP(mpf1_io_map, 0)
544   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
544   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
545545
546546   MDRV_MACHINE_RESET( mpf1 )
547547
src/mess/drivers/astrocde.c
r1877r1878
3535 ****************************************************************************/
3636
3737#include "driver.h"
38#include "deprecat.h"
3839#include "sound/astrocde.h"
3940#include "includes/astrocde.h"
4041#include "devices/cartslot.h"
r1877r1878
4647
4748static WRITE8_HANDLER( astrocade_soundblock1_w )
4849{
49   astrocade_sound1_w(offset + 0x18, data);
50   astrocade_sound1_w(machine, offset + 0x18, data);
5051}
5152
5253static ADDRESS_MAP_START( astrocade_mem, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
7980   AM_RANGE(0x1d, 0x1d) AM_MIRROR(0xff00) AM_READ(input_port_9_r)
8081   AM_RANGE(0x1e, 0x1e) AM_MIRROR(0xff00) AM_READ(input_port_10_r)
8182   AM_RANGE(0x1f, 0x1f) AM_MIRROR(0xff00) AM_READ(input_port_11_r)
82   AM_SPACE(0x18, 0xff) AM_WRITE(astrocade_soundblock1_w)
8383   AM_RANGE(0x19, 0x19) AM_MIRROR(0xff00) AM_WRITE(astrocade_magic_expand_color_w)
84   AM_RANGE(0x18, 0xff) AM_MIRROR(0xff00) AM_WRITE(astrocade_soundblock1_w)
8485ADDRESS_MAP_END
8586
8687static INPUT_PORTS_START( astrocde )
r1877r1878
173174   MDRV_CPU_ADD(Z80, 1789000)        /* 1.789 Mhz */
174175   MDRV_CPU_PROGRAM_MAP(astrocade_mem, 0)
175176   MDRV_CPU_IO_MAP(astrocade_io, 0)
176   MDRV_CPU_VBLANK_INT(astrocade_interrupt,256)
177   MDRV_CPU_VBLANK_INT_HACK(astrocade_interrupt, 256)
177178   MDRV_INTERLEAVE(1)
178179
179180    /* video hardware */
src/mess/drivers/kaypro.c
r1877r1878
235235   MDRV_CPU_ADD_TAG("main", Z80, 4000000)        /* 4 Mhz */
236236   MDRV_CPU_PROGRAM_MAP(kaypro_mem, 0)
237237   MDRV_CPU_IO_MAP(kaypro_io, 0)
238   MDRV_CPU_VBLANK_INT(kaypro_interrupt, 1)
238   MDRV_CPU_VBLANK_INT("main", kaypro_interrupt)
239239   MDRV_INTERLEAVE(4)
240240
241241   MDRV_MACHINE_RESET( kaypro )
src/mess/drivers/n64.c
r1877r1878
8484   MDRV_CPU_ADD(R4600BE, 93750000)
8585   MDRV_CPU_CONFIG(config)
8686   MDRV_CPU_PROGRAM_MAP(n64_map, 0)
87   MDRV_CPU_VBLANK_INT( n64_vblank, 1 )
87   MDRV_CPU_VBLANK_INT("main", n64_vblank)
8888
8989   MDRV_CPU_ADD(RSP, 62500000)
9090   MDRV_CPU_CONFIG(n64_rsp_config)
src/mess/drivers/atarist.c
r1877r1878
8989
9090static void atarist_fdc_dma_transfer(void)
9191{
92   running_machine *machine = Machine;
9293   UINT8 *RAM = memory_region(REGION_CPU1);
9394
9495   if ((fdc.mode & ATARIST_FLOPPY_MODE_DMA_DISABLE) == 0)
r1877r1878
9798      {
9899         if (fdc.mode & ATARIST_FLOPPY_MODE_WRITE)
99100         {
100            wd17xx_data_w(0, RAM[fdc.dmabase]);
101            wd17xx_data_w(machine, 0, RAM[fdc.dmabase]);
101102         }
102103         else
103104         {
104            RAM[fdc.dmabase] = wd17xx_data_r(0);
105            RAM[fdc.dmabase] = wd17xx_data_r(machine, 0);
105106         }
106107
107108         fdc.dmabase++;
r1877r1878
164165      }
165166      else
166167      {
167         return wd17xx_r((fdc.mode & ATARIST_FLOPPY_MODE_ADDRESS_MASK) >> 1);
168         return wd17xx_r(machine, (fdc.mode & ATARIST_FLOPPY_MODE_ADDRESS_MASK) >> 1);
168169      }
169170   }
170171}
r1877r1878
193194      }
194195      else
195196      {
196         wd17xx_w((fdc.mode & ATARIST_FLOPPY_MODE_ADDRESS_MASK) >> 1, data);
197         wd17xx_w(machine, (fdc.mode & ATARIST_FLOPPY_MODE_ADDRESS_MASK) >> 1, data);
197198      }
198199   }
199200}
r1877r1878
754755{
755756   if (ACCESSING_MSB16)
756757   {
757      return scc_r(offset);
758      return scc_r(machine, offset);
758759   }
759760   else
760761   {
r1877r1878
766767{
767768   if (ACCESSING_MSB16)
768769   {
769      scc_w(offset, data);
770      scc_w(machine, offset, data);
770771   }
771772}
772773
src/mess/drivers/geneve.c
r1877r1878
198198*/
199199
200200#include "driver.h"
201#include "deprecat.h"
201202#include "video/v9938.h"
202203#include "includes/geneve.h"
203204#include "machine/ti99_4x.h"
r1877r1878
450451   MDRV_CPU_ADD(TMS9995, 12000000)
451452   MDRV_CPU_PROGRAM_MAP(memmap, 0)
452453   MDRV_CPU_IO_MAP(readcru, writecru)
453   MDRV_CPU_VBLANK_INT(geneve_hblank_interrupt, 262)   /* 262.5 in 60Hz, 312.5 in 50Hz */
454   MDRV_CPU_VBLANK_INT_HACK(geneve_hblank_interrupt, 262)   /* 262.5 in 60Hz, 312.5 in 50Hz */
454455
455456   MDRV_MACHINE_START( geneve )
456457   MDRV_MACHINE_RESET( geneve )
src/mess/drivers/sg1000.c
r1877r1878
557557   MDRV_CPU_ADD(Z80, XTAL_10_738635MHz/3)
558558   MDRV_CPU_PROGRAM_MAP(sg1000_map, 0)
559559   MDRV_CPU_IO_MAP(sg1000_io_map, 0)
560   MDRV_CPU_VBLANK_INT(sg1000_int, 1)
560   MDRV_CPU_VBLANK_INT("main", sg1000_int)
561561
562562   MDRV_MACHINE_START( sg1000 )
563563
r1877r1878
578578   MDRV_CPU_ADD(Z80, XTAL_10_738635MHz/3)
579579   MDRV_CPU_PROGRAM_MAP(sc3000_map, 0)
580580   MDRV_CPU_IO_MAP(sc3000_io_map, 0)
581   MDRV_CPU_VBLANK_INT(sg1000_int, 1)
581   MDRV_CPU_VBLANK_INT("main", sg1000_int)
582582
583583   MDRV_MACHINE_START( sc3000 )
584584
r1877r1878
599599   MDRV_CPU_ADD(Z80, XTAL_10_738635MHz/3)
600600   MDRV_CPU_PROGRAM_MAP(sf7000_map, 0)
601601   MDRV_CPU_IO_MAP(sf7000_io_map, 0)
602   MDRV_CPU_VBLANK_INT(sg1000_int, 1)
602   MDRV_CPU_VBLANK_INT("main", sg1000_int)
603603
604604   MDRV_MACHINE_START( sf7000 )
605605   MDRV_MACHINE_RESET( sf7000 )
src/mess/drivers/tx0.c
r1877r1878
331331   MDRV_CPU_CONFIG(tx0_reset_param)
332332   MDRV_CPU_PROGRAM_MAP(tx0_64kw_map, 0)
333333   /* dummy interrupt: handles input */
334   MDRV_CPU_VBLANK_INT(tx0_interrupt, 1)
334   MDRV_CPU_VBLANK_INT("main", tx0_interrupt)
335335
336336   MDRV_MACHINE_START( tx0 )
337337   MDRV_MACHINE_RESET( tx0 )
src/mess/drivers/ip22.c
r1877r1878
149149static UINT32 nIOC_ParReadCnt;
150150
151151// raise a local0 interrupt
152static void int3_raise_local0_irq(UINT8 source_mask)
152static void int3_raise_local0_irq(running_machine *machine, UINT8 source_mask)
153153{
154154   // signal the interrupt is pending
155155   int3_regs[0] |= source_mask;
r1877r1878
157157   // if it's not masked, also assert it now at the CPU
158158   if (int3_regs[1] & source_mask)
159159   {
160      cpunum_set_input_line(Machine, 0, MIPS3_IRQ0, ASSERT_LINE);
160      cpunum_set_input_line(machine, 0, MIPS3_IRQ0, ASSERT_LINE);
161161   }
162162}
163163
r1877r1878
194194   switch( offset )
195195   {
196196   case 0x004/4:
197      ret8 = pc_parallelport0_r(2) ^ 0x0d;
197      ret8 = pc_parallelport0_r(machine, 2) ^ 0x0d;
198198      verboselog( 0, "Parallel Control Read: %02x\n", ret8 );
199199      return ret8;
200200      break;
r1877r1878
205205//      }
206206//      else
207207//      {
208         ret8 = pc_parallelport0_r(1) ^ 0x80;
208         ret8 = pc_parallelport0_r(machine, 1) ^ 0x80;
209209//          nIOC_ParReadCnt++;
210210//      }
211211      verboselog( 0, "Parallel Status Read: %02x\n", ret8 );
r1877r1878
230230      return 0x00000004;
231231      break;
232232   case 0x40/4:
233      return kbdc8042_8_r(0);
233      return kbdc8042_8_r(machine, 0);
234234      break;
235235   case 0x44/4:
236      return kbdc8042_8_r(4);
236      return kbdc8042_8_r(machine, 4);
237237      break;
238238   case 0x58/4:
239239      return 0x20;   // chip rev 1, board rev 0, "Guinness" (Indy) => 0x01 for "Full House" (Indigo2)
r1877r1878
254254      return int3_regs[offset-0x80/4];
255255      break;
256256   case 0xb0/4:
257      ret8 = pit8253_0_r(0);
257      ret8 = pit8253_0_r(machine, 0);
258258      verboselog( 0, "HPC PBUS6 IOC4 Timer Counter 0 Register Read: 0x%02x (%08x)\n", ret8, mem_mask );
259259      return ret8;
260260      break;
261261   case 0xb4/4:
262      ret8 = pit8253_0_r(1);
262      ret8 = pit8253_0_r(machine, 1);
263263      verboselog( 0, "HPC PBUS6 IOC4 Timer Counter 1 Register Read: 0x%02x (%08x)\n", ret8, mem_mask );
264264      return ret8;
265265      break;
266266   case 0xb8/4:
267      ret8 = pit8253_0_r(2);
267      ret8 = pit8253_0_r(machine, 2);
268268      verboselog( 0, "HPC PBUS6 IOC4 Timer Counter 2 Register Read: 0x%02x (%08x)\n", ret8, mem_mask );
269269      return ret8;
270270      break;
271271   case 0xbc/4:
272      ret8 = pit8253_0_r(3);
272      ret8 = pit8253_0_r(machine, 3);
273273      verboselog( 0, "HPC PBUS6 IOC4 Timer Control Word Register Read: 0x%02x (%08x)\n", ret8, mem_mask );
274274      return ret8;
275275      break;
r1877r1878
288288   {
289289   case 0x004/4:
290290      verboselog( 0, "Parallel Control Write: %08x\n", data );
291      pc_parallelport0_w(2, data ^ 0x0d);
291      pc_parallelport0_w(machine, 2, data ^ 0x0d);
292292//      nIOC_ParCntl = data;
293293      break;
294294   case 0x030/4:
r1877r1878
322322      }
323323      break;
324324   case 0x40/4:
325      kbdc8042_8_w(0, data);
325      kbdc8042_8_w(machine, 0, data);
326326      break;
327327   case 0x44/4:
328      kbdc8042_8_w(4, data);
328      kbdc8042_8_w(machine, 4, data);
329329      break;
330330   case 0x80/4:
331331   case 0x84/4:
r1877r1878
343343      // if no local0 interrupts now, clear the input to the CPU
344344      if ((int3_regs[0] & int3_regs[1]) == 0)
345345      {
346         cpunum_set_input_line(Machine, 0, MIPS3_IRQ0, CLEAR_LINE);
346         cpunum_set_input_line(machine, 0, MIPS3_IRQ0, CLEAR_LINE);
347347      }
348348      else
349349      {
350         cpunum_set_input_line(Machine, 0, MIPS3_IRQ0, ASSERT_LINE);
350         cpunum_set_input_line(machine, 0, MIPS3_IRQ0, ASSERT_LINE);
351351      }
352352
353353      // if no local1 interrupts now, clear the input to the CPU
354354      if ((int3_regs[2] & int3_regs[3]) == 0)
355355      {
356         cpunum_set_input_line(Machine, 0, MIPS3_IRQ1, CLEAR_LINE);
356         cpunum_set_input_line(machine, 0, MIPS3_IRQ1, CLEAR_LINE);
357357      }
358358      else
359359      {
360         cpunum_set_input_line(Machine, 0, MIPS3_IRQ1, ASSERT_LINE);
360         cpunum_set_input_line(machine, 0, MIPS3_IRQ1, ASSERT_LINE);
361361      }
362362      break;
363363   case 0xb0/4:
364364      verboselog( 0, "HPC PBUS6 IOC4 Timer Counter 0 Register Write: 0x%08x (%08x)\n", data, mem_mask );
365      pit8253_0_w(0, data & 0x000000ff);
365      pit8253_0_w(machine, 0, data & 0x000000ff);
366366      return;
367367      break;
368368   case 0xb4/4:
369369      verboselog( 0, "HPC PBUS6 IOC4 Timer Counter 1 Register Write: 0x%08x (%08x)\n", data, mem_mask );
370      pit8253_0_w(1, data & 0x000000ff);
370      pit8253_0_w(machine, 1, data & 0x000000ff);
371371      return;
372372      break;
373373   case 0xb8/4:
374374      verboselog( 0, "HPC PBUS6 IOC4 Timer Counter 2 Register Write: 0x%08x (%08x)\n", data, mem_mask );
375      pit8253_0_w(2, data & 0x000000ff);
375      pit8253_0_w(machine, 2, data & 0x000000ff);
376376      return;
377377      break;
378378   case 0xbc/4:
379379      verboselog( 0, "HPC PBUS6 IOC4 Timer Control Word Register Write: 0x%08x (%08x)\n", data, mem_mask );
380      pit8253_0_w(3, data & 0x000000ff);
380      pit8253_0_w(machine, 3, data & 0x000000ff);
381381      return;
382382      break;
383383   default:
r1877r1878
455455//      verboselog( 2, "HPC3 HD0 Status Read: %08x (%08x): %08x\n", 0x1fb90000 + ( offset << 2), mem_mask, nHPC3_hd0_regs[0x17] );
456456      if (!(mem_mask & 0x000000ff))
457457      {
458         return wd33c93_r( 0 );
458         return wd33c93_r( machine, 0 );
459459      }
460460      else
461461      {
r1877r1878
467467//      verboselog( 2, "HPC3 HD0 Register Read: %08x (%08x): %08x\n", 0x1fb90000 + ( offset << 2), mem_mask, nHPC3_hd0_regs[nHPC3_hd0_register] );
468468      if (!(mem_mask & 0x000000ff))
469469      {
470         return wd33c93_r( 1 );
470         return wd33c93_r( machine, 1 );
471471      }
472472      else
473473      {
r1877r1878
491491//      verboselog( 2, "HPC3 HD0 Register Select Write: %08x\n", data );
492492      if (!(mem_mask & 0x000000ff))
493493      {
494         wd33c93_w( 0, data & 0x000000ff );
494         wd33c93_w( machine, 0, data & 0x000000ff );
495495      }
496496      break;
497497   case 0x0004/4:
r1877r1878
499499//      verboselog( 2, "HPC3 HD0 Register %d Write: %08x\n", nHPC3_hd0_register, data );
500500      if (!(mem_mask & 0x000000ff))
501501      {
502         wd33c93_w( 1,  data & 0x000000ff );
502         wd33c93_w( machine, 1,  data & 0x000000ff );
503503      }
504504      break;
505505   default:
r1877r1878
919919static WRITE32_HANDLER( ip22_write_ram )
920920{
921921   // if banks 2 or 3 are enabled, do nothing, we don't support that much memory
922   if (mc_r(0xc8/4, 0xffffffff) & 0x10001000)
922   if (mc_r(machine, 0xc8/4, 0xffffffff) & 0x10001000)
923923   {
924924      // a random perturbation so the memory test fails
925925      data ^= 0xffffffff;
926926   }
927927
928928   // if banks 0 or 1 have 2 subbanks, also kill it, we only want 128 MB
929   if (mc_r(0xc0/4, 0xffffffff) & 0x40004000)
929   if (mc_r(machine, 0xc0/4, 0xffffffff) & 0x40004000)
930930   {
931931      // a random perturbation so the memory test fails
932932      data ^= 0xffffffff;
r1877r1878
12771277
12781278static void scsi_irq(int state)
12791279{
1280   running_machine *machine = Machine;
1281
12801282   if (state)
12811283   {
12821284      if (wd33c93_get_dma_count())
r1877r1878
14161418      nHPC_SCSI0DMACtrl &= ~HPC3_DMACTRL_ENABLE;
14171419
14181420      // set the interrupt
1419      int3_raise_local0_irq(INT3_LOCAL0_SCSI0);
1421      int3_raise_local0_irq(machine, INT3_LOCAL0_SCSI0);
14201422   }
14211423   else
14221424   {
r1877r1878
15811583   MDRV_CPU_ADD_TAG( "main", R5000BE, 50000000*3 )
15821584   MDRV_CPU_CONFIG( config )
15831585   MDRV_CPU_PROGRAM_MAP( ip225015_map, 0 )
1584   MDRV_CPU_VBLANK_INT( ip22_vbl, 1 )
1586   MDRV_CPU_VBLANK_INT("main", ip22_vbl)
15851587
15861588   MDRV_MACHINE_RESET( ip225015 )
15871589   MDRV_NVRAM_HANDLER( ip22 )
src/mess/drivers/c128.c
r1877r1878
11701170   MDRV_CPU_ADD_TAG("main", Z80, VIC6567_CLOCK)
11711171   MDRV_CPU_PROGRAM_MAP( c128_z80_mem, 0 )
11721172   MDRV_CPU_IO_MAP( c128_z80_io, 0 )
1173   MDRV_CPU_VBLANK_INT(c64_frame_interrupt, 1)
1173   MDRV_CPU_VBLANK_INT("main", c64_frame_interrupt)
11741174   MDRV_CPU_PERIODIC_INT(vic2_raster_irq, VIC2_HRETRACERATE)
11751175
11761176   MDRV_CPU_ADD_TAG("m8502", M8502, VIC6567_CLOCK)
11771177   MDRV_CPU_PROGRAM_MAP( c128_mem, 0 )
1178   MDRV_CPU_VBLANK_INT(c64_frame_interrupt, 1)
1178   MDRV_CPU_VBLANK_INT("main", c64_frame_interrupt)
11791179   MDRV_CPU_PERIODIC_INT(vic2_raster_irq, VIC2_HRETRACERATE)
11801180
11811181   MDRV_INTERLEAVE(0)
src/mess/drivers/exidy.c
r1877r1878
274274   serial_connection_init(&cassette_serial_connection);
275275   serial_connection_set_in_callback(&cassette_serial_connection, cassette_serial_in);
276276
277   exidy_fe_port_w(0,0);
277   exidy_fe_port_w(machine, 0, 0);
278278
279279   timer_set(attotime_zero, NULL, 0, exidy_reset_timer_callback);
280280
r1877r1878
303303   serial_connection_init(&cassette_serial_connection);
304304   serial_connection_set_in_callback(&cassette_serial_connection, cassette_serial_in);
305305
306   exidy_fe_port_w(0,0);
306   exidy_fe_port_w(machine, 0, 0);
307307
308308   timer_set(attotime_zero, NULL, 0, exidy_reset_timer_callback);
309309
r1877r1878
315315   switch (offset & 0x03)
316316   {
317317   case 0:
318      return wd17xx_status_r(offset);
318      return wd17xx_status_r(machine, offset);
319319   case 1:
320      return wd17xx_track_r(offset);
320      return wd17xx_track_r(machine, offset);
321321   case 2:
322      return wd17xx_sector_r(offset);
322      return wd17xx_sector_r(machine, offset);
323323   case 3:
324      return wd17xx_data_r(offset);
324      return wd17xx_data_r(machine, offset);
325325   default:
326326      break;
327327   }
r1877r1878
334334   switch (offset & 0x03)
335335   {
336336   case 0:
337      wd17xx_command_w(offset, data);
337      wd17xx_command_w(machine, offset, data);
338338      return;
339339   case 1:
340      wd17xx_track_w(offset, data);
340      wd17xx_track_w(machine, offset, data);
341341      return;
342342   case 2:
343      wd17xx_sector_w(offset, data);
343      wd17xx_sector_w(machine, offset, data);
344344      return;
345345   case 3:
346      wd17xx_data_w(offset, data);
346      wd17xx_data_w(machine, offset, data);
347347      return;
348348   default:
349349      break;
r1877r1878
377377   logerror("exidy fc w: %04x %02x\n",offset,data);
378378
379379   hd6402_set_input(HD6402_INPUT_TBRL, HD6402_INPUT_TBRL);
380   hd6402_data_w(offset,data);
380   hd6402_data_w(machine, offset, data);
381381}
382382
383383
r1877r1878
552552
553553}
554554
555static READ8_HANDLER(exidy_fc_port_r)
555static READ8_HANDLER(exidy_fc_port_r)
556556{
557557   int data;
558558
559559   hd6402_set_input(HD6402_INPUT_DRR, HD6402_INPUT_DRR);
560   data = hd6402_data_r(offset);
560   data = hd6402_data_r(machine, offset);
561561
562562   logerror("exidy fc r: %04x %02x\n",offset,data);
563563
564564   return data;
565565}
566566
567static READ8_HANDLER(exidy_fd_port_r)
567static READ8_HANDLER(exidy_fd_port_r)
568568{
569569   int data;
570570   /* set unused bits high */
src/mess/drivers/pc8801.c
r1877r1878
507507   MDRV_CPU_ADD_TAG("main", Z80, 4000000)        /* 4 Mhz */
508508   MDRV_CPU_PROGRAM_MAP(pc8801_mem, 0)
509509   MDRV_CPU_IO_MAP(pc88sr_io, 0)
510   MDRV_CPU_VBLANK_INT(pc8801_interrupt,1)
510   MDRV_CPU_VBLANK_INT("main", pc8801_interrupt)
511511
512512   /* sub CPU(5 inch floppy drive) */
513513   MDRV_CPU_ADD_TAG("sub", Z80, 4000000)      /* 4 Mhz */
514514   MDRV_CPU_PROGRAM_MAP(pc8801fd_mem, 0)
515515   MDRV_CPU_IO_MAP(pc8801fd_io, 0)
516   MDRV_CPU_VBLANK_INT(pc8801fd_interrupt,1)
516   MDRV_CPU_VBLANK_INT("main", pc8801fd_interrupt)
517517
518518   MDRV_INTERLEAVE(5000)
519519
src/mess/drivers/p2000t.c
r1877r1878
204204   MDRV_CPU_ADD(Z80, 2500000)
205205   MDRV_CPU_PROGRAM_MAP(p2000t_mem, 0)
206206   MDRV_CPU_IO_MAP(p2000t_io, 0)
207   MDRV_CPU_VBLANK_INT(p2000_interrupt, 1)
207   MDRV_CPU_VBLANK_INT("main", p2000_interrupt)
208208
209209    /* video hardware */
210210   MDRV_IMPORT_FROM( vh_saa5050 )
r1877r1878
222222   MDRV_CPU_ADD(Z80, 2500000)
223223   MDRV_CPU_PROGRAM_MAP(p2000m_mem, 0)
224224   MDRV_CPU_IO_MAP(p2000t_io, 0)
225   MDRV_CPU_VBLANK_INT(p2000_interrupt, 1)
225   MDRV_CPU_VBLANK_INT("main", p2000_interrupt)
226226   MDRV_INTERLEAVE(1)
227227
228228    /* video hardware */
src/mess/drivers/pet.c
r1877r1878
143143   AM_RANGE(0xe810, 0xe813) AM_READWRITE(pia_0_r, pia_0_w)
144144   AM_RANGE(0xe820, 0xe823) AM_READWRITE(pia_1_r, pia_1_w)
145145   AM_RANGE(0xe840, 0xe84f) AM_READWRITE(via_0_r, via_0_w)
146   AM_RANGE(0xe880, 0xe880) AM_WRITE( pet_mc6845_address_w )
147   AM_RANGE(0xe881, 0xe881) AM_READWRITE(pet_mc6845_register_r, pet_mc6845_register_w)
146   AM_RANGE(0xe880, 0xe880) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
147   AM_RANGE(0xe881, 0xe881) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
148148   AM_RANGE(0xf000, 0xffff) AM_ROM
149149ADDRESS_MAP_END
150150
r1877r1878
160160   AM_RANGE(0xe810, 0xe813) AM_READWRITE(pia_0_r, pia_0_w)
161161   AM_RANGE(0xe820, 0xe823) AM_READWRITE(pia_1_r, pia_1_w)
162162   AM_RANGE(0xe840, 0xe84f) AM_READWRITE(via_0_r, via_0_w)
163   AM_RANGE(0xe880, 0xe880) AM_WRITE( pet_mc6845_address_w )
164   AM_RANGE(0xe881, 0xe881) AM_READWRITE(pet_mc6845_register_r, pet_mc6845_register_w)
163   AM_RANGE(0xe880, 0xe880) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
164   AM_RANGE(0xe881, 0xe881) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
165165#endif
166166   AM_RANGE(0xf000, 0xffff) AM_READ(MRA8_BANK8)
167167   AM_RANGE(0xf000, 0xffef) AM_WRITE(MWA8_BANK8)
r1877r1878
191191   AM_RANGE(0xe810, 0xe813) AM_READWRITE(pia_0_r, pia_0_w)
192192   AM_RANGE(0xe820, 0xe823) AM_READWRITE(pia_1_r, pia_1_w)
193193   AM_RANGE(0xe840, 0xe84f) AM_READWRITE(via_0_r, via_0_w)
194   AM_RANGE(0xe880, 0xe880) AM_WRITE(pet_mc6845_address_w)
195   AM_RANGE(0xe881, 0xe881) AM_READWRITE(pet_mc6845_register_r, pet_mc6845_register_w)
194   AM_RANGE(0xe880, 0xe880) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
195   AM_RANGE(0xe881, 0xe881) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
196196   /* 0xefe0, 0xefe3, mos 6702 */
197197   /* 0xeff0, 0xeff3, acia6551 */
198198   AM_RANGE(0xeff8, 0xefff) AM_READWRITE(superpet_r, superpet_w)
r1877r1878
207207   AM_RANGE(0xe810, 0xe813) AM_READWRITE(pia_0_r, pia_0_w)
208208   AM_RANGE(0xe820, 0xe823) AM_READWRITE(pia_1_r, pia_1_w)
209209   AM_RANGE(0xe840, 0xe84f) AM_READWRITE(via_0_r, via_0_w)
210   AM_RANGE(0xe880, 0xe880) AM_WRITE(pet_mc6845_address_w)
211   AM_RANGE(0xe881, 0xe881) AM_READWRITE(pet_mc6845_register_r, pet_mc6845_register_w)
210   AM_RANGE(0xe880, 0xe880) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
211   AM_RANGE(0xe881, 0xe881) AM_DEVREADWRITE(MC6845, "crtc", mc6845_register_r, mc6845_register_w)
212212   AM_RANGE(0xeff8, 0xefff) AM_READWRITE(superpet_r, superpet_w)
213213   AM_RANGE(0xf000, 0xffff) AM_ROM
214214ADDRESS_MAP_END
r1877r1878
563563   return 0;
564564}
565565
566READ8_HANDLER( pet_mc6845_register_r ) {
567   return mc6845_register_r( mc6845 );
568}
569
570WRITE8_HANDLER( pet_mc6845_register_w ) {
571   mc6845_register_w( mc6845, data );
572}
573
574WRITE8_HANDLER( pet_mc6845_address_w ) {
575   mc6845_address_w( mc6845, data );
576}
577
578566/* basic 1 */
579567ROM_START (pet)
580568   ROM_REGION (0x10000, REGION_CPU1, 0)
r1877r1878
832820   /* basic machine hardware */
833821   MDRV_CPU_ADD_TAG("main", M6502, 7833600)        /* 7.8336 Mhz */
834822   MDRV_CPU_PROGRAM_MAP(pet_mem, 0)
835   MDRV_CPU_VBLANK_INT(pet_frame_interrupt, 1)
823   MDRV_CPU_VBLANK_INT("main", pet_frame_interrupt)
836824   MDRV_INTERLEAVE(0)
837825
838826   MDRV_MACHINE_RESET( pet )
r1877r1878
908896   /* m6809 cpu */
909897   MDRV_CPU_ADD_TAG("main", M6809, 1000000)
910898   MDRV_CPU_PROGRAM_MAP(superpet_m6809_mem, 0)
911   MDRV_CPU_VBLANK_INT(pet_frame_interrupt, 1)
899   MDRV_CPU_VBLANK_INT("main", pet_frame_interrupt)
912900
913901   MDRV_SCREEN_MODIFY("main")
914902   MDRV_SCREEN_REFRESH_RATE(50)
src/mess/drivers/a2600.c
r1877r1878
712712static OPBASE_HANDLER( modeF6_opbase )
713713{
714714   if ( ( address & 0x1FFF ) >= 0x1FF6 && ( address & 0x1FFF ) <= 0x1FF9 ) {
715      modeF6_switch_w( ( address & 0x1FFF ) - 0x1FF6, 0 );
715      modeF6_switch_w( machine, ( address & 0x1FFF ) - 0x1FF6, 0 );
716716   }
717717   return address;
718718}
r1877r1878
840840   /* Because the mame core caches opcode data and doesn't perform reads like normal */
841841   /* we have to put in this little hack here to get Suicide Mission to work. */
842842   if ( offset != 0xFF8 && ( activecpu_get_pc() & 0x1FFF ) == 0x1FF8 ) {
843      modeSS_r( 0xFF8 );
843      modeSS_r( machine, 0xFF8 );
844844   }
845845   return data;
846846}
r1877r1878
10111011
10121012 */
10131013
1014static opbase_handler FE_old_opbase_handler;
1014static opbase_handler_func FE_old_opbase_handler;
10151015static int FETimer;
10161016
10171017static OPBASE_HANDLER(modeFE_opbase_handler)
r1877r1878
11591159
11601160   for (i = 0; i < count; i++)
11611161   {
1162      static const read8_handler handler[] =
1162      static const read8_machine_func handler[] =
11631163      {
11641164         MRA8_BANK1,
11651165         MRA8_BANK2,
src/mess/drivers/pcw.c
r1877r1878
274274      /* restore bank handler across entire block */
275275      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM,
276276         block * 0x04000 + 0x0000, block * 0x04000 + 0x3fff, 0, 0,
277         (read8_handler) (STATIC_BANK1 + (FPTR)block));
277         (read8_machine_func) (STATIC_BANK1 + (FPTR)block));
278278   }
279279}
280280
r1877r1878
646646
647647}
648648
649static READ8_HANDLER(pcw_fdc_r)
649static READ8_HANDLER(pcw_fdc_r)
650650{
651651   /* from Jacob Nevins docs. FDC I/O is not fully decoded */
652652   if (offset & 1)
653653   {
654      return nec765_data_r(0);
654      return nec765_data_r(machine, 0);
655655   }
656656
657   return nec765_status_r(0);
657   return nec765_status_r(machine, 0);
658658}
659659
660660static WRITE8_HANDLER(pcw_fdc_w)
r1877r1878
662662   /* from Jacob Nevins docs. FDC I/O is not fully decoded */
663663   if (offset & 1)
664664   {
665      nec765_data_w(0,data);
665      nec765_data_w(machine, 0,data);
666666   }
667667}
668668
src/mess/drivers/mk2.c
r1877r1878
154154static int mk2_read_a(int chip)
155155{
156156   int data=0xff;
157   int help=input_port_1_r(0)|input_port_2_r(0); // looks like white and black keys are the same!
157   int help=readinputport(1)|readinputport(2); // looks like white and black keys are the same!
158158
159   switch (rriot_0_b_r(0)&0x7) {
159   switch (rriot_0_b_r(Machine, 0)&0x7) {
160160   case 4:
161161      if (help&0x20) data&=~0x1; //F
162162      if (help&0x10) data&=~0x2; //E
r1877r1878
165165      if (help&2) data&=~0x10; // B
166166      if (help&1) data&=~0x20; // A
167167#if 0
168      if (input_port_3_r(0)&1) data&=~0x40; //?
168      if (readinputport(3)&1) data&=~0x40; //?
169169#endif
170170      break;
171171   case 5:
172172#if 0
173      if (input_port_3_r(0)&2) data&=~0x1; //?
174      if (input_port_3_r(0)&4) data&=~0x2; //?
175      if (input_port_3_r(0)&8) data&=~0x4; //?
173      if (readinputport(3)&2) data&=~0x1; //?
174      if (readinputport(3)&4) data&=~0x2; //?
175      if (readinputport(3)&8) data&=~0x4; //?
176176#endif
177      if (input_port_0_r(0)&4) data&=~0x8; // Enter
178      if (input_port_0_r(0)&2) data&=~0x10; // Clear
177      if (readinputport(0)&4) data&=~0x8; // Enter
178      if (readinputport(0)&2) data&=~0x10; // Clear
179179      if (help&0x80) data&=~0x20; // H
180180      if (help&0x40) data&=~0x40; // G
181181      break;
r1877r1878
185185
186186static void mk2_write_a(int chip, int value)
187187{
188   int temp=rriot_0_b_r(0);
188   int temp=rriot_0_b_r(Machine, 0);
189189
190190
191191   switch(temp&0x3) {
src/mess/drivers/c16.c
r1877r1878
688688   /* basic machine hardware */
689689   MDRV_CPU_ADD_TAG("main", M7501, 1400000)        /* 7.8336 Mhz */
690690   MDRV_CPU_PROGRAM_MAP(c16_readmem, c16_writemem)
691   MDRV_CPU_VBLANK_INT(c16_frame_interrupt, 1)
691   MDRV_CPU_VBLANK_INT("main", c16_frame_interrupt)
692692   MDRV_CPU_PERIODIC_INT(ted7360_raster_interrupt, TED7360_HRETRACERATE)
693693   MDRV_INTERLEAVE(1)
694694
r1877r1878
783783   MDRV_CPU_PROGRAM_MAP(c364_readmem, c364_writemem)
784784MACHINE_DRIVER_END
785785
786static DRIVER_INIT( c16 )      { c16_driver_init(); }
786static DRIVER_INIT( c16 )      { c16_driver_init(machine); }
787787#ifdef UNUSED_FUNCTION
788DRIVER_INIT( c16hun )   { c16_driver_init(); }
789DRIVER_INIT( c16c )      { c16_driver_init(); }
790DRIVER_INIT( c16v )      { c16_driver_init(); }
788DRIVER_INIT( c16hun )   { c16_driver_init(machine); }
789DRIVER_INIT( c16c )      { c16_driver_init(machine); }
790DRIVER_INIT( c16v )      { c16_driver_init(machine); }
791791#endif
792static DRIVER_INIT( plus4 )   { c16_driver_init(); }
792static DRIVER_INIT( plus4 )   { c16_driver_init(machine); }
793793#ifdef UNUSED_FUNCTION
794DRIVER_INIT( plus4c )   { c16_driver_init(); }
795DRIVER_INIT( plus4v )   { c16_driver_init(); }
796DRIVER_INIT( c364 )      { c16_driver_init(); }
794DRIVER_INIT( plus4c )   { c16_driver_init(machine); }
795DRIVER_INIT( plus4v )   { c16_driver_init(machine); }
796DRIVER_INIT( c364 )      { c16_driver_init(machine); }
797797#endif
798798
799799static void c16cart_device_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
src/mess/drivers/osi.c
r1877r1878
9494static WRITE8_HANDLER ( sb2m600b_keyboard_w )
9595{
9696   key_row_latch = data;
97   discrete_sound_w(NODE_01, (data >> 2) & 0x0f);
97   discrete_sound_w(machine, NODE_01, (data >> 2) & 0x0f);
9898}
9999
100100static WRITE8_HANDLER ( uk101_keyboard_w )
src/mess/drivers/enterp.c
r1877r1878
120120
121121static void enterprise_dave_reg_read(int RegIndex)
122122{
123   running_machine *machine = Machine;
124
123125   switch (RegIndex)
124126   {
125127   case 0x015:
126128      {
127129        /* read keyboard line */
128         Dave_setreg(0x015,
130         Dave_setreg(machine, 0x015,
129131            readinputport(Enterprise_KeyboardLine));
130132      }
131133      break;
132134
133135      case 0x016:
134136      {
135            int ExternalJoystickInputs;
136            int ExternalJoystickPortInput = readinputport(10);
137         int ExternalJoystickInputs;
138         int ExternalJoystickPortInput = readinputport(10);
137139
138            if (Enterprise_KeyboardLine<=4)
139            {
140                  ExternalJoystickInputs = ExternalJoystickPortInput>>(4-Enterprise_KeyboardLine);
141            }
142            else
143            {
144                  ExternalJoystickInputs = 1;
145            }
140         if (Enterprise_KeyboardLine<=4)
141         {
142               ExternalJoystickInputs = ExternalJoystickPortInput>>(4-Enterprise_KeyboardLine);
143         }
144         else
145         {
146               ExternalJoystickInputs = 1;
147         }
146148
147            Dave_setreg(0x016, (0x0fe | (ExternalJoystickInputs & 0x01)));
149         Dave_setreg(machine, 0x016, (0x0fe | (ExternalJoystickInputs & 0x01)));
148150      }
149151      break;
150152
r1877r1878
222224
223225   Dave_SetIFace(&enterprise_dave_interface);
224226
225   Dave_reg_w(0x010,0);
226   Dave_reg_w(0x011,0);
227   Dave_reg_w(0x012,0);
228   Dave_reg_w(0x013,0);
227   Dave_reg_w(machine, 0x010,0);
228   Dave_reg_w(machine, 0x011,0);
229   Dave_reg_w(machine, 0x012,0);
230   Dave_reg_w(machine, 0x013,0);
229231
230232   cpunum_set_input_line_vector(0,0,0x0ff);
231233
r1877r1878
243245   switch (offset & 0x03)
244246   {
245247   case 0:
246      return wd17xx_status_r(offset);
248      return wd17xx_status_r(machine, offset);
247249   case 1:
248      return wd17xx_track_r(offset);
250      return wd17xx_track_r(machine, offset);
249251   case 2:
250      return wd17xx_sector_r(offset);
252      return wd17xx_sector_r(machine, offset);
251253   case 3:
252      return wd17xx_data_r(offset);
254      return wd17xx_data_r(machine, offset);
253255   default:
254256      break;
255257   }
r1877r1878
262264   switch (offset & 0x03)
263265   {
264266   case 0:
265      wd17xx_command_w(offset, data);
267      wd17xx_command_w(machine, offset, data);
266268      return;
267269   case 1:
268      wd17xx_track_w(offset, data);
270      wd17xx_track_w(machine, offset, data);
269271      return;
270272   case 2:
271      wd17xx_sector_w(offset, data);
273      wd17xx_sector_w(machine, offset, data);
272274      return;
273275   case 3:
274      wd17xx_data_w(offset, data);
276      wd17xx_data_w(machine, offset, data);
275277      return;
276278   default:
277279      break;
src/mess/drivers/at.c
r1877r1878
104104
105105static READ8_HANDLER(at_dma8237_1_r)
106106{
107   return dma8237_1_r(offset / 2);
107   return dma8237_1_r(machine, offset / 2);
108108}
109109
110110static WRITE8_HANDLER(at_dma8237_1_w)
111111{
112   dma8237_1_w(offset / 2, data);
112   dma8237_1_w(machine, offset / 2, data);
113113}
114114
115115static READ32_HANDLER(at32_dma8237_1_r)
116116{
117   return read32le_with_read8_handler(at_dma8237_1_r, offset, mem_mask);
117   return read32le_with_read8_handler(at_dma8237_1_r, machine, offset, mem_mask);
118118}
119119
120120static WRITE32_HANDLER(at32_dma8237_1_w)
121121{
122   write32le_with_write8_handler(at_dma8237_1_w, offset, data, mem_mask);
122   write32le_with_write8_handler(at_dma8237_1_w, machine, offset, data, mem_mask);
123123}
124124
125125
r1877r1878
405405
406406
407407
408#define MDRV_CPU_ATPC(mem, port, type, clock, vblankfunc)   \
408#define MDRV_CPU_ATPC(mem, port, type, clock)   \
409409   MDRV_CPU_ADD_TAG("main", type, clock)               \
410410   MDRV_CPU_PROGRAM_MAP(mem##_map, 0)            \
411411   MDRV_CPU_IO_MAP(port##_io, 0)               \
412   MDRV_CPU_VBLANK_INT(vblankfunc, 4)                  \
413412   MDRV_CPU_CONFIG(i286_address_mask)
414413
415414static MACHINE_DRIVER_START( atcga )
416415   /* basic machine hardware */
417   MDRV_CPU_ATPC(at, at, I80286, 12000000, NULL)
416   MDRV_CPU_ATPC(at, at, I80286, 12000000)
418417
419418   MDRV_MACHINE_START( at )
420419   MDRV_MACHINE_RESET( at )
r1877r1878
448447
449448static MACHINE_DRIVER_START( ps2m30286 )
450449   /* basic machine hardware */
451   MDRV_CPU_ATPC(at, at, I80286, 12000000, NULL)
450   MDRV_CPU_ATPC(at, at, I80286, 12000000)
452451
453452   MDRV_SCREEN_REFRESH_RATE(60)
454453   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
r1877r1878
478477
479478static MACHINE_DRIVER_START( atvga )
480479   /* basic machine hardware */
481   MDRV_CPU_ATPC(at, at, I80286, 12000000, NULL)
480   MDRV_CPU_ATPC(at, at, I80286, 12000000)
482481
483482   MDRV_IMPORT_FROM( pcvideo_vga )
484483
r1877r1878
515514static MACHINE_DRIVER_START( at386 )
516515    /* basic machine hardware */
517516   /* original at 6 mhz, at03 8 megahertz */
518   MDRV_CPU_ATPC(at386, at386, I386, 12000000, NULL)
517   MDRV_CPU_ATPC(at386, at386, I386, 12000000)
519518
520519   MDRV_MACHINE_START( at )
521520   MDRV_MACHINE_RESET( at )
src/mess/drivers/coleco.c
r1877r1878
6363
6464READ8_HANDLER(coleco_video_r)
6565{
66    return ((offset & 0x01) ? TMS9928A_register_r(1) : TMS9928A_vram_r(0));
66    return ((offset & 0x01) ? TMS9928A_register_r(machine, 1) : TMS9928A_vram_r(machine, 0));
6767}
6868
6969WRITE8_HANDLER(coleco_video_w)
7070{
71    (offset & 0x01) ? TMS9928A_register_w(1, data) : TMS9928A_vram_w(0, data);
71    (offset & 0x01) ? TMS9928A_register_w(machine, 1, data) : TMS9928A_vram_w(machine, 0, data);
7272}
7373
7474static ADDRESS_MAP_START( coleco_map, ADDRESS_SPACE_PROGRAM, 8 )
r1877r1878
237237   MDRV_CPU_ADD(Z80, 7159090/2)   // 3.579545 MHz
238238   MDRV_CPU_PROGRAM_MAP(coleco_map, 0)
239239   MDRV_CPU_IO_MAP(coleco_io_map, 0)
240   MDRV_CPU_VBLANK_INT(coleco_interrupt, 1)
240   MDRV_CPU_VBLANK_INT("main", coleco_interrupt)
241241
242242   MDRV_MACHINE_START(coleco)
243243   MDRV_MACHINE_RESET(coleco)
src/mess/drivers/ex800.c
r1877r1878
165165
166166
167167/* The ON LINE switch is directly connected to the INT1 input of the CPU */
168static void online_switch(void *param, UINT32 oldvalue, UINT32 newvalue)
168static INPUT_CHANGED( online_switch )
169169{
170170   static int state = ASSERT_LINE;
171171
172   if (newvalue)
172   if (newval)
173173   {
174174      cpunum_set_input_line(Machine, 0, UPD7810_INTF1, state);
175175      state = (state == ASSERT_LINE) ? CLEAR_LINE : ASSERT_LINE;
r1877r1878
177177}
178178
179179
180static void feed_switch(void *param, UINT32 oldvalue, UINT32 newvalue)
181{
182
183}
184
185
186static void selectype_switch(void *param, UINT32 oldvalue, UINT32 newvalue)
187{
188
189}
190
191
192static DRIVER_INIT(ex800)
193{
194   input_port_set_changed_callback(port_tag_to_index("ONLISW"), 0xff, online_switch, NULL);
195   input_port_set_changed_callback(port_tag_to_index("FEED"), 0xff, feed_switch, NULL);
196   input_port_set_changed_callback(port_tag_to_index("SelecType"), 0xff, selectype_switch, NULL);
197}
198
199
200180static MACHINE_START(ex800)
201181{
202182   /* Setup beep */
r1877r1878
361341static INPUT_PORTS_START( ex800 )
362342   PORT_START_TAG("ONLISW")
363343   PORT_BIT(0xfe, IP_ACTIVE_HIGH, IPT_UNUSED)
364   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ON LINE")   PORT_CODE(KEYCODE_F9)
344   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ON LINE")   PORT_CODE(KEYCODE_F9) PORT_CHANGED(online_switch, NULL)
365345
366346   PORT_START_TAG("FEED")
367347   PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNUSED)
r1877r1878
496476
497477
498478/*    YEAR  NAME   PARENT  COMPAT  MACHINE INPUT  INIT   CONFIG COMPANY  FULLNAME  FLAGS */
499COMP( 1986, ex800,      0,      0, ex800,  ex800, ex800, NULL,  "Epson", "EX-800", GAME_NO_SOUND | GAME_NOT_WORKING)
479COMP( 1986, ex800,      0,      0, ex800,  ex800, 0,    NULL,  "Epson", "EX-800", GAME_NO_SOUND | GAME_NOT_WORKING)
src/mess/drivers/apf.c
r1877r1878
366366
367367static WRITE8_HANDLER(apf_wd179x_command_w)
368368{
369   wd17xx_command_w(offset,~data);
369   wd17xx_command_w(machine, offset,~data);
370370}
371371
372372static WRITE8_HANDLER(apf_wd179x_track_w)
373373{
374   wd17xx_track_w(offset,~data);
374   wd17xx_track_w(machine, offset,~data);
375375}
376376
377377static WRITE8_HANDLER(apf_wd179x_sector_w)
378378{
379   wd17xx_sector_w(offset,~data);
379   wd17xx_sector_w(machine, offset,~data);
380380}
381381
382382static WRITE8_HANDLER(apf_wd179x_data_w)
383383{
384   wd17xx_data_w(offset,~data);
384   wd17xx_data_w(machine, offset,~data);
385385}
386386
387387static READ8_HANDLER(apf_wd179x_status_r)
388388{
389   return ~wd17xx_status_r(offset);
389   return ~wd17xx_status_r(machine, offset);
390390}
391391
392392static READ8_HANDLER(apf_wd179x_track_r)
393393{
394   return ~wd17xx_track_r(offset);
394   return ~wd17xx_track_r(machine, offset);
395395}
396396
397397static READ8_HANDLER(apf_wd179x_sector_r)
398398{
399   return ~wd17xx_sector_r(offset);
399   return ~wd17xx_sector_r(machine, offset);
400400}
401401
402402static READ8_HANDLER(apf_wd179x_data_r)
403403{
404   return wd17xx_data_r(offset);
404   return wd17xx_data_r(machine, offset);
405405}
406406
407407static ADDRESS_MAP_START(apf_imagination_map, ADDRESS_SPACE_PROGRAM, 8)
src/mess/drivers/snes.c
r1877r1878
4141
4242static READ8_HANDLER( spc_ram_100_r )
4343{
44   return spc_ram_r(offset + 0x100);
44   return spc_ram_r(machine, offset + 0x100);
4545}
4646
4747static WRITE8_HANDLER( spc_ram_100_w )
4848{
49   spc_ram_w(offset + 0x100, data);
49   spc_ram_w(machine, offset + 0x100, data);
5050}
5151
5252static ADDRESS_MAP_START( spc_map, ADDRESS_SPACE_PROGRAM, 8)
r1877r1878
237237static int device_load_snes_cart(mess_image *image)
238238{
239239   int i;
240   running_machine *machine = Machine;
240241   UINT16 totalblocks, readblocks;
241242   UINT32 offset;
242243   UINT8 header[512], sample[0xffff];
r1877r1878
384385   }
385386
386387   /* Find the amount of sram */
387   snes_cart.sram = snes_r_bank1(0x00ffd8);
388   snes_cart.sram = snes_r_bank1(machine, 0x00ffd8);
388389   if( snes_cart.sram > 0 )
389390   {
390391      snes_cart.sram = ((1 << (snes_cart.sram + 3)) / 8);
r1877r1878
400401      logerror( "\tTotal blocks:  %d (%dmb)\n", totalblocks, totalblocks / (snes_cart.mode == SNES_MODE_20 ? 32 : 16) );
401402      logerror( "\tROM bank size: %s (LoROM: %d , HiROM: %d)\n", (snes_cart.mode == SNES_MODE_20) ? "LoROM" : "HiROM", valid_mode20, valid_mode21 );
402403      for( i = 0; i < 2; i++ )
403         companyid[i] = snes_r_bank1(0x00ffb0 + i);
404         companyid[i] = snes_r_bank1(machine, 0x00ffb0 + i);
404405      logerror( "\tCompany ID:    %s\n", companyid );
405406      for( i = 0; i < 4; i++ )
406         romid[i] = snes_r_bank1(0x00ffb2 + i);
407         romid[i] = snes_r_bank1(machine, 0x00ffb2 + i);
407408      logerror( "\tROM ID:        %s\n", romid );
408409      logerror( "HEADER DETAILS\n" );
409410      for( i = 0; i < 21; i++ )
410         title[i] = snes_r_bank1(0x00ffc0 + i);
411         title[i] = snes_r_bank1(machine, 0x00ffc0 + i);
411412      logerror( "\tName:          %s\n", title );
412      logerror( "\tSpeed:         %s [%d]\n", ((snes_r_bank1(0x00ffd5) & 0xf0)) ? "FastROM" : "SlowROM", (snes_r_bank1(0x00ffd5) & 0xf0) >> 4 );
413      logerror( "\tBank size:     %s [%d]\n", (snes_r_bank1(0x00ffd5) & 0xf) ? "HiROM" : "LoROM", snes_r_bank1(0x00ffd5) & 0xf );
413      logerror( "\tSpeed:         %s [%d]\n", ((snes_r_bank1(machine, 0x00ffd5) & 0xf0)) ? "FastROM" : "SlowROM", (snes_r_bank1(machine, 0x00ffd5) & 0xf0) >> 4 );
414      logerror( "\tBank size:     %s [%d]\n", (snes_r_bank1(machine, 0x00ffd5) & 0xf) ? "HiROM" : "LoROM", snes_r_bank1(machine, 0x00ffd5) & 0xf );
414415      for( i = 0; i < 12; i++ )
415416      {
416         if( CartTypes[i].Code == snes_r_bank1(0x00ffd6) )
417         if( CartTypes[i].Code == snes_r_bank1(machine, 0x00ffd6) )
417418            break;
418419      }
419      logerror( "\tType:          %s [%d]\n", CartTypes[i].Name, snes_r_bank1(0x00ffd6) );
420      logerror( "\tSize:          %d megabits [%d]\n", 1 << (snes_r_bank1(0x00ffd7) - 7), snes_r_bank1(0x00ffd7) );
420      logerror( "\tType:          %s [%d]\n", CartTypes[i].Name, snes_r_bank1(machine, 0x00ffd6) );
421      logerror( "\tSize:          %d megabits [%d]\n", 1 << (snes_r_bank1(machine, 0x00ffd7) - 7), snes_r_bank1(machine, 0x00ffd7) );
421422      logerror( "\tSRAM:          %d kilobits [%d]\n", snes_cart.sram * 8, snes_ram[0xffd8] );
422      country = snes_r_bank1(0x00ffd9);
423      country = snes_r_bank1(machine, 0x00ffd9);
423424      if( country > 14 )
424425         country = 14;
425      logerror( "\tCountry:       %s [%d]\n", countries[country], snes_r_bank1(0x00ffd9) );
426      logerror( "\tLicense:       %s [%X]\n", "", snes_r_bank1(0x00ffda) );
427      logerror( "\tVersion:       1.%d\n", snes_r_bank1(0x00ffdb) );
428      logerror( "\tInv Checksum:  %X %X\n", snes_r_bank1(0x00ffdd), snes_r_bank1(0x00ffdc) );
429      logerror( "\tChecksum:      %X %X\n", snes_r_bank1(0x00ffdf), snes_r_bank1(0x00ffde) );
430      logerror( "\tNMI Address:   %2X%2Xh\n", snes_r_bank1(0x00fffb), snes_r_bank1(0x00fffa) );
431      logerror( "\tStart Address: %2X%2Xh\n", snes_r_bank1(0x00fffd), snes_r_bank1(0x00fffc) );
426      logerror( "\tCountry:       %s [%d]\n", countries[country], snes_r_bank1(machine, 0x00ffd9) );
427      logerror( "\tLicense:       %s [%X]\n", "", snes_r_bank1(machine, 0x00ffda) );
428      logerror( "\tVersion:       1.%d\n", snes_r_bank1(machine, 0x00ffdb) );
429      logerror( "\tInv Checksum:  %X %X\n", snes_r_bank1(machine, 0x00ffdd), snes_r_bank1(machine, 0x00ffdc) );
430      logerror( "\tChecksum:      %X %X\n", snes_r_bank1(machine, 0x00ffdf), snes_r_bank1(machine, 0x00ffde) );
431      logerror( "\tNMI Address:   %2X%2Xh\n", snes_r_bank1(machine, 0x00fffb), snes_r_bank1(machine, 0x00fffa) );
432      logerror( "\tStart Address: %2X%2Xh\n", snes_r_bank1(machine, 0x00fffd), snes_r_bank1(machine, 0x00fffc) );
432433   }
433434
434435   /* Load SRAM */
r1877r1878
446447
447448   MDRV_CPU_ADD_TAG("sound", SPC700, 1024000)   /* 1.024 Mhz */
448449   MDRV_CPU_PROGRAM_MAP(spc_map, 0)
449   MDRV_CPU_VBLANK_INT(NULL, 0)
450   MDRV_CPU_VBLANK_INT_HACK(NULL, 0)
450451
451452   MDRV_INTERLEAVE(800)
452453
src/mess/drivers/vc20.c
r1877r1878
704704   /* basic machine hardware */
705705   MDRV_CPU_ADD_TAG("main", M6502, VIC6560_CLOCK)        /* 7.8336 Mhz */
706706   MDRV_CPU_PROGRAM_MAP(vc20_mem, 0)
707   MDRV_CPU_VBLANK_INT(vc20_frame_interrupt, 1)
707   MDRV_CPU_VBLANK_INT("main", vc20_frame_interrupt)
708708   MDRV_CPU_PERIODIC_INT(vic656x_raster_interrupt, VIC656X_HRETRACERATE)
709709   MDRV_INTERLEAVE(0)
710710
src/mess/drivers/electron.c
r1877r1878
2525#include "includes/electron.h"
2626#include "devices/cassette.h"
2727#include "formats/uef_cas.h"
28#include "deprecat.h"
2829
2930static const unsigned short electron_colour_table[8]=
3031{
r1877r1878
187188static MACHINE_DRIVER_START( electron )
188189   MDRV_CPU_ADD_TAG( "main", M6502, 2000000 )
189190   MDRV_CPU_PROGRAM_MAP( electron_mem, 0 )
190   MDRV_CPU_VBLANK_INT( electron_scanline_interrupt, 312 ) /* scanline interrupt */
191   MDRV_CPU_VBLANK_INT_HACK(electron_scanline_interrupt, 312) /* scanline interrupt */
191192   MDRV_SCREEN_ADD("main", RASTER)
192193   MDRV_SCREEN_REFRESH_RATE( 50.08 )
193194
src/mess/drivers/saturn.c
r1877r1878
18481848static READ32_HANDLER( stv_scsp_regs_r32 )
18491849{
18501850   offset <<= 1;
1851   return (SCSP_0_r(offset+1, 0xffff) | (SCSP_0_r(offset, 0xffff)<<16));
1851   return (SCSP_0_r(machine, offset+1, 0xffff) | (SCSP_0_r(machine, offset, 0xffff)<<16));
18521852}
18531853
18541854static WRITE32_HANDLER( stv_scsp_regs_w32 )
18551855{
18561856   offset <<= 1;
1857   SCSP_0_w(offset, data>>16, mem_mask >> 16);
1858   SCSP_0_w(offset+1, data, mem_mask);
1857   SCSP_0_w(machine, offset + 0, data >> 16, mem_mask >> 16);
1858   SCSP_0_w(machine, offset + 1, data >>  0, mem_mask);
18591859}
18601860
18611861/* communication,SLAVE CPU acquires data from the MASTER CPU and triggers an irq.  *
r1877r1878
22822282   /* basic machine hardware */
22832283   MDRV_CPU_ADD(SH2, MASTER_CLOCK_352/2) // 28.6364 MHz
22842284   MDRV_CPU_PROGRAM_MAP(saturn_mem, 0)
2285   MDRV_CPU_VBLANK_INT(stv_interrupt,264)/*264 lines,224 display lines*/
2285   MDRV_CPU_VBLANK_INT_HACK(stv_interrupt, 264)/*264 lines,224 display lines*/
22862286   MDRV_CPU_CONFIG(sh2_conf_master)
22872287
22882288   MDRV_CPU_ADD(SH2, MASTER_CLOCK_352/2) // 28.6364 MHz
src/mess/drivers/ql.c
r1877r1878
909909   // basic machine hardware
910910   MDRV_CPU_ADD(M68008, X1/2)
911911   MDRV_CPU_PROGRAM_MAP(ql_map, 0)
912   MDRV_CPU_VBLANK_INT(zx8302_int, 1)
912   MDRV_CPU_VBLANK_INT("main", zx8302_int)
913913
914914   MDRV_CPU_ADD(I8749, X4)
915915   MDRV_CPU_PROGRAM_MAP(ipc_map, 0)
src/mess/drivers/amiga.c
r1877r1878
3636/***************************************************************************
3737  Battery Backed-Up Clock (MSM6264)
3838***************************************************************************/
39static READ16_HANDLER( amiga_clock_r ) { return msm6242_r( offset / 2 ); }
40static WRITE16_HANDLER( amiga_clock_w ) { msm6242_w( offset / 2, data ); }
39static READ16_HANDLER( amiga_clock_r ) { return msm6242_r( machine, offset / 2 ); }
40static WRITE16_HANDLER( amiga_clock_w ) { msm6242_w( machine, offset / 2, data ); }
4141
4242/***************************************************************************
4343  Address maps
r1877r1878
192192   /* basic machine hardware */
193193   MDRV_CPU_ADD_TAG("main", M68000, AMIGA_68000_NTSC_CLOCK)
194194   MDRV_CPU_PROGRAM_MAP(amiga_mem, 0)
195   MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 262)
196195
197196   MDRV_SCREEN_ADD("main", RASTER)
198197   MDRV_SCREEN_REFRESH_RATE(59.997)
r1877r1878
245244
246245   /* adjust for PAL specs */
247246   MDRV_CPU_REPLACE("main", M68000, AMIGA_68000_PAL_CLOCK)
248   MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 312)
249247
250248   MDRV_SCREEN_MODIFY("main")
251249   MDRV_SCREEN_REFRESH_RATE(50)
src/mess/drivers/apple1.c
r1877r1878
9494       other address bits are ignored.  Thus $D010-$D013 is mirrored
9595       at all $Dxxx addresses with bit 4 high. */
9696   AM_RANGE(0xd010, 0xd013) AM_MIRROR(0x0fec) AM_READWRITE(pia_0_r, pia_0_w)
97   /* $Dxxx addresses with bit 4 low are NOPs.
98       (Note this uses AM_SPACE, not AM_RANGE.) */
99   AM_SPACE(0xd000, 0xf010) AM_NOP
97   /* $Dxxx addresses with bit 4 low are NOPs. */
98   AM_RANGE(0xd000, 0xd00f) AM_NOP AM_MIRROR(0xfe0)
10099
101100   /* We always include the remapped RAM for cassette BASIC, both for
102101       simplicity and to allow the running of BASIC programs. */
src/mess/drivers/abc80x.c
r1877r1878
9898
9999// CRTC
100100
101static READ8_HANDLER( crtc_register_r )
102{
103   return mc6845_register_r(abc800_mc6845);
104}
105
106static WRITE8_HANDLER( crtc_register_w )
107{
108   mc6845_register_w(abc800_mc6845, data);
109}
110
111static WRITE8_HANDLER( crtc_address_w )
112{
113   mc6845_address_w(abc800_mc6845, data);
114}
115
116101// HR
117102
118103static WRITE8_HANDLER( hrs_w )
r1877r1878
268253
269254   if (abc77_keylatch == 1)
270255   {
271      watchdog_reset_w(0, 0);
256      watchdog_reset(machine);
272257   }
273258
274259//  abc77_beep = data & 0x10;
r1877r1878
301286   AM_RANGE(0x07, 0x07) AM_READWRITE(abcbus_reset_r, hrc_w)
302287   AM_RANGE(0x20, 0x23) AM_READWRITE(dart_r, dart_w)
303288   AM_RANGE(0x30, 0x32) AM_WRITE(ram_ctrl_w)
304   AM_RANGE(0x31, 0x31) AM_READ(crtc_register_r)
305   AM_RANGE(0x38, 0x38) AM_WRITE(crtc_address_w)
306   AM_RANGE(0x39, 0x39) AM_WRITE(crtc_register_w)
289   AM_RANGE(0x31, 0x31) AM_DEVREAD(MC6845, "crtc", mc6845_register_r)
290   AM_RANGE(0x38, 0x38) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
291   AM_RANGE(0x39, 0x39) AM_DEVWRITE(MC6845, "crtc", mc6845_register_w)
307292   AM_RANGE(0x40, 0x43) AM_READWRITE(sio2_r, sio2_w)
308293   AM_RANGE(0x50, 0x53) AM_READWRITE(z80ctc_0_r, z80ctc_0_w)
309294   AM_RANGE(0x80, 0xff) AM_READWRITE(abcbus_strobe_r, abcbus_strobe_w)
r1877r1878
340325   AM_RANGE(0x06, 0x06) AM_WRITE(hrs_w)
341326   AM_RANGE(0x07, 0x07) AM_READWRITE(abcbus_reset_r, hrc_w)
342327   AM_RANGE(0x20, 0x23) AM_READWRITE(dart_r, dart_w)
343   AM_RANGE(0x31, 0x31) AM_READ(crtc_register_r)
328   AM_RANGE(0x31, 0x31) AM_DEVREAD(MC6845, "crtc", mc6845_register_r)
344329   AM_RANGE(0x32, 0x35) AM_READWRITE(sio2_r, sio2_w)
345   AM_RANGE(0x38, 0x38) AM_WRITE(crtc_address_w)
346   AM_RANGE(0x39, 0x39) AM_WRITE(crtc_register_w)
330   AM_RANGE(0x38, 0x38) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
331   AM_RANGE(0x39, 0x39) AM_DEVWRITE(MC6845, "crtc", mc6845_register_w)
347332   AM_RANGE(0x60, 0x63) AM_READWRITE(z80ctc_0_r, z80ctc_0_w)
348333   AM_RANGE(0x80, 0xff) AM_READWRITE(abcbus_strobe_r, abcbus_strobe_w)
349334ADDRESS_MAP_END
r1877r1878
365350   AM_RANGE(0x06, 0x06) AM_WRITE(hrs_w)
366351   AM_RANGE(0x07, 0x07) AM_READWRITE(abcbus_reset_r, hrc_w)
367352   AM_RANGE(0x20, 0x23) AM_READWRITE(dart_r, dart_w)
368   AM_RANGE(0x31, 0x31) AM_READ(crtc_register_r)
353   AM_RANGE(0x31, 0x31) AM_DEVREAD(MC6845, "crtc", mc6845_register_r)
369354   AM_RANGE(0x34, 0x34) AM_READWRITE(bankswitch_r, bankswitch_w)
370355   AM_RANGE(0x35, 0x35) AM_READWRITE(attribute_r, attribute_w)
371356   AM_RANGE(0x37, 0x37) AM_READWRITE(sync_r, fgctlprom_w)
372   AM_RANGE(0x38, 0x38) AM_WRITE(crtc_address_w)
373   AM_RANGE(0x39, 0x39) AM_WRITE(crtc_register_w)
357   AM_RANGE(0x38, 0x38) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
358   AM_RANGE(0x39, 0x39) AM_DEVWRITE(MC6845, "crtc", mc6845_register_w)
374359   AM_RANGE(0x40, 0x41) AM_READWRITE(sio2_r, sio2_w)
375360   AM_RANGE(0x60, 0x63) AM_READWRITE(z80ctc_0_r, z80ctc_0_w)
376361   AM_RANGE(0x80, 0xff) AM_READWRITE(abcbus_strobe_r, abcbus_strobe_w)
r1877r1878
720705   MDRV_CPU_CONFIG(abc800_daisy_chain)
721706   MDRV_CPU_PROGRAM_MAP(abc802_map, 0)
722707   MDRV_CPU_IO_MAP(abc802_io_map, 0)
723   MDRV_CPU_VBLANK_INT(abc802_vblank_interrupt, 1)
708   MDRV_CPU_VBLANK_INT("main", abc802_vblank_interrupt)
724709
725710   MDRV_CPU_ADD(I8035, 4608000) // 4.608 MHz, keyboard cpu
726711   MDRV_CPU_PROGRAM_MAP(abc77_map, 0)
src/mess/drivers/crvision.c
r1877r1878
352352        PB7     SN76489 data output
353353    */
354354
355   SN76496_0_w(0, data);
355   SN76496_0_w(machine, 0, data);
356356
357357   sn76489_ready = 0;
358358
r1877r1878
410410   // basic machine hardware
411411   MDRV_CPU_ADD(M6502, 2000000)
412412   MDRV_CPU_PROGRAM_MAP(crvision_map, 0)
413   MDRV_CPU_VBLANK_INT(crvision_int, 1)
413   MDRV_CPU_VBLANK_INT("main", crvision_int)
414414
415415   MDRV_MACHINE_START( crvision )
416416   MDRV_MACHINE_RESET( crvision )
src/mess/drivers/tmc1800.c
r1877r1878
108108{
109109   memory_set_bank(1, data & 0x01);
110110
111   cdp1864_tone_latch_w(0, data);
111   cdp1864_tone_latch_w(machine, 0, data);
112112}
113113
114114/* Memory Maps */
src/mess/drivers/bebox.c
r1877r1878
3232#include "formats/pc_dsk.h"
3333
3434
35static READ8_HANDLER(at_dma8237_1_r)  { return dma8237_1_r(offset / 2); }
36static WRITE8_HANDLER(at_dma8237_1_w) { dma8237_1_w(offset / 2, data); }
35static READ8_HANDLER(at_dma8237_1_r)  { return dma8237_1_r(machine, offset / 2); }
36static WRITE8_HANDLER(at_dma8237_1_w) { dma8237_1_w(machine, offset / 2, data); }
3737
3838static READ64_HANDLER( bebox_dma8237_1_r )
3939{
40   return read64be_with_read8_handler(at_dma8237_1_r, offset, mem_mask);
40   return read64be_with_read8_handler(at_dma8237_1_r, machine, offset, mem_mask);
4141}
4242
4343static WRITE64_HANDLER( bebox_dma8237_1_w )
4444{
45   write64be_with_write8_handler(at_dma8237_1_w, offset, data, mem_mask);
45   write64be_with_write8_handler(at_dma8237_1_w, machine, offset, data, mem_mask);
4646}
4747
4848static ADDRESS_MAP_START( bebox_mem, ADDRESS_SPACE_PROGRAM, 64 )
src/mess/drivers/a7800.c
r1877r1878
1313***************************************************************************/
1414
1515#include "driver.h"
16#include "deprecat.h"
1617#include "cpu/m6502/m6502.h"
1718#include "sound/tiaintf.h"
1819#include "devices/cartslot.h"
r1877r1878
264265   MDRV_CPU_ADD_TAG("main", M6502, CLK_NTSC)   /* 1.79Mhz (note: The clock switches to 1.19Mhz
265266                                                 * when the TIA or RIOT are accessed) */
266267   MDRV_CPU_PROGRAM_MAP(a7800_mem, 0)
267   MDRV_CPU_VBLANK_INT(a7800_interrupt,262)
268   MDRV_CPU_VBLANK_INT_HACK(a7800_interrupt, 262)
268269
269270   MDRV_INTERLEAVE(1)
270271
r1877r1878
299300   /* basic machine hardware */
300301   MDRV_CPU_REPLACE("main", M6502, CLK_PAL)   /* 1.79Mhz (note: The clock switches to 1.19Mhz
301302                                                 * when the TIA or RIOT are accessed) */
302   MDRV_CPU_VBLANK_INT(a7800_interrupt,312)
303   MDRV_CPU_VBLANK_INT_HACK(a7800_interrupt, 312)
303304
304305   MDRV_SCREEN_MODIFY( "main" )
305306   MDRV_SCREEN_REFRESH_RATE(50)
src/mess/drivers/gmaster.c
r1877r1878
217217MDRV_CPU_PROGRAM_MAP(gmaster_mem, 0)
218218MDRV_CPU_IO_MAP( gmaster_io, 0 )
219219MDRV_CPU_CONFIG( config )
220MDRV_CPU_VBLANK_INT(gmaster_interrupt,1)
220MDRV_CPU_VBLANK_INT("main", gmaster_interrupt)
221221
222222     MDRV_SCREEN_ADD("main", LCD)
223223     MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
src/mess/drivers/acrnsys1.c
r1877r1878
3434
3535static WRITE8_HANDLER( ins8154_b1_port_a_w )
3636{
37   ttl74145_0_w(0, data & 0x07);
37   ttl74145_0_w(machine, 0, data & 0x07);
3838}
3939
4040static WRITE8_HANDLER( acrnsys1_led_segment_w )
src/mess/drivers/mtx.c
r1877r1878
236236   MDRV_CPU_ADD(Z80, MTX_SYSTEM_CLOCK)
237237   MDRV_CPU_PROGRAM_MAP(mtx_mem, 0)
238238   MDRV_CPU_IO_MAP(mtx_io, 0)
239   MDRV_CPU_VBLANK_INT(mtx_interrupt, 1)
239   MDRV_CPU_VBLANK_INT("main", mtx_interrupt)
240240   MDRV_CPU_CONFIG(mtx_daisy_chain)
241241
242242   /* video hardware */
src/mess/drivers/microtan.c
r1877r1878
4141
4242/* Components */
4343#include "sound/ay8910.h"
44#include "machine/6522via.h"
45#include "machine/6551.h"
4446
4547/* Devices */
4648#include "devices/cassette.h"
r1877r1878
5355   AM_RANGE(0xbc01, 0xbc01) AM_READWRITE(AY8910_read_port_0_r, AY8910_write_port_0_w)
5456   AM_RANGE(0xbc02, 0xbc02) AM_WRITE(AY8910_control_port_1_w)
5557   AM_RANGE(0xbc03, 0xbc03) AM_READWRITE(AY8910_read_port_1_r, AY8910_write_port_1_w)
56   AM_RANGE(0xbfc0, 0xbfcf) AM_READWRITE(microtan_via_0_r, microtan_via_0_w)
57   AM_RANGE(0xbfd0, 0xbfd3) AM_READWRITE(microtan_sio_r, microtan_sio_w)
58   AM_RANGE(0xbfe0, 0xbfef) AM_READWRITE(microtan_via_1_r, microtan_via_1_w)
58   AM_RANGE(0xbfc0, 0xbfcf) AM_READWRITE(via_0_r, via_0_w)
59   AM_RANGE(0xbfd0, 0xbfd3) AM_READWRITE(acia_6551_r, acia_6551_w)
60   AM_RANGE(0xbfe0, 0xbfef) AM_READWRITE(via_1_r, via_1_w)
5961   AM_RANGE(0xbff0, 0xbfff) AM_READWRITE(microtan_bffx_r, microtan_bffx_w)
6062   AM_RANGE(0xc000, 0xe7ff) AM_ROM
6163   AM_RANGE(0xf000, 0xffff) AM_ROM
r1877r1878
211213   // basic machine hardware
212214   MDRV_CPU_ADD_TAG("main", M6502, 750000)   // 750 kHz
213215   MDRV_CPU_PROGRAM_MAP(microtan_map, 0)
214   MDRV_CPU_VBLANK_INT(microtan_interrupt, 1)
216   MDRV_CPU_VBLANK_INT("main", microtan_interrupt)
215217
216218   MDRV_MACHINE_RESET(microtan)
217219
src/mess/drivers/einstein.c
r1877r1878
291291      case 5:
292292      case 6:
293293      case 7:
294         return einstein_80col_ram_r(offset);
294         return einstein_80col_ram_r(machine, offset);
295295      case 0x0c:
296         return einstein_80col_state_r(offset);
296         return einstein_80col_state_r(machine, offset);
297297      default:
298298         break;
299299   }
r1877r1878
313313      case 5:
314314      case 6:
315315      case 7:
316         einstein_80col_ram_w(offset,data);
316         einstein_80col_ram_w(machine, offset,data);
317317         break;
318318      case 8:
319         crtc6845_0_address_w(offset,data);
319         crtc6845_0_address_w(machine, offset,data);
320320         break;
321321      case 9:
322         crtc6845_0_register_w(offset,data);
322         crtc6845_0_register_w(machine, offset,data);
323323         break;
324324      default:
325325         break;
r1877r1878
331331   einstein_ctc_trigger^=1;
332332
333333   /* channel 0 and 1 have a 2Mhz input clock for triggering */
334   z80ctc_0_trg0_w(0,einstein_ctc_trigger);
335   z80ctc_0_trg1_w(0,einstein_ctc_trigger);
334   z80ctc_0_trg0_w(machine, 0, einstein_ctc_trigger);
335   z80ctc_0_trg1_w(machine, 0, einstein_ctc_trigger);
336336}
337337
338338/* refresh keyboard data. It is refreshed when the keyboard line is written */
r1877r1878
541541
542542   if (offset & 0x01)
543543   {
544      return TMS9928A_register_r(offset & 0x01);
544      return TMS9928A_register_r(machine, offset & 0x01);
545545   }
546546
547   return TMS9928A_vram_r(offset & 0x01);
547   return TMS9928A_vram_r(machine, offset & 0x01);
548548}
549549
550550static WRITE8_HANDLER(einstein_vdp_w)
r1877r1878
553553
554554   if (offset & 0x01)
555555   {
556      TMS9928A_register_w(offset & 0x01,data);
556      TMS9928A_register_w(machine, offset & 0x01,data);
557557      return;
558558   }
559559
560   TMS9928A_vram_w(offset & 0x01,data);
560   TMS9928A_vram_w(machine, offset & 0x01,data);
561561}
562562
563563static WRITE8_HANDLER(einstein_fdc_w)
r1877r1878
570570   {
571571      case 0:
572572      {
573         wd17xx_command_w(reg, data);
573         wd17xx_command_w(machine, reg, data);
574574      }
575575      break;
576576
577577      case 1:
578578      {
579         wd17xx_track_w(reg, data);
579         wd17xx_track_w(machine, reg, data);
580580      }
581581      break;
582582
583583      case 2:
584584      {
585         wd17xx_sector_w(reg, data);
585         wd17xx_sector_w(machine, reg, data);
586586      }
587587      break;
588588
589589      case 3:
590590      {
591         wd17xx_data_w(reg, data);
591         wd17xx_data_w(machine, reg, data);
592592      }
593593      break;
594594   }
r1877r1878
605605   {
606606      case 0:
607607      {
608         return wd17xx_status_r(reg);
608         return wd17xx_status_r(machine, reg);
609609      }
610610      break;
611611
612612      case 1:
613613      {
614         return wd17xx_track_r(reg);
614         return wd17xx_track_r(machine, reg);
615615      }
616616      break;
617617
618618      case 2:
619619      {
620         return wd17xx_sector_r(reg);
620         return wd17xx_sector_r(machine, reg);
621621      }
622622      break;
623623
624624      case 3:
625625      {
626         return wd17xx_data_r(reg);
626         return wd17xx_data_r(machine, reg);
627627      }
628628      break;
629629   }
r1877r1878
674674{
675675   logerror("ctc r: %04x\n",offset);
676676
677   return z80ctc_0_r(offset & 0x03);
677   return z80ctc_0_r(machine, offset & 0x03);
678678}
679679
680680static WRITE8_HANDLER(einstein_ctc_w)
681681{
682682   logerror("ctc w: %04x %02x\n",offset,data);
683683
684   z80ctc_0_w(offset & 0x03,data);
684   z80ctc_0_w(machine, offset & 0x03,data);
685685}
686686
687687static WRITE8_HANDLER(einstein_serial_w)
r1877r1878
692692
693693   if ((reg)==0)
694694   {
695      msm8251_data_w(reg,data);
695      msm8251_data_w(machine, reg,data);
696696      return;
697697   }
698698
699   msm8251_control_w(reg,data);
699   msm8251_control_w(machine, reg,data);
700700}
701701
702702
r1877r1878
708708
709709   if ((reg)==0)
710710   {
711      return msm8251_data_r(reg);
711      return msm8251_data_r(machine, reg);
712712   }
713713
714   return msm8251_status_r(reg);
714   return msm8251_status_r(machine, reg);
715715}
716716
717717/*
r1877r1878
750750      /* case 0 and 1 are not handled */
751751      case 2:
752752      {
753         AY8910_control_port_0_w(0, data);
753         AY8910_control_port_0_w(machine, 0, data);
754754      }
755755      break;
756756
757757      case 3:
758758      {
759         AY8910_write_port_0_w(0, data);
759         AY8910_write_port_0_w(machine, 0, data);
760760      }
761761      break;
762762
r1877r1878
773773   {
774774      /* case 0 and 1 are not handled */
775775      case 2:
776         return AY8910_read_port_0_r(0);
776         return AY8910_read_port_0_r(machine, 0);
777777
778778      default:
779779         break;
r1877r1878
964964}
965965
966966
967static READ8_HANDLER(einstein2_port_r)
967static READ8_HANDLER(einstein2_port_r)
968968{
969969   switch (offset & 0x0ff)
970970   {
r1877r1878
976976      case 0x05:
977977      case 0x06:
978978      case 0x07:
979         return einstein_psg_r(offset);
979         return einstein_psg_r(machine, offset);
980980      case 0x08:
981981      case 0x09:
982982      case 0x0a:
r1877r1878
985985      case 0x0d:
986986      case 0x0e:
987987      case 0x0f:
988         return einstein_vdp_r(offset);
988         return einstein_vdp_r(machine, offset);
989989      case 0x10:
990990      case 0x11:
991991      case 0x12:
r1877r1878
994994      case 0x15:
995995      case 0x16:
996996      case 0x17:
997         return einstein_serial_r(offset);
997         return einstein_serial_r(machine, offset);
998998      case 0x18:
999999      case 0x19:
10001000      case 0x1a:
r1877r1878
10031003      case 0x1d:
10041004      case 0x1e:
10051005      case 0x1f:
1006         return einstein_fdc_r(offset);
1006         return einstein_fdc_r(machine, offset);
10071007      case 0x20:
1008         return einstein_key_int_r(offset);
1008         return einstein_key_int_r(machine, offset);
10091009      case 0x28:
10101010      case 0x29:
10111011      case 0x2a:
r1877r1878
10141014      case 0x2d:
10151015      case 0x2e:
10161016      case 0x2f:
1017         return einstein_ctc_r(offset);
1017         return einstein_ctc_r(machine, offset);
10181018      case 0x30:
10191019      case 0x31:
10201020      case 0x32:
r1877r1878
10231023      case 0x35:
10241024      case 0x36:
10251025      case 0x37:
1026         return einstein_pio_r(offset);
1026         return einstein_pio_r(machine, offset);
10271027      case 0x40:
10281028      case 0x41:
10291029      case 0x42:
r1877r1878
10401040      case 0x4d:
10411041      case 0x4e:
10421042      case 0x4f:
1043         return einstein_80col_r(offset);
1043         return einstein_80col_r(machine, offset);
10441044
10451045      default:
10461046         break;
r1877r1878
10631063      case 0x05:
10641064      case 0x06:
10651065      case 0x07:
1066         einstein_psg_w(offset,data);
1066         einstein_psg_w(machine, offset,data);
10671067         return;
10681068      case 0x08:
10691069      case 0x09:
r1877r1878
10731073      case 0x0d:
10741074      case 0x0e:
10751075      case 0x0f:
1076         einstein_vdp_w(offset,data);
1076         einstein_vdp_w(machine, offset,data);
10771077         return;
10781078      case 0x10:
10791079      case 0x11:
r1877r1878
10831083      case 0x15:
10841084      case 0x16:
10851085      case 0x17:
1086         einstein_serial_w(offset,data);
1086         einstein_serial_w(machine, offset,data);
10871087         return;
10881088      case 0x18:
10891089      case 0x19:
r1877r1878
10931093      case 0x1d:
10941094      case 0x1e:
10951095      case 0x1f:
1096         einstein_fdc_w(offset,data);
1096         einstein_fdc_w(machine, offset,data);
10971097         return;
10981098      case 0x20:
1099         einstein_key_int_w(offset,data);
1099         einstein_key_int_w(machine, offset,data);
11001100         return;
11011101      case 0x21:
1102         einstein_adc_int_w(offset,data);
1102         einstein_adc_int_w(machine, offset,data);
11031103         return;
11041104      case 0x23:
1105         einstein_drive_w(offset,data);
1105         einstein_drive_w(machine, offset,data);
11061106         return;
11071107      case 0x24:
1108         einstein_rom_w(offset,data);
1108         einstein_rom_w(machine, offset,data);
11091109         return;
11101110      case 0x25:
1111         einstein_fire_int_w(offset,data);
1111         einstein_fire_int_w(machine, offset,data);
11121112         return;
11131113      case 0x28:
11141114      case 0x29:
r1877r1878
11181118      case 0x2d:
11191119      case 0x2e:
11201120      case 0x2f:
1121         einstein_ctc_w(offset,data);
1121         einstein_ctc_w(machine, offset,data);
11221122         return;
11231123      case 0x30:
11241124      case 0x31:
r1877r1878
11281128      case 0x35:
11291129      case 0x36:
11301130      case 0x37:
1131         einstein_pio_w(offset,data);
1131         einstein_pio_w(machine, offset,data);
11321132         return;
11331133      case 0x40:
11341134      case 0x41:
r1877r1878
11461146      case 0x4d:
11471147      case 0x4e:
11481148      case 0x4f:
1149         einstein_80col_w(offset,data);
1149         einstein_80col_w(machine, offset,data);
11501150         return;
11511151
11521152      default:
r1877r1878
11691169      case 0x05:
11701170      case 0x06:
11711171      case 0x07:
1172         return einstein_psg_r(offset);
1172         return einstein_psg_r(machine, offset);
11731173      case 0x08:
11741174      case 0x09:
11751175      case 0x0a:
r1877r1878
11781178      case 0x0d:
11791179      case 0x0e:
11801180      case 0x0f:
1181         return einstein_vdp_r(offset);
1181         return einstein_vdp_r(machine, offset);
11821182      case 0x10:
11831183      case 0x11:
11841184      case 0x12:
r1877r1878
11871187      case 0x15:
11881188      case 0x16:
11891189      case 0x17:
1190         return einstein_serial_r(offset);
1190         return einstein_serial_r(machine, offset);
11911191      case 0x18:
11921192      case 0x19:
11931193      case 0x1a:
r1877r1878
11961196      case 0x1d:
11971197      case 0x1e:
11981198      case 0x1f:
1199         return einstein_fdc_r(offset);
1199         return einstein_fdc_r(machine, offset);
12001200      case 0x20:
1201         return einstein_key_int_r(offset);
1201         return einstein_key_int_r(machine, offset);
12021202      case 0x28:
12031203      case 0x29:
12041204      case 0x2a:
r1877r1878
12071207      case 0x2d:
12081208      case 0x2e:
12091209      case 0x2f:
1210         return einstein_ctc_r(offset);
1210         return einstein_ctc_r(machine, offset);
12111211      case 0x30:
12121212      case 0x31:
12131213      case 0x32:
r1877r1878
12161216      case 0x35:
12171217      case 0x36:
12181218      case 0x37:
1219         return einstein_pio_r(offset);
1219         return einstein_pio_r(machine, offset);
12201220
12211221      default:
12221222         break;
r1877r1878
12391239      case 0x05:
12401240      case 0x06:
12411241      case 0x07:
1242         einstein_psg_w(offset,data);
1242         einstein_psg_w(machine, offset,data);
12431243         return;
12441244      case 0x08:
12451245      case 0x09:
r1877r1878
12491249      case 0x0d:
12501250      case 0x0e:
12511251      case 0x0f:
1252         einstein_vdp_w(offset,data);
1252         einstein_vdp_w(machine, offset,data);
12531253         return;
12541254      case 0x10:
12551255      case 0x11:
r1877r1878
12591259      case 0x15:
12601260      case 0x16:
12611261      case 0x17:
1262         einstein_serial_w(offset,data);
1262         einstein_serial_w(machine, offset,data);
12631263         return;
12641264      case 0x18:
12651265      case 0x19:
r1877r1878
12691269      case 0x1d:
12701270      case 0x1e:
12711271      case 0x1f:
1272         einstein_fdc_w(offset,data);
1272         einstein_fdc_w(machine, offset,data);
12731273         return;
12741274      case 0x20:
1275         einstein_key_int_w(offset,data);
1275         einstein_key_int_w(machine, offset,data);
12761276         return;
12771277      case 0x21:
1278         einstein_adc_int_w(offset,data);
1278         einstein_adc_int_w(machine, offset,data);
12791279         return;
12801280      case 0x23:
1281         einstein_drive_w(offset,data);
1281         einstein_drive_w(machine, offset,data);
12821282         return;
12831283      case 0x24:
1284         einstein_rom_w(offset,data);
1284         einstein_rom_w(machine, offset,data);
12851285         return;
12861286      case 0x25:
1287         einstein_fire_int_w(offset,data);
1287         einstein_fire_int_w(machine, offset,data);
12881288         return;
12891289      case 0x28:
12901290      case 0x29:
r1877r1878
12941294      case 0x2d:
12951295      case 0x2e:
12961296      case 0x2f:
1297         einstein_ctc_w(offset,data);
1297         einstein_ctc_w(machine, offset,data);
12981298         return;
12991299      case 0x30:
13001300      case 0x31:
r1877r1878
13041304      case 0x35:
13051305      case 0x36:
13061306      case 0x37:
1307         einstein_pio_w(offset,data);
1307         einstein_pio_w(machine, offset,data);
13081308         return;
13091309
13101310      default:
src/mess/drivers/ti99_2.c
r1877r1878
367367   MDRV_CPU_CONFIG(ti99_2_processor_config)
368368   MDRV_CPU_PROGRAM_MAP(ti99_2_memmap, 0)
369369   MDRV_CPU_IO_MAP(ti99_2_readcru, ti99_2_writecru)
370   MDRV_CPU_VBLANK_INT(ti99_2_vblank_interrupt, 1)
370   MDRV_CPU_VBLANK_INT("main", ti99_2_vblank_interrupt)
371371
372372   MDRV_MACHINE_RESET( ti99_2 )
373373
src/mess/drivers/intv.c
r1877r1878
325325   /* basic machine hardware */
326326   MDRV_CPU_ADD_TAG("main", CP1610, XTAL_3_579545MHz/4)        /* Colorburst/4 */
327327   MDRV_CPU_PROGRAM_MAP(intv_mem, 0)
328   MDRV_CPU_VBLANK_INT(intv_interrupt,1)
328   MDRV_CPU_VBLANK_INT("main", intv_interrupt)
329329   MDRV_INTERLEAVE(1)
330330
331331   MDRV_MACHINE_RESET( intv )
r1877r1878
359359
360360   MDRV_CPU_ADD(M6502, XTAL_3_579545MHz/2)   /* Colorburst/2 */
361361   MDRV_CPU_PROGRAM_MAP(intv2_mem, 0)
362   MDRV_CPU_VBLANK_INT(intv_interrupt2, 1)
362   MDRV_CPU_VBLANK_INT("main", intv_interrupt2)
363363
364364   MDRV_INTERLEAVE(100)
365365
src/mess/drivers/jupiter.c
r1877r1878
169169   MDRV_CPU_ADD_TAG("main", Z80, 3250000)        /* 3.25 Mhz */
170170   MDRV_CPU_PROGRAM_MAP(jupiter_mem, 0)
171171   MDRV_CPU_IO_MAP(jupiter_io, 0)
172   MDRV_CPU_VBLANK_INT(jupiter_interrupt,1)
172   MDRV_CPU_VBLANK_INT("main", jupiter_interrupt)
173173   MDRV_INTERLEAVE(1)
174174
175175   MDRV_MACHINE_START( jupiter )
src/mess/drivers/exelv.c
r1877r1878
546546   MDRV_CPU_ADD(TMS7000_EXL, 4910000)
547547   MDRV_CPU_PROGRAM_MAP(exelv_memmap, 0)
548548   MDRV_CPU_IO_MAP(exelv_portmap, 0)
549   MDRV_CPU_VBLANK_INT(exelv_hblank_interrupt, 363)
549   MDRV_CPU_VBLANK_INT_HACK(exelv_hblank_interrupt, 363)
550550
551551   MDRV_MACHINE_RESET( exelv )
552552
src/mess/drivers/ssystem3.c
r1877r1878
4343
4444static const struct via6522_interface config=
4545{
46   0,//read8_handler in_a_func;
47   0,//read8_handler in_b_func;
48   0,//read8_handler in_ca1_func;
49   0,//read8_handler in_cb1_func;
50   0,//read8_handler in_ca2_func;
51   0,//read8_handler in_cb2_func;
52   0,//write8_handler out_a_func;
53   0,//write8_handler out_b_func;
54   0,//write8_handler out_ca2_func;
55   0,//write8_handler out_cb2_func;
46   0,//read8_machine_func in_a_func;
47   0,//read8_machine_func in_b_func;
48   0,//read8_machine_func in_ca1_func;
49   0,//read8_machine_func in_cb1_func;
50   0,//read8_machine_func in_ca2_func;
51   0,//read8_machine_func in_cb2_func;
52   0,//write8_machine_func out_a_func;
53   0,//write8_machine_func out_b_func;
54   0,//write8_machine_func out_ca2_func;
55   0,//write8_machine_func out_cb2_func;
5656   0,//void (*irq_func)(int state);
5757};
5858
src/mess/drivers/amstrad.c
r1877r1878
239239
240240static void update_psg(void)
241241{
242   running_machine *machine = Machine;
243
242244   if(aleste_mode & 0x20)  // RTC selected
243245   {
244246      switch(aleste_rtc_function)
245247      {
246248      case 0x02:  // AS
247         mc146818_port_w(0,ppi_port_outputs[amstrad_ppi_PortA]);
249         mc146818_port_w(machine, 0,ppi_port_outputs[amstrad_ppi_PortA]);
248250         break;
249251      case 0x04:  // DS write
250         mc146818_port_w(1,ppi_port_outputs[amstrad_ppi_PortA]);
252         mc146818_port_w(machine, 1,ppi_port_outputs[amstrad_ppi_PortA]);
251253         break;
252254      case 0x05:  // DS read
253         ppi_port_inputs[amstrad_ppi_PortA] = mc146818_port_r(1);
255         ppi_port_inputs[amstrad_ppi_PortA] = mc146818_port_r(machine, 1);
254256         break;
255257      }
256258      return;
r1877r1878
262264      } break;
263265     case 1:
264266      {/* b6 = 1 ? : Read from selected PSG register and make the register data available to PPI Port A */
265           ppi_port_inputs[amstrad_ppi_PortA] = AY8910_read_port_0_r(0);
267           ppi_port_inputs[amstrad_ppi_PortA] = AY8910_read_port_0_r(machine, 0);
266268        }
267269      break;
268270     case 2:
269271      {/* b7 = 1 ? : Write to selected PSG register and write data to PPI Port A */
270           AY8910_write_port_0_w(0, ppi_port_outputs[amstrad_ppi_PortA]);
272           AY8910_write_port_0_w(machine, 0, ppi_port_outputs[amstrad_ppi_PortA]);
271273        }
272274      break;
273275     case 3:
274276      {/* b6 and b7 = 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.*/
275           AY8910_control_port_0_w(0, ppi_port_outputs[amstrad_ppi_PortA]);
277           AY8910_control_port_0_w(machine, 0, ppi_port_outputs[amstrad_ppi_PortA]);
276278         prev_reg = ppi_port_outputs[amstrad_ppi_PortA];
277279        }
278280      break;
r1877r1878
13191321            int b8b0 = ((offset & (1<<8)) >> (8 - 1)) | (offset & (0x01));
13201322            switch (b8b0) {
13211323              case 0x02: {
1322                    data = nec765_status_r(0);
1324                    data = nec765_status_r(machine, 0);
13231325              } break;
13241326              case 0x03: {
1325                    data = nec765_data_r(0);
1327                    data = nec765_data_r(machine, 0);
13261328              } break;
13271329              default: {
13281330              } break;
r1877r1878
14511453           break;
14521454
14531455        case 0x03: /* Write Data register of FDC */
1454               nec765_data_w(0,data);
1456               nec765_data_w(machine, 0,data);
14551457            break;
14561458            default:
14571459            break;
r1877r1878
14891491         video_screen_configure(0,800,312,&rect,HZ_TO_ATTOSECONDS(AMSTRAD_FPS));
14901492      }
14911493   }
1492   multiface_io_write(offset,data);
1494   multiface_io_write(machine, offset,data);
14931495}
14941496
14951497// Handler for checking the ASIC unlocking sequence
src/mess/drivers/a310.c
r1877r1878
408408   else if (offset >= 0xc4000 && offset <= 0xc4010)
409409   {
410410      logerror("17XX: R @ addr %x mask %08x\n", offset*4, mem_mask);
411      return wd17xx_data_r(offset&0xf);
411      return wd17xx_data_r(machine, offset&0xf);
412412   }
413413   else
414414   {
r1877r1878
505505   else if (offset >= 0xc4000 && offset <= 0xc4010)
506506   {
507507      logerror("17XX: %x to addr %x mask %08x\n", data, offset*4, mem_mask);
508      wd17xx_data_w(offset&0xf, data&0xff);
508      wd17xx_data_w(machine, offset&0xf, data&0xff);
509509   }
510510   else if (offset == 0xd40006)
511511   {
src/mess/drivers/avigo.c
r1877r1878
9494   }
9595}
9696
97static void avigo_setbank(int bank, void *address, read8_handler rh, write8_handler wh)
97static void avigo_setbank(int bank, void *address, read8_machine_func rh, write8_machine_func wh)
9898{
9999   if (address)
100100   {
src/mess/drivers/psx.c
r1877r1878
775775   /* basic machine hardware */
776776   MDRV_CPU_ADD( PSXCPU, XTAL_67_7376MHz )
777777   MDRV_CPU_PROGRAM_MAP( psx_map, 0 )
778   MDRV_CPU_VBLANK_INT( psx_vblank, 1 )
778   MDRV_CPU_VBLANK_INT("main", psx_vblank)
779779
780780   MDRV_SCREEN_ADD("main", RASTER)
781781   MDRV_SCREEN_REFRESH_RATE( 60 )
r1877r1878
805805   /* basic machine hardware */
806806   MDRV_CPU_ADD( PSXCPU, XTAL_67_7376MHz )
807807   MDRV_CPU_PROGRAM_MAP( psx_map, 0 )
808   MDRV_CPU_VBLANK_INT( psx_vblank, 1 )
808   MDRV_CPU_VBLANK_INT("main", psx_vblank)
809809
810810   MDRV_SCREEN_ADD("main", RASTER)
811811   MDRV_SCREEN_REFRESH_RATE( 50 )
src/mess/drivers/coupe.c
r1877r1878
2626***************************************************************************/
2727
2828#include "driver.h"
29#include "deprecat.h"
2930#include "cpu/z80/z80.h"
3031#include "includes/coupe.h"
3132#include "machine/wd17xx.h"
r1877r1878
159160   case DSK1_PORT+0:   /* This covers the total range of ports for 1 floppy controller */
160161    case DSK1_PORT+4:
161162      wd17xx_set_side((offset >> 2) & 1);
162      return wd17xx_status_r(0);
163      return wd17xx_status_r(machine, 0);
163164   case DSK1_PORT+1:
164165    case DSK1_PORT+5:
165166      wd17xx_set_side((offset >> 2) & 1);
166        return wd17xx_track_r(0);
167        return wd17xx_track_r(machine, 0);
167168   case DSK1_PORT+2:
168169    case DSK1_PORT+6:
169170      wd17xx_set_side((offset >> 2) & 1);
170        return wd17xx_sector_r(0);
171        return wd17xx_sector_r(machine, 0);
171172   case DSK1_PORT+3:
172173   case DSK1_PORT+7:
173174      wd17xx_set_side((offset >> 2) & 1);
174        return wd17xx_data_r(0);
175        return wd17xx_data_r(machine, 0);
175176   case LPEN_PORT:
176177      return LPEN;
177178   case STAT_PORT:
r1877r1878
200201   if (offset==SSND_ADDR)                  // Set sound address
201202   {
202203      SOUND_ADDR=data&0x1F;               // 32 registers max
203      saa1099_control_port_0_w(0, SOUND_ADDR);
204      saa1099_control_port_0_w(machine, 0, SOUND_ADDR);
204205        return;
205206   }
206207
r1877r1878
209210   case DSK1_PORT+0:                     // This covers the total range of ports for 1 floppy controller
210211    case DSK1_PORT+4:
211212      wd17xx_set_side((offset >> 2) & 1);
212        wd17xx_command_w(0, data);
213        wd17xx_command_w(machine, 0, data);
213214      break;
214215    case DSK1_PORT+1:
215216    case DSK1_PORT+5:
216217      /* Track byte requested on address line */
217218      wd17xx_set_side((offset >> 2) & 1);
218        wd17xx_track_w(0, data);
219        wd17xx_track_w(machine, 0, data);
219220      break;
220221    case DSK1_PORT+2:
221222    case DSK1_PORT+6:
222223      /* Sector byte requested on address line */
223224      wd17xx_set_side((offset >> 2) & 1);
224        wd17xx_sector_w(0, data);
225        wd17xx_sector_w(machine, 0, data);
225226        break;
226227    case DSK1_PORT+3:
227228   case DSK1_PORT+7:
228229      /* Data byte requested on address line */
229230      wd17xx_set_side((offset >> 2) & 1);
230        wd17xx_data_w(0, data);
231        wd17xx_data_w(machine, 0, data);
231232      break;
232233   case CLUT_PORT:
233234      CLUT[(offset >> 8)&0x0F]=data&0x7F;      // set CLUT data
r1877r1878
252253      speaker_level_w(0,(data>>4) & 0x01);
253254      break;
254255    case SSND_DATA:
255      saa1099_write_port_0_w(0, data);
256      saa1099_write_port_0_w(machine, 0, data);
256257      SOUND_REG[SOUND_ADDR] = data;
257258      break;
258259    default:
r1877r1878
407408   MDRV_CPU_ADD(Z80, 6000000)        /* 6 Mhz */
408409   MDRV_CPU_PROGRAM_MAP(coupe_mem, 0)
409410   MDRV_CPU_IO_MAP(coupe_io, 0)
410   MDRV_CPU_VBLANK_INT(coupe_line_interrupt, 192 + 10)   /* 192 scanlines + 10 lines of vblank (approx).. */
411   MDRV_CPU_VBLANK_INT_HACK(coupe_line_interrupt, 192 + 10)   /* 192 scanlines + 10 lines of vblank (approx).. */
411412   MDRV_SCREEN_ADD("main", RASTER)
412413   MDRV_SCREEN_REFRESH_RATE(50)
413414   MDRV_SCREEN_VBLANK_TIME(0)
src/mess/drivers/tutor.c
r1877r1878
568568   MDRV_CPU_CONFIG(tutor_processor_config)
569569   MDRV_CPU_PROGRAM_MAP(tutor_memmap, 0)
570570   MDRV_CPU_IO_MAP(tutor_readcru, /*tutor_writecru*/0)
571   MDRV_CPU_VBLANK_INT(tutor_vblank_interrupt, 1)
571   MDRV_CPU_VBLANK_INT("main", tutor_vblank_interrupt)
572572
573573   MDRV_MACHINE_START( tutor )
574574   MDRV_MACHINE_RESET( tutor )
src/mess/drivers/trs80.c
r1877r1878
7878
7979/* Core includes */
8080#include "driver.h"
81#include "deprecat.h"
8182#include "includes/trs80.h"
8283
8384/* Components */
r1877r1878
9596{
9697   if (readinputport(0) & 0x80)
9798   {
98      return wd17xx_status_r(offset);
99      return wd17xx_status_r(machine, offset);
99100   }
100101   else
101102   {
r1877r1878
317318   MDRV_CPU_ADD_TAG("main", Z80, 1796000)        /* 1.796 Mhz */
318319   MDRV_CPU_PROGRAM_MAP(mem_level1, 0)
319320   MDRV_CPU_IO_MAP(io_level1, 0)
320   MDRV_CPU_VBLANK_INT(trs80_frame_interrupt, 1)
321   MDRV_CPU_VBLANK_INT("main", trs80_frame_interrupt)
321322   MDRV_CPU_PERIODIC_INT(trs80_timer_interrupt, 40)
322323   MDRV_INTERLEAVE(1)
323324
r1877r1878
358359   MDRV_CPU_MODIFY( "main" )
359360   MDRV_CPU_PROGRAM_MAP( mem_model3, 0 )
360361   MDRV_CPU_IO_MAP( io_model3, 0 )
361   MDRV_CPU_VBLANK_INT(trs80_frame_interrupt, 2)
362   MDRV_CPU_VBLANK_INT_HACK(trs80_frame_interrupt, 2)
362363MACHINE_DRIVER_END
363364
364365/***************************************************************************
src/mess/drivers/apple2.c
r1877r1878
183183***************************************************************************/
184184
185185#include "driver.h"
186#include "deprecat.h"
186187#include "includes/apple2.h"
187188#include "machine/ay3600.h"
188189#include "devices/appldriv.h"
r1877r1878
541542   /* basic machine hardware */
542543   MDRV_CPU_ADD_TAG("main", M6502, 1021800)      /* close to actual CPU frequency of 1.020484 MHz */
543544   MDRV_CPU_PROGRAM_MAP(apple2_map, 0)
544   MDRV_CPU_VBLANK_INT(apple2_interrupt, 192/8)
545   MDRV_CPU_VBLANK_INT_HACK(apple2_interrupt, 192/8)
545546   MDRV_INTERLEAVE(1)
546547
547548   MDRV_MACHINE_START( apple2 )
src/mess/drivers/primo.c
r1877r1878
227227   MDRV_CPU_ADD_TAG( "main", Z80, 2500000 )
228228   MDRV_CPU_PROGRAM_MAP( primo32_mem, 0 )
229229   MDRV_CPU_IO_MAP( primoa_port, 0 )
230   MDRV_CPU_VBLANK_INT( primo_vblank_interrupt, 1 )
230   MDRV_CPU_VBLANK_INT("main", primo_vblank_interrupt)
231231
232232   MDRV_MACHINE_RESET( primoa )
233233
src/mess/drivers/svision.c
r1877r1878
166166         svision_soundport_w(svision_channel + 1, offset & 3, data);
167167         break;
168168      case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c:
169         svision_sounddma_w(offset - 0x18, data);
169         svision_sounddma_w(machine, offset - 0x18, data);
170170         break;
171171      case 0x28: case 0x29: case 0x2a:
172         svision_noise_w(offset - 0x28, data);
172         svision_noise_w(machine, offset - 0x28, data);
173173         break;
174174      default:
175175         logerror("%.6f svision write %04x %02x\n", attotime_to_double(timer_get_time()), offset, data);
r1877r1878
185185         if (offset >= 0x800 && offset < 0x840)
186186         {
187187            /* strange effects when modifying palette */
188            return svision_r(offset);
188            return svision_r(machine, offset);
189189         }
190190         else
191191         {
192            return svision_r(offset);
192            return svision_r(machine, offset);
193193         }
194194   }
195195}
r1877r1878
219219         }
220220         break;
221221      default:
222         svision_w(offset,data);
222         svision_w(machine, offset,data);
223223         if (offset >= 0x800 && offset < 0x840)
224224         {
225225            UINT16 c;
r1877r1878
480480   /* basic machine hardware */
481481    MDRV_CPU_ADD_TAG("main", M65C02, 4000000)        /* ? stz used! speed? */
482482   MDRV_CPU_PROGRAM_MAP(svision_mem, 0)
483   MDRV_CPU_VBLANK_INT(svision_frame_int, 1)
483   MDRV_CPU_VBLANK_INT("main", svision_frame_int)
484484
485485   MDRV_MACHINE_RESET( svision )
486486
src/mess/drivers/c64.c
r1877r1878
706706   /* basic machine hardware */
707707   MDRV_CPU_ADD_TAG("main", M6510, VIC6567_CLOCK)
708708   MDRV_CPU_PROGRAM_MAP(c64_mem, 0)
709   MDRV_CPU_VBLANK_INT(c64_frame_interrupt, 1)
709   MDRV_CPU_VBLANK_INT("main", c64_frame_interrupt)
710710   MDRV_CPU_PERIODIC_INT(vic2_raster_irq, VIC2_HRETRACERATE)
711711   MDRV_INTERLEAVE(1)
712712
src/mess/drivers/svi318.c
r1877r1878
7272   AM_RANGE( 0x33, 0x33) AM_READWRITE( wd17xx_data_r, wd17xx_data_w )
7373   AM_RANGE( 0x34, 0x34) AM_READWRITE( svi318_fdc_irqdrq_r, svi318_fdc_drive_motor_w )
7474   AM_RANGE( 0x38, 0x38) AM_WRITE( svi318_fdc_density_side_w )
75   AM_RANGE( 0x50, 0x51) AM_READWRITE( svi806_r, svi806_w )
75   AM_RANGE( 0x50, 0x50) AM_DEVREADWRITE( MC6845, "crtc", mc6845_register_r, mc6845_address_w )
76   AM_RANGE( 0x51, 0x51) AM_DEVREADWRITE( MC6845, "crtc", mc6845_register_r, mc6845_register_w )
7677   AM_RANGE( 0x58, 0x58) AM_WRITE( svi806_ram_enable_w )
7778   AM_RANGE( 0x80, 0x80) AM_WRITE( TMS9928A_vram_w )
7879   AM_RANGE( 0x81, 0x81) AM_WRITE( TMS9928A_register_w )
r1877r1878
320321   MDRV_CPU_ADD_TAG( "main", Z80, 3579545 )   /* 3.579545 Mhz */
321322   MDRV_CPU_PROGRAM_MAP( svi318_mem, 0 )
322323   MDRV_CPU_IO_MAP( svi318_io, 0 )
323   MDRV_CPU_VBLANK_INT( svi318_interrupt, 1 )
324   MDRV_CPU_VBLANK_INT("main", svi318_interrupt)
324325   MDRV_INTERLEAVE(1)
325326
326327   MDRV_MACHINE_START( svi318_pal )
r1877r1878
370371   MDRV_CPU_ADD_TAG( "main", Z80, 3579545 )   /* 3.579545 Mhz */
371372   MDRV_CPU_PROGRAM_MAP( svi328_806_mem, 0 )
372373   MDRV_CPU_IO_MAP( svi318_io2, 0 )
373   MDRV_CPU_VBLANK_INT( svi318_interrupt, 1 )
374   MDRV_CPU_VBLANK_INT("main", svi318_interrupt)
374375   MDRV_INTERLEAVE(1)
375376
376377   MDRV_MACHINE_START( svi318_pal )
src/mess/drivers/ti99_4p.c
r1877r1878
2727*/
2828
2929#include "driver.h"
30#include "deprecat.h"
3031#include "video/v9938.h"
3132
3233#include "machine/ti99_4x.h"
r1877r1878
244245   MDRV_CPU_ADD(TMS9900, 3000000)
245246   MDRV_CPU_PROGRAM_MAP(memmap, 0)
246247   MDRV_CPU_IO_MAP(readcru, writecru)
247   MDRV_CPU_VBLANK_INT(ti99_4ev_hblank_interrupt, 263)   /* 262.5 in 60Hz, 312.5 in 50Hz */
248   MDRV_CPU_VBLANK_INT_HACK(ti99_4ev_hblank_interrupt, 263)   /* 262.5 in 60Hz, 312.5 in 50Hz */
248249
249250   MDRV_MACHINE_RESET( ti99 )
250251
src/mess/drivers/pc.c
r1877r1878
1919
2020
2121#include "driver.h"
22#include "deprecat.h"
2223#include "memconv.h"
2324
2425#include "machine/8255ppi.h"
r1877r1878
9091static READ8_HANDLER( pc_YM3812_0_r )
9192{
9293   if ((offset % 1) == 0)
93      return YM3812_status_port_0_r(0);
94      return YM3812_status_port_0_r(machine, 0);
9495   else
9596      return 0x00;
9697}
r1877r1878
9899static WRITE8_HANDLER( pc_YM3812_0_w )
99100{
100101   if ((offset % 1) == 0)
101      YM3812_control_port_0_w(0, data);
102      YM3812_control_port_0_w(machine, 0, data);
102103   else
103      YM3812_write_port_0_w(0, data);
104      YM3812_write_port_0_w(machine, 0, data);
104105}
105106
106static READ16_HANDLER( pc16le_YM3812_0_r ) { return read16le_with_read8_handler(pc_YM3812_0_r, offset, mem_mask); }
107static WRITE16_HANDLER( pc16le_YM3812_0_w ) { write16le_with_write8_handler(pc_YM3812_0_w, offset, data, mem_mask); }
107static READ16_HANDLER( pc16le_YM3812_0_r ) { return read16le_with_read8_handler(pc_YM3812_0_r, machine, offset, mem_mask); }
108static WRITE16_HANDLER( pc16le_YM3812_0_w ) { write16le_with_write8_handler(pc_YM3812_0_w, machine, offset, data, mem_mask); }
108109
109110#ifdef UNUSED_FUNCTION
110static WRITE16_HANDLER( pc16le_SN76496_0_w ) { write16le_with_write8_handler(SN76496_0_w, offset, data, mem_mask); }
111static WRITE16_HANDLER( pc16le_SN76496_0_w ) { write16le_with_write8_handler(SN76496_0_w, machine, offset, data, mem_mask); }
111112#endif
112113
113114// IO Expansion, only a little bit for ibm bios self tests
r1877r1878
11481149   MDRV_CPU_ADD_TAG("main", type, clock)            \
11491150   MDRV_CPU_PROGRAM_MAP(mem##_map, 0)         \
11501151   MDRV_CPU_IO_MAP(port##_io, 0)            \
1151   MDRV_CPU_VBLANK_INT(vblankfunc, 4)               \
1152   MDRV_CPU_VBLANK_INT_HACK(vblankfunc, 4)               \
11521153   MDRV_CPU_CONFIG(i86_address_mask)
11531154
11541155
r1877r1878
11571158   MDRV_CPU_ADD_TAG("main", V20, 4772720)
11581159   MDRV_CPU_PROGRAM_MAP(pc8_map, 0)
11591160   MDRV_CPU_IO_MAP(pc8_io, 0)
1160   MDRV_CPU_VBLANK_INT(pc_mda_frame_interrupt, 4)
1161   MDRV_CPU_VBLANK_INT_HACK(pc_mda_frame_interrupt, 4)
11611162
11621163   MDRV_MACHINE_RESET(pc_mda)
11631164
src/mess/drivers/pce.c
r1877r1878
5252**********************************************************************/
5353
5454#include "driver.h"
55#include "deprecat.h"
5556#include "video/vdc.h"
5657#include "cpu/h6280/h6280.h"
5758#include "includes/pce.h"
r1877r1878
143144   MDRV_CPU_ADD(H6280, MAIN_CLOCK/3)
144145   MDRV_CPU_PROGRAM_MAP(pce_mem, 0)
145146   MDRV_CPU_IO_MAP(pce_io, 0)
146   MDRV_CPU_VBLANK_INT(pce_interrupt, VDC_LPF)
147   MDRV_CPU_VBLANK_INT_HACK(pce_interrupt, VDC_LPF)
147148   MDRV_INTERLEAVE(1)
148149
149150   MDRV_MACHINE_RESET( pce )
r1877r1878
182183   MDRV_CPU_ADD(H6280, MAIN_CLOCK/3)
183184   MDRV_CPU_PROGRAM_MAP(sgx_mem, 0)
184185   MDRV_CPU_IO_MAP(sgx_io, 0)
185   MDRV_CPU_VBLANK_INT(sgx_interrupt, VDC_LPF)
186   MDRV_CPU_VBLANK_INT_HACK(sgx_interrupt, VDC_LPF)
186187   MDRV_INTERLEAVE(1)
187188
188189   MDRV_MACHINE_RESET( pce )
src/mess/drivers/ti99_4x.c
r1877r1878
1919*/
2020
2121#include "driver.h"
22#include "deprecat.h"
2223#include "video/v9938.h"
2324#include "machine/ti99_4x.h"
2425#include "machine/tms9901.h"
r1877r1878
505506   MDRV_CPU_ADD(TMS9900, 3000000)
506507   MDRV_CPU_PROGRAM_MAP(memmap, 0)
507508   MDRV_CPU_IO_MAP(readcru, writecru)
508   MDRV_CPU_VBLANK_INT(ti99_vblank_interrupt, 1)
509   MDRV_CPU_VBLANK_INT("main", ti99_vblank_interrupt)
509510
510511   MDRV_MACHINE_START( ti99_4_60hz )
511512   MDRV_MACHINE_RESET( ti99 )
r1877r1878
535536   MDRV_CPU_ADD(TMS9900, 3000000)
536537   MDRV_CPU_PROGRAM_MAP(memmap, 0)
537538   MDRV_CPU_IO_MAP(readcru, writecru)
538   MDRV_CPU_VBLANK_INT(ti99_vblank_interrupt, 1)
539   MDRV_CPU_VBLANK_INT("main", ti99_vblank_interrupt)
539540
540541   MDRV_MACHINE_START( ti99_4_50hz )
541542   MDRV_MACHINE_RESET( ti99 )
r1877r1878
564565   MDRV_CPU_ADD(TMS9900, 3000000)
565566   MDRV_CPU_PROGRAM_MAP(memmap, 0)
566567   MDRV_CPU_IO_MAP(readcru, writecru)
567   MDRV_CPU_VBLANK_INT(ti99_vblank_interrupt, 1)
568   MDRV_CPU_VBLANK_INT("main", ti99_vblank_interrupt)
568569
569570   MDRV_MACHINE_START( ti99_4a_60hz )
570571   MDRV_MACHINE_RESET( ti99 )
r1877r1878
593594   MDRV_CPU_ADD(TMS9900, 3000000)
594595   MDRV_CPU_PROGRAM_MAP(memmap, 0)
595596   MDRV_CPU_IO_MAP(readcru, writecru)
596   MDRV_CPU_VBLANK_INT(ti99_vblank_interrupt, 1)
597   MDRV_CPU_VBLANK_INT("main", ti99_vblank_interrupt)
597598
598599   MDRV_MACHINE_START( ti99_4a_50hz )
599600   MDRV_MACHINE_RESET( ti99 )
r1877r1878
622623   MDRV_CPU_ADD(TMS9900, 3000000)
623624   MDRV_CPU_PROGRAM_MAP(memmap_4ev, 0)
624625   MDRV_CPU_IO_MAP(readcru, writecru)
625   MDRV_CPU_VBLANK_INT(ti99_4ev_hblank_interrupt, 263)   /* 262.5 in 60Hz, 312.5 in 50Hz */
626   MDRV_CPU_VBLANK_INT_HACK(ti99_4ev_hblank_interrupt, 263)   /* 262.5 in 60Hz, 312.5 in 50Hz */
626627
627628   MDRV_MACHINE_START( ti99_4ev_60hz )
628629   MDRV_MACHINE_RESET( ti99 )
src/mess/drivers/ip20.c
r1877r1878
1717\*********************************************************************/
1818
1919#include "driver.h"
20#include "deprecat.h"
2021#include "cpu/mips/mips3.h"
2122#include "machine/8530scc.h"
2223#include "machine/sgi.h"
r1877r1878
132133   case 0x0120:
133134      if (!(mem_mask & 0x0000ff00))
134135      {
135         return ( wd33c93_r( 0 ) << 8 );
136         return ( wd33c93_r( machine, 0 ) << 8 );
136137      }
137138      else
138139      {
r1877r1878
142143   case 0x0124:
143144      if (!(mem_mask & 0x0000ff00))
144145      {
145         return ( wd33c93_r( 1 ) << 8 );
146         return ( wd33c93_r( machine, 1 ) << 8 );
146147      }
147148      else
148149      {
r1877r1878
176177   case 0x0d00:
177178      verboselog( 2, "HPC DUART0 Channel B Control Read\n" );
178179//      return 0x00000004;
179      return 0x7c; //scc_r(0);
180      return 0x7c; //scc_r(machine, 0);
180181      break;
181182   case 0x0d04:
182183      verboselog( 2, "HPC DUART0 Channel B Data Read\n" );
183184//      return 0;
184      return scc_r(2);
185      return scc_r(machine, 2);
185186      break;
186187   case 0x0d08:
187188      verboselog( 2, "HPC DUART0 Channel A Control Read (%08x)\n", mem_mask    );
188189//      return 0x40;
189      return 0x7c; //scc_r(1);
190      return 0x7c; //scc_r(machine, 1);
190191      break;
191192   case 0x0d0c:
192193      verboselog( 2, "HPC DUART0 Channel A Data Read\n" );
193194//      return 0;
194      return scc_r(3);
195      return scc_r(machine, 3);
195196      break;
196197   case 0x0d10:
197198//      verboselog( 2, "HPC DUART1 Channel B Control Read\n" );
r1877r1878
308309      if (!(mem_mask & 0x0000ff00))
309310      {
310311         verboselog( 2, "HPC SCSI Controller Register Write: %08x\n", ( data >> 8 ) & 0x000000ff );
311         wd33c93_w( 0, ( data >> 8 ) & 0x000000ff );
312         wd33c93_w( machine, 0, ( data >> 8 ) & 0x000000ff );
312313      }
313314      else
314315      {
r1877r1878
319320      if (!(mem_mask & 0x0000ff00))
320321      {
321322         verboselog( 2, "HPC SCSI Controller Data Write: %08x\n", ( data >> 8 ) & 0x000000ff );
322         wd33c93_w( 1, ( data >> 8 ) & 0x000000ff );
323         wd33c93_w( machine, 1, ( data >> 8 ) & 0x000000ff );
323324      }
324325      else
325326      {
r1877r1878
382383      break;
383384   case 0x0d00:
384385      verboselog( 2, "HPC DUART0 Channel B Control Write: %08x (%08x)\n", data, mem_mask );
385      scc_w(0, data);
386      scc_w(machine, 0, data);
386387      break;
387388   case 0x0d04:
388389      verboselog( 2, "HPC DUART0 Channel B Data Write: %08x (%08x)\n", data, mem_mask );
389      scc_w(2, data);
390      scc_w(machine, 2, data);
390391      break;
391392   case 0x0d08:
392393      verboselog( 2, "HPC DUART0 Channel A Control Write: %08x (%08x)\n", data, mem_mask );
393      scc_w(1, data);
394      scc_w(machine, 1, data);
394395      break;
395396   case 0x0d0c:
396397      verboselog( 2, "HPC DUART0 Channel A Data Write: %08x (%08x)\n", data, mem_mask );
397      scc_w(3, data);
398      scc_w(machine, 3, data);
398399      break;
399400   case 0x0d10:
400401      if( ( data & 0x000000ff ) >= 0x00000020 )
r1877r1878
613614   MDRV_CPU_ADD_TAG( "main", R4600BE, 50000000*3 )
614615   MDRV_CPU_CONFIG( config )
615616   MDRV_CPU_PROGRAM_MAP( ip204415_map, 0 )
616   MDRV_CPU_VBLANK_INT( ip20_update_chips, 10000 )
617   MDRV_CPU_VBLANK_INT_HACK(ip20_update_chips, 10000)
617618
618
619619   MDRV_MACHINE_RESET( ip204415 )
620620   MDRV_NVRAM_HANDLER(93C56)
621621
src/mess/drivers/galaxy.c
r1877r1878
122122   MDRV_CPU_ADD(Z80, 3072000)
123123   MDRV_CPU_PROGRAM_MAP(galaxy_mem, 0)
124124   MDRV_CPU_IO_MAP(galaxy_readport, galaxy_writeport)
125   MDRV_CPU_VBLANK_INT(galaxy_interrupt, 1)
125   MDRV_CPU_VBLANK_INT("main", galaxy_interrupt)
126126   MDRV_SCREEN_ADD("main", RASTER)
127127   MDRV_SCREEN_REFRESH_RATE(50)
128128   MDRV_SCREEN_VBLANK_TIME(0)
src/mess/drivers/bbc.c
r1877r1878
700700
701701static INTERRUPT_GEN( bbcb_vsync )
702702{
703   via_0_ca1_w(0,1);
704   via_0_ca1_w(0,0);
703   via_0_ca1_w(machine, 0,1);
704   via_0_ca1_w(machine, 0,0);
705705   bbc_frameclock();
706706}
707707
r1877r1878
718718   /* basic machine hardware */
719719   MDRV_CPU_ADD_TAG("main", M6502, 2000000)        /* 2.00Mhz */
720720   MDRV_CPU_PROGRAM_MAP( bbca_mem, 0 )
721   MDRV_CPU_VBLANK_INT(bbcb_vsync, 1)            /* screen refresh interrupts */
721   MDRV_CPU_VBLANK_INT("main", bbcb_vsync)            /* screen refresh interrupts */
722722   MDRV_CPU_PERIODIC_INT(bbcb_keyscan, 1000)      /* scan keyboard */
723723   MDRV_SCREEN_ADD("main", RASTER)
724724   MDRV_SCREEN_REFRESH_RATE(50)
r1877r1878
781781   /* basic machine hardware */
782782   MDRV_CPU_ADD_TAG("main", M65SC02, 2000000)        /* 2.00Mhz */
783783   MDRV_CPU_PROGRAM_MAP( bbcm_mem, 0 )
784   MDRV_CPU_VBLANK_INT(bbcb_vsync, 1)            /* screen refresh interrupts */
784   MDRV_CPU_VBLANK_INT("main", bbcb_vsync)            /* screen refresh interrupts */
785785   MDRV_CPU_PERIODIC_INT(bbcm_keyscan, 1000)      /* scan keyboard */
786786   MDRV_INTERLEAVE(1)
787787
src/mess/drivers/compis.c
r1877r1878
206206   MDRV_CPU_ADD_TAG("main", I80186, 8000000)   /* 8 MHz */
207207   MDRV_CPU_PROGRAM_MAP(compis_mem, 0)
208208   MDRV_CPU_IO_MAP(compis_io, 0)
209   MDRV_CPU_VBLANK_INT(compis_vblank_int, 1)
209   MDRV_CPU_VBLANK_INT("main", compis_vblank_int)
210210   MDRV_CPU_CONFIG(i86_address_mask)
211211
212212   MDRV_INTERLEAVE(1)
src/mess/drivers/bbcbc.c
r1877r1878
7575   MDRV_MACHINE_START( bbcbc )
7676   MDRV_MACHINE_RESET( bbcbc )
7777
78   MDRV_CPU_VBLANK_INT( bbcbc_interrupt, 1 )
78   MDRV_CPU_VBLANK_INT("main", bbcbc_interrupt)
7979   MDRV_IMPORT_FROM( tms9928a )
8080   MDRV_SCREEN_MODIFY("main")
8181   MDRV_SCREEN_REFRESH_RATE( 50 )
src/mess/drivers/vtech2.c
r1877r1878
447447   MDRV_CPU_ADD_TAG("main", Z80, 3694700)        /* 3.694700 Mhz */
448448   MDRV_CPU_PROGRAM_MAP(vtech2_mem, 0)
449449   MDRV_CPU_IO_MAP(vtech2_io, 0)
450   MDRV_CPU_VBLANK_INT(vtech2_interrupt, 1)
450   MDRV_CPU_VBLANK_INT("main", vtech2_interrupt)
451451   MDRV_SCREEN_ADD("main", RASTER)
452452   MDRV_SCREEN_REFRESH_RATE(50)
453453   MDRV_SCREEN_VBLANK_TIME(0)
src/mess/drivers/kc.c
r1877r1878
4646   switch (port)
4747   {
4848//      case 0x080:
49//          return kc85_module_r(offset);
49//          return kc85_module_r(machine, offset);
5050
5151      case 0x085:
5252      case 0x084:
53         return kc85_4_84_r(offset);
53         return kc85_4_84_r(machine, offset);
5454
5555
5656      case 0x086:
5757      case 0x087:
58         return kc85_4_86_r(offset);
58         return kc85_4_86_r(machine, offset);
5959
6060      case 0x088:
6161      case 0x089:
62         return kc85_pio_data_r(port-0x088);
62         return kc85_pio_data_r(machine, port-0x088);
6363      case 0x08a:
6464      case 0x08b:
65         return kc85_pio_control_r(port-0x08a);
65         return kc85_pio_control_r(machine, port-0x08a);
6666      case 0x08c:
6767      case 0x08d:
6868      case 0x08e:
6969      case 0x08f:
70         return kc85_ctc_r(port-0x08c);
70         return kc85_ctc_r(machine, port-0x08c);
7171
7272   }
7373
r1877r1878
8484   switch (port)
8585   {
8686//      case 0x080:
87//          kc85_module_w(offset,data);
87//          kc85_module_w(machine, offset,data);
8888//          return;
8989
9090      case 0x085:
9191      case 0x084:
92         kc85_4_84_w(offset,data);
92         kc85_4_84_w(machine, offset,data);
9393         return;
9494
9595      case 0x086:
9696      case 0x087:
97         kc85_4_86_w(offset,data);
97         kc85_4_86_w(machine, offset,data);
9898         return;
9999
100100      case 0x088:
101101      case 0x089:
102         kc85_4_pio_data_w(port-0x088, data);
102         kc85_4_pio_data_w(machine, port-0x088, data);
103103         return;
104104
105105      case 0x08a:
106106      case 0x08b:
107         kc85_pio_control_w(port-0x08a, data);
107         kc85_pio_control_w(machine, port-0x08a, data);
108108         return;
109109
110110      case 0x08c:
111111      case 0x08d:
112112      case 0x08e:
113113      case 0x08f:
114         kc85_ctc_w(port-0x08c, data);
114         kc85_ctc_w(machine, port-0x08c, data);
115115         return;
116116   }
117117
r1877r1878
135135   switch (port)
136136   {
137137      case 0x080:
138         return kc85_module_r(offset);
138         return kc85_module_r(machine, offset);
139139
140140      case 0x085:
141141      case 0x084:
142         return kc85_4_84_r(offset);
142         return kc85_4_84_r(machine, offset);
143143
144144
145145      case 0x086:
146146      case 0x087:
147         return kc85_4_86_r(offset);
147         return kc85_4_86_r(machine, offset);
148148
149149      case 0x088:
150150      case 0x089:
151         return kc85_pio_data_r(port-0x088);
151         return kc85_pio_data_r(machine, port-0x088);
152152      case 0x08a:
153153      case 0x08b:
154         return kc85_pio_control_r(port-0x08a);
154         return kc85_pio_control_r(machine, port-0x08a);
155155      case 0x08c:
156156      case 0x08d:
157157      case 0x08e:
158158      case 0x08f:
159         return kc85_ctc_r(port-0x08c);
159         return kc85_ctc_r(machine, port-0x08c);
160160      case 0x0f0:
161161      case 0x0f1:
162162      case 0x0f2:
163163      case 0x0f3:
164         return kc85_disc_interface_ram_r(offset);
164         return kc85_disc_interface_ram_r(machine, offset);
165165
166166   }
167167
r1877r1878
255255
256256      case 0x088:
257257      case 0x089:
258         return kc85_pio_data_r(port-0x088);
258         return kc85_pio_data_r(machine, port-0x088);
259259      case 0x08a:
260260      case 0x08b:
261         return kc85_pio_control_r(port-0x08a);
261         return kc85_pio_control_r(machine, port-0x08a);
262262      case 0x08c:
263263      case 0x08d:
264264      case 0x08e:
265265      case 0x08f:
266         return kc85_ctc_r(port-0x08c);
266         return kc85_ctc_r(machine, port-0x08c);
267267   }
268268
269269   logerror("unhandled port r: %04x\n",offset);
r1877r1878
284284
285285      case 0x088:
286286      case 0x089:
287         kc85_3_pio_data_w(port-0x088, data);
287         kc85_3_pio_data_w(machine, port-0x088, data);
288288         return;
289289
290290      case 0x08a:
291291      case 0x08b:
292         kc85_pio_control_w(port-0x08a, data);
292         kc85_pio_control_w(machine, port-0x08a, data);
293293         return;
294294
295295      case 0x08c:
296296      case 0x08d:
297297      case 0x08e:
298298      case 0x08f:
299         kc85_ctc_w(port-0x08c, data);
299         kc85_ctc_w(machine, port-0x08c, data);
300300         return;
301301   }
302302
docs/messnew.txt
r1877r1878
5151
5252Source Changes:
5353----------------
54- The core is based on MAME 0.123u3.  This incorporates all features of the
54- The core is based on MAME 0.123u4.  This incorporates all features of the
5555  update to this core.  [MAME team]
5656
5757- Updated the Motorola MC68901 Multi Function Peripheral to use the new

Previous 15994 Revisions Next


© 1998-2018 The MESS Team